{"edges":[{"edgeType":"imports","source":10367,"target":3016},{"edgeType":"contains","source":554,"target":1655},{"edgeType":"contains","source":4510,"target":4808},{"edgeType":"calls","source":3068,"target":454},{"edgeType":"contains","source":2533,"target":2672},{"edgeType":"contains","source":9276,"target":9277},{"edgeType":"contains","source":8147,"target":8336},{"edgeType":"contains","source":11984,"target":12007},{"edgeType":"contains","source":5939,"target":5962},{"edgeType":"contains","source":13636,"target":13647},{"edgeType":"contains","source":9044,"target":9069},{"edgeType":"imports","source":9207,"target":6207},{"edgeType":"contains","source":918,"target":941},{"edgeType":"calls","source":1337,"target":1262},{"edgeType":"contains","source":10301,"target":11328},{"edgeType":"calls","source":6058,"target":6069},{"edgeType":"contains","source":1347,"target":1385},{"edgeType":"calls","source":2754,"target":2789},{"edgeType":"contains","source":2533,"target":2673},{"edgeType":"calls","source":6852,"target":6826},{"edgeType":"imports","source":12255,"target":12140},{"edgeType":"contains","source":7488,"target":7625},{"edgeType":"contains","source":8147,"target":8335},{"edgeType":"contains","source":11984,"target":12006},{"edgeType":"contains","source":1,"target":3998},{"edgeType":"calls","source":7569,"target":454},{"edgeType":"imports","source":2350,"target":1022},{"edgeType":"contains","source":9044,"target":9068},{"edgeType":"contains","source":4257,"target":4194},{"edgeType":"contains","source":11082,"target":12486},{"edgeType":"contains","source":8765,"target":9261},{"edgeType":"contains","source":5939,"target":5964},{"edgeType":"calls","source":10739,"target":491},{"edgeType":"calls","source":5122,"target":4429},{"edgeType":"contains","source":5409,"target":5477},{"edgeType":"contains","source":9276,"target":9279},{"edgeType":"calls","source":2209,"target":655},{"edgeType":"contains","source":554,"target":1657},{"edgeType":"calls","source":13854,"target":13855},{"edgeType":"calls","source":1769,"target":557},{"edgeType":"contains","source":7425,"target":7465},{"edgeType":"contains","source":4185,"target":4310},{"edgeType":"imports","source":2350,"target":1021},{"edgeType":"calls","source":3350,"target":3337},{"edgeType":"contains","source":4944,"target":5093},{"edgeType":"contains","source":9044,"target":9071},{"edgeType":"contains","source":9041,"target":9164},{"edgeType":"contains","source":4320,"target":4354},{"edgeType":"contains","source":11082,"target":12483},{"edgeType":"calls","source":12399,"target":2936},{"edgeType":"calls","source":1928,"target":1970},{"edgeType":"calls","source":1143,"target":936},{"edgeType":"contains","source":8185,"target":8218},{"edgeType":"contains","source":10629,"target":10671},{"edgeType":"contains","source":10598,"target":10575},{"edgeType":"contains","source":918,"target":943},{"edgeType":"imports","source":7001,"target":602},{"edgeType":"imports","source":11000,"target":10874},{"edgeType":"contains","source":5939,"target":5965},{"edgeType":"contains","source":4585,"target":4594},{"edgeType":"contains","source":9276,"target":9278},{"edgeType":"contains","source":2533,"target":2671},{"edgeType":"contains","source":4453,"target":4458},{"edgeType":"calls","source":1336,"target":1295},{"edgeType":"imports","source":6203,"target":6312},{"edgeType":"contains","source":13636,"target":13644},{"edgeType":"calls","source":11314,"target":10146},{"edgeType":"contains","source":4185,"target":4309},{"edgeType":"contains","source":4320,"target":4353},{"edgeType":"contains","source":4981,"target":5002},{"edgeType":"contains","source":9044,"target":9070},{"edgeType":"contains","source":10301,"target":11327},{"edgeType":"calls","source":8801,"target":8773},{"edgeType":"calls","source":11120,"target":1362},{"edgeType":"calls","source":4891,"target":4190},{"edgeType":"imports","source":12259,"target":12019},{"edgeType":"calls","source":707,"target":710},{"edgeType":"calls","source":4857,"target":4187},{"edgeType":"contains","source":9178,"target":9144},{"edgeType":"contains","source":13008,"target":13028},{"edgeType":"contains","source":3402,"target":3214},{"edgeType":"imports","source":1434,"target":876},{"edgeType":"calls","source":2794,"target":491},{"edgeType":"calls","source":8309,"target":8170},{"edgeType":"contains","source":1116,"target":1146},{"edgeType":"contains","source":4510,"target":4812},{"edgeType":"contains","source":7426,"target":7428},{"edgeType":"contains","source":13569,"target":13606},{"edgeType":"calls","source":5122,"target":4427},{"edgeType":"contains","source":12246,"target":12337},{"edgeType":"contains","source":2533,"target":2676},{"edgeType":"contains","source":13636,"target":13643},{"edgeType":"contains","source":11732,"target":1845},{"edgeType":"contains","source":5213,"target":5217},{"edgeType":"contains","source":11456,"target":11458},{"edgeType":"calls","source":127,"target":715},{"edgeType":"contains","source":2006,"target":2100},{"edgeType":"calls","source":7376,"target":7498},{"edgeType":"contains","source":11786,"target":11798},{"edgeType":"contains","source":3427,"target":3503},{"edgeType":"calls","source":12632,"target":12633},{"edgeType":"contains","source":10663,"target":10672},{"edgeType":"calls","source":12265,"target":11324},{"edgeType":"calls","source":4516,"target":4187},{"edgeType":"contains","source":6898,"target":6883},{"edgeType":"calls","source":12331,"target":2936},{"edgeType":"calls","source":9692,"target":9694},{"edgeType":"contains","source":13636,"target":13642},{"edgeType":"contains","source":1,"target":11402},{"edgeType":"contains","source":1,"target":13516},{"edgeType":"calls","source":3846,"target":3816},{"edgeType":"contains","source":5883,"target":6638},{"edgeType":"contains","source":2006,"target":2101},{"edgeType":"contains","source":1882,"target":660},{"edgeType":"contains","source":5939,"target":5959},{"edgeType":"contains","source":3726,"target":3746},{"edgeType":"calls","source":2049,"target":1383},{"edgeType":"calls","source":1372,"target":1229},{"edgeType":"contains","source":11082,"target":12482},{"edgeType":"contains","source":2006,"target":2102},{"edgeType":"contains","source":2005,"target":2133},{"edgeType":"calls","source":510,"target":469},{"edgeType":"contains","source":12519,"target":12330},{"edgeType":"contains","source":10630,"target":10639},{"edgeType":"contains","source":554,"target":1658},{"edgeType":"contains","source":10663,"target":10673},{"edgeType":"contains","source":9044,"target":9064},{"edgeType":"imports","source":10514,"target":10090},{"edgeType":"calls","source":11807,"target":11782},{"edgeType":"contains","source":918,"target":944},{"edgeType":"imports","source":7001,"target":603},{"edgeType":"contains","source":1882,"target":657},{"edgeType":"contains","source":5213,"target":5215},{"edgeType":"contains","source":13636,"target":13641},{"edgeType":"contains","source":9342,"target":9343},{"edgeType":"contains","source":3726,"target":3745},{"edgeType":"calls","source":7167,"target":1294},{"edgeType":"contains","source":8147,"target":8334},{"edgeType":"contains","source":5939,"target":5960},{"edgeType":"contains","source":4223,"target":4194},{"edgeType":"contains","source":4131,"target":4932},{"edgeType":"imports","source":9207,"target":6209},{"edgeType":"calls","source":476,"target":469},{"edgeType":"contains","source":10461,"target":10590},{"edgeType":"contains","source":10663,"target":10670},{"edgeType":"contains","source":10630,"target":10636},{"edgeType":"calls","source":4584,"target":4191},{"edgeType":"calls","source":839,"target":843},{"edgeType":"contains","source":4944,"target":5097},{"edgeType":"contains","source":9044,"target":9067},{"edgeType":"contains","source":11082,"target":12479},{"edgeType":"calls","source":5794,"target":5790},{"edgeType":"calls","source":1665,"target":1662},{"edgeType":"contains","source":2533,"target":2675},{"edgeType":"calls","source":3090,"target":2938},{"edgeType":"contains","source":4639,"target":5038},{"edgeType":"contains","source":4510,"target":4809},{"edgeType":"contains","source":11422,"target":11454},{"edgeType":"contains","source":7488,"target":7623},{"edgeType":"contains","source":7425,"target":7462},{"edgeType":"calls","source":7195,"target":2541},{"edgeType":"calls","source":12963,"target":12939},{"edgeType":"contains","source":2006,"target":2099},{"edgeType":"contains","source":10301,"target":11322},{"edgeType":"contains","source":12519,"target":12328},{"edgeType":"contains","source":3495,"target":3506},{"edgeType":"contains","source":10630,"target":10637},{"edgeType":"calls","source":6501,"target":6086},{"edgeType":"contains","source":918,"target":946},{"edgeType":"calls","source":4619,"target":4162},{"edgeType":"contains","source":4743,"target":4985},{"edgeType":"contains","source":11082,"target":12480},{"edgeType":"calls","source":5022,"target":4353},{"edgeType":"contains","source":9044,"target":9066},{"edgeType":"calls","source":12094,"target":11339},{"edgeType":"contains","source":9852,"target":10456},{"edgeType":"contains","source":952,"target":953},{"edgeType":"calls","source":1699,"target":1660},{"edgeType":"contains","source":4944,"target":5104},{"edgeType":"imports","source":13843,"target":11527},{"edgeType":"contains","source":11489,"target":11504},{"edgeType":"contains","source":9144,"target":9149},{"edgeType":"contains","source":9342,"target":9353},{"edgeType":"contains","source":8147,"target":8345},{"edgeType":"contains","source":2768,"target":2794},{"edgeType":"contains","source":8765,"target":9270},{"edgeType":"contains","source":11983,"target":2532},{"edgeType":"contains","source":4944,"target":5103},{"edgeType":"contains","source":5939,"target":5971},{"edgeType":"calls","source":1558,"target":745},{"edgeType":"contains","source":8197,"target":2567},{"edgeType":"contains","source":4510,"target":4816},{"edgeType":"contains","source":4320,"target":4364},{"edgeType":"contains","source":11984,"target":12016},{"edgeType":"contains","source":12018,"target":12019},{"edgeType":"calls","source":3075,"target":2343},{"edgeType":"contains","source":12051,"target":12053},{"edgeType":"contains","source":10201,"target":10208},{"edgeType":"calls","source":3911,"target":740},{"edgeType":"calls","source":1711,"target":230},{"edgeType":"contains","source":1116,"target":1153},{"edgeType":"contains","source":5213,"target":5220},{"edgeType":"contains","source":9144,"target":9148},{"edgeType":"imports","source":1672,"target":907},{"edgeType":"contains","source":8185,"target":8223},{"edgeType":"contains","source":10201,"target":10209},{"edgeType":"contains","source":8147,"target":8344},{"edgeType":"contains","source":8765,"target":9269},{"edgeType":"imports","source":7923,"target":7951},{"edgeType":"calls","source":7534,"target":491},{"edgeType":"calls","source":12092,"target":2951},{"edgeType":"calls","source":1301,"target":1312},{"edgeType":"contains","source":12644,"target":12694},{"edgeType":"calls","source":379,"target":300},{"edgeType":"contains","source":11489,"target":11502},{"edgeType":"contains","source":9276,"target":9287},{"edgeType":"contains","source":3557,"target":3703},{"edgeType":"contains","source":9144,"target":9151},{"edgeType":"contains","source":3427,"target":3505},{"edgeType":"contains","source":7426,"target":7442},{"edgeType":"contains","source":7425,"target":7473},{"edgeType":"imports","source":11983,"target":12109},{"edgeType":"contains","source":9002,"target":868},{"edgeType":"contains","source":11058,"target":11121},{"edgeType":"calls","source":1462,"target":1609},{"edgeType":"contains","source":2006,"target":2103},{"edgeType":"contains","source":8765,"target":9272},{"edgeType":"imports","source":8074,"target":7495},{"edgeType":"calls","source":1538,"target":1367},{"edgeType":"contains","source":8087,"target":7036},{"edgeType":"contains","source":10201,"target":10206},{"edgeType":"contains","source":8087,"target":8093},{"edgeType":"contains","source":8185,"target":8226},{"edgeType":"contains","source":10301,"target":11334},{"edgeType":"contains","source":11984,"target":12012},{"edgeType":"contains","source":12019,"target":11984},{"edgeType":"calls","source":11272,"target":3000},{"edgeType":"contains","source":952,"target":954},{"edgeType":"contains","source":5213,"target":5218},{"edgeType":"contains","source":9342,"target":9354},{"edgeType":"contains","source":11489,"target":11503},{"edgeType":"contains","source":11532,"target":11227},{"edgeType":"contains","source":9276,"target":9286},{"edgeType":"contains","source":9144,"target":9150},{"edgeType":"contains","source":4841,"target":5122},{"edgeType":"contains","source":11983,"target":2531},{"edgeType":"calls","source":2734,"target":2343},{"edgeType":"imports","source":2314,"target":1087},{"edgeType":"contains","source":2006,"target":2104},{"edgeType":"calls","source":6290,"target":6289},{"edgeType":"contains","source":8765,"target":9271},{"edgeType":"contains","source":5883,"target":6653},{"edgeType":"contains","source":5939,"target":5974},{"edgeType":"contains","source":4758,"target":4524},{"edgeType":"contains","source":8087,"target":8092},{"edgeType":"contains","source":10201,"target":10207},{"edgeType":"contains","source":952,"target":957},{"edgeType":"contains","source":4320,"target":4368},{"edgeType":"calls","source":7482,"target":7391},{"edgeType":"contains","source":9276,"target":9281},{"edgeType":"contains","source":820,"target":821},{"edgeType":"contains","source":853,"target":855},{"edgeType":"contains","source":7129,"target":7130},{"edgeType":"contains","source":11159,"target":11160},{"edgeType":"contains","source":9144,"target":9145},{"edgeType":"contains","source":13636,"target":13651},{"edgeType":"contains","source":11489,"target":11500},{"edgeType":"contains","source":2006,"target":2109},{"edgeType":"contains","source":9041,"target":9166},{"edgeType":"contains","source":11091,"target":11153},{"edgeType":"contains","source":11082,"target":12489},{"edgeType":"contains","source":2768,"target":2798},{"edgeType":"calls","source":9199,"target":2789},{"edgeType":"calls","source":1286,"target":717},{"edgeType":"contains","source":2041,"target":2081},{"edgeType":"contains","source":12150,"target":12151},{"edgeType":"contains","source":885,"target":3033},{"edgeType":"contains","source":10629,"target":10678},{"edgeType":"contains","source":9276,"target":9280},{"edgeType":"contains","source":853,"target":854},{"edgeType":"contains","source":5939,"target":5967},{"edgeType":"imports","source":6043,"target":5981},{"edgeType":"contains","source":1116,"target":1157},{"edgeType":"contains","source":3495,"target":3516},{"edgeType":"contains","source":11489,"target":11501},{"edgeType":"calls","source":2620,"target":2703},{"edgeType":"contains","source":7488,"target":7629},{"edgeType":"contains","source":3080,"target":2641},{"edgeType":"imports","source":10246,"target":420},{"edgeType":"contains","source":8185,"target":8219},{"edgeType":"contains","source":11869,"target":8177},{"edgeType":"contains","source":9044,"target":9072},{"edgeType":"contains","source":9041,"target":9165},{"edgeType":"contains","source":11091,"target":11154},{"edgeType":"imports","source":3847,"target":3237},{"edgeType":"contains","source":4750,"target":4778},{"edgeType":"contains","source":2768,"target":2799},{"edgeType":"contains","source":8299,"target":2571},{"edgeType":"contains","source":8765,"target":9265},{"edgeType":"contains","source":2041,"target":2082},{"edgeType":"contains","source":6762,"target":6880},{"edgeType":"contains","source":9106,"target":808},{"edgeType":"contains","source":12249,"target":12252},{"edgeType":"contains","source":4510,"target":4819},{"edgeType":"contains","source":2006,"target":2110},{"edgeType":"calls","source":3283,"target":3291},{"edgeType":"contains","source":1,"target":13524},{"edgeType":"contains","source":9276,"target":9283},{"edgeType":"contains","source":918,"target":956},{"edgeType":"calls","source":3184,"target":3186},{"edgeType":"calls","source":12604,"target":2936},{"edgeType":"contains","source":9144,"target":9147},{"edgeType":"contains","source":11456,"target":11464},{"edgeType":"contains","source":11489,"target":11498},{"edgeType":"imports","source":4316,"target":4554},{"edgeType":"contains","source":7426,"target":7438},{"edgeType":"imports","source":12423,"target":12206},{"edgeType":"contains","source":2006,"target":2107},{"edgeType":"contains","source":6899,"target":6862},{"edgeType":"contains","source":8185,"target":8222},{"edgeType":"contains","source":8147,"target":8343},{"edgeType":"imports","source":3763,"target":3728},{"edgeType":"contains","source":2768,"target":2796},{"edgeType":"calls","source":676,"target":603},{"edgeType":"contains","source":9106,"target":811},{"edgeType":"contains","source":11082,"target":12487},{"edgeType":"contains","source":10201,"target":10202},{"edgeType":"contains","source":55,"target":226},{"edgeType":"contains","source":8765,"target":9268},{"edgeType":"calls","source":5187,"target":4516},{"edgeType":"calls","source":7248,"target":7248},{"edgeType":"contains","source":12249,"target":12251},{"edgeType":"contains","source":4320,"target":4366},{"edgeType":"imports","source":7128,"target":7231},{"edgeType":"calls","source":4638,"target":4621},{"edgeType":"contains","source":952,"target":958},{"edgeType":"contains","source":820,"target":822},{"edgeType":"contains","source":11984,"target":12008},{"edgeType":"contains","source":4949,"target":4950},{"edgeType":"contains","source":853,"target":856},{"edgeType":"contains","source":9144,"target":9146},{"edgeType":"contains","source":11456,"target":11465},{"edgeType":"contains","source":1347,"target":1396},{"edgeType":"calls","source":7051,"target":7014},{"edgeType":"imports","source":2350,"target":1024},{"edgeType":"contains","source":2041,"target":2080},{"edgeType":"contains","source":11082,"target":12488},{"edgeType":"imports","source":2787,"target":1218},{"edgeType":"contains","source":8087,"target":8088},{"edgeType":"contains","source":10201,"target":10203},{"edgeType":"contains","source":8765,"target":9267},{"edgeType":"calls","source":1202,"target":1208},{"edgeType":"contains","source":10630,"target":10645},{"edgeType":"contains","source":12644,"target":12689},{"edgeType":"contains","source":4944,"target":5079},{"edgeType":"contains","source":11082,"target":12469},{"edgeType":"contains","source":12519,"target":12318},{"edgeType":"calls","source":10146,"target":3000},{"edgeType":"calls","source":11979,"target":11714},{"edgeType":"contains","source":12975,"target":12981},{"edgeType":"contains","source":3016,"target":3538},{"edgeType":"calls","source":2593,"target":2511},{"edgeType":"calls","source":12577,"target":10088},{"edgeType":"calls","source":9859,"target":5554},{"edgeType":"calls","source":973,"target":936},{"edgeType":"contains","source":2533,"target":2655},{"edgeType":"contains","source":7488,"target":7607},{"edgeType":"contains","source":4510,"target":4791},{"edgeType":"imports","source":11983,"target":12099},{"edgeType":"contains","source":9870,"target":9874},{"edgeType":"calls","source":7247,"target":7248},{"edgeType":"contains","source":8147,"target":8320},{"edgeType":"contains","source":3728,"target":3665},{"edgeType":"contains","source":3726,"target":3727},{"edgeType":"contains","source":1,"target":13496},{"edgeType":"imports","source":10037,"target":10059},{"edgeType":"calls","source":2582,"target":1796},{"edgeType":"contains","source":11786,"target":11787},{"edgeType":"contains","source":9106,"target":9244},{"edgeType":"contains","source":3557,"target":3679},{"edgeType":"contains","source":11082,"target":12470},{"edgeType":"calls","source":12799,"target":12719},{"edgeType":"contains","source":9209,"target":9222},{"edgeType":"calls","source":443,"target":452},{"edgeType":"calls","source":4994,"target":4187},{"edgeType":"imports","source":6043,"target":5969},{"edgeType":"contains","source":5409,"target":5461},{"edgeType":"contains","source":4743,"target":4966},{"edgeType":"calls","source":5028,"target":4190},{"edgeType":"calls","source":7875,"target":7864},{"edgeType":"imports","source":8453,"target":1026},{"edgeType":"contains","source":1,"target":3985},{"edgeType":"contains","source":4981,"target":4987},{"edgeType":"contains","source":1,"target":5042},{"edgeType":"contains","source":4944,"target":5077},{"edgeType":"contains","source":9698,"target":9918},{"edgeType":"contains","source":11082,"target":12467},{"edgeType":"contains","source":3741,"target":3259},{"edgeType":"imports","source":12423,"target":10088},{"edgeType":"contains","source":3016,"target":3536},{"edgeType":"calls","source":575,"target":591},{"edgeType":"contains","source":918,"target":927},{"edgeType":"contains","source":6762,"target":6861},{"edgeType":"contains","source":1,"target":13498},{"edgeType":"contains","source":2041,"target":2050},{"edgeType":"calls","source":5894,"target":5882},{"edgeType":"imports","source":7860,"target":7779},{"edgeType":"calls","source":9229,"target":9231},{"edgeType":"contains","source":11082,"target":12468},{"edgeType":"contains","source":1603,"target":830},{"edgeType":"imports","source":6568,"target":266},{"edgeType":"contains","source":10461,"target":10578},{"edgeType":"contains","source":6899,"target":6843},{"edgeType":"calls","source":7974,"target":7969},{"edgeType":"calls","source":1978,"target":436},{"edgeType":"contains","source":2768,"target":2769},{"edgeType":"calls","source":775,"target":732},{"edgeType":"contains","source":918,"target":926},{"edgeType":"contains","source":4758,"target":4499},{"edgeType":"contains","source":4510,"target":4788},{"edgeType":"calls","source":5484,"target":4850},{"edgeType":"contains","source":9870,"target":9873},{"edgeType":"calls","source":3350,"target":3352},{"edgeType":"calls","source":7974,"target":7970},{"edgeType":"contains","source":122,"target":236},{"edgeType":"calls","source":11314,"target":11192},{"edgeType":"contains","source":8628,"target":7146},{"edgeType":"contains","source":5707,"target":5734},{"edgeType":"imports","source":6305,"target":6308},{"edgeType":"contains","source":4393,"target":4194},{"edgeType":"contains","source":3016,"target":3542},{"edgeType":"contains","source":6930,"target":6932},{"edgeType":"contains","source":12975,"target":12977},{"edgeType":"imports","source":1497,"target":1019},{"edgeType":"contains","source":918,"target":929},{"edgeType":"calls","source":5028,"target":4187},{"edgeType":"calls","source":10638,"target":436},{"edgeType":"contains","source":4510,"target":4795},{"edgeType":"contains","source":3262,"target":3315},{"edgeType":"contains","source":1,"target":13500},{"edgeType":"calls","source":11135,"target":3000},{"edgeType":"contains","source":5939,"target":5942},{"edgeType":"contains","source":2041,"target":2056},{"edgeType":"contains","source":3594,"target":3595},{"edgeType":"calls","source":5846,"target":1026},{"edgeType":"contains","source":5707,"target":5735},{"edgeType":"imports","source":8362,"target":7022},{"edgeType":"calls","source":2593,"target":2508},{"edgeType":"contains","source":2636,"target":2639},{"edgeType":"contains","source":3016,"target":3543},{"edgeType":"contains","source":4944,"target":5082},{"edgeType":"contains","source":918,"target":928},{"edgeType":"contains","source":9106,"target":9240},{"edgeType":"contains","source":12975,"target":12976},{"edgeType":"calls","source":977,"target":807},{"edgeType":"calls","source":245,"target":244},{"edgeType":"contains","source":2533,"target":2660},{"edgeType":"calls","source":2161,"target":2159},{"edgeType":"calls","source":2261,"target":1173},{"edgeType":"contains","source":3262,"target":3316},{"edgeType":"contains","source":5939,"target":5943},{"edgeType":"contains","source":9870,"target":9871},{"edgeType":"calls","source":12963,"target":12925},{"edgeType":"contains","source":11984,"target":11986},{"edgeType":"imports","source":11983,"target":12096},{"edgeType":"contains","source":10629,"target":10650},{"edgeType":"calls","source":9396,"target":9343},{"edgeType":"contains","source":3016,"target":3540},{"edgeType":"calls","source":4954,"target":4364},{"edgeType":"contains","source":891,"target":1768},{"edgeType":"contains","source":6831,"target":6832},{"edgeType":"contains","source":9209,"target":9221},{"edgeType":"contains","source":13008,"target":13009},{"edgeType":"calls","source":719,"target":351},{"edgeType":"contains","source":3726,"target":3729},{"edgeType":"contains","source":11984,"target":11985},{"edgeType":"calls","source":6028,"target":5952},{"edgeType":"imports","source":12557,"target":12273},{"edgeType":"contains","source":4292,"target":4151},{"edgeType":"calls","source":7280,"target":7289},{"edgeType":"calls","source":575,"target":586},{"edgeType":"contains","source":4380,"target":3537},{"edgeType":"contains","source":7808,"target":1913},{"edgeType":"contains","source":918,"target":930},{"edgeType":"imports","source":7128,"target":7222},{"edgeType":"contains","source":3016,"target":3541},{"edgeType":"contains","source":12775,"target":12831},{"edgeType":"imports","source":1954,"target":590},{"edgeType":"contains","source":2636,"target":2637},{"edgeType":"calls","source":4679,"target":4432},{"edgeType":"calls","source":1026,"target":347},{"edgeType":"contains","source":5042,"target":5213},{"edgeType":"contains","source":4944,"target":5080},{"edgeType":"calls","source":5128,"target":4255},{"edgeType":"contains","source":12279,"target":12352},{"edgeType":"calls","source":12543,"target":10088},{"edgeType":"contains","source":4510,"target":4792},{"edgeType":"calls","source":7355,"target":7078},{"edgeType":"calls","source":11253,"target":398},{"edgeType":"calls","source":6059,"target":6047},{"edgeType":"contains","source":12975,"target":12989},{"edgeType":"calls","source":4852,"target":4353},{"edgeType":"contains","source":4179,"target":4490},{"edgeType":"contains","source":13636,"target":13639},{"edgeType":"calls","source":2921,"target":2905},{"edgeType":"imports","source":554,"target":667},{"edgeType":"imports","source":5710,"target":5714},{"edgeType":"imports","source":2350,"target":1014},{"edgeType":"contains","source":8678,"target":8780},{"edgeType":"contains","source":4320,"target":4347},{"edgeType":"contains","source":918,"target":933},{"edgeType":"contains","source":2504,"target":2506},{"edgeType":"calls","source":11844,"target":11679},{"edgeType":"contains","source":2533,"target":2664},{"edgeType":"contains","source":3594,"target":3599},{"edgeType":"contains","source":11082,"target":12477},{"edgeType":"imports","source":10237,"target":8079},{"edgeType":"contains","source":5409,"target":5470},{"edgeType":"calls","source":13009,"target":3048},{"edgeType":"contains","source":8147,"target":8327},{"edgeType":"contains","source":12975,"target":12988},{"edgeType":"imports","source":7128,"target":7208},{"edgeType":"contains","source":2533,"target":2665},{"edgeType":"imports","source":554,"target":668},{"edgeType":"contains","source":11786,"target":11795},{"edgeType":"contains","source":918,"target":932},{"edgeType":"contains","source":12519,"target":12325},{"edgeType":"calls","source":11844,"target":11680},{"edgeType":"contains","source":4585,"target":4588},{"edgeType":"contains","source":4510,"target":4799},{"edgeType":"calls","source":7875,"target":7873},{"edgeType":"contains","source":6438,"target":6342},{"edgeType":"calls","source":7545,"target":7532},{"edgeType":"calls","source":5907,"target":5472},{"edgeType":"contains","source":9907,"target":9793},{"edgeType":"contains","source":1,"target":13503},{"edgeType":"calls","source":443,"target":444},{"edgeType":"contains","source":10630,"target":10635},{"edgeType":"contains","source":10663,"target":10669},{"edgeType":"calls","source":575,"target":580},{"edgeType":"calls","source":7049,"target":7053},{"edgeType":"contains","source":13569,"target":13600},{"edgeType":"contains","source":3495,"target":3496},{"edgeType":"contains","source":5409,"target":5469},{"edgeType":"contains","source":9342,"target":9335},{"edgeType":"contains","source":11082,"target":12478},{"edgeType":"calls","source":6093,"target":6048},{"edgeType":"imports","source":12554,"target":2847},{"edgeType":"calls","source":7843,"target":7809},{"edgeType":"contains","source":12975,"target":12987},{"edgeType":"contains","source":13636,"target":13637},{"edgeType":"contains","source":4185,"target":4302},{"edgeType":"contains","source":55,"target":205},{"edgeType":"contains","source":5939,"target":5956},{"edgeType":"contains","source":4944,"target":5085},{"edgeType":"contains","source":4750,"target":4757},{"edgeType":"contains","source":4585,"target":4587},{"edgeType":"contains","source":8483,"target":8485},{"edgeType":"contains","source":4510,"target":4797},{"edgeType":"contains","source":10663,"target":10666},{"edgeType":"contains","source":10630,"target":10632},{"edgeType":"contains","source":3016,"target":3544},{"edgeType":"calls","source":1632,"target":1641},{"edgeType":"contains","source":3262,"target":3317},{"edgeType":"contains","source":9044,"target":9063},{"edgeType":"contains","source":3557,"target":3687},{"edgeType":"contains","source":8185,"target":8208},{"edgeType":"contains","source":12975,"target":12986},{"edgeType":"contains","source":11786,"target":11793},{"edgeType":"contains","source":2269,"target":2390},{"edgeType":"contains","source":5939,"target":5957},{"edgeType":"contains","source":4585,"target":4586},{"edgeType":"contains","source":4743,"target":4973},{"edgeType":"calls","source":5461,"target":270},{"edgeType":"contains","source":10301,"target":11318},{"edgeType":"contains","source":4510,"target":4796},{"edgeType":"contains","source":8483,"target":8484},{"edgeType":"contains","source":10663,"target":10667},{"edgeType":"contains","source":3152,"target":3557},{"edgeType":"contains","source":11082,"target":12476},{"edgeType":"imports","source":12152,"target":12140},{"edgeType":"contains","source":12975,"target":12985},{"edgeType":"imports","source":7894,"target":7779},{"edgeType":"imports","source":5043,"target":1026},{"edgeType":"contains","source":6633,"target":6634},{"edgeType":"calls","source":1830,"target":1839},{"edgeType":"contains","source":2968,"target":2924},{"edgeType":"contains","source":4981,"target":5001},{"edgeType":"contains","source":9852,"target":10436},{"edgeType":"contains","source":7456,"target":7546},{"edgeType":"calls","source":379,"target":311},{"edgeType":"imports","source":12557,"target":12262},{"edgeType":"contains","source":2005,"target":2124},{"edgeType":"contains","source":1831,"target":2233},{"edgeType":"contains","source":2533,"target":2669},{"edgeType":"calls","source":2756,"target":2732},{"edgeType":"imports","source":7694,"target":7638},{"edgeType":"calls","source":11023,"target":10709},{"edgeType":"contains","source":4185,"target":4307},{"edgeType":"calls","source":1362,"target":491},{"edgeType":"contains","source":12280,"target":12331},{"edgeType":"contains","source":4453,"target":4456},{"edgeType":"calls","source":9724,"target":9751},{"edgeType":"contains","source":10663,"target":10665},{"edgeType":"contains","source":12711,"target":12712},{"edgeType":"contains","source":4944,"target":5090},{"edgeType":"calls","source":12379,"target":2498},{"edgeType":"contains","source":8096,"target":391},{"edgeType":"contains","source":2006,"target":2090},{"edgeType":"calls","source":7809,"target":7810},{"edgeType":"contains","source":8147,"target":8326},{"edgeType":"calls","source":2127,"target":2144},{"edgeType":"contains","source":11082,"target":12471},{"edgeType":"contains","source":2533,"target":2666},{"edgeType":"contains","source":1,"target":13511},{"edgeType":"contains","source":4320,"target":4349},{"edgeType":"calls","source":3525,"target":3202},{"edgeType":"calls","source":6741,"target":6036},{"edgeType":"contains","source":8078,"target":952},{"edgeType":"calls","source":3175,"target":1367},{"edgeType":"contains","source":5939,"target":5952},{"edgeType":"calls","source":12137,"target":12111},{"edgeType":"contains","source":1111,"target":1298},{"edgeType":"calls","source":245,"target":239},{"edgeType":"contains","source":5409,"target":5472},{"edgeType":"contains","source":2006,"target":2091},{"edgeType":"contains","source":11674,"target":12090},{"edgeType":"calls","source":2141,"target":654},{"edgeType":"contains","source":1882,"target":650},{"edgeType":"contains","source":9044,"target":9058},{"edgeType":"contains","source":4585,"target":4590},{"edgeType":"contains","source":2533,"target":2667},{"edgeType":"contains","source":10629,"target":10659},{"edgeType":"contains","source":8096,"target":393},{"edgeType":"contains","source":5042,"target":5221},{"edgeType":"calls","source":12229,"target":8203},{"edgeType":"calls","source":245,"target":238},{"edgeType":"contains","source":7456,"target":7549},{"edgeType":"imports","source":12554,"target":2845},{"edgeType":"contains","source":11455,"target":11460},{"edgeType":"contains","source":5342,"target":5409},{"edgeType":"calls","source":989,"target":390},{"edgeType":"calls","source":7907,"target":1570},{"edgeType":"calls","source":2233,"target":937},{"edgeType":"contains","source":11950,"target":11971},{"edgeType":"contains","source":8197,"target":7810},{"edgeType":"calls","source":3712,"target":3712},{"edgeType":"calls","source":1678,"target":1229},{"edgeType":"contains","source":2006,"target":2063},{"edgeType":"contains","source":5961,"target":6304},{"edgeType":"contains","source":11124,"target":11150},{"edgeType":"contains","source":4944,"target":5062},{"edgeType":"calls","source":6239,"target":2539},{"edgeType":"calls","source":6920,"target":2570},{"edgeType":"calls","source":5235,"target":5123},{"edgeType":"contains","source":8482,"target":8489},{"edgeType":"calls","source":8568,"target":8563},{"edgeType":"calls","source":2827,"target":2607},{"edgeType":"contains","source":4743,"target":4951},{"edgeType":"calls","source":2452,"target":491},{"edgeType":"contains","source":12902,"target":13113},{"edgeType":"contains","source":3016,"target":3521},{"edgeType":"contains","source":5083,"target":4981},{"edgeType":"calls","source":2258,"target":2277},{"edgeType":"contains","source":1831,"target":2204},{"edgeType":"contains","source":5342,"target":5408},{"edgeType":"calls","source":127,"target":685},{"edgeType":"contains","source":7425,"target":7431},{"edgeType":"contains","source":646,"target":883},{"edgeType":"imports","source":11616,"target":5554},{"edgeType":"imports","source":3763,"target":3764},{"edgeType":"contains","source":11950,"target":11970},{"edgeType":"contains","source":8197,"target":7809},{"edgeType":"contains","source":122,"target":214},{"edgeType":"contains","source":5707,"target":5723},{"edgeType":"calls","source":1664,"target":1662},{"edgeType":"contains","source":5883,"target":6609},{"edgeType":"contains","source":899,"target":1496},{"edgeType":"contains","source":4320,"target":4322},{"edgeType":"contains","source":8482,"target":8488},{"edgeType":"contains","source":3557,"target":3663},{"edgeType":"calls","source":2444,"target":740},{"edgeType":"contains","source":7127,"target":7155},{"edgeType":"calls","source":672,"target":703},{"edgeType":"contains","source":12902,"target":13112},{"edgeType":"contains","source":3016,"target":3522},{"edgeType":"contains","source":8680,"target":8695},{"edgeType":"calls","source":7896,"target":1913},{"edgeType":"contains","source":2006,"target":2061},{"edgeType":"calls","source":11562,"target":1367},{"edgeType":"contains","source":7425,"target":7432},{"edgeType":"contains","source":7356,"target":7457},{"edgeType":"calls","source":2258,"target":2274},{"edgeType":"contains","source":2733,"target":2779},{"edgeType":"imports","source":3763,"target":3765},{"edgeType":"contains","source":4510,"target":4773},{"edgeType":"calls","source":3487,"target":3286},{"edgeType":"calls","source":5797,"target":4612},{"edgeType":"contains","source":9999,"target":10084},{"edgeType":"contains","source":10227,"target":3016},{"edgeType":"contains","source":11950,"target":11969},{"edgeType":"contains","source":2269,"target":2364},{"edgeType":"contains","source":4320,"target":4321},{"edgeType":"contains","source":7808,"target":1902},{"edgeType":"contains","source":3016,"target":3519},{"edgeType":"calls","source":5235,"target":5121},{"edgeType":"contains","source":10629,"target":10638},{"edgeType":"calls","source":2478,"target":740},{"edgeType":"contains","source":7127,"target":7156},{"edgeType":"contains","source":8482,"target":8491},{"edgeType":"contains","source":12902,"target":13111},{"edgeType":"contains","source":11455,"target":11459},{"edgeType":"calls","source":11412,"target":733},{"edgeType":"contains","source":7356,"target":7458},{"edgeType":"contains","source":2733,"target":2780},{"edgeType":"calls","source":2325,"target":2312},{"edgeType":"calls","source":9195,"target":754},{"edgeType":"contains","source":4510,"target":4772},{"edgeType":"contains","source":9999,"target":10085},{"edgeType":"imports","source":3763,"target":3766},{"edgeType":"imports","source":10514,"target":10117},{"edgeType":"calls","source":6180,"target":4365},{"edgeType":"contains","source":4386,"target":4388},{"edgeType":"calls","source":12867,"target":12707},{"edgeType":"contains","source":10301,"target":11294},{"edgeType":"calls","source":12961,"target":12964},{"edgeType":"contains","source":3016,"target":3520},{"edgeType":"contains","source":6897,"target":6888},{"edgeType":"contains","source":9106,"target":773},{"edgeType":"imports","source":9143,"target":1881},{"edgeType":"contains","source":12902,"target":13110},{"edgeType":"contains","source":3154,"target":3476},{"edgeType":"calls","source":9691,"target":9693},{"edgeType":"contains","source":12902,"target":13109},{"edgeType":"contains","source":7488,"target":7587},{"edgeType":"contains","source":10893,"target":10908},{"edgeType":"contains","source":4510,"target":4779},{"edgeType":"contains","source":8680,"target":8689},{"edgeType":"contains","source":9999,"target":10082},{"edgeType":"calls","source":12928,"target":12937},{"edgeType":"contains","source":2006,"target":2067},{"edgeType":"contains","source":6566,"target":6572},{"edgeType":"contains","source":7897,"target":7593},{"edgeType":"contains","source":10237,"target":10103},{"edgeType":"calls","source":1904,"target":1618},{"edgeType":"calls","source":3879,"target":3816},{"edgeType":"imports","source":3763,"target":3767},{"edgeType":"calls","source":5828,"target":5763},{"edgeType":"calls","source":1336,"target":1256},{"edgeType":"contains","source":11227,"target":11124},{"edgeType":"contains","source":2269,"target":2371},{"edgeType":"contains","source":5707,"target":5718},{"edgeType":"contains","source":6962,"target":6980},{"edgeType":"contains","source":11124,"target":11146},{"edgeType":"calls","source":7057,"target":2556},{"edgeType":"contains","source":11422,"target":11423},{"edgeType":"calls","source":12651,"target":2498},{"edgeType":"contains","source":11455,"target":11457},{"edgeType":"contains","source":13503,"target":13504},{"edgeType":"contains","source":6566,"target":6573},{"edgeType":"contains","source":2006,"target":2068},{"edgeType":"contains","source":11950,"target":11966},{"edgeType":"contains","source":9999,"target":10083},{"edgeType":"contains","source":8449,"target":8450},{"edgeType":"contains","source":2998,"target":3027},{"edgeType":"contains","source":4743,"target":4954},{"edgeType":"contains","source":3016,"target":3526},{"edgeType":"calls","source":4618,"target":4162},{"edgeType":"calls","source":8584,"target":2785},{"edgeType":"contains","source":11124,"target":11147},{"edgeType":"calls","source":12444,"target":2572},{"edgeType":"calls","source":989,"target":385},{"edgeType":"contains","source":7127,"target":7151},{"edgeType":"imports","source":1434,"target":907},{"edgeType":"contains","source":12902,"target":13107},{"edgeType":"contains","source":10826,"target":10869},{"edgeType":"contains","source":13569,"target":13571},{"edgeType":"calls","source":2276,"target":655},{"edgeType":"imports","source":3763,"target":3769},{"edgeType":"calls","source":1929,"target":1902},{"edgeType":"contains","source":8383,"target":8385},{"edgeType":"calls","source":2687,"target":2713},{"edgeType":"contains","source":3461,"target":3471},{"edgeType":"contains","source":8482,"target":8487},{"edgeType":"contains","source":9698,"target":9898},{"edgeType":"calls","source":10950,"target":3431},{"edgeType":"contains","source":12775,"target":12816},{"edgeType":"contains","source":6962,"target":6982},{"edgeType":"calls","source":2952,"target":2954},{"edgeType":"calls","source":4945,"target":3537},{"edgeType":"contains","source":11124,"target":11144},{"edgeType":"contains","source":3016,"target":3523},{"edgeType":"contains","source":7326,"target":7327},{"edgeType":"contains","source":10826,"target":10870},{"edgeType":"contains","source":2601,"target":2648},{"edgeType":"calls","source":4394,"target":3704},{"edgeType":"contains","source":7425,"target":7429},{"edgeType":"calls","source":1829,"target":1830},{"edgeType":"contains","source":2006,"target":2066},{"edgeType":"contains","source":9999,"target":10081},{"edgeType":"contains","source":10301,"target":11289},{"edgeType":"contains","source":6203,"target":3029},{"edgeType":"contains","source":3557,"target":3665},{"edgeType":"contains","source":8383,"target":8384},{"edgeType":"imports","source":12423,"target":12249},{"edgeType":"calls","source":509,"target":469},{"edgeType":"calls","source":5492,"target":320},{"edgeType":"contains","source":3016,"target":3524},{"edgeType":"contains","source":12775,"target":12815},{"edgeType":"calls","source":10285,"target":10306},{"edgeType":"imports","source":11202,"target":420},{"edgeType":"contains","source":5146,"target":5151},{"edgeType":"contains","source":10629,"target":10648},{"edgeType":"contains","source":2998,"target":3031},{"edgeType":"calls","source":12401,"target":12365},{"edgeType":"contains","source":12775,"target":12830},{"edgeType":"contains","source":7356,"target":7463},{"edgeType":"contains","source":11750,"target":2323},{"edgeType":"contains","source":9106,"target":9237},{"edgeType":"contains","source":11224,"target":11230},{"edgeType":"contains","source":8185,"target":8191},{"edgeType":"calls","source":6236,"target":5795},{"edgeType":"calls","source":7214,"target":7206},{"edgeType":"contains","source":1205,"target":2591},{"edgeType":"contains","source":11674,"target":12078},{"edgeType":"contains","source":2006,"target":2072},{"edgeType":"calls","source":773,"target":736},{"edgeType":"calls","source":738,"target":764},{"edgeType":"calls","source":709,"target":606},{"edgeType":"contains","source":8482,"target":8497},{"edgeType":"contains","source":2533,"target":2647},{"edgeType":"contains","source":2527,"target":2833},{"edgeType":"contains","source":10385,"target":9756},{"edgeType":"contains","source":7785,"target":7905},{"edgeType":"contains","source":10629,"target":10649},{"edgeType":"contains","source":2998,"target":3032},{"edgeType":"contains","source":5883,"target":6617},{"edgeType":"calls","source":2299,"target":998},{"edgeType":"calls","source":508,"target":493},{"edgeType":"contains","source":3557,"target":3671},{"edgeType":"calls","source":6248,"target":4365},{"edgeType":"contains","source":1603,"target":824},{"edgeType":"contains","source":7356,"target":7464},{"edgeType":"contains","source":11224,"target":11231},{"edgeType":"contains","source":8185,"target":8190},{"edgeType":"contains","source":1205,"target":2592},{"edgeType":"calls","source":676,"target":571},{"edgeType":"contains","source":4131,"target":5961},{"edgeType":"contains","source":2006,"target":2073},{"edgeType":"contains","source":4944,"target":5069},{"edgeType":"contains","source":8482,"target":8496},{"edgeType":"calls","source":1169,"target":1143},{"edgeType":"contains","source":10301,"target":11304},{"edgeType":"calls","source":1698,"target":1660},{"edgeType":"contains","source":4510,"target":4781},{"edgeType":"calls","source":7544,"target":7548},{"edgeType":"calls","source":11305,"target":3000},{"edgeType":"calls","source":12926,"target":13001},{"edgeType":"contains","source":7488,"target":7601},{"edgeType":"contains","source":2041,"target":2042},{"edgeType":"calls","source":8469,"target":8471},{"edgeType":"calls","source":11646,"target":3000},{"edgeType":"calls","source":571,"target":658},{"edgeType":"calls","source":3346,"target":3420},{"edgeType":"contains","source":12519,"target":12308},{"edgeType":"contains","source":4944,"target":5068},{"edgeType":"contains","source":3016,"target":3527},{"edgeType":"contains","source":2998,"target":3028},{"edgeType":"contains","source":547,"target":792},{"edgeType":"calls","source":1795,"target":766},{"edgeType":"contains","source":8482,"target":8498},{"edgeType":"calls","source":9526,"target":9528},{"edgeType":"contains","source":10629,"target":10647},{"edgeType":"contains","source":8591,"target":9347},{"edgeType":"contains","source":3016,"target":3529},{"edgeType":"calls","source":4675,"target":4502},{"edgeType":"contains","source":12775,"target":12827},{"edgeType":"contains","source":5146,"target":5148},{"edgeType":"contains","source":5707,"target":5733},{"edgeType":"calls","source":8208,"target":8106},{"edgeType":"calls","source":1636,"target":1467},{"edgeType":"contains","source":7356,"target":7466},{"edgeType":"contains","source":3461,"target":3474},{"edgeType":"contains","source":12975,"target":12969},{"edgeType":"contains","source":2006,"target":2071},{"edgeType":"calls","source":8469,"target":8470},{"edgeType":"calls","source":5812,"target":4137},{"edgeType":"contains","source":5939,"target":5941},{"edgeType":"contains","source":4944,"target":5067},{"edgeType":"contains","source":2527,"target":2832},{"edgeType":"calls","source":3382,"target":3362},{"edgeType":"calls","source":11806,"target":11782},{"edgeType":"contains","source":7326,"target":7332},{"edgeType":"contains","source":9209,"target":9211},{"edgeType":"contains","source":3741,"target":3257},{"edgeType":"contains","source":1116,"target":1125},{"edgeType":"imports","source":8074,"target":7534},{"edgeType":"calls","source":2258,"target":2264},{"edgeType":"imports","source":10237,"target":733},{"edgeType":"contains","source":11422,"target":11430},{"edgeType":"contains","source":10301,"target":11299},{"edgeType":"calls","source":4240,"target":4245},{"edgeType":"imports","source":792,"target":733},{"edgeType":"contains","source":11082,"target":12456},{"edgeType":"imports","source":3763,"target":3759},{"edgeType":"imports","source":5860,"target":1118},{"edgeType":"contains","source":11116,"target":10345},{"edgeType":"contains","source":8482,"target":8493},{"edgeType":"contains","source":10826,"target":10879},{"edgeType":"contains","source":10843,"target":10352},{"edgeType":"contains","source":12279,"target":12347},{"edgeType":"calls","source":7964,"target":1929},{"edgeType":"calls","source":7974,"target":562},{"edgeType":"contains","source":3016,"target":3535},{"edgeType":"calls","source":1135,"target":1136},{"edgeType":"calls","source":1988,"target":2176},{"edgeType":"contains","source":7356,"target":7460},{"edgeType":"calls","source":408,"target":418},{"edgeType":"calls","source":4537,"target":4550},{"edgeType":"contains","source":7488,"target":7596},{"edgeType":"contains","source":2269,"target":2380},{"edgeType":"contains","source":3016,"target":3532},{"edgeType":"contains","source":5146,"target":5153},{"edgeType":"contains","source":9209,"target":9213},{"edgeType":"calls","source":8205,"target":8202},{"edgeType":"contains","source":4944,"target":5073},{"edgeType":"calls","source":7057,"target":2565},{"edgeType":"calls","source":230,"target":654},{"edgeType":"contains","source":3557,"target":3674},{"edgeType":"contains","source":7785,"target":7904},{"edgeType":"contains","source":8185,"target":8189},{"edgeType":"calls","source":2258,"target":2262},{"edgeType":"calls","source":12126,"target":9264},{"edgeType":"calls","source":709,"target":604},{"edgeType":"contains","source":3921,"target":4018},{"edgeType":"contains","source":1,"target":13494},{"edgeType":"calls","source":5846,"target":4137},{"edgeType":"contains","source":12902,"target":13115},{"edgeType":"contains","source":4510,"target":4785},{"edgeType":"calls","source":9361,"target":9363},{"edgeType":"contains","source":8482,"target":8495},{"edgeType":"imports","source":1139,"target":1603},{"edgeType":"contains","source":3016,"target":3533},{"edgeType":"imports","source":7629,"target":4417},{"edgeType":"contains","source":9209,"target":9212},{"edgeType":"calls","source":3159,"target":1815},{"edgeType":"contains","source":5883,"target":6615},{"edgeType":"calls","source":5892,"target":5882},{"edgeType":"calls","source":13094,"target":13081},{"edgeType":"contains","source":4981,"target":4982},{"edgeType":"imports","source":13797,"target":11928},{"edgeType":"contains","source":11224,"target":11225},{"edgeType":"calls","source":671,"target":723},{"edgeType":"calls","source":571,"target":652},{"edgeType":"contains","source":9698,"target":9907},{"edgeType":"calls","source":2523,"target":2504},{"edgeType":"imports","source":5860,"target":1119},{"edgeType":"contains","source":2006,"target":2075},{"edgeType":"contains","source":10301,"target":11298},{"edgeType":"contains","source":8185,"target":8188},{"edgeType":"contains","source":1831,"target":2215},{"edgeType":"calls","source":1267,"target":1274},{"edgeType":"contains","source":12902,"target":13114},{"edgeType":"contains","source":4510,"target":4784},{"edgeType":"contains","source":884,"target":889},{"edgeType":"contains","source":11124,"target":11134},{"edgeType":"contains","source":4944,"target":5046},{"edgeType":"contains","source":899,"target":1481},{"edgeType":"imports","source":4316,"target":4573},{"edgeType":"contains","source":10514,"target":11017},{"edgeType":"calls","source":10054,"target":10047},{"edgeType":"contains","source":8542,"target":8726},{"edgeType":"contains","source":4743,"target":4935},{"edgeType":"contains","source":12906,"target":12973},{"edgeType":"contains","source":9106,"target":756},{"edgeType":"contains","source":5052,"target":4869},{"edgeType":"contains","source":7489,"target":7543},{"edgeType":"contains","source":9,"target":531},{"edgeType":"contains","source":11950,"target":11955},{"edgeType":"contains","source":8250,"target":8265},{"edgeType":"imports","source":3763,"target":3747},{"edgeType":"calls","source":5828,"target":5783},{"edgeType":"calls","source":1874,"target":454},{"edgeType":"calls","source":3963,"target":3348},{"edgeType":"contains","source":899,"target":1480},{"edgeType":"imports","source":5711,"target":5723},{"edgeType":"calls","source":12380,"target":5593},{"edgeType":"calls","source":12442,"target":2614},{"edgeType":"imports","source":899,"target":568},{"edgeType":"contains","source":10301,"target":11279},{"edgeType":"contains","source":10893,"target":10897},{"edgeType":"contains","source":10514,"target":11018},{"edgeType":"contains","source":10826,"target":10860},{"edgeType":"imports","source":1347,"target":420},{"edgeType":"contains","source":1144,"target":1284},{"edgeType":"contains","source":12906,"target":12972},{"edgeType":"contains","source":5043,"target":5147},{"edgeType":"calls","source":10453,"target":10361},{"edgeType":"contains","source":7356,"target":7439},{"edgeType":"contains","source":2527,"target":2809},{"edgeType":"contains","source":7629,"target":2147},{"edgeType":"contains","source":4490,"target":4320},{"edgeType":"contains","source":11950,"target":11954},{"edgeType":"contains","source":9,"target":530},{"edgeType":"contains","source":122,"target":198},{"edgeType":"imports","source":7923,"target":7976},{"edgeType":"calls","source":1796,"target":1814},{"edgeType":"contains","source":11124,"target":11132},{"edgeType":"contains","source":3557,"target":3645},{"edgeType":"contains","source":6238,"target":6159},{"edgeType":"contains","source":10514,"target":11015},{"edgeType":"contains","source":1768,"target":2023},{"edgeType":"contains","source":899,"target":1483},{"edgeType":"contains","source":1346,"target":1364},{"edgeType":"contains","source":6731,"target":6732},{"edgeType":"contains","source":12775,"target":12803},{"edgeType":"contains","source":12906,"target":12971},{"edgeType":"contains","source":2006,"target":2045},{"edgeType":"contains","source":3921,"target":3989},{"edgeType":"contains","source":7283,"target":7589},{"edgeType":"contains","source":7356,"target":7440},{"edgeType":"imports","source":8167,"target":409},{"edgeType":"contains","source":2527,"target":2806},{"edgeType":"contains","source":9,"target":533},{"edgeType":"contains","source":11950,"target":11953},{"edgeType":"contains","source":122,"target":201},{"edgeType":"contains","source":884,"target":890},{"edgeType":"contains","source":899,"target":1482},{"edgeType":"contains","source":12519,"target":12282},{"edgeType":"calls","source":12341,"target":2572},{"edgeType":"contains","source":1346,"target":1365},{"edgeType":"calls","source":4613,"target":4335},{"edgeType":"calls","source":10318,"target":10320},{"edgeType":"contains","source":12906,"target":12970},{"edgeType":"contains","source":5939,"target":5916},{"edgeType":"imports","source":2766,"target":1881},{"edgeType":"calls","source":2160,"target":2159},{"edgeType":"contains","source":7283,"target":7590},{"edgeType":"contains","source":9,"target":532},{"edgeType":"calls","source":13716,"target":13854},{"edgeType":"imports","source":2408,"target":2409},{"edgeType":"contains","source":7862,"target":7610},{"edgeType":"contains","source":11950,"target":11952},{"edgeType":"contains","source":122,"target":203},{"edgeType":"contains","source":3016,"target":3509},{"edgeType":"contains","source":6962,"target":6964},{"edgeType":"contains","source":12775,"target":12801},{"edgeType":"contains","source":884,"target":893},{"edgeType":"contains","source":899,"target":1485},{"edgeType":"contains","source":4743,"target":4939},{"edgeType":"contains","source":9106,"target":9208},{"edgeType":"contains","source":11091,"target":11096},{"edgeType":"contains","source":1768,"target":2030},{"edgeType":"contains","source":2527,"target":2812},{"edgeType":"imports","source":11616,"target":5542},{"edgeType":"contains","source":4510,"target":4762},{"edgeType":"imports","source":12521,"target":2849},{"edgeType":"contains","source":8316,"target":8329},{"edgeType":"contains","source":1603,"target":1860},{"edgeType":"contains","source":9,"target":535},{"edgeType":"contains","source":11950,"target":11951},{"edgeType":"contains","source":8011,"target":8271},{"edgeType":"contains","source":122,"target":202},{"edgeType":"contains","source":1497,"target":918},{"edgeType":"imports","source":12601,"target":6712},{"edgeType":"contains","source":7842,"target":1881},{"edgeType":"contains","source":6962,"target":6965},{"edgeType":"imports","source":1139,"target":1580},{"edgeType":"contains","source":884,"target":892},{"edgeType":"contains","source":899,"target":1484},{"edgeType":"contains","source":7163,"target":2848},{"edgeType":"contains","source":1768,"target":2031},{"edgeType":"calls","source":3018,"target":3042},{"edgeType":"calls","source":408,"target":443},{"edgeType":"contains","source":4510,"target":4761},{"edgeType":"contains","source":1603,"target":1861},{"edgeType":"calls","source":8831,"target":8853},{"edgeType":"contains","source":8011,"target":8270},{"edgeType":"calls","source":3744,"target":3790},{"edgeType":"contains","source":9,"target":534},{"edgeType":"contains","source":9,"target":537},{"edgeType":"calls","source":1354,"target":717},{"edgeType":"contains","source":899,"target":1487},{"edgeType":"imports","source":1797,"target":2320},{"edgeType":"contains","source":6962,"target":6966},{"edgeType":"calls","source":12375,"target":12091},{"edgeType":"contains","source":3016,"target":3507},{"edgeType":"contains","source":8765,"target":9210},{"edgeType":"contains","source":1768,"target":2028},{"edgeType":"contains","source":9106,"target":753},{"edgeType":"calls","source":12576,"target":10088},{"edgeType":"contains","source":12906,"target":12966},{"edgeType":"contains","source":2527,"target":2810},{"edgeType":"contains","source":3785,"target":2924},{"edgeType":"contains","source":7854,"target":7855},{"edgeType":"contains","source":3809,"target":3237},{"edgeType":"contains","source":3952,"target":4089},{"edgeType":"contains","source":8011,"target":8273},{"edgeType":"contains","source":4944,"target":5047},{"edgeType":"contains","source":122,"target":204},{"edgeType":"calls","source":626,"target":1086},{"edgeType":"calls","source":11792,"target":568},{"edgeType":"contains","source":1603,"target":1858},{"edgeType":"calls","source":2591,"target":2535},{"edgeType":"calls","source":6501,"target":6036},{"edgeType":"contains","source":12775,"target":12798},{"edgeType":"contains","source":554,"target":1611},{"edgeType":"contains","source":7283,"target":7586},{"edgeType":"contains","source":5213,"target":5164},{"edgeType":"contains","source":6962,"target":6967},{"edgeType":"contains","source":9041,"target":9110},{"edgeType":"contains","source":884,"target":894},{"edgeType":"contains","source":899,"target":1486},{"edgeType":"contains","source":2527,"target":2811},{"edgeType":"contains","source":12279,"target":12319},{"edgeType":"contains","source":1768,"target":2029},{"edgeType":"contains","source":12938,"target":13030},{"edgeType":"calls","source":1711,"target":219},{"edgeType":"contains","source":12902,"target":13089},{"edgeType":"contains","source":2601,"target":2631},{"edgeType":"contains","source":1603,"target":1859},{"edgeType":"contains","source":8316,"target":8330},{"edgeType":"contains","source":9,"target":536},{"edgeType":"contains","source":3952,"target":4088},{"edgeType":"contains","source":9,"target":539},{"edgeType":"contains","source":2733,"target":2773},{"edgeType":"contains","source":4743,"target":4943},{"edgeType":"contains","source":8107,"target":8478},{"edgeType":"contains","source":2006,"target":2055},{"edgeType":"contains","source":122,"target":207},{"edgeType":"imports","source":10699,"target":10702},{"edgeType":"contains","source":10826,"target":10867},{"edgeType":"contains","source":4944,"target":5054},{"edgeType":"contains","source":899,"target":1489},{"edgeType":"contains","source":646,"target":876},{"edgeType":"contains","source":10301,"target":11286},{"edgeType":"contains","source":3741,"target":3237},{"edgeType":"contains","source":9999,"target":10078},{"edgeType":"calls","source":12508,"target":10088},{"edgeType":"contains","source":3016,"target":3513},{"edgeType":"calls","source":1632,"target":1606},{"edgeType":"contains","source":12775,"target":12814},{"edgeType":"calls","source":2589,"target":2594},{"edgeType":"contains","source":3360,"target":2362},{"edgeType":"contains","source":1768,"target":2034},{"edgeType":"calls","source":7082,"target":7053},{"edgeType":"contains","source":1603,"target":1864},{"edgeType":"contains","source":3503,"target":3214},{"edgeType":"contains","source":9,"target":538},{"edgeType":"contains","source":899,"target":1488},{"edgeType":"calls","source":5364,"target":5360},{"edgeType":"contains","source":9999,"target":10079},{"edgeType":"contains","source":646,"target":875},{"edgeType":"contains","source":4510,"target":4765},{"edgeType":"contains","source":8581,"target":8582},{"edgeType":"contains","source":12644,"target":12646},{"edgeType":"contains","source":3016,"target":3514},{"edgeType":"contains","source":12775,"target":12813},{"edgeType":"calls","source":1986,"target":1201},{"edgeType":"contains","source":11454,"target":11483},{"edgeType":"contains","source":1831,"target":2196},{"edgeType":"contains","source":1603,"target":1865},{"edgeType":"contains","source":7623,"target":7626},{"edgeType":"contains","source":7488,"target":7583},{"edgeType":"imports","source":12555,"target":2849},{"edgeType":"contains","source":646,"target":878},{"edgeType":"calls","source":4943,"target":4668},{"edgeType":"contains","source":9506,"target":9507},{"edgeType":"imports","source":5711,"target":5718},{"edgeType":"contains","source":9,"target":541},{"edgeType":"contains","source":8713,"target":8721},{"edgeType":"contains","source":2602,"target":2604},{"edgeType":"contains","source":10843,"target":10338},{"edgeType":"contains","source":3016,"target":3511},{"edgeType":"calls","source":5163,"target":4190},{"edgeType":"calls","source":1135,"target":1160},{"edgeType":"imports","source":11776,"target":568},{"edgeType":"calls","source":11264,"target":3198},{"edgeType":"contains","source":3154,"target":3461},{"edgeType":"contains","source":12644,"target":12645},{"edgeType":"contains","source":2527,"target":2814},{"edgeType":"contains","source":899,"target":1491},{"edgeType":"calls","source":3947,"target":3832},{"edgeType":"calls","source":4670,"target":4675},{"edgeType":"contains","source":1603,"target":1862},{"edgeType":"calls","source":2655,"target":2660},{"edgeType":"contains","source":11124,"target":11140},{"edgeType":"contains","source":9044,"target":9030},{"edgeType":"contains","source":1768,"target":2032},{"edgeType":"calls","source":6886,"target":6789},{"edgeType":"contains","source":9,"target":540},{"edgeType":"contains","source":2006,"target":2054},{"edgeType":"contains","source":9106,"target":765},{"edgeType":"contains","source":10893,"target":10903},{"edgeType":"calls","source":12511,"target":2595},{"edgeType":"contains","source":8680,"target":8686},{"edgeType":"contains","source":6566,"target":6571},{"edgeType":"contains","source":8147,"target":5125},{"edgeType":"contains","source":899,"target":1490},{"edgeType":"calls","source":986,"target":492},{"edgeType":"contains","source":646,"target":877},{"edgeType":"contains","source":5213,"target":5168},{"edgeType":"calls","source":1783,"target":1154},{"edgeType":"contains","source":8581,"target":8584},{"edgeType":"contains","source":10629,"target":10631},{"edgeType":"calls","source":9882,"target":2703},{"edgeType":"contains","source":1,"target":13472},{"edgeType":"contains","source":3016,"target":3512},{"edgeType":"contains","source":8096,"target":2478},{"edgeType":"contains","source":12775,"target":12811},{"edgeType":"imports","source":3234,"target":3237},{"edgeType":"calls","source":1665,"target":1641},{"edgeType":"contains","source":1768,"target":2033},{"edgeType":"contains","source":1603,"target":1863},{"edgeType":"calls","source":4324,"target":602},{"edgeType":"contains","source":2006,"target":2059},{"edgeType":"contains","source":646,"target":880},{"edgeType":"contains","source":10301,"target":11282},{"edgeType":"contains","source":9,"target":543},{"edgeType":"contains","source":11124,"target":11138},{"edgeType":"contains","source":2733,"target":2777},{"edgeType":"calls","source":4967,"target":4979},{"edgeType":"calls","source":4774,"target":4620},{"edgeType":"contains","source":8765,"target":9217},{"edgeType":"contains","source":4510,"target":4771},{"edgeType":"contains","source":10826,"target":10863},{"edgeType":"calls","source":1367,"target":1361},{"edgeType":"contains","source":9999,"target":10074},{"edgeType":"contains","source":3016,"target":3517},{"edgeType":"contains","source":3674,"target":3204},{"edgeType":"contains","source":4386,"target":4387},{"edgeType":"contains","source":12775,"target":12810},{"edgeType":"calls","source":3184,"target":3171},{"edgeType":"calls","source":12341,"target":12098},{"edgeType":"contains","source":9276,"target":9231},{"edgeType":"contains","source":899,"target":1493},{"edgeType":"calls","source":676,"target":584},{"edgeType":"contains","source":3461,"target":3465},{"edgeType":"calls","source":2451,"target":1583},{"edgeType":"calls","source":2589,"target":2590},{"edgeType":"calls","source":508,"target":507},{"edgeType":"imports","source":10037,"target":10088},{"edgeType":"contains","source":646,"target":879},{"edgeType":"contains","source":2006,"target":2060},{"edgeType":"contains","source":2733,"target":2778},{"edgeType":"contains","source":3952,"target":4098},{"edgeType":"contains","source":11124,"target":11139},{"edgeType":"contains","source":9,"target":542},{"edgeType":"contains","source":10826,"target":10864},{"edgeType":"contains","source":4485,"target":4488},{"edgeType":"contains","source":8713,"target":8714},{"edgeType":"contains","source":8897,"target":1952},{"edgeType":"contains","source":7283,"target":7592},{"edgeType":"contains","source":899,"target":1492},{"edgeType":"contains","source":4944,"target":5057},{"edgeType":"contains","source":9999,"target":10075},{"edgeType":"contains","source":5213,"target":5174},{"edgeType":"calls","source":6239,"target":2542},{"edgeType":"contains","source":9953,"target":3045},{"edgeType":"contains","source":11286,"target":10345},{"edgeType":"contains","source":1347,"target":1349},{"edgeType":"calls","source":8479,"target":8148},{"edgeType":"calls","source":9927,"target":5542},{"edgeType":"contains","source":646,"target":882},{"edgeType":"contains","source":11124,"target":11136},{"edgeType":"contains","source":2006,"target":2057},{"edgeType":"calls","source":970,"target":985},{"edgeType":"imports","source":2766,"target":1887},{"edgeType":"contains","source":10826,"target":10861},{"edgeType":"calls","source":6920,"target":454},{"edgeType":"contains","source":9999,"target":10072},{"edgeType":"calls","source":1940,"target":1569},{"edgeType":"contains","source":10176,"target":9870},{"edgeType":"contains","source":3016,"target":3515},{"edgeType":"contains","source":4944,"target":5056},{"edgeType":"contains","source":5213,"target":5173},{"edgeType":"calls","source":6821,"target":6694},{"edgeType":"calls","source":475,"target":475},{"edgeType":"contains","source":2006,"target":2058},{"edgeType":"contains","source":2733,"target":2776},{"edgeType":"contains","source":9,"target":544},{"edgeType":"contains","source":10237,"target":10094},{"edgeType":"contains","source":11124,"target":11137},{"edgeType":"contains","source":4944,"target":5055},{"edgeType":"calls","source":5218,"target":3537},{"edgeType":"contains","source":2533,"target":2634},{"edgeType":"calls","source":1294,"target":454},{"edgeType":"contains","source":10826,"target":10862},{"edgeType":"contains","source":12906,"target":12974},{"edgeType":"contains","source":4358,"target":4194},{"edgeType":"contains","source":6566,"target":6567},{"edgeType":"contains","source":4485,"target":4486},{"edgeType":"calls","source":11928,"target":2703},{"edgeType":"contains","source":9999,"target":10073},{"edgeType":"contains","source":3741,"target":3238},{"edgeType":"contains","source":7283,"target":7594},{"edgeType":"contains","source":5213,"target":5172},{"edgeType":"imports","source":13843,"target":12599},{"edgeType":"contains","source":3557,"target":3657},{"edgeType":"calls","source":6883,"target":6887},{"edgeType":"calls","source":6852,"target":6791},{"edgeType":"contains","source":11950,"target":11956},{"edgeType":"calls","source":2258,"target":2280},{"edgeType":"contains","source":7356,"target":7422},{"edgeType":"contains","source":12119,"target":11984},{"edgeType":"calls","source":2261,"target":2282},{"edgeType":"contains","source":2527,"target":2792},{"edgeType":"contains","source":4746,"target":4825},{"edgeType":"contains","source":5939,"target":5896},{"edgeType":"contains","source":13766,"target":13779},{"edgeType":"contains","source":13797,"target":13875},{"edgeType":"contains","source":9106,"target":9195},{"edgeType":"calls","source":1809,"target":1495},{"edgeType":"calls","source":718,"target":434},{"edgeType":"contains","source":7283,"target":7570},{"edgeType":"contains","source":12775,"target":12789},{"edgeType":"contains","source":3262,"target":3263},{"edgeType":"contains","source":7356,"target":7423},{"edgeType":"contains","source":1831,"target":2171},{"edgeType":"contains","source":5409,"target":5412},{"edgeType":"contains","source":4746,"target":4824},{"edgeType":"contains","source":11322,"target":11323},{"edgeType":"contains","source":4652,"target":4567},{"edgeType":"calls","source":1659,"target":859},{"edgeType":"calls","source":4605,"target":4668},{"edgeType":"contains","source":4944,"target":5028},{"edgeType":"calls","source":12733,"target":12734},{"edgeType":"contains","source":8581,"target":8557},{"edgeType":"calls","source":1008,"target":956},{"edgeType":"calls","source":773,"target":842},{"edgeType":"contains","source":1213,"target":1242},{"edgeType":"contains","source":4746,"target":4823},{"edgeType":"contains","source":9510,"target":3016},{"edgeType":"calls","source":11777,"target":11714},{"edgeType":"contains","source":13797,"target":13873},{"edgeType":"contains","source":5883,"target":6577},{"edgeType":"contains","source":5939,"target":5898},{"edgeType":"contains","source":3016,"target":3486},{"edgeType":"contains","source":2896,"target":2978},{"edgeType":"contains","source":4944,"target":5027},{"edgeType":"imports","source":7853,"target":679},{"edgeType":"contains","source":8250,"target":8251},{"edgeType":"calls","source":5895,"target":5901},{"edgeType":"contains","source":12491,"target":12078},{"edgeType":"calls","source":6378,"target":4675},{"edgeType":"contains","source":6756,"target":6997},{"edgeType":"contains","source":11019,"target":11199},{"edgeType":"imports","source":12553,"target":11426},{"edgeType":"contains","source":12906,"target":12954},{"edgeType":"contains","source":1213,"target":1245},{"edgeType":"contains","source":12516,"target":2845},{"edgeType":"contains","source":12906,"target":12953},{"edgeType":"calls","source":5869,"target":364},{"edgeType":"contains","source":4746,"target":4822},{"edgeType":"calls","source":989,"target":490},{"edgeType":"contains","source":11456,"target":10338},{"edgeType":"contains","source":7489,"target":7530},{"edgeType":"contains","source":1603,"target":1838},{"edgeType":"contains","source":3016,"target":3487},{"edgeType":"contains","source":4944,"target":5026},{"edgeType":"contains","source":10301,"target":11261},{"edgeType":"imports","source":12557,"target":2847},{"edgeType":"contains","source":3427,"target":3430},{"edgeType":"contains","source":12938,"target":13017},{"edgeType":"contains","source":12906,"target":12952},{"edgeType":"contains","source":1768,"target":2013},{"edgeType":"contains","source":4461,"target":4151},{"edgeType":"calls","source":279,"target":297},{"edgeType":"calls","source":270,"target":576},{"edgeType":"calls","source":12408,"target":12243},{"edgeType":"contains","source":6762,"target":6805},{"edgeType":"calls","source":6689,"target":6663},{"edgeType":"contains","source":1603,"target":1843},{"edgeType":"imports","source":7531,"target":7495},{"edgeType":"calls","source":7184,"target":7173},{"edgeType":"contains","source":4746,"target":4829},{"edgeType":"calls","source":8255,"target":398},{"edgeType":"calls","source":7977,"target":7959},{"edgeType":"contains","source":12975,"target":12927},{"edgeType":"calls","source":5837,"target":2411},{"edgeType":"contains","source":12938,"target":13016},{"edgeType":"calls","source":973,"target":980},{"edgeType":"contains","source":1768,"target":2014},{"edgeType":"contains","source":2527,"target":2797},{"edgeType":"contains","source":4639,"target":4974},{"edgeType":"calls","source":2141,"target":1771},{"edgeType":"calls","source":2255,"target":351},{"edgeType":"contains","source":8678,"target":8717},{"edgeType":"contains","source":13797,"target":13870},{"edgeType":"contains","source":2006,"target":2035},{"edgeType":"contains","source":13766,"target":13774},{"edgeType":"imports","source":9664,"target":568},{"edgeType":"contains","source":2139,"target":2141},{"edgeType":"contains","source":4253,"target":4256},{"edgeType":"contains","source":3638,"target":3237},{"edgeType":"calls","source":1354,"target":796},{"edgeType":"contains","source":3427,"target":3436},{"edgeType":"contains","source":4746,"target":4828},{"edgeType":"calls","source":773,"target":838},{"edgeType":"calls","source":2790,"target":2793},{"edgeType":"calls","source":10245,"target":3187},{"edgeType":"contains","source":12279,"target":12303},{"edgeType":"imports","source":7239,"target":7036},{"edgeType":"calls","source":2289,"target":351},{"edgeType":"imports","source":10301,"target":3016},{"edgeType":"calls","source":8584,"target":1829},{"edgeType":"calls","source":9081,"target":8620},{"edgeType":"calls","source":12568,"target":12566},{"edgeType":"calls","source":5895,"target":5897},{"edgeType":"contains","source":13798,"target":13838},{"edgeType":"contains","source":13797,"target":13869},{"edgeType":"contains","source":3741,"target":3214},{"edgeType":"calls","source":5653,"target":715},{"edgeType":"contains","source":10301,"target":11255},{"edgeType":"calls","source":1727,"target":864},{"edgeType":"contains","source":7785,"target":7863},{"edgeType":"contains","source":4185,"target":4249},{"edgeType":"contains","source":12709,"target":12715},{"edgeType":"contains","source":12739,"target":12842},{"edgeType":"contains","source":12644,"target":12616},{"edgeType":"contains","source":4746,"target":4827},{"edgeType":"calls","source":2755,"target":1761},{"edgeType":"calls","source":4616,"target":4322},{"edgeType":"calls","source":7967,"target":1929},{"edgeType":"imports","source":10514,"target":10155},{"edgeType":"contains","source":2527,"target":2795},{"edgeType":"calls","source":7482,"target":7452},{"edgeType":"calls","source":7552,"target":7396},{"edgeType":"calls","source":11642,"target":11676},{"edgeType":"contains","source":1768,"target":2012},{"edgeType":"contains","source":1213,"target":1249},{"edgeType":"contains","source":12519,"target":12261},{"edgeType":"calls","source":5895,"target":5896},{"edgeType":"calls","source":8904,"target":8821},{"edgeType":"calls","source":9264,"target":8232},{"edgeType":"contains","source":4253,"target":4254},{"edgeType":"imports","source":7001,"target":7013},{"edgeType":"contains","source":1603,"target":1842},{"edgeType":"contains","source":3689,"target":3768},{"edgeType":"contains","source":9698,"target":9866},{"edgeType":"contains","source":4746,"target":4826},{"edgeType":"calls","source":7919,"target":7646},{"edgeType":"calls","source":3088,"target":3063},{"edgeType":"calls","source":12165,"target":11324},{"edgeType":"calls","source":180,"target":191},{"edgeType":"contains","source":11091,"target":11092},{"edgeType":"contains","source":3689,"target":3775},{"edgeType":"calls","source":6457,"target":6460},{"edgeType":"calls","source":4843,"target":454},{"edgeType":"imports","source":10514,"target":10145},{"edgeType":"contains","source":2006,"target":2039},{"edgeType":"contains","source":4185,"target":4255},{"edgeType":"contains","source":12938,"target":13029},{"edgeType":"imports","source":8005,"target":4417},{"edgeType":"contains","source":899,"target":1472},{"edgeType":"contains","source":2269,"target":2342},{"edgeType":"calls","source":4608,"target":4568},{"edgeType":"contains","source":2527,"target":2800},{"edgeType":"calls","source":5028,"target":4232},{"edgeType":"calls","source":11642,"target":11681},{"edgeType":"contains","source":8087,"target":2738},{"edgeType":"calls","source":3087,"target":3095},{"edgeType":"calls","source":7585,"target":2147},{"edgeType":"contains","source":10514,"target":11010},{"edgeType":"calls","source":1667,"target":1660},{"edgeType":"contains","source":5213,"target":5154},{"edgeType":"contains","source":9852,"target":10391},{"edgeType":"imports","source":7128,"target":2005},{"edgeType":"contains","source":3557,"target":3638},{"edgeType":"contains","source":1603,"target":1848},{"edgeType":"contains","source":3689,"target":3774},{"edgeType":"contains","source":9106,"target":746},{"edgeType":"imports","source":11616,"target":7692},{"edgeType":"contains","source":2269,"target":2343},{"edgeType":"contains","source":2527,"target":2801},{"edgeType":"contains","source":1768,"target":2015},{"edgeType":"calls","source":5798,"target":5729},{"edgeType":"imports","source":6043,"target":6046},{"edgeType":"imports","source":6769,"target":6795},{"edgeType":"contains","source":8096,"target":348},{"edgeType":"calls","source":12418,"target":5593},{"edgeType":"contains","source":2006,"target":2036},{"edgeType":"calls","source":3911,"target":3974},{"edgeType":"contains","source":13846,"target":2849},{"edgeType":"calls","source":2138,"target":1857},{"edgeType":"contains","source":4079,"target":3311},{"edgeType":"contains","source":9,"target":525},{"edgeType":"calls","source":478,"target":469},{"edgeType":"contains","source":8676,"target":8794},{"edgeType":"imports","source":7001,"target":7002},{"edgeType":"contains","source":8011,"target":8269},{"edgeType":"calls","source":11544,"target":11546},{"edgeType":"calls","source":12160,"target":3020},{"edgeType":"contains","source":8096,"target":347},{"edgeType":"contains","source":12775,"target":12794},{"edgeType":"calls","source":1727,"target":859},{"edgeType":"calls","source":1732,"target":1761},{"edgeType":"contains","source":7785,"target":7874},{"edgeType":"contains","source":5883,"target":6586},{"edgeType":"calls","source":8143,"target":8106},{"edgeType":"contains","source":6962,"target":6963},{"edgeType":"contains","source":2006,"target":2037},{"edgeType":"contains","source":7356,"target":7433},{"edgeType":"contains","source":1768,"target":2016},{"edgeType":"calls","source":12733,"target":12740},{"edgeType":"contains","source":9,"target":524},{"edgeType":"calls","source":2661,"target":2558},{"edgeType":"contains","source":9106,"target":748},{"edgeType":"contains","source":2269,"target":2341},{"edgeType":"contains","source":12214,"target":12216},{"edgeType":"contains","source":4746,"target":4830},{"edgeType":"contains","source":4743,"target":4923},{"edgeType":"contains","source":2733,"target":2755},{"edgeType":"contains","source":11322,"target":11326},{"edgeType":"calls","source":4620,"target":4191},{"edgeType":"contains","source":3097,"target":3104},{"edgeType":"contains","source":899,"target":1477},{"edgeType":"calls","source":11172,"target":3000},{"edgeType":"imports","source":12554,"target":12437},{"edgeType":"contains","source":1768,"target":2021},{"edgeType":"calls","source":12076,"target":11973},{"edgeType":"contains","source":2006,"target":2043},{"edgeType":"contains","source":13797,"target":13879},{"edgeType":"contains","source":9,"target":527},{"edgeType":"contains","source":3890,"target":3891},{"edgeType":"contains","source":12214,"target":12215},{"edgeType":"contains","source":2527,"target":2804},{"edgeType":"contains","source":4510,"target":4754},{"edgeType":"calls","source":3147,"target":1230},{"edgeType":"calls","source":5168,"target":5173},{"edgeType":"contains","source":2998,"target":3003},{"edgeType":"contains","source":1603,"target":795},{"edgeType":"contains","source":5043,"target":5143},{"edgeType":"contains","source":11289,"target":11293},{"edgeType":"contains","source":7356,"target":7427},{"edgeType":"calls","source":4620,"target":4190},{"edgeType":"contains","source":1768,"target":2022},{"edgeType":"calls","source":3911,"target":3973},{"edgeType":"calls","source":12380,"target":436},{"edgeType":"contains","source":1346,"target":1363},{"edgeType":"contains","source":10301,"target":11267},{"edgeType":"contains","source":13797,"target":13878},{"edgeType":"contains","source":2006,"target":2044},{"edgeType":"contains","source":6960,"target":7018},{"edgeType":"contains","source":1,"target":2888},{"edgeType":"contains","source":9,"target":526},{"edgeType":"contains","source":2527,"target":2805},{"edgeType":"contains","source":12279,"target":12313},{"edgeType":"calls","source":13269,"target":13043},{"edgeType":"calls","source":11314,"target":11284},{"edgeType":"contains","source":899,"target":1479},{"edgeType":"contains","source":12775,"target":12791},{"edgeType":"contains","source":3689,"target":3777},{"edgeType":"contains","source":11289,"target":11290},{"edgeType":"contains","source":9106,"target":9202},{"edgeType":"contains","source":1603,"target":1849},{"edgeType":"calls","source":270,"target":570},{"edgeType":"contains","source":13797,"target":13877},{"edgeType":"calls","source":7052,"target":7048},{"edgeType":"contains","source":10461,"target":10532},{"edgeType":"calls","source":5762,"target":5783},{"edgeType":"contains","source":12279,"target":12312},{"edgeType":"contains","source":9,"target":529},{"edgeType":"contains","source":1,"target":2891},{"edgeType":"contains","source":122,"target":197},{"edgeType":"contains","source":12938,"target":13023},{"edgeType":"calls","source":973,"target":975},{"edgeType":"contains","source":1,"target":5005},{"edgeType":"contains","source":10826,"target":10844},{"edgeType":"calls","source":1293,"target":568},{"edgeType":"contains","source":3016,"target":3500},{"edgeType":"contains","source":11454,"target":11461},{"edgeType":"calls","source":4641,"target":3537},{"edgeType":"contains","source":5939,"target":5903},{"edgeType":"contains","source":11322,"target":11325},{"edgeType":"calls","source":3911,"target":3971},{"edgeType":"contains","source":884,"target":886},{"edgeType":"contains","source":7785,"target":7870},{"edgeType":"imports","source":6020,"target":420},{"edgeType":"calls","source":1964,"target":1964},{"edgeType":"calls","source":12341,"target":12213},{"edgeType":"contains","source":4746,"target":4834},{"edgeType":"contains","source":9,"target":528},{"edgeType":"imports","source":12554,"target":12441},{"edgeType":"contains","source":9106,"target":9200},{"edgeType":"contains","source":9144,"target":9079},{"edgeType":"contains","source":2533,"target":2617},{"edgeType":"contains","source":2527,"target":2803},{"edgeType":"calls","source":5762,"target":5782},{"edgeType":"contains","source":12938,"target":13022},{"edgeType":"calls","source":1143,"target":989},{"edgeType":"contains","source":12775,"target":12790},{"edgeType":"contains","source":4510,"target":4751},{"edgeType":"calls","source":9397,"target":9402},{"edgeType":"contains","source":1,"target":6031},{"edgeType":"contains","source":4944,"target":5013},{"edgeType":"calls","source":4620,"target":4220},{"edgeType":"imports","source":1511,"target":655},{"edgeType":"calls","source":12731,"target":12780},{"edgeType":"calls","source":1968,"target":1868},{"edgeType":"contains","source":6829,"target":6830},{"edgeType":"calls","source":11876,"target":11802},{"edgeType":"contains","source":7125,"target":7167},{"edgeType":"calls","source":4514,"target":4335},{"edgeType":"contains","source":12741,"target":12769},{"edgeType":"imports","source":7072,"target":563},{"edgeType":"contains","source":10892,"target":10894},{"edgeType":"calls","source":12446,"target":12101},{"edgeType":"contains","source":2527,"target":2775},{"edgeType":"calls","source":7745,"target":7731},{"edgeType":"calls","source":1732,"target":1784},{"edgeType":"contains","source":2399,"target":2515},{"edgeType":"contains","source":9,"target":498},{"edgeType":"calls","source":1436,"target":1447},{"edgeType":"contains","source":13798,"target":13827},{"edgeType":"contains","source":13797,"target":13858},{"edgeType":"calls","source":514,"target":431},{"edgeType":"contains","source":7018,"target":7314},{"edgeType":"contains","source":4944,"target":5012},{"edgeType":"calls","source":6721,"target":6708},{"edgeType":"calls","source":7878,"target":7838},{"edgeType":"imports","source":5213,"target":1112},{"edgeType":"contains","source":9465,"target":2277},{"edgeType":"contains","source":12741,"target":12768},{"edgeType":"contains","source":7125,"target":7168},{"edgeType":"contains","source":9476,"target":9335},{"edgeType":"calls","source":9958,"target":436},{"edgeType":"calls","source":9230,"target":9263},{"edgeType":"contains","source":9,"target":497},{"edgeType":"contains","source":7853,"target":7854},{"edgeType":"contains","source":13798,"target":13826},{"edgeType":"contains","source":7951,"target":7987},{"edgeType":"contains","source":7018,"target":7315},{"edgeType":"contains","source":12152,"target":2486},{"edgeType":"contains","source":2896,"target":2962},{"edgeType":"contains","source":4944,"target":5011},{"edgeType":"calls","source":6033,"target":5868},{"edgeType":"imports","source":7001,"target":652},{"edgeType":"contains","source":4841,"target":5033},{"edgeType":"contains","source":9465,"target":2280},{"edgeType":"contains","source":4913,"target":4915},{"edgeType":"imports","source":5213,"target":1113},{"edgeType":"contains","source":12741,"target":12767},{"edgeType":"contains","source":8778,"target":8779},{"edgeType":"contains","source":12901,"target":13093},{"edgeType":"contains","source":4743,"target":4899},{"edgeType":"contains","source":13798,"target":13825},{"edgeType":"calls","source":7392,"target":7049},{"edgeType":"calls","source":3583,"target":3596},{"edgeType":"calls","source":7507,"target":1371},{"edgeType":"contains","source":10461,"target":10512},{"edgeType":"contains","source":10660,"target":10685},{"edgeType":"contains","source":12741,"target":12766},{"edgeType":"contains","source":4913,"target":4914},{"edgeType":"calls","source":11947,"target":11714},{"edgeType":"calls","source":10290,"target":10230},{"edgeType":"calls","source":11811,"target":11701},{"edgeType":"calls","source":2261,"target":2298},{"edgeType":"calls","source":12545,"target":10088},{"edgeType":"calls","source":709,"target":731},{"edgeType":"contains","source":8147,"target":8255},{"edgeType":"contains","source":13798,"target":13824},{"edgeType":"calls","source":5816,"target":4137},{"edgeType":"calls","source":9108,"target":8819},{"edgeType":"contains","source":11224,"target":11168},{"edgeType":"calls","source":12409,"target":568},{"edgeType":"calls","source":3387,"target":3328},{"edgeType":"calls","source":11544,"target":11527},{"edgeType":"calls","source":2493,"target":2502},{"edgeType":"contains","source":5043,"target":5119},{"edgeType":"contains","source":7018,"target":7309},{"edgeType":"contains","source":3102,"target":2924},{"edgeType":"calls","source":12062,"target":2869},{"edgeType":"contains","source":2896,"target":2968},{"edgeType":"calls","source":709,"target":725},{"edgeType":"calls","source":4757,"target":1026},{"edgeType":"contains","source":9465,"target":2274},{"edgeType":"contains","source":9664,"target":9846},{"edgeType":"calls","source":12404,"target":12350},{"edgeType":"contains","source":8676,"target":8763},{"edgeType":"contains","source":9999,"target":10033},{"edgeType":"calls","source":7391,"target":7082},{"edgeType":"calls","source":5762,"target":5810},{"edgeType":"contains","source":6203,"target":6148},{"edgeType":"calls","source":1369,"target":1405},{"edgeType":"contains","source":7785,"target":7843},{"edgeType":"imports","source":11096,"target":11124},{"edgeType":"imports","source":12432,"target":11984},{"edgeType":"contains","source":3360,"target":3382},{"edgeType":"contains","source":685,"target":686},{"edgeType":"contains","source":4639,"target":6015},{"edgeType":"contains","source":2765,"target":2802},{"edgeType":"calls","source":12311,"target":436},{"edgeType":"calls","source":11873,"target":11900},{"edgeType":"contains","source":13072,"target":13074},{"edgeType":"contains","source":4944,"target":5016},{"edgeType":"contains","source":10839,"target":10419},{"edgeType":"contains","source":4639,"target":6014},{"edgeType":"contains","source":11713,"target":9751},{"edgeType":"contains","source":9664,"target":9845},{"edgeType":"calls","source":10801,"target":733},{"edgeType":"calls","source":313,"target":316},{"edgeType":"contains","source":6762,"target":6789},{"edgeType":"calls","source":12370,"target":12348},{"edgeType":"imports","source":12355,"target":12257},{"edgeType":"contains","source":2006,"target":2019},{"edgeType":"contains","source":13797,"target":13853},{"edgeType":"contains","source":1940,"target":1951},{"edgeType":"calls","source":5762,"target":5809},{"edgeType":"contains","source":4944,"target":5015},{"edgeType":"calls","source":7249,"target":7258},{"edgeType":"contains","source":2733,"target":2734},{"edgeType":"contains","source":2766,"target":2768},{"edgeType":"contains","source":4746,"target":4811},{"edgeType":"contains","source":5043,"target":5117},{"edgeType":"contains","source":7357,"target":7372},{"edgeType":"contains","source":1205,"target":2535},{"edgeType":"calls","source":773,"target":857},{"edgeType":"imports","source":3763,"target":3786},{"edgeType":"contains","source":11019,"target":11178},{"edgeType":"imports","source":2840,"target":2788},{"edgeType":"contains","source":13797,"target":13852},{"edgeType":"contains","source":7951,"target":7986},{"edgeType":"contains","source":12207,"target":8177},{"edgeType":"contains","source":3724,"target":3725},{"edgeType":"contains","source":4185,"target":4232},{"edgeType":"contains","source":10301,"target":11239},{"edgeType":"contains","source":9,"target":504},{"edgeType":"calls","source":4018,"target":3850},{"edgeType":"contains","source":4944,"target":5014},{"edgeType":"calls","source":1866,"target":1856},{"edgeType":"contains","source":2849,"target":2310},{"edgeType":"calls","source":6106,"target":4657},{"edgeType":"calls","source":11874,"target":11867},{"edgeType":"contains","source":4746,"target":4810},{"edgeType":"contains","source":11019,"target":11180},{"edgeType":"contains","source":7159,"target":7169},{"edgeType":"contains","source":4913,"target":4918},{"edgeType":"calls","source":4675,"target":4622},{"edgeType":"imports","source":12617,"target":12593},{"edgeType":"calls","source":8047,"target":491},{"edgeType":"contains","source":7125,"target":7166},{"edgeType":"contains","source":1831,"target":2157},{"edgeType":"calls","source":12412,"target":12101},{"edgeType":"contains","source":3921,"target":3959},{"edgeType":"imports","source":3763,"target":3787},{"edgeType":"calls","source":11642,"target":11659},{"edgeType":"contains","source":9,"target":503},{"edgeType":"calls","source":8998,"target":9062},{"edgeType":"calls","source":1866,"target":1855},{"edgeType":"imports","source":3763,"target":3771},{"edgeType":"contains","source":3360,"target":3387},{"edgeType":"calls","source":11316,"target":11200},{"edgeType":"contains","source":7163,"target":2826},{"edgeType":"contains","source":8942,"target":8986},{"edgeType":"contains","source":13798,"target":13836},{"edgeType":"contains","source":4944,"target":5021},{"edgeType":"calls","source":4613,"target":4429},{"edgeType":"contains","source":2527,"target":2784},{"edgeType":"calls","source":5033,"target":5150},{"edgeType":"imports","source":11616,"target":11905},{"edgeType":"imports","source":12298,"target":11905},{"edgeType":"contains","source":8613,"target":8615},{"edgeType":"contains","source":3152,"target":3492},{"edgeType":"contains","source":8096,"target":2444},{"edgeType":"calls","source":6688,"target":6682},{"edgeType":"calls","source":4722,"target":4220},{"edgeType":"contains","source":13798,"target":13835},{"edgeType":"contains","source":13797,"target":13866},{"edgeType":"contains","source":13766,"target":13770},{"edgeType":"imports","source":2244,"target":2251},{"edgeType":"imports","source":7583,"target":568},{"edgeType":"contains","source":2896,"target":2973},{"edgeType":"contains","source":4944,"target":5020},{"edgeType":"calls","source":5098,"target":4191},{"edgeType":"calls","source":7878,"target":7846},{"edgeType":"contains","source":8613,"target":8614},{"edgeType":"contains","source":9999,"target":10046},{"edgeType":"contains","source":3016,"target":3481},{"edgeType":"calls","source":445,"target":448},{"edgeType":"calls","source":4391,"target":740},{"edgeType":"calls","source":1978,"target":491},{"edgeType":"contains","source":11183,"target":10338},{"edgeType":"calls","source":12408,"target":12231},{"edgeType":"contains","source":7785,"target":7856},{"edgeType":"imports","source":3763,"target":3773},{"edgeType":"calls","source":9108,"target":8828},{"edgeType":"contains","source":12938,"target":13011},{"edgeType":"contains","source":5961,"target":6265},{"edgeType":"contains","source":4639,"target":6018},{"edgeType":"contains","source":8678,"target":8716},{"edgeType":"calls","source":1172,"target":1169},{"edgeType":"contains","source":2601,"target":2602},{"edgeType":"calls","source":12415,"target":2498},{"edgeType":"contains","source":4944,"target":5019},{"edgeType":"calls","source":7877,"target":7878},{"edgeType":"contains","source":10461,"target":10519},{"edgeType":"contains","source":4746,"target":4815},{"edgeType":"calls","source":982,"target":717},{"edgeType":"contains","source":4510,"target":4731},{"edgeType":"contains","source":12775,"target":12779},{"edgeType":"contains","source":7785,"target":7859},{"edgeType":"contains","source":1,"target":6041},{"edgeType":"calls","source":3911,"target":3990},{"edgeType":"calls","source":3882,"target":3832},{"edgeType":"calls","source":10694,"target":3000},{"edgeType":"calls","source":12602,"target":12556},{"edgeType":"contains","source":3889,"target":3899},{"edgeType":"contains","source":9465,"target":9687},{"edgeType":"contains","source":3691,"target":3695},{"edgeType":"contains","source":7488,"target":7551},{"edgeType":"calls","source":8827,"target":627},{"edgeType":"contains","source":13798,"target":13833},{"edgeType":"contains","source":13797,"target":13864},{"edgeType":"contains","source":10892,"target":10901},{"edgeType":"contains","source":11082,"target":11353},{"edgeType":"imports","source":899,"target":607},{"edgeType":"contains","source":10141,"target":9870},{"edgeType":"contains","source":12906,"target":12945},{"edgeType":"contains","source":4639,"target":6017},{"edgeType":"contains","source":10826,"target":10833},{"edgeType":"imports","source":7694,"target":7698},{"edgeType":"contains","source":4649,"target":4650},{"edgeType":"contains","source":4746,"target":4814},{"edgeType":"calls","source":279,"target":311},{"edgeType":"contains","source":12044,"target":12184},{"edgeType":"calls","source":8802,"target":8800},{"edgeType":"calls","source":11900,"target":2608},{"edgeType":"contains","source":12709,"target":12710},{"edgeType":"contains","source":3689,"target":3756},{"edgeType":"contains","source":11712,"target":11904},{"edgeType":"calls","source":3583,"target":3586},{"edgeType":"calls","source":1568,"target":1571},{"edgeType":"calls","source":2923,"target":2905},{"edgeType":"contains","source":12279,"target":12297},{"edgeType":"calls","source":1558,"target":824},{"edgeType":"contains","source":12519,"target":12256},{"edgeType":"contains","source":3016,"target":3484},{"edgeType":"calls","source":8768,"target":8800},{"edgeType":"contains","source":12741,"target":12774},{"edgeType":"contains","source":12775,"target":12777},{"edgeType":"calls","source":2526,"target":2528},{"edgeType":"imports","source":7019,"target":1144},{"edgeType":"contains","source":4944,"target":5025},{"edgeType":"contains","source":2896,"target":2976},{"edgeType":"contains","source":12044,"target":12183},{"edgeType":"contains","source":1144,"target":1264},{"edgeType":"calls","source":12347,"target":2498},{"edgeType":"calls","source":4137,"target":4381},{"edgeType":"contains","source":11712,"target":11903},{"edgeType":"imports","source":7128,"target":7278},{"edgeType":"contains","source":11019,"target":11190},{"edgeType":"contains","source":13798,"target":13831},{"edgeType":"contains","source":13797,"target":13862},{"edgeType":"contains","source":3360,"target":3390},{"edgeType":"contains","source":2601,"target":2609},{"edgeType":"calls","source":9760,"target":9758},{"edgeType":"imports","source":3763,"target":3776},{"edgeType":"imports","source":13053,"target":5409},{"edgeType":"contains","source":1831,"target":2167},{"edgeType":"contains","source":3921,"target":3969},{"edgeType":"calls","source":989,"target":492},{"edgeType":"contains","source":10892,"target":10899},{"edgeType":"contains","source":10461,"target":10518},{"edgeType":"contains","source":12739,"target":12834},{"edgeType":"contains","source":12741,"target":12772},{"edgeType":"contains","source":12741,"target":12773},{"edgeType":"calls","source":1138,"target":1158},{"edgeType":"contains","source":5043,"target":5126},{"edgeType":"contains","source":12044,"target":12182},{"edgeType":"contains","source":2896,"target":2977},{"edgeType":"contains","source":4944,"target":5024},{"edgeType":"contains","source":9698,"target":9860},{"edgeType":"contains","source":11456,"target":11384},{"edgeType":"imports","source":12276,"target":11527},{"edgeType":"contains","source":7853,"target":7858},{"edgeType":"contains","source":6342,"target":2906},{"edgeType":"contains","source":13798,"target":13830},{"edgeType":"contains","source":3360,"target":3389},{"edgeType":"contains","source":10461,"target":10515},{"edgeType":"calls","source":2131,"target":2086},{"edgeType":"contains","source":4185,"target":4240},{"edgeType":"contains","source":4944,"target":5023},{"edgeType":"calls","source":11775,"target":11772},{"edgeType":"imports","source":7128,"target":7281},{"edgeType":"contains","source":2527,"target":2786},{"edgeType":"contains","source":8591,"target":9294},{"edgeType":"contains","source":12741,"target":12771},{"edgeType":"contains","source":12044,"target":12181},{"edgeType":"contains","source":3016,"target":3482},{"edgeType":"calls","source":8768,"target":8802},{"edgeType":"calls","source":12404,"target":12356},{"edgeType":"imports","source":3763,"target":3778},{"edgeType":"imports","source":1672,"target":952},{"edgeType":"calls","source":10420,"target":3042},{"edgeType":"contains","source":4746,"target":4818},{"edgeType":"contains","source":7163,"target":2825},{"edgeType":"contains","source":12938,"target":13006},{"edgeType":"contains","source":12741,"target":12770},{"edgeType":"contains","source":8591,"target":9293},{"edgeType":"contains","source":1,"target":13444},{"edgeType":"calls","source":11819,"target":3010},{"edgeType":"calls","source":6622,"target":6621},{"edgeType":"contains","source":8096,"target":2441},{"edgeType":"contains","source":5939,"target":5887},{"edgeType":"contains","source":12044,"target":12180},{"edgeType":"contains","source":12246,"target":12260},{"edgeType":"contains","source":9852,"target":10369},{"edgeType":"calls","source":2592,"target":2595},{"edgeType":"contains","source":3260,"target":3318},{"edgeType":"contains","source":1213,"target":1240},{"edgeType":"contains","source":8096,"target":327},{"edgeType":"contains","source":13798,"target":13828},{"edgeType":"contains","source":13797,"target":13859},{"edgeType":"contains","source":8077,"target":8293},{"edgeType":"contains","source":7357,"target":7358},{"edgeType":"contains","source":1836,"target":1982},{"edgeType":"contains","source":11741,"target":414},{"edgeType":"calls","source":5795,"target":5799},{"edgeType":"contains","source":22,"target":78},{"edgeType":"contains","source":11618,"target":11626},{"edgeType":"imports","source":7531,"target":7524},{"edgeType":"calls","source":3650,"target":3586},{"edgeType":"contains","source":4185,"target":4213},{"edgeType":"contains","source":1603,"target":1806},{"edgeType":"calls","source":12114,"target":11806},{"edgeType":"calls","source":12731,"target":12764},{"edgeType":"contains","source":4841,"target":5018},{"edgeType":"calls","source":4778,"target":2444},{"edgeType":"imports","source":12554,"target":11426},{"edgeType":"contains","source":9173,"target":9199},{"edgeType":"contains","source":11110,"target":10461},{"edgeType":"calls","source":5868,"target":364},{"edgeType":"calls","source":11840,"target":11845},{"edgeType":"contains","source":22,"target":77},{"edgeType":"contains","source":1836,"target":1983},{"edgeType":"calls","source":9230,"target":9246},{"edgeType":"calls","source":1467,"target":436},{"edgeType":"calls","source":10853,"target":10731},{"edgeType":"calls","source":3493,"target":3169},{"edgeType":"contains","source":7984,"target":8004},{"edgeType":"contains","source":10429,"target":10433},{"edgeType":"contains","source":8381,"target":8382},{"edgeType":"imports","source":1511,"target":704},{"edgeType":"contains","source":907,"target":1182},{"edgeType":"calls","source":10519,"target":10515},{"edgeType":"contains","source":3360,"target":3362},{"edgeType":"contains","source":9465,"target":2260},{"edgeType":"contains","source":11019,"target":11169},{"edgeType":"calls","source":12446,"target":2572},{"edgeType":"contains","source":1836,"target":1980},{"edgeType":"contains","source":1831,"target":2135},{"edgeType":"contains","source":22,"target":80},{"edgeType":"contains","source":11712,"target":11881},{"edgeType":"calls","source":5796,"target":5766},{"edgeType":"calls","source":5762,"target":5763},{"edgeType":"contains","source":9664,"target":9836},{"edgeType":"contains","source":4417,"target":4419},{"edgeType":"calls","source":4011,"target":4020},{"edgeType":"contains","source":4384,"target":4385},{"edgeType":"contains","source":4944,"target":4994},{"edgeType":"contains","source":10429,"target":10430},{"edgeType":"contains","source":3492,"target":3497},{"edgeType":"calls","source":4858,"target":4190},{"edgeType":"contains","source":1144,"target":1237},{"edgeType":"contains","source":7127,"target":7090},{"edgeType":"calls","source":3622,"target":3396},{"edgeType":"imports","source":3952,"target":1144},{"edgeType":"calls","source":773,"target":811},{"edgeType":"contains","source":22,"target":79},{"edgeType":"calls","source":7195,"target":2570},{"edgeType":"calls","source":1170,"target":1188},{"edgeType":"contains","source":3741,"target":3176},{"edgeType":"calls","source":10849,"target":10853},{"edgeType":"contains","source":8281,"target":8313},{"edgeType":"contains","source":4944,"target":4993},{"edgeType":"calls","source":6721,"target":6694},{"edgeType":"calls","source":6687,"target":6691},{"edgeType":"contains","source":13104,"target":13124},{"edgeType":"contains","source":9465,"target":2262},{"edgeType":"calls","source":445,"target":409},{"edgeType":"contains","source":9028,"target":9467},{"edgeType":"calls","source":991,"target":390},{"edgeType":"contains","source":10825,"target":10836},{"edgeType":"imports","source":12259,"target":12110},{"edgeType":"contains","source":7984,"target":8001},{"edgeType":"calls","source":3488,"target":3319},{"edgeType":"calls","source":8768,"target":8775},{"edgeType":"calls","source":1897,"target":1901},{"edgeType":"calls","source":9230,"target":9251},{"edgeType":"contains","source":10301,"target":11224},{"edgeType":"calls","source":2599,"target":2338},{"edgeType":"contains","source":8480,"target":8481},{"edgeType":"contains","source":8513,"target":8515},{"edgeType":"calls","source":477,"target":469},{"edgeType":"contains","source":4285,"target":4289},{"edgeType":"contains","source":10583,"target":10939},{"edgeType":"calls","source":11642,"target":8473},{"edgeType":"calls","source":1104,"target":1115},{"edgeType":"calls","source":6299,"target":6036},{"edgeType":"calls","source":8282,"target":585},{"edgeType":"calls","source":11829,"target":11132},{"edgeType":"contains","source":7455,"target":7486},{"edgeType":"calls","source":2756,"target":2756},{"edgeType":"contains","source":4944,"target":5000},{"edgeType":"contains","source":7356,"target":7384},{"edgeType":"contains","source":1213,"target":1214},{"edgeType":"contains","source":12938,"target":12983},{"edgeType":"imports","source":8096,"target":585},{"edgeType":"contains","source":22,"target":81},{"edgeType":"contains","source":7984,"target":8000},{"edgeType":"contains","source":9925,"target":10197},{"edgeType":"contains","source":12249,"target":12144},{"edgeType":"contains","source":4944,"target":4999},{"edgeType":"contains","source":8513,"target":8514},{"edgeType":"calls","source":12700,"target":12671},{"edgeType":"calls","source":11614,"target":3000},{"edgeType":"contains","source":1205,"target":2522},{"edgeType":"calls","source":1185,"target":717},{"edgeType":"calls","source":4996,"target":4137},{"edgeType":"contains","source":11618,"target":11620},{"edgeType":"calls","source":3020,"target":3026},{"edgeType":"contains","source":12938,"target":12982},{"edgeType":"contains","source":6663,"target":6672},{"edgeType":"contains","source":1,"target":13420},{"edgeType":"contains","source":7984,"target":8003},{"edgeType":"calls","source":1632,"target":1662},{"edgeType":"contains","source":6287,"target":6700},{"edgeType":"contains","source":4944,"target":4998},{"edgeType":"contains","source":7780,"target":7985},{"edgeType":"contains","source":123,"target":125},{"edgeType":"contains","source":8414,"target":8415},{"edgeType":"contains","source":4285,"target":4287},{"edgeType":"contains","source":2896,"target":2949},{"edgeType":"calls","source":1338,"target":1262},{"edgeType":"contains","source":3671,"target":3237},{"edgeType":"contains","source":10660,"target":10664},{"edgeType":"contains","source":7018,"target":7294},{"edgeType":"calls","source":773,"target":808},{"edgeType":"calls","source":741,"target":743},{"edgeType":"calls","source":2327,"target":2312},{"edgeType":"contains","source":7456,"target":7459},{"edgeType":"contains","source":1213,"target":1216},{"edgeType":"contains","source":10825,"target":10835},{"edgeType":"calls","source":4473,"target":4492},{"edgeType":"calls","source":6638,"target":6100},{"edgeType":"contains","source":7923,"target":7779},{"edgeType":"imports","source":5741,"target":5939},{"edgeType":"contains","source":7984,"target":8002},{"edgeType":"calls","source":6034,"target":5782},{"edgeType":"contains","source":8281,"target":8308},{"edgeType":"contains","source":8244,"target":8398},{"edgeType":"contains","source":8480,"target":8482},{"edgeType":"contains","source":123,"target":124},{"edgeType":"contains","source":10583,"target":10938},{"edgeType":"calls","source":12731,"target":12765},{"edgeType":"calls","source":2501,"target":2204},{"edgeType":"contains","source":11019,"target":11163},{"edgeType":"contains","source":9465,"target":2258},{"edgeType":"calls","source":7481,"target":7451},{"edgeType":"contains","source":3016,"target":3464},{"edgeType":"contains","source":12741,"target":12761},{"edgeType":"contains","source":1213,"target":1219},{"edgeType":"contains","source":1831,"target":2145},{"edgeType":"contains","source":11255,"target":11260},{"edgeType":"calls","source":2111,"target":549},{"edgeType":"contains","source":9664,"target":9842},{"edgeType":"contains","source":1205,"target":2525},{"edgeType":"imports","source":7001,"target":7033},{"edgeType":"contains","source":10461,"target":10505},{"edgeType":"contains","source":12147,"target":12149},{"edgeType":"contains","source":8084,"target":8085},{"edgeType":"contains","source":8381,"target":8391},{"edgeType":"contains","source":4944,"target":5004},{"edgeType":"calls","source":4982,"target":4568},{"edgeType":"contains","source":12741,"target":12760},{"edgeType":"imports","source":891,"target":907},{"edgeType":"contains","source":7357,"target":7367},{"edgeType":"imports","source":10514,"target":10176},{"edgeType":"calls","source":2062,"target":2069},{"edgeType":"contains","source":11322,"target":11298},{"edgeType":"contains","source":9664,"target":9841},{"edgeType":"contains","source":8281,"target":8319},{"edgeType":"contains","source":1205,"target":2526},{"edgeType":"contains","source":2269,"target":2310},{"edgeType":"contains","source":12147,"target":12148},{"edgeType":"contains","source":853,"target":750},{"edgeType":"contains","source":4944,"target":5003},{"edgeType":"imports","source":2609,"target":2613},{"edgeType":"contains","source":5961,"target":6248},{"edgeType":"calls","source":8163,"target":8509},{"edgeType":"contains","source":1213,"target":1221},{"edgeType":"contains","source":7018,"target":7307},{"edgeType":"contains","source":1603,"target":1812},{"edgeType":"calls","source":6068,"target":5782},{"edgeType":"contains","source":4185,"target":4220},{"edgeType":"contains","source":11019,"target":11174},{"edgeType":"contains","source":6203,"target":6146},{"edgeType":"contains","source":8778,"target":8770},{"edgeType":"calls","source":11415,"target":11284},{"edgeType":"contains","source":123,"target":129},{"edgeType":"imports","source":10032,"target":2920},{"edgeType":"contains","source":1205,"target":2523},{"edgeType":"contains","source":12279,"target":12283},{"edgeType":"calls","source":1666,"target":1660},{"edgeType":"imports","source":4639,"target":4151},{"edgeType":"contains","source":7780,"target":7996},{"edgeType":"calls","source":8178,"target":8045},{"edgeType":"contains","source":1213,"target":1220},{"edgeType":"contains","source":11082,"target":12394},{"edgeType":"calls","source":6721,"target":6702},{"edgeType":"calls","source":6457,"target":6430},{"edgeType":"calls","source":6378,"target":4651},{"edgeType":"contains","source":9028,"target":9475},{"edgeType":"contains","source":1205,"target":2524},{"edgeType":"calls","source":11863,"target":568},{"edgeType":"contains","source":6203,"target":6147},{"edgeType":"contains","source":2765,"target":2787},{"edgeType":"contains","source":8678,"target":8693},{"edgeType":"contains","source":12739,"target":12819},{"edgeType":"calls","source":1170,"target":1175},{"edgeType":"calls","source":8178,"target":8046},{"edgeType":"calls","source":1778,"target":1354},{"edgeType":"contains","source":7357,"target":7362},{"edgeType":"contains","source":7356,"target":7393},{"edgeType":"calls","source":12867,"target":12788},{"edgeType":"calls","source":1967,"target":1837},{"edgeType":"contains","source":11255,"target":11256},{"edgeType":"imports","source":1954,"target":717},{"edgeType":"calls","source":4011,"target":4010},{"edgeType":"calls","source":12579,"target":10088},{"edgeType":"contains","source":2006,"target":2010},{"edgeType":"contains","source":6960,"target":6984},{"edgeType":"contains","source":10301,"target":11233},{"edgeType":"contains","source":1205,"target":2529},{"edgeType":"calls","source":2062,"target":2064},{"edgeType":"contains","source":8381,"target":8387},{"edgeType":"contains","source":8244,"target":8406},{"edgeType":"calls","source":12060,"target":9264},{"edgeType":"contains","source":123,"target":131},{"edgeType":"contains","source":2527,"target":2771},{"edgeType":"contains","source":12938,"target":12992},{"edgeType":"contains","source":12906,"target":12927},{"edgeType":"calls","source":7884,"target":7646},{"edgeType":"imports","source":7001,"target":7037},{"edgeType":"contains","source":8591,"target":9276},{"edgeType":"contains","source":6912,"target":7415},{"edgeType":"contains","source":12551,"target":12305},{"edgeType":"calls","source":10830,"target":10399},{"edgeType":"contains","source":8678,"target":8692},{"edgeType":"calls","source":1104,"target":1106},{"edgeType":"calls","source":2495,"target":2383},{"edgeType":"contains","source":9465,"target":2265},{"edgeType":"calls","source":6522,"target":6531},{"edgeType":"contains","source":2006,"target":2011},{"edgeType":"contains","source":11019,"target":11173},{"edgeType":"calls","source":2062,"target":2065},{"edgeType":"contains","source":1940,"target":1943},{"edgeType":"contains","source":123,"target":130},{"edgeType":"imports","source":5342,"target":329},{"edgeType":"contains","source":8512,"target":8553},{"edgeType":"contains","source":2527,"target":2772},{"edgeType":"calls","source":5407,"target":5129},{"edgeType":"contains","source":9465,"target":2264},{"edgeType":"contains","source":4639,"target":6006},{"edgeType":"contains","source":1,"target":13425},{"edgeType":"imports","source":7001,"target":7036},{"edgeType":"contains","source":12741,"target":12756},{"edgeType":"contains","source":7951,"target":7977},{"edgeType":"calls","source":12248,"target":11891},{"edgeType":"contains","source":9465,"target":2268},{"edgeType":"contains","source":3016,"target":3466},{"edgeType":"contains","source":7125,"target":7157},{"edgeType":"contains","source":8077,"target":8299},{"edgeType":"calls","source":4757,"target":4137},{"edgeType":"contains","source":7488,"target":7531},{"edgeType":"calls","source":2660,"target":436},{"edgeType":"contains","source":8281,"target":8318},{"edgeType":"contains","source":9664,"target":9840},{"edgeType":"contains","source":8244,"target":8408},{"edgeType":"imports","source":10884,"target":1881},{"edgeType":"contains","source":4131,"target":4841},{"edgeType":"contains","source":2006,"target":2008},{"edgeType":"calls","source":4774,"target":4668},{"edgeType":"calls","source":5495,"target":4514},{"edgeType":"contains","source":2533,"target":2583},{"edgeType":"contains","source":12741,"target":12755},{"edgeType":"calls","source":4605,"target":4620},{"edgeType":"imports","source":13053,"target":11803},{"edgeType":"contains","source":7125,"target":7158},{"edgeType":"contains","source":11618,"target":11629},{"edgeType":"contains","source":1831,"target":2148},{"edgeType":"contains","source":5342,"target":5352},{"edgeType":"calls","source":12604,"target":2970},{"edgeType":"contains","source":9664,"target":9839},{"edgeType":"contains","source":8281,"target":8317},{"edgeType":"contains","source":1940,"target":1941},{"edgeType":"contains","source":1205,"target":2528},{"edgeType":"calls","source":7107,"target":2140},{"edgeType":"contains","source":2006,"target":2009},{"edgeType":"contains","source":123,"target":132},{"edgeType":"contains","source":12741,"target":12754},{"edgeType":"imports","source":2840,"target":2845},{"edgeType":"contains","source":907,"target":1167},{"edgeType":"calls","source":4620,"target":4187},{"edgeType":"contains","source":12377,"target":12393},{"edgeType":"calls","source":2691,"target":2677},{"edgeType":"imports","source":7128,"target":7316},{"edgeType":"contains","source":9465,"target":2245},{"edgeType":"contains","source":3476,"target":3978},{"edgeType":"calls","source":775,"target":764},{"edgeType":"contains","source":12919,"target":13561},{"edgeType":"contains","source":9173,"target":9183},{"edgeType":"calls","source":12094,"target":11353},{"edgeType":"contains","source":1205,"target":2500},{"edgeType":"imports","source":3234,"target":3298},{"edgeType":"contains","source":13500,"target":13519},{"edgeType":"calls","source":3024,"target":2925},{"edgeType":"imports","source":3763,"target":3813},{"edgeType":"contains","source":9664,"target":9817},{"edgeType":"contains","source":2527,"target":2742},{"edgeType":"imports","source":13843,"target":11617},{"edgeType":"contains","source":7951,"target":7955},{"edgeType":"contains","source":9925,"target":10184},{"edgeType":"contains","source":7785,"target":7814},{"edgeType":"contains","source":8419,"target":8244},{"edgeType":"calls","source":3888,"target":454},{"edgeType":"calls","source":1143,"target":983},{"edgeType":"contains","source":907,"target":1166},{"edgeType":"contains","source":3476,"target":3977},{"edgeType":"contains","source":11289,"target":11239},{"edgeType":"contains","source":10583,"target":10927},{"edgeType":"calls","source":12378,"target":436},{"edgeType":"contains","source":9173,"target":9182},{"edgeType":"contains","source":12919,"target":13560},{"edgeType":"calls","source":2162,"target":2165},{"edgeType":"calls","source":12037,"target":436},{"edgeType":"contains","source":12377,"target":12392},{"edgeType":"contains","source":3855,"target":3856},{"edgeType":"calls","source":5815,"target":4137},{"edgeType":"contains","source":8066,"target":1218},{"edgeType":"contains","source":3016,"target":3437},{"edgeType":"contains","source":907,"target":1169},{"edgeType":"contains","source":4944,"target":4978},{"edgeType":"calls","source":1870,"target":1704},{"edgeType":"contains","source":10583,"target":10924},{"edgeType":"contains","source":9465,"target":2247},{"edgeType":"contains","source":12739,"target":12796},{"edgeType":"calls","source":230,"target":749},{"edgeType":"contains","source":9173,"target":9185},{"edgeType":"calls","source":576,"target":593},{"edgeType":"contains","source":7356,"target":7374},{"edgeType":"contains","source":8077,"target":8279},{"edgeType":"contains","source":3921,"target":3923},{"edgeType":"contains","source":3886,"target":3951},{"edgeType":"calls","source":2193,"target":2258},{"edgeType":"contains","source":2527,"target":2740},{"edgeType":"contains","source":2533,"target":2554},{"edgeType":"calls","source":1336,"target":1345},{"edgeType":"contains","source":12377,"target":12391},{"edgeType":"contains","source":10301,"target":11210},{"edgeType":"contains","source":4119,"target":4127},{"edgeType":"contains","source":2399,"target":2480},{"edgeType":"imports","source":3763,"target":3815},{"edgeType":"contains","source":907,"target":1168},{"edgeType":"contains","source":8381,"target":8367},{"edgeType":"contains","source":10583,"target":10925},{"edgeType":"calls","source":6093,"target":6088},{"edgeType":"contains","source":3886,"target":3949},{"edgeType":"contains","source":13104,"target":13108},{"edgeType":"contains","source":3557,"target":3578},{"edgeType":"contains","source":10704,"target":10345},{"edgeType":"contains","source":11318,"target":10338},{"edgeType":"contains","source":9173,"target":9184},{"edgeType":"contains","source":3476,"target":3975},{"edgeType":"calls","source":4654,"target":4187},{"edgeType":"contains","source":1205,"target":2499},{"edgeType":"imports","source":12077,"target":8230},{"edgeType":"contains","source":3886,"target":3950},{"edgeType":"calls","source":8906,"target":8706},{"edgeType":"contains","source":9664,"target":9818},{"edgeType":"contains","source":22,"target":63},{"edgeType":"contains","source":8244,"target":8386},{"edgeType":"calls","source":11854,"target":2936},{"edgeType":"imports","source":3781,"target":1144},{"edgeType":"contains","source":7951,"target":7956},{"edgeType":"contains","source":10583,"target":10922},{"edgeType":"contains","source":8478,"target":8526},{"edgeType":"contains","source":8160,"target":414},{"edgeType":"calls","source":1170,"target":1200},{"edgeType":"calls","source":1171,"target":1169},{"edgeType":"contains","source":7785,"target":7811},{"edgeType":"contains","source":3476,"target":3982},{"edgeType":"contains","source":3490,"target":3548},{"edgeType":"contains","source":907,"target":1171},{"edgeType":"calls","source":5033,"target":5122},{"edgeType":"calls","source":1534,"target":1543},{"edgeType":"calls","source":12336,"target":12311},{"edgeType":"contains","source":6917,"target":7235},{"edgeType":"imports","source":12355,"target":12289},{"edgeType":"calls","source":5895,"target":5882},{"edgeType":"contains","source":10032,"target":10034},{"edgeType":"contains","source":10367,"target":11276},{"edgeType":"contains","source":10461,"target":10476},{"edgeType":"contains","source":12377,"target":12389},{"edgeType":"imports","source":3763,"target":3817},{"edgeType":"contains","source":22,"target":66},{"edgeType":"contains","source":3855,"target":3861},{"edgeType":"contains","source":7854,"target":7785},{"edgeType":"contains","source":7090,"target":7159},{"edgeType":"contains","source":3476,"target":3981},{"edgeType":"contains","source":5883,"target":6522},{"edgeType":"contains","source":10583,"target":10923},{"edgeType":"calls","source":1369,"target":1372},{"edgeType":"contains","source":7587,"target":7606},{"edgeType":"calls","source":2785,"target":1874},{"edgeType":"contains","source":13104,"target":13106},{"edgeType":"contains","source":1836,"target":1971},{"edgeType":"contains","source":8147,"target":8216},{"edgeType":"contains","source":12919,"target":13555},{"edgeType":"calls","source":5168,"target":5164},{"edgeType":"contains","source":22,"target":65},{"edgeType":"contains","source":10032,"target":10035},{"edgeType":"calls","source":12865,"target":12825},{"edgeType":"imports","source":7072,"target":602},{"edgeType":"contains","source":7785,"target":7813},{"edgeType":"contains","source":8478,"target":8528},{"edgeType":"contains","source":6462,"target":6544},{"edgeType":"imports","source":12554,"target":12464},{"edgeType":"calls","source":6316,"target":2343},{"edgeType":"contains","source":3490,"target":3546},{"edgeType":"contains","source":3476,"target":3980},{"edgeType":"calls","source":6567,"target":6169},{"edgeType":"contains","source":2765,"target":2766},{"edgeType":"contains","source":6960,"target":6962},{"edgeType":"calls","source":7898,"target":1905},{"edgeType":"contains","source":11089,"target":11090},{"edgeType":"contains","source":13104,"target":13105},{"edgeType":"contains","source":907,"target":1173},{"edgeType":"contains","source":5042,"target":5115},{"edgeType":"contains","source":3262,"target":3214},{"edgeType":"contains","source":1836,"target":1968},{"edgeType":"calls","source":3650,"target":3596},{"edgeType":"calls","source":2230,"target":2164},{"edgeType":"contains","source":420,"target":414},{"edgeType":"contains","source":7951,"target":7953},{"edgeType":"imports","source":9852,"target":9553},{"edgeType":"calls","source":3525,"target":3243},{"edgeType":"calls","source":7390,"target":7082},{"edgeType":"contains","source":12377,"target":12387},{"edgeType":"contains","source":8478,"target":8527},{"edgeType":"imports","source":12432,"target":12019},{"edgeType":"contains","source":8591,"target":9252},{"edgeType":"contains","source":7785,"target":7812},{"edgeType":"contains","source":3476,"target":3979},{"edgeType":"contains","source":907,"target":1172},{"edgeType":"contains","source":1205,"target":2503},{"edgeType":"contains","source":1836,"target":1969},{"edgeType":"contains","source":13797,"target":13818},{"edgeType":"contains","source":9002,"target":739},{"edgeType":"calls","source":6638,"target":6084},{"edgeType":"contains","source":12377,"target":12386},{"edgeType":"calls","source":1395,"target":563},{"edgeType":"contains","source":7018,"target":7288},{"edgeType":"calls","source":9640,"target":1814},{"edgeType":"calls","source":12414,"target":2498},{"edgeType":"contains","source":12436,"target":12686},{"edgeType":"contains","source":4639,"target":5987},{"edgeType":"contains","source":9345,"target":9144},{"edgeType":"contains","source":12642,"target":12643},{"edgeType":"contains","source":2527,"target":2750},{"edgeType":"contains","source":10660,"target":10662},{"edgeType":"contains","source":7984,"target":7997},{"edgeType":"contains","source":12739,"target":12807},{"edgeType":"calls","source":1605,"target":1452},{"edgeType":"contains","source":9925,"target":10192},{"edgeType":"contains","source":9698,"target":9830},{"edgeType":"contains","source":3566,"target":3311},{"edgeType":"imports","source":12523,"target":2849},{"edgeType":"contains","source":3490,"target":3551},{"edgeType":"calls","source":1346,"target":1024},{"edgeType":"contains","source":11618,"target":11619},{"edgeType":"contains","source":11019,"target":11161},{"edgeType":"contains","source":2527,"target":2752},{"edgeType":"contains","source":907,"target":1174},{"edgeType":"contains","source":12436,"target":12685},{"edgeType":"contains","source":3855,"target":3864},{"edgeType":"contains","source":12739,"target":12806},{"edgeType":"contains","source":12741,"target":12744},{"edgeType":"contains","source":10583,"target":10936},{"edgeType":"contains","source":7090,"target":7171},{"edgeType":"contains","source":1510,"target":1511},{"edgeType":"contains","source":1836,"target":1975},{"edgeType":"calls","source":6922,"target":6795},{"edgeType":"contains","source":1603,"target":1799},{"edgeType":"calls","source":6823,"target":6693},{"edgeType":"contains","source":3490,"target":3550},{"edgeType":"contains","source":13798,"target":13801},{"edgeType":"calls","source":1237,"target":1235},{"edgeType":"contains","source":1,"target":2837},{"edgeType":"calls","source":844,"target":733},{"edgeType":"calls","source":7612,"target":7604},{"edgeType":"calls","source":1008,"target":935},{"edgeType":"contains","source":12436,"target":12684},{"edgeType":"contains","source":10583,"target":10932},{"edgeType":"contains","source":3855,"target":3863},{"edgeType":"contains","source":2527,"target":2748},{"edgeType":"calls","source":1659,"target":837},{"edgeType":"calls","source":5828,"target":5839},{"edgeType":"contains","source":12739,"target":12805},{"edgeType":"contains","source":12741,"target":12743},{"edgeType":"calls","source":2558,"target":2562},{"edgeType":"contains","source":7984,"target":7999},{"edgeType":"contains","source":7018,"target":7290},{"edgeType":"contains","source":3657,"target":3659},{"edgeType":"contains","source":1836,"target":1972},{"edgeType":"calls","source":12798,"target":12791},{"edgeType":"contains","source":7488,"target":7520},{"edgeType":"contains","source":12436,"target":12683},{"edgeType":"contains","source":11082,"target":12377},{"edgeType":"contains","source":3490,"target":3549},{"edgeType":"contains","source":3476,"target":3983},{"edgeType":"calls","source":3314,"target":1325},{"edgeType":"contains","source":12919,"target":13566},{"edgeType":"calls","source":773,"target":819},{"edgeType":"calls","source":7876,"target":7877},{"edgeType":"contains","source":12605,"target":12729},{"edgeType":"contains","source":10660,"target":10661},{"edgeType":"contains","source":12741,"target":12742},{"edgeType":"calls","source":5864,"target":4722},{"edgeType":"calls","source":270,"target":557},{"edgeType":"calls","source":7481,"target":7437},{"edgeType":"contains","source":7780,"target":7980},{"edgeType":"contains","source":1144,"target":1228},{"edgeType":"calls","source":12450,"target":11951},{"edgeType":"contains","source":7984,"target":7998},{"edgeType":"calls","source":6063,"target":5952},{"edgeType":"calls","source":10404,"target":9842},{"edgeType":"calls","source":3911,"target":3958},{"edgeType":"calls","source":6851,"target":6884},{"edgeType":"contains","source":1836,"target":1973},{"edgeType":"contains","source":3855,"target":3862},{"edgeType":"contains","source":6287,"target":6690},{"edgeType":"contains","source":12436,"target":12682},{"edgeType":"calls","source":11375,"target":3000},{"edgeType":"contains","source":1,"target":2839},{"edgeType":"contains","source":12605,"target":12728},{"edgeType":"contains","source":12919,"target":13565},{"edgeType":"contains","source":10583,"target":10930},{"edgeType":"calls","source":3020,"target":3036},{"edgeType":"calls","source":445,"target":412},{"edgeType":"contains","source":7951,"target":7959},{"edgeType":"contains","source":907,"target":1179},{"edgeType":"contains","source":8077,"target":8281},{"edgeType":"contains","source":9465,"target":2249},{"edgeType":"contains","source":11255,"target":11239},{"edgeType":"calls","source":12701,"target":12633},{"edgeType":"contains","source":3557,"target":3594},{"edgeType":"calls","source":6851,"target":6885},{"edgeType":"contains","source":9698,"target":9826},{"edgeType":"contains","source":13797,"target":13829},{"edgeType":"contains","source":7018,"target":7285},{"edgeType":"contains","source":12436,"target":12681},{"edgeType":"imports","source":3763,"target":3809},{"edgeType":"calls","source":5856,"target":740},{"edgeType":"contains","source":12605,"target":12727},{"edgeType":"contains","source":9173,"target":9186},{"edgeType":"contains","source":10825,"target":10829},{"edgeType":"calls","source":5554,"target":2703},{"edgeType":"contains","source":10583,"target":10931},{"edgeType":"contains","source":10704,"target":10352},{"edgeType":"contains","source":5883,"target":6531},{"edgeType":"calls","source":12731,"target":12759},{"edgeType":"contains","source":1836,"target":1979},{"edgeType":"contains","source":1831,"target":2134},{"edgeType":"contains","source":3154,"target":3402},{"edgeType":"contains","source":8147,"target":8224},{"edgeType":"contains","source":7951,"target":7958},{"edgeType":"contains","source":7785,"target":7819},{"edgeType":"calls","source":2193,"target":2249},{"edgeType":"calls","source":2193,"target":2245},{"edgeType":"calls","source":11844,"target":11714},{"edgeType":"contains","source":2896,"target":2941},{"edgeType":"contains","source":10583,"target":10928},{"edgeType":"contains","source":2527,"target":2753},{"edgeType":"contains","source":5883,"target":6532},{"edgeType":"contains","source":7984,"target":7995},{"edgeType":"imports","source":6769,"target":6815},{"edgeType":"contains","source":907,"target":1181},{"edgeType":"imports","source":4639,"target":4137},{"edgeType":"calls","source":2691,"target":2663},{"edgeType":"contains","source":1836,"target":1976},{"edgeType":"contains","source":7687,"target":7689},{"edgeType":"calls","source":3582,"target":3583},{"edgeType":"contains","source":7018,"target":7287},{"edgeType":"imports","source":12554,"target":12457},{"edgeType":"contains","source":12436,"target":12679},{"edgeType":"calls","source":7383,"target":4137},{"edgeType":"contains","source":12919,"target":13562},{"edgeType":"calls","source":3264,"target":1814},{"edgeType":"contains","source":13500,"target":13520},{"edgeType":"contains","source":7984,"target":7994},{"edgeType":"calls","source":4686,"target":4240},{"edgeType":"contains","source":907,"target":1180},{"edgeType":"calls","source":1897,"target":1910},{"edgeType":"contains","source":1124,"target":795},{"edgeType":"contains","source":1836,"target":1977},{"edgeType":"contains","source":7687,"target":7688},{"edgeType":"contains","source":11515,"target":11615},{"edgeType":"contains","source":7629,"target":2064},{"edgeType":"imports","source":12280,"target":12289},{"edgeType":"calls","source":12442,"target":12308},{"edgeType":"contains","source":4743,"target":4852},{"edgeType":"contains","source":4515,"target":4521},{"edgeType":"contains","source":8244,"target":8368},{"edgeType":"calls","source":5134,"target":4191},{"edgeType":"contains","source":5835,"target":5883},{"edgeType":"contains","source":2368,"target":2370},{"edgeType":"contains","source":13797,"target":13809},{"edgeType":"contains","source":4350,"target":4351},{"edgeType":"contains","source":7780,"target":7954},{"edgeType":"contains","source":9701,"target":9712},{"edgeType":"calls","source":4642,"target":4645},{"edgeType":"contains","source":907,"target":1150},{"edgeType":"contains","source":7587,"target":7595},{"edgeType":"contains","source":7583,"target":7719},{"edgeType":"contains","source":1144,"target":1202},{"edgeType":"calls","source":12108,"target":12091},{"edgeType":"contains","source":12919,"target":13544},{"edgeType":"contains","source":7356,"target":7357},{"edgeType":"calls","source":11926,"target":2936},{"edgeType":"contains","source":4844,"target":4891},{"edgeType":"imports","source":7001,"target":1524},{"edgeType":"contains","source":10301,"target":11196},{"edgeType":"contains","source":13797,"target":13808},{"edgeType":"calls","source":1702,"target":1706},{"edgeType":"contains","source":11674,"target":11972},{"edgeType":"contains","source":4416,"target":4418},{"edgeType":"imports","source":11983,"target":11984},{"edgeType":"contains","source":1,"target":13380},{"edgeType":"calls","source":2529,"target":2498},{"edgeType":"contains","source":2998,"target":2924},{"edgeType":"contains","source":9701,"target":9713},{"edgeType":"calls","source":4642,"target":4644},{"edgeType":"contains","source":907,"target":1149},{"edgeType":"contains","source":1144,"target":1201},{"edgeType":"contains","source":7583,"target":7718},{"edgeType":"imports","source":11058,"target":11059},{"edgeType":"contains","source":7283,"target":7505},{"edgeType":"calls","source":6454,"target":266},{"edgeType":"contains","source":1205,"target":2485},{"edgeType":"contains","source":6690,"target":6863},{"edgeType":"contains","source":7283,"target":7507},{"edgeType":"contains","source":9338,"target":9339},{"edgeType":"contains","source":13500,"target":13501},{"edgeType":"contains","source":7894,"target":7593},{"edgeType":"contains","source":2533,"target":2538},{"edgeType":"calls","source":1547,"target":1229},{"edgeType":"contains","source":4355,"target":4193},{"edgeType":"contains","source":907,"target":1152},{"edgeType":"contains","source":1603,"target":1771},{"edgeType":"calls","source":4642,"target":4643},{"edgeType":"contains","source":7583,"target":7721},{"edgeType":"contains","source":10461,"target":10462},{"edgeType":"calls","source":11120,"target":436},{"edgeType":"contains","source":12642,"target":12616},{"edgeType":"calls","source":6609,"target":6036},{"edgeType":"contains","source":11020,"target":11102},{"edgeType":"contains","source":1007,"target":1223},{"edgeType":"imports","source":11154,"target":11253},{"edgeType":"contains","source":11121,"target":11142},{"edgeType":"imports","source":6043,"target":5855},{"edgeType":"contains","source":6690,"target":6864},{"edgeType":"calls","source":12378,"target":11120},{"edgeType":"contains","source":13797,"target":13806},{"edgeType":"calls","source":989,"target":556},{"edgeType":"imports","source":13797,"target":1205},{"edgeType":"contains","source":4482,"target":4484},{"edgeType":"contains","source":12178,"target":12200},{"edgeType":"contains","source":4515,"target":4518},{"edgeType":"contains","source":9925,"target":10166},{"edgeType":"contains","source":2368,"target":2369},{"edgeType":"contains","source":907,"target":1151},{"edgeType":"contains","source":7187,"target":2027},{"edgeType":"calls","source":12803,"target":12742},{"edgeType":"contains","source":9701,"target":9711},{"edgeType":"contains","source":7583,"target":7720},{"edgeType":"contains","source":3557,"target":3562},{"edgeType":"contains","source":1124,"target":766},{"edgeType":"calls","source":12037,"target":11120},{"edgeType":"imports","source":1511,"target":1528},{"edgeType":"contains","source":6960,"target":6950},{"edgeType":"contains","source":3260,"target":3262},{"edgeType":"contains","source":12938,"target":12951},{"edgeType":"contains","source":11515,"target":11611},{"edgeType":"calls","source":2131,"target":2146},{"edgeType":"contains","source":11776,"target":11976},{"edgeType":"contains","source":22,"target":49},{"edgeType":"contains","source":4179,"target":4370},{"edgeType":"imports","source":9953,"target":6209},{"edgeType":"contains","source":12178,"target":12199},{"edgeType":"contains","source":8512,"target":8513},{"edgeType":"contains","source":4218,"target":4219},{"edgeType":"calls","source":1274,"target":1229},{"edgeType":"calls","source":6069,"target":5856},{"edgeType":"contains","source":9701,"target":9708},{"edgeType":"contains","source":7127,"target":3880},{"edgeType":"contains","source":11020,"target":11100},{"edgeType":"calls","source":579,"target":577},{"edgeType":"contains","source":2527,"target":2731},{"edgeType":"contains","source":7488,"target":7489},{"edgeType":"contains","source":12310,"target":12334},{"edgeType":"contains","source":6078,"target":5746},{"edgeType":"contains","source":12938,"target":12950},{"edgeType":"calls","source":2131,"target":2147},{"edgeType":"contains","source":11515,"target":11612},{"edgeType":"contains","source":22,"target":48},{"edgeType":"contains","source":8676,"target":8713},{"edgeType":"contains","source":12178,"target":12198},{"edgeType":"imports","source":1797,"target":1116},{"edgeType":"contains","source":4284,"target":4286},{"edgeType":"calls","source":1307,"target":1262},{"edgeType":"contains","source":3557,"target":3568},{"edgeType":"calls","source":1239,"target":1256},{"edgeType":"contains","source":9701,"target":9709},{"edgeType":"contains","source":4844,"target":4895},{"edgeType":"contains","source":11020,"target":11101},{"edgeType":"contains","source":11385,"target":11413},{"edgeType":"calls","source":2366,"target":148},{"edgeType":"contains","source":11121,"target":11141},{"edgeType":"contains","source":7455,"target":7456},{"edgeType":"contains","source":11683,"target":11686},{"edgeType":"contains","source":2527,"target":2728},{"edgeType":"contains","source":11019,"target":11129},{"edgeType":"contains","source":11712,"target":11844},{"edgeType":"contains","source":12938,"target":12949},{"edgeType":"contains","source":4515,"target":4523},{"edgeType":"contains","source":11776,"target":11974},{"edgeType":"contains","source":1,"target":13387},{"edgeType":"imports","source":1347,"target":266},{"edgeType":"imports","source":5707,"target":5706},{"edgeType":"contains","source":12310,"target":12333},{"edgeType":"calls","source":2594,"target":2590},{"edgeType":"calls","source":11260,"target":9842},{"edgeType":"contains","source":7583,"target":7717},{"edgeType":"contains","source":11515,"target":11608},{"edgeType":"contains","source":9701,"target":9706},{"edgeType":"contains","source":907,"target":1156},{"edgeType":"imports","source":11096,"target":10941},{"edgeType":"contains","source":7283,"target":7502},{"edgeType":"contains","source":9503,"target":9504},{"edgeType":"contains","source":12938,"target":12948},{"edgeType":"contains","source":12919,"target":13537},{"edgeType":"contains","source":9664,"target":9798},{"edgeType":"contains","source":11776,"target":11975},{"edgeType":"calls","source":1371,"target":1395},{"edgeType":"contains","source":12178,"target":12196},{"edgeType":"contains","source":4416,"target":4420},{"edgeType":"contains","source":1,"target":2815},{"edgeType":"contains","source":4350,"target":4352},{"edgeType":"calls","source":5495,"target":4620},{"edgeType":"contains","source":6462,"target":6529},{"edgeType":"calls","source":1834,"target":1840},{"edgeType":"calls","source":6294,"target":6293},{"edgeType":"contains","source":4841,"target":4986},{"edgeType":"contains","source":6917,"target":7222},{"edgeType":"contains","source":9701,"target":9707},{"edgeType":"contains","source":907,"target":1155},{"edgeType":"calls","source":439,"target":690},{"edgeType":"contains","source":9342,"target":9209},{"edgeType":"calls","source":4720,"target":4334},{"edgeType":"contains","source":4515,"target":4529},{"edgeType":"imports","source":5687,"target":1026},{"edgeType":"contains","source":9852,"target":10324},{"edgeType":"contains","source":7125,"target":7126},{"edgeType":"calls","source":6594,"target":6507},{"edgeType":"calls","source":1834,"target":1835},{"edgeType":"contains","source":1556,"target":1124},{"edgeType":"calls","source":2131,"target":2142},{"edgeType":"contains","source":22,"target":53},{"edgeType":"calls","source":12501,"target":11544},{"edgeType":"contains","source":4151,"target":4186},{"edgeType":"contains","source":10262,"target":10299},{"edgeType":"calls","source":7020,"target":7043},{"edgeType":"contains","source":8147,"target":8213},{"edgeType":"contains","source":11019,"target":11143},{"edgeType":"contains","source":12919,"target":13552},{"edgeType":"calls","source":814,"target":687},{"edgeType":"contains","source":9106,"target":681},{"edgeType":"contains","source":8512,"target":8525},{"edgeType":"contains","source":10583,"target":10918},{"edgeType":"contains","source":6692,"target":6807},{"edgeType":"calls","source":2825,"target":2826},{"edgeType":"contains","source":12377,"target":12385},{"edgeType":"calls","source":6789,"target":6805},{"edgeType":"contains","source":10583,"target":10919},{"edgeType":"contains","source":4515,"target":4528},{"edgeType":"contains","source":4510,"target":4683},{"edgeType":"calls","source":10511,"target":2411},{"edgeType":"calls","source":2131,"target":2143},{"edgeType":"contains","source":13500,"target":13510},{"edgeType":"calls","source":5897,"target":5898},{"edgeType":"calls","source":12408,"target":12314},{"edgeType":"calls","source":4843,"target":1576},{"edgeType":"contains","source":7587,"target":7602},{"edgeType":"contains","source":12377,"target":12384},{"edgeType":"contains","source":4119,"target":4120},{"edgeType":"contains","source":4218,"target":4222},{"edgeType":"contains","source":4253,"target":4194},{"edgeType":"calls","source":11333,"target":10757},{"edgeType":"calls","source":7285,"target":7285},{"edgeType":"contains","source":2527,"target":2735},{"edgeType":"contains","source":853,"target":717},{"edgeType":"contains","source":4841,"target":4992},{"edgeType":"calls","source":4813,"target":4620},{"edgeType":"contains","source":12436,"target":12669},{"edgeType":"contains","source":9925,"target":10173},{"edgeType":"calls","source":2211,"target":717},{"edgeType":"contains","source":9342,"target":9223},{"edgeType":"contains","source":7587,"target":7605},{"edgeType":"contains","source":9701,"target":9718},{"edgeType":"calls","source":10590,"target":10532},{"edgeType":"contains","source":13500,"target":13509},{"edgeType":"contains","source":3531,"target":3320},{"edgeType":"calls","source":1981,"target":1508},{"edgeType":"calls","source":7748,"target":7731},{"edgeType":"contains","source":3490,"target":3534},{"edgeType":"contains","source":3476,"target":3968},{"edgeType":"contains","source":12377,"target":12383},{"edgeType":"contains","source":11712,"target":11856},{"edgeType":"contains","source":3557,"target":3571},{"edgeType":"contains","source":4151,"target":4184},{"edgeType":"contains","source":8358,"target":617},{"edgeType":"contains","source":6917,"target":7233},{"edgeType":"imports","source":10439,"target":642},{"edgeType":"contains","source":9002,"target":736},{"edgeType":"contains","source":10583,"target":10916},{"edgeType":"calls","source":5798,"target":5794},{"edgeType":"calls","source":5187,"target":4651},{"edgeType":"contains","source":10753,"target":9875},{"edgeType":"contains","source":4515,"target":4526},{"edgeType":"contains","source":7780,"target":7963},{"edgeType":"contains","source":9701,"target":9719},{"edgeType":"contains","source":1836,"target":1956},{"edgeType":"contains","source":13500,"target":13508},{"edgeType":"contains","source":7455,"target":7469},{"edgeType":"contains","source":2137,"target":2139},{"edgeType":"contains","source":8535,"target":414},{"edgeType":"contains","source":12377,"target":12382},{"edgeType":"contains","source":4151,"target":4183},{"edgeType":"contains","source":122,"target":126},{"edgeType":"contains","source":8147,"target":8214},{"edgeType":"contains","source":4284,"target":4288},{"edgeType":"contains","source":9028,"target":9442},{"edgeType":"contains","source":10583,"target":10917},{"edgeType":"calls","source":5167,"target":4213},{"edgeType":"contains","source":13500,"target":13507},{"edgeType":"contains","source":3886,"target":3948},{"edgeType":"imports","source":10237,"target":568},{"edgeType":"contains","source":7018,"target":7267},{"edgeType":"contains","source":13797,"target":13813},{"edgeType":"imports","source":3763,"target":3594},{"edgeType":"contains","source":12377,"target":12381},{"edgeType":"contains","source":1205,"target":2496},{"edgeType":"calls","source":8970,"target":8963},{"edgeType":"calls","source":8937,"target":8929},{"edgeType":"imports","source":12516,"target":2847},{"edgeType":"calls","source":9927,"target":436},{"edgeType":"imports","source":12152,"target":2504},{"edgeType":"contains","source":13500,"target":13506},{"edgeType":"calls","source":2330,"target":2312},{"edgeType":"calls","source":10093,"target":10088},{"edgeType":"calls","source":11758,"target":1814},{"edgeType":"contains","source":1,"target":13392},{"edgeType":"calls","source":1669,"target":1660},{"edgeType":"contains","source":7224,"target":7225},{"edgeType":"contains","source":3886,"target":3947},{"edgeType":"contains","source":3689,"target":3712},{"edgeType":"calls","source":5987,"target":4161},{"edgeType":"contains","source":13796,"target":13843},{"edgeType":"imports","source":2314,"target":952},{"edgeType":"calls","source":270,"target":633},{"edgeType":"contains","source":9701,"target":9717},{"edgeType":"contains","source":1205,"target":2497},{"edgeType":"contains","source":8281,"target":8282},{"edgeType":"contains","source":4151,"target":4189},{"edgeType":"calls","source":6926,"target":6791},{"edgeType":"contains","source":122,"target":128},{"edgeType":"calls","source":11968,"target":2703},{"edgeType":"contains","source":8512,"target":8520},{"edgeType":"contains","source":10461,"target":10469},{"edgeType":"contains","source":10583,"target":10915},{"edgeType":"calls","source":13855,"target":5512},{"edgeType":"calls","source":5865,"target":5828},{"edgeType":"contains","source":907,"target":1165},{"edgeType":"calls","source":1870,"target":717},{"edgeType":"imports","source":2244,"target":1007},{"edgeType":"calls","source":2131,"target":2136},{"edgeType":"contains","source":9701,"target":9714},{"edgeType":"contains","source":4841,"target":4995},{"edgeType":"contains","source":7127,"target":3890},{"edgeType":"calls","source":5495,"target":4613},{"edgeType":"contains","source":2005,"target":2006},{"edgeType":"calls","source":2936,"target":436},{"edgeType":"contains","source":4151,"target":4188},{"edgeType":"contains","source":8512,"target":8523},{"edgeType":"calls","source":11764,"target":568},{"edgeType":"contains","source":11020,"target":11106},{"edgeType":"contains","source":12709,"target":12657},{"edgeType":"contains","source":3194,"target":3201},{"edgeType":"calls","source":2365,"target":2282},{"edgeType":"calls","source":12380,"target":2614},{"edgeType":"imports","source":12553,"target":12273},{"edgeType":"contains","source":13797,"target":13810},{"edgeType":"calls","source":4213,"target":4187},{"edgeType":"calls","source":677,"target":703},{"edgeType":"contains","source":7583,"target":7724},{"edgeType":"calls","source":6923,"target":6886},{"edgeType":"imports","source":7127,"target":7129},{"edgeType":"contains","source":1205,"target":2495},{"edgeType":"contains","source":9143,"target":9044},{"edgeType":"contains","source":12377,"target":12378},{"edgeType":"contains","source":4119,"target":4122},{"edgeType":"contains","source":8478,"target":8519},{"edgeType":"contains","source":1,"target":13394},{"edgeType":"contains","source":2527,"target":2737},{"edgeType":"contains","source":4649,"target":4604},{"edgeType":"contains","source":6692,"target":6806},{"edgeType":"contains","source":2962,"target":2966},{"edgeType":"contains","source":907,"target":1134},{"edgeType":"calls","source":6096,"target":6097},{"edgeType":"contains","source":1140,"target":1310},{"edgeType":"calls","source":6472,"target":6036},{"edgeType":"contains","source":5107,"target":5179},{"edgeType":"contains","source":7018,"target":7247},{"edgeType":"contains","source":11108,"target":11531},{"edgeType":"calls","source":2264,"target":2272},{"edgeType":"contains","source":9106,"target":9113},{"edgeType":"contains","source":11019,"target":11119},{"edgeType":"contains","source":12938,"target":12939},{"edgeType":"calls","source":8341,"target":8348},{"edgeType":"contains","source":3952,"target":3988},{"edgeType":"contains","source":7520,"target":7540},{"edgeType":"contains","source":22,"target":29},{"edgeType":"contains","source":4151,"target":4161},{"edgeType":"contains","source":2070,"target":2078},{"edgeType":"contains","source":352,"target":369},{"edgeType":"contains","source":5968,"target":5972},{"edgeType":"calls","source":9237,"target":9113},{"edgeType":"contains","source":12078,"target":12116},{"edgeType":"contains","source":2962,"target":2967},{"edgeType":"calls","source":4613,"target":4502},{"edgeType":"contains","source":5107,"target":5178},{"edgeType":"contains","source":907,"target":1133},{"edgeType":"contains","source":1140,"target":1309},{"edgeType":"calls","source":11881,"target":11714},{"edgeType":"contains","source":7018,"target":7248},{"edgeType":"contains","source":9106,"target":9112},{"edgeType":"calls","source":10093,"target":10059},{"edgeType":"calls","source":2266,"target":2211},{"edgeType":"contains","source":4708,"target":4862},{"edgeType":"calls","source":6860,"target":6694},{"edgeType":"calls","source":4985,"target":4598},{"edgeType":"contains","source":1872,"target":1875},{"edgeType":"calls","source":5827,"target":693},{"edgeType":"contains","source":8676,"target":8700},{"edgeType":"contains","source":4510,"target":4658},{"edgeType":"contains","source":4131,"target":4780},{"edgeType":"contains","source":6287,"target":6654},{"edgeType":"contains","source":352,"target":368},{"edgeType":"contains","source":5968,"target":5973},{"edgeType":"calls","source":9237,"target":9112},{"edgeType":"contains","source":918,"target":795},{"edgeType":"contains","source":9106,"target":9115},{"edgeType":"imports","source":12574,"target":11617},{"edgeType":"contains","source":5107,"target":5177},{"edgeType":"calls","source":9237,"target":9115},{"edgeType":"calls","source":12897,"target":11926},{"edgeType":"contains","source":4944,"target":4945},{"edgeType":"contains","source":2962,"target":2964},{"edgeType":"calls","source":12347,"target":436},{"edgeType":"imports","source":12862,"target":10088},{"edgeType":"calls","source":148,"target":219},{"edgeType":"contains","source":7018,"target":7249},{"edgeType":"imports","source":7128,"target":7087},{"edgeType":"contains","source":11082,"target":12335},{"edgeType":"contains","source":12310,"target":12321},{"edgeType":"contains","source":9809,"target":2120},{"edgeType":"calls","source":11763,"target":11140},{"edgeType":"calls","source":11745,"target":11698},{"edgeType":"calls","source":6724,"target":6683},{"edgeType":"contains","source":1,"target":13366},{"edgeType":"contains","source":10301,"target":11177},{"edgeType":"contains","source":9925,"target":10149},{"edgeType":"contains","source":12178,"target":12185},{"edgeType":"contains","source":352,"target":371},{"edgeType":"calls","source":7053,"target":7054},{"edgeType":"contains","source":12078,"target":12114},{"edgeType":"contains","source":5107,"target":5176},{"edgeType":"contains","source":9106,"target":9114},{"edgeType":"contains","source":11187,"target":11195},{"edgeType":"calls","source":1670,"target":1660},{"edgeType":"contains","source":2962,"target":2965},{"edgeType":"contains","source":1140,"target":1311},{"edgeType":"calls","source":2266,"target":2209},{"edgeType":"calls","source":347,"target":391},{"edgeType":"calls","source":2215,"target":619},{"edgeType":"calls","source":4213,"target":4216},{"edgeType":"contains","source":12310,"target":12320},{"edgeType":"imports","source":11616,"target":11712},{"edgeType":"contains","source":4841,"target":4965},{"edgeType":"calls","source":7053,"target":7055},{"edgeType":"contains","source":352,"target":370},{"edgeType":"contains","source":2399,"target":2448},{"edgeType":"contains","source":8591,"target":9218},{"edgeType":"imports","source":3831,"target":420},{"edgeType":"contains","source":5107,"target":5183},{"edgeType":"contains","source":9106,"target":9109},{"edgeType":"calls","source":2553,"target":708},{"edgeType":"calls","source":580,"target":562},{"edgeType":"contains","source":1140,"target":1314},{"edgeType":"contains","source":1872,"target":1878},{"edgeType":"calls","source":6855,"target":6852},{"edgeType":"calls","source":8907,"target":8777},{"edgeType":"contains","source":3886,"target":3924},{"edgeType":"calls","source":2264,"target":2268},{"edgeType":"contains","source":12919,"target":13523},{"edgeType":"contains","source":6199,"target":6206},{"edgeType":"contains","source":4708,"target":4867},{"edgeType":"imports","source":7489,"target":7525},{"edgeType":"contains","source":11674,"target":11950},{"edgeType":"contains","source":352,"target":373},{"edgeType":"contains","source":3787,"target":3822},{"edgeType":"calls","source":5187,"target":4675},{"edgeType":"contains","source":8676,"target":8697},{"edgeType":"calls","source":1637,"target":1620},{"edgeType":"calls","source":1900,"target":1923},{"edgeType":"contains","source":5939,"target":5810},{"edgeType":"calls","source":348,"target":354},{"edgeType":"contains","source":1140,"target":1313},{"edgeType":"calls","source":4721,"target":4321},{"edgeType":"contains","source":5107,"target":5182},{"edgeType":"contains","source":9463,"target":8611},{"edgeType":"contains","source":11187,"target":11193},{"edgeType":"contains","source":1872,"target":1879},{"edgeType":"contains","source":7520,"target":7537},{"edgeType":"contains","source":4708,"target":4866},{"edgeType":"contains","source":12919,"target":13522},{"edgeType":"contains","source":11700,"target":10088},{"edgeType":"imports","source":11454,"target":11455},{"edgeType":"contains","source":352,"target":372},{"edgeType":"contains","source":8082,"target":8084},{"edgeType":"contains","source":8765,"target":9108},{"edgeType":"contains","source":3787,"target":3821},{"edgeType":"contains","source":8534,"target":414},{"edgeType":"calls","source":1668,"target":658},{"edgeType":"contains","source":6455,"target":6728},{"edgeType":"calls","source":12337,"target":1807},{"edgeType":"contains","source":9925,"target":10144},{"edgeType":"contains","source":7583,"target":7700},{"edgeType":"calls","source":12417,"target":2498},{"edgeType":"imports","source":6917,"target":2005},{"edgeType":"contains","source":5107,"target":5181},{"edgeType":"contains","source":3952,"target":3990},{"edgeType":"contains","source":1140,"target":1316},{"edgeType":"contains","source":10262,"target":10268},{"edgeType":"calls","source":4950,"target":4621},{"edgeType":"calls","source":5033,"target":5219},{"edgeType":"contains","source":4708,"target":4865},{"edgeType":"contains","source":8776,"target":8770},{"edgeType":"contains","source":3787,"target":3820},{"edgeType":"contains","source":6199,"target":6208},{"edgeType":"calls","source":6921,"target":6922},{"edgeType":"contains","source":12310,"target":12317},{"edgeType":"calls","source":3258,"target":3164},{"edgeType":"contains","source":6455,"target":6729},{"edgeType":"contains","source":12078,"target":12108},{"edgeType":"calls","source":1141,"target":1142},{"edgeType":"contains","source":7853,"target":7785},{"edgeType":"contains","source":2768,"target":2641},{"edgeType":"contains","source":5107,"target":5180},{"edgeType":"imports","source":7128,"target":7090},{"edgeType":"contains","source":1140,"target":1315},{"edgeType":"contains","source":11385,"target":10338},{"edgeType":"calls","source":8873,"target":8775},{"edgeType":"contains","source":10262,"target":10269},{"edgeType":"contains","source":7520,"target":7539},{"edgeType":"contains","source":11019,"target":11113},{"edgeType":"contains","source":4708,"target":4864},{"edgeType":"contains","source":4131,"target":4782},{"edgeType":"calls","source":8341,"target":8355},{"edgeType":"calls","source":6615,"target":5839},{"edgeType":"contains","source":12574,"target":12588},{"edgeType":"contains","source":8082,"target":8086},{"edgeType":"contains","source":12310,"target":12316},{"edgeType":"calls","source":12897,"target":11930},{"edgeType":"contains","source":10301,"target":11187},{"edgeType":"contains","source":4841,"target":4977},{"edgeType":"calls","source":3389,"target":3328},{"edgeType":"contains","source":12938,"target":12947},{"edgeType":"contains","source":12919,"target":13536},{"edgeType":"contains","source":8478,"target":8505},{"edgeType":"calls","source":3195,"target":3000},{"edgeType":"contains","source":12178,"target":12195},{"edgeType":"contains","source":4944,"target":4955},{"edgeType":"contains","source":8676,"target":8710},{"edgeType":"calls","source":11968,"target":568},{"edgeType":"contains","source":6690,"target":6853},{"edgeType":"contains","source":1140,"target":1318},{"edgeType":"contains","source":5883,"target":6501},{"edgeType":"imports","source":11082,"target":8177},{"edgeType":"contains","source":5107,"target":5187},{"edgeType":"calls","source":12966,"target":12969},{"edgeType":"calls","source":6922,"target":6893},{"edgeType":"contains","source":9701,"target":9704},{"edgeType":"calls","source":10590,"target":10518},{"edgeType":"contains","source":3689,"target":3693},{"edgeType":"contains","source":3787,"target":3826},{"edgeType":"calls","source":9302,"target":9219},{"edgeType":"imports","source":9207,"target":9223},{"edgeType":"contains","source":11020,"target":11097},{"edgeType":"contains","source":10857,"target":10865},{"edgeType":"contains","source":12938,"target":12946},{"edgeType":"calls","source":1163,"target":454},{"edgeType":"contains","source":2632,"target":2635},{"edgeType":"contains","source":4639,"target":5953},{"edgeType":"contains","source":5107,"target":5186},{"edgeType":"calls","source":1230,"target":491},{"edgeType":"contains","source":8710,"target":8712},{"edgeType":"contains","source":1140,"target":1317},{"edgeType":"contains","source":3152,"target":3427},{"edgeType":"calls","source":12866,"target":12897},{"edgeType":"calls","source":2264,"target":2265},{"edgeType":"calls","source":8975,"target":8786},{"edgeType":"calls","source":9200,"target":754},{"edgeType":"contains","source":9701,"target":9705},{"edgeType":"contains","source":11020,"target":11094},{"edgeType":"contains","source":11019,"target":11125},{"edgeType":"contains","source":12436,"target":12651},{"edgeType":"contains","source":10262,"target":10280},{"edgeType":"contains","source":5107,"target":5185},{"edgeType":"contains","source":12310,"target":12329},{"edgeType":"contains","source":4841,"target":4975},{"edgeType":"contains","source":9293,"target":8611},{"edgeType":"calls","source":943,"target":935},{"edgeType":"contains","source":1116,"target":1007},{"edgeType":"contains","source":11385,"target":11406},{"edgeType":"contains","source":12812,"target":12623},{"edgeType":"contains","source":7785,"target":7793},{"edgeType":"contains","source":1140,"target":1320},{"edgeType":"contains","source":1144,"target":1196},{"edgeType":"contains","source":3724,"target":3663},{"edgeType":"contains","source":3663,"target":3440},{"edgeType":"contains","source":3787,"target":3824},{"edgeType":"calls","source":12897,"target":5593},{"edgeType":"contains","source":9701,"target":9702},{"edgeType":"calls","source":6139,"target":5810},{"edgeType":"calls","source":1372,"target":1376},{"edgeType":"calls","source":2859,"target":2844},{"edgeType":"contains","source":907,"target":1143},{"edgeType":"contains","source":4746,"target":4748},{"edgeType":"contains","source":12919,"target":13533},{"edgeType":"contains","source":2632,"target":2633},{"edgeType":"imports","source":3763,"target":3576},{"edgeType":"contains","source":1140,"target":1319},{"edgeType":"calls","source":8907,"target":8782},{"edgeType":"contains","source":7018,"target":7258},{"edgeType":"calls","source":8975,"target":8788},{"edgeType":"contains","source":9852,"target":10307},{"edgeType":"calls","source":2131,"target":2158},{"edgeType":"contains","source":7283,"target":7499},{"edgeType":"contains","source":3787,"target":3823},{"edgeType":"contains","source":9701,"target":9703},{"edgeType":"contains","source":1836,"target":1940},{"edgeType":"imports","source":2137,"target":1140},{"edgeType":"contains","source":11776,"target":11968},{"edgeType":"contains","source":9,"target":444},{"edgeType":"contains","source":10301,"target":11183},{"edgeType":"contains","source":3952,"target":4000},{"edgeType":"calls","source":9861,"target":9865},{"edgeType":"calls","source":4689,"target":4249},{"edgeType":"contains","source":8776,"target":8777},{"edgeType":"contains","source":4389,"target":4194},{"edgeType":"contains","source":11515,"target":11602},{"edgeType":"contains","source":11385,"target":11404},{"edgeType":"calls","source":1702,"target":1711},{"edgeType":"contains","source":1144,"target":1198},{"edgeType":"contains","source":9698,"target":9793},{"edgeType":"contains","source":11020,"target":11093},{"edgeType":"contains","source":794,"target":420},{"edgeType":"contains","source":4515,"target":4516},{"edgeType":"calls","source":5187,"target":4666},{"edgeType":"contains","source":11385,"target":11405},{"edgeType":"calls","source":5886,"target":4137},{"edgeType":"imports","source":7001,"target":2560},{"edgeType":"calls","source":8907,"target":8784},{"edgeType":"calls","source":6308,"target":568},{"edgeType":"imports","source":7128,"target":7083},{"edgeType":"calls","source":10690,"target":3195},{"edgeType":"contains","source":2533,"target":2534},{"edgeType":"contains","source":4581,"target":4583},{"edgeType":"calls","source":1030,"target":348},{"edgeType":"contains","source":8710,"target":8711},{"edgeType":"contains","source":10857,"target":10858},{"edgeType":"calls","source":5187,"target":4665},{"edgeType":"imports","source":7019,"target":2005},{"edgeType":"contains","source":12078,"target":12118},{"edgeType":"imports","source":11154,"target":11232},{"edgeType":"calls","source":2299,"target":1173},{"edgeType":"contains","source":7780,"target":7944},{"edgeType":"calls","source":2365,"target":2298},{"edgeType":"calls","source":12515,"target":12154},{"edgeType":"calls","source":4863,"target":4137},{"edgeType":"contains","source":6199,"target":6217},{"edgeType":"contains","source":1,"target":2807},{"edgeType":"imports","source":8063,"target":7692},{"edgeType":"contains","source":4581,"target":4582},{"edgeType":"contains","source":11019,"target":11122},{"edgeType":"contains","source":4713,"target":4718},{"edgeType":"contains","source":6692,"target":6790},{"edgeType":"contains","source":7949,"target":7989},{"edgeType":"imports","source":12423,"target":12059},{"edgeType":"contains","source":907,"target":1147},{"edgeType":"calls","source":1668,"target":652},{"edgeType":"contains","source":12259,"target":11791},{"edgeType":"contains","source":1144,"target":1199},{"edgeType":"calls","source":4642,"target":4646},{"edgeType":"contains","source":12310,"target":12324},{"edgeType":"contains","source":1872,"target":1885},{"edgeType":"calls","source":8519,"target":731},{"edgeType":"calls","source":3525,"target":3299},{"edgeType":"contains","source":3952,"target":3971},{"edgeType":"contains","source":1836,"target":1916},{"edgeType":"contains","source":9665,"target":9737},{"edgeType":"calls","source":7338,"target":1371},{"edgeType":"contains","source":352,"target":353},{"edgeType":"calls","source":1833,"target":1841},{"edgeType":"contains","source":12574,"target":12579},{"edgeType":"contains","source":5107,"target":5162},{"edgeType":"contains","source":8412,"target":8413},{"edgeType":"contains","source":8544,"target":8549},{"edgeType":"calls","source":11030,"target":3195},{"edgeType":"contains","source":9698,"target":9772},{"edgeType":"contains","source":1007,"target":1188},{"edgeType":"contains","source":12739,"target":12749},{"edgeType":"calls","source":10437,"target":436},{"edgeType":"contains","source":2631,"target":2641},{"edgeType":"contains","source":8807,"target":8851},{"edgeType":"contains","source":12902,"target":12980},{"edgeType":"calls","source":8971,"target":8885},{"edgeType":"contains","source":3952,"target":3970},{"edgeType":"calls","source":2957,"target":2938},{"edgeType":"calls","source":975,"target":955},{"edgeType":"contains","source":4844,"target":4858},{"edgeType":"contains","source":9665,"target":9736},{"edgeType":"calls","source":12799,"target":2266},{"edgeType":"calls","source":5154,"target":3537},{"edgeType":"imports","source":6203,"target":6211},{"edgeType":"contains","source":2400,"target":2403},{"edgeType":"contains","source":8303,"target":4391},{"edgeType":"contains","source":12078,"target":12098},{"edgeType":"contains","source":5075,"target":5096},{"edgeType":"calls","source":5970,"target":5724},{"edgeType":"contains","source":5107,"target":5161},{"edgeType":"contains","source":6364,"target":6365},{"edgeType":"contains","source":2891,"target":3037},{"edgeType":"contains","source":8544,"target":8548},{"edgeType":"contains","source":10592,"target":10599},{"edgeType":"imports","source":12423,"target":12119},{"edgeType":"imports","source":9207,"target":1881},{"edgeType":"contains","source":11385,"target":11384},{"edgeType":"contains","source":6892,"target":6909},{"edgeType":"calls","source":12319,"target":11860},{"edgeType":"contains","source":11019,"target":11103},{"edgeType":"contains","source":12902,"target":12979},{"edgeType":"contains","source":4844,"target":4857},{"edgeType":"contains","source":12077,"target":12128},{"edgeType":"calls","source":5133,"target":4187},{"edgeType":"imports","source":6203,"target":6214},{"edgeType":"imports","source":11983,"target":12018},{"edgeType":"calls","source":1689,"target":1022},{"edgeType":"contains","source":9665,"target":9739},{"edgeType":"contains","source":12201,"target":11455},{"edgeType":"contains","source":352,"target":355},{"edgeType":"contains","source":5107,"target":5160},{"edgeType":"contains","source":5075,"target":5095},{"edgeType":"contains","source":3865,"target":3495},{"edgeType":"contains","source":10583,"target":10875},{"edgeType":"imports","source":3741,"target":1144},{"edgeType":"contains","source":12574,"target":12577},{"edgeType":"calls","source":12984,"target":1814},{"edgeType":"calls","source":230,"target":799},{"edgeType":"contains","source":6892,"target":6910},{"edgeType":"contains","source":6917,"target":7192},{"edgeType":"contains","source":7018,"target":7232},{"edgeType":"calls","source":6922,"target":6871},{"edgeType":"contains","source":12902,"target":12978},{"edgeType":"contains","source":7596,"target":3057},{"edgeType":"imports","source":12280,"target":12325},{"edgeType":"contains","source":9665,"target":9738},{"edgeType":"contains","source":11731,"target":11227},{"edgeType":"contains","source":11712,"target":11816},{"edgeType":"contains","source":12077,"target":12127},{"edgeType":"contains","source":4639,"target":4869},{"edgeType":"contains","source":6364,"target":6367},{"edgeType":"contains","source":5107,"target":5159},{"edgeType":"contains","source":12574,"target":12576},{"edgeType":"contains","source":8544,"target":8550},{"edgeType":"contains","source":1836,"target":1915},{"edgeType":"calls","source":2756,"target":2825},{"edgeType":"calls","source":677,"target":682},{"edgeType":"imports","source":13053,"target":11617},{"edgeType":"calls","source":7846,"target":7824},{"edgeType":"calls","source":12371,"target":12360},{"edgeType":"imports","source":9467,"target":1218},{"edgeType":"contains","source":10955,"target":10968},{"edgeType":"contains","source":1836,"target":1920},{"edgeType":"calls","source":4923,"target":4353},{"edgeType":"contains","source":4708,"target":4851},{"edgeType":"contains","source":11021,"target":11036},{"edgeType":"contains","source":11715,"target":11720},{"edgeType":"contains","source":6892,"target":6904},{"edgeType":"contains","source":2631,"target":2644},{"edgeType":"contains","source":4510,"target":4647},{"edgeType":"contains","source":352,"target":357},{"edgeType":"contains","source":9,"target":419},{"edgeType":"contains","source":2400,"target":2406},{"edgeType":"contains","source":4448,"target":4455},{"edgeType":"contains","source":6628,"target":6632},{"edgeType":"contains","source":3867,"target":3439},{"edgeType":"contains","source":6462,"target":6492},{"edgeType":"calls","source":4094,"target":454},{"edgeType":"contains","source":8544,"target":8545},{"edgeType":"contains","source":10583,"target":10873},{"edgeType":"contains","source":9925,"target":10130},{"edgeType":"calls","source":512,"target":507},{"edgeType":"contains","source":907,"target":1121},{"edgeType":"contains","source":5883,"target":6472},{"edgeType":"calls","source":11316,"target":10189},{"edgeType":"contains","source":12739,"target":12745},{"edgeType":"contains","source":4841,"target":4956},{"edgeType":"contains","source":7713,"target":7880},{"edgeType":"calls","source":2494,"target":2488},{"edgeType":"contains","source":5107,"target":5166},{"edgeType":"contains","source":5075,"target":5101},{"edgeType":"contains","source":3952,"target":3974},{"edgeType":"imports","source":1497,"target":935},{"edgeType":"imports","source":1434,"target":1831},{"edgeType":"contains","source":8468,"target":329},{"edgeType":"imports","source":10367,"target":2920},{"edgeType":"contains","source":6892,"target":6905},{"edgeType":"contains","source":11715,"target":11721},{"edgeType":"contains","source":2400,"target":2407},{"edgeType":"contains","source":352,"target":356},{"edgeType":"contains","source":8676,"target":8680},{"edgeType":"contains","source":12077,"target":12125},{"edgeType":"calls","source":9199,"target":9220},{"edgeType":"contains","source":10301,"target":11159},{"edgeType":"contains","source":12241,"target":12326},{"edgeType":"calls","source":10897,"target":3095},{"edgeType":"contains","source":9925,"target":10131},{"edgeType":"imports","source":5711,"target":2441},{"edgeType":"imports","source":1111,"target":1275},{"edgeType":"contains","source":7713,"target":7879},{"edgeType":"calls","source":1086,"target":681},{"edgeType":"contains","source":5075,"target":5100},{"edgeType":"contains","source":5107,"target":5165},{"edgeType":"contains","source":11715,"target":11718},{"edgeType":"contains","source":3952,"target":3973},{"edgeType":"contains","source":6892,"target":6906},{"edgeType":"contains","source":12919,"target":13505},{"edgeType":"contains","source":4708,"target":4849},{"edgeType":"contains","source":352,"target":359},{"edgeType":"calls","source":11293,"target":9842},{"edgeType":"contains","source":8544,"target":8547},{"edgeType":"contains","source":8478,"target":8479},{"edgeType":"contains","source":12078,"target":12093},{"edgeType":"calls","source":8405,"target":8469},{"edgeType":"imports","source":12554,"target":12283},{"edgeType":"contains","source":9465,"target":2193},{"edgeType":"contains","source":10955,"target":10967},{"edgeType":"imports","source":1511,"target":1556},{"edgeType":"calls","source":3002,"target":1537},{"edgeType":"calls","source":7548,"target":7553},{"edgeType":"contains","source":1836,"target":1919},{"edgeType":"contains","source":6892,"target":6907},{"edgeType":"calls","source":2141,"target":745},{"edgeType":"contains","source":4448,"target":4452},{"edgeType":"contains","source":2400,"target":2405},{"edgeType":"contains","source":352,"target":358},{"edgeType":"imports","source":7923,"target":7862},{"edgeType":"calls","source":12734,"target":12738},{"edgeType":"contains","source":8544,"target":8546},{"edgeType":"contains","source":10592,"target":10593},{"edgeType":"calls","source":10577,"target":9842},{"edgeType":"calls","source":1121,"target":655},{"edgeType":"contains","source":1673,"target":1687},{"edgeType":"contains","source":7127,"target":3850},{"edgeType":"contains","source":5107,"target":5163},{"edgeType":"calls","source":9893,"target":9906},{"edgeType":"calls","source":3055,"target":3062},{"edgeType":"contains","source":1140,"target":1302},{"edgeType":"contains","source":5961,"target":6180},{"edgeType":"contains","source":352,"target":361},{"edgeType":"contains","source":5107,"target":5171},{"edgeType":"contains","source":11187,"target":11188},{"edgeType":"calls","source":10405,"target":9893},{"edgeType":"calls","source":12341,"target":12243},{"edgeType":"contains","source":9698,"target":9780},{"edgeType":"contains","source":1836,"target":1924},{"edgeType":"imports","source":9341,"target":9345},{"edgeType":"contains","source":10301,"target":11171},{"edgeType":"contains","source":13796,"target":13815},{"edgeType":"contains","source":10262,"target":10266},{"edgeType":"contains","source":5107,"target":5170},{"edgeType":"contains","source":6364,"target":6372},{"edgeType":"calls","source":773,"target":868},{"edgeType":"calls","source":7552,"target":7430},{"edgeType":"imports","source":9953,"target":3059},{"edgeType":"contains","source":10592,"target":10606},{"edgeType":"contains","source":12310,"target":12315},{"edgeType":"imports","source":12044,"target":602},{"edgeType":"contains","source":4841,"target":4960},{"edgeType":"imports","source":1139,"target":420},{"edgeType":"contains","source":3160,"target":3163},{"edgeType":"contains","source":352,"target":360},{"edgeType":"calls","source":8341,"target":8341},{"edgeType":"calls","source":2053,"target":1354},{"edgeType":"contains","source":13796,"target":13814},{"edgeType":"contains","source":12574,"target":12586},{"edgeType":"calls","source":1187,"target":717},{"edgeType":"contains","source":8511,"target":8522},{"edgeType":"calls","source":781,"target":619},{"edgeType":"contains","source":5107,"target":5169},{"edgeType":"contains","source":6364,"target":6373},{"edgeType":"contains","source":12241,"target":12339},{"edgeType":"contains","source":10592,"target":10607},{"edgeType":"calls","source":975,"target":947},{"edgeType":"contains","source":4841,"target":4959},{"edgeType":"contains","source":1836,"target":1922},{"edgeType":"contains","source":2631,"target":2646},{"edgeType":"contains","source":1140,"target":1304},{"edgeType":"contains","source":11286,"target":11288},{"edgeType":"contains","source":7625,"target":2165},{"edgeType":"calls","source":9382,"target":2498},{"edgeType":"contains","source":10262,"target":10264},{"edgeType":"contains","source":8082,"target":8083},{"edgeType":"contains","source":4841,"target":4958},{"edgeType":"calls","source":9516,"target":8913},{"edgeType":"contains","source":1140,"target":1303},{"edgeType":"calls","source":2329,"target":2312},{"edgeType":"contains","source":352,"target":362},{"edgeType":"calls","source":10676,"target":436},{"edgeType":"calls","source":1833,"target":1834},{"edgeType":"calls","source":6096,"target":6036},{"edgeType":"calls","source":6106,"target":4669},{"edgeType":"contains","source":9698,"target":9779},{"edgeType":"contains","source":6199,"target":6205},{"edgeType":"contains","source":10262,"target":10265},{"edgeType":"contains","source":5107,"target":5167},{"edgeType":"contains","source":12259,"target":11779},{"edgeType":"contains","source":4841,"target":4957},{"edgeType":"calls","source":4996,"target":1026},{"edgeType":"contains","source":5075,"target":5102},{"edgeType":"contains","source":907,"target":1126},{"edgeType":"contains","source":10592,"target":10605},{"edgeType":"contains","source":352,"target":365},{"edgeType":"contains","source":5107,"target":5175},{"edgeType":"imports","source":7601,"target":6209},{"edgeType":"calls","source":6723,"target":6707},{"edgeType":"calls","source":6724,"target":6676},{"edgeType":"contains","source":3160,"target":3166},{"edgeType":"contains","source":5043,"target":5045},{"edgeType":"contains","source":1140,"target":1306},{"edgeType":"contains","source":8107,"target":8358},{"edgeType":"contains","source":11712,"target":11821},{"edgeType":"contains","source":7018,"target":7234},{"edgeType":"calls","source":4786,"target":4364},{"edgeType":"contains","source":55,"target":59},{"edgeType":"contains","source":121,"target":127},{"edgeType":"contains","source":6364,"target":6368},{"edgeType":"contains","source":2070,"target":2074},{"edgeType":"imports","source":11096,"target":398},{"edgeType":"contains","source":10955,"target":10976},{"edgeType":"contains","source":12310,"target":12311},{"edgeType":"contains","source":4218,"target":4194},{"edgeType":"contains","source":907,"target":1129},{"edgeType":"calls","source":1541,"target":1367},{"edgeType":"contains","source":4708,"target":4859},{"edgeType":"calls","source":7284,"target":7286},{"edgeType":"contains","source":6960,"target":6918},{"edgeType":"contains","source":3787,"target":3812},{"edgeType":"imports","source":6203,"target":6207},{"edgeType":"contains","source":1007,"target":1200},{"edgeType":"contains","source":11385,"target":11389},{"edgeType":"contains","source":12078,"target":12102},{"edgeType":"contains","source":2962,"target":2963},{"edgeType":"contains","source":11286,"target":11287},{"edgeType":"contains","source":5043,"target":5044},{"edgeType":"contains","source":8303,"target":4395},{"edgeType":"contains","source":9925,"target":10139},{"edgeType":"calls","source":7714,"target":7698},{"edgeType":"calls","source":9879,"target":8232},{"edgeType":"calls","source":1509,"target":1301},{"edgeType":"contains","source":10301,"target":11168},{"edgeType":"calls","source":6855,"target":6845},{"edgeType":"contains","source":907,"target":1128},{"edgeType":"contains","source":10592,"target":10603},{"edgeType":"contains","source":7131,"target":1618},{"edgeType":"contains","source":6917,"target":7195},{"edgeType":"imports","source":7601,"target":6207},{"edgeType":"calls","source":13269,"target":13076},{"edgeType":"contains","source":3787,"target":3811},{"edgeType":"contains","source":352,"target":367},{"edgeType":"contains","source":1,"target":8077},{"edgeType":"calls","source":8127,"target":1239},{"edgeType":"contains","source":3160,"target":3164},{"edgeType":"calls","source":513,"target":469},{"edgeType":"contains","source":1140,"target":1308},{"edgeType":"contains","source":11697,"target":11227},{"edgeType":"contains","source":12078,"target":12101},{"edgeType":"contains","source":4841,"target":4962},{"edgeType":"contains","source":4913,"target":4844},{"edgeType":"calls","source":8975,"target":8777},{"edgeType":"contains","source":9698,"target":9774},{"edgeType":"calls","source":7519,"target":7402},{"edgeType":"contains","source":10592,"target":10600},{"edgeType":"calls","source":941,"target":943},{"edgeType":"contains","source":12919,"target":13513},{"edgeType":"calls","source":5122,"target":4516},{"edgeType":"contains","source":352,"target":366},{"edgeType":"calls","source":1855,"target":1148},{"edgeType":"contains","source":907,"target":1131},{"edgeType":"calls","source":8769,"target":8819},{"edgeType":"imports","source":6898,"target":6862},{"edgeType":"contains","source":1805,"target":1831},{"edgeType":"calls","source":8308,"target":8313},{"edgeType":"calls","source":6300,"target":6082},{"edgeType":"contains","source":4841,"target":4961},{"edgeType":"contains","source":6917,"target":7197},{"edgeType":"imports","source":7128,"target":7131},{"edgeType":"contains","source":6364,"target":6371},{"edgeType":"contains","source":6199,"target":6201},{"edgeType":"imports","source":7923,"target":7854},{"edgeType":"contains","source":5075,"target":5106},{"edgeType":"imports","source":9143,"target":9144},{"edgeType":"contains","source":907,"target":1130},{"edgeType":"contains","source":10592,"target":10601},{"edgeType":"contains","source":4708,"target":4856},{"edgeType":"contains","source":285,"target":299},{"edgeType":"calls","source":6594,"target":6449},{"edgeType":"contains","source":13366,"target":13379},{"edgeType":"contains","source":11020,"target":11055},{"edgeType":"contains","source":12739,"target":12732},{"edgeType":"calls","source":12243,"target":2572},{"edgeType":"calls","source":6071,"target":5782},{"edgeType":"calls","source":11881,"target":11680},{"edgeType":"calls","source":2281,"target":655},{"edgeType":"contains","source":3461,"target":3320},{"edgeType":"contains","source":1966,"target":2098},{"edgeType":"contains","source":6690,"target":6811},{"edgeType":"contains","source":3886,"target":3887},{"edgeType":"imports","source":1954,"target":1556},{"edgeType":"contains","source":8767,"target":9018},{"edgeType":"contains","source":11515,"target":11565},{"edgeType":"contains","source":7949,"target":7951},{"edgeType":"contains","source":11713,"target":11769},{"edgeType":"contains","source":9925,"target":10118},{"edgeType":"imports","source":2350,"target":907},{"edgeType":"contains","source":13366,"target":13378},{"edgeType":"contains","source":907,"target":1100},{"edgeType":"contains","source":4974,"target":5040},{"edgeType":"contains","source":9699,"target":9725},{"edgeType":"imports","source":12523,"target":12173},{"edgeType":"calls","source":9893,"target":9884},{"edgeType":"contains","source":3093,"target":3101},{"edgeType":"contains","source":3322,"target":3401},{"edgeType":"contains","source":12919,"target":13493},{"edgeType":"imports","source":12150,"target":12109},{"edgeType":"contains","source":11417,"target":11433},{"edgeType":"contains","source":11700,"target":10059},{"edgeType":"contains","source":8767,"target":9017},{"edgeType":"calls","source":12602,"target":11527},{"edgeType":"contains","source":2130,"target":2300},{"edgeType":"contains","source":11713,"target":11770},{"edgeType":"imports","source":2244,"target":1021},{"edgeType":"contains","source":853,"target":659},{"edgeType":"calls","source":7197,"target":2556},{"edgeType":"calls","source":7361,"target":6985},{"edgeType":"contains","source":9898,"target":9899},{"edgeType":"contains","source":9925,"target":10119},{"edgeType":"contains","source":913,"target":917},{"edgeType":"contains","source":13366,"target":13377},{"edgeType":"contains","source":853,"target":663},{"edgeType":"calls","source":656,"target":293},{"edgeType":"contains","source":11481,"target":11560},{"edgeType":"contains","source":3322,"target":3398},{"edgeType":"calls","source":6325,"target":6334},{"edgeType":"contains","source":3621,"target":3643},{"edgeType":"contains","source":11108,"target":11496},{"edgeType":"contains","source":8767,"target":9020},{"edgeType":"calls","source":2164,"target":2166},{"edgeType":"contains","source":4743,"target":4800},{"edgeType":"contains","source":12903,"target":12931},{"edgeType":"contains","source":12938,"target":12903},{"edgeType":"contains","source":3985,"target":3987},{"edgeType":"contains","source":11515,"target":11563},{"edgeType":"imports","source":12280,"target":12308},{"edgeType":"contains","source":2130,"target":2297},{"edgeType":"contains","source":1966,"target":2096},{"edgeType":"contains","source":11776,"target":11928},{"edgeType":"calls","source":3087,"target":3150},{"edgeType":"contains","source":9665,"target":9722},{"edgeType":"imports","source":2314,"target":964},{"edgeType":"contains","source":1,"target":2763},{"edgeType":"contains","source":4510,"target":4624},{"edgeType":"calls","source":9108,"target":8853},{"edgeType":"contains","source":10227,"target":10267},{"edgeType":"contains","source":13366,"target":13376},{"edgeType":"contains","source":3093,"target":3099},{"edgeType":"contains","source":913,"target":916},{"edgeType":"contains","source":11021,"target":11023},{"edgeType":"contains","source":11019,"target":11085},{"edgeType":"contains","source":3154,"target":3322},{"edgeType":"calls","source":11881,"target":11679},{"edgeType":"contains","source":8767,"target":9019},{"edgeType":"contains","source":11481,"target":11561},{"edgeType":"contains","source":12902,"target":12961},{"edgeType":"contains","source":11515,"target":11564},{"edgeType":"contains","source":11713,"target":11768},{"edgeType":"contains","source":3985,"target":3986},{"edgeType":"contains","source":1966,"target":2097},{"edgeType":"calls","source":6689,"target":6679},{"edgeType":"contains","source":12078,"target":12080},{"edgeType":"imports","source":8299,"target":414},{"edgeType":"contains","source":13366,"target":13375},{"edgeType":"contains","source":913,"target":919},{"edgeType":"contains","source":7090,"target":7092},{"edgeType":"contains","source":9852,"target":10262},{"edgeType":"contains","source":2763,"target":2764},{"edgeType":"contains","source":11481,"target":11558},{"edgeType":"contains","source":4844,"target":4847},{"edgeType":"contains","source":7680,"target":429},{"edgeType":"contains","source":5600,"target":5715},{"edgeType":"contains","source":10955,"target":10951},{"edgeType":"calls","source":11642,"target":11693},{"edgeType":"contains","source":11713,"target":11765},{"edgeType":"calls","source":12568,"target":11527},{"edgeType":"contains","source":6362,"target":6405},{"edgeType":"contains","source":8767,"target":9014},{"edgeType":"contains","source":12078,"target":12079},{"edgeType":"contains","source":12077,"target":12110},{"edgeType":"contains","source":12441,"target":12453},{"edgeType":"contains","source":1,"target":2765},{"edgeType":"contains","source":10294,"target":10302},{"edgeType":"contains","source":2130,"target":2303},{"edgeType":"contains","source":13366,"target":13374},{"edgeType":"contains","source":907,"target":1104},{"edgeType":"contains","source":5883,"target":6456},{"edgeType":"contains","source":853,"target":664},{"edgeType":"calls","source":2725,"target":2743},{"edgeType":"contains","source":9699,"target":9721},{"edgeType":"calls","source":4810,"target":4700},{"edgeType":"contains","source":1007,"target":1175},{"edgeType":"contains","source":4844,"target":4846},{"edgeType":"contains","source":11020,"target":11052},{"edgeType":"contains","source":11019,"target":11083},{"edgeType":"contains","source":3093,"target":3105},{"edgeType":"contains","source":3952,"target":3958},{"edgeType":"contains","source":4743,"target":4805},{"edgeType":"calls","source":4324,"target":740},{"edgeType":"contains","source":4708,"target":4833},{"edgeType":"imports","source":9341,"target":9342},{"edgeType":"imports","source":6203,"target":6199},{"edgeType":"contains","source":8767,"target":9013},{"edgeType":"contains","source":12077,"target":12109},{"edgeType":"contains","source":2130,"target":2304},{"edgeType":"imports","source":12152,"target":420},{"edgeType":"contains","source":12441,"target":12452},{"edgeType":"contains","source":4179,"target":4320},{"edgeType":"contains","source":6462,"target":6477},{"edgeType":"contains","source":10294,"target":10303},{"edgeType":"calls","source":9230,"target":9303},{"edgeType":"contains","source":853,"target":667},{"edgeType":"calls","source":4002,"target":3321},{"edgeType":"calls","source":6139,"target":5782},{"edgeType":"contains","source":11108,"target":11492},{"edgeType":"contains","source":9732,"target":9752},{"edgeType":"contains","source":1144,"target":1159},{"edgeType":"contains","source":11481,"target":11556},{"edgeType":"contains","source":13366,"target":13373},{"edgeType":"contains","source":10294,"target":10300},{"edgeType":"contains","source":8765,"target":9078},{"edgeType":"contains","source":2130,"target":2301},{"edgeType":"imports","source":3763,"target":3621},{"edgeType":"contains","source":12210,"target":12213},{"edgeType":"imports","source":12423,"target":12099},{"edgeType":"contains","source":12144,"target":12145},{"edgeType":"contains","source":12441,"target":12451},{"edgeType":"contains","source":9465,"target":2176},{"edgeType":"contains","source":913,"target":920},{"edgeType":"contains","source":5883,"target":6458},{"edgeType":"contains","source":715,"target":716},{"edgeType":"contains","source":11481,"target":11557},{"edgeType":"contains","source":9732,"target":9753},{"edgeType":"calls","source":12251,"target":11840},{"edgeType":"contains","source":13366,"target":13372},{"edgeType":"imports","source":12551,"target":2847},{"edgeType":"imports","source":12280,"target":12305},{"edgeType":"contains","source":3886,"target":3888},{"edgeType":"contains","source":8767,"target":9015},{"edgeType":"contains","source":11019,"target":11080},{"edgeType":"contains","source":3853,"target":3854},{"edgeType":"calls","source":1786,"target":1197},{"edgeType":"calls","source":5815,"target":1026},{"edgeType":"contains","source":2130,"target":2302},{"edgeType":"calls","source":8769,"target":8795},{"edgeType":"calls","source":2045,"target":563},{"edgeType":"contains","source":11021,"target":11032},{"edgeType":"calls","source":11562,"target":436},{"edgeType":"calls","source":2619,"target":1796},{"edgeType":"contains","source":6462,"target":6488},{"edgeType":"contains","source":2631,"target":2632},{"edgeType":"contains","source":4974,"target":5049},{"edgeType":"contains","source":2733,"target":2641},{"edgeType":"contains","source":913,"target":923},{"edgeType":"contains","source":2840,"target":3552},{"edgeType":"calls","source":4810,"target":4697},{"edgeType":"contains","source":1140,"target":1285},{"edgeType":"contains","source":12078,"target":12091},{"edgeType":"contains","source":1966,"target":2106},{"edgeType":"contains","source":853,"target":668},{"edgeType":"contains","source":13796,"target":13798},{"edgeType":"calls","source":7383,"target":1026},{"edgeType":"contains","source":11021,"target":11033},{"edgeType":"contains","source":11019,"target":11095},{"edgeType":"calls","source":4950,"target":4584},{"edgeType":"contains","source":12210,"target":12226},{"edgeType":"contains","source":12919,"target":13502},{"edgeType":"contains","source":6462,"target":6489},{"edgeType":"contains","source":913,"target":922},{"edgeType":"contains","source":4974,"target":5048},{"edgeType":"contains","source":2840,"target":3553},{"edgeType":"calls","source":2858,"target":2844},{"edgeType":"contains","source":6628,"target":6629},{"edgeType":"calls","source":11820,"target":3010},{"edgeType":"calls","source":347,"target":348},{"edgeType":"calls","source":2374,"target":936},{"edgeType":"calls","source":6922,"target":6861},{"edgeType":"contains","source":3787,"target":3792},{"edgeType":"contains","source":13366,"target":13386},{"edgeType":"contains","source":1673,"target":1677},{"edgeType":"contains","source":9699,"target":9730},{"edgeType":"contains","source":13796,"target":13797},{"edgeType":"imports","source":12423,"target":1524},{"edgeType":"calls","source":7197,"target":2565},{"edgeType":"contains","source":11082,"target":12310},{"edgeType":"contains","source":913,"target":925},{"edgeType":"contains","source":6690,"target":6822},{"edgeType":"contains","source":10583,"target":10866},{"edgeType":"contains","source":6628,"target":6630},{"edgeType":"contains","source":6462,"target":6490},{"edgeType":"imports","source":2840,"target":2636},{"edgeType":"calls","source":11855,"target":11435},{"edgeType":"contains","source":3093,"target":3106},{"edgeType":"imports","source":13797,"target":2269},{"edgeType":"calls","source":1665,"target":717},{"edgeType":"contains","source":1144,"target":1163},{"edgeType":"contains","source":1768,"target":1900},{"edgeType":"contains","source":1673,"target":1674},{"edgeType":"contains","source":11282,"target":10338},{"edgeType":"contains","source":9898,"target":9904},{"edgeType":"calls","source":6886,"target":6921},{"edgeType":"contains","source":2130,"target":2305},{"edgeType":"calls","source":3900,"target":3307},{"edgeType":"contains","source":7583,"target":7680},{"edgeType":"calls","source":9893,"target":9894},{"edgeType":"calls","source":9926,"target":9928},{"edgeType":"calls","source":9230,"target":9306},{"edgeType":"calls","source":4641,"target":4648},{"edgeType":"calls","source":7534,"target":575},{"edgeType":"contains","source":6601,"target":6411},{"edgeType":"contains","source":6628,"target":6631},{"edgeType":"contains","source":6462,"target":6491},{"edgeType":"contains","source":5089,"target":4652},{"edgeType":"calls","source":5866,"target":5783},{"edgeType":"contains","source":12077,"target":12119},{"edgeType":"contains","source":11350,"target":10345},{"edgeType":"contains","source":7090,"target":7107},{"edgeType":"imports","source":554,"target":566},{"edgeType":"contains","source":12210,"target":12224},{"edgeType":"contains","source":9898,"target":9905},{"edgeType":"imports","source":12255,"target":12019},{"edgeType":"contains","source":1887,"target":1383},{"edgeType":"calls","source":2147,"target":568},{"edgeType":"calls","source":9336,"target":738},{"edgeType":"contains","source":4841,"target":4948},{"edgeType":"calls","source":11462,"target":2483},{"edgeType":"calls","source":611,"target":617},{"edgeType":"calls","source":3582,"target":3650},{"edgeType":"contains","source":547,"target":646},{"edgeType":"contains","source":10955,"target":10960},{"edgeType":"contains","source":2631,"target":2636},{"edgeType":"contains","source":11481,"target":11566},{"edgeType":"contains","source":9925,"target":10122},{"edgeType":"contains","source":1836,"target":1912},{"edgeType":"contains","source":3490,"target":3491},{"edgeType":"contains","source":11713,"target":11773},{"edgeType":"contains","source":9699,"target":9729},{"edgeType":"contains","source":4841,"target":4947},{"edgeType":"contains","source":11187,"target":11168},{"edgeType":"calls","source":810,"target":789},{"edgeType":"calls","source":6921,"target":6896},{"edgeType":"contains","source":10955,"target":10961},{"edgeType":"calls","source":3319,"target":3348},{"edgeType":"contains","source":7218,"target":2076},{"edgeType":"calls","source":1131,"target":351},{"edgeType":"calls","source":3146,"target":1312},{"edgeType":"contains","source":12078,"target":12086},{"edgeType":"calls","source":10405,"target":9879},{"edgeType":"imports","source":12554,"target":12257},{"edgeType":"contains","source":4841,"target":4946},{"edgeType":"contains","source":4131,"target":4758},{"edgeType":"contains","source":3476,"target":3922},{"edgeType":"calls","source":4813,"target":4598},{"edgeType":"contains","source":13366,"target":13381},{"edgeType":"calls","source":3319,"target":3345},{"edgeType":"calls","source":1196,"target":454},{"edgeType":"contains","source":4974,"target":5051},{"edgeType":"calls","source":12027,"target":2936},{"edgeType":"imports","source":1347,"target":1348},{"edgeType":"contains","source":4743,"target":4813},{"edgeType":"contains","source":12903,"target":12936},{"edgeType":"contains","source":12902,"target":12967},{"edgeType":"contains","source":11515,"target":11567},{"edgeType":"calls","source":270,"target":620},{"edgeType":"contains","source":907,"target":1115},{"edgeType":"calls","source":7944,"target":7952},{"edgeType":"contains","source":1140,"target":1291},{"edgeType":"calls","source":1833,"target":1847},{"edgeType":"contains","source":11713,"target":11771},{"edgeType":"calls","source":230,"target":803},{"edgeType":"contains","source":1673,"target":1678},{"edgeType":"contains","source":9664,"target":9757},{"edgeType":"contains","source":9898,"target":9900},{"edgeType":"contains","source":9925,"target":10120},{"edgeType":"calls","source":710,"target":720},{"edgeType":"calls","source":9761,"target":9762},{"edgeType":"contains","source":10955,"target":10959},{"edgeType":"contains","source":6462,"target":6487},{"edgeType":"calls","source":5133,"target":4190},{"edgeType":"contains","source":4974,"target":5050},{"edgeType":"imports","source":5707,"target":5713},{"edgeType":"calls","source":3409,"target":2670},{"edgeType":"contains","source":2527,"target":2688},{"edgeType":"contains","source":4746,"target":4719},{"edgeType":"contains","source":11515,"target":11568},{"edgeType":"calls","source":12401,"target":2970},{"edgeType":"contains","source":8185,"target":8039},{"edgeType":"contains","source":9925,"target":10121},{"edgeType":"contains","source":1836,"target":1911},{"edgeType":"contains","source":12090,"target":11712},{"edgeType":"contains","source":7453,"target":7454},{"edgeType":"contains","source":4743,"target":4786},{"edgeType":"contains","source":12903,"target":12917},{"edgeType":"contains","source":12919,"target":13478},{"edgeType":"contains","source":7415,"target":7575},{"edgeType":"contains","source":10887,"target":10933},{"edgeType":"calls","source":680,"target":687},{"edgeType":"contains","source":11515,"target":11549},{"edgeType":"contains","source":11674,"target":11905},{"edgeType":"contains","source":13498,"target":13499},{"edgeType":"calls","source":7387,"target":7351},{"edgeType":"contains","source":6527,"target":6563},{"edgeType":"contains","source":13795,"target":13805},{"edgeType":"contains","source":6362,"target":6392},{"edgeType":"calls","source":9110,"target":448},{"edgeType":"contains","source":10237,"target":10999},{"edgeType":"calls","source":8905,"target":8917},{"edgeType":"contains","source":2399,"target":2400},{"edgeType":"contains","source":4380,"target":4412},{"edgeType":"contains","source":6462,"target":6464},{"edgeType":"contains","source":8444,"target":8445},{"edgeType":"contains","source":3785,"target":3830},{"edgeType":"contains","source":907,"target":1084},{"edgeType":"contains","source":5835,"target":6874},{"edgeType":"contains","source":12605,"target":12642},{"edgeType":"imports","source":885,"target":918},{"edgeType":"contains","source":1470,"target":1602},{"edgeType":"contains","source":7221,"target":7246},{"edgeType":"contains","source":12837,"target":12849},{"edgeType":"contains","source":3320,"target":3445},{"edgeType":"contains","source":7415,"target":7574},{"edgeType":"calls","source":6893,"target":6810},{"edgeType":"contains","source":7415,"target":7576},{"edgeType":"contains","source":11515,"target":11550},{"edgeType":"contains","source":12077,"target":12096},{"edgeType":"contains","source":13795,"target":13804},{"edgeType":"contains","source":5835,"target":6875},{"edgeType":"contains","source":6527,"target":6564},{"edgeType":"contains","source":10294,"target":10290},{"edgeType":"contains","source":10390,"target":10485},{"edgeType":"contains","source":6362,"target":6393},{"edgeType":"contains","source":12044,"target":12062},{"edgeType":"contains","source":12143,"target":12164},{"edgeType":"contains","source":6362,"target":6394},{"edgeType":"contains","source":3687,"target":3696},{"edgeType":"contains","source":6462,"target":6465},{"edgeType":"calls","source":1924,"target":1232},{"edgeType":"calls","source":4620,"target":4335},{"edgeType":"imports","source":3763,"target":3665},{"edgeType":"imports","source":891,"target":733},{"edgeType":"contains","source":12837,"target":12848},{"edgeType":"contains","source":11108,"target":11482},{"edgeType":"contains","source":7415,"target":7577},{"edgeType":"contains","source":8767,"target":9004},{"edgeType":"contains","source":9476,"target":9223},{"edgeType":"imports","source":10246,"target":9870},{"edgeType":"contains","source":8807,"target":8821},{"edgeType":"calls","source":4987,"target":4584},{"edgeType":"contains","source":4131,"target":5786},{"edgeType":"contains","source":10756,"target":10764},{"edgeType":"contains","source":11713,"target":11751},{"edgeType":"contains","source":4713,"target":429},{"edgeType":"contains","source":6527,"target":6565},{"edgeType":"contains","source":13795,"target":13803},{"edgeType":"contains","source":12407,"target":12435},{"edgeType":"calls","source":13001,"target":13013},{"edgeType":"contains","source":6287,"target":6605},{"edgeType":"contains","source":8444,"target":8447},{"edgeType":"contains","source":2350,"target":1802},{"edgeType":"contains","source":5600,"target":5705},{"edgeType":"imports","source":885,"target":3030},{"edgeType":"contains","source":891,"target":1582},{"edgeType":"contains","source":3320,"target":3443},{"edgeType":"contains","source":11515,"target":11546},{"edgeType":"contains","source":1470,"target":1600},{"edgeType":"contains","source":8767,"target":9003},{"edgeType":"contains","source":11713,"target":11752},{"edgeType":"contains","source":13795,"target":13802},{"edgeType":"calls","source":1572,"target":1576},{"edgeType":"calls","source":10801,"target":10392},{"edgeType":"imports","source":12280,"target":2845},{"edgeType":"contains","source":4380,"target":4408},{"edgeType":"contains","source":10237,"target":10998},{"edgeType":"contains","source":3753,"target":3762},{"edgeType":"contains","source":6362,"target":6396},{"edgeType":"contains","source":8444,"target":8446},{"edgeType":"calls","source":7192,"target":7057},{"edgeType":"contains","source":2350,"target":1803},{"edgeType":"contains","source":4421,"target":4194},{"edgeType":"contains","source":6287,"target":6607},{"edgeType":"contains","source":3785,"target":3827},{"edgeType":"calls","source":2530,"target":2531},{"edgeType":"calls","source":449,"target":450},{"edgeType":"imports","source":8096,"target":414},{"edgeType":"contains","source":907,"target":1085},{"edgeType":"calls","source":2681,"target":1021},{"edgeType":"contains","source":11019,"target":11068},{"edgeType":"contains","source":1603,"target":1706},{"edgeType":"calls","source":2404,"target":2209},{"edgeType":"contains","source":3687,"target":3694},{"edgeType":"imports","source":1434,"target":1867},{"edgeType":"contains","source":1470,"target":1601},{"edgeType":"calls","source":12575,"target":2970},{"edgeType":"calls","source":2215,"target":665},{"edgeType":"imports","source":11776,"target":2614},{"edgeType":"contains","source":11019,"target":11065},{"edgeType":"contains","source":12903,"target":12913},{"edgeType":"contains","source":7018,"target":7193},{"edgeType":"contains","source":10887,"target":10929},{"edgeType":"calls","source":5136,"target":4191},{"edgeType":"contains","source":4480,"target":4487},{"edgeType":"imports","source":2350,"target":952},{"edgeType":"contains","source":285,"target":287},{"edgeType":"contains","source":6594,"target":6596},{"edgeType":"contains","source":10524,"target":10554},{"edgeType":"calls","source":13081,"target":1026},{"edgeType":"contains","source":6527,"target":6559},{"edgeType":"contains","source":6527,"target":6558},{"edgeType":"contains","source":9925,"target":10097},{"edgeType":"calls","source":5471,"target":148},{"edgeType":"calls","source":11517,"target":3000},{"edgeType":"contains","source":4315,"target":4317},{"edgeType":"contains","source":1603,"target":1711},{"edgeType":"calls","source":7320,"target":7318},{"edgeType":"calls","source":10103,"target":9836},{"edgeType":"contains","source":11515,"target":11544},{"edgeType":"contains","source":1836,"target":1888},{"edgeType":"calls","source":7521,"target":7430},{"edgeType":"calls","source":12213,"target":12079},{"edgeType":"contains","source":3320,"target":3451},{"edgeType":"contains","source":8310,"target":8365},{"edgeType":"contains","source":11713,"target":11750},{"edgeType":"contains","source":13795,"target":13800},{"edgeType":"contains","source":12903,"target":12912},{"edgeType":"calls","source":4986,"target":4612},{"edgeType":"contains","source":6362,"target":6389},{"edgeType":"calls","source":1408,"target":1369},{"edgeType":"calls","source":1407,"target":1400},{"edgeType":"contains","source":12519,"target":2618},{"edgeType":"contains","source":8767,"target":8997},{"edgeType":"imports","source":7923,"target":7897},{"edgeType":"contains","source":6594,"target":6597},{"edgeType":"contains","source":6527,"target":6560},{"edgeType":"contains","source":10390,"target":10481},{"edgeType":"contains","source":285,"target":286},{"edgeType":"contains","source":10524,"target":10556},{"edgeType":"contains","source":1007,"target":1158},{"edgeType":"imports","source":885,"target":3029},{"edgeType":"calls","source":3850,"target":3890},{"edgeType":"contains","source":853,"target":647},{"edgeType":"contains","source":7018,"target":7194},{"edgeType":"calls","source":1023,"target":619},{"edgeType":"calls","source":4863,"target":1026},{"edgeType":"contains","source":9390,"target":9767},{"edgeType":"contains","source":11384,"target":10321},{"edgeType":"calls","source":11548,"target":11553},{"edgeType":"contains","source":3320,"target":3448},{"edgeType":"contains","source":8765,"target":9062},{"edgeType":"calls","source":4876,"target":4850},{"edgeType":"contains","source":13795,"target":13799},{"edgeType":"contains","source":11019,"target":11063},{"edgeType":"contains","source":12903,"target":12911},{"edgeType":"contains","source":285,"target":289},{"edgeType":"contains","source":6628,"target":6601},{"edgeType":"calls","source":6925,"target":6880},{"edgeType":"contains","source":8077,"target":8192},{"edgeType":"contains","source":6527,"target":6561},{"edgeType":"contains","source":6362,"target":6390},{"edgeType":"calls","source":1408,"target":1372},{"edgeType":"contains","source":10524,"target":10552},{"edgeType":"contains","source":8510,"target":8511},{"edgeType":"contains","source":4380,"target":4414},{"edgeType":"contains","source":3687,"target":3699},{"edgeType":"contains","source":1007,"target":1161},{"edgeType":"contains","source":11159,"target":10951},{"edgeType":"calls","source":13855,"target":12969},{"edgeType":"contains","source":3320,"target":3447},{"edgeType":"contains","source":7415,"target":7572},{"edgeType":"contains","source":7486,"target":7487},{"edgeType":"contains","source":3320,"target":3449},{"edgeType":"contains","source":12407,"target":12430},{"edgeType":"calls","source":8905,"target":8922},{"edgeType":"imports","source":7583,"target":1524},{"edgeType":"calls","source":12485,"target":12101},{"edgeType":"contains","source":12903,"target":12910},{"edgeType":"calls","source":5800,"target":5802},{"edgeType":"contains","source":6199,"target":6159},{"edgeType":"contains","source":6527,"target":6562},{"edgeType":"contains","source":10390,"target":10479},{"edgeType":"contains","source":285,"target":288},{"edgeType":"contains","source":12605,"target":12634},{"edgeType":"contains","source":6362,"target":6391},{"edgeType":"contains","source":3687,"target":3698},{"edgeType":"contains","source":4380,"target":4413},{"edgeType":"contains","source":6462,"target":6463},{"edgeType":"calls","source":12418,"target":436},{"edgeType":"calls","source":4004,"target":3342},{"edgeType":"contains","source":5835,"target":6873},{"edgeType":"contains","source":3786,"target":3800},{"edgeType":"calls","source":7985,"target":7846},{"edgeType":"contains","source":7415,"target":7573},{"edgeType":"calls","source":2666,"target":2539},{"edgeType":"contains","source":3320,"target":3454},{"edgeType":"contains","source":2399,"target":2408},{"edgeType":"contains","source":7474,"target":469},{"edgeType":"contains","source":285,"target":291},{"edgeType":"contains","source":3621,"target":3637},{"edgeType":"contains","source":3786,"target":3807},{"edgeType":"contains","source":9732,"target":9750},{"edgeType":"contains","source":11481,"target":11554},{"edgeType":"contains","source":13366,"target":13371},{"edgeType":"calls","source":3387,"target":1325},{"edgeType":"contains","source":5600,"target":4654},{"edgeType":"contains","source":120,"target":121},{"edgeType":"calls","source":3354,"target":3405},{"edgeType":"contains","source":11019,"target":11077},{"edgeType":"contains","source":10294,"target":10298},{"edgeType":"contains","source":11776,"target":11922},{"edgeType":"contains","source":2130,"target":2291},{"edgeType":"contains","source":7018,"target":7205},{"edgeType":"calls","source":4846,"target":4721},{"edgeType":"contains","source":4743,"target":4794},{"edgeType":"imports","source":6203,"target":952},{"edgeType":"contains","source":2631,"target":2615},{"edgeType":"contains","source":6891,"target":6914},{"edgeType":"contains","source":8767,"target":9010},{"edgeType":"contains","source":12441,"target":12449},{"edgeType":"contains","source":12436,"target":12604},{"edgeType":"contains","source":2962,"target":2924},{"edgeType":"calls","source":9440,"target":9253},{"edgeType":"contains","source":1140,"target":1268},{"edgeType":"contains","source":3320,"target":3455},{"edgeType":"contains","source":12143,"target":12172},{"edgeType":"contains","source":285,"target":290},{"edgeType":"calls","source":8214,"target":8149},{"edgeType":"contains","source":5600,"target":5712},{"edgeType":"contains","source":4016,"target":4075},{"edgeType":"contains","source":11481,"target":11555},{"edgeType":"calls","source":10491,"target":10496},{"edgeType":"contains","source":2130,"target":2292},{"edgeType":"contains","source":13795,"target":13812},{"edgeType":"contains","source":12441,"target":12448},{"edgeType":"contains","source":6891,"target":6915},{"edgeType":"contains","source":853,"target":651},{"edgeType":"contains","source":12919,"target":13485},{"edgeType":"calls","source":749,"target":653},{"edgeType":"calls","source":9636,"target":9518},{"edgeType":"contains","source":6362,"target":6402},{"edgeType":"contains","source":12276,"target":12278},{"edgeType":"contains","source":12903,"target":12924},{"edgeType":"contains","source":6462,"target":6473},{"edgeType":"calls","source":13097,"target":13218},{"edgeType":"contains","source":10583,"target":10853},{"edgeType":"contains","source":1140,"target":1267},{"edgeType":"contains","source":8767,"target":9009},{"edgeType":"calls","source":9762,"target":2441},{"edgeType":"calls","source":4381,"target":4335},{"edgeType":"contains","source":2631,"target":2613},{"edgeType":"contains","source":11318,"target":11320},{"edgeType":"contains","source":12143,"target":12171},{"edgeType":"contains","source":1672,"target":1688},{"edgeType":"contains","source":3785,"target":3836},{"edgeType":"contains","source":13366,"target":13369},{"edgeType":"contains","source":9798,"target":9816},{"edgeType":"calls","source":10392,"target":10397},{"edgeType":"contains","source":4016,"target":4074},{"edgeType":"calls","source":2666,"target":2534},{"edgeType":"calls","source":4722,"target":4335},{"edgeType":"calls","source":4783,"target":2444},{"edgeType":"contains","source":11776,"target":11920},{"edgeType":"contains","source":12441,"target":12447},{"edgeType":"contains","source":13795,"target":13811},{"edgeType":"contains","source":6891,"target":6916},{"edgeType":"contains","source":10294,"target":10296},{"edgeType":"contains","source":8147,"target":8149},{"edgeType":"contains","source":10237,"target":11006},{"edgeType":"calls","source":6892,"target":6851},{"edgeType":"contains","source":10227,"target":10259},{"edgeType":"contains","source":8767,"target":9012},{"edgeType":"calls","source":11120,"target":7910},{"edgeType":"imports","source":11259,"target":11227},{"edgeType":"contains","source":12276,"target":12277},{"edgeType":"contains","source":6362,"target":6403},{"edgeType":"contains","source":12903,"target":12923},{"edgeType":"contains","source":12919,"target":13484},{"edgeType":"contains","source":853,"target":654},{"edgeType":"contains","source":12110,"target":12136},{"edgeType":"contains","source":12143,"target":12170},{"edgeType":"contains","source":11318,"target":11321},{"edgeType":"contains","source":3320,"target":3453},{"edgeType":"contains","source":7090,"target":7091},{"edgeType":"contains","source":3753,"target":3770},{"edgeType":"calls","source":8830,"target":681},{"edgeType":"contains","source":285,"target":292},{"edgeType":"contains","source":13366,"target":13368},{"edgeType":"contains","source":3785,"target":3835},{"edgeType":"contains","source":2130,"target":2290},{"edgeType":"contains","source":120,"target":122},{"edgeType":"contains","source":4315,"target":4318},{"edgeType":"contains","source":8925,"target":9398},{"edgeType":"contains","source":10294,"target":10297},{"edgeType":"contains","source":8147,"target":8148},{"edgeType":"contains","source":6362,"target":6404},{"edgeType":"calls","source":9240,"target":9112},{"edgeType":"contains","source":12919,"target":13483},{"edgeType":"contains","source":12903,"target":12922},{"edgeType":"contains","source":853,"target":653},{"edgeType":"contains","source":907,"target":1093},{"edgeType":"contains","source":1007,"target":1164},{"edgeType":"calls","source":749,"target":655},{"edgeType":"contains","source":12143,"target":12169},{"edgeType":"contains","source":4457,"target":4151},{"edgeType":"contains","source":8767,"target":9006},{"edgeType":"contains","source":285,"target":295},{"edgeType":"contains","source":7420,"target":7424},{"edgeType":"contains","source":11417,"target":11420},{"edgeType":"contains","source":5042,"target":5043},{"edgeType":"contains","source":10237,"target":11003},{"edgeType":"contains","source":13366,"target":13367},{"edgeType":"contains","source":3320,"target":3458},{"edgeType":"calls","source":3818,"target":3816},{"edgeType":"contains","source":11713,"target":11757},{"edgeType":"contains","source":11712,"target":11788},{"edgeType":"imports","source":12554,"target":12305},{"edgeType":"contains","source":3621,"target":3641},{"edgeType":"contains","source":6362,"target":6397},{"edgeType":"calls","source":6825,"target":6816},{"edgeType":"contains","source":2130,"target":2295},{"edgeType":"contains","source":4285,"target":4198},{"edgeType":"contains","source":7221,"target":7250},{"edgeType":"contains","source":10583,"target":10848},{"edgeType":"imports","source":9143,"target":9178},{"edgeType":"contains","source":853,"target":656},{"edgeType":"contains","source":8077,"target":8197},{"edgeType":"contains","source":11417,"target":11421},{"edgeType":"contains","source":8767,"target":9005},{"edgeType":"contains","source":12143,"target":12168},{"edgeType":"contains","source":5075,"target":5076},{"edgeType":"contains","source":1144,"target":1148},{"edgeType":"contains","source":11318,"target":11319},{"edgeType":"contains","source":285,"target":294},{"edgeType":"contains","source":7415,"target":7580},{"edgeType":"contains","source":3621,"target":3640},{"edgeType":"contains","source":10237,"target":11004},{"edgeType":"contains","source":10227,"target":10257},{"edgeType":"contains","source":3320,"target":3459},{"edgeType":"contains","source":11713,"target":11758},{"edgeType":"calls","source":2695,"target":2691},{"edgeType":"contains","source":5600,"target":5708},{"edgeType":"calls","source":8975,"target":8873},{"edgeType":"contains","source":2130,"target":2296},{"edgeType":"contains","source":1966,"target":2095},{"edgeType":"contains","source":6362,"target":6398},{"edgeType":"contains","source":8444,"target":8448},{"edgeType":"contains","source":10237,"target":11005},{"edgeType":"contains","source":907,"target":1095},{"edgeType":"contains","source":10583,"target":10849},{"edgeType":"calls","source":10854,"target":10878},{"edgeType":"contains","source":12919,"target":13481},{"edgeType":"calls","source":11415,"target":3000},{"edgeType":"calls","source":5018,"target":4669},{"edgeType":"contains","source":12903,"target":12920},{"edgeType":"contains","source":853,"target":655},{"edgeType":"contains","source":1007,"target":1170},{"edgeType":"contains","source":3093,"target":3094},{"edgeType":"calls","source":9307,"target":8097},{"edgeType":"contains","source":12143,"target":12167},{"edgeType":"contains","source":907,"target":1099},{"edgeType":"contains","source":7415,"target":7581},{"edgeType":"contains","source":11417,"target":11418},{"edgeType":"contains","source":7221,"target":7253},{"edgeType":"contains","source":7255,"target":7256},{"edgeType":"contains","source":3320,"target":3456},{"edgeType":"contains","source":3621,"target":3639},{"edgeType":"contains","source":4016,"target":4078},{"edgeType":"contains","source":10237,"target":11001},{"edgeType":"calls","source":2375,"target":980},{"edgeType":"contains","source":10227,"target":10254},{"edgeType":"contains","source":9665,"target":9710},{"edgeType":"contains","source":12077,"target":12099},{"edgeType":"contains","source":13795,"target":13807},{"edgeType":"calls","source":1872,"target":1778},{"edgeType":"calls","source":2133,"target":2140},{"edgeType":"contains","source":2130,"target":2293},{"edgeType":"contains","source":8244,"target":8309},{"edgeType":"contains","source":12441,"target":12443},{"edgeType":"contains","source":12605,"target":12644},{"edgeType":"imports","source":8096,"target":409},{"edgeType":"contains","source":10524,"target":10561},{"edgeType":"calls","source":781,"target":717},{"edgeType":"contains","source":7221,"target":7252},{"edgeType":"calls","source":7419,"target":7430},{"edgeType":"imports","source":11096,"target":10999},{"edgeType":"contains","source":8767,"target":9008},{"edgeType":"calls","source":3061,"target":855},{"edgeType":"contains","source":12837,"target":12851},{"edgeType":"contains","source":12919,"target":13480},{"edgeType":"contains","source":12903,"target":12918},{"edgeType":"calls","source":5800,"target":5794},{"edgeType":"imports","source":11983,"target":414},{"edgeType":"contains","source":285,"target":296},{"edgeType":"contains","source":1140,"target":1274},{"edgeType":"contains","source":11417,"target":11419},{"edgeType":"contains","source":4016,"target":4077},{"edgeType":"calls","source":6033,"target":5970},{"edgeType":"calls","source":4433,"target":604},{"edgeType":"contains","source":3320,"target":3457},{"edgeType":"contains","source":10237,"target":11002},{"edgeType":"calls","source":3850,"target":3880},{"edgeType":"contains","source":9664,"target":9740},{"edgeType":"contains","source":12143,"target":12166},{"edgeType":"contains","source":3786,"target":3808},{"edgeType":"calls","source":1449,"target":1148},{"edgeType":"contains","source":6362,"target":6400},{"edgeType":"contains","source":8279,"target":8280},{"edgeType":"calls","source":10491,"target":10502},{"edgeType":"contains","source":2130,"target":2294},{"edgeType":"contains","source":10301,"target":11133},{"edgeType":"calls","source":7618,"target":7604},{"edgeType":"contains","source":6462,"target":6471},{"edgeType":"contains","source":907,"target":1097},{"edgeType":"calls","source":9078,"target":8853},{"edgeType":"contains","source":8807,"target":8824},{"edgeType":"contains","source":8767,"target":9007},{"edgeType":"contains","source":12837,"target":12850},{"edgeType":"contains","source":11019,"target":11072},{"edgeType":"contains","source":12919,"target":13479},{"edgeType":"contains","source":9830,"target":9858},{"edgeType":"contains","source":317,"target":331},{"edgeType":"contains","source":3815,"target":3940},{"edgeType":"calls","source":1838,"target":745},{"edgeType":"contains","source":12605,"target":12625},{"edgeType":"imports","source":1511,"target":1580},{"edgeType":"imports","source":1139,"target":1484},{"edgeType":"contains","source":3320,"target":3429},{"edgeType":"contains","source":9170,"target":10234},{"edgeType":"calls","source":7023,"target":649},{"edgeType":"contains","source":86,"target":93},{"edgeType":"contains","source":11712,"target":11767},{"edgeType":"contains","source":8767,"target":8985},{"edgeType":"calls","source":978,"target":979},{"edgeType":"contains","source":10389,"target":10499},{"edgeType":"contains","source":10307,"target":9870},{"edgeType":"calls","source":12968,"target":12965},{"edgeType":"imports","source":6203,"target":6229},{"edgeType":"contains","source":8244,"target":8286},{"edgeType":"imports","source":8299,"target":448},{"edgeType":"contains","source":12044,"target":12047},{"edgeType":"contains","source":5107,"target":5112},{"edgeType":"contains","source":317,"target":330},{"edgeType":"contains","source":1007,"target":1138},{"edgeType":"contains","source":10524,"target":10543},{"edgeType":"imports","source":12554,"target":12302},{"edgeType":"contains","source":12605,"target":12624},{"edgeType":"calls","source":1159,"target":652},{"edgeType":"contains","source":3815,"target":3939},{"edgeType":"calls","source":2233,"target":2243},{"edgeType":"contains","source":7629,"target":6209},{"edgeType":"contains","source":9002,"target":9099},{"edgeType":"contains","source":11318,"target":11298},{"edgeType":"contains","source":3652,"target":3707},{"edgeType":"contains","source":7415,"target":7559},{"edgeType":"contains","source":12896,"target":13116},{"edgeType":"calls","source":12248,"target":12030},{"edgeType":"contains","source":1836,"target":1868},{"edgeType":"contains","source":86,"target":92},{"edgeType":"imports","source":9507,"target":9510},{"edgeType":"contains","source":10389,"target":10500},{"edgeType":"calls","source":12803,"target":12794},{"edgeType":"contains","source":9925,"target":10086},{"edgeType":"contains","source":4380,"target":4394},{"edgeType":"contains","source":12044,"target":12046},{"edgeType":"imports","source":6203,"target":6228},{"edgeType":"contains","source":8532,"target":414},{"edgeType":"calls","source":2500,"target":1362},{"edgeType":"contains","source":5107,"target":5111},{"edgeType":"contains","source":3815,"target":3938},{"edgeType":"calls","source":6406,"target":6036},{"edgeType":"contains","source":9830,"target":9856},{"edgeType":"calls","source":7869,"target":1908},{"edgeType":"calls","source":11811,"target":11833},{"edgeType":"contains","source":2727,"target":2783},{"edgeType":"contains","source":646,"target":704},{"edgeType":"contains","source":11547,"target":11595},{"edgeType":"calls","source":12485,"target":12079},{"edgeType":"contains","source":8147,"target":725},{"edgeType":"contains","source":12110,"target":12113},{"edgeType":"contains","source":10389,"target":10497},{"edgeType":"contains","source":8310,"target":8356},{"edgeType":"calls","source":945,"target":947},{"edgeType":"calls","source":978,"target":981},{"edgeType":"contains","source":317,"target":333},{"edgeType":"imports","source":554,"target":590},{"edgeType":"contains","source":3815,"target":3937},{"edgeType":"calls","source":1011,"target":1014},{"edgeType":"contains","source":317,"target":332},{"edgeType":"contains","source":5600,"target":5689},{"edgeType":"contains","source":9830,"target":9857},{"edgeType":"calls","source":6068,"target":5971},{"edgeType":"calls","source":483,"target":469},{"edgeType":"calls","source":6040,"target":5782},{"edgeType":"contains","source":1603,"target":1689},{"edgeType":"contains","source":3320,"target":3428},{"edgeType":"calls","source":7980,"target":7981},{"edgeType":"contains","source":7018,"target":7184},{"edgeType":"contains","source":9506,"target":10389},{"edgeType":"calls","source":1445,"target":1301},{"edgeType":"calls","source":12450,"target":12108},{"edgeType":"calls","source":7613,"target":1388},{"edgeType":"contains","source":11712,"target":11766},{"edgeType":"contains","source":12143,"target":12146},{"edgeType":"contains","source":9996,"target":9997},{"edgeType":"contains","source":4380,"target":4392},{"edgeType":"calls","source":6925,"target":6861},{"edgeType":"contains","source":554,"target":1441},{"edgeType":"calls","source":3191,"target":3197},{"edgeType":"calls","source":4578,"target":4593},{"edgeType":"calls","source":1143,"target":1145},{"edgeType":"contains","source":5883,"target":6422},{"edgeType":"contains","source":10583,"target":10823},{"edgeType":"contains","source":4380,"target":4399},{"edgeType":"calls","source":9116,"target":8706},{"edgeType":"imports","source":12554,"target":12297},{"edgeType":"calls","source":3887,"target":3816},{"edgeType":"contains","source":9925,"target":10080},{"edgeType":"calls","source":2365,"target":2374},{"edgeType":"calls","source":659,"target":293},{"edgeType":"contains","source":1470,"target":1589},{"edgeType":"contains","source":7551,"target":7566},{"edgeType":"contains","source":9665,"target":9683},{"edgeType":"imports","source":11423,"target":11426},{"edgeType":"contains","source":3906,"target":3238},{"edgeType":"contains","source":7018,"target":7176},{"edgeType":"contains","source":11019,"target":11048},{"edgeType":"contains","source":4676,"target":4736},{"edgeType":"contains","source":9002,"target":9095},{"edgeType":"contains","source":10461,"target":10377},{"edgeType":"imports","source":554,"target":588},{"edgeType":"contains","source":12110,"target":12111},{"edgeType":"imports","source":8011,"target":6209},{"edgeType":"contains","source":10301,"target":11109},{"edgeType":"contains","source":10490,"target":10535},{"edgeType":"contains","source":317,"target":335},{"edgeType":"contains","source":10390,"target":10464},{"edgeType":"contains","source":10389,"target":10495},{"edgeType":"contains","source":3652,"target":3711},{"edgeType":"contains","source":4380,"target":4398},{"edgeType":"calls","source":3202,"target":740},{"edgeType":"contains","source":1470,"target":1590},{"edgeType":"contains","source":9830,"target":9855},{"edgeType":"calls","source":5989,"target":4190},{"edgeType":"contains","source":3726,"target":3531},{"edgeType":"calls","source":11346,"target":3000},{"edgeType":"contains","source":11515,"target":11529},{"edgeType":"contains","source":11545,"target":11656},{"edgeType":"contains","source":1275,"target":1293},{"edgeType":"calls","source":2366,"target":230},{"edgeType":"calls","source":2167,"target":2171},{"edgeType":"contains","source":13067,"target":13096},{"edgeType":"contains","source":11019,"target":11049},{"edgeType":"contains","source":9002,"target":9094},{"edgeType":"contains","source":7018,"target":7177},{"edgeType":"contains","source":9294,"target":2156},{"edgeType":"calls","source":12404,"target":2970},{"edgeType":"calls","source":3729,"target":3429},{"edgeType":"contains","source":8807,"target":8797},{"edgeType":"contains","source":317,"target":334},{"edgeType":"contains","source":10490,"target":10536},{"edgeType":"imports","source":554,"target":589},{"edgeType":"contains","source":10391,"target":10434},{"edgeType":"contains","source":6527,"target":6543},{"edgeType":"contains","source":4380,"target":4397},{"edgeType":"calls","source":1903,"target":1899},{"edgeType":"calls","source":10757,"target":3286},{"edgeType":"calls","source":3191,"target":3192},{"edgeType":"contains","source":3815,"target":3942},{"edgeType":"contains","source":7018,"target":7179},{"edgeType":"imports","source":11096,"target":420},{"edgeType":"contains","source":11712,"target":11761},{"edgeType":"contains","source":13067,"target":13095},{"edgeType":"contains","source":10227,"target":10230},{"edgeType":"contains","source":9002,"target":9097},{"edgeType":"contains","source":12919,"target":13455},{"edgeType":"contains","source":3815,"target":3943},{"edgeType":"contains","source":10490,"target":10533},{"edgeType":"contains","source":8077,"target":8176},{"edgeType":"contains","source":10389,"target":10493},{"edgeType":"calls","source":3496,"target":3250},{"edgeType":"contains","source":6364,"target":6312},{"edgeType":"contains","source":3815,"target":3941},{"edgeType":"contains","source":5600,"target":5685},{"edgeType":"calls","source":8214,"target":731},{"edgeType":"calls","source":2366,"target":1285},{"edgeType":"calls","source":6263,"target":6264},{"edgeType":"contains","source":7629,"target":6207},{"edgeType":"contains","source":9506,"target":10385},{"edgeType":"calls","source":8806,"target":8804},{"edgeType":"calls","source":8905,"target":8906},{"edgeType":"imports","source":12591,"target":583},{"edgeType":"contains","source":9002,"target":9096},{"edgeType":"calls","source":4932,"target":4187},{"edgeType":"imports","source":5213,"target":5214},{"edgeType":"imports","source":9698,"target":420},{"edgeType":"contains","source":13067,"target":13094},{"edgeType":"imports","source":554,"target":587},{"edgeType":"contains","source":8740,"target":8762},{"edgeType":"imports","source":12355,"target":2614},{"edgeType":"calls","source":11118,"target":11123},{"edgeType":"contains","source":10389,"target":10494},{"edgeType":"calls","source":1610,"target":1467},{"edgeType":"contains","source":317,"target":336},{"edgeType":"contains","source":11020,"target":11030},{"edgeType":"imports","source":2314,"target":1007},{"edgeType":"contains","source":12241,"target":12290},{"edgeType":"contains","source":10524,"target":10550},{"edgeType":"contains","source":12903,"target":12909},{"edgeType":"calls","source":4760,"target":4232},{"edgeType":"contains","source":8767,"target":8994},{"edgeType":"contains","source":8147,"target":731},{"edgeType":"contains","source":9390,"target":9764},{"edgeType":"calls","source":10094,"target":10103},{"edgeType":"contains","source":1470,"target":1594},{"edgeType":"contains","source":11712,"target":11777},{"edgeType":"contains","source":9173,"target":2749},{"edgeType":"contains","source":10227,"target":10245},{"edgeType":"contains","source":10524,"target":10551},{"edgeType":"contains","source":12919,"target":13469},{"edgeType":"contains","source":1275,"target":1297},{"edgeType":"contains","source":10887,"target":10926},{"edgeType":"contains","source":12903,"target":12908},{"edgeType":"contains","source":8767,"target":8993},{"edgeType":"calls","source":945,"target":936},{"edgeType":"calls","source":10474,"target":436},{"edgeType":"contains","source":4639,"target":5886},{"edgeType":"contains","source":12519,"target":2614},{"edgeType":"calls","source":1837,"target":766},{"edgeType":"contains","source":7415,"target":7567},{"edgeType":"contains","source":3687,"target":3688},{"edgeType":"contains","source":9732,"target":9735},{"edgeType":"contains","source":9699,"target":9701},{"edgeType":"contains","source":11481,"target":11538},{"edgeType":"contains","source":1470,"target":1591},{"edgeType":"contains","source":4380,"target":4401},{"edgeType":"contains","source":7018,"target":7191},{"edgeType":"calls","source":6248,"target":4612},{"edgeType":"imports","source":5741,"target":5746},{"edgeType":"contains","source":12903,"target":12907},{"edgeType":"imports","source":7923,"target":7865},{"edgeType":"calls","source":2905,"target":2540},{"edgeType":"calls","source":11872,"target":436},{"edgeType":"contains","source":1870,"target":1876},{"edgeType":"calls","source":4982,"target":4748},{"edgeType":"calls","source":5000,"target":4190},{"edgeType":"contains","source":9170,"target":10244},{"edgeType":"contains","source":7221,"target":7240},{"edgeType":"contains","source":10239,"target":9870},{"edgeType":"imports","source":12521,"target":12261},{"edgeType":"contains","source":3781,"target":3944},{"edgeType":"contains","source":7415,"target":7568},{"edgeType":"contains","source":11545,"target":11665},{"edgeType":"contains","source":9390,"target":9766},{"edgeType":"contains","source":5600,"target":4640},{"edgeType":"contains","source":10390,"target":10475},{"edgeType":"contains","source":11019,"target":11060},{"edgeType":"calls","source":6034,"target":5960},{"edgeType":"contains","source":4380,"target":4400},{"edgeType":"contains","source":1470,"target":1592},{"edgeType":"contains","source":3665,"target":3310},{"edgeType":"contains","source":8807,"target":8812},{"edgeType":"contains","source":8767,"target":8995},{"edgeType":"calls","source":1605,"target":1618},{"edgeType":"contains","source":6527,"target":6557},{"edgeType":"contains","source":12837,"target":12838},{"edgeType":"contains","source":9390,"target":9765},{"edgeType":"calls","source":3116,"target":2343},{"edgeType":"contains","source":4743,"target":4774},{"edgeType":"contains","source":4676,"target":4737},{"edgeType":"contains","source":9170,"target":10243},{"edgeType":"contains","source":11286,"target":11239},{"edgeType":"contains","source":7415,"target":7569},{"edgeType":"contains","source":8107,"target":8314},{"edgeType":"contains","source":3786,"target":3788},{"edgeType":"contains","source":11515,"target":11539},{"edgeType":"contains","source":9732,"target":9733},{"edgeType":"contains","source":1470,"target":1597},{"edgeType":"calls","source":12401,"target":11527},{"edgeType":"calls","source":1440,"target":1443},{"edgeType":"calls","source":6925,"target":6870},{"edgeType":"imports","source":1511,"target":1584},{"edgeType":"contains","source":10887,"target":10921},{"edgeType":"calls","source":1786,"target":230},{"edgeType":"imports","source":6203,"target":6225},{"edgeType":"calls","source":9410,"target":9114},{"edgeType":"contains","source":2350,"target":1800},{"edgeType":"calls","source":2299,"target":2298},{"edgeType":"contains","source":11545,"target":11663},{"edgeType":"contains","source":11350,"target":11366},{"edgeType":"contains","source":8244,"target":8290},{"edgeType":"contains","source":1470,"target":1598},{"edgeType":"imports","source":12554,"target":12289},{"edgeType":"imports","source":885,"target":907},{"edgeType":"calls","source":6925,"target":6871},{"edgeType":"calls","source":11928,"target":2936},{"edgeType":"contains","source":12407,"target":12424},{"edgeType":"imports","source":9852,"target":6209},{"edgeType":"contains","source":4380,"target":4406},{"edgeType":"imports","source":13766,"target":1144},{"edgeType":"contains","source":12903,"target":12904},{"edgeType":"contains","source":9002,"target":9103},{"edgeType":"contains","source":6692,"target":6721},{"edgeType":"calls","source":10722,"target":10725},{"edgeType":"contains","source":11515,"target":11537},{"edgeType":"contains","source":2350,"target":1801},{"edgeType":"calls","source":2452,"target":1784},{"edgeType":"contains","source":11545,"target":11664},{"edgeType":"contains","source":7415,"target":7563},{"edgeType":"imports","source":12280,"target":12328},{"edgeType":"calls","source":5862,"target":719},{"edgeType":"contains","source":8310,"target":8357},{"edgeType":"calls","source":6085,"target":148},{"edgeType":"imports","source":12521,"target":12256},{"edgeType":"contains","source":9852,"target":10239},{"edgeType":"contains","source":3687,"target":3692},{"edgeType":"calls","source":6826,"target":6770},{"edgeType":"contains","source":10390,"target":10470},{"edgeType":"contains","source":10389,"target":10501},{"edgeType":"contains","source":8310,"target":8360},{"edgeType":"contains","source":8774,"target":8775},{"edgeType":"contains","source":3154,"target":3300},{"edgeType":"imports","source":12044,"target":621},{"edgeType":"contains","source":2350,"target":1798},{"edgeType":"contains","source":7415,"target":7564},{"edgeType":"calls","source":10755,"target":10756},{"edgeType":"calls","source":12408,"target":12366},{"edgeType":"calls","source":1407,"target":1410},{"edgeType":"calls","source":6826,"target":6771},{"edgeType":"imports","source":12279,"target":2847},{"edgeType":"contains","source":10583,"target":10830},{"edgeType":"contains","source":4380,"target":4404},{"edgeType":"calls","source":2861,"target":2844},{"edgeType":"calls","source":9509,"target":1817},{"edgeType":"contains","source":10887,"target":10920},{"edgeType":"imports","source":11259,"target":11214},{"edgeType":"contains","source":1,"target":12254},{"edgeType":"contains","source":7415,"target":7565},{"edgeType":"contains","source":9476,"target":9209},{"edgeType":"contains","source":11417,"target":10345},{"edgeType":"contains","source":11545,"target":11662},{"edgeType":"calls","source":10722,"target":10723},{"edgeType":"contains","source":12044,"target":12048},{"edgeType":"contains","source":1603,"target":1702},{"edgeType":"contains","source":10301,"target":11116},{"edgeType":"contains","source":3621,"target":3622},{"edgeType":"imports","source":12280,"target":12330},{"edgeType":"imports","source":6203,"target":6226},{"edgeType":"imports","source":4316,"target":4473},{"edgeType":"contains","source":7925,"target":7610},{"edgeType":"imports","source":6912,"target":2269},{"edgeType":"calls","source":11763,"target":11192},{"edgeType":"contains","source":12902,"target":12915},{"edgeType":"calls","source":7521,"target":7392},{"edgeType":"calls","source":2893,"target":2873},{"edgeType":"contains","source":6912,"target":7279},{"edgeType":"contains","source":9665,"target":9671},{"edgeType":"imports","source":7923,"target":7925},{"edgeType":"contains","source":5961,"target":6106},{"edgeType":"contains","source":6229,"target":6254},{"edgeType":"calls","source":1239,"target":1295},{"edgeType":"imports","source":8062,"target":7844},{"edgeType":"contains","source":548,"target":553},{"edgeType":"contains","source":10524,"target":10526},{"edgeType":"contains","source":10490,"target":10523},{"edgeType":"contains","source":3653,"target":3661},{"edgeType":"contains","source":1140,"target":1227},{"edgeType":"contains","source":4974,"target":4991},{"edgeType":"calls","source":6097,"target":6082},{"edgeType":"calls","source":6064,"target":6048},{"edgeType":"contains","source":9002,"target":9083},{"edgeType":"contains","source":12,"target":255},{"edgeType":"contains","source":4743,"target":4752},{"edgeType":"contains","source":8111,"target":8163},{"edgeType":"contains","source":12902,"target":12914},{"edgeType":"contains","source":4841,"target":4885},{"edgeType":"calls","source":943,"target":956},{"edgeType":"calls","source":1604,"target":1606},{"edgeType":"calls","source":5128,"target":4409},{"edgeType":"contains","source":10391,"target":10421},{"edgeType":"contains","source":10367,"target":11165},{"edgeType":"imports","source":11983,"target":2567},{"edgeType":"contains","source":6229,"target":6255},{"edgeType":"contains","source":8557,"target":2793},{"edgeType":"contains","source":5132,"target":4320},{"edgeType":"calls","source":10727,"target":8427},{"edgeType":"contains","source":4974,"target":4990},{"edgeType":"contains","source":10583,"target":10812},{"edgeType":"contains","source":9002,"target":9082},{"edgeType":"contains","source":3653,"target":3660},{"edgeType":"calls","source":2869,"target":2558},{"edgeType":"imports","source":12436,"target":2269},{"edgeType":"contains","source":4841,"target":4884},{"edgeType":"contains","source":12,"target":258},{"edgeType":"contains","source":11712,"target":11749},{"edgeType":"contains","source":6692,"target":6702},{"edgeType":"contains","source":4974,"target":4989},{"edgeType":"calls","source":12835,"target":12841},{"edgeType":"calls","source":6925,"target":6843},{"edgeType":"contains","source":10390,"target":10449},{"edgeType":"contains","source":1,"target":12227},{"edgeType":"calls","source":448,"target":449},{"edgeType":"calls","source":4777,"target":491},{"edgeType":"contains","source":10689,"target":10694},{"edgeType":"calls","source":6499,"target":6308},{"edgeType":"contains","source":1140,"target":1229},{"edgeType":"contains","source":9002,"target":9085},{"edgeType":"imports","source":7128,"target":7202},{"edgeType":"contains","source":7415,"target":7545},{"edgeType":"contains","source":1205,"target":2383},{"edgeType":"contains","source":6692,"target":6703},{"edgeType":"contains","source":12,"target":257},{"edgeType":"calls","source":7392,"target":7166},{"edgeType":"contains","source":9665,"target":9672},{"edgeType":"calls","source":5105,"target":5120},{"edgeType":"contains","source":4974,"target":4988},{"edgeType":"contains","source":10390,"target":10450},{"edgeType":"contains","source":9852,"target":10216},{"edgeType":"calls","source":1149,"target":914},{"edgeType":"contains","source":6362,"target":6363},{"edgeType":"contains","source":10490,"target":10522},{"edgeType":"contains","source":10686,"target":10788},{"edgeType":"contains","source":9002,"target":9084},{"edgeType":"calls","source":11844,"target":11851},{"edgeType":"imports","source":7001,"target":568},{"edgeType":"imports","source":12557,"target":12261},{"edgeType":"calls","source":2233,"target":1135},{"edgeType":"contains","source":1470,"target":1568},{"edgeType":"contains","source":3653,"target":3658},{"edgeType":"calls","source":1566,"target":667},{"edgeType":"contains","source":13067,"target":13081},{"edgeType":"contains","source":1836,"target":1854},{"edgeType":"calls","source":2141,"target":812},{"edgeType":"contains","source":7018,"target":7160},{"edgeType":"imports","source":7356,"target":2251},{"edgeType":"contains","source":4676,"target":4720},{"edgeType":"contains","source":4639,"target":5867},{"edgeType":"contains","source":3815,"target":3928},{"edgeType":"contains","source":12,"target":260},{"edgeType":"contains","source":8557,"target":2790},{"edgeType":"contains","source":10753,"target":10822},{"edgeType":"imports","source":2448,"target":1119},{"edgeType":"contains","source":317,"target":319},{"edgeType":"imports","source":2448,"target":1118},{"edgeType":"contains","source":8608,"target":8609},{"edgeType":"contains","source":2916,"target":3256},{"edgeType":"contains","source":5883,"target":6406},{"edgeType":"calls","source":4760,"target":4187},{"edgeType":"calls","source":2534,"target":2371},{"edgeType":"contains","source":9506,"target":10367},{"edgeType":"contains","source":12373,"target":12396},{"edgeType":"contains","source":9665,"target":9666},{"edgeType":"contains","source":6229,"target":6251},{"edgeType":"contains","source":1966,"target":2053},{"edgeType":"contains","source":7087,"target":2908},{"edgeType":"contains","source":2727,"target":2774},{"edgeType":"contains","source":11779,"target":11785},{"edgeType":"contains","source":7018,"target":7161},{"edgeType":"contains","source":3815,"target":3927},{"edgeType":"calls","source":5866,"target":5839},{"edgeType":"contains","source":317,"target":318},{"edgeType":"contains","source":4380,"target":4382},{"edgeType":"imports","source":885,"target":2005},{"edgeType":"calls","source":2049,"target":491},{"edgeType":"contains","source":12077,"target":12059},{"edgeType":"calls","source":12314,"target":2572},{"edgeType":"contains","source":7415,"target":7538},{"edgeType":"contains","source":9390,"target":9734},{"edgeType":"calls","source":9909,"target":8417},{"edgeType":"contains","source":11746,"target":11748},{"edgeType":"contains","source":6229,"target":6252},{"edgeType":"contains","source":13728,"target":13729},{"edgeType":"contains","source":9665,"target":9669},{"edgeType":"calls","source":7544,"target":1400},{"edgeType":"contains","source":12919,"target":13439},{"edgeType":"calls","source":11492,"target":568},{"edgeType":"contains","source":6287,"target":6568},{"edgeType":"contains","source":6527,"target":6528},{"edgeType":"calls","source":6724,"target":6736},{"edgeType":"contains","source":8542,"target":8543},{"edgeType":"calls","source":3953,"target":3832},{"edgeType":"calls","source":12348,"target":2572},{"edgeType":"contains","source":1603,"target":1676},{"edgeType":"calls","source":6492,"target":6529},{"edgeType":"contains","source":12077,"target":12058},{"edgeType":"contains","source":3815,"target":3926},{"edgeType":"contains","source":3497,"target":3214},{"edgeType":"contains","source":7018,"target":7162},{"edgeType":"contains","source":11481,"target":11506},{"edgeType":"contains","source":9665,"target":9668},{"edgeType":"contains","source":11776,"target":9762},{"edgeType":"contains","source":9002,"target":9080},{"edgeType":"calls","source":12311,"target":11120},{"edgeType":"calls","source":1771,"target":655},{"edgeType":"calls","source":5864,"target":5899},{"edgeType":"contains","source":10753,"target":10821},{"edgeType":"calls","source":5953,"target":1026},{"edgeType":"contains","source":4386,"target":4194},{"edgeType":"contains","source":3653,"target":3662},{"edgeType":"contains","source":8608,"target":8610},{"edgeType":"contains","source":7771,"target":8131},{"edgeType":"contains","source":2916,"target":3255},{"edgeType":"contains","source":3815,"target":3925},{"edgeType":"contains","source":3430,"target":3176},{"edgeType":"contains","source":1140,"target":1232},{"edgeType":"calls","source":12063,"target":2952},{"edgeType":"calls","source":13854,"target":12966},{"edgeType":"contains","source":1140,"target":1236},{"edgeType":"calls","source":2366,"target":2289},{"edgeType":"calls","source":2265,"target":2249},{"edgeType":"contains","source":12109,"target":12137},{"edgeType":"contains","source":317,"target":323},{"edgeType":"contains","source":7551,"target":7562},{"edgeType":"contains","source":9925,"target":10076},{"edgeType":"calls","source":1901,"target":1905},{"edgeType":"contains","source":3815,"target":3932},{"edgeType":"contains","source":9665,"target":9679},{"edgeType":"contains","source":9002,"target":9091},{"edgeType":"contains","source":1603,"target":1682},{"edgeType":"imports","source":7128,"target":7192},{"edgeType":"imports","source":11515,"target":2269},{"edgeType":"calls","source":2553,"target":721},{"edgeType":"contains","source":6692,"target":6708},{"edgeType":"contains","source":8767,"target":8977},{"edgeType":"calls","source":270,"target":670},{"edgeType":"contains","source":6527,"target":6539},{"edgeType":"contains","source":11350,"target":11355},{"edgeType":"contains","source":9467,"target":9474},{"edgeType":"calls","source":8260,"target":348},{"edgeType":"contains","source":317,"target":322},{"edgeType":"contains","source":1603,"target":1683},{"edgeType":"contains","source":3815,"target":3931},{"edgeType":"contains","source":9028,"target":9341},{"edgeType":"contains","source":5600,"target":5679},{"edgeType":"contains","source":9002,"target":9090},{"edgeType":"contains","source":10389,"target":10492},{"edgeType":"contains","source":7018,"target":7173},{"edgeType":"contains","source":12407,"target":12412},{"edgeType":"contains","source":6362,"target":6369},{"edgeType":"contains","source":13067,"target":13092},{"edgeType":"contains","source":12605,"target":12616},{"edgeType":"contains","source":9170,"target":10224},{"edgeType":"calls","source":9869,"target":148},{"edgeType":"calls","source":1616,"target":1229},{"edgeType":"contains","source":3952,"target":3911},{"edgeType":"calls","source":3087,"target":3191},{"edgeType":"calls","source":8963,"target":754},{"edgeType":"contains","source":1140,"target":1238},{"edgeType":"contains","source":1213,"target":1089},{"edgeType":"contains","source":317,"target":325},{"edgeType":"contains","source":7221,"target":7224},{"edgeType":"calls","source":1375,"target":1301},{"edgeType":"contains","source":3815,"target":3930},{"edgeType":"contains","source":7415,"target":7552},{"edgeType":"imports","source":1954,"target":587},{"edgeType":"calls","source":2141,"target":806},{"edgeType":"contains","source":4131,"target":5761},{"edgeType":"contains","source":86,"target":87},{"edgeType":"contains","source":9002,"target":9093},{"edgeType":"contains","source":4281,"target":4283},{"edgeType":"calls","source":1367,"target":491},{"edgeType":"contains","source":7018,"target":7174},{"edgeType":"contains","source":13067,"target":13091},{"edgeType":"calls","source":7089,"target":7053},{"edgeType":"imports","source":5115,"target":5117},{"edgeType":"imports","source":9207,"target":9335},{"edgeType":"calls","source":2500,"target":2362},{"edgeType":"contains","source":8767,"target":8979},{"edgeType":"contains","source":1275,"target":1278},{"edgeType":"calls","source":9343,"target":9058},{"edgeType":"imports","source":9664,"target":2567},{"edgeType":"contains","source":9335,"target":9340},{"edgeType":"contains","source":5883,"target":6421},{"edgeType":"contains","source":3320,"target":3420},{"edgeType":"contains","source":317,"target":324},{"edgeType":"contains","source":3815,"target":3929},{"edgeType":"contains","source":7456,"target":7339},{"edgeType":"calls","source":1784,"target":2362},{"edgeType":"contains","source":9002,"target":9092},{"edgeType":"contains","source":10390,"target":10459},{"edgeType":"calls","source":4088,"target":3872},{"edgeType":"contains","source":7018,"target":7175},{"edgeType":"contains","source":1275,"target":1279},{"edgeType":"contains","source":10490,"target":10530},{"edgeType":"contains","source":13067,"target":13090},{"edgeType":"contains","source":8767,"target":8978},{"edgeType":"contains","source":10689,"target":10703},{"edgeType":"contains","source":11481,"target":11517},{"edgeType":"contains","source":1,"target":12237},{"edgeType":"contains","source":3815,"target":3936},{"edgeType":"contains","source":8767,"target":8973},{"edgeType":"imports","source":7001,"target":563},{"edgeType":"contains","source":9467,"target":9471},{"edgeType":"calls","source":9899,"target":9794},{"edgeType":"contains","source":3320,"target":3425},{"edgeType":"calls","source":2332,"target":1225},{"edgeType":"calls","source":6162,"target":6169},{"edgeType":"contains","source":86,"target":89},{"edgeType":"calls","source":11878,"target":11867},{"edgeType":"imports","source":5710,"target":5702},{"edgeType":"contains","source":10490,"target":10527},{"edgeType":"contains","source":12373,"target":12406},{"edgeType":"contains","source":10391,"target":10425},{"edgeType":"contains","source":10583,"target":10815},{"edgeType":"contains","source":2727,"target":2781},{"edgeType":"contains","source":9002,"target":9087},{"edgeType":"contains","source":9028,"target":9338},{"edgeType":"contains","source":3815,"target":3935},{"edgeType":"calls","source":2366,"target":2286},{"edgeType":"contains","source":317,"target":326},{"edgeType":"contains","source":11545,"target":11648},{"edgeType":"calls","source":4521,"target":4187},{"edgeType":"contains","source":11725,"target":1840},{"edgeType":"contains","source":11350,"target":11351},{"edgeType":"contains","source":8147,"target":709},{"edgeType":"contains","source":8244,"target":8272},{"edgeType":"contains","source":9665,"target":9674},{"edgeType":"contains","source":3320,"target":3426},{"edgeType":"calls","source":12341,"target":12314},{"edgeType":"calls","source":270,"target":666},{"edgeType":"contains","source":8077,"target":8164},{"edgeType":"calls","source":13855,"target":12945},{"edgeType":"contains","source":6287,"target":6576},{"edgeType":"calls","source":6924,"target":6886},{"edgeType":"calls","source":12408,"target":12351},{"edgeType":"contains","source":86,"target":88},{"edgeType":"contains","source":1,"target":2723},{"edgeType":"imports","source":7128,"target":7195},{"edgeType":"contains","source":10490,"target":10528},{"edgeType":"calls","source":7982,"target":1570},{"edgeType":"contains","source":12373,"target":12405},{"edgeType":"contains","source":12407,"target":12408},{"edgeType":"contains","source":13067,"target":13088},{"edgeType":"contains","source":2891,"target":2983},{"edgeType":"contains","source":2727,"target":2782},{"edgeType":"imports","source":12423,"target":12173},{"edgeType":"contains","source":1007,"target":1137},{"edgeType":"calls","source":2553,"target":714},{"edgeType":"contains","source":8077,"target":8167},{"edgeType":"contains","source":6692,"target":6706},{"edgeType":"contains","source":9467,"target":9473},{"edgeType":"contains","source":11712,"target":11753},{"edgeType":"imports","source":5977,"target":5883},{"edgeType":"contains","source":10301,"target":11098},{"edgeType":"contains","source":11779,"target":11790},{"edgeType":"contains","source":5883,"target":6416},{"edgeType":"imports","source":12423,"target":10059},{"edgeType":"calls","source":12515,"target":10088},{"edgeType":"imports","source":12605,"target":4417},{"edgeType":"contains","source":3815,"target":3934},{"edgeType":"contains","source":10490,"target":10525},{"edgeType":"contains","source":1,"target":2726},{"edgeType":"contains","source":86,"target":91},{"edgeType":"contains","source":8244,"target":8276},{"edgeType":"contains","source":4676,"target":4726},{"edgeType":"contains","source":11417,"target":11384},{"edgeType":"calls","source":4951,"target":4598},{"edgeType":"contains","source":8767,"target":8975},{"edgeType":"calls","source":9509,"target":745},{"edgeType":"calls","source":3087,"target":3187},{"edgeType":"contains","source":12902,"target":12916},{"edgeType":"contains","source":1140,"target":1241},{"edgeType":"contains","source":9335,"target":9336},{"edgeType":"contains","source":317,"target":328},{"edgeType":"contains","source":9467,"target":9472},{"edgeType":"contains","source":1,"target":8010},{"edgeType":"contains","source":9390,"target":9745},{"edgeType":"contains","source":1603,"target":1685},{"edgeType":"calls","source":481,"target":469},{"edgeType":"calls","source":6038,"target":5782},{"edgeType":"calls","source":1901,"target":1902},{"edgeType":"calls","source":2331,"target":2312},{"edgeType":"contains","source":3815,"target":3933},{"edgeType":"contains","source":9925,"target":10071},{"edgeType":"imports","source":12428,"target":12019},{"edgeType":"imports","source":11616,"target":2310},{"edgeType":"calls","source":1321,"target":855},{"edgeType":"contains","source":7844,"target":591},{"edgeType":"contains","source":10390,"target":10455},{"edgeType":"contains","source":86,"target":90},{"edgeType":"calls","source":844,"target":844},{"edgeType":"contains","source":9002,"target":9088},{"edgeType":"imports","source":9507,"target":9553},{"edgeType":"calls","source":943,"target":946},{"edgeType":"contains","source":11019,"target":11039},{"edgeType":"calls","source":1146,"target":1023},{"edgeType":"contains","source":9925,"target":10051},{"edgeType":"calls","source":1010,"target":1011},{"edgeType":"calls","source":6069,"target":5910},{"edgeType":"calls","source":4319,"target":4137},{"edgeType":"calls","source":746,"target":739},{"edgeType":"contains","source":11613,"target":11632},{"edgeType":"contains","source":4148,"target":4155},{"edgeType":"contains","source":4016,"target":4019},{"edgeType":"contains","source":10390,"target":10435},{"edgeType":"calls","source":1671,"target":1660},{"edgeType":"calls","source":11150,"target":11152},{"edgeType":"contains","source":8039,"target":8266},{"edgeType":"contains","source":4510,"target":4560},{"edgeType":"contains","source":4639,"target":5846},{"edgeType":"calls","source":6988,"target":6986},{"edgeType":"contains","source":10237,"target":10950},{"edgeType":"contains","source":9852,"target":10201},{"edgeType":"contains","source":1041,"target":1108},{"edgeType":"contains","source":3817,"target":3844},{"edgeType":"calls","source":1915,"target":1495},{"edgeType":"contains","source":11019,"target":11021},{"edgeType":"contains","source":7022,"target":7025},{"edgeType":"calls","source":4433,"target":602},{"edgeType":"contains","source":10419,"target":3195},{"edgeType":"contains","source":12285,"target":11941},{"edgeType":"contains","source":12,"target":239},{"edgeType":"contains","source":11545,"target":11627},{"edgeType":"contains","source":6031,"target":6035},{"edgeType":"contains","source":4148,"target":4154},{"edgeType":"contains","source":9002,"target":9065},{"edgeType":"contains","source":8197,"target":2310},{"edgeType":"contains","source":891,"target":1529},{"edgeType":"contains","source":2130,"target":2234},{"edgeType":"contains","source":10324,"target":10368},{"edgeType":"contains","source":9925,"target":10053},{"edgeType":"contains","source":4639,"target":5845},{"edgeType":"calls","source":3175,"target":491},{"edgeType":"contains","source":12241,"target":12248},{"edgeType":"contains","source":4510,"target":4559},{"edgeType":"contains","source":9925,"target":10049},{"edgeType":"contains","source":3817,"target":3843},{"edgeType":"calls","source":4625,"target":4162},{"edgeType":"calls","source":1872,"target":717},{"edgeType":"calls","source":1806,"target":1706},{"edgeType":"contains","source":3016,"target":3305},{"edgeType":"contains","source":3322,"target":3332},{"edgeType":"contains","source":8938,"target":8939},{"edgeType":"contains","source":7187,"target":7196},{"edgeType":"calls","source":10242,"target":4419},{"edgeType":"contains","source":11350,"target":11327},{"edgeType":"calls","source":12515,"target":10059},{"edgeType":"contains","source":4016,"target":4017},{"edgeType":"calls","source":581,"target":571},{"edgeType":"contains","source":4148,"target":4153},{"edgeType":"contains","source":8767,"target":8954},{"edgeType":"calls","source":10491,"target":10441},{"edgeType":"contains","source":8039,"target":8268},{"edgeType":"imports","source":6043,"target":5939},{"edgeType":"contains","source":4510,"target":4558},{"edgeType":"calls","source":1125,"target":619},{"edgeType":"contains","source":10391,"target":10402},{"edgeType":"calls","source":12967,"target":12961},{"edgeType":"contains","source":6229,"target":6240},{"edgeType":"contains","source":6262,"target":6274},{"edgeType":"contains","source":4489,"target":4151},{"edgeType":"contains","source":4510,"target":4557},{"edgeType":"calls","source":415,"target":430},{"edgeType":"contains","source":9925,"target":10050},{"edgeType":"contains","source":217,"target":228},{"edgeType":"contains","source":3016,"target":3306},{"edgeType":"calls","source":10590,"target":8427},{"edgeType":"contains","source":1768,"target":1826},{"edgeType":"contains","source":11675,"target":2310},{"edgeType":"calls","source":2365,"target":2344},{"edgeType":"contains","source":7385,"target":7401},{"edgeType":"imports","source":7001,"target":551},{"edgeType":"contains","source":11545,"target":11625},{"edgeType":"calls","source":7616,"target":7604},{"edgeType":"contains","source":4148,"target":4152},{"edgeType":"contains","source":4115,"target":4118},{"edgeType":"contains","source":10753,"target":10808},{"edgeType":"contains","source":12109,"target":12110},{"edgeType":"calls","source":6691,"target":6683},{"edgeType":"calls","source":977,"target":978},{"edgeType":"calls","source":3094,"target":3000},{"edgeType":"calls","source":5172,"target":5174},{"edgeType":"contains","source":8039,"target":8267},{"edgeType":"contains","source":12437,"target":12512},{"edgeType":"contains","source":6262,"target":6275},{"edgeType":"contains","source":8531,"target":414},{"edgeType":"contains","source":899,"target":1287},{"edgeType":"calls","source":1940,"target":717},{"edgeType":"contains","source":10686,"target":10768},{"edgeType":"contains","source":7187,"target":7190},{"edgeType":"contains","source":9925,"target":10047},{"edgeType":"contains","source":7415,"target":7521},{"edgeType":"contains","source":1140,"target":1215},{"edgeType":"imports","source":6832,"target":6851},{"edgeType":"contains","source":3318,"target":3462},{"edgeType":"contains","source":3320,"target":3400},{"edgeType":"contains","source":11675,"target":11820},{"edgeType":"calls","source":8904,"target":8903},{"edgeType":"contains","source":10237,"target":10946},{"edgeType":"contains","source":11712,"target":11730},{"edgeType":"contains","source":6262,"target":6268},{"edgeType":"contains","source":10904,"target":10352},{"edgeType":"contains","source":11108,"target":11427},{"edgeType":"contains","source":12,"target":244},{"edgeType":"calls","source":1807,"target":1668},{"edgeType":"imports","source":2345,"target":1124},{"edgeType":"contains","source":10390,"target":10431},{"edgeType":"contains","source":10391,"target":10400},{"edgeType":"contains","source":10490,"target":10502},{"edgeType":"contains","source":1603,"target":1662},{"edgeType":"contains","source":10686,"target":10769},{"edgeType":"contains","source":3815,"target":3910},{"edgeType":"contains","source":9925,"target":10048},{"edgeType":"calls","source":11823,"target":11435},{"edgeType":"calls","source":2695,"target":2682},{"edgeType":"imports","source":7128,"target":7187},{"edgeType":"contains","source":11082,"target":12235},{"edgeType":"imports","source":1434,"target":1881},{"edgeType":"contains","source":11545,"target":11623},{"edgeType":"calls","source":4514,"target":4429},{"edgeType":"contains","source":5600,"target":5650},{"edgeType":"contains","source":1205,"target":2373},{"edgeType":"contains","source":6890,"target":6884},{"edgeType":"contains","source":9173,"target":2703},{"edgeType":"contains","source":3318,"target":3463},{"edgeType":"contains","source":4639,"target":5849},{"edgeType":"contains","source":9002,"target":9061},{"edgeType":"calls","source":10422,"target":3068},{"edgeType":"contains","source":12538,"target":12550},{"edgeType":"contains","source":3851,"target":3852},{"edgeType":"contains","source":8767,"target":8947},{"edgeType":"calls","source":3487,"target":3499},{"edgeType":"contains","source":10324,"target":10364},{"edgeType":"contains","source":10390,"target":10432},{"edgeType":"contains","source":10391,"target":10401},{"edgeType":"contains","source":10686,"target":10766},{"edgeType":"contains","source":7348,"target":1144},{"edgeType":"contains","source":3850,"target":3881},{"edgeType":"calls","source":6313,"target":2568},{"edgeType":"contains","source":4873,"target":4937},{"edgeType":"calls","source":2494,"target":454},{"edgeType":"contains","source":7687,"target":7548},{"edgeType":"calls","source":11857,"target":11435},{"edgeType":"contains","source":6890,"target":6885},{"edgeType":"contains","source":11712,"target":11728},{"edgeType":"calls","source":4249,"target":4187},{"edgeType":"contains","source":4676,"target":4701},{"edgeType":"contains","source":4639,"target":5848},{"edgeType":"calls","source":7451,"target":7437},{"edgeType":"contains","source":10301,"target":11074},{"edgeType":"contains","source":6031,"target":6032},{"edgeType":"contains","source":11108,"target":11425},{"edgeType":"contains","source":8039,"target":8264},{"edgeType":"contains","source":12241,"target":12243},{"edgeType":"imports","source":7637,"target":6209},{"edgeType":"calls","source":3595,"target":3319},{"edgeType":"calls","source":6824,"target":6791},{"edgeType":"contains","source":12437,"target":12509},{"edgeType":"imports","source":3763,"target":3687},{"edgeType":"contains","source":12538,"target":12549},{"edgeType":"calls","source":12702,"target":12722},{"edgeType":"calls","source":8830,"target":627},{"edgeType":"contains","source":4974,"target":4976},{"edgeType":"contains","source":8039,"target":8262},{"edgeType":"contains","source":13628,"target":13640},{"edgeType":"contains","source":7022,"target":7023},{"edgeType":"contains","source":11177,"target":10345},{"edgeType":"contains","source":7385,"target":7397},{"edgeType":"contains","source":9390,"target":9720},{"edgeType":"contains","source":11545,"target":11621},{"edgeType":"contains","source":11675,"target":11819},{"edgeType":"calls","source":2826,"target":2848},{"edgeType":"contains","source":6917,"target":7106},{"edgeType":"contains","source":1836,"target":1837},{"edgeType":"contains","source":11109,"target":10338},{"edgeType":"contains","source":8039,"target":8263},{"edgeType":"contains","source":12241,"target":12242},{"edgeType":"contains","source":8079,"target":8080},{"edgeType":"contains","source":12,"target":245},{"edgeType":"contains","source":8767,"target":8949},{"edgeType":"calls","source":8970,"target":8972},{"edgeType":"contains","source":12538,"target":12548},{"edgeType":"calls","source":1512,"target":1301},{"edgeType":"contains","source":10390,"target":10443},{"edgeType":"contains","source":10391,"target":10412},{"edgeType":"calls","source":11877,"target":11878},{"edgeType":"contains","source":13794,"target":13795},{"edgeType":"contains","source":6262,"target":6280},{"edgeType":"contains","source":9002,"target":9075},{"edgeType":"contains","source":1603,"target":1665},{"edgeType":"contains","source":8244,"target":8261},{"edgeType":"contains","source":12340,"target":12359},{"edgeType":"contains","source":6229,"target":6246},{"edgeType":"calls","source":415,"target":421},{"edgeType":"calls","source":4951,"target":4620},{"edgeType":"contains","source":2728,"target":2730},{"edgeType":"imports","source":11154,"target":11330},{"edgeType":"contains","source":3154,"target":3265},{"edgeType":"contains","source":6752,"target":6946},{"edgeType":"contains","source":8740,"target":8741},{"edgeType":"contains","source":9390,"target":9731},{"edgeType":"contains","source":7415,"target":7533},{"edgeType":"contains","source":7255,"target":7208},{"edgeType":"contains","source":9830,"target":9834},{"edgeType":"calls","source":3586,"target":3596},{"edgeType":"contains","source":3785,"target":3789},{"edgeType":"contains","source":12,"target":248},{"edgeType":"contains","source":1966,"target":2040},{"edgeType":"contains","source":9732,"target":9701},{"edgeType":"contains","source":6262,"target":6281},{"edgeType":"contains","source":11746,"target":11747},{"edgeType":"imports","source":11983,"target":12058},{"edgeType":"contains","source":9002,"target":9074},{"edgeType":"contains","source":11779,"target":11781},{"edgeType":"contains","source":12340,"target":12358},{"edgeType":"contains","source":8557,"target":2785},{"edgeType":"contains","source":6692,"target":6693},{"edgeType":"contains","source":7037,"target":1283},{"edgeType":"contains","source":6752,"target":6947},{"edgeType":"calls","source":6757,"target":6757},{"edgeType":"contains","source":6568,"target":6308},{"edgeType":"contains","source":3318,"target":3467},{"edgeType":"contains","source":9830,"target":9835},{"edgeType":"contains","source":12,"target":247},{"edgeType":"calls","source":1549,"target":148},{"edgeType":"calls","source":8970,"target":8974},{"edgeType":"contains","source":8111,"target":8155},{"edgeType":"imports","source":12553,"target":2845},{"edgeType":"contains","source":3869,"target":3298},{"edgeType":"contains","source":13628,"target":13654},{"edgeType":"calls","source":4803,"target":1807},{"edgeType":"contains","source":9002,"target":9077},{"edgeType":"contains","source":6752,"target":6948},{"edgeType":"calls","source":13801,"target":2970},{"edgeType":"contains","source":4841,"target":4876},{"edgeType":"calls","source":5033,"target":4190},{"edgeType":"contains","source":12902,"target":12905},{"edgeType":"calls","source":683,"target":571},{"edgeType":"calls","source":4954,"target":2411},{"edgeType":"calls","source":4813,"target":4668},{"edgeType":"calls","source":745,"target":763},{"edgeType":"contains","source":6692,"target":6694},{"edgeType":"imports","source":6203,"target":6256},{"edgeType":"imports","source":9143,"target":7074},{"edgeType":"calls","source":12442,"target":12330},{"edgeType":"contains","source":11674,"target":11861},{"edgeType":"imports","source":12555,"target":12297},{"edgeType":"imports","source":9170,"target":952},{"edgeType":"contains","source":12,"target":250},{"edgeType":"contains","source":9830,"target":9832},{"edgeType":"contains","source":9002,"target":9076},{"edgeType":"calls","source":2595,"target":2605},{"edgeType":"contains","source":10490,"target":10513},{"edgeType":"calls","source":9909,"target":8407},{"edgeType":"imports","source":1497,"target":995},{"edgeType":"contains","source":1603,"target":1664},{"edgeType":"contains","source":2728,"target":2729},{"edgeType":"contains","source":10583,"target":10801},{"edgeType":"contains","source":4873,"target":4940},{"edgeType":"calls","source":4985,"target":4620},{"edgeType":"imports","source":11616,"target":11803},{"edgeType":"calls","source":1572,"target":1551},{"edgeType":"contains","source":1,"target":12217},{"edgeType":"contains","source":11613,"target":11639},{"edgeType":"imports","source":10246,"target":9878},{"edgeType":"calls","source":2141,"target":824},{"edgeType":"contains","source":9830,"target":9833},{"edgeType":"contains","source":12,"target":249},{"edgeType":"contains","source":12,"target":252},{"edgeType":"calls","source":1439,"target":1441},{"edgeType":"calls","source":2562,"target":2568},{"edgeType":"contains","source":548,"target":549},{"edgeType":"contains","source":10887,"target":10888},{"edgeType":"contains","source":2840,"target":3490},{"edgeType":"contains","source":7187,"target":7198},{"edgeType":"contains","source":853,"target":607},{"edgeType":"contains","source":4639,"target":5859},{"edgeType":"calls","source":2485,"target":1784},{"edgeType":"calls","source":448,"target":451},{"edgeType":"contains","source":8244,"target":8257},{"edgeType":"calls","source":8475,"target":8469},{"edgeType":"contains","source":11878,"target":11879},{"edgeType":"contains","source":4841,"target":4881},{"edgeType":"calls","source":7814,"target":7819},{"edgeType":"contains","source":7187,"target":7199},{"edgeType":"contains","source":8938,"target":8940},{"edgeType":"contains","source":9170,"target":10204},{"edgeType":"calls","source":11277,"target":3000},{"edgeType":"imports","source":11154,"target":11333},{"edgeType":"calls","source":5033,"target":4187},{"edgeType":"imports","source":11259,"target":11249},{"edgeType":"contains","source":7385,"target":7403},{"edgeType":"contains","source":10419,"target":3199},{"edgeType":"contains","source":12373,"target":12388},{"edgeType":"contains","source":6229,"target":6243},{"edgeType":"calls","source":8584,"target":8260},{"edgeType":"imports","source":12298,"target":11803},{"edgeType":"contains","source":6262,"target":6277},{"edgeType":"contains","source":12,"target":251},{"edgeType":"contains","source":6262,"target":6278},{"edgeType":"calls","source":1239,"target":1301},{"edgeType":"contains","source":7844,"target":575},{"edgeType":"contains","source":7187,"target":7200},{"edgeType":"calls","source":7519,"target":7452},{"edgeType":"contains","source":9002,"target":9073},{"edgeType":"contains","source":10419,"target":3196},{"edgeType":"contains","source":8079,"target":8089},{"edgeType":"contains","source":12340,"target":12353},{"edgeType":"contains","source":6229,"target":6244},{"edgeType":"calls","source":9929,"target":9906},{"edgeType":"contains","source":9925,"target":10054},{"edgeType":"calls","source":6064,"target":6050},{"edgeType":"contains","source":10490,"target":10509},{"edgeType":"contains","source":1470,"target":1563},{"edgeType":"contains","source":6262,"target":6279},{"edgeType":"contains","source":12,"target":253},{"edgeType":"calls","source":2662,"target":2638},{"edgeType":"contains","source":6229,"target":6245},{"edgeType":"contains","source":7187,"target":7201},{"edgeType":"contains","source":6752,"target":6945},{"edgeType":"contains","source":11108,"target":11435},{"edgeType":"calls","source":7891,"target":7548},{"edgeType":"contains","source":9390,"target":9728},{"edgeType":"contains","source":7415,"target":7532},{"edgeType":"contains","source":11675,"target":11827},{"edgeType":"calls","source":3905,"target":3215},{"edgeType":"contains","source":5883,"target":6401},{"edgeType":"calls","source":6861,"target":6810},{"edgeType":"contains","source":9218,"target":9225},{"edgeType":"contains","source":9878,"target":9906},{"edgeType":"calls","source":1451,"target":1164},{"edgeType":"contains","source":13380,"target":13391},{"edgeType":"contains","source":5716,"target":5740},{"edgeType":"contains","source":3152,"target":3831},{"edgeType":"contains","source":12553,"target":12602},{"edgeType":"imports","source":12901,"target":12990},{"edgeType":"contains","source":2920,"target":3624},{"edgeType":"contains","source":1144,"target":1599},{"edgeType":"contains","source":11000,"target":11064},{"edgeType":"contains","source":1580,"target":1825},{"edgeType":"contains","source":2,"target":5},{"edgeType":"contains","source":11616,"target":12051},{"edgeType":"calls","source":418,"target":419},{"edgeType":"contains","source":8762,"target":9619},{"edgeType":"calls","source":550,"target":555},{"edgeType":"contains","source":5981,"target":5982},{"edgeType":"contains","source":4316,"target":4744},{"edgeType":"contains","source":10301,"target":11592},{"edgeType":"contains","source":10176,"target":10182},{"edgeType":"contains","source":12059,"target":12061},{"edgeType":"contains","source":12158,"target":12163},{"edgeType":"contains","source":4436,"target":4194},{"edgeType":"contains","source":9218,"target":9224},{"edgeType":"contains","source":12554,"target":12570},{"edgeType":"imports","source":4179,"target":4312},{"edgeType":"calls","source":2658,"target":745},{"edgeType":"contains","source":5089,"target":5092},{"edgeType":"contains","source":2919,"target":3656},{"edgeType":"contains","source":2,"target":4},{"edgeType":"imports","source":7128,"target":6968},{"edgeType":"calls","source":12418,"target":2614},{"edgeType":"contains","source":891,"target":2041},{"edgeType":"contains","source":5981,"target":5983},{"edgeType":"contains","source":6568,"target":6812},{"edgeType":"contains","source":590,"target":802},{"edgeType":"contains","source":12059,"target":12060},{"edgeType":"contains","source":12158,"target":12162},{"edgeType":"contains","source":12257,"target":12264},{"edgeType":"calls","source":1368,"target":568},{"edgeType":"calls","source":10462,"target":3000},{"edgeType":"contains","source":3831,"target":3921},{"edgeType":"contains","source":10702,"target":10786},{"edgeType":"contains","source":5716,"target":5742},{"edgeType":"contains","source":5089,"target":5091},{"edgeType":"contains","source":9852,"target":10710},{"edgeType":"contains","source":1580,"target":1823},{"edgeType":"calls","source":3389,"target":1336},{"edgeType":"contains","source":5352,"target":5394},{"edgeType":"contains","source":11233,"target":11238},{"edgeType":"contains","source":9218,"target":9227},{"edgeType":"contains","source":11266,"target":11272},{"edgeType":"contains","source":3427,"target":3761},{"edgeType":"calls","source":2499,"target":2500},{"edgeType":"contains","source":2,"target":7},{"edgeType":"contains","source":8704,"target":9305},{"edgeType":"calls","source":11620,"target":3038},{"edgeType":"contains","source":10438,"target":10514},{"edgeType":"contains","source":2269,"target":2662},{"edgeType":"contains","source":12158,"target":12161},{"edgeType":"calls","source":11564,"target":10059},{"edgeType":"contains","source":4329,"target":4339},{"edgeType":"contains","source":5981,"target":5984},{"edgeType":"contains","source":12521,"target":12535},{"edgeType":"contains","source":590,"target":805},{"edgeType":"contains","source":10301,"target":11590},{"edgeType":"imports","source":7583,"target":7664},{"edgeType":"calls","source":5472,"target":5470},{"edgeType":"contains","source":5155,"target":5158},{"edgeType":"contains","source":5716,"target":5743},{"edgeType":"contains","source":5746,"target":5870},{"edgeType":"calls","source":12281,"target":12145},{"edgeType":"contains","source":11467,"target":11384},{"edgeType":"contains","source":6968,"target":7099},{"edgeType":"contains","source":9106,"target":9527},{"edgeType":"contains","source":1580,"target":1824},{"edgeType":"calls","source":12840,"target":12784},{"edgeType":"contains","source":9218,"target":9226},{"edgeType":"imports","source":3763,"target":3469},{"edgeType":"contains","source":6159,"target":2581},{"edgeType":"contains","source":11000,"target":11062},{"edgeType":"contains","source":3427,"target":3760},{"edgeType":"imports","source":12152,"target":2387},{"edgeType":"contains","source":1287,"target":1394},{"edgeType":"contains","source":2,"target":6},{"edgeType":"contains","source":8704,"target":9304},{"edgeType":"contains","source":8762,"target":9620},{"edgeType":"contains","source":4329,"target":4338},{"edgeType":"calls","source":11802,"target":568},{"edgeType":"contains","source":2269,"target":2663},{"edgeType":"contains","source":907,"target":490},{"edgeType":"contains","source":12125,"target":12126},{"edgeType":"contains","source":10301,"target":11591},{"edgeType":"contains","source":12254,"target":12355},{"edgeType":"calls","source":2024,"target":1371},{"edgeType":"imports","source":7629,"target":952},{"edgeType":"contains","source":590,"target":804},{"edgeType":"calls","source":781,"target":789},{"edgeType":"contains","source":2920,"target":3628},{"edgeType":"contains","source":7170,"target":7172},{"edgeType":"contains","source":10069,"target":10323},{"edgeType":"contains","source":6159,"target":2573},{"edgeType":"imports","source":4179,"target":4315},{"edgeType":"calls","source":5022,"target":4620},{"edgeType":"calls","source":10587,"target":10755},{"edgeType":"contains","source":11267,"target":11239},{"edgeType":"calls","source":8966,"target":754},{"edgeType":"contains","source":10301,"target":11588},{"edgeType":"contains","source":2,"target":9},{"edgeType":"calls","source":1938,"target":1918},{"edgeType":"contains","source":55,"target":480},{"edgeType":"calls","source":583,"target":585},{"edgeType":"contains","source":10176,"target":10178},{"edgeType":"contains","source":12158,"target":12159},{"edgeType":"calls","source":2444,"target":1032},{"edgeType":"calls","source":748,"target":754},{"edgeType":"contains","source":12714,"target":12891},{"edgeType":"calls","source":5117,"target":617},{"edgeType":"calls","source":2873,"target":2532},{"edgeType":"contains","source":5716,"target":5737},{"edgeType":"contains","source":7629,"target":1400},{"edgeType":"contains","source":11233,"target":11237},{"edgeType":"calls","source":2498,"target":2530},{"edgeType":"calls","source":7159,"target":7091},{"edgeType":"contains","source":3867,"target":3868},{"edgeType":"contains","source":55,"target":479},{"edgeType":"calls","source":11749,"target":11730},{"edgeType":"imports","source":2137,"target":1014},{"edgeType":"contains","source":4316,"target":4747},{"edgeType":"contains","source":8590,"target":8604},{"edgeType":"contains","source":10301,"target":11589},{"edgeType":"contains","source":6568,"target":6808},{"edgeType":"imports","source":2345,"target":907},{"edgeType":"contains","source":2920,"target":3626},{"edgeType":"contains","source":11299,"target":11302},{"edgeType":"contains","source":2909,"target":2910},{"edgeType":"imports","source":10069,"target":9878},{"edgeType":"calls","source":11427,"target":568},{"edgeType":"contains","source":11233,"target":11234},{"edgeType":"contains","source":5716,"target":5738},{"edgeType":"contains","source":7333,"target":7406},{"edgeType":"contains","source":1144,"target":1605},{"edgeType":"contains","source":5746,"target":5865},{"edgeType":"contains","source":1582,"target":1765},{"edgeType":"contains","source":13380,"target":13385},{"edgeType":"contains","source":11674,"target":12361},{"edgeType":"contains","source":7500,"target":7514},{"edgeType":"imports","source":10237,"target":9955},{"edgeType":"contains","source":10301,"target":11586},{"edgeType":"contains","source":6203,"target":2269},{"edgeType":"calls","source":1032,"target":409},{"edgeType":"calls","source":7159,"target":7092},{"edgeType":"contains","source":11000,"target":11057},{"edgeType":"contains","source":55,"target":482},{"edgeType":"contains","source":10955,"target":10338},{"edgeType":"contains","source":2,"target":11},{"edgeType":"contains","source":8704,"target":9301},{"edgeType":"calls","source":351,"target":380},{"edgeType":"contains","source":5089,"target":5094},{"edgeType":"contains","source":8590,"target":8606},{"edgeType":"calls","source":748,"target":756},{"edgeType":"contains","source":1580,"target":1828},{"edgeType":"contains","source":1582,"target":1766},{"edgeType":"contains","source":5746,"target":5866},{"edgeType":"contains","source":11299,"target":11303},{"edgeType":"contains","source":2909,"target":2911},{"edgeType":"contains","source":2920,"target":3627},{"edgeType":"contains","source":7071,"target":7073},{"edgeType":"contains","source":795,"target":796},{"edgeType":"calls","source":1285,"target":1022},{"edgeType":"calls","source":6892,"target":6913},{"edgeType":"contains","source":9852,"target":10707},{"edgeType":"contains","source":5716,"target":5739},{"edgeType":"contains","source":13380,"target":13384},{"edgeType":"contains","source":11828,"target":4417},{"edgeType":"contains","source":1287,"target":1398},{"edgeType":"contains","source":10301,"target":11587},{"edgeType":"calls","source":452,"target":419},{"edgeType":"calls","source":9486,"target":491},{"edgeType":"contains","source":11096,"target":11253},{"edgeType":"imports","source":2480,"target":949},{"edgeType":"contains","source":4591,"target":4676},{"edgeType":"contains","source":12257,"target":12258},{"edgeType":"calls","source":7884,"target":7872},{"edgeType":"contains","source":10176,"target":10177},{"edgeType":"contains","source":2,"target":10},{"edgeType":"contains","source":8704,"target":9300},{"edgeType":"contains","source":8762,"target":9616},{"edgeType":"contains","source":4316,"target":4745},{"edgeType":"contains","source":10629,"target":9875},{"edgeType":"imports","source":11616,"target":3144},{"edgeType":"contains","source":6968,"target":7104},{"edgeType":"contains","source":4199,"target":4151},{"edgeType":"contains","source":9106,"target":9534},{"edgeType":"contains","source":11202,"target":11152},{"edgeType":"contains","source":9218,"target":9233},{"edgeType":"calls","source":10579,"target":436},{"edgeType":"contains","source":1287,"target":1403},{"edgeType":"contains","source":891,"target":2051},{"edgeType":"contains","source":12553,"target":12610},{"edgeType":"contains","source":8704,"target":9312},{"edgeType":"contains","source":10702,"target":10796},{"edgeType":"contains","source":8704,"target":9311},{"edgeType":"calls","source":2018,"target":491},{"edgeType":"contains","source":10141,"target":10218},{"edgeType":"imports","source":12276,"target":12273},{"edgeType":"contains","source":3735,"target":3737},{"edgeType":"contains","source":2,"target":13},{"edgeType":"calls","source":9208,"target":9112},{"edgeType":"contains","source":55,"target":484},{"edgeType":"contains","source":5716,"target":5749},{"edgeType":"contains","source":6968,"target":7105},{"edgeType":"calls","source":5028,"target":4429},{"edgeType":"calls","source":8255,"target":602},{"edgeType":"contains","source":11762,"target":11763},{"edgeType":"contains","source":10301,"target":11601},{"edgeType":"contains","source":12521,"target":12544},{"edgeType":"imports","source":12557,"target":12019},{"edgeType":"contains","source":9106,"target":9533},{"edgeType":"calls","source":3009,"target":2540},{"edgeType":"contains","source":3503,"target":3528},{"edgeType":"calls","source":11076,"target":3000},{"edgeType":"contains","source":9218,"target":9232},{"edgeType":"contains","source":1287,"target":1404},{"edgeType":"contains","source":8762,"target":9627},{"edgeType":"contains","source":12553,"target":12609},{"edgeType":"calls","source":12442,"target":2936},{"edgeType":"contains","source":8704,"target":9310},{"edgeType":"contains","source":10702,"target":10798},{"edgeType":"contains","source":590,"target":810},{"edgeType":"imports","source":11864,"target":2845},{"edgeType":"contains","source":10141,"target":10219},{"edgeType":"calls","source":12041,"target":568},{"edgeType":"contains","source":2,"target":12},{"edgeType":"contains","source":6078,"target":6155},{"edgeType":"contains","source":1,"target":8499},{"edgeType":"imports","source":4179,"target":4304},{"edgeType":"contains","source":11828,"target":11830},{"edgeType":"contains","source":5716,"target":5750},{"edgeType":"calls","source":13206,"target":13076},{"edgeType":"contains","source":6903,"target":7007},{"edgeType":"contains","source":6342,"target":6428},{"edgeType":"contains","source":9106,"target":9536},{"edgeType":"contains","source":10301,"target":11598},{"edgeType":"contains","source":630,"target":631},{"edgeType":"contains","source":8762,"target":9630},{"edgeType":"calls","source":12995,"target":2703},{"edgeType":"contains","source":4758,"target":4790},{"edgeType":"calls","source":5868,"target":5871},{"edgeType":"contains","source":8704,"target":9314},{"edgeType":"contains","source":10702,"target":10794},{"edgeType":"contains","source":8590,"target":8619},{"edgeType":"calls","source":8278,"target":8346},{"edgeType":"contains","source":12820,"target":12787},{"edgeType":"contains","source":4758,"target":4789},{"edgeType":"contains","source":9218,"target":9235},{"edgeType":"imports","source":7520,"target":7495},{"edgeType":"calls","source":724,"target":440},{"edgeType":"contains","source":11674,"target":12373},{"edgeType":"calls","source":748,"target":753},{"edgeType":"contains","source":55,"target":486},{"edgeType":"contains","source":9878,"target":9913},{"edgeType":"contains","source":12152,"target":1785},{"edgeType":"contains","source":2,"target":15},{"edgeType":"contains","source":12521,"target":12542},{"edgeType":"calls","source":2997,"target":2910},{"edgeType":"contains","source":6144,"target":6225},{"edgeType":"contains","source":10301,"target":11599},{"edgeType":"contains","source":5089,"target":5098},{"edgeType":"contains","source":10702,"target":10795},{"edgeType":"contains","source":8704,"target":9313},{"edgeType":"calls","source":8386,"target":8170},{"edgeType":"contains","source":5961,"target":4499},{"edgeType":"calls","source":5471,"target":5492},{"edgeType":"contains","source":10037,"target":10270},{"edgeType":"contains","source":12257,"target":12270},{"edgeType":"contains","source":10141,"target":10217},{"edgeType":"calls","source":11716,"target":11698},{"edgeType":"contains","source":9218,"target":9234},{"edgeType":"imports","source":11674,"target":7676},{"edgeType":"calls","source":682,"target":684},{"edgeType":"calls","source":9208,"target":9113},{"edgeType":"calls","source":748,"target":752},{"edgeType":"contains","source":2,"target":14},{"edgeType":"contains","source":5746,"target":5879},{"edgeType":"contains","source":9780,"target":9781},{"edgeType":"contains","source":5716,"target":5744},{"edgeType":"contains","source":12521,"target":12541},{"edgeType":"calls","source":5030,"target":4364},{"edgeType":"calls","source":6529,"target":6544},{"edgeType":"contains","source":4130,"target":4180},{"edgeType":"calls","source":5901,"target":5903},{"edgeType":"contains","source":590,"target":816},{"edgeType":"calls","source":2108,"target":1926},{"edgeType":"contains","source":9218,"target":9229},{"edgeType":"calls","source":5868,"target":5869},{"edgeType":"contains","source":6968,"target":7100},{"edgeType":"contains","source":5089,"target":5105},{"edgeType":"calls","source":1442,"target":1430},{"edgeType":"contains","source":10301,"target":11596},{"edgeType":"contains","source":9878,"target":9911},{"edgeType":"contains","source":2,"target":17},{"edgeType":"calls","source":8908,"target":8903},{"edgeType":"contains","source":11894,"target":11895},{"edgeType":"contains","source":4130,"target":4179},{"edgeType":"contains","source":5746,"target":5872},{"edgeType":"contains","source":8590,"target":8612},{"edgeType":"contains","source":10439,"target":10490},{"edgeType":"contains","source":2269,"target":2677},{"edgeType":"contains","source":590,"target":815},{"edgeType":"contains","source":2943,"target":2924},{"edgeType":"contains","source":630,"target":632},{"edgeType":"contains","source":10702,"target":10793},{"edgeType":"contains","source":12752,"target":12778},{"edgeType":"contains","source":6968,"target":7101},{"edgeType":"contains","source":9218,"target":9228},{"edgeType":"contains","source":9020,"target":9024},{"edgeType":"contains","source":9106,"target":9529},{"edgeType":"contains","source":3847,"target":3439},{"edgeType":"contains","source":1218,"target":1430},{"edgeType":"calls","source":6236,"target":6087},{"edgeType":"contains","source":12355,"target":12401},{"edgeType":"contains","source":7897,"target":7898},{"edgeType":"contains","source":2,"target":16},{"edgeType":"contains","source":6276,"target":6355},{"edgeType":"calls","source":9208,"target":9115},{"edgeType":"contains","source":9878,"target":9912},{"edgeType":"contains","source":9106,"target":9532},{"edgeType":"contains","source":2,"target":19},{"edgeType":"calls","source":4514,"target":4502},{"edgeType":"contains","source":2269,"target":2674},{"edgeType":"contains","source":3476,"target":3311},{"edgeType":"contains","source":498,"target":499},{"edgeType":"calls","source":2268,"target":2249},{"edgeType":"contains","source":590,"target":818},{"edgeType":"calls","source":2138,"target":2051},{"edgeType":"calls","source":6033,"target":6037},{"edgeType":"contains","source":8762,"target":9626},{"edgeType":"contains","source":6968,"target":7102},{"edgeType":"imports","source":10069,"target":9870},{"edgeType":"contains","source":8762,"target":9625},{"edgeType":"contains","source":8704,"target":9309},{"edgeType":"contains","source":10301,"target":11594},{"edgeType":"contains","source":10238,"target":10376},{"edgeType":"contains","source":12158,"target":11108},{"edgeType":"contains","source":12158,"target":12165},{"edgeType":"calls","source":2404,"target":148},{"edgeType":"contains","source":9106,"target":9531},{"edgeType":"contains","source":5716,"target":5747},{"edgeType":"contains","source":3503,"target":3530},{"edgeType":"contains","source":1287,"target":1406},{"edgeType":"contains","source":10702,"target":10791},{"edgeType":"contains","source":12752,"target":12776},{"edgeType":"contains","source":590,"target":817},{"edgeType":"contains","source":836,"target":590},{"edgeType":"calls","source":6033,"target":6036},{"edgeType":"contains","source":6968,"target":7103},{"edgeType":"contains","source":11000,"target":11067},{"edgeType":"contains","source":12257,"target":12266},{"edgeType":"imports","source":11864,"target":733},{"edgeType":"contains","source":8762,"target":9624},{"edgeType":"imports","source":1111,"target":1116},{"edgeType":"calls","source":5575,"target":5435},{"edgeType":"contains","source":5352,"target":5405},{"edgeType":"calls","source":5471,"target":5488},{"edgeType":"contains","source":9491,"target":9223},{"edgeType":"contains","source":11634,"target":9382},{"edgeType":"calls","source":12575,"target":12556},{"edgeType":"contains","source":6144,"target":6221},{"edgeType":"contains","source":1655,"target":1626},{"edgeType":"imports","source":5835,"target":5811},{"edgeType":"contains","source":4758,"target":4767},{"edgeType":"contains","source":11000,"target":11047},{"edgeType":"contains","source":4179,"target":4746},{"edgeType":"contains","source":8762,"target":9603},{"edgeType":"contains","source":6902,"target":7011},{"edgeType":"calls","source":3976,"target":3241},{"edgeType":"calls","source":7905,"target":1913},{"edgeType":"calls","source":6526,"target":266},{"edgeType":"contains","source":4265,"target":4194},{"edgeType":"contains","source":6673,"target":6711},{"edgeType":"contains","source":10301,"target":11575},{"edgeType":"contains","source":8525,"target":7436},{"edgeType":"calls","source":5950,"target":5470},{"edgeType":"contains","source":12617,"target":12716},{"edgeType":"calls","source":2769,"target":491},{"edgeType":"contains","source":7456,"target":407},{"edgeType":"imports","source":9698,"target":9732},{"edgeType":"contains","source":9848,"target":9763},{"edgeType":"contains","source":10702,"target":10772},{"edgeType":"contains","source":3237,"target":3293},{"edgeType":"calls","source":980,"target":983},{"edgeType":"contains","source":3427,"target":3747},{"edgeType":"calls","source":8945,"target":8784},{"edgeType":"contains","source":1580,"target":1809},{"edgeType":"contains","source":4758,"target":4766},{"edgeType":"contains","source":6568,"target":6796},{"edgeType":"contains","source":12553,"target":12584},{"edgeType":"contains","source":8525,"target":7435},{"edgeType":"contains","source":10301,"target":11576},{"edgeType":"contains","source":9852,"target":10697},{"edgeType":"contains","source":397,"target":426},{"edgeType":"contains","source":3831,"target":3906},{"edgeType":"imports","source":11713,"target":11746},{"edgeType":"contains","source":10702,"target":10773},{"edgeType":"contains","source":1580,"target":1810},{"edgeType":"contains","source":3503,"target":3504},{"edgeType":"contains","source":6144,"target":6199},{"edgeType":"contains","source":8762,"target":9605},{"edgeType":"contains","source":6568,"target":6797},{"edgeType":"calls","source":2439,"target":148},{"edgeType":"imports","source":7456,"target":7357},{"edgeType":"contains","source":10538,"target":10568},{"edgeType":"contains","source":10301,"target":11573},{"edgeType":"contains","source":12355,"target":12379},{"edgeType":"calls","source":7697,"target":2020},{"edgeType":"imports","source":7587,"target":7524},{"edgeType":"imports","source":4179,"target":4297},{"edgeType":"contains","source":10702,"target":10770},{"edgeType":"imports","source":12901,"target":12975},{"edgeType":"contains","source":899,"target":723},{"edgeType":"contains","source":1582,"target":1745},{"edgeType":"calls","source":3068,"target":733},{"edgeType":"contains","source":11108,"target":11925},{"edgeType":"imports","source":3037,"target":583},{"edgeType":"contains","source":7202,"target":7226},{"edgeType":"contains","source":7629,"target":1388},{"edgeType":"contains","source":8762,"target":9604},{"edgeType":"contains","source":6568,"target":6798},{"edgeType":"imports","source":1672,"target":1673},{"edgeType":"contains","source":4758,"target":4764},{"edgeType":"contains","source":4592,"target":4625},{"edgeType":"contains","source":10301,"target":11574},{"edgeType":"contains","source":8557,"target":8560},{"edgeType":"contains","source":12653,"target":12654},{"edgeType":"contains","source":8590,"target":8594},{"edgeType":"contains","source":10702,"target":10771},{"edgeType":"calls","source":2658,"target":1817},{"edgeType":"contains","source":3237,"target":3292},{"edgeType":"contains","source":7862,"target":7907},{"edgeType":"contains","source":5716,"target":5727},{"edgeType":"contains","source":11159,"target":10345},{"edgeType":"contains","source":6968,"target":7082},{"edgeType":"imports","source":2766,"target":2641},{"edgeType":"contains","source":1580,"target":1808},{"edgeType":"contains","source":7333,"target":7394},{"edgeType":"calls","source":8808,"target":8804},{"edgeType":"contains","source":1287,"target":1382},{"edgeType":"contains","source":10301,"target":11571},{"edgeType":"calls","source":9072,"target":9079},{"edgeType":"contains","source":4592,"target":4632},{"edgeType":"contains","source":11108,"target":11923},{"edgeType":"contains","source":11000,"target":11043},{"edgeType":"calls","source":617,"target":604},{"edgeType":"contains","source":8762,"target":9599},{"edgeType":"calls","source":2703,"target":2532},{"edgeType":"contains","source":1582,"target":1751},{"edgeType":"contains","source":3201,"target":3356},{"edgeType":"imports","source":12077,"target":1524},{"edgeType":"calls","source":3063,"target":3000},{"edgeType":"contains","source":5352,"target":5383},{"edgeType":"contains","source":10301,"target":11572},{"edgeType":"calls","source":9302,"target":9347},{"edgeType":"calls","source":1880,"target":1618},{"edgeType":"contains","source":4758,"target":4770},{"edgeType":"contains","source":4231,"target":4194},{"edgeType":"calls","source":4850,"target":454},{"edgeType":"contains","source":4592,"target":4631},{"edgeType":"contains","source":4461,"target":4464},{"edgeType":"contains","source":4428,"target":4430},{"edgeType":"contains","source":1582,"target":1752},{"edgeType":"contains","source":1585,"target":1659},{"edgeType":"contains","source":12173,"target":11676},{"edgeType":"calls","source":2736,"target":454},{"edgeType":"contains","source":3503,"target":3508},{"edgeType":"calls","source":7091,"target":726},{"edgeType":"contains","source":7400,"target":7425},{"edgeType":"contains","source":11202,"target":11124},{"edgeType":"contains","source":4758,"target":4769},{"edgeType":"contains","source":8321,"target":4245},{"edgeType":"calls","source":4614,"target":4598},{"edgeType":"contains","source":8228,"target":8185},{"edgeType":"contains","source":11108,"target":11921},{"edgeType":"contains","source":6673,"target":6709},{"edgeType":"contains","source":10538,"target":10564},{"edgeType":"calls","source":617,"target":606},{"edgeType":"contains","source":8762,"target":9601},{"edgeType":"calls","source":2705,"target":2468},{"edgeType":"contains","source":4592,"target":4630},{"edgeType":"calls","source":2037,"target":2039},{"edgeType":"contains","source":6608,"target":6610},{"edgeType":"contains","source":6568,"target":6793},{"edgeType":"contains","source":12653,"target":12650},{"edgeType":"contains","source":12617,"target":12709},{"edgeType":"calls","source":8780,"target":8620},{"edgeType":"contains","source":12752,"target":12753},{"edgeType":"contains","source":11422,"target":11700},{"edgeType":"calls","source":12871,"target":12869},{"edgeType":"calls","source":2070,"target":2070},{"edgeType":"contains","source":8087,"target":6214},{"edgeType":"calls","source":12272,"target":11353},{"edgeType":"calls","source":4852,"target":4620},{"edgeType":"calls","source":3756,"target":3712},{"edgeType":"imports","source":5835,"target":5818},{"edgeType":"contains","source":3237,"target":3295},{"edgeType":"contains","source":9878,"target":9884},{"edgeType":"contains","source":1580,"target":1811},{"edgeType":"contains","source":5551,"target":5552},{"edgeType":"contains","source":4758,"target":4768},{"edgeType":"contains","source":1287,"target":1381},{"edgeType":"calls","source":4593,"target":4191},{"edgeType":"calls","source":11152,"target":11192},{"edgeType":"calls","source":12319,"target":2498},{"edgeType":"contains","source":6968,"target":7078},{"edgeType":"calls","source":2335,"target":2312},{"edgeType":"contains","source":4592,"target":4629},{"edgeType":"contains","source":6673,"target":6710},{"edgeType":"calls","source":7223,"target":7206},{"edgeType":"calls","source":557,"target":351},{"edgeType":"calls","source":4019,"target":4017},{"edgeType":"calls","source":6102,"target":6036},{"edgeType":"contains","source":8762,"target":9600},{"edgeType":"calls","source":485,"target":469},{"edgeType":"contains","source":6568,"target":6794},{"edgeType":"contains","source":4461,"target":4462},{"edgeType":"contains","source":7202,"target":7223},{"edgeType":"calls","source":748,"target":773},{"edgeType":"contains","source":1,"target":8480},{"edgeType":"contains","source":10704,"target":10705},{"edgeType":"contains","source":10702,"target":10767},{"edgeType":"contains","source":1582,"target":1750},{"edgeType":"calls","source":681,"target":736},{"edgeType":"contains","source":7727,"target":7860},{"edgeType":"calls","source":3061,"target":3061},{"edgeType":"contains","source":9878,"target":9885},{"edgeType":"contains","source":1218,"target":1407},{"edgeType":"imports","source":8362,"target":414},{"edgeType":"calls","source":1914,"target":1618},{"edgeType":"contains","source":7333,"target":7400},{"edgeType":"calls","source":9340,"target":775},{"edgeType":"contains","source":8704,"target":9295},{"edgeType":"contains","source":12058,"target":12083},{"edgeType":"contains","source":11299,"target":11300},{"edgeType":"contains","source":4428,"target":4435},{"edgeType":"contains","source":13380,"target":13383},{"edgeType":"contains","source":5716,"target":5732},{"edgeType":"contains","source":55,"target":467},{"edgeType":"calls","source":4593,"target":4190},{"edgeType":"imports","source":8062,"target":7588},{"edgeType":"contains","source":11108,"target":11935},{"edgeType":"contains","source":10438,"target":10508},{"edgeType":"contains","source":12355,"target":12390},{"edgeType":"contains","source":10301,"target":11584},{"edgeType":"calls","source":4934,"target":4190},{"edgeType":"calls","source":3061,"target":3058},{"edgeType":"calls","source":10757,"target":10758},{"edgeType":"imports","source":6891,"target":6892},{"edgeType":"contains","source":1007,"target":1609},{"edgeType":"calls","source":5803,"target":5790},{"edgeType":"contains","source":4758,"target":4775},{"edgeType":"contains","source":8590,"target":8601},{"edgeType":"contains","source":10663,"target":9875},{"edgeType":"contains","source":6902,"target":7019},{"edgeType":"imports","source":7583,"target":1295},{"edgeType":"contains","source":11299,"target":11301},{"edgeType":"calls","source":11763,"target":11284},{"edgeType":"contains","source":1,"target":12711},{"edgeType":"contains","source":13380,"target":13382},{"edgeType":"imports","source":11713,"target":11738},{"edgeType":"contains","source":1,"target":8483},{"edgeType":"contains","source":233,"target":234},{"edgeType":"contains","source":9106,"target":9516},{"edgeType":"contains","source":10301,"target":11585},{"edgeType":"contains","source":8293,"target":8294},{"edgeType":"contains","source":11000,"target":11056},{"edgeType":"calls","source":7025,"target":662},{"edgeType":"contains","source":7128,"target":7413},{"edgeType":"imports","source":2244,"target":864},{"edgeType":"contains","source":8762,"target":9610},{"edgeType":"calls","source":5471,"target":5511},{"edgeType":"contains","source":2919,"target":3647},{"edgeType":"contains","source":1218,"target":1413},{"edgeType":"contains","source":590,"target":797},{"edgeType":"contains","source":9218,"target":9219},{"edgeType":"contains","source":11422,"target":11713},{"edgeType":"calls","source":9969,"target":1362},{"edgeType":"calls","source":11880,"target":11882},{"edgeType":"imports","source":12553,"target":2614},{"edgeType":"imports","source":11983,"target":2310},{"edgeType":"contains","source":233,"target":237},{"edgeType":"contains","source":4130,"target":4157},{"edgeType":"calls","source":7480,"target":2413},{"edgeType":"contains","source":6968,"target":7089},{"edgeType":"contains","source":1582,"target":1753},{"edgeType":"contains","source":8293,"target":8297},{"edgeType":"contains","source":11133,"target":11158},{"edgeType":"contains","source":6342,"target":6412},{"edgeType":"calls","source":4968,"target":4191},{"edgeType":"contains","source":10301,"target":11582},{"edgeType":"contains","source":11000,"target":11053},{"edgeType":"contains","source":12653,"target":12663},{"edgeType":"calls","source":1814,"target":491},{"edgeType":"contains","source":5107,"target":4524},{"edgeType":"contains","source":10702,"target":10778},{"edgeType":"contains","source":8590,"target":8603},{"edgeType":"contains","source":8762,"target":9613},{"edgeType":"contains","source":1218,"target":1412},{"edgeType":"imports","source":4750,"target":2444},{"edgeType":"contains","source":10238,"target":8250},{"edgeType":"contains","source":1,"target":12713},{"edgeType":"calls","source":11280,"target":3000},{"edgeType":"calls","source":2498,"target":2540},{"edgeType":"contains","source":9848,"target":9770},{"edgeType":"contains","source":11108,"target":11934},{"edgeType":"contains","source":10301,"target":11583},{"edgeType":"contains","source":1582,"target":1754},{"edgeType":"contains","source":11299,"target":11298},{"edgeType":"contains","source":3503,"target":3510},{"edgeType":"contains","source":11000,"target":11054},{"edgeType":"contains","source":12653,"target":12662},{"edgeType":"contains","source":8590,"target":8602},{"edgeType":"calls","source":5626,"target":4932},{"edgeType":"contains","source":8704,"target":9296},{"edgeType":"contains","source":8762,"target":9612},{"edgeType":"contains","source":6144,"target":3030},{"edgeType":"contains","source":13545,"target":13549},{"edgeType":"contains","source":3107,"target":3108},{"edgeType":"contains","source":5155,"target":5157},{"edgeType":"contains","source":6568,"target":6799},{"edgeType":"contains","source":10301,"target":11579},{"edgeType":"contains","source":8321,"target":4251},{"edgeType":"contains","source":5716,"target":5728},{"edgeType":"contains","source":68,"target":69},{"edgeType":"calls","source":7986,"target":7870},{"edgeType":"contains","source":3427,"target":3759},{"edgeType":"calls","source":10871,"target":3000},{"edgeType":"contains","source":8590,"target":8597},{"edgeType":"contains","source":10477,"target":10352},{"edgeType":"contains","source":4329,"target":4337},{"edgeType":"contains","source":3040,"target":3070},{"edgeType":"contains","source":10702,"target":10776},{"edgeType":"calls","source":2070,"target":2064},{"edgeType":"calls","source":12022,"target":11714},{"edgeType":"calls","source":12351,"target":2572},{"edgeType":"contains","source":8762,"target":9606},{"edgeType":"contains","source":3040,"target":3072},{"edgeType":"contains","source":5155,"target":5156},{"edgeType":"calls","source":7714,"target":448},{"edgeType":"calls","source":12589,"target":2595},{"edgeType":"contains","source":13545,"target":13548},{"edgeType":"contains","source":1580,"target":1822},{"edgeType":"contains","source":10301,"target":11580},{"edgeType":"contains","source":9852,"target":10701},{"edgeType":"calls","source":10757,"target":10763},{"edgeType":"contains","source":9848,"target":9768},{"edgeType":"calls","source":9509,"target":824},{"edgeType":"contains","source":12553,"target":12589},{"edgeType":"imports","source":4179,"target":4292},{"edgeType":"contains","source":11108,"target":11932},{"edgeType":"contains","source":6305,"target":6497},{"edgeType":"contains","source":8557,"target":8562},{"edgeType":"contains","source":12653,"target":12660},{"edgeType":"calls","source":351,"target":385},{"edgeType":"contains","source":10583,"target":10238},{"edgeType":"contains","source":4329,"target":4336},{"edgeType":"contains","source":10301,"target":11581},{"edgeType":"contains","source":12521,"target":12524},{"edgeType":"contains","source":2269,"target":2661},{"edgeType":"calls","source":1874,"target":738},{"edgeType":"contains","source":590,"target":798},{"edgeType":"imports","source":792,"target":420},{"edgeType":"contains","source":3040,"target":3071},{"edgeType":"contains","source":10697,"target":9875},{"edgeType":"contains","source":10704,"target":10715},{"edgeType":"contains","source":10702,"target":10777},{"edgeType":"calls","source":12177,"target":568},{"edgeType":"contains","source":7296,"target":1144},{"edgeType":"calls","source":3391,"target":3392},{"edgeType":"contains","source":5221,"target":5223},{"edgeType":"contains","source":8762,"target":9609},{"edgeType":"calls","source":9762,"target":2498},{"edgeType":"calls","source":1166,"target":492},{"edgeType":"contains","source":13545,"target":13547},{"edgeType":"contains","source":3703,"target":3657},{"edgeType":"calls","source":4954,"target":4620},{"edgeType":"contains","source":2314,"target":2320},{"edgeType":"contains","source":10301,"target":11577},{"edgeType":"imports","source":11713,"target":11741},{"edgeType":"contains","source":4230,"target":4233},{"edgeType":"contains","source":5716,"target":5730},{"edgeType":"contains","source":2,"target":3},{"edgeType":"contains","source":9878,"target":9892},{"edgeType":"contains","source":1582,"target":1757},{"edgeType":"contains","source":10473,"target":10474},{"edgeType":"contains","source":4329,"target":4335},{"edgeType":"contains","source":8458,"target":8463},{"edgeType":"contains","source":1287,"target":1389},{"edgeType":"imports","source":2244,"target":859},{"edgeType":"contains","source":4758,"target":4777},{"edgeType":"contains","source":8557,"target":8565},{"edgeType":"contains","source":8590,"target":8599},{"edgeType":"contains","source":590,"target":801},{"edgeType":"calls","source":2070,"target":2062},{"edgeType":"contains","source":11108,"target":11929},{"edgeType":"imports","source":8031,"target":7495},{"edgeType":"contains","source":8704,"target":9292},{"edgeType":"calls","source":1376,"target":1380},{"edgeType":"contains","source":13545,"target":13546},{"edgeType":"contains","source":5409,"target":5736},{"edgeType":"contains","source":7860,"target":7973},{"edgeType":"contains","source":10301,"target":11578},{"edgeType":"contains","source":5883,"target":5839},{"edgeType":"contains","source":6159,"target":2568},{"edgeType":"imports","source":11864,"target":9173},{"edgeType":"calls","source":8091,"target":2504},{"edgeType":"calls","source":3009,"target":2551},{"edgeType":"contains","source":6305,"target":6499},{"edgeType":"contains","source":1,"target":33},{"edgeType":"contains","source":9878,"target":9893},{"edgeType":"contains","source":55,"target":473},{"edgeType":"contains","source":5716,"target":5731},{"edgeType":"contains","source":10440,"target":10441},{"edgeType":"calls","source":385,"target":390},{"edgeType":"contains","source":8557,"target":8564},{"edgeType":"contains","source":8458,"target":8462},{"edgeType":"contains","source":12553,"target":12587},{"edgeType":"contains","source":3436,"target":3477},{"edgeType":"contains","source":4758,"target":4776},{"edgeType":"contains","source":8590,"target":8598},{"edgeType":"contains","source":3040,"target":3069},{"edgeType":"contains","source":10702,"target":10775},{"edgeType":"contains","source":590,"target":800},{"edgeType":"contains","source":2919,"target":3649},{"edgeType":"calls","source":5602,"target":5638},{"edgeType":"contains","source":12713,"target":12894},{"edgeType":"contains","source":3238,"target":3246},{"edgeType":"calls","source":10491,"target":10522},{"edgeType":"contains","source":7630,"target":7682},{"edgeType":"contains","source":3492,"target":3829},{"edgeType":"contains","source":1585,"target":1637},{"edgeType":"contains","source":3469,"target":3485},{"edgeType":"calls","source":8905,"target":8950},{"edgeType":"contains","source":4130,"target":4135},{"edgeType":"contains","source":12456,"target":8177},{"edgeType":"contains","source":55,"target":443},{"edgeType":"contains","source":8762,"target":9586},{"edgeType":"contains","source":3998,"target":3999},{"edgeType":"calls","source":550,"target":522},{"edgeType":"contains","source":12090,"target":12124},{"edgeType":"contains","source":6568,"target":6778},{"edgeType":"contains","source":10185,"target":9870},{"edgeType":"contains","source":12058,"target":12059},{"edgeType":"contains","source":12355,"target":12365},{"edgeType":"contains","source":4592,"target":4611},{"edgeType":"contains","source":3073,"target":3077},{"edgeType":"contains","source":7202,"target":7209},{"edgeType":"contains","source":10538,"target":10555},{"edgeType":"contains","source":12617,"target":12698},{"edgeType":"contains","source":9779,"target":9772},{"edgeType":"contains","source":12824,"target":12623},{"edgeType":"contains","source":3961,"target":4087},{"edgeType":"contains","source":11430,"target":11443},{"edgeType":"contains","source":7037,"target":7039},{"edgeType":"calls","source":2862,"target":2844},{"edgeType":"calls","source":6861,"target":436},{"edgeType":"contains","source":3492,"target":3828},{"edgeType":"calls","source":1125,"target":665},{"edgeType":"contains","source":1,"target":2},{"edgeType":"calls","source":2333,"target":2331},{"edgeType":"contains","source":6046,"target":6049},{"edgeType":"calls","source":1838,"target":1817},{"edgeType":"contains","source":4158,"target":4323},{"edgeType":"imports","source":11154,"target":11155},{"edgeType":"contains","source":2917,"target":3684},{"edgeType":"contains","source":590,"target":769},{"edgeType":"contains","source":8762,"target":9585},{"edgeType":"contains","source":4592,"target":4610},{"edgeType":"contains","source":12276,"target":11642},{"edgeType":"contains","source":12289,"target":12296},{"edgeType":"contains","source":12713,"target":12892},{"edgeType":"contains","source":4469,"target":4194},{"edgeType":"contains","source":10037,"target":10227},{"edgeType":"contains","source":12090,"target":12121},{"edgeType":"contains","source":3073,"target":3074},{"edgeType":"calls","source":12507,"target":12504},{"edgeType":"contains","source":5107,"target":5557},{"edgeType":"contains","source":7630,"target":7684},{"edgeType":"contains","source":3961,"target":4086},{"edgeType":"calls","source":1134,"target":390},{"edgeType":"contains","source":7202,"target":7210},{"edgeType":"contains","source":3469,"target":3483},{"edgeType":"imports","source":9507,"target":3016},{"edgeType":"calls","source":3159,"target":3147},{"edgeType":"calls","source":10148,"target":3187},{"edgeType":"contains","source":10307,"target":10314},{"edgeType":"calls","source":2531,"target":2532},{"edgeType":"imports","source":10037,"target":9842},{"edgeType":"contains","source":4130,"target":4133},{"edgeType":"contains","source":8762,"target":9588},{"edgeType":"calls","source":6099,"target":6084},{"edgeType":"contains","source":3037,"target":3132},{"edgeType":"contains","source":4592,"target":4609},{"edgeType":"contains","source":590,"target":772},{"edgeType":"calls","source":715,"target":693},{"edgeType":"contains","source":3040,"target":3041},{"edgeType":"contains","source":5107,"target":4499},{"edgeType":"contains","source":3238,"target":3245},{"edgeType":"contains","source":11133,"target":11135},{"edgeType":"contains","source":3961,"target":4085},{"edgeType":"contains","source":11165,"target":11200},{"edgeType":"calls","source":3076,"target":436},{"edgeType":"calls","source":11211,"target":3000},{"edgeType":"contains","source":11430,"target":11441},{"edgeType":"contains","source":6046,"target":6051},{"edgeType":"contains","source":11700,"target":11527},{"edgeType":"contains","source":8762,"target":9587},{"edgeType":"contains","source":4130,"target":4132},{"edgeType":"imports","source":10037,"target":9841},{"edgeType":"contains","source":2917,"target":3682},{"edgeType":"contains","source":590,"target":771},{"edgeType":"contains","source":4591,"target":4639},{"edgeType":"contains","source":10307,"target":10315},{"edgeType":"calls","source":12272,"target":11339},{"edgeType":"contains","source":6574,"target":6588},{"edgeType":"contains","source":10702,"target":10751},{"edgeType":"contains","source":2941,"target":2944},{"edgeType":"calls","source":943,"target":1019},{"edgeType":"contains","source":7202,"target":7204},{"edgeType":"contains","source":9852,"target":10675},{"edgeType":"imports","source":11864,"target":8177},{"edgeType":"contains","source":13511,"target":13521},{"edgeType":"contains","source":11430,"target":11438},{"edgeType":"contains","source":5352,"target":5367},{"edgeType":"contains","source":11505,"target":11227},{"edgeType":"calls","source":10587,"target":10722},{"edgeType":"contains","source":1287,"target":1366},{"edgeType":"contains","source":590,"target":774},{"edgeType":"imports","source":7283,"target":1144},{"edgeType":"contains","source":3998,"target":4003},{"edgeType":"calls","source":7024,"target":7014},{"edgeType":"contains","source":4158,"target":4328},{"edgeType":"contains","source":8762,"target":9582},{"edgeType":"calls","source":582,"target":583},{"edgeType":"calls","source":6236,"target":6063},{"edgeType":"contains","source":8523,"target":8535},{"edgeType":"contains","source":12617,"target":12695},{"edgeType":"contains","source":6574,"target":6589},{"edgeType":"contains","source":2941,"target":2945},{"edgeType":"contains","source":10702,"target":10752},{"edgeType":"contains","source":1582,"target":1735},{"edgeType":"calls","source":978,"target":990},{"edgeType":"calls","source":2905,"target":2564},{"edgeType":"contains","source":7128,"target":7385},{"edgeType":"calls","source":6608,"target":6169},{"edgeType":"contains","source":11165,"target":11198},{"edgeType":"imports","source":5968,"target":5969},{"edgeType":"calls","source":1301,"target":491},{"edgeType":"contains","source":3201,"target":3341},{"edgeType":"contains","source":1954,"target":1831},{"edgeType":"contains","source":10307,"target":10313},{"edgeType":"contains","source":12355,"target":12360},{"edgeType":"contains","source":6902,"target":6991},{"edgeType":"calls","source":4777,"target":4782},{"edgeType":"contains","source":8523,"target":8534},{"edgeType":"calls","source":2597,"target":2599},{"edgeType":"contains","source":4592,"target":4614},{"edgeType":"contains","source":1,"target":12690},{"edgeType":"contains","source":8762,"target":9581},{"edgeType":"contains","source":6673,"target":6691},{"edgeType":"contains","source":12090,"target":12117},{"edgeType":"contains","source":3073,"target":3078},{"edgeType":"contains","source":7202,"target":7206},{"edgeType":"calls","source":2070,"target":2020},{"edgeType":"contains","source":2941,"target":2942},{"edgeType":"contains","source":2917,"target":3686},{"edgeType":"contains","source":3566,"target":3651},{"edgeType":"calls","source":3727,"target":3505},{"edgeType":"contains","source":1144,"target":1572},{"edgeType":"calls","source":1408,"target":1405},{"edgeType":"contains","source":3402,"target":3450},{"edgeType":"contains","source":590,"target":776},{"edgeType":"imports","source":2527,"target":583},{"edgeType":"contains","source":3965,"target":3967},{"edgeType":"contains","source":11000,"target":11024},{"edgeType":"contains","source":10307,"target":10310},{"edgeType":"calls","source":1937,"target":1918},{"edgeType":"calls","source":11152,"target":11175},{"edgeType":"contains","source":12268,"target":11885},{"edgeType":"contains","source":10538,"target":10548},{"edgeType":"contains","source":1,"target":13750},{"edgeType":"contains","source":12894,"target":13619},{"edgeType":"calls","source":584,"target":523},{"edgeType":"contains","source":4158,"target":4326},{"edgeType":"contains","source":4316,"target":4713},{"edgeType":"contains","source":6574,"target":6590},{"edgeType":"contains","source":10702,"target":10749},{"edgeType":"contains","source":10702,"target":10750},{"edgeType":"imports","source":11616,"target":11634},{"edgeType":"contains","source":3073,"target":3079},{"edgeType":"contains","source":7070,"target":7071},{"edgeType":"contains","source":2908,"target":2909},{"edgeType":"contains","source":7334,"target":7343},{"edgeType":"contains","source":1580,"target":1795},{"edgeType":"imports","source":10367,"target":10185},{"edgeType":"imports","source":12423,"target":11984},{"edgeType":"contains","source":7630,"target":7679},{"edgeType":"calls","source":10833,"target":3095},{"edgeType":"contains","source":7531,"target":7578},{"edgeType":"calls","source":1837,"target":789},{"edgeType":"contains","source":10307,"target":10311},{"edgeType":"calls","source":7338,"target":454},{"edgeType":"contains","source":11000,"target":11025},{"edgeType":"contains","source":6046,"target":6047},{"edgeType":"contains","source":8762,"target":9583},{"edgeType":"contains","source":10538,"target":10549},{"edgeType":"contains","source":12617,"target":12692},{"edgeType":"calls","source":4777,"target":4780},{"edgeType":"contains","source":8523,"target":8536},{"edgeType":"contains","source":12553,"target":12562},{"edgeType":"imports","source":7128,"target":7007},{"edgeType":"calls","source":7565,"target":7158},{"edgeType":"contains","source":2941,"target":2948},{"edgeType":"contains","source":2919,"target":3630},{"edgeType":"calls","source":978,"target":987},{"edgeType":"contains","source":4758,"target":4759},{"edgeType":"contains","source":11020,"target":10419},{"edgeType":"contains","source":10538,"target":10562},{"edgeType":"contains","source":1287,"target":1370},{"edgeType":"contains","source":8762,"target":9595},{"edgeType":"contains","source":8790,"target":8727},{"edgeType":"contains","source":3237,"target":3285},{"edgeType":"contains","source":3899,"target":3905},{"edgeType":"calls","source":11152,"target":11181},{"edgeType":"contains","source":11430,"target":11450},{"edgeType":"imports","source":2314,"target":859},{"edgeType":"contains","source":590,"target":778},{"edgeType":"contains","source":4592,"target":4619},{"edgeType":"calls","source":7288,"target":7290},{"edgeType":"contains","source":4158,"target":4332},{"edgeType":"contains","source":4367,"target":4194},{"edgeType":"contains","source":7727,"target":7853},{"edgeType":"contains","source":1582,"target":1739},{"edgeType":"contains","source":10538,"target":10563},{"edgeType":"contains","source":2919,"target":3631},{"edgeType":"contains","source":12713,"target":12901},{"edgeType":"contains","source":11430,"target":11451},{"edgeType":"calls","source":6033,"target":6009},{"edgeType":"contains","source":590,"target":777},{"edgeType":"contains","source":8762,"target":9593},{"edgeType":"contains","source":5352,"target":5370},{"edgeType":"calls","source":1377,"target":1301},{"edgeType":"calls","source":11733,"target":11140},{"edgeType":"calls","source":10102,"target":2504},{"edgeType":"contains","source":4592,"target":4618},{"edgeType":"calls","source":4137,"target":4535},{"edgeType":"contains","source":427,"target":545},{"edgeType":"contains","source":7583,"target":7033},{"edgeType":"imports","source":1434,"target":655},{"edgeType":"contains","source":8321,"target":4238},{"edgeType":"contains","source":5716,"target":5717},{"edgeType":"contains","source":4158,"target":4331},{"edgeType":"imports","source":6043,"target":5746},{"edgeType":"contains","source":11096,"target":11232},{"edgeType":"contains","source":12553,"target":12575},{"edgeType":"calls","source":945,"target":955},{"edgeType":"calls","source":5143,"target":5058},{"edgeType":"contains","source":11261,"target":10345},{"edgeType":"imports","source":4316,"target":4319},{"edgeType":"contains","source":10538,"target":10560},{"edgeType":"contains","source":3767,"target":3766},{"edgeType":"contains","source":12355,"target":12371},{"edgeType":"calls","source":5948,"target":5472},{"edgeType":"contains","source":8762,"target":9597},{"edgeType":"contains","source":10117,"target":9870},{"edgeType":"contains","source":1144,"target":1576},{"edgeType":"contains","source":10304,"target":3016},{"edgeType":"contains","source":4592,"target":4617},{"edgeType":"contains","source":590,"target":780},{"edgeType":"contains","source":11430,"target":11448},{"edgeType":"imports","source":1434,"target":654},{"edgeType":"contains","source":10307,"target":10322},{"edgeType":"contains","source":3831,"target":3897},{"edgeType":"calls","source":4951,"target":4668},{"edgeType":"contains","source":7583,"target":7034},{"edgeType":"contains","source":11674,"target":12340},{"edgeType":"calls","source":648,"target":649},{"edgeType":"imports","source":5835,"target":5855},{"edgeType":"contains","source":4158,"target":4330},{"edgeType":"contains","source":2941,"target":2947},{"edgeType":"contains","source":2269,"target":2638},{"edgeType":"contains","source":10477,"target":10338},{"edgeType":"contains","source":6960,"target":7322},{"edgeType":"contains","source":3786,"target":3176},{"edgeType":"calls","source":3491,"target":2362},{"edgeType":"contains","source":3237,"target":3284},{"edgeType":"contains","source":8762,"target":9596},{"edgeType":"imports","source":12574,"target":11527},{"edgeType":"imports","source":2345,"target":952},{"edgeType":"calls","source":5482,"target":5118},{"edgeType":"calls","source":5502,"target":270},{"edgeType":"contains","source":590,"target":779},{"edgeType":"calls","source":8945,"target":8777},{"edgeType":"contains","source":11430,"target":11449},{"edgeType":"contains","source":1,"target":12696},{"edgeType":"contains","source":55,"target":452},{"edgeType":"contains","source":12090,"target":12129},{"edgeType":"calls","source":747,"target":750},{"edgeType":"contains","source":3402,"target":3460},{"edgeType":"contains","source":7630,"target":7686},{"edgeType":"calls","source":12248,"target":12091},{"edgeType":"calls","source":11851,"target":11714},{"edgeType":"calls","source":1814,"target":436},{"edgeType":"contains","source":2919,"target":3634},{"edgeType":"imports","source":2350,"target":795},{"edgeType":"contains","source":4758,"target":4763},{"edgeType":"contains","source":7202,"target":7212},{"edgeType":"contains","source":7400,"target":7416},{"edgeType":"imports","source":11096,"target":266},{"edgeType":"contains","source":3237,"target":3289},{"edgeType":"contains","source":11430,"target":11446},{"edgeType":"contains","source":397,"target":423},{"edgeType":"contains","source":12355,"target":12369},{"edgeType":"imports","source":7853,"target":7779},{"edgeType":"calls","source":9308,"target":8097},{"edgeType":"calls","source":3007,"target":2564},{"edgeType":"imports","source":3763,"target":3495},{"edgeType":"contains","source":7070,"target":7077},{"edgeType":"contains","source":8523,"target":8542},{"edgeType":"calls","source":5171,"target":4187},{"edgeType":"calls","source":10587,"target":10731},{"edgeType":"imports","source":12516,"target":12262},{"edgeType":"contains","source":2919,"target":3635},{"edgeType":"contains","source":10702,"target":10760},{"edgeType":"contains","source":10698,"target":10884},{"edgeType":"calls","source":12066,"target":2936},{"edgeType":"contains","source":6960,"target":7316},{"edgeType":"contains","source":1124,"target":1140},{"edgeType":"contains","source":3237,"target":3290},{"edgeType":"imports","source":9207,"target":9144},{"edgeType":"contains","source":590,"target":781},{"edgeType":"contains","source":8762,"target":9589},{"edgeType":"imports","source":5835,"target":5856},{"edgeType":"contains","source":9878,"target":9879},{"edgeType":"calls","source":4985,"target":4668},{"edgeType":"contains","source":3831,"target":3902},{"edgeType":"calls","source":3819,"target":3816},{"edgeType":"contains","source":4198,"target":4151},{"edgeType":"contains","source":1582,"target":1740},{"edgeType":"imports","source":12553,"target":10059},{"edgeType":"contains","source":12713,"target":12896},{"edgeType":"contains","source":6902,"target":7001},{"edgeType":"contains","source":7202,"target":7214},{"edgeType":"contains","source":7357,"target":2409},{"edgeType":"contains","source":503,"target":311},{"edgeType":"contains","source":11430,"target":11444},{"edgeType":"calls","source":2135,"target":2111},{"edgeType":"contains","source":2919,"target":3632},{"edgeType":"contains","source":13053,"target":12927},{"edgeType":"calls","source":8945,"target":8782},{"edgeType":"contains","source":1144,"target":523},{"edgeType":"contains","source":5223,"target":5144},{"edgeType":"contains","source":3237,"target":3287},{"edgeType":"contains","source":7334,"target":7350},{"edgeType":"contains","source":8762,"target":9592},{"edgeType":"imports","source":10237,"target":1524},{"edgeType":"imports","source":6043,"target":5753},{"edgeType":"contains","source":7896,"target":7899},{"edgeType":"calls","source":6699,"target":6529},{"edgeType":"contains","source":3899,"target":3907},{"edgeType":"contains","source":1954,"target":1836},{"edgeType":"contains","source":12713,"target":12895},{"edgeType":"imports","source":1954,"target":1441},{"edgeType":"imports","source":6203,"target":2906},{"edgeType":"imports","source":4316,"target":4324},{"edgeType":"contains","source":4758,"target":4760},{"edgeType":"imports","source":2244,"target":907},{"edgeType":"contains","source":5107,"target":4511},{"edgeType":"contains","source":11430,"target":11445},{"edgeType":"contains","source":2919,"target":3633},{"edgeType":"calls","source":10103,"target":9879},{"edgeType":"contains","source":3237,"target":3288},{"edgeType":"contains","source":397,"target":424},{"edgeType":"calls","source":451,"target":409},{"edgeType":"calls","source":10888,"target":10912},{"edgeType":"contains","source":1582,"target":1742},{"edgeType":"contains","source":10307,"target":10319},{"edgeType":"contains","source":4158,"target":4333},{"edgeType":"calls","source":719,"target":557},{"edgeType":"calls","source":11253,"target":9110},{"edgeType":"contains","source":3427,"target":3713},{"edgeType":"contains","source":33,"target":51},{"edgeType":"imports","source":5835,"target":5844},{"edgeType":"contains","source":7022,"target":1144},{"edgeType":"contains","source":11000,"target":11014},{"edgeType":"contains","source":12894,"target":13609},{"edgeType":"contains","source":8762,"target":9570},{"edgeType":"contains","source":7862,"target":7873},{"edgeType":"contains","source":8589,"target":8591},{"edgeType":"contains","source":5883,"target":6856},{"edgeType":"contains","source":10702,"target":10739},{"edgeType":"contains","source":9852,"target":10663},{"edgeType":"contains","source":3152,"target":3781},{"edgeType":"contains","source":11108,"target":11894},{"edgeType":"calls","source":11152,"target":11156},{"edgeType":"contains","source":13444,"target":13471},{"edgeType":"contains","source":33,"target":50},{"edgeType":"contains","source":6203,"target":6450},{"edgeType":"contains","source":7072,"target":652},{"edgeType":"contains","source":2941,"target":2924},{"edgeType":"calls","source":6296,"target":6307},{"edgeType":"contains","source":6607,"target":6611},{"edgeType":"contains","source":12090,"target":12106},{"edgeType":"contains","source":12525,"target":2849},{"edgeType":"calls","source":12341,"target":12351},{"edgeType":"contains","source":6508,"target":6509},{"edgeType":"contains","source":8589,"target":8590},{"edgeType":"imports","source":12298,"target":11617},{"edgeType":"calls","source":3395,"target":3250},{"edgeType":"contains","source":9809,"target":9883},{"edgeType":"contains","source":5223,"target":5116},{"edgeType":"contains","source":5883,"target":6857},{"edgeType":"contains","source":11422,"target":11674},{"edgeType":"contains","source":13444,"target":13470},{"edgeType":"contains","source":13053,"target":12906},{"edgeType":"contains","source":8321,"target":4216},{"edgeType":"imports","source":2527,"target":2685},{"edgeType":"calls","source":1632,"target":824},{"edgeType":"contains","source":6203,"target":6451},{"edgeType":"calls","source":2086,"target":491},{"edgeType":"imports","source":9698,"target":9763},{"edgeType":"contains","source":10702,"target":10737},{"edgeType":"contains","source":12090,"target":12105},{"edgeType":"contains","source":1,"target":8444},{"edgeType":"calls","source":12341,"target":12348},{"edgeType":"contains","source":1144,"target":1551},{"edgeType":"contains","source":7862,"target":7875},{"edgeType":"contains","source":7630,"target":7668},{"edgeType":"contains","source":11259,"target":11439},{"edgeType":"contains","source":3568,"target":3569},{"edgeType":"imports","source":10237,"target":2567},{"edgeType":"contains","source":11000,"target":11013},{"edgeType":"contains","source":8762,"target":9571},{"edgeType":"contains","source":6769,"target":6876},{"edgeType":"contains","source":10868,"target":10877},{"edgeType":"calls","source":6099,"target":6100},{"edgeType":"contains","source":590,"target":755},{"edgeType":"calls","source":1986,"target":1476},{"edgeType":"contains","source":6203,"target":6452},{"edgeType":"contains","source":12519,"target":12546},{"edgeType":"calls","source":8907,"target":8873},{"edgeType":"calls","source":2076,"target":1856},{"edgeType":"contains","source":1,"target":13728},{"edgeType":"contains","source":10702,"target":10738},{"edgeType":"contains","source":12090,"target":12104},{"edgeType":"calls","source":4751,"target":4550},{"edgeType":"calls","source":2664,"target":2655},{"edgeType":"contains","source":6968,"target":7049},{"edgeType":"contains","source":1585,"target":1620},{"edgeType":"contains","source":11826,"target":11832},{"edgeType":"contains","source":7630,"target":7667},{"edgeType":"contains","source":7629,"target":7698},{"edgeType":"calls","source":3060,"target":3063},{"edgeType":"imports","source":10514,"target":10893},{"edgeType":"contains","source":13444,"target":13468},{"edgeType":"contains","source":7629,"target":7692},{"edgeType":"calls","source":9864,"target":9863},{"edgeType":"contains","source":11108,"target":11890},{"edgeType":"calls","source":5868,"target":5861},{"edgeType":"contains","source":6203,"target":6445},{"edgeType":"contains","source":6305,"target":6454},{"edgeType":"calls","source":11749,"target":11680},{"edgeType":"contains","source":8762,"target":9566},{"edgeType":"contains","source":12521,"target":11426},{"edgeType":"contains","source":1,"target":9503},{"edgeType":"contains","source":13444,"target":13467},{"edgeType":"contains","source":10702,"target":10735},{"edgeType":"contains","source":5107,"target":5546},{"edgeType":"calls","source":5117,"target":602},{"edgeType":"contains","source":7356,"target":2413},{"edgeType":"contains","source":12090,"target":12103},{"edgeType":"contains","source":5223,"target":5121},{"edgeType":"contains","source":3469,"target":3473},{"edgeType":"contains","source":11826,"target":11831},{"edgeType":"contains","source":1218,"target":1373},{"edgeType":"contains","source":7531,"target":7558},{"edgeType":"calls","source":10491,"target":10509},{"edgeType":"contains","source":7729,"target":7764},{"edgeType":"contains","source":5746,"target":5814},{"edgeType":"contains","source":1388,"target":1390},{"edgeType":"contains","source":7629,"target":7691},{"edgeType":"calls","source":9909,"target":8467},{"edgeType":"calls","source":8411,"target":8395},{"edgeType":"contains","source":33,"target":54},{"edgeType":"contains","source":6203,"target":6446},{"edgeType":"calls","source":7376,"target":1371},{"edgeType":"contains","source":6769,"target":6870},{"edgeType":"contains","source":2379,"target":2381},{"edgeType":"contains","source":4298,"target":4198},{"edgeType":"contains","source":590,"target":757},{"edgeType":"contains","source":2269,"target":2619},{"edgeType":"contains","source":2346,"target":2347},{"edgeType":"contains","source":8762,"target":9565},{"edgeType":"contains","source":13444,"target":13466},{"edgeType":"contains","source":10702,"target":10736},{"edgeType":"calls","source":4875,"target":4932},{"edgeType":"imports","source":9698,"target":9770},{"edgeType":"calls","source":3258,"target":3265},{"edgeType":"contains","source":3436,"target":3438},{"edgeType":"contains","source":3469,"target":3472},{"edgeType":"calls","source":12673,"target":12633},{"edgeType":"contains","source":5786,"target":4575},{"edgeType":"contains","source":11000,"target":11008},{"edgeType":"contains","source":10238,"target":10318},{"edgeType":"contains","source":33,"target":57},{"edgeType":"contains","source":6342,"target":6366},{"edgeType":"contains","source":6769,"target":6871},{"edgeType":"calls","source":7950,"target":491},{"edgeType":"contains","source":6673,"target":6676},{"edgeType":"contains","source":1,"target":8449},{"edgeType":"contains","source":10702,"target":10732},{"edgeType":"contains","source":1,"target":9506},{"edgeType":"imports","source":11616,"target":11618},{"edgeType":"calls","source":12308,"target":12318},{"edgeType":"contains","source":13444,"target":13465},{"edgeType":"contains","source":2346,"target":1286},{"edgeType":"contains","source":7332,"target":7387},{"edgeType":"contains","source":7333,"target":7356},{"edgeType":"imports","source":7520,"target":7524},{"edgeType":"calls","source":3061,"target":1970},{"edgeType":"contains","source":5711,"target":5844},{"edgeType":"calls","source":10631,"target":3000},{"edgeType":"contains","source":11826,"target":11829},{"edgeType":"contains","source":1218,"target":1375},{"edgeType":"contains","source":7531,"target":7560},{"edgeType":"contains","source":6203,"target":6448},{"edgeType":"contains","source":33,"target":56},{"edgeType":"contains","source":8762,"target":9567},{"edgeType":"contains","source":6574,"target":6575},{"edgeType":"contains","source":10702,"target":10734},{"edgeType":"imports","source":11616,"target":11617},{"edgeType":"calls","source":2233,"target":2270},{"edgeType":"contains","source":13444,"target":13464},{"edgeType":"calls","source":8080,"target":8089},{"edgeType":"imports","source":9698,"target":9768},{"edgeType":"contains","source":1218,"target":1374},{"edgeType":"contains","source":7531,"target":7561},{"edgeType":"contains","source":3469,"target":3470},{"edgeType":"contains","source":1218,"target":1378},{"edgeType":"contains","source":7332,"target":7398},{"edgeType":"calls","source":3382,"target":1530},{"edgeType":"contains","source":5352,"target":5355},{"edgeType":"contains","source":12090,"target":12115},{"edgeType":"calls","source":1165,"target":492},{"edgeType":"contains","source":12276,"target":11634},{"edgeType":"calls","source":6316,"target":2539},{"edgeType":"contains","source":7531,"target":7571},{"edgeType":"contains","source":5741,"target":5981},{"edgeType":"calls","source":4249,"target":4251},{"edgeType":"contains","source":5711,"target":5854},{"edgeType":"calls","source":219,"target":221},{"edgeType":"calls","source":2188,"target":491},{"edgeType":"contains","source":8523,"target":8531},{"edgeType":"contains","source":11000,"target":11022},{"edgeType":"calls","source":3395,"target":3241},{"edgeType":"contains","source":8762,"target":9578},{"edgeType":"contains","source":5107,"target":5550},{"edgeType":"contains","source":1218,"target":1377},{"edgeType":"contains","source":6968,"target":7054},{"edgeType":"contains","source":3238,"target":3239},{"edgeType":"calls","source":10491,"target":10513},{"edgeType":"contains","source":6673,"target":6687},{"edgeType":"contains","source":4567,"target":4320},{"edgeType":"calls","source":9864,"target":9866},{"edgeType":"calls","source":13855,"target":12991},{"edgeType":"contains","source":5883,"target":6865},{"edgeType":"contains","source":11826,"target":11842},{"edgeType":"contains","source":10307,"target":10309},{"edgeType":"imports","source":6700,"target":1218},{"edgeType":"calls","source":10756,"target":10757},{"edgeType":"calls","source":9733,"target":9702},{"edgeType":"calls","source":1226,"target":717},{"edgeType":"contains","source":13511,"target":13515},{"edgeType":"imports","source":3763,"target":3476},{"edgeType":"contains","source":5746,"target":5828},{"edgeType":"contains","source":8321,"target":4224},{"edgeType":"contains","source":2346,"target":2348},{"edgeType":"contains","source":5883,"target":6866},{"edgeType":"contains","source":2314,"target":1225},{"edgeType":"contains","source":4179,"target":4719},{"edgeType":"contains","source":11826,"target":11841},{"edgeType":"calls","source":5022,"target":4598},{"edgeType":"contains","source":4361,"target":4363},{"edgeType":"contains","source":3469,"target":3475},{"edgeType":"calls","source":1408,"target":1417},{"edgeType":"contains","source":8523,"target":8533},{"edgeType":"calls","source":8717,"target":2088},{"edgeType":"calls","source":10757,"target":9666},{"edgeType":"contains","source":3237,"target":3266},{"edgeType":"contains","source":1144,"target":1559},{"edgeType":"contains","source":5223,"target":5123},{"edgeType":"contains","source":8762,"target":9580},{"edgeType":"contains","source":1218,"target":1379},{"edgeType":"contains","source":5883,"target":6867},{"edgeType":"contains","source":6568,"target":6773},{"edgeType":"calls","source":9108,"target":8992},{"edgeType":"contains","source":7202,"target":7203},{"edgeType":"calls","source":6920,"target":7057},{"edgeType":"contains","source":13511,"target":13514},{"edgeType":"contains","source":13444,"target":13477},{"edgeType":"imports","source":9698,"target":9756},{"edgeType":"contains","source":2346,"target":2349},{"edgeType":"contains","source":1,"target":8452},{"edgeType":"contains","source":4230,"target":4194},{"edgeType":"imports","source":8031,"target":7524},{"edgeType":"contains","source":4361,"target":4362},{"edgeType":"contains","source":11165,"target":11191},{"edgeType":"calls","source":8811,"target":8686},{"edgeType":"contains","source":8523,"target":8532},{"edgeType":"contains","source":4841,"target":5337},{"edgeType":"contains","source":8762,"target":9579},{"edgeType":"contains","source":8762,"target":9574},{"edgeType":"contains","source":3139,"target":3140},{"edgeType":"calls","source":5495,"target":4731},{"edgeType":"contains","source":3238,"target":3242},{"edgeType":"contains","source":11595,"target":11600},{"edgeType":"calls","source":9633,"target":9633},{"edgeType":"contains","source":13444,"target":13476},{"edgeType":"calls","source":7396,"target":7101},{"edgeType":"contains","source":3961,"target":4084},{"edgeType":"contains","source":6203,"target":6453},{"edgeType":"contains","source":133,"target":135},{"edgeType":"contains","source":11826,"target":11839},{"edgeType":"contains","source":3427,"target":3726},{"edgeType":"contains","source":4130,"target":4131},{"edgeType":"contains","source":10439,"target":10440},{"edgeType":"calls","source":2168,"target":2164},{"edgeType":"calls","source":1985,"target":436},{"edgeType":"contains","source":1205,"target":1784},{"edgeType":"calls","source":6073,"target":5839},{"edgeType":"contains","source":547,"target":1041},{"edgeType":"calls","source":5575,"target":4364},{"edgeType":"imports","source":7531,"target":1887},{"edgeType":"contains","source":8762,"target":9573},{"edgeType":"contains","source":6673,"target":6683},{"edgeType":"contains","source":13511,"target":13512},{"edgeType":"contains","source":8401,"target":7022},{"edgeType":"calls","source":4612,"target":4620},{"edgeType":"contains","source":1,"target":8454},{"edgeType":"imports","source":10237,"target":451},{"edgeType":"contains","source":3961,"target":4083},{"edgeType":"contains","source":12457,"target":2847},{"edgeType":"imports","source":1497,"target":795},{"edgeType":"contains","source":5711,"target":5851},{"edgeType":"contains","source":133,"target":134},{"edgeType":"contains","source":11165,"target":11189},{"edgeType":"contains","source":11826,"target":11838},{"edgeType":"contains","source":6508,"target":6513},{"edgeType":"contains","source":12618,"target":12655},{"edgeType":"contains","source":12553,"target":12556},{"edgeType":"calls","source":2167,"target":2196},{"edgeType":"contains","source":3037,"target":3131},{"edgeType":"contains","source":5107,"target":5553},{"edgeType":"contains","source":11108,"target":11899},{"edgeType":"calls","source":8973,"target":8954},{"edgeType":"contains","source":5223,"target":5128},{"edgeType":"contains","source":3237,"target":3271},{"edgeType":"contains","source":3238,"target":3240},{"edgeType":"imports","source":12204,"target":8177},{"edgeType":"contains","source":12521,"target":11432},{"edgeType":"imports","source":1672,"target":654},{"edgeType":"contains","source":12020,"target":11108},{"edgeType":"imports","source":1497,"target":794},{"edgeType":"contains","source":3961,"target":4082},{"edgeType":"calls","source":11297,"target":9842},{"edgeType":"contains","source":5716,"target":4640},{"edgeType":"contains","source":5711,"target":5852},{"edgeType":"contains","source":9848,"target":9732},{"edgeType":"contains","source":10538,"target":10540},{"edgeType":"calls","source":9511,"target":733},{"edgeType":"contains","source":3469,"target":3479},{"edgeType":"contains","source":7630,"target":7672},{"edgeType":"contains","source":8358,"target":8359},{"edgeType":"contains","source":3402,"target":3442},{"edgeType":"calls","source":2169,"target":2131},{"edgeType":"contains","source":792,"target":848},{"edgeType":"contains","source":11108,"target":11896},{"edgeType":"contains","source":4933,"target":4604},{"edgeType":"contains","source":8762,"target":9575},{"edgeType":"contains","source":12894,"target":13610},{"edgeType":"calls","source":4660,"target":4187},{"edgeType":"contains","source":7865,"target":7785},{"edgeType":"imports","source":1497,"target":793},{"edgeType":"imports","source":7583,"target":7676},{"edgeType":"contains","source":10069,"target":10281},{"edgeType":"calls","source":945,"target":967},{"edgeType":"calls","source":2366,"target":2367},{"edgeType":"contains","source":792,"target":847},{"edgeType":"contains","source":5711,"target":5853},{"edgeType":"contains","source":3440,"target":3320},{"edgeType":"contains","source":3436,"target":3444},{"edgeType":"contains","source":3469,"target":3478},{"edgeType":"contains","source":6508,"target":6515},{"edgeType":"calls","source":1837,"target":1854},{"edgeType":"calls","source":12299,"target":11549},{"edgeType":"contains","source":6968,"target":7053},{"edgeType":"calls","source":1345,"target":1345},{"edgeType":"calls","source":5456,"target":4978},{"edgeType":"contains","source":10569,"target":10617},{"edgeType":"imports","source":4185,"target":4191},{"edgeType":"contains","source":3037,"target":3102},{"edgeType":"contains","source":5883,"target":6839},{"edgeType":"contains","source":5961,"target":6535},{"edgeType":"calls","source":3426,"target":3428},{"edgeType":"contains","source":7992,"target":8054},{"edgeType":"contains","source":7993,"target":8023},{"edgeType":"contains","source":11108,"target":11878},{"edgeType":"contains","source":7729,"target":7751},{"edgeType":"contains","source":5746,"target":5801},{"edgeType":"contains","source":3566,"target":3616},{"edgeType":"contains","source":33,"target":35},{"edgeType":"contains","source":4179,"target":4697},{"edgeType":"calls","source":9210,"target":9108},{"edgeType":"contains","source":2609,"target":2628},{"edgeType":"contains","source":8197,"target":3814},{"edgeType":"contains","source":8787,"target":8778},{"edgeType":"calls","source":1884,"target":491},{"edgeType":"contains","source":4393,"target":4405},{"edgeType":"calls","source":6038,"target":5962},{"edgeType":"calls","source":684,"target":694},{"edgeType":"contains","source":429,"target":442},{"edgeType":"contains","source":5786,"target":4562},{"edgeType":"contains","source":5883,"target":6840},{"edgeType":"contains","source":7992,"target":8053},{"edgeType":"contains","source":7993,"target":8022},{"edgeType":"contains","source":5961,"target":6536},{"edgeType":"contains","source":9117,"target":9118},{"edgeType":"imports","source":2896,"target":2924},{"edgeType":"contains","source":13444,"target":13454},{"edgeType":"contains","source":6144,"target":6149},{"edgeType":"contains","source":7531,"target":7547},{"edgeType":"contains","source":8192,"target":8196},{"edgeType":"contains","source":33,"target":34},{"edgeType":"contains","source":6078,"target":6081},{"edgeType":"contains","source":4195,"target":4200},{"edgeType":"contains","source":4158,"target":4290},{"edgeType":"contains","source":5961,"target":6537},{"edgeType":"imports","source":1954,"target":1472},{"edgeType":"contains","source":8762,"target":9552},{"edgeType":"contains","source":2609,"target":2629},{"edgeType":"contains","source":853,"target":1039},{"edgeType":"calls","source":10059,"target":1814},{"edgeType":"contains","source":3152,"target":3763},{"edgeType":"contains","source":1144,"target":1535},{"edgeType":"contains","source":2350,"target":1142},{"edgeType":"contains","source":1218,"target":1355},{"edgeType":"imports","source":12436,"target":11617},{"edgeType":"contains","source":7036,"target":7038},{"edgeType":"contains","source":11108,"target":11876},{"edgeType":"contains","source":5520,"target":5410},{"edgeType":"contains","source":13444,"target":13453},{"edgeType":"imports","source":9467,"target":1118},{"edgeType":"contains","source":10238,"target":10306},{"edgeType":"contains","source":8762,"target":9555},{"edgeType":"calls","source":9244,"target":9113},{"edgeType":"contains","source":33,"target":37},{"edgeType":"calls","source":2534,"target":2538},{"edgeType":"contains","source":7992,"target":8057},{"edgeType":"contains","source":7993,"target":8026},{"edgeType":"contains","source":5961,"target":6538},{"edgeType":"contains","source":2609,"target":2626},{"edgeType":"imports","source":7127,"target":726},{"edgeType":"calls","source":7955,"target":7846},{"edgeType":"contains","source":5746,"target":5804},{"edgeType":"contains","source":4490,"target":4566},{"edgeType":"calls","source":9470,"target":9505},{"edgeType":"contains","source":12155,"target":12186},{"edgeType":"contains","source":7992,"target":8055},{"edgeType":"contains","source":7993,"target":8024},{"edgeType":"contains","source":7894,"target":7922},{"edgeType":"calls","source":12190,"target":11861},{"edgeType":"contains","source":6960,"target":7281},{"edgeType":"contains","source":7729,"target":7752},{"edgeType":"contains","source":11165,"target":11167},{"edgeType":"contains","source":11108,"target":11877},{"edgeType":"imports","source":2896,"target":2922},{"edgeType":"contains","source":5520,"target":5411},{"edgeType":"calls","source":6663,"target":6675},{"edgeType":"contains","source":13444,"target":13452},{"edgeType":"contains","source":33,"target":36},{"edgeType":"contains","source":6144,"target":6151},{"edgeType":"imports","source":9467,"target":1119},{"edgeType":"contains","source":8762,"target":9554},{"edgeType":"calls","source":9244,"target":9112},{"edgeType":"contains","source":2609,"target":2627},{"edgeType":"contains","source":7992,"target":8056},{"edgeType":"contains","source":7993,"target":8025},{"edgeType":"contains","source":6568,"target":6748},{"edgeType":"contains","source":1,"target":9487},{"edgeType":"contains","source":13444,"target":13451},{"edgeType":"contains","source":5883,"target":6835},{"edgeType":"calls","source":6198,"target":6284},{"edgeType":"contains","source":7992,"target":8050},{"edgeType":"calls","source":10396,"target":3000},{"edgeType":"imports","source":2350,"target":820},{"edgeType":"calls","source":12840,"target":12857},{"edgeType":"calls","source":1640,"target":652},{"edgeType":"contains","source":3204,"target":3214},{"edgeType":"imports","source":4185,"target":4195},{"edgeType":"contains","source":3237,"target":3248},{"edgeType":"calls","source":5004,"target":4187},{"edgeType":"contains","source":7531,"target":7542},{"edgeType":"calls","source":3414,"target":2739},{"edgeType":"calls","source":3095,"target":3114},{"edgeType":"contains","source":7729,"target":7747},{"edgeType":"contains","source":1287,"target":1333},{"edgeType":"contains","source":33,"target":39},{"edgeType":"contains","source":6342,"target":6348},{"edgeType":"contains","source":8192,"target":8193},{"edgeType":"calls","source":11888,"target":11714},{"edgeType":"calls","source":7258,"target":7258},{"edgeType":"contains","source":12255,"target":12257},{"edgeType":"contains","source":6908,"target":429},{"edgeType":"contains","source":10782,"target":10352},{"edgeType":"contains","source":8762,"target":9549},{"edgeType":"contains","source":5883,"target":6836},{"edgeType":"contains","source":7992,"target":8049},{"edgeType":"contains","source":7993,"target":8018},{"edgeType":"contains","source":13444,"target":13450},{"edgeType":"calls","source":3426,"target":3425},{"edgeType":"calls","source":4801,"target":4137},{"edgeType":"calls","source":12710,"target":12658},{"edgeType":"contains","source":1218,"target":1356},{"edgeType":"contains","source":9826,"target":8278},{"edgeType":"calls","source":8278,"target":8407},{"edgeType":"calls","source":12384,"target":568},{"edgeType":"contains","source":7727,"target":7808},{"edgeType":"contains","source":1287,"target":1334},{"edgeType":"contains","source":7630,"target":7644},{"edgeType":"contains","source":11108,"target":11874},{"edgeType":"contains","source":6342,"target":6349},{"edgeType":"contains","source":33,"target":38},{"edgeType":"calls","source":8976,"target":8966},{"edgeType":"calls","source":9635,"target":9677},{"edgeType":"contains","source":792,"target":820},{"edgeType":"contains","source":899,"target":674},{"edgeType":"contains","source":4179,"target":4700},{"edgeType":"contains","source":429,"target":446},{"edgeType":"contains","source":12713,"target":12856},{"edgeType":"contains","source":13444,"target":13449},{"edgeType":"contains","source":5883,"target":6837},{"edgeType":"calls","source":6663,"target":6678},{"edgeType":"calls","source":2732,"target":2738},{"edgeType":"calls","source":6795,"target":6814},{"edgeType":"contains","source":7992,"target":8052},{"edgeType":"contains","source":7993,"target":8021},{"edgeType":"calls","source":4752,"target":4598},{"edgeType":"calls","source":4794,"target":4353},{"edgeType":"contains","source":7729,"target":7749},{"edgeType":"contains","source":1144,"target":1539},{"edgeType":"contains","source":5746,"target":5799},{"edgeType":"calls","source":3294,"target":3286},{"edgeType":"calls","source":10462,"target":10469},{"edgeType":"contains","source":1287,"target":1331},{"edgeType":"calls","source":9081,"target":8885},{"edgeType":"contains","source":8192,"target":8195},{"edgeType":"calls","source":8945,"target":8873},{"edgeType":"contains","source":8762,"target":9551},{"edgeType":"contains","source":33,"target":41},{"edgeType":"calls","source":2678,"target":1241},{"edgeType":"calls","source":7811,"target":687},{"edgeType":"contains","source":2609,"target":2630},{"edgeType":"contains","source":10699,"target":10809},{"edgeType":"contains","source":5883,"target":6838},{"edgeType":"contains","source":7992,"target":8051},{"edgeType":"contains","source":7993,"target":8020},{"edgeType":"calls","source":2073,"target":2027},{"edgeType":"contains","source":13444,"target":13448},{"edgeType":"calls","source":2732,"target":2739},{"edgeType":"contains","source":5961,"target":6534},{"edgeType":"calls","source":6730,"target":6716},{"edgeType":"contains","source":11328,"target":10338},{"edgeType":"calls","source":2865,"target":2844},{"edgeType":"calls","source":4852,"target":4668},{"edgeType":"calls","source":5816,"target":4381},{"edgeType":"imports","source":10037,"target":9878},{"edgeType":"contains","source":1205,"target":1761},{"edgeType":"contains","source":1218,"target":1358},{"edgeType":"calls","source":3414,"target":2738},{"edgeType":"contains","source":6902,"target":6960},{"edgeType":"contains","source":8192,"target":8194},{"edgeType":"calls","source":2567,"target":2569},{"edgeType":"calls","source":6085,"target":270},{"edgeType":"contains","source":6078,"target":6079},{"edgeType":"contains","source":11233,"target":11168},{"edgeType":"calls","source":4748,"target":4721},{"edgeType":"calls","source":519,"target":522},{"edgeType":"calls","source":2018,"target":562},{"edgeType":"calls","source":9640,"target":9524},{"edgeType":"imports","source":9041,"target":9044},{"edgeType":"contains","source":10699,"target":10810},{"edgeType":"contains","source":10698,"target":10841},{"edgeType":"calls","source":4945,"target":4955},{"edgeType":"contains","source":7037,"target":7013},{"edgeType":"contains","source":1585,"target":1612},{"edgeType":"contains","source":10301,"target":10477},{"edgeType":"contains","source":7356,"target":2409},{"edgeType":"calls","source":3062,"target":3076},{"edgeType":"calls","source":1640,"target":648},{"edgeType":"contains","source":1287,"target":1337},{"edgeType":"contains","source":5223,"target":5109},{"edgeType":"contains","source":8938,"target":9391},{"edgeType":"contains","source":1218,"target":1361},{"edgeType":"contains","source":8762,"target":9561},{"edgeType":"contains","source":13444,"target":13463},{"edgeType":"contains","source":33,"target":43},{"edgeType":"contains","source":55,"target":418},{"edgeType":"contains","source":3799,"target":3801},{"edgeType":"calls","source":8910,"target":8903},{"edgeType":"contains","source":7928,"target":7933},{"edgeType":"contains","source":7729,"target":7758},{"edgeType":"contains","source":10702,"target":1218},{"edgeType":"contains","source":11108,"target":11887},{"edgeType":"calls","source":2171,"target":1101},{"edgeType":"contains","source":7629,"target":7687},{"edgeType":"contains","source":1585,"target":1613},{"edgeType":"calls","source":9079,"target":491},{"edgeType":"contains","source":1287,"target":1338},{"edgeType":"contains","source":1144,"target":1540},{"edgeType":"contains","source":10868,"target":10871},{"edgeType":"imports","source":12538,"target":11617},{"edgeType":"calls","source":1986,"target":491},{"edgeType":"calls","source":7088,"target":3020},{"edgeType":"contains","source":8762,"target":9560},{"edgeType":"calls","source":7568,"target":7166},{"edgeType":"contains","source":13444,"target":13462},{"edgeType":"imports","source":12150,"target":12018},{"edgeType":"imports","source":7853,"target":7809},{"edgeType":"contains","source":7862,"target":7864},{"edgeType":"contains","source":1,"target":3148},{"edgeType":"calls","source":6180,"target":4722},{"edgeType":"contains","source":33,"target":42},{"edgeType":"calls","source":763,"target":351},{"edgeType":"contains","source":7928,"target":7932},{"edgeType":"contains","source":7629,"target":7690},{"edgeType":"contains","source":11108,"target":11884},{"edgeType":"contains","source":6203,"target":6443},{"edgeType":"contains","source":11266,"target":11214},{"edgeType":"calls","source":1609,"target":1611},{"edgeType":"calls","source":7819,"target":7843},{"edgeType":"contains","source":6739,"target":6740},{"edgeType":"contains","source":1287,"target":1335},{"edgeType":"contains","source":8762,"target":9564},{"edgeType":"calls","source":11821,"target":11679},{"edgeType":"contains","source":12254,"target":12298},{"edgeType":"calls","source":1873,"target":1883},{"edgeType":"calls","source":11685,"target":11667},{"edgeType":"contains","source":13444,"target":13461},{"edgeType":"contains","source":7729,"target":7762},{"edgeType":"contains","source":33,"target":45},{"edgeType":"calls","source":2897,"target":2905},{"edgeType":"contains","source":9809,"target":9872},{"edgeType":"contains","source":7729,"target":7760},{"edgeType":"contains","source":6203,"target":6444},{"edgeType":"calls","source":10903,"target":8427},{"edgeType":"calls","source":12353,"target":12101},{"edgeType":"calls","source":1786,"target":351},{"edgeType":"contains","source":8787,"target":8788},{"edgeType":"contains","source":8938,"target":9392},{"edgeType":"calls","source":12390,"target":2498},{"edgeType":"contains","source":1144,"target":1542},{"edgeType":"contains","source":1218,"target":1362},{"edgeType":"calls","source":4650,"target":4584},{"edgeType":"calls","source":11821,"target":11680},{"edgeType":"calls","source":5337,"target":4427},{"edgeType":"calls","source":3870,"target":3396},{"edgeType":"contains","source":13444,"target":13460},{"edgeType":"contains","source":33,"target":44},{"edgeType":"contains","source":3865,"target":3866},{"edgeType":"contains","source":6144,"target":6159},{"edgeType":"contains","source":7531,"target":7557},{"edgeType":"contains","source":7928,"target":7934},{"edgeType":"contains","source":7729,"target":7761},{"edgeType":"imports","source":4185,"target":4187},{"edgeType":"contains","source":5746,"target":5805},{"edgeType":"imports","source":1954,"target":1477},{"edgeType":"contains","source":4197,"target":4151},{"edgeType":"contains","source":4157,"target":4334},{"edgeType":"calls","source":9373,"target":9352},{"edgeType":"imports","source":1954,"target":420},{"edgeType":"contains","source":1585,"target":1616},{"edgeType":"calls","source":5091,"target":4653},{"edgeType":"contains","source":12617,"target":12670},{"edgeType":"contains","source":7729,"target":7755},{"edgeType":"contains","source":13444,"target":13459},{"edgeType":"contains","source":1287,"target":1341},{"edgeType":"contains","source":5107,"target":5538},{"edgeType":"contains","source":8938,"target":9387},{"edgeType":"contains","source":6960,"target":7282},{"edgeType":"contains","source":899,"target":684},{"edgeType":"contains","source":11108,"target":11882},{"edgeType":"contains","source":5223,"target":5113},{"edgeType":"imports","source":8103,"target":1119},{"edgeType":"contains","source":7531,"target":7550},{"edgeType":"imports","source":12355,"target":12000},{"edgeType":"contains","source":5883,"target":6844},{"edgeType":"calls","source":7392,"target":7340},{"edgeType":"contains","source":1585,"target":1617},{"edgeType":"contains","source":7992,"target":8059},{"edgeType":"contains","source":7993,"target":8028},{"edgeType":"contains","source":10304,"target":10380},{"edgeType":"contains","source":7928,"target":7929},{"edgeType":"contains","source":33,"target":47},{"edgeType":"calls","source":10760,"target":10752},{"edgeType":"imports","source":12553,"target":12205},{"edgeType":"calls","source":1676,"target":1641},{"edgeType":"contains","source":11294,"target":10345},{"edgeType":"calls","source":5144,"target":5123},{"edgeType":"calls","source":11396,"target":11120},{"edgeType":"imports","source":11423,"target":2845},{"edgeType":"contains","source":5746,"target":5806},{"edgeType":"contains","source":1287,"target":1342},{"edgeType":"calls","source":5917,"target":5472},{"edgeType":"calls","source":1446,"target":1372},{"edgeType":"contains","source":13444,"target":13458},{"edgeType":"contains","source":1,"target":8437},{"edgeType":"contains","source":7993,"target":8027},{"edgeType":"contains","source":10304,"target":10381},{"edgeType":"calls","source":2535,"target":2498},{"edgeType":"contains","source":1,"target":3152},{"edgeType":"contains","source":33,"target":46},{"edgeType":"contains","source":6203,"target":6438},{"edgeType":"calls","source":6929,"target":6896},{"edgeType":"contains","source":7729,"target":7757},{"edgeType":"contains","source":9809,"target":9867},{"edgeType":"contains","source":1585,"target":1614},{"edgeType":"contains","source":8938,"target":9389},{"edgeType":"contains","source":13444,"target":13457},{"edgeType":"contains","source":6871,"target":6872},{"edgeType":"contains","source":1007,"target":1566},{"edgeType":"contains","source":11108,"target":11880},{"edgeType":"calls","source":8216,"target":8224},{"edgeType":"contains","source":1,"target":13725},{"edgeType":"imports","source":1672,"target":704},{"edgeType":"calls","source":10379,"target":9879},{"edgeType":"contains","source":1218,"target":1367},{"edgeType":"calls","source":5471,"target":270},{"edgeType":"contains","source":7928,"target":7931},{"edgeType":"contains","source":7992,"target":8061},{"edgeType":"contains","source":7993,"target":8030},{"edgeType":"contains","source":12617,"target":12667},{"edgeType":"contains","source":1585,"target":1615},{"edgeType":"contains","source":5746,"target":5808},{"edgeType":"contains","source":12713,"target":12862},{"edgeType":"contains","source":8950,"target":9016},{"edgeType":"contains","source":1287,"target":1340},{"edgeType":"contains","source":13444,"target":13456},{"edgeType":"contains","source":3898,"target":3904},{"edgeType":"contains","source":8762,"target":9558},{"edgeType":"imports","source":8103,"target":1118},{"edgeType":"calls","source":8278,"target":8417},{"edgeType":"contains","source":6574,"target":6566},{"edgeType":"contains","source":7928,"target":7930},{"edgeType":"calls","source":10462,"target":10476},{"edgeType":"contains","source":12090,"target":12092},{"edgeType":"contains","source":6276,"target":6291},{"edgeType":"calls","source":11351,"target":3000},{"edgeType":"contains","source":12185,"target":7033},{"edgeType":"contains","source":4131,"target":5137},{"edgeType":"contains","source":7992,"target":8060},{"edgeType":"contains","source":7993,"target":8029},{"edgeType":"contains","source":6078,"target":6087},{"edgeType":"contains","source":10141,"target":10147},{"edgeType":"calls","source":7158,"target":7166},{"edgeType":"contains","source":10304,"target":10359},{"edgeType":"contains","source":10239,"target":10260},{"edgeType":"contains","source":4028,"target":4076},{"edgeType":"contains","source":8852,"target":8861},{"edgeType":"imports","source":12551,"target":12262},{"edgeType":"calls","source":6366,"target":6349},{"edgeType":"contains","source":853,"target":1024},{"edgeType":"calls","source":7953,"target":491},{"edgeType":"contains","source":10456,"target":9875},{"edgeType":"calls","source":7533,"target":7168},{"edgeType":"calls","source":1279,"target":1293},{"edgeType":"contains","source":3037,"target":3085},{"edgeType":"calls","source":558,"target":390},{"edgeType":"contains","source":1144,"target":1516},{"edgeType":"contains","source":1218,"target":1336},{"edgeType":"contains","source":5961,"target":6519},{"edgeType":"calls","source":10298,"target":10245},{"edgeType":"contains","source":5107,"target":5509},{"edgeType":"contains","source":7992,"target":8038},{"edgeType":"contains","source":9852,"target":10630},{"edgeType":"contains","source":7729,"target":7735},{"edgeType":"contains","source":7630,"target":7633},{"edgeType":"calls","source":4881,"target":4850},{"edgeType":"contains","source":9507,"target":9696},{"edgeType":"contains","source":10239,"target":10261},{"edgeType":"calls","source":1784,"target":436},{"edgeType":"imports","source":7128,"target":7018},{"edgeType":"contains","source":8852,"target":8860},{"edgeType":"calls","source":7294,"target":7179},{"edgeType":"contains","source":2269,"target":2582},{"edgeType":"contains","source":4591,"target":4592},{"edgeType":"calls","source":3925,"target":3832},{"edgeType":"contains","source":10304,"target":10360},{"edgeType":"calls","source":5904,"target":5904},{"edgeType":"calls","source":4752,"target":4620},{"edgeType":"calls","source":12556,"target":2614},{"edgeType":"contains","source":7385,"target":429},{"edgeType":"contains","source":5107,"target":5508},{"edgeType":"imports","source":12178,"target":568},{"edgeType":"contains","source":11108,"target":11862},{"edgeType":"calls","source":2965,"target":2938},{"edgeType":"contains","source":7630,"target":7632},{"edgeType":"calls","source":998,"target":490},{"edgeType":"contains","source":9507,"target":9695},{"edgeType":"calls","source":5147,"target":5058},{"edgeType":"calls","source":12676,"target":12633},{"edgeType":"contains","source":3566,"target":3597},{"edgeType":"contains","source":8950,"target":8996},{"edgeType":"imports","source":12553,"target":10088},{"edgeType":"calls","source":4493,"target":4191},{"edgeType":"contains","source":5961,"target":6521},{"edgeType":"contains","source":7992,"target":8040},{"edgeType":"contains","source":7993,"target":8009},{"edgeType":"contains","source":2741,"target":2746},{"edgeType":"calls","source":6069,"target":6073},{"edgeType":"calls","source":11882,"target":11878},{"edgeType":"contains","source":12617,"target":12647},{"edgeType":"calls","source":8909,"target":8911},{"edgeType":"calls","source":13071,"target":13073},{"edgeType":"contains","source":1144,"target":1518},{"edgeType":"contains","source":9809,"target":9847},{"edgeType":"calls","source":4493,"target":4190},{"edgeType":"calls","source":998,"target":492},{"edgeType":"contains","source":10301,"target":10451},{"edgeType":"imports","source":11423,"target":9173},{"edgeType":"contains","source":55,"target":394},{"edgeType":"calls","source":2374,"target":1173},{"edgeType":"contains","source":1510,"target":1797},{"edgeType":"imports","source":13766,"target":1026},{"edgeType":"calls","source":7443,"target":448},{"edgeType":"calls","source":2204,"target":2215},{"edgeType":"calls","source":2230,"target":1409},{"edgeType":"contains","source":853,"target":1025},{"edgeType":"contains","source":561,"target":564},{"edgeType":"contains","source":5107,"target":5506},{"edgeType":"contains","source":8678,"target":8971},{"edgeType":"calls","source":6033,"target":6131},{"edgeType":"contains","source":2741,"target":2747},{"edgeType":"contains","source":8555,"target":8556},{"edgeType":"imports","source":12901,"target":13042},{"edgeType":"contains","source":9852,"target":10629},{"edgeType":"contains","source":4490,"target":4549},{"edgeType":"calls","source":2670,"target":454},{"edgeType":"imports","source":2314,"target":864},{"edgeType":"contains","source":4028,"target":4073},{"edgeType":"contains","source":7630,"target":7634},{"edgeType":"contains","source":9507,"target":9697},{"edgeType":"calls","source":1028,"target":619},{"edgeType":"contains","source":4028,"target":4080},{"edgeType":"calls","source":4522,"target":4347},{"edgeType":"contains","source":8938,"target":9362},{"edgeType":"contains","source":8523,"target":1086},{"edgeType":"contains","source":10239,"target":10256},{"edgeType":"contains","source":11108,"target":11857},{"edgeType":"contains","source":2609,"target":2616},{"edgeType":"contains","source":396,"target":397},{"edgeType":"contains","source":10698,"target":10825},{"edgeType":"contains","source":12750,"target":12751},{"edgeType":"contains","source":5883,"target":6819},{"edgeType":"calls","source":4786,"target":4620},{"edgeType":"calls","source":8909,"target":8913},{"edgeType":"contains","source":9507,"target":9692},{"edgeType":"calls","source":3062,"target":3097},{"edgeType":"contains","source":3402,"target":3403},{"edgeType":"calls","source":2500,"target":436},{"edgeType":"imports","source":7128,"target":7022},{"edgeType":"calls","source":11531,"target":568},{"edgeType":"calls","source":6931,"target":6809},{"edgeType":"contains","source":2839,"target":2886},{"edgeType":"contains","source":4591,"target":4596},{"edgeType":"calls","source":6198,"target":6299},{"edgeType":"contains","source":5883,"target":6820},{"edgeType":"imports","source":1497,"target":820},{"edgeType":"contains","source":10237,"target":2920},{"edgeType":"contains","source":1585,"target":1593},{"edgeType":"imports","source":2244,"target":918},{"edgeType":"calls","source":2658,"target":824},{"edgeType":"contains","source":5221,"target":5149},{"edgeType":"contains","source":11108,"target":11855},{"edgeType":"contains","source":561,"target":569},{"edgeType":"calls","source":11055,"target":11093},{"edgeType":"contains","source":8852,"target":8859},{"edgeType":"contains","source":10569,"target":10594},{"edgeType":"contains","source":396,"target":399},{"edgeType":"calls","source":2365,"target":390},{"edgeType":"calls","source":755,"target":623},{"edgeType":"contains","source":5711,"target":5811},{"edgeType":"contains","source":10238,"target":10285},{"edgeType":"contains","source":7729,"target":7733},{"edgeType":"calls","source":817,"target":815},{"edgeType":"contains","source":5746,"target":5783},{"edgeType":"contains","source":7630,"target":7631},{"edgeType":"calls","source":12247,"target":568},{"edgeType":"calls","source":7553,"target":7613},{"edgeType":"contains","source":12894,"target":13569},{"edgeType":"contains","source":5107,"target":5510},{"edgeType":"calls","source":12707,"target":12733},{"edgeType":"calls","source":949,"target":950},{"edgeType":"calls","source":982,"target":984},{"edgeType":"calls","source":3396,"target":3312},{"edgeType":"contains","source":9809,"target":9844},{"edgeType":"contains","source":7727,"target":7794},{"edgeType":"calls","source":3283,"target":1530},{"edgeType":"calls","source":6009,"target":5813},{"edgeType":"contains","source":7333,"target":7334},{"edgeType":"calls","source":3200,"target":1986},{"edgeType":"contains","source":13444,"target":13447},{"edgeType":"contains","source":12280,"target":12534},{"edgeType":"calls","source":4754,"target":4550},{"edgeType":"calls","source":8844,"target":8818},{"edgeType":"calls","source":354,"target":363},{"edgeType":"calls","source":7399,"target":7103},{"edgeType":"contains","source":7993,"target":8015},{"edgeType":"contains","source":6342,"target":6344},{"edgeType":"contains","source":1585,"target":1596},{"edgeType":"contains","source":8324,"target":8325},{"edgeType":"calls","source":1676,"target":1662},{"edgeType":"contains","source":6968,"target":7021},{"edgeType":"contains","source":5408,"target":414},{"edgeType":"calls","source":3195,"target":3199},{"edgeType":"calls","source":3162,"target":3165},{"edgeType":"contains","source":12280,"target":12533},{"edgeType":"contains","source":13444,"target":13446},{"edgeType":"contains","source":396,"target":400},{"edgeType":"imports","source":5835,"target":5868},{"edgeType":"calls","source":7092,"target":7107},{"edgeType":"calls","source":7459,"target":7358},{"edgeType":"calls","source":4527,"target":4187},{"edgeType":"contains","source":7729,"target":7742},{"edgeType":"contains","source":6342,"target":6345},{"edgeType":"calls","source":4220,"target":4191},{"edgeType":"contains","source":4393,"target":4396},{"edgeType":"calls","source":1771,"target":830},{"edgeType":"contains","source":3492,"target":3787},{"edgeType":"contains","source":12617,"target":12657},{"edgeType":"contains","source":5107,"target":5516},{"edgeType":"calls","source":3395,"target":3341},{"edgeType":"contains","source":3335,"target":3367},{"edgeType":"contains","source":7992,"target":8048},{"edgeType":"contains","source":7993,"target":8017},{"edgeType":"calls","source":8950,"target":8705},{"edgeType":"contains","source":6568,"target":6739},{"edgeType":"contains","source":12280,"target":12532},{"edgeType":"calls","source":3195,"target":3196},{"edgeType":"contains","source":561,"target":573},{"edgeType":"contains","source":11547,"target":12000},{"edgeType":"contains","source":13444,"target":13445},{"edgeType":"calls","source":6000,"target":5033},{"edgeType":"calls","source":2024,"target":390},{"edgeType":"contains","source":12059,"target":11984},{"edgeType":"contains","source":5746,"target":5795},{"edgeType":"contains","source":8111,"target":8587},{"edgeType":"contains","source":2345,"target":2346},{"edgeType":"contains","source":5883,"target":6833},{"edgeType":"contains","source":853,"target":1034},{"edgeType":"calls","source":7982,"target":8058},{"edgeType":"calls","source":753,"target":681},{"edgeType":"calls","source":4324,"target":4137},{"edgeType":"calls","source":7955,"target":7838},{"edgeType":"contains","source":11259,"target":11414},{"edgeType":"calls","source":12412,"target":12368},{"edgeType":"imports","source":12551,"target":12256},{"edgeType":"contains","source":4028,"target":4081},{"edgeType":"contains","source":5961,"target":6530},{"edgeType":"contains","source":12254,"target":12280},{"edgeType":"contains","source":12280,"target":12531},{"edgeType":"contains","source":396,"target":402},{"edgeType":"contains","source":7531,"target":7541},{"edgeType":"contains","source":5883,"target":6834},{"edgeType":"contains","source":7993,"target":8016},{"edgeType":"contains","source":1585,"target":1595},{"edgeType":"contains","source":5107,"target":5514},{"edgeType":"contains","source":11108,"target":11868},{"edgeType":"calls","source":6663,"target":6667},{"edgeType":"calls","source":12674,"target":12703},{"edgeType":"calls","source":1279,"target":1286},{"edgeType":"contains","source":3566,"target":3605},{"edgeType":"contains","source":10699,"target":10806},{"edgeType":"calls","source":3691,"target":3676},{"edgeType":"contains","source":1354,"target":1357},{"edgeType":"contains","source":3402,"target":3404},{"edgeType":"calls","source":10411,"target":409},{"edgeType":"contains","source":1218,"target":1345},{"edgeType":"contains","source":12254,"target":12279},{"edgeType":"calls","source":11365,"target":436},{"edgeType":"contains","source":12280,"target":12530},{"edgeType":"contains","source":2609,"target":2624},{"edgeType":"calls","source":3398,"target":3243},{"edgeType":"contains","source":4490,"target":4565},{"edgeType":"imports","source":9143,"target":9030},{"edgeType":"contains","source":1,"target":9479},{"edgeType":"contains","source":5883,"target":6827},{"edgeType":"contains","source":2350,"target":1140},{"edgeType":"calls","source":12510,"target":12508},{"edgeType":"contains","source":7992,"target":8042},{"edgeType":"contains","source":10304,"target":10363},{"edgeType":"calls","source":4630,"target":4162},{"edgeType":"contains","source":9848,"target":9701},{"edgeType":"contains","source":1,"target":3137},{"edgeType":"contains","source":853,"target":1036},{"edgeType":"contains","source":9809,"target":9853},{"edgeType":"calls","source":988,"target":789},{"edgeType":"contains","source":7729,"target":7739},{"edgeType":"calls","source":12146,"target":12164},{"edgeType":"calls","source":5639,"target":5651},{"edgeType":"contains","source":11108,"target":11865},{"edgeType":"calls","source":8950,"target":8706},{"edgeType":"contains","source":396,"target":404},{"edgeType":"contains","source":7531,"target":7535},{"edgeType":"contains","source":10782,"target":10345},{"edgeType":"contains","source":429,"target":438},{"edgeType":"contains","source":561,"target":574},{"edgeType":"contains","source":5883,"target":6828},{"edgeType":"contains","source":7992,"target":8041},{"edgeType":"calls","source":12578,"target":12515},{"edgeType":"calls","source":915,"target":936},{"edgeType":"calls","source":1640,"target":1716},{"edgeType":"contains","source":3566,"target":3611},{"edgeType":"contains","source":4261,"target":4264},{"edgeType":"contains","source":4195,"target":4196},{"edgeType":"contains","source":853,"target":1035},{"edgeType":"contains","source":7729,"target":7738},{"edgeType":"contains","source":12519,"target":12520},{"edgeType":"contains","source":10438,"target":10439},{"edgeType":"calls","source":3095,"target":3124},{"edgeType":"calls","source":3101,"target":2938},{"edgeType":"calls","source":8359,"target":602},{"edgeType":"contains","source":12750,"target":12758},{"edgeType":"contains","source":1144,"target":1527},{"edgeType":"contains","source":3237,"target":3238},{"edgeType":"calls","source":12380,"target":12308},{"edgeType":"contains","source":7531,"target":7536},{"edgeType":"calls","source":12543,"target":12540},{"edgeType":"calls","source":1028,"target":608},{"edgeType":"calls","source":1015,"target":1011},{"edgeType":"calls","source":6663,"target":6670},{"edgeType":"imports","source":9953,"target":8230},{"edgeType":"contains","source":4195,"target":4194},{"edgeType":"contains","source":7993,"target":8013},{"edgeType":"contains","source":12394,"target":11108},{"edgeType":"contains","source":55,"target":408},{"edgeType":"contains","source":4261,"target":4263},{"edgeType":"contains","source":7729,"target":7741},{"edgeType":"contains","source":1,"target":3139},{"edgeType":"calls","source":12675,"target":12677},{"edgeType":"calls","source":6615,"target":6044},{"edgeType":"contains","source":9848,"target":9699},{"edgeType":"contains","source":12750,"target":12757},{"edgeType":"contains","source":12653,"target":12593},{"edgeType":"contains","source":11108,"target":11863},{"edgeType":"contains","source":11738,"target":1846},{"edgeType":"contains","source":853,"target":1038},{"edgeType":"calls","source":5871,"target":5856},{"edgeType":"contains","source":8762,"target":9542},{"edgeType":"calls","source":7423,"target":7423},{"edgeType":"calls","source":6267,"target":6264},{"edgeType":"calls","source":7027,"target":7014},{"edgeType":"imports","source":9664,"target":7676},{"edgeType":"contains","source":10304,"target":10362},{"edgeType":"contains","source":55,"target":406},{"edgeType":"contains","source":12254,"target":12276},{"edgeType":"contains","source":10569,"target":10604},{"edgeType":"calls","source":11333,"target":10941},{"edgeType":"contains","source":10702,"target":10709},{"edgeType":"calls","source":7954,"target":7874},{"edgeType":"contains","source":853,"target":1037},{"edgeType":"contains","source":1089,"target":1091},{"edgeType":"contains","source":4490,"target":4536},{"edgeType":"contains","source":10698,"target":10813},{"edgeType":"contains","source":12617,"target":12633},{"edgeType":"contains","source":5086,"target":5087},{"edgeType":"contains","source":5107,"target":5493},{"edgeType":"contains","source":3298,"target":3434},{"edgeType":"contains","source":10032,"target":2919},{"edgeType":"contains","source":4028,"target":4059},{"edgeType":"contains","source":11461,"target":11472},{"edgeType":"imports","source":12150,"target":12058},{"edgeType":"calls","source":11607,"target":1362},{"edgeType":"contains","source":98,"target":101},{"edgeType":"contains","source":10238,"target":10275},{"edgeType":"contains","source":4028,"target":4060},{"edgeType":"contains","source":1287,"target":1296},{"edgeType":"calls","source":7723,"target":7604},{"edgeType":"contains","source":12203,"target":11726},{"edgeType":"contains","source":12555,"target":12441},{"edgeType":"contains","source":12254,"target":12259},{"edgeType":"calls","source":7753,"target":7731},{"edgeType":"contains","source":10569,"target":10584},{"edgeType":"calls","source":11851,"target":11767},{"edgeType":"contains","source":428,"target":440},{"edgeType":"calls","source":11659,"target":9264},{"edgeType":"contains","source":10569,"target":10585},{"edgeType":"contains","source":1089,"target":1090},{"edgeType":"contains","source":3298,"target":3435},{"edgeType":"calls","source":4647,"target":4654},{"edgeType":"imports","source":2350,"target":856},{"edgeType":"contains","source":4028,"target":4058},{"edgeType":"contains","source":11098,"target":11099},{"edgeType":"contains","source":98,"target":100},{"edgeType":"calls","source":2498,"target":2567},{"edgeType":"imports","source":3763,"target":3566},{"edgeType":"calls","source":2482,"target":949},{"edgeType":"contains","source":885,"target":3185},{"edgeType":"contains","source":8455,"target":8466},{"edgeType":"contains","source":12155,"target":12156},{"edgeType":"contains","source":10698,"target":10811},{"edgeType":"contains","source":3137,"target":3138},{"edgeType":"contains","source":5786,"target":4530},{"edgeType":"contains","source":885,"target":3189},{"edgeType":"contains","source":5342,"target":320},{"edgeType":"contains","source":4028,"target":4057},{"edgeType":"imports","source":2350,"target":855},{"edgeType":"contains","source":10032,"target":2917},{"edgeType":"calls","source":11179,"target":3000},{"edgeType":"calls","source":9869,"target":9788},{"edgeType":"contains","source":10338,"target":10344},{"edgeType":"contains","source":6868,"target":6927},{"edgeType":"contains","source":7072,"target":603},{"edgeType":"contains","source":98,"target":103},{"edgeType":"contains","source":55,"target":379},{"edgeType":"calls","source":2498,"target":2564},{"edgeType":"contains","source":4128,"target":4129},{"edgeType":"contains","source":6902,"target":6930},{"edgeType":"contains","source":5107,"target":5490},{"edgeType":"contains","source":885,"target":3188},{"edgeType":"contains","source":8388,"target":8432},{"edgeType":"contains","source":8006,"target":4417},{"edgeType":"calls","source":650,"target":660},{"edgeType":"contains","source":1089,"target":1092},{"edgeType":"contains","source":3298,"target":3433},{"edgeType":"contains","source":9809,"target":9831},{"edgeType":"contains","source":4028,"target":4056},{"edgeType":"contains","source":7727,"target":7781},{"edgeType":"contains","source":11461,"target":11471},{"edgeType":"contains","source":8401,"target":2743},{"edgeType":"contains","source":6043,"target":6078},{"edgeType":"contains","source":98,"target":102},{"edgeType":"contains","source":11108,"target":11843},{"edgeType":"contains","source":8700,"target":1930},{"edgeType":"contains","source":10592,"target":9870},{"edgeType":"contains","source":630,"target":522},{"edgeType":"contains","source":12617,"target":12630},{"edgeType":"contains","source":3037,"target":3073},{"edgeType":"calls","source":11111,"target":3000},{"edgeType":"contains","source":11461,"target":11468},{"edgeType":"contains","source":5107,"target":5497},{"edgeType":"calls","source":2741,"target":1371},{"edgeType":"contains","source":3566,"target":3587},{"edgeType":"contains","source":6141,"target":6203},{"edgeType":"contains","source":5710,"target":5823},{"edgeType":"contains","source":5883,"target":6802},{"edgeType":"contains","source":4028,"target":4064},{"edgeType":"contains","source":1287,"target":1300},{"edgeType":"contains","source":10338,"target":10342},{"edgeType":"calls","source":6299,"target":6300},{"edgeType":"contains","source":6374,"target":6380},{"edgeType":"contains","source":98,"target":105},{"edgeType":"contains","source":6407,"target":6414},{"edgeType":"contains","source":12254,"target":12255},{"edgeType":"contains","source":4179,"target":4668},{"edgeType":"calls","source":7290,"target":7290},{"edgeType":"contains","source":2219,"target":2005},{"edgeType":"contains","source":7125,"target":7410},{"edgeType":"contains","source":5107,"target":5496},{"edgeType":"contains","source":5883,"target":6803},{"edgeType":"contains","source":885,"target":3190},{"edgeType":"calls","source":2864,"target":2844},{"edgeType":"contains","source":1089,"target":1094},{"edgeType":"calls","source":8032,"target":7544},{"edgeType":"calls","source":8382,"target":3036},{"edgeType":"calls","source":1641,"target":1644},{"edgeType":"contains","source":11461,"target":11469},{"edgeType":"calls","source":1161,"target":668},{"edgeType":"contains","source":10338,"target":10343},{"edgeType":"calls","source":11155,"target":10094},{"edgeType":"contains","source":6374,"target":6381},{"edgeType":"contains","source":10239,"target":10241},{"edgeType":"contains","source":4028,"target":4063},{"edgeType":"contains","source":98,"target":104},{"edgeType":"contains","source":7125,"target":7411},{"edgeType":"contains","source":6407,"target":6415},{"edgeType":"contains","source":12280,"target":12505},{"edgeType":"contains","source":4490,"target":4539},{"edgeType":"contains","source":5883,"target":6804},{"edgeType":"contains","source":11461,"target":11466},{"edgeType":"contains","source":1,"target":6285},{"edgeType":"calls","source":650,"target":657},{"edgeType":"calls","source":12412,"target":12348},{"edgeType":"calls","source":12410,"target":11353},{"edgeType":"imports","source":3763,"target":3571},{"edgeType":"imports","source":1797,"target":2139},{"edgeType":"calls","source":4620,"target":4429},{"edgeType":"contains","source":10338,"target":10340},{"edgeType":"contains","source":4028,"target":4062},{"edgeType":"contains","source":98,"target":107},{"edgeType":"contains","source":8455,"target":8465},{"edgeType":"contains","source":7125,"target":7412},{"edgeType":"contains","source":6374,"target":6382},{"edgeType":"contains","source":4490,"target":4538},{"edgeType":"contains","source":7125,"target":7414},{"edgeType":"contains","source":9852,"target":10608},{"edgeType":"contains","source":9488,"target":9209},{"edgeType":"contains","source":1218,"target":1325},{"edgeType":"contains","source":9809,"target":9827},{"edgeType":"contains","source":3566,"target":3584},{"edgeType":"contains","source":7630,"target":7613},{"edgeType":"contains","source":4028,"target":4061},{"edgeType":"contains","source":10338,"target":10341},{"edgeType":"calls","source":5872,"target":5783},{"edgeType":"calls","source":8947,"target":8777},{"edgeType":"contains","source":10569,"target":10579},{"edgeType":"contains","source":98,"target":106},{"edgeType":"contains","source":6374,"target":6383},{"edgeType":"contains","source":8762,"target":9517},{"edgeType":"contains","source":1,"target":6287},{"edgeType":"contains","source":3566,"target":3591},{"edgeType":"contains","source":792,"target":793},{"edgeType":"contains","source":2807,"target":2808},{"edgeType":"calls","source":5849,"target":4381},{"edgeType":"contains","source":5107,"target":5501},{"edgeType":"calls","source":1905,"target":1913},{"edgeType":"contains","source":3897,"target":3901},{"edgeType":"calls","source":8977,"target":8907},{"edgeType":"contains","source":12280,"target":12518},{"edgeType":"contains","source":7894,"target":7897},{"edgeType":"contains","source":4524,"target":4547},{"edgeType":"imports","source":7923,"target":7785},{"edgeType":"calls","source":2665,"target":2666},{"edgeType":"contains","source":4028,"target":4068},{"edgeType":"contains","source":3566,"target":3590},{"edgeType":"contains","source":2849,"target":2564},{"edgeType":"imports","source":11000,"target":10702},{"edgeType":"imports","source":12280,"target":12249},{"edgeType":"contains","source":5107,"target":5500},{"edgeType":"contains","source":1287,"target":1305},{"edgeType":"contains","source":12787,"target":12655},{"edgeType":"contains","source":3152,"target":3741},{"edgeType":"imports","source":12856,"target":2849},{"edgeType":"calls","source":4654,"target":4429},{"edgeType":"contains","source":4028,"target":4067},{"edgeType":"contains","source":1882,"target":1887},{"edgeType":"imports","source":5342,"target":1118},{"edgeType":"calls","source":7098,"target":563},{"edgeType":"contains","source":12246,"target":12514},{"edgeType":"imports","source":7489,"target":7495},{"edgeType":"imports","source":8011,"target":1887},{"edgeType":"contains","source":1,"target":5229},{"edgeType":"contains","source":2345,"target":1275},{"edgeType":"calls","source":681,"target":746},{"edgeType":"contains","source":9809,"target":9838},{"edgeType":"contains","source":2906,"target":2908},{"edgeType":"contains","source":792,"target":795},{"edgeType":"contains","source":11098,"target":11104},{"edgeType":"contains","source":5107,"target":5499},{"edgeType":"calls","source":12450,"target":12231},{"edgeType":"contains","source":3335,"target":3350},{"edgeType":"contains","source":6903,"target":6908},{"edgeType":"contains","source":12246,"target":12513},{"edgeType":"contains","source":4028,"target":4066},{"edgeType":"imports","source":2350,"target":864},{"edgeType":"calls","source":12575,"target":11527},{"edgeType":"contains","source":11461,"target":11478},{"edgeType":"contains","source":9507,"target":9690},{"edgeType":"calls","source":12319,"target":436},{"edgeType":"imports","source":5342,"target":1119},{"edgeType":"calls","source":2038,"target":2020},{"edgeType":"contains","source":5883,"target":6817},{"edgeType":"contains","source":5107,"target":5498},{"edgeType":"calls","source":4997,"target":4364},{"edgeType":"contains","source":792,"target":794},{"edgeType":"calls","source":10361,"target":3000},{"edgeType":"contains","source":11098,"target":11105},{"edgeType":"imports","source":12279,"target":12282},{"edgeType":"contains","source":8852,"target":8854},{"edgeType":"contains","source":1205,"target":1732},{"edgeType":"contains","source":4028,"target":4065},{"edgeType":"contains","source":7332,"target":7351},{"edgeType":"calls","source":5441,"target":5398},{"edgeType":"calls","source":5970,"target":5912},{"edgeType":"calls","source":1985,"target":491},{"edgeType":"calls","source":11920,"target":11749},{"edgeType":"calls","source":4089,"target":3973},{"edgeType":"calls","source":4091,"target":3911},{"edgeType":"contains","source":11461,"target":11479},{"edgeType":"calls","source":681,"target":748},{"edgeType":"contains","source":10239,"target":10251},{"edgeType":"calls","source":11418,"target":3000},{"edgeType":"calls","source":1640,"target":1668},{"edgeType":"contains","source":10569,"target":10588},{"edgeType":"contains","source":853,"target":1020},{"edgeType":"contains","source":4131,"target":5107},{"edgeType":"contains","source":5710,"target":5831},{"edgeType":"contains","source":7925,"target":7988},{"edgeType":"calls","source":5953,"target":4324},{"edgeType":"calls","source":5869,"target":5871},{"edgeType":"contains","source":2741,"target":2744},{"edgeType":"contains","source":7002,"target":7004},{"edgeType":"contains","source":5107,"target":5505},{"edgeType":"calls","source":1905,"target":1909},{"edgeType":"imports","source":9207,"target":9209},{"edgeType":"calls","source":12507,"target":11527},{"edgeType":"imports","source":10367,"target":733},{"edgeType":"calls","source":7567,"target":7167},{"edgeType":"contains","source":4028,"target":4072},{"edgeType":"calls","source":9108,"target":9078},{"edgeType":"calls","source":4764,"target":4187},{"edgeType":"contains","source":10239,"target":10248},{"edgeType":"calls","source":980,"target":986},{"edgeType":"imports","source":12521,"target":12173},{"edgeType":"contains","source":10524,"target":9870},{"edgeType":"contains","source":9809,"target":9837},{"edgeType":"contains","source":853,"target":1019},{"edgeType":"contains","source":5710,"target":5832},{"edgeType":"contains","source":5107,"target":5504},{"edgeType":"contains","source":11039,"target":10818},{"edgeType":"contains","source":2741,"target":2745},{"edgeType":"imports","source":4506,"target":4841},{"edgeType":"contains","source":1144,"target":454},{"edgeType":"calls","source":6717,"target":6036},{"edgeType":"contains","source":2350,"target":1124},{"edgeType":"imports","source":1434,"target":717},{"edgeType":"contains","source":10239,"target":10249},{"edgeType":"contains","source":4028,"target":4071},{"edgeType":"contains","source":12155,"target":12160},{"edgeType":"calls","source":980,"target":989},{"edgeType":"contains","source":10569,"target":10586},{"edgeType":"calls","source":2498,"target":2551},{"edgeType":"contains","source":3566,"target":3593},{"edgeType":"contains","source":5710,"target":5833},{"edgeType":"contains","source":5107,"target":5503},{"edgeType":"contains","source":8951,"target":8953},{"edgeType":"calls","source":2105,"target":2050},{"edgeType":"contains","source":853,"target":1022},{"edgeType":"imports","source":2350,"target":859},{"edgeType":"imports","source":12862,"target":10059},{"edgeType":"calls","source":2699,"target":2663},{"edgeType":"calls","source":8286,"target":8135},{"edgeType":"calls","source":1345,"target":1301},{"edgeType":"contains","source":7007,"target":1565},{"edgeType":"contains","source":4490,"target":4546},{"edgeType":"calls","source":749,"target":751},{"edgeType":"contains","source":4028,"target":4070},{"edgeType":"contains","source":5710,"target":5834},{"edgeType":"calls","source":12080,"target":12079},{"edgeType":"contains","source":12716,"target":12736},{"edgeType":"contains","source":8951,"target":8952},{"edgeType":"contains","source":1287,"target":1307},{"edgeType":"contains","source":853,"target":1021},{"edgeType":"calls","source":5902,"target":5902},{"edgeType":"contains","source":3037,"target":3080},{"edgeType":"calls","source":2735,"target":491},{"edgeType":"calls","source":9894,"target":568},{"edgeType":"calls","source":4731,"target":4150},{"edgeType":"calls","source":4722,"target":4429},{"edgeType":"contains","source":5409,"target":5653},{"edgeType":"contains","source":4524,"target":4548},{"edgeType":"contains","source":8762,"target":9525},{"edgeType":"imports","source":10037,"target":2504},{"edgeType":"calls","source":4651,"target":4516},{"edgeType":"contains","source":4028,"target":4069},{"edgeType":"imports","source":12152,"target":2474},{"edgeType":"calls","source":2797,"target":2797},{"edgeType":"contains","source":10239,"target":10247},{"edgeType":"contains","source":12280,"target":12511},{"edgeType":"contains","source":6902,"target":6912},{"edgeType":"imports","source":9207,"target":9197},{"edgeType":"calls","source":9900,"target":9866},{"edgeType":"calls","source":1771,"target":807},{"edgeType":"contains","source":4920,"target":4931},{"edgeType":"contains","source":13093,"target":13716},{"edgeType":"calls","source":1906,"target":1907},{"edgeType":"calls","source":7714,"target":7867},{"edgeType":"calls","source":2204,"target":1126},{"edgeType":"calls","source":10306,"target":451},{"edgeType":"contains","source":6605,"target":6606},{"edgeType":"calls","source":11717,"target":11677},{"edgeType":"contains","source":7925,"target":7968},{"edgeType":"calls","source":2666,"target":2660},{"edgeType":"contains","source":12750,"target":12722},{"edgeType":"calls","source":4954,"target":4668},{"edgeType":"contains","source":9106,"target":9410},{"edgeType":"contains","source":6020,"target":5714},{"edgeType":"contains","source":4028,"target":4043},{"edgeType":"calls","source":816,"target":815},{"edgeType":"contains","source":7794,"target":7801},{"edgeType":"contains","source":3889,"target":4124},{"edgeType":"calls","source":7052,"target":3020},{"edgeType":"contains","source":7596,"target":7597},{"edgeType":"contains","source":4179,"target":4646},{"edgeType":"contains","source":6968,"target":6981},{"edgeType":"contains","source":11725,"target":11729},{"edgeType":"contains","source":11791,"target":11797},{"edgeType":"calls","source":2467,"target":2487},{"edgeType":"contains","source":8107,"target":8667},{"edgeType":"contains","source":5052,"target":5066},{"edgeType":"contains","source":8592,"target":2088},{"edgeType":"contains","source":8718,"target":8753},{"edgeType":"contains","source":891,"target":1926},{"edgeType":"calls","source":2668,"target":2599},{"edgeType":"contains","source":7125,"target":7399},{"edgeType":"contains","source":2310,"target":2335},{"edgeType":"contains","source":3689,"target":2924},{"edgeType":"contains","source":3665,"target":3668},{"edgeType":"imports","source":4185,"target":4209},{"edgeType":"contains","source":7794,"target":7800},{"edgeType":"contains","source":4028,"target":4042},{"edgeType":"contains","source":1,"target":6261},{"edgeType":"contains","source":7629,"target":7630},{"edgeType":"contains","source":11725,"target":11726},{"edgeType":"contains","source":4179,"target":4645},{"edgeType":"contains","source":10367,"target":11542},{"edgeType":"contains","source":11791,"target":11794},{"edgeType":"imports","source":12555,"target":12173},{"edgeType":"contains","source":5107,"target":5474},{"edgeType":"calls","source":9410,"target":9202},{"edgeType":"imports","source":1954,"target":1487},{"edgeType":"contains","source":2641,"target":2642},{"edgeType":"contains","source":5052,"target":5065},{"edgeType":"calls","source":2338,"target":2255},{"edgeType":"imports","source":12279,"target":12273},{"edgeType":"contains","source":12716,"target":12717},{"edgeType":"calls","source":4787,"target":2444},{"edgeType":"calls","source":7611,"target":491},{"edgeType":"contains","source":7794,"target":7803},{"edgeType":"contains","source":7925,"target":7970},{"edgeType":"contains","source":4028,"target":4041},{"edgeType":"contains","source":3665,"target":3667},{"edgeType":"imports","source":4185,"target":4210},{"edgeType":"contains","source":7596,"target":7599},{"edgeType":"calls","source":12939,"target":12904},{"edgeType":"contains","source":9740,"target":3499},{"edgeType":"calls","source":3095,"target":3100},{"edgeType":"calls","source":5870,"target":5866},{"edgeType":"contains","source":4179,"target":4644},{"edgeType":"calls","source":11948,"target":11914},{"edgeType":"contains","source":11725,"target":11727},{"edgeType":"contains","source":6769,"target":6810},{"edgeType":"imports","source":10069,"target":9955},{"edgeType":"imports","source":1954,"target":1486},{"edgeType":"contains","source":2641,"target":2643},{"edgeType":"contains","source":5052,"target":5064},{"edgeType":"contains","source":5107,"target":5473},{"edgeType":"calls","source":1939,"target":1942},{"edgeType":"contains","source":10367,"target":11543},{"edgeType":"contains","source":4963,"target":4652},{"edgeType":"contains","source":6506,"target":6507},{"edgeType":"calls","source":6794,"target":6793},{"edgeType":"contains","source":5786,"target":4515},{"edgeType":"contains","source":7794,"target":7802},{"edgeType":"calls","source":4726,"target":4334},{"edgeType":"contains","source":7925,"target":7969},{"edgeType":"contains","source":2310,"target":2333},{"edgeType":"calls","source":2930,"target":2931},{"edgeType":"contains","source":4028,"target":4040},{"edgeType":"contains","source":3665,"target":3666},{"edgeType":"contains","source":1584,"target":1585},{"edgeType":"contains","source":7596,"target":7598},{"edgeType":"imports","source":8011,"target":1881},{"edgeType":"calls","source":9210,"target":9062},{"edgeType":"contains","source":4028,"target":4047},{"edgeType":"calls","source":13037,"target":13043},{"edgeType":"contains","source":853,"target":995},{"edgeType":"contains","source":4524,"target":4527},{"edgeType":"contains","source":12752,"target":12655},{"edgeType":"calls","source":7821,"target":1383},{"edgeType":"contains","source":5977,"target":5986},{"edgeType":"contains","source":8718,"target":8749},{"edgeType":"imports","source":1511,"target":420},{"edgeType":"imports","source":2244,"target":952},{"edgeType":"contains","source":10137,"target":10214},{"edgeType":"contains","source":5052,"target":5071},{"edgeType":"calls","source":8567,"target":454},{"edgeType":"contains","source":5883,"target":6786},{"edgeType":"contains","source":3427,"target":3652},{"edgeType":"contains","source":7794,"target":7797},{"edgeType":"calls","source":1811,"target":619},{"edgeType":"contains","source":4028,"target":4046},{"edgeType":"calls","source":7057,"target":7098},{"edgeType":"contains","source":7128,"target":7302},{"edgeType":"contains","source":4380,"target":3704},{"edgeType":"contains","source":8785,"target":8786},{"edgeType":"imports","source":1954,"target":1484},{"edgeType":"contains","source":2408,"target":2473},{"edgeType":"contains","source":5883,"target":6787},{"edgeType":"contains","source":2310,"target":2339},{"edgeType":"contains","source":5961,"target":6483},{"edgeType":"calls","source":2835,"target":2703},{"edgeType":"contains","source":5052,"target":5070},{"edgeType":"contains","source":11327,"target":10321},{"edgeType":"contains","source":3566,"target":3570},{"edgeType":"calls","source":12410,"target":11339},{"edgeType":"calls","source":5441,"target":5421},{"edgeType":"contains","source":8107,"target":8663},{"edgeType":"calls","source":5438,"target":2343},{"edgeType":"contains","source":7794,"target":7796},{"edgeType":"imports","source":11259,"target":11124},{"edgeType":"contains","source":4028,"target":4045},{"edgeType":"contains","source":7034,"target":7046},{"edgeType":"contains","source":4179,"target":4649},{"edgeType":"contains","source":11196,"target":11208},{"edgeType":"calls","source":7553,"target":7579},{"edgeType":"contains","source":7125,"target":7396},{"edgeType":"calls","source":6071,"target":5974},{"edgeType":"calls","source":7191,"target":7173},{"edgeType":"contains","source":2849,"target":2540},{"edgeType":"contains","source":8718,"target":8752},{"edgeType":"calls","source":9380,"target":9079},{"edgeType":"contains","source":4490,"target":4522},{"edgeType":"contains","source":4524,"target":4525},{"edgeType":"contains","source":5883,"target":6788},{"edgeType":"contains","source":7925,"target":7966},{"edgeType":"contains","source":907,"target":380},{"edgeType":"contains","source":2310,"target":2336},{"edgeType":"contains","source":8305,"target":414},{"edgeType":"contains","source":8107,"target":8666},{"edgeType":"calls","source":11315,"target":3000},{"edgeType":"contains","source":7794,"target":7799},{"edgeType":"contains","source":3889,"target":4126},{"edgeType":"calls","source":3095,"target":3096},{"edgeType":"calls","source":5022,"target":4668},{"edgeType":"calls","source":1307,"target":390},{"edgeType":"contains","source":9809,"target":9810},{"edgeType":"contains","source":11108,"target":11823},{"edgeType":"imports","source":12276,"target":2849},{"edgeType":"contains","source":4028,"target":4044},{"edgeType":"contains","source":7034,"target":7047},{"edgeType":"calls","source":221,"target":230},{"edgeType":"calls","source":3989,"target":3923},{"edgeType":"contains","source":4758,"target":4669},{"edgeType":"contains","source":2408,"target":2470},{"edgeType":"contains","source":4490,"target":4520},{"edgeType":"contains","source":7925,"target":7965},{"edgeType":"contains","source":5961,"target":6485},{"edgeType":"calls","source":8149,"target":731},{"edgeType":"contains","source":7794,"target":7798},{"edgeType":"imports","source":7923,"target":7780},{"edgeType":"contains","source":8107,"target":8665},{"edgeType":"contains","source":9852,"target":10592},{"edgeType":"calls","source":5143,"target":5144},{"edgeType":"contains","source":6020,"target":5713},{"edgeType":"calls","source":981,"target":982},{"edgeType":"contains","source":3889,"target":4125},{"edgeType":"contains","source":3665,"target":3670},{"edgeType":"contains","source":5786,"target":4511},{"edgeType":"contains","source":7923,"target":628},{"edgeType":"contains","source":4028,"target":4051},{"edgeType":"calls","source":7031,"target":1565},{"edgeType":"contains","source":11422,"target":11616},{"edgeType":"contains","source":10304,"target":10334},{"edgeType":"contains","source":428,"target":433},{"edgeType":"contains","source":8087,"target":2954},{"edgeType":"contains","source":2408,"target":2476},{"edgeType":"calls","source":4731,"target":4173},{"edgeType":"contains","source":2254,"target":907},{"edgeType":"contains","source":8005,"target":7610},{"edgeType":"contains","source":5961,"target":6494},{"edgeType":"contains","source":6374,"target":6376},{"edgeType":"contains","source":11432,"target":2849},{"edgeType":"contains","source":885,"target":3178},{"edgeType":"calls","source":9693,"target":436},{"edgeType":"contains","source":6407,"target":6410},{"edgeType":"contains","source":6506,"target":6512},{"edgeType":"calls","source":8218,"target":8106},{"edgeType":"contains","source":7001,"target":7022},{"edgeType":"calls","source":1675,"target":1660},{"edgeType":"contains","source":1287,"target":1288},{"edgeType":"calls","source":10565,"target":3000},{"edgeType":"imports","source":2892,"target":3073},{"edgeType":"contains","source":3335,"target":3337},{"edgeType":"contains","source":4028,"target":4050},{"edgeType":"calls","source":5239,"target":5337},{"edgeType":"contains","source":8718,"target":8761},{"edgeType":"contains","source":6568,"target":6705},{"edgeType":"calls","source":10103,"target":409},{"edgeType":"contains","source":428,"target":432},{"edgeType":"calls","source":2336,"target":2312},{"edgeType":"imports","source":1434,"target":704},{"edgeType":"calls","source":6201,"target":6169},{"edgeType":"imports","source":1111,"target":148},{"edgeType":"calls","source":749,"target":768},{"edgeType":"contains","source":5961,"target":6495},{"edgeType":"calls","source":11265,"target":9842},{"edgeType":"contains","source":8373,"target":429},{"edgeType":"contains","source":885,"target":3177},{"edgeType":"contains","source":5052,"target":5074},{"edgeType":"contains","source":1,"target":8383},{"edgeType":"calls","source":1569,"target":717},{"edgeType":"contains","source":2269,"target":2558},{"edgeType":"contains","source":7727,"target":7771},{"edgeType":"contains","source":1,"target":7326},{"edgeType":"contains","source":10338,"target":10339},{"edgeType":"contains","source":5223,"target":5058},{"edgeType":"contains","source":7125,"target":7407},{"edgeType":"contains","source":1287,"target":1289},{"edgeType":"contains","source":5107,"target":5483},{"edgeType":"contains","source":4028,"target":4049},{"edgeType":"contains","source":11461,"target":11462},{"edgeType":"imports","source":9475,"target":9335},{"edgeType":"calls","source":8843,"target":8818},{"edgeType":"contains","source":5883,"target":6800},{"edgeType":"contains","source":263,"target":265},{"edgeType":"calls","source":4629,"target":4162},{"edgeType":"contains","source":5961,"target":6496},{"edgeType":"contains","source":4380,"target":3708},{"edgeType":"contains","source":2310,"target":2340},{"edgeType":"contains","source":885,"target":3180},{"edgeType":"contains","source":8455,"target":8461},{"edgeType":"contains","source":12617,"target":12623},{"edgeType":"contains","source":3492,"target":3753},{"edgeType":"contains","source":7125,"target":7408},{"edgeType":"contains","source":8762,"target":9514},{"edgeType":"contains","source":4028,"target":4048},{"edgeType":"calls","source":7553,"target":7584},{"edgeType":"contains","source":6141,"target":6202},{"edgeType":"contains","source":428,"target":434},{"edgeType":"contains","source":4179,"target":4652},{"edgeType":"contains","source":2408,"target":2475},{"edgeType":"calls","source":4623,"target":4347},{"edgeType":"contains","source":263,"target":264},{"edgeType":"contains","source":5883,"target":6801},{"edgeType":"imports","source":4185,"target":4203},{"edgeType":"contains","source":885,"target":3179},{"edgeType":"contains","source":5052,"target":5072},{"edgeType":"contains","source":5107,"target":5481},{"edgeType":"calls","source":10906,"target":3000},{"edgeType":"contains","source":6374,"target":6379},{"edgeType":"contains","source":6407,"target":6413},{"edgeType":"contains","source":12716,"target":12724},{"edgeType":"contains","source":1218,"target":1312},{"edgeType":"calls","source":2024,"target":351},{"edgeType":"contains","source":11547,"target":11965},{"edgeType":"calls","source":12080,"target":436},{"edgeType":"contains","source":6043,"target":6062},{"edgeType":"calls","source":7559,"target":7399},{"edgeType":"calls","source":7553,"target":7585},{"edgeType":"contains","source":6869,"target":6882},{"edgeType":"contains","source":8762,"target":9508},{"edgeType":"calls","source":1167,"target":492},{"edgeType":"contains","source":263,"target":267},{"edgeType":"contains","source":4028,"target":4055},{"edgeType":"calls","source":12905,"target":12915},{"edgeType":"contains","source":7125,"target":7402},{"edgeType":"contains","source":9809,"target":9820},{"edgeType":"contains","source":1287,"target":1292},{"edgeType":"contains","source":885,"target":3182},{"edgeType":"contains","source":11715,"target":414},{"edgeType":"contains","source":9506,"target":9698},{"edgeType":"contains","source":8107,"target":8671},{"edgeType":"contains","source":6902,"target":6917},{"edgeType":"contains","source":5409,"target":5639},{"edgeType":"calls","source":6266,"target":6264},{"edgeType":"calls","source":12905,"target":12914},{"edgeType":"contains","source":10301,"target":11481},{"edgeType":"contains","source":11791,"target":11801},{"edgeType":"calls","source":4518,"target":4429},{"edgeType":"contains","source":1,"target":8388},{"edgeType":"contains","source":4028,"target":4054},{"edgeType":"contains","source":5746,"target":5757},{"edgeType":"contains","source":2849,"target":2551},{"edgeType":"contains","source":907,"target":385},{"edgeType":"contains","source":1582,"target":1661},{"edgeType":"contains","source":2269,"target":2562},{"edgeType":"contains","source":7727,"target":7767},{"edgeType":"contains","source":12551,"target":12552},{"edgeType":"imports","source":4185,"target":4205},{"edgeType":"contains","source":7794,"target":7804},{"edgeType":"calls","source":1838,"target":830},{"edgeType":"calls","source":3426,"target":3400},{"edgeType":"contains","source":7596,"target":7600},{"edgeType":"contains","source":885,"target":3181},{"edgeType":"calls","source":2699,"target":2679},{"edgeType":"contains","source":11008,"target":10702},{"edgeType":"contains","source":8718,"target":8760},{"edgeType":"calls","source":11897,"target":2936},{"edgeType":"contains","source":428,"target":439},{"edgeType":"contains","source":7925,"target":7974},{"edgeType":"contains","source":4028,"target":4053},{"edgeType":"calls","source":11496,"target":568},{"edgeType":"contains","source":98,"target":99},{"edgeType":"contains","source":6407,"target":6408},{"edgeType":"contains","source":8455,"target":8457},{"edgeType":"contains","source":7125,"target":7404},{"edgeType":"contains","source":4293,"target":4295},{"edgeType":"contains","source":6506,"target":6510},{"edgeType":"contains","source":10701,"target":10706},{"edgeType":"calls","source":11564,"target":10088},{"edgeType":"calls","source":11881,"target":11888},{"edgeType":"contains","source":5107,"target":5486},{"edgeType":"calls","source":1708,"target":1692},{"edgeType":"calls","source":11733,"target":11192},{"edgeType":"calls","source":619,"target":568},{"edgeType":"contains","source":9479,"target":9480},{"edgeType":"calls","source":6111,"target":5782},{"edgeType":"calls","source":11749,"target":11753},{"edgeType":"calls","source":9751,"target":1814},{"edgeType":"contains","source":11791,"target":11799},{"edgeType":"imports","source":7583,"target":1400},{"edgeType":"calls","source":9108,"target":9062},{"edgeType":"contains","source":263,"target":268},{"edgeType":"contains","source":1,"target":7333},{"edgeType":"contains","source":5961,"target":6493},{"edgeType":"contains","source":4028,"target":4052},{"edgeType":"contains","source":5710,"target":5818},{"edgeType":"calls","source":6497,"target":6499},{"edgeType":"calls","source":3729,"target":3518},{"edgeType":"contains","source":6407,"target":6409},{"edgeType":"contains","source":8455,"target":8456},{"edgeType":"contains","source":6506,"target":6511},{"edgeType":"contains","source":3578,"target":3204},{"edgeType":"imports","source":1954,"target":1491},{"edgeType":"contains","source":5716,"target":4575},{"edgeType":"imports","source":12279,"target":12262},{"edgeType":"contains","source":7125,"target":7405},{"edgeType":"contains","source":5107,"target":5485},{"edgeType":"contains","source":6568,"target":6679},{"edgeType":"contains","source":1,"target":13645},{"edgeType":"contains","source":7356,"target":3392},{"edgeType":"contains","source":5961,"target":6469},{"edgeType":"contains","source":9207,"target":9434},{"edgeType":"contains","source":2310,"target":2318},{"edgeType":"imports","source":8455,"target":583},{"edgeType":"contains","source":9826,"target":8215},{"edgeType":"calls","source":4653,"target":4568},{"edgeType":"contains","source":7694,"target":7713},{"edgeType":"contains","source":3697,"target":3717},{"edgeType":"calls","source":11192,"target":11155},{"edgeType":"contains","source":10238,"target":10242},{"edgeType":"calls","source":3116,"target":2534},{"edgeType":"contains","source":6312,"target":6159},{"edgeType":"contains","source":8713,"target":8892},{"edgeType":"calls","source":5807,"target":5790},{"edgeType":"contains","source":10436,"target":10446},{"edgeType":"contains","source":918,"target":1073},{"edgeType":"calls","source":1908,"target":1927},{"edgeType":"contains","source":7925,"target":7950},{"edgeType":"contains","source":9207,"target":9433},{"edgeType":"contains","source":2310,"target":2319},{"edgeType":"calls","source":8284,"target":8283},{"edgeType":"contains","source":3697,"target":3716},{"edgeType":"contains","source":5646,"target":5665},{"edgeType":"calls","source":3061,"target":2126},{"edgeType":"calls","source":2272,"target":2273},{"edgeType":"calls","source":1899,"target":1148},{"edgeType":"calls","source":12045,"target":568},{"edgeType":"calls","source":7525,"target":7500},{"edgeType":"contains","source":8713,"target":8891},{"edgeType":"contains","source":918,"target":1072},{"edgeType":"imports","source":3763,"target":3335},{"edgeType":"contains","source":10436,"target":10447},{"edgeType":"imports","source":11776,"target":11791},{"edgeType":"calls","source":4752,"target":4668},{"edgeType":"contains","source":1,"target":12590},{"edgeType":"calls","source":1950,"target":628},{"edgeType":"calls","source":1908,"target":1930},{"edgeType":"contains","source":8618,"target":8668},{"edgeType":"contains","source":7231,"target":7269},{"edgeType":"contains","source":11328,"target":11332},{"edgeType":"contains","source":3298,"target":3399},{"edgeType":"contains","source":5883,"target":6775},{"edgeType":"calls","source":5410,"target":5411},{"edgeType":"contains","source":8167,"target":451},{"edgeType":"contains","source":2310,"target":2316},{"edgeType":"contains","source":5711,"target":5765},{"edgeType":"contains","source":7630,"target":7585},{"edgeType":"calls","source":5076,"target":4137},{"edgeType":"calls","source":719,"target":735},{"edgeType":"calls","source":2371,"target":2372},{"edgeType":"contains","source":4226,"target":4229},{"edgeType":"contains","source":3576,"target":3238},{"edgeType":"contains","source":12361,"target":12078},{"edgeType":"calls","source":11155,"target":11243},{"edgeType":"contains","source":10238,"target":10240},{"edgeType":"calls","source":11112,"target":10462},{"edgeType":"calls","source":7813,"target":687},{"edgeType":"contains","source":918,"target":1075},{"edgeType":"contains","source":8713,"target":8894},{"edgeType":"calls","source":6040,"target":5964},{"edgeType":"calls","source":1743,"target":1759},{"edgeType":"contains","source":12214,"target":8177},{"edgeType":"contains","source":9207,"target":9435},{"edgeType":"contains","source":5883,"target":6776},{"edgeType":"contains","source":1,"target":8361},{"edgeType":"contains","source":2310,"target":2317},{"edgeType":"contains","source":11196,"target":11197},{"edgeType":"contains","source":7630,"target":7584},{"edgeType":"contains","source":9345,"target":9385},{"edgeType":"calls","source":5034,"target":4381},{"edgeType":"calls","source":4521,"target":4429},{"edgeType":"contains","source":4292,"target":4296},{"edgeType":"contains","source":918,"target":1074},{"edgeType":"contains","source":5107,"target":5456},{"edgeType":"calls","source":7194,"target":7193},{"edgeType":"calls","source":9516,"target":746},{"edgeType":"imports","source":5835,"target":5697},{"edgeType":"calls","source":7624,"target":7604},{"edgeType":"contains","source":10436,"target":10445},{"edgeType":"contains","source":5107,"target":5464},{"edgeType":"imports","source":10301,"target":9955},{"edgeType":"contains","source":8713,"target":8888},{"edgeType":"calls","source":1453,"target":1230},{"edgeType":"contains","source":918,"target":1078},{"edgeType":"calls","source":757,"target":608},{"edgeType":"contains","source":1087,"target":1124},{"edgeType":"contains","source":3037,"target":3040},{"edgeType":"contains","source":9510,"target":9550},{"edgeType":"imports","source":5835,"target":5700},{"edgeType":"contains","source":9698,"target":10065},{"edgeType":"calls","source":13892,"target":13079},{"edgeType":"calls","source":10705,"target":3000},{"edgeType":"contains","source":7630,"target":7579},{"edgeType":"contains","source":4758,"target":4655},{"edgeType":"contains","source":5646,"target":5660},{"edgeType":"contains","source":10301,"target":11456},{"edgeType":"contains","source":4028,"target":4031},{"edgeType":"contains","source":8388,"target":8393},{"edgeType":"calls","source":7888,"target":7877},{"edgeType":"calls","source":7524,"target":7534},{"edgeType":"contains","source":2244,"target":2254},{"edgeType":"contains","source":918,"target":1077},{"edgeType":"imports","source":7694,"target":6209},{"edgeType":"contains","source":8618,"target":8662},{"edgeType":"contains","source":1,"target":13649},{"edgeType":"contains","source":4490,"target":4507},{"edgeType":"contains","source":8713,"target":8887},{"edgeType":"contains","source":5961,"target":6466},{"edgeType":"contains","source":5107,"target":5463},{"edgeType":"calls","source":4786,"target":4668},{"edgeType":"contains","source":3847,"target":3298},{"edgeType":"contains","source":11328,"target":11331},{"edgeType":"calls","source":627,"target":409},{"edgeType":"imports","source":12697,"target":2266},{"edgeType":"calls","source":9136,"target":1957},{"edgeType":"contains","source":9345,"target":9379},{"edgeType":"calls","source":5038,"target":4255},{"edgeType":"contains","source":11547,"target":11941},{"edgeType":"contains","source":9698,"target":10066},{"edgeType":"contains","source":4028,"target":4030},{"edgeType":"calls","source":2536,"target":2541},{"edgeType":"calls","source":7161,"target":7161},{"edgeType":"contains","source":918,"target":1076},{"edgeType":"imports","source":2527,"target":2533},{"edgeType":"contains","source":5961,"target":6467},{"edgeType":"contains","source":918,"target":1080},{"edgeType":"calls","source":1540,"target":649},{"edgeType":"contains","source":5052,"target":5053},{"edgeType":"calls","source":6532,"target":6577},{"edgeType":"contains","source":3697,"target":3719},{"edgeType":"calls","source":2503,"target":2504},{"edgeType":"contains","source":9698,"target":10063},{"edgeType":"contains","source":4028,"target":4029},{"edgeType":"contains","source":2219,"target":1970},{"edgeType":"contains","source":11328,"target":11327},{"edgeType":"contains","source":8713,"target":8890},{"edgeType":"contains","source":10137,"target":10196},{"edgeType":"contains","source":2310,"target":2321},{"edgeType":"contains","source":918,"target":1079},{"edgeType":"contains","source":7356,"target":3391},{"edgeType":"contains","source":11328,"target":11329},{"edgeType":"calls","source":4720,"target":4598},{"edgeType":"calls","source":5108,"target":1026},{"edgeType":"contains","source":6142,"target":6143},{"edgeType":"contains","source":10304,"target":10305},{"edgeType":"contains","source":8713,"target":8889},{"edgeType":"contains","source":918,"target":1082},{"edgeType":"contains","source":11224,"target":10338},{"edgeType":"contains","source":2849,"target":2530},{"edgeType":"contains","source":2839,"target":2840},{"edgeType":"contains","source":10436,"target":10454},{"edgeType":"calls","source":1743,"target":692},{"edgeType":"calls","source":11788,"target":11714},{"edgeType":"contains","source":7034,"target":7040},{"edgeType":"contains","source":8983,"target":8987},{"edgeType":"contains","source":7125,"target":7390},{"edgeType":"calls","source":8123,"target":7996},{"edgeType":"contains","source":4028,"target":4035},{"edgeType":"contains","source":7691,"target":414},{"edgeType":"calls","source":1743,"target":1749},{"edgeType":"contains","source":7925,"target":7960},{"edgeType":"contains","source":10338,"target":10321},{"edgeType":"contains","source":5811,"target":5843},{"edgeType":"contains","source":5883,"target":6782},{"edgeType":"contains","source":9875,"target":9876},{"edgeType":"calls","source":488,"target":487},{"edgeType":"contains","source":8454,"target":8472},{"edgeType":"imports","source":7853,"target":7610},{"edgeType":"contains","source":918,"target":1081},{"edgeType":"contains","source":4920,"target":4922},{"edgeType":"contains","source":1144,"target":1474},{"edgeType":"contains","source":7125,"target":7391},{"edgeType":"calls","source":10300,"target":10273},{"edgeType":"contains","source":7034,"target":7041},{"edgeType":"contains","source":4028,"target":4034},{"edgeType":"calls","source":9077,"target":9076},{"edgeType":"contains","source":5883,"target":6783},{"edgeType":"contains","source":2310,"target":2327},{"edgeType":"contains","source":4297,"target":4151},{"edgeType":"contains","source":9875,"target":9877},{"edgeType":"contains","source":12131,"target":4417},{"edgeType":"contains","source":11196,"target":11204},{"edgeType":"contains","source":5107,"target":5466},{"edgeType":"contains","source":5562,"target":5107},{"edgeType":"contains","source":13093,"target":13706},{"edgeType":"calls","source":12492,"target":2572},{"edgeType":"contains","source":7125,"target":7392},{"edgeType":"contains","source":4028,"target":4033},{"edgeType":"calls","source":12510,"target":11527},{"edgeType":"contains","source":6568,"target":6689},{"edgeType":"contains","source":11674,"target":12241},{"edgeType":"contains","source":1881,"target":1882},{"edgeType":"contains","source":4179,"target":4637},{"edgeType":"contains","source":5883,"target":6784},{"edgeType":"contains","source":4490,"target":4509},{"edgeType":"contains","source":7794,"target":7795},{"edgeType":"contains","source":10037,"target":10137},{"edgeType":"contains","source":7925,"target":7962},{"edgeType":"contains","source":2310,"target":2325},{"edgeType":"calls","source":10758,"target":9817},{"edgeType":"contains","source":5716,"target":4562},{"edgeType":"contains","source":5107,"target":5465},{"edgeType":"imports","source":2244,"target":1803},{"edgeType":"contains","source":8618,"target":8675},{"edgeType":"contains","source":8983,"target":8988},{"edgeType":"contains","source":4028,"target":4032},{"edgeType":"calls","source":4801,"target":1026},{"edgeType":"imports","source":7001,"target":2310},{"edgeType":"contains","source":10301,"target":11467},{"edgeType":"contains","source":7860,"target":7862},{"edgeType":"contains","source":10304,"target":10317},{"edgeType":"contains","source":4490,"target":4508},{"edgeType":"contains","source":11983,"target":12176},{"edgeType":"contains","source":6043,"target":6053},{"edgeType":"contains","source":5883,"target":6785},{"edgeType":"contains","source":8107,"target":4433},{"edgeType":"calls","source":8979,"target":8945},{"edgeType":"contains","source":5811,"target":5838},{"edgeType":"contains","source":5786,"target":4499},{"edgeType":"contains","source":11983,"target":12174},{"edgeType":"contains","source":4179,"target":4643},{"edgeType":"imports","source":2244,"target":1802},{"edgeType":"contains","source":7034,"target":7036},{"edgeType":"contains","source":5646,"target":5668},{"edgeType":"contains","source":891,"target":1923},{"edgeType":"contains","source":5052,"target":5063},{"edgeType":"contains","source":5713,"target":420},{"edgeType":"contains","source":7231,"target":7271},{"edgeType":"contains","source":8785,"target":8778},{"edgeType":"imports","source":10237,"target":9817},{"edgeType":"calls","source":2767,"target":2770},{"edgeType":"contains","source":5961,"target":6474},{"edgeType":"imports","source":8523,"target":585},{"edgeType":"contains","source":2310,"target":2330},{"edgeType":"contains","source":11983,"target":12175},{"edgeType":"contains","source":4028,"target":4039},{"edgeType":"contains","source":11983,"target":12173},{"edgeType":"contains","source":2320,"target":964},{"edgeType":"imports","source":2244,"target":1801},{"edgeType":"imports","source":13053,"target":2849},{"edgeType":"calls","source":1724,"target":219},{"edgeType":"calls","source":5542,"target":5536},{"edgeType":"calls","source":12399,"target":11804},{"edgeType":"contains","source":8713,"target":8895},{"edgeType":"contains","source":5883,"target":6779},{"edgeType":"contains","source":2310,"target":2331},{"edgeType":"contains","source":5961,"target":6475},{"edgeType":"contains","source":4179,"target":4642},{"edgeType":"contains","source":8454,"target":8468},{"edgeType":"contains","source":4028,"target":4038},{"edgeType":"contains","source":5646,"target":5670},{"edgeType":"calls","source":1743,"target":690},{"edgeType":"contains","source":659,"target":661},{"edgeType":"calls","source":5859,"target":4164},{"edgeType":"calls","source":1690,"target":219},{"edgeType":"contains","source":1218,"target":1301},{"edgeType":"contains","source":8718,"target":8743},{"edgeType":"imports","source":3763,"target":3332},{"edgeType":"contains","source":5883,"target":6780},{"edgeType":"contains","source":10436,"target":10448},{"edgeType":"calls","source":10875,"target":8308},{"edgeType":"contains","source":5961,"target":6476},{"edgeType":"contains","source":4028,"target":4037},{"edgeType":"calls","source":11319,"target":3000},{"edgeType":"contains","source":6902,"target":6903},{"edgeType":"contains","source":8983,"target":8984},{"edgeType":"contains","source":4920,"target":4924},{"edgeType":"contains","source":8718,"target":8742},{"edgeType":"calls","source":4848,"target":4850},{"edgeType":"contains","source":7925,"target":7957},{"edgeType":"contains","source":5883,"target":6781},{"edgeType":"contains","source":2310,"target":2329},{"edgeType":"calls","source":2603,"target":454},{"edgeType":"contains","source":4028,"target":4036},{"edgeType":"contains","source":1,"target":6259},{"edgeType":"contains","source":8388,"target":8402},{"edgeType":"contains","source":10137,"target":10205},{"edgeType":"calls","source":664,"target":313},{"edgeType":"contains","source":10216,"target":9870},{"edgeType":"contains","source":1,"target":4115},{"edgeType":"contains","source":3531,"target":3561},{"edgeType":"contains","source":8103,"target":8759},{"edgeType":"contains","source":12201,"target":11738},{"edgeType":"contains","source":4655,"target":4657},{"edgeType":"contains","source":918,"target":1057},{"edgeType":"contains","source":899,"target":589},{"edgeType":"calls","source":6072,"target":6048},{"edgeType":"contains","source":6568,"target":6662},{"edgeType":"calls","source":1283,"target":1235},{"edgeType":"contains","source":3144,"target":1816},{"edgeType":"contains","source":9907,"target":9916},{"edgeType":"calls","source":12116,"target":12091},{"edgeType":"contains","source":426,"target":453},{"edgeType":"contains","source":1,"target":13628},{"edgeType":"calls","source":12777,"target":12742},{"edgeType":"imports","source":1111,"target":964},{"edgeType":"contains","source":3697,"target":3701},{"edgeType":"calls","source":4748,"target":4811},{"edgeType":"contains","source":3531,"target":3560},{"edgeType":"contains","source":10270,"target":10291},{"edgeType":"calls","source":2374,"target":2298},{"edgeType":"contains","source":10951,"target":10321},{"edgeType":"contains","source":8762,"target":9470},{"edgeType":"contains","source":899,"target":588},{"edgeType":"contains","source":8713,"target":8875},{"edgeType":"contains","source":4655,"target":4656},{"edgeType":"calls","source":7714,"target":568},{"edgeType":"contains","source":918,"target":1056},{"edgeType":"contains","source":4743,"target":5099},{"edgeType":"contains","source":1144,"target":1449},{"edgeType":"contains","source":6568,"target":6663},{"edgeType":"contains","source":1116,"target":1260},{"edgeType":"contains","source":9907,"target":9917},{"edgeType":"contains","source":7131,"target":7180},{"edgeType":"contains","source":12143,"target":8250},{"edgeType":"contains","source":8103,"target":8758},{"edgeType":"contains","source":3697,"target":3700},{"edgeType":"contains","source":11108,"target":11796},{"edgeType":"calls","source":852,"target":854},{"edgeType":"calls","source":4748,"target":4810},{"edgeType":"calls","source":6457,"target":2539},{"edgeType":"imports","source":12147,"target":11905},{"edgeType":"contains","source":7033,"target":7048},{"edgeType":"calls","source":11155,"target":11226},{"edgeType":"contains","source":3040,"target":2924},{"edgeType":"contains","source":918,"target":1059},{"edgeType":"contains","source":8591,"target":2089},{"edgeType":"contains","source":8713,"target":8878},{"edgeType":"contains","source":10643,"target":10352},{"edgeType":"contains","source":3144,"target":1814},{"edgeType":"contains","source":426,"target":455},{"edgeType":"contains","source":7131,"target":7181},{"edgeType":"contains","source":1144,"target":1452},{"edgeType":"contains","source":5883,"target":6759},{"edgeType":"calls","source":6617,"target":6036},{"edgeType":"calls","source":6533,"target":6526},{"edgeType":"imports","source":12044,"target":11928},{"edgeType":"contains","source":918,"target":1058},{"edgeType":"contains","source":8713,"target":8877},{"edgeType":"contains","source":3144,"target":1815},{"edgeType":"imports","source":3763,"target":3320},{"edgeType":"contains","source":899,"target":590},{"edgeType":"contains","source":6508,"target":6411},{"edgeType":"calls","source":2680,"target":1267},{"edgeType":"contains","source":5883,"target":6760},{"edgeType":"calls","source":13073,"target":13076},{"edgeType":"contains","source":7131,"target":7182},{"edgeType":"calls","source":3363,"target":3348},{"edgeType":"calls","source":753,"target":754},{"edgeType":"calls","source":5033,"target":4429},{"edgeType":"calls","source":2801,"target":2801},{"edgeType":"contains","source":9510,"target":9538},{"edgeType":"calls","source":4923,"target":4668},{"edgeType":"calls","source":11733,"target":11284},{"edgeType":"calls","source":8978,"target":8954},{"edgeType":"contains","source":1,"target":4119},{"edgeType":"contains","source":10369,"target":10388},{"edgeType":"contains","source":13093,"target":13679},{"edgeType":"contains","source":4655,"target":4661},{"edgeType":"contains","source":918,"target":1061},{"edgeType":"calls","source":9760,"target":568},{"edgeType":"contains","source":8713,"target":8871},{"edgeType":"contains","source":426,"target":457},{"edgeType":"contains","source":1116,"target":1265},{"edgeType":"contains","source":3102,"target":3122},{"edgeType":"calls","source":865,"target":448},{"edgeType":"contains","source":8103,"target":8755},{"edgeType":"contains","source":8087,"target":2909},{"edgeType":"contains","source":1497,"target":1083},{"edgeType":"imports","source":12901,"target":12837},{"edgeType":"contains","source":1582,"target":1619},{"edgeType":"calls","source":3150,"target":436},{"edgeType":"calls","source":5807,"target":5802},{"edgeType":"contains","source":11108,"target":11792},{"edgeType":"contains","source":918,"target":1060},{"edgeType":"contains","source":8762,"target":9466},{"edgeType":"contains","source":11426,"target":11447},{"edgeType":"contains","source":2408,"target":2439},{"edgeType":"contains","source":10069,"target":10176},{"edgeType":"contains","source":426,"target":456},{"edgeType":"contains","source":8713,"target":8870},{"edgeType":"contains","source":6568,"target":6659},{"edgeType":"imports","source":11776,"target":11779},{"edgeType":"calls","source":2592,"target":2936},{"edgeType":"contains","source":3102,"target":3123},{"edgeType":"calls","source":4899,"target":4353},{"edgeType":"imports","source":8523,"target":578},{"edgeType":"contains","source":8087,"target":2908},{"edgeType":"calls","source":12562,"target":2498},{"edgeType":"contains","source":11091,"target":11259},{"edgeType":"contains","source":11108,"target":11789},{"edgeType":"contains","source":4194,"target":4151},{"edgeType":"contains","source":6339,"target":6360},{"edgeType":"contains","source":4655,"target":4659},{"edgeType":"imports","source":2559,"target":1524},{"edgeType":"contains","source":8762,"target":9469},{"edgeType":"contains","source":6762,"target":6989},{"edgeType":"contains","source":8713,"target":8874},{"edgeType":"contains","source":12201,"target":11732},{"edgeType":"contains","source":6568,"target":6660},{"edgeType":"contains","source":918,"target":1063},{"edgeType":"calls","source":2669,"target":2660},{"edgeType":"contains","source":8103,"target":8757},{"edgeType":"contains","source":10270,"target":10284},{"edgeType":"calls","source":2933,"target":2932},{"edgeType":"contains","source":9510,"target":9535},{"edgeType":"imports","source":12553,"target":12000},{"edgeType":"calls","source":5149,"target":5058},{"edgeType":"calls","source":5177,"target":4190},{"edgeType":"calls","source":12364,"target":11804},{"edgeType":"contains","source":7727,"target":7729},{"edgeType":"calls","source":1813,"target":658},{"edgeType":"calls","source":11752,"target":11751},{"edgeType":"calls","source":2536,"target":2555},{"edgeType":"calls","source":1606,"target":733},{"edgeType":"contains","source":7131,"target":7178},{"edgeType":"calls","source":1909,"target":1910},{"edgeType":"imports","source":2244,"target":717},{"edgeType":"contains","source":8618,"target":8646},{"edgeType":"contains","source":427,"target":428},{"edgeType":"calls","source":10179,"target":7663},{"edgeType":"contains","source":8713,"target":8872},{"edgeType":"contains","source":12152,"target":12193},{"edgeType":"contains","source":918,"target":1062},{"edgeType":"calls","source":1542,"target":602},{"edgeType":"imports","source":7019,"target":7033},{"edgeType":"contains","source":12020,"target":12057},{"edgeType":"contains","source":12283,"target":2847},{"edgeType":"contains","source":8103,"target":8756},{"edgeType":"calls","source":13081,"target":148},{"edgeType":"calls","source":12083,"target":12060},{"edgeType":"calls","source":5113,"target":5116},{"edgeType":"calls","source":3039,"target":1761},{"edgeType":"contains","source":3531,"target":3563},{"edgeType":"imports","source":4316,"target":4151},{"edgeType":"calls","source":12414,"target":12369},{"edgeType":"contains","source":3697,"target":3702},{"edgeType":"imports","source":12280,"target":12000},{"edgeType":"contains","source":12201,"target":11746},{"edgeType":"contains","source":8713,"target":8884},{"edgeType":"calls","source":7819,"target":491},{"edgeType":"imports","source":1139,"target":2219},{"edgeType":"contains","source":8197,"target":568},{"edgeType":"contains","source":5883,"target":6765},{"edgeType":"contains","source":2409,"target":2412},{"edgeType":"contains","source":4261,"target":4194},{"edgeType":"contains","source":4358,"target":4359},{"edgeType":"contains","source":8388,"target":8389},{"edgeType":"contains","source":9698,"target":10061},{"edgeType":"calls","source":2933,"target":2930},{"edgeType":"contains","source":5811,"target":5826},{"edgeType":"contains","source":918,"target":1065},{"edgeType":"contains","source":5646,"target":5656},{"edgeType":"contains","source":1116,"target":1269},{"edgeType":"calls","source":11921,"target":11802},{"edgeType":"contains","source":13093,"target":13691},{"edgeType":"contains","source":3332,"target":3397},{"edgeType":"contains","source":5409,"target":5602},{"edgeType":"contains","source":8713,"target":8883},{"edgeType":"calls","source":12556,"target":10088},{"edgeType":"contains","source":4655,"target":4664},{"edgeType":"calls","source":2040,"target":1014},{"edgeType":"calls","source":2638,"target":2562},{"edgeType":"contains","source":4179,"target":4621},{"edgeType":"contains","source":5883,"target":6766},{"edgeType":"contains","source":4457,"target":4460},{"edgeType":"contains","source":2376,"target":2379},{"edgeType":"contains","source":2310,"target":2311},{"edgeType":"calls","source":13073,"target":13086},{"edgeType":"contains","source":1,"target":13636},{"edgeType":"calls","source":2143,"target":2052},{"edgeType":"contains","source":9698,"target":10062},{"edgeType":"calls","source":719,"target":741},{"edgeType":"contains","source":918,"target":1064},{"edgeType":"imports","source":3763,"target":3310},{"edgeType":"contains","source":5646,"target":5657},{"edgeType":"contains","source":7231,"target":7259},{"edgeType":"contains","source":1497,"target":1088},{"edgeType":"contains","source":4655,"target":4663},{"edgeType":"contains","source":9510,"target":9548},{"edgeType":"calls","source":12545,"target":12540},{"edgeType":"imports","source":12355,"target":11791},{"edgeType":"contains","source":4841,"target":5239},{"edgeType":"calls","source":2371,"target":2380},{"edgeType":"calls","source":4089,"target":4088},{"edgeType":"contains","source":426,"target":464},{"edgeType":"imports","source":13843,"target":10059},{"edgeType":"calls","source":2603,"target":2587},{"edgeType":"contains","source":4490,"target":4493},{"edgeType":"contains","source":5883,"target":6767},{"edgeType":"imports","source":4316,"target":4137},{"edgeType":"calls","source":10727,"target":10761},{"edgeType":"contains","source":918,"target":1067},{"edgeType":"contains","source":907,"target":351},{"edgeType":"contains","source":5646,"target":5658},{"edgeType":"calls","source":2143,"target":2049},{"edgeType":"calls","source":5848,"target":2411},{"edgeType":"contains","source":12616,"target":12621},{"edgeType":"imports","source":3763,"target":3311},{"edgeType":"contains","source":8553,"target":8561},{"edgeType":"contains","source":1116,"target":1271},{"edgeType":"contains","source":7001,"target":649},{"edgeType":"contains","source":1385,"target":1386},{"edgeType":"calls","source":3493,"target":3537},{"edgeType":"imports","source":7019,"target":7022},{"edgeType":"contains","source":7033,"target":7056},{"edgeType":"calls","source":8284,"target":8277},{"edgeType":"calls","source":3129,"target":3195},{"edgeType":"calls","source":1017,"target":1018},{"edgeType":"contains","source":9510,"target":9547},{"edgeType":"contains","source":4655,"target":4662},{"edgeType":"contains","source":10367,"target":10461},{"edgeType":"contains","source":2409,"target":2411},{"edgeType":"contains","source":2314,"target":1127},{"edgeType":"contains","source":1,"target":8353},{"edgeType":"contains","source":2376,"target":2377},{"edgeType":"contains","source":918,"target":1066},{"edgeType":"contains","source":5646,"target":5659},{"edgeType":"calls","source":5914,"target":364},{"edgeType":"contains","source":10436,"target":10437},{"edgeType":"contains","source":8454,"target":8458},{"edgeType":"contains","source":1116,"target":1270},{"edgeType":"contains","source":11108,"target":11802},{"edgeType":"contains","source":1385,"target":1387},{"edgeType":"contains","source":9507,"target":9635},{"edgeType":"calls","source":8152,"target":8142},{"edgeType":"contains","source":4457,"target":4465},{"edgeType":"contains","source":12125,"target":11984},{"edgeType":"imports","source":12565,"target":11617},{"edgeType":"contains","source":2409,"target":2416},{"edgeType":"contains","source":2408,"target":2447},{"edgeType":"contains","source":8713,"target":8880},{"edgeType":"contains","source":8520,"target":8521},{"edgeType":"contains","source":12616,"target":12619},{"edgeType":"contains","source":918,"target":1069},{"edgeType":"contains","source":4226,"target":4227},{"edgeType":"calls","source":11155,"target":11241},{"edgeType":"calls","source":5807,"target":5794},{"edgeType":"contains","source":5646,"target":5652},{"edgeType":"contains","source":1116,"target":1273},{"edgeType":"contains","source":9507,"target":9634},{"edgeType":"calls","source":9865,"target":2605},{"edgeType":"calls","source":2056,"target":1571},{"edgeType":"imports","source":13795,"target":12599},{"edgeType":"contains","source":8713,"target":8879},{"edgeType":"contains","source":2310,"target":2315},{"edgeType":"calls","source":2603,"target":2586},{"edgeType":"contains","source":12201,"target":11741},{"edgeType":"contains","source":9852,"target":10569},{"edgeType":"contains","source":918,"target":1068},{"edgeType":"contains","source":4292,"target":4294},{"edgeType":"contains","source":1385,"target":1393},{"edgeType":"contains","source":9510,"target":9540},{"edgeType":"contains","source":9506,"target":9664},{"edgeType":"contains","source":1116,"target":1272},{"edgeType":"contains","source":4655,"target":4667},{"edgeType":"contains","source":8107,"target":8641},{"edgeType":"contains","source":8111,"target":8517},{"edgeType":"imports","source":10237,"target":9798},{"edgeType":"calls","source":7570,"target":1874},{"edgeType":"contains","source":426,"target":468},{"edgeType":"contains","source":8713,"target":8882},{"edgeType":"contains","source":12152,"target":12202},{"edgeType":"contains","source":5961,"target":6459},{"edgeType":"imports","source":3781,"target":3814},{"edgeType":"contains","source":2408,"target":2445},{"edgeType":"calls","source":4427,"target":4177},{"edgeType":"contains","source":2310,"target":2312},{"edgeType":"imports","source":8458,"target":1524},{"edgeType":"contains","source":10538,"target":10440},{"edgeType":"calls","source":4618,"target":4598},{"edgeType":"contains","source":7131,"target":7185},{"edgeType":"contains","source":1,"target":4130},{"edgeType":"contains","source":2277,"target":2278},{"edgeType":"contains","source":8454,"target":8455},{"edgeType":"calls","source":11772,"target":568},{"edgeType":"calls","source":2188,"target":650},{"edgeType":"calls","source":5113,"target":5109},{"edgeType":"contains","source":9852,"target":10566},{"edgeType":"contains","source":3102,"target":3128},{"edgeType":"contains","source":7033,"target":7052},{"edgeType":"contains","source":8983,"target":8968},{"edgeType":"calls","source":5456,"target":5046},{"edgeType":"contains","source":918,"target":1071},{"edgeType":"contains","source":885,"target":3151},{"edgeType":"imports","source":2840,"target":3391},{"edgeType":"contains","source":10270,"target":10293},{"edgeType":"calls","source":1908,"target":1933},{"edgeType":"contains","source":3298,"target":3396},{"edgeType":"imports","source":12901,"target":12832},{"edgeType":"contains","source":8713,"target":8881},{"edgeType":"calls","source":8278,"target":8467},{"edgeType":"contains","source":2409,"target":2415},{"edgeType":"contains","source":10137,"target":10188},{"edgeType":"contains","source":2310,"target":2313},{"edgeType":"calls","source":12897,"target":10088},{"edgeType":"contains","source":1,"target":4128},{"edgeType":"contains","source":4358,"target":4360},{"edgeType":"contains","source":2277,"target":2279},{"edgeType":"calls","source":4419,"target":4424},{"edgeType":"calls","source":2339,"target":2312},{"edgeType":"contains","source":1434,"target":1986},{"edgeType":"contains","source":1385,"target":1391},{"edgeType":"contains","source":918,"target":1070},{"edgeType":"calls","source":1611,"target":1626},{"edgeType":"contains","source":3168,"target":3170},{"edgeType":"contains","source":3194,"target":3421},{"edgeType":"contains","source":3201,"target":3204},{"edgeType":"calls","source":619,"target":629},{"edgeType":"contains","source":9345,"target":9351},{"edgeType":"contains","source":2408,"target":2418},{"edgeType":"contains","source":3260,"target":3489},{"edgeType":"imports","source":2244,"target":1831},{"edgeType":"calls","source":3328,"target":3328},{"edgeType":"imports","source":4316,"target":4193},{"edgeType":"calls","source":8217,"target":8212},{"edgeType":"imports","source":11028,"target":10702},{"edgeType":"contains","source":5409,"target":5578},{"edgeType":"contains","source":9510,"target":9521},{"edgeType":"imports","source":9041,"target":420},{"edgeType":"calls","source":12347,"target":12313},{"edgeType":"contains","source":3921,"target":4139},{"edgeType":"imports","source":11674,"target":3360},{"edgeType":"contains","source":3531,"target":3545},{"edgeType":"contains","source":6141,"target":6142},{"edgeType":"contains","source":6411,"target":6228},{"edgeType":"contains","source":8762,"target":9454},{"edgeType":"calls","source":2204,"target":2233},{"edgeType":"contains","source":4655,"target":4640},{"edgeType":"imports","source":11674,"target":4417},{"edgeType":"contains","source":10643,"target":10338},{"edgeType":"contains","source":8618,"target":8633},{"edgeType":"contains","source":1144,"target":1433},{"edgeType":"contains","source":9345,"target":9350},{"edgeType":"contains","source":1116,"target":1244},{"edgeType":"calls","source":2705,"target":2558},{"edgeType":"imports","source":13797,"target":12599},{"edgeType":"contains","source":3102,"target":3103},{"edgeType":"contains","source":5883,"target":6741},{"edgeType":"imports","source":2314,"target":717},{"edgeType":"imports","source":4316,"target":4194},{"edgeType":"contains","source":3194,"target":3422},{"edgeType":"contains","source":7132,"target":7133},{"edgeType":"contains","source":9173,"target":9397},{"edgeType":"calls","source":13076,"target":12968},{"edgeType":"contains","source":9510,"target":9520},{"edgeType":"contains","source":11261,"target":11265},{"edgeType":"contains","source":3921,"target":4138},{"edgeType":"calls","source":4923,"target":4620},{"edgeType":"calls","source":11155,"target":11213},{"edgeType":"contains","source":4258,"target":4262},{"edgeType":"contains","source":6762,"target":6975},{"edgeType":"contains","source":6339,"target":6347},{"edgeType":"calls","source":5629,"target":4932},{"edgeType":"calls","source":11796,"target":11425},{"edgeType":"calls","source":11980,"target":436},{"edgeType":"contains","source":1116,"target":1243},{"edgeType":"contains","source":8762,"target":9453},{"edgeType":"contains","source":1007,"target":1451},{"edgeType":"contains","source":7231,"target":7236},{"edgeType":"contains","source":1116,"target":1247},{"edgeType":"contains","source":11426,"target":11432},{"edgeType":"calls","source":1379,"target":1383},{"edgeType":"contains","source":7132,"target":7134},{"edgeType":"contains","source":1144,"target":1436},{"edgeType":"contains","source":11294,"target":11296},{"edgeType":"contains","source":12020,"target":12045},{"edgeType":"imports","source":12901,"target":12893},{"edgeType":"contains","source":5710,"target":5763},{"edgeType":"calls","source":8949,"target":8777},{"edgeType":"contains","source":11261,"target":11262},{"edgeType":"calls","source":4654,"target":4502},{"edgeType":"contains","source":9510,"target":9523},{"edgeType":"contains","source":10369,"target":10374},{"edgeType":"calls","source":2403,"target":2404},{"edgeType":"imports","source":3889,"target":3691},{"edgeType":"contains","source":10270,"target":10272},{"edgeType":"contains","source":4380,"target":3650},{"edgeType":"contains","source":6141,"target":6144},{"edgeType":"contains","source":10237,"target":10238},{"edgeType":"contains","source":918,"target":1042},{"edgeType":"contains","source":12280,"target":12442},{"edgeType":"imports","source":7923,"target":7593},{"edgeType":"contains","source":3921,"target":4136},{"edgeType":"contains","source":8618,"target":8634},{"edgeType":"contains","source":1116,"target":1246},{"edgeType":"contains","source":3168,"target":3169},{"edgeType":"contains","source":7231,"target":7237},{"edgeType":"contains","source":11294,"target":11297},{"edgeType":"contains","source":7132,"target":7135},{"edgeType":"calls","source":12897,"target":10059},{"edgeType":"contains","source":5710,"target":5764},{"edgeType":"calls","source":12388,"target":12098},{"edgeType":"contains","source":9510,"target":9522},{"edgeType":"imports","source":11082,"target":568},{"edgeType":"calls","source":223,"target":222},{"edgeType":"contains","source":6238,"target":6309},{"edgeType":"contains","source":10369,"target":10375},{"edgeType":"contains","source":10270,"target":10273},{"edgeType":"contains","source":8762,"target":9455},{"edgeType":"contains","source":12285,"target":12286},{"edgeType":"calls","source":7194,"target":7160},{"edgeType":"contains","source":4750,"target":4863},{"edgeType":"contains","source":8713,"target":8855},{"edgeType":"calls","source":10179,"target":7646},{"edgeType":"calls","source":8812,"target":8798},{"edgeType":"calls","source":685,"target":693},{"edgeType":"calls","source":5542,"target":5512},{"edgeType":"contains","source":3921,"target":4143},{"edgeType":"imports","source":4316,"target":4197},{"edgeType":"calls","source":11155,"target":11216},{"edgeType":"calls","source":2470,"target":2439},{"edgeType":"contains","source":4750,"target":4870},{"edgeType":"contains","source":6238,"target":6302},{"edgeType":"contains","source":8453,"target":8459},{"edgeType":"calls","source":4616,"target":4621},{"edgeType":"contains","source":8321,"target":8323},{"edgeType":"contains","source":10369,"target":10372},{"edgeType":"calls","source":11885,"target":11840},{"edgeType":"contains","source":12280,"target":12440},{"edgeType":"calls","source":7812,"target":687},{"edgeType":"contains","source":918,"target":1044},{"edgeType":"contains","source":8581,"target":8719},{"edgeType":"contains","source":8762,"target":9450},{"edgeType":"contains","source":8762,"target":9449},{"edgeType":"contains","source":1116,"target":1248},{"edgeType":"contains","source":3921,"target":4142},{"edgeType":"imports","source":4316,"target":4198},{"edgeType":"contains","source":10369,"target":10373},{"edgeType":"contains","source":11108,"target":11775},{"edgeType":"contains","source":4841,"target":5219},{"edgeType":"contains","source":1,"target":4102},{"edgeType":"contains","source":8321,"target":8322},{"edgeType":"contains","source":6339,"target":6343},{"edgeType":"contains","source":10270,"target":10271},{"edgeType":"calls","source":2568,"target":2573},{"edgeType":"calls","source":8949,"target":8779},{"edgeType":"calls","source":2286,"target":745},{"edgeType":"contains","source":918,"target":1043},{"edgeType":"contains","source":8591,"target":9465},{"edgeType":"contains","source":12616,"target":12593},{"edgeType":"calls","source":9373,"target":9376},{"edgeType":"imports","source":9170,"target":9110},{"edgeType":"calls","source":2171,"target":1135},{"edgeType":"contains","source":12201,"target":11715},{"edgeType":"contains","source":9345,"target":9349},{"edgeType":"contains","source":1,"target":7276},{"edgeType":"contains","source":918,"target":1047},{"edgeType":"contains","source":1116,"target":1251},{"edgeType":"contains","source":3194,"target":3423},{"edgeType":"contains","source":12020,"target":12041},{"edgeType":"contains","source":8107,"target":8616},{"edgeType":"contains","source":3921,"target":4141},{"edgeType":"calls","source":5484,"target":4137},{"edgeType":"contains","source":9510,"target":9519},{"edgeType":"contains","source":10037,"target":10091},{"edgeType":"contains","source":3531,"target":3547},{"edgeType":"imports","source":4316,"target":4199},{"edgeType":"contains","source":5710,"target":5759},{"edgeType":"calls","source":2469,"target":2468},{"edgeType":"calls","source":11856,"target":11680},{"edgeType":"contains","source":11108,"target":11772},{"edgeType":"contains","source":10369,"target":10370},{"edgeType":"calls","source":2634,"target":2638},{"edgeType":"contains","source":8618,"target":8631},{"edgeType":"contains","source":11091,"target":11242},{"edgeType":"contains","source":8762,"target":9452},{"edgeType":"contains","source":8713,"target":8856},{"edgeType":"calls","source":3491,"target":2498},{"edgeType":"contains","source":918,"target":1046},{"edgeType":"contains","source":3194,"target":3424},{"edgeType":"contains","source":9345,"target":9348},{"edgeType":"contains","source":3152,"target":3669},{"edgeType":"contains","source":3168,"target":3173},{"edgeType":"contains","source":12020,"target":12040},{"edgeType":"calls","source":12385,"target":568},{"edgeType":"calls","source":850,"target":864},{"edgeType":"contains","source":3921,"target":4140},{"edgeType":"calls","source":4650,"target":4621},{"edgeType":"contains","source":6207,"target":6209},{"edgeType":"contains","source":10369,"target":10371},{"edgeType":"calls","source":7160,"target":7161},{"edgeType":"contains","source":918,"target":1045},{"edgeType":"contains","source":8581,"target":8720},{"edgeType":"contains","source":8618,"target":8630},{"edgeType":"contains","source":8762,"target":9451},{"edgeType":"imports","source":11259,"target":9875},{"edgeType":"calls","source":850,"target":859},{"edgeType":"contains","source":9698,"target":10044},{"edgeType":"contains","source":918,"target":1049},{"edgeType":"calls","source":5150,"target":4975},{"edgeType":"contains","source":12716,"target":12677},{"edgeType":"contains","source":11091,"target":11257},{"edgeType":"contains","source":5107,"target":5435},{"edgeType":"contains","source":7231,"target":7242},{"edgeType":"calls","source":12021,"target":2343},{"edgeType":"calls","source":11788,"target":11680},{"edgeType":"calls","source":11821,"target":11714},{"edgeType":"calls","source":1811,"target":665},{"edgeType":"calls","source":3989,"target":3969},{"edgeType":"contains","source":8713,"target":8867},{"edgeType":"contains","source":8676,"target":8957},{"edgeType":"calls","source":12578,"target":12559},{"edgeType":"contains","source":7925,"target":7927},{"edgeType":"calls","source":4722,"target":4502},{"edgeType":"contains","source":11674,"target":12210},{"edgeType":"contains","source":10369,"target":10384},{"edgeType":"contains","source":11808,"target":11227},{"edgeType":"calls","source":7371,"target":6963},{"edgeType":"contains","source":9907,"target":9908},{"edgeType":"contains","source":6203,"target":6342},{"edgeType":"calls","source":8133,"target":1312},{"edgeType":"contains","source":853,"target":949},{"edgeType":"calls","source":5045,"target":5058},{"edgeType":"contains","source":918,"target":1048},{"edgeType":"contains","source":2849,"target":2498},{"edgeType":"contains","source":7629,"target":7588},{"edgeType":"contains","source":9345,"target":9358},{"edgeType":"contains","source":1116,"target":1252},{"edgeType":"contains","source":7231,"target":7243},{"edgeType":"contains","source":6868,"target":6869},{"edgeType":"contains","source":11091,"target":11258},{"edgeType":"contains","source":7132,"target":7141},{"edgeType":"imports","source":7456,"target":921},{"edgeType":"calls","source":12317,"target":568},{"edgeType":"contains","source":6762,"target":6983},{"edgeType":"imports","source":12519,"target":414},{"edgeType":"contains","source":8713,"target":8866},{"edgeType":"calls","source":4843,"target":1807},{"edgeType":"contains","source":853,"target":948},{"edgeType":"imports","source":1139,"target":2269},{"edgeType":"contains","source":7925,"target":7926},{"edgeType":"contains","source":4144,"target":3576},{"edgeType":"contains","source":12152,"target":12191},{"edgeType":"contains","source":9907,"target":9909},{"edgeType":"calls","source":4381,"target":4502},{"edgeType":"contains","source":918,"target":1051},{"edgeType":"contains","source":3848,"target":3237},{"edgeType":"contains","source":7629,"target":7591},{"edgeType":"contains","source":8618,"target":8643},{"edgeType":"contains","source":7125,"target":7359},{"edgeType":"calls","source":6929,"target":6926},{"edgeType":"contains","source":8713,"target":8869},{"edgeType":"contains","source":3961,"target":3963},{"edgeType":"calls","source":6102,"target":6115},{"edgeType":"contains","source":2130,"target":1529},{"edgeType":"contains","source":426,"target":447},{"edgeType":"calls","source":9109,"target":9111},{"edgeType":"contains","source":4179,"target":4604},{"edgeType":"calls","source":619,"target":623},{"edgeType":"imports","source":5835,"target":5723},{"edgeType":"contains","source":7923,"target":7991},{"edgeType":"calls","source":11155,"target":11218},{"edgeType":"calls","source":5004,"target":4213},{"edgeType":"contains","source":5115,"target":5184},{"edgeType":"contains","source":6339,"target":6357},{"edgeType":"contains","source":1007,"target":1462},{"edgeType":"contains","source":853,"target":951},{"edgeType":"contains","source":3889,"target":4079},{"edgeType":"contains","source":8916,"target":8918},{"edgeType":"calls","source":7875,"target":1913},{"edgeType":"contains","source":1116,"target":1254},{"edgeType":"contains","source":13093,"target":13672},{"edgeType":"calls","source":11788,"target":11679},{"edgeType":"contains","source":4750,"target":4871},{"edgeType":"contains","source":4743,"target":5088},{"edgeType":"contains","source":8713,"target":8868},{"edgeType":"contains","source":3961,"target":3962},{"edgeType":"contains","source":5811,"target":5813},{"edgeType":"contains","source":7923,"target":7990},{"edgeType":"contains","source":8087,"target":2906},{"edgeType":"calls","source":2667,"target":2669},{"edgeType":"contains","source":11983,"target":12143},{"edgeType":"contains","source":8107,"target":8628},{"edgeType":"calls","source":9220,"target":2498},{"edgeType":"contains","source":2408,"target":2425},{"edgeType":"contains","source":2314,"target":1116},{"edgeType":"contains","source":7132,"target":7136},{"edgeType":"contains","source":918,"target":1053},{"edgeType":"calls","source":1814,"target":568},{"edgeType":"contains","source":7033,"target":7034},{"edgeType":"contains","source":1116,"target":1257},{"edgeType":"calls","source":11884,"target":11880},{"edgeType":"calls","source":1841,"target":1845},{"edgeType":"imports","source":11616,"target":6211},{"edgeType":"calls","source":8216,"target":8255},{"edgeType":"calls","source":6070,"target":6048},{"edgeType":"calls","source":11157,"target":11162},{"edgeType":"contains","source":6238,"target":6310},{"edgeType":"contains","source":12020,"target":12052},{"edgeType":"contains","source":12152,"target":12188},{"edgeType":"contains","source":12201,"target":11726},{"edgeType":"contains","source":918,"target":1052},{"edgeType":"contains","source":7132,"target":7137},{"edgeType":"calls","source":2171,"target":2187},{"edgeType":"contains","source":7630,"target":7553},{"edgeType":"calls","source":11948,"target":2498},{"edgeType":"contains","source":9444,"target":9456},{"edgeType":"calls","source":2091,"target":436},{"edgeType":"contains","source":6769,"target":6762},{"edgeType":"contains","source":6762,"target":6979},{"edgeType":"calls","source":9509,"target":9396},{"edgeType":"contains","source":12152,"target":12187},{"edgeType":"contains","source":6238,"target":6311},{"edgeType":"contains","source":12201,"target":11725},{"edgeType":"contains","source":1,"target":8338},{"edgeType":"contains","source":1,"target":4113},{"edgeType":"contains","source":7132,"target":7138},{"edgeType":"contains","source":7125,"target":7355},{"edgeType":"calls","source":6540,"target":4190},{"edgeType":"calls","source":5507,"target":4473},{"edgeType":"contains","source":918,"target":1055},{"edgeType":"contains","source":899,"target":587},{"edgeType":"imports","source":1139,"target":148},{"edgeType":"calls","source":2732,"target":649},{"edgeType":"contains","source":10270,"target":10276},{"edgeType":"calls","source":2612,"target":2255},{"edgeType":"calls","source":10633,"target":3095},{"edgeType":"calls","source":11192,"target":11132},{"edgeType":"contains","source":12285,"target":12291},{"edgeType":"contains","source":6339,"target":6352},{"edgeType":"contains","source":7132,"target":7139},{"edgeType":"calls","source":5943,"target":5754},{"edgeType":"calls","source":3493,"target":1371},{"edgeType":"contains","source":918,"target":1054},{"edgeType":"contains","source":5115,"target":5188},{"edgeType":"calls","source":1841,"target":1846},{"edgeType":"contains","source":11196,"target":11168},{"edgeType":"contains","source":1116,"target":1258},{"edgeType":"contains","source":9510,"target":9526},{"edgeType":"imports","source":12276,"target":10059},{"edgeType":"calls","source":1907,"target":1914},{"edgeType":"imports","source":12276,"target":12173},{"edgeType":"imports","source":7551,"target":7495},{"edgeType":"contains","source":8713,"target":8864},{"edgeType":"calls","source":2535,"target":2529},{"edgeType":"calls","source":8978,"target":8947},{"edgeType":"contains","source":3497,"target":3525},{"edgeType":"calls","source":7823,"target":1383},{"edgeType":"contains","source":8762,"target":9438},{"edgeType":"calls","source":3791,"target":3790},{"edgeType":"contains","source":4652,"target":4717},{"edgeType":"contains","source":8542,"target":8858},{"edgeType":"calls","source":6795,"target":6825},{"edgeType":"calls","source":9788,"target":719},{"edgeType":"contains","source":11422,"target":11541},{"edgeType":"calls","source":8359,"target":622},{"edgeType":"calls","source":1392,"target":994},{"edgeType":"contains","source":7163,"target":7211},{"edgeType":"contains","source":10137,"target":10152},{"edgeType":"contains","source":2005,"target":2210},{"edgeType":"imports","source":7334,"target":1524},{"edgeType":"calls","source":1227,"target":824},{"edgeType":"calls","source":12380,"target":12330},{"edgeType":"calls","source":2800,"target":2800},{"edgeType":"imports","source":12538,"target":12500},{"edgeType":"imports","source":6903,"target":1144},{"edgeType":"calls","source":7226,"target":7206},{"edgeType":"contains","source":6762,"target":6959},{"edgeType":"contains","source":10137,"target":10153},{"edgeType":"contains","source":8542,"target":8857},{"edgeType":"contains","source":4652,"target":4716},{"edgeType":"contains","source":8762,"target":9437},{"edgeType":"contains","source":10461,"target":10679},{"edgeType":"calls","source":5886,"target":4381},{"edgeType":"contains","source":4639,"target":5118},{"edgeType":"calls","source":11283,"target":3000},{"edgeType":"contains","source":3663,"target":3664},{"edgeType":"contains","source":1582,"target":1583},{"edgeType":"calls","source":4782,"target":4780},{"edgeType":"contains","source":11836,"target":2936},{"edgeType":"contains","source":10367,"target":10419},{"edgeType":"imports","source":5835,"target":5714},{"edgeType":"calls","source":1571,"target":733},{"edgeType":"calls","source":9108,"target":9117},{"edgeType":"contains","source":1007,"target":1438},{"edgeType":"imports","source":3763,"target":3352},{"edgeType":"calls","source":7556,"target":7548},{"edgeType":"contains","source":4652,"target":4714},{"edgeType":"contains","source":1218,"target":1239},{"edgeType":"calls","source":12380,"target":12328},{"edgeType":"imports","source":10237,"target":9836},{"edgeType":"calls","source":3263,"target":3243},{"edgeType":"contains","source":11822,"target":11825},{"edgeType":"calls","source":719,"target":719},{"edgeType":"contains","source":2005,"target":2208},{"edgeType":"calls","source":1704,"target":837},{"edgeType":"contains","source":10301,"target":10352},{"edgeType":"contains","source":1528,"target":1140},{"edgeType":"calls","source":11155,"target":11194},{"edgeType":"contains","source":590,"target":623},{"edgeType":"contains","source":8762,"target":9439},{"edgeType":"contains","source":547,"target":899},{"edgeType":"contains","source":10461,"target":10677},{"edgeType":"contains","source":1007,"target":1437},{"edgeType":"imports","source":5835,"target":5713},{"edgeType":"calls","source":8876,"target":8909},{"edgeType":"calls","source":1215,"target":1197},{"edgeType":"contains","source":7125,"target":7335},{"edgeType":"calls","source":12379,"target":12360},{"edgeType":"calls","source":13073,"target":13043},{"edgeType":"contains","source":10137,"target":10151},{"edgeType":"contains","source":5710,"target":5748},{"edgeType":"calls","source":728,"target":439},{"edgeType":"contains","source":11822,"target":11824},{"edgeType":"contains","source":10461,"target":10674},{"edgeType":"contains","source":55,"target":298},{"edgeType":"imports","source":1954,"target":1287},{"edgeType":"imports","source":3889,"target":3676},{"edgeType":"contains","source":2005,"target":2214},{"edgeType":"calls","source":3706,"target":3250},{"edgeType":"contains","source":4193,"target":4151},{"edgeType":"contains","source":7163,"target":7207},{"edgeType":"calls","source":9402,"target":9518},{"edgeType":"calls","source":6037,"target":6039},{"edgeType":"contains","source":10831,"target":10832},{"edgeType":"imports","source":2345,"target":794},{"edgeType":"contains","source":10137,"target":10148},{"edgeType":"contains","source":8704,"target":9117},{"edgeType":"contains","source":3194,"target":3408},{"edgeType":"contains","source":9342,"target":9423},{"edgeType":"calls","source":2612,"target":2282},{"edgeType":"contains","source":3152,"target":3653},{"edgeType":"calls","source":933,"target":421},{"edgeType":"imports","source":6756,"target":6762},{"edgeType":"contains","source":8371,"target":414},{"edgeType":"imports","source":10389,"target":3016},{"edgeType":"contains","source":55,"target":297},{"edgeType":"contains","source":7596,"target":7525},{"edgeType":"contains","source":590,"target":625},{"edgeType":"calls","source":5789,"target":4213},{"edgeType":"contains","source":7131,"target":7143},{"edgeType":"contains","source":9173,"target":9376},{"edgeType":"imports","source":11259,"target":9870},{"edgeType":"contains","source":5961,"target":6417},{"edgeType":"contains","source":1116,"target":1231},{"edgeType":"contains","source":1007,"target":1439},{"edgeType":"contains","source":8762,"target":9432},{"edgeType":"imports","source":4179,"target":4201},{"edgeType":"calls","source":5487,"target":5118},{"edgeType":"calls","source":5407,"target":4427},{"edgeType":"calls","source":5239,"target":5407},{"edgeType":"calls","source":1148,"target":1154},{"edgeType":"calls","source":11301,"target":9842},{"edgeType":"calls","source":8977,"target":8954},{"edgeType":"calls","source":11784,"target":11782},{"edgeType":"contains","source":11634,"target":2849},{"edgeType":"contains","source":7131,"target":7144},{"edgeType":"contains","source":8762,"target":9436},{"edgeType":"contains","source":1116,"target":1234},{"edgeType":"calls","source":1545,"target":1534},{"edgeType":"contains","source":2005,"target":2212},{"edgeType":"contains","source":9774,"target":9772},{"edgeType":"contains","source":1385,"target":1349},{"edgeType":"contains","source":2005,"target":2213},{"edgeType":"contains","source":10566,"target":10589},{"edgeType":"contains","source":6407,"target":6334},{"edgeType":"calls","source":11883,"target":11885},{"edgeType":"contains","source":7131,"target":7145},{"edgeType":"contains","source":918,"target":1029},{"edgeType":"contains","source":8783,"target":8784},{"edgeType":"contains","source":6762,"target":6957},{"edgeType":"contains","source":1,"target":10429},{"edgeType":"contains","source":1116,"target":1233},{"edgeType":"calls","source":4757,"target":4492},{"edgeType":"calls","source":2668,"target":2659},{"edgeType":"contains","source":3568,"target":3440},{"edgeType":"calls","source":3309,"target":1814},{"edgeType":"contains","source":2005,"target":2218},{"edgeType":"contains","source":9510,"target":9513},{"edgeType":"imports","source":4179,"target":4187},{"edgeType":"calls","source":2739,"target":454},{"edgeType":"calls","source":385,"target":492},{"edgeType":"contains","source":426,"target":429},{"edgeType":"contains","source":12020,"target":12039},{"edgeType":"calls","source":13040,"target":13020},{"edgeType":"calls","source":4187,"target":4191},{"edgeType":"contains","source":7125,"target":7340},{"edgeType":"contains","source":1007,"target":1444},{"edgeType":"contains","source":8581,"target":8715},{"edgeType":"contains","source":5710,"target":5753},{"edgeType":"contains","source":8618,"target":8625},{"edgeType":"contains","source":3194,"target":3412},{"edgeType":"contains","source":12714,"target":12723},{"edgeType":"calls","source":8278,"target":8426},{"edgeType":"calls","source":9040,"target":9116},{"edgeType":"contains","source":12246,"target":12431},{"edgeType":"calls","source":1778,"target":1704},{"edgeType":"calls","source":1085,"target":989},{"edgeType":"contains","source":7637,"target":3097},{"edgeType":"contains","source":8762,"target":9445},{"edgeType":"imports","source":1111,"target":1007},{"edgeType":"calls","source":6070,"target":6068},{"edgeType":"contains","source":10069,"target":10155},{"edgeType":"calls","source":4255,"target":1026},{"edgeType":"contains","source":590,"target":629},{"edgeType":"calls","source":4220,"target":4224},{"edgeType":"calls","source":4966,"target":4353},{"edgeType":"calls","source":4187,"target":4190},{"edgeType":"contains","source":8557,"target":8401},{"edgeType":"contains","source":8618,"target":8624},{"edgeType":"contains","source":12462,"target":12078},{"edgeType":"calls","source":1346,"target":1354},{"edgeType":"calls","source":3196,"target":3198},{"edgeType":"contains","source":8762,"target":9448},{"edgeType":"contains","source":2005,"target":2216},{"edgeType":"calls","source":7818,"target":491},{"edgeType":"contains","source":9510,"target":9515},{"edgeType":"calls","source":1985,"target":575},{"edgeType":"contains","source":4489,"target":4491},{"edgeType":"contains","source":12020,"target":12037},{"edgeType":"contains","source":6374,"target":6312},{"edgeType":"contains","source":6339,"target":6340},{"edgeType":"contains","source":12516,"target":12517},{"edgeType":"contains","source":6438,"target":6442},{"edgeType":"contains","source":899,"target":566},{"edgeType":"contains","source":853,"target":935},{"edgeType":"contains","source":11422,"target":11547},{"edgeType":"calls","source":1704,"target":829},{"edgeType":"contains","source":2005,"target":2217},{"edgeType":"calls","source":2535,"target":2549},{"edgeType":"contains","source":8762,"target":9447},{"edgeType":"contains","source":9444,"target":9446},{"edgeType":"contains","source":6762,"target":6969},{"edgeType":"calls","source":8278,"target":8430},{"edgeType":"calls","source":7891,"target":1400},{"edgeType":"contains","source":10301,"target":11417},{"edgeType":"imports","source":4179,"target":4190},{"edgeType":"calls","source":10033,"target":10046},{"edgeType":"imports","source":10514,"target":10753},{"edgeType":"contains","source":8618,"target":8626},{"edgeType":"contains","source":8591,"target":9463},{"edgeType":"calls","source":1462,"target":931},{"edgeType":"calls","source":13040,"target":13024},{"edgeType":"calls","source":1161,"target":744},{"edgeType":"calls","source":2470,"target":2447},{"edgeType":"imports","source":4179,"target":4191},{"edgeType":"contains","source":8098,"target":429},{"edgeType":"contains","source":4226,"target":4194},{"edgeType":"contains","source":7163,"target":7215},{"edgeType":"calls","source":7376,"target":454},{"edgeType":"contains","source":885,"target":3116},{"edgeType":"contains","source":8618,"target":8621},{"edgeType":"calls","source":3114,"target":2567},{"edgeType":"contains","source":1007,"target":1448},{"edgeType":"contains","source":9342,"target":9431},{"edgeType":"calls","source":3706,"target":3241},{"edgeType":"contains","source":11259,"target":11313},{"edgeType":"calls","source":6045,"target":5782},{"edgeType":"contains","source":3332,"target":3368},{"edgeType":"contains","source":8762,"target":9441},{"edgeType":"calls","source":12556,"target":10059},{"edgeType":"contains","source":4148,"target":3439},{"edgeType":"calls","source":2568,"target":2581},{"edgeType":"contains","source":8542,"target":8862},{"edgeType":"contains","source":8585,"target":8586},{"edgeType":"contains","source":8618,"target":8620},{"edgeType":"contains","source":7163,"target":7216},{"edgeType":"calls","source":8118,"target":8106},{"edgeType":"contains","source":7296,"target":7321},{"edgeType":"contains","source":10301,"target":10355},{"edgeType":"calls","source":8151,"target":8142},{"edgeType":"contains","source":9510,"target":9511},{"edgeType":"imports","source":13843,"target":10088},{"edgeType":"imports","source":9491,"target":7588},{"edgeType":"contains","source":591,"target":605},{"edgeType":"calls","source":2470,"target":2445},{"edgeType":"contains","source":4489,"target":4495},{"edgeType":"contains","source":4466,"target":4151},{"edgeType":"calls","source":385,"target":490},{"edgeType":"calls","source":4631,"target":4162},{"edgeType":"imports","source":11776,"target":11803},{"edgeType":"calls","source":8944,"target":8928},{"edgeType":"contains","source":7163,"target":7217},{"edgeType":"calls","source":3061,"target":3151},{"edgeType":"contains","source":3531,"target":3539},{"edgeType":"contains","source":11108,"target":11764},{"edgeType":"contains","source":11569,"target":11214},{"edgeType":"calls","source":1214,"target":1216},{"edgeType":"contains","source":3300,"target":3301},{"edgeType":"contains","source":8762,"target":9443},{"edgeType":"contains","source":1,"target":10438},{"edgeType":"calls","source":421,"target":430},{"edgeType":"calls","source":11155,"target":11206},{"edgeType":"calls","source":2573,"target":1367},{"edgeType":"calls","source":4620,"target":4502},{"edgeType":"contains","source":6438,"target":6439},{"edgeType":"calls","source":7126,"target":7150},{"edgeType":"contains","source":8552,"target":8554},{"edgeType":"contains","source":8618,"target":8622},{"edgeType":"contains","source":10697,"target":10745},{"edgeType":"contains","source":1,"target":13579},{"edgeType":"contains","source":11227,"target":11228},{"edgeType":"imports","source":2892,"target":2917},{"edgeType":"calls","source":6439,"target":6349},{"edgeType":"imports","source":12521,"target":12019},{"edgeType":"contains","source":4158,"target":4159},{"edgeType":"imports","source":9507,"target":2919},{"edgeType":"calls","source":11389,"target":3000},{"edgeType":"contains","source":2269,"target":2466},{"edgeType":"calls","source":11891,"target":11749},{"edgeType":"calls","source":3431,"target":3405},{"edgeType":"calls","source":11492,"target":11435},{"edgeType":"contains","source":10697,"target":10746},{"edgeType":"contains","source":7164,"target":7165},{"edgeType":"contains","source":2005,"target":2194},{"edgeType":"contains","source":4257,"target":4260},{"edgeType":"contains","source":10301,"target":10338},{"edgeType":"contains","source":11127,"target":11157},{"edgeType":"contains","source":8485,"target":8494},{"edgeType":"contains","source":10831,"target":10820},{"edgeType":"contains","source":8925,"target":9652},{"edgeType":"calls","source":2603,"target":2645},{"edgeType":"imports","source":1434,"target":1603},{"edgeType":"contains","source":7131,"target":7132},{"edgeType":"calls","source":12356,"target":2618},{"edgeType":"calls","source":12353,"target":12224},{"edgeType":"contains","source":4257,"target":4259},{"edgeType":"imports","source":5835,"target":5764},{"edgeType":"calls","source":7031,"target":7026},{"edgeType":"contains","source":8925,"target":9655},{"edgeType":"contains","source":2269,"target":2464},{"edgeType":"contains","source":590,"target":607},{"edgeType":"contains","source":6762,"target":6943},{"edgeType":"imports","source":7583,"target":1256},{"edgeType":"calls","source":7229,"target":7230},{"edgeType":"calls","source":11689,"target":11667},{"edgeType":"contains","source":3016,"target":3618},{"edgeType":"contains","source":10697,"target":10743},{"edgeType":"contains","source":8542,"target":8844},{"edgeType":"contains","source":1218,"target":1222},{"edgeType":"contains","source":4719,"target":4734},{"edgeType":"calls","source":8815,"target":8801},{"edgeType":"calls","source":391,"target":398},{"edgeType":"imports","source":646,"target":663},{"edgeType":"imports","source":891,"target":1524},{"edgeType":"contains","source":2005,"target":2192},{"edgeType":"contains","source":55,"target":279},{"edgeType":"contains","source":2269,"target":2465},{"edgeType":"calls","source":9244,"target":9244},{"edgeType":"contains","source":8542,"target":8843},{"edgeType":"contains","source":10831,"target":10818},{"edgeType":"contains","source":3143,"target":1796},{"edgeType":"contains","source":918,"target":1008},{"edgeType":"contains","source":10697,"target":10744},{"edgeType":"contains","source":6700,"target":6745},{"edgeType":"calls","source":2770,"target":2751},{"edgeType":"contains","source":9507,"target":9577},{"edgeType":"imports","source":11864,"target":679},{"edgeType":"contains","source":11423,"target":11490},{"edgeType":"contains","source":3741,"target":3348},{"edgeType":"contains","source":9740,"target":9754},{"edgeType":"calls","source":347,"target":700},{"edgeType":"calls","source":5117,"target":5045},{"edgeType":"contains","source":7629,"target":7544},{"edgeType":"calls","source":391,"target":393},{"edgeType":"imports","source":646,"target":659},{"edgeType":"contains","source":547,"target":885},{"edgeType":"contains","source":4652,"target":4704},{"edgeType":"contains","source":8551,"target":8559},{"edgeType":"contains","source":8925,"target":9649},{"edgeType":"contains","source":10893,"target":11007},{"edgeType":"calls","source":9376,"target":9382},{"edgeType":"contains","source":11423,"target":11491},{"edgeType":"imports","source":2314,"target":1803},{"edgeType":"contains","source":1007,"target":1423},{"edgeType":"contains","source":6700,"target":6746},{"edgeType":"contains","source":5083,"target":5084},{"edgeType":"calls","source":1521,"target":1301},{"edgeType":"calls","source":3398,"target":3368},{"edgeType":"contains","source":7425,"target":7526},{"edgeType":"calls","source":2571,"target":2579},{"edgeType":"calls","source":6499,"target":266},{"edgeType":"contains","source":9740,"target":9755},{"edgeType":"calls","source":12418,"target":12330},{"edgeType":"calls","source":12353,"target":12231},{"edgeType":"calls","source":2276,"target":2211},{"edgeType":"contains","source":8353,"target":8354},{"edgeType":"contains","source":2005,"target":2199},{"edgeType":"contains","source":8551,"target":8558},{"edgeType":"contains","source":8485,"target":8490},{"edgeType":"contains","source":8925,"target":9648},{"edgeType":"calls","source":9211,"target":9212},{"edgeType":"contains","source":2269,"target":2471},{"edgeType":"calls","source":13046,"target":12945},{"edgeType":"contains","source":10697,"target":10742},{"edgeType":"contains","source":4719,"target":4740},{"edgeType":"contains","source":1007,"target":1426},{"edgeType":"calls","source":4715,"target":4820},{"edgeType":"contains","source":7425,"target":7527},{"edgeType":"contains","source":11423,"target":11488},{"edgeType":"contains","source":1,"target":8300},{"edgeType":"calls","source":6734,"target":6723},{"edgeType":"contains","source":9342,"target":9409},{"edgeType":"contains","source":2005,"target":2195},{"edgeType":"calls","source":3233,"target":3195},{"edgeType":"calls","source":8121,"target":8122},{"edgeType":"calls","source":1680,"target":1660},{"edgeType":"calls","source":5816,"target":4514},{"edgeType":"contains","source":10566,"target":10572},{"edgeType":"contains","source":4179,"target":4567},{"edgeType":"contains","source":2269,"target":2468},{"edgeType":"contains","source":10461,"target":10656},{"edgeType":"contains","source":6462,"target":6726},{"edgeType":"calls","source":7461,"target":7441},{"edgeType":"contains","source":8925,"target":9651},{"edgeType":"calls","source":1928,"target":1371},{"edgeType":"contains","source":4719,"target":4739},{"edgeType":"contains","source":5981,"target":5782},{"edgeType":"contains","source":7425,"target":7528},{"edgeType":"contains","source":9342,"target":9408},{"edgeType":"calls","source":12320,"target":568},{"edgeType":"calls","source":12260,"target":1371},{"edgeType":"calls","source":12380,"target":2936},{"edgeType":"contains","source":2005,"target":2197},{"edgeType":"contains","source":3427,"target":3566},{"edgeType":"contains","source":8485,"target":8492},{"edgeType":"contains","source":10566,"target":10573},{"edgeType":"contains","source":6339,"target":6312},{"edgeType":"contains","source":2269,"target":2469},{"edgeType":"contains","source":4719,"target":4738},{"edgeType":"contains","source":6462,"target":6727},{"edgeType":"contains","source":8925,"target":9650},{"edgeType":"contains","source":10880,"target":10352},{"edgeType":"contains","source":8485,"target":8503},{"edgeType":"contains","source":3741,"target":3352},{"edgeType":"contains","source":11261,"target":11239},{"edgeType":"contains","source":1,"target":8302},{"edgeType":"imports","source":5835,"target":5753},{"edgeType":"contains","source":8542,"target":8850},{"edgeType":"contains","source":1007,"target":1428},{"edgeType":"contains","source":7629,"target":7556},{"edgeType":"contains","source":8925,"target":9662},{"edgeType":"calls","source":5076,"target":1026},{"edgeType":"contains","source":9173,"target":9373},{"edgeType":"contains","source":2005,"target":2202},{"edgeType":"calls","source":5215,"target":5174},{"edgeType":"imports","source":7583,"target":4417},{"edgeType":"calls","source":8290,"target":8170},{"edgeType":"imports","source":9698,"target":1218},{"edgeType":"imports","source":7583,"target":7588},{"edgeType":"contains","source":8762,"target":9429},{"edgeType":"contains","source":8783,"target":8778},{"edgeType":"contains","source":6568,"target":6621},{"edgeType":"contains","source":10301,"target":10345},{"edgeType":"calls","source":11986,"target":11985},{"edgeType":"contains","source":8542,"target":8849},{"edgeType":"contains","source":8485,"target":8502},{"edgeType":"calls","source":12022,"target":11926},{"edgeType":"contains","source":1007,"target":1427},{"edgeType":"contains","source":7629,"target":7555},{"edgeType":"contains","source":6900,"target":6901},{"edgeType":"contains","source":10983,"target":10345},{"edgeType":"calls","source":12154,"target":2549},{"edgeType":"calls","source":7956,"target":7955},{"edgeType":"contains","source":2005,"target":2203},{"edgeType":"imports","source":10237,"target":9878},{"edgeType":"contains","source":12280,"target":12418},{"edgeType":"calls","source":11287,"target":3000},{"edgeType":"contains","source":8925,"target":9660},{"edgeType":"contains","source":6832,"target":6894},{"edgeType":"imports","source":2892,"target":2924},{"edgeType":"contains","source":8762,"target":9428},{"edgeType":"imports","source":1497,"target":717},{"edgeType":"contains","source":6568,"target":6622},{"edgeType":"contains","source":4652,"target":4707},{"edgeType":"contains","source":4639,"target":5110},{"edgeType":"contains","source":5883,"target":6717},{"edgeType":"contains","source":9852,"target":10524},{"edgeType":"contains","source":12185,"target":12192},{"edgeType":"calls","source":12379,"target":2970},{"edgeType":"contains","source":4981,"target":5078},{"edgeType":"calls","source":11887,"target":11880},{"edgeType":"contains","source":547,"target":891},{"edgeType":"calls","source":504,"target":59},{"edgeType":"calls","source":6080,"target":5839},{"edgeType":"contains","source":10461,"target":10668},{"edgeType":"contains","source":8197,"target":521},{"edgeType":"contains","source":12119,"target":12123},{"edgeType":"calls","source":5110,"target":1026},{"edgeType":"calls","source":757,"target":671},{"edgeType":"contains","source":8925,"target":9663},{"edgeType":"calls","source":10250,"target":7663},{"edgeType":"contains","source":1218,"target":1230},{"edgeType":"contains","source":11127,"target":11164},{"edgeType":"calls","source":11921,"target":11884},{"edgeType":"contains","source":8762,"target":9430},{"edgeType":"calls","source":2538,"target":2539},{"edgeType":"calls","source":454,"target":551},{"edgeType":"calls","source":6039,"target":6052},{"edgeType":"imports","source":7551,"target":7524},{"edgeType":"contains","source":12119,"target":12122},{"edgeType":"contains","source":4639,"target":5108},{"edgeType":"contains","source":10137,"target":10143},{"edgeType":"calls","source":3570,"target":3312},{"edgeType":"contains","source":8542,"target":8846},{"edgeType":"contains","source":891,"target":1857},{"edgeType":"contains","source":10566,"target":10582},{"edgeType":"imports","source":12901,"target":5512},{"edgeType":"imports","source":9207,"target":9044},{"edgeType":"contains","source":1007,"target":1432},{"edgeType":"contains","source":1116,"target":1224},{"edgeType":"contains","source":7596,"target":7518},{"edgeType":"contains","source":7488,"target":7694},{"edgeType":"contains","source":4652,"target":4712},{"edgeType":"calls","source":3175,"target":1815},{"edgeType":"contains","source":6041,"target":6042},{"edgeType":"contains","source":8925,"target":9657},{"edgeType":"contains","source":12152,"target":12155},{"edgeType":"calls","source":2770,"target":2743},{"edgeType":"contains","source":8762,"target":9425},{"edgeType":"contains","source":2005,"target":2206},{"edgeType":"calls","source":6734,"target":6730},{"edgeType":"contains","source":2269,"target":2479},{"edgeType":"imports","source":4179,"target":4242},{"edgeType":"imports","source":2244,"target":1867},{"edgeType":"contains","source":11127,"target":11162},{"edgeType":"contains","source":1007,"target":1431},{"edgeType":"calls","source":10230,"target":3000},{"edgeType":"contains","source":7593,"target":7610},{"edgeType":"contains","source":3073,"target":2924},{"edgeType":"contains","source":9507,"target":9584},{"edgeType":"contains","source":3260,"target":3469},{"edgeType":"contains","source":8925,"target":9656},{"edgeType":"calls","source":2571,"target":2571},{"edgeType":"contains","source":590,"target":616},{"edgeType":"contains","source":6041,"target":6043},{"edgeType":"contains","source":4639,"target":5114},{"edgeType":"contains","source":4652,"target":4711},{"edgeType":"calls","source":1156,"target":980},{"edgeType":"imports","source":7583,"target":7591},{"edgeType":"calls","source":390,"target":415},{"edgeType":"contains","source":12119,"target":12120},{"edgeType":"contains","source":8762,"target":9424},{"edgeType":"calls","source":757,"target":665},{"edgeType":"imports","source":4132,"target":414},{"edgeType":"contains","source":6568,"target":6618},{"edgeType":"contains","source":8485,"target":8501},{"edgeType":"contains","source":10697,"target":10747},{"edgeType":"contains","source":8542,"target":8848},{"edgeType":"calls","source":7203,"target":649},{"edgeType":"contains","source":2837,"target":2838},{"edgeType":"contains","source":3107,"target":2924},{"edgeType":"contains","source":7629,"target":7554},{"edgeType":"imports","source":2892,"target":2919},{"edgeType":"calls","source":11570,"target":11140},{"edgeType":"contains","source":5409,"target":270},{"edgeType":"calls","source":3493,"target":3583},{"edgeType":"contains","source":1116,"target":1226},{"edgeType":"calls","source":1121,"target":1011},{"edgeType":"contains","source":590,"target":619},{"edgeType":"contains","source":8762,"target":9427},{"edgeType":"contains","source":8925,"target":9659},{"edgeType":"contains","source":4652,"target":4710},{"edgeType":"contains","source":4750,"target":4843},{"edgeType":"contains","source":6912,"target":7582},{"edgeType":"contains","source":10137,"target":10138},{"edgeType":"contains","source":2269,"target":2477},{"edgeType":"contains","source":7125,"target":7323},{"edgeType":"contains","source":8542,"target":8847},{"edgeType":"contains","source":4981,"target":5081},{"edgeType":"calls","source":4395,"target":4160},{"edgeType":"contains","source":10697,"target":10748},{"edgeType":"contains","source":12713,"target":12730},{"edgeType":"calls","source":5808,"target":5810},{"edgeType":"imports","source":9041,"target":448},{"edgeType":"calls","source":6701,"target":6699},{"edgeType":"calls","source":11292,"target":733},{"edgeType":"contains","source":590,"target":618},{"edgeType":"contains","source":8762,"target":9426},{"edgeType":"contains","source":8925,"target":9658},{"edgeType":"contains","source":6832,"target":6892},{"edgeType":"imports","source":7583,"target":7593},{"edgeType":"calls","source":2592,"target":2975},{"edgeType":"contains","source":11028,"target":11038},{"edgeType":"contains","source":2269,"target":2449},{"edgeType":"contains","source":3495,"target":3554},{"edgeType":"contains","source":13042,"target":13084},{"edgeType":"calls","source":1417,"target":1376},{"edgeType":"contains","source":4743,"target":5034},{"edgeType":"contains","source":4719,"target":4721},{"edgeType":"contains","source":10893,"target":10995},{"edgeType":"contains","source":6700,"target":6733},{"edgeType":"contains","source":918,"target":991},{"edgeType":"calls","source":7868,"target":2201},{"edgeType":"contains","source":8591,"target":9420},{"edgeType":"contains","source":8762,"target":9405},{"edgeType":"contains","source":6762,"target":6925},{"edgeType":"contains","source":8713,"target":8810},{"edgeType":"contains","source":12750,"target":12623},{"edgeType":"calls","source":3959,"target":3966},{"edgeType":"contains","source":11423,"target":11477},{"edgeType":"calls","source":1160,"target":886},{"edgeType":"contains","source":7425,"target":7512},{"edgeType":"calls","source":3200,"target":3183},{"edgeType":"contains","source":7488,"target":7673},{"edgeType":"contains","source":3728,"target":3731},{"edgeType":"imports","source":646,"target":647},{"edgeType":"contains","source":9740,"target":9742},{"edgeType":"contains","source":7692,"target":7693},{"edgeType":"calls","source":12418,"target":12308},{"edgeType":"contains","source":10301,"target":10321},{"edgeType":"contains","source":13042,"target":13083},{"edgeType":"contains","source":2269,"target":2450},{"edgeType":"calls","source":7856,"target":7859},{"edgeType":"calls","source":13071,"target":13206},{"edgeType":"contains","source":918,"target":990},{"edgeType":"contains","source":10461,"target":10646},{"edgeType":"contains","source":8713,"target":8809},{"edgeType":"imports","source":1954,"target":266},{"edgeType":"contains","source":6700,"target":6734},{"edgeType":"contains","source":8762,"target":9404},{"edgeType":"contains","source":8713,"target":8808},{"edgeType":"contains","source":10698,"target":10699},{"edgeType":"contains","source":4652,"target":4682},{"edgeType":"calls","source":12177,"target":11324},{"edgeType":"contains","source":9465,"target":9808},{"edgeType":"contains","source":9442,"target":9464},{"edgeType":"contains","source":561,"target":429},{"edgeType":"contains","source":3728,"target":3730},{"edgeType":"contains","source":7425,"target":7513},{"edgeType":"contains","source":5644,"target":5645},{"edgeType":"contains","source":9740,"target":9743},{"edgeType":"contains","source":1831,"target":2287},{"edgeType":"contains","source":13042,"target":13082},{"edgeType":"imports","source":12152,"target":3360},{"edgeType":"contains","source":3571,"target":3310},{"edgeType":"contains","source":10893,"target":10993},{"edgeType":"contains","source":6462,"target":6713},{"edgeType":"contains","source":9106,"target":857},{"edgeType":"calls","source":1812,"target":1817},{"edgeType":"contains","source":10697,"target":10726},{"edgeType":"contains","source":3016,"target":3602},{"edgeType":"contains","source":6700,"target":6735},{"edgeType":"contains","source":6635,"target":6636},{"edgeType":"contains","source":1831,"target":2284},{"edgeType":"imports","source":4179,"target":4231},{"edgeType":"contains","source":2005,"target":2175},{"edgeType":"contains","source":7629,"target":7534},{"edgeType":"contains","source":5644,"target":5646},{"edgeType":"contains","source":7596,"target":7500},{"edgeType":"contains","source":11028,"target":11037},{"edgeType":"imports","source":7923,"target":7610},{"edgeType":"contains","source":6762,"target":6928},{"edgeType":"contains","source":6462,"target":6714},{"edgeType":"contains","source":6635,"target":6637},{"edgeType":"contains","source":8713,"target":8811},{"edgeType":"calls","source":7335,"target":7099},{"edgeType":"contains","source":8591,"target":9421},{"edgeType":"contains","source":1831,"target":2285},{"edgeType":"calls","source":2681,"target":1302},{"edgeType":"contains","source":13472,"target":13492},{"edgeType":"contains","source":4743,"target":5030},{"edgeType":"contains","source":9740,"target":9741},{"edgeType":"imports","source":12276,"target":10088},{"edgeType":"calls","source":4429,"target":4191},{"edgeType":"contains","source":10461,"target":10641},{"edgeType":"contains","source":3495,"target":3558},{"edgeType":"calls","source":1711,"target":1771},{"edgeType":"calls","source":4493,"target":4321},{"edgeType":"calls","source":1516,"target":1474},{"edgeType":"contains","source":2269,"target":2453},{"edgeType":"contains","source":4981,"target":5059},{"edgeType":"contains","source":885,"target":3075},{"edgeType":"contains","source":10697,"target":10724},{"edgeType":"calls","source":11184,"target":3000},{"edgeType":"contains","source":13042,"target":13080},{"edgeType":"contains","source":9178,"target":9189},{"edgeType":"contains","source":9173,"target":9344},{"edgeType":"contains","source":6932,"target":6936},{"edgeType":"contains","source":704,"target":230},{"edgeType":"contains","source":8925,"target":9633},{"edgeType":"contains","source":7425,"target":7508},{"edgeType":"contains","source":8713,"target":8805},{"edgeType":"contains","source":12099,"target":11659},{"edgeType":"contains","source":13472,"target":13491},{"edgeType":"contains","source":9465,"target":9805},{"edgeType":"contains","source":11423,"target":11473},{"edgeType":"contains","source":12018,"target":12056},{"edgeType":"contains","source":3495,"target":3559},{"edgeType":"contains","source":3741,"target":3332},{"edgeType":"contains","source":11133,"target":10951},{"edgeType":"contains","source":10461,"target":10642},{"edgeType":"contains","source":7780,"target":8130},{"edgeType":"calls","source":9108,"target":9217},{"edgeType":"calls","source":12485,"target":12351},{"edgeType":"contains","source":10301,"target":11374},{"edgeType":"contains","source":13042,"target":13079},{"edgeType":"contains","source":2269,"target":2454},{"edgeType":"contains","source":4361,"target":4194},{"edgeType":"contains","source":6831,"target":6897},{"edgeType":"contains","source":4983,"target":4996},{"edgeType":"contains","source":6762,"target":6922},{"edgeType":"contains","source":9178,"target":9188},{"edgeType":"contains","source":4719,"target":4724},{"edgeType":"contains","source":9465,"target":9804},{"edgeType":"contains","source":6762,"target":6921},{"edgeType":"contains","source":13472,"target":13490},{"edgeType":"calls","source":3266,"target":3248},{"edgeType":"contains","source":8713,"target":8804},{"edgeType":"contains","source":11423,"target":11474},{"edgeType":"contains","source":1510,"target":1672},{"edgeType":"imports","source":1434,"target":1584},{"edgeType":"contains","source":3728,"target":3734},{"edgeType":"calls","source":4874,"target":4137},{"edgeType":"contains","source":3495,"target":3556},{"edgeType":"calls","source":11120,"target":11324},{"edgeType":"contains","source":7596,"target":7495},{"edgeType":"contains","source":6831,"target":6898},{"edgeType":"contains","source":13042,"target":13078},{"edgeType":"contains","source":3016,"target":3606},{"edgeType":"imports","source":7908,"target":679},{"edgeType":"contains","source":9173,"target":9346},{"edgeType":"calls","source":5717,"target":4429},{"edgeType":"contains","source":8762,"target":9403},{"edgeType":"contains","source":8676,"target":8897},{"edgeType":"contains","source":10910,"target":10461},{"edgeType":"contains","source":6700,"target":6730},{"edgeType":"contains","source":7425,"target":7510},{"edgeType":"contains","source":13472,"target":13489},{"edgeType":"contains","source":3728,"target":3733},{"edgeType":"calls","source":11802,"target":11324},{"edgeType":"contains","source":3495,"target":3555},{"edgeType":"contains","source":11255,"target":10338},{"edgeType":"calls","source":454,"target":571},{"edgeType":"contains","source":10461,"target":10640},{"edgeType":"calls","source":7427,"target":7423},{"edgeType":"calls","source":5653,"target":5355},{"edgeType":"contains","source":9178,"target":9190},{"edgeType":"calls","source":13046,"target":12926},{"edgeType":"calls","source":9511,"target":3068},{"edgeType":"contains","source":13042,"target":13077},{"edgeType":"imports","source":2350,"target":668},{"edgeType":"calls","source":6009,"target":5946},{"edgeType":"contains","source":6831,"target":6899},{"edgeType":"contains","source":8067,"target":7692},{"edgeType":"contains","source":8713,"target":8806},{"edgeType":"contains","source":12283,"target":12294},{"edgeType":"contains","source":7425,"target":7511},{"edgeType":"imports","source":1672,"target":1603},{"edgeType":"contains","source":9465,"target":9806},{"edgeType":"contains","source":13472,"target":13488},{"edgeType":"contains","source":5342,"target":5492},{"edgeType":"imports","source":1434,"target":1582},{"edgeType":"imports","source":4179,"target":4236},{"edgeType":"imports","source":12901,"target":12906},{"edgeType":"contains","source":3728,"target":3732},{"edgeType":"calls","source":5117,"target":5058},{"edgeType":"contains","source":9542,"target":9545},{"edgeType":"contains","source":4652,"target":4692},{"edgeType":"calls","source":8780,"target":8820},{"edgeType":"contains","source":6635,"target":6642},{"edgeType":"contains","source":10301,"target":11385},{"edgeType":"contains","source":2269,"target":2457},{"edgeType":"calls","source":12817,"target":12633},{"edgeType":"contains","source":7163,"target":7186},{"edgeType":"contains","source":11259,"target":11284},{"edgeType":"contains","source":6462,"target":6720},{"edgeType":"imports","source":646,"target":655},{"edgeType":"contains","source":8452,"target":8453},{"edgeType":"calls","source":4770,"target":4187},{"edgeType":"contains","source":918,"target":999},{"edgeType":"contains","source":8551,"target":8555},{"edgeType":"contains","source":5710,"target":5720},{"edgeType":"contains","source":10566,"target":10570},{"edgeType":"contains","source":3497,"target":3501},{"edgeType":"contains","source":8925,"target":9645},{"edgeType":"contains","source":12812,"target":12823},{"edgeType":"calls","source":1215,"target":230},{"edgeType":"calls","source":5172,"target":4409},{"edgeType":"contains","source":11187,"target":10345},{"edgeType":"imports","source":3037,"target":2641},{"edgeType":"contains","source":4719,"target":4728},{"edgeType":"contains","source":7425,"target":7522},{"edgeType":"contains","source":8925,"target":9644},{"edgeType":"contains","source":11423,"target":11487},{"edgeType":"contains","source":6700,"target":6742},{"edgeType":"imports","source":1511,"target":266},{"edgeType":"imports","source":4179,"target":4221},{"edgeType":"calls","source":4324,"target":4270},{"edgeType":"contains","source":2269,"target":2458},{"edgeType":"calls","source":13010,"target":12991},{"edgeType":"contains","source":3741,"target":3335},{"edgeType":"contains","source":9173,"target":9355},{"edgeType":"imports","source":646,"target":656},{"edgeType":"calls","source":5495,"target":4965},{"edgeType":"calls","source":658,"target":584},{"edgeType":"contains","source":10566,"target":10571},{"edgeType":"contains","source":11423,"target":11486},{"edgeType":"imports","source":11674,"target":2310},{"edgeType":"contains","source":3469,"target":3311},{"edgeType":"calls","source":8154,"target":8142},{"edgeType":"contains","source":9342,"target":9401},{"edgeType":"contains","source":7425,"target":7523},{"edgeType":"contains","source":6762,"target":6935},{"edgeType":"contains","source":4719,"target":4727},{"edgeType":"calls","source":4657,"target":4516},{"edgeType":"contains","source":6700,"target":6743},{"edgeType":"contains","source":10461,"target":10651},{"edgeType":"calls","source":9110,"target":9162},{"edgeType":"calls","source":2289,"target":1817},{"edgeType":"contains","source":12246,"target":12397},{"edgeType":"calls","source":9244,"target":9237},{"edgeType":"imports","source":646,"target":653},{"edgeType":"calls","source":1462,"target":1031},{"edgeType":"contains","source":6462,"target":6722},{"edgeType":"contains","source":4981,"target":5061},{"edgeType":"contains","source":885,"target":2024},{"edgeType":"contains","source":9740,"target":9748},{"edgeType":"contains","source":8925,"target":9647},{"edgeType":"contains","source":12812,"target":12821},{"edgeType":"calls","source":3067,"target":3068},{"edgeType":"contains","source":6700,"target":6744},{"edgeType":"contains","source":8762,"target":9414},{"edgeType":"calls","source":454,"target":567},{"edgeType":"contains","source":4981,"target":5060},{"edgeType":"contains","source":2269,"target":2456},{"edgeType":"calls","source":6653,"target":6052},{"edgeType":"calls","source":8815,"target":8793},{"edgeType":"contains","source":10301,"target":11384},{"edgeType":"imports","source":4179,"target":4223},{"edgeType":"contains","source":12280,"target":12399},{"edgeType":"contains","source":3778,"target":3243},{"edgeType":"imports","source":646,"target":654},{"edgeType":"contains","source":3728,"target":3736},{"edgeType":"contains","source":8419,"target":8420},{"edgeType":"contains","source":918,"target":1000},{"edgeType":"contains","source":9740,"target":9749},{"edgeType":"contains","source":11423,"target":11484},{"edgeType":"contains","source":11422,"target":11515},{"edgeType":"contains","source":8925,"target":9646},{"edgeType":"contains","source":9173,"target":9357},{"edgeType":"contains","source":4719,"target":4733},{"edgeType":"contains","source":8925,"target":9641},{"edgeType":"contains","source":10880,"target":10345},{"edgeType":"contains","source":6700,"target":6737},{"edgeType":"contains","source":6762,"target":6929},{"edgeType":"contains","source":10145,"target":9875},{"edgeType":"calls","source":758,"target":651},{"edgeType":"contains","source":2005,"target":2189},{"edgeType":"contains","source":6462,"target":6715},{"edgeType":"contains","source":8542,"target":8829},{"edgeType":"contains","source":12280,"target":12398},{"edgeType":"contains","source":260,"target":261},{"edgeType":"calls","source":4935,"target":4353},{"edgeType":"contains","source":8542,"target":8830},{"edgeType":"contains","source":12647,"target":12649},{"edgeType":"contains","source":9173,"target":9352},{"edgeType":"contains","source":10697,"target":10733},{"edgeType":"contains","source":3495,"target":3567},{"edgeType":"calls","source":13179,"target":13043},{"edgeType":"contains","source":5644,"target":5648},{"edgeType":"contains","source":7425,"target":7516},{"edgeType":"contains","source":9740,"target":9746},{"edgeType":"calls","source":1812,"target":745},{"edgeType":"contains","source":7692,"target":7697},{"edgeType":"contains","source":4920,"target":4844},{"edgeType":"imports","source":646,"target":651},{"edgeType":"contains","source":3332,"target":3335},{"edgeType":"contains","source":1836,"target":1087},{"edgeType":"contains","source":4719,"target":4732},{"edgeType":"contains","source":6700,"target":6738},{"edgeType":"imports","source":1797,"target":1966},{"edgeType":"calls","source":2373,"target":2383},{"edgeType":"calls","source":9908,"target":9794},{"edgeType":"contains","source":12716,"target":12623},{"edgeType":"contains","source":2269,"target":2463},{"edgeType":"contains","source":7163,"target":7183},{"edgeType":"contains","source":12647,"target":12648},{"edgeType":"contains","source":10566,"target":10567},{"edgeType":"calls","source":12041,"target":11324},{"edgeType":"contains","source":12812,"target":12818},{"edgeType":"contains","source":5644,"target":5649},{"edgeType":"contains","source":9740,"target":9747},{"edgeType":"imports","source":7072,"target":1218},{"edgeType":"contains","source":7692,"target":7696},{"edgeType":"calls","source":3266,"target":3240},{"edgeType":"calls","source":6069,"target":6193},{"edgeType":"contains","source":8925,"target":9643},{"edgeType":"contains","source":4652,"target":4694},{"edgeType":"imports","source":12499,"target":11617},{"edgeType":"calls","source":2445,"target":148},{"edgeType":"contains","source":6635,"target":6640},{"edgeType":"imports","source":5860,"target":740},{"edgeType":"imports","source":11776,"target":11836},{"edgeType":"contains","source":2269,"target":2459},{"edgeType":"calls","source":2571,"target":2584},{"edgeType":"calls","source":3637,"target":3363},{"edgeType":"contains","source":6462,"target":6718},{"edgeType":"contains","source":5086,"target":4981},{"edgeType":"contains","source":12812,"target":12817},{"edgeType":"calls","source":4976,"target":4137},{"edgeType":"contains","source":9740,"target":9744},{"edgeType":"contains","source":9342,"target":9400},{"edgeType":"contains","source":4719,"target":4730},{"edgeType":"calls","source":5438,"target":2498},{"edgeType":"calls","source":6734,"target":6716},{"edgeType":"contains","source":10270,"target":10227},{"edgeType":"contains","source":8107,"target":8574},{"edgeType":"contains","source":11091,"target":11202},{"edgeType":"contains","source":8925,"target":9642},{"edgeType":"contains","source":13042,"target":13085},{"edgeType":"contains","source":6635,"target":6641},{"edgeType":"calls","source":2670,"target":2687},{"edgeType":"calls","source":8780,"target":8825},{"edgeType":"calls","source":454,"target":563},{"edgeType":"calls","source":12749,"target":12628},{"edgeType":"contains","source":2269,"target":2461},{"edgeType":"contains","source":8551,"target":8552},{"edgeType":"contains","source":4389,"target":4390},{"edgeType":"contains","source":6462,"target":6719},{"edgeType":"contains","source":12713,"target":12714},{"edgeType":"calls","source":2836,"target":2827},{"edgeType":"calls","source":9244,"target":9240},{"edgeType":"contains","source":3743,"target":3275},{"edgeType":"contains","source":3495,"target":3564},{"edgeType":"contains","source":9342,"target":9399},{"edgeType":"contains","source":11423,"target":11480},{"edgeType":"contains","source":1349,"target":1384},{"edgeType":"contains","source":9342,"target":9378},{"edgeType":"contains","source":7425,"target":7496},{"edgeType":"imports","source":4179,"target":4278},{"edgeType":"contains","source":3741,"target":3311},{"edgeType":"calls","source":8949,"target":8841},{"edgeType":"calls","source":1150,"target":1147},{"edgeType":"calls","source":2504,"target":2512},{"edgeType":"calls","source":4619,"target":4598},{"edgeType":"contains","source":3952,"target":4169},{"edgeType":"contains","source":4223,"target":4225},{"edgeType":"contains","source":7625,"target":7639},{"edgeType":"contains","source":11058,"target":11148},{"edgeType":"contains","source":2139,"target":2235},{"edgeType":"calls","source":1679,"target":1660},{"edgeType":"contains","source":9044,"target":9102},{"edgeType":"contains","source":3490,"target":2636},{"edgeType":"contains","source":4380,"target":3586},{"edgeType":"contains","source":9106,"target":838},{"edgeType":"contains","source":9173,"target":9331},{"edgeType":"contains","source":918,"target":974},{"edgeType":"contains","source":4841,"target":5150},{"edgeType":"contains","source":6700,"target":6716},{"edgeType":"calls","source":11763,"target":3000},{"edgeType":"contains","source":12644,"target":12721},{"edgeType":"calls","source":7814,"target":687},{"edgeType":"imports","source":6891,"target":6883},{"edgeType":"contains","source":402,"target":1114},{"edgeType":"contains","source":1,"target":13545},{"edgeType":"contains","source":7425,"target":7497},{"edgeType":"calls","source":8946,"target":8933},{"edgeType":"contains","source":3952,"target":4168},{"edgeType":"contains","source":9044,"target":9101},{"edgeType":"contains","source":11058,"target":11149},{"edgeType":"calls","source":12545,"target":11527},{"edgeType":"calls","source":3039,"target":1784},{"edgeType":"contains","source":7625,"target":7638},{"edgeType":"contains","source":2139,"target":2236},{"edgeType":"calls","source":2340,"target":2312},{"edgeType":"contains","source":3427,"target":3531},{"edgeType":"contains","source":11124,"target":11217},{"edgeType":"contains","source":1250,"target":1255},{"edgeType":"calls","source":7481,"target":441},{"edgeType":"contains","source":10893,"target":10979},{"edgeType":"contains","source":10598,"target":10611},{"edgeType":"contains","source":12644,"target":12720},{"edgeType":"contains","source":3952,"target":4167},{"edgeType":"contains","source":6601,"target":6616},{"edgeType":"contains","source":3300,"target":3238},{"edgeType":"contains","source":9342,"target":9380},{"edgeType":"contains","source":9178,"target":9179},{"edgeType":"contains","source":402,"target":1117},{"edgeType":"calls","source":1216,"target":1217},{"edgeType":"contains","source":7163,"target":7164},{"edgeType":"calls","source":7959,"target":7822},{"edgeType":"calls","source":385,"target":552},{"edgeType":"contains","source":9465,"target":9795},{"edgeType":"calls","source":4564,"target":4187},{"edgeType":"imports","source":12538,"target":11527},{"edgeType":"calls","source":2767,"target":2813},{"edgeType":"contains","source":7625,"target":7641},{"edgeType":"calls","source":12579,"target":11527},{"edgeType":"contains","source":94,"target":95},{"edgeType":"contains","source":6930,"target":6987},{"edgeType":"calls","source":6303,"target":6306},{"edgeType":"contains","source":11154,"target":11341},{"edgeType":"calls","source":2439,"target":2411},{"edgeType":"contains","source":9044,"target":9104},{"edgeType":"contains","source":11227,"target":11192},{"edgeType":"calls","source":12350,"target":2770},{"edgeType":"contains","source":3557,"target":3728},{"edgeType":"contains","source":918,"target":976},{"edgeType":"contains","source":885,"target":3056},{"edgeType":"contains","source":3952,"target":4166},{"edgeType":"calls","source":6081,"target":5783},{"edgeType":"calls","source":12744,"target":12754},{"edgeType":"imports","source":12077,"target":12078},{"edgeType":"contains","source":7625,"target":7640},{"edgeType":"contains","source":9698,"target":9969},{"edgeType":"contains","source":11124,"target":11215},{"edgeType":"contains","source":4258,"target":4194},{"edgeType":"imports","source":12280,"target":2614},{"edgeType":"contains","source":4380,"target":3583},{"edgeType":"contains","source":8925,"target":9621},{"edgeType":"calls","source":12106,"target":2936},{"edgeType":"calls","source":2375,"target":2282},{"edgeType":"calls","source":2273,"target":2273},{"edgeType":"contains","source":9173,"target":9332},{"edgeType":"contains","source":10893,"target":10977},{"edgeType":"contains","source":10598,"target":10609},{"edgeType":"contains","source":12644,"target":12718},{"edgeType":"calls","source":5621,"target":4187},{"edgeType":"contains","source":1250,"target":1253},{"edgeType":"contains","source":6462,"target":6698},{"edgeType":"calls","source":6037,"target":6089},{"edgeType":"contains","source":5043,"target":5227},{"edgeType":"contains","source":402,"target":1119},{"edgeType":"contains","source":7425,"target":7492},{"edgeType":"contains","source":1,"target":13550},{"edgeType":"contains","source":8713,"target":8789},{"edgeType":"contains","source":3016,"target":3592},{"edgeType":"calls","source":6239,"target":6169},{"edgeType":"imports","source":6891,"target":6888},{"edgeType":"contains","source":7489,"target":7622},{"edgeType":"contains","source":13472,"target":13475},{"edgeType":"contains","source":2005,"target":2164},{"edgeType":"contains","source":94,"target":97},{"edgeType":"contains","source":11124,"target":11212},{"edgeType":"calls","source":1651,"target":1467},{"edgeType":"calls","source":3706,"target":3299},{"edgeType":"calls","source":4354,"target":4353},{"edgeType":"contains","source":1349,"target":1360},{"edgeType":"contains","source":1347,"target":1422},{"edgeType":"contains","source":7625,"target":7635},{"edgeType":"contains","source":2139,"target":2239},{"edgeType":"contains","source":918,"target":978},{"edgeType":"contains","source":6831,"target":6879},{"edgeType":"contains","source":10893,"target":10974},{"edgeType":"contains","source":7279,"target":1447},{"edgeType":"contains","source":9044,"target":9098},{"edgeType":"contains","source":402,"target":1118},{"edgeType":"contains","source":8765,"target":9290},{"edgeType":"contains","source":9475,"target":9478},{"edgeType":"contains","source":9442,"target":9444},{"edgeType":"contains","source":13472,"target":13474},{"edgeType":"calls","source":11533,"target":11192},{"edgeType":"contains","source":7425,"target":7493},{"edgeType":"contains","source":11422,"target":11489},{"edgeType":"contains","source":61,"target":62},{"edgeType":"calls","source":13868,"target":13855},{"edgeType":"contains","source":12519,"target":12363},{"edgeType":"contains","source":94,"target":96},{"edgeType":"contains","source":1250,"target":1259},{"edgeType":"contains","source":4223,"target":4228},{"edgeType":"contains","source":2139,"target":2240},{"edgeType":"contains","source":9342,"target":9372},{"edgeType":"contains","source":12647,"target":12623},{"edgeType":"contains","source":11058,"target":11145},{"edgeType":"contains","source":820,"target":844},{"edgeType":"calls","source":7195,"target":7197},{"edgeType":"contains","source":918,"target":977},{"edgeType":"contains","source":4750,"target":4803},{"edgeType":"imports","source":7583,"target":1290},{"edgeType":"contains","source":10893,"target":10972},{"edgeType":"contains","source":9465,"target":9791},{"edgeType":"contains","source":7425,"target":7494},{"edgeType":"contains","source":13472,"target":13473},{"edgeType":"imports","source":4179,"target":4284},{"edgeType":"calls","source":4683,"target":4722},{"edgeType":"contains","source":5835,"target":6046},{"edgeType":"contains","source":10069,"target":10090},{"edgeType":"contains","source":2139,"target":2237},{"edgeType":"contains","source":9044,"target":9100},{"edgeType":"imports","source":10237,"target":409},{"edgeType":"contains","source":9144,"target":9171},{"edgeType":"calls","source":454,"target":523},{"edgeType":"contains","source":1347,"target":1420},{"edgeType":"imports","source":3763,"target":3439},{"edgeType":"imports","source":11547,"target":11593},{"edgeType":"imports","source":9170,"target":9173},{"edgeType":"contains","source":4841,"target":5152},{"edgeType":"contains","source":402,"target":1120},{"edgeType":"contains","source":1007,"target":1392},{"edgeType":"calls","source":3363,"target":3361},{"edgeType":"contains","source":9342,"target":9375},{"edgeType":"contains","source":1111,"target":1339},{"edgeType":"imports","source":11713,"target":11732},{"edgeType":"imports","source":4750,"target":4554},{"edgeType":"contains","source":11674,"target":12131},{"edgeType":"contains","source":2005,"target":2163},{"edgeType":"contains","source":2139,"target":2238},{"edgeType":"contains","source":4157,"target":4158},{"edgeType":"contains","source":61,"target":64},{"edgeType":"contains","source":1349,"target":1359},{"edgeType":"contains","source":1347,"target":1421},{"edgeType":"imports","source":3763,"target":3440},{"edgeType":"calls","source":5849,"target":4514},{"edgeType":"contains","source":7625,"target":7636},{"edgeType":"calls","source":2504,"target":2507},{"edgeType":"contains","source":6238,"target":6239},{"edgeType":"calls","source":4554,"target":4492},{"edgeType":"contains","source":547,"target":853},{"edgeType":"contains","source":918,"target":979},{"edgeType":"contains","source":4750,"target":4801},{"edgeType":"calls","source":6733,"target":6723},{"edgeType":"calls","source":1908,"target":1957},{"edgeType":"imports","source":11515,"target":11527},{"edgeType":"calls","source":2275,"target":2207},{"edgeType":"contains","source":820,"target":846},{"edgeType":"calls","source":60,"target":52},{"edgeType":"contains","source":9173,"target":9328},{"edgeType":"contains","source":10893,"target":10973},{"edgeType":"contains","source":7163,"target":7170},{"edgeType":"contains","source":11289,"target":10338},{"edgeType":"calls","source":2167,"target":266},{"edgeType":"contains","source":8542,"target":8817},{"edgeType":"contains","source":3889,"target":4016},{"edgeType":"contains","source":13472,"target":13487},{"edgeType":"contains","source":8925,"target":9629},{"edgeType":"calls","source":3429,"target":3426},{"edgeType":"contains","source":3298,"target":3310},{"edgeType":"contains","source":13042,"target":13076},{"edgeType":"contains","source":12217,"target":12225},{"edgeType":"contains","source":9465,"target":9801},{"edgeType":"contains","source":9507,"target":9556},{"edgeType":"calls","source":1908,"target":1952},{"edgeType":"imports","source":7551,"target":7556},{"edgeType":"contains","source":61,"target":67},{"edgeType":"contains","source":6831,"target":6891},{"edgeType":"contains","source":402,"target":1123},{"edgeType":"contains","source":12019,"target":12021},{"edgeType":"contains","source":9207,"target":9342},{"edgeType":"calls","source":2131,"target":1383},{"edgeType":"contains","source":6462,"target":6704},{"edgeType":"contains","source":8542,"target":8816},{"edgeType":"contains","source":2968,"target":2971},{"edgeType":"contains","source":10598,"target":10619},{"edgeType":"contains","source":6932,"target":6933},{"edgeType":"contains","source":13472,"target":13486},{"edgeType":"calls","source":3363,"target":3359},{"edgeType":"calls","source":1588,"target":1301},{"edgeType":"contains","source":9465,"target":9800},{"edgeType":"calls","source":11764,"target":11435},{"edgeType":"contains","source":13042,"target":13075},{"edgeType":"calls","source":2405,"target":2403},{"edgeType":"calls","source":2536,"target":2570},{"edgeType":"imports","source":7551,"target":7555},{"edgeType":"calls","source":7852,"target":575},{"edgeType":"contains","source":918,"target":981},{"edgeType":"contains","source":402,"target":1122},{"edgeType":"contains","source":885,"target":3065},{"edgeType":"contains","source":7780,"target":8129},{"edgeType":"calls","source":6542,"target":4190},{"edgeType":"contains","source":1111,"target":1344},{"edgeType":"contains","source":8925,"target":9631},{"edgeType":"contains","source":6932,"target":6934},{"edgeType":"contains","source":9178,"target":9187},{"edgeType":"contains","source":11259,"target":11266},{"edgeType":"contains","source":9465,"target":9803},{"edgeType":"contains","source":1347,"target":1424},{"edgeType":"contains","source":7425,"target":7506},{"edgeType":"calls","source":3825,"target":3832},{"edgeType":"contains","source":2139,"target":2241},{"edgeType":"imports","source":12255,"target":11836},{"edgeType":"contains","source":10301,"target":11367},{"edgeType":"calls","source":2471,"target":2468},{"edgeType":"contains","source":12217,"target":12223},{"edgeType":"contains","source":7780,"target":8128},{"edgeType":"contains","source":2968,"target":2969},{"edgeType":"contains","source":8542,"target":8818},{"edgeType":"contains","source":7629,"target":7524},{"edgeType":"contains","source":1111,"target":1343},{"edgeType":"contains","source":11028,"target":11029},{"edgeType":"contains","source":8916,"target":8852},{"edgeType":"contains","source":11127,"target":11131},{"edgeType":"contains","source":11294,"target":11239},{"edgeType":"contains","source":1347,"target":1425},{"edgeType":"calls","source":2570,"target":2571},{"edgeType":"contains","source":9442,"target":9458},{"edgeType":"contains","source":2005,"target":2168},{"edgeType":"contains","source":4639,"target":5075},{"edgeType":"calls","source":10866,"target":10731},{"edgeType":"calls","source":6653,"target":6036},{"edgeType":"imports","source":3952,"target":740},{"edgeType":"contains","source":4743,"target":5022},{"edgeType":"contains","source":918,"target":987},{"edgeType":"calls","source":10532,"target":10519},{"edgeType":"contains","source":10598,"target":10614},{"edgeType":"contains","source":12644,"target":12725},{"edgeType":"imports","source":4179,"target":4274},{"edgeType":"contains","source":9178,"target":9181},{"edgeType":"calls","source":9108,"target":9210},{"edgeType":"contains","source":12812,"target":12802},{"edgeType":"contains","source":7780,"target":8123},{"edgeType":"contains","source":11127,"target":11128},{"edgeType":"contains","source":11124,"target":11221},{"edgeType":"contains","source":3016,"target":3600},{"edgeType":"contains","source":1349,"target":1368},{"edgeType":"contains","source":9465,"target":9797},{"edgeType":"contains","source":11674,"target":12140},{"edgeType":"calls","source":3990,"target":4000},{"edgeType":"contains","source":10461,"target":10633},{"edgeType":"contains","source":6462,"target":6699},{"edgeType":"contains","source":8542,"target":8813},{"edgeType":"contains","source":9178,"target":9180},{"edgeType":"contains","source":5961,"target":6375},{"edgeType":"calls","source":2076,"target":2027},{"edgeType":"contains","source":9465,"target":9796},{"edgeType":"calls","source":8272,"target":1301},{"edgeType":"contains","source":13472,"target":13482},{"edgeType":"contains","source":7425,"target":7501},{"edgeType":"contains","source":1831,"target":2283},{"edgeType":"contains","source":9044,"target":9105},{"edgeType":"contains","source":4652,"target":4678},{"edgeType":"contains","source":55,"target":256},{"edgeType":"contains","source":1,"target":13557},{"edgeType":"contains","source":6601,"target":6619},{"edgeType":"imports","source":11713,"target":11725},{"edgeType":"calls","source":2603,"target":2603},{"edgeType":"calls","source":4593,"target":4334},{"edgeType":"calls","source":687,"target":688},{"edgeType":"calls","source":654,"target":654},{"edgeType":"contains","source":10367,"target":10377},{"edgeType":"contains","source":4380,"target":3596},{"edgeType":"contains","source":2968,"target":2972},{"edgeType":"calls","source":5859,"target":1026},{"edgeType":"contains","source":3016,"target":3598},{"edgeType":"contains","source":8096,"target":4671},{"edgeType":"contains","source":9465,"target":9799},{"edgeType":"contains","source":11423,"target":11463},{"edgeType":"contains","source":4758,"target":4562},{"edgeType":"imports","source":9475,"target":9223},{"edgeType":"contains","source":10893,"target":10980},{"edgeType":"contains","source":12283,"target":12287},{"edgeType":"contains","source":12280,"target":12380},{"edgeType":"contains","source":6601,"target":6620},{"edgeType":"calls","source":489,"target":487},{"edgeType":"contains","source":6462,"target":6701},{"edgeType":"contains","source":3741,"target":3320},{"edgeType":"contains","source":9173,"target":9337},{"edgeType":"calls","source":7162,"target":7173},{"edgeType":"calls","source":1360,"target":968},{"edgeType":"contains","source":3557,"target":3739},{"edgeType":"contains","source":11124,"target":11220},{"edgeType":"contains","source":1347,"target":1429},{"edgeType":"contains","source":7425,"target":7503},{"edgeType":"imports","source":6891,"target":6881},{"edgeType":"contains","source":1396,"target":967},{"edgeType":"contains","source":6831,"target":6890},{"edgeType":"contains","source":10281,"target":9870},{"edgeType":"contains","source":9044,"target":9107},{"edgeType":"contains","source":11058,"target":11151},{"edgeType":"contains","source":12217,"target":12218},{"edgeType":"contains","source":5961,"target":6378},{"edgeType":"contains","source":6700,"target":6723},{"edgeType":"contains","source":8762,"target":9393},{"edgeType":"contains","source":3594,"target":3623},{"edgeType":"calls","source":7822,"target":7822},{"edgeType":"contains","source":853,"target":859},{"edgeType":"contains","source":9044,"target":9086},{"edgeType":"imports","source":5968,"target":5883},{"edgeType":"contains","source":9144,"target":9157},{"edgeType":"contains","source":10301,"target":11344},{"edgeType":"imports","source":7128,"target":6920},{"edgeType":"contains","source":8591,"target":1988},{"edgeType":"contains","source":952,"target":961},{"edgeType":"contains","source":10630,"target":10658},{"edgeType":"contains","source":5939,"target":5979},{"edgeType":"imports","source":9698,"target":9699},{"edgeType":"contains","source":11489,"target":11512},{"edgeType":"imports","source":2345,"target":864},{"edgeType":"imports","source":10825,"target":10702},{"edgeType":"contains","source":8299,"target":2584},{"edgeType":"contains","source":2041,"target":2085},{"edgeType":"contains","source":2006,"target":2113},{"edgeType":"contains","source":6930,"target":6970},{"edgeType":"contains","source":12519,"target":12350},{"edgeType":"contains","source":4293,"target":4151},{"edgeType":"contains","source":9144,"target":9156},{"edgeType":"contains","source":1511,"target":1603},{"edgeType":"calls","source":4255,"target":4270},{"edgeType":"imports","source":7128,"target":6919},{"edgeType":"contains","source":11124,"target":11201},{"edgeType":"calls","source":3493,"target":3582},{"edgeType":"contains","source":4750,"target":4783},{"edgeType":"contains","source":8781,"target":8782},{"edgeType":"contains","source":6831,"target":6868},{"edgeType":"contains","source":6762,"target":6893},{"edgeType":"contains","source":4639,"target":5052},{"edgeType":"contains","source":5939,"target":5980},{"edgeType":"calls","source":11757,"target":3171},{"edgeType":"contains","source":9342,"target":9360},{"edgeType":"contains","source":2006,"target":2114},{"edgeType":"contains","source":9838,"target":9843},{"edgeType":"contains","source":4428,"target":4194},{"edgeType":"contains","source":8147,"target":8352},{"edgeType":"calls","source":8543,"target":8726},{"edgeType":"contains","source":11489,"target":11513},{"edgeType":"calls","source":2658,"target":1984},{"edgeType":"calls","source":12415,"target":12369},{"edgeType":"contains","source":6930,"target":6971},{"edgeType":"calls","source":8979,"target":8954},{"edgeType":"contains","source":10367,"target":11410},{"edgeType":"contains","source":9144,"target":9159},{"edgeType":"contains","source":11322,"target":10345},{"edgeType":"contains","source":10629,"target":10687},{"edgeType":"contains","source":918,"target":960},{"edgeType":"imports","source":6891,"target":6869},{"edgeType":"contains","source":11489,"target":11510},{"edgeType":"calls","source":12651,"target":2936},{"edgeType":"imports","source":4131,"target":1524},{"edgeType":"contains","source":2041,"target":2083},{"edgeType":"contains","source":4131,"target":4944},{"edgeType":"calls","source":6468,"target":6460},{"edgeType":"contains","source":6930,"target":6972},{"edgeType":"calls","source":2446,"target":2211},{"edgeType":"calls","source":2375,"target":2298},{"edgeType":"contains","source":9144,"target":9158},{"edgeType":"calls","source":60,"target":72},{"edgeType":"imports","source":6144,"target":2542},{"edgeType":"contains","source":10630,"target":10657},{"edgeType":"calls","source":5572,"target":4666},{"edgeType":"contains","source":918,"target":959},{"edgeType":"contains","source":885,"target":3039},{"edgeType":"calls","source":7402,"target":7104},{"edgeType":"contains","source":11489,"target":11511},{"edgeType":"contains","source":4743,"target":4997},{"edgeType":"contains","source":10201,"target":10215},{"edgeType":"calls","source":12117,"target":12092},{"edgeType":"calls","source":1291,"target":1021},{"edgeType":"contains","source":4510,"target":4821},{"edgeType":"imports","source":646,"target":679},{"edgeType":"contains","source":2006,"target":2112},{"edgeType":"contains","source":9144,"target":9153},{"edgeType":"contains","source":7785,"target":7943},{"edgeType":"contains","source":122,"target":269},{"edgeType":"contains","source":918,"target":962},{"edgeType":"contains","source":3037,"target":2924},{"edgeType":"calls","source":9508,"target":9470},{"edgeType":"contains","source":8087,"target":8095},{"edgeType":"contains","source":8765,"target":9274},{"edgeType":"contains","source":8781,"target":8778},{"edgeType":"contains","source":10201,"target":10212},{"edgeType":"calls","source":1450,"target":1372},{"edgeType":"contains","source":11489,"target":11508},{"edgeType":"contains","source":2006,"target":2117},{"edgeType":"contains","source":5939,"target":5975},{"edgeType":"contains","source":8147,"target":8349},{"edgeType":"calls","source":5147,"target":5154},{"edgeType":"contains","source":9144,"target":9152},{"edgeType":"contains","source":7785,"target":7942},{"edgeType":"imports","source":10884,"target":420},{"edgeType":"contains","source":1497,"target":984},{"edgeType":"contains","source":2006,"target":2118},{"edgeType":"contains","source":2005,"target":2149},{"edgeType":"contains","source":3427,"target":3518},{"edgeType":"contains","source":2139,"target":2223},{"edgeType":"contains","source":10630,"target":10655},{"edgeType":"imports","source":9341,"target":9144},{"edgeType":"contains","source":13042,"target":13046},{"edgeType":"contains","source":4750,"target":4787},{"edgeType":"calls","source":6180,"target":5899},{"edgeType":"contains","source":11489,"target":11509},{"edgeType":"contains","source":7426,"target":7445},{"edgeType":"contains","source":8765,"target":9273},{"edgeType":"contains","source":9465,"target":9771},{"edgeType":"imports","source":2345,"target":859},{"edgeType":"imports","source":2350,"target":704},{"edgeType":"contains","source":7488,"target":7637},{"edgeType":"calls","source":8813,"target":8816},{"edgeType":"contains","source":10201,"target":10213},{"edgeType":"contains","source":11675,"target":2572},{"edgeType":"contains","source":5939,"target":5976},{"edgeType":"contains","source":8087,"target":8094},{"edgeType":"contains","source":8299,"target":2579},{"edgeType":"contains","source":3594,"target":3625},{"edgeType":"imports","source":6690,"target":420},{"edgeType":"contains","source":9144,"target":9155},{"edgeType":"contains","source":3436,"target":3238},{"edgeType":"contains","source":853,"target":865},{"edgeType":"calls","source":8816,"target":8726},{"edgeType":"contains","source":9276,"target":9291},{"edgeType":"imports","source":7019,"target":2906},{"edgeType":"contains","source":5043,"target":5216},{"edgeType":"calls","source":2378,"target":1143},{"edgeType":"contains","source":4652,"target":4653},{"edgeType":"contains","source":11159,"target":11166},{"edgeType":"contains","source":10201,"target":10210},{"edgeType":"imports","source":7551,"target":7554},{"edgeType":"contains","source":9342,"target":9359},{"edgeType":"contains","source":9341,"target":9390},{"edgeType":"imports","source":7587,"target":7495},{"edgeType":"contains","source":12051,"target":12055},{"edgeType":"contains","source":2006,"target":2115},{"edgeType":"contains","source":8147,"target":8351},{"edgeType":"calls","source":730,"target":440},{"edgeType":"contains","source":2041,"target":2087},{"edgeType":"contains","source":1497,"target":982},{"edgeType":"contains","source":9144,"target":9154},{"edgeType":"contains","source":7844,"target":1887},{"edgeType":"calls","source":9715,"target":9396},{"edgeType":"calls","source":6037,"target":6102},{"edgeType":"contains","source":918,"target":963},{"edgeType":"contains","source":9106,"target":819},{"edgeType":"contains","source":10893,"target":10957},{"edgeType":"contains","source":853,"target":864},{"edgeType":"contains","source":402,"target":1103},{"edgeType":"contains","source":10201,"target":10211},{"edgeType":"imports","source":11713,"target":11715},{"edgeType":"calls","source":1200,"target":667},{"edgeType":"contains","source":2006,"target":2116},{"edgeType":"contains","source":8147,"target":8350},{"edgeType":"contains","source":11984,"target":12017},{"edgeType":"contains","source":5939,"target":5978},{"edgeType":"contains","source":12051,"target":12054},{"edgeType":"calls","source":12331,"target":11804},{"edgeType":"imports","source":2350,"target":717},{"edgeType":"contains","source":9465,"target":9785},{"edgeType":"calls","source":1032,"target":585},{"edgeType":"contains","source":2139,"target":2226},{"edgeType":"contains","source":6930,"target":6977},{"edgeType":"contains","source":2005,"target":2152},{"edgeType":"contains","source":402,"target":1107},{"edgeType":"contains","source":12051,"target":12069},{"edgeType":"calls","source":9078,"target":9062},{"edgeType":"contains","source":9852,"target":10473},{"edgeType":"contains","source":918,"target":966},{"edgeType":"contains","source":10598,"target":10602},{"edgeType":"contains","source":11423,"target":11452},{"edgeType":"contains","source":5213,"target":5237},{"edgeType":"contains","source":13008,"target":13056},{"edgeType":"contains","source":9342,"target":9369},{"edgeType":"calls","source":11922,"target":11804},{"edgeType":"contains","source":2006,"target":2122},{"edgeType":"calls","source":2504,"target":2521},{"edgeType":"contains","source":13008,"target":13055},{"edgeType":"calls","source":2473,"target":2425},{"edgeType":"contains","source":11489,"target":11522},{"edgeType":"calls","source":9639,"target":9640},{"edgeType":"contains","source":2139,"target":2227},{"edgeType":"contains","source":4510,"target":4832},{"edgeType":"contains","source":12051,"target":12068},{"edgeType":"calls","source":2131,"target":1400},{"edgeType":"contains","source":3016,"target":3580},{"edgeType":"contains","source":1,"target":11422},{"edgeType":"calls","source":5593,"target":2951},{"edgeType":"imports","source":12574,"target":12500},{"edgeType":"contains","source":5213,"target":5236},{"edgeType":"contains","source":1778,"target":1791},{"edgeType":"calls","source":12252,"target":12145},{"edgeType":"calls","source":5489,"target":5118},{"edgeType":"contains","source":11423,"target":11453},{"edgeType":"calls","source":7866,"target":7524},{"edgeType":"calls","source":8219,"target":8208},{"edgeType":"contains","source":9342,"target":9368},{"edgeType":"calls","source":10179,"target":7698},{"edgeType":"contains","source":11124,"target":11209},{"edgeType":"contains","source":8765,"target":9289},{"edgeType":"contains","source":9475,"target":9477},{"edgeType":"contains","source":7489,"target":7620},{"edgeType":"contains","source":7425,"target":7490},{"edgeType":"contains","source":13008,"target":13054},{"edgeType":"contains","source":2006,"target":2119},{"edgeType":"contains","source":2005,"target":2150},{"edgeType":"contains","source":6831,"target":6877},{"edgeType":"contains","source":7013,"target":1235},{"edgeType":"calls","source":11703,"target":11192},{"edgeType":"contains","source":2139,"target":2224},{"edgeType":"calls","source":4757,"target":4554},{"edgeType":"contains","source":6601,"target":6608},{"edgeType":"calls","source":6072,"target":6071},{"edgeType":"contains","source":12051,"target":12067},{"edgeType":"calls","source":2274,"target":2249},{"edgeType":"contains","source":402,"target":1109},{"edgeType":"contains","source":10301,"target":11350},{"edgeType":"calls","source":13046,"target":12898},{"edgeType":"calls","source":2075,"target":2076},{"edgeType":"contains","source":9342,"target":9371},{"edgeType":"contains","source":11489,"target":11518},{"edgeType":"calls","source":12529,"target":2498},{"edgeType":"contains","source":1580,"target":1584},{"edgeType":"imports","source":7127,"target":602},{"edgeType":"contains","source":3562,"target":3565},{"edgeType":"imports","source":7128,"target":2685},{"edgeType":"contains","source":9144,"target":9167},{"edgeType":"contains","source":2041,"target":2092},{"edgeType":"contains","source":7425,"target":7491},{"edgeType":"imports","source":12204,"target":9173},{"edgeType":"contains","source":9475,"target":9476},{"edgeType":"contains","source":7394,"target":7395},{"edgeType":"calls","source":6039,"target":6036},{"edgeType":"contains","source":6831,"target":6878},{"edgeType":"contains","source":7489,"target":7621},{"edgeType":"contains","source":8765,"target":9288},{"edgeType":"contains","source":12519,"target":12356},{"edgeType":"calls","source":4164,"target":740},{"edgeType":"contains","source":9342,"target":9370},{"edgeType":"contains","source":11124,"target":11207},{"edgeType":"contains","source":11489,"target":11519},{"edgeType":"calls","source":8153,"target":8142},{"edgeType":"contains","source":3594,"target":3629},{"edgeType":"contains","source":5342,"target":5471},{"edgeType":"contains","source":13008,"target":13052},{"edgeType":"contains","source":6930,"target":6973},{"edgeType":"contains","source":3952,"target":4165},{"edgeType":"imports","source":9475,"target":9209},{"edgeType":"calls","source":3965,"target":3735},{"edgeType":"imports","source":3763,"target":3412},{"edgeType":"contains","source":6762,"target":6896},{"edgeType":"contains","source":4421,"target":4425},{"edgeType":"contains","source":1,"target":4028},{"edgeType":"calls","source":6284,"target":5839},{"edgeType":"calls","source":2504,"target":2516},{"edgeType":"contains","source":5043,"target":5226},{"edgeType":"contains","source":8616,"target":8617},{"edgeType":"contains","source":4355,"target":4357},{"edgeType":"contains","source":4380,"target":3582},{"edgeType":"contains","source":5811,"target":5723},{"edgeType":"contains","source":9342,"target":9365},{"edgeType":"imports","source":4179,"target":4258},{"edgeType":"contains","source":10697,"target":10700},{"edgeType":"contains","source":3741,"target":3307},{"edgeType":"calls","source":6570,"target":6479},{"edgeType":"contains","source":3594,"target":3636},{"edgeType":"contains","source":9144,"target":9161},{"edgeType":"contains","source":9143,"target":9192},{"edgeType":"imports","source":10514,"target":10826},{"edgeType":"contains","source":1349,"target":1352},{"edgeType":"contains","source":11489,"target":11516},{"edgeType":"calls","source":1908,"target":1964},{"edgeType":"calls","source":7559,"target":7532},{"edgeType":"contains","source":9044,"target":9089},{"edgeType":"contains","source":6930,"target":6974},{"edgeType":"imports","source":9341,"target":8079},{"edgeType":"calls","source":6037,"target":6096},{"edgeType":"calls","source":7359,"target":7390},{"edgeType":"contains","source":402,"target":1110},{"edgeType":"calls","source":4090,"target":4089},{"edgeType":"contains","source":4510,"target":4836},{"edgeType":"contains","source":8765,"target":9282},{"edgeType":"imports","source":11616,"target":11545},{"edgeType":"contains","source":10137,"target":10091},{"edgeType":"calls","source":8985,"target":8777},{"edgeType":"contains","source":6568,"target":6569},{"edgeType":"imports","source":12152,"target":11836},{"edgeType":"imports","source":3889,"target":3735},{"edgeType":"contains","source":1582,"target":1529},{"edgeType":"contains","source":4355,"target":4356},{"edgeType":"calls","source":2207,"target":2211},{"edgeType":"calls","source":5915,"target":364},{"edgeType":"contains","source":1,"target":6141},{"edgeType":"contains","source":918,"target":969},{"edgeType":"contains","source":9144,"target":9160},{"edgeType":"contains","source":9143,"target":9191},{"edgeType":"contains","source":1349,"target":1353},{"edgeType":"contains","source":11124,"target":11205},{"edgeType":"contains","source":2006,"target":2123},{"edgeType":"contains","source":8362,"target":2751},{"edgeType":"calls","source":1084,"target":1085},{"edgeType":"contains","source":8765,"target":9285},{"edgeType":"contains","source":11098,"target":10951},{"edgeType":"calls","source":2473,"target":2418},{"edgeType":"contains","source":10893,"target":10964},{"edgeType":"contains","source":402,"target":1113},{"edgeType":"contains","source":4510,"target":4835},{"edgeType":"imports","source":6144,"target":2539},{"edgeType":"contains","source":12249,"target":12267},{"edgeType":"calls","source":385,"target":556},{"edgeType":"calls","source":2504,"target":2514},{"edgeType":"calls","source":2608,"target":347},{"edgeType":"contains","source":12051,"target":12063},{"edgeType":"calls","source":789,"target":717},{"edgeType":"contains","source":3016,"target":3581},{"edgeType":"imports","source":12605,"target":12593},{"edgeType":"contains","source":918,"target":972},{"edgeType":"contains","source":7129,"target":7148},{"edgeType":"calls","source":9244,"target":9208},{"edgeType":"calls","source":3070,"target":2938},{"edgeType":"calls","source":13206,"target":13228},{"edgeType":"calls","source":12515,"target":2936},{"edgeType":"contains","source":3557,"target":3724},{"edgeType":"contains","source":9144,"target":9163},{"edgeType":"contains","source":9342,"target":9367},{"edgeType":"contains","source":11489,"target":11514},{"edgeType":"contains","source":1349,"target":1350},{"edgeType":"contains","source":4750,"target":4793},{"edgeType":"contains","source":7489,"target":7617},{"edgeType":"contains","source":4652,"target":4660},{"edgeType":"contains","source":11124,"target":11203},{"edgeType":"contains","source":3889,"target":4001},{"edgeType":"contains","source":6930,"target":6976},{"edgeType":"contains","source":402,"target":1112},{"edgeType":"contains","source":6700,"target":6707},{"edgeType":"contains","source":8765,"target":9284},{"edgeType":"contains","source":4421,"target":4422},{"edgeType":"calls","source":8815,"target":8764},{"edgeType":"contains","source":918,"target":971},{"edgeType":"calls","source":2207,"target":2209},{"edgeType":"contains","source":7129,"target":7149},{"edgeType":"contains","source":5213,"target":5238},{"edgeType":"contains","source":9143,"target":9193},{"edgeType":"contains","source":3430,"target":3432},{"edgeType":"contains","source":1349,"target":1351},{"edgeType":"contains","source":7625,"target":7628},{"edgeType":"contains","source":9342,"target":9366},{"edgeType":"contains","source":13117,"target":13352},{"edgeType":"calls","source":4620,"target":4666},{"edgeType":"calls","source":8819,"target":8742},{"edgeType":"contains","source":704,"target":705},{"edgeType":"contains","source":3621,"target":3298},{"edgeType":"contains","source":8299,"target":8381},{"edgeType":"contains","source":6418,"target":6440},{"edgeType":"contains","source":891,"target":2307},{"edgeType":"contains","source":1218,"target":1684},{"edgeType":"contains","source":6749,"target":6750},{"edgeType":"contains","source":8797,"target":8799},{"edgeType":"contains","source":12723,"target":12881},{"edgeType":"calls","source":822,"target":844},{"edgeType":"contains","source":1887,"target":2086},{"edgeType":"contains","source":11505,"target":11528},{"edgeType":"calls","source":8954,"target":8786},{"edgeType":"calls","source":11923,"target":11880},{"edgeType":"contains","source":5424,"target":5542},{"edgeType":"contains","source":5409,"target":6007},{"edgeType":"calls","source":3470,"target":3319},{"edgeType":"calls","source":5849,"target":4620},{"edgeType":"imports","source":9698,"target":8427},{"edgeType":"contains","source":11869,"target":11873},{"edgeType":"calls","source":5216,"target":5217},{"edgeType":"contains","source":142,"target":157},{"edgeType":"contains","source":7805,"target":7840},{"edgeType":"calls","source":560,"target":508},{"edgeType":"contains","source":853,"target":313},{"edgeType":"contains","source":13117,"target":13351},{"edgeType":"contains","source":891,"target":2306},{"edgeType":"contains","source":6418,"target":6441},{"edgeType":"contains","source":9223,"target":9333},{"edgeType":"calls","source":1104,"target":557},{"edgeType":"contains","source":8797,"target":8798},{"edgeType":"contains","source":1087,"target":1515},{"edgeType":"calls","source":4620,"target":4665},{"edgeType":"calls","source":6935,"target":6896},{"edgeType":"calls","source":13868,"target":12893},{"edgeType":"contains","source":3743,"target":3744},{"edgeType":"contains","source":11242,"target":11226},{"edgeType":"contains","source":4480,"target":4151},{"edgeType":"contains","source":5981,"target":6247},{"edgeType":"contains","source":7805,"target":7839},{"edgeType":"contains","source":9722,"target":9723},{"edgeType":"contains","source":11803,"target":11804},{"edgeType":"contains","source":13815,"target":13910},{"edgeType":"contains","source":13783,"target":13845},{"edgeType":"contains","source":4274,"target":4194},{"edgeType":"calls","source":11533,"target":11284},{"edgeType":"contains","source":853,"target":316},{"edgeType":"contains","source":836,"target":843},{"edgeType":"contains","source":13117,"target":13350},{"edgeType":"contains","source":7013,"target":7024},{"edgeType":"contains","source":704,"target":707},{"edgeType":"calls","source":3270,"target":3175},{"edgeType":"contains","source":3741,"target":3804},{"edgeType":"contains","source":8762,"target":9886},{"edgeType":"contains","source":918,"target":415},{"edgeType":"contains","source":12723,"target":12879},{"edgeType":"contains","source":891,"target":2309},{"edgeType":"contains","source":6749,"target":6752},{"edgeType":"contains","source":1887,"target":2084},{"edgeType":"calls","source":4324,"target":4327},{"edgeType":"contains","source":5883,"target":6115},{"edgeType":"contains","source":11505,"target":11526},{"edgeType":"imports","source":6917,"target":563},{"edgeType":"calls","source":4382,"target":3586},{"edgeType":"calls","source":8954,"target":8788},{"edgeType":"calls","source":2447,"target":148},{"edgeType":"contains","source":5409,"target":6005},{"edgeType":"calls","source":988,"target":985},{"edgeType":"imports","source":3763,"target":3204},{"edgeType":"contains","source":3741,"target":3805},{"edgeType":"calls","source":1777,"target":837},{"edgeType":"calls","source":1285,"target":1291},{"edgeType":"contains","source":13783,"target":13844},{"edgeType":"contains","source":1,"target":5587},{"edgeType":"contains","source":9953,"target":9958},{"edgeType":"contains","source":11836,"target":11837},{"edgeType":"contains","source":5786,"target":5951},{"edgeType":"contains","source":11836,"target":11835},{"edgeType":"calls","source":12415,"target":2970},{"edgeType":"contains","source":13117,"target":13349},{"edgeType":"contains","source":2818,"target":2821},{"edgeType":"contains","source":704,"target":706},{"edgeType":"contains","source":3741,"target":3803},{"edgeType":"contains","source":9170,"target":9921},{"edgeType":"calls","source":12717,"target":12633},{"edgeType":"calls","source":4976,"target":1026},{"edgeType":"contains","source":12723,"target":12878},{"edgeType":"contains","source":5409,"target":719},{"edgeType":"contains","source":891,"target":2308},{"edgeType":"calls","source":6304,"target":6375},{"edgeType":"calls","source":626,"target":578},{"edgeType":"calls","source":5034,"target":4514},{"edgeType":"contains","source":5409,"target":6004},{"edgeType":"imports","source":12152,"target":8465},{"edgeType":"contains","source":7221,"target":6919},{"edgeType":"contains","source":4132,"target":4367},{"edgeType":"contains","source":3809,"target":3810},{"edgeType":"calls","source":3506,"target":3259},{"edgeType":"calls","source":1771,"target":1022},{"edgeType":"contains","source":13815,"target":13908},{"edgeType":"contains","source":2093,"target":2041},{"edgeType":"contains","source":1,"target":301},{"edgeType":"contains","source":4132,"target":4374},{"edgeType":"contains","source":11864,"target":12023},{"edgeType":"contains","source":7805,"target":7835},{"edgeType":"calls","source":5477,"target":5578},{"edgeType":"contains","source":6418,"target":6436},{"edgeType":"calls","source":1219,"target":1217},{"edgeType":"contains","source":1529,"target":1560},{"edgeType":"imports","source":4131,"target":4482},{"edgeType":"contains","source":5786,"target":5944},{"edgeType":"imports","source":891,"target":266},{"edgeType":"contains","source":1298,"target":1322},{"edgeType":"contains","source":836,"target":845},{"edgeType":"contains","source":13117,"target":13348},{"edgeType":"contains","source":5981,"target":6242},{"edgeType":"contains","source":11422,"target":11983},{"edgeType":"contains","source":6853,"target":6692},{"edgeType":"calls","source":2344,"target":2282},{"edgeType":"contains","source":5857,"target":5858},{"edgeType":"contains","source":9698,"target":8346},{"edgeType":"contains","source":5409,"target":6011},{"edgeType":"contains","source":11864,"target":12024},{"edgeType":"contains","source":8103,"target":8111},{"edgeType":"contains","source":7805,"target":7834},{"edgeType":"calls","source":7958,"target":7955},{"edgeType":"contains","source":6418,"target":6437},{"edgeType":"contains","source":5786,"target":5945},{"edgeType":"contains","source":1287,"target":607},{"edgeType":"imports","source":12499,"target":12500},{"edgeType":"contains","source":547,"target":1347},{"edgeType":"contains","source":9223,"target":9329},{"edgeType":"contains","source":2849,"target":2923},{"edgeType":"calls","source":11809,"target":11192},{"edgeType":"contains","source":13117,"target":13347},{"edgeType":"contains","source":10944,"target":10947},{"edgeType":"contains","source":9506,"target":10069},{"edgeType":"contains","source":1144,"target":1866},{"edgeType":"contains","source":7938,"target":7940},{"edgeType":"contains","source":5409,"target":6010},{"edgeType":"contains","source":1529,"target":1562},{"edgeType":"contains","source":13783,"target":13841},{"edgeType":"contains","source":1,"target":303},{"edgeType":"contains","source":9,"target":55},{"edgeType":"contains","source":9953,"target":9957},{"edgeType":"calls","source":560,"target":507},{"edgeType":"calls","source":6081,"target":5879},{"edgeType":"imports","source":11019,"target":10818},{"edgeType":"contains","source":6848,"target":6850},{"edgeType":"calls","source":2573,"target":2580},{"edgeType":"contains","source":12723,"target":12875},{"edgeType":"contains","source":1218,"target":1686},{"edgeType":"contains","source":2653,"target":2654},{"edgeType":"calls","source":12669,"target":2498},{"edgeType":"contains","source":8863,"target":8865},{"edgeType":"contains","source":13117,"target":13346},{"edgeType":"calls","source":11323,"target":3000},{"edgeType":"contains","source":405,"target":466},{"edgeType":"contains","source":402,"target":559},{"edgeType":"contains","source":1087,"target":1522},{"edgeType":"calls","source":2446,"target":2289},{"edgeType":"calls","source":2441,"target":2444},{"edgeType":"calls","source":2474,"target":2478},{"edgeType":"contains","source":13783,"target":13840},{"edgeType":"contains","source":9953,"target":9954},{"edgeType":"contains","source":5786,"target":5947},{"edgeType":"contains","source":13815,"target":13905},{"edgeType":"contains","source":6203,"target":2533},{"edgeType":"calls","source":9025,"target":8705},{"edgeType":"contains","source":3741,"target":3809},{"edgeType":"calls","source":6050,"target":5782},{"edgeType":"contains","source":1497,"target":437},{"edgeType":"calls","source":4800,"target":4364},{"edgeType":"contains","source":704,"target":710},{"edgeType":"contains","source":1,"target":305},{"edgeType":"contains","source":7805,"target":7836},{"edgeType":"imports","source":4131,"target":4485},{"edgeType":"imports","source":1954,"target":1135},{"edgeType":"contains","source":11109,"target":11115},{"edgeType":"contains","source":2849,"target":2921},{"edgeType":"calls","source":7961,"target":7864},{"edgeType":"contains","source":13117,"target":13345},{"edgeType":"contains","source":8762,"target":8823},{"edgeType":"contains","source":9664,"target":3059},{"edgeType":"calls","source":5849,"target":4613},{"edgeType":"calls","source":5850,"target":5639},{"edgeType":"calls","source":9710,"target":9666},{"edgeType":"contains","source":5409,"target":6008},{"edgeType":"calls","source":1455,"target":1301},{"edgeType":"contains","source":9953,"target":9955},{"edgeType":"contains","source":13783,"target":13839},{"edgeType":"contains","source":7805,"target":7837},{"edgeType":"contains","source":1836,"target":1556},{"edgeType":"contains","source":1298,"target":1326},{"edgeType":"calls","source":3404,"target":3243},{"edgeType":"contains","source":4132,"target":4378},{"edgeType":"contains","source":13751,"target":13790},{"edgeType":"contains","source":13752,"target":13759},{"edgeType":"calls","source":591,"target":597},{"edgeType":"contains","source":2254,"target":2344},{"edgeType":"calls","source":4778,"target":1874},{"edgeType":"contains","source":918,"target":421},{"edgeType":"contains","source":402,"target":561},{"edgeType":"calls","source":1844,"target":864},{"edgeType":"contains","source":12723,"target":12890},{"edgeType":"contains","source":1144,"target":1871},{"edgeType":"contains","source":1497,"target":1500},{"edgeType":"contains","source":13117,"target":13360},{"edgeType":"imports","source":12077,"target":11836},{"edgeType":"contains","source":11210,"target":11168},{"edgeType":"contains","source":1218,"target":1693},{"edgeType":"contains","source":8103,"target":8122},{"edgeType":"contains","source":8762,"target":9891},{"edgeType":"contains","source":13752,"target":13758},{"edgeType":"calls","source":11757,"target":11751},{"edgeType":"imports","source":899,"target":1088},{"edgeType":"calls","source":2378,"target":2282},{"edgeType":"contains","source":5229,"target":5252},{"edgeType":"contains","source":1087,"target":1523},{"edgeType":"contains","source":11864,"target":12035},{"edgeType":"contains","source":1,"target":7706},{"edgeType":"calls","source":12179,"target":11353},{"edgeType":"contains","source":12723,"target":12889},{"edgeType":"contains","source":13117,"target":13359},{"edgeType":"imports","source":7001,"target":1119},{"edgeType":"calls","source":9025,"target":8706},{"edgeType":"imports","source":4506,"target":4473},{"edgeType":"imports","source":10367,"target":9878},{"edgeType":"contains","source":1497,"target":1501},{"edgeType":"calls","source":3506,"target":3250},{"edgeType":"imports","source":1511,"target":1140},{"edgeType":"contains","source":4841,"target":4595},{"edgeType":"contains","source":1298,"target":1324},{"edgeType":"calls","source":558,"target":565},{"edgeType":"contains","source":10884,"target":10702},{"edgeType":"contains","source":13751,"target":13788},{"edgeType":"contains","source":142,"target":167},{"edgeType":"calls","source":10073,"target":10046},{"edgeType":"contains","source":836,"target":851},{"edgeType":"contains","source":2983,"target":2998},{"edgeType":"imports","source":7239,"target":1144},{"edgeType":"contains","source":374,"target":375},{"edgeType":"contains","source":3741,"target":3813},{"edgeType":"contains","source":1,"target":8766},{"edgeType":"calls","source":3789,"target":2933},{"edgeType":"contains","source":8107,"target":602},{"edgeType":"contains","source":11864,"target":12034},{"edgeType":"contains","source":12723,"target":12888},{"edgeType":"contains","source":1497,"target":1498},{"edgeType":"contains","source":13117,"target":13358},{"edgeType":"contains","source":7013,"target":7032},{"edgeType":"contains","source":8932,"target":8852},{"edgeType":"contains","source":5409,"target":6013},{"edgeType":"contains","source":7596,"target":586},{"edgeType":"contains","source":1,"target":309},{"edgeType":"imports","source":2656,"target":2641},{"edgeType":"contains","source":2849,"target":2925},{"edgeType":"calls","source":2936,"target":2951},{"edgeType":"calls","source":5150,"target":5137},{"edgeType":"contains","source":405,"target":470},{"edgeType":"contains","source":11259,"target":11762},{"edgeType":"contains","source":12622,"target":12847},{"edgeType":"calls","source":9509,"target":9559},{"edgeType":"contains","source":10547,"target":10580},{"edgeType":"contains","source":7905,"target":7920},{"edgeType":"contains","source":12723,"target":12887},{"edgeType":"contains","source":5146,"target":4652},{"edgeType":"contains","source":11864,"target":12033},{"edgeType":"contains","source":13117,"target":13357},{"edgeType":"contains","source":9467,"target":9178},{"edgeType":"contains","source":1218,"target":1696},{"edgeType":"contains","source":13751,"target":13786},{"edgeType":"contains","source":9028,"target":9041},{"edgeType":"contains","source":13117,"target":13356},{"edgeType":"contains","source":13815,"target":13916},{"edgeType":"imports","source":3847,"target":3764},{"edgeType":"contains","source":10944,"target":10954},{"edgeType":"contains","source":12235,"target":12158},{"edgeType":"contains","source":142,"target":169},{"edgeType":"calls","source":7900,"target":7646},{"edgeType":"contains","source":8797,"target":8803},{"edgeType":"contains","source":8762,"target":9888},{"edgeType":"contains","source":12622,"target":12845},{"edgeType":"calls","source":3438,"target":3242},{"edgeType":"contains","source":374,"target":377},{"edgeType":"calls","source":12399,"target":5593},{"edgeType":"contains","source":12723,"target":12886},{"edgeType":"calls","source":5813,"target":5724},{"edgeType":"contains","source":11864,"target":12032},{"edgeType":"contains","source":3741,"target":3819},{"edgeType":"contains","source":7596,"target":580},{"edgeType":"contains","source":1497,"target":1504},{"edgeType":"imports","source":4131,"target":4474},{"edgeType":"contains","source":1218,"target":1697},{"edgeType":"contains","source":5409,"target":6019},{"edgeType":"contains","source":5424,"target":5554},{"edgeType":"contains","source":8331,"target":4221},{"edgeType":"contains","source":13117,"target":13355},{"edgeType":"contains","source":7013,"target":7027},{"edgeType":"contains","source":8762,"target":9887},{"edgeType":"contains","source":10547,"target":10577},{"edgeType":"calls","source":1615,"target":1616},{"edgeType":"calls","source":1644,"target":717},{"edgeType":"contains","source":12622,"target":12844},{"edgeType":"contains","source":374,"target":376},{"edgeType":"contains","source":8591,"target":9902},{"edgeType":"contains","source":4370,"target":4403},{"edgeType":"calls","source":1844,"target":859},{"edgeType":"contains","source":5786,"target":5954},{"edgeType":"contains","source":1497,"target":1505},{"edgeType":"contains","source":12723,"target":12885},{"edgeType":"contains","source":836,"target":852},{"edgeType":"contains","source":9170,"target":9923},{"edgeType":"contains","source":11864,"target":12031},{"edgeType":"contains","source":1144,"target":1874},{"edgeType":"calls","source":591,"target":592},{"edgeType":"contains","source":1218,"target":1698},{"edgeType":"calls","source":6586,"target":6100},{"edgeType":"contains","source":1298,"target":1328},{"edgeType":"calls","source":756,"target":765},{"edgeType":"contains","source":13815,"target":13914},{"edgeType":"contains","source":1218,"target":1694},{"edgeType":"contains","source":8762,"target":9890},{"edgeType":"contains","source":13117,"target":13354},{"edgeType":"contains","source":6749,"target":6756},{"edgeType":"contains","source":10893,"target":10419},{"edgeType":"contains","source":12622,"target":12843},{"edgeType":"contains","source":4370,"target":4402},{"edgeType":"contains","source":12723,"target":12884},{"edgeType":"contains","source":8566,"target":8567},{"edgeType":"contains","source":5786,"target":5955},{"edgeType":"calls","source":6081,"target":5870},{"edgeType":"calls","source":10223,"target":3286},{"edgeType":"contains","source":3578,"target":3585},{"edgeType":"contains","source":1529,"target":1567},{"edgeType":"contains","source":1124,"target":1440},{"edgeType":"contains","source":1497,"target":1502},{"edgeType":"imports","source":4131,"target":4476},{"edgeType":"contains","source":1298,"target":1329},{"edgeType":"contains","source":1218,"target":1695},{"edgeType":"calls","source":2289,"target":806},{"edgeType":"contains","source":10944,"target":10953},{"edgeType":"calls","source":7859,"target":7863},{"edgeType":"calls","source":2835,"target":2907},{"edgeType":"contains","source":13117,"target":13353},{"edgeType":"contains","source":374,"target":378},{"edgeType":"contains","source":405,"target":474},{"edgeType":"contains","source":8762,"target":9889},{"edgeType":"calls","source":3493,"target":3650},{"edgeType":"contains","source":12723,"target":12882},{"edgeType":"calls","source":7556,"target":1400},{"edgeType":"contains","source":12723,"target":12883},{"edgeType":"calls","source":8817,"target":8818},{"edgeType":"contains","source":9170,"target":9925},{"edgeType":"contains","source":3214,"target":3241},{"edgeType":"imports","source":10514,"target":10608},{"edgeType":"contains","source":5409,"target":6016},{"edgeType":"contains","source":3921,"target":3495},{"edgeType":"contains","source":471,"target":512},{"edgeType":"contains","source":12064,"target":12153},{"edgeType":"contains","source":428,"target":788},{"edgeType":"contains","source":3311,"target":3378},{"edgeType":"calls","source":3003,"target":3014},{"edgeType":"contains","source":5409,"target":5991},{"edgeType":"contains","source":11595,"target":11893},{"edgeType":"contains","source":5883,"target":6096},{"edgeType":"contains","source":1,"target":8740},{"edgeType":"contains","source":7805,"target":7823},{"edgeType":"imports","source":4131,"target":4461},{"edgeType":"contains","source":13117,"target":13335},{"edgeType":"contains","source":4271,"target":4273},{"edgeType":"contains","source":3412,"target":3419},{"edgeType":"contains","source":7072,"target":2005},{"edgeType":"contains","source":1139,"target":3058},{"edgeType":"contains","source":3214,"target":3215},{"edgeType":"contains","source":1887,"target":2070},{"edgeType":"contains","source":3311,"target":3379},{"edgeType":"contains","source":5409,"target":5990},{"edgeType":"contains","source":7244,"target":7245},{"edgeType":"calls","source":5122,"target":4975},{"edgeType":"contains","source":11304,"target":10345},{"edgeType":"calls","source":9906,"target":9910},{"edgeType":"contains","source":1,"target":2396},{"edgeType":"contains","source":8478,"target":700},{"edgeType":"contains","source":428,"target":787},{"edgeType":"calls","source":9540,"target":3286},{"edgeType":"contains","source":13815,"target":13894},{"edgeType":"contains","source":5883,"target":6097},{"edgeType":"contains","source":13751,"target":13764},{"edgeType":"contains","source":4271,"target":4272},{"edgeType":"calls","source":12364,"target":5593},{"edgeType":"calls","source":4669,"target":4220},{"edgeType":"contains","source":13117,"target":13334},{"edgeType":"contains","source":4304,"target":4306},{"edgeType":"contains","source":3676,"target":3690},{"edgeType":"contains","source":6418,"target":6425},{"edgeType":"contains","source":3412,"target":3418},{"edgeType":"contains","source":10569,"target":9875},{"edgeType":"contains","source":8591,"target":8825},{"edgeType":"contains","source":3144,"target":3270},{"edgeType":"contains","source":1218,"target":1669},{"edgeType":"contains","source":1124,"target":1408},{"edgeType":"contains","source":7072,"target":2006},{"edgeType":"contains","source":10117,"target":10142},{"edgeType":"contains","source":3311,"target":3376},{"edgeType":"contains","source":428,"target":790},{"edgeType":"contains","source":1139,"target":3061},{"edgeType":"contains","source":3961,"target":3310},{"edgeType":"contains","source":7596,"target":562},{"edgeType":"calls","source":3036,"target":3046},{"edgeType":"imports","source":1954,"target":1124},{"edgeType":"contains","source":9421,"target":2125},{"edgeType":"contains","source":7805,"target":7825},{"edgeType":"imports","source":2244,"target":590},{"edgeType":"calls","source":8922,"target":8706},{"edgeType":"calls","source":1616,"target":1617},{"edgeType":"contains","source":2355,"target":2358},{"edgeType":"contains","source":1,"target":285},{"edgeType":"contains","source":1,"target":2399},{"edgeType":"calls","source":4656,"target":4622},{"edgeType":"contains","source":8299,"target":8367},{"edgeType":"contains","source":142,"target":143},{"edgeType":"contains","source":13117,"target":13333},{"edgeType":"contains","source":11242,"target":11206},{"edgeType":"calls","source":1121,"target":1106},{"edgeType":"contains","source":6418,"target":6426},{"edgeType":"contains","source":3412,"target":3417},{"edgeType":"contains","source":1218,"target":1666},{"edgeType":"contains","source":3234,"target":3648},{"edgeType":"contains","source":5883,"target":6099},{"edgeType":"calls","source":4997,"target":4620},{"edgeType":"contains","source":3311,"target":3377},{"edgeType":"contains","source":5427,"target":5430},{"edgeType":"contains","source":1768,"target":1529},{"edgeType":"contains","source":4133,"target":4319},{"edgeType":"contains","source":4132,"target":4350},{"edgeType":"calls","source":11703,"target":11284},{"edgeType":"imports","source":12077,"target":2310},{"edgeType":"contains","source":4436,"target":4440},{"edgeType":"contains","source":11595,"target":11892},{"edgeType":"calls","source":7959,"target":7905},{"edgeType":"contains","source":10301,"target":10782},{"edgeType":"contains","source":6418,"target":6427},{"edgeType":"calls","source":2739,"target":2741},{"edgeType":"contains","source":3412,"target":3416},{"edgeType":"contains","source":8676,"target":1964},{"edgeType":"calls","source":10845,"target":3000},{"edgeType":"contains","source":13117,"target":13332},{"edgeType":"contains","source":1218,"target":1667},{"edgeType":"calls","source":8222,"target":8208},{"edgeType":"contains","source":5409,"target":702},{"edgeType":"contains","source":11439,"target":11440},{"edgeType":"calls","source":2344,"target":2298},{"edgeType":"calls","source":1814,"target":1815},{"edgeType":"calls","source":1959,"target":491},{"edgeType":"contains","source":9918,"target":9967},{"edgeType":"contains","source":8066,"target":8184},{"edgeType":"contains","source":10117,"target":10140},{"edgeType":"calls","source":11315,"target":3233},{"edgeType":"contains","source":4133,"target":4327},{"edgeType":"contains","source":4132,"target":4358},{"edgeType":"contains","source":142,"target":145},{"edgeType":"contains","source":6418,"target":6420},{"edgeType":"contains","source":1529,"target":1544},{"edgeType":"imports","source":4131,"target":4466},{"edgeType":"contains","source":4304,"target":4311},{"edgeType":"contains","source":5686,"target":5857},{"edgeType":"calls","source":4858,"target":4700},{"edgeType":"contains","source":8931,"target":8852},{"edgeType":"contains","source":10942,"target":10991},{"edgeType":"contains","source":13117,"target":13331},{"edgeType":"contains","source":2849,"target":2905},{"edgeType":"contains","source":428,"target":791},{"edgeType":"contains","source":3311,"target":3383},{"edgeType":"contains","source":1954,"target":2111},{"edgeType":"calls","source":1814,"target":1814},{"edgeType":"contains","source":1529,"target":1545},{"edgeType":"contains","source":6276,"target":6594},{"edgeType":"contains","source":8066,"target":8183},{"edgeType":"imports","source":12228,"target":8200},{"edgeType":"calls","source":5797,"target":5187},{"edgeType":"imports","source":12574,"target":12273},{"edgeType":"contains","source":4205,"target":4208},{"edgeType":"contains","source":7805,"target":7818},{"edgeType":"contains","source":142,"target":144},{"edgeType":"contains","source":2041,"target":1529},{"edgeType":"calls","source":691,"target":688},{"edgeType":"contains","source":10547,"target":10553},{"edgeType":"calls","source":6345,"target":2997},{"edgeType":"calls","source":2497,"target":1785},{"edgeType":"contains","source":10710,"target":10785},{"edgeType":"contains","source":2916,"target":2943},{"edgeType":"contains","source":13117,"target":13330},{"edgeType":"calls","source":936,"target":492},{"edgeType":"contains","source":4841,"target":4575},{"edgeType":"imports","source":10884,"target":4417},{"edgeType":"calls","source":11435,"target":568},{"edgeType":"contains","source":5981,"target":6227},{"edgeType":"imports","source":12279,"target":11905},{"edgeType":"calls","source":5117,"target":5125},{"edgeType":"contains","source":10942,"target":10989},{"edgeType":"contains","source":471,"target":518},{"edgeType":"contains","source":3311,"target":3380},{"edgeType":"calls","source":9841,"target":1362},{"edgeType":"calls","source":1417,"target":1440},{"edgeType":"calls","source":1392,"target":1158},{"edgeType":"imports","source":10237,"target":1218},{"edgeType":"calls","source":2135,"target":1376},{"edgeType":"contains","source":4133,"target":4324},{"edgeType":"contains","source":4132,"target":4355},{"edgeType":"contains","source":7805,"target":7821},{"edgeType":"calls","source":1847,"target":1851},{"edgeType":"imports","source":7808,"target":7809},{"edgeType":"contains","source":12178,"target":3328},{"edgeType":"contains","source":8367,"target":8369},{"edgeType":"contains","source":7673,"target":7685},{"edgeType":"contains","source":9918,"target":9965},{"edgeType":"contains","source":142,"target":147},{"edgeType":"contains","source":1218,"target":1670},{"edgeType":"imports","source":13008,"target":3048},{"edgeType":"imports","source":7001,"target":1118},{"edgeType":"contains","source":13117,"target":13329},{"edgeType":"contains","source":8762,"target":8807},{"edgeType":"contains","source":5229,"target":5230},{"edgeType":"contains","source":3148,"target":3149},{"edgeType":"contains","source":3144,"target":3273},{"edgeType":"calls","source":5218,"target":5164},{"edgeType":"contains","source":471,"target":517},{"edgeType":"contains","source":3311,"target":3381},{"edgeType":"contains","source":11505,"target":11507},{"edgeType":"imports","source":11674,"target":8465},{"edgeType":"contains","source":9918,"target":9966},{"edgeType":"calls","source":1847,"target":1850},{"edgeType":"calls","source":1814,"target":1816},{"edgeType":"calls","source":8102,"target":1362},{"edgeType":"contains","source":5686,"target":5860},{"edgeType":"contains","source":4205,"target":4206},{"edgeType":"contains","source":7805,"target":7820},{"edgeType":"contains","source":142,"target":146},{"edgeType":"contains","source":6418,"target":6423},{"edgeType":"contains","source":1529,"target":1543},{"edgeType":"imports","source":4131,"target":4469},{"edgeType":"contains","source":13117,"target":13328},{"edgeType":"contains","source":1218,"target":1671},{"edgeType":"contains","source":11712,"target":2975},{"edgeType":"calls","source":4858,"target":4697},{"edgeType":"imports","source":4743,"target":2409},{"edgeType":"contains","source":5786,"target":5940},{"edgeType":"contains","source":3143,"target":3309},{"edgeType":"contains","source":3144,"target":3278},{"edgeType":"contains","source":1087,"target":1508},{"edgeType":"calls","source":4382,"target":3596},{"edgeType":"contains","source":3016,"target":3018},{"edgeType":"contains","source":7805,"target":7831},{"edgeType":"contains","source":1144,"target":1855},{"edgeType":"imports","source":4131,"target":4453},{"edgeType":"contains","source":1510,"target":2137},{"edgeType":"contains","source":7673,"target":7695},{"edgeType":"contains","source":9028,"target":9029},{"edgeType":"contains","source":13117,"target":13344},{"edgeType":"contains","source":7013,"target":7014},{"edgeType":"contains","source":11505,"target":11520},{"edgeType":"calls","source":8954,"target":8777},{"edgeType":"calls","source":10765,"target":10774},{"edgeType":"calls","source":6539,"target":6478},{"edgeType":"contains","source":12892,"target":12919},{"edgeType":"contains","source":142,"target":149},{"edgeType":"contains","source":4342,"target":4194},{"edgeType":"contains","source":10547,"target":10565},{"edgeType":"contains","source":11242,"target":11218},{"edgeType":"calls","source":2378,"target":2298},{"edgeType":"contains","source":8523,"target":8827},{"edgeType":"contains","source":1124,"target":1417},{"edgeType":"contains","source":3144,"target":3279},{"edgeType":"contains","source":7805,"target":7830},{"edgeType":"imports","source":12894,"target":12919},{"edgeType":"calls","source":1615,"target":1637},{"edgeType":"calls","source":8780,"target":8885},{"edgeType":"contains","source":13117,"target":13343},{"edgeType":"calls","source":2168,"target":1409},{"edgeType":"imports","source":13755,"target":1026},{"edgeType":"calls","source":626,"target":585},{"edgeType":"contains","source":1887,"target":2079},{"edgeType":"calls","source":760,"target":659},{"edgeType":"calls","source":594,"target":520},{"edgeType":"contains","source":4132,"target":4361},{"edgeType":"contains","source":13783,"target":13837},{"edgeType":"contains","source":471,"target":519},{"edgeType":"contains","source":7805,"target":7833},{"edgeType":"contains","source":6418,"target":6434},{"edgeType":"contains","source":13117,"target":13342},{"edgeType":"contains","source":8962,"target":8963},{"edgeType":"calls","source":8876,"target":627},{"edgeType":"imports","source":12571,"target":2849},{"edgeType":"imports","source":2137,"target":1802},{"edgeType":"imports","source":1511,"target":1124},{"edgeType":"contains","source":13815,"target":13901},{"edgeType":"contains","source":8299,"target":8375},{"edgeType":"calls","source":4995,"target":4675},{"edgeType":"calls","source":7996,"target":7822},{"edgeType":"contains","source":7938,"target":7939},{"edgeType":"imports","source":9852,"target":6799},{"edgeType":"contains","source":3143,"target":3308},{"edgeType":"contains","source":7805,"target":7832},{"edgeType":"contains","source":11109,"target":11111},{"edgeType":"contains","source":13117,"target":13341},{"edgeType":"contains","source":3776,"target":3767},{"edgeType":"contains","source":9223,"target":9327},{"edgeType":"contains","source":11242,"target":11216},{"edgeType":"contains","source":5981,"target":6241},{"edgeType":"contains","source":13117,"target":13340},{"edgeType":"calls","source":4874,"target":1026},{"edgeType":"contains","source":8962,"target":8961},{"edgeType":"contains","source":1218,"target":1675},{"edgeType":"calls","source":1518,"target":1474},{"edgeType":"contains","source":142,"target":150},{"edgeType":"calls","source":856,"target":856},{"edgeType":"contains","source":2892,"target":3689},{"edgeType":"calls","source":5119,"target":5058},{"edgeType":"calls","source":7698,"target":7548},{"edgeType":"contains","source":5883,"target":6100},{"edgeType":"calls","source":7495,"target":7500},{"edgeType":"imports","source":4131,"target":4457},{"edgeType":"calls","source":7404,"target":7150},{"edgeType":"contains","source":3741,"target":3802},{"edgeType":"contains","source":12064,"target":12157},{"edgeType":"contains","source":12000,"target":12027},{"edgeType":"contains","source":3143,"target":3313},{"edgeType":"contains","source":3144,"target":3282},{"edgeType":"contains","source":7805,"target":7827},{"edgeType":"imports","source":12298,"target":12363},{"edgeType":"contains","source":11242,"target":11213},{"edgeType":"contains","source":11715,"target":1835},{"edgeType":"contains","source":1218,"target":1680},{"edgeType":"contains","source":5409,"target":6003},{"edgeType":"calls","source":2937,"target":2934},{"edgeType":"contains","source":13117,"target":13339},{"edgeType":"calls","source":1660,"target":1295},{"edgeType":"contains","source":3776,"target":3773},{"edgeType":"contains","source":12000,"target":12026},{"edgeType":"contains","source":3143,"target":3314},{"edgeType":"contains","source":7805,"target":7826},{"edgeType":"contains","source":5981,"target":6234},{"edgeType":"calls","source":560,"target":512},{"edgeType":"contains","source":1218,"target":1681},{"edgeType":"contains","source":5409,"target":6002},{"edgeType":"contains","source":5424,"target":5537},{"edgeType":"contains","source":13815,"target":13898},{"edgeType":"calls","source":857,"target":819},{"edgeType":"calls","source":12023,"target":11948},{"edgeType":"contains","source":13117,"target":13338},{"edgeType":"contains","source":142,"target":152},{"edgeType":"calls","source":2937,"target":2935},{"edgeType":"calls","source":5168,"target":3537},{"edgeType":"contains","source":6418,"target":6429},{"edgeType":"calls","source":3061,"target":148},{"edgeType":"calls","source":5150,"target":5152},{"edgeType":"contains","source":5883,"target":6102},{"edgeType":"contains","source":7805,"target":7829},{"edgeType":"contains","source":12000,"target":12025},{"edgeType":"contains","source":836,"target":839},{"edgeType":"contains","source":1087,"target":1514},{"edgeType":"contains","source":3144,"target":3280},{"edgeType":"calls","source":12751,"target":12633},{"edgeType":"imports","source":10514,"target":10592},{"edgeType":"calls","source":6586,"target":6084},{"edgeType":"contains","source":5424,"target":5536},{"edgeType":"contains","source":5409,"target":6001},{"edgeType":"contains","source":13783,"target":13832},{"edgeType":"contains","source":7221,"target":563},{"edgeType":"calls","source":7245,"target":454},{"edgeType":"contains","source":13117,"target":13337},{"edgeType":"contains","source":10942,"target":10997},{"edgeType":"contains","source":3776,"target":3771},{"edgeType":"contains","source":9223,"target":9323},{"edgeType":"contains","source":3741,"target":3799},{"edgeType":"contains","source":11616,"target":2789},{"edgeType":"contains","source":2917,"target":2919},{"edgeType":"calls","source":12179,"target":11339},{"edgeType":"contains","source":5409,"target":715},{"edgeType":"contains","source":1087,"target":1513},{"edgeType":"contains","source":3144,"target":3281},{"edgeType":"contains","source":7805,"target":7828},{"edgeType":"imports","source":10237,"target":9665},{"edgeType":"contains","source":13117,"target":13336},{"edgeType":"contains","source":13815,"target":13896},{"edgeType":"contains","source":1218,"target":1679},{"edgeType":"contains","source":5981,"target":6237},{"edgeType":"calls","source":11702,"target":1814},{"edgeType":"imports","source":1347,"target":918},{"edgeType":"contains","source":142,"target":154},{"edgeType":"calls","source":7845,"target":1938},{"edgeType":"contains","source":1528,"target":1554},{"edgeType":"calls","source":8165,"target":4671},{"edgeType":"contains","source":13117,"target":13319},{"edgeType":"contains","source":2949,"target":2956},{"edgeType":"contains","source":3576,"target":3603},{"edgeType":"imports","source":7001,"target":2219},{"edgeType":"calls","source":347,"target":737},{"edgeType":"contains","source":1396,"target":1418},{"edgeType":"contains","source":1096,"target":1204},{"edgeType":"contains","source":1144,"target":1830},{"edgeType":"contains","source":1218,"target":1651},{"edgeType":"calls","source":12290,"target":12098},{"edgeType":"contains","source":3311,"target":3361},{"edgeType":"imports","source":8074,"target":8067},{"edgeType":"contains","source":8066,"target":8172},{"edgeType":"contains","source":10117,"target":10128},{"edgeType":"contains","source":5883,"target":6080},{"edgeType":"contains","source":7805,"target":7807},{"edgeType":"contains","source":5981,"target":6213},{"edgeType":"contains","source":1,"target":5551},{"edgeType":"contains","source":10451,"target":10345},{"edgeType":"contains","source":13117,"target":13318},{"edgeType":"contains","source":2816,"target":2852},{"edgeType":"calls","source":1383,"target":1388},{"edgeType":"calls","source":4092,"target":4089},{"edgeType":"calls","source":6073,"target":6099},{"edgeType":"imports","source":9467,"target":1881},{"edgeType":"contains","source":12990,"target":13027},{"edgeType":"contains","source":1396,"target":1419},{"edgeType":"contains","source":1096,"target":1203},{"edgeType":"contains","source":1218,"target":1652},{"edgeType":"contains","source":1144,"target":1829},{"edgeType":"contains","source":2949,"target":2957},{"edgeType":"calls","source":2474,"target":2452},{"edgeType":"contains","source":8066,"target":8171},{"edgeType":"imports","source":8074,"target":8068},{"edgeType":"contains","source":8762,"target":8792},{"edgeType":"contains","source":7239,"target":7383},{"edgeType":"contains","source":10117,"target":10129},{"edgeType":"contains","source":3741,"target":3773},{"edgeType":"contains","source":7805,"target":7806},{"edgeType":"imports","source":5968,"target":5701},{"edgeType":"contains","source":3657,"target":3204},{"edgeType":"contains","source":13117,"target":13317},{"edgeType":"contains","source":3576,"target":3601},{"edgeType":"contains","source":3741,"target":3771},{"edgeType":"contains","source":1396,"target":1416},{"edgeType":"contains","source":12990,"target":13026},{"edgeType":"calls","source":2703,"target":2749},{"edgeType":"contains","source":1096,"target":1206},{"edgeType":"contains","source":3311,"target":3359},{"edgeType":"contains","source":10117,"target":10126},{"edgeType":"calls","source":5125,"target":604},{"edgeType":"contains","source":12500,"target":2847},{"edgeType":"contains","source":12099,"target":12107},{"edgeType":"contains","source":9223,"target":9303},{"edgeType":"calls","source":9212,"target":9213},{"edgeType":"imports","source":3763,"target":3237},{"edgeType":"calls","source":7595,"target":7544},{"edgeType":"contains","source":7706,"target":7707},{"edgeType":"contains","source":13815,"target":13876},{"edgeType":"contains","source":240,"target":259},{"edgeType":"contains","source":5883,"target":6082},{"edgeType":"calls","source":6111,"target":5976},{"edgeType":"calls","source":2844,"target":2607},{"edgeType":"calls","source":12086,"target":12079},{"edgeType":"contains","source":13117,"target":13316},{"edgeType":"contains","source":3143,"target":3283},{"edgeType":"contains","source":12990,"target":13025},{"edgeType":"contains","source":1887,"target":2052},{"edgeType":"contains","source":1958,"target":1965},{"edgeType":"contains","source":8066,"target":8173},{"edgeType":"contains","source":10117,"target":10127},{"edgeType":"imports","source":11864,"target":2620},{"edgeType":"contains","source":11374,"target":11327},{"edgeType":"contains","source":5823,"target":5829},{"edgeType":"imports","source":3763,"target":3238},{"edgeType":"contains","source":5929,"target":429},{"edgeType":"calls","source":619,"target":757},{"edgeType":"contains","source":5823,"target":5821},{"edgeType":"calls","source":2605,"target":2614},{"edgeType":"imports","source":853,"target":420},{"edgeType":"contains","source":5741,"target":6249},{"edgeType":"calls","source":1152,"target":1147},{"edgeType":"contains","source":6902,"target":7255},{"edgeType":"contains","source":10942,"target":10975},{"edgeType":"contains","source":13117,"target":13315},{"edgeType":"contains","source":2949,"target":2960},{"edgeType":"calls","source":12347,"target":2936},{"edgeType":"contains","source":428,"target":775},{"edgeType":"calls","source":293,"target":293},{"edgeType":"calls","source":1681,"target":1660},{"edgeType":"contains","source":9506,"target":10037},{"edgeType":"calls","source":5116,"target":5109},{"edgeType":"contains","source":3311,"target":3365},{"edgeType":"contains","source":5409,"target":693},{"edgeType":"calls","source":6768,"target":6758},{"edgeType":"contains","source":2269,"target":2899},{"edgeType":"contains","source":5424,"target":5513},{"edgeType":"contains","source":13815,"target":13874},{"edgeType":"contains","source":1,"target":271},{"edgeType":"contains","source":3741,"target":3778},{"edgeType":"contains","source":10216,"target":10226},{"edgeType":"contains","source":10117,"target":10124},{"edgeType":"contains","source":4900,"target":4844},{"edgeType":"contains","source":4132,"target":4340},{"edgeType":"contains","source":11836,"target":11800},{"edgeType":"contains","source":5741,"target":6250},{"edgeType":"calls","source":10532,"target":10578},{"edgeType":"calls","source":2573,"target":436},{"edgeType":"calls","source":1160,"target":898},{"edgeType":"contains","source":2949,"target":2961},{"edgeType":"calls","source":2770,"target":2785},{"edgeType":"contains","source":10910,"target":10911},{"edgeType":"contains","source":1096,"target":1207},{"edgeType":"contains","source":10943,"target":10945},{"edgeType":"contains","source":13117,"target":13314},{"edgeType":"contains","source":10117,"target":10125},{"edgeType":"contains","source":11713,"target":1873},{"edgeType":"contains","source":13649,"target":13734},{"edgeType":"contains","source":3311,"target":3366},{"edgeType":"contains","source":5424,"target":5512},{"edgeType":"contains","source":1,"target":5555},{"edgeType":"contains","source":8293,"target":7472},{"edgeType":"contains","source":1,"target":273},{"edgeType":"calls","source":4992,"target":4722},{"edgeType":"contains","source":13117,"target":13313},{"edgeType":"contains","source":8066,"target":8170},{"edgeType":"calls","source":5812,"target":4671},{"edgeType":"contains","source":12990,"target":13021},{"edgeType":"contains","source":1096,"target":1210},{"edgeType":"contains","source":3311,"target":3363},{"edgeType":"contains","source":9341,"target":9869},{"edgeType":"imports","source":7332,"target":420},{"edgeType":"contains","source":13815,"target":13872},{"edgeType":"contains","source":3741,"target":3776},{"edgeType":"contains","source":5823,"target":5824},{"edgeType":"contains","source":8293,"target":7475},{"edgeType":"contains","source":12000,"target":12001},{"edgeType":"contains","source":3576,"target":3604},{"edgeType":"contains","source":42,"target":58},{"edgeType":"contains","source":9918,"target":9949},{"edgeType":"calls","source":3299,"target":3297},{"edgeType":"contains","source":5761,"target":4575},{"edgeType":"contains","source":13117,"target":13312},{"edgeType":"contains","source":11712,"target":2959},{"edgeType":"contains","source":1218,"target":1654},{"edgeType":"contains","source":2652,"target":2653},{"edgeType":"contains","source":6917,"target":2565},{"edgeType":"contains","source":11133,"target":10338},{"edgeType":"contains","source":1096,"target":1209},{"edgeType":"contains","source":5981,"target":6212},{"edgeType":"calls","source":9724,"target":9199},{"edgeType":"contains","source":3311,"target":3364},{"edgeType":"contains","source":240,"target":262},{"edgeType":"contains","source":5823,"target":5825},{"edgeType":"contains","source":6517,"target":6508},{"edgeType":"contains","source":13815,"target":13871},{"edgeType":"contains","source":2269,"target":2898},{"edgeType":"contains","source":5741,"target":6253},{"edgeType":"contains","source":3831,"target":4156},{"edgeType":"imports","source":7694,"target":1881},{"edgeType":"contains","source":10117,"target":10123},{"edgeType":"contains","source":4132,"target":4345},{"edgeType":"contains","source":10451,"target":10352},{"edgeType":"contains","source":13815,"target":13887},{"edgeType":"contains","source":2849,"target":2893},{"edgeType":"calls","source":1173,"target":492},{"edgeType":"contains","source":6517,"target":6518},{"edgeType":"contains","source":1096,"target":1212},{"edgeType":"contains","source":2269,"target":2903},{"edgeType":"calls","source":2539,"target":2542},{"edgeType":"contains","source":7805,"target":7815},{"edgeType":"contains","source":3144,"target":3261},{"edgeType":"contains","source":12723,"target":12857},{"edgeType":"contains","source":13117,"target":13327},{"edgeType":"contains","source":3311,"target":3369},{"edgeType":"contains","source":7607,"target":7611},{"edgeType":"contains","source":13058,"target":13042},{"edgeType":"contains","source":11455,"target":2483},{"edgeType":"contains","source":9467,"target":9144},{"edgeType":"calls","source":1450,"target":1417},{"edgeType":"imports","source":7434,"target":414},{"edgeType":"contains","source":12990,"target":13035},{"edgeType":"contains","source":11595,"target":11886},{"edgeType":"calls","source":127,"target":148},{"edgeType":"contains","source":1218,"target":1660},{"edgeType":"calls","source":8486,"target":8469},{"edgeType":"contains","source":13751,"target":13756},{"edgeType":"contains","source":12462,"target":12490},{"edgeType":"imports","source":11864,"target":2614},{"edgeType":"contains","source":2518,"target":2585},{"edgeType":"contains","source":10262,"target":9870},{"edgeType":"contains","source":1096,"target":1211},{"edgeType":"calls","source":5953,"target":2411},{"edgeType":"contains","source":9918,"target":9964},{"edgeType":"contains","source":9223,"target":9308},{"edgeType":"calls","source":1959,"target":436},{"edgeType":"calls","source":2539,"target":2543},{"edgeType":"contains","source":5883,"target":6089},{"edgeType":"contains","source":1887,"target":2062},{"edgeType":"contains","source":13117,"target":13326},{"edgeType":"contains","source":3311,"target":3370},{"edgeType":"contains","source":7673,"target":7678},{"edgeType":"contains","source":11259,"target":11731},{"edgeType":"calls","source":9212,"target":9221},{"edgeType":"calls","source":619,"target":755},{"edgeType":"contains","source":4205,"target":4194},{"edgeType":"calls","source":3000,"target":3047},{"edgeType":"contains","source":428,"target":782},{"edgeType":"contains","source":6517,"target":6520},{"edgeType":"contains","source":8066,"target":8182},{"edgeType":"contains","source":2652,"target":2656},{"edgeType":"contains","source":7805,"target":7817},{"edgeType":"calls","source":2474,"target":2441},{"edgeType":"imports","source":10301,"target":9842},{"edgeType":"contains","source":8676,"target":1957},{"edgeType":"contains","source":918,"target":390},{"edgeType":"contains","source":8591,"target":8820},{"edgeType":"contains","source":7673,"target":7681},{"edgeType":"contains","source":2269,"target":2901},{"edgeType":"contains","source":9918,"target":9961},{"edgeType":"contains","source":11168,"target":10321},{"edgeType":"calls","source":2603,"target":2670},{"edgeType":"contains","source":7221,"target":551},{"edgeType":"calls","source":2605,"target":2608},{"edgeType":"contains","source":5424,"target":5515},{"edgeType":"contains","source":13117,"target":13325},{"edgeType":"calls","source":6735,"target":6730},{"edgeType":"calls","source":6265,"target":4365},{"edgeType":"contains","source":10942,"target":10986},{"edgeType":"contains","source":4132,"target":4342},{"edgeType":"calls","source":7168,"target":7049},{"edgeType":"imports","source":3741,"target":740},{"edgeType":"calls","source":12648,"target":12633},{"edgeType":"contains","source":13117,"target":13324},{"edgeType":"calls","source":12247,"target":11324},{"edgeType":"contains","source":8066,"target":8181},{"edgeType":"contains","source":6418,"target":6419},{"edgeType":"contains","source":8499,"target":8500},{"edgeType":"calls","source":8253,"target":5125},{"edgeType":"imports","source":10301,"target":9841},{"edgeType":"contains","source":3016,"target":3000},{"edgeType":"calls","source":5850,"target":5602},{"edgeType":"calls","source":4620,"target":4622},{"edgeType":"contains","source":2269,"target":2902},{"edgeType":"contains","source":3143,"target":3291},{"edgeType":"contains","source":7805,"target":7816},{"edgeType":"calls","source":227,"target":222},{"edgeType":"calls","source":7098,"target":7106},{"edgeType":"calls","source":11922,"target":11891},{"edgeType":"contains","source":1218,"target":1663},{"edgeType":"contains","source":5427,"target":5429},{"edgeType":"contains","source":5424,"target":5522},{"edgeType":"contains","source":5458,"target":5517},{"edgeType":"imports","source":2314,"target":590},{"edgeType":"imports","source":12436,"target":2849},{"edgeType":"contains","source":13117,"target":13323},{"edgeType":"contains","source":13815,"target":13883},{"edgeType":"calls","source":13071,"target":13269},{"edgeType":"calls","source":5118,"target":5038},{"edgeType":"calls","source":7957,"target":7960},{"edgeType":"contains","source":10811,"target":10816},{"edgeType":"contains","source":8697,"target":8699},{"edgeType":"contains","source":471,"target":508},{"edgeType":"contains","source":6917,"target":2570},{"edgeType":"contains","source":428,"target":784},{"edgeType":"contains","source":2355,"target":2356},{"edgeType":"calls","source":11570,"target":11175},{"edgeType":"contains","source":5883,"target":6084},{"edgeType":"contains","source":4370,"target":4371},{"edgeType":"contains","source":3741,"target":3786},{"edgeType":"calls","source":4668,"target":4190},{"edgeType":"contains","source":853,"target":293},{"edgeType":"calls","source":10072,"target":10046},{"edgeType":"contains","source":2849,"target":2897},{"edgeType":"contains","source":1124,"target":1405},{"edgeType":"contains","source":1434,"target":2367},{"edgeType":"contains","source":1087,"target":1495},{"edgeType":"calls","source":623,"target":625},{"edgeType":"calls","source":12388,"target":12243},{"edgeType":"contains","source":1139,"target":3054},{"edgeType":"contains","source":7673,"target":7675},{"edgeType":"calls","source":2605,"target":2606},{"edgeType":"contains","source":3412,"target":3415},{"edgeType":"contains","source":5823,"target":5830},{"edgeType":"contains","source":7706,"target":7709},{"edgeType":"contains","source":3311,"target":3373},{"edgeType":"calls","source":2473,"target":2470},{"edgeType":"contains","source":3311,"target":3375},{"edgeType":"contains","source":5427,"target":5428},{"edgeType":"contains","source":13750,"target":13783},{"edgeType":"contains","source":13783,"target":13817},{"edgeType":"contains","source":12990,"target":13031},{"edgeType":"contains","source":13117,"target":13322},{"edgeType":"calls","source":9212,"target":9222},{"edgeType":"contains","source":428,"target":783},{"edgeType":"contains","source":10811,"target":10817},{"edgeType":"contains","source":2355,"target":2357},{"edgeType":"contains","source":4469,"target":4472},{"edgeType":"contains","source":10367,"target":10839},{"edgeType":"contains","source":8762,"target":8797},{"edgeType":"contains","source":471,"target":507},{"edgeType":"contains","source":8697,"target":8698},{"edgeType":"contains","source":8066,"target":8175},{"edgeType":"contains","source":1087,"target":1494},{"edgeType":"contains","source":9918,"target":9960},{"edgeType":"contains","source":5981,"target":6218},{"edgeType":"imports","source":4506,"target":4510},{"edgeType":"calls","source":2606,"target":2576},{"edgeType":"contains","source":3412,"target":3414},{"edgeType":"contains","source":3311,"target":3374},{"edgeType":"contains","source":1298,"target":1299},{"edgeType":"contains","source":5409,"target":5985},{"edgeType":"contains","source":12462,"target":12485},{"edgeType":"contains","source":13815,"target":13881},{"edgeType":"contains","source":11108,"target":11120},{"edgeType":"contains","source":13117,"target":13321},{"edgeType":"contains","source":2849,"target":2895},{"edgeType":"contains","source":10942,"target":10981},{"edgeType":"imports","source":11616,"target":2906},{"edgeType":"contains","source":428,"target":786},{"edgeType":"contains","source":10811,"target":10814},{"edgeType":"contains","source":4436,"target":4437},{"edgeType":"calls","source":454,"target":581},{"edgeType":"contains","source":7239,"target":7388},{"edgeType":"calls","source":4654,"target":4622},{"edgeType":"contains","source":5883,"target":6086},{"edgeType":"contains","source":9223,"target":9307},{"edgeType":"calls","source":10911,"target":10462},{"edgeType":"contains","source":11242,"target":11194},{"edgeType":"contains","source":7673,"target":7677},{"edgeType":"contains","source":3311,"target":3371},{"edgeType":"imports","source":5968,"target":5700},{"edgeType":"contains","source":1529,"target":1534},{"edgeType":"contains","source":5424,"target":5519},{"edgeType":"contains","source":13117,"target":13320},{"edgeType":"imports","source":2314,"target":587},{"edgeType":"calls","source":726,"target":604},{"edgeType":"calls","source":3000,"target":3044},{"edgeType":"contains","source":428,"target":785},{"edgeType":"calls","source":1440,"target":668},{"edgeType":"contains","source":4469,"target":4470},{"edgeType":"contains","source":7239,"target":7389},{"edgeType":"calls","source":6115,"target":5839},{"edgeType":"contains","source":9223,"target":9306},{"edgeType":"imports","source":12892,"target":13028},{"edgeType":"contains","source":1434,"target":2366},{"edgeType":"contains","source":13649,"target":13740},{"edgeType":"contains","source":3144,"target":3264},{"edgeType":"contains","source":5409,"target":698},{"edgeType":"contains","source":13750,"target":13780},{"edgeType":"calls","source":557,"target":558},{"edgeType":"contains","source":3311,"target":3372},{"edgeType":"contains","source":5424,"target":5518},{"edgeType":"imports","source":12436,"target":2845},{"edgeType":"contains","source":3311,"target":3345},{"edgeType":"contains","source":13420,"target":13423},{"edgeType":"imports","source":1797,"target":1798},{"edgeType":"contains","source":2518,"target":2559},{"edgeType":"calls","source":7130,"target":7142},{"edgeType":"contains","source":13387,"target":13389},{"edgeType":"calls","source":5886,"target":4514},{"edgeType":"contains","source":10281,"target":10312},{"edgeType":"contains","source":13649,"target":13723},{"edgeType":"contains","source":405,"target":411},{"edgeType":"contains","source":5786,"target":5899},{"edgeType":"contains","source":273,"target":275},{"edgeType":"contains","source":2269,"target":2879},{"edgeType":"contains","source":240,"target":241},{"edgeType":"contains","source":6285,"target":6286},{"edgeType":"contains","source":13117,"target":13302},{"edgeType":"contains","source":2849,"target":2868},{"edgeType":"contains","source":6384,"target":6388},{"edgeType":"contains","source":8300,"target":8301},{"edgeType":"contains","source":12592,"target":12665},{"edgeType":"contains","source":1396,"target":1402},{"edgeType":"contains","source":1144,"target":1813},{"edgeType":"contains","source":1124,"target":1376},{"edgeType":"calls","source":4426,"target":4322},{"edgeType":"calls","source":10757,"target":409},{"edgeType":"contains","source":8066,"target":8154},{"edgeType":"contains","source":11616,"target":2754},{"edgeType":"contains","source":7276,"target":7277},{"edgeType":"calls","source":2176,"target":2193},{"edgeType":"contains","source":12254,"target":12571},{"edgeType":"contains","source":6514,"target":6587},{"edgeType":"contains","source":13387,"target":13388},{"edgeType":"calls","source":5108,"target":4319},{"edgeType":"contains","source":5786,"target":5900},{"edgeType":"contains","source":11634,"target":11709},{"edgeType":"contains","source":11569,"target":11610},{"edgeType":"contains","source":11547,"target":12292},{"edgeType":"contains","source":13649,"target":13722},{"edgeType":"contains","source":2269,"target":2880},{"edgeType":"contains","source":273,"target":274},{"edgeType":"calls","source":1914,"target":1856},{"edgeType":"calls","source":3392,"target":436},{"edgeType":"contains","source":13117,"target":13301},{"edgeType":"calls","source":8155,"target":8136},{"edgeType":"calls","source":10071,"target":10047},{"edgeType":"contains","source":1585,"target":829},{"edgeType":"calls","source":1100,"target":664},{"edgeType":"contains","source":8927,"target":8946},{"edgeType":"imports","source":6917,"target":6919},{"edgeType":"contains","source":12990,"target":13010},{"edgeType":"contains","source":7208,"target":7270},{"edgeType":"contains","source":12592,"target":12664},{"edgeType":"contains","source":3154,"target":3984},{"edgeType":"contains","source":1218,"target":1636},{"edgeType":"calls","source":7240,"target":563},{"edgeType":"contains","source":8066,"target":8157},{"edgeType":"contains","source":7208,"target":7272},{"edgeType":"imports","source":7434,"target":409},{"edgeType":"calls","source":12029,"target":11714},{"edgeType":"contains","source":13420,"target":13421},{"edgeType":"imports","source":12436,"target":2847},{"edgeType":"contains","source":273,"target":277},{"edgeType":"contains","source":5761,"target":4562},{"edgeType":"contains","source":11634,"target":11706},{"edgeType":"calls","source":7822,"target":491},{"edgeType":"contains","source":13649,"target":13721},{"edgeType":"calls","source":11914,"target":2595},{"edgeType":"contains","source":13815,"target":13860},{"edgeType":"contains","source":240,"target":243},{"edgeType":"contains","source":2269,"target":2877},{"edgeType":"contains","source":2269,"target":2876},{"edgeType":"contains","source":4944,"target":4515},{"edgeType":"contains","source":2849,"target":2866},{"edgeType":"calls","source":1153,"target":1138},{"edgeType":"imports","source":10514,"target":10630},{"edgeType":"calls","source":8818,"target":8726},{"edgeType":"calls","source":8156,"target":8106},{"edgeType":"contains","source":3234,"target":3615},{"edgeType":"contains","source":13117,"target":13300},{"edgeType":"contains","source":5409,"target":670},{"edgeType":"calls","source":7895,"target":1400},{"edgeType":"imports","source":10237,"target":7588},{"edgeType":"contains","source":7208,"target":7273},{"edgeType":"contains","source":13649,"target":13720},{"edgeType":"calls","source":989,"target":936},{"edgeType":"contains","source":7474,"target":7483},{"edgeType":"contains","source":273,"target":276},{"edgeType":"contains","source":2269,"target":2878},{"edgeType":"contains","source":5786,"target":5902},{"edgeType":"calls","source":5815,"target":4598},{"edgeType":"calls","source":11843,"target":568},{"edgeType":"imports","source":10237,"target":4417},{"edgeType":"calls","source":6081,"target":5865},{"edgeType":"contains","source":2849,"target":2867},{"edgeType":"contains","source":6221,"target":6159},{"edgeType":"imports","source":10514,"target":10629},{"edgeType":"contains","source":1396,"target":1401},{"edgeType":"calls","source":690,"target":692},{"edgeType":"contains","source":12723,"target":12829},{"edgeType":"contains","source":8961,"target":8951},{"edgeType":"contains","source":10710,"target":10754},{"edgeType":"contains","source":13117,"target":13299},{"edgeType":"contains","source":8927,"target":8948},{"edgeType":"calls","source":5030,"target":4620},{"edgeType":"contains","source":7474,"target":7476},{"edgeType":"imports","source":12280,"target":11905},{"edgeType":"contains","source":13649,"target":13719},{"edgeType":"calls","source":7759,"target":7731},{"edgeType":"calls","source":9641,"target":9641},{"edgeType":"contains","source":2345,"target":1584},{"edgeType":"calls","source":5943,"target":5914},{"edgeType":"calls","source":7130,"target":7146},{"edgeType":"contains","source":3615,"target":3439},{"edgeType":"contains","source":8066,"target":8151},{"edgeType":"contains","source":10281,"target":10308},{"edgeType":"contains","source":1,"target":2368},{"edgeType":"contains","source":2849,"target":2872},{"edgeType":"contains","source":108,"target":109},{"edgeType":"calls","source":11775,"target":568},{"edgeType":"contains","source":12462,"target":12463},{"edgeType":"calls","source":560,"target":489},{"edgeType":"imports","source":12565,"target":11527},{"edgeType":"calls","source":2508,"target":2467},{"edgeType":"contains","source":7601,"target":7768},{"edgeType":"contains","source":12723,"target":12828},{"edgeType":"contains","source":8927,"target":8943},{"edgeType":"contains","source":7208,"target":7265},{"edgeType":"contains","source":10942,"target":10958},{"edgeType":"calls","source":10285,"target":9760},{"edgeType":"contains","source":13117,"target":13298},{"edgeType":"contains","source":4567,"target":4580},{"edgeType":"imports","source":12892,"target":13018},{"edgeType":"contains","source":1124,"target":1380},{"edgeType":"calls","source":1606,"target":830},{"edgeType":"contains","source":11634,"target":11705},{"edgeType":"contains","source":11569,"target":11606},{"edgeType":"contains","source":13649,"target":13718},{"edgeType":"contains","source":2345,"target":1585},{"edgeType":"calls","source":7130,"target":7147},{"edgeType":"contains","source":6514,"target":6583},{"edgeType":"contains","source":273,"target":278},{"edgeType":"calls","source":3506,"target":3241},{"edgeType":"contains","source":12394,"target":12455},{"edgeType":"contains","source":4179,"target":4981},{"edgeType":"contains","source":6384,"target":6385},{"edgeType":"calls","source":1383,"target":1400},{"edgeType":"calls","source":560,"target":488},{"edgeType":"calls","source":3362,"target":1362},{"edgeType":"contains","source":6902,"target":7239},{"edgeType":"contains","source":6879,"target":6895},{"edgeType":"contains","source":2849,"target":2873},{"edgeType":"contains","source":7208,"target":7266},{"edgeType":"contains","source":13117,"target":13297},{"edgeType":"contains","source":4567,"target":4579},{"edgeType":"contains","source":11547,"target":12285},{"edgeType":"contains","source":1887,"target":2038},{"edgeType":"calls","source":5112,"target":4190},{"edgeType":"contains","source":5981,"target":6194},{"edgeType":"contains","source":10942,"target":10956},{"edgeType":"contains","source":1144,"target":1820},{"edgeType":"contains","source":273,"target":281},{"edgeType":"contains","source":2585,"target":2598},{"edgeType":"contains","source":13649,"target":13717},{"edgeType":"calls","source":2233,"target":1476},{"edgeType":"contains","source":13815,"target":13856},{"edgeType":"contains","source":6514,"target":6584},{"edgeType":"contains","source":12394,"target":12454},{"edgeType":"contains","source":2269,"target":2881},{"edgeType":"contains","source":8066,"target":8153},{"edgeType":"calls","source":2011,"target":2019},{"edgeType":"contains","source":2849,"target":2870},{"edgeType":"contains","source":108,"target":111},{"edgeType":"contains","source":6384,"target":6386},{"edgeType":"contains","source":7601,"target":7770},{"edgeType":"contains","source":13117,"target":13296},{"edgeType":"contains","source":5155,"target":4320},{"edgeType":"contains","source":8930,"target":8852},{"edgeType":"contains","source":11713,"target":1853},{"edgeType":"contains","source":11569,"target":11604},{"edgeType":"contains","source":3234,"target":3621},{"edgeType":"contains","source":10843,"target":10855},{"edgeType":"contains","source":1144,"target":1819},{"edgeType":"contains","source":7474,"target":7479},{"edgeType":"contains","source":9621,"target":9628},{"edgeType":"contains","source":240,"target":246},{"edgeType":"contains","source":273,"target":280},{"edgeType":"calls","source":2233,"target":1477},{"edgeType":"calls","source":2111,"target":1031},{"edgeType":"calls","source":13073,"target":13179},{"edgeType":"contains","source":8066,"target":8152},{"edgeType":"contains","source":12254,"target":12565},{"edgeType":"contains","source":3576,"target":3588},{"edgeType":"contains","source":2849,"target":2871},{"edgeType":"contains","source":108,"target":110},{"edgeType":"contains","source":6384,"target":6387},{"edgeType":"calls","source":591,"target":586},{"edgeType":"imports","source":3154,"target":2005},{"edgeType":"contains","source":7601,"target":7769},{"edgeType":"calls","source":759,"target":663},{"edgeType":"contains","source":7208,"target":7268},{"edgeType":"contains","source":13117,"target":13295},{"edgeType":"contains","source":8927,"target":8944},{"edgeType":"calls","source":10187,"target":3286},{"edgeType":"calls","source":12431,"target":1371},{"edgeType":"calls","source":4492,"target":4381},{"edgeType":"contains","source":7344,"target":2005},{"edgeType":"contains","source":9918,"target":9946},{"edgeType":"contains","source":3741,"target":3765},{"edgeType":"contains","source":273,"target":283},{"edgeType":"contains","source":12723,"target":12840},{"edgeType":"contains","source":1087,"target":1475},{"edgeType":"contains","source":2269,"target":2887},{"edgeType":"calls","source":2508,"target":2462},{"edgeType":"contains","source":5981,"target":6204},{"edgeType":"contains","source":1528,"target":1546},{"edgeType":"calls","source":7362,"target":7358},{"edgeType":"calls","source":591,"target":580},{"edgeType":"contains","source":13117,"target":13311},{"edgeType":"calls","source":2026,"target":491},{"edgeType":"contains","source":3310,"target":3384},{"edgeType":"calls","source":11117,"target":3000},{"edgeType":"imports","source":11983,"target":11595},{"edgeType":"contains","source":12990,"target":13019},{"edgeType":"contains","source":10216,"target":10222},{"edgeType":"contains","source":8096,"target":8291},{"edgeType":"calls","source":11458,"target":3000},{"edgeType":"calls","source":6422,"target":5844},{"edgeType":"contains","source":471,"target":487},{"edgeType":"calls","source":12082,"target":568},{"edgeType":"contains","source":10367,"target":10826},{"edgeType":"calls","source":12142,"target":2936},{"edgeType":"contains","source":5786,"target":5908},{"edgeType":"calls","source":11914,"target":2606},{"edgeType":"contains","source":1144,"target":1821},{"edgeType":"contains","source":12723,"target":12839},{"edgeType":"contains","source":273,"target":282},{"edgeType":"contains","source":1528,"target":1547},{"edgeType":"contains","source":13117,"target":13310},{"edgeType":"contains","source":3310,"target":3385},{"edgeType":"contains","source":9506,"target":10032},{"edgeType":"contains","source":1585,"target":837},{"edgeType":"imports","source":1797,"target":1805},{"edgeType":"contains","source":3741,"target":3764},{"edgeType":"contains","source":13387,"target":13396},{"edgeType":"contains","source":10216,"target":10223},{"edgeType":"contains","source":108,"target":112},{"edgeType":"imports","source":10237,"target":3354},{"edgeType":"contains","source":12099,"target":12100},{"edgeType":"contains","source":4567,"target":4584},{"edgeType":"calls","source":1284,"target":1294},{"edgeType":"calls","source":5112,"target":4187},{"edgeType":"contains","source":3831,"target":4144},{"edgeType":"contains","source":5786,"target":5909},{"edgeType":"contains","source":5883,"target":6073},{"edgeType":"contains","source":13117,"target":13309},{"edgeType":"calls","source":2233,"target":1472},{"edgeType":"contains","source":1797,"target":2718},{"edgeType":"calls","source":12397,"target":1371},{"edgeType":"calls","source":732,"target":440},{"edgeType":"contains","source":13117,"target":13308},{"edgeType":"contains","source":11108,"target":11107},{"edgeType":"calls","source":560,"target":487},{"edgeType":"contains","source":4672,"target":4499},{"edgeType":"contains","source":471,"target":489},{"edgeType":"imports","source":1797,"target":1803},{"edgeType":"imports","source":4131,"target":4489},{"edgeType":"contains","source":1087,"target":1476},{"edgeType":"contains","source":273,"target":284},{"edgeType":"calls","source":4624,"target":4514},{"edgeType":"calls","source":1708,"target":837},{"edgeType":"contains","source":5409,"target":678},{"edgeType":"imports","source":7127,"target":403},{"edgeType":"contains","source":9918,"target":9945},{"edgeType":"contains","source":6902,"target":7254},{"edgeType":"imports","source":4639,"target":4597},{"edgeType":"contains","source":1797,"target":2719},{"edgeType":"contains","source":13750,"target":13768},{"edgeType":"contains","source":10216,"target":10221},{"edgeType":"contains","source":8096,"target":8292},{"edgeType":"imports","source":12697,"target":12719},{"edgeType":"contains","source":13117,"target":13307},{"edgeType":"imports","source":5860,"target":5855},{"edgeType":"contains","source":2585,"target":2603},{"edgeType":"contains","source":471,"target":488},{"edgeType":"contains","source":428,"target":764},{"edgeType":"contains","source":12268,"target":12144},{"edgeType":"calls","source":11764,"target":11482},{"edgeType":"contains","source":6384,"target":6399},{"edgeType":"contains","source":8581,"target":2770},{"edgeType":"contains","source":13420,"target":13427},{"edgeType":"imports","source":1797,"target":1802},{"edgeType":"contains","source":3741,"target":3769},{"edgeType":"calls","source":8287,"target":8284},{"edgeType":"contains","source":7208,"target":7274},{"edgeType":"imports","source":12892,"target":13009},{"edgeType":"contains","source":5981,"target":6200},{"edgeType":"contains","source":1528,"target":1550},{"edgeType":"contains","source":3310,"target":3388},{"edgeType":"contains","source":5409,"target":685},{"edgeType":"contains","source":11547,"target":12295},{"edgeType":"contains","source":1958,"target":1962},{"edgeType":"contains","source":1,"target":263},{"edgeType":"imports","source":3763,"target":3214},{"edgeType":"contains","source":13117,"target":13306},{"edgeType":"contains","source":1887,"target":2049},{"edgeType":"calls","source":11788,"target":11800},{"edgeType":"contains","source":4567,"target":4589},{"edgeType":"contains","source":12297,"target":12301},{"edgeType":"contains","source":2254,"target":2299},{"edgeType":"calls","source":5150,"target":5120},{"edgeType":"calls","source":3167,"target":3171},{"edgeType":"contains","source":2949,"target":2953},{"edgeType":"imports","source":1797,"target":1801},{"edgeType":"contains","source":6514,"target":6591},{"edgeType":"contains","source":9390,"target":9396},{"edgeType":"contains","source":8066,"target":8158},{"edgeType":"contains","source":1087,"target":1478},{"edgeType":"contains","source":7208,"target":7275},{"edgeType":"calls","source":12093,"target":11860},{"edgeType":"calls","source":4793,"target":2444},{"edgeType":"contains","source":8096,"target":8285},{"edgeType":"contains","source":11242,"target":11181},{"edgeType":"contains","source":5786,"target":5904},{"edgeType":"calls","source":8948,"target":8933},{"edgeType":"contains","source":1396,"target":1415},{"edgeType":"contains","source":3311,"target":3358},{"edgeType":"contains","source":1958,"target":1963},{"edgeType":"contains","source":13750,"target":13766},{"edgeType":"calls","source":11821,"target":11835},{"edgeType":"contains","source":3907,"target":3908},{"edgeType":"imports","source":3898,"target":1144},{"edgeType":"contains","source":1,"target":2376},{"edgeType":"calls","source":4839,"target":4190},{"edgeType":"contains","source":13117,"target":13305},{"edgeType":"calls","source":7627,"target":7604},{"edgeType":"calls","source":9410,"target":9410},{"edgeType":"contains","source":8676,"target":1933},{"edgeType":"contains","source":12297,"target":12300},{"edgeType":"calls","source":1583,"target":1534},{"edgeType":"contains","source":12571,"target":12262},{"edgeType":"contains","source":8078,"target":2504},{"edgeType":"calls","source":3306,"target":3087},{"edgeType":"imports","source":1797,"target":1800},{"edgeType":"contains","source":3741,"target":3767},{"edgeType":"contains","source":5883,"target":6069},{"edgeType":"contains","source":8177,"target":2606},{"edgeType":"contains","source":3831,"target":4148},{"edgeType":"contains","source":11547,"target":12293},{"edgeType":"contains","source":1887,"target":2046},{"edgeType":"calls","source":4770,"target":4213},{"edgeType":"contains","source":3310,"target":3386},{"edgeType":"contains","source":5786,"target":5905},{"edgeType":"calls","source":2605,"target":2620},{"edgeType":"contains","source":11634,"target":11710},{"edgeType":"calls","source":12680,"target":12687},{"edgeType":"imports","source":8523,"target":1524},{"edgeType":"contains","source":13117,"target":13304},{"edgeType":"contains","source":1218,"target":1645},{"edgeType":"contains","source":1887,"target":2047},{"edgeType":"contains","source":1958,"target":1960},{"edgeType":"contains","source":8096,"target":8289},{"edgeType":"imports","source":8107,"target":679},{"edgeType":"contains","source":12297,"target":12299},{"edgeType":"calls","source":5187,"target":5028},{"edgeType":"calls","source":1549,"target":1534},{"edgeType":"contains","source":471,"target":493},{"edgeType":"calls","source":5736,"target":693},{"edgeType":"contains","source":6917,"target":2555},{"edgeType":"contains","source":240,"target":254},{"edgeType":"contains","source":3741,"target":3766},{"edgeType":"contains","source":12204,"target":9895},{"edgeType":"contains","source":2269,"target":2890},{"edgeType":"contains","source":5786,"target":5906},{"edgeType":"contains","source":11712,"target":2951},{"edgeType":"contains","source":7276,"target":7283},{"edgeType":"calls","source":1955,"target":575},{"edgeType":"contains","source":13387,"target":13390},{"edgeType":"calls","source":6222,"target":2539},{"edgeType":"contains","source":13649,"target":13724},{"edgeType":"contains","source":5686,"target":5835},{"edgeType":"contains","source":3944,"target":3815},{"edgeType":"contains","source":1144,"target":1827},{"edgeType":"calls","source":347,"target":742},{"edgeType":"calls","source":4794,"target":2411},{"edgeType":"contains","source":5424,"target":5502},{"edgeType":"contains","source":11864,"target":9865},{"edgeType":"contains","source":13117,"target":13303},{"edgeType":"contains","source":1218,"target":1646},{"edgeType":"calls","source":4191,"target":4192},{"edgeType":"contains","source":1887,"target":2048},{"edgeType":"calls","source":7171,"target":602},{"edgeType":"contains","source":10281,"target":10316},{"edgeType":"contains","source":1958,"target":1961},{"edgeType":"contains","source":8096,"target":8288},{"edgeType":"contains","source":12254,"target":12574},{"edgeType":"contains","source":6384,"target":6395},{"edgeType":"contains","source":2254,"target":2298},{"edgeType":"contains","source":6917,"target":2556},{"edgeType":"contains","source":10689,"target":10352},{"edgeType":"contains","source":13117,"target":13286},{"edgeType":"contains","source":2816,"target":2818},{"edgeType":"contains","source":11239,"target":11252},{"edgeType":"calls","source":11804,"target":2951},{"edgeType":"calls","source":9040,"target":1957},{"edgeType":"contains","source":12990,"target":12995},{"edgeType":"imports","source":12574,"target":2845},{"edgeType":"contains","source":9173,"target":9761},{"edgeType":"calls","source":12362,"target":12079},{"edgeType":"contains","source":10875,"target":10909},{"edgeType":"contains","source":1887,"target":2020},{"edgeType":"contains","source":8066,"target":8139},{"edgeType":"contains","source":4591,"target":4873},{"edgeType":"contains","source":404,"target":425},{"edgeType":"contains","source":397,"target":642},{"edgeType":"contains","source":428,"target":738},{"edgeType":"contains","source":2269,"target":2862},{"edgeType":"contains","source":9953,"target":9894},{"edgeType":"contains","source":4132,"target":4304},{"edgeType":"contains","source":9878,"target":10105},{"edgeType":"imports","source":7908,"target":562},{"edgeType":"contains","source":2949,"target":2924},{"edgeType":"calls","source":4701,"target":4334},{"edgeType":"contains","source":13117,"target":13285},{"edgeType":"contains","source":11454,"target":2474},{"edgeType":"contains","source":12990,"target":12994},{"edgeType":"contains","source":10843,"target":10845},{"edgeType":"calls","source":594,"target":577},{"edgeType":"contains","source":8066,"target":8138},{"edgeType":"calls","source":2204,"target":351},{"edgeType":"contains","source":646,"target":321},{"edgeType":"contains","source":12254,"target":12555},{"edgeType":"contains","source":6514,"target":6570},{"edgeType":"calls","source":11642,"target":10088},{"edgeType":"contains","source":397,"target":641},{"edgeType":"contains","source":1,"target":233},{"edgeType":"contains","source":3853,"target":3439},{"edgeType":"contains","source":13649,"target":13705},{"edgeType":"calls","source":5218,"target":5220},{"edgeType":"contains","source":9793,"target":8509},{"edgeType":"contains","source":899,"target":938},{"edgeType":"contains","source":4963,"target":4967},{"edgeType":"contains","source":4944,"target":4499},{"edgeType":"contains","source":13117,"target":13284},{"edgeType":"contains","source":8927,"target":8933},{"edgeType":"contains","source":10942,"target":10944},{"edgeType":"contains","source":12990,"target":12993},{"edgeType":"contains","source":11008,"target":11012},{"edgeType":"calls","source":806,"target":351},{"edgeType":"contains","source":12131,"target":12139},{"edgeType":"contains","source":3906,"target":3909},{"edgeType":"contains","source":12254,"target":12554},{"edgeType":"contains","source":13649,"target":13704},{"edgeType":"contains","source":11713,"target":1841},{"edgeType":"contains","source":1887,"target":2018},{"edgeType":"imports","source":10508,"target":2409},{"edgeType":"contains","source":5723,"target":5724},{"edgeType":"contains","source":397,"target":644},{"edgeType":"imports","source":10069,"target":1218},{"edgeType":"contains","source":899,"target":937},{"edgeType":"calls","source":3302,"target":3307},{"edgeType":"calls","source":1799,"target":221},{"edgeType":"contains","source":6917,"target":2536},{"edgeType":"imports","source":1434,"target":1470},{"edgeType":"calls","source":2338,"target":2537},{"edgeType":"calls","source":4794,"target":4620},{"edgeType":"calls","source":11925,"target":11884},{"edgeType":"imports","source":7072,"target":2166},{"edgeType":"contains","source":13117,"target":13283},{"edgeType":"contains","source":1882,"target":2174},{"edgeType":"contains","source":1881,"target":2205},{"edgeType":"calls","source":2245,"target":2249},{"edgeType":"contains","source":12254,"target":12553},{"edgeType":"calls","source":2853,"target":1371},{"edgeType":"contains","source":11547,"target":12273},{"edgeType":"contains","source":13649,"target":13703},{"edgeType":"contains","source":5723,"target":5725},{"edgeType":"contains","source":397,"target":643},{"edgeType":"contains","source":13815,"target":13842},{"edgeType":"contains","source":5981,"target":6183},{"edgeType":"contains","source":2320,"target":2337},{"edgeType":"contains","source":9878,"target":10104},{"edgeType":"contains","source":2269,"target":2861},{"edgeType":"contains","source":11965,"target":11999},{"edgeType":"calls","source":2668,"target":1817},{"edgeType":"contains","source":11242,"target":11155},{"edgeType":"contains","source":9878,"target":10100},{"edgeType":"calls","source":9819,"target":8467},{"edgeType":"contains","source":1218,"target":1622},{"edgeType":"contains","source":12990,"target":12991},{"edgeType":"contains","source":13117,"target":13282},{"edgeType":"calls","source":4324,"target":4391},{"edgeType":"calls","source":12983,"target":12917},{"edgeType":"calls","source":4939,"target":4353},{"edgeType":"contains","source":5981,"target":6176},{"edgeType":"contains","source":6902,"target":7221},{"edgeType":"contains","source":8762,"target":9813},{"edgeType":"contains","source":13649,"target":13702},{"edgeType":"calls","source":12386,"target":11339},{"edgeType":"contains","source":1882,"target":2179},{"edgeType":"contains","source":8066,"target":8135},{"edgeType":"contains","source":3906,"target":3915},{"edgeType":"contains","source":8200,"target":8209},{"edgeType":"contains","source":8676,"target":1908},{"edgeType":"contains","source":11242,"target":11156},{"edgeType":"calls","source":11232,"target":11175},{"edgeType":"calls","source":6509,"target":6430},{"edgeType":"calls","source":4535,"target":4191},{"edgeType":"contains","source":11008,"target":11011},{"edgeType":"calls","source":4671,"target":1032},{"edgeType":"contains","source":1218,"target":1623},{"edgeType":"calls","source":7861,"target":7857},{"edgeType":"contains","source":9223,"target":9263},{"edgeType":"contains","source":13117,"target":13281},{"edgeType":"contains","source":6053,"target":6059},{"edgeType":"contains","source":8167,"target":8174},{"edgeType":"calls","source":2245,"target":2247},{"edgeType":"contains","source":12254,"target":12551},{"edgeType":"calls","source":4997,"target":4668},{"edgeType":"contains","source":5981,"target":6177},{"edgeType":"calls","source":8436,"target":602},{"edgeType":"contains","source":12921,"target":13014},{"edgeType":"contains","source":397,"target":645},{"edgeType":"contains","source":8762,"target":9812},{"edgeType":"contains","source":13649,"target":13701},{"edgeType":"contains","source":3708,"target":3710},{"edgeType":"contains","source":5883,"target":6044},{"edgeType":"calls","source":7105,"target":6981},{"edgeType":"contains","source":9918,"target":9919},{"edgeType":"contains","source":1887,"target":2025},{"edgeType":"contains","source":1882,"target":2180},{"edgeType":"imports","source":2400,"target":1119},{"edgeType":"contains","source":3906,"target":3914},{"edgeType":"contains","source":8299,"target":8310},{"edgeType":"imports","source":2400,"target":1118},{"edgeType":"contains","source":4179,"target":4963},{"edgeType":"contains","source":10686,"target":10419},{"edgeType":"contains","source":7601,"target":7753},{"edgeType":"contains","source":11074,"target":11076},{"edgeType":"contains","source":13117,"target":13280},{"edgeType":"contains","source":8927,"target":8929},{"edgeType":"imports","source":10237,"target":9757},{"edgeType":"calls","source":4973,"target":4353},{"edgeType":"calls","source":4535,"target":4190},{"edgeType":"contains","source":7208,"target":7251},{"edgeType":"contains","source":1867,"target":1585},{"edgeType":"contains","source":3906,"target":3913},{"edgeType":"contains","source":8762,"target":9815},{"edgeType":"contains","source":13649,"target":13700},{"edgeType":"contains","source":6053,"target":6060},{"edgeType":"contains","source":1882,"target":2177},{"edgeType":"contains","source":11547,"target":12268},{"edgeType":"calls","source":3183,"target":649},{"edgeType":"contains","source":2448,"target":2600},{"edgeType":"contains","source":3741,"target":3743},{"edgeType":"contains","source":3708,"target":3709},{"edgeType":"calls","source":11309,"target":9842},{"edgeType":"contains","source":2269,"target":2864},{"edgeType":"calls","source":5899,"target":4187},{"edgeType":"calls","source":8985,"target":8954},{"edgeType":"contains","source":1,"target":240},{"edgeType":"contains","source":8066,"target":8137},{"edgeType":"contains","source":9878,"target":10099},{"edgeType":"calls","source":12030,"target":11804},{"edgeType":"calls","source":1898,"target":1376},{"edgeType":"contains","source":12723,"target":12808},{"edgeType":"calls","source":3291,"target":1530},{"edgeType":"contains","source":13117,"target":13279},{"edgeType":"contains","source":8927,"target":8928},{"edgeType":"contains","source":8925,"target":8990},{"edgeType":"contains","source":11008,"target":11009},{"edgeType":"contains","source":1218,"target":1621},{"edgeType":"contains","source":3906,"target":3912},{"edgeType":"contains","source":5981,"target":6179},{"edgeType":"contains","source":8762,"target":9814},{"edgeType":"imports","source":11058,"target":1218},{"edgeType":"contains","source":13649,"target":13699},{"edgeType":"contains","source":8863,"target":8797},{"edgeType":"imports","source":2840,"target":1218},{"edgeType":"contains","source":7346,"target":7202},{"edgeType":"contains","source":12921,"target":13012},{"edgeType":"calls","source":2141,"target":1241},{"edgeType":"contains","source":12131,"target":12134},{"edgeType":"contains","source":12147,"target":9524},{"edgeType":"contains","source":2269,"target":2865},{"edgeType":"contains","source":1882,"target":2178},{"edgeType":"contains","source":10090,"target":9870},{"edgeType":"contains","source":6144,"target":6411},{"edgeType":"contains","source":6053,"target":6061},{"edgeType":"contains","source":4132,"target":4305},{"edgeType":"contains","source":13649,"target":13715},{"edgeType":"imports","source":7434,"target":448},{"edgeType":"contains","source":9621,"target":9623},{"edgeType":"contains","source":6917,"target":2541},{"edgeType":"contains","source":4132,"target":4312},{"edgeType":"contains","source":13750,"target":13755},{"edgeType":"calls","source":7960,"target":7962},{"edgeType":"contains","source":12064,"target":12112},{"edgeType":"contains","source":2849,"target":2860},{"edgeType":"calls","source":1138,"target":619},{"edgeType":"contains","source":2519,"target":2520},{"edgeType":"contains","source":6514,"target":6578},{"edgeType":"contains","source":7208,"target":7261},{"edgeType":"contains","source":11259,"target":11697},{"edgeType":"contains","source":1882,"target":2183},{"edgeType":"contains","source":5981,"target":6188},{"edgeType":"contains","source":3906,"target":3919},{"edgeType":"contains","source":13117,"target":13294},{"edgeType":"imports","source":6654,"target":6658},{"edgeType":"contains","source":3576,"target":3579},{"edgeType":"contains","source":4841,"target":4530},{"edgeType":"contains","source":10238,"target":10581},{"edgeType":"contains","source":9621,"target":9622},{"edgeType":"contains","source":13649,"target":13714},{"edgeType":"contains","source":1218,"target":1627},{"edgeType":"calls","source":7340,"target":7099},{"edgeType":"contains","source":8762,"target":9825},{"edgeType":"contains","source":4567,"target":4568},{"edgeType":"contains","source":6514,"target":6579},{"edgeType":"contains","source":9918,"target":9931},{"edgeType":"contains","source":7208,"target":7262},{"edgeType":"contains","source":1144,"target":1804},{"edgeType":"calls","source":4535,"target":4187},{"edgeType":"contains","source":1528,"target":1531},{"edgeType":"contains","source":1882,"target":2184},{"edgeType":"contains","source":3906,"target":3918},{"edgeType":"contains","source":5409,"target":5948},{"edgeType":"contains","source":13117,"target":13293},{"edgeType":"calls","source":7077,"target":454},{"edgeType":"contains","source":7601,"target":7763},{"edgeType":"contains","source":13649,"target":13713},{"edgeType":"contains","source":11074,"target":11088},{"edgeType":"contains","source":11786,"target":11214},{"edgeType":"contains","source":13117,"target":13292},{"edgeType":"contains","source":8927,"target":8941},{"edgeType":"contains","source":13783,"target":13787},{"edgeType":"contains","source":1218,"target":1624},{"edgeType":"calls","source":7996,"target":7905},{"edgeType":"contains","source":2585,"target":2586},{"edgeType":"contains","source":6514,"target":6580},{"edgeType":"calls","source":6739,"target":6705},{"edgeType":"contains","source":7208,"target":7263},{"edgeType":"contains","source":4444,"target":4151},{"edgeType":"contains","source":9878,"target":10111},{"edgeType":"contains","source":1144,"target":1807},{"edgeType":"contains","source":5883,"target":6057},{"edgeType":"contains","source":7601,"target":7766},{"edgeType":"contains","source":3906,"target":3917},{"edgeType":"contains","source":13649,"target":13712},{"edgeType":"contains","source":1887,"target":2026},{"edgeType":"contains","source":1882,"target":2181},{"edgeType":"calls","source":1898,"target":1372},{"edgeType":"calls","source":10882,"target":3000},{"edgeType":"contains","source":13750,"target":13752},{"edgeType":"contains","source":10237,"target":9553},{"edgeType":"contains","source":11098,"target":10345},{"edgeType":"contains","source":13117,"target":13291},{"edgeType":"contains","source":8925,"target":9002},{"edgeType":"contains","source":1218,"target":1625},{"edgeType":"imports","source":7128,"target":2536},{"edgeType":"contains","source":2585,"target":2587},{"edgeType":"contains","source":471,"target":472},{"edgeType":"contains","source":2518,"target":2550},{"edgeType":"calls","source":3043,"target":1814},{"edgeType":"contains","source":6514,"target":6581},{"edgeType":"contains","source":12592,"target":12653},{"edgeType":"contains","source":1124,"target":1369},{"edgeType":"contains","source":7771,"target":7780},{"edgeType":"contains","source":5883,"target":6058},{"edgeType":"contains","source":9878,"target":10112},{"edgeType":"contains","source":12078,"target":11675},{"edgeType":"contains","source":2269,"target":2869},{"edgeType":"calls","source":454,"target":683},{"edgeType":"contains","source":3234,"target":3608},{"edgeType":"contains","source":1882,"target":2182},{"edgeType":"contains","source":7601,"target":7765},{"edgeType":"contains","source":3906,"target":3916},{"edgeType":"contains","source":7208,"target":7264},{"edgeType":"contains","source":13649,"target":13711},{"edgeType":"contains","source":7601,"target":7759},{"edgeType":"calls","source":7763,"target":7731},{"edgeType":"contains","source":13750,"target":13751},{"edgeType":"contains","source":13783,"target":13785},{"edgeType":"calls","source":2905,"target":2918},{"edgeType":"contains","source":2788,"target":2641},{"edgeType":"imports","source":1434,"target":420},{"edgeType":"calls","source":11802,"target":11482},{"edgeType":"contains","source":13117,"target":13290},{"edgeType":"calls","source":1660,"target":1345},{"edgeType":"contains","source":12919,"target":13086},{"edgeType":"contains","source":2254,"target":2282},{"edgeType":"calls","source":5117,"target":5168},{"edgeType":"contains","source":471,"target":475},{"edgeType":"contains","source":2269,"target":2874},{"edgeType":"contains","source":11713,"target":1847},{"edgeType":"contains","source":7208,"target":7257},{"edgeType":"contains","source":12204,"target":9882},{"edgeType":"calls","source":10317,"target":436},{"edgeType":"calls","source":12753,"target":12656},{"edgeType":"contains","source":5723,"target":5726},{"edgeType":"contains","source":1124,"target":1372},{"edgeType":"contains","source":6023,"target":5939},{"edgeType":"calls","source":8909,"target":746},{"edgeType":"contains","source":9878,"target":10109},{"edgeType":"calls","source":2343,"target":2371},{"edgeType":"contains","source":13649,"target":13710},{"edgeType":"contains","source":1218,"target":1631},{"edgeType":"contains","source":4132,"target":4315},{"edgeType":"calls","source":5841,"target":693},{"edgeType":"contains","source":11074,"target":11087},{"edgeType":"contains","source":13117,"target":13289},{"edgeType":"contains","source":10875,"target":10914},{"edgeType":"calls","source":1617,"target":1620},{"edgeType":"contains","source":8927,"target":8934},{"edgeType":"imports","source":11259,"target":266},{"edgeType":"contains","source":5883,"target":6052},{"edgeType":"contains","source":2269,"target":2875},{"edgeType":"contains","source":10689,"target":10338},{"edgeType":"contains","source":3747,"target":3566},{"edgeType":"contains","source":12824,"target":12859},{"edgeType":"contains","source":8066,"target":8142},{"edgeType":"calls","source":1029,"target":821},{"edgeType":"contains","source":4963,"target":4980},{"edgeType":"contains","source":1,"target":5530},{"edgeType":"calls","source":6522,"target":6036},{"edgeType":"calls","source":12719,"target":12652},{"edgeType":"contains","source":13550,"target":13607},{"edgeType":"contains","source":1396,"target":1399},{"edgeType":"contains","source":11569,"target":11597},{"edgeType":"contains","source":13649,"target":13709},{"edgeType":"calls","source":2226,"target":710},{"edgeType":"calls","source":7699,"target":7603},{"edgeType":"contains","source":13117,"target":13288},{"edgeType":"contains","source":13815,"target":13848},{"edgeType":"contains","source":8927,"target":8937},{"edgeType":"imports","source":10514,"target":10675},{"edgeType":"imports","source":2345,"target":717},{"edgeType":"contains","source":11165,"target":10377},{"edgeType":"contains","source":8299,"target":3036},{"edgeType":"contains","source":10238,"target":10574},{"edgeType":"contains","source":11239,"target":11254},{"edgeType":"contains","source":8762,"target":9824},{"edgeType":"contains","source":10710,"target":10740},{"edgeType":"calls","source":1749,"target":1759},{"edgeType":"calls","source":8909,"target":748},{"edgeType":"calls","source":7926,"target":7965},{"edgeType":"calls","source":1684,"target":1660},{"edgeType":"contains","source":4963,"target":4979},{"edgeType":"contains","source":13649,"target":13708},{"edgeType":"contains","source":9878,"target":10107},{"edgeType":"contains","source":1882,"target":2185},{"edgeType":"contains","source":5981,"target":6186},{"edgeType":"contains","source":5409,"target":666},{"edgeType":"contains","source":1528,"target":1532},{"edgeType":"contains","source":13117,"target":13287},{"edgeType":"contains","source":1882,"target":2186},{"edgeType":"contains","source":8331,"target":5214},{"edgeType":"calls","source":12260,"target":454},{"edgeType":"contains","source":8762,"target":9823},{"edgeType":"contains","source":2849,"target":2863},{"edgeType":"imports","source":11616,"target":1881},{"edgeType":"contains","source":7208,"target":7260},{"edgeType":"contains","source":5883,"target":6054},{"edgeType":"calls","source":6805,"target":436},{"edgeType":"imports","source":4743,"target":4597},{"edgeType":"calls","source":8819,"target":8822},{"edgeType":"contains","source":12254,"target":12557},{"edgeType":"contains","source":3906,"target":3920},{"edgeType":"contains","source":13649,"target":13707},{"edgeType":"contains","source":9878,"target":10108},{"edgeType":"contains","source":1396,"target":1397},{"edgeType":"contains","source":3687,"target":3310},{"edgeType":"contains","source":5409,"target":5950},{"edgeType":"imports","source":10301,"target":9878},{"edgeType":"contains","source":1528,"target":1533},{"edgeType":"contains","source":5981,"target":6163},{"edgeType":"calls","source":4979,"target":4190},{"edgeType":"contains","source":3311,"target":3312},{"edgeType":"contains","source":1887,"target":2003},{"edgeType":"imports","source":1797,"target":1831},{"edgeType":"contains","source":3763,"target":4099},{"edgeType":"contains","source":1,"target":217},{"edgeType":"contains","source":13649,"target":13690},{"edgeType":"contains","source":12064,"target":12087},{"edgeType":"contains","source":2320,"target":2322},{"edgeType":"contains","source":428,"target":722},{"edgeType":"contains","source":305,"target":307},{"edgeType":"contains","source":2943,"target":3092},{"edgeType":"contains","source":938,"target":767},{"edgeType":"calls","source":3202,"target":3253},{"edgeType":"calls","source":5886,"target":4613},{"edgeType":"contains","source":9223,"target":9251},{"edgeType":"contains","source":1144,"target":1780},{"edgeType":"contains","source":12919,"target":13065},{"edgeType":"contains","source":5981,"target":6164},{"edgeType":"contains","source":4639,"target":5482},{"edgeType":"contains","source":1881,"target":2190},{"edgeType":"imports","source":8299,"target":2166},{"edgeType":"contains","source":12254,"target":12538},{"edgeType":"contains","source":2518,"target":2527},{"edgeType":"calls","source":9710,"target":9710},{"edgeType":"calls","source":11295,"target":11315},{"edgeType":"contains","source":13649,"target":13689},{"edgeType":"contains","source":305,"target":306},{"edgeType":"contains","source":428,"target":721},{"edgeType":"contains","source":9953,"target":9878},{"edgeType":"contains","source":6053,"target":6046},{"edgeType":"contains","source":8096,"target":8248},{"edgeType":"contains","source":2254,"target":2255},{"edgeType":"calls","source":7961,"target":7907},{"edgeType":"calls","source":4638,"target":4190},{"edgeType":"contains","source":12423,"target":12585},{"edgeType":"contains","source":3085,"target":2919},{"edgeType":"calls","source":8158,"target":8142},{"edgeType":"contains","source":1144,"target":1779},{"edgeType":"contains","source":13117,"target":13268},{"edgeType":"contains","source":12919,"target":13064},{"edgeType":"calls","source":4324,"target":4409},{"edgeType":"contains","source":428,"target":724},{"edgeType":"contains","source":13649,"target":13688},{"edgeType":"calls","source":4964,"target":4653},{"edgeType":"contains","source":4132,"target":4285},{"edgeType":"contains","source":2353,"target":2354},{"edgeType":"calls","source":7963,"target":7846},{"edgeType":"imports","source":10514,"target":10663},{"edgeType":"contains","source":2943,"target":3090},{"edgeType":"contains","source":12428,"target":12429},{"edgeType":"contains","source":7208,"target":7238},{"edgeType":"contains","source":13117,"target":13267},{"edgeType":"contains","source":1144,"target":1782},{"edgeType":"contains","source":12919,"target":13063},{"edgeType":"calls","source":1526,"target":1301},{"edgeType":"contains","source":12921,"target":13000},{"edgeType":"contains","source":12919,"target":13062},{"edgeType":"calls","source":8257,"target":8247},{"edgeType":"calls","source":2211,"target":148},{"edgeType":"contains","source":13649,"target":13687},{"edgeType":"contains","source":1881,"target":2188},{"edgeType":"contains","source":9421,"target":9457},{"edgeType":"contains","source":12423,"target":12582},{"edgeType":"contains","source":4132,"target":4284},{"edgeType":"contains","source":9878,"target":10087},{"edgeType":"contains","source":305,"target":308},{"edgeType":"contains","source":5981,"target":6166},{"edgeType":"contains","source":5883,"target":6033},{"edgeType":"contains","source":2269,"target":2844},{"edgeType":"contains","source":2943,"target":3091},{"edgeType":"contains","source":12618,"target":12880},{"edgeType":"contains","source":12423,"target":12583},{"edgeType":"contains","source":3476,"target":3480},{"edgeType":"calls","source":231,"target":222},{"edgeType":"calls","source":4161,"target":4177},{"edgeType":"contains","source":12692,"target":12700},{"edgeType":"calls","source":693,"target":698},{"edgeType":"contains","source":1144,"target":1781},{"edgeType":"contains","source":8762,"target":9802},{"edgeType":"contains","source":13117,"target":13266},{"edgeType":"calls","source":9868,"target":2703},{"edgeType":"contains","source":12921,"target":12999},{"edgeType":"contains","source":12919,"target":13061},{"edgeType":"contains","source":9488,"target":9489},{"edgeType":"calls","source":11948,"target":2703},{"edgeType":"contains","source":12856,"target":12900},{"edgeType":"contains","source":397,"target":630},{"edgeType":"contains","source":13649,"target":13686},{"edgeType":"contains","source":12432,"target":12302},{"edgeType":"contains","source":12423,"target":12581},{"edgeType":"contains","source":2320,"target":2326},{"edgeType":"calls","source":8818,"target":8827},{"edgeType":"imports","source":11541,"target":3144},{"edgeType":"contains","source":1887,"target":2007},{"edgeType":"calls","source":1849,"target":796},{"edgeType":"contains","source":4179,"target":4949},{"edgeType":"contains","source":4236,"target":4239},{"edgeType":"contains","source":4132,"target":4292},{"edgeType":"contains","source":10710,"target":10718},{"edgeType":"contains","source":4639,"target":5487},{"edgeType":"contains","source":12824,"target":12835},{"edgeType":"contains","source":13117,"target":13265},{"edgeType":"calls","source":9186,"target":2703},{"edgeType":"contains","source":8197,"target":8284},{"edgeType":"contains","source":12921,"target":12998},{"edgeType":"contains","source":12919,"target":13060},{"edgeType":"contains","source":12856,"target":12899},{"edgeType":"calls","source":7465,"target":7432},{"edgeType":"contains","source":13649,"target":13685},{"edgeType":"contains","source":12064,"target":12082},{"edgeType":"contains","source":8062,"target":8241},{"edgeType":"calls","source":8818,"target":8826},{"edgeType":"contains","source":12423,"target":12580},{"edgeType":"contains","source":239,"target":242},{"edgeType":"contains","source":10237,"target":10583},{"edgeType":"calls","source":1816,"target":1818},{"edgeType":"calls","source":12045,"target":11324},{"edgeType":"contains","source":9223,"target":9246},{"edgeType":"contains","source":4203,"target":4204},{"edgeType":"contains","source":13117,"target":13264},{"edgeType":"contains","source":1218,"target":1607},{"edgeType":"contains","source":7001,"target":7308},{"edgeType":"calls","source":10273,"target":10230},{"edgeType":"contains","source":1140,"target":850},{"edgeType":"contains","source":1124,"target":1346},{"edgeType":"contains","source":1144,"target":1783},{"edgeType":"calls","source":10505,"target":3042},{"edgeType":"contains","source":13649,"target":13684},{"edgeType":"contains","source":11569,"target":11570},{"edgeType":"contains","source":12921,"target":12997},{"edgeType":"contains","source":12919,"target":13059},{"edgeType":"contains","source":1881,"target":2191},{"edgeType":"contains","source":1144,"target":1787},{"edgeType":"contains","source":5981,"target":6161},{"edgeType":"contains","source":12856,"target":12898},{"edgeType":"calls","source":2288,"target":1984},{"edgeType":"contains","source":428,"target":728},{"edgeType":"contains","source":13815,"target":13823},{"edgeType":"contains","source":8197,"target":8287},{"edgeType":"contains","source":8066,"target":8120},{"edgeType":"contains","source":8062,"target":8244},{"edgeType":"contains","source":12618,"target":12877},{"edgeType":"calls","source":12719,"target":12626},{"edgeType":"contains","source":2815,"target":2834},{"edgeType":"contains","source":5786,"target":5864},{"edgeType":"contains","source":10710,"target":10716},{"edgeType":"imports","source":7218,"target":1856},{"edgeType":"contains","source":13117,"target":13263},{"edgeType":"calls","source":2951,"target":2572},{"edgeType":"contains","source":9488,"target":9490},{"edgeType":"contains","source":13649,"target":13683},{"edgeType":"calls","source":127,"target":270},{"edgeType":"imports","source":5968,"target":5723},{"edgeType":"contains","source":12921,"target":12996},{"edgeType":"contains","source":13815,"target":13822},{"edgeType":"contains","source":12423,"target":12578},{"edgeType":"contains","source":11965,"target":11978},{"edgeType":"calls","source":12360,"target":2614},{"edgeType":"imports","source":8525,"target":448},{"edgeType":"contains","source":12618,"target":12876},{"edgeType":"contains","source":12593,"target":12594},{"edgeType":"calls","source":3965,"target":3907},{"edgeType":"contains","source":10710,"target":10717},{"edgeType":"imports","source":10237,"target":9740},{"edgeType":"contains","source":13117,"target":13262},{"edgeType":"calls","source":2741,"target":2741},{"edgeType":"contains","source":397,"target":634},{"edgeType":"contains","source":3080,"target":3082},{"edgeType":"contains","source":12000,"target":11965},{"edgeType":"calls","source":7530,"target":7534},{"edgeType":"contains","source":12064,"target":12095},{"edgeType":"contains","source":428,"target":730},{"edgeType":"contains","source":1144,"target":1789},{"edgeType":"contains","source":9878,"target":10096},{"edgeType":"imports","source":7072,"target":2140},{"edgeType":"imports","source":1111,"target":907},{"edgeType":"calls","source":8255,"target":8314},{"edgeType":"calls","source":12418,"target":2936},{"edgeType":"calls","source":5984,"target":5795},{"edgeType":"contains","source":13117,"target":13278},{"edgeType":"imports","source":12279,"target":11965},{"edgeType":"calls","source":5867,"target":4137},{"edgeType":"contains","source":13649,"target":13698},{"edgeType":"contains","source":8197,"target":8298},{"edgeType":"contains","source":12919,"target":13073},{"edgeType":"contains","source":8096,"target":8258},{"edgeType":"contains","source":1218,"target":1610},{"edgeType":"contains","source":8281,"target":409},{"edgeType":"imports","source":853,"target":448},{"edgeType":"calls","source":990,"target":995},{"edgeType":"contains","source":4639,"target":5491},{"edgeType":"contains","source":3080,"target":3083},{"edgeType":"imports","source":12276,"target":12059},{"edgeType":"contains","source":1144,"target":1788},{"edgeType":"contains","source":8177,"target":2574},{"edgeType":"contains","source":5883,"target":6039},{"edgeType":"contains","source":12064,"target":12094},{"edgeType":"contains","source":12824,"target":12846},{"edgeType":"contains","source":1881,"target":2198},{"edgeType":"calls","source":2132,"target":1534},{"edgeType":"contains","source":13117,"target":13277},{"edgeType":"contains","source":9506,"target":9999},{"edgeType":"calls","source":10602,"target":10609},{"edgeType":"contains","source":8925,"target":8983},{"edgeType":"contains","source":8200,"target":8204},{"edgeType":"contains","source":13649,"target":13697},{"edgeType":"contains","source":6053,"target":6055},{"edgeType":"contains","source":13117,"target":13276},{"edgeType":"contains","source":6902,"target":7218},{"edgeType":"contains","source":6020,"target":6021},{"edgeType":"calls","source":7964,"target":7822},{"edgeType":"contains","source":10237,"target":3197},{"edgeType":"imports","source":11096,"target":10583},{"edgeType":"calls","source":11496,"target":11435},{"edgeType":"contains","source":10281,"target":10289},{"edgeType":"calls","source":12603,"target":6712},{"edgeType":"contains","source":1124,"target":1354},{"edgeType":"contains","source":2320,"target":2328},{"edgeType":"contains","source":13649,"target":13696},{"edgeType":"contains","source":11713,"target":1833},{"edgeType":"contains","source":8200,"target":8207},{"edgeType":"contains","source":8096,"target":8260},{"edgeType":"contains","source":10281,"target":10286},{"edgeType":"contains","source":8762,"target":9811},{"edgeType":"contains","source":6020,"target":6022},{"edgeType":"contains","source":6053,"target":6056},{"edgeType":"contains","source":13117,"target":13275},{"edgeType":"contains","source":4203,"target":4207},{"edgeType":"contains","source":12919,"target":13071},{"edgeType":"contains","source":1218,"target":1608},{"edgeType":"contains","source":4639,"target":5489},{"edgeType":"contains","source":428,"target":732},{"edgeType":"calls","source":5412,"target":270},{"edgeType":"contains","source":8066,"target":8133},{"edgeType":"calls","source":3110,"target":2925},{"edgeType":"contains","source":3080,"target":3081},{"edgeType":"contains","source":10710,"target":10729},{"edgeType":"contains","source":9878,"target":10095},{"edgeType":"contains","source":8177,"target":2576},{"edgeType":"calls","source":2511,"target":2467},{"edgeType":"contains","source":3311,"target":3319},{"edgeType":"contains","source":11984,"target":8230},{"edgeType":"contains","source":7601,"target":7748},{"edgeType":"contains","source":11713,"target":1834},{"edgeType":"contains","source":13649,"target":13695},{"edgeType":"contains","source":8200,"target":8206},{"edgeType":"contains","source":10281,"target":10287},{"edgeType":"contains","source":3476,"target":3488},{"edgeType":"contains","source":4132,"target":4293},{"edgeType":"contains","source":13117,"target":13274},{"edgeType":"contains","source":2254,"target":2261},{"edgeType":"contains","source":12919,"target":13070},{"edgeType":"calls","source":12062,"target":2343},{"edgeType":"contains","source":4841,"target":4511},{"edgeType":"contains","source":12147,"target":9518},{"edgeType":"contains","source":2320,"target":2334},{"edgeType":"imports","source":9475,"target":9044},{"edgeType":"contains","source":2269,"target":2858},{"edgeType":"contains","source":7208,"target":7241},{"edgeType":"contains","source":8068,"target":8064},{"edgeType":"contains","source":8066,"target":8126},{"edgeType":"contains","source":9421,"target":9460},{"edgeType":"calls","source":1814,"target":1873},{"edgeType":"imports","source":9953,"target":568},{"edgeType":"contains","source":9506,"target":9996},{"edgeType":"contains","source":11239,"target":11240},{"edgeType":"contains","source":8096,"target":8253},{"edgeType":"contains","source":9878,"target":10092},{"edgeType":"imports","source":10089,"target":10094},{"edgeType":"contains","source":5981,"target":6167},{"edgeType":"contains","source":13649,"target":13694},{"edgeType":"contains","source":4639,"target":5495},{"edgeType":"calls","source":5728,"target":4213},{"edgeType":"contains","source":13117,"target":13273},{"edgeType":"contains","source":12921,"target":13007},{"edgeType":"contains","source":12919,"target":13069},{"edgeType":"calls","source":5125,"target":709},{"edgeType":"calls","source":990,"target":991},{"edgeType":"contains","source":397,"target":638},{"edgeType":"contains","source":4340,"target":4194},{"edgeType":"contains","source":4374,"target":4197},{"edgeType":"calls","source":2451,"target":2211},{"edgeType":"contains","source":2269,"target":2859},{"edgeType":"contains","source":10237,"target":3192},{"edgeType":"calls","source":1093,"target":968},{"edgeType":"contains","source":8066,"target":8125},{"edgeType":"contains","source":899,"target":931},{"edgeType":"contains","source":9421,"target":9459},{"edgeType":"contains","source":4963,"target":4964},{"edgeType":"contains","source":7239,"target":7338},{"edgeType":"calls","source":12719,"target":12635},{"edgeType":"calls","source":560,"target":578},{"edgeType":"imports","source":5968,"target":5713},{"edgeType":"contains","source":11864,"target":11948},{"edgeType":"contains","source":8096,"target":8252},{"edgeType":"contains","source":5981,"target":6168},{"edgeType":"imports","source":12697,"target":1118},{"edgeType":"contains","source":13649,"target":13693},{"edgeType":"contains","source":13117,"target":13272},{"edgeType":"contains","source":13057,"target":13018},{"edgeType":"contains","source":1887,"target":2017},{"edgeType":"contains","source":12919,"target":13068},{"edgeType":"contains","source":397,"target":637},{"edgeType":"contains","source":4639,"target":5494},{"edgeType":"contains","source":8960,"target":8951},{"edgeType":"contains","source":4370,"target":4320},{"edgeType":"contains","source":5883,"target":6036},{"edgeType":"calls","source":2511,"target":2462},{"edgeType":"calls","source":9410,"target":9512},{"edgeType":"calls","source":1023,"target":1027},{"edgeType":"contains","source":2320,"target":2332},{"edgeType":"contains","source":3851,"target":3495},{"edgeType":"contains","source":899,"target":934},{"edgeType":"contains","source":3080,"target":3084},{"edgeType":"contains","source":10238,"target":10557},{"edgeType":"calls","source":12364,"target":2498},{"edgeType":"contains","source":13649,"target":13692},{"edgeType":"contains","source":9421,"target":9462},{"edgeType":"contains","source":3476,"target":3493},{"edgeType":"contains","source":7601,"target":7745},{"edgeType":"imports","source":12697,"target":1119},{"edgeType":"contains","source":13117,"target":13271},{"edgeType":"contains","source":8299,"target":8305},{"edgeType":"contains","source":8167,"target":8169},{"edgeType":"contains","source":10301,"target":10719},{"edgeType":"contains","source":4132,"target":4298},{"edgeType":"contains","source":8200,"target":8203},{"edgeType":"contains","source":8197,"target":8296},{"edgeType":"contains","source":10281,"target":10282},{"edgeType":"contains","source":10238,"target":10558},{"edgeType":"contains","source":8762,"target":9807},{"edgeType":"contains","source":12921,"target":13005},{"edgeType":"calls","source":5119,"target":5121},{"edgeType":"contains","source":397,"target":640},{"edgeType":"contains","source":12692,"target":12705},{"edgeType":"calls","source":2451,"target":2209},{"edgeType":"contains","source":5883,"target":6037},{"edgeType":"calls","source":5879,"target":5872},{"edgeType":"contains","source":8066,"target":8127},{"edgeType":"contains","source":1881,"target":2200},{"edgeType":"calls","source":1928,"target":454},{"edgeType":"contains","source":5981,"target":6170},{"edgeType":"contains","source":9421,"target":9461},{"edgeType":"calls","source":8261,"target":8135},{"edgeType":"calls","source":9360,"target":491},{"edgeType":"contains","source":8299,"target":8304},{"edgeType":"calls","source":7663,"target":7646},{"edgeType":"contains","source":13117,"target":13270},{"edgeType":"contains","source":4841,"target":4515},{"edgeType":"calls","source":7857,"target":575},{"edgeType":"contains","source":8197,"target":8295},{"edgeType":"contains","source":10281,"target":10283},{"edgeType":"contains","source":1881,"target":2201},{"edgeType":"calls","source":8984,"target":8976},{"edgeType":"contains","source":4132,"target":4297},{"edgeType":"contains","source":10238,"target":10559},{"edgeType":"contains","source":8167,"target":8168},{"edgeType":"contains","source":2448,"target":2593},{"edgeType":"contains","source":12921,"target":13004},{"edgeType":"contains","source":397,"target":639},{"edgeType":"calls","source":5218,"target":5222},{"edgeType":"calls","source":7340,"target":7089},{"edgeType":"imports","source":12436,"target":12441},{"edgeType":"contains","source":13117,"target":13253},{"edgeType":"contains","source":7637,"target":7663},{"edgeType":"contains","source":964,"target":1002},{"edgeType":"calls","source":6737,"target":6723},{"edgeType":"calls","source":1158,"target":1031},{"edgeType":"contains","source":2815,"target":2816},{"edgeType":"contains","source":12394,"target":12411},{"edgeType":"contains","source":8925,"target":8960},{"edgeType":"contains","source":3145,"target":3156},{"edgeType":"contains","source":1124,"target":1327},{"edgeType":"contains","source":12723,"target":12782},{"edgeType":"imports","source":12894,"target":13042},{"edgeType":"contains","source":1144,"target":1764},{"edgeType":"contains","source":1213,"target":682},{"edgeType":"calls","source":658,"target":675},{"edgeType":"contains","source":8951,"target":754},{"edgeType":"contains","source":12254,"target":12523},{"edgeType":"contains","source":4132,"target":4271},{"edgeType":"contains","source":4135,"target":4178},{"edgeType":"contains","source":13649,"target":13673},{"edgeType":"calls","source":1232,"target":850},{"edgeType":"contains","source":1603,"target":221},{"edgeType":"calls","source":11427,"target":11435},{"edgeType":"contains","source":964,"target":1001},{"edgeType":"contains","source":12394,"target":12410},{"edgeType":"contains","source":8925,"target":8959},{"edgeType":"contains","source":7239,"target":7317},{"edgeType":"contains","source":1434,"target":2289},{"edgeType":"contains","source":12723,"target":12781},{"edgeType":"calls","source":627,"target":578},{"edgeType":"contains","source":13117,"target":13252},{"edgeType":"contains","source":3145,"target":3157},{"edgeType":"contains","source":1218,"target":1586},{"edgeType":"contains","source":3176,"target":3253},{"edgeType":"contains","source":8762,"target":9783},{"edgeType":"contains","source":5409,"target":5907},{"edgeType":"contains","source":8678,"target":9216},{"edgeType":"contains","source":9390,"target":9342},{"edgeType":"calls","source":9909,"target":9866},{"edgeType":"calls","source":7693,"target":1400},{"edgeType":"contains","source":10246,"target":10292},{"edgeType":"contains","source":11595,"target":11811},{"edgeType":"calls","source":5217,"target":5218},{"edgeType":"contains","source":2269,"target":2827},{"edgeType":"contains","source":11905,"target":11712},{"edgeType":"calls","source":8260,"target":737},{"edgeType":"contains","source":8455,"target":7676},{"edgeType":"contains","source":1434,"target":2286},{"edgeType":"contains","source":12723,"target":12780},{"edgeType":"contains","source":964,"target":1004},{"edgeType":"contains","source":11127,"target":10461},{"edgeType":"calls","source":12330,"target":9865},{"edgeType":"contains","source":13117,"target":13251},{"edgeType":"imports","source":4676,"target":4597},{"edgeType":"calls","source":6307,"target":6314},{"edgeType":"contains","source":8925,"target":8962},{"edgeType":"contains","source":12919,"target":13047},{"edgeType":"contains","source":12921,"target":12984},{"edgeType":"contains","source":12254,"target":12521},{"edgeType":"contains","source":13649,"target":13671},{"edgeType":"contains","source":1887,"target":1985},{"edgeType":"contains","source":8197,"target":8275},{"edgeType":"contains","source":12394,"target":12409},{"edgeType":"contains","source":4135,"target":4176},{"edgeType":"contains","source":2219,"target":2263},{"edgeType":"imports","source":2345,"target":1803},{"edgeType":"contains","source":9878,"target":10070},{"edgeType":"contains","source":10238,"target":10537},{"edgeType":"contains","source":11984,"target":9264},{"edgeType":"calls","source":9115,"target":9115},{"edgeType":"contains","source":11965,"target":11967},{"edgeType":"calls","source":12463,"target":2572},{"edgeType":"contains","source":1603,"target":219},{"edgeType":"contains","source":964,"target":1003},{"edgeType":"contains","source":3773,"target":3769},{"edgeType":"contains","source":7601,"target":7723},{"edgeType":"contains","source":12622,"target":12739},{"edgeType":"imports","source":13053,"target":9173},{"edgeType":"calls","source":10767,"target":10752},{"edgeType":"contains","source":3145,"target":3155},{"edgeType":"contains","source":5409,"target":620},{"edgeType":"contains","source":11304,"target":11317},{"edgeType":"contains","source":13117,"target":13250},{"edgeType":"contains","source":8925,"target":8961},{"edgeType":"calls","source":6935,"target":6931},{"edgeType":"contains","source":9421,"target":9440},{"edgeType":"contains","source":13649,"target":13670},{"edgeType":"calls","source":3812,"target":3319},{"edgeType":"contains","source":9870,"target":2920},{"edgeType":"contains","source":4135,"target":4175},{"edgeType":"contains","source":4132,"target":4268},{"edgeType":"contains","source":8197,"target":8274},{"edgeType":"imports","source":2345,"target":1802},{"edgeType":"imports","source":7949,"target":7779},{"edgeType":"contains","source":9173,"target":9724},{"edgeType":"contains","source":2848,"target":2854},{"edgeType":"contains","source":9878,"target":10067},{"edgeType":"contains","source":4271,"target":4194},{"edgeType":"contains","source":5883,"target":6009},{"edgeType":"contains","source":964,"target":1006},{"edgeType":"contains","source":13117,"target":13249},{"edgeType":"contains","source":12254,"target":12519},{"edgeType":"calls","source":4391,"target":4395},{"edgeType":"contains","source":554,"target":1031},{"edgeType":"imports","source":12279,"target":12019},{"edgeType":"contains","source":8925,"target":8955},{"edgeType":"calls","source":7665,"target":7556},{"edgeType":"contains","source":13649,"target":13669},{"edgeType":"contains","source":3674,"target":3675},{"edgeType":"contains","source":4132,"target":4275},{"edgeType":"contains","source":8066,"target":8102},{"edgeType":"imports","source":2345,"target":1801},{"edgeType":"contains","source":2848,"target":2855},{"edgeType":"contains","source":11233,"target":10345},{"edgeType":"contains","source":9223,"target":9230},{"edgeType":"contains","source":9878,"target":10068},{"edgeType":"calls","source":494,"target":469},{"edgeType":"calls","source":1478,"target":619},{"edgeType":"calls","source":491,"target":562},{"edgeType":"contains","source":13117,"target":13248},{"edgeType":"contains","source":964,"target":1005},{"edgeType":"contains","source":2650,"target":2651},{"edgeType":"contains","source":7629,"target":7906},{"edgeType":"contains","source":9487,"target":9502},{"edgeType":"calls","source":8276,"target":1301},{"edgeType":"contains","source":1124,"target":1330},{"edgeType":"contains","source":13649,"target":13668},{"edgeType":"contains","source":428,"target":708},{"edgeType":"calls","source":11642,"target":10059},{"edgeType":"calls","source":1849,"target":745},{"edgeType":"calls","source":12981,"target":12945},{"edgeType":"contains","source":4132,"target":4274},{"edgeType":"contains","source":10246,"target":10288},{"edgeType":"contains","source":10237,"target":9510},{"edgeType":"calls","source":6258,"target":2539},{"edgeType":"contains","source":10653,"target":10352},{"edgeType":"calls","source":11755,"target":2325},{"edgeType":"calls","source":11890,"target":11882},{"edgeType":"imports","source":12355,"target":11779},{"edgeType":"contains","source":13117,"target":13247},{"edgeType":"contains","source":8925,"target":8958},{"edgeType":"contains","source":3176,"target":3254},{"edgeType":"contains","source":1218,"target":1587},{"edgeType":"contains","source":3145,"target":3158},{"edgeType":"calls","source":7959,"target":7958},{"edgeType":"contains","source":428,"target":711},{"edgeType":"calls","source":5816,"target":4613},{"edgeType":"contains","source":13649,"target":13667},{"edgeType":"imports","source":2727,"target":2641},{"edgeType":"calls","source":5030,"target":4668},{"edgeType":"contains","source":5981,"target":6145},{"edgeType":"calls","source":8227,"target":8106},{"edgeType":"contains","source":8678,"target":9215},{"edgeType":"contains","source":7935,"target":7937},{"edgeType":"contains","source":12064,"target":12065},{"edgeType":"contains","source":8062,"target":8228},{"edgeType":"contains","source":4305,"target":4194},{"edgeType":"contains","source":12622,"target":12735},{"edgeType":"contains","source":6447,"target":6498},{"edgeType":"contains","source":12762,"target":12623},{"edgeType":"calls","source":8260,"target":742},{"edgeType":"contains","source":13117,"target":13246},{"edgeType":"contains","source":1218,"target":1588},{"edgeType":"calls","source":727,"target":647},{"edgeType":"calls","source":11956,"target":11951},{"edgeType":"calls","source":11290,"target":3000},{"edgeType":"contains","source":1124,"target":1332},{"edgeType":"calls","source":12404,"target":11804},{"edgeType":"calls","source":8435,"target":602},{"edgeType":"contains","source":13649,"target":13666},{"edgeType":"calls","source":7467,"target":7355},{"edgeType":"contains","source":8925,"target":8956},{"edgeType":"contains","source":8678,"target":9214},{"edgeType":"contains","source":7935,"target":7936},{"edgeType":"contains","source":8468,"target":6211},{"edgeType":"calls","source":9026,"target":8706},{"edgeType":"calls","source":12848,"target":12838},{"edgeType":"contains","source":6276,"target":6514},{"edgeType":"calls","source":9049,"target":9050},{"edgeType":"contains","source":12361,"target":12370},{"edgeType":"contains","source":12254,"target":12516},{"edgeType":"contains","source":10238,"target":10534},{"edgeType":"contains","source":8925,"target":8968},{"edgeType":"imports","source":7334,"target":410},{"edgeType":"contains","source":13649,"target":13682},{"edgeType":"imports","source":1954,"target":1250},{"edgeType":"contains","source":8062,"target":8238},{"edgeType":"calls","source":3203,"target":3165},{"edgeType":"contains","source":8591,"target":9809},{"edgeType":"contains","source":7208,"target":7228},{"edgeType":"calls","source":3756,"target":2934},{"edgeType":"calls","source":12379,"target":11527},{"edgeType":"contains","source":10710,"target":10714},{"edgeType":"contains","source":7770,"target":7777},{"edgeType":"contains","source":13117,"target":13261},{"edgeType":"contains","source":11713,"target":1818},{"edgeType":"contains","source":7601,"target":7731},{"edgeType":"contains","source":11547,"target":12249},{"edgeType":"calls","source":2079,"target":2070},{"edgeType":"contains","source":4132,"target":4278},{"edgeType":"contains","source":8925,"target":8967},{"edgeType":"contains","source":13649,"target":13681},{"edgeType":"contains","source":13117,"target":13260},{"edgeType":"contains","source":13815,"target":13820},{"edgeType":"contains","source":7001,"target":7304},{"edgeType":"contains","source":8762,"target":9792},{"edgeType":"contains","source":12464,"target":2849},{"edgeType":"contains","source":2518,"target":2519},{"edgeType":"contains","source":7208,"target":7229},{"edgeType":"imports","source":7001,"target":1218},{"edgeType":"calls","source":8229,"target":8047},{"edgeType":"contains","source":8066,"target":8113},{"edgeType":"contains","source":3608,"target":3610},{"edgeType":"contains","source":7770,"target":7776},{"edgeType":"contains","source":11082,"target":11867},{"edgeType":"calls","source":10875,"target":3187},{"edgeType":"contains","source":13649,"target":13680},{"edgeType":"contains","source":3574,"target":3607},{"edgeType":"contains","source":3674,"target":3678},{"edgeType":"calls","source":658,"target":669},{"edgeType":"contains","source":8197,"target":8283},{"edgeType":"contains","source":10238,"target":10545},{"edgeType":"contains","source":13117,"target":13259},{"edgeType":"contains","source":13815,"target":13819},{"edgeType":"contains","source":899,"target":913},{"edgeType":"contains","source":2585,"target":2553},{"edgeType":"calls","source":7963,"target":7838},{"edgeType":"calls","source":1029,"target":796},{"edgeType":"contains","source":2848,"target":2856},{"edgeType":"calls","source":6770,"target":6768},{"edgeType":"calls","source":11256,"target":3000},{"edgeType":"contains","source":7208,"target":7230},{"edgeType":"calls","source":8886,"target":8823},{"edgeType":"contains","source":12692,"target":12693},{"edgeType":"contains","source":3674,"target":3677},{"edgeType":"calls","source":2277,"target":2272},{"edgeType":"contains","source":3608,"target":3609},{"edgeType":"contains","source":11803,"target":11712},{"edgeType":"contains","source":1867,"target":1556},{"edgeType":"contains","source":4179,"target":4933},{"edgeType":"contains","source":12394,"target":12416},{"edgeType":"calls","source":12111,"target":9264},{"edgeType":"calls","source":5045,"target":1026},{"edgeType":"calls","source":5840,"target":693},{"edgeType":"contains","source":5981,"target":6158},{"edgeType":"contains","source":13117,"target":13258},{"edgeType":"contains","source":12856,"target":12893},{"edgeType":"calls","source":3291,"target":436},{"edgeType":"contains","source":2848,"target":2857},{"edgeType":"calls","source":8818,"target":8816},{"edgeType":"calls","source":12980,"target":12978},{"edgeType":"contains","source":10710,"target":10713},{"edgeType":"contains","source":7770,"target":7778},{"edgeType":"contains","source":428,"target":714},{"edgeType":"imports","source":1139,"target":1144},{"edgeType":"contains","source":2269,"target":2836},{"edgeType":"calls","source":6045,"target":5965},{"edgeType":"contains","source":11746,"target":1851},{"edgeType":"contains","source":5458,"target":5459},{"edgeType":"contains","source":13649,"target":13678},{"edgeType":"contains","source":10301,"target":10704},{"edgeType":"contains","source":8197,"target":8277},{"edgeType":"contains","source":10246,"target":10295},{"edgeType":"imports","source":10514,"target":10710},{"edgeType":"contains","source":13117,"target":13257},{"edgeType":"contains","source":6447,"target":6503},{"edgeType":"contains","source":428,"target":718},{"edgeType":"contains","source":8925,"target":8964},{"edgeType":"contains","source":2269,"target":2841},{"edgeType":"calls","source":2574,"target":2576},{"edgeType":"calls","source":11188,"target":3000},{"edgeType":"calls","source":493,"target":493},{"edgeType":"imports","source":5968,"target":5764},{"edgeType":"contains","source":7770,"target":7773},{"edgeType":"calls","source":12463,"target":12098},{"edgeType":"contains","source":13649,"target":13677},{"edgeType":"contains","source":13117,"target":13256},{"edgeType":"contains","source":13815,"target":13816},{"edgeType":"imports","source":11423,"target":2614},{"edgeType":"contains","source":6144,"target":6384},{"edgeType":"calls","source":9941,"target":9944},{"edgeType":"contains","source":10238,"target":10544},{"edgeType":"contains","source":6447,"target":6504},{"edgeType":"calls","source":7533,"target":7430},{"edgeType":"contains","source":12723,"target":12785},{"edgeType":"contains","source":10710,"target":10711},{"edgeType":"contains","source":12824,"target":12826},{"edgeType":"contains","source":7415,"target":7150},{"edgeType":"calls","source":1984,"target":1837},{"edgeType":"contains","source":2943,"target":3089},{"edgeType":"contains","source":13649,"target":13676},{"edgeType":"imports","source":3763,"target":3298},{"edgeType":"calls","source":658,"target":662},{"edgeType":"contains","source":9878,"target":10077},{"edgeType":"imports","source":5968,"target":5763},{"edgeType":"contains","source":5981,"target":6152},{"edgeType":"contains","source":3608,"target":3614},{"edgeType":"calls","source":2145,"target":2135},{"edgeType":"contains","source":7770,"target":7772},{"edgeType":"contains","source":7767,"target":7865},{"edgeType":"contains","source":13117,"target":13255},{"edgeType":"contains","source":4132,"target":4281},{"edgeType":"calls","source":8950,"target":8957},{"edgeType":"calls","source":757,"target":767},{"edgeType":"calls","source":7530,"target":7524},{"edgeType":"contains","source":6447,"target":6505},{"edgeType":"contains","source":12919,"target":13051},{"edgeType":"contains","source":12723,"target":12784},{"edgeType":"calls","source":1812,"target":830},{"edgeType":"contains","source":12824,"target":12825},{"edgeType":"contains","source":10238,"target":10541},{"edgeType":"contains","source":7770,"target":7775},{"edgeType":"contains","source":13649,"target":13675},{"edgeType":"contains","source":5409,"target":633},{"edgeType":"contains","source":3608,"target":3613},{"edgeType":"calls","source":2215,"target":1019},{"edgeType":"contains","source":13117,"target":13254},{"edgeType":"contains","source":4841,"target":4499},{"edgeType":"contains","source":8925,"target":8965},{"edgeType":"contains","source":4203,"target":4193},{"edgeType":"calls","source":5745,"target":5748},{"edgeType":"contains","source":10238,"target":10542},{"edgeType":"calls","source":1616,"target":1620},{"edgeType":"contains","source":10892,"target":10352},{"edgeType":"contains","source":12692,"target":12687},{"edgeType":"contains","source":12618,"target":12867},{"edgeType":"calls","source":3103,"target":3088},{"edgeType":"calls","source":11872,"target":2936},{"edgeType":"contains","source":12723,"target":12783},{"edgeType":"contains","source":12919,"target":13050},{"edgeType":"calls","source":8717,"target":8780},{"edgeType":"calls","source":2574,"target":2575},{"edgeType":"calls","source":5943,"target":5952},{"edgeType":"contains","source":7208,"target":7227},{"edgeType":"contains","source":7770,"target":7774},{"edgeType":"contains","source":5981,"target":6154},{"edgeType":"contains","source":13649,"target":13674},{"edgeType":"contains","source":5409,"target":5917},{"edgeType":"contains","source":3608,"target":3612},{"edgeType":"imports","source":10089,"target":10141},{"edgeType":"contains","source":12856,"target":12871},{"edgeType":"calls","source":6375,"target":4187},{"edgeType":"calls","source":7731,"target":7604},{"edgeType":"contains","source":4003,"target":4025},{"edgeType":"contains","source":5424,"target":5427},{"edgeType":"contains","source":6778,"target":6792},{"edgeType":"calls","source":11856,"target":11860},{"edgeType":"contains","source":9487,"target":9491},{"edgeType":"calls","source":1683,"target":1685},{"edgeType":"contains","source":3847,"target":3576},{"edgeType":"contains","source":4130,"target":4316},{"edgeType":"contains","source":13649,"target":13657},{"edgeType":"contains","source":2219,"target":2248},{"edgeType":"contains","source":9878,"target":10055},{"edgeType":"contains","source":337,"target":339},{"edgeType":"contains","source":2269,"target":2813},{"edgeType":"contains","source":4367,"target":4369},{"edgeType":"calls","source":6637,"target":6636},{"edgeType":"contains","source":7629,"target":7895},{"edgeType":"calls","source":11837,"target":2936},{"edgeType":"contains","source":964,"target":985},{"edgeType":"contains","source":12394,"target":12395},{"edgeType":"contains","source":10643,"target":10652},{"edgeType":"calls","source":12395,"target":436},{"edgeType":"contains","source":1144,"target":690},{"edgeType":"contains","source":6908,"target":6990},{"edgeType":"contains","source":9341,"target":9788},{"edgeType":"contains","source":13117,"target":13236},{"edgeType":"contains","source":7001,"target":7278},{"edgeType":"calls","source":626,"target":627},{"edgeType":"imports","source":12901,"target":5409},{"edgeType":"calls","source":12224,"target":12079},{"edgeType":"contains","source":4003,"target":4024},{"edgeType":"contains","source":7406,"target":7409},{"edgeType":"contains","source":3310,"target":3311},{"edgeType":"contains","source":13550,"target":13554},{"edgeType":"calls","source":824,"target":830},{"edgeType":"contains","source":9421,"target":9422},{"edgeType":"contains","source":13649,"target":13656},{"edgeType":"contains","source":3898,"target":4108},{"edgeType":"contains","source":4132,"target":4253},{"edgeType":"contains","source":4499,"target":4504},{"edgeType":"contains","source":337,"target":338},{"edgeType":"contains","source":9878,"target":10056},{"edgeType":"contains","source":1585,"target":763},{"edgeType":"contains","source":7637,"target":7646},{"edgeType":"calls","source":8223,"target":8208},{"edgeType":"imports","source":10514,"target":10697},{"edgeType":"contains","source":12723,"target":12765},{"edgeType":"contains","source":13117,"target":13235},{"edgeType":"contains","source":4003,"target":4023},{"edgeType":"contains","source":12856,"target":12869},{"edgeType":"calls","source":2343,"target":2364},{"edgeType":"imports","source":12862,"target":11905},{"edgeType":"contains","source":13649,"target":13655},{"edgeType":"contains","source":3898,"target":4107},{"edgeType":"contains","source":13550,"target":13553},{"edgeType":"contains","source":337,"target":341},{"edgeType":"contains","source":6144,"target":6364},{"edgeType":"contains","source":11700,"target":11708},{"edgeType":"calls","source":1716,"target":1721},{"edgeType":"contains","source":4499,"target":4503},{"edgeType":"contains","source":2219,"target":2246},{"edgeType":"calls","source":454,"target":676},{"edgeType":"calls","source":1136,"target":674},{"edgeType":"calls","source":7961,"target":7875},{"edgeType":"contains","source":12625,"target":12631},{"edgeType":"calls","source":12913,"target":12917},{"edgeType":"contains","source":8331,"target":8333},{"edgeType":"contains","source":3847,"target":3574},{"edgeType":"contains","source":12525,"target":12560},{"edgeType":"calls","source":12030,"target":11749},{"edgeType":"contains","source":12723,"target":12764},{"edgeType":"contains","source":1144,"target":1749},{"edgeType":"contains","source":1144,"target":692},{"edgeType":"contains","source":13117,"target":13234},{"edgeType":"imports","source":10367,"target":2567},{"edgeType":"calls","source":5114,"target":1026},{"edgeType":"contains","source":8762,"target":9769},{"edgeType":"contains","source":4003,"target":4022},{"edgeType":"contains","source":3898,"target":4106},{"edgeType":"contains","source":7865,"target":7979},{"edgeType":"calls","source":1576,"target":775},{"edgeType":"contains","source":337,"target":340},{"edgeType":"contains","source":271,"target":272},{"edgeType":"contains","source":8331,"target":8332},{"edgeType":"calls","source":6012,"target":5956},{"edgeType":"contains","source":6447,"target":6486},{"edgeType":"calls","source":8157,"target":8142},{"edgeType":"calls","source":4726,"target":4598},{"edgeType":"imports","source":4639,"target":4671},{"edgeType":"contains","source":13117,"target":13233},{"edgeType":"contains","source":8098,"target":8150},{"edgeType":"contains","source":13550,"target":13551},{"edgeType":"contains","source":5424,"target":5431},{"edgeType":"contains","source":13649,"target":13653},{"edgeType":"contains","source":8694,"target":8701},{"edgeType":"contains","source":337,"target":343},{"edgeType":"contains","source":2269,"target":2817},{"edgeType":"calls","source":5491,"target":4137},{"edgeType":"contains","source":4132,"target":4258},{"edgeType":"contains","source":6514,"target":6516},{"edgeType":"contains","source":4235,"target":4237},{"edgeType":"contains","source":6447,"target":6479},{"edgeType":"contains","source":2219,"target":2253},{"edgeType":"contains","source":1434,"target":2276},{"edgeType":"contains","source":4367,"target":4373},{"edgeType":"calls","source":4160,"target":4172},{"edgeType":"contains","source":4758,"target":4936},{"edgeType":"calls","source":1125,"target":1009},{"edgeType":"contains","source":7629,"target":7891},{"edgeType":"contains","source":7637,"target":7643},{"edgeType":"contains","source":13117,"target":13232},{"edgeType":"calls","source":8256,"target":8245},{"edgeType":"calls","source":2773,"target":2774},{"edgeType":"contains","source":13649,"target":13652},{"edgeType":"calls","source":5110,"target":4319},{"edgeType":"contains","source":337,"target":342},{"edgeType":"contains","source":4132,"target":4257},{"edgeType":"contains","source":6447,"target":6480},{"edgeType":"contains","source":9878,"target":10052},{"edgeType":"calls","source":3203,"target":3186},{"edgeType":"contains","source":13117,"target":13231},{"edgeType":"calls","source":2541,"target":454},{"edgeType":"contains","source":964,"target":988},{"edgeType":"contains","source":5555,"target":5592},{"edgeType":"contains","source":7604,"target":7608},{"edgeType":"contains","source":7637,"target":7642},{"edgeType":"contains","source":3144,"target":3175},{"edgeType":"contains","source":9506,"target":9953},{"edgeType":"contains","source":11304,"target":11298},{"edgeType":"imports","source":10237,"target":3431},{"edgeType":"contains","source":337,"target":345},{"edgeType":"contains","source":10841,"target":10850},{"edgeType":"contains","source":10439,"target":10627},{"edgeType":"contains","source":4179,"target":4913},{"edgeType":"contains","source":4003,"target":4027},{"edgeType":"calls","source":1727,"target":1376},{"edgeType":"contains","source":2219,"target":2250},{"edgeType":"contains","source":4268,"target":4269},{"edgeType":"contains","source":12625,"target":12627},{"edgeType":"contains","source":6447,"target":6481},{"edgeType":"contains","source":12592,"target":12593},{"edgeType":"imports","source":12499,"target":11527},{"edgeType":"calls","source":9623,"target":754},{"edgeType":"contains","source":7601,"target":7704},{"edgeType":"contains","source":13117,"target":13230},{"edgeType":"contains","source":9173,"target":2310},{"edgeType":"contains","source":3144,"target":3172},{"edgeType":"calls","source":12331,"target":5593},{"edgeType":"contains","source":11634,"target":11637},{"edgeType":"contains","source":4003,"target":4026},{"edgeType":"calls","source":11973,"target":2951},{"edgeType":"contains","source":13649,"target":13650},{"edgeType":"contains","source":9487,"target":9488},{"edgeType":"contains","source":10841,"target":10851},{"edgeType":"imports","source":7334,"target":407},{"edgeType":"calls","source":8543,"target":409},{"edgeType":"contains","source":8694,"target":8702},{"edgeType":"contains","source":4135,"target":4162},{"edgeType":"contains","source":10439,"target":10628},{"edgeType":"calls","source":3468,"target":3426},{"edgeType":"contains","source":337,"target":344},{"edgeType":"calls","source":3493,"target":3708},{"edgeType":"contains","source":12254,"target":12499},{"edgeType":"contains","source":2219,"target":2252},{"edgeType":"contains","source":12625,"target":12626},{"edgeType":"contains","source":12622,"target":12719},{"edgeType":"contains","source":12617,"target":12874},{"edgeType":"calls","source":2026,"target":562},{"edgeType":"contains","source":6447,"target":6482},{"edgeType":"contains","source":3713,"target":3503},{"edgeType":"calls","source":9380,"target":9343},{"edgeType":"contains","source":1434,"target":2275},{"edgeType":"contains","source":12723,"target":12759},{"edgeType":"contains","source":3753,"target":3320},{"edgeType":"contains","source":7601,"target":7703},{"edgeType":"imports","source":12276,"target":12099},{"edgeType":"calls","source":4535,"target":4173},{"edgeType":"contains","source":13117,"target":13229},{"edgeType":"calls","source":725,"target":726},{"edgeType":"contains","source":11304,"target":11310},{"edgeType":"imports","source":11242,"target":2920},{"edgeType":"contains","source":12625,"target":12641},{"edgeType":"contains","source":4407,"target":4194},{"edgeType":"contains","source":7109,"target":7110},{"edgeType":"calls","source":491,"target":575},{"edgeType":"contains","source":13117,"target":13245},{"edgeType":"contains","source":7629,"target":7903},{"edgeType":"contains","source":1887,"target":1978},{"edgeType":"contains","source":9487,"target":9499},{"edgeType":"contains","source":8925,"target":8951},{"edgeType":"contains","source":10238,"target":10531},{"edgeType":"contains","source":13649,"target":13665},{"edgeType":"contains","source":4235,"target":4241},{"edgeType":"contains","source":13117,"target":13244},{"edgeType":"calls","source":1558,"target":266},{"edgeType":"contains","source":2219,"target":2257},{"edgeType":"calls","source":3493,"target":3704},{"edgeType":"contains","source":4179,"target":4920},{"edgeType":"contains","source":8762,"target":9776},{"edgeType":"contains","source":12423,"target":12561},{"edgeType":"contains","source":964,"target":993},{"edgeType":"contains","source":10477,"target":10521},{"edgeType":"contains","source":12394,"target":12403},{"edgeType":"contains","source":7208,"target":7213},{"edgeType":"calls","source":3109,"target":2925},{"edgeType":"contains","source":337,"target":346},{"edgeType":"contains","source":2269,"target":2822},{"edgeType":"contains","source":9878,"target":10064},{"edgeType":"contains","source":397,"target":600},{"edgeType":"calls","source":12463,"target":12079},{"edgeType":"contains","source":5981,"target":6139},{"edgeType":"contains","source":13649,"target":13664},{"edgeType":"calls","source":10602,"target":10576},{"edgeType":"calls","source":12584,"target":12556},{"edgeType":"contains","source":7629,"target":7902},{"edgeType":"contains","source":12361,"target":12368},{"edgeType":"calls","source":737,"target":348},{"edgeType":"contains","source":1434,"target":2281},{"edgeType":"contains","source":13117,"target":13243},{"edgeType":"contains","source":8762,"target":9775},{"edgeType":"calls","source":10403,"target":3000},{"edgeType":"calls","source":10106,"target":10093},{"edgeType":"contains","source":8574,"target":7147},{"edgeType":"contains","source":12590,"target":12668},{"edgeType":"calls","source":3087,"target":436},{"edgeType":"contains","source":12394,"target":12402},{"edgeType":"contains","source":964,"target":992},{"edgeType":"contains","source":337,"target":349},{"edgeType":"calls","source":1727,"target":1372},{"edgeType":"calls","source":12983,"target":12869},{"edgeType":"contains","source":964,"target":996},{"edgeType":"calls","source":2373,"target":2483},{"edgeType":"contains","source":3145,"target":3146},{"edgeType":"imports","source":12279,"target":12000},{"edgeType":"contains","source":1124,"target":1321},{"edgeType":"contains","source":1096,"target":1132},{"edgeType":"contains","source":7109,"target":7112},{"edgeType":"calls","source":8229,"target":8032},{"edgeType":"contains","source":5981,"target":6140},{"edgeType":"contains","source":13649,"target":13663},{"edgeType":"contains","source":4132,"target":4261},{"edgeType":"calls","source":10840,"target":3195},{"edgeType":"contains","source":8762,"target":9778},{"edgeType":"contains","source":13117,"target":13242},{"edgeType":"contains","source":10892,"target":10338},{"edgeType":"contains","source":12622,"target":12732},{"edgeType":"imports","source":2559,"target":2560},{"edgeType":"contains","source":4758,"target":4938},{"edgeType":"contains","source":12423,"target":12559},{"edgeType":"contains","source":3145,"target":3147},{"edgeType":"calls","source":12319,"target":12313},{"edgeType":"contains","source":7109,"target":7113},{"edgeType":"contains","source":11304,"target":11309},{"edgeType":"contains","source":11674,"target":3010},{"edgeType":"calls","source":1916,"target":1854},{"edgeType":"contains","source":13649,"target":13662},{"edgeType":"contains","source":12394,"target":12400},{"edgeType":"contains","source":12361,"target":12366},{"edgeType":"contains","source":6144,"target":6374},{"edgeType":"calls","source":3368,"target":3350},{"edgeType":"contains","source":2219,"target":2256},{"edgeType":"contains","source":13117,"target":13241},{"edgeType":"contains","source":899,"target":895},{"edgeType":"contains","source":12919,"target":13037},{"edgeType":"calls","source":1170,"target":668},{"edgeType":"contains","source":8762,"target":9777},{"edgeType":"calls","source":7893,"target":7878},{"edgeType":"contains","source":964,"target":994},{"edgeType":"imports","source":7019,"target":649},{"edgeType":"contains","source":1124,"target":1323},{"edgeType":"contains","source":11259,"target":11644},{"edgeType":"contains","source":8096,"target":8220},{"edgeType":"calls","source":12515,"target":11527},{"edgeType":"contains","source":13550,"target":13559},{"edgeType":"calls","source":12326,"target":12101},{"edgeType":"calls","source":4160,"target":4164},{"edgeType":"contains","source":13649,"target":13661},{"edgeType":"contains","source":13117,"target":13240},{"edgeType":"contains","source":7601,"target":7710},{"edgeType":"calls","source":10179,"target":436},{"edgeType":"calls","source":7168,"target":7100},{"edgeType":"contains","source":11267,"target":10338},{"edgeType":"contains","source":12919,"target":13036},{"edgeType":"imports","source":2840,"target":3360},{"edgeType":"contains","source":12625,"target":12637},{"edgeType":"imports","source":1797,"target":1867},{"edgeType":"contains","source":337,"target":350},{"edgeType":"contains","source":964,"target":997},{"edgeType":"calls","source":5984,"target":5757},{"edgeType":"calls","source":10106,"target":10098},{"edgeType":"contains","source":1144,"target":1759},{"edgeType":"calls","source":12980,"target":12967},{"edgeType":"imports","source":12551,"target":12019},{"edgeType":"contains","source":13649,"target":13660},{"edgeType":"contains","source":9878,"target":10060},{"edgeType":"contains","source":1396,"target":1349},{"edgeType":"calls","source":4100,"target":3911},{"edgeType":"calls","source":12649,"target":12658},{"edgeType":"contains","source":5424,"target":5438},{"edgeType":"contains","source":13117,"target":13239},{"edgeType":"contains","source":10301,"target":10689},{"edgeType":"calls","source":8047,"target":2049},{"edgeType":"contains","source":4135,"target":4173},{"edgeType":"imports","source":7434,"target":1524},{"edgeType":"calls","source":9577,"target":9584},{"edgeType":"calls","source":3183,"target":2738},{"edgeType":"calls","source":10106,"target":10101},{"edgeType":"calls","source":5845,"target":5837},{"edgeType":"contains","source":2269,"target":2823},{"edgeType":"contains","source":8067,"target":8064},{"edgeType":"calls","source":1619,"target":1545},{"edgeType":"contains","source":13649,"target":13659},{"edgeType":"contains","source":11864,"target":11914},{"edgeType":"contains","source":5424,"target":5437},{"edgeType":"contains","source":7629,"target":7901},{"edgeType":"contains","source":9878,"target":10057},{"edgeType":"contains","source":13117,"target":13238},{"edgeType":"contains","source":4132,"target":4265},{"edgeType":"contains","source":2219,"target":2259},{"edgeType":"contains","source":10566,"target":9870},{"edgeType":"calls","source":7232,"target":7232},{"edgeType":"contains","source":8455,"target":7664},{"edgeType":"calls","source":3183,"target":2739},{"edgeType":"contains","source":13550,"target":13556},{"edgeType":"contains","source":11304,"target":11305},{"edgeType":"contains","source":9878,"target":10058},{"edgeType":"contains","source":10246,"target":10277},{"edgeType":"contains","source":13649,"target":13658},{"edgeType":"contains","source":7601,"target":7711},{"edgeType":"contains","source":8959,"target":8951},{"edgeType":"contains","source":12525,"target":12563},{"edgeType":"contains","source":13117,"target":13237},{"edgeType":"contains","source":10477,"target":10516},{"edgeType":"contains","source":6276,"target":6506},{"edgeType":"contains","source":12361,"target":12362},{"edgeType":"contains","source":10246,"target":10278},{"edgeType":"calls","source":5816,"target":4620},{"edgeType":"calls","source":2972,"target":2938},{"edgeType":"calls","source":5117,"target":5149},{"edgeType":"calls","source":11733,"target":3000},{"edgeType":"contains","source":4758,"target":4941},{"edgeType":"contains","source":10653,"target":10345},{"edgeType":"contains","source":8762,"target":9773},{"edgeType":"imports","source":5860,"target":5713},{"edgeType":"contains","source":12625,"target":12616},{"edgeType":"calls","source":7950,"target":1988},{"edgeType":"contains","source":8925,"target":8927},{"edgeType":"calls","source":2049,"target":2049},{"edgeType":"imports","source":3194,"target":2738},{"edgeType":"contains","source":13117,"target":13220},{"edgeType":"contains","source":1261,"target":1276},{"edgeType":"contains","source":1205,"target":3012},{"edgeType":"calls","source":2227,"target":760},{"edgeType":"contains","source":1218,"target":1552},{"edgeType":"contains","source":5409,"target":5875},{"edgeType":"contains","source":4003,"target":4009},{"edgeType":"calls","source":4955,"target":4984},{"edgeType":"imports","source":7583,"target":6209},{"edgeType":"contains","source":3898,"target":4093},{"edgeType":"imports","source":6879,"target":6892},{"edgeType":"calls","source":740,"target":347},{"edgeType":"contains","source":2219,"target":2232},{"edgeType":"contains","source":4102,"target":4111},{"edgeType":"calls","source":5121,"target":5123},{"edgeType":"contains","source":5107,"target":4666},{"edgeType":"calls","source":1095,"target":968},{"edgeType":"contains","source":2847,"target":2849},{"edgeType":"calls","source":1028,"target":931},{"edgeType":"contains","source":7713,"target":6330},{"edgeType":"contains","source":12713,"target":13058},{"edgeType":"contains","source":8925,"target":8926},{"edgeType":"calls","source":9844,"target":9867},{"edgeType":"contains","source":13117,"target":13219},{"edgeType":"calls","source":2227,"target":761},{"edgeType":"contains","source":10857,"target":10345},{"edgeType":"contains","source":12919,"target":13015},{"edgeType":"contains","source":1261,"target":1277},{"edgeType":"contains","source":1205,"target":3013},{"edgeType":"contains","source":1218,"target":1553},{"edgeType":"contains","source":4003,"target":4008},{"edgeType":"contains","source":1887,"target":1955},{"edgeType":"contains","source":5409,"target":5874},{"edgeType":"calls","source":13097,"target":13672},{"edgeType":"contains","source":3898,"target":4092},{"edgeType":"contains","source":170,"target":216},{"edgeType":"imports","source":12565,"target":12441},{"edgeType":"contains","source":6384,"target":6307},{"edgeType":"contains","source":9878,"target":10036},{"edgeType":"imports","source":7771,"target":7779},{"edgeType":"contains","source":5555,"target":5580},{"edgeType":"contains","source":12713,"target":13057},{"edgeType":"imports","source":11713,"target":1852},{"edgeType":"calls","source":12395,"target":11120},{"edgeType":"contains","source":12990,"target":12927},{"edgeType":"contains","source":1144,"target":676},{"edgeType":"contains","source":5409,"target":5873},{"edgeType":"contains","source":4003,"target":4007},{"edgeType":"calls","source":7504,"target":7359},{"edgeType":"imports","source":7583,"target":6211},{"edgeType":"calls","source":627,"target":681},{"edgeType":"contains","source":3898,"target":4091},{"edgeType":"contains","source":11674,"target":12497},{"edgeType":"contains","source":7865,"target":7964},{"edgeType":"imports","source":13797,"target":12302},{"edgeType":"contains","source":9949,"target":9950},{"edgeType":"contains","source":1,"target":170},{"edgeType":"contains","source":2219,"target":2230},{"edgeType":"contains","source":4132,"target":4236},{"edgeType":"calls","source":1402,"target":967},{"edgeType":"contains","source":8098,"target":8140},{"edgeType":"calls","source":7896,"target":7893},{"edgeType":"calls","source":1025,"target":1026},{"edgeType":"contains","source":5555,"target":5581},{"edgeType":"contains","source":5720,"target":5751},{"edgeType":"contains","source":964,"target":970},{"edgeType":"contains","source":12617,"target":12861},{"edgeType":"contains","source":12655,"target":12740},{"edgeType":"contains","source":6811,"target":6813},{"edgeType":"contains","source":1144,"target":675},{"edgeType":"imports","source":1954,"target":1007},{"edgeType":"contains","source":6902,"target":7163},{"edgeType":"contains","source":6877,"target":6881},{"edgeType":"contains","source":13117,"target":13217},{"edgeType":"calls","source":2227,"target":759},{"edgeType":"calls","source":12160,"target":436},{"edgeType":"contains","source":4132,"target":4235},{"edgeType":"contains","source":4003,"target":4006},{"edgeType":"contains","source":1887,"target":1953},{"edgeType":"contains","source":3898,"target":4090},{"edgeType":"contains","source":9949,"target":9951},{"edgeType":"contains","source":5720,"target":5752},{"edgeType":"contains","source":2219,"target":2231},{"edgeType":"contains","source":9878,"target":10038},{"edgeType":"contains","source":2922,"target":2641},{"edgeType":"contains","source":9173,"target":9691},{"edgeType":"contains","source":10675,"target":10696},{"edgeType":"contains","source":13117,"target":13216},{"edgeType":"contains","source":5686,"target":5741},{"edgeType":"contains","source":1261,"target":1280},{"edgeType":"calls","source":9844,"target":9872},{"edgeType":"contains","source":11171,"target":11176},{"edgeType":"calls","source":12134,"target":4419},{"edgeType":"contains","source":5555,"target":5574},{"edgeType":"contains","source":8098,"target":8134},{"edgeType":"contains","source":11674,"target":12495},{"edgeType":"calls","source":12602,"target":2595},{"edgeType":"imports","source":4131,"target":4350},{"edgeType":"contains","source":6646,"target":6635},{"edgeType":"contains","source":8066,"target":8069},{"edgeType":"contains","source":4132,"target":4242},{"edgeType":"contains","source":5720,"target":5745},{"edgeType":"calls","source":3271,"target":3275},{"edgeType":"imports","source":2527,"target":2269},{"edgeType":"contains","source":11039,"target":11041},{"edgeType":"contains","source":13117,"target":13215},{"edgeType":"contains","source":1205,"target":3017},{"edgeType":"contains","source":1261,"target":1281},{"edgeType":"contains","source":3144,"target":3159},{"edgeType":"contains","source":3107,"target":3249},{"edgeType":"imports","source":11864,"target":347},{"edgeType":"contains","source":5409,"target":593},{"edgeType":"contains","source":5409,"target":5878},{"edgeType":"contains","source":5981,"target":6111},{"edgeType":"calls","source":7467,"target":7452},{"edgeType":"calls","source":2131,"target":562},{"edgeType":"contains","source":11674,"target":12496},{"edgeType":"contains","source":1688,"target":1786},{"edgeType":"contains","source":6611,"target":6664},{"edgeType":"contains","source":1887,"target":1959},{"edgeType":"calls","source":3579,"target":3240},{"edgeType":"contains","source":11972,"target":11712},{"edgeType":"contains","source":12713,"target":13053},{"edgeType":"contains","source":634,"target":635},{"edgeType":"contains","source":13117,"target":13214},{"edgeType":"contains","source":5555,"target":5576},{"edgeType":"contains","source":5409,"target":5877},{"edgeType":"calls","source":4955,"target":4978},{"edgeType":"contains","source":10839,"target":10895},{"edgeType":"contains","source":6611,"target":6665},{"edgeType":"contains","source":12096,"target":12097},{"edgeType":"imports","source":646,"target":327},{"edgeType":"calls","source":5915,"target":5871},{"edgeType":"contains","source":12228,"target":12233},{"edgeType":"contains","source":4003,"target":4011},{"edgeType":"calls","source":1157,"target":1158},{"edgeType":"calls","source":3172,"target":3171},{"edgeType":"calls","source":6145,"target":6140},{"edgeType":"calls","source":4899,"target":4598},{"edgeType":"contains","source":5555,"target":5577},{"edgeType":"contains","source":13117,"target":13213},{"edgeType":"contains","source":1205,"target":3015},{"edgeType":"contains","source":1218,"target":1555},{"edgeType":"contains","source":5223,"target":5300},{"edgeType":"calls","source":11225,"target":3000},{"edgeType":"contains","source":4003,"target":4010},{"edgeType":"contains","source":5409,"target":5876},{"edgeType":"contains","source":3898,"target":4094},{"edgeType":"contains","source":13117,"target":13212},{"edgeType":"calls","source":12354,"target":11339},{"edgeType":"contains","source":3805,"target":3806},{"edgeType":"contains","source":12228,"target":12232},{"edgeType":"contains","source":6,"target":18},{"edgeType":"contains","source":11700,"target":11702},{"edgeType":"calls","source":6145,"target":6139},{"edgeType":"calls","source":12399,"target":436},{"edgeType":"calls","source":7962,"target":7966},{"edgeType":"contains","source":10477,"target":10504},{"edgeType":"contains","source":10857,"target":10352},{"edgeType":"calls","source":11775,"target":11324},{"edgeType":"contains","source":6811,"target":6818},{"edgeType":"contains","source":12617,"target":12872},{"edgeType":"calls","source":4658,"target":4669},{"edgeType":"calls","source":4662,"target":4545},{"edgeType":"contains","source":8628,"target":8629},{"edgeType":"contains","source":10439,"target":10625},{"edgeType":"contains","source":6646,"target":6648},{"edgeType":"contains","source":3144,"target":3162},{"edgeType":"contains","source":10643,"target":10644},{"edgeType":"contains","source":3107,"target":3252},{"edgeType":"calls","source":230,"target":293},{"edgeType":"contains","source":1140,"target":806},{"edgeType":"contains","source":12617,"target":12873},{"edgeType":"contains","source":11613,"target":11227},{"edgeType":"imports","source":6912,"target":6918},{"edgeType":"imports","source":1954,"target":1019},{"edgeType":"contains","source":3412,"target":3310},{"edgeType":"contains","source":13117,"target":13227},{"edgeType":"contains","source":1205,"target":3021},{"edgeType":"contains","source":1218,"target":1561},{"edgeType":"contains","source":634,"target":636},{"edgeType":"contains","source":8694,"target":8696},{"edgeType":"contains","source":6646,"target":6649},{"edgeType":"contains","source":12438,"target":12078},{"edgeType":"contains","source":10439,"target":10626},{"edgeType":"contains","source":4476,"target":4151},{"edgeType":"calls","source":5219,"target":4190},{"edgeType":"contains","source":3898,"target":4100},{"edgeType":"contains","source":1688,"target":1790},{"edgeType":"calls","source":5793,"target":4365},{"edgeType":"imports","source":6879,"target":6883},{"edgeType":"contains","source":11422,"target":11864},{"edgeType":"contains","source":4132,"target":4244},{"edgeType":"contains","source":8197,"target":8250},{"edgeType":"contains","source":13117,"target":13226},{"edgeType":"calls","source":430,"target":437},{"edgeType":"contains","source":1261,"target":1282},{"edgeType":"calls","source":3183,"target":2825},{"edgeType":"contains","source":10841,"target":10846},{"edgeType":"calls","source":5033,"target":4669},{"edgeType":"calls","source":4940,"target":4381},{"edgeType":"calls","source":8821,"target":8823},{"edgeType":"imports","source":4131,"target":4340},{"edgeType":"contains","source":9878,"target":10045},{"edgeType":"contains","source":9341,"target":9782},{"edgeType":"contains","source":6811,"target":6821},{"edgeType":"contains","source":4179,"target":4900},{"edgeType":"contains","source":6877,"target":6889},{"edgeType":"contains","source":13117,"target":13225},{"edgeType":"contains","source":10841,"target":10847},{"edgeType":"contains","source":1205,"target":3019},{"edgeType":"contains","source":12624,"target":12652},{"edgeType":"contains","source":12655,"target":12748},{"edgeType":"contains","source":1144,"target":683},{"edgeType":"contains","source":3107,"target":3251},{"edgeType":"contains","source":3144,"target":3161},{"edgeType":"contains","source":11965,"target":11941},{"edgeType":"calls","source":298,"target":300},{"edgeType":"contains","source":11836,"target":11712},{"edgeType":"contains","source":4135,"target":4150},{"edgeType":"contains","source":3787,"target":3311},{"edgeType":"contains","source":7601,"target":7699},{"edgeType":"contains","source":13117,"target":13224},{"edgeType":"calls","source":11894,"target":11867},{"edgeType":"calls","source":11862,"target":11802},{"edgeType":"contains","source":13018,"target":13122},{"edgeType":"contains","source":4003,"target":4021},{"edgeType":"contains","source":6447,"target":6470},{"edgeType":"contains","source":4179,"target":4907},{"edgeType":"contains","source":554,"target":1007},{"edgeType":"contains","source":2616,"target":2622},{"edgeType":"contains","source":4499,"target":4501},{"edgeType":"calls","source":11201,"target":11152},{"edgeType":"calls","source":7335,"target":7323},{"edgeType":"contains","source":12655,"target":12747},{"edgeType":"contains","source":4466,"target":4467},{"edgeType":"contains","source":6908,"target":6978},{"edgeType":"imports","source":4131,"target":4342},{"edgeType":"imports","source":6879,"target":6888},{"edgeType":"contains","source":1688,"target":1793},{"edgeType":"calls","source":3789,"target":3063},{"edgeType":"calls","source":5219,"target":4187},{"edgeType":"contains","source":1144,"target":1743},{"edgeType":"contains","source":9878,"target":10043},{"edgeType":"contains","source":5716,"target":4820},{"edgeType":"calls","source":12082,"target":11324},{"edgeType":"contains","source":5981,"target":6118},{"edgeType":"contains","source":13117,"target":13223},{"edgeType":"contains","source":5555,"target":5583},{"edgeType":"calls","source":7856,"target":687},{"edgeType":"contains","source":1205,"target":3025},{"edgeType":"imports","source":899,"target":952},{"edgeType":"contains","source":4758,"target":4927},{"edgeType":"contains","source":12655,"target":12746},{"edgeType":"contains","source":12921,"target":12957},{"edgeType":"contains","source":2616,"target":2623},{"edgeType":"contains","source":12856,"target":12858},{"edgeType":"contains","source":4499,"target":4500},{"edgeType":"imports","source":1954,"target":1014},{"edgeType":"calls","source":2412,"target":2413},{"edgeType":"contains","source":3144,"target":3167},{"edgeType":"contains","source":3898,"target":4104},{"edgeType":"calls","source":2052,"target":1942},{"edgeType":"contains","source":8087,"target":2140},{"edgeType":"calls","source":2817,"target":2539},{"edgeType":"contains","source":13117,"target":13222},{"edgeType":"calls","source":12260,"target":1576},{"edgeType":"imports","source":2840,"target":3144},{"edgeType":"contains","source":10477,"target":10498},{"edgeType":"contains","source":2219,"target":2242},{"edgeType":"imports","source":11454,"target":2478},{"edgeType":"contains","source":2550,"target":2552},{"edgeType":"contains","source":13018,"target":13120},{"edgeType":"calls","source":11440,"target":11140},{"edgeType":"contains","source":12921,"target":12956},{"edgeType":"calls","source":2500,"target":1796},{"edgeType":"contains","source":899,"target":884},{"edgeType":"calls","source":6089,"target":5754},{"edgeType":"contains","source":1434,"target":2266},{"edgeType":"contains","source":5409,"target":5885},{"edgeType":"calls","source":12566,"target":10059},{"edgeType":"contains","source":9878,"target":10041},{"edgeType":"contains","source":4132,"target":4247},{"edgeType":"contains","source":5555,"target":5585},{"edgeType":"contains","source":10439,"target":10620},{"edgeType":"contains","source":13117,"target":13221},{"edgeType":"contains","source":4236,"target":4194},{"edgeType":"contains","source":1205,"target":3023},{"edgeType":"imports","source":2840,"target":3143},{"edgeType":"calls","source":2974,"target":2958},{"edgeType":"contains","source":13018,"target":13119},{"edgeType":"contains","source":10839,"target":10905},{"edgeType":"imports","source":1139,"target":1966},{"edgeType":"contains","source":2616,"target":2621},{"edgeType":"contains","source":1688,"target":1792},{"edgeType":"calls","source":1784,"target":1796},{"edgeType":"imports","source":4131,"target":4345},{"edgeType":"calls","source":6637,"target":2539},{"edgeType":"imports","source":4873,"target":4597},{"edgeType":"contains","source":6020,"target":5969},{"edgeType":"contains","source":5409,"target":5884},{"edgeType":"calls","source":6456,"target":6036},{"edgeType":"contains","source":7865,"target":7967},{"edgeType":"contains","source":3574,"target":3576},{"edgeType":"contains","source":11865,"target":11866},{"edgeType":"contains","source":10839,"target":10885},{"edgeType":"imports","source":4131,"target":4329},{"edgeType":"contains","source":8678,"target":9168},{"edgeType":"contains","source":1887,"target":1937},{"edgeType":"imports","source":12538,"target":10088},{"edgeType":"calls","source":9115,"target":9195},{"edgeType":"contains","source":10477,"target":10480},{"edgeType":"contains","source":12591,"target":12597},{"edgeType":"contains","source":3176,"target":3202},{"edgeType":"contains","source":10675,"target":10684},{"edgeType":"contains","source":10698,"target":11028},{"edgeType":"calls","source":10250,"target":436},{"edgeType":"contains","source":3408,"target":3411},{"edgeType":"contains","source":13117,"target":13203},{"edgeType":"contains","source":1218,"target":1536},{"edgeType":"contains","source":11402,"target":11403},{"edgeType":"contains","source":1887,"target":1938},{"edgeType":"calls","source":2743,"target":2751},{"edgeType":"contains","source":13516,"target":13518},{"edgeType":"calls","source":1625,"target":1467},{"edgeType":"contains","source":2053,"target":2077},{"edgeType":"calls","source":1587,"target":1588},{"edgeType":"calls","source":5154,"target":5172},{"edgeType":"calls","source":3124,"target":2567},{"edgeType":"contains","source":12064,"target":12020},{"edgeType":"calls","source":4674,"target":1026},{"edgeType":"imports","source":2345,"target":1556},{"edgeType":"contains","source":12591,"target":12596},{"edgeType":"contains","source":7713,"target":6314},{"edgeType":"contains","source":12525,"target":12528},{"edgeType":"calls","source":2053,"target":1940},{"edgeType":"imports","source":11515,"target":10088},{"edgeType":"contains","source":7347,"target":7090},{"edgeType":"calls","source":12113,"target":2936},{"edgeType":"calls","source":504,"target":279},{"edgeType":"contains","source":13117,"target":13202},{"edgeType":"contains","source":12921,"target":12935},{"edgeType":"contains","source":4758,"target":4897},{"edgeType":"contains","source":13516,"target":13517},{"edgeType":"calls","source":800,"target":619},{"edgeType":"calls","source":4899,"target":4620},{"edgeType":"calls","source":12087,"target":568},{"edgeType":"contains","source":13780,"target":13789},{"edgeType":"contains","source":4597,"target":4603},{"edgeType":"contains","source":4201,"target":4194},{"edgeType":"contains","source":10439,"target":10598},{"edgeType":"contains","source":5687,"target":5700},{"edgeType":"contains","source":10477,"target":10478},{"edgeType":"calls","source":4783,"target":1874},{"edgeType":"contains","source":2908,"target":3052},{"edgeType":"contains","source":10675,"target":10682},{"edgeType":"contains","source":12591,"target":12595},{"edgeType":"calls","source":9844,"target":9853},{"edgeType":"contains","source":12723,"target":12731},{"edgeType":"calls","source":10245,"target":10106},{"edgeType":"contains","source":1144,"target":1716},{"edgeType":"imports","source":11242,"target":10094},{"edgeType":"contains","source":3408,"target":3409},{"edgeType":"contains","source":9170,"target":3431},{"edgeType":"contains","source":13117,"target":13201},{"edgeType":"contains","source":12921,"target":12934},{"edgeType":"contains","source":4132,"target":4218},{"edgeType":"calls","source":8567,"target":1874},{"edgeType":"contains","source":8678,"target":9169},{"edgeType":"calls","source":7432,"target":7462},{"edgeType":"calls","source":8398,"target":8170},{"edgeType":"calls","source":945,"target":351},{"edgeType":"contains","source":303,"target":304},{"edgeType":"imports","source":12557,"target":11617},{"edgeType":"contains","source":5687,"target":5701},{"edgeType":"contains","source":6282,"target":6283},{"edgeType":"contains","source":7805,"target":7692},{"edgeType":"contains","source":5555,"target":5565},{"edgeType":"calls","source":1884,"target":1896},{"edgeType":"contains","source":5587,"target":5630},{"edgeType":"contains","source":7601,"target":7674},{"edgeType":"contains","source":1096,"target":1089},{"edgeType":"contains","source":13117,"target":13200},{"edgeType":"contains","source":1144,"target":658},{"edgeType":"contains","source":5409,"target":570},{"edgeType":"contains","source":12921,"target":12933},{"edgeType":"calls","source":862,"target":805},{"edgeType":"calls","source":2149,"target":2133},{"edgeType":"contains","source":10839,"target":10881},{"edgeType":"calls","source":230,"target":313},{"edgeType":"contains","source":5409,"target":5863},{"edgeType":"contains","source":5981,"target":6093},{"edgeType":"contains","source":12051,"target":2906},{"edgeType":"calls","source":12852,"target":12799},{"edgeType":"calls","source":5816,"target":4731},{"edgeType":"contains","source":6611,"target":6647},{"edgeType":"contains","source":12423,"target":12515},{"edgeType":"imports","source":646,"target":313},{"edgeType":"contains","source":5786,"target":5796},{"edgeType":"contains","source":2219,"target":2220},{"edgeType":"contains","source":10675,"target":10680},{"edgeType":"calls","source":11232,"target":9110},{"edgeType":"contains","source":12657,"target":12661},{"edgeType":"contains","source":13117,"target":13199},{"edgeType":"contains","source":5555,"target":5558},{"edgeType":"calls","source":7863,"target":7843},{"edgeType":"calls","source":12313,"target":11539},{"edgeType":"contains","source":1887,"target":1942},{"edgeType":"contains","source":3152,"target":3952},{"edgeType":"contains","source":5409,"target":5862},{"edgeType":"contains","source":12921,"target":12932},{"edgeType":"contains","source":10377,"target":10405},{"edgeType":"contains","source":3855,"target":3298},{"edgeType":"contains","source":1497,"target":1348},{"edgeType":"contains","source":5786,"target":5797},{"edgeType":"contains","source":170,"target":200},{"edgeType":"contains","source":2219,"target":2221},{"edgeType":"contains","source":10675,"target":10681},{"edgeType":"contains","source":5555,"target":5559},{"edgeType":"contains","source":13117,"target":13198},{"edgeType":"calls","source":2721,"target":2372},{"edgeType":"contains","source":5654,"target":5661},{"edgeType":"contains","source":1218,"target":1541},{"edgeType":"contains","source":11454,"target":2387},{"edgeType":"contains","source":5252,"target":5443},{"edgeType":"contains","source":5409,"target":576},{"edgeType":"calls","source":11921,"target":436},{"edgeType":"calls","source":9869,"target":9079},{"edgeType":"contains","source":1218,"target":1537},{"edgeType":"contains","source":1144,"target":1721},{"edgeType":"contains","source":1887,"target":1939},{"edgeType":"calls","source":3022,"target":2551},{"edgeType":"contains","source":6144,"target":6327},{"edgeType":"contains","source":11039,"target":11021},{"edgeType":"contains","source":4597,"target":4607},{"edgeType":"contains","source":4132,"target":4223},{"edgeType":"contains","source":12657,"target":12659},{"edgeType":"calls","source":10182,"target":436},{"edgeType":"contains","source":12624,"target":12625},{"edgeType":"contains","source":12590,"target":12622},{"edgeType":"contains","source":5687,"target":5696},{"edgeType":"contains","source":7727,"target":7993},{"edgeType":"calls","source":10179,"target":7928},{"edgeType":"contains","source":5555,"target":5560},{"edgeType":"contains","source":5587,"target":5625},{"edgeType":"contains","source":13117,"target":13197},{"edgeType":"contains","source":1261,"target":1262},{"edgeType":"contains","source":1218,"target":1538},{"edgeType":"contains","source":13117,"target":13196},{"edgeType":"contains","source":4597,"target":4606},{"edgeType":"contains","source":11732,"target":11737},{"edgeType":"calls","source":12313,"target":11537},{"edgeType":"contains","source":12921,"target":12930},{"edgeType":"calls","source":9115,"target":9200},{"edgeType":"contains","source":6447,"target":6449},{"edgeType":"calls","source":5480,"target":4573},{"edgeType":"contains","source":12657,"target":12658},{"edgeType":"contains","source":7727,"target":7992},{"edgeType":"contains","source":5687,"target":5697},{"edgeType":"contains","source":5555,"target":5561},{"edgeType":"imports","source":6879,"target":6881},{"edgeType":"contains","source":1205,"target":2999},{"edgeType":"contains","source":1261,"target":1263},{"edgeType":"contains","source":1144,"target":662},{"edgeType":"contains","source":5252,"target":5441},{"edgeType":"contains","source":10675,"target":10692},{"edgeType":"contains","source":3107,"target":3236},{"edgeType":"calls","source":4334,"target":4159},{"edgeType":"contains","source":5223,"target":5291},{"edgeType":"contains","source":5252,"target":5449},{"edgeType":"contains","source":11171,"target":11172},{"edgeType":"contains","source":170,"target":206},{"edgeType":"calls","source":5848,"target":5849},{"edgeType":"contains","source":1887,"target":1945},{"edgeType":"contains","source":5687,"target":5706},{"edgeType":"contains","source":11674,"target":12491},{"edgeType":"contains","source":4132,"target":4230},{"edgeType":"contains","source":5555,"target":5570},{"edgeType":"contains","source":10246,"target":10250},{"edgeType":"contains","source":11096,"target":11382},{"edgeType":"contains","source":4102,"target":4103},{"edgeType":"contains","source":13117,"target":13211},{"edgeType":"contains","source":1205,"target":3004},{"edgeType":"calls","source":7268,"target":7266},{"edgeType":"calls","source":13882,"target":11527},{"edgeType":"calls","source":2599,"target":864},{"edgeType":"contains","source":8678,"target":9176},{"edgeType":"contains","source":10377,"target":10417},{"edgeType":"imports","source":2585,"target":1524},{"edgeType":"contains","source":10675,"target":10693},{"edgeType":"calls","source":5154,"target":5164},{"edgeType":"contains","source":9878,"target":10031},{"edgeType":"contains","source":5252,"target":5448},{"edgeType":"calls","source":5881,"target":5882},{"edgeType":"imports","source":10813,"target":10702},{"edgeType":"contains","source":1887,"target":1946},{"edgeType":"contains","source":5555,"target":5571},{"edgeType":"calls","source":5494,"target":4137},{"edgeType":"contains","source":8362,"target":8401},{"edgeType":"contains","source":2219,"target":2225},{"edgeType":"contains","source":6144,"target":6339},{"edgeType":"contains","source":13117,"target":13210},{"edgeType":"calls","source":2511,"target":2536},{"edgeType":"contains","source":10377,"target":10418},{"edgeType":"contains","source":12655,"target":12734},{"edgeType":"contains","source":8678,"target":9175},{"edgeType":"contains","source":12525,"target":12536},{"edgeType":"contains","source":5252,"target":5447},{"edgeType":"contains","source":11334,"target":10345},{"edgeType":"imports","source":10514,"target":10456},{"edgeType":"calls","source":2367,"target":654},{"edgeType":"contains","source":11259,"target":11613},{"edgeType":"contains","source":7727,"target":8005},{"edgeType":"imports","source":12355,"target":11527},{"edgeType":"calls","source":5914,"target":5915},{"edgeType":"contains","source":10345,"target":10350},{"edgeType":"contains","source":2219,"target":2222},{"edgeType":"contains","source":8098,"target":8132},{"edgeType":"contains","source":13117,"target":13209},{"edgeType":"calls","source":4934,"target":4584},{"edgeType":"contains","source":12228,"target":12229},{"edgeType":"contains","source":1205,"target":3002},{"edgeType":"contains","source":1261,"target":1266},{"edgeType":"imports","source":7601,"target":1400},{"edgeType":"contains","source":6611,"target":6661},{"edgeType":"contains","source":12655,"target":12733},{"edgeType":"contains","source":5252,"target":5446},{"edgeType":"contains","source":3144,"target":3145},{"edgeType":"contains","source":1096,"target":1098},{"edgeType":"calls","source":2367,"target":655},{"edgeType":"calls","source":5717,"target":4622},{"edgeType":"contains","source":5687,"target":5709},{"edgeType":"contains","source":1887,"target":1944},{"edgeType":"contains","source":5555,"target":5573},{"edgeType":"contains","source":4132,"target":4226},{"edgeType":"imports","source":6879,"target":6869},{"edgeType":"contains","source":13117,"target":13208},{"edgeType":"contains","source":10377,"target":10416},{"edgeType":"contains","source":4201,"target":4202},{"edgeType":"contains","source":10345,"target":10351},{"edgeType":"contains","source":11096,"target":11381},{"edgeType":"calls","source":10318,"target":451},{"edgeType":"calls","source":431,"target":422},{"edgeType":"calls","source":9724,"target":9352},{"edgeType":"contains","source":8678,"target":9177},{"edgeType":"contains","source":8678,"target":9172},{"edgeType":"contains","source":964,"target":965},{"edgeType":"calls","source":3735,"target":3697},{"edgeType":"contains","source":6611,"target":6655},{"edgeType":"contains","source":10037,"target":10382},{"edgeType":"calls","source":2599,"target":859},{"edgeType":"imports","source":12423,"target":11527},{"edgeType":"contains","source":170,"target":210},{"edgeType":"contains","source":1887,"target":1949},{"edgeType":"calls","source":12062,"target":11928},{"edgeType":"calls","source":12091,"target":12086},{"edgeType":"calls","source":4805,"target":4353},{"edgeType":"contains","source":11096,"target":11378},{"edgeType":"contains","source":13117,"target":13207},{"edgeType":"imports","source":2983,"target":2924},{"edgeType":"contains","source":5687,"target":5702},{"edgeType":"contains","source":1205,"target":3008},{"edgeType":"contains","source":1218,"target":1548},{"edgeType":"contains","source":5555,"target":5566},{"edgeType":"contains","source":10345,"target":10348},{"edgeType":"contains","source":4003,"target":4005},{"edgeType":"calls","source":5521,"target":5411},{"edgeType":"contains","source":2219,"target":2228},{"edgeType":"contains","source":10839,"target":10889},{"edgeType":"contains","source":10675,"target":10688},{"edgeType":"contains","source":10037,"target":10383},{"edgeType":"contains","source":6611,"target":6656},{"edgeType":"contains","source":1144,"target":669},{"edgeType":"contains","source":1887,"target":1950},{"edgeType":"contains","source":5252,"target":5452},{"edgeType":"contains","source":5687,"target":5703},{"edgeType":"calls","source":2148,"target":2157},{"edgeType":"calls","source":2049,"target":2052},{"edgeType":"contains","source":8098,"target":8124},{"edgeType":"contains","source":6,"target":8},{"edgeType":"imports","source":8063,"target":1881},{"edgeType":"contains","source":10345,"target":10349},{"edgeType":"contains","source":11096,"target":11379},{"edgeType":"contains","source":5555,"target":5567},{"edgeType":"contains","source":11171,"target":11168},{"edgeType":"contains","source":12618,"target":12820},{"edgeType":"contains","source":2219,"target":2229},{"edgeType":"contains","source":12591,"target":12600},{"edgeType":"contains","source":6611,"target":6657},{"edgeType":"calls","source":11563,"target":11539},{"edgeType":"contains","source":5252,"target":5451},{"edgeType":"contains","source":1887,"target":1947},{"edgeType":"calls","source":5867,"target":1026},{"edgeType":"contains","source":13780,"target":13793},{"edgeType":"contains","source":5687,"target":5704},{"edgeType":"contains","source":5883,"target":5970},{"edgeType":"contains","source":9878,"target":10024},{"edgeType":"contains","source":10438,"target":10634},{"edgeType":"calls","source":9052,"target":9049},{"edgeType":"calls","source":1291,"target":1241},{"edgeType":"contains","source":5555,"target":5568},{"edgeType":"contains","source":13117,"target":13205},{"edgeType":"contains","source":10345,"target":10346},{"edgeType":"contains","source":8362,"target":8400},{"edgeType":"contains","source":10301,"target":10653},{"edgeType":"contains","source":8198,"target":8199},{"edgeType":"contains","source":8197,"target":8230},{"edgeType":"calls","source":9115,"target":754},{"edgeType":"contains","source":12591,"target":12599},{"edgeType":"contains","source":8678,"target":9174},{"edgeType":"calls","source":1028,"target":937},{"edgeType":"contains","source":8062,"target":8185},{"edgeType":"contains","source":1887,"target":1948},{"edgeType":"calls","source":12719,"target":12699},{"edgeType":"calls","source":1917,"target":1918},{"edgeType":"contains","source":10237,"target":3124},{"edgeType":"contains","source":4132,"target":4231},{"edgeType":"contains","source":5555,"target":5569},{"edgeType":"contains","source":7125,"target":1294},{"edgeType":"contains","source":11096,"target":11377},{"edgeType":"contains","source":12591,"target":12598},{"edgeType":"contains","source":10345,"target":10347},{"edgeType":"contains","source":12657,"target":12666},{"edgeType":"calls","source":5121,"target":5124},{"edgeType":"contains","source":13117,"target":13204},{"edgeType":"contains","source":7074,"target":7080},{"edgeType":"contains","source":9878,"target":10005},{"edgeType":"contains","source":170,"target":181},{"edgeType":"contains","source":12462,"target":12351},{"edgeType":"imports","source":3952,"target":414},{"edgeType":"contains","source":10575,"target":10596},{"edgeType":"contains","source":6902,"target":7127},{"edgeType":"contains","source":9170,"target":3413},{"edgeType":"calls","source":693,"target":713},{"edgeType":"contains","source":5587,"target":5610},{"edgeType":"calls","source":594,"target":611},{"edgeType":"contains","source":13117,"target":13187},{"edgeType":"contains","source":1954,"target":1958},{"edgeType":"contains","source":5409,"target":5842},{"edgeType":"contains","source":1218,"target":1519},{"edgeType":"calls","source":7077,"target":1535},{"edgeType":"calls","source":9810,"target":9831},{"edgeType":"contains","source":11731,"target":11756},{"edgeType":"contains","source":4132,"target":4205},{"edgeType":"contains","source":8324,"target":4270},{"edgeType":"contains","source":9878,"target":10006},{"edgeType":"contains","source":7074,"target":7081},{"edgeType":"contains","source":1585,"target":1770},{"edgeType":"contains","source":1580,"target":1925},{"edgeType":"contains","source":10575,"target":10597},{"edgeType":"contains","source":899,"target":836},{"edgeType":"contains","source":5587,"target":5611},{"edgeType":"calls","source":12719,"target":12672},{"edgeType":"calls","source":6705,"target":6725},{"edgeType":"calls","source":2741,"target":649},{"edgeType":"calls","source":693,"target":712},{"edgeType":"contains","source":7629,"target":7844},{"edgeType":"contains","source":6902,"target":7128},{"edgeType":"contains","source":13093,"target":13930},{"edgeType":"contains","source":13117,"target":13186},{"edgeType":"contains","source":5409,"target":5841},{"edgeType":"contains","source":1218,"target":1520},{"edgeType":"calls","source":12415,"target":11527},{"edgeType":"calls","source":12159,"target":436},{"edgeType":"contains","source":4841,"target":5479},{"edgeType":"calls","source":3020,"target":2571},{"edgeType":"calls","source":1786,"target":654},{"edgeType":"imports","source":4131,"target":4380},{"edgeType":"contains","source":5587,"target":5612},{"edgeType":"contains","source":1585,"target":1767},{"edgeType":"contains","source":7001,"target":7231},{"edgeType":"contains","source":5409,"target":5840},{"edgeType":"contains","source":13093,"target":13929},{"edgeType":"contains","source":13117,"target":13185},{"edgeType":"calls","source":1462,"target":1188},{"edgeType":"contains","source":1218,"target":1517},{"edgeType":"contains","source":4132,"target":4203},{"edgeType":"imports","source":2137,"target":654},{"edgeType":"contains","source":4841,"target":5478},{"edgeType":"contains","source":11731,"target":11754},{"edgeType":"contains","source":12257,"target":2849},{"edgeType":"contains","source":10145,"target":10183},{"edgeType":"contains","source":6203,"target":2372},{"edgeType":"contains","source":10176,"target":10279},{"edgeType":"contains","source":9878,"target":10004},{"edgeType":"imports","source":8107,"target":568},{"edgeType":"contains","source":10575,"target":10595},{"edgeType":"contains","source":12655,"target":12707},{"edgeType":"contains","source":5587,"target":5613},{"edgeType":"contains","source":8591,"target":8678},{"edgeType":"contains","source":13093,"target":13928},{"edgeType":"contains","source":13117,"target":13184},{"edgeType":"calls","source":4162,"target":4163},{"edgeType":"contains","source":5223,"target":5263},{"edgeType":"contains","source":5252,"target":5421},{"edgeType":"contains","source":7593,"target":1564},{"edgeType":"contains","source":1,"target":136},{"edgeType":"calls","source":5034,"target":4613},{"edgeType":"contains","source":6223,"target":5981},{"edgeType":"contains","source":5786,"target":5787},{"edgeType":"calls","source":5542,"target":491},{"edgeType":"contains","source":5786,"target":4722},{"edgeType":"contains","source":7074,"target":7076},{"edgeType":"contains","source":1585,"target":1773},{"edgeType":"contains","source":7041,"target":7042},{"edgeType":"contains","source":9852,"target":10807},{"edgeType":"contains","source":11109,"target":10951},{"edgeType":"contains","source":3439,"target":3494},{"edgeType":"contains","source":13093,"target":13927},{"edgeType":"contains","source":13117,"target":13183},{"edgeType":"calls","source":1024,"target":1019},{"edgeType":"contains","source":7629,"target":7841},{"edgeType":"contains","source":5587,"target":5606},{"edgeType":"contains","source":7469,"target":7515},{"edgeType":"imports","source":12298,"target":12289},{"edgeType":"contains","source":11674,"target":12462},{"edgeType":"imports","source":7629,"target":592},{"edgeType":"contains","source":8362,"target":8373},{"edgeType":"contains","source":10145,"target":10181},{"edgeType":"contains","source":2269,"target":2767},{"edgeType":"calls","source":491,"target":628},{"edgeType":"contains","source":1585,"target":1774},{"edgeType":"contains","source":5587,"target":5607},{"edgeType":"contains","source":13093,"target":13926},{"edgeType":"contains","source":13117,"target":13182},{"edgeType":"contains","source":554,"target":964},{"edgeType":"contains","source":8111,"target":8754},{"edgeType":"imports","source":12892,"target":12902},{"edgeType":"imports","source":4131,"target":4384},{"edgeType":"contains","source":12523,"target":12569},{"edgeType":"contains","source":10608,"target":10624},{"edgeType":"contains","source":1584,"target":745},{"edgeType":"contains","source":5686,"target":5710},{"edgeType":"contains","source":7041,"target":7044},{"edgeType":"contains","source":9852,"target":10805},{"edgeType":"contains","source":8078,"target":266},{"edgeType":"contains","source":5587,"target":5608},{"edgeType":"calls","source":10076,"target":10048},{"edgeType":"contains","source":8990,"target":8991},{"edgeType":"contains","source":13093,"target":13925},{"edgeType":"contains","source":13117,"target":13181},{"edgeType":"calls","source":9810,"target":9838},{"edgeType":"contains","source":5221,"target":5330},{"edgeType":"calls","source":7957,"target":687},{"edgeType":"contains","source":1218,"target":1521},{"edgeType":"contains","source":7469,"target":7517},{"edgeType":"contains","source":6043,"target":6271},{"edgeType":"contains","source":6149,"target":6156},{"edgeType":"contains","source":8096,"target":8165},{"edgeType":"contains","source":13093,"target":13924},{"edgeType":"contains","source":13117,"target":13180},{"edgeType":"calls","source":230,"target":266},{"edgeType":"calls","source":12604,"target":2498},{"edgeType":"contains","source":8762,"target":9716},{"edgeType":"contains","source":6276,"target":6447},{"edgeType":"contains","source":12590,"target":12605},{"edgeType":"contains","source":10345,"target":10321},{"edgeType":"imports","source":12519,"target":2269},{"edgeType":"calls","source":1959,"target":575},{"edgeType":"contains","source":1585,"target":1772},{"edgeType":"contains","source":7074,"target":7079},{"edgeType":"contains","source":7041,"target":7045},{"edgeType":"imports","source":4131,"target":4386},{"edgeType":"contains","source":5686,"target":5711},{"edgeType":"contains","source":7727,"target":7975},{"edgeType":"calls","source":3271,"target":3240},{"edgeType":"contains","source":5883,"target":5946},{"edgeType":"contains","source":3771,"target":3769},{"edgeType":"calls","source":1156,"target":1156},{"edgeType":"contains","source":9170,"target":3410},{"edgeType":"contains","source":5587,"target":5609},{"edgeType":"contains","source":7629,"target":7842},{"edgeType":"contains","source":5107,"target":4635},{"edgeType":"calls","source":9868,"target":2754},{"edgeType":"contains","source":5223,"target":5267},{"edgeType":"calls","source":9810,"target":9837},{"edgeType":"contains","source":13093,"target":13923},{"edgeType":"calls","source":12388,"target":12366},{"edgeType":"contains","source":12523,"target":12567},{"edgeType":"contains","source":12227,"target":12230},{"edgeType":"contains","source":10155,"target":9870},{"edgeType":"contains","source":10145,"target":10180},{"edgeType":"contains","source":12617,"target":12824},{"edgeType":"contains","source":6149,"target":6157},{"edgeType":"contains","source":6144,"target":6312},{"edgeType":"imports","source":3952,"target":2536},{"edgeType":"imports","source":1497,"target":420},{"edgeType":"contains","source":8990,"target":9001},{"edgeType":"contains","source":5587,"target":5618},{"edgeType":"contains","source":11732,"target":11734},{"edgeType":"calls","source":3273,"target":3175},{"edgeType":"contains","source":13117,"target":13195},{"edgeType":"contains","source":8230,"target":8249},{"edgeType":"contains","source":12921,"target":12929},{"edgeType":"contains","source":600,"target":601},{"edgeType":"calls","source":829,"target":717},{"edgeType":"contains","source":6411,"target":6500},{"edgeType":"contains","source":8762,"target":9727},{"edgeType":"imports","source":7629,"target":580},{"edgeType":"calls","source":7966,"target":7809},{"edgeType":"calls","source":991,"target":981},{"edgeType":"contains","source":10701,"target":9870},{"edgeType":"contains","source":10675,"target":10676},{"edgeType":"calls","source":12226,"target":12108},{"edgeType":"contains","source":12690,"target":12691},{"edgeType":"calls","source":4502,"target":4187},{"edgeType":"contains","source":9878,"target":10014},{"edgeType":"contains","source":1954,"target":1966},{"edgeType":"contains","source":5409,"target":5850},{"edgeType":"calls","source":2148,"target":2111},{"edgeType":"contains","source":5786,"target":5792},{"edgeType":"contains","source":5587,"target":5619},{"edgeType":"contains","source":5753,"target":5758},{"edgeType":"imports","source":12553,"target":11779},{"edgeType":"contains","source":8990,"target":9000},{"edgeType":"contains","source":10301,"target":10643},{"edgeType":"contains","source":11732,"target":11735},{"edgeType":"contains","source":13780,"target":13782},{"edgeType":"contains","source":13846,"target":13850},{"edgeType":"calls","source":7234,"target":7247},{"edgeType":"contains","source":13093,"target":13938},{"edgeType":"contains","source":13117,"target":13194},{"edgeType":"contains","source":1205,"target":2988},{"edgeType":"contains","source":8792,"target":8796},{"edgeType":"contains","source":8762,"target":9726},{"edgeType":"contains","source":10839,"target":10878},{"edgeType":"contains","source":12590,"target":12618},{"edgeType":"contains","source":1144,"target":648},{"edgeType":"contains","source":2448,"target":2508},{"edgeType":"imports","source":1139,"target":2005},{"edgeType":"calls","source":363,"target":364},{"edgeType":"contains","source":12099,"target":11984},{"edgeType":"contains","source":10237,"target":3114},{"edgeType":"contains","source":1580,"target":1934},{"edgeType":"calls","source":12788,"target":12656},{"edgeType":"contains","source":5786,"target":5793},{"edgeType":"imports","source":6912,"target":6950},{"edgeType":"contains","source":1,"target":142},{"edgeType":"contains","source":13780,"target":13781},{"edgeType":"contains","source":13846,"target":13849},{"edgeType":"contains","source":1585,"target":1775},{"edgeType":"contains","source":13093,"target":13937},{"edgeType":"contains","source":13117,"target":13193},{"edgeType":"contains","source":5107,"target":4640},{"edgeType":"contains","source":12590,"target":12617},{"edgeType":"contains","source":6411,"target":6502},{"edgeType":"calls","source":2841,"target":2823},{"edgeType":"calls","source":3074,"target":3000},{"edgeType":"calls","source":10318,"target":436},{"edgeType":"contains","source":11864,"target":11869},{"edgeType":"contains","source":2006,"target":1409},{"edgeType":"contains","source":5555,"target":5556},{"edgeType":"contains","source":13093,"target":13936},{"edgeType":"contains","source":13117,"target":13192},{"edgeType":"contains","source":1580,"target":1931},{"edgeType":"contains","source":8098,"target":8114},{"edgeType":"calls","source":4674,"target":4137},{"edgeType":"contains","source":1218,"target":1526},{"edgeType":"contains","source":2648,"target":2649},{"edgeType":"calls","source":4966,"target":4598},{"edgeType":"imports","source":4131,"target":4374},{"edgeType":"calls","source":297,"target":298},{"edgeType":"contains","source":10698,"target":11019},{"edgeType":"imports","source":1797,"target":1688},{"edgeType":"calls","source":1706,"target":1014},{"edgeType":"contains","source":5409,"target":5847},{"edgeType":"imports","source":12432,"target":2849},{"edgeType":"contains","source":1580,"target":1932},{"edgeType":"calls","source":8226,"target":8208},{"edgeType":"contains","source":4132,"target":4210},{"edgeType":"contains","source":5587,"target":5622},{"edgeType":"contains","source":7601,"target":7666},{"edgeType":"contains","source":13093,"target":13935},{"edgeType":"contains","source":13117,"target":13191},{"edgeType":"contains","source":13846,"target":13847},{"edgeType":"contains","source":1205,"target":2991},{"edgeType":"contains","source":5587,"target":5614},{"edgeType":"calls","source":9844,"target":9847},{"edgeType":"contains","source":2908,"target":3050},{"edgeType":"contains","source":4597,"target":4601},{"edgeType":"contains","source":12590,"target":12615},{"edgeType":"contains","source":12921,"target":12925},{"edgeType":"contains","source":4441,"target":4151},{"edgeType":"contains","source":2448,"target":2511},{"edgeType":"calls","source":2543,"target":2546},{"edgeType":"contains","source":5786,"target":5788},{"edgeType":"contains","source":5753,"target":5754},{"edgeType":"contains","source":3669,"target":3772},{"edgeType":"contains","source":11731,"target":11760},{"edgeType":"calls","source":12313,"target":11529},{"edgeType":"contains","source":5587,"target":5615},{"edgeType":"contains","source":13117,"target":13190},{"edgeType":"contains","source":4235,"target":4194},{"edgeType":"contains","source":2908,"target":3051},{"edgeType":"contains","source":12692,"target":12623},{"edgeType":"calls","source":7267,"target":7285},{"edgeType":"calls","source":1342,"target":665},{"edgeType":"imports","source":9143,"target":1218},{"edgeType":"calls","source":4501,"target":4213},{"edgeType":"contains","source":6611,"target":6639},{"edgeType":"contains","source":5786,"target":5789},{"edgeType":"contains","source":5720,"target":5721},{"edgeType":"contains","source":8197,"target":8210},{"edgeType":"calls","source":12364,"target":436},{"edgeType":"contains","source":5587,"target":5616},{"edgeType":"contains","source":8990,"target":8999},{"edgeType":"contains","source":13117,"target":13189},{"edgeType":"calls","source":11966,"target":11714},{"edgeType":"contains","source":1205,"target":2989},{"edgeType":"calls","source":7171,"target":7091},{"edgeType":"calls","source":4987,"target":5001},{"edgeType":"contains","source":8566,"target":8401},{"edgeType":"imports","source":7629,"target":586},{"edgeType":"contains","source":402,"target":403},{"edgeType":"contains","source":4597,"target":4599},{"edgeType":"contains","source":3174,"target":3258},{"edgeType":"calls","source":6805,"target":6810},{"edgeType":"contains","source":5753,"target":5756},{"edgeType":"contains","source":1580,"target":1935},{"edgeType":"contains","source":5720,"target":5722},{"edgeType":"calls","source":2378,"target":2374},{"edgeType":"calls","source":8259,"target":8245},{"edgeType":"contains","source":9878,"target":10008},{"edgeType":"contains","source":4132,"target":4214},{"edgeType":"contains","source":5587,"target":5617},{"edgeType":"calls","source":5842,"target":693},{"edgeType":"contains","source":8230,"target":8246},{"edgeType":"contains","source":1205,"target":2990},{"edgeType":"calls","source":693,"target":702},{"edgeType":"contains","source":1218,"target":1530},{"edgeType":"calls","source":11859,"target":11861},{"edgeType":"contains","source":2908,"target":3049},{"edgeType":"contains","source":13117,"target":13188},{"edgeType":"contains","source":4597,"target":4598},{"edgeType":"imports","source":7587,"target":1887},{"edgeType":"imports","source":11674,"target":11545},{"edgeType":"contains","source":5223,"target":5275},{"edgeType":"calls","source":2281,"target":2211},{"edgeType":"imports","source":4131,"target":4378},{"edgeType":"contains","source":5981,"target":6088},{"edgeType":"contains","source":7727,"target":7984},{"edgeType":"contains","source":11731,"target":11759},{"edgeType":"calls","source":2362,"target":1814},{"edgeType":"contains","source":5654,"target":5655},{"edgeType":"contains","source":1580,"target":1936},{"edgeType":"contains","source":5786,"target":5791},{"edgeType":"contains","source":8790,"target":8834},{"edgeType":"contains","source":10839,"target":10852},{"edgeType":"contains","source":5981,"target":6064},{"edgeType":"contains","source":2480,"target":2548},{"edgeType":"calls","source":1685,"target":1689},{"edgeType":"imports","source":7908,"target":7779},{"edgeType":"contains","source":13843,"target":13919},{"edgeType":"contains","source":10145,"target":10168},{"edgeType":"contains","source":9826,"target":8430},{"edgeType":"calls","source":5880,"target":5889},{"edgeType":"contains","source":12623,"target":12629},{"edgeType":"calls","source":4709,"target":4137},{"edgeType":"contains","source":12524,"target":12527},{"edgeType":"calls","source":10540,"target":10441},{"edgeType":"calls","source":12290,"target":12213},{"edgeType":"calls","source":2052,"target":1939},{"edgeType":"contains","source":5587,"target":5594},{"edgeType":"contains","source":7007,"target":7026},{"edgeType":"contains","source":8958,"target":8911},{"edgeType":"calls","source":491,"target":650},{"edgeType":"contains","source":9106,"target":9608},{"edgeType":"contains","source":13117,"target":13170},{"edgeType":"contains","source":10145,"target":10169},{"edgeType":"contains","source":12921,"target":12903},{"edgeType":"contains","source":1218,"target":1503},{"edgeType":"contains","source":7400,"target":7529},{"edgeType":"contains","source":4132,"target":4187},{"edgeType":"calls","source":2749,"target":2532},{"edgeType":"calls","source":12386,"target":11353},{"edgeType":"contains","source":8790,"target":8833},{"edgeType":"contains","source":2818,"target":2641},{"edgeType":"contains","source":4530,"target":4534},{"edgeType":"contains","source":10367,"target":10686},{"edgeType":"contains","source":4179,"target":4844},{"edgeType":"contains","source":9878,"target":9990},{"edgeType":"contains","source":2350,"target":2351},{"edgeType":"imports","source":402,"target":516},{"edgeType":"calls","source":1454,"target":1450},{"edgeType":"contains","source":11202,"target":11227},{"edgeType":"calls","source":9693,"target":1814},{"edgeType":"contains","source":12491,"target":12492},{"edgeType":"contains","source":5587,"target":5595},{"edgeType":"contains","source":8590,"target":8691},{"edgeType":"contains","source":10608,"target":10615},{"edgeType":"contains","source":12623,"target":12628},{"edgeType":"calls","source":3789,"target":3060},{"edgeType":"calls","source":4764,"target":4545},{"edgeType":"contains","source":1434,"target":2207},{"edgeType":"calls","source":7996,"target":1570},{"edgeType":"calls","source":6088,"target":5782},{"edgeType":"calls","source":12674,"target":1367},{"edgeType":"contains","source":9106,"target":9607},{"edgeType":"contains","source":13117,"target":13169},{"edgeType":"contains","source":8790,"target":8836},{"edgeType":"contains","source":1,"target":120},{"edgeType":"contains","source":4841,"target":5462},{"edgeType":"imports","source":12280,"target":11779},{"edgeType":"calls","source":3009,"target":2925},{"edgeType":"contains","source":2852,"target":2641},{"edgeType":"contains","source":13843,"target":13917},{"edgeType":"contains","source":4530,"target":4533},{"edgeType":"contains","source":8111,"target":8744},{"edgeType":"contains","source":10301,"target":11672},{"edgeType":"contains","source":6411,"target":6478},{"edgeType":"calls","source":1686,"target":1660},{"edgeType":"contains","source":10608,"target":10612},{"edgeType":"contains","source":12713,"target":13008},{"edgeType":"contains","source":13117,"target":13168},{"edgeType":"calls","source":2755,"target":2343},{"edgeType":"calls","source":2070,"target":1383},{"edgeType":"contains","source":7007,"target":7028},{"edgeType":"contains","source":3440,"target":3441},{"edgeType":"contains","source":8790,"target":8835},{"edgeType":"calls","source":2201,"target":491},{"edgeType":"contains","source":12919,"target":12963},{"edgeType":"calls","source":2086,"target":1942},{"edgeType":"contains","source":4596,"target":4600},{"edgeType":"calls","source":1596,"target":1278},{"edgeType":"contains","source":2480,"target":2547},{"edgeType":"contains","source":4530,"target":4532},{"edgeType":"contains","source":10176,"target":10263},{"edgeType":"contains","source":12617,"target":12812},{"edgeType":"contains","source":12590,"target":12592},{"edgeType":"contains","source":10137,"target":3016},{"edgeType":"contains","source":10608,"target":10613},{"edgeType":"contains","source":12557,"target":12558},{"edgeType":"contains","source":2908,"target":3020},{"edgeType":"imports","source":9852,"target":9878},{"edgeType":"calls","source":6540,"target":6541},{"edgeType":"contains","source":5587,"target":5597},{"edgeType":"contains","source":13117,"target":13167},{"edgeType":"contains","source":3638,"target":3644},{"edgeType":"contains","source":11367,"target":10338},{"edgeType":"contains","source":7007,"target":7029},{"edgeType":"calls","source":2322,"target":965},{"edgeType":"contains","source":13843,"target":13915},{"edgeType":"contains","source":6611,"target":6614},{"edgeType":"contains","source":12254,"target":12436},{"edgeType":"calls","source":12818,"target":12763},{"edgeType":"contains","source":4132,"target":4192},{"edgeType":"contains","source":11259,"target":11569},{"edgeType":"contains","source":8590,"target":8688},{"edgeType":"contains","source":12590,"target":12591},{"edgeType":"contains","source":2909,"target":2994},{"edgeType":"contains","source":10608,"target":10610},{"edgeType":"contains","source":10575,"target":10576},{"edgeType":"imports","source":8485,"target":1524},{"edgeType":"contains","source":9826,"target":8426},{"edgeType":"contains","source":12820,"target":12860},{"edgeType":"calls","source":11531,"target":11435},{"edgeType":"contains","source":13117,"target":13166},{"edgeType":"contains","source":4841,"target":5468},{"edgeType":"calls","source":594,"target":624},{"edgeType":"contains","source":5587,"target":5590},{"edgeType":"calls","source":6842,"target":6694},{"edgeType":"calls","source":5748,"target":5748},{"edgeType":"calls","source":5118,"target":4137},{"edgeType":"calls","source":1817,"target":763},{"edgeType":"contains","source":4132,"target":4191},{"edgeType":"imports","source":4131,"target":4367},{"edgeType":"calls","source":13218,"target":13046},{"edgeType":"calls","source":8819,"target":8828},{"edgeType":"contains","source":2350,"target":2355},{"edgeType":"calls","source":1454,"target":1446},{"edgeType":"imports","source":12574,"target":10059},{"edgeType":"contains","source":10145,"target":10165},{"edgeType":"imports","source":646,"target":347},{"edgeType":"contains","source":10301,"target":11671},{"edgeType":"contains","source":8590,"target":8687},{"edgeType":"contains","source":1434,"target":2211},{"edgeType":"contains","source":1585,"target":1758},{"edgeType":"calls","source":11232,"target":11192},{"edgeType":"contains","source":3440,"target":3446},{"edgeType":"calls","source":1104,"target":668},{"edgeType":"contains","source":5587,"target":5591},{"edgeType":"contains","source":4841,"target":5467},{"edgeType":"calls","source":4794,"target":4668},{"edgeType":"calls","source":6284,"target":6044},{"edgeType":"contains","source":13117,"target":13165},{"edgeType":"imports","source":1511,"target":1014},{"edgeType":"contains","source":5107,"target":4620},{"edgeType":"calls","source":11570,"target":11284},{"edgeType":"calls","source":12396,"target":12101},{"edgeType":"contains","source":4758,"target":4868},{"edgeType":"calls","source":4966,"target":4620},{"edgeType":"contains","source":13117,"target":13164},{"edgeType":"contains","source":4596,"target":4605},{"edgeType":"contains","source":13843,"target":13913},{"edgeType":"contains","source":8762,"target":9700},{"edgeType":"contains","source":8790,"target":8832},{"edgeType":"contains","source":4132,"target":4190},{"edgeType":"contains","source":10176,"target":10258},{"edgeType":"calls","source":1817,"target":766},{"edgeType":"contains","source":2350,"target":2352},{"edgeType":"calls","source":5602,"target":1817},{"edgeType":"contains","source":170,"target":171},{"edgeType":"contains","source":2355,"target":1140},{"edgeType":"imports","source":891,"target":148},{"edgeType":"calls","source":8819,"target":8831},{"edgeType":"contains","source":1585,"target":1755},{"edgeType":"calls","source":6086,"target":5839},{"edgeType":"calls","source":4000,"target":3911},{"edgeType":"contains","source":10719,"target":10338},{"edgeType":"contains","source":8590,"target":8690},{"edgeType":"calls","source":9244,"target":9398},{"edgeType":"imports","source":11019,"target":10702},{"edgeType":"calls","source":594,"target":626},{"edgeType":"contains","source":7470,"target":7471},{"edgeType":"contains","source":5409,"target":5827},{"edgeType":"calls","source":3043,"target":2925},{"edgeType":"contains","source":13117,"target":13163},{"edgeType":"contains","source":13843,"target":13912},{"edgeType":"contains","source":6902,"target":7109},{"edgeType":"contains","source":1,"target":123},{"edgeType":"calls","source":5913,"target":5916},{"edgeType":"contains","source":10145,"target":10163},{"edgeType":"calls","source":1816,"target":1853},{"edgeType":"calls","source":1476,"target":766},{"edgeType":"contains","source":2350,"target":2353},{"edgeType":"contains","source":10301,"target":11669},{"edgeType":"calls","source":8954,"target":8873},{"edgeType":"contains","source":1585,"target":1756},{"edgeType":"contains","source":2909,"target":2993},{"edgeType":"contains","source":891,"target":2130},{"edgeType":"calls","source":12719,"target":12658},{"edgeType":"calls","source":6304,"target":4365},{"edgeType":"contains","source":11779,"target":2847},{"edgeType":"calls","source":740,"target":327},{"edgeType":"contains","source":1434,"target":2209},{"edgeType":"contains","source":7601,"target":1295},{"edgeType":"calls","source":9810,"target":9820},{"edgeType":"contains","source":10237,"target":3096},{"edgeType":"contains","source":10719,"target":10352},{"edgeType":"contains","source":3143,"target":3144},{"edgeType":"calls","source":2289,"target":1984},{"edgeType":"calls","source":2500,"target":1785},{"edgeType":"calls","source":1495,"target":1229},{"edgeType":"contains","source":8111,"target":8750},{"edgeType":"contains","source":11202,"target":11235},{"edgeType":"contains","source":9852,"target":10803},{"edgeType":"calls","source":2141,"target":230},{"edgeType":"contains","source":170,"target":173},{"edgeType":"contains","source":5977,"target":6196},{"edgeType":"contains","source":5981,"target":6072},{"edgeType":"calls","source":5880,"target":5881},{"edgeType":"contains","source":11467,"target":11476},{"edgeType":"contains","source":4132,"target":4197},{"edgeType":"contains","source":6149,"target":6150},{"edgeType":"contains","source":8230,"target":8233},{"edgeType":"contains","source":13117,"target":13178},{"edgeType":"contains","source":8111,"target":8751},{"edgeType":"contains","source":6411,"target":6484},{"edgeType":"calls","source":4492,"target":4514},{"edgeType":"imports","source":2916,"target":2924},{"edgeType":"contains","source":10608,"target":10622},{"edgeType":"contains","source":2448,"target":2492},{"edgeType":"calls","source":9762,"target":3911},{"edgeType":"calls","source":10801,"target":10815},{"edgeType":"contains","source":9878,"target":9998},{"edgeType":"imports","source":4131,"target":4355},{"edgeType":"contains","source":2350,"target":2359},{"edgeType":"contains","source":2006,"target":1395},{"edgeType":"calls","source":1883,"target":1884},{"edgeType":"contains","source":11202,"target":11236},{"edgeType":"contains","source":5977,"target":6197},{"edgeType":"contains","source":3679,"target":3440},{"edgeType":"contains","source":1585,"target":1762},{"edgeType":"contains","source":4132,"target":4195},{"edgeType":"calls","source":6567,"target":2539},{"edgeType":"imports","source":7629,"target":562},{"edgeType":"contains","source":9106,"target":9615},{"edgeType":"calls","source":5491,"target":1026},{"edgeType":"contains","source":8197,"target":8198},{"edgeType":"contains","source":8230,"target":8232},{"edgeType":"contains","source":13117,"target":13177},{"edgeType":"contains","source":12227,"target":12228},{"edgeType":"contains","source":1218,"target":1512},{"edgeType":"contains","source":10176,"target":10274},{"edgeType":"contains","source":10608,"target":10623},{"edgeType":"imports","source":1139,"target":1986},{"edgeType":"contains","source":7239,"target":7244},{"edgeType":"contains","source":1805,"target":2338},{"edgeType":"imports","source":402,"target":521},{"edgeType":"contains","source":1,"target":8585},{"edgeType":"contains","source":170,"target":175},{"edgeType":"contains","source":4132,"target":4194},{"edgeType":"calls","source":10801,"target":10812},{"edgeType":"calls","source":1784,"target":1785},{"edgeType":"calls","source":12652,"target":12626},{"edgeType":"contains","source":13117,"target":13176},{"edgeType":"calls","source":4162,"target":4170},{"edgeType":"contains","source":8098,"target":8099},{"edgeType":"calls","source":8985,"target":8975},{"edgeType":"contains","source":4758,"target":4872},{"edgeType":"contains","source":12590,"target":12601},{"edgeType":"contains","source":8362,"target":8371},{"edgeType":"calls","source":1104,"target":667},{"edgeType":"contains","source":1218,"target":1509},{"edgeType":"calls","source":5814,"target":5810},{"edgeType":"contains","source":8082,"target":2251},{"edgeType":"contains","source":1,"target":10698},{"edgeType":"contains","source":7074,"target":7075},{"edgeType":"contains","source":10145,"target":10175},{"edgeType":"calls","source":4498,"target":4324},{"edgeType":"contains","source":9106,"target":9618},{"edgeType":"contains","source":5686,"target":5707},{"edgeType":"calls","source":4324,"target":4433},{"edgeType":"contains","source":9852,"target":10802},{"edgeType":"contains","source":11467,"target":11475},{"edgeType":"contains","source":4132,"target":4193},{"edgeType":"contains","source":5587,"target":5605},{"edgeType":"imports","source":2244,"target":1556},{"edgeType":"contains","source":6149,"target":6153},{"edgeType":"contains","source":8230,"target":8234},{"edgeType":"contains","source":9170,"target":3405},{"edgeType":"contains","source":13117,"target":13175},{"edgeType":"calls","source":4162,"target":4171},{"edgeType":"contains","source":8164,"target":8166},{"edgeType":"contains","source":1585,"target":1760},{"edgeType":"contains","source":8197,"target":8200},{"edgeType":"contains","source":8096,"target":8160},{"edgeType":"contains","source":9106,"target":9617},{"edgeType":"contains","source":10439,"target":10575},{"edgeType":"imports","source":9852,"target":9870},{"edgeType":"calls","source":4967,"target":4584},{"edgeType":"contains","source":5981,"target":6068},{"edgeType":"imports","source":1954,"target":1031},{"edgeType":"contains","source":10145,"target":10172},{"edgeType":"calls","source":1849,"target":821},{"edgeType":"calls","source":2573,"target":575},{"edgeType":"contains","source":170,"target":177},{"edgeType":"contains","source":8111,"target":8746},{"edgeType":"calls","source":2234,"target":1571},{"edgeType":"contains","source":8197,"target":1852},{"edgeType":"calls","source":10644,"target":3000},{"edgeType":"calls","source":9810,"target":9827},{"edgeType":"contains","source":13093,"target":13918},{"edgeType":"contains","source":13117,"target":13174},{"edgeType":"contains","source":4841,"target":5476},{"edgeType":"contains","source":4132,"target":4201},{"edgeType":"contains","source":5587,"target":5598},{"edgeType":"calls","source":10051,"target":3413},{"edgeType":"calls","source":7168,"target":7166},{"edgeType":"contains","source":10608,"target":10618},{"edgeType":"contains","source":8790,"target":8838},{"edgeType":"calls","source":7538,"target":7323},{"edgeType":"calls","source":5034,"target":4620},{"edgeType":"contains","source":7007,"target":7030},{"edgeType":"calls","source":3111,"target":2925},{"edgeType":"contains","source":8790,"target":8837},{"edgeType":"contains","source":2350,"target":2363},{"edgeType":"calls","source":7927,"target":7950},{"edgeType":"calls","source":12822,"target":12646},{"edgeType":"imports","source":4750,"target":1026},{"edgeType":"calls","source":12397,"target":454},{"edgeType":"imports","source":402,"target":520},{"edgeType":"contains","source":1887,"target":1917},{"edgeType":"contains","source":8111,"target":8745},{"edgeType":"contains","source":5587,"target":5599},{"edgeType":"contains","source":9106,"target":9611},{"edgeType":"calls","source":10147,"target":436},{"edgeType":"contains","source":4841,"target":5475},{"edgeType":"contains","source":12557,"target":12564},{"edgeType":"contains","source":13117,"target":13173},{"edgeType":"imports","source":1511,"target":1022},{"edgeType":"contains","source":11299,"target":10338},{"edgeType":"contains","source":12618,"target":12787},{"edgeType":"calls","source":3006,"target":3009},{"edgeType":"calls","source":7465,"target":7473},{"edgeType":"calls","source":1156,"target":1162},{"edgeType":"calls","source":1222,"target":1230},{"edgeType":"contains","source":10698,"target":11000},{"edgeType":"contains","source":10145,"target":10170},{"edgeType":"contains","source":10839,"target":10854},{"edgeType":"contains","source":1,"target":8589},{"edgeType":"contains","source":2350,"target":2360},{"edgeType":"calls","source":12822,"target":12645},{"edgeType":"calls","source":4660,"target":4584},{"edgeType":"calls","source":4665,"target":4429},{"edgeType":"contains","source":11467,"target":11470},{"edgeType":"contains","source":1585,"target":1763},{"edgeType":"contains","source":1584,"target":1794},{"edgeType":"contains","source":7469,"target":7509},{"edgeType":"calls","source":12431,"target":454},{"edgeType":"contains","source":8111,"target":8748},{"edgeType":"contains","source":9878,"target":9991},{"edgeType":"contains","source":5981,"target":6070},{"edgeType":"contains","source":4132,"target":4199},{"edgeType":"contains","source":8230,"target":8231},{"edgeType":"contains","source":9106,"target":9614},{"edgeType":"contains","source":10377,"target":10378},{"edgeType":"imports","source":9852,"target":9875},{"edgeType":"contains","source":1,"target":133},{"edgeType":"contains","source":10608,"target":10616},{"edgeType":"imports","source":1511,"target":1021},{"edgeType":"contains","source":13117,"target":13172},{"edgeType":"contains","source":8790,"target":8840},{"edgeType":"imports","source":4131,"target":4361},{"edgeType":"contains","source":2350,"target":2361},{"edgeType":"calls","source":10844,"target":8427},{"edgeType":"contains","source":3175,"target":3212},{"edgeType":"contains","source":8111,"target":8747},{"edgeType":"contains","source":5981,"target":6071},{"edgeType":"contains","source":13843,"target":13920},{"edgeType":"contains","source":4132,"target":4198},{"edgeType":"contains","source":3440,"target":3452},{"edgeType":"contains","source":5587,"target":5601},{"edgeType":"contains","source":11202,"target":11229},{"edgeType":"contains","source":4304,"target":4151},{"edgeType":"contains","source":12491,"target":12494},{"edgeType":"contains","source":10377,"target":10379},{"edgeType":"imports","source":1511,"target":1020},{"edgeType":"calls","source":3006,"target":3007},{"edgeType":"contains","source":8790,"target":8839},{"edgeType":"contains","source":13117,"target":13171},{"edgeType":"imports","source":7629,"target":568},{"edgeType":"contains","source":9878,"target":9972},{"edgeType":"calls","source":4600,"target":4427},{"edgeType":"contains","source":907,"target":556},{"edgeType":"contains","source":2909,"target":2974},{"edgeType":"contains","source":2908,"target":3005},{"edgeType":"contains","source":6903,"target":7063},{"edgeType":"contains","source":5223,"target":5233},{"edgeType":"contains","source":7007,"target":7010},{"edgeType":"contains","source":1556,"target":1578},{"edgeType":"contains","source":1585,"target":1736},{"edgeType":"calls","source":2201,"target":575},{"edgeType":"contains","source":13117,"target":13154},{"edgeType":"calls","source":300,"target":311},{"edgeType":"contains","source":11108,"target":12010},{"edgeType":"imports","source":12892,"target":12938},{"edgeType":"calls","source":5523,"target":5411},{"edgeType":"contains","source":5981,"target":6048},{"edgeType":"contains","source":3902,"target":3903},{"edgeType":"contains","source":3899,"target":3996},{"edgeType":"contains","source":6903,"target":7062},{"edgeType":"contains","source":13579,"target":13630},{"edgeType":"contains","source":10301,"target":11658},{"edgeType":"contains","source":4591,"target":4741},{"edgeType":"contains","source":13843,"target":13902},{"edgeType":"contains","source":8031,"target":8035},{"edgeType":"contains","source":8394,"target":8409},{"edgeType":"contains","source":6411,"target":6460},{"edgeType":"contains","source":1585,"target":1737},{"edgeType":"calls","source":6000,"target":4365},{"edgeType":"contains","source":9878,"target":9973},{"edgeType":"contains","source":8590,"target":8674},{"edgeType":"contains","source":5746,"target":5934},{"edgeType":"contains","source":3152,"target":3898},{"edgeType":"contains","source":3899,"target":3994},{"edgeType":"contains","source":6903,"target":7064},{"edgeType":"contains","source":5223,"target":5232},{"edgeType":"calls","source":4403,"target":4191},{"edgeType":"contains","source":7785,"target":1918},{"edgeType":"contains","source":9106,"target":9591},{"edgeType":"contains","source":11108,"target":12011},{"edgeType":"contains","source":11074,"target":10951},{"edgeType":"contains","source":13117,"target":13153},{"edgeType":"contains","source":11532,"target":11551},{"edgeType":"contains","source":12254,"target":12423},{"edgeType":"contains","source":4001,"target":4004},{"edgeType":"contains","source":70,"target":76},{"edgeType":"contains","source":3899,"target":3995},{"edgeType":"contains","source":8762,"target":9684},{"edgeType":"imports","source":12355,"target":11617},{"edgeType":"calls","source":4731,"target":3537},{"edgeType":"imports","source":12077,"target":1205},{"edgeType":"contains","source":8031,"target":8034},{"edgeType":"calls","source":3042,"target":3045},{"edgeType":"contains","source":9878,"target":9974},{"edgeType":"calls","source":1327,"target":1241},{"edgeType":"contains","source":9106,"target":9594},{"edgeType":"contains","source":9878,"target":9970},{"edgeType":"contains","source":12155,"target":7034},{"edgeType":"imports","source":12554,"target":11791},{"edgeType":"calls","source":1721,"target":658},{"edgeType":"contains","source":5746,"target":5935},{"edgeType":"contains","source":8590,"target":8677},{"edgeType":"contains","source":9809,"target":9995},{"edgeType":"contains","source":13117,"target":13152},{"edgeType":"contains","source":3899,"target":3993},{"edgeType":"contains","source":3204,"target":3340},{"edgeType":"calls","source":1970,"target":1395},{"edgeType":"contains","source":5223,"target":5231},{"edgeType":"contains","source":6903,"target":7065},{"edgeType":"contains","source":7007,"target":7012},{"edgeType":"contains","source":1585,"target":1734},{"edgeType":"contains","source":5981,"target":6050},{"edgeType":"contains","source":4841,"target":5445},{"edgeType":"calls","source":764,"target":728},{"edgeType":"contains","source":13843,"target":13900},{"edgeType":"contains","source":8096,"target":737},{"edgeType":"contains","source":6276,"target":6418},{"edgeType":"contains","source":8031,"target":8037},{"edgeType":"calls","source":7872,"target":7646},{"edgeType":"calls","source":1121,"target":230},{"edgeType":"contains","source":9878,"target":9971},{"edgeType":"contains","source":3804,"target":3766},{"edgeType":"contains","source":8394,"target":8410},{"edgeType":"calls","source":4660,"target":4678},{"edgeType":"contains","source":7865,"target":7896},{"edgeType":"contains","source":5746,"target":5936},{"edgeType":"contains","source":907,"target":557},{"edgeType":"contains","source":7601,"target":7624},{"edgeType":"calls","source":7926,"target":687},{"edgeType":"contains","source":13117,"target":13151},{"edgeType":"contains","source":3899,"target":3992},{"edgeType":"contains","source":6908,"target":6911},{"edgeType":"contains","source":6903,"target":7066},{"edgeType":"calls","source":2018,"target":2020},{"edgeType":"calls","source":172,"target":52},{"edgeType":"contains","source":11196,"target":10338},{"edgeType":"contains","source":8762,"target":9686},{"edgeType":"contains","source":4841,"target":5444},{"edgeType":"imports","source":7520,"target":1887},{"edgeType":"contains","source":4001,"target":4002},{"edgeType":"contains","source":13579,"target":13627},{"edgeType":"contains","source":11697,"target":11719},{"edgeType":"contains","source":13843,"target":13899},{"edgeType":"contains","source":10301,"target":11657},{"edgeType":"contains","source":5818,"target":5819},{"edgeType":"calls","source":8819,"target":8942},{"edgeType":"contains","source":8031,"target":8036},{"edgeType":"contains","source":6078,"target":6215},{"edgeType":"contains","source":5883,"target":5910},{"edgeType":"calls","source":9913,"target":9913},{"edgeType":"contains","source":9809,"target":9993},{"edgeType":"contains","source":9878,"target":9968},{"edgeType":"contains","source":4758,"target":4854},{"edgeType":"contains","source":13117,"target":13150},{"edgeType":"calls","source":6115,"target":6082},{"edgeType":"contains","source":13579,"target":13626},{"edgeType":"contains","source":1287,"target":1465},{"edgeType":"contains","source":7436,"target":7448},{"edgeType":"contains","source":1887,"target":1892},{"edgeType":"contains","source":3869,"target":3873},{"edgeType":"calls","source":7538,"target":7430},{"edgeType":"contains","source":4758,"target":4853},{"edgeType":"calls","source":4899,"target":4668},{"edgeType":"imports","source":4639,"target":2409},{"edgeType":"contains","source":8064,"target":8065},{"edgeType":"contains","source":8358,"target":8464},{"edgeType":"imports","source":4131,"target":4416},{"edgeType":"contains","source":8762,"target":9681},{"edgeType":"contains","source":10301,"target":11654},{"edgeType":"contains","source":2909,"target":2979},{"edgeType":"contains","source":8590,"target":8670},{"edgeType":"contains","source":5746,"target":5930},{"edgeType":"contains","source":9809,"target":9994},{"edgeType":"imports","source":12538,"target":12282},{"edgeType":"contains","source":5883,"target":5911},{"edgeType":"contains","source":1585,"target":1741},{"edgeType":"contains","source":13579,"target":13625},{"edgeType":"contains","source":13117,"target":13149},{"edgeType":"contains","source":7436,"target":7449},{"edgeType":"contains","source":1144,"target":1668},{"edgeType":"contains","source":7601,"target":7618},{"edgeType":"contains","source":11334,"target":11343},{"edgeType":"contains","source":8956,"target":8951},{"edgeType":"contains","source":13093,"target":13892},{"edgeType":"contains","source":13117,"target":13148},{"edgeType":"imports","source":7469,"target":2413},{"edgeType":"contains","source":13843,"target":13897},{"edgeType":"contains","source":5981,"target":6045},{"edgeType":"imports","source":11983,"target":952},{"edgeType":"imports","source":4131,"target":4417},{"edgeType":"contains","source":8762,"target":9680},{"edgeType":"calls","source":1700,"target":1301},{"edgeType":"contains","source":10301,"target":11655},{"edgeType":"calls","source":1820,"target":1813},{"edgeType":"contains","source":5746,"target":5931},{"edgeType":"contains","source":1585,"target":1738},{"edgeType":"contains","source":8590,"target":8673},{"edgeType":"contains","source":8589,"target":8704},{"edgeType":"contains","source":5883,"target":5912},{"edgeType":"contains","source":7865,"target":7893},{"edgeType":"calls","source":1853,"target":1847},{"edgeType":"contains","source":4841,"target":5450},{"edgeType":"contains","source":7007,"target":7008},{"edgeType":"calls","source":12030,"target":5593},{"edgeType":"contains","source":13579,"target":13624},{"edgeType":"contains","source":9106,"target":9590},{"edgeType":"contains","source":5223,"target":5235},{"edgeType":"calls","source":764,"target":724},{"edgeType":"contains","source":4151,"target":414},{"edgeType":"contains","source":6078,"target":6210},{"edgeType":"contains","source":10301,"target":11652},{"edgeType":"contains","source":4591,"target":4743},{"edgeType":"contains","source":6903,"target":7060},{"edgeType":"contains","source":8790,"target":8815},{"edgeType":"contains","source":3869,"target":3871},{"edgeType":"contains","source":13117,"target":13147},{"edgeType":"calls","source":4937,"target":4545},{"edgeType":"contains","source":11108,"target":12003},{"edgeType":"contains","source":7071,"target":2909},{"edgeType":"calls","source":12822,"target":12753},{"edgeType":"contains","source":1,"target":108},{"edgeType":"contains","source":10145,"target":10146},{"edgeType":"contains","source":8031,"target":8033},{"edgeType":"contains","source":397,"target":516},{"edgeType":"contains","source":70,"target":83},{"edgeType":"contains","source":12259,"target":12263},{"edgeType":"contains","source":6411,"target":6457},{"edgeType":"calls","source":9186,"target":9196},{"edgeType":"contains","source":5746,"target":5932},{"edgeType":"contains","source":8590,"target":8672},{"edgeType":"contains","source":2845,"target":2847},{"edgeType":"calls","source":1923,"target":733},{"edgeType":"calls","source":1886,"target":1880},{"edgeType":"contains","source":5223,"target":5234},{"edgeType":"contains","source":11108,"target":12005},{"edgeType":"contains","source":13579,"target":13623},{"edgeType":"contains","source":7007,"target":7009},{"edgeType":"contains","source":9809,"target":9992},{"edgeType":"calls","source":7703,"target":7604},{"edgeType":"contains","source":1887,"target":1891},{"edgeType":"calls","source":10242,"target":10285},{"edgeType":"contains","source":11983,"target":2849},{"edgeType":"calls","source":742,"target":348},{"edgeType":"contains","source":13843,"target":13895},{"edgeType":"contains","source":3899,"target":3997},{"edgeType":"contains","source":8762,"target":9682},{"edgeType":"contains","source":8790,"target":8814},{"edgeType":"contains","source":3869,"target":3870},{"edgeType":"contains","source":13117,"target":13146},{"edgeType":"calls","source":3024,"target":2540},{"edgeType":"contains","source":6903,"target":7061},{"edgeType":"contains","source":3847,"target":3495},{"edgeType":"calls","source":1325,"target":1301},{"edgeType":"contains","source":8031,"target":8032},{"edgeType":"calls","source":8995,"target":8775},{"edgeType":"calls","source":3405,"target":3413},{"edgeType":"contains","source":12158,"target":12222},{"edgeType":"contains","source":70,"target":82},{"edgeType":"contains","source":10301,"target":11653},{"edgeType":"contains","source":4179,"target":4837},{"edgeType":"contains","source":8990,"target":8968},{"edgeType":"contains","source":10301,"target":11666},{"edgeType":"calls","source":1925,"target":1723},{"edgeType":"calls","source":11200,"target":11245},{"edgeType":"calls","source":11203,"target":11152},{"edgeType":"calls","source":3405,"target":3410},{"edgeType":"contains","source":13843,"target":13911},{"edgeType":"contains","source":1585,"target":1744},{"edgeType":"calls","source":12024,"target":2614},{"edgeType":"contains","source":13117,"target":13162},{"edgeType":"calls","source":6082,"target":6044},{"edgeType":"contains","source":11096,"target":11333},{"edgeType":"calls","source":398,"target":436},{"edgeType":"contains","source":12254,"target":12432},{"edgeType":"calls","source":2489,"target":2209},{"edgeType":"contains","source":12657,"target":12623},{"edgeType":"contains","source":8590,"target":8683},{"edgeType":"contains","source":2909,"target":2982},{"edgeType":"contains","source":5961,"target":4562},{"edgeType":"contains","source":5223,"target":5241},{"edgeType":"contains","source":10707,"target":10708},{"edgeType":"calls","source":1609,"target":948},{"edgeType":"contains","source":1218,"target":436},{"edgeType":"calls","source":5154,"target":5215},{"edgeType":"contains","source":10145,"target":10160},{"edgeType":"contains","source":3669,"target":3735},{"edgeType":"contains","source":3671,"target":3673},{"edgeType":"contains","source":6078,"target":6220},{"edgeType":"contains","source":4001,"target":4013},{"edgeType":"contains","source":1584,"target":1776},{"edgeType":"contains","source":9878,"target":9981},{"edgeType":"contains","source":70,"target":85},{"edgeType":"contains","source":11731,"target":11733},{"edgeType":"calls","source":4089,"target":3348},{"edgeType":"calls","source":8995,"target":8777},{"edgeType":"contains","source":13117,"target":13161},{"edgeType":"contains","source":6411,"target":6468},{"edgeType":"contains","source":9173,"target":9636},{"edgeType":"calls","source":4492,"target":4595},{"edgeType":"contains","source":8590,"target":8682},{"edgeType":"calls","source":2819,"target":436},{"edgeType":"contains","source":4841,"target":5455},{"edgeType":"contains","source":3175,"target":3193},{"edgeType":"contains","source":5252,"target":5398},{"edgeType":"contains","source":5223,"target":5240},{"edgeType":"calls","source":3036,"target":2166},{"edgeType":"contains","source":11532,"target":11559},{"edgeType":"contains","source":1585,"target":1746},{"edgeType":"contains","source":1584,"target":1777},{"edgeType":"calls","source":12365,"target":2614},{"edgeType":"contains","source":1688,"target":1724},{"edgeType":"contains","source":8096,"target":742},{"edgeType":"contains","source":9683,"target":9685},{"edgeType":"contains","source":4001,"target":4012},{"edgeType":"contains","source":70,"target":84},{"edgeType":"contains","source":13093,"target":13904},{"edgeType":"contains","source":13117,"target":13160},{"edgeType":"contains","source":2909,"target":2980},{"edgeType":"contains","source":2908,"target":3011},{"edgeType":"contains","source":13843,"target":13909},{"edgeType":"contains","source":4841,"target":5454},{"edgeType":"contains","source":10839,"target":10842},{"edgeType":"contains","source":6611,"target":6612},{"edgeType":"contains","source":8590,"target":8685},{"edgeType":"contains","source":3869,"target":3875},{"edgeType":"contains","source":6514,"target":6447},{"edgeType":"calls","source":12826,"target":12633},{"edgeType":"contains","source":9173,"target":9639},{"edgeType":"contains","source":10145,"target":10158},{"edgeType":"contains","source":397,"target":520},{"edgeType":"contains","source":9106,"target":9602},{"edgeType":"contains","source":9878,"target":9979},{"edgeType":"calls","source":12399,"target":2614},{"edgeType":"contains","source":7601,"target":1290},{"edgeType":"contains","source":5587,"target":5588},{"edgeType":"contains","source":13093,"target":13903},{"edgeType":"contains","source":13117,"target":13159},{"edgeType":"contains","source":1580,"target":1898},{"edgeType":"contains","source":1510,"target":1954},{"edgeType":"calls","source":11898,"target":11804},{"edgeType":"calls","source":4943,"target":4353},{"edgeType":"imports","source":8362,"target":1144},{"edgeType":"contains","source":4758,"target":4855},{"edgeType":"contains","source":4841,"target":5453},{"edgeType":"contains","source":6611,"target":6613},{"edgeType":"contains","source":2909,"target":2981},{"edgeType":"contains","source":8590,"target":8684},{"edgeType":"imports","source":4131,"target":4407},{"edgeType":"contains","source":3869,"target":3874},{"edgeType":"contains","source":10145,"target":10159},{"edgeType":"contains","source":12158,"target":12234},{"edgeType":"imports","source":6203,"target":2539},{"edgeType":"contains","source":10176,"target":10255},{"edgeType":"calls","source":6458,"target":6036},{"edgeType":"calls","source":2084,"target":2079},{"edgeType":"contains","source":9878,"target":9980},{"edgeType":"imports","source":12423,"target":11617},{"edgeType":"calls","source":1853,"target":1841},{"edgeType":"contains","source":4132,"target":4177},{"edgeType":"contains","source":5587,"target":5589},{"edgeType":"contains","source":13843,"target":13907},{"edgeType":"calls","source":1391,"target":1360},{"edgeType":"contains","source":7853,"target":1929},{"edgeType":"contains","source":13117,"target":13158},{"edgeType":"contains","source":4841,"target":5460},{"edgeType":"contains","source":7727,"target":7949},{"edgeType":"contains","source":5746,"target":5937},{"edgeType":"contains","source":11202,"target":11214},{"edgeType":"contains","source":7601,"target":7627},{"edgeType":"contains","source":8590,"target":8679},{"edgeType":"contains","source":2909,"target":2986},{"edgeType":"contains","source":2480,"target":2544},{"edgeType":"contains","source":4530,"target":4531},{"edgeType":"contains","source":6903,"target":7067},{"edgeType":"contains","source":10839,"target":10840},{"edgeType":"calls","source":9356,"target":9219},{"edgeType":"contains","source":8762,"target":9689},{"edgeType":"contains","source":10176,"target":10252},{"edgeType":"contains","source":12254,"target":12428},{"edgeType":"calls","source":2537,"target":717},{"edgeType":"contains","source":5818,"target":5820},{"edgeType":"calls","source":8069,"target":491},{"edgeType":"contains","source":8107,"target":398},{"edgeType":"contains","source":5746,"target":5938},{"edgeType":"contains","source":6078,"target":6216},{"edgeType":"contains","source":9809,"target":10002},{"edgeType":"calls","source":12331,"target":2614},{"edgeType":"calls","source":12337,"target":1371},{"edgeType":"imports","source":12538,"target":12273},{"edgeType":"contains","source":9848,"target":9850},{"edgeType":"contains","source":9878,"target":9977},{"edgeType":"contains","source":13843,"target":13906},{"edgeType":"contains","source":11096,"target":11330},{"edgeType":"contains","source":1,"target":113},{"edgeType":"contains","source":3439,"target":3468},{"edgeType":"contains","source":13117,"target":13157},{"edgeType":"calls","source":5519,"target":5522},{"edgeType":"calls","source":5435,"target":4955},{"edgeType":"contains","source":4179,"target":4840},{"edgeType":"contains","source":2909,"target":2987},{"edgeType":"imports","source":7520,"target":1881},{"edgeType":"contains","source":10904,"target":10940},{"edgeType":"contains","source":6903,"target":7068},{"edgeType":"contains","source":2480,"target":2545},{"edgeType":"contains","source":4758,"target":4861},{"edgeType":"contains","source":2515,"target":2517},{"edgeType":"contains","source":13579,"target":13633},{"edgeType":"contains","source":4474,"target":4151},{"edgeType":"calls","source":5187,"target":4187},{"edgeType":"contains","source":8762,"target":9688},{"edgeType":"calls","source":2249,"target":2247},{"edgeType":"contains","source":10176,"target":10253},{"edgeType":"contains","source":9878,"target":9978},{"edgeType":"contains","source":12147,"target":9402},{"edgeType":"contains","source":11674,"target":12438},{"edgeType":"contains","source":9848,"target":9851},{"edgeType":"contains","source":3638,"target":3642},{"edgeType":"contains","source":7001,"target":7202},{"edgeType":"contains","source":9106,"target":9598},{"edgeType":"contains","source":1287,"target":1471},{"edgeType":"contains","source":4268,"target":4194},{"edgeType":"contains","source":8590,"target":8681},{"edgeType":"calls","source":3041,"target":3060},{"edgeType":"contains","source":4758,"target":4860},{"edgeType":"contains","source":10904,"target":10937},{"edgeType":"contains","source":13117,"target":13156},{"edgeType":"contains","source":2909,"target":2984},{"edgeType":"contains","source":6903,"target":7069},{"edgeType":"calls","source":297,"target":394},{"edgeType":"contains","source":13579,"target":13632},{"edgeType":"contains","source":1,"target":8572},{"edgeType":"contains","source":11547,"target":12144},{"edgeType":"contains","source":5223,"target":5243},{"edgeType":"contains","source":11532,"target":11552},{"edgeType":"contains","source":1585,"target":1747},{"edgeType":"contains","source":1584,"target":1778},{"edgeType":"contains","source":10301,"target":11660},{"edgeType":"contains","source":4001,"target":4015},{"edgeType":"calls","source":2209,"target":313},{"edgeType":"calls","source":2227,"target":812},{"edgeType":"contains","source":9878,"target":9975},{"edgeType":"contains","source":5818,"target":5822},{"edgeType":"calls","source":6087,"target":5882},{"edgeType":"imports","source":12554,"target":11779},{"edgeType":"calls","source":3491,"target":1796},{"edgeType":"contains","source":4841,"target":5457},{"edgeType":"contains","source":8361,"target":8380},{"edgeType":"contains","source":9809,"target":10000},{"edgeType":"contains","source":10301,"target":11661},{"edgeType":"contains","source":2909,"target":2985},{"edgeType":"contains","source":13117,"target":13155},{"edgeType":"calls","source":1029,"target":956},{"edgeType":"contains","source":13579,"target":13631},{"edgeType":"contains","source":4591,"target":4750},{"edgeType":"calls","source":12792,"target":12633},{"edgeType":"contains","source":4001,"target":4014},{"edgeType":"contains","source":1585,"target":1748},{"edgeType":"contains","source":6078,"target":6219},{"edgeType":"contains","source":11697,"target":11723},{"edgeType":"contains","source":9848,"target":9849},{"edgeType":"contains","source":5686,"target":5687},{"edgeType":"contains","source":7841,"target":4417},{"edgeType":"contains","source":9809,"target":10001},{"edgeType":"contains","source":9878,"target":9976},{"edgeType":"calls","source":6089,"target":5819},{"edgeType":"calls","source":6082,"target":6036},{"edgeType":"contains","source":8096,"target":740},{"edgeType":"contains","source":6043,"target":6223},{"edgeType":"contains","source":8790,"target":8801},{"edgeType":"contains","source":13579,"target":13614},{"edgeType":"calls","source":5034,"target":4731},{"edgeType":"contains","source":10301,"target":11641},{"edgeType":"calls","source":2999,"target":1222},{"edgeType":"contains","source":2244,"target":2431},{"edgeType":"contains","source":13843,"target":13886},{"edgeType":"contains","source":400,"target":401},{"edgeType":"imports","source":8062,"target":6209},{"edgeType":"contains","source":8358,"target":8451},{"edgeType":"contains","source":895,"target":911},{"edgeType":"contains","source":8559,"target":8563},{"edgeType":"contains","source":7862,"target":7972},{"edgeType":"contains","source":8590,"target":8659},{"edgeType":"contains","source":12523,"target":12525},{"edgeType":"calls","source":2378,"target":390},{"edgeType":"contains","source":3571,"target":3577},{"edgeType":"contains","source":5520,"target":5524},{"edgeType":"contains","source":12787,"target":12797},{"edgeType":"contains","source":11108,"target":11993},{"edgeType":"contains","source":13117,"target":13137},{"edgeType":"contains","source":7436,"target":7437},{"edgeType":"contains","source":7435,"target":7468},{"edgeType":"calls","source":8543,"target":568},{"edgeType":"contains","source":13579,"target":13613},{"edgeType":"contains","source":8790,"target":8800},{"edgeType":"calls","source":12321,"target":11353},{"edgeType":"calls","source":12290,"target":12314},{"edgeType":"calls","source":4694,"target":4700},{"edgeType":"contains","source":13843,"target":13885},{"edgeType":"contains","source":895,"target":910},{"edgeType":"contains","source":2244,"target":2432},{"edgeType":"contains","source":4496,"target":4498},{"edgeType":"calls","source":3108,"target":3129},{"edgeType":"contains","source":5718,"target":5729},{"edgeType":"contains","source":10508,"target":10511},{"edgeType":"contains","source":10473,"target":10539},{"edgeType":"contains","source":8590,"target":8658},{"edgeType":"contains","source":8592,"target":8596},{"edgeType":"contains","source":7700,"target":7708},{"edgeType":"contains","source":7862,"target":7971},{"edgeType":"contains","source":7865,"target":7878},{"edgeType":"contains","source":12554,"target":12620},{"edgeType":"contains","source":2909,"target":2958},{"edgeType":"contains","source":5746,"target":5918},{"edgeType":"imports","source":8500,"target":8488},{"edgeType":"contains","source":13093,"target":13880},{"edgeType":"contains","source":13117,"target":13136},{"edgeType":"contains","source":5520,"target":5525},{"edgeType":"calls","source":9980,"target":9928},{"edgeType":"contains","source":3439,"target":3440},{"edgeType":"contains","source":11108,"target":11994},{"edgeType":"contains","source":4758,"target":4831},{"edgeType":"contains","source":13579,"target":13612},{"edgeType":"contains","source":1218,"target":1467},{"edgeType":"contains","source":2909,"target":2955},{"edgeType":"contains","source":2244,"target":2429},{"edgeType":"contains","source":13843,"target":13884},{"edgeType":"contains","source":2481,"target":2482},{"edgeType":"contains","source":2480,"target":2513},{"edgeType":"calls","source":1761,"target":491},{"edgeType":"contains","source":8394,"target":8395},{"edgeType":"calls","source":466,"target":469},{"edgeType":"imports","source":12436,"target":12262},{"edgeType":"contains","source":899,"target":789},{"edgeType":"contains","source":5746,"target":5919},{"edgeType":"contains","source":7601,"target":7609},{"edgeType":"contains","source":8590,"target":8661},{"edgeType":"contains","source":3571,"target":3575},{"edgeType":"contains","source":5520,"target":5526},{"edgeType":"contains","source":13117,"target":13135},{"edgeType":"contains","source":11108,"target":11991},{"edgeType":"imports","source":1434,"target":266},{"edgeType":"calls","source":1985,"target":2003},{"edgeType":"calls","source":2366,"target":1817},{"edgeType":"calls","source":2344,"target":385},{"edgeType":"contains","source":11334,"target":11327},{"edgeType":"contains","source":8762,"target":9670},{"edgeType":"contains","source":8790,"target":8802},{"edgeType":"contains","source":5981,"target":6034},{"edgeType":"contains","source":11532,"target":11533},{"edgeType":"contains","source":13579,"target":13611},{"edgeType":"contains","source":1,"target":86},{"edgeType":"contains","source":11697,"target":11703},{"edgeType":"calls","source":12589,"target":12556},{"edgeType":"contains","source":2244,"target":2430},{"edgeType":"calls","source":6609,"target":6615},{"edgeType":"calls","source":11191,"target":3042},{"edgeType":"calls","source":3076,"target":3062},{"edgeType":"contains","source":10301,"target":11640},{"edgeType":"contains","source":4562,"target":4564},{"edgeType":"contains","source":7072,"target":7095},{"edgeType":"contains","source":12623,"target":12593},{"edgeType":"calls","source":2415,"target":2413},{"edgeType":"calls","source":4609,"target":4162},{"edgeType":"calls","source":433,"target":434},{"edgeType":"contains","source":5746,"target":5920},{"edgeType":"contains","source":891,"target":2093},{"edgeType":"contains","source":8590,"target":8660},{"edgeType":"calls","source":11564,"target":11563},{"edgeType":"contains","source":3899,"target":3976},{"edgeType":"contains","source":13117,"target":13134},{"edgeType":"contains","source":11108,"target":11992},{"edgeType":"contains","source":9106,"target":9576},{"edgeType":"calls","source":3539,"target":3505},{"edgeType":"contains","source":4562,"target":4571},{"edgeType":"contains","source":6078,"target":6191},{"edgeType":"contains","source":13843,"target":13882},{"edgeType":"contains","source":12524,"target":11432},{"edgeType":"calls","source":12822,"target":12738},{"edgeType":"contains","source":1,"target":10660},{"edgeType":"contains","source":2244,"target":2435},{"edgeType":"calls","source":1457,"target":1453},{"edgeType":"contains","source":2244,"target":2436},{"edgeType":"contains","source":1,"target":7488},{"edgeType":"contains","source":8590,"target":8655},{"edgeType":"contains","source":8592,"target":8593},{"edgeType":"calls","source":11929,"target":11880},{"edgeType":"calls","source":8426,"target":8427},{"edgeType":"calls","source":4694,"target":4697},{"edgeType":"contains","source":12787,"target":12793},{"edgeType":"calls","source":7270,"target":7266},{"edgeType":"contains","source":7700,"target":7705},{"edgeType":"contains","source":11108,"target":11989},{"edgeType":"contains","source":13117,"target":13133},{"edgeType":"contains","source":5746,"target":5913},{"edgeType":"contains","source":7601,"target":7603},{"edgeType":"calls","source":7963,"target":7980},{"edgeType":"contains","source":6078,"target":6192},{"edgeType":"contains","source":13117,"target":13132},{"edgeType":"contains","source":4562,"target":4570},{"edgeType":"calls","source":5053,"target":4137},{"edgeType":"imports","source":9488,"target":1119},{"edgeType":"calls","source":5864,"target":4365},{"edgeType":"contains","source":2448,"target":2455},{"edgeType":"contains","source":301,"target":302},{"edgeType":"contains","source":10301,"target":11638},{"edgeType":"contains","source":8590,"target":8653},{"edgeType":"calls","source":6449,"target":6292},{"edgeType":"contains","source":8590,"target":8654},{"edgeType":"contains","source":2244,"target":2437},{"edgeType":"contains","source":1,"target":8544},{"edgeType":"contains","source":12655,"target":12656},{"edgeType":"calls","source":1130,"target":1018},{"edgeType":"contains","source":7071,"target":7120},{"edgeType":"contains","source":5981,"target":6028},{"edgeType":"calls","source":7668,"target":7613},{"edgeType":"imports","source":9488,"target":1118},{"edgeType":"calls","source":2785,"target":454},{"edgeType":"contains","source":13579,"target":13608},{"edgeType":"imports","source":8500,"target":8492},{"edgeType":"contains","source":11108,"target":11990},{"edgeType":"contains","source":5520,"target":5521},{"edgeType":"calls","source":802,"target":619},{"edgeType":"imports","source":9,"target":40},{"edgeType":"contains","source":10301,"target":11635},{"edgeType":"contains","source":8762,"target":9667},{"edgeType":"contains","source":13117,"target":13131},{"edgeType":"contains","source":11108,"target":11987},{"edgeType":"contains","source":6305,"target":6555},{"edgeType":"contains","source":12554,"target":12614},{"edgeType":"contains","source":10176,"target":10225},{"edgeType":"calls","source":3830,"target":2938},{"edgeType":"contains","source":2244,"target":2433},{"edgeType":"imports","source":8031,"target":1887},{"edgeType":"contains","source":9252,"target":9275},{"edgeType":"contains","source":1585,"target":1722},{"edgeType":"contains","source":8590,"target":8657},{"edgeType":"contains","source":8592,"target":8595},{"edgeType":"imports","source":8500,"target":8489},{"edgeType":"calls","source":11167,"target":11189},{"edgeType":"contains","source":7865,"target":7877},{"edgeType":"contains","source":4841,"target":5433},{"edgeType":"contains","source":7470,"target":7436},{"edgeType":"imports","source":12892,"target":12921},{"edgeType":"contains","source":10301,"target":11636},{"edgeType":"contains","source":5981,"target":6030},{"edgeType":"contains","source":13117,"target":13130},{"edgeType":"calls","source":980,"target":385},{"edgeType":"contains","source":6305,"target":6556},{"edgeType":"contains","source":12919,"target":12926},{"edgeType":"calls","source":5435,"target":4978},{"edgeType":"contains","source":2244,"target":2434},{"edgeType":"contains","source":10547,"target":10352},{"edgeType":"contains","source":12554,"target":12613},{"edgeType":"contains","source":1585,"target":1723},{"edgeType":"contains","source":7865,"target":7876},{"edgeType":"contains","source":8590,"target":8656},{"edgeType":"contains","source":2906,"target":3053},{"edgeType":"contains","source":7341,"target":7208},{"edgeType":"calls","source":10147,"target":7928},{"edgeType":"contains","source":11108,"target":11988},{"edgeType":"contains","source":9106,"target":9572},{"edgeType":"calls","source":4767,"target":4545},{"edgeType":"contains","source":7694,"target":7892},{"edgeType":"contains","source":7601,"target":7604},{"edgeType":"contains","source":11595,"target":11689},{"edgeType":"contains","source":5520,"target":5523},{"edgeType":"calls","source":7698,"target":1400},{"edgeType":"contains","source":5223,"target":5225},{"edgeType":"contains","source":3152,"target":3889},{"edgeType":"imports","source":6912,"target":6968},{"edgeType":"contains","source":11367,"target":11372},{"edgeType":"contains","source":3703,"target":3721},{"edgeType":"contains","source":5746,"target":5925},{"edgeType":"contains","source":7469,"target":7478},{"edgeType":"imports","source":10514,"target":10524},{"edgeType":"contains","source":12178,"target":3144},{"edgeType":"imports","source":4506,"target":1218},{"edgeType":"contains","source":7436,"target":7444},{"edgeType":"calls","source":12093,"target":12086},{"edgeType":"calls","source":12463,"target":12243},{"edgeType":"calls","source":10540,"target":10548},{"edgeType":"calls","source":12366,"target":12079},{"edgeType":"contains","source":13579,"target":13622},{"edgeType":"contains","source":10301,"target":11650},{"edgeType":"contains","source":136,"target":137},{"edgeType":"contains","source":2244,"target":2440},{"edgeType":"contains","source":3608,"target":3495},{"edgeType":"contains","source":4298,"target":4303},{"edgeType":"contains","source":8358,"target":8460},{"edgeType":"calls","source":12093,"target":2572},{"edgeType":"imports","source":2350,"target":420},{"edgeType":"contains","source":13117,"target":13145},{"edgeType":"contains","source":7356,"target":410},{"edgeType":"contains","source":10473,"target":10546},{"edgeType":"imports","source":8078,"target":420},{"edgeType":"contains","source":8559,"target":8571},{"edgeType":"contains","source":8592,"target":8605},{"edgeType":"contains","source":4841,"target":5439},{"edgeType":"calls","source":700,"target":604},{"edgeType":"contains","source":11367,"target":11373},{"edgeType":"contains","source":5223,"target":5224},{"edgeType":"calls","source":8789,"target":8804},{"edgeType":"imports","source":12538,"target":12261},{"edgeType":"contains","source":3703,"target":3720},{"edgeType":"contains","source":12178,"target":3143},{"edgeType":"contains","source":5981,"target":6040},{"edgeType":"contains","source":7700,"target":7716},{"edgeType":"imports","source":12298,"target":12302},{"edgeType":"imports","source":12280,"target":11803},{"edgeType":"imports","source":12574,"target":10088},{"edgeType":"contains","source":13579,"target":13621},{"edgeType":"contains","source":5746,"target":5926},{"edgeType":"contains","source":13117,"target":13144},{"edgeType":"contains","source":13843,"target":13893},{"edgeType":"contains","source":10301,"target":11651},{"edgeType":"contains","source":11108,"target":12002},{"edgeType":"calls","source":4935,"target":4620},{"edgeType":"contains","source":8559,"target":8570},{"edgeType":"contains","source":2908,"target":2997},{"edgeType":"contains","source":8762,"target":9676},{"edgeType":"calls","source":3024,"target":2551},{"edgeType":"contains","source":11367,"target":11370},{"edgeType":"imports","source":13797,"target":9173},{"edgeType":"imports","source":4131,"target":4389},{"edgeType":"contains","source":4496,"target":4505},{"edgeType":"contains","source":9878,"target":9962},{"edgeType":"contains","source":11595,"target":11701},{"edgeType":"contains","source":7469,"target":7480},{"edgeType":"contains","source":7436,"target":7446},{"edgeType":"contains","source":2269,"target":2720},{"edgeType":"contains","source":13579,"target":13620},{"edgeType":"calls","source":3910,"target":454},{"edgeType":"contains","source":9809,"target":9987},{"edgeType":"contains","source":70,"target":71},{"edgeType":"contains","source":13117,"target":13143},{"edgeType":"contains","source":2244,"target":2438},{"edgeType":"contains","source":4265,"target":4267},{"edgeType":"contains","source":136,"target":139},{"edgeType":"calls","source":4136,"target":4018},{"edgeType":"calls","source":11329,"target":3000},{"edgeType":"calls","source":2479,"target":2534},{"edgeType":"calls","source":700,"target":606},{"edgeType":"contains","source":547,"target":1139},{"edgeType":"contains","source":12861,"target":12623},{"edgeType":"contains","source":8590,"target":8669},{"edgeType":"contains","source":8592,"target":8607},{"edgeType":"contains","source":11334,"target":11337},{"edgeType":"contains","source":4562,"target":4572},{"edgeType":"contains","source":1,"target":8551},{"edgeType":"contains","source":9878,"target":9963},{"edgeType":"imports","source":12423,"target":3144},{"edgeType":"contains","source":7436,"target":7447},{"edgeType":"contains","source":2269,"target":2721},{"edgeType":"contains","source":7865,"target":7888},{"edgeType":"contains","source":5746,"target":5928},{"edgeType":"contains","source":7469,"target":7481},{"edgeType":"contains","source":7629,"target":7805},{"edgeType":"contains","source":1,"target":94},{"edgeType":"contains","source":11697,"target":11711},{"edgeType":"imports","source":12279,"target":11836},{"edgeType":"contains","source":4265,"target":4266},{"edgeType":"contains","source":7601,"target":7616},{"edgeType":"contains","source":13843,"target":13891},{"edgeType":"contains","source":10301,"target":11649},{"edgeType":"contains","source":136,"target":138},{"edgeType":"contains","source":13117,"target":13142},{"edgeType":"contains","source":4298,"target":4300},{"edgeType":"contains","source":1585,"target":1727},{"edgeType":"contains","source":3703,"target":3718},{"edgeType":"contains","source":1556,"target":1569},{"edgeType":"contains","source":634,"target":555},{"edgeType":"contains","source":8762,"target":9678},{"edgeType":"contains","source":13018,"target":13040},{"edgeType":"calls","source":763,"target":766},{"edgeType":"calls","source":11440,"target":11192},{"edgeType":"contains","source":8762,"target":9673},{"edgeType":"contains","source":13579,"target":13618},{"edgeType":"contains","source":7865,"target":7883},{"edgeType":"calls","source":8162,"target":8162},{"edgeType":"contains","source":10324,"target":9875},{"edgeType":"calls","source":1821,"target":1788},{"edgeType":"contains","source":10246,"target":10179},{"edgeType":"contains","source":3899,"target":3991},{"edgeType":"calls","source":5554,"target":5512},{"edgeType":"calls","source":12319,"target":2970},{"edgeType":"contains","source":9809,"target":9985},{"edgeType":"contains","source":13843,"target":13890},{"edgeType":"contains","source":8394,"target":8397},{"edgeType":"contains","source":11108,"target":11997},{"edgeType":"contains","source":70,"target":73},{"edgeType":"contains","source":1,"target":98},{"edgeType":"calls","source":6087,"target":5901},{"edgeType":"contains","source":13117,"target":13141},{"edgeType":"contains","source":5746,"target":5921},{"edgeType":"contains","source":136,"target":141},{"edgeType":"contains","source":4157,"target":4450},{"edgeType":"contains","source":4133,"target":4137},{"edgeType":"contains","source":13018,"target":13039},{"edgeType":"contains","source":8589,"target":8694},{"edgeType":"contains","source":4758,"target":4845},{"edgeType":"calls","source":7204,"target":7206},{"edgeType":"contains","source":7072,"target":7096},{"edgeType":"contains","source":13579,"target":13617},{"edgeType":"contains","source":4438,"target":4194},{"edgeType":"contains","source":7436,"target":7441},{"edgeType":"contains","source":3204,"target":3339},{"edgeType":"contains","source":5223,"target":5228},{"edgeType":"contains","source":11334,"target":11335},{"edgeType":"calls","source":1853,"target":1852},{"edgeType":"contains","source":5746,"target":5922},{"edgeType":"contains","source":9809,"target":9986},{"edgeType":"contains","source":1585,"target":1733},{"edgeType":"contains","source":13843,"target":13889},{"edgeType":"calls","source":10242,"target":10275},{"edgeType":"calls","source":9054,"target":9050},{"edgeType":"contains","source":4841,"target":5442},{"edgeType":"contains","source":7700,"target":7712},{"edgeType":"contains","source":8394,"target":8396},{"edgeType":"contains","source":8361,"target":8362},{"edgeType":"contains","source":11108,"target":11998},{"edgeType":"contains","source":136,"target":140},{"edgeType":"imports","source":7908,"target":7809},{"edgeType":"calls","source":3491,"target":1814},{"edgeType":"contains","source":4157,"target":4449},{"edgeType":"contains","source":10301,"target":11647},{"edgeType":"contains","source":8592,"target":8600},{"edgeType":"contains","source":2908,"target":3001},{"edgeType":"contains","source":12787,"target":12800},{"edgeType":"contains","source":7072,"target":7097},{"edgeType":"imports","source":12436,"target":12249},{"edgeType":"calls","source":298,"target":379},{"edgeType":"contains","source":2448,"target":2460},{"edgeType":"calls","source":5886,"target":4731},{"edgeType":"contains","source":13579,"target":13616},{"edgeType":"imports","source":4131,"target":4393},{"edgeType":"calls","source":4560,"target":4612},{"edgeType":"contains","source":3204,"target":3336},{"edgeType":"contains","source":5746,"target":5923},{"edgeType":"calls","source":10576,"target":10491},{"edgeType":"calls","source":6456,"target":6084},{"edgeType":"contains","source":10301,"target":11643},{"edgeType":"calls","source":8247,"target":1301},{"edgeType":"contains","source":13843,"target":13888},{"edgeType":"imports","source":10237,"target":1144},{"edgeType":"contains","source":7700,"target":7715},{"edgeType":"contains","source":9809,"target":9983},{"edgeType":"contains","source":70,"target":75},{"edgeType":"contains","source":2244,"target":2442},{"edgeType":"calls","source":5639,"target":1817},{"edgeType":"contains","source":12457,"target":12459},{"edgeType":"contains","source":8559,"target":8569},{"edgeType":"calls","source":3342,"target":3259},{"edgeType":"calls","source":700,"target":602},{"edgeType":"contains","source":8762,"target":9675},{"edgeType":"contains","source":13117,"target":13139},{"edgeType":"calls","source":944,"target":437},{"edgeType":"contains","source":11108,"target":11995},{"edgeType":"contains","source":13579,"target":13615},{"edgeType":"imports","source":11983,"target":6211},{"edgeType":"contains","source":7436,"target":7443},{"edgeType":"contains","source":2269,"target":2725},{"edgeType":"contains","source":11422,"target":11776},{"edgeType":"contains","source":5746,"target":5924},{"edgeType":"contains","source":11697,"target":11707},{"edgeType":"contains","source":9878,"target":9959},{"edgeType":"contains","source":5981,"target":6038},{"edgeType":"imports","source":2345,"target":568},{"edgeType":"calls","source":5519,"target":5536},{"edgeType":"contains","source":6276,"target":6407},{"edgeType":"contains","source":4157,"target":4447},{"edgeType":"contains","source":11108,"target":11996},{"edgeType":"calls","source":3356,"target":2826},{"edgeType":"contains","source":7601,"target":7612},{"edgeType":"contains","source":70,"target":74},{"edgeType":"contains","source":10301,"target":11645},{"edgeType":"contains","source":12618,"target":12752},{"edgeType":"contains","source":2244,"target":2443},{"edgeType":"contains","source":10439,"target":10538},{"edgeType":"calls","source":5494,"target":1026},{"edgeType":"contains","source":907,"target":552},{"edgeType":"calls","source":2619,"target":1362},{"edgeType":"contains","source":8559,"target":8568},{"edgeType":"contains","source":8590,"target":8664},{"edgeType":"calls","source":730,"target":728},{"edgeType":"contains","source":4841,"target":5440},{"edgeType":"calls","source":12036,"target":11714},{"edgeType":"calls","source":1160,"target":1101},{"edgeType":"contains","source":5155,"target":5194},{"edgeType":"contains","source":8590,"target":8642},{"edgeType":"contains","source":8591,"target":8611},{"edgeType":"calls","source":1819,"target":1813},{"edgeType":"calls","source":2050,"target":2051},{"edgeType":"contains","source":3497,"target":3740},{"edgeType":"contains","source":11266,"target":11307},{"edgeType":"contains","source":13093,"target":13865},{"edgeType":"contains","source":13117,"target":13121},{"edgeType":"calls","source":1562,"target":266},{"edgeType":"contains","source":1218,"target":1453},{"edgeType":"contains","source":4841,"target":5414},{"edgeType":"contains","source":13579,"target":13597},{"edgeType":"contains","source":7036,"target":2906},{"edgeType":"contains","source":12423,"target":12437},{"edgeType":"contains","source":10440,"target":10487},{"edgeType":"contains","source":8063,"target":8067},{"edgeType":"contains","source":8228,"target":8237},{"edgeType":"contains","source":6312,"target":6324},{"edgeType":"contains","source":8358,"target":8435},{"edgeType":"contains","source":5746,"target":5901},{"edgeType":"contains","source":1007,"target":1650},{"edgeType":"contains","source":5155,"target":5193},{"edgeType":"contains","source":10440,"target":10488},{"edgeType":"contains","source":6903,"target":7031},{"edgeType":"imports","source":11616,"target":2845},{"edgeType":"contains","source":5252,"target":5357},{"edgeType":"contains","source":1585,"target":1704},{"edgeType":"contains","source":11266,"target":11308},{"edgeType":"contains","source":13053,"target":12990},{"edgeType":"contains","source":9252,"target":9260},{"edgeType":"contains","source":1,"target":68},{"edgeType":"contains","source":7435,"target":7451},{"edgeType":"calls","source":11910,"target":2936},{"edgeType":"contains","source":4841,"target":5413},{"edgeType":"contains","source":13579,"target":13596},{"edgeType":"imports","source":2787,"target":2768},{"edgeType":"calls","source":1291,"target":1267},{"edgeType":"contains","source":590,"target":835},{"edgeType":"contains","source":547,"target":1111},{"edgeType":"contains","source":8228,"target":8236},{"edgeType":"contains","source":10238,"target":10408},{"edgeType":"calls","source":3113,"target":2925},{"edgeType":"contains","source":5155,"target":5192},{"edgeType":"contains","source":12289,"target":2847},{"edgeType":"contains","source":1007,"target":1653},{"edgeType":"contains","source":2269,"target":2695},{"edgeType":"calls","source":1723,"target":1620},{"edgeType":"contains","source":895,"target":897},{"edgeType":"contains","source":8590,"target":8644},{"edgeType":"contains","source":8591,"target":8613},{"edgeType":"calls","source":11884,"target":568},{"edgeType":"contains","source":11439,"target":11227},{"edgeType":"contains","source":13093,"target":13863},{"edgeType":"contains","source":3669,"target":3691},{"edgeType":"contains","source":3497,"target":3738},{"edgeType":"imports","source":12574,"target":12261},{"edgeType":"calls","source":2366,"target":710},{"edgeType":"contains","source":11644,"target":11214},{"edgeType":"contains","source":6078,"target":6181},{"edgeType":"contains","source":8762,"target":9654},{"edgeType":"calls","source":12390,"target":12365},{"edgeType":"contains","source":13579,"target":13595},{"edgeType":"contains","source":6643,"target":6635},{"edgeType":"contains","source":4329,"target":4372},{"edgeType":"contains","source":10037,"target":10294},{"edgeType":"calls","source":1126,"target":1100},{"edgeType":"contains","source":5155,"target":5191},{"edgeType":"contains","source":9878,"target":9938},{"edgeType":"calls","source":11683,"target":2572},{"edgeType":"contains","source":12617,"target":12762},{"edgeType":"contains","source":895,"target":896},{"edgeType":"contains","source":13117,"target":13118},{"edgeType":"contains","source":13579,"target":13594},{"edgeType":"contains","source":9252,"target":9262},{"edgeType":"contains","source":11266,"target":11306},{"edgeType":"contains","source":7434,"target":7484},{"edgeType":"contains","source":6607,"target":6695},{"edgeType":"contains","source":8762,"target":9653},{"edgeType":"contains","source":1,"target":70},{"edgeType":"imports","source":4131,"target":4448},{"edgeType":"contains","source":10440,"target":10486},{"edgeType":"calls","source":11278,"target":9842},{"edgeType":"contains","source":10473,"target":10520},{"edgeType":"contains","source":8063,"target":8068},{"edgeType":"contains","source":8358,"target":8436},{"edgeType":"contains","source":10238,"target":10406},{"edgeType":"contains","source":8590,"target":8638},{"edgeType":"calls","source":1884,"target":1908},{"edgeType":"contains","source":9252,"target":9257},{"edgeType":"imports","source":885,"target":2533},{"edgeType":"contains","source":3669,"target":3697},{"edgeType":"contains","source":7727,"target":7908},{"edgeType":"calls","source":7883,"target":1988},{"edgeType":"contains","source":3408,"target":3332},{"edgeType":"contains","source":4841,"target":5419},{"edgeType":"contains","source":13579,"target":13593},{"edgeType":"contains","source":11165,"target":11263},{"edgeType":"contains","source":11168,"target":11170},{"edgeType":"contains","source":13093,"target":13861},{"edgeType":"calls","source":431,"target":441},{"edgeType":"contains","source":3201,"target":3406},{"edgeType":"contains","source":5089,"target":5130},{"edgeType":"imports","source":1434,"target":313},{"edgeType":"calls","source":2513,"target":2493},{"edgeType":"contains","source":5155,"target":5198},{"edgeType":"contains","source":11432,"target":11442},{"edgeType":"contains","source":1218,"target":1457},{"edgeType":"calls","source":7500,"target":7518},{"edgeType":"calls","source":12321,"target":11339},{"edgeType":"contains","source":3831,"target":3961},{"edgeType":"contains","source":6312,"target":6320},{"edgeType":"contains","source":8678,"target":9081},{"edgeType":"contains","source":2244,"target":2419},{"edgeType":"contains","source":6607,"target":6688},{"edgeType":"contains","source":10473,"target":10517},{"edgeType":"contains","source":10440,"target":10483},{"edgeType":"contains","source":12355,"target":12427},{"edgeType":"contains","source":2244,"target":2420},{"edgeType":"contains","source":1585,"target":1708},{"edgeType":"calls","source":7871,"target":7646},{"edgeType":"contains","source":9252,"target":9256},{"edgeType":"contains","source":2909,"target":2946},{"edgeType":"contains","source":10698,"target":10942},{"edgeType":"imports","source":885,"target":420},{"edgeType":"contains","source":895,"target":898},{"edgeType":"contains","source":4841,"target":5418},{"edgeType":"contains","source":13579,"target":13592},{"edgeType":"contains","source":11165,"target":11264},{"edgeType":"calls","source":4811,"target":4190},{"edgeType":"calls","source":4777,"target":4187},{"edgeType":"contains","source":5746,"target":5897},{"edgeType":"contains","source":5155,"target":5197},{"edgeType":"contains","source":3201,"target":3407},{"edgeType":"contains","source":12355,"target":12426},{"edgeType":"imports","source":12298,"target":12356},{"edgeType":"contains","source":1805,"target":2288},{"edgeType":"contains","source":11762,"target":11783},{"edgeType":"imports","source":11616,"target":2849},{"edgeType":"contains","source":13018,"target":13013},{"edgeType":"contains","source":10440,"target":10484},{"edgeType":"calls","source":5152,"target":4190},{"edgeType":"contains","source":6312,"target":6321},{"edgeType":"calls","source":5421,"target":5364},{"edgeType":"calls","source":6708,"target":6703},{"edgeType":"contains","source":8676,"target":9142},{"edgeType":"contains","source":8590,"target":8637},{"edgeType":"calls","source":1158,"target":1161},{"edgeType":"contains","source":2269,"target":2699},{"edgeType":"contains","source":9252,"target":9259},{"edgeType":"calls","source":1125,"target":1127},{"edgeType":"contains","source":895,"target":901},{"edgeType":"contains","source":8590,"target":8640},{"edgeType":"contains","source":3769,"target":3766},{"edgeType":"calls","source":1821,"target":692},{"edgeType":"contains","source":12158,"target":12189},{"edgeType":"contains","source":10377,"target":2920},{"edgeType":"contains","source":3497,"target":3742},{"edgeType":"contains","source":4841,"target":5417},{"edgeType":"contains","source":5981,"target":6012},{"edgeType":"contains","source":13579,"target":13591},{"edgeType":"contains","source":9106,"target":9557},{"edgeType":"contains","source":1144,"target":581},{"edgeType":"contains","source":5155,"target":5196},{"edgeType":"contains","source":5252,"target":5360},{"edgeType":"contains","source":12355,"target":12425},{"edgeType":"contains","source":1218,"target":1455},{"edgeType":"contains","source":11762,"target":11780},{"edgeType":"contains","source":3899,"target":3965},{"edgeType":"contains","source":4841,"target":5416},{"edgeType":"contains","source":6312,"target":6322},{"edgeType":"contains","source":8358,"target":8433},{"edgeType":"contains","source":8704,"target":9334},{"edgeType":"calls","source":10735,"target":1312},{"edgeType":"contains","source":6411,"target":6424},{"edgeType":"contains","source":12456,"target":12465},{"edgeType":"contains","source":4329,"target":4376},{"edgeType":"contains","source":9252,"target":9258},{"edgeType":"contains","source":8590,"target":8639},{"edgeType":"contains","source":8591,"target":8608},{"edgeType":"contains","source":5089,"target":5127},{"edgeType":"calls","source":5982,"target":5941},{"edgeType":"calls","source":270,"target":148},{"edgeType":"contains","source":5155,"target":5195},{"edgeType":"contains","source":13579,"target":13590},{"edgeType":"contains","source":1218,"target":1456},{"edgeType":"contains","source":4758,"target":4817},{"edgeType":"contains","source":2005,"target":1371},{"edgeType":"contains","source":8096,"target":8098},{"edgeType":"contains","source":4841,"target":5415},{"edgeType":"contains","source":8955,"target":8951},{"edgeType":"contains","source":13093,"target":13857},{"edgeType":"calls","source":1761,"target":436},{"edgeType":"contains","source":6312,"target":6323},{"edgeType":"contains","source":8063,"target":8064},{"edgeType":"imports","source":3763,"target":3176},{"edgeType":"contains","source":10440,"target":10482},{"edgeType":"imports","source":12152,"target":3143},{"edgeType":"contains","source":10301,"target":11633},{"edgeType":"contains","source":2244,"target":2423},{"edgeType":"calls","source":3989,"target":3243},{"edgeType":"calls","source":7107,"target":3850},{"edgeType":"calls","source":7358,"target":2411},{"edgeType":"imports","source":9852,"target":9955},{"edgeType":"contains","source":8358,"target":8443},{"edgeType":"contains","source":10238,"target":10415},{"edgeType":"contains","source":11165,"target":11275},{"edgeType":"contains","source":13117,"target":13129},{"edgeType":"calls","source":4568,"target":4321},{"edgeType":"contains","source":7072,"target":7084},{"edgeType":"contains","source":10473,"target":10529},{"edgeType":"contains","source":895,"target":903},{"edgeType":"contains","source":8590,"target":8650},{"edgeType":"contains","source":8762,"target":9661},{"edgeType":"contains","source":8790,"target":8793},{"edgeType":"contains","source":1144,"target":1640},{"edgeType":"contains","source":10037,"target":10304},{"edgeType":"contains","source":6576,"target":6604},{"edgeType":"calls","source":5152,"target":4187},{"edgeType":"calls","source":4966,"target":4668},{"edgeType":"contains","source":11259,"target":11532},{"edgeType":"contains","source":1655,"target":1656},{"edgeType":"contains","source":3703,"target":3705},{"edgeType":"imports","source":10813,"target":10818},{"edgeType":"contains","source":1688,"target":1690},{"edgeType":"contains","source":9878,"target":9948},{"edgeType":"contains","source":2269,"target":2705},{"edgeType":"calls","source":8518,"target":2390},{"edgeType":"contains","source":7700,"target":7701},{"edgeType":"imports","source":10884,"target":1218},{"edgeType":"contains","source":13579,"target":13605},{"edgeType":"contains","source":13117,"target":13128},{"edgeType":"contains","source":6902,"target":7070},{"edgeType":"contains","source":9170,"target":3354},{"edgeType":"contains","source":895,"target":902},{"edgeType":"contains","source":12428,"target":12289},{"edgeType":"contains","source":2244,"target":2424},{"edgeType":"contains","source":6144,"target":6256},{"edgeType":"imports","source":2314,"target":1584},{"edgeType":"contains","source":6305,"target":6550},{"edgeType":"contains","source":8358,"target":8442},{"edgeType":"contains","source":5107,"target":4575},{"edgeType":"contains","source":8590,"target":8649},{"edgeType":"contains","source":8591,"target":8618},{"edgeType":"imports","source":5977,"target":1119},{"edgeType":"imports","source":4131,"target":4438},{"edgeType":"contains","source":5961,"target":4530},{"edgeType":"contains","source":12787,"target":12788},{"edgeType":"contains","source":12820,"target":12822},{"edgeType":"contains","source":7601,"target":1256},{"edgeType":"contains","source":7333,"target":7450},{"edgeType":"calls","source":6006,"target":4137},{"edgeType":"calls","source":3534,"target":436},{"edgeType":"calls","source":10783,"target":3000},{"edgeType":"contains","source":13579,"target":13604},{"edgeType":"calls","source":1256,"target":1290},{"edgeType":"contains","source":2244,"target":2421},{"edgeType":"contains","source":13117,"target":13127},{"edgeType":"calls","source":2769,"target":1950},{"edgeType":"contains","source":2943,"target":2950},{"edgeType":"contains","source":11165,"target":11273},{"edgeType":"calls","source":1224,"target":1225},{"edgeType":"contains","source":9106,"target":9569},{"edgeType":"contains","source":10301,"target":11631},{"edgeType":"contains","source":11298,"target":10321},{"edgeType":"calls","source":11435,"target":11324},{"edgeType":"contains","source":6643,"target":6644},{"edgeType":"imports","source":8078,"target":1524},{"edgeType":"contains","source":895,"target":905},{"edgeType":"contains","source":8590,"target":8652},{"edgeType":"imports","source":8523,"target":414},{"edgeType":"contains","source":5252,"target":5364},{"edgeType":"calls","source":12326,"target":12243},{"edgeType":"contains","source":10238,"target":10413},{"edgeType":"contains","source":7727,"target":7923},{"edgeType":"calls","source":12505,"target":9865},{"edgeType":"contains","source":11595,"target":11684},{"edgeType":"contains","source":13579,"target":13603},{"edgeType":"calls","source":12566,"target":10088},{"edgeType":"calls","source":9355,"target":1814},{"edgeType":"contains","source":2244,"target":2422},{"edgeType":"contains","source":6902,"target":7072},{"edgeType":"contains","source":11165,"target":11274},{"edgeType":"contains","source":6078,"target":6190},{"edgeType":"contains","source":9106,"target":9568},{"edgeType":"contains","source":10238,"target":10414},{"edgeType":"contains","source":7072,"target":7087},{"edgeType":"contains","source":7071,"target":7118},{"edgeType":"imports","source":9698,"target":3100},{"edgeType":"contains","source":13018,"target":13024},{"edgeType":"contains","source":895,"target":904},{"edgeType":"contains","source":1218,"target":1460},{"edgeType":"contains","source":8590,"target":8651},{"edgeType":"contains","source":5089,"target":5131},{"edgeType":"contains","source":6643,"target":6645},{"edgeType":"calls","source":230,"target":327},{"edgeType":"contains","source":1144,"target":584},{"edgeType":"contains","source":13579,"target":13602},{"edgeType":"contains","source":2480,"target":2505},{"edgeType":"contains","source":7366,"target":1144},{"edgeType":"contains","source":9506,"target":9852},{"edgeType":"contains","source":11595,"target":11685},{"edgeType":"contains","source":9878,"target":9947},{"edgeType":"contains","source":9852,"target":10753},{"edgeType":"calls","source":12719,"target":12745},{"edgeType":"contains","source":7435,"target":7461},{"edgeType":"contains","source":2269,"target":2704},{"edgeType":"contains","source":11674,"target":12407},{"edgeType":"calls","source":1786,"target":1771},{"edgeType":"contains","source":7700,"target":7702},{"edgeType":"contains","source":4132,"target":4151},{"edgeType":"contains","source":11108,"target":11981},{"edgeType":"calls","source":12463,"target":12231},{"edgeType":"contains","source":7694,"target":7882},{"edgeType":"contains","source":8591,"target":2273},{"edgeType":"contains","source":9106,"target":9563},{"edgeType":"contains","source":6411,"target":6430},{"edgeType":"contains","source":8358,"target":8439},{"edgeType":"contains","source":11165,"target":11271},{"edgeType":"contains","source":10547,"target":10345},{"edgeType":"calls","source":1521,"target":1525},{"edgeType":"contains","source":2244,"target":2427},{"edgeType":"contains","source":11266,"target":11311},{"edgeType":"contains","source":12618,"target":12738},{"edgeType":"contains","source":4562,"target":4563},{"edgeType":"contains","source":10904,"target":10906},{"edgeType":"contains","source":10069,"target":10365},{"edgeType":"contains","source":7434,"target":7485},{"edgeType":"contains","source":13579,"target":13601},{"edgeType":"imports","source":4131,"target":4441},{"edgeType":"contains","source":6576,"target":6600},{"edgeType":"contains","source":6607,"target":6696},{"edgeType":"contains","source":1556,"target":1558},{"edgeType":"calls","source":9879,"target":9885},{"edgeType":"contains","source":10238,"target":10411},{"edgeType":"contains","source":3571,"target":3573},{"edgeType":"contains","source":9878,"target":9944},{"edgeType":"contains","source":4157,"target":4432},{"edgeType":"contains","source":9106,"target":9562},{"edgeType":"contains","source":4841,"target":5426},{"edgeType":"contains","source":8591,"target":2272},{"edgeType":"contains","source":11108,"target":11982},{"edgeType":"contains","source":10301,"target":11630},{"edgeType":"contains","source":7694,"target":7881},{"edgeType":"calls","source":9879,"target":9884},{"edgeType":"contains","source":8590,"target":8645},{"edgeType":"contains","source":8589,"target":8676},{"edgeType":"contains","source":2244,"target":2428},{"edgeType":"calls","source":12621,"target":12619},{"edgeType":"contains","source":11266,"target":11312},{"edgeType":"calls","source":943,"target":415},{"edgeType":"contains","source":13093,"target":13868},{"edgeType":"contains","source":895,"target":906},{"edgeType":"contains","source":10069,"target":10366},{"edgeType":"calls","source":9422,"target":9253},{"edgeType":"contains","source":6607,"target":6697},{"edgeType":"contains","source":7865,"target":7866},{"edgeType":"contains","source":3571,"target":3572},{"edgeType":"contains","source":1580,"target":1872},{"edgeType":"calls","source":230,"target":321},{"edgeType":"calls","source":3491,"target":2819},{"edgeType":"contains","source":4841,"target":5425},{"edgeType":"contains","source":8358,"target":8441},{"edgeType":"contains","source":11165,"target":11269},{"edgeType":"contains","source":9878,"target":9941},{"edgeType":"calls","source":4765,"target":4550},{"edgeType":"contains","source":10440,"target":10489},{"edgeType":"contains","source":12713,"target":12962},{"edgeType":"contains","source":895,"target":909},{"edgeType":"contains","source":1218,"target":1463},{"edgeType":"contains","source":8590,"target":8648},{"edgeType":"contains","source":8790,"target":8791},{"edgeType":"contains","source":11267,"target":11278},{"edgeType":"contains","source":13093,"target":13867},{"edgeType":"contains","source":13117,"target":13123},{"edgeType":"contains","source":13579,"target":13599},{"edgeType":"calls","source":9323,"target":8097},{"edgeType":"contains","source":6576,"target":6602},{"edgeType":"contains","source":1,"target":8539},{"edgeType":"calls","source":10903,"target":10908},{"edgeType":"calls","source":431,"target":435},{"edgeType":"calls","source":4573,"target":4160},{"edgeType":"calls","source":1818,"target":1833},{"edgeType":"contains","source":5883,"target":5888},{"edgeType":"contains","source":10238,"target":10409},{"edgeType":"contains","source":6078,"target":6185},{"edgeType":"contains","source":7865,"target":7869},{"edgeType":"contains","source":11165,"target":11270},{"edgeType":"contains","source":3497,"target":3749},{"edgeType":"contains","source":8358,"target":8440},{"edgeType":"contains","source":2244,"target":2426},{"edgeType":"calls","source":2668,"target":850},{"edgeType":"contains","source":9252,"target":9266},{"edgeType":"contains","source":895,"target":908},{"edgeType":"contains","source":8590,"target":8647},{"edgeType":"calls","source":1226,"target":1158},{"edgeType":"calls","source":799,"target":653},{"edgeType":"calls","source":1098,"target":898},{"edgeType":"contains","source":7072,"target":7083},{"edgeType":"contains","source":2909,"target":2952},{"edgeType":"contains","source":13018,"target":13020},{"edgeType":"calls","source":2513,"target":2484},{"edgeType":"contains","source":9506,"target":9848},{"edgeType":"contains","source":6576,"target":6603},{"edgeType":"calls","source":8789,"target":8794},{"edgeType":"contains","source":13579,"target":13598},{"edgeType":"contains","source":7862,"target":7961},{"edgeType":"contains","source":3703,"target":3706},{"edgeType":"contains","source":5718,"target":5719},{"edgeType":"contains","source":10301,"target":11628},{"edgeType":"contains","source":1556,"target":1557},{"edgeType":"contains","source":10238,"target":10410},{"edgeType":"calls","source":12364,"target":2614},{"edgeType":"imports","source":12298,"target":12350},{"edgeType":"contains","source":3899,"target":3972},{"edgeType":"imports","source":4131,"target":4444},{"edgeType":"calls","source":10593,"target":436},{"edgeType":"contains","source":2,"target":21},{"edgeType":"contains","source":1287,"target":1411},{"edgeType":"contains","source":10944,"target":10702},{"edgeType":"calls","source":7533,"target":7532},{"edgeType":"calls","source":12354,"target":11353},{"edgeType":"contains","source":8704,"target":9320},{"edgeType":"contains","source":13579,"target":13581},{"edgeType":"contains","source":8790,"target":8768},{"edgeType":"calls","source":3693,"target":2930},{"edgeType":"contains","source":498,"target":501},{"edgeType":"contains","source":795,"target":807},{"edgeType":"calls","source":12983,"target":1367},{"edgeType":"contains","source":1,"target":13794},{"edgeType":"contains","source":12355,"target":12414},{"edgeType":"imports","source":4131,"target":4428},{"edgeType":"contains","source":12158,"target":12179},{"edgeType":"contains","source":8525,"target":7470},{"edgeType":"contains","source":1007,"target":1634},{"edgeType":"contains","source":9218,"target":9241},{"edgeType":"calls","source":4432,"target":4334},{"edgeType":"contains","source":7070,"target":7121},{"edgeType":"contains","source":9780,"target":9790},{"edgeType":"contains","source":3152,"target":3847},{"edgeType":"imports","source":10514,"target":10566},{"edgeType":"contains","source":11741,"target":1850},{"edgeType":"contains","source":7356,"target":4597},{"edgeType":"contains","source":11108,"target":11960},{"edgeType":"contains","source":2,"target":20},{"edgeType":"contains","source":13645,"target":13648},{"edgeType":"calls","source":3504,"target":3505},{"edgeType":"contains","source":13018,"target":13001},{"edgeType":"contains","source":13579,"target":13580},{"edgeType":"contains","source":498,"target":500},{"edgeType":"contains","source":8704,"target":9319},{"edgeType":"contains","source":10301,"target":11609},{"edgeType":"imports","source":2137,"target":704},{"edgeType":"calls","source":5123,"target":5109},{"edgeType":"contains","source":10323,"target":9870},{"edgeType":"contains","source":12355,"target":12413},{"edgeType":"imports","source":4131,"target":4429},{"edgeType":"contains","source":6342,"target":6435},{"edgeType":"contains","source":1007,"target":1633},{"edgeType":"contains","source":9878,"target":9924},{"edgeType":"contains","source":10473,"target":10506},{"edgeType":"contains","source":2919,"target":3672},{"edgeType":"contains","source":1,"target":8507},{"edgeType":"imports","source":11674,"target":3144},{"edgeType":"calls","source":663,"target":668},{"edgeType":"calls","source":629,"target":665},{"edgeType":"calls","source":9844,"target":9883},{"edgeType":"contains","source":9106,"target":9541},{"edgeType":"contains","source":11467,"target":10345},{"edgeType":"contains","source":11108,"target":11961},{"edgeType":"contains","source":3669,"target":3676},{"edgeType":"imports","source":12896,"target":12832},{"edgeType":"contains","source":3436,"target":3498},{"edgeType":"contains","source":7435,"target":7436},{"edgeType":"contains","source":8762,"target":9638},{"edgeType":"contains","source":4758,"target":4798},{"edgeType":"calls","source":8459,"target":1026},{"edgeType":"contains","source":8704,"target":9322},{"edgeType":"contains","source":2,"target":23},{"edgeType":"calls","source":12587,"target":12584},{"edgeType":"calls","source":12587,"target":11527},{"edgeType":"contains","source":6576,"target":6582},{"edgeType":"contains","source":13843,"target":13851},{"edgeType":"contains","source":1,"target":13796},{"edgeType":"contains","source":12158,"target":12177},{"edgeType":"imports","source":4185,"target":642},{"edgeType":"contains","source":6305,"target":6526},{"edgeType":"contains","source":11259,"target":11505},{"edgeType":"contains","source":7070,"target":7123},{"edgeType":"contains","source":1,"target":7453},{"edgeType":"contains","source":1,"target":8510},{"edgeType":"contains","source":8525,"target":8529},{"edgeType":"imports","source":11674,"target":3143},{"edgeType":"calls","source":12331,"target":436},{"edgeType":"contains","source":6968,"target":7114},{"edgeType":"calls","source":2020,"target":1942},{"edgeType":"contains","source":7333,"target":7426},{"edgeType":"contains","source":9106,"target":9544},{"edgeType":"contains","source":9218,"target":9243},{"edgeType":"calls","source":4948,"target":4190},{"edgeType":"contains","source":10246,"target":10141},{"edgeType":"contains","source":6078,"target":6165},{"edgeType":"contains","source":13645,"target":13646},{"edgeType":"calls","source":862,"target":843},{"edgeType":"contains","source":2,"target":22},{"edgeType":"contains","source":1218,"target":1435},{"edgeType":"contains","source":8762,"target":9637},{"edgeType":"contains","source":8704,"target":9321},{"edgeType":"contains","source":12096,"target":11984},{"edgeType":"contains","source":2480,"target":2481},{"edgeType":"imports","source":3952,"target":1524},{"edgeType":"contains","source":10473,"target":10503},{"edgeType":"contains","source":498,"target":502},{"edgeType":"contains","source":9878,"target":9922},{"edgeType":"contains","source":7070,"target":7124},{"edgeType":"calls","source":7171,"target":7130},{"edgeType":"calls","source":6050,"target":5967},{"edgeType":"contains","source":12059,"target":12074},{"edgeType":"contains","source":2269,"target":2679},{"edgeType":"contains","source":8590,"target":8627},{"edgeType":"contains","source":1007,"target":1635},{"edgeType":"contains","source":10702,"target":10804},{"edgeType":"contains","source":9780,"target":9789},{"edgeType":"contains","source":6968,"target":7115},{"edgeType":"contains","source":9106,"target":9543},{"edgeType":"imports","source":12565,"target":12525},{"edgeType":"contains","source":9218,"target":9242},{"edgeType":"calls","source":7967,"target":7822},{"edgeType":"contains","source":10301,"target":10547},{"edgeType":"contains","source":5420,"target":5423},{"edgeType":"contains","source":4758,"target":4804},{"edgeType":"contains","source":6968,"target":7108},{"edgeType":"contains","source":2,"target":25},{"edgeType":"contains","source":6276,"target":6362},{"edgeType":"contains","source":6144,"target":6226},{"edgeType":"calls","source":5122,"target":5137},{"edgeType":"contains","source":55,"target":496},{"edgeType":"contains","source":8704,"target":9316},{"edgeType":"contains","source":8762,"target":9632},{"edgeType":"contains","source":8790,"target":8764},{"edgeType":"contains","source":2381,"target":2384},{"edgeType":"calls","source":11052,"target":3095},{"edgeType":"contains","source":1585,"target":1691},{"edgeType":"contains","source":1,"target":7455},{"edgeType":"contains","source":1,"target":8512},{"edgeType":"contains","source":7333,"target":7420},{"edgeType":"contains","source":2909,"target":2928},{"edgeType":"contains","source":1007,"target":1638},{"edgeType":"calls","source":1952,"target":1930},{"edgeType":"calls","source":12134,"target":11834},{"edgeType":"contains","source":5746,"target":5880},{"edgeType":"contains","source":5420,"target":5422},{"edgeType":"calls","source":9495,"target":9079},{"edgeType":"contains","source":9106,"target":9537},{"edgeType":"contains","source":55,"target":495},{"edgeType":"contains","source":2381,"target":2385},{"edgeType":"contains","source":6342,"target":6431},{"edgeType":"contains","source":8704,"target":9315},{"edgeType":"contains","source":10301,"target":11605},{"edgeType":"calls","source":10950,"target":3087},{"edgeType":"calls","source":6841,"target":6791},{"edgeType":"contains","source":1585,"target":1692},{"edgeType":"contains","source":2909,"target":2929},{"edgeType":"contains","source":9218,"target":9236},{"edgeType":"calls","source":2063,"target":602},{"edgeType":"contains","source":9878,"target":9920},{"edgeType":"calls","source":13868,"target":13046},{"edgeType":"imports","source":10514,"target":10569},{"edgeType":"contains","source":5746,"target":5881},{"edgeType":"calls","source":663,"target":664},{"edgeType":"contains","source":11367,"target":11327},{"edgeType":"contains","source":1218,"target":1442},{"edgeType":"contains","source":6144,"target":6228},{"edgeType":"contains","source":6811,"target":6692},{"edgeType":"contains","source":8299,"target":7074},{"edgeType":"imports","source":12276,"target":11965},{"edgeType":"calls","source":4934,"target":4621},{"edgeType":"contains","source":4758,"target":4802},{"edgeType":"calls","source":2150,"target":2133},{"edgeType":"contains","source":2480,"target":2484},{"edgeType":"contains","source":6342,"target":6432},{"edgeType":"contains","source":8704,"target":9318},{"edgeType":"calls","source":5882,"target":5887},{"edgeType":"imports","source":8523,"target":409},{"edgeType":"contains","source":2,"target":27},{"edgeType":"imports","source":5977,"target":1118},{"edgeType":"contains","source":2381,"target":2382},{"edgeType":"contains","source":12553,"target":12612},{"edgeType":"calls","source":3971,"target":3819},{"edgeType":"imports","source":1111,"target":793},{"edgeType":"contains","source":10237,"target":3016},{"edgeType":"contains","source":10702,"target":10799},{"edgeType":"contains","source":1580,"target":1844},{"edgeType":"contains","source":2269,"target":2682},{"edgeType":"contains","source":5746,"target":5882},{"edgeType":"contains","source":9218,"target":9239},{"edgeType":"calls","source":12401,"target":2498},{"edgeType":"contains","source":12752,"target":12786},{"edgeType":"contains","source":2909,"target":2926},{"edgeType":"calls","source":1918,"target":1929},{"edgeType":"contains","source":10141,"target":10220},{"edgeType":"calls","source":2813,"target":2721},{"edgeType":"contains","source":7727,"target":7894},{"edgeType":"calls","source":663,"target":667},{"edgeType":"contains","source":5716,"target":5755},{"edgeType":"calls","source":4709,"target":1026},{"edgeType":"contains","source":6144,"target":6229},{"edgeType":"calls","source":12326,"target":12224},{"edgeType":"contains","source":1287,"target":1414},{"edgeType":"contains","source":10391,"target":9870},{"edgeType":"contains","source":10301,"target":11603},{"edgeType":"contains","source":13843,"target":13846},{"edgeType":"calls","source":230,"target":347},{"edgeType":"contains","source":4130,"target":4185},{"edgeType":"contains","source":6342,"target":6433},{"edgeType":"contains","source":2,"target":26},{"edgeType":"contains","source":8704,"target":9317},{"edgeType":"contains","source":12553,"target":12611},{"edgeType":"calls","source":8721,"target":8763},{"edgeType":"contains","source":12059,"target":12070},{"edgeType":"calls","source":8069,"target":436},{"edgeType":"contains","source":8590,"target":8623},{"edgeType":"contains","source":8591,"target":8592},{"edgeType":"imports","source":12553,"target":11836},{"edgeType":"contains","source":9218,"target":9238},{"edgeType":"contains","source":2909,"target":2927},{"edgeType":"calls","source":1129,"target":1018},{"edgeType":"calls","source":5984,"target":5895},{"edgeType":"imports","source":4131,"target":4436},{"edgeType":"calls","source":7634,"target":7579},{"edgeType":"contains","source":9106,"target":9539},{"edgeType":"contains","source":11165,"target":11245},{"edgeType":"contains","source":1007,"target":1639},{"edgeType":"contains","source":3436,"target":3502},{"edgeType":"contains","source":3201,"target":3394},{"edgeType":"contains","source":8197,"target":733},{"edgeType":"contains","source":8676,"target":9139},{"edgeType":"calls","source":994,"target":970},{"edgeType":"contains","source":9218,"target":9250},{"edgeType":"contains","source":11267,"target":11268},{"edgeType":"contains","source":9252,"target":9253},{"edgeType":"contains","source":1688,"target":1673},{"edgeType":"imports","source":1954,"target":1101},{"edgeType":"contains","source":2381,"target":2388},{"edgeType":"contains","source":5746,"target":5892},{"edgeType":"contains","source":11595,"target":11670},{"edgeType":"contains","source":6144,"target":6238},{"edgeType":"contains","source":9809,"target":9956},{"edgeType":"contains","source":13579,"target":13589},{"edgeType":"calls","source":1818,"target":1852},{"edgeType":"calls","source":12442,"target":11804},{"edgeType":"calls","source":10053,"target":3413},{"edgeType":"contains","source":11762,"target":11778},{"edgeType":"contains","source":8228,"target":8229},{"edgeType":"contains","source":4297,"target":4301},{"edgeType":"contains","source":6312,"target":6316},{"edgeType":"contains","source":6305,"target":6533},{"edgeType":"contains","source":10238,"target":10399},{"edgeType":"contains","source":1007,"target":1642},{"edgeType":"imports","source":6144,"target":2269},{"edgeType":"calls","source":7996,"target":7985},{"edgeType":"contains","source":9218,"target":9249},{"edgeType":"contains","source":1218,"target":1445},{"edgeType":"calls","source":11507,"target":11192},{"edgeType":"calls","source":4665,"target":4502},{"edgeType":"contains","source":8676,"target":9138},{"edgeType":"calls","source":3087,"target":568},{"edgeType":"contains","source":3201,"target":3395},{"edgeType":"calls","source":205,"target":59},{"edgeType":"contains","source":3273,"target":3277},{"edgeType":"contains","source":2381,"target":2389},{"edgeType":"contains","source":7333,"target":7434},{"edgeType":"calls","source":10305,"target":3000},{"edgeType":"contains","source":2,"target":28},{"edgeType":"contains","source":5746,"target":5893},{"edgeType":"contains","source":7434,"target":7474},{"edgeType":"contains","source":6078,"target":6171},{"edgeType":"calls","source":12431,"target":1576},{"edgeType":"contains","source":6020,"target":5855},{"edgeType":"imports","source":12280,"target":11836},{"edgeType":"contains","source":13579,"target":13588},{"edgeType":"contains","source":13093,"target":13855},{"edgeType":"contains","source":4329,"target":4365},{"edgeType":"calls","source":1456,"target":1445},{"edgeType":"contains","source":9218,"target":9248},{"edgeType":"calls","source":1158,"target":1170},{"edgeType":"contains","source":4758,"target":4807},{"edgeType":"contains","source":10630,"target":9875},{"edgeType":"calls","source":7668,"target":7584},{"edgeType":"calls","source":9751,"target":3261},{"edgeType":"contains","source":5961,"target":4514},{"edgeType":"calls","source":3061,"target":1371},{"edgeType":"contains","source":7897,"target":7921},{"edgeType":"calls","source":8856,"target":8811},{"edgeType":"contains","source":9252,"target":9255},{"edgeType":"contains","source":397,"target":471},{"edgeType":"contains","source":2381,"target":2386},{"edgeType":"contains","source":11595,"target":11668},{"edgeType":"contains","source":13579,"target":13587},{"edgeType":"contains","source":5746,"target":5894},{"edgeType":"contains","source":2,"target":31},{"edgeType":"contains","source":9878,"target":9929},{"edgeType":"contains","source":13093,"target":13854},{"edgeType":"contains","source":4297,"target":4299},{"edgeType":"calls","source":3272,"target":3286},{"edgeType":"calls","source":11703,"target":3000},{"edgeType":"contains","source":4758,"target":4806},{"edgeType":"imports","source":8078,"target":451},{"edgeType":"contains","source":8704,"target":9330},{"edgeType":"contains","source":11000,"target":11086},{"edgeType":"contains","source":8590,"target":8636},{"edgeType":"contains","source":8676,"target":9141},{"edgeType":"calls","source":10143,"target":10138},{"edgeType":"contains","source":11432,"target":11437},{"edgeType":"contains","source":3201,"target":3393},{"edgeType":"calls","source":3053,"target":563},{"edgeType":"contains","source":5961,"target":4515},{"edgeType":"contains","source":13579,"target":13586},{"edgeType":"contains","source":9252,"target":9254},{"edgeType":"contains","source":11616,"target":12075},{"edgeType":"contains","source":2,"target":30},{"edgeType":"contains","source":1,"target":61},{"edgeType":"contains","source":5746,"target":5895},{"edgeType":"calls","source":3395,"target":2645},{"edgeType":"contains","source":1524,"target":414},{"edgeType":"contains","source":12456,"target":12460},{"edgeType":"contains","source":12557,"target":12500},{"edgeType":"contains","source":6312,"target":6319},{"edgeType":"imports","source":12538,"target":12297},{"edgeType":"contains","source":3735,"target":3750},{"edgeType":"contains","source":10238,"target":10398},{"edgeType":"calls","source":2513,"target":2505},{"edgeType":"calls","source":5118,"target":1026},{"edgeType":"contains","source":8590,"target":8635},{"edgeType":"contains","source":1007,"target":1643},{"edgeType":"contains","source":1144,"target":567},{"edgeType":"contains","source":8676,"target":9140},{"edgeType":"contains","source":1007,"target":1647},{"edgeType":"contains","source":1144,"target":571},{"edgeType":"contains","source":8704,"target":9324},{"edgeType":"imports","source":12499,"target":12441},{"edgeType":"contains","source":13579,"target":13585},{"edgeType":"calls","source":2479,"target":2498},{"edgeType":"contains","source":8676,"target":9135},{"edgeType":"imports","source":646,"target":420},{"edgeType":"contains","source":5155,"target":5190},{"edgeType":"contains","source":11432,"target":11434},{"edgeType":"contains","source":11616,"target":12072},{"edgeType":"contains","source":11762,"target":11774},{"edgeType":"calls","source":12397,"target":1576},{"edgeType":"contains","source":9106,"target":9546},{"edgeType":"contains","source":11108,"target":11964},{"edgeType":"contains","source":9809,"target":9952},{"edgeType":"contains","source":590,"target":832},{"edgeType":"contains","source":6968,"target":7116},{"edgeType":"contains","source":9218,"target":9245},{"edgeType":"calls","source":7335,"target":7340},{"edgeType":"calls","source":3057,"target":436},{"edgeType":"contains","source":11000,"target":11084},{"edgeType":"contains","source":8274,"target":2569},{"edgeType":"calls","source":1026,"target":1030},{"edgeType":"contains","source":13579,"target":13584},{"edgeType":"contains","source":10141,"target":10231},{"edgeType":"contains","source":5155,"target":5189},{"edgeType":"contains","source":6576,"target":6585},{"edgeType":"calls","source":10276,"target":10245},{"edgeType":"calls","source":6531,"target":5839},{"edgeType":"contains","source":11595,"target":11667},{"edgeType":"contains","source":11616,"target":12073},{"edgeType":"contains","source":2,"target":32},{"edgeType":"calls","source":1984,"target":1986},{"edgeType":"contains","source":9878,"target":9928},{"edgeType":"calls","source":7634,"target":7585},{"edgeType":"contains","source":6312,"target":6313},{"edgeType":"contains","source":5746,"target":5889},{"edgeType":"contains","source":8525,"target":8530},{"edgeType":"contains","source":10473,"target":10510},{"edgeType":"contains","source":12456,"target":12458},{"edgeType":"contains","source":5107,"target":4562},{"edgeType":"calls","source":4675,"target":4187},{"edgeType":"imports","source":899,"target":1034},{"edgeType":"calls","source":5114,"target":4319},{"edgeType":"contains","source":6968,"target":7117},{"edgeType":"calls","source":1197,"target":1014},{"edgeType":"contains","source":1007,"target":1649},{"edgeType":"contains","source":3174,"target":3176},{"edgeType":"contains","source":8704,"target":9326},{"edgeType":"contains","source":8676,"target":9137},{"edgeType":"contains","source":6607,"target":6682},{"edgeType":"calls","source":4527,"target":4545},{"edgeType":"contains","source":2269,"target":2691},{"edgeType":"contains","source":5746,"target":5890},{"edgeType":"contains","source":10238,"target":10392},{"edgeType":"contains","source":10141,"target":10228},{"edgeType":"contains","source":10473,"target":10507},{"edgeType":"calls","source":1291,"target":1274},{"edgeType":"contains","source":7694,"target":7868},{"edgeType":"calls","source":11772,"target":11435},{"edgeType":"contains","source":8590,"target":8632},{"edgeType":"contains","source":9218,"target":9247},{"edgeType":"contains","source":590,"target":834},{"edgeType":"calls","source":3008,"target":3010},{"edgeType":"calls","source":3249,"target":2938},{"edgeType":"contains","source":11108,"target":11962},{"edgeType":"contains","source":10141,"target":10229},{"edgeType":"contains","source":2480,"target":2493},{"edgeType":"contains","source":5252,"target":5351},{"edgeType":"contains","source":8676,"target":9136},{"edgeType":"contains","source":1007,"target":1648},{"edgeType":"contains","source":8704,"target":9325},{"edgeType":"contains","source":2381,"target":2391},{"edgeType":"contains","source":1144,"target":572},{"edgeType":"contains","source":11616,"target":12071},{"edgeType":"contains","source":13579,"target":13582},{"edgeType":"contains","source":5746,"target":5891},{"edgeType":"calls","source":12029,"target":11926},{"edgeType":"calls","source":12319,"target":2936},{"edgeType":"calls","source":12330,"target":2595},{"edgeType":"contains","source":12355,"target":12415},{"edgeType":"contains","source":9878,"target":9926},{"edgeType":"imports","source":4131,"target":4427},{"edgeType":"contains","source":5961,"target":4511},{"edgeType":"calls","source":6080,"target":6082},{"edgeType":"contains","source":7694,"target":7867},{"edgeType":"contains","source":4231,"target":4234},{"edgeType":"calls","source":2668,"target":1924},{"edgeType":"contains","source":12617,"target":12750},{"edgeType":"contains","source":590,"target":833},{"edgeType":"calls","source":11314,"target":266},{"edgeType":"contains","source":4841,"target":5407},{"edgeType":"contains","source":11108,"target":11963},{"edgeType":"contains","source":13053,"target":12975},{"edgeType":"calls","source":1026,"target":1032},{"edgeType":"contains","source":6968,"target":7119},{"edgeType":"contains","source":679,"target":687},{"edgeType":"imports","source":12298,"target":2614},{"edgeType":"contains","source":12,"target":223},{"edgeType":"calls","source":10138,"target":3000},{"edgeType":"imports","source":1139,"target":1831},{"edgeType":"contains","source":8765,"target":8998},{"edgeType":"contains","source":8897,"target":9134},{"edgeType":"contains","source":10089,"target":10236},{"edgeType":"contains","source":907,"target":1018},{"edgeType":"contains","source":8078,"target":8097},{"edgeType":"contains","source":12437,"target":12498},{"edgeType":"contains","source":12436,"target":12529},{"edgeType":"contains","source":4511,"target":4513},{"edgeType":"calls","source":8165,"target":740},{"edgeType":"imports","source":4131,"target":4214},{"edgeType":"contains","source":5765,"target":5807},{"edgeType":"contains","source":7781,"target":7791},{"edgeType":"contains","source":12571,"target":12573},{"edgeType":"contains","source":1140,"target":1194},{"edgeType":"contains","source":5883,"target":6377},{"edgeType":"contains","source":12670,"target":12675},{"edgeType":"contains","source":1528,"target":795},{"edgeType":"contains","source":9002,"target":9050},{"edgeType":"contains","source":5634,"target":5640},{"edgeType":"contains","source":1603,"target":1641},{"edgeType":"contains","source":12,"target":222},{"edgeType":"contains","source":9002,"target":9049},{"edgeType":"contains","source":8897,"target":9133},{"edgeType":"contains","source":907,"target":1017},{"edgeType":"calls","source":9982,"target":436},{"edgeType":"contains","source":4511,"target":4512},{"edgeType":"contains","source":9852,"target":10185},{"edgeType":"contains","source":8574,"target":8576},{"edgeType":"contains","source":10490,"target":10491},{"edgeType":"imports","source":1347,"target":668},{"edgeType":"contains","source":1140,"target":1193},{"edgeType":"contains","source":7781,"target":7790},{"edgeType":"contains","source":12571,"target":12572},{"edgeType":"contains","source":11051,"target":11069},{"edgeType":"contains","source":5634,"target":5641},{"edgeType":"calls","source":4803,"target":1371},{"edgeType":"calls","source":998,"target":936},{"edgeType":"contains","source":9499,"target":9501},{"edgeType":"contains","source":679,"target":689},{"edgeType":"contains","source":11675,"target":11806},{"edgeType":"contains","source":11613,"target":11614},{"edgeType":"contains","source":11051,"target":11066},{"edgeType":"contains","source":13628,"target":13629},{"edgeType":"contains","source":10820,"target":10828},{"edgeType":"contains","source":12,"target":225},{"edgeType":"contains","source":6752,"target":6923},{"edgeType":"contains","source":6592,"target":6598},{"edgeType":"contains","source":12140,"target":12190},{"edgeType":"calls","source":11546,"target":10088},{"edgeType":"calls","source":4371,"target":4191},{"edgeType":"contains","source":10355,"target":10444},{"edgeType":"contains","source":3781,"target":3886},{"edgeType":"contains","source":11313,"target":11400},{"edgeType":"contains","source":12670,"target":12673},{"edgeType":"contains","source":12305,"target":2847},{"edgeType":"calls","source":5837,"target":1026},{"edgeType":"imports","source":1347,"target":667},{"edgeType":"contains","source":9002,"target":9052},{"edgeType":"imports","source":554,"target":937},{"edgeType":"calls","source":930,"target":933},{"edgeType":"calls","source":12957,"target":12858},{"edgeType":"contains","source":11545,"target":11607},{"edgeType":"calls","source":1771,"target":230},{"edgeType":"contains","source":4841,"target":4850},{"edgeType":"contains","source":6752,"target":6924},{"edgeType":"contains","source":679,"target":688},{"edgeType":"contains","source":10237,"target":9875},{"edgeType":"imports","source":8107,"target":403},{"edgeType":"contains","source":9499,"target":9500},{"edgeType":"calls","source":7043,"target":6985},{"edgeType":"contains","source":11712,"target":11717},{"edgeType":"contains","source":11675,"target":11807},{"edgeType":"calls","source":2583,"target":2539},{"edgeType":"imports","source":12622,"target":12657},{"edgeType":"calls","source":4371,"target":4190},{"edgeType":"imports","source":7001,"target":7208},{"edgeType":"contains","source":6592,"target":6599},{"edgeType":"contains","source":10089,"target":10235},{"edgeType":"calls","source":6224,"target":5941},{"edgeType":"calls","source":2159,"target":1942},{"edgeType":"contains","source":12670,"target":12672},{"edgeType":"calls","source":732,"target":728},{"edgeType":"contains","source":5634,"target":5643},{"edgeType":"contains","source":1140,"target":1195},{"edgeType":"imports","source":1434,"target":1140},{"edgeType":"contains","source":7781,"target":7792},{"edgeType":"imports","source":4639,"target":4324},{"edgeType":"calls","source":804,"target":610},{"edgeType":"imports","source":554,"target":938},{"edgeType":"contains","source":9002,"target":9051},{"edgeType":"calls","source":963,"target":966},{"edgeType":"calls","source":1161,"target":1170},{"edgeType":"contains","source":11313,"target":11401},{"edgeType":"contains","source":8525,"target":578},{"edgeType":"calls","source":11205,"target":11152},{"edgeType":"contains","source":9664,"target":9665},{"edgeType":"contains","source":8897,"target":9130},{"edgeType":"calls","source":5985,"target":5950},{"edgeType":"calls","source":7867,"target":7868},{"edgeType":"contains","source":11712,"target":11714},{"edgeType":"contains","source":679,"target":691},{"edgeType":"contains","source":12,"target":227},{"edgeType":"calls","source":6314,"target":6330},{"edgeType":"calls","source":9220,"target":9264},{"edgeType":"contains","source":6261,"target":6282},{"edgeType":"contains","source":9002,"target":9046},{"edgeType":"contains","source":3817,"target":3833},{"edgeType":"contains","source":4511,"target":4517},{"edgeType":"imports","source":11864,"target":11836},{"edgeType":"calls","source":2617,"target":2539},{"edgeType":"contains","source":10367,"target":11127},{"edgeType":"contains","source":7283,"target":7368},{"edgeType":"contains","source":3016,"target":3294},{"edgeType":"contains","source":8039,"target":8245},{"edgeType":"contains","source":10089,"target":10232},{"edgeType":"contains","source":7781,"target":7787},{"edgeType":"contains","source":7415,"target":7504},{"edgeType":"calls","source":10757,"target":10242},{"edgeType":"contains","source":5600,"target":5633},{"edgeType":"imports","source":4131,"target":4218},{"edgeType":"contains","source":5765,"target":5803},{"edgeType":"calls","source":1161,"target":1164},{"edgeType":"contains","source":9002,"target":9045},{"edgeType":"contains","source":8897,"target":9129},{"edgeType":"contains","source":11675,"target":11805},{"edgeType":"contains","source":11674,"target":11836},{"edgeType":"contains","source":10089,"target":10233},{"edgeType":"contains","source":10820,"target":10827},{"edgeType":"contains","source":10390,"target":3016},{"edgeType":"contains","source":10753,"target":10790},{"edgeType":"contains","source":547,"target":554},{"edgeType":"contains","source":10583,"target":10774},{"edgeType":"contains","source":12437,"target":12493},{"edgeType":"calls","source":2338,"target":619},{"edgeType":"contains","source":6592,"target":6593},{"edgeType":"imports","source":1511,"target":865},{"edgeType":"imports","source":1347,"target":664},{"edgeType":"contains","source":1140,"target":1197},{"edgeType":"contains","source":7781,"target":7786},{"edgeType":"calls","source":8997,"target":8777},{"edgeType":"calls","source":1302,"target":1021},{"edgeType":"contains","source":5634,"target":5637},{"edgeType":"contains","source":8897,"target":9132},{"edgeType":"calls","source":2583,"target":2534},{"edgeType":"calls","source":11967,"target":11840},{"edgeType":"contains","source":12438,"target":12461},{"edgeType":"contains","source":9002,"target":9048},{"edgeType":"contains","source":10237,"target":9870},{"edgeType":"calls","source":8113,"target":1301},{"edgeType":"contains","source":10820,"target":10824},{"edgeType":"contains","source":12,"target":229},{"edgeType":"imports","source":7128,"target":2219},{"edgeType":"contains","source":10753,"target":10787},{"edgeType":"contains","source":7283,"target":7370},{"edgeType":"contains","source":11414,"target":11436},{"edgeType":"contains","source":7781,"target":7789},{"edgeType":"calls","source":8311,"target":448},{"edgeType":"calls","source":1346,"target":717},{"edgeType":"contains","source":8897,"target":9131},{"edgeType":"contains","source":11674,"target":11834},{"edgeType":"calls","source":1085,"target":351},{"edgeType":"contains","source":12373,"target":12361},{"edgeType":"imports","source":554,"target":934},{"edgeType":"calls","source":8997,"target":8779},{"edgeType":"contains","source":9002,"target":9047},{"edgeType":"contains","source":4284,"target":4151},{"edgeType":"calls","source":6304,"target":4514},{"edgeType":"calls","source":4564,"target":4545},{"edgeType":"contains","source":6592,"target":6595},{"edgeType":"calls","source":4434,"target":4347},{"edgeType":"contains","source":1603,"target":1644},{"edgeType":"calls","source":868,"target":736},{"edgeType":"contains","source":5600,"target":5636},{"edgeType":"contains","source":7781,"target":7788},{"edgeType":"calls","source":10463,"target":9842},{"edgeType":"calls","source":3493,"target":3922},{"edgeType":"contains","source":9390,"target":9715},{"edgeType":"contains","source":8078,"target":8105},{"edgeType":"contains","source":4510,"target":4552},{"edgeType":"calls","source":11699,"target":11698},{"edgeType":"calls","source":734,"target":656},{"edgeType":"contains","source":12,"target":231},{"edgeType":"contains","source":11613,"target":11624},{"edgeType":"contains","source":3817,"target":3837},{"edgeType":"calls","source":8726,"target":8727},{"edgeType":"contains","source":10390,"target":10427},{"edgeType":"calls","source":2945,"target":2938},{"edgeType":"contains","source":6262,"target":6264},{"edgeType":"contains","source":4214,"target":4215},{"edgeType":"contains","source":6229,"target":6230},{"edgeType":"contains","source":679,"target":695},{"edgeType":"contains","source":12538,"target":12547},{"edgeType":"calls","source":3506,"target":3516},{"edgeType":"imports","source":7629,"target":414},{"edgeType":"contains","source":8039,"target":8256},{"edgeType":"contains","source":8078,"target":8104},{"edgeType":"contains","source":4639,"target":5837},{"edgeType":"contains","source":1,"target":9028},{"edgeType":"contains","source":217,"target":218},{"edgeType":"contains","source":4131,"target":4672},{"edgeType":"contains","source":13628,"target":13638},{"edgeType":"imports","source":554,"target":948},{"edgeType":"contains","source":7163,"target":2645},{"edgeType":"contains","source":4247,"target":4248},{"edgeType":"contains","source":10390,"target":10428},{"edgeType":"contains","source":12437,"target":12506},{"edgeType":"calls","source":2120,"target":2088},{"edgeType":"contains","source":10237,"target":10943},{"edgeType":"contains","source":3557,"target":3440},{"edgeType":"imports","source":12622,"target":12647},{"edgeType":"contains","source":9002,"target":9057},{"edgeType":"calls","source":1771,"target":219},{"edgeType":"calls","source":1197,"target":1104},{"edgeType":"contains","source":7187,"target":7188},{"edgeType":"contains","source":8039,"target":8259},{"edgeType":"contains","source":4510,"target":4550},{"edgeType":"contains","source":4511,"target":4519},{"edgeType":"contains","source":11313,"target":11409},{"edgeType":"contains","source":7415,"target":7519},{"edgeType":"calls","source":4935,"target":4668},{"edgeType":"contains","source":11613,"target":11622},{"edgeType":"contains","source":11712,"target":11724},{"edgeType":"contains","source":9002,"target":9060},{"edgeType":"contains","source":12538,"target":12545},{"edgeType":"calls","source":4940,"target":4514},{"edgeType":"contains","source":10490,"target":10496},{"edgeType":"contains","source":12373,"target":12375},{"edgeType":"contains","source":8244,"target":8247},{"edgeType":"contains","source":10391,"target":10394},{"edgeType":"contains","source":12340,"target":12341},{"edgeType":"contains","source":6262,"target":6266},{"edgeType":"contains","source":11313,"target":11408},{"edgeType":"contains","source":679,"target":697},{"edgeType":"contains","source":10686,"target":10762},{"edgeType":"calls","source":12274,"target":11840},{"edgeType":"contains","source":1041,"target":1102},{"edgeType":"contains","source":6752,"target":6931},{"edgeType":"calls","source":2617,"target":2534},{"edgeType":"contains","source":10753,"target":10800},{"edgeType":"contains","source":12140,"target":12197},{"edgeType":"contains","source":8197,"target":4417},{"edgeType":"calls","source":11930,"target":5593},{"edgeType":"calls","source":1968,"target":1514},{"edgeType":"calls","source":6118,"target":6048},{"edgeType":"contains","source":7187,"target":7189},{"edgeType":"contains","source":9925,"target":10042},{"edgeType":"contains","source":12,"target":232},{"edgeType":"contains","source":10390,"target":10426},{"edgeType":"contains","source":4981,"target":4746},{"edgeType":"contains","source":9002,"target":9059},{"edgeType":"contains","source":11051,"target":11075},{"edgeType":"contains","source":10324,"target":10358},{"edgeType":"contains","source":6262,"target":6267},{"edgeType":"contains","source":12373,"target":12374},{"edgeType":"calls","source":12756,"target":12754},{"edgeType":"contains","source":10237,"target":10941},{"edgeType":"contains","source":679,"target":696},{"edgeType":"imports","source":12553,"target":11617},{"edgeType":"contains","source":8767,"target":8945},{"edgeType":"contains","source":4510,"target":4556},{"edgeType":"contains","source":1041,"target":1105},{"edgeType":"contains","source":7385,"target":7386},{"edgeType":"contains","source":10753,"target":10797},{"edgeType":"contains","source":13628,"target":13635},{"edgeType":"calls","source":3242,"target":3240},{"edgeType":"contains","source":11675,"target":11812},{"edgeType":"calls","source":3175,"target":3203},{"edgeType":"calls","source":799,"target":751},{"edgeType":"contains","source":10294,"target":10227},{"edgeType":"contains","source":11712,"target":11722},{"edgeType":"contains","source":12,"target":235},{"edgeType":"contains","source":9925,"target":10039},{"edgeType":"contains","source":1831,"target":1984},{"edgeType":"contains","source":12538,"target":12543},{"edgeType":"imports","source":8523,"target":4417},{"edgeType":"calls","source":6516,"target":6419},{"edgeType":"imports","source":12622,"target":12642},{"edgeType":"calls","source":434,"target":439},{"edgeType":"contains","source":7283,"target":7376},{"edgeType":"contains","source":13066,"target":13087},{"edgeType":"contains","source":679,"target":699},{"edgeType":"calls","source":11835,"target":11714},{"edgeType":"contains","source":9002,"target":9054},{"edgeType":"contains","source":11481,"target":11485},{"edgeType":"contains","source":6752,"target":6926},{"edgeType":"contains","source":13628,"target":13634},{"edgeType":"contains","source":4510,"target":4555},{"edgeType":"imports","source":12280,"target":11617},{"edgeType":"contains","source":3016,"target":3304},{"edgeType":"calls","source":6248,"target":5187},{"edgeType":"calls","source":1134,"target":936},{"edgeType":"calls","source":4595,"target":4635},{"edgeType":"contains","source":11675,"target":11813},{"edgeType":"contains","source":11746,"target":11726},{"edgeType":"contains","source":3886,"target":3815},{"edgeType":"contains","source":9925,"target":10040},{"edgeType":"calls","source":12957,"target":12871},{"edgeType":"calls","source":12371,"target":2498},{"edgeType":"contains","source":1470,"target":1549},{"edgeType":"contains","source":4115,"target":4116},{"edgeType":"calls","source":2383,"target":2387},{"edgeType":"contains","source":5600,"target":5642},{"edgeType":"contains","source":10391,"target":10393},{"edgeType":"contains","source":12437,"target":12502},{"edgeType":"contains","source":9002,"target":9053},{"edgeType":"contains","source":12670,"target":12678},{"edgeType":"contains","source":3016,"target":3303},{"edgeType":"contains","source":10686,"target":10761},{"edgeType":"contains","source":10904,"target":10345},{"edgeType":"contains","source":11051,"target":11073},{"edgeType":"contains","source":5229,"target":5520},{"edgeType":"calls","source":12444,"target":11860},{"edgeType":"calls","source":1197,"target":1100},{"edgeType":"contains","source":11675,"target":11810},{"edgeType":"contains","source":13496,"target":13497},{"edgeType":"contains","source":11762,"target":11227},{"edgeType":"contains","source":12140,"target":12194},{"edgeType":"contains","source":8011,"target":8066},{"edgeType":"contains","source":12,"target":238},{"edgeType":"calls","source":8142,"target":1467},{"edgeType":"contains","source":4214,"target":4217},{"edgeType":"contains","source":4148,"target":4149},{"edgeType":"calls","source":5189,"target":4190},{"edgeType":"calls","source":4507,"target":4191},{"edgeType":"contains","source":8310,"target":8311},{"edgeType":"contains","source":11051,"target":11070},{"edgeType":"calls","source":1711,"target":1021},{"edgeType":"imports","source":4639,"target":4319},{"edgeType":"calls","source":8163,"target":8215},{"edgeType":"contains","source":679,"target":701},{"edgeType":"calls","source":4800,"target":4620},{"edgeType":"contains","source":4510,"target":4553},{"edgeType":"contains","source":217,"target":224},{"edgeType":"calls","source":3242,"target":3239},{"edgeType":"contains","source":6229,"target":6228},{"edgeType":"contains","source":3815,"target":3900},{"edgeType":"contains","source":8111,"target":8136},{"edgeType":"contains","source":8039,"target":8254},{"edgeType":"contains","source":5634,"target":5647},{"edgeType":"contains","source":9106,"target":9002},{"edgeType":"contains","source":4247,"target":4250},{"edgeType":"calls","source":1711,"target":1020},{"edgeType":"calls","source":1689,"target":1702},{"edgeType":"calls","source":996,"target":988},{"edgeType":"contains","source":6262,"target":6263},{"edgeType":"contains","source":11279,"target":10345},{"edgeType":"contains","source":12538,"target":12540},{"edgeType":"contains","source":6917,"target":7098},{"edgeType":"contains","source":9002,"target":9055},{"edgeType":"contains","source":11051,"target":11071},{"edgeType":"contains","source":381,"target":395},{"edgeType":"contains","source":5765,"target":5790},{"edgeType":"calls","source":1388,"target":491},{"edgeType":"contains","source":7976,"target":8071},{"edgeType":"contains","source":1140,"target":1178},{"edgeType":"contains","source":5600,"target":5620},{"edgeType":"contains","source":13066,"target":13067},{"edgeType":"contains","source":11313,"target":11386},{"edgeType":"calls","source":8816,"target":627},{"edgeType":"contains","source":12273,"target":12281},{"edgeType":"contains","source":9,"target":300},{"edgeType":"contains","source":12042,"target":12043},{"edgeType":"contains","source":4575,"target":4626},{"edgeType":"contains","source":1140,"target":1177},{"edgeType":"calls","source":803,"target":655},{"edgeType":"contains","source":5005,"target":5037},{"edgeType":"contains","source":7976,"target":8070},{"edgeType":"calls","source":709,"target":398},{"edgeType":"contains","source":5600,"target":5621},{"edgeType":"calls","source":5058,"target":5109},{"edgeType":"contains","source":1,"target":547},{"edgeType":"contains","source":6822,"target":6849},{"edgeType":"contains","source":8897,"target":9116},{"edgeType":"calls","source":12062,"target":12048},{"edgeType":"calls","source":11800,"target":11714},{"edgeType":"contains","source":5005,"target":5036},{"edgeType":"contains","source":8010,"target":8074},{"edgeType":"calls","source":11507,"target":11284},{"edgeType":"contains","source":12438,"target":12450},{"edgeType":"calls","source":2143,"target":1400},{"edgeType":"contains","source":12207,"target":12212},{"edgeType":"contains","source":8523,"target":627},{"edgeType":"contains","source":4639,"target":5812},{"edgeType":"contains","source":3016,"target":3272},{"edgeType":"imports","source":1434,"target":1124},{"edgeType":"calls","source":3342,"target":3338},{"edgeType":"contains","source":11183,"target":11186},{"edgeType":"calls","source":6712,"target":6658},{"edgeType":"calls","source":12757,"target":12699},{"edgeType":"calls","source":998,"target":955},{"edgeType":"contains","source":11414,"target":11424},{"edgeType":"contains","source":6891,"target":6825},{"edgeType":"contains","source":8897,"target":9119},{"edgeType":"contains","source":5005,"target":5035},{"edgeType":"contains","source":6261,"target":6272},{"edgeType":"contains","source":10456,"target":10468},{"edgeType":"contains","source":8039,"target":8235},{"edgeType":"calls","source":6001,"target":5472},{"edgeType":"contains","source":12207,"target":12211},{"edgeType":"calls","source":11843,"target":11435},{"edgeType":"calls","source":2070,"target":491},{"edgeType":"contains","source":7087,"target":7093},{"edgeType":"contains","source":1585,"target":1124},{"edgeType":"contains","source":5600,"target":5623},{"edgeType":"calls","source":9022,"target":9040},{"edgeType":"contains","source":11074,"target":10338},{"edgeType":"contains","source":11050,"target":11082},{"edgeType":"imports","source":8011,"target":7591},{"edgeType":"contains","source":11050,"target":11081},{"edgeType":"calls","source":7205,"target":7232},{"edgeType":"calls","source":9386,"target":9384},{"edgeType":"contains","source":899,"target":1250},{"edgeType":"contains","source":6261,"target":6273},{"edgeType":"contains","source":7951,"target":7785},{"edgeType":"contains","source":1603,"target":1628},{"edgeType":"calls","source":2820,"target":491},{"edgeType":"contains","source":8011,"target":8039},{"edgeType":"contains","source":8077,"target":8107},{"edgeType":"contains","source":11183,"target":11184},{"edgeType":"imports","source":899,"target":794},{"edgeType":"calls","source":12368,"target":12079},{"edgeType":"contains","source":5666,"target":5684},{"edgeType":"calls","source":2549,"target":436},{"edgeType":"contains","source":8177,"target":8179},{"edgeType":"contains","source":11108,"target":11394},{"edgeType":"contains","source":11050,"target":11078},{"edgeType":"calls","source":11767,"target":11683},{"edgeType":"contains","source":10583,"target":10757},{"edgeType":"contains","source":4214,"target":4194},{"edgeType":"contains","source":10456,"target":10466},{"edgeType":"contains","source":5005,"target":5041},{"edgeType":"contains","source":8039,"target":8227},{"edgeType":"calls","source":3609,"target":3516},{"edgeType":"contains","source":3817,"target":3815},{"edgeType":"contains","source":4907,"target":4908},{"edgeType":"contains","source":11108,"target":11396},{"edgeType":"contains","source":11183,"target":11185},{"edgeType":"imports","source":12622,"target":12634},{"edgeType":"contains","source":10324,"target":10331},{"edgeType":"contains","source":4639,"target":5816},{"edgeType":"contains","source":6890,"target":6851},{"edgeType":"calls","source":2583,"target":2554},{"edgeType":"imports","source":2727,"target":1205},{"edgeType":"contains","source":7018,"target":7111},{"edgeType":"contains","source":11108,"target":11395},{"edgeType":"contains","source":11276,"target":3016},{"edgeType":"contains","source":10983,"target":11042},{"edgeType":"contains","source":12901,"target":13948},{"edgeType":"contains","source":4510,"target":4530},{"edgeType":"contains","source":6327,"target":6335},{"edgeType":"calls","source":567,"target":568},{"edgeType":"contains","source":10583,"target":10758},{"edgeType":"contains","source":12438,"target":12446},{"edgeType":"contains","source":10456,"target":10467},{"edgeType":"calls","source":1430,"target":1301},{"edgeType":"contains","source":8078,"target":679},{"edgeType":"contains","source":7087,"target":7088},{"edgeType":"calls","source":763,"target":837},{"edgeType":"contains","source":8010,"target":8072},{"edgeType":"imports","source":12259,"target":12261},{"edgeType":"calls","source":12442,"target":11897},{"edgeType":"contains","source":1140,"target":1184},{"edgeType":"contains","source":1347,"target":1106},{"edgeType":"contains","source":8523,"target":626},{"edgeType":"contains","source":4639,"target":5815},{"edgeType":"contains","source":6822,"target":6846},{"edgeType":"contains","source":10390,"target":10396},{"edgeType":"calls","source":3872,"target":3816},{"edgeType":"contains","source":11108,"target":11392},{"edgeType":"contains","source":4575,"target":4628},{"edgeType":"contains","source":12241,"target":12210},{"edgeType":"contains","source":12901,"target":13947},{"edgeType":"contains","source":8078,"target":8079},{"edgeType":"calls","source":1940,"target":1346},{"edgeType":"calls","source":2617,"target":2554},{"edgeType":"contains","source":10583,"target":10755},{"edgeType":"calls","source":12015,"target":2936},{"edgeType":"imports","source":899,"target":793},{"edgeType":"contains","source":5005,"target":5039},{"edgeType":"contains","source":11282,"target":11285},{"edgeType":"imports","source":12892,"target":12723},{"edgeType":"contains","source":1140,"target":1183},{"edgeType":"contains","source":9898,"target":9793},{"edgeType":"contains","source":11644,"target":11690},{"edgeType":"imports","source":12259,"target":12262},{"edgeType":"calls","source":4611,"target":4162},{"edgeType":"contains","source":12438,"target":12444},{"edgeType":"contains","source":12437,"target":12475},{"edgeType":"contains","source":10367,"target":11110},{"edgeType":"contains","source":12407,"target":12348},{"edgeType":"contains","source":8177,"target":8180},{"edgeType":"contains","source":8111,"target":8112},{"edgeType":"contains","source":11210,"target":10345},{"edgeType":"calls","source":3838,"target":3814},{"edgeType":"contains","source":11108,"target":11393},{"edgeType":"imports","source":7128,"target":1144},{"edgeType":"contains","source":4575,"target":4627},{"edgeType":"contains","source":12273,"target":12274},{"edgeType":"contains","source":12901,"target":13946},{"edgeType":"calls","source":11614,"target":11140},{"edgeType":"calls","source":9518,"target":9524},{"edgeType":"imports","source":554,"target":931},{"edgeType":"contains","source":5600,"target":5628},{"edgeType":"contains","source":907,"target":1010},{"edgeType":"calls","source":11887,"target":568},{"edgeType":"contains","source":1603,"target":1632},{"edgeType":"imports","source":7356,"target":405},{"edgeType":"contains","source":8772,"target":8773},{"edgeType":"contains","source":8897,"target":9126},{"edgeType":"contains","source":1140,"target":1186},{"edgeType":"contains","source":10753,"target":10784},{"edgeType":"contains","source":12837,"target":12775},{"edgeType":"imports","source":7469,"target":7472},{"edgeType":"contains","source":4510,"target":4535},{"edgeType":"contains","source":11545,"target":3145},{"edgeType":"contains","source":12,"target":215},{"edgeType":"imports","source":3763,"target":3970},{"edgeType":"contains","source":7781,"target":7783},{"edgeType":"contains","source":5600,"target":5629},{"edgeType":"contains","source":11051,"target":11061},{"edgeType":"calls","source":4334,"target":4290},{"edgeType":"imports","source":2727,"target":1218},{"edgeType":"contains","source":11481,"target":3016},{"edgeType":"calls","source":5228,"target":5116},{"edgeType":"imports","source":12622,"target":12630},{"edgeType":"contains","source":1140,"target":1185},{"edgeType":"contains","source":4907,"target":4912},{"edgeType":"contains","source":8765,"target":8989},{"edgeType":"contains","source":8897,"target":9125},{"edgeType":"contains","source":8704,"target":8765},{"edgeType":"imports","source":12259,"target":12256},{"edgeType":"contains","source":5765,"target":5800},{"edgeType":"imports","source":4131,"target":4190},{"edgeType":"imports","source":3763,"target":3971},{"edgeType":"contains","source":7781,"target":7782},{"edgeType":"contains","source":5883,"target":6370},{"edgeType":"imports","source":10237,"target":3057},{"edgeType":"calls","source":11281,"target":9842},{"edgeType":"calls","source":2513,"target":1549},{"edgeType":"imports","source":10514,"target":10324},{"edgeType":"contains","source":1603,"target":1630},{"edgeType":"calls","source":2991,"target":1526},{"edgeType":"contains","source":12407,"target":12361},{"edgeType":"calls","source":998,"target":947},{"edgeType":"calls","source":6458,"target":6084},{"edgeType":"calls","source":6449,"target":6363},{"edgeType":"contains","source":8897,"target":9128},{"edgeType":"contains","source":8765,"target":8992},{"edgeType":"contains","source":8078,"target":8091},{"edgeType":"contains","source":7283,"target":7366},{"edgeType":"contains","source":3781,"target":3878},{"edgeType":"imports","source":4131,"target":4191},{"edgeType":"calls","source":7173,"target":7174},{"edgeType":"contains","source":11674,"target":11828},{"edgeType":"contains","source":1,"target":6900},{"edgeType":"contains","source":5666,"target":5699},{"edgeType":"calls","source":11272,"target":11175},{"edgeType":"calls","source":2821,"target":454},{"edgeType":"contains","source":4131,"target":4655},{"edgeType":"calls","source":866,"target":810},{"edgeType":"imports","source":10514,"target":10323},{"edgeType":"contains","source":5600,"target":5631},{"edgeType":"contains","source":9002,"target":9043},{"edgeType":"contains","source":8414,"target":8244},{"edgeType":"calls","source":12724,"target":12672},{"edgeType":"contains","source":679,"target":680},{"edgeType":"calls","source":3409,"target":3368},{"edgeType":"contains","source":13066,"target":13072},{"edgeType":"calls","source":1830,"target":523},{"edgeType":"contains","source":4907,"target":4910},{"edgeType":"contains","source":907,"target":1011},{"edgeType":"contains","source":8897,"target":9127},{"edgeType":"contains","source":1140,"target":1187},{"edgeType":"calls","source":1916,"target":1028},{"edgeType":"contains","source":3817,"target":3818},{"edgeType":"calls","source":2754,"target":2532},{"edgeType":"calls","source":5053,"target":1026},{"edgeType":"contains","source":5634,"target":5635},{"edgeType":"contains","source":5600,"target":5632},{"edgeType":"contains","source":5765,"target":5802},{"edgeType":"calls","source":7173,"target":7175},{"edgeType":"contains","source":7781,"target":7784},{"edgeType":"calls","source":1663,"target":1467},{"edgeType":"contains","source":7087,"target":7094},{"edgeType":"imports","source":7673,"target":7495},{"edgeType":"contains","source":10583,"target":10765},{"edgeType":"calls","source":11570,"target":3000},{"edgeType":"contains","source":5600,"target":5624},{"edgeType":"contains","source":5765,"target":5794},{"edgeType":"imports","source":12622,"target":12625},{"edgeType":"contains","source":4676,"target":4679},{"edgeType":"contains","source":3016,"target":3286},{"edgeType":"contains","source":8897,"target":9122},{"edgeType":"calls","source":1854,"target":1888},{"edgeType":"calls","source":7866,"target":491},{"edgeType":"contains","source":3817,"target":3825},{"edgeType":"calls","source":1986,"target":2024},{"edgeType":"contains","source":12441,"target":2849},{"edgeType":"contains","source":1140,"target":1190},{"edgeType":"imports","source":8011,"target":7588},{"edgeType":"contains","source":10753,"target":10780},{"edgeType":"calls","source":799,"target":768},{"edgeType":"imports","source":12432,"target":12173},{"edgeType":"contains","source":1,"target":6902},{"edgeType":"imports","source":7908,"target":7610},{"edgeType":"contains","source":12077,"target":12019},{"edgeType":"calls","source":4762,"target":4761},{"edgeType":"calls","source":12857,"target":12785},{"edgeType":"calls","source":7173,"target":7176},{"edgeType":"contains","source":8111,"target":8119},{"edgeType":"imports","source":1347,"target":655},{"edgeType":"calls","source":10543,"target":10526},{"edgeType":"calls","source":1855,"target":1856},{"edgeType":"contains","source":2562,"target":2563},{"edgeType":"contains","source":8897,"target":9121},{"edgeType":"contains","source":899,"target":1261},{"edgeType":"contains","source":4841,"target":4848},{"edgeType":"contains","source":2727,"target":2733},{"edgeType":"contains","source":1140,"target":1189},{"edgeType":"contains","source":10753,"target":10781},{"edgeType":"contains","source":12273,"target":12284},{"edgeType":"contains","source":8897,"target":9120},{"edgeType":"contains","source":11414,"target":11431},{"edgeType":"calls","source":12463,"target":12314},{"edgeType":"calls","source":1167,"target":986},{"edgeType":"contains","source":3652,"target":3654},{"edgeType":"contains","source":12077,"target":12018},{"edgeType":"contains","source":4131,"target":5716},{"edgeType":"contains","source":10456,"target":10472},{"edgeType":"contains","source":10583,"target":10763},{"edgeType":"contains","source":1470,"target":1529},{"edgeType":"contains","source":5600,"target":5626},{"edgeType":"contains","source":8897,"target":9124},{"edgeType":"contains","source":907,"target":1016},{"edgeType":"contains","source":4676,"target":4677},{"edgeType":"contains","source":11414,"target":11428},{"edgeType":"contains","source":8772,"target":8770},{"edgeType":"contains","source":1140,"target":1192},{"edgeType":"calls","source":1167,"target":989},{"edgeType":"calls","source":3309,"target":3291},{"edgeType":"contains","source":4510,"target":4537},{"edgeType":"contains","source":12437,"target":12484},{"edgeType":"contains","source":6261,"target":6276},{"edgeType":"calls","source":12857,"target":12783},{"edgeType":"contains","source":8111,"target":8121},{"edgeType":"calls","source":763,"target":829},{"edgeType":"contains","source":12,"target":220},{"edgeType":"contains","source":5600,"target":5627},{"edgeType":"contains","source":907,"target":1015},{"edgeType":"calls","source":12575,"target":2498},{"edgeType":"contains","source":8897,"target":9123},{"edgeType":"contains","source":11414,"target":11429},{"edgeType":"contains","source":547,"target":548},{"edgeType":"contains","source":2726,"target":2762},{"edgeType":"calls","source":9948,"target":9944},{"edgeType":"contains","source":1140,"target":1191},{"edgeType":"contains","source":10753,"target":10779},{"edgeType":"contains","source":5765,"target":5798},{"edgeType":"calls","source":5885,"target":5850},{"edgeType":"calls","source":1028,"target":1031},{"edgeType":"calls","source":467,"target":452},{"edgeType":"contains","source":6142,"target":2543},{"edgeType":"contains","source":6654,"target":6755},{"edgeType":"contains","source":2657,"target":2759},{"edgeType":"contains","source":4708,"target":4715},{"edgeType":"imports","source":4131,"target":4247},{"edgeType":"calls","source":2647,"target":2638},{"edgeType":"calls","source":10441,"target":10486},{"edgeType":"contains","source":12668,"target":12704},{"edgeType":"contains","source":3594,"target":3310},{"edgeType":"calls","source":5018,"target":4187},{"edgeType":"contains","source":5600,"target":5604},{"edgeType":"contains","source":3320,"target":3346},{"edgeType":"contains","source":5666,"target":5672},{"edgeType":"calls","source":9154,"target":9159},{"edgeType":"calls","source":12926,"target":12731},{"edgeType":"contains","source":2131,"target":2153},{"edgeType":"calls","source":1870,"target":1354},{"edgeType":"calls","source":7927,"target":687},{"edgeType":"imports","source":7583,"target":1881},{"edgeType":"contains","source":2657,"target":2760},{"edgeType":"calls","source":6082,"target":6084},{"edgeType":"calls","source":12061,"target":436},{"edgeType":"contains","source":11972,"target":12081},{"edgeType":"contains","source":11410,"target":11534},{"edgeType":"calls","source":7073,"target":7077},{"edgeType":"calls","source":9154,"target":9158},{"edgeType":"imports","source":12499,"target":12273},{"edgeType":"contains","source":5666,"target":5673},{"edgeType":"contains","source":7282,"target":7371},{"edgeType":"calls","source":9055,"target":9056},{"edgeType":"imports","source":12428,"target":2847},{"edgeType":"contains","source":10983,"target":11027},{"edgeType":"calls","source":5966,"target":4394},{"edgeType":"calls","source":4595,"target":4613},{"edgeType":"calls","source":1614,"target":837},{"edgeType":"calls","source":5986,"target":5888},{"edgeType":"calls","source":2040,"target":1372},{"edgeType":"contains","source":2657,"target":2757},{"edgeType":"calls","source":5524,"target":5411},{"edgeType":"contains","source":5666,"target":5674},{"edgeType":"imports","source":6879,"target":6795},{"edgeType":"contains","source":3320,"target":3344},{"edgeType":"contains","source":1603,"target":1606},{"edgeType":"calls","source":7230,"target":1154},{"edgeType":"calls","source":9022,"target":9025},{"edgeType":"contains","source":7415,"target":7477},{"edgeType":"contains","source":7283,"target":7341},{"edgeType":"calls","source":8824,"target":8821},{"edgeType":"contains","source":3495,"target":3204},{"edgeType":"contains","source":11644,"target":11678},{"edgeType":"contains","source":12,"target":191},{"edgeType":"calls","source":12004,"target":11714},{"edgeType":"contains","source":6142,"target":2546},{"edgeType":"contains","source":2131,"target":2151},{"edgeType":"calls","source":9640,"target":436},{"edgeType":"contains","source":6592,"target":6566},{"edgeType":"contains","source":10753,"target":10759},{"edgeType":"calls","source":12226,"target":12231},{"edgeType":"contains","source":8039,"target":8217},{"edgeType":"contains","source":907,"target":986},{"edgeType":"contains","source":8077,"target":8096},{"edgeType":"calls","source":9981,"target":436},{"edgeType":"contains","source":2657,"target":2758},{"edgeType":"calls","source":4232,"target":4238},{"edgeType":"contains","source":8507,"target":8508},{"edgeType":"contains","source":5666,"target":5675},{"edgeType":"contains","source":1966,"target":1981},{"edgeType":"contains","source":7282,"target":7373},{"edgeType":"calls","source":3210,"target":3150},{"edgeType":"calls","source":1238,"target":859},{"edgeType":"contains","source":11116,"target":11130},{"edgeType":"contains","source":8678,"target":2144},{"edgeType":"contains","source":4133,"target":4574},{"edgeType":"contains","source":4510,"target":4515},{"edgeType":"contains","source":2396,"target":2398},{"edgeType":"imports","source":9170,"target":5542},{"edgeType":"contains","source":381,"target":383},{"edgeType":"imports","source":1954,"target":907},{"edgeType":"contains","source":6690,"target":6692},{"edgeType":"imports","source":7356,"target":1524},{"edgeType":"calls","source":7704,"target":7603},{"edgeType":"contains","source":4378,"target":4379},{"edgeType":"contains","source":1673,"target":1556},{"edgeType":"calls","source":5554,"target":5536},{"edgeType":"contains","source":12735,"target":12737},{"edgeType":"contains","source":8039,"target":8212},{"edgeType":"calls","source":12822,"target":12788},{"edgeType":"contains","source":907,"target":989},{"edgeType":"contains","source":6062,"target":6076},{"edgeType":"contains","source":11541,"target":11696},{"edgeType":"contains","source":7780,"target":7785},{"edgeType":"contains","source":9506,"target":10301},{"edgeType":"contains","source":6142,"target":2539},{"edgeType":"contains","source":11674,"target":11803},{"edgeType":"contains","source":2585,"target":2882},{"edgeType":"calls","source":12258,"target":1732},{"edgeType":"contains","source":10983,"target":11026},{"edgeType":"calls","source":2056,"target":1926},{"edgeType":"contains","source":10389,"target":3014},{"edgeType":"contains","source":4133,"target":4573},{"edgeType":"contains","source":381,"target":382},{"edgeType":"calls","source":12953,"target":12954},{"edgeType":"contains","source":10686,"target":10720},{"edgeType":"contains","source":12140,"target":12154},{"edgeType":"calls","source":9022,"target":9026},{"edgeType":"contains","source":11183,"target":11168},{"edgeType":"contains","source":6062,"target":6077},{"edgeType":"calls","source":3115,"target":2925},{"edgeType":"contains","source":11410,"target":11530},{"edgeType":"contains","source":5666,"target":5669},{"edgeType":"contains","source":10355,"target":10407},{"edgeType":"contains","source":2657,"target":2761},{"edgeType":"calls","source":4669,"target":4429},{"edgeType":"contains","source":2131,"target":2154},{"edgeType":"contains","source":6752,"target":6886},{"edgeType":"calls","source":9683,"target":9679},{"edgeType":"calls","source":11546,"target":10059},{"edgeType":"contains","source":4444,"target":4445},{"edgeType":"contains","source":6654,"target":6753},{"edgeType":"calls","source":6743,"target":6742},{"edgeType":"calls","source":8717,"target":8971},{"edgeType":"contains","source":10091,"target":10135},{"edgeType":"contains","source":11972,"target":12076},{"edgeType":"contains","source":9860,"target":9897},{"edgeType":"contains","source":9852,"target":10145},{"edgeType":"contains","source":11541,"target":11694},{"edgeType":"contains","source":5761,"target":4839},{"edgeType":"imports","source":4131,"target":4253},{"edgeType":"contains","source":4113,"target":4134},{"edgeType":"calls","source":9881,"target":9882},{"edgeType":"contains","source":6917,"target":7057},{"edgeType":"calls","source":1953,"target":1950},{"edgeType":"contains","source":6142,"target":2542},{"edgeType":"contains","source":1,"target":2650},{"edgeType":"contains","source":6654,"target":6754},{"edgeType":"calls","source":7900,"target":7872},{"edgeType":"calls","source":12027,"target":2549},{"edgeType":"contains","source":2131,"target":2155},{"edgeType":"contains","source":8375,"target":8367},{"edgeType":"contains","source":2396,"target":2397},{"edgeType":"contains","source":381,"target":384},{"edgeType":"contains","source":10653,"target":10683},{"edgeType":"calls","source":11160,"target":3000},{"edgeType":"calls","source":10242,"target":10318},{"edgeType":"contains","source":7282,"target":7369},{"edgeType":"imports","source":7583,"target":1887},{"edgeType":"contains","source":9342,"target":9044},{"edgeType":"imports","source":9194,"target":568},{"edgeType":"contains","source":10091,"target":10136},{"edgeType":"imports","source":10841,"target":10818},{"edgeType":"calls","source":10376,"target":10392},{"edgeType":"contains","source":5666,"target":5671},{"edgeType":"contains","source":11541,"target":11695},{"edgeType":"contains","source":5600,"target":5603},{"edgeType":"contains","source":11644,"target":11673},{"edgeType":"contains","source":13725,"target":13754},{"edgeType":"contains","source":8077,"target":8103},{"edgeType":"contains","source":8925,"target":842},{"edgeType":"calls","source":1327,"target":1267},{"edgeType":"contains","source":7282,"target":7379},{"edgeType":"contains","source":7283,"target":7348},{"edgeType":"calls","source":12231,"target":2572},{"edgeType":"contains","source":2585,"target":2885},{"edgeType":"contains","source":4444,"target":4451},{"edgeType":"contains","source":11644,"target":11687},{"edgeType":"contains","source":381,"target":387},{"edgeType":"contains","source":4131,"target":4640},{"edgeType":"contains","source":11108,"target":11390},{"edgeType":"calls","source":1559,"target":1474},{"edgeType":"contains","source":5666,"target":5680},{"edgeType":"contains","source":6261,"target":6262},{"edgeType":"contains","source":12437,"target":12474},{"edgeType":"contains","source":4350,"target":4194},{"edgeType":"contains","source":10323,"target":10357},{"edgeType":"contains","source":10324,"target":10326},{"edgeType":"contains","source":4378,"target":4383},{"edgeType":"contains","source":8375,"target":8379},{"edgeType":"contains","source":12901,"target":13945},{"edgeType":"contains","source":5005,"target":5029},{"edgeType":"contains","source":6891,"target":6815},{"edgeType":"contains","source":10884,"target":10935},{"edgeType":"calls","source":3241,"target":3243},{"edgeType":"calls","source":7321,"target":454},{"edgeType":"calls","source":5984,"target":5943},{"edgeType":"contains","source":7282,"target":7380},{"edgeType":"contains","source":11282,"target":11283},{"edgeType":"contains","source":11972,"target":12089},{"edgeType":"contains","source":381,"target":386},{"edgeType":"calls","source":467,"target":443},{"edgeType":"contains","source":1,"target":2652},{"edgeType":"imports","source":5977,"target":921},{"edgeType":"imports","source":6305,"target":266},{"edgeType":"contains","source":11675,"target":11784},{"edgeType":"contains","source":8375,"target":8378},{"edgeType":"contains","source":10390,"target":10395},{"edgeType":"contains","source":11108,"target":11391},{"edgeType":"contains","source":12437,"target":12473},{"edgeType":"calls","source":4365,"target":4337},{"edgeType":"contains","source":4312,"target":4314},{"edgeType":"contains","source":4345,"target":4348},{"edgeType":"contains","source":5666,"target":5681},{"edgeType":"contains","source":2264,"target":2267},{"edgeType":"contains","source":6327,"target":6331},{"edgeType":"calls","source":2086,"target":2052},{"edgeType":"calls","source":5126,"target":5058},{"edgeType":"contains","source":12901,"target":13944},{"edgeType":"contains","source":6891,"target":6816},{"edgeType":"imports","source":899,"target":854},{"edgeType":"contains","source":2585,"target":2883},{"edgeType":"contains","source":381,"target":389},{"edgeType":"calls","source":1158,"target":1223},{"edgeType":"contains","source":11410,"target":11540},{"edgeType":"contains","source":4133,"target":4576},{"edgeType":"contains","source":10323,"target":10354},{"edgeType":"contains","source":11972,"target":12088},{"edgeType":"contains","source":5666,"target":5682},{"edgeType":"contains","source":2345,"target":1867},{"edgeType":"contains","source":4312,"target":4313},{"edgeType":"calls","source":5171,"target":491},{"edgeType":"contains","source":9002,"target":9027},{"edgeType":"imports","source":13058,"target":12906},{"edgeType":"contains","source":12437,"target":12472},{"edgeType":"contains","source":6327,"target":6332},{"edgeType":"contains","source":8210,"target":8211},{"edgeType":"imports","source":2480,"target":1524},{"edgeType":"imports","source":402,"target":405},{"edgeType":"contains","source":12901,"target":13943},{"edgeType":"contains","source":6822,"target":6842},{"edgeType":"contains","source":2585,"target":2884},{"edgeType":"calls","source":1267,"target":1014},{"edgeType":"contains","source":8039,"target":8225},{"edgeType":"contains","source":11675,"target":11782},{"edgeType":"contains","source":381,"target":388},{"edgeType":"contains","source":5666,"target":5683},{"edgeType":"contains","source":11905,"target":12050},{"edgeType":"contains","source":11950,"target":11712},{"edgeType":"contains","source":4345,"target":4346},{"edgeType":"contains","source":4384,"target":4194},{"edgeType":"contains","source":6327,"target":6333},{"edgeType":"imports","source":6607,"target":420},{"edgeType":"contains","source":10324,"target":10325},{"edgeType":"contains","source":10884,"target":10934},{"edgeType":"contains","source":12901,"target":13942},{"edgeType":"contains","source":8767,"target":8907},{"edgeType":"calls","source":7107,"target":7091},{"edgeType":"calls","source":10941,"target":9798},{"edgeType":"contains","source":8010,"target":8062},{"edgeType":"contains","source":11905,"target":12049},{"edgeType":"calls","source":12404,"target":2498},{"edgeType":"calls","source":5152,"target":4249},{"edgeType":"contains","source":5666,"target":5676},{"edgeType":"contains","source":10456,"target":10458},{"edgeType":"contains","source":12438,"target":12439},{"edgeType":"contains","source":3016,"target":3269},{"edgeType":"contains","source":9002,"target":9021},{"edgeType":"contains","source":10686,"target":10727},{"edgeType":"calls","source":172,"target":72},{"edgeType":"imports","source":6877,"target":6851},{"edgeType":"contains","source":12901,"target":13941},{"edgeType":"contains","source":2891,"target":2916},{"edgeType":"contains","source":12901,"target":13940},{"edgeType":"contains","source":11414,"target":11415},{"edgeType":"contains","source":11713,"target":3203},{"edgeType":"calls","source":6813,"target":6693},{"edgeType":"contains","source":7976,"target":8058},{"edgeType":"contains","source":11972,"target":12085},{"edgeType":"calls","source":937,"target":667},{"edgeType":"contains","source":10321,"target":3016},{"edgeType":"contains","source":4180,"target":4182},{"edgeType":"calls","source":5239,"target":4722},{"edgeType":"imports","source":4131,"target":4244},{"edgeType":"imports","source":12499,"target":12261},{"edgeType":"contains","source":5666,"target":5677},{"edgeType":"contains","source":2264,"target":2271},{"edgeType":"calls","source":8505,"target":8149},{"edgeType":"contains","source":7283,"target":7344},{"edgeType":"imports","source":2137,"target":1584},{"edgeType":"imports","source":2350,"target":266},{"edgeType":"contains","source":5005,"target":5032},{"edgeType":"contains","source":12901,"target":13939},{"edgeType":"contains","source":7415,"target":7482},{"edgeType":"calls","source":11830,"target":11834},{"edgeType":"calls","source":8368,"target":8170},{"edgeType":"contains","source":1140,"target":1176},{"edgeType":"contains","source":11972,"target":12084},{"edgeType":"imports","source":1497,"target":1339},{"edgeType":"imports","source":1347,"target":704},{"edgeType":"contains","source":5666,"target":5678},{"edgeType":"contains","source":8375,"target":8377},{"edgeType":"contains","source":4180,"target":4181},{"edgeType":"contains","source":6327,"target":6328},{"edgeType":"contains","source":12668,"target":12706},{"edgeType":"contains","source":11410,"target":11535},{"edgeType":"contains","source":7283,"target":7345},{"edgeType":"contains","source":5005,"target":5031},{"edgeType":"contains","source":3016,"target":3267},{"edgeType":"calls","source":1897,"target":1564},{"edgeType":"contains","source":9002,"target":9023},{"edgeType":"calls","source":4847,"target":4187},{"edgeType":"contains","source":9465,"target":9468},{"edgeType":"calls","source":2068,"target":491},{"edgeType":"contains","source":7583,"target":1218},{"edgeType":"calls","source":700,"target":617},{"edgeType":"contains","source":7282,"target":7378},{"edgeType":"contains","source":7283,"target":7347},{"edgeType":"contains","source":381,"target":392},{"edgeType":"contains","source":8010,"target":8063},{"edgeType":"contains","source":8039,"target":8221},{"edgeType":"calls","source":9062,"target":8853},{"edgeType":"calls","source":6006,"target":1026},{"edgeType":"contains","source":6327,"target":6329},{"edgeType":"calls","source":2344,"target":390},{"edgeType":"contains","source":3016,"target":3268},{"edgeType":"contains","source":6891,"target":6814},{"edgeType":"calls","source":5796,"target":4365},{"edgeType":"contains","source":7282,"target":7377},{"edgeType":"contains","source":7283,"target":7346},{"edgeType":"contains","source":11410,"target":11536},{"edgeType":"contains","source":907,"target":998},{"edgeType":"imports","source":4131,"target":4230},{"edgeType":"imports","source":7072,"target":2908},{"edgeType":"calls","source":10526,"target":436},{"edgeType":"calls","source":9058,"target":491},{"edgeType":"contains","source":7629,"target":1882},{"edgeType":"contains","source":13098,"target":13099},{"edgeType":"calls","source":8995,"target":8786},{"edgeType":"contains","source":12,"target":174},{"edgeType":"calls","source":7238,"target":7230},{"edgeType":"contains","source":12895,"target":13049},{"edgeType":"contains","source":4133,"target":4554},{"edgeType":"contains","source":13725,"target":13745},{"edgeType":"contains","source":4281,"target":4194},{"edgeType":"imports","source":1954,"target":895},{"edgeType":"contains","source":10490,"target":10440},{"edgeType":"contains","source":10323,"target":10332},{"edgeType":"contains","source":12239,"target":12245},{"edgeType":"contains","source":8572,"target":8588},{"edgeType":"contains","source":10893,"target":3233},{"edgeType":"contains","source":10719,"target":10741},{"edgeType":"contains","source":11050,"target":11051},{"edgeType":"contains","source":13725,"target":13744},{"edgeType":"contains","source":1966,"target":1967},{"edgeType":"contains","source":6062,"target":6065},{"edgeType":"contains","source":12895,"target":13048},{"edgeType":"imports","source":3234,"target":3495},{"edgeType":"contains","source":12140,"target":12142},{"edgeType":"contains","source":2244,"target":1805},{"edgeType":"contains","source":8077,"target":8078},{"edgeType":"calls","source":5797,"target":4365},{"edgeType":"contains","source":2849,"target":3133},{"edgeType":"contains","source":4672,"target":4756},{"edgeType":"contains","source":4510,"target":4492},{"edgeType":"calls","source":4937,"target":4598},{"edgeType":"contains","source":12670,"target":12623},{"edgeType":"contains","source":5229,"target":5458},{"edgeType":"contains","source":7317,"target":7328},{"edgeType":"calls","source":4991,"target":5038},{"edgeType":"contains","source":11108,"target":11364},{"edgeType":"calls","source":8995,"target":8788},{"edgeType":"calls","source":1128,"target":1121},{"edgeType":"contains","source":13725,"target":13743},{"edgeType":"contains","source":10323,"target":10330},{"edgeType":"contains","source":6062,"target":6066},{"edgeType":"contains","source":4079,"target":4112},{"edgeType":"contains","source":11108,"target":11363},{"edgeType":"contains","source":12892,"target":13140},{"edgeType":"contains","source":4672,"target":4755},{"edgeType":"contains","source":10090,"target":10154},{"edgeType":"calls","source":2614,"target":2618},{"edgeType":"contains","source":8039,"target":8202},{"edgeType":"calls","source":9844,"target":9952},{"edgeType":"imports","source":13058,"target":12898},{"edgeType":"contains","source":2849,"target":3130},{"edgeType":"calls","source":6265,"target":4654},{"edgeType":"calls","source":1392,"target":1392},{"edgeType":"contains","source":4079,"target":4110},{"edgeType":"contains","source":11116,"target":11117},{"edgeType":"contains","source":11108,"target":11365},{"edgeType":"contains","source":11422,"target":12201},{"edgeType":"contains","source":3815,"target":3838},{"edgeType":"contains","source":7317,"target":7329},{"edgeType":"contains","source":6062,"target":6067},{"edgeType":"contains","source":13725,"target":13742},{"edgeType":"contains","source":4113,"target":4114},{"edgeType":"contains","source":899,"target":1217},{"edgeType":"contains","source":8039,"target":8201},{"edgeType":"calls","source":1854,"target":1868},{"edgeType":"calls","source":12159,"target":11120},{"edgeType":"contains","source":5005,"target":5009},{"edgeType":"contains","source":907,"target":973},{"edgeType":"contains","source":2891,"target":2892},{"edgeType":"contains","source":7218,"target":7220},{"edgeType":"contains","source":13725,"target":13741},{"edgeType":"contains","source":10323,"target":10328},{"edgeType":"contains","source":8176,"target":8177},{"edgeType":"contains","source":11108,"target":11361},{"edgeType":"contains","source":12895,"target":13045},{"edgeType":"contains","source":12892,"target":13138},{"edgeType":"contains","source":4453,"target":4151},{"edgeType":"contains","source":1,"target":11089},{"edgeType":"contains","source":12437,"target":12445},{"edgeType":"contains","source":7281,"target":7382},{"edgeType":"contains","source":5005,"target":5008},{"edgeType":"calls","source":1327,"target":230},{"edgeType":"imports","source":4131,"target":4235},{"edgeType":"calls","source":2479,"target":2574},{"edgeType":"contains","source":10323,"target":10329},{"edgeType":"contains","source":11675,"target":11755},{"edgeType":"contains","source":4079,"target":4117},{"edgeType":"contains","source":12373,"target":12314},{"edgeType":"calls","source":4610,"target":4162},{"edgeType":"contains","source":1867,"target":1869},{"edgeType":"contains","source":11108,"target":11362},{"edgeType":"imports","source":554,"target":952},{"edgeType":"contains","source":12239,"target":12240},{"edgeType":"contains","source":12895,"target":13044},{"edgeType":"contains","source":8678,"target":2127},{"edgeType":"contains","source":10813,"target":10994},{"edgeType":"calls","source":4497,"target":4494},{"edgeType":"calls","source":6265,"target":4651},{"edgeType":"contains","source":907,"target":975},{"edgeType":"calls","source":10458,"target":436},{"edgeType":"contains","source":5005,"target":5007},{"edgeType":"contains","source":7317,"target":7324},{"edgeType":"calls","source":665,"target":671},{"edgeType":"calls","source":5484,"target":4550},{"edgeType":"contains","source":9860,"target":9880},{"edgeType":"contains","source":11905,"target":12022},{"edgeType":"contains","source":13725,"target":13739},{"edgeType":"calls","source":6516,"target":6363},{"edgeType":"contains","source":11082,"target":11108},{"edgeType":"contains","source":11108,"target":11359},{"edgeType":"calls","source":4630,"target":4598},{"edgeType":"contains","source":4247,"target":4193},{"edgeType":"contains","source":10583,"target":10722},{"edgeType":"contains","source":2849,"target":3134},{"edgeType":"contains","source":12,"target":180},{"edgeType":"contains","source":12305,"target":12307},{"edgeType":"contains","source":6654,"target":6736},{"edgeType":"contains","source":1,"target":11091},{"edgeType":"calls","source":1463,"target":1301},{"edgeType":"contains","source":5883,"target":6326},{"edgeType":"contains","source":7282,"target":7353},{"edgeType":"contains","source":10090,"target":10150},{"edgeType":"contains","source":891,"target":1470},{"edgeType":"contains","source":5005,"target":5006},{"edgeType":"contains","source":7317,"target":7325},{"edgeType":"imports","source":10237,"target":3100},{"edgeType":"contains","source":7629,"target":1881},{"edgeType":"contains","source":13725,"target":13738},{"edgeType":"contains","source":10323,"target":10327},{"edgeType":"imports","source":12622,"target":12670},{"edgeType":"imports","source":6568,"target":568},{"edgeType":"imports","source":10514,"target":10369},{"edgeType":"contains","source":11108,"target":11360},{"edgeType":"contains","source":6062,"target":6063},{"edgeType":"contains","source":2849,"target":3135},{"edgeType":"calls","source":11416,"target":10903},{"edgeType":"contains","source":10813,"target":10992},{"edgeType":"calls","source":2489,"target":148},{"edgeType":"contains","source":7019,"target":7059},{"edgeType":"calls","source":12160,"target":12156},{"edgeType":"calls","source":975,"target":568},{"edgeType":"contains","source":2891,"target":2896},{"edgeType":"contains","source":11050,"target":11058},{"edgeType":"contains","source":6855,"target":6858},{"edgeType":"contains","source":4844,"target":4719},{"edgeType":"imports","source":891,"target":1087},{"edgeType":"contains","source":3320,"target":3338},{"edgeType":"contains","source":8077,"target":8087},{"edgeType":"contains","source":8771,"target":8770},{"edgeType":"contains","source":8766,"target":8925},{"edgeType":"contains","source":10091,"target":10133},{"edgeType":"contains","source":7415,"target":7467},{"edgeType":"contains","source":11410,"target":11525},{"edgeType":"contains","source":1966,"target":1974},{"edgeType":"contains","source":13725,"target":13753},{"edgeType":"calls","source":7370,"target":7375},{"edgeType":"calls","source":5847,"target":693},{"edgeType":"imports","source":7673,"target":7525},{"edgeType":"contains","source":2726,"target":2727},{"edgeType":"calls","source":5888,"target":5764},{"edgeType":"contains","source":12697,"target":12852},{"edgeType":"contains","source":1041,"target":1050},{"edgeType":"contains","source":4840,"target":4842},{"edgeType":"contains","source":6654,"target":6747},{"edgeType":"contains","source":10091,"target":10134},{"edgeType":"contains","source":8766,"target":8924},{"edgeType":"calls","source":9062,"target":8831},{"edgeType":"contains","source":12310,"target":11108},{"edgeType":"contains","source":12285,"target":11883},{"edgeType":"contains","source":5765,"target":5767},{"edgeType":"contains","source":9860,"target":9896},{"edgeType":"calls","source":10903,"target":10957},{"edgeType":"calls","source":11200,"target":11263},{"edgeType":"contains","source":11905,"target":12036},{"edgeType":"contains","source":4079,"target":4121},{"edgeType":"imports","source":7767,"target":7779},{"edgeType":"contains","source":9002,"target":9011},{"edgeType":"contains","source":2891,"target":2894},{"edgeType":"contains","source":10355,"target":10403},{"edgeType":"calls","source":10970,"target":10990},{"edgeType":"contains","source":4873,"target":4875},{"edgeType":"contains","source":10686,"target":10712},{"edgeType":"imports","source":12895,"target":3144},{"edgeType":"contains","source":7317,"target":7336},{"edgeType":"calls","source":1884,"target":1988},{"edgeType":"contains","source":11410,"target":11523},{"edgeType":"contains","source":1867,"target":1870},{"edgeType":"contains","source":7282,"target":7364},{"edgeType":"contains","source":3781,"target":3845},{"edgeType":"contains","source":6062,"target":6074},{"edgeType":"calls","source":11646,"target":11175},{"edgeType":"calls","source":11607,"target":1814},{"edgeType":"contains","source":4113,"target":4123},{"edgeType":"contains","source":12152,"target":1205},{"edgeType":"contains","source":5005,"target":5010},{"edgeType":"calls","source":6743,"target":6730},{"edgeType":"contains","source":10355,"target":10404},{"edgeType":"contains","source":3152,"target":3260},{"edgeType":"contains","source":10091,"target":10132},{"edgeType":"contains","source":1768,"target":1769},{"edgeType":"contains","source":7282,"target":7365},{"edgeType":"contains","source":7317,"target":7337},{"edgeType":"contains","source":11410,"target":11524},{"edgeType":"calls","source":11296,"target":3000},{"edgeType":"contains","source":11712,"target":11675},{"edgeType":"contains","source":4510,"target":4499},{"edgeType":"contains","source":6062,"target":6075},{"edgeType":"contains","source":5666,"target":5667},{"edgeType":"imports","source":4131,"target":4226},{"edgeType":"calls","source":2334,"target":717},{"edgeType":"contains","source":13098,"target":13103},{"edgeType":"calls","source":3506,"target":3496},{"edgeType":"contains","source":5005,"target":5017},{"edgeType":"contains","source":6891,"target":6795},{"edgeType":"contains","source":11410,"target":11521},{"edgeType":"contains","source":7187,"target":7132},{"edgeType":"contains","source":10951,"target":10952},{"edgeType":"contains","source":7317,"target":7330},{"edgeType":"calls","source":1873,"target":2323},{"edgeType":"contains","source":11541,"target":11688},{"edgeType":"calls","source":10441,"target":10482},{"edgeType":"imports","source":891,"target":1083},{"edgeType":"contains","source":3320,"target":3342},{"edgeType":"calls","source":830,"target":831},{"edgeType":"contains","source":13725,"target":13749},{"edgeType":"contains","source":1603,"target":1604},{"edgeType":"calls","source":7504,"target":7452},{"edgeType":"calls","source":1121,"target":266},{"edgeType":"contains","source":8164,"target":4329},{"edgeType":"calls","source":7384,"target":602},{"edgeType":"imports","source":7637,"target":7588},{"edgeType":"calls","source":9154,"target":9155},{"edgeType":"calls","source":7524,"target":491},{"edgeType":"contains","source":13098,"target":13102},{"edgeType":"contains","source":907,"target":980},{"edgeType":"contains","source":7317,"target":7331},{"edgeType":"calls","source":5966,"target":4399},{"edgeType":"contains","source":7629,"target":1887},{"edgeType":"contains","source":11713,"target":3186},{"edgeType":"contains","source":13725,"target":13748},{"edgeType":"calls","source":3306,"target":3354},{"edgeType":"contains","source":10323,"target":10337},{"edgeType":"contains","source":1867,"target":1877},{"edgeType":"contains","source":8077,"target":8082},{"edgeType":"imports","source":9170,"target":5515},{"edgeType":"contains","source":907,"target":983},{"edgeType":"contains","source":4708,"target":4709},{"edgeType":"contains","source":11422,"target":12204},{"edgeType":"calls","source":10080,"target":10048},{"edgeType":"calls","source":5863,"target":5477},{"edgeType":"contains","source":13098,"target":13101},{"edgeType":"calls","source":2019,"target":2027},{"edgeType":"calls","source":2040,"target":1376},{"edgeType":"contains","source":11545,"target":11562},{"edgeType":"contains","source":13725,"target":13747},{"edgeType":"imports","source":1139,"target":2906},{"edgeType":"contains","source":12077,"target":11984},{"edgeType":"calls","source":9154,"target":9157},{"edgeType":"calls","source":3175,"target":3184},{"edgeType":"calls","source":11262,"target":3000},{"edgeType":"contains","source":8176,"target":8187},{"edgeType":"calls","source":3043,"target":3048},{"edgeType":"contains","source":11905,"target":12029},{"edgeType":"contains","source":6327,"target":6312},{"edgeType":"contains","source":11972,"target":12066},{"edgeType":"contains","source":10583,"target":10731},{"edgeType":"contains","source":6822,"target":6823},{"edgeType":"calls","source":11896,"target":11887},{"edgeType":"contains","source":11713,"target":3184},{"edgeType":"contains","source":7282,"target":7361},{"edgeType":"calls","source":6082,"target":6086},{"edgeType":"contains","source":13098,"target":13100},{"edgeType":"contains","source":7019,"target":7058},{"edgeType":"calls","source":4774,"target":4353},{"edgeType":"contains","source":10868,"target":10352},{"edgeType":"contains","source":13725,"target":13746},{"edgeType":"calls","source":9154,"target":9156},{"edgeType":"calls","source":11830,"target":4419},{"edgeType":"contains","source":8176,"target":8186},{"edgeType":"contains","source":7975,"target":8075},{"edgeType":"contains","source":8039,"target":8205},{"edgeType":"contains","source":11644,"target":11646},{"edgeType":"contains","source":10983,"target":10996},{"edgeType":"contains","source":12895,"target":13033},{"edgeType":"contains","source":12892,"target":13126},{"edgeType":"contains","source":4079,"target":4097},{"edgeType":"calls","source":12065,"target":12037},{"edgeType":"contains","source":8968,"target":8981},{"edgeType":"contains","source":8373,"target":8399},{"edgeType":"contains","source":6752,"target":6855},{"edgeType":"contains","source":6623,"target":6626},{"edgeType":"contains","source":4575,"target":4577},{"edgeType":"contains","source":7844,"target":7886},{"edgeType":"contains","source":8572,"target":8573},{"edgeType":"calls","source":1353,"target":568},{"edgeType":"contains","source":1007,"target":1023},{"edgeType":"contains","source":2460,"target":2490},{"edgeType":"contains","source":10686,"target":10690},{"edgeType":"calls","source":10632,"target":436},{"edgeType":"contains","source":3154,"target":3174},{"edgeType":"calls","source":4987,"target":4190},{"edgeType":"calls","source":2583,"target":2607},{"edgeType":"calls","source":6682,"target":6612},{"edgeType":"calls","source":11470,"target":3000},{"edgeType":"contains","source":4079,"target":4096},{"edgeType":"contains","source":8968,"target":8980},{"edgeType":"contains","source":12895,"target":13032},{"edgeType":"contains","source":12892,"target":13125},{"edgeType":"contains","source":10813,"target":10982},{"edgeType":"calls","source":12369,"target":2614},{"edgeType":"calls","source":8248,"target":348},{"edgeType":"contains","source":6623,"target":6627},{"edgeType":"calls","source":8260,"target":1033},{"edgeType":"contains","source":8362,"target":8739},{"edgeType":"contains","source":545,"target":546},{"edgeType":"contains","source":2849,"target":3117},{"edgeType":"contains","source":10201,"target":9870},{"edgeType":"calls","source":1452,"target":669},{"edgeType":"contains","source":2460,"target":2491},{"edgeType":"contains","source":7844,"target":7885},{"edgeType":"imports","source":4131,"target":4281},{"edgeType":"contains","source":2350,"target":1673},{"edgeType":"contains","source":3016,"target":3225},{"edgeType":"contains","source":1510,"target":2345},{"edgeType":"contains","source":11713,"target":3165},{"edgeType":"calls","source":4939,"target":4620},{"edgeType":"imports","source":9953,"target":9836},{"edgeType":"contains","source":13725,"target":13727},{"edgeType":"contains","source":4079,"target":4095},{"edgeType":"imports","source":5860,"target":364},{"edgeType":"contains","source":3016,"target":3222},{"edgeType":"calls","source":2337,"target":717},{"edgeType":"contains","source":6654,"target":6724},{"edgeType":"contains","source":3152,"target":3234},{"edgeType":"contains","source":10653,"target":10654},{"edgeType":"contains","source":2460,"target":2488},{"edgeType":"contains","source":8572,"target":8575},{"edgeType":"contains","source":10091,"target":10106},{"edgeType":"calls","source":12529,"target":2936},{"edgeType":"calls","source":4701,"target":4598},{"edgeType":"calls","source":865,"target":900},{"edgeType":"calls","source":6615,"target":6577},{"edgeType":"contains","source":13725,"target":13726},{"edgeType":"contains","source":8968,"target":8982},{"edgeType":"calls","source":2551,"target":2540},{"edgeType":"contains","source":6291,"target":6350},{"edgeType":"calls","source":11835,"target":11767},{"edgeType":"contains","source":3016,"target":3223},{"edgeType":"calls","source":11435,"target":11482},{"edgeType":"contains","source":2849,"target":3115},{"edgeType":"calls","source":1923,"target":1926},{"edgeType":"imports","source":1797,"target":1580},{"edgeType":"calls","source":6052,"target":6054},{"edgeType":"calls","source":11646,"target":11284},{"edgeType":"contains","source":7844,"target":7887},{"edgeType":"contains","source":8539,"target":8540},{"edgeType":"contains","source":11282,"target":11239},{"edgeType":"calls","source":2743,"target":1874},{"edgeType":"contains","source":9852,"target":10117},{"edgeType":"calls","source":774,"target":549},{"edgeType":"imports","source":646,"target":266},{"edgeType":"calls","source":12561,"target":12515},{"edgeType":"contains","source":4079,"target":4101},{"edgeType":"contains","source":8362,"target":8736},{"edgeType":"contains","source":2849,"target":3120},{"edgeType":"calls","source":2328,"target":994},{"edgeType":"calls","source":8088,"target":2140},{"edgeType":"calls","source":2055,"target":2057},{"edgeType":"imports","source":1434,"target":148},{"edgeType":"contains","source":1007,"target":1027},{"edgeType":"contains","source":1805,"target":2716},{"edgeType":"calls","source":4973,"target":4620},{"edgeType":"imports","source":8362,"target":1026},{"edgeType":"calls","source":12504,"target":10059},{"edgeType":"calls","source":8433,"target":8359},{"edgeType":"contains","source":1250,"target":895},{"edgeType":"contains","source":8968,"target":8976},{"edgeType":"contains","source":8362,"target":8735},{"edgeType":"contains","source":6752,"target":6852},{"edgeType":"contains","source":10813,"target":10978},{"edgeType":"contains","source":4485,"target":4199},{"edgeType":"contains","source":10719,"target":10721},{"edgeType":"contains","source":8039,"target":8178},{"edgeType":"contains","source":907,"target":955},{"edgeType":"calls","source":5653,"target":5736},{"edgeType":"calls","source":2617,"target":2607},{"edgeType":"contains","source":2849,"target":3121},{"edgeType":"contains","source":7713,"target":7714},{"edgeType":"contains","source":12436,"target":12457},{"edgeType":"contains","source":413,"target":417},{"edgeType":"contains","source":2849,"target":3118},{"edgeType":"contains","source":8362,"target":8738},{"edgeType":"contains","source":4476,"target":4477},{"edgeType":"contains","source":6623,"target":6624},{"edgeType":"imports","source":7001,"target":7279},{"edgeType":"contains","source":10091,"target":10102},{"edgeType":"contains","source":3016,"target":3226},{"edgeType":"contains","source":9860,"target":9864},{"edgeType":"calls","source":3062,"target":436},{"edgeType":"contains","source":1805,"target":2714},{"edgeType":"calls","source":5127,"target":5129},{"edgeType":"contains","source":7680,"target":7683},{"edgeType":"imports","source":12617,"target":4417},{"edgeType":"contains","source":1569,"target":1574},{"edgeType":"calls","source":6317,"target":6306},{"edgeType":"contains","source":7072,"target":2219},{"edgeType":"contains","source":6291,"target":6346},{"edgeType":"contains","source":8362,"target":8737},{"edgeType":"contains","source":4132,"target":4569},{"edgeType":"contains","source":2849,"target":3119},{"edgeType":"contains","source":4639,"target":4708},{"edgeType":"contains","source":8412,"target":8244},{"edgeType":"contains","source":6623,"target":6625},{"edgeType":"contains","source":12730,"target":12855},{"edgeType":"imports","source":1954,"target":937},{"edgeType":"contains","source":4672,"target":4742},{"edgeType":"contains","source":4575,"target":4578},{"edgeType":"contains","source":413,"target":416},{"edgeType":"contains","source":2919,"target":3063},{"edgeType":"contains","source":1007,"target":1028},{"edgeType":"contains","source":8107,"target":7129},{"edgeType":"contains","source":1805,"target":2715},{"edgeType":"contains","source":1569,"target":1575},{"edgeType":"contains","source":11675,"target":11736},{"edgeType":"contains","source":7317,"target":7318},{"edgeType":"contains","source":12210,"target":12078},{"edgeType":"contains","source":4672,"target":4749},{"edgeType":"calls","source":665,"target":747},{"edgeType":"imports","source":4131,"target":4271},{"edgeType":"contains","source":4079,"target":4105},{"edgeType":"contains","source":13725,"target":13737},{"edgeType":"contains","source":4278,"target":4279},{"edgeType":"imports","source":12499,"target":12297},{"edgeType":"contains","source":11108,"target":11357},{"edgeType":"calls","source":6712,"target":6747},{"edgeType":"calls","source":2823,"target":2558},{"edgeType":"calls","source":7869,"target":7876},{"edgeType":"contains","source":12895,"target":13041},{"edgeType":"calls","source":6847,"target":6791},{"edgeType":"contains","source":7415,"target":7452},{"edgeType":"contains","source":7416,"target":7421},{"edgeType":"contains","source":3815,"target":3832},{"edgeType":"contains","source":13725,"target":13736},{"edgeType":"contains","source":11545,"target":11553},{"edgeType":"contains","source":11108,"target":11358},{"edgeType":"calls","source":12791,"target":12794},{"edgeType":"imports","source":1954,"target":952},{"edgeType":"contains","source":2849,"target":3125},{"edgeType":"contains","source":11082,"target":11107},{"edgeType":"contains","source":7317,"target":7320},{"edgeType":"contains","source":10813,"target":10987},{"edgeType":"calls","source":1924,"target":1888},{"edgeType":"contains","source":11713,"target":3171},{"edgeType":"contains","source":13725,"target":13735},{"edgeType":"contains","source":4476,"target":4481},{"edgeType":"contains","source":11941,"target":11959},{"edgeType":"contains","source":1510,"target":2350},{"edgeType":"calls","source":8727,"target":8764},{"edgeType":"contains","source":10389,"target":10390},{"edgeType":"calls","source":3058,"target":2670},{"edgeType":"contains","source":8572,"target":8583},{"edgeType":"contains","source":10719,"target":10730},{"edgeType":"contains","source":8765,"target":8942},{"edgeType":"contains","source":8704,"target":8718},{"edgeType":"contains","source":12895,"target":13038},{"edgeType":"contains","source":3320,"target":3321},{"edgeType":"contains","source":7218,"target":7219},{"edgeType":"contains","source":11941,"target":11958},{"edgeType":"calls","source":2755,"target":436},{"edgeType":"contains","source":7785,"target":7610},{"edgeType":"contains","source":11108,"target":11356},{"edgeType":"imports","source":4131,"target":4275},{"edgeType":"calls","source":8163,"target":8278},{"edgeType":"contains","source":1140,"target":1141},{"edgeType":"contains","source":11545,"target":11548},{"edgeType":"calls","source":12370,"target":12108},{"edgeType":"contains","source":10813,"target":10985},{"edgeType":"contains","source":13494,"target":13495},{"edgeType":"contains","source":5883,"target":6315},{"edgeType":"contains","source":4079,"target":4109},{"edgeType":"contains","source":13725,"target":13733},{"edgeType":"contains","source":11941,"target":11957},{"edgeType":"contains","source":6291,"target":6351},{"edgeType":"imports","source":9143,"target":1118},{"edgeType":"contains","source":7844,"target":7890},{"edgeType":"contains","source":3360,"target":3144},{"edgeType":"contains","source":10719,"target":10728},{"edgeType":"contains","source":4672,"target":4753},{"edgeType":"calls","source":10311,"target":3000},{"edgeType":"contains","source":10868,"target":10338},{"edgeType":"calls","source":11600,"target":11667},{"edgeType":"contains","source":13725,"target":13732},{"edgeType":"contains","source":8767,"target":8873},{"edgeType":"calls","source":2286,"target":2289},{"edgeType":"contains","source":12668,"target":12674},{"edgeType":"contains","source":4278,"target":4282},{"edgeType":"imports","source":9143,"target":1119},{"edgeType":"contains","source":7844,"target":7889},{"edgeType":"calls","source":3108,"target":3233},{"edgeType":"contains","source":7282,"target":7342},{"edgeType":"contains","source":11108,"target":11354},{"edgeType":"calls","source":6118,"target":6111},{"edgeType":"calls","source":1900,"target":1571},{"edgeType":"contains","source":13725,"target":13731},{"edgeType":"contains","source":2657,"target":2736},{"edgeType":"calls","source":10250,"target":10179},{"edgeType":"contains","source":8010,"target":8031},{"edgeType":"contains","source":6291,"target":6353},{"edgeType":"contains","source":12,"target":172},{"edgeType":"contains","source":2849,"target":3126},{"edgeType":"calls","source":9135,"target":8805},{"edgeType":"calls","source":2385,"target":2388},{"edgeType":"imports","source":8482,"target":1524},{"edgeType":"calls","source":2145,"target":1372},{"edgeType":"calls","source":11833,"target":11840},{"edgeType":"calls","source":9854,"target":5542},{"edgeType":"contains","source":7345,"target":2219},{"edgeType":"contains","source":12895,"target":13034},{"edgeType":"contains","source":11675,"target":11745},{"edgeType":"contains","source":13725,"target":13730},{"edgeType":"contains","source":5883,"target":6318},{"edgeType":"contains","source":12436,"target":12464},{"edgeType":"imports","source":1797,"target":1584},{"edgeType":"contains","source":3815,"target":3834},{"edgeType":"calls","source":665,"target":744},{"edgeType":"contains","source":5929,"target":5949},{"edgeType":"contains","source":6291,"target":6354},{"edgeType":"contains","source":2849,"target":3127},{"edgeType":"calls","source":6326,"target":6036},{"edgeType":"calls","source":6315,"target":6377},{"edgeType":"imports","source":7239,"target":2005},{"edgeType":"calls","source":1837,"target":351},{"edgeType":"calls","source":1830,"target":568},{"edgeType":"contains","source":899,"target":1213},{"edgeType":"contains","source":11082,"target":12158},{"edgeType":"contains","source":3016,"target":3235},{"edgeType":"contains","source":3016,"target":3208},{"edgeType":"contains","source":5230,"target":5396},{"edgeType":"contains","source":7151,"target":7154},{"edgeType":"contains","source":6159,"target":6195},{"edgeType":"calls","source":6449,"target":6419},{"edgeType":"calls","source":5128,"target":5121},{"edgeType":"contains","source":4179,"target":5209},{"edgeType":"calls","source":9509,"target":351},{"edgeType":"contains","source":8362,"target":8724},{"edgeType":"contains","source":6287,"target":6455},{"edgeType":"contains","source":3016,"target":3207},{"edgeType":"imports","source":4743,"target":4319},{"edgeType":"calls","source":7472,"target":7475},{"edgeType":"contains","source":3016,"target":3209},{"edgeType":"contains","source":5230,"target":5395},{"edgeType":"contains","source":7218,"target":1907},{"edgeType":"contains","source":1805,"target":2696},{"edgeType":"calls","source":12991,"target":5512},{"edgeType":"contains","source":7593,"target":1909},{"edgeType":"calls","source":12659,"target":12633},{"edgeType":"contains","source":4132,"target":4551},{"edgeType":"calls","source":3061,"target":491},{"edgeType":"calls","source":12304,"target":2498},{"edgeType":"contains","source":8108,"target":8141},{"edgeType":"calls","source":9355,"target":9352},{"edgeType":"contains","source":10813,"target":10965},{"edgeType":"contains","source":4179,"target":5208},{"edgeType":"contains","source":4672,"target":4723},{"edgeType":"contains","source":2559,"target":2577},{"edgeType":"calls","source":9388,"target":9386},{"edgeType":"contains","source":8362,"target":8723},{"edgeType":"contains","source":10091,"target":10093},{"edgeType":"contains","source":1007,"target":1009},{"edgeType":"contains","source":411,"target":458},{"edgeType":"imports","source":4131,"target":4265},{"edgeType":"contains","source":5961,"target":5992},{"edgeType":"contains","source":11972,"target":12030},{"edgeType":"calls","source":8993,"target":8949},{"edgeType":"calls","source":12460,"target":12458},{"edgeType":"contains","source":1805,"target":2693},{"edgeType":"calls","source":6712,"target":6724},{"edgeType":"contains","source":7593,"target":1910},{"edgeType":"contains","source":2130,"target":2132},{"edgeType":"calls","source":5849,"target":4965},{"edgeType":"contains","source":13093,"target":13218},{"edgeType":"contains","source":8108,"target":8144},{"edgeType":"contains","source":4179,"target":5207},{"edgeType":"imports","source":12571,"target":12173},{"edgeType":"contains","source":5961,"target":5993},{"edgeType":"contains","source":8010,"target":8011},{"edgeType":"contains","source":3016,"target":3205},{"edgeType":"calls","source":1527,"target":1535},{"edgeType":"contains","source":10813,"target":10962},{"edgeType":"contains","source":10473,"target":9875},{"edgeType":"contains","source":5230,"target":5393},{"edgeType":"contains","source":5229,"target":5424},{"edgeType":"contains","source":1805,"target":2694},{"edgeType":"calls","source":966,"target":956},{"edgeType":"contains","source":4179,"target":5206},{"edgeType":"contains","source":6752,"target":6841},{"edgeType":"contains","source":8362,"target":8725},{"edgeType":"calls","source":1550,"target":821},{"edgeType":"contains","source":907,"target":936},{"edgeType":"contains","source":5961,"target":5994},{"edgeType":"contains","source":3016,"target":3206},{"edgeType":"imports","source":13067,"target":1026},{"edgeType":"calls","source":11899,"target":11880},{"edgeType":"calls","source":2038,"target":491},{"edgeType":"imports","source":5424,"target":5409},{"edgeType":"contains","source":8039,"target":8162},{"edgeType":"contains","source":7218,"target":7187},{"edgeType":"contains","source":11972,"target":12028},{"edgeType":"contains","source":5230,"target":5400},{"edgeType":"contains","source":7646,"target":7661},{"edgeType":"calls","source":2485,"target":2486},{"edgeType":"calls","source":472,"target":409},{"edgeType":"contains","source":11423,"target":2620},{"edgeType":"contains","source":8241,"target":8243},{"edgeType":"contains","source":2130,"target":2138},{"edgeType":"calls","source":13088,"target":13081},{"edgeType":"contains","source":411,"target":460},{"edgeType":"calls","source":270,"target":329},{"edgeType":"contains","source":3016,"target":3213},{"edgeType":"contains","source":8039,"target":8161},{"edgeType":"contains","source":6527,"target":6411},{"edgeType":"contains","source":11276,"target":11407},{"edgeType":"contains","source":3847,"target":3876},{"edgeType":"contains","source":5230,"target":5399},{"edgeType":"contains","source":7593,"target":1905},{"edgeType":"calls","source":12120,"target":9264},{"edgeType":"imports","source":4131,"target":4268},{"edgeType":"calls","source":1331,"target":1262},{"edgeType":"contains","source":7646,"target":7660},{"edgeType":"contains","source":9106,"target":8909},{"edgeType":"contains","source":10355,"target":10361},{"edgeType":"contains","source":8241,"target":8242},{"edgeType":"contains","source":1805,"target":2701},{"edgeType":"calls","source":602,"target":606},{"edgeType":"calls","source":2261,"target":975},{"edgeType":"contains","source":4179,"target":5212},{"edgeType":"contains","source":411,"target":459},{"edgeType":"contains","source":12667,"target":12680},{"edgeType":"calls","source":1362,"target":1361},{"edgeType":"contains","source":5961,"target":5988},{"edgeType":"contains","source":10090,"target":10116},{"edgeType":"contains","source":3154,"target":3160},{"edgeType":"contains","source":1007,"target":1013},{"edgeType":"contains","source":3016,"target":3210},{"edgeType":"contains","source":11313,"target":11314},{"edgeType":"contains","source":7151,"target":7152},{"edgeType":"contains","source":1805,"target":2697},{"edgeType":"imports","source":10367,"target":1218},{"edgeType":"calls","source":8993,"target":8954},{"edgeType":"contains","source":2559,"target":2578},{"edgeType":"calls","source":4104,"target":4089},{"edgeType":"contains","source":4179,"target":5211},{"edgeType":"contains","source":8362,"target":8722},{"edgeType":"contains","source":411,"target":462},{"edgeType":"contains","source":1,"target":6829},{"edgeType":"contains","source":5961,"target":5989},{"edgeType":"contains","source":5230,"target":5397},{"edgeType":"contains","source":7151,"target":7153},{"edgeType":"contains","source":1007,"target":1012},{"edgeType":"contains","source":2920,"target":3016},{"edgeType":"calls","source":3654,"target":3242},{"edgeType":"contains","source":3016,"target":3211},{"edgeType":"calls","source":1606,"target":1195},{"edgeType":"contains","source":1805,"target":2698},{"edgeType":"contains","source":7646,"target":7662},{"edgeType":"contains","source":7637,"target":7941},{"edgeType":"calls","source":9883,"target":9902},{"edgeType":"contains","source":4179,"target":5210},{"edgeType":"calls","source":7175,"target":7175},{"edgeType":"contains","source":1,"target":2601},{"edgeType":"calls","source":11620,"target":2564},{"edgeType":"calls","source":4095,"target":3312},{"edgeType":"imports","source":6879,"target":6815},{"edgeType":"contains","source":4672,"target":4725},{"edgeType":"contains","source":411,"target":461},{"edgeType":"calls","source":2261,"target":973},{"edgeType":"contains","source":8362,"target":8732},{"edgeType":"imports","source":12436,"target":12119},{"edgeType":"calls","source":966,"target":946},{"edgeType":"contains","source":7436,"target":441},{"edgeType":"calls","source":3096,"target":2567},{"edgeType":"contains","source":10983,"target":10988},{"edgeType":"contains","source":3016,"target":3216},{"edgeType":"contains","source":5230,"target":5404},{"edgeType":"contains","source":12730,"target":12854},{"edgeType":"contains","source":7218,"target":1914},{"edgeType":"calls","source":7868,"target":491},{"edgeType":"contains","source":9465,"target":9421},{"edgeType":"contains","source":11941,"target":11945},{"edgeType":"calls","source":2749,"target":2754},{"edgeType":"contains","source":11905,"target":12004},{"edgeType":"contains","source":5961,"target":5999},{"edgeType":"imports","source":6023,"target":5855},{"edgeType":"contains","source":7908,"target":8008},{"edgeType":"contains","source":9860,"target":9862},{"edgeType":"contains","source":1,"target":6831},{"edgeType":"contains","source":8373,"target":8390},{"edgeType":"contains","source":8362,"target":8731},{"edgeType":"contains","source":2849,"target":3109},{"edgeType":"imports","source":10514,"target":10391},{"edgeType":"contains","source":12730,"target":12853},{"edgeType":"contains","source":6752,"target":6848},{"edgeType":"contains","source":1205,"target":1218},{"edgeType":"contains","source":3016,"target":3217},{"edgeType":"contains","source":5230,"target":5403},{"edgeType":"contains","source":8968,"target":8972},{"edgeType":"contains","source":10884,"target":10887},{"edgeType":"contains","source":10818,"target":10819},{"edgeType":"contains","source":11422,"target":12178},{"edgeType":"contains","source":6752,"target":6847},{"edgeType":"contains","source":10091,"target":10101},{"edgeType":"contains","source":411,"target":463},{"edgeType":"contains","source":3815,"target":3816},{"edgeType":"calls","source":12957,"target":12917},{"edgeType":"calls","source":2383,"target":2474},{"edgeType":"contains","source":9860,"target":9863},{"edgeType":"contains","source":11941,"target":11944},{"edgeType":"contains","source":5961,"target":6000},{"edgeType":"calls","source":766,"target":806},{"edgeType":"contains","source":9793,"target":9822},{"edgeType":"calls","source":11771,"target":3171},{"edgeType":"calls","source":4885,"target":4187},{"edgeType":"contains","source":8362,"target":8734},{"edgeType":"imports","source":2137,"target":1603},{"edgeType":"imports","source":12554,"target":11634},{"edgeType":"contains","source":11108,"target":11339},{"edgeType":"imports","source":12499,"target":12282},{"edgeType":"contains","source":5230,"target":5402},{"edgeType":"calls","source":1346,"target":796},{"edgeType":"calls","source":10700,"target":436},{"edgeType":"calls","source":470,"target":469},{"edgeType":"contains","source":4673,"target":4699},{"edgeType":"calls","source":6880,"target":6810},{"edgeType":"calls","source":7545,"target":7335},{"edgeType":"contains","source":1805,"target":2702},{"edgeType":"contains","source":3848,"target":3849},{"edgeType":"imports","source":4131,"target":4257},{"edgeType":"contains","source":10091,"target":10098},{"edgeType":"contains","source":11941,"target":11943},{"edgeType":"contains","source":8373,"target":8392},{"edgeType":"contains","source":8362,"target":8733},{"edgeType":"contains","source":907,"target":945},{"edgeType":"contains","source":11108,"target":11340},{"edgeType":"calls","source":205,"target":226},{"edgeType":"calls","source":5150,"target":4427},{"edgeType":"contains","source":5230,"target":5401},{"edgeType":"contains","source":4907,"target":4844},{"edgeType":"contains","source":6690,"target":6658},{"edgeType":"imports","source":12622,"target":12698},{"edgeType":"calls","source":10147,"target":10179},{"edgeType":"contains","source":10813,"target":10971},{"edgeType":"contains","source":4672,"target":4729},{"edgeType":"contains","source":4673,"target":4698},{"edgeType":"calls","source":7675,"target":7534},{"edgeType":"calls","source":11948,"target":2970},{"edgeType":"contains","source":411,"target":465},{"edgeType":"calls","source":602,"target":604},{"edgeType":"contains","source":7591,"target":6209},{"edgeType":"contains","source":2849,"target":3112},{"edgeType":"contains","source":11214,"target":11222},{"edgeType":"calls","source":5722,"target":5721},{"edgeType":"calls","source":9261,"target":9108},{"edgeType":"calls","source":270,"target":320},{"edgeType":"contains","source":3016,"target":3220},{"edgeType":"contains","source":7637,"target":7948},{"edgeType":"calls","source":11549,"target":10059},{"edgeType":"contains","source":4673,"target":4706},{"edgeType":"contains","source":8968,"target":8969},{"edgeType":"calls","source":1693,"target":1660},{"edgeType":"contains","source":7415,"target":7430},{"edgeType":"contains","source":10983,"target":10984},{"edgeType":"calls","source":7968,"target":7966},{"edgeType":"contains","source":4869,"target":4972},{"edgeType":"contains","source":1805,"target":2708},{"edgeType":"contains","source":8108,"target":8146},{"edgeType":"calls","source":9984,"target":436},{"edgeType":"contains","source":5883,"target":6299},{"edgeType":"contains","source":5961,"target":5995},{"edgeType":"contains","source":8362,"target":8728},{"edgeType":"calls","source":4605,"target":4409},{"edgeType":"contains","source":9793,"target":9821},{"edgeType":"calls","source":2204,"target":619},{"edgeType":"contains","source":12667,"target":12688},{"edgeType":"contains","source":7637,"target":7947},{"edgeType":"contains","source":3016,"target":3221},{"edgeType":"contains","source":4673,"target":4705},{"edgeType":"imports","source":10811,"target":10702},{"edgeType":"contains","source":907,"target":947},{"edgeType":"contains","source":11545,"target":3076},{"edgeType":"contains","source":4869,"target":4971},{"edgeType":"contains","source":2849,"target":3113},{"edgeType":"imports","source":2350,"target":1339},{"edgeType":"contains","source":8108,"target":8145},{"edgeType":"contains","source":10813,"target":10969},{"edgeType":"contains","source":4672,"target":4735},{"edgeType":"contains","source":2460,"target":2487},{"edgeType":"contains","source":5883,"target":6300},{"edgeType":"contains","source":5961,"target":5996},{"edgeType":"calls","source":6712,"target":6736},{"edgeType":"contains","source":12377,"target":11108},{"edgeType":"contains","source":3781,"target":3817},{"edgeType":"imports","source":7607,"target":7495},{"edgeType":"contains","source":4949,"target":4604},{"edgeType":"contains","source":2849,"target":3110},{"edgeType":"contains","source":8362,"target":8730},{"edgeType":"imports","source":4131,"target":4261},{"edgeType":"contains","source":7283,"target":7296},{"edgeType":"imports","source":13058,"target":12919},{"edgeType":"contains","source":3154,"target":3168},{"edgeType":"contains","source":4869,"target":4970},{"edgeType":"contains","source":3016,"target":3218},{"edgeType":"contains","source":1805,"target":2706},{"edgeType":"contains","source":5230,"target":5406},{"edgeType":"contains","source":7002,"target":1208},{"edgeType":"contains","source":10813,"target":10966},{"edgeType":"calls","source":4578,"target":4187},{"edgeType":"imports","source":5835,"target":1119},{"edgeType":"contains","source":5961,"target":5997},{"edgeType":"contains","source":10301,"target":10983},{"edgeType":"calls","source":11197,"target":3000},{"edgeType":"contains","source":4131,"target":4593},{"edgeType":"imports","source":7072,"target":1881},{"edgeType":"contains","source":2849,"target":3111},{"edgeType":"contains","source":9793,"target":9819},{"edgeType":"contains","source":3562,"target":3204},{"edgeType":"contains","source":8968,"target":8970},{"edgeType":"contains","source":4869,"target":4969},{"edgeType":"contains","source":3016,"target":3219},{"edgeType":"calls","source":5756,"target":5721},{"edgeType":"contains","source":1805,"target":2707},{"edgeType":"contains","source":6752,"target":6845},{"edgeType":"contains","source":11791,"target":2847},{"edgeType":"contains","source":6654,"target":6712},{"edgeType":"imports","source":12555,"target":3144},{"edgeType":"imports","source":5835,"target":1118},{"edgeType":"calls","source":6647,"target":6639},{"edgeType":"contains","source":12110,"target":11984},{"edgeType":"imports","source":7694,"target":568},{"edgeType":"contains","source":3781,"target":3815},{"edgeType":"contains","source":5929,"target":5933},{"edgeType":"contains","source":8362,"target":8729},{"edgeType":"contains","source":5961,"target":5998},{"edgeType":"contains","source":4132,"target":4561},{"edgeType":"contains","source":704,"target":870},{"edgeType":"imports","source":11983,"target":8250},{"edgeType":"contains","source":6159,"target":6178},{"edgeType":"contains","source":6144,"target":6643},{"edgeType":"contains","source":10813,"target":10948},{"edgeType":"contains","source":2922,"target":2934},{"edgeType":"contains","source":3016,"target":3191},{"edgeType":"contains","source":12634,"target":12635},{"edgeType":"contains","source":9294,"target":9412},{"edgeType":"contains","source":11905,"target":11979},{"edgeType":"contains","source":5230,"target":5379},{"edgeType":"calls","source":5088,"target":1026},{"edgeType":"contains","source":5342,"target":6135},{"edgeType":"contains","source":11808,"target":11815},{"edgeType":"calls","source":10498,"target":9842},{"edgeType":"calls","source":4669,"target":4502},{"edgeType":"contains","source":7646,"target":7649},{"edgeType":"contains","source":7637,"target":7928},{"edgeType":"contains","source":7808,"target":1570},{"edgeType":"imports","source":4506,"target":1144},{"edgeType":"contains","source":11422,"target":12152},{"edgeType":"contains","source":4869,"target":4942},{"edgeType":"contains","source":704,"target":869},{"edgeType":"contains","source":2559,"target":2561},{"edgeType":"contains","source":2922,"target":2935},{"edgeType":"contains","source":4639,"target":4673},{"edgeType":"calls","source":4800,"target":4668},{"edgeType":"contains","source":9294,"target":9411},{"edgeType":"contains","source":7844,"target":7852},{"edgeType":"calls","source":805,"target":610},{"edgeType":"calls","source":10480,"target":3000},{"edgeType":"contains","source":11972,"target":12015},{"edgeType":"contains","source":5230,"target":5378},{"edgeType":"contains","source":5342,"target":6134},{"edgeType":"imports","source":10389,"target":583},{"edgeType":"contains","source":11808,"target":11814},{"edgeType":"calls","source":2549,"target":2572},{"edgeType":"calls","source":12396,"target":12314},{"edgeType":"contains","source":7646,"target":7648},{"edgeType":"contains","source":1805,"target":2680},{"edgeType":"calls","source":2823,"target":2534},{"edgeType":"calls","source":1197,"target":1142},{"edgeType":"calls","source":3838,"target":3834},{"edgeType":"calls","source":10852,"target":3095},{"edgeType":"contains","source":6752,"target":6824},{"edgeType":"calls","source":1559,"target":1551},{"edgeType":"imports","source":7283,"target":7022},{"edgeType":"calls","source":7819,"target":1988},{"edgeType":"contains","source":12204,"target":12221},{"edgeType":"contains","source":2922,"target":2932},{"edgeType":"calls","source":12024,"target":2703},{"edgeType":"contains","source":4640,"target":4641},{"edgeType":"contains","source":6523,"target":6524},{"edgeType":"contains","source":3847,"target":3855},{"edgeType":"contains","source":5230,"target":5377},{"edgeType":"calls","source":1279,"target":717},{"edgeType":"calls","source":2682,"target":2674},{"edgeType":"calls","source":10512,"target":3068},{"edgeType":"calls","source":12463,"target":12348},{"edgeType":"contains","source":5342,"target":6133},{"edgeType":"contains","source":11905,"target":11977},{"edgeType":"contains","source":11972,"target":12014},{"edgeType":"contains","source":7646,"target":7651},{"edgeType":"calls","source":3058,"target":2645},{"edgeType":"imports","source":4131,"target":4315},{"edgeType":"contains","source":11422,"target":12150},{"edgeType":"calls","source":10576,"target":10595},{"edgeType":"contains","source":6144,"target":6646},{"edgeType":"contains","source":6291,"target":6317},{"edgeType":"contains","source":12204,"target":12220},{"edgeType":"contains","source":4673,"target":4674},{"edgeType":"contains","source":2922,"target":2933},{"edgeType":"contains","source":6523,"target":6525},{"edgeType":"contains","source":5230,"target":5376},{"edgeType":"contains","source":9294,"target":9413},{"edgeType":"imports","source":6023,"target":5914},{"edgeType":"contains","source":11972,"target":12013},{"edgeType":"contains","source":12832,"target":12836},{"edgeType":"contains","source":5342,"target":6132},{"edgeType":"calls","source":12863,"target":12633},{"edgeType":"calls","source":9058,"target":9031},{"edgeType":"contains","source":7646,"target":7650},{"edgeType":"calls","source":1018,"target":351},{"edgeType":"contains","source":1805,"target":2678},{"edgeType":"contains","source":6256,"target":6338},{"edgeType":"calls","source":12336,"target":436},{"edgeType":"contains","source":12340,"target":12231},{"edgeType":"contains","source":12237,"target":12253},{"edgeType":"contains","source":4315,"target":4151},{"edgeType":"contains","source":2460,"target":2462},{"edgeType":"contains","source":5107,"target":4968},{"edgeType":"calls","source":2086,"target":2121},{"edgeType":"imports","source":7551,"target":1887},{"edgeType":"contains","source":11344,"target":10338},{"edgeType":"contains","source":2922,"target":2938},{"edgeType":"contains","source":12204,"target":12219},{"edgeType":"contains","source":1805,"target":2683},{"edgeType":"imports","source":3763,"target":4098},{"edgeType":"contains","source":6159,"target":6174},{"edgeType":"contains","source":11675,"target":11704},{"edgeType":"imports","source":12436,"target":12173},{"edgeType":"calls","source":1228,"target":1235},{"edgeType":"contains","source":7910,"target":7917},{"edgeType":"contains","source":7844,"target":7849},{"edgeType":"imports","source":3234,"target":3574},{"edgeType":"contains","source":6159,"target":6175},{"edgeType":"calls","source":1872,"target":1354},{"edgeType":"calls","source":11865,"target":11867},{"edgeType":"calls","source":11614,"target":11192},{"edgeType":"contains","source":12896,"target":12964},{"edgeType":"contains","source":6853,"target":6859},{"edgeType":"contains","source":704,"target":873},{"edgeType":"contains","source":9294,"target":9407},{"edgeType":"contains","source":2922,"target":2939},{"edgeType":"contains","source":1805,"target":2684},{"edgeType":"contains","source":5230,"target":5382},{"edgeType":"contains","source":7910,"target":7916},{"edgeType":"calls","source":5126,"target":5128},{"edgeType":"contains","source":5342,"target":6138},{"edgeType":"contains","source":7844,"target":7848},{"edgeType":"calls","source":1085,"target":385},{"edgeType":"contains","source":11082,"target":11059},{"edgeType":"calls","source":12087,"target":11324},{"edgeType":"contains","source":11276,"target":11387},{"edgeType":"calls","source":6150,"target":6151},{"edgeType":"contains","source":6853,"target":6860},{"edgeType":"contains","source":12862,"target":12960},{"edgeType":"contains","source":12832,"target":12833},{"edgeType":"contains","source":5230,"target":5381},{"edgeType":"contains","source":9506,"target":10237},{"edgeType":"contains","source":5342,"target":6137},{"edgeType":"contains","source":1805,"target":2681},{"edgeType":"calls","source":1011,"target":565},{"edgeType":"contains","source":7844,"target":7851},{"edgeType":"contains","source":11808,"target":11809},{"edgeType":"contains","source":7646,"target":7647},{"edgeType":"contains","source":9793,"target":9794},{"edgeType":"contains","source":9826,"target":9828},{"edgeType":"contains","source":1298,"target":429},{"edgeType":"contains","source":6256,"target":6341},{"edgeType":"contains","source":8331,"target":4380},{"edgeType":"contains","source":2922,"target":2937},{"edgeType":"contains","source":411,"target":445},{"edgeType":"contains","source":12862,"target":12959},{"edgeType":"contains","source":11422,"target":12147},{"edgeType":"contains","source":7910,"target":7918},{"edgeType":"calls","source":12505,"target":2595},{"edgeType":"contains","source":12237,"target":12250},{"edgeType":"contains","source":5230,"target":5380},{"edgeType":"contains","source":11276,"target":11388},{"edgeType":"contains","source":12302,"target":12349},{"edgeType":"contains","source":1867,"target":1817},{"edgeType":"calls","source":937,"target":744},{"edgeType":"contains","source":11972,"target":12009},{"edgeType":"calls","source":898,"target":896},{"edgeType":"contains","source":5342,"target":6136},{"edgeType":"calls","source":5225,"target":5228},{"edgeType":"contains","source":7844,"target":7850},{"edgeType":"contains","source":9826,"target":9829},{"edgeType":"contains","source":1510,"target":2314},{"edgeType":"calls","source":1195,"target":1197},{"edgeType":"contains","source":7415,"target":7418},{"edgeType":"contains","source":10090,"target":10114},{"edgeType":"contains","source":8767,"target":8845},{"edgeType":"contains","source":6623,"target":6601},{"edgeType":"contains","source":13394,"target":13395},{"edgeType":"contains","source":4640,"target":4651},{"edgeType":"contains","source":4132,"target":4543},{"edgeType":"contains","source":3847,"target":3865},{"edgeType":"contains","source":7844,"target":7861},{"edgeType":"contains","source":9878,"target":8230},{"edgeType":"calls","source":4497,"target":4540},{"edgeType":"contains","source":6144,"target":6651},{"edgeType":"contains","source":4179,"target":5200},{"edgeType":"calls","source":6679,"target":6680},{"edgeType":"contains","source":11108,"target":11324},{"edgeType":"contains","source":10355,"target":10356},{"edgeType":"contains","source":7646,"target":7657},{"edgeType":"calls","source":6608,"target":2539},{"edgeType":"calls","source":1811,"target":1127},{"edgeType":"contains","source":11545,"target":3062},{"edgeType":"contains","source":1349,"target":968},{"edgeType":"contains","source":5230,"target":5387},{"edgeType":"contains","source":10090,"target":10115},{"edgeType":"calls","source":1926,"target":733},{"edgeType":"calls","source":1889,"target":1880},{"edgeType":"calls","source":7793,"target":687},{"edgeType":"contains","source":12285,"target":11833},{"edgeType":"contains","source":7415,"target":7419},{"edgeType":"contains","source":7593,"target":1901},{"edgeType":"contains","source":4132,"target":4542},{"edgeType":"contains","source":6159,"target":6187},{"edgeType":"contains","source":6144,"target":6652},{"edgeType":"contains","source":2460,"target":2467},{"edgeType":"imports","source":4131,"target":4305},{"edgeType":"contains","source":4179,"target":5199},{"edgeType":"calls","source":9327,"target":8097},{"edgeType":"contains","source":7646,"target":7656},{"edgeType":"contains","source":7637,"target":7935},{"edgeType":"contains","source":12601,"target":12608},{"edgeType":"imports","source":11454,"target":2441},{"edgeType":"calls","source":6679,"target":6681},{"edgeType":"calls","source":5158,"target":5189},{"edgeType":"contains","source":9294,"target":9419},{"edgeType":"contains","source":12730,"target":12837},{"edgeType":"contains","source":12667,"target":12676},{"edgeType":"contains","source":5230,"target":5386},{"edgeType":"contains","source":9467,"target":9345},{"edgeType":"calls","source":2513,"target":1562},{"edgeType":"contains","source":4132,"target":4541},{"edgeType":"contains","source":5765,"target":5718},{"edgeType":"contains","source":2559,"target":2566},{"edgeType":"contains","source":12302,"target":2849},{"edgeType":"contains","source":12535,"target":12539},{"edgeType":"contains","source":6291,"target":6325},{"edgeType":"calls","source":7433,"target":3392},{"edgeType":"contains","source":6259,"target":6260},{"edgeType":"contains","source":7646,"target":7659},{"edgeType":"contains","source":7637,"target":7938},{"edgeType":"imports","source":13752,"target":12599},{"edgeType":"contains","source":2922,"target":2940},{"edgeType":"contains","source":3093,"target":2924},{"edgeType":"calls","source":5122,"target":4190},{"edgeType":"contains","source":5562,"target":4612},{"edgeType":"contains","source":12601,"target":12607},{"edgeType":"contains","source":5230,"target":5385},{"edgeType":"contains","source":11276,"target":11399},{"edgeType":"contains","source":7316,"target":7319},{"edgeType":"contains","source":8039,"target":8159},{"edgeType":"contains","source":4640,"target":4648},{"edgeType":"contains","source":1805,"target":2686},{"edgeType":"contains","source":11675,"target":11716},{"edgeType":"contains","source":1,"target":11045},{"edgeType":"contains","source":6159,"target":6189},{"edgeType":"calls","source":7241,"target":7230},{"edgeType":"contains","source":10090,"target":10113},{"edgeType":"imports","source":3763,"target":4088},{"edgeType":"contains","source":8373,"target":8376},{"edgeType":"contains","source":7018,"target":7043},{"edgeType":"contains","source":7646,"target":7658},{"edgeType":"contains","source":12634,"target":12640},{"edgeType":"contains","source":12601,"target":12606},{"edgeType":"contains","source":5230,"target":5384},{"edgeType":"contains","source":10685,"target":10695},{"edgeType":"imports","source":404,"target":410},{"edgeType":"imports","source":899,"target":918},{"edgeType":"calls","source":2682,"target":2663},{"edgeType":"contains","source":5230,"target":5392},{"edgeType":"contains","source":6159,"target":6182},{"edgeType":"calls","source":2605,"target":2936},{"edgeType":"imports","source":12152,"target":11455},{"edgeType":"contains","source":6752,"target":6826},{"edgeType":"calls","source":1362,"target":1301},{"edgeType":"contains","source":8767,"target":8841},{"edgeType":"calls","source":708,"target":434},{"edgeType":"contains","source":10090,"target":10110},{"edgeType":"contains","source":3847,"target":3869},{"edgeType":"imports","source":3763,"target":4089},{"edgeType":"contains","source":10227,"target":10091},{"edgeType":"contains","source":4179,"target":5205},{"edgeType":"calls","source":12693,"target":12633},{"edgeType":"calls","source":6679,"target":6684},{"edgeType":"contains","source":7844,"target":7857},{"edgeType":"calls","source":8818,"target":627},{"edgeType":"contains","source":12535,"target":12537},{"edgeType":"imports","source":2787,"target":2641},{"edgeType":"imports","source":404,"target":407},{"edgeType":"contains","source":7646,"target":7653},{"edgeType":"contains","source":4719,"target":4320},{"edgeType":"contains","source":11276,"target":11397},{"edgeType":"calls","source":1872,"target":1346},{"edgeType":"contains","source":9294,"target":9416},{"edgeType":"calls","source":11899,"target":11877},{"edgeType":"contains","source":1805,"target":2692},{"edgeType":"contains","source":5230,"target":5391},{"edgeType":"contains","source":7593,"target":1897},{"edgeType":"contains","source":10355,"target":10352},{"edgeType":"calls","source":6679,"target":6685},{"edgeType":"calls","source":8793,"target":8800},{"edgeType":"contains","source":4244,"target":4246},{"edgeType":"calls","source":5122,"target":4187},{"edgeType":"contains","source":913,"target":744},{"edgeType":"calls","source":2925,"target":2531},{"edgeType":"contains","source":4179,"target":5204},{"edgeType":"calls","source":5171,"target":4782},{"edgeType":"contains","source":12697,"target":12799},{"edgeType":"calls","source":5156,"target":4190},{"edgeType":"contains","source":11808,"target":11818},{"edgeType":"contains","source":12634,"target":12638},{"edgeType":"contains","source":7646,"target":7652},{"edgeType":"calls","source":5554,"target":5593},{"edgeType":"contains","source":9294,"target":9415},{"edgeType":"contains","source":11276,"target":11398},{"edgeType":"calls","source":5769,"target":4213},{"edgeType":"contains","source":11410,"target":3016},{"edgeType":"contains","source":1805,"target":2689},{"edgeType":"contains","source":5230,"target":5390},{"edgeType":"contains","source":1,"target":11050},{"edgeType":"contains","source":9506,"target":10246},{"edgeType":"contains","source":5883,"target":6284},{"edgeType":"calls","source":7569,"target":1294},{"edgeType":"contains","source":3847,"target":3867},{"edgeType":"contains","source":6159,"target":6184},{"edgeType":"contains","source":4179,"target":5202},{"edgeType":"contains","source":8039,"target":8156},{"edgeType":"imports","source":12246,"target":1144},{"edgeType":"contains","source":6228,"target":6159},{"edgeType":"contains","source":4974,"target":4869},{"edgeType":"contains","source":12601,"target":12603},{"edgeType":"contains","source":4179,"target":5203},{"edgeType":"calls","source":5058,"target":5113},{"edgeType":"contains","source":11808,"target":11817},{"edgeType":"contains","source":12667,"target":12671},{"edgeType":"contains","source":7646,"target":7655},{"edgeType":"contains","source":12730,"target":12832},{"edgeType":"contains","source":7282,"target":7310},{"edgeType":"contains","source":9294,"target":9418},{"edgeType":"imports","source":13058,"target":12968},{"edgeType":"contains","source":4869,"target":4953},{"edgeType":"contains","source":5230,"target":5389},{"edgeType":"contains","source":5229,"target":5420},{"edgeType":"contains","source":7415,"target":7417},{"edgeType":"contains","source":4001,"target":3320},{"edgeType":"calls","source":1940,"target":1354},{"edgeType":"contains","source":1805,"target":2690},{"edgeType":"contains","source":8897,"target":9040},{"edgeType":"contains","source":4179,"target":5201},{"edgeType":"calls","source":10957,"target":10424},{"edgeType":"contains","source":4131,"target":4575},{"edgeType":"contains","source":4132,"target":4544},{"edgeType":"contains","source":6144,"target":6650},{"edgeType":"contains","source":8472,"target":8474},{"edgeType":"contains","source":12634,"target":12636},{"edgeType":"calls","source":5171,"target":4780},{"edgeType":"contains","source":6457,"target":6461},{"edgeType":"contains","source":11905,"target":11980},{"edgeType":"imports","source":7001,"target":7302},{"edgeType":"contains","source":7646,"target":7654},{"edgeType":"contains","source":10685,"target":10691},{"edgeType":"calls","source":9388,"target":9384},{"edgeType":"contains","source":9028,"target":9207},{"edgeType":"contains","source":4869,"target":4952},{"edgeType":"contains","source":5230,"target":5388},{"edgeType":"contains","source":9294,"target":9417},{"edgeType":"calls","source":12375,"target":11891},{"edgeType":"contains","source":1139,"target":3224},{"edgeType":"calls","source":10148,"target":10106},{"edgeType":"calls","source":3546,"target":3391},{"edgeType":"contains","source":5230,"target":5363},{"edgeType":"imports","source":2244,"target":1484},{"edgeType":"contains","source":5342,"target":6119},{"edgeType":"contains","source":5424,"target":5691},{"edgeType":"calls","source":8991,"target":8976},{"edgeType":"calls","source":2385,"target":2386},{"edgeType":"contains","source":4144,"target":4147},{"edgeType":"contains","source":11675,"target":11692},{"edgeType":"contains","source":4869,"target":4926},{"edgeType":"contains","source":6918,"target":6944},{"edgeType":"contains","source":6159,"target":6162},{"edgeType":"contains","source":8108,"target":8109},{"edgeType":"calls","source":1559,"target":1565},{"edgeType":"contains","source":4672,"target":4691},{"edgeType":"calls","source":2286,"target":1227},{"edgeType":"contains","source":12204,"target":12207},{"edgeType":"contains","source":10826,"target":3129},{"edgeType":"calls","source":9882,"target":9895},{"edgeType":"contains","source":9294,"target":9395},{"edgeType":"calls","source":3368,"target":454},{"edgeType":"contains","source":7084,"target":7085},{"edgeType":"contains","source":8197,"target":4291},{"edgeType":"contains","source":411,"target":422},{"edgeType":"contains","source":5230,"target":5362},{"edgeType":"contains","source":5424,"target":5690},{"edgeType":"contains","source":11461,"target":2472},{"edgeType":"contains","source":7637,"target":7910},{"edgeType":"contains","source":4869,"target":4925},{"edgeType":"contains","source":4144,"target":4146},{"edgeType":"contains","source":6144,"target":6628},{"edgeType":"contains","source":4672,"target":4690},{"edgeType":"contains","source":8401,"target":8538},{"edgeType":"contains","source":6654,"target":6673},{"edgeType":"calls","source":6106,"target":4365},{"edgeType":"contains","source":5230,"target":5361},{"edgeType":"calls","source":1295,"target":1295},{"edgeType":"contains","source":7084,"target":7086},{"edgeType":"imports","source":7001,"target":2006},{"edgeType":"contains","source":5342,"target":6117},{"edgeType":"calls","source":10242,"target":8251},{"edgeType":"calls","source":2620,"target":2498},{"edgeType":"calls","source":3061,"target":454},{"edgeType":"contains","source":4144,"target":4145},{"edgeType":"contains","source":12335,"target":12372},{"edgeType":"imports","source":3763,"target":4079},{"edgeType":"calls","source":2582,"target":2619},{"edgeType":"contains","source":4672,"target":4689},{"edgeType":"calls","source":8170,"target":1660},{"edgeType":"contains","source":12237,"target":12239},{"edgeType":"contains","source":12302,"target":12338},{"edgeType":"contains","source":12634,"target":12616},{"edgeType":"imports","source":7456,"target":585},{"edgeType":"contains","source":8401,"target":8541},{"edgeType":"contains","source":1039,"target":1040},{"edgeType":"contains","source":11276,"target":11376},{"edgeType":"imports","source":7001,"target":2005},{"edgeType":"calls","source":10396,"target":1362},{"edgeType":"imports","source":4750,"target":4137},{"edgeType":"contains","source":5342,"target":6116},{"edgeType":"contains","source":5424,"target":5688},{"edgeType":"contains","source":6984,"target":7016},{"edgeType":"calls","source":3306,"target":3431},{"edgeType":"calls","source":3146,"target":2049},{"edgeType":"contains","source":1511,"target":148},{"edgeType":"contains","source":11675,"target":11691},{"edgeType":"calls","source":1659,"target":1637},{"edgeType":"imports","source":1139,"target":855},{"edgeType":"contains","source":8108,"target":8110},{"edgeType":"contains","source":6984,"target":7015},{"edgeType":"contains","source":12237,"target":12238},{"edgeType":"contains","source":4672,"target":4688},{"edgeType":"contains","source":10782,"target":10834},{"edgeType":"contains","source":10419,"target":10460},{"edgeType":"contains","source":6523,"target":6508},{"edgeType":"contains","source":8074,"target":8101},{"edgeType":"contains","source":7282,"target":7284},{"edgeType":"contains","source":11279,"target":11280},{"edgeType":"contains","source":7348,"target":7352},{"edgeType":"calls","source":983,"target":390},{"edgeType":"contains","source":1139,"target":3228},{"edgeType":"calls","source":5219,"target":148},{"edgeType":"contains","source":5342,"target":6123},{"edgeType":"contains","source":5424,"target":5695},{"edgeType":"contains","source":10419,"target":10457},{"edgeType":"contains","source":1,"target":1510},{"edgeType":"contains","source":4869,"target":4930},{"edgeType":"contains","source":2916,"target":3107},{"edgeType":"calls","source":6052,"target":6036},{"edgeType":"contains","source":4672,"target":4695},{"edgeType":"contains","source":6918,"target":6940},{"edgeType":"contains","source":8074,"target":8100},{"edgeType":"contains","source":11279,"target":11281},{"edgeType":"contains","source":1139,"target":3227},{"edgeType":"contains","source":6144,"target":6623},{"edgeType":"contains","source":5230,"target":5366},{"edgeType":"contains","source":8303,"target":4172},{"edgeType":"contains","source":5342,"target":6122},{"edgeType":"contains","source":5686,"target":6023},{"edgeType":"contains","source":5424,"target":5694},{"edgeType":"contains","source":5860,"target":5914},{"edgeType":"imports","source":9852,"target":9818},{"edgeType":"calls","source":9884,"target":9836},{"edgeType":"contains","source":4869,"target":4929},{"edgeType":"calls","source":4334,"target":4328},{"edgeType":"calls","source":11928,"target":2498},{"edgeType":"calls","source":11440,"target":11284},{"edgeType":"contains","source":6918,"target":6941},{"edgeType":"contains","source":7282,"target":7286},{"edgeType":"contains","source":5230,"target":5365},{"edgeType":"imports","source":11515,"target":10059},{"edgeType":"contains","source":7348,"target":7354},{"edgeType":"calls","source":700,"target":709},{"edgeType":"calls","source":6843,"target":6862},{"edgeType":"contains","source":5342,"target":6121},{"edgeType":"contains","source":1139,"target":3230},{"edgeType":"calls","source":8235,"target":8106},{"edgeType":"contains","source":5424,"target":5693},{"edgeType":"contains","source":5860,"target":5915},{"edgeType":"contains","source":7637,"target":7909},{"edgeType":"imports","source":2585,"target":420},{"edgeType":"imports","source":10514,"target":10436},{"edgeType":"calls","source":11932,"target":11884},{"edgeType":"imports","source":12259,"target":2847},{"edgeType":"contains","source":6918,"target":6942},{"edgeType":"calls","source":6378,"target":4365},{"edgeType":"calls","source":6315,"target":6318},{"edgeType":"contains","source":4869,"target":4928},{"edgeType":"contains","source":6159,"target":6160},{"edgeType":"calls","source":6088,"target":5975},{"edgeType":"calls","source":11770,"target":3165},{"edgeType":"contains","source":4672,"target":4693},{"edgeType":"calls","source":2319,"target":2312},{"edgeType":"imports","source":2244,"target":420},{"edgeType":"imports","source":1434,"target":1218},{"edgeType":"contains","source":12302,"target":12332},{"edgeType":"contains","source":1139,"target":3229},{"edgeType":"contains","source":5342,"target":6120},{"edgeType":"contains","source":5424,"target":5692},{"edgeType":"calls","source":12303,"target":2498},{"edgeType":"calls","source":1661,"target":1571},{"edgeType":"contains","source":12335,"target":12367},{"edgeType":"contains","source":11276,"target":11371},{"edgeType":"contains","source":704,"target":858},{"edgeType":"contains","source":547,"target":1497},{"edgeType":"contains","source":7637,"target":7919},{"edgeType":"calls","source":970,"target":789},{"edgeType":"contains","source":10887,"target":4417},{"edgeType":"contains","source":6853,"target":6854},{"edgeType":"calls","source":1460,"target":1455},{"edgeType":"contains","source":1139,"target":3232},{"edgeType":"contains","source":5230,"target":5371},{"edgeType":"contains","source":9028,"target":9194},{"edgeType":"contains","source":12862,"target":12958},{"edgeType":"contains","source":5342,"target":6127},{"edgeType":"contains","source":411,"target":431},{"edgeType":"calls","source":7174,"target":7174},{"edgeType":"contains","source":7910,"target":7913},{"edgeType":"contains","source":8082,"target":1524},{"edgeType":"contains","source":10321,"target":10336},{"edgeType":"contains","source":704,"target":861},{"edgeType":"contains","source":7844,"target":7845},{"edgeType":"contains","source":5927,"target":5963},{"edgeType":"contains","source":5961,"target":5966},{"edgeType":"contains","source":6144,"target":6635},{"edgeType":"contains","source":11874,"target":11875},{"edgeType":"calls","source":4334,"target":4323},{"edgeType":"calls","source":3045,"target":3059},{"edgeType":"contains","source":8897,"target":9026},{"edgeType":"contains","source":1139,"target":3231},{"edgeType":"contains","source":1347,"target":1014},{"edgeType":"calls","source":1691,"target":1692},{"edgeType":"contains","source":5342,"target":6126},{"edgeType":"contains","source":5424,"target":5698},{"edgeType":"contains","source":12204,"target":12214},{"edgeType":"contains","source":7910,"target":7912},{"edgeType":"imports","source":646,"target":293},{"edgeType":"contains","source":3847,"target":3848},{"edgeType":"contains","source":704,"target":860},{"edgeType":"calls","source":2338,"target":665},{"edgeType":"calls","source":7376,"target":1970},{"edgeType":"contains","source":8107,"target":8147},{"edgeType":"contains","source":6256,"target":6336},{"edgeType":"contains","source":5230,"target":5369},{"edgeType":"contains","source":1805,"target":2668},{"edgeType":"contains","source":6912,"target":1856},{"edgeType":"contains","source":5342,"target":6125},{"edgeType":"imports","source":2244,"target":1491},{"edgeType":"contains","source":12862,"target":12955},{"edgeType":"contains","source":12235,"target":12309},{"edgeType":"contains","source":12302,"target":12346},{"edgeType":"contains","source":9294,"target":9406},{"edgeType":"contains","source":11675,"target":11698},{"edgeType":"contains","source":704,"target":863},{"edgeType":"contains","source":6159,"target":6172},{"edgeType":"imports","source":12147,"target":3144},{"edgeType":"calls","source":2823,"target":2539},{"edgeType":"calls","source":665,"target":733},{"edgeType":"calls","source":2659,"target":2338},{"edgeType":"contains","source":7910,"target":7915},{"edgeType":"contains","source":899,"target":1160},{"edgeType":"calls","source":866,"target":843},{"edgeType":"contains","source":907,"target":912},{"edgeType":"contains","source":6256,"target":6337},{"edgeType":"contains","source":2847,"target":3136},{"edgeType":"contains","source":3152,"target":3194},{"edgeType":"calls","source":8715,"target":2743},{"edgeType":"contains","source":5230,"target":5368},{"edgeType":"contains","source":5342,"target":6124},{"edgeType":"calls","source":12442,"target":5593},{"edgeType":"contains","source":8039,"target":8143},{"edgeType":"contains","source":12237,"target":12246},{"edgeType":"contains","source":4672,"target":4696},{"edgeType":"contains","source":12302,"target":12345},{"edgeType":"calls","source":3904,"target":3911},{"edgeType":"calls","source":7107,"target":7140},{"edgeType":"contains","source":10321,"target":10335},{"edgeType":"contains","source":10301,"target":10955},{"edgeType":"contains","source":11675,"target":11699},{"edgeType":"imports","source":12201,"target":414},{"edgeType":"contains","source":10355,"target":10338},{"edgeType":"contains","source":6159,"target":6173},{"edgeType":"calls","source":601,"target":602},{"edgeType":"contains","source":7910,"target":7914},{"edgeType":"contains","source":9925,"target":9927},{"edgeType":"contains","source":7976,"target":7982},{"edgeType":"contains","source":2847,"target":3141},{"edgeType":"calls","source":7240,"target":7246},{"edgeType":"calls","source":6880,"target":436},{"edgeType":"contains","source":5927,"target":5958},{"edgeType":"contains","source":6984,"target":7017},{"edgeType":"contains","source":7018,"target":7020},{"edgeType":"contains","source":907,"target":915},{"edgeType":"calls","source":1771,"target":266},{"edgeType":"calls","source":5820,"target":5821},{"edgeType":"contains","source":10983,"target":10951},{"edgeType":"contains","source":2922,"target":2930},{"edgeType":"contains","source":3016,"target":3187},{"edgeType":"contains","source":7348,"target":7360},{"edgeType":"contains","source":5230,"target":5375},{"edgeType":"contains","source":12302,"target":12344},{"edgeType":"contains","source":4672,"target":4703},{"edgeType":"contains","source":6752,"target":6809},{"edgeType":"contains","source":8897,"target":9022},{"edgeType":"contains","source":10367,"target":11020},{"edgeType":"contains","source":4131,"target":4562},{"edgeType":"calls","source":9057,"target":9057},{"edgeType":"contains","source":3847,"target":3853},{"edgeType":"imports","source":9848,"target":420},{"edgeType":"contains","source":2847,"target":3142},{"edgeType":"contains","source":907,"target":914},{"edgeType":"calls","source":3480,"target":3312},{"edgeType":"contains","source":2922,"target":2931},{"edgeType":"contains","source":12302,"target":12343},{"edgeType":"contains","source":5230,"target":5374},{"edgeType":"contains","source":5342,"target":6130},{"edgeType":"contains","source":4672,"target":4702},{"edgeType":"contains","source":6918,"target":6949},{"edgeType":"imports","source":1797,"target":1603},{"edgeType":"contains","source":5968,"target":5746},{"edgeType":"contains","source":10321,"target":10333},{"edgeType":"contains","source":12235,"target":12306},{"edgeType":"contains","source":12237,"target":12244},{"edgeType":"contains","source":6291,"target":6303},{"edgeType":"calls","source":10903,"target":2567},{"edgeType":"contains","source":8897,"target":9025},{"edgeType":"contains","source":5230,"target":5373},{"edgeType":"contains","source":11732,"target":414},{"edgeType":"calls","source":6239,"target":2343},{"edgeType":"contains","source":12302,"target":12342},{"edgeType":"calls","source":6845,"target":6809},{"edgeType":"contains","source":5342,"target":6129},{"edgeType":"contains","source":7910,"target":7911},{"edgeType":"contains","source":3847,"target":3851},{"edgeType":"contains","source":6144,"target":6633},{"edgeType":"contains","source":12335,"target":12376},{"edgeType":"contains","source":704,"target":867},{"edgeType":"contains","source":7282,"target":7295},{"edgeType":"contains","source":7348,"target":7363},{"edgeType":"contains","source":5230,"target":5372},{"edgeType":"contains","source":5342,"target":6128},{"edgeType":"contains","source":9476,"target":9044},{"edgeType":"calls","source":3343,"target":3328},{"edgeType":"contains","source":12140,"target":12078},{"edgeType":"imports","source":10037,"target":3016},{"edgeType":"contains","source":7976,"target":7978},{"edgeType":"calls","source":839,"target":619},{"edgeType":"contains","source":10301,"target":10951},{"edgeType":"contains","source":6159,"target":6169},{"edgeType":"calls","source":11055,"target":8427},{"edgeType":"contains","source":12335,"target":12357},{"edgeType":"calls","source":7871,"target":7872},{"edgeType":"calls","source":11553,"target":2606},{"edgeType":"contains","source":11741,"target":11744},{"edgeType":"contains","source":6984,"target":6996},{"edgeType":"calls","source":12403,"target":568},{"edgeType":"contains","source":4672,"target":4675},{"edgeType":"calls","source":3545,"target":3505},{"edgeType":"contains","source":10608,"target":9870},{"edgeType":"contains","source":12302,"target":12323},{"edgeType":"calls","source":7677,"target":7544},{"edgeType":"contains","source":8616,"target":7142},{"edgeType":"contains","source":13392,"target":13415},{"edgeType":"imports","source":7001,"target":7074},{"edgeType":"contains","source":1144,"target":1995},{"edgeType":"contains","source":8039,"target":8117},{"edgeType":"contains","source":5230,"target":5346},{"edgeType":"contains","source":3615,"target":3617},{"edgeType":"calls","source":6881,"target":6851},{"edgeType":"contains","source":2788,"target":2828},{"edgeType":"contains","source":4869,"target":4909},{"edgeType":"contains","source":7019,"target":2741},{"edgeType":"contains","source":11675,"target":11677},{"edgeType":"calls","source":2373,"target":1784},{"edgeType":"contains","source":8303,"target":4160},{"edgeType":"contains","source":12962,"target":13003},{"edgeType":"contains","source":12302,"target":12322},{"edgeType":"calls","source":1988,"target":2089},{"edgeType":"contains","source":5230,"target":5345},{"edgeType":"contains","source":8591,"target":10030},{"edgeType":"contains","source":13392,"target":13414},{"edgeType":"contains","source":1144,"target":1994},{"edgeType":"calls","source":6814,"target":6815},{"edgeType":"contains","source":8039,"target":8116},{"edgeType":"contains","source":5342,"target":6101},{"edgeType":"contains","source":3747,"target":3752},{"edgeType":"calls","source":6532,"target":6044},{"edgeType":"contains","source":11741,"target":11742},{"edgeType":"calls","source":3715,"target":3518},{"edgeType":"calls","source":11901,"target":11900},{"edgeType":"contains","source":10419,"target":10442},{"edgeType":"contains","source":6984,"target":6998},{"edgeType":"contains","source":11461,"target":2452},{"edgeType":"contains","source":12962,"target":13002},{"edgeType":"contains","source":8936,"target":8852},{"edgeType":"contains","source":899,"target":1136},{"edgeType":"contains","source":10813,"target":10913},{"edgeType":"contains","source":2657,"target":2658},{"edgeType":"contains","source":6752,"target":6791},{"edgeType":"calls","source":11951,"target":2951},{"edgeType":"imports","source":1954,"target":1801},{"edgeType":"calls","source":1892,"target":1897},{"edgeType":"calls","source":11614,"target":11284},{"edgeType":"contains","source":8107,"target":726},{"edgeType":"contains","source":5230,"target":5344},{"edgeType":"contains","source":9294,"target":9381},{"edgeType":"contains","source":13392,"target":13413},{"edgeType":"calls","source":6814,"target":6816},{"edgeType":"contains","source":1144,"target":1997},{"edgeType":"contains","source":3747,"target":3751},{"edgeType":"contains","source":13557,"target":13583},{"edgeType":"contains","source":1497,"target":565},{"edgeType":"contains","source":11741,"target":11743},{"edgeType":"contains","source":12335,"target":12354},{"edgeType":"contains","source":6984,"target":6999},{"edgeType":"contains","source":9028,"target":9170},{"edgeType":"contains","source":899,"target":1135},{"edgeType":"contains","source":8074,"target":8090},{"edgeType":"contains","source":10155,"target":10171},{"edgeType":"contains","source":2624,"target":2625},{"edgeType":"contains","source":1,"target":13117},{"edgeType":"contains","source":5230,"target":5343},{"edgeType":"contains","source":13392,"target":13412},{"edgeType":"contains","source":1144,"target":1996},{"edgeType":"contains","source":8039,"target":8118},{"edgeType":"calls","source":4613,"target":4220},{"edgeType":"contains","source":4416,"target":4151},{"edgeType":"calls","source":3151,"target":3033},{"edgeType":"contains","source":4131,"target":4530},{"edgeType":"contains","source":6984,"target":6992},{"edgeType":"contains","source":2788,"target":2831},{"edgeType":"calls","source":4371,"target":4321},{"edgeType":"calls","source":12562,"target":12556},{"edgeType":"contains","source":8401,"target":8518},{"edgeType":"calls","source":205,"target":279},{"edgeType":"contains","source":2917,"target":3060},{"edgeType":"contains","source":10710,"target":9875},{"edgeType":"contains","source":704,"target":841},{"edgeType":"contains","source":2492,"target":2494},{"edgeType":"contains","source":4474,"target":4475},{"edgeType":"contains","source":3747,"target":3757},{"edgeType":"contains","source":8591,"target":10027},{"edgeType":"contains","source":13392,"target":13411},{"edgeType":"contains","source":12437,"target":2849},{"edgeType":"contains","source":1144,"target":1999},{"edgeType":"calls","source":6484,"target":6478},{"edgeType":"contains","source":5230,"target":5350},{"edgeType":"contains","source":11905,"target":11942},{"edgeType":"contains","source":6984,"target":6993},{"edgeType":"calls","source":12399,"target":12325},{"edgeType":"calls","source":11928,"target":2614},{"edgeType":"imports","source":12276,"target":11617},{"edgeType":"calls","source":11277,"target":11167},{"edgeType":"contains","source":2849,"target":3055},{"edgeType":"contains","source":9002,"target":8913},{"edgeType":"contains","source":12864,"target":12866},{"edgeType":"contains","source":12698,"target":12726},{"edgeType":"contains","source":704,"target":840},{"edgeType":"contains","source":5230,"target":5349},{"edgeType":"contains","source":8591,"target":10026},{"edgeType":"contains","source":9294,"target":9374},{"edgeType":"calls","source":11533,"target":10631},{"edgeType":"contains","source":13392,"target":13410},{"edgeType":"contains","source":1144,"target":1998},{"edgeType":"contains","source":5075,"target":4869},{"edgeType":"calls","source":12661,"target":12658},{"edgeType":"contains","source":5342,"target":6105},{"edgeType":"imports","source":1511,"target":733},{"edgeType":"calls","source":967,"target":968},{"edgeType":"contains","source":3615,"target":3620},{"edgeType":"calls","source":7859,"target":1908},{"edgeType":"calls","source":11175,"target":11155},{"edgeType":"contains","source":2788,"target":2829},{"edgeType":"contains","source":6984,"target":6994},{"edgeType":"contains","source":4133,"target":4473},{"edgeType":"contains","source":411,"target":413},{"edgeType":"calls","source":1988,"target":2088},{"edgeType":"contains","source":3747,"target":3755},{"edgeType":"contains","source":8591,"target":10029},{"edgeType":"imports","source":12565,"target":10059},{"edgeType":"contains","source":8039,"target":8115},{"edgeType":"contains","source":5230,"target":5348},{"edgeType":"contains","source":13425,"target":13443},{"edgeType":"contains","source":9294,"target":9377},{"edgeType":"contains","source":13392,"target":13409},{"edgeType":"imports","source":891,"target":924},{"edgeType":"imports","source":12618,"target":12644},{"edgeType":"contains","source":1144,"target":2001},{"edgeType":"calls","source":803,"target":770},{"edgeType":"contains","source":5342,"target":6104},{"edgeType":"contains","source":3615,"target":3619},{"edgeType":"contains","source":2788,"target":2830},{"edgeType":"imports","source":3763,"target":3869},{"edgeType":"contains","source":4869,"target":4911},{"edgeType":"contains","source":7019,"target":2739},{"edgeType":"contains","source":6984,"target":6995},{"edgeType":"contains","source":411,"target":412},{"edgeType":"contains","source":13557,"target":13578},{"edgeType":"contains","source":8591,"target":10028},{"edgeType":"contains","source":10155,"target":10167},{"edgeType":"contains","source":5230,"target":5347},{"edgeType":"contains","source":13425,"target":13442},{"edgeType":"contains","source":13392,"target":13408},{"edgeType":"contains","source":1144,"target":2000},{"edgeType":"contains","source":5342,"target":6103},{"edgeType":"calls","source":12364,"target":12350},{"edgeType":"contains","source":3747,"target":3754},{"edgeType":"calls","source":1827,"target":1788},{"edgeType":"calls","source":1132,"target":1135},{"edgeType":"calls","source":10654,"target":3000},{"edgeType":"calls","source":2007,"target":436},{"edgeType":"calls","source":5837,"target":4324},{"edgeType":"calls","source":12364,"target":12356},{"edgeType":"contains","source":13392,"target":13424},{"edgeType":"contains","source":12340,"target":12210},{"edgeType":"contains","source":4342,"target":4343},{"edgeType":"contains","source":2892,"target":3839},{"edgeType":"calls","source":9397,"target":9199},{"edgeType":"calls","source":5459,"target":5471},{"edgeType":"contains","source":6912,"target":7122},{"edgeType":"contains","source":11276,"target":11368},{"edgeType":"calls","source":5477,"target":685},{"edgeType":"imports","source":9491,"target":8097},{"edgeType":"contains","source":7316,"target":7282},{"edgeType":"contains","source":5230,"target":5354},{"edgeType":"calls","source":8136,"target":8121},{"edgeType":"contains","source":5342,"target":6110},{"edgeType":"contains","source":7348,"target":7349},{"edgeType":"calls","source":1156,"target":390},{"edgeType":"calls","source":4613,"target":4213},{"edgeType":"calls","source":5889,"target":5882},{"edgeType":"calls","source":9198,"target":568},{"edgeType":"contains","source":2892,"target":3840},{"edgeType":"imports","source":3763,"target":3855},{"edgeType":"calls","source":946,"target":558},{"edgeType":"contains","source":4869,"target":4917},{"edgeType":"contains","source":5230,"target":5353},{"edgeType":"contains","source":9294,"target":9386},{"edgeType":"contains","source":13392,"target":13422},{"edgeType":"contains","source":1144,"target":2002},{"edgeType":"contains","source":6918,"target":6937},{"edgeType":"contains","source":11276,"target":11369},{"edgeType":"contains","source":6984,"target":7005},{"edgeType":"contains","source":5342,"target":6109},{"edgeType":"calls","source":1495,"target":1508},{"edgeType":"contains","source":4672,"target":4681},{"edgeType":"contains","source":11675,"target":11682},{"edgeType":"contains","source":4869,"target":4916},{"edgeType":"contains","source":4441,"target":4443},{"edgeType":"calls","source":11370,"target":3000},{"edgeType":"contains","source":5686,"target":6020},{"edgeType":"contains","source":6291,"target":6292},{"edgeType":"calls","source":2227,"target":1014},{"edgeType":"calls","source":11896,"target":436},{"edgeType":"contains","source":2916,"target":3093},{"edgeType":"imports","source":9341,"target":1118},{"edgeType":"contains","source":6918,"target":6938},{"edgeType":"contains","source":6984,"target":7006},{"edgeType":"contains","source":5342,"target":6108},{"edgeType":"calls","source":9919,"target":9931},{"edgeType":"contains","source":4672,"target":4680},{"edgeType":"imports","source":1139,"target":649},{"edgeType":"calls","source":4813,"target":4353},{"edgeType":"contains","source":11675,"target":11683},{"edgeType":"calls","source":174,"target":180},{"edgeType":"calls","source":9027,"target":9042},{"edgeType":"contains","source":12144,"target":11941},{"edgeType":"contains","source":11214,"target":11175},{"edgeType":"contains","source":3747,"target":3758},{"edgeType":"calls","source":10854,"target":8427},{"edgeType":"calls","source":2756,"target":2586},{"edgeType":"imports","source":9341,"target":1119},{"edgeType":"contains","source":9294,"target":9388},{"edgeType":"contains","source":1144,"target":2004},{"edgeType":"contains","source":5342,"target":6107},{"edgeType":"contains","source":6918,"target":6939},{"edgeType":"contains","source":6912,"target":7125},{"edgeType":"calls","source":11637,"target":11642},{"edgeType":"contains","source":12302,"target":12327},{"edgeType":"contains","source":4640,"target":4622},{"edgeType":"contains","source":5230,"target":5359},{"edgeType":"contains","source":4672,"target":4687},{"edgeType":"contains","source":10820,"target":10702},{"edgeType":"contains","source":11675,"target":11680},{"edgeType":"calls","source":5888,"target":5910},{"edgeType":"contains","source":8197,"target":2166},{"edgeType":"contains","source":4131,"target":4545},{"edgeType":"calls","source":5850,"target":745},{"edgeType":"contains","source":8082,"target":2560},{"edgeType":"contains","source":704,"target":849},{"edgeType":"contains","source":6984,"target":7000},{"edgeType":"contains","source":1287,"target":747},{"edgeType":"contains","source":9294,"target":9383},{"edgeType":"contains","source":13392,"target":13419},{"edgeType":"contains","source":9664,"target":3198},{"edgeType":"calls","source":9864,"target":8467},{"edgeType":"contains","source":1805,"target":2659},{"edgeType":"contains","source":11618,"target":9220},{"edgeType":"contains","source":5230,"target":5358},{"edgeType":"contains","source":8303,"target":4164},{"edgeType":"contains","source":4672,"target":4686},{"edgeType":"contains","source":5342,"target":6114},{"edgeType":"contains","source":11674,"target":11712},{"edgeType":"imports","source":12553,"target":12535},{"edgeType":"calls","source":802,"target":789},{"edgeType":"contains","source":8083,"target":414},{"edgeType":"imports","source":11674,"target":679},{"edgeType":"calls","source":3715,"target":3508},{"edgeType":"contains","source":4869,"target":4921},{"edgeType":"contains","source":13392,"target":13418},{"edgeType":"calls","source":9900,"target":8407},{"edgeType":"contains","source":3318,"target":3320},{"edgeType":"contains","source":5342,"target":6113},{"edgeType":"contains","source":4672,"target":4685},{"edgeType":"calls","source":12399,"target":12330},{"edgeType":"contains","source":13755,"target":13792},{"edgeType":"imports","source":12432,"target":12059},{"edgeType":"contains","source":10155,"target":10174},{"edgeType":"imports","source":10367,"target":8427},{"edgeType":"contains","source":12235,"target":12288},{"edgeType":"calls","source":4805,"target":4598},{"edgeType":"contains","source":4131,"target":5600},{"edgeType":"calls","source":2321,"target":2324},{"edgeType":"contains","source":2892,"target":3841},{"edgeType":"calls","source":8433,"target":8435},{"edgeType":"contains","source":12140,"target":2549},{"edgeType":"calls","source":3510,"target":3518},{"edgeType":"contains","source":5230,"target":5356},{"edgeType":"calls","source":9969,"target":3100},{"edgeType":"contains","source":13392,"target":13417},{"edgeType":"calls","source":12331,"target":12325},{"edgeType":"contains","source":5342,"target":6112},{"edgeType":"contains","source":11675,"target":11679},{"edgeType":"contains","source":13755,"target":13791},{"edgeType":"contains","source":4672,"target":4684},{"edgeType":"contains","source":4441,"target":4446},{"edgeType":"calls","source":10961,"target":3000},{"edgeType":"calls","source":10848,"target":10731},{"edgeType":"calls","source":12926,"target":12905},{"edgeType":"contains","source":2892,"target":3842},{"edgeType":"calls","source":5885,"target":1771},{"edgeType":"contains","source":4342,"target":4344},{"edgeType":"calls","source":7211,"target":7207},{"edgeType":"contains","source":11905,"target":11947},{"edgeType":"contains","source":3557,"target":3310},{"edgeType":"contains","source":7637,"target":7900},{"edgeType":"contains","source":4869,"target":4919},{"edgeType":"contains","source":8967,"target":8951},{"edgeType":"contains","source":6984,"target":7003},{"edgeType":"contains","source":918,"target":558},{"edgeType":"calls","source":3547,"target":3429},{"edgeType":"calls","source":9690,"target":9634},{"edgeType":"imports","source":7001,"target":7071},{"edgeType":"contains","source":9294,"target":9384},{"edgeType":"contains","source":13392,"target":13416},{"edgeType":"contains","source":3152,"target":3154},{"edgeType":"contains","source":13392,"target":13399},{"edgeType":"contains","source":13524,"target":13535},{"edgeType":"contains","source":13425,"target":13433},{"edgeType":"contains","source":4869,"target":4893},{"edgeType":"contains","source":5530,"target":5544},{"edgeType":"calls","source":8467,"target":8407},{"edgeType":"contains","source":113,"target":115},{"edgeType":"calls","source":1569,"target":1354},{"edgeType":"contains","source":6752,"target":6772},{"edgeType":"contains","source":12892,"target":13043},{"edgeType":"calls","source":13090,"target":13081},{"edgeType":"contains","source":8767,"target":8787},{"edgeType":"contains","source":10155,"target":10156},{"edgeType":"contains","source":8401,"target":8506},{"edgeType":"calls","source":9328,"target":9199},{"edgeType":"contains","source":10813,"target":10898},{"edgeType":"calls","source":3748,"target":3570},{"edgeType":"contains","source":8591,"target":10015},{"edgeType":"contains","source":5230,"target":5329},{"edgeType":"contains","source":13425,"target":13432},{"edgeType":"contains","source":13392,"target":13398},{"edgeType":"contains","source":11276,"target":11345},{"edgeType":"calls","source":578,"target":363},{"edgeType":"imports","source":1672,"target":1014},{"edgeType":"contains","source":5342,"target":6085},{"edgeType":"contains","source":9197,"target":9198},{"edgeType":"contains","source":11803,"target":11919},{"edgeType":"imports","source":12255,"target":12256},{"edgeType":"imports","source":899,"target":667},{"edgeType":"contains","source":13557,"target":13568},{"edgeType":"imports","source":12554,"target":12500},{"edgeType":"contains","source":13524,"target":13534},{"edgeType":"contains","source":113,"target":114},{"edgeType":"contains","source":4209,"target":4212},{"edgeType":"contains","source":5530,"target":5545},{"edgeType":"contains","source":4132,"target":4485},{"edgeType":"calls","source":11285,"target":9842},{"edgeType":"contains","source":4275,"target":4280},{"edgeType":"calls","source":7177,"target":7173},{"edgeType":"contains","source":10155,"target":10157},{"edgeType":"contains","source":4869,"target":4892},{"edgeType":"contains","source":5230,"target":5328},{"edgeType":"contains","source":13425,"target":13431},{"edgeType":"contains","source":11344,"target":11348},{"edgeType":"contains","source":13392,"target":13397},{"edgeType":"contains","source":9197,"target":9201},{"edgeType":"contains","source":11410,"target":11416},{"edgeType":"calls","source":5564,"target":4353},{"edgeType":"contains","source":11276,"target":11342},{"edgeType":"contains","source":4407,"target":4415},{"edgeType":"calls","source":4675,"target":4429},{"edgeType":"contains","source":5761,"target":5784},{"edgeType":"contains","source":11803,"target":11918},{"edgeType":"contains","source":13557,"target":13567},{"edgeType":"contains","source":4209,"target":4211},{"edgeType":"contains","source":4131,"target":4515},{"edgeType":"contains","source":113,"target":117},{"edgeType":"imports","source":9491,"target":9144},{"edgeType":"calls","source":12036,"target":11926},{"edgeType":"calls","source":2365,"target":989},{"edgeType":"contains","source":1434,"target":2501},{"edgeType":"calls","source":5986,"target":6069},{"edgeType":"contains","source":2657,"target":2641},{"edgeType":"contains","source":6752,"target":6774},{"edgeType":"calls","source":9721,"target":9702},{"edgeType":"calls","source":1898,"target":1727},{"edgeType":"contains","source":8338,"target":8347},{"edgeType":"contains","source":8591,"target":10017},{"edgeType":"contains","source":10813,"target":10896},{"edgeType":"calls","source":1689,"target":807},{"edgeType":"imports","source":13797,"target":12023},{"edgeType":"contains","source":5230,"target":5327},{"edgeType":"contains","source":13425,"target":13430},{"edgeType":"contains","source":3152,"target":3153},{"edgeType":"contains","source":5761,"target":5785},{"edgeType":"contains","source":9294,"target":9364},{"edgeType":"contains","source":11344,"target":11349},{"edgeType":"contains","source":7050,"target":7051},{"edgeType":"contains","source":11905,"target":11926},{"edgeType":"contains","source":4132,"target":4482},{"edgeType":"contains","source":9390,"target":9559},{"edgeType":"contains","source":11803,"target":11917},{"edgeType":"contains","source":13524,"target":13532},{"edgeType":"calls","source":6484,"target":6460},{"edgeType":"contains","source":5530,"target":5547},{"edgeType":"imports","source":1139,"target":2738},{"edgeType":"calls","source":3806,"target":714},{"edgeType":"contains","source":9698,"target":8467},{"edgeType":"contains","source":113,"target":116},{"edgeType":"calls","source":7838,"target":7824},{"edgeType":"calls","source":13228,"target":13028},{"edgeType":"imports","source":554,"target":789},{"edgeType":"contains","source":8107,"target":8108},{"edgeType":"contains","source":12302,"target":12304},{"edgeType":"contains","source":6256,"target":6296},{"edgeType":"contains","source":4869,"target":4890},{"edgeType":"contains","source":8591,"target":10016},{"edgeType":"calls","source":2749,"target":2824},{"edgeType":"contains","source":13524,"target":13531},{"edgeType":"contains","source":8591,"target":10011},{"edgeType":"contains","source":1,"target":13104},{"edgeType":"contains","source":13425,"target":13429},{"edgeType":"calls","source":8829,"target":8816},{"edgeType":"contains","source":11344,"target":11346},{"edgeType":"contains","source":7281,"target":7282},{"edgeType":"calls","source":11253,"target":266},{"edgeType":"imports","source":6144,"target":6146},{"edgeType":"contains","source":12235,"target":12265},{"edgeType":"contains","source":12273,"target":12144},{"edgeType":"calls","source":1562,"target":1567},{"edgeType":"contains","source":5761,"target":5778},{"edgeType":"imports","source":1511,"target":717},{"edgeType":"contains","source":5230,"target":5334},{"edgeType":"contains","source":5342,"target":6090},{"edgeType":"contains","source":11803,"target":11916},{"edgeType":"calls","source":11833,"target":11883},{"edgeType":"contains","source":10419,"target":10424},{"edgeType":"contains","source":7709,"target":7756},{"edgeType":"contains","source":5530,"target":5540},{"edgeType":"contains","source":113,"target":119},{"edgeType":"contains","source":6455,"target":6462},{"edgeType":"contains","source":8337,"target":8372},{"edgeType":"contains","source":6752,"target":6768},{"edgeType":"contains","source":8762,"target":8938},{"edgeType":"contains","source":8767,"target":8783},{"edgeType":"contains","source":13557,"target":13564},{"edgeType":"contains","source":13524,"target":13530},{"edgeType":"contains","source":5230,"target":5333},{"edgeType":"contains","source":8591,"target":10010},{"edgeType":"contains","source":13425,"target":13428},{"edgeType":"calls","source":670,"target":678},{"edgeType":"contains","source":5761,"target":5779},{"edgeType":"contains","source":8082,"target":420},{"edgeType":"contains","source":11905,"target":11924},{"edgeType":"contains","source":11836,"target":11949},{"edgeType":"contains","source":11803,"target":11915},{"edgeType":"contains","source":704,"target":823},{"edgeType":"calls","source":5160,"target":4190},{"edgeType":"calls","source":7106,"target":3036},{"edgeType":"calls","source":439,"target":440},{"edgeType":"contains","source":4869,"target":4896},{"edgeType":"contains","source":113,"target":118},{"edgeType":"contains","source":4179,"target":5146},{"edgeType":"contains","source":5530,"target":5541},{"edgeType":"contains","source":4132,"target":4489},{"edgeType":"contains","source":6443,"target":2607},{"edgeType":"contains","source":8338,"target":8340},{"edgeType":"contains","source":12335,"target":12336},{"edgeType":"contains","source":2849,"target":3038},{"edgeType":"calls","source":2286,"target":266},{"edgeType":"contains","source":12730,"target":12775},{"edgeType":"calls","source":11482,"target":568},{"edgeType":"imports","source":6144,"target":6148},{"edgeType":"contains","source":13524,"target":13529},{"edgeType":"contains","source":8591,"target":10013},{"edgeType":"contains","source":13557,"target":13563},{"edgeType":"calls","source":3584,"target":3363},{"edgeType":"contains","source":5230,"target":5332},{"edgeType":"calls","source":8829,"target":8818},{"edgeType":"contains","source":9294,"target":9361},{"edgeType":"contains","source":13392,"target":13393},{"edgeType":"calls","source":1463,"target":1467},{"edgeType":"contains","source":11410,"target":11412},{"edgeType":"calls","source":2996,"target":2564},{"edgeType":"contains","source":5761,"target":5780},{"edgeType":"calls","source":9027,"target":9023},{"edgeType":"contains","source":8337,"target":8374},{"edgeType":"calls","source":2487,"target":2488},{"edgeType":"contains","source":8401,"target":8504},{"edgeType":"contains","source":6144,"target":6592},{"edgeType":"contains","source":42,"target":208},{"edgeType":"contains","source":10419,"target":10422},{"edgeType":"calls","source":5766,"target":4429},{"edgeType":"contains","source":11618,"target":2849},{"edgeType":"contains","source":704,"target":826},{"edgeType":"contains","source":6752,"target":6770},{"edgeType":"calls","source":7210,"target":7212},{"edgeType":"contains","source":8767,"target":8785},{"edgeType":"calls","source":7524,"target":650},{"edgeType":"calls","source":11857,"target":568},{"edgeType":"imports","source":6144,"target":6147},{"edgeType":"contains","source":13524,"target":13528},{"edgeType":"contains","source":8591,"target":10012},{"edgeType":"calls","source":604,"target":612},{"edgeType":"contains","source":5230,"target":5331},{"edgeType":"contains","source":13425,"target":13426},{"edgeType":"calls","source":3247,"target":3241},{"edgeType":"contains","source":11983,"target":11618},{"edgeType":"contains","source":5761,"target":5781},{"edgeType":"contains","source":8338,"target":8342},{"edgeType":"contains","source":10419,"target":10423},{"edgeType":"contains","source":4869,"target":4894},{"edgeType":"contains","source":5530,"target":5543},{"edgeType":"calls","source":5757,"target":5764},{"edgeType":"contains","source":11276,"target":11338},{"edgeType":"imports","source":2609,"target":2615},{"edgeType":"contains","source":704,"target":825},{"edgeType":"contains","source":6752,"target":6771},{"edgeType":"contains","source":3016,"target":3150},{"edgeType":"calls","source":2749,"target":2820},{"edgeType":"contains","source":13392,"target":13407},{"edgeType":"imports","source":7001,"target":7050},{"edgeType":"contains","source":1144,"target":1987},{"edgeType":"contains","source":11276,"target":11352},{"edgeType":"calls","source":1569,"target":1346},{"edgeType":"contains","source":6984,"target":6988},{"edgeType":"calls","source":6318,"target":6326},{"edgeType":"contains","source":5230,"target":5338},{"edgeType":"contains","source":5342,"target":6094},{"edgeType":"contains","source":10155,"target":10164},{"edgeType":"contains","source":13557,"target":13577},{"edgeType":"calls","source":1138,"target":965},{"edgeType":"calls","source":7961,"target":1902},{"edgeType":"contains","source":13524,"target":13543},{"edgeType":"calls","source":4774,"target":2411},{"edgeType":"contains","source":8591,"target":10023},{"edgeType":"contains","source":13425,"target":13441},{"edgeType":"contains","source":4132,"target":4494},{"edgeType":"contains","source":704,"target":828},{"edgeType":"calls","source":7012,"target":7010},{"edgeType":"contains","source":8074,"target":8081},{"edgeType":"calls","source":12431,"target":1807},{"edgeType":"contains","source":2849,"target":3043},{"edgeType":"calls","source":4805,"target":4620},{"edgeType":"calls","source":11789,"target":568},{"edgeType":"calls","source":1333,"target":1262},{"edgeType":"contains","source":4869,"target":4901},{"edgeType":"contains","source":13425,"target":13440},{"edgeType":"contains","source":13392,"target":13406},{"edgeType":"contains","source":10813,"target":10907},{"edgeType":"calls","source":4803,"target":454},{"edgeType":"contains","source":42,"target":209},{"edgeType":"contains","source":13557,"target":13576},{"edgeType":"contains","source":2788,"target":2819},{"edgeType":"calls","source":3806,"target":708},{"edgeType":"contains","source":13524,"target":13542},{"edgeType":"contains","source":3845,"target":3877},{"edgeType":"contains","source":8591,"target":10022},{"edgeType":"contains","source":4131,"target":4524},{"edgeType":"calls","source":604,"target":606},{"edgeType":"contains","source":704,"target":827},{"edgeType":"calls","source":571,"target":572},{"edgeType":"contains","source":8401,"target":8516},{"edgeType":"imports","source":12553,"target":12524},{"edgeType":"calls","source":4270,"target":4291},{"edgeType":"contains","source":807,"target":809},{"edgeType":"contains","source":12535,"target":11432},{"edgeType":"calls","source":6532,"target":6036},{"edgeType":"calls","source":10858,"target":3000},{"edgeType":"contains","source":5230,"target":5336},{"edgeType":"contains","source":13392,"target":13405},{"edgeType":"contains","source":1144,"target":1989},{"edgeType":"imports","source":9491,"target":8079},{"edgeType":"contains","source":1434,"target":2509},{"edgeType":"contains","source":5342,"target":6092},{"edgeType":"contains","source":12919,"target":13269},{"edgeType":"calls","source":9722,"target":9679},{"edgeType":"contains","source":13524,"target":13541},{"edgeType":"contains","source":8591,"target":10025},{"edgeType":"calls","source":7697,"target":575},{"edgeType":"contains","source":13557,"target":13575},{"edgeType":"contains","source":10369,"target":9870},{"edgeType":"contains","source":6223,"target":6269},{"edgeType":"contains","source":42,"target":212},{"edgeType":"contains","source":11972,"target":11973},{"edgeType":"contains","source":4278,"target":4194},{"edgeType":"contains","source":10155,"target":10162},{"edgeType":"contains","source":2888,"target":2889},{"edgeType":"calls","source":6484,"target":6468},{"edgeType":"contains","source":1434,"target":2510},{"edgeType":"calls","source":3064,"target":2567},{"edgeType":"imports","source":891,"target":921},{"edgeType":"contains","source":5230,"target":5335},{"edgeType":"contains","source":13425,"target":13438},{"edgeType":"contains","source":13392,"target":13404},{"edgeType":"contains","source":5342,"target":6091},{"edgeType":"contains","source":1139,"target":3200},{"edgeType":"calls","source":7970,"target":7969},{"edgeType":"contains","source":12235,"target":12275},{"edgeType":"contains","source":10884,"target":10818},{"edgeType":"contains","source":13557,"target":13574},{"edgeType":"contains","source":4869,"target":4898},{"edgeType":"contains","source":13524,"target":13540},{"edgeType":"imports","source":6769,"target":6843},{"edgeType":"contains","source":42,"target":211},{"edgeType":"contains","source":4242,"target":4252},{"edgeType":"contains","source":11905,"target":5593},{"edgeType":"contains","source":6223,"target":6270},{"edgeType":"calls","source":9062,"target":8998},{"edgeType":"calls","source":6300,"target":5839},{"edgeType":"contains","source":9197,"target":9203},{"edgeType":"contains","source":4179,"target":5155},{"edgeType":"calls","source":12397,"target":1807},{"edgeType":"contains","source":12667,"target":12623},{"edgeType":"contains","source":2723,"target":2724},{"edgeType":"imports","source":891,"target":918},{"edgeType":"calls","source":3768,"target":2938},{"edgeType":"contains","source":13524,"target":13539},{"edgeType":"contains","source":13425,"target":13437},{"edgeType":"contains","source":5530,"target":5548},{"edgeType":"contains","source":13392,"target":13403},{"edgeType":"contains","source":4869,"target":4906},{"edgeType":"calls","source":9693,"target":9524},{"edgeType":"calls","source":3484,"target":3286},{"edgeType":"contains","source":1144,"target":1991},{"edgeType":"calls","source":1264,"target":1283},{"edgeType":"contains","source":1831,"target":1836},{"edgeType":"contains","source":4672,"target":4670},{"edgeType":"contains","source":5342,"target":6098},{"edgeType":"contains","source":8765,"target":8853},{"edgeType":"contains","source":13557,"target":13573},{"edgeType":"calls","source":4159,"target":2444},{"edgeType":"contains","source":10813,"target":10902},{"edgeType":"calls","source":736,"target":739},{"edgeType":"contains","source":8591,"target":10019},{"edgeType":"contains","source":8241,"target":8185},{"edgeType":"calls","source":5152,"target":4429},{"edgeType":"contains","source":6984,"target":6985},{"edgeType":"contains","source":13557,"target":13572},{"edgeType":"contains","source":13524,"target":13538},{"edgeType":"contains","source":5230,"target":5341},{"edgeType":"calls","source":11868,"target":11865},{"edgeType":"contains","source":13425,"target":13436},{"edgeType":"contains","source":5530,"target":5549},{"edgeType":"contains","source":13392,"target":13402},{"edgeType":"contains","source":1144,"target":1990},{"edgeType":"calls","source":571,"target":568},{"edgeType":"calls","source":506,"target":469},{"edgeType":"calls","source":9882,"target":2606},{"edgeType":"calls","source":3151,"target":3039},{"edgeType":"contains","source":6752,"target":6777},{"edgeType":"calls","source":6089,"target":6036},{"edgeType":"calls","source":4017,"target":3676},{"edgeType":"contains","source":1,"target":427},{"edgeType":"contains","source":3747,"target":3748},{"edgeType":"calls","source":6224,"target":6079},{"edgeType":"contains","source":10238,"target":4417},{"edgeType":"contains","source":42,"target":213},{"edgeType":"contains","source":8074,"target":8076},{"edgeType":"contains","source":8767,"target":8790},{"edgeType":"calls","source":7245,"target":1906},{"edgeType":"contains","source":8591,"target":10018},{"edgeType":"calls","source":2338,"target":1817},{"edgeType":"contains","source":4132,"target":4497},{"edgeType":"contains","source":10155,"target":10161},{"edgeType":"calls","source":12001,"target":11967},{"edgeType":"contains","source":7637,"target":7884},{"edgeType":"contains","source":6984,"target":6986},{"edgeType":"contains","source":4840,"target":4746},{"edgeType":"contains","source":4869,"target":4904},{"edgeType":"contains","source":7218,"target":7131},{"edgeType":"contains","source":7434,"target":435},{"edgeType":"contains","source":5230,"target":5340},{"edgeType":"contains","source":13425,"target":13435},{"edgeType":"contains","source":13392,"target":13401},{"edgeType":"contains","source":1144,"target":1993},{"edgeType":"contains","source":2533,"target":2269},{"edgeType":"contains","source":1805,"target":2640},{"edgeType":"contains","source":8591,"target":10021},{"edgeType":"contains","source":10813,"target":10900},{"edgeType":"imports","source":12554,"target":11432},{"edgeType":"calls","source":4773,"target":4550},{"edgeType":"imports","source":3831,"target":3850},{"edgeType":"contains","source":12235,"target":12272},{"edgeType":"contains","source":11276,"target":11347},{"edgeType":"contains","source":9957,"target":9954},{"edgeType":"contains","source":11905,"target":11930},{"edgeType":"contains","source":4837,"target":4838},{"edgeType":"contains","source":13557,"target":13570},{"edgeType":"contains","source":5230,"target":5339},{"edgeType":"contains","source":13425,"target":13434},{"edgeType":"contains","source":7218,"target":7132},{"edgeType":"contains","source":13392,"target":13400},{"edgeType":"contains","source":1144,"target":1992},{"edgeType":"contains","source":5342,"target":6095},{"edgeType":"calls","source":1826,"target":1832},{"edgeType":"contains","source":7975,"target":7976},{"edgeType":"imports","source":3763,"target":3845},{"edgeType":"contains","source":5927,"target":5929},{"edgeType":"contains","source":8591,"target":10020},{"edgeType":"contains","source":8039,"target":8106},{"edgeType":"contains","source":4244,"target":4194},{"edgeType":"contains","source":6144,"target":6601},{"edgeType":"calls","source":2658,"target":351},{"edgeType":"contains","source":4869,"target":4877},{"edgeType":"contains","source":13755,"target":13757},{"edgeType":"contains","source":2251,"target":414},{"edgeType":"contains","source":4132,"target":4469},{"edgeType":"calls","source":11272,"target":11284},{"edgeType":"calls","source":1606,"target":1215},{"edgeType":"calls","source":2452,"target":2472},{"edgeType":"contains","source":1510,"target":2244},{"edgeType":"calls","source":5187,"target":4365},{"edgeType":"contains","source":8767,"target":8771},{"edgeType":"calls","source":11787,"target":11175},{"edgeType":"contains","source":4604,"target":4636},{"edgeType":"contains","source":899,"target":1101},{"edgeType":"contains","source":5230,"target":5313},{"edgeType":"contains","source":5860,"target":5868},{"edgeType":"contains","source":10675,"target":9875},{"edgeType":"contains","source":3214,"target":3329},{"edgeType":"contains","source":8096,"target":1032},{"edgeType":"contains","source":9420,"target":8611},{"edgeType":"contains","source":12698,"target":12699},{"edgeType":"calls","source":1435,"target":1230},{"edgeType":"contains","source":8062,"target":8428},{"edgeType":"calls","source":12504,"target":10088},{"edgeType":"imports","source":12901,"target":2849},{"edgeType":"contains","source":7808,"target":7846},{"edgeType":"calls","source":2620,"target":436},{"edgeType":"contains","source":3944,"target":3955},{"edgeType":"contains","source":42,"target":185},{"edgeType":"contains","source":5761,"target":5766},{"edgeType":"contains","source":5662,"target":5664},{"edgeType":"contains","source":7709,"target":7744},{"edgeType":"contains","source":5686,"target":5977},{"edgeType":"calls","source":9885,"target":9884},{"edgeType":"contains","source":11674,"target":11675},{"edgeType":"contains","source":6950,"target":6961},{"edgeType":"contains","source":4131,"target":4499},{"edgeType":"contains","source":704,"target":803},{"edgeType":"calls","source":5219,"target":4429},{"edgeType":"calls","source":12121,"target":2936},{"edgeType":"calls","source":7078,"target":7054},{"edgeType":"contains","source":10813,"target":10883},{"edgeType":"contains","source":12896,"target":12902},{"edgeType":"contains","source":4944,"target":4665},{"edgeType":"contains","source":8767,"target":8770},{"edgeType":"contains","source":5860,"target":5869},{"edgeType":"contains","source":5230,"target":5312},{"edgeType":"contains","source":4604,"target":4634},{"edgeType":"imports","source":8511,"target":1524},{"edgeType":"contains","source":3214,"target":3330},{"edgeType":"calls","source":12442,"target":2498},{"edgeType":"contains","source":12000,"target":12138},{"edgeType":"calls","source":801,"target":800},{"edgeType":"contains","source":3944,"target":3954},{"edgeType":"contains","source":42,"target":184},{"edgeType":"calls","source":4885,"target":4213},{"edgeType":"contains","source":7709,"target":7743},{"edgeType":"calls","source":270,"target":351},{"edgeType":"contains","source":42,"target":187},{"edgeType":"calls","source":2489,"target":266},{"edgeType":"contains","source":12,"target":60},{"edgeType":"contains","source":4209,"target":4194},{"edgeType":"imports","source":397,"target":420},{"edgeType":"calls","source":7078,"target":7055},{"edgeType":"contains","source":6752,"target":6758},{"edgeType":"contains","source":4672,"target":4640},{"edgeType":"calls","source":1694,"target":1660},{"edgeType":"calls","source":3838,"target":3900},{"edgeType":"contains","source":3085,"target":3098},{"edgeType":"contains","source":1805,"target":2611},{"edgeType":"contains","source":3214,"target":3327},{"edgeType":"contains","source":3878,"target":3885},{"edgeType":"contains","source":4604,"target":4633},{"edgeType":"calls","source":10160,"target":9818},{"edgeType":"contains","source":5230,"target":5311},{"edgeType":"contains","source":5229,"target":5342},{"edgeType":"calls","source":6308,"target":266},{"edgeType":"contains","source":5827,"target":5836},{"edgeType":"imports","source":1347,"target":568},{"edgeType":"contains","source":3713,"target":3715},{"edgeType":"contains","source":7709,"target":7746},{"edgeType":"calls","source":436,"target":491},{"edgeType":"contains","source":1,"target":5686},{"edgeType":"contains","source":5761,"target":5768},{"edgeType":"calls","source":6682,"target":6647},{"edgeType":"contains","source":9499,"target":9335},{"edgeType":"contains","source":3944,"target":3953},{"edgeType":"contains","source":42,"target":186},{"edgeType":"imports","source":4506,"target":2006},{"edgeType":"contains","source":7001,"target":1154},{"edgeType":"calls","source":11128,"target":10462},{"edgeType":"contains","source":8767,"target":8772},{"edgeType":"contains","source":12962,"target":12968},{"edgeType":"calls","source":11736,"target":11698},{"edgeType":"contains","source":2656,"target":2657},{"edgeType":"contains","source":12862,"target":12897},{"edgeType":"calls","source":1724,"target":1786},{"edgeType":"contains","source":4869,"target":4874},{"edgeType":"imports","source":7583,"target":7036},{"edgeType":"contains","source":1805,"target":2612},{"edgeType":"contains","source":3878,"target":3884},{"edgeType":"contains","source":12147,"target":9693},{"edgeType":"contains","source":5860,"target":5871},{"edgeType":"contains","source":8096,"target":1033},{"edgeType":"contains","source":5230,"target":5310},{"edgeType":"contains","source":5761,"target":5769},{"edgeType":"calls","source":12529,"target":2970},{"edgeType":"contains","source":8281,"target":583},{"edgeType":"imports","source":13780,"target":12599},{"edgeType":"contains","source":8062,"target":8429},{"edgeType":"calls","source":1199,"target":1148},{"edgeType":"contains","source":3713,"target":3714},{"edgeType":"contains","source":7808,"target":7847},{"edgeType":"contains","source":11905,"target":11910},{"edgeType":"contains","source":5562,"target":5596},{"edgeType":"contains","source":4132,"target":4466},{"edgeType":"calls","source":4940,"target":4620},{"edgeType":"contains","source":5530,"target":5531},{"edgeType":"calls","source":6531,"target":6044},{"edgeType":"calls","source":12660,"target":12650},{"edgeType":"imports","source":554,"target":836},{"edgeType":"calls","source":10721,"target":3000},{"edgeType":"contains","source":42,"target":189},{"edgeType":"calls","source":7838,"target":7809},{"edgeType":"calls","source":7870,"target":7874},{"edgeType":"contains","source":8337,"target":8355},{"edgeType":"contains","source":6950,"target":6956},{"edgeType":"calls","source":1395,"target":1409},{"edgeType":"contains","source":8062,"target":8424},{"edgeType":"contains","source":8765,"target":8828},{"edgeType":"contains","source":5230,"target":5317},{"edgeType":"contains","source":3845,"target":3857},{"edgeType":"contains","source":3214,"target":3333},{"edgeType":"contains","source":11905,"target":11909},{"edgeType":"contains","source":11864,"target":2608},{"edgeType":"contains","source":12000,"target":12135},{"edgeType":"imports","source":8362,"target":8260},{"edgeType":"contains","source":11803,"target":11898},{"edgeType":"contains","source":42,"target":188},{"edgeType":"contains","source":4869,"target":4880},{"edgeType":"calls","source":1700,"target":1467},{"edgeType":"contains","source":4179,"target":5129},{"edgeType":"calls","source":602,"target":622},{"edgeType":"contains","source":2849,"target":3022},{"edgeType":"contains","source":10782,"target":10783},{"edgeType":"calls","source":1467,"target":1290},{"edgeType":"contains","source":4510,"target":4381},{"edgeType":"calls","source":7974,"target":7822},{"edgeType":"contains","source":5230,"target":5316},{"edgeType":"calls","source":5850,"target":719},{"edgeType":"calls","source":4681,"target":4191},{"edgeType":"contains","source":3214,"target":3334},{"edgeType":"contains","source":6144,"target":6574},{"edgeType":"contains","source":8244,"target":8066},{"edgeType":"imports","source":1347,"target":565},{"edgeType":"contains","source":11905,"target":11908},{"edgeType":"contains","source":7941,"target":7946},{"edgeType":"contains","source":4131,"target":4502},{"edgeType":"calls","source":1704,"target":1346},{"edgeType":"contains","source":6950,"target":6958},{"edgeType":"contains","source":11803,"target":11897},{"edgeType":"contains","source":4869,"target":4879},{"edgeType":"contains","source":9757,"target":9786},{"edgeType":"contains","source":1287,"target":703},{"edgeType":"contains","source":11344,"target":11327},{"edgeType":"contains","source":11259,"target":11848},{"edgeType":"imports","source":7420,"target":1524},{"edgeType":"contains","source":12962,"target":12965},{"edgeType":"contains","source":8765,"target":8831},{"edgeType":"imports","source":9953,"target":1218},{"edgeType":"contains","source":3214,"target":3331},{"edgeType":"contains","source":12235,"target":12247},{"edgeType":"contains","source":5230,"target":5315},{"edgeType":"calls","source":8727,"target":8793},{"edgeType":"contains","source":10301,"target":10892},{"edgeType":"contains","source":12000,"target":12133},{"edgeType":"contains","source":3944,"target":3957},{"edgeType":"calls","source":1294,"target":1371},{"edgeType":"contains","source":11905,"target":11907},{"edgeType":"contains","source":8096,"target":1030},{"edgeType":"calls","source":6315,"target":6401},{"edgeType":"contains","source":9757,"target":9787},{"edgeType":"contains","source":10451,"target":10471},{"edgeType":"contains","source":4869,"target":4878},{"edgeType":"contains","source":7709,"target":7740},{"edgeType":"contains","source":1434,"target":2489},{"edgeType":"contains","source":1,"target":2518},{"edgeType":"contains","source":42,"target":190},{"edgeType":"contains","source":8401,"target":8486},{"edgeType":"contains","source":2492,"target":2460},{"edgeType":"calls","source":6659,"target":6308},{"edgeType":"contains","source":10813,"target":10876},{"edgeType":"contains","source":8062,"target":8425},{"edgeType":"contains","source":7434,"target":411},{"edgeType":"contains","source":5230,"target":5314},{"edgeType":"calls","source":5578,"target":693},{"edgeType":"contains","source":12000,"target":12132},{"edgeType":"contains","source":3944,"target":3956},{"edgeType":"contains","source":5662,"target":5663},{"edgeType":"contains","source":11905,"target":11906},{"edgeType":"contains","source":10813,"target":10890},{"edgeType":"contains","source":12298,"target":12422},{"edgeType":"contains","source":42,"target":193},{"edgeType":"contains","source":13524,"target":13527},{"edgeType":"contains","source":8591,"target":10007},{"edgeType":"contains","source":704,"target":812},{"edgeType":"contains","source":7908,"target":7925},{"edgeType":"imports","source":12246,"target":2005},{"edgeType":"contains","source":11983,"target":11617},{"edgeType":"contains","source":4374,"target":4375},{"edgeType":"contains","source":11836,"target":11946},{"edgeType":"contains","source":1,"target":6749},{"edgeType":"calls","source":12693,"target":12695},{"edgeType":"contains","source":10419,"target":10420},{"edgeType":"contains","source":5761,"target":5774},{"edgeType":"contains","source":12500,"target":12503},{"edgeType":"contains","source":5230,"target":5321},{"edgeType":"contains","source":11082,"target":12064},{"edgeType":"contains","source":5431,"target":5432},{"edgeType":"contains","source":12298,"target":12421},{"edgeType":"contains","source":11410,"target":11411},{"edgeType":"contains","source":8767,"target":8778},{"edgeType":"contains","source":42,"target":192},{"edgeType":"contains","source":13524,"target":13526},{"edgeType":"contains","source":8337,"target":8366},{"edgeType":"calls","source":12561,"target":12559},{"edgeType":"contains","source":7908,"target":7924},{"edgeType":"contains","source":4132,"target":4476},{"edgeType":"imports","source":12152,"target":7034},{"edgeType":"contains","source":8437,"target":8438},{"edgeType":"contains","source":5761,"target":5775},{"edgeType":"contains","source":3845,"target":3860},{"edgeType":"imports","source":12432,"target":12096},{"edgeType":"contains","source":5230,"target":5320},{"edgeType":"calls","source":12236,"target":436},{"edgeType":"contains","source":9028,"target":9143},{"edgeType":"contains","source":11276,"target":11336},{"edgeType":"imports","source":11096,"target":11227},{"edgeType":"calls","source":12258,"target":2925},{"edgeType":"contains","source":12298,"target":12420},{"edgeType":"calls","source":1098,"target":1101},{"edgeType":"contains","source":8762,"target":8936},{"edgeType":"contains","source":8767,"target":8781},{"edgeType":"calls","source":1032,"target":1033},{"edgeType":"contains","source":13524,"target":13525},{"edgeType":"calls","source":6052,"target":6080},{"edgeType":"contains","source":8591,"target":10009},{"edgeType":"contains","source":10782,"target":10792},{"edgeType":"contains","source":4869,"target":4883},{"edgeType":"imports","source":11776,"target":9173},{"edgeType":"contains","source":42,"target":195},{"edgeType":"contains","source":704,"target":814},{"edgeType":"contains","source":4179,"target":5132},{"edgeType":"calls","source":602,"target":621},{"edgeType":"contains","source":10301,"target":10904},{"edgeType":"contains","source":3713,"target":3723},{"edgeType":"contains","source":7709,"target":7754},{"edgeType":"imports","source":12565,"target":10088},{"edgeType":"contains","source":5761,"target":5776},{"edgeType":"contains","source":12500,"target":12501},{"edgeType":"calls","source":6575,"target":2573},{"edgeType":"contains","source":7841,"target":491},{"edgeType":"contains","source":7637,"target":7872},{"edgeType":"imports","source":8078,"target":2251},{"edgeType":"contains","source":8337,"target":8370},{"edgeType":"contains","source":8338,"target":8339},{"edgeType":"calls","source":749,"target":293},{"edgeType":"contains","source":3845,"target":3859},{"edgeType":"calls","source":4940,"target":4613},{"edgeType":"contains","source":5230,"target":5319},{"edgeType":"contains","source":9294,"target":9356},{"edgeType":"contains","source":11616,"target":2907},{"edgeType":"contains","source":8762,"target":8935},{"edgeType":"contains","source":12298,"target":12419},{"edgeType":"calls","source":6847,"target":6826},{"edgeType":"contains","source":4131,"target":5562},{"edgeType":"contains","source":13557,"target":13558},{"edgeType":"contains","source":4132,"target":4474},{"edgeType":"contains","source":4869,"target":4882},{"edgeType":"contains","source":13755,"target":13762},{"edgeType":"contains","source":3944,"target":3960},{"edgeType":"contains","source":2849,"target":3024},{"edgeType":"contains","source":42,"target":194},{"edgeType":"contains","source":704,"target":813},{"edgeType":"calls","source":245,"target":60},{"edgeType":"contains","source":5761,"target":5777},{"edgeType":"contains","source":3713,"target":3722},{"edgeType":"contains","source":7637,"target":7871},{"edgeType":"contains","source":3845,"target":3858},{"edgeType":"imports","source":8103,"target":420},{"edgeType":"contains","source":5530,"target":5539},{"edgeType":"calls","source":6315,"target":6406},{"edgeType":"contains","source":1139,"target":2126},{"edgeType":"contains","source":5230,"target":5318},{"edgeType":"contains","source":1139,"target":3183},{"edgeType":"contains","source":5230,"target":5326},{"edgeType":"contains","source":12895,"target":12938},{"edgeType":"contains","source":8762,"target":8930},{"edgeType":"calls","source":1132,"target":1098},{"edgeType":"contains","source":8935,"target":8852},{"edgeType":"contains","source":10813,"target":10886},{"edgeType":"calls","source":11175,"target":11132},{"edgeType":"calls","source":12858,"target":12869},{"edgeType":"contains","source":6635,"target":6159},{"edgeType":"contains","source":8591,"target":10003},{"edgeType":"contains","source":8337,"target":8363},{"edgeType":"contains","source":8536,"target":8537},{"edgeType":"contains","source":5761,"target":5770},{"edgeType":"contains","source":4275,"target":4277},{"edgeType":"contains","source":4242,"target":4243},{"edgeType":"calls","source":5827,"target":5653},{"edgeType":"contains","source":5530,"target":5532},{"edgeType":"contains","source":5230,"target":5325},{"edgeType":"contains","source":4869,"target":4889},{"edgeType":"calls","source":3714,"target":3505},{"edgeType":"imports","source":7127,"target":2140},{"edgeType":"calls","source":8208,"target":575},{"edgeType":"imports","source":8062,"target":8039},{"edgeType":"calls","source":1227,"target":266},{"edgeType":"contains","source":5431,"target":5436},{"edgeType":"calls","source":7697,"target":562},{"edgeType":"contains","source":8281,"target":585},{"edgeType":"contains","source":8062,"target":8431},{"edgeType":"contains","source":8767,"target":8774},{"edgeType":"imports","source":12523,"target":12441},{"edgeType":"contains","source":42,"target":196},{"edgeType":"contains","source":4132,"target":4480},{"edgeType":"contains","source":4131,"target":4511},{"edgeType":"contains","source":12298,"target":12417},{"edgeType":"contains","source":5761,"target":5771},{"edgeType":"calls","source":9357,"target":9352},{"edgeType":"contains","source":12698,"target":12702},{"edgeType":"calls","source":9395,"target":9231},{"edgeType":"contains","source":4869,"target":4888},{"edgeType":"contains","source":5530,"target":5533},{"edgeType":"contains","source":5230,"target":5324},{"edgeType":"contains","source":11279,"target":11239},{"edgeType":"contains","source":7019,"target":2713},{"edgeType":"calls","source":12515,"target":11872},{"edgeType":"contains","source":1,"target":13098},{"edgeType":"contains","source":8762,"target":8932},{"edgeType":"contains","source":4131,"target":4510},{"edgeType":"contains","source":4407,"target":4411},{"edgeType":"contains","source":42,"target":199},{"edgeType":"contains","source":8062,"target":8434},{"edgeType":"contains","source":12,"target":72},{"edgeType":"calls","source":12925,"target":12904},{"edgeType":"calls","source":8727,"target":8801},{"edgeType":"contains","source":5761,"target":5772},{"edgeType":"contains","source":12000,"target":12141},{"edgeType":"contains","source":12698,"target":12701},{"edgeType":"contains","source":4374,"target":4377},{"edgeType":"calls","source":5128,"target":5123},{"edgeType":"contains","source":7709,"target":7750},{"edgeType":"contains","source":12832,"target":12775},{"edgeType":"contains","source":4869,"target":4887},{"edgeType":"contains","source":5530,"target":5534},{"edgeType":"calls","source":9863,"target":8467},{"edgeType":"contains","source":7254,"target":7055},{"edgeType":"imports","source":899,"target":717},{"edgeType":"contains","source":5230,"target":5323},{"edgeType":"calls","source":12260,"target":1807},{"edgeType":"contains","source":2585,"target":2756},{"edgeType":"contains","source":5431,"target":5434},{"edgeType":"contains","source":8762,"target":8931},{"edgeType":"contains","source":8767,"target":8776},{"edgeType":"contains","source":10782,"target":10789},{"edgeType":"calls","source":11335,"target":3000},{"edgeType":"imports","source":12276,"target":8473},{"edgeType":"contains","source":8337,"target":8364},{"edgeType":"calls","source":4335,"target":4336},{"edgeType":"contains","source":5761,"target":5773},{"edgeType":"contains","source":8082,"target":414},{"edgeType":"contains","source":4869,"target":4886},{"edgeType":"contains","source":5530,"target":5535},{"edgeType":"imports","source":11096,"target":11229},{"edgeType":"contains","source":5230,"target":5322},{"edgeType":"contains","source":5230,"target":5297},{"edgeType":"contains","source":1805,"target":2596},{"edgeType":"calls","source":11300,"target":3000},{"edgeType":"contains","source":42,"target":168},{"edgeType":"calls","source":1628,"target":1606},{"edgeType":"contains","source":4132,"target":4453},{"edgeType":"calls","source":12265,"target":568},{"edgeType":"calls","source":3062,"target":2606},{"edgeType":"calls","source":4336,"target":4337},{"edgeType":"contains","source":12268,"target":12271},{"edgeType":"contains","source":8523,"target":8919},{"edgeType":"calls","source":2655,"target":2539},{"edgeType":"contains","source":5230,"target":5296},{"edgeType":"imports","source":7001,"target":7090},{"edgeType":"contains","source":1,"target":13066},{"edgeType":"contains","source":7709,"target":7726},{"edgeType":"contains","source":1,"target":381},{"edgeType":"contains","source":12,"target":40},{"edgeType":"contains","source":1805,"target":2597},{"edgeType":"contains","source":1887,"target":2169},{"edgeType":"calls","source":5816,"target":4965},{"edgeType":"contains","source":11171,"target":10338},{"edgeType":"contains","source":8238,"target":8240},{"edgeType":"contains","source":12235,"target":12236},{"edgeType":"contains","source":12499,"target":12508},{"edgeType":"calls","source":4818,"target":4191},{"edgeType":"contains","source":5230,"target":5295},{"edgeType":"contains","source":1805,"target":2594},{"edgeType":"calls","source":4939,"target":4668},{"edgeType":"contains","source":2254,"target":2417},{"edgeType":"calls","source":9864,"target":8407},{"edgeType":"contains","source":10301,"target":10880},{"edgeType":"imports","source":10237,"target":8250},{"edgeType":"contains","source":8062,"target":8414},{"edgeType":"contains","source":8401,"target":8475},{"edgeType":"contains","source":12268,"target":12269},{"edgeType":"imports","source":397,"target":403},{"edgeType":"contains","source":12919,"target":13228},{"edgeType":"contains","source":12499,"target":12507},{"edgeType":"contains","source":8523,"target":8921},{"edgeType":"contains","source":4604,"target":4616},{"edgeType":"contains","source":5883,"target":6198},{"edgeType":"contains","source":11713,"target":3048},{"edgeType":"contains","source":5230,"target":5294},{"edgeType":"contains","source":8062,"target":8412},{"edgeType":"contains","source":11864,"target":2595},{"edgeType":"contains","source":2350,"target":1556},{"edgeType":"imports","source":12554,"target":12535},{"edgeType":"calls","source":8717,"target":9081},{"edgeType":"calls","source":6617,"target":6532},{"edgeType":"contains","source":7709,"target":7728},{"edgeType":"contains","source":5562,"target":5579},{"edgeType":"contains","source":4274,"target":4276},{"edgeType":"calls","source":174,"target":172},{"edgeType":"contains","source":4370,"target":4471},{"edgeType":"imports","source":7334,"target":7339},{"edgeType":"contains","source":5230,"target":5293},{"edgeType":"contains","source":8523,"target":8920},{"edgeType":"contains","source":12762,"target":12809},{"edgeType":"contains","source":3085,"target":3088},{"edgeType":"contains","source":3741,"target":3893},{"edgeType":"contains","source":5230,"target":5301},{"edgeType":"imports","source":11096,"target":9110},{"edgeType":"calls","source":803,"target":751},{"edgeType":"calls","source":2655,"target":2534},{"edgeType":"contains","source":6566,"target":6159},{"edgeType":"contains","source":1887,"target":2172},{"edgeType":"calls","source":3047,"target":3066},{"edgeType":"imports","source":10514,"target":10239},{"edgeType":"contains","source":6355,"target":6358},{"edgeType":"calls","source":9135,"target":8811},{"edgeType":"calls","source":9355,"target":3048},{"edgeType":"contains","source":5562,"target":5572},{"edgeType":"calls","source":8994,"target":8954},{"edgeType":"calls","source":12337,"target":454},{"edgeType":"contains","source":2093,"target":2129},{"edgeType":"contains","source":4132,"target":4457},{"edgeType":"contains","source":8401,"target":8469},{"edgeType":"contains","source":2585,"target":2732},{"edgeType":"contains","source":2892,"target":3785},{"edgeType":"calls","source":1981,"target":1229},{"edgeType":"contains","source":4370,"target":4478},{"edgeType":"imports","source":11547,"target":414},{"edgeType":"calls","source":221,"target":824},{"edgeType":"contains","source":4604,"target":4623},{"edgeType":"calls","source":4137,"target":4160},{"edgeType":"calls","source":1476,"target":1028},{"edgeType":"calls","source":1561,"target":1564},{"edgeType":"contains","source":1887,"target":2173},{"edgeType":"contains","source":7808,"target":7824},{"edgeType":"calls","source":4973,"target":4668},{"edgeType":"calls","source":12396,"target":12368},{"edgeType":"contains","source":3741,"target":3892},{"edgeType":"contains","source":7709,"target":7722},{"edgeType":"calls","source":9866,"target":8346},{"edgeType":"contains","source":12499,"target":12504},{"edgeType":"imports","source":12423,"target":2849},{"edgeType":"contains","source":6256,"target":6257},{"edgeType":"calls","source":5790,"target":5767},{"edgeType":"contains","source":6355,"target":6359},{"edgeType":"contains","source":2852,"target":2912},{"edgeType":"calls","source":5986,"target":6033},{"edgeType":"contains","source":7019,"target":2687},{"edgeType":"calls","source":11688,"target":491},{"edgeType":"calls","source":6201,"target":2539},{"edgeType":"contains","source":10813,"target":10859},{"edgeType":"calls","source":711,"target":434},{"edgeType":"calls","source":749,"target":313},{"edgeType":"contains","source":938,"target":939},{"edgeType":"contains","source":1,"target":6731},{"edgeType":"contains","source":5230,"target":5299},{"edgeType":"contains","source":11750,"target":1896},{"edgeType":"calls","source":3047,"target":3064},{"edgeType":"contains","source":7709,"target":7725},{"edgeType":"contains","source":1887,"target":2170},{"edgeType":"contains","source":8068,"target":1881},{"edgeType":"calls","source":12380,"target":11804},{"edgeType":"contains","source":5883,"target":6193},{"edgeType":"contains","source":8337,"target":8341},{"edgeType":"imports","source":12901,"target":9173},{"edgeType":"contains","source":6256,"target":6258},{"edgeType":"calls","source":7245,"target":1866},{"edgeType":"contains","source":8238,"target":8239},{"edgeType":"contains","source":10385,"target":10386},{"edgeType":"contains","source":6223,"target":6224},{"edgeType":"contains","source":8401,"target":8471},{"edgeType":"calls","source":7176,"target":7176},{"edgeType":"contains","source":4345,"target":4194},{"edgeType":"contains","source":12730,"target":12741},{"edgeType":"contains","source":8897,"target":8950},{"edgeType":"contains","source":7084,"target":673},{"edgeType":"contains","source":5230,"target":5298},{"edgeType":"contains","source":1966,"target":1836},{"edgeType":"contains","source":9664,"target":8427},{"edgeType":"calls","source":12098,"target":12091},{"edgeType":"contains","source":1805,"target":2599},{"edgeType":"imports","source":12555,"target":12500},{"edgeType":"calls","source":6326,"target":6044},{"edgeType":"contains","source":2093,"target":2128},{"edgeType":"contains","source":5562,"target":5575},{"edgeType":"calls","source":1662,"target":1606},{"edgeType":"contains","source":6355,"target":6361},{"edgeType":"contains","source":10352,"target":10353},{"edgeType":"imports","source":3763,"target":3886},{"edgeType":"calls","source":4600,"target":4602},{"edgeType":"contains","source":8401,"target":8470},{"edgeType":"contains","source":10385,"target":10387},{"edgeType":"contains","source":899,"target":1089},{"edgeType":"contains","source":7050,"target":7013},{"edgeType":"calls","source":7374,"target":7381},{"edgeType":"calls","source":3510,"target":3508},{"edgeType":"calls","source":11549,"target":10088},{"edgeType":"calls","source":72,"target":153},{"edgeType":"contains","source":9757,"target":9784},{"edgeType":"calls","source":2823,"target":2607},{"edgeType":"contains","source":5686,"target":5968},{"edgeType":"contains","source":2849,"target":3009},{"edgeType":"imports","source":12554,"target":12524},{"edgeType":"contains","source":5562,"target":5584},{"edgeType":"contains","source":5230,"target":5305},{"edgeType":"calls","source":1627,"target":1629},{"edgeType":"calls","source":1708,"target":1232},{"edgeType":"contains","source":6950,"target":6952},{"edgeType":"contains","source":11259,"target":11846},{"edgeType":"imports","source":397,"target":414},{"edgeType":"contains","source":3878,"target":3879},{"edgeType":"calls","source":3838,"target":3910},{"edgeType":"contains","source":2852,"target":2915},{"edgeType":"calls","source":4392,"target":3650},{"edgeType":"contains","source":4132,"target":4461},{"edgeType":"imports","source":4639,"target":1026},{"edgeType":"calls","source":669,"target":673},{"edgeType":"imports","source":4592,"target":4597},{"edgeType":"contains","source":547,"target":1434},{"edgeType":"imports","source":12554,"target":12525},{"edgeType":"contains","source":3741,"target":3896},{"edgeType":"contains","source":7709,"target":7734},{"edgeType":"contains","source":4981,"target":4567},{"edgeType":"contains","source":938,"target":940},{"edgeType":"calls","source":6748,"target":6705},{"edgeType":"contains","source":5230,"target":5304},{"edgeType":"contains","source":7690,"target":6209},{"edgeType":"contains","source":6950,"target":6953},{"edgeType":"calls","source":1759,"target":1764},{"edgeType":"contains","source":8965,"target":8966},{"edgeType":"contains","source":11259,"target":11847},{"edgeType":"imports","source":13053,"target":5512},{"edgeType":"contains","source":7434,"target":405},{"edgeType":"contains","source":10813,"target":10874},{"edgeType":"calls","source":12163,"target":568},{"edgeType":"contains","source":3944,"target":3946},{"edgeType":"calls","source":4666,"target":4668},{"edgeType":"contains","source":6822,"target":6692},{"edgeType":"contains","source":11864,"target":2605},{"edgeType":"calls","source":1986,"target":2126},{"edgeType":"contains","source":42,"target":176},{"edgeType":"contains","source":8762,"target":8916},{"edgeType":"contains","source":5860,"target":5861},{"edgeType":"calls","source":7376,"target":7321},{"edgeType":"imports","source":12423,"target":2845},{"edgeType":"contains","source":8062,"target":8419},{"edgeType":"contains","source":11941,"target":11845},{"edgeType":"contains","source":12000,"target":12130},{"edgeType":"contains","source":7709,"target":7737},{"edgeType":"calls","source":1530,"target":1467},{"edgeType":"contains","source":3741,"target":3895},{"edgeType":"contains","source":5562,"target":5586},{"edgeType":"contains","source":5230,"target":5303},{"edgeType":"contains","source":6917,"target":6920},{"edgeType":"contains","source":6950,"target":6954},{"edgeType":"contains","source":11313,"target":11227},{"edgeType":"imports","source":4131,"target":921},{"edgeType":"contains","source":12298,"target":12404},{"edgeType":"contains","source":7001,"target":1144},{"edgeType":"imports","source":4639,"target":4199},{"edgeType":"contains","source":3944,"target":3945},{"edgeType":"contains","source":42,"target":179},{"edgeType":"contains","source":6223,"target":6236},{"edgeType":"contains","source":8096,"target":1026},{"edgeType":"contains","source":12,"target":52},{"edgeType":"contains","source":2852,"target":2913},{"edgeType":"contains","source":2849,"target":3006},{"edgeType":"contains","source":7941,"target":7945},{"edgeType":"contains","source":938,"target":942},{"edgeType":"contains","source":3741,"target":3894},{"edgeType":"contains","source":7808,"target":7838},{"edgeType":"calls","source":6454,"target":6308},{"edgeType":"contains","source":7709,"target":7736},{"edgeType":"contains","source":11422,"target":12077},{"edgeType":"contains","source":5230,"target":5302},{"edgeType":"imports","source":7001,"target":7084},{"edgeType":"contains","source":6950,"target":6955},{"edgeType":"contains","source":10813,"target":10872},{"edgeType":"calls","source":6063,"target":5754},{"edgeType":"contains","source":42,"target":178},{"edgeType":"contains","source":2852,"target":2914},{"edgeType":"contains","source":2849,"target":3007},{"edgeType":"contains","source":4370,"target":4479},{"edgeType":"contains","source":8523,"target":8923},{"edgeType":"calls","source":4394,"target":3583},{"edgeType":"contains","source":9173,"target":9914},{"edgeType":"calls","source":12404,"target":2614},{"edgeType":"contains","source":11803,"target":11891},{"edgeType":"contains","source":5230,"target":5309},{"edgeType":"calls","source":9690,"target":9584},{"edgeType":"contains","source":3214,"target":3325},{"edgeType":"calls","source":1286,"target":568},{"edgeType":"contains","source":10237,"target":10756},{"edgeType":"imports","source":397,"target":409},{"edgeType":"contains","source":3878,"target":3883},{"edgeType":"contains","source":12895,"target":12921},{"edgeType":"contains","source":704,"target":799},{"edgeType":"imports","source":12298,"target":12000},{"edgeType":"contains","source":899,"target":1096},{"edgeType":"contains","source":5860,"target":5856},{"edgeType":"contains","source":11941,"target":11840},{"edgeType":"contains","source":7709,"target":7730},{"edgeType":"calls","source":9864,"target":8417},{"edgeType":"contains","source":2788,"target":2791},{"edgeType":"contains","source":5230,"target":5308},{"edgeType":"contains","source":11214,"target":11124},{"edgeType":"contains","source":11276,"target":11316},{"edgeType":"contains","source":3214,"target":3326},{"edgeType":"contains","source":6144,"target":6566},{"edgeType":"contains","source":3878,"target":3882},{"edgeType":"contains","source":1805,"target":2610},{"edgeType":"calls","source":1346,"target":821},{"edgeType":"contains","source":8965,"target":8961},{"edgeType":"calls","source":13228,"target":13009},{"edgeType":"contains","source":10451,"target":10465},{"edgeType":"contains","source":8765,"target":8819},{"edgeType":"calls","source":4545,"target":4187},{"edgeType":"calls","source":768,"target":770},{"edgeType":"calls","source":4614,"target":4162},{"edgeType":"calls","source":205,"target":256},{"edgeType":"contains","source":5759,"target":5817},{"edgeType":"calls","source":5757,"target":5724},{"edgeType":"contains","source":11803,"target":11889},{"edgeType":"contains","source":5562,"target":5582},{"edgeType":"contains","source":3214,"target":3323},{"edgeType":"imports","source":11096,"target":11214},{"edgeType":"contains","source":5230,"target":5307},{"edgeType":"contains","source":12335,"target":12310},{"edgeType":"calls","source":12065,"target":436},{"edgeType":"contains","source":8765,"target":8822},{"edgeType":"calls","source":12511,"target":9865},{"edgeType":"contains","source":42,"target":183},{"edgeType":"calls","source":8971,"target":8620},{"edgeType":"contains","source":10436,"target":9870},{"edgeType":"contains","source":4179,"target":5120},{"edgeType":"contains","source":4370,"target":4483},{"edgeType":"contains","source":9173,"target":9915},{"edgeType":"imports","source":2244,"target":1287},{"edgeType":"calls","source":3047,"target":3057},{"edgeType":"contains","source":6950,"target":6951},{"edgeType":"calls","source":7674,"target":7603},{"edgeType":"contains","source":7709,"target":7732},{"edgeType":"imports","source":10942,"target":10702},{"edgeType":"contains","source":3214,"target":3324},{"edgeType":"contains","source":5230,"target":5306},{"edgeType":"calls","source":7960,"target":1908},{"edgeType":"contains","source":13752,"target":13834},{"edgeType":"calls","source":505,"target":469},{"edgeType":"contains","source":6062,"target":5939},{"edgeType":"contains","source":2688,"target":2717},{"edgeType":"imports","source":5213,"target":4380},{"edgeType":"contains","source":10451,"target":10463},{"edgeType":"contains","source":1,"target":396},{"edgeType":"contains","source":3845,"target":3846},{"edgeType":"imports","source":12355,"target":12350},{"edgeType":"contains","source":42,"target":182},{"edgeType":"imports","source":3763,"target":3878},{"edgeType":"contains","source":12499,"target":12510},{"edgeType":"contains","source":8337,"target":8348},{"edgeType":"calls","source":5850,"target":824},{"edgeType":"contains","source":4132,"target":4436},{"edgeType":"contains","source":2254,"target":2402},{"edgeType":"calls","source":2094,"target":2042},{"edgeType":"calls","source":7609,"target":7604},{"edgeType":"imports","source":11202,"target":11155},{"edgeType":"contains","source":5230,"target":5280},{"edgeType":"contains","source":3214,"target":3296},{"edgeType":"calls","source":1988,"target":2156},{"edgeType":"contains","source":7279,"target":7298},{"edgeType":"contains","source":3679,"target":3681},{"edgeType":"calls","source":2462,"target":148},{"edgeType":"contains","source":3778,"target":3783},{"edgeType":"contains","source":2093,"target":2108},{"edgeType":"imports","source":4639,"target":4255},{"edgeType":"contains","source":9757,"target":9760},{"edgeType":"imports","source":12499,"target":10059},{"edgeType":"calls","source":2951,"target":2959},{"edgeType":"calls","source":1663,"target":1660},{"edgeType":"contains","source":704,"target":770},{"edgeType":"contains","source":8898,"target":8904},{"edgeType":"contains","source":1144,"target":1928},{"edgeType":"imports","source":7127,"target":1119},{"edgeType":"contains","source":7279,"target":7299},{"edgeType":"contains","source":12762,"target":12795},{"edgeType":"contains","source":3214,"target":3297},{"edgeType":"contains","source":5230,"target":5279},{"edgeType":"contains","source":11276,"target":11295},{"edgeType":"contains","source":11259,"target":11822},{"edgeType":"contains","source":3741,"target":3872},{"edgeType":"contains","source":3679,"target":3680},{"edgeType":"contains","source":42,"target":151},{"edgeType":"calls","source":2687,"target":2687},{"edgeType":"contains","source":3778,"target":3782},{"edgeType":"contains","source":12,"target":24},{"edgeType":"contains","source":6912,"target":7050},{"edgeType":"calls","source":1022,"target":393},{"edgeType":"contains","source":1434,"target":2451},{"edgeType":"contains","source":5132,"target":5145},{"edgeType":"contains","source":607,"target":609},{"edgeType":"calls","source":9818,"target":436},{"edgeType":"contains","source":8700,"target":8703},{"edgeType":"contains","source":11750,"target":1883},{"edgeType":"contains","source":7279,"target":7300},{"edgeType":"contains","source":5230,"target":5278},{"edgeType":"imports","source":9207,"target":1118},{"edgeType":"contains","source":8006,"target":8019},{"edgeType":"contains","source":471,"target":596},{"edgeType":"contains","source":11276,"target":11292},{"edgeType":"contains","source":4448,"target":4151},{"edgeType":"calls","source":6585,"target":6582},{"edgeType":"contains","source":7643,"target":7645},{"edgeType":"calls","source":474,"target":469},{"edgeType":"contains","source":4130,"target":4496},{"edgeType":"imports","source":12428,"target":12262},{"edgeType":"contains","source":9757,"target":9758},{"edgeType":"calls","source":8584,"target":2751},{"edgeType":"contains","source":4242,"target":4194},{"edgeType":"contains","source":10419,"target":10377},{"edgeType":"contains","source":2254,"target":2401},{"edgeType":"contains","source":4370,"target":4454},{"edgeType":"contains","source":607,"target":608},{"edgeType":"calls","source":3792,"target":3312},{"edgeType":"contains","source":5230,"target":5277},{"edgeType":"contains","source":12862,"target":12864},{"edgeType":"calls","source":11751,"target":1818},{"edgeType":"contains","source":12762,"target":12792},{"edgeType":"contains","source":7279,"target":7301},{"edgeType":"imports","source":9207,"target":1119},{"edgeType":"imports","source":7001,"target":1856},{"edgeType":"contains","source":9390,"target":9509},{"edgeType":"contains","source":11750,"target":1884},{"edgeType":"calls","source":1175,"target":934},{"edgeType":"contains","source":471,"target":595},{"edgeType":"calls","source":738,"target":740},{"edgeType":"calls","source":10317,"target":10334},{"edgeType":"calls","source":4617,"target":4162},{"edgeType":"contains","source":3778,"target":3780},{"edgeType":"contains","source":9757,"target":9759},{"edgeType":"calls","source":4875,"target":4620},{"edgeType":"contains","source":5562,"target":5563},{"edgeType":"contains","source":9698,"target":8417},{"edgeType":"calls","source":1697,"target":1660},{"edgeType":"contains","source":42,"target":156},{"edgeType":"calls","source":9927,"target":5515},{"edgeType":"contains","source":1287,"target":672},{"edgeType":"contains","source":8898,"target":8901},{"edgeType":"contains","source":7019,"target":2670},{"edgeType":"contains","source":471,"target":599},{"edgeType":"calls","source":2234,"target":1926},{"edgeType":"imports","source":7469,"target":7435},{"edgeType":"contains","source":9030,"target":9037},{"edgeType":"contains","source":10880,"target":10882},{"edgeType":"contains","source":8039,"target":8047},{"edgeType":"contains","source":8765,"target":8795},{"edgeType":"imports","source":12428,"target":12256},{"edgeType":"contains","source":471,"target":598},{"edgeType":"calls","source":3314,"target":3328},{"edgeType":"contains","source":5230,"target":5284},{"edgeType":"calls","source":1217,"target":684},{"edgeType":"contains","source":3679,"target":3685},{"edgeType":"calls","source":1134,"target":1143},{"edgeType":"contains","source":42,"target":155},{"edgeType":"contains","source":11082,"target":12020},{"edgeType":"calls","source":1786,"target":1014},{"edgeType":"contains","source":6276,"target":6677},{"edgeType":"contains","source":11210,"target":11223},{"edgeType":"contains","source":11276,"target":11291},{"edgeType":"contains","source":8898,"target":8900},{"edgeType":"contains","source":607,"target":610},{"edgeType":"calls","source":1830,"target":1764},{"edgeType":"calls","source":2042,"target":1534},{"edgeType":"contains","source":9030,"target":9036},{"edgeType":"contains","source":4506,"target":5529},{"edgeType":"contains","source":5230,"target":5283},{"edgeType":"contains","source":1,"target":5654},{"edgeType":"imports","source":8062,"target":8081},{"edgeType":"contains","source":8006,"target":8012},{"edgeType":"contains","source":8039,"target":8046},{"edgeType":"contains","source":4132,"target":4438},{"edgeType":"contains","source":11239,"target":10321},{"edgeType":"contains","source":42,"target":158},{"edgeType":"contains","source":508,"target":511},{"edgeType":"contains","source":4370,"target":4459},{"edgeType":"imports","source":7218,"target":420},{"edgeType":"contains","source":8766,"target":8767},{"edgeType":"contains","source":8898,"target":8903},{"edgeType":"contains","source":607,"target":613},{"edgeType":"contains","source":4506,"target":5528},{"edgeType":"imports","source":13815,"target":12599},{"edgeType":"contains","source":5230,"target":5282},{"edgeType":"calls","source":4793,"target":1874},{"edgeType":"contains","source":3679,"target":3683},{"edgeType":"calls","source":6883,"target":6862},{"edgeType":"contains","source":1287,"target":671},{"edgeType":"contains","source":2556,"target":2557},{"edgeType":"imports","source":11202,"target":11156},{"edgeType":"contains","source":3016,"target":3095},{"edgeType":"contains","source":4637,"target":4638},{"edgeType":"contains","source":8898,"target":8902},{"edgeType":"contains","source":10946,"target":10949},{"edgeType":"contains","source":4506,"target":5527},{"edgeType":"contains","source":5230,"target":5281},{"edgeType":"contains","source":8006,"target":8014},{"edgeType":"contains","source":12919,"target":13206},{"edgeType":"contains","source":3214,"target":3299},{"edgeType":"imports","source":6023,"target":5753},{"edgeType":"calls","source":12926,"target":12963},{"edgeType":"calls","source":9900,"target":8467},{"edgeType":"contains","source":3778,"target":3784},{"edgeType":"contains","source":607,"target":615},{"edgeType":"imports","source":7694,"target":448},{"edgeType":"contains","source":10818,"target":10702},{"edgeType":"contains","source":1887,"target":2160},{"edgeType":"calls","source":7543,"target":7544},{"edgeType":"contains","source":42,"target":160},{"edgeType":"contains","source":1,"target":374},{"edgeType":"contains","source":8700,"target":8709},{"edgeType":"imports","source":4596,"target":2409},{"edgeType":"contains","source":2849,"target":2992},{"edgeType":"contains","source":4132,"target":4444},{"edgeType":"contains","source":4130,"target":4506},{"edgeType":"contains","source":2254,"target":2410},{"edgeType":"calls","source":2233,"target":896},{"edgeType":"calls","source":5604,"target":4213},{"edgeType":"calls","source":2822,"target":2721},{"edgeType":"contains","source":10451,"target":10452},{"edgeType":"contains","source":1805,"target":2588},{"edgeType":"contains","source":5230,"target":5288},{"edgeType":"contains","source":12762,"target":12804},{"edgeType":"calls","source":9927,"target":3405},{"edgeType":"contains","source":9173,"target":9901},{"edgeType":"contains","source":1287,"target":677},{"edgeType":"contains","source":42,"target":159},{"edgeType":"contains","source":8898,"target":8912},{"edgeType":"contains","source":1805,"target":2589},{"edgeType":"contains","source":8700,"target":8708},{"edgeType":"contains","source":1887,"target":2161},{"edgeType":"contains","source":11541,"target":11545},{"edgeType":"calls","source":12795,"target":12802},{"edgeType":"contains","source":607,"target":614},{"edgeType":"calls","source":4943,"target":4620},{"edgeType":"calls","source":738,"target":730},{"edgeType":"contains","source":10451,"target":10453},{"edgeType":"contains","source":2852,"target":2900},{"edgeType":"contains","source":12565,"target":12568},{"edgeType":"contains","source":5230,"target":5287},{"edgeType":"calls","source":3248,"target":3257},{"edgeType":"imports","source":2314,"target":1287},{"edgeType":"calls","source":11805,"target":11782},{"edgeType":"calls","source":4669,"target":4656},{"edgeType":"contains","source":42,"target":162},{"edgeType":"calls","source":9040,"target":8706},{"edgeType":"contains","source":12464,"target":12526},{"edgeType":"contains","source":4370,"target":4463},{"edgeType":"imports","source":1511,"target":1867},{"edgeType":"calls","source":2131,"target":1942},{"edgeType":"contains","source":6355,"target":6356},{"edgeType":"contains","source":7610,"target":7619},{"edgeType":"imports","source":7001,"target":2906},{"edgeType":"imports","source":13053,"target":11905},{"edgeType":"contains","source":3214,"target":3302},{"edgeType":"contains","source":8898,"target":8915},{"edgeType":"contains","source":5230,"target":5286},{"edgeType":"calls","source":12236,"target":12159},{"edgeType":"contains","source":9173,"target":9903},{"edgeType":"imports","source":4743,"target":1026},{"edgeType":"calls","source":4605,"target":2411},{"edgeType":"contains","source":1887,"target":2159},{"edgeType":"contains","source":10813,"target":10856},{"edgeType":"contains","source":42,"target":161},{"edgeType":"contains","source":4132,"target":4441},{"edgeType":"contains","source":9526,"target":9530},{"edgeType":"calls","source":12418,"target":11804},{"edgeType":"contains","source":4604,"target":4608},{"edgeType":"imports","source":8062,"target":8066},{"edgeType":"contains","source":7808,"target":7822},{"edgeType":"contains","source":5230,"target":5285},{"edgeType":"contains","source":12565,"target":12566},{"edgeType":"contains","source":10583,"target":10587},{"edgeType":"calls","source":4805,"target":4668},{"edgeType":"contains","source":7019,"target":2685},{"edgeType":"contains","source":8898,"target":8914},{"edgeType":"calls","source":1115,"target":667},{"edgeType":"contains","source":4604,"target":4615},{"edgeType":"contains","source":13752,"target":13821},{"edgeType":"calls","source":709,"target":568},{"edgeType":"contains","source":42,"target":164},{"edgeType":"calls","source":4173,"target":4174},{"edgeType":"calls","source":6097,"target":5839},{"edgeType":"contains","source":8700,"target":8705},{"edgeType":"contains","source":4132,"target":4448},{"edgeType":"calls","source":4977,"target":4620},{"edgeType":"contains","source":2849,"target":2996},{"edgeType":"imports","source":10514,"target":10281},{"edgeType":"contains","source":5562,"target":5564},{"edgeType":"contains","source":5230,"target":5292},{"edgeType":"imports","source":13057,"target":12832},{"edgeType":"imports","source":7001,"target":2908},{"edgeType":"contains","source":8898,"target":8908},{"edgeType":"contains","source":3899,"target":3214},{"edgeType":"contains","source":10880,"target":10891},{"edgeType":"calls","source":5891,"target":5882},{"edgeType":"contains","source":42,"target":163},{"edgeType":"calls","source":6526,"target":6308},{"edgeType":"contains","source":11259,"target":11826},{"edgeType":"contains","source":1,"target":5662},{"edgeType":"contains","source":2852,"target":2904},{"edgeType":"calls","source":7351,"target":1874},{"edgeType":"calls","source":11920,"target":2936},{"edgeType":"imports","source":10884,"target":6209},{"edgeType":"calls","source":1128,"target":266},{"edgeType":"contains","source":2688,"target":2700},{"edgeType":"contains","source":1887,"target":2162},{"edgeType":"calls","source":8163,"target":3129},{"edgeType":"contains","source":1805,"target":2590},{"edgeType":"contains","source":12895,"target":12903},{"edgeType":"contains","source":6276,"target":6686},{"edgeType":"contains","source":8700,"target":8707},{"edgeType":"contains","source":42,"target":166},{"edgeType":"contains","source":4312,"target":4151},{"edgeType":"contains","source":1,"target":5666},{"edgeType":"contains","source":121,"target":888},{"edgeType":"contains","source":12464,"target":12522},{"edgeType":"calls","source":2224,"target":2226},{"edgeType":"contains","source":4340,"target":4341},{"edgeType":"imports","source":7127,"target":1118},{"edgeType":"contains","source":4370,"target":4468},{"edgeType":"calls","source":5034,"target":4965},{"edgeType":"imports","source":899,"target":750},{"edgeType":"contains","source":7610,"target":7615},{"edgeType":"contains","source":5230,"target":5290},{"edgeType":"contains","source":10301,"target":10868},{"edgeType":"contains","source":5409,"target":6083},{"edgeType":"contains","source":8762,"target":8898},{"edgeType":"contains","source":8898,"target":8910},{"edgeType":"contains","source":10910,"target":11016},{"edgeType":"contains","source":8700,"target":8706},{"edgeType":"contains","source":42,"target":165},{"edgeType":"calls","source":2655,"target":2607},{"edgeType":"calls","source":4843,"target":1371},{"edgeType":"contains","source":121,"target":887},{"edgeType":"contains","source":2254,"target":2414},{"edgeType":"calls","source":810,"target":610},{"edgeType":"calls","source":11288,"target":9842},{"edgeType":"contains","source":918,"target":492},{"edgeType":"calls","source":5114,"target":4598},{"edgeType":"contains","source":2849,"target":2995},{"edgeType":"contains","source":5230,"target":5289},{"edgeType":"contains","source":3145,"target":1218},{"edgeType":"calls","source":1769,"target":1534},{"edgeType":"contains","source":7610,"target":7614},{"edgeType":"imports","source":7001,"target":2909},{"edgeType":"contains","source":5230,"target":5264},{"edgeType":"calls","source":7604,"target":1400},{"edgeType":"contains","source":9390,"target":9492},{"edgeType":"contains","source":405,"target":510},{"edgeType":"contains","source":9294,"target":9297},{"edgeType":"imports","source":10841,"target":10702},{"edgeType":"calls","source":6313,"target":2343},{"edgeType":"imports","source":10367,"target":3198},{"edgeType":"contains","source":3743,"target":3794},{"edgeType":"contains","source":6144,"target":6527},{"edgeType":"calls","source":2451,"target":1562},{"edgeType":"contains","source":309,"target":315},{"edgeType":"contains","source":11836,"target":11888},{"edgeType":"contains","source":11803,"target":11854},{"edgeType":"contains","source":5686,"target":5927},{"edgeType":"contains","source":8303,"target":8307},{"edgeType":"calls","source":2258,"target":2260},{"edgeType":"imports","source":11616,"target":2532},{"edgeType":"calls","source":1462,"target":1566},{"edgeType":"contains","source":8468,"target":8477},{"edgeType":"contains","source":405,"target":509},{"edgeType":"calls","source":1267,"target":1268},{"edgeType":"contains","source":7244,"target":7311},{"edgeType":"contains","source":309,"target":314},{"edgeType":"contains","source":11210,"target":11211},{"edgeType":"contains","source":3743,"target":3793},{"edgeType":"calls","source":671,"target":717},{"edgeType":"contains","source":11803,"target":11853},{"edgeType":"imports","source":899,"target":733},{"edgeType":"contains","source":1,"target":5634},{"edgeType":"contains","source":4016,"target":3786},{"edgeType":"contains","source":1347,"target":907},{"edgeType":"contains","source":6288,"target":6293},{"edgeType":"contains","source":6256,"target":6228},{"edgeType":"contains","source":8303,"target":8306},{"edgeType":"contains","source":8302,"target":8337},{"edgeType":"contains","source":8523,"target":429},{"edgeType":"contains","source":8468,"target":8476},{"edgeType":"contains","source":12298,"target":12364},{"edgeType":"calls","source":7477,"target":7452},{"edgeType":"calls","source":11607,"target":3097},{"edgeType":"contains","source":7244,"target":7312},{"edgeType":"contains","source":9294,"target":9299},{"edgeType":"contains","source":5230,"target":5262},{"edgeType":"contains","source":8108,"target":612},{"edgeType":"calls","source":1168,"target":1169},{"edgeType":"calls","source":4513,"target":4232},{"edgeType":"contains","source":7583,"target":3145},{"edgeType":"contains","source":9390,"target":9494},{"edgeType":"contains","source":11803,"target":11852},{"edgeType":"calls","source":5094,"target":4191},{"edgeType":"calls","source":970,"target":965},{"edgeType":"contains","source":6276,"target":6666},{"edgeType":"contains","source":6288,"target":6294},{"edgeType":"contains","source":5230,"target":5261},{"edgeType":"calls","source":1607,"target":1301},{"edgeType":"calls","source":571,"target":648},{"edgeType":"contains","source":7244,"target":7313},{"edgeType":"contains","source":9294,"target":9298},{"edgeType":"contains","source":9390,"target":9493},{"edgeType":"contains","source":4506,"target":5507},{"edgeType":"imports","source":7001,"target":7125},{"edgeType":"contains","source":11276,"target":11277},{"edgeType":"calls","source":13092,"target":13081},{"edgeType":"calls","source":3151,"target":3116},{"edgeType":"contains","source":3743,"target":3791},{"edgeType":"calls","source":10894,"target":3000},{"edgeType":"calls","source":12101,"target":12093},{"edgeType":"calls","source":2555,"target":2565},{"edgeType":"calls","source":4638,"target":4584},{"edgeType":"calls","source":4677,"target":4432},{"edgeType":"imports","source":4506,"target":4137},{"edgeType":"contains","source":4132,"target":4416},{"edgeType":"contains","source":11116,"target":10951},{"edgeType":"contains","source":6288,"target":6295},{"edgeType":"calls","source":2148,"target":1441},{"edgeType":"contains","source":10547,"target":10621},{"edgeType":"contains","source":10813,"target":10831},{"edgeType":"contains","source":5230,"target":5260},{"edgeType":"contains","source":12696,"target":12708},{"edgeType":"contains","source":405,"target":514},{"edgeType":"contains","source":6750,"target":6764},{"edgeType":"contains","source":2350,"target":1528},{"edgeType":"contains","source":5230,"target":5268},{"edgeType":"contains","source":5132,"target":5135},{"edgeType":"calls","source":11977,"target":11714},{"edgeType":"calls","source":1203,"target":1135},{"edgeType":"contains","source":8525,"target":363},{"edgeType":"contains","source":3743,"target":3798},{"edgeType":"contains","source":6144,"target":6523},{"edgeType":"contains","source":11803,"target":11850},{"edgeType":"contains","source":704,"target":758},{"edgeType":"contains","source":10352,"target":10321},{"edgeType":"contains","source":8468,"target":8473},{"edgeType":"contains","source":7244,"target":7305},{"edgeType":"contains","source":12630,"target":12639},{"edgeType":"contains","source":405,"target":513},{"edgeType":"contains","source":9393,"target":9394},{"edgeType":"contains","source":5132,"target":5134},{"edgeType":"contains","source":1580,"target":1087},{"edgeType":"contains","source":1,"target":352},{"edgeType":"contains","source":3743,"target":3797},{"edgeType":"contains","source":11803,"target":11849},{"edgeType":"contains","source":6288,"target":6289},{"edgeType":"imports","source":5342,"target":420},{"edgeType":"contains","source":1,"target":4581},{"edgeType":"contains","source":12432,"target":12434},{"edgeType":"calls","source":1564,"target":1570},{"edgeType":"contains","source":8964,"target":8951},{"edgeType":"calls","source":11167,"target":3000},{"edgeType":"contains","source":7244,"target":7306},{"edgeType":"contains","source":2687,"target":2709},{"edgeType":"contains","source":12927,"target":12944},{"edgeType":"calls","source":6193,"target":6057},{"edgeType":"contains","source":5132,"target":5133},{"edgeType":"contains","source":7279,"target":7280},{"edgeType":"contains","source":5230,"target":5266},{"edgeType":"contains","source":10367,"target":10910},{"edgeType":"contains","source":3743,"target":3796},{"edgeType":"contains","source":12147,"target":9640},{"edgeType":"contains","source":6288,"target":6290},{"edgeType":"contains","source":2093,"target":2094},{"edgeType":"calls","source":4339,"target":4337},{"edgeType":"contains","source":12432,"target":12433},{"edgeType":"contains","source":10910,"target":10990},{"edgeType":"contains","source":8925,"target":9106},{"edgeType":"contains","source":12927,"target":12943},{"edgeType":"contains","source":704,"target":760},{"edgeType":"contains","source":8897,"target":8917},{"edgeType":"contains","source":5230,"target":5265},{"edgeType":"contains","source":12927,"target":12942},{"edgeType":"contains","source":405,"target":515},{"edgeType":"contains","source":10301,"target":10843},{"edgeType":"calls","source":12056,"target":9264},{"edgeType":"contains","source":7700,"target":1629},{"edgeType":"calls","source":10620,"target":10441},{"edgeType":"contains","source":8525,"target":364},{"edgeType":"contains","source":3743,"target":3795},{"edgeType":"calls","source":10203,"target":3286},{"edgeType":"calls","source":2950,"target":3000},{"edgeType":"contains","source":704,"target":759},{"edgeType":"calls","source":2446,"target":655},{"edgeType":"imports","source":1954,"target":789},{"edgeType":"calls","source":245,"target":180},{"edgeType":"contains","source":4132,"target":4421},{"edgeType":"imports","source":9341,"target":5409},{"edgeType":"calls","source":12062,"target":621},{"edgeType":"contains","source":4378,"target":4194},{"edgeType":"calls","source":11642,"target":11527},{"edgeType":"calls","source":7367,"target":2412},{"edgeType":"contains","source":2849,"target":2970},{"edgeType":"contains","source":5132,"target":5139},{"edgeType":"imports","source":4983,"target":4137},{"edgeType":"calls","source":714,"target":434},{"edgeType":"contains","source":2919,"target":2920},{"edgeType":"contains","source":13093,"target":13097},{"edgeType":"contains","source":5230,"target":5272},{"edgeType":"contains","source":1144,"target":1921},{"edgeType":"contains","source":9030,"target":9033},{"edgeType":"calls","source":8252,"target":347},{"edgeType":"contains","source":2687,"target":2712},{"edgeType":"contains","source":12201,"target":12209},{"edgeType":"calls","source":7711,"target":7604},{"edgeType":"calls","source":12408,"target":12098},{"edgeType":"contains","source":8303,"target":8315},{"edgeType":"calls","source":7569,"target":1436},{"edgeType":"contains","source":10301,"target":10857},{"edgeType":"contains","source":4132,"target":4428},{"edgeType":"contains","source":2254,"target":2394},{"edgeType":"contains","source":8039,"target":8043},{"edgeType":"contains","source":402,"target":611},{"edgeType":"contains","source":704,"target":762},{"edgeType":"contains","source":11210,"target":11219},{"edgeType":"contains","source":5132,"target":5138},{"edgeType":"calls","source":3547,"target":3518},{"edgeType":"contains","source":1434,"target":2446},{"edgeType":"contains","source":5230,"target":5271},{"edgeType":"calls","source":11553,"target":11121},{"edgeType":"contains","source":9030,"target":9032},{"edgeType":"calls","source":3261,"target":1814},{"edgeType":"calls","source":10284,"target":10290},{"edgeType":"contains","source":4132,"target":4427},{"edgeType":"contains","source":9698,"target":8407},{"edgeType":"contains","source":9875,"target":2920},{"edgeType":"contains","source":1,"target":4585},{"edgeType":"imports","source":1511,"target":795},{"edgeType":"calls","source":2343,"target":1732},{"edgeType":"calls","source":9062,"target":9062},{"edgeType":"contains","source":2254,"target":2395},{"edgeType":"contains","source":704,"target":761},{"edgeType":"contains","source":6288,"target":6301},{"edgeType":"contains","source":12201,"target":12208},{"edgeType":"contains","source":7279,"target":7292},{"edgeType":"contains","source":8898,"target":8899},{"edgeType":"contains","source":11045,"target":11046},{"edgeType":"contains","source":5230,"target":5270},{"edgeType":"contains","source":9030,"target":9035},{"edgeType":"contains","source":11177,"target":11182},{"edgeType":"calls","source":9881,"target":2703},{"edgeType":"contains","source":9444,"target":429},{"edgeType":"calls","source":7907,"target":7873},{"edgeType":"calls","source":2555,"target":2556},{"edgeType":"calls","source":4635,"target":4670},{"edgeType":"calls","source":4803,"target":1576},{"edgeType":"contains","source":10813,"target":10838},{"edgeType":"calls","source":12576,"target":10059},{"edgeType":"imports","source":1511,"target":794},{"edgeType":"contains","source":2254,"target":2392},{"edgeType":"contains","source":4179,"target":5083},{"edgeType":"contains","source":6276,"target":6674},{"edgeType":"contains","source":2687,"target":2710},{"edgeType":"contains","source":8039,"target":8045},{"edgeType":"contains","source":5132,"target":5136},{"edgeType":"contains","source":5230,"target":5269},{"edgeType":"contains","source":1,"target":5644},{"edgeType":"contains","source":9955,"target":9954},{"edgeType":"calls","source":837,"target":850},{"edgeType":"calls","source":8106,"target":8047},{"edgeType":"contains","source":11422,"target":12044},{"edgeType":"contains","source":9030,"target":9034},{"edgeType":"imports","source":7434,"target":7435},{"edgeType":"contains","source":2687,"target":2711},{"edgeType":"contains","source":1887,"target":2143},{"edgeType":"contains","source":2254,"target":2393},{"edgeType":"contains","source":12201,"target":12206},{"edgeType":"contains","source":8039,"target":8044},{"edgeType":"imports","source":10237,"target":8274},{"edgeType":"imports","source":1511,"target":793},{"edgeType":"contains","source":9173,"target":9881},{"edgeType":"calls","source":11440,"target":3000},{"edgeType":"contains","source":2787,"target":2788},{"edgeType":"contains","source":5230,"target":5276},{"edgeType":"contains","source":11243,"target":11248},{"edgeType":"calls","source":5554,"target":491},{"edgeType":"contains","source":7692,"target":1882},{"edgeType":"calls","source":7974,"target":1570},{"edgeType":"contains","source":3778,"target":3779},{"edgeType":"contains","source":8072,"target":8073},{"edgeType":"calls","source":12508,"target":10059},{"edgeType":"imports","source":12553,"target":11527},{"edgeType":"contains","source":6276,"target":6668},{"edgeType":"contains","source":4179,"target":5089},{"edgeType":"contains","source":12201,"target":12205},{"edgeType":"calls","source":6854,"target":6693},{"edgeType":"calls","source":11415,"target":11175},{"edgeType":"contains","source":11422,"target":12042},{"edgeType":"calls","source":1335,"target":1262},{"edgeType":"contains","source":11078,"target":11079},{"edgeType":"contains","source":1287,"target":665},{"edgeType":"contains","source":9390,"target":9495},{"edgeType":"contains","source":5132,"target":5142},{"edgeType":"contains","source":8897,"target":8922},{"edgeType":"contains","source":10813,"target":10837},{"edgeType":"calls","source":672,"target":674},{"edgeType":"contains","source":6288,"target":6297},{"edgeType":"contains","source":6276,"target":6669},{"edgeType":"contains","source":3845,"target":3815},{"edgeType":"contains","source":4482,"target":4151},{"edgeType":"calls","source":474,"target":470},{"edgeType":"contains","source":2093,"target":2105},{"edgeType":"calls","source":8831,"target":8828},{"edgeType":"contains","source":3016,"target":3086},{"edgeType":"calls","source":7874,"target":7843},{"edgeType":"imports","source":10514,"target":10262},{"edgeType":"contains","source":9030,"target":9031},{"edgeType":"contains","source":9002,"target":8842},{"edgeType":"contains","source":11243,"target":11246},{"edgeType":"calls","source":3346,"target":3400},{"edgeType":"contains","source":5132,"target":5141},{"edgeType":"contains","source":5230,"target":5274},{"edgeType":"contains","source":6912,"target":7037},{"edgeType":"contains","source":8006,"target":8007},{"edgeType":"contains","source":6288,"target":6298},{"edgeType":"calls","source":672,"target":677},{"edgeType":"contains","source":12201,"target":12203},{"edgeType":"contains","source":12571,"target":2847},{"edgeType":"contains","source":11259,"target":11808},{"edgeType":"imports","source":11454,"target":1205},{"edgeType":"contains","source":3016,"target":3087},{"edgeType":"calls","source":11942,"target":11749},{"edgeType":"contains","source":704,"target":768},{"edgeType":"contains","source":5230,"target":5273},{"edgeType":"calls","source":12445,"target":2498},{"edgeType":"contains","source":11177,"target":11179},{"edgeType":"contains","source":5132,"target":5140},{"edgeType":"contains","source":11243,"target":11247},{"edgeType":"contains","source":9294,"target":9302},{"edgeType":"contains","source":7279,"target":7289},{"edgeType":"calls","source":7419,"target":7150},{"edgeType":"calls","source":1795,"target":745},{"edgeType":"imports","source":5342,"target":414},{"edgeType":"contains","source":6276,"target":6671},{"edgeType":"contains","source":4179,"target":5086},{"edgeType":"contains","source":4132,"target":4429},{"edgeType":"imports","source":3763,"target":3911},{"edgeType":"calls","source":11099,"target":3000},{"edgeType":"contains","source":8303,"target":8312},{"edgeType":"calls","source":2451,"target":1549},{"edgeType":"contains","source":1,"target":4591},{"edgeType":"calls","source":12594,"target":12650},{"edgeType":"contains","source":13752,"target":13784},{"edgeType":"contains","source":836,"target":874},{"edgeType":"contains","source":4131,"target":6548},{"edgeType":"contains","source":9029,"target":9039},{"edgeType":"contains","source":4305,"target":4325},{"edgeType":"contains","source":8302,"target":8321},{"edgeType":"calls","source":12062,"target":602},{"edgeType":"calls","source":5966,"target":3537},{"edgeType":"contains","source":12861,"target":12865},{"edgeType":"contains","source":4837,"target":4746},{"edgeType":"contains","source":1218,"target":1717},{"edgeType":"contains","source":1124,"target":1459},{"edgeType":"imports","source":3763,"target":3961},{"edgeType":"contains","source":9341,"target":9937},{"edgeType":"contains","source":12762,"target":12763},{"edgeType":"contains","source":5230,"target":5247},{"edgeType":"contains","source":11439,"target":11493},{"edgeType":"contains","source":7244,"target":7293},{"edgeType":"contains","source":11616,"target":2835},{"edgeType":"contains","source":10185,"target":10200},{"edgeType":"contains","source":5759,"target":5762},{"edgeType":"contains","source":11836,"target":11872},{"edgeType":"calls","source":2288,"target":2338},{"edgeType":"contains","source":9029,"target":9038},{"edgeType":"contains","source":11738,"target":11739},{"edgeType":"contains","source":4131,"target":6547},{"edgeType":"imports","source":11616,"target":1524},{"edgeType":"contains","source":4275,"target":4197},{"edgeType":"calls","source":11770,"target":11769},{"edgeType":"contains","source":4370,"target":4423},{"edgeType":"contains","source":11110,"target":11123},{"edgeType":"contains","source":13569,"target":429},{"edgeType":"contains","source":8500,"target":8524},{"edgeType":"contains","source":9173,"target":9859},{"edgeType":"contains","source":1218,"target":1718},{"edgeType":"contains","source":1124,"target":1458},{"edgeType":"contains","source":1144,"target":1895},{"edgeType":"contains","source":10707,"target":9875},{"edgeType":"contains","source":3143,"target":3351},{"edgeType":"contains","source":471,"target":560},{"edgeType":"contains","source":11439,"target":11494},{"edgeType":"contains","source":5230,"target":5246},{"edgeType":"contains","source":9341,"target":9936},{"edgeType":"calls","source":2387,"target":2441},{"edgeType":"contains","source":11836,"target":11871},{"edgeType":"calls","source":10503,"target":9818},{"edgeType":"contains","source":11826,"target":11124},{"edgeType":"calls","source":12365,"target":12350},{"edgeType":"contains","source":7607,"target":7670},{"edgeType":"contains","source":8299,"target":8416},{"edgeType":"calls","source":10720,"target":3095},{"edgeType":"imports","source":12622,"target":12623},{"edgeType":"contains","source":8897,"target":8905},{"edgeType":"imports","source":5342,"target":1524},{"edgeType":"calls","source":5187,"target":4429},{"edgeType":"contains","source":11259,"target":11786},{"edgeType":"contains","source":8765,"target":8769},{"edgeType":"contains","source":12919,"target":13179},{"edgeType":"contains","source":5230,"target":5245},{"edgeType":"contains","source":4900,"target":4905},{"edgeType":"contains","source":12861,"target":12863},{"edgeType":"contains","source":1218,"target":1715},{"edgeType":"contains","source":1124,"target":1461},{"edgeType":"calls","source":1988,"target":2125},{"edgeType":"contains","source":9341,"target":9939},{"edgeType":"calls","source":2620,"target":2614},{"edgeType":"calls","source":6222,"target":6169},{"edgeType":"contains","source":10185,"target":10198},{"edgeType":"contains","source":4604,"target":4567},{"edgeType":"calls","source":3151,"target":3065},{"edgeType":"contains","source":11595,"target":11940},{"edgeType":"contains","source":4131,"target":6546},{"edgeType":"contains","source":11836,"target":11870},{"edgeType":"calls","source":2827,"target":2539},{"edgeType":"contains","source":7607,"target":7671},{"edgeType":"imports","source":12622,"target":12624},{"edgeType":"calls","source":6318,"target":6370},{"edgeType":"contains","source":7607,"target":7669},{"edgeType":"contains","source":10942,"target":11044},{"edgeType":"contains","source":12630,"target":12623},{"edgeType":"calls","source":11704,"target":11699},{"edgeType":"contains","source":3143,"target":3349},{"edgeType":"contains","source":5230,"target":5244},{"edgeType":"contains","source":405,"target":494},{"edgeType":"imports","source":4983,"target":1026},{"edgeType":"contains","source":10185,"target":10199},{"edgeType":"contains","source":9173,"target":9861},{"edgeType":"calls","source":1102,"target":1050},{"edgeType":"calls","source":4965,"target":4968},{"edgeType":"contains","source":4131,"target":6545},{"edgeType":"contains","source":4132,"target":4407},{"edgeType":"calls","source":5824,"target":5821},{"edgeType":"contains","source":1,"target":337},{"edgeType":"contains","source":11110,"target":11118},{"edgeType":"contains","source":4131,"target":6552},{"edgeType":"calls","source":4240,"target":4187},{"edgeType":"contains","source":9194,"target":9205},{"edgeType":"contains","source":8863,"target":8896},{"edgeType":"calls","source":2108,"target":1571},{"edgeType":"contains","source":4640,"target":4515},{"edgeType":"imports","source":12499,"target":10088},{"edgeType":"contains","source":9341,"target":9933},{"edgeType":"contains","source":11595,"target":11938},{"edgeType":"contains","source":5230,"target":5251},{"edgeType":"contains","source":11616,"target":9173},{"edgeType":"calls","source":1216,"target":682},{"edgeType":"contains","source":8107,"target":621},{"edgeType":"contains","source":9953,"target":9989},{"edgeType":"contains","source":11869,"target":11902},{"edgeType":"calls","source":2390,"target":2343},{"edgeType":"contains","source":11869,"target":11900},{"edgeType":"contains","source":3557,"target":3204},{"edgeType":"imports","source":7332,"target":1144},{"edgeType":"contains","source":4131,"target":6551},{"edgeType":"contains","source":2254,"target":2374},{"edgeType":"calls","source":1926,"target":1926},{"edgeType":"contains","source":9341,"target":9932},{"edgeType":"contains","source":9194,"target":9204},{"edgeType":"calls","source":174,"target":215},{"edgeType":"contains","source":12927,"target":12928},{"edgeType":"contains","source":1144,"target":1899},{"edgeType":"contains","source":3016,"target":3064},{"edgeType":"contains","source":3143,"target":3355},{"edgeType":"contains","source":5230,"target":5250},{"edgeType":"calls","source":3247,"target":3259},{"edgeType":"contains","source":13752,"target":13778},{"edgeType":"contains","source":6144,"target":6508},{"edgeType":"contains","source":1498,"target":1499},{"edgeType":"contains","source":6221,"target":6235},{"edgeType":"contains","source":8302,"target":8316},{"edgeType":"contains","source":11595,"target":11939},{"edgeType":"imports","source":885,"target":2269},{"edgeType":"contains","source":11869,"target":11901},{"edgeType":"contains","source":5761,"target":4640},{"edgeType":"contains","source":12464,"target":12481},{"edgeType":"calls","source":1503,"target":1301},{"edgeType":"contains","source":4370,"target":4426},{"edgeType":"contains","source":1218,"target":1719},{"edgeType":"calls","source":3945,"target":3816},{"edgeType":"contains","source":7244,"target":7291},{"edgeType":"contains","source":6912,"target":7013},{"edgeType":"contains","source":5230,"target":5249},{"edgeType":"contains","source":10185,"target":10194},{"edgeType":"imports","source":7469,"target":7470},{"edgeType":"contains","source":9341,"target":9935},{"edgeType":"contains","source":11595,"target":11936},{"edgeType":"contains","source":5759,"target":5760},{"edgeType":"calls","source":9869,"target":9396},{"edgeType":"contains","source":13752,"target":13777},{"edgeType":"imports","source":4131,"target":4187},{"edgeType":"contains","source":4131,"target":6549},{"edgeType":"contains","source":6287,"target":6305},{"edgeType":"contains","source":8299,"target":8411},{"edgeType":"contains","source":7607,"target":7665},{"edgeType":"calls","source":7111,"target":7160},{"edgeType":"contains","source":1218,"target":1720},{"edgeType":"calls","source":1826,"target":1857},{"edgeType":"contains","source":9194,"target":9206},{"edgeType":"contains","source":6750,"target":6751},{"edgeType":"contains","source":10942,"target":11040},{"edgeType":"calls","source":1988,"target":2120},{"edgeType":"contains","source":3143,"target":3353},{"edgeType":"contains","source":5230,"target":5248},{"edgeType":"contains","source":6633,"target":6149},{"edgeType":"contains","source":10185,"target":10195},{"edgeType":"contains","source":4637,"target":4604},{"edgeType":"calls","source":8764,"target":8768},{"edgeType":"contains","source":11595,"target":11937},{"edgeType":"contains","source":1124,"target":1464},{"edgeType":"contains","source":9341,"target":9934},{"edgeType":"contains","source":8107,"target":622},{"edgeType":"contains","source":9953,"target":9988},{"edgeType":"contains","source":3645,"target":3646},{"edgeType":"contains","source":13752,"target":13776},{"edgeType":"imports","source":3234,"target":3439},{"edgeType":"contains","source":12927,"target":12941},{"edgeType":"contains","source":1218,"target":1725},{"edgeType":"contains","source":4438,"target":4439},{"edgeType":"imports","source":12255,"target":2849},{"edgeType":"imports","source":8062,"target":8100},{"edgeType":"contains","source":8299,"target":8422},{"edgeType":"contains","source":9173,"target":9868},{"edgeType":"contains","source":3652,"target":3436},{"edgeType":"calls","source":6532,"target":6084},{"edgeType":"contains","source":3016,"target":3067},{"edgeType":"imports","source":13780,"target":1026},{"edgeType":"contains","source":1144,"target":1904},{"edgeType":"contains","source":9390,"target":9483},{"edgeType":"contains","source":5230,"target":5255},{"edgeType":"contains","source":11374,"target":10345},{"edgeType":"contains","source":1218,"target":1726},{"edgeType":"contains","source":12927,"target":12940},{"edgeType":"contains","source":6750,"target":6761},{"edgeType":"calls","source":12347,"target":11860},{"edgeType":"contains","source":836,"target":881},{"edgeType":"contains","source":2254,"target":2378},{"edgeType":"contains","source":402,"target":594},{"edgeType":"contains","source":4370,"target":4431},{"edgeType":"contains","source":8299,"target":8421},{"edgeType":"contains","source":8302,"target":8328},{"edgeType":"contains","source":3016,"target":3068},{"edgeType":"calls","source":2827,"target":2534},{"edgeType":"contains","source":11869,"target":11913},{"edgeType":"calls","source":2895,"target":2540},{"edgeType":"contains","source":2983,"target":3034},{"edgeType":"contains","source":1124,"target":1466},{"edgeType":"contains","source":1144,"target":1903},{"edgeType":"contains","source":9390,"target":9482},{"edgeType":"calls","source":5128,"target":4137},{"edgeType":"calls","source":5033,"target":4968},{"edgeType":"contains","source":5230,"target":5254},{"edgeType":"calls","source":3343,"target":1336},{"edgeType":"contains","source":11177,"target":11168},{"edgeType":"calls","source":1830,"target":673},{"edgeType":"calls","source":4635,"target":4620},{"edgeType":"contains","source":9390,"target":9486},{"edgeType":"contains","source":4131,"target":6554},{"edgeType":"contains","source":4132,"target":4409},{"edgeType":"contains","source":10826,"target":10419},{"edgeType":"contains","source":2254,"target":2375},{"edgeType":"contains","source":8302,"target":8331},{"edgeType":"contains","source":2652,"target":2722},{"edgeType":"calls","source":6532,"target":6086},{"edgeType":"calls","source":10996,"target":3000},{"edgeType":"calls","source":2817,"target":1784},{"edgeType":"contains","source":5230,"target":5253},{"edgeType":"calls","source":2749,"target":2835},{"edgeType":"contains","source":11869,"target":11912},{"edgeType":"calls","source":4787,"target":4137},{"edgeType":"imports","source":10884,"target":952},{"edgeType":"contains","source":1124,"target":1469},{"edgeType":"imports","source":7601,"target":7591},{"edgeType":"contains","source":11439,"target":11499},{"edgeType":"contains","source":1144,"target":1906},{"edgeType":"calls","source":3806,"target":721},{"edgeType":"calls","source":5088,"target":4319},{"edgeType":"contains","source":9390,"target":9485},{"edgeType":"imports","source":12565,"target":12268},{"edgeType":"contains","source":7244,"target":7303},{"edgeType":"calls","source":1100,"target":1104},{"edgeType":"calls","source":439,"target":454},{"edgeType":"contains","source":6750,"target":6763},{"edgeType":"calls","source":3974,"target":3971},{"edgeType":"contains","source":4131,"target":6553},{"edgeType":"contains","source":12861,"target":12870},{"edgeType":"contains","source":8299,"target":8423},{"edgeType":"imports","source":10237,"target":6209},{"edgeType":"imports","source":10514,"target":10307},{"edgeType":"contains","source":12630,"target":12632},{"edgeType":"imports","source":554,"target":913},{"edgeType":"contains","source":3143,"target":3357},{"edgeType":"contains","source":11869,"target":11911},{"edgeType":"contains","source":3016,"target":3066},{"edgeType":"calls","source":8469,"target":8404},{"edgeType":"contains","source":8591,"target":8885},{"edgeType":"imports","source":12622,"target":12616},{"edgeType":"contains","source":1124,"target":1468},{"edgeType":"calls","source":5793,"target":5717},{"edgeType":"contains","source":9390,"target":9484},{"edgeType":"contains","source":1218,"target":1729},{"edgeType":"contains","source":1887,"target":2131},{"edgeType":"calls","source":4683,"target":4187},{"edgeType":"imports","source":10237,"target":3045},{"edgeType":"calls","source":3247,"target":3250},{"edgeType":"contains","source":8299,"target":8418},{"edgeType":"contains","source":12927,"target":12937},{"edgeType":"contains","source":405,"target":506},{"edgeType":"contains","source":10813,"target":10820},{"edgeType":"imports","source":6203,"target":2310},{"edgeType":"calls","source":10482,"target":10483},{"edgeType":"calls","source":473,"target":452},{"edgeType":"calls","source":10815,"target":10731},{"edgeType":"contains","source":7244,"target":7297},{"edgeType":"calls","source":5033,"target":4965},{"edgeType":"contains","source":3743,"target":3790},{"edgeType":"calls","source":12408,"target":2572},{"edgeType":"contains","source":11110,"target":11126},{"edgeType":"contains","source":5230,"target":5259},{"edgeType":"contains","source":1218,"target":1730},{"edgeType":"contains","source":11439,"target":11497},{"edgeType":"contains","source":8525,"target":354},{"edgeType":"imports","source":11700,"target":3144},{"edgeType":"calls","source":571,"target":584},{"edgeType":"contains","source":8302,"target":8324},{"edgeType":"contains","source":8897,"target":8906},{"edgeType":"calls","source":3151,"target":3056},{"edgeType":"contains","source":405,"target":505},{"edgeType":"contains","source":8762,"target":8863},{"edgeType":"contains","source":12861,"target":12868},{"edgeType":"contains","source":704,"target":749},{"edgeType":"contains","source":4438,"target":4442},{"edgeType":"contains","source":6750,"target":6757},{"edgeType":"contains","source":309,"target":310},{"edgeType":"contains","source":2314,"target":1580},{"edgeType":"calls","source":8830,"target":8842},{"edgeType":"contains","source":9341,"target":9940},{"edgeType":"calls","source":12004,"target":11926},{"edgeType":"calls","source":7179,"target":7173},{"edgeType":"contains","source":1218,"target":1731},{"edgeType":"contains","source":3214,"target":3276},{"edgeType":"contains","source":5230,"target":5258},{"edgeType":"contains","source":6144,"target":6517},{"edgeType":"calls","source":12669,"target":2936},{"edgeType":"calls","source":1142,"target":856},{"edgeType":"contains","source":11738,"target":11740},{"edgeType":"contains","source":4591,"target":4983},{"edgeType":"contains","source":8362,"target":8581},{"edgeType":"contains","source":8523,"target":8876},{"edgeType":"contains","source":2983,"target":3035},{"edgeType":"contains","source":3645,"target":3655},{"edgeType":"contains","source":12696,"target":12697},{"edgeType":"imports","source":11202,"target":11181},{"edgeType":"contains","source":5230,"target":5257},{"edgeType":"contains","source":1124,"target":1473},{"edgeType":"contains","source":11439,"target":11495},{"edgeType":"contains","source":9341,"target":9943},{"edgeType":"contains","source":9390,"target":9481},{"edgeType":"contains","source":1218,"target":1728},{"edgeType":"calls","source":1232,"target":1236},{"edgeType":"imports","source":12279,"target":11617},{"edgeType":"calls","source":4017,"target":3691},{"edgeType":"calls","source":2038,"target":562},{"edgeType":"contains","source":704,"target":751},{"edgeType":"imports","source":3741,"target":414},{"edgeType":"calls","source":10482,"target":10484},{"edgeType":"contains","source":309,"target":312},{"edgeType":"calls","source":2660,"target":1362},{"edgeType":"contains","source":8713,"target":1927},{"edgeType":"contains","source":4370,"target":4434},{"edgeType":"calls","source":4410,"target":4191},{"edgeType":"contains","source":7976,"target":7862},{"edgeType":"contains","source":5230,"target":5256},{"edgeType":"calls","source":3856,"target":3396},{"edgeType":"calls","source":5495,"target":4381},{"edgeType":"contains","source":3214,"target":3274},{"edgeType":"contains","source":9341,"target":9942},{"edgeType":"contains","source":11414,"target":11214},{"edgeType":"calls","source":1563,"target":1545},{"edgeType":"calls","source":7611,"target":7524},{"edgeType":"contains","source":9664,"target":3100},{"edgeType":"contains","source":1144,"target":1880},{"edgeType":"contains","source":3214,"target":3247},{"edgeType":"calls","source":6056,"target":6049},{"edgeType":"calls","source":10844,"target":10860},{"edgeType":"imports","source":1511,"target":820},{"edgeType":"calls","source":3962,"target":3312},{"edgeType":"contains","source":405,"target":477},{"edgeType":"contains","source":5409,"target":6024},{"edgeType":"contains","source":4132,"target":4386},{"edgeType":"calls","source":12331,"target":12330},{"edgeType":"contains","source":13752,"target":13767},{"edgeType":"contains","source":8078,"target":450},{"edgeType":"contains","source":6221,"target":6222},{"edgeType":"contains","source":1434,"target":2404},{"edgeType":"contains","source":1529,"target":1573},{"edgeType":"contains","source":11242,"target":11241},{"edgeType":"contains","source":10910,"target":10963},{"edgeType":"calls","source":6000,"target":4613},{"edgeType":"contains","source":8566,"target":8577},{"edgeType":"contains","source":1218,"target":1701},{"edgeType":"calls","source":1870,"target":1569},{"edgeType":"contains","source":3016,"target":3042},{"edgeType":"contains","source":11616,"target":2820},{"edgeType":"contains","source":9491,"target":9498},{"edgeType":"contains","source":7254,"target":6968},{"edgeType":"contains","source":8078,"target":449},{"edgeType":"calls","source":2827,"target":2558},{"edgeType":"contains","source":11242,"target":11243},{"edgeType":"contains","source":405,"target":476},{"edgeType":"contains","source":11595,"target":11927},{"edgeType":"contains","source":4305,"target":4308},{"edgeType":"imports","source":8011,"target":1218},{"edgeType":"contains","source":704,"target":720},{"edgeType":"calls","source":11234,"target":3000},{"edgeType":"contains","source":5883,"target":6131},{"edgeType":"imports","source":13058,"target":12832},{"edgeType":"calls","source":12331,"target":12328},{"edgeType":"calls","source":8830,"target":8816},{"edgeType":"calls","source":1217,"target":674},{"edgeType":"contains","source":12297,"target":2847},{"edgeType":"contains","source":4132,"target":4384},{"edgeType":"contains","source":13752,"target":13765},{"edgeType":"calls","source":3061,"target":1644},{"edgeType":"contains","source":1529,"target":1571},{"edgeType":"contains","source":1497,"target":1506},{"edgeType":"imports","source":8062,"target":8090},{"edgeType":"contains","source":3578,"target":3589},{"edgeType":"calls","source":9636,"target":9199},{"edgeType":"calls","source":13091,"target":13081},{"edgeType":"contains","source":8566,"target":8579},{"edgeType":"contains","source":1218,"target":1699},{"edgeType":"contains","source":3214,"target":3244},{"edgeType":"calls","source":2026,"target":2020},{"edgeType":"contains","source":405,"target":478},{"edgeType":"calls","source":12145,"target":11753},{"edgeType":"calls","source":11268,"target":3000},{"edgeType":"contains","source":1,"target":317},{"edgeType":"calls","source":5127,"target":4191},{"edgeType":"contains","source":1497,"target":1507},{"edgeType":"contains","source":13117,"target":13365},{"edgeType":"calls","source":4509,"target":4322},{"edgeType":"contains","source":6749,"target":6769},{"edgeType":"calls","source":11340,"target":11339},{"edgeType":"contains","source":918,"target":430},{"edgeType":"contains","source":5409,"target":735},{"edgeType":"contains","source":8566,"target":8578},{"edgeType":"contains","source":1218,"target":1700},{"edgeType":"contains","source":1124,"target":1443},{"edgeType":"contains","source":405,"target":481},{"edgeType":"contains","source":11410,"target":11315},{"edgeType":"contains","source":13752,"target":13763},{"edgeType":"contains","source":8107,"target":604},{"edgeType":"contains","source":1529,"target":1577},{"edgeType":"calls","source":3053,"target":2946},{"edgeType":"calls","source":2387,"target":2452},{"edgeType":"contains","source":11836,"target":11851},{"edgeType":"contains","source":8401,"target":8403},{"edgeType":"imports","source":7072,"target":7074},{"edgeType":"contains","source":1218,"target":1705},{"edgeType":"contains","source":13117,"target":13364},{"edgeType":"contains","source":2818,"target":2842},{"edgeType":"calls","source":6618,"target":6569},{"edgeType":"contains","source":1124,"target":1446},{"edgeType":"contains","source":4506,"target":5480},{"edgeType":"contains","source":11374,"target":11375},{"edgeType":"contains","source":1954,"target":1087},{"edgeType":"calls","source":4635,"target":4642},{"edgeType":"calls","source":12165,"target":568},{"edgeType":"contains","source":11822,"target":11227},{"edgeType":"calls","source":4338,"target":4336},{"edgeType":"contains","source":12464,"target":12466},{"edgeType":"contains","source":3016,"target":3047},{"edgeType":"contains","source":13117,"target":13363},{"edgeType":"contains","source":2818,"target":2843},{"edgeType":"contains","source":7013,"target":7035},{"edgeType":"contains","source":405,"target":483},{"edgeType":"contains","source":9491,"target":9497},{"edgeType":"calls","source":572,"target":581},{"edgeType":"contains","source":9506,"target":10089},{"edgeType":"contains","source":1144,"target":1886},{"edgeType":"contains","source":5409,"target":741},{"edgeType":"contains","source":8107,"target":606},{"edgeType":"calls","source":12337,"target":1576},{"edgeType":"calls","source":4679,"target":4334},{"edgeType":"contains","source":8078,"target":448},{"edgeType":"imports","source":2816,"target":2641},{"edgeType":"contains","source":13815,"target":13922},{"edgeType":"contains","source":13752,"target":13761},{"edgeType":"contains","source":3907,"target":3964},{"edgeType":"contains","source":704,"target":727},{"edgeType":"contains","source":8362,"target":8557},{"edgeType":"contains","source":11864,"target":12038},{"edgeType":"contains","source":4132,"target":4389},{"edgeType":"contains","source":6287,"target":6288},{"edgeType":"contains","source":8302,"target":8303},{"edgeType":"calls","source":2554,"target":2558},{"edgeType":"contains","source":8401,"target":8405},{"edgeType":"contains","source":3016,"target":3044},{"edgeType":"contains","source":4370,"target":4410},{"edgeType":"contains","source":1218,"target":1703},{"edgeType":"contains","source":13117,"target":13362},{"edgeType":"calls","source":2007,"target":491},{"edgeType":"calls","source":4820,"target":4190},{"edgeType":"contains","source":12861,"target":12841},{"edgeType":"contains","source":471,"target":550},{"edgeType":"contains","source":3214,"target":3250},{"edgeType":"contains","source":7596,"target":592},{"edgeType":"contains","source":9491,"target":9496},{"edgeType":"contains","source":5409,"target":6025},{"edgeType":"contains","source":13752,"target":13760},{"edgeType":"contains","source":8299,"target":8394},{"edgeType":"contains","source":13815,"target":13921},{"edgeType":"calls","source":12442,"target":436},{"edgeType":"contains","source":8401,"target":8404},{"edgeType":"contains","source":12178,"target":3360},{"edgeType":"imports","source":554,"target":884},{"edgeType":"calls","source":9900,"target":8417},{"edgeType":"calls","source":436,"target":568},{"edgeType":"imports","source":7070,"target":2909},{"edgeType":"calls","source":4372,"target":4337},{"edgeType":"imports","source":7601,"target":7588},{"edgeType":"contains","source":836,"target":862},{"edgeType":"contains","source":13117,"target":13361},{"edgeType":"calls","source":4875,"target":4598},{"edgeType":"contains","source":11242,"target":11250},{"edgeType":"calls","source":7459,"target":585},{"edgeType":"calls","source":10950,"target":3354},{"edgeType":"contains","source":9953,"target":9984},{"edgeType":"calls","source":5492,"target":270},{"edgeType":"contains","source":11021,"target":10702},{"edgeType":"calls","source":8285,"target":348},{"edgeType":"contains","source":11110,"target":11114},{"edgeType":"contains","source":1529,"target":1581},{"edgeType":"calls","source":3151,"target":3075},{"edgeType":"contains","source":1218,"target":1709},{"edgeType":"contains","source":6023,"target":6026},{"edgeType":"calls","source":1722,"target":864},{"edgeType":"contains","source":4841,"target":4613},{"edgeType":"contains","source":13752,"target":13775},{"edgeType":"calls","source":11507,"target":3000},{"edgeType":"contains","source":4131,"target":6540},{"edgeType":"calls","source":3974,"target":3988},{"edgeType":"contains","source":2818,"target":2846},{"edgeType":"contains","source":405,"target":485},{"edgeType":"contains","source":704,"target":729},{"edgeType":"contains","source":11242,"target":11251},{"edgeType":"contains","source":402,"target":577},{"edgeType":"imports","source":1954,"target":836},{"edgeType":"contains","source":1124,"target":1450},{"edgeType":"contains","source":12698,"target":12623},{"edgeType":"contains","source":9029,"target":9030},{"edgeType":"contains","source":3143,"target":3343},{"edgeType":"calls","source":9919,"target":9945},{"edgeType":"contains","source":10185,"target":10193},{"edgeType":"calls","source":9927,"target":3354},{"edgeType":"contains","source":1218,"target":1710},{"edgeType":"contains","source":6023,"target":6027},{"edgeType":"calls","source":2658,"target":390},{"edgeType":"imports","source":9852,"target":1218},{"edgeType":"calls","source":6716,"target":6707},{"edgeType":"contains","source":8005,"target":8006},{"edgeType":"contains","source":10367,"target":10893},{"edgeType":"contains","source":6221,"target":6231},{"edgeType":"contains","source":4506,"target":5484},{"edgeType":"contains","source":8362,"target":8566},{"edgeType":"contains","source":9953,"target":9982},{"edgeType":"contains","source":11110,"target":11112},{"edgeType":"contains","source":1529,"target":1579},{"edgeType":"contains","source":1144,"target":1890},{"edgeType":"imports","source":7332,"target":1118},{"edgeType":"contains","source":9173,"target":9854},{"edgeType":"imports","source":10237,"target":8308},{"edgeType":"contains","source":10942,"target":11034},{"edgeType":"calls","source":3313,"target":1222},{"edgeType":"contains","source":8863,"target":8893},{"edgeType":"imports","source":885,"target":1205},{"edgeType":"contains","source":1218,"target":1707},{"edgeType":"contains","source":4132,"target":4393},{"edgeType":"contains","source":13815,"target":13934},{"edgeType":"contains","source":13752,"target":13773},{"edgeType":"contains","source":6355,"target":6306},{"edgeType":"contains","source":10185,"target":10190},{"edgeType":"contains","source":8238,"target":8185},{"edgeType":"contains","source":6221,"target":6232},{"edgeType":"calls","source":4951,"target":4353},{"edgeType":"contains","source":11836,"target":11860},{"edgeType":"contains","source":1144,"target":1889},{"edgeType":"contains","source":9341,"target":9930},{"edgeType":"contains","source":1805,"target":2537},{"edgeType":"calls","source":12269,"target":12145},{"edgeType":"contains","source":5409,"target":6029},{"edgeType":"calls","source":12145,"target":11761},{"edgeType":"contains","source":11242,"target":11249},{"edgeType":"calls","source":6848,"target":6845},{"edgeType":"contains","source":11595,"target":11933},{"edgeType":"contains","source":10910,"target":10970},{"edgeType":"contains","source":10942,"target":11035},{"edgeType":"calls","source":9692,"target":9584},{"edgeType":"calls","source":12375,"target":12030},{"edgeType":"contains","source":13752,"target":13772},{"edgeType":"contains","source":8762,"target":8852},{"edgeType":"contains","source":13815,"target":13933},{"edgeType":"contains","source":6221,"target":6233},{"edgeType":"contains","source":836,"target":866},{"edgeType":"contains","source":402,"target":579},{"edgeType":"contains","source":10185,"target":10191},{"edgeType":"calls","source":2299,"target":947},{"edgeType":"contains","source":9194,"target":9197},{"edgeType":"contains","source":2818,"target":2851},{"edgeType":"calls","source":4833,"target":4839},{"edgeType":"contains","source":11836,"target":11859},{"edgeType":"contains","source":4900,"target":4903},{"edgeType":"calls","source":7905,"target":7904},{"edgeType":"contains","source":1218,"target":1713},{"edgeType":"contains","source":13752,"target":13771},{"edgeType":"contains","source":6912,"target":7002},{"edgeType":"calls","source":1988,"target":2127},{"edgeType":"contains","source":13815,"target":13932},{"edgeType":"contains","source":402,"target":582},{"edgeType":"calls","source":2785,"target":2790},{"edgeType":"contains","source":2254,"target":2365},{"edgeType":"calls","source":4394,"target":3650},{"edgeType":"contains","source":1,"target":7727},{"edgeType":"imports","source":11864,"target":11779},{"edgeType":"calls","source":11340,"target":11353},{"edgeType":"calls","source":2819,"target":2794},{"edgeType":"contains","source":11836,"target":11858},{"edgeType":"contains","source":4900,"target":4902},{"edgeType":"imports","source":7332,"target":1119},{"edgeType":"contains","source":1124,"target":1454},{"edgeType":"imports","source":554,"target":895},{"edgeType":"contains","source":3143,"target":3347},{"edgeType":"calls","source":1722,"target":859},{"edgeType":"contains","source":11616,"target":2824},{"edgeType":"contains","source":1218,"target":1714},{"edgeType":"contains","source":5230,"target":5242},{"edgeType":"contains","source":11374,"target":11383},{"edgeType":"contains","source":11595,"target":11931},{"edgeType":"contains","source":11738,"target":11726},{"edgeType":"contains","source":13815,"target":13931},{"edgeType":"imports","source":7434,"target":7470},{"edgeType":"contains","source":8863,"target":8886},{"edgeType":"contains","source":10185,"target":10189},{"edgeType":"calls","source":12761,"target":12754},{"edgeType":"calls","source":671,"target":672},{"edgeType":"calls","source":6848,"target":6847},{"edgeType":"contains","source":8566,"target":8580},{"edgeType":"calls","source":8865,"target":8798},{"edgeType":"contains","source":11374,"target":11380},{"edgeType":"contains","source":836,"target":872},{"edgeType":"contains","source":3645,"target":3638},{"edgeType":"contains","source":7767,"target":7983},{"edgeType":"calls","source":4943,"target":4598},{"edgeType":"calls","source":9357,"target":3062},{"edgeType":"calls","source":11538,"target":11554},{"edgeType":"contains","source":11242,"target":11244},{"edgeType":"contains","source":1144,"target":1894},{"edgeType":"contains","source":11674,"target":11593},{"edgeType":"calls","source":9556,"target":9577},{"edgeType":"calls","source":11198,"target":3068},{"edgeType":"contains","source":13752,"target":13769},{"edgeType":"contains","source":3878,"target":3815},{"edgeType":"contains","source":13117,"target":13370},{"edgeType":"contains","source":4131,"target":6542},{"edgeType":"contains","source":10185,"target":10186},{"edgeType":"contains","source":10547,"target":10591},{"edgeType":"calls","source":11415,"target":11140},{"edgeType":"contains","source":836,"target":871},{"edgeType":"contains","source":2852,"target":2853},{"edgeType":"contains","source":4933,"target":4934},{"edgeType":"contains","source":2818,"target":2850},{"edgeType":"calls","source":1334,"target":1262},{"edgeType":"contains","source":1144,"target":1893},{"edgeType":"calls","source":1467,"target":1367},{"edgeType":"calls","source":5604,"target":4190},{"edgeType":"contains","source":1218,"target":1712},{"edgeType":"calls","source":9788,"target":270},{"edgeType":"calls","source":8294,"target":7475},{"edgeType":"contains","source":10942,"target":11031},{"edgeType":"contains","source":704,"target":734},{"edgeType":"contains","source":10185,"target":10187},{"edgeType":"calls","source":571,"target":603},{"edgeType":"imports","source":3763,"target":3944}],"nodes":[{"groupName":"","id":1,"nodeType":"Repo","repoName":"astropy#astropy#c76af9ed6bb89bfba45b9f5bc1e635188278e2fa"},{"id":2,"name":"","nodeType":"Package"},{"id":3,"name":"CITATION","nodeType":"TextFile","path":"","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, 2013).\n\nwhere (Astropy Collaboration, 2013) is a citation to this paper:\n\n  http://adsabs.harvard.edu/abs/2013A%26A...558A..33A\n\nWe encourage you to also include citations to this paper in the main text\nwherever appropriate.\n\nA BibTeX entry for LaTeX users is\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 = {http://adsabs.harvard.edu/abs/2013A%26A...558A..33A},\n  adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n"},{"id":4,"name":"CHANGES.rst","nodeType":"TextFile","path":"","text":"3.0 (unreleased)\n=================\n\nNew Features\n------------\n\nastropy.config\n^^^^^^^^^^^^^^\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\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\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\nastropy.extern\n^^^^^^^^^^^^^^\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\nastropy.io.misc\n~~~~~~~~~~~~~~~\n\n- Add implementations of astropy-specific ASDF tag types. [#6790]\n\n- Add ASDF tag and schema for ICRSCoord. [#6904]\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\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\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\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- Added ``is_separable`` function to modeling totest the\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\nastropy.nddata\n^^^^^^^^^^^^^^\n\nastropy.samp\n^^^^^^^^^^^^\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\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.time\n^^^^^^^^^^^^\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\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\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\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.17. [#6989]\n\nAPI Changes\n-----------\n\nastropy.config\n^^^^^^^^^^^^^^\n\nastropy.constants\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\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\nastropy.extern\n^^^^^^^^^^^^^^\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\n\n- Allow ECSV files to be auto-identified by ``Table.read`` or ``Table.write`` based\n  on the ``.ecsv`` file name suffix. In this case it is not required to provide the\n  ``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.registry\n^^^^^^^^^^^^^^^^^^^\n\nastropy.io.votable\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.nddata\n^^^^^^^^^^^^^^\n\nastropy.samp\n^^^^^^^^^^^^\n\nastropy.stats\n^^^^^^^^^^^^^\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\nastropy.tests\n^^^^^^^^^^^^^\n\nastropy.time\n^^^^^^^^^^^^\n\nastropy.units\n^^^^^^^^^^^^^\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\nastropy.wcs\n^^^^^^^^^^^\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\nastropy.extern\n^^^^^^^^^^^^^^\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\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\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\nastropy.samp\n^^^^^^^^^^^^\n\nastropy.stats\n^^^^^^^^^^^^^\n\nastropy.table\n^^^^^^^^^^^^^\n\nastropy.tests\n^^^^^^^^^^^^^\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\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\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\nastropy.wcs\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\n2.0.4 (unreleased)\n==================\n\nBug Fixes\n---------\n\nastropy.config\n^^^^^^^^^^^^^^\n\nastropy.constants\n^^^^^^^^^^^^^^^^^\n\nastropy.convolution\n^^^^^^^^^^^^^^^^^^^\n\nastropy.coordinates\n^^^^^^^^^^^^^^^^^^^\n\nastropy.cosmology\n^^^^^^^^^^^^^^^^^\n\nastropy.extern\n^^^^^^^^^^^^^^\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\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\nastropy.io.misc\n^^^^^^^^^^^^^^^\n\nastropy.io.registry\n^^^^^^^^^^^^^^^^^^^\n\nastropy.io.votable\n^^^^^^^^^^^^^^^^^^\n\nastropy.modeling\n^^^^^^^^^^^^^^^^\n\nastropy.nddata\n^^^^^^^^^^^^^^\n\nastropy.samp\n^^^^^^^^^^^^\n\nastropy.stats\n^^^^^^^^^^^^^\n\nastropy.table\n^^^^^^^^^^^^^\n\nastropy.tests\n^^^^^^^^^^^^^\n\nastropy.time\n^^^^^^^^^^^^\n\nastropy.units\n^^^^^^^^^^^^^\n\nastropy.utils\n^^^^^^^^^^^^^\n\nastropy.visualization\n^^^^^^^^^^^^^^^^^^^^^\n\nastropy.vo\n^^^^^^^^^^\n\nastropy.wcs\n^^^^^^^^^^^\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- Fixed broken links in the documentation. [#6745]\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- Fixed issue with running test suite directly from ``pytest``. [#6437]\n\nastropy.time\n^^^^^^^^^^^^\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 reading sip wcs while there is no default CRPIX1 CRPIX2 keywords and only CRPIX1n CRPIX2n in header. [#6372]\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. [#4855, #6183,\n  #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\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  :ref:`the backwards compatibility note <astropy_convolve_compat>` for more\n  on how to get the old behavior (and why you probably don't want to.) [#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`` paramater 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.cosmology\n^^^^^^^^^^^^^^^^^\n\nastropy.extern\n^^^^^^^^^^^^^^\n\nastropy.io.ascii\n^^^^^^^^^^^^^^^^\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 suppored. [#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 equivalance 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 useable 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 build-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.cosmology\n^^^^^^^^^^^^^^^^^\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. [#4867,\n  #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.misc\n^^^^^^^^^^^^^^^\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 unsymmetric 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.. _astroML: http://astroML.org\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  http://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/ouput 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.python.org/pypi/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  inteded 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  <http://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  <http://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 acheive 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 seperators 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  http://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  <http://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.python.org/pypi/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 unparseable 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 convertable 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":"CODE_OF_CONDUCT.md","nodeType":"TextFile","path":"","text":"Please read the [Astropy Project Code of Conduct](http://www.astropy.org/code_of_conduct.html).\n"},{"fileName":"conftest.py","filePath":"","id":6,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\npytest_plugins = [\n    'astropy.tests.plugins.config',\n    'astropy.tests.plugins.display',\n]\n"},{"id":7,"name":"appveyor.yml","nodeType":"TextFile","path":"","text":"# AppVeyor.com is a Continuous Integration service to build and run tests under\n# Windows\n\nenvironment:\n\n    global:\n        PYTHON: \"C:\\\\conda\"\n        MINICONDA_VERSION: \"latest\"\n        CMD_IN_ENV: \"cmd /E:ON /V:ON /C .\\\\ci-helpers\\\\appveyor\\\\windows_sdk.cmd\"\n        PYTHON_ARCH: \"64\" # needs to be set for CMD_IN_ENV to succeed. If a mix\n                          # of 32 bit and 64 bit builds are needed, move this\n                          # to the matrix section.\n        CONDA_DEPENDENCIES: \"Cython scipy h5py beautifulsoup4 jinja2 pyyaml matplotlib scikit-image pytz\"\n        PIP_DEPENDENCIES: \"objgraph\"\n\n    matrix:\n        - PYTHON_VERSION: \"3.6\"\n          NUMPY_VERSION: \"stable\"\n\nmatrix:\n    fast_finish: true\n\nplatform:\n    -x64\n\nos: Visual Studio 2015 Update 2\n\ninstall:\n    - \"git clone git://github.com/astropy/ci-helpers.git\"\n    - \"powershell ci-helpers/appveyor/install-miniconda.ps1\"\n    - \"SET PATH=%PYTHON%;%PYTHON%\\\\Scripts;%PATH%\"\n    - \"activate test\"\n\n# Not a .NET project, we build Astropy in the install step instead\nbuild: false\n\ntest_script:\n    - \"%CMD_IN_ENV% python setup.py test\"\n"},{"attributeType":"","col":0,"comment":"null","endLoc":3,"id":8,"name":"pytest_plugins","nodeType":"Attribute","startLoc":3,"text":"pytest_plugins"},{"fileName":"ah_bootstrap.py","filePath":"","id":9,"nodeType":"File","text":"\"\"\"\nThis bootstrap module contains code for ensuring that the astropy_helpers\npackage will be importable by the time the setup.py script runs.  It also\nincludes some workarounds to ensure that a recent-enough version of setuptools\nis being used for the installation.\n\nThis module should be the first thing imported in the setup.py of distributions\nthat make use of the utilities in astropy_helpers.  If the distribution ships\nwith its own copy of astropy_helpers, this module will first attempt to import\nfrom the shipped copy.  However, it will also check PyPI to see if there are\nany bug-fix releases on top of the current version that may be useful to get\npast platform-specific bugs that have been fixed.  When running setup.py, use\nthe ``--offline`` command-line option to disable the auto-upgrade checks.\n\nWhen this module is imported or otherwise executed it automatically calls a\nmain function that attempts to read the project's setup.cfg file, which it\nchecks for a configuration section called ``[ah_bootstrap]`` the presences of\nthat section, and options therein, determine the next step taken:  If it\ncontains an option called ``auto_use`` with a value of ``True``, it will\nautomatically call the main function of this module called\n`use_astropy_helpers` (see that function's docstring for full details).\nOtherwise no further action is taken (however,\n``ah_bootstrap.use_astropy_helpers`` may be called manually from within the\nsetup.py script).\n\nAdditional options in the ``[ah_boostrap]`` section of setup.cfg have the same\nnames as the arguments to `use_astropy_helpers`, and can be used to configure\nthe bootstrap script when ``auto_use = True``.\n\nSee https://github.com/astropy/astropy-helpers for more details, and for the\nlatest version of this module.\n\"\"\"\n\nimport contextlib\nimport errno\nimport imp\nimport io\nimport locale\nimport os\nimport re\nimport subprocess as sp\nimport sys\n\ntry:\n    from ConfigParser import ConfigParser, RawConfigParser\nexcept ImportError:\n    from configparser import ConfigParser, RawConfigParser\n\n\nif sys.version_info[0] < 3:\n    _str_types = (str, unicode)\n    _text_type = unicode\n    PY3 = False\nelse:\n    _str_types = (str, bytes)\n    _text_type = str\n    PY3 = True\n\n\n# What follows are several import statements meant to deal with install-time\n# issues with either missing or misbehaving pacakges (including making sure\n# setuptools itself is installed):\n\n\n# Some pre-setuptools checks to ensure that either distribute or setuptools >=\n# 0.7 is used (over pre-distribute setuptools) if it is available on the path;\n# otherwise the latest setuptools will be downloaded and bootstrapped with\n# ``ez_setup.py``.  This used to be included in a separate file called\n# setuptools_bootstrap.py; but it was combined into ah_bootstrap.py\ntry:\n    import pkg_resources\n    _setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7')\n    # This may raise a DistributionNotFound in which case no version of\n    # setuptools or distribute is properly installed\n    _setuptools = pkg_resources.get_distribution('setuptools')\n    if _setuptools not in _setuptools_req:\n        # Older version of setuptools; check if we have distribute; again if\n        # this results in DistributionNotFound we want to give up\n        _distribute = pkg_resources.get_distribution('distribute')\n        if _setuptools != _distribute:\n            # It's possible on some pathological systems to have an old version\n            # of setuptools and distribute on sys.path simultaneously; make\n            # sure distribute is the one that's used\n            sys.path.insert(1, _distribute.location)\n            _distribute.activate()\n            imp.reload(pkg_resources)\nexcept:\n    # There are several types of exceptions that can occur here; if all else\n    # fails bootstrap and use the bootstrapped version\n    from ez_setup import use_setuptools\n    use_setuptools()\n\n\n# typing as a dependency for 1.6.1+ Sphinx causes issues when imported after\n# initializing submodule with ah_boostrap.py\n# See discussion and references in\n# https://github.com/astropy/astropy-helpers/issues/302\n\ntry:\n    import typing   # noqa\nexcept ImportError:\n    pass\n\n\n# Note: The following import is required as a workaround to\n# https://github.com/astropy/astropy-helpers/issues/89; if we don't import this\n# module now, it will get cleaned up after `run_setup` is called, but that will\n# later cause the TemporaryDirectory class defined in it to stop working when\n# used later on by setuptools\ntry:\n    import setuptools.py31compat   # noqa\nexcept ImportError:\n    pass\n\n\n# matplotlib can cause problems if it is imported from within a call of\n# run_setup(), because in some circumstances it will try to write to the user's\n# home directory, resulting in a SandboxViolation.  See\n# https://github.com/matplotlib/matplotlib/pull/4165\n# Making sure matplotlib, if it is available, is imported early in the setup\n# process can mitigate this (note importing matplotlib.pyplot has the same\n# issue)\ntry:\n    import matplotlib\n    matplotlib.use('Agg')\n    import matplotlib.pyplot\nexcept:\n    # Ignore if this fails for *any* reason*\n    pass\n\n\n# End compatibility imports...\n\n\n# In case it didn't successfully import before the ez_setup checks\nimport pkg_resources\n\nfrom setuptools import Distribution\nfrom setuptools.package_index import PackageIndex\nfrom setuptools.sandbox import run_setup\n\nfrom distutils import log\nfrom distutils.debug import DEBUG\n\n\n# TODO: Maybe enable checking for a specific version of astropy_helpers?\nDIST_NAME = 'astropy-helpers'\nPACKAGE_NAME = 'astropy_helpers'\n\n# Defaults for other options\nDOWNLOAD_IF_NEEDED = True\nINDEX_URL = 'https://pypi.python.org/simple'\nUSE_GIT = True\nOFFLINE = False\nAUTO_UPGRADE = True\n\n# A list of all the configuration options and their required types\nCFG_OPTIONS = [\n    ('auto_use', bool), ('path', str), ('download_if_needed', bool),\n    ('index_url', str), ('use_git', bool), ('offline', bool),\n    ('auto_upgrade', bool)\n]\n\n\nclass _Bootstrapper(object):\n    \"\"\"\n    Bootstrapper implementation.  See ``use_astropy_helpers`` for parameter\n    documentation.\n    \"\"\"\n\n    def __init__(self, path=None, index_url=None, use_git=None, offline=None,\n                 download_if_needed=None, auto_upgrade=None):\n\n        if path is None:\n            path = PACKAGE_NAME\n\n        if not (isinstance(path, _str_types) or path is False):\n            raise TypeError('path must be a string or False')\n\n        if PY3 and not isinstance(path, _text_type):\n            fs_encoding = sys.getfilesystemencoding()\n            path = path.decode(fs_encoding)  # path to unicode\n\n        self.path = path\n\n        # Set other option attributes, using defaults where necessary\n        self.index_url = index_url if index_url is not None else INDEX_URL\n        self.offline = offline if offline is not None else OFFLINE\n\n        # If offline=True, override download and auto-upgrade\n        if self.offline:\n            download_if_needed = False\n            auto_upgrade = False\n\n        self.download = (download_if_needed\n                         if download_if_needed is not None\n                         else DOWNLOAD_IF_NEEDED)\n        self.auto_upgrade = (auto_upgrade\n                             if auto_upgrade is not None else AUTO_UPGRADE)\n\n        # If this is a release then the .git directory will not exist so we\n        # should not use git.\n        git_dir_exists = os.path.exists(os.path.join(os.path.dirname(__file__), '.git'))\n        if use_git is None and not git_dir_exists:\n            use_git = False\n\n        self.use_git = use_git if use_git is not None else USE_GIT\n        # Declared as False by default--later we check if astropy-helpers can be\n        # upgraded from PyPI, but only if not using a source distribution (as in\n        # the case of import from a git submodule)\n        self.is_submodule = False\n\n    @classmethod\n    def main(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = cls.parse_config()\n        config.update(cls.parse_command_line(argv))\n\n        auto_use = config.pop('auto_use', False)\n        bootstrapper = cls(**config)\n\n        if auto_use:\n            # Run the bootstrapper, otherwise the setup.py is using the old\n            # use_astropy_helpers() interface, in which case it will run the\n            # bootstrapper manually after reconfiguring it.\n            bootstrapper.run()\n\n        return bootstrapper\n\n    @classmethod\n    def parse_config(cls):\n        if not os.path.exists('setup.cfg'):\n            return {}\n\n        cfg = ConfigParser()\n\n        try:\n            cfg.read('setup.cfg')\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.error(\n                \"Error reading setup.cfg: {0!r}\\n{1} will not be \"\n                \"automatically bootstrapped and package installation may fail.\"\n                \"\\n{2}\".format(e, PACKAGE_NAME, _err_help_msg))\n            return {}\n\n        if not cfg.has_section('ah_bootstrap'):\n            return {}\n\n        config = {}\n\n        for option, type_ in CFG_OPTIONS:\n            if not cfg.has_option('ah_bootstrap', option):\n                continue\n\n            if type_ is bool:\n                value = cfg.getboolean('ah_bootstrap', option)\n            else:\n                value = cfg.get('ah_bootstrap', option)\n\n            config[option] = value\n\n        return config\n\n    @classmethod\n    def parse_command_line(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = {}\n\n        # For now we just pop recognized ah_bootstrap options out of the\n        # arg list.  This is imperfect; in the unlikely case that a setup.py\n        # custom command or even custom Distribution class defines an argument\n        # of the same name then we will break that.  However there's a catch22\n        # here that we can't just do full argument parsing right here, because\n        # we don't yet know *how* to parse all possible command-line arguments.\n        if '--no-git' in argv:\n            config['use_git'] = False\n            argv.remove('--no-git')\n\n        if '--offline' in argv:\n            config['offline'] = True\n            argv.remove('--offline')\n\n        return config\n\n    def run(self):\n        strategies = ['local_directory', 'local_file', 'index']\n        dist = None\n\n        # First, remove any previously imported versions of astropy_helpers;\n        # this is necessary for nested installs where one package's installer\n        # is installing another package via setuptools.sandbox.run_setup, as in\n        # the case of setup_requires\n        for key in list(sys.modules):\n            try:\n                if key == PACKAGE_NAME or key.startswith(PACKAGE_NAME + '.'):\n                    del sys.modules[key]\n            except AttributeError:\n                # Sometimes mysterious non-string things can turn up in\n                # sys.modules\n                continue\n\n        # Check to see if the path is a submodule\n        self.is_submodule = self._check_submodule()\n\n        for strategy in strategies:\n            method = getattr(self, 'get_{0}_dist'.format(strategy))\n            dist = method()\n            if dist is not None:\n                break\n        else:\n            raise _AHBootstrapSystemExit(\n                \"No source found for the {0!r} package; {0} must be \"\n                \"available and importable as a prerequisite to building \"\n                \"or installing this package.\".format(PACKAGE_NAME))\n\n        # This is a bit hacky, but if astropy_helpers was loaded from a\n        # directory/submodule its Distribution object gets a \"precedence\" of\n        # \"DEVELOP_DIST\".  However, in other cases it gets a precedence of\n        # \"EGG_DIST\".  However, when activing the distribution it will only be\n        # placed early on sys.path if it is treated as an EGG_DIST, so always\n        # do that\n        dist = dist.clone(precedence=pkg_resources.EGG_DIST)\n\n        # Otherwise we found a version of astropy-helpers, so we're done\n        # Just active the found distribution on sys.path--if we did a\n        # download this usually happens automatically but it doesn't hurt to\n        # do it again\n        # Note: Adding the dist to the global working set also activates it\n        # (makes it importable on sys.path) by default.\n\n        try:\n            pkg_resources.working_set.add(dist, replace=True)\n        except TypeError:\n            # Some (much) older versions of setuptools do not have the\n            # replace=True option here.  These versions are old enough that all\n            # bets may be off anyways, but it's easy enough to work around just\n            # in case...\n            if dist.key in pkg_resources.working_set.by_key:\n                del pkg_resources.working_set.by_key[dist.key]\n            pkg_resources.working_set.add(dist)\n\n    @property\n    def config(self):\n        \"\"\"\n        A `dict` containing the options this `_Bootstrapper` was configured\n        with.\n        \"\"\"\n\n        return dict((optname, getattr(self, optname))\n                    for optname, _ in CFG_OPTIONS if hasattr(self, optname))\n\n    def get_local_directory_dist(self):\n        \"\"\"\n        Handle importing a vendored package from a subdirectory of the source\n        distribution.\n        \"\"\"\n\n        if not os.path.isdir(self.path):\n            return\n\n        log.info('Attempting to import astropy_helpers from {0} {1!r}'.format(\n                 'submodule' if self.is_submodule else 'directory',\n                 self.path))\n\n        dist = self._directory_import()\n\n        if dist is None:\n            log.warn(\n                'The requested path {0!r} for importing {1} does not '\n                'exist, or does not contain a copy of the {1} '\n                'package.'.format(self.path, PACKAGE_NAME))\n        elif self.auto_upgrade and not self.is_submodule:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist\n\n    def get_local_file_dist(self):\n        \"\"\"\n        Handle importing from a source archive; this also uses setup_requires\n        but points easy_install directly to the source archive.\n        \"\"\"\n\n        if not os.path.isfile(self.path):\n            return\n\n        log.info('Attempting to unpack and import astropy_helpers from '\n                 '{0!r}'.format(self.path))\n\n        try:\n            dist = self._do_download(find_links=[self.path])\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.warn(\n                'Failed to import {0} from the specified archive {1!r}: '\n                '{2}'.format(PACKAGE_NAME, self.path, str(e)))\n            dist = None\n\n        if dist is not None and self.auto_upgrade:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist\n\n    def get_index_dist(self):\n        if not self.download:\n            log.warn('Downloading {0!r} disabled.'.format(DIST_NAME))\n            return None\n\n        log.warn(\n            \"Downloading {0!r}; run setup.py with the --offline option to \"\n            \"force offline installation.\".format(DIST_NAME))\n\n        try:\n            dist = self._do_download()\n        except Exception as e:\n            if DEBUG:\n                raise\n            log.warn(\n                'Failed to download and/or install {0!r} from {1!r}:\\n'\n                '{2}'.format(DIST_NAME, self.index_url, str(e)))\n            dist = None\n\n        # No need to run auto-upgrade here since we've already presumably\n        # gotten the most up-to-date version from the package index\n        return dist\n\n    def _directory_import(self):\n        \"\"\"\n        Import astropy_helpers from the given path, which will be added to\n        sys.path.\n\n        Must return True if the import succeeded, and False otherwise.\n        \"\"\"\n\n        # Return True on success, False on failure but download is allowed, and\n        # otherwise raise SystemExit\n        path = os.path.abspath(self.path)\n\n        # Use an empty WorkingSet rather than the man\n        # pkg_resources.working_set, since on older versions of setuptools this\n        # will invoke a VersionConflict when trying to install an upgrade\n        ws = pkg_resources.WorkingSet([])\n        ws.add_entry(path)\n        dist = ws.by_key.get(DIST_NAME)\n\n        if dist is None:\n            # We didn't find an egg-info/dist-info in the given path, but if a\n            # setup.py exists we can generate it\n            setup_py = os.path.join(path, 'setup.py')\n            if os.path.isfile(setup_py):\n                with _silence():\n                    run_setup(os.path.join(path, 'setup.py'),\n                              ['egg_info'])\n\n                for dist in pkg_resources.find_distributions(path, True):\n                    # There should be only one...\n                    return dist\n\n        return dist\n\n    def _do_download(self, version='', find_links=None):\n        if find_links:\n            allow_hosts = ''\n            index_url = None\n        else:\n            allow_hosts = None\n            index_url = self.index_url\n\n        # Annoyingly, setuptools will not handle other arguments to\n        # Distribution (such as options) before handling setup_requires, so it\n        # is not straightforward to programmatically augment the arguments which\n        # are passed to easy_install\n        class _Distribution(Distribution):\n            def get_option_dict(self, command_name):\n                opts = Distribution.get_option_dict(self, command_name)\n                if command_name == 'easy_install':\n                    if find_links is not None:\n                        opts['find_links'] = ('setup script', find_links)\n                    if index_url is not None:\n                        opts['index_url'] = ('setup script', index_url)\n                    if allow_hosts is not None:\n                        opts['allow_hosts'] = ('setup script', allow_hosts)\n                return opts\n\n        if version:\n            req = '{0}=={1}'.format(DIST_NAME, version)\n        else:\n            req = DIST_NAME\n\n        attrs = {'setup_requires': [req]}\n\n        try:\n            if DEBUG:\n                _Distribution(attrs=attrs)\n            else:\n                with _silence():\n                    _Distribution(attrs=attrs)\n\n            # If the setup_requires succeeded it will have added the new dist to\n            # the main working_set\n            return pkg_resources.working_set.by_key.get(DIST_NAME)\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            msg = 'Error retrieving {0} from {1}:\\n{2}'\n            if find_links:\n                source = find_links[0]\n            elif index_url != INDEX_URL:\n                source = index_url\n            else:\n                source = 'PyPI'\n\n            raise Exception(msg.format(DIST_NAME, source, repr(e)))\n\n    def _do_upgrade(self, dist):\n        # Build up a requirement for a higher bugfix release but a lower minor\n        # release (so API compatibility is guaranteed)\n        next_version = _next_version(dist.parsed_version)\n\n        req = pkg_resources.Requirement.parse(\n            '{0}>{1},<{2}'.format(DIST_NAME, dist.version, next_version))\n\n        package_index = PackageIndex(index_url=self.index_url)\n\n        upgrade = package_index.obtain(req)\n\n        if upgrade is not None:\n            return self._do_download(version=upgrade.version)\n\n    def _check_submodule(self):\n        \"\"\"\n        Check if the given path is a git submodule.\n\n        See the docstrings for ``_check_submodule_using_git`` and\n        ``_check_submodule_no_git`` for further details.\n        \"\"\"\n\n        if (self.path is None or\n                (os.path.exists(self.path) and not os.path.isdir(self.path))):\n            return False\n\n        if self.use_git:\n            return self._check_submodule_using_git()\n        else:\n            return self._check_submodule_no_git()\n\n    def _check_submodule_using_git(self):\n        \"\"\"\n        Check if the given path is a git submodule.  If so, attempt to initialize\n        and/or update the submodule if needed.\n\n        This function makes calls to the ``git`` command in subprocesses.  The\n        ``_check_submodule_no_git`` option uses pure Python to check if the given\n        path looks like a git submodule, but it cannot perform updates.\n        \"\"\"\n\n        cmd = ['git', 'submodule', 'status', '--', self.path]\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except _CommandNotFound:\n            # The git command simply wasn't found; this is most likely the\n            # case on user systems that don't have git and are simply\n            # trying to install the package from PyPI or a source\n            # distribution.  Silently ignore this case and simply don't try\n            # to use submodules\n            return False\n\n        stderr = stderr.strip()\n\n        if returncode != 0 and stderr:\n            # Unfortunately the return code alone cannot be relied on, as\n            # earlier versions of git returned 0 even if the requested submodule\n            # does not exist\n\n            # This is a warning that occurs in perl (from running git submodule)\n            # which only occurs with a malformatted locale setting which can\n            # happen sometimes on OSX.  See again\n            # https://github.com/astropy/astropy/issues/2749\n            perl_warning = ('perl: warning: Falling back to the standard locale '\n                            '(\"C\").')\n            if not stderr.strip().endswith(perl_warning):\n                # Some other unknown error condition occurred\n                log.warn('git submodule command failed '\n                         'unexpectedly:\\n{0}'.format(stderr))\n                return False\n\n        # Output of `git submodule status` is as follows:\n        #\n        # 1: Status indicator: '-' for submodule is uninitialized, '+' if\n        # submodule is initialized but is not at the commit currently indicated\n        # in .gitmodules (and thus needs to be updated), or 'U' if the\n        # submodule is in an unstable state (i.e. has merge conflicts)\n        #\n        # 2. SHA-1 hash of the current commit of the submodule (we don't really\n        # need this information but it's useful for checking that the output is\n        # correct)\n        #\n        # 3. The output of `git describe` for the submodule's current commit\n        # hash (this includes for example what branches the commit is on) but\n        # only if the submodule is initialized.  We ignore this information for\n        # now\n        _git_submodule_status_re = re.compile(\n            '^(?P<status>[+-U ])(?P<commit>[0-9a-f]{40}) '\n            '(?P<submodule>\\S+)( .*)?$')\n\n        # The stdout should only contain one line--the status of the\n        # requested submodule\n        m = _git_submodule_status_re.match(stdout)\n        if m:\n            # Yes, the path *is* a git submodule\n            self._update_submodule(m.group('submodule'), m.group('status'))\n            return True\n        else:\n            log.warn(\n                'Unexpected output from `git submodule status`:\\n{0}\\n'\n                'Will attempt import from {1!r} regardless.'.format(\n                    stdout, self.path))\n            return False\n\n    def _check_submodule_no_git(self):\n        \"\"\"\n        Like ``_check_submodule_using_git``, but simply parses the .gitmodules file\n        to determine if the supplied path is a git submodule, and does not exec any\n        subprocesses.\n\n        This can only determine if a path is a submodule--it does not perform\n        updates, etc.  This function may need to be updated if the format of the\n        .gitmodules file is changed between git versions.\n        \"\"\"\n\n        gitmodules_path = os.path.abspath('.gitmodules')\n\n        if not os.path.isfile(gitmodules_path):\n            return False\n\n        # This is a minimal reader for gitconfig-style files.  It handles a few of\n        # the quirks that make gitconfig files incompatible with ConfigParser-style\n        # files, but does not support the full gitconfig syntax (just enough\n        # needed to read a .gitmodules file).\n        gitmodules_fileobj = io.StringIO()\n\n        # Must use io.open for cross-Python-compatible behavior wrt unicode\n        with io.open(gitmodules_path) as f:\n            for line in f:\n                # gitconfig files are more flexible with leading whitespace; just\n                # go ahead and remove it\n                line = line.lstrip()\n\n                # comments can start with either # or ;\n                if line and line[0] in (':', ';'):\n                    continue\n\n                gitmodules_fileobj.write(line)\n\n        gitmodules_fileobj.seek(0)\n\n        cfg = RawConfigParser()\n\n        try:\n            cfg.readfp(gitmodules_fileobj)\n        except Exception as exc:\n            log.warn('Malformatted .gitmodules file: {0}\\n'\n                     '{1} cannot be assumed to be a git submodule.'.format(\n                         exc, self.path))\n            return False\n\n        for section in cfg.sections():\n            if not cfg.has_option(section, 'path'):\n                continue\n\n            submodule_path = cfg.get(section, 'path').rstrip(os.sep)\n\n            if submodule_path == self.path.rstrip(os.sep):\n                return True\n\n        return False\n\n    def _update_submodule(self, submodule, status):\n        if status == ' ':\n            # The submodule is up to date; no action necessary\n            return\n        elif status == '-':\n            if self.offline:\n                raise _AHBootstrapSystemExit(\n                    \"Cannot initialize the {0} submodule in --offline mode; \"\n                    \"this requires being able to clone the submodule from an \"\n                    \"online repository.\".format(submodule))\n            cmd = ['update', '--init']\n            action = 'Initializing'\n        elif status == '+':\n            cmd = ['update']\n            action = 'Updating'\n            if self.offline:\n                cmd.append('--no-fetch')\n        elif status == 'U':\n            raise _AHBootstrapSystemExit(\n                'Error: Submodule {0} contains unresolved merge conflicts.  '\n                'Please complete or abandon any changes in the submodule so that '\n                'it is in a usable state, then try again.'.format(submodule))\n        else:\n            log.warn('Unknown status {0!r} for git submodule {1!r}.  Will '\n                     'attempt to use the submodule as-is, but try to ensure '\n                     'that the submodule is in a clean state and contains no '\n                     'conflicts or errors.\\n{2}'.format(status, submodule,\n                                                        _err_help_msg))\n            return\n\n        err_msg = None\n        cmd = ['git', 'submodule'] + cmd + ['--', submodule]\n        log.warn('{0} {1} submodule with: `{2}`'.format(\n            action, submodule, ' '.join(cmd)))\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except OSError as e:\n            err_msg = str(e)\n        else:\n            if returncode != 0:\n                err_msg = stderr\n\n        if err_msg is not None:\n            log.warn('An unexpected error occurred updating the git submodule '\n                     '{0!r}:\\n{1}\\n{2}'.format(submodule, err_msg,\n                                               _err_help_msg))\n\nclass _CommandNotFound(OSError):\n    \"\"\"\n    An exception raised when a command run with run_cmd is not found on the\n    system.\n    \"\"\"\n\n\ndef run_cmd(cmd):\n    \"\"\"\n    Run a command in a subprocess, given as a list of command-line\n    arguments.\n\n    Returns a ``(returncode, stdout, stderr)`` tuple.\n    \"\"\"\n\n    try:\n        p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)\n        # XXX: May block if either stdout or stderr fill their buffers;\n        # however for the commands this is currently used for that is\n        # unlikely (they should have very brief output)\n        stdout, stderr = p.communicate()\n    except OSError as e:\n        if DEBUG:\n            raise\n\n        if e.errno == errno.ENOENT:\n            msg = 'Command not found: `{0}`'.format(' '.join(cmd))\n            raise _CommandNotFound(msg, cmd)\n        else:\n            raise _AHBootstrapSystemExit(\n                'An unexpected error occurred when running the '\n                '`{0}` command:\\n{1}'.format(' '.join(cmd), str(e)))\n\n\n    # Can fail of the default locale is not configured properly.  See\n    # https://github.com/astropy/astropy/issues/2749.  For the purposes under\n    # consideration 'latin1' is an acceptable fallback.\n    try:\n        stdio_encoding = locale.getdefaultlocale()[1] or 'latin1'\n    except ValueError:\n        # Due to an OSX oddity locale.getdefaultlocale() can also crash\n        # depending on the user's locale/language settings.  See:\n        # http://bugs.python.org/issue18378\n        stdio_encoding = 'latin1'\n\n    # Unlikely to fail at this point but even then let's be flexible\n    if not isinstance(stdout, _text_type):\n        stdout = stdout.decode(stdio_encoding, 'replace')\n    if not isinstance(stderr, _text_type):\n        stderr = stderr.decode(stdio_encoding, 'replace')\n\n    return (p.returncode, stdout, stderr)\n\n\ndef _next_version(version):\n    \"\"\"\n    Given a parsed version from pkg_resources.parse_version, returns a new\n    version string with the next minor version.\n\n    Examples\n    ========\n    >>> _next_version(pkg_resources.parse_version('1.2.3'))\n    '1.3.0'\n    \"\"\"\n\n    if hasattr(version, 'base_version'):\n        # New version parsing from setuptools >= 8.0\n        if version.base_version:\n            parts = version.base_version.split('.')\n        else:\n            parts = []\n    else:\n        parts = []\n        for part in version:\n            if part.startswith('*'):\n                break\n            parts.append(part)\n\n    parts = [int(p) for p in parts]\n\n    if len(parts) < 3:\n        parts += [0] * (3 - len(parts))\n\n    major, minor, micro = parts[:3]\n\n    return '{0}.{1}.{2}'.format(major, minor + 1, 0)\n\n\nclass _DummyFile(object):\n    \"\"\"A noop writeable object.\"\"\"\n\n    errors = ''  # Required for Python 3.x\n    encoding = 'utf-8'\n\n    def write(self, s):\n        pass\n\n    def flush(self):\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    exception_occurred = False\n    try:\n        yield\n    except:\n        exception_occurred = True\n        # Go ahead and clean up so that exception handling can work normally\n        sys.stdout = old_stdout\n        sys.stderr = old_stderr\n        raise\n\n    if not exception_occurred:\n        sys.stdout = old_stdout\n        sys.stderr = old_stderr\n\n\n_err_help_msg = \"\"\"\nIf the problem persists consider installing astropy_helpers manually using pip\n(`pip install astropy_helpers`) or by manually downloading the source archive,\nextracting it, and installing by running `python setup.py install` from the\nroot of the extracted source code.\n\"\"\"\n\n\nclass _AHBootstrapSystemExit(SystemExit):\n    def __init__(self, *args):\n        if not args:\n            msg = 'An unknown problem occurred bootstrapping astropy_helpers.'\n        else:\n            msg = args[0]\n\n        msg += '\\n' + _err_help_msg\n\n        super(_AHBootstrapSystemExit, self).__init__(msg, *args[1:])\n\n\nBOOTSTRAPPER = _Bootstrapper.main()\n\n\ndef use_astropy_helpers(**kwargs):\n    \"\"\"\n    Ensure that the `astropy_helpers` module is available and is importable.\n    This supports automatic submodule initialization if astropy_helpers is\n    included in a project as a git submodule, or will download it from PyPI if\n    necessary.\n\n    Parameters\n    ----------\n\n    path : str or None, optional\n        A filesystem path relative to the root of the project's source code\n        that should be added to `sys.path` so that `astropy_helpers` can be\n        imported from that path.\n\n        If the path is a git submodule it will automatically be initialized\n        and/or updated.\n\n        The path may also be to a ``.tar.gz`` archive of the astropy_helpers\n        source distribution.  In this case the archive is automatically\n        unpacked and made temporarily available on `sys.path` as a ``.egg``\n        archive.\n\n        If `None` skip straight to downloading.\n\n    download_if_needed : bool, optional\n        If the provided filesystem path is not found an attempt will be made to\n        download astropy_helpers from PyPI.  It will then be made temporarily\n        available on `sys.path` as a ``.egg`` archive (using the\n        ``setup_requires`` feature of setuptools.  If the ``--offline`` option\n        is given at the command line the value of this argument is overridden\n        to `False`.\n\n    index_url : str, optional\n        If provided, use a different URL for the Python package index than the\n        main PyPI server.\n\n    use_git : bool, optional\n        If `False` no git commands will be used--this effectively disables\n        support for git submodules. If the ``--no-git`` option is given at the\n        command line the value of this argument is overridden to `False`.\n\n    auto_upgrade : bool, optional\n        By default, when installing a package from a non-development source\n        distribution ah_boostrap will try to automatically check for patch\n        releases to astropy-helpers on PyPI and use the patched version over\n        any bundled versions.  Setting this to `False` will disable that\n        functionality. If the ``--offline`` option is given at the command line\n        the value of this argument is overridden to `False`.\n\n    offline : bool, optional\n        If `False` disable all actions that require an internet connection,\n        including downloading packages from the package index and fetching\n        updates to any git submodule.  Defaults to `True`.\n    \"\"\"\n\n    global BOOTSTRAPPER\n\n    config = BOOTSTRAPPER.config\n    config.update(**kwargs)\n\n    # Create a new bootstrapper with the updated configuration and run it\n    BOOTSTRAPPER = _Bootstrapper(**config)\n    BOOTSTRAPPER.run()\n"},{"id":10,"name":"circle.yml","nodeType":"TextFile","path":"","text":"machine:\n  services:\n    - docker\n\ndependencies:\n  override:\n    - docker pull astropy/astropy-py35-32bit-test-env:1.10\n\ntest:\n  override:\n    - ./.run_docker_tests.sh\n"},{"id":11,"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 and provide a minimal\ncode example that reproduces the issue, and also include details of the\noperating system, and the Python, Numpy, and Astropy versions you are using.\n\nContributing code\n-----------------\n\nSo you're interested in contributing code to Astropy? Excellent!\n\nMost contributions to Astropy are done via pull requests from GitHub users'\nforks of the [astropy repository](https://github.com/astropy/astropy). If you're new to this style of development,\nyou'll want to read over our [development workflow](http://docs.astropy.org/en/latest/development/workflow/development_workflow.html).\n\nOnce you open a pull request (which should be opened against the ``master``\nbranch, not against any of the other branches), please make sure that you\ninclude the following:\n\n- **Code**: the code you are adding, which should follow as much as possible\n  our [coding guidelines](http://docs.astropy.org/en/latest/development/codeguide.html).\n\n- **Tests**: these are usually tests to ensure that 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 doesn't break in future, and also\n  returns consistent results on all platforms (since we run these tests on many\n  platforms/configurations). For more information about how to write tests, see\n  our [testing guidelines](http://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](http://docs.astropy.org/en/latest/development/docguide.html)\n  to help you out.\n\n- **Changelog entry**: whether you are fixing a bug or adding new\n  functionality, you should add an entry to the ``CHANGES.rst`` file that\n  includes the PR number and if possible the issue number (if you are\n  opening a pull request you may not know this yet, but you can add it once\n  the pull request is open). If you're not sure where to put the changelog\n  entry, wait at least until a maintainer has reviewed your PR and assigned\n  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.\n  In general you do not need to include a changelog entry for minor\n  documentation or test updates.  Only user-visible changes (new features/API\n  changes, fixed issues) need to be mentioned.  If in doubt ask the core\n  maintainer reviewing your changes.\n\nOther Tips\n----------\n\n- To prevent the automated tests from running you can add ``[ci\n  skip]`` to your commit message. This is useful if your PR is a work\n  in progress and you are not yet ready for the tests to run.  For\n  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- To skip only the AppVeyor (Windows) CI builds you can use ``[skip\n  appveyor]``, and to skip testing on Travis CI use ``[skip travis]``.\n\n- If your commit makes substantial changes to the documentation, but no code\n  changes, the you can use ``[docs only]``, that will skip all but the\n  documentation building jobs on Travis.\n\n- When contributing trivial documentation fixes (i.e. fixes to typos,\n  spelling, grammar) that do not contain any special markup and are\n  not associated with code changes, please include the string ``[docs\n  only]`` in your commit message.\n\n      $ git commit -m \"Fixed typo [docs only]\"\n\n\nChecklist for Contributed Code\n------------------------------\n\nA pull request for a new feature will be reviewed to see if it meets the\nfollowing requirements.  For any pull request, an astropy maintainer can\nhelp to make sure that the pull request meets the requirements for inclusion\nin the package.\n\n**Scientific Quality**\n(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](http://docs.astropy.org/en/latest/development/codeguide.html)\n    followed?\n  * Is the code compatible with Python >=3.5?\n  * Are there dependencies other than the Astropy core, the Python Standard\n    Library, and NumPy 1.10.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](http://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 marked](http://docs.astropy.org/en/latest/development/testguide.html#tests-requiring-optional-dependencies) as such?\n  * Does python setup.py test run without failures?\n\n**Documentation**\n  * Are the [documentation guidelines](http://docs.astropy.org/en/latest/development/docguide.html) followed?\n  * Is there a [docstring](http://docs.astropy.org/en/latest/development/docrules.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 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 Travis CI, AppVeyor, and CircleCI tests pass?\n  * If applicable, has an entry been added into the changelog?\n  * Can you checkout the pull request and repeat the examples and tests?\n"},{"fileName":"ez_setup.py","filePath":"","id":12,"nodeType":"File","text":"#!/usr/bin/env python\n\n\"\"\"\nSetuptools bootstrapping installer.\n\nMaintained at https://github.com/pypa/setuptools/tree/bootstrap.\n\nRun this script to install or upgrade setuptools.\n\nThis method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.\n\"\"\"\n\nimport os\nimport shutil\nimport sys\nimport tempfile\nimport zipfile\nimport optparse\nimport subprocess\nimport platform\nimport textwrap\nimport contextlib\n\nfrom distutils import log\n\ntry:\n    from urllib.request import urlopen\nexcept ImportError:\n    from urllib2 import urlopen\n\ntry:\n    from site import USER_SITE\nexcept ImportError:\n    USER_SITE = None\n\n# 33.1.1 is the last version that supports setuptools self upgrade/installation.\nDEFAULT_VERSION = \"33.1.1\"\nDEFAULT_URL = \"https://pypi.io/packages/source/s/setuptools/\"\nDEFAULT_SAVE_DIR = os.curdir\nDEFAULT_DEPRECATION_MESSAGE = \"ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools\"\n\nMEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'\n\nlog.warn(DEFAULT_DEPRECATION_MESSAGE.format(DEFAULT_VERSION))\n\n\ndef _python_cmd(*args):\n    \"\"\"\n    Execute a command.\n\n    Return True if the command succeeded.\n    \"\"\"\n    args = (sys.executable,) + args\n    return subprocess.call(args) == 0\n\n\ndef _install(archive_filename, install_args=()):\n    \"\"\"Install Setuptools.\"\"\"\n    with archive_context(archive_filename):\n        # installing\n        log.warn('Installing Setuptools')\n        if not _python_cmd('setup.py', 'install', *install_args):\n            log.warn('Something went wrong during the installation.')\n            log.warn('See the error message above.')\n            # exitcode will be 2\n            return 2\n\n\ndef _build_egg(egg, archive_filename, to_dir):\n    \"\"\"Build Setuptools egg.\"\"\"\n    with archive_context(archive_filename):\n        # building an egg\n        log.warn('Building a Setuptools egg in %s', to_dir)\n        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)\n    # returning the result\n    log.warn(egg)\n    if not os.path.exists(egg):\n        raise IOError('Could not build the egg.')\n\n\nclass ContextualZipFile(zipfile.ZipFile):\n\n    \"\"\"Supplement ZipFile class to support context manager for Python 2.6.\"\"\"\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def __new__(cls, *args, **kwargs):\n        \"\"\"Construct a ZipFile or ContextualZipFile as appropriate.\"\"\"\n        if hasattr(zipfile.ZipFile, '__exit__'):\n            return zipfile.ZipFile(*args, **kwargs)\n        return super(ContextualZipFile, cls).__new__(cls)\n\n\n@contextlib.contextmanager\ndef archive_context(filename):\n    \"\"\"\n    Unzip filename to a temporary directory, set to the cwd.\n\n    The unzipped target is cleaned up after.\n    \"\"\"\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        try:\n            with ContextualZipFile(filename) as archive:\n                archive.extractall()\n        except zipfile.BadZipfile as err:\n            if not err.args:\n                err.args = ('', )\n            err.args = err.args + (\n                MEANINGFUL_INVALID_ZIP_ERR_MSG.format(filename),\n            )\n            raise\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n        yield\n\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)\n\n\ndef _do_download(version, download_base, to_dir, download_delay):\n    \"\"\"Download Setuptools.\"\"\"\n    py_desig = 'py{sys.version_info[0]}.{sys.version_info[1]}'.format(sys=sys)\n    tp = 'setuptools-{version}-{py_desig}.egg'\n    egg = os.path.join(to_dir, tp.format(**locals()))\n    if not os.path.exists(egg):\n        archive = download_setuptools(version, download_base,\n            to_dir, download_delay)\n        _build_egg(egg, archive, to_dir)\n    sys.path.insert(0, egg)\n\n    # Remove previously-imported pkg_resources if present (see\n    # https://bitbucket.org/pypa/setuptools/pull-request/7/ for details).\n    if 'pkg_resources' in sys.modules:\n        _unload_pkg_resources()\n\n    import setuptools\n    setuptools.bootstrap_install_from = egg\n\n\ndef use_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, download_delay=15):\n    \"\"\"\n    Ensure that a setuptools version is installed.\n\n    Return None. Raise SystemExit if the requested version\n    or later cannot be installed.\n    \"\"\"\n    to_dir = os.path.abspath(to_dir)\n\n    # prior to importing, capture the module state for\n    # representative modules.\n    rep_modules = 'pkg_resources', 'setuptools'\n    imported = set(sys.modules).intersection(rep_modules)\n\n    try:\n        import pkg_resources\n        pkg_resources.require(\"setuptools>=\" + version)\n        # a suitable version is already installed\n        return\n    except ImportError:\n        # pkg_resources not available; setuptools is not installed; download\n        pass\n    except pkg_resources.DistributionNotFound:\n        # no version of setuptools was found; allow download\n        pass\n    except pkg_resources.VersionConflict as VC_err:\n        if imported:\n            _conflict_bail(VC_err, version)\n\n        # otherwise, unload pkg_resources to allow the downloaded version to\n        #  take precedence.\n        del pkg_resources\n        _unload_pkg_resources()\n\n    return _do_download(version, download_base, to_dir, download_delay)\n\n\ndef _conflict_bail(VC_err, version):\n    \"\"\"\n    Setuptools was imported prior to invocation, so it is\n    unsafe to unload it. Bail out.\n    \"\"\"\n    conflict_tmpl = textwrap.dedent(\"\"\"\n        The required version of setuptools (>={version}) is not available,\n        and can't be installed while this script is running. Please\n        install a more recent version first, using\n        'easy_install -U setuptools'.\n\n        (Currently using {VC_err.args[0]!r})\n        \"\"\")\n    msg = conflict_tmpl.format(**locals())\n    sys.stderr.write(msg)\n    sys.exit(2)\n\n\ndef _unload_pkg_resources():\n    sys.meta_path = [\n        importer\n        for importer in sys.meta_path\n        if importer.__class__.__module__ != 'pkg_resources.extern'\n    ]\n    del_modules = [\n        name for name in sys.modules\n        if name.startswith('pkg_resources')\n    ]\n    for mod_name in del_modules:\n        del sys.modules[mod_name]\n\n\ndef _clean_check(cmd, target):\n    \"\"\"\n    Run the command to download target.\n\n    If the command fails, clean up before re-raising the error.\n    \"\"\"\n    try:\n        subprocess.check_call(cmd)\n    except subprocess.CalledProcessError:\n        if os.access(target, os.F_OK):\n            os.unlink(target)\n        raise\n\n\ndef download_file_powershell(url, target):\n    \"\"\"\n    Download the file at url to target using Powershell.\n\n    Powershell will validate trust.\n    Raise an exception if the command cannot complete.\n    \"\"\"\n    target = os.path.abspath(target)\n    ps_cmd = (\n        \"[System.Net.WebRequest]::DefaultWebProxy.Credentials = \"\n        \"[System.Net.CredentialCache]::DefaultCredentials; \"\n        '(new-object System.Net.WebClient).DownloadFile(\"%(url)s\", \"%(target)s\")'\n        % locals()\n    )\n    cmd = [\n        'powershell',\n        '-Command',\n        ps_cmd,\n    ]\n    _clean_check(cmd, target)\n\n\ndef has_powershell():\n    \"\"\"Determine if Powershell is available.\"\"\"\n    if platform.system() != 'Windows':\n        return False\n    cmd = ['powershell', '-Command', 'echo test']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True\ndownload_file_powershell.viable = has_powershell\n\n\ndef download_file_curl(url, target):\n    cmd = ['curl', url, '--location', '--silent', '--output', target]\n    _clean_check(cmd, target)\n\n\ndef has_curl():\n    cmd = ['curl', '--version']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True\ndownload_file_curl.viable = has_curl\n\n\ndef download_file_wget(url, target):\n    cmd = ['wget', url, '--quiet', '--output-document', target]\n    _clean_check(cmd, target)\n\n\ndef has_wget():\n    cmd = ['wget', '--version']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True\ndownload_file_wget.viable = has_wget\n\n\ndef download_file_insecure(url, target):\n    \"\"\"Use Python to download the file, without connection authentication.\"\"\"\n    src = urlopen(url)\n    try:\n        # Read all the data in one block.\n        data = src.read()\n    finally:\n        src.close()\n\n    # Write all the data in one block to avoid creating a partial file.\n    with open(target, \"wb\") as dst:\n        dst.write(data)\ndownload_file_insecure.viable = lambda: True\n\n\ndef get_best_downloader():\n    downloaders = (\n        download_file_powershell,\n        download_file_curl,\n        download_file_wget,\n        download_file_insecure,\n    )\n    viable_downloaders = (dl for dl in downloaders if dl.viable())\n    return next(viable_downloaders, None)\n\n\ndef download_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, delay=15,\n        downloader_factory=get_best_downloader):\n    \"\"\"\n    Download setuptools from a specified location and return its filename.\n\n    `version` should be a valid setuptools version number that is available\n    as an sdist for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n\n    ``downloader_factory`` should be a function taking no arguments and\n    returning a function for downloading a URL to a target.\n    \"\"\"\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    zip_name = \"setuptools-%s.zip\" % version\n    url = download_base + zip_name\n    saveto = os.path.join(to_dir, zip_name)\n    if not os.path.exists(saveto):  # Avoid repeated downloads\n        log.warn(\"Downloading %s\", url)\n        downloader = downloader_factory()\n        downloader(url, saveto)\n    return os.path.realpath(saveto)\n\n\ndef _build_install_args(options):\n    \"\"\"\n    Build the arguments to 'python setup.py install' on the setuptools package.\n\n    Returns list of command line arguments.\n    \"\"\"\n    return ['--user'] if options.user_install else []\n\n\ndef _parse_args():\n    \"\"\"Parse the command line for options.\"\"\"\n    parser = optparse.OptionParser()\n    parser.add_option(\n        '--user', dest='user_install', action='store_true', default=False,\n        help='install in user site package')\n    parser.add_option(\n        '--download-base', dest='download_base', metavar=\"URL\",\n        default=DEFAULT_URL,\n        help='alternative URL from where to download the setuptools package')\n    parser.add_option(\n        '--insecure', dest='downloader_factory', action='store_const',\n        const=lambda: download_file_insecure, default=get_best_downloader,\n        help='Use internal, non-validating downloader'\n    )\n    parser.add_option(\n        '--version', help=\"Specify which version to download\",\n        default=DEFAULT_VERSION,\n    )\n    parser.add_option(\n        '--to-dir',\n        help=\"Directory to save (and re-use) package\",\n        default=DEFAULT_SAVE_DIR,\n    )\n    options, args = parser.parse_args()\n    # positional arguments are ignored\n    return options\n\n\ndef _download_args(options):\n    \"\"\"Return args for download_setuptools function from cmdline args.\"\"\"\n    return dict(\n        version=options.version,\n        download_base=options.download_base,\n        downloader_factory=options.downloader_factory,\n        to_dir=options.to_dir,\n    )\n\n\ndef main():\n    \"\"\"Install or upgrade setuptools and EasyInstall.\"\"\"\n    options = _parse_args()\n    archive = download_setuptools(**_download_args(options))\n    return _install(archive, _build_install_args(options))\n\nif __name__ == '__main__':\n    sys.exit(main())\n"},{"id":13,"name":"LICENSE.rst","nodeType":"TextFile","path":"","text":"Copyright (c) 2011-2017, 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":14,"name":"MANIFEST.in","nodeType":"TextFile","path":"","text":"include .astropy-root\ninclude LICENSE.rst\ninclude README.rst\ninclude CHANGES.rst\ninclude pip-requirements*\n\ninclude ez_setup.py\ninclude ah_bootstrap.py\ninclude setup.cfg\ninclude astropy/tests/coveragerc\nrecursive-include astropy *.pyx *.c *.h *.map *.templ\n\ninclude astropy/astropy.cfg\n\n# We have to explicitly include the following modules, otherwise only the\n# Python 2 versions are included when making a source distribution in Python\n# 2, and similarly for Python 3:\ninclude astropy/extern/configobj/*.py\nrecursive-include astropy/utils/compat *.py\n\ninclude astropy/utils/misc/data/.hidden_file.txt\n\nrecursive-include docs *\nrecursive-include examples *\nrecursive-include licenses *\nrecursive-include cextern *\nrecursive-include scripts *\nrecursive-include static *\nrecursive-include astropy/sphinx/themes *\n\nprune docs/_build\nprune build\n\n\n# the next few stanzas are for astropy_helpers.  It's derived from the\n# astropy_helpers/MANIFEST.in, but requires additional includes for the actual\n# package directory and egg-info.\n\ninclude astropy_helpers/README.rst\ninclude astropy_helpers/CHANGES.rst\ninclude astropy_helpers/LICENSE.rst\nrecursive-include astropy_helpers/licenses *\n\ninclude astropy_helpers/ez_setup.py\ninclude astropy_helpers/ah_bootstrap.py\n\nrecursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h *.rst\nrecursive-include astropy_helpers/astropy_helpers.egg-info *\n# include the sphinx stuff with \"*\" because there are css/html/rst/etc.\nrecursive-include astropy_helpers/astropy_helpers/sphinx *\n\nprune astropy_helpers/build\nprune astropy_helpers/astropy_helpers/tests\n\n\nglobal-exclude *.pyc *.o\n"},{"id":15,"name":"pip-requirements-doc","nodeType":"TextFile","path":"","text":"-r pip-requirements\nmatplotlib\nscipy\npillow\nsphinx-gallery\njplephem"},{"id":16,"name":"pip-requirements","nodeType":"TextFile","path":"","text":"numpy>=1.10.0\npytest>=3.1\n"},{"id":17,"name":"pip-requirements-dev","nodeType":"TextFile","path":"","text":"-r pip-requirements\n-r pip-requirements-doc\nCython>=0.21\njinja2>=2.7\npyyaml\nscipy\npandas\nh5py\nbeautifulsoup4\nbintrees\nbleach\njplephem\nscikit-image\nmatplotlib\n\n# below here are used only for tests\npytest-astropy\ncoverage\nskyfield\nmpmath\npytest-xdist\npytest-mpl\n"},{"col":0,"comment":"","endLoc":6,"header":"conftest.py#<anonymous>","id":18,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"pytest_plugins = [\n    'astropy.tests.plugins.config',\n    'astropy.tests.plugins.display',\n]"},{"id":19,"name":"README.rst","nodeType":"TextFile","path":"","text":"=======\nAstropy\n=======\n\n.. image:: https://img.shields.io/pypi/v/astropy.svg\n    :target: https://pypi.python.org/pypi/astropy\n\nAstropy (http://www.astropy.org) is a package intended to contain much of\nthe core functionality and some common tools needed for performing\nastronomy and astrophysics with Python.\n\nReleases are `registered on PyPI <http://pypi.python.org/pypi/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 <http://docs.astropy.org/>`_\nor  ``docs/install.rst`` in this source distribution.\n\nFor system packagers: Please install Astropy with the command::\n\n    $ python setup.py --offline install\n\nThis will prevent the astropy_helpers bootstrap script from attempting to\nreach out to PyPI.\n\nProject Status\n--------------\n\n.. image:: https://travis-ci.org/astropy/astropy.svg\n    :target: https://travis-ci.org/astropy/astropy\n    :alt: Astropy's Travis CI Status\n\n.. image:: https://coveralls.io/repos/astropy/astropy/badge.svg\n    :target: https://coveralls.io/r/astropy/astropy\n    :alt: Astropy's Coveralls Status\n\n.. image:: https://ci.appveyor.com/api/projects/status/ym7lxajcs5qwm31e/branch/master?svg=true\n    :target: https://ci.appveyor.com/project/Astropy/astropy/branch/master\n    :alt: Astropy's Appveyor Status\n\nFor an overview of the testing and build status of all packages associated\nwith the Astropy Project, see http://dashboard.astropy.org.\n\n.. 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\nContributing Code, Documentation, or Feedback\n---------------------------------------------\nThe Astropy project is made both by and for its users, so we welcome and encourage\ncontributions of many kinds. Our goal is to keep this a positive, inclusive,\nsuccessful, 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>`_ page.\n\nA `summary of contribution guidelines <CONTRIBUTING.md>`_ can also be used as a quick\nreference when you're ready to start writing or validating code for submission.\n\nLicense\n-------\nAstropy is licensed under a 3-clause BSD style license - see the\n``LICENSE.rst`` file.\n"},{"id":20,"name":"readthedocs.yml","nodeType":"TextFile","path":"","text":"conda:\n  file: .rtd-environment.yml\n\npython:\n  setup_py_install: true\n\nformats:\n  - none\n"},{"id":21,"name":"setup.cfg","nodeType":"TextFile","path":"","text":"[build_sphinx]\nsource-dir = docs\nbuild-dir = docs/_build\nall_files = 1\n\n[build_docs]\nsource-dir = docs\nbuild-dir = docs/_build\nall_files = 1\n\n[upload_docs]\nupload-dir = docs/_build/html\nshow-response = 1\n\n[tool:pytest]\nminversion = 3.1\ntestpaths = \"astropy\" \"docs\"\nnorecursedirs = \"docs[\\/]_build\" \"docs[\\/]generated\" \"astropy[\\/]extern\" \"astropy[\\/]utils[\\/]compat[\\/]futures\"\ndoctest_plus = enabled\nopen_files_ignore = \"astropy.log\" \"/etc/hosts\"\nremote_data_strict = true\naddopts = -p no:warnings\n\n[bdist_wininst]\nbitmap = static/wininst_background.bmp\n\n[ah_bootstrap]\nauto_use = True\n\n[flake8]\nexclude = extern,*parsetab.py,*lextab.py\n\n[pycodestyle]\nexclude = extern,*parsetab.py,*lextab.py\n"},{"fileName":"setup.py","filePath":"","id":22,"nodeType":"File","text":"#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport sys\nimport glob\n\nimport ah_bootstrap\nfrom setuptools import setup\n\nfrom astropy_helpers.setup_helpers import (\n    register_commands, get_package_info, get_debug_option)\nfrom astropy_helpers.distutils_helpers import is_distutils_display_option\nfrom astropy_helpers.git_helpers import get_git_devstr\nfrom astropy_helpers.version_helpers import generate_version_py\n\nimport astropy\n\nNAME = 'astropy'\n\n# VERSION should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)\nVERSION = '3.0.dev'\n\n# Indicates if this version is a release version\nRELEASE = 'dev' not in VERSION\n\nif not RELEASE:\n    VERSION += get_git_devstr(False)\n\n# Populate the dict of setup command overrides; this should be done before\n# invoking any other functionality from distutils since it can potentially\n# modify distutils' behavior.\ncmdclassd = register_commands(NAME, VERSION, RELEASE)\n\n# Freeze build information in version.py\ngenerate_version_py(NAME, VERSION, RELEASE, get_debug_option(NAME),\n                    uses_git=not RELEASE)\n\n# Get configuration information from all of the various subpackages.\n# See the docstring for setup_helpers.update_package_files for more\n# details.\npackage_info = get_package_info()\n\n# Add the project-global data\npackage_info['package_data'].setdefault('astropy', []).append('data/*')\n\n# Add any necessary entry points\nentry_points = {}\n# Command-line scripts\nentry_points['console_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',\n]\n# Register ASDF extensions\nentry_points['asdf_extensions'] = [\n    'astropy = astropy.io.misc.asdf.extension:AstropyExtension',\n    'astropy-asdf = astropy.io.misc.asdf.extension:AstropyAsdfExtension',\n]\n\nmin_numpy_version = 'numpy>=' + astropy.__minimum_numpy_version__\nsetup_requires = [min_numpy_version]\n\n# Make sure to have the packages needed for building astropy, but do not require them\n# when installing from an sdist as the c files are included there.\nif not os.path.exists(os.path.join(os.path.dirname(__file__), 'PKG-INFO')):\n    setup_requires.extend(['cython>=0.21', 'jinja2>=2.7'])\n\ninstall_requires = [min_numpy_version]\n\nextras_require = {\n    'test': ['pytest-astropy']\n}\n\n# Avoid installing setup_requires dependencies if the user just\n# queries for information\nif is_distutils_display_option():\n    setup_requires = []\n\n\nsetup(name=NAME,\n      version=VERSION,\n      description='Community-developed python astronomy tools',\n      requires=['numpy'],  # scipy not required, but strongly recommended\n      setup_requires=setup_requires,\n      install_requires=install_requires,\n      extras_require=extras_require,\n      provides=[NAME],\n      author='The Astropy Developers',\n      author_email='astropy.team@gmail.com',\n      license='BSD',\n      url='http://astropy.org',\n      long_description=astropy.__doc__,\n      keywords=['astronomy', 'astrophysics', 'cosmology', 'space', 'science',\n                'units', 'table', 'wcs', 'samp', 'coordinate', 'fits',\n                'modeling', 'models', 'fitting', 'ascii'],\n      classifiers=[\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      cmdclass=cmdclassd,\n      zip_safe=False,\n      entry_points=entry_points,\n      python_requires='>=' + astropy.__minimum_python_version__,\n      tests_require=['pytest-astropy'],\n      **package_info\n)\n"},{"id":23,"name":".gitmodules","nodeType":"TextFile","path":"","text":"[submodule \"astropy_helpers\"]\n\tpath = astropy_helpers\n\turl = https://github.com/astropy/astropy-helpers.git\n"},{"className":"ContextualZipFile","col":0,"comment":"Supplement ZipFile class to support context manager for Python 2.6.","endLoc":95,"id":24,"nodeType":"Class","startLoc":81,"text":"class ContextualZipFile(zipfile.ZipFile):\n\n    \"\"\"Supplement ZipFile class to support context manager for Python 2.6.\"\"\"\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, type, value, traceback):\n        self.close()\n\n    def __new__(cls, *args, **kwargs):\n        \"\"\"Construct a ZipFile or ContextualZipFile as appropriate.\"\"\"\n        if hasattr(zipfile.ZipFile, '__exit__'):\n            return zipfile.ZipFile(*args, **kwargs)\n        return super(ContextualZipFile, cls).__new__(cls)"},{"id":25,"name":".run_docker_tests.sh","nodeType":"TextFile","path":"","text":"#!/bin/bash\n\ndocker info\n\ncat << EOF | docker run -i \\\n                        -v ${PWD}:/astropy_src \\\n                        -a stdin -a stdout -a stderr \\\n                        astropy/astropy-py35-32bit-test-env:1.10 \\\n                        bash || exit $?\n\ncd /astropy_src\n\necho \"Output of uname -m:\"\nuname -m\n\necho \"Output of sys.maxsize in Python:\"\npython3 -c 'import sys; print(sys.maxsize)'\n\n# We install pytest-astropy explicitly here because the auto-installation\n# of dependencies does not work when using the --parallel option (sub-\n# processes don't see the temporarily installed dependencies)\neasy_install-3.5 pytest-astropy pytest-xdist\n\nPYTHONHASHSEED=42 python3 setup.py test --parallel=4\n\nEOF\n"},{"id":26,"name":".travis.yml","nodeType":"TextFile","path":"","text":"# We set the language to c because python isn't supported on the MacOS X nodes\n# on Travis. However, the language ends up being irrelevant anyway, since we\n# install Python ourselves using conda.\nlanguage: c\n\ncompiler: gcc\n\n# Cache can be cleared from the travis settings menu, see docs currently at\n# https://docs.travis-ci.com/user/caching#Clearing-Caches\ncache:\n  - ccache\n\nos:\n    - linux\n\nstage: Comprehensive tests\n\n# Setting sudo to false opts in to Travis-CI container-based builds.\nsudo: false\n\n# The apt packages below are needed for sphinx builds, which can no longer\n# be installed with sudo apt-get.\naddons:\n    apt:\n        packages:\n            - graphviz\n            - language-pack-de\n\nenv:\n    global:\n        # Set defaults to avoid repeating in most cases\n        - PYTHON_VERSION=3.6\n        - NUMPY_VERSION=stable\n        - MAIN_CMD='python setup.py'\n        # Build against github source until asdf-2.0 has been released\n        - ASDF_GIT='git+git://github.com/spacetelescope/asdf.git#egg=asdf'\n        - CONDA_DEPENDENCIES='Cython jinja2'\n        - CONDA_ALL_DEPENDENCIES='Cython jinja2 scipy h5py matplotlib pyyaml scikit-image pandas pytz beautifulsoup4 ipython mpmath bleach'\n        - SETUP_XVFB=True\n        - EVENT_TYPE='push pull_request'\n        - SETUP_CMD='test'\n\n        # PEP8 errors/warnings:\n        # E101 - mix of tabs and spaces\n        # W191 - use of tabs\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        # E502 - the backslash is redundant between brackets\n        # E722 - do not use bare except\n        # E901 - SyntaxError or IndentationError\n        # E902 - IOError\n        - FLAKE8_OPT=\"--select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E502,E722,E901,E902\"\n\nstages:\n   # Do the style check and a single test job, don't proceed if it fails\n   - name: Initial tests\n   # Do the rest of the tests\n   - name: Comprehensive tests\n   - name: Cron tests\n     if: type = cron\n\nmatrix:\n\n    # Don't wait for allowed failures\n    fast_finish: true\n\n    include:\n\n        - stage: Initial tests\n          env: PYTHON_VERSION=3.5 SETUP_CMD='egg_info'\n\n        - stage: Initial tests\n          env: PYTHON_VERSION=3.6 SETUP_CMD='egg_info'\n\n        # Try MacOS X. Use a slightly old numpy version to help test against\n        # all supported numpy versions.\n        - os: osx\n          stage: Cron tests\n          env: SETUP_CMD='test --remote-data=astropy'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n               PIP_DEPENDENCIES='jplephem' EVENT_TYPE='cron'\n\n        # Check for sphinx doc build warnings - we do this first because it\n        # runs for a long time. The sphinx build also has some additional\n        # dependencies. Using a more stringent locale than UTF-8.\n        - os: linux\n          env: SETUP_CMD='build_docs -w'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n               PIP_DEPENDENCIES='sphinx-gallery>=0.1.12 pillow --no-deps jplephem'\n               LC_CTYPE=C LC_ALL=C LANG=C\n\n        # Try all python versions and Numpy versions. Since we can assume that\n        # the Numpy developers have taken care of testing Numpy with different\n        # versions of Python, we can vary Python and Numpy versions at the same\n        # time. Since we test the latest Numpy as part of the builds with all\n        # optional dependencies below, we can focus on older builds here.\n        # Numpy 1.11 is tested below in the image tests, 1.12 in the Initial stage test.\n        # Run this test using native pytest\n        - os: linux\n          env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.10\n               INSTALL_CMD='python setup.py build_ext --inplace'\n               PIP_DEPENDENCIES='pytest-astropy'\n               TEST_CMD='pytest --open-files --doctest-rst'\n          script:\n            - $INSTALL_CMD\n            - $TEST_CMD\n\n        # Now try with all optional dependencies.\n        # We also test the two latest matplotlib versions for the image tests.\n        - os: linux\n          env: PYTHON_VERSION=3.5 SETUP_CMD='test --remote-data=astropy -a \"--mpl\"'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n               PIP_DEPENDENCIES=\"jplephem pytest-mpl $ASDF_GIT\"\n               LC_CTYPE=C.ascii LC_ALL=C\n               NUMPY_VERSION=1.11\n               MATPLOTLIB_VERSION=1.5\n\n        - os: linux\n          stage: Initial tests\n          env: CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES NUMPY_VERSION=1.12\n               PYTEST_VERSION='>3.2'\n               SETUP_CMD='test -a \"--durations=50\"'\n          compiler: clang\n\n        # Pinning conda version temporarily to 4.3.21, as some anaconda\n        # packges build with 4.3.27 are faulty and we see this job failing,\n        # while locally there are no issues when the same version of\n        # packages are installed from pip.\n        # TODO: remove the pinning once the issue is solved upstream.\n        - os: linux\n          env: SETUP_CMD='test --coverage --remote-data=astropy -a \"--mpl\"'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n               PIP_DEPENDENCIES=\"cpp-coveralls objgraph jplephem pytest-mpl bintrees $ASDF_GIT\"\n               LC_CTYPE=C.ascii LC_ALL=C\n               CFLAGS='-ftest-coverage -fprofile-arcs -fno-inline-functions -O0'\n               MATPLOTLIB_VERSION=2.0\n               EVENT_TYPE='push pull_request cron'\n               CONDA_VERSION=4.3.21\n\n        # Try pre-release version of Numpy without optional dependencies\n        - os: linux\n          env: NUMPY_VERSION=prerelease\n               EVENT_TYPE='push pull_request cron'\n\n        # Do a PEP8/pyflakes test with flake8\n        - os: linux\n          stage: Initial tests\n          env: MAIN_CMD=\"flake8 astropy --count $FLAKE8_OPT\" SETUP_CMD=''\n\n        # Try developer version of Numpy with optional dependencies and also\n        # run all remote tests. Since both cases will be potentially\n        # unstable, we combine them into a single unstable build that we can\n        # mark as an allowed failure below.\n        - os: linux\n          env: NUMPY_VERSION=dev SETUP_CMD='test --remote-data'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\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.\n        - os: linux\n          stage: Cron tests\n          env: NUMPY_VERSION=dev EVENT_TYPE='cron'\n               CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n\n    allow_failures:\n      - os: linux\n        env: NUMPY_VERSION=dev SETUP_CMD='test --remote-data'\n             CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES\n\ninstall:\n    - git clone git://github.com/astropy/ci-helpers.git\n    - source ci-helpers/travis/setup_conda.sh\n\nscript:\n    - $MAIN_CMD $SETUP_CMD\n\nafter_success:\n    - if [[ $SETUP_CMD == *--coverage* ]]; then\n        if [ \"$TRAVIS_REPO_SLUG\" = \"astropy/astropy\" -o \"$TRAVIS_PULL_REQUEST_SLUG\" = \"astropy/astropy\" ]; then\n          cpp-coveralls -E \".*convolution.*\" -E \".*_erfa.*\" -E \".*\\.l\" -E \".*\\.y\" -E \".*flexed.*\" -E \".*cextern.*\" -E \".*_np_utils.*\" -E \".*cparser.*\" -E \".*cython_impl.*\" --dump c-coveralls.json;\n          coveralls --merge=c-coveralls.json --rcfile='astropy/tests/coveragerc';\n        fi;\n      fi\n"},{"id":27,"name":".gitattributes","nodeType":"TextFile","path":"","text":"*.fits    -text\nastropy.0.3.windows.cfg eol=crlf\nCHANGES.rst merge=union\n"},{"id":28,"name":".mailmap","nodeType":"TextFile","path":"","text":"Adam Ginsburg       <keflavich@gmail.com>\nAdam Ginsburg       <keflavich@gmail.com> Adam Ginsburg <adam.g.ginsburg@gmail.com>\nAdam Ginsburg       <keflavich@gmail.com> Adam Ginsburg <keflavich@yahoo.com>\nAdele Plunkett      <aplunket@eso.org>\nAlex Conley         <alexander.conley@colorado.edu> Alexander Conley <alexander.conley@colorado.edu>\nAlex Conley         <alexander.conley@colorado.edu> Alexander Conley <alexanderconley@gmail.com>\nAlex Hagen          <mr.alex.hagen@gmail.com>\nAsish Panda         <asishrocks95@gmail.com>\nAxel Donath         <axel.donath@mpi-hd.mpg.de>\nBryce Nordgren      <bnordgren@gmail.com>\nBogdan Nicula       <bogdan@nicula.net>\nChristopher Bonnett <c.bonnett@gmail.com>\nChristoph Gohlke    <cgohlke@uci.edu>\nCurtis McCully      <cmccully@lcogt.net>\nDaniel Bell         <stampsrule@gmail.com> Daniel <idaniel@me.com>\nDaniel Bell         <stampsrule@gmail.com> stampsrule <stampsrule@gmail.com>\nDaniel Datsev       <dan.datsev@gmail.com>\nDaniel Datsev       <dan.datsev@gmail.com> <fabled@vortex.(none)>\nDavid Pérez-Suárez  <dps.helio@gmail.com>\nDemitri Muna        <demitri.muna@gmail.com> <demitri@me.com>\nDemitri Muna        <demitri.muna@gmail.com> <beswiftly@gmail.com>\nDylan Gregersen     <gregersen.dylan@gmail.com>\nEmma Hogan          <ehogan@gemini.edu>\nMoataz Hisham       <mtzhisham@gmail.com>\nErik M. Bray        <erik.m.bray@gmail.com> <embray@stsci.edu>\nErik M. Bray        <erik.m.bray@gmail.com> <erik.bray@lri.fr>\nErik M. Bray        <erik.m.bray@gmail.com> Erik Bray <erik.m.bray@gmail.com>\nGerrit Schellenberger <gerrit@uni-bonn.de>\nGustavo Bragança    <ga.braganca@gmail.com>\nHans Moritz Günther <moritz.guenther@gmx.de>\nHans Moritz Günther <moritz.guenther@gmx.de> hamogu <hgunther@mit.edu>\nJames Turner        <jturner@gemini.edu>\nJeff Taylor         <jeff.c.taylor@gmail.com>\nKacper Kowalik      <xarthisius.kk@gmail.com> Kacper Kowalik      <xarthisius@gentoo.org>\nKacper Kowalik      <xarthisius.kk@gmail.com> Kacper Kowalik (Xarthisius) <xarthisius@gentoo.org>\nKacper Kowalik      <xarthisius.kk@gmail.com> Kacper Kowalik (Xarthisius) <xarthisius.kk@gmail.com>\nKaran Grover        <karan@karan-HP-Pavilion-dm4-Notebook-PC.(none)>\nKarl Vyhmeister     <kvyh@users.noreply.github.com>\nKirill Tchernyshyov <ktchernyshyov@pha.jhu.edu>\nKelle Cruz          <kellecruz@gmail.com>\nKevin Gullikson     <kevin.gullikson@gmail.com>\nLeonardo Ferreira <leonardo.ferreira.furg@gmail.com> [Leonardo Ferreira] <[leonardo.ferreira.furg@gmail.com]>\nLisa Walter         <lisa@stsci.edu>\nMarten van Kerkwijk <mhvk@astro.utoronto.ca> <mhvk@swan.astro.utoronto.ca>\nMatt Davis          <jiffyclub.programatic@gmail.com>\nNadia Dencheva      <nadia.astropy@gmail.com> <nadia.dencheva@gmail.com>\nNeil Crighton       <neilcrighton@gmail.com>\nPerry Greenfield    <perry@stsci.edu>\nPritish Chakraborty <chakrabortypritish@gmail.com>\nRyan Cooke          <ryancooke86@gmail.com>\nShantanu Srivastava <shan_mbic@rediffmail.com>\nSimon Conseil       <contact@saimon.org> Simon Conseil <simon.conseil@univ-lyon1.fr>\nSimon Conseil       <contact@saimon.org> Simon <contact@saimon.org>\nSimon Liedtke       <liedtke.simon@googlemail.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> astrocaribe <tlcommodore@gmail.com>\nTom Aldcroft        <taldcroft@gmail.com> <aldcroft@dhcp-131-142-152-173.cfa.harvard.edu>\nZach Edwards        <Zachary.Astro@Gmail.com>\nJonathan Foster     <jonathan.bruce.foster@gmail.com>\nDavid Kirkby         <dkirkby@uci.edu>\nAlbert Y. Shih      <ayshih@gmail.com>\nAleh Khvalko        <algerdnazgul@gmail.com>\nElijah Bernstein-Cooper <e.bernsteincooper@gmail.com> <ezbc@astro.wisc.edu>\nLingyi Hu           <hulingyi1995@yahoo.com.sg>\nFrancesco Montesano <franz.bergesund@gmail.com>\nDaniel Lenz         <dlenz.bonn@gmail.com>\nDan P. Cunningham   <dan.p.cunningham@gmail.com>\nJoseph Long         <josephoenix@gmail.com> <me@joseph-long.com>\nBrigitta Sipocz     <bsipocz@gmail.com> <b.sipocz@gmail.com>\nRohit Patil         <rohit4change@yahoo.in> QuanTakeuchi <rohit4change@yahoo.in>\nRohit Patil         <rohit4change@yahoo.in> QuanTakeuchi <Quan@Aries.(none)>\nDemitri Muna        <demitri.muna@gmail.com> Demitri Muna <github@demitri.com>\nSteve Crawford      <crawfordsm@gmail.com> Steven Crawford <crawfordsm@gmail.com>\nSteve Crawford      <crawfordsm@gmail.com> <crawfodsm@gmail.com>\nAnne Archibald      <peridot.faceted@gmail.com> Anne Archibald <archibald@astron.nl>\nStuart Mumford      <stuart@mumford.me.uk> Stuart Mumford <stuart@cadair.com>\nMihai Cara          <mihail.cara@gmail.com> Mihai Cara <mcara@itsd-osx22.home>\nPey Lian Lim        <lim@stsci.edu> P. L. Lim <lim@stsci.edu>\nJonathan Foster     <jonathan.bruce.foster@gmail.com> Jonathan Foster <jonathan.b.foster@yale.edu>\nMiguel de Val-Borro <miguel.deval@gmail.com> Miguel de Val-Borro <miguel@archlinux.net>\nEric Depagne        <eric@depagne.org>\nPratik Patel        <pratikpatel15133@gmail.com>\nMavani Bhautik      <mavanibhautik@gmail.com>\nAniket Kulkarni    <kaniket21@gmail.com>\nSara Ogaz           <ogaz@stsci.edu>\nSourabh Cheedella   <cheedella.sourabh@gmail.com>\nSudheesh Singanamalla <sudheesh1995@outlook.com>\nAmit Kumar          <dtu.amit@gmail.com>\nJake VanderPlas     <jakevdp@gmail.com> Jake VanderPlas <jakevdp@uw.edu>\nMatthew Craig       <mattwcraig@gmail.com> Matt Craig <mattwcraig@gmail.com>\nSergio Pascual      <sergio.pasra@gmail.com> Sergio Pascual <sergiopr@fis.ucm.es>\nLaura Watkins       <lauralwatkins@gmail.com> Laura L Watkins <lauralwatkins@gmail.com>\nAxel Donath         <axel.donath@mpi-hd.mpg.de> Axel Donath <donath@stud.uni-heidelberg.de>\nZé Vinicius         <jvmirca@gmail.com> Ze Vinicius <jvmirca@gmail.com>\nOle Streicher       <ole@aip.de> Ole Streicher <debian@liska.ath.cx>\nAlex Rudy           <alex.rudy@gmail.com> Alexander Rudy <alex.rudy@gmail.com>\nLeo Singer          <leo.singer@ligo.org> Leo Singer <leo.singer@nasa.gov>\nAnthony Horton      <anthony.horton@aao.gov.au>\nManeesh Yadav       <maneesh.yadav@sri.com>\nEsteban Pardo Sánchez <stbnps@users.noreply.github.com>\nJohn Parejko        <parejkoj@uw.edu> John K. Parejko <parejkoj@uw.edu> <parejkoj@gmail.com>\nJohn Parejko        <parejkoj@uw.edu> <parejkoj@gmail.com>\nPauline Barmby      <pbarmby@uwo.ca> Pauline <pbarmby@uwo.ca>\nJoseph Long         <josephoenix@gmail.com> <jlong@stsci.edu>\nGraham Kanarek      <graykanarek@gmail.com>\nJurien Huisman      <huisman@strw.leidenuniv.nl>\nAarya Patil    <aaryapatil1996@gmail.com>\nAarya Patil    <aaryapatil1996@gmail.com> <root@aaryas-MacBook-Pro.local>\nRitwick DSouza      <ritwick.dsouza@outlook.com>\nJake VanderPlas <jakevdp@gmail.com>\nDouglas Burke <dburke.gw@gmail.com>\nBenjamin Alan Weaver  <weaver@noao.edu> <benjamin.weaver@nyu.edu>\nBenjamin Alan Weaver  <weaver@noao.edu> <baweaver@lbl.gov>\nAsra Nizami <anizami@macalester.edu> <anizami@itsd-summer18.stsci.edu>\nAsra Nizami <anizami@macalester.edu> <anizami@itsd-summer18.local>\nMichele Costa  <thenocturnalastrostudent@gmail.com>\nLuke G. Bouma <lgbouma@users.noreply.github.com>\nVSN Reddy Janga <janga1997@gmail.com>\nGiorgio Calderone <giorgio.calderone@gmail.com> <gcalderone@users.noreply.github.com>\nTyler Finethy <tylfin@gmail.com>\nSam Verstocken <sam.verstocken@gmail.com>\nMikhail Minin <mminin2010@gmail.com>\nMatteo Bachetti <matteo@matteobachetti.it> <matteo.bachetti@irap.omp.eu>\nAnirudh Katipally <akatipally@abiomed.com>\nDavid Shupe <shupe@ipac.caltech.edu> <dave.shupe@gmail.com>\nAdrian Price-Whelan <adrian.prw@gmail.com> <adrianmpw@gmail.com>\nDerek Homeier <dhomeie@gwdg.de> <derek.homeier@ens-lyon.fr>\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":29,"name":"NAME","nodeType":"Attribute","startLoc":19,"text":"NAME"},{"id":30,"name":".gitignore","nodeType":"TextFile","path":"","text":"# Compiled files\n*.py[cod]\n*.a\n*.o\n*.so\n*.pyd\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, use `git add -f filename.c`.\n*.c\n\n# Other generated files\nMANIFEST\nastropy/version.py\nastropy/cython_version.py\nastropy/wcs/include/wcsconfig.h\nastropy/_erfa/core.py\nastropy/_erfa/core.pyx\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\n# Other\n.cache\n.tox\n.*.swp\n.*.swo\n*~\n.project\n.pydevproject\n.settings\n.coverage\ncover\nhtmlcov\n\n# Mac OSX\n.DS_Store\n\n# PyCharm\n.idea\n\n# Pytest\nv\n"},{"id":31,"name":".astropy-root","nodeType":"TextFile","path":"","text":""},{"id":32,"name":".rtd-environment.yml","nodeType":"TextFile","path":"","text":"# Note: it's important that none of the packages below depend on Astropy,\n# because if they do, the conda version of Astropy will get installed. If that\n# happens, then that version will take precendence over the latest developer\n# version of Astropy that gets installed just before the documentation build,\n# and Sphinx will pick up only the older stable conda package.\n\nname: astropy\n\ndependencies:\n  - python>=3\n  - numpy\n  - cython\n  - matplotlib\n  - scipy\n  - pillow\n  - pyyaml\n  - jinja2\n  - h5py\n  - scikit-image\n  - pandas\n  - pytz\n  - beautifulsoup4\n  - ipython\n  - mpmath\n  - pytest\n  - pip:\n    - sphinx-gallery>=0.1.12\n    - jplephem\n"},{"id":33,"name":"docs","nodeType":"Package"},{"id":34,"name":"changelog.rst","nodeType":"TextFile","path":"docs","text":".. _changelog:\n\n**************\nFull Changelog\n**************\n\n.. include:: ../CHANGES.rst\n"},{"id":35,"name":"credits.rst","nodeType":"TextFile","path":"docs","text":"*******************\nAuthors and Credits\n*******************\n\nAstropy Project Coordinators\n============================\n\n* Tom Aldcroft\n* Kelle Cruz\n* Thomas Robitaille\n* Erik Tollerud\n\n\nCore Package Contributors\n=========================\n\n* Ryan Abernathey\n* Shailesh Ahuja\n* Tom Aldcroft\n* Anne Archibald\n* Cristian Ardelean\n* Tomas Babej\n* Matteo Bachetti\n* Steven Bamford\n* Kyle Barbary\n* Geert Barentsen\n* Pauline Barmby\n* Paul Barrett\n* Andreas Baumbach\n* Chris Beaumont\n* Daniel Bell\n* Elijah Bernstein-Cooper\n* Kristin Berry\n* Edward Betts\n* Mavani Bhautik\n* Francesco Biscani\n* Thompson Le Blanc\n* Christopher Bonnett\n* Joseph Jon Booker\n* Médéric Boquien\n* Azalee Bostroem\n* Luke G. Bouma\n* Matthew Bourque\n* Larry Bradley\n* Gustavo Bragança\n* Gabriel Brammer\n* Erik M. Bray\n* Eli Bressert\n* Matthew Brett\n* Hannes Breytenbach\n* Hugo Buddelmeijer\n* Doug Burke\n* Giorgio Calderone\n* Mihai Cara\n* Patti Carroll\n* Mabry Cervin\n* Pritish Chakraborty\n* Sourabh Cheedella\n* Alex Conley\n* Jean Connelly\n* Simon Conseil\n* Ryan Cooke\n* Yannick Copin\n* Michele Costa\n* Matthew Craig\n* Steve Crawford\n* Devin Crichton\n* Neil Crighton\n* Robert Cross\n* Kelle Cruz\n* Dan P. Cunningham\n* Ritwick DSouza\n* Daniel Datsev\n* Matt Davis\n* James Dearman\n* Christoph Deil\n* Nadia Dencheva\n* Eric Depagne\n* Jörg Dietrich\n* Axel Donath\n* Bili Dong\n* Michael Droettboom\n* Zach Edwards\n* Jonathan Eisenhamer\n* Thomas Erben\n* Henry Ferguson\n* Leonardo Ferreira\n* Tyler Finethy\n* Jonathan Foster\n* Ryan Fox\n* Lehman Garrison\n* Simon Gibbons\n* Adam Ginsburg\n* Christoph Gohlke\n* Danny Goldstein\n* Ralf Gommers\n* J. Goutin\n* Johnny Greco\n* Perry Greenfield\n* Dylan Gregersen\n* Austen Groener\n* Frédéric Grollier\n* Karan Grover\n* Kevin Gullikson\n* Hans Moritz Günther\n* Chris Hanley\n* Alex Hagen\n* Andrew Hearin\n* Christian Hettlage\n* Paul Hirst\n* Moataz Hisham\n* Michael Hoenig\n* Emma Hogan\n* Derek Homeier\n* Anthony Horton\n* JC Hsu\n* Griffin Hosseinzadeh\n* Lingyi Hu\n* Jurien Huisman\n* Joe Hunkeler\n* Anchit Jain\n* VSN Reddy Janga\n* Eric Jeschke\n* Graham Kanarek\n* Anirudh Katipally\n* Sarah Kendrew\n* Marten van Kerkwijk\n* Nicholas S. Kern\n* Wolfgang Kerzendorf\n* Lennard Kiehl\n* Rashid Khan\n* Aleh Khvalko\n* David Kirkby\n* Dominik Klaes\n* Tom Kooij\n* Kacper Kowalik\n* Roban Hultman Kramer\n* Aniket Kulkarni\n* Amit Kumar\n* Arie Kurniawan\n* Arne de Laat\n* Antony Lee\n* Daniel Lenz\n* Kieran Leschinski\n* Simon Liedtke\n* Pey Lian Lim\n* Stuart Littlefair\n* Joseph Long\n* Joe Lyman\n* Jerry Ma\n* Duncan Macleod\n* Michele Mastropietro\n* Curtis McCully\n* Vinayak Mehta\n* Aaron Meisner\n* Mikhail Minin\n* Serge Montagnac\n* José Sabater Montes\n* Francesco Montesano\n* Brett Morris\n* Michael Mueller\n* Stuart Mumford\n* Demitri Muna\n* Nick Murphy\n* Prasanth Nair\n* Stefan Nelson\n* Giang Nguyen\n* Bogdan Nicula\n* Al Niessner\n* Joe Philip Ninan\n* Asra Nizami\n* Bryce Nordgren\n* Sigurd Næss\n* Maximilian Nöthe\n* Sara Ogaz\n* Georgiana Ogrean\n* Semyeong Oh\n* Miruna Oprescu\n* Carl Osterwisch\n* Luigi Paioro\n* David M. Palmer\n* Asish Panda\n* John Parejko\n* Madhura Parikh\n* Neil Parley\n* Sergio Pascual\n* Pratik Patel\n* Rohit Patil\n* Aarya Patil\n* Ray Plante\n* Adele Plunkett\n* Orion Poplawski\n* Joanna Power\n* Adrian Price-Whelan\n* J. Xavier Prochaska\n* David Pérez-Suárez\n* Tanuj Rastogi\n* Thomas Robitaille\n* Juan Luis Cano Rodríguez\n* Evert Rol\n* Alex Rudy\n* Joseph Ryan\n* Eloy Salinas\n* Gerrit Schellenberger\n* Michael Seifert\n* Srikrishna Sekhar\n* Mathieu Servillat\n* Helen Sherwood-Taylor\n* David Shiga\n* Albert Y. Shih\n* David Shupe\n* Jonathan Sick\n* Max Silbiger\n* Bernie Simon\n* Sudheesh Singanamalla\n* Leo Singer\n* Brigitta Sipocz\n* Paul Sladen\n* Kevin Sooley\n* Shivan Sornarajah\n* Shantanu Srivastava\n* Ole Streicher\n* Matej Stuchlik\n* Bernardo Sulzbach\n* Vatsala Swaroop\n* Esteban Pardo Sánchez\n* James Taylor\n* Jeff Taylor\n* Mark Taylor\n* Kirill Tchernyshyov\n* Régis Terrier\n* Víctor Terrón\n* Scott Thomas\n* Erik Tollerud\n* Matthew Turk\n* James Turner\n* Miguel de Val-Borro\n* Jake VanderPlas\n* Alex de la Vega\n* Sam Verstocken\n* Zé Vinicius\n* Karl Vyhmeister\n* Lisa Walter\n* Laura Watkins\n* Benjamin Alan Weaver\n* Jonathan Whitmore\n* Julien Woillez\n* Maneesh Yadav\n* Víctor Zabalza\n\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/master/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 <http://www.astropy.org/acknowledging.html>`_.\n"},{"id":36,"name":"known_issues.rst","nodeType":"TextFile","path":"docs","text":".. doctest-skip-all\n\n************\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 workaround, or are due to 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 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 in some numpy operations\n(and in scipy operations using numpy internally) the subclass is ignored, which\nmeans that either a plain array is returned, or a `~astropy.units.quantity.Quantity` without units.\nE.g.::\n\n    >>> import astropy.units as u\n    >>> import numpy as np\n    >>> q = u.Quantity(np.arange(10.), u.m)\n    >>> np.dot(q,q)\n    285.0\n    >>> np.hstack((q,q))\n    <Quantity [ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 0., 1., 2., 3., 4.,\n                5., 6., 7., 8., 9.] (Unit not initialised)>\n\n::\n\n    >>> ratio = (3600 * u.s) / (1 * u.h)\n    >>> ratio\n    <Quantity 3600.0 s / h>\n    >>> np.array(ratio)\n    array(3600.0)\n    >>> np.array([ratio])\n    array([ 1.])\n\nAlso in-place operations where the output is a normal `~numpy.ndarray`\nwill drop the unit silently (at least in numpy <= 1.9)::\n\n    >>> a = np.arange(10.)\n    >>> a *= 1. * u.kg\n    >>> a\n    array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])\n\nWork-arounds are available for some cases.  For the above::\n\n    >>> q.dot(q)\n    <Quantity 285.0 m2>\n\n    >>> np.array(ratio.to(u.dimensionless_unscaled))\n    array(1.0)\n\n    >>> u.Quantity([q, q]).flatten()\n    <Quantity [ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 0., 1., 2., 3., 4.,\n                5., 6., 7., 8., 9.] m>\n\nAn incomplete list of specific functions which are known to exhibit this behavior follows.\n\n* `numpy.dot`\n* `numpy.hstack`, `numpy.vstack`, ``numpy.c_``, ``numpy.r_``, `numpy.append`\n* `numpy.where`\n* `numpy.choose`\n* `numpy.vectorize`\n* pandas DataFrame(s)\n\n\nSee: https://github.com/astropy/astropy/issues/1274\n\n\nQuantities float comparison with np.isclose fails\n-------------------------------------------------\n\nComparing Quantities floats using the numpy function `~numpy.isclose` fails on\nnumpy 1.9 as the comparison between ``a`` and ``b`` is made using the formula\n\n.. math::\n\n    |a - b| \\le (a_\\textrm{tol} + r_\\textrm{tol} \\times |b|)\n\nThis will result in the following traceback when using this with Quantities::\n\n    >>> from astropy import units as u, constants as const\n    >>> import numpy as np\n    >>> np.isclose(500* u.km/u.s, 300 * u.km / u.s)\n    UnitsError: Can only apply 'add' function to dimensionless quantities when\n    other argument is not a quantity (unless the latter is all zero/infinity/nan)\n\nAn easy solution is::\n\n    >>> np.isclose(500* u.km/u.s, 300 * u.km / u.s, atol=1e-8 * u.mm / u.s)\n    array([False], dtype=bool)\n\n\nQuantities in np.linspace failure on numpy 1.10\n-----------------------------------------------\n\n`~numpy.linspace` does not work correctly with quantities when using numpy\n1.10.0 to 1.10.5 due to a bug in numpy. The solution is to upgrade to numpy\n1.10.6 or later, in which the bug was fixed.\n\n\nmmap support for ``astropy.io.fits`` on GNU Hurd\n------------------------------------------------\n\nOn Hurd and possibly other platforms ``flush()`` on memory-mapped files is 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\nBug with unicode endianness in ``io.fits`` for big-endian processors\n--------------------------------------------------------------------\n\nOn big-endian processors (e.g. SPARC, PowerPC, MIPS), string columns in FITS\nfiles may not be correctly read when using the ``Table.read`` interface. This\nwill be fixed in a subsequent bug fix release of Astropy (see `bug report here\n<https://github.com/astropy/astropy/issues/3415>`_)\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\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 ``setup.py``::\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 ``setup.py`` again (in the new\nterminal).\n\n\nCreating a Time object fails with ValueError after upgrading Astropy\n--------------------------------------------------------------------\n\nIn some cases, have users have upgraded Astropy from an older version to v1.0\nor greater they have run into the following crash when trying to create a\n`~astropy.time.Time` object::\n\n    >>> datetime = Time('2012-03-01T13:08:00', scale='utc')\n    Traceback (most recent call last):\n    ...\n    ValueError: Input values did not match any of the formats where\n    the format keyword is optional [u'astropy_time', u'datetime',\n    u'jyear_str', u'iso', u'isot', u'yday', u'byear_str']\n\nThis problem can occur when there is a version mismatch between the compiled\nERFA library (this is included as part of Astropy in most distributions), and\nthe version of the Astropy Python source.\n\nThis can have a number of causes.  The most likely is that when installing the\nnew Astropy version, your previous Astropy version was not fully uninstalled\nfirst, resulting in a mishmash of versions.  Your best bet is to fully remove\nAstropy from its installation path, and reinstall from scratch using your\npreferred installation method.  How to remove the old version may be a simple\nmatter if removing the entire ``astropy/`` directory from within the\n``site-packages`` directory it is installed in.  However, if in doubt, ask\nhow best to uninstall packages from your preferred Python distribution.\n\nAnother possible cause of this, in particular for people developing on Astropy\nand installing from a source checkout, is simply that your Astropy build\ndirectory is unclean.  To fix this, run ``git clean -dfx``.  This removes\n*all* build artifacts from the repository that aren't normally tracked by git.\nMake sure before running this that there are no untracked files in the\nrepository you intend to save.  Then rebuild/reinstall from the clean repo.\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 py.test, 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\n\nSome docstrings can not be displayed in IPython < 0.13.2\n--------------------------------------------------------\n\nDisplaying long docstrings that contain Unicode characters may fail on\nsome platforms in the IPython console (prior to IPython version\n0.13.2)::\n\n    In [1]: import astropy.units as u\n\n    In [2]: u.Angstrom?\n    Out[2]: ERROR: UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe5' in\n    position 184: ordinal not in range(128) [IPython.core.page]\n\nThis can be worked around by changing the default encoding to ``utf-8``\nby adding the following to your ``sitecustomize.py`` file::\n\n    import sys\n    sys.setdefaultencoding('utf-8')\n\nNote that in general, `this is not recommended\n<https://ziade.org/2008/01/08/syssetdefaultencoding-is-evil/>`_,\nbecause it can hide other Unicode encoding bugs in your application.\nHowever, in general if your application does not deal with text\nprocessing and you just want docstrings to work, this may be\nacceptable.\n\nThe IPython issue: https://github.com/ipython/ipython/pull/2738\n"},{"id":37,"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\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":38,"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":39,"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.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\n\n# astropy.time\npy:class astropy.time.core.TimeUnique\n\n# astropy.visualization\npy:class matplotlib.axes._subplots.WCSAxesSubplot\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.core.records.recarray\npy:class xmlrpclib.Fault\npy:class xmlrpclib.Error\npy:class xmlrpc.client.Fault\npy:class xmlrpc.client.Error\npy:obj distutils.version.LooseVersion\npy:obj pkg_resources.parse_version\npy:class pandas.DataFrame\n\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\n"},{"col":0,"comment":"\n    Ensure that a setuptools version is installed.\n\n    Return None. Raise SystemExit if the requested version\n    or later cannot be installed.\n    ","endLoc":188,"header":"def use_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, download_delay=15)","id":40,"name":"use_setuptools","nodeType":"Function","startLoc":152,"text":"def use_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, download_delay=15):\n    \"\"\"\n    Ensure that a setuptools version is installed.\n\n    Return None. Raise SystemExit if the requested version\n    or later cannot be installed.\n    \"\"\"\n    to_dir = os.path.abspath(to_dir)\n\n    # prior to importing, capture the module state for\n    # representative modules.\n    rep_modules = 'pkg_resources', 'setuptools'\n    imported = set(sys.modules).intersection(rep_modules)\n\n    try:\n        import pkg_resources\n        pkg_resources.require(\"setuptools>=\" + version)\n        # a suitable version is already installed\n        return\n    except ImportError:\n        # pkg_resources not available; setuptools is not installed; download\n        pass\n    except pkg_resources.DistributionNotFound:\n        # no version of setuptools was found; allow download\n        pass\n    except pkg_resources.VersionConflict as VC_err:\n        if imported:\n            _conflict_bail(VC_err, version)\n\n        # otherwise, unload pkg_resources to allow the downloaded version to\n        #  take precedence.\n        del pkg_resources\n        _unload_pkg_resources()\n\n    return _do_download(version, download_base, to_dir, download_delay)"},{"id":41,"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":42,"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# See astropy.sphinx.conf for which values are set there.\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 (if \"python setup.py build_docs\" is used).\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\nfrom datetime import datetime\nimport os\nON_RTD = os.environ.get('READTHEDOCS') == 'True'\nON_TRAVIS = os.environ.get('TRAVIS') == 'true'\n\ntry:\n    import astropy_helpers\nexcept ImportError:\n    # Building from inside the docs/ directory?\n    import os\n    import sys\n    if os.path.basename(os.getcwd()) == 'docs':\n        a_h_path = os.path.abspath(os.path.join('..', 'astropy_helpers'))\n        if os.path.isdir(a_h_path):\n            sys.path.insert(1, a_h_path)\n\n    # If that doesn't work trying to import from astropy_helpers below will\n    # still blow up\n\n# Load all of the global Astropy configuration\nfrom astropy_helpers.sphinx.conf import *\n\nimport astropy\n\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.\n#needs_sphinx = '1.1'\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\")\n\n# The intersphinx_mapping in astropy_helpers.sphinx.conf refers to astropy for\n# the benefit of affiliated 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']\n\n# add any custom intersphinx for astropy\nintersphinx_mapping['pytest'] = ('https://docs.pytest.org/en/latest/', None)\nintersphinx_mapping['ipython'] = ('http://ipython.readthedocs.io/en/stable/', None)\nintersphinx_mapping['pandas'] = ('http://pandas.pydata.org/pandas-docs/stable/', None)\nintersphinx_mapping['sphinx_automodapi'] = ('https://sphinx-automodapi.readthedocs.io/en/stable/', None)\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')\nexclude_patterns.append('_pkgtemplate.rst')\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\n# This is added to the end of RST files - a good place to put substitutions to\n# be used globally.\nrst_epilog += \"\"\"\n.. |minimum_numpy_version| replace:: {0.__minimum_numpy_version__}\n\n.. Astropy\n.. _Astropy: http://astropy.org\n.. _`Astropy mailing list`: https://mail.python.org/mailman/listinfo/astropy\n.. _`astropy-dev mailing list`: http://groups.google.com/group/astropy-dev\n\"\"\".format(astropy)\n\n# -- Project information ------------------------------------------------------\n\nproject = u'Astropy'\nauthor = u'The Astropy Developers'\ncopyright = u'2011–{0}, '.format(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 short X.Y version.\nversion = astropy.__version__.split('-', 1)[0]\n# The full version, including alpha/beta/rc tags.\nrelease = astropy.__version__\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 = '{0} v{1}'.format(project, release)\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = project + 'doc'\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\n# -- Options for the edit_on_github extension ----------------------------------------\n\nextensions += ['astropy_helpers.sphinx.ext.edit_on_github']\n\n# Don't import the module as \"version\" or it will override the\n# \"version\" configuration parameter\nfrom astropy import version as versionmod\nedit_on_github_project = \"astropy/astropy\"\nif versionmod.release:\n    edit_on_github_branch = \"v{0}.{1}.x\".format(\n        versionmod.major, versionmod.minor)\nelse:\n    edit_on_github_branch = \"master\"\nedit_on_github_source_root = \"\"\nedit_on_github_doc_root = \"docs\"\n\nedit_on_github_skip_regex = '_.*|api/.*'\n\ngithub_issues_url = 'https://github.com/astropy/astropy/issues/'\n\n# Enable nitpicky mode - which ensures that all references in the docs\n# resolve.\n\nnitpicky = True\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 sphinx_gallery\n    extensions += [\"sphinx_gallery.gen_gallery\"]\n\n    sphinx_gallery_conf = {\n        'backreferences_dir': 'generated/modules', # path to store the module using example template\n        'filename_pattern': '^((?!skip_).)*$', # execute all examples except those that start with \"skip_\"\n        'examples_dirs': '..{}examples'.format(os.sep), # path to the examples scripts\n        'gallery_dirs': 'generated/examples', # path to save gallery generated examples\n        'reference_url': {\n            'astropy': None,\n            'matplotlib': 'http://matplotlib.org/',\n            'numpy': 'http://docs.scipy.org/doc/numpy/',\n        },\n        'abort_on_example_error': True\n    }\n\nexcept ImportError:\n    def setup(app):\n        app.warn('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\nlinkcheck_anchors = False\n"},{"id":43,"name":"install.rst","nodeType":"TextFile","path":"docs","text":"************\nInstallation\n************\n\nRequirements\n============\n\nAstropy has the following strict requirements:\n\n- `Python <https://www.python.org/>`_ 3.5 or 3.6\n\n- `Numpy`_ |minimum_numpy_version| or later\n\n- `pytest`_ 3.1 or later\n\nAstropy also depends on other packages for optional 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- `PyYAML <http://pyyaml.org>`_: To read/write\n  :class:`~astropy.table.Table` objects from/to the Enhanced CSV ASCII table format.\n\n- `scipy`_: To power a variety of features (currently\n  mainly cosmology-related functionality).\n\n- `xmllint <http://www.xmlsoft.org/>`_: To validate VOTABLE XML files.\n\n- `matplotlib <http://matplotlib.org/>`_ 1.5 or later: To provide plotting functionality that `astropy.visualization` enhances.\n\n- `pytz <http://pythonhosted.org/pytz/>`_: To specify and convert between timezones.\n\n- `scikit-image <http://scikit-image.org/>`_: To downsample a data array in `astropy.nddata.utils`.\n\n- `pandas <http://pandas.pydata.org/>`_: To read/write\n  :class:`~astropy.table.Table` objects from/to pandas DataFrame objects.\n\n- `objgraph <https://mg.pov.lt/objgraph/>`_: Used only in tests to test for reference leaks.\n\n- `setuptools <https://setuptools.readthedocs.io>`_: Used for discovery of entry points which are used to insert fitters into modeling.fitting\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- `bintrees <https://pypi.python.org/pypi/bintrees>`_ for faster ``FastRBT`` and\n  ``FastBST`` indexing engines with ``Table``, although these will still be\n  slower in most cases than the default indexing engine.\n\nHowever, note that these only need to be installed if those particular features\nare needed. Astropy will import even if these dependencies are not installed.\n\n.. TODO: Link to the planned dependency checker/installer tool.\n\nInstalling Astropy\n==================\n\nUsing pip\n---------\n\nTo install Astropy with `pip <https://pip.pypa.io>`__, simply run::\n\n    pip install astropy --no-deps\n\n.. warning::\n\n    Users of the Anaconda python distribution should follow the instructions\n    for :ref:`anaconda_install`.\n\n.. note::\n\n    You will need a C compiler (e.g. ``gcc`` or ``clang``) to be installed (see\n    `Building from source`_ below) for the installation to succeed.\n\n.. note::\n\n    The ``--no-deps`` flag is optional, but highly recommended if you already\n    have Numpy installed, since otherwise pip will sometimes try to \"help\" you\n    by upgrading your Numpy installation, which may not always be desired.\n\n.. note::\n\n    If you get a ``PermissionError`` this means that you do not have the\n    required administrative access to install new packages to your Python\n    installation.  In this case you may consider using the ``--user`` option\n    to install the package into your home directory.  You can read more\n    about how to do this in the `pip documentation\n    <https://pip.pypa.io/en/stable/user_guide/#user-installs>`_.\n\n    Alternatively, if you intend to do development on other software that uses\n    Astropy, such as an affiliated package, consider installing Astropy into a\n    :ref:`virtualenv<using-virtualenv>`.\n\n    Do **not** install Astropy or other third-party packages using ``sudo``\n    unless you are fully aware of the risks.\n\n\n.. _anaconda_install:\n\nUsing conda\n-----------\n\nAstropy is installed by default with the `Anaconda Distribution\n<https://www.anaconda.com/download/>`_. To update to the latest version run::\n\n    conda update astropy\n\n.. note::\n\n    There may be a delay of a day or two between when a new version of Astropy\n    is released and when a package is available for Anaconda. You can check\n    for the list of available versions with ``conda search astropy``.\n\n.. note::\n\n    Attempting to use `pip <https://pip.pypa.io>`__ to upgrade your installation of Astropy may result\n    in a corrupted installation.\n\n.. _testing_installed_astropy:\n\nTesting an installed Astropy\n----------------------------\n\nThe easiest way to test 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\n.. note::\n\n    This way of running the tests may not work if you do it in the\n    astropy source distribution.  See :ref:`sourcebuildtest` for how to\n    run the tests from the source code directory, or :ref:`running-tests`\n    for more details.\n\n.. note::\n\n    Running the tests this way is currently disabled in the IPython REPL due\n    to conflicts with some common display settings in IPython. Please run the\n    Astropy tests under the standard Python command-line interpreter.\n\n\nBuilding from source\n====================\n\nPrerequisites\n-------------\n\nYou will need a compiler suite and the development headers for Python and\nNumpy in order to build Astropy.\n\nYou will also need `Cython <http://cython.org/>`_ (v0.21 or later) and\n`jinja2 <http://jinja.pocoo.org/docs/dev/>`_ (v2.7 or later) installed\nto build from source, unless you are installing a release. (The released\npackages have the necessary C files packaged with them, and hence do not require\nCython.)\n\nPrerequisites for Linux\n-----------------------\n\nOn Linux, using the package manager for your distribution will usually be the\neasiest route. In order to build from source, you'll need the python development\npackage for your Linux distribution.\n\nFor Debian/Ubuntu::\n\n    sudo apt-get install python-dev\n\nFor Fedora/RHEL::\n\n    sudo yum install python-devel\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://docs.scipy.org/doc/numpy/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.python.org/pypi/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\n.. note::\n\n   If you wish to participate in the development of Astropy, see\n   :ref:`developer-docs`.  This document covers only the basics\n   necessary to install Astropy.\n\nBuilding and Installing\n-----------------------\n\nAstropy uses the Python built-in `distutils framework\n<http://docs.python.org/install/index.html>`_ for building and\ninstalling and requires the `setuptools`_ package -- the later is automatically\ndownloaded when running ``python setup.py`` if it is not already provided by\nyour system.\n\nIf Numpy is not already installed in your Python environment, the\nastropy setup process will try to download and install it before\ncontinuing to install astropy.\n\nTo build Astropy (from the root of the source tree)::\n\n    python setup.py build\n\nTo install Astropy (from the root of the source tree)::\n\n    python setup.py install\n\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    python setup.py install --user\n\nwhich will install into a default directory in your home directory.\n\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\nAstropy.  However, if you wish to use the system-wide installation of\none of those libraries, you can pass one or more of the\n``--use-system-X`` flags to the ``setup.py build`` command.\n\nFor example, to build Astropy using the system `libexpat\n<http://www.libexpat.org/>`_, use::\n\n    python setup.py build --use-system-expat\n\nTo build using all of the system libraries, use::\n\n    python setup.py build --use-system-libraries\n\nTo see which system libraries Astropy knows how to build against, use::\n\n    python setup.py build --help\n\nAs with all distutils commandline options, they may also be provided in a\n``setup.cfg`` in the same directory as ``setup.py``.  For example, to use\nthe system `libexpat <http://www.libexpat.org/>`_, add the following to the\n``setup.cfg`` file::\n\n    [build]\n    use_system_expat=1\n\n\nThe C libraries currently bundled with Astropy include:\n\n- `wcslib <http://www.atnf.csiro.au/people/mcalabre/WCS/>`_ see\n  ``cextern/wcslib/README`` for the bundled version.\n\n- `cfitsio <https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html>`_ see\n  ``cextern/cfitsio/changes.txt`` for the bundled version.\n\n- `erfa <https://github.com/liberfa>`_ see ``cextern/erfa/README.rst`` for the\n  bundled version.\n\n- `expat <http://expat.sourceforge.net/>`_ see ``cextern/expat/README`` for the\n  bundled version.\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 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 pip\n\n    CASA <3>: pip.main(['install', 'astropy', '--user'])\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 <http://spectral-cube.readthedocs.io/en/latest/>`_ or other\npackages that may be useful for radioastronomy).\n\n.. note:: The above instructions have been tested and are known to work on\n          MacOS X with CASA 4.3.1 and Linux with CASA 4.3.1, 4.4.0, 4.5.3, and\n          pre-releases of CASA 4.7. However, due to missing header files in\n          CASA, they are known to **not** work on Linux with CASA 4.2.1 and\n          CASA 4.6.0.\n\n.. _builddocs:\n\nBuilding documentation\n----------------------\n\n.. note::\n\n    Building the documentation is in general not necessary unless you\n    are 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 <http://docs.astropy.org>`_ .\n\nBuilding the documentation requires the Astropy source code and some additional\npackages:\n\n    - `Sphinx <http://sphinx.pocoo.org>`_ (and its dependencies) 1.0 or later\n\n    - `Graphviz <http://www.graphviz.org>`_\n\n    - `Astropy-helpers <https://github.com/astropy/astropy-helpers>`_ (Astropy\n      and most affiliated packages include this as a submodule in the source\n      repository, so it does not need to be installed separately.)\n\n    - `Pillow <http://python-pillow.org/>`_\n\n    - (optional) `sphinx-gallery <http://sphinx-gallery.readthedocs.io/>`_\n\n.. note::\n\n    If sphinx-gallery is not installed, you will see many Sphinx warnings\n    building the documentation, e.g.::\n\n        .../docs/coordinates/frames.rst:278: WARNING: undefined label:\n            sphx_glr_generated_examples_coordinates_plot_sgr-coordinate-frame.py\n            (if the link has no caption the label must precede a section header)\n\nThere are two ways to build the Astropy documentation. The most straightforward\nway is to execute the command (from the astropy source directory)::\n\n    python setup.py build_docs\n\nThe documentation will be built in the ``docs/_build/html`` directory, and can\nbe read by pointing a web browser to ``docs/_build/html/index.html``.\n\nThe LaTeX documentation can be generated by using the command::\n\n    python setup.py build_docs -b latex\n\nThe LaTeX file ``Astropy.tex`` will be created in the ``docs/_build/latex``\ndirectory, and can be compiled using ``pdflatex``.\n\nThe above method builds the API documentation from the source code.\nAlternatively, you can do::\n\n    cd docs\n    make html\n\nAnd the documentation will be generated in the same location, but using the\n*installed* version of Astropy.\n\n.. _sourcebuildtest:\n\nTesting a source code build of Astropy\n--------------------------------------\n\nBefore running tests, it is necessary to make sure that Astropy's test\ndependencies are installed. This can be done with the following command::\n\n    pip install pytest-astropy\n\nMore information on what the ``pytest-astropy`` package provides can be found\nin :ref:`testing-dependencies`.\n\nThe easiest way to test that your Astropy built correctly (without\ninstalling astropy) is to run this from the root of the source tree::\n\n    python setup.py test\n\nThere are also alternative methods of :ref:`running-tests`. Note that you will\nneed `pytest <http://pytest.org>`_ to be installed for this to work.\n\n.. include:: development/workflow/known_projects.inc\n"},{"id":44,"name":"index.rst","nodeType":"TextFile","path":"docs","text":".. Astropy documentation master 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=\"_images/astropy_banner.svg\" onerror=\"this.src='_images/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\n<http://www.astropy.org/affiliated/index.html>`_ covering a broad range of\nneeds for astronomical research, data processing, and data analysis.\n\n.. _getting-started:\n\n***************\nGetting Started\n***************\n\n.. toctree::\n   :maxdepth: 1\n\n   install\n   whatsnew/2.0\n   importing_astropy\n   Example Gallery <generated/examples/index>\n   Tutorials <http://tutorials.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   coordinates/index\n   wcs/index\n   modeling/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   testhelpers\n   development/workflow/get_devel_version\n\n.. _developer-docs:\n\n=======================\nDeveloper Documentation\n=======================\n\nThe developer documentation contains instructions for how to contribute to\nAstropy or affiliated packages, as well as coding, documentation, and\ntesting guidelines. For the guiding vision of this process and the project\nas a whole, see :doc:`development/vision`.\n\nThere are additional tools of use for developers in the\n`astropy/astropy-tools repository\n<https://github.com/astropy/astropy-tools>`__.\n\n.. toctree::\n   :maxdepth: 1\n\n   development/workflow/development_workflow\n   development/codeguide\n   development/docguide\n   development/testguide\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\n.. _project-details:\n\n***************\nProject details\n***************\n\n.. toctree::\n   :maxdepth: 1\n\n   stability\n   whatsnew/index\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"},{"id":45,"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=============================\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 much of the useful tools\nare either in the standard library, py.test, or `numpy.testing\n<https://docs.scipy.org/doc/numpy/reference/routines.testing.html>`_.  This\nmodule contains primarily functionality specific to the astropy core package\nor packages that follow the Astropy package template.\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 either `astropy.test` or ``python setup.py test`` the\ncall to pytest is controlled by 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`~astropy.tests.runner.TestRunner.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.. automodapi:: astropy.tests.runner\n    :no-main-docstr:\n"},{"id":46,"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":47,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":48,"name":"VERSION","nodeType":"Attribute","startLoc":22,"text":"VERSION"},{"attributeType":"","col":0,"comment":"null","endLoc":25,"id":49,"name":"RELEASE","nodeType":"Attribute","startLoc":25,"text":"RELEASE"},{"id":50,"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":51,"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 'python setup.py test' in the root directory to run doctests \" \\\n\t@echo \"in the documentation.\"\n"},{"col":0,"comment":"\n    Execute a command.\n\n    Return True if the command succeeded.\n    ","endLoc":54,"header":"def _python_cmd(*args)","id":52,"name":"_python_cmd","nodeType":"Function","startLoc":47,"text":"def _python_cmd(*args):\n    \"\"\"\n    Execute a command.\n\n    Return True if the command succeeded.\n    \"\"\"\n    args = (sys.executable,) + args\n    return subprocess.call(args) == 0"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":53,"name":"cmdclassd","nodeType":"Attribute","startLoc":33,"text":"cmdclassd"},{"id":54,"name":"importing_astropy.rst","nodeType":"TextFile","path":"docs","text":"*********************************\nImporting astropy and subpackages\n*********************************\n\nIn order to encourage consistency amongst 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\nastropy as::\n\n    >>> import astropy\n\nis not very useful. Instead, it is 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 to **never**\nimport 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, PyWCS),\nso in cases where Astropy needs to be used as a drop-in replacement, the following\nsyntax is also acceptable::\n\n    >>> from astropy.io import fits as pyfits\n\n********************************\nGetting started with subpackages\n********************************\n\nBecause different subpackages have very different functionality, each subpackage has its own\ngetting started guide. These can be found by browsing the sections listed in the :ref:`user-docs`.\n\nYou can also look at docstrings for a\nparticular package or object, or access their documentation using the\n`~astropy.utils.misc.find_api_page` function. For example, ::\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"},{"className":"_Bootstrapper","col":0,"comment":"\n    Bootstrapper implementation.  See ``use_astropy_helpers`` for parameter\n    documentation.\n    ","endLoc":746,"id":55,"nodeType":"Class","startLoc":165,"text":"class _Bootstrapper(object):\n    \"\"\"\n    Bootstrapper implementation.  See ``use_astropy_helpers`` for parameter\n    documentation.\n    \"\"\"\n\n    def __init__(self, path=None, index_url=None, use_git=None, offline=None,\n                 download_if_needed=None, auto_upgrade=None):\n\n        if path is None:\n            path = PACKAGE_NAME\n\n        if not (isinstance(path, _str_types) or path is False):\n            raise TypeError('path must be a string or False')\n\n        if PY3 and not isinstance(path, _text_type):\n            fs_encoding = sys.getfilesystemencoding()\n            path = path.decode(fs_encoding)  # path to unicode\n\n        self.path = path\n\n        # Set other option attributes, using defaults where necessary\n        self.index_url = index_url if index_url is not None else INDEX_URL\n        self.offline = offline if offline is not None else OFFLINE\n\n        # If offline=True, override download and auto-upgrade\n        if self.offline:\n            download_if_needed = False\n            auto_upgrade = False\n\n        self.download = (download_if_needed\n                         if download_if_needed is not None\n                         else DOWNLOAD_IF_NEEDED)\n        self.auto_upgrade = (auto_upgrade\n                             if auto_upgrade is not None else AUTO_UPGRADE)\n\n        # If this is a release then the .git directory will not exist so we\n        # should not use git.\n        git_dir_exists = os.path.exists(os.path.join(os.path.dirname(__file__), '.git'))\n        if use_git is None and not git_dir_exists:\n            use_git = False\n\n        self.use_git = use_git if use_git is not None else USE_GIT\n        # Declared as False by default--later we check if astropy-helpers can be\n        # upgraded from PyPI, but only if not using a source distribution (as in\n        # the case of import from a git submodule)\n        self.is_submodule = False\n\n    @classmethod\n    def main(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = cls.parse_config()\n        config.update(cls.parse_command_line(argv))\n\n        auto_use = config.pop('auto_use', False)\n        bootstrapper = cls(**config)\n\n        if auto_use:\n            # Run the bootstrapper, otherwise the setup.py is using the old\n            # use_astropy_helpers() interface, in which case it will run the\n            # bootstrapper manually after reconfiguring it.\n            bootstrapper.run()\n\n        return bootstrapper\n\n    @classmethod\n    def parse_config(cls):\n        if not os.path.exists('setup.cfg'):\n            return {}\n\n        cfg = ConfigParser()\n\n        try:\n            cfg.read('setup.cfg')\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.error(\n                \"Error reading setup.cfg: {0!r}\\n{1} will not be \"\n                \"automatically bootstrapped and package installation may fail.\"\n                \"\\n{2}\".format(e, PACKAGE_NAME, _err_help_msg))\n            return {}\n\n        if not cfg.has_section('ah_bootstrap'):\n            return {}\n\n        config = {}\n\n        for option, type_ in CFG_OPTIONS:\n            if not cfg.has_option('ah_bootstrap', option):\n                continue\n\n            if type_ is bool:\n                value = cfg.getboolean('ah_bootstrap', option)\n            else:\n                value = cfg.get('ah_bootstrap', option)\n\n            config[option] = value\n\n        return config\n\n    @classmethod\n    def parse_command_line(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = {}\n\n        # For now we just pop recognized ah_bootstrap options out of the\n        # arg list.  This is imperfect; in the unlikely case that a setup.py\n        # custom command or even custom Distribution class defines an argument\n        # of the same name then we will break that.  However there's a catch22\n        # here that we can't just do full argument parsing right here, because\n        # we don't yet know *how* to parse all possible command-line arguments.\n        if '--no-git' in argv:\n            config['use_git'] = False\n            argv.remove('--no-git')\n\n        if '--offline' in argv:\n            config['offline'] = True\n            argv.remove('--offline')\n\n        return config\n\n    def run(self):\n        strategies = ['local_directory', 'local_file', 'index']\n        dist = None\n\n        # First, remove any previously imported versions of astropy_helpers;\n        # this is necessary for nested installs where one package's installer\n        # is installing another package via setuptools.sandbox.run_setup, as in\n        # the case of setup_requires\n        for key in list(sys.modules):\n            try:\n                if key == PACKAGE_NAME or key.startswith(PACKAGE_NAME + '.'):\n                    del sys.modules[key]\n            except AttributeError:\n                # Sometimes mysterious non-string things can turn up in\n                # sys.modules\n                continue\n\n        # Check to see if the path is a submodule\n        self.is_submodule = self._check_submodule()\n\n        for strategy in strategies:\n            method = getattr(self, 'get_{0}_dist'.format(strategy))\n            dist = method()\n            if dist is not None:\n                break\n        else:\n            raise _AHBootstrapSystemExit(\n                \"No source found for the {0!r} package; {0} must be \"\n                \"available and importable as a prerequisite to building \"\n                \"or installing this package.\".format(PACKAGE_NAME))\n\n        # This is a bit hacky, but if astropy_helpers was loaded from a\n        # directory/submodule its Distribution object gets a \"precedence\" of\n        # \"DEVELOP_DIST\".  However, in other cases it gets a precedence of\n        # \"EGG_DIST\".  However, when activing the distribution it will only be\n        # placed early on sys.path if it is treated as an EGG_DIST, so always\n        # do that\n        dist = dist.clone(precedence=pkg_resources.EGG_DIST)\n\n        # Otherwise we found a version of astropy-helpers, so we're done\n        # Just active the found distribution on sys.path--if we did a\n        # download this usually happens automatically but it doesn't hurt to\n        # do it again\n        # Note: Adding the dist to the global working set also activates it\n        # (makes it importable on sys.path) by default.\n\n        try:\n            pkg_resources.working_set.add(dist, replace=True)\n        except TypeError:\n            # Some (much) older versions of setuptools do not have the\n            # replace=True option here.  These versions are old enough that all\n            # bets may be off anyways, but it's easy enough to work around just\n            # in case...\n            if dist.key in pkg_resources.working_set.by_key:\n                del pkg_resources.working_set.by_key[dist.key]\n            pkg_resources.working_set.add(dist)\n\n    @property\n    def config(self):\n        \"\"\"\n        A `dict` containing the options this `_Bootstrapper` was configured\n        with.\n        \"\"\"\n\n        return dict((optname, getattr(self, optname))\n                    for optname, _ in CFG_OPTIONS if hasattr(self, optname))\n\n    def get_local_directory_dist(self):\n        \"\"\"\n        Handle importing a vendored package from a subdirectory of the source\n        distribution.\n        \"\"\"\n\n        if not os.path.isdir(self.path):\n            return\n\n        log.info('Attempting to import astropy_helpers from {0} {1!r}'.format(\n                 'submodule' if self.is_submodule else 'directory',\n                 self.path))\n\n        dist = self._directory_import()\n\n        if dist is None:\n            log.warn(\n                'The requested path {0!r} for importing {1} does not '\n                'exist, or does not contain a copy of the {1} '\n                'package.'.format(self.path, PACKAGE_NAME))\n        elif self.auto_upgrade and not self.is_submodule:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist\n\n    def get_local_file_dist(self):\n        \"\"\"\n        Handle importing from a source archive; this also uses setup_requires\n        but points easy_install directly to the source archive.\n        \"\"\"\n\n        if not os.path.isfile(self.path):\n            return\n\n        log.info('Attempting to unpack and import astropy_helpers from '\n                 '{0!r}'.format(self.path))\n\n        try:\n            dist = self._do_download(find_links=[self.path])\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.warn(\n                'Failed to import {0} from the specified archive {1!r}: '\n                '{2}'.format(PACKAGE_NAME, self.path, str(e)))\n            dist = None\n\n        if dist is not None and self.auto_upgrade:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist\n\n    def get_index_dist(self):\n        if not self.download:\n            log.warn('Downloading {0!r} disabled.'.format(DIST_NAME))\n            return None\n\n        log.warn(\n            \"Downloading {0!r}; run setup.py with the --offline option to \"\n            \"force offline installation.\".format(DIST_NAME))\n\n        try:\n            dist = self._do_download()\n        except Exception as e:\n            if DEBUG:\n                raise\n            log.warn(\n                'Failed to download and/or install {0!r} from {1!r}:\\n'\n                '{2}'.format(DIST_NAME, self.index_url, str(e)))\n            dist = None\n\n        # No need to run auto-upgrade here since we've already presumably\n        # gotten the most up-to-date version from the package index\n        return dist\n\n    def _directory_import(self):\n        \"\"\"\n        Import astropy_helpers from the given path, which will be added to\n        sys.path.\n\n        Must return True if the import succeeded, and False otherwise.\n        \"\"\"\n\n        # Return True on success, False on failure but download is allowed, and\n        # otherwise raise SystemExit\n        path = os.path.abspath(self.path)\n\n        # Use an empty WorkingSet rather than the man\n        # pkg_resources.working_set, since on older versions of setuptools this\n        # will invoke a VersionConflict when trying to install an upgrade\n        ws = pkg_resources.WorkingSet([])\n        ws.add_entry(path)\n        dist = ws.by_key.get(DIST_NAME)\n\n        if dist is None:\n            # We didn't find an egg-info/dist-info in the given path, but if a\n            # setup.py exists we can generate it\n            setup_py = os.path.join(path, 'setup.py')\n            if os.path.isfile(setup_py):\n                with _silence():\n                    run_setup(os.path.join(path, 'setup.py'),\n                              ['egg_info'])\n\n                for dist in pkg_resources.find_distributions(path, True):\n                    # There should be only one...\n                    return dist\n\n        return dist\n\n    def _do_download(self, version='', find_links=None):\n        if find_links:\n            allow_hosts = ''\n            index_url = None\n        else:\n            allow_hosts = None\n            index_url = self.index_url\n\n        # Annoyingly, setuptools will not handle other arguments to\n        # Distribution (such as options) before handling setup_requires, so it\n        # is not straightforward to programmatically augment the arguments which\n        # are passed to easy_install\n        class _Distribution(Distribution):\n            def get_option_dict(self, command_name):\n                opts = Distribution.get_option_dict(self, command_name)\n                if command_name == 'easy_install':\n                    if find_links is not None:\n                        opts['find_links'] = ('setup script', find_links)\n                    if index_url is not None:\n                        opts['index_url'] = ('setup script', index_url)\n                    if allow_hosts is not None:\n                        opts['allow_hosts'] = ('setup script', allow_hosts)\n                return opts\n\n        if version:\n            req = '{0}=={1}'.format(DIST_NAME, version)\n        else:\n            req = DIST_NAME\n\n        attrs = {'setup_requires': [req]}\n\n        try:\n            if DEBUG:\n                _Distribution(attrs=attrs)\n            else:\n                with _silence():\n                    _Distribution(attrs=attrs)\n\n            # If the setup_requires succeeded it will have added the new dist to\n            # the main working_set\n            return pkg_resources.working_set.by_key.get(DIST_NAME)\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            msg = 'Error retrieving {0} from {1}:\\n{2}'\n            if find_links:\n                source = find_links[0]\n            elif index_url != INDEX_URL:\n                source = index_url\n            else:\n                source = 'PyPI'\n\n            raise Exception(msg.format(DIST_NAME, source, repr(e)))\n\n    def _do_upgrade(self, dist):\n        # Build up a requirement for a higher bugfix release but a lower minor\n        # release (so API compatibility is guaranteed)\n        next_version = _next_version(dist.parsed_version)\n\n        req = pkg_resources.Requirement.parse(\n            '{0}>{1},<{2}'.format(DIST_NAME, dist.version, next_version))\n\n        package_index = PackageIndex(index_url=self.index_url)\n\n        upgrade = package_index.obtain(req)\n\n        if upgrade is not None:\n            return self._do_download(version=upgrade.version)\n\n    def _check_submodule(self):\n        \"\"\"\n        Check if the given path is a git submodule.\n\n        See the docstrings for ``_check_submodule_using_git`` and\n        ``_check_submodule_no_git`` for further details.\n        \"\"\"\n\n        if (self.path is None or\n                (os.path.exists(self.path) and not os.path.isdir(self.path))):\n            return False\n\n        if self.use_git:\n            return self._check_submodule_using_git()\n        else:\n            return self._check_submodule_no_git()\n\n    def _check_submodule_using_git(self):\n        \"\"\"\n        Check if the given path is a git submodule.  If so, attempt to initialize\n        and/or update the submodule if needed.\n\n        This function makes calls to the ``git`` command in subprocesses.  The\n        ``_check_submodule_no_git`` option uses pure Python to check if the given\n        path looks like a git submodule, but it cannot perform updates.\n        \"\"\"\n\n        cmd = ['git', 'submodule', 'status', '--', self.path]\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except _CommandNotFound:\n            # The git command simply wasn't found; this is most likely the\n            # case on user systems that don't have git and are simply\n            # trying to install the package from PyPI or a source\n            # distribution.  Silently ignore this case and simply don't try\n            # to use submodules\n            return False\n\n        stderr = stderr.strip()\n\n        if returncode != 0 and stderr:\n            # Unfortunately the return code alone cannot be relied on, as\n            # earlier versions of git returned 0 even if the requested submodule\n            # does not exist\n\n            # This is a warning that occurs in perl (from running git submodule)\n            # which only occurs with a malformatted locale setting which can\n            # happen sometimes on OSX.  See again\n            # https://github.com/astropy/astropy/issues/2749\n            perl_warning = ('perl: warning: Falling back to the standard locale '\n                            '(\"C\").')\n            if not stderr.strip().endswith(perl_warning):\n                # Some other unknown error condition occurred\n                log.warn('git submodule command failed '\n                         'unexpectedly:\\n{0}'.format(stderr))\n                return False\n\n        # Output of `git submodule status` is as follows:\n        #\n        # 1: Status indicator: '-' for submodule is uninitialized, '+' if\n        # submodule is initialized but is not at the commit currently indicated\n        # in .gitmodules (and thus needs to be updated), or 'U' if the\n        # submodule is in an unstable state (i.e. has merge conflicts)\n        #\n        # 2. SHA-1 hash of the current commit of the submodule (we don't really\n        # need this information but it's useful for checking that the output is\n        # correct)\n        #\n        # 3. The output of `git describe` for the submodule's current commit\n        # hash (this includes for example what branches the commit is on) but\n        # only if the submodule is initialized.  We ignore this information for\n        # now\n        _git_submodule_status_re = re.compile(\n            '^(?P<status>[+-U ])(?P<commit>[0-9a-f]{40}) '\n            '(?P<submodule>\\S+)( .*)?$')\n\n        # The stdout should only contain one line--the status of the\n        # requested submodule\n        m = _git_submodule_status_re.match(stdout)\n        if m:\n            # Yes, the path *is* a git submodule\n            self._update_submodule(m.group('submodule'), m.group('status'))\n            return True\n        else:\n            log.warn(\n                'Unexpected output from `git submodule status`:\\n{0}\\n'\n                'Will attempt import from {1!r} regardless.'.format(\n                    stdout, self.path))\n            return False\n\n    def _check_submodule_no_git(self):\n        \"\"\"\n        Like ``_check_submodule_using_git``, but simply parses the .gitmodules file\n        to determine if the supplied path is a git submodule, and does not exec any\n        subprocesses.\n\n        This can only determine if a path is a submodule--it does not perform\n        updates, etc.  This function may need to be updated if the format of the\n        .gitmodules file is changed between git versions.\n        \"\"\"\n\n        gitmodules_path = os.path.abspath('.gitmodules')\n\n        if not os.path.isfile(gitmodules_path):\n            return False\n\n        # This is a minimal reader for gitconfig-style files.  It handles a few of\n        # the quirks that make gitconfig files incompatible with ConfigParser-style\n        # files, but does not support the full gitconfig syntax (just enough\n        # needed to read a .gitmodules file).\n        gitmodules_fileobj = io.StringIO()\n\n        # Must use io.open for cross-Python-compatible behavior wrt unicode\n        with io.open(gitmodules_path) as f:\n            for line in f:\n                # gitconfig files are more flexible with leading whitespace; just\n                # go ahead and remove it\n                line = line.lstrip()\n\n                # comments can start with either # or ;\n                if line and line[0] in (':', ';'):\n                    continue\n\n                gitmodules_fileobj.write(line)\n\n        gitmodules_fileobj.seek(0)\n\n        cfg = RawConfigParser()\n\n        try:\n            cfg.readfp(gitmodules_fileobj)\n        except Exception as exc:\n            log.warn('Malformatted .gitmodules file: {0}\\n'\n                     '{1} cannot be assumed to be a git submodule.'.format(\n                         exc, self.path))\n            return False\n\n        for section in cfg.sections():\n            if not cfg.has_option(section, 'path'):\n                continue\n\n            submodule_path = cfg.get(section, 'path').rstrip(os.sep)\n\n            if submodule_path == self.path.rstrip(os.sep):\n                return True\n\n        return False\n\n    def _update_submodule(self, submodule, status):\n        if status == ' ':\n            # The submodule is up to date; no action necessary\n            return\n        elif status == '-':\n            if self.offline:\n                raise _AHBootstrapSystemExit(\n                    \"Cannot initialize the {0} submodule in --offline mode; \"\n                    \"this requires being able to clone the submodule from an \"\n                    \"online repository.\".format(submodule))\n            cmd = ['update', '--init']\n            action = 'Initializing'\n        elif status == '+':\n            cmd = ['update']\n            action = 'Updating'\n            if self.offline:\n                cmd.append('--no-fetch')\n        elif status == 'U':\n            raise _AHBootstrapSystemExit(\n                'Error: Submodule {0} contains unresolved merge conflicts.  '\n                'Please complete or abandon any changes in the submodule so that '\n                'it is in a usable state, then try again.'.format(submodule))\n        else:\n            log.warn('Unknown status {0!r} for git submodule {1!r}.  Will '\n                     'attempt to use the submodule as-is, but try to ensure '\n                     'that the submodule is in a clean state and contains no '\n                     'conflicts or errors.\\n{2}'.format(status, submodule,\n                                                        _err_help_msg))\n            return\n\n        err_msg = None\n        cmd = ['git', 'submodule'] + cmd + ['--', submodule]\n        log.warn('{0} {1} submodule with: `{2}`'.format(\n            action, submodule, ' '.join(cmd)))\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except OSError as e:\n            err_msg = str(e)\n        else:\n            if returncode != 0:\n                err_msg = stderr\n\n        if err_msg is not None:\n            log.warn('An unexpected error occurred updating the git submodule '\n                     '{0!r}:\\n{1}\\n{2}'.format(submodule, err_msg,\n                                               _err_help_msg))"},{"id":56,"name":"logging.rst","nodeType":"TextFile","path":"docs","text":"**************\nLogging system\n**************\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, only 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('INFO')\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 ``[config.logging_helper]`` section\nof the Astropy configuration file::\n\n    [config.logging_helper]\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\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\nReference/API\n=============\n\n.. automodapi:: astropy.logger\n    :no-inheritance-diagram:\n\n"},{"id":57,"name":"stability.rst","nodeType":"TextFile","path":"docs","text":"******************************\nCurrent status of sub-packages\n******************************\n\nAstropy has benefited from the addition of widely tested legacy code, as well\nas new development, resulting in variations in stability across\nsub-packages. This document summarizes the current status of the Astropy\nsub-packages, so that users understand where they might expect changes in\nfuture, and which sub-packages they can safely use for production code.\n\nThe classification is as follows:\n\n.. raw:: html\n\n    <style>\n         .planned:before {\n              color: #cbcbcb;\n              content: \"⬤\";\n         }\n         .dev:before {\n              color: #ffad00;\n              content: \"⬤\";\n         }\n         .stable:before {\n              color: #4e72c3;\n              content: \"⬤\";\n         }\n         .mature:before {\n              color: #03a913;\n              content: \"⬤\";\n         }\n         .pendingdep:before {\n              color: #a84b03;\n              content: \"⬤\";\n         }\n         .deprecated:before {\n              color: #ff0000;\n              content: \"⬤\";\n         }\n    </style>\n\n    <table align='center'>\n      <tr>\n        <td align='center'><span class=\"planned\"></span></td>\n        <td>Planned</td>\n      </tr>\n      <tr>\n        <td align='center'><span class=\"dev\"></span></td>\n        <td>Actively developed, be prepared for possible significant changes.</td>\n      </tr>\n      <tr>\n        <td align='center'><span class=\"stable\"></span></td>\n        <td>Reasonably stable, any significant changes/additions will generally include backwards-compatiblity.</td>\n      </tr>\n      <tr>\n        <td align='center'><span class=\"mature\"></span></td>\n        <td>Mature.  Additions/improvements possible, but no major changes planned. </td>\n      </tr>\n      <tr>\n        <td align='center'><span class=\"pendingdep\"></span></td>\n        <td>Pending deprecation.  Might be deprecated in a future version.</td>\n      </tr>\n      <tr>\n        <td align='center'><span class=\"deprecated\"></span></td>\n        <td>Deprecated.  Might be removed in a future version.</td>\n      </tr>\n    </table>\n\nThe current planned and existing sub-packages are:\n\n.. raw:: html\n\n    <table border=\"1\" class=\"docutils stability\" align='center'>\n        <tr>\n            <th class=\"head\">\n                Sub-Package\n            </th>\n            <th class=\"head\">\n                &nbsp;\n            </th>\n            <th class=\"head\">\n                Comments\n            </th>\n        </tr>\n        <tr>\n            <td>\n                astropy.config\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                Configuration received major overhaul in v0.4. Since then on, the package has been stable.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.constants\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                Constants were changed to <tt class=\"docutils literal\"><span class=\"pre\">Quantity</span></tt> objects in v0.2. Since then on, the package has been stable, with occasional additions of new constants.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.convolution\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                New top-level package in v0.3 (was previously part of\n                <tt class=\"docutils literal\"><span class=\"pre\">astropy.nddata</span></tt>).\n                A major consistency improvement between fft/non-fft convolution, which is not fully backward-compatible, was added in 2.0.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.coordinates\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                New in v0.2, major changes in v0.4.  Subsequent versions should\n                maintain a stable/backwards-compatible API, following the plan of <a href=\"https://github.com/astropy/astropy-APEs/blob/master/APE5.rst\">APE 5</a>.  Further major additions/enhancements likely, but with basic framework unchanged.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.cosmology\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                Incremental improvements since v0.1, but mostly stable API.\n                Pure functional interface deprecated in v0.4.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.io.ascii\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                Originally developed as <tt class=\"docutils literal\"><span class=\"pre\">asciitable</span></tt>, and has maintained a stable API.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.io.fits\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                Originally developed as <tt class=\"docutils literal\"><span class=\"pre\">pyfits</span></tt>, and retains an API consistent with the standalone version.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.io.misc\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                 The functionality that is currently present is stable, but this sub-package will likely see major additions in future.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.io.votable\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                Originally developed as <tt class=\"docutils literal\"><span class=\"pre\">vo.table</span></tt>, and has a stable API.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.modeling\n            </td>\n            <td align='center'>\n                <span class=\"dev\"></span>\n            </td>\n            <td>\n                New in v0.3.  Major changes in v1.0, significant additions planned.  Backwards-compatibility likely to be maintained, but not guaranteed.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.nddata\n            </td>\n            <td align='center'>\n                <span class=\"dev\"></span>\n            </td>\n            <td>\n                Significantly revised in v1.0 to implement <a href=\"https://github.com/astropy/astropy-APEs/blob/master/APE7.rst\">APE 7</a>. Major changes in the API are not anticipated, broader use may reveal flaws that require API changes.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.samp\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                Virtual Observatory service access: SAMP. This was renamed from astropy.vo.samp to astropy.samp in 2.0.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.stats\n            </td>\n            <td align='center'>\n                <span class=\"dev\"></span>\n            </td>\n            <td>\n                Likely to maintain backwards-compatibility, but functionality continually being expanded, so significant additions likely in the future.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.table\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                Incremental improvements since v0.1, but mostly stable API.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.time\n            </td>\n            <td align='center'>\n                <span class=\"mature\"></span>\n            </td>\n            <td>\n                Incremental improvements since v0.1, API likely to remain stable\n                for the foreseeable future.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.units\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                New in v0.2. Current functionality stable with intent to maintain backwards compatibility. Significant new functionality, in particular to allow dealing with uncertainties, is likely to be added in future versions.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.utils\n            </td>\n            <td align='center'>\n                <span class=\"dev\"></span>\n            </td>\n            <td>\n                Contains mostly utilities destined for internal use with other parts of Astropy.  Existing functionality generally stable, but regular additions and occasional changes.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.visualization\n            </td>\n            <td align='center'>\n                <span class=\"dev\"></span>\n            </td>\n            <td>\n                New in v1.0, and in development.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.visualization.wcsaxes\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                New in v1.3. Originally developed as <tt class=\"docutils literal\"><span class=\"pre\">wcsaxes</span></tt> and has maintained a stable API.\n            </td>\n        </tr>\n        <tr>\n            <td>\n                astropy.wcs\n            </td>\n            <td align='center'>\n                <span class=\"stable\"></span>\n            </td>\n            <td>\n                Originally developed as <tt class=\"docutils literal\"><span class=\"pre\">pywcs</span></tt>, and has a stable API for now. However, there are plans to generalize the WCS interface to accommodate non-FITS WCS transformations, and this may lead to small changes in the user interface.\n            </td>\n        </tr>\n    </table>\n"},{"col":4,"comment":"null","endLoc":250,"header":"def setup(app)","id":58,"name":"setup","nodeType":"Function","startLoc":246,"text":"def setup(app):\n        app.warn('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.')"},{"col":4,"comment":"null","endLoc":211,"header":"def __init__(self, path=None, index_url=None, use_git=None, offline=None,\n                 download_if_needed=None, auto_upgrade=None)","id":59,"name":"__init__","nodeType":"Function","startLoc":171,"text":"def __init__(self, path=None, index_url=None, use_git=None, offline=None,\n                 download_if_needed=None, auto_upgrade=None):\n\n        if path is None:\n            path = PACKAGE_NAME\n\n        if not (isinstance(path, _str_types) or path is False):\n            raise TypeError('path must be a string or False')\n\n        if PY3 and not isinstance(path, _text_type):\n            fs_encoding = sys.getfilesystemencoding()\n            path = path.decode(fs_encoding)  # path to unicode\n\n        self.path = path\n\n        # Set other option attributes, using defaults where necessary\n        self.index_url = index_url if index_url is not None else INDEX_URL\n        self.offline = offline if offline is not None else OFFLINE\n\n        # If offline=True, override download and auto-upgrade\n        if self.offline:\n            download_if_needed = False\n            auto_upgrade = False\n\n        self.download = (download_if_needed\n                         if download_if_needed is not None\n                         else DOWNLOAD_IF_NEEDED)\n        self.auto_upgrade = (auto_upgrade\n                             if auto_upgrade is not None else AUTO_UPGRADE)\n\n        # If this is a release then the .git directory will not exist so we\n        # should not use git.\n        git_dir_exists = os.path.exists(os.path.join(os.path.dirname(__file__), '.git'))\n        if use_git is None and not git_dir_exists:\n            use_git = False\n\n        self.use_git = use_git if use_git is not None else USE_GIT\n        # Declared as False by default--later we check if astropy-helpers can be\n        # upgraded from PyPI, but only if not using a source distribution (as in\n        # the case of import from a git submodule)\n        self.is_submodule = False"},{"col":0,"comment":"Install Setuptools.","endLoc":66,"header":"def _install(archive_filename, install_args=())","id":60,"name":"_install","nodeType":"Function","startLoc":57,"text":"def _install(archive_filename, install_args=()):\n    \"\"\"Install Setuptools.\"\"\"\n    with archive_context(archive_filename):\n        # installing\n        log.warn('Installing Setuptools')\n        if not _python_cmd('setup.py', 'install', *install_args):\n            log.warn('Something went wrong during the installation.')\n            log.warn('See the error message above.')\n            # exitcode will be 2\n            return 2"},{"id":61,"name":"docs/io","nodeType":"Package"},{"id":62,"name":"misc.rst","nodeType":"TextFile","path":"docs/io","text":"***********************************************************\nMiscellaneous: HDF5, YAML, ASDF, 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\n.. automodapi:: astropy.io.misc.hdf5\n\n.. automodapi:: astropy.io.misc.yaml\n\n.. automodapi:: astropy.io.misc.asdf\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":63,"name":"package_info","nodeType":"Attribute","startLoc":42,"text":"package_info"},{"id":64,"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\n          to define their own custom readers/writers. Users who want to find\n          out more about what built-in formats are supported by\n          :class:`~astropy.table.Table` by default should see\n          :ref:`table_io`. No built-in formats are currently defined for\n          :class:`~astropy.nddata.NDData`, but this will be added in\n          future).\n\nIntroduction\n============\n\nThe I/O registry is a sub-module used to define the readers/writers available\nfor the :class:`~astropy.table.Table` and\n:class:`~astropy.nddata.NDData` classes.\n\nUsing `astropy.io.registry`\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 sub-classes). For demonstration,\nlet's 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 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 simplistic 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    from astropy.extern import six\n\n    def identify_mtf(origin, *args, **kwargs):\n        return (isinstance(args[0], six.string_types) and\n                os.path.splitext(args[0].lower())[1] == '.mtf')\n\n.. note:: Identifier functions should be prepared for arbitrary input - in\n          particular, the first argument may not be a filename or file\n          object, so it 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\nWriter functons should take a dataset object (either an instance of the\n:class:`~astropy.table.Table` or :class:`~astropy.nddata.NDData`\nclasses or sub-classes), 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 simply\ndo::\n\n   t.write('catalog_new.mtf')\n\nReference/API\n=============\n\n.. automodapi:: astropy.io.registry\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":65,"name":"entry_points","nodeType":"Attribute","startLoc":48,"text":"entry_points"},{"attributeType":"null","col":0,"comment":"null","endLoc":67,"id":66,"name":"min_numpy_version","nodeType":"Attribute","startLoc":67,"text":"min_numpy_version"},{"id":67,"name":"unified.rst","nodeType":"TextFile","path":"docs/io","text":".. _table_io:\n\nUnified file read/write interface\n***********************************\n\nAstropy provides a unified interface for reading and writing data in different formats.\nFor many common cases this will simplify the process of file I/O and reduce the need to\nmaster the separate details of all the I/O packages within Astropy.  This functionality is\nstill in active development and the number of supported formats will be increasing.  For\ndetails on the implementation see :ref:`io_registry`.\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\nTo use this interface, first import the :class:`~astropy.table.Table` class, then\nsimply 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\nIt is possible to load tables directly from the Internet using URLs. For example,\ndownload tables from Vizier catalogues in 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\")  # 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\nSimilarly, for writing, 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\nAny additional arguments specified will depend on the format.  For examples of this see the\nsection `Built-in table readers/writers`_.  This section also provides the full list of\nchoices for the ``format`` argument.\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\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.. _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`, and :ref:`table_io_votable`.\n\nA full list of the supported formats and corresponding classes\nis shown in the table below.\nThe ``Write`` column indicates those formats that support write functionality, and\nthe ``Suffix`` column indicates the filename suffix indicating a particular format.\nIf the value of ``Suffix`` is ``auto``, the format is auto-detected from the file itself.\nNot all formats support auto-detection.\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.no_header    Yes          :class:`~astropy.io.ascii.NoHeader`: Basic table with no headers\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                    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.  For example:\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 example, to change\ncolumn delimiter and the output format for the ``colc`` column 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 a specific ASCII table format using the unified interface, the format name is\n   prefixed with ``ascii`` in order to identify the format as ASCII-based.  Compare the\n   table above to the `astropy.io.ascii` list of :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   For compatibility with astropy version 0.2 and earlier, the following format\n   values are also allowed in ``Table.read()``: ``daophot``, ``ipac``, ``html``, ``latex``, and ``rdb``.\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 will be\nread 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\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\nAt this time there is no support for appending an HDU to an existing\nfile or writing multi-HDU files using the Table interface. Instead one\ncan 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\nAs of astropy version 3.0 there is support for writing a table which contains\n:ref:`mixin_columns` such as `~astropy.time.Time` or\n`~astropy.coordinates.SkyCoord`.  This uses FITS ``COMMENT`` cards to capture\nadditional information needed order to fully reconstruct the mixin columns when\nreading back from FITS.  The information is a Python `dict` structure which is\nserialized 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 one 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('{0} = {1}'.format(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 simply 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\nAstropy 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 mapping\nof these data components and object attributes to the appropriate FITS table\ncolumns and keywords.  Thus, a well defined protocol has been developed to allow\nthe 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\nAstropy provides the following features for reading and writing ``Time``:\n\n- Writing and reading `~astropy.time.Time` Table columns to and from FITS tables\n- Reading time coordinate columns in FITS tables (compliant with the time standard) as\n  `~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 be\ndone using the FITS time standard by setting the necessary FITS header keywords.\n\nThe default behaviour for reading a FITS table into an `~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 one can indicate these\nshould be used by passing ``astropy_native=True`` (for backwards compatibility,\nthis is not done by default). This will convert columns conforming to the\nFITS time standard to `~astropy.time.Time` instances, avoiding any loss of\nprecision. For 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    ...               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\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 compliant\nfiles, 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 supported\nby Astropy; a thorough examination of the FITS standard time-related keywords is\ndone 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 keywords,\ntime coordinate columns are identified and read as `~astropy.time.Time` objects.\nRefer to :ref:`fits_time_column` for the specification of these keywords and their\ndescription.\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 pre-dates 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\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)\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* String time column in ISO-8601 Datetime format\n\nFITS uses a subset of ISO-8601 (which in itself does not imply a particular time scale)\nfor several time-related keywords, such as DATE-xxx. Following the FITS standard its\nvalues must be written as a character string in the following ``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 follows:\n\nA time column is identified using the time coordinate frame keywords as described in\n:ref:`fits_time_column`. Once it has been identified, its datatype is checked in order\nto determine its representation format. Since ISO-8601 ``datetime`` format is the only\nstring representation of time, a time coordinate column having string datatype will be\nautomatically read as a `~astropy.time.Time` object with ``format='fits'`` ('fits'\nrepresents the FITS ISO-8601 format).\n\nAs this format does not imply a particular time scale, it is determined using the time\nscale keywords in the header (``TCTYP`` or ``TIMESYS``) or their defaults. The other time\ncoordinate information is also determined in the same way, using the time coordinate\nframe keywords. All ISO-8601 times are relative to a globally accepted zero point\n(year 0 corresponds to 1 BCE) and are thus are not relative to the reference time\nkeywords (MJDREF, JDREF or DATEREF). Hence, these keywords will be ignored while dealing\nwith ISO-8601 time columns.\n\n.. note::\n\n   Reading FITS files with time coordinate columns *may* fail. Astropy supports\n   a large subset of these files, but there are still some FITS files which are\n   not compliant with any aspect of the standard.\n   If you have such a file, please don't hesitate to let us know, e.g., by opening\n   an issue in the `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<http://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``.\nRound-tripping of Astropy written FITS binary tables containing time coordinate\ncolumns has been partially achieved by mapping selected metadata, ``scale`` and\nsingular ``location`` of `~astropy.time.Time`, to corresponding keywords.  Note\nthat the arbitrary metadata allowed in `~astropy.table.Table` objects within\nthe ``meta`` dict is not written and will be lost.\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 conversion\n``mjd --> (jd1, jd2) --> jd``. Thus, the final conversion from ``(jd1, jd2)`` will\nrequire a software implementation which is fully compliant with 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\nportability. 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 using a special\n``info.serialize_method`` attribute, as in the following 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['a'].info.serialize_method['fits'] = 'formatted_value'\n    >>> t.write('my_table.fits', overwrite=True)\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['fits']`` in a Time column ``info`` is equal to\n``'jd1_jd2'``, that is, Time column will be written in full precision.\n\n.. note::\n\n   The Astropy `~astropy.time.Time` object does not precisely map to the FITS\n   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   * LOCATION\n\n     In Astropy Time, location can be an array which is broadcastable to the\n     Time values. In the FITS standard, location is a scalar expressed via\n     keywords.\n\n   Hence the ``format`` attribute and a vector ``location`` attribute are not\n   stored.  After reading from FITS the user must set the ``format`` as desired.\n\n.. doctest-skip-all\n\n.. _table_io_hdf5:\n\nHDF5\n----\n\n.. _HDF5: http://www.hdfgroup.org/HDF5/\n.. _h5py: http://www.h5py.org/\n\nReading/writing from/to HDF5_ files is\nsupported with ``format='hdf5'`` (this requires h5py_\nto be installed). However, the ``.hdf5``\nfile extension is automatically recognized when writing files, and HDF5 files\nare automatically identified (even with a different extension) when reading\nin (using the first few bytes of the file to identify the format), so in most\ncases you will not need 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.\nFor example, to read a table called ``data`` from an HDF5 file named\n``observations.hdf5``, you 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\nMetadata and mixin columns\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAstropy 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 of 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~~~~~~~~~~~~~~\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\nAs of astropy 3.0, by specifying ``serialize_meta=True`` one can also store to\nHDF5 tables that contain :ref:`mixin_columns` such as `~astropy.time.Time` or\n`~astropy.coordinates.SkyCoord` columns.\n\ncompatibility_mode\n~~~~~~~~~~~~~~~~~~\n\nThe way metadata are saved in the HDF5 dataset has changed in astropy 3.0.\nPreviously the metadata were serialized with YAML and this was stored as an\nHDF5 attribute.  This process was subject to a fixed limit on the size of an\nattribute.  Starting with 3.0 the YAML-serialized metadata are stored as a\nseparate dataset as described above, with no size limit.\n\nFiles using the old convention are automatically recognized and will always be read\ncorrectly.\n\nIf for some reason the user needs to *write* in the old format, they should\nspecify the deprecated ``compatibility_mode`` keyword::\n\n    >>> t.write('observations.hdf5', path='updated_data', serialize_meta=True,\n    ...         compatibility_mode=True)\n\n.. warning:: The ``compatibility_mode`` keyword will be removed in a future\n   version of astropy so your code should be changed.\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,\npagination).\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\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\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"},{"id":68,"name":"docs/io/fits","nodeType":"Package"},{"id":69,"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.\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 PyFITS,\nthis is where you should start.  See also the :ref:`FAQ <io-fits-faq>` for\nanswers to common questions/issues.\n\n.. note::\n\n    If you want to read or write a single table in FITS format then the\n    simplest method is often 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\nOnce the `astropy.io.fits` package is loaded using the standard convention\n[#f1]_, we can open an existing FITS file::\n\n    >>> # Generally you would store the filename as string but in case you\n    >>> # have no suitable FITS files you can use the ones shipped with Astropy\n    >>> # like this:\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 is using 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's\n(generally) the preferred way to open a file in Python, because it will close\nthe file even if an exception happens.\n\nThe headers will still be accessible after the HDUList is closed. The data may\nor may 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.\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-3 GB cannot be mmap'd (which is fine,\nbecause by that point you're 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 means that\n    when the HDU data is accessed (i.e. ``hdul[0].data``) another handle to the FITS file\n    is opened by mmap. This means that even after calling ``hdul.close()`` the mmap still\n    holds an open handle to the data so that it can still be accessed by unwary programs\n    that were built with the assumption that the .data attribute has all the data in-memory.\n\n    In order to force the mmap to close either wait for the containing ``HDUList`` object to go\n    out of scope, or manually call ``del hdul[0].data`` (this works so long as there are no other\n    references 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\nAstropy 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).  In Astropy versions prior\nto v1.1.0 this was *not* applied automatically, and it is necessary to pass the\nargument ``uint=True`` to :func:`open`.  In v1.1.0 or later this is the\ndefault.\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're 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 with working with compressed files. For example with Zip\nfiles that contain multiple compressed files, only the first file will be accessible.\nAlso bzip does not support the append or update access modes.\n\nWhen writing a file (e.g. with the :func:`writeto` function), compression will be\ndetermined based on the filename extension given, or the compression used in a\npre-existing file that is being written to.\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 the\nvalue associated with a header keyword, simply do (a 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 (a la Python lists)::\n\n    >>> hdul[0].header[7]\n    32768.0\n\nThis example returns the 8th (like Python lists, it is 0-indexed) keyword's\nvalue--a float--32768.0.\n\nSimilarly, it is easy to update a keyword's value in Astropy, either through\nkeyword 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, one 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's 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), simply 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 simply ``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 linebreaks between cards.  This is a common\nsource of confusion for new users.\n\nIt's 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\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 details\non 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; e.g.::\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, e.g.::\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; i.e. for a 2-D\nimage, the fast axis (X-axis) which corresponds to the FITS NAXIS1 keyword, is\nthe second index. Similarly, the 1-indexed sub-section 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 sub-section::\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 sub-section\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 the changes you made and write it to\na new file, you can use the :meth:`HDUList.writeto` method (see below).\n\n.. _Numpy documentation: https://docs.scipy.org/doc/numpy/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 simple cases, however, the\nhigh-level :ref:`table_io` will often suffice and is somewhat easier to use.\nSee 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\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, let's 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;\ne.g.::\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'll have the entire arsenal of Numpy\ntools 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 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 easy in\nAstropy for an image HDU. We'll first demonstrate how to create a FITS file\nconsisting 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 a 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's it! In fact, Astropy even provides a shortcut for the last two lines to\naccomplish 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 simple **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 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'll 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 :class:`Column` object explicitly\n    if the data is stored in a\n    `structured array <https://docs.scipy.org/doc/numpy/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\nOf course, you can do this 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`.\n\nFor example, first create a new :class:`Header` object to encapsulate any\nkeywords you want to include in the primary HDU, then as before create a\n:class:`PrimaryHDU`::\n\n    >>> hdr = fits.Header()\n    >>> hdr['OBSERVER'] = 'Edwin Hubble'\n    >>> hdr['COMMENT'] = \"Here's some commentary about this FITS file.\"\n    >>> primary_hdu = 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 a HDUList containing both the primary HDU and the newly created\ntable extension, and write to a new file::\n\n    >>> hdul = fits.HDUList([primary_hdu, hdu])\n    >>> hdul.writeto('table4.fits')\n\nAlternatively, we can append the table to the HDU list we already created in\nthe image file section::\n\n    >>> hdul.append(hdu)\n    >>> hdul.writeto('image_and_table.fits')\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\nSo far, we have covered the most basic features of `astropy.io.fits`. In the\nfollowing chapters we'll show more advanced examples and explain options in\neach class and method.\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 simple task.\nBy using these \"convenience\" functions, a user does not have to worry about\nopening or closing a file, all the housekeeping is done implicitly.\n\n.. warning::\n\n    These functions are useful for interactive Python sessions and simple\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 3rd argument can be the header associated with the data. If\nthe 3rd 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 COMMMENT 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 subpackages 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 re-writes\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\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":70,"name":"docs/io/fits/api","nodeType":"Package"},{"id":71,"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"},{"col":0,"comment":"\n    Unzip filename to a temporary directory, set to the cwd.\n\n    The unzipped target is cleaned up after.\n    ","endLoc":129,"header":"@contextlib.contextmanager\ndef archive_context(filename)","id":72,"name":"archive_context","nodeType":"Function","startLoc":98,"text":"@contextlib.contextmanager\ndef archive_context(filename):\n    \"\"\"\n    Unzip filename to a temporary directory, set to the cwd.\n\n    The unzipped target is cleaned up after.\n    \"\"\"\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        try:\n            with ContextualZipFile(filename) as archive:\n                archive.extractall()\n        except zipfile.BadZipfile as err:\n            if not err.args:\n                err.args = ('', )\n            err.args = err.args + (\n                MEANINGFUL_INVALID_ZIP_ERR_MSG.format(filename),\n            )\n            raise\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n        yield\n\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)"},{"id":73,"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 5 options for the ``output_verify`` argument of the following methods\nof :class:`HDUList`: :meth:`~HDUList.close`, :meth:`~HDUList.writeto`, and\n:meth:`~HDUList.flush`, or the :meth:``~_BaseHDU.writeto`` method on any HDU\nobject.  In these cases, the verification option is passed to a :meth:``verify``\ncall within these methods.\n\nexception\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\nignore\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\nfix\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 violation: 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's 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\nAstropy 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 make\nthe fix in such a way that it will not throw off other FITS readers.\n\nsilentfix\n=========\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\nwarn\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":74,"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":75,"name":"hdus.rst","nodeType":"TextFile","path":"docs/io/fits/api","text":".. currentmodule:: astropy.io.fits\n\nHeader Data Units\n*****************\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":76,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":68,"id":77,"name":"setup_requires","nodeType":"Attribute","startLoc":68,"text":"setup_requires"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":78,"name":"install_requires","nodeType":"Attribute","startLoc":75,"text":"install_requires"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":79,"name":"extras_require","nodeType":"Attribute","startLoc":77,"text":"extras_require"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":80,"name":"setup_requires","nodeType":"Attribute","startLoc":84,"text":"setup_requires"},{"col":0,"comment":"","endLoc":4,"header":"setup.py#<anonymous>","id":81,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"NAME = 'astropy'\n\nVERSION = '3.0.dev'\n\nRELEASE = 'dev' not in VERSION\n\nif not RELEASE:\n    VERSION += get_git_devstr(False)\n\ncmdclassd = register_commands(NAME, VERSION, RELEASE)\n\ngenerate_version_py(NAME, VERSION, RELEASE, get_debug_option(NAME),\n                    uses_git=not RELEASE)\n\npackage_info = get_package_info()\n\npackage_info['package_data'].setdefault('astropy', []).append('data/*')\n\nentry_points = {}\n\nentry_points['console_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',\n]\n\nentry_points['asdf_extensions'] = [\n    'astropy = astropy.io.misc.asdf.extension:AstropyExtension',\n    'astropy-asdf = astropy.io.misc.asdf.extension:AstropyAsdfExtension',\n]\n\nmin_numpy_version = 'numpy>=' + astropy.__minimum_numpy_version__\n\nsetup_requires = [min_numpy_version]\n\nif not os.path.exists(os.path.join(os.path.dirname(__file__), 'PKG-INFO')):\n    setup_requires.extend(['cython>=0.21', 'jinja2>=2.7'])\n\ninstall_requires = [min_numpy_version]\n\nextras_require = {\n    'test': ['pytest-astropy']\n}\n\nif is_distutils_display_option():\n    setup_requires = []\n\nsetup(name=NAME,\n      version=VERSION,\n      description='Community-developed python astronomy tools',\n      requires=['numpy'],  # scipy not required, but strongly recommended\n      setup_requires=setup_requires,\n      install_requires=install_requires,\n      extras_require=extras_require,\n      provides=[NAME],\n      author='The Astropy Developers',\n      author_email='astropy.team@gmail.com',\n      license='BSD',\n      url='http://astropy.org',\n      long_description=astropy.__doc__,\n      keywords=['astronomy', 'astrophysics', 'cosmology', 'space', 'science',\n                'units', 'table', 'wcs', 'samp', 'coordinate', 'fits',\n                'modeling', 'models', 'fitting', 'ascii'],\n      classifiers=[\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      cmdclass=cmdclassd,\n      zip_safe=False,\n      entry_points=entry_points,\n      python_requires='>=' + astropy.__minimum_python_version__,\n      tests_require=['pytest-astropy'],\n      **package_info\n)"},{"id":82,"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":83,"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":84,"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":85,"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":86,"name":"docs/io/fits/usage","nodeType":"Package"},{"id":87,"name":"scripts.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":"Executable Scripts\n******************\n\nAstropy 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 program\nusage 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 ``fitscheck --help`` to see the full program\nusage documentation.\n"},{"id":88,"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'll 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 table 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    simplest method is often via the high-level :ref:`table_io`.  In particular\n    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. Here is a simple example of 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 3 records (rows) and 4 fields (columns). The first\nfield is a short integer, second a character string (of length 20), third a\nfloating point number, and fourth a character string (of length 10). Each\nrecord 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.  One 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.  To recap, the simple example in the Quick Tutorial::\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 while\nthe 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 ommitted 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\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\nIn the next example, assuming the table's second field having the name\n'magnitude', an output table containing all the records of magnitude > -0.5 from\nthe input table is generated::\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\n\nMerging Tables\n--------------\n\nMerging different tables is straightforward in Astropy. Simply merge the column\ndefinitions 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 don't 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\nA simpler 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's worth, but one 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\nAppending Tables\n----------------\n\nAppending one table after another is slightly trickier, since the two tables\nmay have different field attributes. Here are two examples. The first is to\nappend by field indices, the second one is to append by field names. In both\ncases, the output table will inherit column attributes (name, format, etc.) of\nthe 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\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 the scalings are done for the user, so the user only sees the physical\ndata. Thus, this 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                  4\n    A                        character                       1\n    E                        single precision floating point 4\n    D                        double precision floating point 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'll 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\n\nHere are a few Columns using various combination of these arguments::\n\n    >>> counts = np.array([312, 334, 308, 317])\n    >>> names = np.array(['NGC1', 'NGC2', 'NGC3', 'NGC4'])\n    >>> col1 = fits.Column(name='target', format='10A', array=names)\n    >>> col2 = fits.Column(name='counts', format='J', unit='DN', array=counts)\n    >>> col3 = fits.Column(name='notes', format='A10')\n    >>> col4 = fits.Column(name='spectrum', format='1000E')\n    >>> col5 = fits.Column(name='flag', format='L', array=[True, False, True, True])\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 c4, each cell is\nan array (a numpy array) of 1000 elements.\n\nFor character string fields, the number be to the *left* of the letter 'A' when\ncreating binary tables, and should be to the *right* when creating ASCII\ntables.  However, as this is a common confusion both formats are understood\nwhen creating binary tables (note, however, that upon writing to a file the\ncorrect format will be written in the header).  So, for columns c1 and c3, they\nboth have 10 characters in each of their cells. For numeric data type, the\ndimension 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])\n    >>> hdu = fits.BinTableHDU.from_columns(coldefs)\n\nor directly use the :meth:`BinTableHDU.from_columns` method::\n\n    >>> hdu = fits.BinTableHDU.from_columns([col1, col2, col3, col4, col5])\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.  They just make it\n    more explicit what type of table HDU they create.\n\nA look of 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  =                 4025 / 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 =                    5 / number of table fields\n    TTYPE1  = 'target  '\n    TFORM1  = '10A     '\n    TTYPE2  = 'counts  '\n    TFORM2  = 'J       '\n    TUNIT2  = 'DN      '\n    TTYPE3  = 'notes   '\n    TFORM3  = '10A     '\n    TTYPE4  = 'spectrum'\n    TFORM4  = '1000E   '\n    TTYPE5  = 'flag    '\n    TFORM5  = 'L       '\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 simply 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 won't be necessary.\n\n.. _fits_time_column:\n\nFITS Table with Time Columns\n============================\n\nThe `FITS Time standard paper\n<http://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\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\nHowever, the FITS standard and the Astropy Time object are not perfectly mapped\nand some compromises must be made.  To help the user understand how the Astropy\ncode deals with these situations, the following text describes the approach\nthat 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<http://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 the metadata is the time scale which is a specification\n  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 multiple time\n  columns in the same table, we need to adjust the reference times for the columns\n  using some other keywords.\n\n  The reference point in time shall be specified through one of the three following\n  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 is present, there is no problem as long as all\n     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 need to\n     use ``TCRVLn`` (time coordinate reference value) keyword to compensate for the\n     time scale differences.\n\n* TIME REFERENCE POSITION\n\n  The reference position, specified by the keyword ``TREFPOS``, specifies the spatial\n  location at which the time is valid, either where the observation was made or\n  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 a point\n  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 reference\n  direction that is used in calculating the pathlength delay should be provided\n  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 location\n  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 just 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 just 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"},{"id":89,"name":"verification.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nVerification\n************\n\nAstropy has built in a flexible scheme to verify FITS data being conforming to\nthe FITS standard. The basic verification philosophy in Astropy is to be\ntolerant in input and strict in output.\n\nWhen Astropy reads a FITS file which is not conforming 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 sub-standard\n(dialect?) and some of these become so prevalent that they 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 3 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. In\naddition, 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 non-standard formatting is read and the user wants\n   to copy or write out to an output file. The non-standard formatting will be\n   preserved in the output file.\n\n2. A user wants to create a non-standard 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 will\nnot 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 make\nthe 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, as of Astropy version 0.4.0 the following 'combined' options are\navailable:\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'll examine what Astropy's verification does at the three different levels:\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 second or later HDU in the HDU list is not a Primary HDU. Violation\n   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.. doctest-skip::\n\n    >>> hdu.header               # has a 'bad' header\n    SIMPLE =                     T /\n    NAXIS  =                     0\n    BITPIX =                     8 /\n    >>> hdu.verify('fix')        # fix it\n    Output verification result:\n    'BITPIX' card at the wrong place (card 2). Fixed by moving it to the right\n    place (card 1).\n    >>> hdu.header                 # voila!\n    SIMPLE =                     T / conforms to FITS standard\n    BITPIX =                     8 / array data type\n    NAXIS  =                     0\n\n\nVerification at Each Card\n-------------------------\n\nThe lowest level, the Card, also has the most complicated verification\npossibilities. Here is a lit 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 9 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 9 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')\n    >>> print(c)\n    FIX6    = '2 10    '\n\nUnfixable Cards:\n\n1. illegal characters in keyword name\n\nWe'll summarize the verification with a \"life-cycle\" example:\n\n.. doctest-skip::\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['P.I.'] = 'Hubble'\n    ValueError: Illegal keyword name 'P.I.'\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')\n    Output verification result:\n    HDU 0:\n      Card 4:\n        Unfixable error: Illegal keyword name 'P.I.'\n    ......\n      raise VerifyError\n    VerifyError\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    >>> hdus = fits.open('pi.fits')\n    >>> hdus[0].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    P.I.   = 'Hubble'\n    >>> # even when you try to access the offending keyword, it does NOT\n    >>> # complain\n    >>> hdus[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    >>> hdus.verify()\n    Output verification result:\n    HDU 0:\n      Card 4:\n        Unfixable error: Illegal keyword name 'P.I.'\n\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 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 verify\nHDU checksums when a file is opened or generate checksum values when a file is\nwritten.  In fact, CHECKSUM and DATASUM cards are automatically removed from\nHDU headers when a file is opened, and any CHECKSUM or DATASUM cards are\nstripped from headers when a 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\nHere are some examples:\n\n.. doctest-skip::\n\n     >>> # Open the file pix.fits verifying the checksum values for all HDUs\n     >>> hdul = fits.open('pix.fits', checksum=True)\n\n.. doctest-skip::\n\n     >>> # Open the file in.fits where checksum verification fails for the\n     >>> # primary HDU\n     >>> hdul = fits.open('in.fits', checksum=True)\n     Warning:  Checksum verification failed for HDU #0.\n\n.. doctest-skip::\n\n     >>> # Create file out.fits containing an HDU constructed from data and\n     >>> # header containing both CHECKSUM and DATASUM cards.\n     >>> fits.writeto('out.fits', data, header, checksum=True)\n\n.. doctest-skip::\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('out.fits', checksum='datasum')\n\n.. doctest-skip::\n\n     >>> # Create file out.fits containing the HDU hdu with both CHECKSUM\n     >>> # and DATASUM cards in the header\n     >>> hdu.writeto('out.fits', checksum=True)\n\n.. doctest-skip::\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('existingfile.fits', data, checksum=True)\n\n"},{"id":90,"name":"image.rst","nodeType":"TextFile","path":"docs/io/fits/usage","text":".. currentmodule:: astropy.io.fits\n\nImage Data\n**********\n\nIn this chapter, we'll 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. In Astropy, for most\ncases, it is just a simple numpy array, having the shape specified by the NAXIS\nkeywords and the data type specified by the BITPIX keyword - unless the data is\nscaled, see next section. Here is a quick cross reference between allowed\nBITPIX 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    -32       numpy.float32\n    -64       numpy.float64\n\nTo recap the fact that 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\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\nScaled Data\n===========\n\nSometimes an image is scaled, i.e. 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 scaled image is to store unsigned 16-bit\ninteger data because FITS standard does not allow it. In this case, the stored\ndata is signed 16-bit integer (BITPIX=16) with BZERO=32768 (:math:`2^{15}`),\nBSCALE=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 array of\nthe same data type specified by the BITPIX keyword. For scaled image, the\n``.data`` attribute will be the physical data, i.e. already transformed from\nthe storage data and may not be the same data type as prescribed in BITPIX.\nThis means an extra step of copying is needed and thus the corresponding memory\nrequirement.  This also means that the advantage of memory mapping is reduced\nfor 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``). Here is an example of what happens to such a file,\nbefore and after the data is touched::\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 Astropy,\n    is that when accessing the data via the ``.data`` attribute, the data is\n    automatically scaled with the BZERO and BSCALE parameters.  If the file was\n    opened in \"update\" mode, it will be saved with the rescaled data.  This\n    surprising behavior is a compromise to err on the side of not losing data:\n    If some floating point calculations were made on the data, rescaling it\n    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    One may also manually reapply scale parameters by using ``hdu.scale()``\n    (see below).  Alternately, one 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\nWriting Scaled Image Data\n-------------------------\n\nWith the extra processing and memory requirement, we discourage use of scaled\ndata as much as possible. However, Astropy does provide ways to write scaled\ndata with the `~ImageHDU.scale` method. Here are a few examples::\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\n    >>> hdu.scale('int32', 'minmax')\n    >>> # scale the data, using the original BSCALE/BZERO\n    >>> hdu.scale('int32', 'old')\n    >>> hdul.close()\n\nThe first example above shows how to store an unsigned short integer array.\n\nGreat caution 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.. _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\nimages(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 not\nas necessary as it used to be for handling very large images.  However, if the\nimage's data is scaled with non-trivial BSCALE/BZERO values, accessing the data\nin sections may still be necessary under the current implementation.  Memmap is\nalso 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\nHere is an example of getting the median image from 3 input images of the size\n5000x5000.\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 to.  Any modifications made to a data\nsection are not saved back to the original file.\n"},{"id":91,"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\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\nFor example the :class:`HeaderDiff` class cam 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"},{"id":92,"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 as well as examples will\nbe explained for manipulating FITS headers, image/array data, and table data\nrespectively.\n\n\nHeader of an HDU\n================\n\nEvery HDU normally has two components: header and data. In Astropy these two\ncomponents are accessed through the two attributes of the HDU,\n``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\nLike 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        >>> hdr.insert(20, ('DARKCORR', 'OMIT', 'Dark Image Subtraction'))\n\n      This inserts the DARKCORR keyword before the 20th keyword in the header\n      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 4th and 5th 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 they 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 one\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 the same ways that values are accessed, whether\nby keyword name or card index.  Slices are also possible.  The only difference\nis 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. Here is an example::\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\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.  But there's 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)``. For example::\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 non-standard card ``c2`` in\nthe example below is flagged by such verification. More about verification in\nAstropy 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); print(c2)\n    ABC     =            3.456D023\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 it came from.  Use the\nmethods provided by the :class:`Header` class instead.\n\n\nCONTINUE Cards\n==============\n\nThe fact that the FITS standard only allows up to 8 characters for the keyword\nname and 80 characters to contain the keyword, the value, and the comment is\nrestrictive for certain applications. To allow long string values for keywords,\na 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, even though it is not a FITS\nstandard. The examples below show 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-characters card\nimage, an ampersand is present. The ampersand is not part of the string value.\nAlso, there is no \"=\" at the 9th column after CONTINUE. In the first example,\nthe entire 240 characters is treated by Astropy as a single card. So, if it is\nthe nth card in a header, the (n+1)th card refers to the next keyword, not the\nnext CONTINUE card.  As such, CONTINUE cards are transparently handled by\nAstropy as a single logical card, and it's 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\nHIERARCH Cards\n==============\n\nFor keywords longer than 8 characters, there is a convention originated at ESO\nto facilitate such use. It uses a special keyword HIERARCH with the actual long\nkeyword following. Astropy supports this convention as well.\n\nIf a keyword contains more than 8 characters Astropy will automatically use a\nHIERARCH card, but will also issue a warning in case this is in error.\nHowever, one 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 follow::\n\n    >>> # this will print a Warning because a HIERARCH card is implicitly created\n    >>> c = fits.Card('abcdefghi', 10)\n    >>> print(c)\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.. 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 created CONTINUE and\n    HIERARCH cards.  The Header is just a data structure, and as user you\n    shouldn't 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's 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 where you\n    have concern yourself unnecessarily about how the header is constructed,\n    then let help@stsci.edu know, as there are probably areas where this can be\n    improved on even more.\n"},{"id":93,"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'll 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 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 the\nsame, i.e. the data is in the ``.data`` attribute and the ``field()`` method\nis used to refer to the columns and returns a numpy array. When reading the\ntable, Astropy will automatically detect what kind of table it is.\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: +FLOAT_CMP\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 allowed in a\nbinary 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 '3A' in a binary table and as 'A3' in\nan 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 figure\nout 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 of\nfield it is during reading; no special action is needed from the user. The data\ntype specification (i.e. the value of the TFORM keyword) uses an extra letter\n'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 any\narray in the column. So, for a variable length field of int16, the\ncorresponding format spec\nis, e.g.  'PJ(100)'::\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\nThe above example shows a variable length array field of data type int16. Its\nfirst row has one element, second row has 2 elements etc. Accessing variable\nlength fields is almost identical to regular fields, except that operations on\nthe whole field simultaneously are usually not possible. A user has to process\nthe field row by row as though they are independent arrays.\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). Here is an example of creating a table with two fields,  one\nis regular and the other 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.. _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, i.e. 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. Just 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\nShow the data in 100th 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 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 'date'\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\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\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\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    http://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\nAstropy to work.\n\n\nHeader and Summary\n------------------\n\nIn Astropy, the header of a compressed image HDU appears to the user like any\nimage 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\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\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\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 need be accessed directly.  It may be useful for performing direct\ncopies of the compressed data without needing to decompress it first.\n\n\nCreating a Compressed Image HDU\n-------------------------------\n\nTo create a compressed image HDU from scratch, simply 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\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"},{"id":94,"name":"docs/io/fits/appendix","nodeType":"Package"},{"id":95,"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\nThe Trac ticket discussing the initial motivation and changes to be made to the\n:class:`Header` class is `#64`_.  It may be worth reading for some of the\nbackground to this work, though this document contains a more complete\ndescription of the \"final\" product (which will continue to evolve).\n\n.. _#64: https://aeon.stsci.edu/ssb/trac/pyfits/ticket/64\n\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 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, and not the Card object.  Though almost every\nmethod on the Header class was just performing some operations on the\nunderlying CardList.\n\nThe problem is that there were certain things one could *only* do by directly\naccessing the CardList, such as look up the comments on a card, or access cards\nthat have duplicate keywords, such as HISTORY.  Another long-standing\nmisfeature that slicing a Header object actually returned a CardList object,\nrather than a new Header.  For all but the most simple use cases, working with\nCardList 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's 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 eliminate the ``CardList`` class\naltogether, and make it possible for users to perform all header manipulations\ndirectly through :class:`Header` objects.  It also tries to present headers as\nsimilar as possible to more 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 old 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 for:\n\n- ``Header.has_key``--this has actually been deprecated since PyFITS 3.0,\n  just as Python's `dict.has_key` is deprecated.  For checking 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 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 some like a\nlist of keywords, and in a few contexts like a list of :class:`Card` objects. This\nmay be the most difficult aspect of the new design, but there is logic to 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's 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 ``[]`` returns\n*value* in the header, whether using keyword or index lookup.  Methods like\n:meth:`~Header.index` and :meth:`~Header.count` that deal with the order and\nquantity of items in the Header generally work on keywords.  Finally, methods\nlike :meth:`~Header.insert` and :meth:`~Header.append` that add new items to\nthe 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 simply 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 easily readable\n  regardless of terminal width.  It is *not* necessary to use ``print header``\n  to view this.  Simply entering ``header`` displays the header contents as it\n  would appear in the 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's really just shorthand for ``(keyword, 0)``.  Its is now\n  possible to 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  3 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 represents 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 :meth:`Header.set` and :meth:`Header.append`\n  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 the comments\n  associated with keywords in the header (not to be confused with COMMENT\n  cards).  This allows viewing and updating the comments on specific 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, don't assume that the keyword already\n  exists.  In the old Header implementation this would just silently do\n  nothing.  For backwards-compatibility it is still okay to delete a\n  non-existent keyword, but a warning will be raised.  In the future this\n  *will* be changed so that trying to delete a non-existent 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's\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're 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 remove any use of ``Header.has_key`` and\n  replace it with ``keyword in header`` syntax.  It's 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  don't 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 (eg. ``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's 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, a 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.  Simply 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 one 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 just meant to be a useful\n  string \"representation\" of the object; in this case the contents of the\n  header but with linebreaks between the cards and with the END card and\n  padding trailing padding stripped off.  This happens automatically when\n  one 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 treat trailing spaces as\n  significant.  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 ccdmosaic task for\n  representing its `TNX World Coordinate System\n  <http://iraf.noao.edu/projects/ccdmosaic/tnx.html>`_ and `ZPX World\n  Coordinate System <http://iraf.noao.edu/projects/ccdmosaic/zpx.html>`_\n  non-standard WCS' that uses a series of keywords in the form ``WATj_nnn``\n  which store a text description of coefficients for a non-linear 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":96,"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 non-standard formats\nfound in some FITS files.\n\nThe `astropy.io.fits` module is identical to PyFITS but with the names changed.\nWhen development began on Astropy 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 that in\nthe next question.\n\nAlthough PyFITS is written mostly in Python, it includes an optional module\nwritten in C that's required to read/write compressed image data.  However,\nthe rest of PyFITS functions without this extension module.\n\n.. _PyFITS: http://www.stsci.edu/institute/software_hardware/pyfits\n.. _Python: https://www.python.org/\n.. _FITS: https://fits.gsfc.nasa.gov/\n.. _Numpy: http://www.numpy.org/\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`_ (see `LICENSE.txt`_ in the PyFITS source code).\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 non-trivial.  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 sense\nto continue development there rather than make Astropy a dependency of 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.\nThere is also a legacy `Trac site`_ with some older issue reports still open,\nbut new issues should be submitted via GitHub if possible.\n\nThe current (and last) stable release is 3.4.0.\n\n.. _Space Telescope Science Institute: http://www.stsci.edu/\n.. _AURA: http://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.. _LICENSE.txt: https://aeon.stsci.edu/ssb/trac/pyfits/browser/trunk/LICENSE.txt\n.. _Trac site: https://aeon.stsci.edu/ssb/trac/pyfits/\n.. _GitHub project: https://github.com/spacetelescope/PyFITS\n\n\nUsage Questions\n===============\n\nSomething didn't 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 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\nAstropy crashed and output a long string of code.  What do I do?\n----------------------------------------------------------------\n\nThis listing of code is what is knows 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 non-existent 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\nAstropy, it may indicate a bug in that software, in that it expected to find a\nkeyword that didn't 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're getting an\nexception and you really don't 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's possible that a file should work, but isn't\nsupport due to a bug.  Sometimes it's even possible for a file to work in an\nolder version of Astropy, but not a newer version due to a regression\nthat isn't 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 common-place that it is necessary to support\nthem in any FITS readers.  CONTINUE cards are one such example.  There are\nnon-standard 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 not\nthe 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's 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 keeps outputting to my console?\n------------------------------------------------------------------------------\n\nAstropy 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 warnings\nsubsystem.  See Astropy's documentation on the :ref:`python-warnings` for more\ninformation 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 Astropy\nis likely to cause more difficulties than it's worth.\n\n\nHow do I open a very large image that won't 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 I request just a\nslice of the image, such as ``hdul[0].data[100:200]``, then just 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, just add the ``memmap=True`` argument to\n`fits.open <astropy.io.fits.open>`_.  Likewise, using ``memmap=False`` will\nforce data to be read entirely into memory.\n\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 flakey 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: http://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 non-trivial 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 of guard if you're not expecting\nit, because it doesn't happen until the data portion of the HDU is accessed\n(to allow 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 re-applied to the data before saving.  Usually this is\nnot desirable, especially when converting from floating point 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 (good for updating headers--even if\nyou don't intend for the code to access the data, it's good to err on the side\nof caution here), use the ``do_not_scale_image_data`` argument when opening\nthe 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 don't 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 isn't all that simple.  For\nmany columns there are conversions that have to take place between the actual\ndata that's \"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's\nnot to say it can't be faster even while supporting the peculiarities of\nFITS--CFITSIO for example supports all 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'm 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 if\nyou correctly close a file with `HDUList.close <astropy.io.fits.HDUList.close>`_\na handle is kept open to that file so that the memory-mapped data array can\nstill be continued to be read transparently.\n\nThe way Numpy supports mmap is such that the file mapping is not closed until\nthe 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 easiest\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 easier to automatically perform this sort of\ncleanup when closing FITS files, where needed.\n\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 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 the heavy lifting of reading the FITS\nformat is handled by CFITSIO, while ``fitsio`` provides an easier to use\nobject-oriented API including providing a Numpy interface to FITS files read\nfrom 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 an easier to use\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 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 non-standard\nconventions that have been added to FITS files in the wild.  It does have some\nsupport for some of these conventions (such as CONTINUE cards and, to a limited\nextent, HIERARCH cards), it is not easy to add support for other conventions\nto a large and complex C codebase.\n\nPyFITS' object-oriented design makes supporting non-standard 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 still be readable at least well-enough to correct any\nviolations of the FITS standard.  For example, a common error in non-English-\nspeaking regions is to insert non-ASCII characters into FITS headers.  This\nis not a valid FITS file, but still should be readable in some sense.\nSupporting structural errors such as this is more difficult in CFITSIO which\nassumes 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's 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 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 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 into\nmemory is still going to result in a whole lot of page faults too.  For random\naccess having all the data in physical memory is always going to be best,\nthough with mmap it's usually going to be pretty good too (one doesn't normally\naccess all the data in a file in totally random order--usually a few sections\nof it will be accessed most frequently, the OS will keep those pages in\nphysical memory as best it can).  So for the most general case of reading FITS\nfiles (or most large data on disk) this is the best choice, especially for\ncasual users, and is hence enabled by default.\n\nCFITSIO/``fitsio``, on the other hand, doesn't 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 (so long as it's 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're interested in).  There are some helper functions for\ndetermining the appropriate amount of space to allocate.  Then you just pass it\na pointer to your buffer and CFITSIO handles all the reading (usually using the\nprocess 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's better (and sufficient) to write it work on\nsmaller sections of the data, but this requires extra complexity.  Using mmap\non the other hand makes managing this complexity simpler and more efficient.\n\nA very simple and informal test demonstrates this difference.  This test was\nperformed on four simple FITS images (one of which is a cube) of dimensions\n256x256, 1024x1024, 4096x4096, and 256x1024x1024.  Each image was generated\nbefore the test and filled with randomized 64-bit floating point values.  A\nsimilar test was performed using both `astropy.io.fits` and ``fitsio``:  A\nhandle to the FITS file is opened using each library's basic semantics, and\nthen the entire data array of the files is copied into a temporary array in\nmemory (for example if we were blitting the image to a video buffer).  For\nAstropy the test is written:\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 the sample files, producing the results::\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 would\nbe almost 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 isn't--there is either no difference, or it may be a little\nfaster in Astropy depending on what you're 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 1-D\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 order\nto perform row selection.\n"},{"id":97,"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 ommitted\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 ommitted\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 ommitted 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.  See\n  http://listmgr.cv.nrao.edu/pipermail/fitsbits/2002-April/001094.html.  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, recoverably)\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 psuedo-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 usecase\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 backards (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]: http://stsdas.stsci.edu/stsci_python_sphinxdocs_2.13/tools/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 instanciation 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 mis-alignment 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: http://www.stsci.edu/institute/software_hardware/pyfits\n"},{"id":98,"name":"docs/io/ascii","nodeType":"Package"},{"id":99,"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 easily read with the |read|\nfunction::\n\n  >>> from astropy.io import ascii\n  >>> data = ascii.read(table)  # doctest: +SKIP\n\nwhere ``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 the supported formats.  If this does not work (for unusually\nformatted tables) then one needs give `astropy.io.ascii` additional hints about the\nformat, for example::\n\n   >>> data = astropy.io.ascii.read('t/nls1_stackinfo.dbout', data_start=2, delimiter='|')  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('t/simple.txt', quotechar=\"'\")  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('t/simple4.txt', format='no_header', delimiter='|')  # doctest: +SKIP\n   >>> data = astropy.io.ascii.read('t/tab_and_space.txt', delimiter=r'\\s')  # doctest: +SKIP\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  - Name of 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 string.\n  This assumes that valid file names will not normally contain a newline.\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=True)\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 then that line\n  will be discarded from header or data processing.  For the ``basic`` format this\n  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 double\n  quote character.  This is can be useful for reading text fields with spaces in a space-delimited\n  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.  See\n  `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 line 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**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**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 ``io.ascii`` and tell it where to\nfind the header and data.\n\nWhen processing of a file 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 data\nparsing code sees the table content. For example imagine you have the file\nbelow. The column on the left is not part of the file but instead shows how\n``io.ascii`` is viewing 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.. note::\n\n   Prior to astropy v1.1 there was a bug in which a blank line that had one or\n   more whitespace characters was mistakenly counted for ``header_start`` but\n   was (correctly) not counted for ``data_start`` and ``data_end``.  If you\n   have code that was depending on the incorrect pre-1.1 behavior then it needs\n   to be modified.\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 table\ncontains blank entries with no available data, for example::\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 a masked\nTable with those entries masked out by setting the corresponding mask value set to\n``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 the masked\ncolumn ``fill_value`` attribute and then get the \"filled\" version of the table.  This\nlooks 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 also have other indicators of bad or missing data.  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 then 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'``,\notherwise you may get unexpected behavior [#f1]_.  By default the\n``<missing_spec>`` is applied to all columns unless column name strings are\nsupplied.  An alterate 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\nGuess table format\n==================\n\nIf the ``guess`` parameter in |read| is set to True (which is the default) 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 case.\nThe first format which succeeds and will be used to read the table. To succeed\nthe table must be successfully parsed by the Reader and satisfy the following\ncolumn 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 quote, or\n   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-----------\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, FastBasic, Basic,\n                 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 included\nin the default guess sequence (this causes problems), so to read such tables\none must explicitly specify the format with the ``format`` keyword. Also notice\nthat formats compatible with the fast reading engine attempt to use the fast\nengine 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 that were supplied to the read() function.  Any guesses\nthat would conflict are skipped.  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.\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 isn't 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. For example::\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 re-reading 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\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 2-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://docs.scipy.org/doc/numpy/user/basics.types.html>`_, for example\n``numpy.int``, ``numpy.uint``, ``numpy.int8``, ``numpy.int64``,\n``numpy.float``, ``numpy.float64``, ``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\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 simple examples the\nbest reference is to read the code for the existing\n:ref:`extension_reader_classes`.\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 the build-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 a simple 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**\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.. _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 one 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 one provides 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\n**Example**: Reading 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\n**Example**: Reading the table in chunks with an iterator.\n\nHere we iterate over a CSV table and select all rows where the ``Vmag`` column is\nless than 8.0 (e.g. all stars in table brighter than 8.0 mag).  We collect all\nthese sub-tables and then stack them 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 prevent unneccesary 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"},{"id":100,"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":101,"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 ASCII data table\nformats via built-in :ref:`extension_reader_classes`.  The emphasis is on flexibility and ease of use,\nalthough readers can optionally use a less flexible C/Cython engine for reading and writing for\nimproved performance.\n\nThe following shows a few of the ASCII formats that are available, while the section on\n`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 and ApJ machine readable tables)\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\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 <http://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.Rdb`: tab-separated values with an extra line after the column definition line\n* :class:`~astropy.io.ascii.SExtractor`: `SExtractor format table <http://www.astromatic.net/software/sextractor>`_\n\nThe :mod:`astropy.io.ascii` package is built on a modular and extensible class\nstructure with independent :ref:`base_class_elements` so that new formats can\nbe easily accommodated.\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 easily read with the |read|\nfunction.  Assume you have a file named ``sources.dat`` with the following 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 `guess the table format <#guess-table-format>`_\nby trying all the `supported formats`_.  If this does not work (for unusually\nformatted tables) then one needs give ``astropy.io.ascii`` additional hints about\nthe format, for example::\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\nIf the format of a file is known (e.g. it is a fixed width table or an IPAC table),\nthen it is more efficient and reliable to provide a value for the ``format`` argument from one\nof the values in the `supported formats`_.  For example::\n\n   >>> data = ascii.read(lines, format='fixed_width_two_line', delimiter='&')\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`.\n\n.. Note::\n\n   Reading a table which contains unicode characters is supported; if you need\n   a different encoding, you can specify the ``encoding`` parameter in the\n   pure-Python readers.\n\nWriting Tables\n--------------\n\nThe |write| function provides a way to write a data table as a formatted ASCII\ntable.  For example the following writes a table as a simple space-delimited\nfile::\n\n  >>> import numpy as np\n  >>> from astropy.table import Table, Column, MaskedColumn\n  >>> x = np.array([1, 2, 3])\n  >>> y = x ** 2\n  >>> data = Table([x, y], names=['x', 'y'])\n  >>> ascii.write(data, 'values.dat')\n\nThe ``values.dat`` file will then contain::\n\n  x y\n  1 1\n  2 4\n  3 9\n\nMost of the input Reader formats supported by `astropy.io.ascii` for reading are\nalso supported for writing.  This provides a great deal of flexibility in the\nformat for writing.  The example below writes the data as a LaTeX table, using\nthe option to send the output to ``sys.stdout`` instead of a file::\n\n  >>> import sys\n  >>> ascii.write(data, sys.stdout, format='latex')\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\nFinally, one can write data in the :ref:`ecsv_format` which allows\npreserving table meta-data such as column data types and units.  In this way a\ndata table (including one with masked entries) can be stored and read back as\nASCII with no loss of information.\n\n  >>> t = Table(masked=True)\n  >>> t['x'] = MaskedColumn([1.0, 2.0], unit='m', dtype='float32')\n  >>> t['x'][1] = np.ma.masked\n  >>> t['y'] = MaskedColumn([False, True], dtype='bool')\n\n  >>> import io\n  >>> fh = io.StringIO()\n  >>> t.write(fh, format='ascii.ecsv')  # doctest: +SKIP\n  >>> table_string = fh.getvalue()      # doctest: +SKIP\n  >>> print(table_string)               # doctest: +SKIP\n  # %ECSV 0.9\n  # ---\n  # datatype:\n  # - {name: x, unit: m, datatype: float32}\n  # - {name: y, datatype: bool}\n  x y\n  1.0 False\n  \"\" True\n\n  >>> Table.read(table_string, format='ascii')  # doctest: +SKIP\n  <Table masked=True length=2>\n     x      y\n     m\n  float32  bool\n  ------- -----\n      1.0 False\n       --  True\n\n.. Note::\n\n   For most supported formats one can write a masked table and then\n   read it back without losing information about the masked table\n   entries.  This is accomplished by using a blank string entry to\n   indicate a masked (missing) value.  See the :ref:`replace_bad_or_missing_values`\n   section for more information.\n\n.. _supported_formats:\n\nSupported formats\n=================\n\nA full list of the supported ``format`` values and corresponding format types for ASCII\ntables is given below.  The ``Write`` column indicates which formats support write\nfunctionality, and the ``Fast`` column indicates which formats are compatible with\nthe 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``                              :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\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``no_header``               Yes  Yes :class:`~astropy.io.ascii.NoHeader`: Basic table with no headers\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\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\nReference/API\n=============\n\n.. automodapi:: astropy.io.ascii\n"},{"id":102,"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>`: Get the lines from the table input.\n* :class:`Splitter <astropy.io.ascii.BaseSplitter>`: Split the lines into string column values.\n* :class:`Header <astropy.io.ascii.BaseHeader>`: Initialize output columns based on the table header or user input.\n* :class:`Data <astropy.io.ascii.BaseData>`: Populate column data from the table.\n* :class:`Outputter <astropy.io.ascii.BaseOutputter>`: Convert 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 tweakable\nparameters is modularized into manageable groups.  Where it makes sense these\nattributes are actually functions that make it easy to handle special cases.\n"},{"id":103,"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 difference is\nwhether 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 the\ndelimiter character, whether the delimiter appears on either end (\"bookends\"),\nand padding around the delimiter.\n\nDetails are available in the class API documentation, but the easiest way to\nunderstand all the options and their interactions is by example.\n\nReading\n=======\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 header_start and data_start\nkeywords 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 FixedWidthNoHeader\nconvenience class.**\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 0 to 5\nwill select the first 6 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 column\nstarts at position 0 and that each successive column starts immediately after\nthe 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**Restructured text 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**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\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"},{"id":104,"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.. |Table| replace:: :class:`~astropy.table.Table`\n.. _structured array: https://docs.scipy.org/doc/numpy/user/basics.rec.html\n"},{"id":105,"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.  For example::\n\n  >>> import numpy as np\n  >>> from astropy.io import ascii\n  >>> x = np.array([1, 2, 3])\n  >>> y = x ** 2\n  >>> ascii.write([x, y], 'values.dat', names=['x', 'y'])\n\nThe ``values.dat`` file will then contain::\n\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\nInput data format\n=================\n\nThe input ``table`` argument to |write| can be any value that is supported for\ninitializing a |Table| object.  This is documented in detail in the\n:ref:`construct_table` section and includes creating a table with a list of\ncolumns, a dictionary of columns, or from `numpy` arrays (either structured or\nhomogeneous).  The sections below show a few examples.\n\nTable or NumPy structured array\n-------------------------------\n\nAn Astropy |Table| object or a NumPy `structured array`_ (or record array) can\nserve as input to the |write| function.\n\n::\n\n    >>> from astropy.io import ascii\n    >>> from astropy.table import Table\n\n    >>> data = Table({'a': [1, 2, 3],\n    ...               'b': [4.0, 5.0, 6.0]},\n    ...              names=['a', 'b'])\n    >>> ascii.write(data)\n    a b\n    1 4.0\n    2 5.0\n    3 6.0\n\n    >>> data = np.array([(1, 2., 'Hello'), (2, 3., \"World\")],\n    ...                 dtype=('i4,f4,a10'))\n    >>> ascii.write(data)\n    f0 f1 f2\n    1 2.0 Hello\n    2 3.0 World\n\nThe output of :mod:`astropy.io.ascii.read` is a |Table| or NumPy array data\nobject that can be an input to the |write| function.\n\n::\n\n    >>> data = ascii.read('t/daophot.dat', format='daophot')  # doctest: +SKIP\n    >>> ascii.write(data, 'space_delimited_table.dat')  # doctest: +SKIP\n\nList of lists\n-------------\n\nA list of Python lists (or any iterable object) can be used as input::\n\n    >>> x = [1, 2, 3]\n    >>> y = [4, 5.2, 6.1]\n    >>> z = ['hello', 'world', '!!!']\n    >>> data = [x, y, z]\n\n    >>> ascii.write(data)\n    col0 col1 col2\n    1 4.0 hello\n    2 5.2 world\n    3 6.1 !!!\n\nThe ``data`` object does not contain information about the column names so\n|Table| has chosen them automatically.  To specify the names, provide the\n``names`` keyword argument.  This example also shows excluding one of the columns\nfrom the output::\n\n    >>> ascii.write(data, names=['x', 'y', 'z'], exclude_names=['y'])\n    x z\n    1 hello\n    2 world\n    3 !!!\n\n\nDict of lists\n-------------\n\nA dictionary containing iterable objects can serve as input to |write|.  Each\ndict key is taken as the column name while the value must be an iterable object\ncontaining the corresponding column values.\n\nSince a Python dictionary is not ordered the output column order will be\nunpredictable unless the ``names`` argument is provided.\n\n::\n\n    >>> data = {'x': [1, 2, 3],\n    ...         'y': [4, 5.2, 6.1],\n    ...         'z': ['hello', 'world', '!!!']}\n    >>> ascii.write(data, names=['x', 'y', 'z'])\n    x y z\n    1 4.0 hello\n    2 5.2 world\n    3 6.1 !!!\n\n\n.. _io_ascii_write_parameters:\n\nParameters for ``write()``\n==========================\n\nThe |write| function accepts a number of parameters that specify the detailed output table\nformat.  Each of the :ref:`supported_formats` is handled by a corresponding Writer class that\ncan define different defaults, so the descriptions below sometimes mention \"typical\"\ndefault values.  This refers to the :class:`~astropy.io.ascii.Basic` writer and other\nsimilar 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 :ref:`construct_table`).\n\n**format** : output format (default='basic')\n  This specifies the format of the ASCII table to be written, for\n  example if it is a basic character delimited table, fixed format table, or a\n  CDS-compatible table, etc.  The value of this parameter must\n  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 the space character.\n  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 and how comments are written 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 a string.\n  If the format value is string-like then it is used as a Python format statement,\n  e.g. '%0.2f' % value.  If it is a callable function then that function\n  is called with a single argument containing the column value to be converted.\n  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 names corresponding to each data column\n  Define the complete list of names for each data column.  This will override\n  names determined from the data table (if available).  If not supplied then\n  use names from the data table or auto-generated 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 the syntax.\n  The syntax is almost the same as when reading a table.\n  There is a special value ``astropy.io.ascii.masked`` that is used a say \"output this string\n  for all masked values in a masked table (the default is 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, for\n  example if it is a basic character delimited table, fixed format table, or a\n  CDS-compatible table, etc.  The value of this parameter must be a Writer\n  class.  For basic usage this means one of the built-in :ref:`extension_reader_classes`.\n  Note: 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\n.. _ecsv_format:\n\nECSV format\n===========\n\nThe `Enhanced Character-Separated Values (ECSV) format\n<https://github.com/astropy/astropy-APEs/blob/master/APE6.rst>`_ can be used to\nwrite astropy `~astropy.table.Table` or `~astropy.table.QTable` datasets to a\ntext-only data file and then read the table back without loss of information.\nThe format handles the key issue of serializing column specifications and table\nmetadata by using a YAML-encoded data structure. The actual tabular data are\nstored in a standard character separated values (CSV) format, giving\ncompatibility with a wide variety of non-specialized CSV table readers.\n\nMixin columns\n-------------\n\nStarting with astropy 2.0 it is possible to store not only standard\n`~astropy.table.Column` 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\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 meta data which informs the reader 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`` or ``frame``.\nFor example::\n\n  >>> from astropy.io import ascii\n  >>> from astropy.coordinates import SkyCoord\n  >>> import astropy.units as u\n  >>> from astropy.time import Time\n  >>> from astropy.table import QTable, Column\n\n  >>> sc = SkyCoord(ra=[1,2]*u.deg, dec=[3,4]*u.deg, distance=[5,6]*u.m,\n  ...               frame='fk4', obstime=Time('2000:001'))\n  >>> sc.info.description = 'flying circus'\n  >>> c = Column([1,2])\n  >>> q = [1,2]*u.m\n  >>> q.info.format = '.2f'\n  >>> t = QTable([c, q, sc], names=['c', 'q', 'sc'])\n\n  >>> ascii.write(t, format='ecsv')   # doctest: +SKIP\n  # %ECSV 0.9\n  # ---\n  # datatype:\n  # - {name: c, datatype: int64}\n  # - {name: q, unit: m, datatype: float64}\n  # - {name: sc.ra, unit: deg, datatype: float64}\n  # - {name: sc.dec, unit: deg, datatype: float64}\n  # - {name: sc.distance, unit: m, datatype: float64}\n  # meta: !!omap\n  # - __serialized_columns__:\n  #     q:\n  #       __class__: astropy.units.quantity.Quantity\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  #         value: !astropy.table.SerializedColumn {name: sc.dec}\n  #       distance: !astropy.table.SerializedColumn\n  #         __class__: astropy.coordinates.distances.Distance\n  #         value: !astropy.table.SerializedColumn {name: sc.distance}\n  #       equinox: !astropy.time.Time {format: byear_str, in_subfmt: '*', jd1: 2400000.5,\n  #         jd2: 33281.92345905, out_subfmt: '*', precision: 3, scale: tai}\n  #       frame: fk4\n  #       obstime: !astropy.time.Time {format: yday, in_subfmt: '*', jd1: 2451544.5, jd2: 0.0,\n  #         out_subfmt: '*', precision: 3, scale: utc}\n  #       ra: !astropy.table.SerializedColumn\n  #         __class__: astropy.coordinates.angles.Longitude\n  #         value: !astropy.table.SerializedColumn {name: sc.ra}\n  #         wrap_angle: !astropy.coordinates.Angle\n  #           unit: !astropy.units.Unit {unit: deg}\n  #           value: 360.0\n  #       representation: spherical\n  # schema: astropy-2.0\n  c q sc.ra sc.dec sc.distance\n  1 1.0 1.0 3.0 5.0\n  2 2.0 2.0 4.0 6.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"},{"id":106,"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.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 <http://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.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 <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables>`_\n* :class:`~astropy.io.ascii.SExtractor`: `SExtractor format table <http://www.astromatic.net/software/sextractor>`_\n* :class:`~astropy.io.ascii.Tab`: tab-separated values\n* :class:`~astropy.io.ascii.Csv`: comma-separated values\n\n"},{"id":107,"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 for\nreading and writing ASCII files. By default, |read| and |write| will attempt to\nuse this engine when dealing with compatible formats. The following formats\nare 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, |read|\nwill not fall back on an ordinary reader if fast reading fails.\nFor example::\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 in the input data by successively\n   trying different formats until one succeeds ([reference the guessing section]).\n   For the default ``'ascii'`` format this means that a number of pure Python readers\n   with no fast implementation will be tried before getting to the fast readers.\n\n   **For optimum performance**, turn off guessing entirely (``guess=False``) or\n   narrow down the format options as much as possible by specifying the format\n   (e.g. ``format='csv'``) and/or other options such as the delimiter.\n\nReading\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\ninfrastructure. In this case |read| will fall back on the ordinary reader.\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------------------------------------\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``. For example::\n\n   >>> ascii.read('data.txt', format='basic',\n   ...            fast_reader={'parallel': True, 'use_fast_converter': True}) # doctest: +SKIP\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 below.\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.\nFor details see the section on :ref:`fortran_style_exponents`.\n\nFast converter\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 15 significant figures, or if accuracy is relatively\nunimportant, this converter might be the best option in\nperformance-critical scenarios.\n\n`Here\n<http://nbviewer.jupyter.org/github/astropy/astropy-notebooks/blob/master/io/ascii/conversion_profile.ipynb>`__\nis an IPython notebook analyzing the error of the fast converter, both in\ndecimal values and in ULP. For 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. Another notebook analyzing\nthe fast converter's behavior with extreme values (such as subnormals\nand values out of the range of floats) is available `here\n<http://nbviewer.jupyter.org/github/astropy/astropy-notebooks/blob/master/io/ascii/test_converter.ipynb>`__.\n\nReading large tables\n--------------------\nFor reading very large tables using the fast reader see the section on\n:ref:`chunk_reading`.\n\nWriting\n=======\nThe fast engine supports the same functionality as the ordinary writing engine\nand is generally about 2 to 4 times faster than the ordinary engine. An IPython\nnotebook testing the relative performance of the fast writer against the\nordinary writing system and the data analysis library `Pandas\n<http://pandas.pydata.org/>`__ is available `here <http://nbviewer.ipython.org/github/astropy/astropy-notebooks/blob/master/io/ascii/ascii_write_bench.ipynb>`__.\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===========\nThe fast ASCII engine was designed based on the general parsing strategy\nused in the `Pandas <http://pandas.pydata.org/>`__ data analysis library, so\nits performance is generally comparable (although slightly slower by\ndefault) to the Pandas ``read_csv`` method.\n`Here\n<http://nbviewer.jupyter.org/github/astropy/astropy-notebooks/blob/master/io/ascii/ascii_read_bench.ipynb>`__\nis an IPython notebook comparing the performance of the ordinary\n:mod:`astropy.io.ascii` reader, the fast reader, the fast reader with the\nfast converter enabled, numpy's ``genfromtxt``, and Pandas' ``read_csv``\nfor different kinds of table data in a basic space-delimited file.\n\nIn summary, ``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 4 or 5 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 doesn't\ncontain primarily integer data or repeated string values, specifying\n``parallel`` as ``True`` can yield further performance gains. Although\nIPython doesn't 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":108,"name":"docs/io/votable","nodeType":"Package"},{"id":109,"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` subpackage converts VOTable XML files to and\nfrom Numpy record arrays.\n\nGetting Started\n===============\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, one 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,\none 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 there is expected to be only one table in the file, it\nmight be simplest to just use\n`~astropy.io.votable.tree.VOTableFile.get_first_table`::\n\n  table = votable.get_first_table()\n\nEven easier, 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, one 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.  For\nexample, suppose 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 a `astropy.io.votable.tree.Table` object to\n    an `astropy.table.Table` object, one 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\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\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\nOutputting a VOTable file\n-------------------------\n\nTo save a VOTable file, simply 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 can not 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<http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html>`_,\n`Version 1.2\n<http://www.ivoa.net/Documents/VOTable/20091130/REC-VOTable-1.2.html>`_,\nand the `Version 1.3 proposed recommendation\n<http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html>`_.\nSome flexibility is provided to support the 1.0 draft version and\nother non-standard usage in the wild.  To support these cases, set the\nkeyword argument ``pedantic`` to ``False`` when parsing.\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 or 1.3 spec, depending on the\ninput.\n\n.. _pedantic-mode:\n\nPedantic mode\n^^^^^^^^^^^^^\n\nMany VOTABLE files in the wild do not conform to the VOTABLE\nspecification.  If reading one of these files causes exceptions, you\nmay turn off pedantic mode in `astropy.io.votable` by passing\n``pedantic=False`` to the `~astropy.io.votable.parse` or\n`~astropy.io.votable.parse_single_table` functions::\n\n  from astropy.io.votable import parse\n  votable = parse(\"votable.xml\", pedantic=False)\n\nNote, however, that it is good practice to report these errors to the\nauthor of the application that generated the VOTABLE file to bring the\nfile into compliance with the specification.\n\nEven with ``pedantic`` turned off, many warnings may still be omitted.\nThese warnings are all of the type\n`~astropy.io.votable.exceptions.VOTableSpecWarning` and can be turned\noff using the standard Python `warnings` module.\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 simply 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, one 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.  For\nexample::\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.. _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  <http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html>`_\n\n- `VOTable Format Definition Version 1.2\n  <http://www.ivoa.net/Documents/VOTable/20091130/REC-VOTable-1.2.html>`_\n\n- `VOTable Format Definition Version 1.3, Proposed Recommendatation\n  <http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html>`_\n\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":110,"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.. 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":111,"name":".gitignore","nodeType":"TextFile","path":"docs/io/votable","text":"warnings.rst\nexceptions.rst\n"},{"id":112,"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/REC/VOTable/VOTable-20040811.html#ToC19\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.. _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":113,"name":"docs/wcs","nodeType":"Package"},{"id":114,"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 ommiting 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":115,"name":"index.rst","nodeType":"TextFile","path":"docs/wcs","text":".. doctest-skip-all\n.. _astropy-wcs:\n\n***************************************\nWorld Coordinate System (`astropy.wcs`)\n***************************************\n\n.. _wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: http://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf\n\nIntroduction\n============\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.  These transformations can work both\nforward (from pixel to sky) and backward (from sky to pixel).\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`_.  (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\nEach of these transformations can be used independently or together in\na standard pipeline.\n\nGetting Started\n===============\n\nThe basic workflow is as follows:\n\n    1. ``from astropy import wcs``\n\n    2. Call the `~astropy.wcs.WCS` constructor with an\n       `astropy.io.fits` `~astropy.io.fits.Header` and/or\n       `~astropy.io.fits.HDUList` object.\n\n    3. Optionally, if the FITS file uses any deprecated or\n       non-standard features, you may need to call one of the\n       `~astropy.wcs.wcs.WCS.fix` methods on the object.\n\n    4. Use one of the following transformation methods:\n\n       - From pixels to world coordinates:\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         - `~astropy.wcs.wcs.WCS.wcs_pix2world`: Perform just the core\n           WCS transformation from pixel to world coordinates.\n\n       - From world to pixel coordinates:\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         - `~astropy.wcs.wcs.WCS.wcs_world2pix`: Perform just the core\n           WCS transformation from world to pixel coordinates.\n\n       - 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         - `~astropy.wcs.wcs.WCS.sip_foc2pix`: Convert from focal\n           plane to pixel coordinates using the `SIP`_ polynomial\n           coefficients.\n\n       - 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\nFor example, to convert pixel coordinates from a two dimensional image to world coordinates::\n\n    >>> from astropy.wcs import WCS\n    >>> w = WCS('image.fits')\n    >>> lon, lat = w.all_pix2world(30, 40, 0)\n    >>> print(lon, lat)\n\n\nUsing `astropy.wcs`\n===================\n\nLoading WCS information from a FITS file\n----------------------------------------\n\nThis example loads a FITS file (supplied on the commandline) and uses\nthe WCS cards in its primary header to transform.\n\n.. literalinclude:: examples/from_file.py\n   :language: python\n\nBuilding a WCS structure programmatically\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\n.. _wcslint:\n\nValidating the WCS keywords in a FITS file\n------------------------------------------\n\nAstropy includes a commandline tool, ``wcslint`` to check the WCS\nkeywords in a FITS file::\n\n    > wcslint invalid.fits\n    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        - 'celfix' made the change 'PV1_5 : Unrecognized coordinate\n          transformation parameter'.\n\n    HDU 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 CUNIT2 : Mismatched units type\n          'length': have 'Hz', want 'm''.\n        - 'unitfix' made the change 'Changed units: 'HZ      ' -> 'Hz''.\n\nBounds 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\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 specified in the second part of the ``CTYPEn`` keywords\n(accessible through `Wcsprm.ctype <astropy.wcs.Wcsprm.ctype>`), for\nexample, ``RA---TAN-SIP``.  The 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\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    from matplotlib import pyplot as plt\n    from astropy.io import fits\n    from astropy.wcs import WCS\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    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\nOther information\n=================\n\n.. toctree::\n   :maxdepth: 1\n\n   relax\n   history\n\n\nSee Also\n========\n\n- `wcslib`_\n\nReference/API\n=============\n\n.. automodapi:: astropy.wcs\n\n.. automodapi:: astropy.wcs.utils\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":116,"name":"relax.rst","nodeType":"TextFile","path":"docs/wcs","text":".. _relax:\n\nRelax constants\n***************\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  favour 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 obvious 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`` (the obvious analogy) 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 an obvious\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":117,"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\n"},{"id":118,"name":"references.txt","nodeType":"TextFile","path":"docs/wcs","text":".. _wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: http://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"},{"id":119,"name":"references.rst","nodeType":"TextFile","path":"docs/wcs","text":":orphan:\n\n.. _wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: http://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"},{"id":120,"name":"docs/wcs/examples","nodeType":"Package"},{"fileName":"from_file.py","filePath":"docs/wcs/examples","id":121,"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\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 a NAXIS=2 image here\n    pixcrd = np.array([[0, 0], [24, 38], [45, 98]], np.float_)\n\n    # Convert pixel coordinates to world coordinates\n    # The second argument is \"origin\" -- in this case we're declaring we\n    # have 1-based (Fortran-like) coordinates.\n    world = w.wcs_pix2world(pixcrd, 1)\n    print(world)\n\n    # Convert the same coordinates back to pixel coordinates.\n    pixcrd2 = w.wcs_world2pix(world, 1)\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\nif __name__ == '__main__':\n    load_wcs_from_file(sys.argv[-1])\n"},{"fileName":"programmatic.py","filePath":"docs/wcs/examples","id":122,"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# Some pixel coordinates of interest.\npixcrd = np.array([[0, 0], [24, 38], [45, 98]], np.float_)\n\n# Convert pixel coordinates to world coordinates\nworld = w.wcs_pix2world(pixcrd, 1)\nprint(world)\n\n# Convert the same coordinates back to pixel coordinates.\npixcrd2 = w.wcs_world2pix(world, 1)\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# 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"},{"id":123,"name":"docs/samp","nodeType":"Package"},{"id":124,"name":"advanced_embed_samp_hub.rst","nodeType":"TextFile","path":"docs/samp","text":".. include:: references.txt\n\n.. 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 GUI tool, you will need to start\nthe 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 simply use::\n\n    from astropy.samp import SAMPHubServer\n    hub = SAMPHubServer(web_profile=False)\n    hub.start()\n\nand this should be all you need to do. However, if you want to keep the web\nprofile active, there is an additional consideration, which is that 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\ninstead likely want to open a GUI dialog.\n\nTo do this, you will need to define a class that handles the dialog,\nand you should then pass an **instance** of the class to\n|SAMPHubServer| (not the class itself).  This class should inherit\nfrom `astropy.samp.WebProfileDialog` and add the following:\n\n    1) It should have a GUI timer callback that periodically calls\n       ``WebProfileDialog.handle_queue`` (available as\n       ``self.handle_queue``).\n\n    2) Implement 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\nThe following code is a full example of a simple Tk application that watches\nfor web SAMP connections and opens the appropriate dialog::\n\n\n    import Tkinter as tk\n    import 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 saying \"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"},{"id":125,"name":"example_table_image.rst","nodeType":"TextFile","path":"docs/samp","text":".. include:: references.txt\n\n.. doctest-skip-all\n\n.. _vo-samp-example-table-image:\n\nSending/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, which can also 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 is 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, then first instantiate a\n|SAMPIntegratedClient| instance and 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 the clients connected to the hub::\n\n    >>> client.get_registered_clients()\n    ['hub', 'c1', 'c2']\n\nThese IDs don't 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 re-send 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 message. 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` and\n:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.bind_receive_notification` methods\nto 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\nLet's now broadcast the table from TOPCAT. After a few seconds, we can try and\ncheck again 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 can 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\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\nSending an image to Ds9 and Aladin\n==================================\n\nAs for tables, the easiest way to send a FITS image over SAMP is to make use of\nthe |SAMPIntegratedClient| class. Once Aladin or Ds9 are open, then first\ninstantiate a |SAMPIntegratedClient| instance and connect to the hub as 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 how to construct local URLs\nmore easily. Now we can set up the message itself. This includes the type of\nmessage (here we use ``image.load.fits`` which indicates that a FITS image\nshould 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 as 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\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":126,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":0,"comment":"null","endLoc":38,"header":"def load_wcs_from_file(filename)","id":127,"name":"load_wcs_from_file","nodeType":"Function","startLoc":9,"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 a NAXIS=2 image here\n    pixcrd = np.array([[0, 0], [24, 38], [45, 98]], np.float_)\n\n    # Convert pixel coordinates to world coordinates\n    # The second argument is \"origin\" -- in this case we're declaring we\n    # have 1-based (Fortran-like) coordinates.\n    world = w.wcs_pix2world(pixcrd, 1)\n    print(world)\n\n    # Convert the same coordinates back to pixel coordinates.\n    pixcrd2 = w.wcs_world2pix(world, 1)\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"},{"attributeType":"WCS","col":0,"comment":"null","endLoc":10,"id":128,"name":"w","nodeType":"Attribute","startLoc":10,"text":"w"},{"id":129,"name":"references.txt","nodeType":"TextFile","path":"docs/samp","text":".. |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"},{"id":130,"name":"example_clients.rst","nodeType":"TextFile","path":"docs/samp","text":".. include:: references.txt\n\n.. 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 response::\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 giving the clients that would currently receive\n``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":131,"name":"index.rst","nodeType":"TextFile","path":"docs/samp","text":".. include:: references.txt\n\n.. 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\nSAMP (Simple Application Messaging Protocol) 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 IVOA\n(International Virtual Observatory Alliance)  and is understood by many desktop\nastronomy tools, including `TOPCAT <http://www.star.bris.ac.uk/~mbt/topcat/>`_,\n`SAO Ds9 <http://ds9.si.edu/>`_, and `Aladin\n<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 display a named FITS file in Ds9,\ncause Aladin to re-center on a given sky position, or receive 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 also to\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\nReference/API\n=============\n\n.. automodapi:: astropy.samp\n\nAcknowledgments\n===============\n\nThis code is adapted from the `SAMPy <https://pypi.python.org/pypi/sampy>`__\npackage written by Luigi Paioro, who has granted the Astropy Project permission\nto use the code under a BSD license.\n"},{"id":132,"name":"example_hub.rst","nodeType":"TextFile","path":"docs/samp","text":".. include:: references.txt\n\n.. 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\nAstropy::\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, you can simply 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 and 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":133,"name":"docs/time","nodeType":"Package"},{"id":134,"name":"references.txt","nodeType":"TextFile","path":"docs/time","text":".. |Time| replace:: :class:`~astropy.time.Time`\n.. |TimeDelta| replace:: :class:`~astropy.time.TimeDelta`\n.. _SOFA: http://www.iausofa.org/index.html\n.. _ERFA: https://github.com/liberfa/erfa\n"},{"id":135,"name":"index.rst","nodeType":"TextFile","path":"docs/time","text":".. include:: references.txt\n\n.. _astropy-time:\n\n****************************************************\nTime and Dates (`astropy.time`)\n****************************************************\n\n.. |Quantity| replace:: :class:`~astropy.units.Quantity`\n.. |Longitude| replace:: :class:`~astropy.coordinates.Longitude`\n.. |EarthLocation| replace:: :class:`~astropy.coordinates.EarthLocation`\n.. |SkyCoord| replace:: :class:`~astropy.coordinates.SkyCoord`\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, e.g., sidereal times and barycentric\ncorrections.\nIt uses Cython to wrap the C language `ERFA`_ time and calendar\nroutines, using a fast and memory efficient vectorization scheme.\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        <https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf>`_\n\nGetting Started\n===============\n\nThe basic way to use `astropy.time` is to create a |Time|\nobject by supplying one or more input time values as well as the `time format`_ and\n`time scale`_ 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 below.\nIn general any output values have the same shape (scalar or array) as the input.\n\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,\ne.g. ISO or JD or Unix time.  The ``scale`` argument specifies the `time scale`_ for the\nvalues, e.g. UTC or TT or UT1.  The ``scale`` argument is optional and\ndefaults to UTC except for `Time from epoch formats`_.\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 then the\n``format`` argument is not required, so we can simplify even further::\n\n  >>> t = Time(times)\n\nNow let's 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 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(UTC)'\n                                                 '2010-01-01T00:00:00.000(UTC)']>\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 one could not tell; one format in which\nthis information is kept is the ``fits`` format::\n\n  >>> print(t2.fits)\n  ['1999-01-01T00:01:04.307(TT)' '2010-01-01T00:01:06.184(TT)']\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\n  <Longitude [6.68050179, 6.70281947] hourangle>\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\nOnce a |Time| object is created it cannot be altered internally.  In code lingo\nit is \"immutable.\"  In particular the common operation of \"converting\" to a\ndifferent `time scale`_ is always performed by returning a copy of the original\n|Time| object which has been converted to the new time scale.\n\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\nare listed in the table below.  Each of these formats is implemented as a class\nthat derives from the base :class:`~astropy.time.TimeFormat` class.\nThis class structure can be easily adapted and extended by users for\nspecialized time formats not supplied in `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(TAI)'\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\nyday         :class:`~astropy.time.TimeYearDayTime`             2000:001:00:00:00.000\n===========  =================================================  ==============================\n\n.. note:: The :class:`~astropy.time.TimeFITS` format allows for most\n   but not all of the the FITS standard [#]_. Not implemented (yet) is\n   support for a ``LOCAL`` timescale. Furthermore, FITS supports some deprecated\n   names for timescales; these are translated to the formal names upon\n   initialization.  Furthermore, any specific realization information,\n   such as ``UT(NIST)`` is stored only as long as the time scale is not changed.\n.. [#] `Rots et al. 2015, A&A 574:A36 <http://adsabs.harvard.edu/abs/2015A%26A...574A..36R>`_\n\nChanging format\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe default representation can be changed by setting the ``format`` attribute in place::\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 below)\nmay 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(UTC)'\n  >>> t.format = 'iso'\n  >>> t.out_subfmt\n  u'*'\n  >>> t.format = 'fits'\n  >>> t.value\n  '2000-01-02T00:00:00.000(UTC)'\n\n\nSubformat\n\"\"\"\"\"\"\"\"\"\n\nThe time format classes :class:`~astropy.time.TimeISO`,\n:class:`~astropy.time.TimeISOT`, :class:`~astropy.time.TimeFITS`, and\n:class:`~astropy.time.TimeYearDayTime` support the concept of\nsubformats.  This allows for variations on the basic theme of a format in both\nthe input string parsing and the output.\n\nThe supported subformats are ``date_hms``, ``date_hm``, and ``date``\nfor all but the :class:`~astropy.time.TimeFITS` format; the latter\ndoes not support ``date_hm`` but does support ``longdate_hms`` and\n``longdate`` for years before the year 0 and after the year 10000.  The\ntable below illustrates these subformats for ``iso``, ``fits``, ``yday``\nformats:\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(UTC)\n``fits``  longdate_hms +02001-01-02T03:04:05.678(UTC)\n``fits``  longdate     +02001-01-02(UTC)\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\nTime from epoch formats\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe formats ``cxcsec``, ``gps``, and ``unix`` are a little special in\nthat they provide a floating point representation of the elapsed\ntime in seconds since a particular reference date.  These formats have\na intrinsic time scale which is used to compute the elapsed seconds\nsince 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``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\" [#]_. See also [#]_ and [#]_.\n::\n\n  >>> Time.SCALES\n  ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\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)\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.. [#] `<http://www.ucolick.org/~sla/leapsecs/timescales.html>`_\n\nThe system of transformation between supported time scales is shown in the\nfigure below.  Further details are provided in the `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.  Like other arrays and lists, |Time| objects\nholding arrays are subscriptable, returning scalar or array objects as\nappropriate::\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\n.. _astropy-time-shape-methods:\n\nNumpy method analogs\n^^^^^^^^^^^^^^^^^^^^\n\nFor |Time| instances holding arrays, many of the same methods and attributes\nthat work on `~numpy.ndarray` instances can be used.  E.g., one can reshape\n|Time| instances and take specific parts using\n:meth:`~astropy.time.Time.reshape`,\n:meth:`~astropy.time.Time.ravel`, :meth:`~astropy.time.Time.flatten`,\n:attr:`~astropy.time.Time.T`, :meth:`~astropy.time.Time.transpose`,\n:meth:`~astropy.time.Time.swapaxes`, :meth:`~astropy.time.Time.diagonal`,\n:meth:`~astropy.time.Time.squeeze`, :meth:`~astropy.time.Time.take`::\n\n  >>> t.reshape(2, 3)  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=[[50000.  50000.5 50001. ]\n   [50001.5 50002.  50002.5]]>\n  >>> t.T  # doctest: +FLOAT_CMP\n  <Time object: scale='utc' format='mjd' value=[[50000.  50001.  50002. ]\n   [50000.5 50001.5 50002.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 it is impossible (as discussed, e.g., in\nthe documentation for numpy :func:`~numpy.reshape`).\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`.\nE.g.::\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.. _astropy-time-inferring-input:\n\nInferring input format\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe |Time| class initializer will not accept ambiguous inputs,\nbut it will make automatic inferences in cases where the inputs are\nunambiguous.  This can apply when the times are supplied as `~datetime.datetime`\nobjects or strings.  In the latter case\nit is not required to specify the format because the available\nstring formats have no overlap.  However, if the format is known in advance\nthe string parsing will be faster if the format is provided.\n::\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\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 section.\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.  The user is 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 string input times\n**out_subfmt** : str\n    Unix glob to select subformats for outputting string times\n**location** : |EarthLocation| or tuple, optional\n    If a tuple, 3 |Quantity| items with length units for geocentric coordinates,\n    or a longitude, latitude, and optional height for geodetic coordinates.\n    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\ncan be a single string or number, or it can be a Python list or `numpy` array\nof strings or numbers. To initialize a |Time| object based on a specified time,\nit *must* be present.  If ``val`` is absent (or `None`), the |Time| object will\nbe created for the time corresponding to the instant the object is created.\n\nIn most situations one also needs to specify the `time scale`_ via the\n``scale`` argument.  The |Time| class will never guess the `time scale`_,\nso a simple 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 specialized situations where extremely\nhigh precision is required.  Recall that the internal representation of time\nwithin `astropy.time` is two double-precision numbers that when summed give\nthe Julian date.  If provided the ``val2`` argument is used in combination with\n``val`` to set the second the internal time values.  The exact interpretation of\n``val2`` is determined by the input format class.  As of this release all\nstring-valued formats ignore ``val2`` and all numeric inputs effectively add\nthe two values in a way that maintains the highest precision.  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 which is independent of time scale.\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', scale='utc', 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 string 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\nOne 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\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 ERFA routine ``eraDtdb`` 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\n  <Longitude 12. hourangle>\n  >>> t.sidereal_time('apparent')  # doctest: +FLOAT_CMP\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\nUsing Time objects\n-------------------\n\nThere are four basic operations available with |Time| objects:\n\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 the `sidereal time`_ corresponding to the time value(s).\n- Do time arithmetic involving |Time| and/or |TimeDelta| objects.\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.plot_date # Date value for plotting with matplotlib plot_date()\n  733773.0\n  >>> t.datetime  # Representation as datetime.datetime object\n  datetime.datetime(2010, 1, 1, 0, 0)\n\nExample::\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\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  >>> 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\nAs noted in the ``Time object basics`` section, a |Time| object is immutable and\nthe internal time values cannot be altered once the object is created.  The\nprocess of changing the time scale therefore begins by making a copy of the\noriginal object and then converting the internal time values in the copy to the\nnew time scale.  The new |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')  # doctest: +SKIP\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 sub-format will clear\nthe cache.  In order to explicitly clear the internal cache do::\n\n  >>> del t.cache  # doctest: +SKIP\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\nSince these objects are immutable (cannot be changed internally), this should\nnot normally be required.\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, one has 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 then 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 http://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 ERFA C-library routine ``eraDtdb`` 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\nThe following code replicates an example in the `SOFA Time Scale and Calendar\nTools <http://www.iausofa.org/sofa_ts_c.pdf>`_ document.  It\ndoes the transform from UTC to all supported time scales (TAI, TCB, TCG, TDB,\nTT, UT1, UTC).  This requires an observer location (here, latitude and\nlongitude).::\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\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\nSidereal Time\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 hourangle, 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.  Sample usage::\n\n  >>> t = Time('2006-01-15 21:24:37.5', scale='utc', location=('120d', '45d'))\n  >>> t.sidereal_time('mean')  # doctest: +FLOAT_CMP\n  <Longitude 13.08952187 hourangle>\n  >>> t.sidereal_time('apparent')  # doctest: +FLOAT_CMP\n  <Longitude 13.08950368 hourangle>\n  >>> t.sidereal_time('apparent', 'greenwich')  # doctest: +FLOAT_CMP\n  <Longitude 5.08950368 hourangle>\n  >>> t.sidereal_time('apparent', '-90d')  # doctest: +FLOAT_CMP\n  <Longitude 23.08950368 hourangle>\n  >>> t.sidereal_time('apparent', '-90d', 'IAU1994')  # doctest: +FLOAT_CMP\n  <Longitude 23.08950365 hourangle>\n\nTime Deltas\n-----------\n\nSimple time arithmetic is supported using the |TimeDelta| class.  The\nfollowing operations are available:\n\n- Create a TimeDelta explicitly by instantiating a class object\n- Create a TimeDelta by subtracting two Times\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 Quantities\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\nThe available time formats are:\n\n=========  ===================================================\nFormat            Class\n=========  ===================================================\nsec        :class:`~astropy.time.TimeDeltaSec`\njd         :class:`~astropy.time.TimeDeltaJD`\n=========  ===================================================\n\nExamples\n^^^^^^^^^\n\nUse of the |TimeDelta| object is easily 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\nTime Scales for Time Deltas\n---------------------------\n\nAbove, one sees that the difference between two UTC times is a |TimeDelta|\nwith a scale of TAI.  This is because a UTC time difference cannot be uniquely\ndefined unless one knows the two times that were differenced (because of leap\nseconds, a day does not always have 86400 seconds).  For all other time\nscales, the |TimeDelta| inherits the scale of the first |Time| 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,\ni.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 there 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.. _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 barycentre or the\nheliocentre.\n\nSuppose you observed IP Peg from Greenwich and have a list of times in MJD form, in\nthe UTC timescale. You then create appropriate |Time| and |SkyCoord| objects and\ncalculate light travel times to the barycentre as follows::\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')\n    >>> times = time.Time([56325.95833333, 56325.978254], format='mjd',\n    ...                   scale='utc', location=greenwich)\n    >>> ltt_bary = times.light_travel_time(ip_peg)\n    >>> ltt_bary # doctest: +FLOAT_CMP\n    <TimeDelta object: scale='tdb' format='jd' value=[-0.0037715  -0.00377286]>\n\nIf you desire the light travel time to the heliocentre instead then use::\n\n    >>> ltt_helio = times.light_travel_time(ip_peg, 'heliocentric')\n    >>> ltt_helio # doctest: +FLOAT_CMP\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 barycentre or\nheliocentre.  Here, one should be careful with the timescales used; for more\ndetailed information about timescales, see :ref:`time-scale`.\n\nThe heliocentre is not a fixed point, and therefore the gravity\ncontinually changes at the heliocentre. Thus, the use of a relativistic\ntimescale like TDB is not particularly appropriate, and, historically,\ntimes corrected to the heliocentre are given in the UTC timescale::\n\n    >>> times_heliocentre = times.utc + ltt_helio\n\nCorrections to the barycentre are more precise than the heliocentre,\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\nbarycentre. For this reason, barycentric corrected times normally use\nthe TDB timescale::\n\n    >>> time_barycentre = times.tdb + ltt_bary\n\nBy default, the light travel time is calculated using the position and velocity\nof Earth and the Sun from built-in `ERFA <https://github.com/liberfa/erfa>`_ routines,\nbut one can also use more precise calculations using the JPL ephemerides (which are derived from\ndynamical models). An example using the JPL ephemerides 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 +FLOAT_CMP\n    <Quantity [0.00058527, 0.00058518] ms>\n\nThe difference between the builtin ephemerides and the JPL ephemerides is normally\nof the order of 1/100th of a millisecond, so the builtin ephemerides should be suitable\nfor most purposes. For more details about what ephemerides are available,\nincluding the requirements for using JPL ephemerides, see :ref:`astropy-coordinates-solarsystem`.\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.  Usage is most easily illustrated by examples::\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, scale='utc', format='jyear')\n  <Time object: scale='utc' format='jyear' value=2000.0>\n  >>> Time(2000.*u.yr, scale='utc', 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\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\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 then the format class and\ncorresponding name is automatically registered in the set of available time\nformats.\n\nThe key elements of a new format class are illustrated by examining the\ncode for the ``jd`` format (which is one of the simplest)::\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 spec for strings.\n\nOne special case that is relatively common and easier to implement is a format\nthat makes a small change to the date format. For instance one could insert ``T``\nin the ``yday`` format with the following ``TimeYearDayTimeCustom`` class. Notice how\nthe ``subfmts`` definition is modified slightly from the standard\n`~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\nAnother special case that is relatively common is a\nformat that represents the time since a particular epoch.  The classic example\nis Unix time which is the number of seconds since 1970-01-01 00:00:00 UTC,\nnot counting leap seconds.  What if we wanted that value but **do** want\nto count leap seconds.  This would be done by using the TAI scale instead\nof the UTC scale.  In this case we inherit from the\n`~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\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 to\nhelp.  If you write a format class that is widely useful then we might want to\ninclude it in the core!\n\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\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 <http://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\nReference/API\n=============\n\n.. automodapi:: astropy.time\n   :inherited-members:\n\n\nAcknowledgments and Licenses\n============================\n\nThis package makes use of the `ERFA Software\n<https://github.com/liberfa/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\" library,\navailable from http://www.iausofa.org.\n"},{"id":136,"name":"docs/stats","nodeType":"Package"},{"id":137,"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":138,"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\nA minimal usage example is shown as follows:\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\nReferences\n==========\n.. [1] Peebles, P.J.E. *The large scale structure of the universe*.\n       <http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1980lssu.book.....P&db_key=AST>\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":139,"name":"robust.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats-robust:\n\n*****************************\nRobust Statistical Estimators\n*****************************\n\nRobust statistics provide 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 to identify outliers in a\ndistribution.  For a distribution of points, a center and a standard\ndeviation are calculated.  Values which are a set number of sigma\ntimes the standard deviation away from the center are rejected.  The\nprocess 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`.  They both return a masked array\nwhere the rejected points are masked.\n\nFirst, let's generate 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, let's 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, iters=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\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, iters=10)\n     >>> print(sigclip)  # doctest: +SKIP\n     <SigmaClip>\n        sigma: 3\n        sigma_lower: None\n        sigma_upper: None\n        iters: 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\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.. 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, iters=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, iters=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\nMedian Absolute Deviation\n=========================\n\nThe median abosolute 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\n`~astropy.stats.median_absolute_deviation`.   For a normal\ndistribution, 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   pre-selecting 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 biweight formalism.  These functions have long been used in astronomy, particularly to calculate the velocity dispersion of galaxy clusters [1]_.   The following 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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n"},{"id":140,"name":"lombscargle.rst","nodeType":"TextFile","path":"docs/stats","text":".. _stats-lombscargle:\n\n*************************\nLomb-Scargle Periodograms\n*************************\n\nThe Lomb-Scargle Periodogram (after Lomb [1]_, and Scargle [2]_)\nis a commonly-used statistical tool designed to detect periodic signals\nin unevenly-spaced observations.\nThe :class:`~astropy.stats.LombScargle` class is a unified interface to several\nimplementations of the Lomb-Scargle periodogram, including a fast *O[NlogN]*\nimplementation following the algorithm presented by Press & Rybicki [3]_.\n\nThe code here is adapted from the `astroml`_ package ([4]_, [5]_) and the `gatspy`_ package ([6]_, [7]_).\nFor a detailed practical discussion of the lomb-scargle periodogram, with code\nexamples based on astropy, see *Understanding the Lomb-Scargle Periodogram* [11]_, with associated code at https://github.com/jakevdp/PracticalLombScargle/.\n\n.. _gatspy: http://www.astroml.org/gatspy/\n.. _astroml: http://astroml.org/\n\n\nBasic Usage\n===========\n\n.. Note::\n   All frequencies in :class:`~astropy.stats.LombScargle` are **not** angular\n   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. For example, consider the following data:\n\n>>> import numpy as np\n>>> rand = np.random.RandomState(42)\n>>> t = 100 * rand.rand(100)\n>>> y = np.sin(2 * np.pi * t) + 0.1 * rand.randn(100)\n\nThese are 100 noisy measurements taken at irregular times, with a frequency\nof 1 cycle per unit time.\nThe Lomb-Scargle periodogram, evaluated at frequencies chosen\nautomatically based on the input data, can be computed as follows\nusing the :class:`~astropy.stats.LombScargle` class:\n\n>>> from astropy.stats 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.stats import LombScargle\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    plt.style.use('ggplot')\n\n    rand = np.random.RandomState(42)\n    t = 100 * rand.rand(100)\n    y = np.sin(2 * np.pi * t) + 0.1 * rand.randn(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\nMeasurement Uncertainties\n-------------------------\n\nThe :class:`~astropy.stats.LombScargle` interface can also handle data with\nmeasurement uncertainties.\nFor example, if 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.rand(100))\n>>> y = np.sin(2 * np.pi * t) + dy * rand.randn(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\nPeriodograms and Units\n----------------------\nThe :class:`~astropy.stats.LombScargle` interface properly handles\n:class:`~astropy.units.Quantity` objects with units attached,\nand will validate the inputs to make sure units are appropriate. For example:\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).\n\n\nSpecifying the Frequency\n------------------------\nWith the :func:`~astropy.stats.LombScargle.autopower` method used above,\na heuristic is applied to select\na suitable frequency grid. By default, the heuristic assumes that the width of\npeaks is inversely proportional to the observation baseline, and that the\nmaximum frequency is a factor of 5 larger than the so-called \"average Nyquist\nfrequency\", computed based on the average 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.stats.LombScargle.autopower` method. For example:\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.0010189890448009111, 1.0179700557561102)\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.0010189890448009111, 5.0939262349597545)\n\nAlternatively, we can use the :func:`~astropy.stats.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\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\nFor example, imagine 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.stats import LombScargle\n\n    rand = np.random.RandomState(42)\n    t = 100 * rand.rand(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.randn(100)\n\n    frequency = np.linspace(0.1, 1.9, 100)\n    power = LombScargle(t, y, dy).power(frequency)\n\n    plt.style.use('ggplot')\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, one might conclude that no clear periodic signal exists\nin the data.\nBut this conclusion is in error: there is in fact a strong periodic signal,\nbut the periodogram peak falls in the gap between the chosen grid points!\n\nA safer approach is to use the frequency heuristic to decide on the appropriate\ngrid spacing to use, optionally passing a minimum and maximum frequency to\nthe :func:`~astropy.stats.LombScargle.autopower` method:\n\n>>> frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n...                                                    maximum_frequency=1.9)\n>>> len(frequency)\n884\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.stats import LombScargle\n\n    rand = np.random.RandomState(42)\n    t = 100 * rand.rand(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.randn(100)\n\n    frequency, power = LombScargle(t, y, dy).autopower(minimum_frequency=0.1,\n                                                       maximum_frequency=1.9)\n\n    plt.style.use('ggplot')\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\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)\n1767\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----------------------\nUnder the hood, the Lomb-Scargle periodogram essentially fits a sinusoidal\nmodel to the data at each frequency, with a larger power reflecting a better\nfit. With this in mind, it is often helpful to plot the best-fit sinusoid\nover the phased data.\n\nThis best-fit sinusoid can be computed using the :func:`~astropy.stats.LombScargle.model` method of the :class:`~astropy.stats.LombScargle` object:\n\n>>> best_frequency = frequency[np.argmax(power)]\n>>> t_fit = np.linspace(0, 1)\n>>> y_fit = LombScargle(t, y, dy).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    plt.style.use('ggplot')\n\n    from astropy.stats import LombScargle\n\n    rand = np.random.RandomState(42)\n    t = 100 * rand.rand(100)\n    dy = 0.1\n    y = np.sin(2 * np.pi * t) + dy * rand.randn(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='phased data at frequency={0:.2f}'.format(best_frequency))\n\nAdditional Arguments\n--------------------\nOn initialization, :class:`~astropy.stats.LombScargle` takes a few additional\narguments 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.\n  The only time it is really warranted to change the default\n  is if you are computing the periodogram of a sequence\n  of constant values to, e.g. estimate the window power spectrum for a series of\n  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 ``fit_mean=True``,\n  the periodogram is more robust than the original Lomb-Scargle formalism,\n  particularly in the case of smaller sample sizes and/or\n  data with nontrivial selection bias. In the literature, this model has\n  variously been called the *date-compensated discrete Fourier transform*,\n  the *floating-mean periodogram*, the  *generalized Lomb-Scargle method*,\n  and likely 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 obvious\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==========================\nThere are several normalizations of the Lomb-Scargle periodogram found in the\nliterature. :class:`~astropy.stats.LombScargle` makes four options available,\nvia the ``normalization`` argument: ``normalization='standard'``\n(the default), ``normalization='model'``, ``normalization='log'``,\nand ``normalization='psd'``.\nThese normalizations are easiest to discuss in terms of least-squares fits around\na constant reference model :math:`M_{ref}` and a periodic model :math:`M(f)` at\neach frequency, with best-fit sum-of-residuals that we'll denote by\n:math:`\\chi^2_{ref}` and :math:`\\chi^2(f)` respectively.\n\nStandard Normalization\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.stats.LombScargle`.\nThe resulting power *P* is a dimensionless quantity that lies in the\nrange *0 ≤ P ≤ 1*.\n\nModel Normalization\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\nquantity that lies in the range *0 ≤ P ≤ ∞*.\n\nLogarithmic Normalization\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--------------------------------\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 no-uncertainty case will have units ``y.unit ** 2``.\nThis normalization is constructed to be\ncomparable to the standard Fourier power 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.\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.randn(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>>> from astropy.tests.helper import quantity_allclose\n>>> quantity_allclose(PSD_fourier, PSD_LS)\nTrue\n\nThis equivalence is one reason 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 e.g. Baluev 2008 [8]_.\n\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   easy to misinterpret or misuse if one is not careful. For a detailed\n   discussion of periodogram peak significance, see 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\nFor example, let's simulate 60 observations of a sine wave with noise:\n\n>>> t = 100 * rand.rand(60)\n>>> dy = 1.0\n>>> y = np.sin(2 * np.pi * t) + dy * rand.randn(60)\n>>> ls = LombScargle(t, y, dy)\n>>> freq, power = ls.autopower()\n>>> print(power.max())  # doctest: +FLOAT_CMP\n0.33814001958188855\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.stats.LombScargle.false_alarm_probability` method:\n\n.. doctest-requires:: scipy\n\n  >>> ls.false_alarm_probability(power.max())  # doctest: +FLOAT_CMP\n  0.0043217866919174324\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  One must be careful in interpreting this probability: it is a measurement\n  conditioned on the assumption of the null hypothesis of no signal; in symbols,\n  one might write :math:`P({\\rm data} \\mid {\\rm noise-only})`.\n\n  It is tempting to interpret this quantity incorrectly; in particular, you\n  might wish to say a statement like \"there is an 0.4% chance that this data\n  is noise only\", but this is *not* a correct statement; in symbols, this\n  statement describes the quantity :math:`P({\\rm noise-only} \\mid {\\rm data})`,\n  and in general :math:`P(A\\mid B) \\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.stats.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.25446627, 0.27436154, 0.31716182])\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\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.\nThis must be either determined through bootstrap simulations, or approximated\nby various means.\n\nAstroPy provides four options for approximating the false alarm probability,\nwhich can be chosen using the ``method`` keyword:\n\n- ``method=\"baluev\"`` (the default)\n  implements the approximation proposed by Baluev 2008 [8]_,\n  which employs extreme value statistics to compute an upper-bound of the false\n  alarm probability for the alias-free case. Experiments show that the bound is\n  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.0043217866919174324\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.0043311525763707216\n\n- ``method=\"naive\"`` is a simplistic 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.0011693992470136049\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    plt.style.use('ggplot')\n\n    from astropy.stats import LombScargle\n\n    rng = np.random.RandomState(42)\n\n    N = 100\n    t = 5 * rng.rand(N)\n    t -= 0.5 * (t % 1)  # create alias-inducing structure in the window function\n    dy = 0.5 * (1 + rng.rand(N))\n    y = dy * rng.randn(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, one should use the bootstrap approach when computationally feasible,\nand 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\n\nPeriodogram Algorithms\n======================\nThe :class:`~astropy.stats.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-square 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-----------------\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-----------------\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 e.g. [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-------------------\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------------------\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-----------------\nThe ``fast`` method is a pure-Python implementation of the fast periodogram of\nPress & Rybicki [3]_. It uses an *extirpolation* approach to approximate\nthe periodogram frequencies using a fast Fourier transform. As with the\n``slow`` method, it can handle data errors and floating mean.\nThe scaling is approximately :math:`O[N\\log M]` for :math:`N`\ndata points and :math:`M` frequencies.\n\n``method='chi2'``\n-----------------\nThe ``chi2`` method is a pure-Python implementation based on matrix algebra\n(see, e.g. [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---------------------\nThe fast chi-squared method of Palmer (2009) [9]_ is equivalent to the ``chi2`` method,\nbut the matrices are constructed using an FFT-based approach similar to that\nof the ``fast`` method. The result is a relatively efficient periodogram\n(though not nearly as efficient as the ``fast`` method) which can be extended\nto multiple terms. The scaling is approximately :math:`O[n_f(M + N\\log M)]`\nfor :math:`N` data points, :math:`M` frequencies, and :math:`n_f` Fourier terms.\n\nSummary\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\nAn example of computing the periodogram for a more realistic dataset is\nshown in the following figure. The data here consist of\n50 nightly observations of a simulated RR Lyrae-like variable star,\nwith lightcurve shape that is more complicated than a simple sine wave:\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    plt.style.use('ggplot')\n\n    from astropy.stats 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.RandomState(rseed)\n        t = phase + np.arange(N, dtype=float)\n        t += 0.1 * rand.randn(N)\n        dmag = 0.01 + 0.03 * rand.rand(N)\n\n        omega = 2 * np.pi / period\n        n = np.arange(1 + len(coeffs) // 2)[:, None]\n\n        mag = (15 + dmag * rand.randn(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%.\nThis example demonstrates that for irregularly-sampled\ndata, the Lomb-Scargle periodogram can be sensitive to frequencies higher\nthan the average Nyquist frequency: the above data are sampled at\nan average 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 factors:\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\n   has non-negligible power at a frequency of 1 cycle per day.\n   Thus we expect aliases to\n   appear at :math:`f_{\\rm alias} = f_{\\rm true} + n f_{\\rm window}` for integer\n   values of :math:`n`. With a true period of 0.41 days and a 1-day signal\n   in the observing window, the :math:`n=+1` and :math:`n=-1`\n   aliases to lie at periods of 0.29 and 0.69 days, respectively:\n   these aliases are prominent in the above plot.\n\nThe interaction of these effects means that in practice there is\nno absolute guarantee that the highest peak corresponds to the best frequency,\nand results must be interpreted carefully.\nFor a detailed discussion of these effects, see [11]_.\n\n\nLiterature References\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\tarXiv:1703.09824 (2017)\n\thttp://adsabs.harvard.edu/abs/2017arXiv170309824V\n"},{"id":141,"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 `statsmodel\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 usage.  For example, sigma clipping,\nwhich is common way to estimate the background of an image, can be\nperformed with the :func:`~astropy.stats.sigma_clip` function.  The\nfunction returns a masked array where outliers are masked::\n\n    >>> data = [1, 5, 6, 8, 100, 5, 3, 2]\n    >>> stats.sigma_clip(data, sigma=2, iters=5)  # doctest: +SKIP\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.. above and below, skipped masked_array tests can be included when we know\n   \"not NUMPY_LT_1_14\"\n\nAlternatively, the :class:`~astropy.stats.SigmaClip` class provides an\nobject-oriented interface to sigma clipping::\n\n    >>> sigclip = stats.SigmaClip(sigma=2, iters=5)\n    >>> sigclip(data)  # doctest: +SKIP\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\nIn addition, there are also several convenience functions for making\nthe calculation of statistics even easier.  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, iters=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\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   lombscargle.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 and\n    classes.  The functionality in `astropy.stats` is intended to supplement\n    this, *not* replace it.\n\n* `statsmodel <http://www.statsmodels.org/stable/index.html>`_\n    The statsmodel package provides functionality for estimating\n    different statistical models, tests, and data exploration.\n\n* `astroML <http://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\nReference/API\n=============\n\n.. automodapi:: astropy.stats\n"},{"id":142,"name":"docs/table","nodeType":"Package"},{"id":143,"name":"implementation_details.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n\n\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.  Note that this applies to astropy version 1.0 and later.\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 `~numpy.ndarray` subclass and is\nthe sole owner of its data.  Maintaining the table as separate columns\nsimplifies table management considerably.  It also makes operations like adding\nor removing columns much faster in comparison to implementations using a numpy\nstructured array container.\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 ``numpy.void`` or ``numpy.ma.mvoid`` object with a copy of the\noriginal data.\n\n"},{"id":144,"name":"indexing.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n.. |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 indexes 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\n.. Warning::\n\n   The table indexing engine is new and is not yet considered stable.\n   It is recommended to avoid using this engine in production code for now.\n\nCreating an index\n=================\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` property::\n\n   >>> t.indices['a']\n    a  rows\n   --- ----\n     1    3\n     2    0\n     2    2\n     3    1\n   >>> t.indices['a', 'b']\n    a   b  rows\n   --- --- ----\n     1   5    3\n     2   6    2\n     2   8    0\n     3   7    1\n\n\n\nRow retrieval using indices\n===========================\n\nRow retrieval can be accomplished using two table properties: `~astropy.table.Table.loc` and\n`~astropy.table.Table.iloc`. The `~astropy.table.Table.loc` property can be indexed either by column value, range of\ncolumn values (*including* the bounds), or a list or 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\n\nNote that by default, `~astropy.table.Table.loc` uses the primary index, which here is column\n'a'. To use a different index, pass the indexed column name before the\nretrieval 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 retrieval information must\nbe either an int or a slice, and relates to the sorted order of the index\nrather than column values. For example::\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\nEffects on performance\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) 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 <http://nbviewer.jupyter.org/github/mdmueller/astropy-notebooks/blob/master/table/indexing-profiling.ipynb>`_ for an IPython notebook profiling various aspects of table indexing.\n\nIndex modes\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 manager. There are\ncurrently three indexing modes: *freeze*, *copy_on_getitem*, and\n*discard_on_copy*. The *freeze* mode prevents automatic index updates whenever\na column of the index is modified, and all indices refresh themselves after the\ncontext ends::\n\n  >>> with t.index_mode('freeze'):\n  ...    t['a'][0] = 0\n  ...    print(t.indices['a']) # unmodified\n   a  rows\n  --- ----\n    1    0\n    2    1\n    3    2\n    4    3\n  >>> print(t.indices['a']) # modified\n   a  rows\n  --- ----\n    0    0\n    2    1\n    3    2\n    4    3\n\nThe *copy_on_getitem* mode forces columns to copy and relabel their indices upon\nslicing. In the absence of this mode, table slices will preserve\nindices while column slices will not::\n\n  >>> t['a'][[1, 3]].info.indices\n  []\n  >>> with t.index_mode('copy_on_getitem'):\n  ...    print(t['a'][[1, 3]].info.indices)\n  [ a  rows\n  --- ----\n    2    0\n    4    1]\n\nThe *discard_on_copy* mode prevents indices from being copied whenever a column\nor table is copied::\n\n  >>> t2 = Table(t)\n  >>> t2.indices['a']\n   a  rows\n  --- ----\n    0    0\n    2    1\n    3    2\n    4    3\n  >>> t2.indices['b']\n   b  rows\n  --- ----\n    1    1\n    9    2\n    9    3\n   10    0\n  >>> with t.index_mode('discard_on_copy'):\n  ...    t2 = Table(t)\n  ...    print(t2.indices)\n  []\n\nUpdating row using indices\n==========================\n\nRow updation can be accomplished by assigning the table property: `~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\nRetrieving the location of rows using indices\n=============================================\n\nRetrieval of the location of rows can be accomplished using a table property: `~astropy.table.Table.loc_indices`.\nThe `~astropy.table.Table.loc_indices` property can be indexed either by column value, range of\ncolumn values (*including* the bounds), or a 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\nEngines\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.FastRBT`, a C-based red-black tree engine\n* `~astropy.table.FastBST`, a C-based binary search tree engine\n* `~astropy.table.BST`, a Python-based binary search tree engine\n\nNote that FastRBT and FastBST depend on the bintrees dependency; without this\ndependency, both classes default to `~astropy.table.BST`. For a comparison of\nengine performance, see `this IPython notebook\n<http://nbviewer.jupyter.org/github/mdmueller/astropy-notebooks/blob/master/table/indexing-profiling.ipynb>`_. Probably\nthe most important takeaway is that `~astropy.table.SortedArray` (the default\nengine) is usually best, although `~astropy.table.FastRBT` may be more\nappropriate for an index created on an empty column since adding new values is quicker.\n"},{"id":145,"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\nAstropy provides a unified interface for reading and writing data\nin different formats.  For many common cases this will\nsimplify the process of file I/O and reduce the need to master\nthe separate details of all the I/O packages within Astropy.  For details and\nexamples of using this interface see the :ref:`table_io`\nsection.\n\nGetting started\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:ref:`built_in_readers_writers`) and new file formats and extensions can be\nregistered with the :class:`~astropy.table.Table` class (see\n:ref:`io_registry`).\n\nTo use this interface, first import the :class:`~astropy.table.Table` class, then\nsimply 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    >>> 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 example,\ndownload tables from Vizier catalogues in 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\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 this see the\nsection :ref:`built_in_readers_writers`.  This section also provides the full list of\nchoices 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"},{"id":146,"name":"mixin_columns.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n.. |join| replace:: :func:`~astropy.table.join`\n.. |Quantity| replace:: :class:`~astropy.units.Quantity`\n.. |Time| replace:: :class:`~astropy.time.Time`\n.. |SkyCoord| replace:: :class:`~astropy.coordinates.SkyCoord`\n\n.. _mixin_columns:\n\nMixin columns\n***************\n\nVersion 1.0 of astropy introduces a new concept of the \"Mixin\nColumn\" in tables which allows integration of appropriate non-|Column| based\nclass objects within a |Table| object.  These mixin column objects are not\nconverted in any way but are used 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\nAs a first 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| object::\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.. _quantity_and_qtable:\n\nQuantity and QTable\n===================\n\nThe ability to natively handle |Quantity| objects within a table makes it\neasier 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 retain complete\nbackward compatibility with astropy versions prior to 1.0, a minor variant of\nthe |Table| class called |QTable| is available.  |QTable| is exactly the same\nas |Table| except that |Quantity| is the default for any data column with a\ndefined 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\nTo illustrate these concepts we first create a standard |Table| where we supply as input a\n|Time| object and a |Quantity| object with units of ``m / s``.  In this case\nthe quantity is converted to a |Column| (which has a ``unit`` attribute but\ndoes not have all 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 quantity table |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 easily 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 one adds 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\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 for a\nnon-Column object to 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`` simply 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, one must *always* use the ``info``\n   property to access column attributes.\n\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 changed internally) and that have an ``insert()`` method.\n|Quantity| supports ``insert()`` but |Time| and |SkyCoord| do not.  If we try to\ninsert a row into the previously defined table an exception occurs::\n\n  >>> qt.add_row((1, '2001-02-03T00:01:02', 5 * u.m / u.s))\n  Traceback (most recent call last):\n    ...\n  ValueError: Unable to insert row because of exception in column 'time':\n  'Time' object has no attribute 'insert'\n\n**Initializing from a list of rows or a list of dicts**\n\nThis mode of initializing a table does not work with mixin columns, so both of\nthe following will fail::\n\n   >>> qt = QTable([{'a': 1 * u.m, 'b': 2},\n   ...              {'a': 2 * u.m, 'b': 3}])  # doctest: +SKIP\n   Traceback (most recent call last):\n    ...\n   TypeError: only dimensionless scalar quantities can be converted to Python scalars\n\n   >>> qt = QTable(rows=[[1 * u.m, 2],\n   ...                   [2 * u.m, 3]])  # doctest: +SKIP\n   Traceback (most recent call last):\n    ...\n   TypeError: only dimensionless scalar quantities can be converted to Python scalars\n\nThe problem lies in knowing if and how to assemble the individual elements\nfor each column into an appropriate mixin column.  The current code uses\nnumpy to perform this function on numerical or string types, but it obviously\ndoes not handle mixin column types like |Quantity| or |SkyCoord|.\n\n**Masking**\n\nMixin columns do not support masking, but there is limited support for use of\nmixins within a masked table.  In this case a ``mask`` attribute is assigned to\nthe mixin column object.  This ``mask`` is a special object that is a boolean\narray of ``False`` corresponding to the mixin data shape.  The ``mask`` looks\nlike a normal numpy array but an exception will be raised if ``True`` is assigned\nto any element.  The consequences of the limitation are most obvious in the\nhigh-level table operations.\n\n**High-level table operations**\n\nThe table below gives a summary of support for high-level operations on tables\nthat contain mixin columns:\n\n.. list-table::\n   :header-rows: 1\n   :widths: 28 72\n\n   * - Operation\n     - Support\n   * - :ref:`grouped-operations`\n     - Not implemented yet, but no fundamental limitation\n   * - :ref:`stack-vertically`\n     - Available for `~astropy.units.Quantity` and any other mixin classes that provide an\n       `new_like() method`_ in the ``info`` descriptor.\n   * - :ref:`stack-horizontally`\n     - Works if output mixin column supports masking or if no masking is required\n   * - :ref:`table-join`\n     - Works if output mixin column supports masking or if no masking is required; key\n       columns must be subclasses of `numpy.ndarray`.\n   * - :ref:`unique-rows`\n     - Not implemented yet, uses grouped operations\n\n**ASCII table writing**\n\nMixin columns can be written out to file using the `astropy.io.ascii` module,\nbut the fast C-based writers are not available.  Instead the legacy pure-Python\nwriters will be used.\n\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 simple and requires that a class behave like a minimal numpy array\nwith 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  ``astropy.utils.data_info.MixinInfo`` class.\n\nThe `Example: ArrayWrapper`_ section shows a working minimal example of a class\nwhich can be used as a mixin column.  A `pandas.Series\n<http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html>`_\nobject can function 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 `~astropy.table.join` and\n`~astropy.table.vstack`, a mixin class must provide a ``new_like()`` method\nin the ``info`` class descriptor.  A key part of the functionality is to ensure\nthat the input column metadata are merged appropriately and that the columns\nhave consistent properties such as the shape.\n\nA mixin class that provides ``new_like()`` must also implement ``__setitem__``\nto support setting via a single item, slicing, or index array.\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 : str ('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 a example of a data container class which acts as\na mixin column class.  This class is a simple wrapper around a numpy array.  It\nis used in the astropy mixin test suite and is fully compliant as a mixin\ncolumn.\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 (\"<{0} name='{1}' data={2}>\"\n                  .format(self.__class__.__name__, self.info.name, self.data))\n"},{"id":147,"name":"operations.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n.. |join| replace:: :func:`~astropy.table.join`\n\n.. _table_operations:\n\nTable operations\n*****************\n\nIn this section we describe higher-level operations that can be used to generate a new\ntable 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     - `~astropy.table.Table.group_by`\n   * - `Binning`_\n     - Binning tables\n     - `~astropy.table.Table.group_by`\n   * - `Stack vertically`_\n     - Concatenate input tables along rows\n     - `~astropy.table.vstack`\n   * - `Stack horizontally`_\n     - Concatenate input tables along columns\n     - `~astropy.table.hstack`\n   * - `Join`_\n     - Database-style join of two tables\n     - `~astropy.table.join`\n   * - `Unique rows`_\n     - Unique table rows by keys\n     - `~astropy.table.unique`\n   * - `Set difference`_\n     - Set difference of two tables\n     - `~astropy.table.setdiff`\n\n\n.. _grouped-operations:\n\nGrouped operations\n------------------\n\nSometimes in a table or table column there are natural groups within the dataset for which\nit makes sense to compute some derived values.  A simple example is a list of objects with\nphotometry 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\nTable groups\n^^^^^^^^^^^^^^\n\nNow suppose we want the mean magnitudes for each object.  We first group the data by the\n``name`` column with the :func:`~astropy.table.Table.group_by` method.  This returns\na new table sorted by ``name`` which has a ``groups`` property specifying the unique\nvalues 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 columns.\nIt defines how the table is grouped via an array of the unique row key values and the\nindices of the group boundaries for those key values.  The groups here correspond to the\nrow slices ``0:4``, ``4:7``, and ``7:10`` in the ``obs_by_name`` table.\n\nThe initial argument (``keys``) for the `~astropy.table.Table.group_by` function\ncan 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 tuple of values which\nform a key value that is used to sort the original table and generate\nthe 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 follows::\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\nOnce you have applied grouping to a table then you can easily access the individual\ngroups or subsets of groups.  In all cases this returns a new grouped table.\nFor instance to get the sub-table which corresponds to the second group (index=1)\ndo::\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 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 particular\ngroups, e.g.::\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\nOne can iterate over the group sub-tables and corresponding keys with::\n\n  >>> for key, group in zip(obs_by_name.groups.keys, obs_by_name.groups):\n  ...     print('****** {0} *******'.format(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\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`~astropy.table.Table.group_by` method.  The difference here is that\nthere is no option of providing one or more column names since that\ndoesn't make sense for a |Column|.\n\nExamples::\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('****** {0} *******'.format(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\nAggregation\n^^^^^^^^^^^^^^\n\nAggregation is the process of applying a\nspecified reduction function to the values within each group for each\nnon-key column.  This function must accept a numpy array as the first\nargument and return a single scalar value.  Common function examples are\n`numpy.sum`, `numpy.mean`, and `numpy.std`.\n\nFor the example grouped table ``obs_by_name`` from above we compute the group means with\nthe `~astropy.table.groups.TableGroups.aggregate` method::\n\n  >>> obs_mean = obs_by_name.groups.aggregate(np.mean)  # doctest: +SKIP\n  WARNING: Cannot aggregate column 'obs_date' [astropy.table.groups]\n  >>> print(obs_mean)  # doctest: +SKIP\n  name mag_b mag_v\n  ---- ----- ------\n  M101  15.0 13.725\n   M31  17.0   17.4\n   M82  15.7   15.5\n\nIt seems the magnitude values were successfully averaged, but what\nabout the WARNING?  Since the ``obs_date`` column is a string-type\narray, the `numpy.mean` function failed and raised an exception.\nAny time this happens then `~astropy.table.groups.TableGroups.aggregate`\nwill issue a warning and then\ndrop that column from the output result.  Note that the ``name``\ncolumn is one of the ``keys`` used to determine the grouping so\nit is automatically ignored from aggregation.\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))  # doctest: +SKIP\n  mag_b\n  -----\n   15.0\n   17.0\n   15.1\n\n\n  >>> print(obs_by_name['name', 'mag_v', 'mag_b'].groups.aggregate(np.mean))  # doctest: +SKIP\n  name mag_v  mag_b\n  ---- ------ -----\n  M101 13.725  15.0\n   M31   17.4  17.0\n   M82   15.5  15.7\n\n.. above tests skipped as results look different in \"not NUMPY_LT_1_14\".\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('Sum for {0} = {1}'.format(key, cg_sum))\n  ...\n  Sum for bar = 2\n  Sum for foo = 8\n  Sum for qux = 11\n\nIf the specified function has a `numpy.ufunc.reduceat` method, this will be called instead.\nThis can improve the performance by a factor of 10 to 100 (or more) for large unmasked\ntables or columns with many relatively small groups.  It also allows for the use of\ncertain numpy functions which normally take more than one input array but also work as\nreduction functions, like `numpy.add`.  The numpy functions which should take advantage of\nusing `numpy.ufunc.reduceat` include:\n\n`numpy.add`, `numpy.arctan2`, `numpy.bitwise_and`, `numpy.bitwise_or`, `numpy.bitwise_xor`,\n`numpy.copysign`, `numpy.divide`, `numpy.equal`, `numpy.floor_divide`, `numpy.fmax`,\n`numpy.fmin`, `numpy.fmod`, `numpy.greater_equal`, `numpy.greater`, `numpy.hypot`,\n`numpy.left_shift`, `numpy.less_equal`, `numpy.less`, `numpy.logaddexp2`,\n`numpy.logaddexp`, `numpy.logical_and`, `numpy.logical_or`, `numpy.logical_xor`,\n`numpy.maximum`, `numpy.minimum`, `numpy.mod`, `numpy.multiply`, `numpy.not_equal`,\n`numpy.power`, `numpy.remainder`, `numpy.right_shift`, `numpy.subtract` and `numpy.true_divide`.\n\nAs special cases `numpy.sum` and `numpy.mean` are substituted with their\nrespective reduceat methods.\n\n\nFiltering\n^^^^^^^^^^\n\nTable groups can be filtered by means of the\n`~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`.  As an example, the following\nwill 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\nAn example of using this function is::\n\n  >>> t = Table.read(\"\"\" a   b    c\n  ...                   -2  7.0   0\n  ...                   -2  5.0   1\n  ...                    1  3.0  -5\n  ...                    1 -2.0  -6\n  ...                    1  1.0   7\n  ...                    0  0.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   0\n   -2 5.0   1\n  <BLANKLINE>\n   a   b   c\n  --- --- ---\n    0 0.0   4\n\nAs can be seen only the groups with ``a == -2`` and ``a == 0`` have all positive values\nin the non-key columns, so those are the ones that are selected.\n\nLikewise a grouped column can be filtered with the\n`~astropy.table.groups.ColumnGroups.filter`, method but in this case the filtering\nfunction takes only a single argument which is the column group.  It still must return\neither `True` or `False`.  For example::\n\n  def all_positive(column):\n      if np.any(column < 0):\n          return False\n      return True\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 easily 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 simple 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 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.  As an example, 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 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 ``np.mean``.\n\n  >>> dat_grouped = dat.group_by(year_bin)\n  >>> dat_binned = dat_grouped.groups.aggregate(np.mean)\n\nThen one might plot the results with ``plt.plot(dat_binned['year'], dat_binned['mag'],\n'.')``.   Alternately one 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 plot with ``plt.plot(dat_binned['phase'], dat_binned['mag'])``.\n\n.. _stack-vertically:\n\nStack vertically\n--------------------\n\nThe |Table| class supports stacking tables vertically with the\n`~astropy.table.vstack` function.  This process is also commonly known as\nconcatenating or appending tables in the row direction.  It corresponds roughly\nto the `numpy.vstack` function.\n\nFor example, suppose one has two tables of observations with several\ncolumn names in common::\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 stacked output\ntable those values are marked as missing.  This is the default behavior and corresponds to\n``join_type='outer'``.  There are two other allowed values for the ``join_type`` argument,\n``'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) are\npresent in the output table.  When ``join_type='exact'`` is specified then\n`~astropy.table.vstack` requires that all the input tables\nhave exactly the same column names.\n\nMore than two tables can be stacked by supplying a list of table objects::\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\nattributes`_ for details on how these characteristics of the input tables are merged in\nthe single output table.  Note also that you can use a single table row instead of a\nfull table as one of the inputs.\n\n.. _stack-horizontally:\n\nStack horizontally\n---------------------\n\nThe |Table| class supports stacking tables horizontally (in the column-wise direction) with the\n`~astropy.table.hstack` function.    It corresponds roughly\nto the `numpy.hstack` function.\n\nFor example, suppose one has 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 `~astropy.table.vstack`, there is an optional ``join_type`` argument\nthat can take values ``'inner'``, ``'exact'``, and ``'outer'``.  The default is\n``'outer'``, which effectively takes the union of available rows and masks out any missing\nvalues.  This is illustrated in the example above.  The other options give the\nintersection of rows, where ``'exact'`` requires that all tables have exactly the same\nnumber 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 list of table objects.  The example\nbelow also illustrates the behavior when there is a conflict in the input column names\n(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\n\nThe metadata from the input tables is merged by the process described in the `Merging\nmetadata`_ section.  Note also that you can use a single table row instead of a\nfull table as one of the inputs.\n\n.. _table-join:\n\nJoin\n--------------\n\nThe |Table| class supports the `database join <https://en.wikipedia.org/wiki/Join_(SQL)>`_\noperation.  This provides a flexible and powerful way to combine tables based on the\nvalues in one or more key columns.\n\nFor example, suppose one has two tables of observations, the first with B and V magnitudes\nand the second with X-ray luminosities of an overlapping (but not identical) sample::\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 one to merge these two tables into a single table based on\nmatching values in the \"key columns\".  By default the key columns are the set of columns\nthat are common to both tables.  In this case the key columns are ``name`` and\n``obs_date``.  We can find all the observations of the same object on the same date as\nfollows::\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 only by ``name`` by providing the ``keys`` argument, which can be\neither 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 observations that have both optical and X-ray data for an object\n(M31 and M82).  Notice that since the ``obs_date`` column occurs in both tables it has\nbeen split into two columns, ``obs_date_1`` and ``obs_date_2``.  The values are taken from\nthe \"left\" (``optical``) and \"right\" (``xray``) tables, respectively.\n\n\nDifferent join options\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe table joins so far are known as \"inner\" joins and represent the strict intersection of\nthe two tables on the key columns.\n\nIf one wants to make a new table which has *every* row from the left table and includes\nmatching values from the right table when available, this is known as a left 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 the table.\nWhen there are any missing values the output will be a masked table (see\n:ref:`masking_and_missing_values` for more information).  You might be\nsurprised that there is no X-ray data for M31 in the output.  Remember that the default\nmatching key includes both ``name`` and ``obs_date``.  Specifying the key as only the\n``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 one can construct a new table with every row of the right table and matching left\nvalues (when available) using ``join_type='right'``.\n\nFinally, to 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 cases the output join table will be sorted by the key column(s) and in general\nwill not preserve the row order of the input tables.\n\nNon-identical key column names\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe |join| function requires the key column names to be identical in the\ntwo tables. However, in the following one table has a ``'name'`` column\nwhile 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, one has to\ntemporarily rename one of the columns mentioned above, right before creating\nthe new table::\n\n  >>> xray_1.rename_column('obj_id', 'name')\n  >>> opt_xray_1 = join(optical, xray_1, keys='name')\n  >>> xray_1.rename_column('name', 'obj_id')\n  >>> print(opt_xray_1)\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\nThe original ``xray_1`` table remains unchanged after the operation::\n\n  >>> print(xray_1)\n  obj_id  obs_date  logLx\n  ------- ---------- -----\n  NGC3516 2011-11-11  42.1\n      M31 1999-01-05  43.1\n      M82 2012-10-29  45.0\n\n\nIdentical key values\n^^^^^^^^^^^^^^^^^^^^\n\nThe |Table| join operation works even if there are multiple rows with identical key\nvalues.  For example the following tables have multiple rows for the key column ``x``::\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 `Cartesian\nproduct <https://en.wikipedia.org/wiki/Cartesian_product>`_.  For each matching key, every\ncombination of the left and right tables is represented.  When there is no match in either\nthe left or right table, the corresponding column values are designated as missing.\n\n.. doctest-skip:: win32\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\n.. note::\n\n   The output table is sorted on the key columns, but when there are rows with identical\n   keys the output order in the non-key columns is not guaranteed to be identical across\n   installations.  In the example above the order within the four rows with ``key == 1``\n   can vary.\n\nAn inner join is the same but only returns rows where there is a key match in both the\nleft and right tables:\n\n.. doctest-skip:: win32\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 section on\n`Column renaming`_.  See also the sections on `Merging metadata`_ and `Merging column\nattributes`_ for details on how these characteristics of the input tables are merged in\nthe single output table.\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\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    Two-element list of strings that provide a name 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 most easily 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\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 the input\ntables into a single output structure.  Because the metadata can be arbitrarily complex\nthere is no unique way to do the merge.  The current implementation uses a simple\nrecursive algorithm with four rules:\n\n- `dict` elements are merged by keys\n- Conflicting `list` or `tuple` elements are concatenated\n- Conflicting `dict` elements are merged by recursively calling the merge function\n- Conflicting elements that are not both `list`, `tuple`, or `dict` will follow the following rules:\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 picked\n    - If both metadata values are different and neither is `None`, the one for 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 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 one also will use the\n`~astropy.utils.metadata.enable_merge_strategies` for enable 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 ``unit``,\n``format``, and ``description`` are merged by going through the input tables in\norder and taking the first value which is defined (i.e. is not None).  For example::\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: +SKIP\n  WARNING: MergeConflictWarning: In merged column 'a' the 'unit' attribute does\n  not match (cm != m).  Using m for merged output [astropy.table.operations]\n  >>> out['a'].unit  # doctest: +SKIP\n  Unit(\"m\")\n\nThe rules for merging are as for `Merging metadata`_, and the\n``metadata_conflicts`` option also controls the merging of column attributes.\n\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:func:`~astropy.table.Table.group_by` method and ``groups`` attribute, or\nwith the `~astropy.table.unique` convenience function. The\n`~astropy.table.unique` function returns with a sorted table containing the\nfirst row for each unique ``keys`` column value. If no ``keys`` is provided\nit returns with a sorted table containing all the fully unique rows.\n\nA simple example 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\n.. _set-difference:\n\nSet difference\n--------------\n\nA set difference will tell you the elements that are contained in one set but\nnot in the other.  This concept can be applied to rows of a table by using the\n`~astropy.table.setdiff` function. You provide the function with two input\ntables and it will return all rows in the first table which do not occur in\nthe 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 `~astropy.table.setdiff` function will\nreturn an empty table.\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"},{"col":0,"comment":"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : file path, file object, file-like object or pathlib.Path object\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly' (default), 'update', 'append', 'denywrite', or\n        'ostream'.\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?\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that a\n        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\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: `True`).\n\n    lazy_load_hdus : bool, option\n        By default `~astropy.io.fits.open` will not read all the HDUs and\n        headers in a FITS file immediately upon opening.  This is an\n        optimization especially useful for large files, as FITS has no way\n        of determining the number and offsets of all the HDUs in a file\n        without scanning through the file and reading all the headers.\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    kwargs : dict, optional\n        additional optional keyword arguments, possible values are:\n\n        - **uint** : bool\n\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            This is enabled by default so that the pseudo-unsigned\n            integer convention is assumed.\n\n            Note, for backward compatibility, the kwarg **uint16** may\n            be used instead.  The kwarg was renamed when support was\n            added for integers of any size.\n\n        - **ignore_missing_end** : bool\n\n            Do not issue an exception when opening a file that is\n            missing an ``END`` card in the last header.\n\n        - **checksum** : bool, str\n\n            If `True`, verifies that both ``DATASUM`` and\n            ``CHECKSUM`` card values (when present in the HDU header)\n            match the header and data of all HDU's in the file.  Updates to a\n            file that already has a checksum will preserve and update the\n            existing checksums unless this argument is given a value of\n            'remove', in which case the CHECKSUM and DATASUM values are not\n            checked, and are removed when saving changes to the file.\n\n        - **disable_image_compression** : bool\n\n            If `True`, treats compressed image HDU's like normal\n            binary table HDU's.\n\n        - **do_not_scale_image_data** : bool\n\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read.\n\n        - **character_as_bytes** : bool\n\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        - **ignore_blank** : bool\n\n            If `True`, the BLANK keyword is ignored if present.\n\n        - **scale_back** : bool\n\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.\n\n    Returns\n    -------\n        hdulist : an `HDUList` object\n            `HDUList` containing all of the header data units in the\n            file.\n\n    ","endLoc":164,"header":"def fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, **kwargs)","id":148,"name":"fitsopen","nodeType":"Function","startLoc":28,"text":"def fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, **kwargs):\n    \"\"\"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : file path, file object, file-like object or pathlib.Path object\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly' (default), 'update', 'append', 'denywrite', or\n        'ostream'.\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?\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that a\n        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\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: `True`).\n\n    lazy_load_hdus : bool, option\n        By default `~astropy.io.fits.open` will not read all the HDUs and\n        headers in a FITS file immediately upon opening.  This is an\n        optimization especially useful for large files, as FITS has no way\n        of determining the number and offsets of all the HDUs in a file\n        without scanning through the file and reading all the headers.\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    kwargs : dict, optional\n        additional optional keyword arguments, possible values are:\n\n        - **uint** : bool\n\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            This is enabled by default so that the pseudo-unsigned\n            integer convention is assumed.\n\n            Note, for backward compatibility, the kwarg **uint16** may\n            be used instead.  The kwarg was renamed when support was\n            added for integers of any size.\n\n        - **ignore_missing_end** : bool\n\n            Do not issue an exception when opening a file that is\n            missing an ``END`` card in the last header.\n\n        - **checksum** : bool, str\n\n            If `True`, verifies that both ``DATASUM`` and\n            ``CHECKSUM`` card values (when present in the HDU header)\n            match the header and data of all HDU's in the file.  Updates to a\n            file that already has a checksum will preserve and update the\n            existing checksums unless this argument is given a value of\n            'remove', in which case the CHECKSUM and DATASUM values are not\n            checked, and are removed when saving changes to the file.\n\n        - **disable_image_compression** : bool\n\n            If `True`, treats compressed image HDU's like normal\n            binary table HDU's.\n\n        - **do_not_scale_image_data** : bool\n\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read.\n\n        - **character_as_bytes** : bool\n\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        - **ignore_blank** : bool\n\n            If `True`, the BLANK keyword is ignored if present.\n\n        - **scale_back** : bool\n\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.\n\n    Returns\n    -------\n        hdulist : an `HDUList` object\n            `HDUList` containing all of the header data units in the\n            file.\n\n    \"\"\"\n\n    from .. 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('Empty filename: {!r}'.format(name))\n\n    return HDUList.fromfile(name, mode, memmap, save_backup, cache,\n                            lazy_load_hdus, **kwargs)"},{"id":149,"name":"masking.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n\n.. _masking_and_missing_values:\n\nMasking and missing values\n**************************\n\nThe `astropy.table` package provides support for masking and missing\nvalues in a table by wrapping the ``numpy.ma`` masked array package.\nThis allows handling tables with missing or invalid entries in much\nthe same manner as for standard (unmasked) tables.  It\nis useful to be familiar with the `masked array\n<https://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html>`_\ndocumentation when using masked tables within `astropy.table`.\n\nIn a nutshell, the concept is to define a boolean mask that mirrors\nthe structure of the table 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://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html#operations-on-masked-arrays>`_.\n\n.. Note::\n\n   Reduction operations like `numpy.sum` or `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   See `<http://www.numpy.org/NA-overview.html>`_ for a very\n   interesting discussion of different strategies for handling\n   missing data in the context of `numpy`.\n\nTable creation\n===============\n\nA masked table can be created in several ways:\n\n**Create a new table object and specify masked=True** ::\n\n  >>> from astropy.table import Table, Column, MaskedColumn\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\nNotice the table attributes ``mask`` and ``fill_value`` that are\navailable for a masked table.\n\n**Create a table with one or more columns as a MaskedColumn object**\n\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 masked=True 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\nprovides the interface for creating and manipulating a column of\nmasked data.  The |MaskedColumn| class inherits from\n`numpy.ma.MaskedArray`, in contrast to |Column| which inherits from\n`numpy.ndarray`.  This distinction is the main reason there are\ndifferent 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  >>> from numpy import ma  # masked array package\n  >>> a = ma.array([1, 2])\n  >>> b = [3, 4]\n  >>> t = Table([a, b], names=('a', 'b'))\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  INFO: Upgrading Table to masked Table. Use Table.filled() to convert to unmasked table. [astropy.table.table]\n\nNote the INFO message because the underlying type of the table is modified in this operation.\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  INFO: Upgrading Table to masked Table. Use Table.filled() to convert to unmasked table. [astropy.table.table]\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)  # convert to masked table\n\nTable access\n============\n\nNearly all the of standard methods for accessing and modifying data\ncolumns, rows, and individual elements also apply to masked tables.\n\nThere are two minor differences for the |Row| object that is obtained by\nindexing a single row of a table:\n\n- For standard tables, two such rows can be compared for equality, but\n  in masked tables this comparison will produce an exception.\n\nBoth of these differences are due to issues in the underlying\n`numpy.ma.MaskedArray` implementation.\n\nMasking and filling\n====================\n\nBoth the |Table| and |MaskedColumn| classes provide\nattributes and methods to support manipulating tables with missing or\ninvalid data.\n\nMask\n----\n\nThe actual mask for the table as a whole or a single column can be\nviewed 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\nFilling\n-------\n\nThe entries which are masked (i.e. missing or invalid) can be replaced\nwith specified fill values.  In this case the |MaskedColumn| or masked\n|Table| will be converted to a standard |Column| or table. Each column\nin a masked table has a ``fill_value`` attribute that specifies the\ndefault fill value for that column.  To perform the actual replacement\noperation the ``filled()`` method is called.  This takes an optional\nargument 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"},{"id":150,"name":"references.txt","nodeType":"TextFile","path":"docs/table","text":".. |Row| replace:: :class:`~astropy.table.Row`\n.. |Table| replace:: :class:`~astropy.table.Table`\n.. |QTable| replace:: :class:`~astropy.table.QTable`\n.. |Column| replace:: :class:`~astropy.table.Column`\n.. |MaskedColumn| replace:: :class:`~astropy.table.MaskedColumn`\n.. |TableColumns| replace:: :class:`~astropy.table.TableColumns`\n.. _OrderedDict: https://docs.python.org/3/library/collections.html#collections.OrderedDict\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":151,"name":"ON_RTD","nodeType":"Attribute","startLoc":30,"text":"ON_RTD"},{"id":152,"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 <http://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 be able to easily exchange data between the :class:`~astropy.table.Table` class and the pandas `DataFrame`_ class (the main data structure in pandas), the :class:`~astropy.table.Table` class includes two methods, :meth:`~astropy.table.Table.to_pandas` and :meth:`~astropy.table.Table.from_pandas`.\n\nTo demonstrate these, we can create a simple 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 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 `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        \nThe conversions to/from pandas are subject to the following caveats:\n\n* The pandas `DataFrame`_ structure does not support multi-dimensional\n  columns, so :class:`~astropy.table.Table` objects with multi-dimensional\n  columns cannot be converted to `DataFrame`_.\n\n* Masked tables can be converted, but `DataFrame`_ uses ``numpy.nan`` to\n  indicate masked values, so all numerical columns (integer or float) are\n  converted to ``numpy.float`` columns in `DataFrame`_, and string columns with\n  missing values are converted to object columns with ``numpy.nan`` values to\n  indicate missing values. For numerical columns, the conversion therefore does\n  not necessarily round-trip if converting back to an Astropy table, because the\n  distinction between ``numpy.nan`` and masked values is lost, and the different\n  for example integer columns will be converted to floating-point.\n  \n* Tables with mixin columns can currently not be converted, but this may be\n  implemented in the future.\n\n.. _DataFrame: http://pandas-docs.github.io/pandas-docs-travis/\n"},{"id":154,"name":"access_table.rst","nodeType":"TextFile","path":"docs/table","text":".. _access_table:\n\n.. include:: references.txt\n\nAccessing a table\n*****************\n\nAccessing the table properties and data is straightforward and is generally consistent with\nthe basic interface for `numpy` structured arrays.\n\n.. Warning:: Astropy 2.0 introduces an API change that affects comparison of\n   bytestring column elements in Python 3.  See\n   :ref:`bytestring-columns-python-3` for details.\n\nQuick overview\n==============\n\nFor the impatient, 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 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 obj for with row 1 values\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(max_lines=-1, max_width=-1)  # Print full table no matter how long / wide it is\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\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 the following examples it is assumed that the table has been created as below::\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 = \"%6.3f\"  # print as a float 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\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  %6.3f unladen swallow velocity\n     b int32\n     c int32\n\nIf called as a function then one 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: +SKIP\n  <Table length=5>\n  name mean      std      min max\n  ---- ---- ------------- --- ---\n     a  6.0 4.24264068712   0  12\n     b  7.0 4.24264068712   1  13\n     c  8.0 4.24264068712   2  14\n\n  >>> t.info(['attributes', 'stats'])  # doctest: +SKIP\n  <Table length=5>\n  name dtype   unit   format       description        mean      std      min max\n  ---- ----- -------- ------ ------------------------ ---- ------------- --- ---\n     a int32 m sec^-1  %6.3f unladen swallow velocity  6.0 4.24264068712   0  12\n     b int32                                           7.0 4.24264068712   1  13\n     c int32                                           8.0 4.24264068712   2  14\n\nColumns also have an ``info`` property that has the behavior and arguments,\nbut provides information about a single column::\n\n  >>> t['a'].info\n  name = a\n  dtype = int32\n  unit = m sec^-1\n  format = %6.3f\n  description = unladen swallow velocity\n  class = Column\n  n_bad = 0\n  length = 5\n\n  >>> t['a'].info('stats')  # doctest: +SKIP\n  name = a\n  mean = 6.0\n  std = 4.24264068712\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 meta-data, and number of table rows.  The table\nmeta-data is simply an ordered dictionary (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='%6.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 meta-data as its parent table::\n\n  >>> t[1].columns\n  <TableColumns names=('a','b','c')>\n\n  >>> t[1].colnames\n  ['a', 'b', 'c']\n\nSlicing a table returns a new table object which references to the original\ndata within the slice region (See :ref:`copy_versus_reference`).  The table\nmeta-data 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\nFinally, you can access the underlying table data as a native `numpy`\nstructured array by creating a copy or reference with ``np.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\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 :meth:`~astropy.table.Table.more` or Column\n  :meth:`~astropy.table.Column.more` methods to interactively scroll\n  through table values.\n- Table :meth:`~astropy.table.Table.pprint` or Column\n  :func:`~astropy.table.Column.pprint` methods to print a formatted version of\n  the table to the screen.\n- Table :meth:`~astropy.table.Table.pformat` or Column\n  :func:`~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\n  way 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.  For example::\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\nmore() method\n^^^^^^^^^^^^^\n\nIn order to browse all rows of a table or column use the Table\n:meth:`~astropy.table.Table.more` or Column :func:`~astropy.table.Column.more`\nmethods.  These let you interactively scroll through the rows much like the\nlinux ``more`` command.  Once part of the table or column is displayed the\nsupported navigation 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\n:meth:`~astropy.table.Table.pprint` or Column\n:func:`~astropy.table.Column.pprint` methods.  These have keyword\narguments ``max_lines``, ``max_width``, ``show_name``, ``show_unit`` with\nmeaning as shown below::\n\n  >>> arr = np.arange(3000, dtype=float).reshape(100, 30)\n  >>> t = Table(arr)\n  >>> t['col0'].format = '%e'\n  >>> t['col1'].format = '%.6f'\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=True)\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_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\nset ``max_lines`` or ``max_width`` to ``-1``, respectively.  For the wide\ntable in this example you see 6 lines of wrapped output like the following::\n\n  >>> t.pprint(max_lines=8, max_width=-1)  # 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\n:func:`~astropy.table.Column.pprint` is the same except that there is no\n``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'].format = '<'\n  >>> t1['long column name 3'].format = '0='\n  >>> t1['long column name 4'].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 :meth:`~astropy.table.Table.pformat` or Column\n:func:`~astropy.table.Column.pformat` methods.  These behave just as for\n:meth:`~astropy.table.Table.pprint` but return a list corresponding to each formatted line in the\n:meth:`~astropy.table.Table.pprint` output.\n\n  >>> lines = t['col3'].pformat(max_lines=8)\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 3 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  >>> from astropy.table import Table, Column\n  >>> import numpy as np\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 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\nA `~astropy.table.Column` object with units within a standard\n`~astropy.table.Table` (as opposed to a `~astropy.table.QTable`) has certain\nquantity-related conveniences available.  To begin with, it can be converted\nexplicitly to a `~astropy.units.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\nlike an Astropy `~astropy.units.Quantity` in *some* arithmetic\nexpressions (see the warning below for caveats to 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\n  `~astropy.units.Quantity`. Table columns act more like regular numpy\n  arrays unless either explicitly converted to a\n  `~astropy.units.Quantity` or combined with an\n  `~astropy.units.Quantity` using an arithmetic operator.For example,\n  the following does not work the way you would expect::\n\n    >>> import numpy as np\n    >>> from astropy.table import Table\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 unit is degrees, *and* ``sin`` treated\n  the values and radians rather than degrees.  If at all in doubt that you'll\n  get the right result, the safest choice is to either use\n  `~astropy.table.QTable` or to explicitly convert to\n  `~astropy.units.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 in Python 3\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPrior to astropy 2.0, using bytestring columns (numpy ``'S'`` dtype) in Python\n3 was inconvenient because it was not possible to compare with the natural\nPython string (``str``) type.  See `The bytes/str dichotomy in Python 3\n<http://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 Python 3 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 in memory 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.\nStarting with astropy 2.0 it is possible to work directly and conveniently with\nbytestring data in astropy Table and Column\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\nPython 3 examples\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe examples below highlight the change in behavior introduced by astropy 2.0\nfor Python 3.  *In particular* please note the API change when comparing with a\nsingle element of a bytestring column.  Previously one was required to compare\nwith a ``bytes`` object while now one must compare with a ``str`` object.  When\ncomparing with the entire column one can use either a ``bytes`` or ``str``.\n\n.. doctest-skip-all\n\n**Before astropy 2.0**\n\n    >>> from astropy.table import Table\n    >>> t = Table([['abc', 'def']], names=['a'], dtype=['S'])\n\n    >>> t['a'] == 'abc'  # WRONG answer!\n    False\n\n    >>> t['a'] == b'abc'  # Must explicitly compare to bytestring\n    array([ True, False], dtype=bool)\n\n    >>> t = Table([['bä', 'def']], dtype=['S'])\n    Traceback (most recent call last):\n      ...\n    UnicodeEncodeError: 'ascii' codec can't encode character '\\xe4' in position 1:\n                        ordinal not in range(128)\n\n**Astropy 2.0 or later**:\n\n    >>> t = Table([['abc', 'def']], names=['a'], dtype=['S'])\n\n    >>> t['a'] == 'abc'  # Gives expected answer\n    array([ True, False], dtype=bool)\n\n    >>> t['a'] == b'abc'  # Still gives expected answer\n    array([ True, False], dtype=bool)\n\n    >>> t['a'][0] == 'abc'  # Expected answer\n    True\n\n    >>> t['a'][0] == b'abc'  # API change, this NO LONGER WORKS\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], dtype=bool)\n\n    >>> # Round trip unicode strings through HDF5\n    >>> t = Table([['bä', 'def']], dtype=['S'])\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":155,"name":"ON_TRAVIS","nodeType":"Attribute","startLoc":31,"text":"ON_TRAVIS"},{"attributeType":"null","col":8,"comment":"null","endLoc":40,"id":156,"name":"a_h_path","nodeType":"Attribute","startLoc":40,"text":"a_h_path"},{"id":157,"name":"modify_table.rst","nodeType":"TextFile","path":"docs/table","text":".. _modify_table:\n\n.. include:: references.txt\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 by accessing columns or rows of data and\nassigning values appropriately.  A key enhancement provided by the |Table| class\nis the ability to easily modify the structure of the table: one can add or\nremove 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\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 column values\n  >>> t['a'][2] = 30                 # Set row 2 of column 'a'\n  >>> t[1] = (8, 9, 10)              # Set all row values\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\n`numpy` \"fancy\" ``row`` indexing (in that case ``table[row]`` would be\na *copy* instead of a *view*).  \"Fancy\" `numpy` indices include a\n`list`, `numpy.ndarray`, or `tuple` of `numpy.ndarray` (e.g. the\nreturn from `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**Add a column or columns**\n\nA single column can be added to a table using syntax like adding a dict value.\nThe value on the right hand side can be a list or array\nof the correct size, or a scalar value that will be broadcast::\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 multiple\ncolumns to a table.  In both cases the new columns must be specified as |Column| or\n|MaskedColumn| objects::\n\n  >>> from astropy.table import Column\n  >>> aa = Column(np.arange(5), name='aa')\n  >>> t.add_column(aa, index=0)  # Insert before the first table column\n  >>> bb = Column(np.arange(5))\n  >>> t.add_column(bb, name='bb')  # Append unnamed column to the table with 'bb' as name\n\n  # Make a new table with the same number of rows and add columns to original table\n  >>> t2 = Table(np.arange(25).reshape(5, 5), names=('e', 'f', 'g', 'h', 'i'))\n  >>> t.add_columns(t2.columns.values())\n\nFinally, columns can also be added from\n:class:`~astropy.units.Quantity` objects, which automatically sets the\n``.unit`` attribute on the column:\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**Remove columns**\n::\n\n  >>> t.remove_column('f')\n  >>> t.remove_columns(['aa', 'd1', 'd2', 'd3', 'e'])\n  >>> del t['g']\n  >>> del t['h', 'i']\n  >>> t.keep_columns(['a', 'b'])\n\n**Replace a column**\n\nOne 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\nlist or numpy array).  For example, one could change the data type of the ``a``\ncolumn 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\nusing broadcasting will be done, e.g.::\n\n  >>> t['a'] = 1  # Internally does t['a'][:] = 1\n\n.. Note ::\n\n   Prior to astropy version 1.3, assignment as shown above performed\n   an in-place update of the existing column values and it was not possible\n   to change the data type in this way.  Prior to 1.3 it was necessary\n   to use the :meth:`~astropy.table.Table.replace_column` method in this case.\n   See the section `API change in replacing columns`_ for additional information.\n\n**Rename columns**\n::\n\n  >>> t.rename_column('a', 'a_new')\n  >>> t['b'].name = 'b_new'\n\n**Add a row of data**\n::\n\n  >>> t.add_row([-8, -9])\n\n**Remove rows**\n::\n\n  >>> t.remove_row(0)\n  >>> t.remove_rows(slice(4, 5))\n  >>> t.remove_rows([1, 2])\n\n**Sort by one more more columns**\n::\n\n  >>> t.sort('b_new')\n  >>> t.sort(['a_new', 'b_new'])\n\n**Reverse table rows**\n::\n\n  >>> t.reverse()\n\n**Modify meta-data**\n::\n\n  >>> t.meta['key'] = 'value'\n\n**Select or reorder columns**\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\nCaveats\n=======\n\nModifying the table data and properties is fairly straightforward.  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 are cases where the return value of an\noperation results in a new table in memory versus a view of the existing\ntable data.  As an example, imagine trying to set two table elements\nusing column selection with ``t['a', 'c']`` in combination with row index 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\nrow 1 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\nAPI change in replacing columns\n===============================\n\nAstropy version 1.3 introduces an API change in the way that the following\nbehaves::\n\n  >>> t = Table([[1, 2, 3]], names=['a'])\n  >>> t['a'] = [10.5, 20.5, 30.5]\n\nPrior to 1.3 this always did an in-place replacement of the data values so that\nthe ``t['a']`` column object reference was maintained.  However, since the\noriginal data type was integer in this case, the replaced values would silently\nbe converted to integer by truncation.\n\nStarting with astropy 1.3 the operation shown above does a *complete\nreplacement* of the column object.  In this case it makes a new column\nobject with float values by internally calling\n``t.replace_column('a', [10.5, 20.5, 30.5])``.  In general this behavior\nis more consistent with Python and Pandas behavior, but there is potential\nfor somewhat subtle bugs in code that was written that expects the pre-1.3\nin-place behavior.\n\n**Examples**\n::\n\n  >>> t = Table([[1, 2, 3]], names=['a'])\n  >>> t['a'].description = 'My data column'\n\n  # Sliced column gets replaced\n  >>> t2 = t[:2]  # Make a slice\n\n  # In astropy 1.3 the following emits a warning about replacing a slice.\n  >>> t2['a'] = [10, 20]  # doctest: +SKIP\n\n  >>> list(t['a'])  # Outputs [10, 20, 3] prior to astropy 1.3.\n  [1, 2, 3]\n\n  # Column reference count changes\n  >>> ta = t['a']  # Make a reference to the original column\n  >>> t['a'] = [10, 20, 30]\n  >>> t['a'] is ta  # Outputs True prior to astropy 1.3\n  False\n\n  # Column attributes change\n  >>> print(t['a'].description)  # Outputs 'My data column' prior to astropy 1.3\n  None\n\n**Replicating pre-1.3 behavior**\n\nIf the pre-1.3 in-place behavior is required in code, it is straightforward\nto achieve this.  Simply replace::\n\n  t[colname] = value\n\nwith::\n\n  t[colname][:] = value\n\nAs a *temporary* measure, or if the problematic code is in a package\nthat cannot be modified, one can modify the ``table.replace_inplace``\nconfiguration variable::\n\n  from astropy import table\n  table.conf.replace_inplace = True\n\nThis will entirely revert to the pre-1.3 behavior.  This configuration option\nwill be deprecated and then subsequently removed in future releases, so it is\nmeant only as a stop-gap to provide time to appropriately update all code.\n\n**Finding the source of problems**\n\nIn order to find potential problems related to the API change, the\nconfiguration option ``table.conf.replace_warnings`` controls a set of warnings\nthat are emitted under certain circumstances when a table column is replaced.\nThis option must be set to a list that includes zero or more of the\nfollowing 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 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``['slice']``.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":158,"name":"plot_rcparams","nodeType":"Attribute","startLoc":52,"text":"plot_rcparams"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":159,"name":"plot_apply_rcparams","nodeType":"Attribute","startLoc":59,"text":"plot_apply_rcparams"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":160,"name":"plot_html_show_source_link","nodeType":"Attribute","startLoc":60,"text":"plot_html_show_source_link"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":161,"name":"plot_formats","nodeType":"Attribute","startLoc":61,"text":"plot_formats"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":162,"name":"plot_pre_code","nodeType":"Attribute","startLoc":63,"text":"plot_pre_code"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":163,"name":"templates_path","nodeType":"Attribute","startLoc":93,"text":"templates_path"},{"attributeType":"null","col":0,"comment":"null","endLoc":110,"id":164,"name":"project","nodeType":"Attribute","startLoc":110,"text":"project"},{"attributeType":"null","col":0,"comment":"null","endLoc":111,"id":165,"name":"author","nodeType":"Attribute","startLoc":111,"text":"author"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":166,"name":"copyright","nodeType":"Attribute","startLoc":112,"text":"copyright"},{"id":167,"name":"index.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n\n.. _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\nCurrently `astropy.table` is used when reading an ASCII table using\n`astropy.io.ascii`.  Future releases of Astropy are expected to use\nthe |Table| class for other subpackages such as `astropy.io.votable` and `astropy.io.fits` .\n\n.. Warning:: Astropy 2.0 introduces an API change that affects comparison of\n   bytestring column elements in Python 3.  See\n   :ref:`bytestring-columns-python-3` for details.\n\nGetting Started\n===============\n\nThe basic workflow for creating a table, accessing table elements,\nand modifying the table is shown below.  These examples show a very simple\ncase, while the full `astropy.table` documentation is available from the\n:ref:`using_astropy_table` section.\n\nFirst create a simple table with three columns of data named ``a``, ``b``,\nand ``c``.  These columns have integer, float, and string values respectively::\n\n  >>> from astropy.table import Table\n  >>> a = [1, 4, 5]\n  >>> b = [2.0, 5.0, 8.2]\n  >>> c = ['x', 'y', 'z']\n  >>> t = Table([a, b, c], names=('a', 'b', 'c'), meta={'name': 'first table'})\n\nIf you have row-oriented input data such as a list of records, use the ``rows``\nkeyword.  In this example we also explicitly set the data types for each column::\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'), meta={'name': 'first table'},\n  ...           dtype=('i4', 'f8', 'S1'))\n\nThere are a few ways to examine the table.  You can get detailed information\nabout the table values and column definitions as follows::\n\n  >>> t  # doctest: +IGNORE_OUTPUT_3\n  <Table length=3>\n    a      b     c\n  int32 float64 str1\n  ----- ------- ----\n      1     2.0    x\n      4     5.0    y\n      5     8.2    z\n\nYou can also assign a unit to the columns. If any column has a unit\nassigned, all units would be shown as follows::\n\n  >>> t['b'].unit = 's'\n  >>> t  # doctest: +IGNORE_OUTPUT_3\n  <Table length=3>\n    a      b       c\n           s\n  int32 float64 str1\n  ----- ------- ----\n      1     2.0    x\n      4     5.0    y\n      5     8.2    z\n\nFinally, you can get summary information about the table as follows::\n\n  >>> t.info  # doctest: +IGNORE_OUTPUT_3\n  <Table length=3>\n  name  dtype  unit\n  ---- ------- ----\n     a   int32\n     b float64    s\n     c    str1\n\nA column with a unit works with and can be easily converted to an\n`~astropy.units.Quantity` object (but see :ref:`quantity_and_qtable` for\na way to natively use `~astropy.units.Quantity` objects in tables)::\n\n  >>> t['b'].quantity  # doctest: +FLOAT_CMP\n  <Quantity [2. , 5. , 8.2] s>\n  >>> t['b'].to('min')  # doctest: +FLOAT_CMP\n  <Quantity [0.03333333, 0.08333333, 0.13666667] min>\n\nFrom within the IPython notebook, the table is displayed as a formatted HTML\ntable (details of how it appears can be changed by altering the\n``astropy.table.default_notebook_table_class`` configuration item):\n\n.. image:: table_repr_html.png\n\nOr you can get a fancier notebook interface with in-browser search and sort\nusing `~astropy.table.Table.show_in_notebook`:\n\n.. image:: table_show_in_nb.png\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\n       s\n  --- --- ---\n    1 2.0   x\n    4 5.0   y\n    5 8.2   z\n\nIf you do not like the format of a particular column, you can change it::\n\n  >>> t['b'].format = '7.3f'\n  >>> print(t)\n   a     b     c\n         s\n  --- ------- ---\n    1   2.000   x\n    4   5.000   y\n    5   8.200   z\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 & 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']\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 syntax::\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 object for table row index=1 # doctest: +IGNORE_OUTPUT_3\n  <Row index=1>\n    a      b     c\n           s\n  int32 float64 str1\n  ----- ------- ----\n      4   5.000    y\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 slice) or\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\n         s\n  --- ------- ---\n    1   2.000   x\n    4   5.000   y\n\n  >>> print(t['a', 'c'])  # Table with cols 'a', 'c'\n   a   c\n  --- ---\n    1   x\n    4   y\n    5   z\n\nModifying table values in place is flexible and works as one 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\")        # Set all row values\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\n         s\n  --- ------- ---\n   -1 100.000   x\n    8 100.000   W\n   30   8.200   z\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['d'] = [1, 2, 3]               # Add column d\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']\n\nAdding a new row of data to the table is as follows::\n\n  >>> t.add_row([-8, -9, 10])\n  >>> len(t)\n  4\n\nYou can create a table with support for missing values, for example by setting\n``masked=True``::\n\n  >>> t = Table([a, b, c], names=('a', 'b', 'c'), masked=True, dtype=('i4', 'f8', 'S1'))\n  >>> t['a'].mask = [True, True, False]\n  >>> t  # doctest: +IGNORE_OUTPUT_3\n  <Table masked=True length=3>\n    a      b     c\n  int32 float64 str1\n  ----- ------- ----\n     --     2.0    x\n     --     5.0    y\n      5     8.2    z\n\nYou can include certain object types like `~astropy.time.Time`,\n`~astropy.coordinates.SkyCoord` or `~astropy.units.Quantity` in your table.\nThese \"mixin\" columns behave like a hybrid of a regular `~astropy.table.Column`\nand the native object type (see :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 = Table([tm, sc], names=['time', 'skycoord'])\n  >>> t\n  <Table length=2>\n           time          skycoord\n                         deg,deg\n          object          object\n  --------------------- ----------\n  2000:002:00:00:00.000 10.0,-45.0\n  2002:345:00:00:00.000  20.0,40.0\n\nThe `~astropy.table.QTable` class is a variant of `~astropy.table.Table` in\nwhich `~astropy.units.Quantity` are used natively, instead of being\nconverted to `~astropy.table.Column`. This means their units get taken into\naccount in numerical operations, etc. In this class `~astropy.table.Column`\nis still used for all unit-less arrays (see :ref:`quantity_and_qtable`\nfor details)::\n\n  >>> from astropy.table import QTable\n  >>> import astropy.units as u\n  >>> t = QTable()\n  >>> t['dist'] = [1, 2] * u.m\n  >>> t['velocity'] = [3, 4] * u.m / u.s\n  >>> t['flag'] = [True, False]\n  >>> t\n  <QTable length=2>\n    dist  velocity  flag\n     m     m / s\n  float64 float64   bool\n  ------- -------- -----\n      1.0      3.0  True\n      2.0      4.0 False\n  >>> t.info()\n  <QTable length=2>\n    name    dtype   unit  class\n  -------- ------- ----- --------\n      dist float64     m Quantity\n  velocity float64 m / s Quantity\n      flag    bool         Column\n\n.. Note::\n\n   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 one adds 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.. _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\nReference/API\n=============\n\n.. automodapi:: astropy.table\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":119,"id":168,"name":"version","nodeType":"Attribute","startLoc":119,"text":"version"},{"id":169,"name":"construct_table.rst","nodeType":"TextFile","path":"docs/table","text":".. include:: references.txt\n\n.. _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|\nconstructor are in the `Initialization Details`_ section.  However, the\neasiest way to understand how to make a table is by example.\n\nExamples\n========\n\nMuch of the flexibility lies in the types of data structures\nwhich can be used to initialize the table data.  The examples below show how to\ncreate a table from scratch with no initial data, create a table with a list of\ncolumns, a dictionary of columns, or from `numpy` arrays (either structured or\nhomogeneous).\n\nSetup\n-----\nFor the following examples you need to import the |Table| and |Column| classes\nalong with the `numpy` package::\n\n  >>> from astropy.table import Table, Column\n  >>> import numpy as np\n\nCreating 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 reasonably fast.\n\n::\n\n  >>> t = Table()\n  >>> t['a'] = [1, 4]\n  >>> t['b'] = Column([2.0, 5.0], unit='cm', description='Velocity')\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\nAnother option for creating a table is using the `~astropy.table.QTable` class.\nIn this case any `~astropy.units.Quantity` column objects will be stored\nnatively within the table via the \"mixin\" column protocol (see `Columns and\nQuantities`_ for details)::\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'])  # doctest: +SKIP\n  astropy.units.quantity.Quantity\n\n\nComment lines\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\nList 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 auto-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**Make a new table using columns from the first table**\n\nOnce you have a |Table| then you can make new table by selecting columns\nand putting this 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 `numpy` array 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]])  # vector column\n  >>> c = Column(['x', 'y'], name='axis')\n  >>> arr = (a, b, c)\n  >>> Table(arr)  # doctest: +SKIP\n  <Table length=2>\n   col0 col1 [2] axis\n  int64  int64   str1\n  ----- -------- ----\n      1   2 .. 3    x\n      4   5 .. 6    y\n\n\nNotice that in the third column the existing column name ``'axis'`` is used.\n\n\nDict of columns\n----------------\nA dictionary 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)  # doctest: +SKIP\n  <Table length=2>\n    a    c      b\n  int32 str1 float64\n  ----- ---- -------\n      1    x     2.0\n      4    y     5.0\n\n**Specify the column order and optionally the data types**\n::\n\n  >>> Table(arr, names=('a', 'b', 'c'), dtype=('f8', 'i4', 'S2'))  # doctest: +IGNORE_OUTPUT_3\n  <Table length=2>\n     a      b    c\n  float64 int32 str2\n  ------- ----- ----\n      1.0     2    x\n      4.0     5    y\n\n**Different types of column data**\n\nThe input column data can be any data type that can initialize a |Column| object::\n\n  >>> arr = {'a': (1, 4),\n  ...        'b': np.array([[2, 3], [5, 6]]),\n  ...        'c': Column(['x', 'y'], name='axis')}\n  >>> Table(arr, names=('a', 'b', 'c'))  # doctest: +SKIP\n  <Table length=2>\n    a   b [2]   c\n  int64 int64  str1\n  ----- ------ ----\n      1 2 .. 3    x\n      4 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 2-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\n\nRow data\n---------\nRow-oriented data can be used to create a table using the ``rows``\nkeyword argument.\n\n**List of data records as list or tuple**\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\nThe data object passed as the ``rows`` argument can be any form which is\nparsable by the ``np.rec.fromrecords()`` function.\n\n**List of dict objects**\n\nYou can also initialize a table with row values.  This is constructed as a\nlist of dict objects.  The keys determine the column names::\n\n  >>> data = [{'a': 5, 'b': 10},\n  ...         {'a': 15, 'b': 20}]\n  >>> Table(rows=data)  # doctest: +SKIP\n  <Table length=2>\n    a     b\n  int64 int64\n  ----- -----\n      5    10\n     15    20\n\nEvery row must have the same set of keys or a ValueError will be thrown::\n\n  >>> t = Table(rows=[{'a': 5, 'b': 10}, {'a': 15, 'b': 30, 'c': 50}])\n  Traceback (most recent call last):\n    ...\n  ValueError: Row 0 has no value for column c\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 like\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, it is\n   allowed to 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----------------------\nThe structured array is the standard mechanism in `numpy` for storing\nheterogeneous table data.  Most scientific I/O packages that read table\nfiles (e.g.  `PyFITS\n<http://www.stsci.edu/institute/software_hardware/pyfits>`_, `vo.table\n<http://stsdas.stsci.edu/astrolib/vo/html/intro_table.html>`_, `asciitable\n<http://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', 'S2')])\n\nFrom ``arr`` it is simple to create the corresponding |Table| object::\n\n  >>> Table(arr)  # doctest: +IGNORE_OUTPUT_3\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 the following ones we are creating a\ntable and immediately asking the interactive Python interpreter to print the\ntable 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'))  # doctest: +IGNORE_OUTPUT_3\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\n**New data types**\n\nLikewise the data type for each column can by changed with ``dtype``::\n\n  >>> Table(arr, dtype=('f4', 'i4', 'S4'))  # doctest: +IGNORE_OUTPUT_3\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', 'S4'))  # doctest: +IGNORE_OUTPUT_3\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\n\nNumPy homogeneous array\n-----------------------\nA `numpy` 1-d 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` 2-d 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', 'S4'))  # doctest: +IGNORE_OUTPUT_3\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 for an homogeneous array as long\nas the data types are not changed::\n\n  >>> t = Table(arr, copy=False)\n\n**Python arrays versus `numpy` arrays as input**\n\nThere is a slightly subtle issue that is important to understand in the way\nthat |Table| objects are created.  Any data input that looks like a Python list\n(including a tuple) is considered to be a list of columns.  In contrast an\nhomogeneous `numpy` array input is interpreted as a list of rows::\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 2-d `numpy` arrays where the first index corresponds\nto data \"rows\" and the second index corresponds to data \"columns\".\n\nFrom 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 to use the ``columns`` attribute (explained in the\n`TableColumns`_ section) to initialize a new table.  This let's 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\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`` : numpy ndarray, dict, list, or Table\n    Data to initialize table.\n``names`` : list\n    Specify column names\n``dtype`` : list\n    Specify column data types\n``meta`` : dict-like\n    Meta-Data associated with the table\n``copy`` : boolean\n    Copy the input data (default=True).\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`` ndarray is 1-dimensional then it is treated as a single row\n    table where each element of the array corresponds to a column.\n\n    If the ``data`` ndarray is at least 2-dimensional 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-like\n    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, numpy array, 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 from 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 builtin ``csv.DictReader``, each item in the\n    ``data`` list provides a row of data values and must be a dict.  The\n    key values in each dict define the column names and each row must\n    have identical column names.  The ``names`` argument may be supplied\n    to specify column ordering.  If it is not provided, the column order will\n    default to alphabetical.  The ``dtype`` list may be specified, and must\n    correspond to the order of output columns.  If any row's keys do no match\n    the rest of the rows, a ValueError will be thrown.\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`` object.  See\n    the `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\nfrom existing names (for ``ndarray`` or ``Table`` input) or auto-generated\nas ``col<N>``.  If ``names`` is provided then it must be a list with the\nsame length as the number of columns.  Any list elements with value\n``None`` fall back to the default name.\n\nIn the case where ``data`` is provided as dict of columns, the ``names``\nargument can be supplied to specify the order of columns.  The ``names`` list\nmust then contain each of the keys in the ``data`` dict.  If ``names`` is not\nsupplied then the order of columns in the output table is not determinate.\n\ndtype\n-----\n\nThe ``dtype`` argument provides a way to specify the table column data\ntypes or override the existing types.  By default the types are either\ntaken from existing types (for ``ndarray`` or ``Table`` input) or\nauto-generated by the ``numpy.array()`` routine.  If ``dtype`` is provided\nthen it must be a list with the same length as the number of columns.  The\nvalues must be valid ``numpy.dtype`` initializers or ``None``.  Any list\nelements with value ``None`` fall back to the default type.\n\nIn the case where ``data`` is provided as dict of columns, the ``dtype`` argument\nmust be accompanied by a corresponding ``names`` argument in order to uniquely\nspecify the column ordering.\n\nmeta\n----\n\nThe ``meta`` argument is simply an object that contains meta-data associated\nwith the table.  It is recommended that this object be a dict or\nOrderedDict_, but the only firm requirement is that it can be copied with\nthe standard library ``copy.deepcopy()`` routine.  By default ``meta`` is\nan empty OrderedDict_.\n\ncopy\n----\n\nBy default the input ``data`` are copied into a new internal ``np.ndarray``\nobject in the Table object.  In the case where ``data`` is either an\n``np.ndarray`` object or an existing ``Table``, it is possible to use a\nreference to the existing data by setting ``copy=False``.  This has the\nadvantage of reducing memory use and being faster.  However one should take\ncare because any modifications to the new Table data will also be seen in the\noriginal input data.  See the `Copy versus Reference`_ section for more\ninformation.\n\n\n.. _copy_versus_reference:\n\nCopy versus Reference\n=====================\n\nNormally when a new |Table| object is created, the input data are *copied* into\na new internal array object.  This ensures that if the new table elements are\nmodified then the original data will not be affected.  However, when creating a\ntable from a numpy ndarray object (structured or homogeneous), it is possible to\ndisable copying so that instead a memory reference to the original data is\nused.  This has the advantage of being faster and using less memory.  However,\ncaution must be exercised because the new table data and original data will be\nlinked, 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 in using referenced data is that you if add a new row to the\ntable then the reference to the original data array is lost and instead the\ntable will now 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 one can optionally provide\nthese values:\n\n``data`` : list, ndarray or None\n    Column data values\n``dtype`` : numpy.dtype compatible value\n    Data type for column\n``description`` : str\n    Full description of column\n``unit`` : str\n    Physical unit\n``format`` : str or function\n    `Format specifier`_ for outputting column values\n``meta`` : dict\n    Meta-data 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 a ``data`` value but not a ``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\n  fixed-size data-type initializer for the numpy.dtype() method.  See\n  `<https://docs.scipy.org/doc/numpy/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 provided 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 = 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 shape of a\n  single cell in the column.  The default ``shape`` is () which means a single value in\n  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 `format\n<https://docs.python.org/3/library/functions.html#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 6-character fields.\n\n**Old-style format string**\n\nThis corresponds to syntax like ``\"%.4f\" % value`` as documented in\n`String formatting operations <https://docs.python.org/3/library/stdtypes.html#string-formatting-operations>`_.\n\n   ``\"%.4f\"`` to print four digits after the decimal in float format, or\n\n   ``\"%6d\"`` to print an integer in a 6-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 6-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\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 = '{0:8.2}'.format(value)\n    ...     mant, exp = val.split('e')\n    ...     # remove leading zeros\n    ...     exp = exp[0] + exp[1:].lstrip('0')\n    ...     return '$ {0} \\\\times 10^{{ {1} }}$' .format(mant, 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\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 True).\n- Selecting multiple columns from a |TableColumns| object returns another\n  |TableColumns| object.\n- Select one column from a |TableColumns| object returns a |Column|.\n\nSo now look at the 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 column by index or name**\n::\n\n  >>> t.columns[1]  # Choose columns by index\n  <Column name='b' dtype='float64' length=0>\n\n  >>> t.columns['b']  # Choose 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.  In addition to subclassing |Table| it is\nfrequently desirable 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 by\nspecifying 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 subcomponents::\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\nAs a more practical example, suppose you have a table of data with a certain set of fixed\ncolumns, but you also want to carry an arbitrary dictionary of keyword=value\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)  # doctest: +SKIP\n   a   b             params\n  --- --- ----------------------------\n    1 2.0         {'y': 2.5, 'x': 1.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, six.string_types):\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\nColumns and Quantities\n----------------------\n\nAstropy `~astropy.units.Quantity` objects can be handled within tables in two\ncomplementary 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'])  # doctest: +SKIP\n  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'])  # doctest: +SKIP\n  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\nTable-like objects\n==================\n\nIn order to improve interoperability between different table classes, an\nastropy |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 above,\n``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 returned if possible.  If it is not possible\n(e.g. the original data are in a Python list or must be otherwise transformed in\nmemory) then ``__astropy_table__`` method is free to either return a copy or\nelse raise an exception.  This choice depends on the preference of the\nimplementation.  The implementation might choose to allow an additional keyword\nargument (e.g. ``strict_copy`` which gets passed via ``**kwargs``) to control the\nbehavior in this case.\n\nAs a simple 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('unexpected keyword args {}'.format(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('cannot have copy=False because column {} is '\n                                       'not an ndarray'.format(name))\n\n          return cls(cols, names=names, copy=copy)\n"},{"id":170,"name":"docs/units","nodeType":"Package"},{"id":171,"name":"combining_and_defining.rst","nodeType":"TextFile","path":"docs/units","text":"Combining and defining units\n****************************\n\nUnits and quantities can be combined together using the regular Python\nnumeric operators.  For example::\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\nUnits support fractional powers, which retain their precision through\ncomplex operations.  To do this, it is recommended to use\n`fractions.Fraction` objects.  For example::\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\nUsers are free to define new units, either fundamental or compound\nusing the `~astropy.units.def_unit` function.  For example::\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 simple::\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\nOne can see the definition of a unit and its :ref:`decomposition <decomposing>`\nvia::\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`~astropy.units.core.UnitBase.find_equivalent_units`.  However, they\ncan be enabled by calling `~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  []\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"},{"col":0,"comment":"Build Setuptools egg.","endLoc":78,"header":"def _build_egg(egg, archive_filename, to_dir)","id":172,"name":"_build_egg","nodeType":"Function","startLoc":69,"text":"def _build_egg(egg, archive_filename, to_dir):\n    \"\"\"Build Setuptools egg.\"\"\"\n    with archive_context(archive_filename):\n        # building an egg\n        log.warn('Building a Setuptools egg in %s', to_dir)\n        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)\n    # returning the result\n    log.warn(egg)\n    if not os.path.exists(egg):\n        raise IOError('Could not build the egg.')"},{"id":173,"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\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 to\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 in terms of CGS units::\n\n  >>> u.Ry.decompose(bases=u.cgs.bases)\n  Unit(\"2.17987e-11 cm2 g / s2\")\n\nFinally, if you just want to know how a unit was defined::\n\n  >>> u.Ry.represents\n  Unit(\"13.6057 eV\")\n\nAutomatically composing a unit into more complex units\n======================================================\n\nConversely, a unit may be recomposed back into more complex units\nusing the `~astropy.units.core.UnitBase.compose` method.  Since there\nmay be multiple equally good results, a list is always returned::\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(\"3.7e+10 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\nObviously a name doesn't 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\nConverting between systems\n==========================\n\nBuilt on top of this functionality is a convenience method to convert\nbetween 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`~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"},{"col":0,"comment":"Download Setuptools.","endLoc":149,"header":"def _do_download(version, download_base, to_dir, download_delay)","id":174,"name":"_do_download","nodeType":"Function","startLoc":132,"text":"def _do_download(version, download_base, to_dir, download_delay):\n    \"\"\"Download Setuptools.\"\"\"\n    py_desig = 'py{sys.version_info[0]}.{sys.version_info[1]}'.format(sys=sys)\n    tp = 'setuptools-{version}-{py_desig}.egg'\n    egg = os.path.join(to_dir, tp.format(**locals()))\n    if not os.path.exists(egg):\n        archive = download_setuptools(version, download_base,\n            to_dir, download_delay)\n        _build_egg(egg, archive, to_dir)\n    sys.path.insert(0, egg)\n\n    # Remove previously-imported pkg_resources if present (see\n    # https://bitbucket.org/pypa/setuptools/pull-request/7/ for details).\n    if 'pkg_resources' in sys.modules:\n        _unload_pkg_resources()\n\n    import setuptools\n    setuptools.bootstrap_install_from = egg"},{"id":175,"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\nThere are two ways of handling conversions between units.\n\nDirect Conversion\n=================\n\nIn this case, given a source and destination unit, the value(s) in the\nnew units is(are) returned.\n\n  >>> from astropy import units as u\n  >>> u.pc.to(u.m, 3.26)\n  1.0059308915583043e+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\nIncompatible Conversions\n========================\n\nIf you attempt to convert to a incompatible unit, an exception 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`~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"},{"attributeType":"null","col":0,"comment":"null","endLoc":121,"id":176,"name":"release","nodeType":"Attribute","startLoc":121,"text":"release"},{"id":177,"name":"quantity.rst","nodeType":"TextFile","path":"docs/units","text":".. _quantity:\n\nQuantity\n********\n\n.. |quantity| replace:: :class:`~astropy.units.Quantity`\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 created through multiplication with\n:class:`~astropy.units.Unit` objects. For example, to create a |quantity|\nto 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 Python\nsequences:\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\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 one to\nmerge sequences of |quantity| objects (as long as all of their units are\nequivalent), and to parse simple strings (which may help, e.g., 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\nFinally, the 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,\n\t  any data passed in are copied, which for large arrays may not be\n\t  optimal.  One can instead obtain a `~numpy.ndarray.view` by\n\t  passing ``copy=False`` to |quantity|.\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\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 `~astropy.units.quantity.Quantity.si` and\n`~astropy.units.quantity.Quantity.cgs` attributes can be used to\nconvert the |quantity| to base S.I. or c.g.s 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 short-cut:\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 using ``q.to(u.cm).value``.\n          The difference is that :meth:`~astropy.units.Quantity.to_value` does\n          no conversion if the unit is already the correct one, instead just\n          returning an :meth:`~numpy.ndarray.view` of the data (just as if you\n          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 conversion is necessary).\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.. doctest-requires:: matplotlib\n\n    >>> from matplotlib import pyplot as plt\n    >>> plt.figure(figsize=(5,3))\n    <...>\n    >>> plt.plot([1, 2, 3] * u.m)\n    [...]\n\n.. plot::\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.. doctest-requires:: matplotlib\n\n    >>> plt.plot([1, 2, 3] * u.cm)\n    [...]\n\n.. plot::\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    plt.plot([1, 2, 3] * u.cm)\n\nPlotting a quantity with an incompatible unit will raise an exception:\n\n.. doctest-requires:: matplotlib\n\n    >>> plt.plot([1, 2, 3] * u.kg)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    UnitConversionError: 'kg' (mass) and 'm' (length) are not convertible\n    >>> plt.clf()\n\nTo make sure unit support is turned off afterward, you can use\n`~astropy.visualization.quantity_support` with a ``with`` statement:\n\n.. doctest-requires:: matplotlib\n\n    >>> from astropy.visualization import quantity_support\n    >>> from matplotlib import pyplot as plt\n    >>> with quantity_support():\n    ...     plt.figure(figsize=(5,3))\n    ...     plt.plot([1, 2, 3] * u.m)\n    <...>\n    [...]\n\n.. plot::\n\n    from astropy import units as u\n    from astropy.visualization import quantity_support\n    from matplotlib import pyplot as plt\n    with quantity_support():\n        plt.figure(figsize=(5,3))\n        plt.plot([1, 2, 3] * u.m)\n\nArithmetic\n==========\n\nAddition and Subtraction\n------------------------\n\nAddition or subtraction between |quantity| objects is supported when their\nunits are equivalent. When the units are equal, the resulting object has the\nsame 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:\n\n    >>> 13.5 * u.km + 19.412  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n      ...\n    UnitsError: 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\nexcept for dimensionless quantities (see `Dimensionless quantities`_).\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\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\nNumpy functions\n===============\n\n|quantity| objects are actually full Numpy arrays (the |quantity|\nobject class inherits from and extends the ``numpy.ndarray`` class), and\nwe have tried to ensure that most Numpy functions behave properly with\nquantities:\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\nincluding 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(see `Dimensionless quantities`_ for more details).\n\nDimensionless quantities\n========================\n\nDimensionless quantities have the characteristic that if they are\nadded 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 a non-quantity object, the unit is automatically\ndecomposed 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 the different quantities were specified in:\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\nInstead, only 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\nValidation of quantity arguments to functions can lead to many repetitions\nof the same checking code. A decorator is provided which verifies that certain\narguments to a function are `~astropy.units.Quantity` objects and that the units\nare compatible with a desired unit or physical type.\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\nThe decorator `~astropy.units.quantity_input` accepts keyword arguments to\nspecify which arguments should be validated and what unit they are expected to\nbe compatible with:\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\nIt is also possible to instead specify the physical type 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\nUnder Python 3 you can use the annotations syntax to provide the units:\n\n    >>> @u.quantity_input  # doctest: +SKIP\n    ... def myfunction(myarg: u.arcsec):\n    ...     return myarg.unit\n\n    >>> myfunction(100*u.arcsec)  # doctest: +SKIP\n    Unit(\"arcsec\")\n\nAlso under Python 3 only you can define a return decoration, to which the return\nvalue will be converted, i.e.::\n\n    >>> @u.quantity_input  # doctest: +SKIP\n    ... def myfunction(myarg: u.arcsec) -> u.deg:\n    ...     return myarg*1000\n\n    >>> myfunction(100*u.arcsec)  # doctest: +SKIP\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\nThe decorator also supports specifying a list of valid equivalent units or\nphysical types for functions that should accept inputs with multiple valid\nunits:\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, one can use instead the representations underlying coordinates, which\nallow one to use representations other than cartesian (such as spherical or\ncylindrical), as well as simple vector arithmetic.  For details, see\n:ref:`astropy-coordinates-representations`.\n\nKnown issues with conversion to numpy arrays\n============================================\n\nSince |quantity| objects are Numpy arrays, we are not able to ensure\nthat only dimensionless quantities are converted to Numpy arrays:\n\n    >>> np.array([1, 2, 3] * u.m)  # doctest: +FLOAT_CMP\n    array([1., 2., 3.])\n\nSimilarly, while most numpy functions work properly, a few have :ref:`known\nissues <quantity_issues>`, either ignoring the unit (e.g., ``np.dot``) or\nnot reinitializing it properly (e.g., ``np.hstack``).  This propagates to\nmore complex functions such as ``np.linalg.norm`` and\n``scipy.integrate.odeint``.\n\nSubclassing Quantity\n====================\n\nTo subclass |quantity|, one generally proceeds as one would when subclassing\n:class:`~numpy.ndarray`, i.e., one typically needs to override ``__new__``\n(rather than ``__init__``) and uses the ``numpy.ndarray.__array_finalize__``\nmethod to update attributes.  For details, see the `numpy documentation on\nsubclassing\n<https://docs.scipy.org/doc/numpy/user/basics.subclassing.html>`__.  For\nexamples, one can look at |quantity| itself, where, e.g., 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\nas angles 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, one 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\nquantity that is to be created.  It is used, e.g., in\n:class:`~astropy.coordinates.Angle` to return a |quantity| if a calculation\nreturns a unit other than an angular one.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":169,"id":178,"name":"html_title","nodeType":"Attribute","startLoc":169,"text":"html_title"},{"attributeType":"null","col":0,"comment":"null","endLoc":172,"id":179,"name":"htmlhelp_basename","nodeType":"Attribute","startLoc":172,"text":"htmlhelp_basename"},{"col":0,"comment":"\n    Download setuptools from a specified location and return its filename.\n\n    `version` should be a valid setuptools version number that is available\n    as an sdist for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n\n    ``downloader_factory`` should be a function taking no arguments and\n    returning a function for downloading a URL to a target.\n    ","endLoc":356,"header":"def download_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, delay=15,\n        downloader_factory=get_best_downloader)","id":180,"name":"download_setuptools","nodeType":"Function","startLoc":331,"text":"def download_setuptools(\n        version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n        to_dir=DEFAULT_SAVE_DIR, delay=15,\n        downloader_factory=get_best_downloader):\n    \"\"\"\n    Download setuptools from a specified location and return its filename.\n\n    `version` should be a valid setuptools version number that is available\n    as an sdist for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n\n    ``downloader_factory`` should be a function taking no arguments and\n    returning a function for downloading a URL to a target.\n    \"\"\"\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    zip_name = \"setuptools-%s.zip\" % version\n    url = download_base + zip_name\n    saveto = os.path.join(to_dir, zip_name)\n    if not os.path.exists(saveto):  # Avoid repeated downloads\n        log.warn(\"Downloading %s\", url)\n        downloader = downloader_factory()\n        downloader(url, saveto)\n    return os.path.realpath(saveto)"},{"id":181,"name":"logarithmic_units.rst","nodeType":"TextFile","path":"docs/units","text":".. |quantity| replace:: :class:`~astropy.units.Quantity`\n\n.. _logarithmic_units:\n\nMagnitudes and other Logarithmic Units\n**************************************\n\nMagnitudes and logarithmic units such as ``dex`` and ``dB`` are used 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\nOne can create logarithmic quantities either directly or by multiplication with\na logarithmic unit.  For instance::\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\nAs for normal |quantity| objects, one can access the value with the\n`~astropy.units.Quantity.value` attribute. In addition, one can convert easily\nto a |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\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 `~astropy.units.function.FunctionQuantity.si` and\n`~astropy.units.function.FunctionQuantity.cgs` attributes can be used\nto convert the |quantity| to base S.I. or c.g.s units::\n\n    >>> logg.si  # doctest: +FLOAT_CMP\n    <Dex 3. dex(m / s2)>\n\nArithmetic\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 very simple photometric reduction.  First,\ncalculate instrumental magnitudes assuming some count rates for three objects::\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 simply::\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\nthe first 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 a short-hand 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:: at present, only magnitudes defined in terms of luminosity or flux\n\t  are implemented, since those that do not depend on the filter the\n          measurement was made with.  They include absolute and apparent\n          bolometric [M15]_, 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, e.g., ABMag, using\nappropriate equivalency::\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\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>, <Quantity 1.24 mag>, <Quantity 1.64 mag>)\n\nHere, one sees 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\nNote that one 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 equivalency, we can also convert to distance without remembering\nthe 5-5log rule::\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 not\nmake sense, hence they are disabled.  But one can use those one would expect to\nwork::\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:: This is implemented by having a list of supported ufuncs in\n\t  ``units/function/core.py`` and by explicitly disabling some\n\t  array methods in :class:`~astropy.units.function.FunctionQuantity`.\n          If you believe a function or method is incorrectly treated,\n\t  please `let us know <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 easily 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\n.. [M15] Mamajek et al., 2015, `arXiv:1510.06262\n\t  <http://adsabs.harvard.edu/abs/2015arXiv151006262M>`_\n.. [H95] E.g., Holtzman et al., 1995, `PASP 107, 1065\n          <http://adsabs.harvard.edu/abs/1995PASP..107.1065H>`_\n.. [OG83] Oke, J.B., & Gunn, J. E., 1983, `ApJ 266, 713\n\t  <http://adsabs.harvard.edu/abs/1983ApJ...266..713O>`_\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":179,"id":182,"name":"latex_documents","nodeType":"Attribute","startLoc":179,"text":"latex_documents"},{"attributeType":"null","col":0,"comment":"null","endLoc":182,"id":183,"name":"latex_logo","nodeType":"Attribute","startLoc":182,"text":"latex_logo"},{"attributeType":"null","col":0,"comment":"null","endLoc":189,"id":184,"name":"man_pages","nodeType":"Attribute","startLoc":189,"text":"man_pages"},{"attributeType":"null","col":31,"comment":"null","endLoc":199,"id":185,"name":"versionmod","nodeType":"Attribute","startLoc":199,"text":"versionmod"},{"attributeType":"null","col":0,"comment":"null","endLoc":200,"id":186,"name":"edit_on_github_project","nodeType":"Attribute","startLoc":200,"text":"edit_on_github_project"},{"attributeType":"null","col":4,"comment":"null","endLoc":202,"id":187,"name":"edit_on_github_branch","nodeType":"Attribute","startLoc":202,"text":"edit_on_github_branch"},{"attributeType":"null","col":4,"comment":"null","endLoc":205,"id":188,"name":"edit_on_github_branch","nodeType":"Attribute","startLoc":205,"text":"edit_on_github_branch"},{"attributeType":"null","col":0,"comment":"null","endLoc":206,"id":189,"name":"edit_on_github_source_root","nodeType":"Attribute","startLoc":206,"text":"edit_on_github_source_root"},{"attributeType":"null","col":0,"comment":"null","endLoc":207,"id":190,"name":"edit_on_github_doc_root","nodeType":"Attribute","startLoc":207,"text":"edit_on_github_doc_root"},{"col":0,"comment":"null","endLoc":328,"header":"def get_best_downloader()","id":191,"name":"get_best_downloader","nodeType":"Function","startLoc":320,"text":"def get_best_downloader():\n    downloaders = (\n        download_file_powershell,\n        download_file_curl,\n        download_file_wget,\n        download_file_insecure,\n    )\n    viable_downloaders = (dl for dl in downloaders if dl.viable())\n    return next(viable_downloaders, None)"},{"attributeType":"null","col":0,"comment":"null","endLoc":209,"id":192,"name":"edit_on_github_skip_regex","nodeType":"Attribute","startLoc":209,"text":"edit_on_github_skip_regex"},{"attributeType":"null","col":0,"comment":"null","endLoc":211,"id":193,"name":"github_issues_url","nodeType":"Attribute","startLoc":211,"text":"github_issues_url"},{"attributeType":"null","col":0,"comment":"null","endLoc":216,"id":194,"name":"nitpicky","nodeType":"Attribute","startLoc":216,"text":"nitpicky"},{"attributeType":"null","col":0,"comment":"null","endLoc":217,"id":195,"name":"nitpick_ignore","nodeType":"Attribute","startLoc":217,"text":"nitpick_ignore"},{"attributeType":"null","col":4,"comment":"null","endLoc":219,"id":196,"name":"line","nodeType":"Attribute","startLoc":219,"text":"line"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":197,"name":"crpix","nodeType":"Attribute","startLoc":14,"text":"w.wcs.crpix"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":198,"name":"cdelt","nodeType":"Attribute","startLoc":15,"text":"w.wcs.cdelt"},{"attributeType":"null","col":4,"comment":"null","endLoc":222,"id":199,"name":"dtype","nodeType":"Attribute","startLoc":222,"text":"dtype"},{"id":200,"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 term 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\nstandard that are no longer recommended for use.)\n\nUnits that involve combinations of fundamental units are instances of\n`~astropy.units.CompositeUnit`. In most cases, one does not need\nto worry about the various kinds of unit classes unless one wants to\ndesign a more complex case.\n\nThere are many units already predefined in the module. One may use the\n`~astropy.units.core.UnitBase.find_equivalent_units` method to list\nall 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.97236e+24 kg  | M_earth, Mearth                  ,\n    g            | 0.001 kg        | gram                             ,\n    jupiterMass  | 1.89819e+27 kg  | M_jup, Mjup, M_jupiter, Mjupiter ,\n    kg           | irreducible     | kilogram                         ,\n    solMass      | 1.98848e+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 prefixes and\nthe IEEE 1514 binary prefixes (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 don't 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   >>> from astropy import units as u\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.  For example::\n\n   >>> u.m / u.m\n   Unit(dimensionless)\n\nFor compatibility with the supported unit string formats, 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\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   u'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.. _enabling-other-units:\n\nEnabling other units\n====================\n\nBy default, only the \"default\" units are searched by\n`~astropy.units.core.UnitBase.find_equivalent_units` and similar\nmethods that do searching.  This includes SI, CGS and astrophysical\nunits.  However, one may wish to enable the imperial or other\nuser-defined units.\n\nFor example, to enable Imperial units, simply do::\n\n    >>> from astropy.units import imperial\n    >>> imperial.enable()  # doctest: +SKIP\n    >>> u.m.find_equivalent_units()  # doctest: +SKIP\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      ft           | 0.3048 m        | foot                  ,\n      fur          | 201.168 m       | furlong               ,\n      inch         | 0.0254 m        |                       ,\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 ``with`` statement, to temporarily\nenable additional units::\n\n    >>> from astropy import units as u\n    >>> from astropy.units import imperial\n    >>> with imperial.enable():\n    ...     print(u.m.find_equivalent_units())\n          Primary name | Unit definition | Aliases\n    ...\n\nTo enable just specific units, use `~astropy.units.add_enabled_units`::\n\n    >>> from astropy import units as u\n    >>> from astropy.units import imperial\n    >>> with u.add_enabled_units([imperial.knot]):\n    ...     print(u.m.find_equivalent_units())\n          Primary name | Unit definition | Aliases\n    ...\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":201,"name":"crval","nodeType":"Attribute","startLoc":16,"text":"w.wcs.crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":202,"name":"ctype","nodeType":"Attribute","startLoc":17,"text":"w.wcs.ctype"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":203,"name":"pixcrd","nodeType":"Attribute","startLoc":21,"text":"pixcrd"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":204,"name":"world","nodeType":"Attribute","startLoc":24,"text":"world"},{"col":4,"comment":"null","endLoc":230,"header":"@classmethod\n    def main(cls, argv=None)","id":205,"name":"main","nodeType":"Function","startLoc":213,"text":"@classmethod\n    def main(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = cls.parse_config()\n        config.update(cls.parse_command_line(argv))\n\n        auto_use = config.pop('auto_use', False)\n        bootstrapper = cls(**config)\n\n        if auto_use:\n            # Run the bootstrapper, otherwise the setup.py is using the old\n            # use_astropy_helpers() interface, in which case it will run the\n            # bootstrapper manually after reconfiguring it.\n            bootstrapper.run()\n\n        return bootstrapper"},{"id":206,"name":"index.rst","nodeType":"TextFile","path":"docs/units","text":".. _astropy-units:\n\n**************************************\nUnits and Quantities (`astropy.units`)\n**************************************\n\n.. |quantity| replace:: :class:`~astropy.units.Quantity`\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 :ref:`work with \"quantities\"\n<quantity>`: the combination of a value and a unit.  The easiest way to create\na |quantity| is to simply multiply or divide a value by one of the built-in\nunits.  It works with scalars, sequences and Numpy arrays::\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 simple building block, it's easy 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\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\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(\"3.7e+10 Ci\")]\n\nAnd it can convert between unit systems, such as SI or CGS:\n\n.. doctest-skip::\n\n    >>> (1.0 * u.Pa).cgs\n    <Quantity 10.0 Ba>\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 doesn't\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 ``spectral()``, it does:\n\n    >>> (1000 * u.nm).to(u.Hz, equivalencies=u.spectral())  # doctest: +FLOAT_CMP\n    <Quantity  2.99792458e+14 Hz>\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>`_, the\npreferred string formatting syntax in recent versions of python.  Format\nspecifiers (like ``0.03f``) in new-style format strings will used to format the\nquantity value::\n\n    >>> q = 15.1 * u.meter / (32.0 * u.second)\n    >>> q  # doctest: +FLOAT_CMP\n    <Quantity 0.471875 m / s>\n    >>> \"{0:0.03f}\".format(q)\n    '0.472 m / s'\n\nThe value and unit can also be formatted separately. Format specifiers\nused on 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    >>> \"{0.value:0.03f} {0.unit:FITS}\".format(q)\n    '0.472 m s-1'\n\nUsing `astropy.units`\n=====================\n\n.. toctree::\n   :maxdepth: 2\n\n   quantity\n   standard_units\n   combining_and_defining\n   decomposing_and_composing\n   logarithmic_units\n   format\n   equivalencies\n   conversion\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://cds.u-strasbg.fr/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  <http://www.stsci.edu/~strolger/docs/UNITS.txt>`_\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.function.units\n\n.. automodapi:: astropy.units.imperial\n\n.. automodapi:: astropy.units.cds\n\n.. automodapi:: astropy.units.equivalencies\n\n.. automodapi:: astropy.units.function\n\n.. automodapi:: astropy.units.deprecated\n\n.. automodapi:: astropy.units.required_by_vounit\n\nAcknowledgments\n===============\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 code\nunder a BSD license.\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":207,"name":"pixcrd2","nodeType":"Attribute","startLoc":28,"text":"pixcrd2"},{"attributeType":"null","col":11,"comment":"null","endLoc":222,"id":208,"name":"target","nodeType":"Attribute","startLoc":222,"text":"target"},{"attributeType":"null","col":4,"comment":"null","endLoc":223,"id":209,"name":"target","nodeType":"Attribute","startLoc":223,"text":"target"},{"id":210,"name":"format.rst","nodeType":"TextFile","path":"docs/units","text":".. _astropy-units-format:\n\nString representations of units\n*******************************\n\n.. |quantity| replace:: :class:`~astropy.units.Quantity`\n\n.. |unit| replace:: :class:`~astropy.units.UnitBase`\n\nConverting units to string representations\n==========================================\n\nYou can control the way that |quantity| and |unit| objects are rendered as\nstrings using the new `Format String Syntax\n<https://docs.python.org/3/library/string.html#format-string-syntax>`__.\nNew-style format strings use the ``\"{}\".format()`` syntax.  Most of\nthe format specifiers are similar to the old ``%``-style formatting,\nso things like ``0.003f`` still work, just in the form\n``\"{:0.003f}\".format()``.\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|. This means you can do::\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    >>> \"{0}\".format(q)\n    '10.5 km'\n    >>> \"{0:+0.03f}\".format(q)\n    '+10.500 km'\n    >>> \"{0:20s}\".format(q)\n    '10.5 km             '\n\nTo format both the value and the unit separately, you can access the |quantity|\nclass attributes within new-style format strings::\n\n    >>> q = 10.5 * u.km\n    >>> q\n    <Quantity  10.5 km>\n    >>> \"{0.value:0.003f} in {0.unit:s}\".format(q)\n    '10.500 in km'\n\nBecause Numpy arrays don't accept most format specifiers, using specifiers like\n``0.003f`` will not work when applied to a Numpy array or non-scalar |quantity|.\nUse :func:`numpy.array_str` instead. For example::\n\n    >>> q = np.linspace(0,1,10) * u.m\n    >>> \"{0} {1}\".format(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\nUnits, or the unit part of a quantity, can also be formatted in a\nnumber of different styles.  By default, the string format used is\nreferred to as the \"generic\" format, which is based on syntax of the\nFITS standard's format for representing units, but supports all of the\nunits defined within the `astropy.units` framework, including\nuser-defined units.  The format specifier (and\n`~astropy.units.core.UnitBase.to_string`) functions also take an\noptional parameter to select a different format, including\n``\"latex\"``, ``\"unicode\"``, ``\"cds\"``, and others, defined below.\n\n    >>> \"{0.value:0.003f} in {0.unit:latex}\".format(q)  # doctest: +SKIP\n    '10.000 in $\\\\mathrm{km}$'\n    >>> fluxunit = u.erg / (u.cm ** 2 * u.s)\n    >>> \"{0}\".format(fluxunit)\n    u'erg / (cm2 s)'\n    >>> print(\"{0:console}\".format(fluxunit))\n     erg\n    ------\n    s cm^2\n    >>> \"{0:latex}\".format(fluxunit)\n    u'$\\\\mathrm{\\\\frac{erg}{s\\\\,cm^{2}}}$'\n    >>> \"{0:>20s}\".format(fluxunit)\n    u'       erg / (cm2 s)'\n\nThe `~astropy.units.core.UnitBase.to_string` method is an alternative way to\nformat 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\nUnits can also be created from strings in a number of different\nformats using the `~astropy.units.Unit` class::\n\n  >>> from astropy import units as u\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\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://cds.u-strasbg.fr/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.2 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    <http://journals.aas.org/authors/manuscript.html#_Toc2.2>`_.)\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 multi-line 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: +SKIP\n                      m² kg\n      2.1798721×10-¹⁸ ─────\n                       s²\n\nUnrecognized Units\n==================\n\nSince many files in 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.\n\nNormally, 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\n  Angstrom or angstrom?\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 ValueError exception.\n\n  - ``'warn'``: emit a Warning, and return an\n    `~astropy.units.UnrecognizedUnit` instance.\n\n  - ``'silent'``: return an `~astropy.units.UnrecognizedUnit`\n    instance.\n\nSo, for example, one can do::\n\n   >>> x = u.Unit(\"Angstroem\", format=\"fits\", parse_strict=\"warn\")  # doctest: +SKIP\n   WARNING: UnitsWarning: 'Angstroem' did not parse as unit format\n   'fits': At col 0, 'Angstroem' is not a valid unit in string\n   'Angstroem' [astropy.units.core]\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()  # doctest: +SKIP\n   'Angstroem'\n   >>> x.to(u.km)  # doctest: +SKIP\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  # doctest: +SKIP\n   Traceback (most recent call last):\n     ...\n   ValueError: The unit 'Angstroem' is unrecognized, so all arithmetic\n   operations with it are invalid.\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":232,"id":211,"name":"sphinx_gallery_conf","nodeType":"Attribute","startLoc":232,"text":"sphinx_gallery_conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":252,"id":212,"name":"linkcheck_anchors","nodeType":"Attribute","startLoc":252,"text":"linkcheck_anchors"},{"col":0,"comment":"","endLoc":28,"header":"conf.py#<anonymous>","id":213,"name":"<anonymous>","nodeType":"Function","startLoc":28,"text":"ON_RTD = os.environ.get('READTHEDOCS') == 'True'\n\nON_TRAVIS = os.environ.get('TRAVIS') == 'true'\n\ntry:\n    import astropy_helpers\nexcept ImportError:\n    # Building from inside the docs/ directory?\n    import os\n    import sys\n    if os.path.basename(os.getcwd()) == 'docs':\n        a_h_path = os.path.abspath(os.path.join('..', 'astropy_helpers'))\n        if os.path.isdir(a_h_path):\n            sys.path.insert(1, a_h_path)\n\n    # If that doesn't work trying to import from astropy_helpers below will\n    # still blow up\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\ncheck_sphinx_version(\"1.2.1\")\n\ndel intersphinx_mapping['astropy']\n\nintersphinx_mapping['pytest'] = ('https://docs.pytest.org/en/latest/', None)\n\nintersphinx_mapping['ipython'] = ('http://ipython.readthedocs.io/en/stable/', None)\n\nintersphinx_mapping['pandas'] = ('http://pandas.pydata.org/pandas-docs/stable/', None)\n\nintersphinx_mapping['sphinx_automodapi'] = ('https://sphinx-automodapi.readthedocs.io/en/stable/', None)\n\nexclude_patterns.append('_templates')\n\nexclude_patterns.append('_pkgtemplate.rst')\n\nif 'templates_path' not in locals():  # in case parent conf.py defines it\n    templates_path = []\n\ntemplates_path.append('_templates')\n\nrst_epilog += \"\"\"\n.. |minimum_numpy_version| replace:: {0.__minimum_numpy_version__}\n\n.. Astropy\n.. _Astropy: http://astropy.org\n.. _`Astropy mailing list`: https://mail.python.org/mailman/listinfo/astropy\n.. _`astropy-dev mailing list`: http://groups.google.com/group/astropy-dev\n\"\"\".format(astropy)\n\nproject = u'Astropy'\n\nauthor = u'The Astropy Developers'\n\ncopyright = u'2011–{0}, '.format(datetime.utcnow().year) + author\n\nversion = astropy.__version__.split('-', 1)[0]\n\nrelease = astropy.__version__\n\nhtml_title = '{0} v{1}'.format(project, release)\n\nhtmlhelp_basename = project + 'doc'\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\nextensions += ['astropy_helpers.sphinx.ext.edit_on_github']\n\nedit_on_github_project = \"astropy/astropy\"\n\nif versionmod.release:\n    edit_on_github_branch = \"v{0}.{1}.x\".format(\n        versionmod.major, versionmod.minor)\nelse:\n    edit_on_github_branch = \"master\"\n\nedit_on_github_source_root = \"\"\n\nedit_on_github_doc_root = \"docs\"\n\nedit_on_github_skip_regex = '_.*|api/.*'\n\ngithub_issues_url = 'https://github.com/astropy/astropy/issues/'\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 sphinx_gallery\n    extensions += [\"sphinx_gallery.gen_gallery\"]\n\n    sphinx_gallery_conf = {\n        'backreferences_dir': 'generated/modules', # path to store the module using example template\n        'filename_pattern': '^((?!skip_).)*$', # execute all examples except those that start with \"skip_\"\n        'examples_dirs': '..{}examples'.format(os.sep), # path to the examples scripts\n        'gallery_dirs': 'generated/examples', # path to save gallery generated examples\n        'reference_url': {\n            'astropy': None,\n            'matplotlib': 'http://matplotlib.org/',\n            'numpy': 'http://docs.scipy.org/doc/numpy/',\n        },\n        'abort_on_example_error': True\n    }\n\nexcept ImportError:\n    def setup(app):\n        app.warn('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\nlinkcheck_anchors = False"},{"attributeType":"Header","col":0,"comment":"null","endLoc":36,"id":214,"name":"header","nodeType":"Attribute","startLoc":36,"text":"header"},{"col":0,"comment":"null","endLoc":220,"header":"def _unload_pkg_resources()","id":215,"name":"_unload_pkg_resources","nodeType":"Function","startLoc":209,"text":"def _unload_pkg_resources():\n    sys.meta_path = [\n        importer\n        for importer in sys.meta_path\n        if importer.__class__.__module__ != 'pkg_resources.extern'\n    ]\n    del_modules = [\n        name for name in sys.modules\n        if name.startswith('pkg_resources')\n    ]\n    for mod_name in del_modules:\n        del sys.modules[mod_name]"},{"id":216,"name":"equivalencies.rst","nodeType":"TextFile","path":"docs/units","text":".. |quantity| replace:: :class:`~astropy.units.Quantity`\n\n.. _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 :meth:`Quantity.to\n<astropy.units.quantity.Quantity.to>` or :meth:`Unit.to\n<astropy.units.core.UnitBase.to>` methods.  Alternatively, if a larger\npiece of code needs the same equivalencies, one can set them for a\n:ref:`given context <equivalency-context>`.\n\nBuilt-in equivalencies\n======================\n\nParallax Units\n--------------\n\n:func:`~astropy.units.equivalencies.parallax` is a function that returns an\nequivalency list to handle conversions between angles and length.\n\nLength and angles are not normally convertible, so\n:meth:`~astropy.units.core.UnitBase.to` raises an exception::\n\n  >>> from astropy import units as u\n  >>> (8.0 * 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\nHowever, when passing the result of\n:func:`~astropy.units.equivalencies.parallax` as the third argument to the\n:meth:`~astropy.units.core.UnitBase.to` method, angles can be converted\ninto units of length (and vice versa).\n\n    >>> (8.0 * u.arcsec).to(u.parsec, equivalencies=u.parallax())\n    <Quantity 0.125 pc>\n    >>> u.AU.to(u.arcminute, equivalencies=u.parallax())\n    3437.7467707580054\n\nAngles as Dimensionless Units\n-----------------------------\n\nAngles are treated as a physically distinct type, which usually helps\nto avoid mistakes.  However, this is not very handy when working with\nunits related to rotational energy or the small angle approximation.\n(Indeed, this double-sidedness underlies why radian went from\n`supplementary to derived unit <http://www.bipm.org/en/CGPM/db/20/8/>`__.)\nThe function :func:`~astropy.units.equivalencies.dimensionless_angles`\nprovides the required equivalency list that helps convert between\nangles and dimensionless units.  It is somewhat\ndifferent from all others in that it allows an arbitrary change in the\nnumber of powers to which radian is raised (i.e., including zero and thus\ndimensionless).  For instance, normally the following raise exceptions::\n\n  >>> from astropy import units as u\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: +SKIP\n  <Quantity  0.70710678+0.70710678j>\n\nThe example with complex numbers is also one 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\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\nAs mentioned above with parallax units, we simply pass a list of\nequivalencies (in this case, the result of\n:func:`~astropy.units.equivalencies.spectral`) as the third argument to the\n:meth:`~astropy.units.core.UnitBase.to` method and wavelength, frequency and\nenergy 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\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 straightforward to define the equivalency, but note that there are\ndifferent `conventions <http://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`__.\nIn these conventions :math:`f_0` is the rest frequency, :math:`f` is the observed frequency,\n:math:`V` is the velocity, and :math:`c` is the speed of light:\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`.  Example use::\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\nSpectral Flux / Luminosity Density Units\n----------------------------------------\n\nThere is also support for spectral flux and luminosity density 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. For example::\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\nBrightness Temperature / Flux Density Equivalency\n-------------------------------------------------\n\nThere is an equivalency for brightness temperature and flux density.\nThis equivalency is often referred to as \"Antenna Gain\" since, at a\ngiven frequency, telescope brightness sensitivity is unrelated to\naperture size, but flux density sensitivity is, so this equivalency is\nonly dependent on the aperture size.  See `Tools of Radio Astronomy\n<http://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 planck function that would produce a\n          given flux, you should not use this equivalency.\n\nThe `~astropy.units.equivalencies.brightness_temperature` equivalency requires\nthe beam area and frequency as arguments.  Recalling that the area of a 2D\ngaussian 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    >>> import numpy as np\n    >>> beam_sigma = 50*u.arcsec\n    >>> omega_B = 2 * np.pi * beam_sigma**2\n    >>> freq = 5 * u.GHz\n    >>> u.Jy.to(u.K, equivalencies=u.brightness_temperature(omega_B, freq))  # doctest: +FLOAT_CMP\n    3.526295144567176\n\n.. note:: Despite the Astropy unit on the left being shown as ``u.Jy``, this is\n          the conversion factor from Jy/beam to K (because ``u.beam`` cannot\n          currently be used as a meaningful unit since it depends on the\n          observations).\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    >>> import numpy as np\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    >>> freq = 5 * u.GHz\n    >>> u.Jy.to(u.K, equivalencies=u.brightness_temperature(omega_B, freq))  # doctest: +FLOAT_CMP\n    19.553928332631582\n\n\nTemperature Energy Equivalency\n------------------------------\n\nThis equivalency allows conversion between temperature and its equivalent\nin energy (i.e., the temperature multiplied by the Boltzmann constant),\nusually expressed in electronvolts. This is used frequently for\nobservations at high-energy, be it for solar or X-ray astronomy. Example::\n\n    >>> import astropy.units as u\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\nMolar Mass AMU Equivalency\n--------------------------\n\nThis equivalency allows conversion\nbetween the atomic mass unit and the equivalent g/mol.\nFor reference to why this was added,\nrefer to `NIST Mole Reference <https://physics.nist.gov/cuu/Units/mole.html>`_\nThe following is an example of it's usage:\n\n    >>> import astropy.units as u\n    >>> import astropy.constants as const\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\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.  For\nexample, suppose 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    >>> import astropy.units as u\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 a (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::\n\n    >>> import astropy.units as u\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\nWriting new equivalencies\n=========================\n\nAn equivalence list is just a list of tuples, where each tuple has 4\nelements::\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.\n\nFor example, until 1964 the metric liter was defined as the volume of\n1kg of water at 4°C at 760mm mercury pressure.  Volumes and masses are\nnot normally directly convertible, but if we hold the constants in the\n1964 definition of the liter as true, we could build an equivalency\nfor 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 units::\n\n  >>> from astropy.units import imperial\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\nA slightly more complicated example: Spectral Doppler Equivalencies\n-------------------------------------------------------------------\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`,\nbut this example is illustrative::\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\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 constant.\n\nDisplaying available equivalencies\n==================================\n\nThe :meth:`~astropy.units.core.UnitBase.find_equivalent_units` method also\nunderstands equivalencies.  For example, without passing equivalencies,\nthere are three compatible units for ``Hz`` in the 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    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.. _equivalency-context:\n\nUsing equivalencies in larger pieces of code\n============================================\nSometimes one has an involved calculation where one is regularly\nswitching back between equivalent units. For these cases, one can set\nequivalencies that will by default be used, in a way similar to which\none can :ref:`enable other units <enabling-other-units>`.\n\nFor instance, to enable radian to be treated as a dimensionless unit,\nsimply do:\n\n.. doctest-skip::\n\n  >>> import astropy.units as u\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\nHere, any list of equivalencies could be used, or one could add, e.g.,\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\nThe disadvantage of the above approach is that you may forget to turn\nthe default off (done by giving an empty argument). To automate this,\na context manager is provided:\n\n.. doctest-skip::\n\n  >>> import astropy.units as u\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.2246063538223773e-16j) >\n"},{"id":217,"name":"docs/utils","nodeType":"Package"},{"id":218,"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 exception is below:\n\n.. toctree::\n   :maxdepth: 1\n\n   iers\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. For numpy, however, there are\n    :ref:`instructions <numpy-compatibility>` on how to deal with issues of\n    compatibility between different versions.\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.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.state\n    :no-inheritance-diagram:\n\n.. automodapi:: astropy.utils.timer\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"},{"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":402,"header":"@classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 **kwargs)","id":219,"name":"fromfile","nodeType":"Function","startLoc":388,"text":"@classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 **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                             lazy_load_hdus=lazy_load_hdus, **kwargs)"},{"col":0,"comment":"\n    Setuptools was imported prior to invocation, so it is\n    unsafe to unload it. Bail out.\n    ","endLoc":206,"header":"def _conflict_bail(VC_err, version)","id":220,"name":"_conflict_bail","nodeType":"Function","startLoc":191,"text":"def _conflict_bail(VC_err, version):\n    \"\"\"\n    Setuptools was imported prior to invocation, so it is\n    unsafe to unload it. Bail out.\n    \"\"\"\n    conflict_tmpl = textwrap.dedent(\"\"\"\n        The required version of setuptools (>={version}) is not available,\n        and can't be installed while this script is running. Please\n        install a more recent version first, using\n        'easy_install -U setuptools'.\n\n        (Currently using {VC_err.args[0]!r})\n        \"\"\")\n    msg = conflict_tmpl.format(**locals())\n    sys.stderr.write(msg)\n    sys.exit(2)"},{"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":1031,"header":"@classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None,\n                  memmap=None, save_backup=False, cache=True,\n                  lazy_load_hdus=True, **kwargs)","id":221,"name":"_readfrom","nodeType":"Function","startLoc":973,"text":"@classmethod\n    def _readfrom(cls, fileobj=None, data=None, mode=None,\n                  memmap=None, save_backup=False, cache=True,\n                  lazy_load_hdus=True, **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        hdulist._save_backup = save_backup\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:\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"},{"col":0,"comment":"\n    Run the command to download target.\n\n    If the command fails, clean up before re-raising the error.\n    ","endLoc":234,"header":"def _clean_check(cmd, target)","id":222,"name":"_clean_check","nodeType":"Function","startLoc":223,"text":"def _clean_check(cmd, target):\n    \"\"\"\n    Run the command to download target.\n\n    If the command fails, clean up before re-raising the error.\n    \"\"\"\n    try:\n        subprocess.check_call(cmd)\n    except subprocess.CalledProcessError:\n        if os.access(target, os.F_OK):\n            os.unlink(target)\n        raise"},{"col":0,"comment":"\n    Download the file at url to target using Powershell.\n\n    Powershell will validate trust.\n    Raise an exception if the command cannot complete.\n    ","endLoc":256,"header":"def download_file_powershell(url, target)","id":223,"name":"download_file_powershell","nodeType":"Function","startLoc":237,"text":"def download_file_powershell(url, target):\n    \"\"\"\n    Download the file at url to target using Powershell.\n\n    Powershell will validate trust.\n    Raise an exception if the command cannot complete.\n    \"\"\"\n    target = os.path.abspath(target)\n    ps_cmd = (\n        \"[System.Net.WebRequest]::DefaultWebProxy.Credentials = \"\n        \"[System.Net.CredentialCache]::DefaultCredentials; \"\n        '(new-object System.Net.WebClient).DownloadFile(\"%(url)s\", \"%(target)s\")'\n        % locals()\n    )\n    cmd = [\n        'powershell',\n        '-Command',\n        ps_cmd,\n    ]\n    _clean_check(cmd, target)"},{"id":224,"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 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\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\nThe IERS data are managed via a 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 http://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()\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 three configuration parameters that control the behavior\nof the automatic IERS downloading:\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 replicates the\n    behavior prior to astropy 1.2.  (default=True)\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  iers_auto_url:\n    URL for auto-downloading IERS file data\n\n  remote_timeout:\n    Remote timeout downloading IERS file data (seconds)\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(`<http://maia.usno.navy.mil/ser7/finals2000A.all>`_) 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\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\npart of astropy and can be used for transformations.  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.1140827 s>\n  >>> t.delta_ut1_utc = iers_b.ut1_utc(t)\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`` and ``iers.IERS_B_URL``::\n\n  >>> iers_a = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n\nFor coordinate transformations that require IERS polar motion values,\nsetting the values manually can be done as follows (where one could also\nselect IERS_B)::\n\n  >>> iers.conf.auto_download = False\n  >>> iers.IERS.iers_table = iers.IERS_A.open(iers.IERS_A_URL)  # doctest: +SKIP\n\nTo see the internal IERS data that gets used in astropy you can do the\nfollowing::\n\n  >>> dat = iers.IERS_Auto.open()  # doctest: +SKIP\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":0,"comment":"Determine if Powershell is available.","endLoc":269,"header":"def has_powershell()","id":225,"name":"has_powershell","nodeType":"Function","startLoc":259,"text":"def has_powershell():\n    \"\"\"Determine if Powershell is available.\"\"\"\n    if platform.system() != 'Windows':\n        return False\n    cmd = ['powershell', '-Command', 'echo test']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True"},{"col":4,"comment":"null","endLoc":267,"header":"@classmethod\n    def parse_config(cls)","id":226,"name":"parse_config","nodeType":"Function","startLoc":232,"text":"@classmethod\n    def parse_config(cls):\n        if not os.path.exists('setup.cfg'):\n            return {}\n\n        cfg = ConfigParser()\n\n        try:\n            cfg.read('setup.cfg')\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.error(\n                \"Error reading setup.cfg: {0!r}\\n{1} will not be \"\n                \"automatically bootstrapped and package installation may fail.\"\n                \"\\n{2}\".format(e, PACKAGE_NAME, _err_help_msg))\n            return {}\n\n        if not cfg.has_section('ah_bootstrap'):\n            return {}\n\n        config = {}\n\n        for option, type_ in CFG_OPTIONS:\n            if not cfg.has_option('ah_bootstrap', option):\n                continue\n\n            if type_ is bool:\n                value = cfg.getboolean('ah_bootstrap', option)\n            else:\n                value = cfg.get('ah_bootstrap', option)\n\n            config[option] = value\n\n        return config"},{"col":0,"comment":"null","endLoc":275,"header":"def download_file_curl(url, target)","id":227,"name":"download_file_curl","nodeType":"Function","startLoc":273,"text":"def download_file_curl(url, target):\n    cmd = ['curl', url, '--location', '--silent', '--output', target]\n    _clean_check(cmd, target)"},{"id":228,"name":"numpy.rst","nodeType":"TextFile","path":"docs/utils","text":":orphan:\n\n.. _numpy-compatibility:\n\nNumPy compatibility\n*******************\n\nNumPy_ forms an essential basis for astropy, and astropy's development has led\nto the identification of problems with some of numpy's functionality. Often,\nthese are corrected in later versions of numpy, but in order for astropy not\nto depend on these, work-arounds are made, usually in the code.  If functions\nare used in more than one place, however, it can be more convenient to provide\npatched routines. Hence, `astropy.utils.compat.numpy`.\n\n\nAdding a patched routine\n========================\n\nTo ensure that patched code is only used when required, and that it will be\neasy to remove it if it is no longer needed for any supported version of\nNumPy_, the following procedure should be used to add a patched routine:\n\n* Copy over a correct version of the relevant numpy file to its\n  corresponding location below the ``astropy/utils/compat/numpy`` directory.\n* In this file, remove everything that does not have to be changed.  If\n  necessary, import required pieces from numpy.\n* Define a function that tests whether or not a patched version is needed, by\n  directly testing whether the desired functionality is present. Suggested\n  function names are ``PR####`` with a relevant numpy pull request number,\n  or ``GE####`` with a version number.\n* Place the redefinition of the relevant piece of code inside an ``if``\n  statement that uses the function just defined.  This should ensure that if a\n  sufficiently high version of numpy is used, no replacement is made.\n* In ``numpy/__init__.py``, import your patched code.\n* In ``numpy/tests``, add a new test routine that tests that the patch is used\n  when necessary (i.e., test the test function), and that it provides the\n  desired functionality.\n\nFor an example, see ``numpy/lib/stride_tricks.py`` and the corresponding\n``numpy/tests/test_broadcast_arrays.py``.\n\nNote that patched routines will normally only be considered if they are part\nof NumPy_. Thus, if the patch concerns a new bug discovered in numpy, a `pull\nrequest <https://github.com/numpy/numpy/pulls>`__ should first be made to\nNumPy_ (which can of course form the basis of a `pull request\n<https://github.com/astropy/astropy/pulls>`__ to ``astropy``).\n\n\nReference/API\n=============\n.. automodapi:: astropy.utils.compat.numpy\n    :no-inheritance-diagram:\n\n.. _Numpy: http://www.numpy.org/\n"},{"col":0,"comment":"null","endLoc":285,"header":"def has_curl()","id":229,"name":"has_curl","nodeType":"Function","startLoc":278,"text":"def has_curl():\n    cmd = ['curl', '--version']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True"},{"col":4,"comment":"null","endLoc":215,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,\n                 cache=True)","id":230,"name":"__init__","nodeType":"Function","startLoc":92,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        if fileobj is None:\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            self.simulateonly = True\n            self.close_on_error = False\n            return\n        else:\n            self.simulateonly = False\n            # If fileobj is of type pathlib.Path\n            if isinstance(fileobj, pathlib.Path):\n                fileobj = str(fileobj)\n            elif isinstance(fileobj, bytes):\n                # Using bytes as filename is tricky, it's deprecated for Windows\n                # in Python 3.5 (because it could lead to false-positives) but\n                # was fixed and un-deprecated in Python 3.6.\n                # However it requires that the bytes object is encoded with the\n                # file system encoding.\n                # Probably better to error out and ask for a str object instead.\n                # TODO: This could be revised when Python 3.5 support is dropped\n                # See also: https://github.com/astropy/astropy/issues/6789\n                raise TypeError(\"names should be `str` not `bytes`.\")\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(\"Mode '{}' not recognized\".format(mode))\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) 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                    \"Mode {} not supported for HTTPResponse\".format(mode))\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = 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        # More defaults to be adjusted below as necessary\n        self.compression = None\n        self.readonly = False\n        self.writeonly = 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):\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 isinstance(fileobj, bz2.BZ2File):\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"},{"col":0,"comment":"null","endLoc":291,"header":"def download_file_wget(url, target)","id":231,"name":"download_file_wget","nodeType":"Function","startLoc":289,"text":"def download_file_wget(url, target):\n    cmd = ['wget', url, '--quiet', '--output-document', target]\n    _clean_check(cmd, target)"},{"col":0,"comment":"null","endLoc":301,"header":"def has_wget()","id":232,"name":"has_wget","nodeType":"Function","startLoc":294,"text":"def has_wget():\n    cmd = ['wget', '--version']\n    with open(os.path.devnull, 'wb') as devnull:\n        try:\n            subprocess.check_call(cmd, stdout=devnull, stderr=devnull)\n        except Exception:\n            return False\n    return True"},{"id":233,"name":"docs/config","nodeType":"Package"},{"id":234,"name":"index.rst","nodeType":"TextFile","path":"docs/config","text":".. doctest-skip-all\n\n.. _astropy_config:\n\n***************************************\nConfiguration system (`astropy.config`)\n***************************************\n\nIntroduction\n============\n\nThe astropy configuration system is designed to give users control of various\nparameters used in astropy or affiliated packages without delving into the\nsource code to make those changes.\n\n.. note::\n    The configuration system got a major overhaul in astropy 0.4 as\n    part of APE3.  See :ref:`config-0-4-transition` for information\n    about updating code to use the new API.\n\n\nGetting Started\n===============\n\nThe Astropy configuration options are most easily set by modifying the\nconfiguration file.  It will be automatically generated with all the\ndefault values commented out the first time you import Astropy.  You\ncan find the exact location by doing::\n\n    >>> from astropy.config import get_config_dir\n    >>> get_config_dir()\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`` and the ``$XDG_CONFIG_HOME/astropy`` directory must exist.\nNote that ``XDG_CONFIG_HOME`` comes from a Linux-centric specification (see\n`here <https://wiki.archlinux.org/index.php/XDG_Base_Directory_support>`_ for\nmore details), but Astropy will use this on any OS as a more general mean to\nknow where user-specific configurations should be written.\n\nOnce you've 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 the 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, if you\nwant to see your changes immediately in your current Astropy session, just do::\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 subpackage.  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\nastropy remote data do::\n\n    >>> from astropy.utils.data import conf\n    >>> conf.dataurl\n    'http://data.astropy.org/'\n\nChanging Values at Run-time\n---------------------------\n\nChanging configuration values persistently 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.\n\nFor example, if there is a part of your configuration file that looks\nlike:\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 = 3.0\n\nYou should be able to modify the values at run-time this way::\n\n    >>> from astropy.utils.data import conf\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    3.0\n    >>> conf.remote_timeout = 4.5\n    >>> conf.remote_timeout\n    4.5\n\nReloading Configuration\n-----------------------\n\nInstead of modifying the variables in python, you can also modify the\nconfiguration files and then reload them.  For example, if you modify the\nconfiguration 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    >>> 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 ``reload`` with no parameters::\n\n    >>> conf.reload()\n\nOr if you want to reload all astropy configuration at once, use the\n`~astropy.config.reload_config` function::\n\n    >>> config.reload_config('astropy')\n\nYou can also reset a configuration parameter back to its default value.  Note that this is the default value defined in the Python code, and has nothing to do with the configuration file on disk::\n\n    >>> conf.reset('dataurl')\n    >>> conf.dataurl\n    'http://data.astropy.org/'\n\nUpgrading astropy\n-----------------\n\nEach time you upgrade to a new major version of astropy, the\nconfiguration parameters may have changed.\n\nIf you never edited your configuration file, there is nothing for you\nto do.  It will automatically be replaced with a configuration file\ntemplate for the newly installed version of astropy.\n\nIf you did customize your configuration file, it will not be touched.\nInstead, a new configuration file template will be installed alongside\nit with the version number in the filename, for example\n``astropy.0.4.cfg``.  You can compare this file to your\n``astropy.cfg`` file to see what needs to be changed or updated.\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 `astropy.utils.state.ScienceState`, so\nit's possible to reproduce science results without them being affected\nby 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 subpackage 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    # Create an instance for the user\n    conf = Conf()\n\n    ... implementation ...\n    def some_func():\n        #to get the value of these options, I might do:\n        something = conf.some_setting + 2\n        return conf.another_setting + ' Also, I added text.'\n\nThe configuration items also need to be added to the config file\ntemplate.  For astropy, this file is in ``astropy/astropy.cfg``.  For\nan affiliated package called, for example, ``packagename``, the file\nis in ``packagename/packagename.cfg``.  For the example above, the\nfollowing content would be added 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\nNote that the key/value pairs are commented out.  This will allow for\nchanging the default values in a future version of astropy 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 `~astropy.config.ConfigItem` gets its\ntype from the type of the ``defaultvalue`` it is given when it is\ncreated.  The item can only be set to be an object of this type.\nHence::\n\n    some_setting = ConfigItem(1, 'A description.')\n    ...\n    conf.some_setting = 1.2\n\nwill fail, because ``1.2`` is a float and ``1`` is an int.\n\nNote that if you want the configuration item to be limited to a\nparticular set of options, you should pass in a list as the\n``defaultvalue`` option.  The first entry in the list will be taken as\nthe default, and the list as a whole gives all the valid options.  For\nexample::\n\n    an_option = ConfigItem(\n        ['a', 'b', 'c'],\n        \"This option can be 'a', 'b', or 'c'\")\n    ...\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 `~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 doesn't match ``cfgtype``, the\n`~astropy.config.ConfigItem` cannot be created::\n\n    an_int_setting = ConfigItem(\n        4.2, 'A description.', cfgtype='integer')\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 list.  The default behavior will treat that\nas a list of *options* unless you explicitly tell it that the\n`~astropy.config.ConfigItem` itself is supposed to be a list::\n\n    a_list_setting = ConfigItem([1, 2, 3], 'A description.')\n\n    a_list_setting = ConfigItem([1, 2, 3], 'A description.', cfgtype='list')\n\nDetails of all the valid ``cfgtype`` items can be found in the\n`validation section of the configobj manual\n<http://www.voidspace.org.uk/python/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 is that `~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 just storing their initial\nvalue to some other variable (or used as a default for a\nfunction). For example, the following will work, but is incorrect\nusage::\n\n    def some_func(val=conf.some_setting):\n        return val + 2\n\nThis works fine as long as the user doesn't change its value during\nruntime, but if they do, the function won't know about the change::\n\n    >>> some_func()\n    3\n    >>> conf.some_setting = 3\n    >>> some_func()  # naively should return 5, because 3 + 2 = 5\n    3\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.some_setting + 2\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.some_setting if val is None else val) + 2\n\n\nSee Also\n========\n\n.. toctree::\n   :maxdepth: 2\n\n   config_0_4_transition\n\n:doc:`/logging` (overview of `astropy.logger`)\n\n\nReference/API\n=============\n\n.. automodapi:: astropy.config\n"},{"col":0,"comment":"Use Python to download the file, without connection authentication.","endLoc":316,"header":"def download_file_insecure(url, target)","id":235,"name":"download_file_insecure","nodeType":"Function","startLoc":305,"text":"def download_file_insecure(url, target):\n    \"\"\"Use Python to download the file, without connection authentication.\"\"\"\n    src = urlopen(url)\n    try:\n        # Read all the data in one block.\n        data = src.read()\n    finally:\n        src.close()\n\n    # Write all the data in one block to avoid creating a partial file.\n    with open(target, \"wb\") as dst:\n        dst.write(data)"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":40,"id":236,"name":"hdu","nodeType":"Attribute","startLoc":40,"text":"hdu"},{"id":237,"name":"config_0_4_transition.rst","nodeType":"TextFile","path":"docs/config","text":".. _config-0-4-transition:\n\nConfiguration transition\n************************\n\nThis document describes the changes in the configuration system in\nastropy 0.4 and how to update code to use it.\n\nFor users\n=========\n\nThe config file\n---------------\n\nIf you never edited the configuration file in\n``~/.astropy/config/astropy.cfg``, there is nothing for you to do.\nThe first time you import astropy 0.4, it will automatically be\nreplaced with the configuration file template for astropy 0.4.\n\nIf you did edit the configuration file, it will be left untouched.\nHowever, the template for astropy 0.4 will be installed as\n``~/.astropy/config/astropy.0.4.cfg``.  You can manually compare your\nchanges to this file to determine what customizations should be\nbrought over.\n\nSaving\n------\n\nSaving configuration items from Python has been completely removed.\nInstead, the configuration file must be edited directly.\n\nRenames\n-------\n\nThe location of the configuration parameters have been simplified, so\nthey always appear in a high-level subpackage of astropy, rather than\nlow-level file names (which were really an implementation detail that\nshouldn't have been exposed to the user).  On the Python side,\nconfiguration items always are referenced through a ``conf`` object at\nthe root of a subpackage.\n\nSome configuration items that affect the results of science\ncalculations have been removed as configuration parameters altogether\nand converted to science state objects that must be changed from\nPython code.\n\nThe following table lists all of the moves (in alphabetical order by\noriginal configuration file location).  The old names will continue to\nwork both from Python and the configuration file for the astropy 0.4\nrelease cycle, and will be removed altogether in astropy 0.5.\n\n.. list-table:: Renamed configuration parameters\n   :widths: 20 20 20 20\n   :header-rows: 1\n\n   * - Old config file location\n     - Old Python location\n     - New config file location\n     - New Python location\n   * - ``[] unicode_output``\n     - ``UNICODE_OUTPUT``\n     - *unchanged*\n     - ``conf.unicode_output``\n   * - ``[coordinates.name_resolve] name_resolve_timeout``\n     - ``coordinates.name_resolve.NAME_RESOLVE_TIMEOUT``\n     - ``[astropy.utils.data] remote_timeout``\n     - ``astropy.utils.data.conf.remote_timeout``\n   * - ``[coordinates.name_resolve] sesame_url``\n     - ``coordinates.name_resolve.SESAME_URL``\n     - *removed*\n     - ``coordinates.name_resolve.sesame_url.get/set``\n   * - ``[coordinates.name_resolve] sesame_database``\n     - ``coordinates.name_resolve.SESAME_DATABASE``\n     - *removed*\n     - ``coordinates.name_resolve.sesame_database.get/set``\n   * - ``[cosmology.core] default_cosmology``\n     - ``cosmology.core.DEFAULT_COSMOLOGY``\n     - *removed*\n     - ``cosmology.default_cosmology.get/set``\n   * - ``[io.fits] enable_record_valued_keyword_cards``\n     - ``io.fits.ENABLE_RECORD_VALUED_KEYWORD_CARDS``\n     - *unchanged*\n     - ``io.fits.conf.enable_record_valued_keyword_cards``\n   * - ``[io.fits] extension_name_case_sensitive``\n     - ``io.fits.EXTENSION_NAME_CASE_SENSITIVE``\n     - *unchanged*\n     - ``io.fits.conf.extension_name_case_sensitive``\n   * - ``[io.fits] strip_header_whitespace``\n     - ``io.fits.STRIP_HEADER_WHITESPACE``\n     - *unchanged*\n     - ``io.fits.conf.strip_header_whitespace``\n   * - ``[io.fits] use_memmap``\n     - ``io.fits.USE_MEMMAP``\n     - *unchanged*\n     - ``io.fits.conf.use_memmap``\n   * - ``[io.votable.table] pedantic``\n     - ``io.votable.table.PEDANTIC``\n     - ``[io.votable] pedantic``\n     - ``io.votable.conf.pedantic``\n   * - ``[logger] log_exceptions``\n     - ``logger.LOG_EXCEPTIONS``\n     - *unchanged*\n     - ``logger.conf.log_exceptions``\n   * - ``[logger] log_file_format``\n     - ``logger.LOG_FILE_FORMAT``\n     - *unchanged*\n     - ``logger.conf.log_file_format``\n   * - ``[logger] log_file_level``\n     - ``logger.LOG_FILE_LEVEL``\n     - *unchanged*\n     - ``logger.conf.log_file_level``\n   * - ``[logger] log_file_path``\n     - ``logger.LOG_FILE_PATH``\n     - *unchanged*\n     - ``logger.conf.log_file_path``\n   * - ``[logger] log_level``\n     - ``logger.LOG_LEVEL``\n     - *unchanged*\n     - ``logger.conf.log_level``\n   * - ``[logger] log_to_file``\n     - ``logger.LOG_TO_FILE``\n     - *unchanged*\n     - ``logger.conf.log_to_file``\n   * - ``[logger] log_warnings``\n     - ``logger.LOG_WARNINGS``\n     - *unchanged*\n     - ``logger.conf.log_warnings``\n   * - ``[logger] use_color``\n     - ``logger.USE_COLOR``\n     - ``[] use_color``\n     - ``conf.use_color``\n   * - ``[nddata.nddata] warn_unsupported_correlated``\n     - ``nddata.nddata.WARN_UNSUPPORTED_CORRELATED``\n     - ``[nddata] warn_unsupported_correlated``\n     - ``nddata.conf.warn_unsupported_correlated``\n   * - ``[table.column] auto_colname``\n     - ``table.column.AUTO_COLNAME``\n     - ``[table] auto_colname``\n     - ``table.conf.auto_colname``\n   * - ``[table.jsviewer] jquery_url``\n     - ``table.jsviewer.JQUERY_URL``\n     - *unchanged*\n     - ``table.jsviewer.conf.jquery_url``\n   * - ``[table.jsviewer] datatables_url``\n     - ``table.jsviewer.DATATABLES_URL``\n     - *unchanged*\n     - ``table.jsviewer.conf.datatables_url``\n   * - ``[table.pprint] max_lines``\n     - ``table.pprint.MAX_LINES``\n     - ``[] max_lines``\n     - ``conf.max_lines``\n   * - ``[table.pprint] max_width``\n     - ``table.pprint.MAX_WIDTH``\n     - ``[] max_width``\n     - ``conf.max_width``\n   * - ``[utils.console] use_color``\n     - ``utils.console.USE_COLOR``\n     - ``[] use_color``\n     - ``conf.use_color``\n   * - ``[utils.data] compute_hash_block_size``\n     - ``astropy.utils.data.COMPUTE_HASH_BLOCK_SIZE``\n     - *unchanged*\n     - ``astropy.utils.data.conf.compute_hash_block_size``\n   * - ``[utils.data] dataurl``\n     - ``astropy.utils.data.DATAURL``\n     - *unchanged*\n     - ``astropy.utils.data.conf.dataurl``\n   * - ``[utils.data] delete_temporary_downloads_at_exit``\n     - ``astropy.utils.data.DELETE_TEMPORARY_DOWNLOADS_AT_EXIT``\n     - *unchanged*\n     - ``astropy.utils.data.conf.delete_temporary_downloads_at_exit``\n   * - ``[utils.data] download_cache_block_size``\n     - ``astropy.utils.data.DOWNLOAD_CACHE_BLOCK_SIZE``\n     - *unchanged*\n     - ``astropy.utils.data.conf.download_cache_block_size``\n   * - ``[utils.data] download_cache_lock_attempts``\n     - ``astropy.utils.data.download_cache_lock_attempts``\n     - *unchanged*\n     - ``astropy.utils.data.conf.download_cache_lock_attempts``\n   * - ``[utils.data] remote_timeout``\n     - ``astropy.utils.data.REMOTE_TIMEOUT``\n     - *unchanged*\n     - ``astropy.utils.data.conf.remote_timeout``\n   * - ``[vo.client.conesearch] conesearch_dbname``\n     - ``vo.client.conesearch.CONESEARCH_DBNAME``\n     - ``[vo] conesearch_dbname``\n     - ``vo.conf.conesearch_dbname``\n   * - ``[vo.client.vos_catalog] vos_baseurl``\n     - ``vo.client.vos_catalog.BASEURL``\n     - ``[vo] vos_baseurl``\n     - ``vo.conf.vos_baseurl``\n   * - ``[vo.samp.utils] use_internet``\n     - ``vo.samp.utils.ALLOW_INTERNET``\n     - ``[vo.samp] use_internet``\n     - ``vo.samp.conf.use_internet``\n   * - ``[vo.validator.validate] cs_mstr_list``\n     - ``vo.validator.validate.CS_MSTR_LIST``\n     - ``[vo.validator] conesearch_master_list``\n     - ``vo.validator.conf.conesearch_master_list``\n   * - ``[vo.validator.validate] cs_urls``\n     - ``vo.validator.validate.CS_URLS``\n     - ``[vo.validator] conesearch_urls``\n     - ``vo.validator.conf.conesearch_urls``\n   * - ``[vo.validator.validate] noncrit_warnings``\n     - ``vo.validator.validate.noncrit_warnings``\n     - ``[vo.validator] noncritical_warnings``\n     - ``vo.validator.conf.noncritical_warnings``\n\nFor affiliated package authors\n==============================\n\nFor an affiliated package to support both astropy 0.3 and 0.4,\nfollowing the astropy 0.3 config instructions should continue to work.\nNote that saving of configuration items has been removed entirely from\nastropy 0.4 without a deprecation cycle, so if saving configuration\nprogrammatically is important to your package, you may want to\nconsider another method to save that state.\n\nHowever, by the release of astropy 0.5, the astropy 0.3 config API\nwill no longer work.  The following describes how to transition an\naffiliated package written for astropy 0.3 to support astropy 0.4 and\nlater.  It will not be possible to support astropy 0.3, 0.4 and 0.5\nsimultaneously.  Below ``pkgname`` is the name of your affiliated\npackage.\n\nThe automatic generation of configuration files from the\n``ConfigurationItem`` objects that it finds has been removed.\nInstead, the project should include a hard-coded \"template\"\nconfiguration file in ``pkgname/pkgname.cfg``.  By convention, and to\nease upgrades for end users, all of the values should be commented\nout.  For example:\n\n.. code-block:: ini\n\n    [nddata]\n\n    ## Whether to issue a warning if NDData arithmetic is performed with\n    ## uncertainties and the uncertainties do not support the propagation of\n    ## correlated uncertainties.\n    # warn_unsupported_correlated = True\n\nAffiliated packages should transition to using\n`astropy.config.ConfigItem` objects as members of\n`astropy.config.ConfigNamespace` subclasses.\n\nFor example, the following is an example of the astropy 0.3 and\nearlier method to define configuration items::\n\n    from astropy.config import ConfigurationItem\n\n    ENABLE_RECORD_VALUED_KEYWORD_CARDS = ConfigurationItem(\n        'enabled_record_valued_keyword_cards', True,\n        'If True, enable support for record-valued keywords as described by '\n        'the FITS WCS distortion paper. Otherwise they are treated as normal '\n        'keywords.')\n\n    EXTENSION_NAME_CASE_SENSITIVE = ConfigurationItem(\n        'extension_name_case_sensitive', False,\n        'If True, extension names (i.e. the EXTNAME keyword) should be '\n       'treated as case-sensitive.')\n\nThe above, converted to the new method, looks like::\n\n    from astropy import config as _config\n\n    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            'the FITS WCS distortion paper. Otherwise they are treated as normal '\n            'keywords.',\n            aliases=['astropy.io.fits.enabled_record_valued_keyword_cards'])\n\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    conf = Conf()\n\n\nMoving/renaming configuration items in Python\n---------------------------------------------\n\n``ConfigAlias`` objects can be used when a configuration item has been\nmoved from an astropy 0.3-style ``ConfigurationItem`` to an astropy\n0.4-style ``ConfigItem`` inside of a ``ConfigNamespace``.\n\nIn the above example, the following adds backward-compatible hooks so\nthe old Python locations of the configuration items will continue to\nwork from user code::\n\n    ENABLE_RECORD_VALUED_KEYWORD_CARDS = _config.ConfigAlias(\n        '0.4', 'ENABLE_RECORD_VALUED_KEYWORD_CARDS',\n        'enable_record_valued_keyword_cards')\n\nMoving/renaming configuration items in the config file\n------------------------------------------------------\n\nIf a configuration item is moved or renamed within the configuration\nfile, the ``aliases`` kwarg to ``ConfigItem`` can be used so that the\nold location will continue to be used as a fallback.  For example, if\nthe old location of an item was:\n\n.. code-block:: ini\n\n    [coordinates.name_resolve]\n    sesame_url = http://somewhere.com\n\nOne might want to drop the fact that that is implemented in the module\n``name_resolve`` and just store the configuration in ``coordinates``:\n\n.. code-block:: ini\n\n    [coordinates]\n    sesame_url = http://somewhere.com\n\nWhen defining the ``ConfigItem`` for this entry, the ``aliases`` kwarg\ncan list the old location(s) of the configuration item::\n\n    sesame_url = _config.ConfigItem(\n        [\"http://somewhere.com\"],\n        \"\"\"Docstring\"\"\",\n        aliases=['astropy.coordinates.name_resolve.sesame_url'])\n"},{"col":0,"comment":"\n    Build the arguments to 'python setup.py install' on the setuptools package.\n\n    Returns list of command line arguments.\n    ","endLoc":365,"header":"def _build_install_args(options)","id":238,"name":"_build_install_args","nodeType":"Function","startLoc":359,"text":"def _build_install_args(options):\n    \"\"\"\n    Build the arguments to 'python setup.py install' on the setuptools package.\n\n    Returns list of command line arguments.\n    \"\"\"\n    return ['--user'] if options.user_install else []"},{"col":0,"comment":"Parse the command line for options.","endLoc":394,"header":"def _parse_args()","id":239,"name":"_parse_args","nodeType":"Function","startLoc":368,"text":"def _parse_args():\n    \"\"\"Parse the command line for options.\"\"\"\n    parser = optparse.OptionParser()\n    parser.add_option(\n        '--user', dest='user_install', action='store_true', default=False,\n        help='install in user site package')\n    parser.add_option(\n        '--download-base', dest='download_base', metavar=\"URL\",\n        default=DEFAULT_URL,\n        help='alternative URL from where to download the setuptools package')\n    parser.add_option(\n        '--insecure', dest='downloader_factory', action='store_const',\n        const=lambda: download_file_insecure, default=get_best_downloader,\n        help='Use internal, non-validating downloader'\n    )\n    parser.add_option(\n        '--version', help=\"Specify which version to download\",\n        default=DEFAULT_VERSION,\n    )\n    parser.add_option(\n        '--to-dir',\n        help=\"Directory to save (and re-use) package\",\n        default=DEFAULT_SAVE_DIR,\n    )\n    options, args = parser.parse_args()\n    # positional arguments are ignored\n    return options"},{"id":240,"name":"docs/nddata","nodeType":"Package"},{"id":241,"name":"ccddata.rst","nodeType":"TextFile","path":"docs/nddata","text":".. _ccddata:\n\n.. skipped masked_array tests can be included when we know \"not NUMPY_LT_1_14\"\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 is easy:\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``, which\ncan be set either by providing the string name of the unit (as in the example\nabove) 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 file:\n\n    >>> ccd = CCDData.read('my_file.fits', unit=\"adu\")  # doctest: +SKIP\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 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\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 ``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  # doctest: +SKIP\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)  # doctest: +SKIP\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 not required when a `~astropy.nddata.CCDData` image is created you\ncan 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. For more details on setting flags see\n`~astropy.nddata.NDData`.\n\nWCS\n+++\n\nThe  ``wcs`` attribute of `~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`. Using `~astropy.nddata.StdDevUncertainty`\nis required 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), take care of any necessary unit conversions, and apply masks\nappropriately. Note that the metadata of the result is *not* set if the operation\nis 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"},{"col":14,"endLoc":380,"id":242,"nodeType":"Lambda","startLoc":380,"text":"lambda: download_file_insecure"},{"id":243,"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``, representing the physical unit of the data\n+ ``uncertainty`` for the uncertainty of the data\n+ ``mask``, indicating invalid points in the data\n+ ``wcs``, representing 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 required to be\n`numpy.ndarray`-like. It's the only property that is required to create an\ninstance and it cannot be directly set on the instance.\n\nFor example::\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 can be accessed 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\nData during initialization\n--------------------------\n\nDuring initialization it is possible to provide data that it's not a\n`numpy.ndarray` but convertible to one. For example passing a `list` containing\nnumerical 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\nNested `list` or `tuple` are possible, but if these contain non-numerical\nvalues the conversion might fail.\n\nBesides input that is convertible to such an array you can use the ``data``\nparameter to pass implicit additional information. For example if the data is\nanother `~astropy.nddata.NDData`-object it implicitly uses it's properties::\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 ``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 ``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 array).\n\nMask\n====\n\nThe ``mask`` is being used to indicate if data points are valid or invalid.\n`~astropy.nddata.NDData` doesn't restrict this mask in any way but it is\nexpected to follow the `numpy.ma.MaskedArray` convention that the mask:\n\n+ returns ``True`` for data points that are considered **invalid**.\n+ returns ``False`` for those points that are **valid**.\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 example, a\nfunction which evaluates a mask value as needed is acceptable as long as it\nfollows the convention that ``True`` indicates a value that should be ignored.\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 that it returns a short string like ``\"std\"`` for an uncertainty\ngiven in standard deviation.\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\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\nMeta-data\n=========\n\nThe ``meta`` property contains all further meta information that don't fit\nany other property.\n\nIf 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`` isn't provided or explicitly set to ``None`` it will default to\nan 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 meta-data dictionary can be set to any valid Python object::\n\n    >>> ndd.meta['history'] = ['calibrated', 'aligned', 'flat-fielded']\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 don't allow for this. For\nexample if 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\nConverting NDData to other classes\n==================================\n\nThere is limited to 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  # doctest: +SKIP\n    masked_array(data=[--, 2, 3, --],\n                 mask=[ True, False, False,  True],\n           fill_value=999999)\n\n.. above and below, skipped masked_array tests can be included when we know\n   \"not NUMPY_LT_1_14\"\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, one would construct masked quantities, but these are not properly\n    supported: many operations on them fail.\n"},{"col":0,"comment":"Return args for download_setuptools function from cmdline args.","endLoc":404,"header":"def _download_args(options)","id":244,"name":"_download_args","nodeType":"Function","startLoc":397,"text":"def _download_args(options):\n    \"\"\"Return args for download_setuptools function from cmdline args.\"\"\"\n    return dict(\n        version=options.version,\n        download_base=options.download_base,\n        downloader_factory=options.downloader_factory,\n        to_dir=options.to_dir,\n    )"},{"col":0,"comment":"Install or upgrade setuptools and EasyInstall.","endLoc":411,"header":"def main()","id":245,"name":"main","nodeType":"Function","startLoc":407,"text":"def main():\n    \"\"\"Install or upgrade setuptools and EasyInstall.\"\"\"\n    options = _parse_args()\n    archive = download_setuptools(**_download_args(options))\n    return _install(archive, _build_install_args(options))"},{"id":246,"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.\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 an `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    >>> from astropy.coordinates import SkyCoord\n    >>> wcs = SkyCoord('00h42m44.3s', '+41d16m09s')\n    >>> ndd = NDData(data, mask=mask, unit=unit, uncertainty=uncertainty,\n    ...              meta=meta, wcs=wcs)\n    >>> ndd\n    NDData([1, 2, 3, 4])\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 io 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])\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])\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 (issuing warnings if\nsome attribute cannot be sliced)::\n\n    >>> ndd2[2:]  # discard the first two elements  # doctest: +FLOAT_CMP\n    INFO: wcs cannot be sliced. [astropy.nddata.mixins.ndslicing]\n    NDDataRef([6. , 6.5])\n    >>> ndd2[1]   # get the second element  # doctest: +FLOAT_CMP\n    INFO: wcs cannot be sliced. [astropy.nddata.mixins.ndslicing]\n    NDDataRef(-1.5)\n\n\nStdDevUncertainty\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'll construct a two-dimensional image with a few\nsources, some Gaussian noise, and a \"cosmic ray\" which we will later mask out::\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 simple test image, like this::\n\n    >>> mask = (data == cosmic_ray_value)\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 the works the way you would expect, with the mask and, if present,\nWCS, sliced appropriately also::\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. Support for uncertainties is currently limited\nto standard deviation. The example below creates an uncertainty that is simply\nPoisson error; note that the masked version of the square root is used::\n\n    >>> ccd.uncertainty = np.ma.sqrt(np.ma.abs(ccd.data))\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\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\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. The example below pulls out the large \"galaxy\" in the lower left of the\nimage, with the center of the cutout at ``position``::\n\n    >>> from astropy.nddata import Cutout2D\n    >>> position = (149.7, 100.1)\n    >>> size = (80, 100)     # 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 = (80, 100)     # 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 = (80, 100)     # 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 find pixel coordinates in the original or\nin 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\nImage resizing\n^^^^^^^^^^^^^^\n\nThe functions `~astropy.nddata.block_reduce` and\n`~astropy.nddata.block_replicate` resize images. The example below reduces the\nsize of the image by a factor of 4. Note that the result is a `numpy.ndarray`;\nthe 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)\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\nOther image classes\n-------------------\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 to all 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, sets up straightforward read/write to FITS\n  files, automatically sets up a WCS property.\n\n\nMore general gridded data class\n-------------------------------\n\nThere are two additional classes in the ``nddata`` package that are of\ninterest primarily to people that 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 people writing their own image classes or for those looking\nfor an image class that goes beyond what `~astropy.nddata.CCDData` does.\n\n+ The `SunPy project <http://sunpy.org/>`_ uses `~astropy.nddata.NDData` as the\n  foundation for its\n  `Map classes <http://docs.sunpy.org/en/stable/code_ref/map.html>`_.\n+ The class `~astropy.nddata.NDDataRef` is used in\n  `specutils <http://specutils.readthedocs.io/en/latest/>`_ as the basis for\n  `Spectrum1D <http://specutils.readthedocs.io/en/latest/api/specutils.Spectrum1D.html>`_, which adds several methods useful for\n  spectra.\n+ The package `ndmapper <http://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 <http://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   decorator.rst\n   nddata.rst\n   mixins/index.rst\n   subclassing.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.nddata\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/master/APE7.rst\n"},{"attributeType":"None","col":4,"comment":"null","endLoc":34,"id":247,"name":"USER_SITE","nodeType":"Attribute","startLoc":34,"text":"USER_SITE"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":248,"name":"DEFAULT_VERSION","nodeType":"Attribute","startLoc":37,"text":"DEFAULT_VERSION"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":249,"name":"DEFAULT_URL","nodeType":"Attribute","startLoc":38,"text":"DEFAULT_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":250,"name":"DEFAULT_SAVE_DIR","nodeType":"Attribute","startLoc":39,"text":"DEFAULT_SAVE_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":251,"name":"DEFAULT_DEPRECATION_MESSAGE","nodeType":"Attribute","startLoc":40,"text":"DEFAULT_DEPRECATION_MESSAGE"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":252,"name":"MEANINGFUL_INVALID_ZIP_ERR_MSG","nodeType":"Attribute","startLoc":42,"text":"MEANINGFUL_INVALID_ZIP_ERR_MSG"},{"attributeType":"function","col":0,"comment":"null","endLoc":270,"id":253,"name":"viable","nodeType":"Attribute","startLoc":270,"text":"download_file_powershell.viable"},{"id":254,"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 attribute with one leading underscore. For example\n  the ``data`` is saved as ``_data`` and the ``mask`` as ``_mask``, 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 possible operations is quite easy provided the ``data`` and\n``unit`` allow it within the framework of `~astropy.units.Quantity`.\n\nFor example adding 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 like\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\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,\nand converts the operands, if necessary, to the appropriate classes. Overriding\n``_prepare_then_do_arithmetic`` in subclasses should be avoided if\npossible.\n\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 like\n:meth:`~astropy.nddata.NDArithmeticMixin.add` but it's possible to hardcode\nbehaviour too. The actual operation on the attribute (except for ``unit``) is\ndone in a method ``_arithmetic_*`` where ``*`` is the name of the property.\n\nFor example to 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 ``\"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 accepts different\n    arguments: ``operation, operand, result, correlation, **kwargs``\n\n\nChanging default argument for arithmetic operations\n---------------------------------------------------\n\nIf the goal is to change the default value of an existing parameter for\narithmetic methods, maybe because explicitly specifying the parameter each\ntime you're calling an arithmetic operation is too much effort, you can easily\nchange the default value of existing parameters by changing it in the method\nsignature of ``_arithmetic``::\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 one to only alter one default\nwithout needing to care about the positional order of arguments.\n\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\n\nSlicing an existing property\n----------------------------\n\nSuppose you have a class expecting a 2 dimensional ``data`` but the mask is\nonly 1D. This would lead to problems if one 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 doing the slicing of the attributes are prefixed by a\n  ``_slice_*`` where ``*`` can be ``mask``, ``uncertainty`` or ``wcs``. So\n  simply overriding them is the easiest way to customize how the 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), it may\nbe more straightforward to subclass `~astropy.nddata.NDData` instead of\n`~astropy.nddata.NDDataBase`.\n\nImplementing the NDDataBase interface\n-------------------------------------\n\nFor example to create a readonly 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\nSubclassing `~astropy.nddata.NDUncertainty`\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 to implement:\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 UFUNC\n  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. So let's create an uncertainty just 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 _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\nSubclassing `~astropy.nddata.StdDevUncertainty`\n===============================================\n\nCreating an variance uncertainty\n--------------------------------\n\n`~astropy.nddata.StdDevUncertainty` already implements propagation based\non gaussian standard deviation so this could be the starting point of an\nuncertainty using these propagations:\n\n    >>> from astropy.nddata import StdDevUncertainty\n    >>> import numpy as np\n    >>> import weakref\n\n    >>> class VarianceUncertainty(StdDevUncertainty):\n    ...     @property\n    ...     def uncertainty_type(self):\n    ...         return 'variance'\n    ...\n    ...     def _propagate_add(self, other_uncert, *args, **kwargs):\n    ...         # Neglect the unit assume that both are Variance uncertainties\n    ...         this = StdDevUncertainty(np.sqrt(self.array))\n    ...         other = StdDevUncertainty(np.sqrt(other_uncert.array))\n    ...\n    ...         # We need to set the parent_nddata attribute otherwise it will\n    ...         # fail for multiplication and division where the data\n    ...         # not only the uncertainty matters.\n    ...         this.parent_nddata = weakref.ref(self.parent_nddata)\n    ...         other.parent_nddata = weakref.ref(other_uncert.parent_nddata)\n    ...\n    ...         # Call propagation:\n    ...         result = this._propagate_add(other, *args, **kwargs)\n    ...\n    ...         # Return the square of it\n    ...         return np.square(result)\n\n    >>> from astropy.nddata import NDDataRef\n\n    >>> ndd1 = NDDataRef([1,2,3], unit='m', uncertainty=VarianceUncertainty([1,4,9]))\n    >>> ndd2 = NDDataRef([1,2,3], unit='m', uncertainty=VarianceUncertainty([1,4,9]))\n    >>> ndd = ndd1.add(ndd2)\n    >>> ndd.uncertainty\n    VarianceUncertainty([  2.,   8.,  18.])\n\nthis approach certainly works if both are variance uncertainties, but if you\nwant to allow that the second operand also can be a standard deviation one can\noverride the ``_convert_uncertainty`` method as well::\n\n    >>> class VarianceUncertainty2(VarianceUncertainty):\n    ...     def _convert_uncertainty(self, other_uncert):\n    ...         if isinstance(other_uncert, VarianceUncertainty):\n    ...             return other_uncert\n    ...         elif isinstance(other_uncert, StdDevUncertainty):\n    ...             converted = VarianceUncertainty(np.square(other_uncert.array))\n    ...             converted.parent_nddata = weakref.ref(other_uncert.parent_nddata)\n    ...             return converted\n    ...         raise ValueError('not compatible uncertainties.')\n\n    >>> ndd1 = NDDataRef([1,2,3], uncertainty=VarianceUncertainty2([1,4,9]))\n    >>> ndd2 = NDDataRef([1,2,3], uncertainty=StdDevUncertainty([1,2,3]))\n    >>> ndd = ndd1.add(ndd2)\n    >>> ndd.uncertainty\n    VarianceUncertainty2([  2.,   8.,  18.])\n\n.. warning::\n    This will only allow the **second** operand to have a\n    `~astropy.nddata.StdDevUncertainty` uncertainty. It will fail if the first\n    operand is standard deviation and the second operand a variance.\n\n.. note::\n    Creating a variance uncertainty like this might require more work to\n    include proper treatment of the unit of the uncertainty! And of course\n    implementing also the ``_propagate_*`` for subtraction, division and\n    multiplication.\n"},{"attributeType":"function","col":0,"comment":"null","endLoc":286,"id":255,"name":"viable","nodeType":"Attribute","startLoc":286,"text":"download_file_curl.viable"},{"col":4,"comment":"null","endLoc":290,"header":"@classmethod\n    def parse_command_line(cls, argv=None)","id":256,"name":"parse_command_line","nodeType":"Function","startLoc":269,"text":"@classmethod\n    def parse_command_line(cls, argv=None):\n        if argv is None:\n            argv = sys.argv\n\n        config = {}\n\n        # For now we just pop recognized ah_bootstrap options out of the\n        # arg list.  This is imperfect; in the unlikely case that a setup.py\n        # custom command or even custom Distribution class defines an argument\n        # of the same name then we will break that.  However there's a catch22\n        # here that we can't just do full argument parsing right here, because\n        # we don't yet know *how* to parse all possible command-line arguments.\n        if '--no-git' in argv:\n            config['use_git'] = False\n            argv.remove('--no-git')\n\n        if '--offline' in argv:\n            config['offline'] = True\n            argv.remove('--offline')\n\n        return config"},{"attributeType":"function","col":0,"comment":"null","endLoc":302,"id":257,"name":"viable","nodeType":"Attribute","startLoc":302,"text":"download_file_wget.viable"},{"attributeType":"function","col":0,"comment":"null","endLoc":317,"id":258,"name":"viable","nodeType":"Attribute","startLoc":317,"text":"download_file_insecure.viable"},{"id":259,"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 easy for developers and\nusers to write functions that can accept either :class:`~astropy.nddata.NDData`\nobjects and also separate arguments.\n\nLet's consider the following function::\n\n    def test(data, wcs=None, unit=None, n_iterations=3):\n        ...\n\nNow let's say that we want to be able to call the function as ``test(nd)``\nwhere ``nd`` is a :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\nThat is, the 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 wasn't decorated.\n\nAn 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 simply 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``\nsub-classes (and sub-classes 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"},{"col":0,"comment":"","endLoc":11,"header":"ez_setup.py#<anonymous>","id":260,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nSetuptools bootstrapping installer.\n\nMaintained at https://github.com/pypa/setuptools/tree/bootstrap.\n\nRun this script to install or upgrade setuptools.\n\nThis method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.\n\"\"\"\n\ntry:\n    from urllib.request import urlopen\nexcept ImportError:\n    from urllib2 import urlopen\n\ntry:\n    from site import USER_SITE\nexcept ImportError:\n    USER_SITE = None\n\nDEFAULT_VERSION = \"33.1.1\"\n\nDEFAULT_URL = \"https://pypi.io/packages/source/s/setuptools/\"\n\nDEFAULT_SAVE_DIR = os.curdir\n\nDEFAULT_DEPRECATION_MESSAGE = \"ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools\"\n\nMEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'\n\nlog.warn(DEFAULT_DEPRECATION_MESSAGE.format(DEFAULT_VERSION))\n\ndownload_file_powershell.viable = has_powershell\n\ndownload_file_curl.viable = has_curl\n\ndownload_file_wget.viable = has_wget\n\ndownload_file_insecure.viable = lambda: True\n\nif __name__ == '__main__':\n    sys.exit(main())"},{"col":32,"endLoc":317,"id":261,"nodeType":"Lambda","startLoc":317,"text":"lambda: True"},{"id":262,"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, let's simulate a single source on a 2D data array. If you would like to\nsimulate many sources, see :ref:`bounding-boxes`.\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, let's 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\nNow let's 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) = (40, 50)`` pixels::\n\n    >>> from astropy.nddata import Cutout2D\n    >>> from astropy import units as u\n    >>> position = (49.7, 100.1)\n    >>> size = (40, 50)     # pixels\n    >>> cutout = Cutout2D(data, position, size)\n\nThe ``size`` keyword can also be a `~astropy.units.Quantity` object::\n\n    >>> size = u.Quantity((40, 50), u.pixel)\n    >>> cutout = Cutout2D(data, position, size)\n\nor contain `~astropy.units.Quantity` objects::\n\n    >>> size = (40*u.pixel, 50*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 = 40\n    >>> cutout2 = Cutout2D(data, position, size)\n\n    >>> size = 40 * 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``.  Let's display the cutout\nimage:\n\n.. doctest-skip::\n\n    >>> cutout = Cutout2D(data, position, (40, 50))\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, (40, 50))\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 = (40, 50)\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    (40, 50)\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, 120, None), slice(25, 75, None))\n\n    >>> # tuple of slice objects for the cutout array\n    >>> print(cutout.slices_cutout)\n    (slice(0, 40, None), slice(0, 50, 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, let's 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 let's 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.\nLet's 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'll 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\nReference/API\n=============\n\n.. automodapi:: astropy.nddata.utils\n    :no-inheritance-diagram:\n"},{"id":263,"name":"docs/nddata/mixins","nodeType":"Package"},{"id":264,"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"},{"id":265,"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 us the astropy I/O registry.\n\nThe mixin itself simply 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"},{"col":0,"comment":"Deprecate a _renamed_ 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 list/tuple thereof\n        The old name of the argument.\n\n    new_name : str or list/tuple thereof\n        The new name of the argument.\n\n    since : str or number or list/tuple thereof\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or list/tuple thereof, 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 list/tuple thereof, 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 list/tuple thereof, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\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)\n        2\n\n    To deprecate an argument catched 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)\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)\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)\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    ","endLoc":490,"header":"def deprecated_renamed_argument(old_name, new_name, since,\n                                arg_in_kwargs=False, relax=False,\n                                pending=False)","id":266,"name":"deprecated_renamed_argument","nodeType":"Function","startLoc":264,"text":"def deprecated_renamed_argument(old_name, new_name, since,\n                                arg_in_kwargs=False, relax=False,\n                                pending=False):\n    \"\"\"Deprecate a _renamed_ 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 list/tuple thereof\n        The old name of the argument.\n\n    new_name : str or list/tuple thereof\n        The new name of the argument.\n\n    since : str or number or list/tuple thereof\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or list/tuple thereof, 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 list/tuple thereof, 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 list/tuple thereof, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\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)\n        2\n\n    To deprecate an argument catched 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)\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)\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)\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    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    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\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 new_name[i] in arguments:\n                param = arguments[new_name[i]]\n                # There are several possibilities now:\n\n                # 1.) Positional or keyword argument:\n                if param.kind == param.POSITIONAL_OR_KEYWORD:\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('cannot replace argument \"{0}\" of kind '\n                                    '{1!r}.'.format(new_name[i], param.kind))\n\n            # In case the argument is not found in the list of arguments\n            # the only remaining possibility is that it should be catched\n            # by some kind of **kwargs argument.\n            # This case has to be explicitly specified, otherwise throw\n            # an exception!\n            elif arg_in_kwargs[i]:\n                position[i] = None\n            else:\n                raise TypeError('\"{}\" 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                                '.'.format(new_name[i]))\n\n        @functools.wraps(function)\n        def wrapper(*args, **kwargs):\n            for i in range(n):\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 only\n                    # pending.\n                    if not pending[i]:\n                        warnings.warn(\n                            '\"{0}\" was deprecated in version {1} '\n                            'and will be removed in a future version. '\n                            'Use argument \"{2}\" instead.'\n                            ''.format(old_name[i], since[i], new_name[i]),\n                            AstropyDeprecationWarning, 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                                    '\"{0}\" and \"{1}\" keywords were set. '\n                                    'Using the value of \"{1}\".'\n                                    ''.format(old_name[i], new_name[i]),\n                                    AstropyUserWarning)\n                            else:\n                                raise TypeError(\n                                    'cannot specify both \"{}\" and \"{}\"'\n                                    '.'.format(old_name[i], new_name[i]))\n                    else:\n                        # If the new argument isn't specified just pass the old\n                        # one with the name of the new argument to the function\n                        kwargs[new_name[i]] = value\n            return function(*args, **kwargs)\n\n        return wrapper\n    return decorator"},{"id":267,"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    >>> import numpy as np\n    >>> ndd1 = NDDataRef([1, 2, 3, 4])\n\nwhile the requirement for the second operand is simply: 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\na `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. Also several other\nclasses are possible.\n\nUsing arithmetic classmethods\n=============================\n\nHere both operands don't need to be `~astropy.nddata.NDDataRef`-like::\n\n    >>> NDDataRef.add(1, 3)\n    NDDataRef(4)\n\nor to 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.])\n    >>> ndd.unit\n    Unit(\"cm m\")\n\nor taking the inverse of a `~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 ``+``, ``-``, ... are not implemented because\nthe methods provide several options how to proceed with the additional\nattributes.\n\ndata, 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 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 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 arbitary 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 obviously non-sense but let's 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 don't 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 of the\n  first operand or if that contains no keys the meta of the second operand is\n  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's 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 just 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\nwcs\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=0)\n      >>> ndd2 = NDDataRef(1, wcs=1)\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 the\n  first operand or if that is None the meta of the second operand is\n  taken.\n\n      >>> ndd1 = NDDataRef(1, wcs=1)\n      >>> ndd2 = NDDataRef(1, wcs=0)\n      >>> ndd1.add(ndd2, compare_wcs='ff').wcs\n      1\n\n- If it's 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 identical\n  (enough) to allow the arithmetic operation or ``False`` if the arithmetic\n  operation should be aborted with a ``ValueError``. If ``True`` the ``wcs``\n  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      ...         return abs(wcs1 - wcs2) < allowed_deviation\n\n      >>> ndd1 = NDDataRef(1, wcs=1)\n      >>> ndd2 = NDDataRef(1, wcs=1)\n      >>> ndd1.subtract(ndd2, compare_wcs=compare_wcs_scalar).wcs\n      1\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=1)\n      >>> ndd2 = NDDataRef(1, wcs=2)\n      >>> ndd1.subtract(ndd2, compare_wcs=compare_wcs_scalar, wcs_allowed_deviation=2).wcs\n      1\n\n  If one is using `~astropy.wcs.WCS` objects a very handy function to use might\n  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 not 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 give also an argument\nfor ``uncertainty_correlation``. `~astropy.nddata.StdDevUncertainty` cannot\nkeep track of it's 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\nFor example without correlation subtracting a `~astropy.nddata.NDDataRef`\ninstance from itself 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\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, the second element partially correlates while\nelement 3 is uncorrelated and 4 is anti-correlated.\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":268,"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 applying 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://docs.scipy.org/doc/numpy/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** combination of properties always results 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\nexcept you indexed only one element (for example ``ndd_sliced = ndd[1]``). Then\nthe element is a scalar and changes will not propagate to the original.\n\nSlicing NDDataRef including attributes\n======================================\n\nIn case a ``wcs``, ``mask`` or ``uncertainty`` is present this attribute will\nbe 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    >>> wcs = np.ones(4)\n    >>> ndd = NDDataRef(data, mask=mask, uncertainty=uncertainty, wcs=wcs)\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    >>> ndd_sliced.wcs  # doctest: +FLOAT_CMP\n    array([1., 1.])\n\nbut ``unit`` and ``meta`` will be unaffected.\n\nIf any of the attributes is set but doesn't 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    >>> wcs = {'a': 5}\n    >>> ndd = NDDataRef(data, mask=mask, uncertainty=uncertainty, wcs=wcs)\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    INFO: wcs cannot be sliced. [astropy.nddata.mixins.ndslicing]\n\n    >>> ndd_sliced.mask\n    False\n\nExample: Remove masked data\n===========================\n\n.. warning::\n    If you are using a `~astropy.wcs.WCS` object as ``wcs`` this will **NOT**\n    be possible. But you could work around it, i.e. set it to ``None`` before\n    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\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"},{"col":0,"comment":"","endLoc":4,"header":"programmatic.py#<anonymous>","id":269,"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]], np.float_)\n\nworld = w.wcs_pix2world(pixcrd, 1)\n\nprint(world)\n\npixcrd2 = w.wcs_world2pix(world, 1)\n\nprint(pixcrd2)\n\nassert np.max(np.abs(pixcrd - pixcrd2)) < 1e-6\n\nheader = w.to_header()\n\nhdu = fits.PrimaryHDU(header=header)"},{"col":4,"comment":"null","endLoc":509,"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":270,"name":"__init__","nodeType":"Function","startLoc":358,"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        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            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            except _wcs.NoWcsKeywordsFoundError:\n                est_naxis = 0\n            else:\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis\n                else:\n                    est_naxis = 2\n\n            header = fits.Header.fromstring(header_string)\n\n            if est_naxis == 0:\n                est_naxis = 2\n            self.naxis = est_naxis\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)\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)\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 {0} 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 ({0:d}) than the \"\n                    \"image it is associated with ({1: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            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()"},{"id":271,"name":"docs/_static","nodeType":"Package"},{"id":272,"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":273,"name":"docs/modeling","nodeType":"Package"},{"id":274,"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\nFitting examples\n================\n\n- Fitting a polynomial model to multiple data sets simultaneously::\n\n      >>> from astropy.modeling import models, fitting\n      >>> import numpy as np\n      >>> p1 = models.Polynomial1D(3)\n      >>> p1.c0 = 1\n      >>> p1.c1 = 2\n      >>> print(p1)\n      Model: Polynomial1D\n      Inputs: ('x',)\n      Outputs: ('y',)\n      Model set size: 1\n      Degree: 3\n      Parameters:\n           c0  c1  c2  c3\n          --- --- --- ---\n          1.0 2.0 0.0 0.0\n      >>> x = np.arange(10)\n      >>> y = p1(x)\n      >>> yy = np.array([y, y])\n      >>> p2 = models.Polynomial1D(3, n_models=2)\n      >>> pfit = fitting.LinearLSQFitter()\n      >>> new_model = pfit(p2, x, yy)\n      >>> print(new_model)  # doctest: +SKIP\n      Model: Polynomial1D\n      Inputs: 1\n      Outputs: 1\n      Model set size: 2\n      Degree: 3\n      Parameters:\n           c0  c1         c2                 c3\n          --- --- ------------------ -----------------\n          1.0 2.0 -5.86673908219e-16 3.61636197841e-17\n          1.0 2.0 -5.86673908219e-16 3.61636197841e-17\n\n- Iterative fitting with sigma clipping:\n\n.. plot::\n    :include-source:\n\n     import numpy as np\n     from astropy.stats import sigma_clip\n     from astropy.modeling import models, fitting\n     import scipy.stats as stats\n     from matplotlib import pyplot as plt\n\n     # Generate fake data with outliers\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     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     g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.)\n\n     # initialize fitters\n     fit = fitting.LevMarLSQFitter()\n     or_fit = fitting.FittingWithOutlierRemoval(fit, sigma_clip,\n                                                niter=3, sigma=3.0)\n\n     # get fitted model and filtered data\n     filtered_data, or_fitted_model = or_fit(g_init, x, y)\n     fitted_model = fit(g_init, x, y)\n\n     # plot data and fitted models\n     plt.figure(figsize=(8,5))\n     plt.plot(x, y, 'gx', label=\"original data\")\n     plt.plot(x, filtered_data, 'r+', label=\"filtered data\")\n     plt.plot(x, fitted_model(x), 'g-',\n              label=\"model fitted w/ original data\")\n     plt.plot(x, or_fitted_model(x), 'r--',\n              label=\"model fitted w/ filtered data\")\n     plt.legend(loc=2, numpoints=1)\n\n\nFitters support constrained fitting.\n\n- All fitters support fixed (frozen) parameters through the ``fixed`` argument\n  to models or setting the `~astropy.modeling.Parameter.fixed`\n  attribute directly on a parameter.\n\n  For linear fitters, freezing a polynomial coefficient means that the\n  corresponding term will be subtracted from the data before fitting a\n  polynomial without that term to the result. For example, fixing ``c0`` in a\n  polynomial model will fit a polynomial with the zero-th order term missing\n  to the data minus that constant. However, the fixed coefficient value is\n  restored when evaluating the model, to fit the original data values::\n\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      >>> p1.c0.fixed = True\n      >>> pfit = fitting.LinearLSQFitter()\n      >>> new_model = pfit(p1, x, y)\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.0 3.0\n          1.0 2.0 3.0\n\n- A parameter can be `~astropy.modeling.Parameter.tied` (linked to\n  another parameter). This can be done in two ways::\n\n      >>> def tiedfunc(g1):\n      ...    mean = 3 * g1.stddev\n      ...    return mean\n      >>> g1 = models.Gaussian1D(amplitude=10., mean=3, stddev=.5,\n      ...                        tied={'mean': tiedfunc})\n\n  or::\n\n      >>> g1 = models.Gaussian1D(amplitude=10., mean=3, stddev=.5)\n      >>> g1.mean.tied = tiedfunc\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` handles\nbounds internally.\n\n- Different fitters support different types of constraints::\n\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\nPlugin Fitters\n==============\n\n\nFitters defined outside of astropy's core can 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\ndefining entry points can be found in `setuptools' documentation\n<http://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins>`_.\nPlugin fitters are required 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/>`_,\nwhich insert its `SherpaFitter <http://saba.readthedocs.io/en/stable/api.html#saba.SherpaFitter>`_\nclass and thus allows astropy users to use `Sherpa's <http://cxc.cfa.harvard.edu/contrib/sherpa/>`_\nfitting routine.\n"},{"id":275,"name":"bounding-boxes.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _bounding-boxes:\n\nEfficient Model Rendering with Bounding Boxes\n*********************************************\n\n.. versionadded:: 1.1\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 Bounding Box\n=======================\n\nFor basic usage, see `Model.bounding_box\n<astropy.modeling.Model.bounding_box>`.  By default no\n`~astropy.modeling.Model.bounding_box` is set, except on model subclasses where\na ``bounding_box`` property or method is explicitly defined. The default is then\nthe minimum rectangular region symmetric about the position that fully contains\nthe model. If the model does not have a finite extent, the containment criteria\nare noted in the documentation. For example, see ``Gaussian2D.bounding_box``.\n\n`Model.bounding_box <astropy.modeling.Model.bounding_box>` can be set by the\nuser to any callable. This is particularly useful for fitting models created\nwith `~astropy.modeling.custom_model` or as a compound model::\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    ...     @property\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    >>> model = Ellipsoid3D()\n    >>> model.bounding_box\n    ((-4.0, 4.0), (-3.0, 3.0), (-2.0, 2.0))\n\n.. warning::\n\n    Currently when creating a new compound model by combining multiple\n    models, the bounding boxes of the components (if any) are not currently\n    combined.  So 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\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\n<astropy.modeling.Model.render>` method 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('Full Models\\nTiming: {:.2f} seconds'.format(t_full), 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('Bounded Models\\nTiming: {:.2f} seconds'.format(t_bb), 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('Difference Image\\nTotal Flux Err = {:.0e}'.format(\n        ((flux - np.sum(bb_image)) / flux)))\n    plt.xlabel('x')\n    plt.ylabel('y')\n    plt.show()\n"},{"id":276,"name":"units.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _modeling-units:\n\n********************************\nSupport for units and quantities\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\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``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``return_units``\n^^^^^^^^^^^^^^^^\n\nSimilarly to ``return_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\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\nto evaluate even if ``input_units`` specifies that the input should have units.\nIt is up to the :meth:`~astropy.modeling.Model.evaluate` to then decide how to\nhandle these dimensionless values.\n\n\nFitting\n-------\n\nTo allow models with parameters that have units to be fit 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 OrderedDict([('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"},{"id":277,"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. It currently supports 1-D and 2-D models and\n:doc:`fitting <fitting>` with parameter constraints.\n\nIt is designed to be easily extensible and flexible.  Models do not reference\nfitting algorithms explicitly and new fitting algorithms may be added without\nchanging the existing models (though not all models can be used with all\nfitting algorithms due to constraints such as model linearity).\n\nThe goal is to eventually provide a rich toolset of models and fitters such\nthat most users will not need to define new model classes, nor special purpose\nfitting routines (while making it reasonably easy to do when necessary).\n\n.. note::\n\n    `astropy.modeling` is currently a work-in-progress, and thus it is likely\n    there will still be API changes in later versions of Astropy.  Backwards\n    compatibility support between versions will still be maintained as much as\n    possible, but new features and enhancements are coming in future versions.\n    If you have specific ideas for how it might be improved, feel free to let\n    us know on the `astropy-dev mailing list`_ or at\n    http://feedback.astropy.org\n\n.. _modeling-getting-started:\n\nGetting started\n===============\n\nThe examples here use the predefined models and assume the following modules\nhave been imported::\n\n    >>> import numpy as np\n    >>> from astropy.modeling import models, fitting\n\n\nUsing Models\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    >>> 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.\n\nModels can therefore already be useful to evaluate common functions,\nindependently of the fitting features of the package.\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    t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.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\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.simplefilter('ignore')\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\nA list of models is provided in the `Reference/API`_ section. The fitting\nframework includes many useful features that are not demonstrated here, such as\nweighting of datapoints, fixing or linking parameters, and placing lower or\nupper limits on parameters. For more information on these, take a look at the\n:doc:`fitting` documentation.\n\n.. _modeling-getting-started-model-sets:\n\nModel sets\n----------\n\nIn some cases it is necessary 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    >>> 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 value to all models in the set::\n\n    >>> g(0)  # doctest: +FLOAT_CMP\n    array([1., 2.])\n\nModel sets are used primarily for fitting, allowing a large number of models of\nthe same type to be fitted simultaneously (and independently from each other)\nto some large set of inputs.  For example, fitting a polynomial to the time\nresponse of each pixel in a data cube.  This can greatly speed up the fitting\nprocess, especially for linear models.\n\n\n.. _compound-models-intro:\n\nCompound models\n---------------\n.. versionadded:: 1.0\n\n    This feature is experimental and expected to see significant further\n    development, but the basic usage is stable and expected to see wide use.\n\nWhile the Astropy modeling package makes it very easy to define :doc:`new\nmodels <new>` 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.  It is\nalso possible to define entire new model *classes* using arithmetic expressions\nof other model classes.  This allows general compound models to be created\nwithout specifying any parameter values up front.  This more advanced usage is\nexplained in more detail in the :ref:`compound model documentation\n<compound-model-classes>`.\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 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    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.. _modeling-using:\n\nUsing `astropy.modeling`\n========================\n\n.. toctree::\n   :maxdepth: 1\n\n   models\n   parameters\n   fitting\n   compound-models\n   new\n   bounding-boxes\n   algorithms\n   units\n\nReference/API\n=============\n\n.. automodapi:: astropy.modeling\n.. automodapi:: astropy.modeling.functional_models\n.. automodapi:: astropy.modeling.powerlaws\n.. automodapi:: astropy.modeling.blackbody\n.. automodapi:: astropy.modeling.polynomial\n.. automodapi:: astropy.modeling.projections\n.. automodapi:: astropy.modeling.rotations\n.. automodapi:: astropy.modeling.tabular\n.. autoclass::  astropy.modeling.tabular.Tabular1D\n.. autoclass::  astropy.modeling.tabular.Tabular2D\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"},{"id":278,"name":"links.inc","nodeType":"TextFile","path":"docs/modeling","text":".. _Numpy broadcasting rules: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html\n"},{"col":4,"comment":"null","endLoc":347,"header":"def run(self)","id":279,"name":"run","nodeType":"Function","startLoc":292,"text":"def run(self):\n        strategies = ['local_directory', 'local_file', 'index']\n        dist = None\n\n        # First, remove any previously imported versions of astropy_helpers;\n        # this is necessary for nested installs where one package's installer\n        # is installing another package via setuptools.sandbox.run_setup, as in\n        # the case of setup_requires\n        for key in list(sys.modules):\n            try:\n                if key == PACKAGE_NAME or key.startswith(PACKAGE_NAME + '.'):\n                    del sys.modules[key]\n            except AttributeError:\n                # Sometimes mysterious non-string things can turn up in\n                # sys.modules\n                continue\n\n        # Check to see if the path is a submodule\n        self.is_submodule = self._check_submodule()\n\n        for strategy in strategies:\n            method = getattr(self, 'get_{0}_dist'.format(strategy))\n            dist = method()\n            if dist is not None:\n                break\n        else:\n            raise _AHBootstrapSystemExit(\n                \"No source found for the {0!r} package; {0} must be \"\n                \"available and importable as a prerequisite to building \"\n                \"or installing this package.\".format(PACKAGE_NAME))\n\n        # This is a bit hacky, but if astropy_helpers was loaded from a\n        # directory/submodule its Distribution object gets a \"precedence\" of\n        # \"DEVELOP_DIST\".  However, in other cases it gets a precedence of\n        # \"EGG_DIST\".  However, when activing the distribution it will only be\n        # placed early on sys.path if it is treated as an EGG_DIST, so always\n        # do that\n        dist = dist.clone(precedence=pkg_resources.EGG_DIST)\n\n        # Otherwise we found a version of astropy-helpers, so we're done\n        # Just active the found distribution on sys.path--if we did a\n        # download this usually happens automatically but it doesn't hurt to\n        # do it again\n        # Note: Adding the dist to the global working set also activates it\n        # (makes it importable on sys.path) by default.\n\n        try:\n            pkg_resources.working_set.add(dist, replace=True)\n        except TypeError:\n            # Some (much) older versions of setuptools do not have the\n            # replace=True option here.  These versions are old enough that all\n            # bets may be off anyways, but it's easy enough to work around just\n            # in case...\n            if dist.key in pkg_resources.working_set.by_key:\n                del pkg_resources.working_set.by_key[dist.key]\n            pkg_resources.working_set.add(dist)"},{"id":280,"name":"parameters.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n\n.. _modeling-parameters:\n\n**********\nParameters\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 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 provide 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\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"},{"id":281,"name":"new.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _modeling-new-classes:\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.  It can also be used as a normal factory function (for\nexample ``SumOfGaussians = custom_model(sum_of_gaussians)``) rather than as a\ndecorator.  See the `~astropy.modeling.custom_model` documentation for more\nexamples.\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        inputs = ('x',)\n        outputs = ('y',)\n\n        amplitude = Parameter()\n        mean = Parameter()\n        stddev = Parameter()\n\nThe ``inputs`` and ``outputs`` class attributes must be tuples of strings\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 (in this case ``'x'`` and ``'y'`` respectively) are currently used for\ninformational purposes only and have no requirements on them other than that\nthey do not conflict with parameter names.  Outputs may have the same labels as\ninputs (eg. ``inputs = ('x', 'y')`` and ``outputs = ('x', 'y')``).  However,\ninputs must not conflict with each other (eg. ``inputs = ('x', 'x')`` is\nincorrect) and likewise for outputs.  The lengths of these tuples are\nimportant for specifying the correct number of inputs and outputs.  These\nattributes supersede the ``n_inputs`` and ``n_outputs`` attributes in older\nversions of this package.\n\nThere are two helpful base classes in the modeling package that can be used to\navoid specifying ``inputs`` and ``outputs`` for most common models.  These are\n`~astropy.modeling.Fittable1DModel` and `~astropy.modeling.Fittable2DModel`.\nFor example, the real `~astropy.modeling.functional_models.Gaussian1D` model is\nactually a subclass of `~astropy.modeling.Fittable1DModel`.  This helps cut\ndown on boilerplate by not having to specify ``inputs`` and ``outputs`` for\nmany 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((-(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\nNote that we did *not* have to define an ``__init__`` method or a ``__call__``\nmethod for our model (this contrasts with Astropy versions 0.4.x and earlier).\nFor most models the ``__init__`` follows the same pattern, taking the parameter\nvalues as positional arguments, followed by several optional keyword arguments\n(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    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    from astropy.modeling import Fittable1DModel, Parameter\n    import numpy as np\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\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 <http://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":282,"name":"algorithms.rst","nodeType":"TextFile","path":"docs/modeling","text":"**********\nAlgorithms\n**********\n\nUnivariate polynomial evaluation\n================================\n\n* The evaluation of 1-D polynomials uses Horner's algorithm.\n\n* The evaluation of 1-D Chebyshev and Legendre polynomials uses Clenshaw's\n  algorithm.\n\n\nMultivariate polynomial evaluation\n==================================\n\n* Multivariate Polynomials are evaluated following the algorithm in [1]_ .  The\n  algorithm uses the following notation:\n\n  - **multiindex** is a tuple of non-negative integers for which the length is\n    defined in the following way:\n\n    .. math:: \\alpha = (\\alpha1, \\alpha2, \\alpha3),  |\\alpha| = \\alpha1+\\alpha2+\\alpha3\n\n\n  - **inverse lexical order** is the ordering of monomials in such a way that\n    :math:`{x^a < x^b}` if and only if there exists :math:`{1 \\le i \\le n}`\n    such that :math:`{a_n = b_n, \\dots, a_{i+1} = b_{i+1}, a_i < b_i}`.\n\n    In this ordering :math:`y^2 > x^2*y` and :math:`x*y > y`\n\n  - **Multivariate Horner scheme** uses d+1 variables :math:`r_0, ...,r_d` to\n    store intermediate results, where *d* denotes the number of variables.\n\n    Algorithm:\n\n    1. Set *di* to the max number of variables (2 for a 2-D polynomials).\n\n    2. Set :math:`r_0` to :math:`c_{\\alpha(0)}`, where c is a list of\n       coefficients for each multiindex in inverse lexical order.\n\n    3. For each monomial, n, in the polynomial:\n\n       - determine :math:`k = max \\{1 \\leq j \\leq di: \\alpha(n)_j \\neq \\alpha(n-1)_j\\}`\n\n       - Set :math:`r_k := l_k(x)* (r_0 + r_1 + \\dots + r_k)`\n\n       - Set :math:`r_0 = c_{\\alpha(n)}, r_1 = \\dots r_{k-1} = 0.`\n\n    4. return :math:`r_0 + \\dots + r_{di}`\n\n* The evaluation of multivariate Chebyshev and Legendre polynomials uses a\n  variation of the above Horner's scheme, in which every Legendre or Chebyshev\n  function is considered a separate variable.  In this case the length of the\n  :math:`\\alpha` indices tuple is equal to the number of functions in x plus\n  the number of functions in y.  In addition the Chebyshev and Legendre\n  functions are cached for efficiency.\n\n\n\n.. [1] J. M. Pena, Thomas Sauer, \"On the Multivariate Horner Scheme\", SIAM Journal on Numerical Analysis, Vol 37, No. 4\n"},{"id":283,"name":"models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. include:: links.inc\n.. _modeling-instantiating:\n\n***********************************\nInstantiating and Evaluating Models\n***********************************\n\nThe base class of all models is `~astropy.modeling.Model`, however\nfittable models should subclass `~astropy.modeling.FittableModel`.\nFittable models can be linear or nonlinear in a regression analysis sense.\n\nIn general models are instantiated by providing 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 model *set* consisting of a set of parameters\neach representing a different parameterization of the same parametric model.\nFor example one may instantiate a single Gaussian model with one mean, standard\ndeviation, and amplitude.  Or one may create a set of N Gaussians, each one of\nwhich would be fitted to, for example, a different plane in an image cube.\n\nRegardless of whether using a single model, or a model set, parameter values\nmay be scalar values, or arrays of any size and shape, so long as they are\ncompatible according to the standard `Numpy broadcasting rules`_.  For example,\na 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 given parameters fixed.  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 it may use all array parameters.  For example if all parameters are 2x2\narrays the model is computed element-wise using all elements in the arrays::\n\n    >>> g = Gaussian1D(amplitude=[[1, 2], [3, 4]], mean=[[0, 1], [1, 0]],\n    ...                stddev=[[0.1, 0.2], [0.3, 0.4]])\n    >>> g  # doctest: +FLOAT_CMP\n    <Gaussian1D(amplitude=[[1., 2.], [3., 4.]], mean=[[0., 1.], [1., 0.]],\n    stddev=[[0.1, 0.2], [0.3, 0.4]])>\n    >>> g(0)  # doctest: +FLOAT_CMP\n    array([[1.00000000e+00, 7.45330634e-06],\n           [1.15977604e-02, 4.00000000e+00]])\n\nOr it may even use a mix of scalar values and arrays of different sizes and\ndimensions so long as they are compatible::\n\n    >>> g = Gaussian1D(amplitude=[[1, 2], [3, 4]], mean=0.1, stddev=[0.1, 0.2])\n    >>> g(0)  # doctest: +FLOAT_CMP\n    array([[0.60653066, 1.76499381],\n           [1.81959198, 3.52998761]])\n\nIn this case, four values are computed--one using each element of the amplitude\narray.  Each model uses a mean of 0.1, and a standard deviation of 0.1 is\nused with the amplitudes of 1 and 3, and 0.2 is used with amplitudes 2 and 4.\n\nIf any of the parameters have incompatible values this will result in an\nerror::\n\n    >>> g = Gaussian1D(amplitude=1, mean=[1, 2], stddev=[1, 2, 3])  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    InputParameterError: Parameter 'mean' of shape (2,) cannot be broadcast\n    with parameter 'stddev' of shape (3,).  All parameter arrays must have\n    shapes that are mutually compatible according to the broadcasting rules.\n\n.. _modeling-model-sets:\n\nModel Sets\n==========\n\nBy default, `~astropy.modeling.Model` instances represent a single model.\nThere are two ways, when instantiating a `~astropy.modeling.Model` instance, to\ncreate a model set instead.  The first is to specify the ``n_models`` argument\nwhen instantiating the model::\n\n    >>> g = Gaussian1D(amplitude=[1, 2], mean=[0, 0], stddev=[0.1, 0.2],\n    ...                n_models=2)\n    >>> g  # doctest: +FLOAT_CMP\n    <Gaussian1D(amplitude=[1., 2.], mean=[0., 0.], stddev=[0.1, 0.2],\n    n_models=2)>\n\nWhen specifying some ``n_models=N`` this requires that the parameter values be\narrays of some kind, the first *axis* of which has as length of ``N``.  This\naxis is referred to as the ``model_set_axis``, and by default is is the ``0th``\naxis of parameter arrays.  In this case the parameters were given as 1-D arrays\nof length 2.  The values ``amplitude=1, mean=0, stddev=0.1`` are the parameters\nfor the first model in the set.  The values ``amplitude=2, mean=0, stddev=0.2``\nare the parameters defining the second model in the set.\n\nThis has different semantics from simply using array values for the parameters,\nin that ensures that parameter values and input values are matched up according\nto the model_set_axis before any other array broadcasting rules are applied.\n\nFor example, in the previous section we created a model with array values\nlike::\n\n    >>> g = Gaussian1D(amplitude=[[1, 2], [3, 4]], mean=0.1, stddev=[0.1, 0.2])\n\nIf instead we treat the rows as values for two different model sets, this\nparticular instantiation will fail, since only one value is given for mean::\n\n    >>> g = Gaussian1D(amplitude=[[1, 2], [3, 4]], mean=0.1, stddev=[0.1, 0.2],\n    ...                n_models=2)  # doctest: +IGNORE_EXCEPTION_DETAIL\n    Traceback (most recent call last):\n    ...\n    InputParameterError: All parameter values must be arrays of dimension at\n    least 1 for model_set_axis=0 (the value given for 'mean' is only\n    0-dimensional)\n\nTo get around this for now, provide two values for mean::\n\n    >>> g = Gaussian1D(amplitude=[[1, 2], [3, 4]], mean=[0.1, 0.1],\n    ...                stddev=[0.1, 0.2], n_models=2)\n\nThis is different from the case without ``n_models=2``.  It does not mean that\nthe value of amplitude is a 2x2 array.  Rather, it means there are *two* values\nfor amplitude (one for each model in the set), each of which is 1-D array of\nlength 2.  The value for the first model is ``[1, 2]``, and the value for the\nsecond model is ``[3, 4]``.  Likewise, scalar values are given for the mean and\nstandard deviation of each model in the set.\n\nWhen evaluating this model on a single input we get a different result from the\nsingle-model case::\n\n    >>> g(0)  # doctest: +FLOAT_CMP\n    array([[0.60653066, 1.21306132],\n           [2.64749071, 3.52998761]])\n\nEach row in this output is the output for each model in the set.  The first is\nthe value of the Gaussian with ``amplitude=[1, 2], mean=0.1, stddev=0.1``, and\nthe second is the value of the Gaussian with ``amplitude=[3, 4], mean=0.1,\nstddev=0.2``.\n\nWe can also pass a different input to each model in a model set by passing in\nan array input::\n\n    >>> g([0, 1])  # doctest: +FLOAT_CMP\n    array([[6.06530660e-01, 1.21306132e+00],\n           [1.20195892e-04, 1.60261190e-04]])\n\nBy default this uses the same concept of a ``model_set_axis``.  The first\ndimension of the input array is used to map inputs to corresponding models in\nthe model set.  We can use this, for example, to evaluate the model on 1-D\narray inputs with a different input to each model set::\n\n    >>> g([[0, 1], [2, 3]])  # doctest: +FLOAT_CMP\n    array([[6.06530660e-01, 5.15351422e-18],\n           [7.57849134e-20, 8.84815213e-46]])\n\nIn this case the first model is evaluated on ``[0, 1]``, and the second model\nis evaluated on ``[2, 3]``.  If the input has length greater than the number of\nmodels in the set then this is in error::\n\n    >>> g([0, 1, 2])\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\nAnd input like ``[0, 1, 2]`` wouldn't work anyways because it is not compatible\nwith the array dimensions of the parameter values.  However, what if we wanted\nto evaluate all models in the set on the input ``[0, 1]``?  We could do this\nby simply repeating::\n\n    >>> g([[0, 1], [0, 1]])  # doctest: +FLOAT_CMP\n    array([[6.06530660e-01, 5.15351422e-18],\n           [2.64749071e+00, 1.60261190e-04]])\n\nBut there is a workaround for this use case that does not necessitate\nduplication.  This is to include the argument ``model_set_axis=False``::\n\n    >>> g([0, 1], model_set_axis=False)  # doctest: +FLOAT_CMP\n    array([[6.06530660e-01, 5.15351422e-18],\n           [2.64749071e+00, 1.60261190e-04]])\n\nWhat ``model_set_axis=False`` implies is that an array-like input should not be\ntreated as though any of its dimensions map to models in a model set.  And\nrather, the given input should be used to evaluate all the models in the model\nset.  For scalar inputs like ``g(0)``, ``model_set_axis=False`` is implied\nautomatically.  But for array inputs it is necessary to avoid ambiguity.\n\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 a polynomial.  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: An analytical inverse transform has not been\n    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\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 `GWCS <https://gwcs.readthedocs.io/en/latest/>`_,\ncan be more flexible and take advantage of separable spectral and spatial transforms.\n\n\nFurther examples\n================\n\nThe examples here assume this import statement was executed::\n\n    >>> from astropy.modeling.models import Gaussian1D, Polynomial1D\n    >>> import numpy as np\n\n- Create a model set of two 1-D Gaussians::\n\n      >>> x = np.arange(1, 10, .1)\n      >>> g1 = Gaussian1D(amplitude=[10, 9], mean=[2, 3],\n      ...                 stddev=[0.15, .1], n_models=2)\n      >>> print(g1)\n      Model: Gaussian1D\n      Inputs: ('x',)\n      Outputs: ('y',)\n      Model set size: 2\n      Parameters:\n          amplitude mean stddev\n          --------- ---- ------\n               10.0  2.0   0.15\n                9.0  3.0    0.1\n\n  Evaluate all models in the set on one set of input coordinates::\n\n      >>> y = g1(x, model_set_axis=False)  # broadcast the array to all models\n      >>> y.shape\n      (2, 90)\n\n  or different inputs for each model in the set::\n\n      >>> y = g1([x, x + 3])\n      >>> y.shape\n      (2, 90)\n\n.. plot::\n\n   import matplotlib.pyplot as plt\n   import numpy as np\n   from astropy.modeling import models, fitting\n   x = np.arange(1, 10, .1)\n   g1 = models.Gaussian1D(amplitude=[10, 9], mean=[2,3], stddev=[.15,.1],\n                          n_models=2)\n   y = g1(x, model_set_axis=False)\n   plt.figure(figsize=(8, 4))\n   plt.plot(x, y.T)\n   plt.title('Evaluate two Gaussian1D models on 1 set of input data')\n   plt.show()\n\n.. plot::\n\n   import matplotlib.pyplot as plt\n   import numpy as np\n   from astropy.modeling import models, fitting\n   x = np.arange(1, 10, .1)\n   g1 = models.Gaussian1D(amplitude=[10, 9], mean=[2,3], stddev=[.15,.1],\n                          n_models=2)\n   y = g1([x, x - 3])\n   plt.figure(figsize=(8, 4))\n   plt.plot(x, y[0])\n   plt.plot(x - 3, y[1])\n   plt.title('Evaluate two Gaussian1D models with 2 sets of input data')\n   plt.show()\n\n\n- Evaluating a set of multiple polynomial models with one input data set\n  creates multiple output data sets::\n\n      >>> p1 = Polynomial1D(degree=1, n_models=5)\n      >>> p1.c1 = [0, 1, 2, 3, 4]\n      >>> print(p1)\n      Model: Polynomial1D\n      Inputs: ('x',)\n      Outputs: ('y',)\n      Model set size: 5\n      Degree: 1\n      Parameters:\n           c0  c1\n          --- ---\n          0.0 0.0\n          0.0 1.0\n          0.0 2.0\n          0.0 3.0\n          0.0 4.0\n      >>> y = p1(x, model_set_axis=False)\n\n\n.. plot::\n\n   import matplotlib.pyplot as plt\n   import numpy as np\n   from astropy.modeling import models, fitting\n   x = np.arange(1, 10, .1)\n   p1 = models.Polynomial1D(1, n_models=5)\n   p1.c1 = [0, 1, 2, 3, 4]\n   y = p1(x, model_set_axis=False)\n   plt.figure(figsize=(8, 4))\n   plt.plot(x, y.T)\n   plt.title(\"Polynomial1D with a 5 model set on the same input\")\n   plt.show()\n\n- When passed a 2-D array, the same polynomial will map each row of the array\n  to one model in the set, one for one::\n\n      >>> x = np.arange(30).reshape(5, 6)\n      >>> y = p1(x)\n      >>> y  # doctest: +FLOAT_CMP\n      array([[  0.,   0.,   0.,   0.,   0.,   0.],\n             [  6.,   7.,   8.,   9.,  10.,  11.],\n             [ 24.,  26.,  28.,  30.,  32.,  34.],\n             [ 54.,  57.,  60.,  63.,  66.,  69.],\n             [ 96., 100., 104., 108., 112., 116.]])\n      >>> y.shape\n      (5, 6)\n"},{"id":284,"name":"compound-models.rst","nodeType":"TextFile","path":"docs/modeling","text":".. _compound-models:\n\nCompound Models\n***************\n\n.. versionadded:: 1.0\n\nAs noted in the :ref:`introduction to the modeling package\n<compound-models-intro>`, it is now possible to create new models just by\ncombining existing models using the arithmetic operators ``+``, ``-``, ``*``,\n``/``, and ``**``, as well as by model composition using ``|`` and\nconcatenation (explained below) with ``&``.\n\n\nSome terminology\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      Inputs: ('x',)\n      Outputs: ('y',)\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 models--\n  be they model *instances* or *classes*, and can be models that come with\n  Astropy, :doc:`user defined models <new>`, or other compound models--using\n  Python expressions consisting of one or more of the supported binary\n  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\nAs discussed in the :ref:`introduction to compound models\n<compound-models-intro>`, the only way, currently, 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.  The operands\nused in these expressions may be model *classes*, or model *instances*.  In\nother words, any object for which either ``isinstance(obj, Model)`` or\n``issubclass(obj, Model)`` is `True`.\n\n\n.. _compound-model-classes:\n\nCompound model classes\n----------------------\n\nWe start by demonstrating how new compound model *classes* can be created\nby combining other classes.  This is more advanced usage, but it's useful to\nunderstand that this is what's going on under the hood in the more basic usage\nof :ref:`compound model instances <compound-model-instances>`.\n\nWhen all models involved in the expression are classes, the result of the\nexpression is, itself, a class (remember, classes in Python are themselves also\nobjects just like strings and integers or model instances)::\n\n    >>> TwoGaussians = Gaussian1D + Gaussian1D\n    >>> from astropy.modeling import Model\n    >>> isinstance(TwoGaussians, Model)\n    False\n    >>> issubclass(TwoGaussians, Model)\n    True\n\nWhen we inspect the variable ``TwoGaussians`` by printing its representation at\nthe command prompt we can get some more information about it::\n\n    >>> TwoGaussians\n    <class '__main__.CompoundModel...'>\n    Name: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude_0', 'mean_0', 'stddev_0', 'amplitude_1', 'mean_1', 'stddev_1')\n    Expression: [0] + [1]\n    Components:\n        [0]: <class 'astropy.modeling.functional_models.Gaussian1D'>\n        Name: Gaussian1D\n        Inputs: ('x',)\n        Outputs: ('y',)\n        Fittable parameters: ('amplitude', 'mean', 'stddev')\n    <BLANKLINE>\n        [1]: <class 'astropy.modeling.functional_models.Gaussian1D'>\n        Name: Gaussian1D\n        Inputs: ('x',)\n        Outputs: ('y',)\n        Fittable parameters: ('amplitude', 'mean', 'stddev')\n\nThere are a number of things to point out here:  This model class 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` class).\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    >>> FourGaussians = TwoGaussians + TwoGaussians\n    >>> FourGaussians\n    <class '__main__.CompoundModel...'>\n    Name: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude_0', 'mean_0', 'stddev_0', ..., 'amplitude_3', 'mean_3', 'stddev_3')\n    Expression: [0] + [1] + [2] + [3]\n    Components:\n        [0]: <class 'astropy.modeling.functional_models.Gaussian1D'>\n        Name: Gaussian1D\n        Inputs: ('x',)\n        Outputs: ('y',)\n        Fittable parameters: ('amplitude', 'mean', 'stddev')\n        ...\n        [3]: <class 'astropy.modeling.functional_models.Gaussian1D'>\n        Name: Gaussian1D\n        Inputs: ('x',)\n        Outputs: ('y',)\n        Fittable parameters: ('amplitude', 'mean', 'stddev')\n\nIn a future version it may be possible to \"freeze\" a compound model, so that\nfrom the user's perspective it is treated as a single model.  However, as this\nis the default behavior it is good to be aware of.\n\nOne is also able to get the number of components (also known as submodels) in\na compound model by accessing the method ``n_submodels``::\n\n    >>> FourGaussians.n_submodels()\n    4\n\n\nModel names\n-----------\n\nIn the last 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.  It may be possible in the future to work around this in limited cases,\nbut for now there are a couple workarounds for creating compound model classes\nwith friendlier names.  The first is to use the\n`Model.rename <astropy.modeling.Model.rename>` class method on the result of\nthe model expression::\n\n    >>> TwoGaussians = (Gaussian1D + Gaussian1D).rename('TwoGaussians')\n    >>> TwoGaussians\n    <class '__main__.TwoGaussians'>\n    Name: TwoGaussians (CompoundModel...)\n    ...\n\nThis actually takes the generated compound model and creates a light subclass\nof it with the desired name.  This does not impose any additional overhead.  An\nalternative syntax, which is equivalent to what\n`~astropy.modeling.Model.rename` is doing, is to directly use the model\nexpression as the base class of a new class::\n\n    >>> class TwoGaussians(Gaussian1D + Gaussian1D):\n    ...     \"\"\"A superposition of two Gaussians.\"\"\"\n    ...\n    >>> TwoGaussians\n    <class '__main__.TwoGaussians'>\n    Name: TwoGaussians (CompoundModel...)\n    ...\n\nBecause the result of the expression ``Gaussian1D + Gaussian1D`` *is* a class,\nit can be used directly in the standard class declaration syntax\n``class ClassName(Base):`` as the base.  This syntax also has the advantage of\nallowing a docstring to be assigned to the new class.  In future versions it\nmay be possible to customize other aspects of compound model classes in this\nway.  Single model classes can also be given custom names by using\n`~astropy.modeling.Model.rename`, and model instances can be given names as\nwell.  This can be used to good effect, for example as shown in the section on\n:ref:`compound-model-indexing`.\n\n\n.. _compound-model-instances:\n\nCompound models with model instances\n------------------------------------\n\nSo far we have seen how to create compound model *classes* from expressions\ninvolving other model classes.  This is the most \"generic\" way to create new\nmodels from existing models.  However, many may find it more useful most of the\ntime, especially when providing an initial guess to a fitter, to create a new\nmodel from a combination of model *instances* with already defined parameter\nvalues.  This can also be done and works mostly the same way::\n\n    >>> both_gaussians = Gaussian1D(1, 0, 0.2) + Gaussian1D(2.5, 0.5, 0.1)\n    >>> both_gaussians  # doctest: +FLOAT_CMP\n    <CompoundModel...(amplitude_0=1.0, mean_0=0.0, stddev_0=0.2, amplitude_1=2.5, mean_1=0.5, stddev_1=0.1)>\n\nUnlike when a model was created from model classes, this expression does not\ndirectly return a new class; instead it creates a model instance that is ready\nto be used for evaluation::\n\n    >>> both_gaussians(0.2)  # doctest: +FLOAT_CMP\n    0.6343031510582392\n\nIn this case it is possible to directly assign a name to the compound model instance\nby using the `Model.name <astropy.modeling.Model.name>` attribute.\n\n    >>> both_gaussians.name = \"BothGaussians\"\n    >>> print(both_gaussians)  # doctest: +SKIP\n    Model: CompoundModel6\n    Name: BothGaussians\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Model set size: 1\n    Expression: [0] + [1]\n    Components:\n        [0]: <Gaussian1D(amplitude=1.0, mean=0.0, stddev=0.2)>\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.0    0.0      0.2         2.5    0.5      0.1\n\nThis was found to be much more convenient and natural, in this case, than\nreturning a class.  It is worth understanding that the way this works under the\nhood is to create the compound class, and then immediately instantiate it with\nthe already known parameter values.  We can see this by checking the type of\n``both_gaussians``::\n\n    >>> type(both_gaussians)  # doctest: +FLOAT_CMP\n    <class '__main__.CompoundModel...'>\n    Name: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude_0', 'mean_0', 'stddev_0', 'amplitude_1', 'mean_1', 'stddev_1')\n    Expression: [0] + [1]\n    Components:\n        [0]: <Gaussian1D(amplitude=1., mean=0., stddev=0.2)>\n    <BLANKLINE>\n        [1]: <Gaussian1D(amplitude=2.5, mean=0.5, stddev=0.1)>\n\nIt is also possible, and sometimes useful, to make a compound model from a\ncombination of classes *and* instances in the same expression::\n\n    >>> from astropy.modeling.models import Linear1D, Sine1D\n    >>> MyModel = Linear1D + Sine1D(amplitude=1, frequency=1, phase=0)\n    >>> MyModel  # doctest: +FLOAT_CMP\n    <class '__main__.CompoundModel...'>\n    Name: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('slope_0', 'intercept_0', 'amplitude_1', 'frequency_1', 'phase_1')\n    Expression: [0] + [1]\n    Components:\n        [0]: <class 'astropy.modeling.functional_models.Linear1D'>\n        Name: Linear1D\n        Inputs: ('x',)\n        Outputs: ('y',)\n        Fittable parameters: ('slope', 'intercept')\n    <BLANKLINE>\n        [1]: <Sine1D(amplitude=1., frequency=1., phase=0.)>\n\nIn this case the result is always a class.  However (and this is not\nimmediately obvious by the representation) the difference is that the\n``amplitude`` and ``frequency`` parameters for the\n`~astropy.modeling.functional_models.Sine1D` part of the model are\n\"baked into\" the class as default values for those parameters.  So it is\npossible to instantiate one of these models by specifying just the ``slope``\nand ``intercept`` parameters for the\n`~astropy.modeling.functional_models.Linear1D` part of the model::\n\n    >>> my_model = MyModel(1, 0)\n    >>> my_model(0.25)  # doctest: +FLOAT_CMP\n    1.25\n\nThis does not prevent the other parameters from being overridden, however::\n\n    >>> my_model = MyModel(slope_0=1, intercept_0=0, frequency_1=2)\n    >>> my_model(0.125)  # doctest: +FLOAT_CMP\n    1.125\n\nIn fact, this is currently the only way to use a `polynomial\n<astropy.modeling.polynomial>` model in a compound model, because the design of\nthe polynomial models is currently such that they must be instantiated in order\nto specify their polynomial degree.  Because the polynomials are already\ndesigned so that their coefficients all default to zero, this \"limitation\"\nshould not have any practical drawbacks.\n\n.. note::\n\n    There is currently a caveat in the example of combining model classes and\n    instances, which is that the parameter values of model *instances* are only\n    treated as defaults if the expression is written in such a way that all\n    model instances are to the right of all model classes.  This limitation\n    will be lifted in a later version--in particular, Python 3 offers a lot\n    more flexibility with respect to how function arguments are handled.\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    class RedshiftedGaussian(RedshiftScaleFactor | Gaussian1D(1, 0.75, 0.1)):\n        \"\"\"Evaluates a Gaussian with optional redshift applied to the input.\"\"\"\n\n    x = np.linspace(0, 1.2, 100)\n    g0 = RedshiftedGaussian(z_0=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        g = RedshiftedGaussian(z_0=z)\n        plt.plot(x, g(x), color=plt.cm.OrRd(z),\n                 label='$z={0}$'.format(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='$z={0}$'.format(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    class RotatedGaussian(Rotation2D | Gaussian2D(1, 0, 0, 0.1, 0.3)):\n        \"\"\"A Gaussian2D composed with a coordinate rotation.\"\"\"\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 = RotatedGaussian(theta)\n        plt.subplot(1, 3, idx + 1)\n        plt.imshow(g(x, y), origin='lower')\n        plt.xticks([])\n        plt.yticks([])\n        plt.title('Rotated $ {0}^\\circ $'.format(theta))\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\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.rename('A')\n    >>> B = Const1D.rename('B')\n    >>> C = Const1D.rename('C')\n    >>> M = A + B * C\n    >>> M\n    <class '__main__.CompoundModel...'>\n    Name: CompoundModel...\n    ...\n    Expression: [0] + [1] * [2]\n    Components:\n        [0]: <class '__main__.A'>\n        Name: A (Const1D)\n        ...\n    <BLANKLINE>\n        [1]: <class '__main__.B'>\n        Name: B (Const1D)\n        ...\n    <BLANKLINE>\n        [2]: <class '__main__.C'>\n        Name: C (Const1D)\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    <class '__main__.B'>\n    Name: B (Const1D)\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude',)\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    >>> M[1:]\n    <class 'astropy.modeling.utils.CompoundModel...'>\n    Name: CompoundModel...\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude_1', 'amplitude_2')\n    Expression: [0] * [1]\n    Components:\n        [0]: <class '__main__.B'>\n        Name: B (Const1D)\n        ...\n    <BLANKLINE>\n        [1]: <class '__main__.C'>\n        Name: C (Const1D)\n        ...\n\nThe new compound model for the subexpression can be instantiated and evaluated\nlike any other::\n\n    >>> m = M[1:](2, 3)\n    >>> m  # doctest: +FLOAT_CMP\n    <CompoundModel...(amplitude_1=2., amplitude_2=3.)>\n    >>> m(0)\n    6.0\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    >>> M['B']\n    <class '__main__.B'>\n    Name: B (Const1D)\n    Inputs: ('x',)\n    Outputs: ('y',)\n    Fittable parameters: ('amplitude',)\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.  This may improve in a future release.\n\nSlicing also works with names.  When using names the start and end points are\n*both inclusive*::\n\n    >>> M['B':'C']\n    <class 'astropy.modeling.utils.CompoundModel...'>\n    ...\n    Expression: [0] * [1]\n    Components:\n        [0]: <class '__main__.B'>\n        Name: B (Const1D)\n        ...\n    <BLANKLINE>\n        [1]: <class '__main__.C'>\n        Name: C (Const1D)\n        ...\n\nSo in this case ``M['B':'C']`` is equivalent to ``M[1:3]``.\n\nAll of the above applies equally well to compound models composed of model\ninstances.  Individual model instances can be given a name by passing in the\n``name=`` argument when instantiating them.  These names are used in the same was\nas class names were in the class-based examples::\n\n    >>> a = Const1D(amplitude=1, name='A')\n    >>> b = Const1D(amplitude=2, name='B')\n    >>> c = Const1D(amplitude=3, name='C')\n    >>> m = a + b * c\n\nBecause this model is composed entirely of constants it doesn't matter what\ninput we pass in, so 0 is used without loss of generality::\n\n    >>> m(0)\n    7.0\n    >>> m[1:](0)  # b * c\n    6.0\n    >>> m['A':'B'](0)  # a + b\n    3.0\n    >>> m['B':'C'](0)  # b * c, again\n    6.0\n\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.amplitude_0\n    Parameter('amplitude_0', 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_0', value=99.0)\n\nNote, however, that the original\n`~astropy.modeling.functional_models.Gaussian1D` instance ``a`` has not been\nupdated::\n\n    >>> a.amplitude\n    Parameter('amplitude', value=1.0)\n\nThis is because currently, when a compound model is created, copies are made of\nthe original models.\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            out2 [shape=\"none\", label=\"output 2\"];\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        poly2 -> out1;\n        gaussian0 -> out2;\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"},{"id":285,"name":"docs/whatsnew","nodeType":"Package"},{"id":286,"name":"3.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-3.0:\n\n**************************\nWhat's New in Astropy 3.0?\n**************************\n\nOverview\n========\n\nAstropy 3.0 is a major release that adds significant new functionality since\nthe 2.0.x series of releases. It is the first version that supports only\nPython 3.\n\nIn particular, this release includes:\n\n* :ref:`whatsnew-3.0-python3`\n\nIn addition to these major changes, Astropy 3.0 includes a large number of\nsmaller improvements and bug fixes, which are described in the\n:ref:`changelog`. By the numbers:\n\n* xxx issues have been closed since v2.0\n* xxx pull requests have been merged since v2.0\n* xxx distinct people have contributed code\n\n.. _whatsnew-3.0-python3:\n\nSupporting only Python 3\n========================\n\nThis version removed all Python 2.x compatibility code.\n\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v3.0, including changes in\nAPI, please see the :ref:`changelog`.\n\n\nRenamed/removed functionality\n=============================\n\npytest plugins\n**************\n\nThe following ``pytest`` plugins were previously provided as part of the\nAstropy core package but have now been moved to separate packages:\n\n* `pytest-remotedata <https://github.com/astropy/pytest-remotedata>`__\n* `pytest-doctestplus <https://github.com/astropy/pytest-doctestplus>`__\n* `pytest-openfiles <https://github.com/astropy/pytest-openfiles>`__\n\nAffiliated packages that make use of one or more of these plugins may install\nthem individually using ``pip``, or they may install the Astropy testing\npackage ``pytest-astropy``, which includes all of these plugins as\ndependencies. Packages that use Astropy's test runner will also need to install\n``pytest-astropy``. See :ref:`testing-dependencies` for more details.\n\nThe ``config`` and ``display`` plugins are still provided as part of the\nAstropy core package, but they have moved from ``astropy.tests.pytest_plugins``\nto ``astropy.tests.plugins.config`` and ``astropy.tests.plugins.display``,\nrespectively.\n\nAffiliated packages that currently access plugin decorators and other variables\nfrom ``astropy.tests.pytest_plugins`` will need to make updates, although\nbackwards compatibility will be maintained in the meantime.\n\nBelow is an outline of the required changes:\n\n* Affiliated packages that use the ``remote_data`` decorator to mark tests that\n  require remote data access should now mark them with\n  ``@pytest.mark.remote_data``. This requires installing either\n  ``pytest-remotedata`` or ``pytest-astropy``. Importing ``remote_data`` from\n  ``astropy.tests.helper`` is maintained for backwards compatibility but will\n  eventually be removed.\n* Packages should no longer import ``disable_internet`` from ``astropy.tests``.\n  It is available using ``from pytest_remotedata import disable_internet`` if\n  required, but developers should consider whether they can avoid importing it\n  directly by instead using ``@pytest.mark.remote_data`` and\n  ``@pytest.mark.internet_off`` provided by ``pytest-remotedata``.  Use of\n  ``disable_internet.INTERNET_OFF`` is not recommended and should be replaced\n  by use of ``remote_data`` and ``internet_off``.\n* Packages that access the display configuration variables\n  ``PYTEST_HEADER_MODULES`` and ``TESTED_VERSIONS`` should no longer import\n  them from ``astropy.tests.pytest_plugins``. They should instead be imported\n  from ``astropy.tests.plugins.display``. We hope that eventually these will be\n  configurable using ``setup.cfg`` instead.\n* The function ``enable_deprecations_as_exceptions`` should not be imported\n  from ``astropy.tests.pytest_plugins``. It should be imported from\n  ``astropy.tests.helper`` instead.\n"},{"id":287,"name":"1.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-1.2:\n\n**************************\nWhat's New in Astropy 1.2?\n**************************\n\nOverview\n========\n\nAstropy 1.2 is a major release that adds significant new functionality since\nthe 1.1.x series of releases.\n\nIn particular, this release includes:\n\n* A new class to compute :ref:`Lomb-Scargle periodograms\n  <whatsnew-1.2-lombscargle>` efficiently using different methods.\n* A number of :ref:`new statistics functions <whatsnew-1.2-stats>`, including\n  for Jackknife resampling, circular statistics, and for the Akaike and\n  Bayesian information criteria.\n* Support for getting the :ref:`positions of solar system bodies\n  <whatsnew-1.2-solarsystem>` in the :ref:`coordinates <astropy-coordinates>` sub-package.\n* The ability to compute Barycentric and Heliocentric :ref:`light-travel time\n  corrections <whatsnew-1.2-barycentric>`.\n* Support for :ref:`offset coordinate frames <whatsnew-1.2-skyoffset>`, which\n  can be used to define a coordinate system relative to a known position.\n* An implementation of the :ref:`zscale algorithm <whatsnew-1.2-zscale>` to\n  determine image limits automatically.\n* Support for :ref:`bolometric magnitudes <whatsnew-1.2-magnitudes>` in the\n  units package.\n* Improvements to the :ref:`NDData class and subclasses <whatsnew-1.2-nddata>`.\n* :ref:`Auto-downloading of IERS tables <whatsnew-1.2-iers>` as needed, which\n  gives information about Earth orientation parameters necessary for high\n  precision coordinate calculations and conversions to/from the UT1 scale.\n\nIn addition to these major changes, Astropy 1.2 includes a large number of\nsmaller improvements and bug fixes, which are described in the\n:ref:`changelog`. By the numbers:\n\n* 615 issues have been closed since v1.1\n* 313 pull requests have been merged since v1.1\n* 191 distinct people have contributed code\n\n.. _whatsnew-1.2-lombscargle:\n\nLomb-scargle periodograms\n=========================\nThe new :class:`~astropy.stats.LombScargle` class implements a fast Lomb-Scargle\nperiodogram, useful for detecting periodic signals in noisy, unevenly-spaced\ndata. For example, here is an irregular sinusoidal signal:\n\n>>> import numpy as np\n>>> rand = np.random.RandomState(42)\n>>> t = 100 * rand.rand(100)\n>>> dy = 0.1\n>>> y = np.sin(2 * np.pi * t) + dy * rand.randn(100)\n\nGiven this data, we can compute the Lomb-Scargle periodogram and find the\nfrequency at which the power is maximized:\n\n>>> from astropy.stats import LombScargle\n>>> frequency, power = LombScargle(t, y, dy).autopower()\n>>> frequency[np.argmax(power)]\n0.99962825294969382\n\nThe maximum is very near the input frequency of 1.0 cycles per unit time.\n\nAs a more realistic example, here is a periodogram computed for six\nmonths of nightly observations of a simulated RR-Lyrae-type variable\n(this particular example is discussed more fully in\n:ref:`lomb-scargle-example`):\n\n.. plot::\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    plt.style.use('ggplot')\n\n    from astropy.stats 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.RandomState(rseed)\n        t = phase + np.arange(N, dtype=float)\n        t += 0.1 * rand.randn(N)\n        dmag = 0.01 + 0.03 * rand.rand(N)\n\n        omega = 2 * np.pi / period\n        n = np.arange(1 + len(coeffs) // 2)[:, None]\n\n        mag = (15 + dmag * rand.randn(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    freq, PLS = LombScargle(t, mag, dmag).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 = LombScargle(t, mag, dmag).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 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\nFor more information on astropy's Lomb-Scargle functionality,\nsee :ref:`stats-lombscargle`.\n\n.. _whatsnew-1.2-stats:\n\nOther new statistics features\n=============================\n\nThe **Jackknife resampling method** is available via the\n:func:`~astropy.stats.jackknife_resampling` function. Jackknife resampling\ngenerates n deterministic samples of size n-1 from a measured sample of size n.\nThose samples can then be used for various statistics estimation such as\nvariance and bias using the :func:`~astropy.stats.jackknife_stats` function.\n  \n**Circular statistics** (circular mean, variance, etc) are now provided by the\n:func:`~astropy.stats.circmean`, :func:`~astropy.stats.circvar`, ,\n:func:`~astropy.stats.circmoment`, and :func:`~astropy.stats.circcorrcoef`\nfunctions. in. The API basically follows the same conventions of R CircStats\npackage. In addition, the circular stats are compatible with the\n:class:`~astropy.units.Quantity` class.\n\nThe **Akaike and Bayesian information criteria** are now implemented in\n:func:`~astropy.stats.akaike_info_criterion`,\n:func:`~astropy.stats.akaike_info_criterion_lsq`,\n:func:`~astropy.stats.bayesian_info_criterion`, and\n:func:`~astropy.stats.bayesian_info_criterion_lsq`. Basically, these\ninformation criteria are used to decided whether increasing the number of\nparameters in a model truly improves the fitting. Conversely, they are also\nused to verify whether improvements in fitting are due to the increasing of the\nnumber of parameters.\n\n.. _whatsnew-1.2-solarsystem:\n\nSolar system ephemerides\n========================\n\nIt is now possible to calculate the positions of the major solar system bodies\n(as well as the moon) in the :ref:`coordinates <astropy-coordinates>`\nsub-package. These integrate fully all the coordinate frames, allowing easy\nconversion to apparent (e.g. ``AltAz``) positions or barycentric values. The\npositions can be calculated using either using built-in approximations or more\nprecise values that depend on downloading JPL-provided ephemeris models derived\nfrom n-body simulations (the latter requires the additional dependency of the\n`jplephem <https://pypi.python.org/pypi/jplephem>`_ package). For more details,\nsee :ref:`astropy-coordinates-solarsystem`.\n\n.. _whatsnew-1.2-barycentric:\n\nBarycentric light-travel time corrections\n=========================================\n\nThe :class:`~astropy.time.Time` class has gained a new method\n:meth:`~astropy.time.Time.light_travel_time` for calculating barycentric\n(or heliocentric) corrections. For more details, see\n:ref:`time-light-travel-time`.\n\n.. _whatsnew-1.2-skyoffset:\n\nSky offset coordinate frames\n============================\n\nThe :ref:`coordinates <astropy-coordinates>` sub-package now includes support\nfor coordinate frames that are rotated in the sky to be centered on a\nparticular object. This sort of frame is variously known as \"FOV coordinates\",\n\"offset coordinates\", or \"astrometric\". It makes it easier to compute offsets\nfrom a particular reference object, and define coordinate frames that for\nheirarchical systems like groups or clusters of galaxies. It also enables the\nnew :meth:`~astropy.coordinates.SkyCoord.spherical_offsets_to` method. For more\ndetails, see :ref:`astropy-skyoffset-frames`.\n\n.. _whatsnew-1.2-zscale:\n\nZscale implementation\n=====================\n\nThe `zscale <http://iraf.net/forum/viewtopic.php?showtopic=134139>`_ algorithm\nfrom IRAF is now included in Astropy's :ref:`visualization\n<astropy-visualization>` sub-package, and available as\na `~astropy.visualization.ZScaleInterval` interval class. The implementation is\nbased on `Numdisplay’s <http://stsdas.stsci.edu/numdisplay/>`_ one, slightly\nmodified to expose more arguments and work with data with any number of\ndimensions.\n\n.. _whatsnew-1.2-examples:\n\nNew example gallery\n===================\n\nThe Astropy documentation now contains an\n`example gallery <../generated/examples/index.html>`_ that highlights key\nfunctionality of the package in short snippets of code with descriptive text.\nThe examples are meant to demonstrate the functionality and interoperability of\nthe subpackages in shorter-form worked examples. Longer form tutorials are still\nmaintained at `<http://tutorials.astropy.org/>`_.\n\n.. _whatsnew-1.2-magnitudes:\n\nApparent/absolute bolometric magnitudes and other new units\n===========================================================\n\nThe :ref:`units <astropy-units>` sub-package now supports bolometric magnitudes, based on the\nbolometric flux and luminosity scales adopted in IAU 2015 resolution B2.\n\nFurthermore, Earth and Jupiter radii have been made available as units.\n\n.. _whatsnew-1.2-nddata:\n\nNDData improvements\n===================\n\nArithmetic and uncertainty handling have been enhanced for astropy 1.2, and a\nnew class, :class:`~astropy.nddata.NDDataRef`, has been added that should be\nthe starting point for new users of `astropy.nddata`. One can now do arithmetic\nbetween an :class:`~astropy.nddata.NDDataRef` object and a scalar, an\n:class:`~astropy.units.Quantity` or another :class:`~astropy.nddata.NDDataRef`\nobject (or any class that implements the nddata interface). Limited support for\npropagating correlated errors was added to\n:class:`~astropy.nddata.StdDevUncertainty`.\n\nSeveral internal changes were made to the classes in the nddata package to\nmake writing custom classes that implement the nddata interface more\nstraightforward.\n\n.. _whatsnew-1.2-iers:\n\nAutomatic updates to IERS Earth rotation data\n=============================================\n\nThe `astropy.utils.iers` sub-package provides access to the tables provided by\nthe International Earth Rotation and Reference Systems (IERS) service.  These\nare used in the :ref:`time <astropy-time>` sub-package to transform to/from UT1\nvalues and for determining Earth orientation for celestial-to-terrestrial\ncoordinate transformations (in the :ref:`coordinates <astropy-coordinates>`\nsub-package).\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.\n\nFor details see the `astropy.utils.iers` sub-package documentation.\n\nOther significant changes\n=========================\n\nAstropy now requires Numpy 1.7.0 or later.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v1.2, including changes in\nAPI, please see the :ref:`changelog`.\n"},{"id":288,"name":"2.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-2.0:\n\n**************************\nWhat's New in Astropy 2.0?\n**************************\n\nOverview\n========\n\nAstropy 2.0 is a major release that adds significant new functionality since\nthe 1.3.x series of releases.\n\nOn this page, you can read about some of the big changes in this release:\n\n* :ref:`whatsnew-2.0-models-units`\n* :ref:`whatsnew-2.0-ccddata-class`\n* :ref:`whatsnew-2.0-coordinates-velocities`\n* :ref:`whatsnew-2.0-stats`\n* :ref:`whatsnew-2.0-table-uni-sandwich`\n* :ref:`whatsnew-2.0-bintablehdu-from_table`\n* :ref:`whatsnew-2.0-fits-printdiff`\n* :ref:`whatsnew-2.0-molar-mass`\n* :ref:`whatsnew-2.0-ascii-ecsv-mixins`\n* :ref:`whatsnew-2.0-convolution`\n* :ref:`whatsnew-2.0-cosmo-def`\n* :ref:`whatsnew-2.0-renamed-removed`\n\nIn addition to these major changes, Astropy 2.0 includes a large number of\nsmaller improvements and bug fixes, which are described in the :ref:`changelog`.\nBy the numbers:\n\n\n* 701 issues have been closed since v1.3\n* 319 pull requests have been merged since v1.3\n* 232 distinct people have contributed code\n\n.. _whatsnew-2.0-models-units:\n\nNew unit support for most models\n================================\n\nMost Astropy models now can handle inputs with units, and produce the\nappropriate outputs with units as well. Some models cannot support this due\nto their definitions (e.g., Legendre, Hermite, etc), while some will have\nthis capability added in a future release. Example usage::\n\n    >>> from astropy import units as u\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> g = Gaussian1D(amplitude=1*u.J, mean=1*u.m, stddev=0.1*u.m)\n    >>> g([3, 4, 5.5] * u.cm)\n    <Quantity [  3.70353198e-21,  9.72098502e-21,  4.05703276e-20] J>\n\nFor more information, see :ref:`modeling-units`.\n\n.. _whatsnew-2.0-ccddata-class:\n\nNew image class CCDData added\n=============================\n\nA new class, :class:`~astropy.nddata.CCDData`, has been added to the\n`astropy.nddata` package. It can read from/write to FITS files, provides methods\nfor arithmetic operations with propagation of uncertainty, and support for\nbinary masks. For examples of how to use this class, see the\n:ref:`astropy_nddata_getting_started` section of the :ref:`astropy.nddata\n<astropy_nddata>` documentation.\n\n.. _whatsnew-2.0-coordinates-velocities:\n\nExperimental velocity support in ``astropy.coordinates``\n========================================================\n\nAstropy coordinate frame objects now contains experimental support for storing\nand transforming velocities. This includes, among other things, support for\ntransforming proper motion components between coordinate frames and transforming\nfull-space velocities to/from a local standard of rest (``LSR``) frame and a\n:class:`~astropy.coordinates.Galactocentric` frame. For example, to transform a\nset of proper motions from the :class:`~astropy.coordinates.Galactic` frame to\nthe :class:`~astropy.coordinates.ICRS` frame::\n\n    >>> from astropy.coordinates import Galactic, ICRS\n    >>> gal = Galactic(l=8.67*u.degree, b=53.09*u.degree,\n    ...                pm_l_cosb=-117*u.mas/u.yr, pm_b=13*u.mas/u.yr)\n    >>> gal.transform_to(ICRS)\n    <ICRS Coordinate: (ra, dec) in deg\n        ( 226.45743375,  8.3354549)\n     (pm_ra_cosdec, pm_dec) in mas / yr\n        (-77.61973364, -88.50523685)>\n\nOr, for example, to transform a 3D velocity from the\n:class:`~astropy.coordinates.ICRS` frame to a Galactocentric frame with custom\nvalues for the sun-galactic center distance and solar velocity vector::\n\n    >>> icrs = ICRS(ra=11.23*u.degree, dec=58.13*u.degree,\n    ...             distance=213.4*u.pc,\n    ...             pm_ra_cosdec=9*u.mas/u.yr, pm_dec=3*u.mas/u.yr,\n    ...             radial_velocity=-61*u.km/u.s)\n    >>> v_sun = coord.CartesianDifferential([10, 244, 7.])*u.km/u.s\n    >>> gc = icrs.transform_to(coord.Galactocentric(galcen_distance=8*u.kpc,\n                                                    galcen_v_sun=v_sun))\n    >>> gc.x, gc.y, gc.z\n    (<Quantity -8112.928728515727 pc>,\n     <Quantity 180.22175948399217 pc>,\n     <Quantity 9.781203623025618 pc>)\n    >>> gc.v_x, gc.v_y, gc.v_z\n    (<Quantity 34.40211035247248 km / s>,\n     <Quantity 187.80653073084486 km / s>,\n     <Quantity 14.74171285614737 km / s>)\n\nThe velocity support works by adding support for \"differential\" objects which\ncontain differences of representations. For more details, see\n:ref:`astropy-coordinates-velocities`. This functionality will likely be added\nto the :class:`~astropy.coordinates.SkyCoord` class in future.\n\nIn addition, the :class:`~astropy.coordinates.SkyCoord` class now has a\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` method which can be\nused to compute heliocentric and barycentric corrections for radial velocity\nmeasurements.  While in the future this may use the mechanisms described above,\ncurrently it uses a simpler algorithm for numerical stability. A simple example\nof using this functionality might be::\n\n    >>> from astropy.coordinates import SkyCoord, EarthLocation\n    >>> from astropy.time import Time\n    >>> obstime = Time('2017-2-14')\n    >>> target = SkyCoord.from_name('M31')\n    >>> keck = EarthLocation.of_site('Keck')\n    >>> target.radial_velocity_correction(obstime=obstime, location=keck).to('km/s')\n    <Quantity -22.363056056262263 km / s>\n\n\n\n\n.. _whatsnew-2.0-stats:\n\nNew functionality in astropy.stats\n==================================\n\nNew sigma-clipping class\n------------------------\n\nA new :class:`~astropy.stats.SigmaClip` class has been added as an\nobject-oriented interface for sigma clipping::\n\n    >>> from astropy.stats import SigmaClip\n    >>> data = [1, 5, 6, 8, 100, 5, 3, 2]\n    >>> sigclip = SigmaClip(sigma=2, iters=5)\n    >>> print(sigclip)  # doctest: +SKIP\n    <SigmaClip>\n        sigma: 3\n        sigma_lower: None\n        sigma_upper: None\n        iters: 10\n        cenfunc: <function median at 0x108dbde18>\n        stdfunc: <function std at 0x103ab52f0>\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\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\nNew robust statistical functions\n--------------------------------\n\nNew :func:`~astropy.stats.biweight_midcovariance` and\n:func:`~astropy.stats.biweight_midcorrelation` functions were added to\n`astropy.stats`. The :func:`~astropy.stats.biweight_midcovariance` function\ncomputes the robust covariance between two or more variables, and\n:func:`~astropy.stats.biweight_midcorrelation` computes a robust\nmeasure of similarity between two variables.\n\nFor example::\n\n    >>> import numpy as np\n    >>> from astropy.stats import biweight_midcovariance\n    >>> from astropy.stats import biweight_midcorrelation\n    >>> # Generate two random variables x and y\n    >>> rng = np.random.RandomState(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.82483155 -0.18961219]\n     [-0.18961219 9.80265764]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))  # doctest: +FLOAT_CMP\n    [ 0.90820237  3.13091961]\n    >>> # Compute the biweight midcorrelation between x and y\n    >>> print(biweight_midcorrelation(x, y))  # doctest: +FLOAT_CMP\n    -0.066682472486875297\n\nNew statistical estimators for Ripley's K Function\n--------------------------------------------------\n\nNew statistical estimators for Ripley's K Function,\n:class:`~astropy.stats.RipleysKEstimator`, in `astropy.stats`. For example:\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    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    r = np.linspace(0, 2.5, 100)\n    plt.plot(r, Kest.poisson(r), label='poisson')\n    plt.plot(r, Kest(data=z, radii=r, mode='none'), label='none')\n    plt.plot(r, Kest(data=z, radii=r, mode='translation'), label='translation')\n    plt.plot(r, Kest(data=z, radii=r, mode='ohser'), label='ohser')\n    plt.plot(r, Kest(data=z, radii=r, mode='var-width'), label='var-width')\n    plt.plot(r, Kest(data=z, radii=r, mode='ripley'), label='ripley')\n    plt.legend(loc='upper left')\n\n.. _whatsnew-2.0-table-uni-sandwich:\n\nEasier use of efficient bytestring Table columns in Python 3\n============================================================\n\nWorking with bytestring Table columns (numpy ``'S'`` dtype) in Python\n3 has been made more convenient because it is now possible to compare\nand set array elements with the natural Python string (`str`) type.\nPreviously one had to use the Python `bytes` type and bytestring literals\nlike ``b'hello'``.  This change allows working with ASCII data columns\nin Python 3 using only 1-byte per character instead of the default\n4-bytes per character for the numpy ``'U'`` unicode dtype.  For large\ndatasets this improves memory performance.\n\nPlease see :ref:`bytestring-columns-python-3` for details.  Note that no\nchange has been made to behavior for Python 2.\n\n.. note::\n\n     This introduces an API change that affects comparison of\n     bytestring column elements in Python 3.\n\n     If comparison with `str` instead of `bytes` is a problem\n     (and `bytes` is really more logical), please open an issue\n     on GitHub.\n\n.. _whatsnew-2.0-bintablehdu-from_table:\n\nNew way to instantiate a BinTableHDU directly from a Table\n==========================================================\n\nA new way to instantiate a FITS :class:`~astropy.io.fits.BinTableHDU` directly\nfrom a :class:`~astropy.table.Table` object. For example::\n\n    >>> from astropy.io import fits\n    >>> from astropy.table import Table\n    >>> tab = Table([[1, 2, 3], ['a', 'b', 'c'], [2.3, 4.5, 6.7]],\n    ...             names=['a', 'b', 'c'], dtype=['i', 'U1', 'f'])\n    >>> hdu = fits.BinTableHDU(tab)\n\n.. _whatsnew-2.0-fits-printdiff:\n\nNew ``printdiff`` convenience function for FITS\n===============================================\n\nA new :func:`~astropy.io.fits.printdiff` convenience function was added for\ncomparison between FITS files or HDUs. For example::\n\n    >>> from astropy.io import fits\n    >>> hdu1 = fits.ImageHDU([1, 2, 3])\n    >>> hdu2 = fits.ImageHDU([1, 2.1, 3])\n    >>> fits.printdiff(hdu1, hdu2)\n\n    Headers contain differences:\n      Keyword BITPIX   has different values:\n         a> 64\n         b> -64\n          ? +\n\n    Data contains differences:\n      Data differs at [2]:\n           (int64) a> 2\n         (float64) b> 2.1000000000000001\n      1 different pixels found (33.33% different).\n\n.. _whatsnew-2.0-molar-mass:\n\nNew ``molar_mass_amu`` unit equivalency\n=======================================\n\nA new equivalency named :class:`~astropy.units.molar_mass_amu` has been added to\nconvert between ``g/mol`` unit to atomic mass unit (amu). For example::\n\n    >>> from astropy import constants as const\n    >>> from astropy import units as u\n    >>> x = 1 * (u.g / u.mol)\n    >>> y = 1 * u.u\n    >>> x.to(u.u, equivalencies=u.molar_mass_amu())\n    <Quantity 1.0 u>\n    >>> y.to(u.g/u.mol, equivalencies=u.molar_mass_amu())\n    <Quantity 1.0 g / mol>\n\n.. _whatsnew-2.0-ascii-ecsv-mixins:\n\nStore astropy core object types in ASCII ECSV table file\n========================================================\n\nIt is now possible to store the following :ref:`mixin column\n<mixin_columns>` types in an ASCII :ref:`ECSV\n<ecsv_format>` table file:\n:class:`~astropy.time.Time`,\n:class:`~astropy.time.TimeDelta`,\n:class:`~astropy.units.Quantity`,\n:class:`~astropy.coordinates.Latitude`,\n:class:`~astropy.coordinates.Longitude`,\n:class:`~astropy.coordinates.Angle`,\n:class:`~astropy.coordinates.Distance`,\n:class:`~astropy.coordinates.EarthLocation`,\n:class:`~astropy.coordinates.SkyCoord`. The table file can then be read back\ninto astropy with no loss of object data or attributes.\n\n.. _whatsnew-2.0-convolution:\n\nImprovements to astropy.convolution\n===================================\n\nConvolution has undergone a significant overhaul to make fft and direct\nconvolution consistent.  They keyword arguments have changed and the behavior\nof `~astropy.convolution.convolve` is no longer the same as in versions prior to\n2.0 (although `~astropy.convolution.convolve_fft`'s behavior remains unchanged).\nThe details are given on the :ref:`astropy convolution <astropy_convolve>`.\n\n.. _whatsnew-2.0-cosmo-def:\n\nNo relativistic species by default in cosmological models\n=========================================================\n\nFor all of the built in cosmological model types (e.g.,\n:class:`~astropy.cosmology.FlatLambdaCDM`) the default CMB temperature at z=0 is\nnow 0K, which corresponds to no contributions from photons or neutrinos (massive\nor otherwise).  This does not affect built in literature models (such as the\nWMAP or Planck models).  The justification is to avoid including mass-energy\ncomponents that the user has not explicitly requested.  This is a non-backwards\ncompatible change, although the effects are small for most use cases.\n\n.. _whatsnew-2.0-renamed-removed:\n\nRenamed/removed functionality\n=============================\n\nSeveral sub-packages have been moved or removed, and these are described in the\nfollowing sections.\n\nastropy.tests.helper.pytest\n---------------------------\n\nThe bundled version of ``pytest`` has now been removed, but the\n``astropy.tests.helper.pytest`` import will continue to work properly.\nAffiliated packages should nevertheless transition to importing ``pytest``\ndirectly rather than from ``astropy.tests.helper``. This also means that\n``pytest`` is now a formal requirement for testing for both Astropy and for\naffiliated packages.\n\nastropy.vo.conesearch\n---------------------\n\nThe cone search module has been moved to `Astroquery\n<http://astroquery.readthedocs.io>`_ (0.3.5 and later) and will be removed from\nAstropy in a future version. The API here will be preserved as the \"classic\" API\nin Astroquery, however some configuration behavior might change; See the\nAstroquery `documentation\n<http://astroquery.readthedocs.io/en/latest/vo_conesearch/vo_conesearch.html>`_\nfor new usage details.\n\nastropy.vo.samp\n---------------\n\nThe SAMP (Simple Application Messaging Protocol) module, formerly available in\n``astropy.vo.samp``, has now been moved to `astropy.samp`, so you should\nupdate any imports to this module.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v2.0, including changes in\nAPI, please see the :ref:`changelog`.\n"},{"id":289,"name":"0.2.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. _whatsnew-0.2:\n\n*************************\nWhat's New in Astropy 0.2\n*************************\n\nSee this page in the `Astropy v0.2 documentation`__.\n\n__ http://docs.astropy.org/en/v0.2.5/whatsnew/0.2.html\n"},{"id":290,"name":"1.0.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-1.0:\n\n**************************\nWhat's New in Astropy 1.0?\n**************************\n\nOverview\n========\n\nAstropy 1.0 is a major release that adds significant new functionality since the 0.4.x series of releases.\n\nIn particular, coordinate conversions to/from Altitude/Azimuth are now\nsupported (see `Support for Alt/Az coordinates`_), a new package to help with\ndata visualization has been added (see :ref:`whatsnew_viz`), and a new package\nfor common analytic functions is now also included (see\n:ref:`whatsnew_analytical_functions`).\n\nThe :ref:`io-ascii` sub-package now includes fast C-based\nreaders/writers for common formats, and also supports a new ASCII format that\nbetter preserves meta-data (see :ref:`whatsnew_io_ascii`), the modeling package\nhas been significantly improved and now supports composite models (see\n:ref:`whatsnew_modeling`), and the :class:`~astropy.table.Table` class can now\ninclude :class:`~astropy.coordinates.SkyCoord` and :class:`~astropy.time.Time`\nobjects containing arrays (see :ref:`whatsnew_table`).\n\nIn addition to these major changes, Astropy 1.0 includes a large number of\nsmaller improvements and bug fixes, which are described in the :ref:`changelog`.\nBy the numbers:\n\n* 681 issues have been closed since v0.4\n* 419 pull requests have been merged since v0.4\n* 122 distinct people have contributed code\n\nAbout Long-term support\n=======================\n\nAstropy v1.0 is a long-term support (LTS) release.  This means v1.0 will\nbe supported with bug fixes for 2 years from its release, rather than 6\nmonths like the non-LTS releases. More details about this, including a\nwider rationale for Astropy's version numbering scheme, can be found in\n`Astropy Proposal for Enhancement 2  <https://github.com/astropy/astropy-APEs/blob/master/APE2.rst>`_.\n\nNote that different sub-packages in Astropy have different stability levels. See\nthe :doc:`/stability` page for an overview of the status of major components.\nLTS can be expected for anything with green or blue (stable or mature) status on\nthat page.  For yellow (in development) subpackages, LTS *may* be provided, but\nmajor changes may prevent backporting of complex changes, particularly if they\nare connected to new features.\n\nSupport for Alt/Az coordinates\n==============================\n\nThe `~astropy.coordinates` package now supports conversion to/from AltAz\ncoordinates.  This means `~astropy.coordinates` can now be used for planning\nobservations.  For example::\n\n    >>> from astropy import units as u\n    >>> from astropy.time import Time\n    >>> from astropy.coordinates import SkyCoord, EarthLocation, AltAz\n    >>> greenwich = EarthLocation(lat=51.477*u.deg,lon=0*u.deg)\n    >>> albireo = SkyCoord('19h30m43.2805s +27d57m34.8483s')\n    >>> altaz = albireo.transform_to(AltAz(location=greenwich, obstime=Time('2014-6-21 0:00')))\n    >>> print altaz.alt, altaz.az\n    60d32m28.4576s 133d45m36.4967s\n\nFor a more detailed outline of this new functionality, see the\n:ref:`sphx_glr_generated_examples_coordinates_plot_obs-planning.py` and the\n`~astropy.coordinates.AltAz` documentation.\n\nTo enable this functionality, `~astropy.coordinates` now also contains\nthe full IAU-sanctioned coordinate transformation stack from ICRS to AltAz.\nTo view the full set of coordinate frames now available, see the coordinates\n:ref:`astropy-coordinates-api`.\n\n\nNew Galactocentric coordinate frame\n===================================\n\nAdded a new, customizable :class:`~astropy.coordinates.Galactocentric`\ncoordinate frame. The other coordinate frames (e.g.,\n:class:`~astropy.coordinates.ICRS`, :class:`~astropy.coordinates.Galactic`)\nare all Heliocentric (or barycentric). The center of this new coordinate frame\nis at the center of the Galaxy, with customizable parameters allowing the user\nto specify the distance to the Galactic center (``galcen_distance``), the\nICRS position of the Galactic center (``galcen_ra``, ``galcen_dec``), the\nheight of the Sun above the Galactic midplane (``z_sun``), and a final roll\nangle that allows for specifying the orientation of the z axis (``roll``)::\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord, Galactocentric\n    >>> c = SkyCoord(ra=152.718 * u.degree,\n    ...              dec=-11.214 * u.degree,\n    ...              distance=21.5 * u.kpc)\n    >>> c.transform_to(Galactocentric)\n    <SkyCoord (Galactocentric: galcen_distance=8.3 kpc, galcen_ra=266d24m18.36s, galcen_dec=-28d56m10.23s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc\n        (-13.6512648452, -16.6847348677, 12.4862582821)>\n    >>> c.transform_to(Galactocentric(galcen_distance=8*u.kpc, z_sun=15*u.pc))\n    <SkyCoord (Galactocentric: galcen_distance=8.0 kpc, galcen_ra=266d24m18.36s, galcen_dec=-28d56m10.23s, z_sun=15.0 pc, roll=0.0 deg): (x, y, z) in kpc\n        (-13.368458678, -16.6847348677, 12.466872262)>\n\n.. _whatsnew_viz:\n\nNew data visualization subpackage\n=================================\n\nThe new :ref:`Data Visualization <astropy-visualization>` package is intended\nto collect functionality that can be helpful when visualizing data. At the\nmoment, the main functionality is image normalizing (including both scaling and\nstretching) but this will be expanded in future. Included in the image\nnormalization functionality is the ability to compute interval limits on data,\n(such as percentile limits), stretching with non-linear functions (such as\nsquare root or arcsinh functions), and the ability to use custom stretches in\n`Matplotlib <http://matplotlib.org/>`_ that are correctly reflected in the\ncolorbar:\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 SqrtStretch\n    from astropy.visualization.mpl_normalize import ImageNormalize\n\n    # Generate test image\n    image = np.arange(65536).reshape((256, 256))\n\n    # Create normalizer object\n    norm = ImageNormalize(vmin=0., vmax=65536, stretch=SqrtStretch())\n\n    fig = plt.figure(figsize=(6,3))\n    ax = fig.add_subplot(1,1,1)\n    im = ax.imshow(image, norm=norm, origin='lower', aspect='auto')\n    fig.colorbar(im)\n\n.. _whatsnew_analytical_functions:\n\nNew analytic functions subpackage\n=================================\n\nThis subpackage provides analytic functions that are commonly used in\nastronomy. These already understand `~astropy.units.Quantity`, i.e., they can\nhandle units of input and output parameters. For instance, to calculate the\nblackbody flux for 10000K at 6000 Angstrom::\n\n    >>> from astropy import units as u\n    >>> from astropy.analytic_functions import blackbody_lambda, blackbody_nu\n    >>> blackbody_lambda(6000 * u.AA, 10000 * u.K)\n    <Quantity 15315791.836941158 erg / (Angstrom cm2 s sr)>\n    >>> blackbody_nu(6000 * u.AA, 10000 * u.K)\n    <Quantity 0.00018391673686797075 erg / (cm2 Hz s sr)\n\nSee ``astropy.analytic_functions`` documentation for more details.\n\nIn future versions of Astropy, the functions in this module might also be\naccessible as `~astropy.modeling.Model` classes.\n\n.. _whatsnew_io_ascii:\n\nNew ASCII features\n==================\n\nFast readers/writers for ASCII files\n------------------------------------\n\nThe :mod:`astropy.io.ascii` module now includes a significantly faster Cython/C engine\nfor reading and writing ASCII files.  This is available for the following\nformats: ``basic``, ``commented_header``, ``csv``, ``no_header``, ``rdb``, and\n``tab``.  On average the new engine is about 4 to 5 times faster than the\ncorresponding pure-Python implementation, and is often comparable to the speed\nof the `pandas <http://pandas.pydata.org/pandas-docs/stable/>`_ ASCII file\ninterface (`read_csv\n<http://pandas.pydata.org/pandas-docs/stable/io.html#io-read-csv-table>`_ and\n`to_csv\n<http://pandas.pydata.org/pandas-docs/stable/io.html#io-store-in-csv>`_).  The\nfast reader has parallel processing option that allows harnessing multiple\ncores for input parsing to achieve even greater speed gains.\n\nBy default, :func:`~astropy.io.ascii.read` and :func:`~astropy.io.ascii.write`\nwill attempt to use the fast C engine when dealing with compatible formats.\nCertain features of the full read / write interface are not available in the\nfast version, in which case the pure-Python version will automatically be used.\n\nFor full details including extensive performance testing, see :ref:`fast_ascii_io`.\n\nEnhanced CSV format\n-------------------\n\nOne of the problems when storing a table in an ASCII format is preserving table\nmeta-data such as comments, keywords and column data types, units, and\ndescriptions.  Using the newly defined `Enhanced Character Separated Values\nformat <https://github.com/astropy/astropy-APEs/blob/master/APE6.rst>`_ it is\nnow possible to write a table to an ASCII-format file and read it back with no\nloss of information.  The ECSV format has been designed to be both\nhuman-readable and compatible with most simple CSV readers.\n\nIn the example below we show writing a table that has ``float32`` and ``bool``\ntypes.  This illustrates the simple look of the format which has a few header\nlines (starting with ``#``) in `YAML <http://www.yaml.org/>`_ format and then\nthe data values in CSV format.\n::\n\n  >>> t = Table()\n  >>> t['x'] = Column([1.0, 2.0], unit='m', dtype='float32')\n  >>> t['y'] = Column([False, True], dtype='bool')\n\n  >>> from astropy.extern.six.moves import StringIO\n  >>> fh = StringIO()\n  >>> t.write(fh, format='ascii.ecsv')  # doctest: +SKIP\n  >>> table_string = fh.getvalue()      # doctest: +SKIP\n  >>> print(table_string)               # doctest: +SKIP\n  # %ECSV 0.9\n  # ---\n  # columns:\n  # - {name: x, unit: m, type: float32}\n  # - {name: y, type: bool}\n  x y\n  1.0 False\n  2.0 True\n\nWithout the header this table would get read back with different types\n(``float64`` and ``string`` respectively) and no unit values.  Instead with\nthe automatically-detected ECSV we get::\n\n  >>> Table.read(table_string, format='ascii')  # doctest: +SKIP\n  <Table masked=False length=2>\n     x      y\n     m\n  float32  bool\n  ------- -----\n      1.0 False\n      2.0  True\n\nNote that using the ECSV reader requires the `PyYAML <http://pyyaml.org>`_\npackage to be installed.\n\n.. _whatsnew_modeling:\n\nNew modeling features\n=====================\n\nNew subclasses of `~astropy.modeling.Model` are now a bit easier to define,\nrequiring less boilerplate code in general.  Now all that is necessary to\ndefine a new model class is an `~astropy.modeling.Model.evaluate` method that\ncomputes the model.  Optionally one can define :ref:`fittable parameters\n<modeling-parameters>`, a `~astropy.modeling.FittableModel.fit_deriv`, and/or\nan `~astropy.modeling.Model.inverse`.  The new, improved\n`~astropy.modeling.custom_model` decorator reduces the boilerplate needed for\nmany models even more.  See :ref:`modeling-new-classes` for more details.\n\nArray broadcasting has also been improved, enabling a broader range of\npossibilities for the values of model parameters and inputs.  Support has also\nbeen improved for :ref:`modeling-model-sets` (previously referred to as\nparameter sets) which can be thought of like an array of models of the same\nclass, each with different sets of parameters, which can be fitted\nsimultaneously either to the same data, or to different data sets per model.\nSee :ref:`modeling-instantiating` for more details.\n\nIt is now possible to create *compound* models by combining existing models\nusing the standard arithmetic operators such as ``+`` and ``*``, as well as\nfunctional composition using the ``|`` operator.  This provides a powerful\nand flexible new way to create more complex models without having to define\nany special classes or functions.  For example::\n\n    >>> from astropy.modeling.models import Gaussian1D\n    >>> gaussian1 = Gaussian1D(1, 0, 0.2)\n    >>> gaussian2 = Gaussian1D(2.5, 0.5, 0.1)\n    >>> sum_of_gaussians = gaussian1 + gaussian2\n\nThe resulting model works like any other model, and also works with the\nfitting framework.  See the\n:ref:`introduction to compound models <compound-models-intro>` and full\n:ref:`compound models documentation <compound-models>` for more examples.\n\n.. _whatsnew_table:\n\nNew Table features\n==================\n\n.. |Quantity| replace:: :class:`~astropy.units.Quantity`\n.. |Time| replace:: :class:`~astropy.time.Time`\n.. |SkyCoord| replace:: :class:`~astropy.coordinates.SkyCoord`\n.. |Table| replace:: :class:`~astropy.table.Table`\n.. |Column| replace:: :class:`~astropy.table.Column`\n.. |QTable| replace:: :class:`~astropy.table.QTable`\n\nRefactor of table infrastructure\n--------------------------------\n\nThe underlying data container for the Astropy |Table| object has been changed\nin Astropy v1.0.  Previously, tables were stored internally as a Numpy structured\narray object, with column access being a memory view of the corresponding Numpy\narray field.  Starting with this release the fundamental data container is an\nordered dictionary of individual column objects and each |Column| object is the\nsole owner of its data.\n\nThe biggest impact to users is that operations such as adding or removing\ntable columns is now significantly faster because there is no structured array\nto rebuild each time.\n\nFor details please see `Table implementation change in 1.0\n<https://astropy.readthedocs.io/en/v1.0/table/implementation_change_1.0.html>`_.\n\nSupport for 'mixin' columns\n---------------------------\n\nVersion v1.0 of Astropy introduces a new concept of the \"Mixin\nColumn\" in tables which allows integration of appropriate non-|Column| based\nclass objects within a |Table| object.  These mixin column objects are not\nconverted in any way but are used natively.\n\nThe available built-in mixin column classes are |Quantity|, |SkyCoord|, and\n|Time|.  User classes for array-like objects that support the\n:ref:`mixin_protocol` can also be used in tables as mixin columns.\n\n.. Warning::\n\n   While the Astropy developers are excited about this new capability and\n   intend to improve it, the interface for using mixin columns is not stable at\n   this point and it is not recommended for use in production code.\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| object::\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\n  array([ 51911.52425926,  51943.00071759])\n\nFor all the details, including a new |QTable| class, please see :ref:`mixin_columns`.\n\nIntegration with WCSAxes\n========================\n\nThe :class:`~astropy.wcs.WCS` class can now be used as a `Matplotlib\n<http://matplotlib.org/>`_ projection to make plots of images with WCS\ncoordinates overlaid, making use of the `WCSAxes\n<http://wcsaxes.readthedocs.io>`_ affiliated package behind the scenes. More\ninformation on using this functionality can be found in the `WCSAxes\n<http://wcsaxes.readthedocs.io>`_ documentation.\n\nDeprecation and backward-incompatible changes\n=============================================\n\nAstropy is now no longer supported on Python 3.1 and 3.2. Python 3.x users\nshould use Python 3.3 or 3.4. In addition, support for Numpy 1.5 has been\ndropped, and users should make sure they are using Numpy 1.6 or later.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v1.0, including changes in API,\nplease see the :ref:`changelog`.\n"},{"id":291,"name":"1.3.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-1.3:\n\n**************************\nWhat's New in Astropy 1.3?\n**************************\n\nOverview\n========\n\nAstropy 1.3 is a major release that adds significant new functionality since\nthe 1.2.x series of releases.\n\nIn particular, this release includes:\n\n* The :ref:`WCSAxes framework <whatsnew-1.3-wcsaxes>` for plotting points or\n  images on celestial coordinates in matplotlib.\n* A :ref:`new function <whatsnew-1.3-rgb>` in ``astropy.visualization`` to\n  generate 3-color images from astronomy images in different bands.\n* Astropy coordinate representations\n  :ref:`now combine like vectors <whatsnew-1.3-representation-arithmetic>`,\n  with useful mathematical operations that can be performed on them.\n* Astropy coordinates and time objects now\n  :ref:`behave much more consistently like arrays <whatsnew-1.3-instance-shapes>`\n  when they are reshaped.\n* Earth locations can now\n  :ref:`be created from a postal address <whatsnew-1.3-of-address>`.\n* JPL Ephemerides :ref:`can now be used <whatsnew-1.3-jpl-ephemerides>` in the\n  coordinates sub-package to improve the accuracy of coordinate transformations\n  and barycentric time corrections.\n* A significant\n  :ref:`change in the default behavior <whatsnew-1.3-tablechange>` of astropy\n  tables when setting to an already-existing column.\n* FORTRAN-style extended floating precision files like ``1.495D+238``\n  :ref:`can now be read <whatsnew-1.3-fortan-exponents>` using\n  ``astropy.io.ascii`` or ``Table.read``.\n* Astropy objects can now be serialized to (or re-loaded from)\n  :ref:`a standard YAML representation <whatsnew-1.3-yaml-serialization>`.\n* FITS HDUs can now be :ref:`lazy loaded<whatsnew-1.3-lazy-loading-fits>`,\n  improving performance in files with many HDUs.\n* The default cosmology is now :ref:`Planck 2015 <whatsnew-1.3-cosmo>`.\n* Coordinate frames with ``obsgeoloc`` and ``obsgeovel`` attributes\n  :ref:`now contain representations rather than quantities <whatsnew-1.3-gcrs-repr>`.\n\n\nIn addition to these major changes, Astropy 1.3 includes a large number of\nsmaller improvements and bug fixes, which are described in the\n:ref:`changelog`. By the numbers:\n\n* 467 issues have been closed since v1.2\n* 242 pull requests have been merged since v1.2\n* 210 distinct people have contributed code\n\n.. _whatsnew-1.3-wcsaxes:\n\nNew WCSAxes framework to make plots with celestial coordinates\n==============================================================\n\nThe :ref:`visualization <astropy-visualization>` subpackage now include the\nWCSAxes framework (previously distributed as a separate package) which makes it\npossible to make plots in Matplotlib with celestial coordinates on the axes.\nExamples and documentation are provided in :ref:`wcsaxes`.\n\n.. plot::\n   :context: reset\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    ax = plt.subplot(projection=wcs)\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\n.. _whatsnew-1.3-rgb:\n\nNew function to construct RGB images based on Lupton et al. (2004) algorithm\n============================================================================\n\nThe :ref:`visualization <astropy-visualization>` subpackage now includes a\nfunction to create RGB composite images from individual (high dynamic range)\nimages.  The technique is detailed in `Lupton et al. (2004)`_ and implemented in `~astropy.visualization.make_lupton_rgb`. For more details, see\n:ref:`astropy-visualization-rgb`.\n\n\n.. We use raw here because image directives pointing to external locations fail for some sphinx versions\n.. raw:: html\n\n    <a class=\"reference internal image-reference\" href=\"http://data.astropy.org/visualization/ngc6976.jpeg\"><img alt=\"lupton RGB image\" src=\"http://data.astropy.org/visualization/ngc6976-small.jpeg\" /></a>\n\n.. _whatsnew-1.3-representation-arithmetic:\n\nVector arithmetic using representations\n=======================================\n\n:ref:`Representations <astropy-coordinates-representations>` are used inside\ncoordinates as vectors to points on the sky, but they can more generally be\nseen as vectors in any frame from the origin to a given point. In the latter\ncontext, basic arithmetic such as addition and subtraction of vectors,\nmultiplication or division with a constant, or taking the norm, are all well\ndefined, and thus :ref:`have been implemented\n<astropy-coordinates-representations-arithmetic>`.\n\n.. _whatsnew-1.3-instance-shapes:\n\nTimes and coordinates can now be reshaped like arrays\n=====================================================\n\nThe shapes of :class:`~astropy.time.Time` and\n:class:`~astropy.coordinates.SkyCoord` instances (as well as underlying frames\nand realisations) can now be manipulated just like those of arrays, using\nmethods with the same name.  For more details, see\n:ref:`astropy-time-shape-methods` and\n:ref:`astropy-coordinates-array-operations`.\n\n\n.. _whatsnew-1.3-of-address:\n\nEarth locations can now be obtained by address\n==============================================\n\nWith the new :meth:`~astropy.coordinates.EarthLocation.of_address` class\nmethod, :class:`~astropy.coordinates.EarthLocation` objects can now be\neasily created using a string address.  For example::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> loc = EarthLocation.of_address(\"350 5th Ave, New York, NY 10118\")\n    >>> loc\n    <EarthLocation ( 1334938.47885339, -4651088.60103721,  4141299.41836111) m>\n    >>> loc.geodetic\n    (<Longitude -73.9856554 deg>,\n     <Latitude 40.7484404 deg>,\n     <Quantity -1.2647149866511903e-09 m>)\n\nThis works by querying the Google Maps API to\nretrieve the latitude, longitude, and (optional) height of the specified\nlocation. This can be useful for quickly transforming locally to the\n:class:`~astropy.coordinates.AltAz` frame without having to look up the\nspherical coordinates of a location::\n\n    >>> from astropy.coordinates import SkyCoord, AltAz\n    >>> m31 = SkyCoord.from_name('M31').transform_to(AltAz(obstime='2016-12-22 0:00', location=EarthLocation.of_address(\"350 5th Ave, New York, NY 10118\")))\n    >>> m31.alt, m31.az\n    (<Latitude 85.3804464651436 deg>, <Longitude 279.6441719021479 deg>)\n\n\n.. _whatsnew-1.3-jpl-ephemerides:\n\nCoordinate transformations and barycentric corrections can use JPL Ephemerides\n==============================================================================\n\nJPL ephemerides, which could already be used to calculate positions of solar\nsystem bodies, can now also be used for :ref:`barycentric corrections\n<time-light-travel-time>` and :ref:`coordinate transformations\n<astropy-coordinates-transforming-ephemerides>`.\n\n\n.. _whatsnew-1.3-tablechange:\n\nChange in Table behavior when setting column\n============================================\n\nPrevious to 1.3, :ref:`Tables <astropy-table>` did in-place\nmodification of a table column when a column was set like\n``tab['colname'] = val``.  In 1.3, the default behavior has been set to instead\n*replace* a column.  That is, ``tab['colname'] = val`` is now more like\n``t.replace_column('a', val)`` than ``tab['colname'][:] = val``.  This behavior\ncan be turned off for compatibility using the ``table.replace_inplace``\nconfiguration setting (although in future versions of Astropy this capability\nwill be deprecated and removed).  For more details and examples on this change,\nsee :ref:`table-replace-1_3`.\n\n\n.. _whatsnew-1.3-fortan-exponents:\n\nSupport for Fortran exponent formats in ASCII tables\n====================================================\n\nThe :ref:`fast reader <fast_ascii_io>` in :ref:`io.ascii <io-ascii>` now\nsupports FORTRAN-style floating point values (i.e. ``1.495978707D+238``), via\nthe ``fast_reader`` option ``exponent_style``.  The fast reader also now\nsupports extended precision to fully read fortran outputs. For more details see\n:ref:`fortran_style_exponents`.\n\n.. _whatsnew-1.3-yaml-serialization:\n\nSerialization of Astropy classes to YAML\n========================================\n\nAstropy now has an :mod:`astropy.io.misc.yaml` module, which allows\nconverting astropy objects into a standard `YAML <http://yaml.org/>`_ format.\nFor example::\n\n    >>> from astropy.io.misc import yaml\n    >>> from astropy import units as u\n    >>> print(yaml.dump(1*u.au))\n    !astropy.units.Quantity\n    unit: !astropy.units.Unit {unit: AU}\n    value: 1.0\n\nThis functionality requires PyYaml version 3.12 or later.\n\n.. _whatsnew-1.3-lazy-loading-fits:\n\nPerformance improvements with lazy-loading in the io.fits sub-package\n=====================================================================\n\nThe :ref:`io.fits <astropy-io-fits>` sub-package now supports \"lazy loading\",\nwhere all HDUs are not loaded until they are requested (or the file is closed).\nThis should provide substantial speedups for situations using the convenience\nfunctions (e.g., :func:`~astropy.io.fits.getheader` or\n:func:`~astropy.io.fits.getdata`) to get HDU's that are near the front of a\nfile with many HDU's.\n\nIn the future, this may enable larger speedups using the standard\n:func:`astropy.io.fits.open` interface, but at the price of backwards\ncompatibility.  Currently the interface allows access to HDU's all the way at\nthe end of a file even after the file has been closed, preventing full use of\nthe \"lazy\" loading described above.  To begin discouraging this usage, a\ndeprecation warning will now be issued when an HDU is accessed in this manner.\nFuture versions of astropy may remove this capability completely to allow full\nlazy HDU loading.\n\n\n.. _whatsnew-1.3-cosmo:\n\nPlanck 2015 now the default cosmology\n=====================================\n\nThe default cosmology in the :ref:`astropy-cosmology` sub-package is\nnow the Planck 2015 cosmology, and the references have been updated\nto reflect the published papers.\n\n.. _whatsnew-1.3-gcrs-repr:\n\nGCRS and PrecessedGeocentric attributes are now representations\n===============================================================\n\nThe `astropy.coordinates.GCRS` and `astropy.coordinates.PrecessedGeocentric`\nframes have been subtly changed such that their ``obsgeoloc`` and ``obsgeovel``\nattributes return ``CartesianRepresentation`` objects, rather than ``Quantity``\nobjects.  This was judged to be an advanced enough use case that this change\nwill not include a deprecation period (as this would have added substantial\ncomplexity to `astropy.coordinates`). To make code written for earlier versions\ncompatible with v1.3 and up, simply change all instances of\n``<object>.obsgeoloc`` or ``<object>.obsgeovel`` to\n``<object>.obsgeoloc.xyz``/``<object>.obsgeovel.xyz``.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v1.3, including changes in\nAPI, please see the :ref:`changelog`.\n\n\n.. _Lupton et al. (2004): http://adsabs.harvard.edu/abs/2004PASP..116..133L\n"},{"id":292,"name":"index.rst","nodeType":"TextFile","path":"docs/whatsnew","text":"*********************\nMajor Release History\n*********************\n\n.. toctree::\n   :maxdepth: 1\n\n   3.0\n   2.0\n   1.3\n   1.2\n   1.1\n   1.0\n   0.4\n   0.3\n   0.2\n   0.1\n"},{"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":293,"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"},{"id":294,"name":"0.3.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. _whatsnew-0.3:\n\n**************************\nWhat's New in Astropy 0.3?\n**************************\n\nSee this page in the `Astropy v0.3 documentation`__.\n\n__ http://docs.astropy.org/en/v0.3.2/whatsnew/0.3.html\n"},{"id":295,"name":"1.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-1.1:\n\n**************************\nWhat's New in Astropy 1.1?\n**************************\n\nOverview\n========\n\nAstropy 1.1 is a major release that adds significant new functionality since\nthe 1.0.x series of releases.\n\nIn particular, this release includes:\n\n* Support for supergalactic and ecliptic coordinates (see\n  :ref:`whatsnew-1.1-coords`)\n* New functions to automatically determine histogram bins, including the\n  Bayesian blocks algorithm (see :ref:`whatsnew-1.1-hist`)\n* A new interface to transform between :class:`~astropy.table.Table` objects\n  and pandas `DataFrame`_ objects (see :ref:`whatsnew-1.1-pandas`)\n* Support for table indexing (see :ref:`whatsnew-1.1-table-indexing`)\n* A new ``info`` attribute to get summary information about tables and\n  columns (:ref:`whatsnew-1.1-table-info`)\n* A new :meth:`~astropy.table.Table.show_in_notebook` method to show a table\n  in Jupyter/IPython notebooks with additional interactivity features\n* Support for new units, including logarithmic units such as magnitudes, dex,\n  and decibels (see :ref:`whatsnew-1.1-units`)\n* Support for the Planck 2015 cosmology and significant performance\n  improvements in the cosmology sub-package (see :ref:`whatsnew-1.1-cosmo`).\n\nIn addition to these major changes, Astropy 1.1 includes a large number of\nsmaller improvements and bug fixes, which are described in the\n:ref:`changelog`. By the numbers:\n\n* 685 issues have been closed since v1.0\n* 408 pull requests have been merged since v1.0\n* 161 distinct people have contributed code\n\n.. _whatsnew-1.1-coords:\n\nNew features in celestial coordinates package\n=============================================\n\nThe :ref:`astropy-coordinates` sub-package now includes the following new\ncoordinate frames:\n\n* de Vaucouleur **Supergalactic coordinates**, implemented via the\n  :class:`~astropy.coordinates.Supergalactic` frame.\n\n* **Ecliptic coordinates**, implemented via the\n  :class:`~astropy.coordinates.GeocentricTrueEcliptic`,\n  :class:`~astropy.coordinates.BarycentricTrueEcliptic`, and\n  :class:`~astropy.coordinates.HeliocentricTrueEcliptic` frames. These\n  coordinates are still experimental, and should be used with care. We would\n  welcome any testing and feedback regarding the accuracy of these\n  transformations from users familiar with these frames.\n\n* **Precessed Geocentric coordinates**, which is based on GCRS, but precessed\n  to a requested mean equinox, implemented via the\n  :class:`~astropy.coordinates.PrecessedGeocentric` frame.\n\nIn addition, the sub-package now includes the\n:func:`~astropy.coordinates.get_constellation` function and the :class:`~astropy.coordinates.SkyCoord`\n:meth:`~astropy.coordinates.SkyCoord.get_constellation` method, which can be\nused to determine the constellation that a coordinate is in.\n\n.. _whatsnew-1.1-hist:\n\nAlgorithms for choosing histogram bins\n======================================\n\nThe :ref:`stats` and :ref:`astropy-visualization` sub-packages now include\nfunctions to help automatically select histogram bins, including reference\nrules such as `Scott's rule\n<https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width>`_ and\n`Freedman & Diaconis\n<https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule>`_'s rule, and\nBayesian models such as `Knuth's rule\n<https://arxiv.org/abs/physics/0605197>`_ and `Bayesian Blocks\n<http://adsabs.harvard.edu/abs/2012arXiv1207.5578S>`_:\n\n.. plot::\n   :align: center\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.RandomState(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 = plt.figure(figsize=(10,7))\n    hist_kwds1 = dict(histtype='stepfilled', alpha=0.2, normed=True)\n\n    fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)\n    for i, bins in enumerate(['scott', 'freedman', 'knuth', 'blocks']):\n        ax = fig.add_subplot(2,2,i+1)\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')  # Ignore bayesian block p0 warning\n            hist(t, bins=bins, ax=ax, histtype='stepfilled',\n                 alpha=0.4, normed=True)\n        ax.set_xlabel('t')\n        ax.set_ylabel('P(t)')\n        ax.set_title('hist(t, bins=\"{0}\")'.format(bins),\n                     fontdict=dict(family='monospace'), size=14)\n\n\nFor more information, see the :ref:`astropy-visualization-hist` section.\n\n\nNew features in table package\n=============================\n\n.. _whatsnew-1.1-pandas:\n\nTable interface to Pandas\n-------------------------\n\nThe `pandas <http://pandas.pydata.org/>`__ package is a package for high\nperformance data analysis of table-like structures that is complementary to\nthe :class:`~astropy.table.Table` class in Astropy.\n\nIn order to be able to easily exchange data between the\n:class:`~astropy.table.Table` class and the pandas `DataFrame`_ class (the\nmain data structure in pandas), the :class:`~astropy.table.Table` class now\nincludes two methods, :meth:`~astropy.table.Table.to_pandas` and\n:meth:`~astropy.table.Table.from_pandas`.\n\nTo demonstrate these, we can create a simple table which we convert to a\npandas `DataFrame`_::\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    >>> 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\nA pandas `DataFrame`_ can also easily be converted to an Astropy\n:class:`~astropy.table.Table`::\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\nFor more information, see :ref:`pandas`.\n\n.. _whatsnew-1.1-table-indexing:\n\nTable indexing\n--------------\n\nThe table sub-package now supports creation of one or more table indices which\ninternally sort the rows of the table based on the index column(s).  This\nconcept is commonly used in database tables to enhance performance and ensure\ndata integrity.\n\nThe astropy implementation of indexing provides methods for creating the index,\naccessing rows based on key value or location in the sorted index, and\nmaintaining the index when the table is updated (for instance by adding a new\ndata row).\n\nAs an example, to create an index on a table and retrieve a value::\n\n   >>> from astropy.table import Table\n   >>> t = Table(rows=[('Mary', 48),\n                       ('Jim', 37),\n                       ('Jane', 26),\n                       ('Fred', 50)],\n                 names=('name', 'age'))\n   >>> t.add_index('name')\n   >>> t.loc['Jim']['age']\n   37\n\nNote that the table indexing engine is new and is not yet considered stable, so\nit is not recommended for use in production code at this time.  For more\ninformation, see :ref:`table-indexing`.\n\n.. _whatsnew-1.1-table-info:\n\nTable and column info\n---------------------\n\nThe table sub-package now supports a flexible mechanism to return summary\ninformation about a table and columns.  For the table of ages defined above::\n\n   >>> t.info\n   <Table length=4>\n   name dtype\n   ---- -----\n   name  str4\n    age int64\n\n   >>> t['age'].info('stats')\n   name = age\n   mean = 40.25\n   std = 9.60143218484\n   min = 26\n   max = 50\n   n_bad = 0\n   length = 4\n\nFor more information, see :ref:`table-summary-information`.\n\n\n.. _whatsnew-1.1-table-show-in-notebook:\n\n``show_in_notebook`` method\n---------------------------\n\n:class:`~astropy.table.Table` now has a\n:meth:`~astropy.table.Table.show_in_notebook` method that makes viewing tables\nin Jupyter/IPython notebooks more convenient.  Simply call the method at the\nbottom of a cell (or use the :func:`IPython.display.display` function), and the\noutput of the cell will show the table with a searchable, sortable, and\nresizable interface similar to what's available by doing\n``tab.show_in_browser(jsviewer=True)``.\n\n\n.. _whatsnew-1.1-units:\n\nNew Units\n=========\n\nThe :ref:`astropy-units` sub-package now includes support for logarithmic\nunits such as magnitudes, decibels, and dex::\n\n    >>> from astropy import units as u\n    >>> logg = 5. * u.dex(u.cm / u.s**2)\n    >>> logg.value\n    5.0\n    >>> logg.physical\n    <Quantity 100000.0 cm / s2>\n\nFor more information, see :ref:`logarithmic_units`.\n\nIn addition, the following units have been added:\n\n* Furlongs (``imperial.furlong``)\n* Mil (``imperial.mil``)\n* Stone (``imperial.stone``)\n* Earth mass (``units.M_earth``) and Jupiter mass (``units.M_jup``)\n\nFinally, quantity arrays can now be used in Matplotlib, which will recognize\nthe unit and plot the quantities correctly (see :ref:`plotting-quantities`\nfor more details on how to enable this).\n\n\n.. _whatsnew-1.1-cosmo:\n\nImprovements to cosmology sub-package\n=====================================\n\nThe :ref:`astropy-cosmology` sub-package now includes the Planck 2015\ncosmology, and in addition includes significant performance improvements\n(20-40x) for distance calculations, for all the cosmologies provided.\n\n\nDeprecation and backward-incompatible changes\n=============================================\n\nThe v1.1.x series of releases will be the last one supporting Python 2.6.\nStarting with Astropy v1.2, Python 2.7 or later will be required.\n\n\n2D Cutout Images\n================\n\nThe `astropy.nddata.utils` module now includes a\n`~astropy.nddata.utils.Cutout2D` class to create a postage stamp\ncutout image from a 2D array.  Image cutouts can be generated using\neither pixel or `~astropy.coordinates.SkyCoord` positions.  The cutout\nshapes can be specified in either angular or pixel units.  If an\noptional `~astropy.wcs.WCS` object is input, then the\n`~astropy.nddata.utils.Cutout2D` object will contain an updated\n`~astropy.wcs.WCS` corresponding to the cutout array.\n\nFor more information, see :ref:`cutout_images`.\n\nOther significant changes\n=========================\n\nThe :ref:`astropy-wcs` sub-package now supports (and includes) WCSLIB 5.x,\nwhich implements support for the distortion representations described in\n[Paper IV: Representations of distortions in FITS world coordinate\nsystems](http://www.atnf.csiro.au/people/mcalabre/WCS/) by Calabretta et al,\nincluding TPV and SIP. Note that for now, Astropy still uses a custom\nimplementation of the SIP distortions rather than the ones from WCSLIB, but\nwe plan to change this over in the future.\n\nThe :ref:`astropy-time` sub-package now includes support for time strings\nformatted using the FITS convention, e.g. ``'2000-01-02T03:04:05(TDB)'``.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version v1.1, including changes in\nAPI, please see the :ref:`changelog`.\n\n.. _DataFrame: http://pandas-docs.github.io/pandas-docs-travis/\n"},{"id":296,"name":"0.1.rst","nodeType":"TextFile","path":"docs/whatsnew","text":"*************************\nWhat's New in Astropy 0.1\n*************************\n\nThis was the initial version of Astropy, released on June 19, 2012.  It was\nreleased primarily as a \"developer preview\" for developers interested in\nworking directly on Astropy, on affiliated packages, or on other software that\nmight integrate with Astropy.\n\nAstropy 0.1 integrated several existing packages under a single ``astropy``\npackage with a unified installer, including:\n\n * asciitable as `astropy.io.ascii`\n * PyFITS as `astropy.io.fits`\n * votable as ``astropy.io.vo``\n * PyWCS as `astropy.wcs`\n\nIt also added the beginnings of the :mod:`astropy.cosmology` package, and new\ncommon data structures for science data in the :mod:`astropy.nddata` and\n:mod:`astropy.table` packages.\n\nIt also laid much of the groundwork for Astropy's installation and\ndocumentation frameworks, as well as tools for managing configuration and data\nmanagement.  These facilities are designed to be shared by Astropy's affiliated\npackages in the hopes of providing a framework on which other Astronomy-related\nPython packages can build.\n"},{"col":4,"comment":"\n        Check if the given path is a git submodule.\n\n        See the docstrings for ``_check_submodule_using_git`` and\n        ``_check_submodule_no_git`` for further details.\n        ","endLoc":562,"header":"def _check_submodule(self)","id":297,"name":"_check_submodule","nodeType":"Function","startLoc":547,"text":"def _check_submodule(self):\n        \"\"\"\n        Check if the given path is a git submodule.\n\n        See the docstrings for ``_check_submodule_using_git`` and\n        ``_check_submodule_no_git`` for further details.\n        \"\"\"\n\n        if (self.path is None or\n                (os.path.exists(self.path) and not os.path.isdir(self.path))):\n            return False\n\n        if self.use_git:\n            return self._check_submodule_using_git()\n        else:\n            return self._check_submodule_no_git()"},{"col":4,"comment":"\n        Check if the given path is a git submodule.  If so, attempt to initialize\n        and/or update the submodule if needed.\n\n        This function makes calls to the ``git`` command in subprocesses.  The\n        ``_check_submodule_no_git`` option uses pure Python to check if the given\n        path looks like a git submodule, but it cannot perform updates.\n        ","endLoc":638,"header":"def _check_submodule_using_git(self)","id":298,"name":"_check_submodule_using_git","nodeType":"Function","startLoc":564,"text":"def _check_submodule_using_git(self):\n        \"\"\"\n        Check if the given path is a git submodule.  If so, attempt to initialize\n        and/or update the submodule if needed.\n\n        This function makes calls to the ``git`` command in subprocesses.  The\n        ``_check_submodule_no_git`` option uses pure Python to check if the given\n        path looks like a git submodule, but it cannot perform updates.\n        \"\"\"\n\n        cmd = ['git', 'submodule', 'status', '--', self.path]\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except _CommandNotFound:\n            # The git command simply wasn't found; this is most likely the\n            # case on user systems that don't have git and are simply\n            # trying to install the package from PyPI or a source\n            # distribution.  Silently ignore this case and simply don't try\n            # to use submodules\n            return False\n\n        stderr = stderr.strip()\n\n        if returncode != 0 and stderr:\n            # Unfortunately the return code alone cannot be relied on, as\n            # earlier versions of git returned 0 even if the requested submodule\n            # does not exist\n\n            # This is a warning that occurs in perl (from running git submodule)\n            # which only occurs with a malformatted locale setting which can\n            # happen sometimes on OSX.  See again\n            # https://github.com/astropy/astropy/issues/2749\n            perl_warning = ('perl: warning: Falling back to the standard locale '\n                            '(\"C\").')\n            if not stderr.strip().endswith(perl_warning):\n                # Some other unknown error condition occurred\n                log.warn('git submodule command failed '\n                         'unexpectedly:\\n{0}'.format(stderr))\n                return False\n\n        # Output of `git submodule status` is as follows:\n        #\n        # 1: Status indicator: '-' for submodule is uninitialized, '+' if\n        # submodule is initialized but is not at the commit currently indicated\n        # in .gitmodules (and thus needs to be updated), or 'U' if the\n        # submodule is in an unstable state (i.e. has merge conflicts)\n        #\n        # 2. SHA-1 hash of the current commit of the submodule (we don't really\n        # need this information but it's useful for checking that the output is\n        # correct)\n        #\n        # 3. The output of `git describe` for the submodule's current commit\n        # hash (this includes for example what branches the commit is on) but\n        # only if the submodule is initialized.  We ignore this information for\n        # now\n        _git_submodule_status_re = re.compile(\n            '^(?P<status>[+-U ])(?P<commit>[0-9a-f]{40}) '\n            '(?P<submodule>\\S+)( .*)?$')\n\n        # The stdout should only contain one line--the status of the\n        # requested submodule\n        m = _git_submodule_status_re.match(stdout)\n        if m:\n            # Yes, the path *is* a git submodule\n            self._update_submodule(m.group('submodule'), m.group('status'))\n            return True\n        else:\n            log.warn(\n                'Unexpected output from `git submodule status`:\\n{0}\\n'\n                'Will attempt import from {1!r} regardless.'.format(\n                    stdout, self.path))\n            return False"},{"id":299,"name":"0.4.rst","nodeType":"TextFile","path":"docs/whatsnew","text":".. doctest-skip-all\n\n.. _whatsnew-0.4:\n\n**************************\nWhat's New in Astropy 0.4?\n**************************\n\nOverview\n========\n\nAstropy 0.4 is a major release that adds new functionality since the\n0.3.x series of releases. A new sub-package is included (see `SAMP`_),\na major overhaul of the :ref:`Coordinates <astropy-coordinates>` \nsub-package has been completed (see `Coordinates`_),\nand many new features and improvements have been implemented for the\nexisting sub-packages. In addition to usability improvements, we have\nmade a number of changes in the infrastructure for setting up/installing\nthe package (see `astropy-helpers package`_), as well as reworking the\nconfiguration system (see `Configuration`_).\n\nIn addition to these major changes, a large number of smaller\nimprovements have occurred.  Since v0.3, by the numbers:\n\n* 819 issues have been closed\n* 511 pull requests have been merged\n* 57 distinct people have contributed code\n\n\nCoordinates\n===========\n\nThe :ref:`astropy-coordinates` sub-package has been largely re-designed based\non broad community discussion and experience with v0.2 and v0.3.  The key\nmotivation was to implement coordinates within an extensible framework that\ncleanly separates the distinct aspects of data representation, coordinate\nframe representation and transformation, and user interface.  This is described\nin the `APE5 <https://github.com/astropy/astropy-APEs/blob/master/APE5.rst>`_\ndocument. Details of the new usage are given in the :ref:`astropy-coordinates`\nsection of the documentation.\n\n*An important point is that this sub-package is now considered stable and we do\nnot expect any further major interface changes.*\n\nFor most users the major change is that the recommended user interface to\ncoordinate functionality is the  `~astropy.coordinates.SkyCoord` class\ninstead of classes like `~astropy.coordinates.ICRS` or\n`~astropy.coordinates.Galactic` (which are now\ncalled \"frame\" classes).  For example::\n\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> coordinate = SkyCoord(123.4*u.deg, 56.7*u.deg, frame='icrs')\n\nThe frame classes can still be used to create coordinate objects as before, but\nthey are now more powerful because they can represent abstract coordinate\nframes without underlying data.  The more typical use for frame classes is now::\n\n    >>> from astropy.coordinates import FK4  # Or ICRS, Galactic, or similar\n    >>> fk4_frame = FK4(equinox='J1980.0', obstime='2011-06-12T01:12:34')\n    >>> coordinate.transform_to(fk4_frame)\n    <SkyCoord (FK4): equinox=J1980.000, obstime=2011-06-12T01:12:34.000, ra=123.001698182 deg, dec=56.7609162301 deg>\n\nAt the lowest level of the framework are the representation classes which\ndescribe how to represent a point in a frame as a tuple of quantities, for\ninstance as spherical, cylindrical, or cartesian coordinates.  Any coordinate\nobject can now be created using values in a number of common representations\nand be displayed using those representations.  For example::\n\n    >>> coordinate = SkyCoord(1*u.pc, 2*u.pc, 3*u.pc, representation='cartesian')\n    >>> coordinate\n    <SkyCoord (ICRS): x=1.0 pc, y=2.0 pc, z=3.0 pc>\n\n    >>> coordinate.representation = 'physicsspherical'\n    >>> coordinate\n    <SkyCoord (ICRS): phi=63.4349488229 deg, theta=36.6992252005 deg, r=3.74165738677 pc>\n\nSAMP\n====\n\nThe :ref:`vo-samp` sub-package is a new sub-package (adapted from the `SAMPy\npackage <https://pythonhosted.org/sampy/>`_) that contains an\nimplementation of the `Simple Application Messaging Protocol (SAMP)\n<http://www.ivoa.net/documents/SAMP/>`_ standard that allows communication\nwith any SAMP-enabled application (such as `TOPCAT\n<http://www.star.bris.ac.uk/~mbt/topcat/>`_, `SAO Ds9\n<http://ds9.si.edu/>`_, and `Aladin\n<http://aladin.u-strasbg.fr>`_). This sub-package includes both classes for a\nhub and a client, as well as an *integrated client* which automatically\nconnects to any running SAMP hub and acts as a client::\n\n    >>> from astropy.vo.samp import SAMPIntegratedClient\n    >>> client = SAMPIntegratedClient()\n    >>> client.connect()\n\nWe can then use the client to communicate with other clients::\n\n    >>> client.get_registered_clients()\n    ['hub', 'c1', 'c2']\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\nand we can then send for example tables and images over SAMP to other\napplications (see :ref:`vo-samp` for examples of how to do this).\n\nQuantity\n========\nThe `~astropy.units.Quantity` class has seen a series of optimizations\nand is now substantially faster.  Additionally, the `~astropy.time`,\n`~astropy.coordinates`, and `~astropy.table` subpackages integrate\nbetter with `~astropy.units.Quantity`, with further improvements on the\nway for `~astropy.table`. See :doc:`/units/quantity` and the other\nsubpackage documentation sections for more details.\n\nInspecting FITS headers from the command line\n=============================================\n\nThe :ref:`astropy-io-fits` sub-package now provides a command line script for\ninspecting the header(s) of a FITS file. With Astropy 0.4 installed, run\n``fitsheader file.fits`` in your terminal to print the header information to\nthe screen in a human-readable format. Run ``fitsheader --help`` to see the\nfull usage documentation.\n\nReading and writing HTML tables\n===============================\n\nThe :ref:`io-ascii` sub-package now provides the capability to read a table\nwithin an HTML file or web URL into an astropy `~astropy.table.Table` object.\nThis requires the `BeautifulSoup4\n<https://www.crummy.com/software/BeautifulSoup/>`_ package to be installed.\nConversely a `~astropy.table.Table` object can now be written out as an HTML\ntable.\n\nDocumentation URL changes\n=========================\n\nStarting in v0.4, the astropy documentation (and any package that uses\n``astropy-helpers``) will show the full name of functions and classes\nprefixed by the intended user-facing location.  This is in contrast to\nprevious versions, which pointed to the actual implementation module,\nrather than the intended public API location.\n\nThis will affect URLs pointing to specific documentation pages.  For\nexample, this URL points to the v0.3 location of the\n``astropy.cosmology.luminosity_distance`` function:\n\n* http://docs.astropy.org/en/v0.3/api/astropy.cosmology.funcs.luminosity_distance.html\n\nwhile the appropriate URL for v0.4 and later is:\n\n* http://docs.astropy.org/en/v0.4/api/astropy.cosmology.luminosity_distance.html\n\nastropy-helpers package\n=======================\n\nWe have now extracted our set-up and documentation utilities into a separate\npackage, `astropy-helpers <https://github.com/astropy/astropy-helpers>`_. In\npractice, this does not change anything from a user point of view, but it is\na big internal change that will allow any other packages to benefit from the\nset-up utilies developed for the core package without having to first install\nastropy.\n\nConfiguration\n=============\n\nThe configuration framework has been re-factored based on the design\ndescribed in\n`APE3 <https://github.com/astropy/astropy-APEs/blob/master/APE3.rst>`_.\nIf you have previously edited the astropy configuration file (typically\nlocated at ``~/.astropy/config/astropy.cfg``) then you should read over\n:ref:`config-0-4-transition` in order to understand how to update it\nto the new mechanism.\n\nDeprecation and backward-incompatible changes\n=============================================\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- The functional interface for `astropy.cosmology` (e.g.\n  ``cosmology.H(z=0.5)`` is now deprecated in favor of the\n  objected-oriented approach (``WMAP9.H(z=0.5)``). [#2343]\n\n- The `astropy.coordinates` sub-package has undergone major changes for\n  implementing the\n  `APE5 <https://github.com/astropy/astropy-APEs/blob/master/APE5.rst>`_ plan\n  for the package.  A compatibility layer has been added that will allow\n  common use cases of pre-v0.4 coordinates to work, but this layer will be\n  removed in the next major version.  Hence, any use of the coordinates\n  package should be adapted to the new framework.  Additionally, the\n  compatibility layer cannot be used for convenience functions (like the\n  ``match_catalog_*()`` functions), as these have been moved to\n  `~astropy.coordinates.SkyCoord`. From this point on, major changes to the\n  coordinates classes are not expected.  [#2422]\n\n- The configuration framework has been re-designed to the scheme of\n  `APE3 <https://github.com/astropy/astropy-APEs/blob/master/APE3.rst>`_.\n  The previous framework based on ``ConfigurationItem`` is\n  deprecated, and  will be removed in a future release. Affiliated\n  packages should update to the new configuration system, and any users\n  who have customized their configuration file should migrate to the new\n  configuration approach.  Until they do, warnings will appear prompting\n  them to do so.\n\nFull change log\n===============\n\nTo see a detailed list of all changes in version 0.4 and prior, please see the\n:ref:`changelog`.\n\nNote on future versions\n=======================\n\nWhile the current release supports Python 2.6, 2.7, and 3.1 to 3.4, the next\nrelease (1.0) will drop support for Python 3.1 and 3.2.\n\n"},{"col":0,"comment":"\n    Run a command in a subprocess, given as a list of command-line\n    arguments.\n\n    Returns a ``(returncode, stdout, stderr)`` tuple.\n    ","endLoc":799,"header":"def run_cmd(cmd)","id":300,"name":"run_cmd","nodeType":"Function","startLoc":755,"text":"def run_cmd(cmd):\n    \"\"\"\n    Run a command in a subprocess, given as a list of command-line\n    arguments.\n\n    Returns a ``(returncode, stdout, stderr)`` tuple.\n    \"\"\"\n\n    try:\n        p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)\n        # XXX: May block if either stdout or stderr fill their buffers;\n        # however for the commands this is currently used for that is\n        # unlikely (they should have very brief output)\n        stdout, stderr = p.communicate()\n    except OSError as e:\n        if DEBUG:\n            raise\n\n        if e.errno == errno.ENOENT:\n            msg = 'Command not found: `{0}`'.format(' '.join(cmd))\n            raise _CommandNotFound(msg, cmd)\n        else:\n            raise _AHBootstrapSystemExit(\n                'An unexpected error occurred when running the '\n                '`{0}` command:\\n{1}'.format(' '.join(cmd), str(e)))\n\n\n    # Can fail of the default locale is not configured properly.  See\n    # https://github.com/astropy/astropy/issues/2749.  For the purposes under\n    # consideration 'latin1' is an acceptable fallback.\n    try:\n        stdio_encoding = locale.getdefaultlocale()[1] or 'latin1'\n    except ValueError:\n        # Due to an OSX oddity locale.getdefaultlocale() can also crash\n        # depending on the user's locale/language settings.  See:\n        # http://bugs.python.org/issue18378\n        stdio_encoding = 'latin1'\n\n    # Unlikely to fail at this point but even then let's be flexible\n    if not isinstance(stdout, _text_type):\n        stdout = stdout.decode(stdio_encoding, 'replace')\n    if not isinstance(stderr, _text_type):\n        stderr = stderr.decode(stdio_encoding, 'replace')\n\n    return (p.returncode, stdout, stderr)"},{"id":301,"name":"docs/constants","nodeType":"Package"},{"id":302,"name":"index.rst","nodeType":"TextFile","path":"docs/constants","text":"*******************************\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. Constants are `~astropy.units.Quantity` objects with\nadditional meta-data describing their provenance and uncertainties.\n\nGetting Started\n===============\n\nTo use the constants in S.I. units, you can import the constants directly from\nthe `astropy.constants` sub-package::\n\n    >>> from astropy.constants import G\n\nor, if you want to avoid having to explicitly import all the constants you\nneed, you can simply do:\n\n    >>> from astropy import constants as const\n\nand then subsequently use for example ``const.G``. Constants are fully-fledged\n`~astropy.units.Quantity` objects, so you can easily convert them to\ndifferent units for example::\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 2014\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\nand you can use them in conjunction with unit and other non-constant\n`~astropy.units.Quantity` objects::\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\nIt is possible to convert most constants to cgs using e.g.::\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\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\nCollections of constants (and prior versions)\n=============================================\n\nConstants are organized into version modules. The constants for\nAstropy 1.3 can be accessed in the ``astropyconst13`` module.\nFor example:\n\n    >>> from astropy.constants import astropyconst13 as const\n    >>> print(const.e)\n      Name   = Electron charge\n      Value  = 1.602176565e-19\n      Uncertainty  = 3.5e-27\n      Unit  = C\n      Reference = CODATA 2010\n\nPhysical CODATA constants are in modules with names like ``codata2010`` or\n``codata2014``:\n\n    >>> from astropy.constants import codata2010 as const\n    >>> print(const.h)\n      Name   = Planck constant\n      Value  = 6.62606957e-34\n      Uncertainty  = 2.9e-41\n      Unit  = J s\n      Reference = CODATA 2010\n\nAstronomical constants defined (primarily) by the IAU are collected in \nmodules 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\nThe astronomical and physical constants are combined into modules with\nnames like ``astropyconst13`` and ``astropyconst20``.\n\n.. warning:: \n\n    Units such as ``u.M_sun`` will use the current version of the\n    corresponding constant. When using prior versions of the constants,\n    quantities should be constructed with constants instead of units.\n\nReference/API\n=============\n\n.. automodapi:: astropy.constants\n"},{"id":303,"name":"docs/cosmology","nodeType":"Package"},{"id":304,"name":"index.rst","nodeType":"TextFile","path":"docs/cosmology","text":".. _astropy-cosmology:\n\n***********************************************\nCosmological Calculations (`astropy.cosmology`)\n***********************************************\n\nIntroduction\n============\n\nThe `astropy.cosmology` subpackage contains classes for representing\ncosmologies, and utility functions for calculating commonly used\nquantities that depend on a cosmological model. This includes\ndistances, ages and lookback times corresponding to a measured\nredshift or the transverse separation corresponding to a measured\nangular separation.\n\n\nGetting Started\n===============\n\nCosmological quantities are calculated using methods of a\n:class:`~astropy.cosmology.Cosmology` object. For example, to calculate the\nHubble constant at z=0 (i.e., ``H0``), and the number of transverse proper\nkpc 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\nparameters from the 9-year WMAP results. Several other built-in\ncosmologies are also available, see `Built-in Cosmologies`_. The\navailable methods of the cosmology object are listed in the methods\nsummary for the `~astropy.cosmology.FLRW` class. If you're using\nIPython you can also use tab completion to print a list of the\navailable methods. To do this, after importing the cosmology as in the\nabove example, type ``cosmo.`` at the IPython prompt and then press\nthe tab key.\n\nAll of these methods also accept an arbitrarily shaped array of\nredshifts as input:\n\n.. doctest-requires:: scipy\n\n  >>> from astropy.cosmology import WMAP9 as cosmo\n  >>> cosmo.comoving_distance([0.5, 1.0, 1.5])  # doctest: +FLOAT_CMP\n  <Quantity [1916.06942039, 3363.0706321 , 4451.74754107] 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 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``,\nthe number of effective neutrino species) with default values; these\ncan also be specified explicitly in the call to the constructor.\n\nThe cosmology subpackage makes use of `~astropy.units`, so in many\ncases returns values with units attached.  Consult the documentation\nfor that subpackage for more details, but briefly, 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\nMost of the functionality is enabled by the `~astropy.cosmology.FLRW`\nobject. This represents a homogeneous and isotropic cosmology\n(characterized by the Friedmann-Lemaitre-Robertson-Walker metric,\nnamed after the people who solved Einstein's field equation for this\nspecial case).  However, you can't work with this class directly, as\nyou must specify a dark energy model by using one of its subclasses\ninstead, such as `~astropy.cosmology.FlatLambdaCDM`.\n\nYou can create a new `~astropy.cosmology.FlatLambdaCDM` object with\narguments giving the Hubble parameter 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 km / (Mpc s), Om0=0.3, Tcmb0=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\nHowever, most of the parameters that accept units (``H0``, ``Tcmb0``)\nhave default units, so unit quantities do not have to be used.\nThe exception are neutrino masses, where you must supply a\nunits if you want massive neutrinos.\n\nThe pre-defined cosmologies described in the `Getting Started`_\nsection are instances of `~astropy.cosmology.FlatLambdaCDM`, and have\nthe same methods. So we can find the luminosity distance to\nredshift 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  >>> cosmo.age([0.5, 1, 1.5]).value  # doctest: +FLOAT_CMP\n  array([8.4212803 , 5.74698037, 4.19645387])\n\nSee the `~astropy.cosmology.FLRW` and\n`~astropy.cosmology.FlatLambdaCDM` object docstring for all the\nmethods and attributes available. In addition to flat Universes,\nnon-flat varieties are supported such as\n`~astropy.cosmology.LambdaCDM`.  There are also a variety of standard\ncosmologies with the parameters already defined (see `Built-in\nCosmologies`_)::\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  >>> from astropy.cosmology import WMAP7   # WMAP 7-year cosmology\n  >>> WMAP7.Om([0, 1.0, 2.0]), WMAP7.Ode([0., 1.0, 2.0])  # doctest: +FLOAT_CMP\n  (array([0.272     , 0.74898524, 0.90905239]),\n   array([0.72791572, 0.25055061, 0.0901026 ]))\n\nNote that these don't quite add up to one even though WMAP7 assumes a\nflat Universe because photons and neutrinos are included. Also note\nthat they are unitless and so are not `~astropy.units.Quantity`\nobjects.\n\nIt is possible to specify the baryonic matter density at redshift zero\nat class instantiation 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 km / (Mpc s), Om0=0.3, Tcmb0=0 K,\n                Neff=3.04, m_nu=None, Ob0=0.05)\n\nIn this case the dark matter only density at redshift zero is\navailable as class attribute ``Odm0`` and the redshift evolution of\ndark and baryonic matter densities can be computed using the methods\n``Odm`` and ``Ob``, respectively. If ``Ob0`` is not specified at class\ninstantiation it defaults to ``None`` and any method relying on it\nbeing 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\nused to describe 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.6 km / (Mpc s), Om0=0.262,\n           w0=-1.02, Tcmb0=0 K, Neff=3.04, m_nu=None, Ob0=None)\n\nThis is also an example with a different model for dark energy, a flat\nUniverse with a constant dark energy equation of state, but not\nnecessarily a cosmological constant.  A variety of additional dark\nenergy models are also supported -- see `Specifying a dark energy\nmodel`_.\n\nA important point is that the cosmological parameters of each\ninstance are immutable -- that is, if you want to change, say,\n``Om``, you need to make a new instance of the class.  To make\nthis more convenient, a ``clone`` operation is provided, which\nallows you to make a copy with specified values changed.\nNote that you can't change the type of cosmology with this operation\n(e.g., flat to non-flat). For example:\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\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\nredshift which it corresponds to, you can use ``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  3.1981226843560968\n\nFor some quantities there can be more than one redshift that satisfies\na value. In this case you can use the ``zmin`` and ``zmax`` keywords\nto restrict the search range. See the ``z_at_value`` docstring for more\ndetailed usage examples.\n\n\nBuilt-in Cosmologies\n--------------------\n\nA number of pre-loaded 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 pre-defined cosmologies is given by\n``cosmology.parameters.available``, and summarized below:\n\n========  ============================== ====  ===== =======\nName      Source                         H0    Om    Flat\n========  ============================== ====  ===== =======\nWMAP5     Komatsu et al. 2009            70.2  0.277 Yes\nWMAP7     Komatsu et al. 2011            70.4  0.272 Yes\nWMAP9     Hinshaw et al. 2013            69.3  0.287 Yes\nPlanck13  Planck Collab 2013, Paper XVI  67.8  0.307 Yes\nPlanck15  Planck Collab 2015, Paper XIII 67.7  0.307 Yes\n========  ============================== ====  ===== =======\n\nCurrently, all are instances of `~astropy.cosmology.FlatLambdaCDM`.\nMore details about exactly where each set of parameters come from\nare available in the docstring for each object::\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\nIn addition to the standard `~astropy.cosmology.FlatLambdaCDM` model\ndescribed above, a number of additional dark energy models are\nprovided.  `~astropy.cosmology.FlatLambdaCDM`\nand `~astropy.cosmology.LambdaCDM` assume that dark\nenergy is a cosmological constant, and should be the most commonly\nused cases; the former assumes a flat Universe, the latter allows\nfor spatial curvature.  `~astropy.cosmology.FlatwCDM` and\n`~astropy.cosmology.wCDM` assume a constant dark\nenergy equation of state parameterized by :math:`w_{0}`. Two forms of a\nvariable dark energy equation of state are provided: the simple first\norder linear expansion :math:`w(z) = w_{0} + w_{z} z` by\n`~astropy.cosmology.w0wzCDM`, as well as the common CPL form by\n`~astropy.cosmology.w0waCDM`: :math:`w(z) = w_{0} + w_{a} (1 - a) =\nw_{0} + w_{a} z / (1 + z)` and its generalization to include a pivot\nredshift by `~astropy.cosmology.wpwaCDM`: :math:`w(z) = w_{p} + w_{a}\n(a_{p} - a)`.\n\nUsers can specify their own equation of state by sub-classing\n`~astropy.cosmology.FLRW`.  See the provided subclasses for\nexamples. It is recommended, but not required, that all arguments to the\nconstructor of a new subclass be available as properties, since the\n``clone`` method assumes this is the case.  It is also advisable\nto stick to subclassing `~astropy.cosmology.FLRW` rather than one of\nits subclasses, since some of them use internal optimizations that\nalso need to be propagated to any subclasses.  Users wishing to\nuse similar tricks (which can make distance calculations much faster)\nshould consult the cosmology module source code for details.\n\nPhotons and Neutrinos\n---------------------\nThe cosmology classes (can) include the contribution to the energy density\nfrom both photons and neutrinos.  By default, the latter are assumed\nmassless.  The three parameters controlling the properties of these\nspecies, which are arguments to the initializers of all the\ncosmological classes, are ``Tcmb0`` (the temperature of the CMB at z=0),\n``Neff``, the effective number of neutrino species, and ``m_nu``, the rest\nmass of the neutrino species.  ``Tcmb0`` and ``m_nu`` should be expressed\nas unit Quantities.  All three have standard default values (0 K,\n3.04, and 0 eV respectively; the reason that ``Neff`` is not 3 primarily\nhas to do with a small bump in the neutrino energy spectrum due to\nelectron-positron annihilation, but is also affected by weak\ninteraction physics).  Setting the CMB temperature to zero removes\nthe contribution of both neutrinos and photons. This is the default to ensure\nthese components are excluded unless the user explicitly requests them.\n\nMassive neutrinos are treated using the approach described in the\nWMAP 7-year cosmology paper (Komatsu et al. 2011, ApJS, 192, 18, section 3.3).\nThis 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)`\ninclude both the kinetic energy and the rest-mass energy components,\nand that the Planck13 and Planck15 cosmologies includes a single\nspecies of neutrinos with non-zero mass (which is not included in\n:math:`\\Omega_{m0}`).\n\nAdding massive neutrinos can have significant performance implications.\nIn particular, the computation of distance measures and lookback times\nare factors of 3-4 slower than in the massless neutrino case.  Therefore,\nif you need to compute a lot of distances in such a cosmology and\nperformance is critical, it is particularly useful to calculate them on\na grid and use interpolation.\n\nThe contribution of photons and neutrinos to the total mass-energy density\ncan be 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 = [0, 1.0, 2.0]\n  >>> WMAP7.Ogamma(z), WMAP7.Onu(z)  # doctest: +FLOAT_CMP\n  (array([4.98586899e-05, 2.74583989e-04, 4.99898824e-04]),\n   array([3.44227509e-05, 1.89574501e-04, 3.45133270e-04]))\n\nIf you want to exclude photons and neutrinos from your calculations,\nsimply set ``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\nsetting ``Tcmb0`` to be non-zero (2.725 K is the standard value for our\nUniverse) but setting ``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([0, 1, 2])  # Photons are still present  # doctest: +FLOAT_CMP\n  array([4.98586899e-05, 2.74632798e-04, 5.00069284e-04])\n  >>> cos.Onu([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``,\nwhich in the default case is 3.  Therefore, if non-zero neutrino masses\nare desired, then 3 masses should be provided.  However, if only one\nvalue is provided, all the species are assumed to have the same mass.\n``Neff`` is assumed 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([0, 1.0, 15.0])  # doctest: +FLOAT_CMP\n  array([0.00327   , 0.00896814, 0.01257904])\n  >>> cosmo.Onu(1) * cosmo.critical_density(1)  # doctest: +FLOAT_CMP\n  <Quantity 2.444380380370406e-31 g / cm3>\n\nWhile these examples used `~astropy.cosmology.FlatLambdaCDM`,\nthe above examples also apply for all of the other cosmology classes.\n\n\nFor Developers: Using `astropy.cosmology` inside Astropy\n========================================================\n\nIf you are writing code for the Astropy core or an affiliated package,\nit's often useful to assume a default cosmology, so that the exact\ncosmology doesn't have to be specified every time a function or method\nis called. In this case it's possible to specify a \"default\"\ncosmology.\n\nYou can set the default cosmology to a pre-defined value by using the\n\"default_cosmology\" option in the ``[cosmology.core]`` section of the\nconfiguration file (see :ref:`astropy_config`). Alternatively, you can\nuse the ``set`` function of `~astropy.cosmology.default_cosmology` to\nset a cosmology for the current Python session. If you haven't set a\ndefault cosmology using one of the methods described above, then the\ncosmology module will default to using the 9-year WMAP parameters.\n\nIt is strongly recommended that you use the default cosmology through\nthe `~astropy.cosmology.default_cosmology` science state object. An\noverride option can then be provided using something like the\nfollowing::\n\n    def myfunc(..., cosmo=None):\n\tfrom astropy.cosmology import default_cosmology\n\n\tif cosmo is None:\n\t    cosmo = default_cosmology.get()\n\n\t... your code here ...\n\nThis ensures that all code consistently uses the default cosmology\nunless explicitly overridden.\n\n.. note::\n    In general it's better to use an explicit cosmology (for example\n    ``WMAP9.H(0)`` instead of\n    ``cosmology.default_cosmology.get().H(0)``). Use of the default\n    cosmology should generally be reserved for code that will be\n    included in the Astropy core or an affiliated package.\n\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\nonline cosmology calculators, and has been used to perform many\ncalculations in refereed papers. You can check the range of redshifts\nover which the code is regularly tested in the module\n``astropy.cosmology.tests.test_cosmology``. If you find any bugs,\nplease let us know by `opening an issue at the github repository\n<https://github.com/astropy/astropy/issues>`_!\n\nA more difficult question is the range of redshifts over which\nthe code is expected to return valid results.  This is necessarily\nmodel-dependent, but in general you should not expect the numeric\nresults to be well behaved for redshifts more than a few times\nlarger than the epoch of matter-radiation equality (so, for typical\nmodels, not above z = 5-6,000, but for some models much lower redshifts\nmay be ill-behaved).  In particular, one should pay attention to warnings\nfrom the scipy integration package about integrals failing to converge (which\nmay only be issued once per session).\n\nThe built in cosmologies use the parameters as listed in the\nrespective papers.  These provide only a limited range of precision,\nand so you should not expect derived quantities to match beyond\nthat precision.  For example, the Planck 2013 and 2015 results only provide the\nHubble constant to 4 digits.  Therefore, they shouldn't be expected\nto match the age quoted by the Planck team to better than that, despite\nthe fact that 5 digits are quoted in the papers.\n\nReference/API\n=============\n\n.. automodapi:: astropy.cosmology\n"},{"id":305,"name":"docs/_templates/autosummary","nodeType":"Package"},{"id":306,"name":"base.rst","nodeType":"TextFile","path":"docs/_templates/autosummary","text":"{% extends \"autosummary_core/base.rst\" %}\n"},{"id":307,"name":"module.rst","nodeType":"TextFile","path":"docs/_templates/autosummary","text":"{% extends \"autosummary_core/module.rst\" %}\n"},{"id":308,"name":"class.rst","nodeType":"TextFile","path":"docs/_templates/autosummary","text":"{% extends \"autosummary_core/class.rst\" %}\n"},{"id":309,"name":"docs/convolution","nodeType":"Package"},{"id":310,"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 offers\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 1-D, 2-D, and 3-D 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's and\nAstropy's 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 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    # 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'll\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\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\nFor example, to convolve a 1-d 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\nThis module also includes built-in kernels that can be imported as e.g.::\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 retrieved 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\nUsing astropy's convolution to replace bad data\n-----------------------------------------------\nAstropy'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., with 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\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\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.. _astropy_convolve_compat:\n\nA note on backward compatibility (pre v2.0)\n-------------------------------------------\n\nThe behavior of astropy's direct convolution\n(:func:`~astropy.convolution.convolve`) changed in version 2.0.  Generally, the\nold version is undesirable.  However, to recover the behavior of the old\n(astropy version <2.0) direct convolution function, you can interpolate and\nthen convolve, e.g.:\n\n.. code-block:: python\n\n    from astropy.convolution import interpolate_replace_nans, convolve\n    interped_result = interpolate_replace_nans(image, kernel)\n    result = convolve(interped_image, kernel)\n\nNote that the default behavior of both `~astropy.convolution.convolve` and\n`~astropy.convolution.convolve_fft` is to perform *normalized convolution* and\ninterpolate NaNs during that process.  The example given in this note, and what\nwas previously done only in direct convolution in old versions of astropy, does\na two-step process: first, it replaces the NaNs with their interpolated values\nwhile leaving all non-NaN values unchanged, then it convolves the resulting\nimage with the specified kernel.\n\nUsing `astropy.convolution`\n===========================\n\n.. toctree::\n   :maxdepth: 2\n\n   using.rst\n   kernels.rst\n   non_normalized_kernels.rst\n\nReference/API\n=============\n\n.. automodapi:: astropy.convolution\n    :no-inheritance-diagram:\n"},{"col":4,"comment":"null","endLoc":889,"header":"def __init__(self, *args)","id":311,"name":"__init__","nodeType":"Function","startLoc":881,"text":"def __init__(self, *args):\n        if not args:\n            msg = 'An unknown problem occurred bootstrapping astropy_helpers.'\n        else:\n            msg = args[0]\n\n        msg += '\\n' + _err_help_msg\n\n        super(_AHBootstrapSystemExit, self).__init__(msg, *args[1:])"},{"id":312,"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\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\nwidth 5 pixels:\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`` attribute.\nThis will be faster in most cases than the astropy convolution, but will not\nwork properly if ``NaN`` values are present in the data.\n\n>>> smoothed = np.convolve(data_1D, box_kernel.array)\n\n2D Kernels\n----------\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. We consider a small Gaussian shaped source of amplitude one 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 applied to the simulated data.\nNote that it has a slightly different color scale 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 MexicanHat\n\n    kernels = [TrapezoidDisk2DKernel(11, slope=0.2),\n               Tophat2DKernel(11),\n               Gaussian2DKernel(11),\n               Box2DKernel(11),\n               11 ** 2 * MexicanHat2DKernel(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\nTophat. The Box filter is not isotropic and can produce artifact (the source\nappears rectangular). The Mexican-Hat 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\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   MexicanHat1DKernel\n   MexicanHat2DKernel\n   Model1DKernel\n   Model2DKernel\n   Ring2DKernel\n   Tophat2DKernel\n   Trapezoid1DKernel\n   TrapezoidDisk2DKernel\n\nKernel Arithmetics\n==================\n\nAddition and Subtraction\n------------------------\nAs convolution is a linear operation, kernels can be added or subtracted from each other.\nThey can also be multiplied with some number. One basic example would be the definition\nof a Difference 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 function model.\nE.g. if the response function can be be described by the 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 explicitly:\n\n>>> SoG.normalize()\n\n\nConvolution\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\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)\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))\n\nWhich, in most cases, will also be faster than the first method, because only\none convolution with the, most times, larger data array will be necessary.\n\nDiscretization\n==============\n\nTo obtain the kernel array for discrete convolution, the kernels 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 linearly\n  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 only recommended when 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 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.MexicanHat1DKernel`\nand :class:`~astropy.convolution.MexicanHat2DKernel` 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"},{"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":313,"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":314,"name":"non_normalized_kernels.rst","nodeType":"TextFile","path":"docs/convolution","text":"*************************************\nConvolving with un-normalized 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 is\neasy and can be done in one step::\n\n    convolve(image, kernel)\n\nFor example, we can 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\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"},{"id":315,"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 both\n1, 2, 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 the\ninput 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\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\nKernels and arrays can be specified either as lists or as Numpy\narrays. The following examples show how to construct a 1-d array as a\nlist::\n\n    >>> kernel = [0, 1, 0]\n    >>> result = convolve(spectrum, kernel)  # doctest: +SKIP\n\na 2-d 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 3-d 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\nKernels\n=======\n\nThe above examples uses custom kernels, but `astropy.convolution` also\nincludes a number of built-in kernels, which are described in\n:doc:`kernels`.\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":316,"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":317,"name":"docs/coordinates","nodeType":"Package"},{"id":318,"name":"representations.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _astropy-coordinates-representations:\n\nUsing and Designing Coordinate Representations\n**********************************************\n\nPoints in a 3-d 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 one 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\nmethods as are available to `~numpy.ndarray`::\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  # doctest: +FLOAT_CMP\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  >>> car_array[2]  # doctest: +FLOAT_CMP\n  <CartesianRepresentation (x, y, z) in m\n      (2., 12., 22.)>\n  >>> car_array.reshape(3, 2)  # doctest: +FLOAT_CMP\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\n\n.. _astropy-coordinates-representations-arithmetic:\n\nVector arithmetic\n=================\n\nRepresentations support basic vector arithmetic, in particular taking the norm,\nmultiplying with and dividing by quantities, taking dot and cross products, as\nwell 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\nTo see how the operations work, consider 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.. _astropy-coordinates-differentials:\n\nDifferentials and derivatives of Representations\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\nTo see how this works, consider the following::\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 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 laters 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\nOften, one has 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 one\nprovides 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 2nd 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\nAttaching ``Differential``'s to ``Representation``'s\n====================================================\n\n.. warning::\n\n    The API for this functionality may change in future versions and should be\n    viewed as provisional!\n\n``Differential`` objects can be attached to ``Representation`` objects as a way\nto encapsulate related information into a single object. ``Differential``'s can\nbe passed in to the initializer of any of the built-in ``Representation``\nclasses. For example, to 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\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). For example, in this case\nthe key is ``'s'`` (second) because the ``Differential`` units are velocities, a\ntime derivative. Passing a single differential to the ``Representation``\ninitializer will automatically generate the necessary key and store it in the\ndifferentials dictionary, but a dictionary is required to specify multiple\ndifferentials::\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``Differential`` s can also be attached to a ``Representation`` after creation::\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 also 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\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`` s, you must\nspecify 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\nShape-changing operations (e.g., reshapes) are propagated to all\n``Differential`` s because they are guaranteed to have the same shape as their\nhost ``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, e.g.::\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`` s, you can\neasily retrieve a copy of the ``Representation`` without the ``Differential`` s\nand 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.. _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 the class they should be instances of (which\n  should be `~astropy.units.Quantity` or a subclass, or anything that can\n  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\n* ``recommended_units`` dictionary (optional):\n\n  Maps component names to the recommended unit to convert the values of that\n  component to if the representation is part of a coordinate frame.  Can be\n  ``None`` (or missing) to indicate there is no preferred unit.  If this\n  dictionary is not defined, no conversion of components to particular units\n  will occur.\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 use also offsets in your coordinate system, two further\nmethods should be defined (please see, e.g.,\n`~astropy.coordinates.SphericalRepresentation` for an example):\n\n* ``unit_vectors`` method:\n\n  Returns a ``dict`` with for each component 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 for each component a `~astropy.units.Quantity` 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 can be extremly simple,\nand 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        # recommended_units is optional\n        recommended_units = {'comp1': u.unit1, 'comp2': u.unit2, 'comp3': u.unit3}\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":319,"name":"inplace.rst","nodeType":"TextFile","path":"docs/coordinates","text":"In Place Modification of Coordinates\n************************************\n\nCoordinates are generally considered to be immutable. If you want to create\nanother coordinate frame with different data you should use\n`~astropy.coordinates.BaseCoordinateFrame.realize_frame`, this is the safest way\nto change the data in a frame as it creates a new frame with that data.\nCreating a new frame can be relatively slow, however, particularly for scalar\ncoordinates. Hence some situations may require that data by changed in-place in\nan already existing frame object. This modification can be done by\nmodifiying the values of the representation data as follows::\n\n    >>> import astropy.units as u\n    >>> from astropy.coordinates import SkyCoord\n    >>> c = SkyCoord([1,2],[3,4], unit='deg')\n    >>> c.data.lon[()] = [10, 20] * u.deg\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(10., 3.), (20., 4.)]>\n\n\nThis changes the longitude values of the frame. Unfortunately, doing just this\nintroduces problems: `~astropy.coordinates.SkyCoord` and\n`~astropy.coordinates.BaseCoordinateFrame` cache various kinds of information to\nspeed up some repeated operations. So we need to tell the cache that it should\nbe cleared so that it can be re-calculated from the new data. This can be\nachieved by doing::\n\n    >>> c.cache.clear()\n\nIt should be noted 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 frame\n*i.e.* the following will not work:::\n\n    >>> c.ra[()] = 20 * u.deg\n\nThis is because a different representation object is used when acessing the\naliased component names. If you wish to inspect the mapping between frame\nattributes i.e. ``.ra`` and representation attributes i.e. ``.lon`` you can look\nat the following dictionary.::\n\n    >>> c.representation_component_names\n    OrderedDict([('ra', 'lon'), ('dec', 'lat'), ('distance', 'distance')])\n"},{"col":0,"comment":"null","endLoc":152,"header":"def _parse_keysel(keysel)","id":320,"name":"_parse_keysel","nodeType":"Function","startLoc":135,"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"},{"col":0,"comment":"null","endLoc":85,"header":"def _normalize_fits_mode(mode)","id":321,"name":"_normalize_fits_mode","nodeType":"Function","startLoc":75,"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(\"Mode '{}' not recognized\".format(mode))\n        mode = new_mode\n    return mode"},{"id":322,"name":"skycoord.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _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.\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 one also specifies 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\nThe coordinate values and frame specification can now 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 lower-case version of a frame name as a string,\ne.g. ``\"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` instances\ncan only be passed as frames using the ``frame=`` keyword argument and not as\npositional arguments.\n\nFor representations that have ``ra`` and ``dec`` attributes one can supply a coordinate\nstring 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 have\ncertain default attribute values.  For instance the `~astropy.coordinates.FK4`\nframe uses ``equinox='B1950.0`` and ``obstime=equinox`` as defaults.  If\nthis object is used to initialize a |SkyCoord| it is possible to override\nthe low-level object attributes that were not explicitly set.  If the\ncoordinate 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\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``)\ndescribes a user input of that element type.  Elements in square brackets are\noptional.  For non-spherical 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**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 of\n  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, e.g.\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 simply lower-case\nversions of the class 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. ``'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*: valid `~astropy.coordinates.Distance` initializer, optional\n    Distance from reference from center to source.\n\n*obstime*: valid `~astropy.time.Time` initializer, optional\n    Time of observation\n\n*equinox*: valid `~astropy.time.Time` initializer, 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 args 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\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\nIn addition to vectorized transformations, you can do the usual array slicing,\ndicing, and selection, using the same methods and attributes that one uses for\n`~numpy.ndarray` instances::\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]  # doctest: +FLOAT_CMP\n  <SkyCoord (ICRS): (ra, dec) in deg\n      (0., 0.)>\n  >>> sc[0:-1:100].reshape(2, 5)  # doctest: +FLOAT_CMP\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\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 it is impossible\n(as discussed, e.g., in the documentation for numpy :func:`~numpy.reshape`).\n\n\nAttributes\n===========\n\nThe |SkyCoord| object has a number of useful attributes which come in handy.\nBy digging through these we'll learn a little bit about |SkyCoord| and how it\nworks.\n\nTo begin (if you don't know already) 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's 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\n  sc.frame_attributes                    sc.representation_component_names\n  sc.frame_specific_representation_info  sc.representation_component_units\n  sc.from_name                           sc.representation_info\n  sc.from_pixel                          sc.reshape\n  sc.galactic                            sc.roll\n  sc.galactocentric                      sc.search_around_3d\n  sc.galcen_dec                          sc.search_around_sky\n  sc.galcen_distance                     sc.separation\n  sc.galcen_ra                           sc.separation_3d\n  sc.gcrs                                sc.shape\n  sc.geocentrictrueecliptic              sc.size\n  sc.get_constellation                   sc.skyoffset_frame\n  sc.get_frame_attr_names                sc.spherical\n  sc.guess_from_table                    sc.spherical_offsets_to\n  sc.has_data                            sc.squeeze\n  sc.hcrs                                sc.supergalactic\n  sc.heliocentrictrueecliptic            sc.swapaxes\n  sc.icrs                                sc.take\n  sc.info                                sc.temperature\n  sc.is_equivalent_frame                 sc.to_pixel\n  sc.is_frame_attr_default               sc.to_string\n  sc.is_transformable_to                 sc.transform_to\n  sc.isscalar                            sc.transpose\n  sc.itrs                                sc.z_sun\n  sc.location\n\nHere we see a bunch of stuff there but much of it should be recognizable or\neasily guessed.  The most obvious may be the longitude and latitude attributes\nwhich are named ``ra`` and ``dec`` for the ``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 the built-in frame names ``icrs``, ``galactic``, ``fk5``\n``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 should recognize are ``distance``, ``equinox``,\n``obstime``, ``shape``.\n\nDigger 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  OrderedDict([('l', 'lon'), ('b', 'lat'), ('distance', 'distance')])\n\n  >>> sc_gal.representation_component_units\n  OrderedDict([('l', Unit(\"deg\")), ('b', Unit(\"deg\"))])\n\n  >>> sc_gal.representation\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, e.g. 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  OrderedDict([('equinox', <Time object: scale='tai' format='byear_str' value=B1950.000>), ('obstime', None)])\n\nThe key values correspond to the defaults if no explicit value is provide 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 (aka low-level frame class),\nand |SkyCoord| (aka high-level class; see :ref:`astropy-coordinates-overview`\nand :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 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 simple examples.  Once you've defined\nyour coordinates and the reference frame, you can transform from that frame to\nanother frame.  You can do this a few different ways: if you just 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\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 an easy 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.. _astropy-skycoord-representations:\n\nRepresentations\n================\n\nSo far we have been using a spherical coordinate representation in the all 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 just requires setting the ``representation`` keyword and\nsupplying the corresponding components for that representation::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation='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='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='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='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='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=REPRESENTATION],\n           keyword_args ...)\n  SkyCoord(COMP1, COMP2, [COMP3], [FRAME | frame=FRAME], [unit=UNIT],\n           [representation=REPRESENTATION], keyword_args ...)\n  SkyCoord([FRAME | frame=FRAME], <comp1_name>=COMP1, <comp2_name>=COMP2,\n           <comp3_name>=COMP3, [representation=REPRESENTATION], [unit=UNIT],\n           keyword_args ...)\n\nIn this case the ``keyword_args`` now includes the element\n``representation=REPRESENTATION``.  In the above description, elements in all\ncapital letters (e.g. ``FRAME``) describes a user input of that element type.\nElements in square brackets are optional.\n\n**COMP1**, **COMP2**, **COMP3**\n\nComponent values can be specified as separate positional arguments or as\nkeyword arguments.  In this formalism the exact types of allowed input depend\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 pre-defined 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 3 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 which is\nsimply the class name in lower case and without the final ``representation``\n(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 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 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 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``\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\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n    >>> icrs.representation_component_names\n    OrderedDict([('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`` thus changes a *property* of the object (how it\nappears) without changing the intrinsic object itself which represents a point\nin 3d space.\n::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation='cartesian')\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (x, y, z) in kpc\n        (1., 2., 3.)>\n\n    >>> c.representation = '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 = '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 = '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 = 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 = '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\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n\n\nExample 1: Plotting random data in Aitoff projection\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis is an example 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 <http://matplotlib.org/>`_ here for\nplotting and `numpy <http://www.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 visualisation. 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 an\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 next step, those coordinates are transformed into an astropy.coordinates\n|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 method,\nwhich 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 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 markersize 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 <http://matplotlib.org/>`_ here for\n    # plotting and `numpy <http://www.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 visualisation. 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 an\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 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 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 markersize 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\nExample 2: Plotting star positions in bulge and disk\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis is more realistic example how to make a plot in the Aitoff projection\nusing data in a |SkyCoord| object.\nHere a randomly generated data set (multivariate\nnormal distribution) for both stars in the bulge and in the disk of a galaxy\nwill be used. Both types will be plotted with different number counts.\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 visualisation using\n`numpy.random.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 next step, those coordinates are transformed into an astropy.coordinates\n|SkyCoord| object.\n\n    >>> c_gal = SkyCoord(galaxy, representation='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 visualisation 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 next step, those coordinates are transformed into an astropy.coordinates\n    # astropy.coordinates.SkyCoord object.\n    c_gal = SkyCoord(galaxy, representation='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\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\nAddition information and examples can be found in the section on\n:ref:`astropy-coordinates-separations-matching`.\n"},{"id":323,"name":"matchsep.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _astropy-coordinates-separations-matching:\n\nSeparations, 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\nSeparations\n===========\n\nThe on-sky separation is easily 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\napproximation)::\n\n    >>> import numpy as np\n    >>> from astropy import units as u\n    >>> from astropy.coordinates import SkyCoord\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.74611447604398 deg>\n\nThe returned object is an `~astropy.coordinates.Angle` instance, so it\nis straightforward to access the angle in any of several equivalent angular\nunits::\n\n    >>> sep.radian  # doctest: +FLOAT_CMP\n    0.36208800460262575\n    >>> sep.hour  # doctest: +FLOAT_CMP\n    1.3830742984029323\n    >>> sep.arcminute  # doctest: +FLOAT_CMP\n    1244.7668685626388\n    >>> sep.arcsecond  # doctest: +FLOAT_CMP\n    74686.01211375833\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    >>> from astropy.coordinates import SkyCoord\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.743988157814094 kpc>\n\nThere is also a :meth:`~astropy.coordinates.SkyCoord.spherical_offsets_to` method\nfor 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    >>> from astropy.coordinates import SkyCoord\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.78873354064126 arcsec>\n    >>> ddec.to(u.arcsec)  # doctest: +FLOAT_CMP\n    <Angle 10.605103417374696 arcsec>\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: +SKIP\n    <SkyOffsetICRS Coordinate (rotation=0.0 deg, origin=<ICRS Coordinate: (ra, dec) in deg\n        (10.0, 45.0)>): (lon, lat) in deg\n        (0.0, 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 an skyoffset\nframe from an already-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    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.5920694752086249 deg>\n    >>> eta  # doctest: +FLOAT_CMP\n    <Latitude 7.261837574183891 deg>\n\n\n\n.. _astropy-coordinates-matching:\n\nMatching Catalogs\n=================\n\n`~astropy.coordinates` supports leverages the coordinate framework to make it\nstraightforward 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    >>> from astropy.coordinates import SkyCoord\n    >>> from astropy import units as u\n    >>> c = SkyCoord(ra=ra1*u.degree, dec=dec1*u.degree)  # doctest: +SKIP\n    >>> catalog = SkyCoord(ra=ra2*u.degree, dec=dec2*u.degree)  # doctest: +SKIP\n    >>> idx, d2d, d3d = c.match_to_catalog_sky(catalog)  # doctest: +SKIP\n\nThe 3-dimensional 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    >>> c = SkyCoord(ra=ra1*u.degree, dec=dec1*u.degree, distance=distance1*u.kpc)  # doctest: +SKIP\n    >>> catalog = SkyCoord(ra=ra2*u.degree, dec=dec2*u.degree, distance=distance2*u.kpc)  # doctest: +SKIP\n    >>> idx, d2d, d3d = c.match_to_catalog_3d(catalog)  # doctest: +SKIP\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    >>> matches = catalog[idx]  # doctest: +SKIP\n    >>> (matches.separation_3d(c) == d3d).all()  # doctest: +SKIP\n    True\n    >>> dra, ddec = c.spherical_offsets_to(matches)  # doctest: +SKIP\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    >>> from astropy.coordinates import match_coordinates_sky\n    >>> idx, d2d, d3d = match_coordinates_sky(c, catalog)  # doctest: +SKIP\n    >>> idx, d2d, d3d = match_coordinates_sky(c.frame, catalog.frame)  # doctest: +SKIP\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    >>> idxc, idxcatalog, d2d, d3d = catalog.search_around_sky(c, 1*u.deg)  # doctest: +SKIP\n    >>> np.all(d2d < 1*u.deg)  # doctest: +SKIP\n    True\n    >>> idxc, idxcatalog, d2d, d3d = catalog.search_around_3d(c, 1*u.kpc)  # doctest: +SKIP\n    >>> np.all(d3d < 1*u.kpc)  # doctest: +SKIP\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    >>> np.all(c[idxc].separation(catalog[idxcatalog]) == d2d)  # doctest: +SKIP\n    True\n    >>> np.all(c[idxc].separation_3d(catalog[idxcatalog]) == d3d)  # doctest: +SKIP\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(1*u.deg, 2*u.deg)  # doctest: +SKIP\n    >>> idxscalarc, idxcatalog, d2d, d3d = catalog.search_around_sky(scalarc, 1*u.deg)  # THIS DOESN'T ACTUALLY WORK  # doctest: +SKIP\n    >>> scalarc[idxscalarc]  # doctest: +SKIP\n    IndexError: 0-d arrays can't be indexed\n\nAs a result (and because the ``search_around_*`` algorithm is inefficient in\nthe scalar case, anyway), the best approach for this scenario is to instead\nuse the ``separation*`` methods::\n\n    >>> d2d = scalarc.separation(catalog)  # doctest: +SKIP\n    >>> catalogmsk = d2d < 1*u.deg  # doctest: +SKIP\n    >>> d3d = scalarc.separation_3d(catalog)  # doctest: +SKIP\n    >>> catalog3dmsk = d3d < 1*u.kpc  # doctest: +SKIP\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    >>> idxcatalog = np.where(catalogmsk)[0]  # doctest: +SKIP\n    >>> idxcatalog3d = np.where(catalog3dmsk)[0]  # doctest: +SKIP\n"},{"id":324,"name":"references.txt","nodeType":"TextFile","path":"docs/coordinates","text":".. |skycoord| replace:: `~astropy.coordinates.SkyCoord`\n.. |quantity| replace:: `~astropy.units.Quantity`\n.. |Angle| replace:: `~astropy.coordinates.Angle`\n.. |Longitude| replace:: `~astropy.coordinates.Longitude`\n.. |Latitude| replace:: `~astropy.coordinates.Latitude`\n.. |baseframe| replace:: `~astropy.coordinates.BaseCoordinateFrame`\n"},{"id":325,"name":"remote_methods.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _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\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    >>> EarthLocation.of_site('Apache Point Observatory')  # doctest: +REMOTE_DATA +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\nWhile these methods are convenient, there are several considerations to take into 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 running\n  now 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: +REMOTE_DATA\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: +REMOTE_DATA +FLOAT_CMP\n    <EarthLocation (-1994502.6043061386, -5037538.54232911, 3358104.9969029757) m>\n\n  This can then easily be converted to 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 use 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":326,"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 theses 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 transforms 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":0,"comment":"\n    Test whether a string is a valid URL\n\n    Parameters\n    ----------\n    string : str\n        The string to test\n    ","endLoc":98,"header":"def _is_url(string)","id":327,"name":"_is_url","nodeType":"Function","startLoc":85,"text":"def _is_url(string):\n    \"\"\"\n    Test whether a string is a valid URL\n\n    Parameters\n    ----------\n    string : str\n        The string to test\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":328,"name":"transforming.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _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 `~astropy.coordinates` API\ndocumentation.\n\nThe simplest 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 simple 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\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 easily 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\nAdditionally, some coordinate frames (including `~astropy.coordinates.FK5`,\n`~astropy.coordinates.FK4`, and `~astropy.coordinates.FK4NoETerms`) support\n\"self transformations\", meaning the *type* of frame doesn't change, but the\nframe attributes do.  Any 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 don't specify one::\n\n    >>> fk5c = SkyCoord('02h31m49.09s', '+89d15m50.8s', frame=FK5)\n    >>> fk5c.equinox\n    <Time object: scale='utc' 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 an\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', scale='utc')))\n    >>> fk5_2000 = FK5(equinox=Time(2000, format='jyear', scale='utc'))\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.. _astropy-coordinates-transforming-ephemerides:\n\nTransformations and Solar-system ephemerides\n============================================\n\nSome transformations (e.g. the transformation between `~astropy.coordinates.ICRS` and\n`~astropy.coordinates.GCRS`) require the use of a Solar-system ephemeris to calculate\nthe position and velocity of the Earth and Sun. By default, transformations are\ncalculated using built-in `ERFA <https://github.com/liberfa/erfa>`_ routines,\nbut they can also use more precise ones using the JPL ephemerides (which are derived from\ndynamical models).\n\nTo use the JPL ephemerides, use the `~astropy.coordinates.solar_system_ephemeris` context\nmanager, 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 ephemerides will make a\nnegligible difference, on the order of micro-arcseconds. For nearby objects, such as the Moon,\nthe difference can be of the order of milli-arcseconds. For more details about what ephemerides\nare available, including the requirements for using JPL ephemerides, see :ref:`astropy-coordinates-solarsystem`.\n\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":36,"header":"def possible_filename(filename)","id":329,"name":"possible_filename","nodeType":"Function","startLoc":19,"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":330,"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.\nFor example::\n\n  >>> from astropy.coordinates import ICRS\n  >>> from astropy import units as u\n  >>> c = ICRS(187.70592*u.degree, 12.39112*u.degree)\n  >>> str(c.ra) + ' ' + str(c.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 = c.ra.to_string(u.hour)\n  >>> str(rahmsstr)\n  '12h30m49.4208s'\n  >>> decdmsstr = c.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  >>> 'SDSS J{0}{1}'.format(c.ra.to_string(unit=u.hourangle, sep='', precision=2, pad=True), c.dec.to_string(sep='', precision=2, alwayssign=True, pad=True))\n  'SDSS J123049.42+122328.03'\n  >>> 'The galaxy M87, at an RA of {0.ra.hour:.2f} hours and Dec of {0.dec.deg:.1f} degrees, has an impressive jet.'.format(c)\n  'The galaxy M87, at an RA of 12.51 hours and Dec of 12.4 degrees, has an impressive jet.'\n"},{"id":331,"name":"velocities.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _astropy-coordinates-velocities:\n\nWorking with velocities in Astropy coordinates\n**********************************************\n\n.. warning::\n    Velocities support, new in Astropy v2.0, is an experimental feature and is\n    subject to change based on user feedback.  While we do not expect major API\n    changes, the possibility exists based on the precedent of earlier changes\n    in the ``coordinates`` subpackage based on user feedback from previous\n    versions of Astropy.\n\n.. _astropy-coordinate-custom-frame-with-velocities:\n\nCreating frame objects with velocity data\n=========================================\n\nThe coordinate frame classes now support storing and transforming velocity data\n(along side the positional coordinate data). Similar to the positional data ---\nthat use the ``Representation`` classes to abstract away the particular\nrepresentation and allow re-representing from, e.g., Cartesian to Spherical\n--- the 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\n    >>> from astropy.coordinates import ICRS\n    >>> import astropy.units as u\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\nThe expected differential class can be changed to control the argument names\nthat the frame expects. As mentioned above, by default the proper motions\ncomponents are expected to contain the ``cos(latitude)``, but this can be\nchanged by specifying the `~astropy.coordinates.SphericalDifferential` class\n(instead of the default `~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_cls=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=CartesianRepresentation,\n    ...          differential_cls=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=CartesianRepresentation,\n    ...      differential_cls=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\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.. _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 trasnfromations)\nis done  exactly the same way transforming position-only frame instances::\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\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` subclassese:\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\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 requires 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\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 non-linear.\nAdditionally, some frames are simply more easily 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 the exact\nsame manner as (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    re-orienting 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    ``obtime`` frame attribute, although it is an option that can be set when\n    defining a finite difference transformation function.\n\n\nHowever, it 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. Lets try to compute the radial velocity in the GCRS\nframe 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's 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 clearly nonsense, with values from -1000 to 1000 km/s.  The\nroot of the problem here is that the machine precision is not sufficient to\ncomputedifferences of order km over distances of order kiloparsecs.  Hence, the\nstraightforward finite difference method will not work for this use case with\nthe default values.\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: +SKIP\n    >>> trans.finite_difference_dt = 1*u.second  # return to default\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 to\na particular direction changes dramatically over the course of one year).\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\n``SkyCoord`` support for Velocities\n===================================\n\n|skycoord| currently does *not* support velocities as of Astropy v2.0.  This is\nan intentional choice, allowing the \"power-user\" community to provide feedback\non the API and functionality in the frame-level classes before it is adopted in\n|skycoord| (currently planned for the next Astropy version, v3.0).\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 simply\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\nAn example of this is below.  It demonstrates how to compute this correction if\nobserving some object at a known RA and Dec from the Keck observatory at a\nparticular time.  If a precision of around 3 m/s is sufficient, the computed\ncorrection can then be added to any observed radial velocity to determine\nthe final heliocentric radial 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)\n    >>> barycorr.to(u.km/u.s)  # doctest: +FLOAT_CMP\n    <Quantity 20.077135 km / s>\n    >>> heliocorr = sc.radial_velocity_correction('heliocentric', obstime=Time('2016-6-4'), location=keck)\n    >>> heliocorr.to(u.km/u.s)  # doctest: +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\nPrecision of `~astropy.coordinates.SkyCoord.radial_velocity_correction`\n------------------------------------------------------------------------\n\nThe correction computed by `~astropy.coordinates.SkyCoord.radial_velocity_correction`\ncan be added to any observed radial velocity to provide a correction that is accurate\nto a level of approximately 3 m/s. If you need more precise corrections, there are a number\nof subtleties you must be aware of.\n\nThe first is that one should always use a barycentric correction, as the barycenter is a fixed\npoint where gravity is constant. Since the heliocentre does not satisfy these conditions, corrections\nto the heliocentre are only suitable for low precision work. As a result, and\nto increase speed, the heliocentric correction in\n`~astropy.coordinates.SkyCoord.radial_velocity_correction` does not include effects such as the\ngravitational redshift due to the potential at the Earth's surface. For these reasons, the\nbarycentric correction in `~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 level are outlined\nin `Wright & Eastmann (2014) <http://adsabs.harvard.edu/abs/2014PASP..126..838W>`_. Most important\nis that the barycentric correction is, strictly speaking, *multiplicative*, so that one should apply it\nas\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 radial velocity and :math:`v_b`\nis the barycentric correction returned by `~astropy.coordinates.SkyCoord.radial_velocity_correction`.\nFailure to apply the 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 infinite distance. We do not include\nthe Shapiro delay, nor any effect related to the finite distance or proper motion of the source.\nThe Shapiro delay is unlikely to be important unless you seek mm/s precision, but the effects of the\nsource's parallax and proper motion can be important at the cm/s level. These effects are likely to be\nadded to future versions of Astropy along with velocity support for |skycoord|, but in the meantime\nsee `Wright & Eastmann (2014) <http://adsabs.harvard.edu/abs/2014PASP..126..838W>`_.\n"},{"id":332,"name":"index.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. We call EarthLocation.of_site here first to force the downloading\n.. of sites.json so that future doctest output isn't clutted 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\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 simplest way to use `~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. Commonly sky\npositions are passed in as `~astropy.units.Quantity` objects and the frame is\nspecified with the string name. As an example of creating a |skycoord| to\nrepresent an ICRS (Right ascension [RA], Declination [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 simple 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|skycoord| and all other `~astropy.coordinates` objects also support\narray coordinates.  These work the same as single-value coordinates, but\nthey store multiple coordinates in a single object.  When you're 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.::\n\n    >>> c = SkyCoord(ra=[10, 11, 12, 13]*u.degree, dec=[41, -5, 42, 0]*u.degree)\n    >>> c  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [(10., 41.), (11., -5.), (12., 42.), (13.,  0.)]>\n    >>> c[1]  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (11., -5.)>\n    >>> c.reshape(2, 2)  # doctest: +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        [[(10., 41.), (11., -5.)],\n         [(12., 42.), (13.,  0.)]]>\n\nCoordinate access\n-----------------\n\nOnce you have a coordinate object you can access the components of that\ncoordinate (e.g., RA, Dec) and get string representations of the full\ncoordinate.\n\nThe component values are accessed using (typically lower-case) 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\nThe simplest way to transform to a new coordinate frame is by accessing\nthe appropriately-named attribute.  For instance to get the coordinate in\nthe `~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\nThis form of `~astropy.coordinates.SkyCoord.transform_to` also makes it\nstraightforward 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 the all 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.  This can be done by setting\nthe ``representation`` for either |skycoord| objects or low-level frame\ncoordinate objects::\n\n    >>> c = SkyCoord(x=1, y=2, z=3, unit='kpc', representation='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 = '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 the details see :ref:`astropy-skycoord-representations`.\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 coordiante frame;\nthis can be, e.g., centered on the earth, centered on the solar system\nbarycenter, etc. Two angles and a distance specify a unique point in 3D space,\nwhich also allows converting 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\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\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\ncross-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\nThe `astropy.coordinates` subpackage 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    >>> SkyCoord.from_name(\"PSR J1012+5307\")  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <SkyCoord (ICRS): (ra, dec) in deg\n        (153.1393271, 53.117343)>\n\nFor sites (primarily observatories) on the Earth, `astropy.coordinates` provides\na quick way to get an `~astropy.coordinates.EarthLocation`::\n\n    >>> from astropy.coordinates import EarthLocation\n    >>> EarthLocation.of_site('Apache Point Observatory')  # doctest: +REMOTE_DATA +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, and etc.::\n\n    >>> EarthLocation.of_address('1002 Holy Grail Court, St. Louis, MO')  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <EarthLocation (-26726.98216371, -4997009.8604809, 3950271.16507911) m>\n    >>> EarthLocation.of_address('1002 Holy Grail Court, St. Louis, MO',\n    ...                          get_height=True)  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <EarthLocation (-26727.6272786, -4997130.47437768, 3950367.15622108) m>\n    >>> EarthLocation.of_address('Danbury, CT')  # doctest: +REMOTE_DATA +FLOAT_CMP\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 rather simple. If you need 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    <http://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: +REMOTE_DATA\n    >>> keck = EarthLocation.of_site('Keck')  # doctest: +REMOTE_DATA\n    >>> target.radial_velocity_correction(obstime=obstime, location=keck).to('km/s')  # doctest: +REMOTE_DATA +FLOAT_CMP\n    <Quantity -22.359784554780255 km / s>\n\nVelocities (Proper Motions and Radial Velocities)\n-------------------------------------------------\n\nNew in Astropy v2.0, the :doc:`coordinate frame classes <frames>` can now store\nand transform velocities along with positional coordinate information. This\nis not available from the |skycoord| class as this new functionality is\nexperimental, but is accessible  for more information see the :doc:`velocities` page.\n\n.. _astropy-coordinates-overview:\n\nOverview of `astropy.coordinates` concepts\n==========================================\n\n.. note ::\n    The `~astropy.coordinates` package from v0.4 onward builds from\n    previous versions of  the package, and more detailed information and\n    justification of the design is available in `APE (Astropy Proposal for Enhancement) 5 <https://github.com/astropy/astropy- APEs/blob/master/APE5.rst>`_.\n\nHere we provide an overview of the package and associated framework.\nThis background information is not necessary for simply using\n`~astropy.coordinates`, particularly if you use the |skycoord| high-\nlevel class, but it is helpful for more advanced usage, particularly\ncreating your own frame, transformations, or representations. Another\nuseful 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 simplicity of the |skycoord|\nclass.\n\n.. topic:: Examples:\n\n    See :ref:`sphx_glr_generated_examples_coordinates_plot_obs-planning.py` for an\n    example of using the `~astropy.coordinates` functionality to prepare for an\n    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   formatting\n   matchsep\n   representations\n   frames\n   velocities\n   galactocentric\n   remote_methods\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 looking at it directly if you\ndownloaded a copy of the astropy source code, or typing the following in an\nIPython session::\n\n    In [1]: from astropy.coordinates.tests import test_api_ape5\n    In [2]: test_api_ape5??\n\n\n.. _astropy-coordinates-seealso:\n\nSee Also\n========\n\nSome references particularly useful in understanding subtleties of the\ncoordinate systems implemented here include:\n\n* `USNO Circular 179 <http://aa.usno.navy.mil/publications/docs/Circular_179.php>`_\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\n\n.. _astropy-coordinates-api:\n\nReference/API\n=============\n\n.. automodapi:: astropy.coordinates\n"},{"id":333,"name":"angles.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _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 an 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\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('1d2m3.4s')              # Degree, arcmin, arcsec.  # doctest: +FLOAT_CMP\n    <Angle 1.03427778 deg>\n    >>> Angle('-1h2m3s')               # Hour, minute, second  # 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\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\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.8062s'\n    >>> a.to_string(unit=u.degree, sep=':')\n    '57:17:44.8062'\n    >>> a.to_string(unit=u.degree, sep=('deg', 'm', 's'))\n    '57deg17m44.8062s'\n    >>> a.to_string(unit=u.hour)\n    '3h49m10.9871s'\n    >>> a.to_string(unit=u.hour, decimal=True)\n    '3.81972'\n\n\nUsage\n=====\n\nAngles will also behave correctly for appropriate 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|Angle| objects can also be used for creating coordinate objects::\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\nWrapping and bounds\n===================\n\nThere are two utility methods that simplify working with angles that should\nhave bounds.  The :meth:`~astropy.coordinates.Angle.wrap_at` method allows\ntaking an angle or angles and wrapping to be within a single 360 degree slice.\nThe :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 that range will result in a\n`ValueError`.\n"},{"id":334,"name":"galactocentric.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. _coordinates-galactocentric:\n\n********************************************************\nDescription of Galactocentric coordinates transformation\n********************************************************\n\nThis document describes the mathematics behind the transformation from\n:class:`~astropy.coordinates.ICRS` to `~astropy.coordinates.Galactocentric`\ncoordinates. This is described in detail here both due to 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 transformations will rotate the :math:`x_{\\rm icrs}` axis so\nthat the new :math:`x'` axis points towards the Galactic Center (GC),\nspecified by the ICRS position :math:`(\\alpha_{\\rm GC}, \\delta_{\\rm GC})`:\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 <http://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"},{"id":335,"name":"solarsystem.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. _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 built-in `ERFA <https://github.com/liberfa/erfa>`_ 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 years between 1550 and 2650. The file is 115 MB and will need\nto be downloaded the first time you use this functionality, but will be cached\nafter that.\n\n.. note::\n   Using JPL ephemerides requires that the `jplephem\n   <https://pypi.python.org/pypi/jplephem>`_ package be installed. This is\n   most easily 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, whilst the\nlatter returns a `~astropy.coordinates.CartesianRepresentation` of the\nbarycentric position of a body (i.e in the `~astropy.coordinates.ICRS` frame).\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.68990863, -550931.91188162, 4961151.73733451) m, obsgeovel=(40.15954083, 287.47876693, -0.04597867) m / s): (ra, dec, distance) in (deg, deg, AU)\n      (136.91116209, 17.02935409, 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, one could use the ``de430`` ephemeris mentioned\nabove, but between 1950 and 2050 one could also opt for the ``de432s``\nephemeris, which is stored in a smaller, ~10 MB, file (which will be\ndownloaded and cached when the ephemeris 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.68990897, -550931.9118838,  4961151.73733447) m, obsgeovel=( 40.1745933,  288.00078051,  0.) m / s): (ra, dec, distance) in (deg, deg, km)\n      ( 136.90234781,  17.03160686,   8.89196019e+08)>\n  >>> get_moon(t, loc) # doctest: +REMOTE_DATA, +FLOAT_CMP\n  <SkyCoord (GCRS: obstime=2014-09-22 23:22:00.000, obsgeoloc=( 3949481.6899252, -550931.91194065,  4961151.73733445) m, obsgeovel=( 40.1745933,  288.00078051,  0.) m / s): (ra, dec, distance) in (deg, deg, km)\n          ( 165.51849193,  2.32863887,  407229.65033585)>\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, one 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 km\n      (  1.50107513e+08, -866838.51786769, -418988.57509287)>\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"},{"id":336,"name":"frames.rst","nodeType":"TextFile","path":"docs/coordinates","text":".. include:: references.txt\n\n.. We call EarthLocation.of_site here first to force the downloading\n.. of sites.json so that future doctest output isn't clutted 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\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    OrderedDict([('equinox', <Time object: scale='utc' 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 with UTC scale (see\n:ref:`astropy-time-inferring-input`)::\n\n    >>> f = FK5(equinox='J1975')\n    >>> f.equinox\n    <Time object: scale='utc' 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 keeping the\nimplementation of frame classes simple.  As such, they are created\nsimilarly to |skycoord| object.  The simplest 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`` 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 the system is expressed in (e.g.,\nspherical for equatorial frames), and the latter will be a dictionary\nmapping names for that frame to the attribute name on the representation\nclass::\n\n    >>> import astropy.units as u\n    >>> icrs = ICRS(1*u.deg, 2*u.deg)\n    >>> icrs.representation\n    <class 'astropy.coordinates.representation.SphericalRepresentation'>\n    >>> icrs.representation_component_names\n    OrderedDict([('ra', 'lon'), ('dec', 'lat'), ('distance', 'distance')])\n\nOne 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 actually does *nothing* to the object internal data which\nstores the coordinate values, but it changes the external view of that data in\ntwo ways: (1) the object prints itself in accord with the new representation,\nand (2) the available attributes change to match those of the new\nrepresentation (e.g. from ``ra, dec, distance`` to ``x, y, z``).  Setting the\n``representation`` thus changes a *property* of the object (how it appears)\nwithout changing the intrinsic object itself which represents a point in 3d\nspace.::\n\n    >>> from astropy.coordinates import CartesianRepresentation\n    >>> icrs.representation = 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=CartesianRepresentation)  #  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 preset, 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.  E.g.::\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: +IGNORE_OUTPUT\n    >>> lcoo  # doctest: +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, obswl=1.0 micron): (az, alt) in deg\n        [( 94.71264944, 89.21424252), (307.69488825, 37.98077771)]>\n\nAbove, the shapes -- ``()`` for ``coo`` and ``(2,)`` for ``lf`` -- were\nbroadcast against each other.  If you wished to determine the positions for a\nset of coordinates, you'd need to make sure that the shapes allowed 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: shape mismatch: objects cannot be broadcast to a single shape\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: +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.9024681724, -102.47522910648239, 4966861.273100675) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0, obswl=1.0 micron): (az, alt) in deg\n        [[( 93.09845202, 89.21613119), (126.85789652, 25.46600543),\n          ( 51.37993229, 37.18532521)],\n         [(307.71713699, 37.99437658), (231.37407871, 26.36768329),\n          ( 85.42187335, 89.69297997)]]>\n\n.. Note::\n   One sees that frames without data have a ``shape`` that is determined by\n   their frame attributes.  For frames with data the ``shape`` always is that\n   of the data; any non-scalar attributes are broadcast to have matching shape\n   (as can be seen for ``obstime`` in the last line above).\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 can either be a frame *class*, in which case\nthe default attributes will be used, or a frame object (with or without\ndata)::\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 to. 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\nUsers can add new coordinate frames by creating new classes that are subclasses\nof `~astropy.coordinates.BaseCoordinateFrame`.  Detailed instructions for\nsubclassing are in the docstrings for that class.  The key aspects are to\ndefine the class attributes ``default_representation`` and\n``frame_specific_representation_info`` along with frame attributes as\n`~astropy.coordinates.Attribute` class instances (or subclasses like\n`~astropy.coordinates.TimeAttribute`).  If these are\ndefined, there is often no need to define an ``__init__`` function, as the\ninitializer in `~astropy.coordinates.BaseCoordinateFrame` will probably behave\nthe way you want.  As an example::\n\n  >>> from astropy.coordinates import BaseCoordinateFrame, Attribute, TimeAttribute, RepresentationMapping\n  >>> import astropy.coordinates.representation as r\n  >>> class MyFrame(BaseCoordinateFrame):\n  ...     # Specify how coordinate values are represented when outputted\n  ...      default_representation = r.SphericalRepresentation\n  ...\n  ...      # Specify overrides to the default names and units for all available\n  ...      # representations (subclasses of BaseRepresentation).\n  ...      frame_specific_representation_info = {\n  ...          r.SphericalRepresentation: [RepresentationMapping(reprname='lon', framename='R', defaultunit=u.rad),\n  ...                                      RepresentationMapping(reprname='lat', framename='D', defaultunit=u.rad),\n  ...                                      RepresentationMapping(reprname='distance', framename='DIST', defaultunit=None)],\n  ...          r.UnitSphericalRepresentation: [RepresentationMapping(reprname='lon', framename='R', defaultunit=u.rad),\n  ...                                          RepresentationMapping(reprname='lat', framename='D', defaultunit=u.rad)],\n  ...          r.CartesianRepresentation: [RepresentationMapping(reprname='x', framename='X'),\n  ...                                      RepresentationMapping(reprname='y', framename='Y'),\n  ...                                      RepresentationMapping(reprname='z', framename='Z')]\n  ...      }\n  ...\n  ...      # Specify frame attributes required to fully specify the frame\n  ...      location = Attribute(default=None)\n  ...      equinox = TimeAttribute(default='B1950')\n  ...      obstime = TimeAttribute(default=None, secondary_attribute='equinox')\n\n  >>> c = MyFrame(R=10*u.deg, D=20*u.deg)\n  >>> c  # doctest: +FLOAT_CMP\n  <MyFrame Coordinate (location=None, equinox=B1950.000, obstime=B1950.000): (R, D) in rad\n      (0.17453293, 0.34906585)>\n  >>> c.equinox\n  <Time object: scale='utc' format='byear_str' value=B1950.000>\n\nIf you also want to support velocity data in your coordinate frame, see the\nvelocities documentation at\n:ref:`astropy-coordinate-custom-frame-with-velocities`.\n\nYou can also define arbitrary methods for any added functionality you\nwant your frame to have that's 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\nprobably the source code for the frames that are included in astropy\n(available at ``astropy.coordinates.builtin_frames``).  These are not\n\"magic\" in any way, and use all 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\n\nDefining Transformations\n========================\n\nA frame may not be too useful without a way to transform coordinates\ndefined in it to or from other frames. Fortunately,\n`astropy.coordinates` provides a framework to do just that.  The key\nconcept for these transformations is the frame transform graph,\navailable as ``astropy.coordinates.frame_transform_graph``, an instance of\nthe `~astropy.coordinates.TransformGraph` class.  This graph (in the\n\"graph theory\" sense, not \"plot\"), stores all the transformations\nbetween all of the builtin frames, as well as tools for finding shortest\npaths through this graph to transform from any frame to any other.  All\nof the power of this graph is available to user-created frames as well, meaning\nthat once you define even one transform from your frame to some frame in\nthe graph,  coordinates defined in your frame can be transformed to\n*any* other frame in the graph.\n\nThe transforms themselves are represented as\n`~astropy.coordinates.CoordinateTransform` objects or their subclasses. The useful\nsubclasses/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`'s without\n    a translation, i.e. a rotation. The static version is for\n    the case where the matrix is independent of the frame attributes\n    (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\n\nGenerally, it is not necessary to use these classes directly.  Instead,\nuse methods on ``frame_transform_graph`` that can be used as function\ndecorators.  Then just define functions that either do the actual\ntransformation (for FunctionTransform), or that compute the necessary\ntransformation matrices to transform. Then decorate the functions to\nregister 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"},{"id":337,"name":"docs/development","nodeType":"Package"},{"id":338,"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.iosetuptools.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.py`` ::\n\n    entry_points['console_scripts'] = [\n        'somescript = astropy.somepackage.somemod:main',\n        ...\n    ]\n"},{"id":339,"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`distutils.core.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 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 extensions automatically generated extensions. Note\nthat this allows disabling a Cython file by providing an extension that\nincludes the Cython file, but giving it the special ``name`` 'cython_skip'. Any\nextension with this package name will not be built by ``setup.py``.\n\n.. note::\n\n    If an :class:`~distutils.core.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.  A common idiom you can find in the numpy\ndocs or other examples involves getting the include directory by calling\n``numpy.get_include()``.  However, using this in ``setup_package.py`` will *not*\nwork, because ``setup_package.py`` needs to be able to import even when none of\nthe dependencies are present.  To work around this need, simply include the\nstring ``'numpy'`` in the list that is passed to the ``include_dirs`` argument\nof `distutils.core.Extension`.  The astropy setup helpers will then use\n``numpy.get_include()`` downstream once it is certain that the dependencies\nhave actually been processed.  For example::\n\n    from distutils.extension import Extension\n\n    def get_extensions():\n        return Extension(name='myextension', sources=['myext.pyx'],\n                         include_dirs=['numpy'])\n\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 ``get_package_data`` hook in ``setup_package.py`` to\n       install those header files.  For example, the `astropy.wcs`\n       package has this::\n\n           def get_package_data():\n               return {'astropy.wcs': ['include/*.h']}\n\nPreventing importing at build time\n==================================\n\nIn rare cases, some packages may need to be imported at build time.\nUnfortunately, anything that requires a C or Cython extension will fail to\nimport until the build phase has completed. In this cases, the\n``_ASTROPY_SETUP_`` variable can be used to determine if the package is being\nimported as part of the build and choose to not import problematic modules.\n``_ASTROPY_SETUP_`` is inserted into the builtins, and is `True` when inside\nof astropy's ``setup.py`` script, and `False` otherwise.\n\nFor example, suppose there is a subpackage ``foo`` that needs to\nimport a module called ``version.py`` at build time in order to set\nsome version information, and also has a C extension, ``process``,\nthat will not be available in the source tree.  In this case,\n``astropy/foo/__init__.py`` would probably want to check the value of\n``_ASTROPY_SETUP_`` before importing the C extension::\n\n    try:\n        from . import process\n    except ImportError:\n        if not _ASTROPY_SETUP_:\n            raise\n\n    from . import version\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":340,"name":"codeguide_emacs.rst","nodeType":"TextFile","path":"docs/development","text":"*******************************************\nEmacs setup for following coding guidelines\n*******************************************\n\n.. _flycheck: http://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/blog/python/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, indendation 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":341,"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\nboth for the core package and for affiliated packages.\n\n.. note:: Affiliated packages will only be considered for integration as a\n          module in the core package once these guidelines have been\n          followed.\n\nInterface and Dependencies\n==========================\n\n* All code must be compatible with Python 3.5 and later.\n  Usage of ``six``, ``__future__``, and ``2to3`` is not longer acceptable.\n\n* The new Python 3 formatting style should be used (i.e.\n  ``\"{0:s}\".format(\"spam\")`` instead of ``\"%s\" % \"spam\"``).\n\n* The core package and affiliated packages 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* The package should be importable from the source tree at build time. This\n  means that, for example, if the package relies on C extensions that have\n  yet to be built, the Python code is still importable, even if none of its\n  functionality will work. One way to ensure this is to import the functions\n  in the C extensions only within the functions/methods that require them\n  (see next bullet point).\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.\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 below> will not work.'))\n          class SuperClass(object): pass\n\n      class Whatever(Superclass):\n          ...\n\n  In the astropy core package, such optional dependencies should be recorded in\n  the ``pip-requirements-dev`` file in the root of the repository.\n\n* General utilities necessary for but not specific to the package or\n  sub-package should be placed in the ``packagename.utils`` module. These\n  utilities will be moved to the :mod:`astropy.utils` module when the\n  package is integrated into the core package. If a utility is already\n  present in :mod:`astropy.utils`, the package should always use that\n  utility instead of re-implementing it in ``packagename.utils`` module.\n\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  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 `logging\n<https://docs.python.org/3/library/logging.html>`_ module. The logger can\nbe imported using::\n\n    from astropy import log\n\nCoding Style/Conventions\n========================\n\n* The code will 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* *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* One exception is to be made from the PEP8 style: new style relative imports\n  of the form ``from . import modname`` are allowed and required for Astropy,\n  as opposed to absolute (as PEP8 suggests) or the simpler ``import modname``\n  syntax. This is primarily due to improved relative import support since PEP8\n  was developed, and to simplify the process of moving modules.\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 ``import numpy as np``, ``import matplotlib as mpl``, and ``import\n  matplotlib.pyplot as plt`` naming conventions should be used wherever\n  relevant. ``from packagename import *`` should never be used, except as a\n  tool to flatten the namespace of a module. An example of the allowed usage\n  is given in :ref:`import-star-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. :ref:`prop-get-set-example`\n  below illustrates this guideline.\n\n* Classes should use the builtin :func:`super` function when making calls to\n  methods in their super-class(es) unless there are specific reasons not to.\n  :func:`super` should be used consistently in all subclasses since it does not\n  work otherwise.  :ref:`super-vs-direct-example` illustrates why this is\n  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.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 '<FloatList [{0}]>'.format(', '.join(\n                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, as per the\n  example in the template package. Cython_ extensions should store ``.pyx``\n  files in the source code repository, but they should be compiled to ``.c``\n  files that are updated in the repository when important changes are made to\n  the ``.pyx`` file.\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.\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\nCompatibility between versions of Numpy\n=======================================\n\nIn general, code should aim to be compatible with the lowest supported version\nof NumPy_.  Sometimes, however, it is inefficient to code repeatedly around\nbugs in earlier versions. For those cases, code can be added to\n`astropy.utils.compat.numpy`; see the corresponding :ref:`instructions\n<numpy-compatibility>` for details.\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 are required to follow the layout and documentation form\n  of the template package included in the core package source distribution.\n\n* Affiliated packages must be registered on the `Python Package Index\n  <https://pypi.python.org/pypi>`_, 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. Recommended naming\n  conventions for an affiliated package are either simply ``packagename``\n  or ``awastropy.packagename`` (\"affiliated with Astropy\").\n\n* If the affiliated package requires compatibility with Python 2, it should\n  pin to ``astropy<3`` until it is ready to drop Python 2 support.\n  On the other hand, package that only supports Python 3 may still use\n  ``astropy<3``. New affiliated packages created from Astropy's package template\n  should check with template maintainers regarding Python versions supported\n  if unsure.\n\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 ``':class:`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 :func:`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 :func:`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 :func:`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 :func:`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 :func:`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 ``':func:`foo'``\nand ``':class:`AClass'``, but not ``':class:`numpy.array'`` or\n``':func:`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: http://www.numpy.org/\n.. _Scipy: https://www.scipy.org/\n.. _matplotlib: http://matplotlib.org/\n.. _Cython: http://cython.org/\n.. _PyPI: https://pypi.python.org/pypi\n"},{"id":342,"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 agrees on a single toolkit that could be used, then\nthis 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":343,"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`_. The instructions below describe how to take this template and\nadjust it for your particular package, as well as how to update\nyour package to the latest version of the package template.\n\nThere are two main ways you can use this template layout to create a new\npackage:\n\n#. simply copy over the files you need manually\n\n#. start from a fork of the package-template repository\n\nThere are advantages and disadvantages to both methods. In the first case your\nrepository history will be clean and you will only include the files you really\nneed. However, when updating you will need to make sure you update all the\nfiles manually. In the second case, the history of your package will be\ncluttered with all the commits from the `package-template`_ repository, but if\ndone properly this can be easier to update in future since it simply involves\npulling from the latest version of the `package-template`_ repository and then\nmerging in the changes (and resolving conflicts).\n\n.. note:: The instructions below assume you are using git for version control,\n          as is used by the Astropy repository. If this is not the case,\n          hopefully it will be clear from context what to do with your\n          particular VCS.\n\nEverywhere below that the text ``<packagename>`` is shown, replace it with the\nname of your particular package. In fact, you can do this automatically by\nentering your package name in the box below:\n\n.. raw:: html\n\n    <form id=\"myform\">\n      Package name: <input type=\"text\" name=\"packagename\">\n      <button>Update package name</button>\n    </form>\n    <br>\n\nManaging the template files manually\n************************************\n\nStarting a new package\n======================\n\n#. Clone the `package-template`_ package so that we can have access to the\n   files, but do not go inside it - instead, create another empty repository\n   into which we will copy the required files::\n\n    git clone https://github.com/astropy/package-template.git template\n    mkdir <packagename>\n    cd <packagename>\n    git init\n\n#. The `package-template`_ infrastructure relies on the `astropy-helpers`_\n   package, and we recommend adding this as a sub-module so as to easily be\n   able to bundle it in releases of your packages::\n\n    git submodule add https://github.com/astropy/astropy-helpers.git astropy_helpers\n\n#. Copy over the following files from the package template (these define the\n   bare minimum of what is needed) and add them to the repository::\n\n    # .gitignore specifies which types of files to ignore in the repository\n    cp ../template/.gitignore .\n\n    # MANIFEST.in specifies which files to include in a tar file\n    release. Change all ``'packagename'`` text to be the name of your\n    package, <packagename>.\n    cp ../template/MANIFEST.in .\n\n    # ah_bootstrap.py is used by setup.py to use the astropy-helpers\n    cp ../template/ah_bootstrap.py .\n\n    # ez_setup.py is used by setup.py to be able to get setuptools on-the-fly\n    cp ../template/ez_setup.py .\n\n    # setup.cfg contains details about your package - edit it after copying!\n    # Note: it is important that the package_name variable matches the name you\n    #       are using for your package.\n    cp ../template/setup.cfg .\n\n    # edit the VERSION variable and if applicable, the package_data values,\n    # the rest can be kept as-is\n    # Note: If your package data directory has a sub-directory, you HAVE TO\n    #       break 'data/*' to 'data/*.*' and 'data/subdir/*' (two different\n    #       appends). If you do not have any package data, you can just comment\n    #       out the line that appends 'data/*'.\n    cp ../template/setup.py .\n\n   .. important:: Before proceeding, make sure you have edited\n                 ``MANIFEST.in``, ``setup.cfg`` and ``setup.py`` as\n                 indicated above!\n\n   Once you have edited ``MANIFEST.in``, ``setup.cfg`` and ``setup.py``, you\n   can commit the changes::\n\n    git add .gitignore MANIFEST.in ah_bootstrap.py ez_setup.py setup.cfg setup.py\n\n#. Next, you can create a directory for your package's source code, which will\n   usually also be called the same name as your package. In this directory\n   you can copy over the following files::\n\n    mkdir <packagename>\n\n    cp ../template/packagename/__init__.py <packagename>/\n    cp ../template/packagename/_astropy_init.py <packagename>/\n\n    # edit <packagename>/__init__.py to change the docstring and change the\n    # example import ``from example_mod import *`` to whatever is needed for\n    # your package. If you don't want to try out any specific code yet, just\n    # replace the import by ``pass``.\n\n   The main purpose of the ``_astropy_init.py`` file is to set up the\n   ``test()`` command at the root of your package so that you can do\n   ``<packagename>.test()``. This file is imported into ``__init__``.\n\n   .. important:: Before proceeding, make sure you have edited ``__init__.py`` as\n                  indicated above!\n\n   Once you have made the above changes, you can commit the files::\n\n    git add <packagename>/__init__.py\n    git add <packagename>/_astropy_init.py\n\n#. In order to benefit from the pytest plugins in Astropy, you should also\n   copy over the ``conftest.py`` file to your repository::\n\n    cp ../template/packagename/conftest.py <packagename>/\n\n    git add <packagename>/conftest.py\n\n   You can also uncomment the line ``enable_deprecations_as_exceptions()`` if\n   you want deprecation warnings to make tests fail. There are also\n   options to customize the information to be printed when running the\n   tests. The package template has comments in the ``conftest.py`` file that\n   indicate what they are.\n\n#. If you are interested in accurate coverage test results, copy over the\n   ``coveragerc`` and the ``setup_package.py`` files to your repository (the\n   latter ensures that ``coveragerc`` gets installed with the package::\n\n    mkdir <packagename>/tests/\n    cp ../template/packagename/tests/__init__.py <packagename>/tests\n    cp ../template/packagename/tests/setup_package.py <packagename>/tests\n    cp ../template/packagename/tests/coveragerc <packagename>/tests\n\n    git add <packagename>/tests/__init__.py\n    git add <packagename>/tests/setup_package.py\n    git add <packagename>/tests/coveragerc\n\n   to your repository. When you run tests with with ``--coverage`` option this\n   file will be used to exclude certain files that should not typically be\n   included. Note that you don't need to change the ``{packagename}`` string in\n   ``coveragerc`` - this gets changed automatically using the package name\n   defined in ``setup.cfg``.\n\n   .. note:: the ``python setup.py`` commands will not work until you\n             have made your first commit, as shown in the last step of these\n             instructions.\n\n#. To set up the infrastructure to build the documentation, copy over the\n   following files into a new directory called ``docs``::\n\n    mkdir docs\n    cp -r ../template/docs/_templates docs/\n    cp ../template/docs/Makefile docs/\n    cp ../template/docs/conf.py docs/\n    cp ../template/docs/make.bat docs/\n    touch docs/index.rst  # creates empty page\n    git add docs/_templates docs/Makefile docs/conf.py docs/make.bat docs/index.rst\n\n   you can later start adding content to ``index.rst`` and other documentation\n   files.\n\n#. Add a ``README.md`` file to your repository, describing what the package\n   does, and for example how to install it and any required dependencies::\n\n    git add README.md\n\n#. Finally, if you plan on using Travis for continuous integration, copy over\n   the ``.travis.yml`` file and edit it by replacing \"packagname\" with your\n   package.  (You can do a lot more to customize the travis builds.  More\n   detail on that below.)::\n\n    cp ../template/.travis.yml .\n    # edit .travis.yml\n    git add .travis.yml\n\n   .. important:: Before proceeding, make sure you have edited ``.travis.yml`` as\n                  indicated above!\n\n#. Double check that you have changed all the ``'packagename'`` references\n   in the configuration files to be <packagename>, the name of your package.\n\n#. Now you are ready to make your first commit::\n\n    git commit -m \"Initial layout for package\"\n\n#. You can test that your package works correctly by doing e.g.::\n\n    python setup.py build\n    python setup.py test --coverage\n    python setup.py build_docs\n\n   If you have any issues that you cannot fix, feel free to ask us on the\n   `astropy-dev mailing list`_!\n\nUpdating to the latest template files\n=====================================\n\nFrom time to time we will make changes to the package-template to fix bugs or\nadd functionality. Updating to the latest version is simple - simply check\nthe `TEMPLATE_CHANGES.md`_ file, which provides a changelog of the package\ntemplate. You can also re-copy over all the files listed in the above section\nand see if any of the changes should be committed (some of the changes will\nbe reverting some of your edits, so do not include those!). Remember to\nupdate the astropy-helpers sub-module to the latest stable version, and\nupdate the corresponding ``ah_bootstrap.py`` file, for example::\n\n    cd astropy_helpers\n    git fetch origin\n    git checkout v0.4.3\n    cd ..\n    cp astropy_helpers/ah_bootstrap.py .\n    git add astropy_helpers ah_bootstrap.py\n    git commit -m \"Updated astropy-helpers to v0.4.3\"\n\nYou can find out what the latest version of astropy-helpers is by checking the\n`astropy-helpers <https://pypi.python.org/pypi/astropy-helpers/>`__ entry on\nPyPI.\n\nCustomizing the documentation CSS\n=================================\n\nAs described in the documentation configuration file (`template/docs/conf.py\n<https://github.com/astropy/package-template/blob/master/docs/conf.py#L95>`_),\nthe documentation uses a custom theme based on `bootstrap\n<http://getbootstrap.com/css/>`_. You can swap out this theme by editing the\nconfiguration file. You can also tweak aspects of the documentation theme by\ncreating a custom CSS file in your package documentation.\n\nTo do this, create a new CSS file in ``<packagename>/_static/`` -- let's call it\n``<packagename>.css``::\n\n    cd <packagename>/_static/\n    touch <packagename>.css\n\nWe're going to set the HTML style to this new ``<packagename>.css`` stylesheet,\nso we need to import the original ``bootstrap-astropy`` style before we start\nmodifying entries. To the first line of your ``<packagename>.css`` file, import\nthe default style. We can add any custom CSS below the import. For example, to\nhide the Astropy logo and Astropy link from your project's documentation menu\nbar:\n\n.. code-block:: css\n\n    @import url(\"bootstrap-astropy.css\");\n\n    div.topbar a.brand {\n        background: none;\n        background-image: none;\n    }\n\n    div.topbar ul li a.homelink {\n        background: none;\n        background-image: none;\n    }\n\nWe now have to include the ``<packagename>.css`` in the documentation, and tell\nSphinx to use the new style. To do this, edit your\n``<packagename>/docs/conf.py`` file and add the lines::\n\n    # Static files to copy after template files\n    html_static_path = ['_static']\n    html_style = '<packagename>.css'\n\nManaging the template files via git\n***********************************\n\nStarting a new package\n======================\n\nBefore reading this we recommend reading over the `Managing the template\nfiles manually`_ section since this explains what many of the files do.\n\n#. Make sure `Astropy`_ is installed, as the template depends in part on\n   Astropy to do its setup.\n\n#. You may have already done this if you are looking at this file locally, but\n   if not, you will need to obtain a copy of the package template.  Assuming\n   you have `git`_ installed, just do::\n\n      git clone git://github.com/astropy/package-template.git <packagename>\n\n   This will download the latest version of the template from `github`_ and\n   place it in a directory named ``<packagename>``.\n\n#. Go into the directory you just created, and open the ``setup.cfg``\n   file with your favorite text editor.  Edit the settings in the\n   ``metadata`` section.  These values will be used to automatically\n   replace special placeholders in the package template.\n\n   #. Change the ``package_name`` variable to whatever you decide your\n      package should be named. By tradition/very strong suggestion,\n      python package names should be all lower-case.\n   #. Change the ``description`` variable to a short (one or few\n      sentence) description of your package.\n   #. Add your name and email address by changing the ``author`` and\n      ``author_email`` variables.\n   #. If your package has a website, change ``url`` to point\n      to that site.  Otherwise, you can leave it pointing to `Astropy`_\n      or just delete it.\n   #. Exit out of your text editor.\n\n#. Move the main source directory to reflect the name of your package.\n   To tell your DVCS about this move, you should use it, and not ``mv``\n   directly, to make the move.  For example, with git::\n\n    git mv packagename <packagename>\n\n#. Update the main package docstring in ``<packagename>/__init__.py``.\n\n#. Decide what license you want to use to release your source code. If\n   you don't care and/or are fine with the Astropy license, just edit\n   the file ``licenses/LICENSE.rst`` with your name (or your\n   collaboration's name) at the top as the licensees. Otherwise, make\n   sure to replace that file with whatever license you prefer, and\n   update the ``license`` variable in ``setup.cfg`` to reflect your\n   choice of license. You also may need to update the comment at the\n   top of ``<packagename>/__init__.py`` to reflect your choice of\n   license.\n\n#. Take a moment to look over the ``<packagename>/example_mod.py``,\n   ``<packagename>/tests/test_example.py``, and ``<packagename>/example_c.pyx``\n   files, as well as the ``<packagename>/example_subpkg`` directory.\n   These are examples of a pure-python module, a test script, a\n   `Cython`_ module, and a sub-package, respectively. (`Cython`_ is a\n   way to compile python-like code to C to make it run faster - see the\n   project's web site for details). These are provided as examples of\n   standard way to lay these out. Once you understand these, though,\n   you'll want to delete them (and later replace with your own)::\n\n      git rm <packagename>/example_c.pyx\n      git rm <packagename>/tests/test_example.py\n      git rm -r <packagename>/example_subpkg\n      git commit -m \"removed examples from package template\"\n\n#. Optional: If you're hosting your source code on github, you can\n   enable a sphinx extension that will link documentation pages\n   directly to github's web site. To do this, set ``edit_on_github`` in\n   ``setup.cfg`` to ``True`` and set ``github_project`` to the name of\n   your project on github.\n\n#. Update the names of the documentation files to match your package's name.\n   First open ``docs/index.rst`` in a text editor and change the text\n   ``\"packagename/index.rst\"`` to e.g., ``\"<packagename>/index.rst\"``.  Then do::\n\n      git add docs/index.rst\n      git mv docs/packagename docs/<packagename>\n\n#. Edit the ``README.rst`` file, deleting all of the content and replacing it\n   with a short description of your package.\n\n#.  Open ``docs/<packagename>/index.rst`` and you can start writing the documentation\n    for your package, but at least replace ``packagename`` in ``automodapi::``\n    with your package name.\n\n#. Now tell git to remember the changes you just made::\n\n      git commit -a -m \"Adjusted for new project <packagename>\"\n\n#. (This step assumes your package is hosted as part of the astropy\n   organization on Github.  If it's instead hosted somewhere else, just adjust\n   the URL in the instructions below to match wherever your repository lives)\n   Now you will want to tell git that it should be pushing and pulling updates\n   to the repository of *your* project, rather than the package template::\n\n      git remote rename origin template\n      git remote add upstream git@github.com:astropy/<packagename>.git\n\n   Now that it is pointing to the correct master, you should push everything up\n   to your project and make sure that your local master is tied to your project\n   rather than the template.  You'll only be able to do this if your github\n   repository is empty (if not, add the ``-f`` option to the ``push``\n   command - that will overwrite whatever is there)::\n\n      git push upstream master\n      git branch master --set-upstream upstream/master\n\n#. (optional) If you are adopting the standard workflow used by `Astropy`_ with\n   github, you will also want to set up a fork of the repo on your own account,\n   by going to the Github page https://github.com/astropy/<packagename> and clicking\n   the \"fork\" button on the upper right.  Then run the following commands::\n\n      git remote add origin git@github.com:yourgithubusername/<packagename>.git\n      git branch master --set-upstream origin/master\n\n   Now you can push, pull, and branch whatever you want in your local fork\n   without affecting the official version, but when you want to push something\n   up to the main repository, just switch to the appropriate branch and do\n   ``git push upstream master``.\n\n   Additionally, you can set things up to make it easier to pull future\n   changes to the package template to your package.  Add a remote\n   for the package template::\n\n      git remote add template git@github.com:astropy/package-template.git\n\n   .. _template-changes-with-gitfu:\n\n   Then, each time you want to pull in changes to the package template::\n\n      git fetch template\n      git fetch upstream\n\n      # Make your master match the upstream master.  This will destroy\n      # any unmerged commits on your master (which you shouldn't be doing\n      # work on anyway, according to the standard workflow).\n      git checkout master\n      git reset --hard upstream/master\n\n      # Merge any recent changes from the package-template\n      git merge template/master\n\n      # ...possibly resolve any conflicts...\n\n      # Push to upstream master\n      git push upstream master\n\n#. You should register your package on https://travis-ci.org and modify the\n   ``.travis.yml`` file to make the build pass. This will continuously test\n   your package for each commit, even pull requests against your main repository\n   will be automatically tested, so that you notice when something breaks.\n   For further information see\n   `here <https://github.com/astropy/astropy/wiki/Continuous-Integration>`__\n   and for lot's of example ``.travis.yml`` build configurations see\n   `here <https://github.com/astropy/astropy/wiki/travis-ci-test-status>`__.\n   Generally you should aim to always have your ``master`` branch work with\n   the latest stable as well as the latest development version of astropy\n   (i.e. the astropy git master branch) and the same versions of python and\n   numpy supported by astropy. The template ``.travis.yml`` covers those\n   versions; in some circumstances you may need to limit the versions your\n   package covers.\n\n#. If you register your package with coveralls.io, then you will need\n   to modify the ``coveralls --rcfile`` line in ``.travis.yml`` file to\n   replace ``packagename`` with the name of your package.\n\n#. If you want the documentation for your project to be hosted by\n   `Read the Docs <https://readthedocs.org>`_, then you need to setup an\n   account there. The following entries in \"Advanced Settings\" for your\n   package on `Read the Docs <https://readthedocs.org>`_ should work:\n\n   - activate ``Install your project inside a virtualenv using setup.py install``\n   - copy these additional files from the package template into the top-level\n     directory of your package: ``.rtd-environment.yml`` and ``readthedocs.yml``.\n     Edit ``.rtd-environment.yml`` with your package name and requirements.\n   - activate ``Give the virtual environment access to the global site-packages dir.``\n\n   All other settings can stay on their default value.\n\n   If you need to mock any Python packages or C libraries that can not be\n   installed and built by Read the Docs, you should include the following mocking\n   patch before the ``Project information`` section of the ``docs/conf.py`` file::\n\n      class Mock(object):\n          def __init__(self, *args, **kwargs):\n              pass\n\n          def __call__(self, *args, **kwargs):\n              return Mock()\n\n          @classmethod\n          def __getattr__(cls, name):\n              if name in ('__file__', '__path__'):\n                  return '/dev/null'\n              elif name[0] == name[0].upper():\n                  return type(name, (), {})\n              else:\n                  return Mock()\n\n      MOCK_MODULES = ['<name of package to mock>', '<name of package to mock>']\n      for mod_name in MOCK_MODULES:\n          sys.modules[mod_name] = Mock()\n\n#. You're now ready to start doing actual work on your package.  You\n   will probably want to read over the developer guidelines of the Astropy\n   documentation, and if you are hosting your code in GitHub, you might also\n   want to read the `Github help <https://help.github.com/>`_ to ensure you know\n   how to push your code to GitHub and some recommended workflows that work for\n   the core Astropy Project.\n\n#. Good luck with your code and your science!\n\nUpdating to the latest template files\n=====================================\n\nSee instructions in :ref:`Item 14 above <template-changes-with-gitfu>`.\n\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#. Make sure that Travis and any other 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#. Update the version number in ``setup.cfg`` to the version you're about to\n   release, without the ``.dev`` suffix (e.g. ``0.1``).\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#. Run::\n\n        python setup.py build sdist --format=gztar\n\n   and make sure that generated file is good to\n   go by going inside ``dist``, expanding the tar file, going inside the\n   expanded directory, and running the tests with::\n\n        python setup.py test\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   .. note::\n\n       Running ``python setup.py build sdist`` runs two setup commands in\n       succession.  First it runs ``build``, then immediately runs ``sdist``\n       to create the source distribution.  The reason to do this is that\n       there are several generated source files that must be included in the\n       source distribution for it to be valid.  Running ``build`` first\n       ensures that those files will be generated and packaged in the source\n       distribution.\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 setup.py 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 setup.py build sdist --format=gztar`` 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/tutorials/distributing-packages/#uploading-your-project-to-pypi>`_\n   instructions. Check that the entry on PyPI is correct, and that\n   the tarfile is present.\n\n#. Go back to the master branch and push your changes to github::\n\n        git checkout master\n        git push --tags origin master\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.. note:: The instructions above 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 these for 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.. _git: https://git-scm.com/\n.. _github: https://github.com/\n.. _Cython: http://cython.org/\n.. _package-template: https://github.com/astropy/package-template\n.. _astropy-helpers: https://github.com/astropy/astropy-helpers\n.. _TEMPLATE_CHANGES.md: https://github.com/astropy/package-template/blob/master/TEMPLATE_CHANGES.md\n\n.. raw:: html\n\n    <script>\n\n    function get_url_vars() {\n        var vars = {};\n        var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {\n            vars[key] = value;\n        });\n        return vars;\n    }\n\n    packagename = get_url_vars()[\"packagename\"]\n    if(packagename) {\n      document.body.innerHTML = document.body.innerHTML.replace(/&lt;packagename&gt;/g, packagename);\n    }\n    </script>\n"},{"id":344,"name":"docrules.rst","nodeType":"TextFile","path":"docs/development","text":".. doctest-skip-all\n.. _doc-rules:\n\n***********************\nAstropy Docstring Rules\n***********************\n\nThe original source for these docstring standards is the NumPy_ project, and\nthe associated numpydoc_ tools. The most up-to-date version of these standards\ncan be found at `numpy's github site\n<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_. The\nguidelines below have been adapted to the Astropy package.\n\n\nOverview\n========\n\nIn general, we follow the standard Python style conventions as described here:\n\n * `Style Guide for C Code <https://www.python.org/dev/peps/pep-0007/>`_\n * `Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_\n * `Docstring Conventions <https://www.python.org/dev/peps/pep-0257/>`_\n\nAdditional PEPs of interest regarding documentation of code:\n\n * `Docstring Processing Framework <https://www.python.org/dev/peps/pep-0256/>`_\n * `Docutils Design Specification <https://www.python.org/dev/peps/pep-0258/>`_\n\nUse a code checker:\n\n * `pylint <https://www.logilab.org/857>`_\n * `pyflakes <https://pypi.python.org/pypi/pyflakes>`_\n * `pycodestyle <https://github.com/PyCQA/pycodestyle>`_\n\nThe following import conventions are used throughout the Astropy source\nand documentation::\n\n   import numpy as np\n   import matplotlib as mpl\n   import matplotlib.pyplot as plt\n\nDo not abbreviate ``scipy``. There is no motivating use case to abbreviate\nit in the real world, so we avoid it in the documentation to avoid\nconfusion.\n\nIt is not necessary to do ``import numpy as np`` at the beginning of\nan example.  However, some sub-modules, such as ``fft``, are not\nimported by default, and you have to include them explicitly::\n\n  import numpy.fft\n\nafter which you may use it::\n\n  np.fft.fft2(...)\n\nDocstring Standard\n==================\n\nA documentation string (docstring) is a string that describes a module,\nfunction, class, or method definition. The docstring is a special attribute\nof the object (``object.__doc__``) and, for consistency, is surrounded by\ntriple double quotes, i.e.::\n\n   \"\"\"\n   This is the form of a docstring.\n\n   It can be spread over several lines.\n\n   \"\"\"\n\nNumPy_ and SciPy_ have defined a common convention for docstrings that\nprovides for consistency, while also allowing our toolchain to produce\nwell-formatted reference guides. This format should be used for Astropy\ndocstrings.\n\nThis docstring standard uses `re-structured text (reST)\n<http://docutils.sourceforge.net/rst.html>`_ syntax and is rendered\nusing Sphinx_ (a pre-processor that understands the particular\ndocumentation style we are using). While a rich set of markup is\navailable, we limit ourselves to a very basic subset, in order to\nprovide docstrings that are easy to read on text-only terminals.\n\nA guiding principle is that human readers of the text are given\nprecedence over contorting docstrings so our tools produce nice output.\nRather than sacrificing the readability of the docstrings, we have\nwritten pre-processors to assist Sphinx_ in its task.\n\nThe length of docstring lines should be kept to 75 characters to\nfacilitate reading the docstrings in text terminals.\n\n.. _numpydoc-sections:\n\nSections\n========\n\n.. highlight:: rst\n\nThe sections of the docstring are:\n\n1. **Short summary**\n\n   A one-line summary that does not use variable names or the function\n   name, e.g.\n\n   ::\n\n     def add(a, b):\n        \"\"\"\n        The sum of two numbers.\n\n        \"\"\"\n\n   The function signature is normally found by introspection and\n   displayed by the help function. For some functions (notably those\n   written in C) the signature is not available, so we have to specify\n   it as the first line of the docstring::\n\n     \"\"\"\n     add(a, b)\n\n     The sum of two numbers.\n\n     \"\"\"\n\n2. **Deprecation warning**\n\n   A section (use if applicable) to warn users that the object is deprecated.\n   Section contents should include:\n\n   * In what Astropy version the object was deprecated, and when it will\n     be removed.\n\n   * Reason for deprecation if this is useful information (e.g., object\n     is superseded, duplicates functionality found elsewhere, etc.).\n\n   * New recommended way of obtaining the same functionality.\n\n   This section should use the note Sphinx directive instead of an\n   underlined section header.\n\n   ::\n\n     .. note:: Deprecated in Astropy 1.2\n               `ndobj_old` will be removed in Astropy 2.0, it is replaced by\n               `ndobj_new` because the latter works also with array subclasses.\n\n3. **Extended summary**\n\n   A few sentences giving an extended description. This section should be used\n   to clarify *functionality*, not to discuss implementation detail or\n   background theory, which should rather be explored in the **notes** section\n   below. You may refer to the parameters and the function name, but parameter\n   descriptions still belong in the **parameters** section.\n\n4. **Parameters**\n\n   Description of the function arguments, keywords and their respective types.\n\n   ::\n\n     Parameters\n     ----------\n     x : type\n        Description of parameter `x`.\n\n   Enclose variables in single backticks.\n\n   For the parameter types, be as precise as possible. Below are a few\n   examples of parameters and their types.\n\n   ::\n\n     Parameters\n     ----------\n     filename : str\n     copy : bool\n     dtype : data-type\n     iterable : iterable object\n     shape : int or tuple of int\n     files : list of str\n\n   If it is not necessary to specify a keyword argument, use ``optional``::\n\n     x : int, optional\n\n   Optional keyword parameters have default values, which are displayed as\n   part of the function signature. They can also be detailed in the\n   description::\n\n     Description of parameter `x` (the default is -1, which implies summation\n     over all axes).\n\n   When a parameter can only assume one of a fixed set of values, those values\n   can be listed in braces::\n\n     order : {'C', 'F', 'A'}\n         Description of `order`.\n\n   When two or more input parameters have exactly the same type, shape and\n   description, they can be combined::\n\n     x1, x2 : array-like\n         Input arrays, description of `x1`, `x2`.\n\n5. **Returns**\n\n   Explanation of the returned values and their types, of the same format as\n   **parameters**.\n\n6. **Other parameters**\n\n   An optional section used to describe infrequently used parameters. It\n   should only be used if a function has a large number of keyword parameters,\n   to prevent cluttering the **parameters** section.\n\n7. **Raises**\n\n   An optional section detailing which errors get raised and under what\n   conditions::\n\n     Raises\n     ------\n     InvalidWCSException\n         If the WCS information is invalid.\n\n   This section should be used judiciously, i.e only for errors that are\n   non-obvious or have a large chance of getting raised.\n\n8. **See Also**\n\n   An optional section used to refer to related code. This section can be very\n   useful, but should be used judiciously. The goal is to direct users to\n   other functions they may not be aware of, or have easy means of discovering\n   (by looking at the module docstring, for example). Routines whose\n   docstrings further explain parameters used by this function are good\n   candidates.\n\n   As an example, for a hypothetical function ``astropy.wcs.world2pix``\n   converting sky to pixel coordinates, we would have::\n\n     See Also\n     --------\n     pix2world : Convert pixel to sky coordinates\n\n   When referring to functions in the same sub-module, no prefix is needed,\n   and the tree is searched upwards for a match.\n\n   Prefix functions from other sub-modules appropriately. E.g., whilst\n   documenting a hypothetical ``astropy.vo`` module, refer to a function in\n   ``table`` by\n\n   ::\n\n     table.read : Read in a VO table\n\n   When referring to an entirely different module::\n\n     astropy.coords : Coordinate handling routines\n\n   Functions may be listed without descriptions, and this is preferable if the\n   functionality is clear from the function name::\n\n     See Also\n     --------\n     func_a : Function a with its description.\n     func_b, func_c_, func_d\n     func_e\n\n9. **Notes**\n\n   An optional section that provides additional information about the code,\n   possibly including a discussion of the algorithm. This section may include\n   mathematical equations, written in `LaTeX <http://www.latex-project.org/>`_\n   format::\n\n     The FFT is a fast implementation of the discrete Fourier transform:\n\n     .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n\n   Equations can also be typeset underneath the math directive::\n\n     The discrete-time Fourier time-convolution property states that\n\n     .. math::\n\n          x(n) * y(n) \\Leftrightarrow X(e^{j\\omega } )Y(e^{j\\omega } )\\\\\n          another equation here\n\n   Math can furthermore be used inline, i.e.\n\n   ::\n\n     The value of :math:`\\omega` is larger than 5.\n\n   Variable names are displayed in typewriter font, obtained by using\n   ``\\mathtt{var}``::\n\n     We square the input parameter `alpha` to obtain\n     :math:`\\mathtt{alpha}^2`.\n\n   Note that LaTeX is not particularly easy to read, so use equations\n   sparingly.\n\n   Images are allowed, but should not be central to the explanation; users\n   viewing the docstring as text must be able to comprehend its meaning\n   without resorting to an image viewer. These additional illustrations are\n   included using::\n\n     .. image:: filename\n\n   where filename is a path relative to the reference guide source directory.\n\n10. **References**\n\n   References cited in the **notes** section may be listed here,\n   e.g. if you cited the article below using the text ``[1]_``,\n   include it as in the list as follows::\n\n     .. [1] O. McNoleg, \"The integration of GIS, remote sensing,\n        expert systems and adaptive co-kriging for environmental habitat\n        modelling of the Highland Haggis using object-oriented, fuzzy-logic\n        and neural-network techniques,\" Computers & Geosciences, vol. 22,\n        pp. 585-588, 1996.\n\n   which renders as [1]_\n\n   .. [1] O. McNoleg, \"The integration of GIS, remote sensing,\n      expert systems and adaptive co-kriging for environmental habitat\n      modelling of the Highland Haggis using object-oriented, fuzzy-logic\n      and neural-network techniques,\" Computers & Geosciences, vol. 22,\n      pp. 585-588, 1996.\n\n   Referencing sources of a temporary nature, like web pages, is discouraged.\n   References are meant to augment the docstring, but should not be required\n   to understand it. References are numbered, starting from one, in the order\n   in which they are cited.\n\n11. **Examples**\n\n   An optional section for examples, using the `doctest\n   <https://docs.python.org/3/library/doctest.html>`_ format. This section\n   is meant to illustrate usage, not to provide a testing framework -- for\n   that, use the ``tests/`` directory. While optional, this section is very\n   strongly encouraged.\n\n   When multiple examples are provided, they should be separated by blank\n   lines. Comments explaining the examples should have blank lines both above\n   and below them::\n\n     >>> astropy.wcs.world2pix(233.2, -12.3)\n     (134.5, 233.1)\n\n     Comment explaining the second example\n\n     >>> astropy.coords.fk5_to_gal(\"00:42:44.33 +41:16:07.5\")\n     (121.1743, -21.5733)\n\n   For tests with a result that is random or platform-dependent, mark the\n   output as such::\n\n     >>> astropy.coords.randomize_position(244.9, 44.2, radius=0.1)\n     (244.855, 44.13)  # random\n\n   It is not necessary to use the doctest markup ``<BLANKLINE>`` to indicate\n   empty lines in the output. The examples may assume that ``import numpy as\n   np`` is executed before the example code.\n\n.. We need to consider whether to add a doctest= option to astropy.test to\n.. enable automated testing of the examples as in Numpy.\n\nDocumenting classes\n===================\n\nClass docstrings\n----------------\n\nUse the same sections as outlined above (all except ``Returns`` are\napplicable). The constructor (``__init__``) should also be documented here,\nthe ``Parameters`` section of the docstring details the constructors\nparameters.\n\nAn ``Attributes`` section, located below the ``Parameters`` section, may be\nused to describe class variables::\n\n  Attributes\n  ----------\n  x : float\n      The X coordinate.\n  y : float\n      The Y coordinate.\n\nAttributes that are properties and have their own docstrings can be simply\nlisted by name::\n\n  Attributes\n  ----------\n  real\n  imag\n  x : float\n      The X coordinate\n  y : float\n      The Y coordinate\n\n\n.. highlight:: python\n\nIn general, it is not necessary to list class methods. Those that are not part\nof the public API have names that start with an underscore. In some cases,\nhowever, a class may have a great many methods, of which only a few are\nrelevant (e.g., subclasses of ndarray). Then, it becomes useful to have an\nadditional ``Methods`` section::\n\n  class Table(ndarray):\n      \"\"\"\n      A class to represent tables of data\n\n      ...\n\n      Attributes\n      ----------\n      columns : list\n          List of columns\n\n      Methods\n      -------\n      read(filename)\n          Read a table from a file\n      sort(column, order='ascending')\n          Sort by `column`\n      \"\"\"\n\nIf it is necessary to explain a private method (use with care!), it can be\nreferred to in the **extended summary** or the **notes**. Do not list private\nmethods in the Methods section.\n\nDo not list ``self`` as the first parameter of a method.\n\nMethod docstrings\n-----------------\n\nDocument these as you would any other function. Do not include ``self`` in\nthe list of parameters. If a method has an equivalent function, the function\ndocstring should contain the detailed documentation, and the method\ndocstring should refer to it. Only put brief ``Summary`` and ``See Also``\nsections in the method docstring.\n\nDocumenting class instances\n===========================\n\nInstances of classes that are part of the Astropy API may require some care.\nTo give these instances a useful docstring, we do the following:\n\n* Single instance: If only a single instance of a class is exposed, document\n  the class. Examples can use the instance name.\n\n* Multiple instances: If multiple instances are exposed, docstrings for each\n  instance are written and assigned to the instances' ``__doc__`` attributes\n  at run time. The class is documented as usual, and the exposed instances can\n  be mentioned in the Notes and See Also sections.\n\nDocumenting constants\n=====================\n\nUse the same sections as outlined for functions where applicable::\n\n   1. summary\n   2. extended summary (optional)\n   3. see also (optional)\n   4. references (optional)\n   5. examples (optional)\n\nDocstrings for constants will not be visible in text terminals\n(constants are of immutable type, so docstrings can not be assigned\nto them like for for class instances), but will appear in the\ndocumentation built with Sphinx.\n\nDocumenting modules\n===================\n\nEach module should have a docstring with at least a summary line. Other\nsections are optional, and should be used in the same order as for documenting\nfunctions when they are appropriate::\n\n    1. summary\n    2. extended summary\n    3. routine listings\n    4. see also\n    5. notes\n    6. references\n    7. examples\n\nRoutine listings are encouraged, especially for large modules, for which it is\nhard to get a good overview of all functionality provided by looking at the\nsource file(s) or the ``__all__`` dict.\n\nNote that license and author info, while often included in source files, do not\nbelong in docstrings.\n\nOther points to keep in mind\n============================\n\n* Notes and Warnings : If there are points in the docstring that deserve\n  special emphasis, the reST directives for a note or warning can be used\n  in the vicinity of the context of the warning (inside a section). Syntax:\n\n  .. code-block:: rst\n\n    .. warning:: Warning text.\n\n    .. note:: Note text.\n\n  Use these sparingly, as they do not look very good in text terminals\n  and are not often necessary. One situation in which a warning can\n  be useful is for marking a known bug that is not yet fixed.\n\n* ``array-like`` : For functions that take arguments which can have not only\n  a type ``ndarray``, but also types that can be converted to an ndarray\n  (i.e. scalar types, sequence types), those arguments can be documented\n  with type ``array-like``.\n\nCommon reST concepts\n====================\n\nFor paragraphs, indentation is significant and indicates indentation in the\noutput. New paragraphs are marked with a blank line.\n\nUse *italics*, **bold**, and ``courier`` if needed in any explanations (but\nnot for variable names and doctest code or multi-line code). Variable, module\nand class names should be written between single back-ticks (```astropy```).\n\nA more extensive example of reST markup can be found in `this example document\n<http://docutils.sourceforge.net/docs/user/rst/demo.txt>`_; the `quick\nreference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ is\nuseful while editing.\n\nLine spacing and indentation are significant and should be carefully followed.\n\nConclusion\n==========\n\n`An example <https://github.com/numpy/numpy/blob/master/doc/example.py>`_ of the\nformat shown here is available.  Refer to `How to Build API/Reference\nDocumentation\n<https://github.com/numpy/numpy/blob/master/doc/HOWTO_BUILD_DOCS.rst.txt>`_\non how to use Sphinx_ to build the manual.\n\n\n.. _NumPy: http://www.numpy.org/\n.. _numpydoc: https://pypi.python.org/pypi/numpydoc/0.3.1\n.. _Matplotlib: http://matplotlib.sourceforge.net/\n.. _SciPy: https://www.scipy.org/\n.. _Sphinx: http://sphinx.pocoo.org\n"},{"id":345,"name":"building.rst","nodeType":"TextFile","path":"docs/development","text":"************************************\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\nastropy core (and any affiliated packages that use the template).  The user\ndoesn't necessarily need to have `setuptools`_ installed, as it will\nautomatically bootstrap itself using the ``ez_setup.py`` file in the source\ndistribution if it isn't installed for the user.\n\n\nAstropy-helpers\n===============\n\nAs of Astropy v0.4, Astropy also uses an external package called\n`astropy-helpers <https://github.com/astropy/astropy-helpers>`_ to provide some\nof its build and installation functionality.  A copy of astropy-helpers is\nincluded with the Astropy source distribution, but also includes a mechanism to\nautomatically download bug fixes from PyPI.  The reason for providing these\nhelpers as a separate package is that it makes it easier for affiliated\npackages to take advantage of these same utilities without requiring Astropy to\nbe installed *first*.  See `APE4\n<https://github.com/astropy/astropy-APEs/blob/master/APE4.rst>`_ for the full\nbackground on this.\n\nAstropy-helpers is automatically bootstrapped to the Astropy build/installation\nscript (``setup.py``) via a script called ``ah_bootstrap.py`` that is imported\nby ``setup.py``.  This script will do its best to ensure that the user has an\nup-to-date copy of astropy-helpers before building the package.  The\nauto-upgrade mechanism in particular allows pushing platform-specific fixes for\nthe build process without releasing a new version of Astropy (or any affiliated\npackage that uses astropy-helpers).\n\nThe behavior of the ``ah_bootstrap.py`` script can also be modified by options\nin the project's ``setup.cfg`` file under a section called ``[ah_boostrap]``.\nAPE4 provides `more details\n<https://github.com/astropy/astropy-APEs/blob/master/APE4.rst#astropy_helpers-bootstrap-script>`_.\n\nThe astropy-helpers distribution provides a Python package called\n``astropy_helpers``.  Code that previously referenced the modules\n``astropy.setup_helpers`` and ``astropy.version_helpers`` should now depend on\nastropy-helpers and use ``astrop_helpers.setup_helpers`` and\n``astropy_helpers.version_helpers`` respectively.  Likewise, astropy-helpers\nincludes tools for building Astropy's documentation.  The ``astropy.sphinx``\npackage is deprecated in favor of ``astropy_helpers.sphinx``.  As such,\nastropy-helpers is a dependency of building Astropy's documentation.\n\n\nCustomizing setup/build for subpackages\n=======================================\n\nAs is typical, there is a single ``setup.py`` file that is used for the whole\n``astropy`` package.  To customize setup parameters for a given sub-package, a\n``setup_package.py`` file can be defined inside a package, and if it is present,\nthe setup process will look for the following functions to customize the build\nprocess:\n\n* ``get_package_data``\n    This function, if defined, should return a dictionary mapping the name of\n    the subpackage(s) that need package data to a list of data file paths\n    (possibly including wildcards) relative to the path of the package's source\n    code.  e.g. if the source distribution has a needed data file\n    ``astropy/wcs/tests/data/3d_cd.hdr``, this function should return\n    ``{'astropy.wcs.tests':['data/3d_cd.hdr']}``. See the ``package_data``\n    option of the  :func:`distutils.core.setup` function.\n\n    It is recommended that all such data be in a directory named ``data`` inside\n    the package within which it is supposed to be used.  This package data should\n    be accessed via the `astropy.utils.data.get_pkg_data_filename` and\n    `astropy.utils.data.get_pkg_data_fileobj` functions.\n\n* ``get_extensions``\n    This provides information for building C or Cython extensions. If defined,\n    it should return a list of `distutils.core.Extension` objects controlling\n    the Cython/C build process (see below for more detail).\n\n* ``get_build_options``\n    This function allows a package to add extra build options.  It\n    should return a list of tuples, where each element has:\n\n    - *name*: The name of the option as it would appear on the\n      commandline or in the ``setup.cfg`` file.\n\n    - *doc*: A short doc string for the option, displayed by\n      ``setup.py build --help``.\n\n    - *is_bool* (optional): When `True`, the option is a boolean\n      option and doesn't have an associated value.\n\n    Once an option has been added, its value can be looked up using\n    ``astropy_helpers.setup_helpers.get_distutils_build_option``.\n\n* ``get_external_libraries``\n    This function declares that the package uses libraries that are\n    included in the astropy distribution that may also be distributed\n    elsewhere on the users system.  It should return a list of library\n    names.  For each library, a new build option is created,\n    ``'--use-system-X'`` which allows the user to request to use the\n    system's copy of the library.  The package would typically call\n    ``astropy_helpers.setup_helpers.use_system_library`` from its\n    ``get_extensions`` function to determine if the package should use\n    the system library or the included one.\n\nThe ``astropy_helpers.setup_helpers`` modules includes an\n``update_package_files`` function which automatically searches the given source\npath for ``setup_package.py`` modules and calls each of the above functions, if\nthey exist.  This makes it easy for affiliated packages to use this machinery\nin their own ``setup.py``.\n"},{"id":346,"name":"testguide.rst","nodeType":"TextFile","path":"docs/development","text":".. doctest-skip-all\n\n.. include:: workflow/known_projects.inc\n.. _testing-guidelines:\n\n******************\nTesting Guidelines\n******************\n\nThis section describes the testing framework and format standards for tests in\nAstropy core packages (this also serves as recommendations for affiliated\npackages).\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,\naccessed through the ``python setup.py test`` command.\n\n.. _pytest: https://pytest.org/en/latest/\n\n.. note::\n\n    The ``pytest`` project was formerly called ``py.test``, and you may\n    see the two spellings used interchangeably in the documentation.\n\n.. _testing-dependencies:\n\nTesting Dependencies\n********************\n\nAs of Astropy 3.0, the dependencies used by the Astropy test runner are\nprovided by a separate package called ``pytest-astropy``. This package provides\nthe ``pytest`` dependency itself, in addition to several ``pytest`` plugins\nthat are used by Astropy, 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.py``.\nHowever, for technical reasons it is not currently possible to express these\ndependencies in ``tests_require`` either. Therefore, ``pytest-astropy`` is\nlisted as an extra dependency using ``extras_require`` in ``setup.py``.\nDevelopers who want to run the test suite will need to install the testing\npackage using pip::\n\n    > pip install pytest-astropy\n\nThe following ``pytest`` plugins are included in the ``pytest-astropy``\npackage:\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.. _pytest-remotedata: https://github.com/astropy/pytest-remotedata\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.. _pytest-doctestplus: https://github.com/astropy/pytest-doctestplus\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\n.. _pytest-openfiles: https://github.com/astropy/pytest-openfiles\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 (version 3.1 or later) 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.python.org/pypi/pytest-pep8>`_, which must be installed\nseparately.\n\nsetup.py test\n=============\n\nThe astropy core package and the Astropy package template provide a ``test``\nsetup command, invoked by running ``python setup.py test`` while in the\npackage root directory. Run ``python setup.py test --help`` to see the\noptions to the test command.\n\nSince ``python setup.py test`` wraps the widely-used pytest framework, you may\nfrom time to time want to pass options to the ``pytest`` command itself. For\nexample, the ``-x`` option to stop after the first failure can be passed\nthrough with the ``--args`` argument::\n\n    > python setup.py test --args \"-x\"\n\n`pytest`_ will look for files that `look like tests\n<https://pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery>`_\nin the current directory and all recursive directories then run all the code that\n`looks like tests\n<https://pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery>`_\nwithin those files.\n\nTurn on PEP8 checking by passing ``--pep8`` to the ``test`` command. This will\nturn off regular testing and enable PEP8 testing.\n\nNote also that this test runner actually installs astropy into a temporary\ndirectory and uses that for running the tests.  This means that tests of things\nlike entry points or data file paths should act just like they would once\nastropy is installed.  The other two approaches described below do *not* do\nthis, and hence may give different results when run from the astropy source\ncode. Hence if you're running the tests because you've modified code that might\nbe impacted by this, the ``setup.py test`` approach is the recommended method.\n\n.. _astropy.test():\n\nastropy.test()\n==============\n\nTests can be run from within Astropy with::\n\n    import astropy\n    astropy.test()\n\nThis will run all the default tests for Astropy.\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 `pytest.main() <https://pytest.org/en/latest/builtin.html#pytest.main>`_,\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\npytest\n======\n\nThe test suite can be run directly from the native ``pytest`` command. In this\ncase, it is important for developers to be aware that they must manually\nrebuild any extensions by running ``setup.py build_ext`` before testing.\n\nIn contrast to the case of running from ``setup.py``, the ``--doctest-plus``\nand ``--doctest-rst`` options are not enabled by default when running the\n``pytest`` command directly. This flags should be explicitly given if they are\nneeded.\n\nTest-running options\n====================\n\nRunning parts of the test suite\n-------------------------------\n\nIt is possible to run only the tests for a particular subpackage.  For\nexample, to run only the ``wcs`` tests from the commandline::\n\n    python setup.py test -P wcs\n\nOr from Python::\n\n    >>> import astropy\n    >>> astropy.test(package=\"wcs\")\n\nYou can also specify a single file to test from the commandline::\n\n    python setup.py test -t astropy/wcs/tests/test_wcs.py\n\nWhen the ``-t`` option is given a relative path, it is relative to the\ninstalled root of astropy.  When ``-t`` is given a relative path to a\ndocumentation ``.rst`` file to test, it is relative to the root of the\ndocumentation, i.e. the ``docs`` directory in the source tree.  For\nexample::\n\n    python setup.py test -t units/index.rst\n\n.. _open-files:\n\nTesting for open files\n----------------------\n\nAstropy can test whether any of the unit tests inadvertently leave any\nfiles open.  Since this greatly slows down the time it takes to run\nthe tests, it is turned off by default.\n\nTo use it from the commandline, do::\n\n    python setup.py test --open-files\n\nTo use it from Python, do::\n\n    >>> import astropy\n    >>> astropy.test(open_files=True)\n\nTest coverage reports\n---------------------\n\nAstropy can use `coverage.py <http://coverage.readthedocs.io/en/latest/>`_ to\ngenerate test coverage reports.  To generate a test coverage report, use::\n\n    python setup.py test --coverage\n\nThere is a `coveragerc\n<http://coverage.readthedocs.io/en/latest/config.html>`_ file that\ndefines files to omit as well as lines to exclude.  It is installed\nalong with astropy so that the ``astropy`` testing framework can use\nit.  In the source tree, it is at ``astropy/tests/coveragerc``.\n\nRunning tests in parallel\n-------------------------\n\nIt is possible to speed up astropy's tests using the `pytest-xdist\n<https://pypi.python.org/pypi/pytest-xdist>`_ plugin.  This plugin can be\ninstalled using `pip`_::\n\n    pip install pytest-xdist\n\nOnce installed, tests can be run in parallel using the ``'--parallel'``\ncommandline option.  For example, to use 4 processes::\n\n    python setup.py test --parallel=4\n\nPass a negative number to ``'--parallel'`` to create the same number of\nprocesses as cores on your machine.\n\nSimilarly, this feature can be invoked from Python::\n\n    >>> import astropy\n    >>> astropy.test(parallel=4)\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 `test discovery rules\n<https://pytest.org/en/latest/goodpractices.html#conventions-for-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.6.0 -- pytest-3.2.0\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 ``python setup.py test\n--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 ``python setup.py test --remote-data=astropy``.\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 set an option ``cache_dir`` in the pytest\nconfig file which sets the cache location for the entire test run.  A\n``--cache-dir`` command-line option is also supported (which overrides all\nother settings).  Currently it is not directly supported by the\n``./setup.py test`` command, so it is necessary to use it with the ``-a``\nargument like::\n\n    $ ./setup.py test -a \"--cache-dir=/path/to/custom/cache/dir\"\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 `pytest tmpdir\nfunction argument <https://pytest.org/en/latest/tmpdir.html>`_ or with\nPython's built-in `tempfile module\n<https://docs.python.org/3/library/tempfile.html#module-tempfile>`_.\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 behaviour for a specific input value.\"\"\"\n            added = add_nums(11, self.NUM)\n            assert added == 53\n\n        def test_2(self):\n            \"\"\"Test behaviour 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 behaviour for a specific input value.\"\"\"\n            added = add_nums(11, self.NUM)\n            assert added == 53\n\n        def test_2(self):\n        \"\"\"Test behaviour 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\nParametrizing tests\n===================\n\nIf you want to run a test several times for slightly different values, then\nit can be advantageous to use the ``pytest`` option to parametrize 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 ``parametrize`` decorator to loop over the different\ninputs::\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\nTests requiring optional dependencies\n=====================================\n\nFor tests that test functions or methods that require optional\ndependencies (e.g. Scipy), pytest should be instructed to skip the\ntest if the dependencies are not present. The following example shows\nhow this should be done::\n\n    import pytest\n\n    try:\n        import scipy\n        HAS_SCIPY = True\n    except ImportError:\n        HAS_SCIPY = False\n\n    @pytest.mark.skipif('not HAS_SCIPY')\n    def test_that_uses_scipy():\n        ...\n\nIn this way, the test is run if Scipy is present, and skipped if\nnot. No tests should fail simply because an optional dependency is not\npresent.\n\nUsing pytest helper functions\n=============================\n\nIf your tests need to use `pytest helper functions\n<https://pytest.org/en/latest/builtin.html#pytest-helpers>`_, such as\n``pytest.raises``, import ``pytest`` into your test module like so::\n\n    import pytest\n\nPrior to Astropy 2.0, it was possible to import pytest from a\nbundled version using e.g.::\n\n    from ...tests.helper import pytest\n\nbut this is no longer the recommended method.\n\nTesting warnings\n================\n\nIn order to test that warnings are triggered as expected in certain\nsituations, you can use the `astropy.tests.helper.catch_warnings`\ncontext manager.  Unlike the `warnings.catch_warnings` context manager\nin the standard library, this one will reset all warning state before\nhand so one is assured to get the warnings reported, regardless of\nwhat errors may have been emitted by other tests previously.  Here is\na real-world example::\n\n  from astropy.tests.helper import catch_warnings\n\n  with catch_warnings(MergeConflictWarning) as warning_lines:\n      # Test code which triggers a MergeConflictWarning\n      out = table.vstack([t1, t2, t4], join_type='outer')\n\n      assert warning_lines[0].category == metadata.MergeConflictWarning\n      assert (\"In merged column 'a' the 'units' attribute does not match (cm != m)\"\n              in str(warning_lines[0].message))\n\n.. note::\n\n   Within `pytest`_ there is also the option of using the ``recwarn``\n   function argument to test that warnings are triggered.  This method has\n   been found to be problematic in at least one case (`pull request 1174\n   <https://github.com/astropy/astropy/pull/1174#issuecomment-20249309>`_)\n   so the `astropy.tests.helper.catch_warnings` context manager is\n   preferred.\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\nWe make use of the `pytest-mpl <https://pypi.python.org/pypi/pytest-mpl>`_\nplugin to create tests where we can compare the output of plotting commands\nwith reference files (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    python setup.py test -a \"--mpl\" --remote-data\n\nThe `README.rst <https://github.com/astrofrog/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\nOnce you have a test for which you want to (re-)generate reference images,\nrun the tests with the ``--mpl-generate-path`` argument, e.g::\n\n    python setup.py test -a \"--mpl --mpl-generate-path=reference_tmp\" --remote-data\n\nThis will create a ``reference_tmp`` folder and put the generated reference\nimages inside it.\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\n   the astropy source code, it can only be tested by running ``python\n   setup.py test``, not by ``import astropy; astropy.test()``.\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* `Travis <https://travis-ci.org/astropy/astropy>`_ for 64-bit Linux and OS X setups\n* `Appveyor <https://ci.appveyor.com/project/Astropy/astropy>`_ for Windows\n* `CircleCI <https://circleci.com>`_ for 32-bit Linux\n\nThese continuously test the package for each commit and pull request that is\npushed to GitHub to notice when something breaks.\n\nAstropy and many affiliated packages use an external package called\n`ci-helpers <https://github.com/astropy/astropy-helpers>`_ to provide\nsupport for the generic parts of the CI systems. ``ci-helpers`` consists of\na set of scripts that are used by the ``.travis.yml`` and ``appveyor.yml``\nfiles to set up the conda environment, and install dependencies.\n\nDependencies can be customized for different packages using the appropriate\nenvironment variables in ``.travis.yml`` and ``appveyor.yml``. For more\ndetails on how to set up this machinery, see the `package-template\n<https://github.com/astropy/package-template>`_ and `ci-helpers`_.\n\nThe 32-bit tests on CircleCI use a pre-defined Docker image defined `here\n<https://github.com/astropy/astropy-docker/>`_ which includes a 32-bit\nPython environment. If you want to run tests for packages in the same way,\nyou can use the same set-up on CircleCI as the core package, but just be\nsure to install Astropy first using::\n\n    easy_install pip\n    pip install astropy\n\nFor convenience, you can also use the ``astropy/affiliated-32bit-test-env``\nDocker image instead of ``astropy/astropy-32bit-test-env`` - the former includes\nthe latest stable version of Astropy pre-installed.\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. The following sections\nexplain how you can reproduce specific builds locally.\n\nReproducing failing 32-bit builds\n=================================\n\nIf you want to run your tests in the same 32-bit Python environment that\nCircleCI uses, start off by installing `Docker <https://www.docker.com>`_ if you\ndon't already have it installed. Docker can be installed on a variety of\ndifferent operating systems.\n\nThen, make sure you have a version of the git repository (either the main\nAstropy repository or your fork) for which you want to run the tests. Go to that\ndirectory, then run Docker with::\n\n    $ docker run -i -v ${PWD}:/astropy_src -t astropy/astropy-32bit-test-env:1.6 bash\n\nThis will put you in the bash shell inside the Docker container. Once inside,\nyou can go to the ``astropy_src`` directory, and you should see the files that\nare in your local git repository::\n\n    root@5e2b89d7b07c:/# cd /astropy_src\n    root@5e2b89d7b07c:/astropy_src# ls\n    ah_bootstrap.py  CONTRIBUTING.md       pip-requirements-doc\n    appveyor.yml     docs                  README.rst\n    astropy          examples              readthedocs.yml\n    astropy_helpers  ez_setup.py           setup.cfg\n    cextern          licenses              setup.py\n    CHANGES.rst      MANIFEST.in           static\n    circle.yml       pip-requirements      CITATION\n    pip-requirements-dev\n\nYou can then run the tests with::\n\n    root@5e2b89d7b07c:/astropy_src# python setup.py test\n"},{"col":0,"comment":"\n    Accepts a URL, downloads and optionally caches the result\n    returning the filename, with a name determined by the file's MD5\n    hash. If ``cache=True`` and the file is present in the cache, just\n    returns the filename.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool, optional\n        Whether to use the 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        The timeout, in seconds.  Otherwise, use\n        `astropy.utils.data.Conf.remote_timeout`.\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib2.URLError, urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    ","endLoc":1082,"header":"def download_file(remote_url, cache=False, show_progress=True, timeout=None)","id":347,"name":"download_file","nodeType":"Function","startLoc":947,"text":"def download_file(remote_url, cache=False, show_progress=True, timeout=None):\n    \"\"\"\n    Accepts a URL, downloads and optionally caches the result\n    returning the filename, with a name determined by the file's MD5\n    hash. If ``cache=True`` and the file is present in the cache, just\n    returns the filename.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool, optional\n        Whether to use the 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        The timeout, in seconds.  Otherwise, use\n        `astropy.utils.data.Conf.remote_timeout`.\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib2.URLError, urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    \"\"\"\n\n    from ..utils.console import ProgressBarOrSpinner\n\n    if timeout is None:\n        timeout = conf.remote_timeout\n\n    missing_cache = False\n\n    if cache:\n        try:\n            dldir, urlmapfn = _get_download_cache_locs()\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            cache = False\n            missing_cache = True  # indicates that the cache is missing to raise a warning later\n\n    url_key = remote_url\n\n    try:\n        if cache:\n            # We don't need to acquire the lock here, since we are only reading\n            with shelve.open(urlmapfn) as url2hash:\n                if url_key in url2hash:\n                    return url2hash[url_key]\n\n        with urllib.request.urlopen(remote_url, timeout=timeout) as remote:\n            # keep a hash to rename the local file to the hashed name\n            hash = hashlib.md5()\n\n            info = remote.info()\n            if 'Content-Length' in info:\n                try:\n                    size = int(info['Content-Length'])\n                except ValueError:\n                    size = None\n            else:\n                size = None\n\n            if size is not None:\n                check_free_space_in_dir(gettempdir(), size)\n                if cache:\n                    check_free_space_in_dir(dldir, size)\n\n            if show_progress:\n                progress_stream = sys.stdout\n            else:\n                progress_stream = io.StringIO()\n\n            dlmsg = \"Downloading {0}\".format(remote_url)\n            with ProgressBarOrSpinner(size, dlmsg, file=progress_stream) as p:\n                with NamedTemporaryFile(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                            hash.update(block)\n                            bytes_read += len(block)\n                            p.update(bytes_read)\n                            block = remote.read(conf.download_block_size)\n                    except BaseException:\n                        if os.path.exists(f.name):\n                            os.remove(f.name)\n                        raise\n\n        if cache:\n            _acquire_download_cache_lock()\n            try:\n                with shelve.open(urlmapfn) as url2hash:\n                    # We check now to see if another process has\n                    # inadvertently written the file underneath us\n                    # already\n                    if url_key in url2hash:\n                        return url2hash[url_key]\n                    local_path = os.path.join(dldir, hash.hexdigest())\n                    shutil.move(f.name, local_path)\n                    url2hash[url_key] = local_path\n            finally:\n                _release_download_cache_lock()\n        else:\n            local_path = f.name\n            if missing_cache:\n                msg = ('File downloaded to temporary location due to problem '\n                       'with cache directory and will not be cached.')\n                warn(CacheMissingWarning(msg, local_path))\n            if conf.delete_temporary_downloads_at_exit:\n                global _tempfilestodel\n                _tempfilestodel.append(local_path)\n    except urllib.error.URLError as e:\n        if hasattr(e, 'reason') and hasattr(e.reason, 'errno') and e.reason.errno == 8:\n            e.reason.strerror = e.reason.strerror + '. requested URL: ' + remote_url\n            e.reason.args = (e.reason.errno, e.reason.strerror)\n        raise e\n    except socket.timeout as e:\n        # this isn't supposed to happen, but occasionally a socket.timeout gets\n        # through.  It's supposed to be caught in `urrlib2` and raised in this\n        # way, but for some reason in mysterious circumstances it doesn't. So\n        # we'll just re-raise it here instead\n        raise urllib.error.URLError(e)\n\n    return local_path"},{"col":0,"comment":" Finds the path to the data cache directory and makes them if\n    they don't exist.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    shelveloc : str\n        The path to the shelve object that stores the cache info.\n    ","endLoc":1294,"header":"def _get_download_cache_locs()","id":348,"name":"_get_download_cache_locs","nodeType":"Function","startLoc":1258,"text":"def _get_download_cache_locs():\n    \"\"\" Finds the path to the data cache directory and makes them if\n    they don't exist.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    shelveloc : str\n        The path to the shelve object that stores the cache info.\n    \"\"\"\n    from ..config.paths import get_cache_dir\n\n    # datadir includes both the download files and the shelveloc.  This structure\n    # is required since we cannot know a priori the actual file name corresponding\n    # to the shelve map named shelveloc.  (The backend can vary and is allowed to\n    # do whatever it wants with the filename.  Filename munging can and does happen\n    # in practice).\n    py_version = 'py' + str(sys.version_info.major)\n    datadir = os.path.join(get_cache_dir(), 'download', py_version)\n    shelveloc = os.path.join(datadir, 'urlmap')\n\n    if not os.path.exists(datadir):\n        try:\n            os.makedirs(datadir)\n        except OSError as e:\n            if not os.path.exists(datadir):\n                raise\n    elif not os.path.isdir(datadir):\n        msg = 'Data cache directory {0} is not a directory'\n        raise OSError(msg.format(datadir))\n\n    if os.path.isdir(shelveloc):\n        msg = 'Data cache shelve object location {0} is a directory'\n        raise OSError(msg.format(shelveloc))\n\n    return datadir, shelveloc"},{"id":349,"name":"releasing.rst","nodeType":"TextFile","path":"docs/development","text":"******************\nRelease Procedures\n******************\n\nThe current release procedure for Astropy involves a combination of an\nautomated release script and some manual steps.  Future versions will automate\nmore of the process, if not all.\n\n\n.. _release-procedure:\n\nRelease Procedure\n=================\n\nThis is the standard release procedure for releasing Astropy (or affiliated\npackages that use the full bugfix/maintenance branch approach.)\n\n#. (Only for major versions) Make sure to update the \"What's new\"\n   section with the stats on the number of issues, PRs, and contributors.  For\n   the first two, the `astropy-tools repository`_ script ``gh_issuereport.py``\n   can provide the numbers since the last major release.  For the final one, you\n   will likely need to update the Astropy ``.mailmap`` file, as there are often\n   contributors who are not careful about using the same e-mail address for\n   every commit.  The easiest way to do this is to run the command\n   ``git shortlog -n -s -e`` to see the list of all contributors and their email\n   addresses.  Look for any mis-named entries or duplicates, and add them to the\n   ``.mailmap`` file (matched to the appropriate canonical name/email address.)\n   Once you have finished this, you can could the number of lines in\n   ``git shortlog -s`` to get the final contributor count.\n\n#. Also be sure to update the ``docs/credits.rst`` file to include any new\n   contributors.  This can come from the above step, or the ``author_lists.py``\n   script in the `astropy-tools repository`_ mostly automates this.  (This\n   step is only required on major releases, but can be done for bugfix releases\n   as time allows.)\n\n#. (Optional) You may want to set up a clean environment to build the release.\n   For more on setting up virtual environments, see :ref:`virtual_envs`, but\n   for the sake of example we will assume you're using `Anaconda`_. This is not\n   necessary if you know your normal python environment has what you need, but\n   you might want to do something like this for safety's sake::\n\n      $ conda create -n astropy_release_build_v<version> astropy\n      $ source activate astropy_release_build_v<version>\n      $ conda uninstall astropy  # still keeps the dependencies\n      $ pip install -r pip-requirements-dev  # any that might be left over\n\n#. Before doing a release of Astropy, you may need to do a release of\n   astropy-helpers.  This is not always necessary, as there are not always any\n   significant changes in the helpers.  See :ref:`helpers-release-info` for more\n   on this.\n\n\n#. Make sure that the continuous integration services (e.g., Travis) are passing\n   for the `astropy core repository`_ branch you're going to release.  You may\n   also want to locally run the tests (with remote data on to ensure all the\n   tests actually run), and make sure the description in ``setup.py`` is ReST\n   compliant::\n\n      $ python setup.py test --remote-data=any\n      $ python setup.py check --restructuredtext\n\n#. Ensure you have a GPG key pair available for when git needs to sign the\n   tag you create for the release.  See :ref:`key-signing-info` for more on\n   this.\n\n#. Obtain a *clean* version of the `astropy core repository`_.  That is, one\n   where you don't have any intermediate build files.  Either use a fresh\n   ``git clone`` or do ``git clean -dfx``. If you choose to clean the working tree,\n   don't forget to clean the ``astropy_helpers`` submodule, too.\n\n#. Be sure you're on the branch appropriate for the version you're about to\n   release.  For example, if releasing version 1.2.2 make sure to::\n\n      $ git checkout v1.2.x\n\n#. Edit the ``CHANGES.rst`` file by changing the date for the version you are\n   about to release from \"unreleased\" to today's date.  Also be sure to remove\n   any sections of the changelog for that version that have no entries.  Then\n   add and commit those changes with::\n\n      <use your favorite editor on CHANGES.rst>\n      $ git add CHANGES.rst\n      $ git commit -m \"Finalizing changelog for v<version>\"\n\n\n\n\n#. Edit the ``setup.py`` file by removing the ``\".dev\"`` at the end of the\n   ``VERSION`` string, then add and commit that change as the final step prior\n   to release::\n\n      <use your favorite editor on setup.py>\n      $ git add setup.py\n      $ git commit -m \"Preparing release v<version>\"\n\n#. Tag the commit with ``v<version>``, being certain to sign the tag with the\n   ``-s`` option::\n\n      $ git tag -s v<version> -m \"Tagging v<version>\"\n\n#. Edit the ``VERSION`` in ``setup.py`` to be the next version number, but with\n   a ``.dev`` suffix at the end (E.g., ``1.2.3.dev``).  Then add and commit::\n\n      <use your favorite editor on setup.py>\n      $ git add setup.py\n      $ git commit -m \"Back to development: v<next_version>.dev\"\n\n#. Also update the ``CHANGES.rst`` file with a new section for the next version.\n   You will likely want to use the ``add_to_changelog.py`` script in the\n   `astropy-tools repository`_ for this.  Then add and commit::\n\n      <use your favorite editor on CHANGES.rst>\n      $ git add CHANGES.rst\n      $ git commit -m \"Add v<next_version> to the changelog\"\n\n#. Now go back and check out the tag of the released version with\n   ``git checkout v<version>``.  For example::\n\n      $ git checkout v1.2.2\n\n   Don't forget to remove any non-committed files both from the main working tree\n   and ``astropy_helpers`` submodules with::\n\n      $ git clean -dfx\n      $ cd astropy_helpers; git clean -dfx; cd ..\n\n#. Make sure the source distribution doesn't inherit limited permissions\n   following your default umask::\n\n     $ umask 0022\n     $ chmod -R a+Xr .\n\n#. Create the source distribution by doing::\n\n         $ python setup.py build sdist\n\n   .. note::\n\n       In the future, the ``build`` command may run automatically as a\n       prerequisite for ``sdist``.  But for now, make sure to run it\n       whenever running ``sdist`` to ensure that all Cython sources and\n       other generated files are built.\n\n#. Run the tests in an environment that mocks up a \"typical user\" scenario.\n   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`_. Do::\n\n      $ conda create -n astropy_release_test_v<version> numpy\n      $ source activate astropy_release_test_v<version>\n      $ pip install dist/astropy-<version>.tar.gz\n      $ python -c 'import astropy; astropy.test(remote_data=True)'\n      $ source deactivate\n\n#. Build and test the Astropy wheels.  See the `wheel builder README\n   <https://github.com/MacPython/astropy-wheels>`_ for instructions.  In\n   summary, clone the wheel-building repo, edit the ``.travis.yml`` and\n   ``appveyor.yml`` text files with the branch or commit for the release,\n   commit and then push back up to github.  This will trigger a wheel build\n   and test on OSX, Linux and Windows. Check the build has passed on on the\n   Travis-CI interface at https://travis-ci.org/MacPython/astropy-wheels.\n   You'll need commit privileges to the ``astropy-wheels`` repo; ask Tom Kooij\n   or on the mailing list if you do not have them.\n\n#. If the tests do *not* pass, you'll have to fix whatever the problem is.\n   First you'll need to back out the release procedure by dropping the commits\n   you made for release and removing the tag you created::\n\n      $ git reset --hard HEAD^^^^ # you could also use the SHA hash of the commit before your first changelog edit\n      $ git tag -d v<version>\n\n#. Once the tests are all passing, it's time to actually proceed with the\n   release! This has two steps:\n\n   * build and upload the Astropy wheels;\n   * make and upload the Astropy source release.\n   \n\n#. For the wheel build / upload, follow the `wheel builder README`_\n   instructions again.  Edit the ``.travis.yml`` and ``appveyor.yml`` files\n   to give the release tag to build.  Check the build has passed on on the\n   Travis-CI interface at https://travis-ci.org/MacPython/astropy-wheels.  Now\n   follow the instructions in the page above to download the built wheels to a\n   local machine and upload to PyPI. If you use the ``wheel_download.py`` script,\n   make sure you loop through all the available OS to get all the wheels.\n\n#. Now the wheels are built and uploaded, you can upload the source release.\n   For safety's sake, you may want to clean the repo yet again to make sure\n   you didn't leave anything from the previous step::\n\n      $ git clean -dfx\n      $ cd astropy_helpers; git clean -dfx; cd ..\n\n#. Upload the source distribution to PyPI; this is preceded by re-running\n   the sdist command, which makes sure the source code is packaged up and ready\n   to be uploaded. You also need to GPG sign the release, before using twine to\n   upload it to PyPI. (You may need to install `twine`_ if you haven't used it yet)::\n\n      $ python setup.py build sdist\n      $ gpg --detach-sign -a dist/astropy-<version>.tar.gz\n      $ twine upload dist/astropy-<version>*\n      \n#. Go to https://pypi.python.org/pypi?:action=pkg_edit&name=astropy\n   and ensure that only the most recent releases in each actively maintained\n   release line are *not* marked hidden.  For example, if v1.2.2 was\n   just released, v1.2.1 should be hidden.  This is so that users only find\n   the latest bugfix releases.\n\n   Do not enabled \"Auto-hide old releases\" as that may hide bugfix releases\n   from older release lines that we may still want to make available.\n\n#. Push up these changes and the tag to the `astropy core repository`_::\n\n      $ git push upstream v<version branch>.x\n      $ git push upstream v<version branch>\n\n   .. note::\n\n      You may need to replace ``upstream`` here with ``astropy`` or\n      whatever remote name you use for the `astropy core repository`_.\n      Also, 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\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#. Update Readthedocs so that it builds docs for the version you just released.\n   You'll find this in the \"admin\" tab, with checkboxes next to each github tag.\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 \"protected\".  For example when releasing v1.1.2, set\n   v1.1.1 to \"protected\".  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#. Update the Astropy web site by editing the ``index.html`` page at\n   https://github.com/astropy/astropy.github.com by changing the \"current\n   version\" link and/or updating the list of older versions if this is an LTS\n   bugfix or a new major version.  You may also need to update the contributor\n   list on the web site if you updated the ``docs/credits.rst`` at the outset.\n\n#. In the astropy *master* branch (not just the maintenance branch), be sure to\n   update the ``CHANGES.rst`` to reflect the date of the release you just\n   performed and to include the new section of the changelog.  Often the easiest\n   way to do this is to use ``git cherry-pick`` the changelog commit just before\n   the release commit from above. If you aren't sure how to do this, you might\n   be better off just copying-and-pasting the relevant parts of the maintenance\n   branch's ``CHANGES.rst`` into master.\n\n#. If there are any issues in the Github issue tracker that are labeled\n   ``affects-dev`` but are issues that apply to this release, update them to\n   ``affects-release``.  Similarly, if any issues remain open for this release,\n   re-assign them to the next relevant milestone.\n\n#. Create a github milestone for the next bugfix version, move any remaining\n   issues from the version you just released, and close the milestone. When\n   releasing a major release, close the last milestone on the previous\n   maintenance branch, too.\n\n#. Notify the Conda Distribution Maintainer and the Continuous Integration\n   maintainer about the new release.  Typically, you should wait to make sure\n   ``conda-forge`` and possible ``conda`` works before sending out the public\n   announcement (so that users that want to try out the new version can do\n   so on conda).\n\n#. Update the ``LATEST_ASTROPY_STABLE`` or ``ASTROPY_LTS_VERSION`` variables\n   in the ``ci-helpers`` repository once the ``conda`` packages became\n   available.\n\n\nModifications for a beta/release candidate release\n--------------------------------------------------\n\n   For major releases we do beta and/or release candidates to have a chance to\n   catch significant bugs before the true release. If the release you are\n   performing is this kind of pre-release, some of the above steps need to be\n   modified.\n\n   The primary modifications to the release procedure are:\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   * Do *not* do the step of adding ``.dev`` in the \"back to development\" stage.\n     If an RC goes well, there's no need for a \"dev\" stage, as the same version\n     will be released with only minor doc updates, and strings like \"x.yrcz.dev\"\n     confuse some version number parsing tools.\n   * Do not do step #26 or later, as those are tasks for an actual release.\n\n\nPerforming a Feature Freeze/Branching new Major Versions\n========================================================\n\nAs outlined in\n`APE2 <https://github.com/astropy/astropy-APEs/blob/master/APE2.rst>`_, astropy\nreleases occur at regular intervals, but feature freezes occur well before the\nactual release.  Feature freezes are also the time when the master branch's\ndevelopment separates from the new major version's maintenance branch.  This\nallows new development for the next major version to continue while the\nsoon-to-be-released version can focus on bug fixes and documentation updates.\n\nThe procedure for this is straightforward:\n\n#. Make sure you're on master, and updated to the latest version from github::\n\n      $ git fetch upstream\n      $ git checkout upstream/master\n\n#. Create a new branch from master at the point you want the feature freeze to\n   occur::\n\n      $ git branch v<version>.x\n\n#. Update the ``VERSION`` in ``setup.py`` to reflect the new major version. For\n   example, if you are about to issue a feature freeze for version ``1.2``, you\n   will want to set the new version to ``'1.3.dev'``. Then add and commit that::\n\n      <use your favorite editor on setup.py>\n      $ git add setup.py\n      $ git commit -m \"Next major version: <next_version>\"\n\n#. Update the ``CHANGES.rst`` file with a new section at the very top for the\n   next major version.  You will likely want to use the ``add_to_changelog.py``\n   script in the `astropy-tools repository`_ for this. Then add and commit those\n   changes::\n\n      <use your favorite editor on CHANGES.rst>\n      $ git add CHANGES.rst\n      $ git commit -m \"Add <next_version> to changelog\"\n\n#. Also update the \"what's new\" section of the docs to include a section for the\n   next major version.  E.g.::\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, and commit these changes ::\n\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> whats new section\"\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 HEAD:master\n\n   .. note::\n\n      You may need to replace ``upstream`` here with ``astropy`` or\n      whatever remote name you use for the `astropy core repository`_.\n\n#. On the github issue tracker, add a new milestone for the next major version.\n\n#. Repeat the above steps for the astropy-helpers, using the same version series.\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 master branch (the release procedure below discusses\ncreating these branches).  Typically, whenever an issue is fixed on the Astropy\nmaster 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 master 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:\nv1.2.2 and v0.3.0.  In this case, v1.2.2 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 v0.3.0\nmilestone--this is any work that goes in the master branch that should not\nbe backported.  For a more detailed set of guidelines on using milestones, see\n:ref:`milestones-and-labels`.\n\nBackporting fixes from master\n-----------------------------\n\nMost fixes are backported using the ``git cherry-pick`` command, which applies\nthe diff from a single commit like a patch.  For the sake of example, say the\ncurrent bug fix branch is 'v1.2.x', and that a bug was fixed in master in a\ncommit ``abcd1234``.  In order to backport the fix, simply checkout the v1.2.x\nbranch (it's also good to make sure it's in sync with the\n`astropy core repository`_) and cherry-pick the appropriate commit::\n\n    $ git checkout v1.2.x\n    $ git pull upstream v1.2.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 master branch.  Whenever GitHub merges\na pull request it generates a merge commit in the master 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 v1.2.x\n    $ git pull upstream v1.2.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 simply\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\nMaking fixes directly to the bug fix branch\n-------------------------------------------\n\nAs mentioned earlier in this section, in some cases a fix only applies to a bug\nfix release, and is not applicable in the mainline development.  In this case\nthere are two choices:\n\n1. An Astropy developer with commit access to the `astropy core repository`_ may\n   check out the bug fix branch and commit and push your fix directly.\n\n2. **Preferable**: You may also make a pull request through GitHub against the\n   bug fix branch rather than against master.  Normally when making a pull\n   request from a branch on your fork to the `astropy core repository`_, GitHub\n   compares your branch to Astropy's master.  If you look on the left-hand\n   side of the pull request page, under \"base repo: astropy/astropy\" there is\n   a drop-down list labeled \"base branch: master\".  You can click on this\n   drop-down and instead select the bug fix branch (\"v1.2.x\" for example). Then\n   GitHub will instead compare your fix against that branch, and merge into\n   that branch when the PR is accepted.\n\nPreparing the bug fix branch for release\n----------------------------------------\n\nThere are two primary steps that need to be taken before creating a bug fix\nrelease. The rest of the procedure is the same as any other release as\ndescribed in :ref:`release-procedure` (although be sure to provide the\nright version number).\n\n1. Any existing fixes to the issues assigned to a release milestone (and older\n   LTS releases, if there are any), must be included in the maintenance branch\n   before release.\n\n2. The Astropy changelog must be updated to list all issues--especially\n   user-visible issues--fixed for the current release.  The changelog should\n   be updated in the master branch, and then merged into the bug fix branch.\n   Most issues *should* already have changelog entries for them. But\n   occasionally these are forgotten, so if doesn't exist yet please add one in\n   the process of backporting.  See :ref:`changelog-format` for more details.\n\nTo aid this process, there are a series of related scripts in the\n`astropy-tools repository`_, in the ``pr_consistency`` directory.  These scripts\nessentially check that the above two conditions are met. Detailed documentation\nfor these scripts is given in their repository, but here we summarize the basic\nworkflow.  Run the scripts in order (they are numbered 1.<something>.py,\n2.<something>.py, etc.), entering your github login credentials as needed (if\nyou are going to run them multiple times, using a ``~/.netrc`` file is\nrecommended - see `this Stack Overflow post\n<https://stackoverflow.com/questions/5343068/is-there-a-way-to-skip-password-typing-when-using-https-on-github/18362082>`_\nfor more on how to do that, or\n`a similar github help page <https://help.github.com/articles/caching-your-github-password-in-git>`_).\nThe script to actually check consistency should be run like:\n\n    $ python 4.check_consistency.py > consistency.html\n\nWhich will generate a simple web page that shows all of the areas where either\na pull request was merged into master but is *not* in the relevant release that\nit has been milestoned for, as well as any changelog irregularities (i.e., PRs\nthat are in the wrong section for what the github milestone indicates).  You'll\nwant to correct those irregularities *first* before starting the backport\nprocess (re-running the scripts in order as needed).\n\nThe end of the ``consistency.html`` page will then show a series of\n``git cherry-pick`` commands to update the maintenance branch with the PRs that\nare needed to make the milestones and branches consistent.  Make sure you're in\nthe correct maintenance branch with e.g.,\n\n    $ git checkout v1.3.x\n    $ git pull upstream v1.3.x  # Or possibly a rebase if conflicts exist\n\nif you are doing bugfixes for the 1.3.x series. Go through the commands one at a\ntime, following the cherry-picking procedure described above. If for some reason\nyou determine the github milestone was in error and the backporting is\nimpossible, re-label the issue on github and move on.  Also, whenever you\nbackport a PR, it's useful to leave a comment in the issue along the lines of\n\"backported this to v1.3.x as <SHA>\" so that it's clear that the backport\nhappened to others who might later look.\n\n.. warning::\n\n    Automated scripts are never perfect, and can either miss issues that need to\n    be backported, or in some cases can report false positives.\n\n    It's always a good idea before finalizing a bug fix release to look on\n    GitHub through the list of closed issues in the release milestone and check\n    that each one has a fix in the bug fix branch.  Usually a quick way to do\n    this is for each issue to run::\n\n        $ git log --oneline <bugfix-branch> | grep #<issue>\n\n    Most fixes will mention their related issue in the commit message, so this\n    tends to be pretty reliable.  Some issues won't show up in the commit log,\n    however, as their fix is in a separate pull request.  Usually GitHub makes\n    this clear by cross-referencing the issue with its PR.  A future version\n    of the ``suggest_backports.py`` script will perform this check\n    automatically.\n\nFinally, not all issues assigned to a release milestone need to be fixed before\nmaking that release.  Usually, in the interest of getting a release with\nexisting fixes out within some schedule, it's best to triage issues that won't\nbe fixed soon to a new release milestone.  If the upcoming bug fix release is\n'v1.2.2', then go ahead and create a 'v1.2.3' milestone and reassign to it any\nissues that you don't expect to be fixed in time for 'v1.2.2'.\n\n\n.. _helpers-release-info:\n\nCoordinating Astropy and astropy-helpers Releases\n=================================================\n\nA bit more initial effort is required for an Astropy release that has a\ncorresponding astropy-helpers release.  The main reason for this more complex\nprocedure is to allow the Astropy core to be tested against the new helpers\nbefore anything is released.  Hence the following procedure should be added\nto the beginning of the above procedure when this is required. This procedure\napplies both for regular release *and* release candidates are the same\n(except that version numbers have ``rc#`` at the end).\n\n#. In the `astropy-helpers repository`_, create a new (temporary) branch\n   \"tmp-release-v<version>\"::\n\n      $ cd /wherever/you/put/astropy/astropy_helpers\n      $ git branch tmp-release-v<version> <maintenance branch name>\n\n#. In that branch, create release commits by updating the changelog and then the\n   version info and as described in the release instructions above.\n\n#. Push the branch you just created to the `astropy-helpers repository`_ on\n   github::\n\n      $ git push upstream tmp-release-v<version>\n\n#. In astropy master (or the relevant maintenance branch for the release you\n   are doing), issue a PR updating the helpers to the commit described in the\n   last step (i.e., the commit at the head of the \"tmp-release-v<version>\"\n   branch you just created).  The easiest way to do this is::\n\n      $ cd /wherever/you/put/astropy\n      $ cd astropy_helpers\n      $ git fetch upstream  # you probably did this already in the previous step\n      $ git checkout upstream/tmp-release-v<version>\n      $ cd ..\n      $ cp astropy_helpers/ah_bootstrap.py .\n      $ git add astropy_helpers ah_bootstrap.py\n      $ git commit -m \"updated helpers to v<version>\"\n\n#. Wait for the continuous integration services (e.g., Travis) to run on the PR\n   to ensure the release commit of the helpers works with the to-be-released\n   version of Astropy.\n\n#. If the PR's tests fail, fix whatever the problem is, and then re-do this\n   procedure. You'll need to either delete the previous \"tmp-release-v<version>\"\n   branch on the github `astropy-helpers repository`_ or use ``git push -f``\n   when you push up the replacement temporary release branch. You can re-use the\n   PR into the `astropy core repository`_ (created in the step just before this\n   one) by updating the ``astropy_helpers`` submodule to point to the new\n   \"tmp-release-v<version>\" from  *after* the fix - that way you don't need to\n   make another PR for the fixed version.\n\n#. Once the tests all succeed, finish the release of the helpers by doing this\n   in the helpers repo::\n\n      $ git checkout <maintenance branch name>\n      $ git merge --no-ff tmp-release-v<version>\n      $ git tag -s \"v<version>\" -m \"Tagging v<version>\"\n      $ git clean -dfx\n      $ umask 0022\n      $ chmod -R a+Xr .\n      $ python setup.py build sdist\n      $ gpg --detach-sign -a dist/astropy-helpers-<version>.tar.gz\n      $ twine upload dist/astropy-helpers-<version>.tar.gz*\n      $ git push upstream v<version>.x\n      $ git push upstream v<version>\n\n\n#. Update the changelog and version number in *master* of the\n   `astropy-helpers repository`_ to reflect the release you just did (detailed\n   instructions are above).\n\n#. Delete the temporary branch from github:\n\n      $ git push upstream :tmp-release-v<version>\n\n#. Merge the PR for the `astropy core repository`_ that updates the helpers, and\n   continue with the release process for the core as described above.\n\nThis way the commit of the helpers that is tagged as the release is the same\ncommit that the astropy_helpers submodule will be on when the PR to astropy\ntesting the release gets merged.\n\n\n.. _key-signing-info:\n\nCreating a GPG Signing Key and a Signed Tag\n===========================================\n\nOne of the main steps in performing a release is to create a tag in the git\nrepository representing the exact state of the repository that represents the\nversion being released.  For Astropy we will always use `signed tags`_: A\nsigned tag is annotated with the name and e-mail address of the signer, a date\nand time, and a checksum of the code in the tag.  This information is then\nsigned with a GPG private key and stored in the repository.\n\nUsing a signed tag ensures the integrity of the contents of that tag for the\nfuture.  On a distributed VCS like git, anyone can create a tag of Astropy\ncalled \"0.1\" in their repository--and where it's easy to monkey around even\nafter the tag has been created.  But only one \"0.1\" will be signed by one of\nthe Astropy Project coordinators and will be verifiable with their public key.\n\nGenerating a public/private key pair\n------------------------------------\n\nGit uses GPG to created signed tags, so in order to perform an Astropy release\nyou will need GPG installed and will have to generated a signing key pair.\nMost \\*NIX installations come with GPG installed by default (as it is used to\nverify the integrity of system packages).  If you don't have the ``gpg``\ncommand, consult the documentation for your system on how to install it.\n\nFor OSX, GPG can be installed from MacPorts using ``sudo port install gnupg``.\n\nTo create a new public/private key pair, simply run::\n\n    $ gpg --gen-key\n\nThis will take you through a few interactive steps. For the encryption\nand expiry settings, it should be safe to use the default settings (I use\na key size of 4096 just because what does a couple extra kilobytes\nhurt?) Enter your full name, preferably including your middle name or\nmiddle initial, and an e-mail address that you expect to be active for a\ndecent amount of time. Note that this name and e-mail address must match\nthe info you provide as your git configuration, so you should either\nchoose the same name/e-mail address when you create your key, or update\nyour git configuration to match the key info. Finally, choose a very good\npass phrase that won't be easily subject to brute force attacks.\n\n\nIf you expect to use the same key for some time, it's good to make a backup of\nboth your public and private key::\n\n    $ gpg --export --armor > public.key\n    $ gpg --export-secret-key --armor > private.key\n\nBack up these files to a trusted location--preferably a write-once physical\nmedium that can be stored safely somewhere.  One may also back up their keys to\na trusted online encrypted storage, though some might not find that secure\nenough--it's up to you and what you're comfortable with.\n\nAdd your public key to a keyserver\n----------------------------------\nNow that you have a public key, you can publish this anywhere you like--in your\ne-mail, in a public code repository, etc.  You can also upload it to a\ndedicated public OpenPGP keyserver.  This will store the public key\nindefinitely (until you manually revoke it), and will be automatically synced\nwith other keyservers around the world.  That makes it easy to retrieve your\npublic key using the gpg command-line tool.\n\nTo do this you will need your public key's keyname.  To find this enter::\n\n    $ gpg --list-keys\n\nThis will output something like::\n\n    /path/to/.gnupg/pubring.gpg\n    ---------------------------------------------\n    pub   4096D/1234ABCD 2012-01-01\n    uid                  Your Name <your_email>\n    sub   4096g/567890EF 2012-01-01\n\nThe 8 digit hex number on the line starting with \"pub\"--in this example the\n\"1234ABCD\" unique keyname for your public key.  To push it to a keyserver\nenter::\n\n    $ gpg --send-keys 1234ABCD\n\nBut replace the 1234ABCD with the keyname for your public key.  Most systems\ncome configured with a sensible default keyserver, so you shouldn't have to\nspecify any more than that.\n\nCreate a tag\n------------\nNow test creating a signed tag in git.  It's safe to experiment with this--you\ncan always delete the tag before pushing it to a remote repository::\n\n    $ git tag -s v0.1 -m \"Astropy version 0.1\"\n\nThis will ask for the password to unlock your private key in order to sign\nthe tag with it.  Confirm that the default signing key selected by git is the\ncorrect one (it will be if you only have one key).\n\nOnce the tag has been created, you can verify it with::\n\n    $ git tag -v v0.1\n\nThis should output something like::\n\n    object e8e3e3edc82b02f2088f4e974dbd2fe820c0d934\n    type commit\n    tag v0.1\n    tagger Your Name <your_email> 1339779534 -0400\n\n    Astropy version 0.1\n    gpg: Signature made Fri 15 Jun 2012 12:59:04 PM EDT using DSA key ID 0123ABCD\n    gpg: Good signature from \"Your Name <your_email>\"\n\nYou can use this to verify signed tags from any repository as long as you have\nthe signer's public key in your keyring.  In this case you signed the tag\nyourself, so you already have your public key.\n\nNote that if you are planning to do a release following the steps below, you\nwill want to delete the tag you just created, because the release script does\nthat for you.  You can delete this tag by doing::\n\n    $ git tag -d v0.1\n\n\n.. _astropy core repository: https://github.com/astropy/astropy\n.. _signed tags: http://git-scm.com/book/en/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.. _astropy-helpers repository: https://github.com/astropy/astropy-helpers\n.. _twine: https://packaging.python.org/key_projects/#twine\n"},{"id":350,"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\nthe major goals of the Astropy Project.  Hence, we describe our\ndocumentation procedures and rules here.  For the astropy core\nproject we try to keep to these as closely as possible, while the\nstandards for affiliated packages are somewhat looser.\n(These procedures and guidelines are still recommended for affiliated\npackages, as they encourage useful documentation, a characteristic\noften lacking in professional astronomy software.)\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\n\nAstropy Documentation Rules and Guidelines\n==========================================\n\nThis section describes the standards for documentation format affiliated\npackages that must follow for consideration of integration into the core\nmodule, as well as the standard Astropy docstring format.\n\n* All documentation should be written use the Sphinx documentation tool.\n\n* The template package will provide a recommended general structure for\n  documentation.\n\n* Docstrings must be provided for all public classes, methods, and functions.\n\n* Docstrings will be incorporated into the documentation using a version of\n  numpydoc included with Astropy, and should follow the :doc:`docrules`.\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 aside from NumPy_, SciPy_, or Matplotlib_\n  must be explicitly mentioned in the documentation. They should also be\n  recorded in the ``pip-requirements-doc`` file in the root of the astropy\n  repository.\n\n* Configuration options using the :mod:`astropy.config` mechanisms must be\n  explicitly mentioned in the documentation.\n\n\nThe details of the docstring format are described on a separate page:\n\n.. toctree::\n    docrules\n\n\nSphinx Documentation Themes\n===========================\n\nA custom Sphinx HTML theme is included in the `astropy-helpers`_ package.\nThis allows the\ntheme to be used by both Astropy and affiliated packages. This is done by\nsetting the theme in the global Astropy sphinx configuration, which is imported\nin the sphinx configuration of both Astropy and affiliated packages.\n\nUsing a different theme for ``astropy`` or affiliated packages\n--------------------------------------------------------------\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\nAdding more custom themes to astropy\n------------------------------------\n\nAdditional custom themes can be included in the astropy source tree by\nplacing them in the directory ``astropy/astropy/sphinx/themes``, and\nediting ``astropy/astropy/sphinx/setup_package.py`` to include the theme\n(so that it is installed).\n\n\n\nSphinx extensions\n=================\n\nAstropy-helpers includes a number of sphinx extensions (some via the\n`sphinx-automodapi`_ package) that are used in Astropy and its affiliated\npackages to facilitate easily documenting code in a homogeneous and readable\nway. The two main extensions are `~sphinx_automodapi.automodapi` for\ngenerating module documentation and `~sphinx_automodapi.automodsumm` for\ngenerating tables of module objects. Please see their documentation about\nusage.\n\n\nedit_on_github Extension\n------------------------\n\n.. automodule:: astropy_helpers.sphinx.ext.edit_on_github\n\n\nnumpydoc Extension\n------------------\nThis extension (and some related extensions) are a port of the\n`numpydoc <https://pypi.python.org/pypi/numpydoc/0.3.1>`_ extension\nwritten by the NumPy_ and SciPy_, projects, with some tweaks for\nAstropy.  Its main purposes is to reprocess docstrings from code into\na form sphinx understands. Generally, there's no need to interact with\nit directly, as docstrings following the :doc:`docrules` will be\nprocessed automatically.\n\n\nOther Extensions\n----------------\n\n``astropy_helpers.sphinx.ext`` and `sphinx-automodapi`_ includes a few other\nextensions that are primarily helpers for the other extensions or\nworkarounds for undesired behavior.  Their APIs are not included here\nbecause we may change them in the future.\n\n\n.. _NumPy: http://www.numpy.org/\n.. _numpydoc: https://pypi.python.org/pypi/numpydoc/0.3.1\n.. _Matplotlib: http://matplotlib.org/\n.. _SciPy: https://www.scipy.org/\n.. _Sphinx: http://sphinx.pocoo.org\n.. _astropy-helpers: https://github.com/astropy/astropy-helpers\n.. _sphinx-automodapi: https://github.com/astropy/sphinx-automodapi\n"},{"col":4,"comment":"\n        Construct a `Header` from an iterable and/or text file.\n\n        Parameters\n        ----------\n        cards : A list of `Card` objects, 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":108,"header":"def __init__(self, cards=[], copy=False)","id":351,"name":"__init__","nodeType":"Function","startLoc":75,"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 : A list of `Card` objects, 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":352,"name":"docs/development/workflow","nodeType":"Package"},{"id":353,"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\". These issues are the\nmost accessible ones if you are not familiar with the Astropy source\ncode. Issues labeled as \"effort-low\" are expected to take a few hours (at\nmost) to address, while the \"effort-medium\" ones may take a few days. The\ndevelopers are friendly and want you to help, so don't be shy about asking\nquestions 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 ``master``. 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 ``master``::\n\n    * master                              # this is master in your local repo\n    remotes/your-github-username/master   # master on your fork of Astropy on GitHub\n    remotes/astropy/master                # the official development branch of Astropy\n\nThe naming scheme used by `git`_ will also be used here. A plain branch name,\nlike ``master`` means a branch in your local copy of Astropy. A branch on a\nremote, like ``astropy`` , is labeled by that remote, ``astropy/master``.\n\nThis duplication of names can get very confusing for maintainers when trying\nto merge code contributions into the official master branch,\n``astropy/master``. As a result, you should never do any work in your master\nbranch, ``master``. 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 ``master`` branch for anything. Consider :ref:`delete-master`.\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/master`` 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-master:\n\nDeleting your master branch\n===========================\n\nIt may sound strange, but deleting your own ``master`` branch can help reduce\nconfusion about which branch you are on.  See `deleting master 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/master``) changes from GitHub::\n\n   git fetch astropy\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/master``, and if there have been commits since\nyou last checked, ``astropy/master`` 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/master`` so that you are basing your\nchanges on the latest version of Astropy::\n\n    # Update the mirror of trunk\n    git fetch astropy\n\n    # Make new feature branch starting at astropy/master\n    git branch my-new-feature astropy/master\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\nTo connect your local branch to GitHub, you `git push`_ this new branch up to\nyour GitHub repo with the ``--set-upstream`` option::\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.\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\nAstropy you are working on. Do that with:\n\n.. code-block:: bash\n\n    python setup.py develop  # typically python 2.x, not python 3\n\nor:\n\n.. code-block:: bash\n\n    python3 setup.py install # python 3...\n    # ...though python3 may be called python3.3 or just python,\n    # depending on your system.\n\nIf you are using python 3 you will need to re-install after making changes to\nthe Astropy source code. Re-installing goes much faster than the initial install\nbecause it typically does not require new compilation.\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     python setup.py test\n\n   To run the tests in only a single package, e.g. Time, you can do::\n\n     python setup.py test -P time\n\n   For more details on running tests, please see :ref:`testing-guidelines`.\n\n#. Make sure your code includes appropriate docstrings, described at\n   :ref:`doc-rules`. 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     python setup.py build_docs\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   .. note::\n       If the build_docs command is not found, try running ``python setup.py\n       build_sphinx`` instead.\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:`testing-guidelines`, but if you have no experience writing tests or\n   with the `py.test`_ testing framework submit your changes without adding\n   tests, but mention in the pull request that you have not written tests. An\n   example of writing a test is in :ref:`astropy-fix-example`.\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 an entry to the file ``CHANGES.rst`` briefly describing the change you\nmade. Include the pull request number if the change fixes an issue. An\nexample entry, for the changes which fixed\n`issue 1845 <https://github.com/astropy/astropy/pull/1845>`_, is::\n\n  - ``astropy.wcs.Wcs.printwcs`` will no longer warn that ``cdelt`` is\n    being ignored when none was present in the FITS file. [#1845]\n\nIf the change is a new feature, rather than an existing issue, you will not be\nable to put in the issue number until *after* you make the pull request.\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\nThis step is easy because of the way you created the feature branch. Just::\n\n    git push\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.. _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.. _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 *master* 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 Continious\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.. _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 master # get the latest development astropy\n    git rebase astropy/master 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.\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 upstream\n  git rebase -i upstream/master\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"},{"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    Returns\n    -------\n    cachedir : str\n        The absolute path to the cache directory.\n\n    ","endLoc":159,"header":"def get_cache_dir()","id":354,"name":"get_cache_dir","nodeType":"Function","startLoc":120,"text":"def get_cache_dir():\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    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, 'astropy')\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, 'astropy')\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_astropy_dir('cache', linkto))"},{"id":355,"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.. _subversion: http://subversion.tigris.org/\n.. _git cheat sheet: http://cheat.errtheblog.com/s/git\n.. _pro git book: https://git-scm.com/book\n.. _git svn crash course: https://git-scm.com/course/svn.html\n.. _learn.github: https://services.github.com/\n.. _network graph visualizer: https://github.com/blog/39-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.com/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: http://tom.preston-werner.com/2009/05/19/the-git-parable.html\n.. _git foundation: http://matthew-brett.github.io/pydagogue/foundation.html\n.. _deleting master 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: http://nbviewer.jupyter.org/github/fperez/reprosw/blob/master/Version%20Control.ipynb\n\n.. other stuff\n.. _python: http://www.python.org\n\n.. |emdash| unicode:: U+02014\n\n.. vim: ft=rst\n"},{"id":356,"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\n\n\n\n"},{"id":357,"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_master` 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\n\nLet's say you have some changes that need to go into trunk\n(``upstream-rw/master``).\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/master\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/master\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/master..\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/master``), 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:master\n\nThis pushes the ``my-new-feature`` branch in this repository to the ``master``\nbranch in the ``upstream-rw`` repository.\n\n\n.. _milestones-and-labels:\n\n===========================\nUsing Milestones and Labels\n===========================\n\nThese guidelines are adapted from `similar guidelines <https://github.com/ipython/ipython/wiki/IPython-on-GitHub>`_\nfollowed by IPython:\n\n* 100% of confirmed issues and new features should have a milestone\n\n* Only the following criteria should result in an issue being closed without a milestone:\n\n  * Not actually an issue (user error, etc.)\n\n  * Duplicate of an existing issue\n\n  * A pull request superseded by a new pull request providing an alternate implementation\n\n* Open issues should only lack a milestone if:\n\n  * More clarification is required\n\n  * Which milestone it belongs in requires some discussion\n\n* Corollary: When an issue is closed without a milestone that means that the issue will not be fixed, or that it was\n  not a real issue at all.\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    master 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  * Future--this is for all issues that require attention at some point but for which no immediate solution is in\n    sight.\n\n* Bug fix release milestones should only be used for deferring issues that won't be fixed in the next minor release,\n  or for issues is previous releases that no longer apply to the mainline.\n\n* When in doubt about which milestone to use for an issue, use the next minor release--it can always be moved once\n  it's been more closely reviewed prior to release.\n\n* Active milestones associated with a specific release (eg. v0.3.0) should contain at least one issue with the\n  release label representing the actual task for releasing that version (this also works around the GitHub annoyance\n  that milestones without any open issues are automatically closed).\n\n* Issues that require fixing in the mainline, but that also are confirmed to apply to supported stable version lines\n  should be marked with one or more ``'backport-*'`` labels for each v0.X.Y branch that has the issue.\n\n  * In some cases it may require extra work beyond a simple merge to port bug fixes to older lines of development; if\n    such additional work is required it is not a bad idea to open a \"Backport #nnn to v0.X.Y\" issue in the appropriate\n    v0.X.Y milestone.\n\n\n.. _changelog-format:\n\n======================================\nUpdating and Maintaining the Changelog\n======================================\n\nThe Astropy \"changelog\" is kept in the file ``CHANGES.rst`` at the root of the\nrepository.  As the filename extension suggests this is a reStructured Text\nfile.  The purpose of this file is to give a technical, but still user (and\ndeveloper) oriented overview of what changes were made to Astropy between each\npublic release.  The idea is that it's a little more to the point and easier to\nfollow than trying to read through full git log.  It lists all new features\nadded between versions, so that a user can easily find out from reading the\nchangelog when a feature was added.  Likewise it lists any features or APIs\nthat were changed (and how they were changed) or removed.  It also lists all\nbug fixes.  Affiliated packages are encouraged to maintain a similar changelog.\n\nAdding to the changelog\n-----------------------\n\nThere are two approaches one may take to adding a new entry to the changelog,\neach with certain pros and cons.  Before describing the two specific approaches\nit should be said that *all* additions to the changelog should be made first\nin the 'master' branch.  This is because every release of Astropy includes a\ncopy of the changelog, and it should list all the changes in every prior\nversion of Astropy.  For example, when Astropy v0.3.0 is released, in addition\nto the changes new to that version the changelog should have all the changes\nfrom every v0.2.x version (and earlier) released up to that point.\n\nTwo approaches for including a changelog entry for a new feature or bug fix\nare:\n\n* Include the changelog update in the same pull request as the change.  That\n  is, assuming this change is being made in a pull request it can include an\n  accurate changelog update along with it.\n\n  Pro: An addition to the changelog is just like any other documentation\n  update, and should be part of any atomic change to the software.  It can\n  be pulled into master along with the rest of the change.\n\n  Con: If many pull requests also include changelog updates, they can quickly\n  conflict with each other and require rebasing.  This is not difficult to\n  resolve if the only conflict is in the changelog, but it can still be trouble\n  especially for new contributors.\n\n* Add to the changelog after a change has been merged to master, whether by\n  pull request or otherwise.\n\n  Pro: Largely escapes the merge conflict issue.\n\n  Cons: Isn't included \"atomically\" in the merge commit, making it more\n  difficult to keep track of for backporting.  Requires new contributors to\n  either make a second pull request or have a developer with push access to the\n  main repository make the commit.\n\nThe first approach is probably preferable, especially for core contributors.\nBut the latter approach is acceptable as well.\n\nChangelog format\n----------------\n\nThe exact formatting of the changelog content is a bit loose for now (though\nit might become stricter if we want to develop more tools around the\nchangelog).  The format can be mostly inferred by looking at previous versions.\nEach release gets its own heading (using the ``-`` heading marker) with the\nversion and release date.  Releases still under development have\n``(unreleased)`` as there is no release date yet.\n\nThere are generally up to three subheadings (using the ``^`` marker): \"New\nFeatures\", \"API Changes\", \"Bug Fixes\", and \"Other Changes and Additions\".  The\nlatter is mostly a catch-all for miscellaneous changes, though there's no\nreason not to make up additional sub-headings if it seems appropriate.\n\nUnder each sub-heading, changes are typically grouped according to which\nsub-package they pertain to.  Changes that apply to more than one sub-package\nor that only apply to support modules like ``logging`` or ``utils`` may go\nunder a \"Misc\" group.\n\nThe actual texts of the changelog entries are typically just one to three\nsentences--they should be easy to glance over.  Most entries end with a\nreference to an issue/pull request number in square brackets.\n\nA single changelog entry may also reference multiple small changes.  For\nexample::\n\n\n  - Minor documentation fixes and restructuring.\n    [#935, #967, #978, #1004, #1028, #1047]\n\nBeyond that, the best advice for updating the changelog is just to look at\nexisting entries for previous releases and copy the format.\n\n\n.. include:: links.inc\n"},{"id":358,"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_master`\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 1.8.4\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/articles/generating-ssh-keys>`_\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 git@github.com:your-user-name/astropy.git\n    # ...otherwise use this form:\n    $ git clone 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_master:\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 *master*. 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: ``* master``.\n\nTo make a long story short, you never want to work on master. 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    * master\n      my-own-astropy\n\nThe ``*`` indicates you are still working on master. 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    There are a couple of circumstances in which this quick method of\n    activating your copy of `Astropy`_ will NOT work and you need to go\n    straight to using a virtual python environment:\n\n    + You use Python 3.\n    + You want to work on C or Cython code in `Astropy`_.\n\nIn the directory where your copy of `Astropy`_ is type::\n\n    python setup.py develop\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==0.3.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    '0.3.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\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    python setup.py test\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    python setup.py develop -u\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    '0.2.5'\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/articles/set-up-git/#set-up-git\n"},{"id":359,"name":"command_history.sh","nodeType":"TextFile","path":"docs/development/workflow","text":"#\n# Setup\n#\n# Start by cloning the repo from your GitHub account if you need to...\ngit clone https://github.com/mwcraig/astropy.git apy-bugs\n# ...then navigate to that clone in a terminal, and...\ncd apy-bugs\n# ...rename the origin remote make its meaning clearer and...\ngit remote rename origin mwcraig\n# ...remember to set up the official remote.\ngit remote add astropy git://github.com/astropy/astropy.git\n# get the latest from the official repo\ngit fetch astropy\n#\n# Make a new branch for this fix\n#\ngit branch i-1761 astropy/master # branch just for this work\ngit checkout i-1761               # work on this branch\ngit push --set-upstream mwcraig i-1761 # Hey GitHub, get ready to receive my work\n#\n# Make a python environment for this work -- conda version shown\n#\nconda create -n apy-1761 --clone root   # copy my default environment\nsource activate apy-1761                # switch to this environment\n# next step DOES NOT WORK in python 3\npython setup.py develop                 # install astropy\n#\n# Check setup by running tests\n#\ncd astropy/coordinates/tests    # get ready to run coordinate tests\npy.test                         # test\nls                              # what is here?\n#\n# Write a test in test_arrays.py to expose this bug\n# \n# After edit, re-test\n#\npy.test test_arrays.py          # Hopefully this succeeds\n#\n# Commit changes to local git\n#\ngit status                      # what did we do? Remind me, git\ngit add test_arrays.py          # get ready to commit\n# always include a message with your commits\ngit commit -m'Add test for array coordinate length (issue #1761)'\ngit status                      # Best to be informed!\n#\n# Edit test_arrays.py\n#\ncd ..                           # up a level to coordinates\n#\n# Code fix made in editor\n#\n#\n# Test change\n#\npy.test tests/test_arrays.py   # Did our fix actually fix the problem?\npy.test                        # do all of the coordinate tests pass?\ncd ../..                       # up to the top level to check all of the tests\npython setup.py test           # grab a coffee now; this takes a while\n#\n# Success! Commit our change\n#\ngit status                     # check what we have changed, if you forgot\ngit add astropy/coordinates/coordsystems.py  # Copy and paste path from git status\n                                             # unless you like typing\n# check git staus again if you want...or not.\n# commit, with message!\ngit commit -m\"\n    > Add len() to coordinates\n    >\n    > Closes #1761\"\ngit push                       # or not--can wait until you are completely done\n#\n# Oops! Forgot to include some tests!\n#\ncd astropy/coordinates/tests   # back to add more tests\n#\n# edit test_arrays.py to add tests to test_array_len\n#\n# Now re-test\n#\npy.test test_arrays.py  # do these tests pass with the new tests?\n#   yes! now move up a couple of levels to check all tests\n#\n#   Do I really have to re-test everything? It certainly never hurts and\n#   potentially saves time for the maintainers if you have introduced a bug.\n#\ncd ../../..          # back to the top level\npython setup.py test # grab another coffee....\n#\n# Success! Time to commit\n#\ngit status           # optional, but useful for figuring out what to add\ngit add astropy/coordinates/tests/test_arrays.py # use path git status supplies\n# Commit, with a message...\ngit commit -m\"Add tests of len() for scalar coordinate and length 1 coordinate\"\n#\n# Edit the changelog in CHANGES.rst\n#\n# Then commit changes\n#\ngit add CHANGES.rst\ngit commit -m\"Add changelog entry for 1761\"\n#\n# Push changes to my GitHub account\n#\ngit push   # make sure all of our changes are in our github account\n#\n# Go to GitHub to make pull request. Remember to switch to this branch before \n# pushing the pull request button.\n#"},{"id":360,"name":"known_projects.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. Known projects\n\n.. PROJECTNAME placeholders\n.. _PROJECTNAME: http://neuroimaging.scipy.org\n.. _`PROJECTNAME github`: https://github.com/nipy\n.. _`PROJECTNAME mailing list`: http://projects.scipy.org/mailman/listinfo/nipy-devel\n\n.. numpy\n.. _numpy: http://www.numpy.org/\n.. _`numpy github`: https://github.com/numpy/numpy\n.. _`numpy mailing list`: http://mail.python.org/mailman/listinfo/numpy-discussion\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\n.. ipython\n.. _ipython: http://ipython.scipy.org\n.. _`ipython github`: https://github.com/ipython/ipython\n.. _`ipython mailing list`: http://mail.python.org/mailman/listinfo/IPython-dev\n\n.. pip\n.. _pip: https://pip.pypa.io\n\n.. virtualenv\n.. _virtualenv: https://pypi.python.org/pypi/virtualenv\n.. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrapper\n.. _virtualenvwrapper-csh: https://bitbucket.org/embray/virtualenvwrapper-csh\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.. pytest\n.. _py.test: https://pytest.org/en/latest/\n\n.. pychecker\n.. _pychecker: https://pypi.python.org/pypi/PyChecker\n"},{"id":361,"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 master branch (if you still have one, otherwise change to\n   # another branch)\n   git checkout master\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/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``http://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 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 master # 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/master upstream/master 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/master\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\nConverting a GitHub issue to a pull request\n===========================================\n\nSometimes you have a branch in your own GitHub repository designed to\nfix one particular issue.  If that issue is listed on GitHub, a natural\nway to address it is to convert the issue to a pull request by\nattaching code containing the fix for the issue. This can currently only be\ndone using the GitHub API (there's no button or anything on the web\nsite that does it, at least as of 2/6/2012). There are two options to do this,\nboth of which only work if you own the repository or have the ability to commit\ndirectly to it (for Astropy, that means being an Astropy maintainer):\n\n* You can use the script at https://gist.github.com/1750715, which will\n  do this for you automatically |emdash| just download the script and run it as\n  a python command-line script, using the ``python issue2pr.py --help``\n  option to determine the precise usage.\n\n* You can use the ``hub`` command-line utility provided `here\n  <https://github.com/github/hub>`_ by GitHub. Once installed, you can\n  attach a branch to a pull request by doing::\n\n          hub pull-request -i <ID> -b astropy:master -h <USER>:<BRANCH>\n\n  where ``<ID>`` is the ID of the issue, ``<USER>`` is the username, and\n  ``<BRANCH>`` is the name of the branch you want to attach to the\n  issue. For example::\n\n          hub pull-request -i 42 -b astropy:master -h galahad:feature\n\n  will attach the ``feature`` branch from ``galahad``'s Astropy\n  repository to issue 42.\n\n  The ``hub`` command can do a lot more to interact with GitHub, so be\n  sure to read their documentation. For example, you can fetch all\n  branches of a repository for a given user by doing::\n\n          hub fetch <USER>\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 master branch\nand you've made some commits branching off from it on your own branch::\n\n    upstream:\n\n       master\n          |\n    A--B--C\n\n    origin:\n\n     upstream/master\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 master, 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 master\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              master\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 master from the merge,\nso we want the diff of \"F\" with \"C\".\n\nSince GitHub was on ``master`` when it did ``git merge yourfork/issue-branch``, the\nlast commit in ``master`` 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       master\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":362,"name":"terminal_cast.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. include:: links.inc\n.. _terminal_cast:\n\nTerminal-cast of worked example\n*******************************\n\n.. note::\n\n    The commands used for creating a new environment in this example work\n    only in the Anaconda python distribution. For other distributions use\n    `virtualenvwrapper`_; see :ref:`virtual_envs` for details.\n\n.. raw:: html\n\n    <iframe src='http://asciinema.org/a/7003/raw?container_width=695&speed=4' width='700' height='800'></iframe>\n"},{"col":0,"comment":"null","endLoc":303,"header":"def _find_or_create_astropy_dir(dirnm, linkto)","id":363,"name":"_find_or_create_astropy_dir","nodeType":"Function","startLoc":272,"text":"def _find_or_create_astropy_dir(dirnm, linkto):\n    innerdir = os.path.join(_find_home(), '.astropy')\n    maindir = os.path.join(_find_home(), '.astropy', 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 Astropy directory {0} is actually a file.'\n            raise OSError(msg.format(innerdir))\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 Astropy {0} directory {1} is actually a file.'\n        raise OSError(msg.format(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":76,"header":"def _find_home()","id":364,"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\n    # First find the home directory - this is inspired by the scheme ipython\n    # uses to identify \"home\"\n    if os.name == 'posix':\n        # Linux, Unix, AIX, OS X\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        # Next try for a network home\n        elif 'HOMESHARE' in os.environ:\n            homedir = os.environ['HOMESHARE']\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'\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 unspported '\n                          'platform?')\n    return homedir"},{"id":365,"name":"command_history_with_output.sh","nodeType":"TextFile","path":"docs/development/workflow","text":"#\n# Setup\n#\n# Start by cloning the repo from your GitHub account if you need to...\n$ git clone https://github.com/mwcraig/astropy.git apy-bugs\nCloning into 'apy-bugs'...                                                      \nremote: Counting objects: 44980, done.                                          \nremote: Compressing objects: 100% (11772/11772), done.                          \nremote: Total 44980 (delta 32930), reused 44980 (delta 32930)                   \nReceiving objects: 100% (44980/44980), 18.13 MiB | 3.57 MiB/s, done.            \nResolving deltas: 100% (32930/32930), done.                                     \nChecking connectivity... done.  \n\n# ...then navigate to that clone in a terminal, and...\n$ cd apy-bugs\n# ...rename the origin remote make its meaning clearer and...\n$ git remote rename origin mwcraig\n# ...remember to set up the official remote.\n$ git remote add astropy git://github.com/astropy/astropy.git\n\n# get the latest from the official repo\n$ git fetch astropy\nremote: Counting objects: 37, done.                                             \nremote: Compressing objects: 100% (30/30), done.                                \nremote: Total 37 (delta 10), reused 23 (delta 7)                                \nUnpacking objects: 100% (37/37), done.                                          \nFrom git://github.com/astropy/astropy                                           \n * [new branch]      master     -> astropy/master                               \n * [new branch]      stable     -> astropy/stable                               \n * [new branch]      v0.1.x     -> astropy/v0.1.x                               \n * [new branch]      v0.2.x     -> astropy/v0.2.x                               \n * [new branch]      v0.3.x     -> astropy/v0.3.x  \n#\n# Make a new branch for this fix\n#\n$ git branch i-1761 astropy/master # branch just for this work\nBranch i-1761 set up to track remote branch master from astropy.\n\n$ git checkout i-1761               # work on this branch\nSwitched to branch 'i-1761'                                                     \nYour branch is up-to-date with 'astropy/master'. \n\n# let my github account know about this branch\n$ git push --set-upstream mwcraig i-1761 # Hey GitHub, get ready to receive my work\nBranch i-1761 set up to track remote branch i-1761 from mwcraig.                \nEverything up-to-date  \n\n#\n# Make a python environment for this work -- conda version shown\n#\n$ conda create -n apy-1761 --clone root   # copy my default environment\nOutput not shown\n\n$ source activate apy-1761                # switch to this environment\nprepending /Users/mcraig/anaconda/envs/apy-1761/bin to PATH\n\n# next step DOES NOT WORK in python 3\n$ python setup.py develop   # install astropy, python 2\n# using python 3? do this instead: python3 setup.py install\nConfigured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-\ngxx-include-dir=/usr/include/c++/4.2.1                                          \nrunning develop                                                                 \nrunning egg_info                                                                \nwriting requirements to astropy.egg-info/requires.txt                           \nwriting astropy.egg-info/PKG-INFO\n...\nUsing /Users/mcraig/anaconda/envs/apy-1761/lib/python2.7/site-packages          \nFinished processing dependencies for astropy==0.4.dev6873  \n\n#\n# Check setup by running tests\n#\n$ cd astropy/coordinates/tests    # get ready to run coordinate tests\n$ py.test                         # test\n============================= test session starts ==============================\nplatform darwin -- Python 2.7.6 -- pytest-2.4.2\n\nRunning tests with Astropy version 0.4.dev6877.\nRunning tests in /Users/mcraig/Development/astronomy/apy-bugs/astropy/coordinates/tests.\n\nPlatform: Darwin-13.0.0-x86_64-i386-64bit\n\nExecutable: /Users/mcraig/anaconda/envs/apy-1761/bin/python\n\nFull Python Version:\n2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)\n[GCC 4.0.1 (Apple Inc. build 5493)]\n\nencodings: sys: ascii, locale: US-ASCII, filesystem: utf-8, unicode bits: 15\nbyteorder: little\nfloat info: dig: 15, mant_dig: 15\n\nNumpy: 1.7.1\nScipy: 0.13.0\nMatplotlib: 1.3.1\nh5py: 2.2.0\n\nplugins: capturelog\ncollected 103 items / 2 skipped\n\ntest_angles.py .......................\ntest_angular_separation.py ..\ntest_api.py ............\ntest_arrays.py .............\ntest_distance.py ........\ntest_formatting.py ....................\ntest_matching.py ....\ntest_name_resolve.py ss\ntest_transformations.py ...............\naccuracy/test_fk4_no_e_fk4.py .\naccuracy/test_fk4_no_e_fk5.py .\naccuracy/test_galactic_fk4.py .\naccuracy/test_icrs_fk5.py .\n\n=================== 101 passed, 4 skipped in 152.23 seconds ===================\n\n$ ls   # what is here?\n__init__.py                test_api.pyc                                         \n__init__.pyc               test_arrays.py                                       \n__pycache__                test_distance.py                                     \naccuracy                   test_formatting.py                                   \ntest_angles.py             test_matching.py                                     \ntest_angular_separation.py test_name_resolve.py                                 \ntest_api.py                test_transformations.py  \n#\n# Write a test in test_arrays.py to expose this bug\n# \n# After edit, re-test\n#\n$ py.test test_arrays.py # Hopefully this FAILS--we are trying to expose bug\n                                                                                \nRunning tests with Astropy version 0.4.dev6873.                                 \nRunning tests in test_arrays.py.                                                \n                                                                                \nPlatform: Darwin-13.0.0-x86_64-i386-64bit                                       \n                                                                                \nExecutable: /Users/mcraig/anaconda/envs/apy-1761/bin/python                     \n                                                                                \nFull Python Version:                                                            \n2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)                \n[GCC 4.0.1 (Apple Inc. build 5493)]                                             \n                                                                                \nencodings: sys: ascii, locale: US-ASCII, filesystem: utf-8, unicode bits: 15    \nbyteorder: little                                                               \nfloat info: dig: 15, mant_dig: 15                                               \n                                                                                \nNumpy: 1.7.1                                                                    \nScipy: 0.13.0                                                                   \nMatplotlib: 1.3.1                                                               \nh5py: 2.2.0                                                                     \n                                                                                \nplugins: capturelog                                                             \ncollected 13 items                                                              \n                                                                                \ntest_arrays.py ............F                                                    \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                                           \nE       TypeError: object of type 'ICRS' has no len()                           \n                                                                                \ntest_arrays.py:291: TypeError                                                   \n===================== 1 failed, 12 passed in 2.49 seconds ======================\n\n# Good, failure, as expected.\n#\n# what did we do? Remind me, git\n#\n$ git status                     \nOn branch i-1761                                                                \nYour branch is up-to-date with 'mwcraig/i-1761'.                                \n                                                                                \nChanges 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:   test_arrays.py                                              \n                                                                                \nno changes added to commit (use \"git add\" and/or \"git commit -a\")       \n\n#\n# How about more detail, git?\n$ git diff\ndiff --git a/astropy/coordinates/tests/test_arrays.py b/astropy/coordinates/test\nindex 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+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\n#\n# Stage, then commit\n$ git add test_arrays.py          # get ready to commit\n# always include a message with your commits\n$ git commit -m'Add test for array coordinate length (issue #1761)'\n[i-1761 23ba4ce] Add test for array coordinate length (issue #1761)             \n 1 file changed, 11 insertions(+)   \n\n#\n# Now fix the bug...edit ../coordsystems.py\n#\n# Code fix made in editor\n#\n# Test change\n#\n$ py.test test_arrays.py   # Did our fix actually fix the problem?\n============================= test session starts ==============================\nplatform darwin -- Python 2.7.6 -- pytest-2.4.2                                 \n                                                                                \nRunning tests with Astropy version 0.4.dev6874.                                 \nRunning tests in test_arrays.py.                                                \n                                                                                \nPlatform: Darwin-13.0.0-x86_64-i386-64bit                                       \n                                                                                \nExecutable: /Users/mcraig/anaconda/envs/apy-1761/bin/python                     \n                                                                                \nFull Python Version:                                                            \n2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)                \n[GCC 4.0.1 (Apple Inc. build 5493)]                                             \n                                                                                \nencodings: sys: ascii, locale: US-ASCII, filesystem: utf-8, unicode bits: 15    \nbyteorder: little                                                               \nfloat info: dig: 15, mant_dig: 15                                               \n                                                                                \nNumpy: 1.7.1                                                                    \nScipy: 0.13.0                                                                   \nMatplotlib: 1.3.1                                                               \nh5py: 2.2.0                                                                     \n                                                                                \nplugins: capturelog                                                             \ncollected 13 items                                                              \n                                                                                \ntest_arrays.py .............                                                    \n                                                                                \n========================== 13 passed in 2.60 seconds ===========================\n\n# Great! We fixed it!\n#\n# Run all of the coordinate tests to make sure we broke nothing...\n$ py.test                        # do all of the coordinate tests pass?\n============================= test session starts ==============================\nplatform darwin -- Python 2.7.6 -- pytest-2.4.2\n\nRunning tests with Astropy version 0.4.dev6877.\nRunning tests in /Users/mcraig/Development/astronomy/apy-bugs/astropy/coordinates/tests.\n\nPlatform: Darwin-13.0.0-x86_64-i386-64bit\n\nExecutable: /Users/mcraig/anaconda/envs/apy-1761/bin/python\n\nFull Python Version:\n2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)\n[GCC 4.0.1 (Apple Inc. build 5493)]\n\nencodings: sys: ascii, locale: US-ASCII, filesystem: utf-8, unicode bits: 15\nbyteorder: little\nfloat info: dig: 15, mant_dig: 15\n\nNumpy: 1.7.1\nScipy: 0.13.0\nMatplotlib: 1.3.1\nh5py: 2.2.0\n\nplugins: capturelog\ncollected 103 items / 2 skipped\n\ntest_angles.py .......................\ntest_angular_separation.py ..\ntest_api.py ............\ntest_arrays.py .............\ntest_distance.py ........\ntest_formatting.py ....................\ntest_matching.py ....\ntest_name_resolve.py ss\ntest_transformations.py ...............\naccuracy/test_fk4_no_e_fk4.py .\naccuracy/test_fk4_no_e_fk5.py .\naccuracy/test_galactic_fk4.py .\naccuracy/test_icrs_fk5.py .\n\n=================== 101 passed, 4 skipped in 152.23 seconds ===================\n\n# So far, so good, now check ALL tests\n$ cd ../../..                       # up to the top level to check all of the tests\n$ python setup.py test           # grab a coffee now; this takes a while\nonfigured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1\nFreezing version number to astropy/version.py\nrunning test\nrunning build\nrunning build_py\ncopying astropy/version.py -> build/lib.macosx-10.5-x86_64-2.7/astropy\ncopying astropy/coordinates/tests/test_arrays.py -> build/lib.macosx-10.5-x86_64-2.7/astropy/coordinates/tests\n...\nOUTPUT TRUNCATED\n\n#\n# Success! Commit our change\n#\n$ git status                     # check what we have changed, if you forgot\nOn branch i-1761                                                                \nYour branch is ahead of 'mwcraig/i-1761' by 1 commit.                           \n  (use \"git push\" to publish your local commits)                                \n                                                                                \nChanges 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                                                                                \nno changes added to commit (use \"git add\" and/or \"git commit -a\") \n\n# stage change\n$ git add astropy/coordinates/coordsystems.py # Copy and paste path from git status\n                                             # unless you like typing\n# commit, with message!\n$ git commit -m\"\n    > Add len() to coordinates\n    >\n    > Closes #1761\"\n[i-1761 9688f7e] Add len() to coordinates                                       \n 1 file changed, 2 insertions(+)  \n\n# copy changes to the i-1761 branch in my github account...\n$ git push           # or not--can wait until you are completely done\nCounting objects: 52, done.                                                     \nDelta compression using up to 2 threads.                                        \nCompressing objects: 100% (11/11), done.                                        \nWriting objects: 100% (11/11), 1.01 KiB | 0 bytes/s, done.                      \nTotal 11 (delta 9), reused 0 (delta 0)                                          \nTo https://github.com/mwcraig/astropy.git                                       \n   7fa981e..9688f7e  i-1761 -> i-1761  \n\n#\n# Oops! Forgot to include some tests!\n#\n$ cd astropy/coordinates/tests   # back to add more tests\n#\n# edit test_arrays.py to add tests to test_array_len\n#\n# Now re-test\n#\n$ py.test test_arrays.py  # do these tests pass with the new tests?\n============================= test session starts ==============================\nplatform darwin -- Python 2.7.6 -- pytest-2.4.2                                 \n                                                                                \nRunning tests with Astropy version 0.4.dev6874.                                 \nRunning tests in test_arrays.py.                                                \n                                                                                \nPlatform: Darwin-13.0.0-x86_64-i386-64bit                                       \n                                                                                \nExecutable: /Users/mcraig/anaconda/envs/apy-1761/bin/python                     \n                                                                                \nFull Python Version:                                                            \n2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)                \n[GCC 4.0.1 (Apple Inc. build 5493)]                                             \n                                                                                \nencodings: sys: ascii, locale: US-ASCII, filesystem: utf-8, unicode bits: 15    \nbyteorder: little                                                               \nfloat info: dig: 15, mant_dig: 15                                               \n                                                                                \nNumpy: 1.7.1                                                                    \nScipy: 0.13.0                                                                   \nMatplotlib: 1.3.1                                                               \nh5py: 2.2.0                                                                     \n                                                                                \nplugins: capturelog                                                             \ncollected 13 items                                                              \n                                                                                \ntest_arrays.py .............                                                    \n                                                                                \n========================== 13 passed in 2.60 seconds ===========================\n\n#\n#   yes! now move up a couple of levels to check all tests\n#\n#   Do I really have to re-test everything? It certainly never hurts and\n#   potentially saves time for the maintainers if you have introduced a bug.\n#\n$ cd ../../..          # back to the top level\n$ python setup.py test # grab another coffee....\nOUTPUT OMITTED\n\n#\n# Success! Time to commit\n#\n$ git status           # optional, but useful for figuring out what to add\nOn branch i-1761                                                                \nYour branch is up-to-date with 'mwcraig/i-1761'.                                \n                                                                                \nChanges 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                                                                                \nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n# \n# Stage...\n$ git add astropy/coordinates/tests/test_arrays.py # use path git status supplies\n\n# Commit, with a message...\n$ git commit -m\"Add tests of len() for scalar coordinate and length 1 coordinate\"\n[i-1761 ed92c2d] Add tests of len() for scalar coordinate and length 1 coordinat\ne                                                                               \n 1 file changed, 10 insertions(+), 5 deletions(-) \n\n# Almost done...\n#\n# Edit the changelog in CHANGES.rst\n#\n# Then commit changes\n#\n$ git add CHANGES.rst\n$ git commit -m\"Add changelog entry for 1761\"\n[i-1761 bf6fcfc] Add changelog entry for 1761                                   \n 1 file changed, 2 insertions(+)                                                \n\n#\n# Push changes to my GitHub account\n#\n$ git push   # make sure all of our changes are in our github account\nCounting objects: 47, done.                                                     \nDelta compression using up to 2 threads.                                        \nCompressing objects: 100% (8/8), done.                                          \nWriting objects: 100% (8/8), 836 bytes | 0 bytes/s, done.                       \nTotal 8 (delta 6), reused 0 (delta 0)                                           \nTo https://github.com/mwcraig/astropy.git                                       \n   9688f7e..bf6fcfc  i-1761 -> i-1761 \n\n#\n# Go to GitHub to make pull request. Remember to switch to this branch before \n# pushing the pull request button.\n#"},{"id":366,"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\nShort on time? Don't want to read a long tutorial?\n==================================================\n\nThere is a minimalist, command-only version of this at :ref:`command_history`.\nYou should  have `pull request 1917`_ open as you read the commands so you can\nsee the edits made to the code.\n\nThere is also a very exciting terminal-cast at :ref:`terminal_cast`.\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\n\nSet up an isolated workspace\n============================\n+ Make a new `git`_ branch for fixing this issue, check it out, and let my\n  GitHub account know about this branch::\n\n    git branch fix-1761 astropy/master   # branch based on latest from GitHub\n    git checkout fix-1761                   # switch to this branch\n    git push --set-upstream origin fix-1761 # tell my github acct about it\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 Anaconda python\n  distribution::\n\n        conda create -n apy-1761 --clone root  # Anaconda distribution only\n        source 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+ Install our branch in this environment (will not work in python 3) with::\n\n    python setup.py develop\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, doesn't take much space and\nprovide a way to keep your work organized.\n\nTests first, please\n===================\n\nIt would be hard to overstate the importance of testing to Astropy. Tests are\nwhat gives you confidence that new code does what it should and that it\ndoesn't 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, described at :ref:`testing-guidelines`.\n\nChange to that directory and run the current tests with::\n\n    cd astropy/coordinates/test\n    py.test\n\nThe tests all pass, so I need to write a new test to expose this bug.\n\n\nThere are several files with tests in them, though::\n\n    $ ls\n    test_angles.py\n    test_angular_separation.py\n    test_api.py\n    test_arrays.py\n    test_distance.py\n    test_formatting.py\n    test_matching.py\n    test_name_resolve.py\n    test_transformations.py\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, if you are not\nsure, 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 make sure future\nchanges to code do not break our fix.\n\nLooking over the existing code in ``test_arrays.py``, each test is a function\nwhose name starts with ``test_``; the last test in the file is\n``test_array_indexing`` so an appropriate place to add the test is right after\nthat.\n\nGive the test a reasonably clear name; I chose: ``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 to *fail*. Running ``py.test test_arrays.py`` gives the expected\nresult; an 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    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 I'll commit the test separately. If you aren't 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 'origin/fix-1761'.\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:   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, ``test_arrays.py``\n+ We have not added our changes to git yet, so it is listed under ``Changes\n  not staged for commit``.\n\nFor more extensive changes it can be useful to use ``git diff`` to see what\nchanges 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    +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 test_arrays.py``; 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; 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 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 'origin/fix-1761'.\n\n    Changes to be committed:\n      (use \"git reset HEAD <file>...\" to unstage)\n\n        modified:   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\nI prefer to make commits frequently, so I'll 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, 11 insertions(+)\n\nCommit messages should be short and descriptive. 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 'origin/fix-1761' 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'll 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``. 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 ``py.test tests/test_arrays.py`` in the ``coordinates``\n  directory. In this case, yes!\n+ Do the rest of the coordinate tests still pass? Check by running ``py.test``\n  in the ``coordinates`` directory. In this case, yes--we have not broken\n  anything!\n+ Do all of the astropy tests still succeed? Check by moving to the top level\n  directory (the one that contains ``setup.py``) and run ``python setup.py\n  test``. This may take several minutes 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 'origin/fix-1761' 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\nIf this was not a tutorial I would write the commit message in a git gui or\nrun ``git commit`` without a message and git would put me in an editor.\n\nHowever you do it, the message after committing should look like this::\n\n    Add len() to coordinates\n\n    Closes #1761\n\nYou can check the commit messages by running ``git log``. If the commit\nmessage doesn't look right, ask about fixing it at `astropy-dev mailing list`_.\n\nPush your changes to your GitHub fork of astropy\n================================================\n\nThis one is easy: ``git push``\n\nThis copies the changes made on your computer to your copy of Astropy on\nGitHub. At this point none of the Astropy maintainers know anything about\nyour change.\n\nWe'll take care of that in a moment with a \"pull request\", but first...\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 I realized there were some tests I could\nhave included but didn't:\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 the pull request so it doesn't hurt to check\nthem. In this case they also provide an opportunity to illustrate a feature\nof the `py.test`_ framework.\n\nI'll move back to the directory containing the tests with\n``cd astropy/coordinates/tests`` to make it a bit easier to run just the test\nI want.\n\nThe second case is easier, so I'll handle that one first following the cycle\nwe used above:\n\n+ Make the change in ``test_arrays.py``\n+ Test the change\n\nThe test passed; rather than committing this one change I'll also implement\nthe 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 in 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 I 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. It\nalso provides an opportunity to demonstrate a test when the desired result\nis an error.\n\nThe `py.test`_ framework makes testing for an exception relatively\neasy; you put the code you expect to fail in a ``with`` block::\n\n    with pytest.raises(TypeError):\n        c = ICRS(0, 0, unit=(u.degree, u.degree))\n        len(c)\n\nI added this to ``test_array_len`` in ``test_arrays.py`` and re-ran the test\nto make sure it works as desired.\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\nFollow the cycle you saw above:\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\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\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\nChanges are in the file ``CHANGES.rst`` in the top-level directory (the\ndirectory where ``setup.py`` is). Put the change under the list that matches\nthe milestone (aka release) that is set for the issue in GitHub. If you are\nproposing a new feature in a pull request you may need to wait on this change\nuntil the pull request is discussed.\n\nThis issue was tagged for 0.3.1, as shown in the image below, so the changelog\nentry went there.\n\n    .. image:: milestone.png\n\nThe entry in ``CHANGES.rst`` should summarize was you did and include the\nissue number. For writing changelog entries you don't need to know much about\nthe markup language being used (though you can read as much as you want about\nit at the `Sphinx primer`_); look at other entries and imitate.\n\nFor this issue the entry was the line that starts ``- Implemented``::\n\n    - ``astropy.coordinates``\n\n      - Implemented `len()` for coordinate objects. [#1761]\n\nStarting the line with a ``-`` makes a bulleted list item, indenting it makes\nit a sublist of ``astropy.coordinates`` and putting ``len()`` in single\nbackticks makes that text render in a typewriter font.\n\nCommit your changes to the CHANGES.rst\n--------------------------------------\n\nYou can use ``git status`` as above or jump right to staging and committing::\n\n    git add CHANGES.rst\n    git commit -m\"Add changelog entry for 1761\"\n\n\nPush your changes to GitHub\n===========================\n\nOne last push to GitHub with these changes before asking for the changes to\nbe reviewed::\n\n    git push\n\nAsk for your changes to be merged with a pull request\n=====================================================\n\nThis stage requires to go 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, like\nthat in the image 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.\n\nPlease see `pull request 1917`_ for the pull request from this example.\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/1917\n.. _pull request 1917: https://github.com/astropy/astropy/issues/1917\n.. _Sphinx primer: http://sphinx-doc.org/rest.html\n.. _test commit: https://github.com/mwcraig/astropy/commit/cf7d5ac15d7c63ae28dac638c6484339bac5f8de\n"},{"id":367,"name":"command_history.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. _command_history:\n\nCondensed example of contributing code to Astropy\n*************************************************\n\nThere are two versions:\n\n* :ref:`with output` (easier to read along with)\n* :ref:`no output` (easier to cut and paste from)\n\n.. _with output:\n\nExample, with output\n====================\n\nIn this version the commands are on the lines that begin ``$`` others are\ncomments or output.\n\n.. literalinclude:: command_history_with_output.sh\n    :language: bash\n\n.. _no output:\n\nExample, no output\n==================\n\n.. literalinclude:: command_history.sh\n    :language: bash\n"},{"id":368,"name":"links.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. compiling links file\n.. include:: known_projects.inc\n.. include:: this_project.inc\n.. include:: git_links.inc\n"},{"id":369,"name":"virtualenv_detail.rst","nodeType":"TextFile","path":"docs/development/workflow","text":":orphan:\n\n.. _using-virtualenv:\n\nUsing virtualenv\n****************\n\n`virtualenv`_ is a tool for creating and activating isolated Python\nenvironments that allow installing and experimenting with Python packages\nwithout disrupting your production Python environment.  When using commands\nsuch as ``python setup.py develop``, for example, it is strongly recommended to\ndo so within a virtualenv.  This is generally preferable to installing a\ndevelopment version of Astropy into your system site-packages and having to\nkeep track of whether or not your environment is in a \"known good\"\nconfiguration for production/science use.\n\nUsing a virtualenv is also a good way to try out new versions of software that\nyou're not actively doing development work on without disrupting your normal\nproduction environment.\n\nWe won't provide a full tutorial on using virtualenv here |emdash| the\nvirtualenv documentation linked to above is a better place to start.  But here\nis a quick overview on how to set up a virtualenv for Astropy development with\nyour default Python version:\n\n#. Install virtualenv::\n\n       $ pip install virtualenv\n\n   or (on Debian/Ubuntu)::\n\n       $ sudo apt-get install python-virtualenv\n\n   etc.\n\n#. (Recommended) Create a root directory for all your virtualenvs under a path\n   you have write access to.  For example::\n\n       $ mkdir ~/.virtualenvs\n\n#. Create the Astropy virtualenv::\n\n       $ virtualenv --distribute --system-site-packages ~/.virtualenvs/astropy-dev\n\n   The ``--system-site-packages`` option inherits all packages already\n   installed in your system site-packages directory; this frees you from having\n   to reinstall packages like Numpy and Scipy in the virtualenv.  However, if\n   you would like your virtualenv to use a development version of Numpy, for\n   example, you can still install Numpy into the virtualenv and it will take\n   precedence over the version installed in site-packages.\n\n#. Activate the virtualenv::\n\n       $ source ~/.virtualenvs/astropy-dev/bin/activate\n\n   or if you're using a csh-variant::\n\n       $ source ~/.virtualenvs/astropy-dev/bin/activate.csh\n\n   virtualenv works on Windows too |emdash| see the documentation for details.\n\n#. If the virtualenv successfully activated its name should appear in your\n   shell prompt::\n\n       (astropy-dev) $\n\n   The virtualenv can be disabled at any time by entering::\n\n       (astropy-dev) $ deactivate\n\n#. Now as long as the virtualenv is activated, packages you install with\n   ``pip``, or by manually running ``python setup.py install`` will\n   automatically install into your virtualenv instead of the system\n   site-packages.  Consider installing Astropy in develop mode into the\n   virtualenv as described :ref:`activate_development_astropy`.\n\nUsing virtualenv with IPython\n=============================\n\n.. note::\n\n    As of IPython 0.13 this functionality is built into IPython and these steps\n    are not necessary for IPython to recognize that it's running with a\n    virtualenv enabled.\n\nEach virtualenv has its own ``bin/``, and as IPython is written in pure Python\none can always install IPython directly into a virtualenv.  However, if you\nwould rather not have to install IPython every time you create a virtualenv, it\nalso suffices to make IPython virtualenv-aware.\n\n1. Check to see if you already have an IPython profile in\n   ``~/.ipython/profile_default/``; if not, create one::\n\n       $ ipython profile create\n\n2. Edit ``~/.ipython/profile_default/ipython_config.py`` and add the\n   following to the end::\n\n       import os\n\n       execfile(os.path.join(os.environ['HOME'], '.ipython', 'virtualenv.py'))\n\n3. Finally, create the ``~/.ipython/virtualenv.py`` module::\n\n    import site\n    from os import environ\n    from os.path import join\n    from sys import version_info\n\n    if 'VIRTUAL_ENV' in environ:\n        virtual_env = join(environ.get('VIRTUAL_ENV'),\n                           'lib',\n                           'python%d.%d' % version_info[:2],\n                           'site-packages')\n        site.addsitedir(virtual_env)\n        print 'VIRTUAL_ENV ->', virtual_env\n        del virtual_env\n    del site, environ, join, version_info\n\nNow IPython will import all packages from your virtualenv where applicable.\n\n.. note::\n\n    This is not magic. If you switch to a virtualenv that uses a different\n    Python version from your main IPython installation this won't help you\n    |emdash| instead use the appropriate IPython installation for the Python\n    version in question.\n\nvirtualenvwrapper\n=================\n\n`virtualenvwrapper`_ is a set of enhancements to virtualenv mostly\nimplemented through simple shell scripts and aliases.  It automatically\norganizes all your virtualenvs under a single directory (as suggested\nabove). To create a new virtualenv you can just use the ``'mkvirtualenv\n<env_name>'`` command and it will automatically create a new virtualenv of\nthat name in the default location.\n\nTo activate a virtualenv with virtualenvwrapper you don't need to think\nabout the environment's location of the filesystem or which activate script\nto run.  Simply run ``'workon <env_name>'``.  You can also list all\nvirtualenvs with ``lsvirtualenv``.  That just scratches the surface of the\ngoodies included with virtualenvwrapper.\n\nThe one caveat is that it does not support csh-like shells.  For csh-like\nshells there exists `virtualenvwrapper-csh`_, which implements most of the\nvirtualenvwrapper functionality and is otherwise compatible with the original.\nThere also exists `virtualenvwrapper-win`_, which ports virtualenvwrapper to\nWindows batch scripts.\n\nvenv\n====\n\nvirtualenv is so commonly used in the Python development community that its\nfunctionality was finally added to the standard library in Python 3.3 under\nthe name `venv`_.  venv has not gained wide use yet and is not explicitly\nsupported by tools like virtualenvwrapper, but it is expected to see wider\nadoption in the future.\n\n.. include:: links.inc\n"},{"id":370,"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 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 master\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 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 ``master`` branch::\n\n      git format-patch -M -C master\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 ``master`` branch::\n\n   git checkout master\n\n.. include:: links.inc\n"},{"id":371,"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":372,"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 with as many (or as\nfew) of the packages from your normal environment included in that virtual\nenvironment. It is sandboxed from your normal python environment in the sense\nthat packages installed in the virtual environment do not affect your normal\nenvironment in any way.\n\n.. note::\n    \"Normal python environment\" means whatever python you are using when you\n    log in.\n\nThere are two options for using virtual environments; the choice of method is\ndictated by the python distribution you use:\n\n* If you use the anaconda python distribution you must use `conda`_ to make\n  and manage your virtual environments.\n* If you use any other distribution you use `virtualenvwrapper`_; you *can not*\n  use `conda`_. As the name suggests, `virtualenvwrapper`_ is a wrapper around\n  `virtualenv`_.\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\n.. note::\n    + You **cannot** use `virtualenvwrapper`_ or `virtualenv`_ within anaconda.\n    + `virtualenvwrapper`_ works with bash and bash-like shells; see\n      :ref:`using-virtualenv` for alternatives.\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 ``pip install virtualenvwrapper``.\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.. _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* `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.. _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 normal 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 normal python environment.\n\nThe easiest way to get started is to include in your virtual environment the\npackages installed in your your normal 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 normal\n      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 normal 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* `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 normal python environment, are in the\n      `documentation for the conda command`_ and the\n      `blog post announcing anaconda environments`_.\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* Put the ``bin`` directory for the virtual environment at the front of your\n  ``$PATH``.\n* Add the name of the virtual environment to your command prompt. If you have\n  successfully switched to a new environment called ``ENV`` your prompt should\n  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      source activate ENV\n\n\n.. _deactivate_env:\n\nDeactivate a virtual environment\n================================\n\nAt some point you may want to go back to your normal 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* `conda`_: ``source deactivate``\n\n.. _delete_env:\n\nDelete a virtual environment\n============================\n\nIn both `virtualenvwrapper`_ and `conda`_ you can simply delete the directory in\nwhich the ``ENV`` is located; both also provide commands to make that a bit easier.\n\n* `virtualenvwrapper`_: ``rmvirtualenv ENV``\n* `conda`_: ``conda remove --all -n ENV``\n\n.. _documentation for virtualenvwrapper: http://virtualenvwrapper.readthedocs.io/en/latest/install.html\n.. _virtualenvwrapper command documentation: http://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html\n.. _documentation for the conda command: https://conda.io/docs/using/index.html\n.. _blog post announcing anaconda environments: https://www.anaconda.com/blog/developer-blog/conda-data-science/\n\n"},{"id":373,"name":"this_project.inc","nodeType":"TextFile","path":"docs/development/workflow","text":".. _`Astropy GitHub`: https://github.com/astropy/astropy\n\n"},{"id":374,"name":"docs/visualization","nodeType":"Package"},{"id":375,"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\n    import numpy as np\n    import matplotlib.pyplot as plt\n\n    # generate some complicated data\n    rng = np.random.RandomState(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, normed=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title('plt.hist(t, bins={0})'.format(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\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.RandomState(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    hist_kwds1 = dict(histtype='stepfilled', alpha=0.2, normed=True)\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, normed=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title('hist(t, bins=\"{0}\")'.format(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 tradeoff 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\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.RandomState(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    hist_kwds1 = dict(histtype='stepfilled', alpha=0.2, normed=True)\n\n    fig.subplots_adjust(left=0.1, right=0.95, bottom=0.15)\n    for i, bins in enumerate(['knuth', 'blocks']):\n        with warnings.catch_warnings():\n            warnings.simplefilter('ignore')  # Ignore bayesian block p0 warning\n            hist(t, bins=bins, ax=ax[i], histtype='stepfilled',\n                 alpha=0.2, normed=True)\n        ax[i].set_xlabel('t')\n        ax[i].set_ylabel('P(t)')\n        ax[i].set_title('hist(t, bins=\"{0}\")'.format(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":376,"name":"lupton_rgb.rst","nodeType":"TextFile","path":"docs/visualization","text":".. _astropy-visualization-rgb:\n\n*************************\nCreating color RGB images\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): http://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\n"},{"id":377,"name":"normalization.rst","nodeType":"TextFile","path":"docs/visualization","text":"**********************************\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\n\nIntervals and Normalization\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 provide 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\nAlso note that while the input image to\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` is\ntypically the one to be displayed, a completely different image can be\nused 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\nFinally, we also provide a convenience\n:func:`~astropy.visualization.mpl_normalize.simple_norm` function that\ncan be useful for quick interactive analysis (it is also used by the\n``fits2bitmap`` command-line script).  However, it is not recommended\nto be used in scripted programs; it's better to use\n:class:`~astropy.visualization.mpl_normalize.ImageNormalize` directly:\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"},{"id":378,"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 normaliation (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   wcsaxes/index.rst\n   normalization.rst\n   histogram.rst\n   lupton_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\nReference/API\n=============\n\n.. automodapi:: astropy.visualization\n\n.. automodapi:: astropy.visualization.mpl_normalize\n"},{"col":4,"comment":"null","endLoc":746,"header":"def _update_submodule(self, submodule, status)","id":379,"name":"_update_submodule","nodeType":"Function","startLoc":698,"text":"def _update_submodule(self, submodule, status):\n        if status == ' ':\n            # The submodule is up to date; no action necessary\n            return\n        elif status == '-':\n            if self.offline:\n                raise _AHBootstrapSystemExit(\n                    \"Cannot initialize the {0} submodule in --offline mode; \"\n                    \"this requires being able to clone the submodule from an \"\n                    \"online repository.\".format(submodule))\n            cmd = ['update', '--init']\n            action = 'Initializing'\n        elif status == '+':\n            cmd = ['update']\n            action = 'Updating'\n            if self.offline:\n                cmd.append('--no-fetch')\n        elif status == 'U':\n            raise _AHBootstrapSystemExit(\n                'Error: Submodule {0} contains unresolved merge conflicts.  '\n                'Please complete or abandon any changes in the submodule so that '\n                'it is in a usable state, then try again.'.format(submodule))\n        else:\n            log.warn('Unknown status {0!r} for git submodule {1!r}.  Will '\n                     'attempt to use the submodule as-is, but try to ensure '\n                     'that the submodule is in a clean state and contains no '\n                     'conflicts or errors.\\n{2}'.format(status, submodule,\n                                                        _err_help_msg))\n            return\n\n        err_msg = None\n        cmd = ['git', 'submodule'] + cmd + ['--', submodule]\n        log.warn('{0} {1} submodule with: `{2}`'.format(\n            action, submodule, ' '.join(cmd)))\n\n        try:\n            log.info('Running `{0}`; use the --no-git option to disable git '\n                     'commands'.format(' '.join(cmd)))\n            returncode, stdout, stderr = run_cmd(cmd)\n        except OSError as e:\n            err_msg = str(e)\n        else:\n            if returncode != 0:\n                err_msg = stderr\n\n        if err_msg is not None:\n            log.warn('An unexpected error occurred updating the git submodule '\n                     '{0!r}:\\n{1}\\n{2}'.format(submodule, err_msg,\n                                               _err_help_msg))"},{"col":4,"comment":"\n        Remove all cards from the header.\n        ","endLoc":747,"header":"def clear(self)","id":380,"name":"clear","nodeType":"Function","startLoc":740,"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":381,"name":"docs/visualization/wcsaxes","nodeType":"Package"},{"id":382,"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. There is also the option\n``exclude_overlapping=True`` to prevent overlapping tick labels from being\ndisplayed.\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', exclude_overlapping=True)\n    lat.set_ticks(spacing=10 * u.arcmin, color='white', 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":383,"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":384,"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"},{"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":1188,"header":"def append(self, card=None, useblanks=True, bottom=False, end=False)","id":385,"name":"append","nodeType":"Function","startLoc":1100,"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":386,"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<http://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":387,"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\nThis feature is only for non-angular coordinate axes. To change the format of\nangles, refer to :ref:`tick_label_format`.\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":388,"name":"slicing_datacubes.rst","nodeType":"TextFile","path":"docs/visualization/wcsaxes","text":"*****************************\nSlicing Multidimensional Data\n*****************************\n\nWCSAxes can ultimately only plot two-dimensional data. If we have an\nn-dimensional dataset, we have to select which dimensions to use for\nthe x and y axis of the image. This example will show how to slice a FITS\ndata 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<http://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://astrofrog.github.io/wcsaxes-datasets/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_ticks(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    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"},{"id":389,"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 \n`Matplotlib <http://matplotlib.org/>`_. It was previously distributed \nas a standalone package, 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)\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 than two\ndimensions, 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   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"},{"col":4,"comment":"null","endLoc":198,"header":"def __init__(self, keyword=None, value=None, comment=None, **kwargs)","id":390,"name":"__init__","nodeType":"Function","startLoc":154,"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\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._valuestring = None\n        self._valuemodified = False"},{"col":0,"comment":"\n    Determines if a given directory has enough space to hold a file of\n    a given size.  Raises an OSError if the file would be too large.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    size : int\n        A proposed filesize (in bytes)\n\n    Raises\n    -------\n    OSError : There is not enough room on the filesystem\n    ","endLoc":944,"header":"def check_free_space_in_dir(path, size)","id":391,"name":"check_free_space_in_dir","nodeType":"Function","startLoc":920,"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.  Raises an OSError if the file would be too large.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    size : int\n        A proposed filesize (in bytes)\n\n    Raises\n    -------\n    OSError : There is not enough room on the filesystem\n    \"\"\"\n    from ..utils.console import human_file_size\n\n    space = get_free_space_in_dir(path)\n    if space < size:\n        raise OSError(\n            \"Not enough free space in '{0}' \"\n            \"to download a {1} file\".format(\n                path, human_file_size(size)))"},{"id":392,"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 desribed 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    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\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 Matplotlib patches. For example, we can\nuse the :meth:`~astropy.visualization.wcsaxes.WCSAxes.get_transform` method above to plot a rectangle\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    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    r = Rectangle((266.0, -28.9), 0.3, 0.15, edgecolor='green', facecolor='none',\n                  transform=ax.get_transform('fk5'))\n    ax.add_patch(r)\n\nIn this case, the rectangle will be plotted at FK5 J2000 coordinates (266deg, -28.9deg). However, 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, dependending on the latitude, will represent a different angle on the sky). In other words, if the width and height are set to the same value, the resulting polygon will not be a square, and the 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 = Rectangle((266.4, -28.9), 0.3, 0.3, 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\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, the `~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). For this use case, you can instead use `~astropy.visualization.wcsaxes.SphericalCircle`, which takes a tuple of `~astropy.units.Quantity` as the input, and a `~astropy.units.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    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    from astropy import units as u\n    from astropy.visualization.wcsaxes import SphericalCircle\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    ax.add_patch(r)\n"},{"col":0,"comment":"\n    Given a path to a directory, returns the amount of free space (in\n    bytes) on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    Returns\n    -------\n    bytes : int\n        The amount of free space on the partition that the directory\n        is on.\n    ","endLoc":917,"header":"def get_free_space_in_dir(path)","id":393,"name":"get_free_space_in_dir","nodeType":"Function","startLoc":889,"text":"def get_free_space_in_dir(path):\n    \"\"\"\n    Given a path to a directory, returns the amount of free space (in\n    bytes) on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    Returns\n    -------\n    bytes : int\n        The amount of free space on the partition that the directory\n        is on.\n    \"\"\"\n\n    if sys.platform.startswith('win'):\n        import ctypes\n        free_bytes = ctypes.c_ulonglong(0)\n        retval = ctypes.windll.kernel32.GetDiskFreeSpaceExW(\n                ctypes.c_wchar_p(path), None, None, ctypes.pointer(free_bytes))\n        if retval == 0:\n            raise OSError('Checking free space on {!r} failed '\n                          'unexpectedly.'.format(path))\n        return free_bytes.value\n    else:\n        stat = os.statvfs(path)\n        return stat.f_bavail * stat.f_frsize"},{"col":4,"comment":"\n        Like ``_check_submodule_using_git``, but simply parses the .gitmodules file\n        to determine if the supplied path is a git submodule, and does not exec any\n        subprocesses.\n\n        This can only determine if a path is a submodule--it does not perform\n        updates, etc.  This function may need to be updated if the format of the\n        .gitmodules file is changed between git versions.\n        ","endLoc":696,"header":"def _check_submodule_no_git(self)","id":394,"name":"_check_submodule_no_git","nodeType":"Function","startLoc":640,"text":"def _check_submodule_no_git(self):\n        \"\"\"\n        Like ``_check_submodule_using_git``, but simply parses the .gitmodules file\n        to determine if the supplied path is a git submodule, and does not exec any\n        subprocesses.\n\n        This can only determine if a path is a submodule--it does not perform\n        updates, etc.  This function may need to be updated if the format of the\n        .gitmodules file is changed between git versions.\n        \"\"\"\n\n        gitmodules_path = os.path.abspath('.gitmodules')\n\n        if not os.path.isfile(gitmodules_path):\n            return False\n\n        # This is a minimal reader for gitconfig-style files.  It handles a few of\n        # the quirks that make gitconfig files incompatible with ConfigParser-style\n        # files, but does not support the full gitconfig syntax (just enough\n        # needed to read a .gitmodules file).\n        gitmodules_fileobj = io.StringIO()\n\n        # Must use io.open for cross-Python-compatible behavior wrt unicode\n        with io.open(gitmodules_path) as f:\n            for line in f:\n                # gitconfig files are more flexible with leading whitespace; just\n                # go ahead and remove it\n                line = line.lstrip()\n\n                # comments can start with either # or ;\n                if line and line[0] in (':', ';'):\n                    continue\n\n                gitmodules_fileobj.write(line)\n\n        gitmodules_fileobj.seek(0)\n\n        cfg = RawConfigParser()\n\n        try:\n            cfg.readfp(gitmodules_fileobj)\n        except Exception as exc:\n            log.warn('Malformatted .gitmodules file: {0}\\n'\n                     '{1} cannot be assumed to be a git submodule.'.format(\n                         exc, self.path))\n            return False\n\n        for section in cfg.sections():\n            if not cfg.has_option(section, 'path'):\n                continue\n\n            submodule_path = cfg.get(section, 'path').rstrip(os.sep)\n\n            if submodule_path == self.path.rstrip(os.sep):\n                return True\n\n        return False"},{"id":395,"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"},{"id":396,"name":"astropy","nodeType":"Package"},{"fileName":"logger.py","filePath":"astropy","id":397,"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\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. When ``''``, \"\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\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 = '{0}: {1}'.format(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 = '{0}: {1}'.format(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\n        fh = logging.FileHandler(filename)\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.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                fh = logging.FileHandler(log_file_path)\n            except OSError as e:\n                warnings.warn(\n                    'log file {0!r} could not be opened for writing: '\n                    '{1}'.format(log_file_path, str(e)), 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 = \"{0} [{1:s}]\".format(record.msg, record.origin)\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":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":485,"header":"def human_file_size(size)","id":398,"name":"human_file_size","nodeType":"Function","startLoc":439,"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 .. 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 \"{0:>3s}{1}\".format(str_value, suffix)"},{"id":399,"name":"astropy.cfg","nodeType":"TextFile","path":"astropy","text":"# -*- coding: utf-8 -*-\n\n### CONSOLE SETTINGS\n\n## Use Unicode characters when outputting values, and writing widgets to the\n## console.\n# unicode_output = False\n\n## When True, use ANSI color escape sequences when writing to the console.\n# use_color = True\n\n## Maximum number of lines for the pretty-printer.  If not provided,\n## determine automatically from the size of the terminal.  -1 means no\n## limit.\n# max_lines =\n\n## Maximum number of characters-per-line for the pretty-printer.  If\n## not provided, determine automatically from the size of the\n## terminal, if possible.  -1 means no limit.\n# max_width =\n\n\n### CORE DATA STRUCTURES AND TRANSFORMATIONS\n\n[nddata]\n\n## Whether to issue a warning if NDData arithmetic is performed with\n## uncertainties and the uncertainties do not support the propagation of\n## correlated uncertainties.\n# warn_unsupported_correlated = True\n\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# warn_setting_unit_directly = True\n\n[table]\n\n## The template that determines the name of a column if it cannot be\n## determined. Uses new-style (format method) string formatting\n# auto_colname = col{0}\n\n[table.jsviewer]\n\n## The URL to the jQuery library to use.  If not provided, uses the\n## internal copy installed with astropy.\n# jquery_url =\n\n## The URL to the jQuery datatables library to use.  If not provided,\n## uses the internal copy installed with astropy.\n# datatables_url =\n\n### ASTRONOMY COMPUTATIONS AND UTILITIES\n\n[samp]\n\n## Whether to allow astropy.samp to use the internet, if available\n# use_internet = True\n\n## How many times to retry communications when they fail\n# n_retries = 10\n\n\n### INPUT/OUTPUT\n\n[io.fits]\n\n## If True, enable support for record-valued keywords as described by FITS WCS\n## Paper IV. Otherwise they are treated as normal keywords.\n# enable_record_valued_keyword_cards = True\n\n## If True, extension names (i.e. the EXTNAME keyword) should be treated as\n## case-sensitive.\n# extension_name_case_sensitive = False\n\n## If True, automatically remove trailing whitespace for string values in\n## headers.  Otherwise the values are returned verbatim, with all whitespace\n## intact.\n# strip_header_whitespace = True\n\n## If True, use memory-mapped file access to read/write the data in FITS files.\n## This generally provides better performance, especially for large files, but\n## may affect performance in I/O-heavy applications.\n# use_memmap = True\n\n[io.votable]\n\n## When True, treat fixable violations of the VOTable spec as exceptions.\n# pedantic = True\n\n\n### NUTS AND BOLTS OF ASTROPY\n\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 log warnings.warn calls\n# log_warnings = True\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 = False\n\n## The file to log messages to. When '', it defaults to a file 'astropy.log' in\n## the astropy config directory.\n# log_file_path = \"\"\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)r, %(origin)r, %(levelname)r, %(message)r\"\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 = 3.0\n\n## Block size for computing MD5 file hashes.\n# hash_block_size = 65536\n\n## Number of bytes of remote data to download per step.\n# download_block_size = 65536\n\n## Number of times to try to get the lock while accessing the data cache before\n## giving up.\n# download_cache_lock_attempts = 5\n\n## If True, temporary download files created when the cache is inacessible will\n## be deleted at the end of the python session.\n# delete_temporary_downloads_at_exit = True\n"},{"fileName":"setup_package.py","filePath":"astropy","id":400,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\ndef get_package_data():\n    return {'astropy': ['astropy.cfg']}\n"},{"col":0,"comment":"null","endLoc":5,"header":"def get_package_data()","id":401,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    return {'astropy': ['astropy.cfg']}"},{"fileName":"__init__.py","filePath":"astropy","id":402,"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\n\nimport sys\nimport os\nfrom warnings import warn\n\n__minimum_python_version__ = '3.5'\n__minimum_numpy_version__ = '1.10.0'\n\n\nclass UnsupportedPythonError(Exception):\n    pass\n\nif sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):\n    raise UnsupportedPythonError(\"Astropy does not support Python < {}\".format(__minimum_python_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\ndef _is_astropy_setup():\n    \"\"\"\n    Returns whether we are currently being imported in the context of running\n    Astropy's setup.py.\n    \"\"\"\n\n    main_mod = sys.modules.get('__main__')\n    if not main_mod:\n        return False\n\n    return (getattr(main_mod, '__file__', False) and\n            os.path.basename(main_mod.__file__).rstrip('co') == 'setup.py' and\n            _is_astropy_source(main_mod.__file__))\n\n\n# this indicates whether or not we are in astropy's setup.py\ntry:\n    _ASTROPY_SETUP_\nexcept NameError:\n    from sys import version_info\n    import builtins\n\n    # This will set the _ASTROPY_SETUP_ to True by default if\n    # we are running Astropy's setup.py\n    builtins._ASTROPY_SETUP_ = _is_astropy_setup()\n\n\ntry:\n    from .version import version as __version__\nexcept ImportError:\n    # TODO: Issue a warning using the logging framework\n    __version__ = ''\ntry:\n    from .version import githash as __githash__\nexcept ImportError:\n    # TODO: Issue a warning using the logging framework\n    __githash__ = ''\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 = 'http://docs.astropy.org/en/latest/'\nelse:\n    online_docs_root = 'http://docs.astropy.org/en/{0}/'.format(__version__)\n\n\ndef _check_numpy():\n    \"\"\"\n    Check that Numpy is installed and it is of the minimum version we\n    require.\n    \"\"\"\n    # Note: We could have used distutils.version for this comparison,\n    # but it seems like overkill to import distutils at runtime.\n    requirement_met = False\n\n    try:\n        import numpy\n    except ImportError:\n        pass\n    else:\n        from .utils import minversion\n        requirement_met = minversion(numpy, __minimum_numpy_version__)\n\n    if not requirement_met:\n        msg = (\"Numpy version {0} or later must be installed to use \"\n               \"Astropy\".format(__minimum_numpy_version__))\n        raise ImportError(msg)\n\n    return numpy\n\n\nif not _ASTROPY_SETUP_:\n    _check_numpy()\n\n\nfrom . import config as _config\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# Create the test() function\nfrom .tests.runner import TestRunner\ntest = TestRunner.make_test_runner_in(__path__[0])\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    from . import config\n\n    def _rollback_import(message):\n        log.error(message)\n        # Now disable exception logging to avoid an annoying error in the\n        # exception logger before we raise the import error:\n        _teardown_log()\n\n        # Roll back any astropy sub-modules that have been imported thus\n        # far\n\n        for key in list(sys.modules):\n            if key.startswith('astropy.'):\n                del sys.modules[key]\n        raise ImportError('astropy')\n\n    try:\n        from .utils import _compiler\n    except ImportError:\n        if _is_astropy_source():\n            log.warning('You appear to be trying to import astropy from '\n                        'within a source checkout without building the '\n                        'extension modules first.  Attempting to (re)build '\n                        'extension modules:')\n\n            try:\n                _rebuild_extensions()\n            except BaseException as exc:\n                _rollback_import(\n                    'An error occurred while attempting to rebuild the '\n                    'extension modules.  Please try manually running '\n                    '`./setup.py develop` or `./setup.py build_ext '\n                    '--inplace` to see what the issue was.  Extension '\n                    'modules must be successfully compiled and importable '\n                    'in order to import astropy.')\n                # Reraise the Exception only in case it wasn't an Exception,\n                # for example if a \"SystemExit\" or \"KeyboardInterrupt\" was\n                # invoked.\n                if not isinstance(exc, Exception):\n                    raise\n\n        else:\n            # Outright broken installation; don't be nice.\n            raise\n\n    # add these here so we only need to cleanup the namespace at the end\n    config_dir = os.path.dirname(__file__)\n\n    try:\n        config.configuration.update_default_config(__package__, config_dir)\n    except config.configuration.ConfigurationDefaultMissingError as e:\n        wmsg = (e.args[0] + \" Cannot install default profile. If you are \"\n                \"importing from source, this is expected.\")\n        warn(config.configuration.ConfigurationDefaultMissingWarning(wmsg))\n\n\ndef _rebuild_extensions():\n    global __version__\n    global __githash__\n\n    import subprocess\n    import time\n\n    from .utils.console import Spinner\n\n    devnull = open(os.devnull, 'w')\n    old_cwd = os.getcwd()\n    os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))\n    try:\n        sp = subprocess.Popen([sys.executable, 'setup.py', 'build_ext',\n                               '--inplace'], stdout=devnull,\n                               stderr=devnull)\n        with Spinner('Rebuilding extension modules') as spinner:\n            while sp.poll() is None:\n                next(spinner)\n                time.sleep(0.05)\n    finally:\n        os.chdir(old_cwd)\n        devnull.close()\n\n    if sp.returncode != 0:\n        raise OSError('Running setup.py build_ext --inplace failed '\n                      'with error code {0}: try rerunning this command '\n                      'manually to check what the error was.'.format(\n                          sp.returncode))\n\n    # Try re-loading module-level globals from the astropy.version module,\n    # which may not have existed before this function ran\n    try:\n        from .version import version as __version__\n    except ImportError:\n        pass\n\n    try:\n        from .version import githash as __githash__\n    except ImportError:\n        pass\n\n\n# Set the bibtex entry to the article referenced in CITATION\ndef _get_bibtex():\n    import re\n    if os.path.exists('CITATION'):\n        with open('CITATION', 'r') as citation:\n            refs = re.findall(r'\\{[^()]*\\}', citation.read())\n            if len(refs) == 0: return ''\n            bibtexreference = \"@ARTICLE{0}\".format(refs[0])\n        return bibtexreference\n    else:\n        return ''\n\n\n__bibtex__ = _get_bibtex()\n\n\nimport logging\n\n# Use the root logger as a dummy log before initilizing Astropy's logger\nlog = logging.getLogger()\n\n\nif not _ASTROPY_SETUP_:\n    from .logger import _init_log, _teardown_log\n\n    log = _init_log()\n\n    _initialize_astropy()\n\n    from .utils.misc import find_api_page\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    from urllib.parse import urlencode\n    import webbrowser\n\n    version = __version__\n    if 'dev' in version:\n        version = 'latest'\n    else:\n        version = 'v' + version\n\n    url = 'http://docs.astropy.org/en/{0}/search.html?{1}'.format(\n        version, urlencode({'q': query}))\n\n    webbrowser.open(url)\n\n\n__dir__ = ['__version__', '__githash__', '__minimum_numpy_version__',\n           '__bibtex__', 'test', 'log', 'find_api_page', 'online_help',\n           'online_docs_root', 'conf']\n\n\nfrom types import ModuleType as __module_type__\n# Clean up top-level namespace--delete everything that isn't in __dir__\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__ 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"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":403,"name":"conf","nodeType":"Attribute","startLoc":152,"text":"conf"},{"fileName":"conftest.py","filePath":"astropy","id":404,"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\"\"\"\nfrom astropy.tests.plugins.display import PYTEST_HEADER_MODULES\nfrom astropy.tests.helper import enable_deprecations_as_exceptions\n\nenable_deprecations_as_exceptions(\n    include_astropy_deprecations=False,\n    # This is a workaround for the OpenSSL deprecation warning that comes from\n    # the `requests` module. It only appears when both asdf and sphinx are\n    # installed. This can be removed once pyopenssl 1.7.20+ is released.\n    modules_to_ignore_on_import=['requests'])\n\ntry:\n    import matplotlib\nexcept ImportError:\n    pass\nelse:\n    matplotlib.use('Agg')\n\nPYTEST_HEADER_MODULES['Cython'] = 'cython'\n"},{"className":"TestRunner","col":0,"comment":"\n    A test runner for astropy tests\n    ","endLoc":555,"id":405,"nodeType":"Class","startLoc":277,"text":"class TestRunner(TestRunnerBase):\n    \"\"\"\n    A test runner for astropy tests\n    \"\"\"\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 'utils'.\n            If nothing is specified all default Astropy tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = self.base_path\n        else:\n            self.package_path = os.path.join(self.base_path,\n                                        package.replace('.', os.path.sep))\n\n            if not os.path.isdir(self.package_path):\n                raise ValueError('Package not found: {0}'.format(package))\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            if not (os.path.isdir(test_path) or ext in ('.py', '.rst')):\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()\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        return []\n\n    @keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from py.test. 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 py.test 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 ['--pastebin={0}'.format(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 {0}). 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 ['--remote-data={0}'.format(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                                  'http://pypi.python.org/pypi/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, optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is negative, 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        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                docs_path = os.path.join(\n                    docs_path, kwargs['package'].replace('.', os.path.sep))\n            if not os.path.exists(docs_path):\n                warnings.warn(\n                    \"Can not test .rst docs, since docs path \"\n                    \"({0}) does not exist.\".format(docs_path))\n                docs_path = None\n        if docs_path and not kwargs['skip_docs'] and not kwargs['test_path']:\n            return [docs_path, '--doctest-rst']\n\n        return []\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 ['--repeat={0}'.format(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 ..table import Table  # pylint: disable=W0611\n\n        return super(TestRunner, self).run_tests(**kwargs)"},{"col":4,"comment":"\n        A `dict` containing the options this `_Bootstrapper` was configured\n        with.\n        ","endLoc":357,"header":"@property\n    def config(self)","id":406,"name":"config","nodeType":"Function","startLoc":349,"text":"@property\n    def config(self):\n        \"\"\"\n        A `dict` containing the options this `_Bootstrapper` was configured\n        with.\n        \"\"\"\n\n        return dict((optname, getattr(self, optname))\n                    for optname, _ in CFG_OPTIONS if hasattr(self, optname))"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":407,"name":"PYTEST_HEADER_MODULES","nodeType":"Attribute","startLoc":20,"text":"PYTEST_HEADER_MODULES"},{"col":4,"comment":"\n        Handle importing a vendored package from a subdirectory of the source\n        distribution.\n        ","endLoc":386,"header":"def get_local_directory_dist(self)","id":408,"name":"get_local_directory_dist","nodeType":"Function","startLoc":359,"text":"def get_local_directory_dist(self):\n        \"\"\"\n        Handle importing a vendored package from a subdirectory of the source\n        distribution.\n        \"\"\"\n\n        if not os.path.isdir(self.path):\n            return\n\n        log.info('Attempting to import astropy_helpers from {0} {1!r}'.format(\n                 'submodule' if self.is_submodule else 'directory',\n                 self.path))\n\n        dist = self._directory_import()\n\n        if dist is None:\n            log.warn(\n                'The requested path {0!r} for importing {1} does not '\n                'exist, or does not contain a copy of the {1} '\n                'package.'.format(self.path, PACKAGE_NAME))\n        elif self.auto_upgrade and not self.is_submodule:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist"},{"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":271,"header":"def find_current_module(depth=1, finddiff=False)","id":409,"name":"find_current_module","nodeType":"Function","startLoc":164,"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 = inspect.getmodule(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 = inspect.getmodule(frmb)\n            if modb not in diffmods:\n                return modb\n            frm = frmb\n    else:\n        return inspect.getmodule(frm)"},{"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 deprecation warning messages to ignore. This is in\n        addition of those already ignored by default\n        (see ``_warnings_to_ignore_by_pyver`` values).\n\n    ","endLoc":205,"header":"def 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":410,"name":"enable_deprecations_as_exceptions","nodeType":"Function","startLoc":156,"text":"def 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 deprecation warning messages to ignore. This is in\n        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)"},{"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    `~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    `~astropy.tests.runner.TestRunnerBase.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    `~astropy.tests.runner.TestRunnerBase.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":274,"id":411,"nodeType":"Class","startLoc":65,"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    `~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    `~astropy.tests.runner.TestRunnerBase.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    `~astropy.tests.runner.TestRunnerBase.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(TestRunnerBase, cls).__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(\"run_tests() got an unexpected keyword argument {}\".format(keyword))\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(\"{} keyword method must return a list\".format(keyword))\n\n            args += result\n\n        return args\n\n    RUN_TESTS_DOCSTRING = \\\n        \"\"\"\n        Run the tests for the package.\n\n        Parameters\n        ----------\n        {keywords}\n        See Also\n        --------\n        pytest.main : This method builds arguments for and then calls this function.\n        \"\"\"\n\n    def run_tests(self, **kwargs):\n\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        # runnning python setup.py test, 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            # We now need to force reload pkg_resources in case any pytest\n            # plugins were added above, so that their entry points are picked up\n            import pkg_resources\n            importlib.reload(pkg_resources)\n\n        if not _has_test_dependencies():  # pragma: no cover\n            msg = \"Test dependencies are missing. You should install the 'pytest-astropy' package.\"\n            raise RuntimeError(msg)\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(\"run_tests() got an unexpected keyword argument {}\".format(wrong_kwargs[0]))\n\n        args = self._generate_args(**kwargs)\n\n        if 'plugins' not in self.keywords or self.keywords['plugins'] is None:\n            self.keywords['plugins'] = []\n\n        # Make plugins available to test runner without registering them\n        self.keywords['plugins'].extend([\n            'astropy.tests.plugins.display',\n            'astropy.tests.plugins.config'\n        ])\n\n        # override the config locations to not make a new directory nor use\n        # existing cache or config\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 py.test 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=self.keywords['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__',), exclude_args=('self',))\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        return test"},{"col":4,"comment":"null","endLoc":96,"header":"def __init__(self, base_path)","id":412,"name":"__init__","nodeType":"Function","startLoc":95,"text":"def __init__(self, base_path):\n        self.base_path = os.path.abspath(base_path)"},{"col":4,"comment":"null","endLoc":147,"header":"def __new__(cls, *args, **kwargs)","id":413,"name":"__new__","nodeType":"Function","startLoc":98,"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(TestRunnerBase, cls).__new__(cls)"},{"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":14,"id":414,"nodeType":"Class","startLoc":9,"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    \"\"\""},{"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\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":627,"header":"def _check_if_rvkc(self, *args)","id":415,"name":"_check_if_rvkc","nodeType":"Function","startLoc":579,"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\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            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"},{"col":26,"endLoc":116,"id":416,"nodeType":"Lambda","startLoc":116,"text":"lambda func: func[1].__name__ == 'keyword'"},{"col":47,"endLoc":118,"id":417,"nodeType":"Lambda","startLoc":118,"text":"lambda x: x[1]._priority"},{"col":4,"comment":"\n        Import astropy_helpers from the given path, which will be added to\n        sys.path.\n\n        Must return True if the import succeeded, and False otherwise.\n        ","endLoc":475,"header":"def _directory_import(self)","id":418,"name":"_directory_import","nodeType":"Function","startLoc":443,"text":"def _directory_import(self):\n        \"\"\"\n        Import astropy_helpers from the given path, which will be added to\n        sys.path.\n\n        Must return True if the import succeeded, and False otherwise.\n        \"\"\"\n\n        # Return True on success, False on failure but download is allowed, and\n        # otherwise raise SystemExit\n        path = os.path.abspath(self.path)\n\n        # Use an empty WorkingSet rather than the man\n        # pkg_resources.working_set, since on older versions of setuptools this\n        # will invoke a VersionConflict when trying to install an upgrade\n        ws = pkg_resources.WorkingSet([])\n        ws.add_entry(path)\n        dist = ws.by_key.get(DIST_NAME)\n\n        if dist is None:\n            # We didn't find an egg-info/dist-info in the given path, but if a\n            # setup.py exists we can generate it\n            setup_py = os.path.join(path, 'setup.py')\n            if os.path.isfile(setup_py):\n                with _silence():\n                    run_setup(os.path.join(path, 'setup.py'),\n                              ['egg_info'])\n\n                for dist in pkg_resources.find_distributions(path, True):\n                    # There should be only one...\n                    return dist\n\n        return dist"},{"col":0,"comment":"A context manager that silences sys.stdout and sys.stderr.","endLoc":869,"header":"@contextlib.contextmanager\ndef _silence()","id":419,"name":"_silence","nodeType":"Function","startLoc":849,"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    exception_occurred = False\n    try:\n        yield\n    except:\n        exception_occurred = True\n        # Go ahead and clean up so that exception handling can work normally\n        sys.stdout = old_stdout\n        sys.stderr = old_stderr\n        raise\n\n    if not exception_occurred:\n        sys.stdout = old_stdout\n        sys.stderr = old_stderr"},{"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":22,"id":420,"nodeType":"Class","startLoc":17,"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":"\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":660,"header":"def _check_if_rvkc_image(self, *args)","id":421,"name":"_check_if_rvkc_image","nodeType":"Function","startLoc":629,"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 + len(VALUE_INDICATOR):]\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"},{"col":4,"comment":"null","endLoc":170,"header":"def _generate_args(self, **kwargs)","id":422,"name":"_generate_args","nodeType":"Function","startLoc":149,"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(\"run_tests() got an unexpected keyword argument {}\".format(keyword))\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(\"{} keyword method must return a list\".format(keyword))\n\n            args += result\n\n        return args"},{"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":35,"id":423,"nodeType":"Class","startLoc":31,"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    \"\"\""},{"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":44,"id":424,"nodeType":"Class","startLoc":38,"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    \"\"\""},{"col":0,"comment":"","endLoc":6,"header":"conftest.py#<anonymous>","id":425,"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\nenable_deprecations_as_exceptions(\n    include_astropy_deprecations=False,\n    # This is a workaround for the OpenSSL deprecation warning that comes from\n    # the `requests` module. It only appears when both asdf and sphinx are\n    # installed. This can be removed once pyopenssl 1.7.20+ is released.\n    modules_to_ignore_on_import=['requests'])\n\ntry:\n    import matplotlib\nexcept ImportError:\n    pass\nelse:\n    matplotlib.use('Agg')\n\nPYTEST_HEADER_MODULES['Cython'] = 'cython'"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.logger`.\n    ","endLoc":80,"id":426,"nodeType":"Class","startLoc":47,"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. When ``''``, \"\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.\")"},{"id":427,"name":"astropy/io","nodeType":"Package"},{"fileName":"registry.py","filePath":"astropy/io","id":428,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport contextlib\nimport pathlib\nimport re\nimport sys\n\nfrom collections import OrderedDict\nfrom operator import itemgetter\n\nimport numpy as np\n\n\n__all__ = ['register_reader', 'register_writer', 'register_identifier',\n           'identify_format', 'get_reader', 'get_writer', 'read', 'write',\n           'get_formats', 'IORegistryError', 'delay_doc_updates']\n\n\n__doctest_skip__ = ['register_identifier']\n\n\n_readers = OrderedDict()\n_writers = OrderedDict()\n_identifiers = OrderedDict()\n\nPATH_TYPES = (str, pathlib.Path)\n\n\nclass IORegistryError(Exception):\n    \"\"\"Custom error for registry clashes.\n    \"\"\"\n    pass\n\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_delayed_docs_classes = set()\n\n\n@contextlib.contextmanager\ndef delay_doc_updates(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 mutliple 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    .. warning::\n        This contextmanager is experimental and may be replaced by a more\n        general approach.\n\n    Examples\n    --------\n    see for example the source code of ``astropy.table.__init__``.\n    \"\"\"\n    _delayed_docs_classes.add(cls)\n\n    yield\n\n    _delayed_docs_classes.discard(cls)\n    _update__doc__(cls, 'read')\n    _update__doc__(cls, 'write')\n\n\ndef get_formats(data_class=None, readwrite=None):\n    \"\"\"\n    Get the list of registered I/O formats as a Table.\n\n    Parameters\n    ----------\n    data_class : classobj, 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\"``). If None\n        search for both.  Default is None.\n\n        .. versionadded:: 1.3\n\n    Returns\n    -------\n    format_table : Table\n        Table of available I/O formats.\n    \"\"\"\n    from ..table import Table\n\n    format_classes = sorted(set(_readers) | set(_writers), key=itemgetter(0))\n    rows = []\n\n    for format_class in format_classes:\n        if (data_class is not None and not _is_best_match(\n                data_class, format_class[1], format_classes)):\n            continue\n\n        has_read = 'Yes' if format_class in _readers else 'No'\n        has_write = 'Yes' if format_class in _writers else 'No'\n        has_identify = 'Yes' if format_class in _identifiers else 'No'\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.' + format_class[0], format_class[1])\n\n        deprecated = 'Yes' if ascii_format_class in format_classes else ''\n\n        rows.append((format_class[1].__name__, format_class[0], has_read,\n                     has_write, has_identify, deprecated))\n\n    if readwrite is not None:\n        if readwrite == 'Read':\n            rows = [row for row in rows if row[2] == 'Yes']\n        elif readwrite == 'Write':\n            rows = [row for row in rows if row[3] == 'Yes']\n        else:\n            raise ValueError('unrecognized value for \"readwrite\": {0}.\\n'\n                             'Allowed are \"Read\" and \"Write\" and None.')\n\n    # Sorting the list of tuples is much faster than sorting it after the table\n    # is created. (#5262)\n    if rows:\n        # Indices represent \"Data Class\", \"Deprecated\" and \"Format\".\n        data = list(zip(*sorted(rows, key=itemgetter(0, 5, 1))))\n    else:\n        data = None\n    format_table = Table(data, names=('Data class', 'Format', 'Read', 'Write',\n                                      'Auto-identify', 'Deprecated'))\n\n    if not np.any(format_table['Deprecated'] == 'Yes'):\n        format_table.remove_column('Deprecated')\n\n    return format_table\n\n\ndef _update__doc__(data_class, readwrite):\n    \"\"\"\n    Update the docstring to include all the available readers / writers for the\n    ``data_class.read`` or ``data_class.write`` functions (respectively).\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 = 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    try:\n        class_readwrite_func.__doc__ = '\\n'.join(lines)\n    except AttributeError:\n        class_readwrite_func.__func__.__doc__ = '\\n'.join(lines)\n\n\ndef register_reader(data_format, data_class, function, force=False):\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 : classobj\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    \"\"\"\n\n    if not (data_format, data_class) in _readers or force:\n        _readers[(data_format, data_class)] = function\n    else:\n        raise IORegistryError(\"Reader for format '{0}' and class '{1}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'read')\n\n\ndef unregister_reader(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 : classobj\n        The class of the object that the reader produces.\n    \"\"\"\n\n    if (data_format, data_class) in _readers:\n        _readers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No reader defined for format '{0}' and class '{1}'\"\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'read')\n\n\ndef register_writer(data_format, data_class, function, force=False):\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 : classobj\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    \"\"\"\n\n    if not (data_format, data_class) in _writers or force:\n        _writers[(data_format, data_class)] = function\n    else:\n        raise IORegistryError(\"Writer for format '{0}' and class '{1}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'write')\n\n\ndef unregister_writer(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 : classobj\n        The class of the object that can be written.\n    \"\"\"\n\n    if (data_format, data_class) in _writers:\n        _writers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No writer defined for format '{0}' and class '{1}'\"\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'write')\n\n\ndef register_identifier(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 : classobj\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        >>> def my_identifier(*args, **kwargs):\n        ...     return isinstance(args[0], str) and args[0].endswith('.tbl')\n        >>> register_identifier('ipac', Table, my_identifier)\n    \"\"\"\n\n    if not (data_format, data_class) in _identifiers or force:\n        _identifiers[(data_format, data_class)] = identifier\n    else:\n        raise IORegistryError(\"Identifier for format '{0}' and class '{1}' is \"\n                              'already defined'.format(data_format,\n                                                       data_class.__name__))\n\n\ndef unregister_identifier(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 : classobj\n        The class of the object that can be read/written.\n    \"\"\"\n\n    if (data_format, data_class) in _identifiers:\n        _identifiers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No identifier defined for format '{0}' and class\"\n                              \" '{1}'\".format(data_format, data_class.__name__))\n\n\ndef identify_format(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, other path object or None\n        The path to the file or None.\n    fileobj : File object 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 _identifiers:\n        if _is_best_match(data_class_required, data_class, _identifiers):\n            if _identifiers[(data_format, data_class)](\n                    origin, path, fileobj, *args, **kwargs):\n                valid_formats.append(data_format)\n\n    return valid_formats\n\n\ndef _get_format_table_str(data_class, readwrite):\n    format_table = get_formats(data_class, readwrite=readwrite)\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\ndef get_reader(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 : classobj\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 _readers if fmt == data_format]\n    for reader_format, reader_class in readers:\n        if _is_best_match(data_class, reader_class, readers):\n            return _readers[(reader_format, reader_class)]\n    else:\n        format_table_str = _get_format_table_str(data_class, 'Read')\n        raise IORegistryError(\n            \"No reader defined for format '{0}' and class '{1}'.\\nThe \"\n            \"available formats are:\\n{2}\".format(\n                data_format, data_class.__name__, format_table_str))\n\n\ndef get_writer(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 : classobj\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 _writers if fmt == data_format]\n    for writer_format, writer_class in writers:\n        if _is_best_match(data_class, writer_class, writers):\n            return _writers[(writer_format, writer_class)]\n    else:\n        format_table_str = _get_format_table_str(data_class, 'Write')\n        raise IORegistryError(\n            \"No writer defined for format '{0}' and class '{1}'.\\nThe \"\n            \"available formats are:\\n{2}\".format(\n                data_format, data_class.__name__, format_table_str))\n\n\ndef read(cls, *args, format=None, **kwargs):\n    \"\"\"\n    Read in data.\n\n    The arguments passed to this method depend on the format.\n    \"\"\"\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):\n                    from ..utils.data import get_readable_fileobj\n                    # path might be a pathlib.Path object\n                    if isinstance(args[0], pathlib.Path):\n                        args = (str(args[0]),) + args[1:]\n                    path = args[0]\n                    try:\n                        ctx = get_readable_fileobj(args[0], encoding='binary')\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 = _get_valid_format(\n                'read', cls, path, fileobj, args, kwargs)\n\n        reader = get_reader(format, cls)\n        data = reader(*args, **kwargs)\n\n        if not isinstance(data, cls):\n            if issubclass(cls, data.__class__):\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 {0} '\n                                    'class.'.format(cls.__name__))\n            else:\n                raise TypeError(\"reader should return a {0} instance\"\n                                \"\".format(cls.__name__))\n    finally:\n        if ctx is not None:\n            ctx.__exit__(*sys.exc_info())\n\n    return data\n\n\ndef write(data, *args, format=None, **kwargs):\n    \"\"\"\n    Write out data.\n\n    The arguments passed to this method depend on the format.\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 pathlib.Path object\n                if isinstance(args[0], pathlib.Path):\n                    args = (str(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 = _get_valid_format(\n            'write', data.__class__, path, fileobj, args, kwargs)\n\n    writer = get_writer(format, data.__class__)\n    writer(data, *args, **kwargs)\n\n\ndef _is_best_match(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      - class1 is class2 => class1 was directly registered.\n      - OR class1 is a subclass of class2 and class1 is not in classes.\n        In this case the subclass will use the parent reader/writer.\n    \"\"\"\n    # The set with the classes is only created if class1 is not class2 and\n    # class1 is a subclass of class2.\n    return (class1 is class2 or\n            (issubclass(class1, class2) and\n             class1 not in {cls for fmt, cls in format_classes}))\n\n\ndef _get_valid_format(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\n    valid_formats = identify_format(mode, cls, path, fileobj, args, kwargs)\n\n    if len(valid_formats) == 0:\n        format_table_str = _get_format_table_str(cls, mode.capitalize())\n        raise IORegistryError(\"Format could not be identified.\\n\"\n                              \"The available formats are:\\n\"\n                              \"{0}\".format(format_table_str))\n    elif len(valid_formats) > 1:\n        raise IORegistryError(\n            \"Format is ambiguous - options are: {0}\".format(\n                ', '.join(sorted(valid_formats, key=itemgetter(0)))))\n\n    return valid_formats[0]\n"},{"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":157,"id":429,"nodeType":"Class","startLoc":77,"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 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(\"No configuration parameter '{0}'\".format(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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\n                item.set(item.defaultvalue)"},{"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":673,"header":"def _init_rvkc(self, keyword, field_specifier, field, value)","id":430,"name":"_init_rvkc","nodeType":"Function","startLoc":662,"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"},{"col":4,"comment":"null","endLoc":241,"header":"def run_tests(self, **kwargs)","id":431,"name":"run_tests","nodeType":"Function","startLoc":184,"text":"def run_tests(self, **kwargs):\n\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        # runnning python setup.py test, 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            # We now need to force reload pkg_resources in case any pytest\n            # plugins were added above, so that their entry points are picked up\n            import pkg_resources\n            importlib.reload(pkg_resources)\n\n        if not _has_test_dependencies():  # pragma: no cover\n            msg = \"Test dependencies are missing. You should install the 'pytest-astropy' package.\"\n            raise RuntimeError(msg)\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(\"run_tests() got an unexpected keyword argument {}\".format(wrong_kwargs[0]))\n\n        args = self._generate_args(**kwargs)\n\n        if 'plugins' not in self.keywords or self.keywords['plugins'] is None:\n            self.keywords['plugins'] = []\n\n        # Make plugins available to test runner without registering them\n        self.keywords['plugins'].extend([\n            'astropy.tests.plugins.display',\n            'astropy.tests.plugins.config'\n        ])\n\n        # override the config locations to not make a new directory nor use\n        # existing cache or config\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 py.test 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=self.keywords['plugins'])"},{"className":"IORegistryError","col":0,"comment":"Custom error for registry clashes.\n    ","endLoc":33,"id":432,"nodeType":"Class","startLoc":30,"text":"class IORegistryError(Exception):\n    \"\"\"Custom error for registry clashes.\n    \"\"\"\n    pass"},{"col":0,"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 mutliple 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    .. warning::\n        This contextmanager is experimental and may be replaced by a more\n        general approach.\n\n    Examples\n    --------\n    see for example the source code of ``astropy.table.__init__``.\n    ","endLoc":75,"header":"@contextlib.contextmanager\ndef delay_doc_updates(cls)","id":433,"name":"delay_doc_updates","nodeType":"Function","startLoc":42,"text":"@contextlib.contextmanager\ndef delay_doc_updates(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 mutliple 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    .. warning::\n        This contextmanager is experimental and may be replaced by a more\n        general approach.\n\n    Examples\n    --------\n    see for example the source code of ``astropy.table.__init__``.\n    \"\"\"\n    _delayed_docs_classes.add(cls)\n\n    yield\n\n    _delayed_docs_classes.discard(cls)\n    _update__doc__(cls, 'read')\n    _update__doc__(cls, 'write')"},{"col":0,"comment":"\n    Update the docstring to include all the available readers / writers for the\n    ``data_class.read`` or ``data_class.write`` functions (respectively).\n    ","endLoc":202,"header":"def _update__doc__(data_class, readwrite)","id":434,"name":"_update__doc__","nodeType":"Function","startLoc":146,"text":"def _update__doc__(data_class, readwrite):\n    \"\"\"\n    Update the docstring to include all the available readers / writers for the\n    ``data_class.read`` or ``data_class.write`` functions (respectively).\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 = 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    try:\n        class_readwrite_func.__doc__ = '\\n'.join(lines)\n    except AttributeError:\n        class_readwrite_func.__func__.__doc__ = '\\n'.join(lines)"},{"col":0,"comment":"null","endLoc":32,"header":"def _has_test_dependencies()","id":435,"name":"_has_test_dependencies","nodeType":"Function","startLoc":22,"text":"def _has_test_dependencies(): # 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    required = ['pytest', 'pytest_remotedata', 'pytest_doctestplus']\n    for module in required:\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            return False\n\n    return True"},{"col":4,"comment":"null","endLoc":391,"header":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0)","id":436,"name":"__new__","nodeType":"Function","startLoc":273,"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            # 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        # 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:\n                if not copy:\n                    return value\n\n                if not np.can_cast(np.float32, value.dtype):\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 \"{0}\" as a {1}. 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 and\n                  all(isinstance(v, Quantity) for v in value)):\n                # Convert all quantities 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\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 {0!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{1}\"\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=False, 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(() if value.ndim == 0 else 0),\n                            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 (not np.can_cast(np.float32, value.dtype)\n                              or value.dtype.kind == 'O'):\n            value = value.astype(float)\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)"},{"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":1180,"header":"def _int_or_float(s)","id":437,"name":"_int_or_float","nodeType":"Function","startLoc":1163,"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))"},{"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":117,"header":"def set_temp(self, attr, value)","id":438,"name":"set_temp","nodeType":"Function","startLoc":95,"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(\"No configuration parameter '{0}'\".format(attr))"},{"col":0,"comment":"\n    Get the list of registered I/O formats as a Table.\n\n    Parameters\n    ----------\n    data_class : classobj, 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\"``). If None\n        search for both.  Default is None.\n\n        .. versionadded:: 1.3\n\n    Returns\n    -------\n    format_table : Table\n        Table of available I/O formats.\n    ","endLoc":143,"header":"def get_formats(data_class=None, readwrite=None)","id":439,"name":"get_formats","nodeType":"Function","startLoc":78,"text":"def get_formats(data_class=None, readwrite=None):\n    \"\"\"\n    Get the list of registered I/O formats as a Table.\n\n    Parameters\n    ----------\n    data_class : classobj, 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\"``). If None\n        search for both.  Default is None.\n\n        .. versionadded:: 1.3\n\n    Returns\n    -------\n    format_table : Table\n        Table of available I/O formats.\n    \"\"\"\n    from ..table import Table\n\n    format_classes = sorted(set(_readers) | set(_writers), key=itemgetter(0))\n    rows = []\n\n    for format_class in format_classes:\n        if (data_class is not None and not _is_best_match(\n                data_class, format_class[1], format_classes)):\n            continue\n\n        has_read = 'Yes' if format_class in _readers else 'No'\n        has_write = 'Yes' if format_class in _writers else 'No'\n        has_identify = 'Yes' if format_class in _identifiers else 'No'\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.' + format_class[0], format_class[1])\n\n        deprecated = 'Yes' if ascii_format_class in format_classes else ''\n\n        rows.append((format_class[1].__name__, format_class[0], has_read,\n                     has_write, has_identify, deprecated))\n\n    if readwrite is not None:\n        if readwrite == 'Read':\n            rows = [row for row in rows if row[2] == 'Yes']\n        elif readwrite == 'Write':\n            rows = [row for row in rows if row[3] == 'Yes']\n        else:\n            raise ValueError('unrecognized value for \"readwrite\": {0}.\\n'\n                             'Allowed are \"Read\" and \"Write\" and None.')\n\n    # Sorting the list of tuples is much faster than sorting it after the table\n    # is created. (#5262)\n    if rows:\n        # Indices represent \"Data Class\", \"Deprecated\" and \"Format\".\n        data = list(zip(*sorted(rows, key=itemgetter(0, 5, 1))))\n    else:\n        data = None\n    format_table = Table(data, names=('Data class', 'Format', 'Read', 'Write',\n                                      'Auto-identify', 'Deprecated'))\n\n    if not np.any(format_table['Deprecated'] == 'Yes'):\n        format_table.remove_column('Deprecated')\n\n    return format_table"},{"col":0,"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      - class1 is class2 => class1 was directly registered.\n      - OR class1 is a subclass of class2 and class1 is not in classes.\n        In this case the subclass will use the parent reader/writer.\n    ","endLoc":580,"header":"def _is_best_match(class1, class2, format_classes)","id":440,"name":"_is_best_match","nodeType":"Function","startLoc":567,"text":"def _is_best_match(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      - class1 is class2 => class1 was directly registered.\n      - OR class1 is a subclass of class2 and class1 is not in classes.\n        In this case the subclass will use the parent reader/writer.\n    \"\"\"\n    # The set with the classes is only created if class1 is not class2 and\n    # class1 is a subclass of class2.\n    return (class1 is class2 or\n            (issubclass(class1, class2) and\n             class1 not in {cls for fmt, cls in format_classes}))"},{"col":4,"comment":"null","endLoc":172,"header":"def __init__(self, path=None, delete=False)","id":441,"name":"__init__","nodeType":"Function","startLoc":166,"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"},{"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":136,"header":"def reload(self, attr=None)","id":442,"name":"reload","nodeType":"Function","startLoc":119,"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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\n                item.reload()"},{"col":4,"comment":"null","endLoc":545,"header":"def _do_upgrade(self, dist)","id":443,"name":"_do_upgrade","nodeType":"Function","startLoc":532,"text":"def _do_upgrade(self, dist):\n        # Build up a requirement for a higher bugfix release but a lower minor\n        # release (so API compatibility is guaranteed)\n        next_version = _next_version(dist.parsed_version)\n\n        req = pkg_resources.Requirement.parse(\n            '{0}>{1},<{2}'.format(DIST_NAME, dist.version, next_version))\n\n        package_index = PackageIndex(index_url=self.index_url)\n\n        upgrade = package_index.obtain(req)\n\n        if upgrade is not None:\n            return self._do_download(version=upgrade.version)"},{"col":0,"comment":"\n    Given a parsed version from pkg_resources.parse_version, returns a new\n    version string with the next minor version.\n\n    Examples\n    ========\n    >>> _next_version(pkg_resources.parse_version('1.2.3'))\n    '1.3.0'\n    ","endLoc":833,"header":"def _next_version(version)","id":444,"name":"_next_version","nodeType":"Function","startLoc":802,"text":"def _next_version(version):\n    \"\"\"\n    Given a parsed version from pkg_resources.parse_version, returns a new\n    version string with the next minor version.\n\n    Examples\n    ========\n    >>> _next_version(pkg_resources.parse_version('1.2.3'))\n    '1.3.0'\n    \"\"\"\n\n    if hasattr(version, 'base_version'):\n        # New version parsing from setuptools >= 8.0\n        if version.base_version:\n            parts = version.base_version.split('.')\n        else:\n            parts = []\n    else:\n        parts = []\n        for part in version:\n            if part.startswith('*'):\n                break\n            parts.append(part)\n\n    parts = [int(p) for p in parts]\n\n    if len(parts) < 3:\n        parts += [0] * (3 - len(parts))\n\n    major, minor, micro = parts[:3]\n\n    return '{0}.{1}.{2}'.format(major, minor + 1, 0)"},{"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":274,"header":"@classmethod\n    def make_test_runner_in(cls, path)","id":445,"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__',), exclude_args=('self',))\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        return test"},{"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":157,"header":"def reset(self, attr=None)","id":446,"name":"reset","nodeType":"Function","startLoc":138,"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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\n                item.set(item.defaultvalue)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":51,"id":447,"name":"log_level","nodeType":"Attribute","startLoc":51,"text":"log_level"},{"col":0,"comment":"\n    An alternative to `functools.wraps` which also preserves the original\n    function's call signature by way of\n    `~astropy.utils.codegen.make_function_with_signature`.\n\n    This also adds an optional ``exclude_args`` argument.  If given it should\n    be a sequence of argument names that should not be copied from the wrapped\n    function (either positional or keyword arguments).\n\n    The documentation for the original `functools.wraps` follows:\n\n    ","endLoc":829,"header":"def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n          updated=functools.WRAPPER_UPDATES, exclude_args=())","id":448,"name":"wraps","nodeType":"Function","startLoc":801,"text":"def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n          updated=functools.WRAPPER_UPDATES, exclude_args=()):\n    \"\"\"\n    An alternative to `functools.wraps` which also preserves the original\n    function's call signature by way of\n    `~astropy.utils.codegen.make_function_with_signature`.\n\n    This also adds an optional ``exclude_args`` argument.  If given it should\n    be a sequence of argument names that should not be copied from the wrapped\n    function (either positional or keyword arguments).\n\n    The documentation for the original `functools.wraps` follows:\n\n    \"\"\"\n\n    wrapped_args = _get_function_args(wrapped, exclude_args=exclude_args)\n\n    def wrapper(func):\n        if '__name__' in assigned:\n            name = wrapped.__name__\n        else:\n            name = func.__name__\n\n        func = make_function_with_signature(func, name=name, **wrapped_args)\n        func = functools.update_wrapper(func, wrapped, assigned=assigned,\n                                        updated=updated)\n        return func\n\n    return wrapper"},{"col":0,"comment":"null","endLoc":876,"header":"def _get_function_args(func, exclude_args=())","id":449,"name":"_get_function_args","nodeType":"Function","startLoc":862,"text":"def _get_function_args(func, exclude_args=()):\n    all_args = _get_function_args_internal(func)\n\n    if exclude_args:\n        exclude_args = set(exclude_args)\n\n        for arg_type in ('args', 'kwargs'):\n            all_args[arg_type] = [arg for arg in all_args[arg_type]\n                                  if arg not in exclude_args]\n\n        for arg_type in ('varargs', 'varkwargs'):\n            if all_args[arg_type] in exclude_args:\n                all_args[arg_type] = None\n\n    return all_args"},{"col":0,"comment":"\n    Utility function for `wraps`.\n\n    Reads the argspec for the given function and converts it to arguments\n    for `make_function_with_signature`.\n    ","endLoc":859,"header":"def _get_function_args_internal(func)","id":450,"name":"_get_function_args_internal","nodeType":"Function","startLoc":837,"text":"def _get_function_args_internal(func):\n    \"\"\"\n    Utility function for `wraps`.\n\n    Reads the argspec for the given function and converts it to arguments\n    for `make_function_with_signature`.\n    \"\"\"\n\n    argspec = inspect.getfullargspec(func)\n\n    if argspec.defaults:\n        args = argspec.args[:-len(argspec.defaults)]\n        kwargs = zip(argspec.args[len(args):], argspec.defaults)\n    else:\n        args = argspec.args\n        kwargs = []\n\n    if argspec.kwonlyargs:\n        kwargs.extend((argname, argspec.kwonlydefaults[argname])\n                      for argname in argspec.kwonlyargs)\n\n    return {'args': args, 'kwargs': kwargs, 'varargs': argspec.varargs,\n            'varkwargs': argspec.varkw}"},{"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":451,"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('invalid argument name: {0}'.format(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('invalid argument name: {0}'.format(item))\n\n    def_signature = [', '.join(pos_args)]\n\n    if varargs:\n        def_signature.append(', *{0}'.format(varargs))\n\n    call_signature = def_signature[:]\n\n    if name is None:\n        name = func.__name__\n\n    global_vars = {'__{0}__func'.format(name): 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 = '_kwargs{0}'.format(idx)\n        local_vars[default_var] = value\n        def_signature.append(', {0}={1}'.format(key, default_var))\n        call_signature.append(', {0}={0}'.format(key))\n\n    if varkwargs:\n        def_signature.append(', **{0}'.format(varkwargs))\n        call_signature.append(', **{0}'.format(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":4,"comment":"null","endLoc":530,"header":"def _do_download(self, version='', find_links=None)","id":452,"name":"_do_download","nodeType":"Function","startLoc":477,"text":"def _do_download(self, version='', find_links=None):\n        if find_links:\n            allow_hosts = ''\n            index_url = None\n        else:\n            allow_hosts = None\n            index_url = self.index_url\n\n        # Annoyingly, setuptools will not handle other arguments to\n        # Distribution (such as options) before handling setup_requires, so it\n        # is not straightforward to programmatically augment the arguments which\n        # are passed to easy_install\n        class _Distribution(Distribution):\n            def get_option_dict(self, command_name):\n                opts = Distribution.get_option_dict(self, command_name)\n                if command_name == 'easy_install':\n                    if find_links is not None:\n                        opts['find_links'] = ('setup script', find_links)\n                    if index_url is not None:\n                        opts['index_url'] = ('setup script', index_url)\n                    if allow_hosts is not None:\n                        opts['allow_hosts'] = ('setup script', allow_hosts)\n                return opts\n\n        if version:\n            req = '{0}=={1}'.format(DIST_NAME, version)\n        else:\n            req = DIST_NAME\n\n        attrs = {'setup_requires': [req]}\n\n        try:\n            if DEBUG:\n                _Distribution(attrs=attrs)\n            else:\n                with _silence():\n                    _Distribution(attrs=attrs)\n\n            # If the setup_requires succeeded it will have added the new dist to\n            # the main working_set\n            return pkg_resources.working_set.by_key.get(DIST_NAME)\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            msg = 'Error retrieving {0} from {1}:\\n{2}'\n            if find_links:\n                source = find_links[0]\n            elif index_url != INDEX_URL:\n                source = index_url\n            else:\n                source = 'PyPI'\n\n            raise Exception(msg.format(DIST_NAME, source, repr(e)))"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":57,"id":453,"name":"log_warnings","nodeType":"Attribute","startLoc":57,"text":"log_warnings"},{"col":4,"comment":"null","endLoc":412,"header":"def __init__(self, data=None, masked=None, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 **kwargs)","id":454,"name":"__init__","nodeType":"Function","startLoc":279,"text":"def __init__(self, data=None, masked=None, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.meta = meta\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        # 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        is_list_of_dict = False\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if all(isinstance(row, dict) for row in rows):\n                is_list_of_dict = True  # Avoid doing the all(...) test twice.\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                rec_data = recarray_fromrecords(rows)\n                data = [rec_data[name] for name in rec_data.dtype.names]\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        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 (though the meta\n            # will be deep-copied anyway).\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) and\n                data.shape == (0,) and\n                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            init_func = self._init_from_list\n            if data and (is_list_of_dict or all(isinstance(row, dict) for row in data)):\n                n_cols = len(data[0])\n            else:\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            init_func = self._init_from_table\n            n_cols = len(data.colnames)\n            default_names = data.colnames\n            # don't copy indices if the input Table is in non-copy mode\n            self._init_indices = self._init_indices and data._copy_indices\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    return  # Empty table\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('Data type {0} not allowed to init Table'\n                             .format(type(data)))\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 names is None:\n            names = default_names or [None] * n_cols\n        if dtype is None:\n            dtype = [None] * n_cols\n\n        # Numpy does not support bytes column names on Python 3, so fix them\n        # up now.\n        names = [fix_column_name(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        # Whatever happens above, the masked property should be set to a boolean\n        if type(self.masked) is not bool:\n            raise TypeError(\"masked property has not been set to True or False\")"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":60,"id":455,"name":"log_exceptions","nodeType":"Attribute","startLoc":60,"text":"log_exceptions"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":64,"id":456,"name":"log_to_file","nodeType":"Attribute","startLoc":64,"text":"log_to_file"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":68,"id":457,"name":"log_file_path","nodeType":"Attribute","startLoc":68,"text":"log_file_path"},{"attributeType":"null","col":4,"comment":"null","endLoc":172,"id":458,"name":"RUN_TESTS_DOCSTRING","nodeType":"Attribute","startLoc":172,"text":"RUN_TESTS_DOCSTRING"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":459,"name":"functions","nodeType":"Attribute","startLoc":113,"text":"functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":460,"name":"keywords","nodeType":"Attribute","startLoc":120,"text":"cls.keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":461,"name":"doc_keywords","nodeType":"Attribute","startLoc":121,"text":"doc_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":462,"name":"__doc__","nodeType":"Attribute","startLoc":145,"text":"cls.run_tests.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":463,"name":"base_path","nodeType":"Attribute","startLoc":96,"text":"self.base_path"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":73,"id":464,"name":"log_file_level","nodeType":"Attribute","startLoc":73,"text":"log_file_level"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":465,"name":"sorted_keywords","nodeType":"Attribute","startLoc":118,"text":"sorted_keywords"},{"col":4,"comment":"null","endLoc":292,"header":"@keyword(priority=1000)\n    def coverage(self, coverage, kwargs)","id":466,"name":"coverage","nodeType":"Function","startLoc":283,"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":"\n        Handle importing from a source archive; this also uses setup_requires\n        but points easy_install directly to the source archive.\n        ","endLoc":418,"header":"def get_local_file_dist(self)","id":467,"name":"get_local_file_dist","nodeType":"Function","startLoc":388,"text":"def get_local_file_dist(self):\n        \"\"\"\n        Handle importing from a source archive; this also uses setup_requires\n        but points easy_install directly to the source archive.\n        \"\"\"\n\n        if not os.path.isfile(self.path):\n            return\n\n        log.info('Attempting to unpack and import astropy_helpers from '\n                 '{0!r}'.format(self.path))\n\n        try:\n            dist = self._do_download(find_links=[self.path])\n        except Exception as e:\n            if DEBUG:\n                raise\n\n            log.warn(\n                'Failed to import {0} from the specified archive {1!r}: '\n                '{2}'.format(PACKAGE_NAME, self.path, str(e)))\n            dist = None\n\n        if dist is not None and self.auto_upgrade:\n            # A version of astropy-helpers was found on the available path, but\n            # check to see if a bugfix release is available on PyPI\n            upgrade = self._do_upgrade(dist)\n            if upgrade is not None:\n                dist = upgrade\n\n        return dist"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":77,"id":468,"name":"log_file_format","nodeType":"Attribute","startLoc":77,"text":"log_file_format"},{"col":4,"comment":"null","endLoc":50,"header":"def __init__(self, default_value=None, priority=0)","id":469,"name":"__init__","nodeType":"Function","startLoc":48,"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 'utils'.\n            If nothing is specified all default Astropy tests are run.\n        ","endLoc":315,"header":"@keyword(priority=1)\n    def package(self, package, kwargs)","id":470,"name":"package","nodeType":"Function","startLoc":296,"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 'utils'.\n            If nothing is specified all default Astropy tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = self.base_path\n        else:\n            self.package_path = os.path.join(self.base_path,\n                                        package.replace('.', os.path.sep))\n\n            if not os.path.isdir(self.package_path):\n                raise ValueError('Package not found: {0}'.format(package))\n\n        if not kwargs['test_path']:\n            return [self.package_path]\n\n        return []"},{"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":513,"id":471,"nodeType":"Class","startLoc":139,"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 = '{0}: {1}'.format(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 = '{0}: {1}'.format(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\n        fh = logging.FileHandler(filename)\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.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                fh = logging.FileHandler(log_file_path)\n            except OSError as e:\n                warnings.warn(\n                    'log file {0!r} could not be opened for writing: '\n                    '{1}'.format(log_file_path, str(e)), 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":"null","endLoc":162,"header":"def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info,\n                   func=None, extra=None, sinfo=None)","id":472,"name":"makeRecord","nodeType":"Function","startLoc":150,"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":4,"comment":"null","endLoc":441,"header":"def get_index_dist(self)","id":473,"name":"get_index_dist","nodeType":"Function","startLoc":420,"text":"def get_index_dist(self):\n        if not self.download:\n            log.warn('Downloading {0!r} disabled.'.format(DIST_NAME))\n            return None\n\n        log.warn(\n            \"Downloading {0!r}; run setup.py with the --offline option to \"\n            \"force offline installation.\".format(DIST_NAME))\n\n        try:\n            dist = self._do_download()\n        except Exception as e:\n            if DEBUG:\n                raise\n            log.warn(\n                'Failed to download and/or install {0!r} from {1!r}:\\n'\n                '{2}'.format(DIST_NAME, self.index_url, str(e)))\n            dist = None\n\n        # No need to run auto-upgrade here since we've already presumably\n        # gotten the most up-to-date version from the package index\n        return dist"},{"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":355,"header":"@keyword()\n    def test_path(self, test_path, kwargs)","id":474,"name":"test_path","nodeType":"Function","startLoc":317,"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            if not (os.path.isdir(test_path) or ext in ('.py', '.rst')):\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 []"},{"col":4,"comment":"null","endLoc":202,"header":"def _showwarning(self, *args, **kwargs)","id":475,"name":"_showwarning","nodeType":"Function","startLoc":166,"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 = '{0}: {1}'.format(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":"\n        args : str, optional\n            Additional arguments to be passed to ``pytest.main`` in the ``args``\n            keyword argument.\n        ","endLoc":367,"header":"@keyword()\n    def args(self, args, kwargs)","id":476,"name":"args","nodeType":"Function","startLoc":357,"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":"\n        plugins : list, optional\n            Plugins to be passed to ``pytest.main`` in the ``plugins`` keyword\n            argument.\n        ","endLoc":376,"header":"@keyword()\n    def plugins(self, plugins, kwargs)","id":477,"name":"plugins","nodeType":"Function","startLoc":369,"text":"@keyword()\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        return []"},{"col":4,"comment":"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from py.test. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        ","endLoc":388,"header":"@keyword()\n    def verbose(self, verbose, kwargs)","id":478,"name":"verbose","nodeType":"Function","startLoc":378,"text":"@keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from py.test. Passing\n            True is the same as specifying ``-v`` in ``args``.\n        \"\"\"\n        if verbose:\n            return ['-v']\n\n        return []"},{"attributeType":"null","col":8,"comment":"null","endLoc":184,"id":479,"name":"path","nodeType":"Attribute","startLoc":184,"text":"self.path"},{"attributeType":"null","col":8,"comment":"null","endLoc":187,"id":480,"name":"index_url","nodeType":"Attribute","startLoc":187,"text":"self.index_url"},{"col":4,"comment":"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on py.test pastebin output. Set to\n            'failed' to upload info for failed tests, or 'all' to upload info\n            for all tests.\n        ","endLoc":404,"header":"@keyword()\n    def pastebin(self, pastebin, kwargs)","id":481,"name":"pastebin","nodeType":"Function","startLoc":390,"text":"@keyword()\n    def pastebin(self, pastebin, kwargs):\n        \"\"\"\n        pastebin : ('failed', 'all', None), optional\n            Convenience option for turning on py.test 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 ['--pastebin={0}'.format(pastebin)]\n            else:\n                raise ValueError(\"pastebin should be 'failed' or 'all'\")\n\n        return []"},{"attributeType":"null","col":8,"comment":"null","endLoc":188,"id":482,"name":"offline","nodeType":"Attribute","startLoc":188,"text":"self.offline"},{"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":429,"header":"@keyword(default_value='none')\n    def remote_data(self, remote_data, kwargs)","id":483,"name":"remote_data","nodeType":"Function","startLoc":406,"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 {0}). 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 ['--remote-data={0}'.format(remote_data)]"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":484,"name":"download","nodeType":"Attribute","startLoc":195,"text":"self.download"},{"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":447,"header":"@keyword()\n    def pep8(self, pep8, kwargs)","id":485,"name":"pep8","nodeType":"Function","startLoc":431,"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                                  'http://pypi.python.org/pypi/pytest-pep8')\n            else:\n                return ['--pep8', '-k', 'pep8']\n\n        return []"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":486,"name":"use_git","nodeType":"Attribute","startLoc":207,"text":"self.use_git"},{"col":4,"comment":"null","endLoc":205,"header":"def warnings_logging_enabled(self)","id":487,"name":"warnings_logging_enabled","nodeType":"Function","startLoc":204,"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":220,"header":"def enable_warnings_logging(self)","id":488,"name":"enable_warnings_logging","nodeType":"Function","startLoc":207,"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        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":238,"header":"def disable_warnings_logging(self)","id":489,"name":"disable_warnings_logging","nodeType":"Function","startLoc":222,"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":"\n        For all cards with index above idx, increment or decrement its index\n        value in the keyword_indices dict.\n        ","endLoc":1752,"header":"def _updateindices(self, idx, increment=True)","id":490,"name":"_updateindices","nodeType":"Function","startLoc":1737,"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"},{"col":4,"comment":"null","endLoc":1813,"header":"def __call__(self, s, represents=None, format=None, namespace=None,\n                 doc=None, parse_strict='raise')","id":491,"name":"__call__","nodeType":"Function","startLoc":1732,"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                # cannot use _error_check=False: scale may be effectively unity\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers)\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\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 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 = (\"'{0}' did not parse as {1}unit: {2}\"\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, [], [])\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(\"{0} can not be converted to a Unit\".format(s))"},{"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":577,"header":"@classmethod\n    def normalize_keyword(cls, keyword)","id":492,"name":"normalize_keyword","nodeType":"Function","startLoc":545,"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()"},{"col":4,"comment":"null","endLoc":262,"header":"def _excepthook(self, etype, value, traceback)","id":493,"name":"_excepthook","nodeType":"Function","startLoc":242,"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 = '{0}: {1}'.format(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":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":458,"header":"@keyword()\n    def pdb(self, pdb, kwargs)","id":494,"name":"pdb","nodeType":"Function","startLoc":449,"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 []"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":495,"name":"is_submodule","nodeType":"Attribute","startLoc":211,"text":"self.is_submodule"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":496,"name":"auto_upgrade","nodeType":"Attribute","startLoc":198,"text":"self.auto_upgrade"},{"className":"_CommandNotFound","col":0,"comment":"\n    An exception raised when a command run with run_cmd is not found on the\n    system.\n    ","endLoc":752,"id":497,"nodeType":"Class","startLoc":748,"text":"class _CommandNotFound(OSError):\n    \"\"\"\n    An exception raised when a command run with run_cmd is not found on the\n    system.\n    \"\"\""},{"className":"_DummyFile","col":0,"comment":"A noop writeable object.","endLoc":846,"id":498,"nodeType":"Class","startLoc":836,"text":"class _DummyFile(object):\n    \"\"\"A noop writeable object.\"\"\"\n\n    errors = ''  # Required for Python 3.x\n    encoding = 'utf-8'\n\n    def write(self, s):\n        pass\n\n    def flush(self):\n        pass"},{"col":4,"comment":"null","endLoc":843,"header":"def write(self, s)","id":499,"name":"write","nodeType":"Function","startLoc":842,"text":"def write(self, s):\n        pass"},{"col":4,"comment":"null","endLoc":846,"header":"def flush(self)","id":500,"name":"flush","nodeType":"Function","startLoc":845,"text":"def flush(self):\n        pass"},{"attributeType":"null","col":4,"comment":"null","endLoc":839,"id":501,"name":"errors","nodeType":"Attribute","startLoc":839,"text":"errors"},{"attributeType":"null","col":4,"comment":"null","endLoc":840,"id":502,"name":"encoding","nodeType":"Attribute","startLoc":840,"text":"encoding"},{"className":"_AHBootstrapSystemExit","col":0,"comment":"null","endLoc":889,"id":503,"nodeType":"Class","startLoc":880,"text":"class _AHBootstrapSystemExit(SystemExit):\n    def __init__(self, *args):\n        if not args:\n            msg = 'An unknown problem occurred bootstrapping astropy_helpers.'\n        else:\n            msg = args[0]\n\n        msg += '\\n' + _err_help_msg\n\n        super(_AHBootstrapSystemExit, self).__init__(msg, *args[1:])"},{"col":0,"comment":"\n    Ensure that the `astropy_helpers` module is available and is importable.\n    This supports automatic submodule initialization if astropy_helpers is\n    included in a project as a git submodule, or will download it from PyPI if\n    necessary.\n\n    Parameters\n    ----------\n\n    path : str or None, optional\n        A filesystem path relative to the root of the project's source code\n        that should be added to `sys.path` so that `astropy_helpers` can be\n        imported from that path.\n\n        If the path is a git submodule it will automatically be initialized\n        and/or updated.\n\n        The path may also be to a ``.tar.gz`` archive of the astropy_helpers\n        source distribution.  In this case the archive is automatically\n        unpacked and made temporarily available on `sys.path` as a ``.egg``\n        archive.\n\n        If `None` skip straight to downloading.\n\n    download_if_needed : bool, optional\n        If the provided filesystem path is not found an attempt will be made to\n        download astropy_helpers from PyPI.  It will then be made temporarily\n        available on `sys.path` as a ``.egg`` archive (using the\n        ``setup_requires`` feature of setuptools.  If the ``--offline`` option\n        is given at the command line the value of this argument is overridden\n        to `False`.\n\n    index_url : str, optional\n        If provided, use a different URL for the Python package index than the\n        main PyPI server.\n\n    use_git : bool, optional\n        If `False` no git commands will be used--this effectively disables\n        support for git submodules. If the ``--no-git`` option is given at the\n        command line the value of this argument is overridden to `False`.\n\n    auto_upgrade : bool, optional\n        By default, when installing a package from a non-development source\n        distribution ah_boostrap will try to automatically check for patch\n        releases to astropy-helpers on PyPI and use the patched version over\n        any bundled versions.  Setting this to `False` will disable that\n        functionality. If the ``--offline`` option is given at the command line\n        the value of this argument is overridden to `False`.\n\n    offline : bool, optional\n        If `False` disable all actions that require an internet connection,\n        including downloading packages from the package index and fetching\n        updates to any git submodule.  Defaults to `True`.\n    ","endLoc":958,"header":"def use_astropy_helpers(**kwargs)","id":504,"name":"use_astropy_helpers","nodeType":"Function","startLoc":895,"text":"def use_astropy_helpers(**kwargs):\n    \"\"\"\n    Ensure that the `astropy_helpers` module is available and is importable.\n    This supports automatic submodule initialization if astropy_helpers is\n    included in a project as a git submodule, or will download it from PyPI if\n    necessary.\n\n    Parameters\n    ----------\n\n    path : str or None, optional\n        A filesystem path relative to the root of the project's source code\n        that should be added to `sys.path` so that `astropy_helpers` can be\n        imported from that path.\n\n        If the path is a git submodule it will automatically be initialized\n        and/or updated.\n\n        The path may also be to a ``.tar.gz`` archive of the astropy_helpers\n        source distribution.  In this case the archive is automatically\n        unpacked and made temporarily available on `sys.path` as a ``.egg``\n        archive.\n\n        If `None` skip straight to downloading.\n\n    download_if_needed : bool, optional\n        If the provided filesystem path is not found an attempt will be made to\n        download astropy_helpers from PyPI.  It will then be made temporarily\n        available on `sys.path` as a ``.egg`` archive (using the\n        ``setup_requires`` feature of setuptools.  If the ``--offline`` option\n        is given at the command line the value of this argument is overridden\n        to `False`.\n\n    index_url : str, optional\n        If provided, use a different URL for the Python package index than the\n        main PyPI server.\n\n    use_git : bool, optional\n        If `False` no git commands will be used--this effectively disables\n        support for git submodules. If the ``--no-git`` option is given at the\n        command line the value of this argument is overridden to `False`.\n\n    auto_upgrade : bool, optional\n        By default, when installing a package from a non-development source\n        distribution ah_boostrap will try to automatically check for patch\n        releases to astropy-helpers on PyPI and use the patched version over\n        any bundled versions.  Setting this to `False` will disable that\n        functionality. If the ``--offline`` option is given at the command line\n        the value of this argument is overridden to `False`.\n\n    offline : bool, optional\n        If `False` disable all actions that require an internet connection,\n        including downloading packages from the package index and fetching\n        updates to any git submodule.  Defaults to `True`.\n    \"\"\"\n\n    global BOOTSTRAPPER\n\n    config = BOOTSTRAPPER.config\n    config.update(**kwargs)\n\n    # Create a new bootstrapper with the updated configuration and run it\n    BOOTSTRAPPER = _Bootstrapper(**config)\n    BOOTSTRAPPER.run()"},{"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":485,"header":"@keyword()\n    def open_files(self, open_files, kwargs)","id":505,"name":"open_files","nodeType":"Function","startLoc":460,"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, optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is negative, it will use the all\n            the cores on the machine.  Requires the ``pytest-xdist`` plugin.\n        ","endLoc":504,"header":"@keyword(0)\n    def parallel(self, parallel, kwargs)","id":506,"name":"parallel","nodeType":"Function","startLoc":487,"text":"@keyword(0)\n    def parallel(self, parallel, kwargs):\n        \"\"\"\n        parallel : int, optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is negative, 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        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":281,"header":"def exception_logging_enabled(self)","id":507,"name":"exception_logging_enabled","nodeType":"Function","startLoc":264,"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":322,"header":"def enable_exception_logging(self)","id":508,"name":"enable_exception_logging","nodeType":"Function","startLoc":283,"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        docs_path : str, optional\n            The path to the documentation .rst files.\n        ","endLoc":524,"header":"@keyword()\n    def docs_path(self, docs_path, kwargs)","id":509,"name":"docs_path","nodeType":"Function","startLoc":506,"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        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                docs_path = os.path.join(\n                    docs_path, kwargs['package'].replace('.', os.path.sep))\n            if not os.path.exists(docs_path):\n                warnings.warn(\n                    \"Can not test .rst docs, since docs path \"\n                    \"({0}) does not exist.\".format(docs_path))\n                docs_path = None\n        if docs_path and not kwargs['skip_docs'] and not kwargs['test_path']:\n            return [docs_path, '--doctest-rst']\n\n        return []"},{"col":4,"comment":"\n        skip_docs : `bool`, optional\n            When `True`, skips running the doctests in the .rst files.\n        ","endLoc":533,"header":"@keyword()\n    def skip_docs(self, skip_docs, kwargs)","id":510,"name":"skip_docs","nodeType":"Function","startLoc":526,"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":36,"endLoc":322,"id":511,"nodeType":"Lambda","startLoc":322,"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":351,"header":"def disable_exception_logging(self)","id":512,"name":"disable_exception_logging","nodeType":"Function","startLoc":324,"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)"},{"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":545,"header":"@keyword()\n    def repeat(self, repeat, kwargs)","id":513,"name":"repeat","nodeType":"Function","startLoc":535,"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 ['--repeat={0}'.format(repeat)]\n\n        return []"},{"col":4,"comment":"null","endLoc":555,"header":"def run_tests(self, **kwargs)","id":514,"name":"run_tests","nodeType":"Function","startLoc":548,"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 ..table import Table  # pylint: disable=W0611\n\n        return super(TestRunner, self).run_tests(**kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":304,"id":515,"name":"package_path","nodeType":"Attribute","startLoc":304,"text":"self.package_path"},{"col":0,"comment":"Initializes the Astropy log--in most circumstances this is called\n    automatically when importing astropy.\n    ","endLoc":101,"header":"def _init_log()","id":516,"name":"_init_log","nodeType":"Function","startLoc":86,"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":"\n        Enable colorized output\n        ","endLoc":357,"header":"def enable_color(self)","id":517,"name":"enable_color","nodeType":"Function","startLoc":353,"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":363,"header":"def disable_color(self)","id":518,"name":"disable_color","nodeType":"Function","startLoc":359,"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":412,"header":"@contextmanager\n    def log_to_file(self, filename, filter_level=None, filter_origin=None)","id":519,"name":"log_to_file","nodeType":"Function","startLoc":365,"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\n        fh = logging.FileHandler(filename)\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)"},{"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":133,"header":"def _teardown_log()","id":520,"name":"_teardown_log","nodeType":"Function","startLoc":104,"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":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":280,"header":"def find_api_page(obj, version=None, openinbrowser=True, timeout=None)","id":521,"name":"find_api_page","nodeType":"Function","startLoc":161,"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\n    from zlib import decompress\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 .. 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 = 'http://docs.astropy.org/en/{vers}/'.format(vers=version)\n\n    if timeout is None:\n        uf = urllib.request.urlopen(baseurl + 'objects.inv')\n    else:\n        uf = urllib.request.urlopen(baseurl + 'objects.inv', timeout=timeout)\n\n    try:\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 {0} 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    finally:\n        uf.close()\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('Could not find the docs for the object {obj}'.format(obj=obj))\n    elif openinbrowser:\n        webbrowser.open(resurl)\n\n    return resurl"},{"col":4,"comment":"null","endLoc":554,"header":"def __init__(self, origin)","id":522,"name":"__init__","nodeType":"Function","startLoc":553,"text":"def __init__(self, origin):\n        self.origin = origin"},{"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":1424,"header":"def _set_masked(self, masked)","id":523,"name":"_set_masked","nodeType":"Function","startLoc":1395,"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 hasattr(self, '_masked'):\n            # The only allowed change is from None to False or True, or False to True\n            if self._masked is None and masked in [False, True]:\n                self._masked = masked\n            elif self._masked is False and masked is True:\n                log.info(\"Upgrading Table to masked Table. Use Table.filled() to convert to unmasked table.\")\n                self._masked = masked\n            elif self._masked is masked:\n                raise Exception(\"Masked attribute is already set to {0}\".format(masked))\n            else:\n                raise Exception(\"Cannot change masked attribute to {0} once it is set to {1}\"\n                                .format(masked, self._masked))\n        else:\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        if self._masked:\n            self._column_class = self.MaskedColumn\n        else:\n            self._column_class = self.Column"},{"attributeType":"null","col":21,"comment":"null","endLoc":41,"id":524,"name":"sp","nodeType":"Attribute","startLoc":41,"text":"sp"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":525,"name":"_str_types","nodeType":"Attribute","startLoc":51,"text":"_str_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":526,"name":"_text_type","nodeType":"Attribute","startLoc":52,"text":"_text_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":53,"id":527,"name":"PY3","nodeType":"Attribute","startLoc":53,"text":"PY3"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":528,"name":"_str_types","nodeType":"Attribute","startLoc":55,"text":"_str_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":529,"name":"_text_type","nodeType":"Attribute","startLoc":56,"text":"_text_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":530,"name":"PY3","nodeType":"Attribute","startLoc":57,"text":"PY3"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":531,"name":"_setuptools_req","nodeType":"Attribute","startLoc":72,"text":"_setuptools_req"},{"attributeType":"null","col":4,"comment":"null","endLoc":75,"id":532,"name":"_setuptools","nodeType":"Attribute","startLoc":75,"text":"_setuptools"},{"attributeType":"null","col":8,"comment":"null","endLoc":79,"id":533,"name":"_distribute","nodeType":"Attribute","startLoc":79,"text":"_distribute"},{"attributeType":"null","col":0,"comment":"null","endLoc":147,"id":534,"name":"DIST_NAME","nodeType":"Attribute","startLoc":147,"text":"DIST_NAME"},{"attributeType":"null","col":0,"comment":"null","endLoc":148,"id":535,"name":"PACKAGE_NAME","nodeType":"Attribute","startLoc":148,"text":"PACKAGE_NAME"},{"attributeType":"null","col":0,"comment":"null","endLoc":151,"id":536,"name":"DOWNLOAD_IF_NEEDED","nodeType":"Attribute","startLoc":151,"text":"DOWNLOAD_IF_NEEDED"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":537,"name":"INDEX_URL","nodeType":"Attribute","startLoc":152,"text":"INDEX_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":153,"id":538,"name":"USE_GIT","nodeType":"Attribute","startLoc":153,"text":"USE_GIT"},{"attributeType":"null","col":0,"comment":"null","endLoc":154,"id":539,"name":"OFFLINE","nodeType":"Attribute","startLoc":154,"text":"OFFLINE"},{"attributeType":"null","col":0,"comment":"null","endLoc":155,"id":540,"name":"AUTO_UPGRADE","nodeType":"Attribute","startLoc":155,"text":"AUTO_UPGRADE"},{"attributeType":"null","col":0,"comment":"null","endLoc":158,"id":541,"name":"CFG_OPTIONS","nodeType":"Attribute","startLoc":158,"text":"CFG_OPTIONS"},{"attributeType":"null","col":0,"comment":"null","endLoc":872,"id":542,"name":"_err_help_msg","nodeType":"Attribute","startLoc":872,"text":"_err_help_msg"},{"attributeType":"_Bootstrapper","col":0,"comment":"null","endLoc":892,"id":543,"name":"BOOTSTRAPPER","nodeType":"Attribute","startLoc":892,"text":"BOOTSTRAPPER"},{"col":0,"comment":"","endLoc":32,"header":"ah_bootstrap.py#<anonymous>","id":544,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nThis bootstrap module contains code for ensuring that the astropy_helpers\npackage will be importable by the time the setup.py script runs.  It also\nincludes some workarounds to ensure that a recent-enough version of setuptools\nis being used for the installation.\n\nThis module should be the first thing imported in the setup.py of distributions\nthat make use of the utilities in astropy_helpers.  If the distribution ships\nwith its own copy of astropy_helpers, this module will first attempt to import\nfrom the shipped copy.  However, it will also check PyPI to see if there are\nany bug-fix releases on top of the current version that may be useful to get\npast platform-specific bugs that have been fixed.  When running setup.py, use\nthe ``--offline`` command-line option to disable the auto-upgrade checks.\n\nWhen this module is imported or otherwise executed it automatically calls a\nmain function that attempts to read the project's setup.cfg file, which it\nchecks for a configuration section called ``[ah_bootstrap]`` the presences of\nthat section, and options therein, determine the next step taken:  If it\ncontains an option called ``auto_use`` with a value of ``True``, it will\nautomatically call the main function of this module called\n`use_astropy_helpers` (see that function's docstring for full details).\nOtherwise no further action is taken (however,\n``ah_bootstrap.use_astropy_helpers`` may be called manually from within the\nsetup.py script).\n\nAdditional options in the ``[ah_boostrap]`` section of setup.cfg have the same\nnames as the arguments to `use_astropy_helpers`, and can be used to configure\nthe bootstrap script when ``auto_use = True``.\n\nSee https://github.com/astropy/astropy-helpers for more details, and for the\nlatest version of this module.\n\"\"\"\n\ntry:\n    from ConfigParser import ConfigParser, RawConfigParser\nexcept ImportError:\n    from configparser import ConfigParser, RawConfigParser\n\nif sys.version_info[0] < 3:\n    _str_types = (str, unicode)\n    _text_type = unicode\n    PY3 = False\nelse:\n    _str_types = (str, bytes)\n    _text_type = str\n    PY3 = True\n\ntry:\n    import pkg_resources\n    _setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7')\n    # This may raise a DistributionNotFound in which case no version of\n    # setuptools or distribute is properly installed\n    _setuptools = pkg_resources.get_distribution('setuptools')\n    if _setuptools not in _setuptools_req:\n        # Older version of setuptools; check if we have distribute; again if\n        # this results in DistributionNotFound we want to give up\n        _distribute = pkg_resources.get_distribution('distribute')\n        if _setuptools != _distribute:\n            # It's possible on some pathological systems to have an old version\n            # of setuptools and distribute on sys.path simultaneously; make\n            # sure distribute is the one that's used\n            sys.path.insert(1, _distribute.location)\n            _distribute.activate()\n            imp.reload(pkg_resources)\nexcept:\n    # There are several types of exceptions that can occur here; if all else\n    # fails bootstrap and use the bootstrapped version\n    from ez_setup import use_setuptools\n    use_setuptools()\n\ntry:\n    import typing   # noqa\nexcept ImportError:\n    pass\n\ntry:\n    import setuptools.py31compat   # noqa\nexcept ImportError:\n    pass\n\ntry:\n    import matplotlib\n    matplotlib.use('Agg')\n    import matplotlib.pyplot\nexcept:\n    # Ignore if this fails for *any* reason*\n    pass\n\nDIST_NAME = 'astropy-helpers'\n\nPACKAGE_NAME = 'astropy_helpers'\n\nDOWNLOAD_IF_NEEDED = True\n\nINDEX_URL = 'https://pypi.python.org/simple'\n\nUSE_GIT = True\n\nOFFLINE = False\n\nAUTO_UPGRADE = True\n\nCFG_OPTIONS = [\n    ('auto_use', bool), ('path', str), ('download_if_needed', bool),\n    ('index_url', str), ('use_git', bool), ('offline', bool),\n    ('auto_upgrade', bool)\n]\n\n_err_help_msg = \"\"\"\nIf the problem persists consider installing astropy_helpers manually using pip\n(`pip install astropy_helpers`) or by manually downloading the source archive,\nextracting it, and installing by running `python setup.py install` from the\nroot of the extracted source code.\n\"\"\"\n\nBOOTSTRAPPER = _Bootstrapper.main()"},{"fileName":"__init__.py","filePath":"astropy/io","id":545,"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":546,"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":547,"name":"astropy/io/fits","nodeType":"Package"},{"fileName":"_numpy_hacks.py","filePath":"astropy/io/fits","id":548,"nodeType":"File","text":"\"\"\"\nThis module is for functions that do tricky things with Numpy arrays and dtypes\nthat are not normally supported in Numpy (but can work in limited cases\nrelevant to FITS) or that otherwise require workarounds.\n\"\"\"\n\n\ndef realign_dtype(dtype, offsets):\n    \"\"\"\n    Given a Numpy struct dtype object an a list of integer offsets, with one\n    offset per field in the dtype, returns a new dtype where each field has the\n    given offset.\n\n    All offsets must be non-negative integers, but otherwise have no\n    restrictions, and may overlap, per the usual rules for creating struct\n    dtypes.  The new dtype will have an itemsize equal to the offset of the\n    right-most field plus the width of that field.\n\n    One restriction of this function is that it must not be used with object\n    arrays--incorrect offsets may lead to invalid pointers in the arrays.\n    However, this function is really only meant for use by astropy.io.fits and\n    object arrays are not supported for FITS data anyhow.\n\n    This function is used primarily to get around a shortcoming in Numpy that\n    it is currently impossible to create dtypes with arbitrary offsets, *and*\n    that have zero-width fields.  Both of these features are needed for full\n    FITS support.  However, this will be fixed in a future version of Numpy at\n    which point use of this hack can be deprecated.  See\n    https://github.com/numpy/numpy/pull/6430\n    \"\"\"\n\n    # Previously this was implemented in C, but then I realized that the C\n    # version is not needed--the workaround is to use dtype.__setstate__\n    # Note: There is a comment in the Numpy source code (see\n    # https://github.com/numpy/numpy/blob/v1.10.1/numpy/core/src/multiarray/descriptor.c#L2226)\n    # that this may be changed at some point.  But hopefully by then the fixes\n    # in #6430 will be implemented, making this hack unnecessary to begin with.\n\n    cls, args, state = dtype.__reduce__()\n\n    names, fields = state[3:5]\n    fields = fields.copy()\n\n    itemsize = 0  # We will re-determine the itemsize based on the type\n                  # of the field with the largest (offset + itemsize)\n\n    if fields is None or len(offsets) != len(names):\n        raise ValueError(\n            \"Dtype must be a structured dtype, and length of offsets list \"\n            \"must be the same as the number of fields.\")\n\n    for name, offset in zip(names, offsets):\n        field = fields[name]\n        itemsize = max(itemsize, offset + field[0].itemsize)\n\n        if offset != field[1]:\n            fields[name] = (field[0], offset)\n\n    new_typespec = '|V{0}'.format(itemsize)\n\n    new_state = state[:4] + (fields, itemsize) + state[6:]\n\n    new_dtype = cls(new_typespec, *args[1:])\n    new_dtype.__setstate__(new_state)\n\n    return new_dtype\n"},{"col":0,"comment":"\n    Given a Numpy struct dtype object an a list of integer offsets, with one\n    offset per field in the dtype, returns a new dtype where each field has the\n    given offset.\n\n    All offsets must be non-negative integers, but otherwise have no\n    restrictions, and may overlap, per the usual rules for creating struct\n    dtypes.  The new dtype will have an itemsize equal to the offset of the\n    right-most field plus the width of that field.\n\n    One restriction of this function is that it must not be used with object\n    arrays--incorrect offsets may lead to invalid pointers in the arrays.\n    However, this function is really only meant for use by astropy.io.fits and\n    object arrays are not supported for FITS data anyhow.\n\n    This function is used primarily to get around a shortcoming in Numpy that\n    it is currently impossible to create dtypes with arbitrary offsets, *and*\n    that have zero-width fields.  Both of these features are needed for full\n    FITS support.  However, this will be fixed in a future version of Numpy at\n    which point use of this hack can be deprecated.  See\n    https://github.com/numpy/numpy/pull/6430\n    ","endLoc":66,"header":"def realign_dtype(dtype, offsets)","id":549,"name":"realign_dtype","nodeType":"Function","startLoc":8,"text":"def realign_dtype(dtype, offsets):\n    \"\"\"\n    Given a Numpy struct dtype object an a list of integer offsets, with one\n    offset per field in the dtype, returns a new dtype where each field has the\n    given offset.\n\n    All offsets must be non-negative integers, but otherwise have no\n    restrictions, and may overlap, per the usual rules for creating struct\n    dtypes.  The new dtype will have an itemsize equal to the offset of the\n    right-most field plus the width of that field.\n\n    One restriction of this function is that it must not be used with object\n    arrays--incorrect offsets may lead to invalid pointers in the arrays.\n    However, this function is really only meant for use by astropy.io.fits and\n    object arrays are not supported for FITS data anyhow.\n\n    This function is used primarily to get around a shortcoming in Numpy that\n    it is currently impossible to create dtypes with arbitrary offsets, *and*\n    that have zero-width fields.  Both of these features are needed for full\n    FITS support.  However, this will be fixed in a future version of Numpy at\n    which point use of this hack can be deprecated.  See\n    https://github.com/numpy/numpy/pull/6430\n    \"\"\"\n\n    # Previously this was implemented in C, but then I realized that the C\n    # version is not needed--the workaround is to use dtype.__setstate__\n    # Note: There is a comment in the Numpy source code (see\n    # https://github.com/numpy/numpy/blob/v1.10.1/numpy/core/src/multiarray/descriptor.c#L2226)\n    # that this may be changed at some point.  But hopefully by then the fixes\n    # in #6430 will be implemented, making this hack unnecessary to begin with.\n\n    cls, args, state = dtype.__reduce__()\n\n    names, fields = state[3:5]\n    fields = fields.copy()\n\n    itemsize = 0  # We will re-determine the itemsize based on the type\n                  # of the field with the largest (offset + itemsize)\n\n    if fields is None or len(offsets) != len(names):\n        raise ValueError(\n            \"Dtype must be a structured dtype, and length of offsets list \"\n            \"must be the same as the number of fields.\")\n\n    for name, offset in zip(names, offsets):\n        field = fields[name]\n        itemsize = max(itemsize, offset + field[0].itemsize)\n\n        if offset != field[1]:\n            fields[name] = (field[0], offset)\n\n    new_typespec = '|V{0}'.format(itemsize)\n\n    new_state = state[:4] + (fields, itemsize) + state[6:]\n\n    new_dtype = cls(new_typespec, *args[1:])\n    new_dtype.__setstate__(new_state)\n\n    return new_dtype"},{"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":455,"header":"@contextmanager\n    def log_to_list(self, filter_level=None, filter_origin=None)","id":550,"name":"log_to_list","nodeType":"Function","startLoc":414,"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    Partial replacement for `~numpy.core.records.fromrecords` which includes\n    a workaround for the bug with unicode arrays described at:\n    https://github.com/astropy/astropy/issues/3052\n\n    This should not serve as a full replacement for the original function;\n    this only does enough to fulfill the needs of the table module.\n    ","endLoc":195,"header":"def recarray_fromrecords(rec_list)","id":551,"name":"recarray_fromrecords","nodeType":"Function","startLoc":175,"text":"def recarray_fromrecords(rec_list):\n    \"\"\"\n    Partial replacement for `~numpy.core.records.fromrecords` which includes\n    a workaround for the bug with unicode arrays described at:\n    https://github.com/astropy/astropy/issues/3052\n\n    This should not serve as a full replacement for the original function;\n    this only does enough to fulfill the needs of the table module.\n    \"\"\"\n\n    # Note: This is just copying what Numpy does for converting arbitrary rows\n    # to column arrays in the recarray module; it could be there is a better\n    # way\n    nfields = len(rec_list[0])\n    obj = np.array(rec_list, dtype=object)\n    array_list = [np.array(obj[..., i].tolist()) for i in range(nfields)]\n    formats = []\n    for obj in array_list:\n        formats.append(obj.dtype.str)\n    formats = ','.join(formats)\n    return np.rec.fromarrays(array_list, formats=formats)"},{"col":4,"comment":"Returns the number of blank cards at the end of the Header.","endLoc":1760,"header":"def _countblanks(self)","id":552,"name":"_countblanks","nodeType":"Function","startLoc":1754,"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"},{"col":0,"comment":"","endLoc":5,"header":"_numpy_hacks.py#<anonymous>","id":553,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nThis module is for functions that do tricky things with Numpy arrays and dtypes\nthat are not normally supported in Numpy (but can work in limited cases\nrelevant to FITS) or that otherwise require workarounds.\n\"\"\""},{"fileName":"fitsrec.py","filePath":"astropy/io/fits","id":554,"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 ...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\n        row : int, optional\n           The starting logical row of the array.\n\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\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(\"Key '{}' does not exist.\".format(key))\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(\"Key '{}' does not exist.\".format(key))\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 '({})'.format(', '.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        # Make sure the data is a listener for changes to the columns\n        columns._add_listener(data)\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 __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._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 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        \"\"\"\n        A user-visible accessor for the coldefs.\n\n        See https://aeon.stsci.edu/ssb/trac/pyfits/ticket/44\n        \"\"\"\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 = '_update_column_{0}'.format(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 = 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 conerted 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{0:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\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 = ('|{}{}'.format(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 '{0}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {1!r} of the column, and the index {2} 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.replace(encode_ascii('E'), encode_ascii('D'))\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(('S{0}'.format(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":565,"header":"def __init__(self, filter_level=None, filter_origin=None)","id":555,"name":"__init__","nodeType":"Function","startLoc":563,"text":"def __init__(self, filter_level=None, filter_origin=None):\n        logging.Handler.__init__(self)\n        self.log_list = []"},{"col":4,"comment":"null","endLoc":1767,"header":"def _useblanks(self, count)","id":556,"name":"_useblanks","nodeType":"Function","startLoc":1762,"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"},{"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\n           String containing the entire 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        Returns\n        -------\n        header\n            A new `Header` instance.\n        ","endLoc":387,"header":"@classmethod\n    def fromstring(cls, data, sep='')","id":557,"name":"fromstring","nodeType":"Function","startLoc":319,"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\n           String containing the entire 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        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        # 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(''.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(''.join(image)))\n\n        return cls(cards)"},{"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":543,"header":"@classmethod\n    def fromstring(cls, image)","id":558,"name":"fromstring","nodeType":"Function","startLoc":531,"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        card._image = _pad(image)\n        card._verified = False\n        return card"},{"className":"UnsupportedPythonError","col":0,"comment":"null","endLoc":19,"id":559,"nodeType":"Class","startLoc":18,"text":"class UnsupportedPythonError(Exception):\n    pass"},{"col":4,"comment":"\n        Reset logger to its initial state\n        ","endLoc":513,"header":"def _set_defaults(self)","id":560,"name":"_set_defaults","nodeType":"Function","startLoc":457,"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.log\")\n                else:\n                    log_file_path = os.path.expanduser(log_file_path)\n\n                fh = logging.FileHandler(log_file_path)\n            except OSError as e:\n                warnings.warn(\n                    'log file {0!r} could not be opened for writing: '\n                    '{1}'.format(log_file_path, str(e)), 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()"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy`.\n    ","endLoc":149,"id":561,"nodeType":"Class","startLoc":122,"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":"null","endLoc":170,"header":"def is_effectively_unity(value)","id":562,"name":"is_effectively_unity","nodeType":"Function","startLoc":163,"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)"},{"col":0,"comment":"\n    Fixes column names so that they are compatible with Numpy on\n    Python 2.  Raises a ValueError exception if the column name\n    contains Unicode characters, which can not reasonably be used as a\n    column name.\n    ","endLoc":172,"header":"def fix_column_name(val)","id":563,"name":"fix_column_name","nodeType":"Function","startLoc":159,"text":"def fix_column_name(val):\n    \"\"\"\n    Fixes column names so that they are compatible with Numpy on\n    Python 2.  Raises a ValueError exception if the column name\n    contains Unicode characters, which can not reasonably be used as a\n    column name.\n    \"\"\"\n    if val is not None:\n        try:\n            val = str(val)\n        except UnicodeEncodeError:\n            raise\n\n    return val"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":127,"id":564,"name":"unicode_output","nodeType":"Attribute","startLoc":127,"text":"unicode_output"},{"col":0,"comment":"Pad blank space to the input string to be multiple of 80.","endLoc":1268,"header":"def _pad(input)","id":565,"name":"_pad","nodeType":"Function","startLoc":1252,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":129,"id":566,"name":"ASCIITNULL","nodeType":"Attribute","startLoc":129,"text":"ASCIITNULL"},{"col":4,"comment":"Make sure that names and dtype are both iterable and have\n        the same length as data.\n        ","endLoc":618,"header":"def _check_names_dtype(self, names, dtype, n_cols)","id":567,"name":"_check_names_dtype","nodeType":"Function","startLoc":607,"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('{0} must be a list or None'.format(inp_str))\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                .format(inp_str))"},{"col":0,"comment":"Returns `True` if the given object is iterable.","endLoc":46,"header":"def isiterable(obj)","id":568,"name":"isiterable","nodeType":"Function","startLoc":39,"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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":131,"id":569,"name":"use_color","nodeType":"Attribute","startLoc":131,"text":"use_color"},{"col":4,"comment":"\n        Remove SIP information from a header.\n        ","endLoc":1000,"header":"def _remove_sip_kw(self, header)","id":570,"name":"_remove_sip_kw","nodeType":"Function","startLoc":992,"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 (m.group() for m in map(SIP_KW.match, list(header))\n                    if m is not None):\n            del header[key]"},{"col":4,"comment":"Initialize table from a list of columns.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        ","endLoc":689,"header":"def _init_from_list(self, data, names, dtype, n_cols, copy)","id":571,"name":"_init_from_list","nodeType":"Function","startLoc":648,"text":"def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of columns.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        if data and all(isinstance(row, dict) for row in data):\n            self._init_from_list_of_dicts(data, names, dtype, n_cols, copy)\n            return\n\n        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(data)\n\n        cols = []\n        def_names = _auto_names(n_cols)\n\n        for col, name, def_name, dtype in zip(data, names, def_names, dtype):\n            # Structured ndarray gets viewed as a mixin unless already a valid\n            # mixin class\n            if (isinstance(col, np.ndarray) and len(col.dtype) > 1 and\n                    not self._add_as_mixin_column(col)):\n                col = col.view(NdarrayMixin)\n\n            if isinstance(col, (Column, MaskedColumn)):\n                col = self.ColumnClass(name=(name or col.info.name or def_name),\n                                       data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            elif self._add_as_mixin_column(col):\n                # Copy the mixin column attributes if they exist since the copy below\n                # may not get this attribute.\n                if copy:\n                    col = col_copy(col, copy_indices=self._init_indices)\n\n                col.info.name = name or col.info.name or def_name\n            elif isinstance(col, np.ndarray) or isiterable(col):\n                col = self.ColumnClass(name=(name or def_name), data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            else:\n                raise ValueError('Elements in list initialization must be '\n                                 'either Column or list-like')\n\n            cols.append(col)\n\n        self._init_from_cols(cols)"},{"col":4,"comment":"null","endLoc":646,"header":"def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy)","id":572,"name":"_init_from_list_of_dicts","nodeType":"Function","startLoc":630,"text":"def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        cols = {}\n        for name in names_from_data:\n            cols[name] = []\n            for i, row in enumerate(data):\n                try:\n                    cols[name].append(row[name])\n                except KeyError:\n                    raise ValueError('Row {0} has no value for column {1}'.format(i, name))\n        if all(name is None for name in names):\n            names = sorted(names_from_data)\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n        return"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":135,"id":573,"name":"max_lines","nodeType":"Attribute","startLoc":135,"text":"max_lines"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":142,"id":574,"name":"max_width","nodeType":"Attribute","startLoc":142,"text":"max_width"},{"col":4,"comment":"null","endLoc":1990,"header":"def __init__(self, scale, bases, powers, decompose=False,\n                 decompose_bases=set(), _error_check=True)","id":575,"name":"__init__","nodeType":"Function","startLoc":1969,"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            scale = sanitize_scale(scale)\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        self._scale = scale\n        self._bases = bases\n        self._powers = powers\n        self._decomposed_cache = None\n        self._expand_and_gather(decompose=decompose, bases=decompose_bases)\n        self._hash = None"},{"col":4,"comment":"\n        Create a `distortion paper`_ type lookup table for detector to\n        image plane correction.\n        ","endLoc":789,"header":"def _read_det2im_kw(self, header, fobj, err=0.0)","id":576,"name":"_read_det2im_kw","nodeType":"Function","startLoc":725,"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[str('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), ('An astropy.io.fits.HDUList'\n                                'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + str('.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 + str('.AXIS.{0:d}').format(i)\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('D2IMARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('D2IMARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('D2IMARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0), d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0), d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0), d_header.get(str('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 list(header):\n                    if key.startswith(dp + str('.')):\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))"},{"col":0,"comment":"\n    Returns whether the source for this module is directly in an astropy\n    source distribution or checkout.\n    ","endLoc":40,"header":"def _is_astropy_source(path=None)","id":577,"name":"_is_astropy_source","nodeType":"Function","startLoc":25,"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":0,"comment":"\n    Determines the Astropy 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    Returns\n    -------\n    configdir : str\n        The absolute path to the configuration directory.\n\n    ","endLoc":117,"header":"def get_config_dir(create=True)","id":578,"name":"get_config_dir","nodeType":"Function","startLoc":79,"text":"def get_config_dir(create=True):\n    \"\"\"\n    Determines the Astropy 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    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, 'astropy')\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, 'astropy')\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_astropy_dir('config', linkto))"},{"col":0,"comment":"\n    Returns whether we are currently being imported in the context of running\n    Astropy's setup.py.\n    ","endLoc":55,"header":"def _is_astropy_setup()","id":579,"name":"_is_astropy_setup","nodeType":"Function","startLoc":43,"text":"def _is_astropy_setup():\n    \"\"\"\n    Returns whether we are currently being imported in the context of running\n    Astropy's setup.py.\n    \"\"\"\n\n    main_mod = sys.modules.get('__main__')\n    if not main_mod:\n        return False\n\n    return (getattr(main_mod, '__file__', False) and\n            os.path.basename(main_mod.__file__).rstrip('co') == 'setup.py' and\n            _is_astropy_source(main_mod.__file__))"},{"col":0,"comment":"null","endLoc":188,"header":"def sanitize_scale(scale)","id":580,"name":"sanitize_scale","nodeType":"Function","startLoc":173,"text":"def sanitize_scale(scale):\n    if is_effectively_unity(scale):\n        return 1.0\n\n    if np.iscomplex(scale):  # scale is complex\n        if scale == 0.0:\n            return 0.0\n\n        if abs(scale.real) > abs(scale.imag):\n            if is_effectively_unity(scale.imag/scale.real + 1):\n                scale = scale.real\n        else:\n            if is_effectively_unity(scale.real/scale.imag + 1):\n                scale = complex(0., scale.imag)\n\n    return scale"},{"col":4,"comment":"Initialize table from a dictionary of columns","endLoc":724,"header":"def _init_from_dict(self, data, names, dtype, n_cols, copy)","id":581,"name":"_init_from_dict","nodeType":"Function","startLoc":716,"text":"def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        # TODO: is this restriction still needed with no ndarray?\n        if not copy:\n            raise ValueError('Cannot use copy=False with a dict data input')\n\n        data_list = [data[name] for name in names]\n        self._init_from_list(data_list, names, dtype, n_cols, copy)"},{"col":0,"comment":"\n    Check that Numpy is installed and it is of the minimum version we\n    require.\n    ","endLoc":112,"header":"def _check_numpy()","id":582,"name":"_check_numpy","nodeType":"Function","startLoc":90,"text":"def _check_numpy():\n    \"\"\"\n    Check that Numpy is installed and it is of the minimum version we\n    require.\n    \"\"\"\n    # Note: We could have used distutils.version for this comparison,\n    # but it seems like overkill to import distutils at runtime.\n    requirement_met = False\n\n    try:\n        import numpy\n    except ImportError:\n        pass\n    else:\n        from .utils import minversion\n        requirement_met = minversion(numpy, __minimum_numpy_version__)\n\n    if not requirement_met:\n        msg = (\"Numpy version {0} or later must be installed to use \"\n               \"Astropy\".format(__minimum_numpy_version__))\n        raise ImportError(msg)\n\n    return numpy"},{"col":0,"comment":"\n    Returns `True` if the specified Python module satisfies a minimum version\n    requirement, and `False` if not.\n\n    By default this uses `pkg_resources.parse_version` to do the version\n    comparison if available.  Otherwise it falls back on\n    `distutils.version.LooseVersion`.\n\n    Parameters\n    ----------\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    version_path : `str`\n        A dotted attribute path to follow in the module for the version.\n        Defaults to just ``'__version__'``, which should work for most Python\n        modules.\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    ","endLoc":161,"header":"def minversion(module, version, inclusive=True, version_path='__version__')","id":583,"name":"minversion","nodeType":"Function","startLoc":90,"text":"def 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    By default this uses `pkg_resources.parse_version` to do the version\n    comparison if available.  Otherwise it falls back on\n    `distutils.version.LooseVersion`.\n\n    Parameters\n    ----------\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    version_path : `str`\n        A dotted attribute path to follow in the module for the version.\n        Defaults to just ``'__version__'``, which should work for most Python\n        modules.\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    \"\"\"\n\n    if isinstance(module, types.ModuleType):\n        module_name = module.__name__\n    elif isinstance(module, str):\n        module_name = module\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                         'got {0!r}'.format(module))\n\n    if '.' not in version_path:\n        have_version = getattr(module, version_path)\n    else:\n        have_version = resolve_name(module.__name__, version_path)\n\n    try:\n        from pkg_resources import parse_version\n    except ImportError:\n        from distutils.version import LooseVersion as parse_version\n        # LooseVersion raises a TypeError when strings like dev, rc1 are part\n        # of the version number. Match the dotted numbers only. Regex taken\n        # from PEP440, https://www.python.org/dev/peps/pep-0440/, Appendix B\n        expr = '^([1-9]\\\\d*!)?(0|[1-9]\\\\d*)(\\\\.(0|[1-9]\\\\d*))*'\n        m = re.match(expr, version)\n        if m:\n            version = m.group(0)\n\n    if inclusive:\n        return parse_version(have_version) >= parse_version(version)\n    else:\n        return parse_version(have_version) > parse_version(version)"},{"col":4,"comment":"null","endLoc":628,"header":"def _set_masked_from_cols(self, cols)","id":584,"name":"_set_masked_from_cols","nodeType":"Function","startLoc":620,"text":"def _set_masked_from_cols(self, cols):\n        if self.masked is None:\n            if any(isinstance(col, (MaskedColumn, ma.MaskedArray)) for col in cols):\n                self._set_masked(True)\n            else:\n                self._set_masked(False)\n        elif not self.masked:\n            if any(np.any(col.mask) for col in cols if isinstance(col, (MaskedColumn, ma.MaskedArray))):\n                self._set_masked(True)"},{"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":87,"header":"def resolve_name(name, *additional_parts)","id":585,"name":"resolve_name","nodeType":"Function","startLoc":18,"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__(str('.'.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"},{"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":242,"header":"def validate_power(p, support_tuples=False)","id":586,"name":"validate_power","nodeType":"Function","startLoc":191,"text":"def validate_power(p, support_tuples=False):\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    if isinstance(p, (numbers.Rational, Fraction)):\n        denom = p.denominator\n        if denom == 1:\n            p = int(p.numerator)\n        # This is bit-twiddling hack to see if the integer is a\n        # power of two\n        elif (denom & (denom - 1)) == 0:\n            p = float(p)\n    else:\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        if (p % 1.0) == 0.0:\n            # Denominators of 1 can just be integers.\n            p = int(p)\n        elif (p * 8.0) % 1.0 == 0.0:\n            # Leave alone if the denominator is exactly 2, 4 or 8, since this\n            # can be perfectly represented as a float, which means subsequent\n            # operations are much faster.\n            pass\n        else:\n            # Convert floats indistinguishable from a rational to Fraction.\n            # Here, we do not need to test values that are divisors of a higher\n            # number, such as 3, since it is already addressed by 6.\n            for i in (10, 9, 7, 6):\n                scaled = p * float(i)\n                if((scaled + 4. * _float_finfo.eps) % 1.0 <\n                   8. * _float_finfo.eps):\n                    p = Fraction(int(round(scaled)), i)\n                    break\n\n    return p"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":587,"name":"FITS2NUMPY","nodeType":"Attribute","startLoc":40,"text":"FITS2NUMPY"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":588,"name":"ASCII2NUMPY","nodeType":"Attribute","startLoc":70,"text":"ASCII2NUMPY"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":589,"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":1794,"id":590,"nodeType":"Class","startLoc":1270,"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`, `ColDefs`, other\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('Element {} in the ColDefs input is not a '\n                                'Column.'.format(idx))\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) > 1 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 = repr(dim).replace(' ', '')\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if 'I' in format and ftype == np.dtype('uint16'):\n                bzero = np.uint16(2**15)\n            elif 'J' in format and ftype == np.dtype('uint32'):\n                bzero = np.uint32(2**31)\n            elif 'K' in format and ftype == np.dtype('uint64'):\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, value in hdr.items():\n            key = TDEF_RE.match(keyword)\n            try:\n                keyword = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if keyword in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[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                    'Invalid keyword for column {}: {}'.format(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(\n                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        fields = []\n        offsets = [0]\n\n        for name, format_, dim in zip(self.names, 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            fields.append((name, dt))\n\n        return nh.realign_dtype(np.dtype(fields), 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        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        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('New name {} already exists.'.format(new_name))\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, 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(\"{}:\\n\".format(attr))\n                output.write('    {}\\n'.format(getattr(self, attr + 's')))\n            else:\n                ret[attr] = getattr(self, attr + 's')\n\n        if not output:\n            return ret"},{"col":4,"comment":"null","endLoc":2070,"header":"def _expand_and_gather(self, decompose=False, bases=set())","id":591,"name":"_expand_and_gather","nodeType":"Function","startLoc":2031,"text":"def _expand_and_gather(self, decompose=False, bases=set()):\n        def add_unit(unit, power, scale):\n            if 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 = [validate_power(x[1]) for x in new_parts]\n        self._scale = sanitize_scale(scale)"},{"col":0,"comment":"\n    If either input is a Fraction, convert the other to a Fraction.\n    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    ","endLoc":257,"header":"def resolve_fractions(a, b)","id":592,"name":"resolve_fractions","nodeType":"Function","startLoc":245,"text":"def resolve_fractions(a, b):\n    \"\"\"\n    If either input is a Fraction, convert the other to a Fraction.\n    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    \"\"\"\n    a_is_fraction = isinstance(a, Fraction)\n    b_is_fraction = isinstance(b, Fraction)\n    if a_is_fraction and not b_is_fraction:\n        b = Fraction(b)\n    elif not a_is_fraction and b_is_fraction:\n        a = Fraction(a)\n    return a, b"},{"col":4,"comment":"null","endLoc":824,"header":"def _read_d2im_old_format(self, header, fobj, axiscorr)","id":593,"name":"_read_d2im_old_format","nodeType":"Function","startLoc":791,"text":"def _read_d2im_old_format(self, header, fobj, axiscorr):\n        warnings.warn(\"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[(str('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[(str('D2IMARR'), 1)].header\n        naxis = d2im_hdr[str('NAXIS')]\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get(str('CRPIX') + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get(str('CRVAL') + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get(str('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)"},{"col":0,"comment":"null","endLoc":215,"header":"def _initialize_astropy()","id":594,"name":"_initialize_astropy","nodeType":"Function","startLoc":161,"text":"def _initialize_astropy():\n    from . import config\n\n    def _rollback_import(message):\n        log.error(message)\n        # Now disable exception logging to avoid an annoying error in the\n        # exception logger before we raise the import error:\n        _teardown_log()\n\n        # Roll back any astropy sub-modules that have been imported thus\n        # far\n\n        for key in list(sys.modules):\n            if key.startswith('astropy.'):\n                del sys.modules[key]\n        raise ImportError('astropy')\n\n    try:\n        from .utils import _compiler\n    except ImportError:\n        if _is_astropy_source():\n            log.warning('You appear to be trying to import astropy from '\n                        'within a source checkout without building the '\n                        'extension modules first.  Attempting to (re)build '\n                        'extension modules:')\n\n            try:\n                _rebuild_extensions()\n            except BaseException as exc:\n                _rollback_import(\n                    'An error occurred while attempting to rebuild the '\n                    'extension modules.  Please try manually running '\n                    '`./setup.py develop` or `./setup.py build_ext '\n                    '--inplace` to see what the issue was.  Extension '\n                    'modules must be successfully compiled and importable '\n                    'in order to import astropy.')\n                # Reraise the Exception only in case it wasn't an Exception,\n                # for example if a \"SystemExit\" or \"KeyboardInterrupt\" was\n                # invoked.\n                if not isinstance(exc, Exception):\n                    raise\n\n        else:\n            # Outright broken installation; don't be nice.\n            raise\n\n    # add these here so we only need to cleanup the namespace at the end\n    config_dir = os.path.dirname(__file__)\n\n    try:\n        config.configuration.update_default_config(__package__, config_dir)\n    except config.configuration.ConfigurationDefaultMissingError as e:\n        wmsg = (e.args[0] + \" Cannot install default profile. If you are \"\n                \"importing from source, this is expected.\")\n        warn(config.configuration.ConfigurationDefaultMissingWarning(wmsg))"},{"attributeType":"None","col":4,"comment":"null","endLoc":164,"id":595,"name":"_showwarning_orig","nodeType":"Attribute","startLoc":164,"text":"_showwarning_orig"},{"attributeType":"None","col":4,"comment":"null","endLoc":240,"id":596,"name":"_excepthook_orig","nodeType":"Attribute","startLoc":240,"text":"_excepthook_orig"},{"attributeType":"function","col":8,"comment":"null","endLoc":219,"id":598,"name":"_showwarning_orig","nodeType":"Attribute","startLoc":219,"text":"self._showwarning_orig"},{"attributeType":"function","col":12,"comment":"null","endLoc":302,"id":599,"name":"_excepthook_orig","nodeType":"Attribute","startLoc":302,"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":547,"id":600,"nodeType":"Class","startLoc":516,"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 = \"{0} [{1:s}]\".format(record.msg, record.origin)\n        print(\": \" + record.message, file=stream)"},{"col":4,"comment":"\n        The formatter for stderr\n        ","endLoc":547,"header":"def emit(self, record)","id":601,"name":"emit","nodeType":"Function","startLoc":523,"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 = \"{0} [{1:s}]\".format(record.msg, record.origin)\n        print(\": \" + record.message, file=stream)"},{"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 : writeable file-like object, 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":380,"header":"def color_print(*args, end='\\n', **kwargs)","id":602,"name":"color_print","nodeType":"Function","startLoc":324,"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 : writeable file-like object, 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":0,"comment":"null","endLoc":56,"header":"def _auto_names(n_cols)","id":603,"name":"_auto_names","nodeType":"Function","startLoc":54,"text":"def _auto_names(n_cols):\n    from . import conf\n    return [str(conf.auto_colname).format(i) for i in range(n_cols)]"},{"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":130,"header":"def _get_stdout(stderr=False)","id":604,"name":"_get_stdout","nodeType":"Function","startLoc":102,"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    if not isatty(sys_stream) or _IPython.OutStream is None:\n        return sys_stream\n\n    # Our system stream is an atty and we're in ipython.\n    ipyio_stream = _IPython.get_stream(stream)\n\n    if ipyio_stream is not None and isatty(ipyio_stream):\n        # Use the IPython console output stream\n        return ipyio_stream\n    else:\n        # sys.stdout was set to some other non-TTY stream (a file perhaps)\n        # so just use it directly\n        return sys_stream"},{"col":27,"endLoc":2066,"id":605,"nodeType":"Lambda","startLoc":2066,"text":"lambda x: (-x[1], getattr(x[0], 'name', ''))"},{"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":171,"header":"def isatty(file)","id":606,"name":"isatty","nodeType":"Function","startLoc":133,"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().getName() != 'MainThread'):\n        return False\n\n    if hasattr(file, 'isatty'):\n        return file.isatty()\n\n    # Use two isinstance calls to only evaluate IOStream when necessary.\n    if (_IPython.OutStream is None or\n        (not isinstance(file, _IPython.OutStream) and\n         not isinstance(file, _IPython.IOStream))):\n        return False\n\n    # File is an IPython OutStream or IOStream.  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        # 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"},{"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":607,"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 = '_update_{0}'.format(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":608,"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        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":609,"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)]"},{"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":610,"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 = '_update_{0}'.format(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":0,"comment":"null","endLoc":258,"header":"def _rebuild_extensions()","id":611,"name":"_rebuild_extensions","nodeType":"Function","startLoc":218,"text":"def _rebuild_extensions():\n    global __version__\n    global __githash__\n\n    import subprocess\n    import time\n\n    from .utils.console import Spinner\n\n    devnull = open(os.devnull, 'w')\n    old_cwd = os.getcwd()\n    os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))\n    try:\n        sp = subprocess.Popen([sys.executable, 'setup.py', 'build_ext',\n                               '--inplace'], stdout=devnull,\n                               stderr=devnull)\n        with Spinner('Rebuilding extension modules') as spinner:\n            while sp.poll() is None:\n                next(spinner)\n                time.sleep(0.05)\n    finally:\n        os.chdir(old_cwd)\n        devnull.close()\n\n    if sp.returncode != 0:\n        raise OSError('Running setup.py build_ext --inplace failed '\n                      'with error code {0}: try rerunning this command '\n                      'manually to check what the error was.'.format(\n                          sp.returncode))\n\n    # Try re-loading module-level globals from the astropy.version module,\n    # which may not have existed before this function ran\n    try:\n        from .version import version as __version__\n    except ImportError:\n        pass\n\n    try:\n        from .version import githash as __githash__\n    except ImportError:\n        pass"},{"col":4,"comment":"null","endLoc":99,"header":"@classmethod\n    def get_stream(cls, stream)","id":612,"name":"get_stream","nodeType":"Function","startLoc":97,"text":"@classmethod\n    def get_stream(cls, stream):\n        return getattr(cls.ipyio, stream)"},{"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":613,"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":614,"name":"_listeners","nodeType":"Attribute","startLoc":78,"text":"_listeners"},{"attributeType":"null","col":12,"comment":"null","endLoc":89,"id":615,"name":"_listeners","nodeType":"Attribute","startLoc":89,"text":"self._listeners"},{"col":4,"comment":"null","endLoc":1296,"header":"def __new__(cls, input, ascii=False)","id":616,"name":"__new__","nodeType":"Function","startLoc":1283,"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":"\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 : writeable file-like object, 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":808,"header":"def __init__(self, msg, color='default', file=None, step=1,\n                 chars=None)","id":617,"name":"__init__","nodeType":"Function","startLoc":766,"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 : writeable file-like object, 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)"},{"col":4,"comment":"null","endLoc":1299,"header":"def __getnewargs__(self)","id":618,"name":"__getnewargs__","nodeType":"Function","startLoc":1298,"text":"def __getnewargs__(self):\n        return (self._arrays,)"},{"col":4,"comment":"\n        Parameters\n        ----------\n\n        input : sequence of `Column`, `ColDefs`, other\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":1340,"header":"def __init__(self, input, ascii=False)","id":619,"name":"__init__","nodeType":"Function","startLoc":1301,"text":"def __init__(self, input, ascii=False):\n        \"\"\"\n        Parameters\n        ----------\n\n        input : sequence of `Column`, `ColDefs`, other\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        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":944,"header":"def _read_distortion_kw(self, header, fobj, dist='CPDIS', err=0.0)","id":620,"name":"_read_distortion_kw","nodeType":"Function","startLoc":872,"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 = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('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 + str('.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 + str('.AXIS.{0:d}'.format(i))\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('WCSDVARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('WCSDVARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('WCSDVARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0),\n                               d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0),\n                               d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0),\n                               d_header.get(str('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 list(header):\n                        if key.startswith(dp + str('.')):\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))"},{"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":259,"header":"def _color_text(text, color)","id":621,"name":"_color_text","nodeType":"Function","startLoc":215,"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 '\\033[{0}m{1}\\033[0m'.format(color_code, text)"},{"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":321,"header":"def _write_with_fallback(s, write, fileobj)","id":622,"name":"_write_with_fallback","nodeType":"Function","startLoc":280,"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    if (_IPython.IOStream is not None and\n        isinstance(fileobj, _IPython.IOStream)):\n        # If the output stream is an IPython.utils.io.IOStream object that's\n        # not going to be very helpful to us since it doesn't raise any\n        # exceptions when an error occurs writing to its underlying stream.\n        # There's no advantage to us using IOStream.write directly though;\n        # instead just write directly to its underlying stream:\n        write = fileobj.stream.write\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"},{"col":4,"comment":"Initialize from an existing ColDefs object (just copy the\n        columns and convert their formats if necessary).\n        ","endLoc":1347,"header":"def _init_from_coldefs(self, coldefs)","id":623,"name":"_init_from_coldefs","nodeType":"Function","startLoc":1342,"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]"},{"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":1492,"header":"def _copy_column(self, column)","id":625,"name":"_copy_column","nodeType":"Function","startLoc":1446,"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(\n                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"},{"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\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":719,"header":"def update_default_config(pkg, default_cfg_dir_or_fn, version=None)","id":626,"name":"update_default_config","nodeType":"Function","startLoc":624,"text":"def update_default_config(pkg, default_cfg_dir_or_fn, version=None):\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\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).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 'dev' not in version and cfgfn is not None:\n        template_path = path.join(\n            get_config_dir(), '{0}.{1}.cfg'.format(pkg, version))\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 {0} {1} 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 '{2}'.\".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":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    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":549,"header":"def get_config(packageormod=None, reload=False)","id":627,"name":"get_config","nodeType":"Function","startLoc":476,"text":"def get_config(packageormod=None, reload=False):\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    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    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    packageormodspl = packageormod.split('.')\n    rootname = packageormodspl[0]\n    secname = '.'.join(packageormodspl[1:])\n\n    cobj = _cfgobjs.get(rootname, None)\n\n    if cobj is None or reload:\n        if _ASTROPY_SETUP_:\n            # There's no reason to use anything but the default config\n            cobj = configobj.ConfigObj(interpolation=False)\n        else:\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 + '.cfg')\n                cobj = configobj.ConfigObj(cfgfn, interpolation=False)\n            except OSError as e:\n                msg = ('Configuration defaults will be used due to ')\n                errstr = '' if len(e.args) < 1 else (':' + str(e.args[0]))\n                msg += e.__class__.__name__ + errstr\n                msg += ' on {0}'.format(cfgfn)\n                warn(ConfigurationMissingWarning(msg))\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                cobj = configobj.ConfigObj(interpolation=False)\n\n        _cfgobjs[rootname] = 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 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":62,"header":"def get_format(format=None)","id":628,"name":"get_format","nodeType":"Function","startLoc":30,"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 isinstance(format, type) and issubclass(format, Base):\n        return format\n    elif not (isinstance(format, str) or format is None):\n        raise TypeError(\n            \"Formatter must a subclass or instance of a subclass of {0!r} \"\n            \"or a string giving the name of the formatter.  Valid formatter \"\n            \"names are: [{1}]\".format(Base, ', '.join(Base.registry)))\n\n    if format is None:\n        format = 'generic'\n\n    format_lower = format.lower()\n\n    if format_lower in Base.registry:\n        return Base.registry[format_lower]\n\n    raise ValueError(\"Unknown format {0!r}.  Valid formatter names are: \"\n                     \"[{1}]\".format(format, ', '.join(Base.registry)))"},{"col":4,"comment":"null","endLoc":1388,"header":"def _init_from_array(self, array)","id":629,"name":"_init_from_array","nodeType":"Function","startLoc":1357,"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) > 1 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 = repr(dim).replace(' ', '')\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if 'I' in format and ftype == np.dtype('uint16'):\n                bzero = np.uint16(2**15)\n            elif 'J' in format and ftype == np.dtype('uint32'):\n                bzero = np.uint32(2**31)\n            elif 'K' in format and ftype == np.dtype('uint64'):\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":"FilterOrigin","col":0,"comment":"A filter for the record origin","endLoc":557,"id":630,"nodeType":"Class","startLoc":550,"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)"},{"col":4,"comment":"null","endLoc":557,"header":"def filter(self, record)","id":631,"name":"filter","nodeType":"Function","startLoc":556,"text":"def filter(self, record):\n        return record.origin.startswith(self.origin)"},{"attributeType":"null","col":8,"comment":"null","endLoc":554,"id":632,"name":"origin","nodeType":"Attribute","startLoc":554,"text":"self.origin"},{"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":1119,"header":"def _read_sip_kw(self, header, wcskey=\"\")","id":633,"name":"_read_sip_kw","nodeType":"Function","startLoc":1002,"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 str(\"A_ORDER\") in header and header[str('A_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"A_{0}_{1}\").format(i, j)\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"B_{0}_{1}\").format(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[str('A_ORDER')]\n            del header[str('B_ORDER')]\n\n            ctype = [header['CTYPE{0}{1}'.format(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                \"\"\"\n                log.info(message)\n        elif str(\"B_ORDER\") in header and header[str('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 str(\"AP_ORDER\") in header and header[str('AP_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"AP_{0}_{1}\").format(i, j)\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"BP_{0}_{1}\").format(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[str('AP_ORDER')]\n            del header[str('BP_ORDER')]\n        elif str(\"BP_ORDER\") in header and header[str('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 str(\"CRPIX1{0}\".format(wcskey)) not in header or str(\"CRPIX2{0}\".format(wcskey)) not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(\"CRPIX1{0}\".format(wcskey))\n        crpix2 = header.get(\"CRPIX2{0}\".format(wcskey))\n\n        return Sip(a, b, ap, bp, (crpix1, crpix2))"},{"className":"ListHandler","col":0,"comment":"A handler that can be used to capture the records in a list","endLoc":568,"id":634,"nodeType":"Class","startLoc":560,"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":568,"header":"def emit(self, record)","id":635,"name":"emit","nodeType":"Function","startLoc":567,"text":"def emit(self, record):\n        self.log_list.append(record)"},{"attributeType":"null","col":8,"comment":"null","endLoc":565,"id":636,"name":"log_list","nodeType":"Attribute","startLoc":565,"text":"self.log_list"},{"attributeType":"null","col":24,"comment":"null","endLoc":11,"id":637,"name":"_config","nodeType":"Attribute","startLoc":11,"text":"_config"},{"attributeType":"null","col":22,"comment":"null","endLoc":12,"id":638,"name":"_conf","nodeType":"Attribute","startLoc":12,"text":"_conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":639,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":640,"name":"logging_levels","nodeType":"Attribute","startLoc":20,"text":"logging_levels"},{"attributeType":"null","col":4,"comment":"null","endLoc":22,"id":641,"name":"level","nodeType":"Attribute","startLoc":22,"text":"level"},{"attributeType":"None","col":0,"comment":"null","endLoc":28,"id":642,"name":"log","nodeType":"Attribute","startLoc":28,"text":"log"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":83,"id":643,"name":"conf","nodeType":"Attribute","startLoc":83,"text":"conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":644,"name":"Logger","nodeType":"Attribute","startLoc":136,"text":"Logger"},{"col":0,"comment":"","endLoc":2,"header":"logger.py#<anonymous>","id":645,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"This module defines a logging class based on the built-in logging module\"\"\"\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()"},{"fileName":"file.py","filePath":"astropy/io/fits","id":646,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\nimport bz2\nimport gzip\nimport http.client\nimport mmap\nimport operator\nimport pathlib\nimport io\nimport os\nimport sys\nimport tempfile\nimport warnings\nimport zipfile\nimport re\n\nfrom functools import reduce\n\nimport numpy as np\nfrom numpy import memmap as Memmap\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 ...utils.data import download_file, _is_url\nfrom ...utils.decorators import classproperty, deprecated_renamed_argument\nfrom ...utils.exceptions import AstropyUserWarning\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': 'c', 'copyonwrite': 'c', 'update': 'r+',\n                'append': 'c', 'denywrite': 'r'}\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\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(\"Mode '{}' not recognized\".format(mode))\n        mode = new_mode\n    return mode\n\nclass _File:\n    \"\"\"\n    Represents a FITS file on disk (or in some other file-like object).\n    \"\"\"\n\n    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        if fileobj is None:\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            self.simulateonly = True\n            self.close_on_error = False\n            return\n        else:\n            self.simulateonly = False\n            # If fileobj is of type pathlib.Path\n            if isinstance(fileobj, pathlib.Path):\n                fileobj = str(fileobj)\n            elif isinstance(fileobj, bytes):\n                # Using bytes as filename is tricky, it's deprecated for Windows\n                # in Python 3.5 (because it could lead to false-positives) but\n                # was fixed and un-deprecated in Python 3.6.\n                # However it requires that the bytes object is encoded with the\n                # file system encoding.\n                # Probably better to error out and ask for a str object instead.\n                # TODO: This could be revised when Python 3.5 support is dropped\n                # See also: https://github.com/astropy/astropy/issues/6789\n                raise TypeError(\"names should be `str` not `bytes`.\")\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(\"Mode '{}' not recognized\".format(mode))\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) 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                    \"Mode {} not supported for HTTPResponse\".format(mode))\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = 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        # More defaults to be adjusted below as necessary\n        self.compression = None\n        self.readonly = False\n        self.writeonly = 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):\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 isinstance(fileobj, bz2.BZ2File):\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 '<{}.{} {}>'.format(self.__module__, self.__class__.__name__,\n                                   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('size {} not a multiple of {}'.format(size, 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                    memmap = Memmap(self._file, mode=MEMMAP_MODES[self.mode],\n                                    dtype=np.uint8)\n\n                    # Now we immediately discard the memmap array; we are\n                    # really just using it as a factory function to instantiate\n                    # the mmap object in a convenient way (may later do away\n                    # with this usage)\n                    self._mmap = memmap.base\n\n                    # Prevent dorking with self._memmap._mmap by memmap.__del__\n                    # in Numpy 1.6 (see\n                    # https://github.com/numpy/numpy/commit/dcc355a0b179387eeba10c95baf2e1eb21d417c7)\n                    memmap._mmap = None\n                    del memmap\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 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 hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)\n\n    def flush(self):\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 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(\"File {!r} already exists.\".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        if ext == '.gz' or magic.startswith(GZIP_MAGIC):\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 ext == '.zip' or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif 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            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if mode == '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        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,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 (isinstance(self._file, bz2.BZ2File) 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 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":647,"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"},{"col":4,"comment":"\n        Determine if ``col`` should be added to the table directly as\n        a mixin column.\n        ","endLoc":903,"header":"def _add_as_mixin_column(self, col)","id":648,"name":"_add_as_mixin_column","nodeType":"Function","startLoc":893,"text":"def _add_as_mixin_column(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 not Quantity (which gets converted to Column with\n        # unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)"},{"col":0,"comment":"null","endLoc":62,"header":"def has_info_class(obj, cls)","id":649,"name":"has_info_class","nodeType":"Function","startLoc":61,"text":"def has_info_class(obj, cls):\n    return hasattr(obj, 'info') and isinstance(obj.info, cls)"},{"col":4,"comment":"null","endLoc":1503,"header":"def __init__(self, st, doc=None, format=None, namespace=None)","id":650,"name":"__init__","nodeType":"Function","startLoc":1467,"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)"},{"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":651,"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    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":107,"header":"def col_copy(col, copy_indices=True)","id":652,"name":"col_copy","nodeType":"Function","startLoc":68,"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    # The new column should have None for the parent_table ref.  If the\n    # original parent_table weakref there at the point of copying then it\n    # generates an infinite recursion.  Instead temporarily remove the weakref\n    # on the original column and restore after the copy in an exception-safe\n    # manner.\n\n    parent_table = col.info.parent_table\n    indices = col.info.indices\n    col.info.parent_table = None\n    col.info.indices = []\n\n    try:\n        newcol = col.copy() if hasattr(col, 'copy') else deepcopy(col)\n        newcol.info = col.info\n        newcol.info.indices = deepcopy(indices or []) if copy_indices else []\n        for index in newcol.info.indices:\n            index.replace_col(col, newcol)\n    finally:\n        col.info.parent_table = parent_table\n        col.info.indices = indices\n\n    return newcol"},{"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":653,"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":"\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":654,"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):\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 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":655,"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, str):\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":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":656,"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                    LooseVersion(platform.mac_ver()[0]) < LooseVersion('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.frombuffer(s, dtype=dtype, count=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        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":1515,"header":"def _generate_doc(self)","id":657,"name":"_generate_doc","nodeType":"Function","startLoc":1505,"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]"},{"col":4,"comment":"Initialize table from a list of Column or mixin objects","endLoc":776,"header":"def _init_from_cols(self, cols)","id":658,"name":"_init_from_cols","nodeType":"Function","startLoc":748,"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('Inconsistent data column lengths: {0}'\n                             .format(lengths))\n\n        # Set the table masking\n        self._set_masked_from_cols(cols)\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"},{"col":0,"comment":"\n    Write a numpy array to a file or a file-like object.\n\n    Parameters\n    ----------\n    arr : `~numpy.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":659,"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 : `~numpy.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):\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":4,"comment":"\n        Injects the unit, and all of its aliases, in the given\n        namespace dictionary.\n        ","endLoc":1590,"header":"def _inject(self, namespace=None)","id":660,"name":"_inject","nodeType":"Function","startLoc":1572,"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 {0!r} already exists in \"\n                    \"given namespace ({1!r}).\".format(\n                        name, namespace[name]))\n\n        for name in self._names:\n            namespace[name] = self"},{"col":16,"endLoc":614,"id":661,"nodeType":"Lambda","startLoc":614,"text":"lambda a, f: a.tofile(f)"},{"col":4,"comment":"\n        Make sure that all Column objects have correct 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":746,"header":"def _convert_col_for_table(self, col)","id":662,"name":"_convert_col_for_table","nodeType":"Function","startLoc":737,"text":"def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct 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 col.__class__ is not self.ColumnClass and isinstance(col, Column):\n            col = self.ColumnClass(col)  # copy attributes and reference data\n        return col"},{"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":663,"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":664,"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"},{"col":4,"comment":"\n        Construct a `Column` by specifying attributes.  All attributes\n        except ``format`` can be optional; see :ref:`column_creation` and\n        :ref:`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":620,"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":665,"name":"__init__","nodeType":"Function","startLoc":467,"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:`column_creation` and\n        :ref:`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"},{"col":4,"comment":"null","endLoc":2696,"header":"def _get_naxis(self, header=None)","id":666,"name":"_get_naxis","nodeType":"Function","startLoc":2683,"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['NAXIS{}'.format(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":0,"comment":"null","endLoc":273,"header":"def encode_ascii(s)","id":667,"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":309,"header":"def decode_ascii(s)","id":668,"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(u'\\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":4,"comment":"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        ","endLoc":817,"header":"@staticmethod\n    def _make_table_from_cols(table, cols)","id":669,"name":"_make_table_from_cols","nodeType":"Function","startLoc":799,"text":"@staticmethod\n    def _make_table_from_cols(table, cols):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        colnames = set(col.info.name for col in cols)\n        if None in colnames:\n            raise TypeError('Cannot have None for column name')\n        if len(colnames) != len(cols):\n            raise ValueError('Duplicate column names')\n\n        columns = table.TableColumns((col.info.name, col) for col in cols)\n\n        for col in cols:\n            col.info.parent_table = table\n            if table.masked and not hasattr(col, 'mask'):\n                col.mask = FalseArray(col.shape)\n\n        table.columns = columns"},{"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[naxis], 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":654,"header":"def fix(self, translate_units='', naxis=None)","id":670,"name":"fix","nodeType":"Function","startLoc":608,"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[naxis], 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                    warnings.warn(\n                        (\"'{0}' made the change '{1}'.\").\n                        format(key, val),\n                        FITSFixedWarning)"},{"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":1122,"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":671,"name":"_verify_keywords","nodeType":"Function","startLoc":897,"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        format, recformat = cls._determine_formats(format, start, dim, ascii)\n        valid.update(format=format, recformat=recformat)\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                    'Column disp option (TDISPn) must be a string (got {!r}).'\n                    'The invalid value will be ignored for the purpose of '\n                    'formatting the data in this column.'.format(disp))\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                valid['disp'] = disp\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"},{"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":1159,"header":"@classmethod\n    def _determine_formats(cls, format, start, dim, ascii)","id":672,"name":"_determine_formats","nodeType":"Function","startLoc":1124,"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":4,"comment":"null","endLoc":128,"header":"def __new__(cls, shape)","id":673,"name":"__new__","nodeType":"Function","startLoc":126,"text":"def __new__(cls, shape):\n        obj = np.zeros(shape, dtype=bool).view(cls)\n        return obj"},{"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":2340,"header":"def _dtype_to_recformat(dtype)","id":674,"name":"_dtype_to_recformat","nodeType":"Function","startLoc":2318,"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"},{"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":842,"header":"def itercols(self)","id":675,"name":"itercols","nodeType":"Function","startLoc":819,"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 an ndarray structured array","endLoc":714,"header":"def _init_from_ndarray(self, data, names, dtype, n_cols, copy)","id":676,"name":"_init_from_ndarray","nodeType":"Function","startLoc":691,"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        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(cols)\n\n        if copy:\n            self._init_from_list(cols, names, dtype, n_cols, copy)\n        else:\n            dtype = [(name, col.dtype, col.shape[1:]) for name, col in zip(names, cols)]\n            newdata = data.view(dtype).ravel()\n            columns = self.TableColumns()\n\n            for name in names:\n                columns[name] = self.ColumnClass(name=name, data=newdata[name])\n                columns[name].info.parent_table = self\n            self.columns = columns"},{"col":4,"comment":"null","endLoc":1202,"header":"@classmethod\n    def _guess_format(cls, format, start, dim)","id":677,"name":"_guess_format","nodeType":"Function","startLoc":1161,"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"},{"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":606,"header":"def _fix_scamp(self)","id":678,"name":"_fix_scamp","nodeType":"Function","startLoc":565,"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)"},{"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/deleteable 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":660,"id":679,"nodeType":"Class","startLoc":496,"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/deleteable 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._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 and objtype in self._cache:\n            return self._cache[objtype]\n\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\n        if self._lazy:\n            self._cache[objtype] = val\n\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":603,"header":"def __new__(cls, fget=None, doc=None, lazy=False)","id":680,"name":"__new__","nodeType":"Function","startLoc":594,"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":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":1228,"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":681,"name":"__init__","nodeType":"Function","startLoc":1173,"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('Unrecognised 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)"},{"col":4,"comment":"null","endLoc":276,"header":"def __new__(cls, format, strict=False)","id":682,"name":"__new__","nodeType":"Function","startLoc":268,"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        # This is to support handling logical (boolean) data from binary tables\n        # in an ASCII table\n        self._pseudo_logical = False\n        return self"},{"col":4,"comment":"Initialize table from an existing Table object ","endLoc":735,"header":"def _init_from_table(self, data, names, dtype, n_cols, copy)","id":683,"name":"_init_from_table","nodeType":"Function","startLoc":726,"text":"def _init_from_table(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an existing Table object \"\"\"\n\n        table = data  # data is really a Table, rename for clarity\n        self.meta.clear()\n        self.meta.update(deepcopy(table.meta))\n        self.primary_key = table.primary_key\n        cols = list(table.columns.values())\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)"},{"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":2181,"header":"def _parse_ascii_tformat(tform, strict=False)","id":684,"name":"_parse_ascii_tformat","nodeType":"Function","startLoc":2115,"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('Format {!r} is not recognized.'.format(tform))\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"},{"col":4,"comment":"null","endLoc":1354,"header":"def wcs_pix2world(self, *args, **kwargs)","id":685,"name":"wcs_pix2world","nodeType":"Function","startLoc":1349,"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)"},{"col":12,"endLoc":1353,"id":686,"nodeType":"Lambda","startLoc":1353,"text":"lambda xy, o: self.wcs.p2s(xy, o)['world']"},{"col":4,"comment":"null","endLoc":619,"header":"def __init__(self, fget, doc=None, lazy=False)","id":687,"name":"__init__","nodeType":"Function","startLoc":605,"text":"def __init__(self, fget, doc=None, lazy=False):\n        self._lazy = lazy\n        if lazy:\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":660,"header":"@staticmethod\n    def _wrap_fget(orig_fget)","id":688,"name":"_wrap_fget","nodeType":"Function","startLoc":648,"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":633,"header":"def __get__(self, obj, objtype)","id":689,"name":"__get__","nodeType":"Function","startLoc":621,"text":"def __get__(self, obj, objtype):\n        if self._lazy and objtype in self._cache:\n            return self._cache[objtype]\n\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\n        if self._lazy:\n            self._cache[objtype] = val\n\n        return val"},{"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":1945,"header":"def remove_column(self, name)","id":690,"name":"remove_column","nodeType":"Function","startLoc":1906,"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":"null","endLoc":636,"header":"def getter(self, fget)","id":691,"name":"getter","nodeType":"Function","startLoc":635,"text":"def getter(self, fget):\n        return super().getter(self._wrap_fget(fget))"},{"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\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":2001,"header":"def remove_columns(self, names)","id":692,"name":"remove_columns","nodeType":"Function","startLoc":1947,"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        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        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        for name in names:\n            self.columns.pop(name)"},{"col":4,"comment":"\n        A helper function to support reading either a pair of arrays\n        or a single Nx2 array.\n        ","endLoc":1276,"header":"def _array_converter(self, func, sky, *args, ra_dec_order=False)","id":693,"name":"_array_converter","nodeType":"Function","startLoc":1208,"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            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, {0})\".format(self.naxis))\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][{0}], origin)\".format(self.naxis))\n            if self.naxis == 1 and 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":"null","endLoc":641,"header":"def setter(self, fset)","id":695,"name":"setter","nodeType":"Function","startLoc":638,"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":646,"header":"def deleter(self, fdel)","id":696,"name":"deleter","nodeType":"Function","startLoc":643,"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":619,"id":697,"name":"__doc__","nodeType":"Attribute","startLoc":619,"text":"self.__doc__"},{"col":4,"comment":"null","endLoc":1177,"header":"def _denormalize_sky(self, sky)","id":698,"name":"_denormalize_sky","nodeType":"Function","startLoc":1149,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":606,"id":699,"name":"_lazy","nodeType":"Attribute","startLoc":606,"text":"self._lazy"},{"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 object, 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":924,"header":"def __init__(self, total, msg, color='default', file=None)","id":700,"name":"__init__","nodeType":"Function","startLoc":888,"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 object, 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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":608,"id":701,"name":"_cache","nodeType":"Attribute","startLoc":608,"text":"self._cache"},{"col":4,"comment":"null","endLoc":1206,"header":"def _normalize_sky(self, sky)","id":702,"name":"_normalize_sky","nodeType":"Function","startLoc":1179,"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":"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":895,"header":"@staticmethod\n    def _convert_format(format, cls)","id":703,"name":"_convert_format","nodeType":"Function","startLoc":868,"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('Illegal format `{}`.'.format(format))\n\n        return format, recformat"},{"className":"_File","col":0,"comment":"\n    Represents a FITS file on disk (or in some other file-like object).\n    ","endLoc":604,"id":704,"nodeType":"Class","startLoc":87,"text":"class _File:\n    \"\"\"\n    Represents a FITS file on disk (or in some other file-like object).\n    \"\"\"\n\n    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        if fileobj is None:\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            self.simulateonly = True\n            self.close_on_error = False\n            return\n        else:\n            self.simulateonly = False\n            # If fileobj is of type pathlib.Path\n            if isinstance(fileobj, pathlib.Path):\n                fileobj = str(fileobj)\n            elif isinstance(fileobj, bytes):\n                # Using bytes as filename is tricky, it's deprecated for Windows\n                # in Python 3.5 (because it could lead to false-positives) but\n                # was fixed and un-deprecated in Python 3.6.\n                # However it requires that the bytes object is encoded with the\n                # file system encoding.\n                # Probably better to error out and ask for a str object instead.\n                # TODO: This could be revised when Python 3.5 support is dropped\n                # See also: https://github.com/astropy/astropy/issues/6789\n                raise TypeError(\"names should be `str` not `bytes`.\")\n\n        # Holds mmap instance for files that use mmap\n        self._mmap = None\n\n        if mode is not None and mode not in IO_FITS_MODES:\n            raise ValueError(\"Mode '{}' not recognized\".format(mode))\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) 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                    \"Mode {} not supported for HTTPResponse\".format(mode))\n            fileobj = io.BytesIO(fileobj.read())\n        else:\n            self.name = fileobj_name(fileobj)\n\n        self.closed = False\n        self.binary = True\n        self.mode = mode\n        self.memmap = memmap\n\n        # Underlying fileobj is a file-like object, but an actual file object\n        self.file_like = 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        # More defaults to be adjusted below as necessary\n        self.compression = None\n        self.readonly = False\n        self.writeonly = 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):\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 isinstance(fileobj, bz2.BZ2File):\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 '<{}.{} {}>'.format(self.__module__, self.__class__.__name__,\n                                   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('size {} not a multiple of {}'.format(size, 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                    memmap = Memmap(self._file, mode=MEMMAP_MODES[self.mode],\n                                    dtype=np.uint8)\n\n                    # Now we immediately discard the memmap array; we are\n                    # really just using it as a factory function to instantiate\n                    # the mmap object in a convenient way (may later do away\n                    # with this usage)\n                    self._mmap = memmap.base\n\n                    # Prevent dorking with self._memmap._mmap by memmap.__del__\n                    # in Numpy 1.6 (see\n                    # https://github.com/numpy/numpy/commit/dcc355a0b179387eeba10c95baf2e1eb21d417c7)\n                    memmap._mmap = None\n                    del memmap\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 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 hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)\n\n    def flush(self):\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 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(\"File {!r} already exists.\".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        if ext == '.gz' or magic.startswith(GZIP_MAGIC):\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 ext == '.zip' or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif 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            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if mode == '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        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,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 (isinstance(self._file, bz2.BZ2File) 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":219,"header":"def __repr__(self)","id":705,"name":"__repr__","nodeType":"Function","startLoc":217,"text":"def __repr__(self):\n        return '<{}.{} {}>'.format(self.__module__, self.__class__.__name__,\n                                   self._file)"},{"col":4,"comment":"null","endLoc":223,"header":"def __enter__(self)","id":706,"name":"__enter__","nodeType":"Function","startLoc":222,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":226,"header":"def __exit__(self, type, value, traceback)","id":707,"name":"__exit__","nodeType":"Function","startLoc":225,"text":"def __exit__(self, type, value, traceback):\n        self.close()"},{"col":0,"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 : classobj\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    ","endLoc":231,"header":"def register_reader(data_format, data_class, function, force=False)","id":708,"name":"register_reader","nodeType":"Function","startLoc":205,"text":"def register_reader(data_format, data_class, function, force=False):\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 : classobj\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    \"\"\"\n\n    if not (data_format, data_class) in _readers or force:\n        _readers[(data_format, data_class)] = function\n    else:\n        raise IORegistryError(\"Reader for format '{0}' and class '{1}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'read')"},{"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 object, 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":557,"header":"def __init__(self, total_or_items, ipython_widget=False, file=None)","id":709,"name":"__init__","nodeType":"Function","startLoc":504,"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 object, 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)"},{"col":4,"comment":"\n        Close the 'physical' FITS file.\n        ","endLoc":380,"header":"def close(self)","id":710,"name":"close","nodeType":"Function","startLoc":366,"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":0,"comment":"\n    Unregister a reader function\n\n    Parameters\n    ----------\n    data_format : str\n        The data format identifier.\n    data_class : classobj\n        The class of the object that the reader produces.\n    ","endLoc":253,"header":"def unregister_reader(data_format, data_class)","id":711,"name":"unregister_reader","nodeType":"Function","startLoc":234,"text":"def unregister_reader(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 : classobj\n        The class of the object that the reader produces.\n    \"\"\"\n\n    if (data_format, data_class) in _readers:\n        _readers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No reader defined for format '{0}' and class '{1}'\"\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'read')"},{"col":0,"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 : classobj\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    ","endLoc":282,"header":"def register_writer(data_format, data_class, function, force=False)","id":714,"name":"register_writer","nodeType":"Function","startLoc":256,"text":"def register_writer(data_format, data_class, function, force=False):\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 : classobj\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    \"\"\"\n\n    if not (data_format, data_class) in _writers or force:\n        _writers[(data_format, data_class)] = function\n    else:\n        raise IORegistryError(\"Writer for format '{0}' and class '{1}' is \"\n                              'already defined'\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'write')"},{"col":4,"comment":"null","endLoc":2161,"header":"def wcs_world2pix(self, *args, **kwargs)","id":715,"name":"wcs_world2pix","nodeType":"Function","startLoc":2156,"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":12,"endLoc":2160,"id":716,"nodeType":"Lambda","startLoc":2160,"text":"lambda xy, o: self.wcs.s2p(xy, o)['pixcrd']"},{"col":0,"comment":"null","endLoc":742,"header":"def _is_int(val)","id":717,"name":"_is_int","nodeType":"Function","startLoc":741,"text":"def _is_int(val):\n    return isinstance(val, all_integer_types)"},{"col":0,"comment":"\n    Unregister a writer function\n\n    Parameters\n    ----------\n    data_format : str\n        The data format identifier.\n    data_class : classobj\n        The class of the object that can be written.\n    ","endLoc":304,"header":"def unregister_writer(data_format, data_class)","id":718,"name":"unregister_writer","nodeType":"Function","startLoc":285,"text":"def unregister_writer(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 : classobj\n        The class of the object that can be written.\n    \"\"\"\n\n    if (data_format, data_class) in _writers:\n        _writers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No writer defined for format '{0}' and class '{1}'\"\n                              ''.format(data_format, data_class.__name__))\n\n    if data_class not in _delayed_docs_classes:\n        _update__doc__(data_class, 'write')"},{"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:`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":2563,"header":"def to_header(self, relax=None, key=None)","id":719,"name":"to_header","nodeType":"Function","startLoc":2428,"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:`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\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\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        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: {0} \"\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        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":394,"header":"def _maybe_close_mmap(self, refcount_delta=0)","id":720,"name":"_maybe_close_mmap","nodeType":"Function","startLoc":382,"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":0,"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 : classobj\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        >>> def my_identifier(*args, **kwargs):\n        ...     return isinstance(args[0], str) and args[0].endswith('.tbl')\n        >>> register_identifier('ipac', Table, my_identifier)\n    ","endLoc":357,"header":"def register_identifier(data_format, data_class, identifier, force=False)","id":721,"name":"register_identifier","nodeType":"Function","startLoc":307,"text":"def register_identifier(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 : classobj\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        >>> def my_identifier(*args, **kwargs):\n        ...     return isinstance(args[0], str) and args[0].endswith('.tbl')\n        >>> register_identifier('ipac', Table, my_identifier)\n    \"\"\"\n\n    if not (data_format, data_class) in _identifiers or force:\n        _identifiers[(data_format, data_class)] = identifier\n    else:\n        raise IORegistryError(\"Identifier for format '{0}' and class '{1}' is \"\n                              'already defined'.format(data_format,\n                                                       data_class.__name__))"},{"col":0,"comment":"\n    Unregister an identifier function\n\n    Parameters\n    ----------\n    data_format : str\n        The data format identifier.\n    data_class : classobj\n        The class of the object that can be read/written.\n    ","endLoc":376,"header":"def unregister_identifier(data_format, data_class)","id":722,"name":"unregister_identifier","nodeType":"Function","startLoc":360,"text":"def unregister_identifier(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 : classobj\n        The class of the object that can be read/written.\n    \"\"\"\n\n    if (data_format, data_class) in _identifiers:\n        _identifiers.pop((data_format, data_class))\n    else:\n        raise IORegistryError(\"No identifier defined for format '{0}' and class\"\n                              \" '{1}'\".format(data_format, data_class.__name__))"},{"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":2195,"header":"def _parse_tdim(tdim)","id":723,"name":"_parse_tdim","nodeType":"Function","startLoc":2184,"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\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":"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, other path object or None\n        The path to the file or None.\n    fileobj : File object 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":414,"header":"def identify_format(origin, data_class_required, path, fileobj, args, kwargs)","id":724,"name":"identify_format","nodeType":"Function","startLoc":379,"text":"def identify_format(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, other path object or None\n        The path to the file or None.\n    fileobj : File object 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 _identifiers:\n        if _is_best_match(data_class_required, data_class, _identifiers):\n            if _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":"null","endLoc":561,"header":"def _handle_resize(self, signum=None, frame=None)","id":725,"name":"_handle_resize","nodeType":"Function","startLoc":559,"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":212,"header":"def terminal_size(file=None)","id":726,"name":"terminal_size","nodeType":"Function","startLoc":174,"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(str(\"HHHH\"), 0, 0, 0, 0)\n        x = fcntl.ioctl(file, termios.TIOCGWINSZ, s)\n        (lines, width, xpixels, ypixels) = struct.unpack(str(\"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":231,"header":"def readable(self)","id":727,"name":"readable","nodeType":"Function","startLoc":228,"text":"def readable(self):\n        if self.writeonly:\n            return False\n        return isreadable(self._file)"},{"col":0,"comment":"null","endLoc":421,"header":"def _get_format_table_str(data_class, readwrite)","id":728,"name":"_get_format_table_str","nodeType":"Function","startLoc":417,"text":"def _get_format_table_str(data_class, readwrite):\n    format_table = get_formats(data_class, readwrite=readwrite)\n    format_table.remove_column('Data class')\n    format_table_str = '\\n'.join(format_table.pformat(max_lines=-1))\n    return format_table_str"},{"col":4,"comment":"null","endLoc":244,"header":"def read(self, size=None)","id":729,"name":"read","nodeType":"Function","startLoc":233,"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":0,"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 : classobj\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":449,"header":"def get_reader(data_format, data_class)","id":730,"name":"get_reader","nodeType":"Function","startLoc":424,"text":"def get_reader(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 : classobj\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 _readers if fmt == data_format]\n    for reader_format, reader_class in readers:\n        if _is_best_match(data_class, reader_class, readers):\n            return _readers[(reader_format, reader_class)]\n    else:\n        format_table_str = _get_format_table_str(data_class, 'Read')\n        raise IORegistryError(\n            \"No reader defined for format '{0}' and class '{1}'.\\nThe \"\n            \"available formats are:\\n{2}\".format(\n                data_format, data_class.__name__, format_table_str))"},{"col":4,"comment":"null","endLoc":678,"header":"def _silent_update(self, value=None)","id":731,"name":"_silent_update","nodeType":"Function","startLoc":677,"text":"def _silent_update(self, value=None):\n        pass"},{"col":0,"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 : classobj\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":477,"header":"def get_writer(data_format, data_class)","id":732,"name":"get_writer","nodeType":"Function","startLoc":452,"text":"def get_writer(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 : classobj\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 _writers if fmt == data_format]\n    for writer_format, writer_class in writers:\n        if _is_best_match(data_class, writer_class, writers):\n            return _writers[(writer_format, writer_class)]\n    else:\n        format_table_str = _get_format_table_str(data_class, 'Write')\n        raise IORegistryError(\n            \"No writer defined for format '{0}' and class '{1}'.\\nThe \"\n            \"available formats are:\\n{2}\".format(\n                data_format, data_class.__name__, format_table_str))"},{"col":0,"comment":"Indent a block of text.  The indentation is applied to each line.","endLoc":57,"header":"def indent(s, shift=1, width=4)","id":733,"name":"indent","nodeType":"Function","startLoc":49,"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":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":321,"header":"def readarray(self, size=None, offset=0, dtype=np.uint8, shape=None)","id":734,"name":"readarray","nodeType":"Function","startLoc":246,"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('size {} not a multiple of {}'.format(size, 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                    memmap = Memmap(self._file, mode=MEMMAP_MODES[self.mode],\n                                    dtype=np.uint8)\n\n                    # Now we immediately discard the memmap array; we are\n                    # really just using it as a factory function to instantiate\n                    # the mmap object in a convenient way (may later do away\n                    # with this usage)\n                    self._mmap = memmap.base\n\n                    # Prevent dorking with self._memmap._mmap by memmap.__del__\n                    # in Numpy 1.6 (see\n                    # https://github.com/numpy/numpy/commit/dcc355a0b179387eeba10c95baf2e1eb21d417c7)\n                    memmap._mmap = None\n                    del memmap\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":"\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":2614,"header":"def _fix_ctype(self, header, add_sip=True, log_message=True)","id":735,"name":"_fix_ctype","nodeType":"Function","startLoc":2565,"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 = 'CTYPE{0}{1}'.format(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"},{"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":508,"header":"def __init__(self, parent, depth, main, indict=None, name=None)","id":736,"name":"__init__","nodeType":"Function","startLoc":485,"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"},{"col":0,"comment":"\n    Uses the lock directory method.  This is good because `mkdir` is\n    atomic at the system call level, so it's thread-safe.\n    ","endLoc":1320,"header":"def _acquire_download_cache_lock()","id":737,"name":"_acquire_download_cache_lock","nodeType":"Function","startLoc":1299,"text":"def _acquire_download_cache_lock():\n    \"\"\"\n    Uses the lock directory method.  This is good because `mkdir` is\n    atomic at the system call level, so it's thread-safe.\n    \"\"\"\n\n    lockdir = os.path.join(_get_download_cache_locs()[0], 'lock')\n    for i in range(conf.download_cache_lock_attempts):\n        try:\n            os.mkdir(lockdir)\n            # write the pid of this process for informational purposes\n            with open(os.path.join(lockdir, 'pid'), 'w') as f:\n                f.write(str(os.getpid()))\n\n        except OSError:\n            time.sleep(1)\n        else:\n            return\n    msg = (\"Unable to acquire lock for cache directory ({0} exists). \"\n           \"You may need to delete the lock if the python interpreter wasn't \"\n           \"shut down properly.\")\n    raise RuntimeError(msg.format(lockdir))"},{"col":0,"comment":"\n    Read in data.\n\n    The arguments passed to this method depend on the format.\n    ","endLoc":536,"header":"def read(cls, *args, format=None, **kwargs)","id":738,"name":"read","nodeType":"Function","startLoc":480,"text":"def read(cls, *args, format=None, **kwargs):\n    \"\"\"\n    Read in data.\n\n    The arguments passed to this method depend on the format.\n    \"\"\"\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):\n                    from ..utils.data import get_readable_fileobj\n                    # path might be a pathlib.Path object\n                    if isinstance(args[0], pathlib.Path):\n                        args = (str(args[0]),) + args[1:]\n                    path = args[0]\n                    try:\n                        ctx = get_readable_fileobj(args[0], encoding='binary')\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 = _get_valid_format(\n                'read', cls, path, fileobj, args, kwargs)\n\n        reader = get_reader(format, cls)\n        data = reader(*args, **kwargs)\n\n        if not isinstance(data, cls):\n            if issubclass(cls, data.__class__):\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 {0} '\n                                    'class.'.format(cls.__name__))\n            else:\n                raise TypeError(\"reader should return a {0} instance\"\n                                \"\".format(cls.__name__))\n    finally:\n        if ctx is not None:\n            ctx.__exit__(*sys.exc_info())\n\n    return data"},{"col":4,"comment":"null","endLoc":525,"header":"def _initialise(self)","id":739,"name":"_initialise","nodeType":"Function","startLoc":511,"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"},{"col":0,"comment":"\n    Given a filename, pathlib.Path object or a readable file-like object, return a context\n    manager that yields a readable file-like object.\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    Parameters\n    ----------\n    name_or_obj : str or file-like object\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, optional\n        Whether to cache the contents of remote URLs.\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`, which is 3s by default)\n\n    Returns\n    -------\n    file : readable file-like object\n    ","endLoc":318,"header":"@contextlib.contextmanager\ndef get_readable_fileobj(name_or_obj, encoding=None, cache=False,\n                         show_progress=True, remote_timeout=None)","id":740,"name":"get_readable_fileobj","nodeType":"Function","startLoc":110,"text":"@contextlib.contextmanager\ndef get_readable_fileobj(name_or_obj, encoding=None, cache=False,\n                         show_progress=True, remote_timeout=None):\n    \"\"\"\n    Given a filename, pathlib.Path object or a readable file-like object, return a context\n    manager that yields a readable file-like object.\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    Parameters\n    ----------\n    name_or_obj : str or file-like object\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, optional\n        Whether to cache the contents of remote URLs.\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`, which is 3s by default)\n\n    Returns\n    -------\n    file : readable file-like object\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    PATH_TYPES = (str, pathlib.Path)\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    # Get a file object to the content\n    if isinstance(name_or_obj, PATH_TYPES):\n        # name_or_obj could be a Path object if pathlib is available\n        name_or_obj = str(name_or_obj)\n\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)\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        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 ValueError(\n                \".bz2 format files are not supported since the Python \"\n                \"interpreter does not include 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 ValueError(\n                \".xz format files are not supported since the Python \"\n                \"interpreter does not include the lzma module.\")\n        except (OSError, EOFError) as e:  # 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 = io.BufferedReader(fileobj)\n        fileobj = io.TextIOWrapper(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)"},{"col":4,"comment":"\n        Write out SIP keywords.  Returns a dictionary of key-value\n        pairs.\n        ","endLoc":1147,"header":"def _write_sip_kw(self)","id":741,"name":"_write_sip_kw","nodeType":"Function","startLoc":1121,"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            keywords[str('{0}_ORDER').format(name)] = size - 1\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            str('{0}_{1:d}_{2:d}').format(name, i, j)] = a[i, j]\n\n        write_array(str('A'), self.sip.a)\n        write_array(str('B'), self.sip.b)\n        write_array(str('AP'), self.sip.ap)\n        write_array(str('BP'), self.sip.bp)\n\n        return keywords"},{"col":0,"comment":"null","endLoc":1335,"header":"def _release_download_cache_lock()","id":742,"name":"_release_download_cache_lock","nodeType":"Function","startLoc":1323,"text":"def _release_download_cache_lock():\n    lockdir = os.path.join(_get_download_cache_locs()[0], 'lock')\n\n    if os.path.isdir(lockdir):\n        # if the pid file is present, be sure to remove it\n        pidfn = os.path.join(lockdir, 'pid')\n        if os.path.exists(pidfn):\n            os.remove(pidfn)\n        os.rmdir(lockdir)\n    else:\n        msg = 'Error releasing lock. \"{0}\" either does not exist or is not ' +\\\n              'a directory.'\n        raise RuntimeError(msg.format(lockdir))"},{"col":4,"comment":"\n        Parameters\n        ----------\n        input\n            a sequence of variable-sized elements.\n        ","endLoc":1904,"header":"def __new__(cls, input, dtype='a')","id":744,"name":"__new__","nodeType":"Function","startLoc":1882,"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                    'Inconsistent input data array: {0}'.format(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":4,"comment":"\n        Construct a primary HDU.\n\n        Parameters\n        ----------\n        data : array or DELAYED, optional\n            The data in the HDU.\n\n        header : Header instance, 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":1008,"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":745,"name":"__init__","nodeType":"Function","startLoc":956,"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 DELAYED, optional\n            The data in the HDU.\n\n        header : Header instance, 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":1356,"header":"def _initialise(self, options=None)","id":746,"name":"_initialise","nodeType":"Function","startLoc":1327,"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":1267,"header":"def _convert_to_valid_data_type(self, array)","id":747,"name":"_convert_to_valid_data_type","nodeType":"Function","startLoc":1204,"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":1324,"header":"def _load(self, infile, configspec)","id":748,"name":"_load","nodeType":"Function","startLoc":1231,"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":"Open a FITS file from a file object (including compressed files).","endLoc":473,"header":"def _open_fileobj(self, fileobj, mode, overwrite)","id":749,"name":"_open_fileobj","nodeType":"Function","startLoc":442,"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        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,OSError):\n            return\n\n        self._try_read_compressed(fileobj, magic, mode)"},{"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":750,"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 ticket #218: https://aeon.stsci.edu/ssb/trac/pyfits/ticket/218\n        return array.view(dtype)\n    else:\n        return array.astype(dtype)"},{"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":414,"header":"def _overwrite_existing(self, overwrite, fileobj, closed)","id":751,"name":"_overwrite_existing","nodeType":"Function","startLoc":396,"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(\"File {!r} already exists.\".format(self.name))"},{"col":4,"comment":"Parse the configspec.","endLoc":1944,"header":"def _handle_configspec(self, configspec)","id":753,"name":"_handle_configspec","nodeType":"Function","startLoc":1927,"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":215,"header":"def __init__(self, message='', line_number=None, line='')","id":754,"name":"__init__","nodeType":"Function","startLoc":212,"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":1355,"header":"def _init_from_sequence(self, columns)","id":755,"name":"_init_from_sequence","nodeType":"Function","startLoc":1349,"text":"def _init_from_sequence(self, columns):\n        for idx, col in enumerate(columns):\n            if not isinstance(col, Column):\n                raise TypeError('Element {} in the ColDefs input is not a '\n                                'Column.'.format(idx))\n\n        self._init_from_coldefs(columns)"},{"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":1479,"header":"def _handle_bom(self, infile)","id":756,"name":"_handle_bom","nodeType":"Function","startLoc":1370,"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":1438,"header":"def _init_from_table(self, table)","id":757,"name":"_init_from_table","nodeType":"Function","startLoc":1390,"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, value in hdr.items():\n            key = TDEF_RE.match(keyword)\n            try:\n                keyword = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if keyword in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[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                    'Invalid keyword for column {}: {}'.format(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":326,"header":"def writable(self)","id":758,"name":"writable","nodeType":"Function","startLoc":323,"text":"def writable(self):\n        if self.readonly:\n            return False\n        return iswritable(self._file)"},{"col":4,"comment":"null","endLoc":330,"header":"def write(self, string)","id":759,"name":"write","nodeType":"Function","startLoc":328,"text":"def write(self, string):\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":341,"header":"def writearray(self, array)","id":760,"name":"writearray","nodeType":"Function","startLoc":332,"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 hasattr(self._file, 'write'):\n            _array_to_file(array, self._file)"},{"col":4,"comment":"null","endLoc":345,"header":"def flush(self)","id":761,"name":"flush","nodeType":"Function","startLoc":343,"text":"def flush(self):\n        if hasattr(self._file, 'flush'):\n            self._file.flush()"},{"col":4,"comment":"null","endLoc":355,"header":"def seek(self, offset, whence=0)","id":762,"name":"seek","nodeType":"Function","startLoc":347,"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":4,"comment":"null","endLoc":174,"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":763,"name":"__init__","nodeType":"Function","startLoc":38,"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 header is not None:\n            if not isinstance(header, Header):\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        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\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            # 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 set set _bitpix, _bzero, and _bscale to the\n            # appropriate BITPIX for the data, and always sets _bzero=0 and\n            # _bscale=1.\n            self.data = data\n            self.update_header()\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"},{"col":0,"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":601,"header":"def _get_valid_format(mode, cls, path, fileobj, args, kwargs)","id":764,"name":"_get_valid_format","nodeType":"Function","startLoc":583,"text":"def _get_valid_format(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\n    valid_formats = identify_format(mode, cls, path, fileobj, args, kwargs)\n\n    if len(valid_formats) == 0:\n        format_table_str = _get_format_table_str(cls, mode.capitalize())\n        raise IORegistryError(\"Format could not be identified.\\n\"\n                              \"The available formats are:\\n\"\n                              \"{0}\".format(format_table_str))\n    elif len(valid_formats) > 1:\n        raise IORegistryError(\n            \"Format is ambiguous - options are: {0}\".format(\n                ', '.join(sorted(valid_formats, key=itemgetter(0)))))\n\n    return valid_formats[0]"},{"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":1512,"header":"def _decode(self, infile, encoding)","id":765,"name":"_decode","nodeType":"Function","startLoc":1490,"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":881,"header":"def __init__(self, data=None, header=None, name=None, ver=None, **kwargs)","id":766,"name":"__init__","nodeType":"Function","startLoc":868,"text":"def __init__(self, data=None, header=None, name=None, ver=None, **kwargs):\n        super().__init__(data=data, header=header)\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":"null","endLoc":141,"header":"def __init__(self, hdu=None, field=None)","id":767,"name":"__init__","nodeType":"Function","startLoc":139,"text":"def __init__(self, hdu=None, field=None):\n        self.hdu = weakref.proxy(hdu)\n        self.field = field"},{"col":4,"comment":"Attempt to determine if the given file is compressed","endLoc":440,"header":"def _try_read_compressed(self, obj_or_name, magic, mode, ext='')","id":768,"name":"_try_read_compressed","nodeType":"Function","startLoc":416,"text":"def _try_read_compressed(self, obj_or_name, magic, mode, ext=''):\n        \"\"\"Attempt to determine if the given file is compressed\"\"\"\n        if ext == '.gz' or magic.startswith(GZIP_MAGIC):\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 ext == '.zip' or magic.startswith(PKZIP_MAGIC):\n            # Handle zip files\n            self._open_zipfile(self.name, mode)\n            self.compression = 'zip'\n        elif 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            # bzip2 only supports 'w' and 'r' modes\n            bzip2_mode = 'w' if mode == '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":4,"comment":"null","endLoc":1441,"header":"def __copy__(self)","id":769,"name":"__copy__","nodeType":"Function","startLoc":1440,"text":"def __copy__(self):\n        return self.__class__(self)"},{"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":604,"header":"def _open_zipfile(self, fileobj, mode)","id":770,"name":"_open_zipfile","nodeType":"Function","startLoc":574,"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":4,"comment":"null","endLoc":1444,"header":"def __deepcopy__(self, memo)","id":771,"name":"__deepcopy__","nodeType":"Function","startLoc":1443,"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":1508,"header":"def __getattr__(self, name)","id":772,"name":"__getattr__","nodeType":"Function","startLoc":1494,"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":"Actually parse the config file.","endLoc":1701,"header":"def _parse(self, infile)","id":773,"name":"_parse","nodeType":"Function","startLoc":1537,"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":1539,"header":"@lazyproperty\n    def dtype(self)","id":774,"name":"dtype","nodeType":"Function","startLoc":1510,"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        fields = []\n        offsets = [0]\n\n        for name, format_, dim in zip(self.names, 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            fields.append((name, dt))\n\n        return nh.realign_dtype(np.dtype(fields), offsets)"},{"col":0,"comment":"\n    Write out data.\n\n    The arguments passed to this method depend on the format.\n    ","endLoc":564,"header":"def write(data, *args, format=None, **kwargs)","id":775,"name":"write","nodeType":"Function","startLoc":539,"text":"def write(data, *args, format=None, **kwargs):\n    \"\"\"\n    Write out data.\n\n    The arguments passed to this method depend on the format.\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 pathlib.Path object\n                if isinstance(args[0], pathlib.Path):\n                    args = (str(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 = _get_valid_format(\n            'write', data.__class__, path, fileobj, args, kwargs)\n\n    writer = get_writer(format, data.__class__)\n    writer(data, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":1543,"header":"@lazyproperty\n    def names(self)","id":776,"name":"names","nodeType":"Function","startLoc":1541,"text":"@lazyproperty\n    def names(self):\n        return [col.name for col in self.columns]"},{"col":4,"comment":"null","endLoc":1547,"header":"@lazyproperty\n    def formats(self)","id":777,"name":"formats","nodeType":"Function","startLoc":1545,"text":"@lazyproperty\n    def formats(self):\n        return [col.format for col in self.columns]"},{"col":4,"comment":"null","endLoc":1551,"header":"@lazyproperty\n    def _arrays(self)","id":778,"name":"_arrays","nodeType":"Function","startLoc":1549,"text":"@lazyproperty\n    def _arrays(self):\n        return [col.array for col in self.columns]"},{"col":4,"comment":"null","endLoc":1555,"header":"@lazyproperty\n    def _recformats(self)","id":779,"name":"_recformats","nodeType":"Function","startLoc":1553,"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":1561,"header":"@lazyproperty\n    def _dims(self)","id":780,"name":"_dims","nodeType":"Function","startLoc":1557,"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":1571,"header":"def __getitem__(self, key)","id":781,"name":"__getitem__","nodeType":"Function","startLoc":1563,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":12,"id":782,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":783,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":784,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":20,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":785,"name":"_readers","nodeType":"Attribute","startLoc":23,"text":"_readers"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":786,"name":"_writers","nodeType":"Attribute","startLoc":24,"text":"_writers"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":787,"name":"_identifiers","nodeType":"Attribute","startLoc":25,"text":"_identifiers"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":788,"name":"PATH_TYPES","nodeType":"Attribute","startLoc":27,"text":"PATH_TYPES"},{"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":1973,"header":"def _get_index(names, key)","id":789,"name":"_get_index","nodeType":"Function","startLoc":1930,"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(\"Key '{}' does not exist.\".format(key))\n            else:              # multiple match\n                raise KeyError(\"Ambiguous key name '{}'.\".format(key))\n    else:\n        raise KeyError(\"Illegal key '{!r}'.\".format(key))\n\n    return indx"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":790,"name":"_delayed_docs_classes","nodeType":"Attribute","startLoc":39,"text":"_delayed_docs_classes"},{"col":0,"comment":"","endLoc":4,"header":"registry.py#<anonymous>","id":791,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['register_reader', 'register_writer', 'register_identifier',\n           'identify_format', 'get_reader', 'get_writer', 'read', 'write',\n           'get_formats', 'IORegistryError', 'delay_doc_updates']\n\n__doctest_skip__ = ['register_identifier']\n\n_readers = OrderedDict()\n\n_writers = OrderedDict()\n\n_identifiers = OrderedDict()\n\nPATH_TYPES = (str, pathlib.Path)\n\n_delayed_docs_classes = set()"},{"fileName":"verify.py","filePath":"astropy/io/fits","id":792,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport operator\nimport warnings\n\nfrom ...utils import indent\nfrom ...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 = 'Unfixable error: {}'.format(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:`verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError('Option {!r} not recognized.'.format(option))\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('{} {}:'.format(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"},{"className":"VerifyError","col":0,"comment":"\n    Verify exception class.\n    ","endLoc":13,"id":793,"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":794,"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":795,"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 = 'Unfixable error: {}'.format(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:`verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError('Option {!r} not recognized.'.format(option))\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":796,"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 = 'Unfixable error: {}'.format(text)\n        else:\n            if fix:\n                fix()\n            text += '  ' + fix_text\n\n        return (fixable, text)"},{"col":4,"comment":"null","endLoc":1574,"header":"def __len__(self)","id":797,"name":"__len__","nodeType":"Function","startLoc":1573,"text":"def __len__(self):\n        return len(self.columns)"},{"col":4,"comment":"null","endLoc":1585,"header":"def __repr__(self)","id":798,"name":"__repr__","nodeType":"Function","startLoc":1576,"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":"Open a FITS file from a filename string.","endLoc":535,"header":"def _open_filename(self, filename, mode, overwrite)","id":799,"name":"_open_filename","nodeType":"Function","startLoc":513,"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 (isinstance(self._file, bz2.BZ2File) and mode == 'ostream'):\n            self._file.seek(0)"},{"col":4,"comment":"null","endLoc":1598,"header":"def __add__(self, other, option='left')","id":800,"name":"__add__","nodeType":"Function","startLoc":1587,"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":1601,"header":"def __radd__(self, other)","id":801,"name":"__radd__","nodeType":"Function","startLoc":1600,"text":"def __radd__(self, other):\n        return self.__add__(other, 'right')"},{"col":4,"comment":"null","endLoc":1611,"header":"def __sub__(self, other)","id":802,"name":"__sub__","nodeType":"Function","startLoc":1603,"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":"Open a FITS file from a file-like object, i.e. one that has\n        read and/or write methods.\n        ","endLoc":511,"header":"def _open_filelike(self, fileobj, mode, overwrite)","id":803,"name":"_open_filelike","nodeType":"Function","startLoc":475,"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        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":1636,"header":"def _update_column_attribute_changed(self, column, attr, old_value,\n                                         new_value)","id":804,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":1613,"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":1662,"header":"def add_col(self, column)","id":805,"name":"add_col","nodeType":"Function","startLoc":1638,"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        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"},{"col":4,"comment":"null","endLoc":175,"header":"def __init__(self, data=None, header=None, *args, **kwargs)","id":806,"name":"__init__","nodeType":"Function","startLoc":153,"text":"def __init__(self, data=None, header=None, *args, **kwargs):\n        if header is None:\n            header = Header()\n        self._header = header\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":"\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:`verify` for more info.\n        ","endLoc":119,"header":"def verify(self, option='warn')","id":807,"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:`verify` for more info.\n        \"\"\"\n\n        opt = option.lower()\n        if opt not in VERIFY_OPTIONS:\n            raise ValueError('Option {!r} not recognized.'.format(option))\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        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":1739,"header":"def _handle_error(self, text, ErrorClass, infile, cur_index)","id":808,"name":"_handle_error","nodeType":"Function","startLoc":1723,"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":26,"endLoc":93,"id":809,"nodeType":"Lambda","startLoc":93,"text":"lambda x: not x[0]"},{"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":1692,"header":"def del_col(self, col_name)","id":810,"name":"del_col","nodeType":"Function","startLoc":1664,"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        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":"\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":1720,"header":"def _match_depth(self, sect, depth)","id":811,"name":"_match_depth","nodeType":"Function","startLoc":1704,"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":"null","endLoc":360,"header":"def tell(self)","id":812,"name":"tell","nodeType":"Function","startLoc":357,"text":"def tell(self):\n        if not hasattr(self._file, 'tell'):\n            raise EOFError\n        return self._file.tell()"},{"col":4,"comment":"null","endLoc":364,"header":"def truncate(self, size=None)","id":813,"name":"truncate","nodeType":"Function","startLoc":362,"text":"def truncate(self, size=None):\n        if hasattr(self._file, 'truncate'):\n            self._file.truncate(size)"},{"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":572,"header":"@classproperty(lazy=True)\n    def _mmap_available(cls)","id":814,"name":"_mmap_available","nodeType":"Function","startLoc":537,"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":"\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":1710,"header":"def change_attrib(self, col_name, attrib, new_value)","id":815,"name":"change_attrib","nodeType":"Function","startLoc":1694,"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":1728,"header":"def change_name(self, col_name, new_name)","id":816,"name":"change_name","nodeType":"Function","startLoc":1712,"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('New name {} already exists.'.format(new_name))\n        else:\n            self.change_attrib(col_name, 'name', new_name)"},{"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":1743,"header":"def change_unit(self, col_name, new_unit)","id":817,"name":"change_unit","nodeType":"Function","startLoc":1730,"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, 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":1794,"header":"def info(self, attrib='all', output=None)","id":818,"name":"info","nodeType":"Function","startLoc":1745,"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, 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(\"{}:\\n\".format(attr))\n                output.write('    {}\\n'.format(getattr(self, attr + 's')))\n            else:\n                ret[attr] = getattr(self, attr + 's')\n\n        if not output:\n            return ret"},{"col":4,"comment":"Return an unquoted version of a value","endLoc":1749,"header":"def _unquote(self, value)","id":819,"name":"_unquote","nodeType":"Function","startLoc":1742,"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"},{"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":820,"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('{} {}:'.format(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":821,"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":822,"name":"__str__","nodeType":"Function","startLoc":133,"text":"def __str__(self):\n        return '\\n'.join(item[1] for item in self.iter_lines())"},{"attributeType":"null","col":8,"comment":"null","endLoc":179,"id":823,"name":"fileobj_mode","nodeType":"Attribute","startLoc":179,"text":"self.fileobj_mode"},{"col":4,"comment":"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : sequence of HDU objects or single HDU, 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 object, 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":237,"header":"def __init__(self, hdus=[], file=None)","id":824,"name":"__init__","nodeType":"Function","startLoc":173,"text":"def __init__(self, hdus=[], file=None):\n        \"\"\"\n        Construct a `HDUList` object.\n\n        Parameters\n        ----------\n        hdus : sequence of HDU objects or single HDU, 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 object, 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        self._save_backup = False\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(\"Element {} in the HDUList input is \"\n                                \"not an HDU.\".format(idx))\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 initalizing from a file, this will be handled by the\n            # append method after the first HDU is read\n            self.update_extend()"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":825,"name":"_mmap","nodeType":"Attribute","startLoc":127,"text":"self._mmap"},{"attributeType":"null","col":16,"comment":"null","endLoc":215,"id":826,"name":"memmap","nodeType":"Attribute","startLoc":215,"text":"self.memmap"},{"attributeType":"null","col":12,"comment":"null","endLoc":111,"id":827,"name":"simulateonly","nodeType":"Attribute","startLoc":111,"text":"self.simulateonly"},{"attributeType":"None | {__eq__}","col":8,"comment":"null","endLoc":156,"id":828,"name":"mode","nodeType":"Attribute","startLoc":156,"text":"self.mode"},{"col":4,"comment":"null","endLoc":598,"header":"def _verify_blank(self)","id":829,"name":"_verify_blank","nodeType":"Function","startLoc":574,"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: {0!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":"\n        Make sure that if the primary header needs the keyword ``EXTEND`` that\n        it has it and it is correct.\n        ","endLoc":814,"header":"def update_extend(self)","id":830,"name":"update_extend","nodeType":"Function","startLoc":784,"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))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1280,"id":832,"name":"_padding_byte","nodeType":"Attribute","startLoc":1280,"text":"_padding_byte"},{"attributeType":"null","col":4,"comment":"null","endLoc":1281,"id":833,"name":"_col_format_cls","nodeType":"Attribute","startLoc":1281,"text":"_col_format_cls"},{"attributeType":"null","col":12,"comment":"null","endLoc":1294,"id":834,"name":"klass","nodeType":"Attribute","startLoc":1294,"text":"klass"},{"attributeType":"null","col":8,"comment":"null","endLoc":1347,"id":835,"name":"columns","nodeType":"Attribute","startLoc":1347,"text":"self.columns"},{"className":"_AsciiColDefs","col":0,"comment":"ColDefs implementation for ASCII tables.","endLoc":1873,"id":836,"nodeType":"Class","startLoc":1797,"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":"\n        Update the header keywords to agree with the data.\n        ","endLoc":375,"header":"def update_header(self)","id":837,"name":"update_header","nodeType":"Function","startLoc":310,"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_uint_scale_keywords()\n\n        self._modified = False"},{"col":4,"comment":"Extract the value, where we are in a multiline situation.","endLoc":1924,"header":"def _multiline(self, value, infile, cur_index, maxline)","id":838,"name":"_multiline","nodeType":"Function","startLoc":1892,"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)"},{"col":4,"comment":"null","endLoc":1814,"header":"def __init__(self, input, ascii=True)","id":839,"name":"__init__","nodeType":"Function","startLoc":1803,"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"},{"attributeType":"None","col":12,"comment":"null","endLoc":99,"id":840,"name":"_file","nodeType":"Attribute","startLoc":99,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":841,"name":"close_on_error","nodeType":"Attribute","startLoc":164,"text":"self.close_on_error"},{"col":0,"comment":"null","endLoc":204,"header":"def unrepr(s)","id":842,"name":"unrepr","nodeType":"Function","startLoc":198,"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        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":1873,"header":"def _update_field_metrics(self)","id":843,"name":"_update_field_metrics","nodeType":"Function","startLoc":1853,"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        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":844,"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('{} {}:'.format(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":1824,"header":"@lazyproperty\n    def dtype(self)","id":845,"name":"dtype","nodeType":"Function","startLoc":1816,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":846,"name":"unit","nodeType":"Attribute","startLoc":131,"text":"self.unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":847,"name":"VERIFY_OPTIONS","nodeType":"Attribute","startLoc":22,"text":"VERIFY_OPTIONS"},{"col":0,"comment":"","endLoc":3,"header":"verify.py#<anonymous>","id":848,"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']"},{"attributeType":"null","col":12,"comment":"null","endLoc":194,"id":849,"name":"writeonly","nodeType":"Attribute","startLoc":194,"text":"self.writeonly"},{"col":4,"comment":"\n        If the data is unsigned int 16, 32, or 64 add BSCALE/BZERO cards to\n        header.\n        ","endLoc":506,"header":"def _update_uint_scale_keywords(self)","id":850,"name":"_update_uint_scale_keywords","nodeType":"Function","startLoc":489,"text":"def _update_uint_scale_keywords(self):\n        \"\"\"\n        If the data is unsigned int 16, 32, or 64 add BSCALE/BZERO cards to\n        header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_unsigned(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', _unsigned_zero(self.data.dtype),\n                             after='BSCALE')"},{"col":4,"comment":"A list of the widths of each field in the table.","endLoc":1830,"header":"@property\n    def spans(self)","id":851,"name":"spans","nodeType":"Function","startLoc":1826,"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":1843,"header":"@lazyproperty\n    def _recformats(self)","id":852,"name":"_recformats","nodeType":"Function","startLoc":1832,"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]"},{"fileName":"util.py","filePath":"astropy/io/fits","id":853,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\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 ...utils import data\n\nfrom distutils.version import LooseVersion\n\nimport numpy as np\n\nfrom ...utils import wraps\nfrom ...utils.exceptions import AstropyUserWarning\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 = '_update_{0}'.format(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.currentThread()\n        single_thread = (threading.activeCount() == 1 and\n                         curr_thread.getName() == '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(u'\\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):\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, str):\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                    LooseVersion(platform.mac_ver()[0]) < LooseVersion('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.frombuffer(s, dtype=dtype, count=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 : `~numpy.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):\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):\n            fileobj.write(item.tostring())\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().tostring())\n        else:\n            for item in arr.flat:\n                fileobj.write(item.tostring())\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 ticket #218: https://aeon.stsci.edu/ssb/trac/pyfits/ticket/218\n        return array.view(dtype)\n    else:\n        return array.astype(dtype)\n\n\ndef _unsigned_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    assert dtype.kind == 'u'\n    return 1 << (dtype.itemsize * 8 - 1)\n\n\ndef _is_pseudo_unsigned(dtype):\n    return dtype.kind == 'u' and dtype.itemsize >= 2\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(input, strlen):\n    \"\"\"\n    Split a long string into parts where each part is no longer\n    than ``strlen`` and no word is cut into two pieces.  But if\n    there is one single word which is longer than ``strlen``, then\n    it will be split in the middle of the word.\n    \"\"\"\n\n    words = []\n    nblanks = input.count(' ')\n    nmax = max(nblanks, len(input) // strlen + 1)\n    arr = np.frombuffer((input + ' ').encode('utf8'), dtype=(bytes, 1))\n\n    # locations of the blanks\n    blank_loc = np.nonzero(arr == b' ')[0]\n    offset = 0\n    xoffset = 0\n    for idx in range(nmax):\n        try:\n            loc = np.nonzero(blank_loc >= strlen + offset)[0][0]\n            offset = blank_loc[loc - 1] + 1\n            if loc == 0:\n                offset = -1\n        except Exception:\n            offset = len(input)\n\n        # check for one word longer than strlen, break in the middle\n        if offset <= xoffset:\n            offset = xoffset + strlen\n\n        # collect the pieces in a list\n        words.append(input[xoffset:offset])\n        if len(input) == offset:\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 = np.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        'io/fits/tests/data/{}'.format(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 = \"{0}{1}u{2}\".format(dt.itemsize // bpc, dt.byteorder, 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"},{"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":854,"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":"\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":855,"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":856,"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"},{"col":4,"comment":"\n        Given a value string, unquote, remove comment,\n        handle lists. (including empty and single member lists)\n        ","endLoc":1889,"header":"def _handle_value(self, value)","id":857,"name":"_handle_value","nodeType":"Function","startLoc":1843,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":191,"id":858,"name":"readonly","nodeType":"Attribute","startLoc":191,"text":"self.readonly"},{"col":0,"comment":"null","endLoc":738,"header":"def _is_pseudo_unsigned(dtype)","id":859,"name":"_is_pseudo_unsigned","nodeType":"Function","startLoc":737,"text":"def _is_pseudo_unsigned(dtype):\n    return dtype.kind == 'u' and dtype.itemsize >= 2"},{"attributeType":"null","col":12,"comment":"null","endLoc":206,"id":860,"name":"size","nodeType":"Attribute","startLoc":206,"text":"self.size"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":861,"name":"binary","nodeType":"Attribute","startLoc":155,"text":"self.binary"},{"col":4,"comment":"null","endLoc":1847,"header":"def add_col(self, column)","id":862,"name":"add_col","nodeType":"Function","startLoc":1845,"text":"def add_col(self, column):\n        super().add_col(column)\n        self._update_field_metrics()"},{"attributeType":"null","col":12,"comment":"null","endLoc":152,"id":863,"name":"name","nodeType":"Attribute","startLoc":152,"text":"self.name"},{"col":0,"comment":"\n    Given a numpy dtype, finds its \"zero\" point, which is exactly in the\n    middle of its range.\n    ","endLoc":734,"header":"def _unsigned_zero(dtype)","id":864,"name":"_unsigned_zero","nodeType":"Function","startLoc":727,"text":"def _unsigned_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    assert dtype.kind == 'u'\n    return 1 << (dtype.itemsize * 8 - 1)"},{"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":865,"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.currentThread()\n        single_thread = (threading.activeCount() == 1 and\n                         curr_thread.getName() == '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":4,"comment":"null","endLoc":1851,"header":"def del_col(self, col_name)","id":866,"name":"del_col","nodeType":"Function","startLoc":1849,"text":"def del_col(self, col_name):\n        super().del_col(col_name)\n        self._update_field_metrics()"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":867,"name":"closed","nodeType":"Attribute","startLoc":154,"text":"self.closed"},{"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":624,"header":"def __setitem__(self, key, value, unrepr=False)","id":868,"name":"__setitem__","nodeType":"Function","startLoc":568,"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, collections.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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":187,"id":869,"name":"compression","nodeType":"Attribute","startLoc":187,"text":"self.compression"},{"attributeType":"null","col":8,"comment":"null","endLoc":160,"id":870,"name":"file_like","nodeType":"Attribute","startLoc":160,"text":"self.file_like"},{"attributeType":"null","col":4,"comment":"null","endLoc":1800,"id":871,"name":"_padding_byte","nodeType":"Attribute","startLoc":1800,"text":"_padding_byte"},{"attributeType":"null","col":4,"comment":"null","endLoc":1801,"id":872,"name":"_col_format_cls","nodeType":"Attribute","startLoc":1801,"text":"_col_format_cls"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":873,"name":"strict_memmap","nodeType":"Attribute","startLoc":95,"text":"self.strict_memmap"},{"attributeType":"null","col":12,"comment":"null","endLoc":1814,"id":874,"name":"_width","nodeType":"Attribute","startLoc":1814,"text":"self._width"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":875,"name":"IO_FITS_MODES","nodeType":"Attribute","startLoc":33,"text":"IO_FITS_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":876,"name":"FILE_MODES","nodeType":"Attribute","startLoc":47,"text":"FILE_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":877,"name":"TEXT_RE","nodeType":"Attribute","startLoc":53,"text":"TEXT_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":878,"name":"MEMMAP_MODES","nodeType":"Attribute","startLoc":63,"text":"MEMMAP_MODES"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":879,"name":"GZIP_MAGIC","nodeType":"Attribute","startLoc":71,"text":"GZIP_MAGIC"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":880,"name":"PKZIP_MAGIC","nodeType":"Attribute","startLoc":72,"text":"PKZIP_MAGIC"},{"attributeType":"null","col":12,"comment":"null","endLoc":1813,"id":881,"name":"_spans","nodeType":"Attribute","startLoc":1813,"text":"self._spans"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":882,"name":"BZIP2_MAGIC","nodeType":"Attribute","startLoc":73,"text":"BZIP2_MAGIC"},{"col":0,"comment":"","endLoc":4,"header":"file.py#<anonymous>","id":883,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"IO_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': 'c', 'copyonwrite': 'c', 'update': 'r+',\n                'append': 'c', 'denywrite': 'r'}\n\nGZIP_MAGIC = b'\\x1f\\x8b\\x08'\n\nPKZIP_MAGIC = b'\\x50\\x4b\\x03\\x04'\n\nBZIP2_MAGIC = b'\\x42\\x5a'"},{"className":"_FormatX","col":0,"comment":"For X format in binary tables.","endLoc":330,"id":884,"nodeType":"Class","startLoc":315,"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 '{}X'.format(self.repeat)"},{"fileName":"fitstime.py","filePath":"astropy/io/fits","id":885,"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 ... import units as u\nfrom ...coordinates import EarthLocation\nfrom ...table import Column\nfrom ...time import Time, TimeDelta\nfrom ...time.core import BARYCENTRIC_SCALES\nfrom ...time.formats import FITS_DEPRECATED_SCALES\nfrom ...utils.exceptions import AstropyUserWarning\n\n# The following is based on the FITS WCS Paper IV, \"Representations of time\n# coordinates in FITS\".\n# http://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 = '({0})[0-9]+'.format(\n    '|'.join(COLUMN_TIME_KEYWORDS))\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    # Since TRPOSn is not specified, global reference position is\n    # considered.\n    elif global_info['TREFPOS'] == 'TOPOCENTER':\n\n        column_info['location'] = global_info['location']\n        if column_info['location'] is None:\n            warnings.warn(\n                'Time column reference position \"TRPOSn\" is not specified. The '\n                'default value for it is \"TOPOCENTER\", but due to unspecified '\n                'observatory position, reference position will be ignored.',\n                AstropyUserWarning)\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\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.startswith('DATE'):\n            if key not in table.meta:\n                scale = 'utc' if key == 'DATE' else global_info['scale']\n                try:\n                    precision = len(value.split('.')[-1]) if '.' in value else 0\n                    value = Time(value, format='fits', scale=scale,\n                                 precision=precision)\n                except ValueError:\n                    pass\n                table.meta[key] = value\n\n        # MJD-xxx in MJD according to TIMESYS\n        elif key.startswith('MJD-'):\n            if key not in table.meta:\n                try:\n                    value = Time(value, format='mjd',\n                                 scale=global_info['scale'])\n                except ValueError:\n                    pass\n                table.meta[key] = value\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    # 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\n    # Shallow copy of the input table\n    newtable = table.copy(copy_data=False)\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        if col.info.serialize_method['fits'] == 'formatted_value':\n            newtable.replace_column(col.info.name, Column(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.array([col.jd1, col.jd2])\n        # Roll the 0th (innermost) axis backwards, until it lies in the last position\n        # (jd12.ndim)\n        jd12 = np.rollaxis(jd12, 0, jd12.ndim)\n        newtable.replace_column(col.info.name, Column(jd12, unit='d'))\n\n        # Get column position(index)\n        n = table.colnames.index(col.info.name) + 1\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            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 incompatabile '\n                    'with scale \"{}\".'.format(col.info.name, col.scale.upper()),\n                    AstropyUserWarning)\n            if col.location.size > 1:\n                raise ValueError('Vectorized Location of Time Column \"{}\" cannot be '\n                                 'written, as it is not supported.'.format(col.info.name))\n            if location is None:\n                # Set global geocentric location\n                location = col.location\n                hdr.extend([Card(keyword='OBSGEO-{}'.format(dim.upper()),\n                                 value=getattr(location, dim).to_value(u.m))\n                            for dim in ('x', 'y', 'z')])\n            elif 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":4,"comment":"null","endLoc":323,"header":"def __new__(cls, repeat=1)","id":886,"name":"__new__","nodeType":"Function","startLoc":318,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":887,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"from_file.py#<anonymous>","id":888,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"if __name__ == '__main__':\n    load_wcs_from_file(sys.argv[-1])"},{"col":4,"comment":"null","endLoc":326,"header":"def __getnewargs__(self)","id":889,"name":"__getnewargs__","nodeType":"Function","startLoc":325,"text":"def __getnewargs__(self):\n        return (self.repeat,)"},{"col":4,"comment":"null","endLoc":330,"header":"@property\n    def tform(self)","id":890,"name":"tform","nodeType":"Function","startLoc":328,"text":"@property\n    def tform(self):\n        return '{}X'.format(self.repeat)"},{"fileName":"diff.py","filePath":"astropy/io/fits","id":891,"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\"\"\"\n\n\nimport difflib\nimport fnmatch\nimport functools\nimport glob\nimport io\nimport operator\nimport os.path\nimport textwrap\nimport warnings\n\nfrom collections import defaultdict\nfrom functools import reduce\nfrom inspect import signature\nfrom itertools import islice\n\nimport numpy as np\n\nfrom ... import __version__\n\nfrom ...utils import indent\nfrom .card import Card, BLANK_CARD\nfrom .header import Header\nfrom ...utils.decorators import deprecated_renamed_argument\n# HDUList is used in one of the doctests\nfrom .hdu.hdulist import fitsopen  # pylint: disable=W0611\nfrom .hdu.table import _TableLikeHDU\nfrom ...utils.exceptions import AstropyDeprecationWarning\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\n# Smaller default shift-width for indent:\nindent = functools.partial(indent, width=2)\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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(\"File {0} exists, aborting (pass in \"\n                              \"overwrite=True to overwrite)\".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(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_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True, tolerance=None):\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_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            .. versionchanged:: 2.0\n               ``rtol`` replaces the deprecated ``tolerance`` argument.\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):\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):\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_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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\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        # For now, just compare the extensions one by one in order...might\n        # allow some more sophisticated types of diffing later...\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                self.diff_hdus.append((idx, hdu_diff))\n\n    def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        # print out heading and parameter values\n        filenamea = self.a.filename()\n        if not filenamea:\n            filenamea = '<{} object at {:#x}>'.format(\n                self.a.__class__.__name__, id(self.a))\n\n        filenameb = self.b.filename()\n        if not filenameb:\n            filenameb = '<{} object at {:#x}>'.format(\n                self.b.__class__.__name__, id(self.b))\n\n        self._fileobj.write('\\n')\n        self._writeln(' fitsdiff: {}'.format(__version__))\n        self._writeln(' a: {}\\n b: {}'.format(filenamea, filenameb))\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        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        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(' a: {}'.format(self.diff_hdu_count[0]))\n            self._writeln(' b: {}'.format(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 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                self._writeln('Extension HDU {}:'.format(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, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\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        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        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\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                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(self.diff_keyword_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra keyword {!r:8} in a: {!r}'.format(\n                                keyword, val))\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(' Extra keyword {!r:8} in b: {!r}'.format(\n                                keyword, val))\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(' Inconsistent duplicates of keyword {!r:8}:'\n                              .format(keyword))\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, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(dimsa))\n            self._writeln('  b: {}'.format(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(' Data differs at {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=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        See `FITSDiff` for explanations of the initialization parameters.\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('  a: {} bytes'.format(self.diff_dimensions[0]))\n            self._writeln('  b: {} bytes'.format(self.diff_dimensions[1]))\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(' Data differs at byte {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=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                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(self.diff_column_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra column {} of format {} in a'.format(\n                                name, format))\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(' Extra column {} of format {} in b'.format(\n                                name, format))\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(' Column {} has different {}:'.format(\n                    name, col_attrs[attr]))\n            report_diff_values(self._fileobj, vals[0], vals[1],\n                               ind=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln('  a: {}'.format(self.diff_rows[0]))\n            self._writeln('  b: {}'.format(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(self._fileobj, values[0], values[1],\n                               ind=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 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\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(fileobj, a, b, ind=0):\n    \"\"\"Write a diff between two values to the specified file-like object.\"\"\"\n\n    typea = type(a)\n    typeb = type(b)\n\n    if (isinstance(a, str) and not isinstance(b, str)):\n        a = repr(a).lstrip('u')\n    elif (isinstance(b, str) and not isinstance(a, str)):\n        b = repr(b).lstrip('u')\n\n    if isinstance(a, (int, float, complex, np.number)):\n        a = repr(a)\n\n    if isinstance(b, (int, float, complex, np.number)):\n        b = repr(b)\n\n    if isinstance(a, np.ndarray) and isinstance(b, np.ndarray):\n        diff_indices = np.where(a != b)\n        num_diffs = reduce(operator.mul, map(len, diff_indices), 1)\n        for idx in islice(zip(*diff_indices), 3):\n            fileobj.write(indent('  at {!r}:\\n'.format(list(idx)), ind))\n            report_diff_values(fileobj, a[idx], b[idx], ind=ind + 1)\n\n        if num_diffs > 3:\n            fileobj.write(indent('  ...and at {} more indices.\\n'\n                                 .format(num_diffs - 3), ind))\n        return\n\n    padding = max(len(typea.__name__), len(typeb.__name__)) + 3\n\n    for line in difflib.ndiff(str(a).splitlines(), str(b).splitlines()):\n        if line[0] == '-':\n            line = 'a>' + line[1:]\n            if typea != typeb:\n                typename = '(' + typea.__name__ + ') '\n                line = typename.rjust(padding) + line\n\n        elif line[0] == '+':\n            line = 'b>' + line[1:]\n            if typea != typeb:\n                typename = '(' + typeb.__name__ + ') '\n                line = typename.rjust(padding) + line\n        else:\n            line = ' ' + line\n            if typea != typeb:\n                line = ' ' * padding + line\n        fileobj.write(indent('  {}\\n'.format(line.rstrip('\\n')), ind))\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 = '[{}]'.format(idx + 1)\n            fileobj.write(indent(' Keyword {:8}{} has different {}:\\n'\n                                 .format(keyword, dup, attr), ind))\n            report_diff_values(fileobj, val[0], val[1], ind=ind + 1)\n\n\ndef where_not_allclose(a, b, rtol=1e-5, atol=1e-8):\n    \"\"\"\n    A version of numpy.allclose that returns the indices where the two arrays\n    differ, instead of just a boolean value.\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":"null","col":8,"comment":"null","endLoc":321,"id":892,"name":"obj","nodeType":"Attribute","startLoc":321,"text":"obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":322,"id":893,"name":"repeat","nodeType":"Attribute","startLoc":322,"text":"obj.repeat"},{"attributeType":"null","col":8,"comment":"null","endLoc":319,"id":894,"name":"nbytes","nodeType":"Attribute","startLoc":319,"text":"nbytes"},{"className":"_FormatP","col":0,"comment":"For P format in variable length table.","endLoc":374,"id":895,"nodeType":"Class","startLoc":336,"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('Invalid column format: {}'.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 '{}{}{}({})'.format(repeat, self._format_code, self.format, max)"},{"col":4,"comment":"null","endLoc":353,"header":"def __new__(cls, dtype, repeat=None, max=None)","id":896,"name":"__new__","nodeType":"Function","startLoc":347,"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":356,"header":"def __getnewargs__(self)","id":897,"name":"__getnewargs__","nodeType":"Function","startLoc":355,"text":"def __getnewargs__(self):\n        return (self.dtype, self.repeat, self.max)"},{"col":4,"comment":"null","endLoc":368,"header":"@classmethod\n    def from_tform(cls, format)","id":898,"name":"from_tform","nodeType":"Function","startLoc":358,"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('Invalid column format: {}'.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)"},{"fileName":"column.py","filePath":"astropy/io/fits","id":899,"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 . import _numpy_hacks as nh\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 ...utils import lazyproperty, isiterable, indent\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\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*')\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 '{}{}{}'.format(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        # 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 '{}{}.{}'.format(self.format, self.width, self.precision)\n\n        return '{}{}'.format(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 '{}X'.format(self.repeat)\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('Invalid column format: {}'.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 '{}{}{}({})'.format(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 \"{0}('{1}')\".format(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:`column_creation` and\n        :ref:`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 {0!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('Illegal format `{}`.'.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        format, recformat = cls._determine_formats(format, start, dim, ascii)\n        valid.update(format=format, recformat=recformat)\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                    'Column disp option (TDISPn) must be a string (got {!r}).'\n                    'The invalid value will be ignored for the purpose of '\n                    'formatting the data in this column.'.format(disp))\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                valid['disp'] = disp\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`, `ColDefs`, other\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('Element {} in the ColDefs input is not a '\n                                'Column.'.format(idx))\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) > 1 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 = repr(dim).replace(' ', '')\n            else:\n                dim = None\n\n            # Check for unsigned ints.\n            bzero = None\n            if 'I' in format and ftype == np.dtype('uint16'):\n                bzero = np.uint16(2**15)\n            elif 'J' in format and ftype == np.dtype('uint32'):\n                bzero = np.uint32(2**31)\n            elif 'K' in format and ftype == np.dtype('uint64'):\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, value in hdr.items():\n            key = TDEF_RE.match(keyword)\n            try:\n                keyword = key.group('label')\n            except Exception:\n                continue  # skip if there is no match\n            if keyword in KEYWORD_NAMES:\n                col = int(key.group('num'))\n                if 0 < col <= nfields:\n                    attr = KEYWORD_TO_ATTRIBUTE[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                    'Invalid keyword for column {}: {}'.format(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(\n                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        fields = []\n        offsets = [0]\n\n        for name, format_, dim in zip(self.names, 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            fields.append((name, dt))\n\n        return nh.realign_dtype(np.dtype(fields), 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        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        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('New name {} already exists.'.format(new_name))\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, 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(\"{}:\\n\".format(attr))\n                output.write('    {}\\n'.format(getattr(self, attr + 's')))\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                    'Inconsistent input data array: {0}'.format(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\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(\"Key '{}' does not exist.\".format(key))\n            else:              # multiple match\n                raise KeyError(\"Ambiguous key name '{}'.\".format(key))\n    else:\n        raise KeyError(\"Illegal key '{!r}'.\".format(key))\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('Format {!r} is not recognized.'.format(tform))\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('Format {!r} is not recognized.'.format(tform))\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\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('Illegal format {}.'.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('Illegal format {}.'.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 [for the non-standard J format code just always force 64-bit]\n        if format == 'I' and width <= 4:\n            recformat = 'i2'\n        elif format == 'A':\n            recformat += str(width)\n\n        return recformat\n"},{"col":4,"comment":"null","endLoc":374,"header":"@property\n    def tform(self)","id":901,"name":"tform","nodeType":"Function","startLoc":370,"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 '{}{}{}({})'.format(repeat, self._format_code, self.format, max)"},{"attributeType":"null","col":4,"comment":"null","endLoc":341,"id":902,"name":"_format_re_template","nodeType":"Attribute","startLoc":341,"text":"_format_re_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":343,"id":903,"name":"_format_code","nodeType":"Attribute","startLoc":343,"text":"_format_code"},{"attributeType":"null","col":4,"comment":"null","endLoc":344,"id":904,"name":"_format_re","nodeType":"Attribute","startLoc":344,"text":"_format_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":345,"id":905,"name":"_descriptor_format","nodeType":"Attribute","startLoc":345,"text":"_descriptor_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":352,"id":906,"name":"max","nodeType":"Attribute","startLoc":352,"text":"obj.max"},{"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    ","endLoc":1901,"id":907,"nodeType":"Class","startLoc":39,"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\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 : A list of `Card` objects, 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 Header([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return Header([copy.copy(self._cards[idx])\n                           for idx in self._wildcardmatch(key)])\n        elif (isinstance(key, str) and\n              key.upper() in Card._commentary_keywords):\n            key = key.upper()\n            # Special case for commentary cards\n            return _HeaderCommentaryCards(self, key)\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n        card = self._cards[self._cardindex(key)]\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        return card.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 not (0 < 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 = ''\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = ''\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, int):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\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(\"Keyword '{}' not found.\".format(key))\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    @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\n           String containing the entire 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        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        # 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(''.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(''.join(image)))\n\n        return cls(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        if isinstance(fileobj, str):\n            # Open in text mode by default to support newline handling; if a\n            # binary-mode file object is passed in, the user is on their own\n            # with respect to newline handling\n            fileobj = open(fileobj, 'r')\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 _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        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        header_str = ''.join(read_blocks)\n\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 padding and (len(header_str) % actual_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) - actual_block_size + BLOCK_SIZE\n            # TODO: Pass this error to validation framework\n            raise ValueError(\n                'Header size is not multiple of {0}: {1}'.format(BLOCK_SIZE,\n                                                                 actual_len))\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: {0}; 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 {0} '\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        s : 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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : str, file, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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            if not fileobj.simulateonly:\n                fileobj.flush()\n                try:\n                    offset = fileobj.tell()\n                except (AttributeError, OSError):\n                    offset = 0\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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 = Header((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\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, 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        return self.__iter__()\n\n    def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for _, v in self.items():\n            yield v\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('Header.pop expected at most 2 arguments, got '\n                            '{}'.format(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 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 supercedes 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 = Header(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(\"Keyword {!r} not found.\".format(keyword))\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('The keyword {!r} is not in the '\n                             ' header.'.format(keyword))\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, int):\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(\"Keyword '{}' not found.\".format(keyword))\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('Intended keyword {} already exists in header.'\n                            .format(newkeyword))\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 _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.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, int):\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], int)):\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(\"Keyword {!r} not found.\".format(keyword))\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(\"Keyword {!r} not found.\".format(keyword))\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, int) 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 _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        if 'NAXIS' in self:\n            naxis = self['NAXIS']\n        else:\n            naxis = 0\n\n        if 'TFIELDS' in self:\n            tfields = self['TFIELDS']\n        else:\n            tfields = 0\n\n        for idx in range(naxis):\n            try:\n                del self['NAXIS' + str(idx + 1)]\n            except KeyError:\n                pass\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                try:\n                    del self[name + str(idx + 1)]\n                except KeyError:\n                    pass\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            try:\n                del self[name]\n            except KeyError:\n                pass\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":8,"comment":"null","endLoc":348,"id":908,"name":"obj","nodeType":"Attribute","startLoc":348,"text":"obj"},{"attributeType":"null","col":8,"comment":"null","endLoc":351,"id":909,"name":"repeat","nodeType":"Attribute","startLoc":351,"text":"obj.repeat"},{"attributeType":"null","col":8,"comment":"null","endLoc":349,"id":910,"name":"format","nodeType":"Attribute","startLoc":349,"text":"obj.format"},{"attributeType":"null","col":8,"comment":"null","endLoc":350,"id":911,"name":"dtype","nodeType":"Attribute","startLoc":350,"text":"obj.dtype"},{"col":4,"comment":"null","endLoc":111,"header":"def __len__(self)","id":912,"name":"__len__","nodeType":"Function","startLoc":110,"text":"def __len__(self):\n        return len(self._cards)"},{"className":"_VLF","col":0,"comment":"Variable length field object.","endLoc":1927,"id":913,"nodeType":"Class","startLoc":1879,"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                    'Inconsistent input data array: {0}'.format(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))"},{"col":4,"comment":"null","endLoc":115,"header":"def __iter__(self)","id":914,"name":"__iter__","nodeType":"Function","startLoc":113,"text":"def __iter__(self):\n        for card in self._cards:\n            yield card.keyword"},{"col":4,"comment":"null","endLoc":128,"header":"def __contains__(self, keyword)","id":915,"name":"__contains__","nodeType":"Function","startLoc":117,"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"},{"col":4,"comment":"null","endLoc":1910,"header":"def __array_finalize__(self, obj)","id":916,"name":"__array_finalize__","nodeType":"Function","startLoc":1906,"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":1927,"header":"def __setitem__(self, key, value)","id":917,"name":"__setitem__","nodeType":"Function","startLoc":1912,"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))"},{"className":"Card","col":0,"comment":"null","endLoc":1160,"id":918,"nodeType":"Class","startLoc":41,"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(r'(?P<sign>[+-])?0*?(?P<digt>{})'.format(\n            _digits_FSC))\n    _number_NFSC_RE = re.compile(r'(?P<sign>[+-])? *0*?(?P<digt>{})'.format(\n            _digits_NFSC))\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                r'\\'(?P<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                r'\\'(?P<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            r')? *)'\n        r'(?P<comm_field>'\n            r'(?P<sepr>/ *)'\n            r'(?P<comm>(.|\\n)*)'\n        r')?$')\n\n    _rvkc_identifier = r'[a-zA-Z_]\\w*'\n    _rvkc_field = _rvkc_identifier + r'(\\.\\d+)?'\n    _rvkc_field_specifier_s = r'{}(\\.{})*'.format(_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 = r'\\'(?P<rawval>{})\\''.format(_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\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\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._valuestring = None\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 HEIRARCH 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('Illegal keyword name: {!r}.'.format(keyword))\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError('Keyword name {!r} is not a string.'.format(keyword))\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            self._value = self._parse_value()\n            value = self._value\n        else:\n            self._value = value = ''\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/unparseable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = ''\n        oldvalue = self._value\n        if oldvalue is None:\n            oldvalue = ''\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('Illegal value: {!r}.'.format(value))\n\n        if isinstance(value, float) and (np.isnan(value) or np.isinf(value)):\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, bytes):\n            # Allow str, but only if they can be decoded to ASCII text; note\n            # this is not even allowed on Python 3 since the `bytes` type is\n            # not included in `str`.  Presently we simply don't\n            # allow bytes to be assigned to headers, as doing so would too\n            # easily mask potential user error\n            valid = True\n            try:\n                text_value = value.decode('ascii')\n            except UnicodeDecodeError:\n                valid = False\n            else:\n                # Check against the printable characters regexp as well\n                m = self._ascii_text_re.match(text_value)\n                valid = m is not None\n\n            if not valid:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters/bytes that do not '\n                    'represent printable characters in ASCII.'.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('value {} is not a float'.format(\n                            self._value))\n\n    @value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparseable 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 = '{}: {}'.format(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/unparseable 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.'.format(\n                    comment))\n\n        oldcomment = self._comment\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/unparseable 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        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\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            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 + len(VALUE_INDICATOR):]\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        val_ind_idx = self._image.find(VALUE_INDICATOR)\n\n        special = self._commentary_keywords\n\n        if (0 <= val_ind_idx <= KEYWORD_LENGTH or keyword_upper in special or\n                keyword_upper == 'CONTINUE'):\n            # The value indicator should appear in byte 8, but we are flexible\n            # and allow this to be fixed\n            if val_ind_idx >= 0:\n                keyword = keyword[:val_ind_idx]\n                rest = self._image[val_ind_idx + len(VALUE_INDICATOR):]\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                keyword_upper = keyword_upper[:val_ind_idx]\n\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            warnings.warn('The following header keyword is invalid or follows '\n                          'an unrecognized non-standard convention:\\n{}'.format(\n                          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        if len(self._image) > self.length:\n            values = []\n            for card in self._itersubcards():\n                value = card.value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n\n            value = ''.join(values)\n\n            self._valuestring = value\n            return 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/unparseable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        if len(self._image) > self.length:\n            comments = []\n            for card in self._itersubcards():\n                if card.comment:\n                    comments.append(card.comment)\n            comment = '/ ' + ' '.join(comments).rstrip()\n            m = self._value_NFSC_RE.match(comment)\n        else:\n            m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is not None:\n            comment = m.group('comm')\n            if comment:\n                return comment.rstrip()\n        return ''\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        if self.keyword in self._commentary_keywords.union(['CONTINUE']):\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 = '({}, {})'.format(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 'HIERARCH {} '.format(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 = '{:>20}'.format(self._valuestring)\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = \"'{}: {}'\".format(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 ' / {}'.format(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 = '{:80}'.format(output)\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('{:80}'.format(headstr + value))\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('{:80}'.format(comment))\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        self._verified = True\n\n        errs = _ErrList([])\n        fix_text = ('Fixed {!r} card to meet the FITS '\n                    'standard.'.format(self.keyword))\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return 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(self.run_option(\n                option,\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(self.run_option(\n                        option,\n                        err_text='Card keyword {!r} is not upper case.'.format(\n                                  keyword),\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(self.run_option(\n                    option,\n                    err_text='Illegal keyword name {!r}'.format(keyword),\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(self.run_option(\n                    option,\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            m = self._value_FSC_RE.match(valuecomment)\n            if not m:\n                errs.append(self.run_option(\n                    option,\n                    err_text='Card {!r} is not FITS standard (invalid value '\n                             'string: {!r}).'.format(self.keyword, valuecomment),\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(self.run_option(\n                        option,\n                        err_text=('Unprintable string {!r}; header comments '\n                                  'may only contain printable ASCII '\n                                  'characters'.format(comment)),\n                        fixable=False))\n\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\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() != 'CONTINUE':\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card.')\n\n            if not isinstance(card.value, str):\n                raise VerifyError('CONTINUE cards must have string values.')\n\n            yield card"},{"attributeType":"null","col":8,"comment":"null","endLoc":1903,"id":919,"name":"element_dtype","nodeType":"Attribute","startLoc":1903,"text":"self.element_dtype"},{"attributeType":"null","col":16,"comment":"null","endLoc":1894,"id":920,"name":"input","nodeType":"Attribute","startLoc":1894,"text":"input"},{"attributeType":"null","col":4,"comment":"null","endLoc":74,"id":921,"name":"__version__","nodeType":"Attribute","startLoc":74,"text":"__version__"},{"attributeType":"null","col":8,"comment":"null","endLoc":1899,"id":922,"name":"a","nodeType":"Attribute","startLoc":1899,"text":"a"},{"attributeType":"null","col":8,"comment":"null","endLoc":1902,"id":923,"name":"max","nodeType":"Attribute","startLoc":1902,"text":"self.max"},{"attributeType":"null","col":8,"comment":"null","endLoc":1900,"id":925,"name":"self","nodeType":"Attribute","startLoc":1900,"text":"self"},{"col":4,"comment":"null","endLoc":201,"header":"def __repr__(self)","id":926,"name":"__repr__","nodeType":"Function","startLoc":200,"text":"def __repr__(self):\n        return repr((self.keyword, self.value, self.comment))"},{"col":4,"comment":"null","endLoc":204,"header":"def __str__(self)","id":927,"name":"__str__","nodeType":"Function","startLoc":203,"text":"def __str__(self):\n        return self.image"},{"col":4,"comment":"null","endLoc":207,"header":"def __len__(self)","id":928,"name":"__len__","nodeType":"Function","startLoc":206,"text":"def __len__(self):\n        return 3"},{"col":4,"comment":"null","endLoc":210,"header":"def __getitem__(self, index)","id":929,"name":"__getitem__","nodeType":"Function","startLoc":209,"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":222,"header":"@property\n    def keyword(self)","id":930,"name":"keyword","nodeType":"Function","startLoc":212,"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":"\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":2029,"header":"def _wrapx(input, output, repeat)","id":931,"name":"_wrapx","nodeType":"Function","startLoc":2001,"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])"},{"col":4,"comment":"Set the key attribute; once set it cannot be modified.","endLoc":272,"header":"@keyword.setter\n    def keyword(self, keyword)","id":932,"name":"keyword","nodeType":"Function","startLoc":224,"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 HEIRARCH 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('Illegal keyword name: {!r}.'.format(keyword))\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError('Keyword name {!r} is not a string.'.format(keyword))"},{"col":4,"comment":"null","endLoc":713,"header":"def _parse_keyword(self)","id":933,"name":"_parse_keyword","nodeType":"Function","startLoc":675,"text":"def _parse_keyword(self):\n        keyword = self._image[:KEYWORD_LENGTH].strip()\n        keyword_upper = keyword.upper()\n        val_ind_idx = self._image.find(VALUE_INDICATOR)\n\n        special = self._commentary_keywords\n\n        if (0 <= val_ind_idx <= KEYWORD_LENGTH or keyword_upper in special or\n                keyword_upper == 'CONTINUE'):\n            # The value indicator should appear in byte 8, but we are flexible\n            # and allow this to be fixed\n            if val_ind_idx >= 0:\n                keyword = keyword[:val_ind_idx]\n                rest = self._image[val_ind_idx + len(VALUE_INDICATOR):]\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                keyword_upper = keyword_upper[:val_ind_idx]\n\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            warnings.warn('The following header keyword is invalid or follows '\n                          'an unrecognized non-standard convention:\\n{}'.format(\n                          self._image), AstropyUserWarning)\n            self._invalid = True\n            return keyword"},{"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":1998,"header":"def _unwrapx(input, output, repeat)","id":934,"name":"_unwrapx","nodeType":"Function","startLoc":1976,"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])"},{"col":0,"comment":"null","endLoc":525,"header":"def translate(s, table, deletechars)","id":935,"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":"Returns an index into the ._cards list given a valid lookup key.","endLoc":1657,"header":"def _cardindex(self, key)","id":936,"name":"_cardindex","nodeType":"Function","startLoc":1608,"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, int):\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], int)):\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(\"Keyword {!r} not found.\".format(keyword))\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(\"Keyword {!r} not found.\".format(keyword))\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":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":2091,"header":"def _makep(array, descr_output, format, nrows=None)","id":937,"name":"_makep","nodeType":"Function","startLoc":2032,"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"},{"className":"Delayed","col":0,"comment":"Delayed file-reading data.","endLoc":148,"id":938,"nodeType":"Class","startLoc":136,"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":148,"header":"def __getitem__(self, key)","id":939,"name":"__getitem__","nodeType":"Function","startLoc":143,"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":141,"id":940,"name":"field","nodeType":"Attribute","startLoc":141,"text":"self.field"},{"col":4,"comment":"The value associated with the keyword stored in this card.","endLoc":292,"header":"@property\n    def value(self)","id":941,"name":"value","nodeType":"Function","startLoc":274,"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            self._value = self._parse_value()\n            value = self._value\n        else:\n            self._value = value = ''\n\n        if conf.strip_header_whitespace and isinstance(value, str):\n            value = value.rstrip()\n\n        return value"},{"attributeType":"null","col":8,"comment":"null","endLoc":140,"id":942,"name":"hdu","nodeType":"Attribute","startLoc":140,"text":"self.hdu"},{"col":4,"comment":"Extract the keyword value from the card image.","endLoc":780,"header":"def _parse_value(self)","id":943,"name":"_parse_value","nodeType":"Function","startLoc":715,"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        if len(self._image) > self.length:\n            values = []\n            for card in self._itersubcards():\n                value = card.value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n\n            value = ''.join(values)\n\n            self._valuestring = value\n            return 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":"null","endLoc":369,"header":"@value.setter\n    def value(self, value)","id":944,"name":"value","nodeType":"Function","startLoc":294,"text":"@value.setter\n    def value(self, value):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparseable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = ''\n        oldvalue = self._value\n        if oldvalue is None:\n            oldvalue = ''\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('Illegal value: {!r}.'.format(value))\n\n        if isinstance(value, float) and (np.isnan(value) or np.isinf(value)):\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, bytes):\n            # Allow str, but only if they can be decoded to ASCII text; note\n            # this is not even allowed on Python 3 since the `bytes` type is\n            # not included in `str`.  Presently we simply don't\n            # allow bytes to be assigned to headers, as doing so would too\n            # easily mask potential user error\n            valid = True\n            try:\n                text_value = value.decode('ascii')\n            except UnicodeDecodeError:\n                valid = False\n            else:\n                # Check against the printable characters regexp as well\n                m = self._ascii_text_re.match(text_value)\n                valid = m is not None\n\n            if not valid:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters/bytes that do not '\n                    'represent printable characters in ASCII.'.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('value {} is not a float'.format(\n                            self._value))"},{"col":4,"comment":"null","endLoc":150,"header":"def __getitem__(self, key)","id":945,"name":"__getitem__","nodeType":"Function","startLoc":130,"text":"def __getitem__(self, key):\n        if isinstance(key, slice):\n            return Header([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return Header([copy.copy(self._cards[idx])\n                           for idx in self._wildcardmatch(key)])\n        elif (isinstance(key, str) and\n              key.upper() in Card._commentary_keywords):\n            key = key.upper()\n            # Special case for commentary cards\n            return _HeaderCommentaryCards(self, key)\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n        card = self._cards[self._cardindex(key)]\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        return card.value"},{"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        ","endLoc":1160,"header":"def _itersubcards(self)","id":946,"name":"_itersubcards","nodeType":"Function","startLoc":1141,"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\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() != 'CONTINUE':\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card.')\n\n            if not isinstance(card.value, str):\n                raise VerifyError('CONTINUE cards must have string values.')\n\n            yield card"},{"col":4,"comment":"Return `True` if the input keyword contains a wildcard pattern.","endLoc":1773,"header":"def _haswildcard(self, keyword)","id":947,"name":"_haswildcard","nodeType":"Function","startLoc":1769,"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":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":929,"header":"def _rstrip_inplace(array)","id":948,"name":"_rstrip_inplace","nodeType":"Function","startLoc":882,"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 = \"{0}{1}u{2}\".format(dt.itemsize // bpc, dt.byteorder, 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":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":949,"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":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":951,"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):\n            fileobj.write(item.tostring())\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().tostring())\n        else:\n            for item in arr.flat:\n                fileobj.write(item.tostring())"},{"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    Adapted from the recipe at\n    http://code.activestate.com/recipes/363602-lazy-property-evaluation\n    ","endLoc":731,"id":952,"nodeType":"Class","startLoc":663,"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    Adapted from the recipe at\n    http://code.activestate.com/recipes/363602-lazy-property-evaluation\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\n    def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__[self._key]\n        except KeyError:\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 took\n                # over setting the value in obj.__dict__; this mechanism allows\n                # 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        if self._key in obj.__dict__:\n            del obj.__dict__[self._key]"},{"col":4,"comment":"null","endLoc":702,"header":"def __init__(self, fget, fset=None, fdel=None, doc=None)","id":953,"name":"__init__","nodeType":"Function","startLoc":700,"text":"def __init__(self, fget, fset=None, fdel=None, doc=None):\n        super().__init__(fget, fset, fdel, doc)\n        self._key = self.fget.__name__"},{"col":4,"comment":"null","endLoc":714,"header":"def __get__(self, obj, owner=None)","id":954,"name":"__get__","nodeType":"Function","startLoc":704,"text":"def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__[self._key]\n        except KeyError:\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"},{"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":1790,"header":"def _wildcardmatch(self, pattern)","id":955,"name":"_wildcardmatch","nodeType":"Function","startLoc":1775,"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":"\n        Split the card image between the keyword and the rest of the card.\n        ","endLoc":836,"header":"def _split(self)","id":956,"name":"_split","nodeType":"Function","startLoc":806,"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        if self.keyword in self._commentary_keywords.union(['CONTINUE']):\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":"null","endLoc":725,"header":"def __set__(self, obj, val)","id":957,"name":"__set__","nodeType":"Function","startLoc":716,"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 took\n                # over setting the value in obj.__dict__; this mechanism allows\n                # it to override the input value\n                return\n        obj_dict[self._key] = val"},{"col":4,"comment":"null","endLoc":731,"header":"def __delete__(self, obj)","id":958,"name":"__delete__","nodeType":"Function","startLoc":727,"text":"def __delete__(self, obj):\n        if self.fdel:\n            self.fdel(obj)\n        if self._key in obj.__dict__:\n            del obj.__dict__[self._key]"},{"col":4,"comment":"null","endLoc":382,"header":"@value.deleter\n    def value(self)","id":959,"name":"value","nodeType":"Function","startLoc":371,"text":"@value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparseable 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":397,"header":"@property\n    def rawkeyword(self)","id":960,"name":"rawkeyword","nodeType":"Function","startLoc":384,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":702,"id":961,"name":"_key","nodeType":"Attribute","startLoc":702,"text":"self._key"},{"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":412,"header":"@property\n    def rawvalue(self)","id":962,"name":"rawvalue","nodeType":"Function","startLoc":399,"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 = '{}: {}'.format(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":425,"header":"@property\n    def comment(self)","id":963,"name":"comment","nodeType":"Function","startLoc":414,"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 ''"},{"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":141,"id":964,"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\n        row : int, optional\n           The starting logical row of the array.\n\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\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(\"Key '{}' does not exist.\".format(key))\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(\"Key '{}' does not exist.\".format(key))\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 '({})'.format(', '.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":"\n        Parameters\n        ----------\n        input : array\n           The array to wrap.\n\n        row : int, optional\n           The starting logical row of the array.\n\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\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":61,"header":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None, **kwargs)","id":965,"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\n        row : int, optional\n           The starting logical row of the array.\n\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\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":"Extract the keyword value from the card image.","endLoc":804,"header":"def _parse_comment(self)","id":966,"name":"_parse_comment","nodeType":"Function","startLoc":782,"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/unparseable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        if len(self._image) > self.length:\n            comments = []\n            for card in self._itersubcards():\n                if card.comment:\n                    comments.append(card.comment)\n            comment = '/ ' + ' '.join(comments).rstrip()\n            m = self._value_NFSC_RE.match(comment)\n        else:\n            m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is not None:\n            comment = m.group('comm')\n            if comment:\n                return comment.rstrip()\n        return ''"},{"col":4,"comment":"null","endLoc":2044,"header":"def __init__(self, header, keyword='')","id":967,"name":"__init__","nodeType":"Function","startLoc":2040,"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":1921,"header":"def __init__(self, header)","id":968,"name":"__init__","nodeType":"Function","startLoc":1920,"text":"def __init__(self, header):\n        self._header = header"},{"col":4,"comment":"null","endLoc":451,"header":"@comment.setter\n    def comment(self, comment)","id":969,"name":"comment","nodeType":"Function","startLoc":427,"text":"@comment.setter\n    def comment(self, comment):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparseable 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.'.format(\n                    comment))\n\n        oldcomment = self._comment\n        if oldcomment is None:\n            oldcomment = ''\n        if comment != oldcomment:\n            self._comment = comment\n            self._modified = True"},{"col":4,"comment":"null","endLoc":78,"header":"def __getitem__(self, key)","id":970,"name":"__getitem__","nodeType":"Function","startLoc":63,"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(\"Key '{}' does not exist.\".format(key))\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":"null","endLoc":460,"header":"@comment.deleter\n    def comment(self)","id":971,"name":"comment","nodeType":"Function","startLoc":453,"text":"@comment.deleter\n    def comment(self):\n        if self._invalid:\n            raise ValueError(\n                'The comment of invalid/unparseable 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":474,"header":"@property\n    def field_specifier(self)","id":972,"name":"field_specifier","nodeType":"Function","startLoc":462,"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":189,"header":"def __setitem__(self, key, value)","id":973,"name":"__setitem__","nodeType":"Function","startLoc":152,"text":"def __setitem__(self, key, value):\n        if self._set_slice(key, value, self):\n            return\n\n        if isinstance(value, tuple):\n            if not (0 < 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 = ''\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = ''\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, int):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\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":"null","endLoc":490,"header":"@field_specifier.setter\n    def field_specifier(self, field_specifier)","id":974,"name":"field_specifier","nodeType":"Function","startLoc":476,"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        Used to implement Header.__setitem__ and CardAccessor.__setitem__.\n        ","endLoc":1811,"header":"def _set_slice(self, key, value, target)","id":975,"name":"_set_slice","nodeType":"Function","startLoc":1792,"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":"null","endLoc":495,"header":"@field_specifier.deleter\n    def field_specifier(self)","id":976,"name":"field_specifier","nodeType":"Function","startLoc":492,"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        The card \"image\", that is, the 80 byte character string that represents\n        this card in an actual FITS header.\n        ","endLoc":508,"header":"@property\n    def image(self)","id":977,"name":"image","nodeType":"Function","startLoc":497,"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":"null","endLoc":981,"header":"def _format_image(self)","id":978,"name":"_format_image","nodeType":"Function","startLoc":934,"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 = '{:80}'.format(output)\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":"null","endLoc":896,"header":"def _format_keyword(self)","id":979,"name":"_format_keyword","nodeType":"Function","startLoc":886,"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 'HIERARCH {} '.format(self.keyword)\n            else:\n                return '{:{len}}'.format(self.keyword, len=KEYWORD_LENGTH)\n        else:\n            return ' ' * KEYWORD_LENGTH"},{"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":1606,"header":"def _update(self, card)","id":980,"name":"_update","nodeType":"Function","startLoc":1565,"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.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":926,"header":"def _format_value(self)","id":981,"name":"_format_value","nodeType":"Function","startLoc":898,"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 = '{:>20}'.format(self._valuestring)\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = \"'{}: {}'\".format(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":1217,"header":"def _format_value(value)","id":982,"name":"_format_value","nodeType":"Function","startLoc":1183,"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 = \"'{:8}'\".format(exp_val_str)\n            return '{:20}'.format(val_str)\n\n    # must be before int checking since bool is also int\n    elif isinstance(value, (bool, np.bool_)):\n        return '{:>20}'.format(repr(value)[0])  # T or F\n\n    elif _is_int(value):\n        return '{:>20d}'.format(value)\n\n    elif isinstance(value, (float, np.floating)):\n        return '{:>20}'.format(_format_float(value))\n\n    elif isinstance(value, (complex, np.complexfloating)):\n        val_str = '({}, {})'.format(_format_float(value.real),\n                                    _format_float(value.imag))\n        return '{:>20}'.format(val_str)\n\n    elif isinstance(value, Undefined):\n        return ''\n    else:\n        return ''"},{"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":1838,"header":"def _splitcommentary(self, keyword, value)","id":983,"name":"_splitcommentary","nodeType":"Function","startLoc":1813,"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":"Format a floating number to make sure it gets the decimal point.","endLoc":1249,"header":"def _format_float(value)","id":984,"name":"_format_float","nodeType":"Function","startLoc":1220,"text":"def _format_float(value):\n    \"\"\"Format a floating number to make sure it gets the decimal point.\"\"\"\n\n    value_str = '{:.16G}'.format(value)\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 = '{}E{}{:02d}'.format(significand, sign, int(exponent))\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":141,"header":"def _get_index(self, indx)","id":985,"name":"_get_index","nodeType":"Function","startLoc":133,"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":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":1348,"header":"def index(self, keyword, start=None, stop=None)","id":986,"name":"index","nodeType":"Function","startLoc":1311,"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('The keyword {!r} is not in the '\n                             ' header.'.format(keyword))"},{"col":4,"comment":"null","endLoc":932,"header":"def _format_comment(self)","id":987,"name":"_format_comment","nodeType":"Function","startLoc":928,"text":"def _format_comment(self):\n        if not self.comment:\n            return ''\n        else:\n            return ' / {}'.format(self._comment)"},{"col":4,"comment":"null","endLoc":95,"header":"def __setitem__(self, key, value)","id":988,"name":"__setitem__","nodeType":"Function","startLoc":80,"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(\"Key '{}' does not exist.\".format(key))\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":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":1442,"header":"def insert(self, key, card, useblanks=True, after=False)","id":989,"name":"insert","nodeType":"Function","startLoc":1350,"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, int):\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":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":1033,"header":"def _format_long_image(self)","id":990,"name":"_format_long_image","nodeType":"Function","startLoc":983,"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('{:80}'.format(headstr + value))\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('{:80}'.format(comment))\n\n        return ''.join(output)"},{"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":1049,"header":"def _format_long_commentary_image(self)","id":991,"name":"_format_long_commentary_image","nodeType":"Function","startLoc":1035,"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)"},{"col":4,"comment":"null","endLoc":98,"header":"def __len__(self)","id":992,"name":"__len__","nodeType":"Function","startLoc":97,"text":"def __len__(self):\n        return len(range(self.start, self.end, self.step))"},{"col":4,"comment":"\n        Display a single row.\n        ","endLoc":108,"header":"def __repr__(self)","id":993,"name":"__repr__","nodeType":"Function","startLoc":100,"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 '({})'.format(', '.join(outlist))"},{"col":4,"comment":"\n        Get the field data of the record.\n        ","endLoc":115,"header":"def field(self, field)","id":994,"name":"field","nodeType":"Function","startLoc":110,"text":"def field(self, field):\n        \"\"\"\n        Get the field data of the record.\n        \"\"\"\n\n        return self.__getitem__(field)"},{"col":0,"comment":"\n    Split a long string into parts where each part is no longer\n    than ``strlen`` and no word is cut into two pieces.  But if\n    there is one single word which is longer than ``strlen``, then\n    it will be split in the middle of the word.\n    ","endLoc":792,"header":"def _words_group(input, strlen)","id":995,"name":"_words_group","nodeType":"Function","startLoc":756,"text":"def _words_group(input, strlen):\n    \"\"\"\n    Split a long string into parts where each part is no longer\n    than ``strlen`` and no word is cut into two pieces.  But if\n    there is one single word which is longer than ``strlen``, then\n    it will be split in the middle of the word.\n    \"\"\"\n\n    words = []\n    nblanks = input.count(' ')\n    nmax = max(nblanks, len(input) // strlen + 1)\n    arr = np.frombuffer((input + ' ').encode('utf8'), dtype=(bytes, 1))\n\n    # locations of the blanks\n    blank_loc = np.nonzero(arr == b' ')[0]\n    offset = 0\n    xoffset = 0\n    for idx in range(nmax):\n        try:\n            loc = np.nonzero(blank_loc >= strlen + offset)[0][0]\n            offset = blank_loc[loc - 1] + 1\n            if loc == 0:\n                offset = -1\n        except Exception:\n            offset = len(input)\n\n        # check for one word longer than strlen, break in the middle\n        if offset <= xoffset:\n            offset = xoffset + strlen\n\n        # collect the pieces in a list\n        words.append(input[xoffset:offset])\n        if len(input) == offset:\n            break\n        xoffset = offset\n\n    return words"},{"col":4,"comment":"\n        Set the field data of the record.\n        ","endLoc":122,"header":"def setfield(self, field, value)","id":996,"name":"setfield","nodeType":"Function","startLoc":117,"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":"null","endLoc":131,"header":"@lazyproperty\n    def _bases(self)","id":997,"name":"_bases","nodeType":"Function","startLoc":124,"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"},{"col":4,"comment":"null","endLoc":247,"header":"def __delitem__(self, key)","id":998,"name":"__delitem__","nodeType":"Function","startLoc":191,"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(\"Keyword '{}' not found.\".format(key))\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":"\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":529,"header":"@property\n    def is_blank(self)","id":999,"name":"is_blank","nodeType":"Function","startLoc":510,"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":844,"header":"def _fix_keyword(self)","id":1000,"name":"_fix_keyword","nodeType":"Function","startLoc":838,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":1001,"name":"array","nodeType":"Attribute","startLoc":52,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":1002,"name":"start","nodeType":"Attribute","startLoc":60,"text":"self.start"},{"attributeType":"null","col":20,"comment":"null","endLoc":60,"id":1003,"name":"end","nodeType":"Attribute","startLoc":60,"text":"self.end"},{"attributeType":"null","col":30,"comment":"null","endLoc":60,"id":1004,"name":"step","nodeType":"Attribute","startLoc":60,"text":"self.step"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":1005,"name":"row","nodeType":"Attribute","startLoc":53,"text":"self.row"},{"attributeType":"null","col":8,"comment":"null","endLoc":61,"id":1006,"name":"base","nodeType":"Attribute","startLoc":61,"text":"self.base"},{"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":1264,"id":1007,"nodeType":"Class","startLoc":144,"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        # Make sure the data is a listener for changes to the columns\n        columns._add_listener(data)\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 __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._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 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        \"\"\"\n        A user-visible accessor for the coldefs.\n\n        See https://aeon.stsci.edu/ssb/trac/pyfits/ticket/44\n        \"\"\"\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 = '_update_column_{0}'.format(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 = 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 conerted 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{0:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\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 = ('|{}{}'.format(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 '{0}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {1!r} of the column, and the index {2} 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.replace(encode_ascii('E'), encode_ascii('D'))"},{"col":4,"comment":"Fix the card image for fixable non-standard compliance.","endLoc":884,"header":"def _fix_value(self)","id":1008,"name":"_fix_value","nodeType":"Function","startLoc":846,"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 = '({}, {})'.format(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        Construct a FITS record array from a recarray.\n        ","endLoc":174,"header":"def __new__(subtype, input)","id":1009,"name":"__new__","nodeType":"Function","startLoc":157,"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":250,"header":"def __repr__(self)","id":1010,"name":"__repr__","nodeType":"Function","startLoc":249,"text":"def __repr__(self):\n        return self.tostring(sep='\\n', endcard=False, padding=False)"},{"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        s : str\n            A string representing a FITS header.\n        ","endLoc":635,"header":"def tostring(self, sep='', endcard=True, padding=True)","id":1011,"name":"tostring","nodeType":"Function","startLoc":592,"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        s : 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"},{"col":4,"comment":"null","endLoc":186,"header":"def __setstate__(self, state)","id":1012,"name":"__setstate__","nodeType":"Function","startLoc":176,"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":"\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":215,"header":"def __reduce__(self)","id":1013,"name":"__reduce__","nodeType":"Function","startLoc":188,"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":"Bytes needed to pad the input stringlen to the next FITS block.","endLoc":2096,"header":"def _pad_length(stringlen)","id":1014,"name":"_pad_length","nodeType":"Function","startLoc":2093,"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":253,"header":"def __str__(self)","id":1015,"name":"__str__","nodeType":"Function","startLoc":252,"text":"def __str__(self):\n        return self.tostring()"},{"col":4,"comment":"\n        Two Headers are equal only if they have the exact same string\n        representation.\n        ","endLoc":261,"header":"def __eq__(self, other)","id":1016,"name":"__eq__","nodeType":"Function","startLoc":255,"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":266,"header":"def __add__(self, other)","id":1017,"name":"__add__","nodeType":"Function","startLoc":263,"text":"def __add__(self, other):\n        temp = self.copy(strip=False)\n        temp.extend(other)\n        return temp"},{"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":773,"header":"def copy(self, strip=False)","id":1018,"name":"copy","nodeType":"Function","startLoc":749,"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 = Header((copy.copy(card) for card in self._cards))\n        if strip:\n            tmp._strip()\n        return tmp"},{"col":0,"comment":"Converts a given string to either an int or a float if necessary.","endLoc":753,"header":"def _str_to_num(val)","id":1019,"name":"_str_to_num","nodeType":"Function","startLoc":745,"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    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":805,"header":"def _tmp_name(input)","id":1020,"name":"_tmp_name","nodeType":"Function","startLoc":795,"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":821,"header":"def _get_array_mmap(array)","id":1021,"name":"_get_array_mmap","nodeType":"Function","startLoc":808,"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":0,"comment":"null","endLoc":844,"header":"@contextmanager\ndef _free_space_check(hdulist, dirname=None)","id":1022,"name":"_free_space_check","nodeType":"Function","startLoc":824,"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 = np.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))"},{"col":4,"comment":"null","endLoc":255,"header":"def __array_finalize__(self, obj)","id":1023,"name":"__array_finalize__","nodeType":"Function","startLoc":217,"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":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":858,"header":"def _extract_number(value, default)","id":1024,"name":"_extract_number","nodeType":"Function","startLoc":847,"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":879,"header":"def get_testdata_filepath(filename)","id":1025,"name":"get_testdata_filepath","nodeType":"Function","startLoc":861,"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        'io/fits/tests/data/{}'.format(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`, which\n        is 3s by default)\n\n    Raises\n    ------\n    urllib2.URLError, 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":593,"header":"def get_pkg_data_filename(data_name, package=None, show_progress=True,\n                          remote_timeout=None)","id":1026,"name":"get_pkg_data_filename","nodeType":"Function","startLoc":466,"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`, which\n        is 3s by default)\n\n    Raises\n    ------\n    urllib2.URLError, 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            all_urls = (conf.dataurl, conf.dataurl_mirror)\n            for url in all_urls:\n                try:\n                    return download_file(url + data_name, cache=True,\n                                         show_progress=show_progress,\n                                         timeout=remote_timeout)\n                except urllib.error.URLError:\n                    pass\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\\n\\n\".format(data_name, urls))\n\n        else:\n            return hashfn\n    else:\n        fs_path = os.path.normpath(data_name)\n        datafn = _find_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            all_urls = (conf.dataurl, conf.dataurl_mirror)\n            for url in all_urls:\n                try:\n                    return download_file(url + data_name, cache=True,\n                                         show_progress=show_progress,\n                                         timeout=remote_timeout)\n                except urllib.error.URLError:\n                    pass\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\".format(data_name, urls))"},{"col":4,"comment":"Initializes internal attributes specific to FITS-isms.","endLoc":267,"header":"def _init(self)","id":1027,"name":"_init","nodeType":"Function","startLoc":257,"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":475,"header":"@classmethod\n    def from_columns(cls, columns, nrows=0, fill=False, character_as_bytes=False)","id":1028,"name":"from_columns","nodeType":"Function","startLoc":269,"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        # Make sure the data is a listener for changes to the columns\n        columns._add_listener(data)\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":"null","endLoc":1139,"header":"def _verify(self, option='warn')","id":1029,"name":"_verify","nodeType":"Function","startLoc":1051,"text":"def _verify(self, option='warn'):\n        self._verified = True\n\n        errs = _ErrList([])\n        fix_text = ('Fixed {!r} card to meet the FITS '\n                    'standard.'.format(self.keyword))\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return 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(self.run_option(\n                option,\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(self.run_option(\n                        option,\n                        err_text='Card keyword {!r} is not upper case.'.format(\n                                  keyword),\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(self.run_option(\n                    option,\n                    err_text='Illegal keyword name {!r}'.format(keyword),\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(self.run_option(\n                    option,\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            m = self._value_FSC_RE.match(valuecomment)\n            if not m:\n                errs.append(self.run_option(\n                    option,\n                    err_text='Card {!r} is not FITS standard (invalid value '\n                             'string: {!r}).'.format(self.keyword, valuecomment),\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(self.run_option(\n                        option,\n                        err_text=('Unprintable string {!r}; header comments '\n                                  'may only contain printable ASCII '\n                                  'characters'.format(comment)),\n                        fixable=False))\n\n        return errs"},{"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":886,"header":"def _find_hash_fn(hash)","id":1030,"name":"_find_hash_fn","nodeType":"Function","startLoc":870,"text":"def _find_hash_fn(hash):\n    \"\"\"\n    Looks for a local file by hash - returns file name if found and a valid\n    file, otherwise returns None.\n    \"\"\"\n\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\n    except OSError as e:\n        msg = 'Could not access cache directory to search for data file: '\n        warn(CacheMissingWarning(msg + str(e)))\n        return None\n    hashfn = os.path.join(dldir, hash)\n    if os.path.isfile(hashfn):\n        return hashfn\n    else:\n        return None"},{"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":1281,"header":"def _get_recarray_field(array, key)","id":1031,"name":"_get_recarray_field","nodeType":"Function","startLoc":1267,"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":0,"comment":"\n    Look for data in the source-included data directories and return the\n    path.\n    ","endLoc":867,"header":"def _find_pkg_data_path(data_name, package=None)","id":1032,"name":"_find_pkg_data_path","nodeType":"Function","startLoc":830,"text":"def _find_pkg_data_path(data_name, package=None):\n    \"\"\"\n    Look for data in the source-included data directories and return the\n    path.\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 data_name\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        module = resolve_name(package)\n\n    rootpkgname = package.partition('.')[0]\n\n    rootpkg = resolve_name(rootpkgname)\n\n    module_path = os.path.dirname(module.__file__)\n    path = os.path.join(module_path, data_name)\n\n    root_dir = os.path.dirname(rootpkg.__file__)\n    if not _is_inside(path, root_dir):\n        raise RuntimeError(\"attempted to get a local data file outside \"\n                           \"of the {} tree.\".format(rootpkgname))\n\n    return path"},{"col":0,"comment":"null","endLoc":107,"header":"def _is_inside(path, parent_path)","id":1033,"name":"_is_inside","nodeType":"Function","startLoc":101,"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))"},{"attributeType":"function","col":0,"comment":"null","endLoc":28,"id":1034,"name":"cmp","nodeType":"Attribute","startLoc":28,"text":"cmp"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":1035,"name":"all_integer_types","nodeType":"Attribute","startLoc":30,"text":"all_integer_types"},{"attributeType":"None","col":0,"comment":"null","endLoc":551,"id":1036,"name":"CHUNKED_FROMFILE","nodeType":"Attribute","startLoc":551,"text":"CHUNKED_FROMFILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":592,"id":1037,"name":"_OSX_WRITE_LIMIT","nodeType":"Attribute","startLoc":592,"text":"_OSX_WRITE_LIMIT"},{"attributeType":"null","col":0,"comment":"null","endLoc":593,"id":1038,"name":"_WIN_WRITE_LIMIT","nodeType":"Attribute","startLoc":593,"text":"_WIN_WRITE_LIMIT"},{"col":0,"comment":"","endLoc":4,"header":"util.py#<anonymous>","id":1039,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"cmp = 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":1040,"nodeType":"Lambda","startLoc":28,"text":"lambda a, b: (a > b) - (a < b)"},{"fileName":"setup_package.py","filePath":"astropy/io/fits","id":1041,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport os\n\nfrom distutils.core import Extension\nfrom glob import glob\n\nfrom astropy_helpers import setup_helpers\nfrom astropy_helpers.distutils_helpers import get_distutils_build_option\n\n\ndef _get_compression_extension():\n    # 'numpy' will be replaced with the proper path to the numpy includes\n    cfg = setup_helpers.DistutilsExtensionArgs()\n    cfg['include_dirs'].append('numpy')\n    cfg['sources'].append(os.path.join(os.path.dirname(__file__), 'src',\n                                       'compressionmodule.c'))\n\n    if not setup_helpers.use_system_library('cfitsio'):\n        if setup_helpers.get_compiler_option() == '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            if not get_distutils_build_option('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    else:\n        cfg.update(setup_helpers.pkg_config(['cfitsio'], ['cfitsio']))\n\n    return Extension('astropy.io.fits.compression', **cfg)\n\n\ndef get_extensions():\n    return [_get_compression_extension()]\n\n\ndef get_package_data():\n    # Installs the testing data files\n    return {\n        'astropy.io.fits.tests': [os.path.join('data', '*.fits')]}\n\n\ndef get_external_libraries():\n    return ['cfitsio']\n"},{"attributeType":"null","col":4,"comment":"The length of a Card image; should always be 80 for valid FITS files.","endLoc":43,"id":1042,"name":"length","nodeType":"Attribute","startLoc":43,"text":"length"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":1043,"name":"_keywd_FSC_RE","nodeType":"Attribute","startLoc":47,"text":"_keywd_FSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":1044,"name":"_keywd_hierarch_RE","nodeType":"Attribute","startLoc":49,"text":"_keywd_hierarch_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":1045,"name":"_digits_FSC","nodeType":"Attribute","startLoc":56,"text":"_digits_FSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":1046,"name":"_digits_NFSC","nodeType":"Attribute","startLoc":57,"text":"_digits_NFSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":58,"id":1047,"name":"_numr_FSC","nodeType":"Attribute","startLoc":58,"text":"_numr_FSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":59,"id":1048,"name":"_numr_NFSC","nodeType":"Attribute","startLoc":59,"text":"_numr_NFSC"},{"attributeType":"null","col":4,"comment":"null","endLoc":64,"id":1049,"name":"_number_FSC_RE","nodeType":"Attribute","startLoc":64,"text":"_number_FSC_RE"},{"col":0,"comment":"null","endLoc":60,"header":"def _get_compression_extension()","id":1050,"name":"_get_compression_extension","nodeType":"Function","startLoc":12,"text":"def _get_compression_extension():\n    # 'numpy' will be replaced with the proper path to the numpy includes\n    cfg = setup_helpers.DistutilsExtensionArgs()\n    cfg['include_dirs'].append('numpy')\n    cfg['sources'].append(os.path.join(os.path.dirname(__file__), 'src',\n                                       'compressionmodule.c'))\n\n    if not setup_helpers.use_system_library('cfitsio'):\n        if setup_helpers.get_compiler_option() == '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            if not get_distutils_build_option('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    else:\n        cfg.update(setup_helpers.pkg_config(['cfitsio'], ['cfitsio']))\n\n    return Extension('astropy.io.fits.compression', **cfg)"},{"attributeType":"null","col":4,"comment":"null","endLoc":66,"id":1051,"name":"_number_NFSC_RE","nodeType":"Attribute","startLoc":66,"text":"_number_NFSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":71,"id":1052,"name":"_ascii_text_re","nodeType":"Attribute","startLoc":71,"text":"_ascii_text_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":1053,"name":"_value_FSC_RE","nodeType":"Attribute","startLoc":80,"text":"_value_FSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":110,"id":1054,"name":"_value_NFSC_RE","nodeType":"Attribute","startLoc":110,"text":"_value_NFSC_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":125,"id":1055,"name":"_rvkc_identifier","nodeType":"Attribute","startLoc":125,"text":"_rvkc_identifier"},{"attributeType":"null","col":4,"comment":"null","endLoc":126,"id":1056,"name":"_rvkc_field","nodeType":"Attribute","startLoc":126,"text":"_rvkc_field"},{"attributeType":"null","col":4,"comment":"null","endLoc":127,"id":1057,"name":"_rvkc_field_specifier_s","nodeType":"Attribute","startLoc":127,"text":"_rvkc_field_specifier_s"},{"attributeType":"null","col":4,"comment":"null","endLoc":128,"id":1058,"name":"_rvkc_field_specifier_val","nodeType":"Attribute","startLoc":128,"text":"_rvkc_field_specifier_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":130,"id":1059,"name":"_rvkc_keyword_val","nodeType":"Attribute","startLoc":130,"text":"_rvkc_keyword_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":131,"id":1060,"name":"_rvkc_keyword_val_comm","nodeType":"Attribute","startLoc":131,"text":"_rvkc_keyword_val_comm"},{"attributeType":"null","col":4,"comment":"null","endLoc":134,"id":1061,"name":"_rvkc_field_specifier_val_RE","nodeType":"Attribute","startLoc":134,"text":"_rvkc_field_specifier_val_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":139,"id":1062,"name":"_rvkc_keyword_name_RE","nodeType":"Attribute","startLoc":139,"text":"_rvkc_keyword_name_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":146,"id":1063,"name":"_rvkc_keyword_val_comm_RE","nodeType":"Attribute","startLoc":146,"text":"_rvkc_keyword_val_comm_RE"},{"attributeType":"null","col":4,"comment":"null","endLoc":148,"id":1064,"name":"_commentary_keywords","nodeType":"Attribute","startLoc":148,"text":"_commentary_keywords"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":1065,"name":"_value_indicator","nodeType":"Attribute","startLoc":152,"text":"_value_indicator"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":1066,"name":"_rawkeyword","nodeType":"Attribute","startLoc":181,"text":"self._rawkeyword"},{"attributeType":"null","col":8,"comment":"null","endLoc":168,"id":1067,"name":"_verified","nodeType":"Attribute","startLoc":168,"text":"self._verified"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":1068,"name":"_valuemodified","nodeType":"Attribute","startLoc":198,"text":"self._valuemodified"},{"attributeType":"null","col":8,"comment":"null","endLoc":176,"id":1069,"name":"_invalid","nodeType":"Attribute","startLoc":176,"text":"self._invalid"},{"attributeType":"null","col":8,"comment":"null","endLoc":178,"id":1070,"name":"_field_specifier","nodeType":"Attribute","startLoc":178,"text":"self._field_specifier"},{"attributeType":"null","col":8,"comment":"null","endLoc":163,"id":1071,"name":"_image","nodeType":"Attribute","startLoc":163,"text":"self._image"},{"attributeType":"null","col":8,"comment":"null","endLoc":182,"id":1072,"name":"_rawvalue","nodeType":"Attribute","startLoc":182,"text":"self._rawvalue"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":1073,"name":"_keyword","nodeType":"Attribute","startLoc":159,"text":"self._keyword"},{"attributeType":"null","col":16,"comment":"null","endLoc":253,"id":1074,"name":"_value_indicator","nodeType":"Attribute","startLoc":253,"text":"self._value_indicator"},{"attributeType":"null","col":8,"comment":"null","endLoc":161,"id":1075,"name":"_comment","nodeType":"Attribute","startLoc":161,"text":"self._comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":172,"id":1076,"name":"_hierarch","nodeType":"Attribute","startLoc":172,"text":"self._hierarch"},{"attributeType":"null","col":8,"comment":"null","endLoc":160,"id":1077,"name":"_value","nodeType":"Attribute","startLoc":160,"text":"self._value"},{"attributeType":"null","col":12,"comment":"null","endLoc":194,"id":1078,"name":"comment","nodeType":"Attribute","startLoc":194,"text":"self.comment"},{"attributeType":"null","col":16,"comment":"null","endLoc":189,"id":1079,"name":"keyword","nodeType":"Attribute","startLoc":189,"text":"self.keyword"},{"attributeType":"null","col":16,"comment":"null","endLoc":191,"id":1080,"name":"value","nodeType":"Attribute","startLoc":191,"text":"self.value"},{"attributeType":"null","col":8,"comment":"null","endLoc":196,"id":1081,"name":"_modified","nodeType":"Attribute","startLoc":196,"text":"self._modified"},{"attributeType":"null","col":8,"comment":"null","endLoc":197,"id":1082,"name":"_valuestring","nodeType":"Attribute","startLoc":197,"text":"self._valuestring"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":1083,"name":"BLANK_CARD","nodeType":"Attribute","startLoc":23,"text":"BLANK_CARD"},{"col":4,"comment":"null","endLoc":270,"header":"def __iadd__(self, other)","id":1084,"name":"__iadd__","nodeType":"Function","startLoc":268,"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 supercedes 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":1288,"header":"def extend(self, cards, strip=True, unique=False, update=False,\n               update_first=False, useblanks=True, bottom=False, end=False)","id":1085,"name":"extend","nodeType":"Function","startLoc":1190,"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 supercedes 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 = Header(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)"},{"col":0,"comment":"\n    Determines if a config file can be safely replaced because it doesn't\n    actually contain any meaningful content.\n\n    To meet this criteria, the config file must be either:\n\n    - All comments or completely empty\n\n    - An exact match to a \"legacy\" version of the config file prior to\n      Astropy 0.4, when APE3 was implemented and the config file\n      contained commented-out values by default.\n    ","endLoc":620,"header":"def is_unedited_config_file(content, template_content=None)","id":1086,"name":"is_unedited_config_file","nodeType":"Function","startLoc":574,"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.\n\n    To meet this criteria, the config file must be either:\n\n    - All comments or completely empty\n\n    - An exact match to a \"legacy\" version of the config file prior to\n      Astropy 0.4, when APE3 was implemented and the config file\n      contained commented-out values by default.\n    \"\"\"\n    # We want to calculate the md5sum using universal line endings, so\n    # that even if the files had their line endings converted to \\r\\n\n    # on Windows, this will still work.\n\n    content = content.encode('latin-1')\n\n    # The jquery_url setting, present in 0.3.2 and later only, is\n    # effectively auto-generated by the build system, so we need to\n    # ignore it in the md5sum calculation for 0.3.2.\n    content = re.sub(br'\\njquery_url\\s*=\\s*[^\\n]+', b'', content)\n\n    # First determine if the config file has any effective content\n    buffer = io.BytesIO(content)\n    buffer.seek(0)\n    raw_cfg = configobj.ConfigObj(buffer, interpolation=True)\n    for v in raw_cfg.values():\n        if len(v):\n            break\n    else:\n        return True\n\n    # Now determine if it matches the md5sum of a known, unedited\n    # config file.\n    known_configs = set([\n        '7d4b4f1120304b286d71f205975b1286',  # v0.3.2\n        '5df7e409425e5bfe7ed041513fda3288',  # v0.3\n        '8355f99a01b3bdfd8761ef45d5d8b7e5',  # v0.2\n        '4ea5a84de146dc3fcea2a5b93735e634'   # v0.2.1, v0.2.2, v0.2.3, v0.2.4, v0.2.5\n    ])\n\n    md5 = hashlib.md5()\n    md5.update(content)\n    digest = md5.hexdigest()\n    return digest in known_configs"},{"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":234,"id":1087,"nodeType":"Class","startLoc":48,"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`, or other\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\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            data = raw_data[:self._theap].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_column_added(self, columns, column):\n        \"\"\"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        \"\"\"\n\n        # TODO: It's not clear that this actually works--it probably does not.\n        # This is what the code used to do before introduction of the\n        # notifier interface, but I don't believe it actually worked (there are\n        # several bug reports related to this...)\n        if self._data_loaded:\n            del self.data\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\n        # For now this doesn't do anything fancy--it just deletes the data\n        # attribute so that it is forced to be recreated again.  It doesn't\n        # change anything on the existing data recarray (this is also how this\n        # worked before introducing the notifier interface)\n        if self._data_loaded:\n            del self.data"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":1088,"name":"CARD_LENGTH","nodeType":"Attribute","startLoc":22,"text":"CARD_LENGTH"},{"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":192,"id":1089,"nodeType":"Class","startLoc":151,"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":170,"header":"def __eq__(self, other)","id":1090,"name":"__eq__","nodeType":"Function","startLoc":157,"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"},{"col":4,"comment":"null","endLoc":173,"header":"def __hash__(self)","id":1091,"name":"__hash__","nodeType":"Function","startLoc":172,"text":"def __hash__(self):\n        return hash(self.canonical)"},{"col":4,"comment":"\n        The Numpy dtype object created from the format's associated recformat.\n        ","endLoc":181,"header":"@lazyproperty\n    def dtype(self)","id":1092,"name":"dtype","nodeType":"Function","startLoc":175,"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":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":279,"header":"@property\n    def cards(self)","id":1093,"name":"cards","nodeType":"Function","startLoc":272,"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":"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":192,"header":"@classmethod\n    def from_column_format(cls, format)","id":1094,"name":"from_column_format","nodeType":"Function","startLoc":183,"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":"\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":297,"header":"@property\n    def comments(self)","id":1095,"name":"comments","nodeType":"Function","startLoc":281,"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)"},{"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":248,"id":1096,"nodeType":"Class","startLoc":195,"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 '{}{}{}'.format(repeat, self.format, self.option)"},{"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":313,"header":"@property\n    def _modified(self)","id":1097,"name":"_modified","nodeType":"Function","startLoc":299,"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']"},{"col":4,"comment":"null","endLoc":219,"header":"def __new__(cls, format)","id":1098,"name":"__new__","nodeType":"Function","startLoc":204,"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":"null","endLoc":317,"header":"@_modified.setter\n    def _modified(self, val)","id":1099,"name":"_modified","nodeType":"Function","startLoc":315,"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":447,"header":"@classmethod\n    def fromfile(cls, fileobj, sep='', endcard=True, padding=True)","id":1100,"name":"fromfile","nodeType":"Function","startLoc":389,"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        if isinstance(fileobj, str):\n            # Open in text mode by default to support newline handling; if a\n            # binary-mode file object is passed in, the user is on their own\n            # with respect to newline handling\n            fileobj = open(fileobj, 'r')\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()"},{"col":0,"comment":"Parse ``TFORMn`` keyword for a binary table into a\n    ``(repeat, format, option)`` tuple.\n    ","endLoc":2112,"header":"def _parse_tformat(tform)","id":1101,"name":"_parse_tformat","nodeType":"Function","startLoc":2094,"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('Format {!r} is not recognized.'.format(tform))\n\n    if repeat == '':\n        repeat = 1\n    else:\n        repeat = int(repeat)\n\n    return (repeat, format.upper(), option)"},{"col":0,"comment":"null","endLoc":64,"header":"def get_extensions()","id":1102,"name":"get_extensions","nodeType":"Function","startLoc":63,"text":"def get_extensions():\n    return [_get_compression_extension()]"},{"col":0,"comment":"null","endLoc":271,"header":"def _get_bibtex()","id":1103,"name":"_get_bibtex","nodeType":"Function","startLoc":262,"text":"def _get_bibtex():\n    import re\n    if os.path.exists('CITATION'):\n        with open('CITATION', 'r') as citation:\n            refs = re.findall(r'\\{[^()]*\\}', citation.read())\n            if len(refs) == 0: return ''\n            bibtexreference = \"@ARTICLE{0}\".format(refs[0])\n        return bibtexreference\n    else:\n        return ''"},{"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":545,"header":"@classmethod\n    def _from_blocks(cls, block_iter, is_binary, sep, endcard, padding)","id":1104,"name":"_from_blocks","nodeType":"Function","startLoc":449,"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        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        header_str = ''.join(read_blocks)\n\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 padding and (len(header_str) % actual_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) - actual_block_size + BLOCK_SIZE\n            # TODO: Pass this error to validation framework\n            raise ValueError(\n                'Header size is not multiple of {0}: {1}'.format(BLOCK_SIZE,\n                                                                 actual_len))\n\n        return header_str, cls.fromstring(header_str, sep=sep)"},{"col":0,"comment":"null","endLoc":70,"header":"def get_package_data()","id":1105,"name":"get_package_data","nodeType":"Function","startLoc":67,"text":"def get_package_data():\n    # Installs the testing data files\n    return {\n        'astropy.io.fits.tests': [os.path.join('data', '*.fits')]}"},{"col":0,"comment":"\n    Determine the size of a FITS header block if a non-blank separator is used\n    between cards.\n    ","endLoc":2090,"header":"def _block_size(sep)","id":1106,"name":"_block_size","nodeType":"Function","startLoc":2084,"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":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":316,"header":"def online_help(query)","id":1107,"name":"online_help","nodeType":"Function","startLoc":293,"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    from urllib.parse import urlencode\n    import webbrowser\n\n    version = __version__\n    if 'dev' in version:\n        version = 'latest'\n    else:\n        version = 'v' + version\n\n    url = 'http://docs.astropy.org/en/{0}/search.html?{1}'.format(\n        version, urlencode({'q': query}))\n\n    webbrowser.open(url)"},{"col":0,"comment":"null","endLoc":74,"header":"def get_external_libraries()","id":1108,"name":"get_external_libraries","nodeType":"Function","startLoc":73,"text":"def get_external_libraries():\n    return ['cfitsio']"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":1109,"name":"__minimum_python_version__","nodeType":"Attribute","startLoc":14,"text":"__minimum_python_version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":1110,"name":"__minimum_numpy_version__","nodeType":"Attribute","startLoc":15,"text":"__minimum_numpy_version__"},{"fileName":"__init__.py","filePath":"astropy/io/fits","id":1111,"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 ... 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"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":1112,"name":"online_docs_root","nodeType":"Attribute","startLoc":85,"text":"online_docs_root"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":1113,"name":"online_docs_root","nodeType":"Attribute","startLoc":87,"text":"online_docs_root"},{"attributeType":"null","col":0,"comment":"null","endLoc":156,"id":1114,"name":"test","nodeType":"Attribute","startLoc":156,"text":"test"},{"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":590,"header":"@classmethod\n    def _find_end_card(cls, block, card_len)","id":1115,"name":"_find_end_card","nodeType":"Function","startLoc":547,"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: {0}; 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 {0} '\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"},{"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":1116,"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 arrays\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 = ['PAR{}'.format(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 = '{}{}'.format(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"},{"attributeType":"null","col":0,"comment":"null","endLoc":274,"id":1117,"name":"__bibtex__","nodeType":"Attribute","startLoc":274,"text":"__bibtex__"},{"attributeType":"null","col":0,"comment":"null","endLoc":280,"id":1118,"name":"log","nodeType":"Attribute","startLoc":280,"text":"log"},{"attributeType":"null","col":4,"comment":"null","endLoc":286,"id":1119,"name":"log","nodeType":"Attribute","startLoc":286,"text":"log"},{"attributeType":"null","col":0,"comment":"null","endLoc":319,"id":1120,"name":"__dir__","nodeType":"Attribute","startLoc":319,"text":"__dir__"},{"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 : str, file, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\n        ","endLoc":700,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def tofile(self, fileobj, sep='', endcard=True, padding=True,\n               overwrite=False)","id":1121,"name":"tofile","nodeType":"Function","startLoc":637,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : str, file, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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            if not fileobj.simulateonly:\n                fileobj.flush()\n                try:\n                    offset = fileobj.tell()\n                except (AttributeError, OSError):\n                    offset = 0\n                fileobj.write(blocks.encode('ascii'))\n                fileobj.flush()\n        finally:\n            if close_file:\n                fileobj.close()"},{"attributeType":"null","col":4,"comment":"null","endLoc":327,"id":1122,"name":"varname","nodeType":"Attribute","startLoc":327,"text":"varname"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":1123,"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\n__minimum_python_version__ = '3.5'\n\n__minimum_numpy_version__ = '1.10.0'\n\nif sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):\n    raise UnsupportedPythonError(\"Astropy does not support Python < {}\".format(__minimum_python_version__))\n\ntry:\n    _ASTROPY_SETUP_\nexcept NameError:\n    from sys import version_info\n    import builtins\n\n    # This will set the _ASTROPY_SETUP_ to True by default if\n    # we are running Astropy's setup.py\n    builtins._ASTROPY_SETUP_ = _is_astropy_setup()\n\ntry:\n    from .version import version as __version__\nexcept ImportError:\n    # TODO: Issue a warning using the logging framework\n    __version__ = ''\n\ntry:\n    from .version import githash as __githash__\nexcept ImportError:\n    # TODO: Issue a warning using the logging framework\n    __githash__ = ''\n\nif 'dev' in __version__:\n    online_docs_root = 'http://docs.astropy.org/en/latest/'\nelse:\n    online_docs_root = 'http://docs.astropy.org/en/{0}/'.format(__version__)\n\nif not _ASTROPY_SETUP_:\n    _check_numpy()\n\nconf = Conf()\n\ntest = TestRunner.make_test_runner_in(__path__[0])\n\n__bibtex__ = _get_bibtex()\n\nlog = logging.getLogger()\n\nif not _ASTROPY_SETUP_:\n    from .logger import _init_log, _teardown_log\n\n    log = _init_log()\n\n    _initialize_astropy()\n\n    from .utils.misc import find_api_page\n\n__dir__ = ['__version__', '__githash__', '__minimum_numpy_version__',\n           '__bibtex__', 'test', 'log', 'find_api_page', 'online_help',\n           'online_docs_root', 'conf']\n\nfor varname in dir():\n    if not ((varname.startswith('__') and varname.endswith('__')) or\n            varname in __dir__ 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__"},{"className":"_ValidHDU","col":0,"comment":"\n    Base class for all HDUs which are not corrupted.\n    ","endLoc":1503,"id":1124,"nodeType":"Class","startLoc":863,"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        # 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\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:`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 = \"'{}' card does not exist.\".format(keyword)\n            fix_text = \"Fixed by inserting a new '{}' card.\".format(keyword)\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 = (\"'{}' card at the wrong place \"\n                                \"(card {}).\".format(keyword, index))\n                    fix_text = (\"Fixed by moving it to the right place \"\n                                \"(card {}).\".format(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 = (\"'{}' card has invalid value '{}'.\".format(\n                            keyword, val))\n                    fix_text = (\"Fixed by setting a new value '{}'.\".format(\n                            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 = 'data unit checksum updated {}'.format(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\n        override_datasum : bool, optional\n           add the ``CHECKSUM`` card only\n\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 = 'HDU checksum updated {}'.format(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 {0}.\\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 {0}.\\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.tostring())"},{"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 arrays\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":1125,"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 arrays\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 = ['PAR{}'.format(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 = '{}{}'.format(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        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":717,"header":"@classmethod\n    def fromtextfile(cls, fileobj, endcard=False)","id":1126,"name":"fromtextfile","nodeType":"Function","startLoc":702,"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":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":622,"header":"def _unique_parnames(names)","id":1127,"name":"_unique_parnames","nodeType":"Function","startLoc":603,"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":"\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\n\n        See Also\n        --------\n        tofile\n        ","endLoc":738,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def totextfile(self, fileobj, endcard=False, overwrite=False)","id":1128,"name":"totextfile","nodeType":"Function","startLoc":719,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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":776,"header":"def __copy__(self)","id":1129,"name":"__copy__","nodeType":"Function","startLoc":775,"text":"def __copy__(self):\n        return self.copy()"},{"col":4,"comment":"null","endLoc":779,"header":"def __deepcopy__(self, *args, **kwargs)","id":1130,"name":"__deepcopy__","nodeType":"Function","startLoc":778,"text":"def __deepcopy__(self, *args, **kwargs):\n        return self.copy()"},{"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":810,"header":"@classmethod\n    def fromkeys(cls, iterable, value=None)","id":1131,"name":"fromkeys","nodeType":"Function","startLoc":781,"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":"Creates a column format from a Numpy record dtype format.","endLoc":225,"header":"@classmethod\n    def from_recformat(cls, recformat)","id":1132,"name":"from_recformat","nodeType":"Function","startLoc":221,"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":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\n            The value associated with the given keyword, or the default value\n            if the keyword is not in the header.\n        ","endLoc":836,"header":"def get(self, key, default=None)","id":1133,"name":"get","nodeType":"Function","startLoc":812,"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\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        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":924,"header":"def set(self, keyword, value=None, comment=None, before=None, after=None)","id":1134,"name":"set","nodeType":"Function","startLoc":838,"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 FITS format spec to record format spec.  Do the opposite if\n    reverse=True.\n    ","endLoc":2352,"header":"def _convert_format(format, reverse=False)","id":1135,"name":"_convert_format","nodeType":"Function","startLoc":2343,"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":2315,"header":"def _convert_record2fits(format)","id":1136,"name":"_convert_record2fits","nodeType":"Function","startLoc":2274,"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('Illegal format {}.'.format(format))\n\n    return output_format"},{"col":4,"comment":"null","endLoc":480,"header":"def __repr__(self)","id":1137,"name":"__repr__","nodeType":"Function","startLoc":477,"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":518,"header":"def __getitem__(self, key)","id":1138,"name":"__getitem__","nodeType":"Function","startLoc":482,"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._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"},{"fileName":"connect.py","filePath":"astropy/io/fits","id":1139,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport os\nimport re\nimport warnings\nfrom collections import OrderedDict\n\nfrom .. import registry as io_registry\nfrom ... import units as u\nfrom ...table import Table, serialize, meta, Column, MaskedColumn\nfrom ...table.table import has_info_class\nfrom ...time import Time\nfrom ...utils.exceptions import AstropyUserWarning\nfrom ...utils.data_info import MixinInfo, serialize_context_as\nfrom . import HDUList, TableHDU, BinTableHDU, GroupsHDU\nfrom .column import KEYWORD_NAMES\nfrom .convenience import table_to_hdu\nfrom .hdu.hdulist import fitsopen as fits_open\nfrom .util import first\n\n\n# FITS file signature as per RFC 4047\nFITS_SIGNATURE = (b\"\\x53\\x49\\x4d\\x50\\x4c\\x45\\x20\\x20\\x3d\\x20\\x20\\x20\\x20\\x20\"\n                  b\"\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\"\n                  b\"\\x20\\x54\")\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 object\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    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 ['format', '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):\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 object 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    \"\"\"\n\n    if isinstance(input, HDUList):\n\n        # Parse all table objects\n        tables = OrderedDict()\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                              \" table (hdu={0})\".format(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(\"No table found in hdu={0}\".format(hdu))\n\n        elif len(tables) == 1:\n            table = tables[first(tables)]\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(hdulist, hdu=hdu,\n                                   astropy_native=astropy_native)\n        finally:\n            hdulist.close()\n\n    # Check if table is masked\n    masked = any(col.null is not None for col in table.columns)\n\n    # TODO: in future, it may make more sense to do this column-by-column,\n    # rather than via the structured array.\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\n        # Set column data\n        if masked:\n            column = MaskedColumn(data=data[col.name], name=col.name, copy=False)\n            if col.null is not None:\n                column.set_fill_value(col.null)\n                column.mask[column.data == col.null] = True\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='silent')\n\n        columns.append(column)\n\n    # Create Table object\n    t = Table(columns, masked=masked, 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    # If PyYAML is not available then check to see if there are any mixin cols\n    # that *require* YAML serialization.  FITS already has support for Time,\n    # Quantity, so if those are the only mixins the proceed without doing the\n    # YAML bit, for backward compatibility (i.e. not requiring YAML to write\n    # Time or Quantity).  In this case other mixin column meta (e.g.\n    # description or meta) will be silently dropped, consistent with astropy <=\n    # 2.0 behavior.\n    try:\n        import yaml\n    except ImportError:\n        for col in tbl.itercols():\n            if (has_info_class(col, MixinInfo) and\n                    col.__class__ not in (u.Quantity, Time)):\n                raise TypeError(\"cannot write type {} column '{}' \"\n                                \"to FITS without PyYAML installed.\"\n                                .format(col.__class__.__name__, col.info.name))\n        else:\n            # Warn if information will be lost.  This is hardcoded to the set\n            # difference between column info attributes and what FITS can store\n            # natively (name, dtype, unit).  See _get_col_attributes() in\n            # table/meta.py for where this comes from.\n            for col in tbl.itercols():\n                if any(getattr(col.info, attr, None) not in (None, {})\n                       for attr in ('format', 'description', 'meta')):\n                    warnings.warn(\"table contains column(s) with defined 'format',\"\n                                  \" 'description', or 'meta' info attributes. These\"\n                                  \" will be dropped unless you install PyYAML.\",\n                                  AstropyUserWarning)\n                    break\n            return tbl\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    if encode_tbl is tbl:\n        return tbl\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    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        # 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):\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    \"\"\"\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        else:\n            raise OSError(\"File exists: {0}\".format(output))\n\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"},{"className":"_BaseHDU","col":0,"comment":"Base class for all HDU (header data unit) classes.","endLoc":716,"id":1140,"nodeType":"Class","startLoc":123,"text":"class _BaseHDU(metaclass=_BaseHDUMeta):\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    def __new__(cls, data=None, header=None, *args, **kwargs):\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\n        klass = _hdu_class_from_header(cls, header)\n        return super().__new__(klass)\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._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    @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 object or file-like object\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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 _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                header = Header.fromfile(data, 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        hdu = cls(data=DELAYED, header=header, **new_kwargs)\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        # 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_uint_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)\n\n    def _update_uint_scale_keywords(self):\n        \"\"\"\n        If the data is unsigned int 16, 32, or 64 add BSCALE/BZERO cards to\n        header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_unsigned(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', _unsigned_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_unsigned(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        if not fileobj.simulateonly:\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        else:\n            size = len(str(self._header))\n\n        return offset, size\n\n    def _writedata(self, fileobj):\n        # TODO: A lot of the simulateonly stuff should be moved back into the\n        # _File class--basically it should turn write and flush into a noop\n        offset = 0\n        size = 0\n\n        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except 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            if 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        if not fileobj.simulateonly:\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        if not fileobj.simulateonly:\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:\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":"\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        ","endLoc":151,"header":"def __new__(cls, data=None, header=None, *args, **kwargs)","id":1141,"name":"__new__","nodeType":"Function","startLoc":136,"text":"def __new__(cls, data=None, header=None, *args, **kwargs):\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\n        klass = _hdu_class_from_header(cls, header)\n        return super().__new__(klass)"},{"col":0,"comment":"\n    Used primarily by _BaseHDU.__new__ to find an appropriate HDU class to use\n    based on values in the header.  See the _BaseHDU.__new__ docstring.\n    ","endLoc":87,"header":"def _hdu_class_from_header(cls, header)","id":1142,"name":"_hdu_class_from_header","nodeType":"Function","startLoc":56,"text":"def _hdu_class_from_header(cls, header):\n    \"\"\"\n    Used primarily by _BaseHDU.__new__ to find an appropriate HDU class to use\n    based on values in the header.  See the _BaseHDU.__new__ docstring.\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: {0}'.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"},{"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":1735,"header":"def _relativeinsert(self, card, before=None, after=None, replace=False)","id":1143,"name":"_relativeinsert","nodeType":"Function","startLoc":1678,"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, int) 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)"},{"className":"Table","col":0,"comment":"A class to represent tables of heterogeneous data.\n\n    `Table` provides a class for heterogeneous tabular data, making use of a\n    `numpy` structured array internally to store the data values.  A key\n    enhancement provided by the `Table` class is the ability to easily modify\n    the 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    `Table` differs from `~astropy.nddata.NDData` by the assumption that the\n    input data consists of columns of homogeneous data, where each column\n    has a unique identifier and may contain additional metadata such as the\n    data unit, format, and description.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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    ","endLoc":2732,"id":1144,"nodeType":"Class","startLoc":184,"text":"class Table:\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `Table` provides a class for heterogeneous tabular data, making use of a\n    `numpy` structured array internally to store the data values.  A key\n    enhancement provided by the `Table` class is the ability to easily modify\n    the 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    `Table` differs from `~astropy.nddata.NDData` by the assumption that the\n    input data consists of columns of homogeneous data, where each column\n    has a unique identifier and may contain additional metadata such as the\n    data unit, format, and description.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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    meta = MetaData()\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    def as_array(self, keep_byteorder=False):\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        Returns\n        -------\n        table_array : np.ndarray (unmasked) or np.ma.MaskedArray (masked)\n            Copy of table as a numpy structured array\n        \"\"\"\n        if len(self.columns) == 0:\n            return None\n\n        sys_byteorder = ('>', '<')[sys.byteorder == 'little']\n        native_order = ('=', sys_byteorder)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        for col in cols:\n            col_descr = descr(col)\n            byteorder = col.info.dtype.byteorder\n\n            if not keep_byteorder and byteorder not in native_order:\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        empty_init = ma.empty if self.masked else np.empty\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        return data\n\n    def __init__(self, data=None, masked=None, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.meta = meta\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        # 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        is_list_of_dict = False\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if all(isinstance(row, dict) for row in rows):\n                is_list_of_dict = True  # Avoid doing the all(...) test twice.\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                rec_data = recarray_fromrecords(rows)\n                data = [rec_data[name] for name in rec_data.dtype.names]\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        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 (though the meta\n            # will be deep-copied anyway).\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) and\n                data.shape == (0,) and\n                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            init_func = self._init_from_list\n            if data and (is_list_of_dict or all(isinstance(row, dict) for row in data)):\n                n_cols = len(data[0])\n            else:\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            init_func = self._init_from_table\n            n_cols = len(data.colnames)\n            default_names = data.colnames\n            # don't copy indices if the input Table is in non-copy mode\n            self._init_indices = self._init_indices and data._copy_indices\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    return  # Empty table\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('Data type {0} not allowed to init Table'\n                             .format(type(data)))\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 names is None:\n            names = default_names or [None] * n_cols\n        if dtype is None:\n            dtype = [None] * n_cols\n\n        # Numpy does not support bytes column names on Python 3, so fix them\n        # up now.\n        names = [fix_column_name(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        # Whatever happens above, the masked property should be set to a boolean\n        if type(self.masked) is not bool:\n            raise TypeError(\"masked property has not been set to True or False\")\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:\n            mask_table = Table([col.mask for col in self.columns.values()],\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 a 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 : Table\n            New table with masked values filled\n        \"\"\"\n        if self.masked:\n            data = [col.filled(fill_value) for col in self.columns.values()]\n        else:\n            data = self\n        return self.__class__(data, meta=deepcopy(self.meta))\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            FastBST, and FastRBT. If the supplied argument is None (by\n            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 \"{0}\", of '\n                                 'type \"{1}\"'.format(col.info.name, type(col)))\n\n        index = Index(columns, engine=engine, unique=unique)\n        if not self.indices:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(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        return self.as_array().data if self.masked else self.as_array()\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('{0} must be a list or None'.format(inp_str))\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                .format(inp_str))\n\n    def _set_masked_from_cols(self, cols):\n        if self.masked is None:\n            if any(isinstance(col, (MaskedColumn, ma.MaskedArray)) for col in cols):\n                self._set_masked(True)\n            else:\n                self._set_masked(False)\n        elif not self.masked:\n            if any(np.any(col.mask) for col in cols if isinstance(col, (MaskedColumn, ma.MaskedArray))):\n                self._set_masked(True)\n\n    def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        cols = {}\n        for name in names_from_data:\n            cols[name] = []\n            for i, row in enumerate(data):\n                try:\n                    cols[name].append(row[name])\n                except KeyError:\n                    raise ValueError('Row {0} has no value for column {1}'.format(i, name))\n        if all(name is None for name in names):\n            names = sorted(names_from_data)\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n        return\n\n    def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of columns.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        if data and all(isinstance(row, dict) for row in data):\n            self._init_from_list_of_dicts(data, names, dtype, n_cols, copy)\n            return\n\n        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(data)\n\n        cols = []\n        def_names = _auto_names(n_cols)\n\n        for col, name, def_name, dtype in zip(data, names, def_names, dtype):\n            # Structured ndarray gets viewed as a mixin unless already a valid\n            # mixin class\n            if (isinstance(col, np.ndarray) and len(col.dtype) > 1 and\n                    not self._add_as_mixin_column(col)):\n                col = col.view(NdarrayMixin)\n\n            if isinstance(col, (Column, MaskedColumn)):\n                col = self.ColumnClass(name=(name or col.info.name or def_name),\n                                       data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            elif self._add_as_mixin_column(col):\n                # Copy the mixin column attributes if they exist since the copy below\n                # may not get this attribute.\n                if copy:\n                    col = col_copy(col, copy_indices=self._init_indices)\n\n                col.info.name = name or col.info.name or def_name\n            elif isinstance(col, np.ndarray) or isiterable(col):\n                col = self.ColumnClass(name=(name or def_name), data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            else:\n                raise ValueError('Elements in list initialization must be '\n                                 'either Column or list-like')\n\n            cols.append(col)\n\n        self._init_from_cols(cols)\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        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(cols)\n\n        if copy:\n            self._init_from_list(cols, names, dtype, n_cols, copy)\n        else:\n            dtype = [(name, col.dtype, col.shape[1:]) for name, col in zip(names, cols)]\n            newdata = data.view(dtype).ravel()\n            columns = self.TableColumns()\n\n            for name in names:\n                columns[name] = self.ColumnClass(name=name, data=newdata[name])\n                columns[name].info.parent_table = self\n            self.columns = columns\n\n    def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        # TODO: is this restriction still needed with no ndarray?\n        if not copy:\n            raise ValueError('Cannot use copy=False with a dict data input')\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 _init_from_table(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an existing Table object \"\"\"\n\n        table = data  # data is really a Table, rename for clarity\n        self.meta.clear()\n        self.meta.update(deepcopy(table.meta))\n        self.primary_key = table.primary_key\n        cols = list(table.columns.values())\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)\n\n    def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct 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 col.__class__ is not self.ColumnClass and isinstance(col, Column):\n            col = self.ColumnClass(col)  # copy attributes and reference data\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('Inconsistent data column lengths: {0}'\n                             .format(lengths))\n\n        # Set the table masking\n        self._set_masked_from_cols(cols)\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        table.meta.clear()\n        table.meta.update(deepcopy(self.meta))\n        table.primary_key = self.primary_key\n        cols = self.columns.values()\n\n        newcols = []\n        for col in cols:\n            col.info._copy_indices = self._copy_indices\n            newcol = col[slice_]\n            if col.info.indices:\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n            newcols.append(newcol)\n            col.info._copy_indices = True\n\n        self._make_table_from_cols(table, newcols)\n        return table\n\n    @staticmethod\n    def _make_table_from_cols(table, cols):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        colnames = set(col.info.name for col in cols)\n        if None in colnames:\n            raise TypeError('Cannot have None for column name')\n        if len(colnames) != len(cols):\n            raise ValueError('Duplicate column names')\n\n        columns = table.TableColumns((col.info.name, col) for col in cols)\n\n        for col in cols:\n            col.info.parent_table = table\n            if table.masked and not hasattr(col, 'mask'):\n                col.mask = FalseArray(col.shape)\n\n        table.columns = columns\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('length={0}'.format(len(self)))\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from ..utils.xml.writer import xml_escape\n            descr = '<i>{0}</i>\\n'.format(xml_escape(descr))\n        else:\n            descr = '<{0}>\\n'.format(descr)\n\n        if tableid is None:\n            tableid = 'table{id}'.format(id=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        return self._base_repr_(html=True, max_width=-1,\n                                tableclass=conf.default_notebook_table_class)\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    def _add_as_mixin_column(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 not Quantity (which gets converted to Column with\n        # unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)\n\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        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        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        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('Length = {0} rows'.format(len(self)))\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    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] + 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 <http://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : string\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 = 'table{0}-{1}'.format(id(self),\n                                            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.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 : string\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(\"Browser '{}' not found.\".format(browser))\n        else:\n            br.open(urljoin('file:', pathname2url(path)))\n\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        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\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('Length = {0} rows'.format(len(self)))\n\n        return lines\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 (isinstance(item, (tuple, list)) and item and\n              all(isinstance(x, str) for x in item)):\n            bad_names = [x for x in item if x not in self.colnames]\n            if bad_names:\n                raise ValueError('Slice name(s) {0} not valid column name(s)'\n                                 .format(', '.join(bad_names)))\n            out = self.__class__([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        elif ((isinstance(item, np.ndarray) and item.size == 0) or\n              (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) or\n              isinstance(item, np.ndarray) or\n              isinstance(item, list) or\n              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('Illegal type {0} for table item access'\n                             .format(type(item)))\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            NewColumn = self.MaskedColumn if self.masked else self.Column\n            # If value doesn't have a dtype and won't be added as a mixin then\n            # convert to a numpy array.\n            if not hasattr(value, 'dtype') and not self._add_as_mixin_column(value):\n                value = np.asarray(value)\n\n            # Structured ndarray gets viewed as a mixin (unless already a valid\n            # mixin class).\n            if (isinstance(value, np.ndarray) and len(value.dtype) > 1 and\n                    not self._add_as_mixin_column(value)):\n                value = value.view(NdarrayMixin)\n\n            # Make new column and assign the value.  If the table currently\n            # has no rows (len=0) of the value is already a Column then\n            # define new column directly from value.  In the latter case\n            # this allows for propagation of Column metadata.  Otherwise\n            # define a new column with the right length and shape and then\n            # set it from value.  This allows for broadcasting, e.g. t['a']\n            # = 1.\n            name = item\n            # If this is a column-like object that could be added directly to table\n            if isinstance(value, BaseColumn) or self._add_as_mixin_column(value):\n                # If we're setting a new column to a scalar, broadcast it.\n                # (things will fail in _init_from_cols if this doesn't work)\n                if (len(self) > 0 and (getattr(value, 'isscalar', False) or\n                                       getattr(value, 'shape', None) == () or\n                                       len(value) == 1)):\n                    new_shape = (len(self),) + getattr(value, 'shape', ())[1:]\n                    if isinstance(value, np.ndarray):\n                        value = np.broadcast_to(value, shape=new_shape,\n                                                subok=True)\n                    elif isinstance(value, ShapedLikeNDArray):\n                        value = value._apply(np.broadcast_to, shape=new_shape,\n                                             subok=True)\n\n                new_column = col_copy(value)\n                new_column.info.name = name\n\n            elif len(self) == 0:\n                new_column = NewColumn(value, name=name)\n            else:\n                new_column = NewColumn(name=name, length=len(self), dtype=value.dtype,\n                                       shape=value.shape[1:],\n                                       unit=getattr(value, 'unit', None))\n                new_column[:] = value\n\n            # Now add new column to the table\n            self.add_columns([new_column], copy=False)\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                # Set the corresponding row assuming value is an iterable.\n                if not hasattr(value, '__len__'):\n                    raise TypeError('Right side value must be iterable')\n\n                if len(value) != n_cols:\n                    raise ValueError('Right side value needs {0} elements (one for each column)'\n                                     .format(n_cols))\n\n                for col, val in zip(self.columns.values(), value):\n                    col[item] = val\n\n            elif (isinstance(item, slice) or\n                  isinstance(item, np.ndarray) or\n                  isinstance(item, list) or\n                  (isinstance(item, tuple) and  # output from np.where\n                   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                    import itertools\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 {0} 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('Illegal type {0} for table item access'\n                                 .format(type(item)))\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)) and\n              all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray)) and\n              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 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 hasattr(self, '_masked'):\n            # The only allowed change is from None to False or True, or False to True\n            if self._masked is None and masked in [False, True]:\n                self._masked = masked\n            elif self._masked is False and masked is True:\n                log.info(\"Upgrading Table to masked Table. Use Table.filled() to convert to unmasked table.\")\n                self._masked = masked\n            elif self._masked is masked:\n                raise Exception(\"Masked attribute is already set to {0}\".format(masked))\n            else:\n                raise Exception(\"Cannot change masked attribute to {0} once it is set to {1}\"\n                                .format(masked, self._masked))\n        else:\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        if self._masked:\n            self._column_class = self.MaskedColumn\n        else:\n            self._column_class = 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    def keys(self):\n        return list(self.columns.keys())\n\n    def __len__(self):\n        if len(self.columns) == 0:\n            return 0\n\n        lengths = set(len(col) for col in self.columns.values())\n        if len(lengths) != 1:\n            len_strs = [' {0} : {1}'.format(name, len(col)) for name, col in self.columns.items()]\n            raise ValueError('Column length mismatch:\\n{0}'.format('\\n'.join(len_strs)))\n\n        return lengths.pop()\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(\"Column {0} does not exist\".format(name))\n\n    def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True):\n        \"\"\"\n        Add a new Column object ``col`` to the table.  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        Parameters\n        ----------\n        col : Column\n            Column object to add.\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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create a third column 'c' and append it to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\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              3 0.3   z\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> col_d = Column(name='d', data=['a', 'b', 'c'])\n            >>> t.add_column(col_d, 1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n              3   c 0.3   z\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> t.add_column(col_b, rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.2\n              3 0.3 1.3\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            >>> col_c = Column(data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> t.add_column(col_c, name='c')\n            >>> col_b = Column(name='b', data=[1.1, 1.2])\n            >>> t.add_column(col_b, name='d')\n            >>> print(t)\n             a   b  col2  c   d\n            --- --- ---- --- ---\n              1 0.1    x   x 1.1\n              2 0.2    y   y 1.2\n\n        To add several columns use add_columns.\n        \"\"\"\n        if index is None:\n            index = len(self.columns)\n        if name is not None:\n            name = (name,)\n\n        self.add_columns([col], [index], name, copy=copy, rename_duplicate=rename_duplicate)\n\n    def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new Column objects ``cols`` to the table.  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        Parameters\n        ----------\n        cols : list of Columns\n            Column objects to add.\n        indexes : list of ints 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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create column 'c' and 'd' and append them to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\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              3 0.3   z   w\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, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\n            >>> t.add_columns([col_c, col_d], [0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n              z   3   w 0.3\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> t.add_columns([col_b, col_c], 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              3 0.3 1.3  z\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_a = Column(data=['x', 'y'])\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([col_a, col_b])\n            >>> t.add_columns([col_a, col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               x   u   x   u\n               y   v   y   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 copy:\n            cols = [col_copy(col) for col in cols]\n\n        if len(self.columns) == 0:\n            # No existing table data, init from cols\n            newcols = cols\n        else:\n            newcols = list(self.columns.values())\n            new_indexes = list(range(len(newcols) + 1))\n            for col, index in zip(cols, indexes):\n                i = new_indexes.index(index)\n                new_indexes.insert(i, None)\n                newcols.insert(i, col)\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        for i, (col, name) in enumerate(zip(cols, names)):\n            if name is None:\n                if col.info.name is not None:\n                    continue\n                name = 'col{}'.format(i + len(self.columns))\n            if col.info.parent_table is not None:\n                col = col_copy(col)\n            col.info.name = name\n\n        if rename_duplicate:\n            existing_names = set(self.colnames)\n            for col in cols:\n                i = 1\n                orig_name = col.info.name\n                while col.info.name in existing_names:\n                    # If the column belongs to another table then copy it\n                    # before renaming\n                    if col.info.parent_table is not None:\n                        col = col_copy(col)\n                    new_name = '{0}_{1}'.format(orig_name, i)\n                    col.info.name = new_name\n                    i += 1\n                existing_names.add(new_name)\n\n        self._init_from_cols(newcols)\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\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(\"replaced column '{}'\".format(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):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : column object (list, ndarray, Column, etc)\n            New column object to replace the existing column\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('column name {0} is not in the table'.format(name))\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        t = self.__class__([col], names=[name])\n        cols = OrderedDict(self.columns)\n        cols[name] = t[name]\n        self._init_from_cols(cols.values())\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, int, or array of ints\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 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 : list\n            A list containing the 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        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        for name in names:\n            self.columns.pop(name)\n\n    def _convert_string_dtype(self, in_kind, out_kind):\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        # If there are no `in_kind` columns then do nothing\n        cols = self.columns.values()\n        if not any(col.dtype.kind == in_kind for col in cols):\n            return\n\n        newcols = []\n        for col in cols:\n            if col.dtype.kind == in_kind:\n                newdtype = re.sub(in_kind, out_kind, col.dtype.str)\n                newcol = col.__class__(col, dtype=newdtype)\n            else:\n                newcol = col\n            newcols.append(newcol)\n\n        self._init_from_cols(newcols)\n\n    def convert_bytestring_to_unicode(self, python3_only=NoValue):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U') assuming\n        ASCII 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        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('S', 'U')\n\n    def convert_unicode_to_bytestring(self, python3_only=NoValue):\n        \"\"\"\n        Convert ASCII-only unicode columns (dtype.kind='U') to bytestring (dtype.kind='S').\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.  This routine takes\n        advantage of numpy automated conversion which works for strings that\n        are pure ASCII.\n        \"\"\"\n        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('U', 'S')\n\n    def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to keep. All other\n            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        Specifying only a single column name keeps only this column.\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        Specifying a list of column names is keeps is also possible.\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\n        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        remove = list(set(self.keys()) - set(names))\n\n        self.remove_columns(remove)\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(\"Column {0} does not exist\".format(name))\n\n        self.columns[name].info.name = new_name\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 {0} is out of bounds for table with length {1}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        def _is_mapping(obj):\n            \"\"\"Minimal checker for mapping (dict-like) interface for obj\"\"\"\n            attrs = ('__getitem__', '__len__', '__iter__', 'keys', 'values', 'items')\n            return all(hasattr(obj, attr) for attr in attrs)\n\n        if mask is not None and not self.masked:\n            # Possibly issue upgrade warning and update self.ColumnClass.  This\n            # does not change the existing columns.\n            self._set_masked(True)\n\n        if _is_mapping(vals) 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 _is_mapping(mask):\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(\"Value must be supplied for column '{0}'\".format(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 _is_mapping(mask)):\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        columns = self.TableColumns()\n        try:\n            # Insert val at index for each column\n            for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n                # If the new row caused a change in self.ColumnClass then\n                # Column-based classes need to be converted first.  This is\n                # typical for adding a row with mask values to an unmasked table.\n                if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n                    col = self.ColumnClass(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n                if not isinstance(newcol, BaseColumn):\n                    newcol.info.name = name\n                    if self.masked:\n                        newcol.mask = FalseArray(newcol.shape)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {0} after inserting {1}'\n                                     ' (expected {2}, got {3})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed\n                if self.masked:\n                    newcol.mask[index] = mask_\n\n                columns[name] = newcol\n\n            # insert row in indices\n            for table_index in self.indices:\n                table_index.insert_row(index, vals, self.columns.values())\n\n        except Exception as err:\n            raise ValueError(\"Unable to insert row because of exception in column '{0}':\\n{1}\"\n                             .format(name, err))\n        else:\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 argsort(self, keys=None, kind=None):\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'}, optional\n            Sorting algorithm.\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, self[keys])\n            if index is not None:\n                return index.sorted_data()\n\n        kwargs = {}\n        if keys:\n            kwargs['order'] = keys\n        if kind:\n            kwargs['kind'] = kind\n\n        if keys:\n            data = self[keys].as_array()\n        else:\n            data = self.as_array()\n\n        return data.argsort(**kwargs)\n\n    def sort(self, keys=None):\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\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        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)\n        sort_index = get_index(self, self[keys])\n        if sort_index is not None:\n            # avoid inefficient relabelling of sorted index\n            prev_frozen = sort_index._frozen\n            sort_index._frozen = True\n\n        for col in self.columns.values():\n            col[:] = col.take(indexes, axis=0)\n\n        if sort_index is not None:\n            # undo index freeze\n            sort_index._frozen = prev_frozen\n            # now relabel the sort index appropriately\n            sort_index.sort()\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            col[:] = col[::-1]\n        for index in self.indices:\n            index.reverse()\n\n    @classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).\n        \"\"\"\n        out = io_registry.read(cls, *args, **kwargs)\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 {0} '\n                                'class.'.format(cls.__name__))\n        return out\n\n    def write(self, *args, **kwargs):\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.write`).\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)\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\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.masked:\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 __ne__(self, other):\n        return ~self.__eq__(other)\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\n        unique values of the ``keys`` grouping object.  The output is a new\n        `TableGroups` which contains a copy of this table but sorted by row\n        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          - `Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `Table`\n            New table with groups set\n        \"\"\"\n        if self.has_mixin_columns:\n            raise NotImplementedError('group_by not available for tables with mixin columns')\n\n        return groups.table_group_by(self, keys)\n\n    def to_pandas(self):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\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 contains mixin or multi-dimensional columns\n        \"\"\"\n        from pandas import DataFrame\n\n        if self.has_mixin_columns:\n            raise ValueError(\"Cannot convert a table with mixin columns to a pandas DataFrame\")\n\n        if any(getattr(col, 'ndim', 1) > 1 for col in self.columns.values()):\n            raise ValueError(\"Cannot convert a table with multi-dimensional columns to a pandas DataFrame\")\n\n        out = OrderedDict()\n\n        for name, column in self.columns.items():\n            if isinstance(column, MaskedColumn):\n                if column.dtype.kind in ['i', 'u']:\n                    out[name] = column.astype(float).filled(np.nan)\n                elif column.dtype.kind in ['f', 'c']:\n                    out[name] = column.filled(np.nan)\n                else:\n                    out[name] = column.astype(object).filled(np.nan)\n            else:\n                out[name] = column\n\n            if out[name].dtype.byteorder not in ('=', '|'):\n                out[name] = out[name].byteswap().newbyteorder()\n\n        return DataFrame(out)\n\n    @classmethod\n    def from_pandas(cls, dataframe):\n        \"\"\"\n        Create a `Table` from a :class:`pandas.DataFrame` instance\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            The pandas :class:`pandas.DataFrame` instance\n\n        Returns\n        -------\n        table : `Table`\n            A `Table` (or subclass) instance\n        \"\"\"\n\n        out = OrderedDict()\n\n        for name in dataframe.columns:\n            column = dataframe[name]\n            mask = np.array(column.isnull())\n            data = np.array(column)\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            if np.any(mask):\n                out[name] = MaskedColumn(data=data, name=name, mask=mask)\n            else:\n                out[name] = Column(data=data, name=name)\n\n        return cls(out)\n\n    info = TableInfo()"},{"col":4,"comment":"null","endLoc":209,"header":"def __array_finalize__(self, obj)","id":1146,"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":"Like :meth:`dict.items`.","endLoc":930,"header":"def items(self)","id":1147,"name":"items","nodeType":"Function","startLoc":926,"text":"def items(self):\n        \"\"\"Like :meth:`dict.items`.\"\"\"\n\n        for card in self._cards:\n            yield (card.keyword, card.value)"},{"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        Returns\n        -------\n        table_array : np.ndarray (unmasked) or np.ma.MaskedArray (masked)\n            Copy of table as a numpy structured array\n        ","endLoc":277,"header":"def as_array(self, keep_byteorder=False)","id":1148,"name":"as_array","nodeType":"Function","startLoc":232,"text":"def as_array(self, keep_byteorder=False):\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        Returns\n        -------\n        table_array : np.ndarray (unmasked) or np.ma.MaskedArray (masked)\n            Copy of table as a numpy structured array\n        \"\"\"\n        if len(self.columns) == 0:\n            return None\n\n        sys_byteorder = ('>', '<')[sys.byteorder == 'little']\n        native_order = ('=', sys_byteorder)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        for col in cols:\n            col_descr = descr(col)\n            byteorder = col.info.dtype.byteorder\n\n            if not keep_byteorder and byteorder not in native_order:\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        empty_init = ma.empty if self.masked else np.empty\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        return data"},{"col":4,"comment":"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        ","endLoc":938,"header":"def keys(self)","id":1149,"name":"keys","nodeType":"Function","startLoc":932,"text":"def keys(self):\n        \"\"\"\n        Like :meth:`dict.keys`--iterating directly over the `Header`\n        instance has the same behavior.\n        \"\"\"\n\n        return self.__iter__()"},{"col":4,"comment":"Like :meth:`dict.values`.","endLoc":944,"header":"def values(self)","id":1150,"name":"values","nodeType":"Function","startLoc":940,"text":"def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for _, v in self.items():\n            yield v"},{"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":969,"header":"def pop(self, *args)","id":1151,"name":"pop","nodeType":"Function","startLoc":946,"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('Header.pop expected at most 2 arguments, got '\n                            '{}'.format(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":979,"header":"def popitem(self)","id":1152,"name":"popitem","nodeType":"Function","startLoc":971,"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":"null","endLoc":215,"header":"def __getitem__(self, key)","id":1153,"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":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":58,"header":"def descr(col)","id":1154,"name":"descr","nodeType":"Function","startLoc":50,"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":4,"comment":"Similar to :meth:`dict.setdefault`.","endLoc":988,"header":"def setdefault(self, key, default=None)","id":1155,"name":"setdefault","nodeType":"Function","startLoc":981,"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":1098,"header":"def update(self, *args, **kwargs)","id":1156,"name":"update","nodeType":"Function","startLoc":990,"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 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":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":1157,"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])"},{"col":4,"comment":"\n        A view of a `Column`'s data as an array.\n        ","endLoc":715,"header":"def field(self, key)","id":1158,"name":"field","nodeType":"Function","startLoc":667,"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":"null","endLoc":417,"header":"def __getstate__(self)","id":1159,"name":"__getstate__","nodeType":"Function","startLoc":414,"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":0,"comment":"\n    Convert FITS format spec to record format spec.\n    ","endLoc":2271,"header":"def _convert_fits2record(format)","id":1160,"name":"_convert_fits2record","nodeType":"Function","startLoc":2236,"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('Illegal format {}.'.format(format))\n\n    return output_format"},{"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":817,"header":"def _convert_p(self, column, field, recformat)","id":1161,"name":"_convert_p","nodeType":"Function","startLoc":777,"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":"null","endLoc":421,"header":"def __setstate__(self, state)","id":1163,"name":"__setstate__","nodeType":"Function","startLoc":419,"text":"def __setstate__(self, state):\n        columns, meta = state\n        self.__init__(columns, meta=meta)"},{"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":1023,"header":"def _get_raw_data(self)","id":1164,"name":"_get_raw_data","nodeType":"Function","startLoc":1001,"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":"\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":1309,"header":"def count(self, keyword)","id":1165,"name":"count","nodeType":"Function","startLoc":1290,"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(\"Keyword {!r} not found.\".format(keyword))\n\n        return len(self._keyword_indices[keyword])"},{"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":1470,"header":"def remove(self, keyword, ignore_missing=False, remove_all=False)","id":1166,"name":"remove","nodeType":"Function","startLoc":1444,"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(\"Keyword '{}' not found.\".format(keyword))"},{"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":1509,"header":"def rename_keyword(self, oldkeyword, newkeyword, force=False)","id":1167,"name":"rename_keyword","nodeType":"Function","startLoc":1472,"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('Intended keyword {} already exists in header.'\n                            .format(newkeyword))\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        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":1527,"header":"def add_history(self, value, before=None, after=None)","id":1168,"name":"add_history","nodeType":"Function","startLoc":1511,"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":"\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":1901,"header":"def _add_commentary(self, key, value, before=None, after=None)","id":1169,"name":"_add_commentary","nodeType":"Function","startLoc":1888,"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":"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":985,"header":"def _convert_other(self, column, field, recformat)","id":1170,"name":"_convert_other","nodeType":"Function","startLoc":860,"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{0:d}. \"\n                            \"Returning unscaled data.\".format(indx + 1))\n                    else:\n                        field = test_overflow\n                else:\n                    field += bzero\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 = ('|{}{}'.format(fmt, dim[-1]), dim[:-1])\n                field.dtype = dtype\n            else:\n                field.shape = (field.shape[0],) + dim\n\n        return field"},{"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":1545,"header":"def add_comment(self, value, before=None, after=None)","id":1171,"name":"add_comment","nodeType":"Function","startLoc":1529,"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":1563,"header":"def add_blank(self, value='', before=None, after=None)","id":1172,"name":"add_blank","nodeType":"Function","startLoc":1547,"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":"\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":1676,"header":"def _keyword_from_index(self, idx)","id":1173,"name":"_keyword_from_index","nodeType":"Function","startLoc":1659,"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":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":1886,"header":"def _strip(self)","id":1174,"name":"_strip","nodeType":"Function","startLoc":1840,"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        if 'NAXIS' in self:\n            naxis = self['NAXIS']\n        else:\n            naxis = 0\n\n        if 'TFIELDS' in self:\n            tfields = self['TFIELDS']\n        else:\n            tfields = 0\n\n        for idx in range(naxis):\n            try:\n                del self['NAXIS' + str(idx + 1)]\n            except KeyError:\n                pass\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                try:\n                    del self[name + str(idx + 1)]\n                except KeyError:\n                    pass\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            try:\n                del self[name]\n            except KeyError:\n                pass"},{"col":4,"comment":"Convert a raw table column to a bit array as specified by the\n        FITS X format.\n        ","endLoc":775,"header":"def _convert_x(self, field, recformat)","id":1175,"name":"_convert_x","nodeType":"Function","startLoc":768,"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":"null","endLoc":179,"header":"@property\n    def header(self)","id":1176,"name":"header","nodeType":"Function","startLoc":177,"text":"@property\n    def header(self):\n        return self._header"},{"col":4,"comment":"null","endLoc":183,"header":"@header.setter\n    def header(self, value)","id":1177,"name":"header","nodeType":"Function","startLoc":181,"text":"@header.setter\n    def header(self, value):\n        self._header = value"},{"col":4,"comment":"null","endLoc":189,"header":"@property\n    def name(self)","id":1178,"name":"name","nodeType":"Function","startLoc":185,"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))"},{"attributeType":"null","col":8,"comment":"null","endLoc":746,"id":1179,"name":"_keyword_indices","nodeType":"Attribute","startLoc":746,"text":"self._keyword_indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":747,"id":1180,"name":"_rvkc_indices","nodeType":"Attribute","startLoc":747,"text":"self._rvkc_indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":745,"id":1181,"name":"_cards","nodeType":"Attribute","startLoc":745,"text":"self._cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":1182,"name":"_modified","nodeType":"Attribute","startLoc":108,"text":"self._modified"},{"col":4,"comment":"null","endLoc":200,"header":"@name.setter\n    def name(self, value)","id":1183,"name":"name","nodeType":"Function","startLoc":191,"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":204,"header":"@property\n    def ver(self)","id":1184,"name":"ver","nodeType":"Function","startLoc":202,"text":"@property\n    def ver(self):\n        return self._header.get('EXTVER', 1)"},{"col":4,"comment":"null","endLoc":213,"header":"@ver.setter\n    def ver(self, value)","id":1185,"name":"ver","nodeType":"Function","startLoc":206,"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":217,"header":"@property\n    def level(self)","id":1186,"name":"level","nodeType":"Function","startLoc":215,"text":"@property\n    def level(self):\n        return self._header.get('EXTLEVEL', 1)"},{"col":4,"comment":"null","endLoc":226,"header":"@level.setter\n    def level(self, value)","id":1187,"name":"level","nodeType":"Function","startLoc":219,"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":"Get all the scaling flags and factors for one column.","endLoc":1050,"header":"def _get_scale_factors(self, column)","id":1188,"name":"_get_scale_factors","nodeType":"Function","startLoc":1025,"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":"null","endLoc":235,"header":"@property\n    def is_image(self)","id":1189,"name":"is_image","nodeType":"Function","startLoc":228,"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":239,"header":"@property\n    def _data_loaded(self)","id":1190,"name":"_data_loaded","nodeType":"Function","startLoc":237,"text":"@property\n    def _data_loaded(self):\n        return ('data' in self.__dict__ and self.data is not DELAYED)"},{"col":4,"comment":"null","endLoc":243,"header":"@property\n    def _has_data(self)","id":1191,"name":"_has_data","nodeType":"Function","startLoc":241,"text":"@property\n    def _has_data(self):\n        return self._data_loaded and self.data is not None"},{"col":4,"comment":"null","endLoc":247,"header":"@classmethod\n    def register_hdu(cls, hducls)","id":1192,"name":"register_hdu","nodeType":"Function","startLoc":245,"text":"@classmethod\n    def register_hdu(cls, hducls):\n        cls._hdu_registry.add(hducls)"},{"col":4,"comment":"null","endLoc":252,"header":"@classmethod\n    def unregister_hdu(cls, hducls)","id":1193,"name":"unregister_hdu","nodeType":"Function","startLoc":249,"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":256,"header":"@classmethod\n    def match_header(cls, header)","id":1194,"name":"match_header","nodeType":"Function","startLoc":254,"text":"@classmethod\n    def match_header(cls, header):\n        raise NotImplementedError"},{"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":295,"header":"@classmethod\n    def fromstring(cls, data, checksum=False, ignore_missing_end=False,\n                   **kwargs)","id":1195,"name":"fromstring","nodeType":"Function","startLoc":258,"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":"null","endLoc":437,"header":"@property\n    def mask(self)","id":1196,"name":"mask","nodeType":"Function","startLoc":423,"text":"@property\n    def mask(self):\n        # Dynamic view of available masks\n        if self.masked:\n            mask_table = Table([col.mask for col in self.columns.values()],\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":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":460,"header":"@classmethod\n    def _readfrom_internal(cls, data, header=None, checksum=False,\n                           ignore_missing_end=False, **kwargs)","id":1197,"name":"_readfrom_internal","nodeType":"Function","startLoc":375,"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                header = Header.fromfile(data, 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        hdu = cls(data=DELAYED, header=header, **new_kwargs)\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        # 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":4,"comment":"null","endLoc":441,"header":"@mask.setter\n    def mask(self, val)","id":1198,"name":"mask","nodeType":"Function","startLoc":439,"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":448,"header":"@property\n    def _mask(self)","id":1199,"name":"_mask","nodeType":"Function","startLoc":443,"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":"\n        Special handling for ASCII table columns to convert columns containing\n        numeric types to actual numeric arrays from the string representation.\n        ","endLoc":858,"header":"def _convert_ascii(self, column, field)","id":1200,"name":"_convert_ascii","nodeType":"Function","startLoc":819,"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 = 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 conerted 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":4,"comment":"Return a 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 : Table\n            New table with masked values filled\n        ","endLoc":472,"header":"def filled(self, fill_value=None)","id":1201,"name":"filled","nodeType":"Function","startLoc":450,"text":"def filled(self, fill_value=None):\n        \"\"\"Return a 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 : Table\n            New table with masked values filled\n        \"\"\"\n        if self.masked:\n            data = [col.filled(fill_value) for col in self.columns.values()]\n        else:\n            data = self\n        return self.__class__(data, meta=deepcopy(self.meta))"},{"col":4,"comment":"\n        Return the indices associated with columns of the table\n        as a TableIndices object.\n        ","endLoc":485,"header":"@property\n    def indices(self)","id":1202,"name":"indices","nodeType":"Function","startLoc":474,"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":"Returns the equivalent Numpy record format string.","endLoc":231,"header":"@lazyproperty\n    def recformat(self)","id":1203,"name":"recformat","nodeType":"Function","startLoc":227,"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":248,"header":"@lazyproperty\n    def canonical(self)","id":1204,"name":"canonical","nodeType":"Function","startLoc":233,"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 '{}{}{}'.format(repeat, self.format, self.option)"},{"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":734,"id":1205,"nodeType":"Class","startLoc":152,"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 \"{0}\" and \"{1}\"'\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 : `~astropy.units.UnitBase` object 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.\")\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` 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        lon = Longitude(lon, u.degree, wrap_angle=180*u.degree, copy=False)\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        # convert to float in units required for erfa routine, and ensure\n        # all broadcast to same shape, and are at least 1-dimensional.\n        _lon, _lat, _height = np.broadcast_arrays(lon.to_value(u.radian),\n                                                  lat.to_value(u.radian),\n                                                  height.to_value(u.m))\n        # get geocentric coordinates. Have to give one-dimensional array.\n        xyz = erfa.gd2gc(getattr(erfa, ellipsoid), _lon.ravel(),\n                                 _lat.ravel(), _height.ravel())\n        self = xyz.view(cls._location_dtype, cls).reshape(_lon.shape)\n        self._unit = u.meter\n        self._ellipsoid = ellipsoid\n        return self.to(height.unit)\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        .. 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 : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the observatory.\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"\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', close_names=e.close_names)\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):\n        \"\"\"\n        Return an object of this class for a given address by querying the Google\n        maps geocoding API.\n\n        This is intended as a quick convenience function to get fast access to\n        locations. In the background, this just issues a query to the Google maps\n        geocoding API. It is not meant to be abused! Google uses IP-based query\n        limiting and will ban your IP if you send more than a few thousand queries\n        per hour [1]_.\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** returned\n            location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API, this\n            can be a fully specified street address (e.g., 123 Main St., New York,\n            NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool (optional)\n            Use the retrieved location to perform a second query to the Google maps\n            elevation API to retrieve the height of the input address [2]_.\n\n        Returns\n        -------\n        location : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the input address.\n\n        References\n        ----------\n        .. [1] https://developers.google.com/maps/documentation/geocoding/intro\n        .. [2] https://developers.google.com/maps/documentation/elevation/intro\n\n        \"\"\"\n\n        pars = urllib.parse.urlencode({'address': address})\n        geo_url = \"https://maps.googleapis.com/maps/api/geocode/json?{0}\".format(pars)\n\n        # get longitude and latitude location\n        err_str = (\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n                   .format(address=address))\n        geo_result = _get_json_result(geo_url, err_str=err_str)\n        loc = geo_result[0]['geometry']['location']\n\n        if get_height:\n            pars = {'locations': '{lat:.8f},{lng:.8f}'.format(lat=loc['lat'],\n                                                              lng=loc['lng'])}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = \"https://maps.googleapis.com/maps/api/elevation/json?{0}\".format(pars)\n\n            err_str = (\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n                       .format(address=address))\n            ele_result = _get_json_result(ele_url, err_str=err_str)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=loc['lng']*u.degree,\n                                 lat=loc['lat']*u.degree,\n                                 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        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) : tuple\n            The tuple contains 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        self_array = self.to(u.meter).view(self._array_dtype, np.ndarray)\n        lon, lat, height = erfa.gc2gd(getattr(erfa, ellipsoid), self_array)\n        return GeodeticLocation(\n            Longitude(lon * u.radian, u.degree,\n                      wrap_angle=180.*u.degree, copy=False),\n            Latitude(lat * u.radian, u.degree, copy=False),\n            u.Quantity(height * u.meter, self.unit, copy=False))\n\n    @property\n    @deprecated('2.0', alternative='`lon`', obj_type='property')\n    def longitude(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]\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    @deprecated('2.0', alternative='`lat`', obj_type='property')\n    def latitude(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]\n\n    @property\n    def lat(self):\n        \"\"\"Longitude 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.size > 1:\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\n        itrs = self.get_itrs(obstime)\n        # Assume the observatory itself is fixed on the ground.\n        # We do a direct assignment rather than an update to avoid validation\n        # and creation of a new object.\n        zeros = np.broadcast_to(0. * u.km / u.s, (3,) + itrs.shape, subok=True)\n        itrs.data.differentials['s'] = CartesianDifferential(zeros)\n        return itrs.transform_to(GCRS(obstime=obstime))\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        # GCRS position\n        gcrs_data = self._get_gcrs(obstime).data\n        obsgeopos = gcrs_data.without_differentials()\n        obsgeovel = gcrs_data.differentials['s'].to_cartesian()\n        return obsgeopos, obsgeovel\n\n    def _gravitational_redshift(self, obstime):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the Sun,\n        Jupiter, the Moon, and the Earth itself.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\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        names = ('sun', 'jupiter', 'moon', 'earth')\n        GM_moon = consts.G * 7.34767309e22*u.kg\n        masses = (consts.GM_sun, consts.GM_jup, GM_moon, consts.GM_earth)\n        positions = [get_body_barycentric(name, obstime) for name in names]\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(masses, distances)]\n        return sum(redshifts)\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    if NUMPY_LT_1_12:\n        def __repr__(self):\n            # Use the numpy >=1.12 way to format structured arrays.\n            from .representation import _array2string\n            prefixstr = '<' + self.__class__.__name__ + ' '\n            arrstr = _array2string(self.view(np.ndarray), prefix=prefixstr)\n            return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)"},{"attributeType":"None","col":12,"comment":"null","endLoc":218,"id":1206,"name":"p_format","nodeType":"Attribute","startLoc":218,"text":"self.p_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":206,"id":1207,"name":"repeat","nodeType":"Attribute","startLoc":206,"text":"self.repeat"},{"col":4,"comment":"null","endLoc":738,"header":"def __init__(self, lst)","id":1208,"name":"__init__","nodeType":"Function","startLoc":737,"text":"def __init__(self, lst):\n        super().__init__(lst)"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":1209,"name":"format","nodeType":"Attribute","startLoc":207,"text":"self.format"},{"attributeType":"null","col":8,"comment":"null","endLoc":205,"id":1210,"name":"self","nodeType":"Attribute","startLoc":205,"text":"self"},{"attributeType":"_FormatQ","col":16,"comment":"null","endLoc":214,"id":1211,"name":"recformat","nodeType":"Attribute","startLoc":214,"text":"recformat"},{"attributeType":"null","col":34,"comment":"null","endLoc":206,"id":1212,"name":"option","nodeType":"Attribute","startLoc":206,"text":"self.option"},{"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":312,"id":1213,"nodeType":"Class","startLoc":251,"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        # 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 '{}{}.{}'.format(self.format, self.width, self.precision)\n\n        return '{}{}'.format(self.format, self.width)"},{"col":4,"comment":"null","endLoc":284,"header":"@classmethod\n    def from_column_format(cls, format)","id":1214,"name":"from_column_format","nodeType":"Function","startLoc":278,"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        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 object or file-like object\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":333,"header":"@classmethod\n    def readfrom(cls, fileobj, checksum=False, ignore_missing_end=False,\n                 **kwargs)","id":1215,"name":"readfrom","nodeType":"Function","startLoc":297,"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 object or file-like object\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":"Creates a column format from a Numpy record dtype format.","endLoc":290,"header":"@classmethod\n    def from_recformat(cls, recformat)","id":1216,"name":"from_recformat","nodeType":"Function","startLoc":286,"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":2404,"header":"def _convert_ascii_format(format, reverse=False)","id":1217,"name":"_convert_ascii_format","nodeType":"Function","startLoc":2355,"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 [for the non-standard J format code just always force 64-bit]\n        if format == 'I' and width <= 4:\n            recformat = 'i2'\n        elif format == 'A':\n            recformat += str(width)\n\n        return recformat"},{"className":"Quantity","col":0,"comment":"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `Quantity` object (sequence), 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 : `~astropy.units.UnitBase` instance, str\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 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`.  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 http://docs.astropy.org/en/latest/units/\n\n    ","endLoc":1659,"id":1218,"nodeType":"Class","startLoc":199,"text":"class Quantity(np.ndarray, metaclass=InheritDocstrings):\n    \"\"\"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `Quantity` object (sequence), 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 : `~astropy.units.UnitBase` instance, str\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 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`.  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 http://docs.astropy.org/en/latest/units/\n\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 __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            # 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        # 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:\n                if not copy:\n                    return value\n\n                if not np.can_cast(np.float32, value.dtype):\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 \"{0}\" as a {1}. 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 and\n                  all(isinstance(v, Quantity) for v in value)):\n                # Convert all quantities 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\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 {0!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{1}\"\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=False, 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(() if value.ndim == 0 else 0),\n                            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 (not np.can_cast(np.float32, value.dtype)\n                              or value.dtype.kind == 'O'):\n            value = value.astype(float)\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        # 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.  Note that `obj` can be an\n        # ndarray which doesn't have a `__dict__`.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n\n    def __array_prepare__(self, obj, context=None):\n        # This method gets called by Numpy whenever a ufunc is called on the\n        # array. The object passed in ``obj`` is an empty version of the\n        # output array which we can e.g. change to an array sub-class, add\n        # attributes to, etc. After this is called, then the ufunc is called\n        # and the values in this empty array are set.\n\n        # In principle, this should not be needed any more in numpy >= 1.13,\n        # but it is still called in some np.linalg modules.\n\n        # If no context is set, just return the input\n        if context is None:\n            return obj\n\n        # Find out which ufunc is being used\n        function = context[0]\n        args = context[1][:function.nin]\n        # determine required converter 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\n        converters, result_unit = converters_and_unit(function, '__call__',\n                                                      *args)\n        if function.nout > 1:\n            result_unit = result_unit[context[2]]\n\n        # We now prepare the output object\n        if self is obj:\n            # this happens if the output object is self, which happens\n            # for in-place operations such as q1 += q2\n\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            # and that we can handle the type (e.g., that we are not int when\n            # float is required).\n            check_output(obj, result_unit, (args + tuple(\n                (np.float16 if converter and converter(1.) % 1. != 0.\n                 else np.int8)\n                for converter in converters)),\n                         function=function)\n            result = self  # no view needed since already a Quantity.\n\n            # in principle, if self is also an argument, it could be rescaled\n            # here, since it won't be needed anymore.  But maybe not change\n            # inputs before the calculation even if they will get destroyed\n\n        else:  # normal case: set up output as a Quantity\n\n            result = self._new_view(obj, result_unit)\n\n        # We now need to treat the case where the inputs have to be converted -\n        # the issue is that we can't actually convert the inputs since that\n        # would be changing the objects passed to the ufunc, which would not\n        # be expected by the user.\n        if any(converters):\n\n            # If self is both output and input (which happens for in-place\n            # operations), input will get overwritten with junk. To avoid\n            # that, hide it in a new object\n            if self is obj and any(self is arg for arg in args):\n                # but with two outputs it would become unhidden too soon\n                # [ie., np.modf(q1, q1, other)].  Bail.\n                if context[2] < function.nout - 1:\n                    raise TypeError(\"Cannot apply multi-output {0} function \"\n                                    \"to quantities with in-place replacement \"\n                                    \"of an input by any but the last output.\"\n                                    .format(function.__name__))\n\n                # If self is already contiguous, we don't need to do\n                # an additional copy back into the original array, so\n                # we store it in `result._result`.  Otherwise, we\n                # store it in `result._contiguous`.  `__array_wrap__`\n                # knows how to handle putting either form back into\n                # the original array.\n                if self.flags['C_CONTIGUOUS']:\n                    result = self.copy()\n                    result._result = self\n                else:\n                    result._contiguous = self.copy()\n\n            # ensure we remember the converter functions we need\n            result._converters = converters\n\n            if function in _UFUNCS_FILTER_WARNINGS:\n                # Filter out RuntimeWarning's caused by the ufunc being called on\n                # the unscaled quantity first (e.g., np.arcsin(15*u.pc/u.kpc))\n                self._catch_warnings = warnings.catch_warnings()\n                self._catch_warnings.__enter__()\n                warnings.filterwarnings('ignore',\n                                        message='invalid value encountered in',\n                                        category=RuntimeWarning)\n\n        # unit output will get (setting _unit could prematurely change input\n        # if obj is self, which happens for in-place operations; see above)\n        result._result_unit = result_unit\n\n        return result\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        else:\n            # with context defined, we are continuing after a ufunc evaluation.\n            if hasattr(obj, '_result_unit'):\n                result_unit = obj._result_unit\n                del obj._result_unit\n            else:\n                result_unit = None\n\n            # We now need to re-calculate quantities for which the input\n            # needed to be scaled.\n            if hasattr(obj, '_converters'):\n\n                converters = obj._converters\n                del obj._converters\n\n                if hasattr(self, '_catch_warnings'):\n                    self._catch_warnings.__exit__()\n                    del self._catch_warnings\n\n                # For in-place operations, input will get overwritten with\n                # junk. To avoid that, we hid it in a new object in\n                # __array_prepare__ and retrieve it here.\n                if hasattr(obj, '_result'):\n                    obj = obj._result\n                elif hasattr(obj, '_contiguous'):\n                    obj[()] = obj._contiguous\n                    del obj._contiguous\n\n                # take array view to which output can be written without\n                # getting back here\n                obj_array = obj.view(np.ndarray)\n\n                # Find out which ufunc was called and with which inputs\n                function = context[0]\n                args = context[1][:function.nin]\n\n                # Set the inputs, rescaling as necessary\n                inputs = []\n                for arg, converter in zip(args, converters):\n                    if converter:\n                        inputs.append(converter(arg.value))\n                    else:  # with no conversion, input can be non-Quantity.\n                        inputs.append(getattr(arg, 'value', arg))\n\n                # For output arrays that require scaling, we can reuse the\n                # output array to perform the scaling in place, as long as the\n                # array is not integral. Here, we set the obj_array to `None`\n                # when it cannot be used to store the scaled result.\n                # Use a try/except, since np.result_type can fail, which would\n                # break the wrapping #4770.\n                try:\n                    tmp_dtype = np.result_type(*inputs)\n                # Catch the appropriate exceptions: TypeError or ValueError in\n                # case the result_type raised an Exception, i.e. inputs is list\n                except (TypeError, ValueError):\n                    obj_array = None\n                else:\n                    # Explicitly check if it can store the result.\n                    if not (result_unit is None or\n                            np.can_cast(tmp_dtype, obj_array.dtype)):\n                        obj_array = None\n\n                # Re-compute the output using the ufunc\n                if context[2] == 0:\n                    inputs.append(obj_array)\n                else:\n                    inputs += [None, obj_array]\n                out = function(*inputs)\n                if obj_array is None:\n                    if function.nout > 1:\n                        out = out[context[2]]\n                    obj = self._new_view(out, result_unit)\n\n            if result_unit is None:  # return a plain array\n                return obj.view(np.ndarray)\n            elif obj is self:  # all OK now, so set unit.\n                obj._set_unit(result_unit)\n                return obj\n            else:\n                return obj\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 = tuple((converter(input_.value) if converter else\n                        getattr(input_, 'value', input_))\n                       for input_, converter in zip(inputs, converters))\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 : `~numpy.ndarray` or tuple of `~numpy.ndarray`\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit` or None\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):\n            if out is None:\n                out = (None,) * len(result)\n            return tuple(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            - `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 : `UnitBase`, or anything convertible to a :class:`~astropy.units.Unit`, 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 : 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        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        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False)\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            # 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):\n                raise UnitTypeError(\n                    \"{0} instances require {1} units, not {2} instances.\"\n                    .format(type(self).__name__, UnitBase, 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        return self.unit.to(unit, self.view(np.ndarray),\n                            equivalencies=equivalencies)\n\n    def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance, str\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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`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        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        return self._new_view(self._to_value(unit, equivalencies), 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 : `~astropy.units.UnitBase` instance or str, 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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`unit_equivalencies`). If not provided or\n            ``[]``, 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 : `~numpy.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        value = self.view(np.ndarray)\n        if unit is not None:\n            unit = Unit(unit)\n            if unit != self.unit:\n                value = self._to_value(unit, equivalencies)\n        return value if self.shape else value.item()\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    @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        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        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                \"'{0}' object has no '{1}' member\".format(\n                    self.__class__.__name__,\n                    attr))\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                \"{0} instance has no attribute '{1}'\".format(\n                    self.__class__.__name__, attr))\n        else:\n            return value\n\n    # Equality (return False if units do not match) needs to be handled\n    # explicitly for numpy >=1.9, since it no longer traps errors.\n    def __eq__(self, other):\n        try:\n            try:\n                return super().__eq__(other)\n            except DeprecationWarning:\n                # We treat the DeprecationWarning separately, since it may\n                # mask another Exception.  But we do not want to just use\n                # np.equal, since super's __eq__ treats recarrays correctly.\n                return np.equal(self, other)\n        except UnitsError:\n            return False\n        except TypeError:\n            return NotImplemented\n\n    def __ne__(self, other):\n        try:\n            try:\n                return super().__ne__(other)\n            except DeprecationWarning:\n                return np.not_equal(self, other)\n        except UnitsError:\n            return True\n        except TypeError:\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 __div__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__truediv__(other)\n\n    def __idiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__itruediv__(other)\n\n    def __rdiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__rtruediv__(other)\n\n    if not hasattr(np, 'divmod'):  # NUMPY_LT_1_13\n        # In numpy 1.13, divmod goes via a ufunc and thus works without change.\n        def __divmod__(self, other):\n            other_value = self._to_own_unit(other)\n            result_tuple = divmod(self.value, other_value)\n\n            return (self._new_view(result_tuple[0], dimensionless_unscaled),\n                    self._new_view(result_tuple[1]))\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    # For Py>=3.5\n    def __matmul__(self, other, reverse=False):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(self.value, getattr(other, 'value', other))\n        return self._new_view(result_array, result_unit)\n\n    def __rmatmul__(self, other):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(getattr(other, 'value', other), self.value)\n        return self._new_view(result_array, result_unit)\n\n    if NUMPY_LT_1_13:\n        # Pre-numpy 1.13, there was no np.positive ufunc and the copy done\n        # by ndarray did not properly work for scalar quantities.\n        def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return self.copy()\n\n    else:\n        # In numpy 1.13, a np.positive ufunc exists, but ndarray.__pos__\n        # does not yet go through it, so we still need to define it, to allow\n        # subclasses to override it inside __array_ufunc__.\n        # Presumably, this can eventually be removed.\n        def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return np.positive(self)\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        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 type(out) is not type(self):\n            out = self._new_view(out)\n        return out\n\n    def __setitem__(self, i, value):\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    @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    # Display\n    # TODO: we may want to add a hook for dimensionless quantities?\n    def __str__(self):\n        return '{0}{1:s}'.format(self.value, self._unitstr)\n\n    def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        sep = ',' if NUMPY_LT_1_14 else ', '\n        arrstr = np.array2string(self.view(np.ndarray), separator=sep,\n                                 prefix=prefixstr)\n        return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate a latex 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        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # need to do try/finally because \"threshold\" cannot be overridden\n        # with array2string\n        pops = np.get_printoptions()\n\n        format_spec = '.{}g'.format(pops['precision'])\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        try:\n            formatter = {'float_kind': float_formatter}\n            if conf.latex_array_threshold > -1:\n                np.set_printoptions(threshold=conf.latex_array_threshold,\n                                    formatter=formatter)\n\n            # the view is needed for the scalar case - value might be float\n            if NUMPY_LT_1_14:   # style deprecated in 1.14\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    style=(float_formatter if self.dtype.kind == 'f'\n                           else repr),\n                    max_line_width=np.inf, separator=',~')\n            else:\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    max_line_width=np.inf, separator=',~')\n\n            latex_value = latex_value.replace('...', r'\\dots')\n        finally:\n            np.set_printoptions(**pops)\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        return r'${0} \\; {1}$'.format(latex_value, latex_unit)\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(\"{0}{1:s}\".format(value, self._unitstr),\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 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    # http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#array-conversion\n\n    def item(self, *args):\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.list()\")\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, so 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                _value = Quantity(value).to_value(self.unit)\n            except UnitsError as exc:\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(value)):\n                    _value = value\n                else:\n                    raise exc\n\n        if check_precision:\n            value_dtype = getattr(value, 'dtype', None)\n            if self.dtype != value_dtype:\n                self_dtype_array = np.array(_value, self.dtype)\n                value_dtype_array = np.array(_value, dtype=value_dtype,\n                                             copy=False)\n                if not np.all(np.logical_or(self_dtype_array ==\n                                            value_dtype_array,\n                                            np.isnan(value_dtype_array))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\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 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    # take, repeat, sort, compress, diagonal OK\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    # 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 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\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):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, unit=self.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\n    def mean(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.mean, axis, dtype, out=out)\n\n    def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out)\n\n    def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)\n\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 prod(self, axis=None, dtype=None, out=None, keepdims=False):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use prod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.prod, axis, dtype, out=out,\n                                   keepdims=keepdims)\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    def cumsum(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.cumsum, axis, dtype, out=out)\n\n    def cumprod(self, axis=None, dtype=None, out=None):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use cumprod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.cumprod, axis, dtype, out=out)\n\n    # Calculation: override methods that do not make sense.\n\n    def all(self, axis=None, out=None):\n        raise NotImplementedError(\"cannot evaluate truth value of quantities. \"\n                                  \"Evaluate array with q.value.all(...)\")\n\n    def any(self, axis=None, out=None):\n        raise NotImplementedError(\"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 ints\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)"},{"col":4,"comment":"Returns the equivalent Numpy record format string.","endLoc":296,"header":"@lazyproperty\n    def recformat(self)","id":1219,"name":"recformat","nodeType":"Function","startLoc":292,"text":"@lazyproperty\n    def recformat(self):\n        \"\"\"Returns the equivalent Numpy record format string.\"\"\"\n\n        return _convert_ascii_format(self)"},{"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":312,"header":"@lazyproperty\n    def canonical(self)","id":1220,"name":"canonical","nodeType":"Function","startLoc":298,"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 '{}{}.{}'.format(self.format, self.width, self.precision)\n\n        return '{}{}'.format(self.format, self.width)"},{"attributeType":"null","col":33,"comment":"null","endLoc":270,"id":1221,"name":"precision","nodeType":"Attribute","startLoc":270,"text":"self.precision"},{"col":4,"comment":"null","endLoc":405,"header":"def __array_finalize__(self, obj)","id":1222,"name":"__array_finalize__","nodeType":"Function","startLoc":393,"text":"def __array_finalize__(self, obj):\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.  Note that `obj` can be an\n        # ndarray which doesn't have a `__dict__`.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info"},{"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":743,"header":"def _cache_field(self, name, field)","id":1223,"name":"_cache_field","nodeType":"Function","startLoc":717,"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":229,"header":"@lazyproperty\n    def _unique(self)","id":1224,"name":"_unique","nodeType":"Function","startLoc":227,"text":"@lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)"},{"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":600,"header":"def _par_indices(names)","id":1225,"name":"_par_indices","nodeType":"Function","startLoc":586,"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":1226,"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        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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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":373,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False)","id":1227,"name":"writeto","nodeType":"Function","startLoc":335,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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":"\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":494,"header":"@property\n    def loc(self)","id":1228,"name":"loc","nodeType":"Function","startLoc":487,"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":"\n        Return raw array from either the HDU's memory buffer or underlying\n        file.\n        ","endLoc":477,"header":"def _get_raw_data(self, shape, code, offset)","id":1229,"name":"_get_raw_data","nodeType":"Function","startLoc":462,"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"},{"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":780,"header":"def _set_unit(self, unit)","id":1230,"name":"_set_unit","nodeType":"Function","startLoc":761,"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            # 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):\n                raise UnitTypeError(\n                    \"{0} instances require {1} units, not {2} instances.\"\n                    .format(type(self).__name__, UnitBase, type(unit)))\n\n        self._unit = unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":1231,"name":"_record_type","nodeType":"Attribute","startLoc":95,"text":"_record_type"},{"col":4,"comment":"null","endLoc":487,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":1232,"name":"_prewriteto","nodeType":"Function","startLoc":483,"text":"def _prewriteto(self, checksum=False, inplace=False):\n        self._update_uint_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)"},{"attributeType":"null","col":16,"comment":"null","endLoc":140,"id":1233,"name":"parbzeros","nodeType":"Attribute","startLoc":140,"text":"parbzeros"},{"attributeType":"null","col":16,"comment":"null","endLoc":135,"id":1234,"name":"npars","nodeType":"Attribute","startLoc":135,"text":"npars"},{"col":4,"comment":"null","endLoc":782,"header":"def __init__(self, table)","id":1235,"name":"__init__","nodeType":"Function","startLoc":778,"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":"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":535,"header":"def _update_checksum(self, checksum, checksum_keyword='CHECKSUM',\n                         datasum_keyword='DATASUM')","id":1236,"name":"_update_checksum","nodeType":"Function","startLoc":508,"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        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":502,"header":"@property\n    def loc_indices(self)","id":1237,"name":"loc_indices","nodeType":"Function","startLoc":496,"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":"null","endLoc":544,"header":"def _postwriteto(self)","id":1238,"name":"_postwriteto","nodeType":"Function","startLoc":537,"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_unsigned(self.data.dtype)):\n            for keyword in ('BSCALE', 'BZERO'):\n                with suppress(KeyError):\n                    del self._header[keyword]"},{"col":4,"comment":"null","endLoc":503,"header":"def __array_prepare__(self, obj, context=None)","id":1239,"name":"__array_prepare__","nodeType":"Function","startLoc":407,"text":"def __array_prepare__(self, obj, context=None):\n        # This method gets called by Numpy whenever a ufunc is called on the\n        # array. The object passed in ``obj`` is an empty version of the\n        # output array which we can e.g. change to an array sub-class, add\n        # attributes to, etc. After this is called, then the ufunc is called\n        # and the values in this empty array are set.\n\n        # In principle, this should not be needed any more in numpy >= 1.13,\n        # but it is still called in some np.linalg modules.\n\n        # If no context is set, just return the input\n        if context is None:\n            return obj\n\n        # Find out which ufunc is being used\n        function = context[0]\n        args = context[1][:function.nin]\n        # determine required converter 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\n        converters, result_unit = converters_and_unit(function, '__call__',\n                                                      *args)\n        if function.nout > 1:\n            result_unit = result_unit[context[2]]\n\n        # We now prepare the output object\n        if self is obj:\n            # this happens if the output object is self, which happens\n            # for in-place operations such as q1 += q2\n\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            # and that we can handle the type (e.g., that we are not int when\n            # float is required).\n            check_output(obj, result_unit, (args + tuple(\n                (np.float16 if converter and converter(1.) % 1. != 0.\n                 else np.int8)\n                for converter in converters)),\n                         function=function)\n            result = self  # no view needed since already a Quantity.\n\n            # in principle, if self is also an argument, it could be rescaled\n            # here, since it won't be needed anymore.  But maybe not change\n            # inputs before the calculation even if they will get destroyed\n\n        else:  # normal case: set up output as a Quantity\n\n            result = self._new_view(obj, result_unit)\n\n        # We now need to treat the case where the inputs have to be converted -\n        # the issue is that we can't actually convert the inputs since that\n        # would be changing the objects passed to the ufunc, which would not\n        # be expected by the user.\n        if any(converters):\n\n            # If self is both output and input (which happens for in-place\n            # operations), input will get overwritten with junk. To avoid\n            # that, hide it in a new object\n            if self is obj and any(self is arg for arg in args):\n                # but with two outputs it would become unhidden too soon\n                # [ie., np.modf(q1, q1, other)].  Bail.\n                if context[2] < function.nout - 1:\n                    raise TypeError(\"Cannot apply multi-output {0} function \"\n                                    \"to quantities with in-place replacement \"\n                                    \"of an input by any but the last output.\"\n                                    .format(function.__name__))\n\n                # If self is already contiguous, we don't need to do\n                # an additional copy back into the original array, so\n                # we store it in `result._result`.  Otherwise, we\n                # store it in `result._contiguous`.  `__array_wrap__`\n                # knows how to handle putting either form back into\n                # the original array.\n                if self.flags['C_CONTIGUOUS']:\n                    result = self.copy()\n                    result._result = self\n                else:\n                    result._contiguous = self.copy()\n\n            # ensure we remember the converter functions we need\n            result._converters = converters\n\n            if function in _UFUNCS_FILTER_WARNINGS:\n                # Filter out RuntimeWarning's caused by the ufunc being called on\n                # the unscaled quantity first (e.g., np.arcsin(15*u.pc/u.kpc))\n                self._catch_warnings = warnings.catch_warnings()\n                self._catch_warnings.__enter__()\n                warnings.filterwarnings('ignore',\n                                        message='invalid value encountered in',\n                                        category=RuntimeWarning)\n\n        # unit output will get (setting _unit could prematurely change input\n        # if obj is self, which happens for in-place operations; see above)\n        result._result_unit = result_unit\n\n        return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":275,"id":1240,"name":"_pseudo_logical","nodeType":"Attribute","startLoc":275,"text":"self._pseudo_logical"},{"col":4,"comment":"null","endLoc":561,"header":"def _writeheader(self, fileobj)","id":1241,"name":"_writeheader","nodeType":"Function","startLoc":546,"text":"def _writeheader(self, fileobj):\n        offset = 0\n        if not fileobj.simulateonly:\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        else:\n            size = len(str(self._header))\n\n        return offset, size"},{"attributeType":"null","col":8,"comment":"null","endLoc":270,"id":1242,"name":"format","nodeType":"Attribute","startLoc":270,"text":"self.format"},{"attributeType":"null","col":12,"comment":"null","endLoc":158,"id":1243,"name":"gcount","nodeType":"Attribute","startLoc":158,"text":"gcount"},{"attributeType":"null","col":12,"comment":"null","endLoc":201,"id":1244,"name":"parnames","nodeType":"Attribute","startLoc":201,"text":"self.parnames"},{"attributeType":"null","col":21,"comment":"null","endLoc":270,"id":1245,"name":"width","nodeType":"Attribute","startLoc":270,"text":"self.width"},{"attributeType":"null","col":12,"comment":"null","endLoc":157,"id":1246,"name":"formats","nodeType":"Attribute","startLoc":157,"text":"formats"},{"attributeType":"null","col":12,"comment":"null","endLoc":155,"id":1247,"name":"format","nodeType":"Attribute","startLoc":155,"text":"format"},{"attributeType":"null","col":12,"comment":"null","endLoc":176,"id":1248,"name":"_data_field","nodeType":"Attribute","startLoc":176,"text":"self._data_field"},{"attributeType":"null","col":8,"comment":"null","endLoc":269,"id":1249,"name":"self","nodeType":"Attribute","startLoc":269,"text":"self"},{"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":386,"id":1250,"nodeType":"Class","startLoc":377,"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":12,"comment":"null","endLoc":193,"id":1251,"name":"column","nodeType":"Attribute","startLoc":193,"text":"column"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":1252,"name":"fits_fmt","nodeType":"Attribute","startLoc":154,"text":"fits_fmt"},{"attributeType":"null","col":4,"comment":"null","endLoc":384,"id":1253,"name":"_format_code","nodeType":"Attribute","startLoc":384,"text":"_format_code"},{"attributeType":"null","col":12,"comment":"null","endLoc":194,"id":1254,"name":"scale","nodeType":"Attribute","startLoc":194,"text":"scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":385,"id":1255,"name":"_format_re","nodeType":"Attribute","startLoc":385,"text":"_format_re"},{"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 : Quantity or other 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":564,"header":"def converters_and_unit(function, method, *args)","id":1256,"name":"converters_and_unit","nodeType":"Function","startLoc":417,"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 : Quantity or other 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    # Check whether we even support this ufunc\n    if function in UNSUPPORTED_UFUNCS:\n        raise TypeError(\"Cannot use function '{0}' with quantities\"\n                        .format(function.__name__))\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        # If the ufunc is supported, then we call a helper function (defined\n        # above) which returns a list of function(s) that converts the input(s)\n        # to the unit required for the ufunc, as well as the unit the output\n        # will have (this is a tuple of units if there are multiple outputs).\n        if function in UFUNC_HELPERS:\n            converters, result_unit = UFUNC_HELPERS[function](function, *units)\n        else:\n            raise TypeError(\"Unknown ufunc {0}.  Please raise issue on \"\n                            \"https://github.com/astropy/astropy\"\n                            .format(function.__name__))\n\n        if any(converter is False for converter in converters):\n            # for two-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            maybe_arbitrary_arg = args[converters.index(False)]\n            try:\n                if can_have_arbitrary_unit(maybe_arbitrary_arg):\n                    converters = [None, None]\n                else:\n                    raise UnitsError(\"Can only apply '{0}' 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 {0}: \"\n                                \"'{1}' and '{2}'\"\n                                .format(function.__name__,\n                                        args[0].__class__.__name__,\n                                        args[1].__class__.__name__))\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        if method == 'at':\n            unit = getattr(args[0], 'unit', None)\n            units = [unit]\n            if function.nin == 2:\n                units.append(getattr(args[2], 'unit', None))\n\n            converters, result_unit = UFUNC_HELPERS[function](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\n              function.nin == 2):\n            unit = getattr(args[0], 'unit', None)\n            converters, result_unit = UFUNC_HELPERS[function](function,\n                                                              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', 'reduceat',\n                          'outer') and function.nin != 2:\n                raise ValueError(\"{0} only supported for binary functions\"\n                                 .format(method))\n\n            raise TypeError(\"Unexpected ufunc method {0}.  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 (unit is not None and\n                                         (not result_unit.is_equivalent(unit) or\n                                          result_unit.to(unit) != 1.)):\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":"null","col":16,"comment":"null","endLoc":152,"id":1257,"name":"bitpix","nodeType":"Attribute","startLoc":152,"text":"bitpix"},{"attributeType":"null","col":12,"comment":"null","endLoc":178,"id":1258,"name":"_coldefs","nodeType":"Attribute","startLoc":178,"text":"self._coldefs"},{"attributeType":"null","col":4,"comment":"null","endLoc":386,"id":1259,"name":"_descriptor_format","nodeType":"Attribute","startLoc":386,"text":"_descriptor_format"},{"attributeType":"null","col":19,"comment":"null","endLoc":194,"id":1260,"name":"zero","nodeType":"Attribute","startLoc":194,"text":"zero"},{"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":458,"id":1261,"nodeType":"Class","startLoc":389,"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 \"{0}('{1}')\".format(self.__class__.__name__, self._keyword)"},{"col":4,"comment":"null","endLoc":428,"header":"def __init__(self, keyword)","id":1262,"name":"__init__","nodeType":"Function","startLoc":420,"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":434,"header":"def __get__(self, obj, objtype=None)","id":1263,"name":"__get__","nodeType":"Function","startLoc":430,"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":"\n        Return a TableILoc object that can be used for retrieving\n        indexed rows in the order they appear in the index.\n        ","endLoc":510,"header":"@property\n    def iloc(self)","id":1264,"name":"iloc","nodeType":"Function","startLoc":504,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":149,"id":1265,"name":"unique_parnames","nodeType":"Attribute","startLoc":149,"text":"unique_parnames"},{"col":4,"comment":"null","endLoc":443,"header":"def __set__(self, obj, value)","id":1266,"name":"__set__","nodeType":"Function","startLoc":436,"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":599,"header":"def _writedata(self, fileobj)","id":1267,"name":"_writedata","nodeType":"Function","startLoc":563,"text":"def _writedata(self, fileobj):\n        # TODO: A lot of the simulateonly stuff should be moved back into the\n        # _File class--basically it should turn write and flush into a noop\n        offset = 0\n        size = 0\n\n        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except 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            if 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        if not fileobj.simulateonly:\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":612,"header":"def _writedata_internal(self, fileobj)","id":1268,"name":"_writedata_internal","nodeType":"Function","startLoc":601,"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        if not fileobj.simulateonly:\n            fileobj.writearray(self.data)\n        return self.data.size * self.data.itemsize"},{"attributeType":"null","col":12,"comment":"null","endLoc":200,"id":1269,"name":"self","nodeType":"Attribute","startLoc":200,"text":"self"},{"attributeType":"null","col":16,"comment":"null","endLoc":138,"id":1270,"name":"parbscales","nodeType":"Attribute","startLoc":138,"text":"parbscales"},{"attributeType":"null","col":12,"comment":"null","endLoc":160,"id":1271,"name":"cols","nodeType":"Attribute","startLoc":160,"text":"cols"},{"attributeType":"null","col":12,"comment":"null","endLoc":166,"id":1272,"name":"coldefs","nodeType":"Attribute","startLoc":166,"text":"coldefs"},{"attributeType":"null","col":12,"comment":"null","endLoc":156,"id":1273,"name":"data_fmt","nodeType":"Attribute","startLoc":156,"text":"data_fmt"},{"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":629,"header":"def _writedata_direct_copy(self, fileobj)","id":1274,"name":"_writedata_direct_copy","nodeType":"Function","startLoc":614,"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"},{"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:`data-sections` section of the Astropy documentation for more\n    details.\n    ","endLoc":946,"id":1275,"nodeType":"Class","startLoc":855,"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:`data-sections` section of the Astropy documentation for more\n    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":"\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":455,"header":"def __call__(self, func)","id":1276,"name":"__call__","nodeType":"Function","startLoc":445,"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":458,"header":"def __repr__(self)","id":1277,"name":"__repr__","nodeType":"Function","startLoc":457,"text":"def __repr__(self):\n        return \"{0}('{1}')\".format(self.__class__.__name__, self._keyword)"},{"col":4,"comment":"null","endLoc":870,"header":"def __init__(self, hdu)","id":1278,"name":"__init__","nodeType":"Function","startLoc":869,"text":"def __init__(self, hdu):\n        self.hdu = hdu"},{"col":4,"comment":"null","endLoc":925,"header":"def __getitem__(self, key)","id":1279,"name":"__getitem__","nodeType":"Function","startLoc":872,"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"},{"attributeType":"None","col":8,"comment":"null","endLoc":422,"id":1280,"name":"_validator","nodeType":"Attribute","startLoc":422,"text":"self._validator"},{"attributeType":"null","col":8,"comment":"null","endLoc":428,"id":1281,"name":"_attr","nodeType":"Attribute","startLoc":428,"text":"self._attr"},{"attributeType":"null","col":8,"comment":"null","endLoc":421,"id":1282,"name":"_keyword","nodeType":"Attribute","startLoc":421,"text":"self._keyword"},{"col":4,"comment":"null","endLoc":901,"header":"def __init__(self, table)","id":1283,"name":"__init__","nodeType":"Function","startLoc":900,"text":"def __init__(self, table):\n        super().__init__(table)"},{"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            FastBST, and FastRBT. If the supplied argument is None (by\n            default), use SortedArray.\n        unique : bool\n            Whether the values of the index must be unique. Default is False.\n        ","endLoc":543,"header":"def add_index(self, colnames, engine=None, unique=False)","id":1284,"name":"add_index","nodeType":"Function","startLoc":512,"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            FastBST, and FastRBT. If the supplied argument is None (by\n            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 \"{0}\", of '\n                                 'type \"{1}\"'.format(col.info.name, type(col)))\n\n        index = Index(columns, engine=engine, unique=unique)\n        if not self.indices:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(index)"},{"col":4,"comment":"null","endLoc":642,"header":"def _writeto(self, fileobj, inplace=False, copy=False)","id":1285,"name":"_writeto","nodeType":"Function","startLoc":635,"text":"def _writeto(self, fileobj, inplace=False, copy=False):\n        try:\n            dirname = os.path.dirname(fileobj._file.name)\n        except AttributeError:\n            dirname = None\n\n        with _free_space_check(self, dirname):\n            self._writeto_internal(fileobj, inplace, copy)"},{"col":4,"comment":"null","endLoc":1147,"header":"def __init__(self, indx, naxis)","id":1286,"name":"__init__","nodeType":"Function","startLoc":1129,"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('Index {} out of range.'.format(indx))\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('Illegal index {}'.format(indx))"},{"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":1267,"id":1287,"nodeType":"Class","startLoc":461,"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:`column_creation` and\n        :ref:`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 {0!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('Illegal format `{}`.'.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        format, recformat = cls._determine_formats(format, start, dim, ascii)\n        valid.update(format=format, recformat=recformat)\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                    'Column disp option (TDISPn) must be a string (got {!r}).'\n                    'The invalid value will be ignored for the purpose of '\n                    'formatting the data in this column.'.format(disp))\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                valid['disp'] = disp\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":"null","endLoc":628,"header":"def __repr__(self)","id":1288,"name":"__repr__","nodeType":"Function","startLoc":622,"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":"\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":639,"header":"def __eq__(self, other)","id":1289,"name":"__eq__","nodeType":"Function","startLoc":630,"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":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    `True` if each member is either zero or not finite, `False` otherwise\n    ","endLoc":414,"header":"def can_have_arbitrary_unit(value)","id":1290,"name":"can_have_arbitrary_unit","nodeType":"Function","startLoc":400,"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    `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":"null","endLoc":707,"header":"def _writeto_internal(self, fileobj, inplace, copy)","id":1291,"name":"_writeto_internal","nodeType":"Function","startLoc":644,"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        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":648,"header":"def __hash__(self)","id":1292,"name":"__hash__","nodeType":"Function","startLoc":641,"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":"null","endLoc":946,"header":"def _getdata(self, keys)","id":1293,"name":"_getdata","nodeType":"Function","startLoc":927,"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":127,"header":"def __init__(self, columns, engine=None, unique=False)","id":1294,"name":"__init__","nodeType":"Function","startLoc":80,"text":"def __init__(self, columns, engine=None, unique=False):\n        from .table import Table, Column\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')\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":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 : `~numpy.ndarray` view of ``output`` (or tuple of such views).\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":638,"header":"def check_output(output, unit, inputs, function=None)","id":1295,"name":"check_output","nodeType":"Function","startLoc":567,"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 : `~numpy.ndarray` view of ``output`` (or tuple of such views).\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{0} in {1} \"\n                            \"instance\".format(\n                                (\" from {0} function\".format(function.__name__)\n                                 if function is not None else \"\"),\n                                type(output)))\n\n        if output.__quantity_subclass__(unit)[0] is not type(output):\n            raise UnitTypeError(\n                \"Cannot store output with unit '{0}'{1} \"\n                \"in {2} instance.  Use {3} instance instead.\"\n                .format(unit, (\" from {0} function\".format(function.__name__)\n                               if function is not None else \"\"), type(output),\n                        output.__quantity_subclass__(unit)[0]))\n\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        output = output.view(np.ndarray)\n    else:\n        # output is not a Quantity, so cannot attain a unit.\n        if not (unit is None or unit is dimensionless_unscaled):\n            raise UnitTypeError(\"Cannot store quantity with dimension \"\n                                \"{0}in a non-Quantity instance.\"\n                                .format(\"\" if function is None else\n                                        \"resulting from {0} function \"\n                                        .format(function.__name__)))\n\n    # check we can handle the dtype (e.g., that we are not int\n    # when float is required).\n    if not np.can_cast(np.result_type(*inputs), output.dtype,\n                       casting='same_kind'):\n        raise TypeError(\"Arguments cannot be cast safely to inplace \"\n                        \"output with dtype={0}\".format(output.dtype))\n    return output"},{"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":725,"header":"@property\n    def array(self)","id":1296,"name":"array","nodeType":"Function","startLoc":650,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":870,"id":1297,"name":"hdu","nodeType":"Attribute","startLoc":870,"text":"self.hdu"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.io.fits`.\n    ","endLoc":59,"id":1298,"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.')"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":27,"id":1299,"name":"enable_record_valued_keyword_cards","nodeType":"Attribute","startLoc":27,"text":"enable_record_valued_keyword_cards"},{"col":4,"comment":"null","endLoc":756,"header":"@array.setter\n    def array(self, array)","id":1300,"name":"array","nodeType":"Function","startLoc":727,"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":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 : `UnitBase`, or anything convertible to a :class:`~astropy.units.Unit`, 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 : Quantity subclass\n        ","endLoc":759,"header":"def _new_view(self, obj=None, unit=None)","id":1301,"name":"_new_view","nodeType":"Function","startLoc":704,"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 : `UnitBase`, or anything convertible to a :class:`~astropy.units.Unit`, 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 : 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        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        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False)\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":716,"header":"def _close(self, closed=True)","id":1302,"name":"_close","nodeType":"Function","startLoc":709,"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":126,"id":1303,"name":"_hdu_registry","nodeType":"Attribute","startLoc":126,"text":"_hdu_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":1304,"name":"_standard","nodeType":"Attribute","startLoc":129,"text":"_standard"},{"col":4,"comment":"null","endLoc":765,"header":"@array.deleter\n    def array(self)","id":1305,"name":"array","nodeType":"Function","startLoc":758,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":132,"id":1306,"name":"_padding_byte","nodeType":"Attribute","startLoc":132,"text":"_padding_byte"},{"col":4,"comment":"null","endLoc":791,"header":"@ColumnAttribute('TTYPE')\n    def name(col, name)","id":1307,"name":"name","nodeType":"Function","startLoc":767,"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 {0!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.')"},{"attributeType":"null","col":4,"comment":"null","endLoc":134,"id":1308,"name":"_default_name","nodeType":"Attribute","startLoc":134,"text":"_default_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":161,"id":1309,"name":"_data_size","nodeType":"Attribute","startLoc":161,"text":"self._data_size"},{"attributeType":"null","col":8,"comment":"null","endLoc":157,"id":1310,"name":"_file","nodeType":"Attribute","startLoc":157,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":158,"id":1311,"name":"_buffer","nodeType":"Attribute","startLoc":158,"text":"self._buffer"},{"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            - `Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        ","endLoc":702,"header":"def __quantity_subclass__(self, unit)","id":1312,"name":"__quantity_subclass__","nodeType":"Function","startLoc":686,"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            - `Quantity` subclass\n            - bool: True if subclasses of the given class are ok\n        \"\"\"\n        return Quantity, True"},{"attributeType":"null","col":8,"comment":"null","endLoc":168,"id":1313,"name":"_data_needs_rescale","nodeType":"Attribute","startLoc":168,"text":"self._data_needs_rescale"},{"attributeType":"null","col":12,"comment":"null","endLoc":175,"id":1314,"name":"_output_checksum","nodeType":"Attribute","startLoc":175,"text":"self._output_checksum"},{"attributeType":"null","col":8,"comment":"null","endLoc":159,"id":1315,"name":"_header_offset","nodeType":"Attribute","startLoc":159,"text":"self._header_offset"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":1316,"name":"klass","nodeType":"Attribute","startLoc":150,"text":"klass"},{"attributeType":"null","col":8,"comment":"null","endLoc":156,"id":1317,"name":"_header","nodeType":"Attribute","startLoc":156,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":160,"id":1318,"name":"_data_offset","nodeType":"Attribute","startLoc":160,"text":"self._data_offset"},{"attributeType":"null","col":8,"comment":"null","endLoc":167,"id":1319,"name":"_data_replaced","nodeType":"Attribute","startLoc":167,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":1320,"name":"_new","nodeType":"Attribute","startLoc":169,"text":"self._new"},{"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":894,"header":"@classmethod\n    def match_header(cls, header)","id":1321,"name":"match_header","nodeType":"Function","startLoc":883,"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":"ConfigItem","col":4,"comment":"null","endLoc":33,"id":1322,"name":"extension_name_case_sensitive","nodeType":"Attribute","startLoc":33,"text":"extension_name_case_sensitive"},{"col":4,"comment":"\n        Size (in bytes) of the data portion of the HDU.\n        ","endLoc":912,"header":"@property\n    def size(self)","id":1323,"name":"size","nodeType":"Function","startLoc":896,"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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":37,"id":1324,"name":"strip_header_whitespace","nodeType":"Attribute","startLoc":37,"text":"strip_header_whitespace"},{"col":4,"comment":"null","endLoc":591,"header":"def __array_wrap__(self, obj, context=None)","id":1325,"name":"__array_wrap__","nodeType":"Function","startLoc":505,"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        else:\n            # with context defined, we are continuing after a ufunc evaluation.\n            if hasattr(obj, '_result_unit'):\n                result_unit = obj._result_unit\n                del obj._result_unit\n            else:\n                result_unit = None\n\n            # We now need to re-calculate quantities for which the input\n            # needed to be scaled.\n            if hasattr(obj, '_converters'):\n\n                converters = obj._converters\n                del obj._converters\n\n                if hasattr(self, '_catch_warnings'):\n                    self._catch_warnings.__exit__()\n                    del self._catch_warnings\n\n                # For in-place operations, input will get overwritten with\n                # junk. To avoid that, we hid it in a new object in\n                # __array_prepare__ and retrieve it here.\n                if hasattr(obj, '_result'):\n                    obj = obj._result\n                elif hasattr(obj, '_contiguous'):\n                    obj[()] = obj._contiguous\n                    del obj._contiguous\n\n                # take array view to which output can be written without\n                # getting back here\n                obj_array = obj.view(np.ndarray)\n\n                # Find out which ufunc was called and with which inputs\n                function = context[0]\n                args = context[1][:function.nin]\n\n                # Set the inputs, rescaling as necessary\n                inputs = []\n                for arg, converter in zip(args, converters):\n                    if converter:\n                        inputs.append(converter(arg.value))\n                    else:  # with no conversion, input can be non-Quantity.\n                        inputs.append(getattr(arg, 'value', arg))\n\n                # For output arrays that require scaling, we can reuse the\n                # output array to perform the scaling in place, as long as the\n                # array is not integral. Here, we set the obj_array to `None`\n                # when it cannot be used to store the scaled result.\n                # Use a try/except, since np.result_type can fail, which would\n                # break the wrapping #4770.\n                try:\n                    tmp_dtype = np.result_type(*inputs)\n                # Catch the appropriate exceptions: TypeError or ValueError in\n                # case the result_type raised an Exception, i.e. inputs is list\n                except (TypeError, ValueError):\n                    obj_array = None\n                else:\n                    # Explicitly check if it can store the result.\n                    if not (result_unit is None or\n                            np.can_cast(tmp_dtype, obj_array.dtype)):\n                        obj_array = None\n\n                # Re-compute the output using the ufunc\n                if context[2] == 0:\n                    inputs.append(obj_array)\n                else:\n                    inputs += [None, obj_array]\n                out = function(*inputs)\n                if obj_array is None:\n                    if function.nout > 1:\n                        out = out[context[2]]\n                    obj = self._new_view(out, result_unit)\n\n            if result_unit is None:  # return a plain array\n                return obj.view(np.ndarray)\n            elif obj is self:  # all OK now, so set unit.\n                obj._set_unit(result_unit)\n                return obj\n            else:\n                return obj"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":42,"id":1326,"name":"use_memmap","nodeType":"Attribute","startLoc":42,"text":"use_memmap"},{"col":4,"comment":"\n        Calculates and returns the number of bytes that this HDU will write to\n        a file.\n        ","endLoc":922,"header":"def filebytes(self)","id":1327,"name":"filebytes","nodeType":"Function","startLoc":914,"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]"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":48,"id":1328,"name":"lazy_load_hdus","nodeType":"Attribute","startLoc":48,"text":"lazy_load_hdus"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":54,"id":1329,"name":"enable_uint","nodeType":"Attribute","startLoc":54,"text":"enable_uint"},{"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\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":958,"header":"def fileinfo(self)","id":1330,"name":"fileinfo","nodeType":"Function","startLoc":924,"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\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":"null","endLoc":802,"header":"@ColumnAttribute('TCTYP')\n    def coord_type(col, coord_type)","id":1331,"name":"coord_type","nodeType":"Function","startLoc":793,"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.')"},{"col":4,"comment":"\n        Make a copy of the HDU, both header and data are copied.\n        ","endLoc":969,"header":"def copy(self)","id":1332,"name":"copy","nodeType":"Function","startLoc":960,"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":809,"header":"@ColumnAttribute('TCUNI')\n    def coord_unit(col, coord_unit)","id":1333,"name":"coord_unit","nodeType":"Function","startLoc":804,"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":4,"comment":"null","endLoc":817,"header":"@ColumnAttribute('TCRPX')\n    def coord_ref_point(col, coord_ref_point)","id":1334,"name":"coord_ref_point","nodeType":"Function","startLoc":811,"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.')"},{"col":4,"comment":"null","endLoc":825,"header":"@ColumnAttribute('TCRVL')\n    def coord_ref_value(col, coord_ref_value)","id":1335,"name":"coord_ref_value","nodeType":"Function","startLoc":819,"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":"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":644,"header":"def __array_ufunc__(self, function, method, *inputs, **kwargs)","id":1336,"name":"__array_ufunc__","nodeType":"Function","startLoc":593,"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 = tuple((converter(input_.value) if converter else\n                        getattr(input_, 'value', input_))\n                       for input_, converter in zip(inputs, converters))\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":"null","endLoc":832,"header":"@ColumnAttribute('TCDLT')\n    def coord_inc(col, coord_inc)","id":1337,"name":"coord_inc","nodeType":"Function","startLoc":827,"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.')"},{"col":4,"comment":"null","endLoc":839,"header":"@ColumnAttribute('TRPOS')\n    def time_ref_pos(col, time_ref_pos)","id":1338,"name":"time_ref_pos","nodeType":"Function","startLoc":834,"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.')"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":62,"id":1339,"name":"conf","nodeType":"Attribute","startLoc":62,"text":"conf"},{"col":4,"comment":"Whether this `Column` represents a column in an ASCII table.","endLoc":854,"header":"@lazyproperty\n    def ascii(self)","id":1340,"name":"ascii","nodeType":"Function","startLoc":850,"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":858,"header":"@lazyproperty\n    def dtype(self)","id":1341,"name":"dtype","nodeType":"Function","startLoc":856,"text":"@lazyproperty\n    def dtype(self):\n        return self.format.dtype"},{"col":4,"comment":"\n        Return a copy of this `Column`.\n        ","endLoc":866,"header":"def copy(self)","id":1342,"name":"copy","nodeType":"Function","startLoc":860,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":1343,"name":"__all__","nodeType":"Attribute","startLoc":86,"text":"__all__"},{"col":0,"comment":"","endLoc":13,"header":"__init__.py#<anonymous>","id":1344,"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":"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 : `~numpy.ndarray` or tuple of `~numpy.ndarray`\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit` or None\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":684,"header":"def _result_as_quantity(self, result, unit, out)","id":1345,"name":"_result_as_quantity","nodeType":"Function","startLoc":646,"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 : `~numpy.ndarray` or tuple of `~numpy.ndarray`\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit` or None\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):\n            if out is None:\n                out = (None,) * len(result)\n            return tuple(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":"null","endLoc":1036,"header":"def _verify(self, option='warn')","id":1346,"name":"_verify","nodeType":"Function","startLoc":971,"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"},{"fileName":"header.py","filePath":"astropy/io/fits","id":1347,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport collections\nimport copy\nimport itertools\nimport re\nimport warnings\n\nfrom .card import Card, _pad, KEYWORD_LENGTH\nfrom .file import _File\nfrom .util import encode_ascii, decode_ascii, fileobj_closed, fileobj_is_binary\n\nfrom ...utils import isiterable\nfrom ...utils.exceptions import AstropyUserWarning\nfrom ...utils.decorators import deprecated_renamed_argument\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.*']\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\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 : A list of `Card` objects, 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 Header([copy.copy(c) for c in self._cards[key]])\n        elif self._haswildcard(key):\n            return Header([copy.copy(self._cards[idx])\n                           for idx in self._wildcardmatch(key)])\n        elif (isinstance(key, str) and\n              key.upper() in Card._commentary_keywords):\n            key = key.upper()\n            # Special case for commentary cards\n            return _HeaderCommentaryCards(self, key)\n        if isinstance(key, tuple):\n            keyword = key[0]\n        else:\n            keyword = key\n        card = self._cards[self._cardindex(key)]\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        return card.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 not (0 < 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 = ''\n            elif len(value) == 2:\n                value, comment = value\n                if value is None:\n                    value = ''\n                if comment is None:\n                    comment = ''\n        else:\n            comment = None\n\n        card = None\n        if isinstance(key, int):\n            card = self._cards[key]\n        elif isinstance(key, tuple):\n            card = self._cards[self._cardindex(key)]\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(\"Keyword '{}' not found.\".format(key))\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    @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\n           String containing the entire 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        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        # 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(''.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(''.join(image)))\n\n        return cls(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        if isinstance(fileobj, str):\n            # Open in text mode by default to support newline handling; if a\n            # binary-mode file object is passed in, the user is on their own\n            # with respect to newline handling\n            fileobj = open(fileobj, 'r')\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 _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        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        header_str = ''.join(read_blocks)\n\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 padding and (len(header_str) % actual_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) - actual_block_size + BLOCK_SIZE\n            # TODO: Pass this error to validation framework\n            raise ValueError(\n                'Header size is not multiple of {0}: {1}'.format(BLOCK_SIZE,\n                                                                 actual_len))\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: {0}; 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 {0} '\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        s : 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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : str, file, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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            if not fileobj.simulateonly:\n                fileobj.flush()\n                try:\n                    offset = fileobj.tell()\n                except (AttributeError, OSError):\n                    offset = 0\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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 = Header((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\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, 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        return self.__iter__()\n\n    def values(self):\n        \"\"\"Like :meth:`dict.values`.\"\"\"\n\n        for _, v in self.items():\n            yield v\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('Header.pop expected at most 2 arguments, got '\n                            '{}'.format(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 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 supercedes 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 = Header(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(\"Keyword {!r} not found.\".format(keyword))\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('The keyword {!r} is not in the '\n                             ' header.'.format(keyword))\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, int):\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(\"Keyword '{}' not found.\".format(keyword))\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('Intended keyword {} already exists in header.'\n                            .format(newkeyword))\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 _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.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, int):\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], int)):\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(\"Keyword {!r} not found.\".format(keyword))\n            else:\n                # Maybe it's a RVKC?\n                indices = self._rvkc_indices.get(keyword, None)\n\n        if not indices:\n            raise KeyError(\"Keyword {!r} not found.\".format(keyword))\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, int) 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 _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        if 'NAXIS' in self:\n            naxis = self['NAXIS']\n        else:\n            naxis = 0\n\n        if 'TFIELDS' in self:\n            tfields = self['TFIELDS']\n        else:\n            tfields = 0\n\n        for idx in range(naxis):\n            try:\n                del self['NAXIS' + str(idx + 1)]\n            except KeyError:\n                pass\n\n        for name in ('TFORM', 'TSCAL', 'TZERO', 'TNULL', 'TTYPE',\n                     'TUNIT', 'TDISP', 'TDIM', 'THEAP', 'TBCOL'):\n            for idx in range(tfields):\n                try:\n                    del self[name + str(idx + 1)]\n                except KeyError:\n                    pass\n\n        for name in ('SIMPLE', 'XTENSION', 'BITPIX', 'NAXIS', 'EXTEND',\n                     'PCOUNT', 'GCOUNT', 'GROUPS', 'BSCALE', 'BZERO',\n                     'TFIELDS'):\n            try:\n                del self[name]\n            except KeyError:\n                pass\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.MutableSequence.register(Header)\ncollections.MutableMapping.register(Header)\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\ncollections.Mapping.register(_CardAccessor)\ncollections.Sequence.register(_CardAccessor)\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(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, int):\n            raise ValueError('{} index must be an integer'.format(self._keyword))\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":1348,"name":"KEYWORD_LENGTH","nodeType":"Attribute","startLoc":24,"text":"KEYWORD_LENGTH"},{"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":1973,"id":1349,"nodeType":"Class","startLoc":1908,"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":1924,"header":"def __repr__(self)","id":1350,"name":"__repr__","nodeType":"Function","startLoc":1923,"text":"def __repr__(self):\n        return '\\n'.join(repr(c) for c in self._header._cards)"},{"col":4,"comment":"null","endLoc":1927,"header":"def __len__(self)","id":1351,"name":"__len__","nodeType":"Function","startLoc":1926,"text":"def __len__(self):\n        return len(self._header._cards)"},{"col":4,"comment":"null","endLoc":1930,"header":"def __iter__(self)","id":1352,"name":"__iter__","nodeType":"Function","startLoc":1929,"text":"def __iter__(self):\n        return iter(self._header._cards)"},{"col":4,"comment":"null","endLoc":1945,"header":"def __eq__(self, other)","id":1353,"name":"__eq__","nodeType":"Function","startLoc":1932,"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":"\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:`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":1156,"header":"def req_cards(self, keyword, pos, test, fix_value, option, errlist)","id":1354,"name":"req_cards","nodeType":"Function","startLoc":1040,"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:`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 = \"'{}' card does not exist.\".format(keyword)\n            fix_text = \"Fixed by inserting a new '{}' card.\".format(keyword)\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 = (\"'{}' card at the wrong place \"\n                                \"(card {}).\".format(keyword, index))\n                    fix_text = (\"Fixed by moving it to the right place \"\n                                \"(card {}).\".format(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 = (\"'{}' card has invalid value '{}'.\".format(\n                            keyword, val))\n                    fix_text = (\"Fixed by setting a new value '{}'.\".format(\n                            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":4,"comment":"null","endLoc":785,"header":"def __deepcopy__(self, memo)","id":1355,"name":"__deepcopy__","nodeType":"Function","startLoc":782,"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":793,"header":"def __reduce__(self)","id":1356,"name":"__reduce__","nodeType":"Function","startLoc":787,"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":18,"endLoc":1107,"id":1357,"nodeType":"Lambda","startLoc":1107,"text":"lambda x: x == insert_pos"},{"col":4,"comment":"null","endLoc":801,"header":"def __setstate__(self, state)","id":1358,"name":"__setstate__","nodeType":"Function","startLoc":795,"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)"},{"col":4,"comment":"null","endLoc":1948,"header":"def __ne__(self, other)","id":1359,"name":"__ne__","nodeType":"Function","startLoc":1947,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":1955,"header":"def __getitem__(self, item)","id":1360,"name":"__getitem__","nodeType":"Function","startLoc":1950,"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":"Helper method for to and to_value.","endLoc":810,"header":"def _to_value(self, unit, equivalencies=[])","id":1361,"name":"_to_value","nodeType":"Function","startLoc":805,"text":"def _to_value(self, unit, equivalencies=[]):\n        \"\"\"Helper method for to and to_value.\"\"\"\n        if equivalencies == []:\n            equivalencies = self._equivalencies\n        return self.unit.to(unit, self.view(np.ndarray),\n                            equivalencies=equivalencies)"},{"col":4,"comment":"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance, str\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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`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        See also\n        --------\n        to_value : get the numerical value in a given unit.\n        ","endLoc":838,"header":"def to(self, unit, equivalencies=[])","id":1362,"name":"to","nodeType":"Function","startLoc":812,"text":"def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance, str\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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`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        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        return self._new_view(self._to_value(unit, equivalencies), unit)"},{"col":36,"endLoc":987,"id":1363,"nodeType":"Lambda","startLoc":987,"text":"lambda v: (_is_int(v) and is_valid(v))"},{"col":23,"endLoc":990,"id":1364,"nodeType":"Lambda","startLoc":990,"text":"lambda v: (_is_int(v) and 0 <= v <= 999)"},{"col":31,"endLoc":998,"id":1365,"nodeType":"Lambda","startLoc":998,"text":"lambda v: (_is_int(v) and v >= 0)"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":841,"id":1366,"name":"format","nodeType":"Attribute","startLoc":841,"text":"format"},{"col":4,"comment":"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance or str, 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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`unit_equivalencies`). If not provided or\n            ``[]``, 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 : `~numpy.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":873,"header":"def to_value(self, unit=None, equivalencies=[])","id":1367,"name":"to_value","nodeType":"Function","startLoc":840,"text":"def to_value(self, unit=None, equivalencies=[]):\n        \"\"\"\n        The numerical value, possibly in a different unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance or str, 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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`unit_equivalencies`). If not provided or\n            ``[]``, 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 : `~numpy.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        value = self.view(np.ndarray)\n        if unit is not None:\n            unit = Unit(unit)\n            if unit != self.unit:\n                value = self._to_value(unit, equivalencies)\n        return value if self.shape else value.item()"},{"col":4,"comment":"\n        Helper for implementing __setitem__ on _CardAccessor subclasses; slices\n        should always be handled in this same way.\n        ","endLoc":1973,"header":"def _setslice(self, item, value)","id":1368,"name":"_setslice","nodeType":"Function","startLoc":1957,"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        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":1192,"header":"def add_datasum(self, when=None, datasum_keyword='DATASUM')","id":1369,"name":"add_datasum","nodeType":"Function","startLoc":1158,"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 = 'data unit checksum updated {}'.format(self._get_timestamp())\n\n        self._header[datasum_keyword] = (str(cs), when)\n        return cs"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":842,"id":1370,"name":"unit","nodeType":"Attribute","startLoc":842,"text":"unit"},{"col":4,"comment":"null","endLoc":831,"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":1371,"name":"__new__","nodeType":"Function","startLoc":819,"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":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":1349,"header":"def _calculate_datasum(self)","id":1372,"name":"_calculate_datasum","nodeType":"Function","startLoc":1331,"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":"\n        A `~astropy.units.UnitBase` object representing the unit of this\n        quantity.\n        ","endLoc":890,"header":"@property\n    def unit(self)","id":1373,"name":"unit","nodeType":"Function","startLoc":883,"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":899,"header":"@property\n    def equivalencies(self)","id":1374,"name":"equivalencies","nodeType":"Function","startLoc":892,"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":"\n        Returns a copy of the current `Quantity` instance with SI units. The\n        value of the resulting object will be scaled.\n        ","endLoc":909,"header":"@property\n    def si(self)","id":1375,"name":"si","nodeType":"Function","startLoc":901,"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        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        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":1395,"header":"def _compute_checksum(self, data, sum32=0)","id":1376,"name":"_compute_checksum","nodeType":"Function","startLoc":1373,"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        Returns a copy of the current `Quantity` instance with CGS units. The\n        value of the resulting object will be scaled.\n        ","endLoc":919,"header":"@property\n    def cgs(self)","id":1377,"name":"cgs","nodeType":"Function","startLoc":911,"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        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":933,"header":"@property\n    def isscalar(self)","id":1378,"name":"isscalar","nodeType":"Function","startLoc":921,"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":"\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":955,"header":"@override__dir__\n    def __dir__(self)","id":1379,"name":"__dir__","nodeType":"Function","startLoc":941,"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":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":1439,"header":"def _compute_hdu_checksum(self, data, sum32=0)","id":1380,"name":"_compute_hdu_checksum","nodeType":"Function","startLoc":1397,"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"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":843,"id":1381,"name":"null","nodeType":"Attribute","startLoc":843,"text":"null"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":844,"id":1382,"name":"bscale","nodeType":"Attribute","startLoc":844,"text":"bscale"},{"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":637,"header":"@staticmethod\n    def _normalize_equivalencies(equivalencies)","id":1383,"name":"_normalize_equivalencies","nodeType":"Function","startLoc":612,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1921,"id":1384,"name":"_header","nodeType":"Attribute","startLoc":1921,"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":2031,"id":1385,"nodeType":"Class","startLoc":1980,"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":1993,"header":"def __iter__(self)","id":1386,"name":"__iter__","nodeType":"Function","startLoc":1991,"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":2003,"header":"def __repr__(self)","id":1387,"name":"__repr__","nodeType":"Function","startLoc":1995,"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":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":101,"header":"def _normalize_equivalencies(equivalencies)","id":1388,"name":"_normalize_equivalencies","nodeType":"Function","startLoc":62,"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                \"Invalid equivalence entry {0}: {1!r}\".format(i, equiv))\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                \"Invalid equivalence entry {0}: {1!r}\".format(i, equiv))\n        normalized.append((funit, tunit, a, b))\n\n    return normalized"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":845,"id":1389,"name":"bzero","nodeType":"Attribute","startLoc":845,"text":"bzero"},{"col":20,"endLoc":84,"id":1390,"nodeType":"Lambda","startLoc":84,"text":"lambda x: x"},{"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":2015,"header":"def __getitem__(self, item)","id":1391,"name":"__getitem__","nodeType":"Function","startLoc":2005,"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":550,"header":"def __setitem__(self, key, value)","id":1392,"name":"__setitem__","nodeType":"Function","startLoc":520,"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":"\n        Set/update the comment on specified card or cards.\n\n        Slice/filter updates work similarly to how Header.__setitem__ works.\n        ","endLoc":2031,"header":"def __setitem__(self, item, comment)","id":1393,"name":"__setitem__","nodeType":"Function","startLoc":2017,"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)"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":846,"id":1394,"name":"disp","nodeType":"Attribute","startLoc":846,"text":"disp"},{"col":4,"comment":"null","endLoc":235,"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":1395,"name":"__new__","nodeType":"Function","startLoc":182,"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            dtype = (np.dtype(dtype).str, shape)\n            self_data = np.zeros(length, 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 = deepcopy(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 = np.array(data.to(unit), dtype=dtype, copy=copy)\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 = deepcopy(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 = fix_column_name(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 \\\n                       copy_indices else []\n        for index in self.indices:\n            index.replace_col(data, self)\n\n        return self"},{"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":2081,"id":1396,"nodeType":"Class","startLoc":2034,"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(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, int):\n            raise ValueError('{} index must be an integer'.format(self._keyword))\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":2049,"header":"def __len__(self)","id":1397,"name":"__len__","nodeType":"Function","startLoc":2048,"text":"def __len__(self):\n        return len(range(*self._indices))"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":847,"id":1398,"name":"start","nodeType":"Attribute","startLoc":847,"text":"start"},{"col":4,"comment":"null","endLoc":2053,"header":"def __iter__(self)","id":1399,"name":"__iter__","nodeType":"Function","startLoc":2051,"text":"def __iter__(self):\n        for idx in range(*self._indices):\n            yield self._header[(self._keyword, idx)]"},{"col":0,"comment":"null","endLoc":280,"header":"def get_current_unit_registry()","id":1400,"name":"get_current_unit_registry","nodeType":"Function","startLoc":279,"text":"def get_current_unit_registry():\n    return _unit_registries[-1]"},{"col":4,"comment":"null","endLoc":2056,"header":"def __repr__(self)","id":1401,"name":"__repr__","nodeType":"Function","startLoc":2055,"text":"def __repr__(self):\n        return '\\n'.join(self)"},{"col":4,"comment":"null","endLoc":2067,"header":"def __getitem__(self, idx)","id":1402,"name":"__getitem__","nodeType":"Function","startLoc":2058,"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, int):\n            raise ValueError('{} index must be an integer'.format(self._keyword))\n\n        idx = list(range(*self._indices))[idx]\n        return self._header[(self._keyword, idx)]"},{"attributeType":"ColumnAttribute","col":4,"comment":"null","endLoc":848,"id":1403,"name":"dim","nodeType":"Attribute","startLoc":848,"text":"dim"},{"attributeType":"null","col":12,"comment":"null","endLoc":617,"id":1404,"name":"_physical_values","nodeType":"Attribute","startLoc":617,"text":"self._physical_values"},{"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":1329,"header":"def _get_timestamp(self)","id":1405,"name":"_get_timestamp","nodeType":"Function","startLoc":1321,"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]"},{"attributeType":"ColumnAttribute","col":8,"comment":"null","endLoc":580,"id":1406,"name":"_dims","nodeType":"Attribute","startLoc":580,"text":"self._dims"},{"col":4,"comment":"\n        Quantities are able to directly convert to other units that\n        have the same physical type.\n        ","endLoc":987,"header":"def __getattr__(self, attr)","id":1407,"name":"__getattr__","nodeType":"Function","startLoc":957,"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                \"'{0}' object has no '{1}' member\".format(\n                    self.__class__.__name__,\n                    attr))\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                \"{0} instance has no attribute '{1}'\".format(\n                    self.__class__.__name__, attr))\n        else:\n            return value"},{"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\n        override_datasum : bool, optional\n           add the ``CHECKSUM`` card only\n\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":1247,"header":"def add_checksum(self, when=None, override_datasum=False,\n                     checksum_keyword='CHECKSUM', datasum_keyword='DATASUM')","id":1408,"name":"add_checksum","nodeType":"Function","startLoc":1194,"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\n        override_datasum : bool, optional\n           add the ``CHECKSUM`` card only\n\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 = 'HDU checksum updated {}'.format(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        Encode anything that is unicode-ish as utf-8.  This method is only\n        called for Py3+.\n        ","endLoc":751,"header":"@staticmethod\n    def _encode_str(value)","id":1409,"name":"_encode_str","nodeType":"Function","startLoc":733,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":585,"id":1411,"name":"_pseudo_unsigned_ints","nodeType":"Attribute","startLoc":585,"text":"self._pseudo_unsigned_ints"},{"col":4,"comment":"null","endLoc":1003,"header":"def __eq__(self, other)","id":1412,"name":"__eq__","nodeType":"Function","startLoc":991,"text":"def __eq__(self, other):\n        try:\n            try:\n                return super().__eq__(other)\n            except DeprecationWarning:\n                # We treat the DeprecationWarning separately, since it may\n                # mask another Exception.  But we do not want to just use\n                # np.equal, since super's __eq__ treats recarrays correctly.\n                return np.equal(self, other)\n        except UnitsError:\n            return False\n        except TypeError:\n            return NotImplemented"},{"col":4,"comment":"null","endLoc":1014,"header":"def __ne__(self, other)","id":1413,"name":"__ne__","nodeType":"Function","startLoc":1005,"text":"def __ne__(self, other):\n        try:\n            try:\n                return super().__ne__(other)\n            except DeprecationWarning:\n                return np.not_equal(self, other)\n        except UnitsError:\n            return True\n        except TypeError:\n            return NotImplemented"},{"attributeType":"Delayed | None","col":8,"comment":"null","endLoc":620,"id":1414,"name":"array","nodeType":"Attribute","startLoc":620,"text":"self.array"},{"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":2081,"header":"def __setitem__(self, item, value)","id":1415,"name":"__setitem__","nodeType":"Function","startLoc":2069,"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":2043,"id":1416,"name":"_count","nodeType":"Attribute","startLoc":2043,"text":"self._count"},{"col":4,"comment":"\n        Calculate the value of the ``CHECKSUM`` card in the HDU.\n        ","endLoc":1371,"header":"def _calculate_checksum(self, datasum, checksum_keyword='CHECKSUM')","id":1417,"name":"_calculate_checksum","nodeType":"Function","startLoc":1351,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":2044,"id":1418,"name":"_indices","nodeType":"Attribute","startLoc":2044,"text":"self._indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":2042,"id":1419,"name":"_keyword","nodeType":"Attribute","startLoc":2042,"text":"self._keyword"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":1420,"name":"BLOCK_SIZE","nodeType":"Attribute","startLoc":18,"text":"BLOCK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1421,"name":"HEADER_END_RE","nodeType":"Attribute","startLoc":26,"text":"HEADER_END_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":1422,"name":"VALID_HEADER_CHARS","nodeType":"Attribute","startLoc":32,"text":"VALID_HEADER_CHARS"},{"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":566,"header":"def copy(self, order='C')","id":1423,"name":"copy","nodeType":"Function","startLoc":552,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":1424,"name":"END_CARD","nodeType":"Attribute","startLoc":33,"text":"END_CARD"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":1425,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":36,"text":"__doctest_skip__"},{"col":4,"comment":"\n        A user-visible accessor for the coldefs.\n\n        See https://aeon.stsci.edu/ssb/trac/pyfits/ticket/44\n        ","endLoc":576,"header":"@property\n    def columns(self)","id":1426,"name":"columns","nodeType":"Function","startLoc":568,"text":"@property\n    def columns(self):\n        \"\"\"\n        A user-visible accessor for the coldefs.\n\n        See https://aeon.stsci.edu/ssb/trac/pyfits/ticket/44\n        \"\"\"\n\n        return self._coldefs"},{"col":4,"comment":"null","endLoc":596,"header":"@property\n    def _coldefs(self)","id":1427,"name":"_coldefs","nodeType":"Function","startLoc":578,"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":"null","endLoc":603,"header":"@_coldefs.setter\n    def _coldefs(self, cols)","id":1428,"name":"_coldefs","nodeType":"Function","startLoc":598,"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":"","endLoc":3,"header":"header.py#<anonymous>","id":1429,"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.*']\n\ncollections.MutableSequence.register(Header)\n\ncollections.MutableMapping.register(Header)\n\ncollections.Mapping.register(_CardAccessor)\n\ncollections.Sequence.register(_CardAccessor)"},{"col":4,"comment":" Multiplication between `Quantity` objects and other objects.","endLoc":1026,"header":"def __mul__(self, other)","id":1430,"name":"__mul__","nodeType":"Function","startLoc":1017,"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":"null","endLoc":610,"header":"@_coldefs.deleter\n    def _coldefs(self)","id":1431,"name":"_coldefs","nodeType":"Function","startLoc":605,"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":623,"header":"def __del__(self)","id":1432,"name":"__del__","nodeType":"Function","startLoc":612,"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        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":565,"header":"def remove_indices(self, colname)","id":1433,"name":"remove_indices","nodeType":"Function","startLoc":545,"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)"},{"fileName":"convenience.py","filePath":"astropy/io/fits","id":1434,"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 extension HDU to use when working with a\nmulti-extension FITS file.  There are a few supported argument formats for\nselecting the extension.  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 extension HDU should be passed in as keyword\n    arguments.  This is to avoid ambiguity and conflicts with the\n    extension 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 extension\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\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\nfrom ...units import Unit\nfrom ...units.format.fits import UnitScaleError\nfrom ...units import Quantity\nfrom ...utils.exceptions import AstropyUserWarning\nfrom ...utils.decorators import deprecated_renamed_argument\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 extension of a FITS file.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.  See the\n        `getdata` documentation for explanations/examples.\n\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 extension of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary header::\n\n            getdata('in.fits')\n\n        By extension number::\n\n            getdata('in.fits', 0)      # the primary header\n            getdata('in.fits', 2)      # the second extension\n            getdata('in.fits', ext=2)  # the second extension\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 : array, record array or groups data object\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\n    mode, closed = _get_file_mode(filename)\n\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        data = hdu.data\n        if data is None and extidx == 0:\n            try:\n                hdu = hdulist[1]\n                data = hdu.data\n            except IndexError:\n                raise IndexError('No data in this HDU.')\n        if data is None:\n            raise IndexError('No data in this HDU.')\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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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\n@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object, or file like object\n        File to write to.  If opened, must be opened in a writeable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array, record array, or groups data object\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 :ref:`verify`\n        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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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\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 ...table.column import BaseColumn, Column\n        from ...time import Time\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('cannot write table with mixin column(s) {0}'\n                         .format(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    if table.masked:\n        # float column's default mask value needs to be Nan\n        for column in table.columns.values():\n            fill_value = column.get_fill_value()\n            if column.dtype.kind == 'f' and np.allclose(fill_value, 1e20):\n                column.set_fill_value(np.nan)\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(np.array(table.filled()), header=hdr, character_as_bytes=True)\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            # 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            # The astype is necessary because if the string column is less\n            # than one character, the fill value will be N/A by default which\n            # is too long, and so no values will get masked.\n            fill_value = table[col.name].get_fill_value()\n\n            col.null = fill_value.astype(table[col.name].dtype)\n    else:\n        table_hdu = BinTableHDU.from_columns(np.array(table.filled()), header=hdr, character_as_bytes=character_as_bytes)\n\n    # Set units for output HDU\n    for col in table_hdu.columns:\n        unit = table[col.name].unit\n        if unit is not None:\n            try:\n                col.unit = unit.to_string(format='fits')\n            except UnitScaleError:\n                scale = unit.scale\n                raise UnitScaleError(\n                    \"The column '{0}' could not be stored in FITS format \"\n                    \"because it has a scale '({1})' that \"\n                    \"is not recognized by the FITS standard. Either scale \"\n                    \"the data or change the units.\".format(col.name, str(scale)))\n            except ValueError:\n                warnings.warn(\n                    \"The unit '{0}' could not be saved to FITS format\".format(\n                        unit.to_string()), AstropyUserWarning)\n\n            # Try creating a Unit to issue a warning if the unit is not 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 all three, even if we have no data.\n        for attr in 'coord_type', 'coord_unit', 'time_ref_pos':\n            setattr(col, attr, col_info.get(attr, None))\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                \"Meta-data keyword {0} will be ignored since it conflicts \"\n                \"with a FITS reserved keyword\".format(key), AstropyUserWarning)\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                        \"Attribute `{0}` of type {1} cannot be added to \"\n                        \"FITS Header - skipping\".format(key, type(value)),\n                        AstropyUserWarning)\n        else:\n            try:\n                table_hdu.header[key] = value\n            except ValueError:\n                warnings.warn(\n                    \"Attribute `{0}` of type {1} cannot be added to FITS \"\n                    \"Header - skipping\".format(key, type(value)),\n                    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 : file path, file object, or file like object\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, table, or group data object\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        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\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')\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 extension with the input data/header.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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, table, or group data object\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        extension specification(s).  Header and extension 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\n            update(file, dat, hdr, 3)  # update the 3rd extension\n            update(file, dat, 'sci', 2)  # update the 2nd SCI extension\n            update(file, dat, 3, header=hdr)  # update the 3rd extension\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension\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 extension.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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\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 extension 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 extension number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension\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\n@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\n        Input fits file.\n\n    datafile : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : file path, file object or file-like object, 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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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 : file path, file object or file-like object\n        Input data file containing the table data in ASCII format.\n\n    cdfile : file path, file object or file-like object\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 : file path, file object or file-like object, 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(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):\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    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"},{"col":4,"comment":"In-place multiplication between `Quantity` objects and others.","endLoc":1035,"header":"def __imul__(self, other)","id":1435,"name":"__imul__","nodeType":"Function","startLoc":1028,"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":"\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":586,"header":"def index_mode(self, mode)","id":1436,"name":"index_mode","nodeType":"Function","startLoc":567,"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":"List of column names.","endLoc":634,"header":"@property\n    def names(self)","id":1437,"name":"names","nodeType":"Function","startLoc":625,"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":643,"header":"@property\n    def formats(self)","id":1438,"name":"formats","nodeType":"Function","startLoc":636,"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":665,"header":"@property\n    def _raw_itemsize(self)","id":1439,"name":"_raw_itemsize","nodeType":"Function","startLoc":645,"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"},{"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":1503,"header":"def _char_encode(self, value)","id":1440,"name":"_char_encode","nodeType":"Function","startLoc":1474,"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.tostring())"},{"col":0,"comment":"\n    Returns True if any fields in a structured array have Unicode dtype.\n    ","endLoc":1331,"header":"def _has_unicode_fields(array)","id":1441,"name":"_has_unicode_fields","nodeType":"Function","startLoc":1325,"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":4,"comment":" Right Multiplication between `Quantity` objects and other\n        objects.\n        ","endLoc":1042,"header":"def __rmul__(self, other)","id":1442,"name":"__rmul__","nodeType":"Function","startLoc":1037,"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":"\n        Encode a single byte.\n        ","endLoc":1472,"header":"def _encode_byte(self, byte)","id":1443,"name":"_encode_byte","nodeType":"Function","startLoc":1451,"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"},{"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":759,"header":"def _update_column_attribute_changed(self, column, idx, attr, old_value,\n                                         new_value)","id":1444,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":745,"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 = '_update_column_{0}'.format(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":" Division between `Quantity` objects and other objects.","endLoc":1053,"header":"def __truediv__(self, other)","id":1445,"name":"__truediv__","nodeType":"Function","startLoc":1044,"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)"},{"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":1270,"header":"def verify_datasum(self)","id":1446,"name":"verify_datasum","nodeType":"Function","startLoc":1249,"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":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":669,"header":"def __init__(self, table, mode)","id":1447,"name":"__init__","nodeType":"Function","startLoc":643,"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                             \"'{0}'\".format(mode))"},{"col":4,"comment":"Update the dtype field names when a column name is changed.","endLoc":766,"header":"def _update_column_name(self, column, idx, old_name, name)","id":1448,"name":"_update_column_name","nodeType":"Function","startLoc":761,"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":"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":605,"header":"def __array__(self, dtype=None)","id":1449,"name":"__array__","nodeType":"Function","startLoc":588,"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        return self.as_array().data if self.masked else self.as_array()"},{"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":1297,"header":"def verify_checksum(self)","id":1450,"name":"verify_checksum","nodeType":"Function","startLoc":1272,"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        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":999,"header":"def _get_heap_data(self)","id":1451,"name":"_get_heap_data","nodeType":"Function","startLoc":987,"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":"Create a new table as a referenced slice from self.","endLoc":797,"header":"def _new_from_slice(self, slice_)","id":1452,"name":"_new_from_slice","nodeType":"Function","startLoc":778,"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        table.meta.clear()\n        table.meta.update(deepcopy(self.meta))\n        table.primary_key = self.primary_key\n        cols = self.columns.values()\n\n        newcols = []\n        for col in cols:\n            col.info._copy_indices = self._copy_indices\n            newcol = col[slice_]\n            if col.info.indices:\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n            newcols.append(newcol)\n            col.info._copy_indices = True\n\n        self._make_table_from_cols(table, newcols)\n        return table"},{"col":4,"comment":"Inplace division between `Quantity` objects and other objects.","endLoc":1062,"header":"def __itruediv__(self, other)","id":1453,"name":"__itruediv__","nodeType":"Function","startLoc":1055,"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)"},{"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":1319,"header":"def _verify_checksum_datasum(self)","id":1454,"name":"_verify_checksum_datasum","nodeType":"Function","startLoc":1299,"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 {0}.\\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 {0}.\\n'.format(\n                        (self.name, self.ver)), AstropyUserWarning)"},{"col":4,"comment":" Right Division between `Quantity` objects and other objects.","endLoc":1070,"header":"def __rtruediv__(self, other)","id":1455,"name":"__rtruediv__","nodeType":"Function","startLoc":1064,"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":" Division between `Quantity` objects. ","endLoc":1074,"header":"def __div__(self, other)","id":1456,"name":"__div__","nodeType":"Function","startLoc":1072,"text":"def __div__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__truediv__(other)"},{"col":4,"comment":" Division between `Quantity` objects. ","endLoc":1078,"header":"def __idiv__(self, other)","id":1457,"name":"__idiv__","nodeType":"Function","startLoc":1076,"text":"def __idiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__itruediv__(other)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1443,"id":1458,"name":"_MASK","nodeType":"Attribute","startLoc":1443,"text":"_MASK"},{"attributeType":"null","col":4,"comment":"null","endLoc":1448,"id":1459,"name":"_EXCLUDE","nodeType":"Attribute","startLoc":1448,"text":"_EXCLUDE"},{"col":4,"comment":" Division between `Quantity` objects. ","endLoc":1082,"header":"def __rdiv__(self, other)","id":1460,"name":"__rdiv__","nodeType":"Function","startLoc":1080,"text":"def __rdiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__rtruediv__(other)"},{"attributeType":"null","col":8,"comment":"null","endLoc":873,"id":1461,"name":"_checksum","nodeType":"Attribute","startLoc":873,"text":"self._checksum"},{"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":1152,"header":"def _scale_back(self, update_heap_pointers=True)","id":1462,"name":"_scale_back","nodeType":"Function","startLoc":1052,"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":8,"comment":"null","endLoc":1091,"header":"def __divmod__(self, other)","id":1463,"name":"__divmod__","nodeType":"Function","startLoc":1086,"text":"def __divmod__(self, other):\n            other_value = self._to_own_unit(other)\n            result_tuple = divmod(self.value, other_value)\n\n            return (self._new_view(result_tuple[0], dimensionless_unscaled),\n                    self._new_view(result_tuple[1]))"},{"attributeType":"null","col":8,"comment":"null","endLoc":874,"id":1464,"name":"_checksum_valid","nodeType":"Attribute","startLoc":874,"text":"self._checksum_valid"},{"attributeType":"null","col":8,"comment":"null","endLoc":581,"id":1465,"name":"dim","nodeType":"Attribute","startLoc":581,"text":"self.dim"},{"attributeType":"null","col":12,"comment":"null","endLoc":881,"id":1466,"name":"ver","nodeType":"Attribute","startLoc":881,"text":"self.ver"},{"col":4,"comment":"null","endLoc":1414,"header":"def _to_own_unit(self, value, check_precision=True)","id":1467,"name":"_to_own_unit","nodeType":"Function","startLoc":1385,"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, so 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                _value = Quantity(value).to_value(self.unit)\n            except UnitsError as exc:\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(value)):\n                    _value = value\n                else:\n                    raise exc\n\n        if check_precision:\n            value_dtype = getattr(value, 'dtype', None)\n            if self.dtype != value_dtype:\n                self_dtype_array = np.array(_value, self.dtype)\n                value_dtype_array = np.array(_value, dtype=value_dtype,\n                                             copy=False)\n                if not np.all(np.logical_or(self_dtype_array ==\n                                            value_dtype_array,\n                                            np.isnan(value_dtype_array))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\n        return _value"},{"attributeType":"null","col":8,"comment":"null","endLoc":875,"id":1468,"name":"_datasum","nodeType":"Attribute","startLoc":875,"text":"self._datasum"},{"attributeType":"null","col":8,"comment":"null","endLoc":876,"id":1469,"name":"_datasum_valid","nodeType":"Attribute","startLoc":876,"text":"self._datasum_valid"},{"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":399,"id":1470,"nodeType":"Class","startLoc":199,"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_keywords=[], ignore_comments=[],\n                 ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 ignore_blanks=True, ignore_blank_cards=True, tolerance=None):\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_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            .. versionchanged:: 2.0\n               ``rtol`` replaces the deprecated ``tolerance`` argument.\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):\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):\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_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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\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        # For now, just compare the extensions one by one in order...might\n        # allow some more sophisticated types of diffing later...\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                self.diff_hdus.append((idx, hdu_diff))\n\n    def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        # print out heading and parameter values\n        filenamea = self.a.filename()\n        if not filenamea:\n            filenamea = '<{} object at {:#x}>'.format(\n                self.a.__class__.__name__, id(self.a))\n\n        filenameb = self.b.filename()\n        if not filenameb:\n            filenameb = '<{} object at {:#x}>'.format(\n                self.b.__class__.__name__, id(self.b))\n\n        self._fileobj.write('\\n')\n        self._writeln(' fitsdiff: {}'.format(__version__))\n        self._writeln(' a: {}\\n b: {}'.format(filenamea, filenameb))\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        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        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(' a: {}'.format(self.diff_hdu_count[0]))\n            self._writeln(' b: {}'.format(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 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                self._writeln('Extension HDU {}:'.format(idx))\n            hdu_diff.report(self._fileobj, indent=self._indent + 1)"},{"attributeType":"None","col":8,"comment":"null","endLoc":619,"id":1471,"name":"_parent_fits_rec","nodeType":"Attribute","startLoc":619,"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":2221,"header":"def _scalar_to_format(value)","id":1472,"name":"_scalar_to_format","nodeType":"Function","startLoc":2198,"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))"},{"attributeType":"null","col":12,"comment":"null","endLoc":879,"id":1473,"name":"name","nodeType":"Attribute","startLoc":879,"text":"self.name"},{"col":4,"comment":"null","endLoc":870,"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":1474,"name":"_base_repr_","nodeType":"Function","startLoc":844,"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('length={0}'.format(len(self)))\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from ..utils.xml.writer import xml_escape\n            descr = '<i>{0}</i>\\n'.format(xml_escape(descr))\n        else:\n            descr = '<{0}>\\n'.format(descr)\n\n        if tableid is None:\n            tableid = 'table{id}'.format(id=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"},{"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":70,"header":"@classmethod\n    def match_header(cls, header)","id":1475,"name":"match_header","nodeType":"Function","startLoc":62,"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`, or other\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\n        Any additional keyword arguments accepted by the HDU class's\n        ``__init__`` may also be passed in as keyword arguments.\n        ","endLoc":131,"header":"@classmethod\n    def from_columns(cls, columns, header=None, nrows=0, fill=False,\n                     character_as_bytes=False, **kwargs)","id":1476,"name":"from_columns","nodeType":"Function","startLoc":72,"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`, or other\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\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":0,"comment":"\n    Compares two numpy recformats using the ordering given by FORMATORDER.\n    ","endLoc":2233,"header":"def _cmp_recformats(f1, f2)","id":1477,"name":"_cmp_recformats","nodeType":"Function","startLoc":2224,"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        The :class:`ColDefs` objects describing the columns in this table.\n        ","endLoc":141,"header":"@lazyproperty\n    def columns(self)","id":1478,"name":"columns","nodeType":"Function","startLoc":133,"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([])"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1479,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":1480,"name":"NUMPY2FITS","nodeType":"Attribute","startLoc":44,"text":"NUMPY2FITS"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":1481,"name":"FORMATORDER","nodeType":"Attribute","startLoc":58,"text":"FORMATORDER"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":1482,"name":"FITSUPCONVERTERS","nodeType":"Attribute","startLoc":61,"text":"FITSUPCONVERTERS"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":1483,"name":"ASCII_DEFAULT_WIDTHS","nodeType":"Attribute","startLoc":78,"text":"ASCII_DEFAULT_WIDTHS"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":1484,"name":"KEYWORD_NAMES","nodeType":"Attribute","startLoc":86,"text":"KEYWORD_NAMES"},{"attributeType":"null","col":0,"comment":"This is a list of the attributes that can be set on `Column` objects.","endLoc":89,"id":1485,"name":"KEYWORD_ATTRIBUTES","nodeType":"Attribute","startLoc":89,"text":"KEYWORD_ATTRIBUTES"},{"attributeType":"null","col":0,"comment":"null","endLoc":96,"id":1486,"name":"KEYWORD_TO_ATTRIBUTE","nodeType":"Attribute","startLoc":96,"text":"KEYWORD_TO_ATTRIBUTE"},{"attributeType":"null","col":0,"comment":"null","endLoc":98,"id":1487,"name":"ATTRIBUTE_TO_KEYWORD","nodeType":"Attribute","startLoc":98,"text":"ATTRIBUTE_TO_KEYWORD"},{"attributeType":"null","col":0,"comment":"null","endLoc":104,"id":1488,"name":"TFORMAT_RE","nodeType":"Attribute","startLoc":104,"text":"TFORMAT_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":110,"id":1489,"name":"TFORMAT_ASCII_RE","nodeType":"Attribute","startLoc":110,"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":115,"id":1490,"name":"TTYPE_RE","nodeType":"Attribute","startLoc":115,"text":"TTYPE_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":122,"id":1491,"name":"TDEF_RE","nodeType":"Attribute","startLoc":122,"text":"TDEF_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":125,"id":1492,"name":"TDIM_RE","nodeType":"Attribute","startLoc":125,"text":"TDIM_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":133,"id":1493,"name":"DEFAULT_ASCII_TNULL","nodeType":"Attribute","startLoc":133,"text":"DEFAULT_ASCII_TNULL"},{"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":152,"header":"@property\n    def _nrows(self)","id":1494,"name":"_nrows","nodeType":"Function","startLoc":143,"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":185,"header":"def _get_tbdata(self)","id":1495,"name":"_get_tbdata","nodeType":"Function","startLoc":154,"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            data = raw_data[:self._theap].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":0,"comment":"","endLoc":3,"header":"column.py#<anonymous>","id":1496,"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\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*')\n\nASCIITNULL = 0\n\nDEFAULT_ASCII_TNULL = '---'"},{"fileName":"card.py","filePath":"astropy/io/fits","id":1497,"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 ...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\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(r'(?P<sign>[+-])?0*?(?P<digt>{})'.format(\n            _digits_FSC))\n    _number_NFSC_RE = re.compile(r'(?P<sign>[+-])? *0*?(?P<digt>{})'.format(\n            _digits_NFSC))\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                r'\\'(?P<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                r'\\'(?P<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            r')? *)'\n        r'(?P<comm_field>'\n            r'(?P<sepr>/ *)'\n            r'(?P<comm>(.|\\n)*)'\n        r')?$')\n\n    _rvkc_identifier = r'[a-zA-Z_]\\w*'\n    _rvkc_field = _rvkc_identifier + r'(\\.\\d+)?'\n    _rvkc_field_specifier_s = r'{}(\\.{})*'.format(_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 = r'\\'(?P<rawval>{})\\''.format(_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\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\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._valuestring = None\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 HEIRARCH 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('Illegal keyword name: {!r}.'.format(keyword))\n            self._keyword = keyword\n            self._modified = True\n        else:\n            raise ValueError('Keyword name {!r} is not a string.'.format(keyword))\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            self._value = self._parse_value()\n            value = self._value\n        else:\n            self._value = value = ''\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/unparseable cards cannot set.  Either '\n                'delete this card from the header or replace it.')\n\n        if value is None:\n            value = ''\n        oldvalue = self._value\n        if oldvalue is None:\n            oldvalue = ''\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('Illegal value: {!r}.'.format(value))\n\n        if isinstance(value, float) and (np.isnan(value) or np.isinf(value)):\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, bytes):\n            # Allow str, but only if they can be decoded to ASCII text; note\n            # this is not even allowed on Python 3 since the `bytes` type is\n            # not included in `str`.  Presently we simply don't\n            # allow bytes to be assigned to headers, as doing so would too\n            # easily mask potential user error\n            valid = True\n            try:\n                text_value = value.decode('ascii')\n            except UnicodeDecodeError:\n                valid = False\n            else:\n                # Check against the printable characters regexp as well\n                m = self._ascii_text_re.match(text_value)\n                valid = m is not None\n\n            if not valid:\n                raise ValueError(\n                    'FITS header values must contain standard printable ASCII '\n                    'characters; {!r} contains characters/bytes that do not '\n                    'represent printable characters in ASCII.'.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('value {} is not a float'.format(\n                            self._value))\n\n    @value.deleter\n    def value(self):\n        if self._invalid:\n            raise ValueError(\n                'The value of invalid/unparseable 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 = '{}: {}'.format(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/unparseable 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.'.format(\n                    comment))\n\n        oldcomment = self._comment\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/unparseable 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        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\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            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 + len(VALUE_INDICATOR):]\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        val_ind_idx = self._image.find(VALUE_INDICATOR)\n\n        special = self._commentary_keywords\n\n        if (0 <= val_ind_idx <= KEYWORD_LENGTH or keyword_upper in special or\n                keyword_upper == 'CONTINUE'):\n            # The value indicator should appear in byte 8, but we are flexible\n            # and allow this to be fixed\n            if val_ind_idx >= 0:\n                keyword = keyword[:val_ind_idx]\n                rest = self._image[val_ind_idx + len(VALUE_INDICATOR):]\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                keyword_upper = keyword_upper[:val_ind_idx]\n\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            warnings.warn('The following header keyword is invalid or follows '\n                          'an unrecognized non-standard convention:\\n{}'.format(\n                          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        if len(self._image) > self.length:\n            values = []\n            for card in self._itersubcards():\n                value = card.value.rstrip().replace(\"''\", \"'\")\n                if value and value[-1] == '&':\n                    value = value[:-1]\n                values.append(value)\n\n            value = ''.join(values)\n\n            self._valuestring = value\n            return 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/unparseable cards\n        if self.keyword in Card._commentary_keywords or self._invalid:\n            return ''\n\n        if len(self._image) > self.length:\n            comments = []\n            for card in self._itersubcards():\n                if card.comment:\n                    comments.append(card.comment)\n            comment = '/ ' + ' '.join(comments).rstrip()\n            m = self._value_NFSC_RE.match(comment)\n        else:\n            m = self._value_NFSC_RE.match(self._split()[1])\n\n        if m is not None:\n            comment = m.group('comm')\n            if comment:\n                return comment.rstrip()\n        return ''\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        if self.keyword in self._commentary_keywords.union(['CONTINUE']):\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 = '({}, {})'.format(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 'HIERARCH {} '.format(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 = '{:>20}'.format(self._valuestring)\n        elif self.field_specifier:\n            value = _format_value(self._value).strip()\n            value = \"'{}: {}'\".format(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 ' / {}'.format(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 = '{:80}'.format(output)\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('{:80}'.format(headstr + value))\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('{:80}'.format(comment))\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        self._verified = True\n\n        errs = _ErrList([])\n        fix_text = ('Fixed {!r} card to meet the FITS '\n                    'standard.'.format(self.keyword))\n\n        # Don't try to verify cards that already don't meet any recognizable\n        # standard\n        if self._invalid:\n            return 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(self.run_option(\n                option,\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(self.run_option(\n                        option,\n                        err_text='Card keyword {!r} is not upper case.'.format(\n                                  keyword),\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(self.run_option(\n                    option,\n                    err_text='Illegal keyword name {!r}'.format(keyword),\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(self.run_option(\n                    option,\n                    err_text='Unprintable string {!r}; commentary cards may '\n                             'only contain printable ASCII characters'.format(\n                             valuecomment),\n                    fixable=False))\n        else:\n            m = self._value_FSC_RE.match(valuecomment)\n            if not m:\n                errs.append(self.run_option(\n                    option,\n                    err_text='Card {!r} is not FITS standard (invalid value '\n                             'string: {!r}).'.format(self.keyword, valuecomment),\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(self.run_option(\n                        option,\n                        err_text=('Unprintable string {!r}; header comments '\n                                  'may only contain printable ASCII '\n                                  'characters'.format(comment)),\n                        fixable=False))\n\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\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() != 'CONTINUE':\n                raise VerifyError(\n                        'Long card images must have CONTINUE cards after '\n                        'the first card.')\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 = \"'{:8}'\".format(exp_val_str)\n            return '{:20}'.format(val_str)\n\n    # must be before int checking since bool is also int\n    elif isinstance(value, (bool, np.bool_)):\n        return '{:>20}'.format(repr(value)[0])  # T or F\n\n    elif _is_int(value):\n        return '{:>20d}'.format(value)\n\n    elif isinstance(value, (float, np.floating)):\n        return '{:>20}'.format(_format_float(value))\n\n    elif isinstance(value, (complex, np.complexfloating)):\n        val_str = '({}, {})'.format(_format_float(value.real),\n                                    _format_float(value.imag))\n        return '{:>20}'.format(val_str)\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 = '{:.16G}'.format(value)\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 = '{}E{}{:02d}'.format(significand, sign, int(exponent))\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":35,"id":1498,"nodeType":"Class","startLoc":30,"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":35,"header":"def __init__(self)","id":1499,"name":"__init__","nodeType":"Function","startLoc":33,"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":1500,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":1501,"name":"FIX_FP_TABLE","nodeType":"Attribute","startLoc":18,"text":"FIX_FP_TABLE"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":1502,"name":"FIX_FP_TABLE2","nodeType":"Attribute","startLoc":19,"text":"FIX_FP_TABLE2"},{"col":4,"comment":"null","endLoc":1099,"header":"def __pow__(self, other)","id":1503,"name":"__pow__","nodeType":"Function","startLoc":1093,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":1504,"name":"VALUE_INDICATOR","nodeType":"Attribute","startLoc":26,"text":"VALUE_INDICATOR"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":1505,"name":"HIERARCH_VALUE_INDICATOR","nodeType":"Attribute","startLoc":27,"text":"HIERARCH_VALUE_INDICATOR"},{"attributeType":"Undefined","col":0,"comment":"null","endLoc":38,"id":1506,"name":"UNDEFINED","nodeType":"Attribute","startLoc":38,"text":"UNDEFINED"},{"col":0,"comment":"","endLoc":3,"header":"card.py#<anonymous>","id":1507,"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\nHIERARCH_VALUE_INDICATOR = '='  # HIERARCH cards may use a shortened indicator\n\nUNDEFINED = Undefined()"},{"col":4,"comment":"null","endLoc":208,"header":"def _init_tbdata(self, data)","id":1508,"name":"_init_tbdata","nodeType":"Function","startLoc":187,"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":"null","endLoc":1105,"header":"def __matmul__(self, other, reverse=False)","id":1509,"name":"__matmul__","nodeType":"Function","startLoc":1102,"text":"def __matmul__(self, other, reverse=False):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(self.value, getattr(other, 'value', other))\n        return self._new_view(result_array, result_unit)"},{"id":1510,"name":"astropy/io/fits/hdu","nodeType":"Package"},{"fileName":"hdulist.py","filePath":"astropy/io/fits/hdu","id":1511,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\n\nimport bz2\nimport gzip\nimport itertools\nimport os\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 ..file import _File\nfrom ..header import _pad_length\nfrom ..util import (_is_int, _tmp_name, fileobj_closed, ignore_sigint,\n                    _get_array_mmap, _free_space_check)\nfrom ..verify import _Verify, _ErrList, VerifyError, VerifyWarning\nfrom ....utils import indent\nfrom ....utils.exceptions import AstropyUserWarning\nfrom ....utils.decorators import deprecated_renamed_argument\n\n\ndef fitsopen(name, mode='readonly', memmap=None, save_backup=False,\n             cache=True, lazy_load_hdus=None, **kwargs):\n    \"\"\"Factory function to open a FITS file and return an `HDUList` object.\n\n    Parameters\n    ----------\n    name : file path, file object, file-like object or pathlib.Path object\n        File to be opened.\n\n    mode : str, optional\n        Open mode, 'readonly' (default), 'update', 'append', 'denywrite', or\n        'ostream'.\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?\n\n    save_backup : bool, optional\n        If the file was opened in update or append mode, this ensures that a\n        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\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: `True`).\n\n    lazy_load_hdus : bool, option\n        By default `~astropy.io.fits.open` will not read all the HDUs and\n        headers in a FITS file immediately upon opening.  This is an\n        optimization especially useful for large files, as FITS has no way\n        of determining the number and offsets of all the HDUs in a file\n        without scanning through the file and reading all the headers.\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    kwargs : dict, optional\n        additional optional keyword arguments, possible values are:\n\n        - **uint** : bool\n\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            This is enabled by default so that the pseudo-unsigned\n            integer convention is assumed.\n\n            Note, for backward compatibility, the kwarg **uint16** may\n            be used instead.  The kwarg was renamed when support was\n            added for integers of any size.\n\n        - **ignore_missing_end** : bool\n\n            Do not issue an exception when opening a file that is\n            missing an ``END`` card in the last header.\n\n        - **checksum** : bool, str\n\n            If `True`, verifies that both ``DATASUM`` and\n            ``CHECKSUM`` card values (when present in the HDU header)\n            match the header and data of all HDU's in the file.  Updates to a\n            file that already has a checksum will preserve and update the\n            existing checksums unless this argument is given a value of\n            'remove', in which case the CHECKSUM and DATASUM values are not\n            checked, and are removed when saving changes to the file.\n\n        - **disable_image_compression** : bool\n\n            If `True`, treats compressed image HDU's like normal\n            binary table HDU's.\n\n        - **do_not_scale_image_data** : bool\n\n            If `True`, image data is not scaled using BSCALE/BZERO values\n            when read.\n\n        - **character_as_bytes** : bool\n\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        - **ignore_blank** : bool\n\n            If `True`, the BLANK keyword is ignored if present.\n\n        - **scale_back** : bool\n\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.\n\n    Returns\n    -------\n        hdulist : an `HDUList` object\n            `HDUList` containing all of the header data units in the\n            file.\n\n    \"\"\"\n\n    from .. 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('Empty filename: {!r}'.format(name))\n\n    return HDUList.fromfile(name, mode, memmap, save_backup, cache,\n                            lazy_load_hdus, **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 : sequence of HDU objects or single HDU, 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 object, 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        self._save_backup = False\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(\"Element {} in the HDUList input is \"\n                                \"not an HDU.\".format(idx))\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 initalizing 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            while self._read_next_hdu():\n                pass\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        while self._read_next_hdu():\n            pass\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 ``HDUList.index_of(item)`` succeeds.\n        \"\"\"\n\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except KeyError:\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('{} is not an HDU.'.format(item))\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError('{} is not an HDU.'.format(hdu))\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError('Extension {} is out of bound or not found.'\n                            .format(key))\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        self.close()\n\n    @classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 **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                             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, memoryview, etc.\n            A string or other memory buffer containing an entire FITS file.  It\n            should be noted that if that memory is read-only (such as a Python\n            string) the returned :class:`HDUList`'s data portions will also be\n            read-only.\n\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 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 : HDU object\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('{} is not an HDU.'.format(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 : HDU object\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 or tuple of (string, int)\n           The key identifying the HDU.  If ``key`` is a tuple, it is of the\n           form ``(key, 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        Returns\n        -------\n        index : int\n           The index of the HDU in the `HDUList`.\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = 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('Extension {!r} not found.'.format(key))\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                'Extension {} is out of bound or not found.'.format(index))\n\n        return len(self) + index\n\n    def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n\n        for hdu in self:\n            if hdu.data is not None:\n                continue\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:`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        if self._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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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        # writeto is only for writing a new file from scratch, so the most\n        # sensible mode to require is 'ostream'.  This can accept an open\n        # file object that's open to write only, or in append/update modes\n        # but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except AttributeError:\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:`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, 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 = ['Filename: {}'.format(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 : a string containing the file name associated with the\n                   HDUList object if an association exists.  Otherwise returns\n                   None.\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,\n                  memmap=None, save_backup=False, cache=True,\n                  lazy_load_hdus=True, **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        hdulist._save_backup = save_backup\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:\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 = (\"HDUList's element {} is not an \"\n                            \"extension HDU.\".format(str(idx)))\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                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                        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"},{"col":4,"comment":"null","endLoc":1110,"header":"def __rmatmul__(self, other)","id":1512,"name":"__rmatmul__","nodeType":"Function","startLoc":1107,"text":"def __rmatmul__(self, other):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(getattr(other, 'value', other), self.value)\n        return self._new_view(result_array, result_unit)"},{"col":4,"comment":"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        ","endLoc":221,"header":"def _update_column_added(self, columns, column)","id":1513,"name":"_update_column_added","nodeType":"Function","startLoc":210,"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\n        # TODO: It's not clear that this actually works--it probably does not.\n        # This is what the code used to do before introduction of the\n        # notifier interface, but I don't believe it actually worked (there are\n        # several bug reports related to this...)\n        if self._data_loaded:\n            del self.data"},{"col":4,"comment":"\n        Update the data upon removal of a column through the `ColDefs`\n        interface.\n        ","endLoc":234,"header":"def _update_column_removed(self, columns, col_idx)","id":1514,"name":"_update_column_removed","nodeType":"Function","startLoc":223,"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\n        # For now this doesn't do anything fancy--it just deletes the data\n        # attribute so that it is forced to be recreated again.  It doesn't\n        # change anything on the existing data recarray (this is also how this\n        # worked before introducing the notifier interface)\n        if self._data_loaded:\n            del self.data"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":1515,"name":"_data_type","nodeType":"Attribute","startLoc":55,"text":"_data_type"},{"col":4,"comment":"null","endLoc":874,"header":"def _repr_html_(self)","id":1516,"name":"_repr_html_","nodeType":"Function","startLoc":872,"text":"def _repr_html_(self):\n        return self._base_repr_(html=True, max_width=-1,\n                                tableclass=conf.default_notebook_table_class)"},{"col":8,"comment":"Plus the quantity.","endLoc":1117,"header":"def __pos__(self)","id":1517,"name":"__pos__","nodeType":"Function","startLoc":1115,"text":"def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return self.copy()"},{"col":4,"comment":"null","endLoc":877,"header":"def __repr__(self)","id":1518,"name":"__repr__","nodeType":"Function","startLoc":876,"text":"def __repr__(self):\n        return self._base_repr_(html=False, max_width=None)"},{"col":8,"comment":"Plus the quantity.","endLoc":1126,"header":"def __pos__(self)","id":1519,"name":"__pos__","nodeType":"Function","startLoc":1124,"text":"def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return np.positive(self)"},{"col":4,"comment":"null","endLoc":1130,"header":"def __hash__(self)","id":1520,"name":"__hash__","nodeType":"Function","startLoc":1129,"text":"def __hash__(self):\n        return hash(self.value) ^ hash(self.unit)"},{"col":4,"comment":"null","endLoc":1143,"header":"def __iter__(self)","id":1521,"name":"__iter__","nodeType":"Function","startLoc":1132,"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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":1522,"name":"_columns_type","nodeType":"Attribute","startLoc":56,"text":"_columns_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":60,"id":1523,"name":"_uint","nodeType":"Attribute","startLoc":60,"text":"_uint"},{"className":"AstropyDeprecationWarning","col":0,"comment":"\n    A warning class to indicate a deprecated feature.\n    ","endLoc":28,"id":1524,"nodeType":"Class","startLoc":25,"text":"class AstropyDeprecationWarning(AstropyWarning):\n    \"\"\"\n    A warning class to indicate a deprecated feature.\n    \"\"\""},{"col":4,"comment":"null","endLoc":1161,"header":"def __getitem__(self, key)","id":1526,"name":"__getitem__","nodeType":"Function","startLoc":1145,"text":"def __getitem__(self, key):\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 type(out) is not type(self):\n            out = self._new_view(out)\n        return out"},{"col":4,"comment":"null","endLoc":880,"header":"def __str__(self)","id":1527,"name":"__str__","nodeType":"Function","startLoc":879,"text":"def __str__(self):\n        return '\\n'.join(self.pformat())"},{"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":860,"id":1528,"nodeType":"Class","startLoc":767,"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        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except OSError:\n                offset = 0\n\n        if self.data is not None:\n            if not fileobj.simulateonly:\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"},{"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":196,"id":1529,"nodeType":"Class","startLoc":51,"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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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(\"File {0} exists, aborting (pass in \"\n                              \"overwrite=True to overwrite)\".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(indent(text, self._indent) + '\\n')\n\n    def _diff(self):\n        raise NotImplementedError\n\n    def _report(self):\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":1169,"header":"def __setitem__(self, i, value)","id":1530,"name":"__setitem__","nodeType":"Function","startLoc":1163,"text":"def __setitem__(self, i, value):\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        Matches any HDU that has the 'SIMPLE' keyword but is not a standard\n        Primary or Groups HDU.\n        ","endLoc":802,"header":"@classmethod\n    def match_header(cls, header)","id":1531,"name":"match_header","nodeType":"Function","startLoc":784,"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":813,"header":"@property\n    def size(self)","id":1532,"name":"size","nodeType":"Function","startLoc":804,"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":840,"header":"def _writedata(self, fileobj)","id":1533,"name":"_writedata","nodeType":"Function","startLoc":815,"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        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except OSError:\n                offset = 0\n\n        if self.data is not None:\n            if not fileobj.simulateonly:\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":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":81,"header":"def __init__(self, a, b)","id":1534,"name":"__init__","nodeType":"Function","startLoc":66,"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":"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        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        ","endLoc":1180,"header":"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":1535,"name":"pformat","nodeType":"Function","startLoc":1111,"text":"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        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\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('Length = {0} rows'.format(len(self)))\n\n        return lines"},{"col":4,"comment":"Quantities should always be treated as non-False; there is too much\n        potential for ambiguity otherwise.\n        ","endLoc":1180,"header":"def __bool__(self)","id":1536,"name":"__bool__","nodeType":"Function","startLoc":1173,"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":1187,"header":"def __len__(self)","id":1537,"name":"__len__","nodeType":"Function","startLoc":1182,"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)"},{"col":4,"comment":"null","endLoc":1195,"header":"def __float__(self)","id":1538,"name":"__float__","nodeType":"Function","startLoc":1190,"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":"null","endLoc":883,"header":"def __bytes__(self)","id":1539,"name":"__bytes__","nodeType":"Function","startLoc":882,"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":891,"header":"@property\n    def has_mixin_columns(self)","id":1540,"name":"has_mixin_columns","nodeType":"Function","startLoc":885,"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":"null","endLoc":1202,"header":"def __int__(self)","id":1541,"name":"__int__","nodeType":"Function","startLoc":1197,"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":"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        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        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        ","endLoc":957,"header":"def pprint(self, max_lines=None, max_width=None, show_name=True,\n               show_unit=None, show_dtype=False, align=None)","id":1542,"name":"pprint","nodeType":"Function","startLoc":905,"text":"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        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        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        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('Length = {0} rows'.format(len(self)))\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":193,"header":"def _diff(self)","id":1543,"name":"_diff","nodeType":"Function","startLoc":192,"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":89,"header":"def __bool__(self)","id":1544,"name":"__bool__","nodeType":"Function","startLoc":83,"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":116,"header":"@classmethod\n    def fromdiff(cls, other, a, b)","id":1545,"name":"fromdiff","nodeType":"Function","startLoc":91,"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":843,"header":"def _summary(self)","id":1546,"name":"_summary","nodeType":"Function","startLoc":842,"text":"def _summary(self):\n        return (self.name, self.ver, 'NonstandardHDU', len(self._header))"},{"col":4,"comment":"\n        Return the file data.\n        ","endLoc":851,"header":"@lazyproperty\n    def data(self)","id":1547,"name":"data","nodeType":"Function","startLoc":845,"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":1212,"header":"def __index__(self)","id":1548,"name":"__index__","nodeType":"Function","startLoc":1204,"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')"},{"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_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            .. versionchanged:: 2.0\n               ``rtol`` replaces the deprecated ``tolerance`` argument.\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":325,"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, tolerance=None)","id":1549,"name":"__init__","nodeType":"Function","startLoc":213,"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, tolerance=None):\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_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            .. versionchanged:: 2.0\n               ``rtol`` replaces the deprecated ``tolerance`` argument.\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):\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):\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_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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.ignore_blanks = ignore_blanks\n        self.ignore_blank_cards = ignore_blank_cards\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":860,"header":"def _verify(self, option='warn')","id":1550,"name":"_verify","nodeType":"Function","startLoc":853,"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":4,"comment":"null","endLoc":965,"header":"def _make_index_row_display_table(self, index_row_name)","id":1551,"name":"_make_index_row_display_table","nodeType":"Function","startLoc":959,"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] + self.columns.values(),\n                                           copy=False)\n        else:\n            return self"},{"col":4,"comment":"null","endLoc":1224,"header":"@property\n    def _unitstr(self)","id":1552,"name":"_unitstr","nodeType":"Function","startLoc":1214,"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":1229,"header":"def __str__(self)","id":1553,"name":"__str__","nodeType":"Function","startLoc":1228,"text":"def __str__(self):\n        return '{0}{1:s}'.format(self.value, self._unitstr)"},{"attributeType":"null","col":4,"comment":"null","endLoc":782,"id":1554,"name":"_standard","nodeType":"Attribute","startLoc":782,"text":"_standard"},{"col":4,"comment":"null","endLoc":1236,"header":"def __repr__(self)","id":1555,"name":"__repr__","nodeType":"Function","startLoc":1231,"text":"def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        sep = ',' if NUMPY_LT_1_14 else ', '\n        arrstr = np.array2string(self.view(np.ndarray), separator=sep,\n                                 prefix=prefixstr)\n        return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)"},{"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":1556,"id":1556,"nodeType":"Class","startLoc":1506,"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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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":1524,"header":"@classmethod\n    def match_header(cls, header)","id":1557,"name":"match_header","nodeType":"Function","startLoc":1516,"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\n        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\n        ","endLoc":1543,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def writeto(self, name, output_verify='exception', overwrite=False,\n                checksum=False)","id":1558,"name":"writeto","nodeType":"Function","startLoc":1526,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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":"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 <http://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : string\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":1030,"header":"def show_in_notebook(self, tableid=None, css=None, display_length=50,\n                         table_class='astropy-default', show_row_index='idx')","id":1559,"name":"show_in_notebook","nodeType":"Function","startLoc":967,"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 <http://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : string\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 = 'table{0}-{1}'.format(id(self),\n                                            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.dtype.kind in 'iufc']\n        html += jsv.ipynb(tableid, css=css, sort_columns=sortable_columns)\n        return HTML(html)"},{"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":130,"header":"@property\n    def identical(self)","id":1560,"name":"identical","nodeType":"Function","startLoc":118,"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":"\n        Generate a latex 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        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        ","endLoc":1292,"header":"def _repr_latex_(self)","id":1561,"name":"_repr_latex_","nodeType":"Function","startLoc":1238,"text":"def _repr_latex_(self):\n        \"\"\"\n        Generate a latex 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        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # need to do try/finally because \"threshold\" cannot be overridden\n        # with array2string\n        pops = np.get_printoptions()\n\n        format_spec = '.{}g'.format(pops['precision'])\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        try:\n            formatter = {'float_kind': float_formatter}\n            if conf.latex_array_threshold > -1:\n                np.set_printoptions(threshold=conf.latex_array_threshold,\n                                    formatter=formatter)\n\n            # the view is needed for the scalar case - value might be float\n            if NUMPY_LT_1_14:   # style deprecated in 1.14\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    style=(float_formatter if self.dtype.kind == 'f'\n                           else repr),\n                    max_line_width=np.inf, separator=',~')\n            else:\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    max_line_width=np.inf, separator=',~')\n\n            latex_value = latex_value.replace('...', r'\\dots')\n        finally:\n            np.set_printoptions(**pops)\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        return r'${0} \\; {1}$'.format(latex_value, latex_unit)"},{"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 object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\n\n        Returns\n        -------\n        report : str or None\n        ","endLoc":187,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def report(self, fileobj=None, indent=0, overwrite=False)","id":1562,"name":"report","nodeType":"Function","startLoc":132,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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(\"File {0} exists, aborting (pass in \"\n                              \"overwrite=True to overwrite)\".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":"null","endLoc":339,"header":"def _diff(self)","id":1563,"name":"_diff","nodeType":"Function","startLoc":327,"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        # For now, just compare the extensions one by one in order...might\n        # allow some more sophisticated types of diffing later...\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                self.diff_hdus.append((idx, hdu_diff))"},{"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":123,"header":"@classmethod\n    def format_exponential_notation(cls, val, format_spec=\".8g\")","id":1564,"name":"format_exponential_notation","nodeType":"Function","startLoc":87,"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(\"10^{{{0}}}\".format(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'"},{"col":4,"comment":"null","endLoc":132,"header":"def __init__(self, use_local_files=False, display_length=50)","id":1565,"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":"\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":1264,"header":"def _scale_back_ascii(self, col_idx, input_field, output_field)","id":1566,"name":"_scale_back_ascii","nodeType":"Function","startLoc":1196,"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.replace(encode_ascii('E'), encode_ascii('D'))"},{"col":4,"comment":"null","endLoc":196,"header":"def _report(self)","id":1567,"name":"_report","nodeType":"Function","startLoc":195,"text":"def _report(self):\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":399,"header":"def _report(self)","id":1568,"name":"_report","nodeType":"Function","startLoc":341,"text":"def _report(self):\n        wrapper = textwrap.TextWrapper(initial_indent='  ',\n                                       subsequent_indent='  ')\n\n        # print out heading and parameter values\n        filenamea = self.a.filename()\n        if not filenamea:\n            filenamea = '<{} object at {:#x}>'.format(\n                self.a.__class__.__name__, id(self.a))\n\n        filenameb = self.b.filename()\n        if not filenameb:\n            filenameb = '<{} object at {:#x}>'.format(\n                self.b.__class__.__name__, id(self.b))\n\n        self._fileobj.write('\\n')\n        self._writeln(' fitsdiff: {}'.format(__version__))\n        self._writeln(' a: {}\\n b: {}'.format(filenamea, filenameb))\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        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        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(' a: {}'.format(self.diff_hdu_count[0]))\n            self._writeln(' b: {}'.format(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 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                self._writeln('Extension HDU {}:'.format(idx))\n            hdu_diff.report(self._fileobj, indent=self._indent + 1)"},{"col":4,"comment":"null","endLoc":1556,"header":"def _verify(self, option='warn')","id":1569,"name":"_verify","nodeType":"Function","startLoc":1545,"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":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":75,"header":"def split_mantissa_exponent(v, format_spec=\".8g\")","id":1570,"name":"split_mantissa_exponent","nodeType":"Function","startLoc":45,"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"},{"col":4,"comment":"null","endLoc":190,"header":"def _writeln(self, text)","id":1571,"name":"_writeln","nodeType":"Function","startLoc":189,"text":"def _writeln(self, text):\n        self._fileobj.write(indent(text, self._indent) + '\\n')"},{"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 : string\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":1109,"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":1572,"name":"show_in_browser","nodeType":"Function","startLoc":1032,"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 : string\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(\"Browser '{}' not found.\".format(browser))\n        else:\n            br.open(urljoin('file:', pathname2url(path)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":74,"id":1573,"name":"a","nodeType":"Attribute","startLoc":74,"text":"self.a"},{"col":44,"endLoc":1551,"id":1574,"nodeType":"Lambda","startLoc":1551,"text":"lambda v: (_is_int(v) and v >= 0)"},{"col":44,"endLoc":1553,"id":1575,"nodeType":"Lambda","startLoc":1553,"text":"lambda v: (_is_int(v) and v == 1)"},{"col":4,"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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.write`).\n        ","endLoc":2544,"header":"def write(self, *args, **kwargs)","id":1576,"name":"write","nodeType":"Function","startLoc":2529,"text":"def write(self, *args, **kwargs):\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.write`).\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":75,"id":1577,"name":"b","nodeType":"Attribute","startLoc":75,"text":"self.b"},{"attributeType":"null","col":4,"comment":"null","endLoc":1514,"id":1578,"name":"_extension","nodeType":"Attribute","startLoc":1514,"text":"_extension"},{"attributeType":"null","col":8,"comment":"null","endLoc":79,"id":1579,"name":"_indent","nodeType":"Attribute","startLoc":79,"text":"self._indent"},{"className":"GroupsHDU","col":0,"comment":"\n    FITS Random Groups HDU class.\n\n    See the :ref:`random-groups` section in the Astropy documentation for more\n    details on working with this type of HDU.\n    ","endLoc":583,"id":1580,"nodeType":"Class","startLoc":252,"text":"class GroupsHDU(PrimaryHDU, _TableLikeHDU):\n    \"\"\"\n    FITS Random Groups HDU class.\n\n    See the :ref:`random-groups` section in the Astropy documentation for more\n    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\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        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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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 = '{} Groups  {} Parameters'.format(self._gcount, self._pcount)\n        return (name, ver, classname, length, shape, format, gcount)"},{"attributeType":"None","col":8,"comment":"null","endLoc":78,"id":1581,"name":"_fileobj","nodeType":"Attribute","startLoc":78,"text":"self._fileobj"},{"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":524,"id":1582,"nodeType":"Class","startLoc":402,"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, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\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        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        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\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)"},{"col":4,"comment":"\n        See `FITSDiff` for explanations of the initialization parameters.\n        ","endLoc":463,"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, tolerance=None)","id":1583,"name":"__init__","nodeType":"Function","startLoc":431,"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, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\n\n        self.numdiffs = numdiffs\n        self.ignore_blanks = ignore_blanks\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)"},{"className":"PrimaryHDU","col":0,"comment":"\n    FITS primary HDU class.\n    ","endLoc":1041,"id":1584,"nodeType":"Class","startLoc":949,"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 DELAYED, optional\n            The data in the HDU.\n\n        header : Header instance, 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"},{"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":852,"id":1585,"nodeType":"Class","startLoc":16,"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 header is not None:\n            if not isinstance(header, Header):\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        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\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            # 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 set set _bitpix, _bzero, and _bscale to the\n            # appropriate BITPIX for the data, and always sets _bzero=0 and\n            # _bscale=1.\n            self.data = data\n            self.update_header()\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:`data-sections` section of the Astropy documentation for more\n        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_unsigned(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if data is not None and not isinstance(data, np.ndarray):\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        self.__dict__['data'] = data\n        self._modified = True\n\n        if isinstance(data, np.ndarray):\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        elif self.data is None:\n            self._axes = []\n        else:\n            raise ValueError('not a valid data array')\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_uint_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        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            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            # 0.9.6.3 to avoid out of range error for BZERO = +32768\n            # We have to explcitly 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: {0!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 not None:\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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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 _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 _convert_pseudo_unsigned(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_unsigned(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 += ' (rescales to {0})'.format(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_unsigned(self.data.dtype):\n                d = np.array(self.data - _unsigned_zero(self.data.dtype),\n                             dtype='i{}'.format(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_unsigned(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()"},{"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":1312,"header":"def __format__(self, format_spec)","id":1586,"name":"__format__","nodeType":"Function","startLoc":1294,"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(\"{0}{1:s}\".format(value, self._unitstr),\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 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":1334,"header":"def decompose(self, bases=[])","id":1587,"name":"decompose","nodeType":"Function","startLoc":1314,"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 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":1372,"header":"def _decompose(self, allowscaledunits=False, bases=[])","id":1588,"name":"_decompose","nodeType":"Function","startLoc":1336,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":313,"id":1589,"name":"ignore_blanks","nodeType":"Attribute","startLoc":313,"text":"self.ignore_blanks"},{"attributeType":"null","col":8,"comment":"null","endLoc":297,"id":1590,"name":"ignore_keywords","nodeType":"Attribute","startLoc":297,"text":"self.ignore_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":314,"id":1591,"name":"ignore_blank_cards","nodeType":"Attribute","startLoc":314,"text":"self.ignore_blank_cards"},{"attributeType":"null","col":8,"comment":"null","endLoc":301,"id":1592,"name":"numdiffs","nodeType":"Attribute","startLoc":301,"text":"self.numdiffs"},{"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":183,"header":"@classmethod\n    def match_header(cls, header)","id":1593,"name":"match_header","nodeType":"Function","startLoc":176,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":316,"id":1594,"name":"diff_hdu_count","nodeType":"Attribute","startLoc":316,"text":"self.diff_hdu_count"},{"col":4,"comment":"null","endLoc":187,"header":"@property\n    def is_image(self)","id":1595,"name":"is_image","nodeType":"Function","startLoc":185,"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:`data-sections` section of the Astropy documentation for more\n        details.\n        ","endLoc":204,"header":"@property\n    def section(self)","id":1596,"name":"section","nodeType":"Function","startLoc":189,"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:`data-sections` section of the Astropy documentation for more\n        details.\n        \"\"\"\n\n        return Section(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":317,"id":1597,"name":"diff_hdus","nodeType":"Attribute","startLoc":317,"text":"self.diff_hdus"},{"attributeType":"null","col":12,"comment":"null","endLoc":310,"id":1598,"name":"rtol","nodeType":"Attribute","startLoc":310,"text":"self.rtol"},{"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":1218,"header":"def more(self, max_lines=None, max_width=None, show_name=True,\n             show_unit=None, show_dtype=False)","id":1599,"name":"more","nodeType":"Function","startLoc":1182,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":298,"id":1600,"name":"ignore_comments","nodeType":"Attribute","startLoc":298,"text":"self.ignore_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":303,"id":1601,"name":"atol","nodeType":"Attribute","startLoc":303,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":299,"id":1602,"name":"ignore_fields","nodeType":"Attribute","startLoc":299,"text":"self.ignore_fields"},{"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":1361,"id":1603,"nodeType":"Class","startLoc":167,"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 : sequence of HDU objects or single HDU, 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 object, 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        self._save_backup = False\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(\"Element {} in the HDUList input is \"\n                                \"not an HDU.\".format(idx))\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 initalizing 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            while self._read_next_hdu():\n                pass\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        while self._read_next_hdu():\n            pass\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 ``HDUList.index_of(item)`` succeeds.\n        \"\"\"\n\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except KeyError:\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('{} is not an HDU.'.format(item))\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError('{} is not an HDU.'.format(hdu))\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError('Extension {} is out of bound or not found.'\n                            .format(key))\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        self.close()\n\n    @classmethod\n    def fromfile(cls, fileobj, mode=None, memmap=None,\n                 save_backup=False, cache=True, lazy_load_hdus=True,\n                 **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                             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, memoryview, etc.\n            A string or other memory buffer containing an entire FITS file.  It\n            should be noted that if that memory is read-only (such as a Python\n            string) the returned :class:`HDUList`'s data portions will also be\n            read-only.\n\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 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 : HDU object\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('{} is not an HDU.'.format(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 : HDU object\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 or tuple of (string, int)\n           The key identifying the HDU.  If ``key`` is a tuple, it is of the\n           form ``(key, 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        Returns\n        -------\n        index : int\n           The index of the HDU in the `HDUList`.\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = 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('Extension {!r} not found.'.format(key))\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                'Extension {} is out of bound or not found.'.format(index))\n\n        return len(self) + index\n\n    def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n\n        for hdu in self:\n            if hdu.data is not None:\n                continue\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:`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        if self._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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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        # writeto is only for writing a new file from scratch, so the most\n        # sensible mode to require is 'ostream'.  This can accept an open\n        # file object that's open to write only, or in append/update modes\n        # but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except AttributeError:\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:`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, 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 = ['Filename: {}'.format(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 : a string containing the file name associated with the\n                   HDUList object if an association exists.  Otherwise returns\n                   None.\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,\n                  memmap=None, save_backup=False, cache=True,\n                  lazy_load_hdus=True, **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        hdulist._save_backup = save_backup\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:\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 = (\"HDUList's element {} is not an \"\n                            \"extension HDU.\".format(str(idx)))\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                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                        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":244,"header":"def __len__(self)","id":1604,"name":"__len__","nodeType":"Function","startLoc":239,"text":"def __len__(self):\n        if not self._in_read_next_hdu:\n            while self._read_next_hdu():\n                pass\n\n        return super().__len__()"},{"col":4,"comment":"null","endLoc":1254,"header":"def __getitem__(self, item)","id":1605,"name":"__getitem__","nodeType":"Function","startLoc":1220,"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 (isinstance(item, (tuple, list)) and item and\n              all(isinstance(x, str) for x in item)):\n            bad_names = [x for x in item if x not in self.colnames]\n            if bad_names:\n                raise ValueError('Slice name(s) {0} not valid column name(s)'\n                                 .format(', '.join(bad_names)))\n            out = self.__class__([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        elif ((isinstance(item, np.ndarray) and item.size == 0) or\n              (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) or\n              isinstance(item, np.ndarray) or\n              isinstance(item, list) or\n              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('Illegal type {0} for table item access'\n                             .format(type(item)))"},{"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":1134,"header":"def _read_next_hdu(self)","id":1606,"name":"_read_next_hdu","nodeType":"Function","startLoc":1050,"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":1379,"header":"def item(self, *args)","id":1607,"name":"item","nodeType":"Function","startLoc":1378,"text":"def item(self, *args):\n        return self._new_view(super().item(*args))"},{"col":4,"comment":"null","endLoc":1383,"header":"def tolist(self)","id":1608,"name":"tolist","nodeType":"Function","startLoc":1381,"text":"def tolist(self):\n        raise NotImplementedError(\"cannot make a list of Quantities.  Get \"\n                                  \"list of values with q.value.list()\")"},{"col":4,"comment":"null","endLoc":1194,"header":"def _scale_back_strings(self, col_idx, input_field, output_field)","id":1609,"name":"_scale_back_strings","nodeType":"Function","startLoc":1154,"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 '{0}': Contains characters that \"\n                    \"cannot be encoded as ASCII as required by FITS, starting \"\n                    \"at the index {1!r} of the column, and the index {2} 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":1421,"header":"def itemset(self, *args)","id":1610,"name":"itemset","nodeType":"Function","startLoc":1416,"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]),)))"},{"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":1322,"header":"def _ascii_encode(inarray, out=None)","id":1611,"name":"_ascii_encode","nodeType":"Function","startLoc":1290,"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(('S{0}'.format(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":"\n        Shape of the image array--should be equivalent to ``self.data.shape``.\n        ","endLoc":213,"header":"@property\n    def shape(self)","id":1612,"name":"shape","nodeType":"Function","startLoc":206,"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":217,"header":"@property\n    def header(self)","id":1613,"name":"header","nodeType":"Function","startLoc":215,"text":"@property\n    def header(self):\n        return self._header"},{"col":4,"comment":"null","endLoc":223,"header":"@header.setter\n    def header(self, header)","id":1614,"name":"header","nodeType":"Function","startLoc":219,"text":"@header.setter\n    def header(self, header):\n        self._header = header\n        self._modified = True\n        self.update_header()"},{"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":246,"header":"@lazyproperty\n    def data(self)","id":1615,"name":"data","nodeType":"Function","startLoc":225,"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        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":771,"header":"def _get_scaled_image_data(self, offset, shape)","id":1616,"name":"_get_scaled_image_data","nodeType":"Function","startLoc":700,"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_unsigned(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":"\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":698,"header":"def _convert_pseudo_unsigned(self, data)","id":1617,"name":"_convert_pseudo_unsigned","nodeType":"Function","startLoc":676,"text":"def _convert_pseudo_unsigned(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":"null","endLoc":307,"header":"def __init__(self, parent_table, indices=None, keys=None)","id":1618,"name":"__init__","nodeType":"Function","startLoc":304,"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":497,"header":"def _diff(self)","id":1619,"name":"_diff","nodeType":"Function","startLoc":465,"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        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        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)"},{"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":674,"header":"def _dtype_for_bitpix(self)","id":1620,"name":"_dtype_for_bitpix","nodeType":"Function","startLoc":655,"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":1425,"header":"def tostring(self, order='C')","id":1621,"name":"tostring","nodeType":"Function","startLoc":1423,"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":1429,"header":"def tofile(self, fid, sep=\"\", format=\"%s\")","id":1622,"name":"tofile","nodeType":"Function","startLoc":1427,"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":1433,"header":"def dump(self, file)","id":1623,"name":"dump","nodeType":"Function","startLoc":1431,"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":1437,"header":"def dumps(self)","id":1624,"name":"dumps","nodeType":"Function","startLoc":1435,"text":"def dumps(self):\n        raise NotImplementedError(\"cannot dump Quantities to string.  Write \"\n                                  \"array with q.value.dumps()\")"},{"col":4,"comment":"null","endLoc":1442,"header":"def fill(self, value)","id":1625,"name":"fill","nodeType":"Function","startLoc":1441,"text":"def fill(self, value):\n        self.view(np.ndarray).fill(self._to_own_unit(value))"},{"col":4,"comment":"null","endLoc":1287,"header":"def __init__(self, encoding, object_, start, end, reason, index)","id":1626,"name":"__init__","nodeType":"Function","startLoc":1285,"text":"def __init__(self, encoding, object_, start, end, reason, index):\n        super().__init__(encoding, object_, start, end, reason)\n        self.index = index"},{"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":1457,"header":"@property\n    def flat(self)","id":1627,"name":"flat","nodeType":"Function","startLoc":1448,"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)"},{"col":4,"comment":"null","endLoc":252,"header":"def __repr__(self)","id":1628,"name":"__repr__","nodeType":"Function","startLoc":246,"text":"def __repr__(self):\n        # In order to correctly repr an HDUList we need to load all the\n        # HDUs as well\n        while self._read_next_hdu():\n            pass\n\n        return super().__repr__()"},{"col":4,"comment":"null","endLoc":82,"header":"def __init__(self, q)","id":1629,"name":"__init__","nodeType":"Function","startLoc":80,"text":"def __init__(self, q):\n        self._quantity = q\n        self._dataiter = q.view(np.ndarray).flat"},{"col":4,"comment":"null","endLoc":264,"header":"def __iter__(self)","id":1630,"name":"__iter__","nodeType":"Function","startLoc":254,"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":"null","endLoc":1462,"header":"@flat.setter\n    def flat(self, value)","id":1631,"name":"flat","nodeType":"Function","startLoc":1459,"text":"@flat.setter\n    def flat(self, value):\n        y = self.ravel()\n        y[:] = value"},{"col":4,"comment":"\n        Get an HDU from the `HDUList`, indexed by number or name.\n        ","endLoc":323,"header":"def __getitem__(self, key)","id":1632,"name":"__getitem__","nodeType":"Function","startLoc":266,"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":"FITS_record","col":4,"comment":"null","endLoc":154,"id":1633,"name":"_record_type","nodeType":"Attribute","startLoc":154,"text":"_record_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":1634,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":155,"text":"_character_as_bytes"},{"attributeType":"null","col":12,"comment":"null","endLoc":222,"id":1635,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":222,"text":"self._character_as_bytes"},{"col":4,"comment":"null","endLoc":1467,"header":"def put(self, indices, values, mode='raise')","id":1636,"name":"put","nodeType":"Function","startLoc":1466,"text":"def put(self, indices, values, mode='raise'):\n        self.view(np.ndarray).put(indices, self._to_own_unit(values), mode)"},{"col":4,"comment":"\n        Delete BSCALE/BZERO from header if necessary.\n        ","endLoc":428,"header":"def _update_header_scale_info(self, dtype=None)","id":1637,"name":"_update_header_scale_info","nodeType":"Function","startLoc":377,"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        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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":227,"id":1638,"name":"_heapsize","nodeType":"Attribute","startLoc":227,"text":"self._heapsize"},{"attributeType":"null","col":12,"comment":"null","endLoc":232,"id":1639,"name":"_uint","nodeType":"Attribute","startLoc":232,"text":"self._uint"},{"col":4,"comment":"null","endLoc":1364,"header":"def __setitem__(self, item, value)","id":1640,"name":"__setitem__","nodeType":"Function","startLoc":1256,"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            NewColumn = self.MaskedColumn if self.masked else self.Column\n            # If value doesn't have a dtype and won't be added as a mixin then\n            # convert to a numpy array.\n            if not hasattr(value, 'dtype') and not self._add_as_mixin_column(value):\n                value = np.asarray(value)\n\n            # Structured ndarray gets viewed as a mixin (unless already a valid\n            # mixin class).\n            if (isinstance(value, np.ndarray) and len(value.dtype) > 1 and\n                    not self._add_as_mixin_column(value)):\n                value = value.view(NdarrayMixin)\n\n            # Make new column and assign the value.  If the table currently\n            # has no rows (len=0) of the value is already a Column then\n            # define new column directly from value.  In the latter case\n            # this allows for propagation of Column metadata.  Otherwise\n            # define a new column with the right length and shape and then\n            # set it from value.  This allows for broadcasting, e.g. t['a']\n            # = 1.\n            name = item\n            # If this is a column-like object that could be added directly to table\n            if isinstance(value, BaseColumn) or self._add_as_mixin_column(value):\n                # If we're setting a new column to a scalar, broadcast it.\n                # (things will fail in _init_from_cols if this doesn't work)\n                if (len(self) > 0 and (getattr(value, 'isscalar', False) or\n                                       getattr(value, 'shape', None) == () or\n                                       len(value) == 1)):\n                    new_shape = (len(self),) + getattr(value, 'shape', ())[1:]\n                    if isinstance(value, np.ndarray):\n                        value = np.broadcast_to(value, shape=new_shape,\n                                                subok=True)\n                    elif isinstance(value, ShapedLikeNDArray):\n                        value = value._apply(np.broadcast_to, shape=new_shape,\n                                             subok=True)\n\n                new_column = col_copy(value)\n                new_column.info.name = name\n\n            elif len(self) == 0:\n                new_column = NewColumn(value, name=name)\n            else:\n                new_column = NewColumn(name=name, length=len(self), dtype=value.dtype,\n                                       shape=value.shape[1:],\n                                       unit=getattr(value, 'unit', None))\n                new_column[:] = value\n\n            # Now add new column to the table\n            self.add_columns([new_column], copy=False)\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                # Set the corresponding row assuming value is an iterable.\n                if not hasattr(value, '__len__'):\n                    raise TypeError('Right side value must be iterable')\n\n                if len(value) != n_cols:\n                    raise ValueError('Right side value needs {0} elements (one for each column)'\n                                     .format(n_cols))\n\n                for col, val in zip(self.columns.values(), value):\n                    col[item] = val\n\n            elif (isinstance(item, slice) or\n                  isinstance(item, np.ndarray) or\n                  isinstance(item, list) or\n                  (isinstance(item, tuple) and  # output from np.where\n                   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                    import itertools\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 {0} 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('Illegal type {0} for table item access'\n                                 .format(type(item)))"},{"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":708,"header":"def _positive_index_of(self, key)","id":1641,"name":"_positive_index_of","nodeType":"Function","startLoc":684,"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                'Extension {} is out of bound or not found.'.format(index))\n\n        return len(self) + index"},{"attributeType":"null","col":12,"comment":"null","endLoc":167,"id":1642,"name":"self","nodeType":"Attribute","startLoc":167,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":226,"id":1643,"name":"_heapoffset","nodeType":"Attribute","startLoc":226,"text":"self._heapoffset"},{"col":4,"comment":"\n        Get the index of an HDU from the `HDUList`.\n\n        Parameters\n        ----------\n        key : int, str or tuple of (string, int)\n           The key identifying the HDU.  If ``key`` is a tuple, it is of the\n           form ``(key, 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        Returns\n        -------\n        index : int\n           The index of the HDU in the `HDUList`.\n        ","endLoc":682,"header":"def index_of(self, key)","id":1644,"name":"index_of","nodeType":"Function","startLoc":627,"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 or tuple of (string, int)\n           The key identifying the HDU.  If ``key`` is a tuple, it is of the\n           form ``(key, 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        Returns\n        -------\n        index : int\n           The index of the HDU in the `HDUList`.\n        \"\"\"\n\n        if _is_int(key):\n            return key\n        elif isinstance(key, tuple):\n            _key, _ver = 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('Extension {!r} not found.'.format(key))\n        else:\n            return found"},{"col":4,"comment":"null","endLoc":1471,"header":"def choose(self, choices, out=None, mode='raise')","id":1645,"name":"choose","nodeType":"Function","startLoc":1469,"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":1475,"header":"def argsort(self, axis=-1, kind='quicksort', order=None)","id":1646,"name":"argsort","nodeType":"Function","startLoc":1474,"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":12,"comment":"null","endLoc":172,"id":1647,"name":"_nfields","nodeType":"Attribute","startLoc":172,"text":"self._nfields"},{"attributeType":"null","col":8,"comment":"null","endLoc":183,"id":1648,"name":"_col_weakrefs","nodeType":"Attribute","startLoc":183,"text":"self._col_weakrefs"},{"attributeType":"null","col":12,"comment":"null","endLoc":225,"id":1649,"name":"_converted","nodeType":"Attribute","startLoc":225,"text":"self._converted"},{"attributeType":"null","col":12,"comment":"null","endLoc":231,"id":1650,"name":"_gap","nodeType":"Attribute","startLoc":231,"text":"self._gap"},{"col":4,"comment":"null","endLoc":1480,"header":"def searchsorted(self, v, *args, **kwargs)","id":1651,"name":"searchsorted","nodeType":"Function","startLoc":1477,"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":"null","endLoc":1483,"header":"def argmax(self, axis=None, out=None)","id":1652,"name":"argmax","nodeType":"Function","startLoc":1482,"text":"def argmax(self, axis=None, out=None):\n        return self.view(np.ndarray).argmax(axis, out=out)"},{"attributeType":"null","col":12,"comment":"null","endLoc":229,"id":1653,"name":"_coldefs","nodeType":"Attribute","startLoc":229,"text":"self._coldefs"},{"col":4,"comment":"null","endLoc":1486,"header":"def argmin(self, axis=None, out=None)","id":1654,"name":"argmin","nodeType":"Function","startLoc":1485,"text":"def argmin(self, axis=None, out=None):\n        return self.view(np.ndarray).argmin(axis, out=out)"},{"className":"_UnicodeArrayEncodeError","col":0,"comment":"null","endLoc":1287,"id":1655,"nodeType":"Class","startLoc":1284,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1287,"id":1656,"name":"index","nodeType":"Attribute","startLoc":1287,"text":"self.index"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":1657,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"attributeType":"null","col":26,"comment":"null","endLoc":13,"id":1658,"name":"chararray","nodeType":"Attribute","startLoc":13,"text":"chararray"},{"col":4,"comment":"null","endLoc":308,"header":"@data.setter\n    def data(self, data)","id":1659,"name":"data","nodeType":"Function","startLoc":248,"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_unsigned(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if data is not None and not isinstance(data, np.ndarray):\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        self.__dict__['data'] = data\n        self._modified = True\n\n        if isinstance(data, np.ndarray):\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        elif self.data is None:\n            self._axes = []\n        else:\n            raise ValueError('not a valid data array')\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":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":1535,"header":"def _wrap_function(self, function, *args, unit=None, out=None, **kwargs)","id":1660,"name":"_wrap_function","nodeType":"Function","startLoc":1493,"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":524,"header":"def _report(self)","id":1661,"name":"_report","nodeType":"Function","startLoc":499,"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        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":1048,"header":"def _try_while_unread_hdus(self, func, *args, **kwargs)","id":1662,"name":"_try_while_unread_hdus","nodeType":"Function","startLoc":1033,"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":"null","endLoc":1539,"header":"def clip(self, a_min, a_max, out=None)","id":1663,"name":"clip","nodeType":"Function","startLoc":1537,"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)"},{"col":4,"comment":"\n        Returns `True` if ``HDUList.index_of(item)`` succeeds.\n        ","endLoc":335,"header":"def __contains__(self, item)","id":1664,"name":"__contains__","nodeType":"Function","startLoc":325,"text":"def __contains__(self, item):\n        \"\"\"\n        Returns `True` if ``HDUList.index_of(item)`` succeeds.\n        \"\"\"\n\n        try:\n            self._try_while_unread_hdus(self.index_of, item)\n        except KeyError:\n            return False\n\n        return True"},{"col":4,"comment":"\n        Set an HDU to the `HDUList`, indexed by number or name.\n        ","endLoc":360,"header":"def __setitem__(self, key, hdu)","id":1665,"name":"__setitem__","nodeType":"Function","startLoc":337,"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('{} is not an HDU.'.format(item))\n        else:\n            if not isinstance(hdu, _BaseHDU):\n                raise ValueError('{} is not an HDU.'.format(hdu))\n\n        try:\n            self._try_while_unread_hdus(super().__setitem__, _key, hdu)\n        except IndexError:\n            raise IndexError('Extension {} is out of bound or not found.'\n                            .format(key))\n\n        self._resize = True\n        self._truncate = False"},{"col":4,"comment":"null","endLoc":1543,"header":"def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None)","id":1666,"name":"trace","nodeType":"Function","startLoc":1541,"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":1547,"header":"def var(self, axis=None, dtype=None, out=None, ddof=0)","id":1667,"name":"var","nodeType":"Function","startLoc":1545,"text":"def var(self, axis=None, dtype=None, out=None, ddof=0):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, unit=self.unit**2)"},{"col":4,"comment":"\n        Add a list of new Column objects ``cols`` to the table.  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        Parameters\n        ----------\n        cols : list of Columns\n            Column objects to add.\n        indexes : list of ints 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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create column 'c' and 'd' and append them to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\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              3 0.3   z   w\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, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\n            >>> t.add_columns([col_c, col_d], [0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n              z   3   w 0.3\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> t.add_columns([col_b, col_c], 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              3 0.3 1.3  z\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_a = Column(data=['x', 'y'])\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([col_a, col_b])\n            >>> t.add_columns([col_a, col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               x   u   x   u\n               y   v   y   v\n        ","endLoc":1718,"header":"def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False)","id":1668,"name":"add_columns","nodeType":"Function","startLoc":1583,"text":"def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new Column objects ``cols`` to the table.  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        Parameters\n        ----------\n        cols : list of Columns\n            Column objects to add.\n        indexes : list of ints 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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create column 'c' and 'd' and append them to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\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              3 0.3   z   w\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, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\n            >>> t.add_columns([col_c, col_d], [0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n              z   3   w 0.3\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> t.add_columns([col_b, col_c], 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              3 0.3 1.3  z\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_a = Column(data=['x', 'y'])\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([col_a, col_b])\n            >>> t.add_columns([col_a, col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               x   u   x   u\n               y   v   y   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 copy:\n            cols = [col_copy(col) for col in cols]\n\n        if len(self.columns) == 0:\n            # No existing table data, init from cols\n            newcols = cols\n        else:\n            newcols = list(self.columns.values())\n            new_indexes = list(range(len(newcols) + 1))\n            for col, index in zip(cols, indexes):\n                i = new_indexes.index(index)\n                new_indexes.insert(i, None)\n                newcols.insert(i, col)\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        for i, (col, name) in enumerate(zip(cols, names)):\n            if name is None:\n                if col.info.name is not None:\n                    continue\n                name = 'col{}'.format(i + len(self.columns))\n            if col.info.parent_table is not None:\n                col = col_copy(col)\n            col.info.name = name\n\n        if rename_duplicate:\n            existing_names = set(self.colnames)\n            for col in cols:\n                i = 1\n                orig_name = col.info.name\n                while col.info.name in existing_names:\n                    # If the column belongs to another table then copy it\n                    # before renaming\n                    if col.info.parent_table is not None:\n                        col = col_copy(col)\n                    new_name = '{0}_{1}'.format(orig_name, i)\n                    col.info.name = new_name\n                    i += 1\n                existing_names.add(new_name)\n\n        self._init_from_cols(newcols)"},{"col":4,"comment":"null","endLoc":1550,"header":"def std(self, axis=None, dtype=None, out=None, ddof=0)","id":1669,"name":"std","nodeType":"Function","startLoc":1549,"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)"},{"col":4,"comment":"null","endLoc":1553,"header":"def mean(self, axis=None, dtype=None, out=None)","id":1670,"name":"mean","nodeType":"Function","startLoc":1552,"text":"def mean(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.mean, axis, dtype, out=out)"},{"col":4,"comment":"null","endLoc":1556,"header":"def ptp(self, axis=None, out=None)","id":1671,"name":"ptp","nodeType":"Function","startLoc":1555,"text":"def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out)"},{"fileName":"nonstandard.py","filePath":"astropy/io/fits/hdu","id":1672,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport gzip\nimport io\n\nfrom ..file import _File\nfrom .base import NonstandardExtHDU\nfrom .hdulist import HDUList\nfrom ..header import Header, _pad_length\nfrom ..util import fileobj_name\n\nfrom ....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        return cls.fromhdulist(HDUList.fromfile(filename), 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                              'byte offset of extension {}'.format(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"},{"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":1607,"id":1673,"nodeType":"Class","startLoc":1564,"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        return (self.name, self.ver, 'NonstandardExtHDU', 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)"},{"col":4,"comment":"\n        Matches any extension HDU that is not one of the standard extension HDU\n        types.\n        ","endLoc":1596,"header":"@classmethod\n    def match_header(cls, header)","id":1674,"name":"match_header","nodeType":"Function","startLoc":1578,"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":1559,"header":"def round(self, decimals=0, out=None)","id":1675,"name":"round","nodeType":"Function","startLoc":1558,"text":"def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)"},{"col":4,"comment":"\n        Delete an HDU from the `HDUList`, indexed by number or name.\n        ","endLoc":379,"header":"def __delitem__(self, key)","id":1676,"name":"__delitem__","nodeType":"Function","startLoc":362,"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":4,"comment":"null","endLoc":1599,"header":"def _summary(self)","id":1677,"name":"_summary","nodeType":"Function","startLoc":1598,"text":"def _summary(self):\n        return (self.name, self.ver, 'NonstandardExtHDU', len(self._header))"},{"col":4,"comment":"\n        Return the file data.\n        ","endLoc":1607,"header":"@lazyproperty\n    def data(self)","id":1678,"name":"data","nodeType":"Function","startLoc":1601,"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":1562,"header":"def max(self, axis=None, out=None, keepdims=False)","id":1679,"name":"max","nodeType":"Function","startLoc":1561,"text":"def max(self, axis=None, out=None, keepdims=False):\n        return self._wrap_function(np.max, axis, out=out, keepdims=keepdims)"},{"col":4,"comment":"null","endLoc":1565,"header":"def min(self, axis=None, out=None, keepdims=False)","id":1680,"name":"min","nodeType":"Function","startLoc":1564,"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":1569,"header":"def sum(self, axis=None, dtype=None, out=None, keepdims=False)","id":1681,"name":"sum","nodeType":"Function","startLoc":1567,"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":383,"header":"def __enter__(self)","id":1682,"name":"__enter__","nodeType":"Function","startLoc":382,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":386,"header":"def __exit__(self, type, value, traceback)","id":1683,"name":"__exit__","nodeType":"Function","startLoc":385,"text":"def __exit__(self, type, value, traceback):\n        self.close()"},{"col":4,"comment":"null","endLoc":1576,"header":"def prod(self, axis=None, dtype=None, out=None, keepdims=False)","id":1684,"name":"prod","nodeType":"Function","startLoc":1571,"text":"def prod(self, axis=None, dtype=None, out=None, keepdims=False):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use prod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.prod, axis, dtype, out=out,\n                                   keepdims=keepdims)"},{"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:`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":910,"header":"def close(self, output_verify='exception', verbose=False, closed=True)","id":1685,"name":"close","nodeType":"Function","startLoc":880,"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:`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":"null","endLoc":1580,"header":"def dot(self, b, out=None)","id":1686,"name":"dot","nodeType":"Function","startLoc":1578,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1576,"id":1687,"name":"_standard","nodeType":"Attribute","startLoc":1576,"text":"_standard"},{"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":124,"id":1688,"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        return cls.fromhdulist(HDUList.fromfile(filename), 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                              'byte offset of extension {}'.format(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))"},{"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:`verify` for more info.\n\n        verbose : bool\n            When `True`, print verbose messages\n        ","endLoc":782,"header":"@ignore_sigint\n    def flush(self, output_verify='fix', verbose=False)","id":1689,"name":"flush","nodeType":"Function","startLoc":719,"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:`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        if self._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":"null","endLoc":39,"header":"@lazyproperty\n    def hdulist(self)","id":1690,"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')"},{"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":459,"header":"def scale(self, type=None, option='old', bscale=None, bzero=None)","id":1691,"name":"scale","nodeType":"Function","startLoc":430,"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":564,"header":"def _scale_internal(self, type=None, option='old', bscale=None, bzero=None,\n                        blank=0)","id":1692,"name":"_scale_internal","nodeType":"Function","startLoc":461,"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            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            # 0.9.6.3 to avoid out of range error for BZERO = +32768\n            # We have to explcitly 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":1583,"header":"def cumsum(self, axis=None, dtype=None, out=None)","id":1693,"name":"cumsum","nodeType":"Function","startLoc":1582,"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":1589,"header":"def cumprod(self, axis=None, dtype=None, out=None)","id":1694,"name":"cumprod","nodeType":"Function","startLoc":1585,"text":"def cumprod(self, axis=None, dtype=None, out=None):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use cumprod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.cumprod, axis, dtype, out=out)"},{"col":4,"comment":"null","endLoc":1595,"header":"def all(self, axis=None, out=None)","id":1695,"name":"all","nodeType":"Function","startLoc":1593,"text":"def all(self, axis=None, out=None):\n        raise NotImplementedError(\"cannot evaluate truth value of quantities. \"\n                                  \"Evaluate array with q.value.all(...)\")"},{"col":4,"comment":"null","endLoc":1599,"header":"def any(self, axis=None, out=None)","id":1696,"name":"any","nodeType":"Function","startLoc":1597,"text":"def any(self, axis=None, out=None):\n        raise NotImplementedError(\"cannot evaluate truth value of quantities. \"\n                                  \"Evaluate array with q.value.any(...)\")"},{"col":4,"comment":"null","endLoc":1604,"header":"def diff(self, n=1, axis=-1)","id":1697,"name":"diff","nodeType":"Function","startLoc":1603,"text":"def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis)"},{"col":4,"comment":"null","endLoc":1607,"header":"def ediff1d(self, to_end=None, to_begin=None)","id":1698,"name":"ediff1d","nodeType":"Function","startLoc":1606,"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":1611,"header":"def nansum(self, axis=None, out=None, keepdims=False)","id":1699,"name":"nansum","nodeType":"Function","startLoc":1609,"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 ints\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":1659,"header":"def insert(self, obj, values, axis=None)","id":1700,"name":"insert","nodeType":"Function","startLoc":1613,"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 ints\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":262,"id":1701,"name":"_equivalencies","nodeType":"Attribute","startLoc":262,"text":"_equivalencies"},{"col":4,"comment":"Implements flushing changes to a file in update mode.","endLoc":1209,"header":"def _flush_update(self)","id":1702,"name":"_flush_update","nodeType":"Function","startLoc":1184,"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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":266,"id":1703,"name":"_default_unit","nodeType":"Attribute","startLoc":266,"text":"_default_unit"},{"col":4,"comment":"null","endLoc":572,"header":"def _verify(self, option='warn')","id":1704,"name":"_verify","nodeType":"Function","startLoc":566,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":269,"id":1705,"name":"_unit","nodeType":"Attribute","startLoc":269,"text":"_unit"},{"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":1361,"header":"def _wasresized(self, verbose=False)","id":1706,"name":"_wasresized","nodeType":"Function","startLoc":1320,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":271,"id":1707,"name":"__array_priority__","nodeType":"Attribute","startLoc":271,"text":"__array_priority__"},{"col":4,"comment":"null","endLoc":611,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":1708,"name":"_prewriteto","nodeType":"Function","startLoc":600,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":803,"id":1709,"name":"info","nodeType":"Attribute","startLoc":803,"text":"info"},{"attributeType":"null","col":4,"comment":"null","endLoc":875,"id":1710,"name":"value","nodeType":"Attribute","startLoc":875,"text":"value"},{"col":4,"comment":"\n        Implements flushing changes in update mode when parts of one or more HDU\n        need to be resized.\n        ","endLoc":1318,"header":"def _flush_resize(self)","id":1711,"name":"_flush_resize","nodeType":"Function","startLoc":1211,"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                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                        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":939,"id":1712,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":939,"text":"_include_easy_conversion_members"},{"attributeType":"null","col":16,"comment":"null","endLoc":315,"id":1713,"name":"pattern","nodeType":"Attribute","startLoc":315,"text":"pattern"},{"attributeType":"null","col":16,"comment":"null","endLoc":493,"id":1714,"name":"_catch_warnings","nodeType":"Attribute","startLoc":493,"text":"self._catch_warnings"},{"attributeType":"null","col":20,"comment":"null","endLoc":301,"id":1715,"name":"dtype","nodeType":"Attribute","startLoc":301,"text":"dtype"},{"col":4,"comment":"\n        Same as replace_column but issues warnings under various circumstances.\n        ","endLoc":1773,"header":"def _replace_column_warnings(self, name, col)","id":1716,"name":"_replace_column_warnings","nodeType":"Function","startLoc":1720,"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\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(\"replaced column '{}'\".format(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)"},{"attributeType":"null","col":20,"comment":"null","endLoc":283,"id":1717,"name":"cls","nodeType":"Attribute","startLoc":283,"text":"cls"},{"attributeType":"null","col":16,"comment":"null","endLoc":281,"id":1718,"name":"qcls","nodeType":"Attribute","startLoc":281,"text":"qcls"},{"attributeType":"null","col":20,"comment":"null","endLoc":364,"id":1719,"name":"unit","nodeType":"Attribute","startLoc":364,"text":"unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":780,"id":1720,"name":"_unit","nodeType":"Attribute","startLoc":780,"text":"self._unit"},{"col":4,"comment":"\n        Replace column ``name`` with the new ``col`` object.\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : column object (list, ndarray, Column, etc)\n            New column object to replace the existing column\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":1803,"header":"def replace_column(self, name, col)","id":1721,"name":"replace_column","nodeType":"Function","startLoc":1775,"text":"def replace_column(self, name, col):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : column object (list, ndarray, Column, etc)\n            New column object to replace the existing column\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('column name {0} is not in the table'.format(name))\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        t = self.__class__([col], names=[name])\n        cols = OrderedDict(self.columns)\n        cols[name] = t[name]\n        self._init_from_cols(cols.values())"},{"col":4,"comment":"null","endLoc":653,"header":"def _writedata_internal(self, fileobj)","id":1722,"name":"_writedata_internal","nodeType":"Function","startLoc":613,"text":"def _writedata_internal(self, fileobj):\n        size = 0\n\n        if self.data is not None:\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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":804,"header":"def _summary(self)","id":1723,"name":"_summary","nodeType":"Function","startLoc":773,"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 += ' (rescales to {0})'.format(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, '')"},{"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":55,"header":"@classmethod\n    def fromfile(cls, filename, compress=False)","id":1724,"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        return cls.fromhdulist(HDUList.fromfile(filename), compress=compress)"},{"attributeType":"null","col":16,"comment":"null","endLoc":321,"id":1725,"name":"v","nodeType":"Attribute","startLoc":321,"text":"v"},{"attributeType":"null","col":20,"comment":"null","endLoc":356,"id":1726,"name":"value_unit","nodeType":"Attribute","startLoc":356,"text":"value_unit"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":852,"header":"def _calculate_datasum(self)","id":1727,"name":"_calculate_datasum","nodeType":"Function","startLoc":806,"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_unsigned(self.data.dtype):\n                d = np.array(self.data - _unsigned_zero(self.data.dtype),\n                             dtype='i{}'.format(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_unsigned(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":20,"comment":"null","endLoc":366,"id":1728,"name":"copy","nodeType":"Attribute","startLoc":366,"text":"copy"},{"attributeType":"null","col":8,"comment":"null","endLoc":384,"id":1729,"name":"value","nodeType":"Attribute","startLoc":384,"text":"value"},{"attributeType":"null","col":16,"comment":"null","endLoc":331,"id":1730,"name":"unit_string","nodeType":"Attribute","startLoc":331,"text":"unit_string"},{"attributeType":"null","col":12,"comment":"null","endLoc":405,"id":1731,"name":"info","nodeType":"Attribute","startLoc":405,"text":"self.info"},{"col":4,"comment":"null","endLoc":199,"header":"def __new__(cls, *args, **kwargs)","id":1732,"name":"__new__","nodeType":"Function","startLoc":184,"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 \"{0}\" and \"{1}\"'\n                                .format(exc_geocentric, exc_geodetic))\n        return self"},{"attributeType":"null","col":4,"comment":"null","endLoc":28,"id":1733,"name":"standard_keyword_comments","nodeType":"Attribute","startLoc":28,"text":"standard_keyword_comments"},{"attributeType":"null","col":12,"comment":"null","endLoc":137,"id":1734,"name":"ver","nodeType":"Attribute","startLoc":137,"text":"self.ver"},{"attributeType":"null","col":8,"comment":"null","endLoc":454,"id":1735,"name":"ignore_blanks","nodeType":"Attribute","startLoc":454,"text":"self.ignore_blanks"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":1736,"name":"_do_not_scale_image_data","nodeType":"Attribute","startLoc":96,"text":"self._do_not_scale_image_data"},{"attributeType":"null","col":16,"comment":"null","endLoc":148,"id":1737,"name":"_data_needs_rescale","nodeType":"Attribute","startLoc":148,"text":"self._data_needs_rescale"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":1738,"name":"data","nodeType":"Attribute","startLoc":154,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":456,"id":1739,"name":"diff_extnames","nodeType":"Attribute","startLoc":456,"text":"self.diff_extnames"},{"attributeType":"null","col":8,"comment":"null","endLoc":438,"id":1740,"name":"ignore_keywords","nodeType":"Attribute","startLoc":438,"text":"self.ignore_keywords"},{"attributeType":"null","col":12,"comment":"null","endLoc":174,"id":1741,"name":"_orig_bscale","nodeType":"Attribute","startLoc":174,"text":"self._orig_bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":453,"id":1742,"name":"numdiffs","nodeType":"Attribute","startLoc":453,"text":"self.numdiffs"},{"col":4,"comment":"null","endLoc":1380,"header":"def __delitem__(self, item)","id":1743,"name":"__delitem__","nodeType":"Function","startLoc":1366,"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)) and\n              all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray)) and\n              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')"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":1744,"name":"_blank","nodeType":"Attribute","startLoc":120,"text":"self._blank"},{"attributeType":"null","col":12,"comment":"null","endLoc":450,"id":1745,"name":"rtol","nodeType":"Attribute","startLoc":450,"text":"self.rtol"},{"attributeType":"null","col":12,"comment":"null","endLoc":94,"id":1746,"name":"_header","nodeType":"Attribute","startLoc":94,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":98,"id":1747,"name":"_uint","nodeType":"Attribute","startLoc":98,"text":"self._uint"},{"attributeType":"null","col":8,"comment":"null","endLoc":119,"id":1748,"name":"_pcount","nodeType":"Attribute","startLoc":119,"text":"self._pcount"},{"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":1841,"header":"def remove_row(self, index)","id":1749,"name":"remove_row","nodeType":"Function","startLoc":1805,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":457,"id":1750,"name":"diff_extvers","nodeType":"Attribute","startLoc":457,"text":"self.diff_extvers"},{"attributeType":"null","col":8,"comment":"null","endLoc":458,"id":1751,"name":"diff_extlevels","nodeType":"Attribute","startLoc":458,"text":"self.diff_extlevels"},{"attributeType":"None","col":8,"comment":"null","endLoc":461,"id":1752,"name":"diff_data","nodeType":"Attribute","startLoc":461,"text":"self.diff_data"},{"attributeType":"None","col":8,"comment":"null","endLoc":460,"id":1753,"name":"diff_headers","nodeType":"Attribute","startLoc":460,"text":"self.diff_headers"},{"attributeType":"null","col":8,"comment":"null","endLoc":439,"id":1754,"name":"ignore_comments","nodeType":"Attribute","startLoc":439,"text":"self.ignore_comments"},{"attributeType":"null","col":12,"comment":"null","endLoc":167,"id":1755,"name":"_bscale","nodeType":"Attribute","startLoc":167,"text":"self._bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":1756,"name":"_axes","nodeType":"Attribute","startLoc":111,"text":"self._axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":443,"id":1757,"name":"atol","nodeType":"Attribute","startLoc":443,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":1758,"name":"_orig_bitpix","nodeType":"Attribute","startLoc":123,"text":"self._orig_bitpix"},{"col":4,"comment":"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice, int, or array of ints\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":1904,"header":"def remove_rows(self, row_specifier)","id":1759,"name":"remove_rows","nodeType":"Function","startLoc":1843,"text":"def remove_rows(self, row_specifier):\n        \"\"\"\n        Remove rows from the table.\n\n        Parameters\n        ----------\n        row_specifier : slice, int, or array of ints\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"},{"attributeType":"null","col":12,"comment":"null","endLoc":172,"id":1760,"name":"_orig_bzero","nodeType":"Attribute","startLoc":172,"text":"self._orig_bzero"},{"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 : `~astropy.units.UnitBase` object 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":248,"header":"@classmethod\n    def from_geocentric(cls, x, y, z, unit=None)","id":1761,"name":"from_geocentric","nodeType":"Function","startLoc":201,"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 : `~astropy.units.UnitBase` object 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.\")\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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":166,"id":1762,"name":"_bzero","nodeType":"Attribute","startLoc":166,"text":"self._bzero"},{"attributeType":"null","col":8,"comment":"null","endLoc":99,"id":1763,"name":"_scale_back","nodeType":"Attribute","startLoc":99,"text":"self._scale_back"},{"col":4,"comment":"null","endLoc":2365,"header":"def _replace_cols(self, columns)","id":1764,"name":"_replace_cols","nodeType":"Function","startLoc":2358,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":459,"id":1765,"name":"diff_extension_types","nodeType":"Attribute","startLoc":459,"text":"self.diff_extension_types"},{"attributeType":"null","col":8,"comment":"null","endLoc":440,"id":1766,"name":"ignore_fields","nodeType":"Attribute","startLoc":440,"text":"self.ignore_fields"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":1767,"name":"_orig_blank","nodeType":"Attribute","startLoc":124,"text":"self._orig_blank"},{"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":787,"id":1768,"nodeType":"Class","startLoc":527,"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                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(self.diff_keyword_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra keyword {!r:8} in a: {!r}'.format(\n                                keyword, val))\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(' Extra keyword {!r:8} in b: {!r}'.format(\n                                keyword, val))\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(' Inconsistent duplicates of keyword {!r:8}:'\n                              .format(keyword))\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        See `FITSDiff` for explanations of the initialization parameters.\n        ","endLoc":643,"header":"def __init__(self, a, b, ignore_keywords=[], ignore_comments=[],\n                 rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True,\n                 tolerance=None)","id":1769,"name":"__init__","nodeType":"Function","startLoc":570,"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                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\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        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":135,"id":1770,"name":"name","nodeType":"Attribute","startLoc":135,"text":"self.name"},{"col":4,"comment":"\n        Write the `HDUList` to a new file.\n\n        Parameters\n        ----------\n        fileobj : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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":878,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def writeto(self, fileobj, output_verify='exception', overwrite=False,\n                checksum=False)","id":1771,"name":"writeto","nodeType":"Function","startLoc":816,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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        # writeto is only for writing a new file from scratch, so the most\n        # sensible mode to require is 'ostream'.  This can accept an open\n        # file object that's open to write only, or in append/update modes\n        # but only if the file doesn't exist.\n        fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)\n        hdulist = self.fromfile(fileobj)\n        try:\n            dirname = os.path.dirname(hdulist._file.name)\n        except AttributeError:\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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":160,"id":1772,"name":"_bitpix","nodeType":"Attribute","startLoc":160,"text":"self._bitpix"},{"attributeType":"null","col":16,"comment":"null","endLoc":254,"id":1773,"name":"_data_replaced","nodeType":"Attribute","startLoc":254,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":118,"id":1774,"name":"_gcount","nodeType":"Attribute","startLoc":118,"text":"self._gcount"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":1775,"name":"_modified","nodeType":"Attribute","startLoc":141,"text":"self._modified"},{"col":4,"comment":"null","endLoc":1017,"header":"@classmethod\n    def match_header(cls, header)","id":1776,"name":"match_header","nodeType":"Function","startLoc":1010,"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":1028,"header":"def update_header(self)","id":1777,"name":"update_header","nodeType":"Function","startLoc":1019,"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":1041,"header":"def _verify(self, option='warn')","id":1778,"name":"_verify","nodeType":"Function","startLoc":1030,"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":4,"comment":"Return column[item] for recarray compatibility.","endLoc":1384,"header":"def field(self, item)","id":1779,"name":"field","nodeType":"Function","startLoc":1382,"text":"def field(self, item):\n        \"\"\"Return column[item] for recarray compatibility.\"\"\"\n        return self.columns[item]"},{"col":4,"comment":"null","endLoc":1388,"header":"@property\n    def masked(self)","id":1780,"name":"masked","nodeType":"Function","startLoc":1386,"text":"@property\n    def masked(self):\n        return self._masked"},{"col":4,"comment":"null","endLoc":1393,"header":"@masked.setter\n    def masked(self, masked)","id":1781,"name":"masked","nodeType":"Function","startLoc":1390,"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":"null","endLoc":1431,"header":"@property\n    def ColumnClass(self)","id":1782,"name":"ColumnClass","nodeType":"Function","startLoc":1426,"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":"null","endLoc":1435,"header":"@property\n    def dtype(self)","id":1783,"name":"dtype","nodeType":"Function","startLoc":1433,"text":"@property\n    def dtype(self):\n        return np.dtype([descr(col) for col in self.columns.values()])"},{"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` 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":300,"header":"@classmethod\n    def from_geodetic(cls, lon, lat, height=0., ellipsoid=None)","id":1784,"name":"from_geodetic","nodeType":"Function","startLoc":250,"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` 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        lon = Longitude(lon, u.degree, wrap_angle=180*u.degree, copy=False)\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        # convert to float in units required for erfa routine, and ensure\n        # all broadcast to same shape, and are at least 1-dimensional.\n        _lon, _lat, _height = np.broadcast_arrays(lon.to_value(u.radian),\n                                                  lat.to_value(u.radian),\n                                                  height.to_value(u.m))\n        # get geocentric coordinates. Have to give one-dimensional array.\n        xyz = erfa.gd2gc(getattr(erfa, ellipsoid), _lon.ravel(),\n                                 _lat.ravel(), _height.ravel())\n        self = xyz.view(cls._location_dtype, cls).reshape(_lon.shape)\n        self._unit = u.meter\n        self._ellipsoid = ellipsoid\n        return self.to(height.unit)"},{"col":0,"comment":"null","endLoc":51,"header":"def _check_ellipsoid(ellipsoid=None, default='WGS84')","id":1785,"name":"_check_ellipsoid","nodeType":"Function","startLoc":45,"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('Ellipsoid {0} not among known ones ({1})'\n                         .format(ellipsoid, ELLIPSOIDS))\n    return ellipsoid"},{"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":108,"header":"@classmethod\n    def fromhdulist(cls, hdulist, compress=False)","id":1786,"name":"fromhdulist","nodeType":"Function","startLoc":57,"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                              'byte offset of extension {}'.format(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":1439,"header":"@property\n    def colnames(self)","id":1787,"name":"colnames","nodeType":"Function","startLoc":1437,"text":"@property\n    def colnames(self):\n        return list(self.columns.keys())"},{"col":4,"comment":"null","endLoc":1442,"header":"def keys(self)","id":1788,"name":"keys","nodeType":"Function","startLoc":1441,"text":"def keys(self):\n        return list(self.columns.keys())"},{"col":4,"comment":"null","endLoc":1453,"header":"def __len__(self)","id":1789,"name":"__len__","nodeType":"Function","startLoc":1444,"text":"def __len__(self):\n        if len(self.columns) == 0:\n            return 0\n\n        lengths = set(len(col) for col in self.columns.values())\n        if len(lengths) != 1:\n            len_strs = [' {0} : {1}'.format(name, len(col)) for name, col in self.columns.items()]\n            raise ValueError('Column length mismatch:\\n{0}'.format('\\n'.join(len_strs)))\n\n        return lengths.pop()"},{"col":4,"comment":"null","endLoc":118,"header":"@classmethod\n    def match_header(cls, header)","id":1790,"name":"match_header","nodeType":"Function","startLoc":110,"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":48,"endLoc":1039,"id":1791,"nodeType":"Lambda","startLoc":1039,"text":"lambda v: isinstance(v, bool)"},{"col":4,"comment":"null","endLoc":124,"header":"def _summary(self)","id":1792,"name":"_summary","nodeType":"Function","startLoc":122,"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":1793,"name":"_extension","nodeType":"Attribute","startLoc":25,"text":"_extension"},{"attributeType":"null","col":4,"comment":"null","endLoc":954,"id":1794,"name":"_default_name","nodeType":"Attribute","startLoc":954,"text":"_default_name"},{"col":4,"comment":"null","endLoc":276,"header":"def __init__(self, data=None, header=None)","id":1795,"name":"__init__","nodeType":"Function","startLoc":269,"text":"def __init__(self, data=None, header=None):\n        super().__init__(data=data, header=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":"null","endLoc":614,"header":"def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs)","id":1796,"name":"__new__","nodeType":"Function","startLoc":605,"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\n        return self"},{"fileName":"__init__.py","filePath":"astropy/io/fits/hdu","id":1797,"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":726,"id":1798,"name":"register_hdu","nodeType":"Attribute","startLoc":726,"text":"register_hdu"},{"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, memoryview, etc.\n            A string or other memory buffer containing an entire FITS file.  It\n            should be noted that if that memory is read-only (such as a Python\n            string) the returned :class:`HDUList`'s data portions will also be\n            read-only.\n\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":446,"header":"@classmethod\n    def fromstring(cls, data, **kwargs)","id":1799,"name":"fromstring","nodeType":"Function","startLoc":404,"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, memoryview, etc.\n            A string or other memory buffer containing an entire FITS file.  It\n            should be noted that if that memory is read-only (such as a Python\n            string) the returned :class:`HDUList`'s data portions will also be\n            read-only.\n\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)"},{"attributeType":"function","col":0,"comment":"null","endLoc":727,"id":1800,"name":"unregister_hdu","nodeType":"Attribute","startLoc":727,"text":"unregister_hdu"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":1801,"name":"DELAYED","nodeType":"Attribute","startLoc":31,"text":"DELAYED"},{"attributeType":"null","col":0,"comment":"Maps FITS BITPIX values to Numpy dtype names.","endLoc":34,"id":1802,"name":"BITPIX2DTYPE","nodeType":"Attribute","startLoc":34,"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":38,"id":1803,"name":"DTYPE2BITPIX","nodeType":"Attribute","startLoc":38,"text":"DTYPE2BITPIX"},{"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":1490,"header":"def index_column(self, name)","id":1804,"name":"index_column","nodeType":"Function","startLoc":1455,"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(\"Column {0} does not exist\".format(name))"},{"className":"CompImageHDU","col":0,"comment":"\n    Compressed Image HDU class.\n    ","endLoc":1949,"id":1805,"nodeType":"Class","startLoc":375,"text":"class CompImageHDU(BinTableHDU):\n    \"\"\"\n    Compressed Image HDU class.\n    \"\"\"\n\n    # Maps deprecated keyword arguments to __init__ to their new names\n    DEPRECATED_KWARGS = {\n        'compressionType': 'compression_type', 'tileSize': 'tile_size',\n        'hcompScale': 'hcomp_scale', 'hcompSmooth': 'hcomp_smooth',\n        'quantizeLevel': 'quantize_level'\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    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 : Header instance, 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), ``SUBTRACTIVE_DITHER_1`` (1; default), 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        # Handle deprecated keyword arguments\n        compression_opts = {}\n        for oldarg, newarg in self.DEPRECATED_KWARGS.items():\n            if oldarg in kwargs:\n                warnings.warn('Keyword argument {} to {} is pending '\n                              'deprecation; use {} instead'.format(\n                        oldarg, self.__class__.__name__, newarg),\n                              AstropyPendingDeprecationWarning)\n                compression_opts[newarg] = kwargs[oldarg]\n                del kwargs[oldarg]\n            else:\n                compression_opts[newarg] = locals()[newarg]\n        # Include newer compression options that don't required backwards\n        # compatibility with deprecated spellings\n        compression_opts['quantize_method'] = quantize_method\n        compression_opts['dither_seed'] = dither_seed\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, **compression_opts)\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    @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 : Header instance\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        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\n            if huge_hdu and not CFITSIO_SUPPORTS_Q_FORMAT:\n                raise OSError(\n                    \"Astropy cannot compress images greater than 4 GB in size \"\n                    \"({} is {} bytes) without CFITSIO >= 3.35\".format(\n                        (self.name, self.ver), self.data.nbytes))\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            name = 'COMPRESSED_IMAGE'\n\n        if name:\n            self._header.set('EXTNAME', name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n            self.name = name\n        else:\n            self.name = self._header['EXTNAME']\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            bitpix_comment = image_header.comments['BITPIX']\n            naxis_comment = image_header.comments['NAXIS']\n        else:\n            bitpix_comment = 'data type of original image'\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            if CFITSIO_SUPPORTS_GZIPDATA:\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            else:\n                # Q format is not supported for UNCOMPRESSED_DATA columns.\n                ttype2 = 'UNCOMPRESSED_DATA'\n                if zbitpix == 8:\n                    tform2 = '1QB' if huge_hdu else '1PB'\n                elif zbitpix == 16:\n                    tform2 = '1QI' if huge_hdu else '1PI'\n                elif zbitpix == 32:\n                    tform2 = '1QJ' if huge_hdu else '1PJ'\n                elif zbitpix == -32:\n                    tform2 = '1QE' if huge_hdu else '1PE'\n                else:\n                    tform2 = '1QD' if huge_hdu else '1PD'\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 explcitly 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        # 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 self._header and\n                self._header['EXTNAME'] == 'COMPRESSED_IMAGE'):\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_unsigned(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _unsigned_zero(self.data.dtype),\n                dtype='=i{}'.format(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            # 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_uint_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['ZTILE{}'.format(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        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":513,"header":"def fileinfo(self, index)","id":1806,"name":"fileinfo","nodeType":"Function","startLoc":448,"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":"\n        Add a new Column object ``col`` to the table.  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        Parameters\n        ----------\n        col : Column\n            Column object to add.\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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create a third column 'c' and append it to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\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              3 0.3   z\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> col_d = Column(name='d', data=['a', 'b', 'c'])\n            >>> t.add_column(col_d, 1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n              3   c 0.3   z\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> t.add_column(col_b, rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.2\n              3 0.3 1.3\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            >>> col_c = Column(data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> t.add_column(col_c, name='c')\n            >>> col_b = Column(name='b', data=[1.1, 1.2])\n            >>> t.add_column(col_b, name='d')\n            >>> print(t)\n             a   b  col2  c   d\n            --- --- ---- --- ---\n              1 0.1    x   x 1.1\n              2 0.2    y   y 1.2\n\n        To add several columns use add_columns.\n        ","endLoc":1581,"header":"def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True)","id":1807,"name":"add_column","nodeType":"Function","startLoc":1492,"text":"def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True):\n        \"\"\"\n        Add a new Column object ``col`` to the table.  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        Parameters\n        ----------\n        col : Column\n            Column object to add.\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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create a third column 'c' and append it to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\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              3 0.3   z\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> col_d = Column(name='d', data=['a', 'b', 'c'])\n            >>> t.add_column(col_d, 1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n              3   c 0.3   z\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> t.add_column(col_b, rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.2\n              3 0.3 1.3\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            >>> col_c = Column(data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> t.add_column(col_c, name='c')\n            >>> col_b = Column(name='b', data=[1.1, 1.2])\n            >>> t.add_column(col_b, name='d')\n            >>> print(t)\n             a   b  col2  c   d\n            --- --- ---- --- ---\n              1 0.1    x   x 1.1\n              2 0.2    y   y 1.2\n\n        To add several columns use add_columns.\n        \"\"\"\n        if index is None:\n            index = len(self.columns)\n        if name is not None:\n            name = (name,)\n\n        self.add_columns([col], [index], name, copy=copy, rename_duplicate=rename_duplicate)"},{"col":4,"comment":"null","endLoc":282,"header":"@classmethod\n    def match_header(cls, header)","id":1808,"name":"match_header","nodeType":"Function","startLoc":278,"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":295,"header":"@lazyproperty\n    def data(self)","id":1809,"name":"data","nodeType":"Function","startLoc":284,"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        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":304,"header":"@lazyproperty\n    def parnames(self)","id":1810,"name":"parnames","nodeType":"Function","startLoc":297,"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":343,"header":"@lazyproperty\n    def columns(self)","id":1811,"name":"columns","nodeType":"Function","startLoc":306,"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        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 : HDU object\n            The HDU object to insert\n        ","endLoc":578,"header":"def insert(self, index, hdu)","id":1812,"name":"insert","nodeType":"Function","startLoc":515,"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 : HDU object\n            The HDU object to insert\n        \"\"\"\n\n        if not isinstance(hdu, _BaseHDU):\n            raise ValueError('{} is not an HDU.'.format(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":"\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":2029,"header":"def _convert_string_dtype(self, in_kind, out_kind)","id":1813,"name":"_convert_string_dtype","nodeType":"Function","startLoc":2003,"text":"def _convert_string_dtype(self, in_kind, out_kind):\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        # If there are no `in_kind` columns then do nothing\n        cols = self.columns.values()\n        if not any(col.dtype.kind == in_kind for col in cols):\n            return\n\n        newcols = []\n        for col in cols:\n            if col.dtype.kind == in_kind:\n                newdtype = re.sub(in_kind, out_kind, col.dtype.str)\n                newcol = col.__class__(col, dtype=newdtype)\n            else:\n                newcol = col\n            newcols.append(newcol)\n\n        self._init_from_cols(newcols)"},{"col":4,"comment":"null","endLoc":109,"header":"def __new__(cls, angle, unit=None, dtype=None, copy=True)","id":1814,"name":"__new__","nodeType":"Function","startLoc":83,"text":"def __new__(cls, angle, unit=None, dtype=None, copy=True):\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 = util.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)"},{"col":4,"comment":"null","endLoc":128,"header":"@staticmethod\n    def _convert_unit_to_angle_unit(unit)","id":1815,"name":"_convert_unit_to_angle_unit","nodeType":"Function","startLoc":126,"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":124,"header":"@staticmethod\n    def _tuple_to_float(angle, unit)","id":1816,"name":"_tuple_to_float","nodeType":"Function","startLoc":111,"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 util.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return util.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(\"Can not parse '{0}' as unit '{1}'\"\n                               .format(angle, unit))"},{"col":4,"comment":"\n        Construct an image HDU.\n\n        Parameters\n        ----------\n        data : array\n            The data in the HDU.\n\n        header : Header instance\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":1103,"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":1817,"name":"__init__","nodeType":"Function","startLoc":1051,"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 : Header instance\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)"},{"col":0,"comment":"\n    Convert hour, minute, second to a float hour value.\n    ","endLoc":421,"header":"def hms_to_hours(h, m, s=None)","id":1818,"name":"hms_to_hours","nodeType":"Function","startLoc":398,"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:\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))\n\n    return sign * (h + m / 60. + s / 3600.)"},{"col":4,"comment":"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U') assuming\n        ASCII 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":2045,"header":"def convert_bytestring_to_unicode(self, python3_only=NoValue)","id":1819,"name":"convert_bytestring_to_unicode","nodeType":"Function","startLoc":2031,"text":"def convert_bytestring_to_unicode(self, python3_only=NoValue):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U') assuming\n        ASCII 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        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('S', 'U')"},{"col":4,"comment":"\n        Convert ASCII-only unicode columns (dtype.kind='U') to bytestring (dtype.kind='S').\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.  This routine takes\n        advantage of numpy automated conversion which works for strings that\n        are pure ASCII.\n        ","endLoc":2060,"header":"def convert_unicode_to_bytestring(self, python3_only=NoValue)","id":1820,"name":"convert_unicode_to_bytestring","nodeType":"Function","startLoc":2047,"text":"def convert_unicode_to_bytestring(self, python3_only=NoValue):\n        \"\"\"\n        Convert ASCII-only unicode columns (dtype.kind='U') to bytestring (dtype.kind='S').\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.  This routine takes\n        advantage of numpy automated conversion which works for strings that\n        are pure ASCII.\n        \"\"\"\n        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('U', 'S')"},{"col":4,"comment":"\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to keep. All other\n            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        Specifying only a single column name keeps only this column.\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        Specifying a list of column names is keeps is also possible.\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":2119,"header":"def keep_columns(self, names)","id":1821,"name":"keep_columns","nodeType":"Function","startLoc":2062,"text":"def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to keep. All other\n            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        Specifying only a single column name keeps only this column.\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        Specifying a list of column names is keeps is also possible.\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\n        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        remove = list(set(self.keys()) - set(names))\n\n        self.remove_columns(remove)"},{"col":4,"comment":"null","endLoc":352,"header":"@property\n    def _nrows(self)","id":1822,"name":"_nrows","nodeType":"Function","startLoc":345,"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":357,"header":"@lazyproperty\n    def _theap(self)","id":1823,"name":"_theap","nodeType":"Function","startLoc":354,"text":"@lazyproperty\n    def _theap(self):\n        # Only really a lazyproperty for symmetry with _TableBaseHDU\n        return 0"},{"col":4,"comment":"null","endLoc":361,"header":"@property\n    def is_image(self)","id":1824,"name":"is_image","nodeType":"Function","startLoc":359,"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":381,"header":"@property\n    def size(self)","id":1825,"name":"size","nodeType":"Function","startLoc":363,"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":"null","endLoc":750,"header":"def _diff(self)","id":1826,"name":"_diff","nodeType":"Function","startLoc":648,"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":"\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":2163,"header":"def rename_column(self, name, new_name)","id":1827,"name":"rename_column","nodeType":"Function","startLoc":2121,"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(\"Column {0} does not exist\".format(name))\n\n        self.columns[name].info.name = new_name"},{"col":4,"comment":"null","endLoc":447,"header":"def update_header(self)","id":1828,"name":"update_header","nodeType":"Function","startLoc":383,"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":"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":2216,"header":"def add_row(self, vals=None, mask=None)","id":1829,"name":"add_row","nodeType":"Function","startLoc":2165,"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":2356,"header":"def insert_row(self, index, vals=None, mask=None)","id":1830,"name":"insert_row","nodeType":"Function","startLoc":2218,"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 {0} is out of bounds for table with length {1}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        def _is_mapping(obj):\n            \"\"\"Minimal checker for mapping (dict-like) interface for obj\"\"\"\n            attrs = ('__getitem__', '__len__', '__iter__', 'keys', 'values', 'items')\n            return all(hasattr(obj, attr) for attr in attrs)\n\n        if mask is not None and not self.masked:\n            # Possibly issue upgrade warning and update self.ColumnClass.  This\n            # does not change the existing columns.\n            self._set_masked(True)\n\n        if _is_mapping(vals) 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 _is_mapping(mask):\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(\"Value must be supplied for column '{0}'\".format(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 _is_mapping(mask)):\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        columns = self.TableColumns()\n        try:\n            # Insert val at index for each column\n            for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n                # If the new row caused a change in self.ColumnClass then\n                # Column-based classes need to be converted first.  This is\n                # typical for adding a row with mask values to an unmasked table.\n                if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n                    col = self.ColumnClass(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n                if not isinstance(newcol, BaseColumn):\n                    newcol.info.name = name\n                    if self.masked:\n                        newcol.mask = FalseArray(newcol.shape)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {0} after inserting {1}'\n                                     ' (expected {2}, got {3})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed\n                if self.masked:\n                    newcol.mask[index] = mask_\n\n                columns[name] = newcol\n\n            # insert row in indices\n            for table_index in self.indices:\n                table_index.insert_row(index, vals, self.columns.values())\n\n        except Exception as err:\n            raise ValueError(\"Unable to insert row because of exception in column '{0}':\\n{1}\"\n                             .format(name, err))\n        else:\n            self._replace_cols(columns)\n\n            # Revert groups to default (ungrouped) state\n            if hasattr(self, '_groups'):\n                del self._groups"},{"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":1474,"id":1831,"nodeType":"Class","startLoc":817,"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 ....table import Table\n        if isinstance(data, Table):\n            from ..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            # TODO: The following code may no longer be necessary since it is\n            # now possible to get a pointer directly to the heap data as a\n            # whole.  That said, it is possible for the heap section to contain\n            # data that is not actually pointed to by the table (i.e. garbage;\n            # this *shouldn't* happen but it is not disallowed either)--need to\n            # double check whether or not the checksum should include such\n            # garbage\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\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                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                            if not fileobj.simulateonly:\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                    if not fileobj.simulateonly:\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : file path, file object or file-like object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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                        warnings.warn(\n                            \"Overwriting existing file '{}'.\".format(f),\n                            AstropyUserWarning)\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([\"File '{}' already exists.\".format(f)\n                                     for f in exist]))\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 : file path, file object or file-like object\n            Input data file containing the table data in ASCII format.\n\n        cdfile : file path, file object, file-like object, 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 : file path, file object, file-like object, 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\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 : Header object\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            supercedes 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 '{:21d}'.format(val)\n            elif format in np.typecodes['Complex']:\n                return '{:21.15g}+{:.15g}j'.format(val.real, val.imag)\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return '{:#21.15g}'.format(val)\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('{:21d}'.format(len(row[column.name])))\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 += ['{: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)"},{"col":0,"comment":"\n    Checks that the given hour, minute and second are all within\n    reasonable range.\n    ","endLoc":320,"header":"def check_hms_ranges(h, m, s)","id":1833,"name":"check_hms_ranges","nodeType":"Function","startLoc":312,"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":283,"header":"def _check_hour_range(hrs)","id":1834,"name":"_check_hour_range","nodeType":"Function","startLoc":276,"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)"},{"col":4,"comment":"null","endLoc":60,"header":"def __init__(self, hour, alternativeactionstr=None)","id":1835,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self, hour, alternativeactionstr=None):\n        self.hour = hour\n        self.alternativeactionstr = alternativeactionstr"},{"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.\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":700,"id":1836,"nodeType":"Class","startLoc":237,"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.\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        if header is not None and not isinstance(header, Header):\n            raise ValueError('header must be a Header object.')\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', '', ''),\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                # 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                    # Just doing a view on the input data screws up unsigned\n                    # columns, so treat those more carefully.\n                    # TODO: I need to read this code a little more closely\n                    # again, but I think it can be simplified quite a bit with\n                    # the use of some appropriate utility functions\n                    update_coldefs = {}\n                    if 'u' in [data.dtype[k].kind for k in data.dtype.names]:\n                        self._uint = True\n                        bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                                  8: np.uint64(2**63)}\n\n                        new_dtype = [\n                            (k, data.dtype[k].kind.replace('u', 'i') +\n                            str(data.dtype[k].itemsize))\n                            for k in data.dtype.names]\n\n                        new_data = np.zeros(data.shape, dtype=new_dtype)\n\n                        for k in data.dtype.fields:\n                            dtype = data.dtype[k]\n                            if dtype.kind == 'u':\n                                new_data[k] = data[k] - bzeros[dtype.itemsize]\n                                update_coldefs[k] = bzeros[dtype.itemsize]\n                            else:\n                                new_data[k] = data[k]\n                        self.data = new_data.view(self._data_type)\n                        # Uck...\n                        self.data._uint = True\n                    else:\n                        self.data = data.view(self._data_type)\n                    for k in update_coldefs:\n                        indx = _get_index(self.data.names, k)\n                        self.data._coldefs[indx].bzero = update_coldefs[k]\n                        # This is so bad that we have to update this in\n                        # duplicate...\n                        self.data._coldefs.bzeros[indx] = update_coldefs[k]\n                        # More uck...\n                        self.data._coldefs[indx]._physical_values = False\n                        self.data._coldefs[indx]._pseudo_unsigned_ints = True\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.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        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n            self._header[0] = (self._extension, self._ext_comment)\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            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\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        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                shape, format = (), ''\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            shape = ()\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 = '[{}]'.format(format)\n        dims = \"{}R x {}C\".format(nrows, ncols)\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                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":4,"comment":"null","endLoc":392,"header":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False)","id":1837,"name":"__init__","nodeType":"Function","startLoc":272,"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        if header is not None and not isinstance(header, Header):\n            raise ValueError('header must be a Header object.')\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', '', ''),\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                # 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                    # Just doing a view on the input data screws up unsigned\n                    # columns, so treat those more carefully.\n                    # TODO: I need to read this code a little more closely\n                    # again, but I think it can be simplified quite a bit with\n                    # the use of some appropriate utility functions\n                    update_coldefs = {}\n                    if 'u' in [data.dtype[k].kind for k in data.dtype.names]:\n                        self._uint = True\n                        bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                                  8: np.uint64(2**63)}\n\n                        new_dtype = [\n                            (k, data.dtype[k].kind.replace('u', 'i') +\n                            str(data.dtype[k].itemsize))\n                            for k in data.dtype.names]\n\n                        new_data = np.zeros(data.shape, dtype=new_dtype)\n\n                        for k in data.dtype.fields:\n                            dtype = data.dtype[k]\n                            if dtype.kind == 'u':\n                                new_data[k] = data[k] - bzeros[dtype.itemsize]\n                                update_coldefs[k] = bzeros[dtype.itemsize]\n                            else:\n                                new_data[k] = data[k]\n                        self.data = new_data.view(self._data_type)\n                        # Uck...\n                        self.data._uint = True\n                    else:\n                        self.data = data.view(self._data_type)\n                    for k in update_coldefs:\n                        indx = _get_index(self.data.names, k)\n                        self.data._coldefs[indx].bzero = update_coldefs[k]\n                        # This is so bad that we have to update this in\n                        # duplicate...\n                        self.data._coldefs.bzeros[indx] = update_coldefs[k]\n                        # More uck...\n                        self.data._coldefs[indx]._physical_values = False\n                        self.data._coldefs[indx]._pseudo_unsigned_ints = True\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.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        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n            self._header[0] = (self._extension, self._ext_comment)\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":"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : HDU object\n            HDU to add to the `HDUList`.\n        ","endLoc":625,"header":"def append(self, hdu)","id":1838,"name":"append","nodeType":"Function","startLoc":580,"text":"def append(self, hdu):\n        \"\"\"\n        Append a new HDU to the `HDUList`.\n\n        Parameters\n        ----------\n        hdu : HDU object\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":44,"header":"def __init__(self, hour)","id":1840,"name":"__init__","nodeType":"Function","startLoc":43,"text":"def __init__(self, hour):\n        self.hour = hour"},{"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":295,"header":"def _check_minute_range(m)","id":1841,"name":"_check_minute_range","nodeType":"Function","startLoc":286,"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)"},{"col":4,"comment":"\n        Read data of all HDUs into memory.\n        ","endLoc":717,"header":"def readall(self)","id":1842,"name":"readall","nodeType":"Function","startLoc":710,"text":"def readall(self):\n        \"\"\"\n        Read data of all HDUs into memory.\n        \"\"\"\n\n        for hdu in self:\n            if hdu.data is not None:\n                continue"},{"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, 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":955,"header":"def info(self, output=None)","id":1843,"name":"info","nodeType":"Function","startLoc":912,"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, 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 = ['Filename: {}'.format(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":"\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":499,"header":"def _writedata_internal(self, fileobj)","id":1844,"name":"_writedata_internal","nodeType":"Function","startLoc":449,"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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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":"null","endLoc":103,"header":"def __init__(self, minute, alternativeactionstr=None)","id":1845,"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":87,"header":"def __init__(self, minute)","id":1846,"name":"__init__","nodeType":"Function","startLoc":86,"text":"def __init__(self, minute):\n        self.minute = minute"},{"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":309,"header":"def _check_second_range(sec)","id":1847,"name":"_check_second_range","nodeType":"Function","startLoc":298,"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":"\n        Return the file name associated with the HDUList object if one exists.\n        Otherwise returns None.\n\n        Returns\n        -------\n        filename : a string containing the file name associated with the\n                   HDUList object if an association exists.  Otherwise returns\n                   None.\n        ","endLoc":971,"header":"def filename(self)","id":1848,"name":"filename","nodeType":"Function","startLoc":957,"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 : a string containing the file name associated with the\n                   HDUList object if an association exists.  Otherwise returns\n                   None.\n        \"\"\"\n        if self._file is not None:\n            if hasattr(self._file, 'name'):\n                return self._file.name\n        return None"},{"col":4,"comment":"null","endLoc":1182,"header":"def _verify(self, option='warn')","id":1849,"name":"_verify","nodeType":"Function","startLoc":1136,"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 = (\"HDUList's element {} is not an \"\n                            \"extension HDU.\".format(str(idx)))\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"},{"col":4,"comment":"null","endLoc":145,"header":"def __init__(self, second, alternativeactionstr=None)","id":1850,"name":"__init__","nodeType":"Function","startLoc":143,"text":"def __init__(self, second, alternativeactionstr=None):\n        self.second = second\n        self.alternativeactionstr = alternativeactionstr"},{"col":4,"comment":"null","endLoc":129,"header":"def __init__(self, second)","id":1851,"name":"__init__","nodeType":"Function","startLoc":128,"text":"def __init__(self, second):\n        self.second = second"},{"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        '<unkown>' for the 4 formatting arguments.\n    ","endLoc":111,"header":"def format_exception(msg, *args, **kwargs)","id":1852,"name":"format_exception","nodeType":"Function","startLoc":80,"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        '<unkown>' 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)"},{"col":0,"comment":"\n    Convert degrees, arcminute, arcsecond to a float degrees value.\n    ","endLoc":395,"header":"def dms_to_degrees(d, m, s=None)","id":1853,"name":"dms_to_degrees","nodeType":"Function","startLoc":371,"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:\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))\n\n    return sign * (d + m / 60. + s / 3600.)"},{"col":4,"comment":"\n        Update header keywords to reflect recent changes of columns.\n        ","endLoc":504,"header":"def update(self)","id":1854,"name":"update","nodeType":"Function","startLoc":494,"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":"\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'}, optional\n            Sorting algorithm.\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":2406,"header":"def argsort(self, keys=None, kind=None)","id":1855,"name":"argsort","nodeType":"Function","startLoc":2367,"text":"def argsort(self, keys=None, kind=None):\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'}, optional\n            Sorting algorithm.\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, self[keys])\n            if index is not None:\n                return index.sorted_data()\n\n        kwargs = {}\n        if keys:\n            kwargs['order'] = keys\n        if kind:\n            kwargs['kind'] = kind\n\n        if keys:\n            data = self[keys].as_array()\n        else:\n            data = self.as_array()\n\n        return data.argsort(**kwargs)"},{"col":0,"comment":"\n    Inputs a table and some subset of its columns, and\n    returns an index corresponding to this subset or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`\n        Subset of the columns in the table argument\n    ","endLoc":628,"header":"def get_index(table, table_copy)","id":1856,"name":"get_index","nodeType":"Function","startLoc":609,"text":"def get_index(table, table_copy):\n    '''\n    Inputs a table and some subset of its columns, and\n    returns an index corresponding to this subset or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`\n        Subset of the columns in the table argument\n    '''\n    cols = set(table_copy.columns)\n    indices = set()\n    for column in cols:\n        for index in table[column].info.indices:\n            if set([x.info.name for x in index.columns]) == cols:\n                return index\n    return None"},{"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    ","endLoc":1283,"header":"def diff_values(a, b, rtol=0.0, atol=0.0)","id":1857,"name":"diff_values","nodeType":"Function","startLoc":1272,"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\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"},{"attributeType":"null","col":12,"comment":"null","endLoc":194,"id":1858,"name":"_data","nodeType":"Attribute","startLoc":194,"text":"self._data"},{"attributeType":"null","col":12,"comment":"null","endLoc":193,"id":1859,"name":"_file","nodeType":"Attribute","startLoc":193,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":201,"id":1860,"name":"_in_read_next_hdu","nodeType":"Attribute","startLoc":201,"text":"self._in_read_next_hdu"},{"attributeType":"null","col":8,"comment":"null","endLoc":360,"id":1861,"name":"_truncate","nodeType":"Attribute","startLoc":360,"text":"self._truncate"},{"attributeType":"null","col":12,"comment":"null","endLoc":215,"id":1862,"name":"_read_all","nodeType":"Attribute","startLoc":215,"text":"self._read_all"},{"attributeType":"null","col":8,"comment":"null","endLoc":200,"id":1863,"name":"_open_kwargs","nodeType":"Attribute","startLoc":200,"text":"self._open_kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":196,"id":1864,"name":"_save_backup","nodeType":"Attribute","startLoc":196,"text":"self._save_backup"},{"attributeType":"null","col":8,"comment":"null","endLoc":359,"id":1865,"name":"_resize","nodeType":"Attribute","startLoc":359,"text":"self._resize"},{"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\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        ","endLoc":2464,"header":"def sort(self, keys=None)","id":1866,"name":"sort","nodeType":"Function","startLoc":2408,"text":"def sort(self, keys=None):\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\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        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)\n        sort_index = get_index(self, self[keys])\n        if sort_index is not None:\n            # avoid inefficient relabelling of sorted index\n            prev_frozen = sort_index._frozen\n            sort_index._frozen = True\n\n        for col in self.columns.values():\n            col[:] = col.take(indexes, axis=0)\n\n        if sort_index is not None:\n            # undo index freeze\n            sort_index._frozen = prev_frozen\n            # now relabel the sort index appropriately\n            sort_index.sort()"},{"className":"ImageHDU","col":0,"comment":"\n    FITS image extension HDU class.\n    ","endLoc":1125,"id":1867,"nodeType":"Class","startLoc":1044,"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 : Header instance\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":"\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":690,"header":"def _clear_table_keywords(self, index=None)","id":1868,"name":"_clear_table_keywords","nodeType":"Function","startLoc":641,"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                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":1111,"header":"@classmethod\n    def match_header(cls, header)","id":1869,"name":"match_header","nodeType":"Function","startLoc":1105,"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":1125,"header":"def _verify(self, option='warn')","id":1870,"name":"_verify","nodeType":"Function","startLoc":1113,"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":"\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":2497,"header":"def reverse(self)","id":1871,"name":"reverse","nodeType":"Function","startLoc":2466,"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            col[:] = col[::-1]\n        for index in self.indices:\n            index.reverse()"},{"col":4,"comment":"null","endLoc":518,"header":"def _verify(self, option='warn')","id":1872,"name":"_verify","nodeType":"Function","startLoc":501,"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":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":354,"header":"def parse_angle(angle, unit=None, debug=False)","id":1873,"name":"parse_angle","nodeType":"Function","startLoc":323,"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":"\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).\n        ","endLoc":2527,"header":"@classmethod\n    def read(cls, *args, **kwargs)","id":1874,"name":"read","nodeType":"Function","startLoc":2499,"text":"@classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).\n        \"\"\"\n        out = io_registry.read(cls, *args, **kwargs)\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 {0} '\n                                'class.'.format(cls.__name__))\n        return out"},{"col":23,"endLoc":506,"id":1875,"nodeType":"Lambda","startLoc":506,"text":"lambda v: (_is_int(v) and 1 <= v <= 999)"},{"col":44,"endLoc":1123,"id":1876,"nodeType":"Lambda","startLoc":1123,"text":"lambda v: (_is_int(v) and v == 0)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1049,"id":1877,"name":"_extension","nodeType":"Attribute","startLoc":1049,"text":"_extension"},{"col":36,"endLoc":508,"id":1878,"nodeType":"Lambda","startLoc":508,"text":"lambda v: (_is_int(v) and v == 0)"},{"col":14,"endLoc":512,"id":1879,"nodeType":"Lambda","startLoc":512,"text":"lambda x: x >= after"},{"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":2563,"header":"def copy(self, copy_data=True)","id":1880,"name":"copy","nodeType":"Function","startLoc":2546,"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"},{"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 `None`::\n\n        Unit()\n\n      Returns the null unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\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 : dictionary, 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":1934,"id":1881,"nodeType":"Class","startLoc":1816,"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 `None`::\n\n        Unit()\n\n      Returns the null unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\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 : dictionary, 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        return hash(self.name) + hash(self._represents)\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\n        return unit"},{"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":1590,"id":1882,"nodeType":"Class","startLoc":1427,"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 {0!r} already exists in \"\n                    \"given namespace ({1!r}).\".format(\n                        name, namespace[name]))\n\n        for name in self._names:\n            namespace[name] = self"},{"col":4,"comment":"null","endLoc":49,"header":"def __init__(self)","id":1883,"name":"__init__","nodeType":"Function","startLoc":40,"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.__dict__:\n            _AngleParser._parser, _AngleParser._lexer = self._make_parser()"},{"col":4,"comment":"null","endLoc":256,"header":"@classmethod\n    def _make_parser(cls)","id":1884,"name":"_make_parser","nodeType":"Function","startLoc":63,"text":"@classmethod\n    def _make_parser(cls):\n        from ..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        )\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_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            '(?:{0})'.format(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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        # Build the lexer\n        lexer = lex.lex(optimize=True, lextab='angle_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        def p_angle(p):\n            '''\n            angle : hms\n                  | dms\n                  | arcsecond\n                  | arcminute\n                  | simple\n            '''\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_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = float(p[1])\n\n        def p_colon(p):\n            '''\n            colon : sign UINT COLON ufloat\n                  | sign UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 5:\n                p[0] = (p[1] * p[2], p[4])\n            elif len(p) == 7:\n                p[0] = (p[1] * p[2], p[4], p[6])\n\n        def p_spaced(p):\n            '''\n            spaced : sign UINT ufloat\n                   | sign UINT UINT ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1] * p[2], p[3])\n            elif len(p) == 5:\n                p[0] = (p[1] * p[2], p[3], p[4])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | sign UFLOAT\n                    | sign UINT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] * p[2]\n\n        def p_hms(p):\n            '''\n            hms : sign UINT HOUR\n                | sign UINT HOUR ufloat\n                | sign UINT HOUR UINT MINUTE\n                | sign UINT HOUR UFLOAT MINUTE\n                | sign UINT HOUR UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.hourangle)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.hourangle)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : sign UINT DEGREE\n                | sign UINT DEGREE ufloat\n                | sign UINT DEGREE UINT MINUTE\n                | sign UINT DEGREE UFLOAT MINUTE\n                | sign UINT DEGREE UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.degree)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.degree)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), 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 = yacc.yacc(debug=False, tabmodule='angle_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser, lexer"},{"col":38,"endLoc":516,"id":1885,"nodeType":"Lambda","startLoc":516,"text":"lambda v: (v is True)"},{"col":4,"comment":"null","endLoc":2566,"header":"def __deepcopy__(self, memo=None)","id":1886,"name":"__deepcopy__","nodeType":"Function","startLoc":2565,"text":"def __deepcopy__(self, memo=None):\n        return self.copy(True)"},{"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":1424,"id":1887,"nodeType":"Class","startLoc":486,"text":"class UnitBase(metaclass=InheritDocstrings):\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    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 'Unit(\"{0}\")'.format(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        return CompositeUnit(1, [self], [p])\n\n    def __div__(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 __rdiv__(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    __truediv__ = __div__\n\n    __rtruediv__ = __rdiv__\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 __hash__(self):\n        # This must match the hash used in CompositeUnit for a unit\n        # with only one base and no scale or power.\n        return hash((str(self.scale), self.name, str('1')))\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 False\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 : unit object or 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 equivalence pairs, 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        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 = \"'{0}' ({1})\".format(\n                    unit_str, physical_type)\n            else:\n                unit_str = \"'{0}'\".format(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            \"{0} and {1} are not convertible\".format(\n                unit_str, other_str))\n\n    def _get_converter(self, other, equivalencies=[]):\n        other = Unit(other)\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            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            \"'{0!r}' is not a scaled version of '{1!r}'\".format(self, other))\n\n    def to(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        return self._get_converter(other, 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 : CompositeUnit object\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                \"Cannot represent unit {0} in terms of the given \"\n                \"units\".format(self))\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=False):\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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :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        units : set of units to compose to, 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 `False`.\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        # 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        Return the physical type on the unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> print(u.m.physical_type)\n        length\n\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 equivalence pairs, optional\n            A list of equivalence pairs to also pull options from.\n            See :ref:`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        def __repr__(self):\n            if len(self) == 0:\n                return \"[]\"\n            else:\n                lines = []\n                for u in self:\n                    irred = u.decompose().to_string()\n                    if irred == u.name:\n                        irred = \"irreducible\"\n                    lines.append((u.name, irred, ', '.join(u.aliases)))\n\n                lines.sort()\n                lines.insert(0, ('Primary name', 'Unit definition', 'Aliases'))\n                widths = [0, 0, 0]\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                         ['{0} ,'.format(x) for x in lines[1:]] +\n                         [']'])\n                return '\\n'.join(lines)\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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :ref:`unit_equivalencies`.\n            Any list given, including an empty one, supercedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of units to search in, 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":"Populate the new table definition keywords from the header.","endLoc":700,"header":"def _populate_table_keywords(self)","id":1888,"name":"_populate_table_keywords","nodeType":"Function","startLoc":692,"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":2569,"header":"def __copy__(self)","id":1889,"name":"__copy__","nodeType":"Function","startLoc":2568,"text":"def __copy__(self):\n        return self.copy(False)"},{"col":4,"comment":"null","endLoc":2572,"header":"def __lt__(self, other)","id":1890,"name":"__lt__","nodeType":"Function","startLoc":2571,"text":"def __lt__(self, other):\n        return super().__lt__(other)"},{"col":4,"comment":"null","endLoc":503,"header":"def __deepcopy__(self, memo)","id":1891,"name":"__deepcopy__","nodeType":"Function","startLoc":499,"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":514,"header":"def _repr_latex_(self)","id":1892,"name":"_repr_latex_","nodeType":"Function","startLoc":505,"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":2575,"header":"def __gt__(self, other)","id":1893,"name":"__gt__","nodeType":"Function","startLoc":2574,"text":"def __gt__(self, other):\n        return super().__gt__(other)"},{"col":4,"comment":"null","endLoc":2578,"header":"def __le__(self, other)","id":1894,"name":"__le__","nodeType":"Function","startLoc":2577,"text":"def __le__(self, other):\n        return super().__le__(other)"},{"col":4,"comment":"null","endLoc":2581,"header":"def __ge__(self, other)","id":1895,"name":"__ge__","nodeType":"Function","startLoc":2580,"text":"def __ge__(self, other):\n        return super().__ge__(other)"},{"col":4,"comment":"null","endLoc":61,"header":"@classmethod\n    def _get_simple_unit_names(cls)","id":1896,"name":"_get_simple_unit_names","nodeType":"Function","startLoc":51,"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 list(simple_unit_names)"},{"col":4,"comment":"null","endLoc":85,"header":"@classmethod\n    def to_string(cls, unit)","id":1897,"name":"to_string","nodeType":"Function","startLoc":65,"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 r'$\\mathrm{{{0}}}$'.format(s)"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":567,"header":"def _calculate_datasum(self)","id":1898,"name":"_calculate_datasum","nodeType":"Function","startLoc":520,"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":4,"comment":"null","endLoc":2605,"header":"def __eq__(self, other)","id":1899,"name":"__eq__","nodeType":"Function","startLoc":2583,"text":"def __eq__(self, other):\n\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.masked:\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":787,"header":"def _report(self)","id":1900,"name":"_report","nodeType":"Function","startLoc":752,"text":"def _report(self):\n        if self.diff_keyword_count:\n            self._writeln(' Headers have different number of cards:')\n            self._writeln('  a: {}'.format(self.diff_keyword_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra keyword {!r:8} in a: {!r}'.format(\n                                keyword, val))\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(' Extra keyword {!r:8} in b: {!r}'.format(\n                                keyword, val))\n\n        if self.diff_duplicate_keywords:\n            for keyword, count in sorted(self.diff_duplicate_keywords.items()):\n                self._writeln(' Inconsistent duplicates of keyword {!r:8}:'\n                              .format(keyword))\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":63,"header":"@classmethod\n    def _format_bases(cls, unit)","id":1901,"name":"_format_bases","nodeType":"Function","startLoc":47,"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 = r'\\frac{{{0}}}{{{1}}}'.format(positives, negatives)\n        else:\n            positives = cls._format_unit_list(positives)\n            s = positives\n\n        return s"},{"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 ints\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":42,"header":"def get_grouped_by_powers(bases, powers)","id":1902,"name":"get_grouped_by_powers","nodeType":"Function","startLoc":14,"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 ints\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":4,"comment":"null","endLoc":2608,"header":"def __ne__(self, other)","id":1903,"name":"__ne__","nodeType":"Function","startLoc":2607,"text":"def __ne__(self, other):\n        return ~self.__eq__(other)"},{"col":4,"comment":"null","endLoc":2614,"header":"@property\n    def groups(self)","id":1904,"name":"groups","nodeType":"Function","startLoc":2610,"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":"null","endLoc":45,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":1905,"name":"_format_unit_list","nodeType":"Function","startLoc":35,"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('{0}^{{{1}}}'.format(\n                    cls._get_unit_name(base),\n                    utils.format_power(power)))\n        return r'\\,'.join(out)"},{"col":4,"comment":"\n        Group this table by the specified ``keys``\n\n        This effectively splits the table into groups which correspond to\n        unique values of the ``keys`` grouping object.  The output is a new\n        `TableGroups` which contains a copy of this table but sorted by row\n        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          - `Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `Table`\n            New table with groups set\n        ","endLoc":2644,"header":"def group_by(self, keys)","id":1906,"name":"group_by","nodeType":"Function","startLoc":2616,"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\n        unique values of the ``keys`` grouping object.  The output is a new\n        `TableGroups` which contains a copy of this table but sorted by row\n        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          - `Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `Table`\n            New table with groups set\n        \"\"\"\n        if self.has_mixin_columns:\n            raise NotImplementedError('group_by not available for tables with mixin columns')\n\n        return groups.table_group_by(self, keys)"},{"col":0,"comment":"null","endLoc":18,"header":"def table_group_by(table, keys)","id":1907,"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":"null","endLoc":1047,"header":"def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',\n        reflags=0, nowarn=False, outputdir=None, debuglog=None, errorlog=None)","id":1908,"name":"lex","nodeType":"Function","startLoc":863,"text":"def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',\n        reflags=0, 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            line = f.__code__.co_firstlineno\n            file = f.__code__.co_filename\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        except IOError as e:\n            errorlog.warning(\"Couldn't write lextab module %r. %s\" % (lextab, e))\n\n    return lexobj"},{"col":4,"comment":"null","endLoc":33,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":1909,"name":"_get_unit_name","nodeType":"Function","startLoc":28,"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":26,"header":"@classmethod\n    def _latex_escape(cls, name)","id":1910,"name":"_latex_escape","nodeType":"Function","startLoc":21,"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'\\_')"},{"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":402,"header":"@classmethod\n    def match_header(cls, header)","id":1911,"name":"match_header","nodeType":"Function","startLoc":394,"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":412,"header":"@lazyproperty\n    def columns(self)","id":1912,"name":"columns","nodeType":"Function","startLoc":404,"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":0,"comment":"\n    Converts a value for a power (which may be floating point or a\n    `fractions.Fraction` object), into a string either looking like\n    an integer or a fraction.\n    ","endLoc":127,"header":"def format_power(power)","id":1913,"name":"format_power","nodeType":"Function","startLoc":113,"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 either looking like\n    an integer or a fraction.\n    \"\"\"\n    if not isinstance(power, Fraction):\n        if power % 1.0 != 0.0:\n            frac = Fraction.from_float(power)\n            power = frac.limit_denominator(10)\n            if power.denominator == 1:\n                power = int(power.numerator)\n        else:\n            power = int(power)\n    return str(power)"},{"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":98,"header":"def _table_group_by(table, keys)","id":1914,"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    # 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('Table does not have key column {0!r}'.format(name))\n            if table.masked and np.any(table[name].mask):\n                raise ValueError('Missing values in key column {0!r} are not allowed'.format(name))\n\n        keys = tuple(keys)\n        table_keys = table[keys]\n        grouped_by_table_cols = True  # Grouping keys are columns from the table being grouped\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 {0} does not match table length {1}'\n                             .format(len(table_keys), len(table)))\n        grouped_by_table_cols = False  # Grouping key(s) are external\n\n    else:\n        raise TypeError('Keys input must be string, list, tuple or numpy array, but got {0}'\n                        .format(type(keys)))\n\n    try:\n        # take advantage of index internal sort if possible\n        table_index = get_index(table, table_keys) if \\\n                      isinstance(table_keys, Table) else None\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    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":421,"header":"@lazyproperty\n    def data(self)","id":1915,"name":"data","nodeType":"Function","startLoc":414,"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":477,"header":"@data.setter\n    def data(self, data)","id":1916,"name":"data","nodeType":"Function","startLoc":423,"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            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\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":"Return string representation for unit","endLoc":518,"header":"def __bytes__(self)","id":1917,"name":"__bytes__","nodeType":"Function","startLoc":516,"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":501,"header":"@classmethod\n    def to_string(cls, unit)","id":1918,"name":"to_string","nodeType":"Function","startLoc":499,"text":"@classmethod\n    def to_string(cls, unit):\n        return _to_string(cls, unit)"},{"col":4,"comment":"null","endLoc":484,"header":"@property\n    def _nrows(self)","id":1919,"name":"_nrows","nodeType":"Function","startLoc":479,"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":489,"header":"@lazyproperty\n    def _theap(self)","id":1920,"name":"_theap","nodeType":"Function","startLoc":486,"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        Return a :class:`pandas.DataFrame` instance\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 contains mixin or multi-dimensional columns\n        ","endLoc":2686,"header":"def to_pandas(self)","id":1921,"name":"to_pandas","nodeType":"Function","startLoc":2646,"text":"def to_pandas(self):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\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 contains mixin or multi-dimensional columns\n        \"\"\"\n        from pandas import DataFrame\n\n        if self.has_mixin_columns:\n            raise ValueError(\"Cannot convert a table with mixin columns to a pandas DataFrame\")\n\n        if any(getattr(col, 'ndim', 1) > 1 for col in self.columns.values()):\n            raise ValueError(\"Cannot convert a table with multi-dimensional columns to a pandas DataFrame\")\n\n        out = OrderedDict()\n\n        for name, column in self.columns.items():\n            if isinstance(column, MaskedColumn):\n                if column.dtype.kind in ['i', 'u']:\n                    out[name] = column.astype(float).filled(np.nan)\n                elif column.dtype.kind in ['f', 'c']:\n                    out[name] = column.filled(np.nan)\n                else:\n                    out[name] = column.astype(object).filled(np.nan)\n            else:\n                out[name] = column\n\n            if out[name].dtype.byteorder not in ('=', '|'):\n                out[name] = out[name].byteswap().newbyteorder()\n\n        return DataFrame(out)"},{"col":4,"comment":"\n        Make a copy of the table HDU, both header and data are copied.\n        ","endLoc":514,"header":"def copy(self)","id":1922,"name":"copy","nodeType":"Function","startLoc":506,"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":0,"comment":"\n    Write a diff between two header keyword values or comments to the specified\n    file-like object.\n    ","endLoc":1353,"header":"def report_diff_keyword_attr(fileobj, attr, diffs, keyword, ind=0)","id":1923,"name":"report_diff_keyword_attr","nodeType":"Function","startLoc":1336,"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 = '[{}]'.format(idx + 1)\n            fileobj.write(indent(' Keyword {:8}{} has different {}:\\n'\n                                 .format(keyword, dup, attr), ind))\n            report_diff_values(fileobj, val[0], val[1], ind=ind + 1)"},{"col":4,"comment":"null","endLoc":545,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":1924,"name":"_prewriteto","nodeType":"Function","startLoc":516,"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":583,"header":"def _summary(self)","id":1925,"name":"_summary","nodeType":"Function","startLoc":569,"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 = '{} Groups  {} Parameters'.format(self._gcount, self._pcount)\n        return (name, ver, classname, length, shape, format, gcount)"},{"col":0,"comment":"Write a diff between two values to the specified file-like object.","endLoc":1333,"header":"def report_diff_values(fileobj, a, b, ind=0)","id":1926,"name":"report_diff_values","nodeType":"Function","startLoc":1286,"text":"def report_diff_values(fileobj, a, b, ind=0):\n    \"\"\"Write a diff between two values to the specified file-like object.\"\"\"\n\n    typea = type(a)\n    typeb = type(b)\n\n    if (isinstance(a, str) and not isinstance(b, str)):\n        a = repr(a).lstrip('u')\n    elif (isinstance(b, str) and not isinstance(a, str)):\n        b = repr(b).lstrip('u')\n\n    if isinstance(a, (int, float, complex, np.number)):\n        a = repr(a)\n\n    if isinstance(b, (int, float, complex, np.number)):\n        b = repr(b)\n\n    if isinstance(a, np.ndarray) and isinstance(b, np.ndarray):\n        diff_indices = np.where(a != b)\n        num_diffs = reduce(operator.mul, map(len, diff_indices), 1)\n        for idx in islice(zip(*diff_indices), 3):\n            fileobj.write(indent('  at {!r}:\\n'.format(list(idx)), ind))\n            report_diff_values(fileobj, a[idx], b[idx], ind=ind + 1)\n\n        if num_diffs > 3:\n            fileobj.write(indent('  ...and at {} more indices.\\n'\n                                 .format(num_diffs - 3), ind))\n        return\n\n    padding = max(len(typea.__name__), len(typeb.__name__)) + 3\n\n    for line in difflib.ndiff(str(a).splitlines(), str(b).splitlines()):\n        if line[0] == '-':\n            line = 'a>' + line[1:]\n            if typea != typeb:\n                typename = '(' + typea.__name__ + ') '\n                line = typename.rjust(padding) + line\n\n        elif line[0] == '+':\n            line = 'b>' + line[1:]\n            if typea != typeb:\n                typename = '(' + typeb.__name__ + ') '\n                line = typename.rjust(padding) + line\n        else:\n            line = ' ' + line\n            if typea != typeb:\n                line = ' ' * padding + line\n        fileobj.write(indent('  {}\\n'.format(line.rstrip('\\n')), ind))"},{"col":4,"comment":"null","endLoc":142,"header":"def __init__(self)","id":1927,"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"},{"col":4,"comment":"\n        Create a `Table` from a :class:`pandas.DataFrame` instance\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            The pandas :class:`pandas.DataFrame` instance\n\n        Returns\n        -------\n        table : `Table`\n            A `Table` (or subclass) instance\n        ","endLoc":2730,"header":"@classmethod\n    def from_pandas(cls, dataframe)","id":1928,"name":"from_pandas","nodeType":"Function","startLoc":2688,"text":"@classmethod\n    def from_pandas(cls, dataframe):\n        \"\"\"\n        Create a `Table` from a :class:`pandas.DataFrame` instance\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            The pandas :class:`pandas.DataFrame` instance\n\n        Returns\n        -------\n        table : `Table`\n            A `Table` (or subclass) instance\n        \"\"\"\n\n        out = OrderedDict()\n\n        for name in dataframe.columns:\n            column = dataframe[name]\n            mask = np.array(column.isnull())\n            data = np.array(column)\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            if np.any(mask):\n                out[name] = MaskedColumn(data=data, name=name, mask=mask)\n            else:\n                out[name] = Column(data=data, name=name)\n\n        return cls(out)"},{"col":0,"comment":"null","endLoc":48,"header":"def _to_string(cls, unit)","id":1929,"name":"_to_string","nodeType":"Function","startLoc":23,"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('{0:g}'.format(unit.scale))\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('{0}'.format(unit_list))\n                else:\n                    parts.append('({0})'.format(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":77,"header":"def __init__(self, f)","id":1930,"name":"__init__","nodeType":"Function","startLoc":76,"text":"def __init__(self, f):\n        self.f = f"},{"attributeType":"null","col":4,"comment":"null","endLoc":260,"id":1931,"name":"_bitpix2tform","nodeType":"Attribute","startLoc":260,"text":"_bitpix2tform"},{"attributeType":"null","col":4,"comment":"null","endLoc":261,"id":1932,"name":"_data_type","nodeType":"Attribute","startLoc":261,"text":"_data_type"},{"col":0,"comment":"null","endLoc":454,"header":"def get_caller_module_dict(levels)","id":1933,"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":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":1934,"name":"_data_field","nodeType":"Attribute","startLoc":262,"text":"_data_field"},{"attributeType":"null","col":8,"comment":"null","endLoc":335,"id":1935,"name":"_data_field","nodeType":"Attribute","startLoc":335,"text":"self._data_field"},{"attributeType":"null","col":12,"comment":"null","endLoc":274,"id":1936,"name":"_axes","nodeType":"Attribute","startLoc":274,"text":"self._axes"},{"col":4,"comment":"Return string representation for unit","endLoc":522,"header":"def __str__(self)","id":1937,"name":"__str__","nodeType":"Function","startLoc":520,"text":"def __str__(self):\n        \"\"\"Return string representation for unit\"\"\"\n        return unit_format.Generic.to_string(self)"},{"col":4,"comment":"null","endLoc":527,"header":"def __repr__(self)","id":1938,"name":"__repr__","nodeType":"Function","startLoc":524,"text":"def __repr__(self):\n        string = unit_format.Generic.to_string(self)\n\n        return 'Unit(\"{0}\")'.format(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":541,"header":"def _get_physical_type_id(self)","id":1939,"name":"_get_physical_type_id","nodeType":"Function","startLoc":529,"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        _TableBaseHDU verify method.\n        ","endLoc":562,"header":"def _verify(self, option='warn')","id":1940,"name":"_verify","nodeType":"Function","startLoc":547,"text":"def _verify(self, option='warn'):\n        \"\"\"\n        _TableBaseHDU verify method.\n        \"\"\"\n\n        errs = super()._verify(option=option)\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":38,"endLoc":553,"id":1941,"nodeType":"Lambda","startLoc":553,"text":"lambda v: (v == 2)"},{"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 : CompositeUnit object\n            New object containing only irreducible unit objects.\n        ","endLoc":992,"header":"def decompose(self, bases=set())","id":1942,"name":"decompose","nodeType":"Function","startLoc":974,"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 : CompositeUnit object\n            New object containing only irreducible unit objects.\n        \"\"\"\n        raise NotImplementedError()"},{"col":39,"endLoc":554,"id":1943,"nodeType":"Lambda","startLoc":554,"text":"lambda v: (v == 8)"},{"col":4,"comment":"\n        Returns all of the names associated with this unit.\n        ","endLoc":550,"header":"@property\n    def names(self)","id":1944,"name":"names","nodeType":"Function","startLoc":543,"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":559,"header":"@property\n    def name(self)","id":1945,"name":"name","nodeType":"Function","startLoc":552,"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":568,"header":"@property\n    def aliases(self)","id":1946,"name":"aliases","nodeType":"Function","startLoc":561,"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":575,"header":"@property\n    def scale(self)","id":1947,"name":"scale","nodeType":"Function","startLoc":570,"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":582,"header":"@property\n    def bases(self)","id":1948,"name":"bases","nodeType":"Function","startLoc":577,"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":589,"header":"@property\n    def powers(self)","id":1949,"name":"powers","nodeType":"Function","startLoc":584,"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":603,"header":"def to_string(self, format=unit_format.Generic)","id":1950,"name":"to_string","nodeType":"Function","startLoc":591,"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":23,"endLoc":556,"id":1951,"nodeType":"Lambda","startLoc":556,"text":"lambda v: (_is_int(v) and v >= 0 and v <= 999)"},{"col":4,"comment":"null","endLoc":567,"header":"def __init__(self, ldict, log=None, reflags=0)","id":1952,"name":"__init__","nodeType":"Function","startLoc":559,"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"},{"col":4,"comment":"Try to format units using a formatter.","endLoc":610,"header":"def __format__(self, format_spec)","id":1953,"name":"__format__","nodeType":"Function","startLoc":605,"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)"},{"fileName":"table.py","filePath":"astropy/io/fits/hdu","id":1954,"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 .. import _numpy_hacks as nh\nfrom ..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, _get_index)\nfrom ..fitsrec import FITS_rec, _get_recarray_field, _has_unicode_fields\nfrom ..header import Header, _pad_length\nfrom ..util import _is_int, _str_to_num\n\nfrom ....utils import lazyproperty\nfrom ....utils.exceptions import AstropyUserWarning\nfrom ....utils.decorators import deprecated_renamed_argument\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`, or other\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\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            data = raw_data[:self._theap].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_column_added(self, columns, column):\n        \"\"\"\n        Update the data upon addition of a new column through the `ColDefs`\n        interface.\n        \"\"\"\n\n        # TODO: It's not clear that this actually works--it probably does not.\n        # This is what the code used to do before introduction of the\n        # notifier interface, but I don't believe it actually worked (there are\n        # several bug reports related to this...)\n        if self._data_loaded:\n            del self.data\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\n        # For now this doesn't do anything fancy--it just deletes the data\n        # attribute so that it is forced to be recreated again.  It doesn't\n        # change anything on the existing data recarray (this is also how this\n        # worked before introducing the notifier interface)\n        if self._data_loaded:\n            del self.data\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.\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        if header is not None and not isinstance(header, Header):\n            raise ValueError('header must be a Header object.')\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', '', ''),\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                # 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                    # Just doing a view on the input data screws up unsigned\n                    # columns, so treat those more carefully.\n                    # TODO: I need to read this code a little more closely\n                    # again, but I think it can be simplified quite a bit with\n                    # the use of some appropriate utility functions\n                    update_coldefs = {}\n                    if 'u' in [data.dtype[k].kind for k in data.dtype.names]:\n                        self._uint = True\n                        bzeros = {2: np.uint16(2**15), 4: np.uint32(2**31),\n                                  8: np.uint64(2**63)}\n\n                        new_dtype = [\n                            (k, data.dtype[k].kind.replace('u', 'i') +\n                            str(data.dtype[k].itemsize))\n                            for k in data.dtype.names]\n\n                        new_data = np.zeros(data.shape, dtype=new_dtype)\n\n                        for k in data.dtype.fields:\n                            dtype = data.dtype[k]\n                            if dtype.kind == 'u':\n                                new_data[k] = data[k] - bzeros[dtype.itemsize]\n                                update_coldefs[k] = bzeros[dtype.itemsize]\n                            else:\n                                new_data[k] = data[k]\n                        self.data = new_data.view(self._data_type)\n                        # Uck...\n                        self.data._uint = True\n                    else:\n                        self.data = data.view(self._data_type)\n                    for k in update_coldefs:\n                        indx = _get_index(self.data.names, k)\n                        self.data._coldefs[indx].bzero = update_coldefs[k]\n                        # This is so bad that we have to update this in\n                        # duplicate...\n                        self.data._coldefs.bzeros[indx] = update_coldefs[k]\n                        # More uck...\n                        self.data._coldefs[indx]._physical_values = False\n                        self.data._coldefs[indx]._pseudo_unsigned_ints = True\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.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        if not (isinstance(self._header[0], str) and\n                self._header[0].rstrip() == self._extension):\n            self._header[0] = (self._extension, self._ext_comment)\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            self.__dict__['data'] = data\n\n            self.columns = self.data.columns\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        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                shape, format = (), ''\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            shape = ()\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 = '[{}]'.format(format)\n        dims = \"{}R x {}C\".format(nrows, ncols)\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                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(\"Duplicate field names: {}\".format(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 ....table import Table\n        if isinstance(data, Table):\n            from ..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            # TODO: The following code may no longer be necessary since it is\n            # now possible to get a pointer directly to the heap data as a\n            # whole.  That said, it is possible for the heap section to contain\n            # data that is not actually pointed to by the table (i.e. garbage;\n            # this *shouldn't* happen but it is not disallowed either)--need to\n            # double check whether or not the checksum should include such\n            # garbage\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\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                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                            if not fileobj.simulateonly:\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                    if not fileobj.simulateonly:\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : file path, file object or file-like object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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                        warnings.warn(\n                            \"Overwriting existing file '{}'.\".format(f),\n                            AstropyUserWarning)\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([\"File '{}' already exists.\".format(f)\n                                     for f in exist]))\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 : file path, file object or file-like object\n            Input data file containing the table data in ASCII format.\n\n        cdfile : file path, file object, file-like object, 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 : file path, file object, file-like object, 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\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 : Header object\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            supercedes 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 '{:21d}'.format(val)\n            elif format in np.typecodes['Complex']:\n                return '{:21.15g}+{:.15g}j'.format(val.real, val.imag)\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return '{:#21.15g}'.format(val)\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('{:21d}'.format(len(row[column.name])))\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 += ['{: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    new_dtype = nh.realign_dtype(np.dtype(list(zip(names, formats))),\n                                 offsets)\n\n    data.dtype = new_dtype\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":640,"header":"def __pow__(self, p)","id":1955,"name":"__pow__","nodeType":"Function","startLoc":639,"text":"def __pow__(self, p):\n        return CompositeUnit(1, [self], [p])"},{"col":4,"comment":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":593,"header":"def _summary(self)","id":1956,"name":"_summary","nodeType":"Function","startLoc":564,"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                shape, format = (), ''\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            shape = ()\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 = '[{}]'.format(format)\n        dims = \"{}R x {}C\".format(nrows, ncols)\n        ncards = len(self._header)\n\n        return (self.name, self.ver, class_name, ncards, dims, format)"},{"col":0,"comment":"null","endLoc":440,"header":"def _get_regex(func)","id":1957,"name":"_get_regex","nodeType":"Function","startLoc":439,"text":"def _get_regex(func):\n    return getattr(func, 'regex', func.__doc__)"},{"className":"FITSTableDumpDialect","col":0,"comment":"\n    A CSV dialect for the Astropy format of ASCII dumps of FITS tables.\n    ","endLoc":45,"id":1958,"nodeType":"Class","startLoc":36,"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"},{"col":4,"comment":"null","endLoc":656,"header":"def __div__(self, m)","id":1959,"name":"__div__","nodeType":"Function","startLoc":642,"text":"def __div__(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":41,"id":1960,"name":"delimiter","nodeType":"Attribute","startLoc":41,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":1961,"name":"lineterminator","nodeType":"Attribute","startLoc":42,"text":"lineterminator"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":1962,"name":"quotechar","nodeType":"Attribute","startLoc":43,"text":"quotechar"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":1963,"name":"quoting","nodeType":"Attribute","startLoc":44,"text":"quoting"},{"col":0,"comment":"null","endLoc":523,"header":"def _form_master_re(relist, reflags, ldict, toknames)","id":1964,"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, re.VERBOSE | 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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":45,"id":1965,"name":"skipinitialspace","nodeType":"Attribute","startLoc":45,"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":814,"id":1966,"nodeType":"Class","startLoc":703,"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(\"Duplicate field names: {}\".format(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":737,"header":"def __init__(self, data=None, header=None, name=None, ver=None, character_as_bytes=False)","id":1967,"name":"__init__","nodeType":"Function","startLoc":736,"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":"null","endLoc":599,"header":"def _update_column_removed(self, columns, idx)","id":1968,"name":"_update_column_removed","nodeType":"Function","startLoc":595,"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":639,"header":"def _update_column_attribute_changed(self, column, col_idx, attr,\n                                         old_value, new_value)","id":1969,"name":"_update_column_attribute_changed","nodeType":"Function","startLoc":601,"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"},{"col":4,"comment":"null","endLoc":1137,"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":1970,"name":"__new__","nodeType":"Function","startLoc":1100,"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 and hasattr(data, 'mask'):\n            mask = data.mask\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\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 = self.dtype.type(data.fill_value)\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"},{"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":262,"id":1971,"name":"_manages_own_heap","nodeType":"Attribute","startLoc":262,"text":"_manages_own_heap"},{"attributeType":"null","col":8,"comment":"null","endLoc":281,"id":1972,"name":"_character_as_bytes","nodeType":"Attribute","startLoc":281,"text":"self._character_as_bytes"},{"attributeType":"null","col":12,"comment":"null","endLoc":392,"id":1973,"name":"ver","nodeType":"Attribute","startLoc":392,"text":"self.ver"},{"col":4,"comment":"null","endLoc":745,"header":"@classmethod\n    def match_header(cls, header)","id":1974,"name":"match_header","nodeType":"Function","startLoc":739,"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"},{"attributeType":"null","col":24,"comment":"null","endLoc":346,"id":1975,"name":"data","nodeType":"Attribute","startLoc":346,"text":"self.data"},{"attributeType":"null","col":16,"comment":"null","endLoc":365,"id":1976,"name":"columns","nodeType":"Attribute","startLoc":365,"text":"self.columns"},{"attributeType":"null","col":24,"comment":"null","endLoc":324,"id":1977,"name":"_uint","nodeType":"Attribute","startLoc":324,"text":"self._uint"},{"col":4,"comment":"null","endLoc":674,"header":"def __rdiv__(self, m)","id":1978,"name":"__rdiv__","nodeType":"Function","startLoc":658,"text":"def __rdiv__(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"},{"attributeType":"null","col":12,"comment":"null","endLoc":310,"id":1979,"name":"_header","nodeType":"Attribute","startLoc":310,"text":"self._header"},{"attributeType":"null","col":12,"comment":"null","endLoc":390,"id":1980,"name":"name","nodeType":"Attribute","startLoc":390,"text":"self.name"},{"col":4,"comment":"null","endLoc":777,"header":"def _get_tbdata(self)","id":1981,"name":"_get_tbdata","nodeType":"Function","startLoc":747,"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(\"Duplicate field names: {}\".format(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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":429,"id":1982,"name":"_data_replaced","nodeType":"Attribute","startLoc":429,"text":"self._data_replaced"},{"attributeType":"null","col":8,"comment":"null","endLoc":433,"id":1983,"name":"_modified","nodeType":"Attribute","startLoc":433,"text":"self._modified"},{"col":4,"comment":"null","endLoc":858,"header":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False)","id":1984,"name":"__init__","nodeType":"Function","startLoc":846,"text":"def __init__(self, data=None, header=None, name=None, uint=False, ver=None,\n                 character_as_bytes=False):\n        from ....table import Table\n        if isinstance(data, Table):\n            from ..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":4,"comment":"null","endLoc":696,"header":"def __mul__(self, m)","id":1985,"name":"__mul__","nodeType":"Function","startLoc":680,"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":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":557,"header":"def table_to_hdu(table, character_as_bytes=False)","id":1986,"name":"table_to_hdu","nodeType":"Function","startLoc":426,"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\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 ...table.column import BaseColumn, Column\n        from ...time import Time\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('cannot write table with mixin column(s) {0}'\n                         .format(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    if table.masked:\n        # float column's default mask value needs to be Nan\n        for column in table.columns.values():\n            fill_value = column.get_fill_value()\n            if column.dtype.kind == 'f' and np.allclose(fill_value, 1e20):\n                column.set_fill_value(np.nan)\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(np.array(table.filled()), header=hdr, character_as_bytes=True)\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            # 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            # The astype is necessary because if the string column is less\n            # than one character, the fill value will be N/A by default which\n            # is too long, and so no values will get masked.\n            fill_value = table[col.name].get_fill_value()\n\n            col.null = fill_value.astype(table[col.name].dtype)\n    else:\n        table_hdu = BinTableHDU.from_columns(np.array(table.filled()), header=hdr, character_as_bytes=character_as_bytes)\n\n    # Set units for output HDU\n    for col in table_hdu.columns:\n        unit = table[col.name].unit\n        if unit is not None:\n            try:\n                col.unit = unit.to_string(format='fits')\n            except UnitScaleError:\n                scale = unit.scale\n                raise UnitScaleError(\n                    \"The column '{0}' could not be stored in FITS format \"\n                    \"because it has a scale '({1})' that \"\n                    \"is not recognized by the FITS standard. Either scale \"\n                    \"the data or change the units.\".format(col.name, str(scale)))\n            except ValueError:\n                warnings.warn(\n                    \"The unit '{0}' could not be saved to FITS format\".format(\n                        unit.to_string()), AstropyUserWarning)\n\n            # Try creating a Unit to issue a warning if the unit is not 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 all three, even if we have no data.\n        for attr in 'coord_type', 'coord_unit', 'time_ref_pos':\n            setattr(col, attr, col_info.get(attr, None))\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                \"Meta-data keyword {0} will be ignored since it conflicts \"\n                \"with a FITS reserved keyword\".format(key), AstropyUserWarning)\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                        \"Attribute `{0}` of type {1} cannot be added to \"\n                        \"FITS Header - skipping\".format(key, type(value)),\n                        AstropyUserWarning)\n        else:\n            try:\n                table_hdu.header[key] = value\n            except ValueError:\n                warnings.warn(\n                    \"Attribute `{0}` of type {1} cannot be added to FITS \"\n                    \"Header - skipping\".format(key, type(value)),\n                    AstropyUserWarning)\n    return table_hdu"},{"attributeType":"null","col":4,"comment":"null","endLoc":222,"id":1987,"name":"meta","nodeType":"Attribute","startLoc":222,"text":"meta"},{"col":0,"comment":"null","endLoc":3492,"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":1988,"name":"yacc","nodeType":"Function","startLoc":3212,"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__ attribute is available, try to obtain it from the __module__ instead\n        if '__file__' not in pdict:\n            pdict['__file__'] = sys.modules[pdict['__module__']].__file__\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        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"},{"attributeType":"null","col":4,"comment":"null","endLoc":226,"id":1989,"name":"Row","nodeType":"Attribute","startLoc":226,"text":"Row"},{"attributeType":"null","col":4,"comment":"null","endLoc":227,"id":1990,"name":"Column","nodeType":"Attribute","startLoc":227,"text":"Column"},{"attributeType":"null","col":4,"comment":"null","endLoc":228,"id":1991,"name":"MaskedColumn","nodeType":"Attribute","startLoc":228,"text":"MaskedColumn"},{"attributeType":"null","col":4,"comment":"null","endLoc":229,"id":1992,"name":"TableColumns","nodeType":"Attribute","startLoc":229,"text":"TableColumns"},{"attributeType":"null","col":4,"comment":"null","endLoc":230,"id":1993,"name":"TableFormatter","nodeType":"Attribute","startLoc":230,"text":"TableFormatter"},{"attributeType":"null","col":4,"comment":"null","endLoc":2732,"id":1994,"name":"info","nodeType":"Attribute","startLoc":2732,"text":"info"},{"attributeType":"null","col":8,"comment":"null","endLoc":287,"id":1995,"name":"formatter","nodeType":"Attribute","startLoc":287,"text":"self.formatter"},{"attributeType":"null","col":12,"comment":"null","endLoc":1422,"id":1996,"name":"_column_class","nodeType":"Attribute","startLoc":1422,"text":"self._column_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":285,"id":1997,"name":"columns","nodeType":"Attribute","startLoc":285,"text":"self.columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":286,"id":1998,"name":"meta","nodeType":"Attribute","startLoc":286,"text":"self.meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":288,"id":1999,"name":"_copy_indices","nodeType":"Attribute","startLoc":288,"text":"self._copy_indices"},{"attributeType":"null","col":16,"comment":"null","endLoc":1407,"id":2000,"name":"_masked","nodeType":"Attribute","startLoc":1407,"text":"self._masked"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":2001,"name":"primary_key","nodeType":"Attribute","startLoc":290,"text":"self.primary_key"},{"attributeType":"null","col":12,"comment":"null","endLoc":2613,"id":2002,"name":"_groups","nodeType":"Attribute","startLoc":2613,"text":"self._groups"},{"col":4,"comment":"\n        Returns `True` if the unit is unscaled and dimensionless.\n        ","endLoc":1424,"header":"def is_unity(self)","id":2003,"name":"is_unity","nodeType":"Function","startLoc":1420,"text":"def is_unity(self):\n        \"\"\"\n        Returns `True` if the unit is unscaled and dimensionless.\n        \"\"\"\n        return False"},{"attributeType":"null","col":12,"comment":"null","endLoc":367,"id":2004,"name":"_init_indices","nodeType":"Attribute","startLoc":367,"text":"self._init_indices"},{"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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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":1025,"id":2005,"nodeType":"Class","startLoc":754,"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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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('{0}={1!r}'.format(attr, val))\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from ..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    def _make_compare(oper):\n        \"\"\"\n        Make comparison methods which encode the ``other`` object to utf-8\n        in the case of a bytestring dtype for Py3+.\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            if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U' and\n                    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            return getattr(self.data, op)(other)\n\n        return _compare\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 ints\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\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        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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            data = np.insert(self, obj, values, axis=axis)\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":751,"id":2006,"nodeType":"Class","startLoc":178,"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            dtype = (np.dtype(dtype).str, shape)\n            self_data = np.zeros(length, 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 = deepcopy(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 = np.array(data.to(unit), dtype=dtype, copy=copy)\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 = deepcopy(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 = fix_column_name(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 \\\n                       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 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        # 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\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 or\n            (isinstance(out_arr, BaseColumn) and\n             (context is not None 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        val = fix_column_name(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 '{0}': could not display \"\n                \"values in this column using this format ({1})\".format(\n                    self.name, err.args[0]))\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 : boolean\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 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 equivalence pairs, optional\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`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, copy=False, dtype=self.dtype, order='A')\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 : `~astropy.units.Unit` or str\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of equivalence pairs, optional\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        self.meta = deepcopy(getattr(obj, 'meta', {}))\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"},{"col":4,"comment":"null","endLoc":714,"header":"def __rmul__(self, m)","id":2007,"name":"__rmul__","nodeType":"Function","startLoc":698,"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":239,"header":"@property\n    def data(self)","id":2008,"name":"data","nodeType":"Function","startLoc":237,"text":"@property\n    def data(self):\n        return self.view(np.ndarray)"},{"col":4,"comment":"null","endLoc":249,"header":"@property\n    def parent_table(self)","id":2009,"name":"parent_table","nodeType":"Function","startLoc":241,"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":256,"header":"@parent_table.setter\n    def parent_table(self, table)","id":2010,"name":"parent_table","nodeType":"Function","startLoc":251,"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":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":302,"header":"def copy(self, order='C', data=None, copy_data=True)","id":2011,"name":"copy","nodeType":"Function","startLoc":260,"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        # 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":8,"comment":"null","endLoc":591,"id":2012,"name":"ignore_blanks","nodeType":"Attribute","startLoc":591,"text":"self.ignore_blanks"},{"attributeType":"null","col":8,"comment":"null","endLoc":595,"id":2013,"name":"ignore_comment_patterns","nodeType":"Attribute","startLoc":595,"text":"self.ignore_comment_patterns"},{"attributeType":"null","col":8,"comment":"null","endLoc":608,"id":2014,"name":"common_keywords","nodeType":"Attribute","startLoc":608,"text":"self.common_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":577,"id":2015,"name":"ignore_keywords","nodeType":"Attribute","startLoc":577,"text":"self.ignore_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":592,"id":2016,"name":"ignore_blank_cards","nodeType":"Attribute","startLoc":592,"text":"self.ignore_blank_cards"},{"col":4,"comment":"null","endLoc":719,"header":"def __hash__(self)","id":2017,"name":"__hash__","nodeType":"Function","startLoc":716,"text":"def __hash__(self):\n        # This must match the hash used in CompositeUnit for a unit\n        # with only one base and no scale or power.\n        return hash((str(self.scale), self.name, str('1')))"},{"col":4,"comment":"null","endLoc":738,"header":"def __eq__(self, other)","id":2018,"name":"__eq__","nodeType":"Function","startLoc":721,"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 False\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        Copy current groups into a copy of self ``out``\n        ","endLoc":683,"header":"def _copy_groups(self, out)","id":2019,"name":"_copy_groups","nodeType":"Function","startLoc":675,"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)"},{"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":932,"header":"def _to(self, other)","id":2020,"name":"_to","nodeType":"Function","startLoc":901,"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            \"'{0!r}' is not a scaled version of '{1!r}'\".format(self, other))"},{"attributeType":"null","col":8,"comment":"null","endLoc":611,"id":2021,"name":"diff_keyword_count","nodeType":"Attribute","startLoc":611,"text":"self.diff_keyword_count"},{"attributeType":"null","col":8,"comment":"null","endLoc":620,"id":2022,"name":"diff_keywords","nodeType":"Attribute","startLoc":620,"text":"self.diff_keywords"},{"attributeType":"null","col":12,"comment":"null","endLoc":588,"id":2023,"name":"rtol","nodeType":"Attribute","startLoc":588,"text":"self.rtol"},{"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":568,"header":"def time_to_fits(table)","id":2024,"name":"time_to_fits","nodeType":"Function","startLoc":477,"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\n    # Shallow copy of the input table\n    newtable = table.copy(copy_data=False)\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        if col.info.serialize_method['fits'] == 'formatted_value':\n            newtable.replace_column(col.info.name, Column(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.array([col.jd1, col.jd2])\n        # Roll the 0th (innermost) axis backwards, until it lies in the last position\n        # (jd12.ndim)\n        jd12 = np.rollaxis(jd12, 0, jd12.ndim)\n        newtable.replace_column(col.info.name, Column(jd12, unit='d'))\n\n        # Get column position(index)\n        n = table.colnames.index(col.info.name) + 1\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            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 incompatabile '\n                    'with scale \"{}\".'.format(col.info.name, col.scale.upper()),\n                    AstropyUserWarning)\n            if col.location.size > 1:\n                raise ValueError('Vectorized Location of Time Column \"{}\" cannot be '\n                                 'written, as it is not supported.'.format(col.info.name))\n            if location is None:\n                # Set global geocentric location\n                location = col.location\n                hdr.extend([Card(keyword='OBSGEO-{}'.format(dim.upper()),\n                                 value=getattr(location, dim).to_value(u.m))\n                            for dim in ('x', 'y', 'z')])\n            elif 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":"null","endLoc":741,"header":"def __ne__(self, other)","id":2025,"name":"__ne__","nodeType":"Function","startLoc":740,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":745,"header":"def __le__(self, other)","id":2026,"name":"__le__","nodeType":"Function","startLoc":743,"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":216,"header":"def __init__(self, parent_column, indices=None, keys=None)","id":2027,"name":"__init__","nodeType":"Function","startLoc":212,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":616,"id":2028,"name":"diff_keyword_positions","nodeType":"Attribute","startLoc":616,"text":"self.diff_keyword_positions"},{"attributeType":"null","col":8,"comment":"null","endLoc":628,"id":2029,"name":"diff_keyword_values","nodeType":"Attribute","startLoc":628,"text":"self.diff_keyword_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":594,"id":2030,"name":"ignore_keyword_patterns","nodeType":"Attribute","startLoc":594,"text":"self.ignore_keyword_patterns"},{"attributeType":"null","col":8,"comment":"null","endLoc":632,"id":2031,"name":"diff_keyword_comments","nodeType":"Attribute","startLoc":632,"text":"self.diff_keyword_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":624,"id":2032,"name":"diff_duplicate_keywords","nodeType":"Attribute","startLoc":624,"text":"self.diff_duplicate_keywords"},{"attributeType":"null","col":8,"comment":"null","endLoc":578,"id":2033,"name":"ignore_comments","nodeType":"Attribute","startLoc":578,"text":"self.ignore_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":581,"id":2034,"name":"atol","nodeType":"Attribute","startLoc":581,"text":"self.atol"},{"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":328,"header":"def __setstate__(self, state)","id":2035,"name":"__setstate__","nodeType":"Function","startLoc":304,"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":344,"header":"def __reduce__(self)","id":2036,"name":"__reduce__","nodeType":"Function","startLoc":330,"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":360,"header":"def __array_finalize__(self, obj)","id":2037,"name":"__array_finalize__","nodeType":"Function","startLoc":346,"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)"},{"col":4,"comment":"null","endLoc":749,"header":"def __ge__(self, other)","id":2038,"name":"__ge__","nodeType":"Function","startLoc":747,"text":"def __ge__(self, other):\n        scale = self._to(Unit(other))\n        return scale >= 1. or is_effectively_unity(scale)"},{"col":4,"comment":"\n        Copy key column attributes from ``obj`` to self\n        ","endLoc":731,"header":"def _copy_attrs(self, obj)","id":2039,"name":"_copy_attrs","nodeType":"Function","startLoc":724,"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        self.meta = deepcopy(getattr(obj, 'meta', {}))"},{"col":4,"comment":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":801,"header":"def _calculate_datasum(self)","id":2040,"name":"_calculate_datasum","nodeType":"Function","startLoc":779,"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()"},{"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":918,"id":2041,"nodeType":"Class","startLoc":795,"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, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(dimsa))\n            self._writeln('  b: {}'.format(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(' Data differs at {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=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":"\n        See `FITSDiff` for explanations of the initialization parameters.\n        ","endLoc":853,"header":"def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0, tolerance=None)","id":2042,"name":"__init__","nodeType":"Function","startLoc":827,"text":"def __init__(self, a, b, numdiffs=10, rtol=0.0, atol=0.0, tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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":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":388,"header":"def __array_wrap__(self, out_arr, context=None)","id":2043,"name":"__array_wrap__","nodeType":"Function","startLoc":362,"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 or\n            (isinstance(out_arr, BaseColumn) and\n             (context is not None and context[0] in _comparison_functions))):\n            return out_arr.data[()]\n        else:\n            return out_arr"},{"col":4,"comment":"\n        The name of this column.\n        ","endLoc":395,"header":"@property\n    def name(self)","id":2044,"name":"name","nodeType":"Function","startLoc":390,"text":"@property\n    def name(self):\n        \"\"\"\n        The name of this column.\n        \"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":405,"header":"@name.setter\n    def name(self, val)","id":2045,"name":"name","nodeType":"Function","startLoc":397,"text":"@name.setter\n    def name(self, val):\n        val = fix_column_name(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":"null","endLoc":752,"header":"def __lt__(self, other)","id":2046,"name":"__lt__","nodeType":"Function","startLoc":751,"text":"def __lt__(self, other):\n        return not (self >= other)"},{"col":4,"comment":"null","endLoc":755,"header":"def __gt__(self, other)","id":2047,"name":"__gt__","nodeType":"Function","startLoc":754,"text":"def __gt__(self, other):\n        return not (self <= other)"},{"col":4,"comment":"null","endLoc":758,"header":"def __neg__(self)","id":2048,"name":"__neg__","nodeType":"Function","startLoc":757,"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 : unit object or 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 equivalence pairs, 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        bool\n        ","endLoc":789,"header":"def is_equivalent(self, other, equivalencies=[])","id":2049,"name":"is_equivalent","nodeType":"Function","startLoc":760,"text":"def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : unit object or 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 equivalence pairs, 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        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":4,"comment":"null","endLoc":889,"header":"def _diff(self)","id":2050,"name":"_diff","nodeType":"Function","startLoc":855,"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":0,"comment":"\n    A version of numpy.allclose that returns the indices where the two arrays\n    differ, instead of just a boolean value.\n    ","endLoc":1372,"header":"def where_not_allclose(a, b, rtol=1e-5, atol=1e-8)","id":2051,"name":"where_not_allclose","nodeType":"Function","startLoc":1356,"text":"def where_not_allclose(a, b, rtol=1e-5, atol=1e-8):\n    \"\"\"\n    A version of numpy.allclose that returns the indices where the two arrays\n    differ, instead of just a boolean value.\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":"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":820,"header":"def _is_equivalent(self, other, equivalencies=[])","id":2052,"name":"_is_equivalent","nodeType":"Function","startLoc":791,"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        `TableHDU` verify method.\n        ","endLoc":814,"header":"def _verify(self, option='warn')","id":2053,"name":"_verify","nodeType":"Function","startLoc":803,"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":"\n        Format string for displaying values in this column.\n        ","endLoc":413,"header":"@property\n    def format(self)","id":2054,"name":"format","nodeType":"Function","startLoc":407,"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":431,"header":"@format.setter\n    def format(self, format_string)","id":2055,"name":"format","nodeType":"Function","startLoc":415,"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 '{0}': could not display \"\n                \"values in this column using this format ({1})\".format(\n                    self.name, err.args[0]))"},{"col":4,"comment":"null","endLoc":918,"header":"def _report(self)","id":2056,"name":"_report","nodeType":"Function","startLoc":891,"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('  a: {}'.format(dimsa))\n            self._writeln('  b: {}'.format(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(' Data differs at {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=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":"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":526,"header":"def pformat(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False,\n                html=False)","id":2057,"name":"pformat","nodeType":"Function","startLoc":488,"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":440,"header":"@property\n    def descr(self)","id":2058,"name":"descr","nodeType":"Function","startLoc":433,"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":457,"header":"def iter_str_vals(self)","id":2059,"name":"iter_str_vals","nodeType":"Function","startLoc":442,"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":"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 : boolean\n            True if all attributes are equal\n        ","endLoc":482,"header":"def attrs_equal(self, col)","id":2060,"name":"attrs_equal","nodeType":"Function","startLoc":459,"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 : boolean\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":4,"comment":"null","endLoc":486,"header":"@property\n    def _formatter(self)","id":2061,"name":"_formatter","nodeType":"Function","startLoc":484,"text":"@property\n    def _formatter(self):\n        return FORMATTER if (self.parent_table is None) else self.parent_table.formatter"},{"col":4,"comment":"\n        Internal function (used from `_get_converter`) to apply\n        equivalence pairs.\n        ","endLoc":869,"header":"def _apply_equivalencies(self, unit, other, equivalencies)","id":2062,"name":"_apply_equivalencies","nodeType":"Function","startLoc":822,"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 = \"'{0}' ({1})\".format(\n                    unit_str, physical_type)\n            else:\n                unit_str = \"'{0}'\".format(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            \"{0} and {1} are not convertible\".format(\n                unit_str, other_str))"},{"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":561,"header":"def pprint(self, max_lines=None, show_name=True, show_unit=False, show_dtype=False)","id":2063,"name":"pprint","nodeType":"Function","startLoc":528,"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":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":2295,"header":"def _condition_arg(value)","id":2064,"name":"_condition_arg","nodeType":"Function","startLoc":2265,"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, (float, int, complex)):\n        return value\n\n    if isinstance(value, np.ndarray) and value.dtype.kind in ['i', 'f', 'c']:\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"},{"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":592,"header":"def more(self, max_lines=None, show_name=True, show_unit=False)","id":2066,"name":"more","nodeType":"Function","startLoc":563,"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":603,"header":"@property\n    def unit(self)","id":2067,"name":"unit","nodeType":"Function","startLoc":594,"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":610,"header":"@unit.setter\n    def unit(self, unit)","id":2068,"name":"unit","nodeType":"Function","startLoc":605,"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":899,"header":"def _get_converter(self, other, equivalencies=[])","id":2070,"name":"_get_converter","nodeType":"Function","startLoc":871,"text":"def _get_converter(self, other, equivalencies=[]):\n        other = Unit(other)\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            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"},{"col":4,"comment":"null","endLoc":614,"header":"@unit.deleter\n    def unit(self)","id":2071,"name":"unit","nodeType":"Function","startLoc":612,"text":"@unit.deleter\n    def unit(self):\n        self._unit = None"},{"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 equivalence pairs, optional\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`unit_equivalencies`.\n\n        Raises\n        ------\n        astropy.units.UnitsError\n            If units are inconsistent\n        ","endLoc":643,"header":"def convert_unit_to(self, new_unit, equivalencies=[])","id":2072,"name":"convert_unit_to","nodeType":"Function","startLoc":616,"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 equivalence pairs, optional\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`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":4,"comment":"null","endLoc":649,"header":"@property\n    def groups(self)","id":2073,"name":"groups","nodeType":"Function","startLoc":645,"text":"@property\n    def groups(self):\n        if not hasattr(self, '_groups'):\n            self._groups = groups.ColumnGroups(self)\n        return self._groups"},{"col":19,"endLoc":880,"id":2074,"nodeType":"Lambda","startLoc":880,"text":"lambda val: scale * _condition_arg(val)"},{"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":673,"header":"def group_by(self, keys)","id":2075,"name":"group_by","nodeType":"Function","startLoc":651,"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":151,"header":"def column_group_by(column, keys)","id":2076,"name":"column_group_by","nodeType":"Function","startLoc":101,"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\n    if isinstance(keys, Table):\n        keys = keys.as_array()\n\n    if not isinstance(keys, np.ndarray):\n        raise TypeError('Keys input must be numpy array, but got {0}'\n                        .format(type(keys)))\n\n    if len(keys) != len(column):\n        raise ValueError('Input keys array length {0} does not match column length {1}'\n                         .format(len(keys), len(column)))\n\n    # take advantage of table or column indices, if possible\n    index = None\n    if isinstance(keys, Table):\n        index = get_index(keys)\n    elif hasattr(keys, 'indices') and keys.indices:\n        index = keys.indices[0]\n\n    if index is not None:\n        idx_sort = index.sorted_data()\n    else:\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":39,"endLoc":809,"id":2077,"nodeType":"Lambda","startLoc":809,"text":"lambda v: (v == 0)"},{"col":35,"endLoc":895,"id":2078,"nodeType":"Lambda","startLoc":894,"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 object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        ","endLoc":965,"header":"def to(self, other, value=1.0, equivalencies=[])","id":2079,"name":"to","nodeType":"Function","startLoc":934,"text":"def to(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        return self._get_converter(other, equivalencies=equivalencies)(value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":851,"id":2080,"name":"diff_total","nodeType":"Attribute","startLoc":851,"text":"self.diff_total"},{"attributeType":"null","col":8,"comment":"null","endLoc":846,"id":2081,"name":"diff_ratio","nodeType":"Attribute","startLoc":846,"text":"self.diff_ratio"},{"attributeType":"null","col":8,"comment":"null","endLoc":832,"id":2082,"name":"numdiffs","nodeType":"Attribute","startLoc":832,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":845,"id":2083,"name":"diff_pixels","nodeType":"Attribute","startLoc":845,"text":"self.diff_pixels"},{"col":4,"comment":"\n        Alias for `to` for backward compatibility with pynbody.\n        ","endLoc":972,"header":"def in_units(self, other, value=1.0, equivalencies=[])","id":2084,"name":"in_units","nodeType":"Function","startLoc":967,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":841,"id":2085,"name":"rtol","nodeType":"Attribute","startLoc":841,"text":"self.rtol"},{"col":4,"comment":"null","endLoc":1115,"header":"def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0,\n                 cached_results=None)","id":2086,"name":"_compose","nodeType":"Function","startLoc":994,"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                \"Cannot represent unit {0} in terms of the given \"\n                \"units\".format(self))\n            cached_results[key] = result\n            raise result\n\n        cached_results[key] = [self]\n        return [self]"},{"attributeType":"null","col":8,"comment":"null","endLoc":834,"id":2087,"name":"atol","nodeType":"Attribute","startLoc":834,"text":"self.atol"},{"col":4,"comment":"null","endLoc":111,"header":"def __init__(self, f)","id":2088,"name":"__init__","nodeType":"Function","startLoc":110,"text":"def __init__(self, f):\n        self.f = f"},{"col":0,"comment":"null","endLoc":2878,"header":"def get_caller_module_dict(levels)","id":2089,"name":"get_caller_module_dict","nodeType":"Function","startLoc":2873,"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":689,"header":"def __repr__(self)","id":2090,"name":"__repr__","nodeType":"Function","startLoc":688,"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":700,"header":"@property\n    def quantity(self)","id":2091,"name":"quantity","nodeType":"Function","startLoc":691,"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, copy=False, dtype=self.dtype, order='A')"},{"attributeType":"null","col":8,"comment":"null","endLoc":844,"id":2092,"name":"diff_dimensions","nodeType":"Attribute","startLoc":844,"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":983,"id":2093,"nodeType":"Class","startLoc":921,"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        See `FITSDiff` for explanations of the initialization parameters.\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('  a: {} bytes'.format(self.diff_dimensions[0]))\n            self._writeln('  b: {} bytes'.format(self.diff_dimensions[1]))\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(' Data differs at byte {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=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        See `FITSDiff` for explanations of the initialization parameters.\n        ","endLoc":951,"header":"def __init__(self, a, b, numdiffs=10)","id":2094,"name":"__init__","nodeType":"Function","startLoc":943,"text":"def __init__(self, a, b, numdiffs=10):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.diff_dimensions = ()\n        self.diff_bytes = []\n\n        super().__init__(a, b, numdiffs=numdiffs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":727,"id":2095,"name":"_extension","nodeType":"Attribute","startLoc":727,"text":"_extension"},{"attributeType":"null","col":4,"comment":"null","endLoc":728,"id":2096,"name":"_ext_comment","nodeType":"Attribute","startLoc":728,"text":"_ext_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":730,"id":2097,"name":"_padding_byte","nodeType":"Attribute","startLoc":730,"text":"_padding_byte"},{"attributeType":"_AsciiColDefs","col":4,"comment":"null","endLoc":731,"id":2098,"name":"_columns_type","nodeType":"Attribute","startLoc":731,"text":"_columns_type"},{"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 : `~astropy.units.Unit` or str\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of equivalence pairs, optional\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":722,"header":"def to(self, unit, equivalencies=[], **kwargs)","id":2099,"name":"to","nodeType":"Function","startLoc":702,"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 : `~astropy.units.Unit` or str\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of equivalence pairs, optional\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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":2100,"name":"meta","nodeType":"Attribute","startLoc":180,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":258,"id":2101,"name":"info","nodeType":"Attribute","startLoc":258,"text":"info"},{"attributeType":"null","col":16,"comment":"null","endLoc":220,"id":2102,"name":"data","nodeType":"Attribute","startLoc":220,"text":"data"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":2103,"name":"_name","nodeType":"Attribute","startLoc":224,"text":"self._name"},{"attributeType":"null","col":16,"comment":"null","endLoc":214,"id":2104,"name":"format","nodeType":"Attribute","startLoc":214,"text":"format"},{"col":4,"comment":"null","endLoc":960,"header":"def _diff(self)","id":2105,"name":"_diff","nodeType":"Function","startLoc":953,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":733,"id":2106,"name":"__format_RE","nodeType":"Attribute","startLoc":733,"text":"__format_RE"},{"attributeType":"null","col":12,"comment":"null","endLoc":187,"id":2107,"name":"dtype","nodeType":"Attribute","startLoc":187,"text":"dtype"},{"col":4,"comment":"null","endLoc":983,"header":"def _report(self)","id":2108,"name":"_report","nodeType":"Function","startLoc":962,"text":"def _report(self):\n        if self.diff_dimensions:\n            self._writeln(' Data sizes differ:')\n            self._writeln('  a: {} bytes'.format(self.diff_dimensions[0]))\n            self._writeln('  b: {} bytes'.format(self.diff_dimensions[1]))\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(' Data differs at byte {}:'.format(index))\n            report_diff_values(self._fileobj, values[0], values[1],\n                               ind=self._indent + 1)\n\n        self._writeln(' ...')\n        self._writeln(' {} different bytes found ({:.2%} different).'\n                      .format(self.diff_total, self.diff_ratio))"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":2109,"name":"description","nodeType":"Attribute","startLoc":228,"text":"self.description"},{"attributeType":"null","col":8,"comment":"null","endLoc":225,"id":2110,"name":"_parent_table","nodeType":"Attribute","startLoc":225,"text":"self._parent_table"},{"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":1544,"header":"@contextlib.contextmanager\ndef _binary_table_byte_swap(data)","id":2111,"name":"_binary_table_byte_swap","nodeType":"Function","startLoc":1477,"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    new_dtype = nh.realign_dtype(np.dtype(list(zip(names, formats))),\n                                 offsets)\n\n    data.dtype = new_dtype\n\n    yield data\n\n    for arr in to_swap:\n        arr.byteswap(True)\n\n    data.dtype = orig_dtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":357,"id":2112,"name":"parent_table","nodeType":"Attribute","startLoc":357,"text":"self.parent_table"},{"attributeType":"null","col":12,"comment":"null","endLoc":221,"id":2113,"name":"self_data","nodeType":"Attribute","startLoc":221,"text":"self_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":226,"id":2114,"name":"unit","nodeType":"Attribute","startLoc":226,"text":"self.unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":230,"id":2115,"name":"indices","nodeType":"Attribute","startLoc":230,"text":"self.indices"},{"attributeType":"null","col":12,"comment":"null","endLoc":608,"id":2116,"name":"_unit","nodeType":"Attribute","startLoc":608,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":229,"id":2117,"name":"meta","nodeType":"Attribute","startLoc":229,"text":"self.meta"},{"attributeType":"null","col":16,"comment":"null","endLoc":204,"id":2118,"name":"name","nodeType":"Attribute","startLoc":204,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":223,"id":2119,"name":"self","nodeType":"Attribute","startLoc":223,"text":"self"},{"col":4,"comment":"null","endLoc":2939,"header":"def __init__(self, pdict, log=None)","id":2120,"name":"__init__","nodeType":"Function","startLoc":2927,"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":"null","col":8,"comment":"null","endLoc":227,"id":2122,"name":"_format","nodeType":"Attribute","startLoc":227,"text":"self._format"},{"attributeType":"null","col":12,"comment":"null","endLoc":648,"id":2123,"name":"_groups","nodeType":"Attribute","startLoc":648,"text":"self._groups"},{"col":4,"comment":"null","endLoc":845,"header":"def __setattr__(self, item, value)","id":2124,"name":"__setattr__","nodeType":"Function","startLoc":833,"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":1976,"header":"def __init__(self)","id":2125,"name":"__init__","nodeType":"Function","startLoc":1972,"text":"def __init__(self):\n        self.lr_action = None\n        self.lr_goto = None\n        self.lr_productions = None\n        self.lr_method = None"},{"col":0,"comment":"null","endLoc":37,"header":"def is_column_keyword(keyword)","id":2126,"name":"is_column_keyword","nodeType":"Function","startLoc":36,"text":"def is_column_keyword(keyword):\n    return re.match(COLUMN_KEYWORD_REGEXP, keyword) is not None"},{"col":4,"comment":"null","endLoc":292,"header":"def __init__(self, lrtab, errorf)","id":2127,"name":"__init__","nodeType":"Function","startLoc":286,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":948,"id":2128,"name":"diff_dimensions","nodeType":"Attribute","startLoc":948,"text":"self.diff_dimensions"},{"attributeType":"null","col":8,"comment":"null","endLoc":949,"id":2129,"name":"diff_bytes","nodeType":"Attribute","startLoc":949,"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":1269,"id":2130,"nodeType":"Class","startLoc":986,"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                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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('  a: {}'.format(self.diff_column_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra column {} of format {} in a'.format(\n                                name, format))\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(' Extra column {} of format {} in b'.format(\n                                name, format))\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(' Column {} has different {}:'.format(\n                    name, col_attrs[attr]))\n            report_diff_values(self._fileobj, vals[0], vals[1],\n                               ind=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln('  a: {}'.format(self.diff_rows[0]))\n            self._writeln('  b: {}'.format(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(self._fileobj, values[0], values[1],\n                               ind=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        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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :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        units : set of units to compose to, 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 `False`.\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":1239,"header":"def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=False)","id":2131,"name":"compose","nodeType":"Function","startLoc":1117,"text":"def compose(self, equivalencies=[], units=None, max_depth=2,\n                include_prefix_units=False):\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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :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        units : set of units to compose to, 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 `False`.\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        # 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":"\n        See `FITSDiff` for explanations of the initialization parameters.\n        ","endLoc":1075,"header":"def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 tolerance=None)","id":2132,"name":"__init__","nodeType":"Function","startLoc":1034,"text":"def __init__(self, a, b, ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0,\n                 tolerance=None):\n        \"\"\"\n        See `FITSDiff` for explanations of the initialization parameters.\n        \"\"\"\n\n        self.ignore_fields = set(ignore_fields)\n        self.numdiffs = numdiffs\n        self.rtol = rtol\n        self.atol = atol\n\n        if tolerance is not None:  # This should be removed in the next astropy version\n            warnings.warn(\n                '\"tolerance\" was deprecated in version 2.0 and will be removed in '\n                'a future version. Use argument \"rtol\" instead.',\n                AstropyDeprecationWarning)\n            self.rtol = tolerance  # when tolerance is provided *always* ignore `rtol`\n                                   # during the transition/deprecation period\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":877,"header":"def _base_repr_(self, html=False)","id":2133,"name":"_base_repr_","nodeType":"Function","startLoc":847,"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('{0}={1!r}'.format(attr, val))\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from ..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":"null","endLoc":867,"header":"@classmethod\n    def match_header(cls, header)","id":2134,"name":"match_header","nodeType":"Function","startLoc":860,"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":898,"header":"def _calculate_datasum_with_heap(self)","id":2135,"name":"_calculate_datasum_with_heap","nodeType":"Function","startLoc":869,"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            # TODO: The following code may no longer be necessary since it is\n            # now possible to get a pointer directly to the heap data as a\n            # whole.  That said, it is possible for the heap section to contain\n            # data that is not actually pointed to by the table (i.e. garbage;\n            # this *shouldn't* happen but it is not disallowed either)--need to\n            # double check whether or not the checksum should include such\n            # garbage\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\n            return csum"},{"fileName":"streaming.py","filePath":"astropy/io/fits/hdu","id":2137,"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 ..file import _File\nfrom ..header import _pad_length\nfrom ..util import fileobj_name\n\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 : file path, file object, or file like object\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"},{"col":4,"comment":"null","endLoc":1215,"header":"def _diff(self)","id":2138,"name":"_diff","nodeType":"Function","startLoc":1077,"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)"},{"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":230,"id":2139,"nodeType":"Class","startLoc":16,"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 : file path, file object, or file like object\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":"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    For bytes, string and unicode types, the output is shown below, where <N>\n    is 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, np.dtype, type\n        Input dtype as an object that can be converted via np.dtype()\n\n    Returns\n    -------\n    dtype_info_name : str\n        String name of ``dtype``\n    ","endLoc":100,"header":"def dtype_info_name(dtype)","id":2140,"name":"dtype_info_name","nodeType":"Function","startLoc":66,"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    For bytes, string and unicode types, the output is shown below, where <N>\n    is 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, np.dtype, type\n        Input dtype as an object that can be converted via np.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        length = re.search(r'(\\d+)', dtype.str).group(1)\n        type_name = STRING_TYPE_NAMES[(True, dtype.kind)]\n        out = type_name + length\n    else:\n        out = dtype.name\n\n    return out"},{"col":4,"comment":"\n        Construct a `StreamingHDU` object given a file name and a header.\n\n        Parameters\n        ----------\n        name : file path, file object, or file like object\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":132,"header":"def __init__(self, name, header)","id":2141,"name":"__init__","nodeType":"Function","startLoc":36,"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 : file path, file object, or file like object\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        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 equivalence pairs, optional\n            A list of equivalence pairs to also pull options from.\n            See :ref:`unit_equivalencies`.  It must already be\n            normalized using `_normalize_equivalencies`.\n        ","endLoc":1350,"header":"def _get_units_with_same_physical_type(self, equivalencies=[])","id":2143,"name":"_get_units_with_same_physical_type","nodeType":"Function","startLoc":1318,"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 equivalence pairs, optional\n            A list of equivalence pairs to also pull options from.\n            See :ref:`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":318,"header":"def set_defaulted_states(self)","id":2144,"name":"set_defaulted_states","nodeType":"Function","startLoc":313,"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":"\n        Calculate the value for the ``DATASUM`` card in the HDU.\n        ","endLoc":915,"header":"def _calculate_datasum(self)","id":2145,"name":"_calculate_datasum","nodeType":"Function","startLoc":900,"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":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":59,"header":"def _flatten_units_collection(items)","id":2147,"name":"_flatten_units_collection","nodeType":"Function","startLoc":33,"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":"null","endLoc":965,"header":"def _writedata_internal(self, fileobj)","id":2148,"name":"_writedata_internal","nodeType":"Function","startLoc":917,"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                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                            if not fileobj.simulateonly:\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                    if not fileobj.simulateonly:\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":880,"header":"def _repr_html_(self)","id":2149,"name":"_repr_html_","nodeType":"Function","startLoc":879,"text":"def _repr_html_(self):\n        return self._base_repr_(html=True)"},{"col":4,"comment":"null","endLoc":883,"header":"def __repr__(self)","id":2150,"name":"__repr__","nodeType":"Function","startLoc":882,"text":"def __repr__(self):\n        return self._base_repr_(html=False)"},{"col":29,"endLoc":1223,"id":2151,"nodeType":"Lambda","startLoc":1223,"text":"lambda x: np.abs(x.scale)"},{"col":4,"comment":"null","endLoc":891,"header":"def __str__(self)","id":2152,"name":"__str__","nodeType":"Function","startLoc":885,"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":29,"endLoc":1224,"id":2153,"nodeType":"Lambda","startLoc":1224,"text":"lambda x: np.sum(np.abs(x.powers))"},{"col":29,"endLoc":1225,"id":2154,"nodeType":"Lambda","startLoc":1225,"text":"lambda x: np.sum(x.powers) < 0.0"},{"col":29,"endLoc":1226,"id":2155,"nodeType":"Lambda","startLoc":1226,"text":"lambda x: not is_effectively_unity(x.scale)"},{"col":4,"comment":"null","endLoc":1507,"header":"def __init__(self, terminals)","id":2156,"name":"__init__","nodeType":"Function","startLoc":1474,"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":4,"comment":"null","endLoc":991,"header":"def _writedata_by_row(self, fileobj)","id":2157,"name":"_writedata_by_row","nodeType":"Function","startLoc":967,"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":"\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":1284,"header":"def to_system(self, system)","id":2159,"name":"to_system","nodeType":"Function","startLoc":1241,"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        Returns a copy of the current `Unit` instance in SI units.\n        ","endLoc":1293,"header":"@lazyproperty\n    def si(self)","id":2160,"name":"si","nodeType":"Function","startLoc":1286,"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":1301,"header":"@lazyproperty\n    def cgs(self)","id":2161,"name":"cgs","nodeType":"Function","startLoc":1295,"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        Return the physical type on the unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> print(u.m.physical_type)\n        length\n\n        ","endLoc":1316,"header":"@property\n    def physical_type(self)","id":2162,"name":"physical_type","nodeType":"Function","startLoc":1303,"text":"@property\n    def physical_type(self):\n        \"\"\"\n        Return the physical type on the unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> print(u.m.physical_type)\n        length\n\n        \"\"\"\n        from . import physical\n        return physical.get_physical_type(self)"},{"col":4,"comment":"null","endLoc":894,"header":"def __bytes__(self)","id":2163,"name":"__bytes__","nodeType":"Function","startLoc":893,"text":"def __bytes__(self):\n        return str(self).encode('utf-8')"},{"col":4,"comment":"\n        Emit a warning if any elements of ``value`` will be truncated when\n        ``value`` is assigned to self.\n        ","endLoc":917,"header":"def _check_string_truncate(self, value)","id":2164,"name":"_check_string_truncate","nodeType":"Function","startLoc":896,"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)"},{"col":0,"comment":"\n    Given a unit, returns the name of the physical quantity it\n    represents.  If it represents an unknown physical quantity,\n    ``\"unknown\"`` is returned.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to lookup\n\n    Returns\n    -------\n    physical : str\n        The name of the physical quantity, or unknown if not\n        known.\n    ","endLoc":66,"header":"def get_physical_type(unit)","id":2165,"name":"get_physical_type","nodeType":"Function","startLoc":48,"text":"def get_physical_type(unit):\n    \"\"\"\n    Given a unit, returns the name of the physical quantity it\n    represents.  If it represents an unknown physical quantity,\n    ``\"unknown\"`` is returned.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to lookup\n\n    Returns\n    -------\n    physical : str\n        The name of the physical quantity, or unknown if not\n        known.\n    \"\"\"\n    r = unit._get_physical_type_id()\n    return _physical_unit_mapping.get(r, 'unknown')"},{"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":1129,"header":"def dtype_bytes_or_chars(dtype)","id":2166,"name":"dtype_bytes_or_chars","nodeType":"Function","startLoc":1110,"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"},{"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 : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : file path, file object or file-like object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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":1112,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\n    def dump(self, datafile=None, cdfile=None, hfile=None, overwrite=False)","id":2167,"name":"dump","nodeType":"Function","startLoc":1046,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n            Output column definitions file.  The default is `None`, no\n            column definitions output is produced.\n\n        hfile : file path, file object or file-like object, 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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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                        warnings.warn(\n                            \"Overwriting existing file '{}'.\".format(f),\n                            AstropyUserWarning)\n                        os.remove(f)\n                    else:\n                        exist.append(f)\n\n        if exist:\n            raise OSError('  '.join([\"File '{}' already exists.\".format(f)\n                                     for f in exist]))\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":932,"header":"def __setitem__(self, index, value)","id":2168,"name":"__setitem__","nodeType":"Function","startLoc":919,"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":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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :ref:`unit_equivalencies`.\n            Any list given, including an empty one, supercedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of units to search in, 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":1418,"header":"def find_equivalent_units(self, equivalencies=[], units=None,\n                              include_prefix_units=False)","id":2169,"name":"find_equivalent_units","nodeType":"Function","startLoc":1384,"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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :ref:`unit_equivalencies`.\n            Any list given, including an empty one, supercedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of units to search in, 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":497,"id":2170,"name":"__array_priority__","nodeType":"Attribute","startLoc":497,"text":"__array_priority__"},{"col":4,"comment":"\n        Write the table data in the ASCII format read by BinTableHDU.load()\n        to fileobj.\n        ","endLoc":1274,"header":"def _dump_data(self, fileobj)","id":2171,"name":"_dump_data","nodeType":"Function","startLoc":1202,"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 '{:21d}'.format(val)\n            elif format in np.typecodes['Complex']:\n                return '{:21.15g}+{:.15g}j'.format(val.real, val.imag)\n            elif format in np.typecodes['Float']:\n                # output floating point\n                return '{:#21.15g}'.format(val)\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('{:21d}'.format(len(row[column.name])))\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":"function","col":4,"comment":"null","endLoc":676,"id":2172,"name":"__truediv__","nodeType":"Attribute","startLoc":676,"text":"__truediv__"},{"attributeType":"function","col":4,"comment":"null","endLoc":678,"id":2173,"name":"__rtruediv__","nodeType":"Attribute","startLoc":678,"text":"__rtruediv__"},{"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":1535,"header":"def get_format_name(self, format)","id":2174,"name":"get_format_name","nodeType":"Function","startLoc":1517,"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":"\n        Make comparison methods which encode the ``other`` object to utf-8\n        in the case of a bytestring dtype for Py3+.\n        ","endLoc":967,"header":"def _make_compare(oper)","id":2175,"name":"_make_compare","nodeType":"Function","startLoc":934,"text":"def _make_compare(oper):\n        \"\"\"\n        Make comparison methods which encode the ``other`` object to utf-8\n        in the case of a bytestring dtype for Py3+.\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            if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U' and\n                    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            return getattr(self.data, op)(other)\n\n        return _compare"},{"col":4,"comment":"null","endLoc":2133,"header":"def __init__(self, grammar, method='LALR', log=None)","id":2176,"name":"__init__","nodeType":"Function","startLoc":2100,"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":"\n        Returns all of the names associated with this unit.\n        ","endLoc":1542,"header":"@property\n    def names(self)","id":2177,"name":"names","nodeType":"Function","startLoc":1537,"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":1549,"header":"@property\n    def name(self)","id":2178,"name":"name","nodeType":"Function","startLoc":1544,"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":1556,"header":"@property\n    def aliases(self)","id":2179,"name":"aliases","nodeType":"Function","startLoc":1551,"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":1563,"header":"@property\n    def short_names(self)","id":2180,"name":"short_names","nodeType":"Function","startLoc":1558,"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":1570,"header":"@property\n    def long_names(self)","id":2181,"name":"long_names","nodeType":"Function","startLoc":1565,"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":1487,"id":2182,"name":"_names","nodeType":"Attribute","startLoc":1487,"text":"self._names"},{"attributeType":"null","col":12,"comment":"null","endLoc":1489,"id":2183,"name":"_long_names","nodeType":"Attribute","startLoc":1489,"text":"self._long_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1493,"id":2184,"name":"_format","nodeType":"Attribute","startLoc":1493,"text":"self._format"},{"attributeType":"null","col":8,"comment":"null","endLoc":1501,"id":2185,"name":"__doc__","nodeType":"Attribute","startLoc":1501,"text":"self.__doc__"},{"attributeType":"null","col":12,"comment":"null","endLoc":1488,"id":2186,"name":"_short_names","nodeType":"Attribute","startLoc":1488,"text":"self._short_names"},{"col":4,"comment":"null","endLoc":1907,"header":"def __init__(self, st, represents=None, doc=None,\n                 format=None, namespace=None)","id":2188,"name":"__init__","nodeType":"Function","startLoc":1900,"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":"\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 ints\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\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        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":1014,"header":"def insert(self, obj, values, axis=0)","id":2189,"name":"insert","nodeType":"Function","startLoc":976,"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 ints\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\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        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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            data = np.insert(self, obj, values, axis=axis)\n        out = data.view(self.__class__)\n        out.__array_finalize__(self)\n        return out"},{"col":4,"comment":"The unit that this named unit represents.","endLoc":1912,"header":"@property\n    def represents(self)","id":2190,"name":"represents","nodeType":"Function","startLoc":1909,"text":"@property\n    def represents(self):\n        \"\"\"The unit that this named unit represents.\"\"\"\n        return self._represents"},{"col":4,"comment":"null","endLoc":1915,"header":"def decompose(self, bases=set())","id":2191,"name":"decompose","nodeType":"Function","startLoc":1914,"text":"def decompose(self, bases=set()):\n        return self._represents.decompose(bases=bases)"},{"attributeType":"null","col":4,"comment":"null","endLoc":969,"id":2192,"name":"__eq__","nodeType":"Attribute","startLoc":969,"text":"__eq__"},{"col":4,"comment":"null","endLoc":2708,"header":"def lr_parse_table(self)","id":2193,"name":"lr_parse_table","nodeType":"Function","startLoc":2533,"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                                        sprec, slevel = Productions[st_actionp[a].number].prec\n                                        rprec, rlevel = Precedence.get(a, ('right', 0))\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                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":970,"id":2194,"name":"__ne__","nodeType":"Attribute","startLoc":970,"text":"__ne__"},{"attributeType":"null","col":4,"comment":"null","endLoc":971,"id":2195,"name":"__gt__","nodeType":"Attribute","startLoc":971,"text":"__gt__"},{"col":4,"comment":"\n        Write the column definition parameters in the ASCII format read by\n        BinTableHDU.load() to fileobj.\n        ","endLoc":1299,"header":"def _dump_coldefs(self, fileobj)","id":2196,"name":"_dump_coldefs","nodeType":"Function","startLoc":1276,"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 += ['{: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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":972,"id":2197,"name":"__lt__","nodeType":"Attribute","startLoc":972,"text":"__lt__"},{"col":4,"comment":"null","endLoc":1918,"header":"def is_unity(self)","id":2198,"name":"is_unity","nodeType":"Function","startLoc":1917,"text":"def is_unity(self):\n        return self._represents.is_unity()"},{"attributeType":"null","col":4,"comment":"null","endLoc":973,"id":2199,"name":"__ge__","nodeType":"Attribute","startLoc":973,"text":"__ge__"},{"col":4,"comment":"null","endLoc":1921,"header":"def __hash__(self)","id":2200,"name":"__hash__","nodeType":"Function","startLoc":1920,"text":"def __hash__(self):\n        return hash(self.name) + hash(self._represents)"},{"col":4,"comment":"null","endLoc":1934,"header":"@classmethod\n    def _from_physical_type_id(cls, physical_type_id)","id":2201,"name":"_from_physical_type_id","nodeType":"Function","startLoc":1923,"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\n        return unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":974,"id":2202,"name":"__le__","nodeType":"Attribute","startLoc":974,"text":"__le__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1017,"id":2203,"name":"name","nodeType":"Attribute","startLoc":1017,"text":"name"},{"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 : file path, file object or file-like object\n            Input data file containing the table data in ASCII format.\n\n        cdfile : file path, file object, file-like object, 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 : file path, file object, file-like object, 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\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 : Header object\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            supercedes 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":1193,"header":"def load(cls, datafile, cdfile=None, hfile=None, replace=False,\n             header=None)","id":2204,"name":"load","nodeType":"Function","startLoc":1117,"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 : file path, file object or file-like object\n            Input data file containing the table data in ASCII format.\n\n        cdfile : file path, file object, file-like object, 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 : file path, file object, file-like object, 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\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 : Header object\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            supercedes 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1904,"id":2205,"name":"_represents","nodeType":"Attribute","startLoc":1904,"text":"self._represents"},{"attributeType":"None","col":4,"comment":"null","endLoc":1018,"id":2206,"name":"unit","nodeType":"Attribute","startLoc":1018,"text":"unit"},{"col":0,"comment":"\n    Get the header from an extension of a FITS file.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.  See the\n        `getdata` documentation for explanations/examples.\n\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":115,"header":"def getheader(filename, *args, **kwargs)","id":2207,"name":"getheader","nodeType":"Function","startLoc":84,"text":"def getheader(filename, *args, **kwargs):\n    \"\"\"\n    Get the header from an extension of a FITS file.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.  See the\n        `getdata` documentation for explanations/examples.\n\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1019,"id":2208,"name":"copy","nodeType":"Attribute","startLoc":1019,"text":"copy"},{"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":1068,"header":"def _get_file_mode(filename, default='readonly')","id":2209,"name":"_get_file_mode","nodeType":"Function","startLoc":1050,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1020,"id":2210,"name":"more","nodeType":"Attribute","startLoc":1020,"text":"more"},{"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":1013,"header":"def _getext(filename, mode, *args, ext=None, extname=None, extver=None,\n            **kwargs)","id":2211,"name":"_getext","nodeType":"Function","startLoc":945,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1021,"id":2212,"name":"pprint","nodeType":"Attribute","startLoc":1021,"text":"pprint"},{"attributeType":"null","col":4,"comment":"null","endLoc":1022,"id":2213,"name":"pformat","nodeType":"Attribute","startLoc":1022,"text":"pformat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1023,"id":2214,"name":"convert_unit_to","nodeType":"Attribute","startLoc":1023,"text":"convert_unit_to"},{"col":4,"comment":"\n        Read the table column definitions from the ASCII file output by\n        BinTableHDU.dump().\n        ","endLoc":1474,"header":"@classmethod\n    def _load_coldefs(cls, fileobj)","id":2215,"name":"_load_coldefs","nodeType":"Function","startLoc":1443,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1024,"id":2216,"name":"quantity","nodeType":"Attribute","startLoc":1024,"text":"quantity"},{"attributeType":"null","col":4,"comment":"null","endLoc":1025,"id":2217,"name":"to","nodeType":"Attribute","startLoc":1025,"text":"to"},{"attributeType":"null","col":8,"comment":"null","endLoc":827,"id":2218,"name":"self","nodeType":"Attribute","startLoc":827,"text":"self"},{"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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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":1302,"id":2219,"nodeType":"Class","startLoc":1028,"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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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\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 and hasattr(data, 'mask'):\n            mask = data.mask\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\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 = self.dtype.type(data.fill_value)\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        out = self.view(ma.MaskedArray)\n        # The following is necessary because of a bug in Numpy, which was\n        # fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0.\n        out.fill_value = self.fill_value\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        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 ints\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\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        mask : boolean array_like\n            Mask value(s) to insert.  If not supplied 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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            if self.dtype.kind == 'O':\n                mask = False\n            else:\n                mask = np.zeros(values.shape, dtype=bool)\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\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            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        # Remove this when Numpy no longer emits this warning and that\n        # Numpy version becomes the minimum required version for Astropy.\n        # https://github.com/astropy/astropy/issues/6285\n        if MaskedArrayFutureWarning is None:\n            ma.MaskedArray.__setitem__(self, index, value)\n        else:\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore', MaskedArrayFutureWarning)\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":1141,"header":"@property\n    def fill_value(self)","id":2220,"name":"fill_value","nodeType":"Function","startLoc":1139,"text":"@property\n    def fill_value(self):\n        return self.get_fill_value()  # defer to native ma.MaskedArray method"},{"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":1164,"header":"@fill_value.setter\n    def fill_value(self, val)","id":2221,"name":"fill_value","nodeType":"Function","startLoc":1143,"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":"null","endLoc":1172,"header":"@property\n    def data(self)","id":2222,"name":"data","nodeType":"Function","startLoc":1166,"text":"@property\n    def data(self):\n        out = self.view(ma.MaskedArray)\n        # The following is necessary because of a bug in Numpy, which was\n        # fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0.\n        out.fill_value = self.fill_value\n        return out"},{"col":4,"comment":"null","endLoc":136,"header":"def __enter__(self)","id":2223,"name":"__enter__","nodeType":"Function","startLoc":135,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":139,"header":"def __exit__(self, type, value, traceback)","id":2224,"name":"__exit__","nodeType":"Function","startLoc":138,"text":"def __exit__(self, type, value, traceback):\n        self.close()"},{"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":1199,"header":"def filled(self, fill_value=None)","id":2225,"name":"filled","nodeType":"Function","startLoc":1174,"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        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"},{"col":4,"comment":"\n        Close the physical FITS file.\n        ","endLoc":230,"header":"def close(self)","id":2226,"name":"close","nodeType":"Function","startLoc":225,"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":195,"header":"def write(self, data)","id":2227,"name":"write","nodeType":"Function","startLoc":141,"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":"\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 ints\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\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        mask : boolean array_like\n            Mask value(s) to insert.  If not supplied 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":1255,"header":"def insert(self, obj, values, mask=None, axis=0)","id":2228,"name":"insert","nodeType":"Function","startLoc":1201,"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 ints\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\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        mask : boolean array_like\n            Mask value(s) to insert.  If not supplied 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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            if self.dtype.kind == 'O':\n                mask = False\n            else:\n                mask = np.zeros(values.shape, dtype=bool)\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\n        return out"},{"col":4,"comment":"null","endLoc":1266,"header":"def _copy_attrs_slice(self, out)","id":2229,"name":"_copy_attrs_slice","nodeType":"Function","startLoc":1257,"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            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"},{"col":4,"comment":"null","endLoc":1294,"header":"def __setitem__(self, index, value)","id":2230,"name":"__setitem__","nodeType":"Function","startLoc":1268,"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        # Remove this when Numpy no longer emits this warning and that\n        # Numpy version becomes the minimum required version for Astropy.\n        # https://github.com/astropy/astropy/issues/6285\n        if MaskedArrayFutureWarning is None:\n            ma.MaskedArray.__setitem__(self, index, value)\n        else:\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore', MaskedArrayFutureWarning)\n                ma.MaskedArray.__setitem__(self, index, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1297,"id":2231,"name":"name","nodeType":"Attribute","startLoc":1297,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1298,"id":2232,"name":"copy","nodeType":"Attribute","startLoc":1298,"text":"copy"},{"col":4,"comment":"\n        Read the table data from the ASCII file output by BinTableHDU.dump().\n        ","endLoc":1441,"header":"@classmethod\n    def _load_data(cls, fileobj, coldefs=None)","id":2233,"name":"_load_data","nodeType":"Function","startLoc":1301,"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":"null","endLoc":1269,"header":"def _report(self)","id":2234,"name":"_report","nodeType":"Function","startLoc":1217,"text":"def _report(self):\n        if self.diff_column_count:\n            self._writeln(' Tables have different number of columns:')\n            self._writeln('  a: {}'.format(self.diff_column_count[0]))\n            self._writeln('  b: {}'.format(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(' Extra column {} of format {} in a'.format(\n                                name, format))\n            for name in self.diff_column_names[1]:\n                format = self.diff_columns[1][name.lower()].format\n                self._writeln(' Extra column {} of format {} in b'.format(\n                                name, format))\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(' Column {} has different {}:'.format(\n                    name, col_attrs[attr]))\n            report_diff_values(self._fileobj, vals[0], vals[1],\n                               ind=self._indent + 1)\n\n        if self.diff_rows:\n            self._writeln(' Table rows differ:')\n            self._writeln('  a: {}'.format(self.diff_rows[0]))\n            self._writeln('  b: {}'.format(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(self._fileobj, values[0], values[1],\n                               ind=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        Return the size (in bytes) of the data portion of the HDU.\n        ","endLoc":223,"header":"@property\n    def size(self)","id":2235,"name":"size","nodeType":"Function","startLoc":197,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":2236,"name":"_size","nodeType":"Attribute","startLoc":127,"text":"self._size"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":2237,"name":"_header_offset","nodeType":"Attribute","startLoc":125,"text":"self._header_offset"},{"attributeType":"null","col":12,"comment":"null","endLoc":132,"id":2238,"name":"writecomplete","nodeType":"Attribute","startLoc":132,"text":"self.writecomplete"},{"attributeType":"null","col":8,"comment":"null","endLoc":69,"id":2239,"name":"_header","nodeType":"Attribute","startLoc":69,"text":"self._header"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":2240,"name":"_data_offset","nodeType":"Attribute","startLoc":126,"text":"self._data_offset"},{"attributeType":"_File","col":8,"comment":"null","endLoc":117,"id":2241,"name":"_ffo","nodeType":"Attribute","startLoc":117,"text":"self._ffo"},{"attributeType":"null","col":4,"comment":"null","endLoc":1299,"id":2242,"name":"more","nodeType":"Attribute","startLoc":1299,"text":"more"},{"fileName":"compressed.py","filePath":"astropy/io/fits/hdu","id":2244,"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 ..card import Card\nfrom ..column import Column, ColDefs, TDEF_RE\nfrom ..column import KEYWORD_NAMES as TABLE_KEYWORD_NAMES\nfrom ..fitsrec import FITS_rec\nfrom ..header import Header\nfrom ..util import (_is_pseudo_unsigned, _unsigned_zero, _is_int,\n                    _get_array_mmap)\n\nfrom ....utils import lazyproperty\nfrom ....utils.exceptions import (AstropyPendingDeprecationWarning,\n                                  AstropyUserWarning)\n\ntry:\n    from .. 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 = {}\n\n# CFITSIO version-specific features\nif COMPRESSION_SUPPORTED:\n    try:\n        CFITSIO_SUPPORTS_GZIPDATA = compression.CFITSIO_VERSION >= 3.28\n        CFITSIO_SUPPORTS_Q_FORMAT = compression.CFITSIO_VERSION >= 3.35\n        if compression.CFITSIO_VERSION >= 3.35:\n            CMTYPE_ALIASES['RICE_ONE'] = 'RICE_1'\n    except AttributeError:\n        # This generally shouldn't happen unless running setup.py in an\n        # environment where an old build of pyfits exists\n        CFITSIO_SUPPORTS_GZIPDATA = True\n        CFITSIO_SUPPORTS_Q_FORMAT = True\n\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\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 __init__(self, table_header, image_header=None):\n        if image_header is None:\n            image_header = 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(\"Keyword {!r} not found.\".format(key))\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        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 'ZNAXIS{}'.format(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    # Maps deprecated keyword arguments to __init__ to their new names\n    DEPRECATED_KWARGS = {\n        'compressionType': 'compression_type', 'tileSize': 'tile_size',\n        'hcompScale': 'hcomp_scale', 'hcompSmooth': 'hcomp_smooth',\n        'quantizeLevel': 'quantize_level'\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    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 : Header instance, 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), ``SUBTRACTIVE_DITHER_1`` (1; default), 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        # Handle deprecated keyword arguments\n        compression_opts = {}\n        for oldarg, newarg in self.DEPRECATED_KWARGS.items():\n            if oldarg in kwargs:\n                warnings.warn('Keyword argument {} to {} is pending '\n                              'deprecation; use {} instead'.format(\n                        oldarg, self.__class__.__name__, newarg),\n                              AstropyPendingDeprecationWarning)\n                compression_opts[newarg] = kwargs[oldarg]\n                del kwargs[oldarg]\n            else:\n                compression_opts[newarg] = locals()[newarg]\n        # Include newer compression options that don't required backwards\n        # compatibility with deprecated spellings\n        compression_opts['quantize_method'] = quantize_method\n        compression_opts['dither_seed'] = dither_seed\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, **compression_opts)\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    @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 : Header instance\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        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\n            if huge_hdu and not CFITSIO_SUPPORTS_Q_FORMAT:\n                raise OSError(\n                    \"Astropy cannot compress images greater than 4 GB in size \"\n                    \"({} is {} bytes) without CFITSIO >= 3.35\".format(\n                        (self.name, self.ver), self.data.nbytes))\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            name = 'COMPRESSED_IMAGE'\n\n        if name:\n            self._header.set('EXTNAME', name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n            self.name = name\n        else:\n            self.name = self._header['EXTNAME']\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            bitpix_comment = image_header.comments['BITPIX']\n            naxis_comment = image_header.comments['NAXIS']\n        else:\n            bitpix_comment = 'data type of original image'\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            if CFITSIO_SUPPORTS_GZIPDATA:\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            else:\n                # Q format is not supported for UNCOMPRESSED_DATA columns.\n                ttype2 = 'UNCOMPRESSED_DATA'\n                if zbitpix == 8:\n                    tform2 = '1QB' if huge_hdu else '1PB'\n                elif zbitpix == 16:\n                    tform2 = '1QI' if huge_hdu else '1PI'\n                elif zbitpix == 32:\n                    tform2 = '1QJ' if huge_hdu else '1PJ'\n                elif zbitpix == -32:\n                    tform2 = '1QE' if huge_hdu else '1PE'\n                else:\n                    tform2 = '1QD' if huge_hdu else '1PD'\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 explcitly 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        # 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 self._header and\n                self._header['EXTNAME'] == 'COMPRESSED_IMAGE'):\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_unsigned(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _unsigned_zero(self.data.dtype),\n                dtype='=i{}'.format(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            # 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_uint_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['ZTILE{}'.format(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"},{"col":4,"comment":"null","endLoc":2224,"header":"def lr0_items(self)","id":2245,"name":"lr0_items","nodeType":"Function","startLoc":2198,"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":4,"comment":"null","endLoc":1300,"id":2246,"name":"pprint","nodeType":"Attribute","startLoc":1300,"text":"pprint"},{"col":4,"comment":"null","endLoc":2154,"header":"def lr0_closure(self, I)","id":2247,"name":"lr0_closure","nodeType":"Function","startLoc":2137,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1301,"id":2248,"name":"pformat","nodeType":"Attribute","startLoc":1301,"text":"pformat"},{"col":4,"comment":"null","endLoc":2195,"header":"def lr0_goto(self, I, x)","id":2249,"name":"lr0_goto","nodeType":"Function","startLoc":2163,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1302,"id":2250,"name":"convert_unit_to","nodeType":"Attribute","startLoc":1302,"text":"convert_unit_to"},{"className":"AstropyPendingDeprecationWarning","col":0,"comment":"\n    A warning class to indicate a soon-to-be deprecated feature.\n    ","endLoc":34,"id":2251,"nodeType":"Class","startLoc":31,"text":"class AstropyPendingDeprecationWarning(PendingDeprecationWarning, AstropyWarning):\n    \"\"\"\n    A warning class to indicate a soon-to-be deprecated feature.\n    \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":1118,"id":2252,"name":"self_data","nodeType":"Attribute","startLoc":1118,"text":"self_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":1129,"id":2253,"name":"fill_value","nodeType":"Attribute","startLoc":1129,"text":"self.fill_value"},{"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    ","endLoc":370,"id":2254,"nodeType":"Class","startLoc":80,"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\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 __init__(self, table_header, image_header=None):\n        if image_header is None:\n            image_header = 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(\"Keyword {!r} not found.\".format(key))\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        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 'ZNAXIS{}'.format(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"},{"col":4,"comment":"null","endLoc":115,"header":"def __init__(self, table_header, image_header=None)","id":2255,"name":"__init__","nodeType":"Function","startLoc":108,"text":"def __init__(self, table_header, image_header=None):\n        if image_header is None:\n            image_header = 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1121,"id":2256,"name":"self","nodeType":"Attribute","startLoc":1121,"text":"self"},{"attributeType":"null","col":8,"comment":"null","endLoc":1131,"id":2257,"name":"parent_table","nodeType":"Attribute","startLoc":1131,"text":"self.parent_table"},{"col":4,"comment":"null","endLoc":2526,"header":"def add_lalr_lookaheads(self, C)","id":2258,"name":"add_lalr_lookaheads","nodeType":"Function","startLoc":2509,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1108,"id":2259,"name":"mask","nodeType":"Attribute","startLoc":1108,"text":"mask"},{"col":4,"comment":"null","endLoc":2270,"header":"def compute_nullable_nonterminals(self)","id":2260,"name":"compute_nullable_nonterminals","nodeType":"Function","startLoc":2254,"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"},{"col":4,"comment":"null","endLoc":146,"header":"def __setitem__(self, key, value)","id":2261,"name":"__setitem__","nodeType":"Function","startLoc":120,"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"},{"col":4,"comment":"null","endLoc":2292,"header":"def find_nonterminal_transitions(self, C)","id":2262,"name":"find_nonterminal_transitions","nodeType":"Function","startLoc":2283,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1162,"id":2263,"name":"_fill_value","nodeType":"Attribute","startLoc":1162,"text":"self._fill_value"},{"col":4,"comment":"null","endLoc":2455,"header":"def compute_read_sets(self, C, ntrans, nullable)","id":2264,"name":"compute_read_sets","nodeType":"Function","startLoc":2451,"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":"null","endLoc":2320,"header":"def dr_relation(self, C, trans, nullable)","id":2265,"name":"dr_relation","nodeType":"Function","startLoc":2303,"text":"def dr_relation(self, C, trans, nullable):\n        dr_set = {}\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":0,"comment":"\n    Get the data from an extension of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary header::\n\n            getdata('in.fits')\n\n        By extension number::\n\n            getdata('in.fits', 0)      # the primary header\n            getdata('in.fits', 2)      # the second extension\n            getdata('in.fits', ext=2)  # the second extension\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 : array, record array or groups data object\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    ","endLoc":232,"header":"def getdata(filename, *args, header=None, lower=None, upper=None, view=None,\n            **kwargs)","id":2266,"name":"getdata","nodeType":"Function","startLoc":118,"text":"def getdata(filename, *args, header=None, lower=None, upper=None, view=None,\n            **kwargs):\n    \"\"\"\n    Get the data from an extension of a FITS file (and optionally the\n    header).\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.\n        They are flexible and are best illustrated by examples.\n\n        No extra arguments implies the primary header::\n\n            getdata('in.fits')\n\n        By extension number::\n\n            getdata('in.fits', 0)      # the primary header\n            getdata('in.fits', 2)      # the second extension\n            getdata('in.fits', ext=2)  # the second extension\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 : array, record array or groups data object\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\n    mode, closed = _get_file_mode(filename)\n\n    hdulist, extidx = _getext(filename, mode, *args, **kwargs)\n    try:\n        hdu = hdulist[extidx]\n        data = hdu.data\n        if data is None and extidx == 0:\n            try:\n                hdu = hdulist[1]\n                data = hdu.data\n            except IndexError:\n                raise IndexError('No data in this HDU.')\n        if data is None:\n            raise IndexError('No data in this HDU.')\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":13,"endLoc":2452,"id":2267,"nodeType":"Lambda","startLoc":2452,"text":"lambda x: self.dr_relation(C, x, nullable)"},{"col":4,"comment":"null","endLoc":2341,"header":"def reads_relation(self, C, trans, empty)","id":2268,"name":"reads_relation","nodeType":"Function","startLoc":2328,"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"},{"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', 'cxcsec', 'gps', 'plot_date',\n       'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n       'jyear_str']\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        Subformat for inputting string times\n    out_subfmt : str, optional\n        Subformat for outputting string 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    copy : bool, optional\n        Make a copy of the input values\n    ","endLoc":1473,"id":2269,"nodeType":"Class","startLoc":180,"text":"class Time(ShapedLikeNDArray):\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', 'cxcsec', 'gps', 'plot_date',\n       'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n       'jyear_str']\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        Subformat for inputting string times\n    out_subfmt : str, optional\n        Subformat for outputting string 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    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n\n    SCALES = TIME_SCALES\n    \"\"\"List of time scales\"\"\"\n\n    FORMATS = TIME_FORMATS\n    \"\"\"Dict of time formats\"\"\"\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 __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, cls):\n            self = val.replicate(format=format, copy=copy)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __getnewargs__(self):\n        return (self._time,)\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 ..coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n        else:\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\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\n        if self.location is not None and (self.location.size > 1 and\n                                          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:\n                raise ValueError('The location with shape {0} cannot be '\n                                 'broadcast against time with shape {1}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape))\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) and\n                    scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {0!r} is not in the allowed scales \"\n                                      \"{1}\".format(scale,\n                                                   sorted(self.SCALES)))\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    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 and val.dtype.kind in ('S', 'U', 'O'):\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n            err_msg = ('any of the formats where the format keyword is '\n                       'optional {0}'.format([name for name, cls in formats]))\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) and\n                  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 {0!r} is not one of the allowed \"\n                                 \"formats {1}\".format(format,\n                                                      sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n            err_msg = 'the format class {0}'.format(format)\n\n        for format, FormatClass in formats:\n            try:\n                return FormatClass(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError):\n                pass\n        else:\n            raise ValueError('Input values did not match {0}'.format(err_msg))\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\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    @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', 'cxcsec', 'gps', 'plot_date',\n           'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n           '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('format must be one of {0}'\n                             .format(list(self.FORMATS)))\n        format_cls = self.FORMATS[format]\n\n        # If current output subformat is not in the new format then replace\n        # with default '*'\n        if hasattr(format_cls, 'subfmts'):\n            subfmt_names = [subfmt[0] for subfmt in format_cls.subfmts]\n            if self.out_subfmt not in subfmt_names:\n                self.out_subfmt = '*'\n\n        self._time = format_cls(self._time.jd1, self._time.jd2,\n                                self._time._scale, self.precision,\n                                in_subfmt=self.in_subfmt,\n                                out_subfmt=self.out_subfmt,\n                                from_jd=True)\n        self._format = format\n\n    def __repr__(self):\n        return (\"<{0} object: scale='{1}' format='{2}' value={3}>\"\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    @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 {0!r} is not in the allowed scales {1}\"\n                             .format(scale, sorted(self.SCALES)))\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\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_{0}_{1}'.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        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        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        del self.cache\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        if not isinstance(val, str):\n            raise ValueError('in_subfmt attribute must be a string')\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        if not isinstance(val, str):\n            raise ValueError('out_subfmt attribute must be a string')\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        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        # 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        for attr in ('jd1', 'jd2', '_delta_ut1_utc', '_delta_tdb_tt',\n                     'location'):\n            val = getattr(self, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except AttributeError:\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        return value if self._time.jd1.shape else value.item()\n\n    @property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        return self._shaped_like_input(self._time.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        return self._shaped_like_input(self._time.jd2)\n\n    @property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        # The underlying way to get the time values for the current format is:\n        #     self._shaped_like_input(self._time.to_value(parent=self))\n        # This is done in __getattr__.  By calling getattr(self, self.format)\n        # the ``value`` attribute is cached.\n        return getattr(self, self.format)\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        \"\"\"\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 ..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 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`, `str`, or `None`; optional\n            The longitude on the Earth at which to compute the sidereal time.\n            Can be given as a `~astropy.units.Quantity` with angular units\n            (or an `~astropy.coordinates.Angle` or\n            `~astropy.coordinates.Longitude`), or as a name of an\n            observatory (currently, only ``'greenwich'`` is supported,\n            equivalent to 0 deg).  If `None` (default), the ``lon`` attribute of\n            the Time object is used.\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        sidereal time : `~astropy.coordinates.Longitude`\n            Sidereal time as a quantity with units of hourangle\n        \"\"\"  # docstring is formatted below\n\n        from ..coordinates import Longitude\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {0}'.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        else:\n            if model.upper() not in available_models:\n                raise ValueError(\n                    'Model {0} not implemented for {1} sidereal time; '\n                    'available models are {2}'\n                    .format(model, kind, sorted(available_models.keys())))\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 longitude == 'greenwich':\n            longitude = Longitude(0., u.degree,\n                                  wrap_angle=180.*u.degree)\n        else:\n            # sanity check on input\n            longitude = Longitude(longitude, u.degree,\n                                  wrap_angle=180.*u.degree)\n\n        gst = self._erfa_sidereal_time(available_models[model.upper()])\n        return Longitude(gst + longitude, u.hourangle)\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 _erfa_sidereal_time(self, model):\n        \"\"\"Calculate a sidereal time using a IAU precession/nutation model.\"\"\"\n\n        from ..coordinates import Longitude\n\n        erfa_function = model['function']\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in model['scales']\n                           for jd_part in ('jd1', 'jd2')]\n\n        sidereal_time = erfa_function(*erfa_parameters)\n\n        return Longitude(sidereal_time, u.radian).to(u.hourangle)\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):\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)\n\n    def _apply(self, method, *args, format=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__(self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, self.precision,\n                          self.in_subfmt, self.out_subfmt, from_jd=True)\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location',\n                     'precision', 'in_subfmt', 'out_subfmt'):\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 a single element and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'size', 1) > 1:\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.\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('format must be one of {0}'\n                             .format(list(tm.FORMATS)))\n\n        NewFormat = tm.FORMATS[new_format]\n        tm._time = NewFormat(tm._time.jd1, tm._time.jd2,\n                             tm._time._scale, tm.precision,\n                             tm.in_subfmt, tm.out_subfmt,\n                             from_jd=True)\n        tm._format = new_format\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        return [(indices if i == axis else np.arange(s).reshape(\n            (1,)*(i if keepdims or i < axis else i-1) + (s,) +\n            (1,)*(ndim-i-(1 if keepdims or i > axis else 2))))\n                for i, s in enumerate(self.shape)]\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        jd = self.jd1 + self.jd2\n        approx = jd.min(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 = (self.jd1 - approx) + self.jd2\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        jd = self.jd1 + self.jd2\n        approx = jd.max(axis, keepdims=True)\n\n        dt = (self.jd1 - approx) + self.jd2\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        jd_approx = self.jd\n        jd_remainder = (self - self.__class__(jd_approx, format='jd')).jd\n        if axis is None:\n            return np.lexsort((jd_remainder.ravel(), jd_approx.ravel()))\n        else:\n            return np.lexsort(keys=(jd_remainder, jd_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    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)\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                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            cache = self.cache['format']\n            if attr not in cache:\n                if attr == self.format:\n                    tm = self\n                else:\n                    tm = self.replicate(format=attr)\n                value = tm._shaped_like_input(tm._time.to_value(parent=tm))\n                cache[attr] = value\n            return cache[attr]\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 {0} with scale \"\n                                      \"'{1}' to scale '{2}'\"\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 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`` table, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  If `None`, use default version (see\n            ``astropy.utils.iers``)\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)\n            >>> status == TIME_BEFORE_IERS_RANGE\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from ..utils.iers import IERS\n            iers_table = IERS.open()\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 ..utils.iers import IERS_Auto\n            iers_table = IERS_Auto.open()\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.jd1, self_utc.jd2\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)\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        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        del self.cache\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\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                from ..coordinates import EarthLocation\n                location = EarthLocation.from_geodetic(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        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        del self.cache\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        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\n\n        # Tdelta - something is dealt with in TimeDelta, so we have\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = isinstance(other, TimeDelta)\n\n        # we need a constant scale to calculate, which is guaranteed for\n        # TimeDelta, but not for Time (which can be UTC)\n        if other_is_delta:  # T - Tdelta\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                out._set_scale(other.scale if other.scale is not None\n                               else 'tai')\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            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        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\n\n        # Tdelta + something is dealt with in TimeDelta, so we have\n        # T      + Tdelta = T\n        # T      + T      = error\n\n        if not isinstance(other, TimeDelta):\n            raise OperandTypeError(self, other, '+')\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            out._set_scale(other.scale if other.scale is not None else 'tai')\n\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    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 _time_difference(self, other, op=None):\n        \"\"\"If other is of same class as self, return difference in self.scale.\n        Otherwise, raise OperandTypeError.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                raise OperandTypeError(self, other, op)\n\n        if(self.scale is not None and self.scale not in other.SCALES or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot compare TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".format(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 (self.jd1 - other.jd1) + (self.jd2 - other.jd2)\n\n    def __lt__(self, other):\n        return self._time_difference(other, '<') < 0.\n\n    def __le__(self, other):\n        return self._time_difference(other, '<=') <= 0.\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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return False\n        return diff == 0.\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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return True\n        return diff != 0.\n\n    def __gt__(self, other):\n        return self._time_difference(other, '>') > 0.\n\n    def __ge__(self, other):\n        return self._time_difference(other, '>=') >= 0.\n\n    def to_datetime(self, timezone=None):\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__"},{"col":13,"endLoc":2453,"id":2271,"nodeType":"Lambda","startLoc":2453,"text":"lambda x: self.reads_relation(C, x, nullable)"},{"col":0,"comment":"null","endLoc":2064,"header":"def digraph(X, R, FP)","id":2272,"name":"digraph","nodeType":"Function","startLoc":2055,"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":2087,"header":"def traverse(x, N, stack, F, X, R, FP)","id":2273,"name":"traverse","nodeType":"Function","startLoc":2066,"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":"null","endLoc":2437,"header":"def compute_lookback_includes(self, C, trans, nullable)","id":2274,"name":"compute_lookback_includes","nodeType":"Function","startLoc":2371,"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"},{"col":0,"comment":"\n    Get a keyword's value from a header in a FITS file.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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":268,"header":"def getval(filename, keyword, *args, **kwargs)","id":2275,"name":"getval","nodeType":"Function","startLoc":235,"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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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":338,"header":"def setval(filename, keyword, *args, value=None, comment=None, before=None,\n           after=None, savecomment=False, **kwargs)","id":2276,"name":"setval","nodeType":"Function","startLoc":271,"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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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":4,"comment":"null","endLoc":2477,"header":"def compute_follow_sets(self, ntrans, readsets, inclsets)","id":2277,"name":"compute_follow_sets","nodeType":"Function","startLoc":2473,"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":2474,"id":2278,"nodeType":"Lambda","startLoc":2474,"text":"lambda x: readsets[x]"},{"col":13,"endLoc":2475,"id":2279,"nodeType":"Lambda","startLoc":2475,"text":"lambda x: inclsets.get(x, [])"},{"col":4,"comment":"null","endLoc":2500,"header":"def add_lookaheads(self, lookbacks, followset)","id":2280,"name":"add_lookaheads","nodeType":"Function","startLoc":2491,"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":0,"comment":"\n    Delete all instances of keyword from a header in a FITS file.\n\n    Parameters\n    ----------\n\n    filename : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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":376,"header":"def delval(filename, keyword, *args, **kwargs)","id":2281,"name":"delval","nodeType":"Function","startLoc":341,"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 : file path, file object, or file like object\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 extension specification.\n        See `getdata` for explanations/examples.\n\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":4,"comment":"null","endLoc":331,"header":"@classmethod\n    def _is_reserved_keyword(cls, keyword, warn=True)","id":2282,"name":"_is_reserved_keyword","nodeType":"Function","startLoc":299,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":843,"id":2283,"name":"_extension","nodeType":"Attribute","startLoc":843,"text":"_extension"},{"attributeType":"null","col":4,"comment":"null","endLoc":844,"id":2284,"name":"_ext_comment","nodeType":"Attribute","startLoc":844,"text":"_ext_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":993,"id":2285,"name":"_tdump_file_format","nodeType":"Attribute","startLoc":993,"text":"_tdump_file_format"},{"col":0,"comment":"\n    Create a new FITS file using the supplied data/header.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\n        File to write to.  If opened, must be opened in a writeable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array, record array, or groups data object\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 :ref:`verify`\n        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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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":423,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\ndef writeto(filename, data, header=None, output_verify='exception',\n            overwrite=False, checksum=False)","id":2286,"name":"writeto","nodeType":"Function","startLoc":379,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object, or file like object\n        File to write to.  If opened, must be opened in a writeable binary\n        mode such as 'wb' or 'ab+'.\n\n    data : array, record array, or groups data object\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 :ref:`verify`\n        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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1198,"id":2287,"name":"load","nodeType":"Attribute","startLoc":1198,"text":"load"},{"col":4,"comment":"\n        Parameters\n        ----------\n        data : array, optional\n            Uncompressed image data\n\n        header : Header instance, 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), ``SUBTRACTIVE_DITHER_1`` (1; default), 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":672,"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":2288,"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 : Header instance, 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), ``SUBTRACTIVE_DITHER_1`` (1; default), 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        # Handle deprecated keyword arguments\n        compression_opts = {}\n        for oldarg, newarg in self.DEPRECATED_KWARGS.items():\n            if oldarg in kwargs:\n                warnings.warn('Keyword argument {} to {} is pending '\n                              'deprecation; use {} instead'.format(\n                        oldarg, self.__class__.__name__, newarg),\n                              AstropyPendingDeprecationWarning)\n                compression_opts[newarg] = kwargs[oldarg]\n                del kwargs[oldarg]\n            else:\n                compression_opts[newarg] = locals()[newarg]\n        # Include newer compression options that don't required backwards\n        # compatibility with deprecated spellings\n        compression_opts['quantize_method'] = quantize_method\n        compression_opts['dither_seed'] = dither_seed\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, **compression_opts)\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":0,"comment":"null","endLoc":1030,"header":"def _makehdu(data, header)","id":2289,"name":"_makehdu","nodeType":"Function","startLoc":1016,"text":"def _makehdu(data, header):\n    if header is None:\n        header = Header()\n    hdu = _BaseHDU(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):\n            hdu = ImageHDU(data, header=header)\n        else:\n            raise KeyError('Data must be a numpy array.')\n    return hdu"},{"attributeType":"null","col":8,"comment":"null","endLoc":1073,"id":2290,"name":"diff_total","nodeType":"Attribute","startLoc":1073,"text":"self.diff_total"},{"attributeType":"null","col":8,"comment":"null","endLoc":1059,"id":2291,"name":"diff_rows","nodeType":"Attribute","startLoc":1059,"text":"self.diff_rows"},{"attributeType":"null","col":8,"comment":"null","endLoc":1069,"id":2292,"name":"diff_column_names","nodeType":"Attribute","startLoc":1069,"text":"self.diff_column_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1041,"id":2293,"name":"numdiffs","nodeType":"Attribute","startLoc":1041,"text":"self.numdiffs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1065,"id":2294,"name":"diff_column_attributes","nodeType":"Attribute","startLoc":1065,"text":"self.diff_column_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":1061,"id":2295,"name":"diff_columns","nodeType":"Attribute","startLoc":1061,"text":"self.diff_columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":1060,"id":2296,"name":"diff_column_count","nodeType":"Attribute","startLoc":1060,"text":"self.diff_column_count"},{"attributeType":"null","col":12,"comment":"null","endLoc":1050,"id":2297,"name":"rtol","nodeType":"Attribute","startLoc":1050,"text":"self.rtol"},{"col":4,"comment":"null","endLoc":351,"header":"@classmethod\n    def _remap_keyword(cls, keyword)","id":2298,"name":"_remap_keyword","nodeType":"Function","startLoc":333,"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 'ZNAXIS{}'.format(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)"},{"col":4,"comment":"null","endLoc":173,"header":"def __delitem__(self, key)","id":2299,"name":"__delitem__","nodeType":"Function","startLoc":148,"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(\"Keyword {!r} not found.\".format(key))\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":"null","col":8,"comment":"null","endLoc":1053,"id":2300,"name":"common_columns","nodeType":"Attribute","startLoc":1053,"text":"self.common_columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":1054,"id":2301,"name":"common_column_names","nodeType":"Attribute","startLoc":1054,"text":"self.common_column_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1072,"id":2302,"name":"diff_ratio","nodeType":"Attribute","startLoc":1072,"text":"self.diff_ratio"},{"attributeType":"null","col":8,"comment":"null","endLoc":1070,"id":2303,"name":"diff_values","nodeType":"Attribute","startLoc":1070,"text":"self.diff_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":1043,"id":2304,"name":"atol","nodeType":"Attribute","startLoc":1043,"text":"self.atol"},{"attributeType":"null","col":8,"comment":"null","endLoc":1040,"id":2305,"name":"ignore_fields","nodeType":"Attribute","startLoc":1040,"text":"self.ignore_fields"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":2306,"name":"__all__","nodeType":"Attribute","startLoc":38,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":2307,"name":"_COL_ATTRS","nodeType":"Attribute","startLoc":42,"text":"_COL_ATTRS"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":2308,"name":"indent","nodeType":"Attribute","startLoc":48,"text":"indent"},{"col":0,"comment":"","endLoc":7,"header":"diff.py#<anonymous>","id":2309,"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')]\n\nindent = functools.partial(indent, width=2)"},{"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":1054,"id":2310,"nodeType":"Class","startLoc":863,"text":"class ShapedLikeNDArray(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 instance and underlying arrays.\"\"\"\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 {0!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 {0!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 {0!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    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 ``ShapedLikeNDArray``).\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, 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        return self._apply('take', indices, axis=axis, mode=mode)"},{"col":4,"comment":"The shape of the instance and underlying arrays.","endLoc":893,"header":"@property\n    @abc.abstractmethod\n    def shape(self)","id":2311,"name":"shape","nodeType":"Function","startLoc":890,"text":"@property\n    @abc.abstractmethod\n    def shape(self):\n        \"\"\"The shape of the instance and underlying arrays.\"\"\""},{"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":914,"header":"@abc.abstractmethod\n    def _apply(method, *args, **kwargs)","id":2312,"name":"_apply","nodeType":"Function","startLoc":895,"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":919,"header":"@property\n    def ndim(self)","id":2313,"name":"ndim","nodeType":"Function","startLoc":916,"text":"@property\n    def ndim(self):\n        \"\"\"The number of dimensions of the instance and underlying arrays.\"\"\"\n        return len(self.shape)"},{"fileName":"groups.py","filePath":"astropy/io/fits/hdu","id":2314,"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\nfrom .image import PrimaryHDU\nfrom .table import _TableLikeHDU\nfrom ..column import Column, ColDefs, FITS2NUMPY\nfrom ..fitsrec import FITS_rec, FITS_record\nfrom ..util import _is_int, _is_pseudo_unsigned, _unsigned_zero\n\nfrom ....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 arrays\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 = ['PAR{}'.format(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 = '{}{}'.format(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:`random-groups` section in the Astropy documentation for more\n    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\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        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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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 = '{} Groups  {} Parameters'.format(self._gcount, self._pcount)\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"},{"col":4,"comment":"The size of the object, as calculated from its shape.","endLoc":927,"header":"@property\n    def size(self)","id":2315,"name":"size","nodeType":"Function","startLoc":921,"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":931,"header":"@property\n    def isscalar(self)","id":2316,"name":"isscalar","nodeType":"Function","startLoc":929,"text":"@property\n    def isscalar(self):\n        return self.shape == ()"},{"col":4,"comment":"null","endLoc":937,"header":"def __len__(self)","id":2317,"name":"__len__","nodeType":"Function","startLoc":933,"text":"def __len__(self):\n        if self.isscalar:\n            raise TypeError(\"Scalar {0!r} object has no len()\"\n                            .format(self.__class__.__name__))\n        return self.shape[0]"},{"col":4,"comment":"Any instance should evaluate to True, except when it is empty.","endLoc":941,"header":"def __bool__(self)","id":2318,"name":"__bool__","nodeType":"Function","startLoc":939,"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":951,"header":"def __getitem__(self, item)","id":2319,"name":"__getitem__","nodeType":"Function","startLoc":943,"text":"def __getitem__(self, item):\n        try:\n            return self._apply('__getitem__', item)\n        except IndexError:\n            if self.isscalar:\n                raise TypeError('scalar {0!r} object is not subscriptable.'\n                                .format(self.__class__.__name__))\n            else:\n                raise"},{"className":"Group","col":0,"comment":"\n    One group of the random group data.\n    ","endLoc":84,"id":2320,"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":965,"header":"def __iter__(self)","id":2321,"name":"__iter__","nodeType":"Function","startLoc":953,"text":"def __iter__(self):\n        if self.isscalar:\n            raise TypeError('scalar {0!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()"},{"col":4,"comment":"null","endLoc":23,"header":"def __init__(self, input, row=0, start=None, end=None, step=None,\n                 base=None)","id":2322,"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":273,"header":"def parse(self, angle, unit, debug=False)","id":2323,"name":"parse","nodeType":"Function","startLoc":258,"text":"def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._parser.parse(\n                angle, lexer=self._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(\"{0} in angle {1!r}\".format(\n                    str(e), angle))\n            else:\n                raise ValueError(\n                    \"Syntax error parsing angle {0!r}\".format(angle))\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":"Return an instance containing copies of the internal data.\n\n        Parameters are as for :meth:`~numpy.ndarray.copy`.\n        ","endLoc":972,"header":"def copy(self, *args, **kwargs)","id":2325,"name":"copy","nodeType":"Function","startLoc":967,"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":"null","endLoc":27,"header":"@property\n    def parnames(self)","id":2326,"name":"parnames","nodeType":"Function","startLoc":25,"text":"@property\n    def parnames(self):\n        return self.array.parnames"},{"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 ``ShapedLikeNDArray``).\n        ","endLoc":984,"header":"def reshape(self, *args, **kwargs)","id":2327,"name":"reshape","nodeType":"Function","startLoc":974,"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 ``ShapedLikeNDArray``).\n        \"\"\"\n        return self._apply('reshape', *args, **kwargs)"},{"col":4,"comment":"null","endLoc":32,"header":"@property\n    def data(self)","id":2328,"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":"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":994,"header":"def ravel(self, *args, **kwargs)","id":2329,"name":"ravel","nodeType":"Function","startLoc":986,"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":"Return a copy with the array collapsed into one dimension.\n\n        Parameters are as for :meth:`~numpy.ndarray.flatten`.\n        ","endLoc":1001,"header":"def flatten(self, *args, **kwargs)","id":2330,"name":"flatten","nodeType":"Function","startLoc":996,"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":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":1009,"header":"def transpose(self, *args, **kwargs)","id":2331,"name":"transpose","nodeType":"Function","startLoc":1003,"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":"null","endLoc":36,"header":"@lazyproperty\n    def _unique(self)","id":2332,"name":"_unique","nodeType":"Function","startLoc":34,"text":"@lazyproperty\n    def _unique(self):\n        return _par_indices(self.parnames)"},{"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":1021,"header":"@property\n    def T(self)","id":2333,"name":"T","nodeType":"Function","startLoc":1011,"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":"\n        Get the group parameter value.\n        ","endLoc":56,"header":"def par(self, parname)","id":2334,"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":"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":1030,"header":"def swapaxes(self, *args, **kwargs)","id":2335,"name":"swapaxes","nodeType":"Function","startLoc":1023,"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)"},{"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":1038,"header":"def diagonal(self, *args, **kwargs)","id":2336,"name":"diagonal","nodeType":"Function","startLoc":1032,"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)"},{"col":4,"comment":"\n        Set the group parameter value.\n        ","endLoc":84,"header":"def setpar(self, parname, value)","id":2337,"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        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 : Header instance\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":1363,"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":2338,"name":"_update_header_data","nodeType":"Function","startLoc":702,"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 : Header instance\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        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\n            if huge_hdu and not CFITSIO_SUPPORTS_Q_FORMAT:\n                raise OSError(\n                    \"Astropy cannot compress images greater than 4 GB in size \"\n                    \"({} is {} bytes) without CFITSIO >= 3.35\".format(\n                        (self.name, self.ver), self.data.nbytes))\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            name = 'COMPRESSED_IMAGE'\n\n        if name:\n            self._header.set('EXTNAME', name,\n                             'name of this binary table extension',\n                             after='TFIELDS')\n            self.name = name\n        else:\n            self.name = self._header['EXTNAME']\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            bitpix_comment = image_header.comments['BITPIX']\n            naxis_comment = image_header.comments['NAXIS']\n        else:\n            bitpix_comment = 'data type of original image'\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            if CFITSIO_SUPPORTS_GZIPDATA:\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            else:\n                # Q format is not supported for UNCOMPRESSED_DATA columns.\n                ttype2 = 'UNCOMPRESSED_DATA'\n                if zbitpix == 8:\n                    tform2 = '1QB' if huge_hdu else '1PB'\n                elif zbitpix == 16:\n                    tform2 = '1QI' if huge_hdu else '1PI'\n                elif zbitpix == 32:\n                    tform2 = '1QJ' if huge_hdu else '1PJ'\n                elif zbitpix == -32:\n                    tform2 = '1QE' if huge_hdu else '1PE'\n                else:\n                    tform2 = '1QD' if huge_hdu else '1PD'\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":"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":1046,"header":"def squeeze(self, *args, **kwargs)","id":2339,"name":"squeeze","nodeType":"Function","startLoc":1040,"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":1054,"header":"def take(self, indices, axis=None, mode='raise')","id":2340,"name":"take","nodeType":"Function","startLoc":1048,"text":"def take(self, indices, axis=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        return self._apply('take', indices, axis=axis, mode=mode)"},{"col":4,"comment":"null","endLoc":249,"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":2341,"name":"__new__","nodeType":"Function","startLoc":240,"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, cls):\n            self = val.replicate(format=format, copy=copy)\n        else:\n            self = super().__new__(cls)\n\n        return self"},{"col":4,"comment":"null","endLoc":252,"header":"def __getnewargs__(self)","id":2342,"name":"__getnewargs__","nodeType":"Function","startLoc":251,"text":"def __getnewargs__(self):\n        return (self._time,)"},{"col":4,"comment":"null","endLoc":293,"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":2343,"name":"__init__","nodeType":"Function","startLoc":254,"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 ..coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n        else:\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\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\n        if self.location is not None and (self.location.size > 1 and\n                                          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:\n                raise ValueError('The location with shape {0} cannot be '\n                                 'broadcast against time with shape {1}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape))"},{"col":4,"comment":"null","endLoc":203,"header":"def append(self, card=None, useblanks=True, bottom=False, end=False)","id":2344,"name":"append","nodeType":"Function","startLoc":175,"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        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)"},{"fileName":"image.py","filePath":"astropy/io/fits/hdu","id":2345,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\nimport sys\nimport warnings\n\nimport numpy as np\n\nfrom .base import DELAYED, _ValidHDU, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX\nfrom ..header import Header\nfrom ..util import _is_pseudo_unsigned, _unsigned_zero, _is_int\nfrom ..verify import VerifyWarning\n\nfrom ....utils import isiterable, lazyproperty\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 header is not None:\n            if not isinstance(header, Header):\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        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\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            # 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 set set _bitpix, _bzero, and _bscale to the\n            # appropriate BITPIX for the data, and always sets _bzero=0 and\n            # _bscale=1.\n            self.data = data\n            self.update_header()\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:`data-sections` section of the Astropy documentation for more\n        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_unsigned(self.__dict__['data'].dtype)\n        else:\n            self._data_replaced = True\n            was_unsigned = False\n\n        if data is not None and not isinstance(data, np.ndarray):\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        self.__dict__['data'] = data\n        self._modified = True\n\n        if isinstance(data, np.ndarray):\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        elif self.data is None:\n            self._axes = []\n        else:\n            raise ValueError('not a valid data array')\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_uint_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        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            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            # 0.9.6.3 to avoid out of range error for BZERO = +32768\n            # We have to explcitly 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: {0!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 not None:\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_unsigned(self.data.dtype):\n                # Convert the unsigned array to signed\n                output = np.array(\n                    self.data - _unsigned_zero(self.data.dtype),\n                    dtype='>i{}'.format(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 not fileobj.simulateonly:\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 _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 _convert_pseudo_unsigned(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_unsigned(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 += ' (rescales to {0})'.format(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_unsigned(self.data.dtype):\n                d = np.array(self.data - _unsigned_zero(self.data.dtype),\n                             dtype='i{}'.format(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_unsigned(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:`data-sections` section of the Astropy documentation for more\n    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 DELAYED, optional\n            The data in the HDU.\n\n        header : Header instance, 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 : Header instance\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('Index {} out of range.'.format(indx))\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('Illegal index {}'.format(indx))\n"},{"className":"_IndexInfo","col":0,"comment":"null","endLoc":1147,"id":2346,"nodeType":"Class","startLoc":1128,"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('Index {} out of range.'.format(indx))\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('Illegal index {}'.format(indx))"},{"attributeType":"null","col":12,"comment":"null","endLoc":1143,"id":2347,"name":"npts","nodeType":"Attribute","startLoc":1143,"text":"self.npts"},{"attributeType":"null","col":12,"comment":"null","endLoc":1144,"id":2348,"name":"offset","nodeType":"Attribute","startLoc":1144,"text":"self.offset"},{"attributeType":"null","col":12,"comment":"null","endLoc":1145,"id":2349,"name":"contiguous","nodeType":"Attribute","startLoc":1145,"text":"self.contiguous"},{"fileName":"base.py","filePath":"astropy/io/fits/hdu","id":2350,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see PYFITS.rst\n\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 .. import conf\nfrom ..file import _File\nfrom ..header import Header, _pad_length\nfrom ..util import (_is_int, _is_pseudo_unsigned, _unsigned_zero,\n                    itersubclasses, decode_ascii, _get_array_mmap, first,\n                    _free_space_check, _extract_number)\nfrom ..verify import _Verify, _ErrList\n\nfrom ....utils import lazyproperty\nfrom ....utils.exceptions import AstropyUserWarning\nfrom ....utils.decorators import deprecated_renamed_argument\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 = {'uint8': 8, 'int16': 16, 'uint16': 16, 'int32': 32,\n                'uint32': 32, 'int64': 64, 'uint64': 64, 'float32': -32,\n                '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    Used primarily by _BaseHDU.__new__ to find an appropriate HDU class to use\n    based on values in the header.  See the _BaseHDU.__new__ docstring.\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: {0}'.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\nclass _BaseHDUMeta(type):\n    def __init__(cls, name, bases, members):\n        # The sole purpose of this metaclass right now is to add the same\n        # 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        if 'data' in members:\n            data_prop = members['data']\n            if (isinstance(data_prop, (lazyproperty, property)) and\n                    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\n# TODO: Come up with a better __repr__ for HDUs (and for HDULists, for that\n# matter)\nclass _BaseHDU(metaclass=_BaseHDUMeta):\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    def __new__(cls, data=None, header=None, *args, **kwargs):\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\n        klass = _hdu_class_from_header(cls, header)\n        return super().__new__(klass)\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._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    @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 object or file-like object\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\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:`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            .. versionchanged:: 1.3\n               ``overwrite`` replaces the deprecated ``clobber`` argument.\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 _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                header = Header.fromfile(data, 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        hdu = cls(data=DELAYED, header=header, **new_kwargs)\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        # 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_uint_scale_keywords()\n\n        # Handle checksum\n        self._update_checksum(checksum)\n\n    def _update_uint_scale_keywords(self):\n        \"\"\"\n        If the data is unsigned int 16, 32, or 64 add BSCALE/BZERO cards to\n        header.\n        \"\"\"\n\n        if (self._has_data and self._standard and\n                _is_pseudo_unsigned(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', _unsigned_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_unsigned(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        if not fileobj.simulateonly:\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        else:\n            size = len(str(self._header))\n\n        return offset, size\n\n    def _writedata(self, fileobj):\n        # TODO: A lot of the simulateonly stuff should be moved back into the\n        # _File class--basically it should turn write and flush into a noop\n        offset = 0\n        size = 0\n\n        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except 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            if 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        if not fileobj.simulateonly:\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        if not fileobj.simulateonly:\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:\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        if not fileobj.simulateonly:\n            fileobj.flush()\n            try:\n                offset = fileobj.tell()\n            except OSError:\n                offset = 0\n\n        if self.data is not None:\n            if not fileobj.simulateonly:\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        # 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\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:`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 = \"'{}' card does not exist.\".format(keyword)\n            fix_text = \"Fixed by inserting a new '{}' card.\".format(keyword)\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 = (\"'{}' card at the wrong place \"\n                                \"(card {}).\".format(keyword, index))\n                    fix_text = (\"Fixed by moving it to the right place \"\n                                \"(card {}).\".format(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 = (\"'{}' card has invalid value '{}'.\".format(\n                            keyword, val))\n                    fix_text = (\"Fixed by setting a new value '{}'.\".format(\n                            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 = 'data unit checksum updated {}'.format(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\n        override_datasum : bool, optional\n           add the ``CHECKSUM`` card only\n\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 = 'HDU checksum updated {}'.format(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 {0}.\\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 {0}.\\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.tostring())\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    @deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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        return (self.name, self.ver, 'NonstandardExtHDU', 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\n# TODO: Mark this as deprecated\n_NonstandardExtHDU = NonstandardExtHDU\n"},{"className":"_Delayed","col":0,"comment":"null","endLoc":28,"id":2351,"nodeType":"Class","startLoc":27,"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":53,"id":2352,"nodeType":"Class","startLoc":48,"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    \"\"\""},{"className":"_BaseHDUMeta","col":0,"comment":"null","endLoc":118,"id":2353,"nodeType":"Class","startLoc":90,"text":"class _BaseHDUMeta(type):\n    def __init__(cls, name, bases, members):\n        # The sole purpose of this metaclass right now is to add the same\n        # 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        if 'data' in members:\n            data_prop = members['data']\n            if (isinstance(data_prop, (lazyproperty, property)) and\n                    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))"},{"col":4,"comment":"null","endLoc":118,"header":"def __init__(cls, name, bases, members)","id":2354,"name":"__init__","nodeType":"Function","startLoc":91,"text":"def __init__(cls, name, bases, members):\n        # The sole purpose of this metaclass right now is to add the same\n        # 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        if 'data' in members:\n            data_prop = members['data']\n            if (isinstance(data_prop, (lazyproperty, property)) and\n                    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))"},{"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":764,"id":2355,"nodeType":"Class","startLoc":730,"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":758,"header":"@property\n    def size(self)","id":2356,"name":"size","nodeType":"Function","startLoc":747,"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":761,"header":"def _summary(self)","id":2357,"name":"_summary","nodeType":"Function","startLoc":760,"text":"def _summary(self):\n        return (self.name, self.ver, 'CorruptedHDU')"},{"col":4,"comment":"null","endLoc":764,"header":"def verify(self)","id":2358,"name":"verify","nodeType":"Function","startLoc":763,"text":"def verify(self):\n        pass"},{"attributeType":"_BaseHDU","col":0,"comment":"null","endLoc":721,"id":2359,"name":"_AllHDU","nodeType":"Attribute","startLoc":721,"text":"_AllHDU"},{"attributeType":"ExtensionHDU","col":0,"comment":"null","endLoc":1561,"id":2360,"name":"_ExtensionHDU","nodeType":"Attribute","startLoc":1561,"text":"_ExtensionHDU"},{"attributeType":"NonstandardExtHDU","col":0,"comment":"null","endLoc":1611,"id":2361,"name":"_NonstandardExtHDU","nodeType":"Attribute","startLoc":1611,"text":"_NonstandardExtHDU"},{"col":4,"comment":"null","endLoc":506,"header":"def __new__(cls, angle, unit=None, **kwargs)","id":2362,"name":"__new__","nodeType":"Function","startLoc":500,"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":0,"comment":"","endLoc":5,"header":"base.py#<anonymous>","id":2363,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"DELAYED = _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 = {'uint8': 8, 'int16': 16, 'uint16': 16, 'int32': 32,\n                'uint32': 32, 'int64': 64, 'uint64': 64, 'float32': -32,\n                '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"},{"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":499,"header":"def _set_scale(self, scale)","id":2364,"name":"_set_scale","nodeType":"Function","startLoc":452,"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 {0!r} is not in the allowed scales {1}\"\n                             .format(scale, sorted(self.SCALES)))\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\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_{0}_{1}'.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        self._time = self.FORMATS[self.format](jd1, jd2, scale, self.precision,\n                                               self.in_subfmt, self.out_subfmt,\n                                               from_jd=True)"},{"col":4,"comment":"null","endLoc":250,"header":"def insert(self, key, card, useblanks=True, after=False)","id":2365,"name":"insert","nodeType":"Function","startLoc":205,"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":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 : file path, file object, or file like object\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, table, or group data object\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        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n    ","endLoc":626,"header":"def append(filename, data, header=None, checksum=False, verify=True, **kwargs)","id":2366,"name":"append","nodeType":"Function","startLoc":560,"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 : file path, file object, or file like object\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, table, or group data object\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        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\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')\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":1047,"header":"def _stat_filename_or_fileobj(filename)","id":2367,"name":"_stat_filename_or_fileobj","nodeType":"Function","startLoc":1033,"text":"def _stat_filename_or_fileobj(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"},{"id":2368,"name":"astropy/io/fits/src","nodeType":"Package"},{"id":2369,"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\n    #if CFITSIO_MINOR >= 35\n        #define CFITSIO_SUPPORTS_Q_FORMAT_COMPRESSION\n        #define CFITSIO_SUPPORTS_SUBTRACTIVE_DITHER_2\n    #else\n        /* This constant isn't defined in older versions and has a different */\n        /* value anyways. */\n        #define NO_DITHER 0\n    #endif\n    #if CFITSIO_MINOR >= 28\n        #define CFITSIO_SUPPORTS_GZIPDATA\n    #else\n        #ifdef _MSC_VER\n            #pragma warning ( \"GZIP_COMPRESSED_DATA columns not supported\" )\n        #else\n            #warning \"GZIP_COMPRESSED_DATA columns not supported\"\n        #endif\n    #endif\n#endif\n\n\n#define CFITSIO_LOSSLESS_COMP_SUPPORTED_VERS 3.22\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"},{"id":2370,"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 treates 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_INT8;\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#ifdef CFITSIO_SUPPORTS_SUBTRACTIVE_DITHER_2\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#endif\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#ifdef CFITSIO_SUPPORTS_GZIPDATA\n    Fptr->cn_gzip_data = 0;\n#endif\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#ifdef CFITSIO_SUPPORTS_GZIPDATA\n        } else if (0 == strncmp(columns[idx].ttype,\n                                \"GZIP_COMPRESSED_DATA\", 21)) {\n            Fptr->cn_gzip_data = idx + 1;\n#endif\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 ((version >= CFITSIO_LOSSLESS_COMP_SUPPORTED_VERS) &&\n                (0 == strcmp(tmp, \"NONE\"))) {\n            Fptr->quantize_level = NO_QUANTIZE;\n        } else if (0 == strcmp(tmp, \"SUBTRACTIVE_DITHER_1\")) {\n#ifdef CFITSIO_SUPPORTS_SUBTRACTIVE_DITHER_2\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#else\n            Fptr->quantize_dither = SUBTRACTIVE_DITHER_1;\n        } else {\n            Fptr->quantize_dither = NO_DITHER;\n        }\n    } else {\n        Fptr->quantize_dither = NO_DITHER;\n    }\n\n    if (Fptr->quantize_dither != NO_DITHER) {\n        switch (get_header_int(header, \"ZDITHER0\", &(Fptr->dither_offset), 0, HDR_NOFLAG)) {\n          case GET_HEADER_FAILED:\n            return;\n          case GET_HEADER_DEFAULT_USED: // ZDITHER0 keyword no found\n            /* TODO: Find out if that's actually working and not invalid... */\n            Fptr->dither_offset = 0;\n            Fptr->request_dither_offset = 0;\n            break;\n          default:\n            break;\n        }\n    }\n#endif\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"},{"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":331,"header":"def _init_from_vals(self, val, val2, format, scale, copy,\n                        precision=None, in_subfmt=None, out_subfmt=None)","id":2371,"name":"_init_from_vals","nodeType":"Function","startLoc":295,"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) and\n                    scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {0!r} is not in the allowed scales \"\n                                      \"{1}\".format(scale,\n                                                   sorted(self.SCALES)))\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"},{"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":1744,"header":"def _make_array(val, copy=False)","id":2372,"name":"_make_array","nodeType":"Function","startLoc":1726,"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    val = np.array(val, copy=copy, subok=True)\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 not (val.dtype == np.float64 or val.dtype.kind in 'OSUa'):\n        val = np.asanyarray(val, dtype=np.float64)\n\n    return val"},{"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        .. 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 : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the observatory.\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        ","endLoc":349,"header":"@classmethod\n    def of_site(cls, site_name)","id":2373,"name":"of_site","nodeType":"Function","startLoc":302,"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        .. 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 : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the observatory.\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"\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', close_names=e.close_names)\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":370,"header":"def _remap_index(self, idx)","id":2374,"name":"_remap_index","nodeType":"Function","startLoc":353,"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":265,"header":"def _update(self, card)","id":2375,"name":"_update","nodeType":"Function","startLoc":252,"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:])"},{"id":2376,"name":"astropy/io/fits/tests","nodeType":"Package"},{"id":2377,"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\n"},{"col":4,"comment":"null","endLoc":297,"header":"def _relativeinsert(self, card, before=None, after=None, replace=False)","id":2378,"name":"_relativeinsert","nodeType":"Function","startLoc":269,"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)"},{"fileName":"__init__.py","filePath":"astropy/io/fits/tests","id":2379,"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 ... 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"},{"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":374,"header":"def _get_time_fmt(self, val, val2, format, scale,\n                      precision, in_subfmt, out_subfmt)","id":2380,"name":"_get_time_fmt","nodeType":"Function","startLoc":333,"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 and val.dtype.kind in ('S', 'U', 'O'):\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n            err_msg = ('any of the formats where the format keyword is '\n                       'optional {0}'.format([name for name, cls in formats]))\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) and\n                  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 {0!r} is not one of the allowed \"\n                                 \"formats {1}\".format(format,\n                                                      sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n            err_msg = 'the format class {0}'.format(format)\n\n        for format, FormatClass in formats:\n            try:\n                return FormatClass(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError):\n                pass\n        else:\n            raise ValueError('Input values did not match {0}'.format(err_msg))"},{"className":"FitsTestCase","col":0,"comment":"null","endLoc":60,"id":2381,"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":2382,"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"},{"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":490,"header":"@classmethod\n    def _get_site_registry(cls, force_download=False, force_builtin=False)","id":2383,"name":"_get_site_registry","nodeType":"Function","startLoc":445,"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        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":4,"comment":"null","endLoc":42,"header":"def teardown(self)","id":2384,"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":"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":2385,"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":4,"comment":"Returns the path to a test data file.","endLoc":55,"header":"def data(self, filename)","id":2386,"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)"},{"col":0,"comment":"\n    Load observatory database from data/observatories.json and parse them into\n    a SiteRegistry.\n    ","endLoc":121,"header":"def get_builtin_sites()","id":2387,"name":"get_builtin_sites","nodeType":"Function","startLoc":115,"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":4,"comment":" Returns the full path to a file in the test temp dir.","endLoc":60,"header":"def temp(self, filename)","id":2388,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":15,"id":2389,"name":"temp_dir","nodeType":"Attribute","startLoc":15,"text":"self.temp_dir"},{"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\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":396,"header":"@classmethod\n    def now(cls)","id":2390,"name":"now","nodeType":"Function","startLoc":376,"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\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')"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":2391,"name":"data_dir","nodeType":"Attribute","startLoc":14,"text":"self.data_dir"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":2392,"name":"_keyword_remaps","nodeType":"Attribute","startLoc":93,"text":"_keyword_remaps"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":2393,"name":"_zdef_re","nodeType":"Attribute","startLoc":100,"text":"_zdef_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":2394,"name":"_compression_keywords","nodeType":"Attribute","startLoc":101,"text":"_compression_keywords"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":2395,"name":"_indexed_compression_keywords","nodeType":"Attribute","startLoc":103,"text":"_indexed_compression_keywords"},{"id":2396,"name":"astropy/io/fits/tests/data","nodeType":"Package"},{"id":2397,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                "},{"id":2398,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"id":2399,"name":"astropy/io/fits/scripts","nodeType":"Package"},{"fileName":"fitsinfo.py","filePath":"astropy/io/fits/scripts","id":2400,"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\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=('Print a summary of the HDUs in a FITS file(s).'))\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":2401,"name":"_table_header","nodeType":"Attribute","startLoc":115,"text":"self._table_header"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":2402,"name":"_keyword_indices","nodeType":"Attribute","startLoc":112,"text":"self._keyword_indices"},{"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":45,"header":"def fitsinfo(filename)","id":2403,"name":"fitsinfo","nodeType":"Function","startLoc":31,"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":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 extension.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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\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":724,"header":"def info(filename, output=None, **kwargs)","id":2404,"name":"info","nodeType":"Function","startLoc":688,"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 extension.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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\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":0,"comment":"The main function called by the `fitsinfo` script.","endLoc":60,"header":"def main(args=None)","id":2405,"name":"main","nodeType":"Function","startLoc":48,"text":"def main(args=None):\n    \"\"\"The main function called by the `fitsinfo` script.\"\"\"\n    parser = argparse.ArgumentParser(\n        description=('Print a summary of the HDUs in a FITS file(s).'))\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":2406,"name":"fits","nodeType":"Attribute","startLoc":27,"text":"fits"},{"col":0,"comment":"","endLoc":24,"header":"fitsinfo.py#<anonymous>","id":2407,"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\"\"\""},{"fileName":"fitscheck.py","filePath":"astropy/io/fits/scripts","id":2408,"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 logging\nimport optparse\nimport os\nimport sys\nimport textwrap\n\nfrom ....tests.helper import catch_warnings\nfrom ... import fits\n\n\nlog = logging.getLogger('fitscheck')\n\n\ndef handle_options(args):\n    if not len(args):\n        args = ['-h']\n\n    parser = optparse.OptionParser(usage=textwrap.dedent(\"\"\"\n        fitscheck [options] <.fits files...>\n\n        .e.g. fitscheck example.fits\n\n        Verifies and optionally re-writes the CHECKSUM and DATASUM keywords\n        for a .fits file.\n        Optionally detects and fixes FITS standard compliance problems.\n        \"\"\".strip()))\n\n    parser.add_option(\n        '-k', '--checksum', dest='checksum_kind',\n        type='choice', choices=['standard', 'remove', 'none'],\n        help='Choose FITS checksum mode or none.  Defaults standard.',\n        default='standard', metavar='[standard | remove | none]')\n\n    parser.add_option(\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_option(\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_option(\n        '-c', '--compliance', dest='compliance',\n        help='Do FITS compliance checking; fix if possible.',\n        default=False, action='store_true')\n\n    parser.add_option(\n        '-i', '--ignore-missing', dest='ignore_missing',\n        help='Ignore missing checksums.',\n        default=False, action='store_true')\n\n    parser.add_option(\n        '-v', '--verbose', dest='verbose', help='Generate extra output.',\n        default=False, action='store_true')\n\n    global OPTIONS\n    OPTIONS, fits_files = parser.parse_args(args)\n\n    if OPTIONS.checksum_kind == 'none':\n        OPTIONS.checksum_kind = False\n    elif OPTIONS.checksum_kind == 'remove':\n        OPTIONS.write_file = True\n        OPTIONS.force = True\n\n    return fits_files\n\n\ndef setup_logging():\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\n    with catch_warnings() as wlist:\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('OK {!r}'.format(filename))\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    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('EXCEPTION {!r} .. {}'.format(filename, 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('{} errors'.format(errors))\n    return int(bool(errors))\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    ","endLoc":306,"id":2409,"nodeType":"Class","startLoc":271,"text":"class 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\n    def __init__(self, *classes):\n        super(catch_warnings, self).__init__(record=True)\n        self.classes = classes\n\n    def __enter__(self):\n        warning_list = super(catch_warnings, self).__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()"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":2410,"name":"_rvkc_indices","nodeType":"Attribute","startLoc":113,"text":"self._rvkc_indices"},{"col":4,"comment":"null","endLoc":292,"header":"def __init__(self, *classes)","id":2411,"name":"__init__","nodeType":"Function","startLoc":290,"text":"def __init__(self, *classes):\n        super(catch_warnings, self).__init__(record=True)\n        self.classes = classes"},{"col":4,"comment":"null","endLoc":303,"header":"def __enter__(self)","id":2412,"name":"__enter__","nodeType":"Function","startLoc":294,"text":"def __enter__(self):\n        warning_list = super(catch_warnings, self).__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"},{"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":268,"header":"def treat_deprecations_as_exceptions()","id":2413,"name":"treat_deprecations_as_exceptions","nodeType":"Function","startLoc":208,"text":"def 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        # We don't want to deal with six.MovedModules, only \"real\"\n        # modules.\n        if (isinstance(module, types.ModuleType) and\n                hasattr(module, '__warningregistry__')):\n            del module.__warningregistry__\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    # (py.test 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 DeprecationWarnings into exceptions\n    _all_warns = [DeprecationWarning]\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 deprecation 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    for v in _warnings_to_ignore_by_pyver:\n        if sys.version_info[:2] == v:\n            for s in _warnings_to_ignore_by_pyver[v]:\n                warnings.filterwarnings(\"ignore\", s, DeprecationWarning)"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":2414,"name":"_cards","nodeType":"Attribute","startLoc":111,"text":"self._cards"},{"col":4,"comment":"null","endLoc":306,"header":"def __exit__(self, type, value, traceback)","id":2415,"name":"__exit__","nodeType":"Function","startLoc":305,"text":"def __exit__(self, type, value, traceback):\n        treat_deprecations_as_exceptions()"},{"attributeType":"null","col":8,"comment":"null","endLoc":292,"id":2416,"name":"classes","nodeType":"Attribute","startLoc":292,"text":"self.classes"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":2417,"name":"_modified","nodeType":"Attribute","startLoc":114,"text":"self._modified"},{"col":0,"comment":"null","endLoc":109,"header":"def handle_options(args)","id":2418,"name":"handle_options","nodeType":"Function","startLoc":56,"text":"def handle_options(args):\n    if not len(args):\n        args = ['-h']\n\n    parser = optparse.OptionParser(usage=textwrap.dedent(\"\"\"\n        fitscheck [options] <.fits files...>\n\n        .e.g. fitscheck example.fits\n\n        Verifies and optionally re-writes the CHECKSUM and DATASUM keywords\n        for a .fits file.\n        Optionally detects and fixes FITS standard compliance problems.\n        \"\"\".strip()))\n\n    parser.add_option(\n        '-k', '--checksum', dest='checksum_kind',\n        type='choice', choices=['standard', 'remove', 'none'],\n        help='Choose FITS checksum mode or none.  Defaults standard.',\n        default='standard', metavar='[standard | remove | none]')\n\n    parser.add_option(\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_option(\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_option(\n        '-c', '--compliance', dest='compliance',\n        help='Do FITS compliance checking; fix if possible.',\n        default=False, action='store_true')\n\n    parser.add_option(\n        '-i', '--ignore-missing', dest='ignore_missing',\n        help='Ignore missing checksums.',\n        default=False, action='store_true')\n\n    parser.add_option(\n        '-v', '--verbose', dest='verbose', help='Generate extra output.',\n        default=False, action='store_true')\n\n    global OPTIONS\n    OPTIONS, fits_files = parser.parse_args(args)\n\n    if OPTIONS.checksum_kind == 'none':\n        OPTIONS.checksum_kind = False\n    elif OPTIONS.checksum_kind == 'remove':\n        OPTIONS.write_file = True\n        OPTIONS.force = True\n\n    return fits_files"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":2419,"name":"COMPRESSION_SUPPORTED","nodeType":"Attribute","startLoc":31,"text":"COMPRESSION_SUPPORTED"},{"attributeType":"null","col":28,"comment":"null","endLoc":31,"id":2420,"name":"COMPRESSION_ENABLED","nodeType":"Attribute","startLoc":31,"text":"COMPRESSION_ENABLED"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":2421,"name":"NO_DITHER","nodeType":"Attribute","startLoc":37,"text":"NO_DITHER"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":2422,"name":"SUBTRACTIVE_DITHER_1","nodeType":"Attribute","startLoc":38,"text":"SUBTRACTIVE_DITHER_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":2423,"name":"SUBTRACTIVE_DITHER_2","nodeType":"Attribute","startLoc":39,"text":"SUBTRACTIVE_DITHER_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":2424,"name":"QUANTIZE_METHOD_NAMES","nodeType":"Attribute","startLoc":40,"text":"QUANTIZE_METHOD_NAMES"},{"col":0,"comment":"null","endLoc":120,"header":"def setup_logging()","id":2425,"name":"setup_logging","nodeType":"Function","startLoc":112,"text":"def setup_logging():\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":0,"comment":"null","endLoc":45,"id":2426,"name":"DITHER_SEED_CLOCK","nodeType":"Attribute","startLoc":45,"text":"DITHER_SEED_CLOCK"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":2427,"name":"DITHER_SEED_CHECKSUM","nodeType":"Attribute","startLoc":46,"text":"DITHER_SEED_CHECKSUM"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":2428,"name":"COMPRESSION_TYPES","nodeType":"Attribute","startLoc":48,"text":"COMPRESSION_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":2429,"name":"DEFAULT_COMPRESSION_TYPE","nodeType":"Attribute","startLoc":51,"text":"DEFAULT_COMPRESSION_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":2430,"name":"DEFAULT_QUANTIZE_LEVEL","nodeType":"Attribute","startLoc":52,"text":"DEFAULT_QUANTIZE_LEVEL"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":2431,"name":"DEFAULT_QUANTIZE_METHOD","nodeType":"Attribute","startLoc":53,"text":"DEFAULT_QUANTIZE_METHOD"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":2432,"name":"DEFAULT_DITHER_SEED","nodeType":"Attribute","startLoc":54,"text":"DEFAULT_DITHER_SEED"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":2433,"name":"DEFAULT_HCOMP_SCALE","nodeType":"Attribute","startLoc":55,"text":"DEFAULT_HCOMP_SCALE"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":2434,"name":"DEFAULT_HCOMP_SMOOTH","nodeType":"Attribute","startLoc":56,"text":"DEFAULT_HCOMP_SMOOTH"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":2435,"name":"DEFAULT_BLOCK_SIZE","nodeType":"Attribute","startLoc":57,"text":"DEFAULT_BLOCK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":2436,"name":"DEFAULT_BYTE_PIX","nodeType":"Attribute","startLoc":58,"text":"DEFAULT_BYTE_PIX"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":2437,"name":"CMTYPE_ALIASES","nodeType":"Attribute","startLoc":60,"text":"CMTYPE_ALIASES"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":2438,"name":"CFITSIO_SUPPORTS_GZIPDATA","nodeType":"Attribute","startLoc":65,"text":"CFITSIO_SUPPORTS_GZIPDATA"},{"col":0,"comment":"\n    Prints a message if any HDU in `filename` has a bad checksum or datasum.\n    ","endLoc":150,"header":"def verify_checksums(filename)","id":2439,"name":"verify_checksums","nodeType":"Function","startLoc":123,"text":"def verify_checksums(filename):\n    \"\"\"\n    Prints a message if any HDU in `filename` has a bad checksum or datasum.\n    \"\"\"\n\n    with catch_warnings() as wlist:\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('OK {!r}'.format(filename))\n    return 0"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":2440,"name":"CFITSIO_SUPPORTS_Q_FORMAT","nodeType":"Attribute","startLoc":66,"text":"CFITSIO_SUPPORTS_Q_FORMAT"},{"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    urllib2.URLError, 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":669,"header":"def get_pkg_data_contents(data_name, package=None, encoding=None, cache=True)","id":2441,"name":"get_pkg_data_contents","nodeType":"Function","startLoc":596,"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    urllib2.URLError, 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"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":2442,"name":"COMPRESSION_KEYWORDS","nodeType":"Attribute","startLoc":76,"text":"COMPRESSION_KEYWORDS"},{"col":0,"comment":"","endLoc":3,"header":"compressed.py#<anonymous>","id":2443,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"try:\n    from .. 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 = {}\n\nif COMPRESSION_SUPPORTED:\n    try:\n        CFITSIO_SUPPORTS_GZIPDATA = compression.CFITSIO_VERSION >= 3.28\n        CFITSIO_SUPPORTS_Q_FORMAT = compression.CFITSIO_VERSION >= 3.35\n        if compression.CFITSIO_VERSION >= 3.35:\n            CMTYPE_ALIASES['RICE_ONE'] = 'RICE_1'\n    except AttributeError:\n        # This generally shouldn't happen unless running setup.py in an\n        # environment where an old build of pyfits exists\n        CFITSIO_SUPPORTS_GZIPDATA = True\n        CFITSIO_SUPPORTS_Q_FORMAT = True\n\nCOMPRESSION_KEYWORDS = {'ZIMAGE', 'ZCMPTYPE', 'ZBITPIX', 'ZNAXIS', 'ZMASKCMP',\n                        'ZSIMPLE', 'ZTENSION', 'ZEXTEND'}"},{"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    urllib2.URLError, 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\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\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":463,"header":"@contextlib.contextmanager\ndef get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True)","id":2444,"name":"get_pkg_data_fileobj","nodeType":"Function","startLoc":337,"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    urllib2.URLError, 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\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\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    \"\"\"\n\n    datafn = _find_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        all_urls = (conf.dataurl, conf.dataurl_mirror)\n        for url in all_urls:\n            try:\n                with get_readable_fileobj(url + data_name, encoding=encoding,\n                                          cache=cache) as fileobj:\n                    # We read a byte to trigger any URLErrors\n                    fileobj.read(1)\n                    fileobj.seek(0)\n                    yield fileobj\n                    break\n            except urllib.error.URLError:\n                pass\n        else:\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\".format(data_name, urls))"},{"col":0,"comment":"Check for FITS standard compliance.","endLoc":163,"header":"def verify_compliance(filename)","id":2445,"name":"verify_compliance","nodeType":"Function","startLoc":153,"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"},{"col":0,"comment":"\n    Update the specified extension with the input data/header.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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, table, or group data object\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        extension specification(s).  Header and extension 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\n            update(file, dat, hdr, 3)  # update the 3rd extension\n            update(file, dat, 'sci', 2)  # update the 2nd SCI extension\n            update(file, dat, 3, header=hdr)  # update the 3rd extension\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension\n\n    kwargs\n        Any additional keyword arguments to be passed to\n        `astropy.io.fits.open`.\n    ","endLoc":685,"header":"def update(filename, data, *args, **kwargs)","id":2446,"name":"update","nodeType":"Function","startLoc":629,"text":"def update(filename, data, *args, **kwargs):\n    \"\"\"\n    Update the specified extension with the input data/header.\n\n    Parameters\n    ----------\n    filename : file path, file object, or file like object\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, table, or group data object\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        extension specification(s).  Header and extension 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\n            update(file, dat, hdr, 3)  # update the 3rd extension\n            update(file, dat, 'sci', 2)  # update the 2nd SCI extension\n            update(file, dat, 3, header=hdr)  # update the 3rd extension\n            update(file, dat, header=hdr, ext=5)  # update the 5th extension\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":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":176,"header":"def update(filename)","id":2447,"name":"update","nodeType":"Function","startLoc":166,"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    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)"},{"fileName":"fitsheader.py","filePath":"astropy/io/fits/scripts","id":2448,"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\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\n\nfrom ... import fits\nfrom .... import log\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\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    \"\"\"\n    def __init__(self, filename):\n        self.filename = filename\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 : boolean, 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('# HDU {} in {}:\\n'.format(hdu, self.filename))\n            for c in cards:\n                result.append('{}\\n'.format(c))\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 : boolean, 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 = '{0}: Extension {1} not found.'.format(self.filename,\n                                                             hdukey)\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 as e:  # Keyword does not exist\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\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    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 .... 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        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\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        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    # 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 .... 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 main(args=None):\n    \"\"\"This is the main function called by the `fitsheader` script.\"\"\"\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=('Print the header(s) of a FITS file. '\n                     'Optional arguments allow the desired extension(s), '\n                     'keyword(s), and output format to be specified. '\n                     'Note that in the case of a compressed image, '\n                     'the decompressed header is shown by default.'))\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='append', 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('-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        else:\n            print_headers_traditional(args)\n    except OSError as e:\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"},{"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', 'cxcsec', 'gps', 'plot_date',\n           'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n           'jyear_str']\n        ","endLoc":415,"header":"@property\n    def format(self)","id":2449,"name":"format","nodeType":"Function","startLoc":400,"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', 'cxcsec', 'gps', 'plot_date',\n           'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n           'jyear_str']\n        \"\"\"\n        return self._format"},{"col":4,"comment":"Set time format","endLoc":437,"header":"@format.setter\n    def format(self, format)","id":2450,"name":"format","nodeType":"Function","startLoc":417,"text":"@format.setter\n    def format(self, format):\n        \"\"\"Set time format\"\"\"\n        if format not in self.FORMATS:\n            raise ValueError('format must be one of {0}'\n                             .format(list(self.FORMATS)))\n        format_cls = self.FORMATS[format]\n\n        # If current output subformat is not in the new format then replace\n        # with default '*'\n        if hasattr(format_cls, 'subfmts'):\n            subfmt_names = [subfmt[0] for subfmt in format_cls.subfmts]\n            if self.out_subfmt not in subfmt_names:\n                self.out_subfmt = '*'\n\n        self._time = format_cls(self._time.jd1, self._time.jd2,\n                                self._time._scale, self.precision,\n                                in_subfmt=self.in_subfmt,\n                                out_subfmt=self.out_subfmt,\n                                from_jd=True)\n        self._format = format"},{"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 extension 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 extension number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension\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":833,"header":"def printdiff(inputa, inputb, *args, **kwargs)","id":2451,"name":"printdiff","nodeType":"Function","startLoc":727,"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 extension 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 extension number::\n\n            printdiff('inA.fits', 'inB.fits', 0)      # the primary HDU\n            printdiff('inA.fits', 'inB.fits', 2)      # the second extension\n            printdiff('inA.fits', 'inB.fits', ext=2)  # the second extension\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":112,"header":"@classmethod\n    def from_json(cls, jsondb)","id":2452,"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]\n            location = EarthLocation.from_geodetic(site_info['longitude'] * u.Unit(site_info['longitude_unit']),\n                                                   site_info['latitude'] * u.Unit(site_info['latitude_unit']),\n                                                   site_info['elevation'] * u.Unit(site_info['elevation_unit']))\n            location.info.name = site_info['name']\n\n            reg.add_site([site] + site_info['aliases'], location)\n        reg._loaded_jsondb = jsondb\n        return reg"},{"col":4,"comment":"null","endLoc":442,"header":"def __repr__(self)","id":2453,"name":"__repr__","nodeType":"Function","startLoc":439,"text":"def __repr__(self):\n        return (\"<{0} object: scale='{1}' format='{2}' value={3}>\"\n                .format(self.__class__.__name__, self.scale, self.format,\n                        getattr(self, self.format)))"},{"col":4,"comment":"null","endLoc":445,"header":"def __str__(self)","id":2454,"name":"__str__","nodeType":"Function","startLoc":444,"text":"def __str__(self):\n        return str(getattr(self, self.format))"},{"className":"ExtensionNotFoundException","col":0,"comment":"Raised if an HDU extension requested by the user does not exist.","endLoc":54,"id":2455,"nodeType":"Class","startLoc":52,"text":"class ExtensionNotFoundException(Exception):\n    \"\"\"Raised if an HDU extension requested by the user does not exist.\"\"\"\n    pass"},{"col":4,"comment":"Time scale","endLoc":450,"header":"@property\n    def scale(self)","id":2456,"name":"scale","nodeType":"Function","startLoc":447,"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":507,"header":"@property\n    def precision(self)","id":2457,"name":"precision","nodeType":"Function","startLoc":501,"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":515,"header":"@precision.setter\n    def precision(self, val)","id":2458,"name":"precision","nodeType":"Function","startLoc":509,"text":"@precision.setter\n    def precision(self, val):\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        del self.cache"},{"col":4,"comment":"\n        Unix wildcard pattern to select subformats for parsing string input\n        times.\n        ","endLoc":523,"header":"@property\n    def in_subfmt(self)","id":2459,"name":"in_subfmt","nodeType":"Function","startLoc":517,"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"},{"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\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    ","endLoc":197,"id":2460,"nodeType":"Class","startLoc":57,"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\n    Raises\n    ------\n    OSError\n        If `filename` does not exist or cannot be read.\n    \"\"\"\n    def __init__(self, filename):\n        self.filename = filename\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 : boolean, 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('# HDU {} in {}:\\n'.format(hdu, self.filename))\n            for c in cards:\n                result.append('{}\\n'.format(c))\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 : boolean, 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 = '{0}: Extension {1} not found.'.format(self.filename,\n                                                             hdukey)\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 as e:  # Keyword does not exist\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":530,"header":"@in_subfmt.setter\n    def in_subfmt(self, val)","id":2461,"name":"in_subfmt","nodeType":"Function","startLoc":525,"text":"@in_subfmt.setter\n    def in_subfmt(self, val):\n        if not isinstance(val, str):\n            raise ValueError('in_subfmt attribute must be a string')\n        self._time.in_subfmt = val\n        del self.cache"},{"col":4,"comment":"null","endLoc":77,"header":"def __init__(self, filename)","id":2462,"name":"__init__","nodeType":"Function","startLoc":75,"text":"def __init__(self, filename):\n        self.filename = filename\n        self._hdulist = fits.open(filename)"},{"col":4,"comment":"\n        Unix wildcard pattern to select subformats for outputting times.\n        ","endLoc":537,"header":"@property\n    def out_subfmt(self)","id":2463,"name":"out_subfmt","nodeType":"Function","startLoc":532,"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":544,"header":"@out_subfmt.setter\n    def out_subfmt(self, val)","id":2464,"name":"out_subfmt","nodeType":"Function","startLoc":539,"text":"@out_subfmt.setter\n    def out_subfmt(self, val):\n        if not isinstance(val, str):\n            raise ValueError('out_subfmt attribute must be a string')\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        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":565,"header":"@property\n    def shape(self)","id":2465,"name":"shape","nodeType":"Function","startLoc":546,"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        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":585,"header":"@shape.setter\n    def shape(self, shape)","id":2466,"name":"shape","nodeType":"Function","startLoc":567,"text":"@shape.setter\n    def shape(self, shape):\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        for attr in ('jd1', 'jd2', '_delta_ut1_utc', '_delta_tdb_tt',\n                     'location'):\n            val = getattr(self, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except AttributeError:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)"},{"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 : boolean, 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":124,"header":"def parse(self, extensions=None, keywords=None, compressed=False)","id":2467,"name":"parse","nodeType":"Function","startLoc":79,"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 : boolean, 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)"},{"col":4,"comment":"null","endLoc":588,"header":"def _shaped_like_input(self, value)","id":2468,"name":"_shaped_like_input","nodeType":"Function","startLoc":587,"text":"def _shaped_like_input(self, value):\n        return value if self._time.jd1.shape else value.item()"},{"col":4,"comment":"\n        First of the two doubles that internally store time value(s) in JD.\n        ","endLoc":595,"header":"@property\n    def jd1(self)","id":2469,"name":"jd1","nodeType":"Function","startLoc":590,"text":"@property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        return self._shaped_like_input(self._time.jd1)"},{"col":0,"comment":"\n    Handle a single .fits file,  returning the count of checksum and compliance\n    errors.\n    ","endLoc":196,"header":"def process_file(filename)","id":2470,"name":"process_file","nodeType":"Function","startLoc":179,"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('EXCEPTION {!r} .. {}'.format(filename, e))\n        return 1"},{"col":4,"comment":"\n        Second of the two doubles that internally store time value(s) in JD.\n        ","endLoc":602,"header":"@property\n    def jd2(self)","id":2471,"name":"jd2","nodeType":"Function","startLoc":597,"text":"@property\n    def jd2(self):\n        \"\"\"\n        Second of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        return self._shaped_like_input(self._time.jd2)"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self)","id":2472,"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":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":212,"header":"def main(args=None)","id":2473,"name":"main","nodeType":"Function","startLoc":199,"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('{} errors'.format(errors))\n    return int(bool(errors))"},{"col":0,"comment":"\n    Load observatory database from data.astropy.org and parse into a SiteRegistry\n    ","endLoc":135,"header":"def get_downloaded_sites(jsonurl=None)","id":2474,"name":"get_downloaded_sites","nodeType":"Function","startLoc":124,"text":"def get_downloaded_sites(jsonurl=None):\n    \"\"\"\n    Load observatory database from data.astropy.org and parse into a SiteRegistry\n    \"\"\"\n\n    if jsonurl is None:\n        content = get_pkg_data_contents('coordinates/sites.json')\n    else:\n        content = get_file_contents(jsonurl)\n\n    jsondb = json.loads(content)\n    return SiteRegistry.from_json(jsondb)"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":2475,"name":"log","nodeType":"Attribute","startLoc":53,"text":"log"},{"col":0,"comment":"","endLoc":40,"header":"fitscheck.py#<anonymous>","id":2476,"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')"},{"col":4,"comment":"Time value(s) in current format","endLoc":611,"header":"@property\n    def value(self)","id":2477,"name":"value","nodeType":"Function","startLoc":604,"text":"@property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        # The underlying way to get the time values for the current format is:\n        #     self._shaped_like_input(self._time.to_value(parent=self))\n        # This is done in __getattr__.  By calling getattr(self, self.format)\n        # the ``value`` attribute is cached.\n        return getattr(self, self.format)"},{"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    content\n        The content of the file (as requested by ``encoding``).\n\n    ","endLoc":334,"header":"def get_file_contents(*args, **kwargs)","id":2478,"name":"get_file_contents","nodeType":"Function","startLoc":321,"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    content\n        The content of the file (as requested by ``encoding``).\n\n    \"\"\"\n    with get_readable_fileobj(*args, **kwargs) as f:\n        return f.read()"},{"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        ","endLoc":692,"header":"def light_travel_time(self, skycoord, kind='barycentric', location=None, ephemeris=None)","id":2479,"name":"light_travel_time","nodeType":"Function","startLoc":613,"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        \"\"\"\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 ..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')"},{"fileName":"fitsdiff.py","filePath":"astropy/io/fits/scripts","id":2480,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport glob\nimport logging\nimport optparse\nimport os\nimport sys\nimport textwrap\nimport warnings\n\nfrom ... import fits\nfrom ..util import fill\nfrom ....utils.exceptions import AstropyDeprecationWarning\n\n\nlog = logging.getLogger('fitsdiff')\n\n\nUSAGE = \"\"\"\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\"\"\".strip()\n\n\nEPILOG = \"\"\"\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()\n\n\nclass HelpFormatter(optparse.TitledHelpFormatter):\n    def format_epilog(self, epilog):\n        return '\\n{}\\n'.format(fill(epilog, self.width))\n\n\ndef handle_options(argv=None):\n    # This is a callback--less trouble than actually adding a new action type\n    def store_list(option, opt, value, parser):\n        setattr(parser.values, option.dest, [])\n        # Accept either a comma-separated list or a filename (starting with @)\n        # containing a value on each line\n        if value and value[0] == '@':\n            value = value[1:]\n            if not os.path.exists(value):\n                log.warning('{} argument {} does not exist'.format(opt, value))\n                return\n            try:\n                values = [v.strip() for v in open(value, 'r').readlines()]\n                setattr(parser.values, option.dest, values)\n            except OSError as exc:\n                log.warning('reading {} for {} failed: {}; ignoring this '\n                            'argument'.format(value, opt, exc))\n                del exc\n        else:\n            setattr(parser.values, option.dest,\n                    [v.strip() for v in value.split(',')])\n\n    parser = optparse.OptionParser(usage=USAGE, epilog=EPILOG,\n                                   formatter=HelpFormatter())\n\n    parser.add_option(\n        '-q', '--quiet', action='store_true',\n        help='Produce no output and just return a status code.')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\n        '-d', '--difference-tolerance', type='float', default=None,\n        dest='tolerance', metavar='NUMBER',\n        help='DEPRECATED. Alias for \"--relative-tolerance\". '\n             'Deprecated, provided for backward compatibility (default %default).')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\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_option(\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_option(\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_option(\n        '-o', '--output-file', metavar='FILE',\n        help='Output results to this file; otherwise results are printed to '\n             'stdout.')\n\n    group = optparse.OptionGroup(parser, 'Header Comparison Options')\n\n    group.add_option(\n        '-k', '--ignore-keywords', action='callback', callback=store_list,\n        nargs=1, type='str', 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_option(\n        '-c', '--ignore-comments', action='callback', callback=store_list,\n        nargs=1, type='str', default=[], dest='ignore_comments',\n        metavar='KEYWORDS',\n        help='Comma-separated list of keywords whose comments will not be '\n             'compared.  Wildcards may be used as with --ignore-keywords.')\n\n    parser.add_option_group(group)\n    group = optparse.OptionGroup(parser, 'Table Comparison Options')\n\n    group.add_option(\n        '-f', '--ignore-fields', action='callback', callback=store_list,\n        nargs=1, type='str', 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    parser.add_option_group(group)\n    options, args = parser.parse_args(argv)\n\n    # Determine which filenames to compare\n    if len(args) != 2:\n        parser.error('\\n' + textwrap.fill(\n            'fitsdiff requires two arguments; see `fitsdiff --help` for more '\n            'details.', parser.formatter.width))\n\n    return options, args\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    filelists = []\n\n    for path in paths:\n        if glob.has_magic(path):\n            files = [os.path.abspath(f) for f in glob.glob(path)]\n            if not files:\n                log.error('Wildcard pattern {!r} did not match '\n                          'any files.'.format(path))\n                sys.exit(2)\n            filelists.append(files)\n        elif os.path.isdir(path):\n            filelists.append([os.path.abspath(f) for f in os.listdir(path)])\n        elif os.path.isfile(path):\n            filelists.append([path])\n        else:\n            log.error(\n                '{!r} is not an existing file, directory, or wildcard pattern; '\n                'see `fitsdiff --help` for more usage help.'.format(path))\n            sys.exit(2)\n\n    filelists[0].sort()\n    filelists[1].sort()\n\n    for a, b in [(0, 1), (1, 0)]:\n        if len(filelists[a]) > len(filelists[b]):\n            for extra in filelists[a][len(filelists[b]):]:\n                log.warning('{!r} has no match in {!r}'.format(extra, paths[b]))\n            filelists[a] = filelists[a][:len(filelists[b])]\n            break\n\n    return zip(*filelists)\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, args = handle_options(args)\n\n    if opts.tolerance is not None:\n        warnings.warn(\n            '\"-d\" (\"--difference-tolerance\") was deprecated in version 2.0 '\n            'and will be removed in a future version. '\n            'Use \"-r\" (\"--relative-tolerance\") instead.',\n            AstropyDeprecationWarning)\n        opts.rtol = opts.tolerance\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(args)\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_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"},{"className":"HelpFormatter","col":0,"comment":"null","endLoc":65,"id":2481,"nodeType":"Class","startLoc":63,"text":"class HelpFormatter(optparse.TitledHelpFormatter):\n    def format_epilog(self, epilog):\n        return '\\n{}\\n'.format(fill(epilog, self.width))"},{"col":4,"comment":"null","endLoc":65,"header":"def format_epilog(self, epilog)","id":2482,"name":"format_epilog","nodeType":"Function","startLoc":64,"text":"def format_epilog(self, epilog):\n        return '\\n{}\\n'.format(fill(epilog, self.width))"},{"col":4,"comment":"null","endLoc":175,"header":"def __init__(self, site, attribute, close_names=None)","id":2483,"name":"__init__","nodeType":"Function","startLoc":168,"text":"def __init__(self, site, attribute, close_names=None):\n        message = \"Site '{0}' not in database. Use {1} to see available sites.\".format(site, attribute)\n        if close_names:\n            message += \" Did you mean one of: '{0}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)"},{"col":0,"comment":"null","endLoc":190,"header":"def handle_options(argv=None)","id":2484,"name":"handle_options","nodeType":"Function","startLoc":68,"text":"def handle_options(argv=None):\n    # This is a callback--less trouble than actually adding a new action type\n    def store_list(option, opt, value, parser):\n        setattr(parser.values, option.dest, [])\n        # Accept either a comma-separated list or a filename (starting with @)\n        # containing a value on each line\n        if value and value[0] == '@':\n            value = value[1:]\n            if not os.path.exists(value):\n                log.warning('{} argument {} does not exist'.format(opt, value))\n                return\n            try:\n                values = [v.strip() for v in open(value, 'r').readlines()]\n                setattr(parser.values, option.dest, values)\n            except OSError as exc:\n                log.warning('reading {} for {} failed: {}; ignoring this '\n                            'argument'.format(value, opt, exc))\n                del exc\n        else:\n            setattr(parser.values, option.dest,\n                    [v.strip() for v in value.split(',')])\n\n    parser = optparse.OptionParser(usage=USAGE, epilog=EPILOG,\n                                   formatter=HelpFormatter())\n\n    parser.add_option(\n        '-q', '--quiet', action='store_true',\n        help='Produce no output and just return a status code.')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\n        '-d', '--difference-tolerance', type='float', default=None,\n        dest='tolerance', metavar='NUMBER',\n        help='DEPRECATED. Alias for \"--relative-tolerance\". '\n             'Deprecated, provided for backward compatibility (default %default).')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\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).')\n\n    parser.add_option(\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_option(\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_option(\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_option(\n        '-o', '--output-file', metavar='FILE',\n        help='Output results to this file; otherwise results are printed to '\n             'stdout.')\n\n    group = optparse.OptionGroup(parser, 'Header Comparison Options')\n\n    group.add_option(\n        '-k', '--ignore-keywords', action='callback', callback=store_list,\n        nargs=1, type='str', 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_option(\n        '-c', '--ignore-comments', action='callback', callback=store_list,\n        nargs=1, type='str', default=[], dest='ignore_comments',\n        metavar='KEYWORDS',\n        help='Comma-separated list of keywords whose comments will not be '\n             'compared.  Wildcards may be used as with --ignore-keywords.')\n\n    parser.add_option_group(group)\n    group = optparse.OptionGroup(parser, 'Table Comparison Options')\n\n    group.add_option(\n        '-f', '--ignore-fields', action='callback', callback=store_list,\n        nargs=1, type='str', 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    parser.add_option_group(group)\n    options, args = parser.parse_args(argv)\n\n    # Determine which filenames to compare\n    if len(args) != 2:\n        parser.error('\\n' + textwrap.fill(\n            'fitsdiff requires two arguments; see `fitsdiff --help` for more '\n            'details.', parser.formatter.width))\n\n    return options, args"},{"col":4,"comment":"\n        Return an object of this class for a given address by querying the Google\n        maps geocoding API.\n\n        This is intended as a quick convenience function to get fast access to\n        locations. In the background, this just issues a query to the Google maps\n        geocoding API. It is not meant to be abused! Google uses IP-based query\n        limiting and will ban your IP if you send more than a few thousand queries\n        per hour [1]_.\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** returned\n            location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API, this\n            can be a fully specified street address (e.g., 123 Main St., New York,\n            NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool (optional)\n            Use the retrieved location to perform a second query to the Google maps\n            elevation API to retrieve the height of the input address [2]_.\n\n        Returns\n        -------\n        location : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the input address.\n\n        References\n        ----------\n        .. [1] https://developers.google.com/maps/documentation/geocoding/intro\n        .. [2] https://developers.google.com/maps/documentation/elevation/intro\n\n        ","endLoc":415,"header":"@classmethod\n    def of_address(cls, address, get_height=False)","id":2485,"name":"of_address","nodeType":"Function","startLoc":351,"text":"@classmethod\n    def of_address(cls, address, get_height=False):\n        \"\"\"\n        Return an object of this class for a given address by querying the Google\n        maps geocoding API.\n\n        This is intended as a quick convenience function to get fast access to\n        locations. In the background, this just issues a query to the Google maps\n        geocoding API. It is not meant to be abused! Google uses IP-based query\n        limiting and will ban your IP if you send more than a few thousand queries\n        per hour [1]_.\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** returned\n            location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API, this\n            can be a fully specified street address (e.g., 123 Main St., New York,\n            NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool (optional)\n            Use the retrieved location to perform a second query to the Google maps\n            elevation API to retrieve the height of the input address [2]_.\n\n        Returns\n        -------\n        location : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the input address.\n\n        References\n        ----------\n        .. [1] https://developers.google.com/maps/documentation/geocoding/intro\n        .. [2] https://developers.google.com/maps/documentation/elevation/intro\n\n        \"\"\"\n\n        pars = urllib.parse.urlencode({'address': address})\n        geo_url = \"https://maps.googleapis.com/maps/api/geocode/json?{0}\".format(pars)\n\n        # get longitude and latitude location\n        err_str = (\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n                   .format(address=address))\n        geo_result = _get_json_result(geo_url, err_str=err_str)\n        loc = geo_result[0]['geometry']['location']\n\n        if get_height:\n            pars = {'locations': '{lat:.8f},{lng:.8f}'.format(lat=loc['lat'],\n                                                              lng=loc['lng'])}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = \"https://maps.googleapis.com/maps/api/elevation/json?{0}\".format(pars)\n\n            err_str = (\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n                       .format(address=address))\n            ele_result = _get_json_result(ele_url, err_str=err_str)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=loc['lng']*u.degree,\n                                 lat=loc['lat']*u.degree,\n                                 height=height)"},{"col":0,"comment":"null","endLoc":84,"header":"def _get_json_result(url, err_str)","id":2486,"name":"_get_json_result","nodeType":"Function","startLoc":54,"text":"def _get_json_result(url, err_str):\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\"))\n        else:\n            raise NameResolveError(err_str.format(msg=e.reason))\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    results = resp_data.get('results', [])\n\n    if not results:\n        raise NameResolveError(err_str.format(msg=\"no results returned\"))\n\n    if resp_data.get('status', None) != 'OK':\n        raise NameResolveError(err_str.format(msg=\"unknown failure with Google maps API\"))\n\n    return results"},{"col":4,"comment":"The meat of the formatting; in a separate method to allow overriding.\n        ","endLoc":141,"header":"def _parse_internal(self, hdukeys, keywords, compressed)","id":2487,"name":"_parse_internal","nodeType":"Function","startLoc":126,"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('# HDU {} in {}:\\n'.format(hdu, self.filename))\n            for c in cards:\n                result.append('{}\\n'.format(c))\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 : boolean, 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":197,"header":"def _get_cards(self, hdukey, keywords, compressed)","id":2488,"name":"_get_cards","nodeType":"Function","startLoc":143,"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 : boolean, 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 = '{0}: Extension {1} not found.'.format(self.filename,\n                                                             hdukey)\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 as e:  # Keyword does not exist\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":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 : file path, file object or file-like object\n        Input fits file.\n\n    datafile : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : file path, file object or file-like object, 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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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":899,"header":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\ndef tabledump(filename, datafile=None, cdfile=None, hfile=None, ext=1,\n              overwrite=False)","id":2489,"name":"tabledump","nodeType":"Function","startLoc":836,"text":"@deprecated_renamed_argument('clobber', 'overwrite', '2.0')\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 : file path, file object or file-like object\n        Input fits file.\n\n    datafile : file path, file object or file-like object, 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 : file path, file object or file-like object, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : file path, file object or file-like object, 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        .. versionchanged:: 1.3\n           ``overwrite`` replaces the deprecated ``clobber`` argument.\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()"},{"attributeType":"null","col":8,"comment":"null","endLoc":76,"id":2490,"name":"filename","nodeType":"Attribute","startLoc":76,"text":"self.filename"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":2491,"name":"_hdulist","nodeType":"Attribute","startLoc":77,"text":"self._hdulist"},{"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":223,"id":2492,"nodeType":"Class","startLoc":200,"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    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 .... import table\n            return table.Table(tablerows)\n        return None"},{"col":0,"comment":"null","endLoc":220,"header":"def setup_logging(outfile=None)","id":2493,"name":"setup_logging","nodeType":"Function","startLoc":193,"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":"Method called by the parse method in the parent class.","endLoc":223,"header":"def _parse_internal(self, hdukeys, keywords, compressed)","id":2494,"name":"_parse_internal","nodeType":"Function","startLoc":207,"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 .... import table\n            return table.Table(tablerows)\n        return None"},{"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":443,"header":"@classmethod\n    def get_site_names(cls)","id":2495,"name":"get_site_names","nodeType":"Function","startLoc":417,"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"},{"col":4,"comment":"The default ellipsoid used to convert to geodetic coordinates.","endLoc":495,"header":"@property\n    def ellipsoid(self)","id":2496,"name":"ellipsoid","nodeType":"Function","startLoc":492,"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":499,"header":"@ellipsoid.setter\n    def ellipsoid(self, ellipsoid)","id":2497,"name":"ellipsoid","nodeType":"Function","startLoc":497,"text":"@ellipsoid.setter\n    def ellipsoid(self, ellipsoid):\n        self._ellipsoid = _check_ellipsoid(ellipsoid)"},{"col":4,"comment":"null","endLoc":438,"header":"def __init__(self, *args, copy=True, representation=None,\n                 differential_cls=None,**kwargs)","id":2498,"name":"__init__","nodeType":"Function","startLoc":268,"text":"def __init__(self, *args, copy=True, representation=None,\n                 differential_cls=None,**kwargs):\n        self._attr_names_with_defaults = []\n\n        # TODO: we should be able to deal with an instance, not just a\n        # class or string for representation and differential_cls.\n\n        if representation is not None or differential_cls is not None:\n\n            if representation is None:\n                representation = self.default_representation\n\n            if (inspect.isclass(differential_cls) and\n                    issubclass(differential_cls, r.BaseDifferential)):\n                # TODO: assumes the differential class is for the velocity\n                # differential\n                differential_cls = {'s': differential_cls}\n\n            elif differential_cls is None:\n                differential_cls = {'s': 'base'} # see set_representation_cls()\n\n            self.set_representation_cls(representation, **differential_cls)\n\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)\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation and '\n                    '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                                     '{0}'.format(diffs))\n\n        elif self.representation:\n            representation_cls = self.representation\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            # TODO: possibly generalize this somehow?\n            if repr_kwargs:\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls, r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                representation_data = representation_cls(copy=copy, **repr_kwargs)\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') and\n                        '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                differential_data = differential_cls(copy=copy, **diff_kwargs)\n\n        if len(args) > 0:\n            raise TypeError(\n                '{0}.__init__ had {1} 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            self._data = representation_data.with_differentials(\n                {'s': differential_data})\n        else:\n            self._data = representation_data  # possibly None.\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribue\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                'Coordinate frame got unexpected keywords: {0}'.format(\n                    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, 'size', 1) > 1}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError:\n                        raise ValueError(\n                            \"non-scalar attributes with inconsistent \"\n                            \"shapes: {0}\".format(shapes))\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        else:\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":"Convert to geodetic coordinates for the default ellipsoid.","endLoc":504,"header":"@property\n    def geodetic(self)","id":2499,"name":"geodetic","nodeType":"Function","startLoc":501,"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) : tuple\n            The tuple contains 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":538,"header":"def to_geodetic(self, ellipsoid=None)","id":2500,"name":"to_geodetic","nodeType":"Function","startLoc":506,"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) : tuple\n            The tuple contains 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        self_array = self.to(u.meter).view(self._array_dtype, np.ndarray)\n        lon, lat, height = erfa.gc2gd(getattr(erfa, ellipsoid), self_array)\n        return GeodeticLocation(\n            Longitude(lon * u.radian, u.degree,\n                      wrap_angle=180.*u.degree, copy=False),\n            Latitude(lat * u.radian, u.degree, copy=False),\n            u.Quantity(height * u.meter, self.unit, copy=False))"},{"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 : file path, file object or file-like object\n        Input data file containing the table data in ASCII format.\n\n    cdfile : file path, file object or file-like object\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 : file path, file object or file-like object, 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":938,"header":"def tableload(datafile, cdfile, hfile=None)","id":2501,"name":"tableload","nodeType":"Function","startLoc":906,"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 : file path, file object or file-like object\n        Input data file containing the table data in ASCII format.\n\n    cdfile : file path, file object or file-like object\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 : file path, file object or file-like object, 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)"},{"col":4,"comment":"Longitude of the location, for the default ellipsoid.","endLoc":544,"header":"@property\n    @deprecated('2.0', alternative='`lon`', obj_type='property')\n    def longitude(self)","id":2503,"name":"longitude","nodeType":"Function","startLoc":540,"text":"@property\n    @deprecated('2.0', alternative='`lon`', obj_type='property')\n    def longitude(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]"},{"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        AstropyDeprecationWarning.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\n    ","endLoc":198,"header":"def deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None)","id":2504,"name":"deprecated","nodeType":"Function","startLoc":24,"text":"def deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None):\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        AstropyDeprecationWarning.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\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):\n        \"\"\"\n        Returns a wrapped function that displays an\n        ``AstropyDeprecationWarning`` 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\n\n        func = get_function(func)\n\n        def deprecated_func(*args, **kwargs):\n            if pending:\n                category = AstropyPendingDeprecationWarning\n            else:\n                category = AstropyDeprecationWarning\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__']):  # nopep8\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):\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__), message)\n        else:\n            cls.__new__ = deprecate_function(get_function(cls.__new__), message)\n        return cls\n\n    def deprecate(obj, message=message, name=name, alternative=alternative,\n                  pending=pending):\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 = '\\n        Use {} instead.'.format(alternative)\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)\n        else:\n            return deprecate_function(obj, message)\n\n    if type(message) is type(deprecate):\n        return deprecate(message)\n\n    return deprecate"},{"col":0,"comment":"null","endLoc":254,"header":"def match_files(paths)","id":2505,"name":"match_files","nodeType":"Function","startLoc":223,"text":"def match_files(paths):\n    filelists = []\n\n    for path in paths:\n        if glob.has_magic(path):\n            files = [os.path.abspath(f) for f in glob.glob(path)]\n            if not files:\n                log.error('Wildcard pattern {!r} did not match '\n                          'any files.'.format(path))\n                sys.exit(2)\n            filelists.append(files)\n        elif os.path.isdir(path):\n            filelists.append([os.path.abspath(f) for f in os.listdir(path)])\n        elif os.path.isfile(path):\n            filelists.append([path])\n        else:\n            log.error(\n                '{!r} is not an existing file, directory, or wildcard pattern; '\n                'see `fitsdiff --help` for more usage help.'.format(path))\n            sys.exit(2)\n\n    filelists[0].sort()\n    filelists[1].sort()\n\n    for a, b in [(0, 1), (1, 0)]:\n        if len(filelists[a]) > len(filelists[b]):\n            for extra in filelists[a][len(filelists[b]):]:\n                log.warning('{!r} has no match in {!r}'.format(extra, paths[b]))\n            filelists[a] = filelists[a][:len(filelists[b])]\n            break\n\n    return zip(*filelists)"},{"col":27,"endLoc":107,"id":2506,"nodeType":"Lambda","startLoc":107,"text":"lambda f: f"},{"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":243,"header":"def print_headers_traditional(args)","id":2508,"name":"print_headers_traditional","nodeType":"Function","startLoc":226,"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        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))"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":2509,"name":"__all__","nodeType":"Attribute","startLoc":79,"text":"__all__"},{"col":0,"comment":"","endLoc":55,"header":"convenience.py#<anonymous>","id":2510,"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 extension HDU to use when working with a\nmulti-extension FITS file.  There are a few supported argument formats for\nselecting the extension.  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 extension HDU should be passed in as keyword\n    arguments.  This is to avoid ambiguity and conflicts with the\n    extension 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 extension\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    ')"},{"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":275,"header":"def print_headers_as_table(args)","id":2511,"name":"print_headers_as_table","nodeType":"Function","startLoc":246,"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        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    # 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 .... 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":0,"comment":"null","endLoc":327,"header":"def main(args=None)","id":2513,"name":"main","nodeType":"Function","startLoc":257,"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, args = handle_options(args)\n\n    if opts.tolerance is not None:\n        warnings.warn(\n            '\"-d\" (\"--difference-tolerance\") was deprecated in version 2.0 '\n            'and will be removed in a future version. '\n            'Use \"-r\" (\"--relative-tolerance\") instead.',\n            AstropyDeprecationWarning)\n        opts.rtol = opts.tolerance\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(args)\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_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)"},{"fileName":"__init__.py","filePath":"astropy/io/fits/scripts","id":2515,"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":2517,"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\"\"\""},{"id":2518,"name":"astropy/io/misc","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc","id":2519,"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":2520,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains miscellaneous utility functions for data\ninput/output with astropy.\n\"\"\""},{"col":4,"comment":"Longitude of the location, for the default ellipsoid.","endLoc":549,"header":"@property\n    def lon(self)","id":2522,"name":"lon","nodeType":"Function","startLoc":546,"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":555,"header":"@property\n    @deprecated('2.0', alternative='`lat`', obj_type='property')\n    def latitude(self)","id":2523,"name":"latitude","nodeType":"Function","startLoc":551,"text":"@property\n    @deprecated('2.0', alternative='`lat`', obj_type='property')\n    def latitude(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]"},{"col":4,"comment":"Longitude of the location, for the default ellipsoid.","endLoc":560,"header":"@property\n    def lat(self)","id":2524,"name":"lat","nodeType":"Function","startLoc":557,"text":"@property\n    def lat(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]"},{"col":4,"comment":"Height of the location, for the default ellipsoid.","endLoc":565,"header":"@property\n    def height(self)","id":2525,"name":"height","nodeType":"Function","startLoc":562,"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":571,"header":"@property\n    def geocentric(self)","id":2526,"name":"geocentric","nodeType":"Function","startLoc":568,"text":"@property\n    def geocentric(self):\n        \"\"\"Convert to a tuple with X, Y, and Z as quantities\"\"\"\n        return self.to_geocentric()"},{"fileName":"yaml.py","filePath":"astropy/io/misc","id":2527,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module contains functions for serializing core astropy objects via the\nYAML protocol.\n\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 <http://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\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\n.. Note ::\n\n   This module requires PyYaml version 3.12 or later.\n\nExample\n=======\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\n  >>> t = Time(2457389.0, format='mjd',\n  ...          location=EarthLocation(1000, 2000, 3000, unit=u.km))\n  >>> td = yaml.dump(t)\n\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\n  >>> ty = yaml.load(td)\n  >>> ty\n  <Time object: scale='utc' format='mjd' value=2457389.0>\n\n  >>> ty.location  # doctest: +FLOAT_CMP\n  <EarthLocation (1000., 2000., 3000.) km>\n\"\"\"\n\n\nimport base64\nimport numpy as np\n\nfrom ...time import Time, TimeDelta\nfrom ... import units as u\nfrom ... import coordinates as coords\nfrom ...utils import minversion\nfrom ...table import SerializedColumn\n\n\ntry:\n    import yaml\nexcept ImportError:\n    raise ImportError('`import yaml` failed, PyYAML package is required for YAML')\n\n\nYAML_LT_3_12 = not minversion(yaml, '3.12')\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'])\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.tostring())\n\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype),\n               shape=obj.shape,\n               order=order)\n\n    return dumper.represent_mapping('!numpy.ndarray', out)\n\n\ndef _ndarray_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(**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 = u'%r' % data.real\n    elif data.real == 0.0:\n        data = u'%rj' % data.imag\n    elif data.imag > 0:\n        data = u'%r+%rj' % (data.real, data.imag)\n    else:\n        data = u'%r%rj' % (data.real, data.imag)\n    return self.represent_scalar(u'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    <http://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 <http://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    if YAML_LT_3_12:\n        # pre-3.12, ignore-aliases could not deal with ndarray, so we backport\n        # the more recent ignore_alises definition.\n        def ignore_aliases(self, data):\n            if data is None:\n                return True\n            if isinstance(data, tuple) and data == ():\n                return True\n            if isinstance(data, (str, bool, int, float)):\n                return True\n\n\nAstropyDumper.add_representer(u.IrreducibleUnit, _unit_representer)\nAstropyDumper.add_representer(u.CompositeUnit, _unit_representer)\nAstropyDumper.add_multi_representer(u.Unit, _unit_representer)\nAstropyDumper.add_representer(tuple, AstropyDumper._represent_tuple)\nAstropyDumper.add_representer(np.ndarray, _ndarray_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_,\n                              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,\n                                 _complex_representer)\n\nAstropyLoader.add_constructor(u'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('!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                 (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\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 object\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 object\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 object, 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    return yaml.dump(data, stream=stream, **kwargs)\n"},{"col":4,"comment":"Convert to a tuple with X, Y, and Z as quantities","endLoc":575,"header":"def to_geocentric(self)","id":2528,"name":"to_geocentric","nodeType":"Function","startLoc":573,"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":600,"header":"def get_itrs(self, obstime=None)","id":2529,"name":"get_itrs","nodeType":"Function","startLoc":577,"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.size > 1:\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":"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":541,"header":"def set_representation_cls(self, base=None, s='base')","id":2530,"name":"set_representation_cls","nodeType":"Function","startLoc":526,"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":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":102,"header":"def _get_repr_classes(base, **differentials)","id":2531,"name":"_get_repr_classes","nodeType":"Function","startLoc":64,"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_cls in differentials.items():\n        if differential_cls == 'base':\n            # We don't want to fail for this case.\n            differential_cls = r.DIFFERENTIAL_CLASSES.get(base.get_name(), None)\n\n        elif differential_cls in r.DIFFERENTIAL_CLASSES:\n            differential_cls = r.DIFFERENTIAL_CLASSES[differential_cls]\n\n        elif (differential_cls is not None and\n              (not isinstance(differential_cls, type) or\n               not issubclass(differential_cls, r.BaseDifferential))):\n            raise ValueError(\n                'Differential is {0!r} but must be a BaseDifferential class '\n                'or one of the string aliases {1}'.format(\n                    differential_cls, list(r.DIFFERENTIAL_CLASSES)))\n        repr_classes[name] = differential_cls\n    return repr_classes"},{"col":0,"comment":"\n    Return a valid representation class from ``value`` or raise exception.\n    ","endLoc":61,"header":"def _get_repr_cls(value)","id":2532,"name":"_get_repr_cls","nodeType":"Function","startLoc":48,"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 {0!r} but must be a BaseRepresentation class '\n            'or one of the string aliases {1}'.format(\n                value, list(r.REPRESENTATION_CLASSES)))\n    return value"},{"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']\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    Parameters\n    ----------\n    val : sequence, ndarray, number, or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s).\n    val2 : numpy ndarray, list, str, or number; optional\n        Additional values, as needed to 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 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":1719,"id":2533,"nodeType":"Class","startLoc":1476,"text":"class TimeDelta(Time):\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']\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    Parameters\n    ----------\n    val : sequence, ndarray, number, or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s).\n    val2 : numpy ndarray, list, str, or number; optional\n        Additional values, as needed to 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 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 __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            if format is None:\n                try:\n                    val = val.to(u.day)\n                    if val2 is not None:\n                        val2 = val2.to(u.day)\n                except Exception:\n                    raise ValueError('Only Quantities with Time units can '\n                                     'be used to initiate {0} instances .'\n                                     .format(self.__class__.__name__))\n                format = 'jd'\n\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    def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out\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 {0!r} is not in the allowed scales {1}\"\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__(self, other):\n        # only deal with TimeDelta + TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                return other.__add__(self)\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 + other._time.jd1\n        jd2 = 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 __sub__(self, other):\n        # only deal with TimeDelta - TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                raise OperandTypeError(self, other, '-')\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot subtract TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 - other._time.jd1\n        jd2 = 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 __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\n        try:   # convert to straight float if dimensionless quantity\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:\n            jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                raise err\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 __div__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        return self.__truediv__(other)\n\n    def __rdiv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        return self.__rtruediv__(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        try:\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:   # convert to straight float if dimensionless quantity\n            jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                raise err\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        return other / self.to(u.day)\n\n    def to(self, *args, **kwargs):\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":1543,"header":"def __init__(self, val, val2=None, format=None, scale=None, copy=False)","id":2534,"name":"__init__","nodeType":"Function","startLoc":1524,"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            if format is None:\n                try:\n                    val = val.to(u.day)\n                    if val2 is not None:\n                        val2 = val2.to(u.day)\n                except Exception:\n                    raise ValueError('Only Quantities with Time units can '\n                                     'be used to initiate {0} instances .'\n                                     .format(self.__class__.__name__))\n                format = 'jd'\n\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":"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":628,"header":"def _get_gcrs(self, obstime)","id":2535,"name":"_get_gcrs","nodeType":"Function","startLoc":606,"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\n        itrs = self.get_itrs(obstime)\n        # Assume the observatory itself is fixed on the ground.\n        # We do a direct assignment rather than an update to avoid validation\n        # and creation of a new object.\n        zeros = np.broadcast_to(0. * u.km / u.s, (3,) + itrs.shape, subok=True)\n        itrs.data.differentials['s'] = CartesianDifferential(zeros)\n        return itrs.transform_to(GCRS(obstime=obstime))"},{"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 : Table or list of Table objects\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":286,"header":"def vstack(tables, join_type='outer', metadata_conflicts='warn')","id":2536,"name":"vstack","nodeType":"Function","startLoc":223,"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 : Table or list of Table objects\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    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":4,"comment":"null","endLoc":1949,"header":"def _generate_dither_seed(self, seed)","id":2537,"name":"_generate_dither_seed","nodeType":"Function","startLoc":1908,"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['ZTILE{}'.format(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        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":1573,"header":"def _set_scale(self, scale)","id":2538,"name":"_set_scale","nodeType":"Function","startLoc":1550,"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 {0!r} is not in the allowed scales {1}\"\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":0,"comment":"\n    Return the sum of ``val1`` and ``val2`` as two float64s, an integer part\n    and the fractional remainder.  If ``factor`` is not 1.0 then multiply the\n    sum by ``factor``.  If ``divisor`` is not 1.0 then divide the sum by\n    ``divisor``.\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  This routine assumes the sum is less\n    than about 1e16, otherwise the ``frac`` part will be greater than 1.0.\n\n    Returns\n    -------\n    day, frac : float64\n        Integer and fractional part of val1 + val2.\n    ","endLoc":52,"header":"def day_frac(val1, val2, factor=1., divisor=1.)","id":2539,"name":"day_frac","nodeType":"Function","startLoc":13,"text":"def day_frac(val1, val2, factor=1., divisor=1.):\n    \"\"\"\n    Return the sum of ``val1`` and ``val2`` as two float64s, an integer part\n    and the fractional remainder.  If ``factor`` is not 1.0 then multiply the\n    sum by ``factor``.  If ``divisor`` is not 1.0 then divide the sum by\n    ``divisor``.\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  This routine assumes the sum is less\n    than about 1e16, otherwise the ``frac`` part will be greater than 1.0.\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 np.any(factor != 1.):\n        sum12, carry = two_product(sum12, factor)\n        carry += err12 * factor\n        sum12, err12 = two_sum(sum12, carry)\n\n    if np.any(divisor != 1.):\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    return day, frac"},{"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":524,"header":"def get_representation_cls(self, which='base')","id":2540,"name":"get_representation_cls","nodeType":"Function","startLoc":506,"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 not hasattr(self, '_representation'):\n            self._representation = {'base': self.default_representation,\n                                    's': self.default_differential}\n        return self._representation[which] if which is not None else self._representation"},{"col":0,"comment":"\n    Check that tables is a Table or sequence of Tables.  Returns the\n    corresponding list of Tables.\n    ","endLoc":54,"header":"def _get_list_of_tables(tables)","id":2541,"name":"_get_list_of_tables","nodeType":"Function","startLoc":36,"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    from .table import Table, Row\n\n    # Make sure we have a list of things\n    if not isinstance(tables, collections.Sequence):\n        tables = [tables]\n\n    # Make sure each thing is a Table or Row\n    if any(not isinstance(x, (Table, Row)) for x in tables) or len(tables) == 0:\n        raise TypeError('`tables` arg must be a Table or sequence of Tables or Rows')\n\n    # Convert any Rows to Tables\n    tables = [(x if isinstance(x, Table) else Table(x)) for x in tables]\n\n    return tables"},{"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":75,"header":"def two_sum(a, b)","id":2542,"name":"two_sum","nodeType":"Function","startLoc":55,"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\n    eb = b - eb\n    ea = x - b\n    ea = a - ea\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":104,"header":"def two_product(a, b)","id":2543,"name":"two_product","nodeType":"Function","startLoc":78,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":2544,"name":"log","nodeType":"Attribute","startLoc":15,"text":"log"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":2545,"name":"USAGE","nodeType":"Attribute","startLoc":18,"text":"USAGE"},{"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":120,"header":"def split(a)","id":2546,"name":"split","nodeType":"Function","startLoc":107,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":2547,"name":"EPILOG","nodeType":"Attribute","startLoc":38,"text":"EPILOG"},{"col":0,"comment":"","endLoc":2,"header":"fitsdiff.py#<anonymous>","id":2548,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"log = logging.getLogger('fitsdiff')\n\nUSAGE = \"\"\"\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\"\"\".strip()\n\nEPILOG = \"\"\"\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()"},{"col":4,"comment":"null","endLoc":2237,"header":"def __init__(self, d_x, d_y=None, d_z=None, unit=None, xyz_axis=None,\n                 copy=True)","id":2549,"name":"__init__","nodeType":"Function","startLoc":2212,"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 xyz_axis is not None and xyz_axis != 0:\n                d_x = np.rollaxis(d_x, xyz_axis, 0)\n            d_x, d_y, d_z = d_x\n        elif 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        elif ((d_y is None and d_z is not None) or\n              (d_y is not None and d_z is None)):\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {0}\"\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.')"},{"fileName":"connect.py","filePath":"astropy/io/misc","id":2550,"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\n\nhdf5.register_hdf5()\n"},{"col":4,"comment":"null","endLoc":616,"header":"def get_representation_component_names(self, which='base')","id":2551,"name":"get_representation_component_names","nodeType":"Function","startLoc":607,"text":"def get_representation_component_names(self, which='base'):\n        out = OrderedDict()\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"},{"col":0,"comment":"","endLoc":5,"header":"connect.py#<anonymous>","id":2552,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"hdf5.register_hdf5()"},{"col":0,"comment":"\n    Register HDF5 with Unified I/O.\n    ","endLoc":376,"header":"def register_hdf5()","id":2553,"name":"register_hdf5","nodeType":"Function","startLoc":367,"text":"def register_hdf5():\n    \"\"\"\n    Register HDF5 with Unified I/O.\n    \"\"\"\n    from .. import registry as io_registry\n    from ...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":4,"comment":"null","endLoc":1548,"header":"def replicate(self, *args, **kwargs)","id":2554,"name":"replicate","nodeType":"Function","startLoc":1545,"text":"def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out"},{"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":865,"header":"def _vstack(arrays, join_type='outer', col_name_map=None, metadata_conflicts='warn')","id":2555,"name":"_vstack","nodeType":"Function","startLoc":759,"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    # Input validation\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    # 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    # If there are any output columns 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    masked = any(getattr(arr, 'masked', False) for arr in arrays)\n    for names in col_name_map.values():\n        if any(x is None for x in names):\n            masked = True\n            break\n\n    lens = [len(arr) for arr in arrays]\n    n_rows = sum(lens)\n    out = _get_out_class(arrays)(masked=masked)\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            out[out_name] = 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 '{0}' columns have incompatible types: {1}\"\n                                  .format(out_name, err._incompat_types))\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                out[out_name][idx0:idx1] = array[name]\n            else:\n                try:\n                    out[out_name].mask[idx0:idx1] = True\n                except ValueError:\n                    raise NotImplementedError(\n                        \"vstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, out[out_name].__class__.__name__))\n            idx0 = idx1\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.Mapping):\n        _col_name_map.update(col_name_map)\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":544,"header":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None)","id":2556,"name":"get_col_name_map","nodeType":"Function","startLoc":491,"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: {0}.  '\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":506,"id":2557,"nodeType":"Lambda","startLoc":506,"text":"lambda: [None] * len(arrays)"},{"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":829,"header":"def replicate(self, format=None, copy=False)","id":2558,"name":"replicate","nodeType":"Function","startLoc":800,"text":"def replicate(self, format=None, copy=False):\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)"},{"fileName":"pickle_helpers.py","filePath":"astropy/io/misc","id":2559,"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 warnings\n\nfrom ...utils.exceptions import AstropyDeprecationWarning, NoValue\n\n__all__ = ['fnpickle', 'fnunpickle']\n\n\ndef fnunpickle(fileorname, number=0, usecPickle=NoValue):\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 : obj or list\n        If ``number`` is 0, this is a individual object - the first one unpickled\n        from the file. Otherwise, it is a list of objects unpickled from the\n        file.\n\n    \"\"\"\n\n    if usecPickle is not NoValue:\n        warnings.warn('The \"usecPickle\" keyword is now deprecated.',\n                      AstropyDeprecationWarning)\n\n    import pickle\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, usecPickle=NoValue, protocol=None,\n             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\n    if usecPickle is not NoValue:\n        warnings.warn('The \"usecPickle\" keyword is now deprecated.',\n                      AstropyDeprecationWarning)\n\n    import pickle\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":2560,"name":"NoValue","nodeType":"Attribute","startLoc":57,"text":"NoValue"},{"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 : obj or list\n        If ``number`` is 0, this is a individual object - the first one unpickled\n        from the file. Otherwise, it is a list of objects unpickled from the\n        file.\n\n    ","endLoc":75,"header":"def fnunpickle(fileorname, number=0, usecPickle=NoValue)","id":2561,"name":"fnunpickle","nodeType":"Function","startLoc":14,"text":"def fnunpickle(fileorname, number=0, usecPickle=NoValue):\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 : obj or list\n        If ``number`` is 0, this is a individual object - the first one unpickled\n        from the file. Otherwise, it is a list of objects unpickled from the\n        file.\n\n    \"\"\"\n\n    if usecPickle is not NoValue:\n        warnings.warn('The \"usecPickle\" keyword is now deprecated.',\n                      AstropyDeprecationWarning)\n\n    import pickle\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":"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":924,"header":"def _apply(self, method, *args, format=None, **kwargs)","id":2562,"name":"_apply","nodeType":"Function","startLoc":831,"text":"def _apply(self, method, *args, format=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__(self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, self.precision,\n                          self.in_subfmt, self.out_subfmt, from_jd=True)\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location',\n                     'precision', 'in_subfmt', 'out_subfmt'):\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 a single element and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'size', 1) > 1:\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.\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('format must be one of {0}'\n                             .format(list(tm.FORMATS)))\n\n        NewFormat = tm.FORMATS[new_format]\n        tm._time = NewFormat(tm._time.jd1, tm._time.jd2,\n                             tm._time._scale, tm.precision,\n                             tm.in_subfmt, tm.out_subfmt,\n                             from_jd=True)\n        tm._format = new_format\n\n        return tm"},{"col":27,"endLoc":865,"id":2563,"nodeType":"Lambda","startLoc":865,"text":"lambda array: method(array, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":504,"header":"@classmethod\n    def get_frame_attr_names(cls)","id":2564,"name":"get_frame_attr_names","nodeType":"Function","startLoc":501,"text":"@classmethod\n    def get_frame_attr_names(cls):\n        return OrderedDict((name, getattr(cls, name))\n                           for name in cls.frame_attributes)"},{"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.\n    ","endLoc":73,"header":"def _get_out_class(objs)","id":2565,"name":"_get_out_class","nodeType":"Function","startLoc":57,"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.\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__) 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":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":119,"header":"def fnpickle(object, fileorname, usecPickle=NoValue, protocol=None,\n             append=False)","id":2566,"name":"fnpickle","nodeType":"Function","startLoc":78,"text":"def fnpickle(object, fileorname, usecPickle=NoValue, protocol=None,\n             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\n    if usecPickle is not NoValue:\n        warnings.warn('The \"usecPickle\" keyword is now deprecated.',\n                      AstropyDeprecationWarning)\n\n    import pickle\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()"},{"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":1107,"header":"def check_broadcast(*shapes)","id":2567,"name":"check_broadcast","nodeType":"Function","startLoc":1062,"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":"null","endLoc":129,"header":"def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False)","id":2568,"name":"__init__","nodeType":"Function","startLoc":117,"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        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":"null","endLoc":1059,"header":"def __init__(self, shape_a, shape_a_idx, shape_b, shape_b_idx)","id":2569,"name":"__init__","nodeType":"Function","startLoc":1058,"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":0,"comment":"null","endLoc":33,"header":"def _merge_table_meta(out, tables, metadata_conflicts='warn')","id":2570,"name":"_merge_table_meta","nodeType":"Function","startLoc":29,"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":0,"comment":"\n    Merge the ``left`` and ``right`` metadata objects.\n\n    This is a simplistic and limited implementation at this point.\n    ","endLoc":370,"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":2571,"name":"merge","nodeType":"Function","startLoc":305,"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":4,"comment":"null","endLoc":169,"header":"def __init__(self, *args, **kwargs)","id":2572,"name":"__init__","nodeType":"Function","startLoc":129,"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        attrs = []\n        for component in components:\n            try:\n                attrs.append(args.pop(0) if args else kwargs.pop(component))\n            except KeyError:\n                raise TypeError('__init__() missing 1 required positional '\n                                'argument: {0!r}'.format(component))\n\n        copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n        if args:\n            raise TypeError('unexpected arguments: {0}'.format(args))\n\n        if kwargs:\n            for component in components:\n                if component in kwargs:\n                    raise TypeError(\"__init__() got multiple values for \"\n                                    \"argument {0!r}\".format(component))\n\n            raise TypeError('unexpected keyword arguments: {0}'.format(kwargs))\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy)\n                 for component, attr in zip(components, attrs)]\n        try:\n            attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError:\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(\"Input parameters {0} cannot be broadcast\"\n                             .format(c_str))\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)"},{"col":4,"comment":"Input value validation, typically overridden by derived classes","endLoc":171,"header":"def _check_val_type(self, val1, val2)","id":2573,"name":"_check_val_type","nodeType":"Function","startLoc":144,"text":"def _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if not (val1.dtype == np.double and np.all(np.isfinite(val1)) and\n                (val2 is None or\n                 val2.dtype == np.double and np.all(np.isfinite(val2)))):\n            raise TypeError('Input values for {0} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Possibly scaled unit any quantity-likes should be converted to\n            _unit = u.CompositeUnit(getattr(self, 'unit', 1.), [u.day], [1])\n            val1 = u.Quantity(val1, copy=False).to_value(_unit)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False).to_value(_unit)\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.zeros_like(val1)\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)"},{"col":4,"comment":"\n        Set the current science state value.\n        ","endLoc":65,"header":"@classmethod\n    def set(cls, value)","id":2574,"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                return ('<ScienceState {0}: {1!r}>'\n                        .format(self._parent.__name__, self._parent._value))\n\n        ctx = _Context(cls, cls._value)\n        value = cls.validate(value)\n        cls._value = value\n        return ctx"},{"col":4,"comment":"\n        Validate the value and convert it to its native type, if\n        necessary.\n        ","endLoc":73,"header":"@classmethod\n    def validate(cls, value)","id":2576,"name":"validate","nodeType":"Function","startLoc":67,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":2577,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"pickle_helpers.py#<anonymous>","id":2578,"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']"},{"col":0,"comment":"null","endLoc":205,"header":"def _both_isinstance(left, right, cls)","id":2579,"name":"_both_isinstance","nodeType":"Function","startLoc":204,"text":"def _both_isinstance(left, right, cls):\n    return isinstance(left, cls) and isinstance(right, cls)"},{"col":4,"comment":"\n        Set internal jd1 and jd2 from val1 and val2.  Must be provided\n        by derived classes.\n        ","endLoc":204,"header":"def set_jds(self, val1, val2)","id":2581,"name":"set_jds","nodeType":"Function","startLoc":199,"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":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`, `str`, or `None`; optional\n            The longitude on the Earth at which to compute the sidereal time.\n            Can be given as a `~astropy.units.Quantity` with angular units\n            (or an `~astropy.coordinates.Angle` or\n            `~astropy.coordinates.Longitude`), or as a name of an\n            observatory (currently, only ``'greenwich'`` is supported,\n            equivalent to 0 deg).  If `None` (default), the ``lon`` attribute of\n            the Time object is used.\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        sidereal time : `~astropy.coordinates.Longitude`\n            Sidereal time as a quantity with units of hourangle\n        ","endLoc":754,"header":"def sidereal_time(self, kind, longitude=None, model=None)","id":2582,"name":"sidereal_time","nodeType":"Function","startLoc":694,"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`, `str`, or `None`; optional\n            The longitude on the Earth at which to compute the sidereal time.\n            Can be given as a `~astropy.units.Quantity` with angular units\n            (or an `~astropy.coordinates.Angle` or\n            `~astropy.coordinates.Longitude`), or as a name of an\n            observatory (currently, only ``'greenwich'`` is supported,\n            equivalent to 0 deg).  If `None` (default), the ``lon`` attribute of\n            the Time object is used.\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        sidereal time : `~astropy.coordinates.Longitude`\n            Sidereal time as a quantity with units of hourangle\n        \"\"\"  # docstring is formatted below\n\n        from ..coordinates import Longitude\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {0}'.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        else:\n            if model.upper() not in available_models:\n                raise ValueError(\n                    'Model {0} not implemented for {1} sidereal time; '\n                    'available models are {2}'\n                    .format(model, kind, sorted(available_models.keys())))\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 longitude == 'greenwich':\n            longitude = Longitude(0., u.degree,\n                                  wrap_angle=180.*u.degree)\n        else:\n            # sanity check on input\n            longitude = Longitude(longitude, u.degree,\n                                  wrap_angle=180.*u.degree)\n\n        gst = self._erfa_sidereal_time(available_models[model.upper()])\n        return Longitude(gst + longitude, u.hourangle)"},{"col":4,"comment":"null","endLoc":1605,"header":"def __add__(self, other)","id":2583,"name":"__add__","nodeType":"Function","startLoc":1575,"text":"def __add__(self, other):\n        # only deal with TimeDelta + TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                return other.__add__(self)\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 + other._time.jd1\n        jd2 = self._time.jd2 + other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        return out"},{"col":0,"comment":"null","endLoc":212,"header":"def _not_equal(left, right)","id":2584,"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"},{"fileName":"hdf5.py","filePath":"astropy/io/misc","id":2585,"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:`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 ...utils.exceptions import AstropyUserWarning, AstropyDeprecationWarning\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.highlevel.File, h5py.highlevel.Group, h5py.highlevel.Dataset))\n\n\ndef read_table_hdf5(input, path=None):\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    \"\"\"\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.highlevel.File, h5py.highlevel.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(\"Path {0} does not exist\".format(path))\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.highlevel.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(\"no table found in HDF5 group {0}\".\n                                 format(path))\n            elif len(arrays) > 0:\n                path = arrays[0] if path is None else path + '/' + arrays[0]\n                warnings.warn(\"path= was not specified but multiple tables\"\n                              \" are present, reading in first available\"\n                              \" table (path={0})\".format(path),\n                              AstropyUserWarning)\n                return read_table_hdf5(input, path=path)\n\n    elif not isinstance(input, h5py.highlevel.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)\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 ...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        elif old_version_meta:\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    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 ...table import serialize\n    from ...table.table import has_info_class\n    from ... import units as u\n    from ...utils.data_info import MixinInfo, serialize_context_as\n\n    # If PyYAML is not available then check to see if there are any mixin cols\n    # that *require* YAML serialization.  HDF5 already has support for\n    # Quantity, so if those are the only mixins the proceed without doing the\n    # YAML bit, for backward compatibility (i.e. not requiring YAML to write\n    # Quantity).\n    try:\n        import yaml\n    except ImportError:\n        for col in tbl.itercols():\n            if (has_info_class(col, MixinInfo) and\n                    col.__class__ is not u.Quantity):\n                raise TypeError(\"cannot write type {} column '{}' \"\n                                \"to HDF5 without PyYAML installed.\"\n                                .format(col.__class__.__name__, col.info.name))\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                     compatibility_mode=False):\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    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    \"\"\"\n    from ...table import meta\n\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        raise ValueError(\"table path should be set via the path= argument\")\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.highlevel.File, h5py.highlevel.Group)):\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(\"File exists: {0}\".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                                    compatibility_mode=compatibility_mode)\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        else:\n            raise OSError(\"Table {0} already exists\".format(path))\n\n    # Encode any mixin columns as plain columns + appropriate metadata\n    table = _encode_mixins(table)\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    else:\n        dset = output_group.create_dataset(name, data=table.as_array())\n\n    if serialize_meta:\n        header_yaml = meta.get_yaml_from_table(table)\n\n        header_encoded = [h.encode('utf-8') for h in header_yaml]\n        if compatibility_mode:\n            warnings.warn(\"compatibility mode for writing is deprecated\",\n                          AstropyDeprecationWarning)\n            try:\n                dset.attrs[META_KEY] = header_encoded\n            except Exception as e:\n                warnings.warn(\n                \"Attributes could not be written to the output HDF5 \"\n                \"file: {0}\".format(e))\n\n        else:\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 `{0}` of type {1} 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 .. import registry as io_registry\n    from ...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":24,"header":"def meta_path(path)","id":2586,"name":"meta_path","nodeType":"Function","startLoc":23,"text":"def meta_path(path):\n    return path + '.' + META_KEY"},{"col":0,"comment":"\n    Find all structured arrays in an HDF5 file\n    ","endLoc":38,"header":"def _find_all_structured_arrays(handle)","id":2587,"name":"_find_all_structured_arrays","nodeType":"Function","startLoc":27,"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"},{"col":4,"comment":"null","endLoc":700,"header":"@classmethod\n    def match_header(cls, header)","id":2588,"name":"match_header","nodeType":"Function","startLoc":674,"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":1406,"header":"@lazyproperty\n    def data(self)","id":2589,"name":"data","nodeType":"Function","startLoc":1365,"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 explcitly 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":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":1883,"header":"def _dtype_for_bitpix(self)","id":2590,"name":"_dtype_for_bitpix","nodeType":"Function","startLoc":1864,"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":"\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":651,"header":"def get_gcrs_posvel(self, obstime)","id":2591,"name":"get_gcrs_posvel","nodeType":"Function","startLoc":630,"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        # GCRS position\n        gcrs_data = self._get_gcrs(obstime).data\n        obsgeopos = gcrs_data.without_differentials()\n        obsgeovel = gcrs_data.differentials['s'].to_cartesian()\n        return obsgeopos, obsgeovel"},{"col":4,"comment":"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the Sun,\n        Jupiter, the Moon, and the Earth itself.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\n\n        Returns\n        --------\n        redshift :  `~astropy.units.Quantity`\n            Gravitational redshift in velocity units at given obstime.\n        ","endLoc":682,"header":"def _gravitational_redshift(self, obstime)","id":2592,"name":"_gravitational_redshift","nodeType":"Function","startLoc":653,"text":"def _gravitational_redshift(self, obstime):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the Sun,\n        Jupiter, the Moon, and the Earth itself.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\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        names = ('sun', 'jupiter', 'moon', 'earth')\n        GM_moon = consts.G * 7.34767309e22*u.kg\n        masses = (consts.GM_sun, consts.GM_jup, GM_moon, consts.GM_earth)\n        positions = [get_body_barycentric(name, obstime) for name in names]\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(masses, distances)]\n        return sum(redshifts)"},{"col":0,"comment":"This is the main function called by the `fitsheader` script.","endLoc":327,"header":"def main(args=None)","id":2593,"name":"main","nodeType":"Function","startLoc":278,"text":"def main(args=None):\n    \"\"\"This is the main function called by the `fitsheader` script.\"\"\"\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description=('Print the header(s) of a FITS file. '\n                     'Optional arguments allow the desired extension(s), '\n                     'keyword(s), and output format to be specified. '\n                     'Note that in the case of a compressed image, '\n                     'the decompressed header is shown by default.'))\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='append', 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('-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        else:\n            print_headers_traditional(args)\n    except OSError as e:\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"},{"col":4,"comment":"null","endLoc":1906,"header":"def _update_header_scale_info(self, dtype=None)","id":2594,"name":"_update_header_scale_info","nodeType":"Function","startLoc":1885,"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":0,"comment":"Calculate the barycentric position 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\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    ","endLoc":364,"header":"def get_body_barycentric(body, time, ephemeris=None)","id":2595,"name":"get_body_barycentric","nodeType":"Function","startLoc":336,"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 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\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    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris,\n                                        get_velocity=False)"},{"col":4,"comment":"null","endLoc":1414,"header":"@data.setter\n    def data(self, data)","id":2596,"name":"data","nodeType":"Function","startLoc":1408,"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":4,"comment":"null","endLoc":1433,"header":"@lazyproperty\n    def compressed_data(self)","id":2597,"name":"compressed_data","nodeType":"Function","startLoc":1416,"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":0,"comment":"null","endLoc":58,"header":"def is_hdf5(origin, filepath, fileobj, *args, **kwargs)","id":2598,"name":"is_hdf5","nodeType":"Function","startLoc":41,"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.highlevel.File, h5py.highlevel.Group, h5py.highlevel.Dataset))"},{"col":4,"comment":"\n        Compress the image data so that it may be written to a file.\n        ","endLoc":1683,"header":"def _update_compressed_data(self)","id":2599,"name":"_update_compressed_data","nodeType":"Function","startLoc":1616,"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_unsigned(self.data.dtype):\n            # Convert the unsigned array to signed\n            self.data = np.array(\n                self.data - _unsigned_zero(self.data.dtype),\n                dtype='=i{}'.format(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            # 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":"","endLoc":44,"header":"fitsheader.py#<anonymous>","id":2600,"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\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\"\"\""},{"id":2601,"name":"astropy/io/misc/asdf","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/io/misc/asdf","id":2602,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license\nimport os\n\ndef get_package_data():\n    # Installs the schema files\n    schemas = []\n    root = os.path.join(os.path.dirname(__file__), 'schemas')\n    for node, dirs, files in os.walk(root):\n        for fname in files:\n            if fname.endswith('.yaml'):\n                schemas.append(\n                    os.path.relpath(os.path.join(node, fname), root))\n\n    # In the package directory, install to the subdirectory 'schemas'\n    schemas = [os.path.join('schemas', s) for s in schemas]\n\n    return {'astropy.io.misc.asdf': schemas}\n"},{"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    ","endLoc":182,"header":"def read_table_hdf5(input, path=None)","id":2603,"name":"read_table_hdf5","nodeType":"Function","startLoc":61,"text":"def read_table_hdf5(input, path=None):\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    \"\"\"\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.highlevel.File, h5py.highlevel.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(\"Path {0} does not exist\".format(path))\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.highlevel.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(\"no table found in HDF5 group {0}\".\n                                 format(path))\n            elif len(arrays) > 0:\n                path = arrays[0] if path is None else path + '/' + arrays[0]\n                warnings.warn(\"path= was not specified but multiple tables\"\n                              \" are present, reading in first available\"\n                              \" table (path={0})\".format(path),\n                              AstropyUserWarning)\n                return read_table_hdf5(input, path=path)\n\n    elif not isinstance(input, h5py.highlevel.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)\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 ...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        elif old_version_meta:\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    return table"},{"col":0,"comment":"null","endLoc":17,"header":"def get_package_data()","id":2604,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    # Installs the schema files\n    schemas = []\n    root = os.path.join(os.path.dirname(__file__), 'schemas')\n    for node, dirs, files in os.walk(root):\n        for fname in files:\n            if fname.endswith('.yaml'):\n                schemas.append(\n                    os.path.relpath(os.path.join(node, fname), root))\n\n    # In the package directory, install to the subdirectory 'schemas'\n    schemas = [os.path.join('schemas', s) for s in schemas]\n\n    return {'astropy.io.misc.asdf': schemas}"},{"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    No velocity can be calculated with the built-in ephemeris for the Moon.\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":295,"header":"def _get_body_barycentric_posvel(body, time, ephemeris=None,\n                                 get_velocity=True)","id":2605,"name":"_get_body_barycentric_posvel","nodeType":"Function","startLoc":175,"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    No velocity can be calculated with the built-in ephemeris for the Moon.\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\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n        if ephemeris 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            if get_velocity:\n                raise KeyError(\"the Moon's velocity cannot be calculated with \"\n                               \"the '{0}' ephemeris.\".format(ephemeris))\n            return calc_moon(time).cartesian\n\n        else:\n            sun_pv_bary = 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(\"{0}'s position and velocity cannot be \"\n                                   \"calculated with the '{1}' ephemeris.\"\n                                   .format(body, ephemeris))\n                body_pv_helio = erfa.plan94(jd1, jd2, body_index)\n                body_pv_bary = body_pv_helio + sun_pv_bary\n\n        body_pos_bary = CartesianRepresentation(\n            body_pv_bary[..., 0, :], unit=u.au, xyz_axis=-1, copy=False)\n        if get_velocity:\n            body_vel_bary = CartesianRepresentation(\n                body_pv_bary[..., 1, :], 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(\"{0}'s position cannot be calculated with \"\n                               \"the {1} 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"},{"col":4,"comment":"\n        Get the current science state value.\n        ","endLoc":40,"header":"@classmethod\n    def get(cls)","id":2606,"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)"},{"col":4,"comment":"null","endLoc":1754,"header":"def __init__(self, left, right, op=None)","id":2607,"name":"__init__","nodeType":"Function","startLoc":1748,"text":"def __init__(self, left, right, op=None):\n        op_string = '' if op is None else ' for {0}'.format(op)\n        super().__init__(\n            \"Unsupported operand type(s){0}: \"\n            \"'{1}' and '{2}'\".format(op_string,\n                                     left.__class__.__name__,\n                                     right.__class__.__name__))"},{"col":0,"comment":"\n    Try importing jplephem, download/retrieve from cache the Satellite Planet\n    Kernel corresponding to the given ephemeris.\n    ","endLoc":172,"header":"def _get_kernel(value)","id":2608,"name":"_get_kernel","nodeType":"Function","startLoc":144,"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    if value.lower() == 'jpl':\n        value = DEFAULT_JPL_EPHEMERIS\n\n    if value.lower() in ('de430', 'de432s'):\n        value = ('http://naif.jpl.nasa.gov/pub/naif/generic_kernels'\n                 '/spk/planets/{:s}.bsp'.format(value.lower()))\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 URL'.format(value))\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.python.org/pypi/jplephem)\")\n\n    return SPK.open(download_file(value, cache=True))"},{"fileName":"extension.py","filePath":"astropy/io/misc/asdf","id":2609,"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.resolver import Resolver, DEFAULT_URL_MAPPING\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.coords.coords import *\nfrom .tags.fits.fits import *\nfrom .tags.table.table import *\nfrom .tags.time.time import *\nfrom .tags.transform.basic import *\nfrom .tags.transform.compound import *\nfrom .tags.transform.polynomial import *\nfrom .tags.transform.projections import *\nfrom .tags.transform.tabular import *\nfrom .tags.unit.quantity import *\nfrom .tags.unit.unit import *\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__), '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"},{"col":4,"comment":"null","endLoc":1453,"header":"@compressed_data.deleter\n    def compressed_data(self)","id":2610,"name":"compressed_data","nodeType":"Function","startLoc":1435,"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":1462,"header":"@property\n    def shape(self)","id":2611,"name":"shape","nodeType":"Function","startLoc":1455,"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":1582,"header":"@lazyproperty\n    def header(self)","id":2612,"name":"header","nodeType":"Function","startLoc":1464,"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        # 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 self._header and\n                self._header['EXTNAME'] == 'COMPRESSED_IMAGE'):\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":0,"comment":"null","endLoc":12,"id":2613,"name":"_astropy_types","nodeType":"Attribute","startLoc":12,"text":"_astropy_types"},{"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":115,"header":"def get_jd12(time, scale)","id":2614,"name":"get_jd12","nodeType":"Function","startLoc":90,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":2615,"name":"_astropy_asdf_types","nodeType":"Attribute","startLoc":13,"text":"_astropy_asdf_types"},{"className":"AstropyExtension","col":0,"comment":"null","endLoc":55,"id":2616,"nodeType":"Class","startLoc":43,"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"},{"col":4,"comment":"null","endLoc":1637,"header":"def __sub__(self, other)","id":2617,"name":"__sub__","nodeType":"Function","startLoc":1607,"text":"def __sub__(self, other):\n        # only deal with TimeDelta - TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                raise OperandTypeError(self, other, '-')\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot subtract TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 - other._time.jd1\n        jd2 = self._time.jd2 - other._time.jd2\n\n        out._time.jd1, out._time.jd2 = day_frac(jd1, jd2)\n\n        return out"},{"col":0,"comment":"\n    Generate a warning for an IERSRangeerror\n\n    Parameters\n    ----------\n    ierserr : An `~astropy.utils.iers.IERSRangeError`\n    ","endLoc":74,"header":"def _warn_iers(ierserr)","id":2618,"name":"_warn_iers","nodeType":"Function","startLoc":65,"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":4,"comment":"Calculate a sidereal time using a IAU precession/nutation model.","endLoc":773,"header":"def _erfa_sidereal_time(self, model)","id":2619,"name":"_erfa_sidereal_time","nodeType":"Function","startLoc":761,"text":"def _erfa_sidereal_time(self, model):\n        \"\"\"Calculate a sidereal time using a IAU precession/nutation model.\"\"\"\n\n        from ..coordinates import Longitude\n\n        erfa_function = model['function']\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in model['scales']\n                           for jd_part in ('jd1', 'jd2')]\n\n        sidereal_time = erfa_function(*erfa_parameters)\n\n        return Longitude(sidereal_time, u.radian).to(u.hourangle)"},{"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":245,"header":"def calc_moon(t)","id":2620,"name":"calc_moon","nodeType":"Function","startLoc":174,"text":"def 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                                          equinox=t)\n\n    return SkyCoord(ecliptic_coo.transform_to(ICRS))"},{"col":4,"comment":"null","endLoc":46,"header":"@property\n    def types(self)","id":2621,"name":"types","nodeType":"Function","startLoc":44,"text":"@property\n    def types(self):\n        return _astropy_types"},{"col":4,"comment":"null","endLoc":51,"header":"@property\n    def tag_mapping(self)","id":2622,"name":"tag_mapping","nodeType":"Function","startLoc":48,"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":55,"header":"@property\n    def url_mapping(self)","id":2623,"name":"url_mapping","nodeType":"Function","startLoc":53,"text":"@property\n    def url_mapping(self):\n        return ASTROPY_URL_MAPPING"},{"className":"AstropyAsdfExtension","col":0,"comment":"null","endLoc":63,"id":2624,"nodeType":"Class","startLoc":60,"text":"class AstropyAsdfExtension(BuiltinExtension):\n    @property\n    def types(self):\n        return _astropy_asdf_types"},{"col":4,"comment":"null","endLoc":63,"header":"@property\n    def types(self)","id":2625,"name":"types","nodeType":"Function","startLoc":61,"text":"@property\n    def types(self):\n        return _astropy_asdf_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":2626,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":2627,"name":"ASTROPY_SCHEMA_URI_BASE","nodeType":"Attribute","startLoc":31,"text":"ASTROPY_SCHEMA_URI_BASE"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":2628,"name":"SCHEMA_PATH","nodeType":"Attribute","startLoc":32,"text":"SCHEMA_PATH"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":2629,"name":"ASTROPY_URL_MAPPING","nodeType":"Attribute","startLoc":34,"text":"ASTROPY_URL_MAPPING"},{"col":0,"comment":"","endLoc":4,"header":"extension.py#<anonymous>","id":2630,"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__), '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')]"},{"fileName":"types.py","filePath":"astropy/io/misc/asdf","id":2631,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport six\n\nfrom asdf.asdftypes import CustomType, ExtensionTypeMeta\n\n\n__all__ = ['AstropyType', 'AstropyAsdfType']\n\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(AstropyTypeMeta, mcls).__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\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\n@six.add_metaclass(AstropyTypeMeta)\nclass AstropyType(CustomType):\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\n@six.add_metaclass(AstropyTypeMeta)\nclass AstropyAsdfType(CustomType):\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"},{"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":30,"id":2632,"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(AstropyTypeMeta, mcls).__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\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":4,"comment":"null","endLoc":30,"header":"def __new__(mcls, name, bases, attrs)","id":2633,"name":"__new__","nodeType":"Function","startLoc":21,"text":"def __new__(mcls, name, bases, attrs):\n        cls = super(AstropyTypeMeta, mcls).__new__(mcls, name, bases, attrs)\n        # Classes using this metaclass are automatically added to the list of\n        # astropy extensions\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":4,"comment":"Negation of a `TimeDelta` object.","endLoc":1644,"header":"def __neg__(self)","id":2634,"name":"__neg__","nodeType":"Function","startLoc":1639,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":22,"id":2635,"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":2636,"nodeType":"Class","startLoc":33,"text":"@six.add_metaclass(AstropyTypeMeta)\nclass AstropyType(CustomType):\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":2637,"name":"organization","nodeType":"Attribute","startLoc":42,"text":"organization"},{"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":798,"header":"def copy(self, format=None)","id":2638,"name":"copy","nodeType":"Function","startLoc":775,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":2639,"name":"standard","nodeType":"Attribute","startLoc":43,"text":"standard"},{"col":4,"comment":"\n        Summarize the HDU: name, dimensions, and formats.\n        ","endLoc":1614,"header":"def _summary(self)","id":2640,"name":"_summary","nodeType":"Function","startLoc":1584,"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)"},{"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":56,"id":2641,"nodeType":"Class","startLoc":46,"text":"@six.add_metaclass(AstropyTypeMeta)\nclass AstropyAsdfType(CustomType):\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":55,"id":2642,"name":"organization","nodeType":"Attribute","startLoc":55,"text":"organization"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":2643,"name":"standard","nodeType":"Attribute","startLoc":56,"text":"standard"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":2644,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"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":343,"header":"def get_header_from_yaml(lines)","id":2645,"name":"get_header_from_yaml","nodeType":"Function","startLoc":298,"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\n    try:\n        import yaml\n    except ImportError:\n        raise ImportError('`import yaml` failed, PyYAML package '\n                          'is required for serializing mixin columns')\n\n    from ..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(u'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(str(err))\n\n    return header"},{"col":0,"comment":"","endLoc":4,"header":"types.py#<anonymous>","id":2646,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AstropyType', 'AstropyAsdfType']\n\n_astropy_types = set()\n\n_astropy_asdf_types = set()"},{"col":4,"comment":"Absolute value of a `TimeDelta` object.","endLoc":1653,"header":"def __abs__(self)","id":2647,"name":"__abs__","nodeType":"Function","startLoc":1646,"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"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf","id":2648,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\"\"\"\nThe **asdf** subpackage contains code that is used to serialize astropy types\nso that they can be represented and stored using the Advanced Scientific Data\nFormat (ASDF). This subpackage defines classes, referred to as **tags**, that\nimplement the logic for serialization and deserialization.\n\nASDF makes use of abstract data type definitons called **schemas**. The tags\nprovided here are simply specific implementations of particular schemas.\nCurrently astropy only implements tags for a subset of schemas that are defined\nexternally by the ASDF Standard. However, it is likely that astropy will\neventually define schemas of its own.\n\nAstropy currently has no ability to read or write ASDF files itself. In order\nto process ASDF files it is necessary to make use of the standalone **asdf**\npackage. Users should never need to refer to tag implementations directly.\nTheir presence should be entirely transparent when processing ASDF files.\n\nIf both **asdf** and **astropy** are installed, no futher configuration is\nrequired in order to process ASDF files. The **asdf** package has been designed\nto automatically detect the presence of the tags defined by **astropy**.\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>`__.\n\"\"\"\n"},{"col":0,"comment":"","endLoc":27,"header":"__init__.py#<anonymous>","id":2649,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThe **asdf** subpackage contains code that is used to serialize astropy types\nso that they can be represented and stored using the Advanced Scientific Data\nFormat (ASDF). This subpackage defines classes, referred to as **tags**, that\nimplement the logic for serialization and deserialization.\n\nASDF makes use of abstract data type definitons called **schemas**. The tags\nprovided here are simply specific implementations of particular schemas.\nCurrently astropy only implements tags for a subset of schemas that are defined\nexternally by the ASDF Standard. However, it is likely that astropy will\neventually define schemas of its own.\n\nAstropy currently has no ability to read or write ASDF files itself. In order\nto process ASDF files it is necessary to make use of the standalone **asdf**\npackage. Users should never need to refer to tag implementations directly.\nTheir presence should be entirely transparent when processing ASDF files.\n\nIf both **asdf** and **astropy** are installed, no futher configuration is\nrequired in order to process ASDF files. The **asdf** package has been designed\nto automatically detect the presence of the tags defined by **astropy**.\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>`__.\n\"\"\""},{"id":2650,"name":"astropy/io/misc/asdf/tags","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags","id":2651,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"id":2652,"name":"astropy/io/misc/asdf/tags/fits","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/io/misc/asdf/tags/fits","id":2653,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\ndef get_package_data():  # pragma: no cover\n    return {\n        str('astropy.io.misc.asdf.tags.fits.tests'): ['data/*.fits']\n    }\n"},{"col":0,"comment":"null","endLoc":7,"header":"def get_package_data()","id":2654,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():  # pragma: no cover\n    return {\n        str('astropy.io.misc.asdf.tags.fits.tests'): ['data/*.fits']\n    }"},{"col":4,"comment":"Multiplication of `TimeDelta` objects by numbers/arrays.","endLoc":1678,"header":"def __mul__(self, other)","id":2655,"name":"__mul__","nodeType":"Function","startLoc":1655,"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\n        try:   # convert to straight float if dimensionless quantity\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:\n            jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                raise err\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out"},{"fileName":"fits.py","filePath":"astropy/io/misc/asdf/tags/fits","id":2656,"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 import yamlutil\n\nfrom astropy import table\nfrom astropy.io import fits\nfrom ...types import AstropyAsdfType\n\n\nclass FitsType(AstropyAsdfType):\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'] = yamlutil.custom_tree_to_tagged_tree(data, ctx)\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"},{"className":"FitsType","col":0,"comment":"null","endLoc":84,"id":2657,"nodeType":"Class","startLoc":14,"text":"class FitsType(AstropyAsdfType):\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'] = yamlutil.custom_tree_to_tagged_tree(data, ctx)\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":40,"header":"@classmethod\n    def from_tree(cls, data, ctx)","id":2658,"name":"from_tree","nodeType":"Function","startLoc":19,"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"},{"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":1791,"header":"def scale(self, type=None, option='old', bscale=1, bzero=0)","id":2659,"name":"scale","nodeType":"Function","startLoc":1685,"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":1719,"header":"def to(self, *args, **kwargs)","id":2660,"name":"to","nodeType":"Function","startLoc":1717,"text":"def to(self, *args, **kwargs):\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(*args, **kwargs)"},{"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":932,"header":"def __copy__(self)","id":2661,"name":"__copy__","nodeType":"Function","startLoc":926,"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":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":940,"header":"def __deepcopy__(self, memo)","id":2662,"name":"__deepcopy__","nodeType":"Function","startLoc":934,"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":983,"header":"def _advanced_index(self, indices, axis=None, keepdims=False)","id":2663,"name":"_advanced_index","nodeType":"Function","startLoc":942,"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        return [(indices if i == axis else np.arange(s).reshape(\n            (1,)*(i if keepdims or i < axis else i-1) + (s,) +\n            (1,)*(ndim-i-(1 if keepdims or i > axis else 2))))\n                for i, s in enumerate(self.shape)]"},{"col":4,"comment":"Multiplication of numbers/arrays with `TimeDelta` objects.","endLoc":1682,"header":"def __rmul__(self, other)","id":2664,"name":"__rmul__","nodeType":"Function","startLoc":1680,"text":"def __rmul__(self, other):\n        \"\"\"Multiplication of numbers/arrays with `TimeDelta` objects.\"\"\"\n        return self.__mul__(other)"},{"col":4,"comment":"Division of `TimeDelta` objects by numbers/arrays.","endLoc":1686,"header":"def __div__(self, other)","id":2665,"name":"__div__","nodeType":"Function","startLoc":1684,"text":"def __div__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        return self.__truediv__(other)"},{"col":4,"comment":"Division of `TimeDelta` objects by numbers/arrays.","endLoc":1711,"header":"def __truediv__(self, other)","id":2666,"name":"__truediv__","nodeType":"Function","startLoc":1692,"text":"def __truediv__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        # cannot do __mul__(1./other) as that looses precision\n        try:\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:   # convert to straight float if dimensionless quantity\n            jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                raise err\n\n        if self.format != 'jd':\n            out = out.replicate(format=self.format)\n        return out"},{"col":4,"comment":"Division by `TimeDelta` objects of numbers/arrays.","endLoc":1690,"header":"def __rdiv__(self, other)","id":2667,"name":"__rdiv__","nodeType":"Function","startLoc":1688,"text":"def __rdiv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        return self.__rtruediv__(other)"},{"col":4,"comment":"null","endLoc":1826,"header":"def _prewriteto(self, checksum=False, inplace=False)","id":2668,"name":"_prewriteto","nodeType":"Function","startLoc":1793,"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_uint_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":4,"comment":"Division by `TimeDelta` objects of numbers/arrays.","endLoc":1715,"header":"def __rtruediv__(self, other)","id":2669,"name":"__rtruediv__","nodeType":"Function","startLoc":1713,"text":"def __rtruediv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        return other / self.to(u.day)"},{"col":0,"comment":"null","endLoc":217,"header":"def _construct_mixins_from_columns(tbl)","id":2670,"name":"_construct_mixins_from_columns","nodeType":"Function","startLoc":195,"text":"def _construct_mixins_from_columns(tbl):\n    if '__serialized_columns__' not in tbl.meta:\n        return tbl\n\n    # Don't know final output class but assume QTable so no columns get\n    # downgraded.\n    out = QTable(tbl, copy=False)\n\n    mixin_cols = out.meta.pop('__serialized_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    if not has_quantities:\n        out = Table(out, copy=False)\n\n    return out"},{"attributeType":"null","col":4,"comment":"List of time delta scales.","endLoc":1516,"id":2671,"name":"SCALES","nodeType":"Attribute","startLoc":1516,"text":"SCALES"},{"attributeType":"null","col":4,"comment":"Dict of time delta formats.","endLoc":1519,"id":2672,"name":"FORMATS","nodeType":"Attribute","startLoc":1519,"text":"FORMATS"},{"attributeType":"null","col":4,"comment":"null","endLoc":1522,"id":2673,"name":"info","nodeType":"Attribute","startLoc":1522,"text":"info"},{"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":1005,"header":"def argmin(self, axis=None, out=None)","id":2674,"name":"argmin","nodeType":"Function","startLoc":985,"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        jd = self.jd1 + self.jd2\n        approx = jd.min(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 = (self.jd1 - approx) + self.jd2\n        return dt.argmin(axis, out)"},{"attributeType":"null","col":16,"comment":"null","endLoc":1543,"id":2675,"name":"SCALES","nodeType":"Attribute","startLoc":1543,"text":"self.SCALES"},{"attributeType":"null","col":12,"comment":"null","endLoc":1570,"id":2676,"name":"_time","nodeType":"Attribute","startLoc":1570,"text":"self._time"},{"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":1019,"header":"def argmax(self, axis=None, out=None)","id":2677,"name":"argmax","nodeType":"Function","startLoc":1007,"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        jd = self.jd1 + self.jd2\n        approx = jd.max(axis, keepdims=True)\n\n        dt = (self.jd1 - approx) + self.jd2\n        return dt.argmax(axis, out)"},{"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":1835,"header":"def _writeheader(self, fileobj)","id":2678,"name":"_writeheader","nodeType":"Function","startLoc":1828,"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":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":1034,"header":"def argsort(self, axis=-1)","id":2679,"name":"argsort","nodeType":"Function","startLoc":1021,"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        jd_approx = self.jd\n        jd_remainder = (self - self.__class__(jd_approx, format='jd')).jd\n        if axis is None:\n            return np.lexsort((jd_remainder.ravel(), jd_approx.ravel()))\n        else:\n            return np.lexsort(keys=(jd_remainder, jd_approx), axis=axis)"},{"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":1851,"header":"def _writedata(self, fileobj)","id":2680,"name":"_writedata","nodeType":"Function","startLoc":1837,"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":1859,"header":"def _close(self, closed=True)","id":2681,"name":"_close","nodeType":"Function","startLoc":1853,"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"},{"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":1050,"header":"def min(self, axis=None, out=None, keepdims=False)","id":2682,"name":"min","nodeType":"Function","startLoc":1036,"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":4,"comment":"null","endLoc":381,"id":2683,"name":"DEPRECATED_KWARGS","nodeType":"Attribute","startLoc":381,"text":"DEPRECATED_KWARGS"},{"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":387,"id":2684,"name":"_manages_own_heap","nodeType":"Attribute","startLoc":387,"text":"_manages_own_heap"},{"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":32,"id":2685,"nodeType":"Class","startLoc":23,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":642,"id":2686,"name":"data","nodeType":"Attribute","startLoc":642,"text":"self.data"},{"col":0,"comment":"null","endLoc":192,"header":"def _construct_mixin_from_columns(new_name, obj_attrs, out)","id":2687,"name":"_construct_mixin_from_columns","nodeType":"Function","startLoc":153,"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                _construct_mixin_from_columns(name, val, out)\n                data_attrs_map[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        col = out[name]\n        obj_attrs[data_attr] = col\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.\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)"},{"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    <http://pyyaml.org/wiki/PyYAMLDocumentation>`_ for details of the\n    class signature.\n    ","endLoc":221,"id":2688,"nodeType":"Class","startLoc":205,"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    <http://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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":654,"id":2689,"name":"_do_not_scale_image_data","nodeType":"Attribute","startLoc":654,"text":"self._do_not_scale_image_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":767,"id":2690,"name":"_image_header","nodeType":"Attribute","startLoc":767,"text":"self._image_header"},{"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":1066,"header":"def max(self, axis=None, out=None, keepdims=False)","id":2691,"name":"max","nodeType":"Function","startLoc":1052,"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":8,"comment":"null","endLoc":671,"id":2692,"name":"_orig_bscale","nodeType":"Attribute","startLoc":671,"text":"self._orig_bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":1127,"id":2693,"name":"columns","nodeType":"Attribute","startLoc":1127,"text":"self.columns"},{"attributeType":"null","col":8,"comment":"null","endLoc":655,"id":2694,"name":"_uint","nodeType":"Attribute","startLoc":655,"text":"self._uint"},{"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":1083,"header":"def ptp(self, axis=None, out=None, keepdims=False)","id":2695,"name":"ptp","nodeType":"Function","startLoc":1068,"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":22,"comment":"null","endLoc":1668,"id":2696,"name":"compressed_data","nodeType":"Attribute","startLoc":1668,"text":"self.compressed_data"},{"attributeType":"null","col":12,"comment":"null","endLoc":667,"id":2697,"name":"_bscale","nodeType":"Attribute","startLoc":667,"text":"self._bscale"},{"attributeType":"null","col":8,"comment":"null","endLoc":658,"id":2698,"name":"_axes","nodeType":"Attribute","startLoc":658,"text":"self._axes"},{"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":1100,"header":"def sort(self, axis=-1)","id":2699,"name":"sort","nodeType":"Function","startLoc":1085,"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)]"},{"col":4,"comment":"null","endLoc":218,"header":"def _construct_python_tuple(self, node)","id":2700,"name":"_construct_python_tuple","nodeType":"Function","startLoc":217,"text":"def _construct_python_tuple(self, node):\n        return tuple(self.construct_sequence(node))"},{"attributeType":"null","col":8,"comment":"null","endLoc":670,"id":2701,"name":"_orig_bzero","nodeType":"Attribute","startLoc":670,"text":"self._orig_bzero"},{"attributeType":"null","col":8,"comment":"null","endLoc":672,"id":2702,"name":"_orig_bitpix","nodeType":"Attribute","startLoc":672,"text":"self._orig_bitpix"},{"col":4,"comment":"null","endLoc":231,"header":"def __init__(self, *args, copy=True, **kwargs)","id":2703,"name":"__init__","nodeType":"Function","startLoc":198,"text":"def __init__(self, *args, copy=True, **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        kwargs = self._parse_inputs(args, kwargs)\n\n        frame = kwargs['frame']\n        frame_attr_names = frame.get_frame_attr_names()\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        for attr in kwargs:\n            if (attr not in frame_attr_names and\n                attr in frame_transform_graph.frame_attributes):\n                # Setting it will also validate it.\n                setattr(self, attr, kwargs[attr])\n\n        coord_kwargs = {}\n        if 'representation' in kwargs:\n            coord_kwargs['representation'] = _get_repr_cls(kwargs['representation'])\n        for attr, value in kwargs.items():\n            if value is not None and (attr in frame.representation_component_names\n                                      or attr in frame.get_frame_attr_names()):\n                coord_kwargs[attr] = value\n\n        # Finally make the internal coordinate object.\n        self._sky_coord_frame = frame.__class__(copy=copy, **coord_kwargs)\n\n        if not self._sky_coord_frame.has_data:\n            raise ValueError('Cannot create a SkyCoord without data')"},{"col":4,"comment":"\n        Return the cache associated with this instance.\n        ","endLoc":1107,"header":"@lazyproperty\n    def cache(self)","id":2704,"name":"cache","nodeType":"Function","startLoc":1102,"text":"@lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)"},{"col":4,"comment":"\n        Get dynamic attributes to output format or do timescale conversion.\n        ","endLoc":1147,"header":"def __getattr__(self, attr)","id":2705,"name":"__getattr__","nodeType":"Function","startLoc":1109,"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                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            cache = self.cache['format']\n            if attr not in cache:\n                if attr == self.format:\n                    tm = self\n                else:\n                    tm = self.replicate(format=attr)\n                value = tm._shaped_like_input(tm._time.to_value(parent=tm))\n                cache[attr] = value\n            return cache[attr]\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 {0} with scale \"\n                                      \"'{1}' to scale '{2}'\"\n                                      .format(self.__class__.__name__,\n                                              self.scale, attr))\n\n        else:\n            # Should raise AttributeError\n            return self.__getattribute__(attr)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1657,"id":2706,"name":"_theap","nodeType":"Attribute","startLoc":1657,"text":"self._theap"},{"attributeType":"null","col":12,"comment":"null","endLoc":666,"id":2707,"name":"_bzero","nodeType":"Attribute","startLoc":666,"text":"self._bzero"},{"attributeType":"null","col":8,"comment":"null","endLoc":656,"id":2708,"name":"_scale_back","nodeType":"Attribute","startLoc":656,"text":"self._scale_back"},{"col":42,"endLoc":182,"id":2709,"nodeType":"Lambda","startLoc":182,"text":"lambda x: x not in (None, '')"},{"col":44,"endLoc":183,"id":2710,"nodeType":"Lambda","startLoc":183,"text":"lambda x: x is not None"},{"col":49,"endLoc":184,"id":2711,"nodeType":"Lambda","startLoc":184,"text":"lambda x: x is not None"},{"col":42,"endLoc":185,"id":2712,"nodeType":"Lambda","startLoc":185,"text":"lambda x: x"},{"col":0,"comment":"null","endLoc":150,"header":"def _construct_mixin_from_obj_attrs_and_info(obj_attrs, info)","id":2713,"name":"_construct_mixin_from_obj_attrs_and_info","nodeType":"Function","startLoc":131,"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('unsupported class for construct {}'.format(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"},{"attributeType":"null","col":12,"comment":"null","endLoc":1819,"id":2714,"name":"_imagedata","nodeType":"Attribute","startLoc":1819,"text":"self._imagedata"},{"attributeType":"null","col":12,"comment":"null","endLoc":799,"id":2715,"name":"name","nodeType":"Attribute","startLoc":799,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":2716,"name":"_bitpix","nodeType":"Attribute","startLoc":668,"text":"self._bitpix"},{"col":4,"comment":"null","endLoc":221,"header":"def _construct_python_unicode(self, node)","id":2717,"name":"_construct_python_unicode","nodeType":"Function","startLoc":220,"text":"def _construct_python_unicode(self, node):\n        return self.construct_scalar(node)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":2718,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":2719,"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']"},{"col":4,"comment":"null","endLoc":1153,"header":"@override__dir__\n    def __dir__(self)","id":2720,"name":"__dir__","nodeType":"Function","startLoc":1149,"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":1171,"header":"def _match_shape(self, val)","id":2721,"name":"_match_shape","nodeType":"Function","startLoc":1155,"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"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/fits","id":2722,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"id":2723,"name":"astropy/io/misc/asdf/tags/fits/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/fits/tests","id":2724,"nodeType":"File","text":""},{"col":4,"comment":"Find UT1 - UTC differences by interpolating in IERS Table.\n\n        Parameters\n        ----------\n        iers_table : ``astropy.utils.iers.IERS`` table, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  If `None`, use default version (see\n            ``astropy.utils.iers``)\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)\n            >>> status == TIME_BEFORE_IERS_RANGE\n            array([ True, False]...)\n        ","endLoc":1218,"header":"def get_delta_ut1_utc(self, iers_table=None, return_status=False)","id":2725,"name":"get_delta_ut1_utc","nodeType":"Function","startLoc":1173,"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`` table, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  If `None`, use default version (see\n            ``astropy.utils.iers``)\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)\n            >>> status == TIME_BEFORE_IERS_RANGE\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from ..utils.iers import IERS\n            iers_table = IERS.open()\n\n        return iers_table.ut1_utc(self.utc, return_status=return_status)"},{"id":2726,"name":"astropy/io/misc/asdf/tags/time","nodeType":"Package"},{"fileName":"time.py","filePath":"astropy/io/misc/asdf/tags/time","id":2727,"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 import yamlutil\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 ...types import AstropyAsdfType\n\n\n_guessable_formats = set(['iso', 'byear', 'jyear', 'yday'])\n\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        format = node.format\n\n        if format == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif format == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif format in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        format = node.format\n\n        format = _astropy_format_to_asdf_format.get(format, format)\n\n        guessable_format = format in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format:\n            if node.isscalar:\n                return node.value\n            else:\n                return yamlutil.custom_tree_to_tagged_tree(\n                    node.value, ctx)\n\n        d = {'value': yamlutil.custom_tree_to_tagged_tree(node.value, ctx)}\n\n        if not guessable_format:\n            d['format'] = format\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'] = { 'x': x, 'y': y, 'z': z, 'unit': unit }\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': yamlutil.custom_tree_to_tagged_tree(x, ctx),\n                    'y': yamlutil.custom_tree_to_tagged_tree(y, ctx),\n                    'z': yamlutil.custom_tree_to_tagged_tree(z, ctx)\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            format = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if format not in _guessable_formats:\n                raise ValueError(\"Invalid time '{0}'\".format(node))\n            return t\n\n        value = node['value']\n        format = 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=format, 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"},{"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 <http://pyyaml.org/wiki/PyYAMLDocumentation>`_\n    for details of the class signature.\n    ","endLoc":248,"id":2728,"nodeType":"Class","startLoc":224,"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 <http://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    if YAML_LT_3_12:\n        # pre-3.12, ignore-aliases could not deal with ndarray, so we backport\n        # the more recent ignore_alises definition.\n        def ignore_aliases(self, data):\n            if data is None:\n                return True\n            if isinstance(data, tuple) and data == ():\n                return True\n            if isinstance(data, (str, bool, int, float)):\n                return True"},{"col":4,"comment":"null","endLoc":237,"header":"def _represent_tuple(self, data)","id":2729,"name":"_represent_tuple","nodeType":"Function","startLoc":236,"text":"def _represent_tuple(self, data):\n        return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)"},{"col":8,"comment":"null","endLoc":248,"header":"def ignore_aliases(self, data)","id":2730,"name":"ignore_aliases","nodeType":"Function","startLoc":242,"text":"def ignore_aliases(self, data):\n            if data is None:\n                return True\n            if isinstance(data, tuple) and data == ():\n                return True\n            if isinstance(data, (str, bool, int, float)):\n                return True"},{"col":0,"comment":"null","endLoc":94,"header":"def _unit_representer(dumper, obj)","id":2731,"name":"_unit_representer","nodeType":"Function","startLoc":92,"text":"def _unit_representer(dumper, obj):\n    out = {'unit': str(obj.to_string())}\n    return dumper.represent_mapping('!astropy.units.Unit', out)"},{"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":214,"header":"def _encode_mixins(tbl)","id":2732,"name":"_encode_mixins","nodeType":"Function","startLoc":185,"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 ...table import serialize\n    from ...table.table import has_info_class\n    from ... import units as u\n    from ...utils.data_info import MixinInfo, serialize_context_as\n\n    # If PyYAML is not available then check to see if there are any mixin cols\n    # that *require* YAML serialization.  HDF5 already has support for\n    # Quantity, so if those are the only mixins the proceed without doing the\n    # YAML bit, for backward compatibility (i.e. not requiring YAML to write\n    # Quantity).\n    try:\n        import yaml\n    except ImportError:\n        for col in tbl.itercols():\n            if (has_info_class(col, MixinInfo) and\n                    col.__class__ is not u.Quantity):\n                raise TypeError(\"cannot write type {} column '{}' \"\n                                \"to HDF5 without PyYAML installed.\"\n                                .format(col.__class__.__name__, col.info.name))\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"},{"className":"TimeType","col":0,"comment":"null","endLoc":131,"id":2733,"nodeType":"Class","startLoc":35,"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        format = node.format\n\n        if format == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif format == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif format in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        format = node.format\n\n        format = _astropy_format_to_asdf_format.get(format, format)\n\n        guessable_format = format in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format:\n            if node.isscalar:\n                return node.value\n            else:\n                return yamlutil.custom_tree_to_tagged_tree(\n                    node.value, ctx)\n\n        d = {'value': yamlutil.custom_tree_to_tagged_tree(node.value, ctx)}\n\n        if not guessable_format:\n            d['format'] = format\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'] = { 'x': x, 'y': y, 'z': z, 'unit': unit }\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': yamlutil.custom_tree_to_tagged_tree(x, ctx),\n                    'y': yamlutil.custom_tree_to_tagged_tree(y, ctx),\n                    'z': yamlutil.custom_tree_to_tagged_tree(z, ctx)\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            format = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if format not in _guessable_formats:\n                raise ValueError(\"Invalid time '{0}'\".format(node))\n            return t\n\n        value = node['value']\n        format = 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=format, 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)"},{"col":4,"comment":"null","endLoc":94,"header":"@classmethod\n    def to_tree(cls, node, ctx)","id":2734,"name":"to_tree","nodeType":"Function","startLoc":42,"text":"@classmethod\n    def to_tree(cls, node, ctx):\n        format = node.format\n\n        if format == 'byear':\n            node = time.Time(node, format='byear_str')\n\n        elif format == 'jyear':\n            node = time.Time(node, format='jyear_str')\n\n        elif format in ('fits', 'datetime', 'plot_date'):\n            node = time.Time(node, format='isot')\n\n        format = node.format\n\n        format = _astropy_format_to_asdf_format.get(format, format)\n\n        guessable_format = format in _guessable_formats\n\n        if node.scale == 'utc' and guessable_format:\n            if node.isscalar:\n                return node.value\n            else:\n                return yamlutil.custom_tree_to_tagged_tree(\n                    node.value, ctx)\n\n        d = {'value': yamlutil.custom_tree_to_tagged_tree(node.value, ctx)}\n\n        if not guessable_format:\n            d['format'] = format\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'] = { 'x': x, 'y': y, 'z': z, 'unit': unit }\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': yamlutil.custom_tree_to_tagged_tree(x, ctx),\n                    'y': yamlutil.custom_tree_to_tagged_tree(y, ctx),\n                    'z': yamlutil.custom_tree_to_tagged_tree(z, ctx)\n                }\n\n        return d"},{"col":0,"comment":"null","endLoc":99,"header":"def _unit_constructor(loader, node)","id":2735,"name":"_unit_constructor","nodeType":"Function","startLoc":97,"text":"def _unit_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return u.Unit(map['unit'])"},{"col":4,"comment":"null","endLoc":71,"header":"@classmethod\n    def to_tree(cls, hdulist, ctx)","id":2736,"name":"to_tree","nodeType":"Function","startLoc":42,"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'] = yamlutil.custom_tree_to_tagged_tree(data, ctx)\n\n            units.append(hdu_dict)\n\n        return units"},{"col":0,"comment":"null","endLoc":104,"header":"def _serialized_column_representer(dumper, obj)","id":2737,"name":"_serialized_column_representer","nodeType":"Function","startLoc":102,"text":"def _serialized_column_representer(dumper, obj):\n    out = dumper.represent_mapping('!astropy.table.SerializedColumn', obj)\n    return out"},{"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', 'ecsv', 'yaml'\n    ","endLoc":63,"header":"@contextmanager\ndef serialize_context_as(context)","id":2738,"name":"serialize_context_as","nodeType":"Function","startLoc":47,"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', 'ecsv', 'yaml'\n    \"\"\"\n    old_context = BaseColumnInfo._serialize_context\n    BaseColumnInfo._serialize_context = context\n    yield\n    BaseColumnInfo._serialize_context = old_context"},{"col":0,"comment":"\n    Convert any mixin columns to plain Column or MaskedColumn and\n    return a new table.  Exclude any mixin columns in ``exclude_classes``,\n    which must be a tuple of classes.\n    ","endLoc":128,"header":"def _represent_mixins_as_columns(tbl, exclude_classes=())","id":2739,"name":"_represent_mixins_as_columns","nodeType":"Function","startLoc":107,"text":"def _represent_mixins_as_columns(tbl, exclude_classes=()):\n    \"\"\"\n    Convert any mixin columns to plain Column or MaskedColumn and\n    return a new table.  Exclude any mixin columns in ``exclude_classes``,\n    which must be a tuple of classes.\n    \"\"\"\n    if not tbl.has_mixin_columns:\n        return tbl\n\n    mixin_cols = {}\n\n    new_cols = []\n\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    meta = deepcopy(tbl.meta)\n    meta['__serialized_columns__'] = mixin_cols\n    out = Table(new_cols, meta=meta, copy=False)\n\n    return out"},{"col":0,"comment":"null","endLoc":109,"header":"def _serialized_column_constructor(loader, node)","id":2740,"name":"_serialized_column_constructor","nodeType":"Function","startLoc":107,"text":"def _serialized_column_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    return SerializedColumn(map)"},{"col":0,"comment":"Convert a mixin column to a plain columns or a set of mixin columns.","endLoc":104,"header":"def _represent_mixin_as_column(col, name, new_cols, mixin_cols,\n                               exclude_classes=())","id":2741,"name":"_represent_mixin_as_column","nodeType":"Function","startLoc":35,"text":"def _represent_mixin_as_column(col, name, new_cols, mixin_cols,\n                               exclude_classes=()):\n    \"\"\"Convert a mixin column to a plain columns or a set of mixin columns.\"\"\"\n    # If not a mixin, or if class in ``exclude_classes`` tuple then\n    # treat as a normal column.  Excluded sub-classes must be explicitly\n    # specified.\n    if not has_info_class(col, MixinInfo) 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, xform in (('unit', lambda x: x not in (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            info[attr] = xform(col_attr) if xform else col_attr\n\n    obj_attrs = col.info._represent_as_dict()\n    ordered_keys = col.info._represent_as_dict_attrs\n\n    data_attrs = [key for key in ordered_keys if key in obj_attrs and\n                  getattr(obj_attrs[key], 'shape', ())[:1] == col.shape[:1]]\n\n    for data_attr in data_attrs:\n        data = obj_attrs[data_attr]\n        if len(data_attrs) == 1 and not has_info_class(data, MixinInfo):\n            # For one non-mixin attribute, we need only one serialized column.\n            # We can store info there, and keep the column name as is.\n            new_cols.append(Column(data, name=name, **info))\n            obj_attrs[data_attr] = SerializedColumn({'name': name})\n            # Remove attributes that are already on the serialized column.\n            for attr in info:\n                if attr in obj_attrs:\n                    del obj_attrs[attr]\n\n        else:\n            # New column name combines the old name and attribute\n            # (e.g. skycoord.ra, skycoord.dec).\n            new_name = name + '.' + data_attr\n            # TODO masking, MaskedColumn\n            if not has_info_class(data, MixinInfo):\n                new_cols.append(Column(data, name=new_name))\n                obj_attrs[data_attr] = SerializedColumn({'name': new_name})\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            for attr in col.info.attrs_from_parent:\n                if attr in info:\n                    del info[attr]\n\n            if info:\n                obj_attrs['__info__'] = info\n\n    # Store the fully qualified class name\n    obj_attrs['__class__'] = col.__module__ + '.' + col.__class__.__name__\n\n    mixin_cols[name] = obj_attrs"},{"col":0,"comment":"null","endLoc":114,"header":"def _time_representer(dumper, obj)","id":2742,"name":"_time_representer","nodeType":"Function","startLoc":112,"text":"def _time_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.Time', out)"},{"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        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":163,"header":"@classmethod\n    def open(cls, file=None, cache=False, **kwargs)","id":2743,"name":"open","nodeType":"Function","startLoc":122,"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        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            cls.iers_table = cls.read(**kwargs)\n        return cls.iers_table"},{"col":45,"endLoc":54,"id":2744,"nodeType":"Lambda","startLoc":54,"text":"lambda x: x not in (None, '')"},{"col":47,"endLoc":55,"id":2745,"nodeType":"Lambda","startLoc":55,"text":"lambda x: x is not None"},{"col":52,"endLoc":56,"id":2746,"nodeType":"Lambda","startLoc":56,"text":"lambda x: x is not None"},{"col":45,"endLoc":57,"id":2747,"nodeType":"Lambda","startLoc":57,"text":"lambda x: x"},{"col":0,"comment":"null","endLoc":120,"header":"def _time_constructor(loader, node)","id":2748,"name":"_time_constructor","nodeType":"Function","startLoc":117,"text":"def _time_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = Time.info._construct_from_dict(map)\n    return out"},{"col":4,"comment":"\n        Assemble a validated and sanitized keyword args dict for instantiating a\n        SkyCoord and coordinate object from the provided `args`, and `kwargs`.\n        ","endLoc":393,"header":"def _parse_inputs(self, args, kwargs)","id":2749,"name":"_parse_inputs","nodeType":"Function","startLoc":311,"text":"def _parse_inputs(self, args, kwargs):\n        \"\"\"\n        Assemble a validated and sanitized keyword args dict for instantiating a\n        SkyCoord and coordinate object from the provided `args`, and `kwargs`.\n        \"\"\"\n        valid_kwargs = {}\n\n        # Put the SkyCoord attributes like frame, equinox, obstime, location\n        # into valid_kwargs dict.  `Frame` could come from args or kwargs, so\n        # set valid_kwargs['frame'] accordingly.  The others must be specified\n        # by keyword args or else get a None default.  Pop them off of kwargs\n        # in the process.\n        frame = valid_kwargs['frame'] = _get_frame(args, kwargs)\n        if 'representation' in kwargs:\n            valid_kwargs['representation'] = _get_repr_cls(kwargs.pop('representation'))\n\n        for attr in frame_transform_graph.frame_attributes:\n            if attr in kwargs:\n                valid_kwargs[attr] = kwargs.pop(attr)\n\n        # Get units\n        units = _get_units(args, kwargs)\n\n        # Grab any frame-specific attr names like `ra` or `l` or `distance` from kwargs\n        # and migrate to valid_kwargs.\n        valid_kwargs.update(_get_representation_attrs(frame, units, kwargs))\n\n        # Error if anything is still left in kwargs\n        if kwargs:\n\n            # TODO: remove this when velocities are supported in SkyCoord\n            vel_url = 'http://docs.astropy.org/en/stable/coordinates/velocities.html'\n            for k in kwargs:\n                if k.startswith('pm_') or k == 'radial_velocity':\n                    raise ValueError('Velocity data is currently only supported'\n                                     ' in the coordinate frame objects, not in '\n                                     'SkyCoord. See the velocities '\n                                     'documentation page for more information: '\n                                     '{0}'.format(vel_url))\n\n            raise ValueError('Unrecognized keyword argument(s) {0}'\n                             .format(', '.join(\"'{0}'\".format(key) for key in kwargs)))\n\n        # Finally deal with the unnamed args.  This figures out what the arg[0] is\n        # and returns a dict with appropriate key/values for initializing frame class.\n        if args:\n            if len(args) == 1:\n                # One arg which must be a coordinate.  In this case\n                # coord_kwargs will contain keys like 'ra', 'dec', 'distance'\n                # along with any frame attributes like equinox or obstime which\n                # were explicitly specified in the coordinate object (i.e. non-default).\n                coord_kwargs = _parse_coordinate_arg(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                    self.info = args[0].info\n\n            elif len(args) <= 3:\n                frame_attr_names = frame.representation_component_names.keys()\n                repr_attr_names = frame.representation_component_names.values()\n                coord_kwargs = {}\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.attr_classes[repr_attr_name]\n                    coord_kwargs[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            # Copy the coord_kwargs into the final valid_kwargs dict.  For each\n            # of the coord_kwargs ensure that there is no conflict with a value\n            # specified by the user in the original kwargs.\n            for attr, coord_value in coord_kwargs.items():\n                if (attr in valid_kwargs\n                        and valid_kwargs[attr] is not None\n                        and np.any(valid_kwargs[attr] != coord_value)):\n                    raise ValueError(\"Coordinate attribute '{0}'={1!r} conflicts with \"\n                                     \"keyword argument '{0}'={2!r}\"\n                                     .format(attr, coord_value, valid_kwargs[attr]))\n                valid_kwargs[attr] = coord_value\n\n        return valid_kwargs"},{"col":0,"comment":"null","endLoc":125,"header":"def _timedelta_representer(dumper, obj)","id":2750,"name":"_timedelta_representer","nodeType":"Function","startLoc":123,"text":"def _timedelta_representer(dumper, obj):\n    out = obj.info._represent_as_dict()\n    return dumper.represent_mapping('!astropy.time.TimeDelta', out)"},{"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":78,"header":"def download_file(*args, **kwargs)","id":2751,"name":"download_file","nodeType":"Function","startLoc":70,"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    with utils.data.conf.set_temp('remote_timeout', conf.remote_timeout):\n        return utils.data.download_file(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":131,"header":"def _timedelta_constructor(loader, node)","id":2752,"name":"_timedelta_constructor","nodeType":"Function","startLoc":128,"text":"def _timedelta_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = TimeDelta.info._construct_from_dict(map)\n    return out"},{"col":0,"comment":"null","endLoc":151,"header":"def _ndarray_representer(dumper, obj)","id":2753,"name":"_ndarray_representer","nodeType":"Function","startLoc":134,"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.tostring())\n\n    out = dict(buffer=data_b64,\n               dtype=str(obj.dtype),\n               shape=obj.shape,\n               order=order)\n\n    return dumper.represent_mapping('!numpy.ndarray', out)"},{"col":0,"comment":"\n    Determine the coordinate frame from input SkyCoord args and kwargs.  This\n    modifies args and/or kwargs in-place to remove the item that provided\n    `frame`.  It also infers the frame if an input coordinate was provided and\n    checks for conflicts.\n\n    This allows for frame to be specified as a string like 'icrs' or a frame\n    class like ICRS, but not an instance ICRS() since the latter could have\n    non-default representation attributes which would require a three-way merge.\n    ","endLoc":1634,"header":"def _get_frame(args, kwargs)","id":2754,"name":"_get_frame","nodeType":"Function","startLoc":1536,"text":"def _get_frame(args, kwargs):\n    \"\"\"\n    Determine the coordinate frame from input SkyCoord args and kwargs.  This\n    modifies args and/or kwargs in-place to remove the item that provided\n    `frame`.  It also infers the frame if an input coordinate was provided and\n    checks for conflicts.\n\n    This allows for frame to be specified as a string like 'icrs' or a frame\n    class like ICRS, but not an instance ICRS() since the latter could have\n    non-default representation attributes which would require a three-way merge.\n    \"\"\"\n    frame = kwargs.pop('frame', None)\n\n    if frame is None and len(args) > 1:\n\n        # We do not allow frames to be passed as positional arguments if data\n        # is passed separately from frame.\n\n        for arg in args:\n\n            if isinstance(arg, (SkyCoord, BaseCoordinateFrame)):\n                raise ValueError(\"{0} instance cannot be passed as a positional \"\n                                 \"argument for the frame, pass it using the \"\n                                 \"frame= keyword instead.\".format(arg.__class__.__name__))\n\n    # If the frame is an instance or SkyCoord, we split up the attributes and\n    # make it into a class.\n\n    if isinstance(frame, SkyCoord):\n        # Copy any extra attributes if they are not explicitly given.\n        for attr in frame._extra_frameattr_names:\n            kwargs.setdefault(attr, getattr(frame, attr))\n        frame = frame.frame\n\n    if isinstance(frame, BaseCoordinateFrame):\n\n        for attr in frame.get_frame_attr_names():\n            if attr in kwargs:\n                raise ValueError(\"cannot specify frame attribute '{0}' directly in SkyCoord since a frame instance was passed in\".format(attr))\n            else:\n                kwargs[attr] = getattr(frame, attr)\n\n        frame = frame.__class__\n\n    if frame is not None:\n        # Frame was provided as kwarg so validate and coerce into corresponding frame.\n        frame_cls = _get_frame_class(frame)\n        frame_specified_explicitly = True\n    else:\n        # Look for the frame in args\n        for arg in args:\n            try:\n                frame_cls = _get_frame_class(arg)\n                frame_specified_explicitly = True\n            except ValueError:\n                pass\n            else:\n                args.remove(arg)\n                warnings.warn(\"Passing a frame as a positional argument is now \"\n                              \"deprecated, use the frame= keyword argument \"\n                              \"instead.\", AstropyDeprecationWarning)\n                break\n        else:\n            # Not in args nor kwargs - default to icrs\n            frame_cls = ICRS\n            frame_specified_explicitly = False\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, (collections.Sequence, np.ndarray)) and\n             len(args) == 1 and len(arg) > 0):\n            arg = arg[0]\n\n        coord_frame_cls = None\n        if isinstance(arg, BaseCoordinateFrame):\n            coord_frame_cls = arg.__class__\n        elif isinstance(arg, SkyCoord):\n            coord_frame_cls = arg.frame.__class__\n\n        if coord_frame_cls is not None:\n            if not frame_specified_explicitly:\n                frame_cls = coord_frame_cls\n            elif frame_cls is not coord_frame_cls:\n                raise ValueError(\"Cannot override frame='{0}' of input coordinate with \"\n                                 \"new frame='{1}'.  Instead transform the coordinate.\"\n                                 .format(coord_frame_cls.__name__, frame_cls.__name__))\n\n    if 'representation' in kwargs:\n        frame = frame_cls(representation=_get_repr_cls(kwargs['representation']))\n    else:\n        frame = frame_cls()\n\n    return frame"},{"col":4,"comment":"null","endLoc":119,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2755,"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            format = _astropy_format_to_asdf_format.get(t.format, t.format)\n            if format not in _guessable_formats:\n                raise ValueError(\"Invalid time '{0}'\".format(node))\n            return t\n\n        value = node['value']\n        format = 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=format, scale=scale, location=location)"},{"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    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    ","endLoc":364,"header":"def write_table_hdf5(table, output, path=None, compression=False,\n                     append=False, overwrite=False, serialize_meta=False,\n                     compatibility_mode=False)","id":2756,"name":"write_table_hdf5","nodeType":"Function","startLoc":217,"text":"def write_table_hdf5(table, output, path=None, compression=False,\n                     append=False, overwrite=False, serialize_meta=False,\n                     compatibility_mode=False):\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    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    \"\"\"\n    from ...table import meta\n\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        raise ValueError(\"table path should be set via the path= argument\")\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.highlevel.File, h5py.highlevel.Group)):\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(\"File exists: {0}\".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                                    compatibility_mode=compatibility_mode)\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        else:\n            raise OSError(\"Table {0} already exists\".format(path))\n\n    # Encode any mixin columns as plain columns + appropriate metadata\n    table = _encode_mixins(table)\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    else:\n        dset = output_group.create_dataset(name, data=table.as_array())\n\n    if serialize_meta:\n        header_yaml = meta.get_yaml_from_table(table)\n\n        header_encoded = [h.encode('utf-8') for h in header_yaml]\n        if compatibility_mode:\n            warnings.warn(\"compatibility mode for writing is deprecated\",\n                          AstropyDeprecationWarning)\n            try:\n                dset.attrs[META_KEY] = header_encoded\n            except Exception as e:\n                warnings.warn(\n                \"Attributes could not be written to the output HDF5 \"\n                \"file: {0}\".format(e))\n\n        else:\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 `{0}` of type {1} 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":77,"header":"@classmethod\n    def reserve_blocks(cls, data, ctx)","id":2757,"name":"reserve_blocks","nodeType":"Function","startLoc":73,"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)"},{"col":4,"comment":"null","endLoc":84,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":2758,"name":"assert_equal","nodeType":"Function","startLoc":79,"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":15,"id":2759,"name":"name","nodeType":"Attribute","startLoc":15,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":2760,"name":"types","nodeType":"Attribute","startLoc":16,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":2761,"name":"requires","nodeType":"Attribute","startLoc":17,"text":"requires"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/time","id":2762,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"id":2763,"name":"astropy/io/misc/asdf/tags/time/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/time/tests","id":2764,"nodeType":"File","text":""},{"id":2765,"name":"astropy/io/misc/asdf/tags/unit","nodeType":"Package"},{"fileName":"unit.py","filePath":"astropy/io/misc/asdf/tags/unit","id":2766,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nimport six\n\nfrom astropy.units import Unit, UnitBase\nfrom ...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, six.string_types):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(\"'{0}' is not a valid unit\".format(node))\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')\n"},{"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":1254,"header":"def _get_delta_ut1_utc(self, jd1=None, jd2=None)","id":2767,"name":"_get_delta_ut1_utc","nodeType":"Function","startLoc":1221,"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 ..utils.iers import IERS_Auto\n            iers_table = IERS_Auto.open()\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.jd1, self_utc.jd2\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)\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"},{"className":"UnitType","col":0,"comment":"null","endLoc":25,"id":2768,"nodeType":"Class","startLoc":10,"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, six.string_types):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(\"'{0}' is not a valid unit\".format(node))\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')"},{"col":4,"comment":"null","endLoc":21,"header":"@classmethod\n    def to_tree(cls, node, ctx)","id":2769,"name":"to_tree","nodeType":"Function","startLoc":15,"text":"@classmethod\n    def to_tree(cls, node, ctx):\n        if isinstance(node, six.string_types):\n            node = Unit(node, format='vounit', parse_strict='warn')\n        if isinstance(node, UnitBase):\n            return node.to_string(format='vounit')\n        raise TypeError(\"'{0}' is not a valid unit\".format(node))"},{"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 with IERS (Earth rotation) data columns\n\n        ","endLoc":645,"header":"@classmethod\n    def open(cls)","id":2770,"name":"open","nodeType":"Function","startLoc":597,"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 with IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS.open()\n            return cls.iers_table\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') == conf.iers_auto_url:\n                return cls.iers_table\n\n        try:\n            filename = download_file(conf.iers_auto_url, 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('failed to download {}, using local IERS-B: {}'\n                                .format(conf.iers_auto_url, str(err))))\n            cls.iers_table = IERS.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = str(conf.iers_auto_url)\n\n        return cls.iers_table"},{"col":0,"comment":"null","endLoc":157,"header":"def _ndarray_constructor(loader, node)","id":2771,"name":"_ndarray_constructor","nodeType":"Function","startLoc":154,"text":"def _ndarray_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    map['buffer'] = base64.b64decode(map['buffer'])\n    return np.ndarray(**map)"},{"col":0,"comment":"null","endLoc":164,"header":"def _quantity_representer(tag)","id":2772,"name":"_quantity_representer","nodeType":"Function","startLoc":160,"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":131,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":2773,"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":32,"header":"def _assert_earthlocation_equal(a, b)","id":2774,"name":"_assert_earthlocation_equal","nodeType":"Function","startLoc":27,"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)"},{"col":0,"comment":"null","endLoc":171,"header":"def _quantity_constructor(cls)","id":2775,"name":"_quantity_constructor","nodeType":"Function","startLoc":167,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":2776,"name":"name","nodeType":"Attribute","startLoc":36,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":2777,"name":"version","nodeType":"Attribute","startLoc":37,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":2778,"name":"supported_versions","nodeType":"Attribute","startLoc":38,"text":"supported_versions"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":2779,"name":"types","nodeType":"Attribute","startLoc":39,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":2780,"name":"requires","nodeType":"Attribute","startLoc":40,"text":"requires"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":2781,"name":"_guessable_formats","nodeType":"Attribute","startLoc":17,"text":"_guessable_formats"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":2782,"name":"_astropy_format_to_asdf_format","nodeType":"Attribute","startLoc":20,"text":"_astropy_format_to_asdf_format"},{"col":0,"comment":"","endLoc":4,"header":"time.py#<anonymous>","id":2783,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_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}"},{"col":0,"comment":"null","endLoc":178,"header":"def _skycoord_representer(dumper, obj)","id":2784,"name":"_skycoord_representer","nodeType":"Function","startLoc":174,"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":"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":507,"header":"@classmethod\n    def read(cls, file=None, readme=None)","id":2785,"name":"read","nodeType":"Function","startLoc":475,"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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_a = Table.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        # Fill any masked values, and convert to a QTable.\n        return cls(table.filled())"},{"col":0,"comment":"null","endLoc":184,"header":"def _skycoord_constructor(loader, node)","id":2786,"name":"_skycoord_constructor","nodeType":"Function","startLoc":181,"text":"def _skycoord_constructor(loader, node):\n    map = loader.construct_mapping(node)\n    out = coords.SkyCoord.info._construct_from_dict(map)\n    return out"},{"fileName":"quantity.py","filePath":"astropy/io/misc/asdf/tags/unit","id":2787,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom numpy import isscalar\nfrom astropy.units import Quantity\n\nfrom asdf.yamlutil import custom_tree_to_tagged_tree\nfrom asdf.tags.core import NDArrayType\n\nfrom ...types import AstropyAsdfType\nfrom .unit import UnitType\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'] = custom_tree_to_tagged_tree(quantity.value, ctx)\n            node['unit'] = custom_tree_to_tagged_tree(quantity.unit, ctx)\n            return node\n        raise TypeError(\"'{0}' is not a valid Quantity\".format(quantity))\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)\n"},{"className":"QuantityType","col":0,"comment":"null","endLoc":38,"id":2788,"nodeType":"Class","startLoc":14,"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'] = custom_tree_to_tagged_tree(quantity.value, ctx)\n            node['unit'] = custom_tree_to_tagged_tree(quantity.unit, ctx)\n            return node\n        raise TypeError(\"'{0}' is not a valid Quantity\".format(quantity))\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)"},{"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":1533,"header":"def _get_frame_class(frame)","id":2789,"name":"_get_frame_class","nodeType":"Function","startLoc":1513,"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    import inspect\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 {0} not in allowed values {1}'\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 class')\n\n    return frame_cls"},{"col":4,"comment":"\n        Return a new table with appropriate combination of IERS_A and B columns.\n        ","endLoc":468,"header":"@classmethod\n    def _combine_a_b_columns(cls, iers_a)","id":2790,"name":"_combine_a_b_columns","nodeType":"Function","startLoc":407,"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[~iers_a['UT1_UTC_A'].mask &\n                       ~iers_a['PolPMFlag_A'].mask]\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        # Run np.where on the data from the table columns, since in numpy 1.9\n        # it otherwise returns an only partially initialized column.\n        table['UT1_UTC'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1_UTC_A'].data,\n                                    table['UT1_UTC_B'].data)\n        # Ensure the unit is correct, for later column conversion to Quantity.\n        table['UT1_UTC'].unit = table['UT1_UTC_A'].unit\n        table['UT1Flag'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1Flag_A'].data,\n                                    'B')\n        # Repeat for polar motions.\n        table['PM_x'] = np.where(table['PM_X_B'].mask,\n                                 table['PM_x_A'].data,\n                                 table['PM_X_B'].data)\n        table['PM_x'].unit = table['PM_x_A'].unit\n        table['PM_y'] = np.where(table['PM_Y_B'].mask,\n                                 table['PM_y_A'].data,\n                                 table['PM_Y_B'].data)\n        table['PM_y'].unit = table['PM_y_A'].unit\n        table['PolPMFlag'] = np.where(table['PM_X_B'].mask,\n                                      table['PolPMFlag_A'].data,\n                                      'B')\n\n        table['dX_2000A'] = np.where(table['dX_2000A_B'].mask,\n                                     table['dX_2000A_A'].data,\n                                     table['dX_2000A_B'].data)\n        table['dX_2000A'].unit = table['dX_2000A_A'].unit\n\n        table['dY_2000A'] = np.where(table['dY_2000A_B'].mask,\n                                     table['dY_2000A_A'].data,\n                                     table['dY_2000A_B'].data)\n        table['dY_2000A'].unit = table['dY_2000A_A'].unit\n\n        table['NutFlag'] = np.where(table['dX_2000A_B'].mask,\n                                    table['NutFlag_A'].data,\n                                    '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        is_predictive = (table['UT1Flag_A'] == 'P') | (table['PolPMFlag_A'] == 'P')\n        table.meta['predictive_index'] = np.min(np.flatnonzero(is_predictive))\n        table.meta['predictive_mjd'] = table['MJD'][table.meta['predictive_index']]\n\n        return table"},{"col":4,"comment":"null","endLoc":27,"header":"@classmethod\n    def to_tree(cls, quantity, ctx)","id":2791,"name":"to_tree","nodeType":"Function","startLoc":20,"text":"@classmethod\n    def to_tree(cls, quantity, ctx):\n        node = {}\n        if isinstance(quantity, Quantity):\n            node['value'] = custom_tree_to_tagged_tree(quantity.value, ctx)\n            node['unit'] = custom_tree_to_tagged_tree(quantity.unit, ctx)\n            return node\n        raise TypeError(\"'{0}' is not a valid Quantity\".format(quantity))"},{"col":0,"comment":"null","endLoc":197,"header":"def _complex_representer(self, data)","id":2792,"name":"_complex_representer","nodeType":"Function","startLoc":188,"text":"def _complex_representer(self, data):\n    if data.imag == 0.0:\n        data = u'%r' % data.real\n    elif data.real == 0.0:\n        data = u'%rj' % data.imag\n    elif data.imag > 0:\n        data = u'%r+%rj' % (data.real, data.imag)\n    else:\n        data = u'%r%rj' % (data.real, data.imag)\n    return self.represent_scalar(u'tag:yaml.org,2002:python/complex', data)"},{"col":4,"comment":"null","endLoc":473,"header":"@classmethod\n    def _substitute_iers_b(cls, table)","id":2793,"name":"_substitute_iers_b","nodeType":"Function","startLoc":470,"text":"@classmethod\n    def _substitute_iers_b(cls, table):\n        # See documentation in IERS_Auto.\n        return table"},{"col":4,"comment":"null","endLoc":25,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2794,"name":"from_tree","nodeType":"Function","startLoc":23,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return Unit(node, format='vounit', parse_strict='silent')"},{"col":0,"comment":"null","endLoc":202,"header":"def _complex_constructor(loader, node)","id":2795,"name":"_complex_constructor","nodeType":"Function","startLoc":200,"text":"def _complex_constructor(loader, node):\n    map = loader.construct_scalar(node)\n    return complex(map)"},{"attributeType":"null","col":4,"comment":"null","endLoc":11,"id":2796,"name":"name","nodeType":"Attribute","startLoc":11,"text":"name"},{"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 object\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n    ","endLoc":314,"header":"def load(stream)","id":2797,"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 object\n        YAML input\n\n    Returns\n    -------\n    obj : object\n        Object corresponding to YAML document\n    \"\"\"\n    return yaml.load(stream, Loader=AstropyLoader)"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":2798,"name":"types","nodeType":"Attribute","startLoc":12,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":2799,"name":"requires","nodeType":"Attribute","startLoc":13,"text":"requires"},{"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 object\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":2800,"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 object\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 object, 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":355,"header":"def dump(data, stream=None, **kwargs)","id":2801,"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 object, 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    return yaml.dump(data, stream=stream, **kwargs)"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/unit","id":2802,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":71,"id":2803,"name":"np","nodeType":"Attribute","startLoc":71,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":74,"id":2804,"name":"u","nodeType":"Attribute","startLoc":74,"text":"u"},{"attributeType":"null","col":31,"comment":"null","endLoc":75,"id":2805,"name":"coords","nodeType":"Attribute","startLoc":75,"text":"coords"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":2806,"name":"YAML_LT_3_12","nodeType":"Attribute","startLoc":86,"text":"YAML_LT_3_12"},{"id":2807,"name":"astropy/io/misc/asdf/tags/unit/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/unit/tests","id":2808,"nodeType":"File","text":""},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":2809,"name":"__all__","nodeType":"Attribute","startLoc":89,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":264,"id":2810,"name":"np_type","nodeType":"Attribute","startLoc":264,"text":"np_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":268,"id":2811,"name":"np_type","nodeType":"Attribute","startLoc":268,"text":"np_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":272,"id":2812,"name":"np_type","nodeType":"Attribute","startLoc":272,"text":"np_type"},{"col":4,"comment":"null","endLoc":1261,"header":"def _set_delta_ut1_utc(self, val)","id":2813,"name":"_set_delta_ut1_utc","nodeType":"Function","startLoc":1256,"text":"def _set_delta_ut1_utc(self, val):\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        del self.cache"},{"attributeType":"null","col":4,"comment":"null","endLoc":291,"id":2814,"name":"cls","nodeType":"Attribute","startLoc":291,"text":"cls"},{"id":2815,"name":"astropy/io/misc/asdf/tags/table","nodeType":"Package"},{"fileName":"table.py","filePath":"astropy/io/misc/asdf/tags/table","id":2816,"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 import yamlutil\nfrom asdf.tags.core.ndarray import NDArrayType\n\nfrom astropy import table\nfrom ...types import AstropyAsdfType\n\n\nclass TableType(AstropyAsdfType):\n    name = 'core/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n\n        columns = [\n            yamlutil.tagged_tree_to_custom_tree(c, ctx)\n            for c in node['columns']\n        ]\n\n        return table.Table(columns, meta=node.get('meta', {}))\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        columns = []\n        for name in data.colnames:\n            column = yamlutil.custom_tree_to_tagged_tree(\n                data.columns[name], ctx)\n            columns.append(column)\n\n        node = {'columns': columns}\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        NDArrayType.assert_equal(np.array(old), np.array(new))\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 = yamlutil.tagged_tree_to_custom_tree(\n            node['data'], ctx)\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': yamlutil.custom_tree_to_tagged_tree(\n                data.data, ctx),\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = yamlutil.custom_tree_to_tagged_tree(\n                data.unit, ctx)\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"},{"col":4,"comment":"null","endLoc":1305,"header":"def _get_delta_tdb_tt(self, jd1=None, jd2=None)","id":2817,"name":"_get_delta_tdb_tt","nodeType":"Function","startLoc":1269,"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\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                from ..coordinates import EarthLocation\n                location = EarthLocation.from_geodetic(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"},{"className":"TableType","col":0,"comment":"null","endLoc":44,"id":2818,"nodeType":"Class","startLoc":12,"text":"class TableType(AstropyAsdfType):\n    name = 'core/table'\n    types = ['astropy.table.Table']\n    requires = ['astropy']\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n\n        columns = [\n            yamlutil.tagged_tree_to_custom_tree(c, ctx)\n            for c in node['columns']\n        ]\n\n        return table.Table(columns, meta=node.get('meta', {}))\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        columns = []\n        for name in data.colnames:\n            column = yamlutil.custom_tree_to_tagged_tree(\n                data.columns[name], ctx)\n            columns.append(column)\n\n        node = {'columns': columns}\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        NDArrayType.assert_equal(np.array(old), np.array(new))"},{"col":4,"comment":"null","endLoc":38,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2819,"name":"from_tree","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        if isinstance(node, Quantity):\n            return node\n\n        unit = UnitType.from_tree(node['unit'], ctx)\n        value = node['value']\n        if isinstance(value, NDArrayType):\n            value = value._make_array()\n        return Quantity(value, unit=unit)"},{"col":0,"comment":"\n    Get the longitude unit and latitude unit from kwargs.  Possible enhancement\n    is to allow input from args as well.\n    ","endLoc":1665,"header":"def _get_units(args, kwargs)","id":2820,"name":"_get_units","nodeType":"Function","startLoc":1637,"text":"def _get_units(args, kwargs):\n    \"\"\"\n    Get the longitude unit and latitude unit from kwargs.  Possible enhancement\n    is to allow input from args as well.\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:\n            raise ValueError('Unit keyword must have one to three unit values as '\n                             'tuple or comma-separated string')\n\n    return units"},{"col":4,"comment":"null","endLoc":25,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2821,"name":"from_tree","nodeType":"Function","startLoc":17,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n\n        columns = [\n            yamlutil.tagged_tree_to_custom_tree(c, ctx)\n            for c in node['columns']\n        ]\n\n        return table.Table(columns, meta=node.get('meta', {}))"},{"col":4,"comment":"null","endLoc":1312,"header":"def _set_delta_tdb_tt(self, val)","id":2822,"name":"_set_delta_tdb_tt","nodeType":"Function","startLoc":1307,"text":"def _set_delta_tdb_tt(self, val):\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        del self.cache"},{"col":4,"comment":"null","endLoc":1365,"header":"def __sub__(self, other)","id":2823,"name":"__sub__","nodeType":"Function","startLoc":1319,"text":"def __sub__(self, other):\n        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\n\n        # Tdelta - something is dealt with in TimeDelta, so we have\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = isinstance(other, TimeDelta)\n\n        # we need a constant scale to calculate, which is guaranteed for\n        # TimeDelta, but not for Time (which can be UTC)\n        if other_is_delta:  # T - Tdelta\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                out._set_scale(other.scale if other.scale is not None\n                               else 'tai')\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            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"},{"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    ","endLoc":1852,"header":"def _get_representation_attrs(frame, units, kwargs)","id":2824,"name":"_get_representation_attrs","nodeType":"Function","startLoc":1833,"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    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_classes = frame.representation.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            valid_kwargs[frame_attr_name] = repr_attr_class(value, unit=unit)\n\n    return valid_kwargs"},{"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":206,"header":"def get_yaml_from_table(table)","id":2825,"name":"get_yaml_from_table","nodeType":"Function","startLoc":187,"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    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":291,"header":"def get_yaml_from_header(header)","id":2826,"name":"get_yaml_from_header","nodeType":"Function","startLoc":209,"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    try:\n        import yaml\n    except ImportError:\n        raise ImportError('`import yaml` failed, PyYAML package is '\n                          'required for serializing mixin columns')\n\n    from ..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, Dumper=TableDumper, width=130).splitlines()\n    return lines"},{"col":4,"comment":"null","endLoc":1404,"header":"def __add__(self, other)","id":2827,"name":"__add__","nodeType":"Function","startLoc":1367,"text":"def __add__(self, other):\n        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\n\n        # Tdelta + something is dealt with in TimeDelta, so we have\n        # T      + Tdelta = T\n        # T      + T      = error\n\n        if not isinstance(other, TimeDelta):\n            raise OperandTypeError(self, other, '+')\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            out._set_scale(other.scale if other.scale is not None else 'tai')\n\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":2828,"name":"name","nodeType":"Attribute","startLoc":15,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":2829,"name":"types","nodeType":"Attribute","startLoc":16,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":2830,"name":"requires","nodeType":"Attribute","startLoc":17,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":2831,"name":"version","nodeType":"Attribute","startLoc":18,"text":"version"},{"attributeType":"null","col":9,"comment":"null","endLoc":291,"id":2832,"name":"tag","nodeType":"Attribute","startLoc":291,"text":"tag"},{"col":0,"comment":"","endLoc":67,"header":"yaml.py#<anonymous>","id":2833,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module contains functions for serializing core astropy objects via the\nYAML protocol.\n\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 <http://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\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\n.. Note ::\n\n   This module requires PyYaml version 3.12 or later.\n\nExample\n=======\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\n  >>> t = Time(2457389.0, format='mjd',\n  ...          location=EarthLocation(1000, 2000, 3000, unit=u.km))\n  >>> td = yaml.dump(t)\n\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\n  >>> ty = yaml.load(td)\n  >>> ty\n  <Time object: scale='utc' format='mjd' value=2457389.0>\n\n  >>> ty.location  # doctest: +FLOAT_CMP\n  <EarthLocation (1000., 2000., 3000.) km>\n\"\"\"\n\ntry:\n    import yaml\nexcept ImportError:\n    raise ImportError('`import yaml` failed, PyYAML package is required for YAML')\n\nYAML_LT_3_12 = not minversion(yaml, '3.12')\n\n__all__ = ['AstropyLoader', 'AstropyDumper', 'load', 'load_all', 'dump']\n\nAstropyDumper.add_representer(u.IrreducibleUnit, _unit_representer)\n\nAstropyDumper.add_representer(u.CompositeUnit, _unit_representer)\n\nAstropyDumper.add_multi_representer(u.Unit, _unit_representer)\n\nAstropyDumper.add_representer(tuple, AstropyDumper._represent_tuple)\n\nAstropyDumper.add_representer(np.ndarray, _ndarray_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_,\n                              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,\n                                 _complex_representer)\n\nAstropyLoader.add_constructor(u'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('!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                 (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))"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/table","id":2834,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"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":1830,"header":"def _parse_coordinate_arg(coords, frame, units, init_kwargs)","id":2835,"name":"_parse_coordinate_arg","nodeType":"Function","startLoc":1668,"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    is_scalar = False  # Differentiate between scalar and list input\n    valid_kwargs = {}  # Returned dict of lon, lat, and distance (optional)\n\n    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_names = frame.representation_component_names.values()\n    repr_attr_classes = frame.representation.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)\n\n        values = []  # List of values corresponding to representation attrs\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                continue\n\n            # Get the value from `data` in the eventual representation\n            values.append(getattr(data, repr_attr_name))\n\n        for attr in frame_transform_graph.frame_attributes:\n            value = getattr(coords, attr, None)\n            use_value = (isinstance(coords, SkyCoord)\n                         or attr not in coords._attr_names_with_defaults)\n            if use_value and value is not None:\n                valid_kwargs[attr] = value\n\n    elif isinstance(coords, BaseRepresentation):\n        data = coords.represent_as(frame.representation)\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'\n          and 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, (collections.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: {0} != {1}\".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                valid_kwargs[fattrnm] = getattr(scs[0].frame, fattrnm)\n            for fattrnm in scs[0]._extra_frameattr_names:\n                valid_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:\n                raise ValueError('One or more elements of input sequence does not have a length')\n\n            if len(n_coords) > 1:\n                raise ValueError('Input coordinate values must have same number of elements, found {0}'\n                                 .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 {0} values but '\n                                 'representation {1} only accepts {2}'\n                                 .format(n_coords, frame.representation.get_name(), 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            valid_kwargs[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 \"{0}\" for attribute '\n                         '{1}'.format(value, frame_attr_name), err)\n    return valid_kwargs"},{"col":4,"comment":"null","endLoc":1407,"header":"def __radd__(self, other)","id":2836,"name":"__radd__","nodeType":"Function","startLoc":1406,"text":"def __radd__(self, other):\n        return self.__add__(other)"},{"id":2837,"name":"astropy/io/misc/asdf/tags/table/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/table/tests","id":2838,"nodeType":"File","text":""},{"id":2839,"name":"astropy/io/misc/asdf/tags/coords","nodeType":"Package"},{"fileName":"coords.py","filePath":"astropy/io/misc/asdf/tags/coords","id":2840,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom asdf.yamlutil import custom_tree_to_tagged_tree\n\nfrom astropy.units import Quantity\nfrom astropy.coordinates import ICRS, Longitude, Latitude, Angle\nfrom astropy.tests.helper import assert_quantity_allclose\n\nfrom ...types import AstropyType\nfrom ..unit.quantity import QuantityType\n\n\n__all__ = ['ICRSCoordType']\n\n\nclass ICRSCoordType(AstropyType):\n    name = \"coords/icrs_coord\"\n    types = ['astropy.coordinates.ICRS']\n    requires = ['astropy']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        angle = Angle(QuantityType.from_tree(node['ra']['wrap_angle'], ctx))\n        wrap_angle = Angle(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': custom_tree_to_tagged_tree(wrap_angle, ctx)\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_quantity_allclose(new.ra, old.ra)\n        assert_quantity_allclose(new.dec, old.dec)\n"},{"col":4,"comment":"null","endLoc":1411,"header":"def __rsub__(self, other)","id":2841,"name":"__rsub__","nodeType":"Function","startLoc":1409,"text":"def __rsub__(self, other):\n        out = self.__sub__(other)\n        return -out"},{"col":4,"comment":"null","endLoc":39,"header":"@classmethod\n    def to_tree(cls, data, ctx)","id":2842,"name":"to_tree","nodeType":"Function","startLoc":27,"text":"@classmethod\n    def to_tree(cls, data, ctx):\n        columns = []\n        for name in data.colnames:\n            column = yamlutil.custom_tree_to_tagged_tree(\n                data.columns[name], ctx)\n            columns.append(column)\n\n        node = {'columns': columns}\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node"},{"col":4,"comment":"null","endLoc":44,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":2843,"name":"assert_equal","nodeType":"Function","startLoc":41,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert old.meta == new.meta\n        NDArrayType.assert_equal(np.array(old), np.array(new))"},{"col":4,"comment":"If other is of same class as self, return difference in self.scale.\n        Otherwise, raise OperandTypeError.\n        ","endLoc":1431,"header":"def _time_difference(self, other, op=None)","id":2844,"name":"_time_difference","nodeType":"Function","startLoc":1413,"text":"def _time_difference(self, other, op=None):\n        \"\"\"If other is of same class as self, return difference in self.scale.\n        Otherwise, raise OperandTypeError.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                raise OperandTypeError(self, other, op)\n\n        if(self.scale is not None and self.scale not in other.SCALES or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot compare TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".format(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 (self.jd1 - other.jd1) + (self.jd2 - other.jd2)"},{"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 the\n    references provided in the  :ref:`astropy-coordinates-seealso` section of the\n    documentation.\n\n    {params}\n    ","endLoc":21,"id":2845,"nodeType":"Class","startLoc":7,"text":"class 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 the\n    references provided in the  :ref:`astropy-coordinates-seealso` section of the\n    documentation.\n\n    {params}\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":2846,"name":"name","nodeType":"Attribute","startLoc":13,"text":"name"},{"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\n    {params}\n    ","endLoc":86,"id":2847,"nodeType":"Class","startLoc":49,"text":"class 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    {params}\n    \"\"\"\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ra'),\n            RepresentationMapping('lat', 'dec')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_ra_cosdec', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_dec', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_ra', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_dec', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential"},{"col":0,"comment":"\n    Extract information from a column (apart from the values) that is required\n    to fully serialize the column.\n    ","endLoc":184,"header":"def _get_col_attributes(col)","id":2848,"name":"_get_col_attributes","nodeType":"Function","startLoc":160,"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    attrs = ColumnDict()\n    attrs['name'] = col.info.name\n\n    type_name = col.info.dtype.type.__name__\n    if type_name.startswith(('bytes', 'str')):\n        type_name = 'string'\n    if type_name.endswith('_'):\n        type_name = type_name[:-1]  # string_ and bool_ lose the final _ for ECSV\n    attrs['datatype'] = type_name\n\n    # Set the output attributes\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    return attrs"},{"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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or `None` to have no data (or use the other\n        arguments)\n    *args, **kwargs\n        Coordinates, with names that depend on the subclass.\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\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    ","endLoc":1420,"id":2849,"nodeType":"Class","startLoc":209,"text":"class BaseCoordinateFrame(ShapedLikeNDArray, metaclass=FrameMeta):\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or `None` to have no data (or use the other\n        arguments)\n    *args, **kwargs\n        Coordinates, with names that depend on the subclass.\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\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    \"\"\"\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    _inherit_descriptors_ = (Attribute,)\n\n    frame_attributes = OrderedDict()\n    # Default empty frame_attributes dict\n\n    def __init__(self, *args, copy=True, representation=None,\n                 differential_cls=None,**kwargs):\n        self._attr_names_with_defaults = []\n\n        # TODO: we should be able to deal with an instance, not just a\n        # class or string for representation and differential_cls.\n\n        if representation is not None or differential_cls is not None:\n\n            if representation is None:\n                representation = self.default_representation\n\n            if (inspect.isclass(differential_cls) and\n                    issubclass(differential_cls, r.BaseDifferential)):\n                # TODO: assumes the differential class is for the velocity\n                # differential\n                differential_cls = {'s': differential_cls}\n\n            elif differential_cls is None:\n                differential_cls = {'s': 'base'} # see set_representation_cls()\n\n            self.set_representation_cls(representation, **differential_cls)\n\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)\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation and '\n                    '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                                     '{0}'.format(diffs))\n\n        elif self.representation:\n            representation_cls = self.representation\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            # TODO: possibly generalize this somehow?\n            if repr_kwargs:\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls, r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                representation_data = representation_cls(copy=copy, **repr_kwargs)\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') and\n                        '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                differential_data = differential_cls(copy=copy, **diff_kwargs)\n\n        if len(args) > 0:\n            raise TypeError(\n                '{0}.__init__ had {1} 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            self._data = representation_data.with_differentials(\n                {'s': differential_data})\n        else:\n            self._data = representation_data  # possibly None.\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribue\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                'Coordinate frame got unexpected keywords: {0}'.format(\n                    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, 'size', 1) > 1}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError:\n                        raise ValueError(\n                            \"non-scalar attributes with inconsistent \"\n                            \"shapes: {0}\".format(shapes))\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        else:\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    @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 \"{0!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 OrderedDict((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 not hasattr(self, '_representation'):\n            self._representation = {'base': self.default_representation,\n                                    's': self.default_differential}\n        return self._representation[which] if which is not None else 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 = 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_represenation_cls`` method.\n        \"\"\")\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\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 in repr_diff_cls.attr_classes.keys():\n                repr_attrs[repr_diff_cls]['names'].append(c)\n                rec_unit = repr_diff_cls.recommended_units.get(c, 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            if isinstance(repr_diff_cls, 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                repr_diff_cls = _get_repr_cls(repr_diff_cls)\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) and\n                            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        return repr_attrs\n\n    @property\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 = OrderedDict()\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 = OrderedDict()\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, 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 overriden 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 : same as this frame\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', **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 overriden 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 : same as this frame\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        kwargs['_framedata'] = None\n        return self._apply('copy' if copy else 'replicate', **kwargs)\n\n    def realize_frame(self, representation):\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        representation : BaseRepresentation\n            The representation to use as the data for the new frame.\n\n        Returns\n        -------\n        frameobj : same as this frame\n            A new object with the same frame attributes as this one, but\n            with the ``representation`` as the data.\n        \"\"\"\n        # Here we pass representation_cls=None to _apply, since we do not want\n        # to insist that the realized frame has the same representation as\n        # self.  [Avoids breaking sunpy; see gh-6208]\n        # TODO: should we expose this, so one has a choice?\n        return self._apply('replicate', _framedata=representation,\n                           representation_cls=None)\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 = 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            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                # 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)) and\n                                comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential) and\n                              comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        if new_attr_unit and hasattr(diff, comp):\n                            diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\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 .representation and\n                    # .differential_cls don't point to the original classes, if\n                    # the input differential is a RadialDifferential, it usually\n                    # gets turned into a SphericalCosLatDifferential (or\n                    # whatever the default is) with strange units for the d_lon\n                    # and d_lat attributes. This then causes the dictionary key\n                    # check to fail (i.e. comparison against\n                    # `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n                    # data = data.with_differentials({'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 : class or frame object or SkyCoord object\n            The frame to transform this coordinate frame into.\n\n        Returns\n        -------\n        transframe\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) and\n           hasattr(self, 'obstime') and hasattr(new_frame, 'obstime') and\n           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            # 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 : class or frame object\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\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    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 : 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 np.any(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 = ' ({0})'.format(frameattrs)\n\n        if data_repr:\n            return '<{0} Coordinate{1}: {2}>'.format(self.__class__.__name__,\n                                                     frameattrs, data_repr)\n        else:\n            return '<{0} Frame{1}>'.format(self.__class__.__name__,\n                                           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:\n            if (issubclass(self.representation, r.SphericalRepresentation) and\n                    isinstance(self.data, r.UnitSphericalRepresentation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation\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            for nmpref, nmrepr in self.representation_component_names.items():\n                data_repr = data_repr.replace(nmrepr, nmpref)\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        return ', '.join([attrnm + '=' + str(getattr(self, attrnm))\n                          for attrnm in self.get_frame_attr_names()])\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.misc.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        if '_framedata' in kwargs:\n            data = kwargs.pop('_framedata')\n        else:\n            data = self.data if self.has_data else None\n\n        # This is to provide a slightly nicer error message if the user tries to\n        # 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\n        # TODO: expose this trickery in docstring?\n        representation_cls = kwargs.pop('representation_cls',\n                                        self.representation)\n\n        differential_cls = kwargs.pop('differential_cls',\n                                      self.get_representation_cls('s'))\n\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                if method == 'replicate' and not hasattr(value, method):\n                    return value  # reference directly\n                else:\n                    return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    if method == 'replicate' and not hasattr(value, method):\n                        return value  # reference directly\n                    else:\n                        return getattr(value, method)(*args, **kwargs)\n\n        if data is not None:\n            data = apply_method(data)\n\n        # TODO: change to representation_cls in __init__ - gh-6219.\n        frattrs = {'representation': representation_cls,\n                   'differential_cls': differential_cls}\n        for attr in self.get_frame_attr_names():\n            if attr not in self._attr_names_with_defaults:\n                if (method == 'copy' or method == 'replicate') and attr in kwargs:\n                    value = kwargs[attr]\n                else:\n                    value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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                frattrs[attr] = value\n\n        return self.__class__(data, **frattrs)\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, 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_cls 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        repr_attr_names = set()\n        if hasattr(self, 'representation_info'):\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                'Cannot set any frame attribute {0}'.format(attr))\n        else:\n            super().__setattr__(attr, 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            unintutive 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        return Distance((self_car - other_car).norm())\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 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        try:\n            v = self.cartesian.differentials['s']\n        except Exception as e:\n            raise ValueError('Could not retrieve a Cartesian velocity. Your '\n                             'frame must include velocity information for this '\n                             'to work.')\n        return v\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":2850,"name":"types","nodeType":"Attribute","startLoc":14,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":2851,"name":"requires","nodeType":"Attribute","startLoc":15,"text":"requires"},{"className":"ColumnType","col":0,"comment":"null","endLoc":89,"id":2852,"nodeType":"Class","startLoc":47,"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 = yamlutil.tagged_tree_to_custom_tree(\n            node['data'], ctx)\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': yamlutil.custom_tree_to_tagged_tree(\n                data.data, ctx),\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = yamlutil.custom_tree_to_tagged_tree(\n                data.unit, ctx)\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":64,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2853,"name":"from_tree","nodeType":"Function","startLoc":53,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        data = yamlutil.tagged_tree_to_custom_tree(\n            node['data'], ctx)\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":45,"endLoc":176,"id":2854,"nodeType":"Lambda","startLoc":176,"text":"lambda x: x is not None"},{"col":47,"endLoc":177,"id":2855,"nodeType":"Lambda","startLoc":177,"text":"lambda x: x is not None"},{"col":52,"endLoc":178,"id":2856,"nodeType":"Lambda","startLoc":178,"text":"lambda x: x is not None"},{"col":45,"endLoc":179,"id":2857,"nodeType":"Lambda","startLoc":179,"text":"lambda x: x"},{"col":4,"comment":"null","endLoc":1434,"header":"def __lt__(self, other)","id":2858,"name":"__lt__","nodeType":"Function","startLoc":1433,"text":"def __lt__(self, other):\n        return self._time_difference(other, '<') < 0."},{"col":4,"comment":"null","endLoc":1437,"header":"def __le__(self, other)","id":2859,"name":"__le__","nodeType":"Function","startLoc":1436,"text":"def __le__(self, other):\n        return self._time_difference(other, '<=') <= 0."},{"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":460,"header":"@lazyproperty\n    def cache(self)","id":2860,"name":"cache","nodeType":"Function","startLoc":440,"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        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":1449,"header":"def __eq__(self, other)","id":2861,"name":"__eq__","nodeType":"Function","startLoc":1439,"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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return False\n        return diff == 0."},{"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":1461,"header":"def __ne__(self, other)","id":2862,"name":"__ne__","nodeType":"Function","startLoc":1451,"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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return True\n        return diff != 0."},{"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":472,"header":"@property\n    def data(self)","id":2863,"name":"data","nodeType":"Function","startLoc":462,"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 \"{0!r}\" does not have '\n                             'associated data'.format(self))\n        return self._data"},{"col":4,"comment":"null","endLoc":1464,"header":"def __gt__(self, other)","id":2864,"name":"__gt__","nodeType":"Function","startLoc":1463,"text":"def __gt__(self, other):\n        return self._time_difference(other, '>') > 0."},{"col":4,"comment":"null","endLoc":1467,"header":"def __ge__(self, other)","id":2865,"name":"__ge__","nodeType":"Function","startLoc":1466,"text":"def __ge__(self, other):\n        return self._time_difference(other, '>=') >= 0."},{"col":4,"comment":"\n        True if this frame has `data`, False otherwise.\n        ","endLoc":479,"header":"@property\n    def has_data(self)","id":2866,"name":"has_data","nodeType":"Function","startLoc":474,"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":483,"header":"@property\n    def shape(self)","id":2867,"name":"shape","nodeType":"Function","startLoc":481,"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":488,"header":"def __len__(self)","id":2868,"name":"__len__","nodeType":"Function","startLoc":487,"text":"def __len__(self):\n        return len(self.data)"},{"col":4,"comment":"null","endLoc":1471,"header":"def to_datetime(self, timezone=None)","id":2869,"name":"to_datetime","nodeType":"Function","startLoc":1469,"text":"def to_datetime(self, timezone=None):\n        tm = self.replicate(format='datetime')\n        return tm._shaped_like_input(tm._time.to_value(timezone))"},{"col":4,"comment":"null","endLoc":491,"header":"def __bool__(self)","id":2870,"name":"__bool__","nodeType":"Function","startLoc":490,"text":"def __bool__(self):\n        return self.has_data and self.size > 0"},{"col":4,"comment":"null","endLoc":495,"header":"@property\n    def size(self)","id":2871,"name":"size","nodeType":"Function","startLoc":493,"text":"@property\n    def size(self):\n        return self.data.size"},{"col":4,"comment":"null","endLoc":499,"header":"@property\n    def isscalar(self)","id":2872,"name":"isscalar","nodeType":"Function","startLoc":497,"text":"@property\n    def isscalar(self):\n        return self.has_data and self.data.isscalar"},{"col":4,"comment":"null","endLoc":597,"header":"@classmethod\n    def _get_representation_info(cls)","id":2873,"name":"_get_representation_info","nodeType":"Function","startLoc":553,"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\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 in repr_diff_cls.attr_classes.keys():\n                repr_attrs[repr_diff_cls]['names'].append(c)\n                rec_unit = repr_diff_cls.recommended_units.get(c, 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            if isinstance(repr_diff_cls, 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                repr_diff_cls = _get_repr_cls(repr_diff_cls)\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) and\n                            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        return repr_attrs"},{"attributeType":"null","col":4,"comment":"List of time scales","endLoc":226,"id":2874,"name":"SCALES","nodeType":"Attribute","startLoc":226,"text":"SCALES"},{"attributeType":"null","col":4,"comment":"Dict of time formats","endLoc":229,"id":2875,"name":"FORMATS","nodeType":"Attribute","startLoc":229,"text":"FORMATS"},{"attributeType":"null","col":4,"comment":"null","endLoc":234,"id":2876,"name":"__array_priority__","nodeType":"Attribute","startLoc":234,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":238,"id":2877,"name":"_astropy_column_attrs","nodeType":"Attribute","startLoc":238,"text":"_astropy_column_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":398,"id":2878,"name":"info","nodeType":"Attribute","startLoc":398,"text":"info"},{"attributeType":"null","col":4,"comment":"UT1 - UTC time scale offset","endLoc":1265,"id":2879,"name":"delta_ut1_utc","nodeType":"Attribute","startLoc":1265,"text":"delta_ut1_utc"},{"attributeType":"null","col":4,"comment":"TDB - TT time scale offset","endLoc":1316,"id":2880,"name":"delta_tdb_tt","nodeType":"Attribute","startLoc":1316,"text":"delta_tdb_tt"},{"attributeType":"null","col":4,"comment":"null","endLoc":1473,"id":2881,"name":"__doc__","nodeType":"Attribute","startLoc":1473,"text":"to_datetime.__doc__"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":2882,"name":"HDF5_SIGNATURE","nodeType":"Attribute","startLoc":17,"text":"HDF5_SIGNATURE"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":2883,"name":"META_KEY","nodeType":"Attribute","startLoc":18,"text":"META_KEY"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":2884,"name":"__all__","nodeType":"Attribute","startLoc":20,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"hdf5.py#<anonymous>","id":2885,"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:`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']"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/coords","id":2886,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":247,"id":2887,"name":"self","nodeType":"Attribute","startLoc":247,"text":"self"},{"id":2888,"name":"astropy/io/misc/asdf/tags/coords/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/coords/tests","id":2889,"nodeType":"File","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":331,"id":2890,"name":"_format","nodeType":"Attribute","startLoc":331,"text":"self._format"},{"id":2891,"name":"astropy/io/misc/asdf/tags/transform","nodeType":"Package"},{"fileName":"compound.py","filePath":"astropy/io/misc/asdf/tags/transform","id":2892,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom asdf import tagged, yamlutil\nfrom asdf.tests.helpers import assert_tree_match\n\nfrom astropy import modeling\nfrom astropy.modeling.models import Identity, Mapping\nfrom .basic import TransformType, ConstantType\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}\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}\n\n\nclass CompoundType(TransformType):\n    name = ['transform/' + x for x in _tag_to_method_mapping.keys()]\n    types = ['astropy.modeling.core._CompoundModel']\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\n        oper = _tag_to_method_mapping[tag]\n        left = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][0], ctx)\n        if not isinstance(left, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][0]._tag))\n        right = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][1], ctx)\n        if not isinstance(right, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][1]._tag))\n        model = getattr(left, oper)(right)\n\n        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model\n\n    @classmethod\n    def _to_tree_from_model_tree(cls, tree, ctx):\n        if tree.left.isleaf:\n            left = yamlutil.custom_tree_to_tagged_tree(\n                tree.left.value, ctx)\n        else:\n            left = cls._to_tree_from_model_tree(tree.left, ctx)\n\n        if tree.right.isleaf:\n            right = yamlutil.custom_tree_to_tagged_tree(\n                tree.right.value, ctx)\n        else:\n            right = cls._to_tree_from_model_tree(tree.right, ctx)\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[tree.value]\n        except KeyError:\n            raise ValueError(\"Unknown operator '{0}'\".format(tree.value))\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n        return node\n\n    @classmethod\n    def to_tree_tagged(cls, model, ctx):\n        node = cls._to_tree_from_model_tree(model._tree, ctx)\n        cls._to_tree_base_transform_members(model, node, ctx)\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_tree_match(a._tree.left.value, b._tree.left.value)\n        assert_tree_match(a._tree.right.value, b._tree.right.value)\n        assert a._tree.value == b._tree.value\n\n\nclass RemapAxesType(TransformType):\n    name = 'transform/remap_axes'\n    types = ['astropy.modeling.models.Mapping']\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 & ConstantType.from_tree(\n                    {'value': int(entry.value)}, ctx)\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"},{"col":4,"comment":"\n        A dictionary with the information of what attribute names for this frame\n        apply to particular representations.\n        ","endLoc":605,"header":"@property\n    def representation_info(self)","id":2893,"name":"representation_info","nodeType":"Function","startLoc":599,"text":"@property\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()"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/transform","id":2894,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n"},{"col":4,"comment":"null","endLoc":629,"header":"def get_representation_component_units(self, which='base')","id":2895,"name":"get_representation_component_units","nodeType":"Function","startLoc":618,"text":"def get_representation_component_units(self, which='base'):\n        out = OrderedDict()\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"},{"fileName":"projections.py","filePath":"astropy/io/misc/asdf/tags/transform","id":2896,"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 asdf import yamlutil\n\nfrom astropy import modeling\nfrom .basic import TransformType\n\n\n__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType']\n\n\nclass AffineType(TransformType):\n    name = \"transform/affine\"\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        node = {'matrix': model.matrix.value, 'translation': model.translation.value}\n        return yamlutil.custom_tree_to_tagged_tree(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 (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    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': model.angle.value}\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    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\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                return {\"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                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                return {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            return {\"phi\": model.phi.value,\n                    \"theta\": model.theta.value,\n                    \"psi\": model.psi.value,\n                    \"direction\": model.axes_order\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 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 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))),\n    'gnomonic': ('Gnomonic', ()),\n    'stereographic': ('Stereographic', ()),\n    'slant_orthographic': ('SlantOrthographic', (('xi', 0.0), ('eta', 0.0))),\n    'zenithal_equidistant': ('ZenithalEquidistant', ()),\n    'zenithal_equal_area': ('ZenithalEqualArea', ()),\n    'airy': ('Airy', (('theta_b', 90.0),)),\n    'cylindrical_perspective': ('CylindricalPerspective', (('mu', 0.0), ('lam', 0.0))),\n    'cylindrical_equal_area': ('CylindricalEqualArea', (('lam', 0.0),)),\n    'plate_carree': ('PlateCarree', ()),\n    'mercator': ('Mercator', ()),\n    'sanson_flamsteed': ('SansonFlamsteed', ()),\n    'parabolic': ('Parabolic', ()),\n    'molleweide': ('Molleweide', ()),\n    'hammer_aitoff': ('HammerAitoff', ()),\n    'conic_perspective': ('ConicPerspective', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_equal_area': ('ConicEqualArea', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_equidistant': ('ConicEquidistant', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_orthomorphic': ('ConicOrthomorphic', (('sigma', 0.0), ('delta', 0.0))),\n    'bonne_equal_area': ('BonneEqualArea', (('theta1', 0.0),)),\n    'polyconic': ('Polyconic', ()),\n    'tangential_spherical_cube': ('TangentialSphericalCube', ()),\n    'cobe_quad_spherical_cube': ('COBEQuadSphericalCube', ()),\n    'quad_spherical_cube': ('QuadSphericalCube', ()),\n    'healpix': ('HEALPix', (('H', 4.0), ('X', 3.0))),\n    'healpix_polar': ('HEALPixPolar', ())\n}\n\n\ndef make_projection_types():\n    for tag_name, (name, params) in _generic_projections.items():\n        class_name = '{0}Type'.format(name)\n        types = ['astropy.modeling.projections.Pix2Sky_{0}'.format(name),\n                 'astropy.modeling.projections.Sky2Pix_{0}'.format(name)]\n\n        globals()[class_name] = type(\n            str(class_name),\n            (GenericProjectionType,),\n            {'name': 'transform/{0}'.format(tag_name),\n             'types': types,\n             'params': params})\n\n        __all__.append(class_name)\n\nmake_projection_types()\n"},{"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 overriden 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 : same as this frame\n            Replica of this object, but possibly with new frame attributes.\n        ","endLoc":662,"header":"def replicate(self, copy=False, **kwargs)","id":2897,"name":"replicate","nodeType":"Function","startLoc":635,"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 overriden 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 : same as this frame\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', **kwargs)"},{"attributeType":"null","col":16,"comment":"null","endLoc":286,"id":2898,"name":"location","nodeType":"Attribute","startLoc":286,"text":"self.location"},{"attributeType":"null","col":8,"comment":"null","endLoc":1260,"id":2899,"name":"_delta_ut1_utc","nodeType":"Attribute","startLoc":1260,"text":"self._delta_ut1_utc"},{"col":4,"comment":"null","endLoc":81,"header":"@classmethod\n    def to_tree(cls, data, ctx)","id":2900,"name":"to_tree","nodeType":"Function","startLoc":66,"text":"@classmethod\n    def to_tree(cls, data, ctx):\n        node = {\n            'data': yamlutil.custom_tree_to_tagged_tree(\n                data.data, ctx),\n            'name': data.name\n        }\n        if data.description:\n            node['description'] = data.description\n        if data.unit:\n            node['unit'] = yamlutil.custom_tree_to_tagged_tree(\n                data.unit, ctx)\n        if data.meta:\n            node['meta'] = data.meta\n\n        return node"},{"attributeType":"null","col":12,"comment":"null","endLoc":1301,"id":2901,"name":"_delta_tdb_tt","nodeType":"Attribute","startLoc":1301,"text":"self._delta_tdb_tt"},{"attributeType":"null","col":8,"comment":"null","endLoc":329,"id":2902,"name":"_time","nodeType":"Attribute","startLoc":329,"text":"self._time"},{"attributeType":"null","col":16,"comment":"null","endLoc":430,"id":2903,"name":"out_subfmt","nodeType":"Attribute","startLoc":430,"text":"self.out_subfmt"},{"col":4,"comment":"null","endLoc":89,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":2904,"name":"assert_equal","nodeType":"Function","startLoc":83,"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":"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.misc.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":1184,"header":"def _apply(self, method, *args, **kwargs)","id":2905,"name":"_apply","nodeType":"Function","startLoc":1100,"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.misc.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        if '_framedata' in kwargs:\n            data = kwargs.pop('_framedata')\n        else:\n            data = self.data if self.has_data else None\n\n        # This is to provide a slightly nicer error message if the user tries to\n        # 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\n        # TODO: expose this trickery in docstring?\n        representation_cls = kwargs.pop('representation_cls',\n                                        self.representation)\n\n        differential_cls = kwargs.pop('differential_cls',\n                                      self.get_representation_cls('s'))\n\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                if method == 'replicate' and not hasattr(value, method):\n                    return value  # reference directly\n                else:\n                    return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    if method == 'replicate' and not hasattr(value, method):\n                        return value  # reference directly\n                    else:\n                        return getattr(value, method)(*args, **kwargs)\n\n        if data is not None:\n            data = apply_method(data)\n\n        # TODO: change to representation_cls in __init__ - gh-6219.\n        frattrs = {'representation': representation_cls,\n                   'differential_cls': differential_cls}\n        for attr in self.get_frame_attr_names():\n            if attr not in self._attr_names_with_defaults:\n                if (method == 'copy' or method == 'replicate') and attr in kwargs:\n                    value = kwargs[attr]\n                else:\n                    value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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                frattrs[attr] = value\n\n        return self.__class__(data, **frattrs)"},{"className":"MixinInfo","col":0,"comment":"null","endLoc":616,"id":2906,"nodeType":"Class","startLoc":605,"text":"class MixinInfo(BaseColumnInfo):\n\n    def __setattr__(self, attr, value):\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 attr == 'name' and self.parent_table is not None:\n            from ..table.np_utils import fix_column_name\n            new_name = fix_column_name(value)  # Ensure col name is numpy compatible\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        super().__setattr__(attr, value)"},{"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":1909,"header":"def _parse_ra_dec(coord_str)","id":2907,"name":"_parse_ra_dec","nodeType":"Function","startLoc":1855,"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 = ('{0} {1} {2}'.\n                         format(coord[0][0:3], coord[0][3:5], coord[0][5:]),\n                         '{0} {1} {2}'.\n                         format(coord[1][0:3], coord[1][3:5], coord[1][5:]))\n            else:\n                coord = ('{0} {1} {2}'.\n                         format(coord[0][0:2], coord[0][2:4], coord[0][4:]),\n                         '{0} {1} {2}'.\n                         format(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"},{"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":602,"id":2908,"nodeType":"Class","startLoc":426,"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'])\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', 'ecsv', 'yaml'.  Objects like Time or\n    # SkyCoord will have different default serialization representations\n    # depending on context.\n    _serialize_context = None\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 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 ..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    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 : Column or mixin\n            Sliced object\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 ..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            threshold = 0.6\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 of merged attributes\n\n        \"\"\"\n        from ..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        return out"},{"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 http://nbviewer.ipython.org/urls/\n    gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb for\n    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":423,"id":2909,"nodeType":"Class","startLoc":186,"text":"class DataInfo:\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 http://nbviewer.ipython.org/urls/\n    gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb for\n    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    _attrs_no_copy = set()\n    _info_summary_attrs = ('dtype', 'shape', 'unit', 'format', 'description', 'class')\n    _represent_as_dict_attrs = ()\n    _parent = 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.\n        if bound:\n            self._attrs = dict((attr, None) for attr in self.attr_names)\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            info = self\n            info._parent_cls = owner_cls\n        else:\n            info = instance.__dict__.get('info')\n            if info is None:\n                info = instance.__dict__['info'] = self.__class__(bound=True)\n            info._parent = 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            for attr in info.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 __getattr__(self, attr):\n        if attr.startswith('_'):\n            return super().__getattribute__(attr)\n\n        if attr in self.attrs_from_parent:\n            return getattr(self._parent, attr)\n\n        try:\n            value = self._attrs[attr]\n        except KeyError:\n            super().__getattribute__(attr)  # Generate AttributeError\n\n        # Weak ref for parent table\n        if attr == 'parent_table' and callable(value):\n            value = value()\n\n        # Mixins have a default dtype of Object if nothing else was set\n        if attr == 'dtype' and value is None:\n            value = np.dtype('O')\n\n        return value\n\n    def __setattr__(self, attr, value):\n        propobj = getattr(self.__class__, attr, None)\n\n        # If attribute is taken from parent properties and there is not a\n        # class property (getter/setter) for this attribute then set\n        # attribute directly in parent.\n        if attr in self.attrs_from_parent and not isinstance(propobj, property):\n            setattr(self._parent, attr, value)\n            return\n\n        # Check if there is a property setter and use it if possible.\n        if isinstance(propobj, property):\n            if propobj.fset is None:\n                raise AttributeError(\"can't set attribute\")\n            propobj.fset(self, value)\n            return\n\n        # Private attr names get directly set\n        if attr.startswith('_'):\n            super().__setattr__(attr, value)\n            return\n\n        # Finally this must be an actual data attribute that this class is handling.\n        if attr not in self.attr_names:\n            raise AttributeError(\"attribute must be one of {0}\".format(self.attr_names))\n\n        if attr == 'parent_table':\n            value = None if value is None else weakref.ref(value)\n\n        self._attrs[attr] = value\n\n    def _represent_as_dict(self):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\"\"\"\n        return _get_obj_attrs_map(self._parent, self._represent_as_dict_attrs)\n\n    def _construct_from_dict(self, map):\n        return self._parent_cls(**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, function, list of (str or function)\n            Info option, defaults to 'attributes'.\n        out : file-like object, 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 : 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={0} 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:\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('{0} = {1}'.format(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":215,"header":"def __init__(self, bound=False)","id":2910,"name":"__init__","nodeType":"Function","startLoc":211,"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.\n        if bound:\n            self._attrs = dict((attr, None) for attr in self.attr_names)"},{"col":4,"comment":"null","endLoc":227,"header":"def __get__(self, instance, owner_cls)","id":2911,"name":"__get__","nodeType":"Function","startLoc":217,"text":"def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            info = self\n            info._parent_cls = owner_cls\n        else:\n            info = instance.__dict__.get('info')\n            if info is None:\n                info = instance.__dict__['info'] = self.__class__(bound=True)\n            info._parent = instance\n        return info"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":2912,"name":"name","nodeType":"Attribute","startLoc":48,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":2913,"name":"types","nodeType":"Attribute","startLoc":49,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":2914,"name":"requires","nodeType":"Attribute","startLoc":50,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":2915,"name":"handle_dynamic_subclasses","nodeType":"Attribute","startLoc":51,"text":"handle_dynamic_subclasses"},{"fileName":"polynomial.py","filePath":"astropy/io/misc/asdf/tags/transform","id":2916,"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 import yamlutil\n\nfrom astropy import modeling\nfrom .basic import TransformType\n\n\n__all__ = ['ShiftType', 'ScaleType', 'PolynomialType']\n\n\nclass ShiftType(TransformType):\n    name = \"transform/shift\"\n    types = ['astropy.modeling.models.Shift']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if 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        return {'offset': model.offset.value}\n        #return yamlutil.custom_tree_to_tagged_tree(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 (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    types = ['astropy.modeling.models.Scale']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if 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        node = {'factor': model.factor.value}\n        return yamlutil.custom_tree_to_tagged_tree(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 (isinstance(a, modeling.models.Scale) and\n                isinstance(b, modeling.models.Scale))\n        assert_array_equal(a.factor, b.factor)\n\n\nclass PolynomialType(TransformType):\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            model = modeling.models.Polynomial1D(coefficients.size - 1)\n            model.parameters = coefficients\n        elif n_dim == 2:\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, **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        return yamlutil.custom_tree_to_tagged_tree(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 (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"},{"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":177,"id":2917,"nodeType":"Class","startLoc":126,"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 '<Identity({0})>'.format(self.n_inputs)\n        else:\n            return '<Identity({0}, name={1})>'.format(self.n_inputs, self.name)\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:`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":123,"id":2919,"nodeType":"Class","startLoc":12,"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:`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        if n_inputs is None:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(max(mapping) + 1))\n        else:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(n_inputs))\n        self._outputs = tuple('x' + str(idx) for idx in range(len(mapping)))\n        self._mapping = mapping\n        super().__init__(name=name, meta=meta)\n\n    @property\n    def inputs(self):\n        \"\"\"\n        The name(s) of the input variable(s) on which a model is evaluated.\n        \"\"\"\n\n        return self._inputs\n\n    @property\n    def outputs(self):\n        \"\"\"The name(s) of the output(s) of the model.\"\"\"\n\n        return self._outputs\n\n    @property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n\n        return self._mapping\n\n    def __repr__(self):\n        if self.name is None:\n            return '<Mapping({0})>'.format(self.mapping)\n        else:\n            return '<Mapping({0}, name={1})>'.format(self.mapping, self.name)\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('{0} expects {1} inputs; got {2}'.format(\n                name, self.n_inputs, 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 {0} 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        return inv"},{"className":"FittableModel","col":0,"comment":"\n    Base class for models that can be fitted using the built-in fitting\n    algorithms.\n    ","endLoc":2084,"id":2920,"nodeType":"Class","startLoc":2066,"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":"\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 overriden 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 : same as this frame\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        ","endLoc":692,"header":"def replicate_without_data(self, copy=False, **kwargs)","id":2921,"name":"replicate_without_data","nodeType":"Function","startLoc":664,"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 overriden 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 : same as this frame\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        kwargs['_framedata'] = None\n        return self._apply('copy' if copy else 'replicate', **kwargs)"},{"className":"TransformType","col":0,"comment":"null","endLoc":90,"id":2922,"nodeType":"Class","startLoc":15,"text":"class TransformType(AstropyAsdfType):\n    version = '1.1.0'\n    requires = ['astropy']\n\n    @classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'inverse' in node:\n            model.inverse = yamlutil.tagged_tree_to_custom_tree(\n                node['inverse'], ctx)\n\n        if 'name' in node:\n            model = model.rename(node['name'])\n\n        # TODO: Remove domain in a later version.\n        if 'domain' in node:\n            model.bounding_box = cls._domain_to_bounding_box(node['domain'])\n        elif 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        return model\n\n    @classmethod\n    def _domain_to_bounding_box(cls, domain):\n        bb = tuple([(item['lower'], item['upper']) for item in domain])\n        if len(bb) == 1:\n            bb = bb[0]\n        return bb\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        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model\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'] = yamlutil.custom_tree_to_tagged_tree(\n            model._user_inverse, ctx)\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if bb is not None:\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in model.bounding_box]\n            node['bounding_box'] = bb\n\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        cls._to_tree_base_transform_members(model, node, ctx)\n        return node\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"},{"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        representation : BaseRepresentation\n            The representation to use as the data for the new frame.\n\n        Returns\n        -------\n        frameobj : same as this frame\n            A new object with the same frame attributes as this one, but\n            with the ``representation`` as the data.\n        ","endLoc":716,"header":"def realize_frame(self, representation)","id":2923,"name":"realize_frame","nodeType":"Function","startLoc":694,"text":"def realize_frame(self, representation):\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        representation : BaseRepresentation\n            The representation to use as the data for the new frame.\n\n        Returns\n        -------\n        frameobj : same as this frame\n            A new object with the same frame attributes as this one, but\n            with the ``representation`` as the data.\n        \"\"\"\n        # Here we pass representation_cls=None to _apply, since we do not want\n        # to insist that the realized frame has the same representation as\n        # self.  [Avoids breaking sunpy; see gh-6208]\n        # TODO: should we expose this, so one has a choice?\n        return self._apply('replicate', _framedata=representation,\n                           representation_cls=None)"},{"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 = CartesianRepresentation\n        >>> coord  # doctest: +FLOAT_CMP\n        <SkyCoord (ICRS): (x, y, z) [dimensionless]\n            (1., 0., 0.)>\n        ","endLoc":869,"header":"def represent_as(self, base, s='base', in_frame_units=False)","id":2925,"name":"represent_as","nodeType":"Function","startLoc":718,"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 = 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            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                # 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)) and\n                                comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential) and\n                              comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        if new_attr_unit and hasattr(diff, comp):\n                            diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\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 .representation and\n                    # .differential_cls don't point to the original classes, if\n                    # the input differential is a RadialDifferential, it usually\n                    # gets turned into a SphericalCosLatDifferential (or\n                    # whatever the default is) with strange units for the d_lon\n                    # and d_lat attributes. This then causes the dictionary key\n                    # check to fail (i.e. comparison against\n                    # `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n                    # data = data.with_differentials({'s': diff})\n\n            self.cache['representation'][cache_key] = data\n\n        return self.cache['representation'][cache_key]"},{"col":4,"comment":"null","endLoc":240,"header":"def __set__(self, instance, value)","id":2926,"name":"__set__","nodeType":"Function","startLoc":229,"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            for attr in info.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":243,"header":"def __getstate__(self)","id":2927,"name":"__getstate__","nodeType":"Function","startLoc":242,"text":"def __getstate__(self):\n        return self._attrs"},{"col":4,"comment":"null","endLoc":246,"header":"def __setstate__(self, state)","id":2928,"name":"__setstate__","nodeType":"Function","startLoc":245,"text":"def __setstate__(self, state):\n        self._attrs = state"},{"col":4,"comment":"null","endLoc":268,"header":"def __getattr__(self, attr)","id":2929,"name":"__getattr__","nodeType":"Function","startLoc":248,"text":"def __getattr__(self, attr):\n        if attr.startswith('_'):\n            return super().__getattribute__(attr)\n\n        if attr in self.attrs_from_parent:\n            return getattr(self._parent, attr)\n\n        try:\n            value = self._attrs[attr]\n        except KeyError:\n            super().__getattribute__(attr)  # Generate AttributeError\n\n        # Weak ref for parent table\n        if attr == 'parent_table' and callable(value):\n            value = value()\n\n        # Mixins have a default dtype of Object if nothing else was set\n        if attr == 'dtype' and value is None:\n            value = np.dtype('O')\n\n        return value"},{"col":4,"comment":"null","endLoc":34,"header":"@classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx)","id":2930,"name":"_from_tree_base_transform_members","nodeType":"Function","startLoc":19,"text":"@classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'inverse' in node:\n            model.inverse = yamlutil.tagged_tree_to_custom_tree(\n                node['inverse'], ctx)\n\n        if 'name' in node:\n            model = model.rename(node['name'])\n\n        # TODO: Remove domain in a later version.\n        if 'domain' in node:\n            model.bounding_box = cls._domain_to_bounding_box(node['domain'])\n        elif 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        return model"},{"col":4,"comment":"null","endLoc":41,"header":"@classmethod\n    def _domain_to_bounding_box(cls, domain)","id":2931,"name":"_domain_to_bounding_box","nodeType":"Function","startLoc":36,"text":"@classmethod\n    def _domain_to_bounding_box(cls, domain):\n        bb = tuple([(item['lower'], item['upper']) for item in domain])\n        if len(bb) == 1:\n            bb = bb[0]\n        return bb"},{"col":4,"comment":"null","endLoc":46,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2932,"name":"from_tree_transform","nodeType":"Function","startLoc":43,"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":52,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":2933,"name":"from_tree","nodeType":"Function","startLoc":48,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        model = cls.from_tree_transform(node, ctx)\n        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model"},{"col":4,"comment":"null","endLoc":73,"header":"@classmethod\n    def _to_tree_base_transform_members(cls, model, node, ctx)","id":2934,"name":"_to_tree_base_transform_members","nodeType":"Function","startLoc":54,"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'] = yamlutil.custom_tree_to_tagged_tree(\n            model._user_inverse, ctx)\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if bb is not None:\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in model.bounding_box]\n            node['bounding_box'] = bb"},{"col":4,"comment":"null","endLoc":78,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":2935,"name":"to_tree_transform","nodeType":"Function","startLoc":76,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        raise NotImplementedError(\"Must be implemented in TransformType subclasses\")"},{"col":4,"comment":"null","endLoc":1005,"header":"def __init__(self, x, y=None, z=None, unit=None, xyz_axis=None,\n                 differentials=None, copy=True)","id":2936,"name":"__init__","nodeType":"Function","startLoc":981,"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 xyz_axis is not None and xyz_axis != 0:\n                x = np.rollaxis(x, xyz_axis, 0)\n            x, y, z = x\n        elif 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        elif (y is None and z is not None) or (y is not None and z is None):\n            raise ValueError(\"x, y, and z are required to instantiate {0}\"\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.physical_type ==\n                self._y.unit.physical_type == self._z.unit.physical_type):\n            raise u.UnitsError(\"x, y, and z should have matching physical types\")"},{"col":4,"comment":"null","endLoc":84,"header":"@classmethod\n    def to_tree(cls, model, ctx)","id":2937,"name":"to_tree","nodeType":"Function","startLoc":80,"text":"@classmethod\n    def to_tree(cls, model, ctx):\n        node = cls.to_tree_transform(model, ctx)\n        cls._to_tree_base_transform_members(model, node, ctx)\n        return node"},{"col":4,"comment":"null","endLoc":90,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":2938,"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        assert a.name == b.name\n        # TODO: Assert inverses are the same"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":2939,"name":"version","nodeType":"Attribute","startLoc":16,"text":"version"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":2940,"name":"requires","nodeType":"Attribute","startLoc":17,"text":"requires"},{"className":"AffineType","col":0,"comment":"null","endLoc":45,"id":2941,"nodeType":"Class","startLoc":15,"text":"class AffineType(TransformType):\n    name = \"transform/affine\"\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        node = {'matrix': model.matrix.value, 'translation': model.translation.value}\n        return yamlutil.custom_tree_to_tagged_tree(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 (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":32,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2942,"name":"from_tree_transform","nodeType":"Function","startLoc":19,"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)"},{"className":"ShiftType","col":0,"comment":"null","endLoc":40,"id":2943,"nodeType":"Class","startLoc":16,"text":"class ShiftType(TransformType):\n    name = \"transform/shift\"\n    types = ['astropy.modeling.models.Shift']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if 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        return {'offset': model.offset.value}\n        #return yamlutil.custom_tree_to_tagged_tree(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 (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":37,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":2944,"name":"to_tree_transform","nodeType":"Function","startLoc":34,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'matrix': model.matrix.value, 'translation': model.translation.value}\n        return yamlutil.custom_tree_to_tagged_tree(node, ctx)"},{"col":4,"comment":"null","endLoc":45,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":2945,"name":"assert_equal","nodeType":"Function","startLoc":39,"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":4,"comment":"null","endLoc":299,"header":"def __setattr__(self, attr, value)","id":2946,"name":"__setattr__","nodeType":"Function","startLoc":270,"text":"def __setattr__(self, attr, value):\n        propobj = getattr(self.__class__, attr, None)\n\n        # If attribute is taken from parent properties and there is not a\n        # class property (getter/setter) for this attribute then set\n        # attribute directly in parent.\n        if attr in self.attrs_from_parent and not isinstance(propobj, property):\n            setattr(self._parent, attr, value)\n            return\n\n        # Check if there is a property setter and use it if possible.\n        if isinstance(propobj, property):\n            if propobj.fset is None:\n                raise AttributeError(\"can't set attribute\")\n            propobj.fset(self, value)\n            return\n\n        # Private attr names get directly set\n        if attr.startswith('_'):\n            super().__setattr__(attr, value)\n            return\n\n        # Finally this must be an actual data attribute that this class is handling.\n        if attr not in self.attr_names:\n            raise AttributeError(\"attribute must be one of {0}\".format(self.attr_names))\n\n        if attr == 'parent_table':\n            value = None if value is None else weakref.ref(value)\n\n        self._attrs[attr] = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":2947,"name":"name","nodeType":"Attribute","startLoc":16,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":2948,"name":"types","nodeType":"Attribute","startLoc":17,"text":"types"},{"className":"Rotate2DType","col":0,"comment":"null","endLoc":66,"id":2949,"nodeType":"Class","startLoc":48,"text":"class Rotate2DType(TransformType):\n    name = \"transform/rotate2d\"\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': model.angle.value}\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":27,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2950,"name":"from_tree_transform","nodeType":"Function","startLoc":20,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        offset = node['offset']\n        if 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":"null","endLoc":481,"header":"def __init__(self, *args, differentials=None, **kwargs)","id":2951,"name":"__init__","nodeType":"Function","startLoc":478,"text":"def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\n        self._differentials = self._validate_differentials(differentials)"},{"col":4,"comment":"Get the values for the parent ``attrs`` and return as a dict.","endLoc":303,"header":"def _represent_as_dict(self)","id":2952,"name":"_represent_as_dict","nodeType":"Function","startLoc":301,"text":"def _represent_as_dict(self):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\"\"\"\n        return _get_obj_attrs_map(self._parent, self._represent_as_dict_attrs)"},{"col":4,"comment":"null","endLoc":54,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2953,"name":"from_tree_transform","nodeType":"Function","startLoc":52,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return modeling.rotations.Rotation2D(node['angle'])"},{"col":0,"comment":"\n    Get the values for object ``attrs`` and return as a dict.  This\n    ignores any attributes that are None and in Py2 converts any unicode\n    attribute names or values to str.  In the context of serializing the\n    supported core astropy classes this conversion will succeed and results\n    in more succinct and less python-specific YAML.\n    ","endLoc":165,"header":"def _get_obj_attrs_map(obj, attrs)","id":2954,"name":"_get_obj_attrs_map","nodeType":"Function","startLoc":151,"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 and in Py2 converts any unicode\n    attribute names or values to str.  In the context of serializing the\n    supported core astropy classes this conversion will succeed and results\n    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":306,"header":"def _construct_from_dict(self, map)","id":2955,"name":"_construct_from_dict","nodeType":"Function","startLoc":305,"text":"def _construct_from_dict(self, map):\n        return self._parent_cls(**map)"},{"col":4,"comment":"null","endLoc":58,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":2956,"name":"to_tree_transform","nodeType":"Function","startLoc":56,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'angle': model.angle.value}"},{"col":4,"comment":"null","endLoc":66,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":2957,"name":"assert_equal","nodeType":"Function","startLoc":60,"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)"},{"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, function, list of (str or function)\n            Info option, defaults to 'attributes'.\n        out : file-like object, 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 : OrderedDict if out==None else None\n        ","endLoc":415,"header":"def __call__(self, option='attributes', out='')","id":2958,"name":"__call__","nodeType":"Function","startLoc":319,"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, function, list of (str or function)\n            Info option, defaults to 'attributes'.\n        out : file-like object, 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 : 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={0} 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:\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('{0} = {1}'.format(key, val) + os.linesep)"},{"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":542,"header":"def _validate_differentials(self, differentials)","id":2959,"name":"_validate_differentials","nodeType":"Function","startLoc":483,"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:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\")\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 '{0}', expected \"\n                                     \"unit key = '{1}' but received key = '{2}'\"\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 ({0} vs \"\n                                 \"{1})\".format(diff.shape, self.shape))\n\n        return differentials"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":2960,"name":"name","nodeType":"Attribute","startLoc":49,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":2961,"name":"types","nodeType":"Attribute","startLoc":50,"text":"types"},{"className":"Rotate3DType","col":0,"comment":"null","endLoc":139,"id":2962,"nodeType":"Class","startLoc":69,"text":"class Rotate3DType(TransformType):\n    name = \"transform/rotate3d\"\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\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                return {\"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                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                return {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            return {\"phi\": model.phi.value,\n                    \"theta\": model.theta.value,\n                    \"psi\": model.psi.value,\n                    \"direction\": model.axes_order\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 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":89,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2963,"name":"from_tree_transform","nodeType":"Function","startLoc":75,"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":125,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":2964,"name":"to_tree_transform","nodeType":"Function","startLoc":92,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        if isinstance(model, modeling.rotations.RotateNative2Celestial):\n            try:\n                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"native2celestial\"\n                        }\n            except AttributeError:\n                return {\"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                return {\"phi\": model.lon.value,\n                        \"theta\": model.lat.value,\n                        \"psi\": model.lon_pole.value,\n                        \"direction\": \"celestial2native\"\n                        }\n            except AttributeError:\n                return {\"phi\": model.lon,\n                        \"theta\": model.lat,\n                        \"psi\": model.lon_pole,\n                        \"direction\": \"celestial2native\"\n                        }\n        else:\n            return {\"phi\": model.phi.value,\n                    \"theta\": model.theta.value,\n                    \"psi\": model.psi.value,\n                    \"direction\": model.axes_order\n                    }"},{"col":4,"comment":"null","endLoc":139,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":2965,"name":"assert_equal","nodeType":"Function","startLoc":127,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":70,"id":2966,"name":"name","nodeType":"Attribute","startLoc":70,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":71,"id":2967,"name":"types","nodeType":"Attribute","startLoc":71,"text":"types"},{"className":"GenericProjectionType","col":0,"comment":"null","endLoc":171,"id":2968,"nodeType":"Class","startLoc":142,"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":152,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":2969,"name":"from_tree_transform","nodeType":"Function","startLoc":143,"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)"},{"col":4,"comment":"\n        Transform this object's coordinate data to a new frame.\n\n        Parameters\n        ----------\n        new_frame : class or frame object or SkyCoord object\n            The frame to transform this coordinate frame into.\n\n        Returns\n        -------\n        transframe\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":922,"header":"def transform_to(self, new_frame)","id":2970,"name":"transform_to","nodeType":"Function","startLoc":871,"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 : class or frame object or SkyCoord object\n            The frame to transform this coordinate frame into.\n\n        Returns\n        -------\n        transframe\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) and\n           hasattr(self, 'obstime') and hasattr(new_frame, 'obstime') and\n           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            # 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)"},{"col":4,"comment":"null","endLoc":165,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":2971,"name":"to_tree_transform","nodeType":"Function","startLoc":154,"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":"null","endLoc":171,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":2972,"name":"assert_equal","nodeType":"Function","startLoc":167,"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__"},{"col":0,"comment":"null","endLoc":217,"header":"def make_projection_types()","id":2973,"name":"make_projection_types","nodeType":"Function","startLoc":204,"text":"def make_projection_types():\n    for tag_name, (name, params) in _generic_projections.items():\n        class_name = '{0}Type'.format(name)\n        types = ['astropy.modeling.projections.Pix2Sky_{0}'.format(name),\n                 'astropy.modeling.projections.Sky2Pix_{0}'.format(name)]\n\n        globals()[class_name] = type(\n            str(class_name),\n            (GenericProjectionType,),\n            {'name': 'transform/{0}'.format(tag_name),\n             'types': types,\n             'params': params})\n\n        __all__.append(class_name)"},{"col":4,"comment":"null","endLoc":423,"header":"def __repr__(self)","id":2974,"name":"__repr__","nodeType":"Function","startLoc":417,"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()"},{"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":861,"header":"def norm(self)","id":2975,"name":"norm","nodeType":"Function","startLoc":844,"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":0,"comment":"null","endLoc":12,"id":2976,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":174,"id":2977,"name":"_generic_projections","nodeType":"Attribute","startLoc":174,"text":"_generic_projections"},{"col":0,"comment":"","endLoc":4,"header":"projections.py#<anonymous>","id":2978,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType']\n\n_generic_projections = {\n    'zenithal_perspective': ('ZenithalPerspective', (('mu', 0.0), ('gamma', 0.0))),\n    'gnomonic': ('Gnomonic', ()),\n    'stereographic': ('Stereographic', ()),\n    'slant_orthographic': ('SlantOrthographic', (('xi', 0.0), ('eta', 0.0))),\n    'zenithal_equidistant': ('ZenithalEquidistant', ()),\n    'zenithal_equal_area': ('ZenithalEqualArea', ()),\n    'airy': ('Airy', (('theta_b', 90.0),)),\n    'cylindrical_perspective': ('CylindricalPerspective', (('mu', 0.0), ('lam', 0.0))),\n    'cylindrical_equal_area': ('CylindricalEqualArea', (('lam', 0.0),)),\n    'plate_carree': ('PlateCarree', ()),\n    'mercator': ('Mercator', ()),\n    'sanson_flamsteed': ('SansonFlamsteed', ()),\n    'parabolic': ('Parabolic', ()),\n    'molleweide': ('Molleweide', ()),\n    'hammer_aitoff': ('HammerAitoff', ()),\n    'conic_perspective': ('ConicPerspective', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_equal_area': ('ConicEqualArea', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_equidistant': ('ConicEquidistant', (('sigma', 0.0), ('delta', 0.0))),\n    'conic_orthomorphic': ('ConicOrthomorphic', (('sigma', 0.0), ('delta', 0.0))),\n    'bonne_equal_area': ('BonneEqualArea', (('theta1', 0.0),)),\n    'polyconic': ('Polyconic', ()),\n    'tangential_spherical_cube': ('TangentialSphericalCube', ()),\n    'cobe_quad_spherical_cube': ('COBEQuadSphericalCube', ()),\n    'quad_spherical_cube': ('QuadSphericalCube', ()),\n    'healpix': ('HEALPix', (('H', 4.0), ('X', 3.0))),\n    'healpix_polar': ('HEALPixPolar', ())\n}\n\nmake_projection_types()"},{"attributeType":"null","col":4,"comment":"null","endLoc":203,"id":2979,"name":"_stats","nodeType":"Attribute","startLoc":203,"text":"_stats"},{"attributeType":"null","col":4,"comment":"null","endLoc":204,"id":2980,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":204,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":205,"id":2981,"name":"attr_names","nodeType":"Attribute","startLoc":205,"text":"attr_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":206,"id":2982,"name":"_attrs_no_copy","nodeType":"Attribute","startLoc":206,"text":"_attrs_no_copy"},{"fileName":"tabular.py","filePath":"astropy/io/misc/asdf/tags/transform","id":2983,"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 import yamlutil\n\nfrom astropy import modeling\nfrom .basic import TransformType\n\n\n__all__ = ['TabularType']\n\n\nclass TabularType(TransformType):\n    name = \"transform/tabular\"\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        name = node.get('name', None)\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, name=name)\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, name=name)\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, name=name)\n\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\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        node[\"name\"] = model.name\n        return yamlutil.custom_tree_to_tagged_tree(node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        assert_array_equal(a.lookup_table, b.lookup_table)\n        assert_array_equal(a.points, b.points)\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":207,"id":2984,"name":"_info_summary_attrs","nodeType":"Attribute","startLoc":207,"text":"_info_summary_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":208,"id":2985,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":208,"text":"_represent_as_dict_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":209,"id":2986,"name":"_parent","nodeType":"Attribute","startLoc":209,"text":"_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":308,"id":2987,"name":"info_summary_attributes","nodeType":"Attribute","startLoc":308,"text":"info_summary_attributes"},{"col":4,"comment":"The X component of the geocentric coordinates.","endLoc":687,"header":"@property\n    def x(self)","id":2988,"name":"x","nodeType":"Function","startLoc":684,"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":692,"header":"@property\n    def y(self)","id":2989,"name":"y","nodeType":"Function","startLoc":689,"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":697,"header":"@property\n    def z(self)","id":2990,"name":"z","nodeType":"Function","startLoc":694,"text":"@property\n    def z(self):\n        \"\"\"The Z component of the geocentric coordinates.\"\"\"\n        return self['z']"},{"col":4,"comment":"null","endLoc":704,"header":"def __getitem__(self, item)","id":2991,"name":"__getitem__","nodeType":"Function","startLoc":699,"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":"\n        Determines if this coordinate frame can be transformed to another\n        given frame.\n\n        Parameters\n        ----------\n        new_frame : class or frame object\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":966,"header":"def is_transformable_to(self, new_frame)","id":2992,"name":"is_transformable_to","nodeType":"Function","startLoc":924,"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 : class or frame object\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\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":314,"id":2993,"name":"info_summary_stats","nodeType":"Attribute","startLoc":314,"text":"info_summary_stats"},{"attributeType":"null","col":12,"comment":"null","endLoc":215,"id":2994,"name":"_attrs","nodeType":"Attribute","startLoc":215,"text":"self._attrs"},{"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":985,"header":"def is_frame_attr_default(self, attrnm)","id":2995,"name":"is_frame_attr_default","nodeType":"Function","startLoc":968,"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":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 : 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":1020,"header":"def is_equivalent_frame(self, other)","id":2996,"name":"is_equivalent_frame","nodeType":"Function","startLoc":987,"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 : 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 np.any(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"},{"col":4,"comment":"null","endLoc":454,"header":"def __init__(self, bound=False)","id":2997,"name":"__init__","nodeType":"Function","startLoc":448,"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 = {}"},{"className":"TabularType","col":0,"comment":"null","endLoc":71,"id":2998,"nodeType":"Class","startLoc":16,"text":"class TabularType(TransformType):\n    name = \"transform/tabular\"\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        name = node.get('name', None)\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, name=name)\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, name=name)\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, name=name)\n\n        return model\n\n    @classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\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        node[\"name\"] = model.name\n        return yamlutil.custom_tree_to_tagged_tree(node, ctx)\n\n    @classmethod\n    def assert_equal(cls, a, b):\n        assert_array_equal(a.lookup_table, b.lookup_table)\n        assert_array_equal(a.points, b.points)\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":709,"header":"def __array_finalize__(self, obj)","id":2999,"name":"__array_finalize__","nodeType":"Function","startLoc":706,"text":"def __array_finalize__(self, obj):\n        super().__array_finalize__(obj)\n        if hasattr(obj, '_ellipsoid'):\n            self._ellipsoid = obj._ellipsoid"},{"col":4,"comment":"null","endLoc":683,"header":"def __init__(self, *args, meta=None, name=None, **kwargs)","id":3000,"name":"__init__","nodeType":"Function","startLoc":673,"text":"def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n\n        self._initialize_constraints(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)"},{"col":4,"comment":"\n        This is a mixin-safe version of Column.iter_str_vals.\n        ","endLoc":468,"header":"def iter_str_vals(self)","id":3001,"name":"iter_str_vals","nodeType":"Function","startLoc":456,"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 ..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":715,"header":"def __len__(self)","id":3002,"name":"__len__","nodeType":"Function","startLoc":711,"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":"null","endLoc":47,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3003,"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        name = node.get('name', None)\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, name=name)\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, name=name)\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, name=name)\n\n        return model"},{"col":4,"comment":"Helper method for to and to_value.","endLoc":726,"header":"def _to_value(self, unit, equivalencies=[])","id":3004,"name":"_to_value","nodeType":"Function","startLoc":717,"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)"},{"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":506,"header":"def adjust_indices(self, index, value, col_len)","id":3005,"name":"adjust_indices","nodeType":"Function","startLoc":470,"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":"null","endLoc":1034,"header":"def __repr__(self)","id":3006,"name":"__repr__","nodeType":"Function","startLoc":1022,"text":"def __repr__(self):\n        frameattrs = self._frame_attrs_repr()\n        data_repr = self._data_repr()\n\n        if frameattrs:\n            frameattrs = ' ({0})'.format(frameattrs)\n\n        if data_repr:\n            return '<{0} Coordinate{1}: {2}>'.format(self.__class__.__name__,\n                                                     frameattrs, data_repr)\n        else:\n            return '<{0} Frame{1}>'.format(self.__class__.__name__,\n                                           frameattrs)"},{"col":4,"comment":"\n        Returns a string representation of the frame's attributes, if any.\n        ","endLoc":1098,"header":"def _frame_attrs_repr(self)","id":3007,"name":"_frame_attrs_repr","nodeType":"Function","startLoc":1093,"text":"def _frame_attrs_repr(self):\n        \"\"\"\n        Returns a string representation of the frame's attributes, if any.\n        \"\"\"\n        return ', '.join([attrnm + '=' + str(getattr(self, attrnm))\n                          for attrnm in self.get_frame_attr_names()])"},{"col":8,"comment":"null","endLoc":734,"header":"def __repr__(self)","id":3008,"name":"__repr__","nodeType":"Function","startLoc":729,"text":"def __repr__(self):\n            # Use the numpy >=1.12 way to format structured arrays.\n            from .representation import _array2string\n            prefixstr = '<' + self.__class__.__name__ + ' '\n            arrstr = _array2string(self.view(np.ndarray), prefix=prefixstr)\n            return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)"},{"col":4,"comment":"Returns a string representation of the coordinate data.","endLoc":1091,"header":"def _data_repr(self)","id":3009,"name":"_data_repr","nodeType":"Function","startLoc":1036,"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:\n            if (issubclass(self.representation, r.SphericalRepresentation) and\n                    isinstance(self.data, r.UnitSphericalRepresentation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation\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            for nmpref, nmrepr in self.representation_component_names.items():\n                data_repr = data_repr.replace(nmrepr, nmpref)\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":0,"comment":"null","endLoc":69,"header":"def _array2string(values, prefix='')","id":3010,"name":"_array2string","nodeType":"Function","startLoc":42,"text":"def _array2string(values, prefix=''):\n    # Mimic numpy >=1.12 array2string, in which structured arrays are\n    # typeset taking into account all printoptions.\n    kwargs = {'separator': ', ', 'prefix': prefix}\n    if NUMPY_LT_1_12:  # pragma: no cover\n        # Mimic StructureFormat from numpy >=1.12 assuming float-only data.\n        from numpy.core.arrayprint import FloatFormat\n        opts = np.get_printoptions()\n        format_functions = [FloatFormat(np.atleast_1d(values[component]).ravel(),\n                                        precision=opts['precision'],\n                                        suppress_small=opts['suppress'])\n                            for component in values.dtype.names]\n\n        def fmt(x):\n            return '({})'.format(', '.join(format_function(field)\n                                           for field, format_function in\n                                           zip(x, format_functions)))\n        # Before 1.12, structures arrays were set as \"numpystr\",\n        # so that is the formmater we need to replace.\n        kwargs['formatter'] = {'numpystr': fmt}\n        kwargs['style'] = fmt\n\n    else:\n        kwargs['formatter'] = {}\n        if NUMPY_LT_1_14:  # in 1.14, style is no longer used (and deprecated)\n            kwargs['style'] = repr\n\n    return np.array2string(values, **kwargs)"},{"col":4,"comment":"\n        Given a sliced object, modify its indices\n        to correctly represent the slice.\n\n        Parameters\n        ----------\n        col_slice : Column or mixin\n            Sliced object\n        item : slice, list, or ndarray\n            Slice used to create col_slice\n        col_len : int\n            Length of original object\n        ","endLoc":548,"header":"def slice_indices(self, col_slice, item, col_len)","id":3011,"name":"slice_indices","nodeType":"Function","startLoc":508,"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 : Column or mixin\n            Sliced object\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 ..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            threshold = 0.6\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":177,"id":3012,"name":"_ellipsoid","nodeType":"Attribute","startLoc":177,"text":"_ellipsoid"},{"attributeType":"null","col":4,"comment":"null","endLoc":178,"id":3013,"name":"_location_dtype","nodeType":"Attribute","startLoc":178,"text":"_location_dtype"},{"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 'abc.Tabular2D'>\n    Name: Tabular2D\n    Inputs: (u'x0', u'x1')\n    Outputs: (u'y',)\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":291,"header":"def tabular_model(dim, name=None)","id":3014,"name":"tabular_model","nodeType":"Function","startLoc":235,"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 'abc.Tabular2D'>\n    Name: Tabular2D\n    Inputs: (u'x0', u'x1')\n    Outputs: (u'y',)\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    inputs = tuple('x{0}'.format(idx) for idx in range(table.ndim))\n    members = {'lookup_table': table, 'inputs': inputs}\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 = 'Tabular{0}'.format(model_id)\n\n    return type(str(name), (_Tabular,), members)"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":3015,"name":"_array_dtype","nodeType":"Attribute","startLoc":180,"text":"_array_dtype"},{"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    This class sets the constraints and other properties for all individual\n    parameters and performs parameter validation.\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.\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        Dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list of length 2\n        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":2063,"id":3016,"nodeType":"Class","startLoc":480,"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    This class sets the constraints and other properties for all individual\n    parameters and performs parameter validation.\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.\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        Dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list of length 2\n        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    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    inputs = ()\n    \"\"\"The name(s) of the input variable(s) on which a model is evaluated.\"\"\"\n    outputs = ()\n    \"\"\"The name(s) of the output(s) of the model.\"\"\"\n\n    standard_broadcasting = True\n    fittable = False\n    linear = True\n\n    _separable = None\n    \"\"\" A boolean flag to indicate whether a model is separable.\"\"\"\n\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    # 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    # Enforce strict units on inputs to evaluate. If this is set to True, input\n    # values to evaluate have to be in the exact right units specified by\n    # input_units. In this case, if the input quantities are convertible to\n    # input_units, they are converted.\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.\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 model\n    # inputs. Only has an effect if input_units is defined.\n    input_units_equivalencies = None\n\n    def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n\n        self._initialize_constraints(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\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    def __call__(self, *inputs, **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\n        inputs, format_info = self.prepare_inputs(*inputs, **kwargs)\n\n        # Check whether any of the inputs are quantities\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n\n        parameters = self._param_sets(raw=True, units=True)\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n        bbox = None\n        if with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                bbox = None\n            if self.n_inputs > 1 and bbox is not None:\n                # bounding_box is in python order - convert it to the order of the inputs\n                bbox = bbox[::-1]\n            if bbox is None:\n                outputs = self.evaluate(*chain(inputs, parameters))\n            else:\n                if self.n_inputs == 1:\n                    bbox = [bbox]\n                # indices where input is outside the bbox\n                # have a value of 1 in ``nan_ind``\n                nan_ind = np.zeros(inputs[0].shape, dtype=bool)\n                for ind, inp in enumerate(inputs):\n                    # Pass an ``out`` array so that ``axis_ind`` is array for scalars as well.\n                    axis_ind = np.zeros(inp.shape, dtype=bool)\n                    axis_ind = np.logical_or(inp < bbox[ind][0], inp > bbox[ind][1], out=axis_ind)\n                    nan_ind[axis_ind] = 1\n                # get an array with indices of valid inputs\n                valid_ind = np.logical_not(nan_ind).nonzero()\n                # inputs holds only inputs within the bbox\n                args = []\n                for input in inputs:\n                    if not input.shape:\n                        # shape is ()\n                        if nan_ind:\n                            outputs = [fill_value for a in args]\n                        else:\n                            args.append(input)\n                    else:\n                        args.append(input[valid_ind])\n                valid_result = self.evaluate(*chain(args, parameters))\n                if self.n_outputs == 1:\n                    valid_result = [valid_result]\n                # combine the valid results with the ``fill_value`` values\n                # outside the bbox\n                result = [np.zeros(inputs[0].shape) + fill_value for i in range(len(valid_result))]\n                for ind, r in enumerate(valid_result):\n                    if not result[ind].shape:\n                        # shape is ()\n                        result[ind] = r\n                    else:\n                        result[ind][valid_ind] = r\n                # format output\n                if self.n_outputs == 1:\n                    outputs = np.asarray(result[0])\n                else:\n                    outputs = [np.asarray(r) for r in result]\n        else:\n            outputs = self.evaluate(*chain(inputs, parameters))\n        if self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(format_info, *outputs, **kwargs)\n\n        # If input values were quantities, we use return_units to cast\n        # the return values to the units specified by return_units.\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[out_name], subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        else:\n            return outputs\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\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 n_inputs(self):\n        \"\"\"\n        The number of inputs to this model.\n\n        Equivalent to ``len(model.inputs)``.\n        \"\"\"\n\n        return len(self.inputs)\n\n    @property\n    def n_outputs(self):\n        \"\"\"\n        The number of outputs from this model.\n\n        Equivalent to ``len(model.outputs)``.\n        \"\"\"\n        return len(self.outputs)\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 `Model Sets\n        <http://docs.astropy.org/en/stable/modeling/models.html#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        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\n    @property\n    def fixed(self):\n        \"\"\"\n        A `dict` mapping parameter names to their fixed constraint.\n        \"\"\"\n\n        return self._constraints['fixed']\n\n    @property\n    def tied(self):\n        \"\"\"\n        A `dict` mapping parameter names to their tied constraint.\n        \"\"\"\n\n        return self._constraints['tied']\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.\n        \"\"\"\n\n        return self._constraints['bounds']\n\n    @property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._constraints['eqcons']\n\n    @property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._constraints['ineqcons']\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\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            return self._inverse()\n\n        raise NotImplementedError(\"An analytical inverse transform has not \"\n                                  \"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        del self._user_inverse\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\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        `None` 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:`bounding-boxes`\n\n        The limits are ordered according to the `numpy` 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          File \"<stdin>\", line 1, in <module>\n          File \"astropy\\modeling\\core.py\", line 980, in bounding_box\n            \"No bounding box is defined for this model (note: the \"\n        NotImplementedError: No bounding box is defined for this model (note:\n        the bounding box was explicitly disabled for this model; use `del\n        model.bounding_box` to restore the default bounding box, if one is\n        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, _BoundingBox):\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 self._bounding_box()\n        else:\n            # The only other allowed possibility is that it's a _BoundingBox\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(self._bounding_box, type) and\n                issubclass(self._bounding_box, _BoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = _BoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box\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 separable(self):\n        \"\"\" A flag indicating whether a model is separable.\"\"\"\n\n        if self._separable is not None:\n            return self._separable\n        else:\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 been\n        converted to the right units for the data, then the units have been\n        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 necessarily\n        the units of the input data, but are derived from them. Model subclasses\n        that 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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, outputs_unit)\n\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        return model\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 of\n        the input data, but are derived from them. Model subclasses that want\n        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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, 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, hence\n        # 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 the\n            returned array. If this is not provided (or None), the model will be\n            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 passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of this\n            model is not set.\n\n        Examples\n        --------\n        :ref:`bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\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, dtype=float)\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 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 overriden 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    @input_units.setter\n    def input_units(self, input_units):\n        self._input_units = input_units\n\n    @property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the output\n        of evaluate should be in, and returns a dictionary mapping outputs 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 output units, in which case this property should not be\n        overriden 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    @return_units.setter\n    def return_units(self, return_units):\n        self._return_units = return_units\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\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\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        n_models = len(self)\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        _validate_input_shapes(inputs, self.inputs, n_models,\n                               model_set_axis, self.standard_broadcasting)\n\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n\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                                                                 equivalencies,\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(input_unit, 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 because\n                        # some equivalencies are non-linear, and we need to be\n                        # sure that we evaluate the model in its own frame\n                        # of reference. If input_units_strict is set, we also\n                        # need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict:\n                            inputs[i] = inputs[i].to(input_unit, 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(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required dimensionless \"\n                                             \"input\".format(self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{3} ({4})\".format(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 and\n                       input_unit is not dimensionless_unscaled and input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"Units of input '{0}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{1} ({2})\".format(self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\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 n_models == 1:\n            return _prepare_inputs_single_model(self, params, inputs,\n                                                **kwargs)\n        else:\n            return _prepare_inputs_model_set(self, params, inputs, n_models,\n                                             model_set_axis, **kwargs)\n\n    def prepare_outputs(self, format_info, *outputs, **kwargs):\n        if len(self) == 1:\n            return _prepare_outputs_single_model(self, outputs, format_info)\n        else:\n            return _prepare_outputs_model_set(self, outputs, format_info)\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 copy.deepcopy(self)\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    @sharedmethod\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    # *** Internal methods ***\n    @sharedmethod\n    def _from_existing(self, existing, param_names):\n        \"\"\"\n        Creates a new instance of ``cls`` that shares its underlying parameter\n        values with an existing model instance given by ``existing``.\n\n        This is used primarily by compound models to return a view of an\n        individual component of a compound model.  ``param_names`` should be\n        the names of the parameters in the *existing* model to use as the\n        parameters in this new model.  Its length should equal the number of\n        parameters this model takes, so that it can map parameters on the\n        existing model to parameters on this model one-to-one.\n        \"\"\"\n\n        # Basically this is an alternative __init__\n        if isinstance(self, type):\n            # self is a class, not an instance\n            needs_initialization = True\n            dummy_args = (0,) * len(param_names)\n            self = self.__new__(self, *dummy_args)\n        else:\n            needs_initialization = False\n            self = self.copy()\n\n        aliases = dict(zip(self.param_names, param_names))\n        # This is basically an alternative _initialize_constraints\n        constraints = {}\n        for cons_type in self.parameter_constraints:\n            orig = existing._constraints[cons_type]\n            constraints[cons_type] = AliasDict(orig, aliases)\n\n        self._constraints = constraints\n\n        self._n_models = existing._n_models\n        self._model_set_axis = existing._model_set_axis\n        self._parameters = existing._parameters\n\n        self._param_metrics = defaultdict(dict)\n        for param_a, param_b in aliases.items():\n            # Take the param metrics info for the giving parameters in the\n            # existing model, and hand them to the appropriate parameters in\n            # the new model\n            self._param_metrics[param_a] = existing._param_metrics[param_b]\n\n        if needs_initialization:\n            self.__init__(*dummy_args)\n\n        return self\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        if hasattr(self, '_constraints'):\n            # Skip constraint initialization if it has already been handled via\n            # an alternate initialization\n            return\n\n        self._constraints = {}\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            self._constraints[constraint] = values.copy()\n\n            # Update with default parameter constraints\n            for param_name in self.param_names:\n                param = getattr(self, param_name)\n\n                # Parameters don't have all constraint types\n                value = getattr(param, constraint)\n                if value is not None:\n                    self._constraints[constraint][param_name] = value\n\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._constraints[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        if hasattr(self, '_parameters'):\n            # Skip parameter initialization if it has already been handled via\n            # an alternate initialization\n            return\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                    (isinstance(model_set_axis, int) and\n                        not isinstance(model_set_axis, bool))):\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 = {}\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            params[self.param_names[idx]] = quantity_asanyarray(arg, dtype=float)\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 because\n                # if any of the arguments are quantities, we need to return a\n                # Quantity object not a plain Numpy array.\n                params[param_name] = quantity_asanyarray(value, dtype=float)\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, value in params.items():\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(params, max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(params, None)\n\n        self._n_models = n_models\n        self._initialize_parameter_values(params)\n\n    def _initialize_parameter_values(self, params):\n        # self._param_metrics should have been initialized in\n        # self._initialize_parameters\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            unit = None\n            param_descr = getattr(self, name)\n\n            if params.get(name) is None:\n                default = param_descr.default\n\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(\n                        \"{0}.__init__() requires a value for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, name))\n\n                value = params[name] = default\n                unit = param_descr.unit\n            else:\n                value = params[name]\n                if isinstance(value, Quantity):\n                    unit = value.unit\n                else:\n                    unit = None\n\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n\n            param_slice = slice(total_size, total_size + param_size)\n\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n\n            if unit is None and param_descr.unit is not None:\n                raise InputParameterError(\n                    \"{0}.__init__() requires a Quantity for parameter \"\n                    \"{1!r}\".format(self.__class__.__name__, name))\n\n            param_metrics[name]['orig_unit'] = unit\n            param_metrics[name]['raw_unit'] = None\n            if param_descr._setter is not None:\n                _val = param_descr._setter(value)\n                if isinstance(_val, Quantity):\n                    param_metrics[name]['raw_unit'] = _val.unit\n                else:\n                    param_metrics[name]['raw_unit'] = None\n            total_size += param_size\n\n        self._param_metrics = param_metrics\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        # TODO: This is a bit ugly, but easier to deal with than how this was\n        # done previously.  There's still lots of opportunity for refactoring\n        # though, in particular once we move the _get/set_model_value methods\n        # out of Parameter and into Model (renaming them\n        # _get/set_parameter_value)\n        for name, value in params.items():\n            # value here may be a Quantity object.\n            param_descr = getattr(self, name)\n            unit = param_descr.unit\n            value = np.array(value)\n            orig_unit = param_metrics[name]['orig_unit']\n            if param_descr._setter is not None:\n                if unit is not None:\n                    value = np.asarray(param_descr._setter(value * orig_unit).value)\n                else:\n                    value = param_descr._setter(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        for name in params:\n            param_descr = getattr(self, name)\n            param_descr.validator(param_descr.value)\n\n    def _check_param_broadcast(self, params, 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\n        all_shapes = []\n        param_names = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            # Previously this just used iteritems(params), but we loop over all\n            # param_names instead just to ensure some determinism in the\n            # ordering behavior\n            if name not in params:\n                continue\n\n            value = params[name]\n            param_names.append(name)\n            # We've already checked that each parameter array is compatible in\n            # the model_set_axis dimension, but now we need to check the\n            # dimensions excluding that axis\n            # Split the array dimensions into the axes before model_set_axis\n            # and after model_set_axis\n            param_shape = np.shape(value)\n\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 = param_names[shape_a_idx]\n            param_b = 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        param_metrics = self._param_metrics\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw:\n                value = param._raw_value\n            else:\n                value = param.value\n\n            broadcast_shape = 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 self._param_metrics[name]['raw_unit'] is not None:\n                    unit = self._param_metrics[name]['raw_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        # TODO: Returning an array from this method may be entirely pointless\n        # for internal use--perhaps only the external param_sets method should\n        # return an array (and just for backwards compat--I would prefer to\n        # maybe deprecate that method)\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        # TODO: I think this could be reworked to preset model sets better\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            \"{0}={1}\".format(name,\n                             param_repr_oneline(getattr(self, name)))\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append('name={0!r}'.format(self.name))\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] != value:\n                continue\n            parts.append('{0}={1!r}'.format(kwarg, value))\n\n        if len(self) > 1:\n            parts.append(\"n_models={0}\".format(len(self)))\n\n        return '<{0}({1})>'.format(self.__class__.__name__, ', '.join(parts))\n\n    def _format_str(self, keywords=[]):\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 = ['{0}: {1}'.format(keyword, value)\n                 for keyword, value in default_keywords + keywords\n                 if value is not None]\n\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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":182,"id":3017,"name":"info","nodeType":"Attribute","startLoc":182,"text":"info"},{"col":4,"comment":"null","endLoc":686,"header":"def __repr__(self)","id":3018,"name":"__repr__","nodeType":"Function","startLoc":685,"text":"def __repr__(self):\n        return self._format_repr()"},{"attributeType":"null","col":4,"comment":"null","endLoc":602,"id":3019,"name":"itrs","nodeType":"Attribute","startLoc":602,"text":"itrs"},{"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 of merged attributes\n\n        ","endLoc":602,"header":"@staticmethod\n    def merge_cols_attributes(cols, metadata_conflicts, name, attrs)","id":3020,"name":"merge_cols_attributes","nodeType":"Function","startLoc":550,"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 of merged attributes\n\n        \"\"\"\n        from ..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        return out"},{"attributeType":"null","col":18,"comment":"null","endLoc":470,"id":3021,"name":"_site_registry","nodeType":"Attribute","startLoc":470,"text":"cls._site_registry"},{"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":1197,"header":"@override__dir__\n    def __dir__(self)","id":3022,"name":"__dir__","nodeType":"Function","startLoc":1186,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":193,"id":3023,"name":"self","nodeType":"Attribute","startLoc":193,"text":"self"},{"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":1239,"header":"def __getattr__(self, attr)","id":3024,"name":"__getattr__","nodeType":"Function","startLoc":1199,"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, 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_cls 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."},{"attributeType":"null","col":8,"comment":"null","endLoc":499,"id":3025,"name":"_ellipsoid","nodeType":"Attribute","startLoc":499,"text":"self._ellipsoid"},{"col":4,"comment":"null","endLoc":58,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3027,"name":"to_tree_transform","nodeType":"Function","startLoc":49,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {}\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        node[\"name\"] = model.name\n        return yamlutil.custom_tree_to_tagged_tree(node, ctx)"},{"col":4,"comment":"null","endLoc":71,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3028,"name":"assert_equal","nodeType":"Function","startLoc":60,"text":"@classmethod\n    def assert_equal(cls, a, b):\n        assert_array_equal(a.lookup_table, b.lookup_table)\n        assert_array_equal(a.points, b.points)\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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":3029,"name":"BARYCENTRIC_SCALES","nodeType":"Attribute","startLoc":55,"text":"BARYCENTRIC_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":3030,"name":"FITS_DEPRECATED_SCALES","nodeType":"Attribute","startLoc":37,"text":"FITS_DEPRECATED_SCALES"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3031,"name":"name","nodeType":"Attribute","startLoc":17,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3032,"name":"types","nodeType":"Attribute","startLoc":18,"text":"types"},{"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":3033,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":3034,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"tabular.py#<anonymous>","id":3035,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['TabularType']"},{"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 objects\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":3036,"name":"common_dtype","nodeType":"Function","startLoc":35,"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 objects\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('Arrays have incompatible types {0}'\n                                 .format(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] = [(u'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"},{"fileName":"basic.py","filePath":"astropy/io/misc/asdf/tags/transform","id":3037,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\nfrom asdf import tagged, yamlutil\n\nfrom astropy.modeling import mappings\nfrom astropy.utils import minversion\nfrom astropy.modeling import functional_models\nfrom ...types import AstropyAsdfType\n\n\n__all__ = ['TransformType', 'IdentityType', 'ConstantType', 'DomainType']\n\n\nclass TransformType(AstropyAsdfType):\n    version = '1.1.0'\n    requires = ['astropy']\n\n    @classmethod\n    def _from_tree_base_transform_members(cls, model, node, ctx):\n        if 'inverse' in node:\n            model.inverse = yamlutil.tagged_tree_to_custom_tree(\n                node['inverse'], ctx)\n\n        if 'name' in node:\n            model = model.rename(node['name'])\n\n        # TODO: Remove domain in a later version.\n        if 'domain' in node:\n            model.bounding_box = cls._domain_to_bounding_box(node['domain'])\n        elif 'bounding_box' in node:\n            model.bounding_box = node['bounding_box']\n\n        return model\n\n    @classmethod\n    def _domain_to_bounding_box(cls, domain):\n        bb = tuple([(item['lower'], item['upper']) for item in domain])\n        if len(bb) == 1:\n            bb = bb[0]\n        return bb\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        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model\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'] = yamlutil.custom_tree_to_tagged_tree(\n            model._user_inverse, ctx)\n\n        if model.name is not None:\n            node['name'] = model.name\n\n        try:\n            bb = model.bounding_box\n        except NotImplementedError:\n            bb = None\n\n        if bb is not None:\n            if model.n_inputs == 1:\n                bb = list(bb)\n            else:\n                bb = [list(item) for item in model.bounding_box]\n            node['bounding_box'] = bb\n\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        cls._to_tree_base_transform_members(model, node, ctx)\n        return node\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\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    types = ['astropy.modeling.functional_models.Const1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Const1D(node['value'])\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'value': data.amplitude.value\n        }\n\n\nclass DomainType(AstropyAsdfType):\n    # TODO: Is this used anywhere? Can it be removed?\n    name = \"transform/domain\"\n    version = '1.0.0'\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return node\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        return data\n\n\nclass GenericModel(mappings.Mapping):\n    def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super(GenericModel, self).__init__(mapping)\n        self._outputs = tuple('x' + str(idx) for idx in range(self.n_outputs + 1))\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"},{"col":4,"comment":"null","endLoc":1251,"header":"def __setattr__(self, attr, value)","id":3038,"name":"__setattr__","nodeType":"Function","startLoc":1241,"text":"def __setattr__(self, attr, value):\n        repr_attr_names = set()\n        if hasattr(self, 'representation_info'):\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                'Cannot set any frame attribute {0}'.format(attr))\n        else:\n            super().__setattr__(attr, value)"},{"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":3039,"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'}"},{"className":"IdentityType","col":0,"comment":"null","endLoc":114,"id":3040,"nodeType":"Class","startLoc":93,"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":99,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3041,"name":"from_tree_transform","nodeType":"Function","startLoc":97,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return mappings.Identity(node.get('n_dims', 1))"},{"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":2024,"header":"def _format_repr(self, args=[], kwargs={}, defaults={})","id":3042,"name":"_format_repr","nodeType":"Function","startLoc":1995,"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        # TODO: I think this could be reworked to preset model sets better\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            \"{0}={1}\".format(name,\n                             param_repr_oneline(getattr(self, name)))\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append('name={0!r}'.format(self.name))\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] != value:\n                continue\n            parts.append('{0}={1!r}'.format(kwarg, value))\n\n        if len(self) > 1:\n            parts.append(\"n_models={0}\".format(len(self)))\n\n        return '<{0}({1})>'.format(self.__class__.__name__, ', '.join(parts))"},{"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            unintutive 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":1293,"header":"def separation(self, other)","id":3043,"name":"separation","nodeType":"Function","startLoc":1253,"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            unintutive 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":"\n        Pop parameter constraint values off the keyword arguments passed to\n        `Model.__init__` and store them in private instance attributes.\n        ","endLoc":1641,"header":"def _initialize_constraints(self, kwargs)","id":3044,"name":"_initialize_constraints","nodeType":"Function","startLoc":1613,"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        if hasattr(self, '_constraints'):\n            # Skip constraint initialization if it has already been handled via\n            # an alternate initialization\n            return\n\n        self._constraints = {}\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            self._constraints[constraint] = values.copy()\n\n            # Update with default parameter constraints\n            for param_name in self.param_names:\n                param = getattr(self, param_name)\n\n                # Parameters don't have all constraint types\n                value = getattr(param, constraint)\n                if value is not None:\n                    self._constraints[constraint][param_name] = value\n\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._constraints[constraint] = values"},{"col":0,"comment":"\n    Like array_repr_oneline but works on `Parameter` objects and supports\n    rendering parameters with units like quantities.\n    ","endLoc":911,"header":"def param_repr_oneline(param)","id":3045,"name":"param_repr_oneline","nodeType":"Function","startLoc":902,"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 = '{0} {1!s}'.format(out, param.unit)\n    return out"},{"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":1774,"header":"def _initialize_parameters(self, args, kwargs)","id":3047,"name":"_initialize_parameters","nodeType":"Function","startLoc":1643,"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        if hasattr(self, '_parameters'):\n            # Skip parameter initialization if it has already been handled via\n            # an alternate initialization\n            return\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                    (isinstance(model_set_axis, int) and\n                        not isinstance(model_set_axis, bool))):\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 = {}\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            params[self.param_names[idx]] = quantity_asanyarray(arg, dtype=float)\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 because\n                # if any of the arguments are quantities, we need to return a\n                # Quantity object not a plain Numpy array.\n                params[param_name] = quantity_asanyarray(value, dtype=float)\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, value in params.items():\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(params, max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(params, None)\n\n        self._n_models = n_models\n        self._initialize_parameter_values(params)"},{"col":0,"comment":"\n    Angular separation between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `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` 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":664,"header":"def angular_separation(lon1, lat1, lon2, lat2)","id":3048,"name":"angular_separation","nodeType":"Function","startLoc":627,"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 : `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` 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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":437,"id":3049,"name":"attr_names","nodeType":"Attribute","startLoc":437,"text":"attr_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":438,"id":3050,"name":"_attrs_no_copy","nodeType":"Attribute","startLoc":438,"text":"_attrs_no_copy"},{"attributeType":"null","col":4,"comment":"null","endLoc":446,"id":3051,"name":"_serialize_context","nodeType":"Attribute","startLoc":446,"text":"_serialize_context"},{"attributeType":"null","col":12,"comment":"null","endLoc":454,"id":3052,"name":"_format_funcs","nodeType":"Attribute","startLoc":454,"text":"self._format_funcs"},{"col":4,"comment":"null","endLoc":616,"header":"def __setattr__(self, attr, value)","id":3053,"name":"__setattr__","nodeType":"Function","startLoc":607,"text":"def __setattr__(self, attr, value):\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 attr == 'name' and self.parent_table is not None:\n            from ..table.np_utils import fix_column_name\n            new_name = fix_column_name(value)  # Ensure col name is numpy compatible\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        super().__setattr__(attr, value)"},{"col":0,"comment":"\n    Determine whether `origin` is a FITS file.\n\n    Parameters\n    ----------\n    origin : str or readable file-like object\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":66,"header":"def is_fits(origin, filepath, fileobj, *args, **kwargs)","id":3054,"name":"is_fits","nodeType":"Function","startLoc":40,"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 object\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":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":1333,"header":"def separation_3d(self, other)","id":3055,"name":"separation_3d","nodeType":"Function","startLoc":1295,"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        return Distance((self_car - other_car).norm())"},{"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":275,"header":"def _verify_column_info(column_info, global_info)","id":3056,"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    # Since TRPOSn is not specified, global reference position is\n    # considered.\n    elif global_info['TREFPOS'] == 'TOPOCENTER':\n\n        column_info['location'] = global_info['location']\n        if column_info['location'] is None:\n            warnings.warn(\n                'Time column reference position \"TRPOSn\" is not specified. The '\n                'default value for it is \"TOPOCENTER\", but due to unspecified '\n                'observatory position, reference position will be ignored.',\n                AstropyUserWarning)\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":0,"comment":"null","endLoc":265,"header":"def quantity_asanyarray(a, dtype=None)","id":3057,"name":"quantity_asanyarray","nodeType":"Function","startLoc":260,"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":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":112,"header":"def _decode_mixins(tbl)","id":3058,"name":"_decode_mixins","nodeType":"Function","startLoc":69,"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    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 ['format', '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":0,"comment":"\n    Represents a multi-dimensional Numpy array flattened onto a single line.\n    ","endLoc":495,"header":"def array_repr_oneline(array)","id":3059,"name":"array_repr_oneline","nodeType":"Function","startLoc":489,"text":"def array_repr_oneline(array):\n    \"\"\"\n    Represents a multi-dimensional Numpy array flattened onto a single line.\n    \"\"\"\n    sep = ',' if NUMPY_LT_1_14 else ', '\n    r = np.array2string(array, separator=sep, suppress_small=True)\n    return ' '.join(l.strip() for l in r.splitlines())"},{"col":4,"comment":"null","endLoc":161,"header":"def __init__(self, n_inputs, name=None, meta=None)","id":3060,"name":"__init__","nodeType":"Function","startLoc":159,"text":"def __init__(self, n_inputs, name=None, meta=None):\n        mapping = tuple(range(n_inputs))\n        super().__init__(mapping, name=name, meta=meta)"},{"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 object 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    ","endLoc":274,"header":"def read_table_fits(input, hdu=None, astropy_native=False, memmap=False,\n                    character_as_bytes=True)","id":3061,"name":"read_table_fits","nodeType":"Function","startLoc":115,"text":"def read_table_fits(input, hdu=None, astropy_native=False, memmap=False,\n                    character_as_bytes=True):\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 object 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    \"\"\"\n\n    if isinstance(input, HDUList):\n\n        # Parse all table objects\n        tables = OrderedDict()\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                              \" table (hdu={0})\".format(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(\"No table found in hdu={0}\".format(hdu))\n\n        elif len(tables) == 1:\n            table = tables[first(tables)]\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(hdulist, hdu=hdu,\n                                   astropy_native=astropy_native)\n        finally:\n            hdulist.close()\n\n    # Check if table is masked\n    masked = any(col.null is not None for col in table.columns)\n\n    # TODO: in future, it may make more sense to do this column-by-column,\n    # rather than via the structured array.\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\n        # Set column data\n        if masked:\n            column = MaskedColumn(data=data[col.name], name=col.name, copy=False)\n            if col.null is not None:\n                column.set_fill_value(col.null)\n                column.mask[column.data == col.null] = True\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='silent')\n\n        columns.append(column)\n\n    # Create Table object\n    t = Table(columns, masked=masked, 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":166,"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":3062,"name":"__new__","nodeType":"Function","startLoc":95,"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        if z is not None:\n            if value is not None or distmod is not None:\n                raise ValueError('Should given only one of `value`, `z` '\n                                 'or `distmod` in Distance constructor.')\n\n            if cosmology is None:\n                from ..cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n            # Continue on to take account of unit and other arguments\n            # but a copy is already made, so no longer necessary\n            copy = False\n\n        else:\n            if cosmology is not None:\n                raise ValueError('A `cosmology` was given but `z` was not '\n                                 'provided in Distance constructor')\n\n            value_msg = ('Should given only one of `value`, `z`, `distmod`, or '\n                         '`parallax` in Distance constructor.')\n            n_not_none = np.sum([x is not None\n                                 for x in [value, z, distmod, parallax]])\n            if n_not_none > 1:\n                raise ValueError(value_msg)\n\n            if 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                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif parallax is not None:\n                value = parallax.to(u.pc, equivalencies=u.parallax()).value\n                unit = u.pc\n\n                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif value is None:\n                raise ValueError('None of `value`, `z`, `distmod`, or '\n                                 '`parallax` were given to Distance '\n                                 'constructor')\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        if not allow_negative and np.any(distance.value < 0):\n            raise ValueError(\"Distance must be >= 0.  Use the argument \"\n                             \"'allow_negative=True' to allow negative values.\")\n\n        return distance"},{"col":4,"comment":"null","endLoc":58,"header":"def __init__(self, mapping, n_inputs=None, name=None, meta=None)","id":3063,"name":"__init__","nodeType":"Function","startLoc":49,"text":"def __init__(self, mapping, n_inputs=None, name=None, meta=None):\n        if n_inputs is None:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(max(mapping) + 1))\n        else:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(n_inputs))\n        self._outputs = tuple('x' + str(idx) for idx in range(len(mapping)))\n        self._mapping = mapping\n        super().__init__(name=name, meta=meta)"},{"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":1926,"header":"def _check_param_broadcast(self, params, max_ndim)","id":3064,"name":"_check_param_broadcast","nodeType":"Function","startLoc":1859,"text":"def _check_param_broadcast(self, params, 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\n        all_shapes = []\n        param_names = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            # Previously this just used iteritems(params), but we loop over all\n            # param_names instead just to ensure some determinism in the\n            # ordering behavior\n            if name not in params:\n                continue\n\n            value = params[name]\n            param_names.append(name)\n            # We've already checked that each parameter array is compatible in\n            # the model_set_axis dimension, but now we need to check the\n            # dimensions excluding that axis\n            # Split the array dimensions into the axes before model_set_axis\n            # and after model_set_axis\n            param_shape = np.shape(value)\n\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 = param_names[shape_a_idx]\n            param_b = 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    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":305,"header":"def _get_info_if_time_column(col, global_info)","id":3065,"name":"_get_info_if_time_column","nodeType":"Function","startLoc":278,"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":4,"comment":"null","endLoc":1857,"header":"def _initialize_parameter_values(self, params)","id":3066,"name":"_initialize_parameter_values","nodeType":"Function","startLoc":1776,"text":"def _initialize_parameter_values(self, params):\n        # self._param_metrics should have been initialized in\n        # self._initialize_parameters\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            unit = None\n            param_descr = getattr(self, name)\n\n            if params.get(name) is None:\n                default = param_descr.default\n\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(\n                        \"{0}.__init__() requires a value for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, name))\n\n                value = params[name] = default\n                unit = param_descr.unit\n            else:\n                value = params[name]\n                if isinstance(value, Quantity):\n                    unit = value.unit\n                else:\n                    unit = None\n\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n\n            param_slice = slice(total_size, total_size + param_size)\n\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n\n            if unit is None and param_descr.unit is not None:\n                raise InputParameterError(\n                    \"{0}.__init__() requires a Quantity for parameter \"\n                    \"{1!r}\".format(self.__class__.__name__, name))\n\n            param_metrics[name]['orig_unit'] = unit\n            param_metrics[name]['raw_unit'] = None\n            if param_descr._setter is not None:\n                _val = param_descr._setter(value)\n                if isinstance(_val, Quantity):\n                    param_metrics[name]['raw_unit'] = _val.unit\n                else:\n                    param_metrics[name]['raw_unit'] = None\n            total_size += param_size\n\n        self._param_metrics = param_metrics\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        # TODO: This is a bit ugly, but easier to deal with than how this was\n        # done previously.  There's still lots of opportunity for refactoring\n        # though, in particular once we move the _get/set_model_value methods\n        # out of Parameter and into Model (renaming them\n        # _get/set_parameter_value)\n        for name, value in params.items():\n            # value here may be a Quantity object.\n            param_descr = getattr(self, name)\n            unit = param_descr.unit\n            value = np.array(value)\n            orig_unit = param_metrics[name]['orig_unit']\n            if param_descr._setter is not None:\n                if unit is not None:\n                    value = np.asarray(param_descr._setter(value * orig_unit).value)\n                else:\n                    value = param_descr._setter(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        for name in params:\n            param_descr = getattr(self, name)\n            param_descr.validator(param_descr.value)"},{"col":4,"comment":"null","endLoc":689,"header":"def __str__(self)","id":3067,"name":"__str__","nodeType":"Function","startLoc":688,"text":"def __str__(self):\n        return self._format_str()"},{"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":2063,"header":"def _format_str(self, keywords=[])","id":3068,"name":"_format_str","nodeType":"Function","startLoc":2026,"text":"def _format_str(self, keywords=[]):\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 = ['{0}: {1}'.format(keyword, value)\n                 for keyword, value in default_keywords + keywords\n                 if value is not None]\n\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":106,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":3069,"name":"to_tree_transform","nodeType":"Function","startLoc":101,"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":114,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3070,"name":"assert_equal","nodeType":"Function","startLoc":108,"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":94,"id":3071,"name":"name","nodeType":"Attribute","startLoc":94,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":3072,"name":"types","nodeType":"Attribute","startLoc":95,"text":"types"},{"className":"ConstantType","col":0,"comment":"null","endLoc":129,"id":3073,"nodeType":"Class","startLoc":117,"text":"class ConstantType(TransformType):\n    name = \"transform/constant\"\n    types = ['astropy.modeling.functional_models.Const1D']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Const1D(node['value'])\n\n    @classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'value': data.amplitude.value\n        }"},{"col":4,"comment":"null","endLoc":123,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3074,"name":"from_tree_transform","nodeType":"Function","startLoc":121,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return functional_models.Const1D(node['value'])"},{"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":343,"header":"def _convert_global_time(table, global_info)","id":3075,"name":"_convert_global_time","nodeType":"Function","startLoc":308,"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\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.startswith('DATE'):\n            if key not in table.meta:\n                scale = 'utc' if key == 'DATE' else global_info['scale']\n                try:\n                    precision = len(value.split('.')[-1]) if '.' in value else 0\n                    value = Time(value, format='fits', scale=scale,\n                                 precision=precision)\n                except ValueError:\n                    pass\n                table.meta[key] = value\n\n        # MJD-xxx in MJD according to TIMESYS\n        elif key.startswith('MJD-'):\n            if key not in table.meta:\n                try:\n                    value = Time(value, format='mjd',\n                                 scale=global_info['scale'])\n                except ValueError:\n                    pass\n                table.meta[key] = value"},{"col":4,"comment":"null","endLoc":206,"header":"@classmethod\n    def _distmod_to_pc(cls, dm)","id":3076,"name":"_distmod_to_pc","nodeType":"Function","startLoc":203,"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":129,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":3077,"name":"to_tree_transform","nodeType":"Function","startLoc":125,"text":"@classmethod\n    def to_tree_transform(cls, data, ctx):\n        return {\n            'value': data.amplitude.value\n        }"},{"attributeType":"null","col":4,"comment":"null","endLoc":118,"id":3078,"name":"name","nodeType":"Attribute","startLoc":118,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":119,"id":3079,"name":"types","nodeType":"Attribute","startLoc":119,"text":"types"},{"className":"DomainType","col":0,"comment":"null","endLoc":143,"id":3080,"nodeType":"Class","startLoc":132,"text":"class DomainType(AstropyAsdfType):\n    # TODO: Is this used anywhere? Can it be removed?\n    name = \"transform/domain\"\n    version = '1.0.0'\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        return node\n\n    @classmethod\n    def to_tree(cls, data, ctx):\n        return data"},{"col":4,"comment":"null","endLoc":139,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3081,"name":"from_tree","nodeType":"Function","startLoc":137,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        return node"},{"col":4,"comment":"null","endLoc":143,"header":"@classmethod\n    def to_tree(cls, data, ctx)","id":3082,"name":"to_tree","nodeType":"Function","startLoc":141,"text":"@classmethod\n    def to_tree(cls, data, ctx):\n        return data"},{"attributeType":"null","col":4,"comment":"null","endLoc":134,"id":3083,"name":"name","nodeType":"Attribute","startLoc":134,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":135,"id":3084,"name":"version","nodeType":"Attribute","startLoc":135,"text":"version"},{"className":"GenericModel","col":0,"comment":"null","endLoc":150,"id":3085,"nodeType":"Class","startLoc":146,"text":"class GenericModel(mappings.Mapping):\n    def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super(GenericModel, self).__init__(mapping)\n        self._outputs = tuple('x' + str(idx) for idx in range(self.n_outputs + 1))"},{"col":4,"comment":"null","endLoc":692,"header":"def __len__(self)","id":3086,"name":"__len__","nodeType":"Function","startLoc":691,"text":"def __len__(self):\n        return self._n_models"},{"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":782,"header":"def __call__(self, *inputs, **kwargs)","id":3087,"name":"__call__","nodeType":"Function","startLoc":694,"text":"def __call__(self, *inputs, **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\n        inputs, format_info = self.prepare_inputs(*inputs, **kwargs)\n\n        # Check whether any of the inputs are quantities\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n\n        parameters = self._param_sets(raw=True, units=True)\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n        bbox = None\n        if with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                bbox = None\n            if self.n_inputs > 1 and bbox is not None:\n                # bounding_box is in python order - convert it to the order of the inputs\n                bbox = bbox[::-1]\n            if bbox is None:\n                outputs = self.evaluate(*chain(inputs, parameters))\n            else:\n                if self.n_inputs == 1:\n                    bbox = [bbox]\n                # indices where input is outside the bbox\n                # have a value of 1 in ``nan_ind``\n                nan_ind = np.zeros(inputs[0].shape, dtype=bool)\n                for ind, inp in enumerate(inputs):\n                    # Pass an ``out`` array so that ``axis_ind`` is array for scalars as well.\n                    axis_ind = np.zeros(inp.shape, dtype=bool)\n                    axis_ind = np.logical_or(inp < bbox[ind][0], inp > bbox[ind][1], out=axis_ind)\n                    nan_ind[axis_ind] = 1\n                # get an array with indices of valid inputs\n                valid_ind = np.logical_not(nan_ind).nonzero()\n                # inputs holds only inputs within the bbox\n                args = []\n                for input in inputs:\n                    if not input.shape:\n                        # shape is ()\n                        if nan_ind:\n                            outputs = [fill_value for a in args]\n                        else:\n                            args.append(input)\n                    else:\n                        args.append(input[valid_ind])\n                valid_result = self.evaluate(*chain(args, parameters))\n                if self.n_outputs == 1:\n                    valid_result = [valid_result]\n                # combine the valid results with the ``fill_value`` values\n                # outside the bbox\n                result = [np.zeros(inputs[0].shape) + fill_value for i in range(len(valid_result))]\n                for ind, r in enumerate(valid_result):\n                    if not result[ind].shape:\n                        # shape is ()\n                        result[ind] = r\n                    else:\n                        result[ind][valid_ind] = r\n                # format output\n                if self.n_outputs == 1:\n                    outputs = np.asarray(result[0])\n                else:\n                    outputs = [np.asarray(r) for r in result]\n        else:\n            outputs = self.evaluate(*chain(inputs, parameters))\n        if self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(format_info, *outputs, **kwargs)\n\n        # If input values were quantities, we use return_units to cast\n        # the return values to the units specified by return_units.\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[out_name], subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        else:\n            return outputs"},{"col":4,"comment":"null","endLoc":150,"header":"def __init__(self, n_inputs, n_outputs)","id":3088,"name":"__init__","nodeType":"Function","startLoc":147,"text":"def __init__(self, n_inputs, n_outputs):\n        mapping = tuple(range(n_inputs))\n        super(GenericModel, self).__init__(mapping)\n        self._outputs = tuple('x' + str(idx) for idx in range(self.n_outputs + 1))"},{"col":4,"comment":"null","endLoc":32,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3089,"name":"to_tree_transform","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        return {'offset': model.offset.value}\n        #return yamlutil.custom_tree_to_tagged_tree(node, ctx)"},{"col":4,"comment":"null","endLoc":40,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3090,"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, modeling.models.Shift) and\n                isinstance(b, modeling.models.Shift))\n        assert_array_equal(a.offset.value, b.offset.value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":3091,"name":"name","nodeType":"Attribute","startLoc":17,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3092,"name":"types","nodeType":"Attribute","startLoc":18,"text":"types"},{"className":"ScaleType","col":0,"comment":"null","endLoc":67,"id":3093,"nodeType":"Class","startLoc":43,"text":"class ScaleType(TransformType):\n    name = \"transform/scale\"\n    types = ['astropy.modeling.models.Scale']\n\n    @classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if 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        node = {'factor': model.factor.value}\n        return yamlutil.custom_tree_to_tagged_tree(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 (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":54,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3094,"name":"from_tree_transform","nodeType":"Function","startLoc":47,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        factor = node['factor']\n        if 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":"\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":1520,"header":"def prepare_inputs(self, *inputs, model_set_axis=None, equivalencies=None,\n                       **kwargs)","id":3095,"name":"prepare_inputs","nodeType":"Function","startLoc":1414,"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\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\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        n_models = len(self)\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        _validate_input_shapes(inputs, self.inputs, n_models,\n                               model_set_axis, self.standard_broadcasting)\n\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n\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                                                                 equivalencies,\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(input_unit, 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 because\n                        # some equivalencies are non-linear, and we need to be\n                        # sure that we evaluate the model in its own frame\n                        # of reference. If input_units_strict is set, we also\n                        # need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict:\n                            inputs[i] = inputs[i].to(input_unit, 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(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required dimensionless \"\n                                             \"input\".format(self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{3} ({4})\".format(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 and\n                       input_unit is not dimensionless_unscaled and input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"Units of input '{0}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{1} ({2})\".format(self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\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 n_models == 1:\n            return _prepare_inputs_single_model(self, params, inputs,\n                                                **kwargs)\n        else:\n            return _prepare_inputs_model_set(self, params, inputs, n_models,\n                                             model_set_axis, **kwargs)"},{"col":0,"comment":"\n    Perform basic validation of model inputs--that they are mutually\n    broadcastable and that they have the minimum dimensions for the given\n    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":3323,"header":"def _validate_input_shapes(inputs, argnames, n_models, model_set_axis,\n                           validate_broadcasting)","id":3096,"name":"_validate_input_shapes","nodeType":"Function","startLoc":3270,"text":"def _validate_input_shapes(inputs, argnames, n_models, model_set_axis,\n                           validate_broadcasting):\n    \"\"\"\n    Perform basic validation of model inputs--that they are mutually\n    broadcastable and that they have the minimum dimensions for the given\n    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 = n_models > 1 and model_set_axis is not False\n\n    if not (validate_broadcasting or check_model_set_axis):\n        # Nothing else needed here\n        return\n\n    all_shapes = []\n\n    for idx, _input in enumerate(inputs):\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                    \"For model_set_axis={0}, all inputs must be at \"\n                    \"least {1}-dimensional.\".format(\n                        model_set_axis, model_set_axis + 1))\n            elif input_shape[model_set_axis] != n_models:\n                raise ValueError(\n                    \"Input argument {0!r} does not have the correct \"\n                    \"dimensions in model_set_axis={1} for a model set with \"\n                    \"n_models={2}.\".format(argnames[idx], model_set_axis,\n                                           n_models))\n        all_shapes.append(input_shape)\n\n    if not validate_broadcasting:\n        return\n\n    try:\n        input_broadcast = check_broadcast(*all_shapes)\n    except IncompatibleShapeError as exc:\n        shape_a, shape_a_idx, shape_b, shape_b_idx = exc.args\n        arg_a = argnames[shape_a_idx]\n        arg_b = argnames[shape_b_idx]\n\n        raise ValueError(\n            \"Model input argument {0!r} of shape {1!r} cannot \"\n            \"be broadcast with input {2!r} of shape {3!r}\".format(\n                arg_a, shape_a, arg_b, shape_b))\n\n    return input_broadcast"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    ","endLoc":49,"header":"def parallax()","id":3097,"name":"parallax","nodeType":"Function","startLoc":42,"text":"def parallax():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    \"\"\"\n    return [\n        (si.arcsecond, astrophys.parsec, lambda x: 1. / x)\n    ]"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":3098,"name":"_outputs","nodeType":"Attribute","startLoc":150,"text":"self._outputs"},{"col":4,"comment":"null","endLoc":59,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3099,"name":"to_tree_transform","nodeType":"Function","startLoc":56,"text":"@classmethod\n    def to_tree_transform(cls, model, ctx):\n        node = {'factor': model.factor.value}\n        return yamlutil.custom_tree_to_tagged_tree(node, ctx)"},{"col":0,"comment":"null","endLoc":633,"header":"def _combine_equivalency_dict(keys, eq1=None, eq2=None)","id":3100,"name":"_combine_equivalency_dict","nodeType":"Function","startLoc":622,"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":67,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3101,"name":"assert_equal","nodeType":"Function","startLoc":61,"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)"},{"className":"GenericType","col":0,"comment":"null","endLoc":167,"id":3102,"nodeType":"Class","startLoc":153,"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":160,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3103,"name":"from_tree_transform","nodeType":"Function","startLoc":157,"text":"@classmethod\n    def from_tree_transform(cls, node, ctx):\n        return GenericModel(\n            node['n_inputs'], node['n_outputs'])"},{"col":41,"endLoc":48,"id":3104,"nodeType":"Lambda","startLoc":48,"text":"lambda x: 1. / x"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":3105,"name":"name","nodeType":"Attribute","startLoc":44,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":45,"id":3106,"name":"types","nodeType":"Attribute","startLoc":45,"text":"types"},{"className":"PolynomialType","col":0,"comment":"null","endLoc":122,"id":3107,"nodeType":"Class","startLoc":70,"text":"class PolynomialType(TransformType):\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            model = modeling.models.Polynomial1D(coefficients.size - 1)\n            model.parameters = coefficients\n        elif n_dim == 2:\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, **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        return yamlutil.custom_tree_to_tagged_tree(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 (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)"},{"col":4,"comment":"null","endLoc":99,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3108,"name":"from_tree_transform","nodeType":"Function","startLoc":75,"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            model = modeling.models.Polynomial1D(coefficients.size - 1)\n            model.parameters = coefficients\n        elif n_dim == 2:\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, **coeffs)\n        else:\n            raise NotImplementedError(\n                \"Asdf currently only supports 1D or 2D polynomial transform.\")\n        return model"},{"col":4,"comment":"\n        Shorthand for a cartesian representation of the coordinates in this\n        object.\n        ","endLoc":1344,"header":"@property\n    def cartesian(self)","id":3109,"name":"cartesian","nodeType":"Function","startLoc":1335,"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":"\n        Shorthand for a spherical representation of the coordinates in this\n        object.\n        ","endLoc":1355,"header":"@property\n    def spherical(self)","id":3110,"name":"spherical","nodeType":"Function","startLoc":1346,"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)"},{"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":1367,"header":"@property\n    def sphericalcoslat(self)","id":3111,"name":"sphericalcoslat","nodeType":"Function","startLoc":1357,"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)"},{"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":1386,"header":"@property\n    def velocity(self)","id":3112,"name":"velocity","nodeType":"Function","startLoc":1369,"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        try:\n            v = self.cartesian.differentials['s']\n        except Exception as e:\n            raise ValueError('Could not retrieve a Cartesian velocity. Your '\n                             'frame must include velocity information for this '\n                             'to work.')\n        return v"},{"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":1407,"header":"@property\n    def proper_motion(self)","id":3113,"name":"proper_motion","nodeType":"Function","startLoc":1388,"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"},{"col":0,"comment":"null","endLoc":3171,"header":"def _prepare_inputs_single_model(model, params, inputs, **kwargs)","id":3114,"name":"_prepare_inputs_single_model","nodeType":"Function","startLoc":3115,"text":"def _prepare_inputs_single_model(model, params, inputs, **kwargs):\n    broadcasts = []\n\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 model.standard_broadcasting:\n                    broadcast = check_broadcast(input_shape, param.shape)\n                else:\n                    broadcast = input_shape\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(model.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 model.n_outputs > model.n_inputs:\n        if len(set(broadcasts)) > 1:\n            raise ValueError(\n                \"For models with n_outputs > n_inputs, the combination of \"\n                \"all inputs and parameters must broadcast to the same shape, \"\n                \"which will be used as the shape of all outputs.  In this \"\n                \"case some of the inputs had different shapes, so it is \"\n                \"ambiguous how to format outputs for this model.  Try using \"\n                \"inputs that are all the same size and shape.\")\n        else:\n            # Extend the broadcasts list to include shapes for all outputs\n            extra_outputs = model.n_outputs - model.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_model)\n                broadcasts.append(None)\n            broadcasts.extend([broadcasts[0]] * extra_outputs)\n\n    return inputs, (broadcasts,)"},{"col":4,"comment":"\n        Shorthand for the radial or line-of-sight velocity as a\n        `~astropy.units.Quantity` object.\n        ","endLoc":1420,"header":"@property\n    def radial_velocity(self)","id":3115,"name":"radial_velocity","nodeType":"Function","startLoc":1409,"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"},{"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":404,"header":"def _convert_time_column(col, column_info)","id":3116,"name":"_convert_time_column","nodeType":"Function","startLoc":346,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":256,"id":3117,"name":"default_representation","nodeType":"Attribute","startLoc":256,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":257,"id":3118,"name":"default_differential","nodeType":"Attribute","startLoc":257,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":261,"id":3119,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":261,"text":"frame_specific_representation_info"},{"attributeType":"null","col":4,"comment":"null","endLoc":263,"id":3120,"name":"_inherit_descriptors_","nodeType":"Attribute","startLoc":263,"text":"_inherit_descriptors_"},{"attributeType":"null","col":4,"comment":"null","endLoc":265,"id":3121,"name":"frame_attributes","nodeType":"Attribute","startLoc":265,"text":"frame_attributes"},{"col":4,"comment":"null","endLoc":167,"header":"@classmethod\n    def to_tree_transform(cls, data, ctx)","id":3122,"name":"to_tree_transform","nodeType":"Function","startLoc":162,"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":154,"id":3123,"name":"name","nodeType":"Attribute","startLoc":154,"text":"name"},{"col":0,"comment":"null","endLoc":3253,"header":"def _prepare_inputs_model_set(model, params, inputs, n_models, model_set_axis,\n                              **kwargs)","id":3124,"name":"_prepare_inputs_model_set","nodeType":"Function","startLoc":3191,"text":"def _prepare_inputs_model_set(model, params, inputs, n_models, model_set_axis,\n                              **kwargs):\n    reshaped = []\n    pivots = []\n\n    for idx, _input in enumerate(inputs):\n        max_param_shape = ()\n\n        if n_models > 1 and model_set_axis is not False:\n            # Use the shape of the input *excluding* the model axis\n            input_shape = (_input.shape[:model_set_axis] +\n                           _input.shape[model_set_axis + 1:])\n        else:\n            input_shape = _input.shape\n\n        for param in params:\n            try:\n                check_broadcast(input_shape, param.shape)\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(model.inputs[idx], input_shape,\n                                    param.name, param.shape))\n\n            if len(param.shape) > len(max_param_shape):\n                max_param_shape = param.shape\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 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.model_set_axis\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 = model.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,\n                                        pivot + 1)\n\n        pivots.append(pivot)\n        reshaped.append(new_input)\n\n    if model.n_inputs < model.n_outputs:\n        pivots.extend([model_set_axis] * (model.n_outputs - model.n_inputs))\n\n    return reshaped, (pivots,)"},{"attributeType":"None","col":4,"comment":"null","endLoc":543,"id":3125,"name":"representation","nodeType":"Attribute","startLoc":543,"text":"representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":631,"id":3126,"name":"representation_component_names","nodeType":"Attribute","startLoc":631,"text":"representation_component_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":633,"id":3127,"name":"representation_component_units","nodeType":"Attribute","startLoc":633,"text":"representation_component_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":155,"id":3128,"name":"types","nodeType":"Attribute","startLoc":155,"text":"types"},{"col":4,"comment":"null","endLoc":795,"header":"def __init__(self, degree, domain=[-1, 1], window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":3129,"name":"__init__","nodeType":"Function","startLoc":789,"text":"def __init__(self, degree, domain=[-1, 1], window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"attributeType":"null","col":12,"comment":"null","endLoc":375,"id":3130,"name":"_data","nodeType":"Attribute","startLoc":375,"text":"self._data"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":3131,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"basic.py#<anonymous>","id":3132,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['TransformType', 'IdentityType', 'ConstantType', 'DomainType']"},{"attributeType":"null","col":12,"comment":"null","endLoc":522,"id":3133,"name":"_representation","nodeType":"Attribute","startLoc":522,"text":"self._representation"},{"attributeType":"null","col":8,"comment":"null","endLoc":270,"id":3134,"name":"_attr_names_with_defaults","nodeType":"Attribute","startLoc":270,"text":"self._attr_names_with_defaults"},{"attributeType":"null","col":16,"comment":"null","endLoc":424,"id":3135,"name":"_no_data_shape","nodeType":"Attribute","startLoc":424,"text":"self._no_data_shape"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":3136,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":57,"text":"frame_specific_representation_info"},{"id":3137,"name":"astropy/io/misc/asdf/tags/transform/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/asdf/tags/transform/tests","id":3138,"nodeType":"File","text":""},{"id":3139,"name":"astropy/io/misc/asdf/schemas/astropy.org/astropy/coords","nodeType":"Package"},{"id":3140,"name":"icrs_coord-1.0.0.yaml","nodeType":"TextFile","path":"astropy/io/misc/asdf/schemas/astropy.org/astropy/coords","text":"%YAML 1.1\n---\n$schema: \"http://stsci.edu/schemas/yaml-schema/draft-01\"\nid: \"http://astropy.org/schemas/astropy/coords/icrs_coord-1.0.0\"\ntag: \"tag:astropy.org:astropy/coords/icrs_coord-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"},{"attributeType":"null","col":4,"comment":"null","endLoc":85,"id":3141,"name":"default_representation","nodeType":"Attribute","startLoc":85,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":3142,"name":"default_differential","nodeType":"Attribute","startLoc":86,"text":"default_differential"},{"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 : array, list, scalar, `~astropy.units.Quantity`,\n        :class:`~astropy.coordinates.Angle` The angle value(s). If a tuple,\n        will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending\n        on ``unit``. If a string, it will be interpreted following the\n        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 : :class:`~astropy.units.UnitBase`, str, 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 : :class:`~astropy.coordinates.Angle` or equivalent, or None\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":663,"id":3143,"nodeType":"Class","startLoc":546,"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 : array, list, scalar, `~astropy.units.Quantity`,\n        :class:`~astropy.coordinates.Angle` The angle value(s). If a tuple,\n        will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending\n        on ``unit``. If a string, it will be interpreted following the\n        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 : :class:`~astropy.units.UnitBase`, str, 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 : :class:`~astropy.coordinates.Angle` or equivalent, or None\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\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_internal()\n\n    def _wrap_internal(self):\n        \"\"\"\n        Wrap the internal values in the Longitude object. Using the\n        :meth:`~astropy.coordinates.Angle.wrap_at` method causes\n        recursion.\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 = self.wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.value\n        # Do the wrapping, but only if any angles need to be wrapped\n        if np.any(self_angle < wrap_angle_floor) or np.any(self_angle >= wrap_angle):\n            wrapped = np.mod(self_angle - wrap_angle, a360) + wrap_angle_floor\n            value = u.Quantity(wrapped, self.unit)\n            super().__setitem__((), value)\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)\n        self._wrap_internal()\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_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)\n\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"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\n      Angle('10.2345d')\n      Angle(['10.2345d', '-20d'])\n      Angle('1:2:30.43 degrees')\n      Angle('1 2 0 hours')\n      Angle(np.arange(1, 8), unit=u.deg)\n      Angle('1°2′3″')\n      Angle('1d2m3.4s')\n      Angle('-1h2m3s')\n      Angle('-1h2.5m')\n      Angle('-1:2.5', unit=u.deg)\n      Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      Angle(10.2345 * u.deg)\n      Angle(Angle(10.2345 * u.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 : `~astropy.units.UnitBase`, str, 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":439,"id":3144,"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\n      Angle('10.2345d')\n      Angle(['10.2345d', '-20d'])\n      Angle('1:2:30.43 degrees')\n      Angle('1 2 0 hours')\n      Angle(np.arange(1, 8), unit=u.deg)\n      Angle('1°2′3″')\n      Angle('1d2m3.4s')\n      Angle('-1h2m3s')\n      Angle('-1h2.5m')\n      Angle('-1:2.5', unit=u.deg)\n      Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      Angle(10.2345 * u.deg)\n      Angle(Angle(10.2345 * u.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 : `~astropy.units.UnitBase`, str, 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):\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 = util.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\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 util.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return util.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(\"Can not parse '{0}' as unit '{1}'\"\n                               .format(angle, 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(*util.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(*util.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                                *util.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(\"Unknown format '{0}'\".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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: util.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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: util.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 = \"{0: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 \"{0:g}{1}\".format(val, unit_string)\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    \"'{0}' can not be represented in sexagesimal \"\n                    \"notation\".format(\n                        unit.name))\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            s = func(float(val))\n            if alwayssign and not s.startswith('-'):\n                s = '+' + s\n            if format == 'latex':\n                s = '${0}$'.format(s)\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, inplace=False):\n        \"\"\"\n        Wrap the `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 `Angle` object is wrapped in\n        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 : str, `Angle`, angular `~astropy.units.Quantity`\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``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 `Angle`\n\n        Returns\n        -------\n        out : Angle or `None`\n            If ``inplace is False`` (default), return new `Angle` object\n            with angles wrapped accordingly.  Otherwise wrap in place and\n            return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle)  # Convert to an Angle\n        wrapped = np.mod(self - wrap_angle, 360.0 * u.deg) - (360.0 * u.deg - wrap_angle)\n\n        if inplace:\n            self[()] = wrapped\n        else:\n            return wrapped\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 : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `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__(self):\n        return str(self.to_string())\n\n    def _repr_latex_(self):\n        if self.isscalar:\n            return self.to_string(format='latex')\n        else:\n            # Need to do a magic incantation to convert to str.  Regular str\n            # or array2string causes all backslashes to get doubled.\n            return np.array2string(self.to_string(format='latex'),\n                                   formatter={'str_kind': lambda x: x})"},{"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":1702,"id":3145,"nodeType":"Class","startLoc":1662,"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 uninitalized 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                \"{0} instances require units equivalent to '{1}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 \", so cannot set it to '{0}'.\".format(unit)))\n\n        super()._set_unit(unit)"},{"col":4,"comment":"null","endLoc":1692,"header":"def __quantity_subclass__(self, unit)","id":3146,"name":"__quantity_subclass__","nodeType":"Function","startLoc":1688,"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"},{"col":4,"comment":"null","endLoc":1702,"header":"def _set_unit(self, unit)","id":3147,"name":"_set_unit","nodeType":"Function","startLoc":1694,"text":"def _set_unit(self, unit):\n        if unit is None or not unit.is_equivalent(self._equivalent_unit):\n            raise UnitTypeError(\n                \"{0} instances require units equivalent to '{1}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 \", so cannot set it to '{0}'.\".format(unit)))\n\n        super()._set_unit(unit)"},{"id":3148,"name":"astropy/io/misc/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/misc/tests","id":3149,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"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":1993,"header":"def _param_sets(self, raw=False, units=False)","id":3150,"name":"_param_sets","nodeType":"Function","startLoc":1928,"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        param_metrics = self._param_metrics\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw:\n                value = param._raw_value\n            else:\n                value = param.value\n\n            broadcast_shape = 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 self._param_metrics[name]['raw_unit'] is not None:\n                    unit = self._param_metrics[name]['raw_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        # TODO: Returning an array from this method may be entirely pointless\n        # for internal use--perhaps only the external param_sets method should\n        # return an array (and just for backwards compat--I would prefer to\n        # maybe deprecate that method)\n\n        return np.array(values)"},{"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":474,"header":"def fits_to_time(hdr, table)","id":3151,"name":"fits_to_time","nodeType":"Function","startLoc":407,"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    # 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"},{"id":3152,"name":"astropy/io/ascii","nodeType":"Package"},{"id":3153,"name":"cparser.pyx","nodeType":"TextFile","path":"astropy/io/ascii","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport csv\nimport os\nimport math\nimport multiprocessing\nimport mmap\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 ...table import pprint\nfrom . import core\n\ntry:\n    import Queue\nexcept ImportError: # in python 3, the module is named queue\n    import queue as Queue\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 **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=True):\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        if fast_reader:\n            raise core.FastOptionsError(\"Invalid parameter in fast_reader dict\")\n        if parallel and os.name == 'nt':\n            raise NotImplementedError(\"Multiprocessing is not yet supported on Windows\")\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        # 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            try:\n                source = '\\n'.join(source) # iterable sequence of lines\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):\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\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 self.include_names is not None:\n            self.use_cols.intersection_update(self.include_names)\n        if 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            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._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\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        # Asyncronously 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 chunck 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        # intialize 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=(np.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 __reduce__(self):\n        cdef bytes source_ptr = self.source_ptr if self.source_ptr else b''\n        return (_copy_cparser, (source_ptr, self.source_bytes, self.use_cols, self.fill_names,\n                                self.fill_values, 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                                expchar=chr(self.tokenizer.expchar),\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                                use_fast_converter=self.tokenizer.use_fast_converter,\n                                parallel=False)))\n\ndef _copy_cparser(bytes src_ptr, bytes source_bytes, use_cols, fill_names, fill_values,\n                  strip_whitespace_lines, strip_whitespace_fields, kwargs):\n    parser = CParser(None, strip_whitespace_lines, strip_whitespace_fields, **kwargs)\n    parser.use_cols = use_cols\n    parser.fill_names = fill_names\n    parser.fill_values = fill_values\n\n    if src_ptr:\n        parser.tokenizer.source = src_ptr\n    else:\n        parser.tokenizer.source = source_bytes\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            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        queue.pop()\n        queue.put((None, e, i))\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    reconvert_queue.put(reconvert_cols) # return to the queue for other processes\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        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 is not False:\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            output = open(output, 'w')\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 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()\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 % 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":3154,"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\n\nimport warnings\nimport numpy\n\n\nfrom . import core\nfrom ...table import Column\nfrom ...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 = 'number {0}'.format(self.html['table_id'])\n            else:\n                err_descr = \"id '{0}'\".format(self.html['table_id'])\n            raise core.InconsistentTableError(\n                'ERROR: HTML table {0} not found'.format(err_descr))\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(numpy.int),\n                          core.convert_numpy(numpy.float),\n                          core.convert_numpy(numpy.str),\n                          core.convert_numpy(numpy.unicode)]\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    \"\"\"Read and write HTML tables.\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            http://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    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        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                        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(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                            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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1676,"id":3155,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":1676,"text":"_equivalent_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1680,"id":3156,"name":"_unit","nodeType":"Attribute","startLoc":1680,"text":"_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1683,"id":3157,"name":"_default_unit","nodeType":"Attribute","startLoc":1683,"text":"_default_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":1686,"id":3158,"name":"__array_priority__","nodeType":"Attribute","startLoc":1686,"text":"__array_priority__"},{"col":4,"comment":"null","endLoc":131,"header":"def _set_unit(self, unit)","id":3159,"name":"_set_unit","nodeType":"Function","startLoc":130,"text":"def _set_unit(self, unit):\n        super()._set_unit(self._convert_unit_to_angle_unit(unit))"},{"className":"SoupString","col":0,"comment":"\n    Allows for strings to hold BeautifulSoup data.\n    ","endLoc":32,"id":3160,"nodeType":"Class","startLoc":23,"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":4,"comment":"\n        The angle's value in hours (read-only property).\n        ","endLoc":138,"header":"@property\n    def hour(self)","id":3161,"name":"hour","nodeType":"Function","startLoc":133,"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":146,"header":"@property\n    def hms(self)","id":3162,"name":"hms","nodeType":"Function","startLoc":140,"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(*util.hours_to_hms(self.hourangle))"},{"col":4,"comment":"null","endLoc":29,"header":"def __new__(cls, *args, **kwargs)","id":3163,"name":"__new__","nodeType":"Function","startLoc":28,"text":"def __new__(cls, *args, **kwargs):\n        return str.__new__(cls, *args, **kwargs)"},{"col":4,"comment":"null","endLoc":32,"header":"def __init__(self, val)","id":3164,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self, val):\n        self.soup = val"},{"col":0,"comment":"\n    Convert an floating-point hour value into an ``(hour, minute,\n    second)`` tuple.\n    ","endLoc":477,"header":"def hours_to_hms(h)","id":3165,"name":"hours_to_hms","nodeType":"Function","startLoc":465,"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":8,"comment":"null","endLoc":32,"id":3166,"name":"soup","nodeType":"Attribute","startLoc":32,"text":"self.soup"},{"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":154,"header":"@property\n    def dms(self)","id":3167,"name":"dms","nodeType":"Function","startLoc":148,"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(*util.degrees_to_dms(self.degree))"},{"className":"ListWriter","col":0,"comment":"\n    Allows for XMLWriter to write to a list instead of a file.\n    ","endLoc":44,"id":3168,"nodeType":"Class","startLoc":35,"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":41,"header":"def __init__(self, out)","id":3169,"name":"__init__","nodeType":"Function","startLoc":40,"text":"def __init__(self, out):\n        self.out = out"},{"col":4,"comment":"null","endLoc":44,"header":"def write(self, data)","id":3170,"name":"write","nodeType":"Function","startLoc":43,"text":"def write(self, data):\n        self.out.append(data)"},{"col":0,"comment":"\n    Convert a floating-point degree value into a ``(degree, arcminute,\n    arcsecond)`` tuple.\n    ","endLoc":368,"header":"def degrees_to_dms(d)","id":3171,"name":"degrees_to_dms","nodeType":"Function","startLoc":357,"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"},{"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":167,"header":"@property\n    def signed_dms(self)","id":3172,"name":"signed_dms","nodeType":"Function","startLoc":156,"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                                *util.degrees_to_dms(np.abs(self.degree)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":41,"id":3173,"name":"out","nodeType":"Attribute","startLoc":41,"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":112,"id":3174,"nodeType":"Class","startLoc":69,"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 = 'number {0}'.format(self.html['table_id'])\n            else:\n                err_descr = \"id '{0}'\".format(self.html['table_id'])\n            raise core.InconsistentTableError(\n                'ERROR: HTML table {0} not found'.format(err_descr))\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":" 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":338,"header":"def to_string(self, unit=None, decimal=False, sep='fromunit',\n                  precision=None, alwayssign=False, pad=False,\n                  fields=3, format=None)","id":3175,"name":"to_string","nodeType":"Function","startLoc":169,"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(\"Unknown format '{0}'\".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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: util.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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: util.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 = \"{0: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 \"{0:g}{1}\".format(val, unit_string)\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    \"'{0}' can not be represented in sexagesimal \"\n                    \"notation\".format(\n                        unit.name))\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            s = func(float(val))\n            if alwayssign and not s.startswith('-'):\n                s = '+' + s\n            if format == 'latex':\n                s = '${0}$'.format(s)\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":"BaseInputter","col":0,"comment":"\n    Get the lines from the table input and return a list of lines.\n\n    ","endLoc":319,"id":3176,"nodeType":"Class","startLoc":259,"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):\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 ``read()`` method,\n            or a list of strings.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read') or\n                    ('\\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            lines = table.splitlines()\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                lines = table\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"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":3177,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":11,"id":3178,"name":"u","nodeType":"Attribute","startLoc":11,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":3179,"name":"TCTYP_RE_TYPE","nodeType":"Attribute","startLoc":25,"text":"TCTYP_RE_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":3180,"name":"TCTYP_RE_ALGO","nodeType":"Attribute","startLoc":26,"text":"TCTYP_RE_ALGO"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":3181,"name":"FITS_TIME_UNIT","nodeType":"Attribute","startLoc":30,"text":"FITS_TIME_UNIT"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":3182,"name":"TIME_KEYWORDS","nodeType":"Attribute","startLoc":34,"text":"TIME_KEYWORDS"},{"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":350,"header":"def _encode_mixins(tbl)","id":3183,"name":"_encode_mixins","nodeType":"Function","startLoc":277,"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    # If PyYAML is not available then check to see if there are any mixin cols\n    # that *require* YAML serialization.  FITS already has support for Time,\n    # Quantity, so if those are the only mixins the proceed without doing the\n    # YAML bit, for backward compatibility (i.e. not requiring YAML to write\n    # Time or Quantity).  In this case other mixin column meta (e.g.\n    # description or meta) will be silently dropped, consistent with astropy <=\n    # 2.0 behavior.\n    try:\n        import yaml\n    except ImportError:\n        for col in tbl.itercols():\n            if (has_info_class(col, MixinInfo) and\n                    col.__class__ not in (u.Quantity, Time)):\n                raise TypeError(\"cannot write type {} column '{}' \"\n                                \"to FITS without PyYAML installed.\"\n                                .format(col.__class__.__name__, col.info.name))\n        else:\n            # Warn if information will be lost.  This is hardcoded to the set\n            # difference between column info attributes and what FITS can store\n            # natively (name, dtype, unit).  See _get_col_attributes() in\n            # table/meta.py for where this comes from.\n            for col in tbl.itercols():\n                if any(getattr(col.info, attr, None) not in (None, {})\n                       for attr in ('format', 'description', 'meta')):\n                    warnings.warn(\"table contains column(s) with defined 'format',\"\n                                  \" 'description', or 'meta' info attributes. These\"\n                                  \" will be dropped unless you install PyYAML.\",\n                                  AstropyUserWarning)\n                    break\n            return tbl\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    if encode_tbl is tbl:\n        return tbl\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    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        # 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":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":624,"header":"def degrees_to_string(d, precision=5, pad=False, sep=':', fields=3)","id":3184,"name":"degrees_to_string","nodeType":"Function","startLoc":615,"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":0,"comment":"null","endLoc":43,"id":3185,"name":"COLUMN_TIME_KEYWORDS","nodeType":"Attribute","startLoc":43,"text":"COLUMN_TIME_KEYWORDS"},{"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":599,"header":"def sexagesimal_to_string(values, precision=None, pad=False, sep=(':',),\n                          fields=3)","id":3186,"name":"sexagesimal_to_string","nodeType":"Function","startLoc":513,"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    # If the coordinates are negative, we need to take the absolute value of\n    # the (arc)minutes and (arc)seconds. We need to use np.abs because abs(-0)\n    # is -0.\n    values = (values[0], np.abs(values[1]), np.abs(values[2]))\n\n    if pad:\n        # Check to see if values[0] is negative, using np.copysign to handle -0\n        if np.copysign(1.0, values[0]) == -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 ** -4)\n    else:\n        rounding_thresh = 60.0 - (10.0 ** -precision)\n\n    values = list(values)\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 int(values[1]) >= 60.0:\n        values[1] = 0.0\n        values[0] += 1.0\n    elif fields < 2 and int(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 = '{0:.4f}'.format(abs(values[2]))\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(values[0], int(abs(values[1])), abs(values[2]),\n                          sep=sep, pad=pad,\n                          last_value=last_value)"},{"col":4,"comment":"Evaluate the model on some input variables.","endLoc":1234,"header":"@abc.abstractmethod\n    def evaluate(self, *args, **kwargs)","id":3187,"name":"evaluate","nodeType":"Function","startLoc":1232,"text":"@abc.abstractmethod\n    def evaluate(self, *args, **kwargs):\n        \"\"\"Evaluate the model on some input variables.\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":3188,"name":"COLUMN_TIME_KEYWORD_REGEXP","nodeType":"Attribute","startLoc":47,"text":"COLUMN_TIME_KEYWORD_REGEXP"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":3189,"name":"GLOBAL_TIME_INFO","nodeType":"Attribute","startLoc":64,"text":"GLOBAL_TIME_INFO"},{"col":0,"comment":"","endLoc":3,"header":"fitstime.py#<anonymous>","id":3190,"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 = '({0})[0-9]+'.format(\n    '|'.join(COLUMN_TIME_KEYWORDS))\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')}"},{"col":4,"comment":"null","endLoc":1526,"header":"def prepare_outputs(self, format_info, *outputs, **kwargs)","id":3191,"name":"prepare_outputs","nodeType":"Function","startLoc":1522,"text":"def prepare_outputs(self, format_info, *outputs, **kwargs):\n        if len(self) == 1:\n            return _prepare_outputs_single_model(self, outputs, format_info)\n        else:\n            return _prepare_outputs_model_set(self, outputs, format_info)"},{"col":0,"comment":"null","endLoc":3188,"header":"def _prepare_outputs_single_model(model, outputs, format_info)","id":3192,"name":"_prepare_outputs_single_model","nodeType":"Function","startLoc":3174,"text":"def _prepare_outputs_single_model(model, outputs, format_info):\n    broadcasts = format_info[0]\n\n    outputs = list(outputs)\n\n    for idx, output in enumerate(outputs):\n        broadcast_shape = broadcasts[idx]\n        if broadcast_shape is not None:\n            if not broadcast_shape:\n                # Shape is (), i.e. a scalar should be returned\n                outputs[idx] = np.asscalar(output)\n            else:\n                outputs[idx] = output.reshape(broadcast_shape)\n\n    return tuple(outputs)"},{"col":23,"endLoc":276,"id":3193,"nodeType":"Lambda","startLoc":274,"text":"lambda x: util.degrees_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)"},{"fileName":"ecsv.py","filePath":"astropy/io/ascii","id":3194,"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 contextlib\n\n\nfrom . import core, basic\nfrom ...table import meta, serialize\nfrom ...utils.data_info import serialize_context_as\n\n__doctest_requires__ = {'Ecsv': ['yaml']}\n\nECSV_VERSION = '0.9'\nDELIMITERS = (' ', ',')\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    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.  This format\n        starts with a delimiter separated list of the column names in order\n        to make this format readable by humans and simple csv-type readers.\n        It then encodes the full table meta and column attributes and meta\n        as YAML and pretty-prints this in the header.  Finally the delimited\n        column names are repeated again, for humans and readers that look\n        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        for col in self.cols:\n            if len(getattr(col, 'shape', ())) > 1:\n                raise ValueError(\"ECSV format does not support multidimensional column '{0}'\"\n                                 .format(col.info.name))\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 = (['%ECSV {0}'.format(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        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        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        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        # ecsv_version could be constructed here, but it is not currently used.\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 ValueError('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'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n            col.dtype = header_cols[col.name]['datatype']\n            # ECSV \"string\" means numpy dtype.kind == 'U' AKA str in Python 3\n            if col.dtype == 'string':\n                col.dtype = 'str'\n            if col.dtype.startswith('complex'):\n                raise TypeError('ecsv reader does not support complex number types')\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\nclass Ecsv(basic.Basic):\n    \"\"\"\n    Read a file which conforms to the ECSV (Enhanced Character Separated\n    Values) format.  This format allows for specification of key table\n    and column meta-data, in particular the data type and unit.  For details\n    see: https://github.com/astropy/astropy-APEs/blob/master/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    >>> 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    _format_name = 'ecsv'\n    _description = 'Enhanced CSV'\n    _io_registry_suffix = '.ecsv'\n\n    header_class = EcsvHeader\n    outputter_class = EcsvOutputter\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":4,"comment":"null","endLoc":98,"header":"def __init__(self, degree, n_models=None, model_set_axis=None,\n                 name=None, meta=None, **params)","id":3195,"name":"__init__","nodeType":"Function","startLoc":90,"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\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)"},{"col":4,"comment":"\n        Return the number of coefficients in one parameter set\n        ","endLoc":126,"header":"def get_num_coeff(self, ndim)","id":3196,"name":"get_num_coeff","nodeType":"Function","startLoc":112,"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":0,"comment":"null","endLoc":3267,"header":"def _prepare_outputs_model_set(model, outputs, format_info)","id":3197,"name":"_prepare_outputs_model_set","nodeType":"Function","startLoc":3256,"text":"def _prepare_outputs_model_set(model, outputs, format_info):\n    pivots = format_info[0]\n\n    outputs = list(outputs)\n\n    for idx, output in enumerate(outputs):\n        pivot = pivots[idx]\n        if pivot < output.ndim and pivot != model.model_set_axis:\n            outputs[idx] = np.rollaxis(output, pivot,\n                                       model.model_set_axis)\n\n    return tuple(outputs)"},{"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":486,"header":"def comb(N, k)","id":3198,"name":"comb","nodeType":"Function","startLoc":469,"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":"null","endLoc":151,"header":"def _generate_coeff_names(self, ndim)","id":3199,"name":"_generate_coeff_names","nodeType":"Function","startLoc":137,"text":"def _generate_coeff_names(self, ndim):\n        names = []\n        if ndim == 1:\n            for n in range(self._order):\n                names.append('c{0}'.format(n))\n        else:\n            for i in range(self.degree + 1):\n                names.append('c{0}_{1}'.format(i, 0))\n            for i in range(1, self.degree + 1):\n                names.append('c{0}_{1}'.format(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('c{0}_{1}'.format(i, j))\n        return tuple(names)"},{"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    ","endLoc":379,"header":"def write_table_fits(input, output, overwrite=False)","id":3200,"name":"write_table_fits","nodeType":"Function","startLoc":353,"text":"def write_table_fits(input, output, overwrite=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    \"\"\"\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        else:\n            raise OSError(\"File exists: {0}\".format(output))\n\n    table_hdu.writeto(output)"},{"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":170,"id":3201,"nodeType":"Class","startLoc":22,"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    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.  This format\n        starts with a delimiter separated list of the column names in order\n        to make this format readable by humans and simple csv-type readers.\n        It then encodes the full table meta and column attributes and meta\n        as YAML and pretty-prints this in the header.  Finally the delimited\n        column names are repeated again, for humans and readers that look\n        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        for col in self.cols:\n            if len(getattr(col, 'shape', ())) > 1:\n                raise ValueError(\"ECSV format does not support multidimensional column '{0}'\"\n                                 .format(col.info.name))\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 = (['%ECSV {0}'.format(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        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        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        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        # ecsv_version could be constructed here, but it is not currently used.\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 ValueError('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'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n            col.dtype = header_cols[col.name]['datatype']\n            # ECSV \"string\" means numpy dtype.kind == 'U' AKA str in Python 3\n            if col.dtype == 'string':\n                col.dtype = 'str'\n            if col.dtype.startswith('complex'):\n                raise TypeError('ecsv reader does not support complex number types')"},{"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 ``read()`` method,\n            or a list of strings.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        ","endLoc":307,"header":"def get_lines(self, table)","id":3202,"name":"get_lines","nodeType":"Function","startLoc":268,"text":"def get_lines(self, table):\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 ``read()`` method,\n            or a list of strings.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read') or\n                    ('\\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            lines = table.splitlines()\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                lines = table\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)"},{"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":612,"header":"def hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'),\n                    fields=3)","id":3203,"name":"hours_to_string","nodeType":"Function","startLoc":602,"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)"},{"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":3204,"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 = '# '"},{"col":4,"comment":"User-provided name for this model instance.","endLoc":798,"header":"@property\n    def name(self)","id":3205,"name":"name","nodeType":"Function","startLoc":794,"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":804,"header":"@name.setter\n    def name(self, val)","id":3206,"name":"name","nodeType":"Function","startLoc":800,"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 number of inputs to this model.\n\n        Equivalent to ``len(model.inputs)``.\n        ","endLoc":814,"header":"@property\n    def n_inputs(self)","id":3207,"name":"n_inputs","nodeType":"Function","startLoc":806,"text":"@property\n    def n_inputs(self):\n        \"\"\"\n        The number of inputs to this model.\n\n        Equivalent to ``len(model.inputs)``.\n        \"\"\"\n\n        return len(self.inputs)"},{"col":4,"comment":"\n        The number of outputs from this model.\n\n        Equivalent to ``len(model.outputs)``.\n        ","endLoc":823,"header":"@property\n    def n_outputs(self)","id":3208,"name":"n_outputs","nodeType":"Function","startLoc":816,"text":"@property\n    def n_outputs(self):\n        \"\"\"\n        The number of outputs from this model.\n\n        Equivalent to ``len(model.outputs)``.\n        \"\"\"\n        return len(self.outputs)"},{"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 `Model Sets\n        <http://docs.astropy.org/en/stable/modeling/models.html#model-sets>`_\n        for more details.\n        ","endLoc":837,"header":"@property\n    def model_set_axis(self)","id":3209,"name":"model_set_axis","nodeType":"Function","startLoc":825,"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 `Model Sets\n        <http://docs.astropy.org/en/stable/modeling/models.html#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":849,"header":"@property\n    def param_sets(self)","id":3210,"name":"param_sets","nodeType":"Function","startLoc":839,"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        A flattened array of all parameter values in all parameter sets.\n\n        Fittable parameters maintain this list and fitters modify it.\n        ","endLoc":870,"header":"@property\n    def parameters(self)","id":3211,"name":"parameters","nodeType":"Function","startLoc":851,"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        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":23,"endLoc":291,"id":3212,"nodeType":"Lambda","startLoc":289,"text":"lambda x: util.hours_to_string(\n                    x, precision=precision, sep=sep, pad=pad,\n                    fields=fields)"},{"col":4,"comment":"\n        Assigning to this attribute updates the parameters array rather than\n        replacing it.\n        ","endLoc":891,"header":"@parameters.setter\n    def parameters(self, value)","id":3213,"name":"parameters","nodeType":"Function","startLoc":872,"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))"},{"className":"BaseHeader","col":0,"comment":"\n    Base table header reader\n    ","endLoc":655,"id":3214,"nodeType":"Class","startLoc":506,"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        if self.comment:\n            re_comment = re.compile(self.comment)\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 is not False:\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 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\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if guessing and len(self.colnames) <= 1:\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 ValueError('Length of names argument ({0}) does not match number'\n                             ' of table columns ({1})'.format(len(names), len(self.colnames)))"},{"col":4,"comment":"null","endLoc":524,"header":"def __init__(self)","id":3215,"name":"__init__","nodeType":"Function","startLoc":523,"text":"def __init__(self):\n        self.splitter = self.splitter_class()"},{"col":4,"comment":"\n        A `dict` mapping parameter names to their fixed constraint.\n        ","endLoc":899,"header":"@property\n    def fixed(self)","id":3216,"name":"fixed","nodeType":"Function","startLoc":893,"text":"@property\n    def fixed(self):\n        \"\"\"\n        A `dict` mapping parameter names to their fixed constraint.\n        \"\"\"\n\n        return self._constraints['fixed']"},{"col":4,"comment":"\n        A `dict` mapping parameter names to their tied constraint.\n        ","endLoc":907,"header":"@property\n    def tied(self)","id":3217,"name":"tied","nodeType":"Function","startLoc":901,"text":"@property\n    def tied(self):\n        \"\"\"\n        A `dict` mapping parameter names to their tied constraint.\n        \"\"\"\n\n        return self._constraints['tied']"},{"col":4,"comment":"\n        A `dict` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples.\n        ","endLoc":916,"header":"@property\n    def bounds(self)","id":3218,"name":"bounds","nodeType":"Function","startLoc":909,"text":"@property\n    def bounds(self):\n        \"\"\"\n        A `dict` mapping parameter names to their upper and lower bounds as\n        ``(min, max)`` tuples.\n        \"\"\"\n\n        return self._constraints['bounds']"},{"col":4,"comment":"List of parameter equality constraints.","endLoc":922,"header":"@property\n    def eqcons(self)","id":3219,"name":"eqcons","nodeType":"Function","startLoc":918,"text":"@property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._constraints['eqcons']"},{"col":4,"comment":"List of parameter inequality constraints.","endLoc":928,"header":"@property\n    def ineqcons(self)","id":3220,"name":"ineqcons","nodeType":"Function","startLoc":924,"text":"@property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._constraints['ineqcons']"},{"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":959,"header":"@property\n    def inverse(self)","id":3221,"name":"inverse","nodeType":"Function","startLoc":930,"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\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            return self._inverse()\n\n        raise NotImplementedError(\"An analytical inverse transform has not \"\n                                  \"been implemented for this model.\")"},{"col":4,"comment":"null","endLoc":969,"header":"@inverse.setter\n    def inverse(self, value)","id":3222,"name":"inverse","nodeType":"Function","startLoc":961,"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        Resets the model's inverse to its default (if one exists, otherwise\n        the model will have no inverse).\n        ","endLoc":978,"header":"@inverse.deleter\n    def inverse(self)","id":3223,"name":"inverse","nodeType":"Function","startLoc":971,"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        del self._user_inverse"},{"attributeType":"null","col":27,"comment":"null","endLoc":9,"id":3224,"name":"io_registry","nodeType":"Attribute","startLoc":9,"text":"io_registry"},{"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":987,"header":"@property\n    def has_user_inverse(self)","id":3225,"name":"has_user_inverse","nodeType":"Function","startLoc":980,"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\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        `None` 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:`bounding-boxes`\n\n        The limits are ordered according to the `numpy` 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          File \"<stdin>\", line 1, in <module>\n          File \"astropy\\modeling\\core.py\", line 980, in bounding_box\n            \"No bounding box is defined for this model (note: the \"\n        NotImplementedError: No bounding box is defined for this model (note:\n        the bounding box was explicitly disabled for this model; use `del\n        model.bounding_box` to restore the default bounding box, if one is\n        defined for this model).\n        ","endLoc":1076,"header":"@property\n    def bounding_box(self)","id":3226,"name":"bounding_box","nodeType":"Function","startLoc":989,"text":"@property\n    def bounding_box(self):\n        r\"\"\"\n        A `tuple` of length `n_inputs` defining the bounding box limits, or\n        `None` 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:`bounding-boxes`\n\n        The limits are ordered according to the `numpy` 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          File \"<stdin>\", line 1, in <module>\n          File \"astropy\\modeling\\core.py\", line 980, in bounding_box\n            \"No bounding box is defined for this model (note: the \"\n        NotImplementedError: No bounding box is defined for this model (note:\n        the bounding box was explicitly disabled for this model; use `del\n        model.bounding_box` to restore the default bounding box, if one is\n        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, _BoundingBox):\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 self._bounding_box()\n        else:\n            # The only other allowed possibility is that it's a _BoundingBox\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)"},{"attributeType":"null","col":25,"comment":"null","endLoc":10,"id":3227,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"attributeType":"null","col":37,"comment":"null","endLoc":19,"id":3228,"name":"fits_open","nodeType":"Attribute","startLoc":19,"text":"fits_open"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":3229,"name":"FITS_SIGNATURE","nodeType":"Attribute","startLoc":24,"text":"FITS_SIGNATURE"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":3230,"name":"REMOVE_KEYWORDS","nodeType":"Attribute","startLoc":29,"text":"REMOVE_KEYWORDS"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":3231,"name":"COLUMN_KEYWORD_REGEXP","nodeType":"Attribute","startLoc":33,"text":"COLUMN_KEYWORD_REGEXP"},{"col":0,"comment":"","endLoc":4,"header":"connect.py#<anonymous>","id":3232,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"FITS_SIGNATURE = (b\"\\x53\\x49\\x4d\\x50\\x4c\\x45\\x20\\x20\\x3d\\x20\\x20\\x20\\x20\\x20\"\n                  b\"\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\"\n                  b\"\\x20\\x54\")\n\nREMOVE_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":899,"header":"def __init__(self, degree, x_domain=[-1, 1], y_domain=[-1, 1],\n                 x_window=[-1, 1], y_window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":3233,"name":"__init__","nodeType":"Function","startLoc":890,"text":"def __init__(self, degree, x_domain=[-1, 1], y_domain=[-1, 1],\n                 x_window=[-1, 1], y_window=[-1, 1], 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        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window"},{"fileName":"rst.py","filePath":"astropy/io/ascii","id":3234,"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    \"\"\"\n    Read or write a `reStructuredText simple format table\n    <http://docutils.sourceforge.net/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    _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"},{"col":4,"comment":"\n        Assigns the bounding box limits.\n        ","endLoc":1101,"header":"@bounding_box.setter\n    def bounding_box(self, bounding_box)","id":3235,"name":"bounding_box","nodeType":"Function","startLoc":1078,"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(self._bounding_box, type) and\n                issubclass(self._bounding_box, _BoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = _BoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box"},{"col":4,"comment":"null","endLoc":114,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3236,"name":"to_tree_transform","nodeType":"Function","startLoc":101,"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        return yamlutil.custom_tree_to_tagged_tree(node, ctx)"},{"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":456,"id":3237,"nodeType":"Class","startLoc":372,"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 recognised 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    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        Returns\n        -------\n        lines : iterator\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                                        lineterminator='')\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals)\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":369,"id":3238,"nodeType":"Class","startLoc":322,"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)"},{"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":348,"header":"def process_line(self, line)","id":3239,"name":"process_line","nodeType":"Function","startLoc":345,"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 value.","endLoc":352,"header":"def process_val(self, val)","id":3240,"name":"process_val","nodeType":"Function","startLoc":350,"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":527,"header":"def _set_cols_from_names(self)","id":3241,"name":"_set_cols_from_names","nodeType":"Function","startLoc":526,"text":"def _set_cols_from_names(self):\n        self.cols = [Column(name=x) for x in self.names]"},{"col":4,"comment":"null","endLoc":362,"header":"def __call__(self, lines)","id":3242,"name":"__call__","nodeType":"Function","startLoc":354,"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":4,"comment":"null","endLoc":256,"header":"def __init__(self, name)","id":3243,"name":"__init__","nodeType":"Function","startLoc":251,"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 = {}"},{"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":543,"header":"def update_meta(self, lines, meta)","id":3244,"name":"update_meta","nodeType":"Function","startLoc":529,"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"},{"col":4,"comment":"null","endLoc":369,"header":"def join(self, vals)","id":3245,"name":"join","nodeType":"Function","startLoc":364,"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)"},{"attributeType":"null","col":4,"comment":" one-character string used to separate fields ","endLoc":342,"id":3246,"name":"delimiter","nodeType":"Attribute","startLoc":342,"text":"delimiter"},{"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":580,"header":"def get_cols(self, lines)","id":3247,"name":"get_cols","nodeType":"Function","startLoc":545,"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":"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":406,"header":"def process_line(self, line)","id":3248,"name":"process_line","nodeType":"Function","startLoc":400,"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()"},{"col":4,"comment":"null","endLoc":122,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3249,"name":"assert_equal","nodeType":"Function","startLoc":116,"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)"},{"col":4,"comment":"Generator to yield non-blank and non-comment lines","endLoc":589,"header":"def process_lines(self, lines)","id":3250,"name":"process_lines","nodeType":"Function","startLoc":582,"text":"def process_lines(self, lines):\n        \"\"\"Generator to yield non-blank and non-comment lines\"\"\"\n        if self.comment:\n            re_comment = re.compile(self.comment)\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":4,"comment":"null","endLoc":71,"id":3251,"name":"name","nodeType":"Attribute","startLoc":71,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":3252,"name":"types","nodeType":"Attribute","startLoc":72,"text":"types"},{"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":319,"header":"def process_lines(self, lines)","id":3253,"name":"process_lines","nodeType":"Function","startLoc":309,"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":265,"id":3254,"name":"encoding","nodeType":"Attribute","startLoc":265,"text":"encoding"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":3255,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"polynomial.py#<anonymous>","id":3256,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['ShiftType', 'ScaleType', 'PolynomialType']"},{"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":486,"header":"def _replace_tab_with_space(line, escapechar, quotechar)","id":3257,"name":"_replace_tab_with_space","nodeType":"Function","startLoc":459,"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)"},{"col":4,"comment":"\n        Convert the given input into a list of SoupString rows\n        for further processing.\n        ","endLoc":112,"header":"def process_lines(self, lines)","id":3258,"name":"process_lines","nodeType":"Function","startLoc":77,"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 = 'number {0}'.format(self.html['table_id'])\n            else:\n                err_descr = \"id '{0}'\".format(self.html['table_id'])\n            raise core.InconsistentTableError(\n                'ERROR: HTML table {0} not found'.format(err_descr))\n\n        # Get all table rows\n        soup_list = [SoupString(x) for x in table.find_all('tr')]\n\n        return soup_list"},{"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":503,"header":"def _get_line_index(line_or_func, lines)","id":3259,"name":"_get_line_index","nodeType":"Function","startLoc":489,"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"},{"fileName":"sextractor.py","filePath":"astropy/io/ascii","id":3260,"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' (without 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                                 (?:\\s+(?P<coldescr> \\w .+)  # column description, match any character until...\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?  # ...until [non-space][space][unit] or [not-right-bracket][end]\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            n_data_cols = colnumbers[-1]  # handles no data, where we have to rely on the last column number\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]+\"_{}\".format(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    \"\"\"Read a SExtractor file.\n       SExtractor is a package for faint-galaxy photometry.\n       Bertin & Arnouts 1996, A&A Supp. 317, 393.\n       http://www.astromatic.net/software/sextractor\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 FLUX_RADIUS\n    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\n    optional and that units may be specified at the end of a line in brackets.\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"},{"col":4,"comment":"\n        Wrap the `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 `Angle` object is wrapped in\n        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 : str, `Angle`, angular `~astropy.units.Quantity`\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``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 `Angle`\n\n        Returns\n        -------\n        out : Angle or `None`\n            If ``inplace is False`` (default), return new `Angle` object\n            with angles wrapped accordingly.  Otherwise wrap in place and\n            return `None`.\n        ","endLoc":387,"header":"def wrap_at(self, wrap_angle, inplace=False)","id":3261,"name":"wrap_at","nodeType":"Function","startLoc":340,"text":"def wrap_at(self, wrap_angle, inplace=False):\n        \"\"\"\n        Wrap the `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 `Angle` object is wrapped in\n        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 : str, `Angle`, angular `~astropy.units.Quantity`\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``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 `Angle`\n\n        Returns\n        -------\n        out : Angle or `None`\n            If ``inplace is False`` (default), return new `Angle` object\n            with angles wrapped accordingly.  Otherwise wrap in place and\n            return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle)  # Convert to an Angle\n        wrapped = np.mod(self - wrap_angle, 360.0 * u.deg) - (360.0 * u.deg - wrap_angle)\n\n        if inplace:\n            self[()] = wrapped\n        else:\n            return wrapped"},{"className":"SExtractorHeader","col":0,"comment":"Read the header from a file produced by SExtractor.","endLoc":96,"id":3262,"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' (without 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                                 (?:\\s+(?P<coldescr> \\w .+)  # column description, match any character until...\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?  # ...until [non-space][space][unit] or [not-right-bracket][end]\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            n_data_cols = colnumbers[-1]  # handles no data, where we have to rely on the last column number\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]+\"_{}\".format(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":"\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":96,"header":"def get_cols(self, lines)","id":3263,"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' (without 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                                 (?:\\s+(?P<coldescr> \\w .+)  # column description, match any character until...\n                                 (?:(?<!(\\]))$|(?=(?:(?<=\\S)\\s+\\[.+\\]))))?  # ...until [non-space][space][unit] or [not-right-bracket][end]\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            n_data_cols = colnumbers[-1]  # handles no data, where we have to rely on the last column number\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]+\"_{}\".format(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":"\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 : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `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":427,"header":"def is_within_bounds(self, lower=None, upper=None)","id":3264,"name":"is_within_bounds","nodeType":"Function","startLoc":389,"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 : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `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":0,"comment":"\n    Checks whether the given BeautifulSoup tag is the table\n    the user intends to process.\n    ","endLoc":66,"header":"def identify_table(soup, htmldict, numtable)","id":3265,"name":"identify_table","nodeType":"Function","startLoc":47,"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"},{"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        Returns\n        -------\n        lines : iterator\n\n        ","endLoc":439,"header":"def __call__(self, lines)","id":3266,"name":"__call__","nodeType":"Function","startLoc":408,"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        Returns\n        -------\n        lines : iterator\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":"null","endLoc":1105,"header":"@bounding_box.deleter\n    def bounding_box(self)","id":3267,"name":"bounding_box","nodeType":"Function","startLoc":1103,"text":"@bounding_box.deleter\n    def bounding_box(self):\n        self._user_bounding_box = None"},{"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":1115,"header":"@property\n    def has_user_bounding_box(self)","id":3268,"name":"has_user_bounding_box","nodeType":"Function","startLoc":1107,"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":" A flag indicating whether a model is separable.","endLoc":1126,"header":"@property\n    def separable(self)","id":3269,"name":"separable","nodeType":"Function","startLoc":1117,"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        else:\n            raise NotImplementedError(\n                'The \"separable\" property is not defined for '\n                'model {}'.format(self.__class__.__name__))"},{"col":4,"comment":"null","endLoc":430,"header":"def __str__(self)","id":3270,"name":"__str__","nodeType":"Function","startLoc":429,"text":"def __str__(self):\n        return str(self.to_string())"},{"col":4,"comment":"null","endLoc":456,"header":"def join(self, vals)","id":3271,"name":"join","nodeType":"Function","startLoc":441,"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                                        lineterminator='')\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals)\n\n        return out"},{"col":4,"comment":"\n        Return an instance of the model for which the parameter values have been\n        converted to the right units for the data, then the units have been\n        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 necessarily\n        the units of the input data, but are derived from them. Model subclasses\n        that 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":1171,"header":"def without_units_for_data(self, **kwargs)","id":3272,"name":"without_units_for_data","nodeType":"Function","startLoc":1130,"text":"def without_units_for_data(self, **kwargs):\n        \"\"\"\n        Return an instance of the model for which the parameter values have been\n        converted to the right units for the data, then the units have been\n        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 necessarily\n        the units of the input data, but are derived from them. Model subclasses\n        that 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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, outputs_unit)\n\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        return model"},{"col":4,"comment":"null","endLoc":439,"header":"def _repr_latex_(self)","id":3273,"name":"_repr_latex_","nodeType":"Function","startLoc":432,"text":"def _repr_latex_(self):\n        if self.isscalar:\n            return self.to_string(format='latex')\n        else:\n            # Need to do a magic incantation to convert to str.  Regular str\n            # or array2string causes all backslashes to get doubled.\n            return np.array2string(self.to_string(format='latex'),\n                                   formatter={'str_kind': lambda x: x})"},{"col":4,"comment":"null","endLoc":594,"header":"def write_comments(self, lines, meta)","id":3274,"name":"write_comments","nodeType":"Function","startLoc":591,"text":"def write_comments(self, lines, meta):\n        if self.write_comment is not False:\n            for comment in meta.get('comments', []):\n                lines.append(self.write_comment + comment)"},{"col":4,"comment":"null","endLoc":74,"header":"def __init__(self, csvfile=None, **kwargs)","id":3275,"name":"__init__","nodeType":"Function","startLoc":65,"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":601,"header":"def write(self, lines)","id":3276,"name":"write","nodeType":"Function","startLoc":596,"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":58,"endLoc":439,"id":3277,"nodeType":"Lambda","startLoc":439,"text":"lambda x: x"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":3278,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":80,"text":"_equivalent_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":81,"id":3279,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":81,"text":"_include_easy_conversion_members"},{"attributeType":"null","col":20,"comment":"null","endLoc":95,"id":3280,"name":"angle_unit","nodeType":"Attribute","startLoc":95,"text":"angle_unit"},{"attributeType":"null","col":16,"comment":"null","endLoc":87,"id":3281,"name":"unit","nodeType":"Attribute","startLoc":87,"text":"unit"},{"attributeType":"null","col":16,"comment":"null","endLoc":107,"id":3282,"name":"angle","nodeType":"Attribute","startLoc":107,"text":"angle"},{"col":4,"comment":"null","endLoc":621,"header":"def __setitem__(self, item, value)","id":3283,"name":"__setitem__","nodeType":"Function","startLoc":616,"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_internal()"},{"attributeType":"null","col":4,"comment":" one-character string used to separate fields. ","endLoc":385,"id":3284,"name":"delimiter","nodeType":"Attribute","startLoc":385,"text":"delimiter"},{"attributeType":"null","col":4,"comment":" control how instances of *quotechar* in a field are quoted ","endLoc":387,"id":3285,"name":"quotechar","nodeType":"Attribute","startLoc":387,"text":"quotechar"},{"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":1536,"header":"def copy(self)","id":3286,"name":"copy","nodeType":"Function","startLoc":1528,"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":4,"comment":" character to remove special meaning from following character ","endLoc":389,"id":3287,"name":"doublequote","nodeType":"Attribute","startLoc":389,"text":"doublequote"},{"attributeType":"null","col":4,"comment":" one-character stringto quote fields containing special characters ","endLoc":391,"id":3288,"name":"escapechar","nodeType":"Attribute","startLoc":391,"text":"escapechar"},{"attributeType":"null","col":4,"comment":" control when quotes are recognised by the reader ","endLoc":393,"id":3289,"name":"quoting","nodeType":"Attribute","startLoc":393,"text":"quoting"},{"attributeType":"null","col":4,"comment":" ignore whitespace immediately following the delimiter ","endLoc":395,"id":3290,"name":"skipinitialspace","nodeType":"Attribute","startLoc":395,"text":"skipinitialspace"},{"col":4,"comment":"\n        Wrap the internal values in the Longitude object. Using the\n        :meth:`~astropy.coordinates.Angle.wrap_at` method causes\n        recursion.\n        ","endLoc":640,"header":"def _wrap_internal(self)","id":3291,"name":"_wrap_internal","nodeType":"Function","startLoc":623,"text":"def _wrap_internal(self):\n        \"\"\"\n        Wrap the internal values in the Longitude object. Using the\n        :meth:`~astropy.coordinates.Angle.wrap_at` method causes\n        recursion.\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 = self.wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.value\n        # Do the wrapping, but only if any angles need to be wrapped\n        if np.any(self_angle < wrap_angle_floor) or np.any(self_angle >= wrap_angle):\n            wrapped = np.mod(self_angle - wrap_angle, a360) + wrap_angle_floor\n            value = u.Quantity(wrapped, self.unit)\n            super().__setitem__((), value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":397,"id":3292,"name":"csv_writer","nodeType":"Attribute","startLoc":397,"text":"csv_writer"},{"attributeType":"null","col":4,"comment":"null","endLoc":398,"id":3293,"name":"csv_writer_out","nodeType":"Attribute","startLoc":398,"text":"csv_writer_out"},{"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 of\n        the input data, but are derived from them. Model subclasses that want\n        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":1214,"header":"def with_units_from_data(self, **kwargs)","id":3294,"name":"with_units_from_data","nodeType":"Function","startLoc":1173,"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 of\n        the input data, but are derived from them. Model subclasses that want\n        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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, 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, hence\n        # 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":446,"id":3295,"name":"csv_writer","nodeType":"Attribute","startLoc":446,"text":"self.csv_writer"},{"col":4,"comment":"Return the column names of the table","endLoc":607,"header":"@property\n    def colnames(self)","id":3296,"name":"colnames","nodeType":"Function","startLoc":603,"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":610,"header":"def get_type_map_key(self, col)","id":3297,"name":"get_type_map_key","nodeType":"Function","startLoc":609,"text":"def get_type_map_key(self, col):\n        return col.raw_type"},{"className":"FixedWidth","col":0,"comment":"\n    Read or write a fixed width table with a single header line that defines column\n    names and positions.  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:`fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":301,"id":3298,"nodeType":"Class","startLoc":264,"text":"class FixedWidth(basic.Basic):\n    \"\"\"\n    Read or write a fixed width table with a single header line that defines column\n    names and positions.  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:`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":"null","endLoc":618,"header":"def get_col_type(self, col)","id":3299,"name":"get_col_type","nodeType":"Function","startLoc":612,"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))"},{"className":"HTMLSplitter","col":0,"comment":"\n    Split HTML table data.\n    ","endLoc":138,"id":3300,"nodeType":"Class","startLoc":115,"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')"},{"col":4,"comment":"\n        Return HTML data from lines as a generator.\n        ","endLoc":138,"header":"def __call__(self, lines)","id":3301,"name":"__call__","nodeType":"Function","startLoc":120,"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')"},{"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":655,"header":"def check_column_names(self, names, strict_names, guessing)","id":3302,"name":"check_column_names","nodeType":"Function","startLoc":620,"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\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if guessing and len(self.colnames) <= 1:\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 ValueError('Length of names argument ({0}) does not match number'\n                             ' of table columns ({1})'.format(len(names), len(self.colnames)))"},{"col":4,"comment":"null","endLoc":1223,"header":"@property\n    def _has_units(self)","id":3303,"name":"_has_units","nodeType":"Function","startLoc":1216,"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":1230,"header":"@property\n    def _supports_unit_fitting(self)","id":3304,"name":"_supports_unit_fitting","nodeType":"Function","startLoc":1225,"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":1247,"header":"def sum_of_implicit_terms(self, *args, **kwargs)","id":3305,"name":"sum_of_implicit_terms","nodeType":"Function","startLoc":1236,"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 the\n            returned array. If this is not provided (or None), the model will be\n            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 passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of this\n            model is not set.\n\n        Examples\n        --------\n        :ref:`bounding-boxes`\n        ","endLoc":1360,"header":"def render(self, out=None, coords=None)","id":3306,"name":"render","nodeType":"Function","startLoc":1249,"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 the\n            returned array. If this is not provided (or None), the model will be\n            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 passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of this\n            model is not set.\n\n        Examples\n        --------\n        :ref:`bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\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, dtype=float)\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 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":0,"comment":"null","endLoc":1029,"header":"def _is_number(x)","id":3307,"name":"_is_number","nodeType":"Function","startLoc":1025,"text":"def _is_number(x):\n    with suppress(ValueError):\n        x = float(x)\n        return True\n    return False"},{"col":4,"comment":"null","endLoc":644,"header":"@property\n    def wrap_angle(self)","id":3308,"name":"wrap_angle","nodeType":"Function","startLoc":642,"text":"@property\n    def wrap_angle(self):\n        return self._wrap_angle"},{"col":4,"comment":"null","endLoc":649,"header":"@wrap_angle.setter\n    def wrap_angle(self, value)","id":3309,"name":"wrap_angle","nodeType":"Function","startLoc":646,"text":"@wrap_angle.setter\n    def wrap_angle(self, value):\n        self._wrap_angle = Angle(value)\n        self._wrap_internal()"},{"className":"Basic","col":0,"comment":"\n    Read a character-delimited table with a single header line at the top\n    followed by data lines to the end of the table.  Lines beginning with # as\n    the first non-whitespace character are comments.  This reader is highly\n    configurable.\n    ::\n\n        rdr = ascii.get_reader(Reader=ascii.Basic)\n        rdr.header.splitter.delimiter = ' '\n        rdr.data.splitter.delimiter = ' '\n        rdr.header.start_line = 0\n        rdr.data.start_line = 1\n        rdr.data.end_line = None\n        rdr.header.comment = r'\\s*#'\n        rdr.data.comment = r'\\s*#'\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":73,"id":3310,"nodeType":"Class","startLoc":42,"text":"class Basic(core.BaseReader):\n    r\"\"\"\n    Read a character-delimited table with a single header line at the top\n    followed by data lines to the end of the table.  Lines beginning with # as\n    the first non-whitespace character are comments.  This reader is highly\n    configurable.\n    ::\n\n        rdr = ascii.get_reader(Reader=ascii.Basic)\n        rdr.header.splitter.delimiter = ' '\n        rdr.data.splitter.delimiter = ' '\n        rdr.header.start_line = 0\n        rdr.data.start_line = 1\n        rdr.data.end_line = None\n        rdr.header.comment = r'\\s*#'\n        rdr.data.comment = r'\\s*#'\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\n    header_class = BasicHeader\n    data_class = BasicData"},{"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":1302,"id":3311,"nodeType":"Class","startLoc":1070,"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    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 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        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table)\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        table = self.outputter(cols, self.meta)\n        self.cols = self.header.cols\n\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\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        # 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":1111,"header":"def __init__(self)","id":3312,"name":"__init__","nodeType":"Function","startLoc":1096,"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":654,"header":"def __array_finalize__(self, obj)","id":3313,"name":"__array_finalize__","nodeType":"Function","startLoc":651,"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":659,"header":"def __array_wrap__(self, obj, context=None)","id":3314,"name":"__array_wrap__","nodeType":"Function","startLoc":657,"text":"def __array_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3315,"name":"comment","nodeType":"Attribute","startLoc":18,"text":"comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":84,"id":3316,"name":"names","nodeType":"Attribute","startLoc":84,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":3317,"name":"cols","nodeType":"Attribute","startLoc":91,"text":"self.cols"},{"className":"SExtractorData","col":0,"comment":"null","endLoc":102,"id":3318,"nodeType":"Class","startLoc":99,"text":"class SExtractorData(core.BaseData):\n    start_line = 0\n    delimiter = ' '\n    comment = r'\\s*#'"},{"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":1194,"header":"def read(self, table)","id":3319,"name":"read","nodeType":"Function","startLoc":1113,"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        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table)\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        table = self.outputter(cols, self.meta)\n        self.cols = self.header.cols\n\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\n\n        return table"},{"className":"BaseData","col":0,"comment":"\n    Base table data reader.\n    ","endLoc":828,"id":3320,"nodeType":"Class","startLoc":658,"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        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        \"\"\"Set the ``data_lines`` attribute to the lines slice comprising the\n        table data values.\"\"\"\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        \"\"\"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        \"\"\"Set the fill values of the 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        \"\"\"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=numpy.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        \"\"\"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        '''convert all values in table to a list of lists of strings'''\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        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        \"\"\"\n        \"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.name]"},{"col":4,"comment":"null","endLoc":683,"header":"def __init__(self)","id":3321,"name":"__init__","nodeType":"Function","startLoc":676,"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()"},{"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":175,"id":3322,"nodeType":"Class","startLoc":141,"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(numpy.int),\n                          core.convert_numpy(numpy.float),\n                          core.convert_numpy(numpy.str),\n                          core.convert_numpy(numpy.unicode)]\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":4,"comment":" format string for auto-generating column names ","endLoc":510,"id":3323,"name":"auto_format","nodeType":"Attribute","startLoc":510,"text":"auto_format"},{"attributeType":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":512,"id":3324,"name":"start_line","nodeType":"Attribute","startLoc":512,"text":"start_line"},{"attributeType":"null","col":4,"comment":" regular expression for comment lines ","endLoc":514,"id":3325,"name":"comment","nodeType":"Attribute","startLoc":514,"text":"comment"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":516,"id":3326,"name":"splitter_class","nodeType":"Attribute","startLoc":516,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":" list of names corresponding to each data column ","endLoc":518,"id":3327,"name":"names","nodeType":"Attribute","startLoc":518,"text":"names"},{"col":0,"comment":"Return any Angle subclass objects as an Angle objects.\n\n    This is used to ensure that Latitute and Longitude change to Angle\n    objects when they are used in calculations (such as lon/2.)\n    ","endLoc":451,"header":"def _no_angle_subclass(obj)","id":3328,"name":"_no_angle_subclass","nodeType":"Function","startLoc":442,"text":"def _no_angle_subclass(obj):\n    \"\"\"Return any Angle subclass objects as an Angle objects.\n\n    This is used to ensure that Latitute 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, Angle) else obj"},{"attributeType":"null","col":4,"comment":"null","endLoc":520,"id":3329,"name":"write_comment","nodeType":"Attribute","startLoc":520,"text":"write_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":521,"id":3330,"name":"write_spacer_lines","nodeType":"Attribute","startLoc":521,"text":"write_spacer_lines"},{"attributeType":"null","col":12,"comment":"null","endLoc":568,"id":3331,"name":"names","nodeType":"Attribute","startLoc":568,"text":"self.names"},{"className":"TableOutputter","col":0,"comment":"\n    Output the table as an astropy.table.Table object.\n    ","endLoc":993,"id":3332,"nodeType":"Class","startLoc":964,"text":"class TableOutputter(BaseOutputter):\n    \"\"\"\n    Output the table as an astropy.table.Table object.\n    \"\"\"\n\n    default_converters = [convert_numpy(numpy.int),\n                          convert_numpy(numpy.float),\n                          convert_numpy(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        # If there are any values that were filled and tagged with a mask bit then this\n        # will be a masked table.  Otherwise use a plain table.\n        masked = any(hasattr(col, 'mask') and numpy.any(col.mask) for col in cols)\n\n        out = Table([x.data for x in cols], names=[x.name for x in cols], masked=masked,\n                    meta=meta['table'])\n        for col, out_col in zip(cols, out.columns.values()):\n            if masked and hasattr(col, 'mask'):\n                out_col.data.mask = col.mask\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":524,"id":3333,"name":"splitter","nodeType":"Attribute","startLoc":524,"text":"self.splitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":527,"id":3334,"name":"cols","nodeType":"Attribute","startLoc":527,"text":"self.cols"},{"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":961,"id":3335,"nodeType":"Class","startLoc":899,"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            # If a specific dtype was specified for a column, then use that\n            # to set the defaults, otherwise use the generic defaults.\n            default_converters = ([convert_numpy(col.dtype)] if col.dtype\n                                  else self.default_converters)\n\n            # If the user supplied a specific convert then that takes precedence over defaults\n            converters = self.converters.get(col.name, 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:\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                    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 doesn't fit in native C long).\n                    # Put string at the top of the converters list for the next while iteration.\n                    warnings.warn(\"OverflowError converting to {0} for column {1}, using string instead.\"\n                                  .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err\n                except IndexError:\n                    raise ValueError('Column {} failed to convert: {}'.format(col.name, last_err))"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":3336,"name":"start_line","nodeType":"Attribute","startLoc":25,"text":"start_line"},{"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":923,"header":"@staticmethod\n    def _validate_and_copy(col, converters)","id":3337,"name":"_validate_and_copy","nodeType":"Function","startLoc":906,"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"},{"col":4,"comment":"\n        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":705,"header":"def process_lines(self, lines)","id":3338,"name":"process_lines","nodeType":"Function","startLoc":685,"text":"def process_lines(self, lines):\n        \"\"\"\n        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":4,"comment":"null","endLoc":26,"id":3339,"name":"comment","nodeType":"Attribute","startLoc":26,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":3340,"name":"write_comment","nodeType":"Attribute","startLoc":27,"text":"write_comment"},{"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":41,"header":"def process_lines(self, lines)","id":3341,"name":"process_lines","nodeType":"Function","startLoc":26,"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":"Set the ``data_lines`` attribute to the lines slice comprising the\n        table data values.","endLoc":717,"header":"def get_data_lines(self, lines)","id":3342,"name":"get_data_lines","nodeType":"Function","startLoc":707,"text":"def get_data_lines(self, lines):\n        \"\"\"Set the ``data_lines`` attribute to the lines slice comprising the\n        table data values.\"\"\"\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":663,"header":"def __array_ufunc__(self, *args, **kwargs)","id":3343,"name":"__array_ufunc__","nodeType":"Function","startLoc":661,"text":"def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"col":4,"comment":"Return a generator that returns a list of column values (as strings)\n        for each data line.","endLoc":722,"header":"def get_str_vals(self)","id":3344,"name":"get_str_vals","nodeType":"Function","startLoc":719,"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":"\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":1222,"header":"def inconsistent_handler(self, str_vals, ncols)","id":3345,"name":"inconsistent_handler","nodeType":"Function","startLoc":1196,"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":"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":733,"header":"def masks(self, cols)","id":3346,"name":"masks","nodeType":"Function","startLoc":724,"text":"def masks(self, cols):\n        \"\"\"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":601,"id":3347,"name":"_wrap_angle","nodeType":"Attribute","startLoc":601,"text":"_wrap_angle"},{"col":0,"comment":"\n    Apply names, include_names and exclude_names to a table.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Input table\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":1067,"header":"def _apply_include_exclude_names(table, names, include_names, exclude_names)","id":3348,"name":"_apply_include_exclude_names","nodeType":"Function","startLoc":1032,"text":"def _apply_include_exclude_names(table, names, include_names, exclude_names):\n    \"\"\"\n    Apply names, include_names and exclude_names to a table.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Input table\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\n    if names is not None:\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    names = set(table.colnames)\n    if include_names is not None:\n        names.intersection_update(include_names)\n    if exclude_names is not None:\n        names.difference_update(exclude_names)\n    if names != set(table.colnames):\n        remove_names = set(table.colnames) - set(names)\n        table.remove_columns(remove_names)"},{"attributeType":"null","col":4,"comment":"null","endLoc":602,"id":3349,"name":"_default_wrap_angle","nodeType":"Attribute","startLoc":602,"text":"_default_wrap_angle"},{"col":4,"comment":"null","endLoc":961,"header":"def _convert_vals(self, cols)","id":3350,"name":"_convert_vals","nodeType":"Function","startLoc":925,"text":"def _convert_vals(self, cols):\n        for col in cols:\n            # If a specific dtype was specified for a column, then use that\n            # to set the defaults, otherwise use the generic defaults.\n            default_converters = ([convert_numpy(col.dtype)] if col.dtype\n                                  else self.default_converters)\n\n            # If the user supplied a specific convert then that takes precedence over defaults\n            converters = self.converters.get(col.name, 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:\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                    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 doesn't fit in native C long).\n                    # Put string at the top of the converters list for the next while iteration.\n                    warnings.warn(\"OverflowError converting to {0} for column {1}, using string instead.\"\n                                  .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err\n                except IndexError:\n                    raise ValueError('Column {} failed to convert: {}'.format(col.name, last_err))"},{"attributeType":"null","col":4,"comment":"null","endLoc":603,"id":3351,"name":"info","nodeType":"Attribute","startLoc":603,"text":"info"},{"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://docs.scipy.org/doc/numpy/user/basics.types.html>`_,\n        e.g. numpy.int, numpy.uint, numpy.int8, numpy.int64, numpy.float,\n        numpy.float64, numpy.str.\n\n    Returns\n    -------\n    (converter, converter_type) : (function, generic data-type)\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n        ``converter_type`` tracks the generic data type produced by the converter\n        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":896,"header":"def convert_numpy(numpy_type)","id":3352,"name":"convert_numpy","nodeType":"Function","startLoc":831,"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://docs.scipy.org/doc/numpy/user/basics.types.html>`_,\n        e.g. numpy.int, numpy.uint, numpy.int8, numpy.int64, numpy.float,\n        numpy.float64, numpy.str.\n\n    Returns\n    -------\n    (converter, converter_type) : (function, generic data-type)\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n        ``converter_type`` tracks the generic data type produced by the converter\n        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') | (svals == 'True')):\n                raise ValueError('bool input strings must be only False or True')\n        vals = numpy.asarray(vals)\n        trues = vals == 'True'\n        falses = vals == 'False'\n        if not numpy.all(trues | falses):\n            raise ValueError('bool input strings must be only False or True')\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":613,"id":3353,"name":"wrap_angle","nodeType":"Attribute","startLoc":613,"text":"self.wrap_angle"},{"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 : `~numpy.ndarray`\n        The array from which to extract the small array.\n    shape : tuple or int\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 : tuple of numbers or number\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`` must have the same ``dtype`` as the\n        ``array_large`` array.\n    return_position : boolean, 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 : `~numpy.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":246,"header":"def extract_array(array_large, shape, position, mode='partial',\n                  fill_value=np.nan, return_position=False)","id":3354,"name":"extract_array","nodeType":"Function","startLoc":157,"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 : `~numpy.ndarray`\n        The array from which to extract the small array.\n    shape : tuple or int\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 : tuple of numbers or number\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`` must have the same ``dtype`` as the\n        ``array_large`` array.\n    return_position : boolean, 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 : `~numpy.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    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    # 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        extracted_array[:] = fill_value\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":"null","col":8,"comment":"null","endLoc":648,"id":3355,"name":"_wrap_angle","nodeType":"Attribute","startLoc":648,"text":"self._wrap_angle"},{"col":4,"comment":"\n        Write header information in the ECSV ASCII format.  This format\n        starts with a delimiter separated list of the column names in order\n        to make this format readable by humans and simple csv-type readers.\n        It then encodes the full table meta and column attributes and meta\n        as YAML and pretty-prints this in the header.  Finally the delimited\n        column names are repeated again, for humans and readers that look\n        for the *last* comment line as defining the column names.\n        ","endLoc":76,"header":"def write(self, lines)","id":3356,"name":"write","nodeType":"Function","startLoc":43,"text":"def write(self, lines):\n        \"\"\"\n        Write header information in the ECSV ASCII format.  This format\n        starts with a delimiter separated list of the column names in order\n        to make this format readable by humans and simple csv-type readers.\n        It then encodes the full table meta and column attributes and meta\n        as YAML and pretty-prints this in the header.  Finally the delimited\n        column names are repeated again, for humans and readers that look\n        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        for col in self.cols:\n            if len(getattr(col, 'shape', ())) > 1:\n                raise ValueError(\"ECSV format does not support multidimensional column '{0}'\"\n                                 .format(col.info.name))\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 = (['%ECSV {0}'.format(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":8,"comment":"null","endLoc":610,"id":3357,"name":"self","nodeType":"Attribute","startLoc":610,"text":"self"},{"col":4,"comment":"Return lines in the table that match header.comment regexp","endLoc":1234,"header":"@property\n    def comment_lines(self)","id":3358,"name":"comment_lines","nodeType":"Function","startLoc":1224,"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"},{"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":1254,"header":"def update_table_data(self, table)","id":3359,"name":"update_table_data","nodeType":"Function","startLoc":1236,"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"},{"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`, `Angle`. The\n        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\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 : :class:`~astropy.units.UnitBase`, str, 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":539,"id":3360,"nodeType":"Class","startLoc":454,"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`, `Angle`. The\n        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\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 : :class:`~astropy.units.UnitBase`, str, 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        if np.any(angles.value < lower) or np.any(angles.value > upper):\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {0}'.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        self._validate_angles(value)\n        super().__setitem__(item, value)\n\n    # Any calculation should drop to Angle\n    def __array_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)\n\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":1258,"header":"def write_header(self, lines, meta)","id":3361,"name":"write_header","nodeType":"Function","startLoc":1256,"text":"def write_header(self, lines, meta):\n        self.header.write_comments(lines, meta)\n        self.header.write(lines)"},{"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":522,"header":"def _validate_angles(self, angles=None)","id":3362,"name":"_validate_angles","nodeType":"Function","startLoc":508,"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        if np.any(angles.value < lower) or np.any(angles.value > upper):\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {0}'.format(angles.to(u.degree)))"},{"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":1302,"header":"def write(self, table)","id":3363,"name":"write","nodeType":"Function","startLoc":1260,"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        # 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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1084,"id":3364,"name":"names","nodeType":"Attribute","startLoc":1084,"text":"names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1085,"id":3365,"name":"include_names","nodeType":"Attribute","startLoc":1085,"text":"include_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1086,"id":3366,"name":"exclude_names","nodeType":"Attribute","startLoc":1086,"text":"exclude_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":903,"id":3367,"name":"converters","nodeType":"Attribute","startLoc":903,"text":"converters"},{"col":4,"comment":"null","endLoc":993,"header":"def __call__(self, cols, meta)","id":3368,"name":"__call__","nodeType":"Function","startLoc":973,"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        # If there are any values that were filled and tagged with a mask bit then this\n        # will be a masked table.  Otherwise use a plain table.\n        masked = any(hasattr(col, 'mask') and numpy.any(col.mask) for col in cols)\n\n        out = Table([x.data for x in cols], names=[x.name for x in cols], masked=masked,\n                    meta=meta['table'])\n        for col, out_col in zip(cols, out.columns.values()):\n            if masked and hasattr(col, 'mask'):\n                out_col.data.mask = col.mask\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":4,"comment":"null","endLoc":1087,"id":3369,"name":"strict_names","nodeType":"Attribute","startLoc":1087,"text":"strict_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1088,"id":3370,"name":"guessing","nodeType":"Attribute","startLoc":1088,"text":"guessing"},{"attributeType":"null","col":4,"comment":"null","endLoc":1089,"id":3371,"name":"encoding","nodeType":"Attribute","startLoc":1089,"text":"encoding"},{"attributeType":"null","col":4,"comment":"null","endLoc":1091,"id":3372,"name":"header_class","nodeType":"Attribute","startLoc":1091,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1092,"id":3373,"name":"data_class","nodeType":"Attribute","startLoc":1092,"text":"data_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1093,"id":3374,"name":"inputter_class","nodeType":"Attribute","startLoc":1093,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":1094,"id":3375,"name":"outputter_class","nodeType":"Attribute","startLoc":1094,"text":"outputter_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":1098,"id":3376,"name":"data","nodeType":"Attribute","startLoc":1098,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":1110,"id":3377,"name":"meta","nodeType":"Attribute","startLoc":1110,"text":"self.meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":1097,"id":3378,"name":"header","nodeType":"Attribute","startLoc":1097,"text":"self.header"},{"attributeType":"null","col":8,"comment":"null","endLoc":1099,"id":3379,"name":"inputter","nodeType":"Attribute","startLoc":1099,"text":"self.inputter"},{"attributeType":"null","col":8,"comment":"null","endLoc":1146,"id":3380,"name":"lines","nodeType":"Attribute","startLoc":1146,"text":"self.lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":1160,"id":3381,"name":"cols","nodeType":"Attribute","startLoc":1160,"text":"self.cols"},{"col":4,"comment":"null","endLoc":530,"header":"def __setitem__(self, item, value)","id":3382,"name":"__setitem__","nodeType":"Function","startLoc":524,"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        self._validate_angles(value)\n        super().__setitem__(item, value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1100,"id":3383,"name":"outputter","nodeType":"Attribute","startLoc":1100,"text":"self.outputter"},{"attributeType":"null","col":4,"comment":"null","endLoc":69,"id":3384,"name":"_format_name","nodeType":"Attribute","startLoc":69,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":70,"id":3385,"name":"_description","nodeType":"Attribute","startLoc":70,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":72,"id":3386,"name":"header_class","nodeType":"Attribute","startLoc":72,"text":"header_class"},{"col":4,"comment":"null","endLoc":535,"header":"def __array_wrap__(self, obj, context=None)","id":3387,"name":"__array_wrap__","nodeType":"Function","startLoc":533,"text":"def __array_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":3388,"name":"data_class","nodeType":"Attribute","startLoc":73,"text":"data_class"},{"col":4,"comment":"null","endLoc":539,"header":"def __array_ufunc__(self, *args, **kwargs)","id":3389,"name":"__array_ufunc__","nodeType":"Function","startLoc":537,"text":"def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)"},{"attributeType":"null","col":8,"comment":"null","endLoc":504,"id":3390,"name":"self","nodeType":"Attribute","startLoc":504,"text":"self"},{"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":466,"header":"def assert_quantity_allclose(actual, desired, rtol=1.e-7, atol=None,\n                             **kwargs)","id":3391,"name":"assert_quantity_allclose","nodeType":"Function","startLoc":455,"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    np.testing.assert_allclose(*_unquantify_allclose_arguments(actual, desired,\n                                                               rtol, atol),\n                               **kwargs)"},{"col":0,"comment":"null","endLoc":512,"header":"def _unquantify_allclose_arguments(actual, desired, rtol, atol)","id":3392,"name":"_unquantify_allclose_arguments","nodeType":"Function","startLoc":481,"text":"def _unquantify_allclose_arguments(actual, desired, rtol, atol):\n    from .. import units as u\n\n    actual = u.Quantity(actual, subok=True, copy=False)\n\n    desired = u.Quantity(desired, subok=True, copy=False)\n    try:\n        desired = desired.to(actual.unit)\n    except u.UnitsError:\n        raise u.UnitsError(\"Units for 'desired' ({0}) and 'actual' ({1}) \"\n                           \"are not convertible\"\n                           .format(desired.unit, actual.unit))\n\n    if atol is None:\n        # by default, we assume an absolute tolerance of 0\n        atol = u.Quantity(0)\n    else:\n        atol = u.Quantity(atol, subok=True, copy=False)\n        try:\n            atol = atol.to(actual.unit)\n        except u.UnitsError:\n            raise u.UnitsError(\"Units for 'atol' ({0}) and 'actual' ({1}) \"\n                               \"are not convertible\"\n                               .format(atol.unit, actual.unit))\n\n    rtol = u.Quantity(rtol, subok=True, copy=False)\n    try:\n        rtol = rtol.to(u.dimensionless_unscaled)\n    except Exception:\n        raise u.UnitsError(\"`rtol` should be dimensionless\")\n\n    return actual.value, desired.value, rtol.value, atol.value"},{"col":4,"comment":"\n        Override the default write_comments to do nothing since this is handled\n        in the custom write method.\n        ","endLoc":83,"header":"def write_comments(self, lines, meta)","id":3393,"name":"write_comments","nodeType":"Function","startLoc":78,"text":"def write_comments(self, lines, meta):\n        \"\"\"\n        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        Override the default update_meta to do nothing.  This process is done\n        in get_cols() for this reader.\n        ","endLoc":90,"header":"def update_meta(self, lines, meta)","id":3394,"name":"update_meta","nodeType":"Function","startLoc":85,"text":"def update_meta(self, lines, meta):\n        \"\"\"\n        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        Initialize the header Column objects from the table ``lines``.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":170,"header":"def get_cols(self, lines)","id":3395,"name":"get_cols","nodeType":"Function","startLoc":92,"text":"def get_cols(self, lines):\n        \"\"\"\n        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        # ecsv_version could be constructed here, but it is not currently used.\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 ValueError('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'):\n                if attr in header_cols[col.name]:\n                    setattr(col, attr, header_cols[col.name][attr])\n            col.dtype = header_cols[col.name]['datatype']\n            # ECSV \"string\" means numpy dtype.kind == 'U' AKA str in Python 3\n            if col.dtype == 'string':\n                col.dtype = 'str'\n            if col.dtype.startswith('complex'):\n                raise TypeError('ecsv reader does not support complex number types')"},{"col":4,"comment":"null","endLoc":301,"header":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True)","id":3396,"name":"__init__","nodeType":"Function","startLoc":296,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":969,"id":3397,"name":"default_converters","nodeType":"Attribute","startLoc":969,"text":"default_converters"},{"col":4,"comment":"\n        Process the data in multidimensional columns.\n        ","endLoc":175,"header":"def __call__(self, cols, meta)","id":3398,"name":"__call__","nodeType":"Function","startLoc":155,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":290,"id":3399,"name":"_format_name","nodeType":"Attribute","startLoc":290,"text":"_format_name"},{"col":4,"comment":"Set the fill values of the 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":777,"header":"def _set_fill_values(self, cols)","id":3400,"name":"_set_fill_values","nodeType":"Function","startLoc":735,"text":"def _set_fill_values(self, cols):\n        \"\"\"Set the fill values of the 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":4,"comment":"null","endLoc":150,"id":3401,"name":"default_converters","nodeType":"Attribute","startLoc":150,"text":"default_converters"},{"className":"HTMLHeader","col":0,"comment":"null","endLoc":216,"id":3402,"nodeType":"Class","startLoc":178,"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":193,"header":"def start_line(self, lines)","id":3403,"name":"start_line","nodeType":"Function","startLoc":181,"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":"\n        Set columns from header names, handling multicolumns appropriately.\n        ","endLoc":216,"header":"def _set_cols_from_names(self)","id":3404,"name":"_set_cols_from_names","nodeType":"Function","startLoc":195,"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":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 or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : tuple or int\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 : tuple of numbers or number\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 slices\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 : 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":154,"header":"def overlap_slices(large_array_shape, small_array_shape, position,\n                   mode='partial')","id":3405,"name":"overlap_slices","nodeType":"Function","startLoc":54,"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 or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : tuple or int\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 : tuple of numbers or number\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 slices\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 : 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 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    # Get edge coordinates\n    edges_min = [_round(pos + 0.5 - small_shape / 2. + _offset(small_shape))\n                 for (pos, small_shape) in zip(position, small_array_shape)]\n    edges_max = [_round(pos + 0.5 + small_shape / 2. + _offset(small_shape))\n                 for (pos, small_shape) in zip(position, small_array_shape)]\n\n    for e_max in edges_max:\n        if e_max <= 0:\n            raise NoOverlapError('Arrays do not overlap.')\n    for e_min, large_shape in zip(edges_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 edges_min:\n            if e_min < 0:\n                raise PartialOverlapError('Arrays overlap only partially.')\n        for e_max, large_shape in zip(edges_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, edge_min), min(large_shape, edge_max))\n                         for (edge_min, edge_max, large_shape) in\n                         zip(edges_min, edges_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, -edge_min),\n                                   min(large_shape - edge_min,\n                                       edge_max - edge_min))\n                             for (edge_min, edge_max, large_shape) in\n                             zip(edges_min, edges_max, large_array_shape))\n\n    return slices_large, slices_small"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":3406,"name":"names","nodeType":"Attribute","startLoc":142,"text":"self.names"},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":3407,"name":"table_meta","nodeType":"Attribute","startLoc":131,"text":"self.table_meta"},{"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":193,"id":3408,"nodeType":"Class","startLoc":173,"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"},{"col":4,"comment":"null","endLoc":193,"header":"def __call__(self, cols, meta)","id":3409,"name":"__call__","nodeType":"Function","startLoc":182,"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"},{"col":0,"comment":"Offset by 0.5 for an even array.\n\n    For an array with an odd number of elements, the center is\n    symmetric, e.g. for 3 elements, it's center +/-1 elements, but for\n    four elements it's center -2 / +1\n    This function introduces that offset.\n    ","endLoc":51,"header":"def _offset(a)","id":3410,"name":"_offset","nodeType":"Function","startLoc":40,"text":"def _offset(a):\n    '''Offset by 0.5 for an even array.\n\n    For an array with an odd number of elements, the center is\n    symmetric, e.g. for 3 elements, it's center +/-1 elements, but for\n    four elements it's center -2 / +1\n    This function introduces that offset.\n    '''\n    if np.mod(a, 2) == 0:\n        return -0.5\n    else:\n        return 0."},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":3411,"name":"default_converters","nodeType":"Attribute","startLoc":180,"text":"default_converters"},{"className":"Ecsv","col":0,"comment":"\n    Read a file which conforms to the ECSV (Enhanced Character Separated\n    Values) format.  This format allows for specification of key table\n    and column meta-data, in particular the data type and unit.  For details\n    see: https://github.com/astropy/astropy-APEs/blob/master/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    >>> 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    ","endLoc":252,"id":3412,"nodeType":"Class","startLoc":196,"text":"class Ecsv(basic.Basic):\n    \"\"\"\n    Read a file which conforms to the ECSV (Enhanced Character Separated\n    Values) format.  This format allows for specification of key table\n    and column meta-data, in particular the data type and unit.  For details\n    see: https://github.com/astropy/astropy-APEs/blob/master/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    >>> 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    _format_name = 'ecsv'\n    _description = 'Enhanced CSV'\n    _io_registry_suffix = '.ecsv'\n\n    header_class = EcsvHeader\n    outputter_class = EcsvOutputter\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":0,"comment":"Always round up.\n\n    ``np.round`` cannot be used here, because it rounds .5 to the nearest\n    even number.\n    ","endLoc":37,"header":"def _round(a)","id":3413,"name":"_round","nodeType":"Function","startLoc":31,"text":"def _round(a):\n    '''Always round up.\n\n    ``np.round`` cannot be used here, because it rounds .5 to the nearest\n    even number.\n    '''\n    return int(np.floor(a + 0.5))"},{"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":252,"header":"def update_table_data(self, table)","id":3414,"name":"update_table_data","nodeType":"Function","startLoc":232,"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":225,"id":3415,"name":"_format_name","nodeType":"Attribute","startLoc":225,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":226,"id":3416,"name":"_description","nodeType":"Attribute","startLoc":226,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":227,"id":3417,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":227,"text":"_io_registry_suffix"},{"attributeType":"EcsvHeader","col":4,"comment":"null","endLoc":229,"id":3418,"name":"header_class","nodeType":"Attribute","startLoc":229,"text":"header_class"},{"attributeType":"EcsvOutputter","col":4,"comment":"null","endLoc":230,"id":3419,"name":"outputter_class","nodeType":"Attribute","startLoc":230,"text":"outputter_class"},{"col":4,"comment":"Replace string values in col.str_vals and set masks","endLoc":787,"header":"def _set_masks(self, cols)","id":3420,"name":"_set_masks","nodeType":"Function","startLoc":779,"text":"def _set_masks(self, cols):\n        \"\"\"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=numpy.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":0,"comment":"null","endLoc":16,"id":3421,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":16,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":3422,"name":"ECSV_VERSION","nodeType":"Attribute","startLoc":18,"text":"ECSV_VERSION"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":3423,"name":"DELIMITERS","nodeType":"Attribute","startLoc":19,"text":"DELIMITERS"},{"col":0,"comment":"","endLoc":5,"header":"ecsv.py#<anonymous>","id":3424,"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\n__doctest_requires__ = {'Ecsv': ['yaml']}\n\nECSV_VERSION = '0.9'\n\nDELIMITERS = (' ', ',')"},{"col":4,"comment":"Replace string values in col.str_vals","endLoc":799,"header":"def _replace_vals(self, cols)","id":3425,"name":"_replace_vals","nodeType":"Function","startLoc":789,"text":"def _replace_vals(self, cols):\n        \"\"\"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"},{"col":4,"comment":"convert all values in table to a list of lists of strings","endLoc":808,"header":"def str_vals(self)","id":3426,"name":"str_vals","nodeType":"Function","startLoc":801,"text":"def str_vals(self):\n        '''convert all values in table to a list of lists of strings'''\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]"},{"fileName":"latex.py","filePath":"astropy/io/ascii","id":3427,"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'''Write and read LaTeX tables.\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    def __init__(self, ignore_latex_commands=['hline', 'vspace', 'tableline'],\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            # we compile separately because py2.6 doesn't have a flags keyword in re.sub\n            re_final_line = re.compile(r'\\s* \\\\ \\\\ \\s* $', flags=re.VERBOSE)\n            lines[-1] = re.sub(re_final_line, '', lines[-1])\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    '''Write and read AASTeX tables.\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(AASTex, self).__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":"\n        ","endLoc":828,"header":"def _set_col_formats(self)","id":3428,"name":"_set_col_formats","nodeType":"Function","startLoc":823,"text":"def _set_col_formats(self):\n        \"\"\"\n        \"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.name]"},{"col":4,"comment":"null","endLoc":821,"header":"def write(self, lines)","id":3429,"name":"write","nodeType":"Function","startLoc":810,"text":"def write(self, lines):\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))"},{"className":"LatexInputter","col":0,"comment":"null","endLoc":81,"id":3430,"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":0,"comment":"\n    Add a smaller array at a given position in a larger array.\n\n    Parameters\n    ----------\n    array_large : `~numpy.ndarray`\n        Large array.\n    array_small : `~numpy.ndarray`\n        Small array to add.\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 : `~numpy.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":297,"header":"def add_array(array_large, array_small, position)","id":3431,"name":"add_array","nodeType":"Function","startLoc":249,"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 : `~numpy.ndarray`\n        Large array.\n    array_small : `~numpy.ndarray`\n        Small array to add.\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 : `~numpy.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 really larger\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, 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.\")"},{"col":4,"comment":"null","endLoc":81,"header":"def process_lines(self, lines)","id":3432,"name":"process_lines","nodeType":"Function","startLoc":80,"text":"def process_lines(self, lines):\n        return [lin.strip() for lin in lines]"},{"attributeType":"null","col":4,"comment":"null","endLoc":291,"id":3433,"name":"_description","nodeType":"Attribute","startLoc":291,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":293,"id":3434,"name":"header_class","nodeType":"Attribute","startLoc":293,"text":"header_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":294,"id":3435,"name":"data_class","nodeType":"Attribute","startLoc":294,"text":"data_class"},{"className":"LatexSplitter","col":0,"comment":"Split LaTeX table date. Default delimiter is `&`.\n    ","endLoc":117,"id":3436,"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":"\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 overriden since it will return the input units based on the\n        annotations.\n        ","endLoc":1384,"header":"@property\n    def input_units(self)","id":3437,"name":"input_units","nodeType":"Function","startLoc":1362,"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 overriden 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":94,"header":"def __call__(self, lines)","id":3438,"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)"},{"className":"FixedWidthData","col":0,"comment":"\n    Base table data reader.\n    ","endLoc":261,"id":3439,"nodeType":"Class","startLoc":226,"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('Position_char=\"{}\" must be a single '\n                                 'character'.format(char))\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"},{"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":3440,"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 = '# '"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":3441,"name":"start_line","nodeType":"Attribute","startLoc":37,"text":"start_line"},{"attributeType":"HTMLSplitter","col":4,"comment":"null","endLoc":179,"id":3442,"name":"splitter_class","nodeType":"Attribute","startLoc":179,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":662,"id":3443,"name":"start_line","nodeType":"Attribute","startLoc":662,"text":"start_line"},{"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":3444,"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":"null","col":4,"comment":" None, int, or a function of ``lines`` that returns None or int ","endLoc":664,"id":3445,"name":"end_line","nodeType":"Attribute","startLoc":664,"text":"end_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":3446,"name":"comment","nodeType":"Attribute","startLoc":38,"text":"comment"},{"attributeType":"null","col":4,"comment":" Regular expression for comment lines ","endLoc":666,"id":3447,"name":"comment","nodeType":"Attribute","startLoc":666,"text":"comment"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":668,"id":3448,"name":"splitter_class","nodeType":"Attribute","startLoc":668,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":670,"id":3449,"name":"write_spacer_lines","nodeType":"Attribute","startLoc":670,"text":"write_spacer_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":216,"id":3450,"name":"names","nodeType":"Attribute","startLoc":216,"text":"self.names"},{"attributeType":"null","col":4,"comment":"null","endLoc":671,"id":3451,"name":"fill_include_names","nodeType":"Attribute","startLoc":671,"text":"fill_include_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":3452,"name":"write_comment","nodeType":"Attribute","startLoc":39,"text":"write_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":672,"id":3453,"name":"fill_exclude_names","nodeType":"Attribute","startLoc":672,"text":"fill_exclude_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":673,"id":3454,"name":"fill_values","nodeType":"Attribute","startLoc":673,"text":"fill_values"},{"attributeType":"null","col":4,"comment":"null","endLoc":674,"id":3455,"name":"formats","nodeType":"Attribute","startLoc":674,"text":"formats"},{"attributeType":"null","col":8,"comment":"null","endLoc":682,"id":3456,"name":"formats","nodeType":"Attribute","startLoc":682,"text":"self.formats"},{"attributeType":"null","col":12,"comment":"null","endLoc":715,"id":3457,"name":"data_lines","nodeType":"Attribute","startLoc":715,"text":"self.data_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":683,"id":3458,"name":"splitter","nodeType":"Attribute","startLoc":683,"text":"self.splitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":681,"id":3459,"name":"fill_values","nodeType":"Attribute","startLoc":681,"text":"self.fill_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":199,"id":3460,"name":"cols","nodeType":"Attribute","startLoc":199,"text":"self.cols"},{"className":"HTMLData","col":0,"comment":"null","endLoc":255,"id":3461,"nodeType":"Class","startLoc":219,"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":100,"id":3462,"name":"start_line","nodeType":"Attribute","startLoc":100,"text":"start_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":3463,"name":"delimiter","nodeType":"Attribute","startLoc":101,"text":"delimiter"},{"col":4,"comment":"null","endLoc":1388,"header":"@input_units.setter\n    def input_units(self, input_units)","id":3464,"name":"input_units","nodeType":"Function","startLoc":1386,"text":"@input_units.setter\n    def input_units(self, input_units):\n        self._input_units = input_units"},{"col":4,"comment":"\n        Return the line number at which table data begins.\n        ","endLoc":238,"header":"def start_line(self, lines)","id":3465,"name":"start_line","nodeType":"Function","startLoc":222,"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')"},{"col":4,"comment":"\n        This property is used to indicate what units or sets of units the output\n        of evaluate should be in, and returns a dictionary mapping outputs 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 output units, in which case this property should not be\n        overriden since it will return the return units based on the\n        annotations.\n        ","endLoc":1408,"header":"@property\n    def return_units(self)","id":3466,"name":"return_units","nodeType":"Function","startLoc":1390,"text":"@property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the output\n        of evaluate should be in, and returns a dictionary mapping outputs 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 output units, in which case this property should not be\n        overriden 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"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":3467,"name":"comment","nodeType":"Attribute","startLoc":102,"text":"comment"},{"col":4,"comment":"null","endLoc":261,"header":"def write(self, lines)","id":3468,"name":"write","nodeType":"Function","startLoc":233,"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('Position_char=\"{}\" must be a single '\n                                 'character'.format(char))\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"},{"className":"SExtractor","col":0,"comment":"Read a SExtractor file.\n       SExtractor is a package for faint-galaxy photometry.\n       Bertin & Arnouts 1996, A&A Supp. 317, 393.\n       http://www.astromatic.net/software/sextractor\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 FLUX_RADIUS\n    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\n    optional and that units may be specified at the end of a line in brackets.\n    ","endLoc":149,"id":3469,"nodeType":"Class","startLoc":105,"text":"class SExtractor(core.BaseReader):\n    \"\"\"Read a SExtractor file.\n       SExtractor is a package for faint-galaxy photometry.\n       Bertin & Arnouts 1996, A&A Supp. 317, 393.\n       http://www.astromatic.net/software/sextractor\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 FLUX_RADIUS\n    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\n    optional and that units may be specified at the end of a line in brackets.\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":146,"header":"def read(self, table)","id":3470,"name":"read","nodeType":"Function","startLoc":137,"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":"\n        Return the line number at which table data ends.\n        ","endLoc":255,"header":"def end_line(self, lines)","id":3471,"name":"end_line","nodeType":"Function","startLoc":240,"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"},{"col":4,"comment":"null","endLoc":149,"header":"def write(self, table)","id":3472,"name":"write","nodeType":"Function","startLoc":148,"text":"def write(self, table):\n        raise NotImplementedError"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":3473,"name":"_format_name","nodeType":"Attribute","startLoc":129,"text":"_format_name"},{"attributeType":"HTMLSplitter","col":4,"comment":"null","endLoc":220,"id":3474,"name":"splitter_class","nodeType":"Attribute","startLoc":220,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":130,"id":3475,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":130,"text":"_io_registry_can_write"},{"className":"HTML","col":0,"comment":"Read and write HTML tables.\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            http://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":466,"id":3476,"nodeType":"Class","startLoc":258,"text":"class HTML(core.BaseReader):\n    \"\"\"Read and write HTML tables.\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            http://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    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        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                        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(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                            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":"Remove whitespace and {} at the beginning or end of value.","endLoc":112,"header":"def process_val(self, val)","id":3477,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":131,"id":3478,"name":"_description","nodeType":"Attribute","startLoc":131,"text":"_description"},{"attributeType":"SExtractorHeader","col":4,"comment":"null","endLoc":133,"id":3479,"name":"header_class","nodeType":"Attribute","startLoc":133,"text":"header_class"},{"col":4,"comment":"\n        Initialize classes for HTML reading and writing.\n        ","endLoc":334,"header":"def __init__(self, htmldict={})","id":3480,"name":"__init__","nodeType":"Function","startLoc":324,"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":"null","endLoc":1412,"header":"@return_units.setter\n    def return_units(self, return_units)","id":3481,"name":"return_units","nodeType":"Function","startLoc":1410,"text":"@return_units.setter\n    def return_units(self, return_units):\n        self._return_units = return_units"},{"col":4,"comment":"\n        Return a deep copy of this model.\n\n        ","endLoc":1544,"header":"def deepcopy(self)","id":3482,"name":"deepcopy","nodeType":"Function","startLoc":1538,"text":"def deepcopy(self):\n        \"\"\"\n        Return a deep copy of this model.\n\n        \"\"\"\n\n        return copy.deepcopy(self)"},{"attributeType":"SExtractorData","col":4,"comment":"null","endLoc":134,"id":3483,"name":"data_class","nodeType":"Attribute","startLoc":134,"text":"data_class"},{"col":4,"comment":"\n        Return a copy of this model with a new name.\n        ","endLoc":1553,"header":"@sharedmethod\n    def rename(self, name)","id":3484,"name":"rename","nodeType":"Function","startLoc":1546,"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"},{"attributeType":"ContinuationLinesInputter","col":4,"comment":"null","endLoc":135,"id":3485,"name":"inputter_class","nodeType":"Attribute","startLoc":135,"text":"inputter_class"},{"col":4,"comment":"\n        Return the number of components in a single model, which is\n        obviously 1.\n        ","endLoc":1561,"header":"@sharedmethod\n    def n_submodels(self)","id":3486,"name":"n_submodels","nodeType":"Function","startLoc":1555,"text":"@sharedmethod\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":"\n        Creates a new instance of ``cls`` that shares its underlying parameter\n        values with an existing model instance given by ``existing``.\n\n        This is used primarily by compound models to return a view of an\n        individual component of a compound model.  ``param_names`` should be\n        the names of the parameters in the *existing* model to use as the\n        parameters in this new model.  Its length should equal the number of\n        parameters this model takes, so that it can map parameters on the\n        existing model to parameters on this model one-to-one.\n        ","endLoc":1611,"header":"@sharedmethod\n    def _from_existing(self, existing, param_names)","id":3487,"name":"_from_existing","nodeType":"Function","startLoc":1564,"text":"@sharedmethod\n    def _from_existing(self, existing, param_names):\n        \"\"\"\n        Creates a new instance of ``cls`` that shares its underlying parameter\n        values with an existing model instance given by ``existing``.\n\n        This is used primarily by compound models to return a view of an\n        individual component of a compound model.  ``param_names`` should be\n        the names of the parameters in the *existing* model to use as the\n        parameters in this new model.  Its length should equal the number of\n        parameters this model takes, so that it can map parameters on the\n        existing model to parameters on this model one-to-one.\n        \"\"\"\n\n        # Basically this is an alternative __init__\n        if isinstance(self, type):\n            # self is a class, not an instance\n            needs_initialization = True\n            dummy_args = (0,) * len(param_names)\n            self = self.__new__(self, *dummy_args)\n        else:\n            needs_initialization = False\n            self = self.copy()\n\n        aliases = dict(zip(self.param_names, param_names))\n        # This is basically an alternative _initialize_constraints\n        constraints = {}\n        for cons_type in self.parameter_constraints:\n            orig = existing._constraints[cons_type]\n            constraints[cons_type] = AliasDict(orig, aliases)\n\n        self._constraints = constraints\n\n        self._n_models = existing._n_models\n        self._model_set_axis = existing._model_set_axis\n        self._parameters = existing._parameters\n\n        self._param_metrics = defaultdict(dict)\n        for param_a, param_b in aliases.items():\n            # Take the param metrics info for the giving parameters in the\n            # existing model, and hand them to the appropriate parameters in\n            # the new model\n            self._param_metrics[param_a] = existing._param_metrics[param_b]\n\n        if needs_initialization:\n            self.__init__(*dummy_args)\n\n        return self"},{"col":4,"comment":"\n        Read the ``table`` in HTML format and return a resulting ``Table``.\n        ","endLoc":342,"header":"def read(self, table)","id":3488,"name":"read","nodeType":"Function","startLoc":336,"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":0,"comment":"","endLoc":8,"header":"sextractor.py#<anonymous>","id":3489,"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\"\"\""},{"className":"ICRSCoordType","col":0,"comment":"null","endLoc":57,"id":3490,"nodeType":"Class","startLoc":17,"text":"class ICRSCoordType(AstropyType):\n    name = \"coords/icrs_coord\"\n    types = ['astropy.coordinates.ICRS']\n    requires = ['astropy']\n    version = \"1.0.0\"\n\n    @classmethod\n    def from_tree(cls, node, ctx):\n        angle = Angle(QuantityType.from_tree(node['ra']['wrap_angle'], ctx))\n        wrap_angle = Angle(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': custom_tree_to_tagged_tree(wrap_angle, ctx)\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_quantity_allclose(new.ra, old.ra)\n        assert_quantity_allclose(new.dec, old.dec)"},{"col":4,"comment":"null","endLoc":33,"header":"@classmethod\n    def from_tree(cls, node, ctx)","id":3491,"name":"from_tree","nodeType":"Function","startLoc":23,"text":"@classmethod\n    def from_tree(cls, node, ctx):\n        angle = Angle(QuantityType.from_tree(node['ra']['wrap_angle'], ctx))\n        wrap_angle = Angle(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)"},{"fileName":"cds.py","filePath":"astropy/io/ascii","id":3492,"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\n\n__doctest_skip__ = ['*']\n\n\nclass CdsHeader(core.BaseHeader):\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 CDS format \"{}\" for column \"{}\"'.format(\n                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\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 {0} in {1}\".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\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                col.unit = match.group('units')\n                if col.unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS table\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<equal> =)? (?P<nullval> \\S*) (\\s+ (?P<descriptiontext> \\S.*))?', 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 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                        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('Line \"{}\" not parsable as CDS header'.format(line))\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    splitter_class = fixedwidth.FixedWidthSplitter\n\n    def process_lines(self, lines):\n        \"\"\"Skip over CDS 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('No CDS section delimiter found')\n        return lines[i_sections[-1]+1:]\n\n\nclass Cds(core.BaseReader):\n    \"\"\"Read a CDS format table.  See http://vizier.u-strasbg.fr/doc/catstd.htx.\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(\"t/cds.dat\")\n      >>> table = ascii.read(\"t/vizier/table1.dat\", readme=\"t/vizier/ReadMe\")\n      >>> table = ascii.read(\"t/cds/multi/lhs2065.dat\", readme=\"t/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"t/cds/glob/lmxbrefs.dat\", readme=\"t/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 = \"t/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"t/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"t/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(\"t/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(\"t/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":"\n        Return data in ``table`` converted to HTML as a list of strings.\n        ","endLoc":445,"header":"def write(self, table)","id":3493,"name":"write","nodeType":"Function","startLoc":344,"text":"def write(self, table):\n        \"\"\"\n        Return data in ``table`` converted to HTML as a list of strings.\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                        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(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                            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)]"},{"attributeType":"null","col":4,"comment":" Splitter class for splitting data lines into columns ","endLoc":230,"id":3494,"name":"splitter_class","nodeType":"Attribute","startLoc":230,"text":"splitter_class"},{"className":"FixedWidthHeader","col":0,"comment":"\n    Fixed width table header reader.\n    ","endLoc":223,"id":3495,"nodeType":"Class","startLoc":65,"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            data_lines = self.data.process_lines(lines)\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('Position line should only contain delimiters and 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(set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError('Characters in position line must be part of {0}'.format(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            ends = [x + 1 if x is not None else None for x in self.col_ends]  # user supplies inclusive endpoint\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":"null","endLoc":81,"header":"def get_line(self, lines, index)","id":3496,"name":"get_line","nodeType":"Function","startLoc":75,"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"},{"className":"CdsHeader","col":0,"comment":"null","endLoc":152,"id":3497,"nodeType":"Class","startLoc":25,"text":"class CdsHeader(core.BaseHeader):\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 CDS format \"{}\" for column \"{}\"'.format(\n                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\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 {0} in {1}\".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\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                col.unit = match.group('units')\n                if col.unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS table\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<equal> =)? (?P<nullval> \\S*) (\\s+ (?P<descriptiontext> \\S.*))?', 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 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                        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('Line \"{}\" not parsable as CDS header'.format(line))\n\n        self.names = [x.name for x in cols]\n\n        self.cols = cols"},{"col":4,"comment":"Join values together and add a few extra spaces for readability","endLoc":117,"header":"def join(self, vals)","id":3498,"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' \\\\'"},{"col":4,"comment":"null","endLoc":294,"header":"def __init__(self, parent, aliases)","id":3499,"name":"__init__","nodeType":"Function","startLoc":291,"text":"def __init__(self, parent, aliases):\n        self._parent = parent\n        self._store = self._store_type()\n        self._aliases = dict(aliases)"},{"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":602,"id":3500,"name":"parameter_constraints","nodeType":"Attribute","startLoc":602,"text":"parameter_constraints"},{"col":4,"comment":"null","endLoc":39,"header":"def get_type_map_key(self, col)","id":3501,"name":"get_type_map_key","nodeType":"Function","startLoc":34,"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 CDS format \"{}\" for column \"{}\"'.format(\n                col.raw_type, col.name))\n        return match.group(1)"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":3502,"name":"delimiter","nodeType":"Attribute","startLoc":87,"text":"delimiter"},{"className":"LatexHeader","col":0,"comment":"Class to read the header of Latex Tables","endLoc":163,"id":3503,"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":"null","endLoc":130,"header":"def start_line(self, lines)","id":3504,"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"},{"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":3505,"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        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":156,"header":"def get_cols(self, lines)","id":3506,"name":"get_cols","nodeType":"Function","startLoc":83,"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            data_lines = self.data.process_lines(lines)\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('Position line should only contain delimiters and 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(set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError('Characters in position line must be part of {0}'.format(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]"},{"attributeType":"null","col":4,"comment":"\n    Primarily for informational purposes, these are the types of constraints\n    that constrain model evaluation.\n    ","endLoc":607,"id":3507,"name":"model_constraints","nodeType":"Attribute","startLoc":607,"text":"model_constraints"},{"col":4,"comment":"null","endLoc":141,"header":"def _get_units(self)","id":3508,"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"},{"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":613,"id":3509,"name":"param_names","nodeType":"Attribute","startLoc":613,"text":"param_names"},{"col":4,"comment":"null","endLoc":163,"header":"def write(self, lines)","id":3510,"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":"The name(s) of the input variable(s) on which a model is evaluated.","endLoc":627,"id":3511,"name":"inputs","nodeType":"Attribute","startLoc":627,"text":"inputs"},{"attributeType":"null","col":4,"comment":"The name(s) of the output(s) of the model.","endLoc":629,"id":3512,"name":"outputs","nodeType":"Attribute","startLoc":629,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":632,"id":3513,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":632,"text":"standard_broadcasting"},{"attributeType":"null","col":4,"comment":"null","endLoc":633,"id":3514,"name":"fittable","nodeType":"Attribute","startLoc":633,"text":"fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":634,"id":3515,"name":"linear","nodeType":"Attribute","startLoc":634,"text":"linear"},{"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":218,"header":"def get_fixedwidth_params(self, line)","id":3516,"name":"get_fixedwidth_params","nodeType":"Function","startLoc":158,"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            ends = [x + 1 if x is not None else None for x in self.col_ends]  # user supplies inclusive endpoint\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"},{"attributeType":"null","col":4,"comment":" A boolean flag to indicate whether a model is separable.","endLoc":636,"id":3517,"name":"_separable","nodeType":"Attribute","startLoc":636,"text":"_separable"},{"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":3518,"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])"},{"attributeType":"null","col":4,"comment":"A dict-like object to store optional information.","endLoc":639,"id":3519,"name":"meta","nodeType":"Attribute","startLoc":639,"text":"meta"},{"attributeType":"null","col":4,"comment":"null","endLoc":647,"id":3520,"name":"_inverse","nodeType":"Attribute","startLoc":647,"text":"_inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":648,"id":3521,"name":"_user_inverse","nodeType":"Attribute","startLoc":648,"text":"_user_inverse"},{"attributeType":"null","col":4,"comment":"null","endLoc":650,"id":3522,"name":"_bounding_box","nodeType":"Attribute","startLoc":650,"text":"_bounding_box"},{"attributeType":"null","col":4,"comment":"null","endLoc":651,"id":3523,"name":"_user_bounding_box","nodeType":"Attribute","startLoc":651,"text":"_user_bounding_box"},{"attributeType":"null","col":4,"comment":"null","endLoc":655,"id":3524,"name":"_n_models","nodeType":"Attribute","startLoc":655,"text":"_n_models"},{"col":4,"comment":"\n        Initialize the header Column objects from the table ``lines`` for a CDS\n        header.\n\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        ","endLoc":152,"header":"def get_cols(self, lines)","id":3525,"name":"get_cols","nodeType":"Function","startLoc":41,"text":"def get_cols(self, lines):\n        \"\"\"\n        Initialize the header Column objects from the table ``lines`` for a CDS\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 {0} in {1}\".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\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                col.unit = match.group('units')\n                if col.unit == '---':\n                    col.unit = None  # \"---\" is the marker for no unit in CDS table\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<equal> =)? (?P<nullval> \\S*) (\\s+ (?P<descriptiontext> \\S.*))?', 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 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                        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('Line \"{}\" not parsable as CDS header'.format(line))\n\n        self.names = [x.name for x in cols]\n\n        self.cols = cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":661,"id":3526,"name":"input_units_strict","nodeType":"Attribute","startLoc":661,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":666,"id":3527,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":666,"text":"input_units_allow_dimensionless"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":3528,"name":"header_start","nodeType":"Attribute","startLoc":122,"text":"header_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":671,"id":3529,"name":"input_units_equivalencies","nodeType":"Attribute","startLoc":671,"text":"input_units_equivalencies"},{"attributeType":"LatexSplitter","col":4,"comment":"null","endLoc":123,"id":3530,"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":3531,"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'] + '}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":785,"id":3532,"name":"__add__","nodeType":"Attribute","startLoc":785,"text":"__add__"},{"attributeType":"null","col":4,"comment":"null","endLoc":786,"id":3533,"name":"__sub__","nodeType":"Attribute","startLoc":786,"text":"__sub__"},{"col":4,"comment":"null","endLoc":50,"header":"@classmethod\n    def to_tree(cls, frame, ctx)","id":3534,"name":"to_tree","nodeType":"Function","startLoc":35,"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': custom_tree_to_tagged_tree(wrap_angle, ctx)\n        }\n        node['dec'] = {\n            'value': frame.dec.value,\n            'unit': frame.dec.unit.to_string()\n        }\n\n        return node"},{"attributeType":"null","col":4,"comment":"null","endLoc":787,"id":3535,"name":"__mul__","nodeType":"Attribute","startLoc":787,"text":"__mul__"},{"attributeType":"null","col":4,"comment":"null","endLoc":788,"id":3536,"name":"__truediv__","nodeType":"Attribute","startLoc":788,"text":"__truediv__"},{"col":4,"comment":"\n        Parameters\n        ----------\n        file : writable file-like object.\n        ","endLoc":79,"header":"def __init__(self, file)","id":3537,"name":"__init__","nodeType":"Function","startLoc":64,"text":"def __init__(self, file):\n        \"\"\"\n        Parameters\n        ----------\n        file : writable file-like object.\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":789,"id":3538,"name":"__pow__","nodeType":"Attribute","startLoc":789,"text":"__pow__"},{"col":4,"comment":"null","endLoc":179,"header":"def start_line(self, lines)","id":3539,"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":790,"id":3540,"name":"__or__","nodeType":"Attribute","startLoc":790,"text":"__or__"},{"attributeType":"null","col":4,"comment":"null","endLoc":791,"id":3541,"name":"__and__","nodeType":"Attribute","startLoc":791,"text":"__and__"},{"attributeType":"null","col":8,"comment":"null","endLoc":1101,"id":3542,"name":"_user_bounding_box","nodeType":"Attribute","startLoc":1101,"text":"self._user_bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":1598,"id":3543,"name":"_model_set_axis","nodeType":"Attribute","startLoc":1598,"text":"self._model_set_axis"},{"attributeType":"null","col":8,"comment":"null","endLoc":677,"id":3544,"name":"_name","nodeType":"Attribute","startLoc":677,"text":"self._name"},{"col":4,"comment":"null","endLoc":185,"header":"def end_line(self, lines)","id":3545,"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":57,"header":"@classmethod\n    def assert_equal(cls, old, new)","id":3546,"name":"assert_equal","nodeType":"Function","startLoc":52,"text":"@classmethod\n    def assert_equal(cls, old, new):\n        assert isinstance(old, ICRS)\n        assert isinstance(new, ICRS)\n        assert_quantity_allclose(new.ra, old.ra)\n        assert_quantity_allclose(new.dec, old.dec)"},{"col":4,"comment":"null","endLoc":194,"header":"def write(self, lines)","id":3547,"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'] + '}')"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3548,"name":"name","nodeType":"Attribute","startLoc":18,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":3549,"name":"types","nodeType":"Attribute","startLoc":19,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":20,"id":3550,"name":"requires","nodeType":"Attribute","startLoc":20,"text":"requires"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":3551,"name":"version","nodeType":"Attribute","startLoc":21,"text":"version"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":3552,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"coords.py#<anonymous>","id":3553,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['ICRSCoordType']"},{"col":4,"comment":"null","endLoc":223,"header":"def write(self, lines)","id":3554,"name":"write","nodeType":"Function","startLoc":220,"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":69,"id":3555,"name":"splitter_class","nodeType":"Attribute","startLoc":69,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":" row index of line that specifies position (default = 1) ","endLoc":71,"id":3556,"name":"position_line","nodeType":"Attribute","startLoc":71,"text":"position_line"},{"fileName":"basic.py","filePath":"astropy/io/ascii","id":3557,"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\"\"\"\n    Read a character-delimited table with a single header line at the top\n    followed by data lines to the end of the table.  Lines beginning with # as\n    the first non-whitespace character are comments.  This reader is highly\n    configurable.\n    ::\n\n        rdr = ascii.get_reader(Reader=ascii.Basic)\n        rdr.header.splitter.delimiter = ' '\n        rdr.data.splitter.delimiter = ' '\n        rdr.header.start_line = 0\n        rdr.data.start_line = 1\n        rdr.data.end_line = None\n        rdr.header.comment = r'\\s*#'\n        rdr.data.comment = r'\\s*#'\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\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    \"\"\"\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\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    \"\"\"\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    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 first comment since this is the header line for\n        # commented_header format.\n        if 'comments' in out.meta:\n            out.meta['comments'] = out.meta['comments'][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    process_line = None\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    \"\"\"\n    Read a tab-separated file.  Unlike the :class:`Basic` reader, whitespace is\n    not stripped from the beginning and end of either lines or individual column\n    values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\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    \"\"\"\n    Read a CSV (comma-separated-values) file.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211,0.8,18.1\n      2,38.12321,-88.1321,2.2,17.0\n\n    Plain csv (comma separated value) files typically contain as many entries\n    as there are columns on each line. In contrast, common spreadsheet editors\n    stop writing if all remaining cells on a line are empty, which can lead to\n    lines where the rightmost entries are missing. This Reader can deal with\n    such files.\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    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    _format_name = 'csv'\n    _io_registry_can_write = True\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\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 ValueError('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 ValueError('RDB types definitions do not all match [num](N|S): {}'.format(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    \"\"\"\n    Read a tab-separated file with an extra line after the column definition\n    line.  The RDB format meets this definition.  Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    In this reader the second line is just ignored.\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":3558,"name":"set_of_position_line_characters","nodeType":"Attribute","startLoc":73,"text":"set_of_position_line_characters"},{"attributeType":"null","col":12,"comment":"null","endLoc":113,"id":3559,"name":"names","nodeType":"Attribute","startLoc":113,"text":"self.names"},{"attributeType":"None","col":4,"comment":"null","endLoc":168,"id":3560,"name":"data_start","nodeType":"Attribute","startLoc":168,"text":"data_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":169,"id":3561,"name":"data_end","nodeType":"Attribute","startLoc":169,"text":"data_end"},{"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":83,"id":3562,"nodeType":"Class","startLoc":76,"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":"LatexSplitter","col":4,"comment":"null","endLoc":170,"id":3563,"name":"splitter_class","nodeType":"Attribute","startLoc":170,"text":"splitter_class"},{"attributeType":"null","col":16,"comment":"null","endLoc":143,"id":3564,"name":"col_ends","nodeType":"Attribute","startLoc":143,"text":"self.col_ends"},{"attributeType":"None","col":4,"comment":"null","endLoc":83,"id":3565,"name":"start_line","nodeType":"Attribute","startLoc":83,"text":"start_line"},{"className":"Latex","col":0,"comment":"Write and read LaTeX tables.\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":338,"id":3566,"nodeType":"Class","startLoc":197,"text":"class Latex(core.BaseReader):\n    r'''Write and read LaTeX tables.\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    def __init__(self, ignore_latex_commands=['hline', 'vspace', 'tableline'],\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)"},{"attributeType":"null","col":22,"comment":"null","endLoc":142,"id":3567,"name":"col_starts","nodeType":"Attribute","startLoc":142,"text":"self.col_starts"},{"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":92,"id":3568,"nodeType":"Class","startLoc":86,"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":92,"id":3569,"name":"start_line","nodeType":"Attribute","startLoc":92,"text":"start_line"},{"col":4,"comment":"null","endLoc":333,"header":"def __init__(self, ignore_latex_commands=['hline', 'vspace', 'tableline'],\n                 latexdict={}, caption='', col_align=None)","id":3570,"name":"__init__","nodeType":"Function","startLoc":313,"text":"def __init__(self, ignore_latex_commands=['hline', 'vspace', 'tableline'],\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":"NoHeader","col":0,"comment":"\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    ","endLoc":108,"id":3571,"nodeType":"Class","startLoc":95,"text":"class NoHeader(Basic):\n    \"\"\"\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":3572,"name":"_format_name","nodeType":"Attribute","startLoc":105,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":3573,"name":"_description","nodeType":"Attribute","startLoc":106,"text":"_description"},{"className":"FixedWidthTwoLineDataSplitter","col":0,"comment":"Splitter for fixed width tables splitting on ``' '``.","endLoc":362,"id":3574,"nodeType":"Class","startLoc":360,"text":"class FixedWidthTwoLineDataSplitter(FixedWidthSplitter):\n    '''Splitter for fixed width tables splitting on ``' '``.'''\n    delimiter = ' '"},{"attributeType":"NoHeaderHeader","col":4,"comment":"null","endLoc":107,"id":3575,"name":"header_class","nodeType":"Attribute","startLoc":107,"text":"header_class"},{"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":57,"id":3576,"nodeType":"Class","startLoc":18,"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"},{"attributeType":"NoHeaderData","col":4,"comment":"null","endLoc":108,"id":3577,"name":"data_class","nodeType":"Attribute","startLoc":108,"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":129,"id":3578,"nodeType":"Class","startLoc":111,"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":"null","endLoc":44,"header":"def __call__(self, lines)","id":3579,"name":"__call__","nodeType":"Function","startLoc":38,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1601,"id":3580,"name":"_param_metrics","nodeType":"Attribute","startLoc":1601,"text":"self._param_metrics"},{"attributeType":"null","col":12,"comment":"null","endLoc":676,"id":3581,"name":"meta","nodeType":"Attribute","startLoc":676,"text":"self.meta"},{"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":225,"header":"@contextlib.contextmanager\n    def tag(self, tag, attrib={}, **extra)","id":3582,"name":"tag","nodeType":"Function","startLoc":207,"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":149,"header":"def start(self, tag, attrib={}, **extra)","id":3583,"name":"start","nodeType":"Function","startLoc":107,"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(\"<{}\".format(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(\" {}=\\\"{}\\\"\".format(k, v))\n        self._open = 1\n\n        return len(self._tags)"},{"col":4,"comment":"null","endLoc":338,"header":"def write(self, table=None)","id":3584,"name":"write","nodeType":"Function","startLoc":335,"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":"\n        Return only lines that start with the comment regexp.  For these\n        lines strip out the matching characters.\n        ","endLoc":126,"header":"def process_lines(self, lines)","id":3585,"name":"process_lines","nodeType":"Function","startLoc":117,"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":"\n        Flush internal buffers.\n        ","endLoc":105,"header":"def _flush(self, indent=True, wrap=False)","id":3586,"name":"_flush","nodeType":"Function","startLoc":81,"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 = []"},{"attributeType":"null","col":4,"comment":"null","endLoc":304,"id":3587,"name":"_format_name","nodeType":"Attribute","startLoc":304,"text":"_format_name"},{"col":4,"comment":"null","endLoc":57,"header":"def join(self, vals, widths)","id":3588,"name":"join","nodeType":"Function","startLoc":46,"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"},{"col":4,"comment":"null","endLoc":129,"header":"def write(self, lines)","id":3589,"name":"write","nodeType":"Function","startLoc":128,"text":"def write(self, lines):\n        lines.append(self.write_comment + self.splitter.join(self.colnames))"},{"attributeType":"null","col":4,"comment":"null","endLoc":305,"id":3590,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":305,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":306,"id":3591,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":306,"text":"_io_registry_suffix"},{"attributeType":"null","col":8,"comment":"null","endLoc":1412,"id":3592,"name":"_return_units","nodeType":"Attribute","startLoc":1412,"text":"self._return_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":307,"id":3593,"name":"_description","nodeType":"Attribute","startLoc":307,"text":"_description"},{"className":"CommentedHeader","col":0,"comment":"\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    ","endLoc":172,"id":3594,"nodeType":"Class","startLoc":132,"text":"class CommentedHeader(Basic):\n    \"\"\"\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    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 first comment since this is the header line for\n        # commented_header format.\n        if 'comments' in out.meta:\n            out.meta['comments'] = out.meta['comments'][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":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":165,"header":"def read(self, table)","id":3595,"name":"read","nodeType":"Function","startLoc":151,"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 first comment since this is the header line for\n        # commented_header format.\n        if 'comments' in out.meta:\n            out.meta['comments'] = out.meta['comments'][1:]\n            if not out.meta['comments']:\n                del out.meta['comments']\n\n        return out"},{"col":4,"comment":"\n        Returns a string of spaces that matches the current\n        indentation level.\n        ","endLoc":321,"header":"def get_indentation_spaces(self, offset=0)","id":3596,"name":"get_indentation_spaces","nodeType":"Function","startLoc":316,"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]"},{"attributeType":"LatexHeader","col":4,"comment":"null","endLoc":309,"id":3597,"name":"header_class","nodeType":"Attribute","startLoc":309,"text":"header_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":969,"id":3598,"name":"_user_inverse","nodeType":"Attribute","startLoc":969,"text":"self._user_inverse"},{"col":4,"comment":"\n        Write comment lines after, rather than before, the header.\n        ","endLoc":172,"header":"def write_header(self, lines, meta)","id":3599,"name":"write_header","nodeType":"Function","startLoc":167,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1597,"id":3600,"name":"_n_models","nodeType":"Attribute","startLoc":1597,"text":"self._n_models"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":3601,"name":"delimiter_pad","nodeType":"Attribute","startLoc":34,"text":"delimiter_pad"},{"attributeType":"null","col":8,"comment":"null","endLoc":1388,"id":3602,"name":"_input_units","nodeType":"Attribute","startLoc":1388,"text":"self._input_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":3603,"name":"bookend","nodeType":"Attribute","startLoc":35,"text":"bookend"},{"attributeType":"null","col":4,"comment":"null","endLoc":36,"id":3604,"name":"delimiter","nodeType":"Attribute","startLoc":36,"text":"delimiter"},{"attributeType":"LatexData","col":4,"comment":"null","endLoc":310,"id":3605,"name":"data_class","nodeType":"Attribute","startLoc":310,"text":"data_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":1595,"id":3606,"name":"_constraints","nodeType":"Attribute","startLoc":1595,"text":"self._constraints"},{"attributeType":"null","col":4,"comment":"null","endLoc":362,"id":3607,"name":"delimiter","nodeType":"Attribute","startLoc":362,"text":"delimiter"},{"className":"SimpleRSTHeader","col":0,"comment":"null","endLoc":24,"id":3608,"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":3609,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":3610,"name":"position_line","nodeType":"Attribute","startLoc":15,"text":"position_line"},{"attributeType":"LatexInputter","col":4,"comment":"null","endLoc":311,"id":3611,"name":"inputter_class","nodeType":"Attribute","startLoc":311,"text":"inputter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":3612,"name":"start_line","nodeType":"Attribute","startLoc":16,"text":"start_line"},{"attributeType":"DefaultSplitter","col":4,"comment":"null","endLoc":17,"id":3613,"name":"splitter_class","nodeType":"Attribute","startLoc":17,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":3614,"name":"position_char","nodeType":"Attribute","startLoc":18,"text":"position_char"},{"className":"SimpleRSTData","col":0,"comment":"null","endLoc":30,"id":3615,"nodeType":"Class","startLoc":27,"text":"class SimpleRSTData(FixedWidthData):\n    start_line = 3\n    end_line = -1\n    splitter_class = FixedWidthTwoLineDataSplitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":330,"id":3616,"name":"ignore_latex_commands","nodeType":"Attribute","startLoc":330,"text":"self.ignore_latex_commands"},{"attributeType":"null","col":4,"comment":"null","endLoc":28,"id":3617,"name":"start_line","nodeType":"Attribute","startLoc":28,"text":"start_line"},{"attributeType":"null","col":8,"comment":"null","endLoc":1599,"id":3618,"name":"_parameters","nodeType":"Attribute","startLoc":1599,"text":"self._parameters"},{"attributeType":"null","col":4,"comment":"null","endLoc":29,"id":3619,"name":"end_line","nodeType":"Attribute","startLoc":29,"text":"end_line"},{"attributeType":"FixedWidthTwoLineDataSplitter","col":4,"comment":"null","endLoc":30,"id":3620,"name":"splitter_class","nodeType":"Attribute","startLoc":30,"text":"splitter_class"},{"className":"RST","col":0,"comment":"\n    Read or write a `reStructuredText simple format table\n    <http://docutils.sourceforge.net/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    ","endLoc":62,"id":3621,"nodeType":"Class","startLoc":33,"text":"class RST(FixedWidth):\n    \"\"\"\n    Read or write a `reStructuredText simple format table\n    <http://docutils.sourceforge.net/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    _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":57,"header":"def __init__(self)","id":3622,"name":"__init__","nodeType":"Function","startLoc":56,"text":"def __init__(self):\n        super().__init__(delimiter_pad=None, bookend=False)"},{"attributeType":"null","col":4,"comment":"null","endLoc":145,"id":3623,"name":"_format_name","nodeType":"Attribute","startLoc":145,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":2072,"id":3624,"name":"linear","nodeType":"Attribute","startLoc":2072,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":146,"id":3625,"name":"_description","nodeType":"Attribute","startLoc":146,"text":"_description"},{"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":2074,"id":3626,"name":"fit_deriv","nodeType":"Attribute","startLoc":2074,"text":"fit_deriv"},{"attributeType":"null","col":4,"comment":"null","endLoc":2083,"id":3627,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":2083,"text":"col_fit_deriv"},{"attributeType":"null","col":4,"comment":"null","endLoc":2084,"id":3628,"name":"fittable","nodeType":"Attribute","startLoc":2084,"text":"fittable"},{"attributeType":"CommentedHeaderHeader","col":4,"comment":"null","endLoc":148,"id":3629,"name":"header_class","nodeType":"Attribute","startLoc":148,"text":"header_class"},{"col":4,"comment":"\n        The name(s) of the input variable(s) on which a model is evaluated.\n        ","endLoc":66,"header":"@property\n    def inputs(self)","id":3630,"name":"inputs","nodeType":"Function","startLoc":60,"text":"@property\n    def inputs(self):\n        \"\"\"\n        The name(s) of the input variable(s) on which a model is evaluated.\n        \"\"\"\n\n        return self._inputs"},{"col":4,"comment":"The name(s) of the output(s) of the model.","endLoc":72,"header":"@property\n    def outputs(self)","id":3631,"name":"outputs","nodeType":"Function","startLoc":68,"text":"@property\n    def outputs(self):\n        \"\"\"The name(s) of the output(s) of the model.\"\"\"\n\n        return self._outputs"},{"col":4,"comment":"Integers representing indices of the inputs.","endLoc":78,"header":"@property\n    def mapping(self)","id":3632,"name":"mapping","nodeType":"Function","startLoc":74,"text":"@property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n\n        return self._mapping"},{"col":4,"comment":"null","endLoc":84,"header":"def __repr__(self)","id":3633,"name":"__repr__","nodeType":"Function","startLoc":80,"text":"def __repr__(self):\n        if self.name is None:\n            return '<Mapping({0})>'.format(self.mapping)\n        else:\n            return '<Mapping({0}, name={1})>'.format(self.mapping, self.name)"},{"col":4,"comment":"null","endLoc":98,"header":"def evaluate(self, *args)","id":3634,"name":"evaluate","nodeType":"Function","startLoc":86,"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('{0} expects {1} inputs; got {2}'.format(\n                name, self.n_inputs, 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":123,"header":"@property\n    def inverse(self)","id":3635,"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 {0} 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        return inv"},{"attributeType":"NoHeaderData","col":4,"comment":"null","endLoc":149,"id":3636,"name":"data_class","nodeType":"Attribute","startLoc":149,"text":"data_class"},{"col":4,"comment":"null","endLoc":62,"header":"def write(self, lines)","id":3637,"name":"write","nodeType":"Function","startLoc":59,"text":"def write(self, lines):\n        lines = super().write(lines)\n        lines = [lines[1]] + lines + [lines[1]]\n        return lines"},{"className":"TabHeaderSplitter","col":0,"comment":"Split lines on tab and do not remove whitespace","endLoc":178,"id":3638,"nodeType":"Class","startLoc":175,"text":"class TabHeaderSplitter(core.DefaultSplitter):\n    \"\"\"Split lines on tab and do not remove whitespace\"\"\"\n    delimiter = '\\t'\n    process_line = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":3639,"name":"_format_name","nodeType":"Attribute","startLoc":51,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":3640,"name":"_description","nodeType":"Attribute","startLoc":52,"text":"_description"},{"attributeType":"SimpleRSTData","col":4,"comment":"null","endLoc":53,"id":3641,"name":"data_class","nodeType":"Attribute","startLoc":53,"text":"data_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":177,"id":3642,"name":"delimiter","nodeType":"Attribute","startLoc":177,"text":"delimiter"},{"attributeType":"SimpleRSTHeader","col":4,"comment":"null","endLoc":54,"id":3643,"name":"header_class","nodeType":"Attribute","startLoc":54,"text":"header_class"},{"attributeType":"None","col":4,"comment":"null","endLoc":178,"id":3644,"name":"process_line","nodeType":"Attribute","startLoc":178,"text":"process_line"},{"className":"TabDataSplitter","col":0,"comment":"\n    Don't strip data value whitespace since that is significant in TSV tables\n    ","endLoc":186,"id":3645,"nodeType":"Class","startLoc":181,"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"},{"attributeType":"None","col":4,"comment":"null","endLoc":185,"id":3646,"name":"process_val","nodeType":"Attribute","startLoc":185,"text":"process_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":3647,"name":"linear","nodeType":"Attribute","startLoc":47,"text":"linear"},{"col":0,"comment":"","endLoc":4,"header":"rst.py#<anonymous>","id":3648,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n:Author: Simon Gibbons (simongibbons@gmail.com)\n\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":56,"id":3649,"name":"_outputs","nodeType":"Attribute","startLoc":56,"text":"self._outputs"},{"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":280,"header":"def end(self, tag=None, indent=True, wrap=False)","id":3650,"name":"end","nodeType":"Function","startLoc":251,"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(\"unbalanced end({})\".format(tag))\n            if tag != self._tags[-1]:\n                raise ValueError(\"expected end({}), got {}\".format(\n                        self._tags[-1], 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(\"</{}>\\n\".format(tag))"},{"attributeType":"null","col":8,"comment":"null","endLoc":318,"id":3651,"name":"latex","nodeType":"Attribute","startLoc":318,"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":365,"id":3652,"nodeType":"Class","startLoc":341,"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])"},{"fileName":"setup_package.py","filePath":"astropy/io/ascii","id":3653,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license\n\nimport os\nfrom distutils.extension import Extension\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\"],\n        sources=sources)\n    return [ascii_ext]\n\n\ndef get_package_data():\n    # Installs the testing data files.  Unable to get package_data\n    # to deal with a directory hierarchy of files, so just explicitly list.\n    return {\n        'astropy.io.ascii.tests': ['t/vizier/ReadMe',\n                                   't/vizier/table1.dat',\n                                   't/vizier/table5.dat',\n                                   't/apostrophe.rdb',\n                                   't/apostrophe.tab',\n                                   't/bad.txt',\n                                   't/bars_at_ends.txt',\n                                   't/cds.dat',\n                                   't/cds_malformed.dat',\n                                   't/cds/glob/ReadMe',\n                                   't/cds/glob/lmxbrefs.dat',\n                                   't/cds/multi/ReadMe',\n                                   't/cds/multi/lhs2065.dat',\n                                   't/cds/multi/lp944-20.dat',\n                                   't/cds2.dat',\n                                   't/commented_header.dat',\n                                   't/commented_header2.dat',\n                                   't/continuation.dat',\n                                   't/daophot.dat',\n                                   't/daophot2.dat',\n                                   't/daophot3.dat',\n                                   't/daophot4.dat',\n                                   't/sextractor.dat',\n                                   't/sextractor2.dat',\n                                   't/sextractor3.dat',\n                                   't/daophot.dat.gz',\n                                   't/fill_values.txt',\n                                   't/html.html',\n                                   't/html2.html',\n                                   't/ipac.dat',\n                                   't/ipac.dat.bz2',\n                                   't/ipac.dat.xz',\n                                   't/latex1.tex',\n                                   't/latex1.tex.gz',\n                                   't/latex2.tex',\n                                   't/latex3.tex',\n                                   't/nls1_stackinfo.dbout',\n                                   't/no_data_cds.dat',\n                                   't/no_data_daophot.dat',\n                                   't/no_data_sextractor.dat',\n                                   't/no_data_ipac.dat',\n                                   't/no_data_with_header.dat',\n                                   't/no_data_without_header.dat',\n                                   't/short.rdb',\n                                   't/short.rdb.bz2',\n                                   't/short.rdb.gz',\n                                   't/short.rdb.xz',\n                                   't/short.tab',\n                                   't/simple.txt',\n                                   't/simple2.txt',\n                                   't/simple3.txt',\n                                   't/simple4.txt',\n                                   't/simple5.txt',\n                                   't/space_delim_blank_lines.txt',\n                                   't/space_delim_no_header.dat',\n                                   't/space_delim_no_names.dat',\n                                   't/test4.dat',\n                                   't/test5.dat',\n                                   't/vots_spec.dat',\n                                   't/whitespace.dat',\n                                   't/simple_csv.csv',\n                                   't/simple_csv_missing.csv',\n                                   't/fixed_width_2_line.txt',\n                                   't/cds/description/ReadMe',\n                                   't/cds/description/table.dat',\n                                   ]\n    }\n"},{"col":4,"comment":"null","endLoc":350,"header":"def __call__(self, lines)","id":3654,"name":"__call__","nodeType":"Function","startLoc":349,"text":"def __call__(self, lines):\n        return super(LatexSplitter, self).__call__(lines)"},{"attributeType":"null","col":4,"comment":"null","endLoc":186,"id":3655,"name":"skipinitialspace","nodeType":"Attribute","startLoc":186,"text":"skipinitialspace"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":3656,"name":"_mapping","nodeType":"Attribute","startLoc":57,"text":"self._mapping"},{"className":"TabHeader","col":0,"comment":"\n    Reader for header of tables with tab separated header\n    ","endLoc":193,"id":3657,"nodeType":"Class","startLoc":189,"text":"class TabHeader(BasicHeader):\n    \"\"\"\n    Reader for header of tables with tab separated header\n    \"\"\"\n    splitter_class = TabHeaderSplitter"},{"col":0,"comment":"null","endLoc":16,"header":"def get_extensions()","id":3658,"name":"get_extensions","nodeType":"Function","startLoc":9,"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\"],\n        sources=sources)\n    return [ascii_ext]"},{"attributeType":"TabHeaderSplitter","col":4,"comment":"null","endLoc":193,"id":3659,"name":"splitter_class","nodeType":"Attribute","startLoc":193,"text":"splitter_class"},{"col":0,"comment":"null","endLoc":89,"header":"def get_package_data()","id":3660,"name":"get_package_data","nodeType":"Function","startLoc":19,"text":"def get_package_data():\n    # Installs the testing data files.  Unable to get package_data\n    # to deal with a directory hierarchy of files, so just explicitly list.\n    return {\n        'astropy.io.ascii.tests': ['t/vizier/ReadMe',\n                                   't/vizier/table1.dat',\n                                   't/vizier/table5.dat',\n                                   't/apostrophe.rdb',\n                                   't/apostrophe.tab',\n                                   't/bad.txt',\n                                   't/bars_at_ends.txt',\n                                   't/cds.dat',\n                                   't/cds_malformed.dat',\n                                   't/cds/glob/ReadMe',\n                                   't/cds/glob/lmxbrefs.dat',\n                                   't/cds/multi/ReadMe',\n                                   't/cds/multi/lhs2065.dat',\n                                   't/cds/multi/lp944-20.dat',\n                                   't/cds2.dat',\n                                   't/commented_header.dat',\n                                   't/commented_header2.dat',\n                                   't/continuation.dat',\n                                   't/daophot.dat',\n                                   't/daophot2.dat',\n                                   't/daophot3.dat',\n                                   't/daophot4.dat',\n                                   't/sextractor.dat',\n                                   't/sextractor2.dat',\n                                   't/sextractor3.dat',\n                                   't/daophot.dat.gz',\n                                   't/fill_values.txt',\n                                   't/html.html',\n                                   't/html2.html',\n                                   't/ipac.dat',\n                                   't/ipac.dat.bz2',\n                                   't/ipac.dat.xz',\n                                   't/latex1.tex',\n                                   't/latex1.tex.gz',\n                                   't/latex2.tex',\n                                   't/latex3.tex',\n                                   't/nls1_stackinfo.dbout',\n                                   't/no_data_cds.dat',\n                                   't/no_data_daophot.dat',\n                                   't/no_data_sextractor.dat',\n                                   't/no_data_ipac.dat',\n                                   't/no_data_with_header.dat',\n                                   't/no_data_without_header.dat',\n                                   't/short.rdb',\n                                   't/short.rdb.bz2',\n                                   't/short.rdb.gz',\n                                   't/short.rdb.xz',\n                                   't/short.tab',\n                                   't/simple.txt',\n                                   't/simple2.txt',\n                                   't/simple3.txt',\n                                   't/simple4.txt',\n                                   't/simple5.txt',\n                                   't/space_delim_blank_lines.txt',\n                                   't/space_delim_no_header.dat',\n                                   't/space_delim_no_names.dat',\n                                   't/test4.dat',\n                                   't/test5.dat',\n                                   't/vots_spec.dat',\n                                   't/whitespace.dat',\n                                   't/simple_csv.csv',\n                                   't/simple_csv_missing.csv',\n                                   't/fixed_width_2_line.txt',\n                                   't/cds/description/ReadMe',\n                                   't/cds/description/table.dat',\n                                   ]\n    }"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":3661,"name":"ROOT","nodeType":"Attribute","startLoc":6,"text":"ROOT"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":3662,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ROOT = os.path.relpath(os.path.dirname(__file__))"},{"className":"TabData","col":0,"comment":"\n    Reader for data of tables with tab separated data\n    ","endLoc":200,"id":3663,"nodeType":"Class","startLoc":196,"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":200,"id":3664,"name":"splitter_class","nodeType":"Attribute","startLoc":200,"text":"splitter_class"},{"className":"Tab","col":0,"comment":"\n    Read a tab-separated file.  Unlike the :class:`Basic` reader, whitespace is\n    not stripped from the beginning and end of either lines or individual column\n    values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\n    ","endLoc":218,"id":3665,"nodeType":"Class","startLoc":203,"text":"class Tab(Basic):\n    \"\"\"\n    Read a tab-separated file.  Unlike the :class:`Basic` reader, whitespace is\n    not stripped from the beginning and end of either lines or individual column\n    values.\n\n    Example::\n\n      col1 <tab> col2 <tab> col3\n      # Comment line\n      1 <tab> 2 <tab> 5\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":215,"id":3666,"name":"_format_name","nodeType":"Attribute","startLoc":215,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":216,"id":3667,"name":"_description","nodeType":"Attribute","startLoc":216,"text":"_description"},{"attributeType":"TabHeader","col":4,"comment":"null","endLoc":217,"id":3668,"name":"header_class","nodeType":"Attribute","startLoc":217,"text":"header_class"},{"fileName":"misc.py","filePath":"astropy/io/ascii","id":3669,"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\nimport itertools\nimport operator\n\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 indeces:\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.Callable):\n        raise ValueError('globalkey needs to be callable')\n\n    if isinstance(key, collections.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"},{"attributeType":"TabData","col":4,"comment":"null","endLoc":218,"id":3670,"name":"data_class","nodeType":"Attribute","startLoc":218,"text":"data_class"},{"className":"CsvSplitter","col":0,"comment":"\n    Split on comma for CSV (comma-separated-value) tables\n    ","endLoc":225,"id":3671,"nodeType":"Class","startLoc":221,"text":"class CsvSplitter(core.DefaultSplitter):\n    \"\"\"\n    Split on comma for CSV (comma-separated-value) tables\n    \"\"\"\n    delimiter = ','"},{"attributeType":"null","col":12,"comment":"null","endLoc":54,"id":3672,"name":"_inputs","nodeType":"Attribute","startLoc":54,"text":"self._inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":225,"id":3673,"name":"delimiter","nodeType":"Attribute","startLoc":225,"text":"delimiter"},{"className":"CsvHeader","col":0,"comment":"\n    Header that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    ","endLoc":234,"id":3674,"nodeType":"Class","startLoc":228,"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":232,"id":3675,"name":"splitter_class","nodeType":"Attribute","startLoc":232,"text":"splitter_class"},{"col":0,"comment":"find the first index position for the which the callable pred returns True","endLoc":23,"header":"def first_true_index(iterable, pred=None, default=None)","id":3676,"name":"first_true_index","nodeType":"Function","startLoc":16,"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"},{"attributeType":"None","col":4,"comment":"null","endLoc":233,"id":3677,"name":"comment","nodeType":"Attribute","startLoc":233,"text":"comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":234,"id":3678,"name":"write_comment","nodeType":"Attribute","startLoc":234,"text":"write_comment"},{"className":"CsvData","col":0,"comment":"\n    Data that uses the :class:`astropy.io.ascii.basic.CsvSplitter`\n    ","endLoc":244,"id":3679,"nodeType":"Class","startLoc":237,"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":241,"id":3680,"name":"splitter_class","nodeType":"Attribute","startLoc":241,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":242,"id":3681,"name":"fill_values","nodeType":"Attribute","startLoc":242,"text":"fill_values"},{"col":4,"comment":"null","endLoc":167,"header":"def __repr__(self)","id":3682,"name":"__repr__","nodeType":"Function","startLoc":163,"text":"def __repr__(self):\n        if self.name is None:\n            return '<Identity({0})>'.format(self.n_inputs)\n        else:\n            return '<Identity({0}, name={1})>'.format(self.n_inputs, self.name)"},{"attributeType":"None","col":4,"comment":"null","endLoc":243,"id":3683,"name":"comment","nodeType":"Attribute","startLoc":243,"text":"comment"},{"col":4,"comment":"\n        The inverse transformation.\n\n        In this case of `Identity`, ``self.inverse is self``.\n        ","endLoc":177,"header":"@property\n    def inverse(self)","id":3684,"name":"inverse","nodeType":"Function","startLoc":169,"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":"None","col":4,"comment":"null","endLoc":244,"id":3685,"name":"write_comment","nodeType":"Attribute","startLoc":244,"text":"write_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":157,"id":3686,"name":"linear","nodeType":"Attribute","startLoc":157,"text":"linear"},{"className":"Csv","col":0,"comment":"\n    Read a CSV (comma-separated-values) file.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211,0.8,18.1\n      2,38.12321,-88.1321,2.2,17.0\n\n    Plain csv (comma separated value) files typically contain as many entries\n    as there are columns on each line. In contrast, common spreadsheet editors\n    stop writing if all remaining cells on a line are empty, which can lead to\n    lines where the rightmost entries are missing. This Reader can deal with\n    such files.\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    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    ","endLoc":303,"id":3687,"nodeType":"Class","startLoc":247,"text":"class Csv(Basic):\n    \"\"\"\n    Read a CSV (comma-separated-values) file.\n\n    Example::\n\n      num,ra,dec,radius,mag\n      1,32.23222,10.1211,0.8,18.1\n      2,38.12321,-88.1321,2.2,17.0\n\n    Plain csv (comma separated value) files typically contain as many entries\n    as there are columns on each line. In contrast, common spreadsheet editors\n    stop writing if all remaining cells on a line are empty, which can lead to\n    lines where the rightmost entries are missing. This Reader can deal with\n    such files.\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    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    _format_name = 'csv'\n    _io_registry_can_write = True\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":303,"header":"def inconsistent_handler(self, str_vals, ncols)","id":3688,"name":"inconsistent_handler","nodeType":"Function","startLoc":280,"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"},{"className":"CompoundType","col":0,"comment":"null","endLoc":101,"id":3689,"nodeType":"Class","startLoc":37,"text":"class CompoundType(TransformType):\n    name = ['transform/' + x for x in _tag_to_method_mapping.keys()]\n    types = ['astropy.modeling.core._CompoundModel']\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\n        oper = _tag_to_method_mapping[tag]\n        left = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][0], ctx)\n        if not isinstance(left, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][0]._tag))\n        right = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][1], ctx)\n        if not isinstance(right, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][1]._tag))\n        model = getattr(left, oper)(right)\n\n        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model\n\n    @classmethod\n    def _to_tree_from_model_tree(cls, tree, ctx):\n        if tree.left.isleaf:\n            left = yamlutil.custom_tree_to_tagged_tree(\n                tree.left.value, ctx)\n        else:\n            left = cls._to_tree_from_model_tree(tree.left, ctx)\n\n        if tree.right.isleaf:\n            right = yamlutil.custom_tree_to_tagged_tree(\n                tree.right.value, ctx)\n        else:\n            right = cls._to_tree_from_model_tree(tree.right, ctx)\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[tree.value]\n        except KeyError:\n            raise ValueError(\"Unknown operator '{0}'\".format(tree.value))\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n        return node\n\n    @classmethod\n    def to_tree_tagged(cls, model, ctx):\n        node = cls._to_tree_from_model_tree(model._tree, ctx)\n        cls._to_tree_base_transform_members(model, node, ctx)\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_tree_match(a._tree.left.value, b._tree.left.value)\n        assert_tree_match(a._tree.right.value, b._tree.right.value)\n        assert a._tree.value == b._tree.value"},{"col":15,"endLoc":21,"id":3690,"nodeType":"Lambda","startLoc":21,"text":"lambda x: pred(x[1])"},{"col":0,"comment":"find the first index position for the which the callable pred returns False","endLoc":32,"header":"def first_false_index(iterable, pred=None, default=None)","id":3691,"name":"first_false_index","nodeType":"Function","startLoc":26,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":273,"id":3692,"name":"_format_name","nodeType":"Attribute","startLoc":273,"text":"_format_name"},{"col":4,"comment":"null","endLoc":61,"header":"@classmethod\n    def from_tree_tagged(cls, node, ctx)","id":3693,"name":"from_tree_tagged","nodeType":"Function","startLoc":42,"text":"@classmethod\n    def from_tree_tagged(cls, node, ctx):\n        tag = node._tag[node._tag.rfind('/')+1:]\n        tag = tag[:tag.rfind('-')]\n\n        oper = _tag_to_method_mapping[tag]\n        left = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][0], ctx)\n        if not isinstance(left, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][0]._tag))\n        right = yamlutil.tagged_tree_to_custom_tree(\n            node['forward'][1], ctx)\n        if not isinstance(right, modeling.Model):\n            raise TypeError(\"Unknown model type '{0}'\".format(\n                node['forward'][1]._tag))\n        model = getattr(left, oper)(right)\n\n        model = cls._from_tree_base_transform_members(model, node, ctx)\n        return model"},{"attributeType":"null","col":4,"comment":"null","endLoc":274,"id":3694,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":274,"text":"_io_registry_can_write"},{"col":15,"endLoc":31,"id":3695,"nodeType":"Lambda","startLoc":31,"text":"lambda x: not pred(x)"},{"attributeType":"null","col":4,"comment":"null","endLoc":275,"id":3696,"name":"_description","nodeType":"Attribute","startLoc":275,"text":"_description"},{"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 indeces:\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":3697,"name":"sortmore","nodeType":"Function","startLoc":35,"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 indeces:\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.Callable):\n        raise ValueError('globalkey needs to be callable')\n\n    if isinstance(key, collections.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)))"},{"attributeType":"CsvHeader","col":4,"comment":"null","endLoc":277,"id":3698,"name":"header_class","nodeType":"Attribute","startLoc":277,"text":"header_class"},{"attributeType":"CsvData","col":4,"comment":"null","endLoc":278,"id":3699,"name":"data_class","nodeType":"Attribute","startLoc":278,"text":"data_class"},{"col":18,"endLoc":92,"id":3700,"nodeType":"Lambda","startLoc":92,"text":"lambda x: 0"},{"col":18,"endLoc":94,"id":3701,"nodeType":"Lambda","startLoc":94,"text":"lambda x: x"},{"col":20,"endLoc":96,"id":3702,"nodeType":"Lambda","startLoc":96,"text":"lambda *x: 0"},{"className":"RdbHeader","col":0,"comment":"\n    Header for RDB tables\n    ","endLoc":361,"id":3703,"nodeType":"Class","startLoc":306,"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\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 ValueError('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 ValueError('RDB types definitions do not all match [num](N|S): {}'.format(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":"\n        Adds character data to the output stream.\n\n        Parameters\n        ----------\n        text : str\n            Character data, as a Unicode string.\n        ","endLoc":249,"header":"def data(self, text)","id":3704,"name":"data","nodeType":"Function","startLoc":240,"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":4,"comment":"null","endLoc":314,"header":"def get_type_map_key(self, col)","id":3705,"name":"get_type_map_key","nodeType":"Function","startLoc":313,"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\n        Parameters\n        ----------\n        lines : list\n            List of table lines\n\n        Returns\n        -------\n        None\n\n        ","endLoc":351,"header":"def get_cols(self, lines)","id":3706,"name":"get_cols","nodeType":"Function","startLoc":316,"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\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 ValueError('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 ValueError('RDB types definitions do not all match [num](N|S): {}'.format(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)"},{"col":4,"comment":"extract column names from tablehead\n        ","endLoc":362,"header":"def process_line(self, line)","id":3707,"name":"process_line","nodeType":"Function","startLoc":352,"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":"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        `http://bleach.readthedocs.io/en/latest/clean.html <bleach>`_ 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=\"http://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":205,"header":"@contextlib.contextmanager\n    def xml_cleaning_method(self, method='escape_xml', **clean_kwargs)","id":3708,"name":"xml_cleaning_method","nodeType":"Function","startLoc":151,"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        `http://bleach.readthedocs.io/en/latest/clean.html <bleach>`_ 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=\"http://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            if HAS_BLEACH:\n                if clean_kwargs is None:\n                    clean_kwargs = {}\n                self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n            else:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\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"},{"col":40,"endLoc":194,"id":3709,"nodeType":"Lambda","startLoc":194,"text":"lambda x: bleach.clean(x, **clean_kwargs)"},{"col":36,"endLoc":199,"id":3710,"nodeType":"Lambda","startLoc":199,"text":"lambda x: x"},{"col":4,"comment":"null","endLoc":365,"header":"def join(self, vals)","id":3711,"name":"join","nodeType":"Function","startLoc":364,"text":"def join(self, vals):\n        return ' & '.join([r'\\colhead{' + str(x) + '}' for x in vals])"},{"col":4,"comment":"null","endLoc":87,"header":"@classmethod\n    def _to_tree_from_model_tree(cls, tree, ctx)","id":3712,"name":"_to_tree_from_model_tree","nodeType":"Function","startLoc":63,"text":"@classmethod\n    def _to_tree_from_model_tree(cls, tree, ctx):\n        if tree.left.isleaf:\n            left = yamlutil.custom_tree_to_tagged_tree(\n                tree.left.value, ctx)\n        else:\n            left = cls._to_tree_from_model_tree(tree.left, ctx)\n\n        if tree.right.isleaf:\n            right = yamlutil.custom_tree_to_tagged_tree(\n                tree.right.value, ctx)\n        else:\n            right = cls._to_tree_from_model_tree(tree.right, ctx)\n\n        node = {\n            'forward': [left, right]\n        }\n\n        try:\n            tag_name = 'transform/' + _operator_to_tag_mapping[tree.value]\n        except KeyError:\n            raise ValueError(\"Unknown operator '{0}'\".format(tree.value))\n\n        node = tagged.tag_object(cls.make_yaml_tag(tag_name), node, ctx=ctx)\n        return node"},{"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":400,"id":3713,"nodeType":"Class","startLoc":368,"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":379,"header":"def start_line(self, lines)","id":3714,"name":"start_line","nodeType":"Function","startLoc":378,"text":"def start_line(self, lines):\n        return find_latex_line(lines, r'\\tablehead')"},{"col":4,"comment":"null","endLoc":400,"header":"def write(self, lines)","id":3715,"name":"write","nodeType":"Function","startLoc":381,"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 + '}')"},{"col":12,"endLoc":102,"id":3716,"nodeType":"Lambda","startLoc":102,"text":"lambda x: (globalkey(*x), key(x[0]))"},{"col":27,"endLoc":104,"id":3717,"nodeType":"Lambda","startLoc":104,"text":"lambda x: 0"},{"col":4,"comment":"null","endLoc":361,"header":"def write(self, lines)","id":3718,"name":"write","nodeType":"Function","startLoc":353,"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))"},{"col":12,"endLoc":105,"id":3719,"nodeType":"Lambda","startLoc":105,"text":"lambda x: (globalkey(*x),) + tuple(f(z) for (f, z) in zip(key, x))"},{"attributeType":"null","col":4,"comment":"null","endLoc":310,"id":3720,"name":"col_type_map","nodeType":"Attribute","startLoc":310,"text":"col_type_map"},{"attributeType":"null","col":8,"comment":"null","endLoc":340,"id":3721,"name":"names","nodeType":"Attribute","startLoc":340,"text":"self.names"},{"attributeType":"null","col":4,"comment":"null","endLoc":375,"id":3722,"name":"header_start","nodeType":"Attribute","startLoc":375,"text":"header_start"},{"attributeType":"AASTexHeaderSplitter","col":4,"comment":"null","endLoc":376,"id":3723,"name":"splitter_class","nodeType":"Attribute","startLoc":376,"text":"splitter_class"},{"className":"RdbData","col":0,"comment":"\n    Data reader for RDB data. Starts reading at line 2.\n    ","endLoc":368,"id":3724,"nodeType":"Class","startLoc":364,"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":368,"id":3725,"name":"start_line","nodeType":"Attribute","startLoc":368,"text":"start_line"},{"className":"AASTexData","col":0,"comment":"In a `deluxetable`_ the data is enclosed in `\\startdata` and `\\enddata`\n    ","endLoc":424,"id":3726,"nodeType":"Class","startLoc":403,"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            # we compile separately because py2.6 doesn't have a flags keyword in re.sub\n            re_final_line = re.compile(r'\\s* \\\\ \\\\ \\s* $', flags=re.VERBOSE)\n            lines[-1] = re.sub(re_final_line, '', lines[-1])\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":410,"header":"def start_line(self, lines)","id":3727,"name":"start_line","nodeType":"Function","startLoc":409,"text":"def start_line(self, lines):\n        return find_latex_line(lines, self.data_start) + 1"},{"className":"Rdb","col":0,"comment":"\n    Read a tab-separated file with an extra line after the column definition\n    line.  The RDB format meets this definition.  Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    In this reader the second line is just ignored.\n    ","endLoc":388,"id":3728,"nodeType":"Class","startLoc":371,"text":"class Rdb(Tab):\n    \"\"\"\n    Read a tab-separated file with an extra line after the column definition\n    line.  The RDB format meets this definition.  Example::\n\n      col1 <tab> col2 <tab> col3\n      N <tab> S <tab> N\n      1 <tab> 2 <tab> 5\n\n    In this reader the second line is just ignored.\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"},{"col":4,"comment":"null","endLoc":424,"header":"def write(self, lines)","id":3729,"name":"write","nodeType":"Function","startLoc":412,"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            # we compile separately because py2.6 doesn't have a flags keyword in re.sub\n            re_final_line = re.compile(r'\\s* \\\\ \\\\ \\s* $', flags=re.VERBOSE)\n            lines[-1] = re.sub(re_final_line, '', lines[-1])\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":382,"id":3730,"name":"_format_name","nodeType":"Attribute","startLoc":382,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":383,"id":3731,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":383,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":384,"id":3732,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":384,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":385,"id":3733,"name":"_description","nodeType":"Attribute","startLoc":385,"text":"_description"},{"attributeType":"RdbHeader","col":4,"comment":"null","endLoc":387,"id":3734,"name":"header_class","nodeType":"Attribute","startLoc":387,"text":"header_class"},{"col":0,"comment":"Extends the itertools.groupby functionality to arbitrary number of iterators.","endLoc":127,"header":"def groupmore(func=None, *its)","id":3735,"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"},{"attributeType":"RdbData","col":4,"comment":"null","endLoc":388,"id":3736,"name":"data_class","nodeType":"Attribute","startLoc":388,"text":"data_class"},{"col":15,"endLoc":122,"id":3737,"nodeType":"Lambda","startLoc":122,"text":"lambda x: x"},{"attributeType":"null","col":4,"comment":"The ReadMe file to construct header from.","endLoc":26,"id":3738,"name":"col_type_map","nodeType":"Attribute","startLoc":26,"text":"col_type_map"},{"col":0,"comment":"","endLoc":10,"header":"basic.py#<anonymous>","id":3739,"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\"\"\""},{"attributeType":"None","col":4,"comment":"null","endLoc":32,"id":3740,"name":"readme","nodeType":"Attribute","startLoc":32,"text":"readme"},{"fileName":"core.py","filePath":"astropy/io/ascii","id":3741,"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\n\nfrom collections import OrderedDict\nfrom contextlib import suppress\nfrom io import StringIO\n\nimport numpy\n\nfrom ...utils.exceptions import AstropyWarning\n\nfrom ...table import Table\nfrom ...utils.data import get_readable_fileobj\nfrom . import connect\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\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\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\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    * **data** : list of converted column values\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\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):\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 ``read()`` method,\n            or a list of strings.\n\n        Returns\n        -------\n        lines : list\n            List of lines\n        \"\"\"\n        try:\n            if (hasattr(table, 'read') or\n                    ('\\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            lines = table.splitlines()\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                lines = table\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 recognised 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    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        Returns\n        -------\n        lines : iterator\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                                        lineterminator='')\n        if self.process_val:\n            vals = [self.process_val(x) for x in vals]\n        out = self.csv_writer.writerow(vals)\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        if self.comment:\n            re_comment = re.compile(self.comment)\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 is not False:\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 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\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!r} does not meet strict name requirements'\n                                     .format(name))\n        # When guessing require at least two columns\n        if guessing and len(self.colnames) <= 1:\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 ValueError('Length of names argument ({0}) does not match number'\n                             ' of table columns ({1})'.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        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        \"\"\"Set the ``data_lines`` attribute to the lines slice comprising the\n        table data values.\"\"\"\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        \"\"\"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        \"\"\"Set the fill values of the 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        \"\"\"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=numpy.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        \"\"\"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        '''convert all values in table to a list of lists of strings'''\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        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        \"\"\"\n        \"\"\"\n        for col in self.cols:\n            if col.info.name in self.formats:\n                col.info.format = self.formats[col.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://docs.scipy.org/doc/numpy/user/basics.types.html>`_,\n        e.g. numpy.int, numpy.uint, numpy.int8, numpy.int64, numpy.float,\n        numpy.float64, numpy.str.\n\n    Returns\n    -------\n    (converter, converter_type) : (function, generic data-type)\n        ``converter`` is a function which accepts a list and converts it to a\n        numpy array of type ``numpy_type``.\n        ``converter_type`` tracks the generic data type produced by the converter\n        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') | (svals == 'True')):\n                raise ValueError('bool input strings must be only False or True')\n        vals = numpy.asarray(vals)\n        trues = vals == 'True'\n        falses = vals == 'False'\n        if not numpy.all(trues | falses):\n            raise ValueError('bool input strings must be only False or True')\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            # If a specific dtype was specified for a column, then use that\n            # to set the defaults, otherwise use the generic defaults.\n            default_converters = ([convert_numpy(col.dtype)] if col.dtype\n                                  else self.default_converters)\n\n            # If the user supplied a specific convert then that takes precedence over defaults\n            converters = self.converters.get(col.name, 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:\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                    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 doesn't fit in native C long).\n                    # Put string at the top of the converters list for the next while iteration.\n                    warnings.warn(\"OverflowError converting to {0} for column {1}, using string instead.\"\n                                  .format(converter_type.__name__, col.name), AstropyWarning)\n                    col.converters.insert(0, convert_numpy(numpy.str))\n                    last_err = err\n                except IndexError:\n                    raise ValueError('Column {} failed to convert: {}'.format(col.name, last_err))\n\n\nclass TableOutputter(BaseOutputter):\n    \"\"\"\n    Output the table as an astropy.table.Table object.\n    \"\"\"\n\n    default_converters = [convert_numpy(numpy.int),\n                          convert_numpy(numpy.float),\n                          convert_numpy(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        # If there are any values that were filled and tagged with a mask bit then this\n        # will be a masked table.  Otherwise use a plain table.\n        masked = any(hasattr(col, 'mask') and numpy.any(col.mask) for col in cols)\n\n        out = Table([x.data for x in cols], names=[x.name for x in cols], masked=masked,\n                    meta=meta['table'])\n        for col, out_col in zip(cols, out.columns.values()):\n            if masked and hasattr(col, 'mask'):\n                out_col.data.mask = col.mask\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            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                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.\n\n    Parameters\n    ----------\n    table : `~astropy.table.Table`\n        Input table\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\n    if names is not None:\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    names = set(table.colnames)\n    if include_names is not None:\n        names.intersection_update(include_names)\n    if exclude_names is not None:\n        names.difference_update(exclude_names)\n    if names != set(table.colnames):\n        remove_names = set(table.colnames) - set(names)\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    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 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        # Get a list of the lines (rows) in the table\n        self.lines = self.inputter.get_lines(table)\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        table = self.outputter(cols, self.meta)\n        self.cols = self.header.cols\n\n        _apply_include_exclude_names(table, self.names, self.include_names, self.exclude_names)\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        # 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 or\n                                           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 'fast_reader' in kwargs:\n        del kwargs['fast_reader']  # ignore fast_reader parameter for slow readers\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    if 'delimiter' in kwargs:\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 '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 'fast_{0}'.format(Writer._format_name) in FAST_CLASSES:\n        # Switch to fast writer\n        kwargs['fast_writer'] = fast_writer\n        return FAST_CLASSES['fast_{0}'.format(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')\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":3742,"name":"names","nodeType":"Attribute","startLoc":150,"text":"self.names"},{"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":134,"id":3743,"nodeType":"Class","startLoc":40,"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":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":91,"header":"def writerow(self, values)","id":3744,"name":"writerow","nodeType":"Function","startLoc":76,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":406,"id":3745,"name":"data_start","nodeType":"Attribute","startLoc":406,"text":"data_start"},{"attributeType":"null","col":4,"comment":"null","endLoc":407,"id":3746,"name":"data_end","nodeType":"Attribute","startLoc":407,"text":"data_end"},{"className":"AASTex","col":0,"comment":"Write and read AASTeX tables.\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":451,"id":3747,"nodeType":"Class","startLoc":427,"text":"class AASTex(Latex):\n    '''Write and read AASTeX tables.\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(AASTex, self).__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":451,"header":"def __init__(self, **kwargs)","id":3748,"name":"__init__","nodeType":"Function","startLoc":447,"text":"def __init__(self, **kwargs):\n        super(AASTex, self).__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'"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":3749,"name":"cols","nodeType":"Attribute","startLoc":152,"text":"self.cols"},{"col":12,"endLoc":124,"id":3750,"nodeType":"Lambda","startLoc":124,"text":"lambda x: func(x[0])"},{"attributeType":"null","col":4,"comment":"null","endLoc":439,"id":3751,"name":"_format_name","nodeType":"Attribute","startLoc":439,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":440,"id":3752,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":440,"text":"_io_registry_format_aliases"},{"className":"CdsData","col":0,"comment":"CDS table data reader\n    ","endLoc":172,"id":3753,"nodeType":"Class","startLoc":155,"text":"class CdsData(core.BaseData):\n    \"\"\"CDS table data reader\n    \"\"\"\n    splitter_class = fixedwidth.FixedWidthSplitter\n\n    def process_lines(self, lines):\n        \"\"\"Skip over CDS 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('No CDS section delimiter found')\n        return lines[i_sections[-1]+1:]"},{"attributeType":"null","col":4,"comment":"null","endLoc":441,"id":3754,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":441,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":442,"id":3755,"name":"_description","nodeType":"Attribute","startLoc":442,"text":"_description"},{"col":4,"comment":"null","endLoc":93,"header":"@classmethod\n    def to_tree_tagged(cls, model, ctx)","id":3756,"name":"to_tree_tagged","nodeType":"Function","startLoc":89,"text":"@classmethod\n    def to_tree_tagged(cls, model, ctx):\n        node = cls._to_tree_from_model_tree(model._tree, ctx)\n        cls._to_tree_base_transform_members(model, node, ctx)\n        return node"},{"attributeType":"AASTexHeader","col":4,"comment":"null","endLoc":444,"id":3757,"name":"header_class","nodeType":"Attribute","startLoc":444,"text":"header_class"},{"attributeType":"AASTexData","col":4,"comment":"null","endLoc":445,"id":3758,"name":"data_class","nodeType":"Attribute","startLoc":445,"text":"data_class"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":3759,"name":"latexdicts","nodeType":"Attribute","startLoc":16,"text":"latexdicts"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":3760,"name":"RE_COMMENT","nodeType":"Attribute","startLoc":32,"text":"RE_COMMENT"},{"col":0,"comment":"","endLoc":9,"header":"latex.py#<anonymous>","id":3761,"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 \\%"},{"col":4,"comment":"Skip over CDS header by finding the last section delimiter","endLoc":172,"header":"def process_lines(self, lines)","id":3762,"name":"process_lines","nodeType":"Function","startLoc":160,"text":"def process_lines(self, lines):\n        \"\"\"Skip over CDS 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('No CDS section delimiter found')\n        return lines[i_sections[-1]+1:]"},{"fileName":"__init__.py","filePath":"astropy/io/ascii","id":3763,"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\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 .ecsv import Ecsv\nfrom .latex import Latex, AASTex, latexdicts\nfrom .html import HTML\nfrom .ipac import Ipac\nfrom .daophot import Daophot\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"},{"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":161,"id":3764,"nodeType":"Class","startLoc":155,"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":181,"id":3765,"nodeType":"Class","startLoc":174,"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":197,"id":3766,"nodeType":"Class","startLoc":191,"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":203,"id":3767,"nodeType":"Class","startLoc":200,"text":"class StrType(NoType):\n    \"\"\"\n    Indicates that a column consists of text data.\n    \"\"\""},{"col":4,"comment":"null","endLoc":101,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3768,"name":"assert_equal","nodeType":"Function","startLoc":95,"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._tree.left.value, b._tree.left.value)\n        assert_tree_match(a._tree.right.value, b._tree.right.value)\n        assert a._tree.value == b._tree.value"},{"className":"NumType","col":0,"comment":"\n    Indicates that a column consists of numerical data.\n    ","endLoc":209,"id":3769,"nodeType":"Class","startLoc":206,"text":"class NumType(NoType):\n    \"\"\"\n    Indicates that a column consists of numerical data.\n    \"\"\""},{"attributeType":"FixedWidthSplitter","col":4,"comment":"null","endLoc":158,"id":3770,"name":"splitter_class","nodeType":"Attribute","startLoc":158,"text":"splitter_class"},{"className":"FloatType","col":0,"comment":"\n    Describes floating-point data.\n    ","endLoc":215,"id":3771,"nodeType":"Class","startLoc":212,"text":"class FloatType(NumType):\n    \"\"\"\n    Describes floating-point data.\n    \"\"\""},{"col":0,"comment":"","endLoc":7,"header":"misc.py#<anonymous>","id":3772,"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\"\"\""},{"className":"IntType","col":0,"comment":"\n    Describes integer data.\n    ","endLoc":227,"id":3773,"nodeType":"Class","startLoc":224,"text":"class IntType(NumType):\n    \"\"\"\n    Describes integer data.\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":3774,"name":"name","nodeType":"Attribute","startLoc":38,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":3775,"name":"types","nodeType":"Attribute","startLoc":39,"text":"types"},{"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":236,"id":3776,"nodeType":"Class","startLoc":230,"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    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":3777,"name":"handle_dynamic_subclasses","nodeType":"Attribute","startLoc":40,"text":"handle_dynamic_subclasses"},{"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    * **data** : list of converted column values\n    ","endLoc":256,"id":3778,"nodeType":"Class","startLoc":239,"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    * **data** : list of converted column values\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 = {}"},{"attributeType":"null","col":8,"comment":"null","endLoc":255,"id":3779,"name":"str_vals","nodeType":"Attribute","startLoc":255,"text":"self.str_vals"},{"attributeType":"null","col":8,"comment":"null","endLoc":252,"id":3780,"name":"name","nodeType":"Attribute","startLoc":252,"text":"self.name"},{"fileName":"fastbasic.py","filePath":"astropy/io/ascii","id":3781,"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 ...table import Table\nfrom . import cparser\nfrom ...utils 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 and\n                user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        kwargs = default_kwargs.copy()\n        kwargs.update(user_kwargs)  # user kwargs take precedence over defaults\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        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        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        return Table(data, names=list(self.engine.get_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) or\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!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        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            meta['comments'] = comments[1:]\n            if not meta['comments']:\n                del meta['comments']\n\n        return Table(data, names=list(self.engine.get_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        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        types = self.engine.get_names()\n        self.engine.setup_tokenizer([line1])\n        self.engine.set_names([])\n        self.engine.read_header()\n\n        if len(self.engine.get_names()) != len(types):\n            raise ValueError('RDB header mismatch between number of '\n                             'column names and column types')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise ValueError('RDB type definitions do not all match '\n                             '[num](N|S): {0}'.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"},{"attributeType":"null","col":8,"comment":"null","endLoc":254,"id":3782,"name":"dtype","nodeType":"Attribute","startLoc":254,"text":"self.dtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":253,"id":3783,"name":"type","nodeType":"Attribute","startLoc":253,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":256,"id":3784,"name":"fill_values","nodeType":"Attribute","startLoc":256,"text":"self.fill_values"},{"className":"RemapAxesType","col":0,"comment":"null","endLoc":143,"id":3785,"nodeType":"Class","startLoc":104,"text":"class RemapAxesType(TransformType):\n    name = 'transform/remap_axes'\n    types = ['astropy.modeling.models.Mapping']\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 & ConstantType.from_tree(\n                    {'value': int(entry.value)}, ctx)\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)"},{"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":1338,"id":3786,"nodeType":"Class","startLoc":1305,"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"},{"className":"Cds","col":0,"comment":"Read a CDS format table.  See http://vizier.u-strasbg.fr/doc/catstd.htx.\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(\"t/cds.dat\")\n      >>> table = ascii.read(\"t/vizier/table1.dat\", readme=\"t/vizier/ReadMe\")\n      >>> table = ascii.read(\"t/cds/multi/lhs2065.dat\", readme=\"t/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"t/cds/glob/lmxbrefs.dat\", readme=\"t/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 = \"t/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"t/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"t/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(\"t/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(\"t/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":319,"id":3787,"nodeType":"Class","startLoc":175,"text":"class Cds(core.BaseReader):\n    \"\"\"Read a CDS format table.  See http://vizier.u-strasbg.fr/doc/catstd.htx.\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(\"t/cds.dat\")\n      >>> table = ascii.read(\"t/vizier/table1.dat\", readme=\"t/vizier/ReadMe\")\n      >>> table = ascii.read(\"t/cds/multi/lhs2065.dat\", readme=\"t/cds/multi/ReadMe\")\n      >>> table = ascii.read(\"t/cds/glob/lmxbrefs.dat\", readme=\"t/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 = \"t/vizier/ReadMe\"\n      >>> r = ascii.get_reader(ascii.Cds, readme=readme)\n      >>> table = r.read(\"t/vizier/table1.dat\")\n      >>> # table5.dat has the same ReadMe file\n      >>> table = r.read(\"t/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(\"t/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(\"t/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)"},{"col":4,"comment":"null","endLoc":1338,"header":"def process_lines(self, lines)","id":3788,"name":"process_lines","nodeType":"Function","startLoc":1323,"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":4,"comment":"null","endLoc":130,"header":"@classmethod\n    def from_tree_transform(cls, node, ctx)","id":3789,"name":"from_tree_transform","nodeType":"Function","startLoc":108,"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 & ConstantType.from_tree(\n                    {'value': int(entry.value)}, ctx)\n                i += 1\n        return transform | Mapping(new_mapping)"},{"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":134,"header":"def _writerow(self, writerow_func, values, has_empty)","id":3790,"name":"_writerow","nodeType":"Function","startLoc":111,"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":109,"header":"def writerows(self, values_list)","id":3791,"name":"writerows","nodeType":"Function","startLoc":93,"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":"null","endLoc":287,"header":"def __init__(self, readme=None)","id":3792,"name":"__init__","nodeType":"Function","startLoc":285,"text":"def __init__(self, readme=None):\n        super().__init__()\n        self.header.readme = readme"},{"attributeType":"null","col":4,"comment":"null","endLoc":63,"id":3793,"name":"replace_sentinel","nodeType":"Attribute","startLoc":63,"text":"replace_sentinel"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":3794,"name":"quotechar2","nodeType":"Attribute","startLoc":73,"text":"self.quotechar2"},{"attributeType":"null","col":8,"comment":"null","endLoc":69,"id":3795,"name":"temp_out","nodeType":"Attribute","startLoc":69,"text":"self.temp_out"},{"attributeType":"null","col":8,"comment":"null","endLoc":74,"id":3796,"name":"quote_empty","nodeType":"Attribute","startLoc":74,"text":"self.quote_empty"},{"attributeType":"null","col":8,"comment":"null","endLoc":66,"id":3797,"name":"csvfile","nodeType":"Attribute","startLoc":66,"text":"self.csvfile"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":3798,"name":"writer","nodeType":"Attribute","startLoc":70,"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    ","endLoc":149,"id":3799,"nodeType":"Class","startLoc":137,"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\n    def __hash__(self):\n        '''All instances of this class shall have the same hash.'''\n        # Any large number will do.\n        return 1234567890"},{"attributeType":"null","col":4,"comment":"null","endLoc":1316,"id":3800,"name":"continuation_char","nodeType":"Attribute","startLoc":1316,"text":"continuation_char"},{"col":4,"comment":"All instances of this class shall have the same hash.","endLoc":149,"header":"def __hash__(self)","id":3801,"name":"__hash__","nodeType":"Function","startLoc":146,"text":"def __hash__(self):\n        '''All instances of this class shall have the same hash.'''\n        # Any large number will do.\n        return 1234567890"},{"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":171,"id":3802,"nodeType":"Class","startLoc":164,"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    \"\"\""},{"className":"FastOptionsError","col":0,"comment":"\n    Indicates that one of the specified options for fast\n    reading is invalid.\n    ","endLoc":188,"id":3803,"nodeType":"Class","startLoc":184,"text":"class FastOptionsError(NotImplementedError):\n    \"\"\"\n    Indicates that one of the specified options for fast\n    reading is invalid.\n    \"\"\""},{"className":"BoolType","col":0,"comment":"\n    Describes boolean data.\n    ","endLoc":221,"id":3804,"nodeType":"Class","startLoc":218,"text":"class BoolType(NoType):\n    \"\"\"\n    Describes boolean data.\n    \"\"\""},{"className":"MetaBaseReader","col":0,"comment":"null","endLoc":1022,"id":3805,"nodeType":"Class","startLoc":996,"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            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                connect.io_registry.register_writer(io_format, Table, func)"},{"col":4,"comment":"null","endLoc":1022,"header":"def __init__(cls, name, bases, dct)","id":3806,"name":"__init__","nodeType":"Function","startLoc":997,"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            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                connect.io_registry.register_writer(io_format, Table, func)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1317,"id":3807,"name":"replace_char","nodeType":"Attribute","startLoc":1317,"text":"replace_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":1321,"id":3808,"name":"no_continue","nodeType":"Attribute","startLoc":1321,"text":"no_continue"},{"className":"WhitespaceSplitter","col":0,"comment":"null","endLoc":1356,"id":3809,"nodeType":"Class","startLoc":1341,"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 or\n                                           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":1356,"header":"def process_line(self, line)","id":3810,"name":"process_line","nodeType":"Function","startLoc":1342,"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 or\n                                           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":"Not available for the Cds class (raises NotImplementedError)","endLoc":291,"header":"def write(self, table=None)","id":3811,"name":"write","nodeType":"Function","startLoc":289,"text":"def write(self, table=None):\n        \"\"\"Not available for the Cds class (raises NotImplementedError)\"\"\"\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":319,"header":"def read(self, table)","id":3812,"name":"read","nodeType":"Function","startLoc":293,"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":152,"id":3813,"name":"masked","nodeType":"Attribute","startLoc":152,"text":"masked"},{"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":860,"header":"@contextmanager\ndef set_locale(name)","id":3814,"name":"set_locale","nodeType":"Function","startLoc":829,"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)"},{"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":171,"id":3815,"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 and\n                user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        kwargs = default_kwargs.copy()\n        kwargs.update(user_kwargs)  # user kwargs take precedence over defaults\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        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        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        return Table(data, names=list(self.engine.get_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) or\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!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        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":4,"comment":"null","endLoc":53,"header":"def __init__(self, default_kwargs={}, **user_kwargs)","id":3816,"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 and\n                user_kwargs.get('header_start', 0) is None):\n            raise ValueError('header_start cannot be set to None for this Reader')\n\n        kwargs = default_kwargs.copy()\n        kwargs.update(user_kwargs)  # user kwargs take precedence over defaults\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"},{"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":194,"id":3817,"nodeType":"Class","startLoc":174,"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":187,"header":"def __init__(self, **kwargs)","id":3818,"name":"__init__","nodeType":"Function","startLoc":186,"text":"def __init__(self, **kwargs):\n        super().__init__({'delimiter': ',', 'comment': None}, **kwargs)"},{"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":1450,"header":"def _get_reader(Reader, Inputter=None, Outputter=None, **kwargs)","id":3819,"name":"_get_reader","nodeType":"Function","startLoc":1367,"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 'fast_reader' in kwargs:\n        del kwargs['fast_reader']  # ignore fast_reader parameter for slow readers\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    if 'delimiter' in kwargs:\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 '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"},{"attributeType":"null","col":4,"comment":"null","endLoc":277,"id":3820,"name":"_format_name","nodeType":"Attribute","startLoc":277,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":278,"id":3821,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":278,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":279,"id":3822,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":279,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":280,"id":3823,"name":"_description","nodeType":"Attribute","startLoc":280,"text":"_description"},{"attributeType":"CdsData","col":4,"comment":"null","endLoc":282,"id":3824,"name":"data_class","nodeType":"Attribute","startLoc":282,"text":"data_class"},{"col":4,"comment":"\n        Override the default write method of `FastBasic` to\n        output masked values as empty fields.\n        ","endLoc":194,"header":"def write(self, table, output)","id":3825,"name":"write","nodeType":"Function","startLoc":189,"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, '')]})"},{"attributeType":"CdsHeader","col":4,"comment":"null","endLoc":283,"id":3826,"name":"header_class","nodeType":"Attribute","startLoc":283,"text":"header_class"},{"col":4,"comment":"null","endLoc":137,"header":"@classmethod\n    def to_tree_transform(cls, model, ctx)","id":3827,"name":"to_tree_transform","nodeType":"Function","startLoc":132,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":3828,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":22,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":9,"header":"cds.py#<anonymous>","id":3829,"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__ = ['*']"},{"col":4,"comment":"null","endLoc":143,"header":"@classmethod\n    def assert_equal(cls, a, b)","id":3830,"name":"assert_equal","nodeType":"Function","startLoc":139,"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)"},{"fileName":"ipac.py","filePath":"astropy/io/ascii","id":3831,"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 ...utils.exceptions import AstropyUserWarning\nfrom ...table.pprint import get_auto_format_func\n\n\nclass IpacFormatErrorDBMS(Exception):\n    def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')\n\n\nclass IpacFormatError(Exception):\n    def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://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        http://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: {0}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{0} - 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('Column name cannot start with numbers: {}'.format(name))\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{0} - 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                        '{0} - Maximum length for column name is 16 characters'.format(name))\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        '{0} - Maximum length for column name is 40 characters.'.format(name))\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                dtypelist.append('long')\n            elif col_dtype.kind == 'f':\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\"\"\"Read or write an IPAC format table.  See\n    http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html::\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/t/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 occuring 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:`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\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 <http://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 <http://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        # 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('\\\\{0}={1!r}'.format(keyword.strip(), val))\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":"null","endLoc":171,"header":"def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False)","id":3832,"name":"_write","nodeType":"Function","startLoc":159,"text":"def _write(self, table, output, default_kwargs,\n               header_output=True, output_types=False):\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":181,"id":3833,"name":"_format_name","nodeType":"Attribute","startLoc":181,"text":"_format_name"},{"col":4,"comment":"null","endLoc":58,"header":"def _read_header(self)","id":3834,"name":"_read_header","nodeType":"Function","startLoc":55,"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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":105,"id":3835,"name":"name","nodeType":"Attribute","startLoc":105,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":3836,"name":"types","nodeType":"Attribute","startLoc":106,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":182,"id":3837,"name":"_description","nodeType":"Attribute","startLoc":182,"text":"_description"},{"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":126,"header":"def read(self, table)","id":3838,"name":"read","nodeType":"Function","startLoc":60,"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        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        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"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":3839,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":3840,"name":"_operator_to_tag_mapping","nodeType":"Attribute","startLoc":15,"text":"_operator_to_tag_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":3841,"name":"_tag_to_method_mapping","nodeType":"Attribute","startLoc":26,"text":"_tag_to_method_mapping"},{"col":0,"comment":"","endLoc":4,"header":"compound.py#<anonymous>","id":3842,"name":"<anonymous>","nodeType":"Function","startLoc":4,"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}\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}"},{"attributeType":"null","col":4,"comment":"null","endLoc":183,"id":3843,"name":"_fast","nodeType":"Attribute","startLoc":183,"text":"_fast"},{"attributeType":"null","col":4,"comment":"null","endLoc":184,"id":3844,"name":"fill_extra_cols","nodeType":"Attribute","startLoc":184,"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":209,"id":3845,"nodeType":"Class","startLoc":197,"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":209,"header":"def __init__(self, **kwargs)","id":3846,"name":"__init__","nodeType":"Function","startLoc":206,"text":"def __init__(self, **kwargs):\n        super().__init__({'delimiter': '\\t'}, **kwargs)\n        self.strip_whitespace_lines = False\n        self.strip_whitespace_fields = False"},{"fileName":"fixedwidth.py","filePath":"astropy/io/ascii","id":3847,"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\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            data_lines = self.data.process_lines(lines)\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('Position line should only contain delimiters and 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(set([self.splitter.delimiter, ' ']))\n                if not set(line).issubset(charset):\n                    raise InconsistentTableError('Characters in position line must be part of {0}'.format(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            ends = [x + 1 if x is not None else None for x in self.col_ends]  # user supplies inclusive endpoint\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('Position_char=\"{}\" must be a single '\n                                 'character'.format(char))\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    \"\"\"\n    Read or write a fixed width table with a single header line that defines column\n    names and positions.  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:`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    \"\"\"\n    Read or write a fixed width table which has no header line.  Column\n    names are either input (``names`` keyword) or auto-generated.  Column\n    positions are determined either by input (``col_starts`` and ``col_stops``\n    keywords) or by splitting the first data line.  In the latter case a\n    ``delimiter`` is required to split the data 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_line = None`` and ``data.start_line = 0``.\n\n    See the :ref:`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    \"\"\"\n    Read or write a fixed width table which has two header lines.  The first\n    header line defines the column names and the second implicitly defines the\n    column positions.  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:`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"},{"className":"FixedWidthHeaderSplitter","col":0,"comment":"Splitter class that splits on ``|``.","endLoc":62,"id":3848,"nodeType":"Class","startLoc":60,"text":"class FixedWidthHeaderSplitter(DefaultSplitter):\n    '''Splitter class that splits on ``|``.'''\n    delimiter = '|'"},{"attributeType":"null","col":4,"comment":"null","endLoc":62,"id":3849,"name":"delimiter","nodeType":"Attribute","startLoc":62,"text":"delimiter"},{"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":3850,"name":"get_auto_format_func","nodeType":"Function","startLoc":46,"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)\n            try:\n                out = format_func(format_, val)\n                if not isinstance(out, str):\n                    raise ValueError('Format function for value {0} returned {1} '\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('Format function for value {0} failed: {1}'\n                                 .format(val, 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 {0} 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"},{"className":"FixedWidthNoHeaderHeader","col":0,"comment":"Header reader for fixed with tables with no header line","endLoc":306,"id":3851,"nodeType":"Class","startLoc":304,"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":306,"id":3852,"name":"start_line","nodeType":"Attribute","startLoc":306,"text":"start_line"},{"className":"FixedWidthNoHeaderData","col":0,"comment":"Data reader for fixed width tables with no header line","endLoc":311,"id":3853,"nodeType":"Class","startLoc":309,"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":311,"id":3854,"name":"start_line","nodeType":"Attribute","startLoc":311,"text":"start_line"},{"className":"FixedWidthNoHeader","col":0,"comment":"\n    Read or write a fixed width table which has no header line.  Column\n    names are either input (``names`` keyword) or auto-generated.  Column\n    positions are determined either by input (``col_starts`` and ``col_stops``\n    keywords) or by splitting the first data line.  In the latter case a\n    ``delimiter`` is required to split the data 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_line = None`` and ``data.start_line = 0``.\n\n    See the :ref:`fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":347,"id":3855,"nodeType":"Class","startLoc":314,"text":"class FixedWidthNoHeader(FixedWidth):\n    \"\"\"\n    Read or write a fixed width table which has no header line.  Column\n    names are either input (``names`` keyword) or auto-generated.  Column\n    positions are determined either by input (``col_starts`` and ``col_stops``\n    keywords) or by splitting the first data line.  In the latter case a\n    ``delimiter`` is required to split the data 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_line = None`` and ``data.start_line = 0``.\n\n    See the :ref:`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":4,"comment":"null","endLoc":347,"header":"def __init__(self, col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True)","id":3856,"name":"__init__","nodeType":"Function","startLoc":345,"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":202,"id":3857,"name":"_format_name","nodeType":"Attribute","startLoc":202,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":203,"id":3858,"name":"_description","nodeType":"Attribute","startLoc":203,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":204,"id":3859,"name":"_fast","nodeType":"Attribute","startLoc":204,"text":"_fast"},{"attributeType":"null","col":8,"comment":"null","endLoc":208,"id":3860,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":208,"text":"self.strip_whitespace_lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":340,"id":3861,"name":"_format_name","nodeType":"Attribute","startLoc":340,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":341,"id":3862,"name":"_description","nodeType":"Attribute","startLoc":341,"text":"_description"},{"attributeType":"FixedWidthNoHeaderHeader","col":4,"comment":"null","endLoc":342,"id":3863,"name":"header_class","nodeType":"Attribute","startLoc":342,"text":"header_class"},{"attributeType":"FixedWidthNoHeaderData","col":4,"comment":"null","endLoc":343,"id":3864,"name":"data_class","nodeType":"Attribute","startLoc":343,"text":"data_class"},{"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":357,"id":3865,"nodeType":"Class","startLoc":350,"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":357,"id":3866,"name":"splitter_class","nodeType":"Attribute","startLoc":357,"text":"splitter_class"},{"className":"FixedWidthTwoLineData","col":0,"comment":"Data reader for fixed with tables with two header lines.","endLoc":367,"id":3867,"nodeType":"Class","startLoc":365,"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":367,"id":3868,"name":"splitter_class","nodeType":"Attribute","startLoc":367,"text":"splitter_class"},{"className":"FixedWidthTwoLine","col":0,"comment":"\n    Read or write a fixed width table which has two header lines.  The first\n    header line defines the column names and the second implicitly defines the\n    column positions.  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:`fixed_width_gallery` for specific usage examples.\n\n    ","endLoc":404,"id":3869,"nodeType":"Class","startLoc":370,"text":"class FixedWidthTwoLine(FixedWidth):\n    \"\"\"\n    Read or write a fixed width table which has two header lines.  The first\n    header line defines the column names and the second implicitly defines the\n    column positions.  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:`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"},{"col":4,"comment":"null","endLoc":404,"header":"def __init__(self, position_line=1, position_char='-', delimiter_pad=None, bookend=False)","id":3870,"name":"__init__","nodeType":"Function","startLoc":400,"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":395,"id":3871,"name":"_format_name","nodeType":"Attribute","startLoc":395,"text":"_format_name"},{"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":1521,"header":"def _get_writer(Writer, fast_writer, **kwargs)","id":3872,"name":"_get_writer","nodeType":"Function","startLoc":1460,"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 'fast_{0}'.format(Writer._format_name) in FAST_CLASSES:\n        # Switch to fast writer\n        kwargs['fast_writer'] = fast_writer\n        return FAST_CLASSES['fast_{0}'.format(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')\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":396,"id":3873,"name":"_description","nodeType":"Attribute","startLoc":396,"text":"_description"},{"attributeType":"FixedWidthTwoLineData","col":4,"comment":"null","endLoc":397,"id":3874,"name":"data_class","nodeType":"Attribute","startLoc":397,"text":"data_class"},{"attributeType":"FixedWidthTwoLineHeader","col":4,"comment":"null","endLoc":398,"id":3875,"name":"header_class","nodeType":"Attribute","startLoc":398,"text":"header_class"},{"col":0,"comment":"","endLoc":9,"header":"fixedwidth.py#<anonymous>","id":3876,"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":8,"comment":"null","endLoc":209,"id":3877,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":209,"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":230,"id":3878,"nodeType":"Class","startLoc":212,"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":223,"header":"def __init__(self, **kwargs)","id":3879,"name":"__init__","nodeType":"Function","startLoc":222,"text":"def __init__(self, **kwargs):\n        super().__init__({'header_start': None, 'data_start': 0}, **kwargs)"},{"col":0,"comment":"null","endLoc":20,"header":"def default_format_func(format_, val)","id":3880,"name":"default_format_func","nodeType":"Function","startLoc":16,"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":26,"endLoc":84,"id":3881,"nodeType":"Lambda","startLoc":84,"text":"lambda format_, val: format_(val)"},{"col":4,"comment":"\n        Override the default writing behavior in `FastBasic` so\n        that columns names are not included in output.\n        ","endLoc":230,"header":"def write(self, table, output)","id":3882,"name":"write","nodeType":"Function","startLoc":225,"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":218,"id":3883,"name":"_format_name","nodeType":"Attribute","startLoc":218,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":219,"id":3884,"name":"_description","nodeType":"Attribute","startLoc":219,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":220,"id":3885,"name":"_fast","nodeType":"Attribute","startLoc":220,"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":288,"id":3886,"nodeType":"Class","startLoc":233,"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            meta['comments'] = comments[1:]\n            if not meta['comments']:\n                del meta['comments']\n\n        return Table(data, names=list(self.engine.get_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":248,"header":"def __init__(self, **kwargs)","id":3887,"name":"__init__","nodeType":"Function","startLoc":243,"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":262,"header":"def make_table(self, data, comments)","id":3888,"name":"make_table","nodeType":"Function","startLoc":250,"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            meta['comments'] = comments[1:]\n            if not meta['comments']:\n                del meta['comments']\n\n        return Table(data, names=list(self.engine.get_names()), meta=meta)"},{"fileName":"daophot.py","filePath":"astropy/io/ascii","id":3889,"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\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(l).groups()\n                                       for l 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 ValueError('multiline re could not match line '\n                                 '{}: {}'.format(i, line))\n\n        return outlines\n\n\nclass Daophot(core.BaseReader):\n    \"\"\"\n    Read a DAOphot file.\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/t/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"},{"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":32,"header":"def _use_str_for_masked_values(format_func)","id":3890,"name":"_use_str_for_masked_values","nodeType":"Function","startLoc":25,"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":32,"id":3891,"nodeType":"Lambda","startLoc":31,"text":"lambda format_, val: (str(val) if val is np.ma.masked\n                                 else format_func(format_, val))"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":3892,"name":"FORMAT_CLASSES","nodeType":"Attribute","startLoc":34,"text":"FORMAT_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":3893,"name":"FAST_CLASSES","nodeType":"Attribute","startLoc":37,"text":"FAST_CLASSES"},{"attributeType":"null","col":0,"comment":"null","endLoc":1359,"id":3894,"name":"extra_reader_pars","nodeType":"Attribute","startLoc":1359,"text":"extra_reader_pars"},{"attributeType":"null","col":0,"comment":"null","endLoc":1453,"id":3895,"name":"extra_writer_pars","nodeType":"Attribute","startLoc":1453,"text":"extra_writer_pars"},{"col":0,"comment":"","endLoc":9,"header":"core.py#<anonymous>","id":3896,"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')"},{"className":"IpacFormatErrorDBMS","col":0,"comment":"null","endLoc":29,"id":3897,"nodeType":"Class","startLoc":25,"text":"class IpacFormatErrorDBMS(Exception):\n    def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')"},{"fileName":"connect.py","filePath":"astropy/io/ascii","id":3898,"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\nimport functools\n\nfrom .. import registry as io_registry\nfrom ...table import Table\n\n__all__ = []\n\n\n# Generic\n# =======\n\n\ndef read_asciitable(filename, **kwargs):\n    from .ui import read\n    return read(filename, **kwargs)\n\n\nio_registry.register_reader('ascii', Table, read_asciitable)\n\n\ndef write_asciitable(table, filename, **kwargs):\n    from .ui import write\n    return write(table, filename, **kwargs)\n\n\nio_registry.register_writer('ascii', Table, write_asciitable)\n\n\ndef io_read(format, filename, **kwargs):\n    from .ui import read\n    format = re.sub(r'^ascii\\.', '', format)\n    return read(filename, format=format, **kwargs)\n\n\ndef io_write(format, table, filename, **kwargs):\n    from .ui import write\n    format = re.sub(r'^ascii\\.', '', format)\n    return write(table, filename, format=format, **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 = ':class:`~{0}.{1}`'.format(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                     '{0}: {1}'.format(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 = '%-{0}s'.format(width)\n\n    return out\n\n\n# Specific\n# ========\n\ndef read_csv(filename, **kwargs):\n    from .ui import read\n    kwargs['format'] = 'csv'\n    return read(filename, **kwargs)\n\n\ndef write_csv(table, filename, **kwargs):\n    from .ui import write\n    kwargs['format'] = 'csv'\n    return write(table, filename, **kwargs)\n\n\ncsv_identify = functools.partial(io_identify, '.csv')\n\nio_registry.register_reader('csv', Table, read_csv)\nio_registry.register_writer('csv', Table, write_csv)\nio_registry.register_identifier('csv', Table, csv_identify)\n"},{"className":"DaophotHeader","col":0,"comment":"\n    Read the header from a file produced by the IRAF DAOphot routine.\n    ","endLoc":195,"id":3899,"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\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'))"},{"col":4,"comment":"null","endLoc":150,"header":"def check_header(self)","id":3900,"name":"check_header","nodeType":"Function","startLoc":135,"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) or\n                    len(name) == 0 or\n                    name[0] in bads or\n                    name[-1] in bads):\n                    raise ValueError('Column name {0!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))"},{"col":4,"comment":"null","endLoc":29,"header":"def __str__(self)","id":3901,"name":"__str__","nodeType":"Function","startLoc":26,"text":"def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html')"},{"className":"IpacFormatError","col":0,"comment":"null","endLoc":36,"id":3902,"nodeType":"Class","startLoc":32,"text":"class IpacFormatError(Exception):\n    def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html')"},{"col":4,"comment":"null","endLoc":36,"header":"def __str__(self)","id":3903,"name":"__str__","nodeType":"Function","startLoc":33,"text":"def __str__(self):\n        return '{0}\\nSee {1}'.format(\n            super(Exception, self).__str__(),\n            'http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html')"},{"col":0,"comment":"null","endLoc":20,"header":"def read_asciitable(filename, **kwargs)","id":3904,"name":"read_asciitable","nodeType":"Function","startLoc":18,"text":"def read_asciitable(filename, **kwargs):\n    from .ui import read\n    return read(filename, **kwargs)"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self)","id":3905,"name":"__init__","nodeType":"Function","startLoc":37,"text":"def __init__(self):\n        core.BaseHeader.__init__(self)"},{"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":3906,"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"},{"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":3907,"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"},{"col":19,"endLoc":53,"id":3908,"nodeType":"Lambda","startLoc":53,"text":"lambda s: s[2:].strip(' \\\\')"},{"col":4,"comment":"null","endLoc":63,"header":"def join(self, vals, widths)","id":3909,"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"},{"col":4,"comment":"Actually make the output table give the data and comments.","endLoc":133,"header":"def make_table(self, data, comments)","id":3910,"name":"make_table","nodeType":"Function","startLoc":128,"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        return Table(data, names=list(self.engine.get_names()), meta=meta)"},{"col":0,"comment":"\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    Parameters\n    ----------\n    table : str, file-like, list, pathlib.Path object\n        Input table as a file name, file-like object, list of strings,\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\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 : dict\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 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    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED)\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    ","endLoc":391,"header":"def read(table, guess=None, **kwargs)","id":3911,"name":"read","nodeType":"Function","startLoc":185,"text":"def read(table, guess=None, **kwargs):\n    \"\"\"\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    Parameters\n    ----------\n    table : str, file-like, list, pathlib.Path object\n        Input table as a file name, file-like object, list of strings,\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\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 : dict\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 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    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED)\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    del _read_trace[:]\n\n    # Downstream readers might munge kwargs\n    kwargs = copy.deepcopy(kwargs)\n\n    # Convert fast_reader into a dict if not already and make sure 'enable'\n    # key is available.\n    fast_reader = 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    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    new_kwargs = {}\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    new_kwargs.update(kwargs)\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        reader = get_reader(**new_kwargs)\n        if format is None:\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 'fast_{0}'.format(format) in core.FAST_CLASSES:\n            fast_kwargs = copy.deepcopy(new_kwargs)\n            fast_kwargs['Reader'] = core.FAST_CLASSES['fast_{0}'.format(format)]\n            fast_reader_rdr = get_reader(**fast_kwargs)\n            try:\n                dat = fast_reader_rdr.read(table)\n                _read_trace.append({'kwargs': fast_kwargs,\n                                    'Reader': fast_reader_rdr.__class__,\n                                    'status': 'Success with fast reader (no guessing)'})\n            except (core.ParameterError, cparser.CParserError) 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                        'fast reader {} exception: {}'\n                        .format(fast_reader_rdr.__class__, err))\n                # If the fast reader doesn't work, try the slow version\n                dat = reader.read(table)\n                _read_trace.append({'kwargs': new_kwargs,\n                                    'Reader': reader.__class__,\n                                    'status': 'Success with slow reader after failing'\n                                             ' with fast (no guessing)'})\n        else:\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': new_kwargs,\n                                'Reader': reader.__class__,\n                                'status': 'Success with specified Reader class '\n                                          '(no guessing)'})\n\n    return dat"},{"attributeType":"None","col":4,"comment":"null","endLoc":45,"id":3912,"name":"process_line","nodeType":"Attribute","startLoc":45,"text":"process_line"},{"attributeType":"None","col":4,"comment":"null","endLoc":46,"id":3913,"name":"process_val","nodeType":"Attribute","startLoc":46,"text":"process_val"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":3914,"name":"delimiter","nodeType":"Attribute","startLoc":47,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":3915,"name":"delimiter_pad","nodeType":"Attribute","startLoc":48,"text":"delimiter_pad"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":3916,"name":"skipinitialspace","nodeType":"Attribute","startLoc":49,"text":"skipinitialspace"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":3917,"name":"comment","nodeType":"Attribute","startLoc":50,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":3918,"name":"write_comment","nodeType":"Attribute","startLoc":51,"text":"write_comment"},{"attributeType":"None","col":4,"comment":"null","endLoc":52,"id":3919,"name":"col_starts","nodeType":"Attribute","startLoc":52,"text":"col_starts"},{"attributeType":"None","col":4,"comment":"null","endLoc":53,"id":3920,"name":"col_ends","nodeType":"Attribute","startLoc":53,"text":"col_ends"},{"className":"IpacHeader","col":0,"comment":"IPAC table header","endLoc":297,"id":3921,"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        http://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: {0}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{0} - 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('Column name cannot start with numbers: {}'.format(name))\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{0} - 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                        '{0} - Maximum length for column name is 16 characters'.format(name))\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        '{0} - Maximum length for column name is 40 characters.'.format(name))\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                dtypelist.append('long')\n            elif col_dtype.kind == 'f':\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":"\n        Return an iterator of the values with replacements based on fill_values\n        ","endLoc":466,"header":"def fill_values(self, col, col_str_iters)","id":3922,"name":"fill_values","nodeType":"Function","startLoc":447,"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"},{"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":3923,"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)"},{"col":4,"comment":"null","endLoc":281,"header":"def _read_header(self)","id":3924,"name":"_read_header","nodeType":"Function","startLoc":264,"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        Use a fast Cython method to write table data to output,\n        where output is a filename or file-like object.\n        ","endLoc":157,"header":"def write(self, table, output)","id":3925,"name":"write","nodeType":"Function","startLoc":152,"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":3926,"name":"_format_name","nodeType":"Attribute","startLoc":21,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":22,"id":3927,"name":"_description","nodeType":"Attribute","startLoc":22,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":3928,"name":"_fast","nodeType":"Attribute","startLoc":23,"text":"_fast"},{"attributeType":"null","col":4,"comment":"null","endLoc":24,"id":3929,"name":"fill_extra_cols","nodeType":"Attribute","startLoc":24,"text":"fill_extra_cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":3930,"name":"guessing","nodeType":"Attribute","startLoc":25,"text":"guessing"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":3931,"name":"strict_names","nodeType":"Attribute","startLoc":26,"text":"strict_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":3932,"name":"quotechar","nodeType":"Attribute","startLoc":44,"text":"self.quotechar"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":3933,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":52,"text":"self.strip_whitespace_lines"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":3934,"name":"strict_names","nodeType":"Attribute","startLoc":91,"text":"self.strict_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":40,"id":3935,"name":"write_comment","nodeType":"Attribute","startLoc":40,"text":"self.write_comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":3936,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":53,"text":"self.strip_whitespace_fields"},{"attributeType":"null","col":8,"comment":"null","endLoc":101,"id":3937,"name":"engine","nodeType":"Attribute","startLoc":101,"text":"self.engine"},{"attributeType":"null","col":8,"comment":"null","endLoc":39,"id":3938,"name":"delimiter","nodeType":"Attribute","startLoc":39,"text":"self.delimiter"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":3939,"name":"data_start","nodeType":"Attribute","startLoc":50,"text":"self.data_start"},{"attributeType":"null","col":8,"comment":"null","endLoc":51,"id":3940,"name":"kwargs","nodeType":"Attribute","startLoc":51,"text":"self.kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":3941,"name":"header_start","nodeType":"Attribute","startLoc":45,"text":"self.header_start"},{"attributeType":"null","col":12,"comment":"null","endLoc":43,"id":3942,"name":"comment","nodeType":"Attribute","startLoc":43,"text":"self.comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":98,"id":3943,"name":"return_header_chars","nodeType":"Attribute","startLoc":98,"text":"self.return_header_chars"},{"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":359,"id":3944,"nodeType":"Class","startLoc":291,"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        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        types = self.engine.get_names()\n        self.engine.setup_tokenizer([line1])\n        self.engine.set_names([])\n        self.engine.read_header()\n\n        if len(self.engine.get_names()) != len(types):\n            raise ValueError('RDB header mismatch between number of '\n                             'column names and column types')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise ValueError('RDB type definitions do not all match '\n                             '[num](N|S): {0}'.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":304,"header":"def __init__(self, **kwargs)","id":3945,"name":"__init__","nodeType":"Function","startLoc":301,"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":352,"header":"def _read_header(self)","id":3946,"name":"_read_header","nodeType":"Function","startLoc":306,"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        self.engine.setup_tokenizer([line2])\n        self.engine.header_start = 0\n        self.engine.read_header()\n        types = self.engine.get_names()\n        self.engine.setup_tokenizer([line1])\n        self.engine.set_names([])\n        self.engine.read_header()\n\n        if len(self.engine.get_names()) != len(types):\n            raise ValueError('RDB header mismatch between number of '\n                             'column names and column types')\n\n        if any(not re.match(r'\\d*(N|S)$', x, re.IGNORECASE) for x in types):\n            raise ValueError('RDB type definitions do not all match '\n                             '[num](N|S): {0}'.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":"\n        Override the default writing behavior in `FastBasic` so\n        that column names are commented.\n        ","endLoc":288,"header":"def write(self, table, output)","id":3947,"name":"write","nodeType":"Function","startLoc":283,"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":239,"id":3948,"name":"_format_name","nodeType":"Attribute","startLoc":239,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":240,"id":3949,"name":"_description","nodeType":"Attribute","startLoc":240,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":241,"id":3950,"name":"_fast","nodeType":"Attribute","startLoc":241,"text":"_fast"},{"attributeType":"null","col":12,"comment":"null","endLoc":248,"id":3951,"name":"data_start","nodeType":"Attribute","startLoc":248,"text":"self.data_start"},{"fileName":"ui.py","filePath":"astropy/io/ascii","id":3952,"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\nfrom io import StringIO\n\nimport numpy as np\n\nfrom . import core\nfrom . import basic\nfrom . import cds\nfrom . import daophot\nfrom . import ecsv\nfrom . import sextractor\nfrom . import ipac\nfrom . import latex\nfrom . import html\nfrom . import fastbasic\nfrom . import cparser\nfrom . import fixedwidth\n\nfrom ...table import Table, vstack\nfrom ...utils.data import get_readable_fileobj\nfrom ...utils.exceptions import AstropyWarning, AstropyDeprecationWarning\n\n_read_trace = []\n\ntry:\n    import yaml  # pylint: disable=W0611\n    HAS_YAML = True\nexcept ImportError:\n    HAS_YAML = False\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                    break\n            table = os.linesep.join(table[:i+1])\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(r'< \\s* {0} [^>]* >'.format(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        Dictionary 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 : dict\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 public interface\n    # with a default Reader.\n    if Reader is None:\n        Reader = basic.Basic\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('Cannot supply both format and {0} keywords'.format(label))\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 {0!r} not in allowed list {1}'\n                             .format(format, sorted(core.FORMAT_CLASSES)))\n    return ReaderWriter\n\n\ndef read(table, guess=None, **kwargs):\n    \"\"\"\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    Parameters\n    ----------\n    table : str, file-like, list, pathlib.Path object\n        Input table as a file name, file-like object, list of strings,\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\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 : dict\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 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    Reader : `~astropy.io.ascii.BaseReader`\n        Reader class (DEPRECATED)\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    del _read_trace[:]\n\n    # Downstream readers might munge kwargs\n    kwargs = copy.deepcopy(kwargs)\n\n    # Convert fast_reader into a dict if not already and make sure 'enable'\n    # key is available.\n    fast_reader = 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    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    new_kwargs = {}\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    new_kwargs.update(kwargs)\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        reader = get_reader(**new_kwargs)\n        if format is None:\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 'fast_{0}'.format(format) in core.FAST_CLASSES:\n            fast_kwargs = copy.deepcopy(new_kwargs)\n            fast_kwargs['Reader'] = core.FAST_CLASSES['fast_{0}'.format(format)]\n            fast_reader_rdr = get_reader(**fast_kwargs)\n            try:\n                dat = fast_reader_rdr.read(table)\n                _read_trace.append({'kwargs': fast_kwargs,\n                                    'Reader': fast_reader_rdr.__class__,\n                                    'status': 'Success with fast reader (no guessing)'})\n            except (core.ParameterError, cparser.CParserError) 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                        'fast reader {} exception: {}'\n                        .format(fast_reader_rdr.__class__, err))\n                # If the fast reader doesn't work, try the slow version\n                dat = reader.read(table)\n                _read_trace.append({'kwargs': new_kwargs,\n                                    'Reader': reader.__class__,\n                                    'status': 'Success with slow reader after failing'\n                                             ' with fast (no guessing)'})\n        else:\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': new_kwargs,\n                                'Reader': reader.__class__,\n                                'status': 'Success with specified Reader class '\n                                          '(no guessing)'})\n\n    return dat\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 'fast_{0}'.format(format) in \\\n                                                         core.FAST_CLASSES:\n        fast_kwargs = read_kwargs.copy()\n        fast_kwargs['Reader'] = core.FAST_CLASSES['fast_{0}'.format(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 and\n                guess_kwargs['Reader'] in core.FAST_CLASSES.values()):\n            continue\n\n        # If user required a fast reader then skip all non-fast readers\n        if (fast_reader['enable'] == 'force' and\n                guess_kwargs['Reader'] not in core.FAST_CLASSES.values()):\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] = 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            reader.guessing = True\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': guess_kwargs,\n                                'Reader': reader.__class__,\n                                'status': 'Success (guessing)',\n                                'dt': '{0:.3f} ms'.format((time.time() - t0) * 1000)})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': guess_kwargs,\n                                'status': '{0}: {1}'.format(err.__class__.__name__,\n                                                            str(err)),\n                                'dt': '{0:.3f} ms'.format((time.time() - t0) * 1000)})\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': 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': guess_kwargs,\n                                'status': '{0}: {1}'.format(err.__class__.__name__,\n                                                            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(['{}: {!r}'.format(key, val) 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                   '** appropriate arguments to read().  In particular specify the format **',\n                   '** and any known attributes like the 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    if HAS_YAML:\n        guess_kwargs_list.append(dict(Reader=ecsv.Ecsv))\n\n    # Now try readers that accept the common arguments with the input arguments\n    # (Unless there are not arguments - we try that in the next step anyway.)\n    # FixedWidthTwoLine would also be read by Basic, so it needs to come first.\n    if len(read_kwargs) > 0:\n        for reader in [fixedwidth.FixedWidthTwoLine,\n                       fastbasic.FastBasic,\n                       basic.Basic]:\n            first_kwargs = read_kwargs.copy()\n            first_kwargs.update(dict(Reader=reader))\n            guess_kwargs_list.append(first_kwargs)\n\n    # Then try a list of readers with default arguments\n    guess_kwargs_list.extend([dict(Reader=fixedwidth.FixedWidthTwoLine),\n                              dict(Reader=fastbasic.FastBasic),\n                              dict(Reader=basic.Basic),\n                              dict(Reader=basic.Rdb),\n                              dict(Reader=fastbasic.FastTab),\n                              dict(Reader=basic.Tab),\n                              dict(Reader=cds.Cds),\n                              dict(Reader=daophot.Daophot),\n                              dict(Reader=sextractor.SExtractor),\n                              dict(Reader=ipac.Ipac),\n                              dict(Reader=latex.Latex),\n                              dict(Reader=latex.AASTex)\n                              ])\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=None, **kwargs):\n    \"\"\"Write the input ``table`` to ``filename``.  Most of the default behavior\n    for various parameters is determined by the Writer class.\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\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    overwrite : bool\n        If ``overwrite=None`` (default) and the file exists, then a\n        warning will be issued. In a future release this will instead\n        generate an exception. If ``overwrite=False`` and the file\n        exists, then an exception is raised.\n        This parameter is ignored when the ``output`` arg is not a string\n        (e.g., a file object).\n    Writer : ``Writer``\n        Writer class (DEPRECATED).\n\n    \"\"\"\n    if isinstance(output, str):\n        if os.path.lexists(output):\n            if overwrite is None:\n                warnings.warn(\n                    \"{} already exists. \"\n                    \"Automatically overwriting ASCII files is deprecated. \"\n                    \"Use the argument 'overwrite=True' in the future.\".format(\n                        output), AstropyDeprecationWarning)\n            elif not overwrite:\n                raise OSError(\"{} already exists\".format(output))\n\n    if output is None:\n        output = sys.stdout\n\n    table_cls = table.__class__ if isinstance(table, Table) else Table\n    table = table_cls(table, names=kwargs.get('names'))\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 keys {} specified in the formats argument does 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        output = open(output, 'w')\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\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 dicts\n       Ordered list of format guesses and status\n    \"\"\"\n\n    return copy.deepcopy(_read_trace)\n"},{"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":359,"header":"def write(self, table, output)","id":3953,"name":"write","nodeType":"Function","startLoc":354,"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":4,"comment":"null","endLoc":297,"id":3954,"name":"_format_name","nodeType":"Attribute","startLoc":297,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":298,"id":3955,"name":"_description","nodeType":"Attribute","startLoc":298,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":299,"id":3956,"name":"_fast","nodeType":"Attribute","startLoc":299,"text":"_fast"},{"attributeType":"null","col":8,"comment":"null","endLoc":303,"id":3957,"name":"strip_whitespace_lines","nodeType":"Attribute","startLoc":303,"text":"self.strip_whitespace_lines"},{"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":3958,"name":"_probably_html","nodeType":"Function","startLoc":52,"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                    break\n            table = os.linesep.join(table[:i+1])\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(r'< \\s* {0} [^>]* >'.format(element), table, re.IGNORECASE | re.VERBOSE)\n               for element in ('table', 'tr', 'td')):\n            return True\n\n    return False"},{"col":4,"comment":"\n        Extract table-level comments and keywords for IPAC table.  See:\n        http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html#kw\n        ","endLoc":151,"header":"def update_meta(self, lines, meta)","id":3959,"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        http://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":8,"comment":"null","endLoc":304,"id":3960,"name":"strip_whitespace_fields","nodeType":"Attribute","startLoc":304,"text":"self.strip_whitespace_fields"},{"className":"Ipac","col":0,"comment":"Read or write an IPAC format table.  See\n    http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html::\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/t/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 occuring 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:`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\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 <http://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 <http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html>`_\n        definition.\n    ","endLoc":523,"id":3961,"nodeType":"Class","startLoc":320,"text":"class Ipac(basic.Basic):\n    r\"\"\"Read or write an IPAC format table.  See\n    http://irsa.ipac.caltech.edu/applications/DDGEN/Doc/ipac_tbl.html::\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/t/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 occuring 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:`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\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 <http://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 <http://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        # 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('\\\\{0}={1!r}'.format(keyword.strip(), val))\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":432,"header":"def __init__(self, definition='ignore', DBMS=False)","id":3962,"name":"__init__","nodeType":"Function","startLoc":425,"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":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":523,"header":"def write(self, table)","id":3963,"name":"write","nodeType":"Function","startLoc":434,"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        # 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('\\\\{0}={1!r}'.format(keyword.strip(), val))\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":24,"endLoc":76,"id":3964,"nodeType":"Lambda","startLoc":76,"text":"lambda s: int(self.re_format.search(s).groups()[0])"},{"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":3965,"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":3967,"nodeType":"Lambda","startLoc":106,"text":"lambda s: s.split(None, 1)[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":315,"id":3968,"name":"_format_name","nodeType":"Attribute","startLoc":315,"text":"_format_name"},{"col":4,"comment":"null","endLoc":159,"header":"def get_col_type(self, col)","id":3969,"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))"},{"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":3970,"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 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        Dictionary 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 : dict\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":169,"header":"def get_reader(Reader=None, Inputter=None, Outputter=None, **kwargs)","id":3971,"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        Dictionary 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 : dict\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 public interface\n    # with a default Reader.\n    if Reader is None:\n        Reader = basic.Basic\n    reader = core._get_reader(Reader, Inputter=Inputter, Outputter=Outputter, **kwargs)\n    return reader"},{"col":4,"comment":"\n        Extract info from a header keyword line (#K)\n        ","endLoc":143,"header":"def extract_keyword_line(self, line)","id":3972,"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"},{"col":0,"comment":"null","endLoc":182,"header":"def _get_format_class(format, ReaderWriter, label)","id":3973,"name":"_get_format_class","nodeType":"Function","startLoc":172,"text":"def _get_format_class(format, ReaderWriter, label):\n    if format is not None and ReaderWriter is not None:\n        raise ValueError('Cannot supply both format and {0} keywords'.format(label))\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 {0!r} not in allowed list {1}'\n                             .format(format, sorted(core.FORMAT_CLASSES)))\n    return ReaderWriter"},{"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":545,"header":"def _guess(table, read_kwargs, format, fast_reader)","id":3974,"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 'fast_{0}'.format(format) in \\\n                                                         core.FAST_CLASSES:\n        fast_kwargs = read_kwargs.copy()\n        fast_kwargs['Reader'] = core.FAST_CLASSES['fast_{0}'.format(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 and\n                guess_kwargs['Reader'] in core.FAST_CLASSES.values()):\n            continue\n\n        # If user required a fast reader then skip all non-fast readers\n        if (fast_reader['enable'] == 'force' and\n                guess_kwargs['Reader'] not in core.FAST_CLASSES.values()):\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] = 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            reader.guessing = True\n            dat = reader.read(table)\n            _read_trace.append({'kwargs': guess_kwargs,\n                                'Reader': reader.__class__,\n                                'status': 'Success (guessing)',\n                                'dt': '{0:.3f} ms'.format((time.time() - t0) * 1000)})\n            return dat\n\n        except guess_exception_classes as err:\n            _read_trace.append({'kwargs': guess_kwargs,\n                                'status': '{0}: {1}'.format(err.__class__.__name__,\n                                                            str(err)),\n                                'dt': '{0:.3f} ms'.format((time.time() - t0) * 1000)})\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': 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': guess_kwargs,\n                                'status': '{0}: {1}'.format(err.__class__.__name__,\n                                                            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(['{}: {!r}'.format(key, val) 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                   '** appropriate arguments to read().  In particular specify the format **',\n                   '** and any known attributes like the delimiter.                       **',\n                   '************************************************************************']\n            lines.extend(msg)\n            raise core.InconsistentTableError('\\n'.join(lines))"},{"attributeType":"null","col":4,"comment":"null","endLoc":316,"id":3975,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":316,"text":"_io_registry_format_aliases"},{"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\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":195,"header":"def get_cols(self, lines)","id":3976,"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\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":317,"id":3977,"name":"_io_registry_suffix","nodeType":"Attribute","startLoc":317,"text":"_io_registry_suffix"},{"attributeType":"null","col":4,"comment":"null","endLoc":318,"id":3978,"name":"_description","nodeType":"Attribute","startLoc":318,"text":"_description"},{"attributeType":"HTMLHeader","col":4,"comment":"null","endLoc":320,"id":3979,"name":"header_class","nodeType":"Attribute","startLoc":320,"text":"header_class"},{"attributeType":"HTMLData","col":4,"comment":"null","endLoc":321,"id":3980,"name":"data_class","nodeType":"Attribute","startLoc":321,"text":"data_class"},{"attributeType":"HTMLInputter","col":4,"comment":"null","endLoc":322,"id":3981,"name":"inputter_class","nodeType":"Attribute","startLoc":322,"text":"inputter_class"},{"attributeType":"null","col":8,"comment":"null","endLoc":329,"id":3982,"name":"html","nodeType":"Attribute","startLoc":329,"text":"self.html"},{"attributeType":"HTMLOutputter","col":8,"comment":"null","endLoc":341,"id":3983,"name":"outputter","nodeType":"Attribute","startLoc":341,"text":"self.outputter"},{"col":0,"comment":"","endLoc":9,"header":"html.py#<anonymous>","id":3984,"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\"\"\""},{"id":3985,"name":"astropy/io/ascii/src","nodeType":"Package"},{"id":3986,"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    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 **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} 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":3987,"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->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    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')\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 parse_newline = 0; // explicit flag to treat current char as a newline\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 = (int *) malloc(self->num_cols * sizeof(int));\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 || parse_newline)\n            c = '\\n';\n        else\n            c = self->source[self->source_pos];\n\n        if (c == '\\r')\n            c = '\\n';\n\n        parse_newline = 0;\n\n        switch (self->state)\n        {\n        case START_LINE:\n            if (c == '\\n')\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            else if (c == self->delimiter) // field ends before it begins\n            {\n                if (col >= self->num_cols)\n                    RETURN(TOO_MANY_COLS);\n                END_FIELD();\n                BEGIN_FIELD();\n                break;\n            }\n            else if (c == '\\n')\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\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            else if (c == self->quotechar) // start parsing quoted field\n            {\n                self->state = START_QUOTED_FIELD;\n                break;\n            }\n            else\n            {\n                if (col >= self->num_cols)\n                    RETURN(TOO_MANY_COLS);\n                // Valid field character, parse again in FIELD mode\n                self->state = FIELD;\n            }\n\n        case FIELD:\n            if (self->comment != 0 && c == self->comment && whitespace && col == 0)\n            {\n                // No whitespace stripping, but the comment char is found\n                // before any data, e.g. '  # a b c'\n                self->state = COMMENT;\n            }\n            else if (c == self->delimiter)\n            {\n                // End of field, look for new field\n                END_FIELD();\n                BEGIN_FIELD();\n            }\n            else if (c == '\\n')\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) // empty quotes\n            {\n                self->state = FIELD; // parse the rest of the field normally\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_NEWLINE:\n            if (self->state == QUOTED_FIELD)\n                ; // fall through\n            // Ignore initial whitespace if strip_whitespace_lines and\n            // newlines regardless\n            else if (((c == ' ' || c == '\\t') && self->strip_whitespace_lines)\n                     || c == '\\n')\n                break;\n            else if (c == self->quotechar)\n            {\n                self->state = FIELD;\n                break;\n            }\n            else\n            {\n                // Once data begins, parse it as a normal quoted field\n                self->state = QUOTED_FIELD;\n            }\n\n        case QUOTED_FIELD:\n            if (c == self->quotechar) // Parse rest of field normally, e.g. \"ab\"c\n                self->state = FIELD;\n            else if (c == '\\n')\n                self->state = QUOTED_FIELD_NEWLINE;\n            else\n            {\n                PUSH(c);\n            }\n            break;\n\n        case COMMENT:\n            if (c == '\\n')\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\n// Lower-case a single C locale character\nstatic inline int ascii_tolower(int c)\n{\n    if (c >= 'A' || c <= 'Z')\n    {\n        return c + ('a' - 'A');\n    }\n\n    return c;\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 (*tmp)\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\n    if (tmp == str || *tmp != '\\0')\n    {\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    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    if (num_digits == 0)\n    {\n        errno = ERANGE;\n        number = 0.0;\n    }\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":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":622,"header":"def _get_guess_kwargs_list(read_kwargs)","id":3988,"name":"_get_guess_kwargs_list","nodeType":"Function","startLoc":548,"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    if HAS_YAML:\n        guess_kwargs_list.append(dict(Reader=ecsv.Ecsv))\n\n    # Now try readers that accept the common arguments with the input arguments\n    # (Unless there are not arguments - we try that in the next step anyway.)\n    # FixedWidthTwoLine would also be read by Basic, so it needs to come first.\n    if len(read_kwargs) > 0:\n        for reader in [fixedwidth.FixedWidthTwoLine,\n                       fastbasic.FastBasic,\n                       basic.Basic]:\n            first_kwargs = read_kwargs.copy()\n            first_kwargs.update(dict(Reader=reader))\n            guess_kwargs_list.append(first_kwargs)\n\n    # Then try a list of readers with default arguments\n    guess_kwargs_list.extend([dict(Reader=fixedwidth.FixedWidthTwoLine),\n                              dict(Reader=fastbasic.FastBasic),\n                              dict(Reader=basic.Basic),\n                              dict(Reader=basic.Rdb),\n                              dict(Reader=fastbasic.FastTab),\n                              dict(Reader=basic.Tab),\n                              dict(Reader=cds.Cds),\n                              dict(Reader=daophot.Daophot),\n                              dict(Reader=sextractor.SExtractor),\n                              dict(Reader=ipac.Ipac),\n                              dict(Reader=latex.Latex),\n                              dict(Reader=latex.AASTex)\n                              ])\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"},{"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":3989,"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"},{"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":672,"header":"def _read_in_chunks(table, **kwargs)","id":3990,"name":"_read_in_chunks","nodeType":"Function","startLoc":625,"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":"null","col":4,"comment":"null","endLoc":27,"id":3991,"name":"comment","nodeType":"Attribute","startLoc":27,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":30,"id":3992,"name":"re_format","nodeType":"Attribute","startLoc":30,"text":"re_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":3993,"name":"re_header_keyword","nodeType":"Attribute","startLoc":31,"text":"re_header_keyword"},{"attributeType":"null","col":4,"comment":"null","endLoc":35,"id":3994,"name":"aperture_values","nodeType":"Attribute","startLoc":35,"text":"aperture_values"},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":3995,"name":"names","nodeType":"Attribute","startLoc":131,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":3996,"name":"col_widths","nodeType":"Attribute","startLoc":86,"text":"self.col_widths"},{"attributeType":"{__getitem__}","col":12,"comment":"null","endLoc":130,"id":3997,"name":"meta","nodeType":"Attribute","startLoc":130,"text":"self.meta"},{"id":3998,"name":"astropy/io/ascii/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/ascii/tests","id":3999,"nodeType":"File","text":""},{"col":0,"comment":"\n    For fast_reader read the ``table`` in chunks and return a generator\n    of tables for each chunk.\n    ","endLoc":743,"header":"def _read_in_chunks_generator(table, chunk_size, **kwargs)","id":4000,"name":"_read_in_chunks_generator","nodeType":"Function","startLoc":675,"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"},{"className":"DaophotData","col":0,"comment":"null","endLoc":218,"id":4001,"nodeType":"Class","startLoc":198,"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":205,"header":"def __init__(self)","id":4002,"name":"__init__","nodeType":"Function","startLoc":203,"text":"def __init__(self):\n        core.BaseData.__init__(self)\n        self.is_multiline = False"},{"fileName":"common.py","filePath":"astropy/io/ascii/tests","id":4003,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport os\n\n\nimport numpy as np\n\n\n__all__ = ['raises', '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  # pylint: disable=W0611\nexcept ImportError:\n    try:\n        from numpy import isnan  # pylint: disable=W0611\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 py.test\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\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    If you want to test many assertions about exceptions in a single test,\n    you may want to use `assert_raises` instead.\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 = \"{}() did not raise {}\".format(name, valid)\n                raise AssertionError(message)\n        newfunc = make_decorator(func)(newfunc)\n        return newfunc\n    return decorate\n"},{"col":4,"comment":"null","endLoc":218,"header":"def get_data_lines(self, lines)","id":4004,"name":"get_data_lines","nodeType":"Function","startLoc":207,"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)"},{"col":0,"comment":"null","endLoc":29,"header":"def setup_function(function)","id":4005,"name":"setup_function","nodeType":"Function","startLoc":28,"text":"def setup_function(function):\n    os.chdir(TEST_DIR)"},{"col":0,"comment":"null","endLoc":33,"header":"def teardown_function(function)","id":4006,"name":"teardown_function","nodeType":"Function","startLoc":32,"text":"def teardown_function(function):\n    os.chdir(CWD)"},{"col":0,"comment":"null","endLoc":38,"header":"def assert_equal(a, b)","id":4007,"name":"assert_equal","nodeType":"Function","startLoc":37,"text":"def assert_equal(a, b):\n    assert a == b"},{"col":0,"comment":"null","endLoc":42,"header":"def assert_almost_equal(a, b, **kwargs)","id":4008,"name":"assert_almost_equal","nodeType":"Function","startLoc":41,"text":"def assert_almost_equal(a, b, **kwargs):\n    assert np.allclose(a, b, **kwargs)"},{"col":0,"comment":"null","endLoc":46,"header":"def assert_true(a)","id":4009,"name":"assert_true","nodeType":"Function","startLoc":45,"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":74,"header":"def make_decorator(func)","id":4010,"name":"make_decorator","nodeType":"Function","startLoc":49,"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    If you want to test many assertions about exceptions in a single test,\n    you may want to use `assert_raises` instead.\n    ","endLoc":108,"header":"def raises(*exceptions)","id":4011,"name":"raises","nodeType":"Function","startLoc":77,"text":"def 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    If you want to test many assertions about exceptions in a single test,\n    you may want to use `assert_raises` instead.\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 = \"{}() did not raise {}\".format(name, valid)\n                raise AssertionError(message)\n        newfunc = make_decorator(func)(newfunc)\n        return newfunc\n    return decorate"},{"attributeType":"FixedWidthSplitter","col":4,"comment":"null","endLoc":199,"id":4012,"name":"splitter_class","nodeType":"Attribute","startLoc":199,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":200,"id":4013,"name":"start_line","nodeType":"Attribute","startLoc":200,"text":"start_line"},{"attributeType":"null","col":4,"comment":"null","endLoc":201,"id":4014,"name":"comment","nodeType":"Attribute","startLoc":201,"text":"comment"},{"attributeType":"null","col":8,"comment":"null","endLoc":205,"id":4015,"name":"is_multiline","nodeType":"Attribute","startLoc":205,"text":"self.is_multiline"},{"className":"DaophotInputter","col":0,"comment":"null","endLoc":312,"id":4016,"nodeType":"Class","startLoc":221,"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(l).groups()\n                                       for l 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 ValueError('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":274,"header":"def search_multiline(self, lines, depth=150)","id":4017,"name":"search_multiline","nodeType":"Function","startLoc":228,"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(l).groups()\n                                       for l 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"},{"col":4,"comment":"null","endLoc":285,"header":"def str_vals(self)","id":4018,"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: {0}'.format(doublenames))\n\n        for name in namelist:\n            m = re.match(r'\\w+', name)\n            if m.end() != len(name):\n                raise IpacFormatE('{0} - 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('Column name cannot start with numbers: {}'.format(name))\n            if self.DBMS:\n                if name in ['x', 'y', 'z', 'X', 'Y', 'Z']:\n                    raise IpacFormatE('{0} - 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                        '{0} - Maximum length for column name is 16 characters'.format(name))\n            else:\n                if len(name) > 40:\n                    raise IpacFormatE(\n                        '{0} - Maximum length for column name is 40 characters.'.format(name))\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                dtypelist.append('long')\n            elif col_dtype.kind == 'f':\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]"},{"col":4,"comment":"null","endLoc":312,"header":"def process_lines(self, lines)","id":4019,"name":"process_lines","nodeType":"Function","startLoc":276,"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 ValueError('multiline re could not match line '\n                                 '{}: {}'.format(i, line))\n\n        return outlines"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":4021,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":4022,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":4023,"name":"CWD","nodeType":"Attribute","startLoc":14,"text":"CWD"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":4024,"name":"TEST_DIR","nodeType":"Attribute","startLoc":15,"text":"TEST_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":4025,"name":"has_isnan","nodeType":"Attribute","startLoc":17,"text":"has_isnan"},{"attributeType":"null","col":8,"comment":"null","endLoc":24,"id":4026,"name":"has_isnan","nodeType":"Attribute","startLoc":24,"text":"has_isnan"},{"col":0,"comment":"","endLoc":4,"header":"common.py#<anonymous>","id":4027,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['raises', '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  # pylint: disable=W0611\nexcept ImportError:\n    try:\n        from numpy import isnan  # pylint: disable=W0611\n    except ImportError:\n        has_isnan = False\n        print('Tests requiring isnan will fail')"},{"id":4028,"name":"astropy/io/ascii/tests/t","nodeType":"Package"},{"id":4029,"name":"vots_spec.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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## intented 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 througout 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 defintions.\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"},{"id":4030,"name":"space_delim_no_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"1 3.4 hello\n2 6.4 world\n"},{"id":4031,"name":"latex2.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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\nChandra & \\dataset[ADS/Sa.CXO#obs/06438]{ObsId 6438} & 23 ks & 2006-12-10\\\\\nSpitzer & AOR 3656448  & 41.6 s & 2004-06-09\\\\\nFLWO    & filter: $B$ & 600 s & 2009-11-18\\\\\n\\enddata\n\n\\end{deluxetable}\n"},{"id":4032,"name":"test5.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4033,"name":"ipac.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4034,"name":"simple3.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4035,"name":"bad.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4036,"name":"daophot2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4037,"name":"space_delim_no_names.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"1 2\n3 4\n"},{"id":4038,"name":"commented_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"# a b c\n# A comment line\n1 2 3\n4 5 6\n"},{"id":4039,"name":"html.html","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4040,"name":"cds.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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  1 03 28 39.09 +31 06 01.9                                          I*           1.35 \n"},{"id":4041,"name":"bars_at_ends.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4042,"name":"fill_values.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"a,b,c\n1,2,3\na,a,4\n"},{"id":4043,"name":"sextractor2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4044,"name":"daophot4.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"id":4045,"name":"simple5.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4046,"name":"sextractor.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"id":4047,"name":"nls1_stackinfo.dbout","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4048,"name":"commented_header2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"# A comment line\n# Another comment line\n# a b c\n1 2 3\n4 5 6\n"},{"id":4049,"name":"latex1.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4050,"name":"simple2.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4051,"name":"latex3.tex","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"\\begin{tabular}{lrr}\\hline\ncola & colb & colc\\\\\n\\hline\na & 1 & 2\\\\\nb & 3 & 4\\\\\n\\hline\n\\end{tabular}\n"},{"id":4052,"name":"daophot3.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"id":4053,"name":"cds_malformed.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4054,"name":"no_data_cds.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4055,"name":"short.tab","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4056,"name":"simple.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":" 'test 1a' test2  test3 test4  \n    #  fun1    fun2\t    fun3 fun4 fun5\n    top1 top2 top3     top4 \nhat1  hat2 hat3 hat4    \n"},{"id":4057,"name":"no_data_sextractor.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4058,"name":"short.rdb","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4059,"name":"test4.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4060,"name":"space_delim_blank_lines.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4061,"name":"simple4.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4062,"name":"fixed_width_2_line.txt","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"Col1      Col2 Col3 Col4\n---- --------- ---- ----\n 1.2   \"hello\"    1    a\n 2.4 's worlds    2    2\n"},{"id":4063,"name":"apostrophe.rdb","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"# first comment\nagasc_id\tn_noids\tn_obs\n11S\tN\tN\njean's \t1\t1\n  # second comment\n335416352\t3\t8\n"},{"id":4064,"name":"whitespace.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":" \"quoted colname with tab\tinside\"  col2  \t\t col3\nval1   \"val2 with\ttab\"  \t2\n val3   val4                    3\n"},{"id":4065,"name":"cds2.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"id":4066,"name":"simple_csv.csv","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"a,b,c\n1,2,3\n4,5,6"},{"id":4067,"name":"continuation.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"1 3 5 \\\nhello world\n4 6 8 next \\\nline\n"},{"id":4068,"name":"no_data_daophot.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4069,"name":"simple_csv_missing.csv","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"a,b,c\n1\n4,5,6\n"},{"id":4070,"name":"daophot.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4071,"name":"apostrophe.tab","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"agasc_id\tn_noids\tn_obs\njean's \t1\t1\n335416352\t3\t8\n"},{"id":4072,"name":"html2.html","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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":4073,"name":"no_data_without_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"# blank data table\n \n"},{"attributeType":"null","col":4,"comment":"null","endLoc":223,"id":4074,"name":"continuation_char","nodeType":"Attribute","startLoc":223,"text":"continuation_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":224,"id":4075,"name":"multiline_char","nodeType":"Attribute","startLoc":224,"text":"multiline_char"},{"id":4076,"name":"sextractor3.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"attributeType":"null","col":4,"comment":"null","endLoc":225,"id":4077,"name":"replace_char","nodeType":"Attribute","startLoc":225,"text":"replace_char"},{"attributeType":"null","col":4,"comment":"null","endLoc":226,"id":4078,"name":"re_multiline","nodeType":"Attribute","startLoc":226,"text":"re_multiline"},{"className":"Daophot","col":0,"comment":"\n    Read a DAOphot file.\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/t/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":393,"id":4079,"nodeType":"Class","startLoc":315,"text":"class Daophot(core.BaseReader):\n    \"\"\"\n    Read a DAOphot file.\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/t/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"},{"id":4080,"name":"no_data_ipac.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","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"},{"id":4081,"name":"no_data_with_header.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t","text":"a b c\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":417,"id":4082,"name":"_format_name","nodeType":"Attribute","startLoc":417,"text":"_format_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":418,"id":4083,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":418,"text":"_io_registry_format_aliases"},{"attributeType":"null","col":4,"comment":"null","endLoc":419,"id":4084,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":419,"text":"_io_registry_can_write"},{"attributeType":"null","col":4,"comment":"null","endLoc":420,"id":4085,"name":"_description","nodeType":"Attribute","startLoc":420,"text":"_description"},{"attributeType":"null","col":4,"comment":"null","endLoc":422,"id":4086,"name":"data_class","nodeType":"Attribute","startLoc":422,"text":"data_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":423,"id":4087,"name":"header_class","nodeType":"Attribute","startLoc":423,"text":"header_class"},{"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":801,"header":"def get_writer(Writer=None, fast_writer=True, **kwargs)","id":4088,"name":"get_writer","nodeType":"Function","startLoc":750,"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":"Write the input ``table`` to ``filename``.  Most of the default behavior\n    for various parameters is determined by the Writer class.\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\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    overwrite : bool\n        If ``overwrite=None`` (default) and the file exists, then a\n        warning will be issued. In a future release this will instead\n        generate an exception. If ``overwrite=False`` and the file\n        exists, then an exception is raised.\n        This parameter is ignored when the ``output`` arg is not a string\n        (e.g., a file object).\n    Writer : ``Writer``\n        Writer class (DEPRECATED).\n\n    ","endLoc":894,"header":"def write(table, output=None, format=None, Writer=None, fast_writer=True, *,\n          overwrite=None, **kwargs)","id":4089,"name":"write","nodeType":"Function","startLoc":804,"text":"def write(table, output=None, format=None, Writer=None, fast_writer=True, *,\n          overwrite=None, **kwargs):\n    \"\"\"Write the input ``table`` to ``filename``.  Most of the default behavior\n    for various parameters is determined by the Writer class.\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\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    overwrite : bool\n        If ``overwrite=None`` (default) and the file exists, then a\n        warning will be issued. In a future release this will instead\n        generate an exception. If ``overwrite=False`` and the file\n        exists, then an exception is raised.\n        This parameter is ignored when the ``output`` arg is not a string\n        (e.g., a file object).\n    Writer : ``Writer``\n        Writer class (DEPRECATED).\n\n    \"\"\"\n    if isinstance(output, str):\n        if os.path.lexists(output):\n            if overwrite is None:\n                warnings.warn(\n                    \"{} already exists. \"\n                    \"Automatically overwriting ASCII files is deprecated. \"\n                    \"Use the argument 'overwrite=True' in the future.\".format(\n                        output), AstropyDeprecationWarning)\n            elif not overwrite:\n                raise OSError(\"{} already exists\".format(output))\n\n    if output is None:\n        output = sys.stdout\n\n    table_cls = table.__class__ if isinstance(table, Table) else Table\n    table = table_cls(table, names=kwargs.get('names'))\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 keys {} specified in the formats argument does 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        output = open(output, 'w')\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":"null","endLoc":28,"header":"def write_asciitable(table, filename, **kwargs)","id":4090,"name":"write_asciitable","nodeType":"Function","startLoc":26,"text":"def write_asciitable(table, filename, **kwargs):\n    from .ui import write\n    return write(table, filename, **kwargs)"},{"col":0,"comment":"null","endLoc":37,"header":"def io_read(format, filename, **kwargs)","id":4091,"name":"io_read","nodeType":"Function","startLoc":34,"text":"def io_read(format, filename, **kwargs):\n    from .ui import read\n    format = re.sub(r'^ascii\\.', '', format)\n    return read(filename, format=format, **kwargs)"},{"col":0,"comment":"null","endLoc":43,"header":"def io_write(format, table, filename, **kwargs)","id":4092,"name":"io_write","nodeType":"Function","startLoc":40,"text":"def io_write(format, table, filename, **kwargs):\n    from .ui import write\n    format = re.sub(r'^ascii\\.', '', format)\n    return write(table, filename, format=format, **kwargs)"},{"col":0,"comment":"null","endLoc":47,"header":"def io_identify(suffix, origin, filepath, fileobj, *args, **kwargs)","id":4093,"name":"io_identify","nodeType":"Function","startLoc":46,"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":71,"header":"def _get_connectors_table()","id":4094,"name":"_get_connectors_table","nodeType":"Function","startLoc":50,"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 = ':class:`~{0}.{1}`'.format(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                     '{0}: {1}'.format(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 = '%-{0}s'.format(width)\n\n    return out"},{"col":4,"comment":"null","endLoc":390,"header":"def __init__(self)","id":4095,"name":"__init__","nodeType":"Function","startLoc":387,"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"},{"col":4,"comment":"null","endLoc":393,"header":"def write(self, table=None)","id":4096,"name":"write","nodeType":"Function","startLoc":392,"text":"def write(self, table=None):\n        raise NotImplementedError"},{"attributeType":"null","col":4,"comment":"null","endLoc":376,"id":4097,"name":"_format_name","nodeType":"Attribute","startLoc":376,"text":"_format_name"},{"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 dicts\n       Ordered list of format guesses and status\n    ","endLoc":912,"header":"def get_read_trace()","id":4098,"name":"get_read_trace","nodeType":"Function","startLoc":897,"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 dicts\n       Ordered list of format guesses and status\n    \"\"\"\n\n    return copy.deepcopy(_read_trace)"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":4099,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\" An extensible ASCII table reader and writer.\n\n\"\"\""},{"col":0,"comment":"null","endLoc":80,"header":"def read_csv(filename, **kwargs)","id":4100,"name":"read_csv","nodeType":"Function","startLoc":77,"text":"def read_csv(filename, **kwargs):\n    from .ui import read\n    kwargs['format'] = 'csv'\n    return read(filename, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":377,"id":4101,"name":"_io_registry_format_aliases","nodeType":"Attribute","startLoc":377,"text":"_io_registry_format_aliases"},{"id":4102,"name":"astropy/io/ascii/tests/t/cds/glob","nodeType":"Package"},{"id":4103,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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 ? Aditional 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"},{"col":0,"comment":"null","endLoc":86,"header":"def write_csv(table, filename, **kwargs)","id":4104,"name":"write_csv","nodeType":"Function","startLoc":83,"text":"def write_csv(table, filename, **kwargs):\n    from .ui import write\n    kwargs['format'] = 'csv'\n    return write(table, filename, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":378,"id":4105,"name":"_io_registry_can_write","nodeType":"Attribute","startLoc":378,"text":"_io_registry_can_write"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":4106,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":4107,"name":"csv_identify","nodeType":"Attribute","startLoc":89,"text":"csv_identify"},{"col":0,"comment":"","endLoc":5,"header":"connect.py#<anonymous>","id":4108,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = []\n\nio_registry.register_reader('ascii', Table, read_asciitable)\n\nio_registry.register_writer('ascii', Table, write_asciitable)\n\ncsv_identify = functools.partial(io_identify, '.csv')\n\nio_registry.register_reader('csv', Table, read_csv)\n\nio_registry.register_writer('csv', Table, write_csv)\n\nio_registry.register_identifier('csv', Table, csv_identify)"},{"attributeType":"null","col":4,"comment":"null","endLoc":379,"id":4109,"name":"_description","nodeType":"Attribute","startLoc":379,"text":"_description"},{"attributeType":"DaophotHeader","col":4,"comment":"null","endLoc":381,"id":4110,"name":"header_class","nodeType":"Attribute","startLoc":381,"text":"header_class"},{"id":4111,"name":"lmxbrefs.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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"},{"attributeType":"DaophotData","col":4,"comment":"null","endLoc":382,"id":4112,"name":"data_class","nodeType":"Attribute","startLoc":382,"text":"data_class"},{"id":4113,"name":"astropy/io/ascii/tests/t/cds/multi","nodeType":"Package"},{"id":4114,"name":"lp944-20.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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":4115,"name":"astropy/io/ascii/tests/t/cds/description","nodeType":"Package"},{"id":4116,"name":"table.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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"},{"attributeType":"DaophotInputter","col":4,"comment":"null","endLoc":383,"id":4117,"name":"inputter_class","nodeType":"Attribute","startLoc":383,"text":"inputter_class"},{"id":4118,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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":4119,"name":"astropy/io/ascii/tests/t/vizier","nodeType":"Package"},{"id":4120,"name":"table1.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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"},{"attributeType":"null","col":4,"comment":"null","endLoc":385,"id":4121,"name":"table_width","nodeType":"Attribute","startLoc":385,"text":"table_width"},{"id":4122,"name":"table5.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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":4123,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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"},{"attributeType":"null","col":16,"comment":"null","endLoc":13,"id":4124,"name":"np","nodeType":"Attribute","startLoc":13,"text":"np"},{"attributeType":"null","col":20,"comment":"null","endLoc":14,"id":4125,"name":"itt","nodeType":"Attribute","startLoc":14,"text":"itt"},{"col":0,"comment":"","endLoc":9,"header":"daophot.py#<anonymous>","id":4126,"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\"\"\""},{"id":4127,"name":"ReadMe","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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":4128,"name":"astropy/io/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/io/tests","id":4129,"nodeType":"File","text":""},{"id":4130,"name":"astropy/io/votable","nodeType":"Package"},{"fileName":"tree.py","filePath":"astropy/io/votable","id":4131,"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 sys\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 .. import fits\nfrom ... import __version__ as astropy_version\nfrom ...utils.collections import HomogeneousList\nfrom ...utils.xml.writer import XMLWriter\nfrom ...utils.exceptions import AstropyDeprecationWarning\nfrom ...utils.misc import InheritDocstrings\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, E06, E08, E09, E10, E11, E12,\n                         E13, E15, E16, E17, E18, E19, E20, E21)\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',\n    'FieldRef', 'ParamRef', 'Group', 'Table', 'Resource',\n    'VOTableFile'\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                        \"{} references itself\".format(element_name),\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                        \"{} references itself\".format(element_name),\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    # In the future, this should take into account the VOTable\n    # version.\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('pedantic'):\n                vo_raise(W06, (ucd, str(e)), config, pos)\n            else:\n                vo_warn(W06, (ucd, str(e)), config, pos)\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(metaclass=InheritDocstrings):\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 iterator\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 : 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\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 ... 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                            ['data', '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            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 archive.noao.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 (not config.get('pedantic') 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 + \"_{:d}\".format(i)\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 + \" {:d}\".format(i)\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_ 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 ... 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):\n            column.format = self.converter.output_format\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        if config.get('version_1_2_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 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            \"No field named '{}'\".format(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            \"No params named '{}'\".format(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 '<GROUP>... {0} entries ...</GROUP>'.format(len(self._entries))\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:`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(\"Invalid format '{}'\".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                        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                        \"Columns '{}' not found in fields list\".format(columns))\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if not skip_table:\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                        \"Unknown encoding type '{}'\".format(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                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                    \"Unknown encoding type '{}'\".format(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=\"_g{0}\".format(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=\"(in row {:d}, col '{}')\".format(\n                                    row, 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 ...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 = '{0}{1}'.format(name, i)\n                    i += 1\n                unique_names.append(new_name)\n            array = self.array.copy()\n            array.dtype.names = unique_names\n            names = unique_names\n        else:\n            array = self.array\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, 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._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 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_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            '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.params,\n                                self.infos, self.links, self.tables,\n                                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_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.3\"):\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._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 not in (\"1.0\", \"1.1\", \"1.2\", \"1.3\"):\n            raise ValueError(\"'version' should be one of '1.0', '1.1', \"\n                             \"'1.2', or '1.3'\")\n\n        self._version = version\n\n    def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return '<VOTABLE>... {0} tables ...</VOTABLE>'.format(n_tables)\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 ('1.1', '1.2', '1.3'):\n            raise ValueError(\n                \"astropy.io.votable only supports VOTable versions \"\n                \"1.1, 1.2 and 1.3\")\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 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_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 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 ('1.1', '1.2', '1.3'):\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        correct_ns = ('http://www.ivoa.net/xml/VOTable/v{}'.format(\n                                config['version']))\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(\n                                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['version_1_1_or_later'] = \\\n            util.version_compare(config['version'], '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(config['version'], '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(config['version'], '1.3') >= 0\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\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 path or writable file-like object\n            Where to write the file.\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:`votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(\"Unknown format type '{0}'\".format(format))\n\n        kwargs = {\n            'version': self.version,\n            'version_1_1_or_later':\n                util.version_compare(self.version, '1.1') >= 0,\n            'version_1_2_or_later':\n                util.version_compare(self.version, '1.2') >= 0,\n            'version_1_3_or_later':\n                util.version_compare(self.version, '1.3') >= 0,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\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            with w.tag('VOTABLE',\n                       {'version': version,\n                        'xmlns:xsi':\n                            \"http://www.w3.org/2001/XMLSchema-instance\",\n                        'xsi:noNamespaceSchemaLocation':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version),\n                        'xmlns':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version)}):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.params,\n                                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            \"No table at index {:d} found in VOTABLE file.\".format(idx))\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_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"},{"fileName":"exceptions.py","filePath":"astropy/io/votable","id":4132,"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.  Most of these are of the type\n    `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 vo.table\n    when the file does not conform to spec.  Other exceptions may be\n    raised due to unforeseen cases or bugs in vo.table itself.\n\n{exceptions}\n\"\"\"\n\n\n\n# STDLIB\nimport io\nimport re\n\nfrom textwrap import dedent\nfrom warnings import warn\n\nfrom ...utils.exceptions import AstropyWarning\n\n\n__all__ = [\n    '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\nMAX_WARNINGS = 10\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 '{}:{}:{}: {}: {}'.format(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 <= MAX_WARNINGS:\n        if message_count == 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 pedantic setting.\n    \"\"\"\n    if config is None:\n        config = {}\n    if config.get('pedantic'):\n        if exception_class is None:\n            exception_class = warning_class\n        vo_raise(exception_class, args, config, pos)\n    else:\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    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'] = \"io/votable/api_exceptions.html#{0}\".format(\n                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 ``vo.table`` supports this convention when not in\n    :ref:`pedantic-mode`.\n\n    ``vo.table`` 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, ``vo.table`` 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 ``vo.table`` 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    <http://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, ``vo.table``\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.  ``vo.table`` accepts ``id`` and emits this warning when\n    not in ``pedantic`` mode.\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 ``vo.table``.\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 ``vo.table`` 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 *pedantic mode* is off,\n    ``vo.table`` 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 *pedantic mode* is off,\n    ``vo.table`` 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 *pedantic mode*\n    is off, 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 *pedantic\n    mode* is off, 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 ``vo.table`` with VOTable files\n    from a version other than 1.1, 1.2 or 1.3.\n    \"\"\"\n\n    message_template = (\n        'vo.table is designed for VOTable version 1.1, 1.2 and 1.3, but ' +\n        '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 vo.table.  This may cause problems or limited\n    features performing service queries.  Consider upgrading vo.table\n    to the latest version.\n    \"\"\"\n\n    message_template = \"The VO catalog database is for a later version of vo.table\"\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\n    ways, such as \"null\" and \"-\".  In non-pedantic mode, any non-standard\n    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    vo.table 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 `archive.noao.edu <http://archive.noao.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 `Standards for Astronomical\n    Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_.\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 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\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(\".. _{}:\\n\\n\".format(name))\n            msg = \"{}: {}\".format(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"},{"fileName":"table.py","filePath":"astropy/io/votable","id":4133,"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\n\n# STDLIB\nimport io\nimport os\nimport sys\nimport textwrap\nimport warnings\n\n# LOCAL\nfrom . import exceptions\nfrom . import tree\nfrom ...utils.xml import iterparser\nfrom ...utils import data\n\n\n__all__ = ['parse', 'parse_single_table', 'from_table', 'writeto', 'validate',\n           'reset_vo_warnings']\n\n\ndef parse(source, columns=None, invalid='exception', pedantic=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 : str or readable file-like object\n        Path or file object containing a VOTABLE_ xml file.\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    pedantic : bool, optional\n        When `True`, raise an error when the file violates the spec,\n        otherwise issue a warning.  Warnings may be controlled using\n        the standard Python mechanisms.  See the `warnings`\n        module in the Python standard library for more information.\n        When not provided, uses the configuration setting\n        ``astropy.io.votable.pedantic``, which defaults to False.\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.2 of\n        VOTable, and (probably) ``vounit`` in future versions of the\n        spec).\n\n    datatype_mapping : dict of str to str, optional\n        A mapping of datatype names to valid VOTable datatype names.\n        For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the\n        mapping ``{\"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 pedantic is None:\n        pedantic = conf.pedantic\n\n    if datatype_mapping is None:\n        datatype_mapping = {}\n\n    config = {\n        'columns': columns,\n        'invalid': invalid,\n        'pedantic': pedantic,\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 object\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:`votable-serialization`.\n    \"\"\"\n    from ...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=None, xmllint=False, filename=None):\n    \"\"\"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : str or readable file-like object\n        Path to a VOTABLE_ xml file or pathlib.path\n        object having Path to a VOTABLE_ xml file.\n\n    output : writable file-like object, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\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 ...utils.console import print_code_line, color_print\n\n    if output is None:\n        output = sys.stdout\n\n    return_as_str = False\n    if output is None:\n        output = io.StringIO()\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, pedantic=False, 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(\"Validation report for {0}\\n\\n\".format(filename))\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                    '{0:d}: '.format(w['nline']), '',\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 ...utils.xml import validate\n\n        if votable is None:\n            version = \"1.1\"\n        else:\n            version = votable.version\n        success, stdout, stderr = validate.validate_schema(\n            filename, version)\n\n        if success != 0:\n            output.write(\n                'xmllint schema violations:\\n\\n')\n            output.write(stderr)\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 : str or readable file-like object\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    try:\n        with iterparser.get_xml_iterator(source) as iterator:\n            for start, tag, data, pos in iterator:\n                if tag != 'xml':\n                    return False\n                break\n\n            for start, tag, data, 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        if hasattr(module, '__warningregistry__'):\n            del module.__warningregistry__\n"},{"id":4134,"name":"lhs2065.dat","nodeType":"TextFile","path":"astropy/io/ascii/tests/t/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"},{"fileName":"util.py","filePath":"astropy/io/votable","id":4135,"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 distutils 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 : file path string or writable file-like object\n        May be:\n\n            - a file path, 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 object\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 '{}/{}'.format(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                    \"'{}' is not a valid frame of reference\".format(p[-1]))\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(\"'{}' is not a valid range list\".format(p))\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                \"'{}' is not a valid frame of reference\".format(frame))\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(\"'{}' is not a valid range list\".format(p))\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.StrictVersion(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"},{"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":297,"header":"def write(self, lines, widths)","id":4136,"name":"write","nodeType":"Function","startLoc":287,"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"},{"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 : str or readable file-like object\n        Path or file object containing a VOTABLE_ xml file.\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    pedantic : bool, optional\n        When `True`, raise an error when the file violates the spec,\n        otherwise issue a warning.  Warnings may be controlled using\n        the standard Python mechanisms.  See the `warnings`\n        module in the Python standard library for more information.\n        When not provided, uses the configuration setting\n        ``astropy.io.votable.pedantic``, which defaults to False.\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.2 of\n        VOTable, and (probably) ``vounit`` in future versions of the\n        spec).\n\n    datatype_mapping : dict of str to str, optional\n        A mapping of datatype names to valid VOTable datatype names.\n        For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the\n        mapping ``{\"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":139,"header":"def parse(source, columns=None, invalid='exception', pedantic=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":4137,"name":"parse","nodeType":"Function","startLoc":28,"text":"def parse(source, columns=None, invalid='exception', pedantic=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 : str or readable file-like object\n        Path or file object containing a VOTABLE_ xml file.\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    pedantic : bool, optional\n        When `True`, raise an error when the file violates the spec,\n        otherwise issue a warning.  Warnings may be controlled using\n        the standard Python mechanisms.  See the `warnings`\n        module in the Python standard library for more information.\n        When not provided, uses the configuration setting\n        ``astropy.io.votable.pedantic``, which defaults to False.\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.2 of\n        VOTable, and (probably) ``vounit`` in future versions of the\n        spec).\n\n    datatype_mapping : dict of str to str, optional\n        A mapping of datatype names to valid VOTable datatype names.\n        For example, if the file being read contains the datatype\n        \"unsignedInt\" (an invalid datatype in VOTable), include the\n        mapping ``{\"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 pedantic is None:\n        pedantic = conf.pedantic\n\n    if datatype_mapping is None:\n        datatype_mapping = {}\n\n    config = {\n        'columns': columns,\n        'invalid': invalid,\n        'pedantic': pedantic,\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)"},{"attributeType":"IpacHeaderSplitter","col":4,"comment":"null","endLoc":68,"id":4138,"name":"splitter_class","nodeType":"Attribute","startLoc":68,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":73,"id":4139,"name":"col_type_list","nodeType":"Attribute","startLoc":73,"text":"col_type_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":4140,"name":"definition","nodeType":"Attribute","startLoc":80,"text":"definition"},{"attributeType":"None","col":4,"comment":"null","endLoc":81,"id":4141,"name":"start_line","nodeType":"Attribute","startLoc":81,"text":"start_line"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":4142,"name":"names","nodeType":"Attribute","startLoc":214,"text":"self.names"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":4143,"name":"cols","nodeType":"Attribute","startLoc":215,"text":"self.cols"},{"className":"IpacDataSplitter","col":0,"comment":"null","endLoc":303,"id":4144,"nodeType":"Class","startLoc":300,"text":"class IpacDataSplitter(fixedwidth.FixedWidthSplitter):\n    delimiter = ' '\n    delimiter_pad = ''\n    bookend = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":301,"id":4145,"name":"delimiter","nodeType":"Attribute","startLoc":301,"text":"delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":302,"id":4146,"name":"delimiter_pad","nodeType":"Attribute","startLoc":302,"text":"delimiter_pad"},{"attributeType":"null","col":4,"comment":"null","endLoc":303,"id":4147,"name":"bookend","nodeType":"Attribute","startLoc":303,"text":"bookend"},{"className":"IpacData","col":0,"comment":"IPAC table data reader","endLoc":317,"id":4148,"nodeType":"Class","startLoc":306,"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":4,"comment":" IPAC writer, modified from FixedWidth writer ","endLoc":317,"header":"def write(self, lines, widths, vals_list)","id":4149,"name":"write","nodeType":"Function","startLoc":313,"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"},{"col":0,"comment":"\n    Returns a writable file-like object suitable for streaming output.\n\n    Parameters\n    ----------\n    fd : file path string or writable file-like object\n        May be:\n\n            - a file path, 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 object\n    ","endLoc":85,"header":"@contextlib.contextmanager\ndef convert_to_writable_filelike(fd, compressed=False)","id":4150,"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 : file path string or writable file-like object\n        May be:\n\n            - a file path, 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 object\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\")"},{"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":211,"id":4151,"nodeType":"Class","startLoc":183,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":308,"id":4152,"name":"comment","nodeType":"Attribute","startLoc":308,"text":"comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":309,"id":4153,"name":"start_line","nodeType":"Attribute","startLoc":309,"text":"start_line"},{"attributeType":"IpacDataSplitter","col":4,"comment":"null","endLoc":310,"id":4154,"name":"splitter_class","nodeType":"Attribute","startLoc":310,"text":"splitter_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":311,"id":4155,"name":"fill_values","nodeType":"Attribute","startLoc":311,"text":"fill_values"},{"col":0,"comment":"","endLoc":9,"header":"ipac.py#<anonymous>","id":4156,"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\"\"\""},{"fileName":"ucd.py","filePath":"astropy/io/votable","id":4157,"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 ...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 'QPEV':\n                    self._primary.add(name_lower)\n                if type in 'QSEV':\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 : *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(\"UCD has invalid character '{}' in '{}'\".format(\n                m.group(0), ucd))\n\n    word_component_re = r'[A-Za-z0-9][A-Za-z0-9\\-_]*'\n    word_re = r'{}(\\.{})*'.format(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(\"Invalid namespace '{}'\".format(ns))\n            ns = ns.lower()\n        elif colon_count > 1:\n            raise ValueError(\"Too many colons in '{}'\".format(word))\n        else:\n            ns = 'ivoa'\n\n        if not re.match(word_re, word):\n            raise ValueError(\"Invalid word '{}'\".format(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                            \"Secondary word '{}' is not valid as a primary \"\n                            \"word\".format(word))\n                    else:\n                        raise ValueError(\"Unknown word '{}'\".format(word))\n            else:\n                if not _ucd_singleton.is_secondary(word):\n                    if _ucd_singleton.is_primary(word):\n                        raise ValueError(\n                            \"Primary word '{}' is not valid as a secondary \"\n                            \"word\".format(word))\n                    else:\n                        raise ValueError(\"Unknown word '{}'\".format(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"},{"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":4158,"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 'QPEV':\n                    self._primary.add(name_lower)\n                if type in 'QSEV':\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":4159,"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 'QPEV':\n                    self._primary.add(name_lower)\n                if type in 'QSEV':\n                    self._secondary.add(name_lower)\n                self._descriptions[name_lower] = descr\n                self._capitalization[name_lower] = name"},{"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    fd : readable file-like object or read function\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":162,"header":"@contextlib.contextmanager\ndef get_xml_iterator(source, _debug_python_based_parser=False)","id":4160,"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    fd : readable file-like object or read function\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)"},{"col":4,"comment":"null","endLoc":202,"header":"def __init__(self, args, config=None, pos=None)","id":4161,"name":"__init__","nodeType":"Function","startLoc":193,"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)"},{"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":4162,"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 '{}/{}'.format(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                    \"'{}' is not a valid frame of reference\".format(p[-1]))\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(\"'{}' is not a valid range list\".format(p))\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                \"'{}' is not a valid frame of reference\".format(frame))\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(\"'{}' is not a valid range list\".format(p))"},{"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":4164,"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":0,"comment":"null","endLoc":40,"id":4165,"name":"_read_trace","nodeType":"Attribute","startLoc":40,"text":"_read_trace"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":4166,"name":"HAS_YAML","nodeType":"Attribute","startLoc":44,"text":"HAS_YAML"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":4167,"name":"_GUESS","nodeType":"Attribute","startLoc":49,"text":"_GUESS"},{"attributeType":"null","col":0,"comment":"null","endLoc":746,"id":4168,"name":"extra_writer_pars","nodeType":"Attribute","startLoc":746,"text":"extra_writer_pars"},{"col":0,"comment":"","endLoc":9,"header":"ui.py#<anonymous>","id":4169,"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\ntry:\n    import yaml  # pylint: disable=W0611\n    HAS_YAML = True\nexcept ImportError:\n    HAS_YAML = False\n\n_GUESS = True\n\nextra_writer_pars = ('delimiter', 'comment', 'quotechar', 'formats',\n                     'names', 'include_names', 'exclude_names', 'strip_whitespace')"},{"col":0,"comment":"null","endLoc":110,"header":"def _fast_iterparse(fd, buffersize=2 ** 10)","id":4172,"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"},{"col":0,"comment":"\n    Compare two VOTable version identifiers.\n    ","endLoc":214,"header":"def version_compare(a, b)","id":4173,"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.StrictVersion(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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":4175,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":4176,"name":"stc_reference_frames","nodeType":"Attribute","startLoc":89,"text":"stc_reference_frames"},{"col":0,"comment":"null","endLoc":62,"header":"def _format_message(message, name, config=None, pos=None)","id":4177,"name":"_format_message","nodeType":"Function","startLoc":56,"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 '{}:{}:{}: {}: {}'.format(filename, pos[0], pos[1], name, message)"},{"col":0,"comment":"","endLoc":4,"header":"util.py#<anonymous>","id":4178,"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'])"},{"fileName":"converters.py","filePath":"astropy/io/votable","id":4179,"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 ...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, E01, E02, E03, E04, E05, E06)\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(\"{}B\".format(len(bytes)), *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 (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 : tuple (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 : native type corresponding to this converter\n            The value\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 : tuple (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 '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 : native type corresponding to this converter\n            The value\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : byte string\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        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 = 'S{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize)\n\n        if config.get('pedantic'):\n            self.parse = self._ascii_parse\n        else:\n            self.parse = self._str_parse\n\n    def supports_empty_values(self, config):\n        return True\n\n    def _ascii_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        return value.encode('ascii'), False\n\n    def _str_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        return value.encode('utf-8'), False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n        if not isinstance(value, str):\n            value = value.decode('ascii')\n        return xml_escape_cdata(value)\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length), 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        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        return self._write_length(len(value)) + value\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\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 = 'U{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize * 2)\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('pedantic'):\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 = \"{}{}\".format(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('pedantic'):\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        return ' '.join(base_output(x, m) for x, m in\n                        zip(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.tostring()\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('.{:d}g'.format(int(precision[1:])))\n            elif precision.startswith(\"F\"):\n                format_parts.append('.{:d}f'.format(int(precision[1:])))\n            else:\n                format_parts.append('.{:d}f'.format(int(precision)))\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('pedantic'):\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(\"Invalid floating point value '{}'\".format(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.tostring()\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.tostring()\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_bytes(column):\n    for x in column:\n        if not isinstance(x, bytes):\n            return False\n    return True\n\n\ndef _all_unicode(column):\n    for x in column:\n        if not isinstance(x, str):\n            return False\n    return True\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            \"{0!r} can not be represented in VOTable\".format(dtype))\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    if column.dtype.char == 'O':\n        if isinstance(column[0], bytes):\n            if _all_bytes(column[1:]):\n                return {'datatype': 'char', 'arraysize': '*'}\n        elif isinstance(column[0], str):\n            if _all_unicode(column[1:]):\n                return {'datatype': 'unicodeChar', '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    return numpy_to_votable_dtype(column.dtype, column.shape[1:])\n"},{"fileName":"setup_package.py","filePath":"astropy/io/votable","id":4180,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom distutils.core 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\n\ndef get_package_data():\n    return {\n        'astropy.io.votable': [\n            'data/ucd1p-words.txt', 'data/*.xsd', 'data/*.dtd'],\n        'astropy.io.votable.tests': [\n            'data/*.xml', 'data/*.gz', 'data/*.json', 'data/*.fits',\n            'data/*.txt'],\n        'astropy.io.votable.validator': [\n            'urls/*.dat.gz']}\n"},{"col":0,"comment":"null","endLoc":13,"header":"def get_extensions(build_type='release')","id":4181,"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])]"},{"col":0,"comment":"null","endLoc":24,"header":"def get_package_data()","id":4182,"name":"get_package_data","nodeType":"Function","startLoc":16,"text":"def get_package_data():\n    return {\n        'astropy.io.votable': [\n            'data/ucd1p-words.txt', 'data/*.xsd', 'data/*.dtd'],\n        'astropy.io.votable.tests': [\n            'data/*.xml', 'data/*.gz', 'data/*.json', 'data/*.fits',\n            'data/*.txt'],\n        'astropy.io.votable.validator': [\n            'urls/*.dat.gz']}"},{"col":4,"comment":"null","endLoc":205,"header":"def __str__(self)","id":4183,"name":"__str__","nodeType":"Function","startLoc":204,"text":"def __str__(self):\n        return self.formatted_message"},{"col":4,"comment":"null","endLoc":211,"header":"@classmethod\n    def get_short_name(cls)","id":4184,"name":"get_short_name","nodeType":"Function","startLoc":207,"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"},{"fileName":"xmlutil.py","filePath":"astropy/io/votable","id":4185,"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 ...logger import log\nfrom ...utils import data\nfrom ...utils.xml import check as xml_check\nfrom ...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('{0} has version {1}, using schema 1.1'.format(\n            filename, version))\n        version = '1.1'\n\n    if version in ('1.1', '1.2', '1.3'):\n        schema_path = data.get_pkg_data_filename(\n            'data/VOTable.v{0}.xsd'.format(version))\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":190,"id":4186,"name":"default_args","nodeType":"Attribute","startLoc":190,"text":"default_args"},{"col":0,"comment":"\n    Warn or raise an exception, depending on the pedantic setting.\n    ","endLoc":89,"header":"def warn_or_raise(warning_class, exception_class=None, args=(), config=None,\n                  pos=None, stacklevel=1)","id":4187,"name":"warn_or_raise","nodeType":"Function","startLoc":77,"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 pedantic setting.\n    \"\"\"\n    if config is None:\n        config = {}\n    if config.get('pedantic'):\n        if exception_class is None:\n            exception_class = warning_class\n        vo_raise(exception_class, args, config, pos)\n    else:\n        vo_warn(warning_class, args, config, pos, stacklevel=stacklevel+1)"},{"attributeType":"null","col":4,"comment":"null","endLoc":191,"id":4188,"name":"message_template","nodeType":"Attribute","startLoc":191,"text":"message_template"},{"attributeType":"null","col":8,"comment":"null","endLoc":200,"id":4189,"name":"formatted_message","nodeType":"Attribute","startLoc":200,"text":"self.formatted_message"},{"col":0,"comment":"\n    Raise an exception, with proper position information if available.\n    ","endLoc":98,"header":"def vo_raise(exception_class, args=(), config=None, pos=None)","id":4190,"name":"vo_raise","nodeType":"Function","startLoc":92,"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":126,"header":"def vo_warn(warning_class, args=(), config=None, pos=None, stacklevel=1)","id":4191,"name":"vo_warn","nodeType":"Function","startLoc":119,"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    warning = warning_class(args, config, pos)\n    _suppressed_warning(warning, config, stacklevel=stacklevel+1)"},{"col":0,"comment":"null","endLoc":74,"header":"def _suppressed_warning(warning, config, stacklevel=2)","id":4192,"name":"_suppressed_warning","nodeType":"Function","startLoc":65,"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 <= MAX_WARNINGS:\n        if message_count == MAX_WARNINGS:\n            warning.formatted_message += \\\n                ' (suppressing further warnings of this type...)'\n        warn(warning, stacklevel=stacklevel+1)"},{"className":"VOTableChangeWarning","col":0,"comment":"\n    A change has been made to the input XML file.\n    ","endLoc":217,"id":4193,"nodeType":"Class","startLoc":214,"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":223,"id":4194,"nodeType":"Class","startLoc":220,"text":"class VOTableSpecWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    The input XML file violates the spec, but there is an obvious workaround.\n    \"\"\""},{"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, ``vo.table`` 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":293,"id":4195,"nodeType":"Class","startLoc":267,"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, ``vo.table`` 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":292,"id":4196,"name":"message_template","nodeType":"Attribute","startLoc":292,"text":"message_template"},{"className":"UnimplementedWarning","col":0,"comment":"\n    A feature of the VOTABLE_ spec is not implemented.\n    ","endLoc":229,"id":4197,"nodeType":"Class","startLoc":226,"text":"class UnimplementedWarning(VOWarning, SyntaxWarning):\n    \"\"\"\n    A feature of the VOTABLE_ spec is not implemented.\n    \"\"\""},{"className":"IOWarning","col":0,"comment":"\n    A network or IO error occurred, but was recovered using the cache.\n    ","endLoc":235,"id":4198,"nodeType":"Class","startLoc":232,"text":"class IOWarning(VOWarning, RuntimeWarning):\n    \"\"\"\n    A network or IO error occurred, but was recovered using the cache.\n    \"\"\""},{"className":"VOTableSpecError","col":0,"comment":"\n    The input XML file violates the spec and there is no good workaround.\n    ","endLoc":241,"id":4199,"nodeType":"Class","startLoc":238,"text":"class VOTableSpecError(VOWarning, ValueError):\n    \"\"\"\n    The input XML file violates the spec and there is no good workaround.\n    \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":293,"id":4200,"name":"default_args","nodeType":"Attribute","startLoc":293,"text":"default_args"},{"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 ``vo.table`` supports this convention when not in\n    :ref:`pedantic-mode`.\n\n    ``vo.table`` 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":264,"id":4201,"nodeType":"Class","startLoc":244,"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 ``vo.table`` supports this convention when not in\n    :ref:`pedantic-mode`.\n\n    ``vo.table`` 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":264,"id":4202,"name":"message_template","nodeType":"Attribute","startLoc":264,"text":"message_template"},{"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 ``vo.table`` 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":346,"id":4203,"nodeType":"Class","startLoc":296,"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 ``vo.table`` 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')"},{"attributeType":"null","col":4,"comment":"null","endLoc":345,"id":4204,"name":"message_template","nodeType":"Attribute","startLoc":345,"text":"message_template"},{"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":363,"id":4205,"nodeType":"Class","startLoc":349,"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":362,"id":4206,"name":"message_template","nodeType":"Attribute","startLoc":362,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":346,"id":4207,"name":"default_args","nodeType":"Attribute","startLoc":346,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":363,"id":4208,"name":"default_args","nodeType":"Attribute","startLoc":363,"text":"default_args"},{"className":"W05","col":0,"comment":"\n    The attribute must be a valid URI as defined in `RFC 2396\n    <http://www.ietf.org/rfc/rfc2396.txt>`_.\n    ","endLoc":373,"id":4209,"nodeType":"Class","startLoc":366,"text":"class W05(VOTableSpecWarning):\n    \"\"\"\n    The attribute must be a valid URI as defined in `RFC 2396\n    <http://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":372,"id":4211,"name":"message_template","nodeType":"Attribute","startLoc":372,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":373,"id":4212,"name":"default_args","nodeType":"Attribute","startLoc":373,"text":"default_args"},{"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":4213,"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"},{"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":393,"id":4214,"nodeType":"Class","startLoc":376,"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":392,"id":4215,"name":"message_template","nodeType":"Attribute","startLoc":392,"text":"message_template"},{"col":0,"comment":"\n    Returns `True` if *ID* is a valid XML ID.\n    ","endLoc":16,"header":"def check_id(ID)","id":4216,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":393,"id":4217,"name":"default_args","nodeType":"Attribute","startLoc":393,"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":413,"id":4218,"nodeType":"Class","startLoc":396,"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":412,"id":4219,"name":"message_template","nodeType":"Attribute","startLoc":412,"text":"message_template"},{"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":4220,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":4221,"name":"xml_escape_cdata","nodeType":"Attribute","startLoc":40,"text":"xml_escape_cdata"},{"attributeType":"null","col":4,"comment":"null","endLoc":413,"id":4222,"name":"default_args","nodeType":"Attribute","startLoc":413,"text":"default_args"},{"className":"W30","col":0,"comment":"\n    Some VOTable files write missing floating-point values in non-standard\n    ways, such as \"null\" and \"-\".  In non-pedantic mode, any non-standard\n    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":740,"id":4223,"nodeType":"Class","startLoc":727,"text":"class W30(VOTableSpecWarning):\n    \"\"\"\n    Some VOTable files write missing floating-point values in non-standard\n    ways, such as \"null\" and \"-\".  In non-pedantic mode, any non-standard\n    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',)"},{"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":4224,"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 ''"},{"attributeType":"null","col":4,"comment":"null","endLoc":739,"id":4225,"name":"message_template","nodeType":"Attribute","startLoc":739,"text":"message_template"},{"className":"W08","col":0,"comment":"\n    To avoid local-dependent number parsing differences, ``vo.table``\n    may require a string or unicode string where a numeric type may\n    make more sense.\n    ","endLoc":425,"id":4226,"nodeType":"Class","startLoc":416,"text":"class W08(VOTableSpecWarning):\n    \"\"\"\n    To avoid local-dependent number parsing differences, ``vo.table``\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":423,"id":4227,"name":"message_template","nodeType":"Attribute","startLoc":423,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":740,"id":4228,"name":"default_args","nodeType":"Attribute","startLoc":740,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":425,"id":4229,"name":"default_args","nodeType":"Attribute","startLoc":425,"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.  ``vo.table`` accepts ``id`` and emits this warning when\n    not in ``pedantic`` mode.\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":442,"id":4230,"nodeType":"Class","startLoc":428,"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.  ``vo.table`` accepts ``id`` and emits this warning when\n    not in ``pedantic`` mode.\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\""},{"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":755,"id":4231,"nodeType":"Class","startLoc":743,"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\""},{"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":4232,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":442,"id":4233,"name":"message_template","nodeType":"Attribute","startLoc":442,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":755,"id":4234,"name":"message_template","nodeType":"Attribute","startLoc":755,"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 ``vo.table``.\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":461,"id":4235,"nodeType":"Class","startLoc":445,"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 ``vo.table``.\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',)"},{"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":876,"id":4236,"nodeType":"Class","startLoc":865,"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":460,"id":4237,"name":"message_template","nodeType":"Attribute","startLoc":460,"text":"message_template"},{"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":4238,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":876,"id":4239,"name":"message_template","nodeType":"Attribute","startLoc":876,"text":"message_template"},{"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":4240,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":461,"id":4241,"name":"default_args","nodeType":"Attribute","startLoc":461,"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":990,"id":4242,"nodeType":"Class","startLoc":983,"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":989,"id":4243,"name":"message_template","nodeType":"Attribute","startLoc":989,"text":"message_template"},{"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 ``vo.table`` 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":481,"id":4244,"nodeType":"Class","startLoc":464,"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 ``vo.table`` 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\""},{"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":4245,"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 = '[^()<>@,;:\\\\\\\"/[\\\\]?= {}\\x7f]+'.format(ctrls)\n    return re.match(\n        r'(?P<type>{})/(?P<subtype>{})$'.format(token_regex, token_regex),\n        content_type) is not None"},{"attributeType":"null","col":4,"comment":"null","endLoc":481,"id":4246,"name":"message_template","nodeType":"Attribute","startLoc":481,"text":"message_template"},{"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 *pedantic mode* is off,\n    ``vo.table`` 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":501,"id":4247,"nodeType":"Class","startLoc":484,"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 *pedantic mode* is off,\n    ``vo.table`` 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":499,"id":4248,"name":"message_template","nodeType":"Attribute","startLoc":499,"text":"message_template"},{"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":4249,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":501,"id":4250,"name":"default_args","nodeType":"Attribute","startLoc":501,"text":"default_args"},{"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":4251,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":990,"id":4252,"name":"default_args","nodeType":"Attribute","startLoc":990,"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":529,"id":4253,"nodeType":"Class","startLoc":504,"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":528,"id":4254,"name":"message_template","nodeType":"Attribute","startLoc":528,"text":"message_template"},{"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":128,"header":"def validate_schema(filename, version='1.1')","id":4255,"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('{0} has version {1}, using schema 1.1'.format(\n            filename, version))\n        version = '1.1'\n\n    if version in ('1.1', '1.2', '1.3'):\n        schema_path = data.get_pkg_data_filename(\n            'data/VOTable.v{0}.xsd'.format(version))\n    else:\n        schema_path = data.get_pkg_data_filename(\n            'data/VOTable.dtd')\n\n    return validate.validate_schema(filename, schema_path)"},{"attributeType":"null","col":4,"comment":"null","endLoc":529,"id":4256,"name":"default_args","nodeType":"Attribute","startLoc":529,"text":"default_args"},{"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 *pedantic mode* is off,\n    ``vo.table`` 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":550,"id":4257,"nodeType":"Class","startLoc":535,"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 *pedantic mode* is off,\n    ``vo.table`` 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',)"},{"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":999,"id":4258,"nodeType":"Class","startLoc":993,"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":549,"id":4259,"name":"message_template","nodeType":"Attribute","startLoc":549,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":550,"id":4260,"name":"default_args","nodeType":"Attribute","startLoc":550,"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":571,"id":4261,"nodeType":"Class","startLoc":555,"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":999,"id":4262,"name":"message_template","nodeType":"Attribute","startLoc":999,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":570,"id":4263,"name":"message_template","nodeType":"Attribute","startLoc":570,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":571,"id":4264,"name":"default_args","nodeType":"Attribute","startLoc":571,"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 *pedantic mode*\n    is off, 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":589,"id":4265,"nodeType":"Class","startLoc":574,"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 *pedantic mode*\n    is off, 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":588,"id":4266,"name":"message_template","nodeType":"Attribute","startLoc":588,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":589,"id":4267,"name":"default_args","nodeType":"Attribute","startLoc":589,"text":"default_args"},{"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 *pedantic\n    mode* is off, the embedded FITS file will take precedence.\n    ","endLoc":601,"id":4268,"nodeType":"Class","startLoc":592,"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 *pedantic\n    mode* is off, 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":599,"id":4269,"name":"message_template","nodeType":"Attribute","startLoc":599,"text":"message_template"},{"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":4270,"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        \"xmllint --noout --nonet {} {}\".format(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 ..misc import signal_number_to_name\n        raise OSError(\n            \"xmllint was terminated by signal '{0}'\".format(\n                signal_number_to_name(-p.returncode)))\n\n    return p.returncode, stdout, stderr"},{"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":611,"id":4271,"nodeType":"Class","startLoc":604,"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":610,"id":4272,"name":"message_template","nodeType":"Attribute","startLoc":610,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":611,"id":4273,"name":"default_args","nodeType":"Attribute","startLoc":611,"text":"default_args"},{"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":1020,"id":4274,"nodeType":"Class","startLoc":1011,"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.\""},{"className":"W21","col":0,"comment":"\n    Unknown issues may arise using ``vo.table`` with VOTable files\n    from a version other than 1.1, 1.2 or 1.3.\n    ","endLoc":623,"id":4275,"nodeType":"Class","startLoc":614,"text":"class W21(UnimplementedWarning):\n    \"\"\"\n    Unknown issues may arise using ``vo.table`` with VOTable files\n    from a version other than 1.1, 1.2 or 1.3.\n    \"\"\"\n\n    message_template = (\n        'vo.table is designed for VOTable version 1.1, 1.2 and 1.3, but ' +\n        'this file is {}')\n    default_args = ('x',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1020,"id":4276,"name":"message_template","nodeType":"Attribute","startLoc":1020,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":620,"id":4277,"name":"message_template","nodeType":"Attribute","startLoc":620,"text":"message_template"},{"className":"W51","col":0,"comment":"\n    The integer value is out of range for the size of the field.\n    ","endLoc":1043,"id":4278,"nodeType":"Class","startLoc":1037,"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":1042,"id":4279,"name":"message_template","nodeType":"Attribute","startLoc":1042,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":623,"id":4280,"name":"default_args","nodeType":"Attribute","startLoc":623,"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":638,"id":4281,"nodeType":"Class","startLoc":626,"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":1043,"id":4282,"name":"default_args","nodeType":"Attribute","startLoc":1043,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":638,"id":4283,"name":"message_template","nodeType":"Attribute","startLoc":638,"text":"message_template"},{"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":1086,"id":4284,"nodeType":"Class","startLoc":1066,"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')"},{"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":650,"id":4285,"nodeType":"Class","startLoc":641,"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":1085,"id":4286,"name":"message_template","nodeType":"Attribute","startLoc":1085,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":649,"id":4287,"name":"message_template","nodeType":"Attribute","startLoc":649,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1086,"id":4288,"name":"default_args","nodeType":"Attribute","startLoc":1086,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":650,"id":4289,"name":"default_args","nodeType":"Attribute","startLoc":650,"text":"default_args"},{"col":4,"comment":"\n        Returns True if *name* is a valid primary name.\n        ","endLoc":47,"header":"def is_primary(self, name)","id":4290,"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":0,"comment":"\n    Given an OS signal number, returns a signal name.  If the signal\n    number is unknown, returns ``'UNKNOWN'``.\n    ","endLoc":294,"header":"def signal_number_to_name(signum)","id":4291,"name":"signal_number_to_name","nodeType":"Function","startLoc":283,"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":"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":1098,"id":4292,"nodeType":"Class","startLoc":1089,"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')"},{"className":"W24","col":0,"comment":"\n    The VO catalog database retrieved from the www is designed for a\n    newer version of vo.table.  This may cause problems or limited\n    features performing service queries.  Consider upgrading vo.table\n    to the latest version.\n    ","endLoc":661,"id":4293,"nodeType":"Class","startLoc":653,"text":"class W24(VOWarning, FutureWarning):\n    \"\"\"\n    The VO catalog database retrieved from the www is designed for a\n    newer version of vo.table.  This may cause problems or limited\n    features performing service queries.  Consider upgrading vo.table\n    to the latest version.\n    \"\"\"\n\n    message_template = \"The VO catalog database is for a later version of vo.table\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1095,"id":4294,"name":"message_template","nodeType":"Attribute","startLoc":1095,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":661,"id":4295,"name":"message_template","nodeType":"Attribute","startLoc":661,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1098,"id":4296,"name":"default_args","nodeType":"Attribute","startLoc":1098,"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":1112,"id":4297,"nodeType":"Class","startLoc":1101,"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',)"},{"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":672,"id":4298,"nodeType":"Class","startLoc":664,"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":1111,"id":4299,"name":"message_template","nodeType":"Attribute","startLoc":1111,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":671,"id":4300,"name":"message_template","nodeType":"Attribute","startLoc":671,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1112,"id":4301,"name":"default_args","nodeType":"Attribute","startLoc":1112,"text":"default_args"},{"attributeType":"null","col":34,"comment":"null","endLoc":10,"id":4302,"name":"xml_check","nodeType":"Attribute","startLoc":10,"text":"xml_check"},{"attributeType":"null","col":4,"comment":"null","endLoc":672,"id":4303,"name":"default_args","nodeType":"Attribute","startLoc":672,"text":"default_args"},{"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":1126,"id":4304,"nodeType":"Class","startLoc":1115,"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',)"},{"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":684,"id":4305,"nodeType":"Class","startLoc":675,"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":1125,"id":4306,"name":"message_template","nodeType":"Attribute","startLoc":1125,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":4307,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":683,"id":4308,"name":"message_template","nodeType":"Attribute","startLoc":683,"text":"message_template"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":4309,"name":"_token_regex","nodeType":"Attribute","startLoc":52,"text":"_token_regex"},{"col":0,"comment":"","endLoc":4,"header":"xmlutil.py#<anonymous>","id":4310,"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 ])\""},{"attributeType":"null","col":4,"comment":"null","endLoc":1126,"id":4311,"name":"default_args","nodeType":"Attribute","startLoc":1126,"text":"default_args"},{"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":1147,"id":4312,"nodeType":"Class","startLoc":1129,"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":1146,"id":4313,"name":"message_template","nodeType":"Attribute","startLoc":1146,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1147,"id":4314,"name":"default_args","nodeType":"Attribute","startLoc":1147,"text":"default_args"},{"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":1180,"id":4315,"nodeType":"Class","startLoc":1150,"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')"},{"fileName":"__init__.py","filePath":"astropy/io/votable","id":4316,"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 ... 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    pedantic = _config.ConfigItem(\n        False,\n        'When True, treat fixable violations of the VOTable spec as exceptions.',\n        aliases=['astropy.io.votable.table.pedantic'])\n\n\nconf = Conf()\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1179,"id":4317,"name":"message_template","nodeType":"Attribute","startLoc":1179,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1180,"id":4318,"name":"default_args","nodeType":"Attribute","startLoc":1180,"text":"default_args"},{"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":159,"header":"def parse_single_table(source, **kwargs)","id":4319,"name":"parse_single_table","nodeType":"Function","startLoc":142,"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()"},{"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":284,"id":4320,"nodeType":"Class","startLoc":142,"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 (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 : tuple (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 : native type corresponding to this converter\n            The value\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 : tuple (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 '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 : native type corresponding to this converter\n            The value\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : byte string\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":4,"comment":"null","endLoc":163,"header":"def __init__(self, field, config=None, pos=None)","id":4321,"name":"__init__","nodeType":"Function","startLoc":162,"text":"def __init__(self, field, config=None, pos=None):\n        pass"},{"col":4,"comment":"null","endLoc":167,"header":"@staticmethod\n    def _parse_length(read)","id":4322,"name":"_parse_length","nodeType":"Function","startLoc":165,"text":"@staticmethod\n    def _parse_length(read):\n        return struct_unpack(\">I\", read(4))[0]"},{"col":4,"comment":"\n        Returns True if *name* is a valid secondary name.\n        ","endLoc":53,"header":"def is_secondary(self, name)","id":4323,"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":0,"comment":"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : str or readable file-like object\n        Path to a VOTABLE_ xml file or pathlib.path\n        object having Path to a VOTABLE_ xml file.\n\n    output : writable file-like object, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\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":315,"header":"def validate(source, output=None, xmllint=False, filename=None)","id":4324,"name":"validate","nodeType":"Function","startLoc":191,"text":"def validate(source, output=None, xmllint=False, filename=None):\n    \"\"\"\n    Prints a validation report for the given file.\n\n    Parameters\n    ----------\n    source : str or readable file-like object\n        Path to a VOTABLE_ xml file or pathlib.path\n        object having Path to a VOTABLE_ xml file.\n\n    output : writable file-like object, optional\n        Where to output the report.  Defaults to ``sys.stdout``.\n        If `None`, the output will be returned as a string.\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 ...utils.console import print_code_line, color_print\n\n    if output is None:\n        output = sys.stdout\n\n    return_as_str = False\n    if output is None:\n        output = io.StringIO()\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, pedantic=False, 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(\"Validation report for {0}\\n\\n\".format(filename))\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                    '{0:d}: '.format(w['nline']), '',\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 ...utils.xml import validate\n\n        if votable is None:\n            version = \"1.1\"\n        else:\n            version = votable.version\n        success, stdout, stderr = validate.validate_schema(\n            filename, version)\n\n        if success != 0:\n            output.write(\n                'xmllint schema violations:\\n\\n')\n            output.write(stderr)\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":684,"id":4325,"name":"default_args","nodeType":"Attribute","startLoc":684,"text":"default_args"},{"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":4326,"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":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":388,"header":"def reset_vo_warnings()","id":4327,"name":"reset_vo_warnings","nodeType":"Function","startLoc":370,"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        if hasattr(module, '__warningregistry__'):\n            del module.__warningregistry__"},{"col":4,"comment":"\n        Returns the standard capitalization form of the given name.\n        ","endLoc":66,"header":"def normalize_capitalization(self, name)","id":4328,"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()]"},{"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":57,"id":4329,"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                \"homogeneous list must contain only objects of \"\n                \"type '{}'\".format(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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":26,"id":4330,"name":"_secondary","nodeType":"Attribute","startLoc":26,"text":"self._secondary"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":4331,"name":"_capitalization","nodeType":"Attribute","startLoc":28,"text":"self._capitalization"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":4332,"name":"_descriptions","nodeType":"Attribute","startLoc":27,"text":"self._descriptions"},{"attributeType":"null","col":8,"comment":"null","endLoc":25,"id":4333,"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 : *ucd* is invalid\n    ","endLoc":160,"header":"def parse_ucd(ucd, check_controlled_vocabulary=False, has_colon=False)","id":4334,"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 : *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(\"UCD has invalid character '{}' in '{}'\".format(\n                m.group(0), ucd))\n\n    word_component_re = r'[A-Za-z0-9][A-Za-z0-9\\-_]*'\n    word_re = r'{}(\\.{})*'.format(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(\"Invalid namespace '{}'\".format(ns))\n            ns = ns.lower()\n        elif colon_count > 1:\n            raise ValueError(\"Too many colons in '{}'\".format(word))\n        else:\n            ns = 'ivoa'\n\n        if not re.match(word_re, word):\n            raise ValueError(\"Invalid word '{}'\".format(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                            \"Secondary word '{}' is not valid as a primary \"\n                            \"word\".format(word))\n                    else:\n                        raise ValueError(\"Unknown word '{}'\".format(word))\n            else:\n                if not _ucd_singleton.is_secondary(word):\n                    if _ucd_singleton.is_primary(word):\n                        raise ValueError(\n                            \"Primary word '{}' is not valid as a secondary \"\n                            \"word\".format(word))\n                    else:\n                        raise ValueError(\"Unknown word '{}'\".format(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"},{"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":4335,"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)"},{"col":4,"comment":"null","endLoc":57,"header":"def extend(self, x)","id":4336,"name":"extend","nodeType":"Function","startLoc":54,"text":"def extend(self, x):\n        for item in x:\n            self._assert(item)\n            super().append(item)"},{"col":4,"comment":"null","endLoc":31,"header":"def _assert(self, x)","id":4337,"name":"_assert","nodeType":"Function","startLoc":27,"text":"def _assert(self, x):\n        if not isinstance(x, self._types):\n            raise TypeError(\n                \"homogeneous list must contain only objects of \"\n                \"type '{}'\".format(self._types))"},{"col":4,"comment":"null","endLoc":35,"header":"def __iadd__(self, other)","id":4338,"name":"__iadd__","nodeType":"Function","startLoc":33,"text":"def __iadd__(self, other):\n        self.extend(other)\n        return self"},{"col":4,"comment":"null","endLoc":44,"header":"def __setitem__(self, idx, value)","id":4339,"name":"__setitem__","nodeType":"Function","startLoc":37,"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)"},{"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":697,"id":4340,"nodeType":"Class","startLoc":687,"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":697,"id":4341,"name":"message_template","nodeType":"Attribute","startLoc":697,"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":709,"id":4342,"nodeType":"Class","startLoc":700,"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":708,"id":4343,"name":"message_template","nodeType":"Attribute","startLoc":708,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":709,"id":4344,"name":"default_args","nodeType":"Attribute","startLoc":709,"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":724,"id":4345,"nodeType":"Class","startLoc":712,"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":723,"id":4346,"name":"message_template","nodeType":"Attribute","startLoc":723,"text":"message_template"},{"col":4,"comment":"null","endLoc":171,"header":"@staticmethod\n    def _write_length(length)","id":4347,"name":"_write_length","nodeType":"Function","startLoc":169,"text":"@staticmethod\n    def _write_length(length):\n        return struct_pack(\">I\", int(length))"},{"attributeType":"null","col":4,"comment":"null","endLoc":724,"id":4348,"name":"default_args","nodeType":"Attribute","startLoc":724,"text":"default_args"},{"col":4,"comment":"\n        Returns True when the field can be completely empty.\n        ","endLoc":177,"header":"def supports_empty_values(self, config)","id":4349,"name":"supports_empty_values","nodeType":"Function","startLoc":173,"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')"},{"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":780,"id":4350,"nodeType":"Class","startLoc":758,"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":779,"id":4351,"name":"message_template","nodeType":"Attribute","startLoc":779,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":780,"id":4352,"name":"default_args","nodeType":"Attribute","startLoc":780,"text":"default_args"},{"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 (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        ","endLoc":196,"header":"def parse(self, value, config=None, pos=None)","id":4353,"name":"parse","nodeType":"Function","startLoc":179,"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 (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 : tuple (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        ","endLoc":216,"header":"def parse_scalar(self, value, config=None, pos=None)","id":4354,"name":"parse_scalar","nodeType":"Function","startLoc":198,"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 : tuple (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)"},{"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":796,"id":4355,"nodeType":"Class","startLoc":783,"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":795,"id":4356,"name":"message_template","nodeType":"Attribute","startLoc":795,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":796,"id":4357,"name":"default_args","nodeType":"Attribute","startLoc":796,"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":807,"id":4358,"nodeType":"Class","startLoc":799,"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":806,"id":4359,"name":"message_template","nodeType":"Attribute","startLoc":806,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":807,"id":4360,"name":"default_args","nodeType":"Attribute","startLoc":807,"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":822,"id":4361,"nodeType":"Class","startLoc":810,"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":821,"id":4362,"name":"message_template","nodeType":"Attribute","startLoc":821,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":822,"id":4363,"name":"default_args","nodeType":"Attribute","startLoc":822,"text":"default_args"},{"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 : native type corresponding to this converter\n            The value\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":238,"header":"def output(self, value, mask)","id":4364,"name":"output","nodeType":"Function","startLoc":218,"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 : native type corresponding to this converter\n            The value\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.\")"},{"col":4,"comment":"null","endLoc":48,"header":"def append(self, x)","id":4365,"name":"append","nodeType":"Function","startLoc":46,"text":"def append(self, x):\n        self._assert(x)\n        return super().append(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 : tuple (value, mask)\n            The value as a Numpy array or scalar, and *mask* is True\n            if the value is missing.\n        ","endLoc":260,"header":"def binparse(self, read)","id":4366,"name":"binparse","nodeType":"Function","startLoc":240,"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 : tuple (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 'binparse' method.\")"},{"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":837,"id":4367,"nodeType":"Class","startLoc":825,"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',)"},{"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 : native type corresponding to this converter\n            The value\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : byte string\n            The binary representation of the value, suitable for\n            serialization in the BINARY_ format.\n        ","endLoc":284,"header":"def binoutput(self, value, mask)","id":4368,"name":"binoutput","nodeType":"Function","startLoc":262,"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 : native type corresponding to this converter\n            The value\n\n        mask : bool\n            If `True`, will return the string representation of a\n            masked value.\n\n        Returns\n        -------\n        bytes : byte string\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.\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":836,"id":4369,"name":"message_template","nodeType":"Attribute","startLoc":836,"text":"message_template"},{"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":366,"id":4370,"nodeType":"Class","startLoc":287,"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        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 = 'S{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize)\n\n        if config.get('pedantic'):\n            self.parse = self._ascii_parse\n        else:\n            self.parse = self._str_parse\n\n    def supports_empty_values(self, config):\n        return True\n\n    def _ascii_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        return value.encode('ascii'), False\n\n    def _str_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        return value.encode('utf-8'), False\n\n    def output(self, value, mask):\n        if mask:\n            return ''\n        if not isinstance(value, str):\n            value = value.decode('ascii')\n        return xml_escape_cdata(value)\n\n    def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length), 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        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        return self._write_length(len(value)) + value\n\n    def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\n        return struct_pack(self._struct_format, value)"},{"col":4,"comment":"null","endLoc":325,"header":"def __init__(self, field, config=None, pos=None)","id":4371,"name":"__init__","nodeType":"Function","startLoc":295,"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        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 = 'S{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize)\n\n        if config.get('pedantic'):\n            self.parse = self._ascii_parse\n        else:\n            self.parse = self._str_parse"},{"col":4,"comment":"null","endLoc":52,"header":"def insert(self, i, x)","id":4372,"name":"insert","nodeType":"Function","startLoc":50,"text":"def insert(self, i, x):\n        self._assert(x)\n        return super().insert(i, x)"},{"attributeType":"null","col":4,"comment":"null","endLoc":837,"id":4373,"name":"default_args","nodeType":"Attribute","startLoc":837,"text":"default_args"},{"className":"W37","col":0,"comment":"\n    The 3 datatypes defined in the VOTable specification and supported by\n    vo.table 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":852,"id":4374,"nodeType":"Class","startLoc":840,"text":"class W37(UnimplementedWarning):\n    \"\"\"\n    The 3 datatypes defined in the VOTable specification and supported by\n    vo.table 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":851,"id":4375,"name":"message_template","nodeType":"Attribute","startLoc":851,"text":"message_template"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":4376,"name":"_types","nodeType":"Attribute","startLoc":23,"text":"self._types"},{"attributeType":"null","col":4,"comment":"null","endLoc":852,"id":4377,"name":"default_args","nodeType":"Attribute","startLoc":852,"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":862,"id":4378,"nodeType":"Class","startLoc":855,"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":861,"id":4379,"name":"message_template","nodeType":"Attribute","startLoc":861,"text":"message_template"},{"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":348,"id":4380,"nodeType":"Class","startLoc":44,"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 object.\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(\"<{}\".format(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(\" {}=\\\"{}\\\"\".format(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        `http://bleach.readthedocs.io/en/latest/clean.html <bleach>`_ 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=\"http://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            if HAS_BLEACH:\n                if clean_kwargs is None:\n                    clean_kwargs = {}\n                self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n            else:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\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(\"<!-- {} -->\\n\".format(self.xml_escape_cdata(comment)))\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(\"unbalanced end({})\".format(tag))\n            if tag != self._tags[-1]:\n                raise ValueError(\"expected end({}), got {}\".format(\n                        self._tags[-1], 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(\"</{}>\\n\".format(tag))\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":3251,"header":"def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.3\")","id":4381,"name":"__init__","nodeType":"Function","startLoc":3230,"text":"def __init__(self, ID=None, id=None, config=None, pos=None, version=\"1.3\"):\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._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 not in (\"1.0\", \"1.1\", \"1.2\", \"1.3\"):\n            raise ValueError(\"'version' should be one of '1.0', '1.1', \"\n                             \"'1.2', or '1.3'\")\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":238,"header":"def comment(self, comment)","id":4382,"name":"comment","nodeType":"Function","startLoc":227,"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(\"<!-- {} -->\\n\".format(self.xml_escape_cdata(comment)))"},{"attributeType":"null","col":4,"comment":"null","endLoc":862,"id":4383,"name":"default_args","nodeType":"Attribute","startLoc":862,"text":"default_args"},{"className":"W40","col":0,"comment":"\n    This is a terrible hack to support Simple Image Access Protocol\n    results from `archive.noao.edu <http://archive.noao.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":889,"id":4384,"nodeType":"Class","startLoc":879,"text":"class W40(VOTableSpecWarning):\n    \"\"\"\n    This is a terrible hack to support Simple Image Access Protocol\n    results from `archive.noao.edu <http://archive.noao.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":889,"id":4385,"name":"message_template","nodeType":"Attribute","startLoc":889,"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":911,"id":4386,"nodeType":"Class","startLoc":892,"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":908,"id":4387,"name":"message_template","nodeType":"Attribute","startLoc":908,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":911,"id":4388,"name":"default_args","nodeType":"Attribute","startLoc":911,"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":925,"id":4389,"nodeType":"Class","startLoc":914,"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":925,"id":4390,"name":"message_template","nodeType":"Attribute","startLoc":925,"text":"message_template"},{"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 : readable file-like object, read function or str path\n\n    Returns\n    -------\n    lines : list of unicode\n    ","endLoc":205,"header":"def xml_readlines(source)","id":4391,"name":"xml_readlines","nodeType":"Function","startLoc":186,"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 : readable file-like object, read function or str path\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":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":293,"header":"def close(self, id)","id":4392,"name":"close","nodeType":"Function","startLoc":282,"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()"},{"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":938,"id":4393,"nodeType":"Class","startLoc":928,"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',)"},{"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":304,"header":"def element(self, tag, text=None, wrap=False, attrib={}, **extra)","id":4394,"name":"element","nodeType":"Function","startLoc":295,"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)"},{"col":0,"comment":"\n    Determine the encoding of an XML file by reading its header.\n\n    Parameters\n    ----------\n    source : readable file-like object, read function or str path\n\n    Returns\n    -------\n    encoding : str\n    ","endLoc":183,"header":"def get_xml_encoding(source)","id":4395,"name":"get_xml_encoding","nodeType":"Function","startLoc":165,"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 : readable file-like object, read function or str path\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'"},{"attributeType":"null","col":4,"comment":"null","endLoc":937,"id":4396,"name":"message_template","nodeType":"Attribute","startLoc":937,"text":"message_template"},{"col":4,"comment":"null","endLoc":307,"header":"def flush(self)","id":4397,"name":"flush","nodeType":"Function","startLoc":306,"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":314,"header":"def get_indentation(self)","id":4398,"name":"get_indentation","nodeType":"Function","startLoc":309,"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":348,"header":"@staticmethod\n    def object_attrs(obj, attrs)","id":4399,"name":"object_attrs","nodeType":"Function","startLoc":323,"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":"null","col":8,"comment":"null","endLoc":75,"id":4400,"name":"_data","nodeType":"Attribute","startLoc":75,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":79,"id":4401,"name":"xml_escape","nodeType":"Attribute","startLoc":79,"text":"self.xml_escape"},{"col":4,"comment":"null","endLoc":328,"header":"def supports_empty_values(self, config)","id":4402,"name":"supports_empty_values","nodeType":"Function","startLoc":327,"text":"def supports_empty_values(self, config):\n        return True"},{"col":4,"comment":"null","endLoc":333,"header":"def _ascii_parse(self, value, config=None, pos=None)","id":4403,"name":"_ascii_parse","nodeType":"Function","startLoc":330,"text":"def _ascii_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        return value.encode('ascii'), False"},{"attributeType":"null","col":12,"comment":"null","endLoc":72,"id":4404,"name":"flush","nodeType":"Attribute","startLoc":72,"text":"self.flush"},{"attributeType":"null","col":4,"comment":"null","endLoc":938,"id":4405,"name":"default_args","nodeType":"Attribute","startLoc":938,"text":"default_args"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":4406,"name":"_open","nodeType":"Attribute","startLoc":73,"text":"self._open"},{"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":957,"id":4407,"nodeType":"Class","startLoc":941,"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":8,"comment":"null","endLoc":74,"id":4408,"name":"_tags","nodeType":"Attribute","startLoc":74,"text":"self._tags"},{"col":0,"comment":"\n    Parses the vo warning string back into its parts.\n    ","endLoc":180,"header":"def parse_vowarning(line)","id":4409,"name":"parse_vowarning","nodeType":"Function","startLoc":140,"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'] = \"io/votable/api_exceptions.html#{0}\".format(\n                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"},{"col":4,"comment":"null","endLoc":338,"header":"def _str_parse(self, value, config=None, pos=None)","id":4410,"name":"_str_parse","nodeType":"Function","startLoc":335,"text":"def _str_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        return value.encode('utf-8'), False"},{"attributeType":"null","col":4,"comment":"null","endLoc":956,"id":4411,"name":"message_template","nodeType":"Attribute","startLoc":956,"text":"message_template"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":4412,"name":"xml_escape_cdata","nodeType":"Attribute","startLoc":78,"text":"self.xml_escape_cdata"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":4413,"name":"write","nodeType":"Attribute","startLoc":70,"text":"self.write"},{"attributeType":"null","col":8,"comment":"null","endLoc":76,"id":4414,"name":"_indentation","nodeType":"Attribute","startLoc":76,"text":"self._indentation"},{"attributeType":"null","col":4,"comment":"null","endLoc":957,"id":4415,"name":"default_args","nodeType":"Attribute","startLoc":957,"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":980,"id":4416,"nodeType":"Class","startLoc":960,"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',)"},{"className":"InheritDocstrings","col":0,"comment":"\n    This metaclass makes methods of a class automatically have their\n    docstrings filled in from the methods they override in the base\n    class.\n\n    If the class uses multiple inheritance, the docstring will be\n    chosen from the first class in the bases list, in the same way as\n    methods are normally resolved in Python.  If this results in\n    selecting the wrong docstring, the docstring will need to be\n    explicitly included on the method.\n\n    For example::\n\n        >>> from astropy.utils.misc import InheritDocstrings\n        >>> class A(metaclass=InheritDocstrings):\n        ...     def wiggle(self):\n        ...         \"Wiggle the thingamajig\"\n        ...         pass\n        >>> class B(A):\n        ...     def wiggle(self):\n        ...         pass\n        >>> B.wiggle.__doc__\n        u'Wiggle the thingamajig'\n    ","endLoc":540,"id":4417,"nodeType":"Class","startLoc":497,"text":"class InheritDocstrings(type):\n    \"\"\"\n    This metaclass makes methods of a class automatically have their\n    docstrings filled in from the methods they override in the base\n    class.\n\n    If the class uses multiple inheritance, the docstring will be\n    chosen from the first class in the bases list, in the same way as\n    methods are normally resolved in Python.  If this results in\n    selecting the wrong docstring, the docstring will need to be\n    explicitly included on the method.\n\n    For example::\n\n        >>> from astropy.utils.misc import InheritDocstrings\n        >>> class A(metaclass=InheritDocstrings):\n        ...     def wiggle(self):\n        ...         \"Wiggle the thingamajig\"\n        ...         pass\n        >>> class B(A):\n        ...     def wiggle(self):\n        ...         pass\n        >>> B.wiggle.__doc__\n        u'Wiggle the thingamajig'\n    \"\"\"\n\n    def __init__(cls, name, bases, dct):\n        def is_public_member(key):\n            return (\n                (key.startswith('__') and key.endswith('__')\n                 and len(key) > 4) or\n                not key.startswith('_'))\n\n        for key, val in dct.items():\n            if (inspect.isfunction(val) and\n                is_public_member(key) and\n                val.__doc__ is None):\n                for base in cls.__mro__[1:]:\n                    super_method = getattr(base, key, None)\n                    if super_method is not None:\n                        val.__doc__ = super_method.__doc__\n                        break\n\n        super().__init__(name, bases, dct)"},{"attributeType":"null","col":4,"comment":"null","endLoc":979,"id":4418,"name":"message_template","nodeType":"Attribute","startLoc":979,"text":"message_template"},{"col":4,"comment":"null","endLoc":540,"header":"def __init__(cls, name, bases, dct)","id":4419,"name":"__init__","nodeType":"Function","startLoc":523,"text":"def __init__(cls, name, bases, dct):\n        def is_public_member(key):\n            return (\n                (key.startswith('__') and key.endswith('__')\n                 and len(key) > 4) or\n                not key.startswith('_'))\n\n        for key, val in dct.items():\n            if (inspect.isfunction(val) and\n                is_public_member(key) and\n                val.__doc__ is None):\n                for base in cls.__mro__[1:]:\n                    super_method = getattr(base, key, None)\n                    if super_method is not None:\n                        val.__doc__ = super_method.__doc__\n                        break\n\n        super().__init__(name, bases, dct)"},{"attributeType":"null","col":4,"comment":"null","endLoc":980,"id":4420,"name":"default_args","nodeType":"Attribute","startLoc":980,"text":"default_args"},{"className":"W48","col":0,"comment":"\n    The attribute is not defined in the specification.\n    ","endLoc":1008,"id":4421,"nodeType":"Class","startLoc":1002,"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":4,"comment":"null","endLoc":1007,"id":4422,"name":"message_template","nodeType":"Attribute","startLoc":1007,"text":"message_template"},{"col":4,"comment":"null","endLoc":345,"header":"def output(self, value, mask)","id":4423,"name":"output","nodeType":"Function","startLoc":340,"text":"def output(self, value, mask):\n        if mask:\n            return ''\n        if not isinstance(value, str):\n            value = value.decode('ascii')\n        return xml_escape_cdata(value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1008,"id":4425,"name":"default_args","nodeType":"Attribute","startLoc":1008,"text":"default_args"},{"col":4,"comment":"null","endLoc":349,"header":"def _binparse_var(self, read)","id":4426,"name":"_binparse_var","nodeType":"Function","startLoc":347,"text":"def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length), False"},{"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":116,"header":"def vo_reraise(exc, config=None, pos=None, additional='')","id":4427,"name":"vo_reraise","nodeType":"Function","startLoc":101,"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"},{"className":"W50","col":0,"comment":"\n    Invalid unit string as defined in the `Standards for Astronomical\n    Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_.\n\n    Consider passing an explicit ``unit_format`` parameter if the units\n    in this file conform to another specification.\n    ","endLoc":1034,"id":4428,"nodeType":"Class","startLoc":1023,"text":"class W50(VOTableSpecWarning):\n    \"\"\"\n    Invalid unit string as defined in the `Standards for Astronomical\n    Catalogues, Version 2.0\n    <http://cdsarc.u-strasbg.fr/doc/catstd-3.2.htx>`_.\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',)"},{"col":0,"comment":"null","endLoc":132,"header":"def warn_unknown_attrs(element, attrs, config, pos, good_attr=[], stacklevel=1)","id":4429,"name":"warn_unknown_attrs","nodeType":"Function","startLoc":129,"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":4,"comment":"null","endLoc":1033,"id":4430,"name":"message_template","nodeType":"Attribute","startLoc":1033,"text":"message_template"},{"col":4,"comment":"null","endLoc":356,"header":"def _binparse_fixed(self, read)","id":4431,"name":"_binparse_fixed","nodeType":"Function","startLoc":351,"text":"def _binparse_fixed(self, read):\n        s = struct_unpack(self._struct_format, read(self.arraysize))[0]\n        end = s.find(_zero_byte)\n        if end != -1:\n            return s[:end], False\n        return s, False"},{"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":194,"header":"def check_ucd(ucd, check_controlled_vocabulary=False, has_colon=False)","id":4432,"name":"check_ucd","nodeType":"Function","startLoc":163,"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":"\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 : writeable file-like object, 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":1019,"header":"def print_code_line(line, col=None, file=None, tabwidth=8, width=70)","id":4433,"name":"print_code_line","nodeType":"Function","startLoc":944,"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 : writeable file-like object, 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 lenght.')\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)"},{"col":4,"comment":"null","endLoc":361,"header":"def _binoutput_var(self, value, mask)","id":4434,"name":"_binoutput_var","nodeType":"Function","startLoc":358,"text":"def _binoutput_var(self, value, mask):\n        if mask or value is None or value == '':\n            return _zero_int\n        return self._write_length(len(value)) + value"},{"attributeType":"null","col":4,"comment":"null","endLoc":1034,"id":4435,"name":"default_args","nodeType":"Attribute","startLoc":1034,"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":1054,"id":4436,"nodeType":"Class","startLoc":1046,"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":1052,"id":4437,"name":"message_template","nodeType":"Attribute","startLoc":1052,"text":"message_template"},{"className":"W53","col":0,"comment":"\n    The VOTABLE element must contain at least one RESOURCE element.\n    ","endLoc":1063,"id":4438,"nodeType":"Class","startLoc":1057,"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":1062,"id":4439,"name":"message_template","nodeType":"Attribute","startLoc":1062,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1054,"id":4440,"name":"default_args","nodeType":"Attribute","startLoc":1054,"text":"default_args"},{"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":1197,"id":4441,"nodeType":"Class","startLoc":1185,"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":4,"comment":"null","endLoc":1063,"id":4442,"name":"default_args","nodeType":"Attribute","startLoc":1063,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1196,"id":4443,"name":"message_template","nodeType":"Attribute","startLoc":1196,"text":"message_template"},{"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":1212,"id":4444,"nodeType":"Class","startLoc":1200,"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":1211,"id":4445,"name":"message_template","nodeType":"Attribute","startLoc":1211,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1197,"id":4446,"name":"default_args","nodeType":"Attribute","startLoc":1197,"text":"default_args"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":4447,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"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":1227,"id":4448,"nodeType":"Class","startLoc":1215,"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":"None","col":0,"comment":"null","endLoc":69,"id":4449,"name":"_ucd_singleton","nodeType":"Attribute","startLoc":69,"text":"_ucd_singleton"},{"col":0,"comment":"","endLoc":4,"header":"ucd.py#<anonymous>","id":4450,"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":1212,"id":4451,"name":"default_args","nodeType":"Attribute","startLoc":1212,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1226,"id":4452,"name":"message_template","nodeType":"Attribute","startLoc":1226,"text":"message_template"},{"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":1249,"id":4453,"nodeType":"Class","startLoc":1230,"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',)"},{"col":4,"comment":"null","endLoc":366,"header":"def _binoutput_fixed(self, value, mask)","id":4454,"name":"_binoutput_fixed","nodeType":"Function","startLoc":363,"text":"def _binoutput_fixed(self, value, mask):\n        if mask:\n            value = _empty_bytes\n        return struct_pack(self._struct_format, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1227,"id":4455,"name":"default_args","nodeType":"Attribute","startLoc":1227,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1248,"id":4456,"name":"message_template","nodeType":"Attribute","startLoc":1248,"text":"message_template"},{"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":1265,"id":4457,"nodeType":"Class","startLoc":1252,"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":1249,"id":4458,"name":"default_args","nodeType":"Attribute","startLoc":1249,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":293,"id":4459,"name":"default","nodeType":"Attribute","startLoc":293,"text":"default"},{"attributeType":"null","col":4,"comment":"null","endLoc":1264,"id":4460,"name":"message_template","nodeType":"Attribute","startLoc":1264,"text":"message_template"},{"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":1307,"id":4461,"nodeType":"Class","startLoc":1268,"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":1306,"id":4462,"name":"message_template","nodeType":"Attribute","startLoc":1306,"text":"message_template"},{"attributeType":"function","col":12,"comment":"null","endLoc":318,"id":4463,"name":"binparse","nodeType":"Attribute","startLoc":318,"text":"self.binparse"},{"attributeType":"null","col":4,"comment":"null","endLoc":1307,"id":4464,"name":"default_args","nodeType":"Attribute","startLoc":1307,"text":"default_args"},{"attributeType":"null","col":4,"comment":"null","endLoc":1265,"id":4465,"name":"default_args","nodeType":"Attribute","startLoc":1265,"text":"default_args"},{"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":1333,"id":4466,"nodeType":"Class","startLoc":1323,"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":1333,"id":4467,"name":"message_template","nodeType":"Attribute","startLoc":1333,"text":"message_template"},{"attributeType":"null","col":12,"comment":"null","endLoc":320,"id":4468,"name":"_struct_format","nodeType":"Attribute","startLoc":320,"text":"self._struct_format"},{"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":1349,"id":4469,"nodeType":"Class","startLoc":1336,"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":1348,"id":4470,"name":"message_template","nodeType":"Attribute","startLoc":1348,"text":"message_template"},{"attributeType":"function","col":12,"comment":"null","endLoc":319,"id":4471,"name":"binoutput","nodeType":"Attribute","startLoc":319,"text":"self.binoutput"},{"attributeType":"null","col":4,"comment":"null","endLoc":1349,"id":4472,"name":"default_args","nodeType":"Attribute","startLoc":1349,"text":"default_args"},{"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":336,"header":"def from_table(table, table_id=None)","id":4473,"name":"from_table","nodeType":"Function","startLoc":318,"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)"},{"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":1362,"id":4474,"nodeType":"Class","startLoc":1352,"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":1362,"id":4475,"name":"message_template","nodeType":"Attribute","startLoc":1362,"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":1377,"id":4476,"nodeType":"Class","startLoc":1365,"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":1376,"id":4477,"name":"message_template","nodeType":"Attribute","startLoc":1376,"text":"message_template"},{"attributeType":"null","col":16,"comment":"null","endLoc":314,"id":4478,"name":"arraysize","nodeType":"Attribute","startLoc":314,"text":"self.arraysize"},{"attributeType":"null","col":12,"comment":"null","endLoc":317,"id":4479,"name":"format","nodeType":"Attribute","startLoc":317,"text":"self.format"},{"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":1320,"id":4480,"nodeType":"Class","startLoc":1310,"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":1377,"id":4481,"name":"default_args","nodeType":"Attribute","startLoc":1377,"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":1386,"id":4482,"nodeType":"Class","startLoc":1380,"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":"function","col":12,"comment":"null","endLoc":325,"id":4483,"name":"parse","nodeType":"Attribute","startLoc":325,"text":"self.parse"},{"attributeType":"null","col":4,"comment":"null","endLoc":1386,"id":4484,"name":"message_template","nodeType":"Attribute","startLoc":1386,"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":1396,"id":4485,"nodeType":"Class","startLoc":1389,"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":1395,"id":4486,"name":"message_template","nodeType":"Attribute","startLoc":1395,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1320,"id":4487,"name":"message_template","nodeType":"Attribute","startLoc":1320,"text":"message_template"},{"attributeType":"null","col":4,"comment":"null","endLoc":1396,"id":4488,"name":"default_args","nodeType":"Attribute","startLoc":1396,"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":1406,"id":4489,"nodeType":"Class","startLoc":1399,"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')"},{"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":430,"id":4490,"nodeType":"Class","startLoc":369,"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 = 'U{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize * 2)\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'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":1405,"id":4491,"name":"message_template","nodeType":"Attribute","startLoc":1405,"text":"message_template"},{"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":3641,"header":"@classmethod\n    def from_table(cls, table, table_id=None)","id":4492,"name":"from_table","nodeType":"Function","startLoc":3623,"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"},{"col":4,"comment":"null","endLoc":397,"header":"def __init__(self, field, config=None, pos=None)","id":4493,"name":"__init__","nodeType":"Function","startLoc":377,"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 = 'U{:d}'.format(self.arraysize)\n            self.binparse = self._binparse_fixed\n            self.binoutput = self._binoutput_fixed\n            self._struct_format = \">{:d}s\".format(self.arraysize * 2)"},{"col":0,"comment":"null","endLoc":1415,"header":"def _get_warning_and_exception_classes(prefix)","id":4494,"name":"_get_warning_and_exception_classes","nodeType":"Function","startLoc":1409,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1406,"id":4495,"name":"default_args","nodeType":"Attribute","startLoc":1406,"text":"default_args"},{"fileName":"volint.py","filePath":"astropy/io/votable","id":4496,"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":1445,"header":"def _build_doc_string()","id":4497,"name":"_build_doc_string","nodeType":"Function","startLoc":1418,"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(\".. _{}:\\n\\n\".format(name))\n            msg = \"{}: {}\".format(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":"null","endLoc":18,"header":"def main(args=None)","id":4498,"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])"},{"className":"_IDProperty","col":0,"comment":"null","endLoc":297,"id":4499,"nodeType":"Class","startLoc":281,"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":288,"header":"@property\n    def ID(self)","id":4500,"name":"ID","nodeType":"Function","startLoc":282,"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":293,"header":"@ID.setter\n    def ID(self, ID)","id":4501,"name":"ID","nodeType":"Function","startLoc":290,"text":"@ID.setter\n    def ID(self, ID):\n        xmlutil.check_id(ID, 'ID', self._config, self._pos)\n        self._ID = ID"},{"col":0,"comment":"null","endLoc":242,"header":"def resolve_id(ID, id, config=None, pos=None)","id":4502,"name":"resolve_id","nodeType":"Function","startLoc":238,"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"},{"col":4,"comment":"null","endLoc":297,"header":"@ID.deleter\n    def ID(self)","id":4503,"name":"ID","nodeType":"Function","startLoc":295,"text":"@ID.deleter\n    def ID(self):\n        self._ID = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":293,"id":4504,"name":"_ID","nodeType":"Attribute","startLoc":293,"text":"self._ID"},{"col":0,"comment":"","endLoc":4,"header":"volint.py#<anonymous>","id":4505,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nScript support for validating a VO file.\n\"\"\""},{"fileName":"connect.py","filePath":"astropy/io/votable","id":4506,"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 .. import registry as io_registry\nfrom ...table import Table\nfrom ...table.column import BaseColumn\nfrom ...units import Quantity\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 object\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    \"\"\"\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    if not isinstance(input, (VOTableFile, VOTable)):\n        input = parse(input, table_id=table_id)\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 {0}, \"\n                    'or integers less than {1}.'.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                        \"No tables with id={0} found\".format(table_id))\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 {0} is out of range. \"\n                        \"{1} 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:`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) {0} 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(\"File exists: {0}\".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":4,"comment":"null","endLoc":402,"header":"def parse(self, value, config=None, pos=None)","id":4507,"name":"parse","nodeType":"Function","startLoc":399,"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":4,"comment":"null","endLoc":407,"header":"def output(self, value, mask)","id":4508,"name":"output","nodeType":"Function","startLoc":404,"text":"def output(self, value, mask):\n        if mask:\n            return ''\n        return xml_escape_cdata(str(value))"},{"col":4,"comment":"null","endLoc":411,"header":"def _binparse_var(self, read)","id":4509,"name":"_binparse_var","nodeType":"Function","startLoc":409,"text":"def _binparse_var(self, read):\n        length = self._parse_length(read)\n        return read(length * 2).decode('utf_16_be'), False"},{"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":3641,"id":4510,"nodeType":"Class","startLoc":3219,"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.3\"):\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._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 not in (\"1.0\", \"1.1\", \"1.2\", \"1.3\"):\n            raise ValueError(\"'version' should be one of '1.0', '1.1', \"\n                             \"'1.2', or '1.3'\")\n\n        self._version = version\n\n    def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return '<VOTABLE>... {0} tables ...</VOTABLE>'.format(n_tables)\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 ('1.1', '1.2', '1.3'):\n            raise ValueError(\n                \"astropy.io.votable only supports VOTable versions \"\n                \"1.1, 1.2 and 1.3\")\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 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_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 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 ('1.1', '1.2', '1.3'):\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        correct_ns = ('http://www.ivoa.net/xml/VOTable/v{}'.format(\n                                config['version']))\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(\n                                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['version_1_1_or_later'] = \\\n            util.version_compare(config['version'], '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(config['version'], '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(config['version'], '1.3') >= 0\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\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 path or writable file-like object\n            Where to write the file.\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:`votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(\"Unknown format type '{0}'\".format(format))\n\n        kwargs = {\n            'version': self.version,\n            'version_1_1_or_later':\n                util.version_compare(self.version, '1.1') >= 0,\n            'version_1_2_or_later':\n                util.version_compare(self.version, '1.2') >= 0,\n            'version_1_3_or_later':\n                util.version_compare(self.version, '1.3') >= 0,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\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            with w.tag('VOTABLE',\n                       {'version': version,\n                        'xmlns:xsi':\n                            \"http://www.w3.org/2001/XMLSchema-instance\",\n                        'xsi:noNamespaceSchemaLocation':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version),\n                        'xmlns':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version)}):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.params,\n                                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            \"No table at index {:d} found in VOTABLE file.\".format(idx))\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_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"},{"className":"_NameProperty","col":0,"comment":"null","endLoc":313,"id":4511,"nodeType":"Class","startLoc":300,"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":304,"header":"@property\n    def name(self)","id":4512,"name":"name","nodeType":"Function","startLoc":301,"text":"@property\n    def name(self):\n        \"\"\"An optional name for the element.\"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":309,"header":"@name.setter\n    def name(self, name)","id":4513,"name":"name","nodeType":"Function","startLoc":306,"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":2997,"header":"def __init__(self, name=None, ID=None, utype=None, type='results',\n                 id=None, config=None, pos=None, **kwargs)","id":4514,"name":"__init__","nodeType":"Function","startLoc":2974,"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._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)"},{"className":"Element","col":0,"comment":"\n    A base class for all classes that represent XML elements in the\n    VOTABLE file.\n    ","endLoc":459,"id":4515,"nodeType":"Class","startLoc":406,"text":"class Element(metaclass=InheritDocstrings):\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 iterator\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 : 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\n        kwargs : dict\n            Any configuration parameters to control the output.\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":415,"header":"def _add_unknown_tag(self, iterator, tag, data, config, pos)","id":4516,"name":"_add_unknown_tag","nodeType":"Function","startLoc":414,"text":"def _add_unknown_tag(self, iterator, tag, data, config, pos):\n        warn_or_raise(W10, W10, tag, config, pos)"},{"col":4,"comment":"null","endLoc":313,"header":"@name.deleter\n    def name(self)","id":4517,"name":"name","nodeType":"Function","startLoc":311,"text":"@name.deleter\n    def name(self):\n        self._name = None"},{"col":4,"comment":"null","endLoc":418,"header":"def _ignore_add(self, iterator, tag, data, config, pos)","id":4518,"name":"_ignore_add","nodeType":"Function","startLoc":417,"text":"def _ignore_add(self, iterator, tag, data, config, pos):\n        warn_unknown_attrs(tag, data.keys(), config, pos)"},{"attributeType":"null","col":8,"comment":"null","endLoc":309,"id":4519,"name":"_name","nodeType":"Attribute","startLoc":309,"text":"self._name"},{"col":4,"comment":"null","endLoc":419,"header":"def _binparse_fixed(self, read)","id":4520,"name":"_binparse_fixed","nodeType":"Function","startLoc":413,"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":423,"header":"def _add_definitions(self, iterator, tag, data, config, pos)","id":4521,"name":"_add_definitions","nodeType":"Function","startLoc":420,"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)"},{"col":4,"comment":"null","endLoc":425,"header":"def _binoutput_var(self, value, mask)","id":4522,"name":"_binoutput_var","nodeType":"Function","startLoc":421,"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":"\n        For internal use. Parse the XML content of the children of the\n        element.\n\n        Parameters\n        ----------\n        iterator : xml iterator\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 : Element\n            Returns self as a convenience.\n        ","endLoc":445,"header":"def parse(self, iterator, config)","id":4523,"name":"parse","nodeType":"Function","startLoc":425,"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 iterator\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 : Element\n            Returns self as a convenience.\n        \"\"\"\n        raise NotImplementedError()"},{"className":"_XtypeProperty","col":0,"comment":"null","endLoc":333,"id":4524,"nodeType":"Class","startLoc":316,"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":320,"header":"@property\n    def xtype(self)","id":4525,"name":"xtype","nodeType":"Function","startLoc":317,"text":"@property\n    def xtype(self):\n        \"\"\"Extended data type information.\"\"\"\n        return self._xtype"},{"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\n        kwargs : dict\n            Any configuration parameters to control the output.\n        ","endLoc":459,"header":"def to_xml(self, w, **kwargs)","id":4526,"name":"to_xml","nodeType":"Function","startLoc":447,"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\n        kwargs : dict\n            Any configuration parameters to control the output.\n        \"\"\"\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":329,"header":"@xtype.setter\n    def xtype(self, xtype)","id":4527,"name":"xtype","nodeType":"Function","startLoc":322,"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":4,"comment":"null","endLoc":411,"id":4528,"name":"_element_name","nodeType":"Attribute","startLoc":411,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":412,"id":4529,"name":"_attr_list","nodeType":"Attribute","startLoc":412,"text":"_attr_list"},{"className":"_DescriptionProperty","col":0,"comment":"null","endLoc":401,"id":4530,"nodeType":"Class","startLoc":386,"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":393,"header":"@property\n    def description(self)","id":4531,"name":"description","nodeType":"Function","startLoc":387,"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":397,"header":"@description.setter\n    def description(self, description)","id":4532,"name":"description","nodeType":"Function","startLoc":395,"text":"@description.setter\n    def description(self, description):\n        self._description = description"},{"col":4,"comment":"null","endLoc":401,"header":"@description.deleter\n    def description(self)","id":4533,"name":"description","nodeType":"Function","startLoc":399,"text":"@description.deleter\n    def description(self):\n        self._description = None"},{"attributeType":"null","col":8,"comment":"null","endLoc":397,"id":4534,"name":"_description","nodeType":"Attribute","startLoc":397,"text":"self._description"},{"col":4,"comment":"null","endLoc":3402,"header":"def parse(self, iterator, config)","id":4535,"name":"parse","nodeType":"Function","startLoc":3341,"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 ('1.1', '1.2', '1.3'):\n                            vo_warn(W21, config['version'], config, pos)\n\n                    if 'xmlns' in data:\n                        correct_ns = ('http://www.ivoa.net/xml/VOTable/v{}'.format(\n                                config['version']))\n                        if data['xmlns'] != correct_ns:\n                            vo_warn(\n                                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['version_1_1_or_later'] = \\\n            util.version_compare(config['version'], '1.1') >= 0\n        config['version_1_2_or_later'] = \\\n            util.version_compare(config['version'], '1.2') >= 0\n        config['version_1_3_or_later'] = \\\n            util.version_compare(config['version'], '1.3') >= 0\n\n        tag_mapping = {\n            'PARAM': self._add_param,\n            'RESOURCE': self._add_resource,\n            'COOSYS': self._add_coosys,\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":430,"header":"def _binoutput_fixed(self, value, mask)","id":4536,"name":"_binoutput_fixed","nodeType":"Function","startLoc":427,"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":4,"comment":"null","endLoc":3255,"header":"def __repr__(self)","id":4537,"name":"__repr__","nodeType":"Function","startLoc":3253,"text":"def __repr__(self):\n        n_tables = len(list(self.iter_tables()))\n        return '<VOTABLE>... {0} tables ...</VOTABLE>'.format(n_tables)"},{"attributeType":"null","col":4,"comment":"null","endLoc":375,"id":4538,"name":"default","nodeType":"Attribute","startLoc":375,"text":"default"},{"attributeType":"function","col":12,"comment":"null","endLoc":395,"id":4539,"name":"binparse","nodeType":"Attribute","startLoc":395,"text":"self.binparse"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":4541,"name":"__all__","nodeType":"Attribute","startLoc":46,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":4542,"name":"MAX_WARNINGS","nodeType":"Attribute","startLoc":53,"text":"MAX_WARNINGS"},{"attributeType":"null","col":0,"comment":"null","endLoc":135,"id":4543,"name":"_warning_pat","nodeType":"Attribute","startLoc":135,"text":"_warning_pat"},{"attributeType":"null","col":4,"comment":"null","endLoc":1449,"id":4544,"name":"__doc__","nodeType":"Attribute","startLoc":1449,"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":235,"header":"def check_string(string, attr_name, config=None, pos=None)","id":4545,"name":"check_string","nodeType":"Function","startLoc":215,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":397,"id":4546,"name":"_struct_format","nodeType":"Attribute","startLoc":397,"text":"self._struct_format"},{"col":4,"comment":"null","endLoc":333,"header":"@xtype.deleter\n    def xtype(self)","id":4547,"name":"xtype","nodeType":"Function","startLoc":331,"text":"@xtype.deleter\n    def xtype(self):\n        self._xtype = None"},{"attributeType":"None","col":8,"comment":"null","endLoc":329,"id":4548,"name":"_xtype","nodeType":"Attribute","startLoc":329,"text":"self._xtype"},{"attributeType":"function","col":12,"comment":"null","endLoc":396,"id":4549,"name":"binoutput","nodeType":"Attribute","startLoc":396,"text":"self.binoutput"},{"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":3483,"header":"def iter_tables(self)","id":4550,"name":"iter_tables","nodeType":"Function","startLoc":3476,"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"},{"attributeType":"null","col":25,"comment":"null","endLoc":1451,"id":4551,"name":"x","nodeType":"Attribute","startLoc":1451,"text":"x"},{"col":4,"comment":"\n        The version of the VOTable specification that the file uses.\n        ","endLoc":3262,"header":"@property\n    def version(self)","id":4552,"name":"version","nodeType":"Function","startLoc":3257,"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":3271,"header":"@version.setter\n    def version(self, version)","id":4553,"name":"version","nodeType":"Function","startLoc":3264,"text":"@version.setter\n    def version(self, version):\n        version = str(version)\n        if version not in ('1.1', '1.2', '1.3'):\n            raise ValueError(\n                \"astropy.io.votable only supports VOTable versions \"\n                \"1.1, 1.2 and 1.3\")\n        self._version = version"},{"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 object\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:`votable-serialization`.\n    ","endLoc":188,"header":"def writeto(table, file, tabledata_format=None)","id":4554,"name":"writeto","nodeType":"Function","startLoc":162,"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 object\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:`votable-serialization`.\n    \"\"\"\n    from ...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":"\n        A list of coordinate system descriptions for the file.  Must\n        contain only `CooSys` objects.\n        ","endLoc":3279,"header":"@property\n    def coordinate_systems(self)","id":4555,"name":"coordinate_systems","nodeType":"Function","startLoc":3273,"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 parameters (constant-valued columns) that apply to\n        the entire file.  Must contain only `Param` objects.\n        ","endLoc":3287,"header":"@property\n    def params(self)","id":4556,"name":"params","nodeType":"Function","startLoc":3281,"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":3295,"header":"@property\n    def infos(self)","id":4557,"name":"infos","nodeType":"Function","startLoc":3289,"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":3303,"header":"@property\n    def resources(self)","id":4558,"name":"resources","nodeType":"Function","startLoc":3297,"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":3312,"header":"@property\n    def groups(self)","id":4559,"name":"groups","nodeType":"Function","startLoc":3305,"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":3317,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":4560,"name":"_add_param","nodeType":"Function","startLoc":3314,"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)"},{"attributeType":"null","col":25,"comment":"null","endLoc":1452,"id":4561,"name":"x","nodeType":"Attribute","startLoc":1452,"text":"x"},{"className":"_UtypeProperty","col":0,"comment":"null","endLoc":357,"id":4562,"nodeType":"Class","startLoc":336,"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":342,"header":"@property\n    def utype(self)","id":4563,"name":"utype","nodeType":"Function","startLoc":339,"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":353,"header":"@utype.setter\n    def utype(self, utype)","id":4564,"name":"utype","nodeType":"Function","startLoc":344,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":391,"id":4565,"name":"arraysize","nodeType":"Attribute","startLoc":391,"text":"self.arraysize"},{"attributeType":"null","col":12,"comment":"null","endLoc":394,"id":4566,"name":"format","nodeType":"Attribute","startLoc":394,"text":"self.format"},{"className":"Array","col":0,"comment":"\n    Handles both fixed and variable-lengths arrays.\n    ","endLoc":458,"id":4567,"nodeType":"Class","startLoc":433,"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('pedantic'):\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":445,"header":"def __init__(self, field, config=None, pos=None)","id":4568,"name":"__init__","nodeType":"Function","startLoc":438,"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('pedantic'):\n            self._splitter = self._splitter_pedantic\n        else:\n            self._splitter = self._splitter_lax"},{"col":0,"comment":"","endLoc":32,"header":"exceptions.py#<anonymous>","id":4569,"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.  Most of these are of the type\n    `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 vo.table\n    when the file does not conform to spec.  Other exceptions may be\n    raised due to unforeseen cases or bugs in vo.table itself.\n\n{exceptions}\n\"\"\"\n\n__all__ = [\n    'warn_or_raise', 'vo_raise', 'vo_reraise', 'vo_warn',\n    'warn_unknown_attrs', 'parse_vowarning', 'VOWarning',\n    'VOTableChangeWarning', 'VOTableSpecWarning',\n    'UnimplementedWarning', 'IOWarning', 'VOTableSpecError']\n\nMAX_WARNINGS = 10\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":357,"header":"@utype.deleter\n    def utype(self)","id":4570,"name":"utype","nodeType":"Function","startLoc":355,"text":"@utype.deleter\n    def utype(self):\n        self._utype = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":337,"id":4571,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":337,"text":"_utype_in_v1_2"},{"attributeType":"None","col":8,"comment":"null","endLoc":353,"id":4572,"name":"_utype","nodeType":"Attribute","startLoc":353,"text":"self._utype"},{"col":0,"comment":"\n    Reads the header of a file to determine if it is a VOTable file.\n\n    Parameters\n    ----------\n    source : str or readable file-like object\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":367,"header":"def is_votable(source)","id":4573,"name":"is_votable","nodeType":"Function","startLoc":339,"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 : str or readable file-like object\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    try:\n        with iterparser.get_xml_iterator(source) as iterator:\n            for start, tag, data, pos in iterator:\n                if tag != 'xml':\n                    return False\n                break\n\n            for start, tag, data, pos in iterator:\n                if tag != 'VOTABLE':\n                    return False\n                break\n\n            return True\n    except ValueError:\n        return False"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":4574,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"className":"_UcdProperty","col":0,"comment":"null","endLoc":383,"id":4575,"nodeType":"Class","startLoc":360,"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":0,"comment":"","endLoc":6,"header":"table.py#<anonymous>","id":4576,"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']"},{"col":4,"comment":"The `unified content descriptor`_ for the element.","endLoc":366,"header":"@property\n    def ucd(self)","id":4577,"name":"ucd","nodeType":"Function","startLoc":363,"text":"@property\n    def ucd(self):\n        \"\"\"The `unified content descriptor`_ for the element.\"\"\"\n        return self._ucd"},{"col":4,"comment":"null","endLoc":379,"header":"@ucd.setter\n    def ucd(self, ucd)","id":4578,"name":"ucd","nodeType":"Function","startLoc":368,"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":4,"comment":"null","endLoc":448,"header":"def parse_scalar(self, value, config=None, pos=0)","id":4579,"name":"parse_scalar","nodeType":"Function","startLoc":447,"text":"def parse_scalar(self, value, config=None, pos=0):\n        return self._base.parse_scalar(value, config, pos)"},{"col":4,"comment":"null","endLoc":452,"header":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None)","id":4580,"name":"_splitter_pedantic","nodeType":"Function","startLoc":450,"text":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return pedantic_array_splitter.split(value)"},{"id":4581,"name":"astropy/io/votable/src","nodeType":"Package"},{"id":4582,"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#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 Py_UNICODE\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_AsUnicode(str_val)) == NULL) {\n                    Py_DECREF(str_val);\n                    goto exit;\n                }\n\n                str_len = PyUnicode_GetSize(str_val);\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, \"u#\", buf, x - buf))\n            == 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":4583,"name":".gitignore","nodeType":"TextFile","path":"astropy/io/votable/src","text":"!*.c\n"},{"col":4,"comment":"null","endLoc":458,"header":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None)","id":4584,"name":"_splitter_lax","nodeType":"Function","startLoc":454,"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)"},{"id":4585,"name":"astropy/io/votable/data","nodeType":"Package"},{"id":4586,"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"},{"id":4587,"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 previsouly 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>"},{"id":4588,"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"},{"attributeType":"function","col":12,"comment":"null","endLoc":445,"id":4589,"name":"_splitter","nodeType":"Attribute","startLoc":445,"text":"self._splitter"},{"id":4590,"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 previsouly 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>"},{"id":4591,"name":"astropy/io/votable/tests","nodeType":"Package"},{"fileName":"util_test.py","filePath":"astropy/io/votable/tests","id":4592,"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\"\"\"\n\n\n# LOCAL\nfrom .. import util\nfrom ....tests.helper import raises\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\n@raises(ValueError)\ndef test_range_list4a():\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\n@raises(ValueError)\ndef test_range_list5():\n    util.coerce_range_list_param(('FOO', ))\n\n\n@raises(ValueError)\ndef test_range_list6():\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\n@raises(ValueError)\ndef test_range_list9a():\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":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":276,"header":"def check_ucd(ucd, config=None, pos=None)","id":4593,"name":"check_ucd","nodeType":"Function","startLoc":245,"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('pedantic'):\n                vo_raise(W06, (ucd, str(e)), config, pos)\n            else:\n                vo_warn(W06, (ucd, str(e)), config, pos)\n                return False\n    return True"},{"id":4594,"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        Create a `Table` instance from a given `astropy.table.Table`\n        instance.\n        ","endLoc":2903,"header":"@classmethod\n    def from_table(cls, votable, table)","id":4595,"name":"from_table","nodeType":"Function","startLoc":2878,"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"},{"fileName":"exception_test.py","filePath":"astropy/io/votable/tests","id":4596,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# LOCAL\nfrom ....tests.helper import catch_warnings\n\nfrom .. import converters\nfrom .. import exceptions\nfrom .. import 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 = {'pedantic': True,\n              'filename': 'foo.xml'}\n    pos = (42, 64)\n    with catch_warnings(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config, pos=pos)\n        c = 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"},{"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    ","endLoc":123,"id":4597,"nodeType":"Class","startLoc":92,"text":"class 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\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)"},{"col":4,"comment":"null","endLoc":110,"header":"def __init__(self, exc)","id":4598,"name":"__init__","nodeType":"Function","startLoc":108,"text":"def __init__(self, exc):\n        self._exc = exc\n        self._ctx = None"},{"col":4,"comment":"null","endLoc":116,"header":"def __call__(self, func)","id":4599,"name":"__call__","nodeType":"Function","startLoc":112,"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"},{"col":0,"comment":"null","endLoc":23,"header":"def test_reraise()","id":4600,"name":"test_reraise","nodeType":"Function","startLoc":11,"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":120,"header":"def __enter__(self)","id":4601,"name":"__enter__","nodeType":"Function","startLoc":118,"text":"def __enter__(self):\n        self._ctx = pytest.raises(self._exc)\n        return self._ctx.__enter__()"},{"col":4,"comment":"null","endLoc":123,"header":"def __exit__(self, *exc_info)","id":4603,"name":"__exit__","nodeType":"Function","startLoc":122,"text":"def __exit__(self, *exc_info):\n        return self._ctx.__exit__(*exc_info)"},{"className":"VarArray","col":0,"comment":"\n    Handles variable lengths arrays (i.e. where *arraysize* is '*').\n    ","endLoc":500,"id":4604,"nodeType":"Class","startLoc":461,"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":0,"comment":"null","endLoc":49,"header":"def test_parse_vowarning()","id":4605,"name":"test_parse_vowarning","nodeType":"Function","startLoc":26,"text":"def test_parse_vowarning():\n    config = {'pedantic': True,\n              'filename': 'foo.xml'}\n    pos = (42, 64)\n    with catch_warnings(exceptions.W47) as w:\n        field = tree.Field(\n            None, name='c', datatype='char',\n            config=config, pos=pos)\n        c = 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":4606,"name":"_ctx","nodeType":"Attribute","startLoc":110,"text":"self._ctx"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":4607,"name":"_exc","nodeType":"Attribute","startLoc":109,"text":"self._exc"},{"col":4,"comment":"null","endLoc":471,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":4608,"name":"__init__","nodeType":"Function","startLoc":467,"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":0,"comment":"null","endLoc":13,"header":"def test_range_list()","id":4609,"name":"test_range_list","nodeType":"Function","startLoc":12,"text":"def test_range_list():\n    assert util.coerce_range_list_param((5,)) == (\"5.0\", 1)"},{"col":0,"comment":"null","endLoc":17,"header":"def test_range_list2()","id":4610,"name":"test_range_list2","nodeType":"Function","startLoc":16,"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":22,"header":"def test_range_list3()","id":4611,"name":"test_range_list3","nodeType":"Function","startLoc":20,"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":4,"comment":"null","endLoc":1588,"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":4612,"name":"__init__","nodeType":"Function","startLoc":1580,"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":"null","endLoc":2059,"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":4613,"name":"__init__","nodeType":"Function","startLoc":2024,"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":0,"comment":"null","endLoc":28,"header":"@raises(ValueError)\ndef test_range_list4a()","id":4614,"name":"test_range_list4a","nodeType":"Function","startLoc":25,"text":"@raises(ValueError)\ndef test_range_list4a():\n    util.coerce_range_list_param(\n        (5e-7, (None, 8e-7), (4, None), (4, 5), \"J\", \"FOO\"))"},{"col":4,"comment":"null","endLoc":476,"header":"def output(self, value, mask)","id":4615,"name":"output","nodeType":"Function","startLoc":473,"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":489,"header":"def binparse(self, read)","id":4616,"name":"binparse","nodeType":"Function","startLoc":478,"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"},{"col":0,"comment":"null","endLoc":34,"header":"def test_range_list4()","id":4617,"name":"test_range_list4","nodeType":"Function","startLoc":31,"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":39,"header":"@raises(ValueError)\ndef test_range_list5()","id":4618,"name":"test_range_list5","nodeType":"Function","startLoc":37,"text":"@raises(ValueError)\ndef test_range_list5():\n    util.coerce_range_list_param(('FOO', ))"},{"col":0,"comment":"null","endLoc":44,"header":"@raises(ValueError)\ndef test_range_list6()","id":4619,"name":"test_range_list6","nodeType":"Function","startLoc":42,"text":"@raises(ValueError)\ndef test_range_list6():\n    print(util.coerce_range_list_param((5, 'FOO'), util.stc_reference_frames))"},{"col":4,"comment":"null","endLoc":1234,"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":4620,"name":"__init__","nodeType":"Function","startLoc":1147,"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            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 archive.noao.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 (not config.get('pedantic') 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":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":72,"header":"def _make_masked_array(data, mask)","id":4621,"name":"_make_masked_array","nodeType":"Function","startLoc":59,"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))"},{"col":4,"comment":"null","endLoc":469,"header":"def __init__(self)","id":4622,"name":"__init__","nodeType":"Function","startLoc":468,"text":"def __init__(self):\n        Element.__init__(self)"},{"col":4,"comment":"null","endLoc":500,"header":"def binoutput(self, value, mask)","id":4623,"name":"binoutput","nodeType":"Function","startLoc":491,"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)"},{"col":4,"comment":"null","endLoc":3322,"header":"def _add_resource(self, iterator, tag, data, config, pos)","id":4624,"name":"_add_resource","nodeType":"Function","startLoc":3319,"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":48,"header":"def test_range_list7()","id":4625,"name":"test_range_list7","nodeType":"Function","startLoc":47,"text":"def test_range_list7():\n    assert util.coerce_range_list_param((\"J\",), numeric=False) == (\"J\", 1)"},{"col":4,"comment":"null","endLoc":383,"header":"@ucd.deleter\n    def ucd(self)","id":4626,"name":"ucd","nodeType":"Function","startLoc":381,"text":"@ucd.deleter\n    def ucd(self):\n        self._ucd = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":361,"id":4627,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":361,"text":"_ucd_in_v1_2"},{"attributeType":"None","col":8,"comment":"null","endLoc":379,"id":4628,"name":"_ucd","nodeType":"Attribute","startLoc":379,"text":"self._ucd"},{"col":0,"comment":"null","endLoc":57,"header":"def test_range_list8()","id":4629,"name":"test_range_list8","nodeType":"Function","startLoc":51,"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":62,"header":"@raises(ValueError)\ndef test_range_list9a()","id":4630,"name":"test_range_list9a","nodeType":"Function","startLoc":60,"text":"@raises(ValueError)\ndef test_range_list9a():\n    util.coerce_range_list_param(\"52,-27.8;FOO\", util.stc_reference_frames)"},{"col":0,"comment":"null","endLoc":67,"header":"def test_range_list9()","id":4631,"name":"test_range_list9","nodeType":"Function","startLoc":65,"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":4632,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nA set of tests for the util.py module\n\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":465,"id":4633,"name":"format","nodeType":"Attribute","startLoc":465,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":471,"id":4634,"name":"default","nodeType":"Attribute","startLoc":471,"text":"self.default"},{"col":4,"comment":"\n        Restores a `Field` instance from a given\n        `astropy.table.Column` instance.\n        ","endLoc":1566,"header":"@classmethod\n    def from_table_column(cls, votable, column)","id":4635,"name":"from_table_column","nodeType":"Function","startLoc":1536,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":470,"id":4636,"name":"_base","nodeType":"Attribute","startLoc":470,"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":525,"id":4637,"nodeType":"Class","startLoc":503,"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":525,"header":"def parse(self, value, config=None, pos=None)","id":4638,"name":"parse","nodeType":"Function","startLoc":509,"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"},{"fileName":"vo_test.py","filePath":"astropy/io/votable/tests","id":4639,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\n\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\n# STDLIB\nimport difflib\nimport io\nimport pathlib\nimport sys\nimport gzip\n\n# THIRD-PARTY\nimport pytest\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\n# LOCAL\nfrom ..table import parse, parse_single_table, validate\nfrom .. import tree\nfrom ..exceptions import VOTableSpecError, VOWarning\nfrom ..xmlutil import validate_schema\nfrom ....utils.data import get_pkg_data_filename, get_pkg_data_filenames\nfrom ....tests.helper import raises, catch_warnings\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(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\n    assert isinstance(table, tree.Table)\n    assert len(table.array) == 5\n\n\ndef test_parse_single_table2():\n    table2 = parse_single_table(\n        get_pkg_data_filename('data/regression.xml'),\n        table_number=1,\n        pedantic=False)\n    assert isinstance(table2, tree.Table)\n    assert len(table2.array) == 1\n    assert len(table2.array.dtype.names) == 28\n\n\n@raises(IndexError)\ndef test_parse_single_table3():\n    parse_single_table(\n        get_pkg_data_filename('data/regression.xml'),\n        table_number=3, pedantic=False)\n\n\ndef _test_regression(tmpdir, _python_based=False, binary_mode=1):\n    # Read the VOTABLE\n    votable = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False,\n        _debug_python_based_parser=_python_based)\n    table = votable.get_first_table()\n\n    dtypes = [\n        ((str('string test'), str('string_test')), str('|O8')),\n        ((str('fixed string test'), str('string_test_2')), str('|S10')),\n        (str('unicode_test'), str('|O8')),\n        ((str('unicode test'), str('fixed_unicode_test')), str('<U10')),\n        ((str('string array test'), str('string_array_test')), str('|S4')),\n        (str('unsignedByte'), str('|u1')),\n        (str('short'), str('<i2')),\n        (str('int'), str('<i4')),\n        (str('long'), str('<i8')),\n        (str('double'), str('<f8')),\n        (str('float'), str('<f4')),\n        (str('array'), str('|O8')),\n        (str('bit'), str('|b1')),\n        (str('bitarray'), str('|b1'), (3, 2)),\n        (str('bitvararray'), str('|O8')),\n        (str('bitvararray2'), str('|O8')),\n        (str('floatComplex'), str('<c8')),\n        (str('doubleComplex'), str('<c16')),\n        (str('doubleComplexArray'), str('|O8')),\n        (str('doubleComplexArrayFixed'), str('<c16'), (2,)),\n        (str('boolean'), str('|b1')),\n        (str('booleanArray'), str('|b1'), (4,)),\n        (str('nulls'), str('<i4')),\n        (str('nulls_array'), str('<i4'), (2, 2)),\n        (str('precision1'), str('<f8')),\n        (str('precision2'), str('<f8')),\n        (str('doublearray'), str('|O8')),\n        (str('bitarray2'), str('|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(str('<'), str('>'))\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, pedantic=False,\n                         _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            'data/regression.bin.tabledata.truth.{0}.xml'.format(\n                votable.version)),\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(str('legacy_float_repr'))\ndef test_regression(tmpdir):\n    _test_regression(tmpdir, False)\n\n\n@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_python_based_parser(tmpdir):\n    _test_regression(tmpdir, True)\n\n\n@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_binary2(tmpdir):\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'),\n            pedantic=False).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(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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'),\n        pedantic=False, columns=columns).get_first_table()\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == b\"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'),\n        pedantic=False, columns=columns).get_first_table()\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == b\"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(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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            [b'String & test', b'String &amp; test', b'XXXX',\n             b'', b''])\n\n    def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.string_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            [b'Fixed stri', b'0123456789', b'XXXX', b'', b''])\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(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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 ..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'):\n            continue\n        parse(filename, pedantic=False)\n\n\n@raises(VOTableSpecError)\ndef test_too_many_columns():\n    parse(\n        get_pkg_data_filename('data/too_many_columns.xml.gz'),\n        pedantic=False)\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\", datatype=\"char\"),\n        tree.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    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=[(str('filename'), str('?')),\n                                          (str('matrix'), str('?'), (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    with catch_warnings():\n        result = validate(fpath,\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('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\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(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'wb') as fd:\n        votable.to_xml(\n            fd,\n            compressed=True,\n            _astropy_version=\"testing\")\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'rb') as fd:\n        votable = parse(\n            fd,\n            pedantic=False)\n\n\ndef test_from_scratch_example():\n    with catch_warnings(VOWarning) as warning_lines:\n        try:\n            _run_test_from_scratch_example()\n        except ValueError as e:\n            warning_lines.append(str(e))\n\n    assert len(warning_lines) == 0\n\n\ndef _run_test_from_scratch_example():\n    from ..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 ....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 .... import units as u\n\n    votable = parse(\n        get_pkg_data_filename('data/nonstandard_units.xml'),\n        pedantic=False)\n\n    assert isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)\n\n    votable = parse(\n        get_pkg_data_filename('data/nonstandard_units.xml'),\n        pedantic=False,\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    with catch_warnings():\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(\n        get_pkg_data_filename('data/custom_datatype.xml'),\n        pedantic=False,\n        datatype_mapping={'bar': 'int'}\n    )\n\n    table = votable.get_first_table()\n    assert table.array.dtype['foo'] == np.int32\n"},{"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":487,"id":4640,"nodeType":"Class","startLoc":462,"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":474,"header":"def __repr__(self)","id":4641,"name":"__repr__","nodeType":"Function","startLoc":471,"text":"def __repr__(self):\n        buff = io.StringIO()\n        SimpleElement.to_xml(self, XMLWriter(buff))\n        return buff.getvalue().strip()"},{"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":1436,"header":"def table_column_to_votable_datatype(column)","id":4642,"name":"table_column_to_votable_datatype","nodeType":"Function","startLoc":1381,"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    if column.dtype.char == 'O':\n        if isinstance(column[0], bytes):\n            if _all_bytes(column[1:]):\n                return {'datatype': 'char', 'arraysize': '*'}\n        elif isinstance(column[0], str):\n            if _all_unicode(column[1:]):\n                return {'datatype': 'unicodeChar', '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    return numpy_to_votable_dtype(column.dtype, column.shape[1:])"},{"col":0,"comment":"null","endLoc":1318,"header":"def _all_bytes(column)","id":4643,"name":"_all_bytes","nodeType":"Function","startLoc":1314,"text":"def _all_bytes(column):\n    for x in column:\n        if not isinstance(x, bytes):\n            return False\n    return True"},{"col":0,"comment":"null","endLoc":1325,"header":"def _all_unicode(column)","id":4644,"name":"_all_unicode","nodeType":"Function","startLoc":1321,"text":"def _all_unicode(column):\n    for x in column:\n        if not isinstance(x, str):\n            return False\n    return True"},{"col":0,"comment":"null","endLoc":1342,"header":"def _all_matching_dtype(column)","id":4645,"name":"_all_matching_dtype","nodeType":"Function","startLoc":1328,"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"},{"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":1378,"header":"def numpy_to_votable_dtype(dtype, shape)","id":4646,"name":"numpy_to_votable_dtype","nodeType":"Function","startLoc":1345,"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            \"{0!r} can not be represented in VOTable\".format(dtype))\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"},{"col":4,"comment":"null","endLoc":3327,"header":"def _add_coosys(self, iterator, tag, data, config, pos)","id":4647,"name":"_add_coosys","nodeType":"Function","startLoc":3324,"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":"null","endLoc":487,"header":"def to_xml(self, w, **kwargs)","id":4648,"name":"to_xml","nodeType":"Function","startLoc":485,"text":"def to_xml(self, w, **kwargs):\n        w.element(self._element_name,\n                  attrib=w.object_attrs(self, self._attr_list))"},{"className":"ScalarVarArray","col":0,"comment":"\n    Handles a variable-length array of numeric scalars.\n    ","endLoc":547,"id":4649,"nodeType":"Class","startLoc":528,"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":547,"header":"def parse(self, value, config=None, pos=None)","id":4650,"name":"parse","nodeType":"Function","startLoc":533,"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":4,"comment":"null","endLoc":483,"header":"def parse(self, iterator, config)","id":4651,"name":"parse","nodeType":"Function","startLoc":476,"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"},{"className":"NumericArray","col":0,"comment":"\n    Handles a fixed-length array of numeric scalars.\n    ","endLoc":623,"id":4652,"nodeType":"Class","startLoc":550,"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 = \"{}{}\".format(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('pedantic'):\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        return ' '.join(base_output(x, m) for x, m in\n                        zip(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.tostring()"},{"col":4,"comment":"null","endLoc":571,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":4653,"name":"__init__","nodeType":"Function","startLoc":556,"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 = \"{}{}\".format(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":1649,"header":"def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None,\n                 config=None, pos=None, **extra)","id":4654,"name":"__init__","nodeType":"Function","startLoc":1632,"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        if config.get('version_1_2_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)"},{"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":528,"id":4655,"nodeType":"Class","startLoc":490,"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":499,"header":"def __init__(self)","id":4656,"name":"__init__","nodeType":"Function","startLoc":496,"text":"def __init__(self):\n        SimpleElement.__init__(self)\n\n        self._content = None"},{"col":4,"comment":"null","endLoc":510,"header":"def parse(self, iterator, config)","id":4657,"name":"parse","nodeType":"Function","startLoc":501,"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":"null","endLoc":3332,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":4658,"name":"_add_info","nodeType":"Function","startLoc":3329,"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":4,"comment":"null","endLoc":514,"header":"def to_xml(self, w, **kwargs)","id":4659,"name":"to_xml","nodeType":"Function","startLoc":512,"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":591,"header":"def parse(self, value, config=None, pos=None)","id":4660,"name":"parse","nodeType":"Function","startLoc":573,"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('pedantic'):\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":4,"comment":"The content of the element.","endLoc":519,"header":"@property\n    def content(self)","id":4661,"name":"content","nodeType":"Function","startLoc":516,"text":"@property\n    def content(self):\n        \"\"\"The content of the element.\"\"\"\n        return self._content"},{"col":4,"comment":"null","endLoc":524,"header":"@content.setter\n    def content(self, content)","id":4662,"name":"content","nodeType":"Function","startLoc":521,"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":528,"header":"@content.deleter\n    def content(self)","id":4663,"name":"content","nodeType":"Function","startLoc":526,"text":"@content.deleter\n    def content(self):\n        self._content = None"},{"attributeType":"None","col":8,"comment":"null","endLoc":499,"id":4664,"name":"_content","nodeType":"Attribute","startLoc":499,"text":"self._content"},{"col":4,"comment":"null","endLoc":839,"header":"def __init__(self, votable, field, ID=None, null=None, ref=None,\n                 type=\"legal\", id=None, config=None, pos=None, **extras)","id":4665,"name":"__init__","nodeType":"Function","startLoc":817,"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)"},{"col":4,"comment":"null","endLoc":1276,"header":"def _setup(self, config, pos)","id":4666,"name":"_setup","nodeType":"Function","startLoc":1273,"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)"},{"attributeType":"null","col":20,"comment":"null","endLoc":507,"id":4667,"name":"content","nodeType":"Attribute","startLoc":507,"text":"self.content"},{"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":1294,"header":"def get_converter(field, config=None, pos=None)","id":4668,"name":"get_converter","nodeType":"Function","startLoc":1236,"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"},{"col":4,"comment":"null","endLoc":686,"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":4669,"name":"__init__","nodeType":"Function","startLoc":651,"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)"},{"col":4,"comment":"null","endLoc":635,"header":"@classmethod\n    def from_table_column(cls, d)","id":4670,"name":"from_table_column","nodeType":"Function","startLoc":633,"text":"@classmethod\n    def from_table_column(cls, d):\n        return cls(**d)"},{"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('maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    ","endLoc":726,"header":"def get_pkg_data_filenames(datadir, package=None, pattern='*')","id":4671,"name":"get_pkg_data_filenames","nodeType":"Function","startLoc":672,"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('maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    \"\"\"\n\n    path = _find_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\")"},{"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":635,"id":4672,"nodeType":"Class","startLoc":531,"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)"},{"className":"TestFixups","col":0,"comment":"null","endLoc":206,"id":4673,"nodeType":"Class","startLoc":196,"text":"class TestFixups:\n    def setup_class(self):\n        self.table = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False).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":202,"header":"def setup_class(self)","id":4674,"name":"setup_class","nodeType":"Function","startLoc":197,"text":"def setup_class(self):\n        self.table = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False).get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"col":4,"comment":"null","endLoc":568,"header":"def __init__(self, ID=None, title=None, value=None, href=None, action=None,\n                 id=None, config=None, pos=None, **kwargs)","id":4675,"name":"__init__","nodeType":"Function","startLoc":542,"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":"ucd_test.py","filePath":"astropy/io/votable/tests","id":4676,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n\n\nfrom ....tests.helper import raises\n\n# LOCAL\nfrom .. 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}\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\n@raises(ValueError)\ndef test_too_many_colons():\n    ucd.parse_ucd(\"ivoa:stsci:phot\", True, True)\n\n\n@raises(ValueError)\ndef test_invalid_namespace():\n    ucd.parse_ucd(\"_ivoa:phot.mag\", True, True)\n\n\n@raises(ValueError)\ndef test_invalid_word():\n    ucd.parse_ucd(\"-pho\")\n"},{"col":0,"comment":"null","endLoc":13,"header":"def test_none()","id":4677,"name":"test_none","nodeType":"Function","startLoc":12,"text":"def test_none():\n    assert ucd.check_ucd(None)"},{"col":4,"comment":"null","endLoc":605,"header":"def parse_parts(self, parts, config=None, pos=None)","id":4678,"name":"parse_parts","nodeType":"Function","startLoc":593,"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"},{"col":0,"comment":"null","endLoc":44,"header":"def test_check()","id":4679,"name":"test_check","nodeType":"Function","startLoc":41,"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)"},{"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":577,"header":"@property\n    def content_role(self)","id":4680,"name":"content_role","nodeType":"Function","startLoc":570,"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":586,"header":"@content_role.setter\n    def content_role(self, content_role)","id":4681,"name":"content_role","nodeType":"Function","startLoc":579,"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":612,"header":"def output(self, value, mask)","id":4682,"name":"output","nodeType":"Function","startLoc":607,"text":"def output(self, value, mask):\n        base_output = self._base.output\n        value = np.asarray(value)\n        mask = np.asarray(mask)\n        return ' '.join(base_output(x, m) for x, m in\n                        zip(value.flat, mask.flat))"},{"col":4,"comment":"null","endLoc":3339,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":4683,"name":"_add_group","nodeType":"Function","startLoc":3334,"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)"},{"col":4,"comment":"null","endLoc":590,"header":"@content_role.deleter\n    def content_role(self)","id":4684,"name":"content_role","nodeType":"Function","startLoc":588,"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":595,"header":"@property\n    def content_type(self)","id":4685,"name":"content_type","nodeType":"Function","startLoc":592,"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":600,"header":"@content_type.setter\n    def content_type(self, content_type)","id":4686,"name":"content_type","nodeType":"Function","startLoc":597,"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":604,"header":"@content_type.deleter\n    def content_type(self)","id":4687,"name":"content_type","nodeType":"Function","startLoc":602,"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":612,"header":"@property\n    def href(self)","id":4688,"name":"href","nodeType":"Function","startLoc":606,"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":617,"header":"@href.setter\n    def href(self, href)","id":4689,"name":"href","nodeType":"Function","startLoc":614,"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":621,"header":"@href.deleter\n    def href(self)","id":4690,"name":"href","nodeType":"Function","startLoc":619,"text":"@href.deleter\n    def href(self):\n        self._href = None"},{"col":4,"comment":"null","endLoc":631,"header":"def to_table_column(self, column)","id":4691,"name":"to_table_column","nodeType":"Function","startLoc":623,"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":618,"header":"def binparse(self, read)","id":4692,"name":"binparse","nodeType":"Function","startLoc":614,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":538,"id":4693,"name":"_attr_list","nodeType":"Attribute","startLoc":538,"text":"_attr_list"},{"col":4,"comment":"null","endLoc":623,"header":"def binoutput(self, value, mask)","id":4694,"name":"binoutput","nodeType":"Function","startLoc":620,"text":"def binoutput(self, value, mask):\n        filtered = self._base.filter_array(value, mask)\n        filtered = _ensure_bigendian(filtered)\n        return filtered.tostring()"},{"attributeType":"null","col":4,"comment":"null","endLoc":540,"id":4695,"name":"_element_name","nodeType":"Attribute","startLoc":540,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":617,"id":4696,"name":"_href","nodeType":"Attribute","startLoc":617,"text":"self._href"},{"col":4,"comment":"null","endLoc":51,"header":"def _ensure_bigendian(x)","id":4697,"name":"_ensure_bigendian","nodeType":"Function","startLoc":48,"text":"def _ensure_bigendian(x):\n        if x.dtype.byteorder != '>':\n            return x.byteswap()\n        return x"},{"col":4,"comment":"null","endLoc":206,"header":"def test_implicit_id(self)","id":4698,"name":"test_implicit_id","nodeType":"Function","startLoc":204,"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":201,"id":4699,"name":"array","nodeType":"Attribute","startLoc":201,"text":"self.array"},{"col":4,"comment":"null","endLoc":56,"header":"def _ensure_bigendian(x)","id":4700,"name":"_ensure_bigendian","nodeType":"Function","startLoc":53,"text":"def _ensure_bigendian(x):\n        if x.dtype.byteorder == '<':\n            return x.byteswap()\n        return x"},{"col":0,"comment":"null","endLoc":49,"header":"@raises(ValueError)\ndef test_too_many_colons()","id":4701,"name":"test_too_many_colons","nodeType":"Function","startLoc":47,"text":"@raises(ValueError)\ndef test_too_many_colons():\n    ucd.parse_ucd(\"ivoa:stsci:phot\", True, True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":559,"id":4702,"name":"content_type","nodeType":"Attribute","startLoc":559,"text":"self.content_type"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":586,"id":4703,"name":"_content_role","nodeType":"Attribute","startLoc":586,"text":"self._content_role"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":554,"id":4704,"name":"vararray_type","nodeType":"Attribute","startLoc":554,"text":"vararray_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":4705,"name":"table","nodeType":"Attribute","startLoc":198,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":202,"id":4706,"name":"mask","nodeType":"Attribute","startLoc":202,"text":"self.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":567,"id":4707,"name":"_memsize","nodeType":"Attribute","startLoc":567,"text":"self._memsize"},{"className":"TestReferences","col":0,"comment":"null","endLoc":247,"id":4708,"nodeType":"Class","startLoc":209,"text":"class TestReferences:\n    def setup_class(self):\n        self.votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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":216,"header":"def setup_class(self)","id":4709,"name":"setup_class","nodeType":"Function","startLoc":210,"text":"def setup_class(self):\n        self.votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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":570,"id":4710,"name":"default","nodeType":"Attribute","startLoc":570,"text":"self.default"},{"attributeType":"{format}","col":8,"comment":"null","endLoc":559,"id":4711,"name":"_base","nodeType":"Attribute","startLoc":559,"text":"self._base"},{"attributeType":"null","col":8,"comment":"null","endLoc":561,"id":4712,"name":"format","nodeType":"Attribute","startLoc":561,"text":"self.format"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.io.votable`.\n    ","endLoc":30,"id":4713,"nodeType":"Class","startLoc":22,"text":"class Conf(_config.ConfigNamespace):\n    \"\"\"\n    Configuration parameters for `astropy.io.votable`.\n    \"\"\"\n\n    pedantic = _config.ConfigItem(\n        False,\n        'When True, treat fixable violations of the VOTable spec as exceptions.',\n        aliases=['astropy.io.votable.table.pedantic'])"},{"attributeType":"{__iter__}","col":8,"comment":"null","endLoc":560,"id":4714,"name":"_arraysize","nodeType":"Attribute","startLoc":560,"text":"self._arraysize"},{"col":4,"comment":"null","endLoc":222,"header":"def test_fieldref(self)","id":4715,"name":"test_fieldref","nodeType":"Function","startLoc":218,"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":8,"comment":"null","endLoc":563,"id":4716,"name":"_items","nodeType":"Attribute","startLoc":563,"text":"self._items"},{"attributeType":"null","col":8,"comment":"null","endLoc":568,"id":4717,"name":"_bigendian_format","nodeType":"Attribute","startLoc":568,"text":"self._bigendian_format"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":27,"id":4718,"name":"pedantic","nodeType":"Attribute","startLoc":27,"text":"pedantic"},{"className":"Numeric","col":0,"comment":"\n    The base class for all numeric data types.\n    ","endLoc":652,"id":4719,"nodeType":"Class","startLoc":626,"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":0,"comment":"null","endLoc":54,"header":"@raises(ValueError)\ndef test_invalid_namespace()","id":4720,"name":"test_invalid_namespace","nodeType":"Function","startLoc":52,"text":"@raises(ValueError)\ndef test_invalid_namespace():\n    ucd.parse_ucd(\"_ivoa:phot.mag\", True, True)"},{"col":4,"comment":"null","endLoc":644,"header":"def __init__(self, field, config=None, pos=None)","id":4721,"name":"__init__","nodeType":"Function","startLoc":634,"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"},{"col":4,"comment":"null","endLoc":1893,"header":"def __init__(self, table, ID=None, name=None, ref=None, ucd=None,\n                 utype=None, id=None, config=None, pos=None, **extra)","id":4722,"name":"__init__","nodeType":"Function","startLoc":1872,"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":"null","col":8,"comment":"null","endLoc":547,"id":4723,"name":"_pos","nodeType":"Attribute","startLoc":547,"text":"self._pos"},{"col":4,"comment":"null","endLoc":649,"header":"def binparse(self, read)","id":4724,"name":"binparse","nodeType":"Function","startLoc":646,"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])"},{"attributeType":"null","col":8,"comment":"null","endLoc":563,"id":4725,"name":"action","nodeType":"Attribute","startLoc":563,"text":"self.action"},{"col":0,"comment":"null","endLoc":59,"header":"@raises(ValueError)\ndef test_invalid_word()","id":4726,"name":"test_invalid_word","nodeType":"Function","startLoc":57,"text":"@raises(ValueError)\ndef test_invalid_word():\n    ucd.parse_ucd(\"-pho\")"},{"col":4,"comment":"null","endLoc":652,"header":"def _is_null(self, value)","id":4727,"name":"_is_null","nodeType":"Function","startLoc":651,"text":"def _is_null(self, value):\n        return value == self.null"},{"attributeType":"NumericArray","col":4,"comment":"null","endLoc":630,"id":4728,"name":"array_type","nodeType":"Attribute","startLoc":630,"text":"array_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":557,"id":4729,"name":"ID","nodeType":"Attribute","startLoc":557,"text":"self.ID"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":631,"id":4730,"name":"vararray_type","nodeType":"Attribute","startLoc":631,"text":"vararray_type"},{"col":4,"comment":"\n        Write to an XML file.\n\n        Parameters\n        ----------\n        fd : str path or writable file-like object\n            Where to write the file.\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:`votable-serialization`.\n        ","endLoc":3474,"header":"def to_xml(self, fd, compressed=False, tabledata_format=None,\n               _debug_python_based_parser=False, _astropy_version=None)","id":4731,"name":"to_xml","nodeType":"Function","startLoc":3404,"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 path or writable file-like object\n            Where to write the file.\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:`votable-serialization`.\n        \"\"\"\n        if tabledata_format is not None:\n            if tabledata_format.lower() not in (\n                    'tabledata', 'binary', 'binary2'):\n                raise ValueError(\"Unknown format type '{0}'\".format(format))\n\n        kwargs = {\n            'version': self.version,\n            'version_1_1_or_later':\n                util.version_compare(self.version, '1.1') >= 0,\n            'version_1_2_or_later':\n                util.version_compare(self.version, '1.2') >= 0,\n            'version_1_3_or_later':\n                util.version_compare(self.version, '1.3') >= 0,\n            'tabledata_format':\n                tabledata_format,\n            '_debug_python_based_parser': _debug_python_based_parser,\n            '_group_number': 1}\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            with w.tag('VOTABLE',\n                       {'version': version,\n                        'xmlns:xsi':\n                            \"http://www.w3.org/2001/XMLSchema-instance\",\n                        'xsi:noNamespaceSchemaLocation':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version),\n                        'xmlns':\n                            \"http://www.ivoa.net/xml/VOTable/v{}\".format(version)}):\n                if self.description is not None:\n                    w.element(\"DESCRIPTION\", self.description, wrap=True)\n                element_sets = [self.coordinate_systems, self.params,\n                                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":"None","col":4,"comment":"null","endLoc":632,"id":4732,"name":"null","nodeType":"Attribute","startLoc":632,"text":"null"},{"attributeType":"null","col":8,"comment":"null","endLoc":637,"id":4733,"name":"_memsize","nodeType":"Attribute","startLoc":637,"text":"self._memsize"},{"attributeType":"null","col":12,"comment":"null","endLoc":641,"id":4734,"name":"default","nodeType":"Attribute","startLoc":641,"text":"self.default"},{"attributeType":"null","col":8,"comment":"null","endLoc":562,"id":4735,"name":"href","nodeType":"Attribute","startLoc":562,"text":"self.href"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":4736,"name":"examples","nodeType":"Attribute","startLoc":16,"text":"examples"},{"col":0,"comment":"","endLoc":6,"header":"ucd_test.py#<anonymous>","id":4737,"name":"<anonymous>","nodeType":"Function","startLoc":6,"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}"},{"attributeType":"null","col":12,"comment":"null","endLoc":640,"id":4738,"name":"null","nodeType":"Attribute","startLoc":640,"text":"self.null"},{"attributeType":"null","col":12,"comment":"null","endLoc":644,"id":4739,"name":"is_null","nodeType":"Attribute","startLoc":644,"text":"self.is_null"},{"attributeType":"null","col":8,"comment":"null","endLoc":638,"id":4740,"name":"_bigendian_format","nodeType":"Attribute","startLoc":638,"text":"self._bigendian_format"},{"fileName":"__init__.py","filePath":"astropy/io/votable/tests","id":4741,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":600,"id":4742,"name":"_content_type","nodeType":"Attribute","startLoc":600,"text":"self._content_type"},{"fileName":"converter_test.py","filePath":"astropy/io/votable/tests","id":4743,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n\nimport io\n\n# THIRD-PARTY\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\n# LOCAL\nfrom .. import converters\nfrom .. import exceptions\nfrom .. import tree\n\nfrom ..table import parse_single_table\nfrom ....tests.helper import raises, catch_warnings\nfrom ....utils.data import get_pkg_data_filename\n\n\n@raises(exceptions.E13)\ndef test_invalid_arraysize():\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 = {'pedantic': True}\n    with catch_warnings(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 catch_warnings(exceptions.W46) as w:\n        c.parse(\"XXX\")\n    assert len(w) == 1\n\n\ndef test_char_mask():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', 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 = {'pedantic': True}\n    with catch_warnings(exceptions.W46) as w:\n        field = tree.Field(\n            None, name='c2', datatype='unicodeChar',\n            config=config)\n        c = converters.get_converter(field, config=config)\n\n        c.parse(\"XXX\")\n    assert len(w) == 1\n\n\ndef test_unicode_mask():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='unicodeChar',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''\n\n\n@raises(exceptions.E02)\ndef test_wrong_number_of_elements():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='int', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse(\"2 3 4 5 6\")\n\n\n@raises(ValueError)\ndef test_float_mask():\n    config = {'pedantic': True}\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    c.parse('null')\n\n\ndef test_float_mask_permissive():\n    config = {'pedantic': False}\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('null') == (c.null, True)\n\n\n@raises(exceptions.E02)\ndef test_complex_array_vararray():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse(\"2 3 4 5 6\")\n\n\ndef test_complex_array_vararray2():\n    config = {'pedantic': True}\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 = {'pedantic': True}\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 = {'pedantic': True}\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\n@raises(exceptions.E03)\ndef test_complex():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3\")\n\n\n@raises(exceptions.E04)\ndef test_bit():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='bit',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"T\")\n\n\ndef test_bit_mask():\n    config = {'pedantic': True}\n    with catch_warnings(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\n@raises(exceptions.E05)\ndef test_boolean():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='boolean',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse('YES')\n\n\ndef test_boolean_array():\n    config = {'pedantic': True}\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\n@raises(exceptions.E06)\ndef test_invalid_type():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='foobar',\n        config=config)\n    c = converters.get_converter(field, config=config)\n\n\ndef test_precision():\n    config = {'pedantic': True}\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\n@raises(exceptions.W51)\ndef test_integer_overflow():\n    config = {'pedantic': True}\n\n    field = tree.Field(\n        None, name='c', datatype='int', config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse('-2208988800', config=config)\n\n\ndef test_float_default_precision():\n    config = {'pedantic': True}\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":4744,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":33,"id":4745,"name":"conf","nodeType":"Attribute","startLoc":33,"text":"conf"},{"className":"FloatingPoint","col":0,"comment":"\n    The base class for floating-point datatypes.\n    ","endLoc":763,"id":4746,"nodeType":"Class","startLoc":655,"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('.{:d}g'.format(int(precision[1:])))\n            elif precision.startswith(\"F\"):\n                format_parts.append('.{:d}f'.format(int(precision[1:])))\n            else:\n                format_parts.append('.{:d}f'.format(int(precision)))\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('pedantic'):\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(\"Invalid floating point value '{}'\".format(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.tostring()\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":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":4747,"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()"},{"col":4,"comment":"null","endLoc":704,"header":"def __init__(self, field, config=None, pos=None)","id":4748,"name":"__init__","nodeType":"Function","startLoc":661,"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('.{:d}g'.format(int(precision[1:])))\n            elif precision.startswith(\"F\"):\n                format_parts.append('.{:d}f'.format(int(precision[1:])))\n            else:\n                format_parts.append('.{:d}f'.format(int(precision)))\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('pedantic'):\n            self.parse = self._parse_pedantic\n        else:\n            self.parse = self._parse_permissive"},{"attributeType":"null","col":8,"comment":"null","endLoc":560,"id":4749,"name":"title","nodeType":"Attribute","startLoc":560,"text":"self.title"},{"fileName":"table_test.py","filePath":"astropy/io/votable/tests","id":4750,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nTest the conversion to/from astropy.table\n\"\"\"\n\n\nimport io\nimport os\n\nimport pathlib\nimport numpy as np\n\nfrom ....utils.data import get_pkg_data_filename, get_pkg_data_fileobj\nfrom ..table import parse, writeto\nfrom .. import tree\n\n\ndef test_table(tmpdir):\n    # Read the VOTABLE\n    votable = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\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']\n        if 'arraysize' in d:\n            assert field.arraysize == d['arraysize']\n\n    writeto(votable2, os.path.join(str(tmpdir), \"through_table.xml\"))\n\n\ndef test_read_through_table_interface(tmpdir):\n    from ....table import Table\n\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    fn = os.path.join(str(tmpdir), \"table_interface.xml\")\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    from ....table import Table\n\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_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_table_read_with_unnamed_tables():\n    \"\"\"\n    Issue #927\n    \"\"\"\n    from ....table import Table\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    from ....table import Table, Column\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    from ....table import Table, Column\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.3\"' 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.3\"' in obuff\n    assert b'BINARY2' in obuff\n    assert b'TABLEDATA' not in obuff\n\n\ndef test_empty_table():\n    votable = parse(\n        get_pkg_data_filename('data/empty_table.xml'),\n        pedantic=False)\n    table = votable.get_first_table()\n    astropy_table = table.to_table()\n"},{"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":3493,"header":"def get_first_table(self)","id":4751,"name":"get_first_table","nodeType":"Function","startLoc":3485,"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.\")"},{"col":0,"comment":"null","endLoc":25,"header":"@raises(exceptions.E13)\ndef test_invalid_arraysize()","id":4752,"name":"test_invalid_arraysize","nodeType":"Function","startLoc":21,"text":"@raises(exceptions.E13)\ndef test_invalid_arraysize():\n    field = tree.Field(\n        None, name='broken', datatype='char', arraysize='foo')\n    converters.get_converter(field)"},{"attributeType":"null","col":8,"comment":"null","endLoc":561,"id":4753,"name":"value","nodeType":"Attribute","startLoc":561,"text":"self.value"},{"col":4,"comment":"\n        Get a table by its ordinal position in the file.\n        ","endLoc":3517,"header":"def get_table_by_index(self, idx)","id":4754,"name":"get_table_by_index","nodeType":"Function","startLoc":3509,"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            \"No table at index {:d} found in VOTABLE file.\".format(idx))"},{"attributeType":"null","col":8,"comment":"null","endLoc":546,"id":4755,"name":"_config","nodeType":"Attribute","startLoc":546,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":558,"id":4756,"name":"content_role","nodeType":"Attribute","startLoc":558,"text":"self.content_role"},{"col":0,"comment":"null","endLoc":69,"header":"def test_table(tmpdir)","id":4757,"name":"test_table","nodeType":"Function","startLoc":18,"text":"def test_table(tmpdir):\n    # Read the VOTABLE\n    votable = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\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']\n        if 'arraysize' in d:\n            assert field.arraysize == d['arraysize']\n\n    writeto(votable2, os.path.join(str(tmpdir), \"through_table.xml\"))"},{"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":806,"id":4758,"nodeType":"Class","startLoc":638,"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 ... 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":"[*required*] The key of the key-value pair.","endLoc":691,"header":"@property\n    def name(self)","id":4759,"name":"name","nodeType":"Function","startLoc":688,"text":"@property\n    def name(self):\n        \"\"\"[*required*] The key of the key-value pair.\"\"\"\n        return self._name"},{"col":4,"comment":"null","endLoc":698,"header":"@name.setter\n    def name(self, name)","id":4760,"name":"name","nodeType":"Function","startLoc":693,"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":"\n        Recursively iterate over all FIELD_ and PARAM_ elements in the\n        VOTABLE_ file.\n        ","endLoc":3526,"header":"def iter_fields_and_params(self)","id":4761,"name":"iter_fields_and_params","nodeType":"Function","startLoc":3519,"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":3554,"header":"def iter_values(self)","id":4762,"name":"iter_values","nodeType":"Function","startLoc":3548,"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":4,"comment":"\n        [*required*] The value of the key-value pair.  (Always stored\n        as a string or unicode string).\n        ","endLoc":706,"header":"@property\n    def value(self)","id":4763,"name":"value","nodeType":"Function","startLoc":700,"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"},{"col":4,"comment":"null","endLoc":713,"header":"@value.setter\n    def value(self, value)","id":4764,"name":"value","nodeType":"Function","startLoc":708,"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"},{"col":4,"comment":"\n        Recursively iterate over all GROUP_ elements in the VOTABLE_\n        file.\n        ","endLoc":3570,"header":"def iter_groups(self)","id":4765,"name":"iter_groups","nodeType":"Function","startLoc":3563,"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":"The content inside the INFO element.","endLoc":718,"header":"@property\n    def content(self)","id":4766,"name":"content","nodeType":"Function","startLoc":715,"text":"@property\n    def content(self):\n        \"\"\"The content inside the INFO element.\"\"\"\n        return self._content"},{"col":4,"comment":"null","endLoc":723,"header":"@content.setter\n    def content(self, content)","id":4767,"name":"content","nodeType":"Function","startLoc":720,"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":727,"header":"@content.deleter\n    def content(self)","id":4768,"name":"content","nodeType":"Function","startLoc":725,"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":735,"header":"@property\n    def ref(self)","id":4769,"name":"ref","nodeType":"Function","startLoc":729,"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":758,"header":"@ref.setter\n    def ref(self, ref)","id":4770,"name":"ref","nodeType":"Function","startLoc":737,"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":"\n        Recursively iterate over all COOSYS_ elements in the VOTABLE_\n        file.\n        ","endLoc":3595,"header":"def iter_coosys(self)","id":4771,"name":"iter_coosys","nodeType":"Function","startLoc":3586,"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 INFO_ elements in the VOTABLE_\n        file.\n        ","endLoc":3610,"header":"def iter_info(self)","id":4772,"name":"iter_info","nodeType":"Function","startLoc":3601,"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":"\n        Set the output storage format of all tables in the file.\n        ","endLoc":3621,"header":"def set_all_tables_format(self, format)","id":4773,"name":"set_all_tables_format","nodeType":"Function","startLoc":3616,"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"},{"col":0,"comment":"null","endLoc":39,"header":"def test_oversize_char()","id":4774,"name":"test_oversize_char","nodeType":"Function","startLoc":28,"text":"def test_oversize_char():\n    config = {'pedantic': True}\n    with catch_warnings(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 catch_warnings(exceptions.W46) as w:\n        c.parse(\"XXX\")\n    assert len(w) == 1"},{"col":4,"comment":"null","endLoc":762,"header":"@ref.deleter\n    def ref(self)","id":4775,"name":"ref","nodeType":"Function","startLoc":760,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"A string specifying the units_ for the INFO_.","endLoc":767,"header":"@property\n    def unit(self)","id":4776,"name":"unit","nodeType":"Function","startLoc":764,"text":"@property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the INFO_.\"\"\"\n        return self._unit"},{"col":4,"comment":"null","endLoc":795,"header":"@unit.setter\n    def unit(self, unit)","id":4777,"name":"unit","nodeType":"Function","startLoc":769,"text":"@unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from ... 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":0,"comment":"null","endLoc":86,"header":"def test_read_through_table_interface(tmpdir)","id":4778,"name":"test_read_through_table_interface","nodeType":"Function","startLoc":72,"text":"def test_read_through_table_interface(tmpdir):\n    from ....table import Table\n\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    fn = os.path.join(str(tmpdir), \"table_interface.xml\")\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":4,"comment":"null","endLoc":3495,"id":4779,"name":"get_table_by_id","nodeType":"Attribute","startLoc":3495,"text":"get_table_by_id"},{"col":0,"comment":"\n    Get the default unit format as specified in the VOTable spec.\n    ","endLoc":174,"header":"def _get_default_unit_format(config)","id":4780,"name":"_get_default_unit_format","nodeType":"Function","startLoc":168,"text":"def _get_default_unit_format(config):\n    \"\"\"\n    Get the default unit format as specified in the VOTable spec.\n    \"\"\"\n    # In the future, this should take into account the VOTable\n    # version.\n    return 'cds'"},{"attributeType":"null","col":4,"comment":"null","endLoc":3502,"id":4781,"name":"get_tables_by_utype","nodeType":"Attribute","startLoc":3502,"text":"get_tables_by_utype"},{"col":0,"comment":"\n    Get the unit format based on the configuration.\n    ","endLoc":185,"header":"def _get_unit_format(config)","id":4782,"name":"_get_unit_format","nodeType":"Function","startLoc":177,"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":0,"comment":"null","endLoc":95,"header":"def test_read_through_table_interface2()","id":4783,"name":"test_read_through_table_interface2","nodeType":"Function","startLoc":89,"text":"def test_read_through_table_interface2():\n    from ....table import Table\n\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":4,"comment":"null","endLoc":3528,"id":4784,"name":"get_field_by_id","nodeType":"Attribute","startLoc":3528,"text":"get_field_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3535,"id":4785,"name":"get_fields_by_utype","nodeType":"Attribute","startLoc":3535,"text":"get_fields_by_utype"},{"col":0,"comment":"null","endLoc":48,"header":"def test_char_mask()","id":4786,"name":"test_char_mask","nodeType":"Function","startLoc":42,"text":"def test_char_mask():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='char',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''"},{"col":0,"comment":"null","endLoc":107,"header":"def test_names_over_ids()","id":4787,"name":"test_names_over_ids","nodeType":"Function","startLoc":98,"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":4,"comment":"null","endLoc":3542,"id":4788,"name":"get_field_by_id_or_name","nodeType":"Attribute","startLoc":3542,"text":"get_field_by_id_or_name"},{"col":4,"comment":"null","endLoc":799,"header":"@unit.deleter\n    def unit(self)","id":4789,"name":"unit","nodeType":"Function","startLoc":797,"text":"@unit.deleter\n    def unit(self):\n        self._unit = None"},{"col":4,"comment":"null","endLoc":806,"header":"def to_xml(self, w, **kwargs)","id":4790,"name":"to_xml","nodeType":"Function","startLoc":801,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":3556,"id":4791,"name":"get_values_by_id","nodeType":"Attribute","startLoc":3556,"text":"get_values_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3572,"id":4792,"name":"get_group_by_id","nodeType":"Attribute","startLoc":3572,"text":"get_group_by_id"},{"col":0,"comment":"\n    Issue #927\n    ","endLoc":119,"header":"def test_table_read_with_unnamed_tables()","id":4793,"name":"test_table_read_with_unnamed_tables","nodeType":"Function","startLoc":110,"text":"def test_table_read_with_unnamed_tables():\n    \"\"\"\n    Issue #927\n    \"\"\"\n    from ....table import Table\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"},{"col":0,"comment":"null","endLoc":60,"header":"def test_oversize_unicode()","id":4794,"name":"test_oversize_unicode","nodeType":"Function","startLoc":51,"text":"def test_oversize_unicode():\n    config = {'pedantic': True}\n    with catch_warnings(exceptions.W46) as w:\n        field = tree.Field(\n            None, name='c2', datatype='unicodeChar',\n            config=config)\n        c = converters.get_converter(field, config=config)\n\n        c.parse(\"XXX\")\n    assert len(w) == 1"},{"attributeType":"null","col":4,"comment":"null","endLoc":3579,"id":4795,"name":"get_groups_by_utype","nodeType":"Attribute","startLoc":3579,"text":"get_groups_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":3597,"id":4796,"name":"get_coosys_by_id","nodeType":"Attribute","startLoc":3597,"text":"get_coosys_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":3612,"id":4797,"name":"get_info_by_id","nodeType":"Attribute","startLoc":3612,"text":"get_info_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":646,"id":4798,"name":"_element_name","nodeType":"Attribute","startLoc":646,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":3242,"id":4799,"name":"_infos","nodeType":"Attribute","startLoc":3242,"text":"self._infos"},{"col":0,"comment":"null","endLoc":69,"header":"def test_unicode_mask()","id":4800,"name":"test_unicode_mask","nodeType":"Function","startLoc":63,"text":"def test_unicode_mask():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='unicodeChar',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    assert c.output(\"Foo\", True) == ''"},{"col":0,"comment":"\n    Testing when votable is passed as pathlib.Path object #4412.\n    ","endLoc":130,"header":"def test_votable_path_object()","id":4801,"name":"test_votable_path_object","nodeType":"Function","startLoc":122,"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":4,"comment":"null","endLoc":647,"id":4802,"name":"_attr_list_11","nodeType":"Attribute","startLoc":647,"text":"_attr_list_11"},{"col":0,"comment":"null","endLoc":139,"header":"def test_from_table_without_mask()","id":4803,"name":"test_from_table_without_mask","nodeType":"Function","startLoc":133,"text":"def test_from_table_without_mask():\n    from ....table import Table, Column\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":4,"comment":"null","endLoc":648,"id":4804,"name":"_attr_list_12","nodeType":"Attribute","startLoc":648,"text":"_attr_list_12"},{"col":0,"comment":"null","endLoc":79,"header":"@raises(exceptions.E02)\ndef test_wrong_number_of_elements()","id":4805,"name":"test_wrong_number_of_elements","nodeType":"Function","startLoc":72,"text":"@raises(exceptions.E02)\ndef test_wrong_number_of_elements():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='int', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse(\"2 3 4 5 6\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":649,"id":4806,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":649,"text":"_utype_in_v1_2"},{"attributeType":"null","col":8,"comment":"null","endLoc":665,"id":4807,"name":"xtype","nodeType":"Attribute","startLoc":665,"text":"self.xtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":3234,"id":4808,"name":"_pos","nodeType":"Attribute","startLoc":3234,"text":"self._pos"},{"attributeType":"null","col":8,"comment":"null","endLoc":3238,"id":4809,"name":"description","nodeType":"Attribute","startLoc":3238,"text":"self.description"},{"col":4,"comment":"null","endLoc":757,"header":"def binoutput(self, value, mask)","id":4810,"name":"binoutput","nodeType":"Function","startLoc":752,"text":"def binoutput(self, value, mask):\n        if mask:\n            return self._null_binoutput\n\n        value = _ensure_bigendian(value)\n        return value.tostring()"},{"col":4,"comment":"null","endLoc":750,"header":"def output(self, value, mask)","id":4811,"name":"output","nodeType":"Function","startLoc":730,"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(\"Invalid floating point value '{}'\".format(value))"},{"attributeType":"null","col":8,"comment":"null","endLoc":3240,"id":4812,"name":"_coordinate_systems","nodeType":"Attribute","startLoc":3240,"text":"self._coordinate_systems"},{"col":0,"comment":"null","endLoc":90,"header":"@raises(ValueError)\ndef test_float_mask()","id":4813,"name":"test_float_mask","nodeType":"Function","startLoc":82,"text":"@raises(ValueError)\ndef test_float_mask():\n    config = {'pedantic': True}\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    c.parse('null')"},{"col":4,"comment":"null","endLoc":707,"header":"def supports_empty_values(self, config)","id":4814,"name":"supports_empty_values","nodeType":"Function","startLoc":706,"text":"def supports_empty_values(self, config):\n        return True"},{"col":4,"comment":"null","endLoc":713,"header":"def _parse_pedantic(self, value, config=None, pos=None)","id":4815,"name":"_parse_pedantic","nodeType":"Function","startLoc":709,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":3237,"id":4816,"name":"ID","nodeType":"Attribute","startLoc":3237,"text":"self.ID"},{"attributeType":"None","col":8,"comment":"null","endLoc":698,"id":4817,"name":"_name","nodeType":"Attribute","startLoc":698,"text":"self._name"},{"col":4,"comment":"null","endLoc":724,"header":"def _parse_permissive(self, value, config=None, pos=None)","id":4818,"name":"_parse_permissive","nodeType":"Function","startLoc":715,"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":3243,"id":4819,"name":"_resources","nodeType":"Attribute","startLoc":3243,"text":"self._resources"},{"col":4,"comment":"\n        Lookup the :class:`Field` instance that this :class:`FieldRef`\n        references.\n        ","endLoc":1789,"header":"def get_ref(self)","id":4820,"name":"get_ref","nodeType":"Function","startLoc":1779,"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            \"No field named '{}'\".format(self.ref),\n            self._config, self._pos, KeyError)"},{"attributeType":"null","col":8,"comment":"null","endLoc":3251,"id":4821,"name":"_version","nodeType":"Attribute","startLoc":3251,"text":"self._version"},{"col":4,"comment":"null","endLoc":728,"header":"@property\n    def output_format(self)","id":4822,"name":"output_format","nodeType":"Function","startLoc":726,"text":"@property\n    def output_format(self):\n        return self._output_format"},{"col":4,"comment":"null","endLoc":760,"header":"def _filter_nan(self, value, mask)","id":4823,"name":"_filter_nan","nodeType":"Function","startLoc":759,"text":"def _filter_nan(self, value, mask):\n        return np.where(mask, np.nan, value)"},{"col":4,"comment":"null","endLoc":763,"header":"def _filter_null(self, value, mask)","id":4824,"name":"_filter_null","nodeType":"Function","startLoc":762,"text":"def _filter_null(self, value, mask):\n        return np.where(mask, self.null, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":659,"id":4825,"name":"default","nodeType":"Attribute","startLoc":659,"text":"default"},{"attributeType":"null","col":8,"comment":"null","endLoc":688,"id":4826,"name":"_output_format","nodeType":"Attribute","startLoc":688,"text":"self._output_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":690,"id":4827,"name":"nan","nodeType":"Attribute","startLoc":690,"text":"self.nan"},{"attributeType":"null","col":12,"comment":"null","endLoc":697,"id":4828,"name":"_null_output","nodeType":"Attribute","startLoc":697,"text":"self._null_output"},{"attributeType":"null","col":12,"comment":"null","endLoc":698,"id":4829,"name":"_null_binoutput","nodeType":"Attribute","startLoc":698,"text":"self._null_binoutput"},{"attributeType":"function","col":12,"comment":"null","endLoc":699,"id":4830,"name":"filter_array","nodeType":"Attribute","startLoc":699,"text":"self.filter_array"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":4831,"name":"utype","nodeType":"Attribute","startLoc":669,"text":"self.utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":3233,"id":4832,"name":"_config","nodeType":"Attribute","startLoc":3233,"text":"self._config"},{"col":4,"comment":"null","endLoc":228,"header":"def test_paramref(self)","id":4833,"name":"test_paramref","nodeType":"Function","startLoc":224,"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'"},{"attributeType":"function","col":12,"comment":"null","endLoc":704,"id":4834,"name":"parse","nodeType":"Attribute","startLoc":704,"text":"self.parse"},{"attributeType":"null","col":8,"comment":"null","endLoc":3244,"id":4835,"name":"_groups","nodeType":"Attribute","startLoc":3244,"text":"self._groups"},{"attributeType":"null","col":8,"comment":"null","endLoc":3241,"id":4836,"name":"_params","nodeType":"Attribute","startLoc":3241,"text":"self._params"},{"className":"Double","col":0,"comment":"\n    Handles the double datatype.  Double-precision IEEE\n    floating-point.\n    ","endLoc":771,"id":4837,"nodeType":"Class","startLoc":766,"text":"class Double(FloatingPoint):\n    \"\"\"\n    Handles the double datatype.  Double-precision IEEE\n    floating-point.\n    \"\"\"\n    format = 'f8'"},{"attributeType":"null","col":4,"comment":"null","endLoc":771,"id":4838,"name":"format","nodeType":"Attribute","startLoc":771,"text":"format"},{"col":4,"comment":"\n        Lookup the :class:`Param` instance that this :class:``PARAMref``\n        references.\n        ","endLoc":1855,"header":"def get_ref(self)","id":4839,"name":"get_ref","nodeType":"Function","startLoc":1845,"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            \"No params named '{}'\".format(self.ref),\n            self._config, self._pos, KeyError)"},{"className":"Float","col":0,"comment":"\n    Handles the float datatype.  Single-precision IEEE floating-point.\n    ","endLoc":778,"id":4840,"nodeType":"Class","startLoc":774,"text":"class Float(FloatingPoint):\n    \"\"\"\n    Handles the float datatype.  Single-precision IEEE floating-point.\n    \"\"\"\n    format = 'f4'"},{"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":2962,"id":4841,"nodeType":"Class","startLoc":2001,"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:`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(\"Invalid format '{}'\".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                        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                        \"Columns '{}' not found in fields list\".format(columns))\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if not skip_table:\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                        \"Unknown encoding type '{}'\".format(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                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                    \"Unknown encoding type '{}'\".format(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=\"_g{0}\".format(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=\"(in row {:d}, col '{}')\".format(\n                                    row, 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 ...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 = '{0}{1}'.format(name, i)\n                    i += 1\n                unique_names.append(new_name)\n            array = self.array.copy()\n            array.dtype.names = unique_names\n            names = unique_names\n        else:\n            array = self.array\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, 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":4,"comment":"null","endLoc":778,"id":4842,"name":"format","nodeType":"Attribute","startLoc":778,"text":"format"},{"col":0,"comment":"null","endLoc":160,"header":"def test_write_with_format()","id":4843,"name":"test_write_with_format","nodeType":"Function","startLoc":142,"text":"def test_write_with_format():\n    from ....table import Table, Column\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.3\"' 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.3\"' in obuff\n    assert b'BINARY2' in obuff\n    assert b'TABLEDATA' not in obuff"},{"className":"Integer","col":0,"comment":"\n    The base class for all the integral datatypes.\n    ","endLoc":854,"id":4844,"nodeType":"Class","startLoc":781,"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.tostring()\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"},{"attributeType":"null","col":12,"comment":"null","endLoc":674,"id":4845,"name":"_attr_list","nodeType":"Attribute","startLoc":674,"text":"self._attr_list"},{"col":4,"comment":"null","endLoc":788,"header":"def __init__(self, field, config=None, pos=None)","id":4846,"name":"__init__","nodeType":"Function","startLoc":787,"text":"def __init__(self, field, config=None, pos=None):\n        Numeric.__init__(self, field, config, pos)"},{"col":4,"comment":"null","endLoc":828,"header":"def parse(self, value, config=None, pos=None)","id":4847,"name":"parse","nodeType":"Function","startLoc":790,"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"},{"col":4,"comment":"null","endLoc":2062,"header":"def __repr__(self)","id":4848,"name":"__repr__","nodeType":"Function","startLoc":2061,"text":"def __repr__(self):\n        return repr(self.to_table())"},{"col":4,"comment":"null","endLoc":231,"header":"def test_iter_fields_and_params_on_a_group(self)","id":4849,"name":"test_iter_fields_and_params_on_a_group","nodeType":"Function","startLoc":230,"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":"\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":2876,"header":"def to_table(self, use_names_over_ids=False)","id":4850,"name":"to_table","nodeType":"Function","startLoc":2826,"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 ...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 = '{0}{1}'.format(name, i)\n                    i += 1\n                unique_names.append(new_name)\n            array = self.array.copy()\n            array.dtype.names = unique_names\n            names = unique_names\n        else:\n            array = self.array\n            names = [field.ID for field in self.fields]\n\n        table = Table(self.array, 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"},{"col":4,"comment":"null","endLoc":234,"header":"def test_iter_groups_on_a_group(self)","id":4851,"name":"test_iter_groups_on_a_group","nodeType":"Function","startLoc":233,"text":"def test_iter_groups_on_a_group(self):\n        assert len(list(self.table.groups[1].iter_groups())) == 1"},{"col":0,"comment":"null","endLoc":99,"header":"def test_float_mask_permissive()","id":4852,"name":"test_float_mask_permissive","nodeType":"Function","startLoc":93,"text":"def test_float_mask_permissive():\n    config = {'pedantic': False}\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('null') == (c.null, True)"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":656,"id":4853,"name":"_config","nodeType":"Attribute","startLoc":656,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":666,"id":4854,"name":"ref","nodeType":"Attribute","startLoc":666,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":667,"id":4855,"name":"unit","nodeType":"Attribute","startLoc":667,"text":"self.unit"},{"col":4,"comment":"null","endLoc":239,"header":"def test_iter_groups(self)","id":4856,"name":"test_iter_groups","nodeType":"Function","startLoc":236,"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"},{"col":4,"comment":"null","endLoc":836,"header":"def output(self, value, mask)","id":4857,"name":"output","nodeType":"Function","startLoc":830,"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":4,"comment":"null","endLoc":846,"header":"def binoutput(self, value, mask)","id":4858,"name":"binoutput","nodeType":"Function","startLoc":838,"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.tostring()"},{"col":4,"comment":"null","endLoc":244,"header":"def test_ref_table(self)","id":4859,"name":"test_ref_table","nodeType":"Function","startLoc":241,"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":"None","col":12,"comment":"null","endLoc":772,"id":4860,"name":"_unit","nodeType":"Attribute","startLoc":772,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":4861,"name":"ucd","nodeType":"Attribute","startLoc":668,"text":"self.ucd"},{"col":4,"comment":"null","endLoc":247,"header":"def test_iter_coosys(self)","id":4862,"name":"test_iter_coosys","nodeType":"Function","startLoc":246,"text":"def test_iter_coosys(self):\n        assert len(list(self.votable.iter_coosys())) == 1"},{"col":0,"comment":"null","endLoc":168,"header":"def test_empty_table()","id":4863,"name":"test_empty_table","nodeType":"Function","startLoc":163,"text":"def test_empty_table():\n    votable = parse(\n        get_pkg_data_filename('data/empty_table.xml'),\n        pedantic=False)\n    table = votable.get_first_table()\n    astropy_table = table.to_table()"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":4864,"name":"array","nodeType":"Attribute","startLoc":215,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":4865,"name":"votable","nodeType":"Attribute","startLoc":211,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":4866,"name":"table","nodeType":"Attribute","startLoc":214,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":216,"id":4867,"name":"mask","nodeType":"Attribute","startLoc":216,"text":"self.mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":663,"id":4868,"name":"name","nodeType":"Attribute","startLoc":663,"text":"self.name"},{"className":"TestParse","col":0,"comment":"null","endLoc":606,"id":4869,"nodeType":"Class","startLoc":277,"text":"class TestParse:\n    def setup_class(self):\n        self.votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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            [b'String & test', b'String &amp; test', b'XXXX',\n             b'', b''])\n\n    def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.string_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            [b'Fixed stri', b'0123456789', b'XXXX', b'', b''])\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) == '[</>]'"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":4870,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"table_test.py#<anonymous>","id":4871,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nTest the conversion to/from astropy.table\n\"\"\""},{"attributeType":"None","col":8,"comment":"null","endLoc":758,"id":4872,"name":"_ref","nodeType":"Attribute","startLoc":758,"text":"self._ref"},{"fileName":"tree_test.py","filePath":"astropy/io/votable/tests","id":4873,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# LOCAL\nfrom .. import exceptions\nfrom .. import tree\nfrom ....tests.helper import raises\n\n\n@raises(exceptions.W07)\ndef test_check_astroyear_fail():\n    config = {'pedantic': True}\n    field = tree.Field(None, name='astroyear')\n    tree.check_astroyear('X2100', field, config)\n\n\n@raises(exceptions.W08)\ndef test_string_fail():\n    config = {'pedantic': True}\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(votable, name='Test', datatype=\"float\", unit=\"mag\")])\n"},{"col":4,"comment":"null","endLoc":284,"header":"def setup_class(self)","id":4874,"name":"setup_class","nodeType":"Function","startLoc":278,"text":"def setup_class(self):\n        self.votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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":12,"header":"@raises(exceptions.W07)\ndef test_check_astroyear_fail()","id":4875,"name":"test_check_astroyear_fail","nodeType":"Function","startLoc":8,"text":"@raises(exceptions.W07)\ndef test_check_astroyear_fail():\n    config = {'pedantic': True}\n    field = tree.Field(None, name='astroyear')\n    tree.check_astroyear('X2100', field, config)"},{"col":4,"comment":"null","endLoc":2065,"header":"def __bytes__(self)","id":4876,"name":"__bytes__","nodeType":"Function","startLoc":2064,"text":"def __bytes__(self):\n        return bytes(self.to_table())"},{"col":4,"comment":"null","endLoc":292,"header":"def test_string_test(self)","id":4877,"name":"test_string_test","nodeType":"Function","startLoc":286,"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            [b'String & test', b'String &amp; test', b'XXXX',\n             b'', b''])"},{"col":4,"comment":"null","endLoc":299,"header":"def test_fixed_string_test(self)","id":4878,"name":"test_fixed_string_test","nodeType":"Function","startLoc":294,"text":"def test_fixed_string_test(self):\n        assert issubclass(self.array['string_test_2'].dtype.type,\n                          np.string_)\n        assert_array_equal(\n            self.array['string_test_2'],\n            [b'Fixed stri', b'0123456789', b'XXXX', b'', b''])"},{"col":4,"comment":"null","endLoc":307,"header":"def test_unicode_test(self)","id":4879,"name":"test_unicode_test","nodeType":"Function","startLoc":301,"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":315,"header":"def test_fixed_unicode_test(self)","id":4880,"name":"test_fixed_unicode_test","nodeType":"Function","startLoc":309,"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":2068,"header":"def __str__(self)","id":4881,"name":"__str__","nodeType":"Function","startLoc":2067,"text":"def __str__(self):\n        return str(self.to_table())"},{"col":4,"comment":"null","endLoc":322,"header":"def test_unsignedByte(self)","id":4882,"name":"test_unsignedByte","nodeType":"Function","startLoc":317,"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":329,"header":"def test_short(self)","id":4883,"name":"test_short","nodeType":"Function","startLoc":324,"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":2072,"header":"@property\n    def ref(self)","id":4884,"name":"ref","nodeType":"Function","startLoc":2070,"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":2102,"header":"@ref.setter\n    def ref(self, ref)","id":4885,"name":"ref","nodeType":"Function","startLoc":2074,"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":4,"comment":"null","endLoc":338,"header":"def test_int(self)","id":4886,"name":"test_int","nodeType":"Function","startLoc":331,"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":348,"header":"def test_long(self)","id":4887,"name":"test_long","nodeType":"Function","startLoc":340,"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":356,"header":"def test_double(self)","id":4888,"name":"test_double","nodeType":"Function","startLoc":350,"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":364,"header":"def test_float(self)","id":4889,"name":"test_float","nodeType":"Function","startLoc":358,"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":381,"header":"def test_array(self)","id":4890,"name":"test_array","nodeType":"Function","startLoc":366,"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]"},{"col":4,"comment":"null","endLoc":854,"header":"def filter_array(self, value, mask)","id":4891,"name":"filter_array","nodeType":"Function","startLoc":848,"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"},{"col":4,"comment":"null","endLoc":387,"header":"def test_bit(self)","id":4892,"name":"test_bit","nodeType":"Function","startLoc":383,"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])"},{"col":4,"comment":"null","endLoc":391,"header":"def test_bit_mask(self)","id":4893,"name":"test_bit_mask","nodeType":"Function","startLoc":389,"text":"def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":416,"header":"def test_bitarray(self)","id":4894,"name":"test_bitarray","nodeType":"Function","startLoc":393,"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]]])"},{"attributeType":"null","col":4,"comment":"null","endLoc":785,"id":4895,"name":"default","nodeType":"Attribute","startLoc":785,"text":"default"},{"col":4,"comment":"null","endLoc":438,"header":"def test_bitarray_mask(self)","id":4896,"name":"test_bitarray_mask","nodeType":"Function","startLoc":418,"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]]])"},{"attributeType":"null","col":8,"comment":"null","endLoc":657,"id":4897,"name":"_pos","nodeType":"Attribute","startLoc":657,"text":"self._pos"},{"col":4,"comment":"null","endLoc":454,"header":"def test_bitvararray(self)","id":4898,"name":"test_bitvararray","nodeType":"Function","startLoc":440,"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)"},{"col":0,"comment":"null","endLoc":109,"header":"@raises(exceptions.E02)\ndef test_complex_array_vararray()","id":4899,"name":"test_complex_array_vararray","nodeType":"Function","startLoc":102,"text":"@raises(exceptions.E02)\ndef test_complex_array_vararray():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='floatComplex', arraysize='2x3*',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse(\"2 3 4 5 6\")"},{"className":"UnsignedByte","col":0,"comment":"\n    Handles the unsignedByte datatype.  Unsigned 8-bit integer.\n    ","endLoc":863,"id":4900,"nodeType":"Class","startLoc":857,"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'"},{"col":4,"comment":"null","endLoc":479,"header":"def test_bitvararray2(self)","id":4901,"name":"test_bitvararray2","nodeType":"Function","startLoc":456,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":861,"id":4902,"name":"format","nodeType":"Attribute","startLoc":861,"text":"format"},{"attributeType":"null","col":4,"comment":"null","endLoc":862,"id":4903,"name":"val_range","nodeType":"Attribute","startLoc":862,"text":"val_range"},{"col":4,"comment":"null","endLoc":487,"header":"def test_floatComplex(self)","id":4904,"name":"test_floatComplex","nodeType":"Function","startLoc":481,"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])"},{"attributeType":"null","col":4,"comment":"null","endLoc":863,"id":4905,"name":"bit_size","nodeType":"Attribute","startLoc":863,"text":"bit_size"},{"col":4,"comment":"null","endLoc":496,"header":"def test_doubleComplex(self)","id":4906,"name":"test_doubleComplex","nodeType":"Function","startLoc":489,"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])"},{"className":"Short","col":0,"comment":"\n    Handles the short datatype.  Signed 16-bit integer.\n    ","endLoc":872,"id":4907,"nodeType":"Class","startLoc":866,"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":870,"id":4908,"name":"format","nodeType":"Attribute","startLoc":870,"text":"format"},{"col":4,"comment":"null","endLoc":502,"header":"def test_doubleComplexArray(self)","id":4909,"name":"test_doubleComplexArray","nodeType":"Function","startLoc":498,"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":4,"comment":"null","endLoc":871,"id":4910,"name":"val_range","nodeType":"Attribute","startLoc":871,"text":"val_range"},{"col":4,"comment":"null","endLoc":508,"header":"def test_boolean(self)","id":4911,"name":"test_boolean","nodeType":"Function","startLoc":504,"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])"},{"attributeType":"null","col":4,"comment":"null","endLoc":872,"id":4912,"name":"bit_size","nodeType":"Attribute","startLoc":872,"text":"bit_size"},{"className":"Int","col":0,"comment":"\n    Handles the int datatype.  Signed 32-bit integer.\n    ","endLoc":881,"id":4913,"nodeType":"Class","startLoc":875,"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":879,"id":4914,"name":"format","nodeType":"Attribute","startLoc":879,"text":"format"},{"attributeType":"null","col":4,"comment":"null","endLoc":880,"id":4915,"name":"val_range","nodeType":"Attribute","startLoc":880,"text":"val_range"},{"col":4,"comment":"null","endLoc":512,"header":"def test_boolean_mask(self)","id":4916,"name":"test_boolean_mask","nodeType":"Function","startLoc":510,"text":"def test_boolean_mask(self):\n        assert_array_equal(self.mask['boolean'],\n                           [False, False, False, False, True])"},{"col":4,"comment":"null","endLoc":522,"header":"def test_boolean_array(self)","id":4917,"name":"test_boolean_array","nodeType":"Function","startLoc":514,"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]])"},{"attributeType":"null","col":4,"comment":"null","endLoc":881,"id":4918,"name":"bit_size","nodeType":"Attribute","startLoc":881,"text":"bit_size"},{"col":4,"comment":"null","endLoc":530,"header":"def test_boolean_array_mask(self)","id":4919,"name":"test_boolean_array_mask","nodeType":"Function","startLoc":524,"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]])"},{"className":"Long","col":0,"comment":"\n    Handles the long datatype.  Signed 64-bit integer.\n    ","endLoc":890,"id":4920,"nodeType":"Class","startLoc":884,"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'"},{"col":4,"comment":"null","endLoc":536,"header":"def test_nulls(self)","id":4921,"name":"test_nulls","nodeType":"Function","startLoc":532,"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])"},{"attributeType":"null","col":4,"comment":"null","endLoc":888,"id":4922,"name":"format","nodeType":"Attribute","startLoc":888,"text":"format"},{"col":0,"comment":"null","endLoc":119,"header":"def test_complex_array_vararray2()","id":4923,"name":"test_complex_array_vararray2","nodeType":"Function","startLoc":112,"text":"def test_complex_array_vararray2():\n    config = {'pedantic': True}\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":889,"id":4924,"name":"val_range","nodeType":"Attribute","startLoc":889,"text":"val_range"},{"col":4,"comment":"null","endLoc":559,"header":"def test_nulls_array(self)","id":4925,"name":"test_nulls_array","nodeType":"Function","startLoc":538,"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":568,"header":"def test_double_array(self)","id":4926,"name":"test_double_array","nodeType":"Function","startLoc":561,"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])"},{"attributeType":"None","col":8,"comment":"null","endLoc":713,"id":4927,"name":"_value","nodeType":"Attribute","startLoc":713,"text":"self._value"},{"col":4,"comment":"null","endLoc":575,"header":"def test_bit_array2(self)","id":4928,"name":"test_bit_array2","nodeType":"Function","startLoc":570,"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":579,"header":"def test_bit_array2_mask(self)","id":4929,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":577,"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":583,"header":"def test_get_coosys_by_id(self)","id":4930,"name":"test_get_coosys_by_id","nodeType":"Function","startLoc":581,"text":"def test_get_coosys_by_id(self):\n        coosys = self.votable.get_coosys_by_id('J2000')\n        assert coosys.system == 'eq_FK5'"},{"attributeType":"null","col":4,"comment":"null","endLoc":890,"id":4931,"name":"bit_size","nodeType":"Attribute","startLoc":890,"text":"bit_size"},{"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":212,"header":"def check_astroyear(year, field, config=None, pos=None)","id":4932,"name":"check_astroyear","nodeType":"Function","startLoc":190,"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"},{"className":"ComplexArrayVarArray","col":0,"comment":"\n    Handles an array of variable-length arrays of complex numbers.\n    ","endLoc":914,"id":4933,"nodeType":"Class","startLoc":893,"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":914,"header":"def parse(self, value, config=None, pos=None)","id":4934,"name":"parse","nodeType":"Function","startLoc":898,"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"},{"col":0,"comment":"null","endLoc":130,"header":"def test_complex_array_vararray3()","id":4935,"name":"test_complex_array_vararray3","nodeType":"Function","startLoc":122,"text":"def test_complex_array_vararray3():\n    config = {'pedantic': True}\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))"},{"attributeType":"null","col":8,"comment":"null","endLoc":661,"id":4936,"name":"ID","nodeType":"Attribute","startLoc":661,"text":"self.ID"},{"col":0,"comment":"null","endLoc":18,"header":"@raises(exceptions.W08)\ndef test_string_fail()","id":4937,"name":"test_string_fail","nodeType":"Function","startLoc":15,"text":"@raises(exceptions.W08)\ndef test_string_fail():\n    config = {'pedantic': True}\n    tree.check_string(42, 'foo', config)"},{"attributeType":"null","col":8,"comment":"null","endLoc":723,"id":4938,"name":"_content","nodeType":"Attribute","startLoc":723,"text":"self._content"},{"col":0,"comment":"null","endLoc":141,"header":"def test_complex_vararray()","id":4939,"name":"test_complex_vararray","nodeType":"Function","startLoc":133,"text":"def test_complex_vararray():\n    config = {'pedantic': True}\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)"},{"col":0,"comment":"null","endLoc":31,"header":"def test_make_Fields()","id":4940,"name":"test_make_Fields","nodeType":"Function","startLoc":21,"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(votable, name='Test', datatype=\"float\", unit=\"mag\")])"},{"attributeType":"null","col":8,"comment":"null","endLoc":664,"id":4941,"name":"value","nodeType":"Attribute","startLoc":664,"text":"self.value"},{"col":4,"comment":"null","endLoc":588,"header":"def test_get_field_by_utype(self)","id":4942,"name":"test_get_field_by_utype","nodeType":"Function","startLoc":585,"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":0,"comment":"null","endLoc":151,"header":"@raises(exceptions.E03)\ndef test_complex()","id":4943,"name":"test_complex","nodeType":"Function","startLoc":144,"text":"@raises(exceptions.E03)\ndef test_complex():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='doubleComplex',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"1 2 3\")"},{"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":1126,"id":4944,"nodeType":"Class","startLoc":809,"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                            ['data', '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":844,"header":"def __repr__(self)","id":4945,"name":"__repr__","nodeType":"Function","startLoc":841,"text":"def __repr__(self):\n        buff = io.StringIO()\n        self.to_xml(XMLWriter(buff))\n        return buff.getvalue().strip()"},{"col":4,"comment":"null","endLoc":2106,"header":"@ref.deleter\n    def ref(self)","id":4946,"name":"ref","nodeType":"Function","startLoc":2104,"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:`votable-serialization`.\n        ","endLoc":2123,"header":"@property\n    def format(self)","id":4947,"name":"format","nodeType":"Function","startLoc":2108,"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:`votable-serialization`.\n        \"\"\"\n        return self._format"},{"col":4,"comment":"null","endLoc":2139,"header":"@format.setter\n    def format(self, format)","id":4948,"name":"format","nodeType":"Function","startLoc":2125,"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(\"Invalid format '{}'\".format(format),\n                     self._config, self._pos)\n        self._format = format"},{"className":"ComplexVarArray","col":0,"comment":"\n    Handles a variable-length array of complex numbers.\n    ","endLoc":937,"id":4949,"nodeType":"Class","startLoc":917,"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":937,"header":"def parse(self, value, config=None, pos=None)","id":4950,"name":"parse","nodeType":"Function","startLoc":922,"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":0,"comment":"null","endLoc":161,"header":"@raises(exceptions.E04)\ndef test_bit()","id":4951,"name":"test_bit","nodeType":"Function","startLoc":154,"text":"@raises(exceptions.E04)\ndef test_bit():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='bit',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    x = c.parse(\"T\")"},{"col":4,"comment":"null","endLoc":596,"header":"def test_get_info_by_id(self)","id":4952,"name":"test_get_info_by_id","nodeType":"Function","startLoc":590,"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":"null","endLoc":606,"header":"def test_repr(self)","id":4953,"name":"test_repr","nodeType":"Function","startLoc":598,"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) == '[</>]'"},{"col":0,"comment":"null","endLoc":172,"header":"def test_bit_mask()","id":4954,"name":"test_bit_mask","nodeType":"Function","startLoc":164,"text":"def test_bit_mask():\n    config = {'pedantic': True}\n    with catch_warnings(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":1088,"header":"def to_xml(self, w, **kwargs)","id":4955,"name":"to_xml","nodeType":"Function","startLoc":1059,"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":"\n        [*immutable*] The number of rows in the table, as specified in\n        the XML file.\n        ","endLoc":2147,"header":"@property\n    def nrows(self)","id":4956,"name":"nrows","nodeType":"Function","startLoc":2141,"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":2155,"header":"@property\n    def fields(self)","id":4957,"name":"fields","nodeType":"Function","startLoc":2149,"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":2163,"header":"@property\n    def params(self)","id":4958,"name":"params","nodeType":"Function","startLoc":2157,"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":2173,"header":"@property\n    def groups(self)","id":4959,"name":"groups","nodeType":"Function","startLoc":2165,"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":2181,"header":"@property\n    def links(self)","id":4960,"name":"links","nodeType":"Function","startLoc":2175,"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":2189,"header":"@property\n    def infos(self)","id":4961,"name":"infos","nodeType":"Function","startLoc":2183,"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":2197,"header":"def is_empty(self)","id":4962,"name":"is_empty","nodeType":"Function","startLoc":2191,"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"},{"className":"ComplexArray","col":0,"comment":"\n    Handles a fixed-size array of complex numbers.\n    ","endLoc":971,"id":4963,"nodeType":"Class","startLoc":940,"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":948,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":4964,"name":"__init__","nodeType":"Function","startLoc":946,"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":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":2237,"header":"def create_arrays(self, nrows=0, config=None)","id":4965,"name":"create_arrays","nodeType":"Function","startLoc":2199,"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":0,"comment":"null","endLoc":182,"header":"@raises(exceptions.E05)\ndef test_boolean()","id":4966,"name":"test_boolean","nodeType":"Function","startLoc":175,"text":"@raises(exceptions.E05)\ndef test_boolean():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='boolean',\n        config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse('YES')"},{"col":4,"comment":"null","endLoc":954,"header":"def parse(self, value, config=None, pos=None)","id":4967,"name":"parse","nodeType":"Function","startLoc":950,"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        Make sure that all names and titles in a list of fields are\n        unique, by appending numbers if necessary.\n        ","endLoc":1271,"header":"@classmethod\n    def uniqify_names(cls, fields)","id":4968,"name":"uniqify_names","nodeType":"Function","startLoc":1236,"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 + \"_{:d}\".format(i)\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 + \" {:d}\".format(i)\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":283,"id":4969,"name":"array","nodeType":"Attribute","startLoc":283,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":279,"id":4970,"name":"votable","nodeType":"Attribute","startLoc":279,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":282,"id":4971,"name":"table","nodeType":"Attribute","startLoc":282,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":284,"id":4972,"name":"mask","nodeType":"Attribute","startLoc":284,"text":"self.mask"},{"col":0,"comment":"null","endLoc":192,"header":"def test_boolean_array()","id":4973,"name":"test_boolean_array","nodeType":"Function","startLoc":185,"text":"def test_boolean_array():\n    config = {'pedantic': True}\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":"TestThroughTableData","col":0,"comment":"null","endLoc":639,"id":4974,"nodeType":"Class","startLoc":609,"text":"class TestThroughTableData(TestParse):\n    def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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":"\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":2249,"header":"def _resize_strategy(self, size)","id":4975,"name":"_resize_strategy","nodeType":"Function","startLoc":2239,"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":621,"header":"def setup_class(self)","id":4976,"name":"setup_class","nodeType":"Function","startLoc":610,"text":"def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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":2254,"header":"def _add_field(self, iterator, tag, data, config, pos)","id":4977,"name":"_add_field","nodeType":"Function","startLoc":2251,"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":"\n        Are the settings on this ``VALUE`` element all the same as the\n        XML defaults?\n        ","endLoc":1057,"header":"def is_defaults(self)","id":4978,"name":"is_defaults","nodeType":"Function","startLoc":1049,"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":"null","endLoc":971,"header":"def parse_parts(self, parts, config=None, pos=None)","id":4979,"name":"parse_parts","nodeType":"Function","startLoc":956,"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":944,"id":4980,"name":"vararray_type","nodeType":"Attribute","startLoc":944,"text":"vararray_type"},{"className":"Complex","col":0,"comment":"\n    The base class for complex numbers.\n    ","endLoc":1015,"id":4981,"nodeType":"Class","startLoc":974,"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":984,"header":"def __init__(self, field, config=None, pos=None)","id":4982,"name":"__init__","nodeType":"Function","startLoc":982,"text":"def __init__(self, field, config=None, pos=None):\n        FloatingPoint.__init__(self, field, config, pos)\n        Array.__init__(self, field, config, pos)"},{"fileName":"resource_test.py","filePath":"astropy/io/votable/tests","id":4983,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# LOCAL\nfrom .. import parse\nfrom ....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":0,"comment":"null","endLoc":201,"header":"@raises(exceptions.E06)\ndef test_invalid_type()","id":4985,"name":"test_invalid_type","nodeType":"Function","startLoc":195,"text":"@raises(exceptions.E06)\ndef test_invalid_type():\n    config = {'pedantic': True}\n    field = tree.Field(\n        None, name='c', datatype='foobar',\n        config=config)\n    c = converters.get_converter(field, config=config)"},{"col":4,"comment":"null","endLoc":2259,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":4986,"name":"_add_param","nodeType":"Function","startLoc":2256,"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":994,"header":"def parse(self, value, config=None, pos=None)","id":4987,"name":"parse","nodeType":"Function","startLoc":986,"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":625,"header":"def test_bit_mask(self)","id":4988,"name":"test_bit_mask","nodeType":"Function","startLoc":623,"text":"def test_bit_mask(self):\n        assert_array_equal(self.mask['bit'],\n                           [False, False, False, False, False])"},{"col":4,"comment":"null","endLoc":628,"header":"def test_bitarray_mask(self)","id":4989,"name":"test_bitarray_mask","nodeType":"Function","startLoc":627,"text":"def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])"},{"col":4,"comment":"null","endLoc":631,"header":"def test_bit_array2_mask(self)","id":4990,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":630,"text":"def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])"},{"col":4,"comment":"null","endLoc":639,"header":"def test_schema(self, tmpdir)","id":4991,"name":"test_schema","nodeType":"Function","startLoc":633,"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')"},{"col":4,"comment":"null","endLoc":2264,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":4992,"name":"_add_group","nodeType":"Function","startLoc":2261,"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":4,"comment":"\n        For integral datatypes, *null* is used to define the value\n        used for missing values.\n        ","endLoc":852,"header":"@property\n    def null(self)","id":4993,"name":"null","nodeType":"Function","startLoc":846,"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":866,"header":"@null.setter\n    def null(self, null)","id":4994,"name":"null","nodeType":"Function","startLoc":854,"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":"null","endLoc":2269,"header":"def _add_link(self, iterator, tag, data, config, pos)","id":4995,"name":"_add_link","nodeType":"Function","startLoc":2266,"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":22,"header":"def test_resource_groups()","id":4996,"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":0,"comment":"null","endLoc":217,"header":"def test_precision()","id":4997,"name":"test_precision","nodeType":"Function","startLoc":204,"text":"def test_precision():\n    config = {'pedantic': True}\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":"null","endLoc":870,"header":"@null.deleter\n    def null(self)","id":4998,"name":"null","nodeType":"Function","startLoc":868,"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":885,"header":"@property\n    def type(self)","id":4999,"name":"type","nodeType":"Function","startLoc":872,"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":891,"header":"@type.setter\n    def type(self, type)","id":5000,"name":"type","nodeType":"Function","startLoc":887,"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":"null","endLoc":1000,"header":"def parse_parts(self, parts, config=None, pos=None)","id":5001,"name":"parse_parts","nodeType":"Function","startLoc":998,"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":1015,"header":"def output(self, value, mask)","id":5002,"name":"output","nodeType":"Function","startLoc":1002,"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":"\n        Refer to another VALUES_ element by ID_, defined previously in\n        the document, for MIN/MAX/OPTION information.\n        ","endLoc":899,"header":"@property\n    def ref(self)","id":5003,"name":"ref","nodeType":"Function","startLoc":893,"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":919,"header":"@ref.setter\n    def ref(self, ref)","id":5004,"name":"ref","nodeType":"Function","startLoc":901,"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"},{"id":5005,"name":"astropy/io/votable/tests/data","nodeType":"Package"},{"id":5006,"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":5007,"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":5008,"name":"validation.txt","nodeType":"TextFile","path":"astropy/io/votable/tests/data","text":"Validation report for /tmp/astropy-test-D69Wr6/lib.linux-x86_64-2.7/astropy/io/votable/tests/data/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\" name=\"empty_value\" arraysize=\"*\" datatype=\"...\n^\n\n22: W11: The gref attribute on LINK is deprecated in VOTable 1.1\n<LINK href=\"http://www.foo.com/\" gref=\"DECPRECATED\">\n^\n\n23: W10: Unknown tag 'DESCRIPTION'.  Ignoring\n  <DESCRIPTION>Really, this link is totally bogus.</DESCRIPTION>\n  ^\n\n29: W26: 'INFO' inside 'TABLE' added in VOTable 1.2\n<INFO name=\"Error\" ID=\"ErrorInfo\" value=\"One might expect to find s...\n^\n\n33: W01: Array uses commas rather than whitespace\n<PARAM datatype=\"float\" name=\"INPUT2\" value=\"0.000000,0.000000\" arr...\n^\n\n36: W09: ID attribute not capitalized\n<FIELD id=\"string_test\" name=\"string test\" datatype=\"char\" arraysiz...\n^\n\n39: 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\n41: 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\n44: W51: Value '-32769' is out of range for a 16-bit integer field\n  <VALUES null=\"-32769\"/>\n  ^\n\n50: W48: Unknown attribute 'value' on OPTION\n    <OPTION name=\"bogus\" value=\"whatever\"/>\n    ^\n\n52: W10: Unknown tag 'IGNORE_ME'.  Ignoring\n  <IGNORE_ME/>\n  ^\n\n92: W17: GROUP element contains more than one DESCRIPTION element\n    This should warn of a second description.\n^\n\n99: W01: Array uses commas rather than whitespace\n  <PARAM datatype=\"float\" name=\"INPUT3\" value=\"0.000000,0.000000\" a...\n  ^\n\n37: 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\n107: W46: char value is too long for specified length of 10\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n      ^\n\n109: W46: unicodeChar value is too long for specified length of 10\n  <TD>Ceçi n'est pas un pipe</TD>\n      ^\n\n110: W46: char value is too long for specified length of 4\n  <TD>ab cd</TD>\n      ^\n\n129: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n129: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n137: W46: char value is too long for specified length of 10\n  <TD>0123456789A</TD>\n      ^\n\n140: W46: char value is too long for specified length of 4\n  <TD>0123456789A</TD>\n      ^\n\n141: 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\n142: W51: Value '65536' is out of range for a 16-bit integer field\n  <TD>65536</TD> <!-- should overflow to 0-->\n      ^\n\n144: W49: Empty cell illegal for integer fields.\n  <TD></TD>\n  ^\n\n147: W01: Array uses commas rather than whitespace\n  <TD>42 32, 12 32</TD>\n      ^\n\n163: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields.\n  <TD/>\n  ^\n\n163: W49: Empty cell illegal for integer fields. (suppressing further\n  warnings of this type...)\n  <TD/>\n  ^\n\n169: W46: unicodeChar value is too long for specified length of 10\n  <TD>0123456789A</TD>\n      ^\n\n171: 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\n193: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n202: W51: Value '65535' is out of range for a 16-bit integer field\n  <TD>0xffff</TD> <!-- hex - negative value -->\n      ^\n\n207: W01: Array uses commas rather than whitespace\n  <TD>NaN, 23</TD>\n      ^\n\n209: E02: Incorrect number of elements in array. Expected multiple of\n  6, got 0\n  <TD/>\n  ^\n\n217: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n223: E02: Incorrect number of elements in array. Expected multiple of\n  16, got 0\n  <TD/>\n  ^\n\n231: W51: Value '256' is out of range for a 8-bit unsigned integer\n  field\n  <TD>0x100</TD> <!-- hex, overflow -->\n      ^\n\n232: W51: Value '65536' is out of range for a 16-bit integer field\n  <TD>0x10000</TD> <!-- hex, overflow -->\n      ^\n\n237: W01: Array uses commas rather than whitespace\n  <TD>31, -1</TD>\n      ^\n\n239: E02: Incorrect number of elements in array. Expected multiple of\n  6, got 0\n  <TD/>\n  ^\n\n247: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1\n  <TD/>\n  ^\n\n249: E02: Incorrect number of elements in array. Expected multiple of\n  4, got 1 (suppressing further warnings of this type...)\n  <TD/>\n  ^\n\n267: W46: char value is too long for specified length of 10\n  <TD>Fixed string long test</TD> <!-- Should truncate -->\n      ^\n\n269: W46: unicodeChar value is too long for specified length of 10\n  <TD>Ceçi n'est pas un pipe</TD>\n      ^\n\n270: W46: char value is too long for specified length of 4\n  <TD>ab cd</TD>\n      ^\n"},{"id":5009,"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\" />\n          <OPTION value=\"application/x-download-manifest+txt\" />\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":5010,"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"},{"col":4,"comment":"null","endLoc":923,"header":"@ref.deleter\n    def ref(self)","id":5011,"name":"ref","nodeType":"Function","startLoc":921,"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":930,"header":"@property\n    def min(self)","id":5012,"name":"min","nodeType":"Function","startLoc":925,"text":"@property\n    def min(self):\n        \"\"\"\n        The minimum value of the domain.  See :attr:`min_inclusive`.\n        \"\"\"\n        return self._min"},{"col":4,"comment":"null","endLoc":937,"header":"@min.setter\n    def min(self, min)","id":5013,"name":"min","nodeType":"Function","startLoc":932,"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"},{"col":4,"comment":"null","endLoc":941,"header":"@min.deleter\n    def min(self)","id":5014,"name":"min","nodeType":"Function","startLoc":939,"text":"@min.deleter\n    def min(self):\n        self._min = None"},{"col":4,"comment":"When `True`, the domain includes the minimum value.","endLoc":946,"header":"@property\n    def min_inclusive(self)","id":5015,"name":"min_inclusive","nodeType":"Function","startLoc":943,"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":955,"header":"@min_inclusive.setter\n    def min_inclusive(self, inclusive)","id":5016,"name":"min_inclusive","nodeType":"Function","startLoc":948,"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)"},{"id":5017,"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  <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"},{"col":4,"comment":"null","endLoc":2276,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":5018,"name":"_add_info","nodeType":"Function","startLoc":2271,"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":959,"header":"@min_inclusive.deleter\n    def min_inclusive(self)","id":5019,"name":"min_inclusive","nodeType":"Function","startLoc":957,"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":966,"header":"@property\n    def max(self)","id":5020,"name":"max","nodeType":"Function","startLoc":961,"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":973,"header":"@max.setter\n    def max(self, max)","id":5021,"name":"max","nodeType":"Function","startLoc":968,"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"},{"col":0,"comment":"null","endLoc":227,"header":"@raises(exceptions.W51)\ndef test_integer_overflow()","id":5022,"name":"test_integer_overflow","nodeType":"Function","startLoc":220,"text":"@raises(exceptions.W51)\ndef test_integer_overflow():\n    config = {'pedantic': True}\n\n    field = tree.Field(\n        None, name='c', datatype='int', config=config)\n    c = converters.get_converter(field, config=config)\n    c.parse('-2208988800', config=config)"},{"col":4,"comment":"null","endLoc":977,"header":"@max.deleter\n    def max(self)","id":5023,"name":"max","nodeType":"Function","startLoc":975,"text":"@max.deleter\n    def max(self):\n        self._max = None"},{"col":4,"comment":"When `True`, the domain includes the maximum value.","endLoc":982,"header":"@property\n    def max_inclusive(self)","id":5024,"name":"max_inclusive","nodeType":"Function","startLoc":979,"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":991,"header":"@max_inclusive.setter\n    def max_inclusive(self, inclusive)","id":5025,"name":"max_inclusive","nodeType":"Function","startLoc":984,"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":995,"header":"@max_inclusive.deleter\n    def max_inclusive(self)","id":5026,"name":"max_inclusive","nodeType":"Function","startLoc":993,"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":1004,"header":"@property\n    def options(self)","id":5027,"name":"options","nodeType":"Function","startLoc":997,"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":1047,"header":"def parse(self, iterator, config)","id":5028,"name":"parse","nodeType":"Function","startLoc":1006,"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                            ['data', 'name'])\n                elif tag == 'VALUES':\n                    break\n\n        return self"},{"id":5029,"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"},{"col":0,"comment":"null","endLoc":238,"header":"def test_float_default_precision()","id":5030,"name":"test_float_default_precision","nodeType":"Function","startLoc":230,"text":"def test_float_default_precision():\n    config = {'pedantic': True}\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')"},{"id":5031,"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":5032,"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=\"http://dx.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":2428,"header":"def parse(self, iterator, config)","id":5033,"name":"parse","nodeType":"Function","startLoc":2278,"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                        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                        \"Columns '{}' not found in fields list\".format(columns))\n            else:\n                raise TypeError(\"Invalid columns list\")\n\n        if not skip_table:\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"},{"col":0,"comment":"null","endLoc":265,"header":"def test_vararray()","id":5034,"name":"test_vararray","nodeType":"Function","startLoc":241,"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)"},{"id":5035,"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:noNamespaceSchemaLocation=\"http://www.ivoa.net/xml/VOTable/v1.3\">\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  <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":5036,"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":5037,"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":46,"header":"def assert_validate_schema(filename, version)","id":5038,"name":"assert_validate_schema","nodeType":"Function","startLoc":37,"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'"},{"id":5039,"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\" name=\"empty_value\" arraysize=\"*\" datatype=\"char\" value=\"\" unit=\"foo\"/>\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":620,"id":5040,"name":"array","nodeType":"Attribute","startLoc":620,"text":"self.array"},{"id":5041,"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":5042,"name":"astropy/io/votable/validator","nodeType":"Package"},{"fileName":"main.py","filePath":"astropy/io/votable/validator","id":5043,"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 ....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            'urls/cone.{0}.dat.gz'.format(type))\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 strings, 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, 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, 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 ....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                '{0} does not exist.'.format(stilts))\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":"null","endLoc":20,"header":"def get_srcdir()","id":5044,"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":5045,"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            'urls/cone.{0}.dat.gz'.format(type))\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":1108,"header":"def to_table_column(self, column)","id":5046,"name":"to_table_column","nodeType":"Function","startLoc":1090,"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"},{"col":4,"comment":"null","endLoc":1126,"header":"def from_table_column(self, column)","id":5047,"name":"from_table_column","nodeType":"Function","startLoc":1110,"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":618,"id":5048,"name":"votable","nodeType":"Attribute","startLoc":618,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":619,"id":5049,"name":"table","nodeType":"Attribute","startLoc":619,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":615,"id":5050,"name":"xmlout","nodeType":"Attribute","startLoc":615,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":621,"id":5051,"name":"mask","nodeType":"Attribute","startLoc":621,"text":"self.mask"},{"className":"TestThroughBinary","col":0,"comment":"null","endLoc":668,"id":5052,"nodeType":"Class","startLoc":642,"text":"class TestThroughBinary(TestParse):\n    def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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":656,"header":"def setup_class(self)","id":5053,"name":"setup_class","nodeType":"Function","startLoc":643,"text":"def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\n        votable.get_first_table().format = 'binary'\n\n        self.xmlout = bio = io.BytesIO()\n        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\n\n        self.table = self.votable.get_first_table()\n        self.array = self.table.array\n        self.mask = self.table.array.mask"},{"attributeType":"None","col":8,"comment":"null","endLoc":834,"id":5054,"name":"max","nodeType":"Attribute","startLoc":834,"text":"self.max"},{"attributeType":"null","col":8,"comment":"null","endLoc":835,"id":5055,"name":"min_inclusive","nodeType":"Attribute","startLoc":835,"text":"self.min_inclusive"},{"attributeType":"null","col":12,"comment":"null","endLoc":951,"id":5056,"name":"_min_inclusive","nodeType":"Attribute","startLoc":951,"text":"self._min_inclusive"},{"attributeType":"null","col":8,"comment":"null","endLoc":866,"id":5057,"name":"_null","nodeType":"Attribute","startLoc":866,"text":"self._null"},{"col":4,"comment":"null","endLoc":39,"header":"def __init__(self, url, root='results', timeout=10)","id":5058,"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()"},{"attributeType":"ComplexArray","col":4,"comment":"null","endLoc":978,"id":5059,"name":"array_type","nodeType":"Attribute","startLoc":978,"text":"array_type"},{"attributeType":"ComplexVarArray","col":4,"comment":"null","endLoc":979,"id":5060,"name":"vararray_type","nodeType":"Attribute","startLoc":979,"text":"vararray_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":980,"id":5061,"name":"default","nodeType":"Attribute","startLoc":980,"text":"default"},{"attributeType":"null","col":8,"comment":"null","endLoc":891,"id":5062,"name":"_type","nodeType":"Attribute","startLoc":891,"text":"self._type"},{"col":4,"comment":"null","endLoc":662,"header":"def test_bit_mask(self)","id":5063,"name":"test_bit_mask","nodeType":"Function","startLoc":661,"text":"def test_bit_mask(self):\n        assert not np.any(self.mask['bit'])"},{"col":4,"comment":"null","endLoc":665,"header":"def test_bitarray_mask(self)","id":5064,"name":"test_bitarray_mask","nodeType":"Function","startLoc":664,"text":"def test_bitarray_mask(self):\n        assert not np.any(self.mask['bitarray'])"},{"col":4,"comment":"null","endLoc":668,"header":"def test_bit_array2_mask(self)","id":5065,"name":"test_bit_array2_mask","nodeType":"Function","startLoc":667,"text":"def test_bit_array2_mask(self):\n        assert not np.any(self.mask['bitarray2'])"},{"attributeType":"null","col":8,"comment":"null","endLoc":655,"id":5066,"name":"array","nodeType":"Attribute","startLoc":655,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":837,"id":5067,"name":"_options","nodeType":"Attribute","startLoc":837,"text":"self._options"},{"attributeType":"null","col":12,"comment":"null","endLoc":971,"id":5068,"name":"_max","nodeType":"Attribute","startLoc":971,"text":"self._max"},{"attributeType":"null","col":8,"comment":"null","endLoc":836,"id":5069,"name":"max_inclusive","nodeType":"Attribute","startLoc":836,"text":"self.max_inclusive"},{"attributeType":"null","col":8,"comment":"null","endLoc":652,"id":5070,"name":"votable","nodeType":"Attribute","startLoc":652,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":654,"id":5071,"name":"table","nodeType":"Attribute","startLoc":654,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":649,"id":5072,"name":"xmlout","nodeType":"Attribute","startLoc":649,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":831,"id":5073,"name":"type","nodeType":"Attribute","startLoc":831,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":656,"id":5074,"name":"mask","nodeType":"Attribute","startLoc":656,"text":"self.mask"},{"className":"TestThroughBinary2","col":0,"comment":"null","endLoc":691,"id":5075,"nodeType":"Class","startLoc":671,"text":"class TestThroughBinary2(TestParse):\n    def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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"},{"col":4,"comment":"null","endLoc":687,"header":"def setup_class(self)","id":5076,"name":"setup_class","nodeType":"Function","startLoc":672,"text":"def setup_class(self):\n        votable = parse(\n            get_pkg_data_filename('data/regression.xml'),\n            pedantic=False)\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        votable.to_xml(bio)\n        bio.seek(0)\n        self.votable = parse(bio, pedantic=False)\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":821,"id":5077,"name":"_config","nodeType":"Attribute","startLoc":821,"text":"self._config"},{"attributeType":"function","col":4,"comment":"null","endLoc":995,"id":5078,"name":"_parse_permissive","nodeType":"Attribute","startLoc":995,"text":"_parse_permissive"},{"attributeType":"null","col":8,"comment":"null","endLoc":827,"id":5079,"name":"_field","nodeType":"Attribute","startLoc":827,"text":"self._field"},{"attributeType":"None","col":8,"comment":"null","endLoc":833,"id":5080,"name":"min","nodeType":"Attribute","startLoc":833,"text":"self.min"},{"attributeType":"function","col":4,"comment":"null","endLoc":996,"id":5081,"name":"_parse_pedantic","nodeType":"Attribute","startLoc":996,"text":"_parse_pedantic"},{"attributeType":"null","col":8,"comment":"null","endLoc":829,"id":5082,"name":"null","nodeType":"Attribute","startLoc":829,"text":"self.null"},{"className":"FloatComplex","col":0,"comment":"\n    Handle floatComplex datatype.  Pair of single-precision IEEE\n    floating-point numbers.\n    ","endLoc":1023,"id":5083,"nodeType":"Class","startLoc":1018,"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":1023,"id":5084,"name":"format","nodeType":"Attribute","startLoc":1023,"text":"format"},{"attributeType":"null","col":8,"comment":"null","endLoc":830,"id":5085,"name":"_ref","nodeType":"Attribute","startLoc":830,"text":"self._ref"},{"className":"DoubleComplex","col":0,"comment":"\n    Handle doubleComplex datatype.  Pair of double-precision IEEE\n    floating-point numbers.\n    ","endLoc":1031,"id":5086,"nodeType":"Class","startLoc":1026,"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":1031,"id":5087,"name":"format","nodeType":"Attribute","startLoc":1031,"text":"format"},{"col":0,"comment":"\n    see Pull Request 4782 or Issue 4781 for details\n    ","endLoc":273,"header":"def test_gemini_v1_2()","id":5088,"name":"test_gemini_v1_2","nodeType":"Function","startLoc":268,"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"},{"className":"BitArray","col":0,"comment":"\n    Handles an array of bits.\n    ","endLoc":1073,"id":5089,"nodeType":"Class","startLoc":1034,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":822,"id":5090,"name":"_pos","nodeType":"Attribute","startLoc":822,"text":"self._pos"},{"col":4,"comment":"null","endLoc":1043,"header":"def __init__(self, field, base, arraysize, config=None, pos=None)","id":5091,"name":"__init__","nodeType":"Function","startLoc":1040,"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":1047,"header":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None)","id":5092,"name":"_splitter_pedantic","nodeType":"Function","startLoc":1045,"text":"@staticmethod\n    def _splitter_pedantic(value, config=None, pos=None):\n        return list(re.sub(r'\\s', '', value))"},{"attributeType":"null","col":8,"comment":"null","endLoc":828,"id":5093,"name":"ID","nodeType":"Attribute","startLoc":828,"text":"self.ID"},{"col":4,"comment":"null","endLoc":1053,"header":"@staticmethod\n    def _splitter_lax(value, config=None, pos=None)","id":5094,"name":"_splitter_lax","nodeType":"Function","startLoc":1049,"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":691,"header":"def test_get_coosys_by_id(self)","id":5095,"name":"test_get_coosys_by_id","nodeType":"Function","startLoc":689,"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":686,"id":5096,"name":"array","nodeType":"Attribute","startLoc":686,"text":"self.array"},{"attributeType":"null","col":12,"comment":"null","endLoc":987,"id":5097,"name":"_max_inclusive","nodeType":"Attribute","startLoc":987,"text":"self._max_inclusive"},{"col":4,"comment":"null","endLoc":1060,"header":"def output(self, value, mask)","id":5098,"name":"output","nodeType":"Function","startLoc":1055,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":5099,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":8,"comment":"null","endLoc":683,"id":5100,"name":"votable","nodeType":"Attribute","startLoc":683,"text":"self.votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":685,"id":5101,"name":"table","nodeType":"Attribute","startLoc":685,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":680,"id":5102,"name":"xmlout","nodeType":"Attribute","startLoc":680,"text":"self.xmlout"},{"attributeType":"null","col":8,"comment":"null","endLoc":826,"id":5103,"name":"_votable","nodeType":"Attribute","startLoc":826,"text":"self._votable"},{"attributeType":"null","col":12,"comment":"null","endLoc":935,"id":5104,"name":"_min","nodeType":"Attribute","startLoc":935,"text":"self._min"},{"col":4,"comment":"null","endLoc":1067,"header":"def binparse(self, read)","id":5105,"name":"binparse","nodeType":"Function","startLoc":1062,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":687,"id":5106,"name":"mask","nodeType":"Attribute","startLoc":687,"text":"self.mask"},{"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":1566,"id":5107,"nodeType":"Class","startLoc":1129,"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            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 archive.noao.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 (not config.get('pedantic') 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 + \"_{:d}\".format(i)\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 + \" {:d}\".format(i)\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_ 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 ... 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):\n            column.format = self.converter.output_format\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":0,"comment":"null","endLoc":54,"header":"def test_parse_single_table()","id":5108,"name":"test_parse_single_table","nodeType":"Function","startLoc":49,"text":"def test_parse_single_table():\n    table = parse_single_table(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\n    assert isinstance(table, tree.Table)\n    assert len(table.array) == 5"},{"col":4,"comment":"null","endLoc":48,"header":"def get_dirpath(self)","id":5109,"name":"get_dirpath","nodeType":"Function","startLoc":47,"text":"def get_dirpath(self):\n        return os.path.join(self._root, self._path)"},{"col":0,"comment":"null","endLoc":64,"header":"def test_parse_single_table2()","id":5110,"name":"test_parse_single_table2","nodeType":"Function","startLoc":57,"text":"def test_parse_single_table2():\n    table2 = parse_single_table(\n        get_pkg_data_filename('data/regression.xml'),\n        table_number=1,\n        pedantic=False)\n    assert isinstance(table2, tree.Table)\n    assert len(table2.array) == 1\n    assert len(table2.array.dtype.names) == 28"},{"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":1292,"header":"@property\n    def datatype(self)","id":5111,"name":"datatype","nodeType":"Function","startLoc":1278,"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":1303,"header":"@datatype.setter\n    def datatype(self, datatype)","id":5112,"name":"datatype","nodeType":"Function","startLoc":1294,"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":72,"header":"def load_attributes(self)","id":5113,"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":0,"comment":"null","endLoc":71,"header":"@raises(IndexError)\ndef test_parse_single_table3()","id":5114,"name":"test_parse_single_table3","nodeType":"Function","startLoc":67,"text":"@raises(IndexError)\ndef test_parse_single_table3():\n    parse_single_table(\n        get_pkg_data_filename('data/regression.xml'),\n        table_number=3, pedantic=False)"},{"fileName":"__init__.py","filePath":"astropy/io/votable/validator","id":5115,"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":4,"comment":"null","endLoc":54,"header":"def get_attribute_path(self)","id":5116,"name":"get_attribute_path","nodeType":"Function","startLoc":53,"text":"def get_attribute_path(self):\n        return os.path.join(self.get_dirpath(), \"values.dat\")"},{"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 strings, 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, 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, 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":5117,"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 strings, 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, 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, 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 ....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                '{0} does not exist.'.format(stilts))\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":178,"header":"def _test_regression(tmpdir, _python_based=False, binary_mode=1)","id":5118,"name":"_test_regression","nodeType":"Function","startLoc":74,"text":"def _test_regression(tmpdir, _python_based=False, binary_mode=1):\n    # Read the VOTABLE\n    votable = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False,\n        _debug_python_based_parser=_python_based)\n    table = votable.get_first_table()\n\n    dtypes = [\n        ((str('string test'), str('string_test')), str('|O8')),\n        ((str('fixed string test'), str('string_test_2')), str('|S10')),\n        (str('unicode_test'), str('|O8')),\n        ((str('unicode test'), str('fixed_unicode_test')), str('<U10')),\n        ((str('string array test'), str('string_array_test')), str('|S4')),\n        (str('unsignedByte'), str('|u1')),\n        (str('short'), str('<i2')),\n        (str('int'), str('<i4')),\n        (str('long'), str('<i8')),\n        (str('double'), str('<f8')),\n        (str('float'), str('<f4')),\n        (str('array'), str('|O8')),\n        (str('bit'), str('|b1')),\n        (str('bitarray'), str('|b1'), (3, 2)),\n        (str('bitvararray'), str('|O8')),\n        (str('bitvararray2'), str('|O8')),\n        (str('floatComplex'), str('<c8')),\n        (str('doubleComplex'), str('<c16')),\n        (str('doubleComplexArray'), str('|O8')),\n        (str('doubleComplexArrayFixed'), str('<c16'), (2,)),\n        (str('boolean'), str('|b1')),\n        (str('booleanArray'), str('|b1'), (4,)),\n        (str('nulls'), str('<i4')),\n        (str('nulls_array'), str('<i4'), (2, 2)),\n        (str('precision1'), str('<f8')),\n        (str('precision2'), str('<f8')),\n        (str('doublearray'), str('|O8')),\n        (str('bitarray2'), str('|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(str('<'), str('>'))\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, pedantic=False,\n                         _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            'data/regression.bin.tabledata.truth.{0}.xml'.format(\n                votable.version)),\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":49,"header":"def download(args)","id":5119,"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()"},{"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":104,"header":"def bitarray_to_bool(data, length)","id":5120,"name":"bitarray_to_bool","nodeType":"Function","startLoc":75,"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":136,"header":"def download_xml_content(self)","id":5121,"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('FAILED: {0}\\n'.format(reason).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(\"HTTPException: {}\".format(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":4,"comment":"null","endLoc":2544,"header":"def _parse_tabledata(self, iterator, colnumbers, fields, config)","id":5122,"name":"_parse_tabledata","nodeType":"Function","startLoc":2430,"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":57,"header":"def get_vo_xml_path(self)","id":5123,"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":"\n        Does a `map` operation while displaying a progress bar with\n        percentage complete.\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, optional\n            If `True`, use the `multiprocessing` module to distribute each\n            task to a different processor core.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writeable file-like object, 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        ","endLoc":750,"header":"@classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False)","id":5125,"name":"map","nodeType":"Function","startLoc":680,"text":"@classmethod\n    def map(cls, function, items, multiprocess=False, file=None, step=100,\n            ipython_widget=False):\n        \"\"\"\n        Does a `map` operation while displaying a progress bar with\n        percentage complete.\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, optional\n            If `True`, use the `multiprocessing` module to distribute each\n            task to a different processor core.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writeable file-like object, 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\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:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                p = multiprocessing.Pool()\n                for i, result in enumerate(\n                    p.imap_unordered(function, items, chunksize=chunksize)):\n                    bar.update(i)\n                    results.append(result)\n                p.close()\n                p.join()\n\n        return results"},{"col":0,"comment":"null","endLoc":55,"header":"def validate_vo(args)","id":5126,"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":4,"comment":"null","endLoc":1073,"header":"def binoutput(self, value, mask)","id":5127,"name":"binoutput","nodeType":"Function","startLoc":1069,"text":"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":203,"header":"def validate_vo(self)","id":5128,"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, pedantic=False, 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"},{"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":139,"header":"def bool_to_bitarray(value)","id":5129,"name":"bool_to_bitarray","nodeType":"Function","startLoc":107,"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(\"{}B\".format(len(bytes)), *bytes)"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":1038,"id":5130,"name":"vararray_type","nodeType":"Attribute","startLoc":1038,"text":"vararray_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":1043,"id":5131,"name":"_bytes","nodeType":"Attribute","startLoc":1043,"text":"self._bytes"},{"className":"Bit","col":0,"comment":"\n    Handles the bit datatype.\n    ","endLoc":1120,"id":5132,"nodeType":"Class","startLoc":1076,"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":1099,"header":"def parse(self, value, config=None, pos=None)","id":5133,"name":"parse","nodeType":"Function","startLoc":1087,"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":1108,"header":"def output(self, value, mask)","id":5134,"name":"output","nodeType":"Function","startLoc":1101,"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":1112,"header":"def binparse(self, read)","id":5135,"name":"binparse","nodeType":"Function","startLoc":1110,"text":"def binparse(self, read):\n        data = read(1)\n        return (ord(data) & 0x8) != 0, False"},{"col":4,"comment":"null","endLoc":1120,"header":"def binoutput(self, value, mask)","id":5136,"name":"binoutput","nodeType":"Function","startLoc":1114,"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"},{"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":70,"header":"def _resize(masked, new_size)","id":5137,"name":"_resize","nodeType":"Function","startLoc":60,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1080,"id":5138,"name":"format","nodeType":"Attribute","startLoc":1080,"text":"format"},{"attributeType":"BitArray","col":4,"comment":"null","endLoc":1081,"id":5139,"name":"array_type","nodeType":"Attribute","startLoc":1081,"text":"array_type"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":1082,"id":5140,"name":"vararray_type","nodeType":"Attribute","startLoc":1082,"text":"vararray_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":1083,"id":5141,"name":"default","nodeType":"Attribute","startLoc":1083,"text":"default"},{"attributeType":"null","col":4,"comment":"null","endLoc":1084,"id":5142,"name":"binary_one","nodeType":"Attribute","startLoc":1084,"text":"binary_one"},{"col":0,"comment":"null","endLoc":62,"header":"def votlint_validate(args)","id":5143,"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":4,"comment":"null","endLoc":234,"header":"def validate_with_votlint(self, path_to_stilts_jar)","id":5144,"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            \"java -jar {} votlint validate=false {}\".format(\n                path_to_stilts_jar, 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":4,"comment":"null","endLoc":1085,"id":5145,"name":"binary_zero","nodeType":"Attribute","startLoc":1085,"text":"binary_zero"},{"className":"BooleanArray","col":0,"comment":"\n    Handles an array of boolean values.\n    ","endLoc":1150,"id":5146,"nodeType":"Class","startLoc":1123,"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":0,"comment":"null","endLoc":68,"header":"def write_html_result(args)","id":5147,"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)"},{"col":4,"comment":"null","endLoc":1142,"header":"def binparse(self, read)","id":5148,"name":"binparse","nodeType":"Function","startLoc":1129,"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":0,"comment":"null","endLoc":357,"header":"def get_result_subsets(results, root, s=None)","id":5149,"name":"get_result_subsets","nodeType":"Function","startLoc":237,"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                 '{}: {}'.format(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                 '{}: {}'.format(exception_code, exception_descr),\n                 exc, ['ul', 'li']))\n\n    return tables"},{"col":4,"comment":"null","endLoc":2657,"header":"def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos)","id":5150,"name":"_parse_binary","nodeType":"Function","startLoc":2600,"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                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"},{"col":4,"comment":"null","endLoc":1150,"header":"def binoutput(self, value, mask)","id":5151,"name":"binoutput","nodeType":"Function","startLoc":1144,"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)"},{"col":4,"comment":"null","endLoc":2598,"header":"def _get_binary_data_stream(self, iterator, config)","id":5152,"name":"_get_binary_data_stream","nodeType":"Function","startLoc":2546,"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                        \"Unknown encoding type '{}'\".format(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"},{"attributeType":"ArrayVarArray","col":4,"comment":"null","endLoc":1127,"id":5153,"name":"vararray_type","nodeType":"Attribute","startLoc":1127,"text":"vararray_type"},{"col":0,"comment":"null","endLoc":159,"header":"def write_result(result)","id":5154,"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)"},{"className":"Boolean","col":0,"comment":"\n    Handles the boolean datatype.\n    ","endLoc":1218,"id":5155,"nodeType":"Class","startLoc":1153,"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":1183,"header":"def parse(self, value, config=None, pos=None)","id":5156,"name":"parse","nodeType":"Function","startLoc":1165,"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":1190,"header":"def output(self, value, mask)","id":5157,"name":"output","nodeType":"Function","startLoc":1185,"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":1194,"header":"def binparse(self, read)","id":5158,"name":"binparse","nodeType":"Function","startLoc":1192,"text":"def binparse(self, read):\n        value = ord(read(1))\n        return self.binparse_value(value)"},{"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":1315,"header":"@property\n    def precision(self)","id":5159,"name":"precision","nodeType":"Function","startLoc":1305,"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":1321,"header":"@precision.setter\n    def precision(self, precision)","id":5160,"name":"precision","nodeType":"Function","startLoc":1317,"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":1325,"header":"@precision.deleter\n    def precision(self)","id":5161,"name":"precision","nodeType":"Function","startLoc":1323,"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":1337,"header":"@property\n    def width(self)","id":5162,"name":"width","nodeType":"Function","startLoc":1327,"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":1345,"header":"@width.setter\n    def width(self, width)","id":5163,"name":"width","nodeType":"Function","startLoc":1339,"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":0,"comment":"null","endLoc":71,"header":"@contextlib.contextmanager\ndef make_html_header(w)","id":5164,"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"},{"col":4,"comment":"null","endLoc":1349,"header":"@width.deleter\n    def width(self)","id":5165,"name":"width","nodeType":"Function","startLoc":1347,"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_ element.\n        ","endLoc":1360,"header":"@property\n    def ref(self)","id":5166,"name":"ref","nodeType":"Function","startLoc":1354,"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_ element.\n        \"\"\"\n        return self._ref"},{"col":4,"comment":"null","endLoc":1365,"header":"@ref.setter\n    def ref(self, ref)","id":5167,"name":"ref","nodeType":"Function","startLoc":1362,"text":"@ref.setter\n    def ref(self, ref):\n        xmlutil.check_id(ref, 'ref', self._config, self._pos)\n        self._ref = ref"},{"col":0,"comment":"null","endLoc":300,"header":"def write_index(subsets, results, root='results')","id":5168,"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))"},{"col":4,"comment":"null","endLoc":1369,"header":"@ref.deleter\n    def ref(self)","id":5169,"name":"ref","nodeType":"Function","startLoc":1367,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"col":4,"comment":"A string specifying the units_ for the FIELD_.","endLoc":1374,"header":"@property\n    def unit(self)","id":5170,"name":"unit","nodeType":"Function","startLoc":1371,"text":"@property\n    def unit(self):\n        \"\"\"A string specifying the units_ for the FIELD_.\"\"\"\n        return self._unit"},{"col":4,"comment":"null","endLoc":1398,"header":"@unit.setter\n    def unit(self, unit)","id":5171,"name":"unit","nodeType":"Function","startLoc":1376,"text":"@unit.setter\n    def unit(self, unit):\n        if unit is None:\n            self._unit = None\n            return\n\n        from ... 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":0,"comment":"null","endLoc":101,"header":"def write_warning(w, line, xml_lines)","id":5172,"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('Line {:d}: '.format(warning['nline']))\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":288,"header":"def add_subset(w, basename, name, subresults, inside=['p'], total=None)","id":5173,"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='{}_00.html'.format(basename))\n            for element in reversed(inside):\n                w.end(element)\n        numbers = '{:d} ({:.2%})'.format(len(subresults), percentage)\n        with w.tag('td'):\n            w.data(numbers)"},{"col":0,"comment":"null","endLoc":83,"header":"def write_source_line(w, line, nchar=0)","id":5174,"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('<span class=\"highlight\">{}</span>'.format(char))\n    w.write(part2)\n    w.write('\\n\\n')"},{"col":4,"comment":"null","endLoc":1402,"header":"@unit.deleter\n    def unit(self)","id":5175,"name":"unit","nodeType":"Function","startLoc":1400,"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":1412,"header":"@property\n    def arraysize(self)","id":5176,"name":"arraysize","nodeType":"Function","startLoc":1404,"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":1419,"header":"@arraysize.setter\n    def arraysize(self, arraysize)","id":5177,"name":"arraysize","nodeType":"Function","startLoc":1414,"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":1423,"header":"@arraysize.deleter\n    def arraysize(self)","id":5178,"name":"arraysize","nodeType":"Function","startLoc":1421,"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":1431,"header":"@property\n    def type(self)","id":5179,"name":"type","nodeType":"Function","startLoc":1425,"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":1435,"header":"@type.setter\n    def type(self, type)","id":5180,"name":"type","nodeType":"Function","startLoc":1433,"text":"@type.setter\n    def type(self, type):\n        self._type = type"},{"col":4,"comment":"null","endLoc":1439,"header":"@type.deleter\n    def type(self)","id":5181,"name":"type","nodeType":"Function","startLoc":1437,"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":1447,"header":"@property\n    def values(self)","id":5182,"name":"values","nodeType":"Function","startLoc":1441,"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":1452,"header":"@values.setter\n    def values(self, values)","id":5183,"name":"values","nodeType":"Function","startLoc":1449,"text":"@values.setter\n    def values(self, values):\n        assert values is None or isinstance(values, Values)\n        self._values = values"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":5184,"name":"__doc__","nodeType":"Attribute","startLoc":5,"text":"__doc__"},{"col":4,"comment":"null","endLoc":1456,"header":"@values.deleter\n    def values(self)","id":5185,"name":"values","nodeType":"Function","startLoc":1454,"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":1466,"header":"@property\n    def links(self)","id":5186,"name":"links","nodeType":"Function","startLoc":1458,"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":1501,"header":"def parse(self, iterator, config)","id":5187,"name":"parse","nodeType":"Function","startLoc":1468,"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":0,"comment":"","endLoc":2,"header":"__init__.py#<anonymous>","id":5188,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__doc__ = main.__doc__\n\ndel main"},{"col":4,"comment":"null","endLoc":1211,"header":"def binparse_value(self, value)","id":5189,"name":"binparse_value","nodeType":"Function","startLoc":1207,"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":1218,"header":"def binoutput(self, value, mask)","id":5190,"name":"binoutput","nodeType":"Function","startLoc":1213,"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":1157,"id":5191,"name":"format","nodeType":"Attribute","startLoc":1157,"text":"format"},{"attributeType":"BooleanArray","col":4,"comment":"null","endLoc":1158,"id":5192,"name":"array_type","nodeType":"Attribute","startLoc":1158,"text":"array_type"},{"attributeType":"ScalarVarArray","col":4,"comment":"null","endLoc":1159,"id":5193,"name":"vararray_type","nodeType":"Attribute","startLoc":1159,"text":"vararray_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":1160,"id":5194,"name":"default","nodeType":"Attribute","startLoc":1160,"text":"default"},{"attributeType":"null","col":4,"comment":"null","endLoc":1161,"id":5195,"name":"binary_question_mark","nodeType":"Attribute","startLoc":1161,"text":"binary_question_mark"},{"attributeType":"null","col":4,"comment":"null","endLoc":1162,"id":5196,"name":"binary_true","nodeType":"Attribute","startLoc":1162,"text":"binary_true"},{"attributeType":"null","col":4,"comment":"null","endLoc":1163,"id":5197,"name":"binary_false","nodeType":"Attribute","startLoc":1163,"text":"binary_false"},{"attributeType":"null","col":4,"comment":"null","endLoc":1196,"id":5198,"name":"_binparse_mapping","nodeType":"Attribute","startLoc":1196,"text":"_binparse_mapping"},{"attributeType":"null","col":29,"comment":"null","endLoc":11,"id":5199,"name":"_struct_unpack","nodeType":"Attribute","startLoc":11,"text":"_struct_unpack"},{"attributeType":"null","col":27,"comment":"null","endLoc":12,"id":5200,"name":"_struct_pack","nodeType":"Attribute","startLoc":12,"text":"_struct_pack"},{"attributeType":"null","col":16,"comment":"null","endLoc":15,"id":5201,"name":"np","nodeType":"Attribute","startLoc":15,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":5202,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":5203,"name":"pedantic_array_splitter","nodeType":"Attribute","startLoc":29,"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":30,"id":5204,"name":"array_splitter","nodeType":"Attribute","startLoc":30,"text":"array_splitter"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":5205,"name":"_zero_int","nodeType":"Attribute","startLoc":38,"text":"_zero_int"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":5206,"name":"_empty_bytes","nodeType":"Attribute","startLoc":39,"text":"_empty_bytes"},{"attributeType":"null","col":0,"comment":"null","endLoc":40,"id":5207,"name":"_zero_byte","nodeType":"Attribute","startLoc":40,"text":"_zero_byte"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":5208,"name":"struct_unpack","nodeType":"Attribute","startLoc":43,"text":"struct_unpack"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":5209,"name":"struct_pack","nodeType":"Attribute","startLoc":44,"text":"struct_pack"},{"attributeType":"null","col":0,"comment":"null","endLoc":1221,"id":5210,"name":"converter_mapping","nodeType":"Attribute","startLoc":1221,"text":"converter_mapping"},{"attributeType":"null","col":0,"comment":"null","endLoc":1297,"id":5211,"name":"numpy_dtype_to_field_mapping","nodeType":"Attribute","startLoc":1297,"text":"numpy_dtype_to_field_mapping"},{"col":0,"comment":"","endLoc":5,"header":"converters.py#<anonymous>","id":5212,"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'"},{"fileName":"html.py","filePath":"astropy/io/votable/validator","id":5213,"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 ....utils.xml.writer import XMLWriter, xml_escape\nfrom .... import online_docs_root\n\n# VO\nfrom .. 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('<span class=\"highlight\">{}</span>'.format(char))\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('Line {:d}: '.format(warning['nline']))\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='{}/index.html'.format(result.get_htmlpath()))\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='{}_{:02d}.html'.format(basename, j-1))\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='{}_{:02d}.html'.format(basename, i))\n                w.data(' ')\n            if j < npages - 1:\n                w.element('a', '>>', href='{}_{:02d}.html'.format(basename, j+1))\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, '{}_{:02d}.html'.format(basename, i))\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='{}_00.html'.format(basename))\n            for element in reversed(inside):\n                w.end(element)\n        numbers = '{:d} ({:.2%})'.format(len(subresults), percentage)\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 = '{:d} ({:.2%})'.format(len(subresults), percentage)\n    write_table(basename, name + ' ' + numbers, subresults, root, chunk_size)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":5214,"name":"xml_escape","nodeType":"Attribute","startLoc":41,"text":"xml_escape"},{"col":0,"comment":"null","endLoc":114,"header":"def write_votlint_warning(w, line, xml_lines)","id":5215,"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')"},{"col":0,"comment":"null","endLoc":73,"header":"def write_subindex(args)","id":5216,"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":"null","endLoc":309,"header":"def write_index_table(root, basename, name, subresults, inside=None,\n                      total=None, chunk_size=500)","id":5217,"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 = '{:d} ({:.2%})'.format(len(subresults), percentage)\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":5218,"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='{}_{:02d}.html'.format(basename, j-1))\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='{}_{:02d}.html'.format(basename, i))\n                w.data(' ')\n            if j < npages - 1:\n                w.element('a', '>>', href='{}_{:02d}.html'.format(basename, j+1))\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, '{}_{:02d}.html'.format(basename, i))\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":2695,"header":"def _parse_fits(self, iterator, extnum, config)","id":5219,"name":"_parse_fits","nodeType":"Function","startLoc":2659,"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                    \"Unknown encoding type '{}'\".format(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"},{"col":0,"comment":"null","endLoc":223,"header":"def write_result_row(w, result)","id":5220,"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='{}/index.html'.format(result.get_htmlpath()))\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})"},{"fileName":"result.py","filePath":"astropy/io/votable/validator","id":5221,"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 .. import table\nfrom .. import exceptions\nfrom .. 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('FAILED: {0}\\n'.format(reason).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(\"HTTPException: {}\".format(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, pedantic=False, 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            \"java -jar {} votlint validate=false {}\".format(\n                path_to_stilts_jar, 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                 '{}: {}'.format(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                 '{}: {}'.format(exception_code, exception_descr),\n                 exc, ['ul', 'li']))\n\n    return tables\n"},{"className":"Result","col":0,"comment":"null","endLoc":234,"id":5223,"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('FAILED: {0}\\n'.format(reason).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(\"HTTPException: {}\".format(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, pedantic=False, 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            \"java -jar {} votlint validate=false {}\".format(\n                path_to_stilts_jar, 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":4,"comment":"null","endLoc":42,"header":"def __enter__(self)","id":5224,"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":5225,"name":"__exit__","nodeType":"Function","startLoc":44,"text":"def __exit__(self, *args):\n        self.save_attributes()"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":5226,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"main.py#<anonymous>","id":5227,"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']"},{"col":4,"comment":"null","endLoc":77,"header":"def save_attributes(self)","id":5228,"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)"},{"id":5229,"name":"astropy/wcs","nodeType":"Package"},{"fileName":"docstrings.py","filePath":"astropy/wcs","id":5230,"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\nfrom . import _docutil as __\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nworld : double array[ncoord][nelem]\n    Returns an array of world coordinates.\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\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\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 may be or'ed together to loosen the\n    comparison.\n\n    - ``WCSCOMPARE_ANCILLARY``: Ignores ancillary keywords that don't\n      change the WCS transformation, such as ``DATE-OBS`` or\n      ``EQUINOX``.\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\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\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)\n\n``EXTLEV`` identifying the binary table extension.\n\"\"\"\n\nextnam = \"\"\"\n``str`` (read-only)\n\n``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)\n\n``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:`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` objects\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[naxis], 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 : coordinate pair\n    The offset from the distortion table for pixel point (*x*, *y*).\n\"\"\"\n\nget_cdelt = \"\"\"\nget_cdelt() -> double array[naxis]\n\nCoordinate increments (``CDELTia``) for each coord axis.\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() -> double array[naxis][naxis]\n\nReturns the ``PC`` matrix in read-only form.  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 of tuples\n\nReturns ``PSi_ma`` keywords for each *i* and *m*.\n\nReturns\n-------\nps : list of tuples\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 of tuples\n\nReturns ``PVi_ma`` keywords for each *i* and *m*.\n\nReturns\n-------\n\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\ni = \"\"\"\n``int`` (read-only)\n\nImage 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)\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)\n\nArray 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 : pair of floats\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 : double array[naxis]\n    World coordinate elements.  ``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 : double array[naxis].\n    Pixel coordinates.  The element indicated by *mixpix* is given and\n    the remaining elements will be written in-place.\n\n{0}\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)\n\nExpected 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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\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.  For\n        spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n        spectral coordinate, in SI units.\n\n    - *phi*: double array[ncoord]\n\n    - *theta*: double array[ncoord]\n\n      - Longitude and latitude in the native coordinate system of the\n        projection, in degrees.\n\n    - *world*: double array[ncoord][nelem]\n\n      - Array of world coordinates.  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*: int array[ncoord]\n\n      - Status return value for each coordinate. ``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 : double array[ncoord][nelem].\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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\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)\n\nTable row number.\n\"\"\"\n\ns2p = \"\"\"\ns2p(world, origin)\n\nTransforms world coordinates to pixel coordinates.\n\nParameters\n----------\nworld : double array[ncoord][nelem]\n    Array of world coordinates, in decimal degrees.\n\n{0}\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\nInvalidTabularParameters\n    Invalid tabular parameters.\n\"\"\"\n\nset_ps = \"\"\"\nset_ps(ps)\n\nSets ``PSi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\nps : sequence of tuples\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 tuples\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 : double array[m+1][m+1]\n    The ``A_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``A_ORDER``.\n\nb : double array[m+1][m+1]\n    The ``B_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``B_ORDER``.\n\nap : double array[m+1][m+1]\n    The ``AP_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``AP_ORDER``.\n\nbp : double array[m+1][m+1]\n    The ``BP_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``BP_ORDER``.\n\ncrpix : double array[2]\n    The reference pixel.\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 : double array[ncoord][nelem]\n    Array of focal plane coordinates.\n\n{0}\n\nReturns\n-------\npixcrd : double array[ncoord][nelem]\n    Returns an array of pixel coordinates.\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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\nNonseparableSubimageCoordinateSystem\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:`relaxwrite` for details.\n\nReturns\n-------\nheader : str\n    Raw FITS header as a string.\n\"\"\"\n\nttype = \"\"\"\n``str`` (read-only)\n\n``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 : A pair of `~astropy.wcs.DistortionLookupTable` objects, or\n  ``(None, None)``.\n\nwcsprm : `~astropy.wcs.Wcsprm` object\n\ndet2im : A pair of `~astropy.wcs.DistortionLookupTable` objects, or\n   ``(None, 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\nParameters\n----------\nheader : An `astropy.io.fits.Header`, string, 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:`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\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"},{"col":4,"comment":"null","endLoc":51,"header":"def get_htmlpath(self)","id":5231,"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":5232,"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":5233,"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":5234,"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":5235,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":5236,"name":"html_header","nodeType":"Attribute","startLoc":16,"text":"html_header"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":5237,"name":"default_style","nodeType":"Attribute","startLoc":22,"text":"default_style"},{"col":0,"comment":"","endLoc":4,"header":"html.py#<anonymous>","id":5238,"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\"\"\""},{"col":4,"comment":"null","endLoc":2740,"header":"def to_xml(self, w, **kwargs)","id":5239,"name":"to_xml","nodeType":"Function","startLoc":2697,"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=\"_g{0}\".format(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":206,"header":"def has_warning(self, warning_code)","id":5240,"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":5241,"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":26,"comment":"null","endLoc":9,"id":5242,"name":"__","nodeType":"Attribute","startLoc":9,"text":"__"},{"attributeType":"null","col":8,"comment":"null","endLoc":33,"id":5243,"name":"_root","nodeType":"Attribute","startLoc":33,"text":"self._root"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":5244,"name":"a","nodeType":"Attribute","startLoc":11,"text":"a"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":5245,"name":"a_order","nodeType":"Attribute","startLoc":22,"text":"a_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":5246,"name":"all_pix2world","nodeType":"Attribute","startLoc":26,"text":"all_pix2world"},{"attributeType":"null","col":0,"comment":"null","endLoc":82,"id":5247,"name":"alt","nodeType":"Attribute","startLoc":82,"text":"alt"},{"attributeType":"null","col":0,"comment":"null","endLoc":90,"id":5248,"name":"ap","nodeType":"Attribute","startLoc":90,"text":"ap"},{"attributeType":"null","col":0,"comment":"null","endLoc":99,"id":5249,"name":"ap_order","nodeType":"Attribute","startLoc":99,"text":"ap_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":5250,"name":"axis_types","nodeType":"Attribute","startLoc":103,"text":"axis_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":150,"id":5251,"name":"b","nodeType":"Attribute","startLoc":150,"text":"b"},{"fileName":"setup_package.py","filePath":"astropy/wcs","id":5252,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nCONTACT = \"Michael Droettboom\"\nEMAIL = \"mdroe@stsci.edu\"\n\nimport io\nfrom os.path import join\nimport os.path\nimport shutil\nimport sys\n\nfrom distutils.core import Extension\nfrom distutils.dep_util import newer_group\n\n\nfrom astropy_helpers import setup_helpers\nfrom astropy_helpers.distutils_helpers import get_distutils_build_option\n\nWCSROOT = os.path.relpath(os.path.dirname(__file__))\nWCSVERSION = \"5.17\"\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 {0}\n\n    /* 64-bit integer data type. */\n    #define WCSLIB_INT64 {1}\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        setup_helpers.write_if_different(path, content)\n\n\n######################################################################\n# GENERATE DOCSTRINGS IN C\n\n\ndef generate_c_docstrings():\n    from astropy.wcs import docstrings\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('extern char doc_{0}[{1}];\\n'.format(key, len(val)))\n    h_file.write(\"\\n#endif\\n\\n\")\n\n    setup_helpers.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('char doc_{0}[{1}] = {{\\n'.format(key, len(val)))\n        for i in range(0, len(val), 12):\n            section = val[i:i+12]\n            c_file.write('    ')\n            c_file.write(''.join('0x{0:02x}, '.format(x) for x in section))\n            c_file.write('\\n')\n\n        c_file.write(\"    };\\n\\n\")\n\n    setup_helpers.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    from astropy.version import debug\n\n    cfg['include_dirs'].append('numpy')\n    cfg['define_macros'].extend([\n        ('ECHO', None),\n        ('WCSTRIG_MACRO', None),\n        ('ASTROPY_WCS_BUILD', None),\n        ('_GNU_SOURCE', None)])\n\n    if (not setup_helpers.use_system_library('wcslib') or\n            sys.platform == 'win32'):\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    else:\n        wcsconfig_h_path = join(WCSROOT, 'include', 'wcsconfig.h')\n        if os.path.exists(wcsconfig_h_path):\n            os.unlink(wcsconfig_h_path)\n        cfg.update(setup_helpers.pkg_config(['wcslib'], ['wcs']))\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    # Squelch a few compilation warnings in WCSLIB\n    if setup_helpers.get_compiler_option() in ('unix', 'mingw32'):\n        if not get_distutils_build_option('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 = setup_helpers.DistutilsExtensionArgs()\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_tabprm_wrap.c']\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    return [Extension(str('astropy.wcs._wcs'), **cfg)]\n\n\ndef get_package_data():\n    # Installs the testing data files\n    api_files = [\n        'astropy_wcs.h',\n        'astropy_wcs_api.h',\n        'distortion.h',\n        'isnan.h',\n        'pipeline.h',\n        'pyutil.h',\n        'sip.h',\n        'util.h',\n        'wcsconfig.h',\n        ]\n    api_files = [join('include', 'astropy_wcs', x) for x in api_files]\n    api_files.append(join('include', 'astropy_wcs_api.h'))\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    if not setup_helpers.use_system_library('wcslib'):\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            api_files.append(join('include', 'wcslib', header))\n\n    return {\n        str('astropy.wcs.tests'): ['data/*.hdr', 'data/*.fits',\n                                   'data/*.txt', 'data/*.fits.gz',\n                                   'maps/*.hdr', 'spectra/*.hdr',\n                                   'extension/*.c'],\n        str('astropy.wcs'): api_files,\n    }\n\n\ndef get_external_libraries():\n    return ['wcslib']\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":159,"id":5253,"name":"b_order","nodeType":"Attribute","startLoc":159,"text":"b_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":163,"id":5254,"name":"bounds_check","nodeType":"Attribute","startLoc":163,"text":"bounds_check"},{"attributeType":"null","col":0,"comment":"null","endLoc":184,"id":5255,"name":"bp","nodeType":"Attribute","startLoc":184,"text":"bp"},{"attributeType":"null","col":0,"comment":"null","endLoc":193,"id":5256,"name":"bp_order","nodeType":"Attribute","startLoc":193,"text":"bp_order"},{"attributeType":"null","col":0,"comment":"null","endLoc":197,"id":5257,"name":"cd","nodeType":"Attribute","startLoc":197,"text":"cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":221,"id":5258,"name":"cdelt","nodeType":"Attribute","startLoc":221,"text":"cdelt"},{"attributeType":"null","col":0,"comment":"null","endLoc":234,"id":5259,"name":"cdfix","nodeType":"Attribute","startLoc":234,"text":"cdfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":251,"id":5260,"name":"cel_offset","nodeType":"Attribute","startLoc":251,"text":"cel_offset"},{"attributeType":"null","col":0,"comment":"null","endLoc":258,"id":5261,"name":"celfix","nodeType":"Attribute","startLoc":258,"text":"celfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":268,"id":5262,"name":"cname","nodeType":"Attribute","startLoc":268,"text":"cname"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":5263,"name":"_hash","nodeType":"Attribute","startLoc":32,"text":"self._hash"},{"attributeType":"null","col":0,"comment":"null","endLoc":273,"id":5264,"name":"colax","nodeType":"Attribute","startLoc":273,"text":"colax"},{"attributeType":"null","col":0,"comment":"null","endLoc":278,"id":5265,"name":"colnum","nodeType":"Attribute","startLoc":278,"text":"colnum"},{"attributeType":"null","col":0,"comment":"null","endLoc":288,"id":5266,"name":"compare","nodeType":"Attribute","startLoc":288,"text":"compare"},{"attributeType":"null","col":8,"comment":"null","endLoc":34,"id":5267,"name":"_path","nodeType":"Attribute","startLoc":34,"text":"self._path"},{"attributeType":"null","col":0,"comment":"null","endLoc":331,"id":5268,"name":"convert","nodeType":"Attribute","startLoc":331,"text":"convert"},{"attributeType":"null","col":0,"comment":"null","endLoc":338,"id":5269,"name":"coord","nodeType":"Attribute","startLoc":338,"text":"coord"},{"attributeType":"null","col":0,"comment":"null","endLoc":350,"id":5270,"name":"copy","nodeType":"Attribute","startLoc":350,"text":"copy"},{"attributeType":"null","col":0,"comment":"null","endLoc":354,"id":5271,"name":"cpdis1","nodeType":"Attribute","startLoc":354,"text":"cpdis1"},{"attributeType":"null","col":0,"comment":"null","endLoc":360,"id":5272,"name":"cpdis2","nodeType":"Attribute","startLoc":360,"text":"cpdis2"},{"attributeType":"null","col":0,"comment":"null","endLoc":366,"id":5273,"name":"crder","nodeType":"Attribute","startLoc":366,"text":"crder"},{"attributeType":"null","col":0,"comment":"null","endLoc":373,"id":5274,"name":"crota","nodeType":"Attribute","startLoc":373,"text":"crota"},{"attributeType":"null","col":20,"comment":"null","endLoc":66,"id":5275,"name":"_attributes","nodeType":"Attribute","startLoc":66,"text":"self._attributes"},{"attributeType":"null","col":0,"comment":"null","endLoc":397,"id":5276,"name":"crpix","nodeType":"Attribute","startLoc":397,"text":"crpix"},{"attributeType":"null","col":0,"comment":"null","endLoc":402,"id":5277,"name":"crval","nodeType":"Attribute","startLoc":402,"text":"crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":407,"id":5278,"name":"crval_tabprm","nodeType":"Attribute","startLoc":407,"text":"crval_tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":412,"id":5279,"name":"csyer","nodeType":"Attribute","startLoc":412,"text":"csyer"},{"attributeType":"null","col":0,"comment":"null","endLoc":419,"id":5280,"name":"ctype","nodeType":"Attribute","startLoc":419,"text":"ctype"},{"attributeType":"null","col":0,"comment":"null","endLoc":427,"id":5281,"name":"cubeface","nodeType":"Attribute","startLoc":427,"text":"cubeface"},{"attributeType":"null","col":0,"comment":"null","endLoc":463,"id":5282,"name":"cunit","nodeType":"Attribute","startLoc":463,"text":"cunit"},{"attributeType":"null","col":0,"comment":"null","endLoc":494,"id":5283,"name":"cylfix","nodeType":"Attribute","startLoc":494,"text":"cylfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":505,"id":5284,"name":"data","nodeType":"Attribute","startLoc":505,"text":"data"},{"attributeType":"null","col":0,"comment":"null","endLoc":510,"id":5285,"name":"data_wtbarr","nodeType":"Attribute","startLoc":510,"text":"data_wtbarr"},{"attributeType":"null","col":0,"comment":"null","endLoc":516,"id":5286,"name":"dateavg","nodeType":"Attribute","startLoc":516,"text":"dateavg"},{"attributeType":"null","col":0,"comment":"null","endLoc":526,"id":5287,"name":"dateobs","nodeType":"Attribute","startLoc":526,"text":"dateobs"},{"attributeType":"null","col":0,"comment":"null","endLoc":536,"id":5288,"name":"datfix","nodeType":"Attribute","startLoc":536,"text":"datfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":554,"id":5289,"name":"delta","nodeType":"Attribute","startLoc":554,"text":"delta"},{"attributeType":"null","col":0,"comment":"null","endLoc":563,"id":5290,"name":"det2im","nodeType":"Attribute","startLoc":563,"text":"det2im"},{"attributeType":"null","col":8,"comment":"null","endLoc":29,"id":5291,"name":"url","nodeType":"Attribute","startLoc":29,"text":"self.url"},{"attributeType":"null","col":0,"comment":"null","endLoc":567,"id":5292,"name":"det2im1","nodeType":"Attribute","startLoc":567,"text":"det2im1"},{"attributeType":"null","col":0,"comment":"null","endLoc":572,"id":5293,"name":"det2im2","nodeType":"Attribute","startLoc":572,"text":"det2im2"},{"attributeType":"null","col":0,"comment":"null","endLoc":577,"id":5294,"name":"dims","nodeType":"Attribute","startLoc":577,"text":"dims"},{"attributeType":"null","col":0,"comment":"null","endLoc":584,"id":5295,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":584,"text":"DistortionLookupTable"},{"attributeType":"null","col":0,"comment":"null","endLoc":605,"id":5296,"name":"equinox","nodeType":"Attribute","startLoc":605,"text":"equinox"},{"attributeType":"null","col":0,"comment":"null","endLoc":615,"id":5297,"name":"extlev","nodeType":"Attribute","startLoc":615,"text":"extlev"},{"attributeType":"null","col":0,"comment":"null","endLoc":621,"id":5298,"name":"extnam","nodeType":"Attribute","startLoc":621,"text":"extnam"},{"attributeType":"null","col":0,"comment":"null","endLoc":627,"id":5299,"name":"extrema","nodeType":"Attribute","startLoc":627,"text":"extrema"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":5300,"name":"timeout","nodeType":"Attribute","startLoc":38,"text":"self.timeout"},{"attributeType":"null","col":0,"comment":"null","endLoc":642,"id":5301,"name":"extver","nodeType":"Attribute","startLoc":642,"text":"extver"},{"attributeType":"null","col":0,"comment":"null","endLoc":648,"id":5302,"name":"find_all_wcs","nodeType":"Attribute","startLoc":648,"text":"find_all_wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":688,"id":5303,"name":"fix","nodeType":"Attribute","startLoc":688,"text":"fix"},{"attributeType":"null","col":0,"comment":"null","endLoc":746,"id":5304,"name":"get_offset","nodeType":"Attribute","startLoc":746,"text":"get_offset"},{"attributeType":"null","col":0,"comment":"null","endLoc":757,"id":5305,"name":"get_cdelt","nodeType":"Attribute","startLoc":757,"text":"get_cdelt"},{"attributeType":"null","col":0,"comment":"null","endLoc":770,"id":5306,"name":"get_pc","nodeType":"Attribute","startLoc":770,"text":"get_pc"},{"attributeType":"null","col":0,"comment":"null","endLoc":781,"id":5307,"name":"get_ps","nodeType":"Attribute","startLoc":781,"text":"get_ps"},{"attributeType":"null","col":0,"comment":"null","endLoc":803,"id":5308,"name":"get_pv","nodeType":"Attribute","startLoc":803,"text":"get_pv"},{"attributeType":"null","col":0,"comment":"null","endLoc":833,"id":5309,"name":"has_cd","nodeType":"Attribute","startLoc":833,"text":"has_cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":858,"id":5310,"name":"has_cdi_ja","nodeType":"Attribute","startLoc":858,"text":"has_cdi_ja"},{"attributeType":"null","col":0,"comment":"null","endLoc":865,"id":5311,"name":"has_crota","nodeType":"Attribute","startLoc":865,"text":"has_crota"},{"attributeType":"null","col":0,"comment":"null","endLoc":887,"id":5312,"name":"has_crotaia","nodeType":"Attribute","startLoc":887,"text":"has_crotaia"},{"attributeType":"null","col":0,"comment":"null","endLoc":894,"id":5313,"name":"has_pc","nodeType":"Attribute","startLoc":894,"text":"has_pc"},{"attributeType":"null","col":0,"comment":"null","endLoc":905,"id":5314,"name":"has_pci_ja","nodeType":"Attribute","startLoc":905,"text":"has_pci_ja"},{"attributeType":"null","col":0,"comment":"null","endLoc":912,"id":5315,"name":"i","nodeType":"Attribute","startLoc":912,"text":"i"},{"attributeType":"null","col":0,"comment":"null","endLoc":918,"id":5316,"name":"imgpix_matrix","nodeType":"Attribute","startLoc":918,"text":"imgpix_matrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":926,"id":5317,"name":"is_unity","nodeType":"Attribute","startLoc":926,"text":"is_unity"},{"attributeType":"null","col":0,"comment":"null","endLoc":933,"id":5318,"name":"K","nodeType":"Attribute","startLoc":933,"text":"K"},{"attributeType":"null","col":0,"comment":"null","endLoc":941,"id":5319,"name":"kind","nodeType":"Attribute","startLoc":941,"text":"kind"},{"attributeType":"null","col":0,"comment":"null","endLoc":950,"id":5320,"name":"lat","nodeType":"Attribute","startLoc":950,"text":"lat"},{"attributeType":"null","col":0,"comment":"null","endLoc":955,"id":5321,"name":"latpole","nodeType":"Attribute","startLoc":955,"text":"latpole"},{"attributeType":"null","col":0,"comment":"null","endLoc":959,"id":5322,"name":"lattyp","nodeType":"Attribute","startLoc":959,"text":"lattyp"},{"attributeType":"null","col":0,"comment":"null","endLoc":967,"id":5323,"name":"lng","nodeType":"Attribute","startLoc":967,"text":"lng"},{"attributeType":"null","col":0,"comment":"null","endLoc":972,"id":5324,"name":"lngtyp","nodeType":"Attribute","startLoc":972,"text":"lngtyp"},{"attributeType":"null","col":0,"comment":"null","endLoc":980,"id":5325,"name":"lonpole","nodeType":"Attribute","startLoc":980,"text":"lonpole"},{"attributeType":"null","col":0,"comment":"null","endLoc":986,"id":5326,"name":"M","nodeType":"Attribute","startLoc":986,"text":"M"},{"attributeType":"null","col":0,"comment":"null","endLoc":990,"id":5327,"name":"m","nodeType":"Attribute","startLoc":990,"text":"m"},{"attributeType":"null","col":0,"comment":"null","endLoc":996,"id":5328,"name":"map","nodeType":"Attribute","startLoc":996,"text":"map"},{"attributeType":"null","col":0,"comment":"null","endLoc":1019,"id":5329,"name":"mix","nodeType":"Attribute","startLoc":1019,"text":"mix"},{"col":0,"comment":"","endLoc":5,"header":"result.py#<anonymous>","id":5330,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nContains a class to handle a validation result for a single VOTable\nfile.\n\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":1155,"id":5331,"name":"mjdavg","nodeType":"Attribute","startLoc":1155,"text":"mjdavg"},{"attributeType":"null","col":0,"comment":"null","endLoc":1167,"id":5332,"name":"mjdobs","nodeType":"Attribute","startLoc":1167,"text":"mjdobs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1179,"id":5333,"name":"name","nodeType":"Attribute","startLoc":1179,"text":"name"},{"attributeType":"null","col":0,"comment":"null","endLoc":1184,"id":5334,"name":"naxis","nodeType":"Attribute","startLoc":1184,"text":"naxis"},{"attributeType":"null","col":0,"comment":"null","endLoc":1210,"id":5335,"name":"nc","nodeType":"Attribute","startLoc":1210,"text":"nc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1217,"id":5336,"name":"ndim","nodeType":"Attribute","startLoc":1217,"text":"ndim"},{"col":4,"comment":"null","endLoc":2789,"header":"def _write_tabledata(self, w, **kwargs)","id":5337,"name":"_write_tabledata","nodeType":"Function","startLoc":2742,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1223,"id":5338,"name":"obsgeo","nodeType":"Attribute","startLoc":1223,"text":"obsgeo"},{"attributeType":"null","col":0,"comment":"null","endLoc":1232,"id":5339,"name":"p0","nodeType":"Attribute","startLoc":1232,"text":"p0"},{"attributeType":"null","col":0,"comment":"null","endLoc":1240,"id":5340,"name":"p2s","nodeType":"Attribute","startLoc":1240,"text":"p2s"},{"attributeType":"null","col":0,"comment":"null","endLoc":1316,"id":5341,"name":"p4_pix2foc","nodeType":"Attribute","startLoc":1316,"text":"p4_pix2foc"},{"fileName":"wcs.py","filePath":"astropy/wcs","id":5342,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nUnder the hood, there are 3 separate classes that perform different\nparts 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\nAdditionally, the class `WCS` aggregates all of these transformations\ntogether 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\"\"\"\n\n# STDLIB\nimport copy\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 .. import log\nfrom ..io import fits\nfrom . import _docutil as __\ntry:\n    from . import _wcs\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n    else:\n        _wcs = None\n\nfrom ..utils.compat import possible_filename\nfrom ..utils.exceptions import AstropyWarning, AstropyUserWarning, AstropyDeprecationWarning\n\n__all__ = ['FITSFixedWarning', 'WCS', 'find_all_wcs',\n           'DistortionLookupTable', 'Sip', 'Tabprm', 'Wcsprm',\n           'WCSBase', 'validate', 'WcsError', 'SingularMatrixError',\n           'InconsistentAxisTypesError', 'InvalidTransformError',\n           'InvalidCoordinateError', '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    Tabprm = _wcs.Tabprm\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\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')):\n            locals()[key] = val\n            __all__.append(key)\nelse:\n    WCSBase = object\n    Wcsprm = object\n    DistortionLookupTable = object\n    Sip = object\n    Tabprm = 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(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    Parameters\n    ----------\n    header : astropy.io.fits header object, Primary HDU, Image HDU, string, 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 : An astropy.io.fits file (hdulist) object, 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:`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 flags, 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    \"\"\"\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        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            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            except _wcs.NoWcsKeywordsFoundError:\n                est_naxis = 0\n            else:\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis\n                else:\n                    est_naxis = 2\n\n            header = fits.Header.fromstring(header_string)\n\n            if est_naxis == 0:\n                est_naxis = 2\n            self.naxis = est_naxis\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)\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)\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 {0} 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 ({0:d}) than the \"\n                    \"image it is associated with ({1: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            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    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        copy = self.deepcopy()\n        copy.wcs = self.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n        return copy\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[naxis], 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                    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 : length 2 sequence ints, 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 = self._naxis1\n                    naxis2 = self._naxis2\n                except AttributeError:\n                    warnings.warn(\"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[str('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), ('An astropy.io.fits.HDUList'\n                                'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + str('.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 + str('.AXIS.{0:d}').format(i)\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('D2IMARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('D2IMARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('D2IMARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0), d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0), d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0), d_header.get(str('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 list(header):\n                    if key.startswith(dp + str('.')):\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(\"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[(str('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[(str('D2IMARR'), 1)].header\n        naxis = d2im_hdr[str('NAXIS')]\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get(str('CRPIX') + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get(str('CRVAL') + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get(str('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        err_kw = 'D2IMERR'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n            str('{0}{1:d}').format(dist, num),\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(det2im.data.shape), 'Number of independent variables in d2im function')\n            for i in range(det2im.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1, 'Axis number of the jth independent variable in a d2im function')\n\n            image = fits.ImageHDU(det2im.data, name=str('D2IMARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (det2im.crpix[0],\n                                     'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (det2im.crpix[1],\n                                     'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (det2im.crval[0],\n                                     'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (det2im.crval[1],\n                                     'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (det2im.cdelt[0],\n                                     'Coordinate increment along axis')\n            header[str('CDELT2')] = (det2im.cdelt[1],\n                                     'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\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 = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('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 + str('.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 + str('.AXIS.{0:d}'.format(i))\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('WCSDVARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('WCSDVARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('WCSDVARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0),\n                               d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0),\n                               d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0),\n                               d_header.get(str('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 list(header):\n                        if key.startswith(dp + str('.')):\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        `fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('CQERR')\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(cpdis.data.shape), 'Number of independent variables in distortion function')\n\n            for i in range(cpdis.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1,\n                    'Axis number of the jth independent variable in a distortion function')\n\n            image = fits.ImageHDU(cpdis.data, name=str('WCSDVARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header[str('CDELT2')] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\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 (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 str(\"A_ORDER\") in header and header[str('A_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"A_{0}_{1}\").format(i, j)\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"B_{0}_{1}\").format(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[str('A_ORDER')]\n            del header[str('B_ORDER')]\n\n            ctype = [header['CTYPE{0}{1}'.format(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                \"\"\"\n                log.info(message)\n        elif str(\"B_ORDER\") in header and header[str('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 str(\"AP_ORDER\") in header and header[str('AP_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"AP_{0}_{1}\").format(i, j)\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"BP_{0}_{1}\").format(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[str('AP_ORDER')]\n            del header[str('BP_ORDER')]\n        elif str(\"BP_ORDER\") in header and header[str('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 str(\"CRPIX1{0}\".format(wcskey)) not in header or str(\"CRPIX2{0}\".format(wcskey)) not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(\"CRPIX1{0}\".format(wcskey))\n        crpix2 = header.get(\"CRPIX2{0}\".format(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            keywords[str('{0}_ORDER').format(name)] = size - 1\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            str('{0}_{1:d}_{2:d}').format(name, i, j)] = a[i, j]\n\n        write_array(str('A'), self.sip.a)\n        write_array(str('B'), self.sip.b)\n        write_array(str('AP'), self.sip.ap)\n        write_array(str('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            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, {0})\".format(self.naxis))\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][{0}], origin)\".format(self.naxis))\n            if self.naxis == 1 and 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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        Returns\n        -------\n\n        {2}\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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        Returns\n        -------\n\n        {2}\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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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 self.sip is None and \\\n           self.cpdis1 is None and self.cpdis2 is None and \\\n           self.det2im1 is None and self.det2im2 is None:\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                # Bookeeping 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 {0: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    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, accuracy=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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\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 `~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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.RETURNS('pixel coordinates', 8))\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:`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:`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\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\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        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: {0} \"\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 = 'CTYPE{0}{1}'.format(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('{}\\n'.format(coordsys))\n            f.write('polygon(')\n            self.calc_footprint().tofile(f, sep=',')\n            f.write(') # color={0}, width={1:d} \\n'.format(color, width))\n\n    @property\n    def _naxis1(self):\n        return self._naxis[0]\n\n    @_naxis1.setter\n    def _naxis1(self, value):\n        self._naxis[0] = value\n\n    @property\n    def _naxis2(self):\n        return self._naxis[1]\n\n    @_naxis2.setter\n    def _naxis2(self, value):\n        self._naxis[1] = value\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['NAXIS{}'.format(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                       \"Number of WCS axes: {0!r}\".format(self.naxis)]\n        sfmt = ' : ' + \"\".join([\"{\"+\"{0}\".format(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('NAXIS : {}'.format('  '.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 dicts\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        return (__WCS_unpickle__,\n                (self.__class__, self.__dict__, 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        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        A new `~astropy.wcs.WCS` instance with the same number of axes, but two\n        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])\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            raise ValueError(\"Cannot downsample a WCS with indexing.  Use \"\n                             \"wcs.sub or wcs.dropaxis if you want to remove \"\n                             \"axes.\")\n\n        wcs_new = self.deepcopy()\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                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitary 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{0} attribute is not updated because at \"\n                              \"least one indix ('{1}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\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(\"'{0}' object is not iterable\".format(self.__class__.__name__))\n\n    @property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\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])\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.celestial.naxis == 2\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.matrix(np.diag(self.wcs.get_cdelt()))\n            pc = np.matrix(self.wcs.get_pc())\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                cdelt = np.matrix(self.wcs.cd) * np.matrix(np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.matrix(np.diag(self.wcs.cdelt))\n\n            try:\n                pc = np.matrix(self.wcs.pc)\n            except AttributeError:\n                pc = 1\n\n        pccd = np.array(cdelt * pc)\n\n        return pccd\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes.\n\n        With this method, one can do:\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n\n            wcs = WCS('filename.fits')\n\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 ..visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}\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    self.__dict__.update(dct)\n\n    buffer = io.BytesIO(fits_data)\n    hdulist = fits.open(buffer)\n\n    WCS.__init__(self, hdulist[0].header, hdulist)\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:`relaxread` for details.\n\n    keysel : sequence of flags, 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` objects\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 path, readable file-like object or `astropy.io.fits.HDUList` object\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : WcsValidateResults 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    class _WcsValidateWcsResult(list):\n        def __init__(self, key):\n            self._key = key\n\n        def __repr__(self):\n            result = [\"  WCS key '{0}':\".format(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 = ' ({0})'.format(self._hdu_name)\n                else:\n                    hdu_name = ''\n                result = ['HDU {0}{1}:'.format(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":0,"comment":"null","endLoc":1343,"id":5343,"name":"pc","nodeType":"Attribute","startLoc":1343,"text":"pc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1372,"id":5344,"name":"phi0","nodeType":"Attribute","startLoc":1372,"text":"phi0"},{"attributeType":"null","col":0,"comment":"null","endLoc":1384,"id":5345,"name":"pix2foc","nodeType":"Attribute","startLoc":1384,"text":"pix2foc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1411,"id":5346,"name":"piximg_matrix","nodeType":"Attribute","startLoc":1411,"text":"piximg_matrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1416,"id":5347,"name":"print_contents","nodeType":"Attribute","startLoc":1416,"text":"print_contents"},{"attributeType":"null","col":0,"comment":"null","endLoc":1426,"id":5348,"name":"print_contents_tabprm","nodeType":"Attribute","startLoc":1426,"text":"print_contents_tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":1436,"id":5349,"name":"radesys","nodeType":"Attribute","startLoc":1436,"text":"radesys"},{"attributeType":"null","col":0,"comment":"null","endLoc":1441,"id":5350,"name":"restfrq","nodeType":"Attribute","startLoc":1441,"text":"restfrq"},{"col":0,"comment":"null","endLoc":24,"header":"def b(s)","id":5351,"name":"b","nodeType":"Function","startLoc":23,"text":"def b(s):\n    return s.encode('ascii')"},{"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":204,"id":5352,"nodeType":"Class","startLoc":155,"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":0,"comment":"null","endLoc":1447,"id":5353,"name":"restwav","nodeType":"Attribute","startLoc":1447,"text":"restwav"},{"attributeType":"null","col":0,"comment":"null","endLoc":1453,"id":5354,"name":"row","nodeType":"Attribute","startLoc":1453,"text":"row"},{"col":4,"comment":"null","endLoc":204,"header":"def __init__(self, *args, best_solution=None, accuracy=None, niter=None,\n                 divergent=None, slow_conv=None, **kwargs)","id":5355,"name":"__init__","nodeType":"Function","startLoc":190,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1459,"id":5356,"name":"s2p","nodeType":"Attribute","startLoc":1459,"text":"s2p"},{"col":0,"comment":"null","endLoc":31,"header":"def string_escape(s)","id":5357,"name":"string_escape","nodeType":"Function","startLoc":27,"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":"null","col":0,"comment":"null","endLoc":1529,"id":5358,"name":"sense","nodeType":"Attribute","startLoc":1529,"text":"sense"},{"attributeType":"null","col":0,"comment":"null","endLoc":1537,"id":5359,"name":"set","nodeType":"Attribute","startLoc":1537,"text":"set"},{"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":60,"header":"def determine_64_bit_int()","id":5360,"name":"determine_64_bit_int","nodeType":"Function","startLoc":34,"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\""},{"attributeType":"null","col":0,"comment":"null","endLoc":1581,"id":5361,"name":"set_tabprm","nodeType":"Attribute","startLoc":1581,"text":"set_tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":1600,"id":5362,"name":"set_ps","nodeType":"Attribute","startLoc":1600,"text":"set_ps"},{"attributeType":"null","col":0,"comment":"null","endLoc":1623,"id":5363,"name":"set_pv","nodeType":"Attribute","startLoc":1623,"text":"set_pv"},{"col":0,"comment":"\n    Writes out the wcsconfig.h header with local configuration.\n    ","endLoc":108,"header":"def write_wcsconfig_h(paths)","id":5364,"name":"write_wcsconfig_h","nodeType":"Function","startLoc":63,"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 {0}\n\n    /* 64-bit integer data type. */\n    #define WCSLIB_INT64 {1}\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        setup_helpers.write_if_different(path, content)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1646,"id":5365,"name":"sip","nodeType":"Attribute","startLoc":1646,"text":"sip"},{"attributeType":"null","col":0,"comment":"null","endLoc":1651,"id":5366,"name":"Sip","nodeType":"Attribute","startLoc":1651,"text":"Sip"},{"attributeType":"null","col":8,"comment":"null","endLoc":194,"id":5367,"name":"best_solution","nodeType":"Attribute","startLoc":194,"text":"self.best_solution"},{"attributeType":"null","col":0,"comment":"null","endLoc":1685,"id":5368,"name":"sip_foc2pix","nodeType":"Attribute","startLoc":1685,"text":"sip_foc2pix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1712,"id":5369,"name":"sip_pix2foc","nodeType":"Attribute","startLoc":1712,"text":"sip_pix2foc"},{"attributeType":"null","col":8,"comment":"null","endLoc":197,"id":5370,"name":"divergent","nodeType":"Attribute","startLoc":197,"text":"self.divergent"},{"attributeType":"null","col":0,"comment":"null","endLoc":1739,"id":5371,"name":"spcfix","nodeType":"Attribute","startLoc":1739,"text":"spcfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":1752,"id":5372,"name":"spec","nodeType":"Attribute","startLoc":1752,"text":"spec"},{"attributeType":"null","col":0,"comment":"null","endLoc":1756,"id":5373,"name":"specsys","nodeType":"Attribute","startLoc":1756,"text":"specsys"},{"attributeType":"null","col":0,"comment":"null","endLoc":1764,"id":5374,"name":"sptr","nodeType":"Attribute","startLoc":1764,"text":"sptr"},{"attributeType":"null","col":0,"comment":"null","endLoc":1813,"id":5375,"name":"ssysobs","nodeType":"Attribute","startLoc":1813,"text":"ssysobs"},{"attributeType":"null","col":0,"comment":"null","endLoc":1825,"id":5376,"name":"ssyssrc","nodeType":"Attribute","startLoc":1825,"text":"ssyssrc"},{"attributeType":"null","col":0,"comment":"null","endLoc":1832,"id":5377,"name":"sub","nodeType":"Attribute","startLoc":1832,"text":"sub"},{"attributeType":"null","col":0,"comment":"null","endLoc":1932,"id":5378,"name":"tab","nodeType":"Attribute","startLoc":1932,"text":"tab"},{"attributeType":"null","col":0,"comment":"null","endLoc":1938,"id":5379,"name":"Tabprm","nodeType":"Attribute","startLoc":1938,"text":"Tabprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":1946,"id":5380,"name":"theta0","nodeType":"Attribute","startLoc":1946,"text":"theta0"},{"attributeType":"null","col":0,"comment":"null","endLoc":1958,"id":5381,"name":"to_header","nodeType":"Attribute","startLoc":1958,"text":"to_header"},{"attributeType":"null","col":0,"comment":"null","endLoc":2030,"id":5382,"name":"ttype","nodeType":"Attribute","startLoc":2030,"text":"ttype"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":5383,"name":"slow_conv","nodeType":"Attribute","startLoc":198,"text":"self.slow_conv"},{"attributeType":"null","col":0,"comment":"null","endLoc":2037,"id":5384,"name":"unitfix","nodeType":"Attribute","startLoc":2037,"text":"unitfix"},{"attributeType":"null","col":0,"comment":"null","endLoc":2074,"id":5385,"name":"velangl","nodeType":"Attribute","startLoc":2074,"text":"velangl"},{"attributeType":"null","col":0,"comment":"null","endLoc":2083,"id":5386,"name":"velosys","nodeType":"Attribute","startLoc":2083,"text":"velosys"},{"attributeType":"null","col":0,"comment":"null","endLoc":2097,"id":5387,"name":"velref","nodeType":"Attribute","startLoc":2097,"text":"velref"},{"attributeType":"null","col":0,"comment":"null","endLoc":2103,"id":5388,"name":"wcs","nodeType":"Attribute","startLoc":2103,"text":"wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2108,"id":5389,"name":"Wcs","nodeType":"Attribute","startLoc":2108,"text":"Wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":2130,"id":5390,"name":"Wcsprm","nodeType":"Attribute","startLoc":2130,"text":"Wcsprm"},{"attributeType":"null","col":0,"comment":"null","endLoc":2206,"id":5391,"name":"Wtbarr","nodeType":"Attribute","startLoc":2206,"text":"Wtbarr"},{"attributeType":"null","col":0,"comment":"null","endLoc":2214,"id":5392,"name":"zsource","nodeType":"Attribute","startLoc":2214,"text":"zsource"},{"attributeType":"null","col":0,"comment":"null","endLoc":2220,"id":5393,"name":"WcsError","nodeType":"Attribute","startLoc":2220,"text":"WcsError"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":5394,"name":"accuracy","nodeType":"Attribute","startLoc":195,"text":"self.accuracy"},{"attributeType":"null","col":0,"comment":"null","endLoc":2224,"id":5395,"name":"SingularMatrix","nodeType":"Attribute","startLoc":2224,"text":"SingularMatrix"},{"attributeType":"null","col":0,"comment":"null","endLoc":2230,"id":5396,"name":"InconsistentAxisTypes","nodeType":"Attribute","startLoc":2230,"text":"InconsistentAxisTypes"},{"attributeType":"null","col":0,"comment":"null","endLoc":2236,"id":5397,"name":"InvalidTransform","nodeType":"Attribute","startLoc":2236,"text":"InvalidTransform"},{"col":0,"comment":"null","endLoc":175,"header":"def generate_c_docstrings()","id":5398,"name":"generate_c_docstrings","nodeType":"Function","startLoc":115,"text":"def generate_c_docstrings():\n    from astropy.wcs import docstrings\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('extern char doc_{0}[{1}];\\n'.format(key, len(val)))\n    h_file.write(\"\\n#endif\\n\\n\")\n\n    setup_helpers.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('char doc_{0}[{1}] = {{\\n'.format(key, len(val)))\n        for i in range(0, len(val), 12):\n            section = val[i:i+12]\n            c_file.write('    ')\n            c_file.write(''.join('0x{0:02x}, '.format(x) for x in section))\n            c_file.write('\\n')\n\n        c_file.write(\"    };\\n\\n\")\n\n    setup_helpers.write_if_different(\n        join(WCSROOT, 'src', 'docstrings.c'),\n        c_file.getvalue().encode('utf-8'))"},{"attributeType":"null","col":0,"comment":"null","endLoc":2243,"id":5399,"name":"InvalidCoordinate","nodeType":"Attribute","startLoc":2243,"text":"InvalidCoordinate"},{"attributeType":"null","col":0,"comment":"null","endLoc":2249,"id":5400,"name":"NoSolution","nodeType":"Attribute","startLoc":2249,"text":"NoSolution"},{"attributeType":"null","col":0,"comment":"null","endLoc":2255,"id":5401,"name":"InvalidSubimageSpecification","nodeType":"Attribute","startLoc":2255,"text":"InvalidSubimageSpecification"},{"attributeType":"null","col":0,"comment":"null","endLoc":2261,"id":5402,"name":"NonseparableSubimageCoordinateSystem","nodeType":"Attribute","startLoc":2261,"text":"NonseparableSubimageCoordinateSystem"},{"attributeType":"null","col":0,"comment":"null","endLoc":2267,"id":5403,"name":"NoWcsKeywordsFound","nodeType":"Attribute","startLoc":2267,"text":"NoWcsKeywordsFound"},{"attributeType":"null","col":0,"comment":"null","endLoc":2273,"id":5404,"name":"InvalidTabularParameters","nodeType":"Attribute","startLoc":2273,"text":"InvalidTabularParameters"},{"attributeType":"null","col":8,"comment":"null","endLoc":196,"id":5405,"name":"niter","nodeType":"Attribute","startLoc":196,"text":"self.niter"},{"col":0,"comment":"","endLoc":9,"header":"docstrings.py#<anonymous>","id":5406,"name":"<anonymous>","nodeType":"Function","startLoc":9,"text":"a = \"\"\"\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nworld : double array[ncoord][nelem]\n    Returns an array of world coordinates.\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\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\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 may be or'ed together to loosen the\n    comparison.\n\n    - ``WCSCOMPARE_ANCILLARY``: Ignores ancillary keywords that don't\n      change the WCS transformation, such as ``DATE-OBS`` or\n      ``EQUINOX``.\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\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\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)\n\n``EXTLEV`` identifying the binary table extension.\n\"\"\"\n\nextnam = \"\"\"\n``str`` (read-only)\n\n``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)\n\n``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:`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` objects\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[naxis], 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 : coordinate pair\n    The offset from the distortion table for pixel point (*x*, *y*).\n\"\"\"\n\nget_cdelt = \"\"\"\nget_cdelt() -> double array[naxis]\n\nCoordinate increments (``CDELTia``) for each coord axis.\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() -> double array[naxis][naxis]\n\nReturns the ``PC`` matrix in read-only form.  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 of tuples\n\nReturns ``PSi_ma`` keywords for each *i* and *m*.\n\nReturns\n-------\nps : list of tuples\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 of tuples\n\nReturns ``PVi_ma`` keywords for each *i* and *m*.\n\nReturns\n-------\n\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\ni = \"\"\"\n``int`` (read-only)\n\nImage 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)\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)\n\nArray 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 : pair of floats\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 : double array[naxis]\n    World coordinate elements.  ``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 : double array[naxis].\n    Pixel coordinates.  The element indicated by *mixpix* is given and\n    the remaining elements will be written in-place.\n\n{0}\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)\n\nExpected 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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nresult : dict\n    Returns a dictionary with the following keys:\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.  For\n        spectral axes, ``imgcrd[][self.spec]`` is the intermediate\n        spectral coordinate, in SI units.\n\n    - *phi*: double array[ncoord]\n\n    - *theta*: double array[ncoord]\n\n      - Longitude and latitude in the native coordinate system of the\n        projection, in degrees.\n\n    - *world*: double array[ncoord][nelem]\n\n      - Array of world coordinates.  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*: int array[ncoord]\n\n      - Status return value for each coordinate. ``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 : double array[ncoord][nelem].\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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\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)\n\nTable row number.\n\"\"\"\n\ns2p = \"\"\"\ns2p(world, origin)\n\nTransforms world coordinates to pixel coordinates.\n\nParameters\n----------\nworld : double array[ncoord][nelem]\n    Array of world coordinates, in decimal degrees.\n\n{0}\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\nInvalidTabularParameters\n    Invalid tabular parameters.\n\"\"\"\n\nset_ps = \"\"\"\nset_ps(ps)\n\nSets ``PSi_ma`` keywords for each *i* and *m*.\n\nParameters\n----------\nps : sequence of tuples\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 tuples\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 : double array[m+1][m+1]\n    The ``A_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``A_ORDER``.\n\nb : double array[m+1][m+1]\n    The ``B_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``B_ORDER``.\n\nap : double array[m+1][m+1]\n    The ``AP_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``AP_ORDER``.\n\nbp : double array[m+1][m+1]\n    The ``BP_i_j`` polynomial for pixel to focal plane transformation.\n    Its size must be (*m* + 1, *m* + 1) where *m* = ``BP_ORDER``.\n\ncrpix : double array[2]\n    The reference pixel.\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 : double array[ncoord][nelem]\n    Array of focal plane coordinates.\n\n{0}\n\nReturns\n-------\npixcrd : double array[ncoord][nelem]\n    Returns an array of pixel coordinates.\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 : double array[ncoord][nelem]\n    Array of pixel coordinates.\n\n{0}\n\nReturns\n-------\nfoccrd : double array[ncoord][nelem]\n    Returns an array of focal plane coordinates.\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\nNonseparableSubimageCoordinateSystem\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:`relaxwrite` for details.\n\nReturns\n-------\nheader : str\n    Raw FITS header as a string.\n\"\"\"\n\nttype = \"\"\"\n``str`` (read-only)\n\n``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 : A pair of `~astropy.wcs.DistortionLookupTable` objects, or\n  ``(None, None)``.\n\nwcsprm : `~astropy.wcs.Wcsprm` object\n\ndet2im : A pair of `~astropy.wcs.DistortionLookupTable` objects, or\n   ``(None, 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\nParameters\n----------\nheader : An `astropy.io.fits.Header`, string, 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:`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\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\"\"\""},{"col":4,"comment":"null","endLoc":2824,"header":"def _write_binary(self, mode, w, **kwargs)","id":5407,"name":"_write_binary","nodeType":"Function","startLoc":2791,"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=\"(in row {:d}, col '{}')\".format(\n                                    row, fields[i].ID))\n                        data.write(chunk)\n\n                w._flush()\n                w.write(base64.b64encode(data.getvalue()).decode('ascii'))"},{"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":212,"id":5408,"nodeType":"Class","startLoc":207,"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"},{"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    Parameters\n    ----------\n    header : astropy.io.fits header object, Primary HDU, Image HDU, string, 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 : An astropy.io.fits file (hdulist) object, 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:`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 flags, 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":3069,"id":5409,"nodeType":"Class","startLoc":215,"text":"class WCS(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    Parameters\n    ----------\n    header : astropy.io.fits header object, Primary HDU, Image HDU, string, 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 : An astropy.io.fits file (hdulist) object, 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:`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 flags, 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    \"\"\"\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        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            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            except _wcs.NoWcsKeywordsFoundError:\n                est_naxis = 0\n            else:\n                if naxis is not None:\n                    try:\n                        tmp_wcsprm.sub(naxis)\n                    except ValueError:\n                        pass\n                    est_naxis = tmp_wcsprm.naxis\n                else:\n                    est_naxis = 2\n\n            header = fits.Header.fromstring(header_string)\n\n            if est_naxis == 0:\n                est_naxis = 2\n            self.naxis = est_naxis\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)\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)\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 {0} 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 ({0:d}) than the \"\n                    \"image it is associated with ({1: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            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    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        copy = self.deepcopy()\n        copy.wcs = self.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n        return copy\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[naxis], 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                    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 : length 2 sequence ints, 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 = self._naxis1\n                    naxis2 = self._naxis2\n                except AttributeError:\n                    warnings.warn(\"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[str('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), ('An astropy.io.fits.HDUList'\n                                'is required for Lookup table distortion.')\n                    dp = (d_kw + str(i)).strip()\n                    dp_extver_key = dp + str('.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 + str('.AXIS.{0:d}').format(i)\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('D2IMARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('D2IMARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('D2IMARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0), d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0), d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0), d_header.get(str('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 list(header):\n                    if key.startswith(dp + str('.')):\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(\"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[(str('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[(str('D2IMARR'), 1)].header\n        naxis = d2im_hdr[str('NAXIS')]\n\n        for i in range(1, naxis + 1):\n            crpix[i - 1] = d2im_hdr.get(str('CRPIX') + str(i), 0.0)\n            crval[i - 1] = d2im_hdr.get(str('CRVAL') + str(i), 0.0)\n            cdelt[i - 1] = d2im_hdr.get(str('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        err_kw = 'D2IMERR'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n            str('{0}{1:d}').format(dist, num),\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(det2im.data.shape), 'Number of independent variables in d2im function')\n            for i in range(det2im.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1, 'Axis number of the jth independent variable in a d2im function')\n\n            image = fits.ImageHDU(det2im.data, name=str('D2IMARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (det2im.crpix[0],\n                                     'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (det2im.crpix[1],\n                                     'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (det2im.crval[0],\n                                     'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (det2im.crval[1],\n                                     'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (det2im.cdelt[0],\n                                     'Coordinate increment along axis')\n            header[str('CDELT2')] = (det2im.cdelt[1],\n                                     'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\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 = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('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 + str('.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 + str('.AXIS.{0:d}'.format(i))\n                    if i == header[dp_axis_key]:\n                        d_data = fobj[str('WCSDVARR'), d_extver].data\n                    else:\n                        d_data = (fobj[str('WCSDVARR'), d_extver].data).transpose()\n                    del header[dp_axis_key]\n                    d_header = fobj[str('WCSDVARR'), d_extver].header\n                    d_crpix = (d_header.get(str('CRPIX1'), 0.0),\n                               d_header.get(str('CRPIX2'), 0.0))\n                    d_crval = (d_header.get(str('CRVAL1'), 0.0),\n                               d_header.get(str('CRVAL2'), 0.0))\n                    d_cdelt = (d_header.get(str('CDELT1'), 1.0),\n                               d_header.get(str('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 list(header):\n                        if key.startswith(dp + str('.')):\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        `fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('CQERR')\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(cpdis.data.shape), 'Number of independent variables in distortion function')\n\n            for i in range(cpdis.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1,\n                    'Axis number of the jth independent variable in a distortion function')\n\n            image = fits.ImageHDU(cpdis.data, name=str('WCSDVARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header[str('CDELT2')] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\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 (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 str(\"A_ORDER\") in header and header[str('A_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"A_{0}_{1}\").format(i, j)\n                    if key in header:\n                        a[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"B_{0}_{1}\").format(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[str('A_ORDER')]\n            del header[str('B_ORDER')]\n\n            ctype = [header['CTYPE{0}{1}'.format(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                \"\"\"\n                log.info(message)\n        elif str(\"B_ORDER\") in header and header[str('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 str(\"AP_ORDER\") in header and header[str('AP_ORDER')] > 1:\n            if str(\"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[str(\"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 = str(\"AP_{0}_{1}\").format(i, j)\n                    if key in header:\n                        ap[i, j] = header[key]\n                        del header[key]\n\n            m = int(header[str(\"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 = str(\"BP_{0}_{1}\").format(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[str('AP_ORDER')]\n            del header[str('BP_ORDER')]\n        elif str(\"BP_ORDER\") in header and header[str('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 str(\"CRPIX1{0}\".format(wcskey)) not in header or str(\"CRPIX2{0}\".format(wcskey)) not in header:\n            raise ValueError(\n                \"Header has SIP keywords without CRPIX keywords\")\n\n        crpix1 = header.get(\"CRPIX1{0}\".format(wcskey))\n        crpix2 = header.get(\"CRPIX2{0}\".format(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            keywords[str('{0}_ORDER').format(name)] = size - 1\n            for i in range(size):\n                for j in range(size - i):\n                    if a[i, j] != 0.0:\n                        keywords[\n                            str('{0}_{1:d}_{2:d}').format(name, i, j)] = a[i, j]\n\n        write_array(str('A'), self.sip.a)\n        write_array(str('B'), self.sip.b)\n        write_array(str('AP'), self.sip.ap)\n        write_array(str('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            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, {0})\".format(self.naxis))\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][{0}], origin)\".format(self.naxis))\n            if self.naxis == 1 and 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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        Returns\n        -------\n\n        {2}\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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\n\n        Returns\n        -------\n\n        {2}\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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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 self.sip is None and \\\n           self.cpdis1 is None and self.cpdis2 is None and \\\n           self.det2im1 is None and self.det2im2 is None:\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                # Bookeeping 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 {0: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    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, accuracy=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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n            For a transformation that is not two-dimensional, the\n            two-argument form must be used.\n\n        {1}\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 `~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(__.TWO_OR_MORE_ARGS('naxis', 8),\n                   __.RA_DEC_ORDER(8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.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        {0}\n\n        Returns\n        -------\n\n        {1}\n\n        Raises\n        ------\n        MemoryError\n            Memory allocation failed.\n\n        ValueError\n            Invalid coordinate transformation parameters.\n        \"\"\".format(__.TWO_OR_MORE_ARGS('2', 8),\n                   __.RETURNS('pixel coordinates', 8))\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:`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:`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\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\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        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: {0} \"\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 = 'CTYPE{0}{1}'.format(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('{}\\n'.format(coordsys))\n            f.write('polygon(')\n            self.calc_footprint().tofile(f, sep=',')\n            f.write(') # color={0}, width={1:d} \\n'.format(color, width))\n\n    @property\n    def _naxis1(self):\n        return self._naxis[0]\n\n    @_naxis1.setter\n    def _naxis1(self, value):\n        self._naxis[0] = value\n\n    @property\n    def _naxis2(self):\n        return self._naxis[1]\n\n    @_naxis2.setter\n    def _naxis2(self, value):\n        self._naxis[1] = value\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['NAXIS{}'.format(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                       \"Number of WCS axes: {0!r}\".format(self.naxis)]\n        sfmt = ' : ' + \"\".join([\"{\"+\"{0}\".format(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('NAXIS : {}'.format('  '.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 dicts\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        return (__WCS_unpickle__,\n                (self.__class__, self.__dict__, 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        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        A new `~astropy.wcs.WCS` instance with the same number of axes, but two\n        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])\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            raise ValueError(\"Cannot downsample a WCS with indexing.  Use \"\n                             \"wcs.sub or wcs.dropaxis if you want to remove \"\n                             \"axes.\")\n\n        wcs_new = self.deepcopy()\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                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitary 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{0} attribute is not updated because at \"\n                              \"least one indix ('{1}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\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(\"'{0}' object is not iterable\".format(self.__class__.__name__))\n\n    @property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\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])\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.celestial.naxis == 2\n        except InconsistentAxisTypesError:\n            return False\n\n    @property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.matrix(np.diag(self.wcs.get_cdelt()))\n            pc = np.matrix(self.wcs.get_pc())\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                cdelt = np.matrix(self.wcs.cd) * np.matrix(np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.matrix(np.diag(self.wcs.cdelt))\n\n            try:\n                pc = np.matrix(self.wcs.pc)\n            except AttributeError:\n                pc = 1\n\n        pccd = np.array(cdelt * pc)\n\n        return pccd\n\n    def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes.\n\n        With this method, one can do:\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n\n            wcs = WCS('filename.fits')\n\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 ..visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}"},{"col":0,"comment":"null","endLoc":49,"header":"def ORIGIN(indent=0)","id":5410,"name":"ORIGIN","nodeType":"Function","startLoc":42,"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)"},{"col":0,"comment":"null","endLoc":14,"header":"def _fix(content, indent=0)","id":5411,"name":"_fix","nodeType":"Function","startLoc":11,"text":"def _fix(content, indent=0):\n    lines = content.split('\\n')\n    indent = '\\n' + ' ' * indent\n    return indent.join(lines)"},{"col":4,"comment":"null","endLoc":518,"header":"def __copy__(self)","id":5412,"name":"__copy__","nodeType":"Function","startLoc":511,"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"},{"col":4,"comment":"\n        Recursively iterate over all FIELD and PARAM elements in the\n        TABLE.\n        ","endLoc":2916,"header":"def iter_fields_and_params(self)","id":5413,"name":"iter_fields_and_params","nodeType":"Function","startLoc":2905,"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":2944,"header":"def iter_groups(self)","id":5414,"name":"iter_groups","nodeType":"Function","startLoc":2937,"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":2962,"header":"def iter_info(self)","id":5415,"name":"iter_info","nodeType":"Function","startLoc":2960,"text":"def iter_info(self):\n        for info in self.infos:\n            yield info"},{"attributeType":"null","col":4,"comment":"null","endLoc":2918,"id":5416,"name":"get_field_by_id","nodeType":"Attribute","startLoc":2918,"text":"get_field_by_id"},{"attributeType":"null","col":4,"comment":"null","endLoc":2924,"id":5417,"name":"get_field_by_id_or_name","nodeType":"Attribute","startLoc":2924,"text":"get_field_by_id_or_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":2930,"id":5418,"name":"get_fields_by_utype","nodeType":"Attribute","startLoc":2930,"text":"get_fields_by_utype"},{"attributeType":"null","col":4,"comment":"null","endLoc":2946,"id":5419,"name":"get_group_by_id","nodeType":"Attribute","startLoc":2946,"text":"get_group_by_id"},{"fileName":"__init__.py","filePath":"astropy/wcs","id":5420,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\n.. _wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: http://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\n\ntry:\n    # Not guaranteed available at setup time\n    from .wcs import *\n    from . import utils\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\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"},{"col":0,"comment":"null","endLoc":235,"header":"def get_wcslib_cfg(cfg, wcslib_files, include_paths)","id":5421,"name":"get_wcslib_cfg","nodeType":"Function","startLoc":178,"text":"def get_wcslib_cfg(cfg, wcslib_files, include_paths):\n    from astropy.version import debug\n\n    cfg['include_dirs'].append('numpy')\n    cfg['define_macros'].extend([\n        ('ECHO', None),\n        ('WCSTRIG_MACRO', None),\n        ('ASTROPY_WCS_BUILD', None),\n        ('_GNU_SOURCE', None)])\n\n    if (not setup_helpers.use_system_library('wcslib') or\n            sys.platform == 'win32'):\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    else:\n        wcsconfig_h_path = join(WCSROOT, 'include', 'wcsconfig.h')\n        if os.path.exists(wcsconfig_h_path):\n            os.unlink(wcsconfig_h_path)\n        cfg.update(setup_helpers.pkg_config(['wcslib'], ['wcs']))\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    # Squelch a few compilation warnings in WCSLIB\n    if setup_helpers.get_compiler_option() in ('unix', 'mingw32'):\n        if not get_distutils_build_option('debug'):\n            cfg['extra_compile_args'].extend([\n                '-Wno-strict-prototypes',\n                '-Wno-unused-function',\n                '-Wno-unused-value',\n                '-Wno-uninitialized'])"},{"col":0,"comment":"\n    Get the path to astropy.wcs's C header files.\n    ","endLoc":41,"header":"def get_include()","id":5422,"name":"get_include","nodeType":"Function","startLoc":36,"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\")"},{"col":0,"comment":"","endLoc":24,"header":"__init__.py#<anonymous>","id":5423,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\n.. _wcslib: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html\n.. _distortion paper: http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf\n.. _SIP: http://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\ntry:\n    # Not guaranteed available at setup time\n    from .wcs import *\n    from . import utils\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise"},{"fileName":"utils.py","filePath":"astropy/wcs","id":5424,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom .. import units as u\n\nfrom .wcs import WCS, WCSSUB_CELESTIAL\n\n__doctest_skip__ = ['wcs_to_celestial_frame', 'celestial_frame_to_wcs']\n\n__all__ = ['add_stokes_axis_to_wcs', 'celestial_frame_to_wcs',\n           'wcs_to_celestial_frame', 'proj_plane_pixel_scales',\n           'proj_plane_pixel_area', 'is_proj_plane_distorted',\n           'non_celestial_pixel_scales', 'skycoord_to_pixel',\n           'pixel_to_skycoord', 'custom_wcs_to_frame_mappings',\n           'custom_frame_to_wcs_mappings']\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    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 ..coordinates import FK4, FK4NoETerms, FK5, ICRS, Galactic\n\n    # Import astropy.time here otherwise setup.py fails before extensions are compiled\n    from ..time import Time\n\n    # Keep only the celestial part of the axes\n    wcs = wcs.sub([WCSSUB_CELESTIAL])\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[0][:4]\n    ycoord = wcs.wcs.ctype[1][: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        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 ..coordinates import BaseRADecFrame, FK4, FK4NoETerms, FK5, ICRS, 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    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 <http://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 : `~numpy.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 <http://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 <http://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_CELESTIAL])\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 `numpy.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 : Whatever ``cls`` is (a subclass of `~astropy.coordinates.SkyCoord`)\n        The celestial coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    # Import astropy.coordinates here to avoid circular imports\n    from ..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_CELESTIAL])\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":2953,"id":5425,"name":"get_groups_by_utype","nodeType":"Attribute","startLoc":2953,"text":"get_groups_by_utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":2054,"id":5426,"name":"_links","nodeType":"Attribute","startLoc":2054,"text":"self._links"},{"className":"custom_wcs_to_frame_mappings","col":0,"comment":"null","endLoc":151,"id":5427,"nodeType":"Class","startLoc":141,"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":145,"header":"def __init__(self, mappings=[])","id":5428,"name":"__init__","nodeType":"Function","startLoc":142,"text":"def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        WCS_FRAME_MAPPINGS.append(mappings)"},{"col":4,"comment":"null","endLoc":148,"header":"def __enter__(self)","id":5429,"name":"__enter__","nodeType":"Function","startLoc":147,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":151,"header":"def __exit__(self, type, value, tb)","id":5430,"name":"__exit__","nodeType":"Function","startLoc":150,"text":"def __exit__(self, type, value, tb):\n        WCS_FRAME_MAPPINGS.pop()"},{"className":"custom_frame_to_wcs_mappings","col":0,"comment":"null","endLoc":168,"id":5431,"nodeType":"Class","startLoc":158,"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":162,"header":"def __init__(self, mappings=[])","id":5432,"name":"__init__","nodeType":"Function","startLoc":159,"text":"def __init__(self, mappings=[]):\n        if hasattr(mappings, '__call__'):\n            mappings = [mappings]\n        FRAME_WCS_MAPPINGS.append(mappings)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2042,"id":5433,"name":"utype","nodeType":"Attribute","startLoc":2042,"text":"self.utype"},{"col":4,"comment":"null","endLoc":165,"header":"def __enter__(self)","id":5434,"name":"__enter__","nodeType":"Function","startLoc":164,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":1513,"header":"def to_xml(self, w, **kwargs)","id":5435,"name":"to_xml","nodeType":"Function","startLoc":1503,"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":4,"comment":"null","endLoc":168,"header":"def __exit__(self, type, value, tb)","id":5436,"name":"__exit__","nodeType":"Function","startLoc":167,"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    A new `~astropy.wcs.WCS` instance with an additional axis\n    ","endLoc":42,"header":"def add_stokes_axis_to_wcs(wcs, add_before_ind)","id":5437,"name":"add_stokes_axis_to_wcs","nodeType":"Function","startLoc":19,"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    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":0,"comment":"null","endLoc":98,"header":"def _wcs_to_celestial_frame_builtin(wcs)","id":5438,"name":"_wcs_to_celestial_frame_builtin","nodeType":"Function","startLoc":45,"text":"def _wcs_to_celestial_frame_builtin(wcs):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from ..coordinates import FK4, FK4NoETerms, FK5, ICRS, Galactic\n\n    # Import astropy.time here otherwise setup.py fails before extensions are compiled\n    from ..time import Time\n\n    # Keep only the celestial part of the axes\n    wcs = wcs.sub([WCSSUB_CELESTIAL])\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[0][:4]\n    ycoord = wcs.wcs.ctype[1][: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        else:\n            frame = None\n\n    return frame"},{"attributeType":"null","col":8,"comment":"null","endLoc":2049,"id":5439,"name":"format","nodeType":"Attribute","startLoc":2049,"text":"self.format"},{"attributeType":"null","col":8,"comment":"null","endLoc":2048,"id":5440,"name":"description","nodeType":"Attribute","startLoc":2048,"text":"self.description"},{"col":0,"comment":"null","endLoc":297,"header":"def get_extensions()","id":5441,"name":"get_extensions","nodeType":"Function","startLoc":238,"text":"def get_extensions():\n    generate_c_docstrings()\n\n    ######################################################################\n    # DISTUTILS SETUP\n    cfg = setup_helpers.DistutilsExtensionArgs()\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_tabprm_wrap.c']\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    return [Extension(str('astropy.wcs._wcs'), **cfg)]"},{"attributeType":"null","col":8,"comment":"null","endLoc":2051,"id":5442,"name":"_fields","nodeType":"Attribute","startLoc":2051,"text":"self._fields"},{"col":0,"comment":"null","endLoc":342,"header":"def get_package_data()","id":5443,"name":"get_package_data","nodeType":"Function","startLoc":300,"text":"def get_package_data():\n    # Installs the testing data files\n    api_files = [\n        'astropy_wcs.h',\n        'astropy_wcs_api.h',\n        'distortion.h',\n        'isnan.h',\n        'pipeline.h',\n        'pyutil.h',\n        'sip.h',\n        'util.h',\n        'wcsconfig.h',\n        ]\n    api_files = [join('include', 'astropy_wcs', x) for x in api_files]\n    api_files.append(join('include', 'astropy_wcs_api.h'))\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    if not setup_helpers.use_system_library('wcslib'):\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            api_files.append(join('include', 'wcslib', header))\n\n    return {\n        str('astropy.wcs.tests'): ['data/*.hdr', 'data/*.fits',\n                                   'data/*.txt', 'data/*.fits.gz',\n                                   'maps/*.hdr', 'spectra/*.hdr',\n                                   'extension/*.c'],\n        str('astropy.wcs'): api_files,\n    }"},{"attributeType":"null","col":8,"comment":"null","endLoc":2029,"id":5444,"name":"_config","nodeType":"Attribute","startLoc":2029,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":2031,"id":5445,"name":"_empty","nodeType":"Attribute","startLoc":2031,"text":"self._empty"},{"col":0,"comment":"null","endLoc":346,"header":"def get_external_libraries()","id":5446,"name":"get_external_libraries","nodeType":"Function","startLoc":345,"text":"def get_external_libraries():\n    return ['wcslib']"},{"attributeType":"null","col":0,"comment":"null","endLoc":3,"id":5447,"name":"CONTACT","nodeType":"Attribute","startLoc":3,"text":"CONTACT"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":5448,"name":"EMAIL","nodeType":"Attribute","startLoc":4,"text":"EMAIL"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":5449,"name":"WCSROOT","nodeType":"Attribute","startLoc":19,"text":"WCSROOT"},{"attributeType":"null","col":8,"comment":"null","endLoc":2055,"id":5450,"name":"_infos","nodeType":"Attribute","startLoc":2055,"text":"self._infos"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":5451,"name":"WCSVERSION","nodeType":"Attribute","startLoc":20,"text":"WCSVERSION"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":5452,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"CONTACT = \"Michael Droettboom\"\n\nEMAIL = \"mdroe@stsci.edu\"\n\nWCSROOT = os.path.relpath(os.path.dirname(__file__))\n\nWCSVERSION = \"5.17\""},{"attributeType":"function","col":12,"comment":"null","endLoc":2305,"id":5453,"name":"ref","nodeType":"Attribute","startLoc":2305,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":2057,"id":5454,"name":"array","nodeType":"Attribute","startLoc":2057,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":2041,"id":5455,"name":"ucd","nodeType":"Attribute","startLoc":2041,"text":"self.ucd"},{"col":4,"comment":"\n        Sets the attributes of a given `astropy.table.Column` instance\n        to match the information in this `Field`.\n        ","endLoc":1534,"header":"def to_table_column(self, column)","id":5456,"name":"to_table_column","nodeType":"Function","startLoc":1515,"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):\n            column.format = self.converter.output_format"},{"attributeType":"null","col":8,"comment":"null","endLoc":2047,"id":5457,"name":"_nrows","nodeType":"Attribute","startLoc":2047,"text":"self._nrows"},{"fileName":"wcslint.py","filePath":"astropy/wcs","id":5458,"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":0,"comment":"null","endLoc":18,"header":"def main(args=None)","id":5459,"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]))"},{"attributeType":"null","col":8,"comment":"null","endLoc":2038,"id":5460,"name":"name","nodeType":"Attribute","startLoc":2038,"text":"self.name"},{"col":4,"comment":"null","endLoc":533,"header":"def __deepcopy__(self, memo)","id":5461,"name":"__deepcopy__","nodeType":"Function","startLoc":520,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":2040,"id":5462,"name":"_ref","nodeType":"Attribute","startLoc":2040,"text":"self._ref"},{"attributeType":"null","col":4,"comment":"null","endLoc":1142,"id":5463,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1142,"text":"_attr_list_11"},{"attributeType":"null","col":4,"comment":"null","endLoc":1144,"id":5464,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1144,"text":"_attr_list_12"},{"attributeType":"null","col":4,"comment":"null","endLoc":1145,"id":5465,"name":"_element_name","nodeType":"Attribute","startLoc":1145,"text":"_element_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1220,"id":5466,"name":"arraysize","nodeType":"Attribute","startLoc":1220,"text":"self.arraysize"},{"attributeType":"null","col":8,"comment":"null","endLoc":2030,"id":5467,"name":"_pos","nodeType":"Attribute","startLoc":2030,"text":"self._pos"},{"attributeType":"null","col":8,"comment":"null","endLoc":2139,"id":5468,"name":"_format","nodeType":"Attribute","startLoc":2139,"text":"self._format"},{"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":546,"header":"def copy(self)","id":5469,"name":"copy","nodeType":"Function","startLoc":535,"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":555,"header":"def deepcopy(self)","id":5470,"name":"deepcopy","nodeType":"Function","startLoc":548,"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":0,"comment":"\n    Prints a WCS validation report for the given FITS file.\n\n    Parameters\n    ----------\n    source : str path, readable file-like object or `astropy.io.fits.HDUList` object\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : WcsValidateResults 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    ","endLoc":3288,"header":"def validate(source)","id":5471,"name":"validate","nodeType":"Function","startLoc":3179,"text":"def validate(source):\n    \"\"\"\n    Prints a WCS validation report for the given FITS file.\n\n    Parameters\n    ----------\n    source : str path, readable file-like object or `astropy.io.fits.HDUList` object\n        The FITS file to validate.\n\n    Returns\n    -------\n    results : WcsValidateResults 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    class _WcsValidateWcsResult(list):\n        def __init__(self, key):\n            self._key = key\n\n        def __repr__(self):\n            result = [\"  WCS key '{0}':\".format(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 = ' ({0})'.format(self._hdu_name)\n                else:\n                    hdu_name = ''\n                result = ['HDU {0}{1}:'.format(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"},{"col":4,"comment":"null","endLoc":561,"header":"def sub(self, axes=None)","id":5472,"name":"sub","nodeType":"Function","startLoc":557,"text":"def sub(self, axes=None):\n        copy = self.deepcopy()\n        copy.wcs = self.wcs.sub(axes)\n        copy.naxis = copy.wcs.naxis\n        return copy"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":1227,"id":5473,"name":"_links","nodeType":"Attribute","startLoc":1227,"text":"self._links"},{"attributeType":"None","col":8,"comment":"null","endLoc":1321,"id":5474,"name":"_precision","nodeType":"Attribute","startLoc":1321,"text":"self._precision"},{"attributeType":"null","col":8,"comment":"null","endLoc":2036,"id":5475,"name":"ID","nodeType":"Attribute","startLoc":2036,"text":"self.ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":2053,"id":5476,"name":"_groups","nodeType":"Attribute","startLoc":2053,"text":"self._groups"},{"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 : length 2 sequence ints, 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":723,"header":"def calc_footprint(self, header=None, undistort=True, axes=None, center=True)","id":5477,"name":"calc_footprint","nodeType":"Function","startLoc":656,"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 : length 2 sequence ints, 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 = self._naxis1\n                    naxis2 = self._naxis2\n                except AttributeError:\n                    warnings.warn(\"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":2034,"id":5478,"name":"_votable","nodeType":"Attribute","startLoc":2034,"text":"self._votable"},{"attributeType":"null","col":8,"comment":"null","endLoc":2052,"id":5479,"name":"_params","nodeType":"Attribute","startLoc":2052,"text":"self._params"},{"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 object\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":44,"header":"def is_votable(origin, filepath, fileobj, *args, **kwargs)","id":5480,"name":"is_votable","nodeType":"Function","startLoc":15,"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 object\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":8,"comment":"null","endLoc":1224,"id":5481,"name":"precision","nodeType":"Attribute","startLoc":1224,"text":"self.precision"},{"col":0,"comment":"null","endLoc":183,"header":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression(tmpdir)","id":5482,"name":"test_regression","nodeType":"Function","startLoc":181,"text":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression(tmpdir):\n    _test_regression(tmpdir, False)"},{"attributeType":"Values","col":8,"comment":"null","endLoc":1229,"id":5483,"name":"values","nodeType":"Attribute","startLoc":1229,"text":"self.values"},{"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    ","endLoc":113,"header":"def read_table_votable(input, table_id=None, use_names_over_ids=False)","id":5484,"name":"read_table_votable","nodeType":"Function","startLoc":47,"text":"def read_table_votable(input, table_id=None, use_names_over_ids=False):\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    if not isinstance(input, (VOTableFile, VOTable)):\n        input = parse(input, table_id=table_id)\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 {0}, \"\n                    'or integers less than {1}.'.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                        \"No tables with id={0} found\".format(table_id))\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 {0} is out of range. \"\n                        \"{1} 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)"},{"attributeType":"Converter","col":8,"comment":"null","endLoc":1276,"id":5485,"name":"converter","nodeType":"Attribute","startLoc":1276,"text":"self.converter"},{"attributeType":"null","col":8,"comment":"null","endLoc":1225,"id":5486,"name":"utype","nodeType":"Attribute","startLoc":1225,"text":"self.utype"},{"col":0,"comment":"null","endLoc":188,"header":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_python_based_parser(tmpdir)","id":5487,"name":"test_regression_python_based_parser","nodeType":"Function","startLoc":186,"text":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_python_based_parser(tmpdir):\n    _test_regression(tmpdir, True)"},{"col":0,"comment":"null","endLoc":193,"header":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_binary2(tmpdir)","id":5489,"name":"test_regression_binary2","nodeType":"Function","startLoc":191,"text":"@pytest.mark.xfail(str('legacy_float_repr'))\ndef test_regression_binary2(tmpdir):\n    _test_regression(tmpdir, False, 2)"},{"attributeType":"None","col":8,"comment":"null","endLoc":1181,"id":5490,"name":"description","nodeType":"Attribute","startLoc":1181,"text":"self.description"},{"col":0,"comment":"null","endLoc":261,"header":"def test_select_columns_by_index()","id":5491,"name":"test_select_columns_by_index","nodeType":"Function","startLoc":250,"text":"def test_select_columns_by_index():\n    columns = [0, 5, 13]\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False, columns=columns).get_first_table()\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == b\"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":"\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:`relaxread` for details.\n\n    keysel : sequence of flags, 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` objects\n    ","endLoc":3176,"header":"def find_all_wcs(header, relax=True, keysel=None, fix=True,\n                 translate_units='',\n                 _do_set=True)","id":5492,"name":"find_all_wcs","nodeType":"Function","startLoc":3088,"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:`relaxread` for details.\n\n    keysel : sequence of flags, 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` objects\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1226,"id":5493,"name":"type","nodeType":"Attribute","startLoc":1226,"text":"self.type"},{"col":0,"comment":"null","endLoc":274,"header":"def test_select_columns_by_name()","id":5494,"name":"test_select_columns_by_name","nodeType":"Function","startLoc":264,"text":"def test_select_columns_by_name():\n    columns = ['string_test', 'unsignedByte', 'bitarray']\n    table = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False, columns=columns).get_first_table()\n    array = table.array\n    mask = table.array.mask\n    assert array['string_test'][0] == b\"String & test\"\n    for c in columns:\n        assert not np.all(mask[c])\n    assert np.all(mask['unicode_test'])"},{"col":0,"comment":"null","endLoc":724,"header":"def table_from_scratch()","id":5495,"name":"table_from_scratch","nodeType":"Function","startLoc":694,"text":"def table_from_scratch():\n    from ..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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1228,"id":5496,"name":"title","nodeType":"Attribute","startLoc":1228,"text":"self.title"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1154,"id":5497,"name":"_config","nodeType":"Attribute","startLoc":1154,"text":"self._config"},{"attributeType":"null","col":8,"comment":"null","endLoc":1218,"id":5498,"name":"ref","nodeType":"Attribute","startLoc":1218,"text":"self.ref"},{"attributeType":"None","col":12,"comment":"null","endLoc":1379,"id":5499,"name":"_unit","nodeType":"Attribute","startLoc":1379,"text":"self._unit"},{"attributeType":"Values","col":8,"comment":"null","endLoc":1452,"id":5500,"name":"_values","nodeType":"Attribute","startLoc":1452,"text":"self._values"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":1219,"id":5501,"name":"datatype","nodeType":"Attribute","startLoc":1219,"text":"self.datatype"},{"col":0,"comment":"null","endLoc":134,"header":"def _celestial_frame_to_wcs_builtin(frame, projection='TAN')","id":5502,"name":"_celestial_frame_to_wcs_builtin","nodeType":"Function","startLoc":101,"text":"def _celestial_frame_to_wcs_builtin(frame, projection='TAN'):\n\n    # Import astropy.coordinates here to avoid circular imports\n    from ..coordinates import BaseRADecFrame, FK4, FK4NoETerms, FK5, ICRS, 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    else:\n        return None\n\n    wcs.wcs.ctype = [xcoord + '-' + projection, ycoord + '-' + projection]\n\n    return wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1303,"id":5503,"name":"_datatype","nodeType":"Attribute","startLoc":1303,"text":"self._datatype"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":1221,"id":5504,"name":"ucd","nodeType":"Attribute","startLoc":1221,"text":"self.ucd"},{"attributeType":"null","col":8,"comment":"null","endLoc":1184,"id":5505,"name":"ID","nodeType":"Attribute","startLoc":1184,"text":"self.ID"},{"attributeType":"None","col":8,"comment":"null","endLoc":1345,"id":5506,"name":"_width","nodeType":"Attribute","startLoc":1345,"text":"self._width"},{"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:`votable-serialization`.\n    ","endLoc":160,"header":"def write_table_votable(input, output, table_id=None, overwrite=False,\n                        tabledata_format=None)","id":5507,"name":"write_table_votable","nodeType":"Function","startLoc":116,"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:`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) {0} 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(\"File exists: {0}\".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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1182,"id":5508,"name":"_votable","nodeType":"Attribute","startLoc":1182,"text":"self._votable"},{"attributeType":"None","col":8,"comment":"null","endLoc":1230,"id":5509,"name":"xtype","nodeType":"Attribute","startLoc":1230,"text":"self.xtype"},{"attributeType":"null","col":8,"comment":"null","endLoc":1435,"id":5510,"name":"_type","nodeType":"Attribute","startLoc":1435,"text":"self._type"},{"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":206,"header":"def wcs_to_celestial_frame(wcs)","id":5512,"name":"wcs_to_celestial_frame","nodeType":"Function","startLoc":171,"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\")"},{"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":277,"header":"def celestial_frame_to_wcs(frame, projection='TAN')","id":5513,"name":"celestial_frame_to_wcs","nodeType":"Function","startLoc":209,"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":12,"comment":"null","endLoc":1162,"id":5514,"name":"_attr_list","nodeType":"Attribute","startLoc":1162,"text":"self._attr_list"},{"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 <http://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 : `~numpy.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":321,"header":"def proj_plane_pixel_scales(wcs)","id":5515,"name":"proj_plane_pixel_scales","nodeType":"Function","startLoc":280,"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 <http://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 : `~numpy.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))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1222,"id":5516,"name":"unit","nodeType":"Attribute","startLoc":1222,"text":"self.unit"},{"col":0,"comment":"","endLoc":4,"header":"wcslint.py#<anonymous>","id":5517,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nScript support for validating the WCS keywords in a FITS file.\n\"\"\""},{"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 <http://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":382,"header":"def proj_plane_pixel_area(wcs)","id":5518,"name":"proj_plane_pixel_area","nodeType":"Function","startLoc":324,"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 <http://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":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 <http://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":432,"header":"def is_proj_plane_distorted(wcs, maxerr=1.0e-5)","id":5519,"name":"is_proj_plane_distorted","nodeType":"Function","startLoc":385,"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 <http://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))"},{"fileName":"_docutil.py","filePath":"astropy/wcs","id":5520,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nastropy.wcs-specific utilities for generating boilerplate in docstrings.\n\"\"\"\n\n\n\n__all__ = ['TWO_OR_THREE_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(\n\"\"\"args : flexible\n    There are two accepted forms for the positional arguments:\n\n        - 2 arguments: An *N* x *{0}* 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\"\"\".format(naxis), indent)\n\n\ndef RETURNS(out_type, indent=0):\n    return _fix(\"\"\"result : array\n    Returns the {0}.  If the input was a single array and\n    origin, a single array is returned, otherwise a tuple of arrays is\n    returned.\"\"\".format(out_type), 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"},{"col":0,"comment":"null","endLoc":32,"header":"def TWO_OR_MORE_ARGS(naxis, indent=0)","id":5521,"name":"TWO_OR_MORE_ARGS","nodeType":"Function","startLoc":17,"text":"def TWO_OR_MORE_ARGS(naxis, indent=0):\n    return _fix(\n\"\"\"args : flexible\n    There are two accepted forms for the positional arguments:\n\n        - 2 arguments: An *N* x *{0}* 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\"\"\".format(naxis), indent)"},{"col":0,"comment":"null","endLoc":449,"header":"def _is_cd_orthogonal(cd, maxerr)","id":5522,"name":"_is_cd_orthogonal","nodeType":"Function","startLoc":435,"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":0,"comment":"null","endLoc":39,"header":"def RETURNS(out_type, indent=0)","id":5523,"name":"RETURNS","nodeType":"Function","startLoc":35,"text":"def RETURNS(out_type, indent=0):\n    return _fix(\"\"\"result : array\n    Returns the {0}.  If the input was a single array and\n    origin, a single array is returned, otherwise a tuple of arrays is\n    returned.\"\"\".format(out_type), indent)"},{"col":0,"comment":"null","endLoc":60,"header":"def RA_DEC_ORDER(indent=0)","id":5524,"name":"RA_DEC_ORDER","nodeType":"Function","startLoc":52,"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":0,"comment":"null","endLoc":8,"id":5525,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"_docutil.py#<anonymous>","id":5526,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nastropy.wcs-specific utilities for generating boilerplate in docstrings.\n\"\"\"\n\n__all__ = ['TWO_OR_THREE_ARGS', 'RETURNS', 'ORIGIN', 'RA_DEC_ORDER']"},{"attributeType":"null","col":40,"comment":"null","endLoc":8,"id":5527,"name":"VOTable","nodeType":"Attribute","startLoc":8,"text":"VOTable"},{"attributeType":"null","col":27,"comment":"null","endLoc":9,"id":5528,"name":"io_registry","nodeType":"Attribute","startLoc":9,"text":"io_registry"},{"col":0,"comment":"","endLoc":4,"header":"connect.py#<anonymous>","id":5529,"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)"},{"id":5530,"name":"astropy/wcs/src","nodeType":"Package"},{"id":5531,"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  int vret;\n\n  vret = visit(self->owner, arg);\n  if (vret != 0) {\n    return vret;\n  }\n\n  return 0;\n}\n\nstatic int\nPyTabprm_clear(\n    PyTabprm* self) {\n  PyObject* tmp;\n\n  tmp = self->owner;\n  self->owner = NULL;\n  Py_XDECREF(tmp);\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  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_INCREF(Py_None);\n  return Py_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\n  tabprt(self->x);\n\n  printf(\"%s\", wcsprintf_buf());\n\n  Py_INCREF(Py_None);\n  return Py_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  (reprfunc)PyTabprm___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)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":5532,"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, 3);\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}\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;\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  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) {\n  if (status > 0 && status != WCSHDRERR_PARSER) {\n    PyErr_SetString(PyExc_MemoryError, \"Memory allocation error\");\n  } else {\n    PyErr_SetString(PyExc_ValueError, \"Internal error in wcslib header parser\");\n  }\n}\n\n\n/***************************************************************************\n  Property helpers\n ***************************************************************************/\n\n#define SHAPE_STR_LEN 128\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' must be less than %u characters\",\n        propname,\n        (unsigned int)maxlen);\n    goto end;\n  }\n\n  strncpy(dest, buffer, (size_t)maxlen);\n\n  result = 0;\n\n end:\n  Py_XDECREF(ascii_obj);\n\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":5533,"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  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  int vret;\n\n  if (self->pyobject) {\n    vret = visit(self->pyobject, arg);\n    if (vret != 0) {\n      return vret;\n    }\n  }\n\n  return 0;\n}\n\nstatic int\nPyStrListProxy_clear(\n    PyStrListProxy *self) {\n\n  PyObject *tmp;\n\n  tmp = self->pyobject;\n  self->pyobject = NULL;\n  Py_XDECREF(tmp);\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) {\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) {\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":5534,"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":5535,"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\nstatic PyTypeObject PyUnitListProxyType;\n\ntypedef struct {\n  PyObject_HEAD\n  /*@null@*/ /*@shared@*/ PyObject* pyobject;\n  Py_ssize_t size;\n  char (*array)[72];\n  PyObject* unit_class;\n} PyUnitListProxy;\n\nstatic void\nPyUnitListProxy_dealloc(\n    PyUnitListProxy* self) {\n\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  int vret;\n\n  if (self->pyobject) {\n    vret = visit(self->pyobject, arg);\n    if (vret != 0) {\n      return vret;\n    }\n  }\n\n  if (self->unit_class) {\n    vret = visit(self->unit_class, arg);\n    if (vret != 0) {\n      return vret;\n    }\n  }\n\n  return 0;\n}\n\nstatic int\nPyUnitListProxy_clear(\n    PyUnitListProxy *self) {\n\n  PyObject *tmp;\n\n  tmp = self->pyobject;\n  self->pyobject = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->unit_class;\n  self->unit_class = NULL;\n  Py_XDECREF(tmp);\n\n  return 0;\n}\n\n/*@null@*/ PyObject *\nPyUnitListProxy_New(\n    /*@shared@*/ PyObject* owner,\n    Py_ssize_t size,\n    char (*array)[72]) {\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  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) {\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 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) {\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  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  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)[72]) {\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"},{"col":0,"comment":"\n    `True` if contains any SIP or image distortion components.\n    ","endLoc":484,"header":"def _has_distortion(wcs)","id":5536,"name":"_has_distortion","nodeType":"Function","startLoc":479,"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'])"},{"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":476,"header":"def non_celestial_pixel_scales(inwcs)","id":5537,"name":"non_celestial_pixel_scales","nodeType":"Function","startLoc":452,"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\")"},{"attributeType":"null","col":12,"comment":"null","endLoc":1193,"id":5538,"name":"name","nodeType":"Attribute","startLoc":1193,"text":"self.name"},{"id":5539,"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":5540,"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":5541,"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    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  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"},{"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":555,"header":"def skycoord_to_pixel(coords, wcs, origin=0, mode='all')","id":5542,"name":"skycoord_to_pixel","nodeType":"Function","startLoc":490,"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_CELESTIAL])\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"},{"id":5543,"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":5544,"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_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/***************************************************************************\n * Wcs type\n ***************************************************************************/\n\nstatic PyTypeObject WcsType;\n\nstatic int _setup_wcs_type(PyObject* m);\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  PyObject* tmp;\n\n  tmp = self->py_det2im[0];\n  self->py_det2im[0] = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->py_det2im[1];\n  self->py_det2im[1] = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->py_sip;\n  self->py_sip = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->py_distortion_lookup[0];\n  self->py_distortion_lookup[0] = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->py_distortion_lookup[1];\n  self->py_distortion_lookup[1] = NULL;\n  Py_XDECREF(tmp);\n\n  tmp = self->py_wcsprm;\n  self->py_wcsprm = NULL;\n  Py_XDECREF(tmp);\n\n  return 0;\n}\n\nstatic void\nWcs_dealloc(\n    Wcs* self) {\n\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_XDECREF(self->py_det2im[i]);\n      self->py_det2im[i] = 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_XDECREF(self->py_sip);\n    self->py_sip = 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_XDECREF(self->py_distortion_lookup[i]);\n      self->py_distortion_lookup[i] = 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_XDECREF(self->py_wcsprm);\n    self->py_wcsprm = py_wcsprm;\n    self->x.wcs = &(((PyWcsprm*)py_wcsprm)->x);\n  }\n\n  Py_XINCREF(self->py_sip);\n  Py_XINCREF(self->py_distortion_lookup[0]);\n  Py_XINCREF(self->py_distortion_lookup[1]);\n  Py_XINCREF(self->py_wcsprm);\n  Py_XINCREF(self->py_det2im[0]);\n  Py_XINCREF(self->py_det2im[1]);\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_XDECREF(self->py_wcsprm);\n  self->py_wcsprm = NULL;\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_XDECREF(self->py_distortion_lookup[0]);\n  self->py_distortion_lookup[0] = NULL;\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_XDECREF(self->py_distortion_lookup[1]);\n  self->py_distortion_lookup[1] = NULL;\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_XDECREF(self->py_det2im[0]);\n  self->py_det2im[0] = NULL;\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_XDECREF(self->py_det2im[1]);\n  self->py_det2im[1] = NULL;\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_XDECREF(self->py_sip);\n  self->py_sip = NULL;\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  {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_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":5545,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1223,"id":5546,"name":"width","nodeType":"Attribute","startLoc":1223,"text":"self.width"},{"id":5547,"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  PyObject* tmp;\n\n  tmp = (PyObject*)self->py_data;\n  self->py_data = NULL;\n  Py_XDECREF(tmp);\n\n  return 0;\n}\n\nstatic void\nPyDistLookup_dealloc(\n    PyDistLookup* self) {\n\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_XDECREF(self->py_data);\n    self->py_data = NULL;\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":5548,"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_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 <tab.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 * 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  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             = 0;\n  const char*    keywords[]    = {\"header\", \"key\", \"relax\", \"naxis\", \"keysel\",\n                                  \"colsel\", \"warnings\", NULL};\n\n  if (!PyArg_ParseTupleAndKeywords(\n          args, kwds, \"|OsOiiOi:WCSBase.__init__\",\n          (char **)keywords, &header_obj, &key, &relax_obj, &naxis, &keysel,\n          &colsel, &warnings)) {\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    note_change(self);\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, 1, 1, NPY_INT);\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);\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);\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    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;\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    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);\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);\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, 1, 1, NPY_INT);\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    {\"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, 1, 1, NPY_INT);\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          Py_DECREF(element_utf8); element_utf8 = NULL;\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      } 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_DECREF(element);\n      element = NULL;\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\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_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_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\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_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_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\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 = 3;\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 = 3;\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    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/* static PyObject* */\n/* PyWcsprm_get_wtb( */\n/*     PyWcsprm* self, */\n/*     /\\*@unused@*\\/ void* closure) { */\n\n/*   PyObject* result; */\n/*   PyObject* subresult; */\n/*   int i, nwtb; */\n\n/*   nwtb = self->x.nwtb; */\n\n/*   result = PyList_New(nwtb); */\n/*   if (result == NULL) { */\n/*     return NULL; */\n/*   } */\n\n/*   for (i = 0; i < nwtb; ++i) { */\n/*     subresult = (PyObject *)PyWtbarr_cnew((PyObject *)self, &(self->x.wtb[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_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/***************************************************************************\n * PyWcsprm definition structures\n */\n\nstatic PyGetSetDef PyWcsprm_getset[] = {\n  {\"alt\", (getter)PyWcsprm_get_alt, (setter)PyWcsprm_set_alt, (char *)doc_alt},\n  {\"axis_types\", (getter)PyWcsprm_get_axis_types, NULL, (char *)doc_axis_types},\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  {\"dateavg\", (getter)PyWcsprm_get_dateavg, (setter)PyWcsprm_set_dateavg, (char *)doc_dateavg},\n  {\"dateobs\", (getter)PyWcsprm_get_dateobs, (setter)PyWcsprm_set_dateobs, (char *)doc_dateobs},\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  {\"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  {\"mjdobs\", (getter)PyWcsprm_get_mjdobs, (setter)PyWcsprm_set_mjdobs, (char *)doc_mjdobs},\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  {\"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  {\"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  {\"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  /* {\"wtb\", (getter)PyWcsprm_get_wtb, NULL, (char *)doc_tab}, */\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\n#define XSTRINGIFY(s) STRINGIFY(s)\n#define STRINGIFY(s) #s\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}\n"},{"id":5549,"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  n = NAN;\n\n  for ( ; s != s_end; ++s) {\n    if (*s) {\n      for (i = 0; i < nelem; ++i) {\n        *d++ = n;\n      }\n    } else {\n      d += nelem;\n    }\n  }\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1365,"id":5550,"name":"_ref","nodeType":"Attribute","startLoc":1365,"text":"self._ref"},{"id":5551,"name":"astropy/wcs/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/wcs/tests","id":5552,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1155,"id":5553,"name":"_pos","nodeType":"Attribute","startLoc":1155,"text":"self._pos"},{"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 `numpy.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 : Whatever ``cls`` is (a subclass of `~astropy.coordinates.SkyCoord`)\n        The celestial coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    ","endLoc":630,"header":"def pixel_to_skycoord(xp, yp, wcs, origin=0, mode='all', cls=None)","id":5554,"name":"pixel_to_skycoord","nodeType":"Function","startLoc":558,"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 `numpy.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 : Whatever ``cls`` is (a subclass of `~astropy.coordinates.SkyCoord`)\n        The celestial coordinates\n\n    See Also\n    --------\n    astropy.coordinates.SkyCoord.from_pixel\n    \"\"\"\n\n    # Import astropy.coordinates here to avoid circular imports\n    from ..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_CELESTIAL])\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"},{"id":5555,"name":"astropy/wcs/tests/data","nodeType":"Package"},{"id":5556,"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"},{"attributeType":"None","col":8,"comment":"null","endLoc":1419,"id":5557,"name":"_arraysize","nodeType":"Attribute","startLoc":1419,"text":"self._arraysize"},{"id":5558,"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":5559,"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":5560,"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":5561,"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"},{"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":1619,"id":5562,"nodeType":"Class","startLoc":1569,"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":1596,"header":"@property\n    def value(self)","id":5563,"name":"value","nodeType":"Function","startLoc":1590,"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":1606,"header":"@value.setter\n    def value(self, value)","id":5564,"name":"value","nodeType":"Function","startLoc":1598,"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"},{"id":5565,"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":5566,"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":5567,"name":"3d_cd.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/data","text":"CD1_2   =            -3.72E-05                                                  \nCD1_3   =                    0                                                  \nCD1_1   =            -4.12E-05                                                  \nCUNIT3  = 'nm      '                                                            \nCUNIT2  = 'deg     '                                                            \nCTYPE1  = 'RA---TAN'                                                            \nNAXIS   =                    3                                                  \nCTYPE3  = 'AWAV    '                                                            \nCD2_1   =            -3.72E-05                                                  \nCTYPE2  = 'DEC--TAN'                                                            \nCD2_3   =                    0                                                  \nCD2_2   =             4.12E-05                                                  \nCUNIT1  = 'deg     '                                                            \nCD3_1   =                    0                                                  \nCD3_2   =                    0                                                  \nCD3_3   =                  0.2                                                  "},{"id":5568,"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":5569,"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":5570,"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":5571,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"col":4,"comment":"null","endLoc":1610,"header":"def _setup(self, config, pos)","id":5572,"name":"_setup","nodeType":"Function","startLoc":1608,"text":"def _setup(self, config, pos):\n        Field._setup(self, config, pos)\n        self.value = self._value"},{"id":5573,"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":5574,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"col":4,"comment":"null","endLoc":1619,"header":"def to_xml(self, w, **kwargs)","id":5575,"name":"to_xml","nodeType":"Function","startLoc":1612,"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"},{"id":5576,"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":5577,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"col":4,"comment":"null","endLoc":1280,"header":"def all_pix2world(self, *args, **kwargs)","id":5578,"name":"all_pix2world","nodeType":"Function","startLoc":1278,"text":"def all_pix2world(self, *args, **kwargs):\n        return self._array_converter(\n            self._all_pix2world, 'output', *args, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1576,"id":5579,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1576,"text":"_attr_list_11"},{"id":5580,"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":5581,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"attributeType":"null","col":4,"comment":"null","endLoc":1577,"id":5582,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1577,"text":"_attr_list_12"},{"id":5583,"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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             "},{"attributeType":"null","col":4,"comment":"null","endLoc":1578,"id":5584,"name":"_element_name","nodeType":"Attribute","startLoc":1578,"text":"_element_name"},{"id":5585,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1584,"id":5586,"name":"_value","nodeType":"Attribute","startLoc":1584,"text":"self._value"},{"id":5587,"name":"astropy/wcs/tests/maps","nodeType":"Package"},{"id":5588,"name":"1904-66_CEA.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5589,"name":"1904-66_CYP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5590,"name":"1904-66_AZP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5591,"name":"1904-66_SZP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5592,"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"},{"col":4,"comment":"null","endLoc":1250,"header":"def __init__(self, lon, lat, differentials=None, copy=True)","id":5593,"name":"__init__","nodeType":"Function","startLoc":1249,"text":"def __init__(self, lon, lat, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)"},{"id":5594,"name":"1904-66_HPX.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5595,"name":"1904-66_AIR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"attributeType":"null","col":8,"comment":"null","endLoc":1610,"id":5596,"name":"value","nodeType":"Attribute","startLoc":1610,"text":"self.value"},{"id":5597,"name":"1904-66_ZEA.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"id":5598,"name":"1904-66_SIN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5599,"name":"1904-66_COP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"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":1723,"id":5600,"nodeType":"Class","startLoc":1622,"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        if config.get('version_1_2_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"},{"id":5601,"name":"1904-66_PAR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"col":4,"comment":"\n        Writes a `distortion paper`_ type lookup table to the given\n        `astropy.io.fits.HDUList`.\n        ","endLoc":870,"header":"def _write_det2im(self, hdulist)","id":5602,"name":"_write_det2im","nodeType":"Function","startLoc":826,"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        err_kw = 'D2IMERR'\n\n        def write_d2i(num, det2im):\n            if det2im is None:\n                return\n            str('{0}{1:d}').format(dist, num),\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Detector to image correction type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(det2im.data.shape), 'Number of independent variables in d2im function')\n            for i in range(det2im.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1, 'Axis number of the jth independent variable in a d2im function')\n\n            image = fits.ImageHDU(det2im.data, name=str('D2IMARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (det2im.crpix[0],\n                                     'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (det2im.crpix[1],\n                                     'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (det2im.crval[0],\n                                     'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (det2im.crval[1],\n                                     'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (det2im.cdelt[0],\n                                     'Coordinate increment along axis')\n            header[str('CDELT2')] = (det2im.cdelt[1],\n                                     'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\n            hdulist.append(image)\n        write_d2i(1, self.det2im1)\n        write_d2i(2, self.det2im2)"},{"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":1658,"header":"@property\n    def ID(self)","id":5603,"name":"ID","nodeType":"Function","startLoc":1651,"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":1666,"header":"@ID.setter\n    def ID(self, ID)","id":5604,"name":"ID","nodeType":"Function","startLoc":1660,"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"},{"id":5605,"name":"1904-66_STG.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5606,"name":"1904-66_ARC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5607,"name":"1904-66_BON.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5608,"name":"1904-66_PCO.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5609,"name":"1904-66_TSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5610,"name":"1904-66_MER.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5611,"name":"1904-66_COO.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5612,"name":"1904-66_ZPN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5613,"name":"1904-66_SFL.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5614,"name":"1904-66_QSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5615,"name":"1904-66_NCP.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5616,"name":"1904-66_AIT.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5617,"name":"1904-66_COE.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5618,"name":"1904-66_CSC.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5619,"name":"1904-66_TAN.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"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":1676,"header":"@property\n    def system(self)","id":5620,"name":"system","nodeType":"Function","startLoc":1668,"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":1684,"header":"@system.setter\n    def system(self, system)","id":5621,"name":"system","nodeType":"Function","startLoc":1678,"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":5622,"name":"1904-66_CAR.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"col":4,"comment":"null","endLoc":1688,"header":"@system.deleter\n    def system(self)","id":5623,"name":"system","nodeType":"Function","startLoc":1686,"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":1697,"header":"@property\n    def equinox(self)","id":5624,"name":"equinox","nodeType":"Function","startLoc":1690,"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"},{"id":5625,"name":"1904-66_COD.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"col":4,"comment":"null","endLoc":1702,"header":"@equinox.setter\n    def equinox(self, equinox)","id":5626,"name":"equinox","nodeType":"Function","startLoc":1699,"text":"@equinox.setter\n    def equinox(self, equinox):\n        check_astroyear(equinox, 'equinox', self._config, self._pos)\n        self._equinox = equinox"},{"col":4,"comment":"null","endLoc":1706,"header":"@equinox.deleter\n    def equinox(self)","id":5627,"name":"equinox","nodeType":"Function","startLoc":1704,"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":1714,"header":"@property\n    def epoch(self)","id":5628,"name":"epoch","nodeType":"Function","startLoc":1708,"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":1719,"header":"@epoch.setter\n    def epoch(self, epoch)","id":5629,"name":"epoch","nodeType":"Function","startLoc":1716,"text":"@epoch.setter\n    def epoch(self, epoch):\n        check_astroyear(epoch, 'epoch', self._config, self._pos)\n        self._epoch = epoch"},{"id":5630,"name":"1904-66_MOL.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)                              "},{"col":4,"comment":"null","endLoc":1723,"header":"@epoch.deleter\n    def epoch(self)","id":5631,"name":"epoch","nodeType":"Function","startLoc":1721,"text":"@epoch.deleter\n    def epoch(self):\n        self._epoch = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1629,"id":5632,"name":"_attr_list","nodeType":"Attribute","startLoc":1629,"text":"_attr_list"},{"attributeType":"null","col":4,"comment":"null","endLoc":1630,"id":5633,"name":"_element_name","nodeType":"Attribute","startLoc":1630,"text":"_element_name"},{"id":5634,"name":"astropy/wcs/tests/spectra","nodeType":"Package"},{"id":5635,"name":"orion-freq-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)   "},{"attributeType":"null","col":8,"comment":"null","endLoc":1684,"id":5636,"name":"_system","nodeType":"Attribute","startLoc":1684,"text":"self._system"},{"id":5637,"name":"orion-velo-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)   "},{"col":4,"comment":"\n        Write out `distortion paper`_ keywords to the given\n        `fits.HDUList`.\n        ","endLoc":990,"header":"def _write_distortion_kw(self, hdulist, dist='CPDIS')","id":5639,"name":"_write_distortion_kw","nodeType":"Function","startLoc":946,"text":"def _write_distortion_kw(self, hdulist, dist='CPDIS'):\n        \"\"\"\n        Write out `distortion paper`_ keywords to the given\n        `fits.HDUList`.\n        \"\"\"\n        if self.cpdis1 is None and self.cpdis2 is None:\n            return\n\n        if dist == 'CPDIS':\n            d_kw = str('DP')\n            err_kw = str('CPERR')\n        else:\n            d_kw = str('DQ')\n            err_kw = str('CQERR')\n\n        def write_dist(num, cpdis):\n            if cpdis is None:\n                return\n\n            hdulist[0].header[str('{0}{1:d}').format(dist, num)] = (\n                'LOOKUP', 'Prior distortion function type')\n            hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)] = (\n                num, 'Version number of WCSDVARR extension')\n            hdulist[0].header[str('{0}{1:d}.NAXES').format(d_kw, num)] = (\n                len(cpdis.data.shape), 'Number of independent variables in distortion function')\n\n            for i in range(cpdis.data.ndim):\n                hdulist[0].header[str('{0}{1:d}.AXIS.{2:d}').format(d_kw, num, i + 1)] = (\n                    i + 1,\n                    'Axis number of the jth independent variable in a distortion function')\n\n            image = fits.ImageHDU(cpdis.data, name=str('WCSDVARR'))\n            header = image.header\n\n            header[str('CRPIX1')] = (cpdis.crpix[0], 'Coordinate system reference pixel')\n            header[str('CRPIX2')] = (cpdis.crpix[1], 'Coordinate system reference pixel')\n            header[str('CRVAL1')] = (cpdis.crval[0], 'Coordinate system value at reference pixel')\n            header[str('CRVAL2')] = (cpdis.crval[1], 'Coordinate system value at reference pixel')\n            header[str('CDELT1')] = (cpdis.cdelt[0], 'Coordinate increment along axis')\n            header[str('CDELT2')] = (cpdis.cdelt[1], 'Coordinate increment along axis')\n            image.ver = int(hdulist[0].header[str('{0}{1:d}.EXTVER').format(d_kw, num)])\n            hdulist.append(image)\n\n        write_dist(1, self.cpdis1)\n        write_dist(2, self.cpdis2)"},{"id":5640,"name":"orion-freq-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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":5641,"name":"orion-velo-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)   "},{"attributeType":"null","col":8,"comment":"null","endLoc":1702,"id":5642,"name":"_equinox","nodeType":"Attribute","startLoc":1702,"text":"self._equinox"},{"id":5643,"name":"orion-wave-1.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)   "},{"id":5644,"name":"astropy/wcs/tests/extension","nodeType":"Package"},{"id":5645,"name":".gitignore","nodeType":"TextFile","path":"astropy/wcs/tests/extension","text":"!*.c\n"},{"fileName":"setup.py","filePath":"astropy/wcs/tests/extension","id":5646,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport os\nimport sys\n\nif __name__ == '__main__':\n    astropy_path = sys.argv[-1]\n    sys.argv = sys.argv[:-1]\n    sys.path.insert(0, astropy_path)\n\n    from astropy import wcs\n    import numpy as np\n    from distutils.core import setup, Extension\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        define_macros = [\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    else:\n        define_macros = []\n\n    try:\n        numpy_include = np.get_include()\n    except AttributeError:\n        numpy_include = np.get_numpy_include()\n\n    wcsapi_test_module = Extension(\n        str('wcsapi_test'),\n        include_dirs=[\n            numpy_include,\n            os.path.join(wcs.get_include(), 'astropy_wcs'),\n            os.path.join(wcs.get_include(), 'wcslib')\n        ],\n        # Use the *full* name to the c file, since we can't change the cwd\n        # during testing\n        sources=[str(os.path.join(os.path.dirname(__file__),\n                                  'wcsapi_test.c'))],\n        define_macros=define_macros)\n\n    setup(\n        name='wcsapi_test',\n        ext_modules=[wcsapi_test_module])\n"},{"id":5647,"name":"orion-wave-4.hdr","nodeType":"TextFile","path":"astropy/wcs/tests/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)   "},{"fileName":"__init__.py","filePath":"astropy/wcs/tests/extension","id":5648,"nodeType":"File","text":""},{"id":5649,"name":"wcsapi_test.c","nodeType":"TextFile","path":"astropy/wcs/tests/extension","text":"#include \"Python.h\"\n#include \"astropy_wcs_api.h\"\n\nstatic PyObject*\ntest(\n    PyObject* self,\n    PyObject* args,\n    PyObject* kwds) {\n\n    pipeline_t p;\n\n    pipeline_clear(&p);\n\n    return Py_None;\n}\n\nstatic PyMethodDef module_methods[] = {\n  {\"test\", (PyCFunction)test, METH_NOARGS, \"\"},\n  {NULL}  /* Sentinel */\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    \"wcsapi_test\",\n    NULL,\n    sizeof(struct module_state),\n    module_methods,\n    NULL,\n    NULL,\n    NULL,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit_wcsapi_test(void)\n\n{\n  PyObject* m;\n\n  m = PyModule_Create(&moduledef);\n\n  if (m == NULL) {\n      return NULL;\n  }\n\n  import_astropy_wcs();\n\n  if (PyErr_Occurred())\n      return NULL;\n  else\n      return m;\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1647,"id":5650,"name":"system","nodeType":"Attribute","startLoc":1647,"text":"self.system"},{"attributeType":"null","col":4,"comment":"null","endLoc":8,"id":5652,"name":"astropy_path","nodeType":"Attribute","startLoc":8,"text":"astropy_path"},{"col":4,"comment":"null","endLoc":1814,"header":"def _all_world2pix(self, world, origin, tolerance, maxiter, adaptive,\n                       detect_divergence, quiet)","id":5653,"name":"_all_world2pix","nodeType":"Function","startLoc":1418,"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 self.sip is None and \\\n           self.cpdis1 is None and self.cpdis2 is None and \\\n           self.det2im1 is None and self.det2im2 is None:\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                # Bookeeping 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 {0: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":5654,"name":"astropy/wcs/include","nodeType":"Package"},{"id":5655,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":9,"id":5656,"name":"argv","nodeType":"Attribute","startLoc":9,"text":"sys.argv"},{"attributeType":"null","col":20,"comment":"null","endLoc":13,"id":5657,"name":"np","nodeType":"Attribute","startLoc":13,"text":"np"},{"attributeType":"null","col":8,"comment":"null","endLoc":19,"id":5658,"name":"define_macros","nodeType":"Attribute","startLoc":19,"text":"define_macros"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":5659,"name":"define_macros","nodeType":"Attribute","startLoc":27,"text":"define_macros"},{"attributeType":"null","col":8,"comment":"null","endLoc":30,"id":5660,"name":"numpy_include","nodeType":"Attribute","startLoc":30,"text":"numpy_include"},{"id":5661,"name":".gitignore","nodeType":"TextFile","path":"astropy/wcs/include","text":"docstrings.h\nwcsconfig.h\n"},{"id":5662,"name":"astropy/wcs/include/wcslib","nodeType":"Package"},{"id":5663,"name":".empty","nodeType":"TextFile","path":"astropy/wcs/include/wcslib","text":""},{"id":5664,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":5665,"name":"numpy_include","nodeType":"Attribute","startLoc":32,"text":"numpy_include"},{"id":5666,"name":"astropy/wcs/include/astropy_wcs","nodeType":"Package"},{"id":5667,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":5668,"name":"wcsapi_test_module","nodeType":"Attribute","startLoc":34,"text":"wcsapi_test_module"},{"id":5669,"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"},{"col":0,"comment":"","endLoc":4,"header":"setup.py#<anonymous>","id":5670,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"if __name__ == '__main__':\n    astropy_path = sys.argv[-1]\n    sys.argv = sys.argv[:-1]\n    sys.path.insert(0, astropy_path)\n\n    from astropy import wcs\n    import numpy as np\n    from distutils.core import setup, Extension\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        define_macros = [\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    else:\n        define_macros = []\n\n    try:\n        numpy_include = np.get_include()\n    except AttributeError:\n        numpy_include = np.get_numpy_include()\n\n    wcsapi_test_module = Extension(\n        str('wcsapi_test'),\n        include_dirs=[\n            numpy_include,\n            os.path.join(wcs.get_include(), 'astropy_wcs'),\n            os.path.join(wcs.get_include(), 'wcslib')\n        ],\n        # Use the *full* name to the c file, since we can't change the cwd\n        # during testing\n        sources=[str(os.path.join(os.path.dirname(__file__),\n                                  'wcsapi_test.c'))],\n        define_macros=define_macros)\n\n    setup(\n        name='wcsapi_test',\n        ext_modules=[wcsapi_test_module])"},{"id":5671,"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":5672,"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":5673,"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":5674,"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":5675,"name":"wcslib_wrap.h","nodeType":"TextFile","path":"astropy/wcs/include/astropy_wcs","text":"/*\n Author: Michael Droettboom\n         mdroe@stsci.edu\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\n#endif\n"},{"id":5676,"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":5677,"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"},{"id":5678,"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;\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);\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":8,"comment":"null","endLoc":1637,"id":5679,"name":"_pos","nodeType":"Attribute","startLoc":1637,"text":"self._pos"},{"id":5680,"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":5681,"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"},{"id":5682,"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"},{"id":5683,"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"},{"id":5684,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1646,"id":5685,"name":"epoch","nodeType":"Attribute","startLoc":1646,"text":"self.epoch"},{"id":5686,"name":"astropy/samp","nodeType":"Package"},{"fileName":"constants.py","filePath":"astropy/samp","id":5687,"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 ..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"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":5688,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"attributeType":"null","col":8,"comment":"null","endLoc":1719,"id":5689,"name":"_epoch","nodeType":"Attribute","startLoc":1719,"text":"self._epoch"},{"attributeType":"null","col":24,"comment":"null","endLoc":5,"id":5690,"name":"u","nodeType":"Attribute","startLoc":5,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":5691,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":9,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":5692,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":137,"id":5693,"name":"WCS_FRAME_MAPPINGS","nodeType":"Attribute","startLoc":137,"text":"WCS_FRAME_MAPPINGS"},{"attributeType":"null","col":0,"comment":"null","endLoc":138,"id":5694,"name":"FRAME_WCS_MAPPINGS","nodeType":"Attribute","startLoc":138,"text":"FRAME_WCS_MAPPINGS"},{"attributeType":"custom_wcs_to_frame_mappings","col":0,"comment":"null","endLoc":155,"id":5695,"name":"custom_frame_mappings","nodeType":"Attribute","startLoc":155,"text":"custom_frame_mappings"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":5696,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":5697,"name":"__profile_version__","nodeType":"Attribute","startLoc":12,"text":"__profile_version__"},{"col":0,"comment":"","endLoc":3,"header":"utils.py#<anonymous>","id":5698,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__doctest_skip__ = ['wcs_to_celestial_frame', 'celestial_frame_to_wcs']\n\n__all__ = ['add_stokes_axis_to_wcs', 'celestial_frame_to_wcs',\n           'wcs_to_celestial_frame', 'proj_plane_pixel_scales',\n           'proj_plane_pixel_area', 'is_proj_plane_distorted',\n           'non_celestial_pixel_scales', 'skycoord_to_pixel',\n           'pixel_to_skycoord', 'custom_wcs_to_frame_mappings',\n           'custom_frame_to_wcs_mappings']\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"},{"id":5699,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":5700,"name":"SAMP_STATUS_OK","nodeType":"Attribute","startLoc":15,"text":"SAMP_STATUS_OK"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":5701,"name":"SAMP_STATUS_WARNING","nodeType":"Attribute","startLoc":17,"text":"SAMP_STATUS_WARNING"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":5702,"name":"SAMP_STATUS_ERROR","nodeType":"Attribute","startLoc":19,"text":"SAMP_STATUS_ERROR"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":5703,"name":"SAFE_MTYPES","nodeType":"Attribute","startLoc":21,"text":"SAFE_MTYPES"},{"attributeType":"null","col":67,"comment":"null","endLoc":24,"id":5704,"name":"f","nodeType":"Attribute","startLoc":24,"text":"f"},{"attributeType":"null","col":8,"comment":"null","endLoc":1644,"id":5705,"name":"ID","nodeType":"Attribute","startLoc":1644,"text":"self.ID"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":5706,"name":"SAMP_ICON","nodeType":"Attribute","startLoc":25,"text":"SAMP_ICON"},{"fileName":"standard_profile.py","filePath":"astropy/samp","id":5707,"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":"None","col":8,"comment":"null","endLoc":1666,"id":5708,"name":"_ID","nodeType":"Attribute","startLoc":1666,"text":"self._ID"},{"col":0,"comment":"","endLoc":4,"header":"constants.py#<anonymous>","id":5709,"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()"},{"fileName":"utils.py","filePath":"astropy/samp","id":5710,"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, \"{}.{}\".format(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\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, \"{}.{}\".format(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"},{"fileName":"web_profile.py","filePath":"astropy/samp","id":5711,"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 ..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\", \"{0}\".format(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\", \"{0}\".format(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 ['/translator/{}'.format(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                       ['/translator/{}'.format(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        \"\"\"A Web application which declares to be\n\nName: {}\nOrigin: {}\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]\"\"\".format(samp_name, request[2])\n\n    print(text)\n    answer = input(\">>> \")\n    queue.put(answer.lower() in [\"yes\", \"y\"])\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1645,"id":5712,"name":"equinox","nodeType":"Attribute","startLoc":1645,"text":"self.equinox"},{"className":"SAMPWarning","col":0,"comment":"\n    SAMP-specific Astropy warning class\n    ","endLoc":18,"id":5713,"nodeType":"Class","startLoc":15,"text":"class SAMPWarning(AstropyUserWarning):\n    \"\"\"\n    SAMP-specific Astropy warning class\n    \"\"\""},{"className":"SAMPProxyError","col":0,"comment":"\n    SAMP Proxy Hub exception\n    ","endLoc":36,"id":5714,"nodeType":"Class","startLoc":33,"text":"class SAMPProxyError(xmlrpc.Fault):\n    \"\"\"\n    SAMP Proxy Hub exception\n    \"\"\""},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1636,"id":5715,"name":"_config","nodeType":"Attribute","startLoc":1636,"text":"self._config"},{"className":"FieldRef","col":0,"comment":"\n    FIELDref_ element: used inside of GROUP_ elements to refer to remote FIELD_ elements.\n    ","endLoc":1789,"id":5716,"nodeType":"Class","startLoc":1726,"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            \"No field named '{}'\".format(self.ref),\n            self._config, self._pos, KeyError)"},{"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":1763,"header":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None,\n                 **extra)","id":5717,"name":"__init__","nodeType":"Function","startLoc":1736,"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)"},{"className":"SAMPSimpleXMLRPCRequestHandler","col":0,"comment":"\n    XMLRPC handler of Standard Profile requests.\n    ","endLoc":127,"id":5718,"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)"},{"col":4,"comment":"null","endLoc":28,"header":"def do_GET(self)","id":5719,"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)"},{"className":"_ServerProxyPoolMethod","col":0,"comment":"null","endLoc":67,"id":5720,"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, \"{}.{}\".format(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":5721,"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":5722,"name":"__getattr__","nodeType":"Function","startLoc":55,"text":"def __getattr__(self, name):\n        return _ServerProxyPoolMethod(self.__proxies, \"{}.{}\".format(self.__name, name))"},{"className":"ThreadingXMLRPCServer","col":0,"comment":"\n    Asynchronous multithreaded XMLRPC server.\n    ","endLoc":148,"id":5723,"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":5724,"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":148,"header":"def handle_error(self, request, client_address)","id":5725,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":5726,"name":"log","nodeType":"Attribute","startLoc":138,"text":"self.log"},{"col":4,"comment":"The ID_ of the FIELD_ that this FIELDref_ references.","endLoc":1768,"header":"@property\n    def ref(self)","id":5727,"name":"ref","nodeType":"Function","startLoc":1765,"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":1773,"header":"@ref.setter\n    def ref(self, ref)","id":5728,"name":"ref","nodeType":"Function","startLoc":1770,"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        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":5729,"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)"},{"col":4,"comment":"null","endLoc":1777,"header":"@ref.deleter\n    def ref(self)","id":5730,"name":"ref","nodeType":"Function","startLoc":1775,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1730,"id":5731,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1730,"text":"_attr_list_11"},{"attributeType":"null","col":4,"comment":"null","endLoc":1731,"id":5732,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1731,"text":"_attr_list_12"},{"attributeType":"null","col":24,"comment":"null","endLoc":8,"id":5733,"name":"xmlrpc","nodeType":"Attribute","startLoc":8,"text":"xmlrpc"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":5734,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"standard_profile.py#<anonymous>","id":5735,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = []"},{"col":4,"comment":"null","endLoc":2220,"header":"def pix2foc(self, *args)","id":5736,"name":"pix2foc","nodeType":"Function","startLoc":2219,"text":"def pix2foc(self, *args):\n        return self._array_converter(self._pix2foc, None, *args)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1732,"id":5737,"name":"_element_name","nodeType":"Attribute","startLoc":1732,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1733,"id":5738,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":1733,"text":"_utype_in_v1_2"},{"attributeType":"null","col":4,"comment":"null","endLoc":1734,"id":5739,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":1734,"text":"_ucd_in_v1_2"},{"attributeType":"null","col":8,"comment":"null","endLoc":1752,"id":5740,"name":"ref","nodeType":"Attribute","startLoc":1752,"text":"self.ref"},{"fileName":"integrated_client.py","filePath":"astropy/samp","id":5741,"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 keywords\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 keywords\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 keywords\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 keywords\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 keywords\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":8,"comment":"null","endLoc":1751,"id":5742,"name":"_table","nodeType":"Attribute","startLoc":1751,"text":"self._table"},{"attributeType":"null","col":8,"comment":"null","endLoc":1753,"id":5743,"name":"ucd","nodeType":"Attribute","startLoc":1753,"text":"self.ucd"},{"attributeType":"null","col":8,"comment":"null","endLoc":1754,"id":5744,"name":"utype","nodeType":"Attribute","startLoc":1754,"text":"self.utype"},{"col":4,"comment":"null","endLoc":67,"header":"def __call__(self, *args, **kwrds)","id":5745,"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"},{"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":5746,"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                                           '{0}:{1}'.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={0}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(\"Call to select in SAMPClient failed: {0}\".format(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 catched.\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":"null","col":8,"comment":"null","endLoc":1773,"id":5747,"name":"_ref","nodeType":"Attribute","startLoc":1773,"text":"self._ref"},{"col":0,"comment":"\n    Get attributes recursively.\n    ","endLoc":43,"header":"def getattr_recursive(variable, attribute)","id":5748,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1748,"id":5749,"name":"_pos","nodeType":"Attribute","startLoc":1748,"text":"self._pos"},{"attributeType":"null","col":12,"comment":"null","endLoc":1759,"id":5750,"name":"_attr_list","nodeType":"Attribute","startLoc":1759,"text":"self._attr_list"},{"attributeType":"null","col":8,"comment":"null","endLoc":53,"id":5751,"name":"__name","nodeType":"Attribute","startLoc":53,"text":"self.__name"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":5752,"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":83,"id":5753,"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)"},{"col":4,"comment":"null","endLoc":79,"header":"def __init__(self, size, proxy_class, *args, **keywords)","id":5754,"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))"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1747,"id":5755,"name":"_config","nodeType":"Attribute","startLoc":1747,"text":"self._config"},{"col":4,"comment":"null","endLoc":83,"header":"def __getattr__(self, name)","id":5756,"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":126,"header":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True)","id":5757,"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                                           '{0}:{1}'.format(self._addr or self._host_name,\n                                                            self._port),\n                                           '', '', '', ''))"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":5758,"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":125,"id":5759,"nodeType":"Class","startLoc":86,"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"},{"col":4,"comment":"null","endLoc":99,"header":"def __init__(self, cli)","id":5760,"name":"__init__","nodeType":"Function","startLoc":98,"text":"def __init__(self, cli):\n        self.cli = cli"},{"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":1855,"id":5761,"nodeType":"Class","startLoc":1792,"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            \"No params named '{}'\".format(self.ref),\n            self._config, self._pos, KeyError)"},{"col":4,"comment":"null","endLoc":125,"header":"def __call__(self, f)","id":5762,"name":"__call__","nodeType":"Function","startLoc":101,"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":160,"header":"def get_num_args(f)","id":5763,"name":"get_num_args","nodeType":"Function","startLoc":151,"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":0,"comment":"null","endLoc":27,"header":"def internet_on()","id":5764,"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"},{"className":"WebProfileRequestHandler","col":0,"comment":"\n    Handler of XMLRPC requests performed through the Web Profile.\n    ","endLoc":127,"id":5765,"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\", \"{0}\".format(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\", \"{0}\".format(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 ['/translator/{}'.format(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                       ['/translator/{}'.format(clid) for clid in self.server.clients])\n        return self.path.split('?')[0] in valid_paths"},{"col":4,"comment":"null","endLoc":1829,"header":"def __init__(self, table, ref, ucd=None, utype=None, config=None, pos=None)","id":5766,"name":"__init__","nodeType":"Function","startLoc":1809,"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)"},{"col":4,"comment":"null","endLoc":41,"header":"def _send_CORS_header(self)","id":5767,"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":"The ID_ of the PARAM_ that this PARAMref_ references.","endLoc":1834,"header":"@property\n    def ref(self)","id":5768,"name":"ref","nodeType":"Function","startLoc":1831,"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":1839,"header":"@ref.setter\n    def ref(self, ref)","id":5769,"name":"ref","nodeType":"Function","startLoc":1836,"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":1843,"header":"@ref.deleter\n    def ref(self)","id":5770,"name":"ref","nodeType":"Function","startLoc":1841,"text":"@ref.deleter\n    def ref(self):\n        self._ref = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1803,"id":5771,"name":"_attr_list_11","nodeType":"Attribute","startLoc":1803,"text":"_attr_list_11"},{"attributeType":"null","col":4,"comment":"null","endLoc":1804,"id":5772,"name":"_attr_list_12","nodeType":"Attribute","startLoc":1804,"text":"_attr_list_12"},{"attributeType":"null","col":4,"comment":"null","endLoc":1805,"id":5773,"name":"_element_name","nodeType":"Attribute","startLoc":1805,"text":"_element_name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1806,"id":5774,"name":"_utype_in_v1_2","nodeType":"Attribute","startLoc":1806,"text":"_utype_in_v1_2"},{"attributeType":"null","col":4,"comment":"null","endLoc":1807,"id":5775,"name":"_ucd_in_v1_2","nodeType":"Attribute","startLoc":1807,"text":"_ucd_in_v1_2"},{"attributeType":"null","col":8,"comment":"null","endLoc":1818,"id":5776,"name":"ref","nodeType":"Attribute","startLoc":1818,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":1817,"id":5777,"name":"_table","nodeType":"Attribute","startLoc":1817,"text":"self._table"},{"attributeType":"null","col":8,"comment":"null","endLoc":1819,"id":5778,"name":"ucd","nodeType":"Attribute","startLoc":1819,"text":"self.ucd"},{"attributeType":"null","col":8,"comment":"null","endLoc":1820,"id":5779,"name":"utype","nodeType":"Attribute","startLoc":1820,"text":"self.utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":1839,"id":5780,"name":"_ref","nodeType":"Attribute","startLoc":1839,"text":"self._ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":1814,"id":5781,"name":"_pos","nodeType":"Attribute","startLoc":1814,"text":"self._pos"},{"col":4,"comment":"null","endLoc":491,"header":"def get_private_key(self)","id":5782,"name":"get_private_key","nodeType":"Function","startLoc":490,"text":"def get_private_key(self):\n        return self.client.get_private_key()"},{"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":5783,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":1825,"id":5784,"name":"_attr_list","nodeType":"Attribute","startLoc":1825,"text":"self._attr_list"},{"attributeType":"{get} | None","col":8,"comment":"null","endLoc":1813,"id":5785,"name":"_config","nodeType":"Attribute","startLoc":1813,"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":1998,"id":5786,"nodeType":"Class","startLoc":1858,"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 '<GROUP>... {0} entries ...</GROUP>'.format(len(self._entries))\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"},{"col":4,"comment":"null","endLoc":1896,"header":"def __repr__(self)","id":5787,"name":"__repr__","nodeType":"Function","startLoc":1895,"text":"def __repr__(self):\n        return '<GROUP>... {0} entries ...</GROUP>'.format(len(self._entries))"},{"col":4,"comment":"\n        Currently ignored, as it's not clear from the spec how this is\n        meant to work.\n        ","endLoc":1904,"header":"@property\n    def ref(self)","id":5788,"name":"ref","nodeType":"Function","startLoc":1898,"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":1909,"header":"@ref.setter\n    def ref(self, ref)","id":5789,"name":"ref","nodeType":"Function","startLoc":1906,"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":45,"header":"def end_headers(self)","id":5790,"name":"end_headers","nodeType":"Function","startLoc":43,"text":"def end_headers(self):\n        self._send_CORS_header()\n        SAMPSimpleXMLRPCRequestHandler.end_headers(self)"},{"col":4,"comment":"null","endLoc":1913,"header":"@ref.deleter\n    def ref(self)","id":5791,"name":"ref","nodeType":"Function","startLoc":1911,"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":1922,"header":"@property\n    def entries(self)","id":5792,"name":"entries","nodeType":"Function","startLoc":1915,"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":1926,"header":"def _add_fieldref(self, iterator, tag, data, config, pos)","id":5793,"name":"_add_fieldref","nodeType":"Function","startLoc":1924,"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)"},{"col":4,"comment":"null","endLoc":77,"header":"def _serve_cross_domain_xml(self)","id":5794,"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\", \"{0}\".format(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\", \"{0}\".format(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"},{"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":5795,"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":"null","endLoc":1930,"header":"def _add_paramref(self, iterator, tag, data, config, pos)","id":5796,"name":"_add_paramref","nodeType":"Function","startLoc":1928,"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)"},{"col":4,"comment":"null","endLoc":1939,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":5797,"name":"_add_param","nodeType":"Function","startLoc":1932,"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":83,"header":"def do_POST(self)","id":5798,"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":"null","endLoc":175,"header":"def _run_client(self)","id":5799,"name":"_run_client","nodeType":"Function","startLoc":173,"text":"def _run_client(self):\n        if self._callable:\n            self._thread.start()"},{"col":4,"comment":"null","endLoc":92,"header":"def do_HEAD(self)","id":5800,"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":"\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":5801,"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={0}s)\".format(timeout))"},{"col":4,"comment":"null","endLoc":127,"header":"def is_http_path_valid(self)","id":5802,"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                       ['/translator/{}'.format(clid) for clid in self.server.clients])\n        return self.path.split('?')[0] in valid_paths"},{"col":4,"comment":"null","endLoc":97,"header":"def do_OPTIONS(self)","id":5803,"name":"do_OPTIONS","nodeType":"Function","startLoc":94,"text":"def do_OPTIONS(self):\n\n        self.send_response(200, 'OK')\n        self.end_headers()"},{"col":4,"comment":"\n        Whether the client is currently running.\n        ","endLoc":164,"header":"@property\n    def is_running(self)","id":5804,"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":5805,"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"},{"col":4,"comment":"null","endLoc":188,"header":"def _serve_forever(self)","id":5806,"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(\"Call to select in SAMPClient failed: {0}\".format(exc),\n                              SAMPWarning)\n            else:\n                if read_ready:\n                    self.client.handle_request()\n\n        self.client.server_close()"},{"col":4,"comment":"null","endLoc":121,"header":"def do_GET(self)","id":5807,"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 ['/translator/{}'.format(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":195,"header":"def _ping(self, private_key, sender_id, msg_id, msg_mtype, msg_params,\n              message)","id":5808,"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)"},{"col":4,"comment":"\n        Proxy to ``reply`` SAMP Hub method.\n        ","endLoc":202,"header":"def reply(self, private_key, msg_id, response)","id":5810,"name":"reply","nodeType":"Function","startLoc":198,"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)"},{"className":"WebProfileXMLRPCServer","col":0,"comment":"\n    XMLRPC server supporting the SAMP Web Profile.\n    ","endLoc":152,"id":5811,"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":0,"comment":"null","endLoc":731,"header":"def test_open_files()","id":5812,"name":"test_open_files","nodeType":"Function","startLoc":727,"text":"def test_open_files():\n    for filename in get_pkg_data_filenames('data', pattern='*.xml'):\n        if filename.endswith('custom_datatype.xml'):\n            continue\n        parse(filename, pedantic=False)"},{"col":4,"comment":"null","endLoc":140,"header":"def __init__(self, addr, log=None, requestHandler=WebProfileRequestHandler,\n                 logRequests=True, allow_none=True, encoding=None)","id":5813,"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":"null","endLoc":209,"header":"def _client_env_get(self, private_key, sender_id, msg_id, msg_mtype,\n                        msg_params, message)","id":5814,"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":"null","endLoc":738,"header":"@raises(VOTableSpecError)\ndef test_too_many_columns()","id":5815,"name":"test_too_many_columns","nodeType":"Function","startLoc":734,"text":"@raises(VOTableSpecError)\ndef test_too_many_columns():\n    parse(\n        get_pkg_data_filename('data/too_many_columns.xml.gz'),\n        pedantic=False)"},{"col":0,"comment":"null","endLoc":777,"header":"def test_build_from_scratch(tmpdir)","id":5816,"name":"test_build_from_scratch","nodeType":"Function","startLoc":741,"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\", datatype=\"char\"),\n        tree.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    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=[(str('filename'), str('?')),\n                                          (str('matrix'), str('?'), (2, 2))]))"},{"attributeType":"SAMPIntegratedClient | SAMPClient","col":8,"comment":"null","endLoc":99,"id":5817,"name":"cli","nodeType":"Attribute","startLoc":99,"text":"self.cli"},{"className":"_HubAsClient","col":0,"comment":"null","endLoc":135,"id":5818,"nodeType":"Class","startLoc":128,"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":131,"header":"def __init__(self, handler)","id":5819,"name":"__init__","nodeType":"Function","startLoc":130,"text":"def __init__(self, handler):\n        self._handler = handler"},{"col":4,"comment":"null","endLoc":135,"header":"def __getattr__(self, name)","id":5820,"name":"__getattr__","nodeType":"Function","startLoc":133,"text":"def __getattr__(self, name):\n        # magic method dispatcher\n        return _HubAsClientMethod(self._handler, name)"},{"col":4,"comment":"null","endLoc":142,"header":"def __init__(self, send, name)","id":5821,"name":"__init__","nodeType":"Function","startLoc":140,"text":"def __init__(self, send, name):\n        self.__send = send\n        self.__name = name"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":5822,"name":"_handler","nodeType":"Attribute","startLoc":131,"text":"self._handler"},{"className":"_HubAsClientMethod","col":0,"comment":"null","endLoc":148,"id":5823,"nodeType":"Class","startLoc":138,"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, \"{}.{}\".format(self.__name, name))\n\n    def __call__(self, *args):\n        return self.__send(self.__name, args)"},{"col":4,"comment":"null","endLoc":145,"header":"def __getattr__(self, name)","id":5824,"name":"__getattr__","nodeType":"Function","startLoc":144,"text":"def __getattr__(self, name):\n        return _HubAsClientMethod(self.__send, \"{}.{}\".format(self.__name, name))"},{"col":4,"comment":"null","endLoc":148,"header":"def __call__(self, *args)","id":5825,"name":"__call__","nodeType":"Function","startLoc":147,"text":"def __call__(self, *args):\n        return self.__send(self.__name, args)"},{"col":4,"comment":"null","endLoc":143,"header":"def add_client(self, client_id)","id":5826,"name":"add_client","nodeType":"Function","startLoc":142,"text":"def add_client(self, client_id):\n        self.clients.append(client_id)"},{"col":4,"comment":"null","endLoc":1828,"header":"def all_world2pix(self, *args, tolerance=1e-4, maxiter=20, adaptive=False,\n                      detect_divergence=True, quiet=False, **kwargs)","id":5827,"name":"all_world2pix","nodeType":"Function","startLoc":1816,"text":"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":4,"comment":"null","endLoc":231,"header":"def _handle_notification(self, private_key, sender_id, message)","id":5828,"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 \"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":5829,"name":"__name","nodeType":"Attribute","startLoc":142,"text":"self.__name"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":5830,"name":"__send","nodeType":"Attribute","startLoc":141,"text":"self.__send"},{"attributeType":"null","col":24,"comment":"null","endLoc":11,"id":5831,"name":"xmlrpc","nodeType":"Attribute","startLoc":11,"text":"xmlrpc"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":5832,"name":"__all__","nodeType":"Attribute","startLoc":30,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":5833,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":32,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"utils.py#<anonymous>","id":5834,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nUtility functions and classes\n\"\"\"\n\n__all__ = [\"SAMPMsgReplierWrapper\"]\n\n__doctest_skip__ = ['.']"},{"fileName":"hub.py","filePath":"astropy/samp","id":5835,"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 .. 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 = \"{0}:{1}\".format(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 {0} 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                            \"Client {} timeout expired!\".format(private_key),\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\": \"http://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 \"Hub {0}\".format(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(\"Call to select() in SAMPHubServer failed: {0}\".format(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(\"Call to select() in SAMPHubServer failed: {0}\".format(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(\"notify disconnection to {}\".format(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(\"set_xmlrpc_callback: {} {}\".format(private_key,\n                                                          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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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(\"register: private-key = {} and self-id = {}\"\n                  .format(private_key, 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 = \"cli#{}\".format(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(\"unregister {} ({})\".format(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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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(\"--> metadata = {}\"\n                              .format(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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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 \" + 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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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"},{"col":12,"endLoc":1826,"id":5836,"nodeType":"Lambda","startLoc":1822,"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":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":816,"header":"def test_validate(test_path_object=False)","id":5837,"name":"test_validate","nodeType":"Function","startLoc":780,"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    with catch_warnings():\n        result = validate(fpath,\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('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"},{"col":4,"comment":"null","endLoc":152,"header":"def remove_client(self, client_id)","id":5838,"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"},{"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":940,"header":"@staticmethod\n    def get_mtype_subtypes(mtype)","id":5839,"name":"get_mtype_subtypes","nodeType":"Function","startLoc":902,"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"},{"col":4,"comment":"null","endLoc":2250,"header":"def p4_pix2foc(self, *args)","id":5840,"name":"p4_pix2foc","nodeType":"Function","startLoc":2249,"text":"def p4_pix2foc(self, *args):\n        return self._array_converter(self._p4_pix2foc, None, *args)"},{"col":4,"comment":"null","endLoc":2279,"header":"def det2im(self, *args)","id":5841,"name":"det2im","nodeType":"Function","startLoc":2278,"text":"def det2im(self, *args):\n        return self._array_converter(self._det2im, None, *args)"},{"col":4,"comment":"null","endLoc":2315,"header":"def sip_pix2foc(self, *args)","id":5842,"name":"sip_pix2foc","nodeType":"Function","startLoc":2307,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":5843,"name":"clients","nodeType":"Attribute","startLoc":138,"text":"self.clients"},{"col":0,"comment":"null","endLoc":180,"header":"def web_profile_text_dialog(request, queue)","id":5844,"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        \"\"\"A Web application which declares to be\n\nName: {}\nOrigin: {}\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]\"\"\".format(samp_name, request[2])\n\n    print(text)\n    answer = input(\">>> \")\n    queue.put(answer.lower() in [\"yes\", \"y\"])"},{"col":0,"comment":"\n    Validating when source is passed as path object. (#4412)\n    ","endLoc":823,"header":"def test_validate_path_object()","id":5845,"name":"test_validate_path_object","nodeType":"Function","startLoc":819,"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":840,"header":"def test_gzip_filehandles(tmpdir)","id":5846,"name":"test_gzip_filehandles","nodeType":"Function","startLoc":826,"text":"def test_gzip_filehandles(tmpdir):\n    votable = parse(\n        get_pkg_data_filename('data/regression.xml'),\n        pedantic=False)\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'wb') as fd:\n        votable.to_xml(\n            fd,\n            compressed=True,\n            _astropy_version=\"testing\")\n\n    with open(str(tmpdir.join(\"regression.compressed.xml\")), 'rb') as fd:\n        votable = parse(\n            fd,\n            pedantic=False)"},{"col":4,"comment":"null","endLoc":2356,"header":"def sip_foc2pix(self, *args)","id":5847,"name":"sip_foc2pix","nodeType":"Function","startLoc":2348,"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":0,"comment":"null","endLoc":850,"header":"def test_from_scratch_example()","id":5848,"name":"test_from_scratch_example","nodeType":"Function","startLoc":843,"text":"def test_from_scratch_example():\n    with catch_warnings(VOWarning) as warning_lines:\n        try:\n            _run_test_from_scratch_example()\n        except ValueError as e:\n            warning_lines.append(str(e))\n\n    assert len(warning_lines) == 0"},{"col":0,"comment":"null","endLoc":880,"header":"def _run_test_from_scratch_example()","id":5849,"name":"_run_test_from_scratch_example","nodeType":"Function","startLoc":853,"text":"def _run_test_from_scratch_example():\n    from ..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":"\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:`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":2426,"header":"def to_fits(self, relax=False, key=None)","id":5850,"name":"to_fits","nodeType":"Function","startLoc":2385,"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:`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"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":5851,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":5852,"name":"CROSS_DOMAIN","nodeType":"Attribute","startLoc":14,"text":"CROSS_DOMAIN"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":5853,"name":"CLIENT_ACCESS_POLICY","nodeType":"Attribute","startLoc":15,"text":"CLIENT_ACCESS_POLICY"},{"col":0,"comment":"","endLoc":4,"header":"web_profile.py#<anonymous>","id":5854,"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')"},{"className":"SAMPHubError","col":0,"comment":"\n    SAMP Hub exception.\n    ","endLoc":24,"id":5855,"nodeType":"Class","startLoc":21,"text":"class SAMPHubError(Exception):\n    \"\"\"\n    SAMP Hub exception.\n    \"\"\""},{"col":0,"comment":"\n    Read in the lockfile given by ``lockfilename`` into a dictionary.\n    ","endLoc":38,"header":"def read_lockfile(lockfilename)","id":5856,"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"},{"fileName":"setup_package.py","filePath":"astropy/samp","id":5857,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\n\n\ndef get_package_data():\n    return {\n            'astropy.samp': [os.path.join('data', '*')],\n            'astropy.samp.tests': [os.path.join('data', '*')]\n           }\n"},{"col":0,"comment":"null","endLoc":10,"header":"def get_package_data()","id":5858,"name":"get_package_data","nodeType":"Function","startLoc":6,"text":"def get_package_data():\n    return {\n            'astropy.samp': [os.path.join('data', '*')],\n            'astropy.samp.tests': [os.path.join('data', '*')]\n           }"},{"col":0,"comment":"null","endLoc":892,"header":"def test_fileobj()","id":5859,"name":"test_fileobj","nodeType":"Function","startLoc":883,"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 ....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)"},{"fileName":"lockfile_helpers.py","filePath":"astropy/samp","id":5860,"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 ..config.paths import _find_home\n\n\nfrom .. import log\n\nfrom ..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(\"# SAMP lockfile written on {}\\n\".format(now_iso))\n    lockfile.write(\"# Standard Profile required keys\\n\")\n    for key, value in lockfiledict.items():\n        lockfile.write(\"{0}={1}\\n\".format(key, value))\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                                            \"samp-hub-{}\".format(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"},{"col":0,"comment":"null","endLoc":53,"header":"def write_lockfile(lockfilename, lockfiledict)","id":5861,"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(\"# SAMP lockfile written on {}\\n\".format(now_iso))\n    lockfile.write(\"# Standard Profile required keys\\n\")\n    for key, value in lockfiledict.items():\n        lockfile.write(\"{0}={1}\\n\".format(key, value))\n    lockfile.close()"},{"col":4,"comment":"\n        Identical to `to_header`, but returns a string containing the\n        header cards.\n        ","endLoc":2621,"header":"def to_header_string(self, relax=None)","id":5862,"name":"to_header_string","nodeType":"Function","startLoc":2616,"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":2665,"header":"def footprint_to_file(self, filename='footprint.reg', color='green',\n                          width=2, coordsys=None)","id":5863,"name":"footprint_to_file","nodeType":"Function","startLoc":2623,"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('{}\\n'.format(coordsys))\n            f.write('polygon(')\n            self.calc_footprint().tofile(f, sep=',')\n            f.write(') # color={0}, width={1:d} \\n'.format(color, width))"},{"col":4,"comment":"null","endLoc":1944,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":5864,"name":"_add_group","nodeType":"Function","startLoc":1941,"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)"},{"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":5865,"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)"},{"col":4,"comment":"null","endLoc":282,"header":"def _handle_call(self, private_key, sender_id, msg_id, message)","id":5866,"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":0,"comment":"null","endLoc":911,"header":"def test_nonstandard_units()","id":5867,"name":"test_nonstandard_units","nodeType":"Function","startLoc":895,"text":"def test_nonstandard_units():\n    from .... import units as u\n\n    votable = parse(\n        get_pkg_data_filename('data/nonstandard_units.xml'),\n        pedantic=False)\n\n    assert isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)\n\n    votable = parse(\n        get_pkg_data_filename('data/nonstandard_units.xml'),\n        pedantic=False,\n        unit_format='generic')\n\n    assert not isinstance(\n        votable.get_first_table().fields[0].unit, u.UnrecognizedUnit)"},{"col":0,"comment":"null","endLoc":118,"header":"def create_lock_file(lockfilename=None, mode=None, hub_id=None,\n                     hub_params=None)","id":5868,"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                                            \"samp-hub-{}\".format(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":5869,"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":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":5870,"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":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":5871,"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":"null","endLoc":324,"header":"def _handle_response(self, private_key, responder_id, msg_tag, response)","id":5872,"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":2669,"header":"@property\n    def _naxis1(self)","id":5873,"name":"_naxis1","nodeType":"Function","startLoc":2667,"text":"@property\n    def _naxis1(self):\n        return self._naxis[0]"},{"col":4,"comment":"null","endLoc":2673,"header":"@_naxis1.setter\n    def _naxis1(self, value)","id":5874,"name":"_naxis1","nodeType":"Function","startLoc":2671,"text":"@_naxis1.setter\n    def _naxis1(self, value):\n        self._naxis[0] = value"},{"col":4,"comment":"null","endLoc":2677,"header":"@property\n    def _naxis2(self)","id":5875,"name":"_naxis2","nodeType":"Function","startLoc":2675,"text":"@property\n    def _naxis2(self):\n        return self._naxis[1]"},{"col":4,"comment":"null","endLoc":2681,"header":"@_naxis2.setter\n    def _naxis2(self, value)","id":5876,"name":"_naxis2","nodeType":"Function","startLoc":2679,"text":"@_naxis2.setter\n    def _naxis2(self, value):\n        self._naxis[1] = value"},{"col":4,"comment":"null","endLoc":2699,"header":"def printwcs(self)","id":5877,"name":"printwcs","nodeType":"Function","startLoc":2698,"text":"def printwcs(self):\n        print(repr(self))"},{"col":4,"comment":"\n        Return a short description. Simply porting the behavior from\n        the `printwcs()` method.\n        ","endLoc":2733,"header":"def __repr__(self)","id":5878,"name":"__repr__","nodeType":"Function","startLoc":2701,"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                       \"Number of WCS axes: {0!r}\".format(self.naxis)]\n        sfmt = ' : ' + \"\".join([\"{\"+\"{0}\".format(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('NAXIS : {}'.format('  '.join(map(str, self._naxis))))\n        return '\\n'.join(description)"},{"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":5879,"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":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 catched.\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":5880,"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 catched.\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        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":5881,"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":"null","endLoc":674,"header":"def _declare_subscriptions(self, subscriptions=None)","id":5882,"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.\")"},{"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":1354,"id":5883,"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 = \"{0}:{1}\".format(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 {0} 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                            \"Client {} timeout expired!\".format(private_key),\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\": \"http://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 \"Hub {0}\".format(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(\"Call to select() in SAMPHubServer failed: {0}\".format(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(\"Call to select() in SAMPHubServer failed: {0}\".format(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(\"notify disconnection to {}\".format(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(\"set_xmlrpc_callback: {} {}\".format(private_key,\n                                                          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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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(\"register: private-key = {} and self-id = {}\"\n                  .format(private_key, 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 = \"cli#{}\".format(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(\"unregister {} ({})\".format(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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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(\"--> metadata = {}\"\n                              .format(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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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 \" + 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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"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 dicts\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":2830,"header":"def get_axis_types(self)","id":5884,"name":"get_axis_types","nodeType":"Function","startLoc":2735,"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 dicts\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":"\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":2844,"header":"def __reduce__(self)","id":5885,"name":"__reduce__","nodeType":"Function","startLoc":2832,"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        return (__WCS_unpickle__,\n                (self.__class__, self.__dict__, buffer.getvalue(),))"},{"col":0,"comment":"null","endLoc":958,"header":"def test_resource_structure()","id":5886,"name":"test_resource_structure","nodeType":"Function","startLoc":914,"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"},{"col":4,"comment":"\n        Proxy to ``declareSubscriptions`` SAMP Hub method.\n        ","endLoc":147,"header":"def declare_subscriptions(self, private_key, subscriptions)","id":5887,"name":"declare_subscriptions","nodeType":"Function","startLoc":143,"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":"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":5888,"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":"\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":5889,"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        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":5890,"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.\")"},{"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":5891,"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":"\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":5892,"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":"\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":5893,"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":"\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":5894,"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        Register the client to the SAMP Hub.\n        ","endLoc":632,"header":"def register(self)","id":5895,"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        Proxy to ``register`` SAMP Hub method.\n        ","endLoc":123,"header":"def register(self, secret)","id":5896,"name":"register","nodeType":"Function","startLoc":119,"text":"def register(self, secret):\n        \"\"\"\n        Proxy to ``register`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.register(secret)"},{"col":4,"comment":"null","endLoc":651,"header":"def _set_xmlrpc_callback(self)","id":5897,"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":"\n        Proxy to ``setXmlrpcCallback`` SAMP Hub method (Standard Profile only).\n        ","endLoc":117,"header":"def set_xmlrpc_callback(self, private_key, xmlrpc_addr)","id":5898,"name":"set_xmlrpc_callback","nodeType":"Function","startLoc":113,"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":"null","endLoc":1965,"header":"def parse(self, iterator, config)","id":5899,"name":"parse","nodeType":"Function","startLoc":1946,"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":1975,"header":"def to_xml(self, w, **kwargs)","id":5900,"name":"to_xml","nodeType":"Function","startLoc":1967,"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)"},{"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":5901,"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        Recursively iterate over all :class:`Param` elements in this\n        :class:`Group`.\n        ","endLoc":1987,"header":"def iter_fields_and_params(self)","id":5902,"name":"iter_fields_and_params","nodeType":"Function","startLoc":1977,"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"},{"col":4,"comment":"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        ","endLoc":135,"header":"def declare_metadata(self, private_key, metadata)","id":5903,"name":"declare_metadata","nodeType":"Function","startLoc":131,"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        Recursively iterate over all sub-:class:`Group` instances in\n        this :class:`Group`.\n        ","endLoc":1998,"header":"def iter_groups(self)","id":5904,"name":"iter_groups","nodeType":"Function","startLoc":1989,"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":1885,"id":5905,"name":"ref","nodeType":"Attribute","startLoc":1885,"text":"self.ref"},{"attributeType":"null","col":8,"comment":"null","endLoc":1880,"id":5906,"name":"_table","nodeType":"Attribute","startLoc":1880,"text":"self._table"},{"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        A new `~astropy.wcs.WCS` instance with one axis fewer\n        ","endLoc":2868,"header":"def dropaxis(self, dropax)","id":5907,"name":"dropaxis","nodeType":"Function","startLoc":2846,"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        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":"HomogeneousList","col":8,"comment":"null","endLoc":1890,"id":5908,"name":"_entries","nodeType":"Attribute","startLoc":1890,"text":"self._entries"},{"attributeType":"null","col":8,"comment":"null","endLoc":1886,"id":5909,"name":"ucd","nodeType":"Attribute","startLoc":1886,"text":"self.ucd"},{"col":4,"comment":"null","endLoc":461,"header":"def _create_secret_code(self)","id":5910,"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":5911,"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":5912,"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')"},{"col":4,"comment":"\n        Unregister the client from the SAMP Hub.\n        ","endLoc":646,"header":"def unregister(self)","id":5913,"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.\")"},{"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":5914,"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":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":5915,"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":"\n        Proxy to ``unregister`` SAMP Hub method.\n        ","endLoc":129,"header":"def unregister(self, private_key)","id":5916,"name":"unregister","nodeType":"Function","startLoc":125,"text":"def unregister(self, private_key):\n        \"\"\"\n        Proxy to ``unregister`` SAMP Hub method.\n        \"\"\"\n        return self._samp_hub.unregister(private_key)"},{"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        A new `~astropy.wcs.WCS` instance with the same number of axes, but two\n        swapped\n        ","endLoc":2891,"header":"def swapaxes(self, ax0, ax1)","id":5917,"name":"swapaxes","nodeType":"Function","startLoc":2870,"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        A new `~astropy.wcs.WCS` instance with the same number of axes, but two\n        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])"},{"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":5918,"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":5919,"name":"_hub_id","nodeType":"Attribute","startLoc":87,"text":"self._hub_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":85,"id":5920,"name":"_public_id","nodeType":"Attribute","startLoc":85,"text":"self._public_id"},{"attributeType":"null","col":16,"comment":"null","endLoc":119,"id":5921,"name":"_port","nodeType":"Attribute","startLoc":119,"text":"self._port"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":5922,"name":"_private_key","nodeType":"Attribute","startLoc":86,"text":"self._private_key"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":5923,"name":"_is_running","nodeType":"Attribute","startLoc":64,"text":"self._is_running"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":5924,"name":"_notification_bindings","nodeType":"Attribute","startLoc":88,"text":"self._notification_bindings"},{"attributeType":"SAMPHubProxy","col":8,"comment":"null","endLoc":101,"id":5925,"name":"hub","nodeType":"Attribute","startLoc":101,"text":"self.hub"},{"attributeType":"null","col":8,"comment":"null","endLoc":81,"id":5926,"name":"_callable","nodeType":"Attribute","startLoc":81,"text":"self._callable"},{"fileName":"__init__.py","filePath":"astropy/samp","id":5927,"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 Protocal (SAMP)\n<http://www.ivoa.net/documents/SAMP/>`_.\n\nBefore integration into Astropy it was known as\n`SAMPy <https://pypi.python.org/pypi/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 .. 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":5928,"name":"_addr","nodeType":"Attribute","startLoc":78,"text":"self._addr"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.samp`.\n    ","endLoc":36,"id":5929,"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\")"},{"attributeType":"null","col":12,"comment":"null","endLoc":105,"id":5930,"name":"_thread","nodeType":"Attribute","startLoc":105,"text":"self._thread"},{"attributeType":"null","col":12,"comment":"null","endLoc":108,"id":5931,"name":"client","nodeType":"Attribute","startLoc":108,"text":"self.client"},{"attributeType":"null","col":8,"comment":"null","endLoc":65,"id":5932,"name":"_is_registered","nodeType":"Attribute","startLoc":65,"text":"self._is_registered"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":29,"id":5933,"name":"use_internet","nodeType":"Attribute","startLoc":29,"text":"use_internet"},{"attributeType":"null","col":12,"comment":"null","endLoc":123,"id":5934,"name":"_xmlrpcAddr","nodeType":"Attribute","startLoc":123,"text":"self._xmlrpcAddr"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":5935,"name":"_response_bindings","nodeType":"Attribute","startLoc":91,"text":"self._response_bindings"},{"attributeType":"null","col":8,"comment":"null","endLoc":76,"id":5936,"name":"_metadata","nodeType":"Attribute","startLoc":76,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":5937,"name":"_call_bindings","nodeType":"Attribute","startLoc":89,"text":"self._call_bindings"},{"attributeType":"null","col":16,"comment":"null","endLoc":99,"id":5938,"name":"_host_name","nodeType":"Attribute","startLoc":99,"text":"self._host_name"},{"className":"SAMPHubProxy","col":0,"comment":"\n    Proxy class to simplify the client interaction with a SAMP hub (via the\n    standard profile).\n    ","endLoc":202,"id":5939,"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(\"Protocol Error {}: {}\".format(p.errcode,\n                                                                  p.errmsg))\n\n    def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        self.proxy = None\n        self._connected = False\n        self.lockfile = {}\n\n    def server_close(self):\n        self.proxy.server_close()\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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1884,"id":5940,"name":"name","nodeType":"Attribute","startLoc":1884,"text":"self.name"},{"col":4,"comment":"null","endLoc":23,"header":"def __init__(self)","id":5941,"name":"__init__","nodeType":"Function","startLoc":21,"text":"def __init__(self):\n        self.proxy = None\n        self._connected = False"},{"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":5942,"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":86,"header":"def connect(self, hub=None, hub_params=None, pool_size=20)","id":5943,"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(\"Protocol Error {}: {}\".format(p.errcode,\n                                                                  p.errmsg))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1887,"id":5944,"name":"utype","nodeType":"Attribute","startLoc":1887,"text":"self.utype"},{"attributeType":"null","col":8,"comment":"null","endLoc":1909,"id":5945,"name":"_ref","nodeType":"Attribute","startLoc":1909,"text":"self._ref"},{"col":4,"comment":"null","endLoc":234,"header":"def _register_web_profile_api(self, server)","id":5946,"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')"},{"attributeType":"null","col":8,"comment":"null","endLoc":1877,"id":5947,"name":"_pos","nodeType":"Attribute","startLoc":1877,"text":"self._pos"},{"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":2899,"header":"def reorient_celestial_first(self)","id":5948,"name":"reorient_celestial_first","nodeType":"Function","startLoc":2893,"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])"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":35,"id":5949,"name":"n_retries","nodeType":"Attribute","startLoc":35,"text":"n_retries"},{"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":2978,"header":"def slice(self, view, numpy_order=True)","id":5950,"name":"slice","nodeType":"Function","startLoc":2901,"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            raise ValueError(\"Cannot downsample a WCS with indexing.  Use \"\n                             \"wcs.sub or wcs.dropaxis if you want to remove \"\n                             \"axes.\")\n\n        wcs_new = self.deepcopy()\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                    wcs_new.wcs.cdelt[wcs_index] = cdelt * iview.step\n                else:\n                    wcs_new.wcs.crpix[wcs_index] -= iview.start\n\n            try:\n                # range requires integers but the other attributes can also\n                # handle arbitary 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{0} attribute is not updated because at \"\n                              \"least one indix ('{1}') is no integer.\"\n                              \"\".format(wcs_index, iview), AstropyUserWarning)\n            else:\n                wcs_new._naxis[wcs_index] = nitems\n\n        return wcs_new"},{"attributeType":"None","col":8,"comment":"null","endLoc":1888,"id":5951,"name":"description","nodeType":"Attribute","startLoc":1888,"text":"self.description"},{"col":4,"comment":"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        ","endLoc":111,"header":"def ping(self)","id":5952,"name":"ping","nodeType":"Function","startLoc":107,"text":"def ping(self):\n        \"\"\"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        \"\"\"\n        return self._samp_hub.ping()"},{"col":0,"comment":"null","endLoc":990,"header":"def test_no_resource_check()","id":5953,"name":"test_no_resource_check","nodeType":"Function","startLoc":961,"text":"def test_no_resource_check():\n    output = io.StringIO()\n\n    with catch_warnings():\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":1882,"id":5954,"name":"ID","nodeType":"Attribute","startLoc":1882,"text":"self.ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":1876,"id":5955,"name":"_config","nodeType":"Attribute","startLoc":1876,"text":"self._config"},{"col":4,"comment":"\n        Disconnect from the current SAMP Hub.\n        ","endLoc":94,"header":"def disconnect(self)","id":5956,"name":"disconnect","nodeType":"Function","startLoc":88,"text":"def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        self.proxy = None\n        self._connected = False\n        self.lockfile = {}"},{"col":4,"comment":"null","endLoc":97,"header":"def server_close(self)","id":5957,"name":"server_close","nodeType":"Function","startLoc":96,"text":"def server_close(self):\n        self.proxy.server_close()"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":39,"id":5958,"name":"conf","nodeType":"Attribute","startLoc":39,"text":"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":105,"header":"@property\n    def _samp_hub(self)","id":5959,"name":"_samp_hub","nodeType":"Function","startLoc":99,"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 ``getMetadata`` SAMP Hub method.\n        ","endLoc":141,"header":"def get_metadata(self, private_key, client_id)","id":5960,"name":"get_metadata","nodeType":"Function","startLoc":137,"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)"},{"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":3216,"id":5961,"nodeType":"Class","startLoc":2965,"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._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 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_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            '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.params,\n                                self.infos, self.links, self.tables,\n                                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_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":"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        ","endLoc":153,"header":"def get_subscriptions(self, private_key, client_id)","id":5962,"name":"get_subscriptions","nodeType":"Function","startLoc":149,"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":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":5963,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis subpackage provides classes to communicate with other applications via the\n`Simple Application Messaging Protocal (SAMP)\n<http://www.ivoa.net/documents/SAMP/>`_.\n\nBefore integration into Astropy it was known as\n`SAMPy <https://pypi.python.org/pypi/sampy/>`_, and was developed by Luigi Paioro\n(INAF - Istituto Nazionale di Astrofisica).\n\"\"\"\n\nconf = Conf()"},{"col":4,"comment":"\n        Proxy to ``getRegisteredClients`` SAMP Hub method.\n        ","endLoc":159,"header":"def get_registered_clients(self, private_key)","id":5964,"name":"get_registered_clients","nodeType":"Function","startLoc":155,"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":165,"header":"def get_subscribed_clients(self, private_key, mtype)","id":5965,"name":"get_subscribed_clients","nodeType":"Function","startLoc":161,"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":3005,"header":"def __repr__(self)","id":5966,"name":"__repr__","nodeType":"Function","startLoc":2999,"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":4,"comment":"\n        Proxy to ``notify`` SAMP Hub method.\n        ","endLoc":171,"header":"def notify(self, private_key, recipient_id, message)","id":5967,"name":"notify","nodeType":"Function","startLoc":167,"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)"},{"fileName":"client.py","filePath":"astropy/samp","id":5968,"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                                           '{0}:{1}'.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={0}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(\"Call to select in SAMPClient failed: {0}\".format(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 catched.\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"},{"className":"SAMPClientError","col":0,"comment":"\n    SAMP Client exceptions.\n    ","endLoc":30,"id":5969,"nodeType":"Class","startLoc":27,"text":"class SAMPClientError(Exception):\n    \"\"\"\n    SAMP Client exceptions.\n    \"\"\""},{"col":4,"comment":"null","endLoc":247,"header":"def _start_standard_server(self)","id":5970,"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 = \"{0}:{1}\".format(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":4,"comment":"\n        Proxy to ``notifyAll`` SAMP Hub method.\n        ","endLoc":177,"header":"def notify_all(self, private_key, message)","id":5971,"name":"notify_all","nodeType":"Function","startLoc":173,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":5972,"name":"__all__","nodeType":"Attribute","startLoc":20,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"client.py#<anonymous>","id":5973,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPClient']"},{"col":4,"comment":"\n        Proxy to ``call`` SAMP Hub method.\n        ","endLoc":183,"header":"def call(self, private_key, recipient_id, msg_tag, message)","id":5974,"name":"call","nodeType":"Function","startLoc":179,"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)"},{"col":4,"comment":"\n        Proxy to ``callAll`` SAMP Hub method.\n        ","endLoc":189,"header":"def call_all(self, private_key, msg_tag, message)","id":5975,"name":"call_all","nodeType":"Function","startLoc":185,"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        Proxy to ``callAndWait`` SAMP Hub method.\n        ","endLoc":196,"header":"def call_and_wait(self, private_key, recipient_id, message, timeout)","id":5976,"name":"call_and_wait","nodeType":"Function","startLoc":191,"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)"},{"fileName":"hub_script.py","filePath":"astropy/samp","id":5977,"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 .. import log, __version__\n\nfrom .hub import SAMPHubServer\n\n__all__ = ['main']\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(\"[SAMP] Error: I/O error({0}): {1}\".format(e.errno, e.strerror))\n        sys.exit(1)\n    except SystemExit:\n        pass\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":5978,"name":"_connected","nodeType":"Attribute","startLoc":23,"text":"self._connected"},{"attributeType":"null","col":8,"comment":"null","endLoc":22,"id":5979,"name":"proxy","nodeType":"Attribute","startLoc":22,"text":"self.proxy"},{"attributeType":"null","col":8,"comment":"null","endLoc":52,"id":5980,"name":"lockfile","nodeType":"Attribute","startLoc":52,"text":"self.lockfile"},{"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":5981,"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 keywords\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 keywords\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 keywords\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 keywords\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 keywords\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":"null","endLoc":68,"header":"def __init__(self, name=None, description=None, metadata=None,\n                 addr=None, port=0, callable=True)","id":5982,"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        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":5983,"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":5984,"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":"null","endLoc":2985,"header":"def __getitem__(self, item)","id":5985,"name":"__getitem__","nodeType":"Function","startLoc":2980,"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":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":5986,"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(\"[SAMP] Error: I/O error({0}): {1}\".format(e.errno, e.strerror))\n        sys.exit(1)\n    except SystemExit:\n        pass"},{"col":0,"comment":"null","endLoc":996,"header":"def test_instantiate_vowarning()","id":5987,"name":"test_instantiate_vowarning","nodeType":"Function","startLoc":993,"text":"def test_instantiate_vowarning():\n    # This used to raise a deprecation exception.\n    # See https://github.com/astropy/astroquery/pull/276\n    VOWarning(())"},{"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":3018,"header":"@property\n    def type(self)","id":5988,"name":"type","nodeType":"Function","startLoc":3007,"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":3024,"header":"@type.setter\n    def type(self, type)","id":5989,"name":"type","nodeType":"Function","startLoc":3020,"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":"null","endLoc":2991,"header":"def __iter__(self)","id":5990,"name":"__iter__","nodeType":"Function","startLoc":2987,"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(\"'{0}' object is not iterable\".format(self.__class__.__name__))"},{"col":4,"comment":"\n        World names for each coordinate axis\n\n        Returns\n        -------\n        A list of names along each axis\n        ","endLoc":3008,"header":"@property\n    def axis_type_names(self)","id":5991,"name":"axis_type_names","nodeType":"Function","startLoc":2993,"text":"@property\n    def axis_type_names(self):\n        \"\"\"\n        World names for each coordinate axis\n\n        Returns\n        -------\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":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":3034,"header":"@property\n    def extra_attributes(self)","id":5992,"name":"extra_attributes","nodeType":"Function","startLoc":3026,"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":3042,"header":"@property\n    def coordinate_systems(self)","id":5993,"name":"coordinate_systems","nodeType":"Function","startLoc":3036,"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 informational parameters (key-value pairs) for the\n        resource.  Must only contain `Info` objects.\n        ","endLoc":3050,"header":"@property\n    def infos(self)","id":5994,"name":"infos","nodeType":"Function","startLoc":3044,"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":3057,"header":"@property\n    def groups(self)","id":5995,"name":"groups","nodeType":"Function","startLoc":3052,"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":3065,"header":"@property\n    def params(self)","id":5996,"name":"params","nodeType":"Function","startLoc":3059,"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":3074,"header":"@property\n    def links(self)","id":5997,"name":"links","nodeType":"Function","startLoc":3067,"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":3082,"header":"@property\n    def tables(self)","id":5998,"name":"tables","nodeType":"Function","startLoc":3076,"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":3090,"header":"@property\n    def resources(self)","id":5999,"name":"resources","nodeType":"Function","startLoc":3084,"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":3095,"header":"def _add_table(self, iterator, tag, data, config, pos)","id":6000,"name":"_add_table","nodeType":"Function","startLoc":3092,"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":"\n        A copy of the current WCS with only the celestial axes included\n        ","endLoc":3015,"header":"@property\n    def celestial(self)","id":6001,"name":"celestial","nodeType":"Function","startLoc":3010,"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])"},{"col":4,"comment":"null","endLoc":3019,"header":"@property\n    def is_celestial(self)","id":6002,"name":"is_celestial","nodeType":"Function","startLoc":3017,"text":"@property\n    def is_celestial(self):\n        return self.has_celestial and self.naxis == 2"},{"col":4,"comment":"null","endLoc":3026,"header":"@property\n    def has_celestial(self)","id":6003,"name":"has_celestial","nodeType":"Function","startLoc":3021,"text":"@property\n    def has_celestial(self):\n        try:\n            return self.celestial.naxis == 2\n        except InconsistentAxisTypesError:\n            return False"},{"col":4,"comment":"null","endLoc":3048,"header":"@property\n    def pixel_scale_matrix(self)","id":6004,"name":"pixel_scale_matrix","nodeType":"Function","startLoc":3028,"text":"@property\n    def pixel_scale_matrix(self):\n\n        try:\n            cdelt = np.matrix(np.diag(self.wcs.get_cdelt()))\n            pc = np.matrix(self.wcs.get_pc())\n        except InconsistentAxisTypesError:\n            try:\n                # for non-celestial axes, get_cdelt doesn't work\n                cdelt = np.matrix(self.wcs.cd) * np.matrix(np.diag(self.wcs.cdelt))\n            except AttributeError:\n                cdelt = np.matrix(np.diag(self.wcs.cdelt))\n\n            try:\n                pc = np.matrix(self.wcs.pc)\n            except AttributeError:\n                pc = 1\n\n        pccd = np.array(cdelt * pc)\n\n        return pccd"},{"col":4,"comment":"\n        Compatibility hook for Matplotlib and WCSAxes.\n\n        With this method, one can do:\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n\n            wcs = WCS('filename.fits')\n\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":3069,"header":"def _as_mpl_axes(self)","id":6005,"name":"_as_mpl_axes","nodeType":"Function","startLoc":3050,"text":"def _as_mpl_axes(self):\n        \"\"\"\n        Compatibility hook for Matplotlib and WCSAxes.\n\n        With this method, one can do:\n\n            from astropy.wcs import WCS\n            import matplotlib.pyplot as plt\n\n            wcs = WCS('filename.fits')\n\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 ..visualization.wcsaxes import WCSAxes\n        return WCSAxes, {'wcs': self}"},{"col":0,"comment":"null","endLoc":1007,"header":"def test_custom_datatype()","id":6006,"name":"test_custom_datatype","nodeType":"Function","startLoc":999,"text":"def test_custom_datatype():\n    votable = parse(\n        get_pkg_data_filename('data/custom_datatype.xml'),\n        pedantic=False,\n        datatype_mapping={'bar': 'int'}\n    )\n\n    table = votable.get_first_table()\n    assert table.array.dtype['foo'] == np.int32"},{"attributeType":"null","col":4,"comment":"null","endLoc":1281,"id":6007,"name":"__doc__","nodeType":"Attribute","startLoc":1281,"text":"all_pix2world.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":1355,"id":6008,"name":"__doc__","nodeType":"Attribute","startLoc":1355,"text":"wcs_pix2world.__doc__"},{"col":4,"comment":"null","endLoc":277,"header":"def _start_web_profile_server(self)","id":6009,"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 {0} 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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1830,"id":6010,"name":"__doc__","nodeType":"Attribute","startLoc":1830,"text":"all_world2pix.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2162,"id":6011,"name":"__doc__","nodeType":"Attribute","startLoc":2162,"text":"wcs_world2pix.__doc__"},{"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":6012,"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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":2221,"id":6013,"name":"__doc__","nodeType":"Attribute","startLoc":2221,"text":"pix2foc.__doc__"},{"attributeType":"null","col":16,"comment":"null","endLoc":19,"id":6014,"name":"np","nodeType":"Attribute","startLoc":19,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":32,"id":6015,"name":"legacy_float_repr","nodeType":"Attribute","startLoc":32,"text":"legacy_float_repr"},{"attributeType":"null","col":4,"comment":"null","endLoc":2251,"id":6016,"name":"__doc__","nodeType":"Attribute","startLoc":2251,"text":"p4_pix2foc.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":34,"id":6017,"name":"legacy_float_repr","nodeType":"Attribute","startLoc":34,"text":"legacy_float_repr"},{"col":0,"comment":"","endLoc":7,"header":"vo_test.py#<anonymous>","id":6018,"name":"<anonymous>","nodeType":"Function","startLoc":5,"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')"},{"attributeType":"null","col":4,"comment":"null","endLoc":2280,"id":6019,"name":"__doc__","nodeType":"Attribute","startLoc":2280,"text":"det2im.__doc__"},{"fileName":"errors.py","filePath":"astropy/samp","id":6020,"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 ..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":6021,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"errors.py#<anonymous>","id":6022,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nDefines custom errors and exceptions used in `astropy.samp`.\n\"\"\"\n\n__all__ = ['SAMPWarning', 'SAMPHubError', 'SAMPClientError', 'SAMPProxyError']"},{"fileName":"hub_proxy.py","filePath":"astropy/samp","id":6023,"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(\"Protocol Error {}: {}\".format(p.errcode,\n                                                                  p.errmsg))\n\n    def disconnect(self):\n        \"\"\"\n        Disconnect from the current SAMP Hub.\n        \"\"\"\n        self.proxy = None\n        self._connected = False\n        self.lockfile = {}\n\n    def server_close(self):\n        self.proxy.server_close()\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":2316,"id":6024,"name":"__doc__","nodeType":"Attribute","startLoc":2316,"text":"sip_pix2foc.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2357,"id":6025,"name":"__doc__","nodeType":"Attribute","startLoc":2357,"text":"sip_foc2pix.__doc__"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":6026,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"hub_proxy.py#<anonymous>","id":6027,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPHubProxy']"},{"col":4,"comment":"\n        Proxy to ``ping`` SAMP Hub method (Standard Profile only).\n        ","endLoc":135,"header":"def ping(self)","id":6028,"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":12,"comment":"null","endLoc":479,"id":6029,"name":"naxis","nodeType":"Attribute","startLoc":479,"text":"self.naxis"},{"col":4,"comment":"\n        Proxy to ``declareMetadata`` SAMP Hub method.\n        ","endLoc":141,"header":"def declare_metadata(self, metadata)","id":6030,"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)"},{"id":6031,"name":"astropy/samp/data","nodeType":"Package"},{"id":6032,"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        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":6033,"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":"\n        Proxy to ``getMetadata`` SAMP Hub method.\n        ","endLoc":147,"header":"def get_metadata(self, client_id)","id":6034,"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)"},{"id":6035,"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":"null","endLoc":1257,"header":"def _update_last_activity_time(self, private_key=None)","id":6036,"name":"_update_last_activity_time","nodeType":"Function","startLoc":1253,"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":"null","endLoc":364,"header":"def _setup_hub_as_client(self)","id":6037,"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\": \"http://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":4,"comment":"\n        Proxy to ``getSubscriptions`` SAMP Hub method.\n        ","endLoc":153,"header":"def get_subscriptions(self, client_id)","id":6038,"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":711,"header":"def _register(self, secret)","id":6039,"name":"_register","nodeType":"Function","startLoc":705,"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":6040,"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())"},{"id":6041,"name":"astropy/samp/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/samp/tests","id":6042,"nodeType":"File","text":""},{"fileName":"web_profile_test_helpers.py","filePath":"astropy/samp/tests","id":6043,"nodeType":"File","text":"import time\nimport threading\nimport xmlrpc.client as xmlrpc\n\nfrom ..hub import WebProfileDialog\nfrom ..hub_proxy import SAMPHubProxy\nfrom ..client import SAMPClient\nfrom ..integrated_client import SAMPIntegratedClient\nfrom ..utils import ServerProxyPool\nfrom ..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                                         'http://127.0.0.1:{0}'.format(web_port),\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(\"Protocol Error {}: {}\".format(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        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            # Watch for callbacks here\n            if self._is_registered:\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.server_close()\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\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")\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":"null","endLoc":294,"header":"def _launch_thread(self, group=None, target=None, name=None, args=None)","id":6044,"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        Proxy to ``getSubscribedClients`` SAMP Hub method.\n        ","endLoc":167,"header":"def get_subscribed_clients(self, mtype)","id":6045,"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)"},{"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":1403,"id":6046,"nodeType":"Class","startLoc":1357,"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":1397,"header":"def handle_queue(self)","id":6047,"name":"handle_queue","nodeType":"Function","startLoc":1384,"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":"null","endLoc":181,"header":"def _format_easy_msg(self, mtype, params)","id":6048,"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":1400,"header":"def consent(self)","id":6049,"name":"consent","nodeType":"Function","startLoc":1399,"text":"def consent(self):\n        self.queue_result.put(True)"},{"col":4,"comment":"\n        Proxy to ``notify`` SAMP Hub method.\n        ","endLoc":187,"header":"def notify(self, recipient_id, message)","id":6050,"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)"},{"col":4,"comment":"null","endLoc":1403,"header":"def reject(self)","id":6051,"name":"reject","nodeType":"Function","startLoc":1402,"text":"def reject(self):\n        self.queue_result.put(False)"},{"col":4,"comment":"null","endLoc":703,"header":"def _perform_standard_register(self)","id":6052,"name":"_perform_standard_register","nodeType":"Function","startLoc":692,"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(\"register: private-key = {} and self-id = {}\"\n                  .format(private_key, public_id))\n        return {\"samp.self-id\": public_id,\n                \"samp.private-key\": private_key,\n                \"samp.hub-id\": self._hub_public_id}"},{"className":"AlwaysApproveWebProfileDialog","col":0,"comment":"null","endLoc":28,"id":6053,"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":4,"comment":"null","endLoc":720,"header":"def _get_new_ids(self)","id":6054,"name":"_get_new_ids","nodeType":"Function","startLoc":713,"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 = \"cli#{}\".format(self._client_id_counter)\n\n        return private_key, public_id"},{"col":4,"comment":"null","endLoc":17,"header":"def __init__(self)","id":6055,"name":"__init__","nodeType":"Function","startLoc":15,"text":"def __init__(self):\n        self.polling = True\n        WebProfileDialog.__init__(self)"},{"col":4,"comment":"null","endLoc":20,"header":"def show_dialog(self, *args)","id":6056,"name":"show_dialog","nodeType":"Function","startLoc":19,"text":"def show_dialog(self, *args):\n        self.consent()"},{"col":4,"comment":"null","endLoc":298,"header":"def _join_launched_threads(self, timeout=None)","id":6057,"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)"},{"col":4,"comment":"null","endLoc":317,"header":"def _timeout_test_hub(self)","id":6058,"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":4,"comment":"null","endLoc":25,"header":"def poll(self)","id":6059,"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":"null","endLoc":28,"header":"def stop(self)","id":6060,"name":"stop","nodeType":"Function","startLoc":27,"text":"def stop(self):\n        self.polling = False"},{"attributeType":"null","col":8,"comment":"null","endLoc":16,"id":6061,"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":6062,"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                                         'http://127.0.0.1:{0}'.format(web_port),\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(\"Protocol Error {}: {}\".format(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":6063,"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                                         'http://127.0.0.1:{0}'.format(web_port),\n                                         allow_none=1)\n            self.ping()\n            self._connected = True\n        except xmlrpc.ProtocolError as p:\n            raise SAMPHubError(\"Protocol Error {}: {}\".format(p.errcode, p.errmsg))"},{"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 keywords\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":6064,"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 keywords\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":"\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":6065,"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":6066,"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":6067,"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 ``notifyAll`` SAMP Hub method.\n        ","endLoc":226,"header":"def notify_all(self, message)","id":6068,"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        Stop the current SAMP Hub instance and delete the lock file.\n        ","endLoc":497,"header":"def stop(self)","id":6069,"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.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 keywords\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":6070,"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 keywords\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":"\n        Proxy to ``call`` SAMP Hub method.\n        ","endLoc":263,"header":"def call(self, recipient_id, msg_tag, message)","id":6071,"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        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 keywords\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":6072,"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 keywords\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":578,"header":"def _notify_shutdown(self)","id":6073,"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 ``allowReverseCallbacks`` SAMP Hub method.\n        ","endLoc":84,"header":"def allow_reverse_callbacks(self, private_key, allow)","id":6074,"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":6075,"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":6076,"name":"_connected","nodeType":"Attribute","startLoc":51,"text":"self._connected"},{"attributeType":"ServerProxyPool","col":12,"comment":"null","endLoc":54,"id":6077,"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":211,"id":6078,"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        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            # Watch for callbacks here\n            if self._is_registered:\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.server_close()\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\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")"},{"col":4,"comment":"null","endLoc":157,"header":"def __init__(self, hub, name=None, description=None, metadata=None,\n                 callable=True)","id":6079,"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        if self._callable:\n            self._thread = threading.Thread(target=self._serve_forever)\n            self._thread.daemon = True"},{"col":4,"comment":"null","endLoc":590,"header":"def _notify_register(self, private_key)","id":6080,"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":"null","endLoc":175,"header":"def _serve_forever(self)","id":6081,"name":"_serve_forever","nodeType":"Function","startLoc":159,"text":"def _serve_forever(self):\n        while self.is_running:\n            # Watch for callbacks here\n            if self._is_registered:\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.server_close()"},{"col":4,"comment":"null","endLoc":970,"header":"def _notify(self, private_key, recipient_id, message)","id":6082,"name":"_notify","nodeType":"Function","startLoc":955,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"attributeType":"null","col":8,"comment":"null","endLoc":2696,"id":6083,"name":"_naxis","nodeType":"Attribute","startLoc":2696,"text":"self._naxis"},{"col":4,"comment":"null","endLoc":1244,"header":"def _public_id_to_private_key(self, public_id)","id":6084,"name":"_public_id_to_private_key","nodeType":"Function","startLoc":1239,"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":0,"comment":"\n    Unpickles a WCS object from a serialized FITS string.\n    ","endLoc":3085,"header":"def __WCS_unpickle__(cls, dct, fits_data)","id":6085,"name":"__WCS_unpickle__","nodeType":"Function","startLoc":3072,"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    self.__dict__.update(dct)\n\n    buffer = io.BytesIO(fits_data)\n    hdulist = fits.open(buffer)\n\n    WCS.__init__(self, hdulist[0].header, hdulist)\n\n    return self"},{"col":4,"comment":"null","endLoc":953,"header":"def _is_subscribed(self, private_key, mtype)","id":6086,"name":"_is_subscribed","nodeType":"Function","startLoc":942,"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        Register the client to the SAMP Hub.\n        ","endLoc":211,"header":"def register(self)","id":6087,"name":"register","nodeType":"Function","startLoc":177,"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\n        else:\n            raise SAMPClientError(\"Unable to register to the SAMP Hub. Hub \"\n                                  \"proxy not connected.\")"},{"col":4,"comment":"\n        Proxy to ``callAll`` SAMP Hub method.\n        ","endLoc":307,"header":"def call_all(self, msg_tag, message)","id":6088,"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":690,"header":"def _set_xmlrpc_callback(self, private_key, xmlrpc_addr)","id":6089,"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(\"set_xmlrpc_callback: {} {}\".format(private_key,\n                                                          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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\n\n        return \"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":6090,"name":"__all__","nodeType":"Attribute","startLoc":60,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":6091,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":70,"text":"__doctest_skip__"},{"attributeType":"null","col":4,"comment":"null","endLoc":74,"id":6092,"name":"_parsed_version","nodeType":"Attribute","startLoc":74,"text":"_parsed_version"},{"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 keywords\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":6093,"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 keywords\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))"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":6094,"name":"WCSBase","nodeType":"Attribute","startLoc":86,"text":"WCSBase"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":6095,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":87,"text":"DistortionLookupTable"},{"col":4,"comment":"null","endLoc":773,"header":"def _declare_metadata(self, private_key, metadata)","id":6096,"name":"_declare_metadata","nodeType":"Function","startLoc":763,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\n        return \"\""},{"col":4,"comment":"null","endLoc":616,"header":"def _notify_metadata(self, private_key)","id":6097,"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                                  })"},{"attributeType":"null","col":4,"comment":"null","endLoc":88,"id":6098,"name":"Sip","nodeType":"Attribute","startLoc":88,"text":"Sip"},{"col":4,"comment":"null","endLoc":996,"header":"def _notify_(self, sender_private_key, recipient_public_id, message)","id":6099,"name":"_notify_","nodeType":"Function","startLoc":972,"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":1237,"header":"def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params)","id":6100,"name":"_retry_method","nodeType":"Function","startLoc":1184,"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 \" + conf.n_retries + \" attempts\"\n        raise SAMPHubError(error_message)"},{"attributeType":"null","col":4,"comment":"null","endLoc":89,"id":6101,"name":"Wcsprm","nodeType":"Attribute","startLoc":89,"text":"Wcsprm"},{"col":4,"comment":"null","endLoc":844,"header":"def _declare_subscriptions(self, private_key, mtypes)","id":6102,"name":"_declare_subscriptions","nodeType":"Function","startLoc":794,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\n\n        return \"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":90,"id":6103,"name":"Tabprm","nodeType":"Attribute","startLoc":90,"text":"Tabprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":6104,"name":"WcsError","nodeType":"Attribute","startLoc":91,"text":"WcsError"},{"attributeType":"null","col":4,"comment":"null","endLoc":92,"id":6105,"name":"SingularMatrixError","nodeType":"Attribute","startLoc":92,"text":"SingularMatrixError"},{"col":4,"comment":"null","endLoc":3100,"header":"def _add_info(self, iterator, tag, data, config, pos)","id":6106,"name":"_add_info","nodeType":"Function","startLoc":3097,"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":"null","col":4,"comment":"null","endLoc":93,"id":6107,"name":"InconsistentAxisTypesError","nodeType":"Attribute","startLoc":93,"text":"InconsistentAxisTypesError"},{"attributeType":"null","col":4,"comment":"null","endLoc":94,"id":6108,"name":"InvalidTransformError","nodeType":"Attribute","startLoc":94,"text":"InvalidTransformError"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":6109,"name":"InvalidCoordinateError","nodeType":"Attribute","startLoc":95,"text":"InvalidCoordinateError"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":6110,"name":"NoSolutionError","nodeType":"Attribute","startLoc":96,"text":"NoSolutionError"},{"col":4,"comment":"\n        Proxy to ``callAndWait`` SAMP Hub method.\n        ","endLoc":347,"header":"def call_and_wait(self, recipient_id, message, timeout)","id":6111,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":6112,"name":"InvalidSubimageSpecificationError","nodeType":"Attribute","startLoc":97,"text":"InvalidSubimageSpecificationError"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":6113,"name":"NonseparableSubimageCoordinateSystemError","nodeType":"Attribute","startLoc":98,"text":"NonseparableSubimageCoordinateSystemError"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":6114,"name":"NoWcsKeywordsFoundError","nodeType":"Attribute","startLoc":99,"text":"NoWcsKeywordsFoundError"},{"col":4,"comment":"null","endLoc":629,"header":"def _notify_subscriptions(self, private_key)","id":6115,"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                                  })"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":6116,"name":"InvalidTabularParametersError","nodeType":"Attribute","startLoc":100,"text":"InvalidTabularParametersError"},{"attributeType":"null","col":8,"comment":"null","endLoc":103,"id":6117,"name":"key","nodeType":"Attribute","startLoc":103,"text":"key"},{"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 keywords\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":6118,"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 keywords\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)"},{"attributeType":"null","col":13,"comment":"null","endLoc":103,"id":6119,"name":"val","nodeType":"Attribute","startLoc":103,"text":"val"},{"attributeType":"null","col":4,"comment":"null","endLoc":108,"id":6120,"name":"WCSBase","nodeType":"Attribute","startLoc":108,"text":"WCSBase"},{"attributeType":"null","col":4,"comment":"null","endLoc":109,"id":6121,"name":"Wcsprm","nodeType":"Attribute","startLoc":109,"text":"Wcsprm"},{"attributeType":"null","col":4,"comment":"null","endLoc":110,"id":6122,"name":"DistortionLookupTable","nodeType":"Attribute","startLoc":110,"text":"DistortionLookupTable"},{"attributeType":"null","col":4,"comment":"null","endLoc":111,"id":6123,"name":"Sip","nodeType":"Attribute","startLoc":111,"text":"Sip"},{"attributeType":"null","col":4,"comment":"null","endLoc":112,"id":6124,"name":"Tabprm","nodeType":"Attribute","startLoc":112,"text":"Tabprm"},{"attributeType":"None","col":4,"comment":"null","endLoc":113,"id":6125,"name":"WcsError","nodeType":"Attribute","startLoc":113,"text":"WcsError"},{"attributeType":"None","col":4,"comment":"null","endLoc":114,"id":6126,"name":"SingularMatrixError","nodeType":"Attribute","startLoc":114,"text":"SingularMatrixError"},{"attributeType":"None","col":4,"comment":"null","endLoc":115,"id":6127,"name":"InconsistentAxisTypesError","nodeType":"Attribute","startLoc":115,"text":"InconsistentAxisTypesError"},{"attributeType":"None","col":4,"comment":"null","endLoc":116,"id":6128,"name":"InvalidTransformError","nodeType":"Attribute","startLoc":116,"text":"InvalidTransformError"},{"attributeType":"None","col":4,"comment":"null","endLoc":117,"id":6129,"name":"InvalidCoordinateError","nodeType":"Attribute","startLoc":117,"text":"InvalidCoordinateError"},{"attributeType":"None","col":4,"comment":"null","endLoc":118,"id":6130,"name":"NoSolutionError","nodeType":"Attribute","startLoc":118,"text":"NoSolutionError"},{"col":4,"comment":"null","endLoc":455,"header":"def _start_threads(self)","id":6131,"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()"},{"attributeType":"None","col":4,"comment":"null","endLoc":119,"id":6132,"name":"InvalidSubimageSpecificationError","nodeType":"Attribute","startLoc":119,"text":"InvalidSubimageSpecificationError"},{"attributeType":"None","col":4,"comment":"null","endLoc":120,"id":6133,"name":"NonseparableSubimageCoordinateSystemError","nodeType":"Attribute","startLoc":120,"text":"NonseparableSubimageCoordinateSystemError"},{"attributeType":"None","col":4,"comment":"null","endLoc":121,"id":6134,"name":"NoWcsKeywordsFoundError","nodeType":"Attribute","startLoc":121,"text":"NoWcsKeywordsFoundError"},{"attributeType":"None","col":4,"comment":"null","endLoc":122,"id":6135,"name":"InvalidTabularParametersError","nodeType":"Attribute","startLoc":122,"text":"InvalidTabularParametersError"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":6136,"name":"WCSHDO_SIP","nodeType":"Attribute","startLoc":126,"text":"WCSHDO_SIP"},{"attributeType":"null","col":0,"comment":"null","endLoc":132,"id":6137,"name":"SIP_KW","nodeType":"Attribute","startLoc":132,"text":"SIP_KW"},{"col":0,"comment":"","endLoc":30,"header":"wcs.py#<anonymous>","id":6138,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nUnder the hood, there are 3 separate classes that perform different\nparts 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\nAdditionally, the class `WCS` aggregates all of these transformations\ntogether 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\"\"\"\n\ntry:\n    from . import _wcs\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n    else:\n        _wcs = None\n\n__all__ = ['FITSFixedWarning', 'WCS', 'find_all_wcs',\n           'DistortionLookupTable', 'Sip', 'Tabprm', 'Wcsprm',\n           'WCSBase', 'validate', 'WcsError', 'SingularMatrixError',\n           'InconsistentAxisTypesError', 'InvalidTransformError',\n           'InvalidCoordinateError', '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    Tabprm = _wcs.Tabprm\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\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')):\n            locals()[key] = val\n            __all__.append(key)\nelse:\n    WCSBase = object\n    Wcsprm = object\n    DistortionLookupTable = object\n    Sip = object\n    Tabprm = 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]?$''')"},{"col":4,"comment":"\n        Proxy to ``reply`` SAMP Hub method.\n        ","endLoc":390,"header":"def reply(self, msg_id, response)","id":6139,"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":"null","endLoc":400,"header":"def _format_easy_response(self, status, result, error)","id":6140,"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"},{"id":6141,"name":"astropy/time","nodeType":"Package"},{"fileName":"utils.py","filePath":"astropy/time","id":6142,"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\"\"\"\n\nimport numpy as np\n\n\ndef day_frac(val1, val2, factor=1., divisor=1.):\n    \"\"\"\n    Return the sum of ``val1`` and ``val2`` as two float64s, an integer part\n    and the fractional remainder.  If ``factor`` is not 1.0 then multiply the\n    sum by ``factor``.  If ``divisor`` is not 1.0 then divide the sum by\n    ``divisor``.\n\n    The arithmetic is all done with exact floating point operations so no\n    precision is lost to rounding error.  This routine assumes the sum is less\n    than about 1e16, otherwise the ``frac`` part will be greater than 1.0.\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 np.any(factor != 1.):\n        sum12, carry = two_product(sum12, factor)\n        carry += err12 * factor\n        sum12, err12 = two_sum(sum12, carry)\n\n    if np.any(divisor != 1.):\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    return day, frac\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\n    eb = b - eb\n    ea = x - b\n    ea = a - ea\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"},{"col":0,"comment":"","endLoc":8,"header":"utils.py#<anonymous>","id":6143,"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\"\"\""},{"fileName":"formats.py","filePath":"astropy/time","id":6144,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport fnmatch\nimport time\nimport re\nimport datetime\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .. import units as u\nfrom .. import _erfa as erfa\nfrom .utils import day_frac, two_sum\n\n\n__all__ = ['TimeFormat', 'TimeJD', 'TimeMJD', 'TimeFromEpoch', 'TimeUnix',\n           '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']\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        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 TimeFormatMeta(type):\n    \"\"\"\n    Metaclass that adds `TimeFormat` and `TimeDeltaFormat` to the\n    `TIME_FORMATS` and `TIME_DELTA_FORMATS` registries, respectively.\n    \"\"\"\n\n    _registry = TIME_FORMATS\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Register time formats that have 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 members and cls.name != 'astropy_time':\n            mcls._registry[cls.name] = cls\n\n        if 'subfmts' in members:\n            cls.subfmts = _regexify_subfmts(members['subfmts'])\n\n        return cls\n\n\nclass TimeFormat(metaclass=TimeFormatMeta):\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    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        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 __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 _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if not (val1.dtype == np.double and np.all(np.isfinite(val1)) and\n                (val2 is None or\n                 val2.dtype == np.double and np.all(np.isfinite(val2)))):\n            raise TypeError('Input values for {0} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Possibly scaled unit any quantity-likes should be converted to\n            _unit = u.CompositeUnit(getattr(self, 'unit', 1.), [u.day], [1])\n            val1 = u.Quantity(val1, copy=False).to_value(_unit)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False).to_value(_unit)\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.zeros_like(val1)\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 hasattr(self.__class__, 'epoch_scale') and scale is None:\n            scale = self.__class__.epoch_scale\n\n        if scale is None:\n            scale = 'utc'  # Default scale as of astropy 0.4\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{0}' not in \"\n                                  \"allowed values {1}\"\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):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.  This is\n        the base method that ignores ``parent`` and requires that\n        subclasses implement the ``value`` property.  Subclasses that\n        require ``parent`` or have other optional args for ``to_value``\n        should compute and return the value directly.\n        \"\"\"\n        return self.value\n\n    @property\n    def value(self):\n        raise NotImplementedError\n\n\nclass TimeJD(TimeFormat):\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    @property\n    def value(self):\n        return self.jd1 + self.jd2\n\n\nclass TimeMJD(TimeFormat):\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        # TODO - this routine and vals should be Cythonized to follow the ERFA\n        # convention of preserving precision by adding to the larger of the two\n        # values in a vectorized operation.  But in most practical cases the\n        # first one is probably biggest.\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    @property\n    def value(self):\n        return (self.jd1 - erfa.DJM0) + self.jd2\n\n\nclass TimeDecimalYear(TimeFormat):\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    @property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2)\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\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 decimalyear\n\n\nclass TimeFromEpoch(TimeFormat):\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    def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale\n        # Initialize the reference epoch (a single time defined in subclasses)\n        epoch = Time(self.epoch_val, self.epoch_val2, scale=self.epoch_scale,\n                     format=self.epoch_format)\n        self.epoch = epoch\n\n        # Now create the TimeFormat object as normal\n        super().__init__(val1, val2, scale, precision, in_subfmt, out_subfmt,\n                         from_jd)\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        # 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 '{0}' epoch scale '{1}'\"\n                                  \"to specified scale '{2}', got error:\\n{3}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err))\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)\n\n    def to_value(self, parent=None):\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            tm = getattr(parent, self.epoch_scale)\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        time_from_epoch = ((jd1 - self.epoch.jd1) +\n                           (jd2 - self.epoch.jd2)) / self.unit\n        return time_from_epoch\n\n    value = property(to_value)\n\n\nclass TimeUnix(TimeFromEpoch):\n    \"\"\"\n    Unix time: seconds from 1970-01-01 00:00:00 UTC.\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 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 http://tycho.usno.navy.mil/gpstt.html\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\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 {0} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\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        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\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        # Note: don't care about val2 for this class\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {0} class must be '\n                            'datetime objects'.format(self.name))\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'],\n                             op_dtypes=[object] + 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):\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 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)\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok'],\n                             op_dtypes=7*[iys.dtype] + [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        return iterator.operands[-1]\n\n    value = property(to_value)\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 : string, `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    This is a reference implementation can be made much faster with effort.\n    \"\"\"\n\n    def _check_val_type(self, val1, val2):\n        # Note: don't care about val2 for these classes\n        if val1.dtype.kind not in ('S', 'U'):\n            raise TypeError('Input values for {0} class must be strings'\n                            .format(self.name))\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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))\n\n    def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set 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                             op_dtypes=[val1.dtype] + 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        self.jd1, self.jd2 = 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)\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        if '{yday:' in str_fmt:\n            has_yday = True\n        else:\n            has_yday = False\n            yday = None\n\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs]):\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    def _select_subfmts(self, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n        \"\"\"\n\n        fnmatchcase = fnmatch.fnmatchcase\n        subfmts = [x for x in self.subfmts if fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            raise ValueError('No subformats match {0}'.format(pattern))\n        return subfmts\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    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\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\nclass TimeFITS(TimeString):\n    \"\"\"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]][(SCALE[(REALIZATION)])]\".\n\n    ISOT with two extensions:\n    - Can give signed five-digit year (mostly for negative years);\n    - A possible time scale (and realization) appended in parentheses.\n\n    Note: FITS supports some deprecated names for timescales; these are\n    translated to the formal names upon initialization.  Furthermore, any\n    specific realization information is stored only as long as the time scale\n    is not changed.\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    subfmts = tuple(\n        (subfmt[0],\n         subfmt[1] + r'(\\((?P<scale>\\w+)(\\((?P<realization>\\w+)\\))?\\))?',\n         subfmt[2]) for subfmt in subfmts)\n    _fits_scale = None\n    _fits_realization = None\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and set scale according to trailing scale codes.\"\"\"\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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))\n        tm = tm.groupdict()\n        if tm['scale'] is not None:\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 {0!r} is not in the allowed scales {1}\"\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.  Also store a possible realization,\n            # so we can round-trip (as long as no scale changes are made).\n            fits_realization = (tm['realization'].upper()\n                                if tm['realization'] else None)\n            if self._fits_scale is None:\n                self._fits_scale = fits_scale\n                self._fits_realization = fits_realization\n                if self._scale is None:\n                    self._scale = scale\n            if (scale != self.scale or fits_scale != self._fits_scale or\n                fits_realization != self._fits_realization):\n                raise ValueError(\"Input strings for {0} 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    def format_string(self, str_fmt, **kwargs):\n        \"\"\"Format time-string: append the scale to the normal ISOT format.\"\"\"\n        time_str = super().format_string(str_fmt, **kwargs)\n        if self._fits_scale and self._fits_realization:\n            return '{0}({1}({2}))'.format(time_str, self._fits_scale,\n                                          self._fits_realization)\n        else:\n            return '{0}({1})'.format(time_str, self._scale.upper())\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.min() < 1721425.5 or jd.max() >= 5373484.5:\n                self.out_subfmt = 'long' + self.out_subfmt\n        return super().value\n\n\nclass TimeEpochDate(TimeFormat):\n    \"\"\"\n    Base class for support floating point Besselian and Julian epoch dates\n    \"\"\"\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    @property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        return jd_to_epoch(self.jd1, self.jd2)\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\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\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        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('Time {0} does not match {1} format'\n                                 .format(time_str, self.name))\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 TimeDeltaFormatMeta(TimeFormatMeta):\n    _registry = TIME_DELTA_FORMATS\n\n\nclass TimeDeltaFormat(TimeFormat, metaclass=TimeDeltaFormatMeta):\n    \"\"\"Base class for time delta representations\"\"\"\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 '{0}' not in \"\n                                  \"allowed values {1}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale\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    @property\n    def value(self):\n        return (self.jd1 + self.jd2) / self.unit\n\n\nclass TimeDeltaSec(TimeDeltaFormat):\n    \"\"\"Time delta in SI seconds\"\"\"\n    name = 'sec'\n    unit = 1. / erfa.DAYSEC  # for quantity input\n\n\nclass TimeDeltaJD(TimeDeltaFormat):\n    \"\"\"Time delta in Julian days (86400 SI seconds)\"\"\"\n    name = 'jd'\n    unit = 1.\n\n\nfrom .core import Time, TIME_SCALES, TIME_DELTA_SCALES, ScaleValueError\n"},{"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":6145,"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))"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":6146,"name":"TIME_SCALES","nodeType":"Attribute","startLoc":37,"text":"TIME_SCALES"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":6147,"name":"TIME_DELTA_SCALES","nodeType":"Attribute","startLoc":60,"text":"TIME_DELTA_SCALES"},{"className":"ScaleValueError","col":0,"comment":"null","endLoc":1723,"id":6148,"nodeType":"Class","startLoc":1722,"text":"class ScaleValueError(Exception):\n    pass"},{"className":"TimeFormatMeta","col":0,"comment":"\n    Metaclass that adds `TimeFormat` and `TimeDeltaFormat` to the\n    `TIME_FORMATS` and `TIME_DELTA_FORMATS` registries, respectively.\n    ","endLoc":91,"id":6149,"nodeType":"Class","startLoc":71,"text":"class TimeFormatMeta(type):\n    \"\"\"\n    Metaclass that adds `TimeFormat` and `TimeDeltaFormat` to the\n    `TIME_FORMATS` and `TIME_DELTA_FORMATS` registries, respectively.\n    \"\"\"\n\n    _registry = TIME_FORMATS\n\n    def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Register time formats that have 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 members and cls.name != 'astropy_time':\n            mcls._registry[cls.name] = cls\n\n        if 'subfmts' in members:\n            cls.subfmts = _regexify_subfmts(members['subfmts'])\n\n        return cls"},{"col":4,"comment":"null","endLoc":91,"header":"def __new__(mcls, name, bases, members)","id":6150,"name":"__new__","nodeType":"Function","startLoc":79,"text":"def __new__(mcls, name, bases, members):\n        cls = super().__new__(mcls, name, bases, members)\n\n        # Register time formats that have 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 members and cls.name != 'astropy_time':\n            mcls._registry[cls.name] = cls\n\n        if 'subfmts' in members:\n            cls.subfmts = _regexify_subfmts(members['subfmts'])\n\n        return cls"},{"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":68,"header":"def _regexify_subfmts(subfmts)","id":6151,"name":"_regexify_subfmts","nodeType":"Function","startLoc":41,"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        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":4,"comment":"null","endLoc":436,"header":"def receive_notification(self, private_key, sender_id, message)","id":6152,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":77,"id":6153,"name":"_registry","nodeType":"Attribute","startLoc":77,"text":"_registry"},{"col":4,"comment":"null","endLoc":441,"header":"def receive_call(self, private_key, sender_id, msg_id, message)","id":6154,"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)"},{"attributeType":"None","col":8,"comment":"null","endLoc":147,"id":6155,"name":"_hub_id","nodeType":"Attribute","startLoc":147,"text":"self._hub_id"},{"attributeType":"null","col":8,"comment":"null","endLoc":80,"id":6156,"name":"cls","nodeType":"Attribute","startLoc":80,"text":"cls"},{"attributeType":"null","col":12,"comment":"null","endLoc":89,"id":6157,"name":"subfmts","nodeType":"Attribute","startLoc":89,"text":"cls.subfmts"},{"col":4,"comment":"null","endLoc":446,"header":"def receive_response(self, private_key, responder_id, msg_tag, response)","id":6158,"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)"},{"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":218,"id":6159,"nodeType":"Class","startLoc":94,"text":"class TimeFormat(metaclass=TimeFormatMeta):\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    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        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 __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 _check_val_type(self, val1, val2):\n        \"\"\"Input value validation, typically overridden by derived classes\"\"\"\n        if not (val1.dtype == np.double and np.all(np.isfinite(val1)) and\n                (val2 is None or\n                 val2.dtype == np.double and np.all(np.isfinite(val2)))):\n            raise TypeError('Input values for {0} class must be finite doubles'\n                            .format(self.name))\n\n        if getattr(val1, 'unit', None) is not None:\n            # Possibly scaled unit any quantity-likes should be converted to\n            _unit = u.CompositeUnit(getattr(self, 'unit', 1.), [u.day], [1])\n            val1 = u.Quantity(val1, copy=False).to_value(_unit)\n            if val2 is not None:\n                val2 = u.Quantity(val2, copy=False).to_value(_unit)\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.zeros_like(val1)\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 hasattr(self.__class__, 'epoch_scale') and scale is None:\n            scale = self.__class__.epoch_scale\n\n        if scale is None:\n            scale = 'utc'  # Default scale as of astropy 0.4\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{0}' not in \"\n                                  \"allowed values {1}\"\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):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.  This is\n        the base method that ignores ``parent`` and requires that\n        subclasses implement the ``value`` property.  Subclasses that\n        require ``parent`` or have other optional args for ``to_value``\n        should compute and return the value directly.\n        \"\"\"\n        return self.value\n\n    @property\n    def value(self):\n        raise NotImplementedError"},{"col":4,"comment":"null","endLoc":132,"header":"def __len__(self)","id":6160,"name":"__len__","nodeType":"Function","startLoc":131,"text":"def __len__(self):\n        return len(self.jd1)"},{"col":4,"comment":"null","endLoc":451,"header":"def bind_receive_message(self, mtype, function, declare=True, metadata=None)","id":6161,"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":"Time scale","endLoc":138,"header":"@property\n    def scale(self)","id":6162,"name":"scale","nodeType":"Function","startLoc":134,"text":"@property\n    def scale(self):\n        \"\"\"Time scale\"\"\"\n        self._scale = self._check_scale(self._scale)\n        return self._scale"},{"col":4,"comment":"null","endLoc":456,"header":"def bind_receive_notification(self, mtype, function, declare=True, metadata=None)","id":6163,"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":6164,"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)"},{"attributeType":"None","col":8,"comment":"null","endLoc":145,"id":6165,"name":"_public_id","nodeType":"Attribute","startLoc":145,"text":"self._public_id"},{"col":4,"comment":"null","endLoc":466,"header":"def bind_receive_response(self, msg_tag, function)","id":6166,"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":6167,"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":6168,"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":"\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":197,"header":"def _check_scale(self, scale)","id":6169,"name":"_check_scale","nodeType":"Function","startLoc":173,"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 hasattr(self.__class__, 'epoch_scale') and scale is None:\n            scale = self.__class__.epoch_scale\n\n        if scale is None:\n            scale = 'utc'  # Default scale as of astropy 0.4\n\n        if scale not in TIME_SCALES:\n            raise ScaleValueError(\"Scale value '{0}' not in \"\n                                  \"allowed values {1}\"\n                                  .format(scale, TIME_SCALES))\n\n        return scale"},{"col":4,"comment":"null","endLoc":481,"header":"def unbind_receive_response(self, msg_tag)","id":6170,"name":"unbind_receive_response","nodeType":"Function","startLoc":480,"text":"def unbind_receive_response(self, msg_tag):\n        self.client.unbind_receive_response(msg_tag)"},{"attributeType":"None","col":8,"comment":"null","endLoc":146,"id":6171,"name":"_private_key","nodeType":"Attribute","startLoc":146,"text":"self._private_key"},{"col":4,"comment":"null","endLoc":142,"header":"@scale.setter\n    def scale(self, val)","id":6172,"name":"scale","nodeType":"Function","startLoc":140,"text":"@scale.setter\n    def scale(self, val):\n        self._scale = val"},{"col":4,"comment":"\n        Return time representation from internal jd1 and jd2.  This is\n        the base method that ignores ``parent`` and requires that\n        subclasses implement the ``value`` property.  Subclasses that\n        require ``parent`` or have other optional args for ``to_value``\n        should compute and return the value directly.\n        ","endLoc":214,"header":"def to_value(self, parent=None)","id":6173,"name":"to_value","nodeType":"Function","startLoc":206,"text":"def to_value(self, parent=None):\n        \"\"\"\n        Return time representation from internal jd1 and jd2.  This is\n        the base method that ignores ``parent`` and requires that\n        subclasses implement the ``value`` property.  Subclasses that\n        require ``parent`` or have other optional args for ``to_value``\n        should compute and return the value directly.\n        \"\"\"\n        return self.value"},{"col":4,"comment":"null","endLoc":218,"header":"@property\n    def value(self)","id":6174,"name":"value","nodeType":"Function","startLoc":216,"text":"@property\n    def value(self):\n        raise NotImplementedError"},{"attributeType":"null","col":8,"comment":"null","endLoc":137,"id":6175,"name":"_scale","nodeType":"Attribute","startLoc":137,"text":"self._scale"},{"col":4,"comment":"null","endLoc":486,"header":"def declare_subscriptions(self, subscriptions=None)","id":6176,"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":6177,"name":"get_public_id","nodeType":"Function","startLoc":495,"text":"def get_public_id(self):\n        return self.client.get_public_id()"},{"attributeType":"null","col":12,"comment":"null","endLoc":125,"id":6178,"name":"jd1","nodeType":"Attribute","startLoc":125,"text":"self.jd1"},{"attributeType":"null","col":4,"comment":"null","endLoc":438,"id":6179,"name":"__doc__","nodeType":"Attribute","startLoc":438,"text":"receive_notification.__doc__"},{"col":4,"comment":"null","endLoc":3105,"header":"def _add_group(self, iterator, tag, data, config, pos)","id":6180,"name":"_add_group","nodeType":"Function","startLoc":3102,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":6181,"name":"_is_running","nodeType":"Attribute","startLoc":127,"text":"self._is_running"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":6182,"name":"precision","nodeType":"Attribute","startLoc":120,"text":"self.precision"},{"attributeType":"null","col":4,"comment":"null","endLoc":443,"id":6183,"name":"__doc__","nodeType":"Attribute","startLoc":443,"text":"receive_call.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":119,"id":6184,"name":"scale","nodeType":"Attribute","startLoc":119,"text":"self.scale"},{"attributeType":"null","col":8,"comment":"null","endLoc":148,"id":6185,"name":"_notification_bindings","nodeType":"Attribute","startLoc":148,"text":"self._notification_bindings"},{"attributeType":"null","col":4,"comment":"null","endLoc":448,"id":6186,"name":"__doc__","nodeType":"Attribute","startLoc":448,"text":"receive_response.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":6187,"name":"in_subfmt","nodeType":"Attribute","startLoc":121,"text":"self.in_subfmt"},{"attributeType":"null","col":4,"comment":"null","endLoc":453,"id":6188,"name":"__doc__","nodeType":"Attribute","startLoc":453,"text":"bind_receive_message.__doc__"},{"attributeType":"null","col":12,"comment":"null","endLoc":126,"id":6189,"name":"jd2","nodeType":"Attribute","startLoc":126,"text":"self.jd2"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":6190,"name":"hub","nodeType":"Attribute","startLoc":153,"text":"self.hub"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":6191,"name":"_callable","nodeType":"Attribute","startLoc":141,"text":"self._callable"},{"attributeType":"null","col":12,"comment":"null","endLoc":156,"id":6192,"name":"_thread","nodeType":"Attribute","startLoc":156,"text":"self._thread"},{"col":4,"comment":"null","endLoc":517,"header":"def _join_all_threads(self, timeout=None)","id":6193,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":458,"id":6194,"name":"__doc__","nodeType":"Attribute","startLoc":458,"text":"bind_receive_notification.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":6195,"name":"out_subfmt","nodeType":"Attribute","startLoc":122,"text":"self.out_subfmt"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":6196,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"hub_script.py#<anonymous>","id":6197,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['main']"},{"col":4,"comment":"null","endLoc":337,"header":"def _timeout_test_client(self)","id":6198,"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                            \"Client {} timeout expired!\".format(private_key),\n                            SAMPWarning)\n                        self._notify_disconnection(private_key)\n                        self._unregister(private_key)\n                last = now"},{"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":236,"id":6199,"nodeType":"Class","startLoc":221,"text":"class TimeJD(TimeFormat):\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    @property\n    def value(self):\n        return self.jd1 + self.jd2"},{"attributeType":"null","col":4,"comment":"null","endLoc":463,"id":6200,"name":"__doc__","nodeType":"Attribute","startLoc":463,"text":"bind_receive_call.__doc__"},{"col":4,"comment":"null","endLoc":232,"header":"def set_jds(self, val1, val2)","id":6201,"name":"set_jds","nodeType":"Function","startLoc":230,"text":"def set_jds(self, val1, val2):\n        self._check_scale(self._scale)  # Validate scale.\n        self.jd1, self.jd2 = day_frac(val1, val2)"},{"fileName":"__init__.py","filePath":"astropy/time","id":6202,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom .formats import *\nfrom .core import *\n"},{"fileName":"core.py","filePath":"astropy/time","id":6203,"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\n\nimport copy\nimport operator\nfrom datetime import datetime\nfrom collections import defaultdict\n\nimport numpy as np\n\nfrom .. import units as u, constants as const\nfrom .. import _erfa as erfa\nfrom ..units import UnitConversionError\nfrom ..utils.decorators import lazyproperty\nfrom ..utils import ShapedLikeNDArray\nfrom ..utils.compat.misc import override__dir__\nfrom ..utils.data_info import MixinInfo, data_info_factory\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  # pylint: disable=W0611\n\n\n__all__ = ['Time', 'TimeDelta', 'TIME_SCALES', 'TIME_DELTA_SCALES',\n           'ScaleValueError', 'OperandTypeError', 'TimeInfo']\n\n\nTIME_SCALES = ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\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) for scale in scales)\nTIME_DELTA_SCALES = TIME_DELTA_TYPES.keys()\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',)}},\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',)}}}\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    attrs_from_parent = set(['unit'])  # unit is read-only and None\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    @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                                     None: 'jd1_jd2'}\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            format = map.pop('format')\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n        else:\n            format = map['format']\n            map['val'] = map.pop('value')\n\n        out = self._parent_cls(**map)\n        out.format = format\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\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\nclass Time(ShapedLikeNDArray):\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', 'cxcsec', 'gps', 'plot_date',\n       'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n       'jyear_str']\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        Subformat for inputting string times\n    out_subfmt : str, optional\n        Subformat for outputting string 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    copy : bool, optional\n        Make a copy of the input values\n    \"\"\"\n\n    SCALES = TIME_SCALES\n    \"\"\"List of time scales\"\"\"\n\n    FORMATS = TIME_FORMATS\n    \"\"\"Dict of time formats\"\"\"\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 __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, cls):\n            self = val.replicate(format=format, copy=copy)\n        else:\n            self = super().__new__(cls)\n\n        return self\n\n    def __getnewargs__(self):\n        return (self._time,)\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 ..coordinates import EarthLocation\n            if isinstance(location, EarthLocation):\n                self.location = location\n            else:\n                self.location = EarthLocation(*location)\n        else:\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\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\n        if self.location is not None and (self.location.size > 1 and\n                                          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:\n                raise ValueError('The location with shape {0} cannot be '\n                                 'broadcast against time with shape {1}. '\n                                 'Typically, either give a single location or '\n                                 'one for each time.'\n                                 .format(self.location.shape, self.shape))\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) and\n                    scale.lower() in self.SCALES):\n                raise ScaleValueError(\"Scale {0!r} is not in the allowed scales \"\n                                      \"{1}\".format(scale,\n                                                   sorted(self.SCALES)))\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    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 and val.dtype.kind in ('S', 'U', 'O'):\n            formats = [(name, cls) for name, cls in self.FORMATS.items()\n                       if issubclass(cls, TimeUnique)]\n            err_msg = ('any of the formats where the format keyword is '\n                       'optional {0}'.format([name for name, cls in formats]))\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) and\n                  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 {0!r} is not one of the allowed \"\n                                 \"formats {1}\".format(format,\n                                                      sorted(self.FORMATS)))\n        else:\n            formats = [(format, self.FORMATS[format])]\n            err_msg = 'the format class {0}'.format(format)\n\n        for format, FormatClass in formats:\n            try:\n                return FormatClass(val, val2, scale, precision, in_subfmt, out_subfmt)\n            except UnitConversionError:\n                raise\n            except (ValueError, TypeError):\n                pass\n        else:\n            raise ValueError('Input values did not match {0}'.format(err_msg))\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\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    @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', 'cxcsec', 'gps', 'plot_date',\n           'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str',\n           '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('format must be one of {0}'\n                             .format(list(self.FORMATS)))\n        format_cls = self.FORMATS[format]\n\n        # If current output subformat is not in the new format then replace\n        # with default '*'\n        if hasattr(format_cls, 'subfmts'):\n            subfmt_names = [subfmt[0] for subfmt in format_cls.subfmts]\n            if self.out_subfmt not in subfmt_names:\n                self.out_subfmt = '*'\n\n        self._time = format_cls(self._time.jd1, self._time.jd2,\n                                self._time._scale, self.precision,\n                                in_subfmt=self.in_subfmt,\n                                out_subfmt=self.out_subfmt,\n                                from_jd=True)\n        self._format = format\n\n    def __repr__(self):\n        return (\"<{0} object: scale='{1}' format='{2}' value={3}>\"\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    @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 {0!r} is not in the allowed scales {1}\"\n                             .format(scale, sorted(self.SCALES)))\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\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_{0}_{1}'.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        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        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        del self.cache\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        if not isinstance(val, str):\n            raise ValueError('in_subfmt attribute must be a string')\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        if not isinstance(val, str):\n            raise ValueError('out_subfmt attribute must be a string')\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        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        # 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        for attr in ('jd1', 'jd2', '_delta_ut1_utc', '_delta_tdb_tt',\n                     'location'):\n            val = getattr(self, attr, None)\n            if val is not None and val.size > 1:\n                try:\n                    val.shape = shape\n                except AttributeError:\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        return value if self._time.jd1.shape else value.item()\n\n    @property\n    def jd1(self):\n        \"\"\"\n        First of the two doubles that internally store time value(s) in JD.\n        \"\"\"\n        return self._shaped_like_input(self._time.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        return self._shaped_like_input(self._time.jd2)\n\n    @property\n    def value(self):\n        \"\"\"Time value(s) in current format\"\"\"\n        # The underlying way to get the time values for the current format is:\n        #     self._shaped_like_input(self._time.to_value(parent=self))\n        # This is done in __getattr__.  By calling getattr(self, self.format)\n        # the ``value`` attribute is cached.\n        return getattr(self, self.format)\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        \"\"\"\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 ..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 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`, `str`, or `None`; optional\n            The longitude on the Earth at which to compute the sidereal time.\n            Can be given as a `~astropy.units.Quantity` with angular units\n            (or an `~astropy.coordinates.Angle` or\n            `~astropy.coordinates.Longitude`), or as a name of an\n            observatory (currently, only ``'greenwich'`` is supported,\n            equivalent to 0 deg).  If `None` (default), the ``lon`` attribute of\n            the Time object is used.\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        sidereal time : `~astropy.coordinates.Longitude`\n            Sidereal time as a quantity with units of hourangle\n        \"\"\"  # docstring is formatted below\n\n        from ..coordinates import Longitude\n\n        if kind.lower() not in SIDEREAL_TIME_MODELS.keys():\n            raise ValueError('The kind of sidereal time has to be {0}'.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        else:\n            if model.upper() not in available_models:\n                raise ValueError(\n                    'Model {0} not implemented for {1} sidereal time; '\n                    'available models are {2}'\n                    .format(model, kind, sorted(available_models.keys())))\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 longitude == 'greenwich':\n            longitude = Longitude(0., u.degree,\n                                  wrap_angle=180.*u.degree)\n        else:\n            # sanity check on input\n            longitude = Longitude(longitude, u.degree,\n                                  wrap_angle=180.*u.degree)\n\n        gst = self._erfa_sidereal_time(available_models[model.upper()])\n        return Longitude(gst + longitude, u.hourangle)\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 _erfa_sidereal_time(self, model):\n        \"\"\"Calculate a sidereal time using a IAU precession/nutation model.\"\"\"\n\n        from ..coordinates import Longitude\n\n        erfa_function = model['function']\n        erfa_parameters = [getattr(getattr(self, scale)._time, jd_part)\n                           for scale in model['scales']\n                           for jd_part in ('jd1', 'jd2')]\n\n        sidereal_time = erfa_function(*erfa_parameters)\n\n        return Longitude(sidereal_time, u.radian).to(u.hourangle)\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):\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)\n\n    def _apply(self, method, *args, format=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__(self.__class__)\n        tm._time = TimeJD(jd1, jd2, self.scale, self.precision,\n                          self.in_subfmt, self.out_subfmt, from_jd=True)\n        # Optional ndarray attributes.\n        for attr in ('_delta_ut1_utc', '_delta_tdb_tt', 'location',\n                     'precision', 'in_subfmt', 'out_subfmt'):\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 a single element and the method would return a view,\n                # since in that case nothing would change).\n                if getattr(val, 'size', 1) > 1:\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.\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('format must be one of {0}'\n                             .format(list(tm.FORMATS)))\n\n        NewFormat = tm.FORMATS[new_format]\n        tm._time = NewFormat(tm._time.jd1, tm._time.jd2,\n                             tm._time._scale, tm.precision,\n                             tm.in_subfmt, tm.out_subfmt,\n                             from_jd=True)\n        tm._format = new_format\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        return [(indices if i == axis else np.arange(s).reshape(\n            (1,)*(i if keepdims or i < axis else i-1) + (s,) +\n            (1,)*(ndim-i-(1 if keepdims or i > axis else 2))))\n                for i, s in enumerate(self.shape)]\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        jd = self.jd1 + self.jd2\n        approx = jd.min(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 = (self.jd1 - approx) + self.jd2\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        jd = self.jd1 + self.jd2\n        approx = jd.max(axis, keepdims=True)\n\n        dt = (self.jd1 - approx) + self.jd2\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        jd_approx = self.jd\n        jd_remainder = (self - self.__class__(jd_approx, format='jd')).jd\n        if axis is None:\n            return np.lexsort((jd_remainder.ravel(), jd_approx.ravel()))\n        else:\n            return np.lexsort(keys=(jd_remainder, jd_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    @lazyproperty\n    def cache(self):\n        \"\"\"\n        Return the cache associated with this instance.\n        \"\"\"\n        return defaultdict(dict)\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                cache[attr] = tm\n            return cache[attr]\n\n        elif attr in self.FORMATS:\n            cache = self.cache['format']\n            if attr not in cache:\n                if attr == self.format:\n                    tm = self\n                else:\n                    tm = self.replicate(format=attr)\n                value = tm._shaped_like_input(tm._time.to_value(parent=tm))\n                cache[attr] = value\n            return cache[attr]\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 {0} with scale \"\n                                      \"'{1}' to scale '{2}'\"\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 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`` table, optional\n            Table containing UT1-UTC differences from IERS Bulletins A\n            and/or B.  If `None`, use default version (see\n            ``astropy.utils.iers``)\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)\n            >>> status == TIME_BEFORE_IERS_RANGE\n            array([ True, False]...)\n        \"\"\"\n        if iers_table is None:\n            from ..utils.iers import IERS\n            iers_table = IERS.open()\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 ..utils.iers import IERS_Auto\n            iers_table = IERS_Auto.open()\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.jd1, self_utc.jd2\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)\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        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        del self.cache\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\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                from ..coordinates import EarthLocation\n                location = EarthLocation.from_geodetic(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        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        del self.cache\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        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\n\n        # Tdelta - something is dealt with in TimeDelta, so we have\n        # T      - Tdelta = T\n        # T      - T      = Tdelta\n        other_is_delta = isinstance(other, TimeDelta)\n\n        # we need a constant scale to calculate, which is guaranteed for\n        # TimeDelta, but not for Time (which can be UTC)\n        if other_is_delta:  # T - Tdelta\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                out._set_scale(other.scale if other.scale is not None\n                               else 'tai')\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            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        if not isinstance(other, Time):\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\n\n        # Tdelta + something is dealt with in TimeDelta, so we have\n        # T      + Tdelta = T\n        # T      + T      = error\n\n        if not isinstance(other, TimeDelta):\n            raise OperandTypeError(self, other, '+')\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            out._set_scale(other.scale if other.scale is not None else 'tai')\n\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    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 _time_difference(self, other, op=None):\n        \"\"\"If other is of same class as self, return difference in self.scale.\n        Otherwise, raise OperandTypeError.\n        \"\"\"\n        if other.__class__ is not self.__class__:\n            try:\n                other = self.__class__(other, scale=self.scale)\n            except Exception:\n                raise OperandTypeError(self, other, op)\n\n        if(self.scale is not None and self.scale not in other.SCALES or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot compare TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".format(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 (self.jd1 - other.jd1) + (self.jd2 - other.jd2)\n\n    def __lt__(self, other):\n        return self._time_difference(other, '<') < 0.\n\n    def __le__(self, other):\n        return self._time_difference(other, '<=') <= 0.\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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return False\n        return diff == 0.\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        try:\n            diff = self._time_difference(other)\n        except OperandTypeError:\n            return True\n        return diff != 0.\n\n    def __gt__(self, other):\n        return self._time_difference(other, '>') > 0.\n\n    def __ge__(self, other):\n        return self._time_difference(other, '>=') >= 0.\n\n    def to_datetime(self, timezone=None):\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 TimeDelta(Time):\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']\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    Parameters\n    ----------\n    val : sequence, ndarray, number, or `~astropy.time.TimeDelta` object\n        Value(s) to initialize the time difference(s).\n    val2 : numpy ndarray, list, str, or number; optional\n        Additional values, as needed to 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 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 __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            if format is None:\n                try:\n                    val = val.to(u.day)\n                    if val2 is not None:\n                        val2 = val2.to(u.day)\n                except Exception:\n                    raise ValueError('Only Quantities with Time units can '\n                                     'be used to initiate {0} instances .'\n                                     .format(self.__class__.__name__))\n                format = 'jd'\n\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    def replicate(self, *args, **kwargs):\n        out = super().replicate(*args, **kwargs)\n        out.SCALES = self.SCALES\n        return out\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 {0!r} is not in the allowed scales {1}\"\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__(self, other):\n        # only deal with TimeDelta + TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                return other.__add__(self)\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '+')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot add TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 + other._time.jd1\n        jd2 = 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 __sub__(self, other):\n        # only deal with TimeDelta - TimeDelta\n        if isinstance(other, Time):\n            if not isinstance(other, TimeDelta):\n                raise OperandTypeError(self, other, '-')\n        else:\n            try:\n                other = TimeDelta(other)\n            except Exception:\n                raise OperandTypeError(self, other, '-')\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 or\n           other.scale is not None and other.scale not in self.SCALES):\n            raise TypeError(\"Cannot subtract TimeDelta instances with scales \"\n                            \"'{0}' and '{1}'\".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 = self._time.jd1 - other._time.jd1\n        jd2 = 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 __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\n        try:   # convert to straight float if dimensionless quantity\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:\n            jd1, jd2 = day_frac(self.jd1, self.jd2, factor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) * other\n            except Exception:\n                raise err\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 __div__(self, other):\n        \"\"\"Division of `TimeDelta` objects by numbers/arrays.\"\"\"\n        return self.__truediv__(other)\n\n    def __rdiv__(self, other):\n        \"\"\"Division by `TimeDelta` objects of numbers/arrays.\"\"\"\n        return self.__rtruediv__(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        try:\n            other = other.to(1)\n        except Exception:\n            pass\n\n        try:   # convert to straight float if dimensionless quantity\n            jd1, jd2 = day_frac(self.jd1, self.jd2, divisor=other)\n            out = TimeDelta(jd1, jd2, format='jd', scale=self.scale)\n        except Exception as err:  # try downgrading self to a quantity\n            try:\n                return self.to(u.day) / other\n            except Exception:\n                raise err\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        return other / self.to(u.day)\n\n    def to(self, *args, **kwargs):\n        return u.Quantity(self._time.jd1 + self._time.jd2,\n                          u.day).to(*args, **kwargs)\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    val = np.array(val, copy=copy, subok=True)\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 not (val.dtype == np.float64 or val.dtype.kind in 'OSUa'):\n        val = np.asanyarray(val, dtype=np.float64)\n\n    return val\n\n\nclass OperandTypeError(TypeError):\n    def __init__(self, left, right, op=None):\n        op_string = '' if op is None else ' for {0}'.format(op)\n        super().__init__(\n            \"Unsupported operand type(s){0}: \"\n            \"'{1}' and '{2}'\".format(op_string,\n                                     left.__class__.__name__,\n                                     right.__class__.__name__))\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":468,"id":6204,"name":"__doc__","nodeType":"Attribute","startLoc":468,"text":"bind_receive_response.__doc__"},{"col":4,"comment":"null","endLoc":236,"header":"@property\n    def value(self)","id":6205,"name":"value","nodeType":"Function","startLoc":234,"text":"@property\n    def value(self):\n        return self.jd1 + self.jd2"},{"attributeType":"null","col":4,"comment":"null","endLoc":228,"id":6206,"name":"name","nodeType":"Attribute","startLoc":228,"text":"name"},{"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":468,"id":6207,"nodeType":"Class","startLoc":464,"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":8,"comment":"null","endLoc":232,"id":6208,"name":"jd1","nodeType":"Attribute","startLoc":232,"text":"self.jd1"},{"className":"UnitsError","col":0,"comment":"\n    The base class for unit-specific exceptions.\n    ","endLoc":453,"id":6209,"nodeType":"Class","startLoc":450,"text":"class UnitsError(Exception):\n    \"\"\"\n    The base class for unit-specific exceptions.\n    \"\"\""},{"attributeType":"None","col":8,"comment":"null","endLoc":144,"id":6210,"name":"client","nodeType":"Attribute","startLoc":144,"text":"self.client"},{"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    @override__dir__\n    def __dir__(self):\n        return ['special_method1', 'special_method2']\n    ","endLoc":62,"header":"def override__dir__(f)","id":6211,"name":"override__dir__","nodeType":"Function","startLoc":39,"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    @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":4,"comment":"null","endLoc":473,"id":6212,"name":"__doc__","nodeType":"Attribute","startLoc":473,"text":"unbind_receive_notification.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":478,"id":6213,"name":"__doc__","nodeType":"Attribute","startLoc":478,"text":"unbind_receive_call.__doc__"},{"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.0\n    median = 2.5\n    max = 4.0\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":148,"header":"def data_info_factory(names, funcs)","id":6214,"name":"data_info_factory","nodeType":"Function","startLoc":103,"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.0\n    median = 2.5\n    max = 4.0\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                outs.append(str(out))\n\n        return OrderedDict(zip(names, outs))\n    return func"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":6215,"name":"_is_registered","nodeType":"Attribute","startLoc":128,"text":"self._is_registered"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":6216,"name":"_response_bindings","nodeType":"Attribute","startLoc":151,"text":"self._response_bindings"},{"attributeType":"null","col":18,"comment":"null","endLoc":232,"id":6217,"name":"jd2","nodeType":"Attribute","startLoc":232,"text":"self.jd2"},{"attributeType":"null","col":4,"comment":"null","endLoc":483,"id":6218,"name":"__doc__","nodeType":"Attribute","startLoc":483,"text":"unbind_receive_response.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":6219,"name":"_metadata","nodeType":"Attribute","startLoc":139,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":6220,"name":"_call_bindings","nodeType":"Attribute","startLoc":149,"text":"self._call_bindings"},{"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":259,"id":6221,"nodeType":"Class","startLoc":239,"text":"class TimeMJD(TimeFormat):\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        # TODO - this routine and vals should be Cythonized to follow the ERFA\n        # convention of preserving precision by adding to the larger of the two\n        # values in a vectorized operation.  But in most practical cases the\n        # first one is probably biggest.\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    @property\n    def value(self):\n        return (self.jd1 - erfa.DJM0) + self.jd2"},{"col":4,"comment":"null","endLoc":255,"header":"def set_jds(self, val1, val2)","id":6222,"name":"set_jds","nodeType":"Function","startLoc":247,"text":"def set_jds(self, val1, val2):\n        # TODO - this routine and vals should be Cythonized to follow the ERFA\n        # convention of preserving precision by adding to the larger of the two\n        # values in a vectorized operation.  But in most practical cases the\n        # first one is probably biggest.\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)"},{"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":265,"id":6223,"nodeType":"Class","startLoc":214,"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":4,"comment":"null","endLoc":250,"header":"def __init__(self, name=None, description=None, metadata=None,\n                 callable=True)","id":6224,"name":"__init__","nodeType":"Function","startLoc":244,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":6225,"name":"TIME_FORMATS","nodeType":"Attribute","startLoc":32,"text":"TIME_FORMATS"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":6226,"name":"TIME_DELTA_FORMATS","nodeType":"Attribute","startLoc":33,"text":"TIME_DELTA_FORMATS"},{"attributeType":"null","col":4,"comment":"null","endLoc":488,"id":6227,"name":"__doc__","nodeType":"Attribute","startLoc":488,"text":"declare_subscriptions.__doc__"},{"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":489,"id":6228,"nodeType":"Class","startLoc":484,"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":527,"id":6229,"nodeType":"Class","startLoc":492,"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 {0} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\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        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\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":527,"header":"def __new__(cls, val1, val2, scale, precision,\n                in_subfmt, out_subfmt, from_jd=False)","id":6230,"name":"__new__","nodeType":"Function","startLoc":501,"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 {0} class must all be same '\n                            'astropy Time type.'.format(cls.name))\n\n        if scale is None:\n            scale = val1_0.scale\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        else:\n            val = getattr(val1_0, scale)._time\n            jd1, jd2 = val.jd1, val.jd2\n\n        OutTimeFormat = val1_0._time.__class__\n        self = OutTimeFormat(jd1, jd2, scale, precision, in_subfmt, out_subfmt,\n                             from_jd=True)\n\n        return self"},{"col":4,"comment":"null","endLoc":259,"header":"@property\n    def value(self)","id":6231,"name":"value","nodeType":"Function","startLoc":257,"text":"@property\n    def value(self):\n        return (self.jd1 - erfa.DJM0) + self.jd2"},{"attributeType":"null","col":4,"comment":"null","endLoc":245,"id":6232,"name":"name","nodeType":"Attribute","startLoc":245,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":255,"id":6233,"name":"jd1","nodeType":"Attribute","startLoc":255,"text":"self.jd1"},{"attributeType":"null","col":4,"comment":"null","endLoc":493,"id":6234,"name":"__doc__","nodeType":"Attribute","startLoc":493,"text":"get_private_key.__doc__"},{"attributeType":"null","col":18,"comment":"null","endLoc":255,"id":6235,"name":"jd2","nodeType":"Attribute","startLoc":255,"text":"self.jd2"},{"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":265,"header":"def connect(self, pool_size=20, web_port=21012)","id":6236,"name":"connect","nodeType":"Function","startLoc":252,"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()"},{"attributeType":"null","col":4,"comment":"null","endLoc":498,"id":6237,"name":"__doc__","nodeType":"Attribute","startLoc":498,"text":"get_public_id.__doc__"},{"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":324,"id":6238,"nodeType":"Class","startLoc":262,"text":"class TimeDecimalYear(TimeFormat):\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    @property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2)\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\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 decimalyear"},{"col":4,"comment":"null","endLoc":299,"header":"def set_jds(self, val1, val2)","id":6239,"name":"set_jds","nodeType":"Function","startLoc":270,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":499,"id":6240,"name":"name","nodeType":"Attribute","startLoc":499,"text":"name"},{"attributeType":"SAMPHubProxy","col":8,"comment":"null","endLoc":50,"id":6241,"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":6242,"name":"client_arguments","nodeType":"Attribute","startLoc":52,"text":"self.client_arguments"},{"attributeType":"null","col":12,"comment":"null","endLoc":520,"id":6243,"name":"val","nodeType":"Attribute","startLoc":520,"text":"val"},{"attributeType":"null","col":8,"comment":"null","endLoc":507,"id":6244,"name":"val1_0","nodeType":"Attribute","startLoc":507,"text":"val1_0"},{"attributeType":"null","col":12,"comment":"null","endLoc":516,"id":6245,"name":"vals","nodeType":"Attribute","startLoc":516,"text":"vals"},{"attributeType":"null","col":12,"comment":"null","endLoc":521,"id":6246,"name":"jd1","nodeType":"Attribute","startLoc":521,"text":"jd1"},{"attributeType":"None","col":8,"comment":"The client will be instantiated upon connect().","endLoc":67,"id":6247,"name":"client","nodeType":"Attribute","startLoc":67,"text":"self.client"},{"col":4,"comment":"null","endLoc":3110,"header":"def _add_param(self, iterator, tag, data, config, pos)","id":6248,"name":"_add_param","nodeType":"Function","startLoc":3107,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":6249,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":6250,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":9,"text":"__doctest_skip__"},{"attributeType":"null","col":8,"comment":"null","endLoc":523,"id":6251,"name":"OutTimeFormat","nodeType":"Attribute","startLoc":523,"text":"OutTimeFormat"},{"attributeType":"null","col":12,"comment":"null","endLoc":514,"id":6252,"name":"scale","nodeType":"Attribute","startLoc":514,"text":"scale"},{"col":0,"comment":"","endLoc":4,"header":"integrated_client.py#<anonymous>","id":6253,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPIntegratedClient']\n\n__doctest_skip__ = ['SAMPIntegratedClient.*']"},{"attributeType":"null","col":17,"comment":"null","endLoc":521,"id":6254,"name":"jd2","nodeType":"Attribute","startLoc":521,"text":"jd2"},{"attributeType":"null","col":8,"comment":"null","endLoc":524,"id":6255,"name":"self","nodeType":"Attribute","startLoc":524,"text":"self"},{"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":623,"id":6256,"nodeType":"Class","startLoc":530,"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        # Note: don't care about val2 for this class\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {0} class must be '\n                            'datetime objects'.format(self.name))\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'],\n                             op_dtypes=[object] + 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):\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 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)\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok'],\n                             op_dtypes=7*[iys.dtype] + [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        return iterator.operands[-1]\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":551,"header":"def _check_val_type(self, val1, val2)","id":6257,"name":"_check_val_type","nodeType":"Function","startLoc":546,"text":"def _check_val_type(self, val1, val2):\n        # Note: don't care about val2 for this class\n        if not all(isinstance(val, datetime.datetime) for val in val1.flat):\n            raise TypeError('Input values for {0} class must be '\n                            'datetime objects'.format(self.name))\n        return val1, None"},{"col":4,"comment":"Convert datetime object contained in val1 to jd1, jd2","endLoc":574,"header":"def set_jds(self, val1, val2)","id":6258,"name":"set_jds","nodeType":"Function","startLoc":553,"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'],\n                             op_dtypes=[object] + 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)"},{"id":6259,"name":"astropy/time/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/time/tests","id":6260,"nodeType":"File","text":""},{"id":6261,"name":"astropy/_erfa","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/_erfa","id":6262,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport glob\n\nfrom distutils import log\nfrom distutils.extension import Extension\n\nfrom astropy_helpers import setup_helpers\nfrom astropy_helpers.version_helpers import get_pkg_version_module\n\nERFAPKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nERFA_SRC = os.path.abspath(os.path.join(ERFAPKGDIR, '..', '..', 'cextern', 'erfa'))\n\nSRC_FILES = glob.glob(os.path.join(ERFA_SRC, '*'))\nSRC_FILES += [os.path.join(ERFAPKGDIR, filename)\n              for filename in ['core.py.templ', 'core.c.templ', 'erfa_generator.py']]\n\nGEN_FILES = [os.path.join(ERFAPKGDIR, 'core.py'), os.path.join(ERFAPKGDIR, 'core.c')]\n\n\ndef pre_build_py_hook(cmd_obj):\n    preprocess_source()\n\n\ndef pre_build_ext_hook(cmd_obj):\n    preprocess_source()\n\n\ndef pre_sdist_hook(cmd_obj):\n    preprocess_source()\n\n\ndef preprocess_source():\n    # Generating the ERFA wrappers should only be done if needed. This also\n    # ensures that it is not done for any release tarball since those will\n    # include core.py and core.c.\n    if all(os.path.exists(filename) for filename in GEN_FILES):\n\n        # Determine modification times\n        erfa_mtime = max(os.path.getmtime(filename) for filename in SRC_FILES)\n        gen_mtime = min(os.path.getmtime(filename) for filename in GEN_FILES)\n\n        version = get_pkg_version_module('astropy')\n\n        if gen_mtime > erfa_mtime:\n            # If generated source is recent enough, don't update\n            return\n        elif version.release:\n            # or, if we're on a release, issue a warning, but go ahead and use\n            # the wrappers anyway\n            log.warn('WARNING: The autogenerated wrappers in astropy._erfa '\n                     'seem to be older than the source templates used to '\n                     'create them. Because this is a release version we will '\n                     'use them anyway, but this might be a sign of some sort '\n                     'of version mismatch or other tampering. Or it might just '\n                     'mean you moved some files around or otherwise '\n                     'accidentally changed timestamps.')\n            return\n        # otherwise rebuild the autogenerated files\n\n        # If jinja2 isn't present, then print a warning and use existing files\n        try:\n            import jinja2  # pylint: disable=W0611\n        except ImportError:\n            log.warn(\"WARNING: jinja2 could not be imported, so the existing \"\n                     \"ERFA core.py and core.c files will be used\")\n            return\n\n    name = 'erfa_generator'\n    filename = os.path.join(ERFAPKGDIR, 'erfa_generator.py')\n\n    try:\n        from importlib import machinery as import_machinery\n        loader = import_machinery.SourceFileLoader(name, filename)\n        gen = loader.load_module()\n    except ImportError:\n        import imp\n        gen = imp.load_source(name, filename)\n\n    gen.main(gen.DEFAULT_ERFA_LOC,\n             os.path.join(ERFAPKGDIR, 'core.py'),\n             gen.DEFAULT_TEMPLATE_LOC,\n             verbose=False)\n\n\ndef get_extensions():\n    sources = [os.path.join(ERFAPKGDIR, \"core.c\")]\n    include_dirs = ['numpy']\n    libraries = []\n\n    if setup_helpers.use_system_library('erfa'):\n        libraries.append('erfa')\n    else:\n        # get all of the .c files in the cextern/erfa directory\n        erfafns = os.listdir(ERFA_SRC)\n        sources.extend(['cextern/erfa/'+fn for fn in erfafns if fn.endswith('.c')])\n\n        include_dirs.append('cextern/erfa')\n\n    erfa_ext = Extension(\n        name=\"astropy._erfa._core\",\n        sources=sources,\n        include_dirs=include_dirs,\n        libraries=libraries,\n        language=\"c\",)\n\n    return [erfa_ext]\n\n\ndef get_external_libraries():\n    return ['erfa']\n"},{"col":0,"comment":"null","endLoc":24,"header":"def pre_build_py_hook(cmd_obj)","id":6263,"name":"pre_build_py_hook","nodeType":"Function","startLoc":23,"text":"def pre_build_py_hook(cmd_obj):\n    preprocess_source()"},{"col":0,"comment":"null","endLoc":85,"header":"def preprocess_source()","id":6264,"name":"preprocess_source","nodeType":"Function","startLoc":35,"text":"def preprocess_source():\n    # Generating the ERFA wrappers should only be done if needed. This also\n    # ensures that it is not done for any release tarball since those will\n    # include core.py and core.c.\n    if all(os.path.exists(filename) for filename in GEN_FILES):\n\n        # Determine modification times\n        erfa_mtime = max(os.path.getmtime(filename) for filename in SRC_FILES)\n        gen_mtime = min(os.path.getmtime(filename) for filename in GEN_FILES)\n\n        version = get_pkg_version_module('astropy')\n\n        if gen_mtime > erfa_mtime:\n            # If generated source is recent enough, don't update\n            return\n        elif version.release:\n            # or, if we're on a release, issue a warning, but go ahead and use\n            # the wrappers anyway\n            log.warn('WARNING: The autogenerated wrappers in astropy._erfa '\n                     'seem to be older than the source templates used to '\n                     'create them. Because this is a release version we will '\n                     'use them anyway, but this might be a sign of some sort '\n                     'of version mismatch or other tampering. Or it might just '\n                     'mean you moved some files around or otherwise '\n                     'accidentally changed timestamps.')\n            return\n        # otherwise rebuild the autogenerated files\n\n        # If jinja2 isn't present, then print a warning and use existing files\n        try:\n            import jinja2  # pylint: disable=W0611\n        except ImportError:\n            log.warn(\"WARNING: jinja2 could not be imported, so the existing \"\n                     \"ERFA core.py and core.c files will be used\")\n            return\n\n    name = 'erfa_generator'\n    filename = os.path.join(ERFAPKGDIR, 'erfa_generator.py')\n\n    try:\n        from importlib import machinery as import_machinery\n        loader = import_machinery.SourceFileLoader(name, filename)\n        gen = loader.load_module()\n    except ImportError:\n        import imp\n        gen = imp.load_source(name, filename)\n\n    gen.main(gen.DEFAULT_ERFA_LOC,\n             os.path.join(ERFAPKGDIR, 'core.py'),\n             gen.DEFAULT_TEMPLATE_LOC,\n             verbose=False)"},{"col":4,"comment":"null","endLoc":3115,"header":"def _add_coosys(self, iterator, tag, data, config, pos)","id":6265,"name":"_add_coosys","nodeType":"Function","startLoc":3112,"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":0,"comment":"null","endLoc":28,"header":"def pre_build_ext_hook(cmd_obj)","id":6266,"name":"pre_build_ext_hook","nodeType":"Function","startLoc":27,"text":"def pre_build_ext_hook(cmd_obj):\n    preprocess_source()"},{"col":0,"comment":"null","endLoc":32,"header":"def pre_sdist_hook(cmd_obj)","id":6267,"name":"pre_sdist_hook","nodeType":"Function","startLoc":31,"text":"def pre_sdist_hook(cmd_obj):\n    preprocess_source()"},{"col":0,"comment":"null","endLoc":109,"header":"def get_extensions()","id":6268,"name":"get_extensions","nodeType":"Function","startLoc":88,"text":"def get_extensions():\n    sources = [os.path.join(ERFAPKGDIR, \"core.c\")]\n    include_dirs = ['numpy']\n    libraries = []\n\n    if setup_helpers.use_system_library('erfa'):\n        libraries.append('erfa')\n    else:\n        # get all of the .c files in the cextern/erfa directory\n        erfafns = os.listdir(ERFA_SRC)\n        sources.extend(['cextern/erfa/'+fn for fn in erfafns if fn.endswith('.c')])\n\n        include_dirs.append('cextern/erfa')\n\n    erfa_ext = Extension(\n        name=\"astropy._erfa._core\",\n        sources=sources,\n        include_dirs=include_dirs,\n        libraries=libraries,\n        language=\"c\",)\n\n    return [erfa_ext]"},{"attributeType":"SAMPWebHubProxy","col":8,"comment":"null","endLoc":247,"id":6269,"name":"hub","nodeType":"Attribute","startLoc":247,"text":"self.hub"},{"attributeType":"SAMPWebClient","col":8,"comment":"null","endLoc":249,"id":6270,"name":"client","nodeType":"Attribute","startLoc":249,"text":"self.client"},{"attributeType":"null","col":24,"comment":"null","endLoc":3,"id":6271,"name":"xmlrpc","nodeType":"Attribute","startLoc":3,"text":"xmlrpc"},{"id":6272,"name":"core.py.templ","nodeType":"TextFile","path":"astropy/_erfa","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# \"core.py\" is auto-generated by erfa_generator.py from the template\n# \"core.py.templ\". Do *not* edit \"core.py\" directly, instead edit\n# \"core.py.templ\" and run erfa_generator.py from the source directory to\n# update it.\n\n\"\"\"\nThis module uses the Python/C API to wrap the ERFA library in\nnumpy-vectorized equivalents.\n\n..warning::\n    This is currently *not* part of the public Astropy API, and may change in\n    the future.\n\n\nThe key idea is that any function can be called with inputs that are arrays,\nand the wrappers will automatically vectorize and call the ERFA functions for\neach item using broadcasting rules for numpy.  So the return values are always\nnumpy arrays of some sort.\n\nFor ERFA functions that take/return vectors or matrices, the vector/matrix\ndimension(s) are always the *last* dimension(s).  For example, if you\nwant to give ten matrices (i.e., the ERFA input type is double[3][3]),\nyou would pass in a (10, 3, 3) numpy array.  If the output of the ERFA\nfunction is scalar, you'll get back a length-10 1D array.\n\nNote that the C part of these functions are implemented in a separate\nmodule (compiled as ``_core``), derived from the ``core.c`` file.\nSplitting the wrappers into separate pure-python and C portions\ndramatically reduces compilation time without notably impacting\nperformance. (See issue [#3063] on the github repository for more\nabout this.)\n\"\"\"\n\nimport warnings\n\nfrom ..utils.exceptions import AstropyUserWarning\n\nimport numpy\nfrom . import _core\n\n# TODO: remove the above variable and the code using it and make_outputs_scalar\n# when numpy < 1.8 is no longer supported\n\n__all__ = ['ErfaError', 'ErfaWarning',\n           {{ funcs|map(attribute='pyname')|surround(\"'\",\"'\")|join(\", \") }},\n           {{ constants|map(attribute='name')|surround(\"'\",\"'\")|join(\", \") }},\n           # TODO: delete the functions below when they can get auto-generated\n           'version', 'version_major', 'version_minor', 'version_micro', 'sofa_version',\n           'dt_eraASTROM', 'dt_eraLDBODY']\n\n\n# <---------------------------------Error-handling---------------------------->\n\nclass ErfaError(ValueError):\n    \"\"\"\n    A class for errors triggered by ERFA functions (status codes < 0)\n    \"\"\"\n\n\nclass ErfaWarning(AstropyUserWarning):\n    \"\"\"\n    A class for warnings triggered by ERFA functions (status codes > 0)\n    \"\"\"\n\n\nSTATUS_CODES = {}  # populated below before each function that returns an int\n\n# This is a hard-coded list of status codes that need to be remapped,\n# such as to turn errors into warnings.\nSTATUS_CODES_REMAP = {\n    'cal2jd': {-3: 3}\n}\n\n\ndef check_errwarn(statcodes, func_name):\n    # Remap any errors into warnings in the STATUS_CODES_REMAP dict.\n    if func_name in STATUS_CODES_REMAP:\n        for before, after in STATUS_CODES_REMAP[func_name].items():\n            statcodes[statcodes == before] = after\n            STATUS_CODES[func_name][after] = STATUS_CODES[func_name][before]\n\n    if numpy.any(statcodes<0):\n        # errors present - only report the errors.\n        if statcodes.shape:\n            statcodes = statcodes[statcodes<0]\n\n        errcodes = numpy.unique(statcodes)\n\n        errcounts = dict([(e, numpy.sum(statcodes==e)) for e in errcodes])\n\n        elsemsg = STATUS_CODES[func_name].get('else', None)\n        if elsemsg is None:\n            errmsgs = dict([(e, STATUS_CODES[func_name].get(e, 'Return code ' + str(e))) for e in errcodes])\n        else:\n            errmsgs = dict([(e, STATUS_CODES[func_name].get(e, elsemsg)) for e in errcodes])\n\n        emsg = ', '.join(['{0} of \"{1}\"'.format(errcounts[e], errmsgs[e]) for e in errcodes])\n        raise ErfaError('ERFA function \"' + func_name + '\" yielded ' + emsg)\n\n    elif numpy.any(statcodes>0):\n        #only warnings present\n        if statcodes.shape:\n            statcodes = statcodes[statcodes>0]\n\n        warncodes = numpy.unique(statcodes)\n\n        warncounts = dict([(w, numpy.sum(statcodes==w)) for w in warncodes])\n\n        elsemsg = STATUS_CODES[func_name].get('else', None)\n        if elsemsg is None:\n            warnmsgs = dict([(w, STATUS_CODES[func_name].get(w, 'Return code ' + str(w))) for w in warncodes])\n        else:\n            warnmsgs = dict([(w, STATUS_CODES[func_name].get(w, elsemsg)) for w in warncodes])\n\n        wmsg = ', '.join(['{0} of \"{1}\"'.format(warncounts[w], warnmsgs[w]) for w in warncodes])\n        warnings.warn('ERFA function \"' + func_name + '\" yielded ' + wmsg, ErfaWarning)\n\n\n# <-------------------------trailing shape verification----------------------->\n\ndef check_trailing_shape(arr, shape, name):\n    try:\n        if arr.shape[-len(shape):] != shape:\n            raise Exception()\n    except:\n        raise ValueError(\"{0} must be of trailing dimensions {1}\".format(name, shape))\n\n# <--------------------------Actual ERFA-wrapping code------------------------>\n\ndt_eraASTROM = numpy.dtype([('pmt','d'),\n                         ('eb','d',(3,)),\n                         ('eh','d',(3,)),\n                         ('em','d'),\n                         ('v','d',(3,)),\n                         ('bm1','d'),\n                         ('bpn','d',(3,3)),\n                         ('along','d'),\n                         ('phi','d'),\n                         ('xpl','d'),\n                         ('ypl','d'),\n                         ('sphi','d'),\n                         ('cphi','d'),\n                         ('diurab','d'),\n                         ('eral','d'),\n                         ('refa','d'),\n                         ('refb','d')], align=True)\n\ndt_eraLDBODY = numpy.dtype([('bm','d'),\n                         ('dl','d'),\n                         ('pv','d',(2,3))], align=True)\n\n\n{% for constant in constants %}\n{{ constant.name }} = {{ constant.value }}\n\"\"\"{{ constant.doc|join(' ') }}\"\"\"\n{%- endfor %}\n\n{% for func in funcs %}\ndef {{ func.pyname }}({{ func.args_by_inout('in|inout')|map(attribute='name')|join(', ') }}):\n    \"\"\"\n    Wrapper for ERFA function ``{{ func.name }}``.\n\n    Parameters\n    ----------\n    {%- for arg in func.args_by_inout('in|inout') %}\n    {{ arg.name }} : {{ arg.ctype }} array\n    {%- endfor %}\n\n    Returns\n    -------\n    {%- for arg in func.args_by_inout('inout|out|ret') %}\n    {{ arg.name }} : {{ arg.ctype }} array\n    {%- endfor %}\n\n    Notes\n    -----\n    The ERFA documentation is below.\n\n{{ func.doc }}\n    \"\"\"\n\n    #Turn all inputs into arrays\n    {%- for arg in func.args_by_inout('in|inout') %}\n    {{ arg.name }}_in = numpy.array({{ arg.name }}, dtype={{ arg.dtype }}, order=\"C\", copy=False, subok=True)\n    {%- endfor %}\n    {%- for arg in func.args_by_inout('in|inout') %}\n    {%- if arg.ndim > 0 %}\n    check_trailing_shape({{ arg.name }}_in, {{ arg.shape }}, \"{{arg.name}}\")\n    {%- endif %}\n    {%- endfor %}\n\n    {%- if func.args_by_inout('in|inout') %}\n    make_outputs_scalar = False\n    {%- endif %}\n\n    #Create the output array, based on the broadcasted shape, adding the generated dimensions if needed\n    broadcast = numpy.broadcast(numpy.int32(0.0), numpy.int32(0.0), {{ func.args_by_inout('in|inout')|map(attribute='name_in_broadcast')|join(', ') }})\n    {%- for arg in func.args_by_inout('inout|out|ret|stat') %}\n    {{ arg.name }}_out = numpy.empty(broadcast.shape + {{ arg.shape }}, dtype={{ arg.dtype }})\n    {%- endfor %}\n    {%- for arg in func.args_by_inout('inout') %}\n    numpy.copyto({{ arg.name }}_out, {{ arg.name }}_in)\n    {%- endfor %}\n\n    #Create the iterator, broadcasting on all but the consumed dimensions\n    arrs = [{{ (func.args_by_inout('in')|map(attribute='name_in_broadcast')|list + func.args_by_inout('inout|out|ret|stat')|map(attribute='name_out_broadcast')|list)|join(', ') }}]\n    op_axes = [[-1]*(broadcast.nd-arr.ndim) + list(range(arr.ndim)) for arr in arrs]\n    op_flags = [['readonly']]*{{ func.args_by_inout('in')|count }} + [['readwrite']]*{{ func.args_by_inout('inout|out|ret|stat')|count }}\n    it = numpy.nditer(arrs, op_axes=op_axes, op_flags=op_flags)\n\n    #Iterate\n    stat_ok = _core._{{ func.pyname }}(it)\n\n    {%- for arg in func.args_by_inout('stat') %}\n\n    if not stat_ok:\n        check_errwarn({{ arg.name }}_out, '{{ func.pyname }}')\n    {%- endfor %}\n\n    {%- if func.args_by_inout('in|inout') %}\n    #need to convert the outputs back to scalars if all the inputs were scalars but we made them 1d\n    if make_outputs_scalar:\n        {%- for arg in func.args_by_inout('inout|out|ret') %}\n        assert len({{ arg.name }}_out.shape) > 0 and {{ arg.name }}_out.shape[0] == 1\n        {{ arg.name }}_out = {{ arg.name }}_out.reshape({{ arg.name }}_out.shape[1:])\n        {%- else %}\n        pass\n        {%- endfor %}\n    {%- endif %}\n\n    return {{ func.args_by_inout('inout|out|ret')|map(attribute='name')|postfix('_out')|join(', ') }}\n\n{%- for stat in func.args_by_inout('stat') %}\n{%- if stat.doc_info.statuscodes %}\nSTATUS_CODES['{{ func.pyname }}'] = {{ stat.doc_info.statuscodes|string }}\n{% endif %}\n{%- endfor %}\n\n{% endfor %}\n\n\n# TODO: delete the functions below when they can get auto-generated\n# (current machinery doesn't support returning strings or non-status-codes)\ndef version():\n    \"\"\"\n    Returns the package version\n    as defined in configure.ac\n    in string format\n    \"\"\"\n    return \"1.4.0\"\n\ndef version_major():\n    \"\"\"\n    Returns the package major version\n    as defined in configure.ac\n    as integer\n    \"\"\"\n    return 1\n\ndef version_minor():\n    \"\"\"\n    Returns the package minor version\n    as defined in configure.ac\n    as integer\n    \"\"\"\n    return 4\n\ndef version_micro():\n    \"\"\"\n    Returns the package micro version\n    as defined in configure.ac\n    as integer\n    \"\"\"\n    return 0\n\ndef sofa_version():\n    \"\"\"\n    Returns the corresponding SOFA version\n    as defined in configure.ac\n    in string format\n    \"\"\"\n    return \"20170420\"\n"},{"id":6273,"name":"core.c.templ","nodeType":"TextFile","path":"astropy/_erfa","text":"/* -*- mode: c -*- */\n\n/* Licensed under a 3-clause BSD style license - see LICENSE.rst */\n\n/* \"core.c\" is auto-generated by erfa_generator.py from the template\n   \"core.c.templ\". Do *not* edit \"core.c\" directly, instead edit\n   \"core.c.templ\" and run erfa_generator.py from the source directory to\n   update it. */\n\n\n#include <Python.h>\n#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#include <numpy/arrayobject.h>\n#include \"erfa.h\"\n\n\ntypedef struct {\n    PyObject_HEAD\n    NpyIter *iter;\n} _NpyIterObject;\n\n\n#define MODULE_DOCSTRING \\\n    \"This module contains the C part of the ERFA python wrappers.\\n\" \\\n    \"This implements only the inner iterator loops, while the heavy lifting\\n\" \\\n    \"happens in Python in core.py\\n\\n\" \\\n    \"For more about the module and how to use it, see the ``core.py``\\n\" \\\n    \"docstrings.\"\n\n\n{%- for func in funcs %}\n\nstatic PyObject *Py_{{ func.pyname }}(PyObject *self, PyObject *args, PyObject *kwds)\n{\n    {%- for arg in func.args_by_inout('in|inout|out') %}\n    {{ arg.ctype }} (*_{{ arg.name }}){{ arg.cshape }};\n    {%- endfor %}\n    {%- for arg in func.args_by_inout('ret|stat') %}\n    {{ arg.ctype_ptr }} _{{ arg.name }};\n    {%- endfor %}\n    {%- if func.args_by_inout('stat')|length > 0 %}\n    int stat_ok = 1;\n    {%- endif %}\n    NpyIter *it = ((_NpyIterObject *)args)->iter;\n    char **dataptrarray = NpyIter_GetDataPtrArray(it);\n    NpyIter_IterNextFunc *iternext = NpyIter_GetIterNext(it, NULL);\n\n    Py_BEGIN_ALLOW_THREADS\n\n    do {\n        {%- for arg in func.args_by_inout('in|inout|out') %}\n        _{{ arg.name }} = (({{ arg.ctype }} (*){{ arg.cshape }})(dataptrarray[{{ func.args.index(arg) }}]));\n        {%- endfor %}\n\n        {{ func.args_by_inout('ret|stat')|map(attribute='name')|surround('_', ' = ')|join }}{{func.name}}({{ func.args_by_inout('in|inout|out')|map(attribute='name_for_call')|join(', ') }});\n\n        {%- for arg in func.args_by_inout('ret|stat') %}\n        *(({{ arg.ctype_ptr }} *)(dataptrarray[{{ func.args.index(arg) }}])) = _{{ arg.name }};\n        {%- endfor %}\n\n        {%- for arg in func.args_by_inout('stat') %}\n        if (_{{ arg.name }}) {\n            stat_ok = 0;\n        }\n        {%- endfor %}\n    } while (iternext(it));\n\n    Py_END_ALLOW_THREADS\n\n    {%- if func.args_by_inout('stat')|length > 0 %}\n    if (stat_ok) {\n        Py_RETURN_TRUE;\n    } else {\n        Py_RETURN_FALSE;\n    }\n    {%- else %}\n    Py_RETURN_NONE;\n    {%- endif %}\n}\n\n{%- endfor %}\n\nstatic PyMethodDef module_functions[] = {\n    {%- for func in funcs %}\n    { \"_\" \"{{ func.pyname }}\", (PyCFunction)Py_{{ func.pyname }}, METH_O, NULL },\n    {%- endfor %}\n    { NULL }\n};\n\nstruct module_state\n{\n    int _dummy;\n};\n\n\nstatic struct PyModuleDef moduledef = {\n    PyModuleDef_HEAD_INIT,\n    \"_core\",\n    MODULE_DOCSTRING,\n    sizeof(struct module_state),\n    module_functions,\n    NULL,\n    NULL,\n    NULL,\n    NULL\n};\n\nPyMODINIT_FUNC PyInit__core(void)\n\n{\n    PyObject *m;\n\n    m = PyModule_Create(&moduledef);\n\n    if (m == NULL) {\n        return NULL;\n    }\n\n    import_array();\n\n    return m;\n}\n"},{"col":0,"comment":"null","endLoc":113,"header":"def get_external_libraries()","id":6274,"name":"get_external_libraries","nodeType":"Function","startLoc":112,"text":"def get_external_libraries():\n    return ['erfa']"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":6275,"name":"ERFAPKGDIR","nodeType":"Attribute","startLoc":12,"text":"ERFAPKGDIR"},{"fileName":"erfa_generator.py","filePath":"astropy/_erfa","id":6276,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module's main purpose is to act as a script to create new versions\nof erfa.c when ERFA is updated (or this generator is enhanced).\n\n`Jinja2 <http://jinja.pocoo.org/>`_ must be installed for this\nmodule/script to function.\n\nNote that this does *not* currently automate the process of creating structs\nor dtypes for those structs.  They should be added manually in the template file.\n\"\"\"\n# note that we do *not* use unicode_literals here, because that makes the\n# generated code's strings have u'' in them on py 2.x\n\nimport re\nimport os.path\nfrom collections import OrderedDict\n\n\nctype_to_dtype = {'double': \"numpy.double\",\n                  'int': \"numpy.intc\",\n                  'eraASTROM': \"dt_eraASTROM\",\n                  'eraLDBODY': \"dt_eraLDBODY\",\n                  'char': \"numpy.dtype('S1')\",\n                  'const char': \"numpy.dtype('S16')\",\n                  }\n\n\nNDIMS_REX = re.compile(re.escape(\"numpy.dtype([('fi0', '.*', <(.*)>)])\").replace(r'\\.\\*', '.*').replace(r'\\<', '(').replace(r'\\>', ')'))\n\n\nclass FunctionDoc:\n\n    def __init__(self, doc):\n        self.doc = doc.replace(\"**\", \"  \").replace(\"/*\\n\", \"\").replace(\"*/\", \"\")\n        self.__input = None\n        self.__output = None\n        self.__ret_info = None\n\n    @property\n    def input(self):\n        if self.__input is None:\n            self.__input = []\n            result = re.search(\"Given([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n        return self.__input\n\n    @property\n    def output(self):\n        if self.__output is None:\n            self.__output = []\n            result = re.search(\"Returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n        return self.__output\n\n    @property\n    def ret_info(self):\n        if self.__ret_info is None:\n            ret_info = []\n            result = re.search(\"Returned \\\\(function value\\\\)([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                ret_info.append(ReturnDoc(result.group(2)))\n\n            if len(ret_info) == 0:\n                self.__ret_info = ''\n            elif len(ret_info) == 1:\n                self.__ret_info = ret_info[0]\n            else:\n                raise ValueError(\"Multiple C return sections found in this doc:\\n\" + self.doc)\n\n        return self.__ret_info\n\n    def __repr__(self):\n        return self.doc.replace(\"  \\n\", \"\\n\")\n\n\nclass ArgumentDoc:\n\n    def __init__(self, doc):\n        match = re.search(\"^ +([^ ]+)[ ]+([^ ]+)[ ]+(.+)\", doc)\n        if match is not None:\n            self.name = match.group(1)\n            self.type = match.group(2)\n            self.doc = match.group(3)\n        else:\n            self.name = None\n            self.type = None\n            self.doc = None\n\n    def __repr__(self):\n        return \"    {0:15} {1:15} {2}\".format(self.name, self.type, self.doc)\n\n\nclass Argument:\n\n    def __init__(self, definition, doc):\n        self.doc = doc\n        self.__inout_state = None\n        self.ctype, ptr_name_arr = definition.strip().rsplit(\" \", 1)\n        if \"*\" == ptr_name_arr[0]:\n            self.is_ptr = True\n            name_arr = ptr_name_arr[1:]\n        else:\n            self.is_ptr = False\n            name_arr = ptr_name_arr\n        if \"[]\" in ptr_name_arr:\n            self.is_ptr = True\n            name_arr = name_arr[:-2]\n        if \"[\" in name_arr:\n            self.name, arr = name_arr.split(\"[\", 1)\n            self.shape = tuple([int(size) for size in arr[:-1].split(\"][\")])\n        else:\n            self.name = name_arr\n            self.shape = ()\n\n    @property\n    def inout_state(self):\n        if self.__inout_state is None:\n            self.__inout_state = ''\n            for i in self.doc.input:\n                if self.name in i.name.split(','):\n                    self.__inout_state = 'in'\n            for o in self.doc.output:\n                if self.name in o.name.split(','):\n                    if self.__inout_state == 'in':\n                        self.__inout_state = 'inout'\n                    else:\n                        self.__inout_state = 'out'\n        return self.__inout_state\n\n    @property\n    def ctype_ptr(self):\n        if (self.is_ptr) | (len(self.shape) > 0):\n            return self.ctype+\" *\"\n        else:\n            return self.ctype\n\n    @property\n    def name_in_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_in[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_in\".format(self.name)\n\n    @property\n    def name_out_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_out[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_out\".format(self.name)\n\n    @property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]\n\n    @property\n    def ndim(self):\n        return len(self.shape)\n\n    @property\n    def cshape(self):\n        return ''.join(['[{0}]'.format(s) for s in self.shape])\n\n    @property\n    def name_for_call(self):\n        if self.is_ptr:\n            return '_'+self.name\n        else:\n            return '*_'+self.name\n\n    def __repr__(self):\n        return \"Argument('{0}', name='{1}', ctype='{2}', inout_state='{3}')\".format(self.definition, self.name, self.ctype, self.inout_state)\n\n\nclass ReturnDoc:\n\n    def __init__(self, doc):\n        self.doc = doc\n\n        self.infoline = doc.split('\\n')[0].strip()\n        self.type = self.infoline.split()[0]\n        self.descr = self.infoline.split()[1]\n\n        if self.descr.startswith('status'):\n            self.statuscodes = statuscodes = {}\n\n            code = None\n            for line in doc[doc.index(':')+1:].split('\\n'):\n                ls = line.strip()\n                if ls != '':\n                    if ' = ' in ls:\n                        code, msg = ls.split(' = ')\n                        if code != 'else':\n                            code = int(code)\n                        statuscodes[code] = msg\n                    elif code is not None:\n                        statuscodes[code] += ls\n        else:\n            self.statuscodes = None\n\n    def __repr__(self):\n        return \"Return value, type={0:15}, {1}, {2}\".format(self.type, self.descr, self.doc)\n\n\nclass Return:\n\n    def __init__(self, ctype, doc):\n        self.name = 'c_retval'\n        self.name_out_broadcast = self.name+\"_out\"\n        self.inout_state = 'stat' if ctype == 'int' else 'ret'\n        self.ctype = ctype\n        self.ctype_ptr = ctype\n        self.shape = ()\n        self.doc = doc\n\n    def __repr__(self):\n        return \"Return(name='{0}', ctype='{1}', inout_state='{2}')\".format(self.name, self.ctype, self.inout_state)\n\n    @property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]\n\n    @property\n    def nd_dtype(self):\n        \"\"\"\n        This if the return type has a multi-dimensional output, like\n        double[3][3]\n        \"\"\"\n        return \"'fi0'\" in self.dtype\n\n    @property\n    def doc_info(self):\n        return self.doc.ret_info\n\n\nclass Function:\n    \"\"\"\n    A class representing a C function.\n\n    Parameters\n    ----------\n    name : str\n        The name of the function\n    source_path : str\n        Either a directory, which means look for the function in a\n        stand-alone file (like for the standard ERFA distribution), or a\n        file, which means look for the function in that file (as for the\n        astropy-packaged single-file erfa.c).\n    match_line : str, optional\n        If given, searching of the source file will skip until it finds\n        a line matching this string, and start from there.\n    \"\"\"\n\n    def __init__(self, name, source_path, match_line=None):\n        self.name = name\n        self.pyname = name.split('era')[-1].lower()\n        self.filename = self.pyname+\".c\"\n        if os.path.isdir(source_path):\n            self.filepath = os.path.join(os.path.normpath(source_path), self.filename)\n        else:\n            self.filepath = source_path\n\n        with open(self.filepath) as f:\n            if match_line:\n                line = f.readline()\n                while line != '':\n                    if line.startswith(match_line):\n                        filecontents = '\\n' + line + f.read()\n                        break\n                    line = f.readline()\n                else:\n                    msg = ('Could not find the match_line \"{0}\" in '\n                           'the source file \"{1}\"')\n                    raise ValueError(msg.format(match_line, self.filepath))\n            else:\n                filecontents = f.read()\n\n        pattern = r\"\\n([^\\n]+{0} ?\\([^)]+\\)).+?(/\\*.+?\\*/)\".format(name)\n        p = re.compile(pattern, flags=re.DOTALL | re.MULTILINE)\n\n        search = p.search(filecontents)\n        self.cfunc = \" \".join(search.group(1).split())\n        self.doc = FunctionDoc(search.group(2))\n\n        self.args = []\n        for arg in re.search(r\"\\(([^)]+)\\)\", self.cfunc).group(1).split(', '):\n            self.args.append(Argument(arg, self.doc))\n        self.ret = re.search(\"^(.*){0}\".format(name), self.cfunc).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))\n\n    def args_by_inout(self, inout_filter, prop=None, join=None):\n        \"\"\"\n        Gives all of the arguments and/or returned values, depending on whether\n        they are inputs, outputs, etc.\n\n        The value for `inout_filter` should be a string containing anything\n        that arguments' `inout_state` attribute produces.  Currently, that can be:\n\n          * \"in\" : input\n          * \"out\" : output\n          * \"inout\" : something that's could be input or output (e.g. a struct)\n          * \"ret\" : the return value of the C function\n          * \"stat\" : the return value of the C function if it is a status code\n\n        It can also be a \"|\"-separated string giving inout states to OR\n        together.\n        \"\"\"\n        result = []\n        for arg in self.args:\n            if arg.inout_state in inout_filter.split('|'):\n                if prop is None:\n                    result.append(arg)\n                else:\n                    result.append(getattr(arg, prop))\n        if join is not None:\n            return join.join(result)\n        else:\n            return result\n\n    def __repr__(self):\n        return \"Function(name='{0}', pyname='{1}', filename='{2}', filepath='{3}')\".format(self.name, self.pyname, self.filename, self.filepath)\n\n\nclass Constant:\n\n    def __init__(self, name, value, doc):\n        self.name = name.replace(\"ERFA_\", \"\")\n        self.value = value.replace(\"ERFA_\", \"\")\n        self.doc = doc\n\n\nclass ExtraFunction(Function):\n    \"\"\"\n    An \"extra\" function - e.g. one not following the SOFA/ERFA standard format.\n\n    Parameters\n    ----------\n    cname : str\n        The name of the function in C\n    prototype : str\n        The prototype for the function (usually derived from the header)\n    pathfordoc : str\n        The path to a file that contains the prototype, with the documentation\n        as a multiline string *before* it.\n    \"\"\"\n\n    def __init__(self, cname, prototype, pathfordoc):\n        self.name = cname\n        self.pyname = cname.split('era')[-1].lower()\n        self.filepath, self.filename = os.path.split(pathfordoc)\n\n        self.prototype = prototype.strip()\n        if prototype.endswith('{') or prototype.endswith(';'):\n            self.prototype = prototype[:-1].strip()\n\n        incomment = False\n        lastcomment = None\n        with open(pathfordoc, 'r') as f:\n            for l in f:\n                if incomment:\n                    if l.lstrip().startswith('*/'):\n                        incomment = False\n                        lastcomment = ''.join(lastcomment)\n                    else:\n                        if l.startswith('**'):\n                            l = l[2:]\n                        lastcomment.append(l)\n                else:\n                    if l.lstrip().startswith('/*'):\n                        incomment = True\n                        lastcomment = []\n                    if l.startswith(self.prototype):\n                        self.doc = lastcomment\n                        break\n            else:\n                raise ValueError('Did not find prototype {} in file '\n                                 '{}'.format(self.prototype, pathfordoc))\n\n        self.args = []\n        argset = re.search(r\"{0}\\(([^)]+)?\\)\".format(self.name),\n                           self.prototype).group(1)\n        if argset is not None:\n            for arg in argset.split(', '):\n                self.args.append(Argument(arg, self.doc))\n        self.ret = re.match(\"^(.*){0}\".format(self.name),\n                            self.prototype).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))\n\n    def __repr__(self):\n        r = super().__repr__()\n        if r.startswith('Function'):\n            r = 'Extra' + r\n        return r\n\n\ndef main(srcdir, outfn, templateloc, verbose=True):\n    from jinja2 import Environment, FileSystemLoader\n\n    if verbose:\n        print_ = lambda *args, **kwargs: print(*args, **kwargs)\n    else:\n        print_ = lambda *args, **kwargs: None\n\n    # Prepare the jinja2 templating environment\n    env = Environment(loader=FileSystemLoader(templateloc))\n\n    def prefix(a_list, pre):\n        return [pre+'{0}'.format(an_element) for an_element in a_list]\n\n    def postfix(a_list, post):\n        return ['{0}'.format(an_element)+post for an_element in a_list]\n\n    def surround(a_list, pre, post):\n        return [pre+'{0}'.format(an_element)+post for an_element in a_list]\n    env.filters['prefix'] = prefix\n    env.filters['postfix'] = postfix\n    env.filters['surround'] = surround\n\n    erfa_c_in = env.get_template('core.c.templ')\n    erfa_py_in = env.get_template('core.py.templ')\n\n    # Extract all the ERFA function names from erfa.h\n    if os.path.isdir(srcdir):\n        erfahfn = os.path.join(srcdir, 'erfa.h')\n        multifilserc = True\n    else:\n        erfahfn = os.path.join(os.path.split(srcdir)[0], 'erfa.h')\n        multifilserc = False\n\n    with open(erfahfn, \"r\") as f:\n        erfa_h = f.read()\n\n    funcs = OrderedDict()\n    section_subsection_functions = re.findall(r'/\\* (\\w*)/(\\w*) \\*/\\n(.*?)\\n\\n',\n                                              erfa_h, flags=re.DOTALL | re.MULTILINE)\n    for section, subsection, functions in section_subsection_functions:\n        print_(\"{0}.{1}\".format(section, subsection))\n        if ((section == \"Astronomy\") or (subsection == \"AngleOps\")\n            or (subsection == \"SphericalCartesian\")\n            or (subsection == \"MatrixVectorProducts\")):\n            func_names = re.findall(r' (\\w+)\\(.*?\\);', functions, flags=re.DOTALL)\n            for name in func_names:\n                print_(\"{0}.{1}.{2}...\".format(section, subsection, name))\n                if multifilserc:\n                    # easy because it just looks in the file itself\n                    funcs[name] = Function(name, srcdir)\n                else:\n                    # Have to tell it to look for a declaration matching\n                    # the start of the header declaration, otherwise it\n                    # might find a *call* of the function instead of the\n                    # definition\n                    for line in functions.split(r'\\n'):\n                        if name in line:\n                            # [:-1] is to remove trailing semicolon, and\n                            # splitting on '(' is because the header and\n                            # C files don't necessarily have to match\n                            # argument names and line-breaking or\n                            # whitespace\n                            match_line = line[:-1].split('(')[0]\n                            funcs[name] = Function(name, srcdir, match_line)\n                            break\n                    else:\n                        raise ValueError(\"A name for a C file wasn't \"\n                                         \"found in the string that \"\n                                         \"spawned it.  This should be \"\n                                         \"impossible!\")\n\n    funcs = list(funcs.values())\n\n    # Extract all the ERFA constants from erfam.h\n    erfamhfn = os.path.join(srcdir, 'erfam.h')\n    with open(erfamhfn, 'r') as f:\n        erfa_m_h = f.read()\n    constants = []\n    for chunk in erfa_m_h.split(\"\\n\\n\"):\n        result = re.findall(r\"#define (ERFA_\\w+?) (.+?)$\", chunk, flags=re.DOTALL | re.MULTILINE)\n        if result:\n            doc = re.findall(r\"/\\* (.+?) \\*/\\n\", chunk, flags=re.DOTALL)\n            for (name, value) in result:\n                constants.append(Constant(name, value, doc))\n\n    # TODO: re-enable this when const char* return values and non-status code integer rets are possible\n    # #Add in any \"extra\" functions from erfaextra.h\n    # erfaextrahfn = os.path.join(srcdir, 'erfaextra.h')\n    # with open(erfaextrahfn, 'r') as f:\n    #     for l in f:\n    #         ls = l.strip()\n    #         match = re.match('.* (era.*)\\(', ls)\n    #         if match:\n    #             print_(\"Extra:  {0} ...\".format(match.group(1)))\n    #             funcs.append(ExtraFunction(match.group(1), ls, erfaextrahfn))\n\n    print_(\"Rendering template\")\n    erfa_c = erfa_c_in.render(funcs=funcs)\n    erfa_py = erfa_py_in.render(funcs=funcs, constants=constants)\n\n    if outfn is not None:\n        outfn_c = os.path.splitext(outfn)[0] + \".c\"\n        print_(\"Saving to\", outfn, 'and', outfn_c)\n        with open(outfn, \"w\") as f:\n            f.write(erfa_py)\n        with open(outfn_c, \"w\") as f:\n            f.write(erfa_c)\n\n    print_(\"Done!\")\n\n    return erfa_c, erfa_py, funcs\n\n\nDEFAULT_ERFA_LOC = os.path.join(os.path.split(__file__)[0],\n                                '../../cextern/erfa')\nDEFAULT_TEMPLATE_LOC = os.path.split(__file__)[0]\n\nif __name__ == '__main__':\n    from argparse import ArgumentParser\n\n    ap = ArgumentParser()\n    ap.add_argument('srcdir', default=DEFAULT_ERFA_LOC, nargs='?',\n                    help='Directory where the ERFA c and header files '\n                         'can be found or to a single erfa.c file '\n                         '(which must be in the same directory as '\n                         'erfa.h). Defaults to the builtin astropy '\n                         'erfa: \"{0}\"'.format(DEFAULT_ERFA_LOC))\n    ap.add_argument('-o', '--output', default='core.py',\n                    help='The output filename.  This is the name for only the '\n                         'pure-python output, the C part will have the '\n                         'same name but with a \".c\" extension.')\n    ap.add_argument('-t', '--template-loc',\n                    default=DEFAULT_TEMPLATE_LOC,\n                    help='the location where the \"core.c.templ\" '\n                         'template can be found.')\n    ap.add_argument('-q', '--quiet', action='store_false', dest='verbose',\n                    help='Suppress output normally printed to stdout.')\n\n    args = ap.parse_args()\n    main(args.srcdir, args.output, args.template_loc)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":6277,"name":"ERFA_SRC","nodeType":"Attribute","startLoc":14,"text":"ERFA_SRC"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":6278,"name":"SRC_FILES","nodeType":"Attribute","startLoc":16,"text":"SRC_FILES"},{"attributeType":"null","col":18,"comment":"null","endLoc":18,"id":6279,"name":"filename","nodeType":"Attribute","startLoc":18,"text":"filename"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":6280,"name":"GEN_FILES","nodeType":"Attribute","startLoc":20,"text":"GEN_FILES"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":6281,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ERFAPKGDIR = os.path.relpath(os.path.dirname(__file__))\n\nERFA_SRC = os.path.abspath(os.path.join(ERFAPKGDIR, '..', '..', 'cextern', 'erfa'))\n\nSRC_FILES = glob.glob(os.path.join(ERFA_SRC, '*'))\n\nSRC_FILES += [os.path.join(ERFAPKGDIR, filename)\n              for filename in ['core.py.templ', 'core.c.templ', 'erfa_generator.py']]\n\nGEN_FILES = [os.path.join(ERFAPKGDIR, 'core.py'), os.path.join(ERFAPKGDIR, 'core.c')]"},{"fileName":"__init__.py","filePath":"astropy/_erfa","id":6282,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\ntry:\n    # The ERFA wrappers are not guaranteed available at setup time\n    from .core import *\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":6283,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"try:\n    # The ERFA wrappers are not guaranteed available at setup time\n    from .core import *\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise"},{"col":4,"comment":"null","endLoc":647,"header":"def _notify_disconnection(self, private_key)","id":6284,"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(\"notify disconnection to {}\".format(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!\"}}))"},{"id":6285,"name":"astropy/_erfa/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/_erfa/tests","id":6286,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"id":6287,"name":"astropy/stats","nodeType":"Package"},{"fileName":"info_theory.py","filePath":"astropy/stats","id":6288,"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       <http://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\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    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.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: +FLOAT_CMP\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       <http://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <http://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       <http://theses.ulaval.ca/archimede/fichiers/21842/apa.html>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <http://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, 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    -660.41075962620482\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 Criteria\n       <http://avesbiodiv.mncn.csic.es/estadistica/ejemploaic.pdf>\n    .. [2] Hu, S. Akaike Information Criterion.\n       <http://www4.ncsu.edu/~shu3/Presentation/AIC.pdf>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <http://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":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       <http://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":6289,"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       <http://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    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.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: +FLOAT_CMP\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       <http://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <http://docs.astropy.org/en/stable/modeling>\n    ","endLoc":196,"header":"def bayesian_info_criterion_lsq(ssr, n_params, n_samples)","id":6290,"name":"bayesian_info_criterion_lsq","nodeType":"Function","startLoc":115,"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    >>> t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.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: +FLOAT_CMP\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       <http://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    .. [3] Astropy Models and Fitting\n        <http://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)"},{"className":"FunctionDoc","col":0,"comment":"null","endLoc":98,"id":6291,"nodeType":"Class","startLoc":32,"text":"class FunctionDoc:\n\n    def __init__(self, doc):\n        self.doc = doc.replace(\"**\", \"  \").replace(\"/*\\n\", \"\").replace(\"*/\", \"\")\n        self.__input = None\n        self.__output = None\n        self.__ret_info = None\n\n    @property\n    def input(self):\n        if self.__input is None:\n            self.__input = []\n            result = re.search(\"Given([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n        return self.__input\n\n    @property\n    def output(self):\n        if self.__output is None:\n            self.__output = []\n            result = re.search(\"Returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n        return self.__output\n\n    @property\n    def ret_info(self):\n        if self.__ret_info is None:\n            ret_info = []\n            result = re.search(\"Returned \\\\(function value\\\\)([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                ret_info.append(ReturnDoc(result.group(2)))\n\n            if len(ret_info) == 0:\n                self.__ret_info = ''\n            elif len(ret_info) == 1:\n                self.__ret_info = ret_info[0]\n            else:\n                raise ValueError(\"Multiple C return sections found in this doc:\\n\" + self.doc)\n\n        return self.__ret_info\n\n    def __repr__(self):\n        return self.doc.replace(\"  \\n\", \"\\n\")"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self, doc)","id":6292,"name":"__init__","nodeType":"Function","startLoc":34,"text":"def __init__(self, doc):\n        self.doc = doc.replace(\"**\", \"  \").replace(\"/*\\n\", \"\").replace(\"*/\", \"\")\n        self.__input = None\n        self.__output = None\n        self.__ret_info = None"},{"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       <http://theses.ulaval.ca/archimede/fichiers/21842/apa.html>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <http://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":302,"header":"def akaike_info_criterion(log_likelihood, n_params, n_samples)","id":6293,"name":"akaike_info_criterion","nodeType":"Function","startLoc":199,"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       <http://theses.ulaval.ca/archimede/fichiers/21842/apa.html>\n    .. [3] Wikipedia. Akaike Information Criterion.\n       <https://en.wikipedia.org/wiki/Akaike_information_criterion>\n    .. [4] Origin Lab. Comparing Two Fitting Functions.\n       <http://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, 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    -660.41075962620482\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 Criteria\n       <http://avesbiodiv.mncn.csic.es/estadistica/ejemploaic.pdf>\n    .. [2] Hu, S. Akaike Information Criterion.\n       <http://www4.ncsu.edu/~shu3/Presentation/AIC.pdf>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <http://www.originlab.com/doc/Origin-Help/PostFit-CompareFitFunc>\n    ","endLoc":401,"header":"def akaike_info_criterion_lsq(ssr, n_params, n_samples)","id":6294,"name":"akaike_info_criterion_lsq","nodeType":"Function","startLoc":305,"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, 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    -660.41075962620482\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 Criteria\n       <http://avesbiodiv.mncn.csic.es/estadistica/ejemploaic.pdf>\n    .. [2] Hu, S. Akaike Information Criterion.\n       <http://www4.ncsu.edu/~shu3/Presentation/AIC.pdf>\n    .. [3] Origin Lab. Comparing Two Fitting Functions.\n       <http://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":16,"comment":"null","endLoc":7,"id":6295,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"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":621,"header":"def to_value(self, timezone=None, parent=None)","id":6296,"name":"to_value","nodeType":"Function","startLoc":576,"text":"def to_value(self, timezone=None, parent=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 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)\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        iterator = np.nditer([iys, ims, ids, ihrs, imins, isecs, ifracs, None],\n                             flags=['refs_ok'],\n                             op_dtypes=7*[iys.dtype] + [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        return iterator.operands[-1]"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":6297,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":6298,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":12,"text":"__doctest_requires__"},{"col":4,"comment":"null","endLoc":761,"header":"def _unregister(self, private_key)","id":6299,"name":"_unregister","nodeType":"Function","startLoc":722,"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(\"unregister {} ({})\".format(public_key, private_key))\n\n        return \"\""},{"col":4,"comment":"null","endLoc":602,"header":"def _notify_unregister(self, private_key)","id":6300,"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}})"},{"col":0,"comment":"","endLoc":5,"header":"info_theory.py#<anonymous>","id":6301,"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']}"},{"col":4,"comment":"null","endLoc":324,"header":"@property\n    def value(self)","id":6302,"name":"value","nodeType":"Function","startLoc":301,"text":"@property\n    def value(self):\n        scale = self.scale.upper().encode('ascii')\n        iy_start, ims, ids, ihmsfs = erfa.d2dtf(scale, 0,  # precision=0\n                                                self.jd1, self.jd2)\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\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 decimalyear"},{"col":4,"comment":"null","endLoc":58,"header":"@property\n    def input(self)","id":6303,"name":"input","nodeType":"Function","startLoc":40,"text":"@property\n    def input(self):\n        if self.__input is None:\n            self.__input = []\n            result = re.search(\"Given([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __input = result.group(2)\n                for i in __input.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__input.append(arg_doc)\n        return self.__input"},{"col":4,"comment":"null","endLoc":3120,"header":"def _add_resource(self, iterator, tag, data, config, pos)","id":6304,"name":"_add_resource","nodeType":"Function","startLoc":3117,"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)"},{"fileName":"biweight.py","filePath":"astropy/stats","id":6305,"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\n\nimport numpy as np\n\nfrom .funcs import median_absolute_deviation\nfrom ..utils.decorators import deprecated_renamed_argument\n\n\n__all__ = ['biweight_location', 'biweight_scale', 'biweight_midvariance',\n           'biweight_midcovariance', 'biweight_midcorrelation']\n\n\n@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_location(data, c=6.0, M=None, axis=None):\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{\\Sigma_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\Sigma_{|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    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\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 : int, optional\n        The axis along which the biweight locations are computed.  If\n        `None` (default), then the biweight location of the flattened\n        input array will be computed.\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biloc = biweight_location(rand.randn(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    -0.0175741540445\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = np.median(data, axis=axis)\n    if axis is not None:\n        M = np.expand_dims(M, axis=axis)\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis)\n    if axis is not None:\n        mad = np.expand_dims(mad, axis=axis)\n    u = d / (c * mad)\n\n    # now remove the outlier points\n    mask = (np.abs(u) >= 1)\n    u = (1 - u ** 2) ** 2\n    u[mask] = 0\n\n    return M.squeeze() + (d * u).sum(axis=axis) / u.sum(axis=axis)\n\n\ndef biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight scales are computed.  If\n        `None` (default), then the biweight scale of the flattened input\n        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\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biscl = biweight_scale(rand.randn(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    0.986726249291\n    \"\"\"\n\n    return np.sqrt(\n        biweight_midvariance(data, c=c, M=M, axis=axis,\n                             modify_sample_size=modify_sample_size))\n\n\n@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight midvariances are computed.  If\n        `None` (default), then the biweight midvariance 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        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\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) (http://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.RandomState(12345)\n    >>> bivar = biweight_midvariance(rand.randn(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    0.97362869104\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = np.median(data, axis=axis)\n    if axis is not None:\n        M = np.expand_dims(M, axis=axis)\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis)\n    if axis is not None:\n        mad = np.expand_dims(mad, axis=axis)\n    u = d / (c * mad)\n\n    # now remove the outlier points\n    mask = np.abs(u) < 1\n    u = u ** 2\n\n    if modify_sample_size:\n        n = mask.sum(axis=axis)\n    else:\n        if axis is None:\n            n = data.size\n        else:\n            n = data.shape[axis]\n\n    f1 = d * d * (1. - u)**4\n    f1[~mask] = 0.\n    f1 = f1.sum(axis=axis)\n    f2 = (1. - u) * (1. - 5.*u)\n    f2[~mask] = 0.\n    f2 = np.abs(f2.sum(axis=axis))**2\n\n    return n * f1 / f2\n\n\n@deprecated_renamed_argument('a', 'data', '2.0')\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 \\ \\frac{\\Sigma_{|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            {(\\Sigma_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\Sigma_{|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    For the standard definition of biweight midcovariance :math:`n` is\n    the total number of observations of each variable.  That definition\n    is used if ``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 observations for which :math:`|u_i| < 1` and :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n = \\Sigma_{|u_i| < 1, \\ |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 : `~numpy.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] http://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.RandomState(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.82483155 -0.18961219]\n     [-0.18961219 9.80265764]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))    # doctest: +FLOAT_CMP\n    [ 0.90820237  3.13091961]\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    u = (d.T / (c * mad)).T\n\n    # now remove the outlier points\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    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    return n * (numerator_matrix / denominator_matrix)\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.RandomState(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.0495780713907\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"},{"col":4,"comment":"null","endLoc":112,"header":"def __init__(self, doc)","id":6306,"name":"__init__","nodeType":"Function","startLoc":103,"text":"def __init__(self, doc):\n        match = re.search(\"^ +([^ ]+)[ ]+([^ ]+)[ ]+(.+)\", doc)\n        if match is not None:\n            self.name = match.group(1)\n            self.type = match.group(2)\n            self.doc = match.group(3)\n        else:\n            self.name = None\n            self.type = None\n            self.doc = None"},{"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 : string, `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":665,"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":6307,"name":"__init__","nodeType":"Function","startLoc":635,"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 : string, `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))"},{"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 : {int, sequence of int, None}, optional\n        Axis along which the MADs are computed.  The default (`None`) is\n        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.RandomState(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.randn(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.65244241428454486\n\n    See Also\n    --------\n    mad_std\n    ","endLoc":815,"header":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef median_absolute_deviation(data, axis=None, func=None, ignore_nan=False)","id":6308,"name":"median_absolute_deviation","nodeType":"Function","startLoc":725,"text":"@deprecated_renamed_argument('a', 'data', '2.0')\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 : {int, sequence of int, None}, optional\n        Axis along which the MADs are computed.  The default (`None`) is\n        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.RandomState(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.randn(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.65244241428454486\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_invalid(data)\n        elif ignore_nan:\n            is_masked = False\n            func = np.nanmedian\n        else:\n            is_masked = False\n            func = np.median\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\n    # broadcast the median array before subtraction\n    if axis is not None:\n        if isiterable(axis):\n            for ax in sorted(list(axis)):\n                data_median = np.expand_dims(data_median, axis=ax)\n        else:\n            data_median = np.expand_dims(data_median, axis=axis)\n\n    result = func(np.abs(data - data_median), axis=axis, overwrite_input=True)\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":268,"id":6309,"name":"name","nodeType":"Attribute","startLoc":268,"text":"name"},{"attributeType":"null","col":8,"comment":"null","endLoc":299,"id":6310,"name":"jd1","nodeType":"Attribute","startLoc":299,"text":"self.jd1"},{"attributeType":"null","col":18,"comment":"null","endLoc":299,"id":6311,"name":"jd2","nodeType":"Attribute","startLoc":299,"text":"self.jd2"},{"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":400,"id":6312,"nodeType":"Class","startLoc":327,"text":"class TimeFromEpoch(TimeFormat):\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    def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale\n        # Initialize the reference epoch (a single time defined in subclasses)\n        epoch = Time(self.epoch_val, self.epoch_val2, scale=self.epoch_scale,\n                     format=self.epoch_format)\n        self.epoch = epoch\n\n        # Now create the TimeFormat object as normal\n        super().__init__(val1, val2, scale, precision, in_subfmt, out_subfmt,\n                         from_jd)\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        # 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 '{0}' epoch scale '{1}'\"\n                                  \"to specified scale '{2}', got error:\\n{3}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err))\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)\n\n    def to_value(self, parent=None):\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            tm = getattr(parent, self.epoch_scale)\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        time_from_epoch = ((jd1 - self.epoch.jd1) +\n                           (jd2 - self.epoch.jd2)) / self.unit\n        return time_from_epoch\n\n    value = property(to_value)"},{"col":4,"comment":"null","endLoc":344,"header":"def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False)","id":6313,"name":"__init__","nodeType":"Function","startLoc":334,"text":"def __init__(self, val1, val2, scale, precision,\n                 in_subfmt, out_subfmt, from_jd=False):\n        self.scale = scale\n        # Initialize the reference epoch (a single time defined in subclasses)\n        epoch = Time(self.epoch_val, self.epoch_val2, scale=self.epoch_scale,\n                     format=self.epoch_format)\n        self.epoch = epoch\n\n        # Now create the TimeFormat object as normal\n        super().__init__(val1, val2, scale, precision, in_subfmt, out_subfmt,\n                         from_jd)"},{"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 decorator,\n        or by using function annotation syntax. Arguments to the decorator\n        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\n        or in the annotation.\n        If the argument has no unit attribute, i.e. it is not a Quantity object, a\n        `ValueError` will be raised.\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        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        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":149,"header":"@classmethod\n    def as_decorator(cls, func=None, **kwargs)","id":6314,"name":"as_decorator","nodeType":"Function","startLoc":84,"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 decorator,\n        or by using function annotation syntax. Arguments to the decorator\n        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\n        or in the annotation.\n        If the argument has no unit attribute, i.e. it is not a Quantity object, a\n        `ValueError` will be raised.\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        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        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":"null","endLoc":347,"header":"def _hub_as_client_request_handler(self, method, args)","id":6315,"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)"},{"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":383,"header":"def set_jds(self, val1, val2)","id":6316,"name":"set_jds","nodeType":"Function","startLoc":346,"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        # 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 '{0}' epoch scale '{1}'\"\n                                  \"to specified scale '{2}', got error:\\n{3}\"\n                                  .format(self.name, self.epoch_scale,\n                                          self.scale, err))\n\n        self.jd1, self.jd2 = day_frac(tm._time.jd1, tm._time.jd2)"},{"col":4,"comment":"null","endLoc":78,"header":"@property\n    def output(self)","id":6317,"name":"output","nodeType":"Function","startLoc":60,"text":"@property\n    def output(self):\n        if self.__output is None:\n            self.__output = []\n            result = re.search(\"Returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n            result = re.search(\"Given and returned([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                __output = result.group(2)\n                for i in __output.split(\"\\n\"):\n                    arg_doc = ArgumentDoc(i)\n                    if arg_doc.name is not None:\n                        self.__output.append(arg_doc)\n        return self.__output"},{"col":4,"comment":"null","endLoc":1281,"header":"def _receive_call(self, private_key, sender_id, msg_id, message)","id":6318,"name":"_receive_call","nodeType":"Function","startLoc":1262,"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 \"\""},{"col":4,"comment":"null","endLoc":398,"header":"def to_value(self, parent=None)","id":6319,"name":"to_value","nodeType":"Function","startLoc":385,"text":"def to_value(self, parent=None):\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            tm = getattr(parent, self.epoch_scale)\n            jd1, jd2 = tm._time.jd1, tm._time.jd2\n        else:\n            jd1, jd2 = self.jd1, self.jd2\n\n        time_from_epoch = ((jd1 - self.epoch.jd1) +\n                           (jd2 - self.epoch.jd2)) / self.unit\n        return time_from_epoch"},{"attributeType":"null","col":4,"comment":"null","endLoc":400,"id":6320,"name":"value","nodeType":"Attribute","startLoc":400,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":383,"id":6321,"name":"jd1","nodeType":"Attribute","startLoc":383,"text":"self.jd1"},{"attributeType":"null","col":8,"comment":"null","endLoc":336,"id":6322,"name":"scale","nodeType":"Attribute","startLoc":336,"text":"self.scale"},{"attributeType":"null","col":18,"comment":"null","endLoc":383,"id":6323,"name":"jd2","nodeType":"Attribute","startLoc":383,"text":"self.jd2"},{"attributeType":"Time","col":8,"comment":"null","endLoc":340,"id":6324,"name":"epoch","nodeType":"Attribute","startLoc":340,"text":"self.epoch"},{"col":4,"comment":"null","endLoc":95,"header":"@property\n    def ret_info(self)","id":6325,"name":"ret_info","nodeType":"Function","startLoc":80,"text":"@property\n    def ret_info(self):\n        if self.__ret_info is None:\n            ret_info = []\n            result = re.search(\"Returned \\\\(function value\\\\)([^\\n]*):\\n(.+?)  \\n\", self.doc, re.DOTALL)\n            if result is not None:\n                ret_info.append(ReturnDoc(result.group(2)))\n\n            if len(ret_info) == 0:\n                self.__ret_info = ''\n            elif len(ret_info) == 1:\n                self.__ret_info = ret_info[0]\n            else:\n                raise ValueError(\"Multiple C return sections found in this doc:\\n\" + self.doc)\n\n        return self.__ret_info"},{"col":4,"comment":"\n        The main method that gets called for replying. This starts up an\n        asynchronous reply thread and returns.\n        ","endLoc":1150,"header":"def _reply(self, private_key, msg_id, response)","id":6326,"name":"_reply","nodeType":"Function","startLoc":1137,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\n\n        return {}"},{"className":"TimeUnix","col":0,"comment":"\n    Unix time: seconds from 1970-01-01 00:00:00 UTC.\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":419,"id":6327,"nodeType":"Class","startLoc":403,"text":"class TimeUnix(TimeFromEpoch):\n    \"\"\"\n    Unix time: seconds from 1970-01-01 00:00:00 UTC.\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":414,"id":6328,"name":"name","nodeType":"Attribute","startLoc":414,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":415,"id":6329,"name":"unit","nodeType":"Attribute","startLoc":415,"text":"unit"},{"col":4,"comment":"null","endLoc":153,"header":"def __init__(self, func=None, **kwargs)","id":6330,"name":"__init__","nodeType":"Function","startLoc":151,"text":"def __init__(self, func=None, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs"},{"attributeType":"null","col":4,"comment":"null","endLoc":416,"id":6331,"name":"epoch_val","nodeType":"Attribute","startLoc":416,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":417,"id":6332,"name":"epoch_val2","nodeType":"Attribute","startLoc":417,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":418,"id":6333,"name":"epoch_scale","nodeType":"Attribute","startLoc":418,"text":"epoch_scale"},{"col":4,"comment":"null","endLoc":223,"header":"def __init__(self, doc)","id":6334,"name":"__init__","nodeType":"Function","startLoc":201,"text":"def __init__(self, doc):\n        self.doc = doc\n\n        self.infoline = doc.split('\\n')[0].strip()\n        self.type = self.infoline.split()[0]\n        self.descr = self.infoline.split()[1]\n\n        if self.descr.startswith('status'):\n            self.statuscodes = statuscodes = {}\n\n            code = None\n            for line in doc[doc.index(':')+1:].split('\\n'):\n                ls = line.strip()\n                if ls != '':\n                    if ' = ' in ls:\n                        code, msg = ls.split(' = ')\n                        if code != 'else':\n                            code = int(code)\n                        statuscodes[code] = msg\n                    elif code is not None:\n                        statuscodes[code] += ls\n        else:\n            self.statuscodes = None"},{"attributeType":"null","col":4,"comment":"null","endLoc":419,"id":6335,"name":"epoch_format","nodeType":"Attribute","startLoc":419,"text":"epoch_format"},{"attributeType":"null","col":4,"comment":"null","endLoc":544,"id":6336,"name":"name","nodeType":"Attribute","startLoc":544,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":623,"id":6337,"name":"value","nodeType":"Attribute","startLoc":623,"text":"value"},{"attributeType":"null","col":8,"comment":"null","endLoc":574,"id":6338,"name":"jd1","nodeType":"Attribute","startLoc":574,"text":"self.jd1"},{"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":432,"id":6339,"nodeType":"Class","startLoc":422,"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":427,"id":6340,"name":"name","nodeType":"Attribute","startLoc":427,"text":"name"},{"attributeType":"null","col":18,"comment":"null","endLoc":574,"id":6341,"name":"jd2","nodeType":"Attribute","startLoc":574,"text":"self.jd2"},{"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":170,"id":6342,"nodeType":"Class","startLoc":92,"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    attrs_from_parent = set(['unit'])  # unit is read-only and None\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    @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                                     None: 'jd1_jd2'}\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            format = map.pop('format')\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n        else:\n            format = map['format']\n            map['val'] = map.pop('value')\n\n        out = self._parent_cls(**map)\n        out.format = format\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":428,"id":6343,"name":"unit","nodeType":"Attribute","startLoc":428,"text":"unit"},{"col":4,"comment":"null","endLoc":118,"header":"@property\n    def _represent_as_dict_attrs(self)","id":6344,"name":"_represent_as_dict_attrs","nodeType":"Function","startLoc":108,"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":4,"comment":"null","endLoc":133,"header":"def __init__(self, bound=False)","id":6345,"name":"__init__","nodeType":"Function","startLoc":120,"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                                     None: 'jd1_jd2'}"},{"col":4,"comment":"null","endLoc":98,"header":"def __repr__(self)","id":6346,"name":"__repr__","nodeType":"Function","startLoc":97,"text":"def __repr__(self):\n        return self.doc.replace(\"  \\n\", \"\\n\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":429,"id":6347,"name":"epoch_val","nodeType":"Attribute","startLoc":429,"text":"epoch_val"},{"col":4,"comment":"null","endLoc":137,"header":"@property\n    def unit(self)","id":6348,"name":"unit","nodeType":"Function","startLoc":135,"text":"@property\n    def unit(self):\n        return None"},{"col":4,"comment":"null","endLoc":157,"header":"def _construct_from_dict_base(self, map)","id":6349,"name":"_construct_from_dict_base","nodeType":"Function","startLoc":145,"text":"def _construct_from_dict_base(self, map):\n        if 'jd1' in map and 'jd2' in map:\n            format = map.pop('format')\n            map['format'] = 'jd'\n            map['val'] = map.pop('jd1')\n            map['val2'] = map.pop('jd2')\n        else:\n            format = map['format']\n            map['val'] = map.pop('value')\n\n        out = self._parent_cls(**map)\n        out.format = format\n        return out"},{"attributeType":"None","col":8,"comment":"null","endLoc":37,"id":6350,"name":"__output","nodeType":"Attribute","startLoc":37,"text":"self.__output"},{"attributeType":"None","col":8,"comment":"null","endLoc":38,"id":6351,"name":"__ret_info","nodeType":"Attribute","startLoc":38,"text":"self.__ret_info"},{"attributeType":"None","col":4,"comment":"null","endLoc":430,"id":6352,"name":"epoch_val2","nodeType":"Attribute","startLoc":430,"text":"epoch_val2"},{"attributeType":"null","col":8,"comment":"null","endLoc":35,"id":6353,"name":"doc","nodeType":"Attribute","startLoc":35,"text":"self.doc"},{"attributeType":"None","col":8,"comment":"null","endLoc":36,"id":6354,"name":"__input","nodeType":"Attribute","startLoc":36,"text":"self.__input"},{"className":"ArgumentDoc","col":0,"comment":"null","endLoc":115,"id":6355,"nodeType":"Class","startLoc":101,"text":"class ArgumentDoc:\n\n    def __init__(self, doc):\n        match = re.search(\"^ +([^ ]+)[ ]+([^ ]+)[ ]+(.+)\", doc)\n        if match is not None:\n            self.name = match.group(1)\n            self.type = match.group(2)\n            self.doc = match.group(3)\n        else:\n            self.name = None\n            self.type = None\n            self.doc = None\n\n    def __repr__(self):\n        return \"    {0:15} {1:15} {2}\".format(self.name, self.type, self.doc)"},{"col":4,"comment":"null","endLoc":115,"header":"def __repr__(self)","id":6356,"name":"__repr__","nodeType":"Function","startLoc":114,"text":"def __repr__(self):\n        return \"    {0:15} {1:15} {2}\".format(self.name, self.type, self.doc)"},{"attributeType":"null","col":4,"comment":"null","endLoc":431,"id":6357,"name":"epoch_scale","nodeType":"Attribute","startLoc":431,"text":"epoch_scale"},{"attributeType":"None","col":12,"comment":"null","endLoc":110,"id":6358,"name":"name","nodeType":"Attribute","startLoc":110,"text":"self.name"},{"attributeType":"None","col":12,"comment":"null","endLoc":112,"id":6359,"name":"doc","nodeType":"Attribute","startLoc":112,"text":"self.doc"},{"attributeType":"null","col":4,"comment":"null","endLoc":432,"id":6360,"name":"epoch_format","nodeType":"Attribute","startLoc":432,"text":"epoch_format"},{"attributeType":"None","col":12,"comment":"null","endLoc":111,"id":6361,"name":"type","nodeType":"Attribute","startLoc":111,"text":"self.type"},{"className":"Argument","col":0,"comment":"null","endLoc":196,"id":6362,"nodeType":"Class","startLoc":118,"text":"class Argument:\n\n    def __init__(self, definition, doc):\n        self.doc = doc\n        self.__inout_state = None\n        self.ctype, ptr_name_arr = definition.strip().rsplit(\" \", 1)\n        if \"*\" == ptr_name_arr[0]:\n            self.is_ptr = True\n            name_arr = ptr_name_arr[1:]\n        else:\n            self.is_ptr = False\n            name_arr = ptr_name_arr\n        if \"[]\" in ptr_name_arr:\n            self.is_ptr = True\n            name_arr = name_arr[:-2]\n        if \"[\" in name_arr:\n            self.name, arr = name_arr.split(\"[\", 1)\n            self.shape = tuple([int(size) for size in arr[:-1].split(\"][\")])\n        else:\n            self.name = name_arr\n            self.shape = ()\n\n    @property\n    def inout_state(self):\n        if self.__inout_state is None:\n            self.__inout_state = ''\n            for i in self.doc.input:\n                if self.name in i.name.split(','):\n                    self.__inout_state = 'in'\n            for o in self.doc.output:\n                if self.name in o.name.split(','):\n                    if self.__inout_state == 'in':\n                        self.__inout_state = 'inout'\n                    else:\n                        self.__inout_state = 'out'\n        return self.__inout_state\n\n    @property\n    def ctype_ptr(self):\n        if (self.is_ptr) | (len(self.shape) > 0):\n            return self.ctype+\" *\"\n        else:\n            return self.ctype\n\n    @property\n    def name_in_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_in[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_in\".format(self.name)\n\n    @property\n    def name_out_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_out[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_out\".format(self.name)\n\n    @property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]\n\n    @property\n    def ndim(self):\n        return len(self.shape)\n\n    @property\n    def cshape(self):\n        return ''.join(['[{0}]'.format(s) for s in self.shape])\n\n    @property\n    def name_for_call(self):\n        if self.is_ptr:\n            return '_'+self.name\n        else:\n            return '*_'+self.name\n\n    def __repr__(self):\n        return \"Argument('{0}', name='{1}', ctype='{2}', inout_state='{3}')\".format(self.definition, self.name, self.ctype, self.inout_state)"},{"col":4,"comment":"null","endLoc":138,"header":"def __init__(self, definition, doc)","id":6363,"name":"__init__","nodeType":"Function","startLoc":120,"text":"def __init__(self, definition, doc):\n        self.doc = doc\n        self.__inout_state = None\n        self.ctype, ptr_name_arr = definition.strip().rsplit(\" \", 1)\n        if \"*\" == ptr_name_arr[0]:\n            self.is_ptr = True\n            name_arr = ptr_name_arr[1:]\n        else:\n            self.is_ptr = False\n            name_arr = ptr_name_arr\n        if \"[]\" in ptr_name_arr:\n            self.is_ptr = True\n            name_arr = name_arr[:-2]\n        if \"[\" in name_arr:\n            self.name, arr = name_arr.split(\"[\", 1)\n            self.shape = tuple([int(size) for size in arr[:-1].split(\"][\")])\n        else:\n            self.name = name_arr\n            self.shape = ()"},{"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 http://tycho.usno.navy.mil/gpstt.html\n    ","endLoc":454,"id":6364,"nodeType":"Class","startLoc":435,"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 http://tycho.usno.navy.mil/gpstt.html\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":448,"id":6365,"name":"name","nodeType":"Attribute","startLoc":448,"text":"name"},{"col":4,"comment":"null","endLoc":170,"header":"def _construct_from_dict(self, map)","id":6366,"name":"_construct_from_dict","nodeType":"Function","startLoc":159,"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":449,"id":6367,"name":"unit","nodeType":"Attribute","startLoc":449,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":450,"id":6368,"name":"epoch_val","nodeType":"Attribute","startLoc":450,"text":"epoch_val"},{"col":4,"comment":"null","endLoc":153,"header":"@property\n    def inout_state(self)","id":6369,"name":"inout_state","nodeType":"Function","startLoc":140,"text":"@property\n    def inout_state(self):\n        if self.__inout_state is None:\n            self.__inout_state = ''\n            for i in self.doc.input:\n                if self.name in i.name.split(','):\n                    self.__inout_state = 'in'\n            for o in self.doc.output:\n                if self.name in o.name.split(','):\n                    if self.__inout_state == 'in':\n                        self.__inout_state = 'inout'\n                    else:\n                        self.__inout_state = 'out'\n        return self.__inout_state"},{"col":4,"comment":"null","endLoc":661,"header":"def _query_by_metadata(self, key, value)","id":6370,"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"},{"attributeType":"None","col":4,"comment":"null","endLoc":452,"id":6371,"name":"epoch_val2","nodeType":"Attribute","startLoc":452,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":453,"id":6372,"name":"epoch_scale","nodeType":"Attribute","startLoc":453,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":454,"id":6373,"name":"epoch_format","nodeType":"Attribute","startLoc":454,"text":"epoch_format"},{"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":481,"id":6374,"nodeType":"Class","startLoc":457,"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'"},{"col":4,"comment":"null","endLoc":3154,"header":"def parse(self, votable, iterator, config)","id":6375,"name":"parse","nodeType":"Function","startLoc":3127,"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            '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"},{"attributeType":"null","col":4,"comment":"null","endLoc":476,"id":6376,"name":"name","nodeType":"Attribute","startLoc":476,"text":"name"},{"col":4,"comment":"null","endLoc":1260,"header":"def _receive_notification(self, private_key, sender_id, message)","id":6377,"name":"_receive_notification","nodeType":"Function","startLoc":1259,"text":"def _receive_notification(self, private_key, sender_id, message):\n        return \"\""},{"col":4,"comment":"null","endLoc":3125,"header":"def _add_link(self, iterator, tag, data, config, pos)","id":6378,"name":"_add_link","nodeType":"Function","startLoc":3122,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":477,"id":6379,"name":"unit","nodeType":"Attribute","startLoc":477,"text":"unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":478,"id":6380,"name":"epoch_val","nodeType":"Attribute","startLoc":478,"text":"epoch_val"},{"attributeType":"None","col":4,"comment":"null","endLoc":479,"id":6381,"name":"epoch_val2","nodeType":"Attribute","startLoc":479,"text":"epoch_val2"},{"attributeType":"null","col":4,"comment":"null","endLoc":480,"id":6382,"name":"epoch_scale","nodeType":"Attribute","startLoc":480,"text":"epoch_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":481,"id":6383,"name":"epoch_format","nodeType":"Attribute","startLoc":481,"text":"epoch_format"},{"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":674,"id":6384,"nodeType":"Class","startLoc":626,"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 : string, `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":668,"header":"def utcoffset(self, dt)","id":6385,"name":"utcoffset","nodeType":"Function","startLoc":667,"text":"def utcoffset(self, dt):\n        return self._utcoffset"},{"col":4,"comment":"null","endLoc":671,"header":"def tzname(self, dt)","id":6386,"name":"tzname","nodeType":"Function","startLoc":670,"text":"def tzname(self, dt):\n        return str(self._tzname)"},{"col":4,"comment":"null","endLoc":674,"header":"def dst(self, dt)","id":6387,"name":"dst","nodeType":"Function","startLoc":673,"text":"def dst(self, dt):\n        return self._dst"},{"attributeType":"null","col":8,"comment":"null","endLoc":663,"id":6388,"name":"_utcoffset","nodeType":"Attribute","startLoc":663,"text":"self._utcoffset"},{"col":4,"comment":"null","endLoc":160,"header":"@property\n    def ctype_ptr(self)","id":6389,"name":"ctype_ptr","nodeType":"Function","startLoc":155,"text":"@property\n    def ctype_ptr(self):\n        if (self.is_ptr) | (len(self.shape) > 0):\n            return self.ctype+\" *\"\n        else:\n            return self.ctype"},{"col":4,"comment":"null","endLoc":167,"header":"@property\n    def name_in_broadcast(self)","id":6390,"name":"name_in_broadcast","nodeType":"Function","startLoc":162,"text":"@property\n    def name_in_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_in[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_in\".format(self.name)"},{"col":4,"comment":"null","endLoc":174,"header":"@property\n    def name_out_broadcast(self)","id":6391,"name":"name_out_broadcast","nodeType":"Function","startLoc":169,"text":"@property\n    def name_out_broadcast(self):\n        if len(self.shape) > 0:\n            return \"{0}_out[...{1}]\".format(self.name, \",0\"*len(self.shape))\n        else:\n            return \"{0}_out\".format(self.name)"},{"col":4,"comment":"null","endLoc":178,"header":"@property\n    def dtype(self)","id":6392,"name":"dtype","nodeType":"Function","startLoc":176,"text":"@property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]"},{"col":4,"comment":"null","endLoc":182,"header":"@property\n    def ndim(self)","id":6393,"name":"ndim","nodeType":"Function","startLoc":180,"text":"@property\n    def ndim(self):\n        return len(self.shape)"},{"col":4,"comment":"null","endLoc":186,"header":"@property\n    def cshape(self)","id":6394,"name":"cshape","nodeType":"Function","startLoc":184,"text":"@property\n    def cshape(self):\n        return ''.join(['[{0}]'.format(s) for s in self.shape])"},{"attributeType":"null","col":8,"comment":"null","endLoc":665,"id":6395,"name":"_dst","nodeType":"Attribute","startLoc":665,"text":"self._dst"},{"col":4,"comment":"null","endLoc":193,"header":"@property\n    def name_for_call(self)","id":6396,"name":"name_for_call","nodeType":"Function","startLoc":188,"text":"@property\n    def name_for_call(self):\n        if self.is_ptr:\n            return '_'+self.name\n        else:\n            return '*_'+self.name"},{"col":4,"comment":"null","endLoc":196,"header":"def __repr__(self)","id":6397,"name":"__repr__","nodeType":"Function","startLoc":195,"text":"def __repr__(self):\n        return \"Argument('{0}', name='{1}', ctype='{2}', inout_state='{3}')\".format(self.definition, self.name, self.ctype, self.inout_state)"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":6398,"name":"ctype","nodeType":"Attribute","startLoc":123,"text":"self.ctype"},{"attributeType":"null","col":8,"comment":"null","endLoc":664,"id":6399,"name":"_tzname","nodeType":"Attribute","startLoc":664,"text":"self._tzname"},{"attributeType":"null","col":12,"comment":"null","endLoc":138,"id":6400,"name":"shape","nodeType":"Attribute","startLoc":138,"text":"self.shape"},{"col":4,"comment":"null","endLoc":1284,"header":"def _receive_response(self, private_key, responder_id, msg_tag, response)","id":6401,"name":"_receive_response","nodeType":"Function","startLoc":1283,"text":"def _receive_response(self, private_key, responder_id, msg_tag, response):\n        return \"\""},{"attributeType":"null","col":12,"comment":"null","endLoc":131,"id":6402,"name":"is_ptr","nodeType":"Attribute","startLoc":131,"text":"self.is_ptr"},{"attributeType":"null","col":12,"comment":"null","endLoc":137,"id":6403,"name":"name","nodeType":"Attribute","startLoc":137,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":6404,"name":"doc","nodeType":"Attribute","startLoc":121,"text":"self.doc"},{"attributeType":"None","col":8,"comment":"null","endLoc":122,"id":6405,"name":"__inout_state","nodeType":"Attribute","startLoc":122,"text":"self.__inout_state"},{"col":4,"comment":"null","endLoc":652,"header":"def _ping(self)","id":6406,"name":"_ping","nodeType":"Function","startLoc":649,"text":"def _ping(self):\n        self._update_last_activity_time()\n        log.debug(\"ping\")\n        return \"1\""},{"className":"ReturnDoc","col":0,"comment":"null","endLoc":226,"id":6407,"nodeType":"Class","startLoc":199,"text":"class ReturnDoc:\n\n    def __init__(self, doc):\n        self.doc = doc\n\n        self.infoline = doc.split('\\n')[0].strip()\n        self.type = self.infoline.split()[0]\n        self.descr = self.infoline.split()[1]\n\n        if self.descr.startswith('status'):\n            self.statuscodes = statuscodes = {}\n\n            code = None\n            for line in doc[doc.index(':')+1:].split('\\n'):\n                ls = line.strip()\n                if ls != '':\n                    if ' = ' in ls:\n                        code, msg = ls.split(' = ')\n                        if code != 'else':\n                            code = int(code)\n                        statuscodes[code] = msg\n                    elif code is not None:\n                        statuscodes[code] += ls\n        else:\n            self.statuscodes = None\n\n    def __repr__(self):\n        return \"Return value, type={0:15}, {1}, {2}\".format(self.type, self.descr, self.doc)"},{"col":4,"comment":"null","endLoc":226,"header":"def __repr__(self)","id":6408,"name":"__repr__","nodeType":"Function","startLoc":225,"text":"def __repr__(self):\n        return \"Return value, type={0:15}, {1}, {2}\".format(self.type, self.descr, self.doc)"},{"attributeType":"null","col":8,"comment":"null","endLoc":206,"id":6409,"name":"descr","nodeType":"Attribute","startLoc":206,"text":"self.descr"},{"attributeType":"None","col":12,"comment":"null","endLoc":223,"id":6410,"name":"statuscodes","nodeType":"Attribute","startLoc":223,"text":"self.statuscodes"},{"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    This is a reference implementation can be made much faster with effort.\n    ","endLoc":823,"id":6411,"nodeType":"Class","startLoc":677,"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    This is a reference implementation can be made much faster with effort.\n    \"\"\"\n\n    def _check_val_type(self, val1, val2):\n        # Note: don't care about val2 for these classes\n        if val1.dtype.kind not in ('S', 'U'):\n            raise TypeError('Input values for {0} class must be strings'\n                            .format(self.name))\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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))\n\n    def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set 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                             op_dtypes=[val1.dtype] + 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        self.jd1, self.jd2 = 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)\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        if '{yday:' in str_fmt:\n            has_yday = True\n        else:\n            has_yday = False\n            yday = None\n\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs]):\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    def _select_subfmts(self, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n        \"\"\"\n\n        fnmatchcase = fnmatch.fnmatchcase\n        subfmts = [x for x in self.subfmts if fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            raise ValueError('No subformats match {0}'.format(pattern))\n        return subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":98,"id":6412,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":98,"text":"attrs_from_parent"},{"attributeType":"null","col":8,"comment":"null","endLoc":204,"id":6413,"name":"infoline","nodeType":"Attribute","startLoc":204,"text":"self.infoline"},{"attributeType":"{split}","col":8,"comment":"null","endLoc":202,"id":6414,"name":"doc","nodeType":"Attribute","startLoc":202,"text":"self.doc"},{"attributeType":"null","col":8,"comment":"null","endLoc":205,"id":6415,"name":"type","nodeType":"Attribute","startLoc":205,"text":"self.type"},{"col":4,"comment":"\n        The hub parameters (which are written to the logfile)\n        ","endLoc":427,"header":"@property\n    def params(self)","id":6416,"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 \"Hub {0}\".format(self.id)\n\n        return params"},{"col":4,"comment":"null","endLoc":3166,"header":"def to_xml(self, w, **kwargs)","id":6417,"name":"to_xml","nodeType":"Function","startLoc":3156,"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.params,\n                                self.infos, self.links, self.tables,\n                                self.resources):\n                for element in element_set:\n                    element.to_xml(w, **kwargs)"},{"className":"Return","col":0,"comment":"null","endLoc":257,"id":6418,"nodeType":"Class","startLoc":229,"text":"class Return:\n\n    def __init__(self, ctype, doc):\n        self.name = 'c_retval'\n        self.name_out_broadcast = self.name+\"_out\"\n        self.inout_state = 'stat' if ctype == 'int' else 'ret'\n        self.ctype = ctype\n        self.ctype_ptr = ctype\n        self.shape = ()\n        self.doc = doc\n\n    def __repr__(self):\n        return \"Return(name='{0}', ctype='{1}', inout_state='{2}')\".format(self.name, self.ctype, self.inout_state)\n\n    @property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]\n\n    @property\n    def nd_dtype(self):\n        \"\"\"\n        This if the return type has a multi-dimensional output, like\n        double[3][3]\n        \"\"\"\n        return \"'fi0'\" in self.dtype\n\n    @property\n    def doc_info(self):\n        return self.doc.ret_info"},{"col":4,"comment":"null","endLoc":238,"header":"def __init__(self, ctype, doc)","id":6419,"name":"__init__","nodeType":"Function","startLoc":231,"text":"def __init__(self, ctype, doc):\n        self.name = 'c_retval'\n        self.name_out_broadcast = self.name+\"_out\"\n        self.inout_state = 'stat' if ctype == 'int' else 'ret'\n        self.ctype = ctype\n        self.ctype_ptr = ctype\n        self.shape = ()\n        self.doc = doc"},{"col":4,"comment":"null","endLoc":241,"header":"def __repr__(self)","id":6420,"name":"__repr__","nodeType":"Function","startLoc":240,"text":"def __repr__(self):\n        return \"Return(name='{0}', ctype='{1}', inout_state='{2}')\".format(self.name, self.ctype, self.inout_state)"},{"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":6421,"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":6422,"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(\"Call to select() in SAMPHubServer failed: {0}\".format(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(\"Call to select() in SAMPHubServer failed: {0}\".format(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()"},{"col":4,"comment":"null","endLoc":245,"header":"@property\n    def dtype(self)","id":6423,"name":"dtype","nodeType":"Function","startLoc":243,"text":"@property\n    def dtype(self):\n        return ctype_to_dtype[self.ctype]"},{"col":4,"comment":"null","endLoc":692,"header":"def _check_val_type(self, val1, val2)","id":6424,"name":"_check_val_type","nodeType":"Function","startLoc":687,"text":"def _check_val_type(self, val1, val2):\n        # Note: don't care about val2 for these classes\n        if val1.dtype.kind not in ('S', 'U'):\n            raise TypeError('Input values for {0} class must be strings'\n                            .format(self.name))\n        return val1, None"},{"col":4,"comment":"\n        This if the return type has a multi-dimensional output, like\n        double[3][3]\n        ","endLoc":253,"header":"@property\n    def nd_dtype(self)","id":6425,"name":"nd_dtype","nodeType":"Function","startLoc":247,"text":"@property\n    def nd_dtype(self):\n        \"\"\"\n        This if the return type has a multi-dimensional output, like\n        double[3][3]\n        \"\"\"\n        return \"'fi0'\" in self.dtype"},{"col":4,"comment":"null","endLoc":257,"header":"@property\n    def doc_info(self)","id":6426,"name":"doc_info","nodeType":"Function","startLoc":255,"text":"@property\n    def doc_info(self):\n        return self.doc.ret_info"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":6427,"name":"inout_state","nodeType":"Attribute","startLoc":234,"text":"self.inout_state"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":6428,"name":"attr_names","nodeType":"Attribute","startLoc":99,"text":"attr_names"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":236,"id":6429,"name":"ctype_ptr","nodeType":"Attribute","startLoc":236,"text":"self.ctype_ptr"},{"col":4,"comment":"Read time from a single string, using a set of possible formats.","endLoc":733,"header":"def parse_string(self, timestr, subfmts)","id":6430,"name":"parse_string","nodeType":"Function","startLoc":694,"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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))"},{"attributeType":"null","col":4,"comment":"null","endLoc":100,"id":6431,"name":"_supports_indexing","nodeType":"Attribute","startLoc":100,"text":"_supports_indexing"},{"attributeType":"null","col":4,"comment":"null","endLoc":104,"id":6432,"name":"_represent_as_dict_extra_attrs","nodeType":"Attribute","startLoc":104,"text":"_represent_as_dict_extra_attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":139,"id":6433,"name":"info_summary_stats","nodeType":"Attribute","startLoc":139,"text":"info_summary_stats"},{"attributeType":"{__eq__}","col":8,"comment":"null","endLoc":235,"id":6434,"name":"ctype","nodeType":"Attribute","startLoc":235,"text":"self.ctype"},{"attributeType":"null","col":12,"comment":"null","endLoc":129,"id":6435,"name":"serialize_method","nodeType":"Attribute","startLoc":129,"text":"self.serialize_method"},{"attributeType":"null","col":8,"comment":"null","endLoc":237,"id":6436,"name":"shape","nodeType":"Attribute","startLoc":237,"text":"self.shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":6437,"name":"name_out_broadcast","nodeType":"Attribute","startLoc":233,"text":"self.name_out_broadcast"},{"className":"TimeDeltaInfo","col":0,"comment":"null","endLoc":177,"id":6438,"nodeType":"Class","startLoc":173,"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)"},{"col":4,"comment":"null","endLoc":177,"header":"def _construct_from_dict(self, map)","id":6439,"name":"_construct_from_dict","nodeType":"Function","startLoc":176,"text":"def _construct_from_dict(self, map):\n        return self._construct_from_dict_base(map)"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":6440,"name":"name","nodeType":"Attribute","startLoc":232,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":238,"id":6441,"name":"doc","nodeType":"Attribute","startLoc":238,"text":"self.doc"},{"attributeType":"null","col":4,"comment":"null","endLoc":174,"id":6442,"name":"_represent_as_dict_extra_attrs","nodeType":"Attribute","startLoc":174,"text":"_represent_as_dict_extra_attrs"},{"className":"OperandTypeError","col":0,"comment":"null","endLoc":1754,"id":6443,"nodeType":"Class","startLoc":1747,"text":"class OperandTypeError(TypeError):\n    def __init__(self, left, right, op=None):\n        op_string = '' if op is None else ' for {0}'.format(op)\n        super().__init__(\n            \"Unsupported operand type(s){0}: \"\n            \"'{1}' and '{2}'\".format(op_string,\n                                     left.__class__.__name__,\n                                     right.__class__.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":6444,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":6445,"name":"MULTI_HOPS","nodeType":"Attribute","startLoc":38,"text":"MULTI_HOPS"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":6446,"name":"GEOCENTRIC_SCALES","nodeType":"Attribute","startLoc":54,"text":"GEOCENTRIC_SCALES"},{"className":"Function","col":0,"comment":"\n    A class representing a C function.\n\n    Parameters\n    ----------\n    name : str\n        The name of the function\n    source_path : str\n        Either a directory, which means look for the function in a\n        stand-alone file (like for the standard ERFA distribution), or a\n        file, which means look for the function in that file (as for the\n        astropy-packaged single-file erfa.c).\n    match_line : str, optional\n        If given, searching of the source file will skip until it finds\n        a line matching this string, and start from there.\n    ","endLoc":346,"id":6447,"nodeType":"Class","startLoc":260,"text":"class Function:\n    \"\"\"\n    A class representing a C function.\n\n    Parameters\n    ----------\n    name : str\n        The name of the function\n    source_path : str\n        Either a directory, which means look for the function in a\n        stand-alone file (like for the standard ERFA distribution), or a\n        file, which means look for the function in that file (as for the\n        astropy-packaged single-file erfa.c).\n    match_line : str, optional\n        If given, searching of the source file will skip until it finds\n        a line matching this string, and start from there.\n    \"\"\"\n\n    def __init__(self, name, source_path, match_line=None):\n        self.name = name\n        self.pyname = name.split('era')[-1].lower()\n        self.filename = self.pyname+\".c\"\n        if os.path.isdir(source_path):\n            self.filepath = os.path.join(os.path.normpath(source_path), self.filename)\n        else:\n            self.filepath = source_path\n\n        with open(self.filepath) as f:\n            if match_line:\n                line = f.readline()\n                while line != '':\n                    if line.startswith(match_line):\n                        filecontents = '\\n' + line + f.read()\n                        break\n                    line = f.readline()\n                else:\n                    msg = ('Could not find the match_line \"{0}\" in '\n                           'the source file \"{1}\"')\n                    raise ValueError(msg.format(match_line, self.filepath))\n            else:\n                filecontents = f.read()\n\n        pattern = r\"\\n([^\\n]+{0} ?\\([^)]+\\)).+?(/\\*.+?\\*/)\".format(name)\n        p = re.compile(pattern, flags=re.DOTALL | re.MULTILINE)\n\n        search = p.search(filecontents)\n        self.cfunc = \" \".join(search.group(1).split())\n        self.doc = FunctionDoc(search.group(2))\n\n        self.args = []\n        for arg in re.search(r\"\\(([^)]+)\\)\", self.cfunc).group(1).split(', '):\n            self.args.append(Argument(arg, self.doc))\n        self.ret = re.search(\"^(.*){0}\".format(name), self.cfunc).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))\n\n    def args_by_inout(self, inout_filter, prop=None, join=None):\n        \"\"\"\n        Gives all of the arguments and/or returned values, depending on whether\n        they are inputs, outputs, etc.\n\n        The value for `inout_filter` should be a string containing anything\n        that arguments' `inout_state` attribute produces.  Currently, that can be:\n\n          * \"in\" : input\n          * \"out\" : output\n          * \"inout\" : something that's could be input or output (e.g. a struct)\n          * \"ret\" : the return value of the C function\n          * \"stat\" : the return value of the C function if it is a status code\n\n        It can also be a \"|\"-separated string giving inout states to OR\n        together.\n        \"\"\"\n        result = []\n        for arg in self.args:\n            if arg.inout_state in inout_filter.split('|'):\n                if prop is None:\n                    result.append(arg)\n                else:\n                    result.append(getattr(arg, prop))\n        if join is not None:\n            return join.join(result)\n        else:\n            return result\n\n    def __repr__(self):\n        return \"Function(name='{0}', pyname='{1}', filename='{2}', filepath='{3}')\".format(self.name, self.pyname, self.filename, self.filepath)"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":6448,"name":"ROTATIONAL_SCALES","nodeType":"Attribute","startLoc":56,"text":"ROTATIONAL_SCALES"},{"col":4,"comment":"null","endLoc":314,"header":"def __init__(self, name, source_path, match_line=None)","id":6449,"name":"__init__","nodeType":"Function","startLoc":278,"text":"def __init__(self, name, source_path, match_line=None):\n        self.name = name\n        self.pyname = name.split('era')[-1].lower()\n        self.filename = self.pyname+\".c\"\n        if os.path.isdir(source_path):\n            self.filepath = os.path.join(os.path.normpath(source_path), self.filename)\n        else:\n            self.filepath = source_path\n\n        with open(self.filepath) as f:\n            if match_line:\n                line = f.readline()\n                while line != '':\n                    if line.startswith(match_line):\n                        filecontents = '\\n' + line + f.read()\n                        break\n                    line = f.readline()\n                else:\n                    msg = ('Could not find the match_line \"{0}\" in '\n                           'the source file \"{1}\"')\n                    raise ValueError(msg.format(match_line, self.filepath))\n            else:\n                filecontents = f.read()\n\n        pattern = r\"\\n([^\\n]+{0} ?\\([^)]+\\)).+?(/\\*.+?\\*/)\".format(name)\n        p = re.compile(pattern, flags=re.DOTALL | re.MULTILINE)\n\n        search = p.search(filecontents)\n        self.cfunc = \" \".join(search.group(1).split())\n        self.doc = FunctionDoc(search.group(2))\n\n        self.args = []\n        for arg in re.search(r\"\\(([^)]+)\\)\", self.cfunc).group(1).split(', '):\n            self.args.append(Argument(arg, self.doc))\n        self.ret = re.search(\"^(.*){0}\".format(name), self.cfunc).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":6450,"name":"TIME_DELTA_TYPES","nodeType":"Attribute","startLoc":57,"text":"TIME_DELTA_TYPES"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":6451,"name":"SCALE_OFFSETS","nodeType":"Attribute","startLoc":70,"text":"SCALE_OFFSETS"},{"attributeType":"null","col":0,"comment":"null","endLoc":80,"id":6452,"name":"SIDEREAL_TIME_MODELS","nodeType":"Attribute","startLoc":80,"text":"SIDEREAL_TIME_MODELS"},{"col":0,"comment":"","endLoc":8,"header":"core.py#<anonymous>","id":6453,"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__ = ['Time', 'TimeDelta', 'TIME_SCALES', 'TIME_DELTA_SCALES',\n           'ScaleValueError', 'OperandTypeError', 'TimeInfo']\n\nTIME_SCALES = ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')\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) for scale in scales)\n\nTIME_DELTA_SCALES = TIME_DELTA_TYPES.keys()\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',)}},\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',)}}}"},{"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{\\Sigma_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\Sigma_{|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    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\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 : int, optional\n        The axis along which the biweight locations are computed.  If\n        `None` (default), then the biweight location of the flattened\n        input array will be computed.\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biloc = biweight_location(rand.randn(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    -0.0175741540445\n    ","endLoc":114,"header":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_location(data, c=6.0, M=None, axis=None)","id":6454,"name":"biweight_location","nodeType":"Function","startLoc":18,"text":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_location(data, c=6.0, M=None, axis=None):\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{\\Sigma_{|u_i|<1} \\ (x_i - M) (1 - u_i^2)^2}\n            {\\Sigma_{|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    Parameters\n    ----------\n    data : array-like\n        Input array or object that can be converted to an array.\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 : int, optional\n        The axis along which the biweight locations are computed.  If\n        `None` (default), then the biweight location of the flattened\n        input array will be computed.\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biloc = biweight_location(rand.randn(1000))\n    >>> print(biloc)    # doctest: +FLOAT_CMP\n    -0.0175741540445\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = np.median(data, axis=axis)\n    if axis is not None:\n        M = np.expand_dims(M, axis=axis)\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis)\n    if axis is not None:\n        mad = np.expand_dims(mad, axis=axis)\n    u = d / (c * mad)\n\n    # now remove the outlier points\n    mask = (np.abs(u) >= 1)\n    u = (1 - u ** 2) ** 2\n    u[mask] = 0\n\n    return M.squeeze() + (d * u).sum(axis=axis) / u.sum(axis=axis)"},{"fileName":"spatial.py","filePath":"astropy/stats","id":6455,"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\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       <http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1980lssu.book.....P&db_key=AST>\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('area is expected to be a positive number. '\n                             'Got {}.'.format(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('y_min is expected to be a real number. '\n                             'Got {}.'.format(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('x_min is expected to be a real number. '\n                             'Got {}.'.format(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 homongeneous 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 weigth 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 * (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('mode {} is not implemented.'.format(mode))\n\n        return ripley\n"},{"col":4,"comment":"null","endLoc":792,"header":"def _get_metadata(self, private_key, client_id)","id":6456,"name":"_get_metadata","nodeType":"Function","startLoc":775,"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(\"--> metadata = {}\"\n                              .format(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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"col":4,"comment":"Parse the time strings contained in val1 and set jd1, jd2","endLoc":753,"header":"def set_jds(self, val1, val2)","id":6457,"name":"set_jds","nodeType":"Function","startLoc":735,"text":"def set_jds(self, val1, val2):\n        \"\"\"Parse the time strings contained in val1 and set 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                             op_dtypes=[val1.dtype] + 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        self.jd1, self.jd2 = day_frac(jd1, jd2)"},{"col":4,"comment":"null","endLoc":866,"header":"def _get_subscriptions(self, private_key, client_id)","id":6458,"name":"_get_subscriptions","nodeType":"Function","startLoc":846,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"col":4,"comment":"\n        Recursively iterates over all tables in the resource and\n        nested resources.\n        ","endLoc":3177,"header":"def iter_tables(self)","id":6459,"name":"iter_tables","nodeType":"Function","startLoc":3168,"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"},{"col":4,"comment":"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n        ","endLoc":823,"header":"def _select_subfmts(self, pattern)","id":6460,"name":"_select_subfmts","nodeType":"Function","startLoc":813,"text":"def _select_subfmts(self, pattern):\n        \"\"\"\n        Return a list of subformats where name matches ``pattern`` using\n        fnmatch.\n        \"\"\"\n\n        fnmatchcase = fnmatch.fnmatchcase\n        subfmts = [x for x in self.subfmts if fnmatchcase(x[0], pattern)]\n        if len(subfmts) == 0:\n            raise ValueError('No subformats match {0}'.format(pattern))\n        return subfmts"},{"col":21,"endLoc":743,"id":6461,"nodeType":"Lambda","startLoc":743,"text":"lambda x: str(x.item(), encoding='ascii')"},{"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       <http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1980lssu.book.....P&db_key=AST>\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":329,"id":6462,"nodeType":"Class","startLoc":11,"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       <http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1980lssu.book.....P&db_key=AST>\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('area is expected to be a positive number. '\n                             'Got {}.'.format(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('y_min is expected to be a real number. '\n                             'Got {}.'.format(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('x_min is expected to be a real number. '\n                             'Got {}.'.format(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 homongeneous 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 weigth 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 * (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('mode {} is not implemented.'.format(mode))\n\n        return ripley"},{"col":4,"comment":"null","endLoc":63,"header":"def __init__(self, area, x_max=None, y_max=None, x_min=None, y_min=None)","id":6463,"name":"__init__","nodeType":"Function","startLoc":58,"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":67,"header":"@property\n    def area(self)","id":6464,"name":"area","nodeType":"Function","startLoc":65,"text":"@property\n    def area(self):\n        return self._area"},{"col":4,"comment":"null","endLoc":75,"header":"@area.setter\n    def area(self, value)","id":6465,"name":"area","nodeType":"Function","startLoc":69,"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('area is expected to be a positive number. '\n                             'Got {}.'.format(value))"},{"col":4,"comment":"\n        Recursively iterates over all FIELD_ and PARAM_ elements in\n        the resource, its tables and nested resources.\n        ","endLoc":3191,"header":"def iter_fields_and_params(self)","id":6466,"name":"iter_fields_and_params","nodeType":"Function","startLoc":3179,"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":3202,"header":"def iter_coosys(self)","id":6467,"name":"iter_coosys","nodeType":"Function","startLoc":3193,"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        Generator that yields a dict of values corresponding to the\n        calendar date and time for the internal JD values.\n        ","endLoc":784,"header":"def str_kwargs(self)","id":6468,"name":"str_kwargs","nodeType":"Function","startLoc":755,"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)\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        if '{yday:' in str_fmt:\n            has_yday = True\n        else:\n            has_yday = False\n            yday = None\n\n        ihrs = ihmsfs[..., 0]\n        imins = ihmsfs[..., 1]\n        isecs = ihmsfs[..., 2]\n        ifracs = ihmsfs[..., 3]\n        for iy, im, id, ihr, imin, isec, ifracsec in np.nditer(\n                [iys, ims, ids, ihrs, imins, isecs, ifracs]):\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":"\n        Recursively iterates over all the INFO_ elements in the\n        resource and nested resources.\n        ","endLoc":3216,"header":"def iter_info(self)","id":6469,"name":"iter_info","nodeType":"Function","startLoc":3204,"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":4,"comment":"\n        Gives all of the arguments and/or returned values, depending on whether\n        they are inputs, outputs, etc.\n\n        The value for `inout_filter` should be a string containing anything\n        that arguments' `inout_state` attribute produces.  Currently, that can be:\n\n          * \"in\" : input\n          * \"out\" : output\n          * \"inout\" : something that's could be input or output (e.g. a struct)\n          * \"ret\" : the return value of the C function\n          * \"stat\" : the return value of the C function if it is a status code\n\n        It can also be a \"|\"-separated string giving inout states to OR\n        together.\n        ","endLoc":343,"header":"def args_by_inout(self, inout_filter, prop=None, join=None)","id":6470,"name":"args_by_inout","nodeType":"Function","startLoc":316,"text":"def args_by_inout(self, inout_filter, prop=None, join=None):\n        \"\"\"\n        Gives all of the arguments and/or returned values, depending on whether\n        they are inputs, outputs, etc.\n\n        The value for `inout_filter` should be a string containing anything\n        that arguments' `inout_state` attribute produces.  Currently, that can be:\n\n          * \"in\" : input\n          * \"out\" : output\n          * \"inout\" : something that's could be input or output (e.g. a struct)\n          * \"ret\" : the return value of the C function\n          * \"stat\" : the return value of the C function if it is a status code\n\n        It can also be a \"|\"-separated string giving inout states to OR\n        together.\n        \"\"\"\n        result = []\n        for arg in self.args:\n            if arg.inout_state in inout_filter.split('|'):\n                if prop is None:\n                    result.append(arg)\n                else:\n                    result.append(getattr(arg, prop))\n        if join is not None:\n            return join.join(result)\n        else:\n            return result"},{"col":4,"comment":"null","endLoc":79,"header":"@property\n    def y_max(self)","id":6471,"name":"y_max","nodeType":"Function","startLoc":77,"text":"@property\n    def y_max(self):\n        return self._y_max"},{"col":4,"comment":"null","endLoc":882,"header":"def _get_registered_clients(self, private_key)","id":6472,"name":"_get_registered_clients","nodeType":"Function","startLoc":868,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"col":4,"comment":"null","endLoc":87,"header":"@y_max.setter\n    def y_max(self, value)","id":6473,"name":"y_max","nodeType":"Function","startLoc":81,"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))"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2994,"id":6474,"name":"_tables","nodeType":"Attribute","startLoc":2994,"text":"self._tables"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2993,"id":6475,"name":"_links","nodeType":"Attribute","startLoc":2993,"text":"self._links"},{"attributeType":"null","col":8,"comment":"null","endLoc":2986,"id":6476,"name":"_extra_attributes","nodeType":"Attribute","startLoc":2986,"text":"self._extra_attributes"},{"col":4,"comment":"null","endLoc":91,"header":"@property\n    def x_max(self)","id":6477,"name":"x_max","nodeType":"Function","startLoc":89,"text":"@property\n    def x_max(self):\n        return self._x_max"},{"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":792,"header":"def format_string(self, str_fmt, **kwargs)","id":6478,"name":"format_string","nodeType":"Function","startLoc":786,"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":346,"header":"def __repr__(self)","id":6479,"name":"__repr__","nodeType":"Function","startLoc":345,"text":"def __repr__(self):\n        return \"Function(name='{0}', pyname='{1}', filename='{2}', filepath='{3}')\".format(self.name, self.pyname, self.filename, self.filepath)"},{"attributeType":"null","col":8,"comment":"null","endLoc":309,"id":6480,"name":"args","nodeType":"Attribute","startLoc":309,"text":"self.args"},{"attributeType":"null","col":8,"comment":"null","endLoc":312,"id":6481,"name":"ret","nodeType":"Attribute","startLoc":312,"text":"self.ret"},{"attributeType":"null","col":8,"comment":"null","endLoc":281,"id":6482,"name":"filename","nodeType":"Attribute","startLoc":281,"text":"self.filename"},{"attributeType":"null","col":8,"comment":"null","endLoc":2984,"id":6483,"name":"utype","nodeType":"Attribute","startLoc":2984,"text":"self.utype"},{"col":4,"comment":"null","endLoc":811,"header":"@property\n    def value(self)","id":6484,"name":"value","nodeType":"Function","startLoc":794,"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":3024,"id":6485,"name":"_type","nodeType":"Attribute","startLoc":3024,"text":"self._type"},{"attributeType":"null","col":12,"comment":"null","endLoc":285,"id":6486,"name":"filepath","nodeType":"Attribute","startLoc":285,"text":"self.filepath"},{"col":4,"comment":"null","endLoc":99,"header":"@x_max.setter\n    def x_max(self, value)","id":6487,"name":"x_max","nodeType":"Function","startLoc":93,"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":103,"header":"@property\n    def y_min(self)","id":6488,"name":"y_min","nodeType":"Function","startLoc":101,"text":"@property\n    def y_min(self):\n        return self._y_min"},{"col":4,"comment":"null","endLoc":111,"header":"@y_min.setter\n    def y_min(self, value)","id":6489,"name":"y_min","nodeType":"Function","startLoc":105,"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('y_min is expected to be a real number. '\n                             'Got {}.'.format(value))"},{"col":4,"comment":"null","endLoc":115,"header":"@property\n    def x_min(self)","id":6490,"name":"x_min","nodeType":"Function","startLoc":113,"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":6491,"name":"x_min","nodeType":"Function","startLoc":117,"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('x_min is expected to be a real number. '\n                             'Got {}.'.format(value))"},{"col":4,"comment":"null","endLoc":126,"header":"def __call__(self, data, radii, mode='none')","id":6492,"name":"__call__","nodeType":"Function","startLoc":125,"text":"def __call__(self, data, radii, mode='none'):\n        return self.evaluate(data=data, radii=radii, mode=mode)"},{"attributeType":"None","col":8,"comment":"null","endLoc":2987,"id":6493,"name":"description","nodeType":"Attribute","startLoc":2987,"text":"self.description"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2995,"id":6494,"name":"_resources","nodeType":"Attribute","startLoc":2995,"text":"self._resources"},{"attributeType":"null","col":8,"comment":"null","endLoc":2985,"id":6495,"name":"type","nodeType":"Attribute","startLoc":2985,"text":"self.type"},{"attributeType":"null","col":8,"comment":"null","endLoc":2978,"id":6496,"name":"_config","nodeType":"Attribute","startLoc":2978,"text":"self._config"},{"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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight scales are computed.  If\n        `None` (default), then the biweight scale of the flattened input\n        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\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biscl = biweight_scale(rand.randn(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    0.986726249291\n    ","endLoc":221,"header":"def biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=False)","id":6497,"name":"biweight_scale","nodeType":"Function","startLoc":117,"text":"def biweight_scale(data, c=9.0, M=None, axis=None, modify_sample_size=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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4}} {|(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight scales are computed.  If\n        `None` (default), then the biweight scale of the flattened input\n        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\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) (http://adsabs.harvard.edu/abs/1990AJ....100...32B)\n\n    .. [2] http://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.RandomState(12345)\n    >>> biscl = biweight_scale(rand.randn(1000))\n    >>> print(biscl)    # doctest: +FLOAT_CMP\n    0.986726249291\n    \"\"\"\n\n    return np.sqrt(\n        biweight_midvariance(data, c=c, M=M, axis=axis,\n                             modify_sample_size=modify_sample_size))"},{"attributeType":"null","col":8,"comment":"null","endLoc":306,"id":6498,"name":"cfunc","nodeType":"Attribute","startLoc":306,"text":"self.cfunc"},{"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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight midvariances are computed.  If\n        `None` (default), then the biweight midvariance 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        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\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) (http://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.RandomState(12345)\n    >>> bivar = biweight_midvariance(rand.randn(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    0.97362869104\n    ","endLoc":362,"header":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=False)","id":6499,"name":"biweight_midvariance","nodeType":"Function","startLoc":224,"text":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_midvariance(data, c=9.0, M=None, axis=None,\n                         modify_sample_size=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{\\Sigma_{|u_i| < 1} \\\n            (x_i - M)^2 (1 - u_i^2)^4} {(\\Sigma_{|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    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 = \\Sigma_{|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    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 : int, optional\n        The axis along which the biweight midvariances are computed.  If\n        `None` (default), then the biweight midvariance 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        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\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) (http://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.RandomState(12345)\n    >>> bivar = biweight_midvariance(rand.randn(1000))\n    >>> print(bivar)    # doctest: +FLOAT_CMP\n    0.97362869104\n    \"\"\"\n\n    data = np.asanyarray(data).astype(np.float64)\n\n    if M is None:\n        M = np.median(data, axis=axis)\n    if axis is not None:\n        M = np.expand_dims(M, axis=axis)\n\n    # set up the differences\n    d = data - M\n\n    # set up the weighting\n    mad = median_absolute_deviation(data, axis=axis)\n    if axis is not None:\n        mad = np.expand_dims(mad, axis=axis)\n    u = d / (c * mad)\n\n    # now remove the outlier points\n    mask = np.abs(u) < 1\n    u = u ** 2\n\n    if modify_sample_size:\n        n = mask.sum(axis=axis)\n    else:\n        if axis is None:\n            n = data.size\n        else:\n            n = data.shape[axis]\n\n    f1 = d * d * (1. - u)**4\n    f1[~mask] = 0.\n    f1 = f1.sum(axis=axis)\n    f2 = (1. - u) * (1. - 5.*u)\n    f2[~mask] = 0.\n    f2 = np.abs(f2.sum(axis=axis))**2\n\n    return n * f1 / f2"},{"attributeType":"null","col":8,"comment":"null","endLoc":753,"id":6500,"name":"jd1","nodeType":"Attribute","startLoc":753,"text":"self.jd1"},{"col":4,"comment":"null","endLoc":900,"header":"def _get_subscribed_clients(self, private_key, mtype)","id":6501,"name":"_get_subscribed_clients","nodeType":"Function","startLoc":884,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"attributeType":"null","col":18,"comment":"null","endLoc":753,"id":6502,"name":"jd2","nodeType":"Attribute","startLoc":753,"text":"self.jd2"},{"attributeType":"null","col":8,"comment":"null","endLoc":279,"id":6503,"name":"name","nodeType":"Attribute","startLoc":279,"text":"self.name"},{"attributeType":"FunctionDoc","col":8,"comment":"null","endLoc":307,"id":6504,"name":"doc","nodeType":"Attribute","startLoc":307,"text":"self.doc"},{"attributeType":"null","col":8,"comment":"null","endLoc":280,"id":6505,"name":"pyname","nodeType":"Attribute","startLoc":280,"text":"self.pyname"},{"className":"Constant","col":0,"comment":"null","endLoc":354,"id":6506,"nodeType":"Class","startLoc":349,"text":"class Constant:\n\n    def __init__(self, name, value, doc):\n        self.name = name.replace(\"ERFA_\", \"\")\n        self.value = value.replace(\"ERFA_\", \"\")\n        self.doc = doc"},{"col":4,"comment":"null","endLoc":354,"header":"def __init__(self, name, value, doc)","id":6507,"name":"__init__","nodeType":"Function","startLoc":351,"text":"def __init__(self, name, value, doc):\n        self.name = name.replace(\"ERFA_\", \"\")\n        self.value = value.replace(\"ERFA_\", \"\")\n        self.doc = doc"},{"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":857,"id":6508,"nodeType":"Class","startLoc":826,"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    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)"},{"col":4,"comment":"null","endLoc":857,"header":"def parse_string(self, timestr, subfmts)","id":6509,"name":"parse_string","nodeType":"Function","startLoc":850,"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":"null","col":8,"comment":"null","endLoc":352,"id":6510,"name":"name","nodeType":"Attribute","startLoc":352,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":354,"id":6511,"name":"doc","nodeType":"Attribute","startLoc":354,"text":"self.doc"},{"attributeType":"null","col":8,"comment":"null","endLoc":353,"id":6512,"name":"value","nodeType":"Attribute","startLoc":353,"text":"self.value"},{"attributeType":"null","col":4,"comment":"null","endLoc":838,"id":6513,"name":"name","nodeType":"Attribute","startLoc":838,"text":"name"},{"className":"ExtraFunction","col":0,"comment":"\n    An \"extra\" function - e.g. one not following the SOFA/ERFA standard format.\n\n    Parameters\n    ----------\n    cname : str\n        The name of the function in C\n    prototype : str\n        The prototype for the function (usually derived from the header)\n    pathfordoc : str\n        The path to a file that contains the prototype, with the documentation\n        as a multiline string *before* it.\n    ","endLoc":419,"id":6514,"nodeType":"Class","startLoc":357,"text":"class ExtraFunction(Function):\n    \"\"\"\n    An \"extra\" function - e.g. one not following the SOFA/ERFA standard format.\n\n    Parameters\n    ----------\n    cname : str\n        The name of the function in C\n    prototype : str\n        The prototype for the function (usually derived from the header)\n    pathfordoc : str\n        The path to a file that contains the prototype, with the documentation\n        as a multiline string *before* it.\n    \"\"\"\n\n    def __init__(self, cname, prototype, pathfordoc):\n        self.name = cname\n        self.pyname = cname.split('era')[-1].lower()\n        self.filepath, self.filename = os.path.split(pathfordoc)\n\n        self.prototype = prototype.strip()\n        if prototype.endswith('{') or prototype.endswith(';'):\n            self.prototype = prototype[:-1].strip()\n\n        incomment = False\n        lastcomment = None\n        with open(pathfordoc, 'r') as f:\n            for l in f:\n                if incomment:\n                    if l.lstrip().startswith('*/'):\n                        incomment = False\n                        lastcomment = ''.join(lastcomment)\n                    else:\n                        if l.startswith('**'):\n                            l = l[2:]\n                        lastcomment.append(l)\n                else:\n                    if l.lstrip().startswith('/*'):\n                        incomment = True\n                        lastcomment = []\n                    if l.startswith(self.prototype):\n                        self.doc = lastcomment\n                        break\n            else:\n                raise ValueError('Did not find prototype {} in file '\n                                 '{}'.format(self.prototype, pathfordoc))\n\n        self.args = []\n        argset = re.search(r\"{0}\\(([^)]+)?\\)\".format(self.name),\n                           self.prototype).group(1)\n        if argset is not None:\n            for arg in argset.split(', '):\n                self.args.append(Argument(arg, self.doc))\n        self.ret = re.match(\"^(.*){0}\".format(self.name),\n                            self.prototype).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))\n\n    def __repr__(self):\n        r = super().__repr__()\n        if r.startswith('Function'):\n            r = 'Extra' + r\n        return r"},{"attributeType":"null","col":4,"comment":"null","endLoc":839,"id":6515,"name":"subfmts","nodeType":"Attribute","startLoc":839,"text":"subfmts"},{"col":4,"comment":"null","endLoc":413,"header":"def __init__(self, cname, prototype, pathfordoc)","id":6516,"name":"__init__","nodeType":"Function","startLoc":372,"text":"def __init__(self, cname, prototype, pathfordoc):\n        self.name = cname\n        self.pyname = cname.split('era')[-1].lower()\n        self.filepath, self.filename = os.path.split(pathfordoc)\n\n        self.prototype = prototype.strip()\n        if prototype.endswith('{') or prototype.endswith(';'):\n            self.prototype = prototype[:-1].strip()\n\n        incomment = False\n        lastcomment = None\n        with open(pathfordoc, 'r') as f:\n            for l in f:\n                if incomment:\n                    if l.lstrip().startswith('*/'):\n                        incomment = False\n                        lastcomment = ''.join(lastcomment)\n                    else:\n                        if l.startswith('**'):\n                            l = l[2:]\n                        lastcomment.append(l)\n                else:\n                    if l.lstrip().startswith('/*'):\n                        incomment = True\n                        lastcomment = []\n                    if l.startswith(self.prototype):\n                        self.doc = lastcomment\n                        break\n            else:\n                raise ValueError('Did not find prototype {} in file '\n                                 '{}'.format(self.prototype, pathfordoc))\n\n        self.args = []\n        argset = re.search(r\"{0}\\(([^)]+)?\\)\".format(self.name),\n                           self.prototype).group(1)\n        if argset is not None:\n            for arg in argset.split(', '):\n                self.args.append(Argument(arg, self.doc))\n        self.ret = re.match(\"^(.*){0}\".format(self.name),\n                            self.prototype).group(1).strip()\n        if self.ret != 'void':\n            self.args.append(Return(self.ret, self.doc))"},{"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":883,"id":6517,"nodeType":"Class","startLoc":860,"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}'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":874,"id":6518,"name":"name","nodeType":"Attribute","startLoc":874,"text":"name"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2992,"id":6519,"name":"_infos","nodeType":"Attribute","startLoc":2992,"text":"self._infos"},{"attributeType":"null","col":4,"comment":"null","endLoc":875,"id":6520,"name":"subfmts","nodeType":"Attribute","startLoc":875,"text":"subfmts"},{"attributeType":"null","col":8,"comment":"null","endLoc":2982,"id":6521,"name":"name","nodeType":"Attribute","startLoc":2982,"text":"self.name"},{"col":4,"comment":"null","endLoc":1008,"header":"def _notify_all(self, private_key, message)","id":6522,"name":"_notify_all","nodeType":"Function","startLoc":998,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"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":908,"id":6523,"nodeType":"Class","startLoc":886,"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}'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":899,"id":6524,"name":"name","nodeType":"Attribute","startLoc":899,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":900,"id":6525,"name":"subfmts","nodeType":"Attribute","startLoc":900,"text":"subfmts"},{"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 \\ \\frac{\\Sigma_{|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            {(\\Sigma_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\Sigma_{|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    For the standard definition of biweight midcovariance :math:`n` is\n    the total number of observations of each variable.  That definition\n    is used if ``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 observations for which :math:`|u_i| < 1` and :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n = \\Sigma_{|u_i| < 1, \\ |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 : `~numpy.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] http://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.RandomState(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.82483155 -0.18961219]\n     [-0.18961219 9.80265764]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))    # doctest: +FLOAT_CMP\n    [ 0.90820237  3.13091961]\n    ","endLoc":554,"header":"@deprecated_renamed_argument('a', 'data', '2.0')\ndef biweight_midcovariance(data, c=9.0, M=None, modify_sample_size=False)","id":6526,"name":"biweight_midcovariance","nodeType":"Function","startLoc":365,"text":"@deprecated_renamed_argument('a', 'data', '2.0')\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 \\ \\frac{\\Sigma_{|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            {(\\Sigma_{|u_i| < 1} \\ (1 - u_i^2) (1 - 5u_i^2))\n            (\\Sigma_{|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    For the standard definition of biweight midcovariance :math:`n` is\n    the total number of observations of each variable.  That definition\n    is used if ``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 observations for which :math:`|u_i| < 1` and :math:`|v_i|\n    < 1`, i.e.\n\n    .. math::\n\n        n = \\Sigma_{|u_i| < 1, \\ |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 : `~numpy.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] http://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.RandomState(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.82483155 -0.18961219]\n     [-0.18961219 9.80265764]]\n    >>> # Print standard deviation estimates\n    >>> print(np.sqrt(bicov.diagonal()))    # doctest: +FLOAT_CMP\n    [ 0.90820237  3.13091961]\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    u = (d.T / (c * mad)).T\n\n    # now remove the outlier points\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    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    return n * (numerator_matrix / denominator_matrix)"},{"className":"TimeFITS","col":0,"comment":"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]][(SCALE[(REALIZATION)])]\".\n\n    ISOT with two extensions:\n    - Can give signed five-digit year (mostly for negative years);\n    - A possible time scale (and realization) appended in parentheses.\n\n    Note: FITS supports some deprecated names for timescales; these are\n    translated to the formal names upon initialization.  Furthermore, any\n    specific realization information is stored only as long as the time scale\n    is not changed.\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":1013,"id":6527,"nodeType":"Class","startLoc":911,"text":"class TimeFITS(TimeString):\n    \"\"\"\n    FITS format: \"[±Y]YYYY-MM-DD[THH:MM:SS[.sss]][(SCALE[(REALIZATION)])]\".\n\n    ISOT with two extensions:\n    - Can give signed five-digit year (mostly for negative years);\n    - A possible time scale (and realization) appended in parentheses.\n\n    Note: FITS supports some deprecated names for timescales; these are\n    translated to the formal names upon initialization.  Furthermore, any\n    specific realization information is stored only as long as the time scale\n    is not changed.\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    subfmts = tuple(\n        (subfmt[0],\n         subfmt[1] + r'(\\((?P<scale>\\w+)(\\((?P<realization>\\w+)\\))?\\))?',\n         subfmt[2]) for subfmt in subfmts)\n    _fits_scale = None\n    _fits_realization = None\n\n    def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and set scale according to trailing scale codes.\"\"\"\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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))\n        tm = tm.groupdict()\n        if tm['scale'] is not None:\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 {0!r} is not in the allowed scales {1}\"\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.  Also store a possible realization,\n            # so we can round-trip (as long as no scale changes are made).\n            fits_realization = (tm['realization'].upper()\n                                if tm['realization'] else None)\n            if self._fits_scale is None:\n                self._fits_scale = fits_scale\n                self._fits_realization = fits_realization\n                if self._scale is None:\n                    self._scale = scale\n            if (scale != self.scale or fits_scale != self._fits_scale or\n                fits_realization != self._fits_realization):\n                raise ValueError(\"Input strings for {0} 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    def format_string(self, str_fmt, **kwargs):\n        \"\"\"Format time-string: append the scale to the normal ISOT format.\"\"\"\n        time_str = super().format_string(str_fmt, **kwargs)\n        if self._fits_scale and self._fits_realization:\n            return '{0}({1}({2}))'.format(time_str, self._fits_scale,\n                                          self._fits_realization)\n        else:\n            return '{0}({1})'.format(time_str, self._scale.upper())\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.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 set scale according to trailing scale codes.","endLoc":993,"header":"def parse_string(self, timestr, subfmts)","id":6528,"name":"parse_string","nodeType":"Function","startLoc":957,"text":"def parse_string(self, timestr, subfmts):\n        \"\"\"Read time and set scale according to trailing scale codes.\"\"\"\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('Time {0} does not match {1} format'\n                             .format(timestr, self.name))\n        tm = tm.groupdict()\n        if tm['scale'] is not None:\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 {0!r} is not in the allowed scales {1}\"\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.  Also store a possible realization,\n            # so we can round-trip (as long as no scale changes are made).\n            fits_realization = (tm['realization'].upper()\n                                if tm['realization'] else None)\n            if self._fits_scale is None:\n                self._fits_scale = fits_scale\n                self._fits_realization = fits_realization\n                if self._scale is None:\n                    self._scale = scale\n            if (scale != self.scale or fits_scale != self._fits_scale or\n                fits_realization != self._fits_realization):\n                raise ValueError(\"Input strings for {0} 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.))]"},{"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 weigth 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":329,"header":"def evaluate(self, data, radii, mode='none')","id":6529,"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 weigth 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 * (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('mode {} is not implemented.'.format(mode))\n\n        return ripley"},{"attributeType":"null","col":8,"comment":"null","endLoc":2979,"id":6530,"name":"_pos","nodeType":"Attribute","startLoc":2979,"text":"self._pos"},{"col":4,"comment":"null","endLoc":1026,"header":"def _notify_all_(self, sender_private_key, message)","id":6531,"name":"_notify_all_","nodeType":"Function","startLoc":1010,"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":1044,"header":"def _call(self, private_key, recipient_id, msg_tag, message)","id":6532,"name":"_call","nodeType":"Function","startLoc":1028,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"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.RandomState(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.0495780713907\n    ","endLoc":642,"header":"def biweight_midcorrelation(x, y, c=9.0, M=None, modify_sample_size=False)","id":6533,"name":"biweight_midcorrelation","nodeType":"Function","startLoc":557,"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.RandomState(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.0495780713907\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]))"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2989,"id":6534,"name":"_coordinate_systems","nodeType":"Attribute","startLoc":2989,"text":"self._coordinate_systems"},{"attributeType":"null","col":8,"comment":"null","endLoc":2983,"id":6535,"name":"ID","nodeType":"Attribute","startLoc":2983,"text":"self.ID"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2990,"id":6536,"name":"_groups","nodeType":"Attribute","startLoc":2990,"text":"self._groups"},{"attributeType":"HomogeneousList","col":8,"comment":"null","endLoc":2991,"id":6537,"name":"_params","nodeType":"Attribute","startLoc":2991,"text":"self._params"},{"attributeType":"null","col":8,"comment":"null","endLoc":3128,"id":6538,"name":"_votable","nodeType":"Attribute","startLoc":3128,"text":"self._votable"},{"col":4,"comment":"Format time-string: append the scale to the normal ISOT format.","endLoc":1002,"header":"def format_string(self, str_fmt, **kwargs)","id":6539,"name":"format_string","nodeType":"Function","startLoc":995,"text":"def format_string(self, str_fmt, **kwargs):\n        \"\"\"Format time-string: append the scale to the normal ISOT format.\"\"\"\n        time_str = super().format_string(str_fmt, **kwargs)\n        if self._fits_scale and self._fits_realization:\n            return '{0}({1}({2}))'.format(time_str, self._fits_scale,\n                                          self._fits_realization)\n        else:\n            return '{0}({1})'.format(time_str, self._scale.upper())"},{"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":134,"header":"def _lookup_by_attr_factory(attr, unique, iterator, element_name, doc)","id":6540,"name":"_lookup_by_attr_factory","nodeType":"Function","startLoc":73,"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                        \"{} references itself\".format(element_name),\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":0,"comment":"\n    Like `_lookup_by_attr_factory`, but looks in both the \"ID\" and\n    \"name\" attributes.\n    ","endLoc":165,"header":"def _lookup_by_id_or_name_factory(iterator, element_name, doc)","id":6542,"name":"_lookup_by_id_or_name_factory","nodeType":"Function","startLoc":137,"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                        \"{} references itself\".format(element_name),\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":"Convert times to strings, using signed 5 digit if necessary.","endLoc":1013,"header":"@property\n    def value(self)","id":6543,"name":"value","nodeType":"Function","startLoc":1004,"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.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":137,"header":"def _pairwise_diffs(self, data)","id":6544,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":15,"id":6545,"name":"np","nodeType":"Attribute","startLoc":15,"text":"np"},{"attributeType":"null","col":31,"comment":"null","endLoc":20,"id":6546,"name":"astropy_version","nodeType":"Attribute","startLoc":20,"text":"astropy_version"},{"attributeType":"null","col":21,"comment":"null","endLoc":33,"id":6547,"name":"ucd_mod","nodeType":"Attribute","startLoc":33,"text":"ucd_mod"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":6548,"name":"_has_c_tabledata_writer","nodeType":"Attribute","startLoc":39,"text":"_has_c_tabledata_writer"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":6549,"name":"_has_c_tabledata_writer","nodeType":"Attribute","startLoc":41,"text":"_has_c_tabledata_writer"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":6550,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":6551,"name":"__all__","nodeType":"Attribute","startLoc":44,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":6552,"name":"DEFAULT_CHUNK_SIZE","nodeType":"Attribute","startLoc":53,"text":"DEFAULT_CHUNK_SIZE"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":6553,"name":"RESIZE_AMOUNT","nodeType":"Attribute","startLoc":54,"text":"RESIZE_AMOUNT"},{"col":0,"comment":"","endLoc":5,"header":"tree.py#<anonymous>","id":6554,"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',\n    'FieldRef', 'ParamRef', 'Group', 'Table', 'Resource',\n    'VOTableFile'\n    ]\n\nDEFAULT_CHUNK_SIZE = 256\n\nRESIZE_AMOUNT = 1.5"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":6555,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"biweight.py#<anonymous>","id":6556,"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']"},{"attributeType":"null","col":4,"comment":"null","endLoc":933,"id":6557,"name":"name","nodeType":"Attribute","startLoc":933,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":934,"id":6558,"name":"subfmts","nodeType":"Attribute","startLoc":934,"text":"subfmts"},{"attributeType":"null","col":4,"comment":"null","endLoc":950,"id":6559,"name":"subfmts","nodeType":"Attribute","startLoc":950,"text":"subfmts"},{"attributeType":"None","col":4,"comment":"null","endLoc":954,"id":6560,"name":"_fits_scale","nodeType":"Attribute","startLoc":954,"text":"_fits_scale"},{"attributeType":"None","col":4,"comment":"null","endLoc":955,"id":6561,"name":"_fits_realization","nodeType":"Attribute","startLoc":955,"text":"_fits_realization"},{"attributeType":"null","col":20,"comment":"null","endLoc":985,"id":6562,"name":"_scale","nodeType":"Attribute","startLoc":985,"text":"self._scale"},{"attributeType":"null","col":16,"comment":"null","endLoc":982,"id":6563,"name":"_fits_scale","nodeType":"Attribute","startLoc":982,"text":"self._fits_scale"},{"attributeType":"null","col":16,"comment":"null","endLoc":1012,"id":6564,"name":"out_subfmt","nodeType":"Attribute","startLoc":1012,"text":"self.out_subfmt"},{"attributeType":"None","col":16,"comment":"null","endLoc":983,"id":6565,"name":"_fits_realization","nodeType":"Attribute","startLoc":983,"text":"self._fits_realization"},{"className":"TimeEpochDate","col":0,"comment":"\n    Base class for support floating point Besselian and Julian epoch dates\n    ","endLoc":1030,"id":6566,"nodeType":"Class","startLoc":1016,"text":"class TimeEpochDate(TimeFormat):\n    \"\"\"\n    Base class for support floating point Besselian and Julian epoch dates\n    \"\"\"\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    @property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        return jd_to_epoch(self.jd1, self.jd2)"},{"col":4,"comment":"null","endLoc":1025,"header":"def set_jds(self, val1, val2)","id":6567,"name":"set_jds","nodeType":"Function","startLoc":1021,"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)"},{"fileName":"funcs.py","filePath":"astropy/stats","id":6568,"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\n\nimport math\nimport itertools\n\nimport numpy as np\n\nfrom warnings import warn\n\nfrom ..utils.decorators import deprecated_renamed_argument\nfrom ..utils import isiterable\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__doctest_requires__ = {'binom_conf_interval': ['scipy.special'],\n                        'poisson_conf_interval': ['scipy.special',\n                                                  'scipy.optimize',\n                                                  'scipy.integrate']}\n\n\ngaussian_sigma_to_fwhm = 2.0 * np.sqrt(2.0 * np.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# TODO Note scipy dependency\ndef binom_conf_interval(k, n, conf=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    conf : float in [0, 1], optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\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 : numpy.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    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')\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([0, 1, 2, 5], 5, interval='wilson')\n    array([[ 0.        ,  0.07921741,  0.21597328,  0.83333304],\n           [ 0.16666696,  0.42078276,  0.61736012,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='jeffreys')\n    array([[ 0.        ,  0.0842525 ,  0.21789949,  0.82788246],\n           [ 0.17211754,  0.42218001,  0.61753691,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='flat')\n    array([[ 0.        ,  0.12139799,  0.24309021,  0.73577037],\n           [ 0.26422963,  0.45401727,  0.61535699,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald')\n    array([[ 0.        ,  0.02111437,  0.18091075,  1.        ],\n           [ 0.        ,  0.37888563,  0.61908925,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald', conf=0.99)\n    array([[ 0.        , -0.26077835, -0.16433593,  1.        ],\n           [ 0.        ,  0.66077835,  0.96433593,  1.        ]])\n\n    \"\"\"\n\n    if conf < 0. or conf > 1.:\n        raise ValueError('conf must be between 0. and 1.')\n    alpha = 1. - conf\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(conf), 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('Unrecognized interval: {0:s}'.format(interval))\n\n    return conf_interval\n\n\n# TODO Note scipy dependency (needed in binom_conf_interval)\ndef binned_binom_proportion(x, success, bins=10, range=None, conf=0.68269,\n                            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 : list_like\n        Values.\n    success : list_like (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 scalars, 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    conf : float in [0, 1], optional\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 : numpy.ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : numpy.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 : numpy.ndarray\n        Efficiency in each bin.\n    perr : numpy.ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\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\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, conf=conf, 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, conflevel, name):\n    if sigma != 1:\n        raise ValueError(\"Only sigma=1 supported for interval {0}\"\n                         .format(name))\n    if background != 0:\n        raise ValueError(\"background not supported for interval {0}\"\n                         .format(name))\n    if conflevel is not None:\n        raise ValueError(\"conflevel not supported for interval {0}\"\n                         .format(name))\n\n\ndef poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          conflevel=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    conflevel : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n\n    Returns\n    -------\n    conf_interval : numpy.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][pois_eb]\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also [discusses][ErrorBars] several possibilities but\n    concludes that no single representation is suitable for all cases.\n    The suggestion has also been [floated][ac12] that error bars should be\n    attached to theoretical predictions instead of observed data,\n    which this function will not help with (but it's easy; then you\n    really should use the square root of the theoretical 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][pois_eb] by\n    the CDF working group). It also has the nice feature that\n    if your theory curve touches an endpoint of the interval, then your\n    data 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][sherpa_gehrels] claims it is\n    based on a numerical approximation published in\n    [Gehrels 1986][gehrels86] but it does not actually appear there.\n    It is symmetrical, and while the upper limits\n    are within about 1% of those given by 'frequentist-confidence', the\n    lower limits can be badly wrong. The 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][maxw11] for further 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 [KraftBurrowsNousek][kbn1991] for further details.\n\n    These formulas implement a positive, uniform prior.\n    [KraftBurrowsNousek][kbn1991] discuss this choice in more detail and show\n    that the problem is relatively insensitive to the choice of prior.\n\n    This functions has an optional dependency: Either scipy or\n    `mpmath <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n\n\n    Examples\n    --------\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(np.arange(10),\n    ...                       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(7,\n    ...                       interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(10, background=1.5, conflevel=0.95,\n    ...                       interval='kraft-burrows-nousek').T\n    array([  3.47894005, 16.113329533])   # doctest: +FLOAT_CMP\n\n    [pois_eb]: http://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt\n\n    [ErrorBars]: http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf\n\n    [ac12]: http://adsabs.harvard.edu/abs/2012EPJP..127...24A\n\n    [maxw11]: http://adsabs.harvard.edu/abs/2011arXiv1102.0822M\n\n    [gehrels86]: http://adsabs.harvard.edu/abs/1986ApJ...303..336G\n\n    [sherpa_gehrels]: http://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels\n\n    [kbn1991]: http://adsabs.harvard.edu/abs/1991ApJ...374..344K\n\n    \"\"\"\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, conflevel, 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, conflevel, 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, conflevel, 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, conflevel, 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, conflevel, 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        if conflevel is None:\n            raise ValueError('Set conflevel for method {0}. (sigma is '\n                             'ignored.)'.format(interval))\n        conflevel = np.asanyarray(conflevel)\n        if np.any(conflevel <= 0) or np.any(conflevel >= 1):\n            raise ValueError('Conflevel 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, conflevel)\n        conf_interval = np.vstack(conf_interval)\n    else:\n        raise ValueError(\"Invalid method for Poisson confidence intervals: \"\n                         \"{}\".format(interval))\n    return conf_interval\n\n\n@deprecated_renamed_argument('a', 'data', '2.0')\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 : {int, sequence of int, None}, optional\n        Axis along which the MADs are computed.  The default (`None`) is\n        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.RandomState(12345)\n        >>> from numpy.random import randn\n        >>> mad = median_absolute_deviation(rand.randn(1000))\n        >>> print(mad)    # doctest: +FLOAT_CMP\n        0.65244241428454486\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_invalid(data)\n        elif ignore_nan:\n            is_masked = False\n            func = np.nanmedian\n        else:\n            is_masked = False\n            func = np.median\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\n    # broadcast the median array before subtraction\n    if axis is not None:\n        if isiterable(axis):\n            for ax in sorted(list(axis)):\n                data_median = np.expand_dims(data_median, axis=ax)\n        else:\n            data_median = np.expand_dims(data_median, axis=axis)\n\n    result = func(np.abs(data - data_median), axis=axis, overwrite_input=True)\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 : {int, sequence of int, None}, optional\n        Axis along which the robust standard deviations are computed.\n        The default (`None`) is to compute the robust standard deviation\n        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.RandomState(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    2.0232764659422626\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 : numpy.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 : numpy.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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires `scipy`. This implementation will cause Overflow Errors for about\n    N > 100 (the exact limit depends on details of how scipy was compiled).\n    See `~astropy.stats.mpmath_poisson_upper_limit` for an implementation that\n    is slower, but can deal with arbitrarily high numbers since it is based on\n    the `mpmath <http://mpmath.org/>`_ library.\n    '''\n\n    from scipy.optimize import brentq\n    from scipy.integrate import quad\n\n    from math import exp\n\n    def eqn8(N, B):\n        n = np.arange(N + 1, dtype=np.float64)\n        # Create an array containing the factorials. scipy.special.factorial\n        # requires SciPy 0.14 (#5064) therefore this is calculated by using\n        # numpy.cumprod. This could be replaced by factorial again as soon as\n        # older SciPy are not supported anymore but the cumprod alternative\n        # might also be a bit faster.\n        factorial_n = np.ones(n.shape, dtype=np.float64)\n        np.cumprod(n[1:], out=factorial_n[1:])\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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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    N = mpf(N)\n    B = mpf(B)\n    CL = mpf(CL)\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 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, (N - B) / 2.)\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    S_max = findroot(func, N - B, tol=1e-4)\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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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 `scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    '''\n    try:\n        import scipy\n        HAS_SCIPY = True\n    except ImportError:\n        HAS_SCIPY = False\n\n    try:\n        import mpmath\n        HAS_MPMATH = True\n    except ImportError:\n        HAS_MPMATH = False\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    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    \"\"\"\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.)\n        a, b = -k + r, -k - r\n        return 1. - factorial(N - 1) * (b**(N - 1.) * (1. - a) -\n                                        a**(N - 1.) * (1. - b)) / float(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        def T(t):\n            y = D + t / float(N)\n            return y**(t - 3) * (y**3 * N - y**2 * t * (3. - 2. /\n                                                        N) / N - t * (t - 1) * (t - 2) / float(N)**2)\n        s = 0.\n        # NOTE: the upper limit of this sum is taken from Stephens 1965\n        for t in range(int(np.floor(N * (1 - D))) + 1):\n            term = T(t) * comb(N, t) * (1 - D - t / float(N))**(N - t - 1)\n            s += term\n        return s\n    else:\n        z = D * np.sqrt(N)\n        S1 = 0.\n        term_eps = 1e-12\n        abs_eps = 1e-100\n        for m in itertools.count(1):\n            T1 = 2. * (4. * m**2 * z**2 - 1.) * np.exp(-2. * m**2 * z**2)\n            so = S1\n            S1 += T1\n            if np.abs(S1 - so) / (np.abs(S1) + np.abs(so)\n                                  ) < term_eps or np.abs(S1 - so) < abs_eps:\n                break\n        S2 = 0.\n        for m in itertools.count(1):\n            T2 = m**2 * (4. * m**2 * z**2 - 3.) * np.exp(-2 * m**2 * z**2)\n            so = S2\n            S2 += T2\n            if np.abs(S2 - so) / (np.abs(S2) + np.abs(so)\n                                  ) < term_eps or np.abs(S1 - so) < abs_eps:\n                break\n        return S1 - 8 * D / (3. * np.sqrt(N)) * 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, data2 = np.sort(data1), np.sort(data2)\n\n    if len(data2) < len(data1):\n        data1, data2 = data2, data1\n\n    # this could be more efficient\n    cdfv1 = np.searchsorted(data2, data1) / float(len(data2))\n    # this could be more efficient\n    cdfv2 = np.searchsorted(data1, data2) / float(len(data1))\n    D = (np.amax(cdfv1 - np.arange(len(data1)) / float(len(data1))) +\n         np.amax(cdfv2 - np.arange(len(data2)) / float(len(data2))))\n\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 three-element tuples (ai,bi,wi)\n        The intervals to fold; ai and bi are the limits of the interval, and\n        wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : array of floats length N\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : array of floats of length N-1\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 : array of floats of length N\n        The boundaries of successive intervals.\n    totals : array of floats of length N-1\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 : pairs of two floats\n        The two intervals.\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 : array of floats of length N\n        Endpoints of the intervals in the PDF\n    totals : array of floats of length N-1\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of floats\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"},{"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    conf : float in [0, 1], optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\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 : numpy.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    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')\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([0, 1, 2, 5], 5, interval='wilson')\n    array([[ 0.        ,  0.07921741,  0.21597328,  0.83333304],\n           [ 0.16666696,  0.42078276,  0.61736012,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='jeffreys')\n    array([[ 0.        ,  0.0842525 ,  0.21789949,  0.82788246],\n           [ 0.17211754,  0.42218001,  0.61753691,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='flat')\n    array([[ 0.        ,  0.12139799,  0.24309021,  0.73577037],\n           [ 0.26422963,  0.45401727,  0.61535699,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald')\n    array([[ 0.        ,  0.02111437,  0.18091075,  1.        ],\n           [ 0.        ,  0.37888563,  0.61908925,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald', conf=0.99)\n    array([[ 0.        , -0.26077835, -0.16433593,  1.        ],\n           [ 0.        ,  0.66077835,  0.96433593,  1.        ]])\n\n    ","endLoc":274,"header":"def binom_conf_interval(k, n, conf=0.68269, interval='wilson')","id":6569,"name":"binom_conf_interval","nodeType":"Function","startLoc":52,"text":"def binom_conf_interval(k, n, conf=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    conf : float in [0, 1], optional\n        Desired probability content of interval. Default is 0.68269,\n        corresponding to 1 sigma in a 1-dimensional Gaussian distribution.\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 : numpy.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    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')\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([0, 1, 2, 5], 5, interval='wilson')\n    array([[ 0.        ,  0.07921741,  0.21597328,  0.83333304],\n           [ 0.16666696,  0.42078276,  0.61736012,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='jeffreys')\n    array([[ 0.        ,  0.0842525 ,  0.21789949,  0.82788246],\n           [ 0.17211754,  0.42218001,  0.61753691,  1.        ]])\n\n    >>> binom_conf_interval([0, 1, 2, 5], 5, interval='flat')\n    array([[ 0.        ,  0.12139799,  0.24309021,  0.73577037],\n           [ 0.26422963,  0.45401727,  0.61535699,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald')\n    array([[ 0.        ,  0.02111437,  0.18091075,  1.        ],\n           [ 0.        ,  0.37888563,  0.61908925,  1.        ]])\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([0, 1, 2, 5], 5, interval='wald', conf=0.99)\n    array([[ 0.        , -0.26077835, -0.16433593,  1.        ],\n           [ 0.        ,  0.66077835,  0.96433593,  1.        ]])\n\n    \"\"\"\n\n    if conf < 0. or conf > 1.:\n        raise ValueError('conf must be between 0. and 1.')\n    alpha = 1. - conf\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(conf), 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('Unrecognized interval: {0:s}'.format(interval))\n\n    return conf_interval"},{"col":4,"comment":"null","endLoc":419,"header":"def __repr__(self)","id":6570,"name":"__repr__","nodeType":"Function","startLoc":415,"text":"def __repr__(self):\n        r = super().__repr__()\n        if r.startswith('Function'):\n            r = 'Extra' + r\n        return r"},{"col":4,"comment":"null","endLoc":1030,"header":"@property\n    def value(self)","id":6571,"name":"value","nodeType":"Function","startLoc":1027,"text":"@property\n    def value(self):\n        jd_to_epoch = getattr(erfa, self.jd_to_epoch)\n        return jd_to_epoch(self.jd1, self.jd2)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1025,"id":6572,"name":"jd1","nodeType":"Attribute","startLoc":1025,"text":"self.jd1"},{"attributeType":"null","col":18,"comment":"null","endLoc":1025,"id":6573,"name":"jd2","nodeType":"Attribute","startLoc":1025,"text":"self.jd2"},{"className":"TimeBesselianEpoch","col":0,"comment":"Besselian Epoch year as floating point value(s) like 1950.0","endLoc":1046,"id":6574,"nodeType":"Class","startLoc":1033,"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\n        return super()._check_val_type(val1, val2)"},{"col":4,"comment":"Input value validation, typically overridden by derived classes","endLoc":1046,"header":"def _check_val_type(self, val1, val2)","id":6575,"name":"_check_val_type","nodeType":"Function","startLoc":1039,"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\n        return super()._check_val_type(val1, val2)"},{"fileName":"jackknife.py","filePath":"astropy/stats","id":6576,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\n\n__all__ = ['jackknife_resampling', 'jackknife_stats']\n__doctest_requires__ = {'jackknife_stats': ['scipy.special']}\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 : numpy.ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : numpy.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        <http://people.bu.edu/aimcinto/jackknife.pdf>\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    \"\"\"\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, conf_lvl=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 : numpy.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    conf_lvl : 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 : numpy.float64 or numpy.ndarray\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife bias.\n\n    std_err : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife standard error.\n\n    conf_interval : numpy.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\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\n    from scipy.special import erfinv\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    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    # jackknife confidence interval\n    if not (0 < conf_lvl < 1):\n        raise ValueError(\"confidence level must be in (0, 1).\")\n\n    z_score = np.sqrt(2.0)*erfinv(conf_lvl)\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":"null","endLoc":1251,"header":"def _get_new_hub_msg_id(self, sender_public_id, sender_msg_id)","id":6577,"name":"_get_new_hub_msg_id","nodeType":"Function","startLoc":1246,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":404,"id":6578,"name":"args","nodeType":"Attribute","startLoc":404,"text":"self.args"},{"attributeType":"null","col":8,"comment":"null","endLoc":410,"id":6579,"name":"ret","nodeType":"Attribute","startLoc":410,"text":"self.ret"},{"attributeType":"null","col":23,"comment":"null","endLoc":375,"id":6580,"name":"filename","nodeType":"Attribute","startLoc":375,"text":"self.filename"},{"attributeType":"null","col":8,"comment":"null","endLoc":375,"id":6581,"name":"filepath","nodeType":"Attribute","startLoc":375,"text":"self.filepath"},{"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 : numpy.ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : numpy.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        <http://people.bu.edu/aimcinto/jackknife.pdf>\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":53,"header":"def jackknife_resampling(data)","id":6582,"name":"jackknife_resampling","nodeType":"Function","startLoc":10,"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 : numpy.ndarray\n        Original sample (1-D array) from which the jackknife resamples will be\n        generated.\n\n    Returns\n    -------\n    resamples : numpy.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        <http://people.bu.edu/aimcinto/jackknife.pdf>\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    \"\"\"\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":373,"id":6583,"name":"name","nodeType":"Attribute","startLoc":373,"text":"self.name"},{"attributeType":"None","col":24,"comment":"null","endLoc":398,"id":6584,"name":"doc","nodeType":"Attribute","startLoc":398,"text":"self.doc"},{"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 : numpy.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    conf_lvl : 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 : numpy.float64 or numpy.ndarray\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife bias.\n\n    std_err : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife standard error.\n\n    conf_interval : numpy.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\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":177,"header":"def jackknife_stats(data, statistic, conf_lvl=0.95)","id":6585,"name":"jackknife_stats","nodeType":"Function","startLoc":56,"text":"def jackknife_stats(data, statistic, conf_lvl=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 : numpy.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    conf_lvl : 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 : numpy.float64 or numpy.ndarray\n        The i-th element is the bias-corrected \"jackknifed\" estimate.\n\n    bias : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife bias.\n\n    std_err : numpy.float64 or numpy.ndarray\n        The i-th element is the jackknife standard error.\n\n    conf_interval : numpy.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\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\n    from scipy.special import erfinv\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    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    # jackknife confidence interval\n    if not (0 < conf_lvl < 1):\n        raise ValueError(\"confidence level must be in (0, 1).\")\n\n    z_score = np.sqrt(2.0)*erfinv(conf_lvl)\n    conf_interval = estimate + z_score*np.array((-std_err, std_err))\n\n    return estimate, bias, std_err, conf_interval"},{"col":4,"comment":"null","endLoc":1070,"header":"def _call_(self, sender_private_key, sender_public_id,\n               recipient_public_id, msg_id, message)","id":6586,"name":"_call_","nodeType":"Function","startLoc":1046,"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":12,"comment":"null","endLoc":379,"id":6587,"name":"prototype","nodeType":"Attribute","startLoc":379,"text":"self.prototype"},{"attributeType":"null","col":4,"comment":"null","endLoc":1035,"id":6588,"name":"name","nodeType":"Attribute","startLoc":1035,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1036,"id":6589,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1036,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1037,"id":6590,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1037,"text":"jd_to_epoch"},{"attributeType":"null","col":8,"comment":"null","endLoc":374,"id":6591,"name":"pyname","nodeType":"Attribute","startLoc":374,"text":"self.pyname"},{"className":"TimeJulianEpoch","col":0,"comment":"Julian Epoch year as floating point value(s) like 2000.0","endLoc":1054,"id":6592,"nodeType":"Class","startLoc":1049,"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":1051,"id":6593,"name":"name","nodeType":"Attribute","startLoc":1051,"text":"name"},{"col":0,"comment":"null","endLoc":533,"header":"def main(srcdir, outfn, templateloc, verbose=True)","id":6594,"name":"main","nodeType":"Function","startLoc":422,"text":"def main(srcdir, outfn, templateloc, verbose=True):\n    from jinja2 import Environment, FileSystemLoader\n\n    if verbose:\n        print_ = lambda *args, **kwargs: print(*args, **kwargs)\n    else:\n        print_ = lambda *args, **kwargs: None\n\n    # Prepare the jinja2 templating environment\n    env = Environment(loader=FileSystemLoader(templateloc))\n\n    def prefix(a_list, pre):\n        return [pre+'{0}'.format(an_element) for an_element in a_list]\n\n    def postfix(a_list, post):\n        return ['{0}'.format(an_element)+post for an_element in a_list]\n\n    def surround(a_list, pre, post):\n        return [pre+'{0}'.format(an_element)+post for an_element in a_list]\n    env.filters['prefix'] = prefix\n    env.filters['postfix'] = postfix\n    env.filters['surround'] = surround\n\n    erfa_c_in = env.get_template('core.c.templ')\n    erfa_py_in = env.get_template('core.py.templ')\n\n    # Extract all the ERFA function names from erfa.h\n    if os.path.isdir(srcdir):\n        erfahfn = os.path.join(srcdir, 'erfa.h')\n        multifilserc = True\n    else:\n        erfahfn = os.path.join(os.path.split(srcdir)[0], 'erfa.h')\n        multifilserc = False\n\n    with open(erfahfn, \"r\") as f:\n        erfa_h = f.read()\n\n    funcs = OrderedDict()\n    section_subsection_functions = re.findall(r'/\\* (\\w*)/(\\w*) \\*/\\n(.*?)\\n\\n',\n                                              erfa_h, flags=re.DOTALL | re.MULTILINE)\n    for section, subsection, functions in section_subsection_functions:\n        print_(\"{0}.{1}\".format(section, subsection))\n        if ((section == \"Astronomy\") or (subsection == \"AngleOps\")\n            or (subsection == \"SphericalCartesian\")\n            or (subsection == \"MatrixVectorProducts\")):\n            func_names = re.findall(r' (\\w+)\\(.*?\\);', functions, flags=re.DOTALL)\n            for name in func_names:\n                print_(\"{0}.{1}.{2}...\".format(section, subsection, name))\n                if multifilserc:\n                    # easy because it just looks in the file itself\n                    funcs[name] = Function(name, srcdir)\n                else:\n                    # Have to tell it to look for a declaration matching\n                    # the start of the header declaration, otherwise it\n                    # might find a *call* of the function instead of the\n                    # definition\n                    for line in functions.split(r'\\n'):\n                        if name in line:\n                            # [:-1] is to remove trailing semicolon, and\n                            # splitting on '(' is because the header and\n                            # C files don't necessarily have to match\n                            # argument names and line-breaking or\n                            # whitespace\n                            match_line = line[:-1].split('(')[0]\n                            funcs[name] = Function(name, srcdir, match_line)\n                            break\n                    else:\n                        raise ValueError(\"A name for a C file wasn't \"\n                                         \"found in the string that \"\n                                         \"spawned it.  This should be \"\n                                         \"impossible!\")\n\n    funcs = list(funcs.values())\n\n    # Extract all the ERFA constants from erfam.h\n    erfamhfn = os.path.join(srcdir, 'erfam.h')\n    with open(erfamhfn, 'r') as f:\n        erfa_m_h = f.read()\n    constants = []\n    for chunk in erfa_m_h.split(\"\\n\\n\"):\n        result = re.findall(r\"#define (ERFA_\\w+?) (.+?)$\", chunk, flags=re.DOTALL | re.MULTILINE)\n        if result:\n            doc = re.findall(r\"/\\* (.+?) \\*/\\n\", chunk, flags=re.DOTALL)\n            for (name, value) in result:\n                constants.append(Constant(name, value, doc))\n\n    # TODO: re-enable this when const char* return values and non-status code integer rets are possible\n    # #Add in any \"extra\" functions from erfaextra.h\n    # erfaextrahfn = os.path.join(srcdir, 'erfaextra.h')\n    # with open(erfaextrahfn, 'r') as f:\n    #     for l in f:\n    #         ls = l.strip()\n    #         match = re.match('.* (era.*)\\(', ls)\n    #         if match:\n    #             print_(\"Extra:  {0} ...\".format(match.group(1)))\n    #             funcs.append(ExtraFunction(match.group(1), ls, erfaextrahfn))\n\n    print_(\"Rendering template\")\n    erfa_c = erfa_c_in.render(funcs=funcs)\n    erfa_py = erfa_py_in.render(funcs=funcs, constants=constants)\n\n    if outfn is not None:\n        outfn_c = os.path.splitext(outfn)[0] + \".c\"\n        print_(\"Saving to\", outfn, 'and', outfn_c)\n        with open(outfn, \"w\") as f:\n            f.write(erfa_py)\n        with open(outfn_c, \"w\") as f:\n            f.write(erfa_c)\n\n    print_(\"Done!\")\n\n    return erfa_c, erfa_py, funcs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1052,"id":6595,"name":"unit","nodeType":"Attribute","startLoc":1052,"text":"unit"},{"col":17,"endLoc":426,"id":6596,"nodeType":"Lambda","startLoc":426,"text":"lambda *args, **kwargs: print(*args, **kwargs)"},{"col":17,"endLoc":428,"id":6597,"nodeType":"Lambda","startLoc":428,"text":"lambda *args, **kwargs: None"},{"attributeType":"null","col":4,"comment":"null","endLoc":1053,"id":6598,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1053,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1054,"id":6599,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1054,"text":"jd_to_epoch"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":6600,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"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":1094,"id":6601,"nodeType":"Class","startLoc":1057,"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\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        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('Time {0} does not match {1} format'\n                                 .format(time_str, self.name))\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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":6602,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":6603,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":7,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":3,"header":"jackknife.py#<anonymous>","id":6604,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['jackknife_resampling', 'jackknife_stats']\n\n__doctest_requires__ = {'jackknife_stats': ['scipy.special']}"},{"fileName":"__init__.py","filePath":"astropy/stats","id":6605,"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 .funcs import *\nfrom .biweight import *\nfrom .sigma_clipping import *\nfrom .jackknife import *\nfrom .circstats import *\nfrom .bayesian_blocks import *\nfrom .histogram import *\nfrom .info_theory import *\nfrom .lombscargle import *\nfrom .spatial import *\n"},{"col":0,"comment":"","endLoc":12,"header":"__init__.py#<anonymous>","id":6606,"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\"\"\""},{"fileName":"sigma_clipping.py","filePath":"astropy/stats","id":6607,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\nimport warnings\nfrom ..utils.exceptions import AstropyUserWarning\n\n\n__all__ = ['SigmaClip', 'sigma_clip', 'sigma_clipped_stats']\n\n\nclass SigmaClip:\n    \"\"\"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations\n    from a center value. If the data contains invalid values (NaNs or\n    infs), they are automatically masked before performing the sigma\n    clipping.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this class.\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n\n    See Also\n    --------\n    sigma_clip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, iters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    copy the data::\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, iters=None, cenfunc=mean)\n        >>> filtered_data = sigclip(randvar, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    \"\"\"\n\n    def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None, iters=5,\n                 cenfunc=np.ma.median, stdfunc=np.std):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower\n        self.sigma_upper = sigma_upper\n        self.iters = iters\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc\n\n    def __repr__(self):\n        return ('SigmaClip(sigma={0}, sigma_lower={1}, sigma_upper={2}, '\n                'iters={3}, cenfunc={4}, stdfunc={5})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.iters, self.cenfunc, self.stdfunc))\n\n    def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'iters', 'cenfunc',\n                 'stdfunc']\n        for attr in attrs:\n            lines.append('    {0}: {1}'.format(attr, getattr(self, attr)))\n        return '\\n'.join(lines)\n\n    def _perform_clip(self, _filtered_data, axis=None):\n        \"\"\"\n        Perform sigma clip by comparing the data to the minimum and\n        maximum values (median + sig * standard deviation). Use\n        sigma_lower and sigma_upper to get the correct limits. Data\n        values less or greater than the minimum / maximum values\n        will have True set in the mask array.\n        \"\"\"\n\n        if _filtered_data.size == 0:\n            return _filtered_data\n\n        max_value = self.cenfunc(_filtered_data, axis=axis)\n        std = self.stdfunc(_filtered_data, axis=axis)\n        min_value = max_value - std * self.sigma_lower\n        max_value += std * self.sigma_upper\n\n        if axis is not None:\n            if axis != 0:\n                min_value = np.expand_dims(min_value, axis=axis)\n                max_value = np.expand_dims(max_value, axis=axis)\n        if max_value is np.ma.masked:\n            max_value = np.ma.MaskedArray(np.nan, mask=True)\n            min_value = np.ma.MaskedArray(np.nan, mask=True)\n\n        _filtered_data.mask |= _filtered_data > max_value\n        _filtered_data.mask |= _filtered_data < min_value\n\n        return _filtered_data\n\n    def __call__(self, data, axis=None, copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like\n            The data to be sigma clipped.\n        axis : int or `None`, optional\n            If not `None`, clip along the given axis.  For this case,\n            ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``,\n            which are expected to return an array with the axis\n            dimension removed (like the numpy functions).  If `None`,\n            clip over all axes.  Defaults to `None`.\n        copy : bool, optional\n            If `True`, the ``data`` array will be copied.  If `False`,\n            the returned masked array data will contain the same array\n            as ``data``.  Defaults to `True`.\n\n        Returns\n        -------\n        filtered_data : `numpy.ma.MaskedArray`\n            A masked array with the same shape as ``data`` input, where\n            the points rejected by the algorithm have been masked.\n        \"\"\"\n\n        if self.sigma_lower is None:\n            self.sigma_lower = self.sigma\n        if self.sigma_upper is None:\n            self.sigma_upper = self.sigma\n\n        if np.any(~np.isfinite(data)):\n            data = np.ma.masked_invalid(data)\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically masked.',\n                          AstropyUserWarning)\n\n        filtered_data = np.ma.array(data, copy=copy)\n\n        if self.iters is None:\n            lastrej = filtered_data.count() + 1\n            while filtered_data.count() != lastrej:\n                lastrej = filtered_data.count()\n                self._perform_clip(filtered_data, axis=axis)\n        else:\n            for i in range(self.iters):\n                self._perform_clip(filtered_data, axis=axis)\n\n        # prevent filtered_data.mask = False (scalar) if no values are clipped\n        if filtered_data.mask.shape == ():\n            # make .mask shape match .data shape\n            filtered_data.mask = False\n\n        return filtered_data\n\n\ndef sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, iters=5,\n               cenfunc=np.ma.median, stdfunc=np.std, axis=None, copy=True):\n    \"\"\"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations from a\n    center value. If the data contains invalid values (NaNs or infs),\n    they are automatically masked before performing the sigma clipping.\n\n    For an object-oriented interface to sigma clipping, see\n    :func:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this function.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be sigma clipped.\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n    copy : bool, optional\n        If `True`, the ``data`` array will be copied.  If `False`, the\n        returned masked array data will contain the same array as\n        ``data``.  Defaults to `True`.\n\n    Returns\n    -------\n    filtered_data : `numpy.ma.MaskedArray`\n        A masked array with the same shape as ``data`` input, where the\n        points rejected by the algorithm have been masked.\n\n    Notes\n    -----\n     1. The routine works by calculating::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        and then setting a mask for points outside the range::\n\n           deviation < (-sigma_lower * stdfunc(deviation))\n           deviation > (sigma_upper * stdfunc(deviation))\n\n        It will iterate a given number of times, or until no further\n        data are rejected.\n\n     2. Most numpy functions deal well with masked arrays, but if one\n        would like to have an array with just the good (or bad) values, one\n        can use::\n\n            good_only = filtered_data.data[~filtered_data.mask]\n            bad_only = filtered_data.data[filtered_data.mask]\n\n        However, for multidimensional data, this flattens the array,\n        which may not be what one wants (especially if filtering was\n        done along an axis).\n\n    See Also\n    --------\n    SigmaClip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\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, iters=5)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    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, iters=None,\n        ...                            cenfunc=mean, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    \"\"\"\n\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, iters=iters,\n                        cenfunc=cenfunc, stdfunc=stdfunc)\n    return sigclip(data, axis=axis, copy=copy)\n\n\ndef sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, iters=5,\n                        cenfunc=np.ma.median, stdfunc=np.std, std_ddof=0,\n                        axis=None):\n    \"\"\"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like\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 as the lower and upper\n        clipping limit.  These limits are overridden by ``sigma_lower``\n        and ``sigma_upper``, if input. Defaults to 3.\n\n    sigma_lower : float, 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 used.\n        Defaults to `None`.\n\n    sigma_upper : float, 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 used.\n        Defaults to `None`.\n\n    iters : int, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing) when calculating the statistics.\n        Defaults to 5.\n\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.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 zero.\n\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n    \"\"\"\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    data_clip = sigma_clip(data, sigma=sigma, sigma_lower=sigma_lower,\n                           sigma_upper=sigma_upper, iters=iters,\n                           cenfunc=cenfunc, stdfunc=stdfunc, axis=axis)\n\n    mean = np.ma.mean(data_clip, axis=axis)\n    median = np.ma.median(data_clip, axis=axis)\n    std = np.ma.std(data_clip, ddof=std_ddof, axis=axis)\n\n    if axis is None and np.ma.isMaskedArray(median):\n        # np.ma.median now always return a MaskedArray, even with one\n        # element. So for compatibility with previous versions of astropy,\n        # we keep taking the scalar value.\n        median = median.item()\n\n    return mean, median, std\n"},{"col":4,"comment":"null","endLoc":1085,"header":"def set_jds(self, val1, val2)","id":6608,"name":"set_jds","nodeType":"Function","startLoc":1063,"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        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('Time {0} does not match {1} format'\n                                 .format(time_str, self.name))\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":4,"comment":"null","endLoc":1085,"header":"def _call_all(self, private_key, msg_tag, message)","id":6609,"name":"_call_all","nodeType":"Function","startLoc":1072,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"col":21,"endLoc":1067,"id":6610,"nodeType":"Lambda","startLoc":1067,"text":"lambda x: str(x.item(), encoding='ascii')"},{"className":"SigmaClip","col":0,"comment":"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations\n    from a center value. If the data contains invalid values (NaNs or\n    infs), they are automatically masked before performing the sigma\n    clipping.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this class.\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n\n    See Also\n    --------\n    sigma_clip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, iters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    copy the data::\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, iters=None, cenfunc=mean)\n        >>> filtered_data = sigclip(randvar, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    ","endLoc":213,"id":6611,"nodeType":"Class","startLoc":11,"text":"class SigmaClip:\n    \"\"\"\n    Class to perform sigma clipping.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations\n    from a center value. If the data contains invalid values (NaNs or\n    infs), they are automatically masked before performing the sigma\n    clipping.\n\n    For a functional interface to sigma clipping, see\n    :func:`sigma_clip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this class.\n\n    Parameters\n    ----------\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n\n    See Also\n    --------\n    sigma_clip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\n\n        >>> from astropy.stats import SigmaClip\n        >>> from numpy.random import randn\n        >>> randvar = randn(10000)\n        >>> sigclip = SigmaClip(sigma=2, iters=5)\n        >>> filtered_data = sigclip(randvar)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    copy the data::\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, iters=None, cenfunc=mean)\n        >>> filtered_data = sigclip(randvar, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    \"\"\"\n\n    def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None, iters=5,\n                 cenfunc=np.ma.median, stdfunc=np.std):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower\n        self.sigma_upper = sigma_upper\n        self.iters = iters\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc\n\n    def __repr__(self):\n        return ('SigmaClip(sigma={0}, sigma_lower={1}, sigma_upper={2}, '\n                'iters={3}, cenfunc={4}, stdfunc={5})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.iters, self.cenfunc, self.stdfunc))\n\n    def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'iters', 'cenfunc',\n                 'stdfunc']\n        for attr in attrs:\n            lines.append('    {0}: {1}'.format(attr, getattr(self, attr)))\n        return '\\n'.join(lines)\n\n    def _perform_clip(self, _filtered_data, axis=None):\n        \"\"\"\n        Perform sigma clip by comparing the data to the minimum and\n        maximum values (median + sig * standard deviation). Use\n        sigma_lower and sigma_upper to get the correct limits. Data\n        values less or greater than the minimum / maximum values\n        will have True set in the mask array.\n        \"\"\"\n\n        if _filtered_data.size == 0:\n            return _filtered_data\n\n        max_value = self.cenfunc(_filtered_data, axis=axis)\n        std = self.stdfunc(_filtered_data, axis=axis)\n        min_value = max_value - std * self.sigma_lower\n        max_value += std * self.sigma_upper\n\n        if axis is not None:\n            if axis != 0:\n                min_value = np.expand_dims(min_value, axis=axis)\n                max_value = np.expand_dims(max_value, axis=axis)\n        if max_value is np.ma.masked:\n            max_value = np.ma.MaskedArray(np.nan, mask=True)\n            min_value = np.ma.MaskedArray(np.nan, mask=True)\n\n        _filtered_data.mask |= _filtered_data > max_value\n        _filtered_data.mask |= _filtered_data < min_value\n\n        return _filtered_data\n\n    def __call__(self, data, axis=None, copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like\n            The data to be sigma clipped.\n        axis : int or `None`, optional\n            If not `None`, clip along the given axis.  For this case,\n            ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``,\n            which are expected to return an array with the axis\n            dimension removed (like the numpy functions).  If `None`,\n            clip over all axes.  Defaults to `None`.\n        copy : bool, optional\n            If `True`, the ``data`` array will be copied.  If `False`,\n            the returned masked array data will contain the same array\n            as ``data``.  Defaults to `True`.\n\n        Returns\n        -------\n        filtered_data : `numpy.ma.MaskedArray`\n            A masked array with the same shape as ``data`` input, where\n            the points rejected by the algorithm have been masked.\n        \"\"\"\n\n        if self.sigma_lower is None:\n            self.sigma_lower = self.sigma\n        if self.sigma_upper is None:\n            self.sigma_upper = self.sigma\n\n        if np.any(~np.isfinite(data)):\n            data = np.ma.masked_invalid(data)\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically masked.',\n                          AstropyUserWarning)\n\n        filtered_data = np.ma.array(data, copy=copy)\n\n        if self.iters is None:\n            lastrej = filtered_data.count() + 1\n            while filtered_data.count() != lastrej:\n                lastrej = filtered_data.count()\n                self._perform_clip(filtered_data, axis=axis)\n        else:\n            for i in range(self.iters):\n                self._perform_clip(filtered_data, axis=axis)\n\n        # prevent filtered_data.mask = False (scalar) if no values are clipped\n        if filtered_data.mask.shape == ():\n            # make .mask shape match .data shape\n            filtered_data.mask = False\n\n        return filtered_data"},{"col":4,"comment":"null","endLoc":114,"header":"def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None, iters=5,\n                 cenfunc=np.ma.median, stdfunc=np.std)","id":6612,"name":"__init__","nodeType":"Function","startLoc":107,"text":"def __init__(self, sigma=3., sigma_lower=None, sigma_upper=None, iters=5,\n                 cenfunc=np.ma.median, stdfunc=np.std):\n        self.sigma = sigma\n        self.sigma_lower = sigma_lower\n        self.sigma_upper = sigma_upper\n        self.iters = iters\n        self.cenfunc = cenfunc\n        self.stdfunc = stdfunc"},{"col":4,"comment":"null","endLoc":120,"header":"def __repr__(self)","id":6613,"name":"__repr__","nodeType":"Function","startLoc":116,"text":"def __repr__(self):\n        return ('SigmaClip(sigma={0}, sigma_lower={1}, sigma_upper={2}, '\n                'iters={3}, cenfunc={4}, stdfunc={5})'\n                .format(self.sigma, self.sigma_lower, self.sigma_upper,\n                        self.iters, self.cenfunc, self.stdfunc))"},{"col":4,"comment":"null","endLoc":128,"header":"def __str__(self)","id":6614,"name":"__str__","nodeType":"Function","startLoc":122,"text":"def __str__(self):\n        lines = ['<' + self.__class__.__name__ + '>']\n        attrs = ['sigma', 'sigma_lower', 'sigma_upper', 'iters', 'cenfunc',\n                 'stdfunc']\n        for attr in attrs:\n            lines.append('    {0}: {1}'.format(attr, getattr(self, attr)))\n        return '\\n'.join(lines)"},{"col":4,"comment":"null","endLoc":1106,"header":"def _call_all_(self, sender_private_key, sender_public_id, msg_tag,\n                   message)","id":6615,"name":"_call_all_","nodeType":"Function","startLoc":1087,"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":4,"comment":"null","endLoc":1094,"header":"@property\n    def value(self)","id":6616,"name":"value","nodeType":"Function","startLoc":1087,"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":"null","endLoc":1135,"header":"def _call_and_wait(self, private_key, recipient_id, message, timeout)","id":6617,"name":"_call_and_wait","nodeType":"Function","startLoc":1108,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"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 : list_like\n        Values.\n    success : list_like (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 scalars, 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    conf : float in [0, 1], optional\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 : numpy.ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : numpy.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 : numpy.ndarray\n        Efficiency in each bin.\n    perr : numpy.ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\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":452,"header":"def binned_binom_proportion(x, success, bins=10, range=None, conf=0.68269,\n                            interval='wilson')","id":6618,"name":"binned_binom_proportion","nodeType":"Function","startLoc":278,"text":"def binned_binom_proportion(x, success, bins=10, range=None, conf=0.68269,\n                            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 : list_like\n        Values.\n    success : list_like (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 scalars, 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    conf : float in [0, 1], optional\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 : numpy.ndarray\n        Central value of bins. Bins without any entries are not returned.\n    bin_halfwidth : numpy.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 : numpy.ndarray\n        Efficiency in each bin.\n    perr : numpy.ndarray\n        2-d array of shape (2, len(p)) representing the upper and lower\n        uncertainty on p in each bin.\n\n    See Also\n    --------\n    binom_conf_interval : Function used to estimate confidence interval in\n                          each bin.\n\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\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, conf=conf, interval=interval)\n    perr = np.abs(bounds - p)\n\n    return bin_ctr, bin_halfwidth, p, perr"},{"attributeType":"null","col":8,"comment":"null","endLoc":1085,"id":6619,"name":"jd1","nodeType":"Attribute","startLoc":1085,"text":"self.jd1"},{"attributeType":"null","col":18,"comment":"null","endLoc":1085,"id":6620,"name":"jd2","nodeType":"Attribute","startLoc":1085,"text":"self.jd2"},{"col":0,"comment":"null","endLoc":464,"header":"def _check_poisson_conf_inputs(sigma, background, conflevel, name)","id":6621,"name":"_check_poisson_conf_inputs","nodeType":"Function","startLoc":455,"text":"def _check_poisson_conf_inputs(sigma, background, conflevel, name):\n    if sigma != 1:\n        raise ValueError(\"Only sigma=1 supported for interval {0}\"\n                         .format(name))\n    if background != 0:\n        raise ValueError(\"background not supported for interval {0}\"\n                         .format(name))\n    if conflevel is not None:\n        raise ValueError(\"conflevel not supported for interval {0}\"\n                         .format(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    conflevel : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n\n    Returns\n    -------\n    conf_interval : numpy.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][pois_eb]\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also [discusses][ErrorBars] several possibilities but\n    concludes that no single representation is suitable for all cases.\n    The suggestion has also been [floated][ac12] that error bars should be\n    attached to theoretical predictions instead of observed data,\n    which this function will not help with (but it's easy; then you\n    really should use the square root of the theoretical 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][pois_eb] by\n    the CDF working group). It also has the nice feature that\n    if your theory curve touches an endpoint of the interval, then your\n    data 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][sherpa_gehrels] claims it is\n    based on a numerical approximation published in\n    [Gehrels 1986][gehrels86] but it does not actually appear there.\n    It is symmetrical, and while the upper limits\n    are within about 1% of those given by 'frequentist-confidence', the\n    lower limits can be badly wrong. The 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][maxw11] for further 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 [KraftBurrowsNousek][kbn1991] for further details.\n\n    These formulas implement a positive, uniform prior.\n    [KraftBurrowsNousek][kbn1991] discuss this choice in more detail and show\n    that the problem is relatively insensitive to the choice of prior.\n\n    This functions has an optional dependency: Either scipy or\n    `mpmath <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n\n\n    Examples\n    --------\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(np.arange(10),\n    ...                       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(7,\n    ...                       interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(10, background=1.5, conflevel=0.95,\n    ...                       interval='kraft-burrows-nousek').T\n    array([  3.47894005, 16.113329533])   # doctest: +FLOAT_CMP\n\n    [pois_eb]: http://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt\n\n    [ErrorBars]: http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf\n\n    [ac12]: http://adsabs.harvard.edu/abs/2012EPJP..127...24A\n\n    [maxw11]: http://adsabs.harvard.edu/abs/2011arXiv1102.0822M\n\n    [gehrels86]: http://adsabs.harvard.edu/abs/1986ApJ...303..336G\n\n    [sherpa_gehrels]: http://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels\n\n    [kbn1991]: http://adsabs.harvard.edu/abs/1991ApJ...374..344K\n\n    ","endLoc":722,"header":"def poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          conflevel=None)","id":6622,"name":"poisson_conf_interval","nodeType":"Function","startLoc":467,"text":"def poisson_conf_interval(n, interval='root-n', sigma=1, background=0,\n                          conflevel=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    conflevel : float, optional\n        Confidence level between 0 and 1; only supported for the\n        'kraft-burrows-nousek' mode.\n\n\n    Returns\n    -------\n    conf_interval : numpy.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][pois_eb]\n    using root-n throughout, largely in the interest of\n    comprehensibility, but discusses other possibilities. The ATLAS\n    group also [discusses][ErrorBars] several possibilities but\n    concludes that no single representation is suitable for all cases.\n    The suggestion has also been [floated][ac12] that error bars should be\n    attached to theoretical predictions instead of observed data,\n    which this function will not help with (but it's easy; then you\n    really should use the square root of the theoretical 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][pois_eb] by\n    the CDF working group). It also has the nice feature that\n    if your theory curve touches an endpoint of the interval, then your\n    data 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][sherpa_gehrels] claims it is\n    based on a numerical approximation published in\n    [Gehrels 1986][gehrels86] but it does not actually appear there.\n    It is symmetrical, and while the upper limits\n    are within about 1% of those given by 'frequentist-confidence', the\n    lower limits can be badly wrong. The 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][maxw11] for further 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 [KraftBurrowsNousek][kbn1991] for further details.\n\n    These formulas implement a positive, uniform prior.\n    [KraftBurrowsNousek][kbn1991] discuss this choice in more detail and show\n    that the problem is relatively insensitive to the choice of prior.\n\n    This functions has an optional dependency: Either scipy or\n    `mpmath <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n\n\n    Examples\n    --------\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(np.arange(10),\n    ...                       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(7,\n    ...                       interval='frequentist-confidence').T\n    array([  4.41852954,  10.77028072])\n\n    >>> poisson_conf_interval(10, background=1.5, conflevel=0.95,\n    ...                       interval='kraft-burrows-nousek').T\n    array([  3.47894005, 16.113329533])   # doctest: +FLOAT_CMP\n\n    [pois_eb]: http://www-cdf.fnal.gov/physics/statistics/notes/pois_eb.txt\n\n    [ErrorBars]: http://www.pp.rhul.ac.uk/~cowan/atlas/ErrorBars.pdf\n\n    [ac12]: http://adsabs.harvard.edu/abs/2012EPJP..127...24A\n\n    [maxw11]: http://adsabs.harvard.edu/abs/2011arXiv1102.0822M\n\n    [gehrels86]: http://adsabs.harvard.edu/abs/1986ApJ...303..336G\n\n    [sherpa_gehrels]: http://cxc.harvard.edu/sherpa4.4/statistics/#chigehrels\n\n    [kbn1991]: http://adsabs.harvard.edu/abs/1991ApJ...374..344K\n\n    \"\"\"\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, conflevel, 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, conflevel, 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, conflevel, 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, conflevel, 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, conflevel, 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        if conflevel is None:\n            raise ValueError('Set conflevel for method {0}. (sigma is '\n                             'ignored.)'.format(interval))\n        conflevel = np.asanyarray(conflevel)\n        if np.any(conflevel <= 0) or np.any(conflevel >= 1):\n            raise ValueError('Conflevel 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, conflevel)\n        conf_interval = np.vstack(conf_interval)\n    else:\n        raise ValueError(\"Invalid method for Poisson confidence intervals: \"\n                         \"{}\".format(interval))\n    return conf_interval"},{"className":"TimeBesselianEpochString","col":0,"comment":"Besselian Epoch year as string value(s) like 'B1950.0'","endLoc":1102,"id":6623,"nodeType":"Class","startLoc":1097,"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":1099,"id":6624,"name":"name","nodeType":"Attribute","startLoc":1099,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1100,"id":6625,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1100,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1101,"id":6626,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1101,"text":"jd_to_epoch"},{"attributeType":"null","col":4,"comment":"null","endLoc":1102,"id":6627,"name":"epoch_prefix","nodeType":"Attribute","startLoc":1102,"text":"epoch_prefix"},{"className":"TimeJulianEpochString","col":0,"comment":"Julian Epoch year as string value(s) like 'J2000.0'","endLoc":1110,"id":6628,"nodeType":"Class","startLoc":1105,"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":1107,"id":6629,"name":"name","nodeType":"Attribute","startLoc":1107,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1108,"id":6630,"name":"epoch_to_jd","nodeType":"Attribute","startLoc":1108,"text":"epoch_to_jd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1109,"id":6631,"name":"jd_to_epoch","nodeType":"Attribute","startLoc":1109,"text":"jd_to_epoch"},{"attributeType":"null","col":4,"comment":"null","endLoc":1110,"id":6632,"name":"epoch_prefix","nodeType":"Attribute","startLoc":1110,"text":"epoch_prefix"},{"className":"TimeDeltaFormatMeta","col":0,"comment":"null","endLoc":1114,"id":6633,"nodeType":"Class","startLoc":1113,"text":"class TimeDeltaFormatMeta(TimeFormatMeta):\n    _registry = TIME_DELTA_FORMATS"},{"attributeType":"null","col":4,"comment":"null","endLoc":1114,"id":6634,"name":"_registry","nodeType":"Attribute","startLoc":1114,"text":"_registry"},{"className":"TimeDeltaFormat","col":0,"comment":"Base class for time delta representations","endLoc":1137,"id":6635,"nodeType":"Class","startLoc":1117,"text":"class TimeDeltaFormat(TimeFormat, metaclass=TimeDeltaFormatMeta):\n    \"\"\"Base class for time delta representations\"\"\"\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 '{0}' not in \"\n                                  \"allowed values {1}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale\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    @property\n    def value(self):\n        return (self.jd1 + self.jd2) / self.unit"},{"col":4,"comment":"\n        Check that the scale is in the allowed list of scales, or is `None`\n        ","endLoc":1129,"header":"def _check_scale(self, scale)","id":6636,"name":"_check_scale","nodeType":"Function","startLoc":1120,"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 '{0}' not in \"\n                                  \"allowed values {1}\"\n                                  .format(scale, TIME_DELTA_SCALES))\n\n        return scale"},{"col":4,"comment":"null","endLoc":1133,"header":"def set_jds(self, val1, val2)","id":6637,"name":"set_jds","nodeType":"Function","startLoc":1131,"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":"null","endLoc":1182,"header":"def _reply_(self, responder_private_key, msg_id, response)","id":6638,"name":"_reply_","nodeType":"Function","startLoc":1152,"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":4,"comment":"\n        Perform sigma clip by comparing the data to the minimum and\n        maximum values (median + sig * standard deviation). Use\n        sigma_lower and sigma_upper to get the correct limits. Data\n        values less or greater than the minimum / maximum values\n        will have True set in the mask array.\n        ","endLoc":158,"header":"def _perform_clip(self, _filtered_data, axis=None)","id":6639,"name":"_perform_clip","nodeType":"Function","startLoc":130,"text":"def _perform_clip(self, _filtered_data, axis=None):\n        \"\"\"\n        Perform sigma clip by comparing the data to the minimum and\n        maximum values (median + sig * standard deviation). Use\n        sigma_lower and sigma_upper to get the correct limits. Data\n        values less or greater than the minimum / maximum values\n        will have True set in the mask array.\n        \"\"\"\n\n        if _filtered_data.size == 0:\n            return _filtered_data\n\n        max_value = self.cenfunc(_filtered_data, axis=axis)\n        std = self.stdfunc(_filtered_data, axis=axis)\n        min_value = max_value - std * self.sigma_lower\n        max_value += std * self.sigma_upper\n\n        if axis is not None:\n            if axis != 0:\n                min_value = np.expand_dims(min_value, axis=axis)\n                max_value = np.expand_dims(max_value, axis=axis)\n        if max_value is np.ma.masked:\n            max_value = np.ma.MaskedArray(np.nan, mask=True)\n            min_value = np.ma.MaskedArray(np.nan, mask=True)\n\n        _filtered_data.mask |= _filtered_data > max_value\n        _filtered_data.mask |= _filtered_data < min_value\n\n        return _filtered_data"},{"col":4,"comment":"null","endLoc":1137,"header":"@property\n    def value(self)","id":6640,"name":"value","nodeType":"Function","startLoc":1135,"text":"@property\n    def value(self):\n        return (self.jd1 + self.jd2) / self.unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":1133,"id":6641,"name":"jd1","nodeType":"Attribute","startLoc":1133,"text":"self.jd1"},{"attributeType":"null","col":18,"comment":"null","endLoc":1133,"id":6642,"name":"jd2","nodeType":"Attribute","startLoc":1133,"text":"self.jd2"},{"className":"TimeDeltaSec","col":0,"comment":"Time delta in SI seconds","endLoc":1143,"id":6643,"nodeType":"Class","startLoc":1140,"text":"class TimeDeltaSec(TimeDeltaFormat):\n    \"\"\"Time delta in SI seconds\"\"\"\n    name = 'sec'\n    unit = 1. / erfa.DAYSEC  # for quantity input"},{"attributeType":"null","col":4,"comment":"null","endLoc":1142,"id":6644,"name":"name","nodeType":"Attribute","startLoc":1142,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1143,"id":6645,"name":"unit","nodeType":"Attribute","startLoc":1143,"text":"unit"},{"className":"TimeDeltaJD","col":0,"comment":"Time delta in Julian days (86400 SI seconds)","endLoc":1149,"id":6646,"nodeType":"Class","startLoc":1146,"text":"class TimeDeltaJD(TimeDeltaFormat):\n    \"\"\"Time delta in Julian days (86400 SI seconds)\"\"\"\n    name = 'jd'\n    unit = 1."},{"col":4,"comment":"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like\n            The data to be sigma clipped.\n        axis : int or `None`, optional\n            If not `None`, clip along the given axis.  For this case,\n            ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``,\n            which are expected to return an array with the axis\n            dimension removed (like the numpy functions).  If `None`,\n            clip over all axes.  Defaults to `None`.\n        copy : bool, optional\n            If `True`, the ``data`` array will be copied.  If `False`,\n            the returned masked array data will contain the same array\n            as ``data``.  Defaults to `True`.\n\n        Returns\n        -------\n        filtered_data : `numpy.ma.MaskedArray`\n            A masked array with the same shape as ``data`` input, where\n            the points rejected by the algorithm have been masked.\n        ","endLoc":213,"header":"def __call__(self, data, axis=None, copy=True)","id":6647,"name":"__call__","nodeType":"Function","startLoc":160,"text":"def __call__(self, data, axis=None, copy=True):\n        \"\"\"\n        Perform sigma clipping on the provided data.\n\n        Parameters\n        ----------\n        data : array-like\n            The data to be sigma clipped.\n        axis : int or `None`, optional\n            If not `None`, clip along the given axis.  For this case,\n            ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``,\n            which are expected to return an array with the axis\n            dimension removed (like the numpy functions).  If `None`,\n            clip over all axes.  Defaults to `None`.\n        copy : bool, optional\n            If `True`, the ``data`` array will be copied.  If `False`,\n            the returned masked array data will contain the same array\n            as ``data``.  Defaults to `True`.\n\n        Returns\n        -------\n        filtered_data : `numpy.ma.MaskedArray`\n            A masked array with the same shape as ``data`` input, where\n            the points rejected by the algorithm have been masked.\n        \"\"\"\n\n        if self.sigma_lower is None:\n            self.sigma_lower = self.sigma\n        if self.sigma_upper is None:\n            self.sigma_upper = self.sigma\n\n        if np.any(~np.isfinite(data)):\n            data = np.ma.masked_invalid(data)\n            warnings.warn('Input data contains invalid values (NaNs or '\n                          'infs), which were automatically masked.',\n                          AstropyUserWarning)\n\n        filtered_data = np.ma.array(data, copy=copy)\n\n        if self.iters is None:\n            lastrej = filtered_data.count() + 1\n            while filtered_data.count() != lastrej:\n                lastrej = filtered_data.count()\n                self._perform_clip(filtered_data, axis=axis)\n        else:\n            for i in range(self.iters):\n                self._perform_clip(filtered_data, axis=axis)\n\n        # prevent filtered_data.mask = False (scalar) if no values are clipped\n        if filtered_data.mask.shape == ():\n            # make .mask shape match .data shape\n            filtered_data.mask = False\n\n        return filtered_data"},{"attributeType":"null","col":4,"comment":"null","endLoc":1148,"id":6648,"name":"name","nodeType":"Attribute","startLoc":1148,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":1149,"id":6649,"name":"unit","nodeType":"Attribute","startLoc":1149,"text":"unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":6650,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":6651,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":27,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"formats.py#<anonymous>","id":6652,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['TimeFormat', 'TimeJD', 'TimeMJD', 'TimeFromEpoch', 'TimeUnix',\n           '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']\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":1325,"header":"def _web_profile_register(self, identity_info,\n                              client_address=(\"unknown\", 0),\n                              origin=\"unknown\")","id":6653,"name":"_web_profile_register","nodeType":"Function","startLoc":1286,"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.\")"},{"fileName":"histogram.py","filePath":"astropy/stats","id":6654,"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: http://astroML.org/\n\"\"\"\n\n\n\nimport numpy as np\nfrom . import bayesian_blocks\n\n__all__ = ['histogram', 'scott_bin_width', 'freedman_bin_width',\n           'knuth_bin_width']\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 or 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        Not Implemented\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``normed`` 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    # 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 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 == '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(\"unrecognized bin code: '{}'\".format(bins))\n\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        bins = dmin + dx * np.arange(Nbins + 1)\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 a width dx\"\"\"\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        dx : float\n            Width of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth likelihood 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":6655,"name":"sigma","nodeType":"Attribute","startLoc":109,"text":"self.sigma"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":6656,"name":"cenfunc","nodeType":"Attribute","startLoc":113,"text":"self.cenfunc"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":6657,"name":"sigma_lower","nodeType":"Attribute","startLoc":110,"text":"self.sigma_lower"},{"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 2012 [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    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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\n\n    See Also\n    --------\n    astropy.stats.histogram : compute a histogram using bayesian blocks\n    ","endLoc":154,"header":"def bayesian_blocks(t, x=None, sigma=None,\n                    fitness='events', **kwargs)","id":6658,"name":"bayesian_blocks","nodeType":"Function","startLoc":54,"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 2012 [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    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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\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":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 : {int, sequence of int, None}, optional\n        Axis along which the robust standard deviations are computed.\n        The default (`None`) is to compute the robust standard deviation\n        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.RandomState(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    2.0232764659422626\n\n    See Also\n    --------\n    biweight_midvariance, biweight_midcovariance, median_absolute_deviation\n    ","endLoc":875,"header":"def mad_std(data, axis=None, func=None, ignore_nan=False)","id":6659,"name":"mad_std","nodeType":"Function","startLoc":818,"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 : {int, sequence of int, None}, optional\n        Axis along which the robust standard deviations are computed.\n        The default (`None`) is to compute the robust standard deviation\n        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.RandomState(12345)\n    >>> madstd = mad_std(rand.normal(5, 2, (100, 100)))\n    >>> print(madstd)    # doctest: +FLOAT_CMP\n    2.0232764659422626\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":918,"header":"def signal_to_noise_oir_ccd(t, source_eps, sky_eps, dark_eps, rd, npix,\n                            gain=1.0)","id":6660,"name":"signal_to_noise_oir_ccd","nodeType":"Function","startLoc":878,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":6661,"name":"iters","nodeType":"Attribute","startLoc":112,"text":"self.iters"},{"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 : numpy.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 : numpy.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":1031,"header":"def bootstrap(data, bootnum=100, samples=None, bootfunc=None)","id":6662,"name":"bootstrap","nodeType":"Function","startLoc":921,"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 : numpy.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 : numpy.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":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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires `scipy`. This implementation will cause Overflow Errors for about\n    N > 100 (the exact limit depends on details of how scipy was compiled).\n    See `~astropy.stats.mpmath_poisson_upper_limit` for an implementation that\n    is slower, but can deal with arbitrarily high numbers since it is based on\n    the `mpmath <http://mpmath.org/>`_ library.\n    ","endLoc":1116,"header":"def _scipy_kraft_burrows_nousek(N, B, CL)","id":6663,"name":"_scipy_kraft_burrows_nousek","nodeType":"Function","startLoc":1034,"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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\n       Confidence level (number between 0 and 1)\n\n    Returns\n    -------\n    S : source count limit\n\n    Notes\n    -----\n    Requires `scipy`. This implementation will cause Overflow Errors for about\n    N > 100 (the exact limit depends on details of how scipy was compiled).\n    See `~astropy.stats.mpmath_poisson_upper_limit` for an implementation that\n    is slower, but can deal with arbitrarily high numbers since it is based on\n    the `mpmath <http://mpmath.org/>`_ library.\n    '''\n\n    from scipy.optimize import brentq\n    from scipy.integrate import quad\n\n    from math import exp\n\n    def eqn8(N, B):\n        n = np.arange(N + 1, dtype=np.float64)\n        # Create an array containing the factorials. scipy.special.factorial\n        # requires SciPy 0.14 (#5064) therefore this is calculated by using\n        # numpy.cumprod. This could be replaced by factorial again as soon as\n        # older SciPy are not supported anymore but the cumprod alternative\n        # might also be a bit faster.\n        factorial_n = np.ones(n.shape, dtype=np.float64)\n        np.cumprod(n[1:], out=factorial_n[1:])\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":8,"comment":"null","endLoc":114,"id":6664,"name":"stdfunc","nodeType":"Attribute","startLoc":114,"text":"self.stdfunc"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":6665,"name":"sigma_upper","nodeType":"Attribute","startLoc":111,"text":"self.sigma_upper"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":6666,"name":"ctype_to_dtype","nodeType":"Attribute","startLoc":20,"text":"ctype_to_dtype"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":6668,"name":"NDIMS_REX","nodeType":"Attribute","startLoc":29,"text":"NDIMS_REX"},{"attributeType":"null","col":0,"comment":"null","endLoc":536,"id":6669,"name":"DEFAULT_ERFA_LOC","nodeType":"Attribute","startLoc":536,"text":"DEFAULT_ERFA_LOC"},{"attributeType":"null","col":0,"comment":"null","endLoc":538,"id":6671,"name":"DEFAULT_TEMPLATE_LOC","nodeType":"Attribute","startLoc":538,"text":"DEFAULT_TEMPLATE_LOC"},{"col":26,"endLoc":1107,"id":6672,"nodeType":"Lambda","startLoc":1107,"text":"lambda x: eqn7(x, N, B) - y_S_max"},{"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":354,"id":6673,"nodeType":"Class","startLoc":281,"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 a width dx\"\"\"\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        dx : float\n            Width of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth likelihood 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)))"},{"attributeType":"null","col":4,"comment":"null","endLoc":543,"id":6674,"name":"ap","nodeType":"Attribute","startLoc":543,"text":"ap"},{"col":4,"comment":"null","endLoc":319,"header":"def __init__(self, data)","id":6676,"name":"__init__","nodeType":"Function","startLoc":306,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":561,"id":6677,"name":"args","nodeType":"Attribute","startLoc":561,"text":"args"},{"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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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":1193,"header":"def _mpmath_kraft_burrows_nousek(N, B, CL)","id":6679,"name":"_mpmath_kraft_burrows_nousek","nodeType":"Function","startLoc":1119,"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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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    N = mpf(N)\n    B = mpf(B)\n    CL = mpf(CL)\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 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, (N - B) / 2.)\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    S_max = findroot(func, N - B, tol=1e-4)\n    S_min = find_s_min(S_max, N, B)\n    return float(S_min), float(S_max)"},{"col":0,"comment":"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations from a\n    center value. If the data contains invalid values (NaNs or infs),\n    they are automatically masked before performing the sigma clipping.\n\n    For an object-oriented interface to sigma clipping, see\n    :func:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this function.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be sigma clipped.\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n    copy : bool, optional\n        If `True`, the ``data`` array will be copied.  If `False`, the\n        returned masked array data will contain the same array as\n        ``data``.  Defaults to `True`.\n\n    Returns\n    -------\n    filtered_data : `numpy.ma.MaskedArray`\n        A masked array with the same shape as ``data`` input, where the\n        points rejected by the algorithm have been masked.\n\n    Notes\n    -----\n     1. The routine works by calculating::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        and then setting a mask for points outside the range::\n\n           deviation < (-sigma_lower * stdfunc(deviation))\n           deviation > (sigma_upper * stdfunc(deviation))\n\n        It will iterate a given number of times, or until no further\n        data are rejected.\n\n     2. Most numpy functions deal well with masked arrays, but if one\n        would like to have an array with just the good (or bad) values, one\n        can use::\n\n            good_only = filtered_data.data[~filtered_data.mask]\n            bad_only = filtered_data.data[filtered_data.mask]\n\n        However, for multidimensional data, this flattens the array,\n        which may not be what one wants (especially if filtering was\n        done along an axis).\n\n    See Also\n    --------\n    SigmaClip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\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, iters=5)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    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, iters=None,\n        ...                            cenfunc=mean, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    ","endLoc":356,"header":"def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, iters=5,\n               cenfunc=np.ma.median, stdfunc=np.std, axis=None, copy=True)","id":6682,"name":"sigma_clip","nodeType":"Function","startLoc":216,"text":"def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, iters=5,\n               cenfunc=np.ma.median, stdfunc=np.std, axis=None, copy=True):\n    \"\"\"\n    Perform sigma-clipping on the provided data.\n\n    The data will be iterated over, each time rejecting points that are\n    discrepant by more than a specified number of standard deviations from a\n    center value. If the data contains invalid values (NaNs or infs),\n    they are automatically masked before performing the sigma clipping.\n\n    For an object-oriented interface to sigma clipping, see\n    :func:`SigmaClip`.\n\n    .. note::\n        `scipy.stats.sigmaclip\n        <https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.sigmaclip.html>`_\n        provides a subset of the functionality in this function.\n\n    Parameters\n    ----------\n    data : array-like\n        The data to be sigma clipped.\n    sigma : float, optional\n        The number of standard deviations to use for both the lower and\n        upper clipping limit. These limits are overridden by\n        ``sigma_lower`` and ``sigma_upper``, if input. Defaults to 3.\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. Defaults to `None`.\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. Defaults to `None`.\n    iters : int or `None`, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing). Defaults to 5.\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.std`).\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n    copy : bool, optional\n        If `True`, the ``data`` array will be copied.  If `False`, the\n        returned masked array data will contain the same array as\n        ``data``.  Defaults to `True`.\n\n    Returns\n    -------\n    filtered_data : `numpy.ma.MaskedArray`\n        A masked array with the same shape as ``data`` input, where the\n        points rejected by the algorithm have been masked.\n\n    Notes\n    -----\n     1. The routine works by calculating::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        and then setting a mask for points outside the range::\n\n           deviation < (-sigma_lower * stdfunc(deviation))\n           deviation > (sigma_upper * stdfunc(deviation))\n\n        It will iterate a given number of times, or until no further\n        data are rejected.\n\n     2. Most numpy functions deal well with masked arrays, but if one\n        would like to have an array with just the good (or bad) values, one\n        can use::\n\n            good_only = filtered_data.data[~filtered_data.mask]\n            bad_only = filtered_data.data[filtered_data.mask]\n\n        However, for multidimensional data, this flattens the array,\n        which may not be what one wants (especially if filtering was\n        done along an axis).\n\n    See Also\n    --------\n    SigmaClip\n\n    Examples\n    --------\n    This example generates random variates from a Gaussian distribution\n    and returns a masked array in which all points that are more than 2\n    sample standard deviations from the median are masked::\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, iters=5)\n\n    This example sigma clips on a similar distribution, but uses 3 sigma\n    relative to the sample *mean*, clips until convergence, and does not\n    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, iters=None,\n        ...                            cenfunc=mean, copy=False)\n\n    This example sigma clips along one axis on a similar distribution\n    (with bad points inserted)::\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 masked, as the\n    variance is higher.\n    \"\"\"\n\n    sigclip = SigmaClip(sigma=sigma, sigma_lower=sigma_lower,\n                        sigma_upper=sigma_upper, iters=iters,\n                        cenfunc=cenfunc, stdfunc=stdfunc)\n    return sigclip(data, axis=axis, copy=copy)"},{"col":4,"comment":"Return the bin edges given a width dx","endLoc":323,"header":"def bins(self, M)","id":6683,"name":"bins","nodeType":"Function","startLoc":321,"text":"def bins(self, M):\n        \"\"\"Return the bin edges given a width dx\"\"\"\n        return np.linspace(self.data[0], self.data[-1], int(M) + 1)"},{"col":0,"comment":"","endLoc":11,"header":"erfa_generator.py#<anonymous>","id":6686,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module's main purpose is to act as a script to create new versions\nof erfa.c when ERFA is updated (or this generator is enhanced).\n\n`Jinja2 <http://jinja.pocoo.org/>`_ must be installed for this\nmodule/script to function.\n\nNote that this does *not* currently automate the process of creating structs\nor dtypes for those structs.  They should be added manually in the template file.\n\"\"\"\n\nctype_to_dtype = {'double': \"numpy.double\",\n                  'int': \"numpy.intc\",\n                  'eraASTROM': \"dt_eraASTROM\",\n                  'eraLDBODY': \"dt_eraLDBODY\",\n                  'char': \"numpy.dtype('S1')\",\n                  'const char': \"numpy.dtype('S16')\",\n                  }\n\nNDIMS_REX = re.compile(re.escape(\"numpy.dtype([('fi0', '.*', <(.*)>)])\").replace(r'\\.\\*', '.*').replace(r'\\<', '(').replace(r'\\>', ')'))\n\nDEFAULT_ERFA_LOC = os.path.join(os.path.split(__file__)[0],\n                                '../../cextern/erfa')\n\nDEFAULT_TEMPLATE_LOC = os.path.split(__file__)[0]\n\nif __name__ == '__main__':\n    from argparse import ArgumentParser\n\n    ap = ArgumentParser()\n    ap.add_argument('srcdir', default=DEFAULT_ERFA_LOC, nargs='?',\n                    help='Directory where the ERFA c and header files '\n                         'can be found or to a single erfa.c file '\n                         '(which must be in the same directory as '\n                         'erfa.h). Defaults to the builtin astropy '\n                         'erfa: \"{0}\"'.format(DEFAULT_ERFA_LOC))\n    ap.add_argument('-o', '--output', default='core.py',\n                    help='The output filename.  This is the name for only the '\n                         'pure-python output, the C part will have the '\n                         'same name but with a \".c\" extension.')\n    ap.add_argument('-t', '--template-loc',\n                    default=DEFAULT_TEMPLATE_LOC,\n                    help='the location where the \"core.c.templ\" '\n                         'template can be found.')\n    ap.add_argument('-q', '--quiet', action='store_false', dest='verbose',\n                    help='Suppress output normally printed to stdout.')\n\n    args = ap.parse_args()\n    main(args.srcdir, args.output, args.template_loc)"},{"col":4,"comment":"null","endLoc":326,"header":"def __call__(self, M)","id":6687,"name":"__call__","nodeType":"Function","startLoc":325,"text":"def __call__(self, M):\n        return self.eval(M)"},{"col":0,"comment":"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like\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 as the lower and upper\n        clipping limit.  These limits are overridden by ``sigma_lower``\n        and ``sigma_upper``, if input. Defaults to 3.\n\n    sigma_lower : float, 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 used.\n        Defaults to `None`.\n\n    sigma_upper : float, 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 used.\n        Defaults to `None`.\n\n    iters : int, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing) when calculating the statistics.\n        Defaults to 5.\n\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.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 zero.\n\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n    ","endLoc":461,"header":"def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, iters=5,\n                        cenfunc=np.ma.median, stdfunc=np.std, std_ddof=0,\n                        axis=None)","id":6688,"name":"sigma_clipped_stats","nodeType":"Function","startLoc":359,"text":"def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,\n                        sigma_lower=None, sigma_upper=None, iters=5,\n                        cenfunc=np.ma.median, stdfunc=np.std, std_ddof=0,\n                        axis=None):\n    \"\"\"\n    Calculate sigma-clipped statistics on the provided data.\n\n    Parameters\n    ----------\n    data : array-like\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 as the lower and upper\n        clipping limit.  These limits are overridden by ``sigma_lower``\n        and ``sigma_upper``, if input. Defaults to 3.\n\n    sigma_lower : float, 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 used.\n        Defaults to `None`.\n\n    sigma_upper : float, 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 used.\n        Defaults to `None`.\n\n    iters : int, optional\n        The number of iterations to perform sigma clipping, or `None` to\n        clip until convergence is achieved (i.e., continue until the\n        last iteration clips nothing) when calculating the statistics.\n        Defaults to 5.\n\n    cenfunc : callable, optional\n        The function used to compute the center for the clipping. Must\n        be a callable that takes in a masked array and outputs the\n        central value. Defaults to the median (`numpy.ma.median`).\n\n    stdfunc : callable, optional\n        The function used to compute the standard deviation about the\n        center. Must be a callable that takes in a masked array and\n        outputs a width estimator. Masked (rejected) pixels are those\n        where::\n\n             deviation < (-sigma_lower * stdfunc(deviation))\n             deviation > (sigma_upper * stdfunc(deviation))\n\n        where::\n\n            deviation = data - cenfunc(data [,axis=int])\n\n        Defaults to the standard deviation (`numpy.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 zero.\n\n    axis : int or `None`, optional\n        If not `None`, clip along the given axis.  For this case,\n        ``axis`` will be passed on to ``cenfunc`` and ``stdfunc``, which\n        are expected to return an array with the axis dimension removed\n        (like the numpy functions).  If `None`, clip over all axes.\n        Defaults to `None`.\n\n    Returns\n    -------\n    mean, median, stddev : float\n        The mean, median, and standard deviation of the sigma-clipped\n        data.\n    \"\"\"\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    data_clip = sigma_clip(data, sigma=sigma, sigma_lower=sigma_lower,\n                           sigma_upper=sigma_upper, iters=iters,\n                           cenfunc=cenfunc, stdfunc=stdfunc, axis=axis)\n\n    mean = np.ma.mean(data_clip, axis=axis)\n    median = np.ma.median(data_clip, axis=axis)\n    std = np.ma.std(data_clip, ddof=std_ddof, axis=axis)\n\n    if axis is None and np.ma.isMaskedArray(median):\n        # np.ma.median now always return a MaskedArray, even with one\n        # element. So for compatibility with previous versions of astropy,\n        # we keep taking the scalar value.\n        median = median.item()\n\n    return mean, median, std"},{"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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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 `scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    ","endLoc":1245,"header":"def _kraft_burrows_nousek(N, B, CL)","id":6689,"name":"_kraft_burrows_nousek","nodeType":"Function","startLoc":1196,"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) <http://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\n        Total observed count number\n    B : float\n        Background count rate (assumed to be known with negligible error\n        from a large background area).\n    CL : float\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 `scipy` or `mpmath\n    <http://mpmath.org/>`_  need to be available. (Scipy only works for\n    N < 100).\n    '''\n    try:\n        import scipy\n        HAS_SCIPY = True\n    except ImportError:\n        HAS_SCIPY = False\n\n    try:\n        import mpmath\n        HAS_MPMATH = True\n    except ImportError:\n        HAS_MPMATH = False\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.')"},{"fileName":"bayesian_blocks.py","filePath":"astropy/stats","id":6690,"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 2012 [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] http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\n.. [2] http://astroML.org/ https://github.com//astroML/astroML/\n\"\"\"\n\nimport warnings\n\nimport numpy as np\n\nfrom inspect import signature\nfrom ..utils.exceptions import AstropyUserWarning\n\n# TODO: implement other fitness functions from appendix B of Scargle 2012\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 2012 [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    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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\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        if x is not None:\n            x = np.asarray(x)\n        if sigma is not None:\n            sigma = np.asarray(sigma)\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)\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)\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 (2012)\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        if self.ncp_prior is not None:\n            return self.ncp_prior\n        elif 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`` is not defined, and cannot compute \"\n                             \"it as neither ``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        # ----------------------------------------------------------------\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 True:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\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 2012). 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    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        if p0 is not None and gamma is None and ncp_prior is None:\n            warnings.warn('p0 does not seem to accurately represent the false '\n                          'positive rate for event data. It is highly '\n                          'recommended that you run random trials on signal-'\n                          'free noise to calibrate ncp_prior to achieve a '\n                          'desired false positive rate.', AstropyUserWarning)\n        super().__init__(p0, gamma, ncp_prior)\n\n    def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2012\n        return N_k * (np.log(N_k) - np.log(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 2012). 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. 75 of Scargle 2012\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 2012). 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 2012\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":"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        dx : float\n            Width of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth likelihood function:\n            smaller values indicate a better fit.\n        ","endLoc":354,"header":"def eval(self, M)","id":6691,"name":"eval","nodeType":"Function","startLoc":328,"text":"def eval(self, M):\n        \"\"\"Evaluate the Knuth function\n\n        Parameters\n        ----------\n        dx : float\n            Width of bins\n\n        Returns\n        -------\n        F : float\n            evaluation of the negative Knuth likelihood 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":"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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\n    ","endLoc":394,"id":6692,"nodeType":"Class","startLoc":157,"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. (2012)\n       http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\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        if x is not None:\n            x = np.asarray(x)\n        if sigma is not None:\n            sigma = np.asarray(sigma)\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)\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)\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 (2012)\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        if self.ncp_prior is not None:\n            return self.ncp_prior\n        elif 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`` is not defined, and cannot compute \"\n                             \"it as neither ``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        # ----------------------------------------------------------------\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 True:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\n        change_points = change_points[i_cp:]\n\n        return edges[change_points]"},{"col":4,"comment":"null","endLoc":196,"header":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None)","id":6693,"name":"__init__","nodeType":"Function","startLoc":193,"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":265,"header":"def validate_input(self, t, x=None, sigma=None)","id":6694,"name":"validate_input","nodeType":"Function","startLoc":198,"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        if x is not None:\n            x = np.asarray(x)\n        if sigma is not None:\n            sigma = np.asarray(sigma)\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)\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)\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"},{"attributeType":"null","col":16,"comment":"null","endLoc":3,"id":6695,"name":"np","nodeType":"Attribute","startLoc":3,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":6696,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"sigma_clipping.py#<anonymous>","id":6697,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['SigmaClip', 'sigma_clip', 'sigma_clipped_stats']"},{"col":4,"comment":"\n        Evaluates the Ripley K function for the homongeneous 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":6698,"name":"poisson","nodeType":"Function","startLoc":139,"text":"def poisson(self, radii):\n        \"\"\"\n        Evaluates the Ripley K function for the homongeneous 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"},{"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":6699,"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)"},{"fileName":"circstats.py","filePath":"astropy/stats","id":6700,"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', 'circvar', 'circmoment', 'circcorrcoef', 'rayleightest',\n           'vtest', 'vonmisesmle']\n__doctest_requires__ = {'vtest': ['scipy.stats']}\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 : numpy.ndarray or 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 : numpy.ndarray or 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 : numpy.ndarray or dimensionless 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 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 : numpy.ndarray or dimensionless Quantity\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 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 : numpy.ndarray or 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 : Boolean, 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 : numpy.ndarray or 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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : numpy.ndarray or 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 : numpy.ndarray or dimensionless Quantity\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 : numpy.ndarray or 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 dimensionless Quantity\n        p-value.\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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or Quantity, 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 dimensionless Quantity\n        p-value.\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 : numpy.ndarray or 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 Quantity\n        the mean (aka location parameter).\n    kappa : float or dimensionless Quantity\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":"\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":6701,"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":4,"comment":"null","endLoc":268,"header":"def fitness(self, **kwargs)","id":6702,"name":"fitness","nodeType":"Function","startLoc":267,"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 (2012)\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":279,"header":"def p0_prior(self, N)","id":6703,"name":"p0_prior","nodeType":"Function","startLoc":270,"text":"def p0_prior(self, N):\n        \"\"\"\n        Empirical prior, parametrized by the false alarm probability ``p0``\n        See  eq. 21 in Scargle (2012)\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":59,"id":6704,"name":"area","nodeType":"Attribute","startLoc":59,"text":"self.area"},{"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    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    ","endLoc":1325,"header":"def kuiper_false_positive_probability(D, N)","id":6705,"name":"kuiper_false_positive_probability","nodeType":"Function","startLoc":1248,"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    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    \"\"\"\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.)\n        a, b = -k + r, -k - r\n        return 1. - factorial(N - 1) * (b**(N - 1.) * (1. - a) -\n                                        a**(N - 1.) * (1. - b)) / float(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        def T(t):\n            y = D + t / float(N)\n            return y**(t - 3) * (y**3 * N - y**2 * t * (3. - 2. /\n                                                        N) / N - t * (t - 1) * (t - 2) / float(N)**2)\n        s = 0.\n        # NOTE: the upper limit of this sum is taken from Stephens 1965\n        for t in range(int(np.floor(N * (1 - D))) + 1):\n            term = T(t) * comb(N, t) * (1 - D - t / float(N))**(N - t - 1)\n            s += term\n        return s\n    else:\n        z = D * np.sqrt(N)\n        S1 = 0.\n        term_eps = 1e-12\n        abs_eps = 1e-100\n        for m in itertools.count(1):\n            T1 = 2. * (4. * m**2 * z**2 - 1.) * np.exp(-2. * m**2 * z**2)\n            so = S1\n            S1 += T1\n            if np.abs(S1 - so) / (np.abs(S1) + np.abs(so)\n                                  ) < term_eps or np.abs(S1 - so) < abs_eps:\n                break\n        S2 = 0.\n        for m in itertools.count(1):\n            T2 = m**2 * (4. * m**2 * z**2 - 3.) * np.exp(-2 * m**2 * z**2)\n            so = S2\n            S2 += T2\n            if np.abs(S2 - so) / (np.abs(S2) + np.abs(so)\n                                  ) < term_eps or np.abs(S1 - so) < abs_eps:\n                break\n        return S1 - 8 * D / (3. * np.sqrt(N)) * S2"},{"col":4,"comment":"null","endLoc":285,"header":"@property\n    def _fitness_args(self)","id":6706,"name":"_fitness_args","nodeType":"Function","startLoc":283,"text":"@property\n    def _fitness_args(self):\n        return signature(self.fitness).parameters.keys()"},{"col":0,"comment":"null","endLoc":34,"header":"def _components(data, p=1, phi=0.0, axis=None, weights=None)","id":6707,"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":"\n        If ``ncp_prior`` is not explicitly defined, compute it from ``gamma``\n        or ``p0``.\n        ","endLoc":300,"header":"def compute_ncp_prior(self, N)","id":6708,"name":"compute_ncp_prior","nodeType":"Function","startLoc":287,"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        if self.ncp_prior is not None:\n            return self.ncp_prior\n        elif 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`` is not defined, and cannot compute \"\n                             \"it as neither ``gamma`` nor ``p0`` is defined.\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":319,"id":6709,"name":"gammaln","nodeType":"Attribute","startLoc":319,"text":"self.gammaln"},{"attributeType":"null","col":8,"comment":"null","endLoc":307,"id":6710,"name":"data","nodeType":"Attribute","startLoc":307,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":311,"id":6711,"name":"n","nodeType":"Attribute","startLoc":311,"text":"self.n"},{"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 or 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        Not Implemented\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``normed`` 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":90,"header":"def histogram(a, bins=10, range=None, weights=None, **kwargs)","id":6712,"name":"histogram","nodeType":"Function","startLoc":18,"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 or 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        Not Implemented\n\n    other keyword arguments are described in numpy.histogram().\n\n    Returns\n    -------\n    hist : array\n        The values of the histogram. See ``normed`` 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    # 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 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 == '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(\"unrecognized bin code: '{}'\".format(bins))\n\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":"{__gt__}","col":12,"comment":"null","endLoc":72,"id":6713,"name":"_area","nodeType":"Attribute","startLoc":72,"text":"self._area"},{"attributeType":"null","col":12,"comment":"null","endLoc":120,"id":6714,"name":"_x_min","nodeType":"Attribute","startLoc":120,"text":"self._x_min"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":6715,"name":"y_min","nodeType":"Attribute","startLoc":63,"text":"self.y_min"},{"col":0,"comment":"null","endLoc":48,"header":"def _angle(data, p=1, phi=0.0, axis=None, weights=None)","id":6716,"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"},{"col":4,"comment":"null","endLoc":1338,"header":"def _web_profile_allowReverseCallbacks(self, private_key, allow)","id":6717,"name":"_web_profile_allowReverseCallbacks","nodeType":"Function","startLoc":1327,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))\n        return \"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":6718,"name":"x_max","nodeType":"Attribute","startLoc":60,"text":"self.x_max"},{"attributeType":"null","col":12,"comment":"null","endLoc":96,"id":6719,"name":"_x_max","nodeType":"Attribute","startLoc":96,"text":"self._x_max"},{"attributeType":"null","col":8,"comment":"null","endLoc":61,"id":6720,"name":"y_max","nodeType":"Attribute","startLoc":61,"text":"self.y_max"},{"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":394,"header":"def fit(self, t, x=None, sigma=None)","id":6721,"name":"fit","nodeType":"Function","startLoc":302,"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        # ----------------------------------------------------------------\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 True:\n            i_cp -= 1\n            change_points[i_cp] = ind\n            if ind == 0:\n                break\n            ind = last[ind - 1]\n        change_points = change_points[i_cp:]\n\n        return edges[change_points]"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":6722,"name":"x_min","nodeType":"Attribute","startLoc":62,"text":"self.x_min"},{"col":0,"comment":"null","endLoc":54,"header":"def _length(data, p=1, phi=0.0, axis=None, weights=None)","id":6723,"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":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":278,"header":"def knuth_bin_width(data, return_bins=False, quiet=True)","id":6724,"name":"knuth_bin_width","nodeType":"Function","startLoc":218,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":84,"id":6726,"name":"_y_max","nodeType":"Attribute","startLoc":84,"text":"self._y_max"},{"attributeType":"null","col":12,"comment":"null","endLoc":108,"id":6727,"name":"_y_min","nodeType":"Attribute","startLoc":108,"text":"self._y_min"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":6728,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"col":0,"comment":"","endLoc":4,"header":"spatial.py#<anonymous>","id":6729,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module implements functions and classes for spatial statistics.\n\"\"\""},{"col":0,"comment":" Computes the circular mean angle of an array of circular data.\n\n    Parameters\n    ----------\n    data : numpy.ndarray or 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 : numpy.ndarray or 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":6730,"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 : numpy.ndarray or 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 : numpy.ndarray or 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)"},{"id":6731,"name":"astropy/stats/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/tests","id":6732,"nodeType":"File","text":""},{"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 : numpy.ndarray or dimensionless 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 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 : numpy.ndarray or dimensionless Quantity\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":149,"header":"def circvar(data, axis=None, weights=None)","id":6733,"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 : numpy.ndarray or dimensionless 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 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 : numpy.ndarray or dimensionless Quantity\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)"},{"col":0,"comment":" Computes the ``p``-th trigonometric circular moment for an array\n    of circular data.\n\n    Parameters\n    ----------\n    data : numpy.ndarray or 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 : Boolean, 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 : numpy.ndarray or 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":204,"header":"def circmoment(data, p=1.0, centered=False, axis=None, weights=None)","id":6734,"name":"circmoment","nodeType":"Function","startLoc":152,"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 : numpy.ndarray or 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 : Boolean, 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 : numpy.ndarray or 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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : numpy.ndarray or 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 : numpy.ndarray or dimensionless Quantity\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":268,"header":"def circcorrcoef(alpha, beta, axis=None, weights_alpha=None,\n                 weights_beta=None)","id":6735,"name":"circcorrcoef","nodeType":"Function","startLoc":207,"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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    beta : numpy.ndarray or 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 : numpy.ndarray or dimensionless Quantity\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"},{"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":215,"header":"def freedman_bin_width(data, return_bins=False)","id":6736,"name":"freedman_bin_width","nodeType":"Function","startLoc":154,"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        bins = dmin + dx * np.arange(Nbins + 1)\n        return dx, bins\n    else:\n        return dx"},{"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 : numpy.ndarray or 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 dimensionless Quantity\n        p-value.\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":335,"header":"def rayleightest(data, axis=None, weights=None)","id":6737,"name":"rayleightest","nodeType":"Function","startLoc":271,"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 : numpy.ndarray or 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 dimensionless Quantity\n        p-value.\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"},{"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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or Quantity, 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 dimensionless Quantity\n        p-value.\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":398,"header":"def vtest(data, mu=0.0, axis=None, weights=None)","id":6738,"name":"vtest","nodeType":"Function","startLoc":338,"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 : numpy.ndarray or Quantity\n        Array of circular (directional) data, which is assumed to be in\n        radians whenever ``data`` is ``numpy.ndarray``.\n    mu : float or Quantity, 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 dimensionless Quantity\n        p-value.\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"},{"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":1399,"header":"def kuiper(data, cdf=lambda x: x, args=())","id":6739,"name":"kuiper","nodeType":"Function","startLoc":1328,"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":1328,"id":6740,"nodeType":"Lambda","startLoc":1328,"text":"lambda x: x"},{"col":4,"comment":"null","endLoc":1354,"header":"def _web_profile_pullCallbacks(self, private_key, timeout_secs)","id":6741,"name":"_web_profile_pullCallbacks","nodeType":"Function","startLoc":1340,"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, \"Private-key {} expired or invalid.\"\n                                 .format(private_key))"},{"col":0,"comment":"null","endLoc":409,"header":"def _A1inv(x)","id":6742,"name":"_A1inv","nodeType":"Function","startLoc":401,"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 : numpy.ndarray or 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 Quantity\n        the mean (aka location parameter).\n    kappa : float or dimensionless Quantity\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":451,"header":"def vonmisesmle(data, axis=None)","id":6743,"name":"vonmisesmle","nodeType":"Function","startLoc":412,"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 : numpy.ndarray or 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 Quantity\n        the mean (aka location parameter).\n    kappa : float or dimensionless Quantity\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":6744,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":6745,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":18,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":11,"header":"circstats.py#<anonymous>","id":6746,"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', 'circvar', 'circmoment', 'circcorrcoef', 'rayleightest',\n           'vtest', 'vonmisesmle']\n\n__doctest_requires__ = {'vtest': ['scipy.stats']}"},{"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":151,"header":"def scott_bin_width(data, return_bins=False)","id":6747,"name":"scott_bin_width","nodeType":"Function","startLoc":93,"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":"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":1437,"header":"def kuiper_two(data1, data2)","id":6748,"name":"kuiper_two","nodeType":"Function","startLoc":1402,"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, data2 = np.sort(data1), np.sort(data2)\n\n    if len(data2) < len(data1):\n        data1, data2 = data2, data1\n\n    # this could be more efficient\n    cdfv1 = np.searchsorted(data2, data1) / float(len(data2))\n    # this could be more efficient\n    cdfv2 = np.searchsorted(data1, data2) / float(len(data1))\n    D = (np.amax(cdfv1 - np.arange(len(data1)) / float(len(data1))) +\n         np.amax(cdfv2 - np.arange(len(data2)) / float(len(data2))))\n\n    Ne = len(data1) * len(data2) / float(len(data1) + len(data2))\n    return D, kuiper_false_positive_probability(D, Ne)"},{"id":6749,"name":"astropy/stats/lombscargle","nodeType":"Package"},{"fileName":"utils.py","filePath":"astropy/stats/lombscargle","id":6750,"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 : boolean\n        specify whether data should be pre-centered\n    fit_mean : boolean\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 : integer\n        the number of data points\n    from_normalization, to_normalization : strings\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(\"{0} is not a valid normalization\"\n                             \"\".format(from_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 '{0}' to '{1}'\"\n                                  \"\".format(from_normalization,\n                                            to_normalization))\n"},{"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 : boolean\n        specify whether data should be pre-centered\n    fit_mean : boolean\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":6751,"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 : boolean\n        specify whether data should be pre-centered\n    fit_mean : boolean\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)"},{"fileName":"_statistics.py","filePath":"astropy/stats/lombscargle","id":6752,"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.stats.LombScargle`` API.\n\"\"\"\n\nfrom functools import wraps\n\nimport numpy as np\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_like(val), 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 _log_gamma(N):\n    from scipy.special import gammaln\n    return 0.5 * np.log(2 / N) + 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 : integers, 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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))\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 : integers, 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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))\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 : integers, 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    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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))\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 : integers, 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(\"normalization={0}\".format(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    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    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('inv_fap_baluev did not converge for p={0}'.format(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('inv_fap_baluev did not converge for p={0}'.format(p))\n    return res.x\n\n\ndef _bootstrap_max(t, y, dy, fmax, normalization, random_seed):\n    \"\"\"Generate a sequence of bootstrap estimates of the max\"\"\"\n    from .core import LombScargle\n    rng = np.random.RandomState(random_seed)\n    while True:\n        s = rng.randint(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        yield 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 = np.fromiter(_bootstrap_max(t, y, dy, fmax,\n                                      normalization, random_seed),\n                       float, n_bootstraps)\n    pmax.sort()\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 = np.fromiter(_bootstrap_max(t, y, dy, fmax,\n                                      normalization, random_seed),\n                       float, n_bootstraps)\n    pmax.sort()\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(\"Unrecognized method: {0}\".format(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(\"Unrecognized method: {0}\".format(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"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":6753,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":6754,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":7,"header":"histogram.py#<anonymous>","id":6755,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nMethods for selecting the bin width of histograms\n\nPorted from the astroML project: http://astroML.org/\n\"\"\"\n\n__all__ = ['histogram', 'scott_bin_width', 'freedman_bin_width',\n           'knuth_bin_width']"},{"fileName":"__init__.py","filePath":"astropy/stats/lombscargle","id":6756,"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":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 : integer\n        the number of data points\n    from_normalization, to_normalization : strings\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":103,"header":"def convert_normalization(Z, N, from_normalization, to_normalization,\n                          chi2_ref=None)","id":6757,"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 : integer\n        the number of data points\n    from_normalization, to_normalization : strings\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(\"{0} is not a valid normalization\"\n                             \"\".format(from_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 '{0}' to '{1}'\"\n                                  \"\".format(from_normalization,\n                                            to_normalization))"},{"col":0,"comment":"null","endLoc":18,"header":"def _weighted_sum(val, dy)","id":6758,"name":"_weighted_sum","nodeType":"Function","startLoc":14,"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":8,"comment":"null","endLoc":155,"id":6759,"name":"_hub_secret","nodeType":"Attribute","startLoc":155,"text":"self._hub_secret"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":6760,"name":"_thread_lock","nodeType":"Attribute","startLoc":139,"text":"self._thread_lock"},{"attributeType":"null","col":16,"comment":"null","endLoc":1,"id":6761,"name":"np","nodeType":"Attribute","startLoc":1,"text":"np"},{"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 Quantity\n        sequence of observation times\n    y : array_like or Quantity\n        sequence of observations associated with times t\n    dy : float, array_like or Quantity (optional)\n        error or sequence of observational errors associated with times t\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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.RandomState(42)\n    >>> t = 100 * rand.rand(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.randn(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.0016662310392956\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.0204304 , 0.01393845, 0.35552682, 0.01358029, 0.03083737])\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":541,"id":6762,"nodeType":"Class","startLoc":27,"text":"class LombScargle:\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 Quantity\n        sequence of observation times\n    y : array_like or Quantity\n        sequence of observations associated with times t\n    dy : float, array_like or Quantity (optional)\n        error or sequence of observational errors associated with times t\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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.RandomState(42)\n    >>> t = 100 * rand.rand(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.randn(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.0016662310392956\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.0204304 , 0.01393845, 0.35552682, 0.01358029, 0.03083737])\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        self.t, self.y, self.dy = self._validate_inputs(t, y, dy)\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.t):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self.t.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.t):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self.t.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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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 Quantity\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self.t.max() - self.t.min()\n        n_samples = self.t.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 : string (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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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\n        Returns\n        -------\n        frequency, power : ndarrays\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 Quantity\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 : string (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, default=True)\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, default=True)\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.t, 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 model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        Parameters\n        ----------\n        t : array_like or Quantity, length n_samples\n            times at which to compute the model\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray, length n_samples\n            The model fit corresponding to the input times\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(t)\n        y_fit = periodic_fit(*strip_units(self.t, 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 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.t), 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.t, 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.t, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":6763,"name":"NORMALIZATIONS","nodeType":"Attribute","startLoc":4,"text":"NORMALIZATIONS"},{"col":0,"comment":"","endLoc":1,"header":"utils.py#<anonymous>","id":6764,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"NORMALIZATIONS = ['standard', 'psd', 'model', 'log']"},{"attributeType":"null","col":8,"comment":"null","endLoc":184,"id":6765,"name":"_client_id_counter","nodeType":"Attribute","startLoc":184,"text":"self._client_id_counter"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":6766,"name":"_private_keys","nodeType":"Attribute","startLoc":162,"text":"self._private_keys"},{"attributeType":"null","col":8,"comment":"null","endLoc":178,"id":6767,"name":"_xmlrpc_endpoints","nodeType":"Attribute","startLoc":178,"text":"self._xmlrpc_endpoints"},{"col":0,"comment":"null","endLoc":25,"header":"def _weighted_mean(val, dy)","id":6768,"name":"_weighted_mean","nodeType":"Function","startLoc":21,"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_like(val), dy)"},{"fileName":"core.py","filePath":"astropy/stats/lombscargle","id":6769,"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\nfrom . import _statistics\nfrom ... import units\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:\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 Quantity\n        sequence of observation times\n    y : array_like or Quantity\n        sequence of observations associated with times t\n    dy : float, array_like or Quantity (optional)\n        error or sequence of observational errors associated with times t\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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.RandomState(42)\n    >>> t = 100 * rand.rand(100)\n    >>> y = np.sin(2 * np.pi * t) + rand.randn(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.0016662310392956\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.0204304 , 0.01393845, 0.35552682, 0.01358029, 0.03083737])\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        self.t, self.y, self.dy = self._validate_inputs(t, y, dy)\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.t):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self.t.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.t):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self.t.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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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 Quantity\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self.t.max() - self.t.min()\n        n_samples = self.t.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 : string (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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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\n        Returns\n        -------\n        frequency, power : ndarrays\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 Quantity\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 : string (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, default=True)\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, default=True)\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.t, 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 model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        Parameters\n        ----------\n        t : array_like or Quantity, length n_samples\n            times at which to compute the model\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray, length n_samples\n            The model fit corresponding to the input times\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(t)\n        y_fit = periodic_fit(*strip_units(self.t, 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 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.t), 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.t, 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.t, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)\n"},{"col":0,"comment":"null","endLoc":29,"header":"def _weighted_var(val, dy)","id":6770,"name":"_weighted_var","nodeType":"Function","startLoc":28,"text":"def _weighted_var(val, dy):\n    return _weighted_mean(val ** 2, dy) - _weighted_mean(val, dy) ** 2"},{"col":0,"comment":"null","endLoc":35,"header":"def _gamma(N)","id":6771,"name":"_gamma","nodeType":"Function","startLoc":32,"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":"null","endLoc":40,"header":"def _log_gamma(N)","id":6772,"name":"_log_gamma","nodeType":"Function","startLoc":38,"text":"def _log_gamma(N):\n    from scipy.special import gammaln\n    return 0.5 * np.log(2 / N) + gammaln(N / 2) - gammaln((N - 1) / 2)"},{"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 three-element tuples (ai,bi,wi)\n        The intervals to fold; ai and bi are the limits of the interval, and\n        wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : array of floats length N\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : array of floats of length N-1\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":1489,"header":"def fold_intervals(intervals)","id":6773,"name":"fold_intervals","nodeType":"Function","startLoc":1440,"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 three-element tuples (ai,bi,wi)\n        The intervals to fold; ai and bi are the limits of the interval, and\n        wi is the weight to apply to the interval.\n\n    Returns\n    -------\n    breaks : array of floats length N\n        The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and\n        breaks[-1] = 1\n    weights : array of floats of length N-1\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"},{"col":0,"comment":"null","endLoc":49,"header":"def vectorize_first_argument(func)","id":6774,"name":"vectorize_first_argument","nodeType":"Function","startLoc":43,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":6775,"name":"_hub_secret_code_customized","nodeType":"Attribute","startLoc":154,"text":"self._hub_secret_code_customized"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":6776,"name":"_label","nodeType":"Attribute","startLoc":113,"text":"self._label"},{"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 : integers, 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":99,"header":"def pdf_single(z, N, normalization, dH=1, dK=3)","id":6777,"name":"pdf_single","nodeType":"Function","startLoc":52,"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 : integers, 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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))"},{"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 : array of floats of length N\n        The boundaries of successive intervals.\n    totals : array of floats of length N-1\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":1525,"header":"def cdf_from_intervals(breaks, totals)","id":6778,"name":"cdf_from_intervals","nodeType":"Function","startLoc":1492,"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 : array of floats of length N\n        The boundaries of successive intervals.\n    totals : array of floats of length N-1\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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":6779,"name":"_port","nodeType":"Attribute","startLoc":111,"text":"self._port"},{"attributeType":"None","col":8,"comment":"null","endLoc":142,"id":6780,"name":"_thread_client_timeout","nodeType":"Attribute","startLoc":142,"text":"self._thread_client_timeout"},{"attributeType":"ThreadingXMLRPCServer","col":8,"comment":"null","endLoc":238,"id":6781,"name":"_server","nodeType":"Attribute","startLoc":238,"text":"self._server"},{"attributeType":"null","col":8,"comment":"null","endLoc":148,"id":6782,"name":"_client_activity_time","nodeType":"Attribute","startLoc":148,"text":"self._client_activity_time"},{"attributeType":"None","col":8,"comment":"null","endLoc":147,"id":6783,"name":"_last_activity_time","nodeType":"Attribute","startLoc":147,"text":"self._last_activity_time"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":6784,"name":"_client_timeout","nodeType":"Attribute","startLoc":115,"text":"self._client_timeout"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":6785,"name":"_launched_threads","nodeType":"Attribute","startLoc":144,"text":"self._launched_threads"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":6786,"name":"_timeout","nodeType":"Attribute","startLoc":114,"text":"self._timeout"},{"attributeType":"null","col":8,"comment":"null","endLoc":166,"id":6787,"name":"_metadata","nodeType":"Attribute","startLoc":166,"text":"self._metadata"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":6788,"name":"_url","nodeType":"Attribute","startLoc":245,"text":"self._url"},{"col":4,"comment":"null","endLoc":107,"header":"def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard')","id":6789,"name":"__init__","nodeType":"Function","startLoc":101,"text":"def __init__(self, t, y, dy=None, fit_mean=True, center_data=True,\n                 nterms=1, normalization='standard'):\n        self.t, self.y, self.dy = self._validate_inputs(t, y, dy)\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":194,"id":6790,"name":"p0","nodeType":"Attribute","startLoc":194,"text":"self.p0"},{"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 : integers, 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":150,"header":"def fap_single(z, N, normalization, dH=1, dK=3)","id":6791,"name":"fap_single","nodeType":"Function","startLoc":102,"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 : integers, 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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))"},{"col":11,"endLoc":1525,"id":6792,"nodeType":"Lambda","startLoc":1525,"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 : pairs of two floats\n        The two intervals.\n\n    Returns\n    -------\n    l : float\n        The length of the overlap between the two intervals.\n\n    ","endLoc":1557,"header":"def interval_overlap_length(i1, i2)","id":6793,"name":"interval_overlap_length","nodeType":"Function","startLoc":1528,"text":"def interval_overlap_length(i1, i2):\n    \"\"\"Compute the length of overlap of two intervals.\n\n    Parameters\n    ----------\n    i1, i2 : pairs of two floats\n        The two intervals.\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 : array of floats of length N\n        Endpoints of the intervals in the PDF\n    totals : array of floats of length N-1\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of floats\n        The average weight for each bin\n\n    ","endLoc":1591,"header":"def histogram_intervals(n, breaks, totals)","id":6794,"name":"histogram_intervals","nodeType":"Function","startLoc":1560,"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 : array of floats of length N\n        Endpoints of the intervals in the PDF\n    totals : array of floats of length N-1\n        Probability densities in each bin\n\n    Returns\n    -------\n    h : array of floats\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"},{"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 : string (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 : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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 (default=1)\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":219,"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":6795,"name":"lombscargle","nodeType":"Function","startLoc":113,"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 : string (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 : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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 (default=1)\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":0,"comment":"null","endLoc":24,"id":6796,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":6797,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":31,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":6798,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":32,"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":38,"id":6799,"name":"gaussian_sigma_to_fwhm","nodeType":"Attribute","startLoc":38,"text":"gaussian_sigma_to_fwhm"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":6800,"name":"_sync_msg_ids_heap","nodeType":"Attribute","startLoc":181,"text":"self._sync_msg_ids_heap"},{"attributeType":"None","col":8,"comment":"null","endLoc":123,"id":6801,"name":"_web_profile_server","nodeType":"Attribute","startLoc":123,"text":"self._web_profile_server"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":6802,"name":"_web_profile_callbacks","nodeType":"Attribute","startLoc":124,"text":"self._web_profile_callbacks"},{"attributeType":"null","col":8,"comment":"null","endLoc":359,"id":6803,"name":"_hub_private_key","nodeType":"Attribute","startLoc":359,"text":"self._hub_private_key"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":6804,"name":"_pool_size","nodeType":"Attribute","startLoc":116,"text":"self._pool_size"},{"col":4,"comment":"null","endLoc":128,"header":"def _validate_inputs(self, t, y, dy)","id":6805,"name":"_validate_inputs","nodeType":"Function","startLoc":109,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":196,"id":6806,"name":"ncp_prior","nodeType":"Attribute","startLoc":196,"text":"self.ncp_prior"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":6807,"name":"gamma","nodeType":"Attribute","startLoc":195,"text":"self.gamma"},{"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":44,"id":6808,"name":"gaussian_fwhm_to_sigma","nodeType":"Attribute","startLoc":44,"text":"gaussian_fwhm_to_sigma"},{"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 : integers, 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":202,"header":"def inv_fap_single(fap, N, normalization, dH=1, dK=3)","id":6809,"name":"inv_fap_single","nodeType":"Function","startLoc":153,"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 : integers, 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    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(\"normalization='{0}' is not recognized\"\n                         \"\".format(normalization))"},{"col":0,"comment":"null","endLoc":12,"header":"def has_units(obj)","id":6810,"name":"has_units","nodeType":"Function","startLoc":11,"text":"def has_units(obj):\n    return hasattr(obj, 'unit')"},{"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 2012). 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":438,"id":6811,"nodeType":"Class","startLoc":397,"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 2012). 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    def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        if p0 is not None and gamma is None and ncp_prior is None:\n            warnings.warn('p0 does not seem to accurately represent the false '\n                          'positive rate for event data. It is highly '\n                          'recommended that you run random trials on signal-'\n                          'free noise to calibrate ncp_prior to achieve a '\n                          'desired false positive rate.', AstropyUserWarning)\n        super().__init__(p0, gamma, ncp_prior)\n\n    def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2012\n        return N_k * (np.log(N_k) - np.log(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":0,"comment":"","endLoc":10,"header":"funcs.py#<anonymous>","id":6812,"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.special'],\n                        'poisson_conf_interval': ['scipy.special',\n                                                  'scipy.optimize',\n                                                  'scipy.integrate']}\n\ngaussian_sigma_to_fwhm = 2.0 * np.sqrt(2.0 * np.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\"\"\""},{"col":4,"comment":"null","endLoc":428,"header":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None)","id":6813,"name":"__init__","nodeType":"Function","startLoc":421,"text":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        if p0 is not None and gamma is None and ncp_prior is None:\n            warnings.warn('p0 does not seem to accurately represent the false '\n                          'positive rate for event data. It is highly '\n                          'recommended that you run random trials on signal-'\n                          'free noise to calibrate ncp_prior to achieve a '\n                          'desired false positive rate.', AstropyUserWarning)\n        super().__init__(p0, gamma, ncp_prior)"},{"col":0,"comment":"\n    Validate the method argument, and if method='auto'\n    choose the appropriate method\n    ","endLoc":110,"header":"def validate_method(method, dy, fit_mean, nterms,\n                    frequency, assume_regular_frequency)","id":6814,"name":"validate_method","nodeType":"Function","startLoc":81,"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(\"invalid method: {0}\".format(method))\n\n    return method"},{"col":0,"comment":"null","endLoc":40,"header":"def available_methods()","id":6815,"name":"available_methods","nodeType":"Function","startLoc":30,"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":52,"header":"def _is_regular(frequency)","id":6816,"name":"_is_regular","nodeType":"Function","startLoc":43,"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)"},{"attributeType":"None","col":8,"comment":"null","endLoc":141,"id":6817,"name":"_thread_hub_timeout","nodeType":"Attribute","startLoc":141,"text":"self._thread_hub_timeout"},{"col":4,"comment":"null","endLoc":432,"header":"def fitness(self, N_k, T_k)","id":6818,"name":"fitness","nodeType":"Function","startLoc":430,"text":"def fitness(self, N_k, T_k):\n        # eq. 19 from Scargle 2012\n        return N_k * (np.log(N_k) - np.log(T_k))"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":6819,"name":"_mtype2ids","nodeType":"Attribute","startLoc":170,"text":"self._mtype2ids"},{"attributeType":"null","col":8,"comment":"null","endLoc":158,"id":6820,"name":"_hub_public_id","nodeType":"Attribute","startLoc":158,"text":"self._hub_public_id"},{"col":4,"comment":"null","endLoc":438,"header":"def validate_input(self, t, x, sigma)","id":6821,"name":"validate_input","nodeType":"Function","startLoc":434,"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 2012). 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":486,"id":6822,"nodeType":"Class","startLoc":441,"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 2012). 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. 75 of Scargle 2012\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":4,"comment":"null","endLoc":464,"header":"def __init__(self, dt, p0=0.05, gamma=None, ncp_prior=None)","id":6823,"name":"__init__","nodeType":"Function","startLoc":462,"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":"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 : integers, 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":237,"header":"def cdf_single(z, N, normalization, dH=1, dK=3)","id":6824,"name":"cdf_single","nodeType":"Function","startLoc":205,"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 : integers, 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":0,"comment":"Utility to get grid parameters from a frequency array\n\n    Parameters\n    ----------\n    frequency : array_like or Quantity\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 : scalars\n        Parameters such that all(frequency == f0 + df * np.arange(N))\n    ","endLoc":78,"header":"def _get_frequency_grid(frequency, assume_regular_frequency=False)","id":6825,"name":"_get_frequency_grid","nodeType":"Function","startLoc":55,"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 Quantity\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 : scalars\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)"},{"col":0,"comment":"tau factor for estimating Davies bound (Baluev 2008, Table 1)","endLoc":265,"header":"def tau_davies(Z, fmax, t, y, dy, normalization='standard', dH=1, dK=3)","id":6826,"name":"tau_davies","nodeType":"Function","startLoc":240,"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(\"normalization={0}\".format(normalization))"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":6827,"name":"_mode","nodeType":"Attribute","startLoc":112,"text":"self._mode"},{"attributeType":"null","col":8,"comment":"null","endLoc":120,"id":6828,"name":"_web_profile_dialog","nodeType":"Attribute","startLoc":120,"text":"self._web_profile_dialog"},{"id":6829,"name":"astropy/stats/lombscargle/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/lombscargle/tests","id":6830,"nodeType":"File","text":""},{"id":6831,"name":"astropy/stats/lombscargle/implementations","nodeType":"Package"},{"fileName":"fastchi2_impl.py","filePath":"astropy/stats/lombscargle/implementations","id":6832,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":6833,"name":"_is_running","nodeType":"Attribute","startLoc":107,"text":"self._is_running"},{"attributeType":"None","col":8,"comment":"null","endLoc":126,"id":6834,"name":"_web_profile_requests_result","nodeType":"Attribute","startLoc":126,"text":"self._web_profile_requests_result"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":6835,"name":"_web_profile_requests_semaphore","nodeType":"Attribute","startLoc":127,"text":"self._web_profile_requests_semaphore"},{"attributeType":"None","col":8,"comment":"null","endLoc":140,"id":6836,"name":"_thread_run","nodeType":"Attribute","startLoc":140,"text":"self._thread_run"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":6837,"name":"_hub_msg_id_counter","nodeType":"Attribute","startLoc":151,"text":"self._hub_msg_id_counter"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":6838,"name":"_addr","nodeType":"Attribute","startLoc":110,"text":"self._addr"},{"attributeType":"null","col":8,"comment":"null","endLoc":119,"id":6839,"name":"_web_profile","nodeType":"Attribute","startLoc":119,"text":"self._web_profile"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":6840,"name":"_id","nodeType":"Attribute","startLoc":104,"text":"self._id"},{"col":0,"comment":"False Alarm Probability based on estimated number of indep frequencies","endLoc":276,"header":"def fap_naive(Z, fmax, t, y, dy, normalization='standard')","id":6841,"name":"fap_naive","nodeType":"Function","startLoc":268,"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    return -np.expm1(N_eff * np.log1p(-fap_s))"},{"col":4,"comment":"null","endLoc":470,"header":"def validate_input(self, t, x, sigma)","id":6842,"name":"validate_input","nodeType":"Function","startLoc":466,"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"},{"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":6843,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":121,"id":6844,"name":"_web_port","nodeType":"Attribute","startLoc":121,"text":"self._web_port"},{"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":6845,"name":"inv_fap_naive","nodeType":"Function","startLoc":279,"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    fap_s = -np.expm1(np.log(1 - fap) / N_eff)\n    return inv_fap_single(fap_s, N, normalization)"},{"col":4,"comment":"null","endLoc":486,"header":"def fitness(self, T_k, N_k)","id":6846,"name":"fitness","nodeType":"Function","startLoc":472,"text":"def fitness(self, T_k, N_k):\n        # Eq. 75 of Scargle 2012\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":"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":6847,"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":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":6848,"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('inv_fap_baluev did not converge for p={0}'.format(p))\n    return res.x"},{"attributeType":"null","col":8,"comment":"null","endLoc":463,"id":6849,"name":"dt","nodeType":"Attribute","startLoc":463,"text":"self.dt"},{"col":11,"endLoc":307,"id":6850,"nodeType":"Lambda","startLoc":307,"text":"lambda z, *args: fap_davies(z, *args) - p"},{"col":0,"comment":"Compute (approximate) trigonometric sums for a number of frequencies\n    This routine computes weighted sine and cosine sums:\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    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, default=0)\n        The low frequency to use\n    freq_factor : float (optional, default=1)\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 tradeoff 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 : ndarrays\n        summation arrays for frequencies f = df * np.arange(1, N + 1)\n    ","endLoc":157,"header":"def trig_sum(t, h, df, N, f0=0, freq_factor=1,\n             oversampling=5, use_fft=True, Mfft=4)","id":6851,"name":"trig_sum","nodeType":"Function","startLoc":82,"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        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    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, default=0)\n        The low frequency to use\n    freq_factor : float (optional, default=1)\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 tradeoff 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 : ndarrays\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":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":6852,"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)"},{"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 2012). 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":514,"id":6853,"nodeType":"Class","startLoc":489,"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 2012). 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 2012\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":505,"header":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None)","id":6854,"name":"__init__","nodeType":"Function","startLoc":504,"text":"def __init__(self, p0=0.05, gamma=None, ncp_prior=None):\n        super().__init__(p0, gamma, ncp_prior)"},{"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":6855,"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('inv_fap_baluev did not converge for p={0}'.format(p))\n    return res.x"},{"attributeType":"None","col":8,"comment":"null","endLoc":125,"id":6856,"name":"_web_profile_requests_queue","nodeType":"Attribute","startLoc":125,"text":"self._web_profile_requests_queue"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":6857,"name":"_customlockfilename","nodeType":"Attribute","startLoc":108,"text":"self._customlockfilename"},{"col":11,"endLoc":332,"id":6858,"nodeType":"Lambda","startLoc":332,"text":"lambda z, *args: fap_baluev(z, *args) - p"},{"col":4,"comment":"null","endLoc":509,"header":"def fitness(self, a_k, b_k)","id":6859,"name":"fitness","nodeType":"Function","startLoc":507,"text":"def fitness(self, a_k, b_k):\n        # eq. 41 from Scargle 2012\n        return (b_k * b_k) / (4 * a_k)"},{"col":4,"comment":"null","endLoc":514,"header":"def validate_input(self, t, x, sigma)","id":6860,"name":"validate_input","nodeType":"Function","startLoc":511,"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":4,"comment":"null","endLoc":143,"header":"def _validate_frequency(self, frequency)","id":6861,"name":"_validate_frequency","nodeType":"Function","startLoc":130,"text":"def _validate_frequency(self, frequency):\n        frequency = np.asanyarray(frequency)\n\n        if has_units(self.t):\n            frequency = units.Quantity(frequency)\n            try:\n                frequency = units.Quantity(frequency, unit=1./self.t.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":"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":6862,"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":0,"comment":"null","endLoc":50,"id":6863,"name":"__all__","nodeType":"Attribute","startLoc":50,"text":"__all__"},{"col":0,"comment":"","endLoc":39,"header":"bayesian_blocks.py#<anonymous>","id":6864,"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 2012 [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] http://adsabs.harvard.edu/abs/2012arXiv1207.5578S\n.. [2] http://astroML.org/ https://github.com//astroML/astroML/\n\"\"\"\n\n__all__ = ['FitnessFunc', 'Events', 'RegularEvents', 'PointMeasures',\n           'bayesian_blocks']"},{"attributeType":"None","col":8,"comment":"null","endLoc":109,"id":6865,"name":"_lockfile","nodeType":"Attribute","startLoc":109,"text":"self._lockfile"},{"attributeType":"null","col":16,"comment":"null","endLoc":132,"id":6866,"name":"_host_name","nodeType":"Attribute","startLoc":132,"text":"self._host_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":6867,"name":"_id2mtypes","nodeType":"Attribute","startLoc":174,"text":"self._id2mtypes"},{"fileName":"slow_impl.py","filePath":"astropy/stats/lombscargle/implementations","id":6868,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p.ravel()\n"},{"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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":120,"header":"def lombscargle_slow(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True)","id":6869,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p.ravel()"},{"col":0,"comment":"null","endLoc":16,"header":"def get_unit(obj)","id":6870,"name":"get_unit","nodeType":"Function","startLoc":15,"text":"def get_unit(obj):\n    return getattr(obj, 'unit', 1)"},{"col":0,"comment":"null","endLoc":24,"header":"def strip_units(*arrs)","id":6871,"name":"strip_units","nodeType":"Function","startLoc":19,"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":20,"id":6872,"nodeType":"Lambda","startLoc":20,"text":"lambda a: None if a is None else np.asarray(a)"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":6873,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":6874,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":30,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":4,"header":"hub.py#<anonymous>","id":6875,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SAMPHubServer', 'WebProfileDialog']\n\n__doctest_skip__ = ['.', 'SAMPHubServer.*']"},{"col":0,"comment":"","endLoc":1,"header":"core.py#<anonymous>","id":6876,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Main Lomb-Scargle Implementation\"\"\""},{"fileName":"fast_impl.py","filePath":"astropy/stats/lombscargle/implementations","id":6877,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\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 : string (optional, default='standard')\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n\n    return power\n"},{"id":6878,"name":"cython_impl.pyx","nodeType":"TextFile","path":"astropy/stats/lombscargle/implementations","text":"import 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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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(DTYPE_t[::1] t, DTYPE_t[::1] y, DTYPE_t[::1] dy,\n                            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(DTYPE_t[::1] t, DTYPE_t[::1] y, DTYPE_t[::1] dy,\n                               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/stats/lombscargle/implementations","id":6879,"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"},{"col":4,"comment":"null","endLoc":155,"header":"def _validate_t(self, t)","id":6880,"name":"_validate_t","nodeType":"Function","startLoc":145,"text":"def _validate_t(self, t):\n        t = np.asanyarray(t)\n\n        if has_units(self.t):\n            t = units.Quantity(t)\n            try:\n                t = units.Quantity(t, unit=self.t.unit)\n            except units.UnitConversionError:\n                raise ValueError(\"Units of t not equivalent to \"\n                                 \"units of input self.t\")\n        return t"},{"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\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 : string (optional, default='standard')\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":136,"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":6881,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\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 : string (optional, default='standard')\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n\n    return power"},{"col":22,"endLoc":64,"id":6882,"nodeType":"Lambda","startLoc":64,"text":"lambda x: x[:, np.newaxis]"},{"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 (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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":87,"header":"def lombscargle_chi2(t, y, dy, frequency, normalization='standard',\n                     fit_mean=True, center_data=True, nterms=1)","id":6883,"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 (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p"},{"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":13,"header":"def bitceil(N)","id":6884,"name":"bitceil","nodeType":"Function","startLoc":7,"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":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    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.RandomState(0)\n    >>> x = 100 * rng.rand(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":79,"header":"def extirpolate(x, y, N=None, M=4)","id":6885,"name":"extirpolate","nodeType":"Function","startLoc":16,"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    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.RandomState(0)\n    >>> x = 100 * rng.rand(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":"Generate a sequence of bootstrap estimates of the max","endLoc":348,"header":"def _bootstrap_max(t, y, dy, fmax, normalization, random_seed)","id":6886,"name":"_bootstrap_max","nodeType":"Function","startLoc":339,"text":"def _bootstrap_max(t, y, dy, fmax, normalization, random_seed):\n    \"\"\"Generate a sequence of bootstrap estimates of the max\"\"\"\n    from .core import LombScargle\n    rng = np.random.RandomState(random_seed)\n    while True:\n        s = rng.randint(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        yield power.max()"},{"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool (optional, default=True)\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":73,"header":"def lombscargle_scipy(t, y, frequency, normalization='standard',\n                      center_data=True)","id":6888,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool (optional, default=True)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":6889,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"fileName":"utils.py","filePath":"astropy/stats/lombscargle/implementations","id":6890,"nodeType":"File","text":"\nimport warnings\nfrom 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    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.RandomState(0)\n    >>> x = 100 * rng.rand(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        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    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, default=0)\n        The low frequency to use\n    freq_factor : float (optional, default=1)\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 tradeoff 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 : ndarrays\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/stats/lombscargle/implementations","id":6891,"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 warnings\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 Quantity\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 : scalars\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(\"invalid method: {0}\".format(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 : string (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 : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard' or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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 (default=1)\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"},{"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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":135,"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":6892,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    f0, df, Nf : (float, float, int)\n        parameters describing the frequency grid, f = f0 + df * arange(Nf).\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p"},{"col":4,"comment":"null","endLoc":164,"header":"def _power_unit(self, norm)","id":6893,"name":"_power_unit","nodeType":"Function","startLoc":157,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":6894,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":6895,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Various implementations of the Lomb-Scargle Periodogram\"\"\""},{"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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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 Quantity\n            The heuristically-determined optimal frequency bin\n        ","endLoc":222,"header":"def autofrequency(self, samples_per_peak=5, nyquist_factor=5,\n                      minimum_frequency=None, maximum_frequency=None,\n                      return_freq_limits=False)","id":6896,"name":"autofrequency","nodeType":"Function","startLoc":166,"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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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 Quantity\n            The heuristically-determined optimal frequency bin\n        \"\"\"\n        baseline = self.t.max() - self.t.min()\n        n_samples = self.t.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)"},{"fileName":"scipy_impl.py","filePath":"astropy/stats/lombscargle/implementations","id":6897,"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  (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    center_data : bool (optional, default=True)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p\n"},{"fileName":"chi2_impl.py","filePath":"astropy/stats/lombscargle/implementations","id":6898,"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 (NOT astropy.Quantities)\n        times, values, and errors of the data points. These should be\n        broadcastable to the same shape.\n    frequency : array_like\n        frequencies (not angular frequencies) at which to calculate periodogram\n    normalization : string (optional, default='standard')\n        Normalization to use for the periodogram.\n        Options are 'standard', 'model', 'log', or 'psd'.\n    fit_mean : bool (optional, default=True)\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, default=True)\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, default=1)\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(\"normalization='{0}' \"\n                         \"not recognized\".format(normalization))\n    return p\n"},{"fileName":"mle.py","filePath":"astropy/stats/lombscargle/implementations","id":6899,"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":6900,"name":"astropy/stats/lombscargle/implementations/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/stats/lombscargle/implementations/tests","id":6901,"nodeType":"File","text":""},{"id":6902,"name":"astropy/table","nodeType":"Package"},{"fileName":"jsviewer.py","filePath":"astropy/table","id":6903,"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\nfrom ..io import registry as io_registry\nfrom .. import config as _config\nfrom .. 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='list')\n\n\nconf = Conf()\n\n\nEXTERN_JS_DIR = abspath(join(dirname(extern.__file__), 'js'))\nEXTERN_CSS_DIR = abspath(join(dirname(extern.__file__), '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 = '<style>{0}</style>'.format(css if css is not None\n                                           else DEFAULT_CSS_NB)\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):\n    if table_id is None:\n        table_id = 'table{id}'.format(id=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.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\n\nio_registry.register_writer('jsviewer', Table, write_table_jsviewer)\n"},{"col":19,"endLoc":106,"id":6904,"nodeType":"Lambda","startLoc":106,"text":"lambda m, i: Syw[m][i]"},{"col":19,"endLoc":107,"id":6905,"nodeType":"Lambda","startLoc":107,"text":"lambda m, i: Cyw[m][i]"},{"col":20,"endLoc":108,"id":6906,"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":6907,"nodeType":"Lambda","startLoc":109,"text":"lambda m, n, i: 0.5 * (Cw[abs(m - n)][i] + Cw[m + n][i])"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.table.jsviewer`.\n    ","endLoc":27,"id":6908,"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='list')"},{"col":20,"endLoc":111,"id":6909,"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":6910,"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])"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":17,"id":6911,"name":"jquery_url","nodeType":"Attribute","startLoc":17,"text":"jquery_url"},{"fileName":"index.py","filePath":"astropy/table","id":6912,"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\nfrom ..time import Time\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        FastBST, and FastRBT) 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 __new__(cls, *args, **kwargs):\n        self = super().__new__(cls)\n\n        # If (and only if) unpickling for protocol >= 2, then args and kwargs\n        # are both empty.  The class __init__ requires at least the `columns`\n        # arg.  In this case return a bare `Index` object which is then morphed\n        # by the unpickling magic into the correct SlicedIndex object.\n        if not args and not kwargs:\n            return self\n\n        self.__init__(*args, **kwargs)\n        return SlicedIndex(self, slice(0, 0, None), original=True)\n\n    def __init__(self, columns, engine=None, unique=False):\n        from .table import Table, Column\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')\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(\"Column does not belong to index: {0}\".format(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[i] = vals[self.col_position(col.info.name)]\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 {0} 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(\"Could not remove row {0} from index\".format(row))\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 __str__(self):\n        return str(self.data)\n\n    def __repr__(self):\n        return str(self)\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 : 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        else:  # 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\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 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.copy().insert_row(self.orig_coords(pos), vals,\n                                   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.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.copy().sort()\n\n    def __repr__(self):\n        if self.original:\n            return repr(self.index)\n        return 'Index slice {0} of\\n{1}'.format(\n            (self.start, self.stop, self.step), self.index)\n\n    def __str__(self):\n        return repr(self)\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            return Index([col_slice], engine=self.data.__class__)\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        return Index(new_cols, engine=self.data.__class__)\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):\n    '''\n    Inputs a table and some subset of its columns, and\n    returns an index corresponding to this subset or None\n    if no such index exists.\n\n    Parameters\n    ----------\n    table : `Table`\n        Input table\n    table_copy : `Table`\n        Subset of the columns in the table argument\n    '''\n    cols = set(table_copy.columns)\n    indices = set()\n    for column in cols:\n        for index in table[column].info.indices:\n            if set([x.info.name for x in index.columns]) == cols:\n                return index\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                             \"'{0}'\".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 = '_{0}WithIndexCopy'.format(cls.__name__)\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(\"No index found for {0}\".format(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('No matches found for key {0}'.format(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('No matches found for key {0}'.format(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('No matches found for key {0}'.format(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('Right side should contain {0} values'.format(len(rows)))\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('No matches found for key {0}'.format(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('Invalid index for iloc: {0}'.format(item))\n\n        return table_slice\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":6914,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":6915,"name":"METHODS","nodeType":"Attribute","startLoc":22,"text":"METHODS"},{"col":0,"comment":"","endLoc":6,"header":"main.py#<anonymous>","id":6916,"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":"operations.py","filePath":"astropy/table","id":6917,"nodeType":"File","text":"\"\"\"\nHigh-level table operations:\n\n- join()\n- setdiff()\n- hstack()\n- vstack()\n\"\"\"\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom copy import deepcopy\nimport warnings\nimport collections\nimport itertools\nfrom collections import OrderedDict, Counter\n\nimport numpy as np\nfrom numpy import ma\n\nfrom ..utils import metadata\nfrom .column import Column\n\nfrom . import _np_utils\nfrom .np_utils import fix_column_name, TableMergeError\n\n__all__ = ['join', 'setdiff', 'hstack', 'vstack', 'unique']\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    from .table import Table, Row\n\n    # Make sure we have a list of things\n    if not isinstance(tables, collections.Sequence):\n        tables = [tables]\n\n    # Make sure each thing is a Table or Row\n    if any(not isinstance(x, (Table, Row)) for x in tables) or len(tables) == 0:\n        raise TypeError('`tables` arg must be a Table or sequence of Tables or Rows')\n\n    # Convert any Rows to Tables\n    tables = [(x if isinstance(x, Table) else Table(x)) for x in tables]\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.\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__) 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(left, right, keys=None, join_type='inner',\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn'):\n    \"\"\"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : Table object or a value that will initialize a Table object\n        Left side table in the join\n    right : Table object or a value that will initialize a Table object\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'), 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    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    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n    from .table import Table\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\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 is masked then that means some rows were in table1 but not table2.\n    if t12.masked:\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 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 : Table or list of Table objects\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    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 : List of Table objects\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, 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 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    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\n    input_table : `~astropy.table.Table` object or a value that\n        will initialize a `~astropy.table.Table` object\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 : one of 'first', 'last' or '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 : boolean\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    if input_table.masked:\n        nkeys = 0\n        for key in keys[:]:\n            if np.any(input_table[key].mask):\n                if not silent:\n                    raise ValueError(\n                        \"cannot use columns with masked values as keys; \"\n                        \"remove column '{0}' 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: {0}.  '\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 '{0}' columns have incompatible types: {1}\"\n                                  .format(names[0], tme._incompat_types))\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 {0!r} have different shape'.format(names))\n        shape = uniq_shapes.pop()\n\n        out_descrs.append((fix_column_name(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('Columns have incompatible types {0}'\n                              .format(err._incompat_types))\n        tme._incompat_types = err._incompat_types\n        raise tme\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    \"\"\"\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'), 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\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    if join_type not in ('inner', 'outer', 'left', 'right'):\n        raise ValueError(\"The 'join_type' argument should be in 'inner', \"\n                         \"'outer', 'left' or 'right' (got '{0}' instead)\".\n                         format(join_type))\n\n    # If we have a single key, put it in a tuple\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        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('{0} table does not have key column {1!r}'\n                                      .format(arr_label, name))\n            if hasattr(arr[name], 'mask') and np.any(arr[name].mask):\n                raise TableMergeError('{0} key column {1!r} has missing values'\n                                      .format(arr_label, name))\n            if not isinstance(arr[name], np.ndarray):\n                raise ValueError(\"non-ndarray column '{}' not allowed as a key column\"\n                                 .format(name))\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    # 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    # Make an array with just the key columns.  This uses a temporary\n    # structured array for efficiency.\n    out_keys_dtype = [descr for descr in out_descrs if descr[0] in keys]\n    out_keys = np.empty(len_left + len_right, dtype=out_keys_dtype)\n    for key in keys:\n        out_keys[key][:len_left] = left[key]\n        out_keys[key][len_left:] = right[key]\n    idx_sort = out_keys.argsort(order=keys)\n    out_keys = out_keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], out_keys[1:] != out_keys[:-1], [True]))\n    idxs = np.flatnonzero(diffs)\n\n    # Main inner loop in Cython to compute the cartesion product\n    # indices for the given join type\n    int_join_type = {'inner': 0, 'outer': 1, 'left': 2, 'right': 3}[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    # If either of the inputs are masked then the output is masked\n    if left.masked or right.masked:\n        masked = True\n    masked = bool(masked)\n\n    out = _get_out_class([left, right])(masked=masked)\n\n    for out_name, dtype, shape in out_descrs:\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\n            if issubclass(col_cls, Column):\n                out[out_name][:] = np.where(right_mask,\n                                            left[left_name].take(left_out),\n                                            right[right_name].take(right_out))\n            else:\n                # np.where does not work for mixin columns (e.g. Quantity) so\n                # use a slower workaround.\n                left_mask = ~right_mask\n                if np.any(left_mask):\n                    out[out_name][left_mask] = left[left_name].take(left_out)\n                if np.any(right_mask):\n                    out[out_name][right_mask] = 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        # Finally add the joined column to the output table.\n        out[out_name] = array[name][array_out]\n\n        # If the output table is masked then set the output column masking\n        # accordingly.  Check for columns that don't support a mask attribute.\n        if masked:\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 = (out[out_name].shape[0],) + (1,) * (len(out[out_name].shape) - 1)\n\n            if array.masked:\n                array_mask = array_mask | array[name].mask[array_out]\n            try:\n                out[out_name].mask[:] = array_mask\n            except ValueError:\n                raise NotImplementedError(\n                    \"join requires masking column '{}' but column\"\n                    \" type {} does not support masking\"\n                    .format(out_name, out[out_name].__class__.__name__))\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out\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    # Input validation\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    # 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    # If there are any output columns 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    masked = any(getattr(arr, 'masked', False) for arr in arrays)\n    for names in col_name_map.values():\n        if any(x is None for x in names):\n            masked = True\n            break\n\n    lens = [len(arr) for arr in arrays]\n    n_rows = sum(lens)\n    out = _get_out_class(arrays)(masked=masked)\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            out[out_name] = 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 '{0}' columns have incompatible types: {1}\"\n                                  .format(out_name, err._incompat_types))\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                out[out_name][idx0:idx1] = array[name]\n            else:\n                try:\n                    out[out_name].mask[idx0:idx1] = True\n                except ValueError:\n                    raise NotImplementedError(\n                        \"vstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, out[out_name].__class__.__name__))\n            idx0 = idx1\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.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    # Input validation\n    if join_type not in ('inner', 'exact', 'outer'):\n        raise ValueError(\"join_type arg must be either 'inner', 'exact' or 'outer'\")\n\n    if table_names is None:\n        table_names = ['{0}'.format(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    masked = any(getattr(arr, 'masked', False) for arr in arrays) or len(set(arr_lens)) > 1\n\n    n_rows = max(arr_lens)\n    out = _get_out_class(arrays)(masked=masked)\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                out[out_name] = array[name][indices]\n                try:\n                    out[out_name].mask[arr_len:] = True\n                except ValueError:\n                    raise NotImplementedError(\n                        \"hstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, out[out_name].__class__.__name__))\n            else:\n                out[out_name] = array[name][:n_rows]\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out\n"},{"className":"MinValue","col":0,"comment":"\n    The opposite of MaxValue, i.e. a representation of\n    negative infinity.\n    ","endLoc":55,"id":6918,"nodeType":"Class","startLoc":32,"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    __le__ = __lt__\n    __ge__ = __gt__\n    __str__ = __repr__"},{"className":"TableMergeError","col":0,"comment":"null","endLoc":21,"id":6919,"nodeType":"Class","startLoc":20,"text":"class TableMergeError(ValueError):\n    pass"},{"col":0,"comment":"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : Table object or a value that will initialize a Table object\n        Left side table in the join\n    right : Table object or a value that will initialize a Table object\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'), 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    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    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    ","endLoc":126,"header":"def join(left, right, keys=None, join_type='inner',\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn')","id":6920,"name":"join","nodeType":"Function","startLoc":76,"text":"def join(left, right, keys=None, join_type='inner',\n         uniq_col_name='{col_name}_{table_name}',\n         table_names=['1', '2'], metadata_conflicts='warn'):\n    \"\"\"\n    Perform a join of the left table with the right table on specified keys.\n\n    Parameters\n    ----------\n    left : Table object or a value that will initialize a Table object\n        Left side table in the join\n    right : Table object or a value that will initialize a Table object\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'), 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    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    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    \"\"\"\n    from .table import Table\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\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":"Compute Lomb-Scargle power at automatically-determined frequencies.\n\n        Parameters\n        ----------\n        method : string (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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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\n        Returns\n        -------\n        frequency, power : ndarrays\n            The frequency and Lomb-Scargle power\n        ","endLoc":279,"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":6921,"name":"autopower","nodeType":"Function","startLoc":224,"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 : string (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, default=5)\n            The approximate number of desired samples across the typical peak\n        nyquist_factor : float (optional, default=5)\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\n        Returns\n        -------\n        frequency, power : ndarrays\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":"Compute the Lomb-Scargle power at the given frequencies.\n\n        Parameters\n        ----------\n        frequency : array_like or Quantity\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 : string (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, default=True)\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, default=True)\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":341,"header":"def power(self, frequency, normalization=None, method='auto',\n              assume_regular_frequency=False, method_kwds=None)","id":6922,"name":"power","nodeType":"Function","startLoc":281,"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 Quantity\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 : string (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, default=True)\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, default=True)\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.t, 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":0,"comment":"Bootstrap estimate of the false alarm probability","endLoc":358,"header":"def fap_bootstrap(Z, fmax, t, y, dy, normalization='standard',\n                  n_bootstraps=1000, random_seed=None)","id":6923,"name":"fap_bootstrap","nodeType":"Function","startLoc":351,"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 = np.fromiter(_bootstrap_max(t, y, dy, fmax,\n                                      normalization, random_seed),\n                       float, n_bootstraps)\n    pmax.sort()\n    return 1 - np.searchsorted(pmax, Z) / len(pmax)"},{"col":0,"comment":"Bootstrap estimate of the inverse false alarm probability","endLoc":370,"header":"def inv_fap_bootstrap(fap, fmax, t, y, dy, normalization='standard',\n                      n_bootstraps=1000, random_seed=None)","id":6924,"name":"inv_fap_bootstrap","nodeType":"Function","startLoc":361,"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 = np.fromiter(_bootstrap_max(t, y, dy, fmax,\n                                      normalization, random_seed),\n                       float, n_bootstraps)\n    pmax.sort()\n    return pmax[np.clip(np.floor((1 - fap) * len(pmax)).astype(int),\n                        0, len(pmax) - 1)]"},{"col":4,"comment":"Compute the Lomb-Scargle model at the given frequency.\n\n        Parameters\n        ----------\n        t : array_like or Quantity, length n_samples\n            times at which to compute the model\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray, length n_samples\n            The model fit corresponding to the input times\n        ","endLoc":366,"header":"def model(self, t, frequency)","id":6925,"name":"model","nodeType":"Function","startLoc":343,"text":"def model(self, t, frequency):\n        \"\"\"Compute the Lomb-Scargle model at the given frequency.\n\n        Parameters\n        ----------\n        t : array_like or Quantity, length n_samples\n            times at which to compute the model\n        frequency : float\n            the frequency for the model\n\n        Returns\n        -------\n        y : np.ndarray, length n_samples\n            The model fit corresponding to the input times\n        \"\"\"\n        frequency = self._validate_frequency(frequency)\n        t = self._validate_t(t)\n        y_fit = periodic_fit(*strip_units(self.t, 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)"},{"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":429,"header":"def false_alarm_probability(Z, fmax, t, y, dy, normalization='standard',\n                            method='baluev', method_kwds=None)","id":6926,"name":"false_alarm_probability","nodeType":"Function","startLoc":380,"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(\"Unrecognized method: {0}\".format(method))\n    method = METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(Z, fmax, t, y, dy, normalization, **method_kwds)"},{"attributeType":"null","col":16,"comment":"null","endLoc":2,"id":6927,"name":"np","nodeType":"Attribute","startLoc":2,"text":"np"},{"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":398,"header":"def distribution(self, power, cumulative=False)","id":6928,"name":"distribution","nodeType":"Function","startLoc":368,"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.t), self.normalization, dH=dH, dK=dK)"},{"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":469,"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":6929,"name":"false_alarm_probability","nodeType":"Function","startLoc":400,"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.t, y=self.y, dy=self.dy,\n                                                   normalization=self.normalization,\n                                                   method=method,\n                                                   method_kwds=method_kwds)"},{"fileName":"pandas.py","filePath":"astropy/table","id":6930,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\nascii_coded = 'Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò'\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)\n"},{"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":489,"header":"def false_alarm_level(p, fmax, t, y, dy, normalization,\n                      method='baluev', method_kwds=None)","id":6931,"name":"false_alarm_level","nodeType":"Function","startLoc":439,"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(\"Unrecognized method: {0}\".format(method))\n    method = INV_METHODS[method]\n    method_kwds = method_kwds or {}\n\n    return method(p, fmax, t, y, dy, normalization, **method_kwds)"},{"className":"HTMLWithBackup","col":4,"comment":"null","endLoc":23,"id":6932,"nodeType":"Class","startLoc":14,"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":17,"header":"def __init__(self, data, backup_text)","id":6933,"name":"__init__","nodeType":"Function","startLoc":15,"text":"def __init__(self, data, backup_text):\n            super().__init__(data)\n            self.backup_text = backup_text"},{"col":8,"comment":"null","endLoc":23,"header":"def __repr__(self)","id":6934,"name":"__repr__","nodeType":"Function","startLoc":19,"text":"def __repr__(self):\n            if self.backup_text is None:\n                return super().__repr__()\n            else:\n                return self.backup_text"},{"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":541,"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":6935,"name":"false_alarm_level","nodeType":"Function","startLoc":471,"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.t, y=self.y, dy=self.dy,\n                                             normalization=self.normalization,\n                                             method=method,\n                                             method_kwds=method_kwds)"},{"attributeType":"null","col":12,"comment":"null","endLoc":17,"id":6936,"name":"backup_text","nodeType":"Attribute","startLoc":17,"text":"self.backup_text"},{"col":4,"comment":"null","endLoc":39,"header":"def __lt__(self, other)","id":6937,"name":"__lt__","nodeType":"Function","startLoc":38,"text":"def __lt__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":42,"header":"def __le__(self, other)","id":6938,"name":"__le__","nodeType":"Function","startLoc":41,"text":"def __le__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":45,"header":"def __gt__(self, other)","id":6939,"name":"__gt__","nodeType":"Function","startLoc":44,"text":"def __gt__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":48,"header":"def __ge__(self, other)","id":6940,"name":"__ge__","nodeType":"Function","startLoc":47,"text":"def __ge__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":51,"header":"def __repr__(self)","id":6941,"name":"__repr__","nodeType":"Function","startLoc":50,"text":"def __repr__(self):\n        return \"MIN\""},{"attributeType":"function","col":4,"comment":"null","endLoc":53,"id":6942,"name":"__le__","nodeType":"Attribute","startLoc":53,"text":"__le__"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":6943,"name":"available_methods","nodeType":"Attribute","startLoc":99,"text":"available_methods"},{"attributeType":"function","col":4,"comment":"null","endLoc":54,"id":6944,"name":"__ge__","nodeType":"Attribute","startLoc":54,"text":"__ge__"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":6945,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":373,"id":6946,"name":"METHODS","nodeType":"Attribute","startLoc":373,"text":"METHODS"},{"attributeType":"null","col":0,"comment":"null","endLoc":432,"id":6947,"name":"INV_METHODS","nodeType":"Attribute","startLoc":432,"text":"INV_METHODS"},{"col":0,"comment":"","endLoc":7,"header":"_statistics.py#<anonymous>","id":6948,"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.stats.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}"},{"attributeType":"function","col":4,"comment":"null","endLoc":55,"id":6949,"name":"__str__","nodeType":"Attribute","startLoc":55,"text":"__str__"},{"className":"MaxValue","col":0,"comment":"\n    Represents an infinite value for purposes\n    of tuple comparison.\n    ","endLoc":29,"id":6950,"nodeType":"Class","startLoc":6,"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    __le__ = __lt__\n    __ge__ = __gt__\n    __str__ = __repr__"},{"col":4,"comment":"null","endLoc":13,"header":"def __gt__(self, other)","id":6951,"name":"__gt__","nodeType":"Function","startLoc":12,"text":"def __gt__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":16,"header":"def __ge__(self, other)","id":6952,"name":"__ge__","nodeType":"Function","startLoc":15,"text":"def __ge__(self, other):\n        return True"},{"col":4,"comment":"null","endLoc":19,"header":"def __lt__(self, other)","id":6953,"name":"__lt__","nodeType":"Function","startLoc":18,"text":"def __lt__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":22,"header":"def __le__(self, other)","id":6954,"name":"__le__","nodeType":"Function","startLoc":21,"text":"def __le__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":25,"header":"def __repr__(self)","id":6955,"name":"__repr__","nodeType":"Function","startLoc":24,"text":"def __repr__(self):\n        return \"MAX\""},{"attributeType":"function","col":4,"comment":"null","endLoc":27,"id":6956,"name":"__le__","nodeType":"Attribute","startLoc":27,"text":"__le__"},{"attributeType":"null","col":8,"comment":"null","endLoc":103,"id":6957,"name":"t","nodeType":"Attribute","startLoc":103,"text":"self.t"},{"attributeType":"function","col":4,"comment":"null","endLoc":28,"id":6958,"name":"__ge__","nodeType":"Attribute","startLoc":28,"text":"__ge__"},{"attributeType":"null","col":24,"comment":"null","endLoc":103,"id":6959,"name":"dy","nodeType":"Attribute","startLoc":103,"text":"self.dy"},{"fileName":"bst.py","filePath":"astropy/table","id":6960,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport operator\nimport numpy as np\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    __le__ = __lt__\n    __ge__ = __gt__\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    __le__ = __lt__\n    __ge__ = __gt__\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 (defaults to False)\n        Whether the values of the index must be unique\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(\"Invalid traversal method: \\\"{0}\\\"\".format(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 : 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        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 __str__(self):\n        if self.root is None:\n            return 'Empty'\n        return self._print(self.root, 0)\n\n    def __repr__(self):\n        return str(self)\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\n\nclass FastBase:\n    '''\n    A fast binary search tree implementation for indexing,\n    using the bintrees library.\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 (defaults to False)\n        Whether the values of the index must be unique\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        self.data = self.engine()\n        self.unique = unique\n\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)\n\n    def add(self, key, val):\n        '''\n        Add a key, value pair.\n        '''\n        if self.unique:\n            if key in self.data:\n                # already exists\n                raise ValueError('Cannot add duplicate value \"{0}\" in a '\n                                 'unique index'.format(key))\n            self.data[key] = val\n        else:\n            rows = self.data.set_default(key, [])\n            rows.insert(np.searchsorted(rows, val), val)\n\n    def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        rows = self.data.get(key, [])\n        if self.unique:\n            # only one row\n            rows = [rows]\n        return rows\n\n    def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if self.unique:\n            try:\n                self.data.pop(key)\n            except KeyError:\n                return False\n        else:\n            node = self.data.get(key, None)\n            if node is None or len(node) == 0:\n                return False\n            if data is None:\n                self.data.pop(key)\n                return True\n            if data not in node:\n                if len(node) == 0:\n                    return False\n                raise ValueError(\"Data does not belong to correct node\")\n            node.remove(data)\n        return True\n\n    def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x > row:\n                    self.data[key] = x - 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x - 1 if x > row else x for x in node]\n\n    def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x >= row:\n                    self.data[key] = x + 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x + 1 if x >= row else x for x in node]\n\n    def traverse(self):\n        '''\n        Return all nodes in this BST.\n        '''\n        l = []\n        for key, data in self.data.items():\n            n = Node(key, key)\n            n.data = data\n            l.append(n)\n        return l\n\n    def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        if self.unique:\n            return self.data.items()\n        return [x for x in self.data.items() if len(x[1]) > 0]\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        if self.unique:\n            for i, (key, row) in enumerate(self.data.items()):\n                self.data[key] = i\n        else:\n            i = 0\n            for key, rows in self.data.items():\n                num_rows = len(rows)\n                self.data[key] = [x for x in range(i, i + num_rows)]\n                i += num_rows\n\n    def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        if self.unique:\n            return [x for x in self.data.values()]\n        return [x for node in self.data.values() for x in node]\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        # we need Epsilon since bintrees searches for\n        # lower <= key < upper, while we might want lower <= key <= upper\n        # or similar\n        if not bounds[0]:  # lower < key\n            lower = Epsilon(lower)\n        if bounds[1]:  # key <= upper\n            upper = Epsilon(upper)\n        l = [v for v in self.data.value_slice(lower, upper)]\n        if self.unique:\n            return l\n        return [x for sublist in l for x in sublist]\n\n    def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        if self.unique:\n            del_keys = []\n            for key, data in self.data.items():\n                if data in row_map:\n                    self.data[key] = row_map[data]\n                else:\n                    del_keys.append(key)\n            for key in del_keys:\n                self.data.pop(key)\n        else:\n            for data in self.data.values():\n                data[:] = [row_map[x] for x in data if x in row_map]\n\n    def __str__(self):\n        return str(self.data)\n\n    def __repr__(self):\n        return str(self)\n\n\ntry:\n    # bintrees is an optional dependency\n    from bintrees import FastBinaryTree, FastRBTree\n\n    class FastBST(FastBase):\n        engine = FastBinaryTree\n\n    class FastRBT(FastBase):\n        engine = FastRBTree\n\nexcept ImportError:\n    FastBST = BST\n    FastRBT = BST\n"},{"attributeType":"function","col":4,"comment":"null","endLoc":29,"id":6961,"name":"__str__","nodeType":"Attribute","startLoc":29,"text":"__str__"},{"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":89,"id":6962,"nodeType":"Class","startLoc":58,"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":73,"header":"def __init__(self, val)","id":6963,"name":"__init__","nodeType":"Function","startLoc":72,"text":"def __init__(self, val):\n        self.val = val"},{"col":4,"comment":"null","endLoc":78,"header":"def __lt__(self, other)","id":6964,"name":"__lt__","nodeType":"Function","startLoc":75,"text":"def __lt__(self, other):\n        if self.val == other:\n            return False\n        return self.val < other"},{"col":4,"comment":"null","endLoc":83,"header":"def __gt__(self, other)","id":6965,"name":"__gt__","nodeType":"Function","startLoc":80,"text":"def __gt__(self, other):\n        if self.val == other:\n            return True\n        return self.val > other"},{"col":4,"comment":"null","endLoc":86,"header":"def __eq__(self, other)","id":6966,"name":"__eq__","nodeType":"Function","startLoc":85,"text":"def __eq__(self, other):\n        return False"},{"col":4,"comment":"null","endLoc":89,"header":"def __repr__(self)","id":6967,"name":"__repr__","nodeType":"Function","startLoc":88,"text":"def __repr__(self):\n        return repr(self.val) + \" + epsilon\""},{"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 (defaults to False)\n        Whether the values of the index must be unique\n    ","endLoc":314,"id":6968,"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 (defaults to False)\n        Whether the values of the index must be unique\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 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('Cannot add duplicate value \"{0}\" in a '\n                             'unique index'.format(key))\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 and\n                                         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 : 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        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 str(t)\n\n    def __str__(self):\n        return repr(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":6969,"name":"fit_mean","nodeType":"Attribute","startLoc":104,"text":"self.fit_mean"},{"attributeType":"null","col":0,"comment":"null","endLoc":3,"id":6970,"name":"ascii_coded","nodeType":"Attribute","startLoc":3,"text":"ascii_coded"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":6971,"name":"ascii_uncoded","nodeType":"Attribute","startLoc":4,"text":"ascii_uncoded"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":6972,"name":"url","nodeType":"Attribute","startLoc":5,"text":"url"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":6973,"name":"message_coded","nodeType":"Attribute","startLoc":6,"text":"message_coded"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":6974,"name":"message_uncoded","nodeType":"Attribute","startLoc":7,"text":"message_uncoded"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":6975,"name":"normalization","nodeType":"Attribute","startLoc":107,"text":"self.normalization"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":6976,"name":"html","nodeType":"Attribute","startLoc":12,"text":"html"},{"attributeType":"HTMLWithBackup","col":4,"comment":"null","endLoc":25,"id":6977,"name":"dhtml","nodeType":"Attribute","startLoc":25,"text":"dhtml"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":21,"id":6978,"name":"datatables_url","nodeType":"Attribute","startLoc":21,"text":"datatables_url"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":6979,"name":"center_data","nodeType":"Attribute","startLoc":105,"text":"self.center_data"},{"attributeType":"null","col":4,"comment":"null","endLoc":70,"id":6980,"name":"__slots__","nodeType":"Attribute","startLoc":70,"text":"__slots__"},{"col":4,"comment":"null","endLoc":47,"header":"def __init__(self, data, row_index, unique=False)","id":6981,"name":"__init__","nodeType":"Function","startLoc":43,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":6982,"name":"val","nodeType":"Attribute","startLoc":73,"text":"self.val"},{"attributeType":"null","col":16,"comment":"null","endLoc":103,"id":6983,"name":"y","nodeType":"Attribute","startLoc":103,"text":"self.y"},{"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":148,"id":6984,"nodeType":"Class","startLoc":92,"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":118,"header":"def __init__(self, key, data)","id":6985,"name":"__init__","nodeType":"Function","startLoc":114,"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":129,"header":"def replace(self, child, new_child)","id":6986,"name":"replace","nodeType":"Function","startLoc":120,"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":0,"comment":"","endLoc":3,"header":"pandas.py#<anonymous>","id":6987,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ascii_coded = 'Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò'\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)"},{"col":4,"comment":"\n        Remove the given child.\n        ","endLoc":135,"header":"def remove(self, child)","id":6988,"name":"remove","nodeType":"Function","startLoc":131,"text":"def remove(self, child):\n        '''\n        Remove the given child.\n        '''\n        self.replace(child, None)"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":6989,"name":"nterms","nodeType":"Attribute","startLoc":106,"text":"self.nterms"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":25,"id":6990,"name":"css_urls","nodeType":"Attribute","startLoc":25,"text":"css_urls"},{"id":6991,"name":"_column_mixins.pyx","nodeType":"TextFile","path":"astropy/table","text":"\"\"\"\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\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"},{"col":4,"comment":"\n        Copy the given node.\n        ","endLoc":142,"header":"def set(self, other)","id":6992,"name":"set","nodeType":"Function","startLoc":137,"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":145,"header":"def __str__(self)","id":6993,"name":"__str__","nodeType":"Function","startLoc":144,"text":"def __str__(self):\n        return str((self.key, self.data))"},{"col":4,"comment":"null","endLoc":148,"header":"def __repr__(self)","id":6994,"name":"__repr__","nodeType":"Function","startLoc":147,"text":"def __repr__(self):\n        return str(self)"},{"attributeType":"function","col":4,"comment":"null","endLoc":105,"id":6995,"name":"__lt__","nodeType":"Attribute","startLoc":105,"text":"__lt__"},{"attributeType":"function","col":4,"comment":"null","endLoc":106,"id":6996,"name":"__le__","nodeType":"Attribute","startLoc":106,"text":"__le__"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":6997,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nlombscargle\n===========\nAstroPy-compatible implementation of the Lomb-Scargle periodogram.\n\"\"\""},{"attributeType":"function","col":4,"comment":"null","endLoc":107,"id":6998,"name":"__eq__","nodeType":"Attribute","startLoc":107,"text":"__eq__"},{"attributeType":"function","col":4,"comment":"null","endLoc":108,"id":6999,"name":"__ge__","nodeType":"Attribute","startLoc":108,"text":"__ge__"},{"attributeType":"function","col":4,"comment":"null","endLoc":109,"id":7000,"name":"__gt__","nodeType":"Attribute","startLoc":109,"text":"__gt__"},{"fileName":"table.py","filePath":"astropy/table","id":7001,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom .index import TableIndices, TableLoc, TableILoc, TableLocIndices\n\nimport re\nimport sys\nfrom collections import OrderedDict, Mapping\nimport warnings\nfrom copy import deepcopy\n\nimport numpy as np\nfrom numpy import ma\n\nfrom .. import log\nfrom ..io import registry as io_registry\nfrom ..units import Quantity, QuantityInfo\nfrom ..utils import isiterable, ShapedLikeNDArray\nfrom ..utils.console import color_print\nfrom ..utils.metadata import MetaData\nfrom ..utils.data_info import BaseColumnInfo, MixinInfo, ParentDtypeInfo, DataInfo\nfrom ..utils.exceptions import AstropyDeprecationWarning, NoValue\n\nfrom . import groups\nfrom .pprint import TableFormatter\nfrom .column import (BaseColumn, Column, MaskedColumn, _auto_names, FalseArray,\n                     col_copy)\nfrom .row import Row\nfrom .np_utils import fix_column_name, recarray_fromrecords\nfrom .info import TableInfo\nfrom .index import Index, _IndexModeContext, get_index\nfrom . import conf\n\n\n__doctest_skip__ = ['Table.read', 'Table.write',\n                    'Table.convert_bytestring_to_unicode',\n                    'Table.convert_unicode_to_bytestring',\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    return hasattr(obj, 'info') and isinstance(obj.info, cls)\n\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 self.values()[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return 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):\n        if item in self:\n            raise ValueError(\"Cannot replace column '{0}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)\n\n    def __repr__(self):\n        names = (\"'{0}'\".format(x) for x in self.keys())\n        return \"<{1} names=({0})>\".format(\",\".join(names), self.__class__.__name__)\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(\"Column {0} already exists\".format(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    # Define keys and values for Python 2 and 3 source compatibility\n    def keys(self):\n        return list(OrderedDict.keys(self))\n\n    def values(self):\n        return list(OrderedDict.values(self))\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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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 Table:\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `Table` provides a class for heterogeneous tabular data, making use of a\n    `numpy` structured array internally to store the data values.  A key\n    enhancement provided by the `Table` class is the ability to easily modify\n    the 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    `Table` differs from `~astropy.nddata.NDData` by the assumption that the\n    input data consists of columns of homogeneous data, where each column\n    has a unique identifier and may contain additional metadata such as the\n    data unit, format, and description.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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    meta = MetaData()\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    def as_array(self, keep_byteorder=False):\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        Returns\n        -------\n        table_array : np.ndarray (unmasked) or np.ma.MaskedArray (masked)\n            Copy of table as a numpy structured array\n        \"\"\"\n        if len(self.columns) == 0:\n            return None\n\n        sys_byteorder = ('>', '<')[sys.byteorder == 'little']\n        native_order = ('=', sys_byteorder)\n\n        dtype = []\n\n        cols = self.columns.values()\n\n        for col in cols:\n            col_descr = descr(col)\n            byteorder = col.info.dtype.byteorder\n\n            if not keep_byteorder and byteorder not in native_order:\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        empty_init = ma.empty if self.masked else np.empty\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        return data\n\n    def __init__(self, data=None, masked=None, names=None, dtype=None,\n                 meta=None, copy=True, rows=None, copy_indices=True,\n                 **kwargs):\n\n        # Set up a placeholder empty table\n        self._set_masked(masked)\n        self.columns = self.TableColumns()\n        self.meta = meta\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        # 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        is_list_of_dict = False\n        if rows is not None:\n            if data is not None:\n                raise ValueError('Cannot supply both `data` and `rows` values')\n            if all(isinstance(row, dict) for row in rows):\n                is_list_of_dict = True  # Avoid doing the all(...) test twice.\n                data = rows\n            elif isinstance(rows, self.Row):\n                data = rows\n            else:\n                rec_data = recarray_fromrecords(rows)\n                data = [rec_data[name] for name in rec_data.dtype.names]\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        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 (though the meta\n            # will be deep-copied anyway).\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) and\n                data.shape == (0,) and\n                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            init_func = self._init_from_list\n            if data and (is_list_of_dict or all(isinstance(row, dict) for row in data)):\n                n_cols = len(data[0])\n            else:\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            init_func = self._init_from_table\n            n_cols = len(data.colnames)\n            default_names = data.colnames\n            # don't copy indices if the input Table is in non-copy mode\n            self._init_indices = self._init_indices and data._copy_indices\n\n        elif data is None:\n            if names is None:\n                if dtype is None:\n                    return  # Empty table\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('Data type {0} not allowed to init Table'\n                             .format(type(data)))\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 names is None:\n            names = default_names or [None] * n_cols\n        if dtype is None:\n            dtype = [None] * n_cols\n\n        # Numpy does not support bytes column names on Python 3, so fix them\n        # up now.\n        names = [fix_column_name(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        # Whatever happens above, the masked property should be set to a boolean\n        if type(self.masked) is not bool:\n            raise TypeError(\"masked property has not been set to True or False\")\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:\n            mask_table = Table([col.mask for col in self.columns.values()],\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 a 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 : Table\n            New table with masked values filled\n        \"\"\"\n        if self.masked:\n            data = [col.filled(fill_value) for col in self.columns.values()]\n        else:\n            data = self\n        return self.__class__(data, meta=deepcopy(self.meta))\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            FastBST, and FastRBT. If the supplied argument is None (by\n            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 \"{0}\", of '\n                                 'type \"{1}\"'.format(col.info.name, type(col)))\n\n        index = Index(columns, engine=engine, unique=unique)\n        if not self.indices:\n            self.primary_key = colnames\n        for col in columns:\n            col.info.indices.append(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        return self.as_array().data if self.masked else self.as_array()\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('{0} must be a list or None'.format(inp_str))\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                .format(inp_str))\n\n    def _set_masked_from_cols(self, cols):\n        if self.masked is None:\n            if any(isinstance(col, (MaskedColumn, ma.MaskedArray)) for col in cols):\n                self._set_masked(True)\n            else:\n                self._set_masked(False)\n        elif not self.masked:\n            if any(np.any(col.mask) for col in cols if isinstance(col, (MaskedColumn, ma.MaskedArray))):\n                self._set_masked(True)\n\n    def _init_from_list_of_dicts(self, data, names, dtype, n_cols, copy):\n        names_from_data = set()\n        for row in data:\n            names_from_data.update(row)\n\n        cols = {}\n        for name in names_from_data:\n            cols[name] = []\n            for i, row in enumerate(data):\n                try:\n                    cols[name].append(row[name])\n                except KeyError:\n                    raise ValueError('Row {0} has no value for column {1}'.format(i, name))\n        if all(name is None for name in names):\n            names = sorted(names_from_data)\n        self._init_from_dict(cols, names, dtype, n_cols, copy)\n        return\n\n    def _init_from_list(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a list of columns.  A column can be a\n        Column object, np.ndarray, mixin, or any other iterable object.\n        \"\"\"\n        if data and all(isinstance(row, dict) for row in data):\n            self._init_from_list_of_dicts(data, names, dtype, n_cols, copy)\n            return\n\n        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(data)\n\n        cols = []\n        def_names = _auto_names(n_cols)\n\n        for col, name, def_name, dtype in zip(data, names, def_names, dtype):\n            # Structured ndarray gets viewed as a mixin unless already a valid\n            # mixin class\n            if (isinstance(col, np.ndarray) and len(col.dtype) > 1 and\n                    not self._add_as_mixin_column(col)):\n                col = col.view(NdarrayMixin)\n\n            if isinstance(col, (Column, MaskedColumn)):\n                col = self.ColumnClass(name=(name or col.info.name or def_name),\n                                       data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            elif self._add_as_mixin_column(col):\n                # Copy the mixin column attributes if they exist since the copy below\n                # may not get this attribute.\n                if copy:\n                    col = col_copy(col, copy_indices=self._init_indices)\n\n                col.info.name = name or col.info.name or def_name\n            elif isinstance(col, np.ndarray) or isiterable(col):\n                col = self.ColumnClass(name=(name or def_name), data=col, dtype=dtype,\n                                       copy=copy, copy_indices=self._init_indices)\n            else:\n                raise ValueError('Elements in list initialization must be '\n                                 'either Column or list-like')\n\n            cols.append(col)\n\n        self._init_from_cols(cols)\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        # Set self.masked appropriately, then get class to create column instances.\n        self._set_masked_from_cols(cols)\n\n        if copy:\n            self._init_from_list(cols, names, dtype, n_cols, copy)\n        else:\n            dtype = [(name, col.dtype, col.shape[1:]) for name, col in zip(names, cols)]\n            newdata = data.view(dtype).ravel()\n            columns = self.TableColumns()\n\n            for name in names:\n                columns[name] = self.ColumnClass(name=name, data=newdata[name])\n                columns[name].info.parent_table = self\n            self.columns = columns\n\n    def _init_from_dict(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from a dictionary of columns\"\"\"\n\n        # TODO: is this restriction still needed with no ndarray?\n        if not copy:\n            raise ValueError('Cannot use copy=False with a dict data input')\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 _init_from_table(self, data, names, dtype, n_cols, copy):\n        \"\"\"Initialize table from an existing Table object \"\"\"\n\n        table = data  # data is really a Table, rename for clarity\n        self.meta.clear()\n        self.meta.update(deepcopy(table.meta))\n        self.primary_key = table.primary_key\n        cols = list(table.columns.values())\n\n        self._init_from_list(cols, names, dtype, n_cols, copy)\n\n    def _convert_col_for_table(self, col):\n        \"\"\"\n        Make sure that all Column objects have correct 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 col.__class__ is not self.ColumnClass and isinstance(col, Column):\n            col = self.ColumnClass(col)  # copy attributes and reference data\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('Inconsistent data column lengths: {0}'\n                             .format(lengths))\n\n        # Set the table masking\n        self._set_masked_from_cols(cols)\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        table.meta.clear()\n        table.meta.update(deepcopy(self.meta))\n        table.primary_key = self.primary_key\n        cols = self.columns.values()\n\n        newcols = []\n        for col in cols:\n            col.info._copy_indices = self._copy_indices\n            newcol = col[slice_]\n            if col.info.indices:\n                newcol = col.info.slice_indices(newcol, slice_, len(col))\n            newcols.append(newcol)\n            col.info._copy_indices = True\n\n        self._make_table_from_cols(table, newcols)\n        return table\n\n    @staticmethod\n    def _make_table_from_cols(table, cols):\n        \"\"\"\n        Make ``table`` in-place so that it represents the given list of ``cols``.\n        \"\"\"\n        colnames = set(col.info.name for col in cols)\n        if None in colnames:\n            raise TypeError('Cannot have None for column name')\n        if len(colnames) != len(cols):\n            raise ValueError('Duplicate column names')\n\n        columns = table.TableColumns((col.info.name, col) for col in cols)\n\n        for col in cols:\n            col.info.parent_table = table\n            if table.masked and not hasattr(col, 'mask'):\n                col.mask = FalseArray(col.shape)\n\n        table.columns = columns\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('length={0}'.format(len(self)))\n\n        descr = ' '.join(descr_vals)\n        if html:\n            from ..utils.xml.writer import xml_escape\n            descr = '<i>{0}</i>\\n'.format(xml_escape(descr))\n        else:\n            descr = '<{0}>\\n'.format(descr)\n\n        if tableid is None:\n            tableid = 'table{id}'.format(id=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        return self._base_repr_(html=True, max_width=-1,\n                                tableclass=conf.default_notebook_table_class)\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    def _add_as_mixin_column(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 not Quantity (which gets converted to Column with\n        # unit set).\n        return has_info_class(col, MixinInfo) and not has_info_class(col, QuantityInfo)\n\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        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        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        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('Length = {0} rows'.format(len(self)))\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    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] + 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 <http://getbootstrap.com/css/#tables>`_\n            for the list of classes.\n        css : string\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 = 'table{0}-{1}'.format(id(self),\n                                            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.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 : string\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(\"Browser '{}' not found.\".format(browser))\n        else:\n            br.open(urljoin('file:', pathname2url(path)))\n\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        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\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('Length = {0} rows'.format(len(self)))\n\n        return lines\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 (isinstance(item, (tuple, list)) and item and\n              all(isinstance(x, str) for x in item)):\n            bad_names = [x for x in item if x not in self.colnames]\n            if bad_names:\n                raise ValueError('Slice name(s) {0} not valid column name(s)'\n                                 .format(', '.join(bad_names)))\n            out = self.__class__([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        elif ((isinstance(item, np.ndarray) and item.size == 0) or\n              (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) or\n              isinstance(item, np.ndarray) or\n              isinstance(item, list) or\n              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('Illegal type {0} for table item access'\n                             .format(type(item)))\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            NewColumn = self.MaskedColumn if self.masked else self.Column\n            # If value doesn't have a dtype and won't be added as a mixin then\n            # convert to a numpy array.\n            if not hasattr(value, 'dtype') and not self._add_as_mixin_column(value):\n                value = np.asarray(value)\n\n            # Structured ndarray gets viewed as a mixin (unless already a valid\n            # mixin class).\n            if (isinstance(value, np.ndarray) and len(value.dtype) > 1 and\n                    not self._add_as_mixin_column(value)):\n                value = value.view(NdarrayMixin)\n\n            # Make new column and assign the value.  If the table currently\n            # has no rows (len=0) of the value is already a Column then\n            # define new column directly from value.  In the latter case\n            # this allows for propagation of Column metadata.  Otherwise\n            # define a new column with the right length and shape and then\n            # set it from value.  This allows for broadcasting, e.g. t['a']\n            # = 1.\n            name = item\n            # If this is a column-like object that could be added directly to table\n            if isinstance(value, BaseColumn) or self._add_as_mixin_column(value):\n                # If we're setting a new column to a scalar, broadcast it.\n                # (things will fail in _init_from_cols if this doesn't work)\n                if (len(self) > 0 and (getattr(value, 'isscalar', False) or\n                                       getattr(value, 'shape', None) == () or\n                                       len(value) == 1)):\n                    new_shape = (len(self),) + getattr(value, 'shape', ())[1:]\n                    if isinstance(value, np.ndarray):\n                        value = np.broadcast_to(value, shape=new_shape,\n                                                subok=True)\n                    elif isinstance(value, ShapedLikeNDArray):\n                        value = value._apply(np.broadcast_to, shape=new_shape,\n                                             subok=True)\n\n                new_column = col_copy(value)\n                new_column.info.name = name\n\n            elif len(self) == 0:\n                new_column = NewColumn(value, name=name)\n            else:\n                new_column = NewColumn(name=name, length=len(self), dtype=value.dtype,\n                                       shape=value.shape[1:],\n                                       unit=getattr(value, 'unit', None))\n                new_column[:] = value\n\n            # Now add new column to the table\n            self.add_columns([new_column], copy=False)\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                # Set the corresponding row assuming value is an iterable.\n                if not hasattr(value, '__len__'):\n                    raise TypeError('Right side value must be iterable')\n\n                if len(value) != n_cols:\n                    raise ValueError('Right side value needs {0} elements (one for each column)'\n                                     .format(n_cols))\n\n                for col, val in zip(self.columns.values(), value):\n                    col[item] = val\n\n            elif (isinstance(item, slice) or\n                  isinstance(item, np.ndarray) or\n                  isinstance(item, list) or\n                  (isinstance(item, tuple) and  # output from np.where\n                   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                    import itertools\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 {0} 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('Illegal type {0} for table item access'\n                                 .format(type(item)))\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)) and\n              all(isinstance(x, str) for x in item)):\n            self.remove_columns(item)\n        elif (isinstance(item, (list, np.ndarray)) and\n              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 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 hasattr(self, '_masked'):\n            # The only allowed change is from None to False or True, or False to True\n            if self._masked is None and masked in [False, True]:\n                self._masked = masked\n            elif self._masked is False and masked is True:\n                log.info(\"Upgrading Table to masked Table. Use Table.filled() to convert to unmasked table.\")\n                self._masked = masked\n            elif self._masked is masked:\n                raise Exception(\"Masked attribute is already set to {0}\".format(masked))\n            else:\n                raise Exception(\"Cannot change masked attribute to {0} once it is set to {1}\"\n                                .format(masked, self._masked))\n        else:\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        if self._masked:\n            self._column_class = self.MaskedColumn\n        else:\n            self._column_class = 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    def keys(self):\n        return list(self.columns.keys())\n\n    def __len__(self):\n        if len(self.columns) == 0:\n            return 0\n\n        lengths = set(len(col) for col in self.columns.values())\n        if len(lengths) != 1:\n            len_strs = [' {0} : {1}'.format(name, len(col)) for name, col in self.columns.items()]\n            raise ValueError('Column length mismatch:\\n{0}'.format('\\n'.join(len_strs)))\n\n        return lengths.pop()\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(\"Column {0} does not exist\".format(name))\n\n    def add_column(self, col, index=None, name=None, rename_duplicate=False, copy=True):\n        \"\"\"\n        Add a new Column object ``col`` to the table.  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        Parameters\n        ----------\n        col : Column\n            Column object to add.\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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create a third column 'c' and append it to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\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              3 0.3   z\n\n        Add column 'd' at position 1. Note that the column is inserted\n        before the given index::\n\n            >>> col_d = Column(name='d', data=['a', 'b', 'c'])\n            >>> t.add_column(col_d, 1)\n            >>> print(t)\n             a   d   b   c\n            --- --- --- ---\n              1   a 0.1   x\n              2   b 0.2   y\n              3   c 0.3   z\n\n        Add second column named 'b' with rename_duplicate::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> t.add_column(col_b, rename_duplicate=True)\n            >>> print(t)\n             a   b  b_1\n            --- --- ---\n              1 0.1 1.1\n              2 0.2 1.2\n              3 0.3 1.3\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            >>> col_c = Column(data=['x', 'y'])\n            >>> t.add_column(col_c)\n            >>> t.add_column(col_c, name='c')\n            >>> col_b = Column(name='b', data=[1.1, 1.2])\n            >>> t.add_column(col_b, name='d')\n            >>> print(t)\n             a   b  col2  c   d\n            --- --- ---- --- ---\n              1 0.1    x   x 1.1\n              2 0.2    y   y 1.2\n\n        To add several columns use add_columns.\n        \"\"\"\n        if index is None:\n            index = len(self.columns)\n        if name is not None:\n            name = (name,)\n\n        self.add_columns([col], [index], name, copy=copy, rename_duplicate=rename_duplicate)\n\n    def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):\n        \"\"\"\n        Add a list of new Column objects ``cols`` to the table.  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        Parameters\n        ----------\n        cols : list of Columns\n            Column objects to add.\n        indexes : list of ints 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\n        Examples\n        --------\n        Create a table with two columns 'a' and 'b'::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> print(t)\n             a   b\n            --- ---\n              1 0.1\n              2 0.2\n              3 0.3\n\n        Create column 'c' and 'd' and append them to the end of the table::\n\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\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              3 0.3   z   w\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, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> col_d = Column(name='d', data=['u', 'v', 'w'])\n            >>> t.add_columns([col_c, col_d], [0, 1])\n            >>> print(t)\n             c   a   d   b\n            --- --- --- ---\n              x   1   u 0.1\n              y   2   v 0.2\n              z   3   w 0.3\n\n        Add second column 'b' and column 'c' with ``rename_duplicate``::\n\n            >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b'))\n            >>> col_b = Column(name='b', data=[1.1, 1.2, 1.3])\n            >>> col_c = Column(name='c', data=['x', 'y', 'z'])\n            >>> t.add_columns([col_b, col_c], 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              3 0.3 1.3  z\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_a = Column(data=['x', 'y'])\n            >>> col_b = Column(name='b', data=['u', 'v'])\n            >>> t.add_columns([col_a, col_b])\n            >>> t.add_columns([col_a, col_b], names=['c', 'd'])\n            >>> print(t)\n            col0  b   c   d\n            ---- --- --- ---\n               x   u   x   u\n               y   v   y   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 copy:\n            cols = [col_copy(col) for col in cols]\n\n        if len(self.columns) == 0:\n            # No existing table data, init from cols\n            newcols = cols\n        else:\n            newcols = list(self.columns.values())\n            new_indexes = list(range(len(newcols) + 1))\n            for col, index in zip(cols, indexes):\n                i = new_indexes.index(index)\n                new_indexes.insert(i, None)\n                newcols.insert(i, col)\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        for i, (col, name) in enumerate(zip(cols, names)):\n            if name is None:\n                if col.info.name is not None:\n                    continue\n                name = 'col{}'.format(i + len(self.columns))\n            if col.info.parent_table is not None:\n                col = col_copy(col)\n            col.info.name = name\n\n        if rename_duplicate:\n            existing_names = set(self.colnames)\n            for col in cols:\n                i = 1\n                orig_name = col.info.name\n                while col.info.name in existing_names:\n                    # If the column belongs to another table then copy it\n                    # before renaming\n                    if col.info.parent_table is not None:\n                        col = col_copy(col)\n                    new_name = '{0}_{1}'.format(orig_name, i)\n                    col.info.name = new_name\n                    i += 1\n                existing_names.add(new_name)\n\n        self._init_from_cols(newcols)\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\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(\"replaced column '{}'\".format(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):\n        \"\"\"\n        Replace column ``name`` with the new ``col`` object.\n\n        Parameters\n        ----------\n        name : str\n            Name of column to replace\n        col : column object (list, ndarray, Column, etc)\n            New column object to replace the existing column\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('column name {0} is not in the table'.format(name))\n\n        if self[name].info.indices:\n            raise ValueError('cannot replace a table index column')\n\n        t = self.__class__([col], names=[name])\n        cols = OrderedDict(self.columns)\n        cols[name] = t[name]\n        self._init_from_cols(cols.values())\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, int, or array of ints\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 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 : list\n            A list containing the 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        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        for name in names:\n            self.columns.pop(name)\n\n    def _convert_string_dtype(self, in_kind, out_kind):\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        # If there are no `in_kind` columns then do nothing\n        cols = self.columns.values()\n        if not any(col.dtype.kind == in_kind for col in cols):\n            return\n\n        newcols = []\n        for col in cols:\n            if col.dtype.kind == in_kind:\n                newdtype = re.sub(in_kind, out_kind, col.dtype.str)\n                newcol = col.__class__(col, dtype=newdtype)\n            else:\n                newcol = col\n            newcols.append(newcol)\n\n        self._init_from_cols(newcols)\n\n    def convert_bytestring_to_unicode(self, python3_only=NoValue):\n        \"\"\"\n        Convert bytestring columns (dtype.kind='S') to unicode (dtype.kind='U') assuming\n        ASCII 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        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('S', 'U')\n\n    def convert_unicode_to_bytestring(self, python3_only=NoValue):\n        \"\"\"\n        Convert ASCII-only unicode columns (dtype.kind='U') to bytestring (dtype.kind='S').\n\n        When exporting a unicode string array to a file, it may be desirable\n        to encode unicode columns as bytestrings.  This routine takes\n        advantage of numpy automated conversion which works for strings that\n        are pure ASCII.\n        \"\"\"\n        if python3_only is not NoValue:\n            warnings.warn('The \"python3_only\" keyword is now deprecated.',\n                          AstropyDeprecationWarning)\n\n        self._convert_string_dtype('U', 'S')\n\n    def keep_columns(self, names):\n        '''\n        Keep only the columns specified (remove the others).\n\n        Parameters\n        ----------\n        names : list\n            A list containing the names of the columns to keep. All other\n            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        Specifying only a single column name keeps only this column.\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        Specifying a list of column names is keeps is also possible.\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\n        if isinstance(names, str):\n            names = [names]\n\n        for name in names:\n            if name not in self.columns:\n                raise KeyError(\"Column {0} does not exist\".format(name))\n\n        remove = list(set(self.keys()) - set(names))\n\n        self.remove_columns(remove)\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(\"Column {0} does not exist\".format(name))\n\n        self.columns[name].info.name = new_name\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 {0} is out of bounds for table with length {1}\"\n                             .format(index, N))\n        if index < 0:\n            index += N\n\n        def _is_mapping(obj):\n            \"\"\"Minimal checker for mapping (dict-like) interface for obj\"\"\"\n            attrs = ('__getitem__', '__len__', '__iter__', 'keys', 'values', 'items')\n            return all(hasattr(obj, attr) for attr in attrs)\n\n        if mask is not None and not self.masked:\n            # Possibly issue upgrade warning and update self.ColumnClass.  This\n            # does not change the existing columns.\n            self._set_masked(True)\n\n        if _is_mapping(vals) 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 _is_mapping(mask):\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(\"Value must be supplied for column '{0}'\".format(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 _is_mapping(mask)):\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        columns = self.TableColumns()\n        try:\n            # Insert val at index for each column\n            for name, col, val, mask_ in zip(colnames, self.columns.values(), vals, mask):\n                # If the new row caused a change in self.ColumnClass then\n                # Column-based classes need to be converted first.  This is\n                # typical for adding a row with mask values to an unmasked table.\n                if isinstance(col, Column) and not isinstance(col, self.ColumnClass):\n                    col = self.ColumnClass(col, copy=False)\n\n                newcol = col.insert(index, val, axis=0)\n                if not isinstance(newcol, BaseColumn):\n                    newcol.info.name = name\n                    if self.masked:\n                        newcol.mask = FalseArray(newcol.shape)\n\n                if len(newcol) != N + 1:\n                    raise ValueError('Incorrect length for column {0} after inserting {1}'\n                                     ' (expected {2}, got {3})'\n                                     .format(name, val, len(newcol), N + 1))\n                newcol.info.parent_table = self\n\n                # Set mask if needed\n                if self.masked:\n                    newcol.mask[index] = mask_\n\n                columns[name] = newcol\n\n            # insert row in indices\n            for table_index in self.indices:\n                table_index.insert_row(index, vals, self.columns.values())\n\n        except Exception as err:\n            raise ValueError(\"Unable to insert row because of exception in column '{0}':\\n{1}\"\n                             .format(name, err))\n        else:\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 argsort(self, keys=None, kind=None):\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'}, optional\n            Sorting algorithm.\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, self[keys])\n            if index is not None:\n                return index.sorted_data()\n\n        kwargs = {}\n        if keys:\n            kwargs['order'] = keys\n        if kind:\n            kwargs['kind'] = kind\n\n        if keys:\n            data = self[keys].as_array()\n        else:\n            data = self.as_array()\n\n        return data.argsort(**kwargs)\n\n    def sort(self, keys=None):\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\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        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)\n        sort_index = get_index(self, self[keys])\n        if sort_index is not None:\n            # avoid inefficient relabelling of sorted index\n            prev_frozen = sort_index._frozen\n            sort_index._frozen = True\n\n        for col in self.columns.values():\n            col[:] = col.take(indexes, axis=0)\n\n        if sort_index is not None:\n            # undo index freeze\n            sort_index._frozen = prev_frozen\n            # now relabel the sort index appropriately\n            sort_index.sort()\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            col[:] = col[::-1]\n        for index in self.indices:\n            index.reverse()\n\n    @classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).\n        \"\"\"\n        out = io_registry.read(cls, *args, **kwargs)\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 {0} '\n                                'class.'.format(cls.__name__))\n        return out\n\n    def write(self, *args, **kwargs):\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        The arguments and keywords (other than ``format``) provided to this function are\n        passed through to the underlying data reader (e.g. `~astropy.io.ascii.write`).\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)\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\n        if isinstance(other, Table):\n            other = other.as_array()\n\n        if self.masked:\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 __ne__(self, other):\n        return ~self.__eq__(other)\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\n        unique values of the ``keys`` grouping object.  The output is a new\n        `TableGroups` which contains a copy of this table but sorted by row\n        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          - `Table` with same length as this table\n\n        Parameters\n        ----------\n        keys : str, list of str, numpy array, or `Table`\n            Key grouping object\n\n        Returns\n        -------\n        out : `Table`\n            New table with groups set\n        \"\"\"\n        if self.has_mixin_columns:\n            raise NotImplementedError('group_by not available for tables with mixin columns')\n\n        return groups.table_group_by(self, keys)\n\n    def to_pandas(self):\n        \"\"\"\n        Return a :class:`pandas.DataFrame` instance\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 contains mixin or multi-dimensional columns\n        \"\"\"\n        from pandas import DataFrame\n\n        if self.has_mixin_columns:\n            raise ValueError(\"Cannot convert a table with mixin columns to a pandas DataFrame\")\n\n        if any(getattr(col, 'ndim', 1) > 1 for col in self.columns.values()):\n            raise ValueError(\"Cannot convert a table with multi-dimensional columns to a pandas DataFrame\")\n\n        out = OrderedDict()\n\n        for name, column in self.columns.items():\n            if isinstance(column, MaskedColumn):\n                if column.dtype.kind in ['i', 'u']:\n                    out[name] = column.astype(float).filled(np.nan)\n                elif column.dtype.kind in ['f', 'c']:\n                    out[name] = column.filled(np.nan)\n                else:\n                    out[name] = column.astype(object).filled(np.nan)\n            else:\n                out[name] = column\n\n            if out[name].dtype.byteorder not in ('=', '|'):\n                out[name] = out[name].byteswap().newbyteorder()\n\n        return DataFrame(out)\n\n    @classmethod\n    def from_pandas(cls, dataframe):\n        \"\"\"\n        Create a `Table` from a :class:`pandas.DataFrame` instance\n\n        Parameters\n        ----------\n        dataframe : :class:`pandas.DataFrame`\n            The pandas :class:`pandas.DataFrame` instance\n\n        Returns\n        -------\n        table : `Table`\n            A `Table` (or subclass) instance\n        \"\"\"\n\n        out = OrderedDict()\n\n        for name in dataframe.columns:\n            column = dataframe[name]\n            mask = np.array(column.isnull())\n            data = np.array(column)\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            if np.any(mask):\n                out[name] = MaskedColumn(data=data, name=name, mask=mask)\n            else:\n                out[name] = Column(data=data, name=name)\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    `QTable` provides a class for heterogeneous tabular data which can be\n    easily modified, for instance adding columns or new rows.\n\n    The `QTable` class is identical to `Table` except that columns with an\n    associated ``unit`` attribute are converted to `~astropy.units.Quantity`\n    objects.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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 _add_as_mixin_column(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, or a subclass\n            # identified in the unit (such as u.mag()).\n            q_cls = getattr(col.unit, '_quantity_class', Quantity)\n            qcol = q_cls(col.data, col.unit, copy=False)\n            qcol.info = col.info\n            col = qcol\n        else:\n            col = super()._convert_col_for_table(col)\n\n        return col\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 ndarray().\n    \"\"\"\n    info = ParentDtypeInfo()\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 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 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":"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":764,"id":7002,"nodeType":"Class","startLoc":726,"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(\"No index found for {0}\".format(item))\n\n        return super().__getitem__(item)"},{"attributeType":"function","col":4,"comment":"null","endLoc":110,"id":7003,"name":"__ne__","nodeType":"Attribute","startLoc":110,"text":"__ne__"},{"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":764,"header":"def __getitem__(self, item)","id":7004,"name":"__getitem__","nodeType":"Function","startLoc":740,"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(\"No index found for {0}\".format(item))\n\n        return super().__getitem__(item)"},{"attributeType":"null","col":4,"comment":"null","endLoc":111,"id":7005,"name":"__slots__","nodeType":"Attribute","startLoc":111,"text":"__slots__"},{"attributeType":"null","col":8,"comment":"null","endLoc":116,"id":7006,"name":"data","nodeType":"Attribute","startLoc":116,"text":"self.data"},{"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":170,"id":7007,"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 = '<style>{0}</style>'.format(css if css is not None\n                                           else DEFAULT_CSS_NB)\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":7008,"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":148,"header":"@property\n    def css_urls(self)","id":7009,"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":7010,"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]"},{"id":7011,"name":"_np_utils.pyx","nodeType":"TextFile","path":"astropy/table","text":"\"\"\"\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 = np.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"},{"col":4,"comment":"null","endLoc":164,"header":"def ipynb(self, table_id, css=None, sort_columns='[]')","id":7012,"name":"ipynb","nodeType":"Function","startLoc":156,"text":"def ipynb(self, table_id, css=None, sort_columns='[]'):\n        html = '<style>{0}</style>'.format(css if css is not None\n                                           else DEFAULT_CSS_NB)\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"},{"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":863,"id":7013,"nodeType":"Class","startLoc":767,"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('No matches found for key {0}'.format(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('No matches found for key {0}'.format(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('No matches found for key {0}'.format(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('Right side should contain {0} values'.format(len(rows)))"},{"col":4,"comment":"\n        Retrieve Table rows indexes by value slice.\n        ","endLoc":814,"header":"def _get_rows(self, item)","id":7014,"name":"_get_rows","nodeType":"Function","startLoc":784,"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('No matches found for key {0}'.format(key))\n                else:\n                    rows.extend(p)\n        return rows"},{"attributeType":"None","col":8,"comment":"null","endLoc":117,"id":7015,"name":"left","nodeType":"Attribute","startLoc":117,"text":"self.left"},{"attributeType":"None","col":8,"comment":"null","endLoc":118,"id":7016,"name":"right","nodeType":"Attribute","startLoc":118,"text":"self.right"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":7017,"name":"key","nodeType":"Attribute","startLoc":115,"text":"self.key"},{"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 (defaults to False)\n        Whether the values of the index must be unique\n    ","endLoc":489,"id":7018,"nodeType":"Class","startLoc":151,"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 (defaults to False)\n        Whether the values of the index must be unique\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(\"Invalid traversal method: \\\"{0}\\\"\".format(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 : 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        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 __str__(self):\n        if self.root is None:\n            return 'Empty'\n        return self._print(self.root, 0)\n\n    def __repr__(self):\n        return str(self)\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]"},{"fileName":"serialize.py","filePath":"astropy/table","id":7019,"nodeType":"File","text":"from importlib import import_module\nimport re\nfrom copy import deepcopy\n\nfrom ..utils.data_info import MixinInfo\nfrom .column import Column\nfrom .table import Table, QTable, has_info_class\nfrom ..units.quantity import QuantityInfo\n\n\n__construct_mixin_classes = ('astropy.time.core.Time',\n                             'astropy.time.core.TimeDelta',\n                             'astropy.units.quantity.Quantity',\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.table.NdarrayMixin')\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    \"\"\"Convert a mixin column to a plain columns or a set of mixin columns.\"\"\"\n    # If not a mixin, or if class in ``exclude_classes`` tuple then\n    # treat as a normal column.  Excluded sub-classes must be explicitly\n    # specified.\n    if not has_info_class(col, MixinInfo) 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, xform in (('unit', lambda x: x not in (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            info[attr] = xform(col_attr) if xform else col_attr\n\n    obj_attrs = col.info._represent_as_dict()\n    ordered_keys = col.info._represent_as_dict_attrs\n\n    data_attrs = [key for key in ordered_keys if key in obj_attrs and\n                  getattr(obj_attrs[key], 'shape', ())[:1] == col.shape[:1]]\n\n    for data_attr in data_attrs:\n        data = obj_attrs[data_attr]\n        if len(data_attrs) == 1 and not has_info_class(data, MixinInfo):\n            # For one non-mixin attribute, we need only one serialized column.\n            # We can store info there, and keep the column name as is.\n            new_cols.append(Column(data, name=name, **info))\n            obj_attrs[data_attr] = SerializedColumn({'name': name})\n            # Remove attributes that are already on the serialized column.\n            for attr in info:\n                if attr in obj_attrs:\n                    del obj_attrs[attr]\n\n        else:\n            # New column name combines the old name and attribute\n            # (e.g. skycoord.ra, skycoord.dec).\n            new_name = name + '.' + data_attr\n            # TODO masking, MaskedColumn\n            if not has_info_class(data, MixinInfo):\n                new_cols.append(Column(data, name=new_name))\n                obj_attrs[data_attr] = SerializedColumn({'name': new_name})\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            for attr in col.info.attrs_from_parent:\n                if attr in info:\n                    del info[attr]\n\n            if info:\n                obj_attrs['__info__'] = info\n\n    # Store the fully qualified class name\n    obj_attrs['__class__'] = col.__module__ + '.' + col.__class__.__name__\n\n    mixin_cols[name] = obj_attrs\n\n\ndef _represent_mixins_as_columns(tbl, exclude_classes=()):\n    \"\"\"\n    Convert any mixin columns to plain Column or MaskedColumn and\n    return a new table.  Exclude any mixin columns in ``exclude_classes``,\n    which must be a tuple of classes.\n    \"\"\"\n    if not tbl.has_mixin_columns:\n        return tbl\n\n    mixin_cols = {}\n\n    new_cols = []\n\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    meta = deepcopy(tbl.meta)\n    meta['__serialized_columns__'] = mixin_cols\n    out = Table(new_cols, meta=meta, copy=False)\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('unsupported class for construct {}'.format(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\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                _construct_mixin_from_columns(name, val, out)\n                data_attrs_map[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        col = out[name]\n        obj_attrs[data_attr] = col\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.\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    # Don't know final output class but assume QTable so no columns get\n    # downgraded.\n    out = QTable(tbl, copy=False)\n\n    mixin_cols = out.meta.pop('__serialized_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    if not has_quantities:\n        out = Table(out, copy=False)\n\n    return out\n"},{"col":4,"comment":"null","endLoc":172,"header":"def __init__(self, data, row_index, unique=False)","id":7020,"name":"__init__","nodeType":"Function","startLoc":167,"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":51,"header":"@property\n    def cols(self)","id":7021,"name":"cols","nodeType":"Function","startLoc":49,"text":"@property\n    def cols(self):\n        return self.data.columns.values()"},{"className":"QTable","col":0,"comment":"A class to represent tables of heterogeneous data.\n\n    `QTable` provides a class for heterogeneous tabular data which can be\n    easily modified, for instance adding columns or new rows.\n\n    The `QTable` class is identical to `Table` except that columns with an\n    associated ``unit`` attribute are converted to `~astropy.units.Quantity`\n    objects.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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":2786,"id":7022,"nodeType":"Class","startLoc":2735,"text":"class QTable(Table):\n    \"\"\"A class to represent tables of heterogeneous data.\n\n    `QTable` provides a class for heterogeneous tabular data which can be\n    easily modified, for instance adding columns or new rows.\n\n    The `QTable` class is identical to `Table` except that columns with an\n    associated ``unit`` attribute are converted to `~astropy.units.Quantity`\n    objects.\n\n    Parameters\n    ----------\n    data : numpy ndarray, dict, list, Table, or 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 lists, 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 _add_as_mixin_column(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, or a subclass\n            # identified in the unit (such as u.mag()).\n            q_cls = getattr(col.unit, '_quantity_class', Quantity)\n            qcol = q_cls(col.data, col.unit, copy=False)\n            qcol.info = col.info\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":2773,"header":"def _add_as_mixin_column(self, col)","id":7023,"name":"_add_as_mixin_column","nodeType":"Function","startLoc":2768,"text":"def _add_as_mixin_column(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":"\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":835,"header":"def __getitem__(self, item)","id":7024,"name":"__getitem__","nodeType":"Function","startLoc":816,"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('No matches found for key {0}'.format(item))\n        elif len(rows) == 1:  # single row\n            return self.table[rows[0]]\n        return self.table[rows]"},{"col":4,"comment":"null","endLoc":2786,"header":"def _convert_col_for_table(self, col)","id":7025,"name":"_convert_col_for_table","nodeType":"Function","startLoc":2775,"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, or a subclass\n            # identified in the unit (such as u.mag()).\n            q_cls = getattr(col.unit, '_quantity_class', Quantity)\n            qcol = q_cls(col.data, col.unit, copy=False)\n            qcol.info = col.info\n            col = qcol\n        else:\n            col = super()._convert_col_for_table(col)\n\n        return col"},{"col":4,"comment":"null","endLoc":170,"header":"def html_js(self, table_id='table0', sort_columns='[]')","id":7026,"name":"html_js","nodeType":"Function","startLoc":166,"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":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":863,"header":"def __setitem__(self, key, value)","id":7027,"name":"__setitem__","nodeType":"Function","startLoc":837,"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('No matches found for key {0}'.format(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('Right side should contain {0} values'.format(len(rows)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":7028,"name":"display_length","nodeType":"Attribute","startLoc":129,"text":"self.display_length"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":7029,"name":"_use_local_files","nodeType":"Attribute","startLoc":126,"text":"self._use_local_files"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":7030,"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)","id":7031,"name":"write_table_jsviewer","nodeType":"Function","startLoc":173,"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):\n    if table_id is None:\n        table_id = 'table{id}'.format(id=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.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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":780,"id":7032,"name":"indices","nodeType":"Attribute","startLoc":780,"text":"self.indices"},{"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":196,"id":7033,"nodeType":"Class","startLoc":136,"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\n    def _construct_from_dict(self, map):\n        # Need to pop value because different Quantity subclasses use\n        # different first arg name for the value.  :-(\n        value = map.pop('value')\n        return self._parent_cls(value, **map)\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 : 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"},{"className":"QuantityInfoBase","col":0,"comment":"null","endLoc":133,"id":7034,"nodeType":"Class","startLoc":110,"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 '{0.value:}'.format(val)\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":779,"id":7035,"name":"table","nodeType":"Attribute","startLoc":779,"text":"self.table"},{"className":"ParentDtypeInfo","col":0,"comment":"Mixin that gets info.dtype from parent","endLoc":622,"id":7036,"nodeType":"Class","startLoc":619,"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"},{"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":915,"id":7037,"nodeType":"Class","startLoc":889,"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('Invalid index for iloc: {0}'.format(item))\n\n        return table_slice"},{"attributeType":"null","col":4,"comment":"null","endLoc":622,"id":7038,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":622,"text":"attrs_from_parent"},{"col":4,"comment":"null","endLoc":915,"header":"def __getitem__(self, item)","id":7039,"name":"__getitem__","nodeType":"Function","startLoc":903,"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('Invalid index for iloc: {0}'.format(item))\n\n        return table_slice"},{"col":4,"comment":"null","endLoc":119,"header":"@staticmethod\n    def default_format(val)","id":7040,"name":"default_format","nodeType":"Function","startLoc":117,"text":"@staticmethod\n    def default_format(val):\n        return '{0.value:}'.format(val)"},{"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":133,"header":"@staticmethod\n    def possible_string_format_functions(format_)","id":7041,"name":"possible_string_format_functions","nodeType":"Function","startLoc":121,"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":131,"id":7042,"nodeType":"Lambda","startLoc":131,"text":"lambda format_, val: format(val.value, format_)"},{"col":4,"comment":"\n        Add a key, data pair.\n        ","endLoc":203,"header":"def add(self, key, data=None)","id":7043,"name":"add","nodeType":"Function","startLoc":174,"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"},{"col":14,"endLoc":132,"id":7044,"nodeType":"Lambda","startLoc":132,"text":"lambda format_, val: format_.format(val.value)"},{"col":14,"endLoc":133,"id":7045,"nodeType":"Lambda","startLoc":133,"text":"lambda format_, val: format_ % val.value"},{"attributeType":"null","col":4,"comment":"null","endLoc":114,"id":7046,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":114,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":115,"id":7047,"name":"_supports_indexing","nodeType":"Attribute","startLoc":115,"text":"_supports_indexing"},{"col":4,"comment":"null","endLoc":148,"header":"def _construct_from_dict(self, map)","id":7048,"name":"_construct_from_dict","nodeType":"Function","startLoc":144,"text":"def _construct_from_dict(self, map):\n        # Need to pop value because different Quantity subclasses use\n        # different first arg name for the value.  :-(\n        value = map.pop('value')\n        return self._parent_cls(value, **map)"},{"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":7049,"name":"add","nodeType":"Function","startLoc":53,"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('Cannot add duplicate value \"{0}\" in a '\n                             'unique index'.format(key))\n        self.data.insert_row(pos, key)\n        self.row_index = self.row_index.insert(pos, row)"},{"className":"TableLocIndices","col":0,"comment":"null","endLoc":886,"id":7050,"nodeType":"Class","startLoc":866,"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('No matches found for key {0}'.format(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":886,"header":"def __getitem__(self, item)","id":7051,"name":"__getitem__","nodeType":"Function","startLoc":868,"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('No matches found for key {0}'.format(item))\n        elif len(rows) == 1:  # single row\n            return rows[0]\n        return rows"},{"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 : Quantity (or subclass)\n            Empty instance of this class consistent with ``cols``\n\n        ","endLoc":196,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":7052,"name":"new_like","nodeType":"Function","startLoc":150,"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 : 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"},{"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":7053,"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 and\n                                         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":7054,"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":7055,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":142,"id":7056,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":142,"text":"_represent_as_dict_attrs"},{"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'), 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\n    Returns\n    -------\n    joined_table : `~astropy.table.Table` object\n        New table containing the result of the join operation.\n    ","endLoc":756,"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')","id":7057,"name":"_join","nodeType":"Function","startLoc":600,"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    \"\"\"\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'), 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\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    if join_type not in ('inner', 'outer', 'left', 'right'):\n        raise ValueError(\"The 'join_type' argument should be in 'inner', \"\n                         \"'outer', 'left' or 'right' (got '{0}' instead)\".\n                         format(join_type))\n\n    # If we have a single key, put it in a tuple\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        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('{0} table does not have key column {1!r}'\n                                      .format(arr_label, name))\n            if hasattr(arr[name], 'mask') and np.any(arr[name].mask):\n                raise TableMergeError('{0} key column {1!r} has missing values'\n                                      .format(arr_label, name))\n            if not isinstance(arr[name], np.ndarray):\n                raise ValueError(\"non-ndarray column '{}' not allowed as a key column\"\n                                 .format(name))\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    # 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    # Make an array with just the key columns.  This uses a temporary\n    # structured array for efficiency.\n    out_keys_dtype = [descr for descr in out_descrs if descr[0] in keys]\n    out_keys = np.empty(len_left + len_right, dtype=out_keys_dtype)\n    for key in keys:\n        out_keys[key][:len_left] = left[key]\n        out_keys[key][len_left:] = right[key]\n    idx_sort = out_keys.argsort(order=keys)\n    out_keys = out_keys[idx_sort]\n\n    # Get all keys\n    diffs = np.concatenate(([True], out_keys[1:] != out_keys[:-1], [True]))\n    idxs = np.flatnonzero(diffs)\n\n    # Main inner loop in Cython to compute the cartesion product\n    # indices for the given join type\n    int_join_type = {'inner': 0, 'outer': 1, 'left': 2, 'right': 3}[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    # If either of the inputs are masked then the output is masked\n    if left.masked or right.masked:\n        masked = True\n    masked = bool(masked)\n\n    out = _get_out_class([left, right])(masked=masked)\n\n    for out_name, dtype, shape in out_descrs:\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\n            if issubclass(col_cls, Column):\n                out[out_name][:] = np.where(right_mask,\n                                            left[left_name].take(left_out),\n                                            right[right_name].take(right_out))\n            else:\n                # np.where does not work for mixin columns (e.g. Quantity) so\n                # use a slower workaround.\n                left_mask = ~right_mask\n                if np.any(left_mask):\n                    out[out_name][left_mask] = left[left_name].take(left_out)\n                if np.any(right_mask):\n                    out[out_name][right_mask] = 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        # Finally add the joined column to the output table.\n        out[out_name] = array[name][array_out]\n\n        # If the output table is masked then set the output column masking\n        # accordingly.  Check for columns that don't support a mask attribute.\n        if masked:\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 = (out[out_name].shape[0],) + (1,) * (len(out[out_name].shape) - 1)\n\n            if array.masked:\n                array_mask = array_mask | array[name].mask[array_out]\n            try:\n                out[out_name].mask[:] = array_mask\n            except ValueError:\n                raise NotImplementedError(\n                    \"join requires masking column '{}' but column\"\n                    \" type {} does not support masking\"\n                    .format(out_name, out[out_name].__class__.__name__))\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7058,"name":"__construct_mixin_classes","nodeType":"Attribute","startLoc":11,"text":"__construct_mixin_classes"},{"col":0,"comment":"","endLoc":1,"header":"serialize.py#<anonymous>","id":7059,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__construct_mixin_classes = ('astropy.time.core.Time',\n                             'astropy.time.core.TimeDelta',\n                             'astropy.units.quantity.Quantity',\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.table.NdarrayMixin')"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":30,"id":7060,"name":"conf","nodeType":"Attribute","startLoc":30,"text":"conf"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":7061,"name":"EXTERN_JS_DIR","nodeType":"Attribute","startLoc":33,"text":"EXTERN_JS_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":7062,"name":"EXTERN_CSS_DIR","nodeType":"Attribute","startLoc":34,"text":"EXTERN_CSS_DIR"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":7063,"name":"_SORTING_SCRIPT_PART_1","nodeType":"Attribute","startLoc":36,"text":"_SORTING_SCRIPT_PART_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":7064,"name":"_SORTING_SCRIPT_PART_2","nodeType":"Attribute","startLoc":50,"text":"_SORTING_SCRIPT_PART_2"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":7065,"name":"IPYNB_JS_SCRIPT","nodeType":"Attribute","startLoc":57,"text":"IPYNB_JS_SCRIPT"},{"attributeType":"null","col":0,"comment":"null","endLoc":78,"id":7066,"name":"HTML_JS_SCRIPT","nodeType":"Attribute","startLoc":78,"text":"HTML_JS_SCRIPT"},{"attributeType":"null","col":0,"comment":"null","endLoc":92,"id":7067,"name":"DEFAULT_CSS","nodeType":"Attribute","startLoc":92,"text":"DEFAULT_CSS"},{"attributeType":"null","col":0,"comment":"null","endLoc":100,"id":7068,"name":"DEFAULT_CSS_NB","nodeType":"Attribute","startLoc":100,"text":"DEFAULT_CSS_NB"},{"col":0,"comment":"","endLoc":3,"header":"jsviewer.py#<anonymous>","id":7069,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"conf = Conf()\n\nEXTERN_JS_DIR = abspath(join(dirname(extern.__file__), 'js'))\n\nEXTERN_CSS_DIR = abspath(join(dirname(extern.__file__), '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)"},{"fileName":"info.py","filePath":"astropy/table","id":7070,"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\n\nimport numpy as np\nfrom ..utils.data_info import DataInfo\n\n__all__ = ['table_info', 'TableInfo']\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.0 2.0\n\n    Parameters\n    ----------\n    option : str, function, list of (str or function)\n        Info option, defaults to 'attributes'.\n    out : file-like object, 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('length={0}'.format(len(tbl)))\n\n    outlines = ['<' + ' '.join(descr_vals) + '>']\n\n    cols = 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    _parent = None\n\n    def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)\n\n    __call__.__doc__ = table_info.__doc__\n"},{"className":"TableInfo","col":0,"comment":"null","endLoc":123,"id":7071,"nodeType":"Class","startLoc":117,"text":"class TableInfo(DataInfo):\n    _parent = None\n\n    def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)\n\n    __call__.__doc__ = table_info.__doc__"},{"fileName":"column.py","filePath":"astropy/table","id":7072,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport warnings\nimport weakref\nimport re\n\nfrom copy import deepcopy\n\nimport numpy as np\nfrom numpy import ma\n\n# Remove this when Numpy no longer emits this warning and that Numpy version\n# becomes the minimum required version for Astropy.\n# https://github.com/astropy/astropy/issues/6285\ntry:\n    from numpy.ma.core import MaskedArrayFutureWarning\nexcept ImportError:\n    # For Numpy versions that do not raise this warning.\n    MaskedArrayFutureWarning = None\n\nfrom ..units import Unit, Quantity\nfrom ..utils.console import color_print\nfrom ..utils.metadata import MetaData\nfrom ..utils.data_info import BaseColumnInfo, dtype_info_name\nfrom ..utils.misc import dtype_bytes_or_chars\nfrom . import groups\nfrom . import pprint\nfrom .np_utils import fix_column_name\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    # The new column should have None for the parent_table ref.  If the\n    # original parent_table weakref there at the point of copying then it\n    # generates an infinite recursion.  Instead temporarily remove the weakref\n    # on the original column and restore after the copy in an exception-safe\n    # manner.\n\n    parent_table = col.info.parent_table\n    indices = col.info.indices\n    col.info.parent_table = None\n    col.info.indices = []\n\n    try:\n        newcol = col.copy() if hasattr(col, 'copy') else deepcopy(col)\n        newcol.info = col.info\n        newcol.info.indices = deepcopy(indices or []) if copy_indices else []\n        for index in newcol.info.indices:\n            index.replace_col(col, newcol)\n    finally:\n        col.info.parent_table = parent_table\n        col.info.indices = indices\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 {0} class to True'\n                             .format(self.__class__.__name__))\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\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            dtype = (np.dtype(dtype).str, shape)\n            self_data = np.zeros(length, 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 = deepcopy(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 = np.array(data.to(unit), dtype=dtype, copy=copy)\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 = deepcopy(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 = fix_column_name(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 \\\n                       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 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        # 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\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 or\n            (isinstance(out_arr, BaseColumn) and\n             (context is not None 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        val = fix_column_name(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 '{0}': could not display \"\n                \"values in this column using this format ({1})\".format(\n                    self.name, err.args[0]))\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 : boolean\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 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 equivalence pairs, optional\n           A list of equivalence pairs to try if the unit are not\n           directly convertible.  See :ref:`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, copy=False, dtype=self.dtype, order='A')\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 : `~astropy.units.Unit` or str\n            The unit to convert to (i.e., a valid argument to the\n            :meth:`astropy.units.Quantity.to` method).\n        equivalencies : list of equivalence pairs, optional\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        self.meta = deepcopy(getattr(obj, 'meta', {}))\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\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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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('{0}={1!r}'.format(attr, val))\n\n        descr = '<' + ' '.join(descr_vals) + '>\\n'\n\n        if html:\n            from ..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    def _make_compare(oper):\n        \"\"\"\n        Make comparison methods which encode the ``other`` object to utf-8\n        in the case of a bytestring dtype for Py3+.\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            if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U' and\n                    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            return getattr(self.data, op)(other)\n\n        return _compare\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 ints\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\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        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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            data = np.insert(self, obj, values, axis=axis)\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 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 compatible value\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 or None or function 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://docs.scipy.org/doc/numpy/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\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 and hasattr(data, 'mask'):\n            mask = data.mask\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\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 = self.dtype.type(data.fill_value)\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        out = self.view(ma.MaskedArray)\n        # The following is necessary because of a bug in Numpy, which was\n        # fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0.\n        out.fill_value = self.fill_value\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        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 ints\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\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        mask : boolean array_like\n            Mask value(s) to insert.  If not supplied 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            # Explicitly convert to dtype of this column.  Needed because numpy 1.7\n            # enforces safe casting by default, so .  This isn't the case for 1.6 or 1.8+.\n            values = np.asarray(values, dtype=self.dtype)\n            new_data = np.insert(self_ma.data, obj, values, axis=axis)\n\n        if mask is None:\n            if self.dtype.kind == 'O':\n                mask = False\n            else:\n                mask = np.zeros(values.shape, dtype=bool)\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\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            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        # Remove this when Numpy no longer emits this warning and that\n        # Numpy version becomes the minimum required version for Astropy.\n        # https://github.com/astropy/astropy/issues/6285\n        if MaskedArrayFutureWarning is None:\n            ma.MaskedArray.__setitem__(self, index, value)\n        else:\n            with warnings.catch_warnings():\n                warnings.simplefilter('ignore', MaskedArrayFutureWarning)\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"},{"col":4,"comment":"null","endLoc":121,"header":"def __call__(self, option='attributes', out='')","id":7073,"name":"__call__","nodeType":"Function","startLoc":120,"text":"def __call__(self, option='attributes', out=''):\n        return table_info(self._parent, option, out)"},{"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.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":416,"id":7074,"nodeType":"Class","startLoc":373,"text":"class MetaData:\n    \"\"\"\n    A descriptor for classes that have a ``meta`` property.\n\n    This can be set to any valid `~collections.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, collections.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":397,"header":"def __init__(self, doc=\"\", copy=True)","id":7075,"name":"__init__","nodeType":"Function","startLoc":395,"text":"def __init__(self, doc=\"\", copy=True):\n        self.__doc__ = doc\n        self.copy = copy"},{"col":4,"comment":"null","endLoc":404,"header":"def __get__(self, instance, owner)","id":7076,"name":"__get__","nodeType":"Function","startLoc":399,"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":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.0 2.0\n\n    Parameters\n    ----------\n    option : str, function, list of (str or function)\n        Info option, defaults to 'attributes'.\n    out : file-like object, 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":114,"header":"def table_info(tbl, option='attributes', out='')","id":7077,"name":"table_info","nodeType":"Function","startLoc":14,"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.0 2.0\n\n    Parameters\n    ----------\n    option : str, function, list of (str or function)\n        Info option, defaults to 'attributes'.\n    out : file-like object, 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('length={0}'.format(len(tbl)))\n\n    outlines = ['<' + ' '.join(descr_vals) + '>']\n\n    cols = 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)"},{"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":7078,"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":4,"comment":"null","endLoc":416,"header":"def __set__(self, instance, value)","id":7079,"name":"__set__","nodeType":"Function","startLoc":406,"text":"def __set__(self, instance, value):\n        if value is None:\n            instance._meta = OrderedDict()\n        else:\n            if isinstance(value, collections.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":396,"id":7080,"name":"__doc__","nodeType":"Attribute","startLoc":396,"text":"self.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":397,"id":7081,"name":"copy","nodeType":"Attribute","startLoc":397,"text":"self.copy"},{"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 : 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":194,"header":"def range(self, lower, upper, bounds)","id":7082,"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 : 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        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]"},{"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":47,"id":7083,"nodeType":"Class","startLoc":38,"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":"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":134,"id":7084,"nodeType":"Class","startLoc":110,"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 {0} class to True'\n                             .format(self.__class__.__name__))"},{"col":4,"comment":"null","endLoc":134,"header":"def __setitem__(self, item, val)","id":7085,"name":"__setitem__","nodeType":"Function","startLoc":130,"text":"def __setitem__(self, item, val):\n        val = np.asarray(val)\n        if np.any(val):\n            raise ValueError('Cannot set any element of {0} class to True'\n                             .format(self.__class__.__name__))"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":7086,"name":"obj","nodeType":"Attribute","startLoc":127,"text":"obj"},{"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":175,"id":7087,"nodeType":"Class","startLoc":137,"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)"},{"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":175,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":7088,"name":"new_like","nodeType":"Function","startLoc":147,"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)"},{"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":7089,"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"},{"className":"TableFormatter","col":0,"comment":"null","endLoc":719,"id":7090,"nodeType":"Class","startLoc":139,"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        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        col_strs = list(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 ..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 = '<{0}>{1}</{2}>'.format(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('Length = {0} rows'.format(len(col)))\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 += ' [{0}]'.format(\n                    ','.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 = '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) or\n                _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 '{0} .. {1}'.format(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 \"{0}\" for entry \"{1}\" '\n                        'in column \"{2}\"'.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        cols = []\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 {0} alignment values instead of '\n                                 'the number of columns ({1})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {0})'\n                            .format(type(align)))\n\n        for align_, col in zip(align, table.columns.values()):\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        outwidth = lambda cols: sum(len(c[0]) for c in cols) + len(cols) - 1\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 ..utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = 'table{id}'.format(id=id(table))\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append('<table id=\"{tid}\" class=\"{tcls}\">'.format(\n                    tid=tableid, tcls=tableclass))\n            else:\n                rows.append('<table id=\"{tid}\">'.format(tid=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 = ('<{0}>{1}</{2}>'.format(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\")"},{"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":191,"header":"@staticmethod\n    def _get_pprint_size(max_lines=None, max_width=None)","id":7091,"name":"_get_pprint_size","nodeType":"Function","startLoc":140,"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        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":"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":314,"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":7092,"name":"_pformat_col","nodeType":"Function","startLoc":193,"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        col_strs = list(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 ..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 = '<{0}>{1}</{2}>'.format(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('Length = {0} rows'.format(len(col)))\n\n        return col_strs, outs"},{"attributeType":"null","col":4,"comment":"null","endLoc":144,"id":7093,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":144,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":145,"id":7094,"name":"_supports_indexing","nodeType":"Attribute","startLoc":145,"text":"_supports_indexing"},{"attributeType":"TableFormatter","col":0,"comment":"null","endLoc":35,"id":7095,"name":"FORMATTER","nodeType":"Attribute","startLoc":35,"text":"FORMATTER"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":7096,"name":"_comparison_functions","nodeType":"Attribute","startLoc":62,"text":"_comparison_functions"},{"col":0,"comment":"","endLoc":3,"header":"column.py#<anonymous>","id":7097,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"try:\n    from numpy.ma.core import MaskedArrayFutureWarning\nexcept ImportError:\n    # For Numpy versions that do not raise this warning.\n    MaskedArrayFutureWarning = None\n\nFORMATTER = 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":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":581,"header":"def get_descrs(arrays, col_name_map)","id":7098,"name":"get_descrs","nodeType":"Function","startLoc":547,"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 '{0}' columns have incompatible types: {1}\"\n                                  .format(names[0], tme._incompat_types))\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 {0!r} have different shape'.format(names))\n        shape = uniq_shapes.pop()\n\n        out_descrs.append((fix_column_name(out_name), dtype, shape))\n\n    return out_descrs"},{"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":7099,"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":7100,"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":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":7101,"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":7102,"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":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":289,"header":"def sort(self)","id":7103,"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":7104,"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":7105,"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])"},{"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":597,"header":"def common_dtype(cols)","id":7106,"name":"common_dtype","nodeType":"Function","startLoc":584,"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('Columns have incompatible types {0}'\n                              .format(err._incompat_types))\n        tme._incompat_types = err._incompat_types\n        raise tme"},{"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":461,"header":"def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs,\n                          show_dtype=False, show_length=None)","id":7107,"name":"_pformat_col_iter","nodeType":"Function","startLoc":316,"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 += ' [{0}]'.format(\n                    ','.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 = '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) or\n                _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 '{0} .. {1}'.format(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 \"{0}\" for entry \"{1}\" '\n                        'in column \"{2}\"'.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"},{"col":4,"comment":"null","endLoc":311,"header":"def __repr__(self)","id":7108,"name":"__repr__","nodeType":"Function","startLoc":308,"text":"def __repr__(self):\n        t = self.data.copy()\n        t['rows'] = self.row_index\n        return str(t)"},{"fileName":"setup_package.py","filePath":"astropy/table","id":7109,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom distutils.extension import Extension\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']\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":20,"header":"def get_extensions()","id":7110,"name":"get_extensions","nodeType":"Function","startLoc":9,"text":"def get_extensions():\n    sources = [\"_np_utils.pyx\", \"_column_mixins.pyx\"]\n    include_dirs = ['numpy']\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"},{"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":220,"header":"def find(self, key)","id":7111,"name":"find","nodeType":"Function","startLoc":205,"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 []"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7112,"name":"ROOT","nodeType":"Attribute","startLoc":6,"text":"ROOT"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":7113,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ROOT = os.path.relpath(os.path.dirname(__file__))"},{"col":4,"comment":"null","endLoc":314,"header":"def __str__(self)","id":7114,"name":"__str__","nodeType":"Function","startLoc":313,"text":"def __str__(self):\n        return repr(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":7115,"name":"data","nodeType":"Attribute","startLoc":44,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":7116,"name":"row_index","nodeType":"Attribute","startLoc":45,"text":"self.row_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":7117,"name":"unique","nodeType":"Attribute","startLoc":47,"text":"self.unique"},{"attributeType":"None","col":4,"comment":"null","endLoc":118,"id":7118,"name":"_parent","nodeType":"Attribute","startLoc":118,"text":"_parent"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":7119,"name":"num_cols","nodeType":"Attribute","startLoc":46,"text":"self.num_cols"},{"attributeType":"null","col":4,"comment":"null","endLoc":123,"id":7120,"name":"__doc__","nodeType":"Attribute","startLoc":123,"text":"__call__.__doc__"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":7121,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"className":"QueryError","col":0,"comment":"\n    Indicates that a given index cannot handle the supplied query.\n    ","endLoc":45,"id":7122,"nodeType":"Class","startLoc":41,"text":"class QueryError(ValueError):\n    '''\n    Indicates that a given index cannot handle the supplied query.\n    '''\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7123,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"info.py#<anonymous>","id":7124,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nTable property for providing information about table.\n\"\"\"\n\n__all__ = ['table_info', 'TableInfo']"},{"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        FastBST, and FastRBT) 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":407,"id":7125,"nodeType":"Class","startLoc":48,"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        FastBST, and FastRBT) 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 __new__(cls, *args, **kwargs):\n        self = super().__new__(cls)\n\n        # If (and only if) unpickling for protocol >= 2, then args and kwargs\n        # are both empty.  The class __init__ requires at least the `columns`\n        # arg.  In this case return a bare `Index` object which is then morphed\n        # by the unpickling magic into the correct SlicedIndex object.\n        if not args and not kwargs:\n            return self\n\n        self.__init__(*args, **kwargs)\n        return SlicedIndex(self, slice(0, 0, None), original=True)\n\n    def __init__(self, columns, engine=None, unique=False):\n        from .table import Table, Column\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')\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(\"Column does not belong to index: {0}\".format(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[i] = vals[self.col_position(col.info.name)]\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 {0} 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(\"Could not remove row {0} from index\".format(row))\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 __str__(self):\n        return str(self.data)\n\n    def __repr__(self):\n        return str(self)\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":"null","endLoc":78,"header":"def __new__(cls, *args, **kwargs)","id":7126,"name":"__new__","nodeType":"Function","startLoc":67,"text":"def __new__(cls, *args, **kwargs):\n        self = super().__new__(cls)\n\n        # If (and only if) unpickling for protocol >= 2, then args and kwargs\n        # are both empty.  The class __init__ requires at least the `columns`\n        # arg.  In this case return a bare `Index` object which is then morphed\n        # by the unpickling magic into the correct SlicedIndex object.\n        if not args and not kwargs:\n            return self\n\n        self.__init__(*args, **kwargs)\n        return SlicedIndex(self, slice(0, 0, None), original=True)"},{"fileName":"pprint.py","filePath":"astropy/table","id":7127,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nimport sys\nimport re\n\nimport numpy as np\n\nfrom .. import log\nfrom ..utils.console import Getch, color_print, terminal_size, conf\nfrom ..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)\n            try:\n                out = format_func(format_, val)\n                if not isinstance(out, str):\n                    raise ValueError('Format function for value {0} returned {1} '\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('Format function for value {0} failed: {1}'\n                                 .format(val, 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 {0} 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\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        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        col_strs = list(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 ..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 = '<{0}>{1}</{2}>'.format(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('Length = {0} rows'.format(len(col)))\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 += ' [{0}]'.format(\n                    ','.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 = '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) or\n                _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 '{0} .. {1}'.format(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 \"{0}\" for entry \"{1}\" '\n                        'in column \"{2}\"'.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        cols = []\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 {0} alignment values instead of '\n                                 'the number of columns ({1})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {0})'\n                            .format(type(align)))\n\n        for align_, col in zip(align, table.columns.values()):\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        outwidth = lambda cols: sum(len(c[0]) for c in cols) + len(cols) - 1\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 ..utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = 'table{id}'.format(id=id(table))\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append('<table id=\"{tid}\" class=\"{tcls}\">'.format(\n                    tid=tableid, tcls=tableclass))\n            else:\n                rows.append('<table id=\"{tid}\">'.format(tid=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 = ('<{0}>{1}</{2}>'.format(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":"__init__.py","filePath":"astropy/table","id":7128,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom .. import config as _config\n\n\nclass Conf(_config.ConfigNamespace):\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 <http://getbootstrap.com/css/#tables '\n        'for a list of useful bootstrap classes.')\n    replace_warnings = _config.ConfigItem(\n        ['slice'],\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        'list',\n        )\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\n\nconf = Conf()\n\n\nfrom .column import Column, MaskedColumn, StringTruncateWarning, ColumnInfo\nfrom .groups import TableGroups, ColumnGroups\nfrom .table import (Table, QTable, TableColumns, Row, TableFormatter,\n                    NdarrayMixin, TableReplaceWarning)\nfrom .operations import join, setdiff, hstack, vstack, unique, TableMergeError\nfrom .bst import BST, FastBST, FastRBT\nfrom .sorted_array import SortedArray\nfrom .serialize import SerializedColumn\n\n# Finally import the formats for the read and write method but delay building\n# the documentation until all are loaded. (#5275)\nfrom ..io import registry\n\nwith registry.delay_doc_updates(Table):\n    # Import routines that connect readers/writers to astropy.table\n    from .jsviewer import JSViewer\n    from ..io.ascii import connect\n    from ..io.fits import connect\n    from ..io.misc import connect\n    from ..io.votable import connect\n"},{"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":1046,"id":7129,"nodeType":"Class","startLoc":1028,"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":1043,"header":"def __init__(self)","id":7130,"name":"__init__","nodeType":"Function","startLoc":1036,"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()"},{"className":"TableGroups","col":0,"comment":"null","endLoc":402,"id":7131,"nodeType":"Class","startLoc":303,"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, i1s = self.indices[:-1], 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"},{"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":208,"id":7132,"nodeType":"Class","startLoc":154,"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:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array')\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 '<{0} indices={1}>'.format(self.__class__.__name__, self.indices)\n\n    def __len__(self):\n        return len(self.indices) - 1"},{"col":4,"comment":"null","endLoc":164,"header":"@property\n    def parent(self)","id":7133,"name":"parent","nodeType":"Function","startLoc":162,"text":"@property\n    def parent(self):\n        return self.parent_column if isinstance(self, ColumnGroups) else self.parent_table"},{"col":4,"comment":"null","endLoc":168,"header":"def __iter__(self)","id":7134,"name":"__iter__","nodeType":"Function","startLoc":166,"text":"def __iter__(self):\n        self._iter_index = 0\n        return self"},{"col":4,"comment":"null","endLoc":177,"header":"def next(self)","id":7135,"name":"next","nodeType":"Function","startLoc":170,"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":202,"header":"def __getitem__(self, item)","id":7136,"name":"__getitem__","nodeType":"Function","startLoc":180,"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:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array')\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"},{"col":4,"comment":"null","endLoc":205,"header":"def __repr__(self)","id":7137,"name":"__repr__","nodeType":"Function","startLoc":204,"text":"def __repr__(self):\n        return '<{0} indices={1}>'.format(self.__class__.__name__, self.indices)"},{"col":4,"comment":"null","endLoc":208,"header":"def __len__(self)","id":7138,"name":"__len__","nodeType":"Function","startLoc":207,"text":"def __len__(self):\n        return len(self.indices) - 1"},{"attributeType":"function","col":4,"comment":"null","endLoc":178,"id":7139,"name":"__next__","nodeType":"Attribute","startLoc":178,"text":"__next__"},{"attributeType":"null","col":8,"comment":"null","endLoc":167,"id":7141,"name":"_iter_index","nodeType":"Attribute","startLoc":167,"text":"self._iter_index"},{"col":4,"comment":"null","endLoc":1074,"header":"def __init__(self)","id":7142,"name":"__init__","nodeType":"Function","startLoc":1073,"text":"def __init__(self):\n        import msvcrt  # pylint: disable=W0611"},{"col":4,"comment":"\n        Return the names of columns in the parent table that were used for grouping.\n        ","endLoc":319,"header":"@property\n    def key_colnames(self)","id":7143,"name":"key_colnames","nodeType":"Function","startLoc":309,"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":326,"header":"@property\n    def indices(self)","id":7144,"name":"indices","nodeType":"Function","startLoc":321,"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"},{"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":361,"header":"def aggregate(self, func)","id":7145,"name":"aggregate","nodeType":"Function","startLoc":328,"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, i1s = self.indices[:-1], 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":1091,"header":"def __init__(self)","id":7146,"name":"__init__","nodeType":"Function","startLoc":1089,"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":1056,"header":"def __init__(self)","id":7147,"name":"__init__","nodeType":"Function","startLoc":1050,"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":1046,"header":"def __call__(self)","id":7148,"name":"__call__","nodeType":"Function","startLoc":1045,"text":"def __call__(self):\n        return self.impl()"},{"attributeType":"null","col":16,"comment":"null","endLoc":1043,"id":7149,"name":"impl","nodeType":"Attribute","startLoc":1043,"text":"self.impl"},{"col":4,"comment":"null","endLoc":440,"header":"def __init__(self, index, index_slice, original=False)","id":7150,"name":"__init__","nodeType":"Function","startLoc":431,"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        else:  # 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)"},{"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":43,"header":"def _possible_string_format_functions(format_)","id":7151,"name":"_possible_string_format_functions","nodeType":"Function","startLoc":35,"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":10,"endLoc":41,"id":7152,"nodeType":"Lambda","startLoc":41,"text":"lambda format_, val: format(val, format_)"},{"col":10,"endLoc":42,"id":7153,"nodeType":"Lambda","startLoc":42,"text":"lambda format_, val: format_.format(val)"},{"col":10,"endLoc":43,"id":7154,"nodeType":"Lambda","startLoc":43,"text":"lambda format_, val: format_ % val"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":7155,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"pprint.py#<anonymous>","id":7156,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = []"},{"col":4,"comment":"\n        Number of rows in index.\n        ","endLoc":133,"header":"def __len__(self)","id":7157,"name":"__len__","nodeType":"Function","startLoc":129,"text":"def __len__(self):\n        '''\n        Number of rows in index.\n        '''\n        return len(self.columns[0])"},{"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":146,"header":"def replace_col(self, prev_col, new_col)","id":7158,"name":"replace_col","nodeType":"Function","startLoc":135,"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":"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":601,"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":7159,"name":"_pformat_table","nodeType":"Function","startLoc":463,"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        cols = []\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 {0} alignment values instead of '\n                                 'the number of columns ({1})'\n                                 .format(len(align), n_cols))\n        else:\n            raise TypeError('align keyword must be str or list or tuple (got {0})'\n                            .format(type(align)))\n\n        for align_, col in zip(align, table.columns.values()):\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        outwidth = lambda cols: sum(len(c[0]) for c in cols) + len(cols) - 1\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 ..utils.xml.writer import xml_escape\n\n            if tableid is None:\n                tableid = 'table{id}'.format(id=id(table))\n\n            if tableclass is not None:\n                if isinstance(tableclass, list):\n                    tableclass = ' '.join(tableclass)\n                rows.append('<table id=\"{tid}\" class=\"{tcls}\">'.format(\n                    tid=tableid, tcls=tableclass))\n            else:\n                rows.append('<table id=\"{tid}\">'.format(tid=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 = ('<{0}>{1}</{2}>'.format(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 the node associated with the given key.\n        ","endLoc":228,"header":"def find_node(self, key)","id":7160,"name":"find_node","nodeType":"Function","startLoc":222,"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":257,"header":"def _find_recursive(self, key, node, parent)","id":7161,"name":"_find_recursive","nodeType":"Function","startLoc":244,"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":235,"header":"def shift_left(self, row)","id":7162,"name":"shift_left","nodeType":"Function","startLoc":230,"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]"},{"fileName":"meta.py","filePath":"astropy/table","id":7163,"nodeType":"File","text":"import textwrap\nimport copy\nfrom collections import OrderedDict\n\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    import yaml\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            \"expected a sequence, but found {}\".format(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                \"expected a mapping of length 1, but found {}\".format(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                \"expected a single mapping item, but found {} items\".format(len(subnode.value)),\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    import yaml\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, u'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(u'tag:yaml.org,2002:map', data)\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    attrs = ColumnDict()\n    attrs['name'] = col.info.name\n\n    type_name = col.info.dtype.type.__name__\n    if type_name.startswith(('bytes', 'str')):\n        type_name = 'string'\n    if type_name.endswith('_'):\n        type_name = type_name[:-1]  # string_ and bool_ lose the final _ for ECSV\n    attrs['datatype'] = type_name\n\n    # Set the output attributes\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    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    try:\n        import yaml\n    except ImportError:\n        raise ImportError('`import yaml` failed, PyYAML package is '\n                          'required for serializing mixin columns')\n\n    from ..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, 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\n    try:\n        import yaml\n    except ImportError:\n        raise ImportError('`import yaml` failed, PyYAML package '\n                          'is required for serializing mixin columns')\n\n    from ..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(u'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(str(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":32,"id":7164,"nodeType":"Class","startLoc":9,"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":32,"header":"def sort(self, *args, **kwargs)","id":7165,"name":"sort","nodeType":"Function","startLoc":15,"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 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":166,"header":"def col_position(self, col_name)","id":7166,"name":"col_position","nodeType":"Function","startLoc":154,"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(\"Column does not belong to index: {0}\".format(col_name))"},{"col":4,"comment":"\n        Recreate the index based on data in self.columns.\n        ","endLoc":152,"header":"def reload(self)","id":7167,"name":"reload","nodeType":"Function","startLoc":148,"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        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":191,"header":"def insert_row(self, pos, vals, columns)","id":7168,"name":"insert_row","nodeType":"Function","startLoc":168,"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[i] = vals[self.col_position(col.info.name)]\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":19,"endLoc":553,"id":7169,"nodeType":"Lambda","startLoc":553,"text":"lambda cols: sum(len(c[0]) for c in cols) + len(cols) - 1"},{"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":47,"id":7170,"nodeType":"Class","startLoc":35,"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":"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":719,"header":"def _more_tabcol(self, tabcol, max_lines=None, max_width=None,\n                     show_name=True, show_unit=None, show_dtype=False)","id":7171,"name":"_more_tabcol","nodeType":"Function","startLoc":603,"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\")"},{"col":4,"comment":"\n        Return items as a ColumnOrderList, which sorts in the preferred\n        way for column attributes.\n        ","endLoc":47,"header":"def items(self)","id":7172,"name":"items","nodeType":"Function","startLoc":42,"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())"},{"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":278,"header":"def traverse(self, order='inorder')","id":7173,"name":"traverse","nodeType":"Function","startLoc":259,"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(\"Invalid traversal method: \\\"{0}\\\"\".format(order))"},{"col":4,"comment":"null","endLoc":308,"header":"def _preorder(self, node, lst)","id":7174,"name":"_preorder","nodeType":"Function","startLoc":302,"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":316,"header":"def _inorder(self, node, lst)","id":7175,"name":"_inorder","nodeType":"Function","startLoc":310,"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":324,"header":"def _postorder(self, node, lst)","id":7176,"name":"_postorder","nodeType":"Function","startLoc":318,"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":242,"header":"def shift_right(self, row)","id":7177,"name":"shift_right","nodeType":"Function","startLoc":237,"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":"\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":398,"header":"def filter(self, func)","id":7178,"name":"filter","nodeType":"Function","startLoc":363,"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]"},{"col":4,"comment":"\n        Return BST items in order as (key, data) pairs.\n        ","endLoc":284,"header":"def items(self)","id":7179,"name":"items","nodeType":"Function","startLoc":280,"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()]"},{"col":4,"comment":"null","endLoc":402,"header":"@property\n    def keys(self)","id":7180,"name":"keys","nodeType":"Function","startLoc":400,"text":"@property\n    def keys(self):\n        return self._keys"},{"attributeType":"null","col":8,"comment":"null","endLoc":305,"id":7181,"name":"parent_table","nodeType":"Attribute","startLoc":305,"text":"self.parent_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":306,"id":7182,"name":"_indices","nodeType":"Attribute","startLoc":306,"text":"self._indices"},{"className":"YamlParseError","col":0,"comment":"null","endLoc":295,"id":7183,"nodeType":"Class","startLoc":294,"text":"class YamlParseError(Exception):\n    pass"},{"col":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":294,"header":"def sort(self)","id":7184,"name":"sort","nodeType":"Function","startLoc":286,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":307,"id":7185,"name":"_keys","nodeType":"Attribute","startLoc":307,"text":"self._keys"},{"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":101,"header":"def _construct_odict(load, node)","id":7186,"name":"_construct_odict","nodeType":"Function","startLoc":50,"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    import yaml\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            \"expected a sequence, but found {}\".format(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                \"expected a mapping of length 1, but found {}\".format(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                \"expected a single mapping item, but found {} items\".format(len(subnode.value)),\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"},{"className":"ColumnGroups","col":0,"comment":"null","endLoc":300,"id":7187,"nodeType":"Class","startLoc":211,"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:\n            raise TypeError(\"Cannot aggregate column '{0}' with type '{1}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype))\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]"},{"col":4,"comment":"null","endLoc":227,"header":"@property\n    def indices(self)","id":7188,"name":"indices","nodeType":"Function","startLoc":218,"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"},{"col":4,"comment":"null","endLoc":235,"header":"@property\n    def keys(self)","id":7189,"name":"keys","nodeType":"Function","startLoc":229,"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":267,"header":"def aggregate(self, func)","id":7190,"name":"aggregate","nodeType":"Function","startLoc":237,"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:\n            raise TypeError(\"Cannot aggregate column '{0}' with type '{1}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype))\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"},{"col":4,"comment":"\n        Return BST rows sorted by key values.\n        ","endLoc":300,"header":"def sorted_data(self)","id":7191,"name":"sorted_data","nodeType":"Function","startLoc":296,"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":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":220,"header":"def setdiff(table1, table2, keys=None)","id":7192,"name":"setdiff","nodeType":"Function","startLoc":129,"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 is masked then that means some rows were in table1 but not table2.\n    if t12.masked:\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":"null","endLoc":330,"header":"def _substitute(self, node, parent, new_node)","id":7193,"name":"_substitute","nodeType":"Function","startLoc":326,"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":374,"header":"def remove(self, key, data=None)","id":7194,"name":"remove","nodeType":"Function","startLoc":332,"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"},{"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 : List of Table objects\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, 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 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":357,"header":"def hstack(tables, join_type='outer',\n           uniq_col_name='{col_name}_{table_name}', table_names=None,\n           metadata_conflicts='warn')","id":7195,"name":"hstack","nodeType":"Function","startLoc":289,"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 : List of Table objects\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, 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 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    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        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":300,"header":"def filter(self, func)","id":7196,"name":"filter","nodeType":"Function","startLoc":269,"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]"},{"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":963,"header":"def _hstack(arrays, join_type='outer', uniq_col_name='{col_name}_{table_name}',\n           table_names=None, col_name_map=None)","id":7197,"name":"_hstack","nodeType":"Function","startLoc":868,"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    # Input validation\n    if join_type not in ('inner', 'exact', 'outer'):\n        raise ValueError(\"join_type arg must be either 'inner', 'exact' or 'outer'\")\n\n    if table_names is None:\n        table_names = ['{0}'.format(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    masked = any(getattr(arr, 'masked', False) for arr in arrays) or len(set(arr_lens)) > 1\n\n    n_rows = max(arr_lens)\n    out = _get_out_class(arrays)(masked=masked)\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                out[out_name] = array[name][indices]\n                try:\n                    out[out_name].mask[arr_len:] = True\n                except ValueError:\n                    raise NotImplementedError(\n                        \"hstack requires masking column '{}' but column\"\n                        \" type {} does not support masking\"\n                        .format(out_name, out[out_name].__class__.__name__))\n            else:\n                out[out_name] = array[name][:n_rows]\n\n    # If col_name_map supplied as a dict input, then update.\n    if isinstance(_col_name_map, collections.Mapping):\n        _col_name_map.update(col_name_map)\n\n    return out"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":7198,"name":"parent_column","nodeType":"Attribute","startLoc":213,"text":"self.parent_column"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":7199,"name":"parent_table","nodeType":"Attribute","startLoc":214,"text":"self.parent_table"},{"attributeType":"null","col":8,"comment":"null","endLoc":215,"id":7200,"name":"_indices","nodeType":"Attribute","startLoc":215,"text":"self._indices"},{"attributeType":"null","col":8,"comment":"null","endLoc":216,"id":7201,"name":"_keys","nodeType":"Attribute","startLoc":216,"text":"self._keys"},{"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":181,"id":7202,"nodeType":"Class","startLoc":65,"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 self.values()[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return 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):\n        if item in self:\n            raise ValueError(\"Cannot replace column '{0}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)\n\n    def __repr__(self):\n        names = (\"'{0}'\".format(x) for x in self.keys())\n        return \"<{1} names=({0})>\".format(\",\".join(names), self.__class__.__name__)\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(\"Column {0} already exists\".format(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    # Define keys and values for Python 2 and 3 source compatibility\n    def keys(self):\n        return list(OrderedDict.keys(self))\n\n    def values(self):\n        return list(OrderedDict.values(self))\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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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":93,"header":"def __init__(self, cols={})","id":7203,"name":"__init__","nodeType":"Function","startLoc":82,"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":117,"header":"def __getitem__(self, item)","id":7204,"name":"__getitem__","nodeType":"Function","startLoc":95,"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 self.values()[item]\n        elif (isinstance(item, np.ndarray) and item.shape == () and item.dtype.kind == 'i'):\n            return 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":"\n        Returns whether this is a valid BST.\n        ","endLoc":380,"header":"def is_valid(self)","id":7205,"name":"is_valid","nodeType":"Function","startLoc":376,"text":"def is_valid(self):\n        '''\n        Returns whether this is a valid BST.\n        '''\n        return self._is_valid(self.root)"},{"col":4,"comment":"null","endLoc":147,"header":"def values(self)","id":7206,"name":"values","nodeType":"Function","startLoc":146,"text":"def values(self):\n        return list(OrderedDict.values(self))"},{"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":130,"header":"def _repr_pairs(dump, tag, sequence, flow_style=None)","id":7207,"name":"_repr_pairs","nodeType":"Function","startLoc":104,"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    import yaml\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"},{"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":165,"id":7208,"nodeType":"Class","startLoc":9,"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        self._table = table\n        self._index = index\n\n        n = len(table)\n        if index < -n or index >= n:\n            raise IndexError('index {0} out of range for table with length {1}'\n                             .format(index, len(table)))\n\n    def __getitem__(self, item):\n        return self._table.columns[item][self._index]\n\n    def __setitem__(self, item, val):\n        self._table.columns[item][self._index] = val\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    @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 : np.void (unmasked) or np.ma.mvoid (masked)\n            Copy of row values\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            # The logic here is a little complicated to work around\n            # bug in numpy < 1.8 (numpy/numpy#483).  Need to build up\n            # a np.ma.mvoid object by hand.\n            from .table import descr\n\n            # Make np.void version of masks.  Use the table dtype but\n            # substitute bool for data type\n            masks = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                          for col in cols)\n            descrs = (descr(col) for col in cols)\n            mask_dtypes = [(name, bool, shape) for name, type_, shape in descrs]\n            row_mask = np.array([masks], dtype=mask_dtypes)[0]\n\n            # Make np.void version of values, and then the final mvoid row\n            row_vals = np.array([vals], dtype=self.dtype)[0]\n            void_row = np.ma.mvoid(data=row_vals, mask=row_mask)\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                      'index={0}'.format(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='table{0}'.format(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')"},{"col":4,"comment":"null","endLoc":123,"header":"def __setitem__(self, item, value)","id":7209,"name":"__setitem__","nodeType":"Function","startLoc":119,"text":"def __setitem__(self, item, value):\n        if item in self:\n            raise ValueError(\"Cannot replace column '{0}'.  Use Table.replace_column() instead.\"\n                             .format(item))\n        super().__setitem__(item, value)"},{"col":4,"comment":"null","endLoc":127,"header":"def __repr__(self)","id":7210,"name":"__repr__","nodeType":"Function","startLoc":125,"text":"def __repr__(self):\n        names = (\"'{0}'\".format(x) for x in self.keys())\n        return \"<{1} names=({0})>\".format(\",\".join(names), self.__class__.__name__)"},{"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":146,"header":"def _repr_odict(dumper, data)","id":7211,"name":"_repr_odict","nodeType":"Function","startLoc":133,"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, u'tag:yaml.org,2002:omap', data.items())"},{"col":4,"comment":"null","endLoc":144,"header":"def keys(self)","id":7212,"name":"keys","nodeType":"Function","startLoc":143,"text":"def keys(self):\n        return list(OrderedDict.keys(self))"},{"col":4,"comment":"null","endLoc":38,"header":"def __init__(self, table, index)","id":7213,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self, table, index):\n        self._table = table\n        self._index = index\n\n        n = len(table)\n        if index < -n or index >= n:\n            raise IndexError('index {0} out of range for table with length {1}'\n                             .format(index, len(table)))"},{"col":4,"comment":"null","endLoc":140,"header":"def _rename_column(self, name, new_name)","id":7214,"name":"_rename_column","nodeType":"Function","startLoc":129,"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(\"Column {0} already exists\".format(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)))"},{"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":157,"header":"def _repr_column_dict(dumper, data)","id":7215,"name":"_repr_column_dict","nodeType":"Function","startLoc":149,"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(u'tag:yaml.org,2002:map', data)"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7216,"name":"__all__","nodeType":"Attribute","startLoc":6,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"meta.py#<anonymous>","id":7217,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['get_header_from_yaml', 'get_yaml_from_header', 'get_yaml_from_table']"},{"fileName":"groups.py","filePath":"astropy/table","id":7218,"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\n\nfrom ..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    # 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('Table does not have key column {0!r}'.format(name))\n            if table.masked and np.any(table[name].mask):\n                raise ValueError('Missing values in key column {0!r} are not allowed'.format(name))\n\n        keys = tuple(keys)\n        table_keys = table[keys]\n        grouped_by_table_cols = True  # Grouping keys are columns from the table being grouped\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 {0} does not match table length {1}'\n                             .format(len(table_keys), len(table)))\n        grouped_by_table_cols = False  # Grouping key(s) are external\n\n    else:\n        raise TypeError('Keys input must be string, list, tuple or numpy array, but got {0}'\n                        .format(type(keys)))\n\n    try:\n        # take advantage of index internal sort if possible\n        table_index = get_index(table, table_keys) if \\\n                      isinstance(table_keys, Table) else None\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    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\n    if isinstance(keys, Table):\n        keys = keys.as_array()\n\n    if not isinstance(keys, np.ndarray):\n        raise TypeError('Keys input must be numpy array, but got {0}'\n                        .format(type(keys)))\n\n    if len(keys) != len(column):\n        raise ValueError('Input keys array length {0} does not match column length {1}'\n                         .format(len(keys), len(column)))\n\n    # take advantage of table or column indices, if possible\n    index = None\n    if isinstance(keys, Table):\n        index = get_index(keys)\n    elif hasattr(keys, 'indices') and keys.indices:\n        index = keys.indices[0]\n\n    if index is not None:\n        idx_sort = index.sorted_data()\n    else:\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:\n                raise TypeError('Index item for groups attribute must be a slice, '\n                                'numpy mask or int array')\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 '<{0} indices={1}>'.format(self.__class__.__name__, 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:\n            raise TypeError(\"Cannot aggregate column '{0}' with type '{1}'\"\n                            .format(par_col.info.name,\n                                    par_col.info.dtype))\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, i1s = self.indices[:-1], 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"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7219,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"groups.py#<anonymous>","id":7220,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['TableGroups', 'ColumnGroups']"},{"fileName":"np_utils.py","filePath":"astropy/table","id":7221,"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\nfrom itertools import chain\nimport collections\nfrom collections import OrderedDict, Counter\n\nimport numpy as np\nimport numpy.ma as ma\n\nfrom . import _np_utils\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: {0}.  '\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 '{0}' columns have incompatible types: {1}\"\n                                  .format(names[0], tme._incompat_types))\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 {0!r} have different shape'.format(name))\n        shape = uniq_shapes.pop()\n\n        out_descrs.append((fix_column_name(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('Columns have incompatible types {0}'\n                              .format(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, collections.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\n\ndef fix_column_name(val):\n    \"\"\"\n    Fixes column names so that they are compatible with Numpy on\n    Python 2.  Raises a ValueError exception if the column name\n    contains Unicode characters, which can not reasonably be used as a\n    column name.\n    \"\"\"\n    if val is not None:\n        try:\n            val = str(val)\n        except UnicodeEncodeError:\n            raise\n\n    return val\n\n\ndef recarray_fromrecords(rec_list):\n    \"\"\"\n    Partial replacement for `~numpy.core.records.fromrecords` which includes\n    a workaround for the bug with unicode arrays described at:\n    https://github.com/astropy/astropy/issues/3052\n\n    This should not serve as a full replacement for the original function;\n    this only does enough to fulfill the needs of the table module.\n    \"\"\"\n\n    # Note: This is just copying what Numpy does for converting arbitrary rows\n    # to column arrays in the recarray module; it could be there is a better\n    # way\n    nfields = len(rec_list[0])\n    obj = np.array(rec_list, dtype=object)\n    array_list = [np.array(obj[..., i].tolist()) for i in range(nfields)]\n    formats = []\n    for obj in array_list:\n        formats.append(obj.dtype.str)\n    formats = ','.join(formats)\n    return np.rec.fromarrays(array_list, formats=formats)\n"},{"col":0,"comment":"\n    Returns the unique rows of a table.\n\n    Parameters\n    ----------\n\n    input_table : `~astropy.table.Table` object or a value that\n        will initialize a `~astropy.table.Table` object\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 : one of 'first', 'last' or '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 : boolean\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":488,"header":"def unique(input_table, keys=None, silent=False, keep='first')","id":7222,"name":"unique","nodeType":"Function","startLoc":360,"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\n    input_table : `~astropy.table.Table` object or a value that\n        will initialize a `~astropy.table.Table` object\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 : one of 'first', 'last' or '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 : boolean\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    if input_table.masked:\n        nkeys = 0\n        for key in keys[:]:\n            if np.any(input_table[key].mask):\n                if not silent:\n                    raise ValueError(\n                        \"cannot use columns with masked values as keys; \"\n                        \"remove column '{0}' 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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\n            List of Column objects which are instances of given classes.\n        ","endLoc":164,"header":"def isinstance(self, cls)","id":7223,"name":"isinstance","nodeType":"Function","startLoc":149,"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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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":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":77,"header":"def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}',\n                     table_names=None)","id":7224,"name":"get_col_name_map","nodeType":"Function","startLoc":24,"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: {0}.  '\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":39,"id":7225,"nodeType":"Lambda","startLoc":39,"text":"lambda: [None] * len(arrays)"},{"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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\n            List of Column objects which are not instances of given classes.\n        ","endLoc":181,"header":"def not_isinstance(self, cls)","id":7226,"name":"not_isinstance","nodeType":"Function","startLoc":166,"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 of classes\n            Column class (including mixin) or tuple of Column classes.\n\n        Returns\n        -------\n        col_list : list of Columns\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":41,"header":"def __getitem__(self, item)","id":7227,"name":"__getitem__","nodeType":"Function","startLoc":40,"text":"def __getitem__(self, item):\n        return self._table.columns[item][self._index]"},{"col":4,"comment":"null","endLoc":44,"header":"def __setitem__(self, item, val)","id":7228,"name":"__setitem__","nodeType":"Function","startLoc":43,"text":"def __setitem__(self, item, val):\n        self._table.columns[item][self._index] = val"},{"col":4,"comment":"null","endLoc":52,"header":"def __eq__(self, other)","id":7229,"name":"__eq__","nodeType":"Function","startLoc":46,"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 : np.void (unmasked) or np.ma.mvoid (masked)\n            Copy of row values\n        ","endLoc":122,"header":"def as_void(self)","id":7230,"name":"as_void","nodeType":"Function","startLoc":88,"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 : np.void (unmasked) or np.ma.mvoid (masked)\n            Copy of row values\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            # The logic here is a little complicated to work around\n            # bug in numpy < 1.8 (numpy/numpy#483).  Need to build up\n            # a np.ma.mvoid object by hand.\n            from .table import descr\n\n            # Make np.void version of masks.  Use the table dtype but\n            # substitute bool for data type\n            masks = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                          for col in cols)\n            descrs = (descr(col) for col in cols)\n            mask_dtypes = [(name, bool, shape) for name, type_, shape in descrs]\n            row_mask = np.array([masks], dtype=mask_dtypes)[0]\n\n            # Make np.void version of values, and then the final mvoid row\n            row_vals = np.array([vals], dtype=self.dtype)[0]\n            void_row = np.ma.mvoid(data=row_vals, mask=row_mask)\n        else:\n            void_row = np.array([vals], dtype=self.dtype)[0]\n        return void_row"},{"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 ndarray().\n    ","endLoc":2830,"id":7231,"nodeType":"Class","startLoc":2789,"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 ndarray().\n    \"\"\"\n    info = ParentDtypeInfo()\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 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 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":387,"header":"def _is_valid(self, node)","id":7232,"name":"_is_valid","nodeType":"Function","startLoc":382,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":7233,"name":"__all__","nodeType":"Attribute","startLoc":26,"text":"__all__"},{"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 : 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":406,"header":"def range(self, lower, upper, bounds=(True, True))","id":7234,"name":"range","nodeType":"Function","startLoc":389,"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 : 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        nodes = self.range_nodes(lower, upper, bounds)\n        return [x for node in nodes for x in node.data]"},{"col":0,"comment":"","endLoc":8,"header":"operations.py#<anonymous>","id":7235,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nHigh-level table operations:\n\n- join()\n- setdiff()\n- hstack()\n- vstack()\n\"\"\"\n\n__all__ = ['join', 'setdiff', 'hstack', 'vstack', 'unique']"},{"col":4,"comment":"null","endLoc":2801,"header":"def __new__(cls, obj, *args, **kwargs)","id":7236,"name":"__new__","nodeType":"Function","startLoc":2797,"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":4,"comment":"null","endLoc":2814,"header":"def __array_finalize__(self, obj)","id":7237,"name":"__array_finalize__","nodeType":"Function","startLoc":2803,"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 __ne__(self, other)","id":7238,"name":"__ne__","nodeType":"Function","startLoc":54,"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"},{"fileName":"table_helpers.py","filePath":"astropy/table","id":7239,"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 ..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 ..utils.data import get_pkg_data_filename\n    from ..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 ArrayWrapper:\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 (\"<{0} name='{1}' data={2}>\"\n                .format(self.__class__.__name__, self.info.name, self.data))\n"},{"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":114,"header":"def get_descrs(arrays, col_name_map)","id":7240,"name":"get_descrs","nodeType":"Function","startLoc":80,"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 '{0}' columns have incompatible types: {1}\"\n                                  .format(names[0], tme._incompat_types))\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 {0!r} have different shape'.format(name))\n        shape = uniq_shapes.pop()\n\n        out_descrs.append((fix_column_name(out_name), dtype, shape))\n\n    return out_descrs"},{"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":70,"header":"def __array__(self, dtype=None)","id":7241,"name":"__array__","nodeType":"Function","startLoc":59,"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":2822,"header":"def __reduce__(self)","id":7242,"name":"__reduce__","nodeType":"Function","startLoc":2816,"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":4,"comment":"null","endLoc":2830,"header":"def __setstate__(self, state)","id":7243,"name":"__setstate__","nodeType":"Function","startLoc":2824,"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)"},{"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":7244,"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":7245,"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"},{"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":144,"header":"def common_dtype(cols)","id":7246,"name":"common_dtype","nodeType":"Function","startLoc":117,"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('Columns have incompatible types {0}'\n                              .format(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":4,"comment":"\n        Return nodes in the given range.\n        ","endLoc":417,"header":"def range_nodes(self, lower, upper, bounds=(True, True))","id":7247,"name":"range_nodes","nodeType":"Function","startLoc":408,"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":436,"header":"def _range(self, lower, upper, op1, op2, node, lst)","id":7248,"name":"_range","nodeType":"Function","startLoc":429,"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        Assuming the given value has smaller length than keys, return\n        nodes whose keys have this value as a prefix.\n        ","endLoc":427,"header":"def same_prefix(self, val)","id":7249,"name":"same_prefix","nodeType":"Function","startLoc":419,"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]"},{"col":0,"comment":"null","endLoc":156,"header":"def _check_for_sequence_of_structured_arrays(arrays)","id":7250,"name":"_check_for_sequence_of_structured_arrays","nodeType":"Function","startLoc":147,"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, collections.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')"},{"col":4,"comment":"null","endLoc":73,"header":"def __len__(self)","id":7251,"name":"__len__","nodeType":"Function","startLoc":72,"text":"def __len__(self):\n        return len(self._table.columns)"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":7252,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"np_utils.py#<anonymous>","id":7253,"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":"sorted_array.py","filePath":"astropy/table","id":7254,"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 (defaults to False)\n        Whether the values of the index must be unique\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 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('Cannot add duplicate value \"{0}\" in a '\n                             'unique index'.format(key))\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 and\n                                         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 : 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        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 str(t)\n\n    def __str__(self):\n        return repr(self)\n"},{"fileName":"row.py","filePath":"astropy/table","id":7255,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport collections\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        self._table = table\n        self._index = index\n\n        n = len(table)\n        if index < -n or index >= n:\n            raise IndexError('index {0} out of range for table with length {1}'\n                             .format(index, len(table)))\n\n    def __getitem__(self, item):\n        return self._table.columns[item][self._index]\n\n    def __setitem__(self, item, val):\n        self._table.columns[item][self._index] = val\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    @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 : np.void (unmasked) or np.ma.mvoid (masked)\n            Copy of row values\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            # The logic here is a little complicated to work around\n            # bug in numpy < 1.8 (numpy/numpy#483).  Need to build up\n            # a np.ma.mvoid object by hand.\n            from .table import descr\n\n            # Make np.void version of masks.  Use the table dtype but\n            # substitute bool for data type\n            masks = tuple(col.mask[index] if hasattr(col, 'mask') else False\n                          for col in cols)\n            descrs = (descr(col) for col in cols)\n            mask_dtypes = [(name, bool, shape) for name, type_, shape in descrs]\n            row_mask = np.array([masks], dtype=mask_dtypes)[0]\n\n            # Make np.void version of values, and then the final mvoid row\n            row_vals = np.array([vals], dtype=self.dtype)[0]\n            void_row = np.ma.mvoid(data=row_vals, mask=row_mask)\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                      'index={0}'.format(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='table{0}'.format(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.Sequence.register(Row)\n"},{"col":0,"comment":"","endLoc":4,"header":"row.py#<anonymous>","id":7256,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"collections.Sequence.register(Row)"},{"col":4,"comment":"null","endLoc":78,"header":"def __iter__(self)","id":7257,"name":"__iter__","nodeType":"Function","startLoc":75,"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":446,"header":"def _same_prefix(self, val, node, lst)","id":7258,"name":"_same_prefix","nodeType":"Function","startLoc":438,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":2795,"id":7259,"name":"info","nodeType":"Attribute","startLoc":2795,"text":"info"},{"col":4,"comment":"null","endLoc":82,"header":"@property\n    def table(self)","id":7260,"name":"table","nodeType":"Function","startLoc":80,"text":"@property\n    def table(self):\n        return self._table"},{"col":4,"comment":"null","endLoc":86,"header":"@property\n    def index(self)","id":7261,"name":"index","nodeType":"Function","startLoc":84,"text":"@property\n    def index(self):\n        return self._index"},{"col":4,"comment":"null","endLoc":126,"header":"@property\n    def meta(self)","id":7262,"name":"meta","nodeType":"Function","startLoc":124,"text":"@property\n    def meta(self):\n        return self._table.meta"},{"col":4,"comment":"null","endLoc":130,"header":"@property\n    def columns(self)","id":7263,"name":"columns","nodeType":"Function","startLoc":128,"text":"@property\n    def columns(self):\n        return self._table.columns"},{"col":4,"comment":"null","endLoc":134,"header":"@property\n    def colnames(self)","id":7264,"name":"colnames","nodeType":"Function","startLoc":132,"text":"@property\n    def colnames(self):\n        return self._table.colnames"},{"col":4,"comment":"null","endLoc":138,"header":"@property\n    def dtype(self)","id":7265,"name":"dtype","nodeType":"Function","startLoc":136,"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":152,"header":"def _base_repr_(self, html=False)","id":7266,"name":"_base_repr_","nodeType":"Function","startLoc":140,"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                      'index={0}'.format(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='table{0}'.format(id(self._table)))"},{"col":4,"comment":"null","endLoc":451,"header":"def __str__(self)","id":7267,"name":"__str__","nodeType":"Function","startLoc":448,"text":"def __str__(self):\n        if self.root is None:\n            return 'Empty'\n        return self._print(self.root, 0)"},{"col":4,"comment":"null","endLoc":155,"header":"def _repr_html_(self)","id":7268,"name":"_repr_html_","nodeType":"Function","startLoc":154,"text":"def _repr_html_(self):\n        return self._base_repr_(html=True)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2798,"id":7269,"name":"self","nodeType":"Attribute","startLoc":2798,"text":"self"},{"col":4,"comment":"null","endLoc":158,"header":"def __repr__(self)","id":7270,"name":"__repr__","nodeType":"Function","startLoc":157,"text":"def __repr__(self):\n        return self._base_repr_(html=False)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2800,"id":7271,"name":"info","nodeType":"Attribute","startLoc":2800,"text":"self.info"},{"col":4,"comment":"null","endLoc":162,"header":"def __str__(self)","id":7272,"name":"__str__","nodeType":"Function","startLoc":160,"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":165,"header":"def __bytes__(self)","id":7273,"name":"__bytes__","nodeType":"Function","startLoc":164,"text":"def __bytes__(self):\n        return str(self).encode('utf-8')"},{"attributeType":"null","col":8,"comment":"null","endLoc":32,"id":7274,"name":"_table","nodeType":"Attribute","startLoc":32,"text":"self._table"},{"attributeType":"null","col":8,"comment":"null","endLoc":33,"id":7275,"name":"_index","nodeType":"Attribute","startLoc":33,"text":"self._index"},{"id":7276,"name":"astropy/table/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/table/tests","id":7277,"nodeType":"File","text":""},{"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":47,"id":7278,"nodeType":"Class","startLoc":39,"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":"_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":723,"id":7279,"nodeType":"Class","startLoc":631,"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                             \"'{0}'\".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 = '_{0}WithIndexCopy'.format(cls.__name__)\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":680,"header":"def __enter__(self)","id":7280,"name":"__enter__","nodeType":"Function","startLoc":671,"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"},{"className":"FastBST","col":4,"comment":"null","endLoc":671,"id":7281,"nodeType":"Class","startLoc":670,"text":"class FastBST(FastBase):\n        engine = FastBinaryTree"},{"className":"FastBase","col":0,"comment":"\n    A fast binary search tree implementation for indexing,\n    using the bintrees library.\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 (defaults to False)\n        Whether the values of the index must be unique\n    ","endLoc":663,"id":7282,"nodeType":"Class","startLoc":492,"text":"class FastBase:\n    '''\n    A fast binary search tree implementation for indexing,\n    using the bintrees library.\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 (defaults to False)\n        Whether the values of the index must be unique\n    '''\n\n    def __init__(self, data, row_index, unique=False):\n        self.data = self.engine()\n        self.unique = unique\n\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)\n\n    def add(self, key, val):\n        '''\n        Add a key, value pair.\n        '''\n        if self.unique:\n            if key in self.data:\n                # already exists\n                raise ValueError('Cannot add duplicate value \"{0}\" in a '\n                                 'unique index'.format(key))\n            self.data[key] = val\n        else:\n            rows = self.data.set_default(key, [])\n            rows.insert(np.searchsorted(rows, val), val)\n\n    def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        rows = self.data.get(key, [])\n        if self.unique:\n            # only one row\n            rows = [rows]\n        return rows\n\n    def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if self.unique:\n            try:\n                self.data.pop(key)\n            except KeyError:\n                return False\n        else:\n            node = self.data.get(key, None)\n            if node is None or len(node) == 0:\n                return False\n            if data is None:\n                self.data.pop(key)\n                return True\n            if data not in node:\n                if len(node) == 0:\n                    return False\n                raise ValueError(\"Data does not belong to correct node\")\n            node.remove(data)\n        return True\n\n    def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x > row:\n                    self.data[key] = x - 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x - 1 if x > row else x for x in node]\n\n    def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x >= row:\n                    self.data[key] = x + 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x + 1 if x >= row else x for x in node]\n\n    def traverse(self):\n        '''\n        Return all nodes in this BST.\n        '''\n        l = []\n        for key, data in self.data.items():\n            n = Node(key, key)\n            n.data = data\n            l.append(n)\n        return l\n\n    def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        if self.unique:\n            return self.data.items()\n        return [x for x in self.data.items() if len(x[1]) > 0]\n\n    def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        if self.unique:\n            for i, (key, row) in enumerate(self.data.items()):\n                self.data[key] = i\n        else:\n            i = 0\n            for key, rows in self.data.items():\n                num_rows = len(rows)\n                self.data[key] = [x for x in range(i, i + num_rows)]\n                i += num_rows\n\n    def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        if self.unique:\n            return [x for x in self.data.values()]\n        return [x for node in self.data.values() for x in node]\n\n    def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        # we need Epsilon since bintrees searches for\n        # lower <= key < upper, while we might want lower <= key <= upper\n        # or similar\n        if not bounds[0]:  # lower < key\n            lower = Epsilon(lower)\n        if bounds[1]:  # key <= upper\n            upper = Epsilon(upper)\n        l = [v for v in self.data.value_slice(lower, upper)]\n        if self.unique:\n            return l\n        return [x for sublist in l for x in sublist]\n\n    def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        if self.unique:\n            del_keys = []\n            for key, data in self.data.items():\n                if data in row_map:\n                    self.data[key] = row_map[data]\n                else:\n                    del_keys.append(key)\n            for key in del_keys:\n                self.data.pop(key)\n        else:\n            for data in self.data.values():\n                data[:] = [row_map[x] for x in data if x in row_map]\n\n    def __str__(self):\n        return str(self.data)\n\n    def __repr__(self):\n        return str(self)"},{"fileName":"conftest.py","filePath":"astropy/table/tests","id":7283,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nAll of the py.test fixtures used by astropy.table are defined here.\n\nThe fixtures can not be defined in the modules that use them, because\nthose modules are imported twice: once with `from __future__ import\nunicode_literals` and once without.  py.test complains when the same\nfixtures are defined more than once.\n\n`conftest.py` is a \"special\" module name for py.test 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 ... import table\nfrom ...table import table_helpers, Table, QTable\nfrom ... import time\nfrom ... import units as u\nfrom ... import coordinates\nfrom .. 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    try:\n        request.param\n        return MaskedTable\n    except AttributeError:\n        return 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              'skycoord': coordinates.SkyCoord(ra=[0, 1, 2, 3] * u.deg,\n                                               dec=[0, 1, 2, 3] * u.deg),\n              'arraywrap': table_helpers.ArrayWrapper([0, 1, 2, 3]),\n              'ndarray': 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'])\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"},{"col":4,"comment":"null","endLoc":512,"header":"def __init__(self, data, row_index, unique=False)","id":7284,"name":"__init__","nodeType":"Function","startLoc":507,"text":"def __init__(self, data, row_index, unique=False):\n        self.data = self.engine()\n        self.unique = unique\n\n        for key, row in zip(data, row_index):\n            self.add(tuple(key), row)"},{"col":4,"comment":"null","endLoc":462,"header":"def _print(self, node, level)","id":7285,"name":"_print","nodeType":"Function","startLoc":456,"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":"\n        Add a key, value pair.\n        ","endLoc":526,"header":"def add(self, key, val)","id":7286,"name":"add","nodeType":"Function","startLoc":514,"text":"def add(self, key, val):\n        '''\n        Add a key, value pair.\n        '''\n        if self.unique:\n            if key in self.data:\n                # already exists\n                raise ValueError('Cannot add duplicate value \"{0}\" in a '\n                                 'unique index'.format(key))\n            self.data[key] = val\n        else:\n            rows = self.data.set_default(key, [])\n            rows.insert(np.searchsorted(rows, val), val)"},{"col":4,"comment":"null","endLoc":454,"header":"def __repr__(self)","id":7287,"name":"__repr__","nodeType":"Function","startLoc":453,"text":"def __repr__(self):\n        return str(self)"},{"col":4,"comment":"\n        Return the BST height.\n        ","endLoc":469,"header":"@property\n    def height(self)","id":7288,"name":"height","nodeType":"Function","startLoc":464,"text":"@property\n    def height(self):\n        '''\n        Return the BST height.\n        '''\n        return self._height(self.root)"},{"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":723,"header":"def _get_copy_on_getitem_shim(self, cls)","id":7289,"name":"_get_copy_on_getitem_shim","nodeType":"Function","startLoc":693,"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 = '_{0}WithIndexCopy'.format(cls.__name__)\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":475,"header":"def _height(self, node)","id":7290,"name":"_height","nodeType":"Function","startLoc":471,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":7291,"name":"extra_row","nodeType":"Attribute","startLoc":37,"text":"self.extra_row"},{"col":4,"comment":"null","endLoc":691,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":7292,"name":"__exit__","nodeType":"Function","startLoc":682,"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":8,"comment":"null","endLoc":53,"id":7293,"name":"bool_mask","nodeType":"Attribute","startLoc":53,"text":"self.bool_mask"},{"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":489,"header":"def replace_rows(self, row_map)","id":7294,"name":"replace_rows","nodeType":"Function","startLoc":477,"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]"},{"col":4,"comment":"\n        Find rows corresponding to the given key.\n        ","endLoc":536,"header":"def find(self, key)","id":7295,"name":"find","nodeType":"Function","startLoc":528,"text":"def find(self, key):\n        '''\n        Find rows corresponding to the given key.\n        '''\n        rows = self.data.get(key, [])\n        if self.unique:\n            # only one row\n            rows = [rows]\n        return rows"},{"className":"MaskedTable","col":0,"comment":"null","endLoc":43,"id":7296,"nodeType":"Class","startLoc":40,"text":"class MaskedTable(table.Table):\n    def __init__(self, *args, **kwargs):\n        kwargs['masked'] = True\n        table.Table.__init__(self, *args, **kwargs)"},{"attributeType":"null","col":8,"comment":"null","endLoc":24,"id":7297,"name":"masked","nodeType":"Attribute","startLoc":24,"text":"self.masked"},{"attributeType":"null","col":4,"comment":"null","endLoc":641,"id":7298,"name":"_col_subclasses","nodeType":"Attribute","startLoc":641,"text":"_col_subclasses"},{"attributeType":"null","col":8,"comment":"null","endLoc":663,"id":7299,"name":"mode","nodeType":"Attribute","startLoc":663,"text":"self.mode"},{"attributeType":"null","col":8,"comment":"null","endLoc":665,"id":7300,"name":"_orig_classes","nodeType":"Attribute","startLoc":665,"text":"self._orig_classes"},{"attributeType":"null","col":8,"comment":"null","endLoc":662,"id":7301,"name":"table","nodeType":"Attribute","startLoc":662,"text":"self.table"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":7302,"name":"conf","nodeType":"Attribute","startLoc":38,"text":"conf"},{"attributeType":"null","col":8,"comment":"null","endLoc":39,"id":7303,"name":"row_indices","nodeType":"Attribute","startLoc":39,"text":"self.row_indices"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":7304,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":33,"text":"__doctest_skip__"},{"attributeType":"Table","col":8,"comment":"null","endLoc":43,"id":7305,"name":"other_table","nodeType":"Attribute","startLoc":43,"text":"self.other_table"},{"attributeType":"Table","col":8,"comment":"null","endLoc":49,"id":7306,"name":"other_table_2","nodeType":"Attribute","startLoc":49,"text":"self.other_table_2"},{"attributeType":"Node","col":4,"comment":"null","endLoc":165,"id":7307,"name":"NodeClass","nodeType":"Attribute","startLoc":165,"text":"NodeClass"},{"col":0,"comment":"","endLoc":2,"header":"table.py#<anonymous>","id":7308,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__doctest_skip__ = ['Table.read', 'Table.write',\n                    'Table.convert_bytestring_to_unicode',\n                    'Table.convert_unicode_to_bytestring',\n                    ]"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":7309,"name":"size","nodeType":"Attribute","startLoc":169,"text":"self.size"},{"col":4,"comment":"\n        Remove data from the given key.\n        ","endLoc":559,"header":"def remove(self, key, data=None)","id":7310,"name":"remove","nodeType":"Function","startLoc":538,"text":"def remove(self, key, data=None):\n        '''\n        Remove data from the given key.\n        '''\n        if self.unique:\n            try:\n                self.data.pop(key)\n            except KeyError:\n                return False\n        else:\n            node = self.data.get(key, None)\n            if node is None or len(node) == 0:\n                return False\n            if data is None:\n                self.data.pop(key)\n                return True\n            if data not in node:\n                if len(node) == 0:\n                    return False\n                raise ValueError(\"Data does not belong to correct node\")\n            node.remove(data)\n        return True"},{"attributeType":"Table","col":8,"comment":"null","endLoc":27,"id":7311,"name":"table","nodeType":"Attribute","startLoc":27,"text":"self.table"},{"attributeType":"null","col":8,"comment":"null","endLoc":38,"id":7312,"name":"extra_column","nodeType":"Attribute","startLoc":38,"text":"self.extra_column"},{"attributeType":"Table","col":8,"comment":"null","endLoc":40,"id":7313,"name":"table_grouped","nodeType":"Attribute","startLoc":40,"text":"self.table_grouped"},{"attributeType":"None","col":8,"comment":"null","endLoc":168,"id":7314,"name":"root","nodeType":"Attribute","startLoc":168,"text":"self.root"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":7315,"name":"unique","nodeType":"Attribute","startLoc":170,"text":"self.unique"},{"className":"FastRBT","col":4,"comment":"null","endLoc":674,"id":7316,"nodeType":"Class","startLoc":673,"text":"class FastRBT(FastBase):\n        engine = FastRBTree"},{"className":"ArrayWrapper","col":0,"comment":"\n    Minimal mixin using a simple wrapper around a numpy array\n    ","endLoc":176,"id":7317,"nodeType":"Class","startLoc":140,"text":"class ArrayWrapper:\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 (\"<{0} name='{1}' data={2}>\"\n                .format(self.__class__.__name__, self.info.name, self.data))"},{"col":4,"comment":"null","endLoc":149,"header":"def __init__(self, data)","id":7318,"name":"__init__","nodeType":"Function","startLoc":146,"text":"def __init__(self, data):\n        self.data = np.array(data)\n        if 'info' in getattr(data, '__dict__', ()):\n            self.info = data.info"},{"attributeType":"null","col":8,"comment":"null","endLoc":674,"id":7319,"name":"engine","nodeType":"Attribute","startLoc":674,"text":"engine"},{"col":4,"comment":"null","endLoc":158,"header":"def __getitem__(self, item)","id":7320,"name":"__getitem__","nodeType":"Function","startLoc":151,"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"},{"col":4,"comment":"null","endLoc":43,"header":"def __init__(self, *args, **kwargs)","id":7321,"name":"__init__","nodeType":"Function","startLoc":41,"text":"def __init__(self, *args, **kwargs):\n        kwargs['masked'] = True\n        table.Table.__init__(self, *args, **kwargs)"},{"col":0,"comment":"","endLoc":2,"header":"bst.py#<anonymous>","id":7322,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"try:\n    # bintrees is an optional dependency\n    from bintrees import FastBinaryTree, FastRBTree\n\n    class FastBST(FastBase):\n        engine = FastBinaryTree\n\n    class FastRBT(FastBase):\n        engine = FastRBTree\n\nexcept ImportError:\n    FastBST = BST\n    FastRBT = BST"},{"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":211,"header":"def get_row_specifier(self, row_specifier)","id":7323,"name":"get_row_specifier","nodeType":"Function","startLoc":193,"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 {0} in remove_rows\".format(row_specifier))"},{"col":4,"comment":"null","endLoc":161,"header":"def __setitem__(self, item, value)","id":7324,"name":"__setitem__","nodeType":"Function","startLoc":160,"text":"def __setitem__(self, item, value):\n        self.data[item] = value"},{"col":4,"comment":"null","endLoc":164,"header":"def __len__(self)","id":7325,"name":"__len__","nodeType":"Function","startLoc":163,"text":"def __len__(self):\n        return len(self.data)"},{"id":7326,"name":"astropy/table/scripts","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/table/scripts","id":7327,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":168,"header":"@property\n    def dtype(self)","id":7328,"name":"dtype","nodeType":"Function","startLoc":166,"text":"@property\n    def dtype(self):\n        return self.data.dtype"},{"col":4,"comment":"null","endLoc":172,"header":"@property\n    def shape(self)","id":7329,"name":"shape","nodeType":"Function","startLoc":170,"text":"@property\n    def shape(self):\n        return self.data.shape"},{"col":4,"comment":"null","endLoc":176,"header":"def __repr__(self)","id":7330,"name":"__repr__","nodeType":"Function","startLoc":174,"text":"def __repr__(self):\n        return (\"<{0} name='{1}' data={2}>\"\n                .format(self.__class__.__name__, self.info.name, self.data))"},{"attributeType":"ParentDtypeInfo","col":4,"comment":"null","endLoc":144,"id":7331,"name":"info","nodeType":"Attribute","startLoc":144,"text":"info"},{"fileName":"showtable.py","filePath":"astropy/table/scripts","id":7332,"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"},{"id":7333,"name":"astropy/tests","nodeType":"Package"},{"fileName":"pytest_plugins.py","filePath":"astropy/tests","id":7334,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module is included only for backwards compatibility. Packages that\nwant to use these variables should now import them directly from\n`astropy.tests.plugins.display` (although eventually it may be possible to\nconfigure them within setup.cfg).\n\nTODO: This entire module should eventually be removed once backwards\ncompatibility is no longer supported.\n\"\"\"\nimport warnings\nfrom ..utils.exceptions import AstropyDeprecationWarning\n\nfrom .helper import enable_deprecations_as_exceptions\nfrom .plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\n\n\n_warning_message = \"The module `astropy.tests.pytest_plugins has been \" \\\n    \"deprecated. The variables `PYTEST_HEADER_MODULES` and `TESTED_VERSIONS`\" \\\n    \"should now be imported from `astropy.tests.plugins.display`. The function \" \\\n    \"`enable_deprecations_as_exceptions` should be imported from \" \\\n    \"`astropy.tests.helper`\"\n# Unfortunately, pytest does not display warning messages that occur within\n# conftest files, which is where these variables are imported by most packages.\nwarnings.warn(_warning_message, AstropyDeprecationWarning)\n"},{"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":232,"header":"def remove_rows(self, row_specifier)","id":7335,"name":"remove_rows","nodeType":"Function","startLoc":213,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":147,"id":7336,"name":"data","nodeType":"Attribute","startLoc":147,"text":"self.data"},{"attributeType":"null","col":12,"comment":"null","endLoc":149,"id":7337,"name":"info","nodeType":"Attribute","startLoc":149,"text":"self.info"},{"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":7338,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":7339,"name":"TESTED_VERSIONS","nodeType":"Attribute","startLoc":28,"text":"TESTED_VERSIONS"},{"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":250,"header":"def remove_row(self, row, reorder=True)","id":7340,"name":"remove_row","nodeType":"Function","startLoc":234,"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(\"Could not remove row {0} from index\".format(row))\n        # decrement the row number of all later rows\n        if reorder:\n            self.data.shift_left(row)"},{"className":"MyRow","col":0,"comment":"null","endLoc":47,"id":7341,"nodeType":"Class","startLoc":46,"text":"class MyRow(table.Row):\n    pass"},{"col":4,"comment":"\n        Decrement rows larger than the given row.\n        ","endLoc":571,"header":"def shift_left(self, row)","id":7342,"name":"shift_left","nodeType":"Function","startLoc":561,"text":"def shift_left(self, row):\n        '''\n        Decrement rows larger than the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x > row:\n                    self.data[key] = x - 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x - 1 if x > row else x for x in node]"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":7343,"name":"_warning_message","nodeType":"Attribute","startLoc":18,"text":"_warning_message"},{"className":"MyColumn","col":0,"comment":"null","endLoc":51,"id":7344,"nodeType":"Class","startLoc":50,"text":"class MyColumn(table.Column):\n    pass"},{"className":"MyMaskedColumn","col":0,"comment":"null","endLoc":55,"id":7345,"nodeType":"Class","startLoc":54,"text":"class MyMaskedColumn(table.MaskedColumn):\n    pass"},{"className":"MyTableColumns","col":0,"comment":"null","endLoc":59,"id":7346,"nodeType":"Class","startLoc":58,"text":"class MyTableColumns(table.TableColumns):\n    pass"},{"className":"MyTableFormatter","col":0,"comment":"null","endLoc":63,"id":7347,"nodeType":"Class","startLoc":62,"text":"class MyTableFormatter(pprint.TableFormatter):\n    pass"},{"className":"MyTable","col":0,"comment":"null","endLoc":71,"id":7348,"nodeType":"Class","startLoc":66,"text":"class MyTable(table.Table):\n    Row = MyRow\n    Column = MyColumn\n    MaskedColumn = MyMaskedColumn\n    TableColumns = MyTableColumns\n    TableFormatter = MyTableFormatter"},{"attributeType":"MyRow","col":4,"comment":"null","endLoc":67,"id":7349,"name":"Row","nodeType":"Attribute","startLoc":67,"text":"Row"},{"col":0,"comment":"","endLoc":10,"header":"pytest_plugins.py#<anonymous>","id":7350,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis module is included only for backwards compatibility. Packages that\nwant to use these variables should now import them directly from\n`astropy.tests.plugins.display` (although eventually it may be possible to\nconfigure them within setup.cfg).\n\nTODO: This entire module should eventually be removed once backwards\ncompatibility is no longer supported.\n\"\"\"\n\n_warning_message = \"The module `astropy.tests.pytest_plugins has been \" \\\n    \"deprecated. The variables `PYTEST_HEADER_MODULES` and `TESTED_VERSIONS`\" \\\n    \"should now be imported from `astropy.tests.plugins.display`. The function \" \\\n    \"`enable_deprecations_as_exceptions` should be imported from \" \\\n    \"`astropy.tests.helper`\"\n\nwarnings.warn(_warning_message, AstropyDeprecationWarning)"},{"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":7351,"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":"MyColumn","col":4,"comment":"null","endLoc":68,"id":7352,"name":"Column","nodeType":"Attribute","startLoc":68,"text":"Column"},{"col":4,"comment":"\n        Increment rows greater than or equal to the given row.\n        ","endLoc":583,"header":"def shift_right(self, row)","id":7353,"name":"shift_right","nodeType":"Function","startLoc":573,"text":"def shift_right(self, row):\n        '''\n        Increment rows greater than or equal to the given row.\n        '''\n        if self.unique:\n            for key, x in self.data.items():\n                if x >= row:\n                    self.data[key] = x + 1\n        else:\n            for key, node in self.data.items():\n                self.data[key] = [x + 1 if x >= row else x for x in node]"},{"attributeType":"MyMaskedColumn","col":4,"comment":"null","endLoc":69,"id":7354,"name":"MaskedColumn","nodeType":"Attribute","startLoc":69,"text":"MaskedColumn"},{"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":261,"header":"def find(self, key)","id":7355,"name":"find","nodeType":"Function","startLoc":252,"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)"},{"fileName":"helper.py","filePath":"astropy/tests","id":7356,"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\"\"\"\n\nimport os\nimport sys\nimport types\nimport pickle\nimport warnings\nimport functools\n\nimport pytest\n\ntry:\n    # Import pkg_resources to prevent it from issuing warnings upon being\n    # imported from within py.test.  See\n    # https://github.com/astropy/astropy/pull/537 for a detailed explanation.\n    import pkg_resources  # pylint: disable=W0611\nexcept ImportError:\n    pass\n\nfrom ..utils.exceptions import (AstropyDeprecationWarning,\n                                AstropyPendingDeprecationWarning)\n\n\n# For backward-compatibility with affiliated packages\nfrom .runner import TestRunner  # pylint: disable=W0611\n\n__all__ = ['raises', 'enable_deprecations_as_exceptions', 'remote_data',\n           'treat_deprecations_as_exceptions', 'catch_warnings',\n           'assert_follows_unicode_guidelines', 'quantity_allclose',\n           'assert_quantity_allclose', 'check_pickling_recovery',\n           'pickle_protocol', 'generic_recursive_equality_test']\n\n# pytest marker to mark tests which get data from the web\n# This is being maintained for backwards compatibility\nremote_data = pytest.mark.remote_data\n\n\n# distutils expects options to be Unicode strings\ndef _fix_user_options(options):\n    def to_str_or_none(x):\n        if x is None:\n            return None\n        return str(x)\n\n    return [tuple(to_str_or_none(x) for x in y) for y in options]\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 ..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\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\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_deprecations_as_exceptions = False\n_include_astropy_deprecations = True\n_modules_to_ignore_on_import = set([\n    'compiler',  # A deprecated stdlib module used by py.test\n    'scipy',\n    'pygments',\n    'ipykernel',\n    'IPython',   # deprecation warnings for async and await\n    'setuptools'])\n_warnings_to_ignore_entire_module = set([])\n_warnings_to_ignore_by_pyver = {\n    (3, 5): set([\n        # py.test reads files with the 'U' flag, which is\n        # deprecated.\n        r\"'U' mode is deprecated\",\n        # py.test raised this warning in inspect on Python 3.5.\n        # See https://github.com/pytest-dev/pytest/pull/1009\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\\(\\) instead\"]),\n    (3, 6): set([\n        # py.test reads files with the 'U' flag, which is\n        # deprecated.\n        r\"'U' mode is deprecated\",\n        # inspect raises this slightly different warning on Python 3.6.\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\n\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 deprecation warning messages to ignore. This is in\n        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\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        # We don't want to deal with six.MovedModules, only \"real\"\n        # modules.\n        if (isinstance(module, types.ModuleType) and\n                hasattr(module, '__warningregistry__')):\n            del module.__warningregistry__\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    # (py.test 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 DeprecationWarnings into exceptions\n    _all_warns = [DeprecationWarning]\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 deprecation 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    for v in _warnings_to_ignore_by_pyver:\n        if sys.version_info[:2] == v:\n            for s in _warnings_to_ignore_by_pyver[v]:\n                warnings.filterwarnings(\"ignore\", s, DeprecationWarning)\n\n\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\n    def __init__(self, *classes):\n        super(catch_warnings, self).__init__(record=True)\n        self.classes = classes\n\n    def __enter__(self):\n        warning_list = super(catch_warnings, self).__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\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(ignore_warnings, self).__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(ignore_warnings, self).__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 .. 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.__dict__\n    dict_b = b.__dict__\n    for key in dict_a:\n        assert key in dict_b,\\\n          \"Did not pickle {0}\".format(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, \"Value of {0} changed by pickling\".format(key)\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    np.testing.assert_allclose(*_unquantify_allclose_arguments(actual, desired,\n                                                               rtol, atol),\n                               **kwargs)\n\n\ndef quantity_allclose(a, b, rtol=1.e-5, atol=None, **kwargs):\n    \"\"\"\n    Returns True if two arrays are element-wise equal within a tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`.\n    \"\"\"\n    import numpy as np\n    return np.allclose(*_unquantify_allclose_arguments(a, b, rtol, atol),\n                       **kwargs)\n\n\ndef _unquantify_allclose_arguments(actual, desired, rtol, atol):\n    from .. import units as u\n\n    actual = u.Quantity(actual, subok=True, copy=False)\n\n    desired = u.Quantity(desired, subok=True, copy=False)\n    try:\n        desired = desired.to(actual.unit)\n    except u.UnitsError:\n        raise u.UnitsError(\"Units for 'desired' ({0}) and 'actual' ({1}) \"\n                           \"are not convertible\"\n                           .format(desired.unit, actual.unit))\n\n    if atol is None:\n        # by default, we assume an absolute tolerance of 0\n        atol = u.Quantity(0)\n    else:\n        atol = u.Quantity(atol, subok=True, copy=False)\n        try:\n            atol = atol.to(actual.unit)\n        except u.UnitsError:\n            raise u.UnitsError(\"Units for 'atol' ({0}) and 'actual' ({1}) \"\n                               \"are not convertible\"\n                               .format(atol.unit, actual.unit))\n\n    rtol = u.Quantity(rtol, subok=True, copy=False)\n    try:\n        rtol = rtol.to(u.dimensionless_unscaled)\n    except Exception:\n        raise u.UnitsError(\"`rtol` should be dimensionless\")\n\n    return actual.value, desired.value, rtol.value, atol.value\n"},{"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":344,"id":7357,"nodeType":"Class","startLoc":309,"text":"class 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(ignore_warnings, self).__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(ignore_warnings, self).__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":324,"header":"def __init__(self, category=None)","id":7358,"name":"__init__","nodeType":"Function","startLoc":318,"text":"def __init__(self, category=None):\n        super(ignore_warnings, self).__init__()\n\n        if isinstance(category, type) and issubclass(category, Warning):\n            self.category = [category]\n        else:\n            self.category = category"},{"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":272,"header":"def same_prefix(self, key)","id":7359,"name":"same_prefix","nodeType":"Function","startLoc":263,"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":"MyTableColumns","col":4,"comment":"null","endLoc":70,"id":7360,"name":"TableColumns","nodeType":"Attribute","startLoc":70,"text":"TableColumns"},{"col":4,"comment":"\n        Return all nodes in this BST.\n        ","endLoc":594,"header":"def traverse(self)","id":7361,"name":"traverse","nodeType":"Function","startLoc":585,"text":"def traverse(self):\n        '''\n        Return all nodes in this BST.\n        '''\n        l = []\n        for key, data in self.data.items():\n            n = Node(key, key)\n            n.data = data\n            l.append(n)\n        return l"},{"col":4,"comment":"null","endLoc":335,"header":"def __call__(self, func)","id":7362,"name":"__call__","nodeType":"Function","startLoc":326,"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"},{"attributeType":"MyTableFormatter","col":4,"comment":"null","endLoc":71,"id":7363,"name":"TableFormatter","nodeType":"Attribute","startLoc":71,"text":"TableFormatter"},{"col":4,"comment":"\n        Return a list of key, data tuples.\n        ","endLoc":602,"header":"def items(self)","id":7364,"name":"items","nodeType":"Function","startLoc":596,"text":"def items(self):\n        '''\n        Return a list of key, data tuples.\n        '''\n        if self.unique:\n            return self.data.items()\n        return [x for x in self.data.items() if len(x[1]) > 0]"},{"col":4,"comment":"\n        Make row order align with key order.\n        ","endLoc":616,"header":"def sort(self)","id":7365,"name":"sort","nodeType":"Function","startLoc":604,"text":"def sort(self):\n        '''\n        Make row order align with key order.\n        '''\n        if self.unique:\n            for i, (key, row) in enumerate(self.data.items()):\n                self.data[key] = i\n        else:\n            i = 0\n            for key, rows in self.data.items():\n                num_rows = len(rows)\n                self.data[key] = [x for x in range(i, i + num_rows)]\n                i += num_rows"},{"className":"SubclassTable","col":0,"comment":"null","endLoc":113,"id":7366,"nodeType":"Class","startLoc":112,"text":"class SubclassTable(table.Table):\n    pass"},{"col":4,"comment":"null","endLoc":344,"header":"def __enter__(self)","id":7367,"name":"__enter__","nodeType":"Function","startLoc":337,"text":"def __enter__(self):\n        retval = super(ignore_warnings, self).__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":0,"comment":"null","endLoc":37,"header":"@pytest.fixture(params=[table.Column, table.MaskedColumn])\ndef Column(request)","id":7368,"name":"Column","nodeType":"Function","startLoc":33,"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":4,"comment":"\n        Return a list of rows in order sorted by key.\n        ","endLoc":624,"header":"def sorted_data(self)","id":7369,"name":"sorted_data","nodeType":"Function","startLoc":618,"text":"def sorted_data(self):\n        '''\n        Return a list of rows in order sorted by key.\n        '''\n        if self.unique:\n            return [x for x in self.data.values()]\n        return [x for node in self.data.values() for x in node]"},{"col":0,"comment":"null","endLoc":90,"header":"@pytest.fixture(params=['unmasked', 'masked', 'subclass'])\ndef table_types(request)","id":7370,"name":"table_types","nodeType":"Function","startLoc":77,"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":4,"comment":"\n        Return row values in the given range.\n        ","endLoc":640,"header":"def range(self, lower, upper, bounds=(True, True))","id":7371,"name":"range","nodeType":"Function","startLoc":626,"text":"def range(self, lower, upper, bounds=(True, True)):\n        '''\n        Return row values in the given range.\n        '''\n        # we need Epsilon since bintrees searches for\n        # lower <= key < upper, while we might want lower <= key <= upper\n        # or similar\n        if not bounds[0]:  # lower < key\n            lower = Epsilon(lower)\n        if bounds[1]:  # key <= upper\n            upper = Epsilon(upper)\n        l = [v for v in self.data.value_slice(lower, upper)]\n        if self.unique:\n            return l\n        return [x for sublist in l for x in sublist]"},{"attributeType":"null","col":12,"comment":"null","endLoc":324,"id":7372,"name":"category","nodeType":"Attribute","startLoc":324,"text":"self.category"},{"col":4,"comment":"\n        Replace rows with the values in row_map.\n        ","endLoc":657,"header":"def replace_rows(self, row_map)","id":7373,"name":"replace_rows","nodeType":"Function","startLoc":642,"text":"def replace_rows(self, row_map):\n        '''\n        Replace rows with the values in row_map.\n        '''\n        if self.unique:\n            del_keys = []\n            for key, data in self.data.items():\n                if data in row_map:\n                    self.data[key] = row_map[data]\n                else:\n                    del_keys.append(key)\n            for key in del_keys:\n                self.data.pop(key)\n        else:\n            for data in self.data.values():\n                data[:] = [row_map[x] for x in data if x in row_map]"},{"col":0,"comment":"null","endLoc":49,"header":"def _fix_user_options(options)","id":7374,"name":"_fix_user_options","nodeType":"Function","startLoc":43,"text":"def _fix_user_options(options):\n    def to_str_or_none(x):\n        if x is None:\n            return None\n        return str(x)\n\n    return [tuple(to_str_or_none(x) for x in y) for y in options]"},{"col":0,"comment":"null","endLoc":109,"header":"@pytest.fixture(params=[False, True])\ndef table_data(request)","id":7376,"name":"table_data","nodeType":"Function","startLoc":95,"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)"},{"col":4,"comment":"null","endLoc":660,"header":"def __str__(self)","id":7377,"name":"__str__","nodeType":"Function","startLoc":659,"text":"def __str__(self):\n        return str(self.data)"},{"col":4,"comment":"null","endLoc":663,"header":"def __repr__(self)","id":7378,"name":"__repr__","nodeType":"Function","startLoc":662,"text":"def __repr__(self):\n        return str(self)"},{"attributeType":"null","col":8,"comment":"null","endLoc":508,"id":7379,"name":"data","nodeType":"Attribute","startLoc":508,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":509,"id":7380,"name":"unique","nodeType":"Attribute","startLoc":509,"text":"self.unique"},{"attributeType":"null","col":8,"comment":"null","endLoc":671,"id":7382,"name":"engine","nodeType":"Attribute","startLoc":671,"text":"engine"},{"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":7383,"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 ..utils.data import get_pkg_data_filename\n    from ..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":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":89,"header":"def _save_coverage(cov, result, rootdir, testing_path)","id":7384,"name":"_save_coverage","nodeType":"Function","startLoc":52,"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 ..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'))"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.table`.\n    ","endLoc":35,"id":7385,"nodeType":"Class","startLoc":6,"text":"class Conf(_config.ConfigNamespace):\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 <http://getbootstrap.com/css/#tables '\n        'for a list of useful bootstrap classes.')\n    replace_warnings = _config.ConfigItem(\n        ['slice'],\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        'list',\n        )\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        )"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":11,"id":7386,"name":"auto_colname","nodeType":"Attribute","startLoc":11,"text":"auto_colname"},{"col":0,"comment":"The main function called by the `showtable` script.","endLoc":158,"header":"def main(args=None)","id":7387,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":7388,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"col":0,"comment":"","endLoc":6,"header":"table_helpers.py#<anonymous>","id":7389,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHelper functions for table development, mostly creating useful\ntables for testing.\n\"\"\""},{"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":298,"header":"def same_prefix_range(self, lower, upper, bounds=(True, True))","id":7390,"name":"same_prefix_range","nodeType":"Function","startLoc":274,"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)"},{"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":316,"header":"def range(self, lower, upper, bounds=(True, True))","id":7391,"name":"range","nodeType":"Function","startLoc":300,"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":"\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":334,"header":"def replace(self, row, col_name, val)","id":7392,"name":"replace","nodeType":"Function","startLoc":318,"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":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":403,"header":"def assert_follows_unicode_guidelines(\n        x, roundtrip=None)","id":7393,"name":"assert_follows_unicode_guidelines","nodeType":"Function","startLoc":347,"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 .. 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"},{"fileName":"setup_package.py","filePath":"astropy/tests","id":7394,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\ndef get_package_data():\n    return {\n        'astropy.tests': ['coveragerc'],\n    }\n"},{"col":0,"comment":"null","endLoc":7,"header":"def get_package_data()","id":7395,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    return {\n        'astropy.tests': ['coveragerc'],\n    }"},{"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":350,"header":"def replace_rows(self, col_slice)","id":7396,"name":"replace_rows","nodeType":"Function","startLoc":336,"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)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":16,"id":7397,"name":"default_notebook_table_class","nodeType":"Attribute","startLoc":16,"text":"default_notebook_table_class"},{"col":0,"comment":"","endLoc":43,"header":"showtable.py#<anonymous>","id":7398,"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\"\"\""},{"col":4,"comment":"\n        Make row numbers follow the same sort order as the keys\n        of the index.\n        ","endLoc":357,"header":"def sort(self)","id":7399,"name":"sort","nodeType":"Function","startLoc":352,"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()"},{"fileName":"command.py","filePath":"astropy/tests","id":7400,"nodeType":"File","text":"\"\"\"\nImplements the wrapper for the Astropy test runner in the form of the\n``./setup.py test`` distutils command.\n\"\"\"\n\n\nimport os\nimport glob\nimport shutil\nimport subprocess\nimport sys\nimport tempfile\n\nfrom setuptools import Command\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 distutils/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(FixRemoteDataOption, cls).__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         \"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 negative, 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    ]\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\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        # 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            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 py.test 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        # 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        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 _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, '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)\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=\"{0}\", config_file=\"{1}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), tmp_coveragerc))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, \"{0}\", \"{1}\");'.format(\n                os.path.abspath('.'), self.testing_path))\n\n        return cmd_pre, cmd_post\n"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":21,"id":7401,"name":"replace_warnings","nodeType":"Attribute","startLoc":21,"text":"replace_warnings"},{"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":364,"header":"def sorted_data(self)","id":7402,"name":"sorted_data","nodeType":"Function","startLoc":359,"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()"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":28,"id":7403,"name":"replace_inplace","nodeType":"Attribute","startLoc":28,"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":380,"header":"def __getitem__(self, item)","id":7404,"name":"__getitem__","nodeType":"Function","startLoc":366,"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)"},{"col":4,"comment":"null","endLoc":383,"header":"def __str__(self)","id":7405,"name":"__str__","nodeType":"Function","startLoc":382,"text":"def __str__(self):\n        return str(self.data)"},{"fileName":"__init__.py","filePath":"astropy/tests","id":7406,"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"},{"col":4,"comment":"null","endLoc":386,"header":"def __repr__(self)","id":7407,"name":"__repr__","nodeType":"Function","startLoc":385,"text":"def __repr__(self):\n        return str(self)"},{"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":407,"header":"def __deepcopy__(self, memo)","id":7408,"name":"__deepcopy__","nodeType":"Function","startLoc":388,"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"},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":7409,"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\"\"\""},{"attributeType":"SortedArray","col":8,"comment":"null","endLoc":126,"id":7410,"name":"data","nodeType":"Attribute","startLoc":126,"text":"self.data"},{"attributeType":"SortedArray","col":8,"comment":"null","endLoc":91,"id":7411,"name":"engine","nodeType":"Attribute","startLoc":91,"text":"self.engine"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":7412,"name":"columns","nodeType":"Attribute","startLoc":127,"text":"self.columns"},{"col":0,"comment":"","endLoc":3,"header":"__init__.py#<anonymous>","id":7413,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"conf = Conf()\n\nwith registry.delay_doc_updates(Table):\n    # Import routines that connect readers/writers to astropy.table\n    from .jsviewer import JSViewer\n    from ..io.ascii import connect\n    from ..io.fits import connect\n    from ..io.misc import connect\n    from ..io.votable import connect"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":7414,"name":"self","nodeType":"Attribute","startLoc":68,"text":"self"},{"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 : 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":606,"id":7415,"nodeType":"Class","startLoc":410,"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 : 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        else:  # 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\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 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.copy().insert_row(self.orig_coords(pos), vals,\n                                   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.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.copy().sort()\n\n    def __repr__(self):\n        if self.original:\n            return repr(self.index)\n        return 'Index slice {0} of\\n{1}'.format(\n            (self.start, self.stop, self.step), self.index)\n\n    def __str__(self):\n        return repr(self)\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            return Index([col_slice], engine=self.data.__class__)\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        return Index(new_cols, engine=self.data.__class__)\n\n    @property\n    def columns(self):\n        return self.index.columns\n\n    @property\n    def data(self):\n        return self.index.data"},{"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 distutils/setuptools try to parse the command-line options.\n    ","endLoc":41,"id":7416,"nodeType":"Class","startLoc":17,"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 distutils/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(FixRemoteDataOption, cls).__init__(name, bases, dct)"},{"col":4,"comment":"null","endLoc":444,"header":"@property\n    def length(self)","id":7417,"name":"length","nodeType":"Function","startLoc":442,"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":452,"header":"@property\n    def stop(self)","id":7418,"name":"stop","nodeType":"Function","startLoc":446,"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":"\n        Returns another slice of this Index slice.\n\n        Parameters\n        ----------\n        item : slice\n            Index slice\n        ","endLoc":470,"header":"def __getitem__(self, item)","id":7419,"name":"__getitem__","nodeType":"Function","startLoc":454,"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))"},{"fileName":"disable_internet.py","filePath":"astropy/tests","id":7420,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis is retained only for backwards compatibility. Affiliated packages\nshould no longer import ``disable_internet`` from ``astropy.tests``. It is\nnow available from ``pytest_remotedata``. However, this is not the\nrecommended mechanism for controlling access to remote data in tests.\nInstead, packages should make use of decorators provided by the\npytest_remotedata plugin: - ``@pytest.mark.remote_data`` for tests that\nrequire remote data access - ``@pytest.mark.internet_off`` for tests that\nshould only run when remote data access is disabled.  Remote data access for\nthe test suite is controlled by the ``--remote-data`` command line flag. This\nis either passed to ``pytest`` directly or to the ``setup.py test`` command.\n\nTODO: This module should eventually be removed once backwards compatibility\nis no longer supported.\n\"\"\"\nfrom warnings import warn\nfrom ..utils.exceptions import AstropyDeprecationWarning\n\n\nwarn(\"The ``disable_internet`` module is no longer provided by astropy. It \"\n     \"is now available as ``pytest_remotedata.disable_internet``. However, \"\n     \"developers are encouraged to avoid using this module directly. See \"\n     \"<https://docs.astropy.org/en/latest/whatsnew/3.0.html#pytest-plugins> \"\n     \"for more information.\", AstropyDeprecationWarning)\n\n\ntry:\n    # This should only be necessary during testing, in which case the test\n    # package must be installed anyway.\n    from pytest_remotedata.disable_internet import *\nexcept ImportError:\n    pass\n"},{"col":4,"comment":"null","endLoc":41,"header":"def __init__(cls, name, bases, dct)","id":7421,"name":"__init__","nodeType":"Function","startLoc":25,"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(FixRemoteDataOption, cls).__init__(name, bases, dct)"},{"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":412,"header":"@pytest.fixture(params=[0, 1, -1])\ndef pickle_protocol(request)","id":7422,"name":"pickle_protocol","nodeType":"Function","startLoc":406,"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":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":440,"header":"def generic_recursive_equality_test(a, b, class_history)","id":7423,"name":"generic_recursive_equality_test","nodeType":"Function","startLoc":415,"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.__dict__\n    dict_b = b.__dict__\n    for key in dict_a:\n        assert key in dict_b,\\\n          \"Did not pickle {0}\".format(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, \"Value of {0} changed by pickling\".format(key)\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)"},{"col":0,"comment":"","endLoc":16,"header":"disable_internet.py#<anonymous>","id":7424,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis is retained only for backwards compatibility. Affiliated packages\nshould no longer import ``disable_internet`` from ``astropy.tests``. It is\nnow available from ``pytest_remotedata``. However, this is not the\nrecommended mechanism for controlling access to remote data in tests.\nInstead, packages should make use of decorators provided by the\npytest_remotedata plugin: - ``@pytest.mark.remote_data`` for tests that\nrequire remote data access - ``@pytest.mark.internet_off`` for tests that\nshould only run when remote data access is disabled.  Remote data access for\nthe test suite is controlled by the ``--remote-data`` command line flag. This\nis either passed to ``pytest`` directly or to the ``setup.py test`` command.\n\nTODO: This module should eventually be removed once backwards compatibility\nis no longer supported.\n\"\"\"\n\nwarn(\"The ``disable_internet`` module is no longer provided by astropy. It \"\n     \"is now available as ``pytest_remotedata.disable_internet``. However, \"\n     \"developers are encouraged to avoid using this module directly. See \"\n     \"<https://docs.astropy.org/en/latest/whatsnew/3.0.html#pytest-plugins> \"\n     \"for more information.\", AstropyDeprecationWarning)\n\ntry:\n    # This should only be necessary during testing, in which case the test\n    # package must be installed anyway.\n    from pytest_remotedata.disable_internet import *\nexcept ImportError:\n    pass"},{"className":"AstropyTest","col":0,"comment":"null","endLoc":303,"id":7425,"nodeType":"Class","startLoc":44,"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         \"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 negative, 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    ]\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\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        # 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            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 py.test 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        # 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        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 _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, '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)\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=\"{0}\", config_file=\"{1}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), tmp_coveragerc))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, \"{0}\", \"{1}\");'.format(\n                os.path.abspath('.'), self.testing_path))\n\n        return cmd_pre, cmd_post"},{"fileName":"image_tests.py","filePath":"astropy/tests","id":7426,"nodeType":"File","text":"from distutils.version import LooseVersion\n\nimport matplotlib\n\nMPL_VERSION = LooseVersion(matplotlib.__version__)\n\nROOT = \"http://{server}/testing/astropy/2017-07-12T14:12:26.217559/{mpl_version}/\"\n\nIMAGE_REFERENCE_DIR = (ROOT.format(server='data.astropy.org', mpl_version='1.5.x') + ',' +\n                       ROOT.format(server='www.astropy.org/astropy-data', mpl_version='1.5.x'))\n"},{"col":0,"comment":"\n    Try to pickle an object. If successful, make sure\n    the object's attributes survived pickling and unpickling.\n    ","endLoc":452,"header":"def check_pickling_recovery(original, protocol)","id":7427,"name":"check_pickling_recovery","nodeType":"Function","startLoc":443,"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":"null","col":0,"comment":"null","endLoc":5,"id":7428,"name":"MPL_VERSION","nodeType":"Attribute","startLoc":5,"text":"MPL_VERSION"},{"col":4,"comment":"null","endLoc":113,"header":"def initialize_options(self)","id":7429,"name":"initialize_options","nodeType":"Function","startLoc":97,"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"},{"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":515,"header":"def orig_coords(self, row)","id":7430,"name":"orig_coords","nodeType":"Function","startLoc":500,"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":"null","endLoc":118,"header":"def finalize_options(self)","id":7431,"name":"finalize_options","nodeType":"Function","startLoc":115,"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":154,"header":"def generate_testing_command(self)","id":7432,"name":"generate_testing_command","nodeType":"Function","startLoc":120,"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":0,"comment":"\n    Returns True if two arrays are element-wise equal within a tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`.\n    ","endLoc":478,"header":"def quantity_allclose(a, b, rtol=1.e-5, atol=None, **kwargs)","id":7433,"name":"quantity_allclose","nodeType":"Function","startLoc":469,"text":"def quantity_allclose(a, b, rtol=1.e-5, atol=None, **kwargs):\n    \"\"\"\n    Returns True if two arrays are element-wise equal within a tolerance.\n\n    This is a :class:`~astropy.units.Quantity`-aware version of\n    :func:`numpy.allclose`.\n    \"\"\"\n    import numpy as np\n    return np.allclose(*_unquantify_allclose_arguments(a, b, rtol, atol),\n                       **kwargs)"},{"fileName":"runner.py","filePath":"astropy/tests","id":7434,"nodeType":"File","text":"\"\"\"Implements the Astropy TestRunner which is a thin wrapper around py.test.\"\"\"\n\nimport inspect\nimport os\nimport glob\nimport copy\nimport shlex\nimport sys\nimport tempfile\nimport warnings\nimport importlib\nfrom collections import OrderedDict\nfrom importlib.util import find_spec\n\nfrom ..config.paths import set_temp_config, set_temp_cache\nfrom ..utils import wraps, find_current_module\nfrom ..utils.exceptions import AstropyWarning, AstropyDeprecationWarning\n\n__all__ = ['TestRunner', 'TestRunnerBase', 'keyword']\n\n\ndef _has_test_dependencies(): # 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    required = ['pytest', 'pytest_remotedata', 'pytest_doctestplus']\n    for module in required:\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            return False\n\n    return True\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    `~astropy.tests.runner.keyword` decorator, these methods are used to\n    construct allowed keyword arguments to the\n    `~astropy.tests.runner.TestRunnerBase.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    `~astropy.tests.runner.TestRunnerBase.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(TestRunnerBase, cls).__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(\"run_tests() got an unexpected keyword argument {}\".format(keyword))\n\n            # keyword methods must return a list\n            if not isinstance(result, list):\n                raise TypeError(\"{} keyword method must return a list\".format(keyword))\n\n            args += result\n\n        return args\n\n    RUN_TESTS_DOCSTRING = \\\n        \"\"\"\n        Run the tests for the package.\n\n        Parameters\n        ----------\n        {keywords}\n        See Also\n        --------\n        pytest.main : This method builds arguments for and then calls this function.\n        \"\"\"\n\n    def run_tests(self, **kwargs):\n\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        # runnning python setup.py test, 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            # We now need to force reload pkg_resources in case any pytest\n            # plugins were added above, so that their entry points are picked up\n            import pkg_resources\n            importlib.reload(pkg_resources)\n\n        if not _has_test_dependencies():  # pragma: no cover\n            msg = \"Test dependencies are missing. You should install the 'pytest-astropy' package.\"\n            raise RuntimeError(msg)\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(\"run_tests() got an unexpected keyword argument {}\".format(wrong_kwargs[0]))\n\n        args = self._generate_args(**kwargs)\n\n        if 'plugins' not in self.keywords or self.keywords['plugins'] is None:\n            self.keywords['plugins'] = []\n\n        # Make plugins available to test runner without registering them\n        self.keywords['plugins'].extend([\n            'astropy.tests.plugins.display',\n            'astropy.tests.plugins.config'\n        ])\n\n        # override the config locations to not make a new directory nor use\n        # existing cache or config\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 py.test 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=self.keywords['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__',), exclude_args=('self',))\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        return test\n\n\nclass TestRunner(TestRunnerBase):\n    \"\"\"\n    A test runner for astropy tests\n    \"\"\"\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 'utils'.\n            If nothing is specified all default Astropy tests are run.\n        \"\"\"\n        if package is None:\n            self.package_path = self.base_path\n        else:\n            self.package_path = os.path.join(self.base_path,\n                                        package.replace('.', os.path.sep))\n\n            if not os.path.isdir(self.package_path):\n                raise ValueError('Package not found: {0}'.format(package))\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            if not (os.path.isdir(test_path) or ext in ('.py', '.rst')):\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()\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        return []\n\n    @keyword()\n    def verbose(self, verbose, kwargs):\n        \"\"\"\n        verbose : bool, optional\n            Convenience option to turn on verbose output from py.test. 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 py.test 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 ['--pastebin={0}'.format(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 {0}). 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 ['--remote-data={0}'.format(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                                  'http://pypi.python.org/pypi/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, optional\n            When provided, run the tests in parallel on the specified\n            number of CPUs.  If parallel is negative, 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        if docs_path is not None and not kwargs['skip_docs']:\n            if kwargs['package'] is not None:\n                docs_path = os.path.join(\n                    docs_path, kwargs['package'].replace('.', os.path.sep))\n            if not os.path.exists(docs_path):\n                warnings.warn(\n                    \"Can not test .rst docs, since docs path \"\n                    \"({0}) does not exist.\".format(docs_path))\n                docs_path = None\n        if docs_path and not kwargs['skip_docs'] and not kwargs['test_path']:\n            return [docs_path, '--doctest-rst']\n\n        return []\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 ['--repeat={0}'.format(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 ..table import Table  # pylint: disable=W0611\n\n        return super(TestRunner, self).run_tests(**kwargs)\n"},{"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":237,"id":7435,"nodeType":"Class","startLoc":195,"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\n        from .configuration import _cfgobjs\n\n        path = super().__enter__()\n        _cfgobjs.clear()\n        return path\n\n    def __exit__(self, *args):\n        from .configuration import _cfgobjs\n\n        super().__exit__(*args)\n        _cfgobjs.clear()"},{"className":"_SetTempPath","col":0,"comment":"null","endLoc":192,"id":7436,"nodeType":"Class","startLoc":162,"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        return self._default_path_getter()\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":176,"header":"def __enter__(self)","id":7437,"name":"__enter__","nodeType":"Function","startLoc":174,"text":"def __enter__(self):\n        self.__class__._temp_path = self._path\n        return self._default_path_getter()"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":7438,"name":"ROOT","nodeType":"Attribute","startLoc":7,"text":"ROOT"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":7439,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":7440,"name":"remote_data","nodeType":"Attribute","startLoc":39,"text":"remote_data"},{"col":4,"comment":"null","endLoc":182,"header":"def __exit__(self, *args)","id":7441,"name":"__exit__","nodeType":"Function","startLoc":178,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7442,"name":"IMAGE_REFERENCE_DIR","nodeType":"Attribute","startLoc":9,"text":"IMAGE_REFERENCE_DIR"},{"col":4,"comment":"Implements use as a decorator.","endLoc":192,"header":"def __call__(self, func)","id":7443,"name":"__call__","nodeType":"Function","startLoc":184,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":163,"id":7444,"name":"_temp_path","nodeType":"Attribute","startLoc":163,"text":"_temp_path"},{"col":0,"comment":"","endLoc":1,"header":"image_tests.py#<anonymous>","id":7445,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"MPL_VERSION = LooseVersion(matplotlib.__version__)\n\nROOT = \"http://{server}/testing/astropy/2017-07-12T14:12:26.217559/{mpl_version}/\"\n\nIMAGE_REFERENCE_DIR = (ROOT.format(server='data.astropy.org', mpl_version='1.5.x') + ',' +\n                       ROOT.format(server='www.astropy.org/astropy-data', mpl_version='1.5.x'))"},{"attributeType":"null","col":4,"comment":"null","endLoc":164,"id":7446,"name":"_default_path_getter","nodeType":"Attribute","startLoc":164,"text":"_default_path_getter"},{"attributeType":"null","col":8,"comment":"null","endLoc":172,"id":7447,"name":"_prev_path","nodeType":"Attribute","startLoc":172,"text":"self._prev_path"},{"attributeType":"null","col":8,"comment":"null","endLoc":170,"id":7448,"name":"_path","nodeType":"Attribute","startLoc":170,"text":"self._path"},{"attributeType":"null","col":8,"comment":"null","endLoc":171,"id":7449,"name":"_delete","nodeType":"Attribute","startLoc":171,"text":"self._delete"},{"id":7450,"name":"coveragerc","nodeType":"TextFile","path":"astropy/tests","text":"[run]\nsource = astropy\nomit =\n   astropy/__init__*\n   astropy/conftest.py\n   astropy/*setup*\n   astropy/*/tests/*\n   astropy/tests/test_*\n   astropy/extern/*\n   astropy/sphinx/*\n   astropy/utils/compat/*\n   astropy/version*\n   astropy/wcs/docstrings*\n   astropy/_erfa/*\n\n[report]\nexclude_lines =\n   # Have to re-enable the standard pragma\n   pragma: no cover\n\n   # Don't complain about packages we have installed\n   except ImportError\n\n   # Don't complain if tests don't hit assertions\n   raise AssertionError\n   raise NotImplementedError\n\n   # Don't complain about script hooks\n   def main\\(.*\\):\n\n   # Ignore branches that don't pertain to this version of Python\n   pragma: py{ignore_python_version}"},{"col":4,"comment":"null","endLoc":231,"header":"def __enter__(self)","id":7451,"name":"__enter__","nodeType":"Function","startLoc":224,"text":"def __enter__(self):\n        # Special case for the config case, where we need to reset all the\n        # cached config objects\n        from .configuration import _cfgobjs\n\n        path = super().__enter__()\n        _cfgobjs.clear()\n        return path"},{"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":498,"header":"def sliced_coords(self, rows)","id":7452,"name":"sliced_coords","nodeType":"Function","startLoc":472,"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"},{"id":7453,"name":"astropy/tests/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/tests/tests","id":7454,"nodeType":"File","text":""},{"id":7455,"name":"astropy/tests/plugins","nodeType":"Package"},{"fileName":"display.py","filePath":"astropy/tests/plugins","id":7456,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis plugin provides customization of the header displayed by pytest for\nreporting purposes.\n\"\"\"\nfrom __future__ import (absolute_import, division, print_function,\n                        unicode_literals)\n\nimport os\nimport sys\nimport datetime\nimport locale\nimport math\nfrom collections import OrderedDict\n\nfrom ..helper import ignore_warnings\nfrom ...utils.introspection import resolve_name\n\n\nPYTEST_HEADER_MODULES = OrderedDict([('Numpy', 'numpy'),\n                                     ('Scipy', 'scipy'),\n                                     ('Matplotlib', 'matplotlib'),\n                                     ('h5py', 'h5py'),\n                                     ('Pandas', 'pandas')])\n\n# This always returns with Astropy's version\nfrom ... import __version__\nTESTED_VERSIONS = OrderedDict([('Astropy', __version__)])\n\n\ndef pytest_report_header(config):\n\n    try:\n        stdoutencoding = sys.stdout.encoding or 'ascii'\n    except AttributeError:\n        stdoutencoding = 'ascii'\n\n    args = config.args\n\n    # TESTED_VERSIONS can contain the affiliated package version, too\n    if len(TESTED_VERSIONS) > 1:\n        for pkg, version in TESTED_VERSIONS.items():\n            if pkg != 'Astropy':\n                s = \"\\nRunning tests with {0} version {1}.\\n\".format(\n                    pkg, version)\n    else:\n        s = \"\\nRunning tests with Astropy version {0}.\\n\".format(\n            TESTED_VERSIONS['Astropy'])\n\n    # Per https://github.com/astropy/astropy/pull/4204, strip the rootdir from\n    # each directory argument\n    if hasattr(config, 'rootdir'):\n        rootdir = str(config.rootdir)\n        if not rootdir.endswith(os.sep):\n            rootdir += os.sep\n\n        dirs = [arg[len(rootdir):] if arg.startswith(rootdir) else arg\n                for arg in args]\n    else:\n        dirs = args\n\n    s += \"Running tests in {0}.\\n\\n\".format(\" \".join(dirs))\n\n    s += \"Date: {0}\\n\\n\".format(datetime.datetime.now().isoformat()[:19])\n\n    from platform import platform\n    plat = platform()\n    if isinstance(plat, bytes):\n        plat = plat.decode(stdoutencoding, 'replace')\n    s += \"Platform: {0}\\n\\n\".format(plat)\n    s += \"Executable: {0}\\n\\n\".format(sys.executable)\n    s += \"Full Python Version: \\n{0}\\n\\n\".format(sys.version)\n\n    s += \"encodings: sys: {0}, locale: {1}, filesystem: {2}\".format(\n        sys.getdefaultencoding(),\n        locale.getpreferredencoding(),\n        sys.getfilesystemencoding())\n    s += '\\n'\n\n    s += \"byteorder: {0}\\n\".format(sys.byteorder)\n    s += \"float info: dig: {0.dig}, mant_dig: {0.dig}\\n\\n\".format(\n        sys.float_info)\n\n    for module_display, module_name in PYTEST_HEADER_MODULES.items():\n        try:\n            with ignore_warnings(DeprecationWarning):\n                module = resolve_name(module_name)\n        except ImportError:\n            s += \"{0}: not available\\n\".format(module_display)\n        else:\n            try:\n                version = module.__version__\n            except AttributeError:\n                version = 'unknown (no __version__ attribute)'\n            s += \"{0}: {1}\\n\".format(module_display, version)\n\n    special_opts = [\"remote_data\", \"pep8\"]\n    opts = []\n    for op in special_opts:\n        op_value = getattr(config.option, op, None)\n        if op_value:\n            if isinstance(op_value, str):\n                op = ': '.join((op, op_value))\n            opts.append(op)\n    if opts:\n        s += \"Using Astropy options: {0}.\\n\".format(\", \".join(opts))\n\n    return s\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 are known to 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        'http://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"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":7457,"name":"_deprecations_as_exceptions","nodeType":"Attribute","startLoc":126,"text":"_deprecations_as_exceptions"},{"attributeType":"null","col":0,"comment":"null","endLoc":127,"id":7458,"name":"_include_astropy_deprecations","nodeType":"Attribute","startLoc":127,"text":"_include_astropy_deprecations"},{"col":0,"comment":"null","endLoc":108,"header":"def pytest_report_header(config)","id":7459,"name":"pytest_report_header","nodeType":"Function","startLoc":31,"text":"def pytest_report_header(config):\n\n    try:\n        stdoutencoding = sys.stdout.encoding or 'ascii'\n    except AttributeError:\n        stdoutencoding = 'ascii'\n\n    args = config.args\n\n    # TESTED_VERSIONS can contain the affiliated package version, too\n    if len(TESTED_VERSIONS) > 1:\n        for pkg, version in TESTED_VERSIONS.items():\n            if pkg != 'Astropy':\n                s = \"\\nRunning tests with {0} version {1}.\\n\".format(\n                    pkg, version)\n    else:\n        s = \"\\nRunning tests with Astropy version {0}.\\n\".format(\n            TESTED_VERSIONS['Astropy'])\n\n    # Per https://github.com/astropy/astropy/pull/4204, strip the rootdir from\n    # each directory argument\n    if hasattr(config, 'rootdir'):\n        rootdir = str(config.rootdir)\n        if not rootdir.endswith(os.sep):\n            rootdir += os.sep\n\n        dirs = [arg[len(rootdir):] if arg.startswith(rootdir) else arg\n                for arg in args]\n    else:\n        dirs = args\n\n    s += \"Running tests in {0}.\\n\\n\".format(\" \".join(dirs))\n\n    s += \"Date: {0}\\n\\n\".format(datetime.datetime.now().isoformat()[:19])\n\n    from platform import platform\n    plat = platform()\n    if isinstance(plat, bytes):\n        plat = plat.decode(stdoutencoding, 'replace')\n    s += \"Platform: {0}\\n\\n\".format(plat)\n    s += \"Executable: {0}\\n\\n\".format(sys.executable)\n    s += \"Full Python Version: \\n{0}\\n\\n\".format(sys.version)\n\n    s += \"encodings: sys: {0}, locale: {1}, filesystem: {2}\".format(\n        sys.getdefaultencoding(),\n        locale.getpreferredencoding(),\n        sys.getfilesystemencoding())\n    s += '\\n'\n\n    s += \"byteorder: {0}\\n\".format(sys.byteorder)\n    s += \"float info: dig: {0.dig}, mant_dig: {0.dig}\\n\\n\".format(\n        sys.float_info)\n\n    for module_display, module_name in PYTEST_HEADER_MODULES.items():\n        try:\n            with ignore_warnings(DeprecationWarning):\n                module = resolve_name(module_name)\n        except ImportError:\n            s += \"{0}: not available\\n\".format(module_display)\n        else:\n            try:\n                version = module.__version__\n            except AttributeError:\n                version = 'unknown (no __version__ attribute)'\n            s += \"{0}: {1}\\n\".format(module_display, version)\n\n    special_opts = [\"remote_data\", \"pep8\"]\n    opts = []\n    for op in special_opts:\n        op_value = getattr(config.option, op, None)\n        if op_value:\n            if isinstance(op_value, str):\n                op = ': '.join((op, op_value))\n            opts.append(op)\n    if opts:\n        s += \"Using Astropy options: {0}.\\n\".format(\", \".join(opts))\n\n    return s"},{"attributeType":"null","col":0,"comment":"null","endLoc":128,"id":7460,"name":"_modules_to_ignore_on_import","nodeType":"Attribute","startLoc":128,"text":"_modules_to_ignore_on_import"},{"col":4,"comment":"null","endLoc":237,"header":"def __exit__(self, *args)","id":7461,"name":"__exit__","nodeType":"Function","startLoc":233,"text":"def __exit__(self, *args):\n        from .configuration import _cfgobjs\n\n        super().__exit__(*args)\n        _cfgobjs.clear()"},{"col":4,"comment":"\n        This method creates the post and pre commands if coverage is to be\n        generated\n        ","endLoc":303,"header":"def _generate_coverage_commands(self)","id":7462,"name":"_generate_coverage_commands","nodeType":"Function","startLoc":261,"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, '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)\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=\"{0}\", config_file=\"{1}\"); '\n            'cov.start();'.format(\n                os.path.abspath(\".coverage\"), tmp_coveragerc))\n        cmd_post = (\n            'cov.stop(); '\n            'from astropy.tests.helper import _save_coverage; '\n            '_save_coverage(cov, result, \"{0}\", \"{1}\");'.format(\n                os.path.abspath('.'), self.testing_path))\n\n        return cmd_pre, cmd_post"},{"attributeType":"null","col":0,"comment":"null","endLoc":135,"id":7463,"name":"_warnings_to_ignore_entire_module","nodeType":"Attribute","startLoc":135,"text":"_warnings_to_ignore_entire_module"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":7464,"name":"_warnings_to_ignore_by_pyver","nodeType":"Attribute","startLoc":136,"text":"_warnings_to_ignore_by_pyver"},{"col":4,"comment":"\n        Run the tests!\n        ","endLoc":218,"header":"def run(self)","id":7465,"name":"run","nodeType":"Function","startLoc":156,"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        # 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            shutil.rmtree(self.tmp_dir)\n\n        raise SystemExit(retcode)"},{"col":0,"comment":"","endLoc":5,"header":"helper.py#<anonymous>","id":7466,"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\ntry:\n    # Import pkg_resources to prevent it from issuing warnings upon being\n    # imported from within py.test.  See\n    # https://github.com/astropy/astropy/pull/537 for a detailed explanation.\n    import pkg_resources  # pylint: disable=W0611\nexcept ImportError:\n    pass\n\n__all__ = ['raises', 'enable_deprecations_as_exceptions', 'remote_data',\n           'treat_deprecations_as_exceptions', 'catch_warnings',\n           'assert_follows_unicode_guidelines', 'quantity_allclose',\n           'assert_quantity_allclose', 'check_pickling_recovery',\n           'pickle_protocol', 'generic_recursive_equality_test']\n\nremote_data = pytest.mark.remote_data\n\n_deprecations_as_exceptions = False\n\n_include_astropy_deprecations = True\n\n_modules_to_ignore_on_import = set([\n    'compiler',  # A deprecated stdlib module used by py.test\n    'scipy',\n    'pygments',\n    'ipykernel',\n    'IPython',   # deprecation warnings for async and await\n    'setuptools'])\n\n_warnings_to_ignore_entire_module = set([])\n\n_warnings_to_ignore_by_pyver = {\n    (3, 5): set([\n        # py.test reads files with the 'U' flag, which is\n        # deprecated.\n        r\"'U' mode is deprecated\",\n        # py.test raised this warning in inspect on Python 3.5.\n        # See https://github.com/pytest-dev/pytest/pull/1009\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\\(\\) instead\"]),\n    (3, 6): set([\n        # py.test reads files with the 'U' flag, which is\n        # deprecated.\n        r\"'U' mode is deprecated\",\n        # inspect raises this slightly different warning on Python 3.6.\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\\(\\)\"])}"},{"col":4,"comment":"null","endLoc":518,"header":"def find(self, key)","id":7467,"name":"find","nodeType":"Function","startLoc":517,"text":"def find(self, key):\n        return self.sliced_coords(self.index.find(key))"},{"attributeType":"null","col":4,"comment":"null","endLoc":222,"id":7468,"name":"_default_path_getter","nodeType":"Attribute","startLoc":222,"text":"_default_path_getter"},{"fileName":"config.py","filePath":"astropy/tests/plugins","id":7469,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis plugin provides customization of configuration and cache directories used\nby pytest.\n\"\"\"\nimport datetime\nimport locale\nimport os\nimport sys\nfrom collections import OrderedDict\n\nimport pytest\n\nfrom ...config.paths import set_temp_config, set_temp_cache\nfrom ...utils.argparse import writeable_directory\nfrom ..helper import treat_deprecations_as_exceptions\n\nimport importlib.machinery as importlib_machinery\n\n\n# these pytest hooks allow us to mark tests and run the marked tests with\n# specific command line options.\n\ndef pytest_addoption(parser):\n\n    parser.addoption(\"--config-dir\", nargs='?', type=writeable_directory,\n                     help=\"specify directory for storing and retrieving the \"\n                          \"Astropy configuration during tests (default is \"\n                          \"to use a temporary directory created by the test \"\n                          \"runner); be aware that using an Astropy config \"\n                          \"file other than the default can cause some tests \"\n                          \"to fail unexpectedly\")\n\n    parser.addoption(\"--cache-dir\", nargs='?', type=writeable_directory,\n                     help=\"specify directory for storing and retrieving the \"\n                          \"Astropy cache during tests (default is \"\n                          \"to use a temporary directory created by the test \"\n                          \"runner)\")\n    parser.addini(\"config_dir\",\n                  \"specify directory for storing and retrieving the \"\n                  \"Astropy configuration during tests (default is \"\n                  \"to use a temporary directory created by the test \"\n                  \"runner); be aware that using an Astropy config \"\n                  \"file other than the default can cause some tests \"\n                  \"to fail unexpectedly\", default=None)\n\n    parser.addini(\"cache_dir\",\n                  \"specify directory for storing and retrieving the \"\n                  \"Astropy cache during tests (default is \"\n                  \"to use a temporary directory created by the test \"\n                  \"runner)\", default=None)\n\ndef pytest_configure(config):\n    treat_deprecations_as_exceptions()\n\ndef pytest_runtest_setup(item):\n    config_dir = item.config.getini('config_dir')\n    cache_dir = item.config.getini('cache_dir')\n\n    # Command-line options can override, however\n    config_dir = item.config.getoption('config_dir') or config_dir\n    cache_dir = item.config.getoption('cache_dir') or cache_dir\n\n    # We can't really use context managers directly in py.test (although\n    # py.test 2.7 adds the capability), so this may look a bit hacky\n    if config_dir:\n        item.set_temp_config = set_temp_config(config_dir)\n        item.set_temp_config.__enter__()\n    if cache_dir:\n        item.set_temp_cache = set_temp_cache(cache_dir)\n        item.set_temp_cache.__enter__()\n\ndef pytest_runtest_teardown(item, nextitem):\n    if hasattr(item, 'set_temp_cache'):\n        item.set_temp_cache.__exit__()\n    if hasattr(item, 'set_temp_config'):\n        item.set_temp_config.__exit__()\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":269,"id":7470,"nodeType":"Class","startLoc":240,"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":269,"id":7471,"name":"_default_path_getter","nodeType":"Attribute","startLoc":269,"text":"_default_path_getter"},{"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":55,"header":"def writeable_directory(arg)","id":7472,"name":"writeable_directory","nodeType":"Function","startLoc":41,"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            \"{0} exists but is not writeable with its current \"\n            \"permissions\".format(arg))\n\n    return arg"},{"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":259,"header":"def _build_temp_install(self)","id":7473,"name":"_build_temp_install","nodeType":"Function","startLoc":220,"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 py.test 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        # 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        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)"},{"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":62,"id":7474,"nodeType":"Class","startLoc":35,"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":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":7475,"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            \"{0} 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":4,"comment":"null","endLoc":62,"header":"def __call__(self, f)","id":7476,"name":"__call__","nodeType":"Function","startLoc":52,"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"},{"col":4,"comment":"null","endLoc":521,"header":"def where(self, col_map)","id":7477,"name":"where","nodeType":"Function","startLoc":520,"text":"def where(self, col_map):\n        return self.sliced_coords(self.index.where(col_map))"},{"col":0,"comment":"null","endLoc":51,"header":"def pytest_addoption(parser)","id":7478,"name":"pytest_addoption","nodeType":"Function","startLoc":24,"text":"def pytest_addoption(parser):\n\n    parser.addoption(\"--config-dir\", nargs='?', type=writeable_directory,\n                     help=\"specify directory for storing and retrieving the \"\n                          \"Astropy configuration during tests (default is \"\n                          \"to use a temporary directory created by the test \"\n                          \"runner); be aware that using an Astropy config \"\n                          \"file other than the default can cause some tests \"\n                          \"to fail unexpectedly\")\n\n    parser.addoption(\"--cache-dir\", nargs='?', type=writeable_directory,\n                     help=\"specify directory for storing and retrieving the \"\n                          \"Astropy cache during tests (default is \"\n                          \"to use a temporary directory created by the test \"\n                          \"runner)\")\n    parser.addini(\"config_dir\",\n                  \"specify directory for storing and retrieving the \"\n                  \"Astropy configuration during tests (default is \"\n                  \"to use a temporary directory created by the test \"\n                  \"runner); be aware that using an Astropy config \"\n                  \"file other than the default can cause some tests \"\n                  \"to fail unexpectedly\", default=None)\n\n    parser.addini(\"cache_dir\",\n                  \"specify directory for storing and retrieving the \"\n                  \"Astropy cache during tests (default is \"\n                  \"to use a temporary directory created by the test \"\n                  \"runner)\", default=None)"},{"attributeType":"null","col":8,"comment":"null","endLoc":49,"id":7479,"name":"default_value","nodeType":"Attribute","startLoc":49,"text":"self.default_value"},{"col":0,"comment":"null","endLoc":54,"header":"def pytest_configure(config)","id":7480,"name":"pytest_configure","nodeType":"Function","startLoc":53,"text":"def pytest_configure(config):\n    treat_deprecations_as_exceptions()"},{"col":0,"comment":"null","endLoc":71,"header":"def pytest_runtest_setup(item)","id":7481,"name":"pytest_runtest_setup","nodeType":"Function","startLoc":56,"text":"def pytest_runtest_setup(item):\n    config_dir = item.config.getini('config_dir')\n    cache_dir = item.config.getini('cache_dir')\n\n    # Command-line options can override, however\n    config_dir = item.config.getoption('config_dir') or config_dir\n    cache_dir = item.config.getoption('cache_dir') or cache_dir\n\n    # We can't really use context managers directly in py.test (although\n    # py.test 2.7 adds the capability), so this may look a bit hacky\n    if config_dir:\n        item.set_temp_config = set_temp_config(config_dir)\n        item.set_temp_config.__enter__()\n    if cache_dir:\n        item.set_temp_cache = set_temp_cache(cache_dir)\n        item.set_temp_cache.__enter__()"},{"col":4,"comment":"null","endLoc":524,"header":"def range(self, lower, upper)","id":7482,"name":"range","nodeType":"Function","startLoc":523,"text":"def range(self, lower, upper):\n        return self.sliced_coords(self.index.range(lower, upper))"},{"attributeType":"null","col":8,"comment":"null","endLoc":50,"id":7483,"name":"priority","nodeType":"Attribute","startLoc":50,"text":"self.priority"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7484,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"runner.py#<anonymous>","id":7485,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Implements the Astropy TestRunner which is a thin wrapper around py.test.\"\"\"\n\n__all__ = ['TestRunner', 'TestRunnerBase', 'keyword']"},{"fileName":"__init__.py","filePath":"astropy/tests/plugins","id":7486,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis package contains pytest plugins that are used by the astropy test suite.\n\"\"\"\n"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":7487,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis package contains pytest plugins that are used by the astropy test suite.\n\"\"\""},{"id":7488,"name":"astropy/units","nodeType":"Package"},{"fileName":"deprecated.py","filePath":"astropy/units","id":7489,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":45,"id":7490,"name":"description","nodeType":"Attribute","startLoc":45,"text":"description"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":7491,"name":"user_options","nodeType":"Attribute","startLoc":47,"text":"user_options"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":7492,"name":"package_name","nodeType":"Attribute","startLoc":95,"text":"package_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":7493,"name":"coverage","nodeType":"Attribute","startLoc":107,"text":"self.coverage"},{"attributeType":"null","col":8,"comment":"null","endLoc":248,"id":7494,"name":"testing_path","nodeType":"Attribute","startLoc":248,"text":"self.testing_path"},{"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":121,"header":"def generate_unit_summary(namespace)","id":7495,"name":"generate_unit_summary","nodeType":"Function","startLoc":81,"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   * - ``{0}``\n     - {1}\n     - {2}\n     - {3}\n     - {4}\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()"},{"attributeType":"None","col":8,"comment":"null","endLoc":113,"id":7496,"name":"temp_root","nodeType":"Attribute","startLoc":113,"text":"self.temp_root"},{"attributeType":"None","col":8,"comment":"null","endLoc":98,"id":7497,"name":"package","nodeType":"Attribute","startLoc":98,"text":"self.package"},{"col":0,"comment":"null","endLoc":118,"header":"@pytest.fixture(params=[True, False])\ndef tableclass(request)","id":7499,"name":"tableclass","nodeType":"Function","startLoc":116,"text":"@pytest.fixture(params=[True, False])\ndef tableclass(request):\n    return table.Table if request.param else SubclassTable"},{"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":78,"header":"def _iter_unit_summary(namespace)","id":7500,"name":"_iter_unit_summary","nodeType":"Function","startLoc":39,"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 = \":math:`{0}`\".format(\n                unit._represents.to_string('latex')[1:-1])\n        aliases = ', '.join('``{0}``'.format(x) for x in unit.aliases)\n\n        yield (unit, doc, represents, aliases, 'Yes' if unit.name in has_prefixes else 'No')"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":7501,"name":"verbose_results","nodeType":"Attribute","startLoc":100,"text":"self.verbose_results"},{"col":0,"comment":"\n    Fixture to run all the tests for all available pickle protocols.\n    ","endLoc":126,"header":"@pytest.fixture(params=list(range(0, pickle.HIGHEST_PROTOCOL + 1)))\ndef protocol(request)","id":7502,"name":"protocol","nodeType":"Function","startLoc":121,"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"},{"attributeType":"None","col":8,"comment":"null","endLoc":101,"id":7503,"name":"plugins","nodeType":"Attribute","startLoc":101,"text":"self.plugins"},{"col":4,"comment":"null","endLoc":527,"header":"def same_prefix(self, key)","id":7504,"name":"same_prefix","nodeType":"Function","startLoc":526,"text":"def same_prefix(self, key):\n        return self.sliced_coords(self.index.same_prefix(key))"},{"col":0,"comment":"null","endLoc":138,"header":"@pytest.fixture(params=[False, True])\ndef table_type(request)","id":7505,"name":"table_type","nodeType":"Function","startLoc":131,"text":"@pytest.fixture(params=[False, True])\ndef table_type(request):\n    # return MaskedTable if request.param else table.Table\n    try:\n        request.param\n        return MaskedTable\n    except AttributeError:\n        return table.Table"},{"attributeType":"null","col":8,"comment":"null","endLoc":105,"id":7506,"name":"pep8","nodeType":"Attribute","startLoc":105,"text":"self.pep8"},{"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":173,"header":"@pytest.fixture(params=sorted(MIXIN_COLS))\ndef mixin_cols(request)","id":7507,"name":"mixin_cols","nodeType":"Function","startLoc":159,"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":8,"comment":"null","endLoc":111,"id":7508,"name":"skip_docs","nodeType":"Attribute","startLoc":111,"text":"self.skip_docs"},{"col":0,"comment":"null","endLoc":77,"header":"def pytest_runtest_teardown(item, nextitem)","id":7509,"name":"pytest_runtest_teardown","nodeType":"Function","startLoc":73,"text":"def pytest_runtest_teardown(item, nextitem):\n    if hasattr(item, 'set_temp_cache'):\n        item.set_temp_cache.__exit__()\n    if hasattr(item, 'set_temp_config'):\n        item.set_temp_config.__exit__()"},{"attributeType":"null","col":8,"comment":"null","endLoc":104,"id":7510,"name":"remote_data","nodeType":"Attribute","startLoc":104,"text":"self.remote_data"},{"attributeType":"null","col":8,"comment":"null","endLoc":106,"id":7511,"name":"pdb","nodeType":"Attribute","startLoc":106,"text":"self.pdb"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":7512,"name":"tmp_dir","nodeType":"Attribute","startLoc":235,"text":"self.tmp_dir"},{"attributeType":"None","col":8,"comment":"null","endLoc":103,"id":7513,"name":"args","nodeType":"Attribute","startLoc":103,"text":"self.args"},{"col":19,"endLoc":68,"id":7514,"nodeType":"Lambda","startLoc":68,"text":"lambda x: x.name.lower()"},{"attributeType":"null","col":30,"comment":"null","endLoc":18,"id":7515,"name":"importlib_machinery","nodeType":"Attribute","startLoc":18,"text":"importlib_machinery"},{"attributeType":"None","col":8,"comment":"null","endLoc":99,"id":7516,"name":"test_path","nodeType":"Attribute","startLoc":99,"text":"self.test_path"},{"col":0,"comment":"","endLoc":5,"header":"config.py#<anonymous>","id":7517,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis plugin provides customization of configuration and cache directories used\nby pytest.\n\"\"\""},{"col":0,"comment":"\n    Get the first sentence from a string and remove any carriage\n    returns.\n    ","endLoc":36,"header":"def _get_first_sentence(s)","id":7518,"name":"_get_first_sentence","nodeType":"Function","startLoc":27,"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', ' ')"},{"col":4,"comment":"null","endLoc":530,"header":"def sorted_data(self)","id":7519,"name":"sorted_data","nodeType":"Function","startLoc":529,"text":"def sorted_data(self):\n        return self.sliced_coords(self.index.sorted_data())"},{"fileName":"si.py","filePath":"astropy/units","id":7520,"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 ..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': 'μm'})\n\ndef_unit(['Angstrom', 'AA', 'angstrom'], 0.1 * nm, namespace=_ns,\n         doc=\"ångström: 10 ** -10 m\",\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\")\ndef_unit(['bar'], 1e5 * Pa, namespace=_ns,\n         doc=\"bar: 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 emittence\")\n\n###########################################################################\n# RADIOACTIVITY\n\ndef_unit(['Bq', 'becquerel'], Hz, 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":4,"comment":"null","endLoc":534,"header":"def replace(self, row, col, val)","id":7521,"name":"replace","nodeType":"Function","startLoc":532,"text":"def replace(self, row, col, val):\n        if not self._frozen:\n            self.index.replace(self.orig_coords(row), col, val)"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":7522,"name":"open_files","nodeType":"Attribute","startLoc":108,"text":"self.open_files"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":7523,"name":"parallel","nodeType":"Attribute","startLoc":109,"text":"self.parallel"},{"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 : `UnitBase` object\n        The newly-defined unit, or a matching unit that was already\n        defined.\n    ","endLoc":2262,"header":"def def_unit(s, represents=None, doc=None, format=None, prefixes=False,\n             exclude_prefixes=[], namespace=None)","id":7524,"name":"def_unit","nodeType":"Function","startLoc":2194,"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 : `UnitBase` object\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":"\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":160,"header":"def generate_prefixonly_unit_summary(namespace)","id":7525,"name":"generate_prefixonly_unit_summary","nodeType":"Function","startLoc":124,"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 ``{0}``\n     - {1} prefixes\n     - {2}\n     - {3}\n     - Only\n\"\"\".format(*unit_summary))\n\n    return docstring.getvalue()"},{"attributeType":"None","col":8,"comment":"null","endLoc":112,"id":7526,"name":"repeat","nodeType":"Attribute","startLoc":112,"text":"self.repeat"},{"attributeType":"None","col":8,"comment":"null","endLoc":110,"id":7527,"name":"docs_path","nodeType":"Attribute","startLoc":110,"text":"self.docs_path"},{"attributeType":"None","col":8,"comment":"null","endLoc":102,"id":7528,"name":"pastebin","nodeType":"Attribute","startLoc":102,"text":"self.pastebin"},{"col":0,"comment":"","endLoc":4,"header":"command.py#<anonymous>","id":7529,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nImplements the wrapper for the Astropy test runner in the form of the\n``./setup.py test`` distutils command.\n\"\"\""},{"col":0,"comment":"null","endLoc":37,"header":"def _initialize_module()","id":7530,"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)"},{"fileName":"cgs.py","filePath":"astropy/units","id":7531,"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":4,"comment":"null","endLoc":540,"header":"def copy(self)","id":7532,"name":"copy","nodeType":"Function","startLoc":536,"text":"def 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":545,"header":"def insert_row(self, pos, vals, columns)","id":7533,"name":"insert_row","nodeType":"Function","startLoc":542,"text":"def insert_row(self, pos, vals, columns):\n        if not self._frozen:\n            self.copy().insert_row(self.orig_coords(pos), vals,\n                                   columns)"},{"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":2191,"header":"def _add_prefixes(u, excludes=[], namespace=None, prefixes=False)","id":7534,"name":"_add_prefixes","nodeType":"Function","startLoc":2136,"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'] = 'μ' + 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":15,"id":7535,"name":"_ns","nodeType":"Attribute","startLoc":15,"text":"_ns"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":7536,"name":"g","nodeType":"Attribute","startLoc":18,"text":"g"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":7537,"name":"_ns","nodeType":"Attribute","startLoc":14,"text":"_ns"},{"col":4,"comment":"null","endLoc":549,"header":"def get_row_specifier(self, row_specifier)","id":7538,"name":"get_row_specifier","nodeType":"Function","startLoc":547,"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":0,"comment":"null","endLoc":223,"id":7539,"name":"bases","nodeType":"Attribute","startLoc":223,"text":"bases"},{"col":0,"comment":"","endLoc":7,"header":"si.py#<anonymous>","id":7540,"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': 'μm'})\n\ndef_unit(['Angstrom', 'AA', 'angstrom'], 0.1 * nm, namespace=_ns,\n         doc=\"ångström: 10 ** -10 m\",\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(['bar'], 1e5 * Pa, namespace=_ns,\n         doc=\"bar: 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 emittence\")\n\ndef_unit(['Bq', 'becquerel'], Hz, 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())"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7541,"name":"s","nodeType":"Attribute","startLoc":19,"text":"s"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7542,"name":"C","nodeType":"Attribute","startLoc":20,"text":"C"},{"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":7543,"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 sequences, dicts, or modules containing units, or units\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      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":387,"header":"def add_enabled_units(units)","id":7544,"name":"add_enabled_units","nodeType":"Function","startLoc":335,"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 sequences, dicts, or modules containing units, or units\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      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":4,"comment":"null","endLoc":553,"header":"def remove_rows(self, row_specifier)","id":7545,"name":"remove_rows","nodeType":"Function","startLoc":551,"text":"def remove_rows(self, row_specifier):\n        if not self._frozen:\n            self.copy().remove_rows(row_specifier)"},{"col":0,"comment":"Output a warning to IPython users in case any tests failed.","endLoc":131,"header":"def pytest_terminal_summary(terminalreporter)","id":7546,"name":"pytest_terminal_summary","nodeType":"Function","startLoc":111,"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 are known to 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        'http://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":0,"comment":"null","endLoc":21,"id":7547,"name":"rad","nodeType":"Attribute","startLoc":21,"text":"rad"},{"col":4,"comment":"null","endLoc":267,"header":"def __init__(self, init=[], equivalencies=[])","id":7548,"name":"__init__","nodeType":"Function","startLoc":265,"text":"def __init__(self, init=[], equivalencies=[]):\n        _unit_registries.append(\n            _UnitRegistry(init=init, equivalencies=equivalencies))"},{"col":0,"comment":"","endLoc":5,"header":"display.py#<anonymous>","id":7549,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nThis plugin provides customization of the header displayed by pytest for\nreporting purposes.\n\"\"\"\n\nPYTEST_HEADER_MODULES = OrderedDict([('Numpy', 'numpy'),\n                                     ('Scipy', 'scipy'),\n                                     ('Matplotlib', 'matplotlib'),\n                                     ('h5py', 'h5py'),\n                                     ('Pandas', 'pandas')])\n\nTESTED_VERSIONS = OrderedDict([('Astropy', __version__)])"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":7550,"name":"sr","nodeType":"Attribute","startLoc":22,"text":"sr"},{"fileName":"astrophys.py","filePath":"astropy/units","id":7551,"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 ..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⊙'})\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♃'})\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\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\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⊙'})\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♃'})\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⊕'})\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# 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###########################################################################\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\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# 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)\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((['pix', 'pixel'], ['pixel']),\n         format={'ogip': 'pixel', 'vounit': 'pixel'},\n         namespace=_ns, prefixes=True)\n\n\n###########################################################################\n# MISCELLANEOUS\n\ndef_unit(['chan'], namespace=_ns, prefixes=True)\ndef_unit(['bin'], namespace=_ns, prefixes=True)\ndef_unit((['vox', 'voxel'], ['voxel']),\n         format={'fits': 'voxel', 'ogip': 'voxel', 'vounit': 'voxel'},\n         namespace=_ns, prefixes=True)\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(['adu'], 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###########################################################################\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"},{"col":4,"comment":"null","endLoc":557,"header":"def replace_rows(self, col_slice)","id":7552,"name":"replace_rows","nodeType":"Function","startLoc":555,"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":4,"comment":"null","endLoc":129,"header":"def __init__(self, init=[], equivalencies=[])","id":7553,"name":"__init__","nodeType":"Function","startLoc":109,"text":"def __init__(self, init=[], equivalencies=[]):\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._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.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)"},{"attributeType":"null","col":0,"comment":"null","endLoc":2102,"id":7554,"name":"si_prefixes","nodeType":"Attribute","startLoc":2102,"text":"si_prefixes"},{"attributeType":"null","col":0,"comment":"null","endLoc":2126,"id":7555,"name":"binary_prefixes","nodeType":"Attribute","startLoc":2126,"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 sequences, dicts, or modules containing units, or units\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      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":332,"header":"def set_enabled_units(units)","id":7556,"name":"set_enabled_units","nodeType":"Function","startLoc":283,"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 sequences, dicts, or modules containing units, or units\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      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"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":7557,"name":"cd","nodeType":"Attribute","startLoc":23,"text":"cd"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":7558,"name":"K","nodeType":"Attribute","startLoc":24,"text":"K"},{"col":4,"comment":"null","endLoc":561,"header":"def sort(self)","id":7559,"name":"sort","nodeType":"Function","startLoc":559,"text":"def sort(self):\n        if not self._frozen:\n            self.copy().sort()"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":7560,"name":"deg_C","nodeType":"Attribute","startLoc":25,"text":"deg_C"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":7561,"name":"mol","nodeType":"Attribute","startLoc":26,"text":"mol"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7562,"name":"_ns","nodeType":"Attribute","startLoc":20,"text":"_ns"},{"col":4,"comment":"null","endLoc":567,"header":"def __repr__(self)","id":7563,"name":"__repr__","nodeType":"Function","startLoc":563,"text":"def __repr__(self):\n        if self.original:\n            return repr(self.index)\n        return 'Index slice {0} of\\n{1}'.format(\n            (self.start, self.stop, self.step), self.index)"},{"col":4,"comment":"null","endLoc":570,"header":"def __str__(self)","id":7564,"name":"__str__","nodeType":"Function","startLoc":569,"text":"def __str__(self):\n        return repr(self)"},{"col":4,"comment":"null","endLoc":573,"header":"def replace_col(self, prev_col, new_col)","id":7565,"name":"replace_col","nodeType":"Function","startLoc":572,"text":"def replace_col(self, prev_col, new_col):\n        self.index.replace_col(prev_col, new_col)"},{"col":0,"comment":"","endLoc":7,"header":"astrophys.py#<anonymous>","id":7566,"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\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\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(['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(['solMass', 'M_sun', 'Msun'], _si.M_sun, namespace=_ns,\n         prefixes=False, doc=\"Solar mass\",\n         format={'latex': r'M_{\\odot}', 'unicode': 'M⊙'})\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\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(['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(['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\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(['Sun'], namespace=_ns)\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((['pix', 'pixel'], ['pixel']),\n         format={'ogip': 'pixel', 'vounit': 'pixel'},\n         namespace=_ns, prefixes=True)\n\ndef_unit(['chan'], namespace=_ns, prefixes=True)\n\ndef_unit(['bin'], namespace=_ns, prefixes=True)\n\ndef_unit((['vox', 'voxel'], ['voxel']),\n         format={'fits': 'voxel', 'ogip': 'voxel', 'vounit': 'voxel'},\n         namespace=_ns, prefixes=True)\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(['adu'], 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())"},{"col":4,"comment":"null","endLoc":576,"header":"def reload(self)","id":7567,"name":"reload","nodeType":"Function","startLoc":575,"text":"def reload(self):\n        self.index.reload()"},{"col":4,"comment":"null","endLoc":579,"header":"def col_position(self, col_name)","id":7568,"name":"col_position","nodeType":"Function","startLoc":578,"text":"def col_position(self, col_name):\n        return self.index.col_position(col_name)"},{"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":598,"header":"def get_slice(self, col_slice, item)","id":7569,"name":"get_slice","nodeType":"Function","startLoc":581,"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            return Index([col_slice], engine=self.data.__class__)\n        t = Table(self.columns, copy_indices=False)\n        with t.index_mode('discard_on_copy'):\n            new_cols = t[item].columns.values()\n        return Index(new_cols, engine=self.data.__class__)"},{"col":0,"comment":"null","endLoc":193,"header":"@pytest.fixture(params=[False, True])\ndef T1(request)","id":7570,"name":"T1","nodeType":"Function","startLoc":176,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":116,"id":7571,"name":"bases","nodeType":"Attribute","startLoc":116,"text":"bases"},{"col":4,"comment":"null","endLoc":602,"header":"@property\n    def columns(self)","id":7572,"name":"columns","nodeType":"Function","startLoc":600,"text":"@property\n    def columns(self):\n        return self.index.columns"},{"col":4,"comment":"null","endLoc":606,"header":"@property\n    def data(self)","id":7573,"name":"data","nodeType":"Function","startLoc":604,"text":"@property\n    def data(self):\n        return self.index.data"},{"attributeType":"null","col":24,"comment":"null","endLoc":440,"id":7574,"name":"_stop","nodeType":"Attribute","startLoc":440,"text":"self._stop"},{"attributeType":"null","col":8,"comment":"null","endLoc":433,"id":7575,"name":"original","nodeType":"Attribute","startLoc":433,"text":"self.original"},{"attributeType":"null","col":8,"comment":"null","endLoc":434,"id":7576,"name":"_frozen","nodeType":"Attribute","startLoc":434,"text":"self._frozen"},{"attributeType":"null","col":12,"comment":"null","endLoc":440,"id":7577,"name":"start","nodeType":"Attribute","startLoc":440,"text":"self.start"},{"col":0,"comment":"","endLoc":7,"header":"cgs.py#<anonymous>","id":7578,"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())"},{"col":4,"comment":"null","endLoc":135,"header":"def _reset_units(self)","id":7579,"name":"_reset_units","nodeType":"Function","startLoc":131,"text":"def _reset_units(self):\n        self._all_units = set()\n        self._non_prefix_units = set()\n        self._registry = {}\n        self._by_physical_type = {}"},{"attributeType":"Index","col":8,"comment":"null","endLoc":432,"id":7580,"name":"index","nodeType":"Attribute","startLoc":432,"text":"self.index"},{"attributeType":"null","col":36,"comment":"null","endLoc":440,"id":7581,"name":"step","nodeType":"Attribute","startLoc":440,"text":"self.step"},{"col":0,"comment":"","endLoc":31,"header":"index.py#<anonymous>","id":7582,"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\"\"\""},{"fileName":"quantity.py","filePath":"astropy/units","id":7583,"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 warnings\n\nimport numpy as np\n\n# AstroPy\nfrom .core import (Unit, dimensionless_unscaled, get_current_unit_registry,\n                   UnitBase, UnitsError, UnitTypeError)\nfrom .format.latex import Latex\nfrom ..utils.compat import NUMPY_LT_1_13, NUMPY_LT_1_14\nfrom ..utils.compat.misc import override__dir__\nfrom ..utils.exceptions import AstropyDeprecationWarning\nfrom ..utils.misc import isiterable, InheritDocstrings\nfrom ..utils.data_info import ParentDtypeInfo\nfrom .. import config as _config\nfrom .quantity_helper import (converters_and_unit, can_have_arbitrary_unit,\n                              check_output)\n\n__all__ = [\"Quantity\", \"SpecificTypeQuantity\",\n           \"QuantityInfoBase\", \"QuantityInfo\"]\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\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 '{0.value:}'.format(val)\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\n    def _construct_from_dict(self, map):\n        # Need to pop value because different Quantity subclasses use\n        # different first arg name for the value.  :-(\n        value = map.pop('value')\n        return self._parent_cls(value, **map)\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 : 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\nclass Quantity(np.ndarray, metaclass=InheritDocstrings):\n    \"\"\"A `~astropy.units.Quantity` represents a number with some associated unit.\n\n    Parameters\n    ----------\n    value : number, `~numpy.ndarray`, `Quantity` object (sequence), 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 : `~astropy.units.UnitBase` instance, str\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 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`.  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 http://docs.astropy.org/en/latest/units/\n\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 __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            # 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        # 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:\n                if not copy:\n                    return value\n\n                if not np.can_cast(np.float32, value.dtype):\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 \"{0}\" as a {1}. 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 and\n                  all(isinstance(v, Quantity) for v in value)):\n                # Convert all quantities 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\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 {0!r} of the input could \"\n                                    \"not be parsed as an astropy Unit, raising \"\n                                    \"the following exception:\\n{1}\"\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=False, 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(() if value.ndim == 0 else 0),\n                            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 (not np.can_cast(np.float32, value.dtype)\n                              or value.dtype.kind == 'O'):\n            value = value.astype(float)\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        # 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.  Note that `obj` can be an\n        # ndarray which doesn't have a `__dict__`.\n        if 'info' in getattr(obj, '__dict__', ()):\n            self.info = obj.info\n\n    def __array_prepare__(self, obj, context=None):\n        # This method gets called by Numpy whenever a ufunc is called on the\n        # array. The object passed in ``obj`` is an empty version of the\n        # output array which we can e.g. change to an array sub-class, add\n        # attributes to, etc. After this is called, then the ufunc is called\n        # and the values in this empty array are set.\n\n        # In principle, this should not be needed any more in numpy >= 1.13,\n        # but it is still called in some np.linalg modules.\n\n        # If no context is set, just return the input\n        if context is None:\n            return obj\n\n        # Find out which ufunc is being used\n        function = context[0]\n        args = context[1][:function.nin]\n        # determine required converter 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\n        converters, result_unit = converters_and_unit(function, '__call__',\n                                                      *args)\n        if function.nout > 1:\n            result_unit = result_unit[context[2]]\n\n        # We now prepare the output object\n        if self is obj:\n            # this happens if the output object is self, which happens\n            # for in-place operations such as q1 += q2\n\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            # and that we can handle the type (e.g., that we are not int when\n            # float is required).\n            check_output(obj, result_unit, (args + tuple(\n                (np.float16 if converter and converter(1.) % 1. != 0.\n                 else np.int8)\n                for converter in converters)),\n                         function=function)\n            result = self  # no view needed since already a Quantity.\n\n            # in principle, if self is also an argument, it could be rescaled\n            # here, since it won't be needed anymore.  But maybe not change\n            # inputs before the calculation even if they will get destroyed\n\n        else:  # normal case: set up output as a Quantity\n\n            result = self._new_view(obj, result_unit)\n\n        # We now need to treat the case where the inputs have to be converted -\n        # the issue is that we can't actually convert the inputs since that\n        # would be changing the objects passed to the ufunc, which would not\n        # be expected by the user.\n        if any(converters):\n\n            # If self is both output and input (which happens for in-place\n            # operations), input will get overwritten with junk. To avoid\n            # that, hide it in a new object\n            if self is obj and any(self is arg for arg in args):\n                # but with two outputs it would become unhidden too soon\n                # [ie., np.modf(q1, q1, other)].  Bail.\n                if context[2] < function.nout - 1:\n                    raise TypeError(\"Cannot apply multi-output {0} function \"\n                                    \"to quantities with in-place replacement \"\n                                    \"of an input by any but the last output.\"\n                                    .format(function.__name__))\n\n                # If self is already contiguous, we don't need to do\n                # an additional copy back into the original array, so\n                # we store it in `result._result`.  Otherwise, we\n                # store it in `result._contiguous`.  `__array_wrap__`\n                # knows how to handle putting either form back into\n                # the original array.\n                if self.flags['C_CONTIGUOUS']:\n                    result = self.copy()\n                    result._result = self\n                else:\n                    result._contiguous = self.copy()\n\n            # ensure we remember the converter functions we need\n            result._converters = converters\n\n            if function in _UFUNCS_FILTER_WARNINGS:\n                # Filter out RuntimeWarning's caused by the ufunc being called on\n                # the unscaled quantity first (e.g., np.arcsin(15*u.pc/u.kpc))\n                self._catch_warnings = warnings.catch_warnings()\n                self._catch_warnings.__enter__()\n                warnings.filterwarnings('ignore',\n                                        message='invalid value encountered in',\n                                        category=RuntimeWarning)\n\n        # unit output will get (setting _unit could prematurely change input\n        # if obj is self, which happens for in-place operations; see above)\n        result._result_unit = result_unit\n\n        return result\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        else:\n            # with context defined, we are continuing after a ufunc evaluation.\n            if hasattr(obj, '_result_unit'):\n                result_unit = obj._result_unit\n                del obj._result_unit\n            else:\n                result_unit = None\n\n            # We now need to re-calculate quantities for which the input\n            # needed to be scaled.\n            if hasattr(obj, '_converters'):\n\n                converters = obj._converters\n                del obj._converters\n\n                if hasattr(self, '_catch_warnings'):\n                    self._catch_warnings.__exit__()\n                    del self._catch_warnings\n\n                # For in-place operations, input will get overwritten with\n                # junk. To avoid that, we hid it in a new object in\n                # __array_prepare__ and retrieve it here.\n                if hasattr(obj, '_result'):\n                    obj = obj._result\n                elif hasattr(obj, '_contiguous'):\n                    obj[()] = obj._contiguous\n                    del obj._contiguous\n\n                # take array view to which output can be written without\n                # getting back here\n                obj_array = obj.view(np.ndarray)\n\n                # Find out which ufunc was called and with which inputs\n                function = context[0]\n                args = context[1][:function.nin]\n\n                # Set the inputs, rescaling as necessary\n                inputs = []\n                for arg, converter in zip(args, converters):\n                    if converter:\n                        inputs.append(converter(arg.value))\n                    else:  # with no conversion, input can be non-Quantity.\n                        inputs.append(getattr(arg, 'value', arg))\n\n                # For output arrays that require scaling, we can reuse the\n                # output array to perform the scaling in place, as long as the\n                # array is not integral. Here, we set the obj_array to `None`\n                # when it cannot be used to store the scaled result.\n                # Use a try/except, since np.result_type can fail, which would\n                # break the wrapping #4770.\n                try:\n                    tmp_dtype = np.result_type(*inputs)\n                # Catch the appropriate exceptions: TypeError or ValueError in\n                # case the result_type raised an Exception, i.e. inputs is list\n                except (TypeError, ValueError):\n                    obj_array = None\n                else:\n                    # Explicitly check if it can store the result.\n                    if not (result_unit is None or\n                            np.can_cast(tmp_dtype, obj_array.dtype)):\n                        obj_array = None\n\n                # Re-compute the output using the ufunc\n                if context[2] == 0:\n                    inputs.append(obj_array)\n                else:\n                    inputs += [None, obj_array]\n                out = function(*inputs)\n                if obj_array is None:\n                    if function.nout > 1:\n                        out = out[context[2]]\n                    obj = self._new_view(out, result_unit)\n\n            if result_unit is None:  # return a plain array\n                return obj.view(np.ndarray)\n            elif obj is self:  # all OK now, so set unit.\n                obj._set_unit(result_unit)\n                return obj\n            else:\n                return obj\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 = tuple((converter(input_.value) if converter else\n                        getattr(input_, 'value', input_))\n                       for input_, converter in zip(inputs, converters))\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 : `~numpy.ndarray` or tuple of `~numpy.ndarray`\n            Array(s) which need to be turned into quantity.\n        unit : `~astropy.units.Unit` or None\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):\n            if out is None:\n                out = (None,) * len(result)\n            return tuple(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            - `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 : `UnitBase`, or anything convertible to a :class:`~astropy.units.Unit`, 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 : 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        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        if obj is None:\n            obj = self.view(np.ndarray)\n        else:\n            obj = np.array(obj, copy=False)\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            # 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):\n                raise UnitTypeError(\n                    \"{0} instances require {1} units, not {2} instances.\"\n                    .format(type(self).__name__, UnitBase, 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        return self.unit.to(unit, self.view(np.ndarray),\n                            equivalencies=equivalencies)\n\n    def to(self, unit, equivalencies=[]):\n        \"\"\"\n        Return a new `~astropy.units.Quantity` object with the specified unit.\n\n        Parameters\n        ----------\n        unit : `~astropy.units.UnitBase` instance, str\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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not\n            directly convertible.  See :ref:`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        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        return self._new_view(self._to_value(unit, equivalencies), 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 : `~astropy.units.UnitBase` instance or str, 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 equivalence pairs, optional\n            A list of equivalence pairs to try if the units are not directly\n            convertible (see :ref:`unit_equivalencies`). If not provided or\n            ``[]``, 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 : `~numpy.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        value = self.view(np.ndarray)\n        if unit is not None:\n            unit = Unit(unit)\n            if unit != self.unit:\n                value = self._to_value(unit, equivalencies)\n        return value if self.shape else value.item()\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    @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        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        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                \"'{0}' object has no '{1}' member\".format(\n                    self.__class__.__name__,\n                    attr))\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                \"{0} instance has no attribute '{1}'\".format(\n                    self.__class__.__name__, attr))\n        else:\n            return value\n\n    # Equality (return False if units do not match) needs to be handled\n    # explicitly for numpy >=1.9, since it no longer traps errors.\n    def __eq__(self, other):\n        try:\n            try:\n                return super().__eq__(other)\n            except DeprecationWarning:\n                # We treat the DeprecationWarning separately, since it may\n                # mask another Exception.  But we do not want to just use\n                # np.equal, since super's __eq__ treats recarrays correctly.\n                return np.equal(self, other)\n        except UnitsError:\n            return False\n        except TypeError:\n            return NotImplemented\n\n    def __ne__(self, other):\n        try:\n            try:\n                return super().__ne__(other)\n            except DeprecationWarning:\n                return np.not_equal(self, other)\n        except UnitsError:\n            return True\n        except TypeError:\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 __div__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__truediv__(other)\n\n    def __idiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__itruediv__(other)\n\n    def __rdiv__(self, other):\n        \"\"\" Division between `Quantity` objects. \"\"\"\n        return self.__rtruediv__(other)\n\n    if not hasattr(np, 'divmod'):  # NUMPY_LT_1_13\n        # In numpy 1.13, divmod goes via a ufunc and thus works without change.\n        def __divmod__(self, other):\n            other_value = self._to_own_unit(other)\n            result_tuple = divmod(self.value, other_value)\n\n            return (self._new_view(result_tuple[0], dimensionless_unscaled),\n                    self._new_view(result_tuple[1]))\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    # For Py>=3.5\n    def __matmul__(self, other, reverse=False):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(self.value, getattr(other, 'value', other))\n        return self._new_view(result_array, result_unit)\n\n    def __rmatmul__(self, other):\n        result_unit = self.unit * getattr(other, 'unit', dimensionless_unscaled)\n        result_array = np.matmul(getattr(other, 'value', other), self.value)\n        return self._new_view(result_array, result_unit)\n\n    if NUMPY_LT_1_13:\n        # Pre-numpy 1.13, there was no np.positive ufunc and the copy done\n        # by ndarray did not properly work for scalar quantities.\n        def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return self.copy()\n\n    else:\n        # In numpy 1.13, a np.positive ufunc exists, but ndarray.__pos__\n        # does not yet go through it, so we still need to define it, to allow\n        # subclasses to override it inside __array_ufunc__.\n        # Presumably, this can eventually be removed.\n        def __pos__(self):\n            \"\"\"Plus the quantity.\"\"\"\n            return np.positive(self)\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        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 type(out) is not type(self):\n            out = self._new_view(out)\n        return out\n\n    def __setitem__(self, i, value):\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    @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    # Display\n    # TODO: we may want to add a hook for dimensionless quantities?\n    def __str__(self):\n        return '{0}{1:s}'.format(self.value, self._unitstr)\n\n    def __repr__(self):\n        prefixstr = '<' + self.__class__.__name__ + ' '\n        sep = ',' if NUMPY_LT_1_14 else ', '\n        arrstr = np.array2string(self.view(np.ndarray), separator=sep,\n                                 prefix=prefixstr)\n        return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)\n\n    def _repr_latex_(self):\n        \"\"\"\n        Generate a latex 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        Returns\n        -------\n        lstr\n            A LaTeX string with the contents of this Quantity\n        \"\"\"\n        # need to do try/finally because \"threshold\" cannot be overridden\n        # with array2string\n        pops = np.get_printoptions()\n\n        format_spec = '.{}g'.format(pops['precision'])\n\n        def float_formatter(value):\n            return Latex.format_exponential_notation(value,\n                                                     format_spec=format_spec)\n\n        try:\n            formatter = {'float_kind': float_formatter}\n            if conf.latex_array_threshold > -1:\n                np.set_printoptions(threshold=conf.latex_array_threshold,\n                                    formatter=formatter)\n\n            # the view is needed for the scalar case - value might be float\n            if NUMPY_LT_1_14:   # style deprecated in 1.14\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    style=(float_formatter if self.dtype.kind == 'f'\n                           else repr),\n                    max_line_width=np.inf, separator=',~')\n            else:\n                latex_value = np.array2string(\n                    self.view(np.ndarray),\n                    max_line_width=np.inf, separator=',~')\n\n            latex_value = latex_value.replace('...', r'\\dots')\n        finally:\n            np.set_printoptions(**pops)\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        return r'${0} \\; {1}$'.format(latex_value, latex_unit)\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(\"{0}{1:s}\".format(value, self._unitstr),\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 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    # http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#array-conversion\n\n    def item(self, *args):\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.list()\")\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, so 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                _value = Quantity(value).to_value(self.unit)\n            except UnitsError as exc:\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(value)):\n                    _value = value\n                else:\n                    raise exc\n\n        if check_precision:\n            value_dtype = getattr(value, 'dtype', None)\n            if self.dtype != value_dtype:\n                self_dtype_array = np.array(_value, self.dtype)\n                value_dtype_array = np.array(_value, dtype=value_dtype,\n                                             copy=False)\n                if not np.all(np.logical_or(self_dtype_array ==\n                                            value_dtype_array,\n                                            np.isnan(value_dtype_array))):\n                    raise TypeError(\"cannot convert value type to array type \"\n                                    \"without precision loss\")\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 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    # take, repeat, sort, compress, diagonal OK\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    # 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 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\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):\n        return self._wrap_function(np.var, axis, dtype,\n                                   out=out, ddof=ddof, unit=self.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\n    def mean(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.mean, axis, dtype, out=out)\n\n    def ptp(self, axis=None, out=None):\n        return self._wrap_function(np.ptp, axis, out=out)\n\n    def round(self, decimals=0, out=None):\n        return self._wrap_function(np.round, decimals, out=out)\n\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 prod(self, axis=None, dtype=None, out=None, keepdims=False):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use prod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.prod, axis, dtype, out=out,\n                                   keepdims=keepdims)\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    def cumsum(self, axis=None, dtype=None, out=None):\n        return self._wrap_function(np.cumsum, axis, dtype, out=out)\n\n    def cumprod(self, axis=None, dtype=None, out=None):\n        if not self.unit.is_unity():\n            raise ValueError(\"cannot use cumprod on scaled or \"\n                             \"non-dimensionless Quantity arrays\")\n        return self._wrap_function(np.cumprod, axis, dtype, out=out)\n\n    # Calculation: override methods that do not make sense.\n\n    def all(self, axis=None, out=None):\n        raise NotImplementedError(\"cannot evaluate truth value of quantities. \"\n                                  \"Evaluate array with q.value.all(...)\")\n\n    def any(self, axis=None, out=None):\n        raise NotImplementedError(\"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 ints\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 uninitalized 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                \"{0} instances require units equivalent to '{1}'\"\n                .format(type(self).__name__, self._equivalent_unit) +\n                (\", but no unit was given.\" if unit is None else\n                 \", so cannot set it to '{0}'.\".format(unit)))\n\n        super()._set_unit(unit)\n"},{"col":4,"comment":"null","endLoc":138,"header":"def _reset_equivalencies(self)","id":7584,"name":"_reset_equivalencies","nodeType":"Function","startLoc":137,"text":"def _reset_equivalencies(self):\n        self._equivalencies = set()"},{"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 sequences, dicts, or modules containing units, or units\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":207,"header":"def add_enabled_units(self, units)","id":7585,"name":"add_enabled_units","nodeType":"Function","startLoc":171,"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 sequences, dicts, or modules containing units, or units\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 {0!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)"},{"col":0,"comment":"null","endLoc":198,"header":"@pytest.fixture(params=[Table, QTable])\ndef operation_table_type(request)","id":7586,"name":"operation_table_type","nodeType":"Function","startLoc":196,"text":"@pytest.fixture(params=[Table, QTable])\ndef operation_table_type(request):\n    return request.param"},{"fileName":"imperial.py","filePath":"astropy/units","id":7587,"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'})\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":2298,"id":7588,"name":"dimensionless_unscaled","nodeType":"Attribute","startLoc":2298,"text":"dimensionless_unscaled"},{"attributeType":"null","col":16,"comment":"null","endLoc":23,"id":7589,"name":"np","nodeType":"Attribute","startLoc":23,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":28,"id":7590,"name":"u","nodeType":"Attribute","startLoc":28,"text":"u"},{"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":477,"id":7591,"nodeType":"Class","startLoc":471,"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    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":143,"id":7592,"name":"MIXIN_COLS","nodeType":"Attribute","startLoc":143,"text":"MIXIN_COLS"},{"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":123,"id":7593,"nodeType":"Class","startLoc":13,"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            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append('{0}^{{{1}}}'.format(\n                    cls._get_unit_name(base),\n                    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 = r'\\frac{{{0}}}{{{1}}}'.format(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 r'$\\mathrm{{{0}}}$'.format(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(\"10^{{{0}}}\".format(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'"},{"col":0,"comment":"","endLoc":16,"header":"conftest.py#<anonymous>","id":7594,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nAll of the py.test fixtures used by astropy.table are defined here.\n\nThe fixtures can not be defined in the modules that use them, because\nthose modules are imported twice: once with `from __future__ import\nunicode_literals` and once without.  py.test complains when the same\nfixtures are defined more than once.\n\n`conftest.py` is a \"special\" module name for py.test 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              'skycoord': coordinates.SkyCoord(ra=[0, 1, 2, 3] * u.deg,\n                                               dec=[0, 1, 2, 3] * u.deg),\n              'arraywrap': table_helpers.ArrayWrapper([0, 1, 2, 3]),\n              'ndarray': 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'])"},{"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":167,"header":"def enable()","id":7595,"name":"enable","nodeType":"Function","startLoc":154,"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":"utils.py","filePath":"astropy/units","id":7596,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nMiscellaneous utilities for `astropy.units`.\n\nNone of the functions in the module are meant for use outside of the\npackage.\n\"\"\"\n\n\nimport numbers\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 = \":math:`{0}`\".format(\n                unit._represents.to_string('latex')[1:-1])\n        aliases = ', '.join('``{0}``'.format(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   * - ``{0}``\n     - {1}\n     - {2}\n     - {3}\n     - {4}\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 ``{0}``\n     - {1} prefixes\n     - {2}\n     - {3}\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    if np.iscomplex(scale):  # scale is complex\n        if scale == 0.0:\n            return 0.0\n\n        if abs(scale.real) > abs(scale.imag):\n            if is_effectively_unity(scale.imag/scale.real + 1):\n                scale = scale.real\n        else:\n            if is_effectively_unity(scale.real/scale.imag + 1):\n                scale = complex(0., scale.imag)\n\n    return scale\n\n\ndef validate_power(p, support_tuples=False):\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    if isinstance(p, (numbers.Rational, Fraction)):\n        denom = p.denominator\n        if denom == 1:\n            p = int(p.numerator)\n        # This is bit-twiddling hack to see if the integer is a\n        # power of two\n        elif (denom & (denom - 1)) == 0:\n            p = float(p)\n    else:\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        if (p % 1.0) == 0.0:\n            # Denominators of 1 can just be integers.\n            p = int(p)\n        elif (p * 8.0) % 1.0 == 0.0:\n            # Leave alone if the denominator is exactly 2, 4 or 8, since this\n            # can be perfectly represented as a float, which means subsequent\n            # operations are much faster.\n            pass\n        else:\n            # Convert floats indistinguishable from a rational to Fraction.\n            # Here, we do not need to test values that are divisors of a higher\n            # number, such as 3, since it is already addressed by 6.\n            for i in (10, 9, 7, 6):\n                scaled = p * float(i)\n                if((scaled + 4. * _float_finfo.eps) % 1.0 <\n                   8. * _float_finfo.eps):\n                    p = Fraction(int(round(scaled)), i)\n                    break\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    This ensures that any operation involving a Fraction will use\n    rational arithmetic and preserve precision.\n    \"\"\"\n    a_is_fraction = isinstance(a, Fraction)\n    b_is_fraction = isinstance(b, Fraction)\n    if a_is_fraction and not b_is_fraction:\n        b = Fraction(b)\n    elif not a_is_fraction and b_is_fraction:\n        a = 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":20,"id":7597,"name":"_float_finfo","nodeType":"Attribute","startLoc":20,"text":"_float_finfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":7598,"name":"_JUST_BELOW_UNITY","nodeType":"Attribute","startLoc":23,"text":"_JUST_BELOW_UNITY"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":7599,"name":"_JUST_ABOVE_UNITY","nodeType":"Attribute","startLoc":24,"text":"_JUST_ABOVE_UNITY"},{"col":0,"comment":"","endLoc":8,"header":"utils.py#<anonymous>","id":7600,"name":"<anonymous>","nodeType":"Function","startLoc":3,"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)"},{"fileName":"quantity_helper.py","filePath":"astropy/units","id":7601,"nodeType":"File","text":"# The idea for this module (but no code) was borrowed from the\n# quantities (http://pythonhosted.org/quantities/) package.\n\nfrom fractions import Fraction\n\nimport numpy as np\nfrom .core import (UnitsError, UnitConversionError, UnitTypeError,\n                   dimensionless_unscaled, get_current_unit_registry)\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    try:\n        scale = from_unit._to(to_unit)\n    except UnitsError:\n        return from_unit._apply_equivalencies(\n                from_unit, to_unit, get_current_unit_registry().equivalencies)\n    except AttributeError:\n        raise UnitTypeError(\"Unit '{0}' cannot be converted to '{1}'\"\n                            .format(from_unit, to_unit))\n    if scale == 1.:\n        return None\n    else:\n        return lambda val: scale * val\n\n\nUFUNC_HELPERS = {}\n\n# In this file, we implement the logic that determines for a given ufunc and\n# input how the input should be scaled and what unit the output will have.\n\n# list of ufuncs:\n# http://docs.scipy.org/doc/numpy/reference/ufuncs.html#available-ufuncs\n\nUNSUPPORTED_UFUNCS = set([np.bitwise_and, np.bitwise_or,\n                          np.bitwise_xor, np.invert, np.left_shift,\n                          np.right_shift, np.logical_and, np.logical_or,\n                          np.logical_xor, np.logical_not])\nif isinstance(getattr(np, 'isnat', None), np.ufunc):\n    UNSUPPORTED_UFUNCS |= {np.isnat}\n\n# SINGLE ARGUMENT UFUNCS\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 function should be two values: the\n# scale by which the input needs to be multiplied before being passed to the\n# ufunc, and the unit the output will be in.\n\n# ufuncs that return a boolean and do not care about the unit\nhelper_onearg_test = lambda f, unit: ([None], None)\n\nUFUNC_HELPERS[np.isfinite] = helper_onearg_test\nUFUNC_HELPERS[np.isinf] = helper_onearg_test\nUFUNC_HELPERS[np.isnan] = helper_onearg_test\nUFUNC_HELPERS[np.sign] = helper_onearg_test\nUFUNC_HELPERS[np.signbit] = helper_onearg_test\n\n# ufuncs that return a value with the same unit as the input\n\nhelper_invariant = lambda f, unit: ([None], _d(unit))\n\nUFUNC_HELPERS[np.absolute] = helper_invariant\nUFUNC_HELPERS[np.fabs] = helper_invariant\nUFUNC_HELPERS[np.conj] = helper_invariant\nUFUNC_HELPERS[np.conjugate] = helper_invariant\nUFUNC_HELPERS[np.negative] = helper_invariant\nUFUNC_HELPERS[np.spacing] = helper_invariant\nUFUNC_HELPERS[np.rint] = helper_invariant\nUFUNC_HELPERS[np.floor] = helper_invariant\nUFUNC_HELPERS[np.ceil] = helper_invariant\nUFUNC_HELPERS[np.trunc] = helper_invariant\n# positive only was added in numpy 1.13\nif isinstance(getattr(np, 'positive', None), np.ufunc):\n    UFUNC_HELPERS[np.positive] = helper_invariant\n\n# ufuncs handled as special cases\n\nUFUNC_HELPERS[np.sqrt] = lambda f, unit: (\n    [None], unit ** 0.5 if unit is not None else dimensionless_unscaled)\nUFUNC_HELPERS[np.square] = lambda f, unit: (\n    [None], unit ** 2 if unit is not None else dimensionless_unscaled)\nUFUNC_HELPERS[np.reciprocal] = lambda f, unit: (\n    [None], unit ** -1 if unit is not None else dimensionless_unscaled)\n\nUFUNC_HELPERS[np.cbrt] = lambda f, unit: (\n    [None], (unit ** Fraction(1, 3) if unit is not None\n             else dimensionless_unscaled))\nUFUNC_HELPERS[np.core.umath._ones_like] = (lambda f, unit:\n                                           ([None], dimensionless_unscaled))\n\n# ufuncs that require dimensionless input and and give dimensionless output\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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.exp] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.expm1] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.exp2] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.log] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.log10] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.log2] = helper_dimensionless_to_dimensionless\nUFUNC_HELPERS[np.log1p] = helper_dimensionless_to_dimensionless\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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.modf] = helper_modf\n\n\n# ufuncs that require dimensionless input and give output in radians\ndef helper_dimensionless_to_radian(f, unit):\n    from .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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.arccos] = helper_dimensionless_to_radian\nUFUNC_HELPERS[np.arcsin] = helper_dimensionless_to_radian\nUFUNC_HELPERS[np.arctan] = helper_dimensionless_to_radian\nUFUNC_HELPERS[np.arccosh] = helper_dimensionless_to_radian\nUFUNC_HELPERS[np.arcsinh] = helper_dimensionless_to_radian\nUFUNC_HELPERS[np.arctanh] = helper_dimensionless_to_radian\n\n\n# ufuncs that require input in degrees and give output in radians\ndef helper_degree_to_radian(f, unit):\n    from .si import degree, radian\n    try:\n        return [get_converter(unit, degree)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.radians] = helper_degree_to_radian\nUFUNC_HELPERS[np.deg2rad] = helper_degree_to_radian\n\n\n# ufuncs that require input in radians and give output in degrees\ndef helper_radian_to_degree(f, unit):\n    from .si import degree, radian\n    try:\n        return [get_converter(unit, radian)], degree\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.degrees] = helper_radian_to_degree\nUFUNC_HELPERS[np.rad2deg] = helper_radian_to_degree\n\n\n# ufuncs that require input in radians and give dimensionless output\ndef helper_radian_to_dimensionless(f, unit):\n    from .si import radian\n    try:\n        return [get_converter(unit, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))\n\n\nUFUNC_HELPERS[np.cos] = helper_radian_to_dimensionless\nUFUNC_HELPERS[np.sin] = helper_radian_to_dimensionless\nUFUNC_HELPERS[np.tan] = helper_radian_to_dimensionless\nUFUNC_HELPERS[np.cosh] = helper_radian_to_dimensionless\nUFUNC_HELPERS[np.sinh] = helper_radian_to_dimensionless\nUFUNC_HELPERS[np.tanh] = helper_radian_to_dimensionless\n\n\n# ufuncs that require dimensionless_unscaled input and return non-quantities\ndef helper_frexp(f, unit):\n    if not unit.is_unity():\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"unscaled dimensionless quantities\"\n                            .format(f.__name__))\n    return [None], (None, None)\n\n\nUFUNC_HELPERS[np.frexp] = helper_frexp\n\n\n# TWO ARGUMENT UFUNCS\ndef helper_multiplication(f, unit1, unit2):\n    return [None, None], _d(unit1) * _d(unit2)\n\n\nUFUNC_HELPERS[np.multiply] = helper_multiplication\n\n\ndef helper_division(f, unit1, unit2):\n    return [None, None], _d(unit1) / _d(unit2)\n\n\nUFUNC_HELPERS[np.divide] = helper_division\nUFUNC_HELPERS[np.true_divide] = helper_division\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\nUFUNC_HELPERS[np.power] = helper_power\n# float_power was added in numpy 1.12\nif isinstance(getattr(np, 'float_power', None), np.ufunc):\n    UFUNC_HELPERS[np.float_power] = helper_power\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\nUFUNC_HELPERS[np.ldexp] = helper_ldexp\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\nUFUNC_HELPERS[np.copysign] = helper_copysign\n\n# heaviside only was added in numpy 1.13\nif isinstance(getattr(np, 'heaviside', None), np.ufunc):\n    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)\n\n    UFUNC_HELPERS[np.heaviside] = helper_heaviside\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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n    return ([converter1, converter2], dimensionless_unscaled)\n\n\nUFUNC_HELPERS[np.logaddexp] = helper_two_arg_dimensionless\nUFUNC_HELPERS[np.logaddexp2] = helper_two_arg_dimensionless\n\n\ndef get_converters_and_unit(f, *units):\n\n    converters = [None, None]\n    # no units for any input -- e.g., np.add(a1, a2, out=q)\n    if all(unit is None for unit in units):\n        return converters, dimensionless_unscaled\n\n    fixed, changeable = (1, 0) if units[1] is None else (0, 1)\n    if units[fixed] is None:\n        try:\n            converters[changeable] = get_converter(units[changeable],\n                                                   dimensionless_unscaled)\n        except UnitsError:\n            # special case: would be OK if unitless number is zero, inf, nan\n            converters[fixed] = False\n            return converters, units[changeable]\n        else:\n            return converters, dimensionless_unscaled\n\n    else:\n        try:\n            converters[changeable] = get_converter(units[changeable],\n                                                   units[fixed])\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{0}' function to quantities \"\n                \"with compatible dimensions\"\n                .format(f.__name__))\n\n        return converters, units[fixed]\n\n\ndef helper_twoarg_invariant(f, unit1, unit2):\n    return get_converters_and_unit(f, unit1, unit2)\n\n\nUFUNC_HELPERS[np.add] = helper_twoarg_invariant\nUFUNC_HELPERS[np.subtract] = helper_twoarg_invariant\nUFUNC_HELPERS[np.hypot] = helper_twoarg_invariant\nUFUNC_HELPERS[np.maximum] = helper_twoarg_invariant\nUFUNC_HELPERS[np.minimum] = helper_twoarg_invariant\nUFUNC_HELPERS[np.fmin] = helper_twoarg_invariant\nUFUNC_HELPERS[np.fmax] = helper_twoarg_invariant\nUFUNC_HELPERS[np.nextafter] = helper_twoarg_invariant\nUFUNC_HELPERS[np.remainder] = helper_twoarg_invariant\nUFUNC_HELPERS[np.mod] = helper_twoarg_invariant\nUFUNC_HELPERS[np.fmod] = helper_twoarg_invariant\n\n\ndef helper_twoarg_comparison(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, None\n\n\nUFUNC_HELPERS[np.greater] = helper_twoarg_comparison\nUFUNC_HELPERS[np.greater_equal] = helper_twoarg_comparison\nUFUNC_HELPERS[np.less] = helper_twoarg_comparison\nUFUNC_HELPERS[np.less_equal] = helper_twoarg_comparison\nUFUNC_HELPERS[np.not_equal] = helper_twoarg_comparison\nUFUNC_HELPERS[np.equal] = helper_twoarg_comparison\n\n\ndef helper_twoarg_invtrig(f, unit1, unit2):\n    from .si import radian\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, radian\n\n\nUFUNC_HELPERS[np.arctan2] = helper_twoarg_invtrig\n# another private function in numpy; use getattr in case it disappears\nif isinstance(getattr(np.core.umath, '_arg', None), np.ufunc):\n    UFUNC_HELPERS[np.core.umath._arg] = helper_twoarg_invtrig\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\nUFUNC_HELPERS[np.floor_divide] = helper_twoarg_floor_divide\n\n# divmod only was added in numpy 1.13\nif isinstance(getattr(np, 'divmod', None), np.ufunc):\n    def 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    UFUNC_HELPERS[np.divmod] = helper_divmod\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    `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 : Quantity or other 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    # Check whether we even support this ufunc\n    if function in UNSUPPORTED_UFUNCS:\n        raise TypeError(\"Cannot use function '{0}' with quantities\"\n                        .format(function.__name__))\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        # If the ufunc is supported, then we call a helper function (defined\n        # above) which returns a list of function(s) that converts the input(s)\n        # to the unit required for the ufunc, as well as the unit the output\n        # will have (this is a tuple of units if there are multiple outputs).\n        if function in UFUNC_HELPERS:\n            converters, result_unit = UFUNC_HELPERS[function](function, *units)\n        else:\n            raise TypeError(\"Unknown ufunc {0}.  Please raise issue on \"\n                            \"https://github.com/astropy/astropy\"\n                            .format(function.__name__))\n\n        if any(converter is False for converter in converters):\n            # for two-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            maybe_arbitrary_arg = args[converters.index(False)]\n            try:\n                if can_have_arbitrary_unit(maybe_arbitrary_arg):\n                    converters = [None, None]\n                else:\n                    raise UnitsError(\"Can only apply '{0}' 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 {0}: \"\n                                \"'{1}' and '{2}'\"\n                                .format(function.__name__,\n                                        args[0].__class__.__name__,\n                                        args[1].__class__.__name__))\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        if method == 'at':\n            unit = getattr(args[0], 'unit', None)\n            units = [unit]\n            if function.nin == 2:\n                units.append(getattr(args[2], 'unit', None))\n\n            converters, result_unit = UFUNC_HELPERS[function](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\n              function.nin == 2):\n            unit = getattr(args[0], 'unit', None)\n            converters, result_unit = UFUNC_HELPERS[function](function,\n                                                              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', 'reduceat',\n                          'outer') and function.nin != 2:\n                raise ValueError(\"{0} only supported for binary functions\"\n                                 .format(method))\n\n            raise TypeError(\"Unexpected ufunc method {0}.  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 (unit is not None and\n                                         (not result_unit.is_equivalent(unit) or\n                                          result_unit.to(unit) != 1.)):\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 : `~numpy.ndarray` view of ``output`` (or tuple of such views).\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{0} in {1} \"\n                            \"instance\".format(\n                                (\" from {0} function\".format(function.__name__)\n                                 if function is not None else \"\"),\n                                type(output)))\n\n        if output.__quantity_subclass__(unit)[0] is not type(output):\n            raise UnitTypeError(\n                \"Cannot store output with unit '{0}'{1} \"\n                \"in {2} instance.  Use {3} instance instead.\"\n                .format(unit, (\" from {0} function\".format(function.__name__)\n                               if function is not None else \"\"), type(output),\n                        output.__quantity_subclass__(unit)[0]))\n\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        output = output.view(np.ndarray)\n    else:\n        # output is not a Quantity, so cannot attain a unit.\n        if not (unit is None or unit is dimensionless_unscaled):\n            raise UnitTypeError(\"Cannot store quantity with dimension \"\n                                \"{0}in a non-Quantity instance.\"\n                                .format(\"\" if function is None else\n                                        \"resulting from {0} function \"\n                                        .format(function.__name__)))\n\n    # check we can handle the dtype (e.g., that we are not int\n    # when float is required).\n    if not np.can_cast(np.result_type(*inputs), output.dtype,\n                       casting='same_kind'):\n        raise TypeError(\"Arguments cannot be cast safely to inplace \"\n                        \"output with dtype={0}\".format(output.dtype))\n    return output\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":7602,"name":"_ns","nodeType":"Attribute","startLoc":25,"text":"_ns"},{"col":0,"comment":"null","endLoc":15,"header":"def _d(unit)","id":7603,"name":"_d","nodeType":"Function","startLoc":11,"text":"def _d(unit):\n    if unit is None:\n        return dimensionless_unscaled\n    else:\n        return unit"},{"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":32,"header":"def get_converter(from_unit, to_unit)","id":7604,"name":"get_converter","nodeType":"Function","startLoc":18,"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    try:\n        scale = from_unit._to(to_unit)\n    except UnitsError:\n        return from_unit._apply_equivalencies(\n                from_unit, to_unit, get_current_unit_registry().equivalencies)\n    except AttributeError:\n        raise UnitTypeError(\"Unit '{0}' cannot be converted to '{1}'\"\n                            .format(from_unit, to_unit))\n    if scale == 1.:\n        return None\n    else:\n        return lambda val: scale * val"},{"attributeType":"null","col":44,"comment":"null","endLoc":149,"id":7605,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":149,"text":"_generate_unit_summary"},{"col":0,"comment":"","endLoc":19,"header":"imperial.py#<anonymous>","id":7606,"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\ndel UnitBase\n\ndel def_unit\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"fileName":"cds.py","filePath":"astropy/units","id":7607,"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://cds.u-strasbg.fr/doc/catstd-3.2.htx>`_ format and the `complete\nset of supported units <http://vizier.u-strasbg.fr/cgi-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 .. import units as u\n    from ..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: http://vizier.u-strasbg.fr/cgi-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        (['arcm', 'arcmin'], u.arcminute, \"minute of arc\"),\n        (['arcs', 'arcsec'], 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":15,"endLoc":32,"id":7608,"nodeType":"Lambda","startLoc":32,"text":"lambda val: scale * val"},{"col":0,"comment":"null","endLoc":112,"header":"def helper_dimensionless_to_dimensionless(f, unit)","id":7609,"name":"helper_dimensionless_to_dimensionless","nodeType":"Function","startLoc":102,"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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"className":"Base","col":0,"comment":"\n    The abstract base class of all unit formats.\n    ","endLoc":48,"id":7610,"nodeType":"Class","startLoc":21,"text":"class Base(metaclass=_FormatterMeta):\n    \"\"\"\n    The abstract base class of all unit formats.\n    \"\"\"\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    @classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not parse {0}\".format(cls.__name__))\n\n    @classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not output in {0} format\".format(cls.__name__))"},{"col":0,"comment":"null","endLoc":157,"header":"def _initialize_module()","id":7611,"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 .. import units as u\n    from ..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: http://vizier.u-strasbg.fr/cgi-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        (['arcm', 'arcmin'], u.arcminute, \"minute of arc\"),\n        (['arcs', 'arcsec'], 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":0,"comment":"null","endLoc":134,"header":"def helper_modf(f, unit)","id":7612,"name":"helper_modf","nodeType":"Function","startLoc":124,"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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"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 equivalent pairs\n            E.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        ","endLoc":261,"header":"def add_enabled_equivalencies(self, equivalencies)","id":7613,"name":"add_enabled_equivalencies","nodeType":"Function","startLoc":243,"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 equivalent pairs\n            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":"null","endLoc":30,"header":"def __new__(cls, *args, **kwargs)","id":7614,"name":"__new__","nodeType":"Function","startLoc":26,"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":"\n        Convert a string to a unit object.\n        ","endLoc":39,"header":"@classmethod\n    def parse(cls, s)","id":7615,"name":"parse","nodeType":"Function","startLoc":32,"text":"@classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not parse {0}\".format(cls.__name__))"},{"col":0,"comment":"null","endLoc":151,"header":"def helper_dimensionless_to_radian(f, unit)","id":7616,"name":"helper_dimensionless_to_radian","nodeType":"Function","startLoc":141,"text":"def helper_dimensionless_to_radian(f, unit):\n    from .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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":7617,"name":"_ns","nodeType":"Attribute","startLoc":21,"text":"_ns"},{"col":0,"comment":"null","endLoc":170,"header":"def helper_degree_to_radian(f, unit)","id":7618,"name":"helper_degree_to_radian","nodeType":"Function","startLoc":163,"text":"def helper_degree_to_radian(f, unit):\n    from .si import degree, radian\n    try:\n        return [get_converter(unit, degree)], radian\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"col":4,"comment":"\n        Convert a unit object to a string.\n        ","endLoc":48,"header":"@classmethod\n    def to_string(cls, u)","id":7619,"name":"to_string","nodeType":"Function","startLoc":41,"text":"@classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not output in {0} format\".format(cls.__name__))"},{"attributeType":"null","col":45,"comment":"null","endLoc":48,"id":7620,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":48,"text":"_generate_unit_summary"},{"attributeType":"null","col":56,"comment":"null","endLoc":49,"id":7621,"name":"_generate_prefixonly_unit_summary","nodeType":"Attribute","startLoc":49,"text":"_generate_prefixonly_unit_summary"},{"col":0,"comment":"","endLoc":19,"header":"deprecated.py#<anonymous>","id":7622,"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())"},{"fileName":"__init__.py","filePath":"astropy/units","id":7623,"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\nfrom .core import *\nfrom .quantity import *\nfrom .decorators import *\n\nfrom . import si\nfrom . import cgs\nfrom . import astrophys\nfrom .function import units as function_units\n\nfrom .si import *\nfrom .astrophys import *\nfrom .cgs import *\nfrom .physical import *\nfrom .function.units import *\n\nfrom .equivalencies import *\n\nfrom .function.core import *\nfrom .function.logarithmic import *\nfrom .function import magnitude_zero_points\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])\n"},{"col":0,"comment":"null","endLoc":185,"header":"def helper_radian_to_degree(f, unit)","id":7624,"name":"helper_radian_to_degree","nodeType":"Function","startLoc":178,"text":"def helper_radian_to_degree(f, unit):\n    from .si import degree, radian\n    try:\n        return [get_converter(unit, radian)], degree\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"fileName":"physical.py","filePath":"astropy/units","id":7625,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nDefines physical unit names.\n\nThis module is not intended for use by user code directly.  Instead,\nthe physical unit name of a `Unit` can be obtained using its `ptype`\nproperty.\n\"\"\"\n\n\nfrom . import core\nfrom . import si\nfrom . import astrophys\nfrom . import cgs\nfrom . import imperial\n\n\n__all__ = ['def_physical_type', 'get_physical_type']\n\n\n_physical_unit_mapping = {}\n_unit_physical_mapping = {}\n\n\ndef def_physical_type(unit, name):\n    \"\"\"\n    Adds a new physical unit mapping.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to map from.\n\n    name : str\n        The physical name of the unit.\n    \"\"\"\n    r = unit._get_physical_type_id()\n    if r in _physical_unit_mapping:\n        raise ValueError(\n            \"{0!r} ({1!r}) already defined as {2!r}\".format(\n                r, name, _physical_unit_mapping[r]))\n    _physical_unit_mapping[r] = name\n    _unit_physical_mapping[name] = r\n\n\ndef get_physical_type(unit):\n    \"\"\"\n    Given a unit, returns the name of the physical quantity it\n    represents.  If it represents an unknown physical quantity,\n    ``\"unknown\"`` is returned.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to lookup\n\n    Returns\n    -------\n    physical : str\n        The name of the physical quantity, or unknown if not\n        known.\n    \"\"\"\n    r = unit._get_physical_type_id()\n    return _physical_unit_mapping.get(r, 'unknown')\n\n\nfor unit, name in [\n    (core.Unit(1), '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'),\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.deg_C, 'temperature'),\n    (imperial.deg_F, 'temperature'),\n    (si.N, 'force'),\n    (si.J, 'energy'),\n    (si.Pa, 'pressure'),\n    (si.W, 'power'),\n    (si.kg / si.m ** 3, 'mass density'),\n    (si.m ** 3 / si.kg, 'specific volume'),\n    (si.mol / si.m ** 3, 'molar volume'),\n    (si.kg * si.m / si.s, 'momentum/impulse'),\n    (si.kg * si.m ** 2 / si.s, 'angular momentum'),\n    (si.rad / si.s, 'angular speed'),\n    (si.rad / si.s ** 2, 'angular acceleration'),\n    (si.g / (si.m * si.s), 'dynamic viscosity'),\n    (si.m ** 2 / si.s, 'kinematic viscosity'),\n    (si.m ** -1, 'wavenumber'),\n    (si.A, 'electrical current'),\n    (si.C, 'electrical charge'),\n    (si.V, 'electrical potential'),\n    (si.Ohm, 'electrical resistance'),\n    (si.S, 'electrical conductance'),\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, 'electrical flux density'),\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.H / si.m, 'electromagnetic field strength'),\n    (si.H, 'inductance'),\n    (si.cd, 'luminous intensity'),\n    (si.lm, 'luminous flux'),\n    (si.lx, 'luminous emittence/illuminance'),\n    (si.W / si.sr, 'radiant intensity'),\n    (si.cd / si.m ** 2, 'luminance'),\n    (astrophys.Jy, 'spectral flux density'),\n    (cgs.erg / si.angstrom / si.cm ** 2 / si.s, 'spectral flux density wav'),\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    (astrophys.bit, 'data quantity'),\n    (astrophys.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]:\n    def_physical_type(unit, name)\n"},{"col":0,"comment":"","endLoc":11,"header":"__init__.py#<anonymous>","id":7626,"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])"},{"col":0,"comment":"null","endLoc":200,"header":"def helper_radian_to_dimensionless(f, unit)","id":7627,"name":"helper_radian_to_dimensionless","nodeType":"Function","startLoc":193,"text":"def helper_radian_to_dimensionless(f, unit):\n    from .si import radian\n    try:\n        return [get_converter(unit, radian)], dimensionless_unscaled\n    except UnitsError:\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"quantities with angle units\"\n                            .format(f.__name__))"},{"col":0,"comment":"\n    Adds a new physical unit mapping.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to map from.\n\n    name : str\n        The physical name of the unit.\n    ","endLoc":45,"header":"def def_physical_type(unit, name)","id":7628,"name":"def_physical_type","nodeType":"Function","startLoc":27,"text":"def def_physical_type(unit, name):\n    \"\"\"\n    Adds a new physical unit mapping.\n\n    Parameters\n    ----------\n    unit : `~astropy.units.UnitBase` instance\n        The unit to map from.\n\n    name : str\n        The physical name of the unit.\n    \"\"\"\n    r = unit._get_physical_type_id()\n    if r in _physical_unit_mapping:\n        raise ValueError(\n            \"{0!r} ({1!r}) already defined as {2!r}\".format(\n                r, name, _physical_unit_mapping[r]))\n    _physical_unit_mapping[r] = name\n    _unit_physical_mapping[name] = r"},{"fileName":"core.py","filePath":"astropy/units","id":7629,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# 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 ..utils.decorators import lazyproperty\nfrom ..utils.exceptions import AstropyWarning\nfrom ..utils.misc import isiterable, InheritDocstrings\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    'dimensionless_unscaled', 'one']\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                \"Invalid equivalence entry {0}: {1!r}\".format(i, equiv))\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                \"Invalid equivalence entry {0}: {1!r}\".format(i, equiv))\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=[]):\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._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.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)\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    @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 sequences, dicts, or modules containing units, or units\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 sequences, dicts, or modules containing units, or units\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 {0!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 equivalent pairs\n            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 equivalent pairs\n            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\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 sequences, dicts, or modules containing units, or units\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      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 sequences, dicts, or modules containing units, or units\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      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 equivalent pairs\n        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: +SKIP\n        <Quantity  -1. +1.22464680e-16j>\n    \"\"\"\n    # doctest skipped as the complex number formatting changed in numpy 1.14.\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 equivalent pairs\n        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\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(metaclass=InheritDocstrings):\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    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 'Unit(\"{0}\")'.format(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        return CompositeUnit(1, [self], [p])\n\n    def __div__(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 __rdiv__(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    __truediv__ = __div__\n\n    __rtruediv__ = __rdiv__\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 __hash__(self):\n        # This must match the hash used in CompositeUnit for a unit\n        # with only one base and no scale or power.\n        return hash((str(self.scale), self.name, str('1')))\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 False\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 : unit object or 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 equivalence pairs, 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        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 = \"'{0}' ({1})\".format(\n                    unit_str, physical_type)\n            else:\n                unit_str = \"'{0}'\".format(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            \"{0} and {1} are not convertible\".format(\n                unit_str, other_str))\n\n    def _get_converter(self, other, equivalencies=[]):\n        other = Unit(other)\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            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            \"'{0!r}' is not a scaled version of '{1!r}'\".format(self, other))\n\n    def to(self, other, value=1.0, equivalencies=[]):\n        \"\"\"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : unit object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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). Input value sequences are returned as\n            numpy arrays.\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent\n        \"\"\"\n        return self._get_converter(other, 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 : CompositeUnit object\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                \"Cannot represent unit {0} in terms of the given \"\n                \"units\".format(self))\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=False):\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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :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        units : set of units to compose to, 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 `False`.\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        # 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        Return the physical type on the unit.\n\n        Examples\n        --------\n        >>> from astropy import units as u\n        >>> print(u.m.physical_type)\n        length\n\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 equivalence pairs, optional\n            A list of equivalence pairs to also pull options from.\n            See :ref:`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        def __repr__(self):\n            if len(self) == 0:\n                return \"[]\"\n            else:\n                lines = []\n                for u in self:\n                    irred = u.decompose().to_string()\n                    if irred == u.name:\n                        irred = \"irreducible\"\n                    lines.append((u.name, irred, ', '.join(u.aliases)))\n\n                lines.sort()\n                lines.insert(0, ('Primary name', 'Unit definition', 'Aliases'))\n                widths = [0, 0, 0]\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                         ['{0} ,'.format(x) for x in lines[1:]] +\n                         [']'])\n                return '\\n'.join(lines)\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 equivalence pairs, optional\n            A list of equivalence pairs to also list.  See\n            :ref:`unit_equivalencies`.\n            Any list given, including an empty one, supercedes global defaults\n            that may be in effect (as set by `set_enabled_equivalencies`)\n\n        units : set of units to search in, 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 {0!r} already exists in \"\n                    \"given namespace ({1!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.__dict__)\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                \"Unit {0} can not be decomposed into the requested \"\n                \"bases\".format(self))\n\n        return self\n\n\nclass UnrecognizedUnit(IrreducibleUnit):\n    \"\"\"\n    A unit that did not parse correctly.  This allows for\n    roundtripping 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 \"UnrecognizedUnit({0})\".format(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 {0!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))\n\n    __pow__ = __div__ = __rdiv__ = __truediv__ = __rtruediv__ = __mul__ = \\\n        __rmul__ = __lt__ = __gt__ = __le__ = __ge__ = __neg__ = \\\n        _unrecognized_operator\n\n    def __eq__(self, other):\n        other = Unit(other, parse_strict='silent')\n        return isinstance(other, UnrecognizedUnit) 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 {0!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(InheritDocstrings):\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                # cannot use _error_check=False: scale may be effectively unity\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers)\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\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 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 = (\"'{0}' did not parse as {1}unit: {2}\"\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, [], [])\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(\"{0} can not be converted to a Unit\".format(s))\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 `None`::\n\n        Unit()\n\n      Returns the null unit.\n\n    - The last form, which creates a new `Unit` is described in detail\n      below.\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 : dictionary, 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        return hash(self.name) + hash(self._represents)\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\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\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            scale = sanitize_scale(scale)\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        self._scale = scale\n        self._bases = bases\n        self._powers = powers\n        self._decomposed_cache = None\n        self._expand_and_gather(decompose=decompose, bases=decompose_bases)\n        self._hash = None\n\n    def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return 'Unit(dimensionless with a scale of {0})'.format(\n                    self._scale)\n            else:\n                return 'Unit(dimensionless)'\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    @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 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 = [validate_power(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'] = 'μ' + 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 : `UnitBase` object\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, (float, int, complex)):\n        return value\n\n    if isinstance(value, np.ndarray) and value.dtype.kind in ['i', 'f', 'c']:\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\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"},{"className":"_UnitRegistry","col":0,"comment":"\n    Manages a registry of the enabled units.\n    ","endLoc":261,"id":7630,"nodeType":"Class","startLoc":104,"text":"class _UnitRegistry:\n    \"\"\"\n    Manages a registry of the enabled units.\n    \"\"\"\n\n    def __init__(self, init=[], equivalencies=[]):\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._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.add_enabled_units(init)\n            self.add_enabled_equivalencies(equivalencies)\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    @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 sequences, dicts, or modules containing units, or units\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 sequences, dicts, or modules containing units, or units\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 {0!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 equivalent pairs\n            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 equivalent pairs\n            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":"null","endLoc":142,"header":"@property\n    def registry(self)","id":7631,"name":"registry","nodeType":"Function","startLoc":140,"text":"@property\n    def registry(self):\n        return self._registry"},{"col":4,"comment":"null","endLoc":146,"header":"@property\n    def all_units(self)","id":7632,"name":"all_units","nodeType":"Function","startLoc":144,"text":"@property\n    def all_units(self):\n        return self._all_units"},{"col":4,"comment":"null","endLoc":150,"header":"@property\n    def non_prefix_units(self)","id":7633,"name":"non_prefix_units","nodeType":"Function","startLoc":148,"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 sequences, dicts, or modules containing units, or units\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":169,"header":"def set_enabled_units(self, units)","id":7634,"name":"set_enabled_units","nodeType":"Function","startLoc":152,"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 sequences, dicts, or modules containing units, or units\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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7635,"name":"__all__","nodeType":"Attribute","startLoc":20,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":7636,"name":"_physical_unit_mapping","nodeType":"Attribute","startLoc":23,"text":"_physical_unit_mapping"},{"fileName":"equivalencies.py","filePath":"astropy/units","id":7637,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"A set of standard astronomical equivalencies.\"\"\"\n\n# THIRD-PARTY\nimport numpy as np\n\n# LOCAL\nfrom ..constants import si as _si\nfrom . import si\nfrom . import cgs\nfrom . import astrophys\nfrom .function import units as function_units\nfrom . import dimensionless_unscaled\nfrom .core import UnitsError\n\n\n__all__ = ['parallax', 'spectral', 'spectral_density', 'doppler_radio',\n           'doppler_optical', 'doppler_relativistic', 'mass_energy',\n           'brightness_temperature', 'dimensionless_angles',\n           'logarithmic', 'temperature', 'temperature_energy', 'molar_mass_amu',\n           'pixel_scale', 'plate_scale']\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 [(si.radian, None)]\n\n\ndef logarithmic():\n    \"\"\"Allow logarithmic units to be converted to dimensionless fractions\"\"\"\n    return [\n        (dimensionless_unscaled, function_units.dex,\n         np.log10, lambda x: 10.**x)\n    ]\n\n\ndef parallax():\n    \"\"\"\n    Returns a list of equivalence pairs that handle the conversion\n    between parallax angle and distance.\n    \"\"\"\n    return [\n        (si.arcsecond, astrophys.parsec, lambda x: 1. / x)\n    ]\n\n\ndef spectral():\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalences.\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 [\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    ]\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\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\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    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 [\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        # 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    ]\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 <http://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 [(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            ]\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 <http://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 [(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            ]\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 <http://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    \"\"\"\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 [(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            ]\n\n\ndef molar_mass_amu():\n    \"\"\"\n    Returns the equivalence between amu and molar mass.\n    \"\"\"\n    return [\n        (si.g/si.mol, astrophys.u)\n    ]\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 [(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    ]\n\n\ndef brightness_temperature(beam_area, disp):\n    r\"\"\"\n    Defines the conversion between Jy/beam 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    <http://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    However, the beam area is essential for this computation: the brightness\n    temperature is inversely proportional to the beam area\n\n    Parameters\n    ----------\n    beam_area : Beam Area equivalent\n        Beam area in angular units, i.e. steradian equivalent\n    disp : `~astropy.units.Quantity` with spectral units\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength)\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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        3.526294429423223\n        >>> (1*u.Jy).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526294429423223 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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        217.2658703625732\n    \"\"\"\n    beam = beam_area.to_value(si.sr)\n    nu = disp.to(si.GHz, spectral())\n\n    def convert_Jy_to_K(x_jybm):\n        factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to_value(astrophys.Jy)\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_value(si.K)\n        return (x_K * beam / factor)\n\n    return [(astrophys.Jy, si.K, convert_Jy_to_K, convert_K_to_Jy)]\n\n\ndef temperature():\n    \"\"\"Convert between Kelvin, Celsius, and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    \"\"\"\n    from .imperial import deg_F\n    return [\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\n\ndef temperature_energy():\n    \"\"\"Convert between Kelvin and keV(eV) to an equivalent amount.\"\"\"\n    return [\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))]\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 angular units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of angle/pixel or pixel/angle.\n    \"\"\"\n    if pixscale.unit.is_equivalent(si.arcsec/astrophys.pix):\n        pixscale_val = pixscale.to_value(si.radian/astrophys.pix)\n    elif pixscale.unit.is_equivalent(astrophys.pix/si.arcsec):\n        pixscale_val = (1/pixscale).to_value(si.radian/astrophys.pix)\n    else:\n        raise UnitsError(\"The pixel scale must be in angle/pixel or \"\n                         \"pixel/angle\")\n\n    return [(astrophys.pix, si.radian, lambda px: px*pixscale_val, lambda rad: rad/pixscale_val)]\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 [(si.m, si.radian, lambda d: d*platescale_val, lambda rad: rad/platescale_val)]\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":7638,"name":"_unit_physical_mapping","nodeType":"Attribute","startLoc":24,"text":"_unit_physical_mapping"},{"attributeType":"null","col":4,"comment":"null","endLoc":69,"id":7639,"name":"unit","nodeType":"Attribute","startLoc":69,"text":"unit"},{"attributeType":"null","col":10,"comment":"null","endLoc":69,"id":7640,"name":"name","nodeType":"Attribute","startLoc":69,"text":"name"},{"col":0,"comment":"","endLoc":10,"header":"physical.py#<anonymous>","id":7641,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nDefines physical unit names.\n\nThis module is not intended for use by user code directly.  Instead,\nthe physical unit name of a `Unit` can be obtained using its `ptype`\nproperty.\n\"\"\"\n\n__all__ = ['def_physical_type', 'get_physical_type']\n\n_physical_unit_mapping = {}\n\n_unit_physical_mapping = {}\n\nfor unit, name in [\n    (core.Unit(1), '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'),\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.deg_C, 'temperature'),\n    (imperial.deg_F, 'temperature'),\n    (si.N, 'force'),\n    (si.J, 'energy'),\n    (si.Pa, 'pressure'),\n    (si.W, 'power'),\n    (si.kg / si.m ** 3, 'mass density'),\n    (si.m ** 3 / si.kg, 'specific volume'),\n    (si.mol / si.m ** 3, 'molar volume'),\n    (si.kg * si.m / si.s, 'momentum/impulse'),\n    (si.kg * si.m ** 2 / si.s, 'angular momentum'),\n    (si.rad / si.s, 'angular speed'),\n    (si.rad / si.s ** 2, 'angular acceleration'),\n    (si.g / (si.m * si.s), 'dynamic viscosity'),\n    (si.m ** 2 / si.s, 'kinematic viscosity'),\n    (si.m ** -1, 'wavenumber'),\n    (si.A, 'electrical current'),\n    (si.C, 'electrical charge'),\n    (si.V, 'electrical potential'),\n    (si.Ohm, 'electrical resistance'),\n    (si.S, 'electrical conductance'),\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, 'electrical flux density'),\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.H / si.m, 'electromagnetic field strength'),\n    (si.H, 'inductance'),\n    (si.cd, 'luminous intensity'),\n    (si.lm, 'luminous flux'),\n    (si.lx, 'luminous emittence/illuminance'),\n    (si.W / si.sr, 'radiant intensity'),\n    (si.cd / si.m ** 2, 'luminance'),\n    (astrophys.Jy, 'spectral flux density'),\n    (cgs.erg / si.angstrom / si.cm ** 2 / si.s, 'spectral flux density wav'),\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    (astrophys.bit, 'data quantity'),\n    (astrophys.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]:\n    def_physical_type(unit, name)"},{"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":31,"header":"def dimensionless_angles()","id":7642,"name":"dimensionless_angles","nodeType":"Function","startLoc":24,"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 [(si.radian, None)]"},{"col":0,"comment":"Allow logarithmic units to be converted to dimensionless fractions","endLoc":39,"header":"def logarithmic()","id":7643,"name":"logarithmic","nodeType":"Function","startLoc":34,"text":"def logarithmic():\n    \"\"\"Allow logarithmic units to be converted to dimensionless fractions\"\"\"\n    return [\n        (dimensionless_unscaled, function_units.dex,\n         np.log10, lambda x: 10.**x)\n    ]"},{"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":218,"header":"def get_units_with_physical_type(self, unit)","id":7644,"name":"get_units_with_physical_type","nodeType":"Function","startLoc":209,"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":19,"endLoc":38,"id":7645,"nodeType":"Lambda","startLoc":38,"text":"lambda x: 10.**x"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalences.\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":84,"header":"def spectral()","id":7646,"name":"spectral","nodeType":"Function","startLoc":52,"text":"def spectral():\n    \"\"\"\n    Returns a list of equivalence pairs that handle spectral\n    wavelength, wave number, frequency, and energy equivalences.\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 [\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    ]"},{"col":22,"endLoc":72,"id":7647,"nodeType":"Lambda","startLoc":72,"text":"lambda x: _si.c.value / x"},{"col":21,"endLoc":73,"id":7648,"nodeType":"Lambda","startLoc":73,"text":"lambda x: hc / x"},{"col":22,"endLoc":74,"id":7649,"nodeType":"Lambda","startLoc":74,"text":"lambda x: _si.h.value * x"},{"col":49,"endLoc":74,"id":7650,"nodeType":"Lambda","startLoc":74,"text":"lambda x: x / _si.h.value"},{"col":27,"endLoc":75,"id":7651,"nodeType":"Lambda","startLoc":75,"text":"lambda x: 1.0 / x"},{"col":28,"endLoc":76,"id":7652,"nodeType":"Lambda","startLoc":76,"text":"lambda x: x / _si.c.value"},{"col":9,"endLoc":77,"id":7653,"nodeType":"Lambda","startLoc":77,"text":"lambda x: _si.c.value * x"},{"col":27,"endLoc":78,"id":7654,"nodeType":"Lambda","startLoc":78,"text":"lambda x: x / hc"},{"col":45,"endLoc":78,"id":7655,"nodeType":"Lambda","startLoc":78,"text":"lambda x: hc * x"},{"col":32,"endLoc":79,"id":7656,"nodeType":"Lambda","startLoc":79,"text":"lambda x: x * two_pi"},{"col":54,"endLoc":79,"id":7657,"nodeType":"Lambda","startLoc":79,"text":"lambda x: x / two_pi"},{"col":26,"endLoc":80,"id":7658,"nodeType":"Lambda","startLoc":80,"text":"lambda x: two_pi / x"},{"col":27,"endLoc":81,"id":7659,"nodeType":"Lambda","startLoc":81,"text":"lambda x: two_pi * x / _si.c.value"},{"col":9,"endLoc":82,"id":7660,"nodeType":"Lambda","startLoc":82,"text":"lambda x: _si.c.value * x / two_pi"},{"col":26,"endLoc":83,"id":7661,"nodeType":"Lambda","startLoc":83,"text":"lambda x: x * two_pi / hc"},{"col":53,"endLoc":83,"id":7662,"nodeType":"Lambda","startLoc":83,"text":"lambda x: hc * x / two_pi"},{"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":214,"header":"def spectral_density(wav, factor=None)","id":7663,"name":"spectral_density","nodeType":"Function","startLoc":87,"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\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\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    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 [\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        # 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    ]"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":7664,"name":"NUMPY_LT_1_13","nodeType":"Attribute","startLoc":18,"text":"NUMPY_LT_1_13"},{"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":7665,"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))"},{"col":0,"comment":"null","endLoc":217,"header":"def helper_frexp(f, unit)","id":7666,"name":"helper_frexp","nodeType":"Function","startLoc":212,"text":"def helper_frexp(f, unit):\n    if not unit.is_unity():\n        raise UnitTypeError(\"Can only apply '{0}' function to \"\n                            \"unscaled dimensionless quantities\"\n                            .format(f.__name__))\n    return [None], (None, None)"},{"col":4,"comment":"null","endLoc":222,"header":"@property\n    def equivalencies(self)","id":7667,"name":"equivalencies","nodeType":"Function","startLoc":220,"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 equivalent pairs\n            E.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        ","endLoc":241,"header":"def set_enabled_equivalencies(self, equivalencies)","id":7668,"name":"set_enabled_equivalencies","nodeType":"Function","startLoc":224,"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 equivalent pairs\n            E.g., as returned by\n            `~astropy.units.equivalencies.dimensionless_angles`.\n        \"\"\"\n        self._reset_equivalencies()\n        return self.add_enabled_equivalencies(equivalencies)"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":7669,"name":"_ns","nodeType":"Attribute","startLoc":27,"text":"_ns"},{"attributeType":"null","col":44,"comment":"null","endLoc":168,"id":7670,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":168,"text":"_generate_unit_summary"},{"col":0,"comment":"","endLoc":24,"header":"cds.py#<anonymous>","id":7671,"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://cds.u-strasbg.fr/doc/catstd-3.2.htx>`_ format and the `complete\nset of supported units <http://vizier.u-strasbg.fr/cgi-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())"},{"attributeType":"null","col":12,"comment":"null","endLoc":118,"id":7672,"name":"_non_prefix_units","nodeType":"Attribute","startLoc":118,"text":"self._non_prefix_units"},{"fileName":"required_by_vounit.py","filePath":"astropy/units","id":7673,"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"},{"col":0,"comment":"null","endLoc":225,"header":"def helper_multiplication(f, unit1, unit2)","id":7674,"name":"helper_multiplication","nodeType":"Function","startLoc":224,"text":"def helper_multiplication(f, unit1, unit2):\n    return [None, None], _d(unit1) * _d(unit2)"},{"col":0,"comment":"null","endLoc":25,"header":"def _initialize_module()","id":7675,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":7676,"name":"NUMPY_LT_1_14","nodeType":"Attribute","startLoc":19,"text":"NUMPY_LT_1_14"},{"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":7677,"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":0,"comment":"null","endLoc":14,"id":7678,"name":"_ns","nodeType":"Attribute","startLoc":14,"text":"_ns"},{"attributeType":"null","col":12,"comment":"null","endLoc":115,"id":7679,"name":"_equivalencies","nodeType":"Attribute","startLoc":115,"text":"self._equivalencies"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for Quantity\n    ","endLoc":51,"id":7680,"nodeType":"Class","startLoc":42,"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":"null","col":45,"comment":"null","endLoc":36,"id":7681,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":36,"text":"_generate_unit_summary"},{"attributeType":"null","col":12,"comment":"null","endLoc":116,"id":7682,"name":"_all_units","nodeType":"Attribute","startLoc":116,"text":"self._all_units"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":46,"id":7683,"name":"latex_array_threshold","nodeType":"Attribute","startLoc":46,"text":"latex_array_threshold"},{"attributeType":"null","col":12,"comment":"null","endLoc":117,"id":7684,"name":"_registry","nodeType":"Attribute","startLoc":117,"text":"self._registry"},{"attributeType":"null","col":56,"comment":"null","endLoc":37,"id":7685,"name":"_generate_prefixonly_unit_summary","nodeType":"Attribute","startLoc":37,"text":"_generate_prefixonly_unit_summary"},{"attributeType":"null","col":12,"comment":"null","endLoc":122,"id":7686,"name":"_by_physical_type","nodeType":"Attribute","startLoc":122,"text":"self._by_physical_type"},{"className":"_UnitContext","col":0,"comment":"null","endLoc":273,"id":7687,"nodeType":"Class","startLoc":264,"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":270,"header":"def __enter__(self)","id":7688,"name":"__enter__","nodeType":"Function","startLoc":269,"text":"def __enter__(self):\n        pass"},{"col":4,"comment":"null","endLoc":273,"header":"def __exit__(self, type, value, tb)","id":7689,"name":"__exit__","nodeType":"Function","startLoc":272,"text":"def __exit__(self, type, value, tb):\n        _unit_registries.pop()"},{"className":"UnitScaleError","col":0,"comment":"\n    Used to catch the errors involving scaled units,\n    which are not recognized by FITS format.\n    ","endLoc":461,"id":7690,"nodeType":"Class","startLoc":456,"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":483,"id":7691,"nodeType":"Class","startLoc":480,"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":1660,"id":7692,"nodeType":"Class","startLoc":1613,"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.__dict__)\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                \"Unit {0} can not be decomposed into the requested \"\n                \"bases\".format(self))\n\n        return self"},{"col":4,"comment":"null","endLoc":1632,"header":"def __reduce__(self)","id":7693,"name":"__reduce__","nodeType":"Function","startLoc":1622,"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.__dict__)"},{"fileName":"decorators.py","filePath":"astropy/units","id":7694,"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 ..utils.decorators import wraps\nfrom ..utils.misc import isiterable\n\nfrom .core import Unit, UnitsError, add_enabled_equivalencies\nfrom .physical import _unit_physical_mapping\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\n    allowed_units = []\n    for target in targets:\n\n        try:  # unit passed in as a string\n            target_unit = Unit(target)\n\n        except ValueError:\n\n            try:  # See if the function writer specified a physical type\n                physical_type_id = _unit_physical_mapping[target]\n\n            except KeyError:  # Function argument target is invalid\n                raise ValueError(\"Invalid unit or physical type '{0}'.\"\n                                 .format(target))\n\n            # get unit directly from physical type id\n            target_unit = Unit._from_physical_type_id(physical_type_id)\n\n        allowed_units.append(target_unit)\n\n    return allowed_units\n\n\ndef _validate_arg_value(param_name, func_name, arg, targets, equivalencies):\n    \"\"\"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    \"\"\"\n\n    allowed_units = _get_allowed_units(targets)\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(\"Argument '{0}' to function '{1}' has {2}. \"\n                  \"You may want to pass in an astropy Quantity instead.\"\n                     .format(param_name, func_name, error_msg))\n\n    else:\n        if len(targets) > 1:\n            raise UnitsError(\"Argument '{0}' to function '{1}' must be in units\"\n                             \" convertible to one of: {2}.\"\n                             .format(param_name, func_name,\n                                     [str(targ) for targ in targets]))\n        else:\n            raise UnitsError(\"Argument '{0}' to function '{1}' must be in units\"\n                             \" convertible to '{2}'.\"\n                             .format(param_name, func_name,\n                                     str(targets[0])))\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 decorator,\n        or by using function annotation syntax. Arguments to the decorator\n        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\n        or in the annotation.\n        If the argument has no unit attribute, i.e. it is not a Quantity object, a\n        `ValueError` will be raised.\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        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        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, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs\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 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                else:\n                    targets = param.annotation\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) or not isiterable(targets):\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:\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                # 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\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            if wrapped_signature.return_annotation is not inspect.Signature.empty:\n                return return_.to(wrapped_signature.return_annotation)\n            else:\n                return return_\n\n        return wrapper\n\n\nquantity_input = QuantityInput.as_decorator\n"},{"col":0,"comment":"","endLoc":12,"header":"required_by_vounit.py#<anonymous>","id":7695,"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()"},{"col":4,"comment":"The unit that this named unit represents.\n\n        For an irreducible unit, that is always itself.\n        ","endLoc":1640,"header":"@property\n    def represents(self)","id":7696,"name":"represents","nodeType":"Function","startLoc":1634,"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":1660,"header":"def decompose(self, bases=set())","id":7697,"name":"decompose","nodeType":"Function","startLoc":1642,"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                \"Unit {0} can not be decomposed into the requested \"\n                \"bases\".format(self))\n\n        return self"},{"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 equivalent pairs\n        E.g., as returned by\n        `~astropy.units.equivalencies.dimensionless_angles`.\n    ","endLoc":447,"header":"def add_enabled_equivalencies(equivalencies)","id":7698,"name":"add_enabled_equivalencies","nodeType":"Function","startLoc":426,"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 equivalent pairs\n        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":0,"comment":"null","endLoc":232,"header":"def helper_division(f, unit1, unit2)","id":7699,"name":"helper_division","nodeType":"Function","startLoc":231,"text":"def helper_division(f, unit1, unit2):\n    return [None, None], _d(unit1) / _d(unit2)"},{"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":107,"id":7700,"nodeType":"Class","startLoc":57,"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__"},{"col":4,"comment":"null","endLoc":85,"header":"def __iter__(self)","id":7701,"name":"__iter__","nodeType":"Function","startLoc":84,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":94,"header":"def __getitem__(self, indx)","id":7702,"name":"__getitem__","nodeType":"Function","startLoc":87,"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)"},{"col":0,"comment":"null","endLoc":249,"header":"def helper_power(f, unit1, unit2)","id":7703,"name":"helper_power","nodeType":"Function","startLoc":239,"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":0,"comment":"null","endLoc":263,"header":"def helper_ldexp(f, unit1, unit2)","id":7704,"name":"helper_ldexp","nodeType":"Function","startLoc":258,"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":4,"comment":"null","endLoc":97,"header":"def __setitem__(self, index, value)","id":7705,"name":"__setitem__","nodeType":"Function","startLoc":96,"text":"def __setitem__(self, index, value):\n        self._dataiter[index] = self._quantity._to_own_unit(value)"},{"id":7706,"name":"astropy/units/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/units/tests","id":7707,"nodeType":"File","text":""},{"col":4,"comment":"\n        Return the next value, or raise StopIteration.\n        ","endLoc":105,"header":"def __next__(self)","id":7708,"name":"__next__","nodeType":"Function","startLoc":99,"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)"},{"fileName":"py3_test_quantity_annotations.py","filePath":"astropy/units/tests","id":7709,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom functools import wraps\nfrom textwrap import dedent\n\nimport pytest\n\nfrom ... import units as u  # pylint: disable=W0611\n\n\ndef py3only(func):\n    @wraps(func)\n    def wrapper(*args, **kwargs):\n        src = func(*args, **kwargs)\n        code = compile(dedent(src), __file__, 'exec')\n        # This uses an unqualified exec statement illegally in Python 2,\n        # but perfectly allowed in Python 3 so in fact we eval the exec\n        # call :)\n        eval('exec(code)')\n\n    return wrapper\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 1*u.arcsec)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.arcsec\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args_noconvert3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input()\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.deg, 1*u.arcmin)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.deg\n    assert solary.unit == u.arcmin\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit\", [\n                         \"u.arcsec\", \"'angle'\"])\ndef test_args_nonquantity3(solarx_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 100)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n\n    assert solarx.unit == u.arcsec\n    \"\"\".format(solarx_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_arg_equivalencies3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input(equivalencies=u.mass_energy())\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary+(10*u.J)  # Add an energy to check equiv is working\n\n    solarx, solary = myfunc_args(1*u.arcsec, 100*u.gram)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.gram\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_wrong_unit3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    with pytest.raises(u.UnitsError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, 100*u.km)\n\n    str_to = str({1})\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' must be in units convertible to '{{0}}'.\".format(str_to)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_not_quantity3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    with pytest.raises(TypeError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, 100)\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' has no 'unit' attribute. You may want to pass in an astropy Quantity instead.\"\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\ndef test_decorator_override():\n    src = \"\"\"\n    @u.quantity_input(solarx=u.arcsec)\n    def myfunc_args(solarx: u.km, solary: u.arcsec):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 1*u.arcsec)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.arcsec\n    \"\"\"\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwargs3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary, myk: {1}=1*u.arcsec):\n        return solarx, solary, myk\n\n    solarx, solary, myk = myfunc_args(1*u.arcsec, 100, myk=100*u.deg)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n    assert isinstance(myk, u.Quantity)\n\n    assert myk.unit == u.deg\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_unused_kwargs3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary, myk: {1}=1*u.arcsec, myk2=1000):\n        return solarx, solary, myk, myk2\n\n    solarx, solary, myk, myk2 = myfunc_args(1*u.arcsec, 100, myk=100*u.deg, myk2=10)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n    assert isinstance(myk, u.Quantity)\n    assert isinstance(myk2, int)\n\n    assert myk.unit == u.deg\n    assert myk2 == 10\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,energy\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_kwarg_equivalencies3(solarx_unit, energy):\n    src = \"\"\"\n    @u.quantity_input(equivalencies=u.mass_energy())\n    def myfunc_args(solarx: {0}, energy: {1}=10*u.eV):\n        return solarx, energy+(10*u.J)  # Add an energy to check equiv is working\n\n    solarx, energy = myfunc_args(1*u.arcsec, 100*u.gram)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(energy, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert energy.unit == u.gram\n    \"\"\".format(solarx_unit, energy)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_wrong_unit3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    with pytest.raises(u.UnitsError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, solary=100*u.km)\n\n    str_to = str({1})\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' must be in units convertible to '{{0}}'.\".format(str_to)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_not_quantity3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    with pytest.raises(TypeError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, solary=100)\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' has no 'unit' attribute. You may want to pass in an astropy Quantity instead.\"\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_default3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src\n\n\n@py3only\ndef test_return_annotation():\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: u.arcsec) -> u.deg:\n        return solarx\n\n    solarx = myfunc_args(1*u.arcsec)\n    assert solarx.unit is u.deg\n    \"\"\"\n    return src\n"},{"col":0,"comment":"null","endLoc":274,"header":"def helper_copysign(f, unit1, unit2)","id":7710,"name":"helper_copysign","nodeType":"Function","startLoc":269,"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":4,"comment":"null","endLoc":288,"header":"def helper_heaviside(f, unit1, unit2)","id":7711,"name":"helper_heaviside","nodeType":"Function","startLoc":281,"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)"},{"attributeType":"function","col":4,"comment":"null","endLoc":107,"id":7712,"name":"next","nodeType":"Attribute","startLoc":107,"text":"next"},{"className":"QuantityInput","col":0,"comment":"null","endLoc":228,"id":7713,"nodeType":"Class","startLoc":82,"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 decorator,\n        or by using function annotation syntax. Arguments to the decorator\n        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\n        or in the annotation.\n        If the argument has no unit attribute, i.e. it is not a Quantity object, a\n        `ValueError` will be raised.\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        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        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, **kwargs):\n        self.equivalencies = kwargs.pop('equivalencies', [])\n        self.decorator_kwargs = kwargs\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 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                else:\n                    targets = param.annotation\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) or not isiterable(targets):\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:\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                # 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\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            if wrapped_signature.return_annotation is not inspect.Signature.empty:\n                return return_.to(wrapped_signature.return_annotation)\n            else:\n                return return_\n\n        return wrapper"},{"col":4,"comment":"null","endLoc":228,"header":"def __call__(self, wrapped_function)","id":7714,"name":"__call__","nodeType":"Function","startLoc":155,"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 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                else:\n                    targets = param.annotation\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) or not isiterable(targets):\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:\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                # 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\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            if wrapped_signature.return_annotation is not inspect.Signature.empty:\n                return return_.to(wrapped_signature.return_annotation)\n            else:\n                return return_\n\n        return wrapper"},{"attributeType":"null","col":8,"comment":"null","endLoc":82,"id":7715,"name":"_dataiter","nodeType":"Attribute","startLoc":82,"text":"self._dataiter"},{"attributeType":"{view}","col":8,"comment":"null","endLoc":81,"id":7716,"name":"_quantity","nodeType":"Attribute","startLoc":81,"text":"self._quantity"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":7717,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":7718,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":36,"text":"__doctest_skip__"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":7719,"name":"_UNIT_NOT_INITIALISED","nodeType":"Attribute","startLoc":38,"text":"_UNIT_NOT_INITIALISED"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":7720,"name":"_UFUNCS_FILTER_WARNINGS","nodeType":"Attribute","startLoc":39,"text":"_UFUNCS_FILTER_WARNINGS"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":54,"id":7721,"name":"conf","nodeType":"Attribute","startLoc":54,"text":"conf"},{"col":0,"comment":"null","endLoc":22,"header":"def py3only(func)","id":7722,"name":"py3only","nodeType":"Function","startLoc":12,"text":"def py3only(func):\n    @wraps(func)\n    def wrapper(*args, **kwargs):\n        src = func(*args, **kwargs)\n        code = compile(dedent(src), __file__, 'exec')\n        # This uses an unqualified exec statement illegally in Python 2,\n        # but perfectly allowed in Python 3 so in fact we eval the exec\n        # call :)\n        eval('exec(code)')\n\n    return wrapper"},{"col":0,"comment":"null","endLoc":303,"header":"def helper_two_arg_dimensionless(f, unit1, unit2)","id":7723,"name":"helper_two_arg_dimensionless","nodeType":"Function","startLoc":293,"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 '{0}' function to \"\n                            \"dimensionless quantities\"\n                            .format(f.__name__))\n    return ([converter1, converter2], dimensionless_unscaled)"},{"col":0,"comment":"","endLoc":7,"header":"quantity.py#<anonymous>","id":7724,"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\"]\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":"null","endLoc":43,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args3(solarx_unit, solary_unit)","id":7725,"name":"test_args3","nodeType":"Function","startLoc":25,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 1*u.arcsec)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.arcsec\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"col":0,"comment":"null","endLoc":64,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args_noconvert3(solarx_unit, solary_unit)","id":7726,"name":"test_args_noconvert3","nodeType":"Function","startLoc":46,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.arcsec\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_args_noconvert3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input()\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.deg, 1*u.arcmin)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.deg\n    assert solary.unit == u.arcmin\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"id":7727,"name":"astropy/units/format","nodeType":"Package"},{"col":0,"comment":"null","endLoc":83,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit\", [\n                         \"u.arcsec\", \"'angle'\"])\ndef test_args_nonquantity3(solarx_unit)","id":7728,"name":"test_args_nonquantity3","nodeType":"Function","startLoc":67,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit\", [\n                         \"u.arcsec\", \"'angle'\"])\ndef test_args_nonquantity3(solarx_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 100)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n\n    assert solarx.unit == u.arcsec\n    \"\"\".format(solarx_unit)\n    return src"},{"fileName":"cds_parsetab.py","filePath":"astropy/units/format","id":7729,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# This file is automatically generated. Do not edit.\n_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = '6FC211F72F2851FC3FF7D2BFF951FE7A'\n    \n_lr_action_items = {'UINT':([0,2,3,14,15,16,19,23,],[1,-21,20,-20,28,29,30,32,]),'PRODUCT':([2,12,13,18,30,31,],[-18,-10,27,-17,-19,-11,]),'CLOSE_PAREN':([2,7,8,12,13,18,22,25,30,31,33,34,],[-18,-4,-5,-10,-7,-17,31,-8,-19,-11,-9,-6,]),'UNIT':([0,1,5,6,10,11,17,20,21,26,27,28,35,36,],[2,-15,2,-16,2,2,-14,-23,-24,2,2,-22,-13,-12,]),'OPEN_PAREN':([0,1,5,6,10,11,17,20,21,26,27,28,35,36,],[5,-15,5,-16,5,5,-14,-23,-24,5,5,-22,-13,-12,]),'$end':([1,2,4,6,7,8,9,10,12,13,17,18,20,21,24,25,28,30,31,33,34,35,36,],[-15,-18,-2,-16,-4,-5,0,-3,-10,-7,-14,-17,-23,-24,-1,-8,-22,-19,-11,-9,-6,-13,-12,]),'DIVISION':([0,1,2,5,6,10,12,13,17,18,20,21,26,27,28,30,31,35,36,],[11,-15,-18,11,-16,11,-10,26,-14,-17,-23,-24,11,11,-22,-19,-11,-13,-12,]),'UFLOAT':([0,3,14,],[-21,21,-20,]),'X':([1,6,20,21,],[16,23,-23,-24,]),'SIGN':([0,1,2,29,32,],[14,15,14,15,15,]),}\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 = {'division_of_units':([0,5,10,26,27,],[8,8,8,8,8,]),'main':([0,],[9,]),'combined_units':([0,5,10,26,27,],[4,22,24,33,34,]),'factor':([0,],[10,]),'signed_float':([0,],[6,]),'unit_with_power':([0,5,10,11,26,27,],[12,12,12,12,12,12,]),'product_of_units':([0,5,10,26,27,],[7,7,7,7,7,]),'signed_int':([1,29,32,],[17,35,36,]),'numeric_power':([2,],[18,]),'unit_expression':([0,5,10,11,26,27,],[13,13,13,25,13,13,]),'sign':([0,2,],[3,19,]),}\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',150),\n  ('main -> combined_units','main',1,'p_main','cds.py',151),\n  ('main -> factor','main',1,'p_main','cds.py',152),\n  ('combined_units -> product_of_units','combined_units',1,'p_combined_units','cds.py',162),\n  ('combined_units -> division_of_units','combined_units',1,'p_combined_units','cds.py',163),\n  ('product_of_units -> unit_expression PRODUCT combined_units','product_of_units',3,'p_product_of_units','cds.py',169),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','cds.py',170),\n  ('division_of_units -> DIVISION unit_expression','division_of_units',2,'p_division_of_units','cds.py',179),\n  ('division_of_units -> unit_expression DIVISION combined_units','division_of_units',3,'p_division_of_units','cds.py',180),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','cds.py',189),\n  ('unit_expression -> OPEN_PAREN combined_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','cds.py',190),\n  ('factor -> signed_float X UINT signed_int','factor',4,'p_factor','cds.py',199),\n  ('factor -> UINT X UINT signed_int','factor',4,'p_factor','cds.py',200),\n  ('factor -> UINT signed_int','factor',2,'p_factor','cds.py',201),\n  ('factor -> UINT','factor',1,'p_factor','cds.py',202),\n  ('factor -> signed_float','factor',1,'p_factor','cds.py',203),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','cds.py',220),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','cds.py',221),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','cds.py',230),\n  ('sign -> SIGN','sign',1,'p_sign','cds.py',236),\n  ('sign -> <empty>','sign',0,'p_sign','cds.py',237),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','cds.py',246),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','cds.py',252),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','cds.py',253),\n]\n"},{"col":0,"comment":"null","endLoc":104,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_arg_equivalencies3(solarx_unit, solary_unit)","id":7730,"name":"test_arg_equivalencies3","nodeType":"Function","startLoc":86,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_arg_equivalencies3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input(equivalencies=u.mass_energy())\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary+(10*u.J)  # Add an energy to check equiv is working\n\n    solarx, solary = myfunc_args(1*u.arcsec, 100*u.gram)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.gram\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"col":0,"comment":"null","endLoc":339,"header":"def get_converters_and_unit(f, *units)","id":7731,"name":"get_converters_and_unit","nodeType":"Function","startLoc":310,"text":"def get_converters_and_unit(f, *units):\n\n    converters = [None, None]\n    # no units for any input -- e.g., np.add(a1, a2, out=q)\n    if all(unit is None for unit in units):\n        return converters, dimensionless_unscaled\n\n    fixed, changeable = (1, 0) if units[1] is None else (0, 1)\n    if units[fixed] is None:\n        try:\n            converters[changeable] = get_converter(units[changeable],\n                                                   dimensionless_unscaled)\n        except UnitsError:\n            # special case: would be OK if unitless number is zero, inf, nan\n            converters[fixed] = False\n            return converters, units[changeable]\n        else:\n            return converters, dimensionless_unscaled\n\n    else:\n        try:\n            converters[changeable] = get_converter(units[changeable],\n                                                   units[fixed])\n        except UnitsError:\n            raise UnitConversionError(\n                \"Can only apply '{0}' function to quantities \"\n                \"with compatible dimensions\"\n                .format(f.__name__))\n\n        return converters, units[fixed]"},{"col":0,"comment":"null","endLoc":123,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_wrong_unit3(solarx_unit, solary_unit)","id":7732,"name":"test_wrong_unit3","nodeType":"Function","startLoc":107,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_wrong_unit3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    with pytest.raises(u.UnitsError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, 100*u.km)\n\n    str_to = str({1})\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' must be in units convertible to '{{0}}'.\".format(str_to)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7733,"name":"_tabversion","nodeType":"Attribute","startLoc":5,"text":"_tabversion"},{"col":0,"comment":"null","endLoc":140,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_not_quantity3(solarx_unit, solary_unit)","id":7734,"name":"test_not_quantity3","nodeType":"Function","startLoc":126,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_not_quantity3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}):\n        return solarx, solary\n\n    with pytest.raises(TypeError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, 100)\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' has no 'unit' attribute. You may want to pass in an astropy Quantity instead.\"\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":7735,"name":"_lr_method","nodeType":"Attribute","startLoc":7,"text":"_lr_method"},{"col":0,"comment":"null","endLoc":158,"header":"@py3only\ndef test_decorator_override()","id":7736,"name":"test_decorator_override","nodeType":"Function","startLoc":143,"text":"@py3only\ndef test_decorator_override():\n    src = \"\"\"\n    @u.quantity_input(solarx=u.arcsec)\n    def myfunc_args(solarx: u.km, solary: u.arcsec):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec, 1*u.arcsec)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert solary.unit == u.arcsec\n    \"\"\"\n    return src"},{"col":0,"comment":"null","endLoc":179,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwargs3(solarx_unit, solary_unit)","id":7737,"name":"test_kwargs3","nodeType":"Function","startLoc":161,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwargs3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary, myk: {1}=1*u.arcsec):\n        return solarx, solary, myk\n\n    solarx, solary, myk = myfunc_args(1*u.arcsec, 100, myk=100*u.deg)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n    assert isinstance(myk, u.Quantity)\n\n    assert myk.unit == u.deg\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7738,"name":"_lr_signature","nodeType":"Attribute","startLoc":9,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7739,"name":"_lr_action_items","nodeType":"Attribute","startLoc":11,"text":"_lr_action_items"},{"col":0,"comment":"null","endLoc":202,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_unused_kwargs3(solarx_unit, solary_unit)","id":7740,"name":"test_unused_kwargs3","nodeType":"Function","startLoc":182,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_unused_kwargs3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary, myk: {1}=1*u.arcsec, myk2=1000):\n        return solarx, solary, myk, myk2\n\n    solarx, solary, myk, myk2 = myfunc_args(1*u.arcsec, 100, myk=100*u.deg, myk2=10)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(solary, int)\n    assert isinstance(myk, u.Quantity)\n    assert isinstance(myk2, int)\n\n    assert myk.unit == u.deg\n    assert myk2 == 10\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":7741,"name":"_lr_action","nodeType":"Attribute","startLoc":13,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":7742,"name":"_k","nodeType":"Attribute","startLoc":14,"text":"_k"},{"col":0,"comment":"null","endLoc":223,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,energy\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_kwarg_equivalencies3(solarx_unit, energy)","id":7743,"name":"test_kwarg_equivalencies3","nodeType":"Function","startLoc":205,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,energy\", [\n                         (\"u.arcsec\", \"u.eV\"),\n                         (\"'angle'\", \"'energy'\")])\ndef test_kwarg_equivalencies3(solarx_unit, energy):\n    src = \"\"\"\n    @u.quantity_input(equivalencies=u.mass_energy())\n    def myfunc_args(solarx: {0}, energy: {1}=10*u.eV):\n        return solarx, energy+(10*u.J)  # Add an energy to check equiv is working\n\n    solarx, energy = myfunc_args(1*u.arcsec, 100*u.gram)\n\n    assert isinstance(solarx, u.Quantity)\n    assert isinstance(energy, u.Quantity)\n\n    assert solarx.unit == u.arcsec\n    assert energy.unit == u.gram\n    \"\"\".format(solarx_unit, energy)\n    return src"},{"col":0,"comment":"null","endLoc":242,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_wrong_unit3(solarx_unit, solary_unit)","id":7744,"name":"test_kwarg_wrong_unit3","nodeType":"Function","startLoc":226,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_wrong_unit3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    with pytest.raises(u.UnitsError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, solary=100*u.km)\n\n    str_to = str({1})\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' must be in units convertible to '{{0}}'.\".format(str_to)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"col":0,"comment":"null","endLoc":343,"header":"def helper_twoarg_invariant(f, unit1, unit2)","id":7745,"name":"helper_twoarg_invariant","nodeType":"Function","startLoc":342,"text":"def helper_twoarg_invariant(f, unit1, unit2):\n    return get_converters_and_unit(f, unit1, unit2)"},{"col":0,"comment":"null","endLoc":259,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_not_quantity3(solarx_unit, solary_unit)","id":7746,"name":"test_kwarg_not_quantity3","nodeType":"Function","startLoc":245,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_not_quantity3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    with pytest.raises(TypeError) as e:\n        solarx, solary = myfunc_args(1*u.arcsec, solary=100)\n    assert str(e.value) == \"Argument 'solary' to function 'myfunc_args' has no 'unit' attribute. You may want to pass in an astropy Quantity instead.\"\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":7747,"name":"_v","nodeType":"Attribute","startLoc":14,"text":"_v"},{"col":0,"comment":"null","endLoc":361,"header":"def helper_twoarg_comparison(f, unit1, unit2)","id":7748,"name":"helper_twoarg_comparison","nodeType":"Function","startLoc":359,"text":"def helper_twoarg_comparison(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, None"},{"attributeType":"null","col":7,"comment":"null","endLoc":15,"id":7749,"name":"_x","nodeType":"Attribute","startLoc":15,"text":"_x"},{"col":0,"comment":"null","endLoc":274,"header":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_default3(solarx_unit, solary_unit)","id":7750,"name":"test_kwarg_default3","nodeType":"Function","startLoc":262,"text":"@py3only\n@pytest.mark.parametrize(\"solarx_unit,solary_unit\", [\n                         (\"u.arcsec\", \"u.deg\"),\n                         (\"'angle'\", \"'angle'\")])\ndef test_kwarg_default3(solarx_unit, solary_unit):\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: {0}, solary: {1}=10*u.deg):\n        return solarx, solary\n\n    solarx, solary = myfunc_args(1*u.arcsec)\n    \"\"\".format(solarx_unit, solary_unit)\n    return src"},{"attributeType":"null","col":10,"comment":"null","endLoc":15,"id":7751,"name":"_y","nodeType":"Attribute","startLoc":15,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":7752,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":20,"text":"_lr_goto_items"},{"col":0,"comment":"null","endLoc":375,"header":"def helper_twoarg_invtrig(f, unit1, unit2)","id":7753,"name":"helper_twoarg_invtrig","nodeType":"Function","startLoc":372,"text":"def helper_twoarg_invtrig(f, unit1, unit2):\n    from .si import radian\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, radian"},{"col":0,"comment":"null","endLoc":287,"header":"@py3only\ndef test_return_annotation()","id":7754,"name":"test_return_annotation","nodeType":"Function","startLoc":277,"text":"@py3only\ndef test_return_annotation():\n    src = \"\"\"\n    @u.quantity_input\n    def myfunc_args(solarx: u.arcsec) -> u.deg:\n        return solarx\n\n    solarx = myfunc_args(1*u.arcsec)\n    assert solarx.unit is u.deg\n    \"\"\"\n    return src"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":7755,"name":"_lr_goto","nodeType":"Attribute","startLoc":22,"text":"_lr_goto"},{"attributeType":"null","col":25,"comment":"null","endLoc":9,"id":7756,"name":"u","nodeType":"Attribute","startLoc":9,"text":"u"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":7757,"name":"_k","nodeType":"Attribute","startLoc":23,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":7758,"name":"_v","nodeType":"Attribute","startLoc":23,"text":"_v"},{"col":0,"comment":"null","endLoc":386,"header":"def helper_twoarg_floor_divide(f, unit1, unit2)","id":7759,"name":"helper_twoarg_floor_divide","nodeType":"Function","startLoc":384,"text":"def helper_twoarg_floor_divide(f, unit1, unit2):\n    converters, _ = get_converters_and_unit(f, unit1, unit2)\n    return converters, dimensionless_unscaled"},{"attributeType":"null","col":7,"comment":"null","endLoc":24,"id":7760,"name":"_x","nodeType":"Attribute","startLoc":24,"text":"_x"},{"attributeType":"null","col":11,"comment":"null","endLoc":24,"id":7761,"name":"_y","nodeType":"Attribute","startLoc":24,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":7762,"name":"_lr_productions","nodeType":"Attribute","startLoc":28,"text":"_lr_productions"},{"col":4,"comment":"null","endLoc":395,"header":"def helper_divmod(f, unit1, unit2)","id":7763,"name":"helper_divmod","nodeType":"Function","startLoc":393,"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)"},{"col":0,"comment":"","endLoc":5,"header":"cds_parsetab.py#<anonymous>","id":7764,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = '6FC211F72F2851FC3FF7D2BFF951FE7A'\n\n_lr_action_items = {'UINT':([0,2,3,14,15,16,19,23,],[1,-21,20,-20,28,29,30,32,]),'PRODUCT':([2,12,13,18,30,31,],[-18,-10,27,-17,-19,-11,]),'CLOSE_PAREN':([2,7,8,12,13,18,22,25,30,31,33,34,],[-18,-4,-5,-10,-7,-17,31,-8,-19,-11,-9,-6,]),'UNIT':([0,1,5,6,10,11,17,20,21,26,27,28,35,36,],[2,-15,2,-16,2,2,-14,-23,-24,2,2,-22,-13,-12,]),'OPEN_PAREN':([0,1,5,6,10,11,17,20,21,26,27,28,35,36,],[5,-15,5,-16,5,5,-14,-23,-24,5,5,-22,-13,-12,]),'$end':([1,2,4,6,7,8,9,10,12,13,17,18,20,21,24,25,28,30,31,33,34,35,36,],[-15,-18,-2,-16,-4,-5,0,-3,-10,-7,-14,-17,-23,-24,-1,-8,-22,-19,-11,-9,-6,-13,-12,]),'DIVISION':([0,1,2,5,6,10,12,13,17,18,20,21,26,27,28,30,31,35,36,],[11,-15,-18,11,-16,11,-10,26,-14,-17,-23,-24,11,11,-22,-19,-11,-13,-12,]),'UFLOAT':([0,3,14,],[-21,21,-20,]),'X':([1,6,20,21,],[16,23,-23,-24,]),'SIGN':([0,1,2,29,32,],[14,15,14,15,15,]),}\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 = {'division_of_units':([0,5,10,26,27,],[8,8,8,8,8,]),'main':([0,],[9,]),'combined_units':([0,5,10,26,27,],[4,22,24,33,34,]),'factor':([0,],[10,]),'signed_float':([0,],[6,]),'unit_with_power':([0,5,10,11,26,27,],[12,12,12,12,12,12,]),'product_of_units':([0,5,10,26,27,],[7,7,7,7,7,]),'signed_int':([1,29,32,],[17,35,36,]),'numeric_power':([2,],[18,]),'unit_expression':([0,5,10,11,26,27,],[13,13,13,25,13,13,]),'sign':([0,2,],[3,19,]),}\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',150),\n  ('main -> combined_units','main',1,'p_main','cds.py',151),\n  ('main -> factor','main',1,'p_main','cds.py',152),\n  ('combined_units -> product_of_units','combined_units',1,'p_combined_units','cds.py',162),\n  ('combined_units -> division_of_units','combined_units',1,'p_combined_units','cds.py',163),\n  ('product_of_units -> unit_expression PRODUCT combined_units','product_of_units',3,'p_product_of_units','cds.py',169),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','cds.py',170),\n  ('division_of_units -> DIVISION unit_expression','division_of_units',2,'p_division_of_units','cds.py',179),\n  ('division_of_units -> unit_expression DIVISION combined_units','division_of_units',3,'p_division_of_units','cds.py',180),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','cds.py',189),\n  ('unit_expression -> OPEN_PAREN combined_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','cds.py',190),\n  ('factor -> signed_float X UINT signed_int','factor',4,'p_factor','cds.py',199),\n  ('factor -> UINT X UINT signed_int','factor',4,'p_factor','cds.py',200),\n  ('factor -> UINT signed_int','factor',2,'p_factor','cds.py',201),\n  ('factor -> UINT','factor',1,'p_factor','cds.py',202),\n  ('factor -> signed_float','factor',1,'p_factor','cds.py',203),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','cds.py',220),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','cds.py',221),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','cds.py',230),\n  ('sign -> SIGN','sign',1,'p_sign','cds.py',236),\n  ('sign -> <empty>','sign',0,'p_sign','cds.py',237),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','cds.py',246),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','cds.py',252),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','cds.py',253),\n]"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":7765,"name":"UFUNC_HELPERS","nodeType":"Attribute","startLoc":35,"text":"UFUNC_HELPERS"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":7766,"name":"UNSUPPORTED_UFUNCS","nodeType":"Attribute","startLoc":43,"text":"UNSUPPORTED_UFUNCS"},{"fileName":"ogip.py","filePath":"astropy/units/format","id":7767,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICNSE.rst\n\n# Note that  files generated by lex/yacc not always fully py 2/3 compatible.\n# Hence, the ``clean_parse_tables.py`` tool in the astropy-tools\n# (https://github.com/astropy/astropy-tools) repository should be used to fix\n# this when/if lextab/parsetab files are re-generated.\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\n\n\nimport keyword\nimport math\nimport os\nimport copy\nimport warnings\nfrom fractions import Fraction\n\nfrom . import core, generic, utils\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 ... 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        from ...extern.ply import lex\n\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='ogip_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        return lexer\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        from ...extern.ply import yacc\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 '{0}' 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 ..core import UnitsWarning\n                warnings.warn(\n                    \"'{0}' 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        parser = yacc.yacc(debug=False, tabmodule='ogip_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, '{1}': {2}\".format(\n                    t.lexpos, t.value, str(e)))\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 '{0}' not supported by the OGIP \"\n                    \"standard. {1}\".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                        \"Syntax error parsing unit '{0}'\".format(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('{0}**({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}**{1}'.format(\n                        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                    \"'{0}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(\n                        unit.scale),\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 '{0} (with data multiplied by {1})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)\n"},{"attributeType":"function","col":0,"comment":"null","endLoc":58,"id":7768,"name":"helper_onearg_test","nodeType":"Attribute","startLoc":58,"text":"helper_onearg_test"},{"attributeType":"function","col":0,"comment":"null","endLoc":68,"id":7769,"name":"helper_invariant","nodeType":"Attribute","startLoc":68,"text":"helper_invariant"},{"col":0,"comment":"","endLoc":4,"header":"quantity_helper.py#<anonymous>","id":7770,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"UFUNC_HELPERS = {}\n\nUNSUPPORTED_UFUNCS = set([np.bitwise_and, np.bitwise_or,\n                          np.bitwise_xor, np.invert, np.left_shift,\n                          np.right_shift, np.logical_and, np.logical_or,\n                          np.logical_xor, np.logical_not])\n\nif isinstance(getattr(np, 'isnat', None), np.ufunc):\n    UNSUPPORTED_UFUNCS |= {np.isnat}\n\nhelper_onearg_test = lambda f, unit: ([None], None)\n\nUFUNC_HELPERS[np.isfinite] = helper_onearg_test\n\nUFUNC_HELPERS[np.isinf] = helper_onearg_test\n\nUFUNC_HELPERS[np.isnan] = helper_onearg_test\n\nUFUNC_HELPERS[np.sign] = helper_onearg_test\n\nUFUNC_HELPERS[np.signbit] = helper_onearg_test\n\nhelper_invariant = lambda f, unit: ([None], _d(unit))\n\nUFUNC_HELPERS[np.absolute] = helper_invariant\n\nUFUNC_HELPERS[np.fabs] = helper_invariant\n\nUFUNC_HELPERS[np.conj] = helper_invariant\n\nUFUNC_HELPERS[np.conjugate] = helper_invariant\n\nUFUNC_HELPERS[np.negative] = helper_invariant\n\nUFUNC_HELPERS[np.spacing] = helper_invariant\n\nUFUNC_HELPERS[np.rint] = helper_invariant\n\nUFUNC_HELPERS[np.floor] = helper_invariant\n\nUFUNC_HELPERS[np.ceil] = helper_invariant\n\nUFUNC_HELPERS[np.trunc] = helper_invariant\n\nif isinstance(getattr(np, 'positive', None), np.ufunc):\n    UFUNC_HELPERS[np.positive] = helper_invariant\n\nUFUNC_HELPERS[np.sqrt] = lambda f, unit: (\n    [None], unit ** 0.5 if unit is not None else dimensionless_unscaled)\n\nUFUNC_HELPERS[np.square] = lambda f, unit: (\n    [None], unit ** 2 if unit is not None else dimensionless_unscaled)\n\nUFUNC_HELPERS[np.reciprocal] = lambda f, unit: (\n    [None], unit ** -1 if unit is not None else dimensionless_unscaled)\n\nUFUNC_HELPERS[np.cbrt] = lambda f, unit: (\n    [None], (unit ** Fraction(1, 3) if unit is not None\n             else dimensionless_unscaled))\n\nUFUNC_HELPERS[np.core.umath._ones_like] = (lambda f, unit:\n                                           ([None], dimensionless_unscaled))\n\nUFUNC_HELPERS[np.exp] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.expm1] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.exp2] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.log] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.log10] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.log2] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.log1p] = helper_dimensionless_to_dimensionless\n\nUFUNC_HELPERS[np.modf] = helper_modf\n\nUFUNC_HELPERS[np.arccos] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.arcsin] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.arctan] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.arccosh] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.arcsinh] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.arctanh] = helper_dimensionless_to_radian\n\nUFUNC_HELPERS[np.radians] = helper_degree_to_radian\n\nUFUNC_HELPERS[np.deg2rad] = helper_degree_to_radian\n\nUFUNC_HELPERS[np.degrees] = helper_radian_to_degree\n\nUFUNC_HELPERS[np.rad2deg] = helper_radian_to_degree\n\nUFUNC_HELPERS[np.cos] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.sin] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.tan] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.cosh] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.sinh] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.tanh] = helper_radian_to_dimensionless\n\nUFUNC_HELPERS[np.frexp] = helper_frexp\n\nUFUNC_HELPERS[np.multiply] = 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\nif isinstance(getattr(np, 'float_power', None), np.ufunc):\n    UFUNC_HELPERS[np.float_power] = helper_power\n\nUFUNC_HELPERS[np.ldexp] = helper_ldexp\n\nUFUNC_HELPERS[np.copysign] = helper_copysign\n\nif isinstance(getattr(np, 'heaviside', None), np.ufunc):\n    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)\n\n    UFUNC_HELPERS[np.heaviside] = helper_heaviside\n\nUFUNC_HELPERS[np.logaddexp] = helper_two_arg_dimensionless\n\nUFUNC_HELPERS[np.logaddexp2] = helper_two_arg_dimensionless\n\nUFUNC_HELPERS[np.add] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.subtract] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.hypot] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.maximum] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.minimum] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.fmin] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.fmax] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.nextafter] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.remainder] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.mod] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.fmod] = helper_twoarg_invariant\n\nUFUNC_HELPERS[np.greater] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.greater_equal] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.less] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.less_equal] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.not_equal] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.equal] = helper_twoarg_comparison\n\nUFUNC_HELPERS[np.arctan2] = helper_twoarg_invtrig\n\nif isinstance(getattr(np.core.umath, '_arg', None), np.ufunc):\n    UFUNC_HELPERS[np.core.umath._arg] = helper_twoarg_invtrig\n\nUFUNC_HELPERS[np.floor_divide] = helper_twoarg_floor_divide\n\nif isinstance(getattr(np, 'divmod', None), np.ufunc):\n    def 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    UFUNC_HELPERS[np.divmod] = helper_divmod"},{"fileName":"vounit.py","filePath":"astropy/units/format","id":7771,"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 ... import units as u\n        from ...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        if s.count('/') > 1:\n            raise core.UnitsError(\n                \"'{0}' 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 _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if cls._explicit_custom_unit_regex.match(unit):\n                return cls._def_custom_unit(unit)\n\n            if not cls._custom_unit_regex.match(unit):\n                raise ValueError()\n\n            warnings.warn(\n                \"Unit {0!r} not supported by the VOUnit \"\n                \"standard. {1}\".format(\n                    unit, utils.did_you_mean_units(\n                        unit, cls._units, cls._deprecated_units,\n                        cls._to_decomposed_alternative)),\n                core.UnitsWarning)\n\n            return cls._def_custom_unit(unit)\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 '{0}': 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 '{0}': 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                \"Unit {0!r} is not part of the VOUnit standard\".format(name))\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 to_string(cls, unit):\n        from .. 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 {0:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                m, ex = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m:\n                    parts.append(m)\n                if ex:\n                    fex = '10'\n                    if not ex.startswith('-'):\n                        fex += '+'\n                    fex += ex\n                    parts.append(fex)\n                s += ' '.join(parts)\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 .. 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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), scale)\n        return s\n"},{"col":21,"endLoc":58,"id":7772,"nodeType":"Lambda","startLoc":58,"text":"lambda f, unit: ([None], None)"},{"col":19,"endLoc":68,"id":7773,"nodeType":"Lambda","startLoc":68,"text":"lambda f, unit: ([None], _d(unit))"},{"col":25,"endLoc":87,"id":7774,"nodeType":"Lambda","startLoc":86,"text":"lambda f, unit: (\n    [None], unit ** 0.5 if unit is not None else dimensionless_unscaled)"},{"col":27,"endLoc":89,"id":7775,"nodeType":"Lambda","startLoc":88,"text":"lambda f, unit: (\n    [None], unit ** 2 if unit is not None else dimensionless_unscaled)"},{"col":31,"endLoc":91,"id":7776,"nodeType":"Lambda","startLoc":90,"text":"lambda f, unit: (\n    [None], unit ** -1 if unit is not None else dimensionless_unscaled)"},{"col":25,"endLoc":95,"id":7777,"nodeType":"Lambda","startLoc":93,"text":"lambda f, unit: (\n    [None], (unit ** Fraction(1, 3) if unit is not None\n             else dimensionless_unscaled))"},{"col":43,"endLoc":97,"id":7778,"nodeType":"Lambda","startLoc":96,"text":"lambda f, unit:\n                                           ([None], dimensionless_unscaled)"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7779,"name":"core","nodeType":"Attribute","startLoc":12,"text":"core"},{"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":235,"id":7780,"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 ... import units as u\n        from ...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        if s.count('/') > 1:\n            raise core.UnitsError(\n                \"'{0}' 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 _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if cls._explicit_custom_unit_regex.match(unit):\n                return cls._def_custom_unit(unit)\n\n            if not cls._custom_unit_regex.match(unit):\n                raise ValueError()\n\n            warnings.warn(\n                \"Unit {0!r} not supported by the VOUnit \"\n                \"standard. {1}\".format(\n                    unit, utils.did_you_mean_units(\n                        unit, cls._units, cls._deprecated_units,\n                        cls._to_decomposed_alternative)),\n                core.UnitsWarning)\n\n            return cls._def_custom_unit(unit)\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 '{0}': 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 '{0}': 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                \"Unit {0!r} is not part of the VOUnit standard\".format(name))\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 to_string(cls, unit):\n        from .. 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 {0:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                m, ex = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m:\n                    parts.append(m)\n                if ex:\n                    fex = '10'\n                    if not ex.startswith('-'):\n                        fex += '+'\n                    fex += ex\n                    parts.append(fex)\n                s += ' '.join(parts)\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 .. 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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), scale)\n        return s"},{"fileName":"ogip_lextab.py","filePath":"astropy/units/format","id":7781,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n_tabversion   = '3.8'\n_lextokens    = set(('UINT', 'WHITESPACE', 'STAR', 'OPEN_PAREN', 'UNIT', 'SIGN', 'UFLOAT', 'STARSTAR', 'DIVISION', 'LIT10', 'CLOSE_PAREN', 'UNKNOWN'))\n_lexreflags   = 0\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_CLOSE_PAREN>\\\\))|(?P<t_OPEN_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, 'CLOSE_PAREN'), (None, 'OPEN_PAREN'), (None, 'STAR'), (None, 'DIVISION')])]}\n_lexstateignore = {'INITIAL': ''}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":7782,"name":"_tabversion","nodeType":"Attribute","startLoc":4,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7783,"name":"_lextokens","nodeType":"Attribute","startLoc":5,"text":"_lextokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7784,"name":"_lexreflags","nodeType":"Attribute","startLoc":6,"text":"_lexreflags"},{"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":501,"id":7785,"nodeType":"Class","startLoc":51,"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        '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        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\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 = float(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            r\"%|([YZEPTGMkhdcmunpfazy]?'((?!\\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='generic_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer\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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : 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 ..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 ..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 signed_int\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] = (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.0\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(\"'{0}' is not a recognized function\".format(p[1]))\n\n        def p_error(p):\n            raise ValueError()\n\n        parser = yacc.yacc(debug=False, tabmodule='generic_parsetab',\n                           outputdir=os.path.dirname(__file__))\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    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 == '%':\n            return registry['percent']\n        elif s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                '{0} is not a valid unit. {1}'.format(\n                    s, did_you_mean(s, registry)))\n        else:\n            raise ValueError()\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        result = cls._do_parse(s, debug=debug)\n        if s.count('/') > 1:\n            warnings.warn(\n                \"'{0}' 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(\n                        \"Syntax error parsing unit '{0}'\".format(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:\n                    out.append('{0}({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}{1}'.format(\n                        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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":7786,"name":"_lexliterals","nodeType":"Attribute","startLoc":7,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":7787,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":8,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7788,"name":"_lexstatere","nodeType":"Attribute","startLoc":9,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":7789,"name":"_lexstateignore","nodeType":"Attribute","startLoc":10,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7790,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":11,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":7791,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":12,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":4,"header":"ogip_lextab.py#<anonymous>","id":7792,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_tabversion   = '3.8'\n\n_lextokens    = set(('UINT', 'WHITESPACE', 'STAR', 'OPEN_PAREN', 'UNIT', 'SIGN', 'UFLOAT', 'STARSTAR', 'DIVISION', 'LIT10', 'CLOSE_PAREN', 'UNKNOWN'))\n\n_lexreflags   = 0\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_CLOSE_PAREN>\\\\))|(?P<t_OPEN_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, 'CLOSE_PAREN'), (None, 'OPEN_PAREN'), (None, 'STAR'), (None, 'DIVISION')])]}\n\n_lexstateignore = {'INITIAL': ''}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"col":4,"comment":"null","endLoc":79,"header":"@classproperty(lazy=True)\n    def _all_units(cls)","id":7793,"name":"_all_units","nodeType":"Function","startLoc":77,"text":"@classproperty(lazy=True)\n    def _all_units(cls):\n        return cls._generate_unit_names()"},{"fileName":"generic_lextab.py","filePath":"astropy/units/format","id":7794,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n_tabversion   = '3.8'\n_lextokens    = set(('CARET', 'CLOSE_PAREN', 'SOLIDUS', 'FUNCNAME', 'UFLOAT', 'STAR', 'SIGN', 'UINT', 'DOUBLE_STAR', 'OPEN_PAREN', 'PERIOD', '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>%|([YZEPTGMkhdcmunpfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+)|(?P<t_DOUBLE_STAR>\\\\*\\\\*)|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_STAR>\\\\*)|(?P<t_PERIOD>\\\\.)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CARET>\\\\^)|(?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, 'CLOSE_PAREN'), (None, 'STAR'), (None, 'PERIOD'), (None, 'OPEN_PAREN'), (None, 'CARET'), (None, 'SOLIDUS')])]}\n_lexstateignore = {'INITIAL': ' '}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":3,"id":7795,"name":"_tabversion","nodeType":"Attribute","startLoc":3,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":7796,"name":"_lextokens","nodeType":"Attribute","startLoc":4,"text":"_lextokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7797,"name":"_lexreflags","nodeType":"Attribute","startLoc":5,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7798,"name":"_lexliterals","nodeType":"Attribute","startLoc":6,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":7799,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":7,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":7800,"name":"_lexstatere","nodeType":"Attribute","startLoc":8,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":7801,"name":"_lexstateignore","nodeType":"Attribute","startLoc":9,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":7802,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":10,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":7803,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":11,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":3,"header":"generic_lextab.py#<anonymous>","id":7804,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"_tabversion   = '3.8'\n\n_lextokens    = set(('CARET', 'CLOSE_PAREN', 'SOLIDUS', 'FUNCNAME', 'UFLOAT', 'STAR', 'SIGN', 'UINT', 'DOUBLE_STAR', 'OPEN_PAREN', 'PERIOD', '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>%|([YZEPTGMkhdcmunpfazy]?'((?!\\\\d)\\\\w)+')|((?!\\\\d)\\\\w)+)|(?P<t_DOUBLE_STAR>\\\\*\\\\*)|(?P<t_CLOSE_PAREN>\\\\))|(?P<t_STAR>\\\\*)|(?P<t_PERIOD>\\\\.)|(?P<t_OPEN_PAREN>\\\\()|(?P<t_CARET>\\\\^)|(?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, 'CLOSE_PAREN'), (None, 'STAR'), (None, 'PERIOD'), (None, 'OPEN_PAREN'), (None, 'CARET'), (None, 'SOLIDUS')])]}\n\n_lexstateignore = {'INITIAL': ' '}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"className":"UnrecognizedUnit","col":0,"comment":"\n    A unit that did not parse correctly.  This allows for\n    roundtripping 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":1721,"id":7805,"nodeType":"Class","startLoc":1663,"text":"class UnrecognizedUnit(IrreducibleUnit):\n    \"\"\"\n    A unit that did not parse correctly.  This allows for\n    roundtripping 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 \"UnrecognizedUnit({0})\".format(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 {0!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))\n\n    __pow__ = __div__ = __rdiv__ = __truediv__ = __rtruediv__ = __mul__ = \\\n        __rmul__ = __lt__ = __gt__ = __le__ = __ge__ = __neg__ = \\\n        _unrecognized_operator\n\n    def __eq__(self, other):\n        other = Unit(other, parse_strict='silent')\n        return isinstance(other, UnrecognizedUnit) 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 {0!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":1680,"header":"def __repr__(self)","id":7806,"name":"__repr__","nodeType":"Function","startLoc":1679,"text":"def __repr__(self):\n        return \"UnrecognizedUnit({0})\".format(str(self))"},{"col":4,"comment":"null","endLoc":1683,"header":"def __bytes__(self)","id":7807,"name":"__bytes__","nodeType":"Function","startLoc":1682,"text":"def __bytes__(self):\n        return self.name.encode('ascii', 'replace')"},{"fileName":"utils.py","filePath":"astropy/units/format","id":7808,"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 ...utils.misc import did_you_mean\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 ints\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 .. 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\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 either looking like\n    an integer or a fraction.\n    \"\"\"\n    if not isinstance(power, Fraction):\n        if power % 1.0 != 0.0:\n            frac = Fraction.from_float(power)\n            power = frac.limit_denominator(10)\n            if power.denominator == 1:\n                power = int(power.numerator)\n        else:\n            power = int(power)\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 ..core import UnitsWarning\n\n    message = \"The unit '{0}' has been deprecated in the {1} standard.\".format(\n        s, standard_name)\n    decomposed = _try_decomposed(unit, format_decomposed)\n    if decomposed is not None:\n        message += \" Suggested: {0}.\".format(decomposed)\n    warnings.warn(message, UnitsWarning)\n"},{"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":494,"header":"def did_you_mean(s, candidates, n=3, cutoff=0.8, fix=None)","id":7809,"name":"did_you_mean","nodeType":"Function","startLoc":419,"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 'Did you mean {0}?'.format(matches)\n\n    return ''"},{"col":0,"comment":"\n    Remove accents from a Unicode string.\n\n    This helps with matching \"ångström\" to \"angstrom\", for example.\n    ","endLoc":416,"header":"def strip_accents(s)","id":7810,"name":"strip_accents","nodeType":"Function","startLoc":408,"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":4,"comment":"null","endLoc":83,"header":"@classproperty(lazy=True)\n    def _units(cls)","id":7811,"name":"_units","nodeType":"Function","startLoc":81,"text":"@classproperty(lazy=True)\n    def _units(cls):\n        return cls._all_units[0]"},{"col":4,"comment":"null","endLoc":87,"header":"@classproperty(lazy=True)\n    def _deprecated_units(cls)","id":7812,"name":"_deprecated_units","nodeType":"Function","startLoc":85,"text":"@classproperty(lazy=True)\n    def _deprecated_units(cls):\n        return cls._all_units[1]"},{"col":4,"comment":"null","endLoc":91,"header":"@classproperty(lazy=True)\n    def _functions(cls)","id":7813,"name":"_functions","nodeType":"Function","startLoc":89,"text":"@classproperty(lazy=True)\n    def _functions(cls):\n        return cls._all_units[2]"},{"col":4,"comment":"null","endLoc":95,"header":"@classproperty(lazy=True)\n    def _parser(cls)","id":7814,"name":"_parser","nodeType":"Function","startLoc":93,"text":"@classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()"},{"col":4,"comment":"null","endLoc":1686,"header":"def __str__(self)","id":7815,"name":"__str__","nodeType":"Function","startLoc":1685,"text":"def __str__(self):\n        return self.name"},{"col":4,"comment":"null","endLoc":1689,"header":"def to_string(self, format=None)","id":7816,"name":"to_string","nodeType":"Function","startLoc":1688,"text":"def to_string(self, format=None):\n        return self.name"},{"col":4,"comment":"null","endLoc":1694,"header":"def _unrecognized_operator(self, *args, **kwargs)","id":7817,"name":"_unrecognized_operator","nodeType":"Function","startLoc":1691,"text":"def _unrecognized_operator(self, *args, **kwargs):\n        raise ValueError(\n            \"The unit {0!r} is unrecognized, so all arithmetic operations \"\n            \"with it are invalid.\".format(self.name))"},{"col":4,"comment":"null","endLoc":1702,"header":"def __eq__(self, other)","id":7818,"name":"__eq__","nodeType":"Function","startLoc":1700,"text":"def __eq__(self, other):\n        other = Unit(other, parse_strict='silent')\n        return isinstance(other, UnrecognizedUnit) and self.name == other.name"},{"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":422,"header":"@classmethod\n    def _make_parser(cls)","id":7819,"name":"_make_parser","nodeType":"Function","startLoc":163,"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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : 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 ..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 ..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 signed_int\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] = (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.0\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(\"'{0}' is not a recognized function\".format(p[1]))\n\n        def p_error(p):\n            raise ValueError()\n\n        parser = yacc.yacc(debug=False, tabmodule='generic_parsetab',\n                           outputdir=os.path.dirname(__file__))\n\n        return parser"},{"col":4,"comment":"null","endLoc":1705,"header":"def __ne__(self, other)","id":7820,"name":"__ne__","nodeType":"Function","startLoc":1704,"text":"def __ne__(self, other):\n        return not (self == other)"},{"col":4,"comment":"null","endLoc":1709,"header":"def is_equivalent(self, other, equivalencies=None)","id":7821,"name":"is_equivalent","nodeType":"Function","startLoc":1707,"text":"def is_equivalent(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        return self == other"},{"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":110,"header":"def decompose_to_known_units(unit, func)","id":7822,"name":"decompose_to_known_units","nodeType":"Function","startLoc":78,"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 .. 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"},{"col":4,"comment":"null","endLoc":1715,"header":"def _get_converter(self, other, equivalencies=None)","id":7823,"name":"_get_converter","nodeType":"Function","startLoc":1711,"text":"def _get_converter(self, other, equivalencies=None):\n        self._normalize_equivalencies(equivalencies)\n        raise ValueError(\n            \"The unit {0!r} is unrecognized.  It can not be converted \"\n            \"to other units.\".format(self.name))"},{"col":0,"comment":"null","endLoc":149,"header":"def _try_decomposed(unit, format_decomposed)","id":7824,"name":"_try_decomposed","nodeType":"Function","startLoc":130,"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":1718,"header":"def get_format_name(self, format)","id":7825,"name":"get_format_name","nodeType":"Function","startLoc":1717,"text":"def get_format_name(self, format):\n        return self.name"},{"col":4,"comment":"null","endLoc":1721,"header":"def is_unity(self)","id":7826,"name":"is_unity","nodeType":"Function","startLoc":1720,"text":"def is_unity(self):\n        return False"},{"attributeType":"null","col":4,"comment":"null","endLoc":1677,"id":7827,"name":"__reduce__","nodeType":"Attribute","startLoc":1677,"text":"__reduce__"},{"attributeType":"function","col":4,"comment":"null","endLoc":1696,"id":7828,"name":"__pow__","nodeType":"Attribute","startLoc":1696,"text":"__pow__"},{"attributeType":"function","col":14,"comment":"null","endLoc":1696,"id":7829,"name":"__div__","nodeType":"Attribute","startLoc":1696,"text":"__div__"},{"attributeType":"function","col":24,"comment":"null","endLoc":1696,"id":7830,"name":"__rdiv__","nodeType":"Attribute","startLoc":1696,"text":"__rdiv__"},{"attributeType":"function","col":35,"comment":"null","endLoc":1696,"id":7831,"name":"__truediv__","nodeType":"Attribute","startLoc":1696,"text":"__truediv__"},{"attributeType":"function","col":49,"comment":"null","endLoc":1696,"id":7832,"name":"__rtruediv__","nodeType":"Attribute","startLoc":1696,"text":"__rtruediv__"},{"attributeType":"function","col":64,"comment":"null","endLoc":1696,"id":7833,"name":"__mul__","nodeType":"Attribute","startLoc":1696,"text":"__mul__"},{"attributeType":"function","col":8,"comment":"null","endLoc":1697,"id":7834,"name":"__rmul__","nodeType":"Attribute","startLoc":1697,"text":"__rmul__"},{"attributeType":"function","col":19,"comment":"null","endLoc":1697,"id":7835,"name":"__lt__","nodeType":"Attribute","startLoc":1697,"text":"__lt__"},{"attributeType":"function","col":28,"comment":"null","endLoc":1697,"id":7836,"name":"__gt__","nodeType":"Attribute","startLoc":1697,"text":"__gt__"},{"attributeType":"function","col":37,"comment":"null","endLoc":1697,"id":7837,"name":"__le__","nodeType":"Attribute","startLoc":1697,"text":"__le__"},{"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":188,"header":"def did_you_mean_units(s, all_units, deprecated_units, format_decomposed)","id":7838,"name":"did_you_mean_units","nodeType":"Function","startLoc":152,"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)"},{"attributeType":"function","col":46,"comment":"null","endLoc":1697,"id":7839,"name":"__ge__","nodeType":"Attribute","startLoc":1697,"text":"__ge__"},{"attributeType":"function","col":55,"comment":"null","endLoc":1697,"id":7840,"name":"__neg__","nodeType":"Attribute","startLoc":1697,"text":"__neg__"},{"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":1813,"id":7841,"nodeType":"Class","startLoc":1724,"text":"class _UnitMetaClass(InheritDocstrings):\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                # cannot use _error_check=False: scale may be effectively unity\n                represents = CompositeUnit(represents.value *\n                                           represents.unit.scale,\n                                           bases=represents.unit.bases,\n                                           powers=represents.unit.powers)\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\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 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 = (\"'{0}' did not parse as {1}unit: {2}\"\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, [], [])\n\n        elif s is None:\n            raise TypeError(\"None is not a valid Unit\")\n\n        else:\n            raise TypeError(\"{0} can not be converted to a Unit\".format(s))"},{"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":1944,"id":7842,"nodeType":"Class","startLoc":1937,"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    \"\"\""},{"col":4,"comment":"null","endLoc":446,"header":"@classmethod\n    def _parse_unit(cls, s, detailed_exception=True)","id":7843,"name":"_parse_unit","nodeType":"Function","startLoc":433,"text":"@classmethod\n    def _parse_unit(cls, s, detailed_exception=True):\n        registry = core.get_current_unit_registry().registry\n        if s == '%':\n            return registry['percent']\n        elif s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                '{0} is not a valid unit. {1}'.format(\n                    s, did_you_mean(s, registry)))\n        else:\n            raise ValueError()"},{"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":2099,"id":7844,"nodeType":"Class","startLoc":1947,"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\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            scale = sanitize_scale(scale)\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        self._scale = scale\n        self._bases = bases\n        self._powers = powers\n        self._decomposed_cache = None\n        self._expand_and_gather(decompose=decompose, bases=decompose_bases)\n        self._hash = None\n\n    def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return 'Unit(dimensionless with a scale of {0})'.format(\n                    self._scale)\n            else:\n                return 'Unit(dimensionless)'\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    @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 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 = [validate_power(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"},{"col":4,"comment":"null","endLoc":2000,"header":"def __repr__(self)","id":7845,"name":"__repr__","nodeType":"Function","startLoc":1992,"text":"def __repr__(self):\n        if len(self._bases):\n            return super().__repr__()\n        else:\n            if self._scale != 1.0:\n                return 'Unit(dimensionless with a scale of {0})'.format(\n                    self._scale)\n            else:\n                return 'Unit(dimensionless)'"},{"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":7846,"name":"unit_deprecation_warning","nodeType":"Function","startLoc":191,"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 ..core import UnitsWarning\n\n    message = \"The unit '{0}' has been deprecated in the {1} standard.\".format(\n        s, standard_name)\n    decomposed = _try_decomposed(unit, format_decomposed)\n    if decomposed is not None:\n        message += \" Suggested: {0}.\".format(decomposed)\n    warnings.warn(message, UnitsWarning)"},{"col":0,"comment":"","endLoc":5,"header":"utils.py#<anonymous>","id":7847,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nUtilities shared by the different formats.\n\"\"\""},{"col":4,"comment":"null","endLoc":2008,"header":"def __hash__(self)","id":7848,"name":"__hash__","nodeType":"Function","startLoc":2002,"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        Return the scale of the composite unit.\n        ","endLoc":2015,"header":"@property\n    def scale(self)","id":7849,"name":"scale","nodeType":"Function","startLoc":2010,"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":2022,"header":"@property\n    def bases(self)","id":7850,"name":"bases","nodeType":"Function","startLoc":2017,"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":2029,"header":"@property\n    def powers(self)","id":7851,"name":"powers","nodeType":"Function","startLoc":2024,"text":"@property\n    def powers(self):\n        \"\"\"\n        Return the powers of the composite unit.\n        \"\"\"\n        return self._powers"},{"col":4,"comment":"\n        For compatibility with python copy module.\n        ","endLoc":2076,"header":"def __copy__(self)","id":7852,"name":"__copy__","nodeType":"Function","startLoc":2072,"text":"def __copy__(self):\n        \"\"\"\n        For compatibility with python copy module.\n        \"\"\"\n        return CompositeUnit(self._scale, self._bases[:], self._powers[:])"},{"fileName":"generic.py","filePath":"astropy/units/format","id":7853,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# Note that  files generated by lex/yacc not always fully py 2/3 compatible.\n# Hence, the ``clean_parse_tables.py`` tool in the astropy-tools\n# (https://github.com/astropy/astropy-tools) repository should be used to fix\n# this when/if lextab/parsetab files are re-generated.\n\"\"\"\nHandles a \"generic\" string format for units\n\"\"\"\n\n\n\nimport os\nimport re\nimport warnings\n\nfrom . import core, utils\nfrom .base import Base\nfrom ...utils import classproperty\nfrom ...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('{0:g}'.format(unit.scale))\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('{0}'.format(unit_list))\n                else:\n                    parts.append('({0})'.format(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        '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        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\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 = float(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            r\"%|([YZEPTGMkhdcmunpfazy]?'((?!\\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='generic_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer\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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : 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 ..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 ..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 signed_int\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] = (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.0\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(\"'{0}' is not a recognized function\".format(p[1]))\n\n        def p_error(p):\n            raise ValueError()\n\n        parser = yacc.yacc(debug=False, tabmodule='generic_parsetab',\n                           outputdir=os.path.dirname(__file__))\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    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 == '%':\n            return registry['percent']\n        elif s in registry:\n            return registry[s]\n\n        if detailed_exception:\n            raise ValueError(\n                '{0} is not a valid unit. {1}'.format(\n                    s, did_you_mean(s, registry)))\n        else:\n            raise ValueError()\n\n    @classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        result = cls._do_parse(s, debug=debug)\n        if s.count('/') > 1:\n            warnings.warn(\n                \"'{0}' 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(\n                        \"Syntax error parsing unit '{0}'\".format(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:\n                    out.append('{0}({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}{1}'.format(\n                        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"},{"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":511,"id":7854,"nodeType":"Class","startLoc":504,"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":511,"id":7855,"name":"_show_scale","nodeType":"Attribute","startLoc":511,"text":"_show_scale"},{"col":4,"comment":"null","endLoc":99,"header":"@classproperty(lazy=True)\n    def _lexer(cls)","id":7856,"name":"_lexer","nodeType":"Function","startLoc":97,"text":"@classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()"},{"col":4,"comment":"null","endLoc":2095,"header":"def decompose(self, bases=set())","id":7857,"name":"decompose","nodeType":"Function","startLoc":2078,"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":9,"header":"generic.py#<anonymous>","id":7858,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"\"\"\"\nHandles a \"generic\" string format for units\n\"\"\""},{"col":4,"comment":"null","endLoc":161,"header":"@classmethod\n    def _make_lexer(cls)","id":7859,"name":"_make_lexer","nodeType":"Function","startLoc":101,"text":"@classmethod\n    def _make_lexer(cls):\n        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\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 = float(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            r\"%|([YZEPTGMkhdcmunpfazy]?'((?!\\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='generic_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer"},{"fileName":"console.py","filePath":"astropy/units/format","id":7860,"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 '^{0}'.format(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('{0}{1}'.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(\"10{0}\".format(\n                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 = \"{{0:^{0}s}} {{1:^{1}s}}\".format(l, r)\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"},{"col":4,"comment":"null","endLoc":2099,"header":"def is_unity(self)","id":7861,"name":"is_unity","nodeType":"Function","startLoc":2097,"text":"def is_unity(self):\n        unit = self.decompose()\n        return len(unit.bases) == 0 and unit.scale == 1.0"},{"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":98,"id":7862,"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 '^{0}'.format(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('{0}{1}'.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(\"10{0}\".format(\n                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 = \"{{0:^{0}s}} {{1:^{1}s}}\".format(l, r)\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":431,"header":"@classmethod\n    def _get_unit(cls, t)","id":7863,"name":"_get_unit","nodeType":"Function","startLoc":424,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    t.lexpos, str(e)))"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7864,"name":"_get_unit_name","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('console')"},{"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":463,"id":7865,"nodeType":"Class","startLoc":26,"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 ... 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        from ...extern.ply import lex\n\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='ogip_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        return lexer\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        from ...extern.ply import yacc\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 '{0}' 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 ..core import UnitsWarning\n                warnings.warn(\n                    \"'{0}' 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        parser = yacc.yacc(debug=False, tabmodule='ogip_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, '{1}': {2}\".format(\n                    t.lexpos, t.value, str(e)))\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 '{0}' not supported by the OGIP \"\n                    \"standard. {1}\".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                        \"Syntax error parsing unit '{0}'\".format(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('{0}**({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}**{1}'.format(\n                        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                    \"'{0}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(\n                        unit.scale),\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 '{0} (with data multiplied by {1})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)"},{"col":4,"comment":"null","endLoc":106,"header":"@staticmethod\n    def _generate_unit_names()","id":7866,"name":"_generate_unit_names","nodeType":"Function","startLoc":48,"text":"@staticmethod\n    def _generate_unit_names():\n\n        from ... 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"},{"col":0,"comment":"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    ","endLoc":79,"header":"def _validate_arg_value(param_name, func_name, arg, targets, equivalencies)","id":7867,"name":"_validate_arg_value","nodeType":"Function","startLoc":43,"text":"def _validate_arg_value(param_name, func_name, arg, targets, equivalencies):\n    \"\"\"\n    Validates the object passed in to the wrapped function, ``arg``, with target\n    unit or physical type, ``target``.\n    \"\"\"\n\n    allowed_units = _get_allowed_units(targets)\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(\"Argument '{0}' to function '{1}' has {2}. \"\n                  \"You may want to pass in an astropy Quantity instead.\"\n                     .format(param_name, func_name, error_msg))\n\n    else:\n        if len(targets) > 1:\n            raise UnitsError(\"Argument '{0}' to function '{1}' must be in units\"\n                             \" convertible to one of: {2}.\"\n                             .format(param_name, func_name,\n                                     [str(targ) for targ in targets]))\n        else:\n            raise UnitsError(\"Argument '{0}' to function '{1}' must be in units\"\n                             \" convertible to '{2}'.\"\n                             .format(param_name, func_name,\n                                     str(targets[0])))"},{"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":40,"header":"def _get_allowed_units(targets)","id":7868,"name":"_get_allowed_units","nodeType":"Function","startLoc":14,"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\n    allowed_units = []\n    for target in targets:\n\n        try:  # unit passed in as a string\n            target_unit = Unit(target)\n\n        except ValueError:\n\n            try:  # See if the function writer specified a physical type\n                physical_type_id = _unit_physical_mapping[target]\n\n            except KeyError:  # Function argument target is invalid\n                raise ValueError(\"Invalid unit or physical type '{0}'.\"\n                                 .format(target))\n\n            # get unit directly from physical type id\n            target_unit = Unit._from_physical_type_id(physical_type_id)\n\n        allowed_units.append(target_unit)\n\n    return allowed_units"},{"col":4,"comment":"null","endLoc":166,"header":"@classmethod\n    def _make_lexer(cls)","id":7869,"name":"_make_lexer","nodeType":"Function","startLoc":108,"text":"@classmethod\n    def _make_lexer(cls):\n        from ...extern.ply import lex\n\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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='ogip_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        return lexer"},{"col":4,"comment":"null","endLoc":459,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":7870,"name":"parse","nodeType":"Function","startLoc":448,"text":"@classmethod\n    def parse(cls, s, debug=False):\n        if not isinstance(s, str):\n            s = s.decode('ascii')\n\n        result = cls._do_parse(s, debug=debug)\n        if s.count('/') > 1:\n            warnings.warn(\n                \"'{0}' contains multiple slashes, which is \"\n                \"discouraged by the FITS standard\".format(s),\n                core.UnitsWarning)\n        return result"},{"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 <http://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":279,"header":"def doppler_radio(rest)","id":7871,"name":"doppler_radio","nodeType":"Function","startLoc":217,"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 <http://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 [(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            ]"},{"col":0,"comment":"null","endLoc":535,"header":"def assert_is_spectral_unit(value)","id":7872,"name":"assert_is_spectral_unit","nodeType":"Function","startLoc":530,"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":4,"comment":"null","endLoc":35,"header":"@classmethod\n    def _format_superscript(cls, number)","id":7873,"name":"_format_superscript","nodeType":"Function","startLoc":33,"text":"@classmethod\n    def _format_superscript(cls, number):\n        return '^{0}'.format(number)"},{"col":4,"comment":"null","endLoc":475,"header":"@classmethod\n    def _do_parse(cls, s, debug=False)","id":7874,"name":"_do_parse","nodeType":"Function","startLoc":461,"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(\n                        \"Syntax error parsing unit '{0}'\".format(s))"},{"col":4,"comment":"null","endLoc":48,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":7875,"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('{0}{1}'.format(\n                    cls._get_unit_name(base),\n                    cls._format_superscript(\n                            utils.format_power(power))))\n        return ' '.join(out)"},{"col":4,"comment":"null","endLoc":366,"header":"@classmethod\n    def _get_unit(cls, t)","id":7876,"name":"_get_unit","nodeType":"Function","startLoc":359,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, '{1}': {2}\".format(\n                    t.lexpos, t.value, str(e)))"},{"col":4,"comment":"null","endLoc":389,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":7877,"name":"_parse_unit","nodeType":"Function","startLoc":386,"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":384,"header":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True)","id":7878,"name":"_validate_unit","nodeType":"Function","startLoc":368,"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 '{0}' not supported by the OGIP \"\n                    \"standard. {1}\".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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":7879,"name":"decorator_kwargs","nodeType":"Attribute","startLoc":153,"text":"self.decorator_kwargs"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":7880,"name":"equivalencies","nodeType":"Attribute","startLoc":152,"text":"self.equivalencies"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":7881,"name":"__all__","nodeType":"Attribute","startLoc":4,"text":"__all__"},{"attributeType":"function","col":0,"comment":"null","endLoc":231,"id":7882,"name":"quantity_input","nodeType":"Attribute","startLoc":231,"text":"quantity_input"},{"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":357,"header":"@classmethod\n    def _make_parser(cls)","id":7883,"name":"_make_parser","nodeType":"Function","startLoc":168,"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        from ...extern.ply import yacc\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 '{0}' 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 ..core import UnitsWarning\n                warnings.warn(\n                    \"'{0}' 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        parser = yacc.yacc(debug=False, tabmodule='ogip_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser"},{"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 <http://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":345,"header":"def doppler_optical(rest)","id":7884,"name":"doppler_optical","nodeType":"Function","startLoc":282,"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 <http://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 [(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            ]"},{"attributeType":"None","col":8,"comment":"null","endLoc":1988,"id":7885,"name":"_decomposed_cache","nodeType":"Attribute","startLoc":1988,"text":"self._decomposed_cache"},{"attributeType":"null","col":8,"comment":"null","endLoc":1985,"id":7886,"name":"_scale","nodeType":"Attribute","startLoc":1985,"text":"self._scale"},{"attributeType":"None","col":8,"comment":"null","endLoc":1990,"id":7887,"name":"_hash","nodeType":"Attribute","startLoc":1990,"text":"self._hash"},{"col":4,"comment":"null","endLoc":407,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":7888,"name":"parse","nodeType":"Function","startLoc":391,"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                        \"Syntax error parsing unit '{0}'\".format(s))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1986,"id":7889,"name":"_bases","nodeType":"Attribute","startLoc":1986,"text":"self._bases"},{"attributeType":"null","col":8,"comment":"null","endLoc":1987,"id":7890,"name":"_powers","nodeType":"Attribute","startLoc":1987,"text":"self._powers"},{"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 equivalent pairs\n        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: +SKIP\n        <Quantity  -1. +1.22464680e-16j>\n    ","endLoc":423,"header":"def set_enabled_equivalencies(equivalencies)","id":7891,"name":"set_enabled_equivalencies","nodeType":"Function","startLoc":390,"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 equivalent pairs\n        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: +SKIP\n        <Quantity  -1. +1.22464680e-16j>\n    \"\"\"\n    # doctest skipped as the complex number formatting changed in numpy 1.14.\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"},{"col":0,"comment":"","endLoc":4,"header":"decorators.py#<anonymous>","id":7892,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['quantity_input']\n\nquantity_input = QuantityInput.as_decorator"},{"col":4,"comment":"null","endLoc":413,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7893,"name":"_get_unit_name","nodeType":"Function","startLoc":409,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        name = unit.get_format_name('ogip')\n        cls._validate_unit(name)\n        return name"},{"fileName":"latex.py","filePath":"astropy/units/format","id":7894,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandles the \"LaTeX\" unit format.\n\"\"\"\n\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            if power == 1:\n                out.append(cls._get_unit_name(base))\n            else:\n                out.append('{0}^{{{1}}}'.format(\n                    cls._get_unit_name(base),\n                    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 = r'\\frac{{{0}}}{{{1}}}'.format(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 r'$\\mathrm{{{0}}}$'.format(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(\"10^{{{0}}}\".format(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    <http://journals.aas.org/authors/manuscript.html>`_.\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"},{"col":0,"comment":"\n    This is used to reconstruct units when passed around by\n    multiprocessing.\n    ","endLoc":1610,"header":"def _recreate_irreducible_unit(cls, names, registered)","id":7895,"name":"_recreate_irreducible_unit","nodeType":"Function","startLoc":1593,"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"},{"col":4,"comment":"null","endLoc":431,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":7896,"name":"_format_unit_list","nodeType":"Function","startLoc":415,"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('{0}**({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}**{1}'.format(\n                        cls._get_unit_name(base), power))\n        return ' '.join(out)"},{"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    <http://journals.aas.org/authors/manuscript.html>`_.\n    ","endLoc":140,"id":7897,"nodeType":"Class","startLoc":126,"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    <http://journals.aas.org/authors/manuscript.html>`_.\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":140,"header":"@classmethod\n    def _format_bases(cls, unit)","id":7898,"name":"_format_bases","nodeType":"Function","startLoc":138,"text":"@classmethod\n    def _format_bases(cls, unit):\n        return cls._format_unit_list(zip(unit.bases, unit.powers))"},{"col":23,"endLoc":418,"id":7899,"nodeType":"Lambda","startLoc":418,"text":"lambda x: cls._get_unit_name(x[0]).lower()"},{"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 <http://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":418,"header":"def doppler_relativistic(rest)","id":7900,"name":"doppler_relativistic","nodeType":"Function","startLoc":348,"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 <http://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    \"\"\"\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 [(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            ]"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":7901,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":276,"id":7902,"name":"_unit_registries","nodeType":"Attribute","startLoc":276,"text":"_unit_registries"},{"attributeType":"CompositeUnit","col":0,"comment":"null","endLoc":2300,"id":7903,"name":"one","nodeType":"Attribute","startLoc":2300,"text":"one"},{"col":4,"comment":"null","endLoc":479,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7904,"name":"_get_unit_name","nodeType":"Function","startLoc":477,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('generic')"},{"col":4,"comment":"null","endLoc":497,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":7905,"name":"_format_unit_list","nodeType":"Function","startLoc":481,"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('{0}({1})'.format(\n                        cls._get_unit_name(base), power))\n                else:\n                    out.append('{0}{1}'.format(\n                        cls._get_unit_name(base), power))\n        return ' '.join(out)"},{"col":0,"comment":"","endLoc":6,"header":"core.py#<anonymous>","id":7906,"name":"<anonymous>","nodeType":"Function","startLoc":4,"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    'dimensionless_unscaled', 'one']\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"},{"col":4,"comment":"null","endLoc":62,"header":"@classmethod\n    def format_exponential_notation(cls, val)","id":7907,"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(\"10{0}\".format(\n                cls._format_superscript(ex)))\n\n        return cls._times.join(parts)"},{"fileName":"cds.py","filePath":"astropy/units/format","id":7908,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICNSE.rst\n\n# Note that  files generated by lex/yacc not always fully py 2/3 compatible.\n# Hence, the ``clean_parse_tables.py`` tool in the astropy-tools\n# (https://github.com/astropy/astropy-tools) repository should be used to fix\n# this when/if lextab/parsetab files are re-generated.\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 ..utils import is_effectively_unity\nfrom ...utils import classproperty\nfrom ...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://cds.u-strasbg.fr/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <http://vizier.u-strasbg.fr/cgi-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        'X',\n        'SIGN',\n        'UINT',\n        'UFLOAT',\n        'UNIT'\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 .. import cds\n        from ... 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        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = 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            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        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='cds_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer\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://cds.u-strasbg.fr/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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | factor\n            '''\n            from ..core import Unit\n            if len(p) == 3:\n                p[0] = Unit(p[1] * 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        parser = yacc.yacc(debug=False, tabmodule='cds_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    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 '{0}' not supported by the CDS SAC \"\n                    \"standard. {1}\".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('{0}{1}'.format(\n                    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.physical_type == 'dimensionless' and\n               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('10{0}'.format(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":0,"comment":"\n    Returns the equivalence between amu and molar mass.\n    ","endLoc":427,"header":"def molar_mass_amu()","id":7909,"name":"molar_mass_amu","nodeType":"Function","startLoc":421,"text":"def molar_mass_amu():\n    \"\"\"\n    Returns the equivalence between amu and molar mass.\n    \"\"\"\n    return [\n        (si.g/si.mol, astrophys.u)\n    ]"},{"col":0,"comment":"\n    Returns a list of equivalence pairs that handle the conversion\n    between mass and energy.\n    ","endLoc":446,"header":"def mass_energy()","id":7910,"name":"mass_energy","nodeType":"Function","startLoc":430,"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 [(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    ]"},{"col":26,"endLoc":436,"id":7911,"nodeType":"Lambda","startLoc":436,"text":"lambda x: x * _si.c.value ** 2"},{"col":13,"endLoc":437,"id":7912,"nodeType":"Lambda","startLoc":437,"text":"lambda x: x / _si.c.value ** 2"},{"col":13,"endLoc":439,"id":7913,"nodeType":"Lambda","startLoc":439,"text":"lambda x: x * _si.c.value ** 2"},{"col":13,"endLoc":440,"id":7914,"nodeType":"Lambda","startLoc":440,"text":"lambda x: x / _si.c.value ** 2"},{"col":13,"endLoc":442,"id":7915,"nodeType":"Lambda","startLoc":442,"text":"lambda x: x * _si.c.value ** 2"},{"col":13,"endLoc":443,"id":7916,"nodeType":"Lambda","startLoc":443,"text":"lambda x: x / _si.c.value ** 2"},{"col":40,"endLoc":444,"id":7917,"nodeType":"Lambda","startLoc":444,"text":"lambda x: x * _si.c.value ** 2"},{"col":13,"endLoc":445,"id":7918,"nodeType":"Lambda","startLoc":445,"text":"lambda x: x / _si.c.value ** 2"},{"col":0,"comment":"\n    Defines the conversion between Jy/beam 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    <http://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    However, the beam area is essential for this computation: the brightness\n    temperature is inversely proportional to the beam area\n\n    Parameters\n    ----------\n    beam_area : Beam Area equivalent\n        Beam area in angular units, i.e. steradian equivalent\n    disp : `~astropy.units.Quantity` with spectral units\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength)\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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        3.526294429423223\n        >>> (1*u.Jy).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526294429423223 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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        217.2658703625732\n    ","endLoc":508,"header":"def brightness_temperature(beam_area, disp)","id":7919,"name":"brightness_temperature","nodeType":"Function","startLoc":449,"text":"def brightness_temperature(beam_area, disp):\n    r\"\"\"\n    Defines the conversion between Jy/beam 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    <http://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    However, the beam area is essential for this computation: the brightness\n    temperature is inversely proportional to the beam area\n\n    Parameters\n    ----------\n    beam_area : Beam Area equivalent\n        Beam area in angular units, i.e. steradian equivalent\n    disp : `~astropy.units.Quantity` with spectral units\n        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,\n        frequency or wavelength)\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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        3.526294429423223\n        >>> (1*u.Jy).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        <Quantity 3.526294429423223 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(beam_area, freq)\n        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP\n        217.2658703625732\n    \"\"\"\n    beam = beam_area.to_value(si.sr)\n    nu = disp.to(si.GHz, spectral())\n\n    def convert_Jy_to_K(x_jybm):\n        factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to_value(astrophys.Jy)\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_value(si.K)\n        return (x_K * beam / factor)\n\n    return [(astrophys.Jy, si.K, convert_Jy_to_K, convert_K_to_Jy)]"},{"col":23,"endLoc":484,"id":7920,"nodeType":"Lambda","startLoc":484,"text":"lambda x: cls._get_unit_name(x[0]).lower()"},{"attributeType":"null","col":4,"comment":"null","endLoc":136,"id":7921,"name":"name","nodeType":"Attribute","startLoc":136,"text":"name"},{"col":0,"comment":"","endLoc":5,"header":"latex.py#<anonymous>","id":7922,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHandles the \"LaTeX\" unit format.\n\"\"\""},{"fileName":"__init__.py","filePath":"astropy/units/format","id":7923,"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\nfrom .generic import Generic, Unscaled\nfrom .cds import CDS\nfrom .console import Console\nfrom .fits import Fits\nfrom .latex import Latex, LatexInline\nfrom .ogip import OGIP\nfrom .unicode_format import Unicode\nfrom .vounit import VOUnit\n\n\n__all__ = [\n    'Base', 'Generic', 'CDS', 'Console', 'Fits', 'Latex', 'LatexInline',\n    'OGIP', 'Unicode', 'Unscaled', 'VOUnit', 'get_format']\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 isinstance(format, type) and issubclass(format, Base):\n        return format\n    elif not (isinstance(format, str) or format is None):\n        raise TypeError(\n            \"Formatter must a subclass or instance of a subclass of {0!r} \"\n            \"or a string giving the name of the formatter.  Valid formatter \"\n            \"names are: [{1}]\".format(Base, ', '.join(Base.registry)))\n\n    if format is None:\n        format = 'generic'\n\n    format_lower = format.lower()\n\n    if format_lower in Base.registry:\n        return Base.registry[format_lower]\n\n    raise ValueError(\"Unknown format {0!r}.  Valid formatter names are: \"\n                     \"[{1}]\".format(format, ', '.join(Base.registry)))\n"},{"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://cds.u-strasbg.fr/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <http://vizier.u-strasbg.fr/cgi-bin/Unit>`_.  This format is used\n    by VOTable up to version 1.2.\n    ","endLoc":353,"id":7925,"nodeType":"Class","startLoc":28,"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://cds.u-strasbg.fr/doc/catstd-3.2.htx>`_\n    format, and the `complete set of supported units\n    <http://vizier.u-strasbg.fr/cgi-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        'X',\n        'SIGN',\n        'UINT',\n        'UFLOAT',\n        'UNIT'\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 .. import cds\n        from ... 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        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = 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            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        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='cds_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer\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://cds.u-strasbg.fr/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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | factor\n            '''\n            from ..core import Unit\n            if len(p) == 3:\n                p[0] = Unit(p[1] * 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        parser = yacc.yacc(debug=False, tabmodule='cds_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser\n\n    @classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    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 '{0}' not supported by the CDS SAC \"\n                    \"standard. {1}\".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('{0}{1}'.format(\n                    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.physical_type == 'dimensionless' and\n               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('10{0}'.format(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":52,"header":"@classproperty(lazy=True)\n    def _units(cls)","id":7926,"name":"_units","nodeType":"Function","startLoc":50,"text":"@classproperty(lazy=True)\n    def _units(cls):\n        return cls._generate_unit_names()"},{"col":4,"comment":"null","endLoc":56,"header":"@classproperty(lazy=True)\n    def _parser(cls)","id":7927,"name":"_parser","nodeType":"Function","startLoc":54,"text":"@classproperty(lazy=True)\n    def _parser(cls):\n        return cls._make_parser()"},{"col":0,"comment":"Convert between Kelvin, Celsius, and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    ","endLoc":520,"header":"def temperature()","id":7928,"name":"temperature","nodeType":"Function","startLoc":511,"text":"def temperature():\n    \"\"\"Convert between Kelvin, Celsius, and Fahrenheit here because\n    Unit and CompositeUnit cannot do addition or subtraction properly.\n    \"\"\"\n    from .imperial import deg_F\n    return [\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)]"},{"col":25,"endLoc":517,"id":7929,"nodeType":"Lambda","startLoc":517,"text":"lambda x: x - 273.15"},{"col":47,"endLoc":517,"id":7930,"nodeType":"Lambda","startLoc":517,"text":"lambda x: x + 273.15"},{"col":26,"endLoc":518,"id":7931,"nodeType":"Lambda","startLoc":518,"text":"lambda x: x * 1.8 + 32.0"},{"col":52,"endLoc":518,"id":7932,"nodeType":"Lambda","startLoc":518,"text":"lambda x: (x - 32.0) / 1.8"},{"col":22,"endLoc":519,"id":7933,"nodeType":"Lambda","startLoc":519,"text":"lambda x: (x - 273.15) * 1.8 + 32.0"},{"col":9,"endLoc":520,"id":7934,"nodeType":"Lambda","startLoc":520,"text":"lambda x: ((x - 32.0) / 1.8) + 273.15"},{"col":0,"comment":"Convert between Kelvin and keV(eV) to an equivalent amount.","endLoc":527,"header":"def temperature_energy()","id":7935,"name":"temperature_energy","nodeType":"Function","startLoc":523,"text":"def temperature_energy():\n    \"\"\"Convert between Kelvin and keV(eV) to an equivalent amount.\"\"\"\n    return [\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))]"},{"col":22,"endLoc":526,"id":7936,"nodeType":"Lambda","startLoc":526,"text":"lambda x: x / (_si.e.value / _si.k_B.value)"},{"col":9,"endLoc":527,"id":7937,"nodeType":"Lambda","startLoc":527,"text":"lambda x: x * (_si.e.value / _si.k_B.value)"},{"col":0,"comment":"\n    Convert between pixel distances (in units of ``pix``) and angular units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of angle/pixel or pixel/angle.\n    ","endLoc":556,"header":"def pixel_scale(pixscale)","id":7938,"name":"pixel_scale","nodeType":"Function","startLoc":538,"text":"def pixel_scale(pixscale):\n    \"\"\"\n    Convert between pixel distances (in units of ``pix``) and angular units,\n    given a particular ``pixscale``.\n\n    Parameters\n    ----------\n    pixscale : `~astropy.units.Quantity`\n        The pixel scale either in units of angle/pixel or pixel/angle.\n    \"\"\"\n    if pixscale.unit.is_equivalent(si.arcsec/astrophys.pix):\n        pixscale_val = pixscale.to_value(si.radian/astrophys.pix)\n    elif pixscale.unit.is_equivalent(astrophys.pix/si.arcsec):\n        pixscale_val = (1/pixscale).to_value(si.radian/astrophys.pix)\n    else:\n        raise UnitsError(\"The pixel scale must be in angle/pixel or \"\n                         \"pixel/angle\")\n\n    return [(astrophys.pix, si.radian, lambda px: px*pixscale_val, lambda rad: rad/pixscale_val)]"},{"col":39,"endLoc":556,"id":7939,"nodeType":"Lambda","startLoc":556,"text":"lambda px: px*pixscale_val"},{"col":67,"endLoc":556,"id":7940,"nodeType":"Lambda","startLoc":556,"text":"lambda rad: rad/pixscale_val"},{"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":577,"header":"def plate_scale(platescale)","id":7941,"name":"plate_scale","nodeType":"Function","startLoc":559,"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 [(si.m, si.radian, lambda d: d*platescale_val, lambda rad: rad/platescale_val)]"},{"attributeType":"null","col":4,"comment":"null","endLoc":60,"id":7942,"name":"_show_scale","nodeType":"Attribute","startLoc":60,"text":"_show_scale"},{"attributeType":"null","col":4,"comment":"null","endLoc":62,"id":7943,"name":"_tokens","nodeType":"Attribute","startLoc":62,"text":"_tokens"},{"col":4,"comment":"null","endLoc":80,"header":"@staticmethod\n    def _generate_unit_names()","id":7944,"name":"_generate_unit_names","nodeType":"Function","startLoc":28,"text":"@staticmethod\n    def _generate_unit_names():\n        from ... import units as u\n        from ...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":30,"endLoc":577,"id":7945,"nodeType":"Lambda","startLoc":577,"text":"lambda d: d*platescale_val"},{"col":58,"endLoc":577,"id":7946,"nodeType":"Lambda","startLoc":577,"text":"lambda rad: rad/platescale_val"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":7947,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"col":0,"comment":"","endLoc":2,"header":"equivalencies.py#<anonymous>","id":7948,"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', 'mass_energy',\n           'brightness_temperature', 'dimensionless_angles',\n           'logarithmic', 'temperature', 'temperature_energy', 'molar_mass_amu',\n           'pixel_scale', 'plate_scale']"},{"fileName":"fits.py","filePath":"astropy/units/format","id":7949,"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 ... 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 '{0}' not supported by the FITS standard. {1}\".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                    \"{0:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append('10**{0}'.format(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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), 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":4,"comment":"\n        The grammar here is based on the description in the `Standards\n        for Astronomical Catalogues 2.0\n        <http://cds.u-strasbg.fr/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":260,"header":"@classmethod\n    def _make_parser(cls)","id":7950,"name":"_make_parser","nodeType":"Function","startLoc":129,"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://cds.u-strasbg.fr/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        from ...extern.ply import yacc\n\n        tokens = cls._tokens\n\n        def p_main(p):\n            '''\n            main : factor combined_units\n                 | combined_units\n                 | factor\n            '''\n            from ..core import Unit\n            if len(p) == 3:\n                p[0] = Unit(p[1] * 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        parser = yacc.yacc(debug=False, tabmodule='cds_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser"},{"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":157,"id":7951,"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 ... 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 '{0}' not supported by the FITS standard. {1}\".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                    \"{0:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append('10**{0}'.format(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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), 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":80,"header":"@staticmethod\n    def _generate_unit_names()","id":7953,"name":"_generate_unit_names","nodeType":"Function","startLoc":27,"text":"@staticmethod\n    def _generate_unit_names():\n        from ... 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":96,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":7954,"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        if s.count('/') > 1:\n            raise core.UnitsError(\n                \"'{0}' 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":"null","endLoc":97,"header":"@classmethod\n    def _validate_unit(cls, unit, detailed_exception=True)","id":7955,"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 '{0}' not supported by the FITS standard. {1}\".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":"null","endLoc":102,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":7956,"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":60,"header":"@classproperty(lazy=True)\n    def _lexer(cls)","id":7957,"name":"_lexer","nodeType":"Function","startLoc":58,"text":"@classproperty(lazy=True)\n    def _lexer(cls):\n        return cls._make_lexer()"},{"col":4,"comment":"null","endLoc":108,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7958,"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":137,"header":"@classmethod\n    def to_string(cls, unit)","id":7959,"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                    \"{0:e}.\".format(unit.scale))\n            elif unit.scale != 1.0:\n                parts.append('10**{0}'.format(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":127,"header":"@classmethod\n    def _make_lexer(cls)","id":7960,"name":"_make_lexer","nodeType":"Function","startLoc":75,"text":"@classmethod\n    def _make_lexer(cls):\n        from ...extern.ply import lex\n\n        tokens = cls._tokens\n\n        t_PRODUCT = r'\\.'\n        t_DIVISION = 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            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        t_ignore = ''\n\n        # Error handling rule\n        def t_error(t):\n            raise ValueError(\n                \"Invalid character at col {0}\".format(t.lexpos))\n\n        lexer = lex.lex(optimize=True, lextab='cds_lextab',\n                        outputdir=os.path.dirname(__file__),\n                        reflags=re.UNICODE)\n\n        return lexer"},{"col":4,"comment":"null","endLoc":98,"header":"@classmethod\n    def to_string(cls, unit)","id":7961,"name":"to_string","nodeType":"Function","startLoc":64,"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 = \"{{0:^{0}s}} {{1:^{1}s}}\".format(l, r)\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":269,"header":"@classmethod\n    def _get_unit(cls, t)","id":7962,"name":"_get_unit","nodeType":"Function","startLoc":262,"text":"@classmethod\n    def _get_unit(cls, t):\n        try:\n            return cls._parse_unit(t.value)\n        except ValueError as e:\n            raise ValueError(\n                \"At col {0}, {1}\".format(\n                    t.lexpos, str(e)))"},{"col":4,"comment":"null","endLoc":122,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":7963,"name":"_parse_unit","nodeType":"Function","startLoc":98,"text":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True):\n        if unit not in cls._units:\n            if cls._explicit_custom_unit_regex.match(unit):\n                return cls._def_custom_unit(unit)\n\n            if not cls._custom_unit_regex.match(unit):\n                raise ValueError()\n\n            warnings.warn(\n                \"Unit {0!r} not supported by the VOUnit \"\n                \"standard. {1}\".format(\n                    unit, utils.did_you_mean_units(\n                        unit, cls._units, cls._deprecated_units,\n                        cls._to_decomposed_alternative)),\n                core.UnitsWarning)\n\n            return cls._def_custom_unit(unit)\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":447,"header":"@classmethod\n    def to_string(cls, unit)","id":7964,"name":"to_string","nodeType":"Function","startLoc":433,"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                    \"'{0}' scale should be a power of 10 in \"\n                    \"OGIP format\".format(\n                        unit.scale),\n                    core.UnitsWarning)\n\n        return generic._to_string(cls, unit)"},{"col":4,"comment":"null","endLoc":73,"header":"@staticmethod\n    def _generate_unit_names()","id":7965,"name":"_generate_unit_names","nodeType":"Function","startLoc":62,"text":"@staticmethod\n    def _generate_unit_names():\n        from .. import cds\n        from ... 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":283,"header":"@classmethod\n    def _parse_unit(cls, unit, detailed_exception=True)","id":7966,"name":"_parse_unit","nodeType":"Function","startLoc":271,"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 '{0}' not supported by the CDS SAC \"\n                    \"standard. {1}\".format(\n                        unit, did_you_mean(\n                            unit, cls._units)))\n            else:\n                raise ValueError()\n\n        return cls._units[unit]"},{"col":4,"comment":"null","endLoc":463,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":7967,"name":"_to_decomposed_alternative","nodeType":"Function","startLoc":449,"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 '{0} (with data multiplied by {1})'.format(\n                    generic._to_string(cls, unit), scale)\n\n        return generic._to_string(unit)"},{"col":4,"comment":"null","endLoc":304,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":7968,"name":"parse","nodeType":"Function","startLoc":285,"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\")"},{"col":4,"comment":"null","endLoc":308,"header":"@staticmethod\n    def _get_unit_name(unit)","id":7969,"name":"_get_unit_name","nodeType":"Function","startLoc":306,"text":"@staticmethod\n    def _get_unit_name(unit):\n        return unit.get_format_name('cds')"},{"col":4,"comment":"null","endLoc":319,"header":"@classmethod\n    def _format_unit_list(cls, units)","id":7970,"name":"_format_unit_list","nodeType":"Function","startLoc":310,"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('{0}{1}'.format(\n                    cls._get_unit_name(base), int(power)))\n        return '.'.join(out)"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":7971,"name":"_times","nodeType":"Attribute","startLoc":26,"text":"_times"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":7972,"name":"_line","nodeType":"Attribute","startLoc":27,"text":"_line"},{"col":0,"comment":"","endLoc":6,"header":"console.py#<anonymous>","id":7973,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nHandles the \"Console\" unit format.\n\"\"\""},{"col":4,"comment":"null","endLoc":353,"header":"@classmethod\n    def to_string(cls, unit)","id":7974,"name":"to_string","nodeType":"Function","startLoc":321,"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.physical_type == 'dimensionless' and\n               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('10{0}'.format(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"},{"fileName":"unicode_format.py","filePath":"astropy/units/format","id":7975,"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(\"10{0}\".format(\n                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"},{"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":69,"id":7976,"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(\"10{0}\".format(\n                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":149,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":7977,"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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), scale)\n        return s"},{"col":4,"comment":"null","endLoc":31,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7978,"name":"_get_unit_name","nodeType":"Function","startLoc":29,"text":"@classmethod\n    def _get_unit_name(cls, unit):\n        return unit.get_format_name('unicode')"},{"attributeType":"null","col":4,"comment":"null","endLoc":33,"id":7979,"name":"_tokens","nodeType":"Attribute","startLoc":33,"text":"_tokens"},{"col":4,"comment":"null","endLoc":184,"header":"@classmethod\n    def _def_custom_unit(cls, unit)","id":7980,"name":"_def_custom_unit","nodeType":"Function","startLoc":154,"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)"},{"col":4,"comment":"null","endLoc":45,"header":"@classmethod\n    def format_exponential_notation(cls, val)","id":7982,"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(\"10{0}\".format(\n                cls._format_superscript(ex)))\n\n        return cls._times.join(parts)"},{"col":0,"comment":"","endLoc":12,"header":"ogip.py#<anonymous>","id":7983,"name":"<anonymous>","nodeType":"Function","startLoc":8,"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\"\"\""},{"fileName":"cds_lextab.py","filePath":"astropy/units/format","id":7984,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n_tabversion   = '3.8'\n_lextokens    = set(('UINT', 'PRODUCT', 'OPEN_PAREN', 'UNIT', 'SIGN', 'UFLOAT', 'DIVISION', 'CLOSE_PAREN', '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_CLOSE_PAREN>\\\\))|(?P<t_OPEN_PAREN>\\\\()|(?P<t_PRODUCT>\\\\.)|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_UNIT', 'UNIT'), None, (None, 'CLOSE_PAREN'), (None, 'OPEN_PAREN'), (None, 'PRODUCT'), (None, 'DIVISION')])]}\n_lexstateignore = {'INITIAL': ''}\n_lexstateerrorf = {'INITIAL': 't_error'}\n_lexstateeoff = {}\n"},{"col":4,"comment":"null","endLoc":152,"header":"@classmethod\n    def _get_unit_name(cls, unit)","id":7985,"name":"_get_unit_name","nodeType":"Function","startLoc":124,"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 '{0}': 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 '{0}': 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                \"Unit {0!r} is not part of the VOUnit standard\".format(name))\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"},{"col":4,"comment":"null","endLoc":157,"header":"@classmethod\n    def parse(cls, s, debug=False)","id":7986,"name":"parse","nodeType":"Function","startLoc":151,"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":4,"comment":"null","endLoc":25,"id":7987,"name":"name","nodeType":"Attribute","startLoc":25,"text":"name"},{"attributeType":"null","col":4,"comment":"null","endLoc":38,"id":7988,"name":"_tokens","nodeType":"Attribute","startLoc":38,"text":"_tokens"},{"col":0,"comment":"","endLoc":5,"header":"fits.py#<anonymous>","id":7989,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHandles the \"FITS\" unit format.\n\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":7990,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"__init__.py#<anonymous>","id":7991,"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']"},{"fileName":"generic_parsetab.py","filePath":"astropy/units/format","id":7992,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# This file is automatically generated. Do not edit.\n_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'A63D4C561E2ED1A045DB279536CAFDDA'\n    \n_lr_action_items = {'CARET':([16,17,29,42,],[39,39,39,39,]),'FUNCNAME':([0,1,4,5,7,8,9,14,15,16,17,19,20,21,22,24,25,27,31,33,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[18,-16,18,-32,-17,18,18,-14,-48,-37,-20,-15,18,-33,18,18,-46,-47,18,18,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'CLOSE_PAREN':([1,2,4,5,7,9,10,12,14,16,17,19,21,23,26,28,30,32,34,35,36,45,47,48,49,50,51,52,55,56,57,58,59,61,62,63,65,66,67,69,71,72,73,74,75,76,77,78,79,81,83,],[-16,-4,-10,-32,-17,-31,-1,-7,-14,-37,-20,-15,-33,-5,-8,-2,55,-30,-53,-52,-36,-21,-13,-11,-6,-9,-3,-18,-34,-29,74,-38,-35,-42,-41,76,-23,-27,-22,-26,79,-51,-19,-55,-40,-39,-24,81,-28,-25,-43,]),'UFLOAT':([0,6,13,33,41,60,68,70,],[-45,-44,34,-45,-45,34,-44,-45,]),'$end':([1,2,3,4,5,7,9,10,12,14,16,17,19,21,23,26,28,32,34,35,36,45,47,48,49,50,51,52,55,56,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,-4,0,-10,-32,-17,-31,-1,-7,-14,-37,-20,-15,-33,-5,-8,-2,-30,-53,-52,-36,-21,-13,-11,-6,-9,-3,-18,-34,-29,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'SOLIDUS':([0,1,2,4,5,7,9,10,14,16,17,19,21,23,24,25,27,28,32,33,34,35,36,45,48,49,51,52,55,56,58,59,65,66,67,69,72,73,74,75,76,77,79,81,],[15,-16,15,15,-32,-17,-31,-12,-14,-37,-20,-15,-33,15,15,-46,-47,-12,-30,15,-53,-52,-36,-21,-11,15,-12,-18,-34,-29,-38,-35,-23,-27,-22,-26,-51,-19,-55,15,-39,-24,-28,-25,]),'UINT':([0,6,7,13,15,16,17,33,34,35,37,38,39,40,41,43,44,53,54,60,64,68,70,80,82,],[17,-44,29,35,-48,-45,42,17,-53,-52,58,-45,-50,-49,-45,66,-45,72,-45,75,-45,72,-45,-45,83,]),'SIGN':([0,15,16,17,29,33,38,39,40,41,42,44,46,54,64,70,80,],[6,-48,6,43,53,6,6,-50,-49,6,53,68,53,6,6,68,6,]),'DOUBLE_STAR':([16,17,29,42,],[40,40,40,40,]),'OPEN_PAREN':([0,1,4,5,7,8,9,11,14,15,16,17,18,19,20,21,22,24,25,27,31,33,34,35,36,38,39,40,44,45,52,54,55,58,59,64,65,66,67,69,72,73,74,76,77,79,81,],[8,-16,8,-32,-17,8,8,33,-14,-48,41,46,-54,-15,8,-33,8,8,-46,-47,8,8,-53,-52,-36,41,-50,-49,70,-21,-18,41,-34,-38,-35,41,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'PERIOD':([1,4,5,7,9,14,16,17,19,21,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,27,-32,-17,27,-14,-37,-20,-15,-33,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'STAR':([1,4,5,7,9,14,16,17,19,21,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,25,-32,-17,25,-14,-37,-20,-15,-33,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'UNIT':([0,1,4,5,7,8,9,14,15,16,17,19,20,21,22,24,25,27,31,33,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[16,-16,16,-32,-17,16,16,-14,-48,-37,-20,-15,16,-33,16,16,-46,-47,16,16,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),}\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 = {'power':([16,17,29,42,],[38,44,54,64,]),'sign':([0,16,33,38,41,44,54,64,70,80,],[13,37,13,37,60,37,37,37,60,82,]),'factor_int':([0,33,],[1,1,]),'numeric_power':([16,38,44,54,64,],[36,59,67,73,77,]),'division_product_of_units':([0,4,24,33,],[2,23,49,2,]),'signed_int':([17,29,42,44,46,70,],[45,52,65,69,71,78,]),'signed_float':([0,33,41,70,],[7,7,62,62,]),'factor':([0,33,],[4,4,]),'function':([0,4,8,9,20,22,24,31,33,],[5,5,5,5,5,5,5,5,5,]),'factor_fits':([0,33,],[14,14,]),'product':([4,9,],[24,31,]),'paren_expr':([41,70,],[63,63,]),'main':([0,33,],[3,57,]),'inverse_unit':([0,4,24,33,],[12,26,50,12,]),'factor_float':([0,33,],[19,19,]),'division':([0,2,4,23,24,33,49,75,],[20,22,20,22,20,20,22,80,]),'unit_expression':([0,4,8,9,20,22,24,31,33,],[9,9,9,9,47,9,9,9,9,]),'product_of_units':([0,4,8,9,22,24,31,33,],[10,28,30,32,48,51,56,10,]),'function_name':([0,4,8,9,20,22,24,31,33,],[11,11,11,11,11,11,11,11,11,]),'frac':([41,70,],[61,61,]),'unit_with_power':([0,4,8,9,20,22,24,31,33,],[21,21,21,21,21,21,21,21,21,]),}\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 -> product_of_units','main',1,'p_main','generic.py',186),\n  ('main -> factor product_of_units','main',2,'p_main','generic.py',187),\n  ('main -> factor product product_of_units','main',3,'p_main','generic.py',188),\n  ('main -> division_product_of_units','main',1,'p_main','generic.py',189),\n  ('main -> factor division_product_of_units','main',2,'p_main','generic.py',190),\n  ('main -> factor product division_product_of_units','main',3,'p_main','generic.py',191),\n  ('main -> inverse_unit','main',1,'p_main','generic.py',192),\n  ('main -> factor inverse_unit','main',2,'p_main','generic.py',193),\n  ('main -> factor product inverse_unit','main',3,'p_main','generic.py',194),\n  ('main -> factor','main',1,'p_main','generic.py',195),\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',207),\n  ('division_product_of_units -> product_of_units','division_product_of_units',1,'p_division_product_of_units','generic.py',208),\n  ('inverse_unit -> division unit_expression','inverse_unit',2,'p_inverse_unit','generic.py',218),\n  ('factor -> factor_fits','factor',1,'p_factor','generic.py',224),\n  ('factor -> factor_float','factor',1,'p_factor','generic.py',225),\n  ('factor -> factor_int','factor',1,'p_factor','generic.py',226),\n  ('factor_float -> signed_float','factor_float',1,'p_factor_float','generic.py',232),\n  ('factor_float -> signed_float UINT signed_int','factor_float',3,'p_factor_float','generic.py',233),\n  ('factor_float -> signed_float UINT power numeric_power','factor_float',4,'p_factor_float','generic.py',234),\n  ('factor_int -> UINT','factor_int',1,'p_factor_int','generic.py',247),\n  ('factor_int -> UINT signed_int','factor_int',2,'p_factor_int','generic.py',248),\n  ('factor_int -> UINT power numeric_power','factor_int',3,'p_factor_int','generic.py',249),\n  ('factor_int -> UINT UINT signed_int','factor_int',3,'p_factor_int','generic.py',250),\n  ('factor_int -> UINT UINT power numeric_power','factor_int',4,'p_factor_int','generic.py',251),\n  ('factor_fits -> UINT power OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',269),\n  ('factor_fits -> UINT power signed_int','factor_fits',3,'p_factor_fits','generic.py',270),\n  ('factor_fits -> UINT SIGN UINT','factor_fits',3,'p_factor_fits','generic.py',271),\n  ('factor_fits -> UINT OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',4,'p_factor_fits','generic.py',272),\n  ('product_of_units -> unit_expression product product_of_units','product_of_units',3,'p_product_of_units','generic.py',291),\n  ('product_of_units -> unit_expression product_of_units','product_of_units',2,'p_product_of_units','generic.py',292),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','generic.py',293),\n  ('unit_expression -> function','unit_expression',1,'p_unit_expression','generic.py',304),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','generic.py',305),\n  ('unit_expression -> OPEN_PAREN product_of_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','generic.py',306),\n  ('unit_with_power -> UNIT power numeric_power','unit_with_power',3,'p_unit_with_power','generic.py',315),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','generic.py',316),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','generic.py',317),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','generic.py',328),\n  ('numeric_power -> OPEN_PAREN paren_expr CLOSE_PAREN','numeric_power',3,'p_numeric_power','generic.py',329),\n  ('paren_expr -> sign UINT','paren_expr',2,'p_paren_expr','generic.py',338),\n  ('paren_expr -> signed_float','paren_expr',1,'p_paren_expr','generic.py',339),\n  ('paren_expr -> frac','paren_expr',1,'p_paren_expr','generic.py',340),\n  ('frac -> sign UINT division sign UINT','frac',5,'p_frac','generic.py',349),\n  ('sign -> SIGN','sign',1,'p_sign','generic.py',355),\n  ('sign -> <empty>','sign',0,'p_sign','generic.py',356),\n  ('product -> STAR','product',1,'p_product','generic.py',365),\n  ('product -> PERIOD','product',1,'p_product','generic.py',366),\n  ('division -> SOLIDUS','division',1,'p_division','generic.py',372),\n  ('power -> DOUBLE_STAR','power',1,'p_power','generic.py',378),\n  ('power -> CARET','power',1,'p_power','generic.py',379),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','generic.py',385),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','generic.py',391),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','generic.py',392),\n  ('function_name -> FUNCNAME','function_name',1,'p_function_name','generic.py',398),\n  ('function -> function_name OPEN_PAREN main CLOSE_PAREN','function',4,'p_function','generic.py',404),\n]\n"},{"fileName":"ogip_parsetab.py","filePath":"astropy/units/format","id":7993,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# This file is automatically generated. Do not edit.\n_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = '6AD6E7286443B59D7DF329E6378BFC6B'\n    \n_lr_action_items = {'UINT':([0,2,7,9,18,22,23,28,31,32,35,37,40,42,59,60,63,],[-38,19,-20,33,-21,39,-29,39,-23,39,39,-22,-38,-37,39,39,66,]),'WHITESPACE':([0,3,4,6,7,8,12,13,15,17,18,19,20,21,25,29,36,39,41,43,44,46,47,48,49,51,52,53,54,56,61,62,64,65,67,],[1,-30,24,29,31,-16,1,-17,-6,-10,37,-40,-41,1,45,1,-7,-32,-33,-31,57,-8,-9,-19,58,-15,-12,-18,-11,1,-34,-35,-14,-13,-36,]),'CLOSE_PAREN':([3,4,15,17,19,20,33,34,36,38,39,41,43,46,47,52,54,55,56,61,62,64,65,66,67,],[-30,-5,-6,-10,-40,-41,-39,52,-7,54,-32,-33,-31,-8,-9,-12,-11,61,62,-34,-35,-14,-13,67,-36,]),'OPEN_PAREN':([0,3,6,7,8,12,13,16,18,19,20,21,22,23,24,25,26,27,28,29,31,32,35,37,39,41,44,45,48,49,51,53,57,58,59,60,61,62,67,],[12,21,12,-20,-16,12,-17,12,-21,-40,-41,12,40,-29,-24,-25,12,12,40,12,-23,40,40,-22,-32,-33,-26,-28,-19,-20,-15,-18,-27,-22,40,40,-34,-35,-36,]),'UNIT':([0,6,7,8,12,13,16,18,19,20,21,24,25,26,27,29,31,37,39,41,44,45,48,49,51,53,57,58,61,62,67,],[3,3,-20,-16,3,-17,3,-21,-40,-41,3,-24,-25,3,3,3,-23,-22,-32,-33,-26,-28,-19,-20,-15,-18,-27,-22,-34,-35,-36,]),'UFLOAT':([0,2,9,22,23,28,32,35,40,42,59,60,],[-38,20,-37,-38,-29,-38,-38,-38,-38,-37,-38,-38,]),'SIGN':([0,22,23,28,32,35,40,59,60,],[9,42,-29,42,42,42,9,42,42,]),'DIVISION':([0,1,3,4,6,8,12,13,15,17,19,20,21,24,29,36,39,41,43,46,47,48,51,52,53,54,56,61,62,64,65,67,],[7,18,-30,7,7,-16,7,-17,-6,-10,-40,-41,7,18,49,-7,-32,-33,-31,-8,-9,-19,-15,-12,-18,-11,7,-34,-35,-14,-13,-36,]),'$end':([3,4,10,11,14,15,17,19,20,30,36,39,41,43,46,47,50,52,54,61,62,64,65,67,],[-30,-5,-1,-2,0,-6,-10,-40,-41,-3,-7,-32,-33,-31,-8,-9,-4,-12,-11,-34,-35,-14,-13,-36,]),'STARSTAR':([3,5,8,13,19,20,33,52,54,],[23,23,23,23,-40,-41,-39,23,23,]),'LIT10':([0,],[8,]),'STAR':([3,4,15,17,19,20,24,36,39,41,43,46,47,52,54,61,62,64,65,67,],[-30,25,-6,-10,-40,-41,44,-7,-32,-33,-31,-8,-9,-12,-11,-34,-35,-14,-13,-36,]),'UNKNOWN':([0,],[10,]),}\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 = {'sign':([0,22,28,32,35,40,59,60,],[2,2,2,2,2,2,2,2,]),'signed_float':([0,22,28,32,35,40,59,60,],[13,41,41,41,41,56,41,41,]),'numeric_power':([22,28,32,35,59,60,],[43,48,51,53,64,65,]),'product_of_units':([0,6,12,21,29,],[4,4,4,4,4,]),'signed_int':([0,40,],[5,55,]),'scale_factor':([0,],[6,]),'product':([4,],[26,]),'main':([0,],[14,]),'power':([3,5,8,13,52,54,],[22,28,32,35,59,60,]),'unit_expression':([0,6,12,16,21,26,27,29,],[15,15,15,36,15,46,47,15,]),'division':([0,4,6,12,21,29,56,],[16,27,16,16,16,16,63,]),'unit':([0,6,12,16,21,26,27,29,],[17,17,17,17,17,17,17,17,]),'complete_expression':([0,6,12,21,29,],[11,30,34,38,50,]),}\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',188),\n  ('main -> complete_expression','main',1,'p_main','ogip.py',189),\n  ('main -> scale_factor complete_expression','main',2,'p_main','ogip.py',190),\n  ('main -> scale_factor WHITESPACE complete_expression','main',3,'p_main','ogip.py',191),\n  ('complete_expression -> product_of_units','complete_expression',1,'p_complete_expression','ogip.py',202),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','ogip.py',208),\n  ('product_of_units -> division unit_expression','product_of_units',2,'p_product_of_units','ogip.py',209),\n  ('product_of_units -> product_of_units product unit_expression','product_of_units',3,'p_product_of_units','ogip.py',210),\n  ('product_of_units -> product_of_units division unit_expression','product_of_units',3,'p_product_of_units','ogip.py',211),\n  ('unit_expression -> unit','unit_expression',1,'p_unit_expression','ogip.py',225),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',4,'p_unit_expression','ogip.py',226),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',3,'p_unit_expression','ogip.py',227),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',6,'p_unit_expression','ogip.py',228),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',5,'p_unit_expression','ogip.py',229),\n  ('scale_factor -> LIT10 power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',263),\n  ('scale_factor -> LIT10','scale_factor',1,'p_scale_factor','ogip.py',264),\n  ('scale_factor -> signed_float','scale_factor',1,'p_scale_factor','ogip.py',265),\n  ('scale_factor -> signed_float power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',266),\n  ('scale_factor -> signed_int power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',267),\n  ('division -> DIVISION','division',1,'p_division','ogip.py',282),\n  ('division -> WHITESPACE DIVISION','division',2,'p_division','ogip.py',283),\n  ('division -> WHITESPACE DIVISION WHITESPACE','division',3,'p_division','ogip.py',284),\n  ('division -> DIVISION WHITESPACE','division',2,'p_division','ogip.py',285),\n  ('product -> WHITESPACE','product',1,'p_product','ogip.py',291),\n  ('product -> STAR','product',1,'p_product','ogip.py',292),\n  ('product -> WHITESPACE STAR','product',2,'p_product','ogip.py',293),\n  ('product -> WHITESPACE STAR WHITESPACE','product',3,'p_product','ogip.py',294),\n  ('product -> STAR WHITESPACE','product',2,'p_product','ogip.py',295),\n  ('power -> STARSTAR','power',1,'p_power','ogip.py',301),\n  ('unit -> UNIT','unit',1,'p_unit','ogip.py',307),\n  ('unit -> UNIT power numeric_power','unit',3,'p_unit','ogip.py',308),\n  ('numeric_power -> UINT','numeric_power',1,'p_numeric_power','ogip.py',317),\n  ('numeric_power -> signed_float','numeric_power',1,'p_numeric_power','ogip.py',318),\n  ('numeric_power -> OPEN_PAREN signed_int CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',319),\n  ('numeric_power -> OPEN_PAREN signed_float CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',320),\n  ('numeric_power -> OPEN_PAREN signed_float division UINT CLOSE_PAREN','numeric_power',5,'p_numeric_power','ogip.py',321),\n  ('sign -> SIGN','sign',1,'p_sign','ogip.py',332),\n  ('sign -> <empty>','sign',0,'p_sign','ogip.py',333),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','ogip.py',342),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','ogip.py',348),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','ogip.py',349),\n]\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":7994,"name":"_tabversion","nodeType":"Attribute","startLoc":4,"text":"_tabversion"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":7995,"name":"_lextokens","nodeType":"Attribute","startLoc":5,"text":"_lextokens"},{"col":4,"comment":"null","endLoc":221,"header":"@classmethod\n    def to_string(cls, unit)","id":7996,"name":"to_string","nodeType":"Function","startLoc":186,"text":"@classmethod\n    def to_string(cls, unit):\n        from .. 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 {0:e}.\"\n                    .format(unit.scale))\n            s = ''\n            if unit.scale != 1:\n                m, ex = utils.split_mantissa_exponent(unit.scale)\n                parts = []\n                if m:\n                    parts.append(m)\n                if ex:\n                    fex = '10'\n                    if not ex.startswith('-'):\n                        fex += '+'\n                    fex += ex\n                    parts.append(fex)\n                s += ' '.join(parts)\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":7997,"name":"_lexreflags","nodeType":"Attribute","startLoc":6,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":7998,"name":"_lexliterals","nodeType":"Attribute","startLoc":7,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":7999,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":8,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8000,"name":"_lexstatere","nodeType":"Attribute","startLoc":9,"text":"_lexstatere"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":8001,"name":"_lexstateignore","nodeType":"Attribute","startLoc":10,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8002,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":11,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8003,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":12,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":4,"header":"cds_lextab.py#<anonymous>","id":8004,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_tabversion   = '3.8'\n\n_lextokens    = set(('UINT', 'PRODUCT', 'OPEN_PAREN', 'UNIT', 'SIGN', 'UFLOAT', 'DIVISION', 'CLOSE_PAREN', '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_CLOSE_PAREN>\\\\))|(?P<t_OPEN_PAREN>\\\\()|(?P<t_PRODUCT>\\\\.)|(?P<t_DIVISION>/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_UNIT', 'UNIT'), None, (None, 'CLOSE_PAREN'), (None, 'OPEN_PAREN'), (None, 'PRODUCT'), (None, 'DIVISION')])]}\n\n_lexstateignore = {'INITIAL': ''}\n\n_lexstateerrorf = {'INITIAL': 't_error'}\n\n_lexstateeoff = {}"},{"fileName":"base.py","filePath":"astropy/units/format","id":8005,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom ...utils.misc import InheritDocstrings\n\n\nclass _FormatterMeta(InheritDocstrings):\n    registry = {}\n\n    def __new__(mcls, name, bases, members):\n        if 'name' in members:\n            formatter_name = members['name'].lower()\n        else:\n            formatter_name = members['name'] = name.lower()\n\n        cls = super().__new__(mcls, name, bases, members)\n\n        mcls.registry[formatter_name] = cls\n\n        return cls\n\n\nclass Base(metaclass=_FormatterMeta):\n    \"\"\"\n    The abstract base class of all unit formats.\n    \"\"\"\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    @classmethod\n    def parse(cls, s):\n        \"\"\"\n        Convert a string to a unit object.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not parse {0}\".format(cls.__name__))\n\n    @classmethod\n    def to_string(cls, u):\n        \"\"\"\n        Convert a unit object to a string.\n        \"\"\"\n\n        raise NotImplementedError(\n            \"Can not output in {0} format\".format(cls.__name__))\n"},{"className":"_FormatterMeta","col":0,"comment":"null","endLoc":18,"id":8006,"nodeType":"Class","startLoc":5,"text":"class _FormatterMeta(InheritDocstrings):\n    registry = {}\n\n    def __new__(mcls, name, bases, members):\n        if 'name' in members:\n            formatter_name = members['name'].lower()\n        else:\n            formatter_name = members['name'] = name.lower()\n\n        cls = super().__new__(mcls, name, bases, members)\n\n        mcls.registry[formatter_name] = cls\n\n        return cls"},{"col":4,"comment":"null","endLoc":18,"header":"def __new__(mcls, name, bases, members)","id":8007,"name":"__new__","nodeType":"Function","startLoc":8,"text":"def __new__(mcls, name, bases, members):\n        if 'name' in members:\n            formatter_name = members['name'].lower()\n        else:\n            formatter_name = members['name'] = name.lower()\n\n        cls = super().__new__(mcls, name, bases, members)\n\n        mcls.registry[formatter_name] = cls\n\n        return cls"},{"col":0,"comment":"","endLoc":11,"header":"cds.py#<anonymous>","id":8008,"name":"<anonymous>","nodeType":"Function","startLoc":9,"text":"\"\"\"\nHandles the CDS string format for units\n\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":8009,"name":"_tabversion","nodeType":"Attribute","startLoc":5,"text":"_tabversion"},{"id":8010,"name":"astropy/units/function","nodeType":"Package"},{"fileName":"core.py","filePath":"astropy/units/function","id":8011,"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 .. import (Unit, UnitBase, UnitsError, UnitTypeError,\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', 'power',\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 ValueError(\"Unit {0} 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 ValueError(\"Cannot initialize '{0}' instance with \"\n                                 \"function unit '{1}', as it is not \"\n                                 \"equivalent to default function unit '{2}'.\"\n                                 .format(self.__class__.__name__,\n                                         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 : unit object or 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 equivalence pairs, 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 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` object, `~astropy.units.function.FunctionUnitBase` object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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 meant to treat only equivalencies between different\n            physical units; the build-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        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            # when other is not a function unit\n            return self.physical_unit.to(other, self.to_physical(value),\n                                         equivalencies)\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 __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 __div__(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 __rdiv__(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    __truediv__ = __div__\n\n    __rtruediv__ = __rdiv__\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 {0} 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 += '({0})'.format(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 += '({0})'.format(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 'Unit(\"{0}\")'.format(self.to_string())\n\n        else:\n            return '{0}(\"{1}\"{2})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else ', unit=\"{0}\"'.format(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, sequence of convertible items, `~astropy.units.Quantity`, or `~astropy.units.function.FunctionQuantity`\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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 behaviour\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 behaviour\n    def __array_prepare__(self, obj, context=None):\n        \"\"\"Check that the ufunc can deal with a FunctionQuantity.\"\"\"\n\n        # If no context is set, just return the input\n        if context is None:  # pragma: no cover\n            return obj\n\n        # Find out whether ufunc is supported\n        function = context[0]\n        if not (function in self._supported_ufuncs or\n                all(arg.unit.physical_unit == dimensionless_unscaled\n                    for arg in context[1][:function.nin]\n                    if (hasattr(arg, 'unit') and\n                        hasattr(arg.unit, 'physical_unit')))):\n            raise UnitTypeError(\"Cannot use function '{0}' with function \"\n                                \"quantities that are not dimensionless.\"\n                                .format(context[0].__name__))\n\n        return super().__array_prepare__(obj, context)\n\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                    \"{0} instances require {1} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    \", so cannot set it to '{0}'.\".format(unit))\n\n        self._unit = unit\n\n    # ↓↓↓ methods overridden to change behaviour\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.__rdiv__(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    # 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 '{0}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":6,"id":8012,"name":"registry","nodeType":"Attribute","startLoc":6,"text":"registry"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":8013,"name":"_lr_method","nodeType":"Attribute","startLoc":7,"text":"_lr_method"},{"attributeType":"null","col":12,"comment":"null","endLoc":12,"id":8014,"name":"formatter_name","nodeType":"Attribute","startLoc":12,"text":"formatter_name"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8015,"name":"_lr_signature","nodeType":"Attribute","startLoc":9,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8016,"name":"_lr_action_items","nodeType":"Attribute","startLoc":11,"text":"_lr_action_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8017,"name":"_lr_action","nodeType":"Attribute","startLoc":13,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":8018,"name":"_k","nodeType":"Attribute","startLoc":14,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":8019,"name":"cls","nodeType":"Attribute","startLoc":14,"text":"cls"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":8020,"name":"_v","nodeType":"Attribute","startLoc":14,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":15,"id":8021,"name":"_x","nodeType":"Attribute","startLoc":15,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":15,"id":8022,"name":"_y","nodeType":"Attribute","startLoc":15,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":8023,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":20,"text":"_lr_goto_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":8024,"name":"_lr_goto","nodeType":"Attribute","startLoc":22,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":8025,"name":"_k","nodeType":"Attribute","startLoc":23,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":8026,"name":"_v","nodeType":"Attribute","startLoc":23,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":24,"id":8027,"name":"_x","nodeType":"Attribute","startLoc":24,"text":"_x"},{"attributeType":"null","col":11,"comment":"null","endLoc":24,"id":8028,"name":"_y","nodeType":"Attribute","startLoc":24,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":8029,"name":"_lr_productions","nodeType":"Attribute","startLoc":28,"text":"_lr_productions"},{"col":0,"comment":"","endLoc":5,"header":"ogip_parsetab.py#<anonymous>","id":8030,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = '6AD6E7286443B59D7DF329E6378BFC6B'\n\n_lr_action_items = {'UINT':([0,2,7,9,18,22,23,28,31,32,35,37,40,42,59,60,63,],[-38,19,-20,33,-21,39,-29,39,-23,39,39,-22,-38,-37,39,39,66,]),'WHITESPACE':([0,3,4,6,7,8,12,13,15,17,18,19,20,21,25,29,36,39,41,43,44,46,47,48,49,51,52,53,54,56,61,62,64,65,67,],[1,-30,24,29,31,-16,1,-17,-6,-10,37,-40,-41,1,45,1,-7,-32,-33,-31,57,-8,-9,-19,58,-15,-12,-18,-11,1,-34,-35,-14,-13,-36,]),'CLOSE_PAREN':([3,4,15,17,19,20,33,34,36,38,39,41,43,46,47,52,54,55,56,61,62,64,65,66,67,],[-30,-5,-6,-10,-40,-41,-39,52,-7,54,-32,-33,-31,-8,-9,-12,-11,61,62,-34,-35,-14,-13,67,-36,]),'OPEN_PAREN':([0,3,6,7,8,12,13,16,18,19,20,21,22,23,24,25,26,27,28,29,31,32,35,37,39,41,44,45,48,49,51,53,57,58,59,60,61,62,67,],[12,21,12,-20,-16,12,-17,12,-21,-40,-41,12,40,-29,-24,-25,12,12,40,12,-23,40,40,-22,-32,-33,-26,-28,-19,-20,-15,-18,-27,-22,40,40,-34,-35,-36,]),'UNIT':([0,6,7,8,12,13,16,18,19,20,21,24,25,26,27,29,31,37,39,41,44,45,48,49,51,53,57,58,61,62,67,],[3,3,-20,-16,3,-17,3,-21,-40,-41,3,-24,-25,3,3,3,-23,-22,-32,-33,-26,-28,-19,-20,-15,-18,-27,-22,-34,-35,-36,]),'UFLOAT':([0,2,9,22,23,28,32,35,40,42,59,60,],[-38,20,-37,-38,-29,-38,-38,-38,-38,-37,-38,-38,]),'SIGN':([0,22,23,28,32,35,40,59,60,],[9,42,-29,42,42,42,9,42,42,]),'DIVISION':([0,1,3,4,6,8,12,13,15,17,19,20,21,24,29,36,39,41,43,46,47,48,51,52,53,54,56,61,62,64,65,67,],[7,18,-30,7,7,-16,7,-17,-6,-10,-40,-41,7,18,49,-7,-32,-33,-31,-8,-9,-19,-15,-12,-18,-11,7,-34,-35,-14,-13,-36,]),'$end':([3,4,10,11,14,15,17,19,20,30,36,39,41,43,46,47,50,52,54,61,62,64,65,67,],[-30,-5,-1,-2,0,-6,-10,-40,-41,-3,-7,-32,-33,-31,-8,-9,-4,-12,-11,-34,-35,-14,-13,-36,]),'STARSTAR':([3,5,8,13,19,20,33,52,54,],[23,23,23,23,-40,-41,-39,23,23,]),'LIT10':([0,],[8,]),'STAR':([3,4,15,17,19,20,24,36,39,41,43,46,47,52,54,61,62,64,65,67,],[-30,25,-6,-10,-40,-41,44,-7,-32,-33,-31,-8,-9,-12,-11,-34,-35,-14,-13,-36,]),'UNKNOWN':([0,],[10,]),}\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 = {'sign':([0,22,28,32,35,40,59,60,],[2,2,2,2,2,2,2,2,]),'signed_float':([0,22,28,32,35,40,59,60,],[13,41,41,41,41,56,41,41,]),'numeric_power':([22,28,32,35,59,60,],[43,48,51,53,64,65,]),'product_of_units':([0,6,12,21,29,],[4,4,4,4,4,]),'signed_int':([0,40,],[5,55,]),'scale_factor':([0,],[6,]),'product':([4,],[26,]),'main':([0,],[14,]),'power':([3,5,8,13,52,54,],[22,28,32,35,59,60,]),'unit_expression':([0,6,12,16,21,26,27,29,],[15,15,15,36,15,46,47,15,]),'division':([0,4,6,12,21,29,56,],[16,27,16,16,16,16,63,]),'unit':([0,6,12,16,21,26,27,29,],[17,17,17,17,17,17,17,17,]),'complete_expression':([0,6,12,21,29,],[11,30,34,38,50,]),}\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',188),\n  ('main -> complete_expression','main',1,'p_main','ogip.py',189),\n  ('main -> scale_factor complete_expression','main',2,'p_main','ogip.py',190),\n  ('main -> scale_factor WHITESPACE complete_expression','main',3,'p_main','ogip.py',191),\n  ('complete_expression -> product_of_units','complete_expression',1,'p_complete_expression','ogip.py',202),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','ogip.py',208),\n  ('product_of_units -> division unit_expression','product_of_units',2,'p_product_of_units','ogip.py',209),\n  ('product_of_units -> product_of_units product unit_expression','product_of_units',3,'p_product_of_units','ogip.py',210),\n  ('product_of_units -> product_of_units division unit_expression','product_of_units',3,'p_product_of_units','ogip.py',211),\n  ('unit_expression -> unit','unit_expression',1,'p_unit_expression','ogip.py',225),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',4,'p_unit_expression','ogip.py',226),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN','unit_expression',3,'p_unit_expression','ogip.py',227),\n  ('unit_expression -> UNIT OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',6,'p_unit_expression','ogip.py',228),\n  ('unit_expression -> OPEN_PAREN complete_expression CLOSE_PAREN power numeric_power','unit_expression',5,'p_unit_expression','ogip.py',229),\n  ('scale_factor -> LIT10 power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',263),\n  ('scale_factor -> LIT10','scale_factor',1,'p_scale_factor','ogip.py',264),\n  ('scale_factor -> signed_float','scale_factor',1,'p_scale_factor','ogip.py',265),\n  ('scale_factor -> signed_float power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',266),\n  ('scale_factor -> signed_int power numeric_power','scale_factor',3,'p_scale_factor','ogip.py',267),\n  ('division -> DIVISION','division',1,'p_division','ogip.py',282),\n  ('division -> WHITESPACE DIVISION','division',2,'p_division','ogip.py',283),\n  ('division -> WHITESPACE DIVISION WHITESPACE','division',3,'p_division','ogip.py',284),\n  ('division -> DIVISION WHITESPACE','division',2,'p_division','ogip.py',285),\n  ('product -> WHITESPACE','product',1,'p_product','ogip.py',291),\n  ('product -> STAR','product',1,'p_product','ogip.py',292),\n  ('product -> WHITESPACE STAR','product',2,'p_product','ogip.py',293),\n  ('product -> WHITESPACE STAR WHITESPACE','product',3,'p_product','ogip.py',294),\n  ('product -> STAR WHITESPACE','product',2,'p_product','ogip.py',295),\n  ('power -> STARSTAR','power',1,'p_power','ogip.py',301),\n  ('unit -> UNIT','unit',1,'p_unit','ogip.py',307),\n  ('unit -> UNIT power numeric_power','unit',3,'p_unit','ogip.py',308),\n  ('numeric_power -> UINT','numeric_power',1,'p_numeric_power','ogip.py',317),\n  ('numeric_power -> signed_float','numeric_power',1,'p_numeric_power','ogip.py',318),\n  ('numeric_power -> OPEN_PAREN signed_int CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',319),\n  ('numeric_power -> OPEN_PAREN signed_float CLOSE_PAREN','numeric_power',3,'p_numeric_power','ogip.py',320),\n  ('numeric_power -> OPEN_PAREN signed_float division UINT CLOSE_PAREN','numeric_power',5,'p_numeric_power','ogip.py',321),\n  ('sign -> SIGN','sign',1,'p_sign','ogip.py',332),\n  ('sign -> <empty>','sign',0,'p_sign','ogip.py',333),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','ogip.py',342),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','ogip.py',348),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','ogip.py',349),\n]"},{"fileName":"magnitude_zero_points.py","filePath":"astropy/units/function","id":8031,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis package defines magnitude zero points.  By default, they are used to\ndefine corresponding magnitudes, but not enabled as regular physical units.\nTo enable them, do::\n\n    >>> from astropy.units import magnitude_zero_points\n    >>> magnitude_zero_points.enable()  # doctest: +SKIP\n\"\"\"\n\n\nimport numpy as _numpy\nfrom ..core import UnitBase, def_unit\n\nfrom ...constants import si as _si\nfrom .. import 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\")\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\")\ndef_unit(['AB'], 10.**(-0.4*48.6) * 1.e-3 * si.W / si.m**2 / si.Hz,\n         namespace=_ns, prefixes=False,\n         doc=\"AB magnitude zero flux density.\")\ndef_unit(['ST'], 10.**(-0.4*21.1) * 1.e-3 * si.W / si.m**2 / si.AA,\n         namespace=_ns, prefixes=False,\n         doc=\"ST magnitude zero flux density.\")\n\n###########################################################################\n# CLEANUP\n\ndel UnitBase\ndel def_unit\ndel si\ndel 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\n\ndef enable():\n    \"\"\"\n    Enable magnitude zero point 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 these\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    Enable magnitude zero point 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 these\n    units only temporarily.\n    ","endLoc":66,"header":"def enable()","id":8032,"name":"enable","nodeType":"Function","startLoc":53,"text":"def enable():\n    \"\"\"\n    Enable magnitude zero point 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 these\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))"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":8033,"name":"_numpy","nodeType":"Attribute","startLoc":14,"text":"_numpy"},{"attributeType":"null","col":31,"comment":"null","endLoc":17,"id":8034,"name":"_si","nodeType":"Attribute","startLoc":17,"text":"_si"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":8035,"name":"_ns","nodeType":"Attribute","startLoc":21,"text":"_ns"},{"attributeType":"null","col":45,"comment":"null","endLoc":48,"id":8036,"name":"_generate_unit_summary","nodeType":"Attribute","startLoc":48,"text":"_generate_unit_summary"},{"col":0,"comment":"","endLoc":11,"header":"magnitude_zero_points.py#<anonymous>","id":8037,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis package defines magnitude zero points.  By default, they are used to\ndefine corresponding magnitudes, but not enabled as regular physical units.\nTo enable them, do::\n\n    >>> from astropy.units import magnitude_zero_points\n    >>> magnitude_zero_points.enable()  # doctest: +SKIP\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\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\")\n\ndef_unit(['AB'], 10.**(-0.4*48.6) * 1.e-3 * si.W / si.m**2 / si.Hz,\n         namespace=_ns, prefixes=False,\n         doc=\"AB magnitude zero flux density.\")\n\ndef_unit(['ST'], 10.**(-0.4*21.1) * 1.e-3 * si.W / si.m**2 / si.AA,\n         namespace=_ns, prefixes=False,\n         doc=\"ST magnitude zero flux density.\")\n\ndel UnitBase\n\ndel def_unit\n\ndel si\n\ndel astrophys\n\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":8038,"name":"_tabversion","nodeType":"Attribute","startLoc":5,"text":"_tabversion"},{"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":394,"id":8039,"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 ValueError(\"Unit {0} 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 ValueError(\"Cannot initialize '{0}' instance with \"\n                                 \"function unit '{1}', as it is not \"\n                                 \"equivalent to default function unit '{2}'.\"\n                                 .format(self.__class__.__name__,\n                                         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 : unit object or 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 equivalence pairs, 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 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` object, `~astropy.units.function.FunctionUnitBase` object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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 meant to treat only equivalencies between different\n            physical units; the build-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        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            # when other is not a function unit\n            return self.physical_unit.to(other, self.to_physical(value),\n                                         equivalencies)\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 __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 __div__(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 __rdiv__(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    __truediv__ = __div__\n\n    __rtruediv__ = __rdiv__\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 {0} 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 += '({0})'.format(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 += '({0})'.format(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 'Unit(\"{0}\")'.format(self.to_string())\n\n        else:\n            return '{0}(\"{1}\"{2})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else ', unit=\"{0}\"'.format(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))"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":8040,"name":"_lr_method","nodeType":"Attribute","startLoc":7,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8041,"name":"_lr_signature","nodeType":"Attribute","startLoc":9,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8042,"name":"_lr_action_items","nodeType":"Attribute","startLoc":11,"text":"_lr_action_items"},{"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":8043,"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":8044,"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":8045,"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":8046,"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":118,"header":"def __init__(self, physical_unit=None, function_unit=None)","id":8047,"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 ValueError(\"Unit {0} 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 ValueError(\"Cannot initialize '{0}' instance with \"\n                                 \"function unit '{1}', as it is not \"\n                                 \"equivalent to default function unit '{2}'.\"\n                                 .format(self.__class__.__name__,\n                                         function_unit,\n                                         self._default_function_unit))"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8048,"name":"_lr_action","nodeType":"Attribute","startLoc":13,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":8049,"name":"_k","nodeType":"Attribute","startLoc":14,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":8050,"name":"_v","nodeType":"Attribute","startLoc":14,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":15,"id":8051,"name":"_x","nodeType":"Attribute","startLoc":15,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":15,"id":8052,"name":"_y","nodeType":"Attribute","startLoc":15,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":8053,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":20,"text":"_lr_goto_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":8054,"name":"_lr_goto","nodeType":"Attribute","startLoc":22,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":8055,"name":"_k","nodeType":"Attribute","startLoc":23,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":8056,"name":"_v","nodeType":"Attribute","startLoc":23,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":24,"id":8057,"name":"_x","nodeType":"Attribute","startLoc":24,"text":"_x"},{"col":4,"comment":"null","endLoc":69,"header":"@classmethod\n    def _format_superscript(cls, number)","id":8058,"name":"_format_superscript","nodeType":"Function","startLoc":47,"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":11,"comment":"null","endLoc":24,"id":8059,"name":"_y","nodeType":"Attribute","startLoc":24,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":8060,"name":"_lr_productions","nodeType":"Attribute","startLoc":28,"text":"_lr_productions"},{"col":0,"comment":"","endLoc":5,"header":"generic_parsetab.py#<anonymous>","id":8061,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'A63D4C561E2ED1A045DB279536CAFDDA'\n\n_lr_action_items = {'CARET':([16,17,29,42,],[39,39,39,39,]),'FUNCNAME':([0,1,4,5,7,8,9,14,15,16,17,19,20,21,22,24,25,27,31,33,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[18,-16,18,-32,-17,18,18,-14,-48,-37,-20,-15,18,-33,18,18,-46,-47,18,18,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'CLOSE_PAREN':([1,2,4,5,7,9,10,12,14,16,17,19,21,23,26,28,30,32,34,35,36,45,47,48,49,50,51,52,55,56,57,58,59,61,62,63,65,66,67,69,71,72,73,74,75,76,77,78,79,81,83,],[-16,-4,-10,-32,-17,-31,-1,-7,-14,-37,-20,-15,-33,-5,-8,-2,55,-30,-53,-52,-36,-21,-13,-11,-6,-9,-3,-18,-34,-29,74,-38,-35,-42,-41,76,-23,-27,-22,-26,79,-51,-19,-55,-40,-39,-24,81,-28,-25,-43,]),'UFLOAT':([0,6,13,33,41,60,68,70,],[-45,-44,34,-45,-45,34,-44,-45,]),'$end':([1,2,3,4,5,7,9,10,12,14,16,17,19,21,23,26,28,32,34,35,36,45,47,48,49,50,51,52,55,56,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,-4,0,-10,-32,-17,-31,-1,-7,-14,-37,-20,-15,-33,-5,-8,-2,-30,-53,-52,-36,-21,-13,-11,-6,-9,-3,-18,-34,-29,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'SOLIDUS':([0,1,2,4,5,7,9,10,14,16,17,19,21,23,24,25,27,28,32,33,34,35,36,45,48,49,51,52,55,56,58,59,65,66,67,69,72,73,74,75,76,77,79,81,],[15,-16,15,15,-32,-17,-31,-12,-14,-37,-20,-15,-33,15,15,-46,-47,-12,-30,15,-53,-52,-36,-21,-11,15,-12,-18,-34,-29,-38,-35,-23,-27,-22,-26,-51,-19,-55,15,-39,-24,-28,-25,]),'UINT':([0,6,7,13,15,16,17,33,34,35,37,38,39,40,41,43,44,53,54,60,64,68,70,80,82,],[17,-44,29,35,-48,-45,42,17,-53,-52,58,-45,-50,-49,-45,66,-45,72,-45,75,-45,72,-45,-45,83,]),'SIGN':([0,15,16,17,29,33,38,39,40,41,42,44,46,54,64,70,80,],[6,-48,6,43,53,6,6,-50,-49,6,53,68,53,6,6,68,6,]),'DOUBLE_STAR':([16,17,29,42,],[40,40,40,40,]),'OPEN_PAREN':([0,1,4,5,7,8,9,11,14,15,16,17,18,19,20,21,22,24,25,27,31,33,34,35,36,38,39,40,44,45,52,54,55,58,59,64,65,66,67,69,72,73,74,76,77,79,81,],[8,-16,8,-32,-17,8,8,33,-14,-48,41,46,-54,-15,8,-33,8,8,-46,-47,8,8,-53,-52,-36,41,-50,-49,70,-21,-18,41,-34,-38,-35,41,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'PERIOD':([1,4,5,7,9,14,16,17,19,21,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,27,-32,-17,27,-14,-37,-20,-15,-33,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'STAR':([1,4,5,7,9,14,16,17,19,21,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[-16,25,-32,-17,25,-14,-37,-20,-15,-33,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),'UNIT':([0,1,4,5,7,8,9,14,15,16,17,19,20,21,22,24,25,27,31,33,34,35,36,45,52,55,58,59,65,66,67,69,72,73,74,76,77,79,81,],[16,-16,16,-32,-17,16,16,-14,-48,-37,-20,-15,16,-33,16,16,-46,-47,16,16,-53,-52,-36,-21,-18,-34,-38,-35,-23,-27,-22,-26,-51,-19,-55,-39,-24,-28,-25,]),}\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 = {'power':([16,17,29,42,],[38,44,54,64,]),'sign':([0,16,33,38,41,44,54,64,70,80,],[13,37,13,37,60,37,37,37,60,82,]),'factor_int':([0,33,],[1,1,]),'numeric_power':([16,38,44,54,64,],[36,59,67,73,77,]),'division_product_of_units':([0,4,24,33,],[2,23,49,2,]),'signed_int':([17,29,42,44,46,70,],[45,52,65,69,71,78,]),'signed_float':([0,33,41,70,],[7,7,62,62,]),'factor':([0,33,],[4,4,]),'function':([0,4,8,9,20,22,24,31,33,],[5,5,5,5,5,5,5,5,5,]),'factor_fits':([0,33,],[14,14,]),'product':([4,9,],[24,31,]),'paren_expr':([41,70,],[63,63,]),'main':([0,33,],[3,57,]),'inverse_unit':([0,4,24,33,],[12,26,50,12,]),'factor_float':([0,33,],[19,19,]),'division':([0,2,4,23,24,33,49,75,],[20,22,20,22,20,20,22,80,]),'unit_expression':([0,4,8,9,20,22,24,31,33,],[9,9,9,9,47,9,9,9,9,]),'product_of_units':([0,4,8,9,22,24,31,33,],[10,28,30,32,48,51,56,10,]),'function_name':([0,4,8,9,20,22,24,31,33,],[11,11,11,11,11,11,11,11,11,]),'frac':([41,70,],[61,61,]),'unit_with_power':([0,4,8,9,20,22,24,31,33,],[21,21,21,21,21,21,21,21,21,]),}\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 -> product_of_units','main',1,'p_main','generic.py',186),\n  ('main -> factor product_of_units','main',2,'p_main','generic.py',187),\n  ('main -> factor product product_of_units','main',3,'p_main','generic.py',188),\n  ('main -> division_product_of_units','main',1,'p_main','generic.py',189),\n  ('main -> factor division_product_of_units','main',2,'p_main','generic.py',190),\n  ('main -> factor product division_product_of_units','main',3,'p_main','generic.py',191),\n  ('main -> inverse_unit','main',1,'p_main','generic.py',192),\n  ('main -> factor inverse_unit','main',2,'p_main','generic.py',193),\n  ('main -> factor product inverse_unit','main',3,'p_main','generic.py',194),\n  ('main -> factor','main',1,'p_main','generic.py',195),\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',207),\n  ('division_product_of_units -> product_of_units','division_product_of_units',1,'p_division_product_of_units','generic.py',208),\n  ('inverse_unit -> division unit_expression','inverse_unit',2,'p_inverse_unit','generic.py',218),\n  ('factor -> factor_fits','factor',1,'p_factor','generic.py',224),\n  ('factor -> factor_float','factor',1,'p_factor','generic.py',225),\n  ('factor -> factor_int','factor',1,'p_factor','generic.py',226),\n  ('factor_float -> signed_float','factor_float',1,'p_factor_float','generic.py',232),\n  ('factor_float -> signed_float UINT signed_int','factor_float',3,'p_factor_float','generic.py',233),\n  ('factor_float -> signed_float UINT power numeric_power','factor_float',4,'p_factor_float','generic.py',234),\n  ('factor_int -> UINT','factor_int',1,'p_factor_int','generic.py',247),\n  ('factor_int -> UINT signed_int','factor_int',2,'p_factor_int','generic.py',248),\n  ('factor_int -> UINT power numeric_power','factor_int',3,'p_factor_int','generic.py',249),\n  ('factor_int -> UINT UINT signed_int','factor_int',3,'p_factor_int','generic.py',250),\n  ('factor_int -> UINT UINT power numeric_power','factor_int',4,'p_factor_int','generic.py',251),\n  ('factor_fits -> UINT power OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',5,'p_factor_fits','generic.py',269),\n  ('factor_fits -> UINT power signed_int','factor_fits',3,'p_factor_fits','generic.py',270),\n  ('factor_fits -> UINT SIGN UINT','factor_fits',3,'p_factor_fits','generic.py',271),\n  ('factor_fits -> UINT OPEN_PAREN signed_int CLOSE_PAREN','factor_fits',4,'p_factor_fits','generic.py',272),\n  ('product_of_units -> unit_expression product product_of_units','product_of_units',3,'p_product_of_units','generic.py',291),\n  ('product_of_units -> unit_expression product_of_units','product_of_units',2,'p_product_of_units','generic.py',292),\n  ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','generic.py',293),\n  ('unit_expression -> function','unit_expression',1,'p_unit_expression','generic.py',304),\n  ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','generic.py',305),\n  ('unit_expression -> OPEN_PAREN product_of_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','generic.py',306),\n  ('unit_with_power -> UNIT power numeric_power','unit_with_power',3,'p_unit_with_power','generic.py',315),\n  ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','generic.py',316),\n  ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','generic.py',317),\n  ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','generic.py',328),\n  ('numeric_power -> OPEN_PAREN paren_expr CLOSE_PAREN','numeric_power',3,'p_numeric_power','generic.py',329),\n  ('paren_expr -> sign UINT','paren_expr',2,'p_paren_expr','generic.py',338),\n  ('paren_expr -> signed_float','paren_expr',1,'p_paren_expr','generic.py',339),\n  ('paren_expr -> frac','paren_expr',1,'p_paren_expr','generic.py',340),\n  ('frac -> sign UINT division sign UINT','frac',5,'p_frac','generic.py',349),\n  ('sign -> SIGN','sign',1,'p_sign','generic.py',355),\n  ('sign -> <empty>','sign',0,'p_sign','generic.py',356),\n  ('product -> STAR','product',1,'p_product','generic.py',365),\n  ('product -> PERIOD','product',1,'p_product','generic.py',366),\n  ('division -> SOLIDUS','division',1,'p_division','generic.py',372),\n  ('power -> DOUBLE_STAR','power',1,'p_power','generic.py',378),\n  ('power -> CARET','power',1,'p_power','generic.py',379),\n  ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','generic.py',385),\n  ('signed_float -> sign UINT','signed_float',2,'p_signed_float','generic.py',391),\n  ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','generic.py',392),\n  ('function_name -> FUNCNAME','function_name',1,'p_function_name','generic.py',398),\n  ('function -> function_name OPEN_PAREN main CLOSE_PAREN','function',4,'p_function','generic.py',404),\n]"},{"fileName":"logarithmic.py","filePath":"astropy/units/function","id":8062,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\n\nfrom .. import CompositeUnit, UnitsError, dimensionless_unscaled\nfrom . import magnitude_zero_points as mag0\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    def __init__(self, *args, **kwargs):\n        # Ensure we recognize magnitude zero points here.\n        with mag0.enable():\n            super().__init__(*args, **kwargs)\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\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 convertible items.\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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    # Could add __mul__ and __div__ and try interpreting other as a power,\n    # but this seems just too error-prone.\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(mag0.ST)\nSTmag.__doc__ = \"ST magnitude: STmag=-21.1 corresponds to 1 erg/s/cm2/A\"\n\nABmag = MagUnit(mag0.AB)\nABmag.__doc__ = \"AB magnitude: ABmag=-48.6 corresponds to 1 erg/s/cm2/Hz\"\n\nM_bol = MagUnit(mag0.Bol)\nM_bol.__doc__ = (\"Absolute bolometric magnitude: M_bol=0 corresponds to \"\n                 \"L_bol0={0}\".format(mag0.Bol.si))\n\nm_bol = MagUnit(mag0.bol)\nm_bol.__doc__ = (\"Apparent bolometric magnitude: m_bol=0 corresponds to \"\n                 \"f_bol0={0}\".format(mag0.bol.si))\n"},{"fileName":"mixin.py","filePath":"astropy/units/function","id":8063,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom ..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":8064,"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":8065,"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":"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, sequence of convertible items, `~astropy.units.Quantity`, or `~astropy.units.function.FunctionQuantity`\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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":653,"id":8066,"nodeType":"Class","startLoc":397,"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, sequence of convertible items, `~astropy.units.Quantity`, or `~astropy.units.function.FunctionQuantity`\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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 behaviour\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 behaviour\n    def __array_prepare__(self, obj, context=None):\n        \"\"\"Check that the ufunc can deal with a FunctionQuantity.\"\"\"\n\n        # If no context is set, just return the input\n        if context is None:  # pragma: no cover\n            return obj\n\n        # Find out whether ufunc is supported\n        function = context[0]\n        if not (function in self._supported_ufuncs or\n                all(arg.unit.physical_unit == dimensionless_unscaled\n                    for arg in context[1][:function.nin]\n                    if (hasattr(arg, 'unit') and\n                        hasattr(arg.unit, 'physical_unit')))):\n            raise UnitTypeError(\"Cannot use function '{0}' with function \"\n                                \"quantities that are not dimensionless.\"\n                                .format(context[0].__name__))\n\n        return super().__array_prepare__(obj, context)\n\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                    \"{0} instances require {1} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    \", so cannot set it to '{0}'.\".format(unit))\n\n        self._unit = unit\n\n    # ↓↓↓ methods overridden to change behaviour\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.__rdiv__(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    # 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 '{0}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))"},{"className":"IrreducibleFunctionUnit","col":0,"comment":"null","endLoc":21,"id":8067,"nodeType":"Class","startLoc":20,"text":"class IrreducibleFunctionUnit(FunctionMixin, IrreducibleUnit):\n    pass"},{"className":"RegularFunctionUnit","col":0,"comment":"null","endLoc":25,"id":8068,"nodeType":"Class","startLoc":24,"text":"class RegularFunctionUnit(FunctionMixin, Unit):\n    pass"},{"col":4,"comment":"null","endLoc":495,"header":"def __new__(cls, value, unit=None, dtype=None, copy=True, order=None,\n                subok=False, ndmin=0)","id":8069,"name":"__new__","nodeType":"Function","startLoc":473,"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":4,"comment":"null","endLoc":26,"id":8070,"name":"_times","nodeType":"Attribute","startLoc":26,"text":"_times"},{"attributeType":"null","col":4,"comment":"null","endLoc":27,"id":8071,"name":"_line","nodeType":"Attribute","startLoc":27,"text":"_line"},{"fileName":"__init__.py","filePath":"astropy/units/function","id":8072,"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 *\nfrom .units import *\n"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":8073,"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":8074,"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 ..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 ..utils import generate_unit_summary as _generate_unit_summary\nif __doc__ is not None:\n    __doc__ += _generate_unit_summary(globals())\n"},{"col":0,"comment":"","endLoc":6,"header":"unicode_format.py#<anonymous>","id":8075,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nHandles the \"Unicode\" unit format.\n\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8076,"name":"_ns","nodeType":"Attribute","startLoc":13,"text":"_ns"},{"id":8077,"name":"astropy/utils","nodeType":"Package"},{"fileName":"decorators.py","filePath":"astropy/utils","id":8078,"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\n\nimport functools\nimport inspect\nimport textwrap\nimport types\nimport warnings\nfrom inspect import signature\n\nfrom .codegen import make_function_with_signature\nfrom .exceptions import (AstropyDeprecationWarning, AstropyUserWarning,\n                         AstropyPendingDeprecationWarning)\n\n\n__all__ = ['classproperty', 'deprecated', 'deprecated_attribute',\n           'deprecated_renamed_argument', 'format_doc',\n           'lazyproperty', 'sharedmethod', 'wraps']\n\n\ndef deprecated(since, message='', name='', alternative='', pending=False,\n               obj_type=None):\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        AstropyDeprecationWarning.\n\n    obj_type : str, optional\n        The type of this object, if the automatically determined one\n        needs to be overridden.\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):\n        \"\"\"\n        Returns a wrapped function that displays an\n        ``AstropyDeprecationWarning`` 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\n\n        func = get_function(func)\n\n        def deprecated_func(*args, **kwargs):\n            if pending:\n                category = AstropyPendingDeprecationWarning\n            else:\n                category = AstropyDeprecationWarning\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__']):  # nopep8\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):\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__), message)\n        else:\n            cls.__new__ = deprecate_function(get_function(cls.__new__), message)\n        return cls\n\n    def deprecate(obj, message=message, name=name, alternative=alternative,\n                  pending=pending):\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 = '\\n        Use {} instead.'.format(alternative)\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)\n        else:\n            return deprecate_function(obj, message)\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):\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 a\n        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    @deprecated(since, name=name, obj_type='attribute')\n    def get(self):\n        return getattr(self, private_name)\n\n    @deprecated(since, name=name, obj_type='attribute')\n    def set(self, val):\n        setattr(self, private_name, val)\n\n    @deprecated(since, name=name, obj_type='attribute')\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    \"\"\"Deprecate a _renamed_ 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 list/tuple thereof\n        The old name of the argument.\n\n    new_name : str or list/tuple thereof\n        The new name of the argument.\n\n    since : str or number or list/tuple thereof\n        The release at which the old argument became deprecated.\n\n    arg_in_kwargs : bool or list/tuple thereof, 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 list/tuple thereof, 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 list/tuple thereof, optional\n        If ``True`` this will hide the deprecation warning and ignore the\n        corresponding ``relax`` parameter value.\n        Default is ``False``.\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)\n        2\n\n    To deprecate an argument catched 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)\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)\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)\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    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    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\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 new_name[i] in arguments:\n                param = arguments[new_name[i]]\n                # There are several possibilities now:\n\n                # 1.) Positional or keyword argument:\n                if param.kind == param.POSITIONAL_OR_KEYWORD:\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('cannot replace argument \"{0}\" of kind '\n                                    '{1!r}.'.format(new_name[i], param.kind))\n\n            # In case the argument is not found in the list of arguments\n            # the only remaining possibility is that it should be catched\n            # by some kind of **kwargs argument.\n            # This case has to be explicitly specified, otherwise throw\n            # an exception!\n            elif arg_in_kwargs[i]:\n                position[i] = None\n            else:\n                raise TypeError('\"{}\" 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                                '.'.format(new_name[i]))\n\n        @functools.wraps(function)\n        def wrapper(*args, **kwargs):\n            for i in range(n):\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 only\n                    # pending.\n                    if not pending[i]:\n                        warnings.warn(\n                            '\"{0}\" was deprecated in version {1} '\n                            'and will be removed in a future version. '\n                            'Use argument \"{2}\" instead.'\n                            ''.format(old_name[i], since[i], new_name[i]),\n                            AstropyDeprecationWarning, 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                                    '\"{0}\" and \"{1}\" keywords were set. '\n                                    'Using the value of \"{1}\".'\n                                    ''.format(old_name[i], new_name[i]),\n                                    AstropyUserWarning)\n                            else:\n                                raise TypeError(\n                                    'cannot specify both \"{}\" and \"{}\"'\n                                    '.'.format(old_name[i], new_name[i]))\n                    else:\n                        # If the new argument isn't specified just pass the old\n                        # one with the name of the new argument to the function\n                        kwargs[new_name[i]] = value\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/deleteable 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._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 and objtype in self._cache:\n            return self._cache[objtype]\n\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\n        if self._lazy:\n            self._cache[objtype] = val\n\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\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    Adapted from the recipe at\n    http://code.activestate.com/recipes/363602-lazy-property-evaluation\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\n    def __get__(self, obj, owner=None):\n        try:\n            return obj.__dict__[self._key]\n        except KeyError:\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 took\n                # over setting the value in obj.__dict__; this mechanism allows\n                # 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        if self._key in obj.__dict__:\n            del obj.__dict__[self._key]\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 wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n          updated=functools.WRAPPER_UPDATES, exclude_args=()):\n    \"\"\"\n    An alternative to `functools.wraps` which also preserves the original\n    function's call signature by way of\n    `~astropy.utils.codegen.make_function_with_signature`.\n\n    This also adds an optional ``exclude_args`` argument.  If given it should\n    be a sequence of argument names that should not be copied from the wrapped\n    function (either positional or keyword arguments).\n\n    The documentation for the original `functools.wraps` follows:\n\n    \"\"\"\n\n    wrapped_args = _get_function_args(wrapped, exclude_args=exclude_args)\n\n    def wrapper(func):\n        if '__name__' in assigned:\n            name = wrapped.__name__\n        else:\n            name = func.__name__\n\n        func = make_function_with_signature(func, name=name, **wrapped_args)\n        func = functools.update_wrapper(func, wrapped, assigned=assigned,\n                                        updated=updated)\n        return func\n\n    return wrapper\n\n\nif (isinstance(wraps.__doc__, str) and\n        wraps.__doc__ is not None and functools.wraps.__doc__ is not None):\n    wraps.__doc__ += functools.wraps.__doc__\n\n\ndef _get_function_args_internal(func):\n    \"\"\"\n    Utility function for `wraps`.\n\n    Reads the argspec for the given function and converts it to arguments\n    for `make_function_with_signature`.\n    \"\"\"\n\n    argspec = inspect.getfullargspec(func)\n\n    if argspec.defaults:\n        args = argspec.args[:-len(argspec.defaults)]\n        kwargs = zip(argspec.args[len(args):], argspec.defaults)\n    else:\n        args = argspec.args\n        kwargs = []\n\n    if argspec.kwonlyargs:\n        kwargs.extend((argname, argspec.kwonlydefaults[argname])\n                      for argname in argspec.kwonlyargs)\n\n    return {'args': args, 'kwargs': kwargs, 'varargs': argspec.varargs,\n            'varkwargs': argspec.varkw}\n\n\ndef _get_function_args(func, exclude_args=()):\n    all_args = _get_function_args_internal(func)\n\n    if exclude_args:\n        exclude_args = set(exclude_args)\n\n        for arg_type in ('args', 'kwargs'):\n            all_args[arg_type] = [arg for arg in all_args[arg_type]\n                                  if arg not in exclude_args]\n\n        for arg_type in ('varargs', 'varkwargs'):\n            if all_args[arg_type] in exclude_args:\n                all_args[arg_type] = None\n\n    return all_args\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"},{"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":798,"id":8079,"nodeType":"Class","startLoc":734,"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":4,"comment":"null","endLoc":794,"header":"def __get__(self, obj, objtype=None)","id":8080,"name":"__get__","nodeType":"Function","startLoc":783,"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)"},{"attributeType":"IrreducibleFunctionUnit","col":0,"comment":"null","endLoc":21,"id":8081,"name":"dex","nodeType":"Attribute","startLoc":21,"text":"dex"},{"fileName":"exceptions.py","filePath":"astropy/utils","id":8082,"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*\nbe here, but rather in the particular subpackage.\n\"\"\"\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\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"},{"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":44,"id":8083,"nodeType":"Class","startLoc":37,"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    \"\"\""},{"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":54,"id":8084,"nodeType":"Class","startLoc":46,"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":54,"header":"def __repr__(self)","id":8085,"name":"__repr__","nodeType":"Function","startLoc":53,"text":"def __repr__(self):\n        return 'astropy.utils.exceptions.NoValue'"},{"col":0,"comment":"","endLoc":6,"header":"exceptions.py#<anonymous>","id":8086,"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*\nbe here, but rather in the particular subpackage.\n\"\"\"\n\nNoValue = _NoValue()"},{"fileName":"data_info.py","filePath":"astropy/utils","id":8087,"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\nSTRING_TYPE_NAMES = {(False, 'S'): 'str',  # not PY3\n                     (False, 'U'): 'unicode',\n                     (True, 'S'): 'bytes',  # PY3\n                     (True, 'U'): 'str'}\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', 'ecsv', 'yaml'\n    \"\"\"\n    old_context = BaseColumnInfo._serialize_context\n    BaseColumnInfo._serialize_context = context\n    yield\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    For bytes, string and unicode types, the output is shown below, where <N>\n    is 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, np.dtype, type\n        Input dtype as an object that can be converted via np.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        length = re.search(r'(\\d+)', dtype.str).group(1)\n        type_name = STRING_TYPE_NAMES[(True, dtype.kind)]\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.0\n    median = 2.5\n    max = 4.0\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                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 and in Py2 converts any unicode\n    attribute names or values to str.  In the context of serializing the\n    supported core astropy classes this conversion will succeed and results\n    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 DataInfo:\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 http://nbviewer.ipython.org/urls/\n    gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb for\n    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    _attrs_no_copy = set()\n    _info_summary_attrs = ('dtype', 'shape', 'unit', 'format', 'description', 'class')\n    _represent_as_dict_attrs = ()\n    _parent = 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.\n        if bound:\n            self._attrs = dict((attr, None) for attr in self.attr_names)\n\n    def __get__(self, instance, owner_cls):\n        if instance is None:\n            # This is an unbound descriptor on the class\n            info = self\n            info._parent_cls = owner_cls\n        else:\n            info = instance.__dict__.get('info')\n            if info is None:\n                info = instance.__dict__['info'] = self.__class__(bound=True)\n            info._parent = 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            for attr in info.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 __getattr__(self, attr):\n        if attr.startswith('_'):\n            return super().__getattribute__(attr)\n\n        if attr in self.attrs_from_parent:\n            return getattr(self._parent, attr)\n\n        try:\n            value = self._attrs[attr]\n        except KeyError:\n            super().__getattribute__(attr)  # Generate AttributeError\n\n        # Weak ref for parent table\n        if attr == 'parent_table' and callable(value):\n            value = value()\n\n        # Mixins have a default dtype of Object if nothing else was set\n        if attr == 'dtype' and value is None:\n            value = np.dtype('O')\n\n        return value\n\n    def __setattr__(self, attr, value):\n        propobj = getattr(self.__class__, attr, None)\n\n        # If attribute is taken from parent properties and there is not a\n        # class property (getter/setter) for this attribute then set\n        # attribute directly in parent.\n        if attr in self.attrs_from_parent and not isinstance(propobj, property):\n            setattr(self._parent, attr, value)\n            return\n\n        # Check if there is a property setter and use it if possible.\n        if isinstance(propobj, property):\n            if propobj.fset is None:\n                raise AttributeError(\"can't set attribute\")\n            propobj.fset(self, value)\n            return\n\n        # Private attr names get directly set\n        if attr.startswith('_'):\n            super().__setattr__(attr, value)\n            return\n\n        # Finally this must be an actual data attribute that this class is handling.\n        if attr not in self.attr_names:\n            raise AttributeError(\"attribute must be one of {0}\".format(self.attr_names))\n\n        if attr == 'parent_table':\n            value = None if value is None else weakref.ref(value)\n\n        self._attrs[attr] = value\n\n    def _represent_as_dict(self):\n        \"\"\"Get the values for the parent ``attrs`` and return as a dict.\"\"\"\n        return _get_obj_attrs_map(self._parent, self._represent_as_dict_attrs)\n\n    def _construct_from_dict(self, map):\n        return self._parent_cls(**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, function, list of (str or function)\n            Info option, defaults to 'attributes'.\n        out : file-like object, 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 : 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={0} 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:\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('{0} = {1}'.format(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'])\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', 'ecsv', 'yaml'.  Objects like Time or\n    # SkyCoord will have different default serialization representations\n    # depending on context.\n    _serialize_context = None\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 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 ..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    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 : Column or mixin\n            Sliced object\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 ..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            threshold = 0.6\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 of merged attributes\n\n        \"\"\"\n        from ..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        return out\n\n\nclass MixinInfo(BaseColumnInfo):\n\n    def __setattr__(self, attr, value):\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 attr == 'name' and self.parent_table is not None:\n            from ..table.np_utils import fix_column_name\n            new_name = fix_column_name(value)  # Ensure col name is numpy compatible\n            self.parent_table.columns._rename_column(self.name, new_name)\n\n        super().__setattr__(attr, value)\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"},{"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":8088,"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)"},{"col":4,"comment":"null","endLoc":798,"header":"@staticmethod\n    def _make_method(func, instance)","id":8089,"name":"_make_method","nodeType":"Function","startLoc":796,"text":"@staticmethod\n    def _make_method(func, instance):\n        return types.MethodType(func, instance)"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":8090,"name":"dB","nodeType":"Attribute","startLoc":24,"text":"dB"},{"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 a\n        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":261,"header":"def deprecated_attribute(name, since, message=None, alternative=None,\n                         pending=False)","id":8091,"name":"deprecated_attribute","nodeType":"Function","startLoc":201,"text":"def deprecated_attribute(name, since, message=None, alternative=None,\n                         pending=False):\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 a\n        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    @deprecated(since, name=name, obj_type='attribute')\n    def get(self):\n        return getattr(self, private_name)\n\n    @deprecated(since, name=name, obj_type='attribute')\n    def set(self, val):\n        setattr(self, private_name, val)\n\n    @deprecated(since, name=name, obj_type='attribute')\n    def delete(self):\n        delattr(self, private_name)\n\n    return property(get, set, delete)"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":8092,"name":"__all__","nodeType":"Attribute","startLoc":34,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":8093,"name":"IGNORE_WARNINGS","nodeType":"Attribute","startLoc":38,"text":"IGNORE_WARNINGS"},{"attributeType":"null","col":0,"comment":"null","endLoc":41,"id":8094,"name":"STRING_TYPE_NAMES","nodeType":"Attribute","startLoc":41,"text":"STRING_TYPE_NAMES"},{"col":0,"comment":"","endLoc":11,"header":"data_info.py#<anonymous>","id":8095,"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\nSTRING_TYPE_NAMES = {(False, 'S'): 'str',  # not PY3\n                     (False, 'U'): 'unicode',\n                     (True, 'S'): 'bytes',  # PY3\n                     (True, 'U'): 'str'}"},{"fileName":"data.py","filePath":"astropy/utils","id":8096,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\" This module contains helper functions for accessing, downloading, and\ncaching data files.\n\"\"\"\n\n\n\nimport atexit\nimport contextlib\nimport fnmatch\nimport hashlib\nimport os\nimport io\nimport pathlib\nimport shutil\nimport socket\nimport sys\nimport time\nimport urllib.request\nimport urllib.error\nimport urllib.parse\nimport shelve\n\nfrom tempfile import NamedTemporaryFile, gettempdir\nfrom warnings import warn\n\nfrom .. import config as _config\nfrom ..utils.exceptions import AstropyWarning\nfrom ..utils.introspection import find_current_module, resolve_name\n\n__all__ = [\n    'Conf', 'conf', 'get_readable_fileobj', 'get_file_contents',\n    'get_pkg_data_fileobj', 'get_pkg_data_filename',\n    'get_pkg_data_contents', 'get_pkg_data_fileobjs',\n    'get_pkg_data_filenames', 'compute_hash', 'clear_download_cache',\n    'CacheMissingWarning', 'get_free_space_in_dir',\n    'check_free_space_in_dir', 'download_file',\n    'download_files_in_parallel', 'is_url_in_cache', 'get_cached_urls']\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    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    compute_hash_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Block size for computing MD5 file hashes.')\n    download_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Number of bytes of remote data to download per step.')\n    download_cache_lock_attempts = _config.ConfigItem(\n        5,\n        'Number of times to try to get the lock ' +\n        'while accessing the data cache before giving up.')\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\n\n    Parameters\n    ----------\n    string : str\n        The string to test\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\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    \"\"\"\n    Given a filename, pathlib.Path object or a readable file-like object, return a context\n    manager that yields a readable file-like object.\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    Parameters\n    ----------\n    name_or_obj : str or file-like object\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, optional\n        Whether to cache the contents of remote URLs.\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`, which is 3s by default)\n\n    Returns\n    -------\n    file : readable file-like object\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    PATH_TYPES = (str, pathlib.Path)\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    # Get a file object to the content\n    if isinstance(name_or_obj, PATH_TYPES):\n        # name_or_obj could be a Path object if pathlib is available\n        name_or_obj = str(name_or_obj)\n\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)\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        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 ValueError(\n                \".bz2 format files are not supported since the Python \"\n                \"interpreter does not include 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 ValueError(\n                \".xz format files are not supported since the Python \"\n                \"interpreter does not include the lzma module.\")\n        except (OSError, EOFError) as e:  # 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 = io.BufferedReader(fileobj)\n        fileobj = io.TextIOWrapper(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    content\n        The content of the file (as requested by ``encoding``).\n\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    urllib2.URLError, 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\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\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    \"\"\"\n\n    datafn = _find_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        all_urls = (conf.dataurl, conf.dataurl_mirror)\n        for url in all_urls:\n            try:\n                with get_readable_fileobj(url + data_name, encoding=encoding,\n                                          cache=cache) as fileobj:\n                    # We read a byte to trigger any URLErrors\n                    fileobj.read(1)\n                    fileobj.seek(0)\n                    yield fileobj\n                    break\n            except urllib.error.URLError:\n                pass\n        else:\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\".format(data_name, urls))\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`, which\n        is 3s by default)\n\n    Raises\n    ------\n    urllib2.URLError, 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            all_urls = (conf.dataurl, conf.dataurl_mirror)\n            for url in all_urls:\n                try:\n                    return download_file(url + data_name, cache=True,\n                                         show_progress=show_progress,\n                                         timeout=remote_timeout)\n                except urllib.error.URLError:\n                    pass\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\\n\\n\".format(data_name, urls))\n\n        else:\n            return hashfn\n    else:\n        fs_path = os.path.normpath(data_name)\n        datafn = _find_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            all_urls = (conf.dataurl, conf.dataurl_mirror)\n            for url in all_urls:\n                try:\n                    return download_file(url + data_name, cache=True,\n                                         show_progress=show_progress,\n                                         timeout=remote_timeout)\n                except urllib.error.URLError:\n                    pass\n            urls = '\\n'.join('  - {0}'.format(url) for url in all_urls)\n            raise urllib.error.URLError(\"Failed to download {0} from the following \"\n                                        \"repositories:\\n\\n{1}\".format(data_name, urls))\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    urllib2.URLError, 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('maps', 'astropy.wcs.tests',\n        ...                                  '*.hdr'):\n        ...     with open(fn) as f:\n        ...         fcontents = f.read()\n        ...\n    \"\"\"\n\n    path = _find_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 objects\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('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    md5hash : str\n        The hex digest of the MD5 hash for the contents of the ``localfn``\n        file.\n\n    \"\"\"\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 _find_pkg_data_path(data_name, package=None):\n    \"\"\"\n    Look for data in the source-included data directories and return the\n    path.\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 data_name\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        module = resolve_name(package)\n\n    rootpkgname = package.partition('.')[0]\n\n    rootpkg = resolve_name(rootpkgname)\n\n    module_path = os.path.dirname(module.__file__)\n    path = os.path.join(module_path, data_name)\n\n    root_dir = os.path.dirname(rootpkg.__file__)\n    if not _is_inside(path, root_dir):\n        raise RuntimeError(\"attempted to get a local data file outside \"\n                           \"of the {} tree.\".format(rootpkgname))\n\n    return path\n\n\ndef _find_hash_fn(hash):\n    \"\"\"\n    Looks for a local file by hash - returns file name if found and a valid\n    file, otherwise returns None.\n    \"\"\"\n\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\n    except OSError as e:\n        msg = 'Could not access cache directory to search for data file: '\n        warn(CacheMissingWarning(msg + str(e)))\n        return None\n    hashfn = os.path.join(dldir, hash)\n    if os.path.isfile(hashfn):\n        return hashfn\n    else:\n        return None\n\n\ndef get_free_space_in_dir(path):\n    \"\"\"\n    Given a path to a directory, returns the amount of free space (in\n    bytes) on that filesystem.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    Returns\n    -------\n    bytes : int\n        The amount of free space on the partition that the directory\n        is on.\n    \"\"\"\n\n    if sys.platform.startswith('win'):\n        import ctypes\n        free_bytes = ctypes.c_ulonglong(0)\n        retval = ctypes.windll.kernel32.GetDiskFreeSpaceExW(\n                ctypes.c_wchar_p(path), None, None, ctypes.pointer(free_bytes))\n        if retval == 0:\n            raise OSError('Checking free space on {!r} failed '\n                          'unexpectedly.'.format(path))\n        return free_bytes.value\n    else:\n        stat = os.statvfs(path)\n        return stat.f_bavail * stat.f_frsize\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.  Raises an OSError if the file would be too large.\n\n    Parameters\n    ----------\n    path : str\n        The path to a directory\n\n    size : int\n        A proposed filesize (in bytes)\n\n    Raises\n    -------\n    OSError : There is not enough room on the filesystem\n    \"\"\"\n    from ..utils.console import human_file_size\n\n    space = get_free_space_in_dir(path)\n    if space < size:\n        raise OSError(\n            \"Not enough free space in '{0}' \"\n            \"to download a {1} file\".format(\n                path, human_file_size(size)))\n\n\ndef download_file(remote_url, cache=False, show_progress=True, timeout=None):\n    \"\"\"\n    Accepts a URL, downloads and optionally caches the result\n    returning the filename, with a name determined by the file's MD5\n    hash. If ``cache=True`` and the file is present in the cache, just\n    returns the filename.\n\n    Parameters\n    ----------\n    remote_url : str\n        The URL of the file to download\n\n    cache : bool, optional\n        Whether to use the 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        The timeout, in seconds.  Otherwise, use\n        `astropy.utils.data.Conf.remote_timeout`.\n\n    Returns\n    -------\n    local_path : str\n        Returns the local path that the file was download to.\n\n    Raises\n    ------\n    urllib2.URLError, urllib.error.URLError\n        Whenever there's a problem getting the remote file.\n    \"\"\"\n\n    from ..utils.console import ProgressBarOrSpinner\n\n    if timeout is None:\n        timeout = conf.remote_timeout\n\n    missing_cache = False\n\n    if cache:\n        try:\n            dldir, urlmapfn = _get_download_cache_locs()\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            cache = False\n            missing_cache = True  # indicates that the cache is missing to raise a warning later\n\n    url_key = remote_url\n\n    try:\n        if cache:\n            # We don't need to acquire the lock here, since we are only reading\n            with shelve.open(urlmapfn) as url2hash:\n                if url_key in url2hash:\n                    return url2hash[url_key]\n\n        with urllib.request.urlopen(remote_url, timeout=timeout) as remote:\n            # keep a hash to rename the local file to the hashed name\n            hash = hashlib.md5()\n\n            info = remote.info()\n            if 'Content-Length' in info:\n                try:\n                    size = int(info['Content-Length'])\n                except ValueError:\n                    size = None\n            else:\n                size = None\n\n            if size is not None:\n                check_free_space_in_dir(gettempdir(), size)\n                if cache:\n                    check_free_space_in_dir(dldir, size)\n\n            if show_progress:\n                progress_stream = sys.stdout\n            else:\n                progress_stream = io.StringIO()\n\n            dlmsg = \"Downloading {0}\".format(remote_url)\n            with ProgressBarOrSpinner(size, dlmsg, file=progress_stream) as p:\n                with NamedTemporaryFile(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                            hash.update(block)\n                            bytes_read += len(block)\n                            p.update(bytes_read)\n                            block = remote.read(conf.download_block_size)\n                    except BaseException:\n                        if os.path.exists(f.name):\n                            os.remove(f.name)\n                        raise\n\n        if cache:\n            _acquire_download_cache_lock()\n            try:\n                with shelve.open(urlmapfn) as url2hash:\n                    # We check now to see if another process has\n                    # inadvertently written the file underneath us\n                    # already\n                    if url_key in url2hash:\n                        return url2hash[url_key]\n                    local_path = os.path.join(dldir, hash.hexdigest())\n                    shutil.move(f.name, local_path)\n                    url2hash[url_key] = local_path\n            finally:\n                _release_download_cache_lock()\n        else:\n            local_path = f.name\n            if missing_cache:\n                msg = ('File downloaded to temporary location due to problem '\n                       'with cache directory and will not be cached.')\n                warn(CacheMissingWarning(msg, local_path))\n            if conf.delete_temporary_downloads_at_exit:\n                global _tempfilestodel\n                _tempfilestodel.append(local_path)\n    except urllib.error.URLError as e:\n        if hasattr(e, 'reason') and hasattr(e.reason, 'errno') and e.reason.errno == 8:\n            e.reason.strerror = e.reason.strerror + '. requested URL: ' + remote_url\n            e.reason.args = (e.reason.errno, e.reason.strerror)\n        raise e\n    except socket.timeout as e:\n        # this isn't supposed to happen, but occasionally a socket.timeout gets\n        # through.  It's supposed to be caught in `urrlib2` and raised in this\n        # way, but for some reason in mysterious circumstances it doesn't. So\n        # we'll just re-raise it here instead\n        raise urllib.error.URLError(e)\n\n    return local_path\n\n\ndef is_url_in_cache(url_key):\n    \"\"\"\n    Check if a download from ``url_key`` is in the cache.\n\n    Parameters\n    ----------\n    url_key : string\n        The URL retrieved\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download from ``url_key`` is in the cache\n    \"\"\"\n    # The code below is modified from astropy.utils.data.download_file()\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\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        return False\n\n    with shelve.open(urlmapfn) as url2hash:\n        if url_key in url2hash:\n            return True\n    return False\n\n\ndef _do_download_files_in_parallel(args):\n    return download_file(*args)\n\n\ndef download_files_in_parallel(urls, cache=True, show_progress=True,\n                               timeout=None):\n    \"\"\"\n    Downloads multiple files in parallel from the given URLs.  Blocks until\n    all files have downloaded.  The result is a list of local file paths\n    corresponding to the given urls.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool, optional\n        Whether to use the cache (default is `True`).\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False`` will\n            print a Warning and set it to ``True`` again, because the function\n            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    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n    \"\"\"\n    from .console import ProgressBar\n\n    if timeout is None:\n        timeout = conf.remote_timeout\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.\n        warn(\"Disabling the cache does not work because of multiprocessing, it \"\n             \"will be set to ``True``. You may need to manually remove the \"\n             \"cached files afterwards.\", AstropyWarning)\n        cache = True\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        [(x, cache, False, timeout) for x in combined_urls],\n        file=progress,\n        multiprocess=True)\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                os.remove(fn)\n\n\ndef clear_download_cache(hashorurl=None):\n    \"\"\" Clears the data file cache by deleting the local file(s).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, either specifies a\n        hash for the cached file that is supposed to be deleted, or a URL that\n        should be removed from the cache if present.\n    \"\"\"\n\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\n    except OSError as e:\n        msg = 'Not clearing data cache - cache inacessable due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        return\n\n    _acquire_download_cache_lock()\n    try:\n        if hashorurl is None:\n            # dldir includes both the download files and the urlmapfn.  This structure\n            # is required since we cannot know a priori the actual file name corresponding\n            # to the shelve map named urlmapfn.\n            if os.path.exists(dldir):\n                shutil.rmtree(dldir)\n        else:\n            with shelve.open(urlmapfn) as url2hash:\n                filepath = os.path.join(dldir, hashorurl)\n                if not _is_inside(filepath, dldir):\n                    raise RuntimeError(\"attempted to use clear_download_cache on\"\n                                       \" a path outside the data cache directory\")\n\n                hash_key = hashorurl\n\n                if os.path.exists(filepath):\n                    for k, v in url2hash.items():\n                        if v == filepath:\n                            del url2hash[k]\n                    os.unlink(filepath)\n                elif hash_key in url2hash:\n                    filepath = url2hash[hash_key]\n                    del url2hash[hash_key]\n                    if os.path.exists(filepath):\n                        # Make sure the filepath still actually exists (perhaps user removed it)\n                        os.unlink(filepath)\n                # Otherwise could not find file or url, but no worries.\n                # Clearing download cache just makes sure that the file or url\n                # is no longer in the cache regardless of starting condition.\n\n    finally:\n        # the lock will be gone if rmtree was used above, but release otherwise\n        if os.path.exists(os.path.join(dldir, 'lock')):\n            _release_download_cache_lock()\n\n\ndef _get_download_cache_locs():\n    \"\"\" Finds the path to the data cache directory and makes them if\n    they don't exist.\n\n    Returns\n    -------\n    datadir : str\n        The path to the data cache directory.\n    shelveloc : str\n        The path to the shelve object that stores the cache info.\n    \"\"\"\n    from ..config.paths import get_cache_dir\n\n    # datadir includes both the download files and the shelveloc.  This structure\n    # is required since we cannot know a priori the actual file name corresponding\n    # to the shelve map named shelveloc.  (The backend can vary and is allowed to\n    # do whatever it wants with the filename.  Filename munging can and does happen\n    # in practice).\n    py_version = 'py' + str(sys.version_info.major)\n    datadir = os.path.join(get_cache_dir(), 'download', py_version)\n    shelveloc = os.path.join(datadir, 'urlmap')\n\n    if not os.path.exists(datadir):\n        try:\n            os.makedirs(datadir)\n        except OSError as e:\n            if not os.path.exists(datadir):\n                raise\n    elif not os.path.isdir(datadir):\n        msg = 'Data cache directory {0} is not a directory'\n        raise OSError(msg.format(datadir))\n\n    if os.path.isdir(shelveloc):\n        msg = 'Data cache shelve object location {0} is a directory'\n        raise OSError(msg.format(shelveloc))\n\n    return datadir, shelveloc\n\n\n# the cache directory must be locked before any writes are performed.  Same for\n# the hash shelve, so this should be used for both.\ndef _acquire_download_cache_lock():\n    \"\"\"\n    Uses the lock directory method.  This is good because `mkdir` is\n    atomic at the system call level, so it's thread-safe.\n    \"\"\"\n\n    lockdir = os.path.join(_get_download_cache_locs()[0], 'lock')\n    for i in range(conf.download_cache_lock_attempts):\n        try:\n            os.mkdir(lockdir)\n            # write the pid of this process for informational purposes\n            with open(os.path.join(lockdir, 'pid'), 'w') as f:\n                f.write(str(os.getpid()))\n\n        except OSError:\n            time.sleep(1)\n        else:\n            return\n    msg = (\"Unable to acquire lock for cache directory ({0} exists). \"\n           \"You may need to delete the lock if the python interpreter wasn't \"\n           \"shut down properly.\")\n    raise RuntimeError(msg.format(lockdir))\n\n\ndef _release_download_cache_lock():\n    lockdir = os.path.join(_get_download_cache_locs()[0], 'lock')\n\n    if os.path.isdir(lockdir):\n        # if the pid file is present, be sure to remove it\n        pidfn = os.path.join(lockdir, 'pid')\n        if os.path.exists(pidfn):\n            os.remove(pidfn)\n        os.rmdir(lockdir)\n    else:\n        msg = 'Error releasing lock. \"{0}\" either does not exist or is not ' +\\\n              'a directory.'\n        raise RuntimeError(msg.format(lockdir))\n\n\ndef get_cached_urls():\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    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n    \"\"\"\n    # The code below is modified from astropy.utils.data.download_file()\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\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        return False\n\n    with shelve.open(urlmapfn) as url2hash:\n        return list(url2hash.keys())\n"},{"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":1098,"header":"def format_doc(docstring, *args, **kwargs)","id":8097,"name":"format_doc","nodeType":"Function","startLoc":879,"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"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.utils.data`.\n    ","endLoc":70,"id":8098,"nodeType":"Class","startLoc":42,"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    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    compute_hash_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Block size for computing MD5 file hashes.')\n    download_block_size = _config.ConfigItem(\n        2 ** 16,  # 64K\n        'Number of bytes of remote data to download per step.')\n    download_cache_lock_attempts = _config.ConfigItem(\n        5,\n        'Number of times to try to get the lock ' +\n        'while accessing the data cache before giving up.')\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":47,"id":8099,"name":"dataurl","nodeType":"Attribute","startLoc":47,"text":"dataurl"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":8100,"name":"mag","nodeType":"Attribute","startLoc":27,"text":"mag"},{"col":0,"comment":"","endLoc":8,"header":"units.py#<anonymous>","id":8101,"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":4,"comment":"The physical quantity corresponding the function one.","endLoc":501,"header":"@property\n    def physical(self)","id":8102,"name":"physical","nodeType":"Function","startLoc":498,"text":"@property\n    def physical(self):\n        \"\"\"The physical quantity corresponding the function one.\"\"\"\n        return self.to(self.unit.physical_unit)"},{"fileName":"timer.py","filePath":"astropy/utils","id":8103,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"General purpose timer related functions.\"\"\"\n\n# STDLIB\nimport time\nimport warnings\nfrom collections import Iterable, OrderedDict\nfrom functools import partial, wraps\n\n# THIRD-PARTY\nimport numpy as np\n\n# LOCAL\nfrom .. import units as u\nfrom .. import log\nfrom .. import modeling\nfrom .exceptions import AstropyUserWarning\n\n__all__ = ['timefunc', 'RunTimePredictor']\n__doctest_skip__ = ['timefunc']\n\n\ndef timefunc(num_tries=1, verbose=True):\n    \"\"\"Decorator to time a function or method.\n\n    Parameters\n    ----------\n    num_tries : int, optional\n        Number of calls to make. Timer will take the\n        average run time.\n\n    verbose : bool, optional\n        Extra log information.\n\n    Returns\n    -------\n    tt : float\n        Average run time in seconds.\n\n    result\n        Output(s) from the function.\n\n    Examples\n    --------\n    To add timer to time `numpy.log` for 100 times with\n    verbose output::\n\n        import numpy as np\n        from astropy.utils.timer import timefunc\n\n        @timefunc(100)\n        def timed_log(x):\n            return np.log(x)\n\n    To run the decorated function above:\n\n    >>> t, y = timed_log(100)\n    INFO: timed_log took 9.29832458496e-06 s on AVERAGE for 100 call(s). [...]\n    >>> t\n    9.298324584960938e-06\n    >>> y\n    4.6051701859880918\n\n    \"\"\"\n    def real_decorator(function):\n        @wraps(function)\n        def wrapper(*args, **kwargs):\n            ts = time.time()\n            for i in range(num_tries):\n                result = function(*args, **kwargs)\n            te = time.time()\n            tt = (te - ts) / num_tries\n            if verbose:  # pragma: no cover\n                log.info('{0} took {1} s on AVERAGE for {2} call(s).'.format(\n                    function.__name__, tt, num_tries))\n            return tt, result\n        return wrapper\n    return real_decorator\n\n\nclass RunTimePredictor:\n    \"\"\"Class to predict run time.\n\n    .. note:: Only predict for single varying numeric input parameter.\n\n    Parameters\n    ----------\n    func : function\n        Function to time.\n\n    args : tuple\n        Fixed positional argument(s) for the function.\n\n    kwargs : dict\n        Fixed keyword argument(s) for the function.\n\n    Examples\n    --------\n    >>> from astropy.utils.timer import RunTimePredictor\n\n    Set up a predictor for :math:`10^{x}`:\n\n    >>> p = RunTimePredictor(pow, 10)\n\n    Give it baseline data to use for prediction and\n    get the function output values:\n\n    >>> p.time_func(range(10, 1000, 200))\n    >>> for input, result in sorted(p.results.items()):\n    ...     print(\"pow(10, {0})\\\\n{1}\".format(input, result))\n    pow(10, 10)\n    10000000000\n    pow(10, 210)\n    10000000000...\n    pow(10, 410)\n    10000000000...\n    pow(10, 610)\n    10000000000...\n    pow(10, 810)\n    10000000000...\n\n    Fit a straight line assuming :math:`\\\\text{arg}^{1}` relationship\n    (coefficients are returned):\n\n    >>> p.do_fit()  # doctest: +SKIP\n    array([1.16777420e-05,  1.00135803e-08])\n\n    Predict run time for :math:`10^{5000}`:\n\n    >>> p.predict_time(5000)  # doctest: +SKIP\n    6.174564361572262e-05\n\n    Plot the prediction:\n\n    >>> p.plot(xlabeltext='Power of 10')  # doctest: +SKIP\n\n    .. image:: /_static/timer_prediction_pow10.png\n        :width: 450px\n        :alt: Example plot from `astropy.utils.timer.RunTimePredictor`\n\n    When the changing argument is not the last, e.g.,\n    :math:`x^{2}`, something like this might work:\n\n    >>> p = RunTimePredictor(lambda x: pow(x, 2))\n    >>> p.time_func([2, 3, 5])\n    >>> sorted(p.results.items())\n    [(2, 4), (3, 9), (5, 25)]\n\n    \"\"\"\n    def __init__(self, func, *args, **kwargs):\n        self._funcname = func.__name__\n        self._pfunc = partial(func, *args, **kwargs)\n        self._cache_good = OrderedDict()\n        self._cache_bad = []\n        self._cache_est = OrderedDict()\n        self._cache_out = OrderedDict()\n        self._fit_func = None\n        self._power = None\n\n    @property\n    def results(self):\n        \"\"\"Function outputs from `time_func`.\n\n        A dictionary mapping input arguments (fixed arguments\n        are not included) to their respective output values.\n\n        \"\"\"\n        return self._cache_out\n\n    @timefunc(num_tries=1, verbose=False)\n    def _timed_pfunc(self, arg):\n        \"\"\"Run partial func once for single arg and time it.\"\"\"\n        return self._pfunc(arg)\n\n    def _cache_time(self, arg):\n        \"\"\"Cache timing results without repetition.\"\"\"\n        if arg not in self._cache_good and arg not in self._cache_bad:\n            try:\n                result = self._timed_pfunc(arg)\n            except Exception as e:\n                warnings.warn(str(e), AstropyUserWarning)\n                self._cache_bad.append(arg)\n            else:\n                self._cache_good[arg] = result[0]  # Run time\n                self._cache_out[arg] = result[1]  # Function output\n\n    def time_func(self, arglist):\n        \"\"\"Time the partial function for a list of single args\n        and store run time in a cache. This forms a baseline for\n        the prediction.\n\n        This also stores function outputs in `results`.\n\n        Parameters\n        ----------\n        arglist : list of numbers\n            List of input arguments to time.\n\n        \"\"\"\n        if not isinstance(arglist, Iterable):\n            arglist = [arglist]\n\n        # Preserve arglist order\n        for arg in arglist:\n            self._cache_time(arg)\n\n    # FUTURE: Implement N^x * O(log(N)) fancy fitting.\n    def do_fit(self, model=None, fitter=None, power=1, min_datapoints=3):\n        \"\"\"Fit a function to the lists of arguments and\n        their respective run time in the cache.\n\n        By default, this does a linear least-square fitting\n        to a straight line on run time w.r.t. argument values\n        raised to the given power, and returns the optimal\n        intercept and slope.\n\n        Parameters\n        ----------\n        model : `astropy.modeling.Model`\n            Model for the expected trend of run time (Y-axis)\n            w.r.t. :math:`\\\\text{arg}^{\\\\text{power}}` (X-axis).\n            If `None`, will use `~astropy.modeling.polynomial.Polynomial1D`\n            with ``degree=1``.\n\n        fitter : `astropy.modeling.fitting.Fitter`\n            Fitter for the given model to extract optimal coefficient values.\n            If `None`, will use `~astropy.modeling.fitting.LinearLSQFitter`.\n\n        power : int, optional\n            Power of values to fit.\n\n        min_datapoints : int, optional\n            Minimum number of data points required for fitting.\n            They can be built up with `time_func`.\n\n        Returns\n        -------\n        a : array-like\n            Fitted `~astropy.modeling.FittableModel` parameters.\n\n        Raises\n        ------\n        ValueError\n            Insufficient data points for fitting.\n\n        ModelsError\n            Invalid model or fitter.\n\n        \"\"\"\n        # Reset related attributes\n        self._power = power\n        self._cache_est = OrderedDict()\n\n        x_arr = np.array(list(self._cache_good.keys()))\n        if x_arr.size < min_datapoints:\n            raise ValueError('requires {0} points but has {1}'.format(\n                min_datapoints, x_arr.size))\n\n        if model is None:\n            model = modeling.models.Polynomial1D(1)\n        elif not isinstance(model, modeling.core.Model):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a model.'.format(model))\n\n        if fitter is None:\n            fitter = modeling.fitting.LinearLSQFitter()\n        elif not isinstance(fitter, modeling.fitting.Fitter):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a fitter.'.format(fitter))\n\n        self._fit_func = fitter(\n            model, x_arr**power, list(self._cache_good.values()))\n\n        return self._fit_func.parameters\n\n    def predict_time(self, arg):\n        \"\"\"Predict run time for given argument.\n        If prediction is already cached, cached value is returned.\n\n        Parameters\n        ----------\n        arg : number\n            Input argument to predict run time for.\n\n        Returns\n        -------\n        t_est : float\n            Estimated run time for given argument.\n\n        Raises\n        ------\n        RuntimeError\n            No fitted data for prediction.\n\n        \"\"\"\n        if arg in self._cache_est:\n            t_est = self._cache_est[arg]\n        else:\n            if self._fit_func is None:\n                raise RuntimeError('no fitted data for prediction')\n            t_est = self._fit_func(arg**self._power)\n            self._cache_est[arg] = t_est\n        return t_est\n\n    def plot(self, xscale='linear', yscale='linear', xlabeltext='args',\n             save_as=''):  # pragma: no cover\n        \"\"\"Plot prediction.\n\n        .. note:: Uses `matplotlib <http://matplotlib.org/>`_.\n\n        Parameters\n        ----------\n        xscale, yscale : {'linear', 'log', 'symlog'}\n            Scaling for `matplotlib.axes.Axes`.\n\n        xlabeltext : str, optional\n            Text for X-label.\n\n        save_as : str, optional\n            Save plot as given filename.\n\n        Raises\n        ------\n        RuntimeError\n            Insufficient data for plotting.\n\n        \"\"\"\n        import matplotlib.pyplot as plt\n\n        # Actual data\n        x_arr = sorted(self._cache_good)\n        y_arr = np.array([self._cache_good[x] for x in x_arr])\n\n        if len(x_arr) <= 1:\n            raise RuntimeError('insufficient data for plotting')\n\n        # Auto-ranging\n        qmean = y_arr.mean() * u.second\n        for cur_u in (u.minute, u.second, u.millisecond, u.microsecond,\n                      u.nanosecond):\n            val = qmean.to_value(cur_u)\n            if 1000 > val >= 1:\n                break\n        y_arr = (y_arr * u.second).to_value(cur_u)\n\n        fig, ax = plt.subplots()\n        ax.plot(x_arr, y_arr, 'kx-', label='Actual')\n\n        # Fitted data\n        if self._fit_func is not None:\n            x_est = list(self._cache_est.keys())\n            y_est = (np.array(list(self._cache_est.values())) *\n                     u.second).to_value(cur_u)\n            ax.scatter(x_est, y_est, marker='o', c='r', label='Predicted')\n\n            x_fit = np.array(sorted(x_arr + x_est))\n            y_fit = (self._fit_func(x_fit**self._power) *\n                     u.second).to_value(cur_u)\n            ax.plot(x_fit, y_fit, 'b--', label='Fit')\n\n        ax.set_xscale(xscale)\n        ax.set_yscale(yscale)\n\n        ax.set_xlabel(xlabeltext)\n        ax.set_ylabel('Run time ({})'.format(cur_u.to_string()))\n        ax.set_title(self._funcname)\n        ax.legend(loc='best', numpoints=1)\n\n        plt.draw()\n\n        if save_as:\n            plt.savefig(save_as)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":8104,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"decorators.py#<anonymous>","id":8105,"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', 'wraps']\n\nif (isinstance(wraps.__doc__, str) and\n        wraps.__doc__ is not None and functools.wraps.__doc__ is not None):\n    wraps.__doc__ += functools.wraps.__doc__"},{"col":4,"comment":"Copy oneself, possibly with a different physical unit.","endLoc":124,"header":"def _copy(self, physical_unit=None)","id":8106,"name":"_copy","nodeType":"Function","startLoc":120,"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)"},{"fileName":"console.py","filePath":"astropy/utils","id":8107,"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\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 .. 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    @classproperty\n    def IOStream(cls):\n        if cls.ipyio is None:\n            return None\n        else:\n            return cls.ipyio.IOStream\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    if not isatty(sys_stream) or _IPython.OutStream is None:\n        return sys_stream\n\n    # Our system stream is an atty and we're in ipython.\n    ipyio_stream = _IPython.get_stream(stream)\n\n    if ipyio_stream is not None and isatty(ipyio_stream):\n        # Use the IPython console output stream\n        return ipyio_stream\n    else:\n        # sys.stdout was set to some other non-TTY stream (a file perhaps)\n        # so just use it directly\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().getName() != 'MainThread'):\n        return False\n\n    if hasattr(file, 'isatty'):\n        return file.isatty()\n\n    # Use two isinstance calls to only evaluate IOStream when necessary.\n    if (_IPython.OutStream is None or\n        (not isinstance(file, _IPython.OutStream) and\n         not isinstance(file, _IPython.IOStream))):\n        return False\n\n    # File is an IPython OutStream or IOStream.  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        # 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(str(\"HHHH\"), 0, 0, 0, 0)\n        x = fcntl.ioctl(file, termios.TIOCGWINSZ, s)\n        (lines, width, xpixels, ypixels) = struct.unpack(str(\"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 '\\033[{0}m{1}\\033[0m'.format(color_code, text)\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    if (_IPython.IOStream is not None and\n        isinstance(fileobj, _IPython.IOStream)):\n        # If the output stream is an IPython.utils.io.IOStream object that's\n        # not going to be very helpful to us since it doesn't raise any\n        # exceptions when an error occurs writing to its underlying stream.\n        # There's no advantage to us using IOStream.write directly though;\n        # instead just write directly to its underlying stream:\n        write = fileobj.stream.write\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 : writeable file-like object, 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 '   {0:2d}s'.format(seconds)\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 '{0:2d}{1}{2:2d}{3}'.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 .. 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 \"{0:>3s}{1}\".format(str_value, suffix)\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 object, 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(' {0:>4s}/{1:>4s}'.format(\n            human_file_size(value),\n            self._human_total))\n        write(' ({:>6.2%})'.format(frac))\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 = ' ({:>6.2%})'.format(frac)\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):\n        \"\"\"\n        Does a `map` operation while displaying a progress bar with\n        percentage complete.\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, optional\n            If `True`, use the `multiprocessing` module to distribute each\n            task to a different processor core.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writeable file-like object, 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\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:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                p = multiprocessing.Pool()\n                for i, result in enumerate(\n                    p.imap_unordered(function, items, chunksize=chunksize)):\n                    bar.update(i)\n                    results.append(result)\n                p.close()\n                p.join()\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.next()\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 : writeable file-like object, 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    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        if self._silent:\n            return self._silent_iterator()\n        else:\n            return self._iterator()\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 _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 object, 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        self._iter = self._obj.__enter__()\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        if self._is_spinner:\n            next(self._iter)\n        else:\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 : writeable file-like object, 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 lenght.')\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":99,"id":8108,"nodeType":"Class","startLoc":40,"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    @classproperty\n    def IOStream(cls):\n        if cls.ipyio is None:\n            return None\n        else:\n            return cls.ipyio.IOStream\n\n    @classmethod\n    def get_stream(cls, stream):\n        return getattr(cls.ipyio, stream)"},{"col":4,"comment":"null","endLoc":49,"header":"@classproperty\n    def get_ipython(cls)","id":8109,"name":"get_ipython","nodeType":"Function","startLoc":43,"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":77,"header":"@classproperty\n    def OutStream(cls)","id":8110,"name":"OutStream","nodeType":"Function","startLoc":51,"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"},{"className":"RunTimePredictor","col":0,"comment":"Class to predict run time.\n\n    .. note:: Only predict for single varying numeric input parameter.\n\n    Parameters\n    ----------\n    func : function\n        Function to time.\n\n    args : tuple\n        Fixed positional argument(s) for the function.\n\n    kwargs : dict\n        Fixed keyword argument(s) for the function.\n\n    Examples\n    --------\n    >>> from astropy.utils.timer import RunTimePredictor\n\n    Set up a predictor for :math:`10^{x}`:\n\n    >>> p = RunTimePredictor(pow, 10)\n\n    Give it baseline data to use for prediction and\n    get the function output values:\n\n    >>> p.time_func(range(10, 1000, 200))\n    >>> for input, result in sorted(p.results.items()):\n    ...     print(\"pow(10, {0})\\n{1}\".format(input, result))\n    pow(10, 10)\n    10000000000\n    pow(10, 210)\n    10000000000...\n    pow(10, 410)\n    10000000000...\n    pow(10, 610)\n    10000000000...\n    pow(10, 810)\n    10000000000...\n\n    Fit a straight line assuming :math:`\\text{arg}^{1}` relationship\n    (coefficients are returned):\n\n    >>> p.do_fit()  # doctest: +SKIP\n    array([1.16777420e-05,  1.00135803e-08])\n\n    Predict run time for :math:`10^{5000}`:\n\n    >>> p.predict_time(5000)  # doctest: +SKIP\n    6.174564361572262e-05\n\n    Plot the prediction:\n\n    >>> p.plot(xlabeltext='Power of 10')  # doctest: +SKIP\n\n    .. image:: /_static/timer_prediction_pow10.png\n        :width: 450px\n        :alt: Example plot from `astropy.utils.timer.RunTimePredictor`\n\n    When the changing argument is not the last, e.g.,\n    :math:`x^{2}`, something like this might work:\n\n    >>> p = RunTimePredictor(lambda x: pow(x, 2))\n    >>> p.time_func([2, 3, 5])\n    >>> sorted(p.results.items())\n    [(2, 4), (3, 9), (5, 25)]\n\n    ","endLoc":372,"id":8111,"nodeType":"Class","startLoc":81,"text":"class RunTimePredictor:\n    \"\"\"Class to predict run time.\n\n    .. note:: Only predict for single varying numeric input parameter.\n\n    Parameters\n    ----------\n    func : function\n        Function to time.\n\n    args : tuple\n        Fixed positional argument(s) for the function.\n\n    kwargs : dict\n        Fixed keyword argument(s) for the function.\n\n    Examples\n    --------\n    >>> from astropy.utils.timer import RunTimePredictor\n\n    Set up a predictor for :math:`10^{x}`:\n\n    >>> p = RunTimePredictor(pow, 10)\n\n    Give it baseline data to use for prediction and\n    get the function output values:\n\n    >>> p.time_func(range(10, 1000, 200))\n    >>> for input, result in sorted(p.results.items()):\n    ...     print(\"pow(10, {0})\\\\n{1}\".format(input, result))\n    pow(10, 10)\n    10000000000\n    pow(10, 210)\n    10000000000...\n    pow(10, 410)\n    10000000000...\n    pow(10, 610)\n    10000000000...\n    pow(10, 810)\n    10000000000...\n\n    Fit a straight line assuming :math:`\\\\text{arg}^{1}` relationship\n    (coefficients are returned):\n\n    >>> p.do_fit()  # doctest: +SKIP\n    array([1.16777420e-05,  1.00135803e-08])\n\n    Predict run time for :math:`10^{5000}`:\n\n    >>> p.predict_time(5000)  # doctest: +SKIP\n    6.174564361572262e-05\n\n    Plot the prediction:\n\n    >>> p.plot(xlabeltext='Power of 10')  # doctest: +SKIP\n\n    .. image:: /_static/timer_prediction_pow10.png\n        :width: 450px\n        :alt: Example plot from `astropy.utils.timer.RunTimePredictor`\n\n    When the changing argument is not the last, e.g.,\n    :math:`x^{2}`, something like this might work:\n\n    >>> p = RunTimePredictor(lambda x: pow(x, 2))\n    >>> p.time_func([2, 3, 5])\n    >>> sorted(p.results.items())\n    [(2, 4), (3, 9), (5, 25)]\n\n    \"\"\"\n    def __init__(self, func, *args, **kwargs):\n        self._funcname = func.__name__\n        self._pfunc = partial(func, *args, **kwargs)\n        self._cache_good = OrderedDict()\n        self._cache_bad = []\n        self._cache_est = OrderedDict()\n        self._cache_out = OrderedDict()\n        self._fit_func = None\n        self._power = None\n\n    @property\n    def results(self):\n        \"\"\"Function outputs from `time_func`.\n\n        A dictionary mapping input arguments (fixed arguments\n        are not included) to their respective output values.\n\n        \"\"\"\n        return self._cache_out\n\n    @timefunc(num_tries=1, verbose=False)\n    def _timed_pfunc(self, arg):\n        \"\"\"Run partial func once for single arg and time it.\"\"\"\n        return self._pfunc(arg)\n\n    def _cache_time(self, arg):\n        \"\"\"Cache timing results without repetition.\"\"\"\n        if arg not in self._cache_good and arg not in self._cache_bad:\n            try:\n                result = self._timed_pfunc(arg)\n            except Exception as e:\n                warnings.warn(str(e), AstropyUserWarning)\n                self._cache_bad.append(arg)\n            else:\n                self._cache_good[arg] = result[0]  # Run time\n                self._cache_out[arg] = result[1]  # Function output\n\n    def time_func(self, arglist):\n        \"\"\"Time the partial function for a list of single args\n        and store run time in a cache. This forms a baseline for\n        the prediction.\n\n        This also stores function outputs in `results`.\n\n        Parameters\n        ----------\n        arglist : list of numbers\n            List of input arguments to time.\n\n        \"\"\"\n        if not isinstance(arglist, Iterable):\n            arglist = [arglist]\n\n        # Preserve arglist order\n        for arg in arglist:\n            self._cache_time(arg)\n\n    # FUTURE: Implement N^x * O(log(N)) fancy fitting.\n    def do_fit(self, model=None, fitter=None, power=1, min_datapoints=3):\n        \"\"\"Fit a function to the lists of arguments and\n        their respective run time in the cache.\n\n        By default, this does a linear least-square fitting\n        to a straight line on run time w.r.t. argument values\n        raised to the given power, and returns the optimal\n        intercept and slope.\n\n        Parameters\n        ----------\n        model : `astropy.modeling.Model`\n            Model for the expected trend of run time (Y-axis)\n            w.r.t. :math:`\\\\text{arg}^{\\\\text{power}}` (X-axis).\n            If `None`, will use `~astropy.modeling.polynomial.Polynomial1D`\n            with ``degree=1``.\n\n        fitter : `astropy.modeling.fitting.Fitter`\n            Fitter for the given model to extract optimal coefficient values.\n            If `None`, will use `~astropy.modeling.fitting.LinearLSQFitter`.\n\n        power : int, optional\n            Power of values to fit.\n\n        min_datapoints : int, optional\n            Minimum number of data points required for fitting.\n            They can be built up with `time_func`.\n\n        Returns\n        -------\n        a : array-like\n            Fitted `~astropy.modeling.FittableModel` parameters.\n\n        Raises\n        ------\n        ValueError\n            Insufficient data points for fitting.\n\n        ModelsError\n            Invalid model or fitter.\n\n        \"\"\"\n        # Reset related attributes\n        self._power = power\n        self._cache_est = OrderedDict()\n\n        x_arr = np.array(list(self._cache_good.keys()))\n        if x_arr.size < min_datapoints:\n            raise ValueError('requires {0} points but has {1}'.format(\n                min_datapoints, x_arr.size))\n\n        if model is None:\n            model = modeling.models.Polynomial1D(1)\n        elif not isinstance(model, modeling.core.Model):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a model.'.format(model))\n\n        if fitter is None:\n            fitter = modeling.fitting.LinearLSQFitter()\n        elif not isinstance(fitter, modeling.fitting.Fitter):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a fitter.'.format(fitter))\n\n        self._fit_func = fitter(\n            model, x_arr**power, list(self._cache_good.values()))\n\n        return self._fit_func.parameters\n\n    def predict_time(self, arg):\n        \"\"\"Predict run time for given argument.\n        If prediction is already cached, cached value is returned.\n\n        Parameters\n        ----------\n        arg : number\n            Input argument to predict run time for.\n\n        Returns\n        -------\n        t_est : float\n            Estimated run time for given argument.\n\n        Raises\n        ------\n        RuntimeError\n            No fitted data for prediction.\n\n        \"\"\"\n        if arg in self._cache_est:\n            t_est = self._cache_est[arg]\n        else:\n            if self._fit_func is None:\n                raise RuntimeError('no fitted data for prediction')\n            t_est = self._fit_func(arg**self._power)\n            self._cache_est[arg] = t_est\n        return t_est\n\n    def plot(self, xscale='linear', yscale='linear', xlabeltext='args',\n             save_as=''):  # pragma: no cover\n        \"\"\"Plot prediction.\n\n        .. note:: Uses `matplotlib <http://matplotlib.org/>`_.\n\n        Parameters\n        ----------\n        xscale, yscale : {'linear', 'log', 'symlog'}\n            Scaling for `matplotlib.axes.Axes`.\n\n        xlabeltext : str, optional\n            Text for X-label.\n\n        save_as : str, optional\n            Save plot as given filename.\n\n        Raises\n        ------\n        RuntimeError\n            Insufficient data for plotting.\n\n        \"\"\"\n        import matplotlib.pyplot as plt\n\n        # Actual data\n        x_arr = sorted(self._cache_good)\n        y_arr = np.array([self._cache_good[x] for x in x_arr])\n\n        if len(x_arr) <= 1:\n            raise RuntimeError('insufficient data for plotting')\n\n        # Auto-ranging\n        qmean = y_arr.mean() * u.second\n        for cur_u in (u.minute, u.second, u.millisecond, u.microsecond,\n                      u.nanosecond):\n            val = qmean.to_value(cur_u)\n            if 1000 > val >= 1:\n                break\n        y_arr = (y_arr * u.second).to_value(cur_u)\n\n        fig, ax = plt.subplots()\n        ax.plot(x_arr, y_arr, 'kx-', label='Actual')\n\n        # Fitted data\n        if self._fit_func is not None:\n            x_est = list(self._cache_est.keys())\n            y_est = (np.array(list(self._cache_est.values())) *\n                     u.second).to_value(cur_u)\n            ax.scatter(x_est, y_est, marker='o', c='r', label='Predicted')\n\n            x_fit = np.array(sorted(x_arr + x_est))\n            y_fit = (self._fit_func(x_fit**self._power) *\n                     u.second).to_value(cur_u)\n            ax.plot(x_fit, y_fit, 'b--', label='Fit')\n\n        ax.set_xscale(xscale)\n        ax.set_yscale(yscale)\n\n        ax.set_xlabel(xlabeltext)\n        ax.set_ylabel('Run time ({})'.format(cur_u.to_string()))\n        ax.set_title(self._funcname)\n        ax.legend(loc='best', numpoints=1)\n\n        plt.draw()\n\n        if save_as:\n            plt.savefig(save_as)"},{"col":4,"comment":"null","endLoc":158,"header":"def __init__(self, func, *args, **kwargs)","id":8112,"name":"__init__","nodeType":"Function","startLoc":150,"text":"def __init__(self, func, *args, **kwargs):\n        self._funcname = func.__name__\n        self._pfunc = partial(func, *args, **kwargs)\n        self._cache_good = OrderedDict()\n        self._cache_bad = []\n        self._cache_est = OrderedDict()\n        self._cache_out = OrderedDict()\n        self._fit_func = None\n        self._power = None"},{"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":509,"header":"@property\n    def _function_view(self)","id":8113,"name":"_function_view","nodeType":"Function","startLoc":503,"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)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":50,"id":8114,"name":"dataurl_mirror","nodeType":"Attribute","startLoc":50,"text":"dataurl_mirror"},{"col":4,"comment":"null","endLoc":128,"header":"@property\n    def physical_unit(self)","id":8115,"name":"physical_unit","nodeType":"Function","startLoc":126,"text":"@property\n    def physical_unit(self):\n        return self._physical_unit"},{"col":4,"comment":"null","endLoc":132,"header":"@property\n    def function_unit(self)","id":8116,"name":"function_unit","nodeType":"Function","startLoc":130,"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":141,"header":"@property\n    def equivalencies(self)","id":8117,"name":"equivalencies","nodeType":"Function","startLoc":134,"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":149,"header":"def decompose(self, bases=set())","id":8118,"name":"decompose","nodeType":"Function","startLoc":144,"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":4,"comment":"Function outputs from `time_func`.\n\n        A dictionary mapping input arguments (fixed arguments\n        are not included) to their respective output values.\n\n        ","endLoc":168,"header":"@property\n    def results(self)","id":8119,"name":"results","nodeType":"Function","startLoc":160,"text":"@property\n    def results(self):\n        \"\"\"Function outputs from `time_func`.\n\n        A dictionary mapping input arguments (fixed arguments\n        are not included) to their respective output values.\n\n        \"\"\"\n        return self._cache_out"},{"col":4,"comment":"Return a copy with the physical unit in SI units.","endLoc":515,"header":"@property\n    def si(self)","id":8120,"name":"si","nodeType":"Function","startLoc":512,"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":4,"comment":"Run partial func once for single arg and time it.","endLoc":173,"header":"@timefunc(num_tries=1, verbose=False)\n    def _timed_pfunc(self, arg)","id":8121,"name":"_timed_pfunc","nodeType":"Function","startLoc":170,"text":"@timefunc(num_tries=1, verbose=False)\n    def _timed_pfunc(self, arg):\n        \"\"\"Run partial func once for single arg and time it.\"\"\"\n        return self._pfunc(arg)"},{"col":0,"comment":"Decorator to time a function or method.\n\n    Parameters\n    ----------\n    num_tries : int, optional\n        Number of calls to make. Timer will take the\n        average run time.\n\n    verbose : bool, optional\n        Extra log information.\n\n    Returns\n    -------\n    tt : float\n        Average run time in seconds.\n\n    result\n        Output(s) from the function.\n\n    Examples\n    --------\n    To add timer to time `numpy.log` for 100 times with\n    verbose output::\n\n        import numpy as np\n        from astropy.utils.timer import timefunc\n\n        @timefunc(100)\n        def timed_log(x):\n            return np.log(x)\n\n    To run the decorated function above:\n\n    >>> t, y = timed_log(100)\n    INFO: timed_log took 9.29832458496e-06 s on AVERAGE for 100 call(s). [...]\n    >>> t\n    9.298324584960938e-06\n    >>> y\n    4.6051701859880918\n\n    ","endLoc":78,"header":"def timefunc(num_tries=1, verbose=True)","id":8122,"name":"timefunc","nodeType":"Function","startLoc":23,"text":"def timefunc(num_tries=1, verbose=True):\n    \"\"\"Decorator to time a function or method.\n\n    Parameters\n    ----------\n    num_tries : int, optional\n        Number of calls to make. Timer will take the\n        average run time.\n\n    verbose : bool, optional\n        Extra log information.\n\n    Returns\n    -------\n    tt : float\n        Average run time in seconds.\n\n    result\n        Output(s) from the function.\n\n    Examples\n    --------\n    To add timer to time `numpy.log` for 100 times with\n    verbose output::\n\n        import numpy as np\n        from astropy.utils.timer import timefunc\n\n        @timefunc(100)\n        def timed_log(x):\n            return np.log(x)\n\n    To run the decorated function above:\n\n    >>> t, y = timed_log(100)\n    INFO: timed_log took 9.29832458496e-06 s on AVERAGE for 100 call(s). [...]\n    >>> t\n    9.298324584960938e-06\n    >>> y\n    4.6051701859880918\n\n    \"\"\"\n    def real_decorator(function):\n        @wraps(function)\n        def wrapper(*args, **kwargs):\n            ts = time.time()\n            for i in range(num_tries):\n                result = function(*args, **kwargs)\n            te = time.time()\n            tt = (te - ts) / num_tries\n            if verbose:  # pragma: no cover\n                log.info('{0} took {1} s on AVERAGE for {2} call(s).'.format(\n                    function.__name__, tt, num_tries))\n            return tt, result\n        return wrapper\n    return real_decorator"},{"col":4,"comment":"null","endLoc":235,"header":"@classmethod\n    def _to_decomposed_alternative(cls, unit)","id":8123,"name":"_to_decomposed_alternative","nodeType":"Function","startLoc":223,"text":"@classmethod\n    def _to_decomposed_alternative(cls, unit):\n        from .. 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 '{0} (with data multiplied by {1})'.format(\n                cls.to_string(unit), scale)\n        return s"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":53,"id":8124,"name":"remote_timeout","nodeType":"Attribute","startLoc":53,"text":"remote_timeout"},{"col":4,"comment":"Return a copy with the physical unit in CGS units.","endLoc":520,"header":"@property\n    def cgs(self)","id":8125,"name":"cgs","nodeType":"Function","startLoc":517,"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":"Generate a new `FunctionQuantity` with the physical unit decomposed.\n\n        For details, see `~astropy.units.Quantity.decompose`.\n        ","endLoc":527,"header":"def decompose(self, bases=[])","id":8126,"name":"decompose","nodeType":"Function","startLoc":522,"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":"Check that the ufunc can deal with a FunctionQuantity.","endLoc":548,"header":"def __array_prepare__(self, obj, context=None)","id":8127,"name":"__array_prepare__","nodeType":"Function","startLoc":530,"text":"def __array_prepare__(self, obj, context=None):\n        \"\"\"Check that the ufunc can deal with a FunctionQuantity.\"\"\"\n\n        # If no context is set, just return the input\n        if context is None:  # pragma: no cover\n            return obj\n\n        # Find out whether ufunc is supported\n        function = context[0]\n        if not (function in self._supported_ufuncs or\n                all(arg.unit.physical_unit == dimensionless_unscaled\n                    for arg in context[1][:function.nin]\n                    if (hasattr(arg, 'unit') and\n                        hasattr(arg.unit, 'physical_unit')))):\n            raise UnitTypeError(\"Cannot use function '{0}' with function \"\n                                \"quantities that are not dimensionless.\"\n                                .format(context[0].__name__))\n\n        return super().__array_prepare__(obj, context)"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":8128,"name":"_explicit_custom_unit_regex","nodeType":"Attribute","startLoc":23,"text":"_explicit_custom_unit_regex"},{"attributeType":"null","col":4,"comment":"null","endLoc":25,"id":8129,"name":"_custom_unit_regex","nodeType":"Attribute","startLoc":25,"text":"_custom_unit_regex"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":8130,"name":"_custom_units","nodeType":"Attribute","startLoc":26,"text":"_custom_units"},{"col":0,"comment":"","endLoc":4,"header":"vounit.py#<anonymous>","id":8131,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nHandles the \"VOUnit\" unit format.\n\"\"\""},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":57,"id":8132,"name":"compute_hash_block_size","nodeType":"Attribute","startLoc":57,"text":"compute_hash_block_size"},{"col":4,"comment":"null","endLoc":554,"header":"def __quantity_subclass__(self, unit)","id":8133,"name":"__quantity_subclass__","nodeType":"Function","startLoc":550,"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":"ConfigItem","col":4,"comment":"null","endLoc":60,"id":8134,"name":"download_block_size","nodeType":"Attribute","startLoc":60,"text":"download_block_size"},{"col":4,"comment":"null","endLoc":568,"header":"def _set_unit(self, unit)","id":8135,"name":"_set_unit","nodeType":"Function","startLoc":556,"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                    \"{0} instances require {1} function units\"\n                    .format(type(self).__name__, self._unit_class.__name__) +\n                    \", so cannot set it to '{0}'.\".format(unit))\n\n        self._unit = unit"},{"col":4,"comment":"Cache timing results without repetition.","endLoc":185,"header":"def _cache_time(self, arg)","id":8136,"name":"_cache_time","nodeType":"Function","startLoc":175,"text":"def _cache_time(self, arg):\n        \"\"\"Cache timing results without repetition.\"\"\"\n        if arg not in self._cache_good and arg not in self._cache_bad:\n            try:\n                result = self._timed_pfunc(arg)\n            except Exception as e:\n                warnings.warn(str(e), AstropyUserWarning)\n                self._cache_bad.append(arg)\n            else:\n                self._cache_good[arg] = result[0]  # Run time\n                self._cache_out[arg] = result[1]  # Function output"},{"col":4,"comment":"null","endLoc":576,"header":"def __mul__(self, other)","id":8137,"name":"__mul__","nodeType":"Function","startLoc":571,"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.\")"},{"col":4,"comment":"null","endLoc":583,"header":"def __truediv__(self, other)","id":8138,"name":"__truediv__","nodeType":"Function","startLoc":578,"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":590,"header":"def __rtruediv__(self, other)","id":8139,"name":"__rtruediv__","nodeType":"Function","startLoc":585,"text":"def __rtruediv__(self, other):\n        if self.unit.physical_unit == dimensionless_unscaled:\n            return self._function_view.__rdiv__(other)\n\n        raise UnitTypeError(\"Cannot divide function quantities which \"\n                            \"are not dimensionless into anything.\")"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":63,"id":8140,"name":"download_cache_lock_attempts","nodeType":"Attribute","startLoc":63,"text":"download_cache_lock_attempts"},{"col":4,"comment":"null","endLoc":88,"header":"@classproperty\n    def ipyio(cls)","id":8141,"name":"ipyio","nodeType":"Function","startLoc":79,"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":"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":612,"header":"def _comparison(self, other, comparison_func)","id":8142,"name":"_comparison","nodeType":"Function","startLoc":592,"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":4,"comment":"Copy the current function unit with the physical unit in SI.","endLoc":154,"header":"@property\n    def si(self)","id":8143,"name":"si","nodeType":"Function","startLoc":151,"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":"null","endLoc":95,"header":"@classproperty\n    def IOStream(cls)","id":8144,"name":"IOStream","nodeType":"Function","startLoc":90,"text":"@classproperty\n    def IOStream(cls):\n        if cls.ipyio is None:\n            return None\n        else:\n            return cls.ipyio.IOStream"},{"attributeType":"None","col":16,"comment":"null","endLoc":85,"id":8145,"name":"_ipyio","nodeType":"Attribute","startLoc":85,"text":"cls._ipyio"},{"attributeType":"None","col":12,"comment":"null","endLoc":54,"id":8146,"name":"_OutStream","nodeType":"Attribute","startLoc":54,"text":"cls._OutStream"},{"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":750,"id":8147,"nodeType":"Class","startLoc":488,"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 object, 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(' {0:>4s}/{1:>4s}'.format(\n            human_file_size(value),\n            self._human_total))\n        write(' ({:>6.2%})'.format(frac))\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 = ' ({:>6.2%})'.format(frac)\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):\n        \"\"\"\n        Does a `map` operation while displaying a progress bar with\n        percentage complete.\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, optional\n            If `True`, use the `multiprocessing` module to distribute each\n            task to a different processor core.\n\n        ipython_widget : bool, optional\n            If `True`, the progress bar will display as an IPython\n            notebook widget.\n\n        file : writeable file-like object, 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\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:\n                for i, item in enumerate(items):\n                    results.append(function(item))\n                    if (i % chunksize) == 0:\n                        bar.update(i)\n            else:\n                p = multiprocessing.Pool()\n                for i, result in enumerate(\n                    p.imap_unordered(function, items, chunksize=chunksize)):\n                    bar.update(i)\n                    results.append(result)\n                p.close()\n                p.join()\n\n        return results"},{"col":4,"comment":"null","endLoc":564,"header":"def __enter__(self)","id":8148,"name":"__enter__","nodeType":"Function","startLoc":563,"text":"def __enter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":573,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":8149,"name":"__exit__","nodeType":"Function","startLoc":566,"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)"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":67,"id":8150,"name":"delete_temporary_downloads_at_exit","nodeType":"Attribute","startLoc":67,"text":"delete_temporary_downloads_at_exit"},{"col":4,"comment":"null","endLoc":618,"header":"def __eq__(self, other)","id":8151,"name":"__eq__","nodeType":"Function","startLoc":614,"text":"def __eq__(self, other):\n        try:\n            return self._comparison(other, self.value.__eq__)\n        except UnitsError:\n            return False"},{"col":4,"comment":"null","endLoc":624,"header":"def __ne__(self, other)","id":8152,"name":"__ne__","nodeType":"Function","startLoc":620,"text":"def __ne__(self, other):\n        try:\n            return self._comparison(other, self.value.__ne__)\n        except UnitsError:\n            return True"},{"col":4,"comment":"null","endLoc":627,"header":"def __gt__(self, other)","id":8153,"name":"__gt__","nodeType":"Function","startLoc":626,"text":"def __gt__(self, other):\n        return self._comparison(other, self.value.__gt__)"},{"col":4,"comment":"null","endLoc":630,"header":"def __ge__(self, other)","id":8154,"name":"__ge__","nodeType":"Function","startLoc":629,"text":"def __ge__(self, other):\n        return self._comparison(other, self.value.__ge__)"},{"col":4,"comment":"Time the partial function for a list of single args\n        and store run time in a cache. This forms a baseline for\n        the prediction.\n\n        This also stores function outputs in `results`.\n\n        Parameters\n        ----------\n        arglist : list of numbers\n            List of input arguments to time.\n\n        ","endLoc":205,"header":"def time_func(self, arglist)","id":8155,"name":"time_func","nodeType":"Function","startLoc":187,"text":"def time_func(self, arglist):\n        \"\"\"Time the partial function for a list of single args\n        and store run time in a cache. This forms a baseline for\n        the prediction.\n\n        This also stores function outputs in `results`.\n\n        Parameters\n        ----------\n        arglist : list of numbers\n            List of input arguments to time.\n\n        \"\"\"\n        if not isinstance(arglist, Iterable):\n            arglist = [arglist]\n\n        # Preserve arglist order\n        for arg in arglist:\n            self._cache_time(arg)"},{"col":4,"comment":"Copy the current function unit with the physical unit in CGS.","endLoc":159,"header":"@property\n    def cgs(self)","id":8156,"name":"cgs","nodeType":"Function","startLoc":156,"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)"},{"col":4,"comment":"null","endLoc":633,"header":"def __lt__(self, other)","id":8157,"name":"__lt__","nodeType":"Function","startLoc":632,"text":"def __lt__(self, other):\n        return self._comparison(other, self.value.__lt__)"},{"col":4,"comment":"null","endLoc":636,"header":"def __le__(self, other)","id":8158,"name":"__le__","nodeType":"Function","startLoc":635,"text":"def __le__(self, other):\n        return self._comparison(other, self.value.__le__)"},{"col":4,"comment":"Get physical type corresponding to physical unit.","endLoc":163,"header":"def _get_physical_type_id(self)","id":8159,"name":"_get_physical_type_id","nodeType":"Function","startLoc":161,"text":"def _get_physical_type_id(self):\n        \"\"\"Get physical type corresponding to physical unit.\"\"\"\n        return self.physical_unit._get_physical_type_id()"},{"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":82,"id":8160,"nodeType":"Class","startLoc":76,"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    \"\"\""},{"col":4,"comment":"Return the physical type of the physical unit (e.g., 'length').","endLoc":168,"header":"@property\n    def physical_type(self)","id":8161,"name":"physical_type","nodeType":"Function","startLoc":165,"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 : unit object or 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 equivalence pairs, 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 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":201,"header":"def is_equivalent(self, other, equivalencies=[])","id":8162,"name":"is_equivalent","nodeType":"Function","startLoc":170,"text":"def is_equivalent(self, other, equivalencies=[]):\n        \"\"\"\n        Returns `True` if this unit is equivalent to ``other``.\n\n        Parameters\n        ----------\n        other : unit object or 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 equivalence pairs, 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 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)"},{"col":4,"comment":"Fit a function to the lists of arguments and\n        their respective run time in the cache.\n\n        By default, this does a linear least-square fitting\n        to a straight line on run time w.r.t. argument values\n        raised to the given power, and returns the optimal\n        intercept and slope.\n\n        Parameters\n        ----------\n        model : `astropy.modeling.Model`\n            Model for the expected trend of run time (Y-axis)\n            w.r.t. :math:`\\text{arg}^{\\text{power}}` (X-axis).\n            If `None`, will use `~astropy.modeling.polynomial.Polynomial1D`\n            with ``degree=1``.\n\n        fitter : `astropy.modeling.fitting.Fitter`\n            Fitter for the given model to extract optimal coefficient values.\n            If `None`, will use `~astropy.modeling.fitting.LinearLSQFitter`.\n\n        power : int, optional\n            Power of values to fit.\n\n        min_datapoints : int, optional\n            Minimum number of data points required for fitting.\n            They can be built up with `time_func`.\n\n        Returns\n        -------\n        a : array-like\n            Fitted `~astropy.modeling.FittableModel` parameters.\n\n        Raises\n        ------\n        ValueError\n            Insufficient data points for fitting.\n\n        ModelsError\n            Invalid model or fitter.\n\n        ","endLoc":274,"header":"def do_fit(self, model=None, fitter=None, power=1, min_datapoints=3)","id":8163,"name":"do_fit","nodeType":"Function","startLoc":208,"text":"def do_fit(self, model=None, fitter=None, power=1, min_datapoints=3):\n        \"\"\"Fit a function to the lists of arguments and\n        their respective run time in the cache.\n\n        By default, this does a linear least-square fitting\n        to a straight line on run time w.r.t. argument values\n        raised to the given power, and returns the optimal\n        intercept and slope.\n\n        Parameters\n        ----------\n        model : `astropy.modeling.Model`\n            Model for the expected trend of run time (Y-axis)\n            w.r.t. :math:`\\\\text{arg}^{\\\\text{power}}` (X-axis).\n            If `None`, will use `~astropy.modeling.polynomial.Polynomial1D`\n            with ``degree=1``.\n\n        fitter : `astropy.modeling.fitting.Fitter`\n            Fitter for the given model to extract optimal coefficient values.\n            If `None`, will use `~astropy.modeling.fitting.LinearLSQFitter`.\n\n        power : int, optional\n            Power of values to fit.\n\n        min_datapoints : int, optional\n            Minimum number of data points required for fitting.\n            They can be built up with `time_func`.\n\n        Returns\n        -------\n        a : array-like\n            Fitted `~astropy.modeling.FittableModel` parameters.\n\n        Raises\n        ------\n        ValueError\n            Insufficient data points for fitting.\n\n        ModelsError\n            Invalid model or fitter.\n\n        \"\"\"\n        # Reset related attributes\n        self._power = power\n        self._cache_est = OrderedDict()\n\n        x_arr = np.array(list(self._cache_good.keys()))\n        if x_arr.size < min_datapoints:\n            raise ValueError('requires {0} points but has {1}'.format(\n                min_datapoints, x_arr.size))\n\n        if model is None:\n            model = modeling.models.Polynomial1D(1)\n        elif not isinstance(model, modeling.core.Model):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a model.'.format(model))\n\n        if fitter is None:\n            fitter = modeling.fitting.LinearLSQFitter()\n        elif not isinstance(fitter, modeling.fitting.Fitter):\n            raise modeling.fitting.ModelsError(\n                '{0} is not a fitter.'.format(fitter))\n\n        self._fit_func = fitter(\n            model, x_arr**power, list(self._cache_good.values()))\n\n        return self._fit_func.parameters"},{"fileName":"collections.py","filePath":"astropy/utils","id":8164,"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                \"homogeneous list must contain only objects of \"\n                \"type '{}'\".format(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":"\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 objects\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('maps', 'astropy.wcs.tests',\n        ...                                 '*.hdr'):\n        ...     fcontents = fd.read()\n        ...\n    ","endLoc":790,"header":"def get_pkg_data_fileobjs(datadir, package=None, pattern='*', encoding=None)","id":8165,"name":"get_pkg_data_fileobjs","nodeType":"Function","startLoc":729,"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 objects\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('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":"","endLoc":4,"header":"collections.py#<anonymous>","id":8166,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nA module containing specialized collection classes.\n\"\"\""},{"fileName":"codegen.py","filePath":"astropy/utils","id":8167,"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('invalid argument name: {0}'.format(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('invalid argument name: {0}'.format(item))\n\n    def_signature = [', '.join(pos_args)]\n\n    if varargs:\n        def_signature.append(', *{0}'.format(varargs))\n\n    call_signature = def_signature[:]\n\n    if name is None:\n        name = func.__name__\n\n    global_vars = {'__{0}__func'.format(name): 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 = '_kwargs{0}'.format(idx)\n        local_vars[default_var] = value\n        def_signature.append(', {0}={1}'.format(key, default_var))\n        call_signature.append(', {0}={0}'.format(key))\n\n    if varkwargs:\n        def_signature.append(', **{0}'.format(varkwargs))\n        call_signature.append(', **{0}'.format(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":"null","col":0,"comment":"null","endLoc":16,"id":8168,"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":8169,"name":"_ARGNAME_RE","nodeType":"Attribute","startLoc":19,"text":"_ARGNAME_RE"},{"col":4,"comment":"null","endLoc":653,"header":"def _wrap_function(self, function, *args, **kwargs)","id":8170,"name":"_wrap_function","nodeType":"Function","startLoc":639,"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 '{0}' with \"\n                        \"function quantities that are not dimensionless.\"\n                        .format(function.__name__))"},{"attributeType":"null","col":4,"comment":"Default `~astropy.units.function.FunctionUnitBase` subclass.\n\n    This should be overridden by subclasses.\n    ","endLoc":460,"id":8171,"name":"_unit_class","nodeType":"Attribute","startLoc":460,"text":"_unit_class"},{"attributeType":"null","col":4,"comment":"null","endLoc":467,"id":8172,"name":"__array_priority__","nodeType":"Attribute","startLoc":467,"text":"__array_priority__"},{"attributeType":"null","col":4,"comment":"null","endLoc":470,"id":8173,"name":"_supported_ufuncs","nodeType":"Attribute","startLoc":470,"text":"_supported_ufuncs"},{"col":0,"comment":"","endLoc":3,"header":"codegen.py#<anonymous>","id":8174,"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\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":471,"id":8175,"name":"_supported_functions","nodeType":"Attribute","startLoc":471,"text":"_supported_functions"},{"fileName":"state.py","filePath":"astropy/utils","id":8176,"nodeType":"File","text":"\"\"\"\nA simple class to manage a piece of global science state.  See\n:ref:`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                return ('<ScienceState {0}: {1!r}>'\n                        .format(self._parent.__name__, self._parent._value))\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"},{"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":73,"id":8177,"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                return ('<ScienceState {0}: {1!r}>'\n                        .format(self._parent.__name__, self._parent._value))\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"},{"col":4,"comment":"\n        Return the converted values in the specified unit.\n\n        Parameters\n        ----------\n        other : `~astropy.units.Unit` object, `~astropy.units.function.FunctionUnitBase` object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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 meant to treat only equivalencies between different\n            physical units; the build-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        UnitsError\n            If units are inconsistent.\n        ","endLoc":257,"header":"def to(self, other, value=1., equivalencies=[])","id":8178,"name":"to","nodeType":"Function","startLoc":203,"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` object, `~astropy.units.function.FunctionUnitBase` object or string\n            The unit to convert to.\n\n        value : scalar int or float, or sequence convertible to array, 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 equivalence pairs, 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 meant to treat only equivalencies between different\n            physical units; the build-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        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            # when other is not a function unit\n            return self.physical_unit.to(other, self.to_physical(value),\n                                         equivalencies)"},{"col":4,"comment":"null","endLoc":33,"header":"def __init__(self)","id":8179,"name":"__init__","nodeType":"Function","startLoc":31,"text":"def __init__(self):\n        raise RuntimeError(\n            \"This class is a singleton.  Do not instantiate.\")"},{"attributeType":"null","col":8,"comment":"null","endLoc":64,"id":8180,"name":"_value","nodeType":"Attribute","startLoc":64,"text":"cls._value"},{"attributeType":"null","col":12,"comment":"null","endLoc":491,"id":8181,"name":"unit","nodeType":"Attribute","startLoc":491,"text":"unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":568,"id":8182,"name":"_unit","nodeType":"Attribute","startLoc":568,"text":"self._unit"},{"attributeType":"null","col":20,"comment":"null","endLoc":487,"id":8183,"name":"value_unit","nodeType":"Attribute","startLoc":487,"text":"value_unit"},{"attributeType":"null","col":12,"comment":"null","endLoc":490,"id":8184,"name":"physical_unit","nodeType":"Attribute","startLoc":490,"text":"physical_unit"},{"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":104,"id":8185,"nodeType":"Class","startLoc":16,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":8186,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"state.py#<anonymous>","id":8187,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"\nA simple class to manage a piece of global science state.  See\n:ref:`config-developer` for more details.\n\"\"\"\n\n__all__ = ['ScienceState']"},{"col":4,"comment":"null","endLoc":35,"header":"@property\n    def _default_function_unit(self)","id":8188,"name":"_default_function_unit","nodeType":"Function","startLoc":33,"text":"@property\n    def _default_function_unit(self):\n        return dex"},{"col":4,"comment":"null","endLoc":39,"header":"@property\n    def _quantity_class(self)","id":8189,"name":"_quantity_class","nodeType":"Function","startLoc":37,"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":44,"header":"def from_physical(self, x)","id":8190,"name":"from_physical","nodeType":"Function","startLoc":41,"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":49,"header":"def to_physical(self, x)","id":8191,"name":"to_physical","nodeType":"Function","startLoc":46,"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)"},{"fileName":"setup_package.py","filePath":"astropy/utils","id":8192,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom distutils.core 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\n\ndef get_package_data():\n    # Installs the testing data files\n    return {\n        'astropy.utils.tests': [\n            'data/test_package/*.py',\n            'data/test_package/data/*.txt',\n            'data/*.dat',\n            'data/*.txt',\n            'data/*.gz',\n            'data/*.bz2',\n            'data/*.xz',\n            'data/.hidden_file.txt',\n            'data/*.cfg'],\n        'astropy.utils.iers': [\n            'data/ReadMe.eopc04_IAU2000',\n            'data/ReadMe.finals2000A',\n            'data/eopc04_IAU2000.62-now',\n            'tests/finals2000A-2016-04-30-test',\n            'tests/finals2000A-2016-02-30-test',\n            'tests/iers_a_excerpt']\n    }\n"},{"col":0,"comment":"null","endLoc":13,"header":"def get_extensions()","id":8193,"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":36,"header":"def get_package_data()","id":8194,"name":"get_package_data","nodeType":"Function","startLoc":16,"text":"def get_package_data():\n    # Installs the testing data files\n    return {\n        'astropy.utils.tests': [\n            'data/test_package/*.py',\n            'data/test_package/data/*.txt',\n            'data/*.dat',\n            'data/*.txt',\n            'data/*.gz',\n            'data/*.bz2',\n            'data/*.xz',\n            'data/.hidden_file.txt',\n            'data/*.cfg'],\n        'astropy.utils.iers': [\n            'data/ReadMe.eopc04_IAU2000',\n            'data/ReadMe.finals2000A',\n            'data/eopc04_IAU2000.62-now',\n            'tests/finals2000A-2016-04-30-test',\n            'tests/finals2000A-2016-02-30-test',\n            'tests/iers_a_excerpt']\n    }"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":8195,"name":"ASTROPY_UTILS_ROOT","nodeType":"Attribute","startLoc":6,"text":"ASTROPY_UTILS_ROOT"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":8196,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"ASTROPY_UTILS_ROOT = dirname(__file__)"},{"fileName":"misc.py","filePath":"astropy/utils","id":8197,"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\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\nimport urllib.request\n\nfrom itertools import zip_longest\nfrom contextlib import contextmanager\nfrom collections import defaultdict, OrderedDict\n\n\n\n__all__ = ['isiterable', 'silence', 'format_exception', 'NumpyRNGContext',\n           'find_api_page', 'is_path_hidden', 'walk_skip_hidden',\n           'JsonCustomEncoder', 'indent', 'InheritDocstrings',\n           'OrderedDescriptor', 'OrderedDescriptorContainer', 'set_locale',\n           'ShapedLikeNDArray', 'check_broadcast', 'IncompatibleShapeError',\n           'dtype_bytes_or_chars']\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        '<unkown>' 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\n    from zlib import decompress\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 .. 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 = 'http://docs.astropy.org/en/{vers}/'.format(vers=version)\n\n    if timeout is None:\n        uf = urllib.request.urlopen(baseurl + 'objects.inv')\n    else:\n        uf = urllib.request.urlopen(baseurl + 'objects.inv', timeout=timeout)\n\n    try:\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 {0} 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    finally:\n        uf.close()\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('Could not find the docs for the object {obj}'.format(obj=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        http://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 .. 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 'Did you mean {0}?'.format(matches)\n\n    return ''\n\n\nclass InheritDocstrings(type):\n    \"\"\"\n    This metaclass makes methods of a class automatically have their\n    docstrings filled in from the methods they override in the base\n    class.\n\n    If the class uses multiple inheritance, the docstring will be\n    chosen from the first class in the bases list, in the same way as\n    methods are normally resolved in Python.  If this results in\n    selecting the wrong docstring, the docstring will need to be\n    explicitly included on the method.\n\n    For example::\n\n        >>> from astropy.utils.misc import InheritDocstrings\n        >>> class A(metaclass=InheritDocstrings):\n        ...     def wiggle(self):\n        ...         \"Wiggle the thingamajig\"\n        ...         pass\n        >>> class B(A):\n        ...     def wiggle(self):\n        ...         pass\n        >>> B.wiggle.__doc__\n        u'Wiggle the thingamajig'\n    \"\"\"\n\n    def __init__(cls, name, bases, dct):\n        def is_public_member(key):\n            return (\n                (key.startswith('__') and key.endswith('__')\n                 and len(key) > 4) or\n                not key.startswith('_'))\n\n        for key, val in dct.items():\n            if (inspect.isfunction(val) and\n                is_public_member(key) and\n                val.__doc__ is None):\n                for base in cls.__mro__[1:]:\n                    super_method = getattr(base, key, None)\n                    if super_method is not None:\n                        val.__doc__ = super_method.__doc__\n                        break\n\n        super().__init__(name, bases, dct)\n\n\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 {0} and {1}; 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\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().__init__(cls_name, bases, 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\nclass ShapedLikeNDArray(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 instance and underlying arrays.\"\"\"\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 {0!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 {0!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 {0!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    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 ``ShapedLikeNDArray``).\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, 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        return self._apply('take', indices, axis=axis, mode=mode)\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 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"},{"className":"_DummyFile","col":0,"comment":"A noop writeable object.","endLoc":64,"id":8198,"nodeType":"Class","startLoc":60,"text":"class _DummyFile:\n    \"\"\"A noop writeable object.\"\"\"\n\n    def write(self, s):\n        pass"},{"col":4,"comment":"null","endLoc":64,"header":"def write(self, s)","id":8199,"name":"write","nodeType":"Function","startLoc":63,"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":158,"id":8200,"nodeType":"Class","startLoc":114,"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":260,"header":"def is_unity(self)","id":8201,"name":"is_unity","nodeType":"Function","startLoc":259,"text":"def is_unity(self):\n        return False"},{"col":4,"comment":"null","endLoc":265,"header":"def __eq__(self, other)","id":8202,"name":"__eq__","nodeType":"Function","startLoc":262,"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":147,"header":"def __init__(self, seed)","id":8203,"name":"__init__","nodeType":"Function","startLoc":146,"text":"def __init__(self, seed):\n        self.seed = seed"},{"col":4,"comment":"null","endLoc":153,"header":"def __enter__(self)","id":8204,"name":"__enter__","nodeType":"Function","startLoc":149,"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":268,"header":"def __ne__(self, other)","id":8205,"name":"__ne__","nodeType":"Function","startLoc":267,"text":"def __ne__(self, other):\n        return not self.__eq__(other)"},{"col":4,"comment":"null","endLoc":158,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":8206,"name":"__exit__","nodeType":"Function","startLoc":155,"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":147,"id":8207,"name":"seed","nodeType":"Attribute","startLoc":147,"text":"self.seed"},{"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":85,"header":"def _add_and_adjust_physical_unit(self, other, sign_self, sign_other)","id":8208,"name":"_add_and_adjust_physical_unit","nodeType":"Function","startLoc":54,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":8209,"name":"startstate","nodeType":"Attribute","startLoc":152,"text":"self.startstate"},{"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":405,"id":8210,"nodeType":"Class","startLoc":363,"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 .. 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":405,"header":"def default(self, obj)","id":8211,"name":"default","nodeType":"Function","startLoc":386,"text":"def default(self, obj):\n        from .. 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":283,"header":"def __mul__(self, other)","id":8212,"name":"__mul__","nodeType":"Function","startLoc":270,"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"},{"col":4,"comment":"null","endLoc":576,"header":"def __iter__(self)","id":8213,"name":"__iter__","nodeType":"Function","startLoc":575,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":586,"header":"def __next__(self)","id":8214,"name":"__next__","nodeType":"Function","startLoc":578,"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"},{"col":4,"comment":"null","endLoc":269,"header":"def __init__(self)","id":8215,"name":"__init__","nodeType":"Function","startLoc":264,"text":"def __init__(self):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }"},{"col":4,"comment":"\n        Update progress bar via the console or notebook accordingly.\n        ","endLoc":602,"header":"def update(self, value=None)","id":8216,"name":"update","nodeType":"Function","startLoc":588,"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":4,"comment":"null","endLoc":286,"header":"def __rmul__(self, other)","id":8217,"name":"__rmul__","nodeType":"Function","startLoc":285,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"col":4,"comment":"null","endLoc":88,"header":"def __neg__(self)","id":8218,"name":"__neg__","nodeType":"Function","startLoc":87,"text":"def __neg__(self):\n        return self._copy(self.physical_unit**(-1))"},{"col":4,"comment":"null","endLoc":93,"header":"def __add__(self, other)","id":8219,"name":"__add__","nodeType":"Function","startLoc":90,"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":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    md5hash : str\n        The hex digest of the MD5 hash for the contents of the ``localfn``\n        file.\n\n    ","endLoc":827,"header":"def compute_hash(localfn)","id":8220,"name":"compute_hash","nodeType":"Function","startLoc":793,"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    md5hash : str\n        The hex digest of the MD5 hash for the contents of the ``localfn``\n        file.\n\n    \"\"\"\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":301,"header":"def __div__(self, other)","id":8221,"name":"__div__","nodeType":"Function","startLoc":288,"text":"def __div__(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":96,"header":"def __radd__(self, other)","id":8222,"name":"__radd__","nodeType":"Function","startLoc":95,"text":"def __radd__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, +1)"},{"col":4,"comment":"null","endLoc":99,"header":"def __sub__(self, other)","id":8223,"name":"__sub__","nodeType":"Function","startLoc":98,"text":"def __sub__(self, other):\n        return self._add_and_adjust_physical_unit(other, +1, -1)"},{"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":675,"header":"def _update_ipython_widget(self, value=None)","id":8224,"name":"_update_ipython_widget","nodeType":"Function","startLoc":647,"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 = ' ({:>6.2%})'.format(frac)"},{"col":4,"comment":"null","endLoc":313,"header":"def __rdiv__(self, other)","id":8225,"name":"__rdiv__","nodeType":"Function","startLoc":303,"text":"def __rdiv__(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":104,"header":"def __rsub__(self, other)","id":8226,"name":"__rsub__","nodeType":"Function","startLoc":101,"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)"},{"col":4,"comment":"null","endLoc":329,"header":"def __pow__(self, power)","id":8227,"name":"__pow__","nodeType":"Function","startLoc":319,"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.\")"},{"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":131,"id":8228,"nodeType":"Class","startLoc":107,"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    def __init__(self, *args, **kwargs):\n        # Ensure we recognize magnitude zero points here.\n        with mag0.enable():\n            super().__init__(*args, **kwargs)\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":123,"header":"def __init__(self, *args, **kwargs)","id":8229,"name":"__init__","nodeType":"Function","startLoc":120,"text":"def __init__(self, *args, **kwargs):\n        # Ensure we recognize magnitude zero points here.\n        with mag0.enable():\n            super().__init__(*args, **kwargs)"},{"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":624,"id":8230,"nodeType":"Class","startLoc":543,"text":"class 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 {0} and {1}; 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":591,"header":"@property\n    @abc.abstractmethod\n    def _class_attribute_(self)","id":8231,"name":"_class_attribute_","nodeType":"Function","startLoc":581,"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":606,"header":"def __init__(self, *args, **kwargs)","id":8232,"name":"__init__","nodeType":"Function","startLoc":600,"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":624,"header":"def __lt__(self, other)","id":8233,"name":"__lt__","nodeType":"Function","startLoc":608,"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 {0} and {1}; 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":579,"id":8234,"name":"_nextid","nodeType":"Attribute","startLoc":579,"text":"_nextid"},{"col":4,"comment":"null","endLoc":332,"header":"def __pos__(self)","id":8235,"name":"__pos__","nodeType":"Function","startLoc":331,"text":"def __pos__(self):\n        return self._copy()"},{"col":4,"comment":"null","endLoc":127,"header":"@property\n    def _default_function_unit(self)","id":8236,"name":"_default_function_unit","nodeType":"Function","startLoc":125,"text":"@property\n    def _default_function_unit(self):\n        return mag"},{"col":4,"comment":"null","endLoc":131,"header":"@property\n    def _quantity_class(self)","id":8237,"name":"_quantity_class","nodeType":"Function","startLoc":129,"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":154,"id":8238,"nodeType":"Class","startLoc":134,"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"},{"col":4,"comment":"null","endLoc":150,"header":"@property\n    def _default_function_unit(self)","id":8239,"name":"_default_function_unit","nodeType":"Function","startLoc":148,"text":"@property\n    def _default_function_unit(self):\n        return dex"},{"col":4,"comment":"null","endLoc":154,"header":"@property\n    def _quantity_class(self)","id":8240,"name":"_quantity_class","nodeType":"Function","startLoc":152,"text":"@property\n    def _quantity_class(self):\n        return Dex"},{"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":177,"id":8241,"nodeType":"Class","startLoc":157,"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":173,"header":"@property\n    def _default_function_unit(self)","id":8242,"name":"_default_function_unit","nodeType":"Function","startLoc":171,"text":"@property\n    def _default_function_unit(self):\n        return dB"},{"col":4,"comment":"null","endLoc":177,"header":"@property\n    def _quantity_class(self)","id":8243,"name":"_quantity_class","nodeType":"Function","startLoc":175,"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 convertible items.\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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":302,"id":8244,"nodeType":"Class","startLoc":180,"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 convertible items.\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 : string, `~astropy.units.UnitBase` or `~astropy.units.function.FunctionUnitBase` instance, 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    # Could add __mul__ and __div__ and try interpreting other as a power,\n    # but this seems just too error-prone.\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":"\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":360,"header":"def to_string(self, format='generic')","id":8245,"name":"to_string","nodeType":"Function","startLoc":334,"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 {0} 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 += '({0})'.format(pu_str)\n        return self_str"},{"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":593,"id":8246,"name":"_name_attribute_","nodeType":"Attribute","startLoc":593,"text":"_name_attribute_"},{"col":4,"comment":"null","endLoc":236,"header":"def __add__(self, other)","id":8247,"name":"__add__","nodeType":"Function","startLoc":229,"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":0,"comment":"\n    Check if a download from ``url_key`` is in the cache.\n\n    Parameters\n    ----------\n    url_key : string\n        The URL retrieved\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download from ``url_key`` is in the cache\n    ","endLoc":1111,"header":"def is_url_in_cache(url_key)","id":8248,"name":"is_url_in_cache","nodeType":"Function","startLoc":1085,"text":"def is_url_in_cache(url_key):\n    \"\"\"\n    Check if a download from ``url_key`` is in the cache.\n\n    Parameters\n    ----------\n    url_key : string\n        The URL retrieved\n\n    Returns\n    -------\n    in_cache : bool\n        `True` if a download from ``url_key`` is in the cache\n    \"\"\"\n    # The code below is modified from astropy.utils.data.download_file()\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\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        return False\n\n    with shelve.open(urlmapfn) as url2hash:\n        if url_key in url2hash:\n            return True\n    return False"},{"attributeType":"null","col":8,"comment":"null","endLoc":604,"id":8249,"name":"__order","nodeType":"Attribute","startLoc":604,"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":823,"id":8250,"nodeType":"Class","startLoc":627,"text":"class 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().__init__(cls_name, bases, members)"},{"col":4,"comment":"null","endLoc":823,"header":"def __init__(cls, cls_name, bases, members)","id":8251,"name":"__init__","nodeType":"Function","startLoc":763,"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().__init__(cls_name, bases, members)"},{"col":0,"comment":"null","endLoc":1115,"header":"def _do_download_files_in_parallel(args)","id":8252,"name":"_do_download_files_in_parallel","nodeType":"Function","startLoc":1114,"text":"def _do_download_files_in_parallel(args):\n    return download_file(*args)"},{"col":0,"comment":"\n    Downloads multiple files in parallel from the given URLs.  Blocks until\n    all files have downloaded.  The result is a list of local file paths\n    corresponding to the given urls.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool, optional\n        Whether to use the cache (default is `True`).\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False`` will\n            print a Warning and set it to ``True`` again, because the function\n            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    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n    ","endLoc":1181,"header":"def download_files_in_parallel(urls, cache=True, show_progress=True,\n                               timeout=None)","id":8253,"name":"download_files_in_parallel","nodeType":"Function","startLoc":1118,"text":"def download_files_in_parallel(urls, cache=True, show_progress=True,\n                               timeout=None):\n    \"\"\"\n    Downloads multiple files in parallel from the given URLs.  Blocks until\n    all files have downloaded.  The result is a list of local file paths\n    corresponding to the given urls.\n\n    Parameters\n    ----------\n    urls : list of str\n        The URLs to retrieve.\n\n    cache : bool, optional\n        Whether to use the cache (default is `True`).\n\n        .. versionchanged:: 3.0\n            The default was changed to ``True`` and setting it to ``False`` will\n            print a Warning and set it to ``True`` again, because the function\n            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    Returns\n    -------\n    paths : list of str\n        The local file paths corresponding to the downloaded URLs.\n    \"\"\"\n    from .console import ProgressBar\n\n    if timeout is None:\n        timeout = conf.remote_timeout\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.\n        warn(\"Disabling the cache does not work because of multiprocessing, it \"\n             \"will be set to ``True``. You may need to manually remove the \"\n             \"cached files afterwards.\", AstropyWarning)\n        cache = True\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        [(x, cache, False, timeout) for x in combined_urls],\n        file=progress,\n        multiprocess=True)\n    paths = []\n    for url in urls:\n        paths.append(combined_paths[combined_urls.index(url)])\n    return paths"},{"col":4,"comment":"Return string representation for unit.","endLoc":368,"header":"def __str__(self)","id":8254,"name":"__str__","nodeType":"Function","startLoc":362,"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 += '({0})'.format(pu_str)\n        return self_str"},{"col":4,"comment":"\n        Update the progress bar to the given value (out of the total\n        given to the constructor).\n        ","endLoc":645,"header":"def _update_console(self, value=None)","id":8255,"name":"_update_console","nodeType":"Function","startLoc":604,"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(' {0:>4s}/{1:>4s}'.format(\n            human_file_size(value),\n            self._human_total))\n        write(' ({:>6.2%})'.format(frac))\n        write(prefix)\n        if t is not None:\n            write(human_time(t))\n        self._file.flush()"},{"col":4,"comment":"null","endLoc":380,"header":"def __repr__(self)","id":8256,"name":"__repr__","nodeType":"Function","startLoc":370,"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 'Unit(\"{0}\")'.format(self.to_string())\n\n        else:\n            return '{0}(\"{1}\"{2})'.format(\n                self.__class__.__name__, self.physical_unit,\n                \"\" if self.function_unit is self._default_function_unit\n                else ', unit=\"{0}\"'.format(self.function_unit))"},{"col":4,"comment":"null","endLoc":239,"header":"def __radd__(self, other)","id":8257,"name":"__radd__","nodeType":"Function","startLoc":238,"text":"def __radd__(self, other):\n        return self.__add__(other)"},{"col":0,"comment":"null","endLoc":1198,"header":"@atexit.register\ndef _deltemps()","id":8258,"name":"_deltemps","nodeType":"Function","startLoc":1189,"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                os.remove(fn)"},{"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":391,"header":"def _repr_latex_(self)","id":8259,"name":"_repr_latex_","nodeType":"Function","startLoc":382,"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":0,"comment":" Clears the data file cache by deleting the local file(s).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, either specifies a\n        hash for the cached file that is supposed to be deleted, or a URL that\n        should be removed from the cache if present.\n    ","endLoc":1255,"header":"def clear_download_cache(hashorurl=None)","id":8260,"name":"clear_download_cache","nodeType":"Function","startLoc":1201,"text":"def clear_download_cache(hashorurl=None):\n    \"\"\" Clears the data file cache by deleting the local file(s).\n\n    Parameters\n    ----------\n    hashorurl : str or None\n        If None, the whole cache is cleared.  Otherwise, either specifies a\n        hash for the cached file that is supposed to be deleted, or a URL that\n        should be removed from the cache if present.\n    \"\"\"\n\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\n    except OSError as e:\n        msg = 'Not clearing data cache - cache inacessable due to '\n        estr = '' if len(e.args) < 1 else (': ' + str(e))\n        warn(CacheMissingWarning(msg + e.__class__.__name__ + estr))\n        return\n\n    _acquire_download_cache_lock()\n    try:\n        if hashorurl is None:\n            # dldir includes both the download files and the urlmapfn.  This structure\n            # is required since we cannot know a priori the actual file name corresponding\n            # to the shelve map named urlmapfn.\n            if os.path.exists(dldir):\n                shutil.rmtree(dldir)\n        else:\n            with shelve.open(urlmapfn) as url2hash:\n                filepath = os.path.join(dldir, hashorurl)\n                if not _is_inside(filepath, dldir):\n                    raise RuntimeError(\"attempted to use clear_download_cache on\"\n                                       \" a path outside the data cache directory\")\n\n                hash_key = hashorurl\n\n                if os.path.exists(filepath):\n                    for k, v in url2hash.items():\n                        if v == filepath:\n                            del url2hash[k]\n                    os.unlink(filepath)\n                elif hash_key in url2hash:\n                    filepath = url2hash[hash_key]\n                    del url2hash[hash_key]\n                    if os.path.exists(filepath):\n                        # Make sure the filepath still actually exists (perhaps user removed it)\n                        os.unlink(filepath)\n                # Otherwise could not find file or url, but no worries.\n                # Clearing download cache just makes sure that the file or url\n                # is no longer in the cache regardless of starting condition.\n\n    finally:\n        # the lock will be gone if rmtree was used above, but release otherwise\n        if os.path.exists(os.path.join(dldir, 'lock')):\n            _release_download_cache_lock()"},{"col":4,"comment":"null","endLoc":247,"header":"def __iadd__(self, other)","id":8261,"name":"__iadd__","nodeType":"Function","startLoc":241,"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":4,"comment":"null","endLoc":394,"header":"def __hash__(self)","id":8262,"name":"__hash__","nodeType":"Function","startLoc":393,"text":"def __hash__(self):\n        return hash((self.function_unit, self.physical_unit))"},{"attributeType":"null","col":4,"comment":"null","endLoc":91,"id":8263,"name":"__array_priority__","nodeType":"Attribute","startLoc":91,"text":"__array_priority__"},{"attributeType":"function","col":4,"comment":"null","endLoc":315,"id":8264,"name":"__truediv__","nodeType":"Attribute","startLoc":315,"text":"__truediv__"},{"attributeType":"null","col":4,"comment":"null","endLoc":761,"id":8265,"name":"_inherit_descriptors_","nodeType":"Attribute","startLoc":761,"text":"_inherit_descriptors_"},{"attributeType":"function","col":4,"comment":"null","endLoc":317,"id":8266,"name":"__rtruediv__","nodeType":"Attribute","startLoc":317,"text":"__rtruediv__"},{"attributeType":"null","col":16,"comment":"null","endLoc":111,"id":8267,"name":"_function_unit","nodeType":"Attribute","startLoc":111,"text":"self._function_unit"},{"attributeType":"null","col":12,"comment":"null","endLoc":97,"id":8268,"name":"_physical_unit","nodeType":"Attribute","startLoc":97,"text":"self._physical_unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":8269,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":8270,"name":"SUPPORTED_UFUNCS","nodeType":"Attribute","startLoc":14,"text":"SUPPORTED_UFUNCS"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":8271,"name":"SUPPORTED_FUNCTIONS","nodeType":"Attribute","startLoc":24,"text":"SUPPORTED_FUNCTIONS"},{"col":4,"comment":"null","endLoc":254,"header":"def __sub__(self, other)","id":8272,"name":"__sub__","nodeType":"Function","startLoc":249,"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":0,"comment":"","endLoc":3,"header":"core.py#<anonymous>","id":8273,"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', 'power',\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":"IncompatibleShapeError","col":0,"comment":"null","endLoc":1059,"id":8274,"nodeType":"Class","startLoc":1057,"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)"},{"col":0,"comment":"A context manager that silences sys.stdout and sys.stderr.","endLoc":77,"header":"@contextlib.contextmanager\ndef silence()","id":8275,"name":"silence","nodeType":"Function","startLoc":67,"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":"null","endLoc":264,"header":"def __rsub__(self, other)","id":8276,"name":"__rsub__","nodeType":"Function","startLoc":256,"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":4,"comment":"\n        Returns True if the given filepath has the hidden attribute on\n        MS-Windows.  Based on a post here:\n        http://stackoverflow.com/questions/284115/cross-platform-hidden-file-detection\n        ","endLoc":313,"header":"def _has_hidden_attribute(filepath)","id":8277,"name":"_has_hidden_attribute","nodeType":"Function","startLoc":300,"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        http://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":"\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\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 and keyword-only argument\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        ","endLoc":479,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, rcond=None)","id":8278,"name":"__call__","nodeType":"Function","startLoc":309,"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\n            input coordinates\n        z : array (optional)\n            input coordinates\n        weights : array (optional)\n            weights\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 and keyword-only argument\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        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        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\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        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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices,\n                                                   x=x)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x)\n            else:\n                lhs = 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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices, x=x, y=y)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                    fixparam_indices, x=x, y=y)\n            else:\n                lhs = 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                if z.ndim > 2:\n                    # Basically this code here is making the assumption that if\n                    # z has 3 dimensions it represents multiple models where\n                    # the value of z is one plane per model.  It's then\n                    # flattening each plane and transposing so that the model\n                    # axis is *last*.  That's fine, but this could be\n                    # generalized for other dimensionalities of z.\n                    # TODO: See above comment\n                    rhs = np.array([i.flatten() for i in z]).T\n                else:\n                    rhs = z.T\n            else:\n                rhs = z.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        # 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 co-ordinates, 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            weights = np.asarray(weights, dtype=float)\n            if len(x) != len(weights):\n                raise ValueError(\"x and weights should have the same length\")\n            if rhs.ndim == 2:\n                lhs *= weights[:, np.newaxis]\n                # Don't modify in-place in case rhs was the original dependent\n                # variable array\n                rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        if rcond is None:\n            rcond = len(x) * np.finfo(x.dtype).eps\n\n        scl = (lhs * lhs).sum(0)\n        lacoef, resids, rank, sval = np.linalg.lstsq(lhs / scl, rhs, rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef = (lacoef.T / scl).T\n        self.fit_info['params'] = lacoef\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 rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        _fitter_to_model_params(model_copy, lacoef.flatten())\n        return model_copy"},{"fileName":"__init__.py","filePath":"astropy/utils","id":8279,"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. This subpackage also includes the\n`astropy.utils.compat` package, which houses utilities that provide\ncompatibility and bugfixes across all versions of Python that Astropy supports.\n\"\"\"\n\n\nfrom .codegen import *\nfrom .decorators import *\nfrom .introspection import *\nfrom .misc import *\n"},{"col":0,"comment":"","endLoc":10,"header":"__init__.py#<anonymous>","id":8280,"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. This subpackage also includes the\n`astropy.utils.compat` package, which houses utilities that provide\ncompatibility and bugfixes across all versions of Python that Astropy supports.\n\"\"\""},{"fileName":"introspection.py","filePath":"astropy/utils","id":8281,"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\n\nimport inspect\nimport re\nimport types\nimport importlib\n\n__all__ = ['resolve_name', 'minversion', 'find_current_module',\n           'isinstancemethod']\n\n\n__doctest_skip__ = ['find_current_module']\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__(str('.'.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\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    By default this uses `pkg_resources.parse_version` to do the version\n    comparison if available.  Otherwise it falls back on\n    `distutils.version.LooseVersion`.\n\n    Parameters\n    ----------\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    version_path : `str`\n        A dotted attribute path to follow in the module for the version.\n        Defaults to just ``'__version__'``, which should work for most Python\n        modules.\n\n    Examples\n    --------\n\n    >>> import astropy\n    >>> minversion(astropy, '0.4.4')\n    True\n    \"\"\"\n\n    if isinstance(module, types.ModuleType):\n        module_name = module.__name__\n    elif isinstance(module, str):\n        module_name = module\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                         'got {0!r}'.format(module))\n\n    if '.' not in version_path:\n        have_version = getattr(module, version_path)\n    else:\n        have_version = resolve_name(module.__name__, version_path)\n\n    try:\n        from pkg_resources import parse_version\n    except ImportError:\n        from distutils.version import LooseVersion as parse_version\n        # LooseVersion raises a TypeError when strings like dev, rc1 are part\n        # of the version number. Match the dotted numbers only. Regex taken\n        # from PEP440, https://www.python.org/dev/peps/pep-0440/, Appendix B\n        expr = '^([1-9]\\\\d*!)?(0|[1-9]\\\\d*)(\\\\.(0|[1-9]\\\\d*))*'\n        m = re.match(expr, version)\n        if m:\n            version = m.group(0)\n\n    if inclusive:\n        return parse_version(have_version) >= parse_version(version)\n    else:\n        return parse_version(have_version) > parse_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 = inspect.getmodule(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 = inspect.getmodule(frmb)\n            if modb not in diffmods:\n                return modb\n            frm = frmb\n    else:\n        return inspect.getmodule(frm)\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":337,"header":"def find_mod_objs(modname, onlylocals=False)","id":8282,"name":"find_mod_objs","nodeType":"Function","startLoc":274,"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":4,"comment":"null","endLoc":316,"header":"def _has_hidden_attribute(filepath)","id":8283,"name":"_has_hidden_attribute","nodeType":"Function","startLoc":315,"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":338,"header":"def is_path_hidden(filepath)","id":8284,"name":"is_path_hidden","nodeType":"Function","startLoc":319,"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    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    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n    ","endLoc":1358,"header":"def get_cached_urls()","id":8285,"name":"get_cached_urls","nodeType":"Function","startLoc":1338,"text":"def get_cached_urls():\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    Returns\n    -------\n    cached_urls : list\n        List of cached URLs.\n    \"\"\"\n    # The code below is modified from astropy.utils.data.download_file()\n    try:\n        dldir, urlmapfn = _get_download_cache_locs()\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        return False\n\n    with shelve.open(urlmapfn) as url2hash:\n        return list(url2hash.keys())"},{"col":4,"comment":"null","endLoc":272,"header":"def __isub__(self, other)","id":8286,"name":"__isub__","nodeType":"Function","startLoc":266,"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":"\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":360,"header":"def walk_skip_hidden(top, onerror=None, followlinks=False)","id":8287,"name":"walk_skip_hidden","nodeType":"Function","startLoc":341,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":8288,"name":"__all__","nodeType":"Attribute","startLoc":32,"text":"__all__"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":73,"id":8289,"name":"conf","nodeType":"Attribute","startLoc":73,"text":"conf"},{"col":4,"comment":"null","endLoc":282,"header":"def var(self, axis=None, dtype=None, out=None, ddof=0)","id":8290,"name":"var","nodeType":"Function","startLoc":280,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":1186,"id":8291,"name":"_tempfilestodel","nodeType":"Attribute","startLoc":1186,"text":"_tempfilestodel"},{"col":0,"comment":"","endLoc":5,"header":"data.py#<anonymous>","id":8292,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\" This module contains helper functions for accessing, downloading, and\ncaching data files.\n\"\"\"\n\n__all__ = [\n    'Conf', 'conf', 'get_readable_fileobj', 'get_file_contents',\n    'get_pkg_data_fileobj', 'get_pkg_data_filename',\n    'get_pkg_data_contents', 'get_pkg_data_fileobjs',\n    'get_pkg_data_filenames', 'compute_hash', 'clear_download_cache',\n    'CacheMissingWarning', 'get_free_space_in_dir',\n    'check_free_space_in_dir', 'download_file',\n    'download_files_in_parallel', 'is_url_in_cache', 'get_cached_urls']\n\nconf = Conf()\n\n_tempfilestodel = []"},{"fileName":"argparse.py","filePath":"astropy/utils","id":8293,"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            \"{0} 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            \"{0} exists but is not readable with its current \"\n            \"permissions\".format(arg))\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            \"{0} exists but is not writeable with its current \"\n            \"permissions\".format(arg))\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    a directory that exists and is readable (and returns the absolute path).\n    ","endLoc":38,"header":"def readable_directory(arg)","id":8294,"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            \"{0} exists but is not readable with its current \"\n            \"permissions\".format(arg))\n\n    return arg"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":8295,"name":"__all__","nodeType":"Attribute","startLoc":31,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":826,"id":8296,"name":"LOCALE_LOCK","nodeType":"Attribute","startLoc":826,"text":"LOCALE_LOCK"},{"col":0,"comment":"","endLoc":1,"header":"argparse.py#<anonymous>","id":8297,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Utilities and extensions for use with `argparse`.\"\"\""},{"col":0,"comment":"","endLoc":6,"header":"misc.py#<anonymous>","id":8298,"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', 'InheritDocstrings',\n           'OrderedDescriptor', 'OrderedDescriptorContainer', 'set_locale',\n           'ShapedLikeNDArray', 'check_broadcast', 'IncompatibleShapeError',\n           'dtype_bytes_or_chars']\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        http://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\nLOCALE_LOCK = threading.Lock()"},{"fileName":"metadata.py","filePath":"astropy/utils","id":8299,"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 ..utils import wraps\n\nimport warnings\n\nimport collections\nfrom collections import OrderedDict\nfrom copy import deepcopy\n\nimport numpy as np\nfrom ..utils.exceptions import AstropyWarning\nfrom ..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\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 objects\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('Arrays have incompatible types {0}'\n                                 .format(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] = [(u'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 : one or more `~astropy.utils.metadata.MergeStrategy` args\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 = ('Cannot merge meta key {0!r} '\n           'types {1!r} and {2!r}'\n           .format(key, type(left), type(right)))\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.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, collections.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"},{"id":8300,"name":"astropy/utils/src","nodeType":"Package"},{"id":8301,"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":8302,"name":"astropy/utils/xml","nodeType":"Package"},{"fileName":"iterparser.py","filePath":"astropy/utils/xml","id":8303,"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 .. 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    fd : readable file-like object or read function\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 : readable file-like object, read function or str path\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 : readable file-like object, read function or str path\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"},{"className":"MergeConflictError","col":0,"comment":"null","endLoc":25,"id":8304,"nodeType":"Class","startLoc":24,"text":"class MergeConflictError(TypeError):\n    pass"},{"className":"MergeConflictWarning","col":0,"comment":"null","endLoc":29,"id":8305,"nodeType":"Class","startLoc":28,"text":"class MergeConflictWarning(AstropyWarning):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8306,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"function","col":0,"comment":"null","endLoc":115,"id":8307,"name":"_slow_iterparse","nodeType":"Attribute","startLoc":115,"text":"_slow_iterparse"},{"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":383,"header":"def isinstancemethod(cls, obj)","id":8308,"name":"isinstancemethod","nodeType":"Function","startLoc":342,"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":4,"comment":"null","endLoc":286,"header":"def std(self, axis=None, dtype=None, out=None, ddof=0)","id":8309,"name":"std","nodeType":"Function","startLoc":284,"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))"},{"className":"MergeStrategyMeta","col":0,"comment":"\n    Metaclass that registers MergeStrategy subclasses into the\n    MERGE_STRATEGIES registry.\n    ","endLoc":110,"id":8310,"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":8311,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":118,"id":8312,"name":"_fast_iterparse","nodeType":"Attribute","startLoc":118,"text":"_fast_iterparse"},{"col":0,"comment":"null","endLoc":401,"header":"def _isinstancemethod(cls, obj)","id":8313,"name":"_isinstancemethod","nodeType":"Function","startLoc":386,"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":"\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":436,"header":"def human_time(seconds)","id":8314,"name":"human_time","nodeType":"Function","startLoc":390,"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 '   {0:2d}s'.format(seconds)\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 '{0:2d}{1}{2:2d}{3}'.format(\n                seconds // limit1, unit1,\n                (seconds % limit1) // limit2, unit2)\n    return '  ~inf'"},{"col":0,"comment":"","endLoc":4,"header":"iterparser.py#<anonymous>","id":8315,"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":8316,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom distutils.core import Extension\nfrom os.path import join\nimport sys\n\nfrom astropy_helpers import setup_helpers\n\n\ndef get_external_libraries():\n    return ['expat']\n\n\ndef get_extensions(build_type='release'):\n    XML_DIR = 'astropy/utils/xml/src'\n\n    cfg = setup_helpers.DistutilsExtensionArgs({\n        'sources': [join(XML_DIR, \"iterparse.c\")]\n        })\n\n    if setup_helpers.use_system_library('expat'):\n        cfg.update(setup_helpers.pkg_config(['expat'], ['expat']))\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                '-Wl,--version-script={0}'.format(\n                    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"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8317,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8318,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":15,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":3,"header":"introspection.py#<anonymous>","id":8319,"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']"},{"attributeType":"null","col":8,"comment":"null","endLoc":545,"id":8320,"name":"_human_total","nodeType":"Attribute","startLoc":545,"text":"self._human_total"},{"fileName":"check.py","filePath":"astropy/utils/xml","id":8321,"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 = '[^()<>@,;:\\\\\\\"/[\\\\]?= {}\\x7f]+'.format(ctrls)\n    return re.match(\n        r'(?P<type>{})/(?P<subtype>{})$'.format(token_regex, 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":8322,"name":"_token_regex","nodeType":"Attribute","startLoc":37,"text":"_token_regex"},{"col":0,"comment":"","endLoc":5,"header":"check.py#<anonymous>","id":8323,"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 ])\""},{"fileName":"validate.py","filePath":"astropy/utils/xml","id":8324,"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        \"xmllint --noout --nonet {} {}\".format(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 ..misc import signal_number_to_name\n        raise OSError(\n            \"xmllint was terminated by signal '{0}'\".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":8325,"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\"\"\""},{"attributeType":"function","col":12,"comment":"null","endLoc":527,"id":8326,"name":"update","nodeType":"Attribute","startLoc":527,"text":"self.update"},{"attributeType":"null","col":12,"comment":"null","endLoc":550,"id":8327,"name":"_should_handle_resize","nodeType":"Attribute","startLoc":550,"text":"self._should_handle_resize"},{"fileName":"__init__.py","filePath":"astropy/utils/xml","id":8328,"nodeType":"File","text":""},{"col":0,"comment":"null","endLoc":11,"header":"def get_external_libraries()","id":8329,"name":"get_external_libraries","nodeType":"Function","startLoc":10,"text":"def get_external_libraries():\n    return ['expat']"},{"col":0,"comment":"null","endLoc":45,"header":"def get_extensions(build_type='release')","id":8330,"name":"get_extensions","nodeType":"Function","startLoc":14,"text":"def get_extensions(build_type='release'):\n    XML_DIR = 'astropy/utils/xml/src'\n\n    cfg = setup_helpers.DistutilsExtensionArgs({\n        'sources': [join(XML_DIR, \"iterparse.c\")]\n        })\n\n    if setup_helpers.use_system_library('expat'):\n        cfg.update(setup_helpers.pkg_config(['expat'], ['expat']))\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                '-Wl,--version-script={0}'.format(\n                    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)]"},{"fileName":"writer.py","filePath":"astropy/utils/xml","id":8331,"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    import bleach\n    HAS_BLEACH = True\nexcept ImportError:\n    HAS_BLEACH = False\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 object.\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(\"<{}\".format(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(\" {}=\\\"{}\\\"\".format(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        `http://bleach.readthedocs.io/en/latest/clean.html <bleach>`_ 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=\"http://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            if HAS_BLEACH:\n                if clean_kwargs is None:\n                    clean_kwargs = {}\n                self.xml_escape_cdata = lambda x: bleach.clean(x, **clean_kwargs)\n            else:\n                raise ValueError('bleach package is required when HTML escaping is disabled.\\n'\n                                 'Use \"pip install bleach\".')\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(\"<!-- {} -->\\n\".format(self.xml_escape_cdata(comment)))\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(\"unbalanced end({})\".format(tag))\n            if tag != self._tags[-1]:\n                raise ValueError(\"expected end({}), got {}\".format(\n                        self._tags[-1], 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(\"</{}>\\n\".format(tag))\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":13,"id":8332,"name":"HAS_BLEACH","nodeType":"Attribute","startLoc":13,"text":"HAS_BLEACH"},{"col":0,"comment":"","endLoc":5,"header":"writer.py#<anonymous>","id":8333,"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    import bleach\n    HAS_BLEACH = True\nexcept ImportError:\n    HAS_BLEACH = False\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":543,"id":8334,"name":"_file","nodeType":"Attribute","startLoc":543,"text":"self._file"},{"attributeType":"null","col":12,"comment":"null","endLoc":530,"id":8335,"name":"_silent","nodeType":"Attribute","startLoc":530,"text":"self._silent"},{"attributeType":"null","col":8,"comment":"null","endLoc":544,"id":8336,"name":"_start_time","nodeType":"Attribute","startLoc":544,"text":"self._start_time"},{"fileName":"unescaper.py","filePath":"astropy/utils/xml","id":8337,"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"},{"id":8338,"name":"astropy/utils/xml/src","nodeType":"Package"},{"id":8339,"name":".gitignore","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"!*.c\n"},{"id":8340,"name":"expat_config.h","nodeType":"TextFile","path":"astropy/utils/xml/src","text":"/* expat_config.h.  Generated by configure.  */\n/* expat_config.h.in.  Generated from configure.in by autoheader.  */\n\n/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\n/* #define BYTEORDER 1234 */\n\n/* Define to 1 if you have the `bcopy' function. */\n#define HAVE_BCOPY 1\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 <inttypes.h> header file. */\n#define HAVE_INTTYPES_H 1\n\n/* Define to 1 if you have the `memmove' function. */\n#define HAVE_MEMMOVE 1\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 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 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.0.1\"\n\n/* Define to the one symbol short name of this package. */\n#define PACKAGE_TARNAME \"expat\"\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"2.0.1\"\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* whether byteorder is bigendian */\n/* #undef WORDS_BIGENDIAN */\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 make parameter entity parsing functionality available. */\n#define XML_DTD 0\n\n/* Define to make XML Namespaces functionality available. */\n#define XML_NS 0\n\n/* Define to __FUNCTION__ or \"\" if `__func__' does not conform to ANSI C. */\n/* #undef __func__ */\n\n/* Define to empty if `const' does not conform to ANSI C. */\n/* #undef const */\n\n/* Define to `long' if <sys/types.h> does not define. */\n/* #undef off_t */\n\n/* Define to `unsigned' if <sys/types.h> does not define. */\n/* #undef size_t */\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":8341,"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"},{"id":8342,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":555,"id":8343,"name":"_signal_set","nodeType":"Attribute","startLoc":555,"text":"self._signal_set"},{"attributeType":"null","col":8,"comment":"null","endLoc":546,"id":8344,"name":"_ipython_widget","nodeType":"Attribute","startLoc":546,"text":"self._ipython_widget"},{"attributeType":"null","col":16,"comment":"null","endLoc":662,"id":8345,"name":"_widget","nodeType":"Attribute","startLoc":662,"text":"self._widget"},{"col":0,"comment":"Make sure model constraints are supported by the current fitter.","endLoc":1197,"header":"def _validate_constraints(supported_constraints, model)","id":8346,"name":"_validate_constraints","nodeType":"Function","startLoc":1174,"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'))"},{"id":8347,"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 occuring 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 <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-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;\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    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                if (*(*(att_ptr + 1)) != 0) {\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    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, (ssize_t)(1 << 10), (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/*\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    int count = 0;\n    Py_UNICODE* uinput = NULL;\n    char* input = NULL;\n    Py_ssize_t input_len;\n    Py_UNICODE* uoutput = NULL;\n    char* output = NULL;\n    Py_UNICODE* up = NULL;\n    char* p = NULL;\n    Py_ssize_t i;\n    const char** esc;\n    const char* ent;\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        uinput = PyUnicode_AsUnicode(input_coerce);\n        if (uinput == NULL) {\n            Py_DECREF(input_coerce);\n            return NULL;\n        }\n\n        input_len = PyUnicode_GetSize(input_coerce);\n\n        for (i = 0; i < input_len; ++i) {\n            for (esc = escapes; ; esc += 2) {\n                if (uinput[i] > (Py_UNICODE)**esc) {\n                    break;\n                } else if (uinput[i] == (Py_UNICODE)**esc) {\n                    ++count;\n                    break;\n                }\n            }\n        }\n\n        if (count) {\n            uoutput = malloc((input_len + 1 + count * 5) * sizeof(Py_UNICODE));\n            if (uoutput == NULL) {\n                Py_DECREF(input_coerce);\n                PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n                return NULL;\n            }\n\n            up = uoutput;\n            for (i = 0; i < input_len; ++i) {\n                for (esc = escapes; ; esc += 2) {\n                    if (uinput[i] > (Py_UNICODE)**esc) {\n                        *(up++) = uinput[i];\n                        break;\n                    } else if (uinput[i] == (Py_UNICODE)**esc) {\n                        for (ent = *(esc + 1); *ent != '\\0'; ++ent) {\n                            *(up++) = (Py_UNICODE)*ent;\n                        }\n                        break;\n                    }\n                }\n            }\n\n            *up = 0;\n\n            Py_DECREF(input_coerce);\n            output_obj = PyUnicode_FromUnicode(uoutput, up - uoutput);\n            free(uoutput);\n            return output_obj;\n        } else {\n            return input_coerce;\n        }\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        for (i = 0; i < input_len; ++i) {\n            for (esc = escapes; ; esc += 2) {\n                if (input[i] > **esc) {\n                    break;\n                } else if (input[i] == **esc) {\n                    ++count;\n                    break;\n                }\n            }\n        }\n\n        if (count) {\n            output = malloc((input_len + 1 + count * 5) * sizeof(char));\n            if (output == NULL) {\n                Py_DECREF(input_coerce);\n                PyErr_SetString(PyExc_MemoryError, \"Out of memory\");\n                return NULL;\n            }\n\n            p = output;\n            for (i = 0; i < input_len; ++i) {\n                for (esc = escapes; ; esc += 2) {\n                    if (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\n            Py_DECREF(input_coerce);\n            output_obj = PyBytes_FromStringAndSize(output, p - output);\n            free(output);\n            return output_obj;\n        } else {\n            return input_coerce;\n        }\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"},{"col":0,"comment":"null","endLoc":58,"header":"def _unescape_bytes(url)","id":8348,"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":16,"comment":"null","endLoc":537,"id":8349,"name":"_total","nodeType":"Attribute","startLoc":537,"text":"self._total"},{"attributeType":"null","col":16,"comment":"null","endLoc":541,"id":8350,"name":"_items","nodeType":"Attribute","startLoc":541,"text":"self._items"},{"attributeType":"null","col":8,"comment":"null","endLoc":561,"id":8351,"name":"_bar_length","nodeType":"Attribute","startLoc":561,"text":"self._bar_length"},{"attributeType":"null","col":8,"comment":"null","endLoc":596,"id":8352,"name":"_current_value","nodeType":"Attribute","startLoc":596,"text":"self._current_value"},{"id":8353,"name":"astropy/utils/xml/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/xml/tests","id":8354,"nodeType":"File","text":""},{"col":0,"comment":"null","endLoc":51,"header":"def _unescape_str(url)","id":8355,"name":"_unescape_str","nodeType":"Function","startLoc":50,"text":"def _unescape_str(url):\n    return saxutils.unescape(url, _str_entities)"},{"attributeType":"null","col":12,"comment":"null","endLoc":91,"id":8356,"name":"orig_merge","nodeType":"Attribute","startLoc":91,"text":"orig_merge"},{"attributeType":"null","col":16,"comment":"null","endLoc":106,"id":8357,"name":"types","nodeType":"Attribute","startLoc":106,"text":"types"},{"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.next()\n    ","endLoc":866,"id":8358,"nodeType":"Class","startLoc":753,"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.next()\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 : writeable file-like object, 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    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        if self._silent:\n            return self._silent_iterator()\n        else:\n            return self._iterator()\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 _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":839,"header":"def _iterator(self)","id":8359,"name":"_iterator","nodeType":"Function","startLoc":810,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":100,"id":8360,"name":"merge","nodeType":"Attribute","startLoc":100,"text":"cls.merge"},{"id":8361,"name":"astropy/utils/iers","nodeType":"Package"},{"fileName":"iers.py","filePath":"astropy/utils/iers","id":8362,"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\nfrom warnings import warn\n\ntry:\n    from urlparse import urlparse\nexcept ImportError:\n    from urllib.parse import urlparse\n\nimport numpy as np\n\nfrom ... import config as _config\nfrom ... import units as u\nfrom ...table import Table, QTable\nfrom ...utils.data import get_pkg_data_filename, clear_download_cache\nfrom ... import utils\nfrom ...utils.exceptions import AstropyWarning\n\n__all__ = ['Conf', 'conf',\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_README',\n           'IERS_B_FILE', 'IERS_B_URL', 'IERS_B_README',\n           'IERSRangeError', 'IERSStaleWarning']\n\n# IERS-A default file name, URL, and ReadMe with content description\nIERS_A_FILE = 'finals2000A.all'\nIERS_A_URL = 'http://maia.usno.navy.mil/ser7/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# 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 {} 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\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    with utils.data.conf.set_temp('remote_timeout', conf.remote_timeout):\n        return utils.data.download_file(*args, **kwargs)\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. Default is True.')\n    auto_max_age = _config.ConfigItem(\n        30.0,\n        'Maximum age (days) of predictive data before auto-downloading. Default is 30.')\n    iers_auto_url = _config.ConfigItem(\n        IERS_A_URL,\n        'URL for auto-downloading IERS file data.')\n    remote_timeout = _config.ConfigItem(\n        10.0,\n        'Remote timeout downloading IERS file data (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\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        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            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 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        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        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, float array, or 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, float array, or 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 : Quantity with angle units\n            x component of CIP correction for the requested times\n        D_y : Quantity with angle units\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, float array, or 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 : Quantity with angle units\n            x component of polar motion for the requested times\n        PM_y : Quantity with angle units\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\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            # http://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        from astropy.time import Time\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()\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 http://maia.usno.navy.mil/\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL``.  See ``iers.__doc__`` for instructions on how to use\n    it 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[~iers_a['UT1_UTC_A'].mask &\n                       ~iers_a['PolPMFlag_A'].mask]\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        # Run np.where on the data from the table columns, since in numpy 1.9\n        # it otherwise returns an only partially initialized column.\n        table['UT1_UTC'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1_UTC_A'].data,\n                                    table['UT1_UTC_B'].data)\n        # Ensure the unit is correct, for later column conversion to Quantity.\n        table['UT1_UTC'].unit = table['UT1_UTC_A'].unit\n        table['UT1Flag'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1Flag_A'].data,\n                                    'B')\n        # Repeat for polar motions.\n        table['PM_x'] = np.where(table['PM_X_B'].mask,\n                                 table['PM_x_A'].data,\n                                 table['PM_X_B'].data)\n        table['PM_x'].unit = table['PM_x_A'].unit\n        table['PM_y'] = np.where(table['PM_Y_B'].mask,\n                                 table['PM_y_A'].data,\n                                 table['PM_Y_B'].data)\n        table['PM_y'].unit = table['PM_y_A'].unit\n        table['PolPMFlag'] = np.where(table['PM_X_B'].mask,\n                                      table['PolPMFlag_A'].data,\n                                      'B')\n\n        table['dX_2000A'] = np.where(table['dX_2000A_B'].mask,\n                                     table['dX_2000A_A'].data,\n                                     table['dX_2000A_B'].data)\n        table['dX_2000A'].unit = table['dX_2000A_A'].unit\n\n        table['dY_2000A'] = np.where(table['dY_2000A_B'].mask,\n                                     table['dY_2000A_A'].data,\n                                     table['dY_2000A_B'].data)\n        table['dY_2000A'].unit = table['dY_2000A_A'].unit\n\n        table['NutFlag'] = np.where(table['dX_2000A_B'].mask,\n                                    table['NutFlag_A'].data,\n                                    '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        is_predictive = (table['UT1Flag_A'] == 'P') | (table['PolPMFlag_A'] == 'P')\n        table.meta['predictive_index'] = np.min(np.flatnonzero(is_predictive))\n        table.meta['predictive_mjd'] = table['MJD'][table.meta['predictive_index']]\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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_a = Table.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        # Fill any masked values, and convert to a QTable.\n        return cls(table.filled())\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 http://www.iers.org/\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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_b = Table.read(file, format='cds', readme=readme,\n                            data_start=data_start)\n        return cls(iers_b.filled())\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 with IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS.open()\n            return cls.iers_table\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') == conf.iers_auto_url:\n                return cls.iers_table\n\n        try:\n            filename = download_file(conf.iers_auto_url, 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('failed to download {}, using local IERS-B: {}'\n                                .format(conf.iers_auto_url, str(err))))\n            cls.iers_table = IERS.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = str(conf.iers_auto_url)\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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR)\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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\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            # Get the latest version\n            try:\n                clear_download_cache(conf.iers_auto_url)\n                filename = download_file(conf.iers_auto_url, 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('failed to download {}: {}.\\nA 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                                    .format(conf.iers_auto_url, str(err))))\n                return\n\n            new_table = self.__class__.read(file=filename)\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'][~table['UT1_UTC_B'].mask]\n        i0 = np.searchsorted(iers_b['MJD'].value, mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'].value, 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 np.allclose(table['MJD'][:n_iers_b], iers_b['MJD'].value):\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'].value\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x'].value\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y'].value\n\n        return table\n\n\n# by default for IERS class, read IERS-B table\nIERS.read = IERS_B.read\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":8363,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8364,"name":"_bytes_entities","nodeType":"Attribute","startLoc":11,"text":"_bytes_entities"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":8365,"name":"cls","nodeType":"Attribute","startLoc":86,"text":"cls"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8366,"name":"_bytes_keys","nodeType":"Attribute","startLoc":13,"text":"_bytes_keys"},{"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":8367,"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), ...]"},{"col":4,"comment":"null","endLoc":290,"header":"def ptp(self, axis=None, out=None)","id":8368,"name":"ptp","nodeType":"Function","startLoc":288,"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))"},{"attributeType":"null","col":4,"comment":"null","endLoc":166,"id":8369,"name":"enabled","nodeType":"Attribute","startLoc":166,"text":"enabled"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":8370,"name":"_str_entities","nodeType":"Attribute","startLoc":16,"text":"_str_entities"},{"className":"IERSStaleWarning","col":0,"comment":"null","endLoc":82,"id":8371,"nodeType":"Class","startLoc":81,"text":"class IERSStaleWarning(AstropyWarning):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":8372,"name":"_str_keys","nodeType":"Attribute","startLoc":17,"text":"_str_keys"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.utils.iers`.\n    ","endLoc":101,"id":8373,"nodeType":"Class","startLoc":85,"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. Default is True.')\n    auto_max_age = _config.ConfigItem(\n        30.0,\n        'Maximum age (days) of predictive data before auto-downloading. Default is 30.')\n    iers_auto_url = _config.ConfigItem(\n        IERS_A_URL,\n        'URL for auto-downloading IERS file data.')\n    remote_timeout = _config.ConfigItem(\n        10.0,\n        'Remote timeout downloading IERS file data (seconds).')"},{"col":0,"comment":"","endLoc":2,"header":"unescaper.py#<anonymous>","id":8374,"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']"},{"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":8375,"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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":89,"id":8376,"name":"auto_download","nodeType":"Attribute","startLoc":89,"text":"auto_download"},{"col":4,"comment":"null","endLoc":181,"header":"@classmethod\n    def merge(cls, left, right)","id":8377,"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":8378,"name":"types","nodeType":"Attribute","startLoc":176,"text":"types"},{"attributeType":"null","col":4,"comment":"null","endLoc":177,"id":8379,"name":"enabled","nodeType":"Attribute","startLoc":177,"text":"enabled"},{"fileName":"__init__.py","filePath":"astropy/utils/iers","id":8380,"nodeType":"File","text":"\nfrom .iers import *\n"},{"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":8381,"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":8382,"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])"},{"id":8383,"name":"astropy/utils/iers/data","nodeType":"Package"},{"id":8384,"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"},{"id":8385,"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"},{"col":4,"comment":"null","endLoc":294,"header":"def diff(self, n=1, axis=-1)","id":8386,"name":"diff","nodeType":"Function","startLoc":292,"text":"def diff(self, n=1, axis=-1):\n        return self._wrap_function(np.diff, n, axis,\n                                   unit=self.unit._copy(dimensionless_unscaled))"},{"attributeType":"null","col":4,"comment":"null","endLoc":192,"id":8387,"name":"types","nodeType":"Attribute","startLoc":192,"text":"types"},{"id":8388,"name":"astropy/utils/iers/tests","nodeType":"Package"},{"id":8389,"name":"iers_a_excerpt","nodeType":"TextFile","path":"astropy/utils/iers/tests","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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":93,"id":8390,"name":"auto_max_age","nodeType":"Attribute","startLoc":93,"text":"auto_max_age"},{"attributeType":"null","col":4,"comment":"null","endLoc":195,"id":8391,"name":"enabled","nodeType":"Attribute","startLoc":195,"text":"enabled"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":96,"id":8392,"name":"iers_auto_url","nodeType":"Attribute","startLoc":96,"text":"iers_auto_url"},{"id":8393,"name":"finals2000A-2016-02-30-test","nodeType":"TextFile","path":"astropy/utils/iers/tests","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"},{"className":"_EnableMergeStrategies","col":0,"comment":"null","endLoc":229,"id":8394,"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":8395,"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":4,"comment":"null","endLoc":225,"header":"def __enter__(self)","id":8396,"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":8397,"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":4,"comment":"null","endLoc":298,"header":"def ediff1d(self, to_end=None, to_begin=None)","id":8398,"name":"ediff1d","nodeType":"Function","startLoc":296,"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))"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":99,"id":8399,"name":"remote_timeout","nodeType":"Attribute","startLoc":99,"text":"remote_timeout"},{"className":"IERSRangeError","col":0,"comment":"\n    Any error for when dates are outside of the valid range for IERS\n    ","endLoc":110,"id":8400,"nodeType":"Class","startLoc":107,"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":389,"id":8401,"nodeType":"Class","startLoc":113,"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\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        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            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 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        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        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, float array, or 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, float array, or 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 : Quantity with angle units\n            x component of CIP correction for the requested times\n        D_y : Quantity with angle units\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, float array, or 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 : Quantity with angle units\n            x component of polar motion for the requested times\n        PM_y : Quantity with angle units\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\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            # http://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        from astropy.time import Time\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()"},{"id":8402,"name":"finals2000A-2016-04-30-test","nodeType":"TextFile","path":"astropy/utils/iers/tests","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":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":172,"header":"@classmethod\n    def close(cls)","id":8403,"name":"close","nodeType":"Function","startLoc":165,"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 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        Returns\n        -------\n        mjd : float or array\n            integer part of MJD\n        utc : float or array\n            fractional part of MJD\n        ","endLoc":197,"header":"def mjd_utc(self, jd1, jd2=0.)","id":8404,"name":"mjd_utc","nodeType":"Function","startLoc":174,"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 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        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        mjd = np.floor(jd1 - MJD_ZERO + jd2)\n        utc = jd1 - (MJD_ZERO+mjd) + jd2\n        return mjd, utc"},{"col":4,"comment":"Interpolate UT1-UTC corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, float array, or 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":227,"header":"def ut1_utc(self, jd1, jd2=0., return_status=False)","id":8405,"name":"ut1_utc","nodeType":"Function","startLoc":199,"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, float array, or 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)"},{"attributeType":"LogUnit","col":4,"comment":"null","endLoc":226,"id":8406,"name":"_unit_class","nodeType":"Attribute","startLoc":226,"text":"_unit_class"},{"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\n    These may be a subset of the model parameters, if some of them are held\n    constant or tied.\n    ","endLoc":1171,"header":"def _model_to_fit_params(model)","id":8407,"name":"_model_to_fit_params","nodeType":"Function","startLoc":1149,"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\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    else:\n        return (model.parameters, fitparam_indices)"},{"attributeType":"null","col":4,"comment":"null","endLoc":300,"id":8408,"name":"_supported_functions","nodeType":"Attribute","startLoc":300,"text":"_supported_functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":8409,"name":"orig_enabled","nodeType":"Attribute","startLoc":218,"text":"self.orig_enabled"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":8410,"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 : one or more `~astropy.utils.metadata.MergeStrategy` args\n        Merge strategies that will be enabled.\n\n    ","endLoc":288,"header":"def enable_merge_strategies(*merge_strategies)","id":8411,"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 : one or more `~astropy.utils.metadata.MergeStrategy` args\n        Merge strategies that will be enabled.\n\n    \"\"\"\n\n    return _EnableMergeStrategies(*merge_strategies)"},{"className":"Dex","col":0,"comment":"null","endLoc":306,"id":8412,"nodeType":"Class","startLoc":305,"text":"class Dex(LogQuantity):\n    _unit_class = DexUnit"},{"attributeType":"DexUnit","col":4,"comment":"null","endLoc":306,"id":8413,"name":"_unit_class","nodeType":"Attribute","startLoc":306,"text":"_unit_class"},{"className":"Decibel","col":0,"comment":"null","endLoc":310,"id":8414,"nodeType":"Class","startLoc":309,"text":"class Decibel(LogQuantity):\n    _unit_class = DecibelUnit"},{"attributeType":"DecibelUnit","col":4,"comment":"null","endLoc":310,"id":8415,"name":"_unit_class","nodeType":"Attribute","startLoc":310,"text":"_unit_class"},{"col":0,"comment":"null","endLoc":295,"header":"def _warn_str_func(key, left, right)","id":8416,"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":"Convert inputs to float arrays.","endLoc":1083,"header":"def _convert_input(x, y, z=None, n_models=1, model_set_axis=0)","id":8417,"name":"_convert_input","nodeType":"Function","startLoc":1046,"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.asarray(x, dtype=float)\n    y = np.asarray(y, dtype=float)\n\n    if z is not None:\n        z = np.asarray(z, dtype=float)\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:\n        if z is None:\n            if y.shape[model_set_axis] != n_models:\n                raise ValueError(\n                    \"Number of data sets (y array is expected to equal \"\n                    \"the number of parameter sets)\")\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            # http://docs.scipy.org/doc/numpy/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        else:\n            # Shape of z excluding model_set_axis\n            z_shape = z.shape[:model_set_axis] + z.shape[model_set_axis + 1:]\n\n            if not (x.shape == y.shape == z_shape):\n                raise ValueError(\"x, y and z should have the same shape\")\n\n    if z is None:\n        farg = (x, y)\n    else:\n        farg = (x, y, z)\n    return farg"},{"col":0,"comment":"null","endLoc":302,"header":"def _error_str_func(key, left, right)","id":8418,"name":"_error_str_func","nodeType":"Function","startLoc":298,"text":"def _error_str_func(key, left, right):\n    out = ('Cannot merge meta key {0!r} '\n           'types {1!r} and {2!r}'\n           .format(key, type(left), type(right)))\n    return out"},{"className":"Magnitude","col":0,"comment":"null","endLoc":314,"id":8419,"nodeType":"Class","startLoc":313,"text":"class Magnitude(LogQuantity):\n    _unit_class = MagUnit"},{"attributeType":"MagUnit","col":4,"comment":"null","endLoc":314,"id":8420,"name":"_unit_class","nodeType":"Attribute","startLoc":314,"text":"_unit_class"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":8421,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":8422,"name":"MERGE_STRATEGIES","nodeType":"Attribute","startLoc":32,"text":"MERGE_STRATEGIES"},{"col":0,"comment":"","endLoc":4,"header":"metadata.py#<anonymous>","id":8423,"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\nMERGE_STRATEGIES = []"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8424,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":322,"id":8425,"name":"STmag","nodeType":"Attribute","startLoc":322,"text":"STmag"},{"col":4,"comment":"\n        Maps domain into window for a polynomial model which has these\n        attributes.\n        ","endLoc":307,"header":"def _map_domain_window(self, model, x, y=None)","id":8426,"name":"_map_domain_window","nodeType":"Function","startLoc":283,"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"},{"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":466,"header":"def poly_map_domain(oldx, domain, window)","id":8427,"name":"poly_map_domain","nodeType":"Function","startLoc":449,"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    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"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":325,"id":8428,"name":"ABmag","nodeType":"Attribute","startLoc":325,"text":"ABmag"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":328,"id":8429,"name":"M_bol","nodeType":"Attribute","startLoc":328,"text":"M_bol"},{"col":4,"comment":"null","endLoc":281,"header":"@staticmethod\n    def _deriv_with_constraints(model, param_indices, x=None, y=None)","id":8430,"name":"_deriv_with_constraints","nodeType":"Function","startLoc":271,"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]"},{"attributeType":"MagUnit","col":0,"comment":"null","endLoc":332,"id":8431,"name":"m_bol","nodeType":"Attribute","startLoc":332,"text":"m_bol"},{"fileName":"__init__.py","filePath":"astropy/utils/iers/tests","id":8432,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":845,"header":"def __enter__(self)","id":8433,"name":"__enter__","nodeType":"Function","startLoc":841,"text":"def __enter__(self):\n        if self._silent:\n            return self._silent_iterator()\n        else:\n            return self._iterator()"},{"col":0,"comment":"","endLoc":3,"header":"logarithmic.py#<anonymous>","id":8434,"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(mag0.ST)\n\nSTmag.__doc__ = \"ST magnitude: STmag=-21.1 corresponds to 1 erg/s/cm2/A\"\n\nABmag = MagUnit(mag0.AB)\n\nABmag.__doc__ = \"AB magnitude: ABmag=-48.6 corresponds to 1 erg/s/cm2/Hz\"\n\nM_bol = MagUnit(mag0.Bol)\n\nM_bol.__doc__ = (\"Absolute bolometric magnitude: M_bol=0 corresponds to \"\n                 \"L_bol0={0}\".format(mag0.Bol.si))\n\nm_bol = MagUnit(mag0.bol)\n\nm_bol.__doc__ = (\"Apparent bolometric magnitude: m_bol=0 corresponds to \"\n                 \"f_bol0={0}\".format(mag0.bol.si))"},{"col":4,"comment":"null","endLoc":866,"header":"def _silent_iterator(self)","id":8435,"name":"_silent_iterator","nodeType":"Function","startLoc":861,"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":4,"comment":"null","endLoc":859,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":8436,"name":"__exit__","nodeType":"Function","startLoc":847,"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()"},{"id":8437,"name":"astropy/utils/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/tests","id":8438,"nodeType":"File","text":""},{"attributeType":"null","col":4,"comment":"null","endLoc":763,"id":8439,"name":"_default_unicode_chars","nodeType":"Attribute","startLoc":763,"text":"_default_unicode_chars"},{"attributeType":"null","col":4,"comment":"null","endLoc":764,"id":8440,"name":"_default_ascii_chars","nodeType":"Attribute","startLoc":764,"text":"_default_ascii_chars"},{"attributeType":"null","col":8,"comment":"null","endLoc":799,"id":8441,"name":"_file","nodeType":"Attribute","startLoc":799,"text":"self._file"},{"attributeType":"null","col":8,"comment":"null","endLoc":808,"id":8442,"name":"_silent","nodeType":"Attribute","startLoc":808,"text":"self._silent"},{"attributeType":"null","col":8,"comment":"null","endLoc":798,"id":8443,"name":"_color","nodeType":"Attribute","startLoc":798,"text":"self._color"},{"id":8444,"name":"astropy/utils/tests/data","nodeType":"Package"},{"id":8445,"name":"unicode.txt","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"# -*- coding: utf-8 -*-\nהאסטרונומי פייתון\n"},{"id":8446,"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":8447,"name":"alias.cfg","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"[cosmology.core]\ndefault_cosmology = WMAP7"},{"id":8448,"name":".hidden_file.txt","nodeType":"TextFile","path":"astropy/utils/tests/data","text":"This is a deliberately hidden file.\n"},{"id":8449,"name":"astropy/utils/tests/data/test_package/data","nodeType":"Package"},{"id":8450,"name":"foo.txt","nodeType":"TextFile","path":"astropy/utils/tests/data/test_package/data","text":""},{"attributeType":"null","col":8,"comment":"null","endLoc":800,"id":8451,"name":"_step","nodeType":"Attribute","startLoc":800,"text":"self._step"},{"id":8452,"name":"astropy/utils/tests/data/test_package","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/tests/data/test_package","id":8453,"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"},{"id":8454,"name":"astropy/utils/compat","nodeType":"Package"},{"fileName":"numpycompat.py","filePath":"astropy/utils/compat","id":8455,"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\"\"\"\nfrom ...utils import minversion\n\n\n__all__ = ['NUMPY_LT_1_10_4', 'NUMPY_LT_1_11',\n           'NUMPY_LT_1_12', 'NUMPY_LT_1_13', 'NUMPY_LT_1_14']\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_10_4 = not minversion('numpy', '1.10.4')\nNUMPY_LT_1_11 = not minversion('numpy', '1.11.0')\nNUMPY_LT_1_12 = not minversion('numpy', '1.12')\nNUMPY_LT_1_13 = not minversion('numpy', '1.13')\nNUMPY_LT_1_14 = not minversion('numpy', '1.14dev')\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":8456,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8457,"name":"NUMPY_LT_1_10_4","nodeType":"Attribute","startLoc":15,"text":"NUMPY_LT_1_10_4"},{"fileName":"funcsigs.py","filePath":"astropy/utils/compat","id":8458,"nodeType":"File","text":"from inspect import signature, Parameter, Signature, BoundArguments\n\n__all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature']\n\nimport warnings\nfrom ..exceptions import AstropyDeprecationWarning\n\nwarnings.warn(\"astropy.utils.compat.funcsigs is now deprecated - \"\n              \"use inspect instead\", AstropyDeprecationWarning)\n"},{"col":0,"comment":"null","endLoc":5,"header":"def get_data_filename()","id":8459,"name":"get_data_filename","nodeType":"Function","startLoc":4,"text":"def get_data_filename():\n    return get_pkg_data_filename('data/foo.txt')"},{"attributeType":"null","col":8,"comment":"null","endLoc":797,"id":8460,"name":"_msg","nodeType":"Attribute","startLoc":797,"text":"self._msg"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":8461,"name":"NUMPY_LT_1_11","nodeType":"Attribute","startLoc":16,"text":"NUMPY_LT_1_11"},{"attributeType":"null","col":0,"comment":"null","endLoc":3,"id":8462,"name":"__all__","nodeType":"Attribute","startLoc":3,"text":"__all__"},{"col":0,"comment":"","endLoc":1,"header":"funcsigs.py#<anonymous>","id":8463,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"__all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature']\n\nwarnings.warn(\"astropy.utils.compat.funcsigs is now deprecated - \"\n              \"use inspect instead\", AstropyDeprecationWarning)"},{"attributeType":"null","col":8,"comment":"null","endLoc":806,"id":8464,"name":"_chars","nodeType":"Attribute","startLoc":806,"text":"self._chars"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":8465,"name":"NUMPY_LT_1_12","nodeType":"Attribute","startLoc":17,"text":"NUMPY_LT_1_12"},{"col":0,"comment":"","endLoc":5,"header":"numpycompat.py#<anonymous>","id":8466,"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_10_4', 'NUMPY_LT_1_11',\n           'NUMPY_LT_1_12', 'NUMPY_LT_1_13', 'NUMPY_LT_1_14']\n\nNUMPY_LT_1_10_4 = not minversion('numpy', '1.10.4')\n\nNUMPY_LT_1_11 = not minversion('numpy', '1.11.0')\n\nNUMPY_LT_1_12 = not minversion('numpy', '1.12')\n\nNUMPY_LT_1_13 = not minversion('numpy', '1.13')\n\nNUMPY_LT_1_14 = not minversion('numpy', '1.14dev')"},{"col":0,"comment":"\n    Constructs the full list of model parameters from the fitted and\n    constrained parameters.\n    ","endLoc":1146,"header":"def _fitter_to_model_params(model, fps)","id":8467,"name":"_fitter_to_model_params","nodeType":"Function","startLoc":1094,"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\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        model.parameters[slice_] = values\n        offset += size\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                model.parameters[slice_] = value"},{"fileName":"misc.py","filePath":"astropy/utils/compat","id":8468,"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\nfrom importlib import invalidate_caches\n\n\n__all__ = ['invalidate_caches', '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    @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"},{"col":4,"comment":"null","endLoc":357,"header":"def _interpolate(self, jd1, jd2, columns, source=None)","id":8469,"name":"_interpolate","nodeType":"Function","startLoc":302,"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\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            # http://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":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":365,"header":"def _refresh_table_as_needed(self, mjd)","id":8470,"name":"_refresh_table_as_needed","nodeType":"Function","startLoc":359,"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"},{"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":300,"header":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd)","id":8471,"name":"_check_interpolate_indices","nodeType":"Function","startLoc":292,"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.')"},{"fileName":"__init__.py","filePath":"astropy/utils/compat","id":8472,"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\"\"\"\n\nfrom .misc import *\n\n# Importing this module will also install monkey-patches defined in it\nfrom .numpycompat import *\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":74,"header":"def namedtuple_asdict(namedtuple)","id":8473,"name":"namedtuple_asdict","nodeType":"Function","startLoc":65,"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":9,"header":"__init__.py#<anonymous>","id":8474,"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\"\"\""},{"col":4,"comment":"Interpolate CIP corrections in IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, float array, or 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 : Quantity with angle units\n            x component of CIP correction for the requested times\n        D_y : Quantity with angle units\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":258,"header":"def dcip_xy(self, jd1, jd2=0., return_status=False)","id":8475,"name":"dcip_xy","nodeType":"Function","startLoc":229,"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, float array, or 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 : Quantity with angle units\n            x component of CIP correction for the requested times\n        D_y : Quantity with angle units\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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":8476,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"col":0,"comment":"","endLoc":7,"header":"misc.py#<anonymous>","id":8477,"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__ = ['invalidate_caches', 'override__dir__', 'suppress',\n           'possible_filename', 'namedtuple_asdict']"},{"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":941,"id":8478,"nodeType":"Class","startLoc":869,"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 object, 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        self._iter = self._obj.__enter__()\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        if self._is_spinner:\n            next(self._iter)\n        else:\n            self._obj.update(value)"},{"col":4,"comment":"null","endLoc":928,"header":"def __enter__(self)","id":8479,"name":"__enter__","nodeType":"Function","startLoc":926,"text":"def __enter__(self):\n        self._iter = self._obj.__enter__()\n        return self"},{"id":8480,"name":"astropy/utils/compat/numpy/lib","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/compat/numpy/lib","id":8481,"nodeType":"File","text":""},{"fileName":"stride_tricks.py","filePath":"astropy/utils/compat/numpy/lib","id":8482,"nodeType":"File","text":"# coding: utf-8\n# Licensed like the corresponding numpy file; see licenses/NUMPY_LICENSE.rst\n\"\"\"\nUtilities that manipulate strides to achieve desirable effects.\n\nAn explanation of strides can be found in the \"ndarray.rst\" file in the\nNumPy reference guide.\n\"\"\"\n\nimport warnings\n\nimport numpy as np\nfrom numpy.lib.stride_tricks import (\n    broadcast_arrays as np_broadcast_arrays,\n    broadcast_to as np_broadcast_to)\n\nfrom ....exceptions import AstropyDeprecationWarning\n\n__all__ = ['broadcast_arrays', 'broadcast_to', 'GE1P10']\n__doctest_skip__ = ['*']\n\n\ndef GE1P10(module=np):\n    return hasattr(module, 'broadcast_to')\n\n\ndef broadcast_arrays(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.broadcast_arrays directly.', AstropyDeprecationWarning)\n    return np_broadcast_arrays(*args, **kwargs)\n\n\ndef broadcast_to(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.broadcast_to directly.', AstropyDeprecationWarning)\n    return np_broadcast_to(*args, **kwargs)\n"},{"id":8483,"name":"astropy/utils/compat/numpy/core","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/compat/numpy/core","id":8484,"nodeType":"File","text":""},{"fileName":"multiarray.py","filePath":"astropy/utils/compat/numpy/core","id":8485,"nodeType":"File","text":"# coding: utf-8\n# Licensed like numpy; see licenses/NUMPY_LICENSE.rst\n\nimport warnings\n\nimport numpy as np\nfrom numpy import matmul as np_matmul\n\nfrom ....exceptions import AstropyDeprecationWarning\n\n__all__ = ['matmul', 'GE1P10']\n\n\ndef GE1P10(module=np):\n    return hasattr(module, 'matmul')\n\ndef matmul(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.matmul directly.', AstropyDeprecationWarning)\n    return np_matmul(*args, **kwargs)\n"},{"col":4,"comment":"Interpolate polar motions from IERS Table for given dates.\n\n        Parameters\n        ----------\n        jd1 : float, float array, or 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 : Quantity with angle units\n            x component of polar motion for the requested times\n        PM_y : Quantity with angle units\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":290,"header":"def pm_xy(self, jd1, jd2=0., return_status=False)","id":8486,"name":"pm_xy","nodeType":"Function","startLoc":260,"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, float array, or 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 : Quantity with angle units\n            x component of polar motion for the requested times\n        PM_y : Quantity with angle units\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)"},{"col":0,"comment":"null","endLoc":24,"header":"def GE1P10(module=np)","id":8487,"name":"GE1P10","nodeType":"Function","startLoc":23,"text":"def GE1P10(module=np):\n    return hasattr(module, 'broadcast_to')"},{"col":0,"comment":"null","endLoc":32,"header":"def broadcast_arrays(*args, **kwargs)","id":8488,"name":"broadcast_arrays","nodeType":"Function","startLoc":27,"text":"def broadcast_arrays(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.broadcast_arrays directly.', AstropyDeprecationWarning)\n    return np_broadcast_arrays(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":40,"header":"def broadcast_to(*args, **kwargs)","id":8489,"name":"broadcast_to","nodeType":"Function","startLoc":35,"text":"def broadcast_to(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.broadcast_to directly.', AstropyDeprecationWarning)\n    return np_broadcast_to(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":15,"header":"def GE1P10(module=np)","id":8490,"name":"GE1P10","nodeType":"Function","startLoc":14,"text":"def GE1P10(module=np):\n    return hasattr(module, 'matmul')"},{"attributeType":"null","col":16,"comment":"null","endLoc":12,"id":8491,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"col":0,"comment":"null","endLoc":22,"header":"def matmul(*args, **kwargs)","id":8492,"name":"matmul","nodeType":"Function","startLoc":17,"text":"def matmul(*args, **kwargs):\n    warnings.warn(\n        'This function is deprecated, as it is available in all NumPy versions '\n        'that this version of Astropy supports. You should use '\n        'numpy.matmul directly.', AstropyDeprecationWarning)\n    return np_matmul(*args, **kwargs)"},{"attributeType":"null","col":24,"comment":"null","endLoc":14,"id":8493,"name":"np_broadcast_arrays","nodeType":"Attribute","startLoc":14,"text":"np_broadcast_arrays"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":8494,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":20,"comment":"null","endLoc":15,"id":8495,"name":"np_broadcast_to","nodeType":"Attribute","startLoc":15,"text":"np_broadcast_to"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":8496,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":8497,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":20,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":8,"header":"stride_tricks.py#<anonymous>","id":8498,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nUtilities that manipulate strides to achieve desirable effects.\n\nAn explanation of strides can be found in the \"ndarray.rst\" file in the\nNumPy reference guide.\n\"\"\"\n\n__all__ = ['broadcast_arrays', 'broadcast_to', 'GE1P10']\n\n__doctest_skip__ = ['*']"},{"id":8499,"name":"astropy/utils/compat/numpy","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/compat/numpy","id":8500,"nodeType":"File","text":"# coding: utf-8\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"NumPy functions and classes needed for astropy but not available\nin all supported NumPy versions.  See docs/utils/numpy.rst for details.\n\"\"\"\n\n\nfrom .lib.stride_tricks import broadcast_arrays, broadcast_to\nfrom .core.multiarray import matmul\n"},{"attributeType":"null","col":28,"comment":"null","endLoc":7,"id":8501,"name":"np_matmul","nodeType":"Attribute","startLoc":7,"text":"np_matmul"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8502,"name":"__all__","nodeType":"Attribute","startLoc":11,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"multiarray.py#<anonymous>","id":8503,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['matmul', 'GE1P10']"},{"col":4,"comment":"Source for UT1-UTC.  To be overridden by subclass.","endLoc":369,"header":"def ut1_utc_source(self, i)","id":8504,"name":"ut1_utc_source","nodeType":"Function","startLoc":367,"text":"def ut1_utc_source(self, i):\n        \"\"\"Source for UT1-UTC.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"col":4,"comment":"null","endLoc":931,"header":"def __exit__(self, exc_type, exc_value, traceback)","id":8505,"name":"__exit__","nodeType":"Function","startLoc":930,"text":"def __exit__(self, exc_type, exc_value, traceback):\n        return self._obj.__exit__(exc_type, exc_value, traceback)"},{"col":4,"comment":"Source for CIP correction.  To be overridden by subclass.","endLoc":373,"header":"def dcip_source(self, i)","id":8506,"name":"dcip_source","nodeType":"Function","startLoc":371,"text":"def dcip_source(self, i):\n        \"\"\"Source for CIP correction.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"id":8507,"name":"astropy/utils/compat/numpy/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/compat/numpy/tests","id":8508,"nodeType":"File","text":""},{"col":4,"comment":"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n\n        Fitter subclasses should implement this method.\n        ","endLoc":247,"header":"@abc.abstractmethod\n    def __call__(self)","id":8509,"name":"__call__","nodeType":"Function","startLoc":238,"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\n        Fitter subclasses should implement this method.\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this method.\")"},{"id":8510,"name":"astropy/utils/compat/futures","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/utils/compat/futures","id":8511,"nodeType":"File","text":"from concurrent.futures import *\n\nimport warnings\nfrom ...exceptions import AstropyDeprecationWarning\n\nwarnings.warn(\"astropy.utils.compat.futures is now deprecated - \"\n              \"use concurrent.futures instead\", AstropyDeprecationWarning)\n"},{"id":8512,"name":"astropy/config","nodeType":"Package"},{"fileName":"affiliated.py","filePath":"astropy/config","id":8513,"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":8514,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"affiliated.py#<anonymous>","id":8515,"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":4,"comment":"Source for polar motion.  To be overridden by subclass.","endLoc":377,"header":"def pm_source(self, i)","id":8516,"name":"pm_source","nodeType":"Function","startLoc":375,"text":"def pm_source(self, i):\n        \"\"\"Source for polar motion.  To be overridden by subclass.\"\"\"\n        return np.zeros_like(i)"},{"col":4,"comment":"Predict run time for given argument.\n        If prediction is already cached, cached value is returned.\n\n        Parameters\n        ----------\n        arg : number\n            Input argument to predict run time for.\n\n        Returns\n        -------\n        t_est : float\n            Estimated run time for given argument.\n\n        Raises\n        ------\n        RuntimeError\n            No fitted data for prediction.\n\n        ","endLoc":303,"header":"def predict_time(self, arg)","id":8517,"name":"predict_time","nodeType":"Function","startLoc":276,"text":"def predict_time(self, arg):\n        \"\"\"Predict run time for given argument.\n        If prediction is already cached, cached value is returned.\n\n        Parameters\n        ----------\n        arg : number\n            Input argument to predict run time for.\n\n        Returns\n        -------\n        t_est : float\n            Estimated run time for given argument.\n\n        Raises\n        ------\n        RuntimeError\n            No fitted data for prediction.\n\n        \"\"\"\n        if arg in self._cache_est:\n            t_est = self._cache_est[arg]\n        else:\n            if self._fit_func is None:\n                raise RuntimeError('no fitted data for prediction')\n            t_est = self._fit_func(arg**self._power)\n            self._cache_est[arg] = t_est\n        return t_est"},{"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":389,"header":"@property\n    def time_now(self)","id":8518,"name":"time_now","nodeType":"Function","startLoc":379,"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        from astropy.time import Time\n        try:\n            return self._time_now\n        except Exception:\n            return Time.now()"},{"col":4,"comment":"\n        Update the progress bar to the given value (out of the total\n        given to the constructor.\n        ","endLoc":941,"header":"def update(self, value)","id":8519,"name":"update","nodeType":"Function","startLoc":933,"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        if self._is_spinner:\n            next(self._iter)\n        else:\n            self._obj.update(value)"},{"fileName":"setup_package.py","filePath":"astropy/config","id":8520,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\ndef get_package_data():\n    return {\n        str('astropy.config.tests'): ['data/*.cfg']\n    }\n"},{"col":0,"comment":"null","endLoc":7,"header":"def get_package_data()","id":8521,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    return {\n        str('astropy.config.tests'): ['data/*.cfg']\n    }"},{"col":0,"comment":"","endLoc":1,"header":"__init__.py#<anonymous>","id":8522,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"warnings.warn(\"astropy.utils.compat.futures is now deprecated - \"\n              \"use concurrent.futures instead\", AstropyDeprecationWarning)"},{"fileName":"configuration.py","filePath":"astropy/config","id":8523,"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 http://www.voidspace.org.uk/python/configobj.html.\n\"\"\"\n\nfrom contextlib import contextmanager\nimport hashlib\nimport io\nfrom os import path\nimport re\nfrom warnings import warn\n\nfrom ..extern.configobj import configobj, validate\nfrom ..utils.exceptions import AstropyWarning, AstropyDeprecationWarning\nfrom ..utils import find_current_module\nfrom ..utils.introspection import resolve_name\nfrom ..utils.misc import InheritDocstrings\nfrom .paths import get_config_dir\n\n\n__all__ = ['InvalidConfigurationItemWarning',\n           'ConfigurationMissingWarning', 'get_config',\n           'reload_config', 'ConfigNamespace', 'ConfigItem']\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\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 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(\"No configuration parameter '{0}'\".format(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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\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(\"No configuration parameter '{0}'\".format(attr))\n\n        for item in self.__class__.__dict__.values():\n            if isinstance(item, ConfigItem):\n                item.set(item.defaultvalue)\n\n\nclass ConfigItem(metaclass=InheritDocstrings):\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 whiich 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    def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from ..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)\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\n            The new value loaded from the configuration file.\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True)\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 = '<{0}: name={1!r} value={2!r} at 0x{3: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\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        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return 'in section [{0}]'.format(section)\n\n        options = []\n        sec = get_config(self.module)\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)\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 '{0}' {1} of the file '{2}' \"\n                    \"is deprecated. Use '{3}' {4} instead.\".format(\n                        name, section_name(module), get_config_filename(filename),\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 '{0}' {1} of the file '{2}' is \"\n                \"given by more than one alias ({3}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename),\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 master copy of the ConfigObj's for each\n# root package\n_cfgobjs = {}\n\n\ndef get_config_filename(packageormod=None):\n    \"\"\"\n    Get the filename of the config file associated with the given\n    package or module.\n    \"\"\"\n    cfg = get_config(packageormod)\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):\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    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    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    packageormodspl = packageormod.split('.')\n    rootname = packageormodspl[0]\n    secname = '.'.join(packageormodspl[1:])\n\n    cobj = _cfgobjs.get(rootname, None)\n\n    if cobj is None or reload:\n        if _ASTROPY_SETUP_:\n            # There's no reason to use anything but the default config\n            cobj = configobj.ConfigObj(interpolation=False)\n        else:\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 + '.cfg')\n                cobj = configobj.ConfigObj(cfgfn, interpolation=False)\n            except OSError as e:\n                msg = ('Configuration defaults will be used due to ')\n                errstr = '' if len(e.args) < 1 else (':' + str(e.args[0]))\n                msg += e.__class__.__name__ + errstr\n                msg += ' on {0}'.format(cfgfn)\n                warn(ConfigurationMissingWarning(msg))\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                cobj = configobj.ConfigObj(interpolation=False)\n\n        _cfgobjs[rootname] = 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 reload_config(packageormod=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    \"\"\"\n    sec = get_config(packageormod, True)\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.\n\n    To meet this criteria, the config file must be either:\n\n    - All comments or completely empty\n\n    - An exact match to a \"legacy\" version of the config file prior to\n      Astropy 0.4, when APE3 was implemented and the config file\n      contained commented-out values by default.\n    \"\"\"\n    # We want to calculate the md5sum using universal line endings, so\n    # that even if the files had their line endings converted to \\r\\n\n    # on Windows, this will still work.\n\n    content = content.encode('latin-1')\n\n    # The jquery_url setting, present in 0.3.2 and later only, is\n    # effectively auto-generated by the build system, so we need to\n    # ignore it in the md5sum calculation for 0.3.2.\n    content = re.sub(br'\\njquery_url\\s*=\\s*[^\\n]+', b'', content)\n\n    # First determine if the config file has any effective content\n    buffer = io.BytesIO(content)\n    buffer.seek(0)\n    raw_cfg = configobj.ConfigObj(buffer, interpolation=True)\n    for v in raw_cfg.values():\n        if len(v):\n            break\n    else:\n        return True\n\n    # Now determine if it matches the md5sum of a known, unedited\n    # config file.\n    known_configs = set([\n        '7d4b4f1120304b286d71f205975b1286',  # v0.3.2\n        '5df7e409425e5bfe7ed041513fda3288',  # v0.3\n        '8355f99a01b3bdfd8761ef45d5d8b7e5',  # v0.2\n        '4ea5a84de146dc3fcea2a5b93735e634'   # v0.2.1, v0.2.2, v0.2.3, v0.2.4, v0.2.5\n    ])\n\n    md5 = hashlib.md5()\n    md5.update(content)\n    digest = md5.hexdigest()\n    return digest in known_configs\n\n\n# this is not in __all__ because it's not intended that a user uses it\ndef update_default_config(pkg, default_cfg_dir_or_fn, version=None):\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\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).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 'dev' not in version and cfgfn is not None:\n        template_path = path.join(\n            get_config_dir(), '{0}.{1}.cfg'.format(pkg, version))\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 {0} {1} 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 '{2}'.\".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"},{"col":0,"comment":"","endLoc":6,"header":"__init__.py#<anonymous>","id":8524,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"NumPy functions and classes needed for astropy but not available\nin all supported NumPy versions.  See docs/utils/numpy.rst for details.\n\"\"\""},{"fileName":"paths.py","filePath":"astropy/config","id":8525,"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 ..utils.decorators 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\n    # First find the home directory - this is inspired by the scheme ipython\n    # uses to identify \"home\"\n    if os.name == 'posix':\n        # Linux, Unix, AIX, OS X\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        # Next try for a network home\n        elif 'HOMESHARE' in os.environ:\n            homedir = os.environ['HOMESHARE']\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'\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 unspported '\n                          'platform?')\n    return homedir\n\n\ndef get_config_dir(create=True):\n    \"\"\"\n    Determines the Astropy 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    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, 'astropy')\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, 'astropy')\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_astropy_dir('config', linkto))\n\n\ndef get_cache_dir():\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    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, 'astropy')\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, 'astropy')\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_astropy_dir('cache', linkto))\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        return self._default_path_getter()\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\n        from .configuration import _cfgobjs\n\n        path = super().__enter__()\n        _cfgobjs.clear()\n        return path\n\n    def __exit__(self, *args):\n        from .configuration import _cfgobjs\n\n        super().__exit__(*args)\n        _cfgobjs.clear()\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_astropy_dir(dirnm, linkto):\n    innerdir = os.path.join(_find_home(), '.astropy')\n    maindir = os.path.join(_find_home(), '.astropy', 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 Astropy directory {0} is actually a file.'\n            raise OSError(msg.format(innerdir))\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 Astropy {0} directory {1} is actually a file.'\n        raise OSError(msg.format(dirnm, maindir))\n\n    return os.path.abspath(maindir)\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":922,"id":8526,"name":"_is_spinner","nodeType":"Attribute","startLoc":922,"text":"self._is_spinner"},{"attributeType":"ProgressBar","col":12,"comment":"null","endLoc":924,"id":8527,"name":"_obj","nodeType":"Attribute","startLoc":924,"text":"self._obj"},{"attributeType":"ProgressBar","col":8,"comment":"null","endLoc":927,"id":8528,"name":"_iter","nodeType":"Attribute","startLoc":927,"text":"self._iter"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":8529,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"paths.py#<anonymous>","id":8530,"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']"},{"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":36,"id":8531,"nodeType":"Class","startLoc":32,"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":44,"id":8532,"nodeType":"Class","startLoc":39,"text":"class 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    \"\"\""},{"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":51,"id":8533,"nodeType":"Class","startLoc":48,"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    \"\"\""},{"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":58,"id":8534,"nodeType":"Class","startLoc":55,"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    \"\"\""},{"className":"ConfigurationChangedWarning","col":0,"comment":"\n    A warning that the configuration options have changed.\n    ","endLoc":64,"id":8535,"nodeType":"Class","startLoc":61,"text":"class ConfigurationChangedWarning(AstropyWarning):\n    \"\"\"\n    A warning that the configuration options have changed.\n    \"\"\""},{"className":"_ConfigNamespaceMeta","col":0,"comment":"null","endLoc":74,"id":8536,"nodeType":"Class","startLoc":67,"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"},{"col":4,"comment":"null","endLoc":74,"header":"def __init__(cls, name, bases, dict)","id":8537,"name":"__init__","nodeType":"Function","startLoc":68,"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"},{"attributeType":"None","col":4,"comment":"null","endLoc":120,"id":8538,"name":"iers_table","nodeType":"Attribute","startLoc":120,"text":"iers_table"},{"id":8539,"name":"astropy/config/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/config/tests","id":8540,"nodeType":"File","text":""},{"attributeType":"null","col":12,"comment":"null","endLoc":162,"id":8541,"name":"iers_table","nodeType":"Attribute","startLoc":162,"text":"cls.iers_table"},{"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 whiich 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":451,"id":8542,"nodeType":"Class","startLoc":160,"text":"class ConfigItem(metaclass=InheritDocstrings):\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 whiich 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    def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from ..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)\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\n            The new value loaded from the configuration file.\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True)\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 = '<{0}: name={1!r} value={2!r} at 0x{3: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\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        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return 'in section [{0}]'.format(section)\n\n        options = []\n        sec = get_config(self.module)\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)\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 '{0}' {1} of the file '{2}' \"\n                    \"is deprecated. Use '{3}' {4} instead.\".format(\n                        name, section_name(module), get_config_filename(filename),\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 '{0}' {1} of the file '{2}' is \"\n                \"given by more than one alias ({3}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename),\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":265,"header":"def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None)","id":8543,"name":"__init__","nodeType":"Function","startLoc":220,"text":"def __init__(self, defaultvalue='', description=None, cfgtype=None,\n                 module=None, aliases=None):\n        from ..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"},{"id":8544,"name":"astropy/config/tests/data","nodeType":"Package"},{"id":8545,"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":8546,"name":"alias.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"[coordinates.name_resolve]\nname_resolve_timeout = 42.0"},{"id":8547,"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":8548,"name":"astropy.0.3.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"\n# Use Unicode characters when outputting values, and writing widgets to the\n# console.\nunicode_output = False\n[utils.console]\n\n# When True, use ANSI color escape sequences when writing to the console.\nuse_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\n# Whether to use color for the level names\nuse_color = True\n\n# Whether to log warnings.warn calls\nlog_warnings = True\n\n# Whether to log exceptions before raising them\nlog_exceptions = False\n\n# Whether to always log messages to a log file\nlog_to_file = False\n\n# The file to log messages to. When '', it defaults to a file 'astropy.log' in\n# the astropy config directory.\nlog_file_path = \"\"\n\n# Threshold for logging messages to log_file_path\nlog_file_level = INFO\n\n# Format for log file entries\nlog_file_format = \"%(asctime)r, %(origin)r, %(levelname)r, %(message)r\"\n\n[coordinates.name_resolve]\n\n# The URL to Sesame's web-queryable database.\nsesame_url = http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/, http://vizier.cfa.harvard.edu/viz-bin/nph-sesame/\n\n# This specifies the default database that SESAME will query when using the\n# name resolve mechanism in the coordinates subpackage. Default is to search\n# all databases, but this can be 'all', 'simbad', 'ned', or 'vizier'.\n# Options: all, simbad, ned, vizier\nsesame_database = all\n\n# This is the maximum time to wait for a response from a name resolve query to\n# SESAME in seconds.\nname_resolve_timeout = 5\n\n[table.pprint]\n\n# Maximum number of lines for the pretty-printer to use if it cannot determine\n# the terminal size. Negative numbers mean no limit.\nmax_lines = 25\n\n# Maximum number of characters for the pretty-printer to use per line if it\n# cannot determine the terminal size.  Negative numbers mean no limit.\nmax_width = 80\n\n[table.table]\n\n# The template that determines the name of a column if it cannot be\n# determined. Uses new-style (format method) string formatting\nauto_colname = col{0}\n\n[utils.data]\n\n# URL for astropy remote data site.\ndataurl = http://data.astropy.org/\n\n# Time to wait for remote data query (in seconds).\nremote_timeout = 3.0\n\n# Block size for computing MD5 file hashes.\nhash_block_size = 65536\n\n# Number of bytes of remote data to download per step.\ndownload_block_size = 65536\n\n# Number of times to try to get the lock while accessing the data cache before\n# giving up.\ndownload_cache_lock_attempts = 5\n\n# If True, temporary download files created when the cache is inacessible will\n# be deleted at the end of the python session.\ndelete_temporary_downloads_at_exit = True\n\n[io.fits]\n\n# If True, enable support for record-valued keywords as described by FITS WCS\n# Paper IV. Otherwise they are treated as normal keywords.\nenabled_record_valued_keyword_cards = True\n\n# If True, extension names (i.e. the EXTNAME keyword) should be treated as\n# case-sensitive.\nextension_name_case_sensitive = False\n\n# If True, automatically remove trailing whitespace for string values in\n# headers.  Otherwise the values are returned verbatim, with all whitespace\n# intact.\nstrip_header_whitespace = True\n\n# If True, use memory-mapped file access to read/write the data in FITS files.\n# This generally provides better performance, especially for large files, but\n# may affect performance in I/O-heavy applications.\nuse_memmap = True\n\n[io.votable.table]\n\n# When True, treat fixable violations of the VOTable spec as exceptions.\npedantic = False\n\n[cosmology.core]\n\n# The default cosmology to use. Note this is only read on import, so changing\n# this value at runtime has no effect.\ndefault_cosmology = no_default\n\n[nddata.nddata]\n\n# Whether to issue a warning if NDData arithmetic is performed with\n# uncertainties and the uncertainties do not support the propagation of\n# correlated uncertainties.\nwarn_unsupported_correlated = True\n\n[vo.client.vos_catalog]\n\n# URL where VO Service database file is stored.\nvos_baseurl = http://stsdas.stsci.edu/astrolib/vo_databases/\n\n[vo.client.conesearch]\n\n# Conesearch database name.\nconesearch_dbname = conesearch_good\n\n[vo.validator.validate]\n\n# Cone Search services master list for validation.\ncs_mstr_list = http://vao.stsci.edu/directory/NVORegInt.asmx/VOTCapabilityPredOpt?predicate=1%3D1&capability=conesearch&VOTStyleOption=2\n\n# Only check these Cone Search URLs.\ncs_urls = http://archive.noao.edu/nvo/usno.php?cat=a&amp;, http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&amp;, http://irsa.ipac.caltech.edu/cgi-bin/Oasis/CatSearch/nph-catsearch?CAT=fp_psc&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/284/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=II/246/out&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=field&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=photoobjall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=phototag&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=specobjall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=specphotoall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=sppparams&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&amp;tab=psc&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&amp;tab=xsc&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=usnoa2&amp;tab=main&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=usnob1&amp;tab=main&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=Galaxy&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=PhotoObj&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=PhotoObjAll&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=Star&amp;, http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&amp;DSATAB=PhotoObjAll&amp;, http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&amp;DSATAB=SpecObjAll&amp;, http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&amp;DSATAB=twomass_psc&amp;, http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&amp;DSATAB=twomass_xsc&amp;, http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&amp;, http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-B1&amp;\n\n# VO Table warning codes that are considered non-critical\nnoncrit_warnings = W03, W06, W07, W09, W10, W15, W17, W20, W21, W22, W27, W28, W29, W41, W42, W48, W50\n"},{"id":8549,"name":"astropy.0.3.windows.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"\n# Use Unicode characters when outputting values, and writing widgets to the\n# console.\nunicode_output = False\n[utils.console]\n\n# When True, use ANSI color escape sequences when writing to the console.\nuse_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\n# Whether to use color for the level names\nuse_color = True\n\n# Whether to log warnings.warn calls\nlog_warnings = True\n\n# Whether to log exceptions before raising them\nlog_exceptions = False\n\n# Whether to always log messages to a log file\nlog_to_file = False\n\n# The file to log messages to. When '', it defaults to a file 'astropy.log' in\n# the astropy config directory.\nlog_file_path = \"\"\n\n# Threshold for logging messages to log_file_path\nlog_file_level = INFO\n\n# Format for log file entries\nlog_file_format = \"%(asctime)r, %(origin)r, %(levelname)r, %(message)r\"\n\n[coordinates.name_resolve]\n\n# The URL to Sesame's web-queryable database.\nsesame_url = http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/, http://vizier.cfa.harvard.edu/viz-bin/nph-sesame/\n\n# This specifies the default database that SESAME will query when using the\n# name resolve mechanism in the coordinates subpackage. Default is to search\n# all databases, but this can be 'all', 'simbad', 'ned', or 'vizier'.\n# Options: all, simbad, ned, vizier\nsesame_database = all\n\n# This is the maximum time to wait for a response from a name resolve query to\n# SESAME in seconds.\nname_resolve_timeout = 5\n\n[table.pprint]\n\n# Maximum number of lines for the pretty-printer to use if it cannot determine\n# the terminal size. Negative numbers mean no limit.\nmax_lines = 25\n\n# Maximum number of characters for the pretty-printer to use per line if it\n# cannot determine the terminal size.  Negative numbers mean no limit.\nmax_width = 80\n\n[table.table]\n\n# The template that determines the name of a column if it cannot be\n# determined. Uses new-style (format method) string formatting\nauto_colname = col{0}\n\n[utils.data]\n\n# URL for astropy remote data site.\ndataurl = http://data.astropy.org/\n\n# Time to wait for remote data query (in seconds).\nremote_timeout = 3.0\n\n# Block size for computing MD5 file hashes.\nhash_block_size = 65536\n\n# Number of bytes of remote data to download per step.\ndownload_block_size = 65536\n\n# Number of times to try to get the lock while accessing the data cache before\n# giving up.\ndownload_cache_lock_attempts = 5\n\n# If True, temporary download files created when the cache is inacessible will\n# be deleted at the end of the python session.\ndelete_temporary_downloads_at_exit = True\n\n[io.fits]\n\n# If True, enable support for record-valued keywords as described by FITS WCS\n# Paper IV. Otherwise they are treated as normal keywords.\nenabled_record_valued_keyword_cards = True\n\n# If True, extension names (i.e. the EXTNAME keyword) should be treated as\n# case-sensitive.\nextension_name_case_sensitive = False\n\n# If True, automatically remove trailing whitespace for string values in\n# headers.  Otherwise the values are returned verbatim, with all whitespace\n# intact.\nstrip_header_whitespace = True\n\n# If True, use memory-mapped file access to read/write the data in FITS files.\n# This generally provides better performance, especially for large files, but\n# may affect performance in I/O-heavy applications.\nuse_memmap = True\n\n[io.votable.table]\n\n# When True, treat fixable violations of the VOTable spec as exceptions.\npedantic = False\n\n[cosmology.core]\n\n# The default cosmology to use. Note this is only read on import, so changing\n# this value at runtime has no effect.\ndefault_cosmology = no_default\n\n[nddata.nddata]\n\n# Whether to issue a warning if NDData arithmetic is performed with\n# uncertainties and the uncertainties do not support the propagation of\n# correlated uncertainties.\nwarn_unsupported_correlated = True\n\n[vo.client.vos_catalog]\n\n# URL where VO Service database file is stored.\nvos_baseurl = http://stsdas.stsci.edu/astrolib/vo_databases/\n\n[vo.client.conesearch]\n\n# Conesearch database name.\nconesearch_dbname = conesearch_good\n\n[vo.validator.validate]\n\n# Cone Search services master list for validation.\ncs_mstr_list = http://vao.stsci.edu/directory/NVORegInt.asmx/VOTCapabilityPredOpt?predicate=1%3D1&capability=conesearch&VOTStyleOption=2\n\n# Only check these Cone Search URLs.\ncs_urls = http://archive.noao.edu/nvo/usno.php?cat=a&amp;, http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&amp;, http://irsa.ipac.caltech.edu/cgi-bin/Oasis/CatSearch/nph-catsearch?CAT=fp_psc&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/284/out&amp;, http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=II/246/out&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=field&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=photoobjall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=phototag&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=specobjall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=specphotoall&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&amp;tab=sppparams&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&amp;tab=psc&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&amp;tab=xsc&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=usnoa2&amp;tab=main&amp;, http://vo.astronet.ru/sai_cas/conesearch?cat=usnob1&amp;tab=main&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=Galaxy&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=PhotoObj&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=PhotoObjAll&amp;, http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&amp;DSATAB=Star&amp;, http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&amp;DSATAB=PhotoObjAll&amp;, http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&amp;DSATAB=SpecObjAll&amp;, http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&amp;DSATAB=twomass_psc&amp;, http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&amp;DSATAB=twomass_xsc&amp;, http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&amp;, http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-B1&amp;\n\n# VO Table warning codes that are considered non-critical\nnoncrit_warnings = W03, W06, W07, W09, W10, W15, W17, W20, W21, W22, W27, W28, W29, W41, W42, W48, W50\n"},{"id":8550,"name":"deprecated.cfg","nodeType":"TextFile","path":"astropy/config/tests/data","text":"[table.pprint]\nmax_lines = 25\n"},{"id":8551,"name":"astropy/extern","nodeType":"Package"},{"fileName":"setup_package.py","filePath":"astropy/extern","id":8552,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\n\n\ndef get_package_data():\n    paths = [os.path.join('js', '*.js'), os.path.join('css', '*.css')]\n    return {'astropy.extern': paths}\n"},{"fileName":"__init__.py","filePath":"astropy/config","id":8553,"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":8,"header":"def get_package_data()","id":8554,"name":"get_package_data","nodeType":"Function","startLoc":6,"text":"def get_package_data():\n    paths = [os.path.join('js', '*.js'), os.path.join('css', '*.css')]\n    return {'astropy.extern': paths}"},{"fileName":"__init__.py","filePath":"astropy/extern","id":8555,"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":"","endLoc":10,"header":"__init__.py#<anonymous>","id":8556,"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\"\"\""},{"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 http://maia.usno.navy.mil/\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL``.  See ``iers.__doc__`` for instructions on how to use\n    it in ``Time``, etc.\n    ","endLoc":531,"id":8557,"nodeType":"Class","startLoc":392,"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 http://maia.usno.navy.mil/\n\n    Notes\n    -----\n    The IERS A file is not part of astropy.  It can be downloaded from\n    ``iers.IERS_A_URL``.  See ``iers.__doc__`` for instructions on how to use\n    it 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[~iers_a['UT1_UTC_A'].mask &\n                       ~iers_a['PolPMFlag_A'].mask]\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        # Run np.where on the data from the table columns, since in numpy 1.9\n        # it otherwise returns an only partially initialized column.\n        table['UT1_UTC'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1_UTC_A'].data,\n                                    table['UT1_UTC_B'].data)\n        # Ensure the unit is correct, for later column conversion to Quantity.\n        table['UT1_UTC'].unit = table['UT1_UTC_A'].unit\n        table['UT1Flag'] = np.where(table['UT1_UTC_B'].mask,\n                                    table['UT1Flag_A'].data,\n                                    'B')\n        # Repeat for polar motions.\n        table['PM_x'] = np.where(table['PM_X_B'].mask,\n                                 table['PM_x_A'].data,\n                                 table['PM_X_B'].data)\n        table['PM_x'].unit = table['PM_x_A'].unit\n        table['PM_y'] = np.where(table['PM_Y_B'].mask,\n                                 table['PM_y_A'].data,\n                                 table['PM_Y_B'].data)\n        table['PM_y'].unit = table['PM_y_A'].unit\n        table['PolPMFlag'] = np.where(table['PM_X_B'].mask,\n                                      table['PolPMFlag_A'].data,\n                                      'B')\n\n        table['dX_2000A'] = np.where(table['dX_2000A_B'].mask,\n                                     table['dX_2000A_A'].data,\n                                     table['dX_2000A_B'].data)\n        table['dX_2000A'].unit = table['dX_2000A_A'].unit\n\n        table['dY_2000A'] = np.where(table['dY_2000A_B'].mask,\n                                     table['dY_2000A_A'].data,\n                                     table['dY_2000A_B'].data)\n        table['dY_2000A'].unit = table['dY_2000A_A'].unit\n\n        table['NutFlag'] = np.where(table['dX_2000A_B'].mask,\n                                    table['NutFlag_A'].data,\n                                    '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        is_predictive = (table['UT1Flag_A'] == 'P') | (table['PolPMFlag_A'] == 'P')\n        table.meta['predictive_index'] = np.min(np.flatnonzero(is_predictive))\n        table.meta['predictive_mjd'] = table['MJD'][table.meta['predictive_index']]\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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_a = Table.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        # Fill any masked values, and convert to a QTable.\n        return cls(table.filled())\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"},{"id":8558,"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_ (Python 2 and 3 versions): This provides the core config file\n  handling for Astropy's 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\n- pytest_: This is the test framework used to collect and run Astropy's tests.\n  It is a fairly large package, so it is bundled as a compressed base64 string\n  that is unpacked and loaded as a Python module.  This packed bundled version\n  is officially provided by the pytest project.\n\n- Six_: This is a Python 2/3 compatibility library used to ease development\n  of a simultaneously Python 2 and 3-compatible code base.\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^^^^^^^^^^^^^^^^^\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\nSix\n^^^\n\nBecause use of the ``six`` module is pervasive throughout the Astropy package\n(it is crucial for providing Python 2/3 compatibility at all levels) it has\nbeen made easier to replace.  The actual ``six`` module is included under\n``astropy/extern/bundled``.  Importing ``astropy.extern.six`` will first try\nto load the ``six`` module from that location, and then will fall back on\ntrying to import an installed ``six`` module from the standard ``sys.path``\nlocations (if it is a new enough version).\n\nPackagers may wish to prioritize the system version and/or remove the bundled\nversion altogether.  To do this, edit the ``_SIX_SEARCH_PATH`` list in\n``astropy.extern.six``.  If removing the bundled copy altogether simply delete\n``astropy/extern/bundled/six.py`` and update this variable to read::\n\n    _SIX_SEARCH_PATH = ['six']\n\nNo other imports in Astropy need to be updated.  Imports from\n``astropy.extern.six`` are automatically updated to point to the system version\nof the module.\n\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 <http://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.  If requested we could add a mechanism similar\nto that used by ``six`` for the other modules.\n\n\n.. _ConfigObj: https://github.com/DiffSK/configobj\n.. _PLY: http://www.dabeaz.com/ply/\n.. _pytest: https://pytest.org/en/latest/\n.. _Six: http://pypi.python.org/pypi/six/\n.. _jQuery: http://jquery.com/\n.. _DataTables: http://www.datatables.net/\n"},{"fileName":"six.py","filePath":"astropy/extern","id":8559,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nHandle loading six package from system or from the bundled copy\n\"\"\"\n\nimport imp\nfrom distutils.version import StrictVersion\n\n\n_SIX_MIN_VERSION = StrictVersion('1.10.0')\n\n# Update this to prevent Astropy from using its bundled copy of six\n# (but only if some other version of at least _SIX_MIN_VERSION can\n# be provided)\n_SIX_SEARCH_PATH = ['astropy.extern.bundled.six', 'six']\n\n\ndef _find_module(name, path=None):\n    \"\"\"\n    Alternative to `imp.find_module` that can also search in subpackages.\n    \"\"\"\n\n    parts = name.split('.')\n\n    for part in parts:\n        if path is not None:\n            path = [path]\n\n        fh, path, descr = imp.find_module(part, path)\n\n    return fh, path, descr\n\n\ndef _import_six(search_path=_SIX_SEARCH_PATH):\n    for mod_name in search_path:\n        try:\n            mod_info = _find_module(mod_name)\n        except ImportError:\n            continue\n\n        mod = imp.load_module(__name__, *mod_info)\n\n        try:\n            if StrictVersion(mod.__version__) >= _SIX_MIN_VERSION:\n                break\n        except (AttributeError, ValueError):\n            # Attribute error if the six module isn't what it should be and\n            # doesn't have a .__version__; ValueError if the version string\n            # exists but is somehow bogus/unparseable\n            continue\n    else:\n        raise ImportError(\n            \"Astropy requires the 'six' module of minimum version {0}; \"\n            \"normally this is bundled with the astropy package so if you get \"\n            \"this warning consult the packager of your Astropy \"\n            \"distribution.\".format(_SIX_MIN_VERSION))\n\n\n_import_six()\n"},{"col":4,"comment":"Set UT1-UTC source flag for entries in IERS table","endLoc":515,"header":"def ut1_utc_source(self, i)","id":8560,"name":"ut1_utc_source","nodeType":"Function","startLoc":509,"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":"","endLoc":7,"header":"__init__.py#<anonymous>","id":8561,"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\"\"\""},{"col":4,"comment":"Set CIP correction source flag for entries in IERS table","endLoc":523,"header":"def dcip_source(self, i)","id":8562,"name":"dcip_source","nodeType":"Function","startLoc":517,"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":0,"comment":"\n    Alternative to `imp.find_module` that can also search in subpackages.\n    ","endLoc":32,"header":"def _find_module(name, path=None)","id":8563,"name":"_find_module","nodeType":"Function","startLoc":19,"text":"def _find_module(name, path=None):\n    \"\"\"\n    Alternative to `imp.find_module` that can also search in subpackages.\n    \"\"\"\n\n    parts = name.split('.')\n\n    for part in parts:\n        if path is not None:\n            path = [path]\n\n        fh, path, descr = imp.find_module(part, path)\n\n    return fh, path, descr"},{"col":4,"comment":"Set polar motion source flag for entries in IERS table","endLoc":531,"header":"def pm_source(self, i)","id":8564,"name":"pm_source","nodeType":"Function","startLoc":525,"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":405,"id":8565,"name":"iers_table","nodeType":"Attribute","startLoc":405,"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 http://www.iers.org/\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":587,"id":8566,"nodeType":"Class","startLoc":534,"text":"class IERS_B(IERS):\n    \"\"\"IERS Table class targeted to IERS B, provided by IERS itself.\n\n    These are final values; see http://www.iers.org/\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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_b = Table.read(file, format='cds', readme=readme,\n                            data_start=data_start)\n        return cls(iers_b.filled())\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":"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":575,"header":"@classmethod\n    def read(cls, file=None, readme=None, data_start=14)","id":8567,"name":"read","nodeType":"Function","startLoc":547,"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        # Read in as a regular Table, including possible masked columns.\n        # Columns will be filled and converted to Quantity in cls.__init__.\n        iers_b = Table.read(file, format='cds', readme=readme,\n                            data_start=data_start)\n        return cls(iers_b.filled())"},{"col":0,"comment":"null","endLoc":57,"header":"def _import_six(search_path=_SIX_SEARCH_PATH)","id":8568,"name":"_import_six","nodeType":"Function","startLoc":35,"text":"def _import_six(search_path=_SIX_SEARCH_PATH):\n    for mod_name in search_path:\n        try:\n            mod_info = _find_module(mod_name)\n        except ImportError:\n            continue\n\n        mod = imp.load_module(__name__, *mod_info)\n\n        try:\n            if StrictVersion(mod.__version__) >= _SIX_MIN_VERSION:\n                break\n        except (AttributeError, ValueError):\n            # Attribute error if the six module isn't what it should be and\n            # doesn't have a .__version__; ValueError if the version string\n            # exists but is somehow bogus/unparseable\n            continue\n    else:\n        raise ImportError(\n            \"Astropy requires the 'six' module of minimum version {0}; \"\n            \"normally this is bundled with the astropy package so if you get \"\n            \"this warning consult the packager of your Astropy \"\n            \"distribution.\".format(_SIX_MIN_VERSION))"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":8569,"name":"_SIX_MIN_VERSION","nodeType":"Attribute","startLoc":11,"text":"_SIX_MIN_VERSION"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":8570,"name":"_SIX_SEARCH_PATH","nodeType":"Attribute","startLoc":16,"text":"_SIX_SEARCH_PATH"},{"col":0,"comment":"","endLoc":5,"header":"six.py#<anonymous>","id":8571,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nHandle loading six package from system or from the bundled copy\n\"\"\"\n\n_SIX_MIN_VERSION = StrictVersion('1.10.0')\n\n_SIX_SEARCH_PATH = ['astropy.extern.bundled.six', 'six']\n\n_import_six()"},{"id":8572,"name":"astropy/extern/js","nodeType":"Package"},{"id":8573,"name":"jquery-3.1.1.min.js","nodeType":"TextFile","path":"astropy/extern/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"},{"className":"_GetchUnix","col":0,"comment":"null","endLoc":1069,"id":8574,"nodeType":"Class","startLoc":1049,"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"},{"id":8575,"name":"jquery-3.1.1.js","nodeType":"TextFile","path":"astropy/extern/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":1069,"header":"def __call__(self)","id":8576,"name":"__call__","nodeType":"Function","startLoc":1058,"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":4,"comment":"Set UT1-UTC source flag for entries in IERS table","endLoc":579,"header":"def ut1_utc_source(self, i)","id":8577,"name":"ut1_utc_source","nodeType":"Function","startLoc":577,"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":583,"header":"def dcip_source(self, i)","id":8578,"name":"dcip_source","nodeType":"Function","startLoc":581,"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":587,"header":"def pm_source(self, i)","id":8579,"name":"pm_source","nodeType":"Function","startLoc":585,"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":545,"id":8580,"name":"iers_table","nodeType":"Attribute","startLoc":545,"text":"iers_table"},{"className":"IERS_Auto","col":0,"comment":"\n    Provide most-recent IERS data and automatically handle downloading\n    of updated values as necessary.\n    ","endLoc":765,"id":8581,"nodeType":"Class","startLoc":590,"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 with IERS (Earth rotation) data columns\n\n        \"\"\"\n        if not conf.auto_download:\n            cls.iers_table = IERS.open()\n            return cls.iers_table\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') == conf.iers_auto_url:\n                return cls.iers_table\n\n        try:\n            filename = download_file(conf.iers_auto_url, 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('failed to download {}, using local IERS-B: {}'\n                                .format(conf.iers_auto_url, str(err))))\n            cls.iers_table = IERS.open()\n            return cls.iers_table\n\n        cls.iers_table = cls.read(file=filename)\n        cls.iers_table.meta['data_url'] = str(conf.iers_auto_url)\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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR)\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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\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            # Get the latest version\n            try:\n                clear_download_cache(conf.iers_auto_url)\n                filename = download_file(conf.iers_auto_url, 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('failed to download {}: {}.\\nA 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                                    .format(conf.iers_auto_url, str(err))))\n                return\n\n            new_table = self.__class__.read(file=filename)\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'][~table['UT1_UTC_B'].mask]\n        i0 = np.searchsorted(iers_b['MJD'].value, mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'].value, 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 np.allclose(table['MJD'][:n_iers_b], iers_b['MJD'].value):\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'].value\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x'].value\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y'].value\n\n        return table"},{"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":661,"header":"def _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd)","id":8582,"name":"_check_interpolate_indices","nodeType":"Function","startLoc":647,"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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\n        if (max_input_mjd > predictive_mjd and\n                self.time_now.mjd - predictive_mjd > auto_max_age):\n            raise ValueError(INTERPOLATE_ERROR)"},{"id":8583,"name":"jquery.dataTables.min.js","nodeType":"TextFile","path":"astropy/extern/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"},{"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":736,"header":"def _refresh_table_as_needed(self, mjd)","id":8584,"name":"_refresh_table_as_needed","nodeType":"Function","startLoc":663,"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 = (conf.auto_max_age if conf.auto_max_age is not None\n                        else np.finfo(float).max)\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            # Get the latest version\n            try:\n                clear_download_cache(conf.iers_auto_url)\n                filename = download_file(conf.iers_auto_url, 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('failed to download {}: {}.\\nA 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                                    .format(conf.iers_auto_url, str(err))))\n                return\n\n            new_table = self.__class__.read(file=filename)\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)))"},{"id":8585,"name":"astropy/extern/css","nodeType":"Package"},{"id":8586,"name":"jquery.dataTables.css","nodeType":"TextFile","path":"astropy/extern/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"},{"col":4,"comment":"Plot prediction.\n\n        .. note:: Uses `matplotlib <http://matplotlib.org/>`_.\n\n        Parameters\n        ----------\n        xscale, yscale : {'linear', 'log', 'symlog'}\n            Scaling for `matplotlib.axes.Axes`.\n\n        xlabeltext : str, optional\n            Text for X-label.\n\n        save_as : str, optional\n            Save plot as given filename.\n\n        Raises\n        ------\n        RuntimeError\n            Insufficient data for plotting.\n\n        ","endLoc":372,"header":"def plot(self, xscale='linear', yscale='linear', xlabeltext='args',\n             save_as='')","id":8587,"name":"plot","nodeType":"Function","startLoc":305,"text":"def plot(self, xscale='linear', yscale='linear', xlabeltext='args',\n             save_as=''):  # pragma: no cover\n        \"\"\"Plot prediction.\n\n        .. note:: Uses `matplotlib <http://matplotlib.org/>`_.\n\n        Parameters\n        ----------\n        xscale, yscale : {'linear', 'log', 'symlog'}\n            Scaling for `matplotlib.axes.Axes`.\n\n        xlabeltext : str, optional\n            Text for X-label.\n\n        save_as : str, optional\n            Save plot as given filename.\n\n        Raises\n        ------\n        RuntimeError\n            Insufficient data for plotting.\n\n        \"\"\"\n        import matplotlib.pyplot as plt\n\n        # Actual data\n        x_arr = sorted(self._cache_good)\n        y_arr = np.array([self._cache_good[x] for x in x_arr])\n\n        if len(x_arr) <= 1:\n            raise RuntimeError('insufficient data for plotting')\n\n        # Auto-ranging\n        qmean = y_arr.mean() * u.second\n        for cur_u in (u.minute, u.second, u.millisecond, u.microsecond,\n                      u.nanosecond):\n            val = qmean.to_value(cur_u)\n            if 1000 > val >= 1:\n                break\n        y_arr = (y_arr * u.second).to_value(cur_u)\n\n        fig, ax = plt.subplots()\n        ax.plot(x_arr, y_arr, 'kx-', label='Actual')\n\n        # Fitted data\n        if self._fit_func is not None:\n            x_est = list(self._cache_est.keys())\n            y_est = (np.array(list(self._cache_est.values())) *\n                     u.second).to_value(cur_u)\n            ax.scatter(x_est, y_est, marker='o', c='r', label='Predicted')\n\n            x_fit = np.array(sorted(x_arr + x_est))\n            y_fit = (self._fit_func(x_fit**self._power) *\n                     u.second).to_value(cur_u)\n            ax.plot(x_fit, y_fit, 'b--', label='Fit')\n\n        ax.set_xscale(xscale)\n        ax.set_yscale(yscale)\n\n        ax.set_xlabel(xlabeltext)\n        ax.set_ylabel('Run time ({})'.format(cur_u.to_string()))\n        ax.set_title(self._funcname)\n        ax.legend(loc='best', numpoints=1)\n\n        plt.draw()\n\n        if save_as:\n            plt.savefig(save_as)"},{"id":8588,"name":"jquery.dataTables.js","nodeType":"TextFile","path":"astropy/extern/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"},{"id":8589,"name":"astropy/extern/ply","nodeType":"Package"},{"fileName":"ctokens.py","filePath":"astropy/extern/ply","id":8590,"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\n\n    \n\n\n\n"},{"fileName":"yacc.py","filePath":"astropy/extern/ply","id":8591,"nodeType":"File","text":"# -----------------------------------------------------------------------------\n# ply: yacc.py\n#\n# Copyright (C) 2001-2016\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 grammer 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 base64\nimport warnings\n\n__version__    = '3.9'\n__tabversion__ = '3.8'\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 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 = 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        dr_set = {}\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                                        sprec, slevel = Productions[st_actionp[a].number].prec\n                                        rprec, rlevel = Precedence.get(a, ('right', 0))\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                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\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_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        try:\n            from hashlib import md5\n        except ImportError:\n            from md5 import md5\n        try:\n            sig = md5()\n            if self.start:\n                sig.update(self.start.encode('latin-1'))\n            if self.prec:\n                sig.update(''.join([''.join(p) for p in self.prec]).encode('latin-1'))\n            if self.tokens:\n                sig.update(' '.join(self.tokens).encode('latin-1'))\n            for f in self.pfuncs:\n                if f[3]:\n                    sig.update(f[3].encode('latin-1'))\n        except (TypeError, ValueError):\n            pass\n\n        digest = base64.b16encode(sig.digest())\n        if sys.version_info[0] >= 3:\n            digest = digest.decode('latin-1')\n        return digest\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 = 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__ attribute is available, try to obtain it from the __module__ instead\n        if '__file__' not in pdict:\n            pdict['__file__'] = sys.modules[pdict['__module__']].__file__\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        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":124,"id":8592,"nodeType":"Class","startLoc":109,"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":114,"header":"def debug(self, msg, *args, **kwargs)","id":8593,"name":"debug","nodeType":"Function","startLoc":113,"text":"def debug(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')"},{"col":0,"comment":"/\\*(.|\\n)*?\\*/","endLoc":121,"header":"def t_COMMENT(t)","id":8594,"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":4,"comment":"null","endLoc":119,"header":"def warning(self, msg, *args, **kwargs)","id":8595,"name":"warning","nodeType":"Function","startLoc":118,"text":"def warning(self, msg, *args, **kwargs):\n        self.f.write('WARNING: ' + (msg % args) + '\\n')"},{"col":4,"comment":"null","endLoc":122,"header":"def error(self, msg, *args, **kwargs)","id":8596,"name":"error","nodeType":"Function","startLoc":121,"text":"def error(self, msg, *args, **kwargs):\n        self.f.write('ERROR: ' + (msg % args) + '\\n')"},{"col":0,"comment":"//.*\\n","endLoc":127,"header":"def t_CPPCOMMENT(t)","id":8597,"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":8598,"name":"tokens","nodeType":"Attribute","startLoc":10,"text":"tokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":8599,"name":"t_PLUS","nodeType":"Attribute","startLoc":44,"text":"t_PLUS"},{"attributeType":"function","col":4,"comment":"null","endLoc":116,"id":8600,"name":"info","nodeType":"Attribute","startLoc":116,"text":"info"},{"attributeType":"null","col":0,"comment":"null","endLoc":45,"id":8601,"name":"t_MINUS","nodeType":"Attribute","startLoc":45,"text":"t_MINUS"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":8602,"name":"t_TIMES","nodeType":"Attribute","startLoc":46,"text":"t_TIMES"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":8603,"name":"t_DIVIDE","nodeType":"Attribute","startLoc":47,"text":"t_DIVIDE"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":8604,"name":"t_MODULO","nodeType":"Attribute","startLoc":48,"text":"t_MODULO"},{"attributeType":"function","col":4,"comment":"null","endLoc":124,"id":8605,"name":"critical","nodeType":"Attribute","startLoc":124,"text":"critical"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":8606,"name":"t_OR","nodeType":"Attribute","startLoc":49,"text":"t_OR"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":8607,"name":"f","nodeType":"Attribute","startLoc":111,"text":"self.f"},{"className":"NullLogger","col":0,"comment":"null","endLoc":132,"id":8608,"nodeType":"Class","startLoc":127,"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":129,"header":"def __getattribute__(self, name)","id":8609,"name":"__getattribute__","nodeType":"Function","startLoc":128,"text":"def __getattribute__(self, name):\n        return self"},{"col":4,"comment":"null","endLoc":132,"header":"def __call__(self, *args, **kwargs)","id":8610,"name":"__call__","nodeType":"Function","startLoc":131,"text":"def __call__(self, *args, **kwargs):\n        return self"},{"className":"YaccError","col":0,"comment":"null","endLoc":136,"id":8611,"nodeType":"Class","startLoc":135,"text":"class YaccError(Exception):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":8612,"name":"t_AND","nodeType":"Attribute","startLoc":50,"text":"t_AND"},{"className":"YaccSymbol","col":0,"comment":"null","endLoc":222,"id":8613,"nodeType":"Class","startLoc":217,"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":219,"header":"def __str__(self)","id":8614,"name":"__str__","nodeType":"Function","startLoc":218,"text":"def __str__(self):\n        return self.type"},{"col":4,"comment":"null","endLoc":222,"header":"def __repr__(self)","id":8615,"name":"__repr__","nodeType":"Function","startLoc":221,"text":"def __repr__(self):\n        return str(self)"},{"className":"_GetchWindows","col":0,"comment":"null","endLoc":1078,"id":8616,"nodeType":"Class","startLoc":1072,"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":1078,"header":"def __call__(self)","id":8617,"name":"__call__","nodeType":"Function","startLoc":1076,"text":"def __call__(self):\n        import msvcrt\n        return msvcrt.getch()"},{"className":"YaccProduction","col":0,"comment":"null","endLoc":277,"id":8618,"nodeType":"Class","startLoc":233,"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 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"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":8619,"name":"t_NOT","nodeType":"Attribute","startLoc":51,"text":"t_NOT"},{"col":4,"comment":"null","endLoc":238,"header":"def __init__(self, s, stack=None)","id":8620,"name":"__init__","nodeType":"Function","startLoc":234,"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":246,"header":"def __getitem__(self, n)","id":8621,"name":"__getitem__","nodeType":"Function","startLoc":240,"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":249,"header":"def __setitem__(self, n, v)","id":8622,"name":"__setitem__","nodeType":"Function","startLoc":248,"text":"def __setitem__(self, n, v):\n        self.slice[n].value = v"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":8623,"name":"t_XOR","nodeType":"Attribute","startLoc":52,"text":"t_XOR"},{"col":4,"comment":"null","endLoc":252,"header":"def __getslice__(self, i, j)","id":8624,"name":"__getslice__","nodeType":"Function","startLoc":251,"text":"def __getslice__(self, i, j):\n        return [s.value for s in self.slice[i:j]]"},{"col":4,"comment":"null","endLoc":255,"header":"def __len__(self)","id":8625,"name":"__len__","nodeType":"Function","startLoc":254,"text":"def __len__(self):\n        return len(self.slice)"},{"col":4,"comment":"null","endLoc":258,"header":"def lineno(self, n)","id":8626,"name":"lineno","nodeType":"Function","startLoc":257,"text":"def lineno(self, n):\n        return getattr(self.slice[n], 'lineno', 0)"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":8627,"name":"t_LSHIFT","nodeType":"Attribute","startLoc":53,"text":"t_LSHIFT"},{"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":1108,"id":8628,"nodeType":"Class","startLoc":1081,"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":1108,"header":"def __call__(self)","id":8629,"name":"__call__","nodeType":"Function","startLoc":1093,"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":4,"comment":"null","endLoc":261,"header":"def set_lineno(self, n, lineno)","id":8630,"name":"set_lineno","nodeType":"Function","startLoc":260,"text":"def set_lineno(self, n, lineno):\n        self.slice[n].lineno = lineno"},{"col":4,"comment":"null","endLoc":266,"header":"def linespan(self, n)","id":8631,"name":"linespan","nodeType":"Function","startLoc":263,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":8632,"name":"t_RSHIFT","nodeType":"Attribute","startLoc":54,"text":"t_RSHIFT"},{"col":4,"comment":"null","endLoc":269,"header":"def lexpos(self, n)","id":8633,"name":"lexpos","nodeType":"Function","startLoc":268,"text":"def lexpos(self, n):\n        return getattr(self.slice[n], 'lexpos', 0)"},{"col":4,"comment":"null","endLoc":274,"header":"def lexspan(self, n)","id":8634,"name":"lexspan","nodeType":"Function","startLoc":271,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":8635,"name":"t_LOR","nodeType":"Attribute","startLoc":55,"text":"t_LOR"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":8636,"name":"t_LAND","nodeType":"Attribute","startLoc":56,"text":"t_LAND"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":8637,"name":"t_LNOT","nodeType":"Attribute","startLoc":57,"text":"t_LNOT"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":8638,"name":"t_LT","nodeType":"Attribute","startLoc":58,"text":"t_LT"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":8639,"name":"t_GT","nodeType":"Attribute","startLoc":59,"text":"t_GT"},{"attributeType":"null","col":0,"comment":"null","endLoc":60,"id":8640,"name":"t_LE","nodeType":"Attribute","startLoc":60,"text":"t_LE"},{"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":277,"header":"def _decode_preferred_encoding(s)","id":8641,"name":"_decode_preferred_encoding","nodeType":"Function","startLoc":262,"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')"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":8642,"name":"t_GE","nodeType":"Attribute","startLoc":61,"text":"t_GE"},{"col":4,"comment":"null","endLoc":277,"header":"def error(self)","id":8643,"name":"error","nodeType":"Function","startLoc":276,"text":"def error(self):\n        raise SyntaxError"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":8644,"name":"t_EQ","nodeType":"Attribute","startLoc":62,"text":"t_EQ"},{"attributeType":"null","col":0,"comment":"null","endLoc":63,"id":8645,"name":"t_NE","nodeType":"Attribute","startLoc":63,"text":"t_NE"},{"attributeType":"null","col":8,"comment":"null","endLoc":236,"id":8646,"name":"stack","nodeType":"Attribute","startLoc":236,"text":"self.stack"},{"attributeType":"null","col":0,"comment":"null","endLoc":67,"id":8647,"name":"t_EQUALS","nodeType":"Attribute","startLoc":67,"text":"t_EQUALS"},{"attributeType":"null","col":0,"comment":"null","endLoc":68,"id":8648,"name":"t_TIMESEQUAL","nodeType":"Attribute","startLoc":68,"text":"t_TIMESEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":8649,"name":"t_DIVEQUAL","nodeType":"Attribute","startLoc":69,"text":"t_DIVEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":8650,"name":"t_MODEQUAL","nodeType":"Attribute","startLoc":70,"text":"t_MODEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":8651,"name":"t_PLUSEQUAL","nodeType":"Attribute","startLoc":71,"text":"t_PLUSEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":8652,"name":"t_MINUSEQUAL","nodeType":"Attribute","startLoc":72,"text":"t_MINUSEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":8653,"name":"t_LSHIFTEQUAL","nodeType":"Attribute","startLoc":73,"text":"t_LSHIFTEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":8654,"name":"t_RSHIFTEQUAL","nodeType":"Attribute","startLoc":74,"text":"t_RSHIFTEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":8655,"name":"t_ANDEQUAL","nodeType":"Attribute","startLoc":75,"text":"t_ANDEQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":8656,"name":"t_OREQUAL","nodeType":"Attribute","startLoc":76,"text":"t_OREQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":8657,"name":"t_XOREQUAL","nodeType":"Attribute","startLoc":77,"text":"t_XOREQUAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":80,"id":8658,"name":"t_INCREMENT","nodeType":"Attribute","startLoc":80,"text":"t_INCREMENT"},{"attributeType":"null","col":0,"comment":"null","endLoc":81,"id":8659,"name":"t_DECREMENT","nodeType":"Attribute","startLoc":81,"text":"t_DECREMENT"},{"attributeType":"null","col":0,"comment":"null","endLoc":84,"id":8660,"name":"t_ARROW","nodeType":"Attribute","startLoc":84,"text":"t_ARROW"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":8661,"name":"t_TERNARY","nodeType":"Attribute","startLoc":87,"text":"t_TERNARY"},{"attributeType":"None","col":8,"comment":"null","endLoc":238,"id":8662,"name":"parser","nodeType":"Attribute","startLoc":238,"text":"self.parser"},{"col":0,"comment":"\n    Remove ANSI color codes from the string.\n    ","endLoc":387,"header":"def strip_ansi_codes(s)","id":8663,"name":"strip_ansi_codes","nodeType":"Function","startLoc":383,"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":0,"comment":"null","endLoc":90,"id":8664,"name":"t_LPAREN","nodeType":"Attribute","startLoc":90,"text":"t_LPAREN"},{"attributeType":"null","col":4,"comment":"null","endLoc":22,"id":8665,"name":"_CAN_RESIZE_TERMINAL","nodeType":"Attribute","startLoc":22,"text":"_CAN_RESIZE_TERMINAL"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":8666,"name":"__all__","nodeType":"Attribute","startLoc":32,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":8667,"name":"_DEFAULT_ENCODING","nodeType":"Attribute","startLoc":37,"text":"_DEFAULT_ENCODING"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":8668,"name":"slice","nodeType":"Attribute","startLoc":235,"text":"self.slice"},{"attributeType":"null","col":0,"comment":"null","endLoc":91,"id":8669,"name":"t_RPAREN","nodeType":"Attribute","startLoc":91,"text":"t_RPAREN"},{"attributeType":"null","col":0,"comment":"null","endLoc":92,"id":8670,"name":"t_LBRACKET","nodeType":"Attribute","startLoc":92,"text":"t_LBRACKET"},{"col":0,"comment":"","endLoc":5,"header":"console.py#<anonymous>","id":8671,"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":93,"id":8672,"name":"t_RBRACKET","nodeType":"Attribute","startLoc":93,"text":"t_RBRACKET"},{"attributeType":"null","col":0,"comment":"null","endLoc":94,"id":8673,"name":"t_LBRACE","nodeType":"Attribute","startLoc":94,"text":"t_LBRACE"},{"attributeType":"null","col":0,"comment":"null","endLoc":95,"id":8674,"name":"t_RBRACE","nodeType":"Attribute","startLoc":95,"text":"t_RBRACE"},{"attributeType":"None","col":8,"comment":"null","endLoc":237,"id":8675,"name":"lexer","nodeType":"Attribute","startLoc":237,"text":"self.lexer"},{"fileName":"lex.py","filePath":"astropy/extern/ply","id":8676,"nodeType":"File","text":"# -----------------------------------------------------------------------------\n# ply: lex.py\n#\n# Copyright (C) 2001-2016\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.9'\n__tabversion__ = '3.8'\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(self.lextokens)))\n            tf.write('_lexreflags   = %s\\n' % repr(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 | re.VERBOSE), _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, re.VERBOSE | 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    nonstate = 1\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)), re.VERBOSE | 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), re.VERBOSE | 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=0, 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            line = f.__code__.co_firstlineno\n            file = f.__code__.co_filename\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        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\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":96,"id":8677,"name":"t_COMMA","nodeType":"Attribute","startLoc":96,"text":"t_COMMA"},{"className":"LRParser","col":0,"comment":"null","endLoc":1273,"id":8678,"nodeType":"Class","startLoc":285,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":97,"id":8679,"name":"t_PERIOD","nodeType":"Attribute","startLoc":97,"text":"t_PERIOD"},{"className":"LexError","col":0,"comment":"null","endLoc":60,"id":8680,"nodeType":"Class","startLoc":57,"text":"class LexError(Exception):\n    def __init__(self, message, s):\n        self.args = (message,)\n        self.text = s"},{"attributeType":"null","col":0,"comment":"null","endLoc":98,"id":8681,"name":"t_SEMI","nodeType":"Attribute","startLoc":98,"text":"t_SEMI"},{"attributeType":"null","col":0,"comment":"null","endLoc":99,"id":8682,"name":"t_COLON","nodeType":"Attribute","startLoc":99,"text":"t_COLON"},{"attributeType":"null","col":0,"comment":"null","endLoc":100,"id":8683,"name":"t_ELLIPSIS","nodeType":"Attribute","startLoc":100,"text":"t_ELLIPSIS"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":8684,"name":"t_ID","nodeType":"Attribute","startLoc":103,"text":"t_ID"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":8685,"name":"t_INTEGER","nodeType":"Attribute","startLoc":106,"text":"t_INTEGER"},{"col":4,"comment":"null","endLoc":60,"header":"def __init__(self, message, s)","id":8686,"name":"__init__","nodeType":"Function","startLoc":58,"text":"def __init__(self, message, s):\n        self.args = (message,)\n        self.text = s"},{"attributeType":"null","col":0,"comment":"null","endLoc":109,"id":8687,"name":"t_FLOAT","nodeType":"Attribute","startLoc":109,"text":"t_FLOAT"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":8688,"name":"t_STRING","nodeType":"Attribute","startLoc":112,"text":"t_STRING"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":8689,"name":"args","nodeType":"Attribute","startLoc":59,"text":"self.args"},{"attributeType":"null","col":0,"comment":"null","endLoc":115,"id":8690,"name":"t_CHARACTER","nodeType":"Attribute","startLoc":115,"text":"t_CHARACTER"},{"col":0,"comment":"","endLoc":41,"header":"ctokens.py#<anonymous>","id":8691,"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":"null","endLoc":295,"header":"def errok(self)","id":8692,"name":"errok","nodeType":"Function","startLoc":294,"text":"def errok(self):\n        self.errorok = True"},{"col":4,"comment":"null","endLoc":303,"header":"def restart(self)","id":8693,"name":"restart","nodeType":"Function","startLoc":297,"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)"},{"fileName":"__init__.py","filePath":"astropy/extern/ply","id":8694,"nodeType":"File","text":"# PLY package\n# Author: David Beazley (dave@dabeaz.com)\n\n__version__ = '3.9'\n__all__ = ['lex','yacc']\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":8695,"name":"text","nodeType":"Attribute","startLoc":60,"text":"self.text"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":8696,"name":"__version__","nodeType":"Attribute","startLoc":4,"text":"__version__"},{"className":"LexToken","col":0,"comment":"null","endLoc":69,"id":8697,"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":8698,"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":8699,"name":"__repr__","nodeType":"Function","startLoc":68,"text":"def __repr__(self):\n        return str(self)"},{"className":"PlyLogger","col":0,"comment":"null","endLoc":89,"id":8700,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":8701,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":8702,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__version__ = '3.9'\n\n__all__ = ['lex','yacc']"},{"col":4,"comment":"null","endLoc":80,"header":"def critical(self, msg, *args, **kwargs)","id":8703,"name":"critical","nodeType":"Function","startLoc":79,"text":"def critical(self, msg, *args, **kwargs):\n        self.f.write((msg % args) + '\\n')"},{"fileName":"cpp.py","filePath":"astropy/extern/ply","id":8704,"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\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                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    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 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                    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\n\n\n\n\n\n\n\n\n\n\n"},{"col":4,"comment":"null","endLoc":83,"header":"def warning(self, msg, *args, **kwargs)","id":8705,"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":8706,"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":8707,"name":"info","nodeType":"Attribute","startLoc":88,"text":"info"},{"attributeType":"function","col":4,"comment":"null","endLoc":89,"id":8708,"name":"debug","nodeType":"Attribute","startLoc":89,"text":"debug"},{"attributeType":"null","col":8,"comment":"null","endLoc":77,"id":8709,"name":"f","nodeType":"Attribute","startLoc":77,"text":"self.f"},{"className":"NullLogger","col":0,"comment":"null","endLoc":98,"id":8710,"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":8711,"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":8712,"name":"__call__","nodeType":"Function","startLoc":97,"text":"def __call__(self, *args, **kwargs):\n        return self"},{"className":"Lexer","col":0,"comment":"null","endLoc":424,"id":8713,"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(self.lextokens)))\n            tf.write('_lexreflags   = %s\\n' % repr(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 | re.VERBOSE), _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":8714,"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":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":765,"header":"@classmethod\n    def _substitute_iers_b(cls, table)","id":8715,"name":"_substitute_iers_b","nodeType":"Function","startLoc":738,"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'][~table['UT1_UTC_B'].mask]\n        i0 = np.searchsorted(iers_b['MJD'].value, mjd_b[0], side='left')\n        i1 = np.searchsorted(iers_b['MJD'].value, 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 np.allclose(table['MJD'][:n_iers_b], iers_b['MJD'].value):\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'].value\n            table['PM_X_B'][:n_iers_b] = iers_b['PM_x'].value\n            table['PM_Y_B'][:n_iers_b] = iers_b['PM_y'].value\n\n        return table"},{"col":4,"comment":"null","endLoc":321,"header":"def disable_defaulted_states(self)","id":8716,"name":"disable_defaulted_states","nodeType":"Function","startLoc":320,"text":"def disable_defaulted_states(self):\n        self.defaulted_states = {}"},{"col":4,"comment":"null","endLoc":331,"header":"def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":8717,"name":"parse","nodeType":"Function","startLoc":323,"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)"},{"className":"Macro","col":0,"comment":"null","endLoc":149,"id":8718,"nodeType":"Class","startLoc":141,"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"},{"attributeType":"None","col":4,"comment":"null","endLoc":595,"id":8719,"name":"iers_table","nodeType":"Attribute","startLoc":595,"text":"iers_table"},{"attributeType":"None","col":12,"comment":"null","endLoc":620,"id":8720,"name":"iers_table","nodeType":"Attribute","startLoc":620,"text":"cls.iers_table"},{"col":4,"comment":"null","endLoc":206,"header":"def writetab(self, lextab, outputdir='')","id":8721,"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(self.lextokens)))\n            tf.write('_lexreflags   = %s\\n' % repr(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":"null","col":0,"comment":"null","endLoc":28,"id":8722,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":8723,"name":"IERS_A_FILE","nodeType":"Attribute","startLoc":37,"text":"IERS_A_FILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":8724,"name":"IERS_A_URL","nodeType":"Attribute","startLoc":38,"text":"IERS_A_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":8725,"name":"IERS_A_README","nodeType":"Attribute","startLoc":39,"text":"IERS_A_README"},{"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":451,"header":"def _validate_val(self, val)","id":8726,"name":"_validate_val","nodeType":"Function","startLoc":442,"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":8727,"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)"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":8728,"name":"IERS_B_FILE","nodeType":"Attribute","startLoc":42,"text":"IERS_B_FILE"},{"attributeType":"null","col":0,"comment":"null","endLoc":43,"id":8729,"name":"IERS_B_URL","nodeType":"Attribute","startLoc":43,"text":"IERS_B_URL"},{"attributeType":"null","col":0,"comment":"null","endLoc":44,"id":8730,"name":"IERS_B_README","nodeType":"Attribute","startLoc":44,"text":"IERS_B_README"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":8731,"name":"FROM_IERS_B","nodeType":"Attribute","startLoc":47,"text":"FROM_IERS_B"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":8732,"name":"FROM_IERS_A","nodeType":"Attribute","startLoc":48,"text":"FROM_IERS_A"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":8733,"name":"FROM_IERS_A_PREDICTION","nodeType":"Attribute","startLoc":49,"text":"FROM_IERS_A_PREDICTION"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":8734,"name":"TIME_BEFORE_IERS_RANGE","nodeType":"Attribute","startLoc":50,"text":"TIME_BEFORE_IERS_RANGE"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":8735,"name":"TIME_BEYOND_IERS_RANGE","nodeType":"Attribute","startLoc":51,"text":"TIME_BEYOND_IERS_RANGE"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":8736,"name":"MJD_ZERO","nodeType":"Attribute","startLoc":53,"text":"MJD_ZERO"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":8737,"name":"INTERPOLATE_ERROR","nodeType":"Attribute","startLoc":55,"text":"INTERPOLATE_ERROR"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":104,"id":8738,"name":"conf","nodeType":"Attribute","startLoc":104,"text":"conf"},{"col":0,"comment":"","endLoc":10,"header":"iers.py#<anonymous>","id":8739,"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\ntry:\n    from urlparse import urlparse\nexcept ImportError:\n    from urllib.parse import urlparse\n\n__all__ = ['Conf', 'conf',\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_README',\n           'IERS_B_FILE', 'IERS_B_URL', 'IERS_B_README',\n           'IERSRangeError', 'IERSStaleWarning']\n\nIERS_A_FILE = 'finals2000A.all'\n\nIERS_A_URL = 'http://maia.usno.navy.mil/ser7/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\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 {} 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\nconf = Conf()\n\nIERS.read = IERS_B.read"},{"id":8740,"name":"astropy/extern/bundled","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/extern/bundled","id":8741,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":149,"header":"def __init__(self,name,value,arglist=None,variadic=False)","id":8742,"name":"__init__","nodeType":"Function","startLoc":142,"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":145,"id":8743,"name":"arglist","nodeType":"Attribute","startLoc":145,"text":"self.arglist"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":8744,"name":"_pfunc","nodeType":"Attribute","startLoc":152,"text":"self._pfunc"},{"attributeType":"null","col":8,"comment":"null","endLoc":156,"id":8745,"name":"_cache_out","nodeType":"Attribute","startLoc":156,"text":"self._cache_out"},{"attributeType":"None","col":8,"comment":"null","endLoc":157,"id":8746,"name":"_fit_func","nodeType":"Attribute","startLoc":157,"text":"self._fit_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":155,"id":8747,"name":"_cache_est","nodeType":"Attribute","startLoc":155,"text":"self._cache_est"},{"attributeType":"None","col":8,"comment":"null","endLoc":158,"id":8748,"name":"_power","nodeType":"Attribute","startLoc":158,"text":"self._power"},{"attributeType":"null","col":12,"comment":"null","endLoc":148,"id":8749,"name":"vararg","nodeType":"Attribute","startLoc":148,"text":"self.vararg"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":8750,"name":"_cache_good","nodeType":"Attribute","startLoc":153,"text":"self._cache_good"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":8751,"name":"_funcname","nodeType":"Attribute","startLoc":151,"text":"self._funcname"},{"attributeType":"null","col":8,"comment":"null","endLoc":143,"id":8752,"name":"name","nodeType":"Attribute","startLoc":143,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":146,"id":8753,"name":"variadic","nodeType":"Attribute","startLoc":146,"text":"self.variadic"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":8754,"name":"_cache_bad","nodeType":"Attribute","startLoc":154,"text":"self._cache_bad"},{"attributeType":"null","col":16,"comment":"null","endLoc":11,"id":8755,"name":"np","nodeType":"Attribute","startLoc":11,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":14,"id":8756,"name":"u","nodeType":"Attribute","startLoc":14,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":8757,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":8758,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":20,"text":"__doctest_skip__"},{"col":0,"comment":"","endLoc":2,"header":"timer.py#<anonymous>","id":8759,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"General purpose timer related functions.\"\"\"\n\n__all__ = ['timefunc', 'RunTimePredictor']\n\n__doctest_skip__ = ['timefunc']"},{"attributeType":"None","col":8,"comment":"null","endLoc":149,"id":8760,"name":"source","nodeType":"Attribute","startLoc":149,"text":"self.source"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":8761,"name":"value","nodeType":"Attribute","startLoc":144,"text":"self.value"},{"fileName":"six.py","filePath":"astropy/extern/bundled","id":8762,"nodeType":"File","text":"\"\"\"Utilities for writing code that runs on Python 2 and 3\"\"\"\n\n# Copyright (c) 2010-2015 Benjamin Peterson\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 deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# 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 all\n# 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# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nfrom __future__ import absolute_import\n\nimport functools\nimport itertools\nimport operator\nimport sys\nimport types\n\n__author__ = \"Benjamin Peterson <benjamin@python.org>\"\n__version__ = \"1.10.0\"\n\n\n# Useful for very coarse version differentiation.\nPY2 = sys.version_info[0] == 2\nPY3 = sys.version_info[0] == 3\nPY34 = sys.version_info[0:2] >= (3, 4)\n\nif PY3:\n    string_types = str,\n    integer_types = int,\n    class_types = type,\n    text_type = str\n    binary_type = bytes\n\n    MAXSIZE = sys.maxsize\nelse:\n    string_types = basestring,\n    integer_types = (int, long)\n    class_types = (type, types.ClassType)\n    text_type = unicode\n    binary_type = str\n\n    if sys.platform.startswith(\"java\"):\n        # Jython always uses 32 bits.\n        MAXSIZE = int((1 << 31) - 1)\n    else:\n        # It's possible to have sizeof(long) != sizeof(Py_ssize_t).\n        class X(object):\n\n            def __len__(self):\n                return 1 << 31\n        try:\n            len(X())\n        except OverflowError:\n            # 32-bit\n            MAXSIZE = int((1 << 31) - 1)\n        else:\n            # 64-bit\n            MAXSIZE = int((1 << 63) - 1)\n        del X\n\n\ndef _add_doc(func, doc):\n    \"\"\"Add documentation to a function.\"\"\"\n    func.__doc__ = doc\n\n\ndef _import_module(name):\n    \"\"\"Import module, returning the module after the last dot.\"\"\"\n    __import__(name)\n    return sys.modules[name]\n\n\nclass _LazyDescr(object):\n\n    def __init__(self, name):\n        self.name = name\n\n    def __get__(self, obj, tp):\n        result = self._resolve()\n        setattr(obj, self.name, result)  # Invokes __set__.\n        try:\n            # This is a bit ugly, but it avoids running this again by\n            # removing this descriptor.\n            delattr(obj.__class__, self.name)\n        except AttributeError:\n            pass\n        return result\n\n\nclass MovedModule(_LazyDescr):\n\n    def __init__(self, name, old, new=None):\n        super(MovedModule, self).__init__(name)\n        if PY3:\n            if new is None:\n                new = name\n            self.mod = new\n        else:\n            self.mod = old\n\n    def _resolve(self):\n        return _import_module(self.mod)\n\n    def __getattr__(self, attr):\n        _module = self._resolve()\n        value = getattr(_module, attr)\n        setattr(self, attr, value)\n        return value\n\n\nclass _LazyModule(types.ModuleType):\n\n    def __init__(self, name):\n        super(_LazyModule, self).__init__(name)\n        self.__doc__ = self.__class__.__doc__\n\n    def __dir__(self):\n        attrs = [\"__doc__\", \"__name__\"]\n        attrs += [attr.name for attr in self._moved_attributes]\n        return attrs\n\n    # Subclasses should override this\n    _moved_attributes = []\n\n\nclass MovedAttribute(_LazyDescr):\n\n    def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):\n        super(MovedAttribute, self).__init__(name)\n        if PY3:\n            if new_mod is None:\n                new_mod = name\n            self.mod = new_mod\n            if new_attr is None:\n                if old_attr is None:\n                    new_attr = name\n                else:\n                    new_attr = old_attr\n            self.attr = new_attr\n        else:\n            self.mod = old_mod\n            if old_attr is None:\n                old_attr = name\n            self.attr = old_attr\n\n    def _resolve(self):\n        module = _import_module(self.mod)\n        return getattr(module, self.attr)\n\n\nclass _SixMetaPathImporter(object):\n\n    \"\"\"\n    A meta path importer to import six.moves and its submodules.\n\n    This class implements a PEP302 finder and loader. It should be compatible\n    with Python 2.5 and all existing versions of Python3\n    \"\"\"\n\n    def __init__(self, six_module_name):\n        self.name = six_module_name\n        self.known_modules = {}\n\n    def _add_module(self, mod, *fullnames):\n        for fullname in fullnames:\n            self.known_modules[self.name + \".\" + fullname] = mod\n\n    def _get_module(self, fullname):\n        return self.known_modules[self.name + \".\" + fullname]\n\n    def find_module(self, fullname, path=None):\n        if fullname in self.known_modules:\n            return self\n        return None\n\n    def __get_module(self, fullname):\n        try:\n            return self.known_modules[fullname]\n        except KeyError:\n            raise ImportError(\"This loader does not know module \" + fullname)\n\n    def load_module(self, fullname):\n        try:\n            # in case of a reload\n            return sys.modules[fullname]\n        except KeyError:\n            pass\n        mod = self.__get_module(fullname)\n        if isinstance(mod, MovedModule):\n            mod = mod._resolve()\n        else:\n            mod.__loader__ = self\n        sys.modules[fullname] = mod\n        return mod\n\n    def is_package(self, fullname):\n        \"\"\"\n        Return true, if the named module is a package.\n\n        We need this method to get correct spec objects with\n        Python 3.4 (see PEP451)\n        \"\"\"\n        return hasattr(self.__get_module(fullname), \"__path__\")\n\n    def get_code(self, fullname):\n        \"\"\"Return None\n\n        Required, if is_package is implemented\"\"\"\n        self.__get_module(fullname)  # eventually raises ImportError\n        return None\n    get_source = get_code  # same as get_code\n\n_importer = _SixMetaPathImporter(__name__)\n\n\nclass _MovedItems(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects\"\"\"\n    __path__ = []  # mark as package\n\n\n_moved_attributes = [\n    MovedAttribute(\"cStringIO\", \"cStringIO\", \"io\", \"StringIO\"),\n    MovedAttribute(\"filter\", \"itertools\", \"builtins\", \"ifilter\", \"filter\"),\n    MovedAttribute(\"filterfalse\", \"itertools\", \"itertools\", \"ifilterfalse\", \"filterfalse\"),\n    MovedAttribute(\"input\", \"__builtin__\", \"builtins\", \"raw_input\", \"input\"),\n    MovedAttribute(\"intern\", \"__builtin__\", \"sys\"),\n    MovedAttribute(\"map\", \"itertools\", \"builtins\", \"imap\", \"map\"),\n    MovedAttribute(\"getcwd\", \"os\", \"os\", \"getcwdu\", \"getcwd\"),\n    MovedAttribute(\"getcwdb\", \"os\", \"os\", \"getcwd\", \"getcwdb\"),\n    MovedAttribute(\"range\", \"__builtin__\", \"builtins\", \"xrange\", \"range\"),\n    MovedAttribute(\"reload_module\", \"__builtin__\", \"importlib\" if PY34 else \"imp\", \"reload\"),\n    MovedAttribute(\"reduce\", \"__builtin__\", \"functools\"),\n    MovedAttribute(\"shlex_quote\", \"pipes\", \"shlex\", \"quote\"),\n    MovedAttribute(\"StringIO\", \"StringIO\", \"io\"),\n    MovedAttribute(\"UserDict\", \"UserDict\", \"collections\"),\n    MovedAttribute(\"UserList\", \"UserList\", \"collections\"),\n    MovedAttribute(\"UserString\", \"UserString\", \"collections\"),\n    MovedAttribute(\"xrange\", \"__builtin__\", \"builtins\", \"xrange\", \"range\"),\n    MovedAttribute(\"zip\", \"itertools\", \"builtins\", \"izip\", \"zip\"),\n    MovedAttribute(\"zip_longest\", \"itertools\", \"itertools\", \"izip_longest\", \"zip_longest\"),\n    MovedModule(\"builtins\", \"__builtin__\"),\n    MovedModule(\"configparser\", \"ConfigParser\"),\n    MovedModule(\"copyreg\", \"copy_reg\"),\n    MovedModule(\"dbm_gnu\", \"gdbm\", \"dbm.gnu\"),\n    MovedModule(\"_dummy_thread\", \"dummy_thread\", \"_dummy_thread\"),\n    MovedModule(\"http_cookiejar\", \"cookielib\", \"http.cookiejar\"),\n    MovedModule(\"http_cookies\", \"Cookie\", \"http.cookies\"),\n    MovedModule(\"html_entities\", \"htmlentitydefs\", \"html.entities\"),\n    MovedModule(\"html_parser\", \"HTMLParser\", \"html.parser\"),\n    MovedModule(\"http_client\", \"httplib\", \"http.client\"),\n    MovedModule(\"email_mime_multipart\", \"email.MIMEMultipart\", \"email.mime.multipart\"),\n    MovedModule(\"email_mime_nonmultipart\", \"email.MIMENonMultipart\", \"email.mime.nonmultipart\"),\n    MovedModule(\"email_mime_text\", \"email.MIMEText\", \"email.mime.text\"),\n    MovedModule(\"email_mime_base\", \"email.MIMEBase\", \"email.mime.base\"),\n    MovedModule(\"BaseHTTPServer\", \"BaseHTTPServer\", \"http.server\"),\n    MovedModule(\"CGIHTTPServer\", \"CGIHTTPServer\", \"http.server\"),\n    MovedModule(\"SimpleHTTPServer\", \"SimpleHTTPServer\", \"http.server\"),\n    MovedModule(\"cPickle\", \"cPickle\", \"pickle\"),\n    MovedModule(\"queue\", \"Queue\"),\n    MovedModule(\"reprlib\", \"repr\"),\n    MovedModule(\"socketserver\", \"SocketServer\"),\n    MovedModule(\"_thread\", \"thread\", \"_thread\"),\n    MovedModule(\"tkinter\", \"Tkinter\"),\n    MovedModule(\"tkinter_dialog\", \"Dialog\", \"tkinter.dialog\"),\n    MovedModule(\"tkinter_filedialog\", \"FileDialog\", \"tkinter.filedialog\"),\n    MovedModule(\"tkinter_scrolledtext\", \"ScrolledText\", \"tkinter.scrolledtext\"),\n    MovedModule(\"tkinter_simpledialog\", \"SimpleDialog\", \"tkinter.simpledialog\"),\n    MovedModule(\"tkinter_tix\", \"Tix\", \"tkinter.tix\"),\n    MovedModule(\"tkinter_ttk\", \"ttk\", \"tkinter.ttk\"),\n    MovedModule(\"tkinter_constants\", \"Tkconstants\", \"tkinter.constants\"),\n    MovedModule(\"tkinter_dnd\", \"Tkdnd\", \"tkinter.dnd\"),\n    MovedModule(\"tkinter_colorchooser\", \"tkColorChooser\",\n                \"tkinter.colorchooser\"),\n    MovedModule(\"tkinter_commondialog\", \"tkCommonDialog\",\n                \"tkinter.commondialog\"),\n    MovedModule(\"tkinter_tkfiledialog\", \"tkFileDialog\", \"tkinter.filedialog\"),\n    MovedModule(\"tkinter_font\", \"tkFont\", \"tkinter.font\"),\n    MovedModule(\"tkinter_messagebox\", \"tkMessageBox\", \"tkinter.messagebox\"),\n    MovedModule(\"tkinter_tksimpledialog\", \"tkSimpleDialog\",\n                \"tkinter.simpledialog\"),\n    MovedModule(\"urllib_parse\", __name__ + \".moves.urllib_parse\", \"urllib.parse\"),\n    MovedModule(\"urllib_error\", __name__ + \".moves.urllib_error\", \"urllib.error\"),\n    MovedModule(\"urllib\", __name__ + \".moves.urllib\", __name__ + \".moves.urllib\"),\n    MovedModule(\"urllib_robotparser\", \"robotparser\", \"urllib.robotparser\"),\n    MovedModule(\"xmlrpc_client\", \"xmlrpclib\", \"xmlrpc.client\"),\n    MovedModule(\"xmlrpc_server\", \"SimpleXMLRPCServer\", \"xmlrpc.server\"),\n]\n# Add windows specific modules.\nif sys.platform == \"win32\":\n    _moved_attributes += [\n        MovedModule(\"winreg\", \"_winreg\"),\n    ]\n\nfor attr in _moved_attributes:\n    setattr(_MovedItems, attr.name, attr)\n    if isinstance(attr, MovedModule):\n        _importer._add_module(attr, \"moves.\" + attr.name)\ndel attr\n\n_MovedItems._moved_attributes = _moved_attributes\n\nmoves = _MovedItems(__name__ + \".moves\")\n_importer._add_module(moves, \"moves\")\n\n\nclass Module_six_moves_urllib_parse(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_parse\"\"\"\n\n\n_urllib_parse_moved_attributes = [\n    MovedAttribute(\"ParseResult\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"SplitResult\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"parse_qs\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"parse_qsl\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urldefrag\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urljoin\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlparse\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlsplit\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlunparse\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlunsplit\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"quote\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"quote_plus\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"unquote\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"unquote_plus\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"urlencode\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splitquery\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splittag\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splituser\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"uses_fragment\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_netloc\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_params\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_query\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_relative\", \"urlparse\", \"urllib.parse\"),\n]\nfor attr in _urllib_parse_moved_attributes:\n    setattr(Module_six_moves_urllib_parse, attr.name, attr)\ndel attr\n\nModule_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_parse(__name__ + \".moves.urllib_parse\"),\n                      \"moves.urllib_parse\", \"moves.urllib.parse\")\n\n\nclass Module_six_moves_urllib_error(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_error\"\"\"\n\n\n_urllib_error_moved_attributes = [\n    MovedAttribute(\"URLError\", \"urllib2\", \"urllib.error\"),\n    MovedAttribute(\"HTTPError\", \"urllib2\", \"urllib.error\"),\n    MovedAttribute(\"ContentTooShortError\", \"urllib\", \"urllib.error\"),\n]\nfor attr in _urllib_error_moved_attributes:\n    setattr(Module_six_moves_urllib_error, attr.name, attr)\ndel attr\n\nModule_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_error(__name__ + \".moves.urllib.error\"),\n                      \"moves.urllib_error\", \"moves.urllib.error\")\n\n\nclass Module_six_moves_urllib_request(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_request\"\"\"\n\n\n_urllib_request_moved_attributes = [\n    MovedAttribute(\"urlopen\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"install_opener\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"build_opener\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"pathname2url\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"url2pathname\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"getproxies\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"Request\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"OpenerDirector\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPDefaultErrorHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPRedirectHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPCookieProcessor\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"BaseHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPPasswordMgr\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPPasswordMgrWithDefaultRealm\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"AbstractBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"AbstractDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPSHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"FileHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"FTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"CacheFTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"UnknownHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPErrorProcessor\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"urlretrieve\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"urlcleanup\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"URLopener\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"FancyURLopener\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"proxy_bypass\", \"urllib\", \"urllib.request\"),\n]\nfor attr in _urllib_request_moved_attributes:\n    setattr(Module_six_moves_urllib_request, attr.name, attr)\ndel attr\n\nModule_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_request(__name__ + \".moves.urllib.request\"),\n                      \"moves.urllib_request\", \"moves.urllib.request\")\n\n\nclass Module_six_moves_urllib_response(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_response\"\"\"\n\n\n_urllib_response_moved_attributes = [\n    MovedAttribute(\"addbase\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addclosehook\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addinfo\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addinfourl\", \"urllib\", \"urllib.response\"),\n]\nfor attr in _urllib_response_moved_attributes:\n    setattr(Module_six_moves_urllib_response, attr.name, attr)\ndel attr\n\nModule_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_response(__name__ + \".moves.urllib.response\"),\n                      \"moves.urllib_response\", \"moves.urllib.response\")\n\n\nclass Module_six_moves_urllib_robotparser(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_robotparser\"\"\"\n\n\n_urllib_robotparser_moved_attributes = [\n    MovedAttribute(\"RobotFileParser\", \"robotparser\", \"urllib.robotparser\"),\n]\nfor attr in _urllib_robotparser_moved_attributes:\n    setattr(Module_six_moves_urllib_robotparser, attr.name, attr)\ndel attr\n\nModule_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + \".moves.urllib.robotparser\"),\n                      \"moves.urllib_robotparser\", \"moves.urllib.robotparser\")\n\n\nclass Module_six_moves_urllib(types.ModuleType):\n\n    \"\"\"Create a six.moves.urllib namespace that resembles the Python 3 namespace\"\"\"\n    __path__ = []  # mark as package\n    parse = _importer._get_module(\"moves.urllib_parse\")\n    error = _importer._get_module(\"moves.urllib_error\")\n    request = _importer._get_module(\"moves.urllib_request\")\n    response = _importer._get_module(\"moves.urllib_response\")\n    robotparser = _importer._get_module(\"moves.urllib_robotparser\")\n\n    def __dir__(self):\n        return ['parse', 'error', 'request', 'response', 'robotparser']\n\n_importer._add_module(Module_six_moves_urllib(__name__ + \".moves.urllib\"),\n                      \"moves.urllib\")\n\n\ndef add_move(move):\n    \"\"\"Add an item to six.moves.\"\"\"\n    setattr(_MovedItems, move.name, move)\n\n\ndef remove_move(name):\n    \"\"\"Remove item from six.moves.\"\"\"\n    try:\n        delattr(_MovedItems, name)\n    except AttributeError:\n        try:\n            del moves.__dict__[name]\n        except KeyError:\n            raise AttributeError(\"no such move, %r\" % (name,))\n\n\nif PY3:\n    _meth_func = \"__func__\"\n    _meth_self = \"__self__\"\n\n    _func_closure = \"__closure__\"\n    _func_code = \"__code__\"\n    _func_defaults = \"__defaults__\"\n    _func_globals = \"__globals__\"\nelse:\n    _meth_func = \"im_func\"\n    _meth_self = \"im_self\"\n\n    _func_closure = \"func_closure\"\n    _func_code = \"func_code\"\n    _func_defaults = \"func_defaults\"\n    _func_globals = \"func_globals\"\n\n\ntry:\n    advance_iterator = next\nexcept NameError:\n    def advance_iterator(it):\n        return it.next()\nnext = advance_iterator\n\n\ntry:\n    callable = callable\nexcept NameError:\n    def callable(obj):\n        return any(\"__call__\" in klass.__dict__ for klass in type(obj).__mro__)\n\n\nif PY3:\n    def get_unbound_function(unbound):\n        return unbound\n\n    create_bound_method = types.MethodType\n\n    def create_unbound_method(func, cls):\n        return func\n\n    Iterator = object\nelse:\n    def get_unbound_function(unbound):\n        return unbound.im_func\n\n    def create_bound_method(func, obj):\n        return types.MethodType(func, obj, obj.__class__)\n\n    def create_unbound_method(func, cls):\n        return types.MethodType(func, None, cls)\n\n    class Iterator(object):\n\n        def next(self):\n            return type(self).__next__(self)\n\n    callable = callable\n_add_doc(get_unbound_function,\n         \"\"\"Get the function out of a possibly unbound function\"\"\")\n\n\nget_method_function = operator.attrgetter(_meth_func)\nget_method_self = operator.attrgetter(_meth_self)\nget_function_closure = operator.attrgetter(_func_closure)\nget_function_code = operator.attrgetter(_func_code)\nget_function_defaults = operator.attrgetter(_func_defaults)\nget_function_globals = operator.attrgetter(_func_globals)\n\n\nif PY3:\n    def iterkeys(d, **kw):\n        return iter(d.keys(**kw))\n\n    def itervalues(d, **kw):\n        return iter(d.values(**kw))\n\n    def iteritems(d, **kw):\n        return iter(d.items(**kw))\n\n    def iterlists(d, **kw):\n        return iter(d.lists(**kw))\n\n    viewkeys = operator.methodcaller(\"keys\")\n\n    viewvalues = operator.methodcaller(\"values\")\n\n    viewitems = operator.methodcaller(\"items\")\nelse:\n    def iterkeys(d, **kw):\n        return d.iterkeys(**kw)\n\n    def itervalues(d, **kw):\n        return d.itervalues(**kw)\n\n    def iteritems(d, **kw):\n        return d.iteritems(**kw)\n\n    def iterlists(d, **kw):\n        return d.iterlists(**kw)\n\n    viewkeys = operator.methodcaller(\"viewkeys\")\n\n    viewvalues = operator.methodcaller(\"viewvalues\")\n\n    viewitems = operator.methodcaller(\"viewitems\")\n\n_add_doc(iterkeys, \"Return an iterator over the keys of a dictionary.\")\n_add_doc(itervalues, \"Return an iterator over the values of a dictionary.\")\n_add_doc(iteritems,\n         \"Return an iterator over the (key, value) pairs of a dictionary.\")\n_add_doc(iterlists,\n         \"Return an iterator over the (key, [values]) pairs of a dictionary.\")\n\n\nif PY3:\n    def b(s):\n        return s.encode(\"latin-1\")\n\n    def u(s):\n        return s\n    unichr = chr\n    import struct\n    int2byte = struct.Struct(\">B\").pack\n    del struct\n    byte2int = operator.itemgetter(0)\n    indexbytes = operator.getitem\n    iterbytes = iter\n    import io\n    StringIO = io.StringIO\n    BytesIO = io.BytesIO\n    _assertCountEqual = \"assertCountEqual\"\n    if sys.version_info[1] <= 1:\n        _assertRaisesRegex = \"assertRaisesRegexp\"\n        _assertRegex = \"assertRegexpMatches\"\n    else:\n        _assertRaisesRegex = \"assertRaisesRegex\"\n        _assertRegex = \"assertRegex\"\nelse:\n    def b(s):\n        return s\n    # Workaround for standalone backslash\n\n    def u(s):\n        return unicode(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n    unichr = unichr\n    int2byte = chr\n\n    def byte2int(bs):\n        return ord(bs[0])\n\n    def indexbytes(buf, i):\n        return ord(buf[i])\n    iterbytes = functools.partial(itertools.imap, ord)\n    import StringIO\n    StringIO = BytesIO = StringIO.StringIO\n    _assertCountEqual = \"assertItemsEqual\"\n    _assertRaisesRegex = \"assertRaisesRegexp\"\n    _assertRegex = \"assertRegexpMatches\"\n_add_doc(b, \"\"\"Byte literal\"\"\")\n_add_doc(u, \"\"\"Text literal\"\"\")\n\n\ndef assertCountEqual(self, *args, **kwargs):\n    return getattr(self, _assertCountEqual)(*args, **kwargs)\n\n\ndef assertRaisesRegex(self, *args, **kwargs):\n    return getattr(self, _assertRaisesRegex)(*args, **kwargs)\n\n\ndef assertRegex(self, *args, **kwargs):\n    return getattr(self, _assertRegex)(*args, **kwargs)\n\n\nif PY3:\n    exec_ = getattr(moves.builtins, \"exec\")\n\n    def reraise(tp, value, tb=None):\n        if value is None:\n            value = tp()\n        if value.__traceback__ is not tb:\n            raise value.with_traceback(tb)\n        raise value\n\nelse:\n    def exec_(_code_, _globs_=None, _locs_=None):\n        \"\"\"Execute code in a namespace.\"\"\"\n        if _globs_ is None:\n            frame = sys._getframe(1)\n            _globs_ = frame.f_globals\n            if _locs_ is None:\n                _locs_ = frame.f_locals\n            del frame\n        elif _locs_ is None:\n            _locs_ = _globs_\n        exec(\"\"\"exec _code_ in _globs_, _locs_\"\"\")\n\n    exec_(\"\"\"def reraise(tp, value, tb=None):\n    raise tp, value, tb\n\"\"\")\n\n\nif sys.version_info[:2] == (3, 2):\n    exec_(\"\"\"def raise_from(value, from_value):\n    if from_value is None:\n        raise value\n    raise value from from_value\n\"\"\")\nelif sys.version_info[:2] > (3, 2):\n    exec_(\"\"\"def raise_from(value, from_value):\n    raise value from from_value\n\"\"\")\nelse:\n    def raise_from(value, from_value):\n        raise value\n\n\nprint_ = getattr(moves.builtins, \"print\", None)\nif print_ is None:\n    def print_(*args, **kwargs):\n        \"\"\"The new-style print function for Python 2.4 and 2.5.\"\"\"\n        fp = kwargs.pop(\"file\", sys.stdout)\n        if fp is None:\n            return\n\n        def write(data):\n            if not isinstance(data, basestring):\n                data = str(data)\n            # If the file has an encoding, encode unicode with it.\n            if (isinstance(fp, file) and\n                    isinstance(data, unicode) and\n                    fp.encoding is not None):\n                errors = getattr(fp, \"errors\", None)\n                if errors is None:\n                    errors = \"strict\"\n                data = data.encode(fp.encoding, errors)\n            fp.write(data)\n        want_unicode = False\n        sep = kwargs.pop(\"sep\", None)\n        if sep is not None:\n            if isinstance(sep, unicode):\n                want_unicode = True\n            elif not isinstance(sep, str):\n                raise TypeError(\"sep must be None or a string\")\n        end = kwargs.pop(\"end\", None)\n        if end is not None:\n            if isinstance(end, unicode):\n                want_unicode = True\n            elif not isinstance(end, str):\n                raise TypeError(\"end must be None or a string\")\n        if kwargs:\n            raise TypeError(\"invalid keyword arguments to print()\")\n        if not want_unicode:\n            for arg in args:\n                if isinstance(arg, unicode):\n                    want_unicode = True\n                    break\n        if want_unicode:\n            newline = unicode(\"\\n\")\n            space = unicode(\" \")\n        else:\n            newline = \"\\n\"\n            space = \" \"\n        if sep is None:\n            sep = space\n        if end is None:\n            end = newline\n        for i, arg in enumerate(args):\n            if i:\n                write(sep)\n            write(arg)\n        write(end)\nif sys.version_info[:2] < (3, 3):\n    _print = print_\n\n    def print_(*args, **kwargs):\n        fp = kwargs.get(\"file\", sys.stdout)\n        flush = kwargs.pop(\"flush\", False)\n        _print(*args, **kwargs)\n        if flush and fp is not None:\n            fp.flush()\n\n_add_doc(reraise, \"\"\"Reraise an exception.\"\"\")\n\nif sys.version_info[0:2] < (3, 4):\n    def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n              updated=functools.WRAPPER_UPDATES):\n        def wrapper(f):\n            f = functools.wraps(wrapped, assigned, updated)(f)\n            f.__wrapped__ = wrapped\n            return f\n        return wrapper\nelse:\n    wraps = functools.wraps\n\n\ndef with_metaclass(meta, *bases):\n    \"\"\"Create a base class with a metaclass.\"\"\"\n    # This requires a bit of explanation: the basic idea is to make a dummy\n    # metaclass for one level of class instantiation that replaces itself with\n    # the actual metaclass.\n    class metaclass(meta):\n\n        def __new__(cls, name, this_bases, d):\n            return meta(name, bases, d)\n    return type.__new__(metaclass, 'temporary_class', (), {})\n\n\ndef add_metaclass(metaclass):\n    \"\"\"Class decorator for creating a class with a metaclass.\"\"\"\n    def wrapper(cls):\n        orig_vars = cls.__dict__.copy()\n        slots = orig_vars.get('__slots__')\n        if slots is not None:\n            if isinstance(slots, str):\n                slots = [slots]\n            for slots_var in slots:\n                orig_vars.pop(slots_var)\n        orig_vars.pop('__dict__', None)\n        orig_vars.pop('__weakref__', None)\n        return metaclass(cls.__name__, cls.__bases__, orig_vars)\n    return wrapper\n\n\ndef python_2_unicode_compatible(klass):\n    \"\"\"\n    A decorator that defines __unicode__ and __str__ methods under Python 2.\n    Under Python 3 it does nothing.\n\n    To support Python 2 and 3 with a single code base, define a __str__ method\n    returning text and apply this decorator to the class.\n    \"\"\"\n    if PY2:\n        if '__str__' not in klass.__dict__:\n            raise ValueError(\"@python_2_unicode_compatible cannot be applied \"\n                             \"to %s because it doesn't define __str__().\" %\n                             klass.__name__)\n        klass.__unicode__ = klass.__str__\n        klass.__str__ = lambda self: self.__unicode__().encode('utf-8')\n    return klass\n\n\n# Complete the moves implementation.\n# This code is at the end of this module to speed up module loading.\n# Turn this module into a package.\n__path__ = []  # required for PEP 302 and PEP 451\n__package__ = __name__  # see PEP 366 @ReservedAssignment\nif globals().get(\"__spec__\") is not None:\n    __spec__.submodule_search_locations = []  # PEP 451 @UndefinedVariable\n# Remove other six meta path importers, since they cause problems. This can\n# happen if six is removed from sys.modules and then reloaded. (Setuptools does\n# this for some reason.)\nif sys.meta_path:\n    for i, importer in enumerate(sys.meta_path):\n        # Here's some real nastiness: Another \"instance\" of the six module might\n        # be floating around. Therefore, we can't use isinstance() to check for\n        # the six meta path importer, since the other six instance will have\n        # inserted an importer with different class.\n        if (type(importer).__name__ == \"_SixMetaPathImporter\" and\n                importer.name == __name__):\n            del sys.meta_path[i]\n            break\n    del i, importer\n# Finally, add the importer to the meta path import hook.\nsys.meta_path.append(_importer)\n"},{"col":0,"comment":"null","endLoc":469,"header":"def _funcs_to_names(funclist, namelist)","id":8763,"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":648,"header":"def _parse_with_caching(self, check)","id":8764,"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"},{"className":"Preprocessor","col":0,"comment":"null","endLoc":890,"id":8765,"nodeType":"Class","startLoc":158,"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                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    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 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                    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"},{"id":8766,"name":"astropy/extern/configobj","nodeType":"Package"},{"fileName":"validate.py","filePath":"astropy/extern/configobj","id":8767,"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":697,"header":"def _parse_check(self, check)","id":8768,"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"},{"col":4,"comment":"null","endLoc":173,"header":"def __init__(self,lexer=None)","id":8769,"name":"__init__","nodeType":"Function","startLoc":159,"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"},{"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":8770,"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":8771,"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":8772,"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,))"},{"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":8773,"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,))"},{"className":"VdtParamError","col":0,"comment":"An incorrect parameter was passed","endLoc":395,"id":8774,"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))"},{"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":8775,"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))"},{"className":"VdtTypeError","col":0,"comment":"The value supplied was of the wrong type","endLoc":407,"id":8776,"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":8777,"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":8778,"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":8779,"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,))"},{"col":4,"comment":"null","endLoc":685,"header":"def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":8780,"name":"parsedebug","nodeType":"Function","startLoc":348,"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"},{"className":"VdtValueTooSmallError","col":0,"comment":"The value supplied was of the correct type, but was too small.","endLoc":431,"id":8781,"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":8782,"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":8783,"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":8784,"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":8785,"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":8786,"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":8787,"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":8788,"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,))"},{"col":4,"comment":"null","endLoc":246,"header":"def readtab(self, tabfile, fdict)","id":8789,"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 | re.VERBOSE), _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')"},{"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":8790,"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":"\n        >>> vtri = Validator()\n        ","endLoc":590,"header":"def __init__(self, functions=None)","id":8791,"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 = {}"},{"className":"X","col":8,"comment":"null","endLoc":63,"id":8792,"nodeType":"Class","startLoc":60,"text":"class X(object):\n\n            def __len__(self):\n                return 1 << 31"},{"col":4,"comment":"null","endLoc":634,"header":"def _handle_none(self, value)","id":8793,"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":0,"comment":"null","endLoc":484,"header":"def _names_to_funcs(namelist, fdict)","id":8794,"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"},{"col":4,"comment":"null","endLoc":260,"header":"def lexprobe(self)","id":8795,"name":"lexprobe","nodeType":"Function","startLoc":208,"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)"},{"col":12,"comment":"null","endLoc":63,"header":"def __len__(self)","id":8796,"name":"__len__","nodeType":"Function","startLoc":62,"text":"def __len__(self):\n                return 1 << 31"},{"className":"_LazyDescr","col":0,"comment":"null","endLoc":100,"id":8797,"nodeType":"Class","startLoc":86,"text":"class _LazyDescr(object):\n\n    def __init__(self, name):\n        self.name = name\n\n    def __get__(self, obj, tp):\n        result = self._resolve()\n        setattr(obj, self.name, result)  # Invokes __set__.\n        try:\n            # This is a bit ugly, but it avoids running this again by\n            # removing this descriptor.\n            delattr(obj.__class__, self.name)\n        except AttributeError:\n            pass\n        return result"},{"col":4,"comment":"null","endLoc":89,"header":"def __init__(self, name)","id":8798,"name":"__init__","nodeType":"Function","startLoc":88,"text":"def __init__(self, name):\n        self.name = name"},{"col":4,"comment":"null","endLoc":100,"header":"def __get__(self, obj, tp)","id":8799,"name":"__get__","nodeType":"Function","startLoc":91,"text":"def __get__(self, obj, tp):\n        result = self._resolve()\n        setattr(obj, self.name, result)  # Invokes __set__.\n        try:\n            # This is a bit ugly, but it avoids running this again by\n            # removing this descriptor.\n            delattr(obj.__class__, self.name)\n        except AttributeError:\n            pass\n        return result"},{"col":4,"comment":"Unquote a value if necessary.","endLoc":704,"header":"def _unquote(self, val)","id":8800,"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":4,"comment":"null","endLoc":657,"header":"def _check_value(self, value, fun_name, fun_args, fun_kwargs)","id":8801,"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":"Take apart a ``keyword=list('val, 'val')`` type string.","endLoc":714,"header":"def _list_handle(self, listmatch)","id":8802,"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":89,"id":8803,"name":"name","nodeType":"Attribute","startLoc":89,"text":"self.name"},{"col":4,"comment":"null","endLoc":271,"header":"def begin(self, state)","id":8804,"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"},{"col":4,"comment":"null","endLoc":258,"header":"def input(self, s)","id":8805,"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":8806,"name":"push_state","nodeType":"Function","startLoc":276,"text":"def push_state(self, state):\n        self.lexstatestack.append(self.lexstate)\n        self.begin(state)"},{"className":"MovedModule","col":0,"comment":"null","endLoc":121,"id":8807,"nodeType":"Class","startLoc":103,"text":"class MovedModule(_LazyDescr):\n\n    def __init__(self, name, old, new=None):\n        super(MovedModule, self).__init__(name)\n        if PY3:\n            if new is None:\n                new = name\n            self.mod = new\n        else:\n            self.mod = old\n\n    def _resolve(self):\n        return _import_module(self.mod)\n\n    def __getattr__(self, attr):\n        _module = self._resolve()\n        value = getattr(_module, attr)\n        setattr(self, attr, value)\n        return value"},{"col":4,"comment":"null","endLoc":284,"header":"def pop_state(self)","id":8808,"name":"pop_state","nodeType":"Function","startLoc":283,"text":"def pop_state(self):\n        self.begin(self.lexstatestack.pop())"},{"col":4,"comment":"null","endLoc":290,"header":"def current_state(self)","id":8809,"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":8810,"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":8811,"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":112,"header":"def __init__(self, name, old, new=None)","id":8812,"name":"__init__","nodeType":"Function","startLoc":105,"text":"def __init__(self, name, old, new=None):\n        super(MovedModule, self).__init__(name)\n        if PY3:\n            if new is None:\n                new = name\n            self.mod = new\n        else:\n            self.mod = old"},{"col":4,"comment":"null","endLoc":268,"header":"def __set__(self, obj, value)","id":8813,"name":"__set__","nodeType":"Function","startLoc":267,"text":"def __set__(self, obj, value):\n        return self.set(value)"},{"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":8814,"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":8815,"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)"},{"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":300,"header":"def set(self, value)","id":8816,"name":"set","nodeType":"Function","startLoc":275,"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)\n\n        sec[self.name] = value"},{"col":4,"comment":"null","endLoc":273,"header":"def __get__(self, obj, objtype=None)","id":8817,"name":"__get__","nodeType":"Function","startLoc":270,"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\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        ","endLoc":440,"header":"def __call__(self)","id":8818,"name":"__call__","nodeType":"Function","startLoc":375,"text":"def __call__(self):\n        \"\"\" Returns the value of this ``ConfigItem``\n\n        Returns\n        -------\n        val\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        def section_name(section):\n            if section == '':\n                return 'at the top-level'\n            else:\n                return 'in section [{0}]'.format(section)\n\n        options = []\n        sec = get_config(self.module)\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)\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 '{0}' {1} of the file '{2}' \"\n                    \"is deprecated. Use '{3}' {4} instead.\".format(\n                        name, section_name(module), get_config_filename(filename),\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 '{0}' {1} of the file '{2}' is \"\n                \"given by more than one alias ({3}). Using the first.\".format(\n                    self.name, section_name(sec), get_config_filename(filename),\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":"null","endLoc":854,"header":"def define(self,tokens)","id":8819,"name":"define","nodeType":"Function","startLoc":792,"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":"null","endLoc":156,"header":"def format_stack_entry(r)","id":8820,"name":"format_stack_entry","nodeType":"Function","startLoc":149,"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))"},{"col":4,"comment":"null","endLoc":115,"header":"def _resolve(self)","id":8821,"name":"_resolve","nodeType":"Function","startLoc":114,"text":"def _resolve(self):\n        return _import_module(self.mod)"},{"col":4,"comment":"null","endLoc":188,"header":"def tokenize(self,text)","id":8822,"name":"tokenize","nodeType":"Function","startLoc":181,"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":0,"comment":"Import module, returning the module after the last dot.","endLoc":83,"header":"def _import_module(name)","id":8823,"name":"_import_module","nodeType":"Function","startLoc":80,"text":"def _import_module(name):\n    \"\"\"Import module, returning the module after the last dot.\"\"\"\n    __import__(name)\n    return sys.modules[name]"},{"col":4,"comment":"null","endLoc":121,"header":"def __getattr__(self, attr)","id":8824,"name":"__getattr__","nodeType":"Function","startLoc":117,"text":"def __getattr__(self, attr):\n        _module = self._resolve()\n        value = getattr(_module, attr)\n        setattr(self, attr, value)\n        return value"},{"col":0,"comment":"null","endLoc":146,"header":"def format_result(r)","id":8825,"name":"format_result","nodeType":"Function","startLoc":139,"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":"\n    Get the filename of the config file associated with the given\n    package or module.\n    ","endLoc":467,"header":"def get_config_filename(packageormod=None)","id":8827,"name":"get_config_filename","nodeType":"Function","startLoc":459,"text":"def get_config_filename(packageormod=None):\n    \"\"\"\n    Get the filename of the config file associated with the given\n    package or module.\n    \"\"\"\n    cfg = get_config(packageormod)\n    while cfg.parent is not cfg:\n        cfg = cfg.parent\n    return cfg.filename"},{"col":4,"comment":"null","endLoc":322,"header":"def tokenstrip(self,tokens)","id":8828,"name":"tokenstrip","nodeType":"Function","startLoc":313,"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":"\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":328,"header":"@contextmanager\n    def set_temp(self, value)","id":8829,"name":"set_temp","nodeType":"Function","startLoc":302,"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":4,"comment":" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val\n            The new value loaded from the configuration file.\n        ","endLoc":356,"header":"def reload(self)","id":8830,"name":"reload","nodeType":"Function","startLoc":330,"text":"def reload(self):\n        \"\"\" Reloads the value of this ``ConfigItem`` from the relevant\n        configuration file.\n\n        Returns\n        -------\n        val\n            The new value loaded from the configuration file.\n        \"\"\"\n        self.set(self.defaultvalue)\n        baseobj = get_config(self.module, True)\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":4,"comment":"null","endLoc":384,"header":"def collect_args(self,tokenlist)","id":8831,"name":"collect_args","nodeType":"Function","startLoc":341,"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, [],[]"},{"attributeType":"null","col":4,"comment":"null","endLoc":545,"id":8832,"name":"_func_re","nodeType":"Attribute","startLoc":545,"text":"_func_re"},{"attributeType":"null","col":4,"comment":"null","endLoc":548,"id":8833,"name":"_key_arg","nodeType":"Attribute","startLoc":548,"text":"_key_arg"},{"attributeType":"null","col":4,"comment":"null","endLoc":552,"id":8834,"name":"_list_arg","nodeType":"Attribute","startLoc":552,"text":"_list_arg"},{"attributeType":"null","col":4,"comment":"null","endLoc":555,"id":8835,"name":"_list_members","nodeType":"Attribute","startLoc":555,"text":"_list_members"},{"attributeType":"null","col":4,"comment":"null","endLoc":559,"id":8836,"name":"_paramfinder","nodeType":"Attribute","startLoc":559,"text":"_paramfinder"},{"attributeType":"null","col":4,"comment":"null","endLoc":560,"id":8837,"name":"_matchfinder","nodeType":"Attribute","startLoc":560,"text":"_matchfinder"},{"attributeType":"null","col":8,"comment":"null","endLoc":567,"id":8838,"name":"functions","nodeType":"Attribute","startLoc":567,"text":"self.functions"},{"attributeType":"null","col":8,"comment":"null","endLoc":590,"id":8839,"name":"_cache","nodeType":"Attribute","startLoc":590,"text":"self._cache"},{"attributeType":"ValidateError","col":8,"comment":"null","endLoc":589,"id":8840,"name":"baseErrorClass","nodeType":"Attribute","startLoc":589,"text":"self.baseErrorClass"},{"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":8841,"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":"A version of ``get`` that doesn't bypass string interpolation.","endLoc":643,"header":"def get(self, key, default=None)","id":8842,"name":"get","nodeType":"Function","startLoc":638,"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":361,"header":"def __repr__(self)","id":8843,"name":"__repr__","nodeType":"Function","startLoc":358,"text":"def __repr__(self):\n        out = '<{0}: name={1!r} value={2!r} at 0x{3:x}>'.format(\n            self.__class__.__name__, self.name, self(), id(self))\n        return out"},{"col":4,"comment":"null","endLoc":373,"header":"def __str__(self)","id":8844,"name":"__str__","nodeType":"Function","startLoc":363,"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"},{"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":8845,"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)"},{"attributeType":"Validator","col":4,"comment":"null","endLoc":213,"id":8846,"name":"_validator","nodeType":"Attribute","startLoc":213,"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":214,"id":8847,"name":"cfgtype","nodeType":"Attribute","startLoc":214,"text":"cfgtype"},{"attributeType":"null","col":12,"comment":"null","endLoc":265,"id":8848,"name":"aliases","nodeType":"Attribute","startLoc":265,"text":"self.aliases"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":8849,"name":"module","nodeType":"Attribute","startLoc":233,"text":"self.module"},{"attributeType":"None","col":8,"comment":"null","endLoc":255,"id":8850,"name":"cfgtype","nodeType":"Attribute","startLoc":255,"text":"self.cfgtype"},{"attributeType":"null","col":12,"comment":"null","endLoc":112,"id":8851,"name":"mod","nodeType":"Attribute","startLoc":112,"text":"self.mod"},{"className":"_LazyModule","col":0,"comment":"null","endLoc":136,"id":8852,"nodeType":"Class","startLoc":124,"text":"class _LazyModule(types.ModuleType):\n\n    def __init__(self, name):\n        super(_LazyModule, self).__init__(name)\n        self.__doc__ = self.__class__.__doc__\n\n    def __dir__(self):\n        attrs = [\"__doc__\", \"__name__\"]\n        attrs += [attr.name for attr in self._moved_attributes]\n        return attrs\n\n    # Subclasses should override this\n    _moved_attributes = []"},{"col":4,"comment":"null","endLoc":197,"header":"def error(self,file,line,msg)","id":8853,"name":"error","nodeType":"Function","startLoc":196,"text":"def error(self,file,line,msg):\n        print(\"%s:%d %s\" % (file,line,msg))"},{"col":4,"comment":"null","endLoc":128,"header":"def __init__(self, name)","id":8854,"name":"__init__","nodeType":"Function","startLoc":126,"text":"def __init__(self, name):\n        super(_LazyModule, self).__init__(name)\n        self.__doc__ = self.__class__.__doc__"},{"col":4,"comment":"null","endLoc":416,"header":"def __iter__(self)","id":8855,"name":"__iter__","nodeType":"Function","startLoc":415,"text":"def __iter__(self):\n        return self"},{"col":4,"comment":"null","endLoc":422,"header":"def next(self)","id":8856,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":234,"id":8857,"name":"description","nodeType":"Attribute","startLoc":234,"text":"self.description"},{"attributeType":"null","col":8,"comment":"null","endLoc":235,"id":8858,"name":"__doc__","nodeType":"Attribute","startLoc":235,"text":"self.__doc__"},{"col":4,"comment":"null","endLoc":133,"header":"def __dir__(self)","id":8859,"name":"__dir__","nodeType":"Function","startLoc":130,"text":"def __dir__(self):\n        attrs = [\"__doc__\", \"__name__\"]\n        attrs += [attr.name for attr in self._moved_attributes]\n        return attrs"},{"attributeType":"null","col":4,"comment":"null","endLoc":136,"id":8860,"name":"_moved_attributes","nodeType":"Attribute","startLoc":136,"text":"_moved_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":8861,"name":"__doc__","nodeType":"Attribute","startLoc":128,"text":"self.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":258,"id":8862,"name":"defaultvalue","nodeType":"Attribute","startLoc":258,"text":"self.defaultvalue"},{"className":"MovedAttribute","col":0,"comment":"null","endLoc":161,"id":8863,"nodeType":"Class","startLoc":139,"text":"class MovedAttribute(_LazyDescr):\n\n    def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):\n        super(MovedAttribute, self).__init__(name)\n        if PY3:\n            if new_mod is None:\n                new_mod = name\n            self.mod = new_mod\n            if new_attr is None:\n                if old_attr is None:\n                    new_attr = name\n                else:\n                    new_attr = old_attr\n            self.attr = new_attr\n        else:\n            self.mod = old_mod\n            if old_attr is None:\n                old_attr = name\n            self.attr = old_attr\n\n    def _resolve(self):\n        module = _import_module(self.mod)\n        return getattr(module, self.attr)"},{"attributeType":"function","col":4,"comment":"null","endLoc":424,"id":8864,"name":"__next__","nodeType":"Attribute","startLoc":424,"text":"__next__"},{"col":4,"comment":"null","endLoc":157,"header":"def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None)","id":8865,"name":"__init__","nodeType":"Function","startLoc":141,"text":"def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):\n        super(MovedAttribute, self).__init__(name)\n        if PY3:\n            if new_mod is None:\n                new_mod = name\n            self.mod = new_mod\n            if new_attr is None:\n                if old_attr is None:\n                    new_attr = name\n                else:\n                    new_attr = old_attr\n            self.attr = new_attr\n        else:\n            self.mod = old_mod\n            if old_attr is None:\n                old_attr = name\n            self.attr = old_attr"},{"attributeType":"null","col":16,"comment":"null","endLoc":347,"id":8866,"name":"lexmatch","nodeType":"Attribute","startLoc":347,"text":"self.lexmatch"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":8867,"name":"lexlen","nodeType":"Attribute","startLoc":134,"text":"self.lexlen"},{"attributeType":"null","col":8,"comment":"null","endLoc":128,"id":8868,"name":"lexstateignore","nodeType":"Attribute","startLoc":128,"text":"self.lexstateignore"},{"attributeType":"null","col":8,"comment":"null","endLoc":133,"id":8869,"name":"lexpos","nodeType":"Attribute","startLoc":133,"text":"self.lexpos"},{"attributeType":"None","col":8,"comment":"null","endLoc":135,"id":8870,"name":"lexerrorf","nodeType":"Attribute","startLoc":135,"text":"self.lexerrorf"},{"attributeType":"None","col":8,"comment":"null","endLoc":136,"id":8871,"name":"lexeoff","nodeType":"Attribute","startLoc":136,"text":"self.lexeoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":131,"id":8872,"name":"lexreflags","nodeType":"Attribute","startLoc":131,"text":"self.lexreflags"},{"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":8873,"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"},{"attributeType":"None","col":8,"comment":"null","endLoc":132,"id":8874,"name":"lexdata","nodeType":"Attribute","startLoc":132,"text":"self.lexdata"},{"attributeType":"None","col":8,"comment":"null","endLoc":127,"id":8875,"name":"lexstateinfo","nodeType":"Attribute","startLoc":127,"text":"self.lexstateinfo"},{"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    ","endLoc":571,"header":"def reload_config(packageormod=None)","id":8876,"name":"reload_config","nodeType":"Function","startLoc":552,"text":"def reload_config(packageormod=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    \"\"\"\n    sec = get_config(packageormod, True)\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()"},{"attributeType":"None","col":8,"comment":"null","endLoc":121,"id":8877,"name":"lexretext","nodeType":"Attribute","startLoc":121,"text":"self.lexretext"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":8878,"name":"lexstaterenames","nodeType":"Attribute","startLoc":124,"text":"self.lexstaterenames"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":8879,"name":"lexstateretext","nodeType":"Attribute","startLoc":123,"text":"self.lexstateretext"},{"attributeType":"None","col":8,"comment":"null","endLoc":137,"id":8880,"name":"lextokens","nodeType":"Attribute","startLoc":137,"text":"self.lextokens"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":8881,"name":"lexstateerrorf","nodeType":"Attribute","startLoc":129,"text":"self.lexstateerrorf"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":8882,"name":"lexignore","nodeType":"Attribute","startLoc":138,"text":"self.lexignore"},{"attributeType":"None","col":8,"comment":"null","endLoc":140,"id":8883,"name":"lexmodule","nodeType":"Attribute","startLoc":140,"text":"self.lexmodule"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":8884,"name":"lexliterals","nodeType":"Attribute","startLoc":139,"text":"self.lexliterals"},{"col":0,"comment":"null","endLoc":198,"header":"def call_errorfunc(errorfunc, token, parser)","id":8885,"name":"call_errorfunc","nodeType":"Function","startLoc":188,"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":161,"header":"def _resolve(self)","id":8886,"name":"_resolve","nodeType":"Function","startLoc":159,"text":"def _resolve(self):\n        module = _import_module(self.mod)\n        return getattr(module, self.attr)"},{"attributeType":"null","col":8,"comment":"null","endLoc":142,"id":8887,"name":"lexoptimize","nodeType":"Attribute","startLoc":142,"text":"self.lexoptimize"},{"attributeType":"null","col":8,"comment":"null","endLoc":126,"id":8888,"name":"lexstatestack","nodeType":"Attribute","startLoc":126,"text":"self.lexstatestack"},{"attributeType":"null","col":8,"comment":"null","endLoc":130,"id":8889,"name":"lexstateeoff","nodeType":"Attribute","startLoc":130,"text":"self.lexstateeoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":8890,"name":"lexstatere","nodeType":"Attribute","startLoc":122,"text":"self.lexstatere"},{"attributeType":"None","col":8,"comment":"null","endLoc":117,"id":8891,"name":"lexre","nodeType":"Attribute","startLoc":117,"text":"self.lexre"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":8892,"name":"lineno","nodeType":"Attribute","startLoc":141,"text":"self.lineno"},{"attributeType":"null","col":12,"comment":"null","endLoc":154,"id":8893,"name":"mod","nodeType":"Attribute","startLoc":154,"text":"self.mod"},{"attributeType":"null","col":8,"comment":"null","endLoc":125,"id":8894,"name":"lexstate","nodeType":"Attribute","startLoc":125,"text":"self.lexstate"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":8895,"name":"lextokens_all","nodeType":"Attribute","startLoc":224,"text":"self.lextokens_all"},{"attributeType":"null","col":12,"comment":"null","endLoc":157,"id":8896,"name":"attr","nodeType":"Attribute","startLoc":157,"text":"self.attr"},{"className":"LexerReflect","col":0,"comment":"null","endLoc":856,"id":8897,"nodeType":"Class","startLoc":558,"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)), re.VERBOSE | 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), re.VERBOSE | 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"},{"className":"_SixMetaPathImporter","col":0,"comment":"\n    A meta path importer to import six.moves and its submodules.\n\n    This class implements a PEP302 finder and loader. It should be compatible\n    with Python 2.5 and all existing versions of Python3\n    ","endLoc":224,"id":8898,"nodeType":"Class","startLoc":164,"text":"class _SixMetaPathImporter(object):\n\n    \"\"\"\n    A meta path importer to import six.moves and its submodules.\n\n    This class implements a PEP302 finder and loader. It should be compatible\n    with Python 2.5 and all existing versions of Python3\n    \"\"\"\n\n    def __init__(self, six_module_name):\n        self.name = six_module_name\n        self.known_modules = {}\n\n    def _add_module(self, mod, *fullnames):\n        for fullname in fullnames:\n            self.known_modules[self.name + \".\" + fullname] = mod\n\n    def _get_module(self, fullname):\n        return self.known_modules[self.name + \".\" + fullname]\n\n    def find_module(self, fullname, path=None):\n        if fullname in self.known_modules:\n            return self\n        return None\n\n    def __get_module(self, fullname):\n        try:\n            return self.known_modules[fullname]\n        except KeyError:\n            raise ImportError(\"This loader does not know module \" + fullname)\n\n    def load_module(self, fullname):\n        try:\n            # in case of a reload\n            return sys.modules[fullname]\n        except KeyError:\n            pass\n        mod = self.__get_module(fullname)\n        if isinstance(mod, MovedModule):\n            mod = mod._resolve()\n        else:\n            mod.__loader__ = self\n        sys.modules[fullname] = mod\n        return mod\n\n    def is_package(self, fullname):\n        \"\"\"\n        Return true, if the named module is a package.\n\n        We need this method to get correct spec objects with\n        Python 3.4 (see PEP451)\n        \"\"\"\n        return hasattr(self.__get_module(fullname), \"__path__\")\n\n    def get_code(self, fullname):\n        \"\"\"Return None\n\n        Required, if is_package is implemented\"\"\"\n        self.__get_module(fullname)  # eventually raises ImportError\n        return None\n    get_source = get_code  # same as get_code"},{"col":4,"comment":"null","endLoc":175,"header":"def __init__(self, six_module_name)","id":8899,"name":"__init__","nodeType":"Function","startLoc":173,"text":"def __init__(self, six_module_name):\n        self.name = six_module_name\n        self.known_modules = {}"},{"col":4,"comment":"null","endLoc":179,"header":"def _add_module(self, mod, *fullnames)","id":8900,"name":"_add_module","nodeType":"Function","startLoc":177,"text":"def _add_module(self, mod, *fullnames):\n        for fullname in fullnames:\n            self.known_modules[self.name + \".\" + fullname] = mod"},{"col":4,"comment":"null","endLoc":182,"header":"def _get_module(self, fullname)","id":8901,"name":"_get_module","nodeType":"Function","startLoc":181,"text":"def _get_module(self, fullname):\n        return self.known_modules[self.name + \".\" + fullname]"},{"col":4,"comment":"null","endLoc":187,"header":"def find_module(self, fullname, path=None)","id":8902,"name":"find_module","nodeType":"Function","startLoc":184,"text":"def find_module(self, fullname, path=None):\n        if fullname in self.known_modules:\n            return self\n        return None"},{"col":4,"comment":"null","endLoc":193,"header":"def __get_module(self, fullname)","id":8903,"name":"__get_module","nodeType":"Function","startLoc":189,"text":"def __get_module(self, fullname):\n        try:\n            return self.known_modules[fullname]\n        except KeyError:\n            raise ImportError(\"This loader does not know module \" + fullname)"},{"col":4,"comment":"null","endLoc":207,"header":"def load_module(self, fullname)","id":8904,"name":"load_module","nodeType":"Function","startLoc":195,"text":"def load_module(self, fullname):\n        try:\n            # in case of a reload\n            return sys.modules[fullname]\n        except KeyError:\n            pass\n        mod = self.__get_module(fullname)\n        if isinstance(mod, MovedModule):\n            mod = mod._resolve()\n        else:\n            mod.__loader__ = self\n        sys.modules[fullname] = mod\n        return mod"},{"col":4,"comment":"null","endLoc":574,"header":"def get_all(self)","id":8905,"name":"get_all","nodeType":"Function","startLoc":570,"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":601,"header":"def get_tokens(self)","id":8906,"name":"get_tokens","nodeType":"Function","startLoc":584,"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":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":8907,"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":"\n        Return true, if the named module is a package.\n\n        We need this method to get correct spec objects with\n        Python 3.4 (see PEP451)\n        ","endLoc":216,"header":"def is_package(self, fullname)","id":8908,"name":"is_package","nodeType":"Function","startLoc":209,"text":"def is_package(self, fullname):\n        \"\"\"\n        Return true, if the named module is a package.\n\n        We need this method to get correct spec objects with\n        Python 3.4 (see PEP451)\n        \"\"\"\n        return hasattr(self.__get_module(fullname), \"__path__\")"},{"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":2365,"header":"def reload(self)","id":8909,"name":"reload","nodeType":"Function","startLoc":2343,"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)"},{"col":4,"comment":"Return None\n\n        Required, if is_package is implemented","endLoc":223,"header":"def get_code(self, fullname)","id":8910,"name":"get_code","nodeType":"Function","startLoc":218,"text":"def get_code(self, fullname):\n        \"\"\"Return None\n\n        Required, if is_package is implemented\"\"\"\n        self.__get_module(fullname)  # eventually raises ImportError\n        return None"},{"col":4,"comment":"null","endLoc":238,"header":"def __init__(self)","id":8911,"name":"__init__","nodeType":"Function","startLoc":237,"text":"def __init__(self):\n        IOError.__init__(self, 'reload failed, filename is not set.')"},{"attributeType":"function","col":4,"comment":"null","endLoc":224,"id":8912,"name":"get_source","nodeType":"Attribute","startLoc":224,"text":"get_source"},{"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":696,"header":"def clear(self)","id":8913,"name":"clear","nodeType":"Function","startLoc":681,"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 = []"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":8914,"name":"name","nodeType":"Attribute","startLoc":174,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":175,"id":8915,"name":"known_modules","nodeType":"Attribute","startLoc":175,"text":"self.known_modules"},{"className":"_MovedItems","col":0,"comment":"Lazy loading of moved objects","endLoc":232,"id":8916,"nodeType":"Class","startLoc":229,"text":"class _MovedItems(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects\"\"\"\n    __path__ = []  # mark as package"},{"col":4,"comment":"null","endLoc":618,"header":"def get_literals(self)","id":8917,"name":"get_literals","nodeType":"Function","startLoc":615,"text":"def get_literals(self):\n        self.literals = self.ldict.get('literals', '')\n        if not self.literals:\n            self.literals = ''"},{"attributeType":"null","col":4,"comment":"null","endLoc":232,"id":8918,"name":"__path__","nodeType":"Attribute","startLoc":232,"text":"__path__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":8919,"name":"__all__","nodeType":"Attribute","startLoc":27,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":456,"id":8920,"name":"_cfgobjs","nodeType":"Attribute","startLoc":456,"text":"_cfgobjs"},{"attributeType":"None","col":0,"comment":"null","endLoc":473,"id":8921,"name":"_override_config_file","nodeType":"Attribute","startLoc":473,"text":"_override_config_file"},{"col":4,"comment":"null","endLoc":658,"header":"def get_states(self)","id":8922,"name":"get_states","nodeType":"Function","startLoc":632,"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":0,"comment":"","endLoc":10,"header":"configuration.py#<anonymous>","id":8923,"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 http://www.voidspace.org.uk/python/configobj.html.\n\"\"\"\n\n__all__ = ['InvalidConfigurationItemWarning',\n           'ConfigurationMissingWarning', 'get_config',\n           'reload_config', 'ConfigNamespace', 'ConfigItem']\n\n_cfgobjs = {}\n\n_override_config_file = None"},{"fileName":"__init__.py","filePath":"astropy/extern/configobj","id":8924,"nodeType":"File","text":""},{"fileName":"configobj.py","filePath":"astropy/extern/configobj","id":8925,"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\nimport collections\n\nfrom codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE\n\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, collections.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], collections.Mapping) and\n                                isinstance(val, collections.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 unrecognised 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('Unrecognised 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), collections.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":137,"id":8926,"nodeType":"Class","startLoc":136,"text":"class UnknownType(Exception):\n    pass"},{"className":"Builder","col":0,"comment":"null","endLoc":192,"id":8927,"nodeType":"Class","startLoc":140,"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":145,"header":"def build(self, o)","id":8928,"name":"build","nodeType":"Function","startLoc":142,"text":"def build(self, o):\n        if m is None:\n            raise UnknownType(o.__class__.__name__)\n        return m(o)"},{"col":4,"comment":"null","endLoc":148,"header":"def build_List(self, o)","id":8929,"name":"build_List","nodeType":"Function","startLoc":147,"text":"def build_List(self, o):\n        return list(map(self.build, o.getChildren()))"},{"className":"Module_six_moves_urllib_parse","col":0,"comment":"Lazy loading of moved objects in six.moves.urllib_parse","endLoc":322,"id":8930,"nodeType":"Class","startLoc":320,"text":"class Module_six_moves_urllib_parse(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_parse\"\"\""},{"className":"Module_six_moves_urllib_error","col":0,"comment":"Lazy loading of moved objects in six.moves.urllib_error","endLoc":362,"id":8931,"nodeType":"Class","startLoc":360,"text":"class Module_six_moves_urllib_error(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_error\"\"\""},{"className":"Module_six_moves_urllib_request","col":0,"comment":"Lazy loading of moved objects in six.moves.urllib_request","endLoc":382,"id":8932,"nodeType":"Class","startLoc":380,"text":"class Module_six_moves_urllib_request(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_request\"\"\""},{"col":4,"comment":"null","endLoc":151,"header":"def build_Const(self, o)","id":8933,"name":"build_Const","nodeType":"Function","startLoc":150,"text":"def build_Const(self, o):\n        return o.value"},{"col":4,"comment":"null","endLoc":158,"header":"def build_Dict(self, o)","id":8934,"name":"build_Dict","nodeType":"Function","startLoc":153,"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"},{"className":"Module_six_moves_urllib_response","col":0,"comment":"Lazy loading of moved objects in six.moves.urllib_response","endLoc":432,"id":8935,"nodeType":"Class","startLoc":430,"text":"class Module_six_moves_urllib_response(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_response\"\"\""},{"className":"Module_six_moves_urllib_robotparser","col":0,"comment":"Lazy loading of moved objects in six.moves.urllib_robotparser","endLoc":453,"id":8936,"nodeType":"Class","startLoc":451,"text":"class Module_six_moves_urllib_robotparser(_LazyModule):\n\n    \"\"\"Lazy loading of moved objects in six.moves.urllib_robotparser\"\"\""},{"col":4,"comment":"null","endLoc":161,"header":"def build_Tuple(self, o)","id":8937,"name":"build_Tuple","nodeType":"Function","startLoc":160,"text":"def build_Tuple(self, o):\n        return tuple(self.build_List(o))"},{"className":"Module_six_moves_urllib","col":0,"comment":"Create a six.moves.urllib namespace that resembles the Python 3 namespace","endLoc":480,"id":8938,"nodeType":"Class","startLoc":469,"text":"class Module_six_moves_urllib(types.ModuleType):\n\n    \"\"\"Create a six.moves.urllib namespace that resembles the Python 3 namespace\"\"\"\n    __path__ = []  # mark as package\n    parse = _importer._get_module(\"moves.urllib_parse\")\n    error = _importer._get_module(\"moves.urllib_error\")\n    request = _importer._get_module(\"moves.urllib_request\")\n    response = _importer._get_module(\"moves.urllib_response\")\n    robotparser = _importer._get_module(\"moves.urllib_robotparser\")\n\n    def __dir__(self):\n        return ['parse', 'error', 'request', 'response', 'robotparser']"},{"col":4,"comment":"null","endLoc":480,"header":"def __dir__(self)","id":8939,"name":"__dir__","nodeType":"Function","startLoc":479,"text":"def __dir__(self):\n        return ['parse', 'error', 'request', 'response', 'robotparser']"},{"attributeType":"null","col":4,"comment":"null","endLoc":472,"id":8940,"name":"__path__","nodeType":"Attribute","startLoc":472,"text":"__path__"},{"col":4,"comment":"null","endLoc":172,"header":"def build_Name(self, o)","id":8941,"name":"build_Name","nodeType":"Function","startLoc":163,"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":427,"header":"def macro_prescan(self,macro)","id":8942,"name":"macro_prescan","nodeType":"Function","startLoc":394,"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                    continue\n                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):\n                    macro.patch.append(('c',argnum,i))\n                    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":4,"comment":"null","endLoc":182,"header":"def build_Add(self, o)","id":8943,"name":"build_Add","nodeType":"Function","startLoc":174,"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":4,"comment":"null","endLoc":186,"header":"def build_Getattr(self, o)","id":8944,"name":"build_Getattr","nodeType":"Function","startLoc":184,"text":"def build_Getattr(self, o):\n        parent = self.build(o.expr)\n        return getattr(parent, o.attrname)"},{"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":8945,"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"},{"col":4,"comment":"null","endLoc":189,"header":"def build_UnarySub(self, o)","id":8946,"name":"build_UnarySub","nodeType":"Function","startLoc":188,"text":"def build_UnarySub(self, o):\n        return -self.build_Const(o.getChildren()[0])"},{"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":8947,"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)"},{"col":4,"comment":"null","endLoc":192,"header":"def build_UnaryAdd(self, o)","id":8948,"name":"build_UnaryAdd","nodeType":"Function","startLoc":191,"text":"def build_UnaryAdd(self, o):\n        return self.build_Const(o.getChildren()[0])"},{"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":8949,"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":726,"header":"def get_rules(self)","id":8950,"name":"get_rules","nodeType":"Function","startLoc":663,"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)"},{"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":215,"id":8951,"nodeType":"Class","startLoc":207,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":213,"id":8952,"name":"line","nodeType":"Attribute","startLoc":213,"text":"self.line"},{"attributeType":"null","col":8,"comment":"null","endLoc":214,"id":8953,"name":"line_number","nodeType":"Attribute","startLoc":214,"text":"self.line_number"},{"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":8954,"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)"},{"className":"NestingError","col":0,"comment":"\n    This error indicates a level of nesting that doesn't match.\n    ","endLoc":221,"id":8955,"nodeType":"Class","startLoc":218,"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":229,"id":8956,"nodeType":"Class","startLoc":224,"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    \"\"\""},{"col":0,"comment":"null","endLoc":549,"header":"def _statetoken(s, names)","id":8957,"name":"_statetoken","nodeType":"Function","startLoc":533,"text":"def _statetoken(s, names):\n    nonstate = 1\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)"},{"className":"ReloadError","col":0,"comment":"\n    A 'reload' operation failed.\n    This exception is a subclass of ``IOError``.\n    ","endLoc":238,"id":8958,"nodeType":"Class","startLoc":232,"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.')"},{"className":"DuplicateError","col":0,"comment":"\n    The keyword or section specified already exists.\n    ","endLoc":244,"id":8959,"nodeType":"Class","startLoc":241,"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":250,"id":8960,"nodeType":"Class","startLoc":247,"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":254,"id":8961,"nodeType":"Class","startLoc":253,"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":263,"id":8962,"nodeType":"Class","startLoc":257,"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":263,"header":"def __init__(self, option)","id":8963,"name":"__init__","nodeType":"Function","startLoc":260,"text":"def __init__(self, option):\n        InterpolationError.__init__(\n            self,\n            'interpolation loop detected in value \"%s\".' % option)"},{"className":"RepeatSectionError","col":0,"comment":"\n    This error indicates additional sections in a section with a\n    ``__many__`` (repeated) section.\n    ","endLoc":270,"id":8964,"nodeType":"Class","startLoc":266,"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":277,"id":8965,"nodeType":"Class","startLoc":273,"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":277,"header":"def __init__(self, option)","id":8966,"name":"__init__","nodeType":"Function","startLoc":275,"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":281,"id":8967,"nodeType":"Class","startLoc":280,"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":405,"id":8968,"nodeType":"Class","startLoc":285,"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":299,"header":"def __init__(self, section)","id":8969,"name":"__init__","nodeType":"Function","startLoc":297,"text":"def __init__(self, section):\n        # the Section instance that \"owns\" this engine\n        self.section = section"},{"col":4,"comment":"null","endLoc":352,"header":"def interpolate(self, key, value)","id":8970,"name":"interpolate","nodeType":"Function","startLoc":302,"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":4,"comment":"null","endLoc":991,"header":"def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":8971,"name":"parseopt","nodeType":"Function","startLoc":695,"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":"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":405,"header":"def _parse_match(self, match)","id":8972,"name":"_parse_match","nodeType":"Function","startLoc":389,"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":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":8973,"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":8975,"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":"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":386,"header":"def _fetch(self, key)","id":8976,"name":"_fetch","nodeType":"Function","startLoc":355,"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"},{"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":8977,"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":8978,"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":8979,"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)]"},{"attributeType":"null","col":4,"comment":"null","endLoc":294,"id":8980,"name":"_KEYCRE","nodeType":"Attribute","startLoc":294,"text":"_KEYCRE"},{"attributeType":"null","col":4,"comment":"null","endLoc":295,"id":8981,"name":"_cookie","nodeType":"Attribute","startLoc":295,"text":"_cookie"},{"attributeType":"null","col":8,"comment":"null","endLoc":299,"id":8982,"name":"section","nodeType":"Attribute","startLoc":299,"text":"self.section"},{"className":"ConfigParserInterpolation","col":0,"comment":"Behaves like ConfigParser.","endLoc":417,"id":8983,"nodeType":"Class","startLoc":409,"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":417,"header":"def _parse_match(self, match)","id":8984,"name":"_parse_match","nodeType":"Function","startLoc":414,"text":"def _parse_match(self, match):\n        key = match.group(1)\n        value, section = self._fetch(key)\n        return key, value, section"},{"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":8985,"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)]"},{"col":29,"endLoc":427,"id":8986,"nodeType":"Lambda","startLoc":427,"text":"lambda x: x[2]"},{"attributeType":"null","col":4,"comment":"null","endLoc":411,"id":8987,"name":"_cookie","nodeType":"Attribute","startLoc":411,"text":"_cookie"},{"attributeType":"null","col":4,"comment":"null","endLoc":412,"id":8988,"name":"_KEYCRE","nodeType":"Attribute","startLoc":412,"text":"_KEYCRE"},{"col":4,"comment":"null","endLoc":269,"header":"def add_path(self,path)","id":8989,"name":"add_path","nodeType":"Function","startLoc":268,"text":"def add_path(self,path):\n        self.path.append(path)"},{"className":"TemplateInterpolation","col":0,"comment":"Behaves like string.Template.","endLoc":444,"id":8990,"nodeType":"Class","startLoc":421,"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":444,"header":"def _parse_match(self, match)","id":8991,"name":"_parse_match","nodeType":"Function","startLoc":433,"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":4,"comment":"null","endLoc":305,"header":"def group_lines(self,input)","id":8992,"name":"group_lines","nodeType":"Function","startLoc":280,"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":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":8993,"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":8994,"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":8995,"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":23,"endLoc":722,"id":8996,"nodeType":"Lambda","startLoc":722,"text":"lambda x: x[1].__code__.co_firstlineno"},{"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":8997,"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":"null","endLoc":476,"header":"def macro_expand_args(self,macro,args)","id":8998,"name":"macro_expand_args","nodeType":"Function","startLoc":437,"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":423,"id":8999,"name":"_cookie","nodeType":"Attribute","startLoc":423,"text":"_cookie"},{"attributeType":"null","col":4,"comment":"null","endLoc":424,"id":9000,"name":"_delimiter","nodeType":"Attribute","startLoc":424,"text":"_delimiter"},{"attributeType":"null","col":4,"comment":"null","endLoc":425,"id":9001,"name":"_KEYCRE","nodeType":"Attribute","startLoc":425,"text":"_KEYCRE"},{"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":1067,"id":9002,"nodeType":"Class","startLoc":457,"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, collections.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], collections.Mapping) and\n                                isinstance(val, collections.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 unrecognised 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":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":9003,"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)"},{"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":9004,"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":9005,"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":9006,"name":"__version__","nodeType":"Attribute","startLoc":129,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":132,"id":9007,"name":"__all__","nodeType":"Attribute","startLoc":132,"text":"__all__"},{"attributeType":"null","col":4,"comment":"null","endLoc":173,"id":9008,"name":"string_type","nodeType":"Attribute","startLoc":173,"text":"string_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":175,"id":9009,"name":"string_type","nodeType":"Attribute","startLoc":175,"text":"string_type"},{"attributeType":"function","col":4,"comment":"null","endLoc":180,"id":9010,"name":"unicode","nodeType":"Attribute","startLoc":180,"text":"unicode"},{"col":4,"comment":"null","endLoc":478,"header":"def __setstate__(self, state)","id":9011,"name":"__setstate__","nodeType":"Function","startLoc":476,"text":"def __setstate__(self, state):\n        dict.update(self, state[0])\n        self.__dict__.update(state[1])"},{"attributeType":"null","col":4,"comment":"null","endLoc":183,"id":9012,"name":"long","nodeType":"Attribute","startLoc":183,"text":"long"},{"attributeType":"null","col":0,"comment":"null","endLoc":185,"id":9013,"name":"_list_arg","nodeType":"Attribute","startLoc":185,"text":"_list_arg"},{"attributeType":"null","col":0,"comment":"null","endLoc":208,"id":9014,"name":"_list_members","nodeType":"Attribute","startLoc":208,"text":"_list_members"},{"attributeType":"null","col":0,"comment":"null","endLoc":219,"id":9015,"name":"_paramstring","nodeType":"Attribute","startLoc":219,"text":"_paramstring"},{"col":23,"endLoc":726,"id":9016,"nodeType":"Lambda","startLoc":726,"text":"lambda x: len(x[1])"},{"attributeType":"null","col":0,"comment":"null","endLoc":260,"id":9017,"name":"_matchstring","nodeType":"Attribute","startLoc":260,"text":"_matchstring"},{"attributeType":"null","col":0,"comment":"null","endLoc":891,"id":9018,"name":"bool_dict","nodeType":"Attribute","startLoc":891,"text":"bool_dict"},{"attributeType":"null","col":0,"comment":"null","endLoc":1250,"id":9019,"name":"fun_dict","nodeType":"Attribute","startLoc":1250,"text":"fun_dict"},{"col":0,"comment":"","endLoc":127,"header":"validate.py#<anonymous>","id":9020,"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":4,"comment":"null","endLoc":482,"header":"def __reduce__(self)","id":9021,"name":"__reduce__","nodeType":"Function","startLoc":480,"text":"def __reduce__(self):\n        state = (dict(self), self.__dict__)\n        return (__newobj__, (self.__class__,), state)"},{"col":4,"comment":"null","endLoc":581,"header":"def validate_all(self)","id":9022,"name":"validate_all","nodeType":"Function","startLoc":577,"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":548,"header":"def _interpolate(self, key, value)","id":9023,"name":"_interpolate","nodeType":"Function","startLoc":528,"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":14,"endLoc":180,"id":9024,"nodeType":"Lambda","startLoc":180,"text":"lambda x: x"},{"col":4,"comment":"null","endLoc":612,"header":"def validate_tokens(self)","id":9025,"name":"validate_tokens","nodeType":"Function","startLoc":604,"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"},{"col":4,"comment":"null","endLoc":630,"header":"def validate_literals(self)","id":9026,"name":"validate_literals","nodeType":"Function","startLoc":621,"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":"Fetch the item and do string interpolation.","endLoc":565,"header":"def __getitem__(self, key)","id":9027,"name":"__getitem__","nodeType":"Function","startLoc":551,"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"},{"id":9028,"name":"astropy/nddata","nodeType":"Package"},{"fileName":"nddata_base.py","filePath":"astropy/nddata","id":9029,"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\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"},{"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    ","endLoc":73,"id":9030,"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\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":22,"header":"@abstractmethod\n    def __init__(self)","id":9031,"name":"__init__","nodeType":"Function","startLoc":20,"text":"@abstractmethod\n    def __init__(self):\n        pass"},{"col":4,"comment":"The stored dataset.\n        ","endLoc":29,"header":"@property\n    @abstractmethod\n    def data(self)","id":9032,"name":"data","nodeType":"Function","startLoc":24,"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":39,"header":"@property\n    @abstractmethod\n    def mask(self)","id":9033,"name":"mask","nodeType":"Function","startLoc":31,"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":46,"header":"@property\n    @abstractmethod\n    def unit(self)","id":9034,"name":"unit","nodeType":"Function","startLoc":41,"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":53,"header":"@property\n    @abstractmethod\n    def wcs(self)","id":9035,"name":"wcs","nodeType":"Function","startLoc":48,"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":62,"header":"@property\n    @abstractmethod\n    def meta(self)","id":9036,"name":"meta","nodeType":"Function","startLoc":55,"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":73,"header":"@property\n    @abstractmethod\n    def uncertainty(self)","id":9037,"name":"uncertainty","nodeType":"Function","startLoc":64,"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":9038,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"nddata_base.py#<anonymous>","id":9039,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDDataBase']"},{"col":4,"comment":"null","endLoc":822,"header":"def validate_rules(self)","id":9040,"name":"validate_rules","nodeType":"Function","startLoc":729,"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)), re.VERBOSE | 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), re.VERBOSE | 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)"},{"fileName":"decorators.py","filePath":"astropy/nddata","id":9041,"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\n\nfrom ..utils import wraps\nfrom ..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 : cls, 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 `{0}`\"\n                             \"\".format(attr_arg_map.get('data', 'data')))\n\n        @wraps(func)\n        def wrapper(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 {0}\"\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 kwargs:\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                                 (kwargs[propmatch] is not\n                                  sig[propmatch].default))):\n                            warnings.warn(\n                                \"Property {0} has been passed explicitly and \"\n                                \"as an NDData property{1}, 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":4,"comment":"Remove items from the sequence when deleting.","endLoc":635,"header":"def __delitem__(self, key)","id":9043,"name":"__delitem__","nodeType":"Function","startLoc":627,"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]"},{"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    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 : `~astropy.units.Unit`-like or str, 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":308,"id":9044,"nodeType":"Class","startLoc":19,"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    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 : `~astropy.units.Unit`-like or str, 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 behaviour 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 = 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        return str(self.data)\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        body = np.array2string(self.data, separator=', ', prefix=prefix)\n        return ''.join([prefix, body, ')'])\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    @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":4,"comment":"\n        A version of update that uses our ``__setitem__``.\n        ","endLoc":651,"header":"def update(self, indict)","id":9045,"name":"update","nodeType":"Function","startLoc":646,"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":667,"header":"def pop(self, key, default=MISSING)","id":9046,"name":"pop","nodeType":"Function","startLoc":654,"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"},{"col":4,"comment":"Pops the first (key,val)","endLoc":678,"header":"def popitem(self)","id":9047,"name":"popitem","nodeType":"Function","startLoc":670,"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":"A version of setdefault that sets sequence if appropriate.","endLoc":705,"header":"def setdefault(self, key, default=None)","id":9048,"name":"setdefault","nodeType":"Function","startLoc":699,"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":710,"header":"def items(self)","id":9049,"name":"items","nodeType":"Function","startLoc":708,"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())))"},{"col":4,"comment":"D.values() -> list of D's values","endLoc":720,"header":"def values(self)","id":9050,"name":"values","nodeType":"Function","startLoc":718,"text":"def values(self):\n        \"\"\"D.values() -> list of D's values\"\"\"\n        return [self[key] for key in (self.scalars + self.sections)]"},{"col":4,"comment":"D.keys() -> list of D's keys","endLoc":715,"header":"def keys(self)","id":9051,"name":"keys","nodeType":"Function","startLoc":713,"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":725,"header":"def iteritems(self)","id":9052,"name":"iteritems","nodeType":"Function","startLoc":723,"text":"def iteritems(self):\n        \"\"\"D.iteritems() -> an iterator over the (key, value) items of D\"\"\"\n        return iter(list(self.items()))"},{"col":4,"comment":"D.iterkeys() -> an iterator over the keys of D","endLoc":730,"header":"def iterkeys(self)","id":9053,"name":"iterkeys","nodeType":"Function","startLoc":728,"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":737,"header":"def itervalues(self)","id":9054,"name":"itervalues","nodeType":"Function","startLoc":735,"text":"def itervalues(self):\n        \"\"\"D.itervalues() -> an iterator over the values of D\"\"\"\n        return iter(list(self.values()))"},{"col":4,"comment":"x.__repr__() <==> repr(x)","endLoc":748,"header":"def __repr__(self)","id":9055,"name":"__repr__","nodeType":"Function","startLoc":740,"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":781,"header":"def dict(self)","id":9057,"name":"dict","nodeType":"Function","startLoc":756,"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":"null","endLoc":228,"header":"def __init__(self, data, uncertainty=None, mask=None, wcs=None,\n                 meta=None, unit=None, copy=False)","id":9058,"name":"__init__","nodeType":"Function","startLoc":115,"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 behaviour 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 = 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":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":808,"header":"def merge(self, indict)","id":9059,"name":"merge","nodeType":"Function","startLoc":784,"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], collections.Mapping) and\n                                isinstance(val, collections.Mapping)):\n                self[key].merge(val)\n            else:\n                self[key] = val"},{"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":838,"header":"def rename(self, oldkey, newkey)","id":9060,"name":"rename","nodeType":"Function","startLoc":811,"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        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 unrecognised 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":923,"header":"def walk(self, function, raise_errors=True,\n            call_on_sections=False, **keywargs)","id":9061,"name":"walk","nodeType":"Function","startLoc":841,"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 unrecognised 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"},{"col":4,"comment":"null","endLoc":544,"header":"def expand_macros(self,tokens,expanded=None)","id":9062,"name":"expand_macros","nodeType":"Function","startLoc":487,"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 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                    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":"null","endLoc":231,"header":"def __str__(self)","id":9063,"name":"__str__","nodeType":"Function","startLoc":230,"text":"def __str__(self):\n        return str(self.data)"},{"col":4,"comment":"null","endLoc":236,"header":"def __repr__(self)","id":9064,"name":"__repr__","nodeType":"Function","startLoc":233,"text":"def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        body = np.array2string(self.data, separator=', ', prefix=prefix)\n        return ''.join([prefix, body, ')'])"},{"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":967,"header":"def as_bool(self, key)","id":9065,"name":"as_bool","nodeType":"Function","startLoc":926,"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":"\n        `~numpy.ndarray`-like : The stored dataset.\n        ","endLoc":243,"header":"@property\n    def data(self)","id":9066,"name":"data","nodeType":"Function","startLoc":238,"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":253,"header":"@property\n    def mask(self)","id":9067,"name":"mask","nodeType":"Function","startLoc":245,"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":257,"header":"@mask.setter\n    def mask(self, value)","id":9068,"name":"mask","nodeType":"Function","startLoc":255,"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":264,"header":"@property\n    def unit(self)","id":9069,"name":"unit","nodeType":"Function","startLoc":259,"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":271,"header":"@property\n    def wcs(self)","id":9070,"name":"wcs","nodeType":"Function","startLoc":266,"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":"\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":283,"header":"@property\n    def uncertainty(self)","id":9071,"name":"uncertainty","nodeType":"Function","startLoc":273,"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"},{"col":4,"comment":"null","endLoc":308,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":9072,"name":"uncertainty","nodeType":"Function","startLoc":285,"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"},{"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":990,"header":"def as_int(self, key)","id":9073,"name":"as_int","nodeType":"Function","startLoc":970,"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":1012,"header":"def as_float(self, key)","id":9074,"name":"as_float","nodeType":"Function","startLoc":993,"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":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":1034,"header":"def as_list(self, key)","id":9075,"name":"as_list","nodeType":"Function","startLoc":1015,"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":1050,"header":"def restore_default(self, key)","id":9076,"name":"restore_default","nodeType":"Function","startLoc":1037,"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"},{"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":1067,"header":"def restore_defaults(self)","id":9077,"name":"restore_defaults","nodeType":"Function","startLoc":1053,"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":"null","endLoc":605,"header":"def evalexpr(self,tokens)","id":9078,"name":"evalexpr","nodeType":"Function","startLoc":553,"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"},{"col":4,"comment":"null","endLoc":97,"header":"def __init__(self, array=None, copy=True, unit=None)","id":9079,"name":"__init__","nodeType":"Function","startLoc":62,"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!"},{"attributeType":"function","col":4,"comment":"null","endLoc":732,"id":9080,"name":"__iter__","nodeType":"Attribute","startLoc":732,"text":"__iter__"},{"col":4,"comment":"null","endLoc":1273,"header":"def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None)","id":9081,"name":"parseopt_notrack","nodeType":"Function","startLoc":1001,"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"},{"attributeType":"function","col":4,"comment":"null","endLoc":750,"id":9082,"name":"__str__","nodeType":"Attribute","startLoc":750,"text":"__str__"},{"attributeType":"null","col":4,"comment":"null","endLoc":751,"id":9083,"name":"__doc__","nodeType":"Attribute","startLoc":751,"text":"__str__.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":496,"id":9084,"name":"parent","nodeType":"Attribute","startLoc":496,"text":"self.parent"},{"attributeType":"null","col":8,"comment":"null","endLoc":513,"id":9085,"name":"scalars","nodeType":"Attribute","startLoc":513,"text":"self.scalars"},{"attributeType":"null","col":4,"comment":"null","endLoc":113,"id":9086,"name":"meta","nodeType":"Attribute","startLoc":113,"text":"meta"},{"attributeType":"null","col":8,"comment":"null","endLoc":517,"id":9087,"name":"comments","nodeType":"Attribute","startLoc":517,"text":"self.comments"},{"attributeType":"None","col":8,"comment":"null","endLoc":520,"id":9088,"name":"configspec","nodeType":"Attribute","startLoc":520,"text":"self.configspec"},{"attributeType":"null","col":8,"comment":"null","endLoc":222,"id":9089,"name":"_data","nodeType":"Attribute","startLoc":222,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":524,"id":9090,"name":"extra_values","nodeType":"Attribute","startLoc":524,"text":"self.extra_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":498,"id":9091,"name":"main","nodeType":"Attribute","startLoc":498,"text":"self.main"},{"attributeType":"null","col":8,"comment":"null","endLoc":515,"id":9092,"name":"sections","nodeType":"Attribute","startLoc":515,"text":"self.sections"},{"attributeType":"null","col":8,"comment":"null","endLoc":518,"id":9093,"name":"inline_comments","nodeType":"Attribute","startLoc":518,"text":"self.inline_comments"},{"attributeType":"null","col":8,"comment":"null","endLoc":523,"id":9094,"name":"default_values","nodeType":"Attribute","startLoc":523,"text":"self.default_values"},{"attributeType":"null","col":8,"comment":"null","endLoc":500,"id":9095,"name":"depth","nodeType":"Attribute","startLoc":500,"text":"self.depth"},{"attributeType":"null","col":8,"comment":"null","endLoc":522,"id":9096,"name":"defaults","nodeType":"Attribute","startLoc":522,"text":"self.defaults"},{"attributeType":"null","col":8,"comment":"null","endLoc":525,"id":9097,"name":"_created","nodeType":"Attribute","startLoc":525,"text":"self._created"},{"attributeType":"null","col":8,"comment":"null","endLoc":308,"id":9098,"name":"_uncertainty","nodeType":"Attribute","startLoc":308,"text":"self._uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":502,"id":9099,"name":"name","nodeType":"Attribute","startLoc":502,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":226,"id":9100,"name":"_unit","nodeType":"Attribute","startLoc":226,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":9101,"name":"_wcs","nodeType":"Attribute","startLoc":224,"text":"self._wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":225,"id":9102,"name":"meta","nodeType":"Attribute","startLoc":225,"text":"self.meta"},{"attributeType":"null","col":25,"comment":"null","endLoc":546,"id":9103,"name":"_interpolation_engine","nodeType":"Attribute","startLoc":546,"text":"self._interpolation_engine"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":9104,"name":"_mask","nodeType":"Attribute","startLoc":257,"text":"self._mask"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":9105,"name":"uncertainty","nodeType":"Attribute","startLoc":228,"text":"self.uncertainty"},{"className":"ConfigObj","col":0,"comment":"An object to read, create, and write config files.","endLoc":2365,"id":9106,"nodeType":"Class","startLoc":1070,"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('Unrecognised 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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":223,"id":9107,"name":"mask","nodeType":"Attribute","startLoc":223,"text":"self.mask"},{"col":4,"comment":"null","endLoc":735,"header":"def parsegen(self,input,source=None)","id":9108,"name":"parsegen","nodeType":"Function","startLoc":612,"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":"null","endLoc":1367,"header":"def __repr__(self)","id":9109,"name":"__repr__","nodeType":"Function","startLoc":1359,"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":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 : cls, 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":277,"header":"def support_nddata(_func=None, accepts=NDData,\n                   repack=False, returns=None, keeps=None,\n                   **attribute_argument_mapping)","id":9110,"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 : cls, 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 `{0}`\"\n                             \"\".format(attr_arg_map.get('data', 'data')))\n\n        @wraps(func)\n        def wrapper(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 {0}\"\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 kwargs:\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                                 (kwargs[propmatch] is not\n                                  sig[propmatch].default))):\n                            warnings.warn(\n                                \"Property {0} has been passed explicitly and \"\n                                \"as an NDData property{1}, 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":"Decode ASCII strings to unicode if a self.encoding is specified.","endLoc":1487,"header":"def _a_to_u(self, aString)","id":9112,"name":"_a_to_u","nodeType":"Function","startLoc":1482,"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":4,"comment":"Decode element to unicode if necessary.","endLoc":1520,"header":"def _decode_element(self, line)","id":9113,"name":"_decode_element","nodeType":"Function","startLoc":1515,"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"},{"col":4,"comment":"\n        Used by ``stringify`` within validate, to turn non-string values\n        into strings.\n        ","endLoc":1534,"header":"def _str(self, value)","id":9114,"name":"_str","nodeType":"Function","startLoc":1524,"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":1820,"header":"def _quote(self, value, multiline=True)","id":9115,"name":"_quote","nodeType":"Function","startLoc":1752,"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"},{"col":4,"comment":"null","endLoc":856,"header":"def validate_module(self, module)","id":9116,"name":"validate_module","nodeType":"Function","startLoc":832,"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":0,"comment":"null","endLoc":123,"header":"def trigraph(input)","id":9117,"name":"trigraph","nodeType":"Function","startLoc":122,"text":"def trigraph(input):\n    return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input)"},{"col":29,"endLoc":123,"id":9118,"nodeType":"Lambda","startLoc":123,"text":"lambda g: _trigraph_rep[g.group()[-1]]"},{"attributeType":"null","col":8,"comment":"null","endLoc":560,"id":9119,"name":"ldict","nodeType":"Attribute","startLoc":560,"text":"self.ldict"},{"attributeType":"null","col":8,"comment":"null","endLoc":669,"id":9120,"name":"strsym","nodeType":"Attribute","startLoc":669,"text":"self.strsym"},{"attributeType":"PlyLogger","col":8,"comment":"null","endLoc":567,"id":9121,"name":"log","nodeType":"Attribute","startLoc":567,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":672,"id":9122,"name":"eoff","nodeType":"Attribute","startLoc":672,"text":"self.eoff"},{"attributeType":"null","col":8,"comment":"null","endLoc":616,"id":9123,"name":"literals","nodeType":"Attribute","startLoc":616,"text":"self.literals"},{"attributeType":"null","col":8,"comment":"null","endLoc":564,"id":9124,"name":"stateinfo","nodeType":"Attribute","startLoc":564,"text":"self.stateinfo"},{"attributeType":"null","col":8,"comment":"null","endLoc":671,"id":9125,"name":"errorf","nodeType":"Attribute","startLoc":671,"text":"self.errorf"},{"attributeType":"null","col":8,"comment":"null","endLoc":566,"id":9126,"name":"error","nodeType":"Attribute","startLoc":566,"text":"self.error"},{"attributeType":"null","col":8,"comment":"null","endLoc":565,"id":9127,"name":"modules","nodeType":"Attribute","startLoc":565,"text":"self.modules"},{"attributeType":"null","col":8,"comment":"null","endLoc":633,"id":9128,"name":"states","nodeType":"Attribute","startLoc":633,"text":"self.states"},{"attributeType":"null","col":8,"comment":"null","endLoc":667,"id":9129,"name":"toknames","nodeType":"Attribute","startLoc":667,"text":"self.toknames"},{"attributeType":"null","col":8,"comment":"null","endLoc":670,"id":9130,"name":"ignore","nodeType":"Attribute","startLoc":670,"text":"self.ignore"},{"attributeType":"null","col":8,"comment":"null","endLoc":562,"id":9131,"name":"tokens","nodeType":"Attribute","startLoc":562,"text":"self.tokens"},{"attributeType":"None","col":8,"comment":"null","endLoc":561,"id":9132,"name":"error_func","nodeType":"Attribute","startLoc":561,"text":"self.error_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":563,"id":9133,"name":"reflags","nodeType":"Attribute","startLoc":563,"text":"self.reflags"},{"attributeType":"null","col":8,"comment":"null","endLoc":668,"id":9134,"name":"funcsym","nodeType":"Attribute","startLoc":668,"text":"self.funcsym"},{"col":0,"comment":"null","endLoc":1080,"header":"def runmain(lexer=None, data=None)","id":9135,"name":"runmain","nodeType":"Function","startLoc":1055,"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":0,"comment":"null","endLoc":1096,"header":"def TOKEN(r)","id":9136,"name":"TOKEN","nodeType":"Function","startLoc":1089,"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":9137,"name":"__version__","nodeType":"Attribute","startLoc":34,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":9138,"name":"__tabversion__","nodeType":"Attribute","startLoc":35,"text":"__tabversion__"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":9139,"name":"StringTypes","nodeType":"Attribute","startLoc":47,"text":"StringTypes"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":9140,"name":"_is_identifier","nodeType":"Attribute","startLoc":53,"text":"_is_identifier"},{"attributeType":"function","col":0,"comment":"null","endLoc":1099,"id":9141,"name":"Token","nodeType":"Attribute","startLoc":1099,"text":"Token"},{"col":0,"comment":"","endLoc":34,"header":"lex.py#<anonymous>","id":9142,"name":"<anonymous>","nodeType":"Function","startLoc":34,"text":"__version__    = '3.9'\n\n__tabversion__ = '3.8'\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"},{"fileName":"nddata.py","filePath":"astropy/nddata","id":9143,"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 .. import log\nfrom ..units import Unit, Quantity\nfrom ..utils.metadata import MetaData\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    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 : `~astropy.units.Unit`-like or str, 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 behaviour 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 = 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        return str(self.data)\n\n    def __repr__(self):\n        prefix = self.__class__.__name__ + '('\n        body = np.array2string(self.data, separator=', ', prefix=prefix)\n        return ''.join([prefix, body, ')'])\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    @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 : `~astropy.units.Unit` or str, 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":311,"id":9144,"nodeType":"Class","startLoc":30,"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 : `~astropy.units.Unit` or str, 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        Even though it is not enforced the unit should be convertible to the\n        ``parent_nddata`` unit. Otherwise uncertainty propagation might give\n        wrong results.\n\n        If the unit is not set the unit of the parent will be returned.\n        \"\"\"\n        if self._unit is None:\n            if (self._parent_nddata is None or\n                    self.parent_nddata.unit is None):\n                return None\n            else:\n                return self.parent_nddata.unit\n        return self._unit\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        message = \"uncertainty is not associated with an NDData object\"\n        try:\n            if self._parent_nddata is None:\n                raise MissingDataAssociationException(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.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    return self._parent_nddata()\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(message)\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        self._parent_nddata = value\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 __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 `numpy.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(\"{0} 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":"`str` : Short description of the type of uncertainty.\n\n        Defined as abstract property so subclasses *have* to override this.\n        ","endLoc":106,"header":"@property\n    @abstractmethod\n    def uncertainty_type(self)","id":9145,"name":"uncertainty_type","nodeType":"Function","startLoc":99,"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":115,"header":"@property\n    def supports_correlated(self)","id":9146,"name":"supports_correlated","nodeType":"Function","startLoc":108,"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":121,"header":"@property\n    def array(self)","id":9147,"name":"array","nodeType":"Function","startLoc":117,"text":"@property\n    def array(self):\n        \"\"\"`numpy.ndarray` : the uncertainty's value.\n        \"\"\"\n        return self._array"},{"col":4,"comment":"null","endLoc":127,"header":"@array.setter\n    def array(self, value)","id":9148,"name":"array","nodeType":"Function","startLoc":123,"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\n        Even though it is not enforced the unit should be convertible to the\n        ``parent_nddata`` unit. Otherwise uncertainty propagation might give\n        wrong results.\n\n        If the unit is not set the unit of the parent will be returned.\n        ","endLoc":145,"header":"@property\n    def unit(self)","id":9149,"name":"unit","nodeType":"Function","startLoc":129,"text":"@property\n    def unit(self):\n        \"\"\"`~astropy.units.Unit` : The unit of the uncertainty, if any.\n\n        Even though it is not enforced the unit should be convertible to the\n        ``parent_nddata`` unit. Otherwise uncertainty propagation might give\n        wrong results.\n\n        If the unit is not set the unit of the parent will be returned.\n        \"\"\"\n        if self._unit is None:\n            if (self._parent_nddata is None or\n                    self.parent_nddata.unit is None):\n                return None\n            else:\n                return self.parent_nddata.unit\n        return self._unit"},{"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":169,"header":"@property\n    def parent_nddata(self)","id":9150,"name":"parent_nddata","nodeType":"Function","startLoc":147,"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        message = \"uncertainty is not associated with an NDData object\"\n        try:\n            if self._parent_nddata is None:\n                raise MissingDataAssociationException(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.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    return self._parent_nddata()\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(message)"},{"col":4,"comment":"null","endLoc":178,"header":"@parent_nddata.setter\n    def parent_nddata(self, value)","id":9151,"name":"parent_nddata","nodeType":"Function","startLoc":171,"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        self._parent_nddata = value"},{"col":4,"comment":"null","endLoc":187,"header":"def __repr__(self)","id":9152,"name":"__repr__","nodeType":"Function","startLoc":180,"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":"Normal slicing on the array, keep the unit and return a reference.\n        ","endLoc":192,"header":"def __getitem__(self, item)","id":9153,"name":"__getitem__","nodeType":"Function","startLoc":189,"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 `numpy.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":263,"header":"def propagate(self, operation, other_nddata, result_data, correlation)","id":9154,"name":"propagate","nodeType":"Function","startLoc":194,"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 `numpy.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(\"{0} 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":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":295,"header":"def _convert_uncertainty(self, other_uncert)","id":9155,"name":"_convert_uncertainty","nodeType":"Function","startLoc":265,"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"},{"col":4,"comment":"null","endLoc":299,"header":"@abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation)","id":9156,"name":"_propagate_add","nodeType":"Function","startLoc":297,"text":"@abstractmethod\n    def _propagate_add(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":303,"header":"@abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation)","id":9157,"name":"_propagate_subtract","nodeType":"Function","startLoc":301,"text":"@abstractmethod\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":307,"header":"@abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation)","id":9158,"name":"_propagate_multiply","nodeType":"Function","startLoc":305,"text":"@abstractmethod\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":311,"header":"@abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation)","id":9159,"name":"_propagate_divide","nodeType":"Function","startLoc":309,"text":"@abstractmethod\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"attributeType":"null","col":8,"comment":"null","endLoc":178,"id":9160,"name":"_parent_nddata","nodeType":"Attribute","startLoc":178,"text":"self._parent_nddata"},{"attributeType":"null","col":12,"comment":"null","endLoc":90,"id":9161,"name":"_unit","nodeType":"Attribute","startLoc":90,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":127,"id":9163,"name":"_array","nodeType":"Attribute","startLoc":127,"text":"self._array"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9164,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9165,"name":"SUPPORTED_PROPERTIES","nodeType":"Attribute","startLoc":18,"text":"SUPPORTED_PROPERTIES"},{"col":0,"comment":"","endLoc":4,"header":"decorators.py#<anonymous>","id":9166,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['support_nddata']\n\nSUPPORTED_PROPERTIES = ['data', 'uncertainty', 'mask', 'meta', 'unit', 'wcs',\n                        'flags']"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":9167,"name":"array","nodeType":"Attribute","startLoc":96,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":290,"id":9168,"name":"errorfunc","nodeType":"Attribute","startLoc":290,"text":"self.errorfunc"},{"attributeType":"null","col":8,"comment":"null","endLoc":289,"id":9169,"name":"goto","nodeType":"Attribute","startLoc":289,"text":"self.goto"},{"fileName":"utils.py","filePath":"astropy/nddata","id":9170,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nThis module includes helper functions for array operations.\n\"\"\"\nfrom copy import deepcopy\n\nimport numpy as np\n\nfrom .decorators import support_nddata\nfrom .. import units as u\nfrom ..coordinates import SkyCoord\nfrom ..utils import lazyproperty\nfrom ..wcs.utils import skycoord_to_pixel, proj_plane_pixel_scales\n\n\n__all__ = ['extract_array', 'add_array', 'subpixel_indices',\n           'overlap_slices', 'block_reduce', 'block_replicate',\n           'NoOverlapError', 'PartialOverlapError', '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 _round(a):\n    '''Always round up.\n\n    ``np.round`` cannot be used here, because it rounds .5 to the nearest\n    even number.\n    '''\n    return int(np.floor(a + 0.5))\n\n\ndef _offset(a):\n    '''Offset by 0.5 for an even array.\n\n    For an array with an odd number of elements, the center is\n    symmetric, e.g. for 3 elements, it's center +/-1 elements, but for\n    four elements it's center -2 / +1\n    This function introduces that offset.\n    '''\n    if np.mod(a, 2) == 0:\n        return -0.5\n    else:\n        return 0.\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 or int\n        The shape of the large array (for 1D arrays, this can be an\n        `int`).\n    small_array_shape : tuple or int\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 : tuple of numbers or number\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 slices\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 : 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 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    # Get edge coordinates\n    edges_min = [_round(pos + 0.5 - small_shape / 2. + _offset(small_shape))\n                 for (pos, small_shape) in zip(position, small_array_shape)]\n    edges_max = [_round(pos + 0.5 + small_shape / 2. + _offset(small_shape))\n                 for (pos, small_shape) in zip(position, small_array_shape)]\n\n    for e_max in edges_max:\n        if e_max <= 0:\n            raise NoOverlapError('Arrays do not overlap.')\n    for e_min, large_shape in zip(edges_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 edges_min:\n            if e_min < 0:\n                raise PartialOverlapError('Arrays overlap only partially.')\n        for e_max, large_shape in zip(edges_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, edge_min), min(large_shape, edge_max))\n                         for (edge_min, edge_max, large_shape) in\n                         zip(edges_min, edges_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, -edge_min),\n                                   min(large_shape - edge_min,\n                                       edge_max - edge_min))\n                             for (edge_min, edge_max, large_shape) in\n                             zip(edges_min, edges_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 : `~numpy.ndarray`\n        The array from which to extract the small array.\n    shape : tuple or int\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 : tuple of numbers or number\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`` must have the same ``dtype`` as the\n        ``array_large`` array.\n    return_position : boolean, 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 : `~numpy.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    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    # 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        extracted_array[:] = fill_value\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 : `~numpy.ndarray`\n        Large array.\n    array_small : `~numpy.ndarray`\n        Small array to add.\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 : `~numpy.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 really larger\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, 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 : `~numpy.ndarray` or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : `~numpy.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\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 along which the function is applied.  The\n        default is `~numpy.sum`, which provides block summation (and\n        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.utils import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)    # doctest: +SKIP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)    # doctest: +SKIP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    \"\"\"\n\n    from skimage.measure import block_reduce\n\n    data = np.asanyarray(data)\n\n    block_size = np.atleast_1d(block_size)\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 `data.shape`')\n\n    block_size = np.array([int(i) for i in block_size])\n    size_resampled = np.array(data.shape) // block_size\n    size_init = size_resampled * block_size\n\n    # trim data if necessary\n    for i in range(data.ndim):\n        if data.shape[i] != size_init[i]:\n            data = data.swapaxes(0, i)\n            data = data[:size_init[i]]\n            data = data.swapaxes(0, i)\n\n    return block_reduce(data, tuple(block_size), func=func)\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.utils 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 = np.asanyarray(data)\n\n    block_size = np.atleast_1d(block_size)\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 `data.shape`')\n\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\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:`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        <http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : `~numpy.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, `~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 : number, 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 objects\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 objects\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 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        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    @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 (_round(self.input_position_original[0]),\n                _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 (_round(self.input_position_cutout[0]),\n                _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"},{"attributeType":"null","col":8,"comment":"null","endLoc":97,"id":9171,"name":"parent_nddata","nodeType":"Attribute","startLoc":97,"text":"self.parent_nddata"},{"attributeType":"null","col":8,"comment":"null","endLoc":314,"id":9172,"name":"defaulted_states","nodeType":"Attribute","startLoc":314,"text":"self.defaulted_states"},{"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='cartesian'`` (for example) along with data in\n    ``x``, ``y``, and ``z``.\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], \"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +1:12:43\", \"1 12 43.2 +1 12 43\"]\n      >>> c = SkyCoord(coords, FK4, unit=(u.deg, u.hourangle), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", Galactic)  # Units from string\n      >>> c = SkyCoord(\"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(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', representation='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    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 ``LON`` and ``LAT`` values, respectively.  If\n        only one unit is supplied then it applies to both ``LON`` and\n        ``LAT``.\n    obstime : valid `~astropy.time.Time` initializer, optional\n        Time of observation\n    equinox : valid `~astropy.time.Time` initializer, optional\n        Coordinate frame equinox\n    representation : 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 : valid `~astropy.coordinates.Angle` initializer, 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        l, b : valid `~astropy.coordinates.Angle` initializer, 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        x, y, z : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values for the Galactic frame.\n    ","endLoc":1507,"id":9173,"nodeType":"Class","startLoc":93,"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='cartesian'`` (for example) along with data in\n    ``x``, ``y``, and ``z``.\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], \"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +1:12:43\", \"1 12 43.2 +1 12 43\"]\n      >>> c = SkyCoord(coords, FK4, unit=(u.deg, u.hourangle), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", Galactic)  # Units from string\n      >>> c = SkyCoord(\"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(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', representation='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    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 ``LON`` and ``LAT`` values, respectively.  If\n        only one unit is supplied then it applies to both ``LON`` and\n        ``LAT``.\n    obstime : valid `~astropy.time.Time` initializer, optional\n        Time of observation\n    equinox : valid `~astropy.time.Time` initializer, optional\n        Coordinate frame equinox\n    representation : 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 : valid `~astropy.coordinates.Angle` initializer, 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        l, b : valid `~astropy.coordinates.Angle` initializer, 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        x, y, z : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values for the Galactic frame.\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        # 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        kwargs = self._parse_inputs(args, kwargs)\n\n        frame = kwargs['frame']\n        frame_attr_names = frame.get_frame_attr_names()\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        for attr in kwargs:\n            if (attr not in frame_attr_names and\n                attr in frame_transform_graph.frame_attributes):\n                # Setting it will also validate it.\n                setattr(self, attr, kwargs[attr])\n\n        coord_kwargs = {}\n        if 'representation' in kwargs:\n            coord_kwargs['representation'] = _get_repr_cls(kwargs['representation'])\n        for attr, value in kwargs.items():\n            if value is not None and (attr in frame.representation_component_names\n                                      or attr in frame.get_frame_attr_names()):\n                coord_kwargs[attr] = value\n\n        # Finally make the internal coordinate object.\n        self._sky_coord_frame = frame.__class__(copy=copy, **coord_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(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 _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.misc.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        self_frame = self._sky_coord_frame\n        try:\n            # First turn `self` into a mockup of the thing we want - we can copy\n            # this to get all the right attributes\n            self._sky_coord_frame = self_frame._apply(method, *args, **kwargs)\n            out = SkyCoord(self, representation=self.representation, copy=False)\n            for attr in self._extra_frameattr_names:\n                value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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(out, '_' + 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                out.info = self.info\n\n            return out\n        finally:\n            # now put back the right frame in self\n            self._sky_coord_frame = self_frame\n\n    def _parse_inputs(self, args, kwargs):\n        \"\"\"\n        Assemble a validated and sanitized keyword args dict for instantiating a\n        SkyCoord and coordinate object from the provided `args`, and `kwargs`.\n        \"\"\"\n        valid_kwargs = {}\n\n        # Put the SkyCoord attributes like frame, equinox, obstime, location\n        # into valid_kwargs dict.  `Frame` could come from args or kwargs, so\n        # set valid_kwargs['frame'] accordingly.  The others must be specified\n        # by keyword args or else get a None default.  Pop them off of kwargs\n        # in the process.\n        frame = valid_kwargs['frame'] = _get_frame(args, kwargs)\n        if 'representation' in kwargs:\n            valid_kwargs['representation'] = _get_repr_cls(kwargs.pop('representation'))\n\n        for attr in frame_transform_graph.frame_attributes:\n            if attr in kwargs:\n                valid_kwargs[attr] = kwargs.pop(attr)\n\n        # Get units\n        units = _get_units(args, kwargs)\n\n        # Grab any frame-specific attr names like `ra` or `l` or `distance` from kwargs\n        # and migrate to valid_kwargs.\n        valid_kwargs.update(_get_representation_attrs(frame, units, kwargs))\n\n        # Error if anything is still left in kwargs\n        if kwargs:\n\n            # TODO: remove this when velocities are supported in SkyCoord\n            vel_url = 'http://docs.astropy.org/en/stable/coordinates/velocities.html'\n            for k in kwargs:\n                if k.startswith('pm_') or k == 'radial_velocity':\n                    raise ValueError('Velocity data is currently only supported'\n                                     ' in the coordinate frame objects, not in '\n                                     'SkyCoord. See the velocities '\n                                     'documentation page for more information: '\n                                     '{0}'.format(vel_url))\n\n            raise ValueError('Unrecognized keyword argument(s) {0}'\n                             .format(', '.join(\"'{0}'\".format(key) for key in kwargs)))\n\n        # Finally deal with the unnamed args.  This figures out what the arg[0] is\n        # and returns a dict with appropriate key/values for initializing frame class.\n        if args:\n            if len(args) == 1:\n                # One arg which must be a coordinate.  In this case\n                # coord_kwargs will contain keys like 'ra', 'dec', 'distance'\n                # along with any frame attributes like equinox or obstime which\n                # were explicitly specified in the coordinate object (i.e. non-default).\n                coord_kwargs = _parse_coordinate_arg(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                    self.info = args[0].info\n\n            elif len(args) <= 3:\n                frame_attr_names = frame.representation_component_names.keys()\n                repr_attr_names = frame.representation_component_names.values()\n                coord_kwargs = {}\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.attr_classes[repr_attr_name]\n                    coord_kwargs[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            # Copy the coord_kwargs into the final valid_kwargs dict.  For each\n            # of the coord_kwargs ensure that there is no conflict with a value\n            # specified by the user in the original kwargs.\n            for attr, coord_value in coord_kwargs.items():\n                if (attr in valid_kwargs\n                        and valid_kwargs[attr] is not None\n                        and np.any(valid_kwargs[attr] != coord_value)):\n                    raise ValueError(\"Coordinate attribute '{0}'={1!r} conflicts with \"\n                                     \"keyword argument '{0}'={2!r}\"\n                                     .format(attr, coord_value, valid_kwargs[attr]))\n                valid_kwargs[attr] = coord_value\n\n        return valid_kwargs\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 loosing 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 and not\n                    (merge_attributes and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None and\n                      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 {0} to {1}'\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        return self.__class__(new_coord, **frame_kwargs)\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 master transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self.frame.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(\"'{0}' object has no attribute '{1}'\"\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.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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('Invalid style.  Valid options are: {0}'.format(\",\".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                            + \" \" +\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                                 + \" \" +\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 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 np.any(getattr(self, fattrnm) != 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            unintutive 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:`/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                other = other.transform_to(self, merge_attributes=False)\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:`/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                other = other.transform_to(self, merge_attributes=False)\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        return Distance((self.cartesian - other.cartesian).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 offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction (i.e., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction (i.e., 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\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 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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self_in_catalog_frame, 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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self_in_catalog_frame, 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:`/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        seplimit : `~astropy.units.Quantity` with angle units\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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:`/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` with distance units\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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 : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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        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        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 `numpy.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 : an instance of this class\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        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)\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` with velocity units\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. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n           sc = SkyCoord(1*u.deg, 2*u.deg)\n           vcorr = sc.rv_correction(kind='barycentric', obstime=t, location=loc)\n           rv = rv + vcorr + rv * vcorr / consts.c\n\n        If your target is nearby and/or has finite proper motion you may need to account\n        for terms arising from this. See Wright & Eastmann (2014) for details.\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            sc = SkyCoord(1*u.deg, 2*u.deg)\n            with coord.solar_system_ephemeris.set('jpl'):\n                rv += sc.rv_correction(obstime=t, location=loc)\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel, get_body_barycentric\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        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:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`obstime` argument is passed in and it is '\n                             'inconsistent with the `obstime` frame '\n                             'attribute on the SkyCoord')\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        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = self.icrs.cartesian\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            icrs_cart = self.icrs.cartesian\n            targcart = icrs_cart - 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 + targcart.dot(beta_obs)) / (1 + gr/speed_of_light) - 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, if they are also\n        followed by a non-alphanumeric character. It will also match columns\n        that *end* with the component name if a non-alphanumeric character is\n        *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\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 : same as this class\n            The new `SkyCoord` (or subclass) object.\n        \"\"\"\n        inital_frame = coord_kwargs.get('frame')\n        frame = _get_frame([], coord_kwargs)\n        coord_kwargs['frame'] = inital_frame\n\n        comp_kwargs = {}\n        for comp_name in frame.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('(' + starts_with_comp + ')|(' + ends_with_comp + ')',\n                             re.IGNORECASE | re.UNICODE)\n\n            for col_name in table.colnames:\n                if rex.match(col_name):\n                    if comp_name in comp_kwargs:\n                        oldname = comp_kwargs[comp_name].name\n                        msg = ('Found at least two matches for  component \"{0}\"'\n                               ': \"{1}\" and \"{2}\". Cannot continue with this '\n                               'ambiguity.')\n                        raise ValueError(msg.format(comp_name, oldname, col_name))\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 \"{0}\" in table, but it was '\n                                 'already provided as \"{1}\" 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'):\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\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)\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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":390,"id":9174,"name":"symstack","nodeType":"Attribute","startLoc":390,"text":"self.symstack"},{"attributeType":"null","col":8,"comment":"null","endLoc":288,"id":9175,"name":"action","nodeType":"Attribute","startLoc":288,"text":"self.action"},{"attributeType":"null","col":8,"comment":"null","endLoc":287,"id":9176,"name":"productions","nodeType":"Attribute","startLoc":287,"text":"self.productions"},{"attributeType":"null","col":28,"comment":"null","endLoc":500,"id":9177,"name":"state","nodeType":"Attribute","startLoc":500,"text":"self.state"},{"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":358,"id":9178,"nodeType":"Class","startLoc":314,"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 _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":330,"header":"@property\n    def supports_correlated(self)","id":9179,"name":"supports_correlated","nodeType":"Function","startLoc":326,"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":337,"header":"@property\n    def uncertainty_type(self)","id":9180,"name":"uncertainty_type","nodeType":"Function","startLoc":332,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"unknown\"`` : `UnknownUncertainty` implements any unknown \\\n                           uncertainty type.\n        \"\"\"\n        return 'unknown'"},{"col":4,"comment":"Raise an Exception because unknown uncertainty types cannot\n        implement propagation.\n        ","endLoc":344,"header":"def _convert_uncertainty(self, other_uncert)","id":9181,"name":"_convert_uncertainty","nodeType":"Function","startLoc":339,"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":235,"header":"@property\n    def frame(self)","id":9182,"name":"frame","nodeType":"Function","startLoc":233,"text":"@property\n    def frame(self):\n        return self._sky_coord_frame"},{"col":4,"comment":"null","endLoc":239,"header":"@property\n    def representation(self)","id":9183,"name":"representation","nodeType":"Function","startLoc":237,"text":"@property\n    def representation(self):\n        return self.frame.representation"},{"col":4,"comment":"null","endLoc":243,"header":"@representation.setter\n    def representation(self, value)","id":9184,"name":"representation","nodeType":"Function","startLoc":241,"text":"@representation.setter\n    def representation(self, value):\n        self.frame.representation = value"},{"col":4,"comment":"null","endLoc":247,"header":"@property\n    def shape(self)","id":9185,"name":"shape","nodeType":"Function","startLoc":245,"text":"@property\n    def shape(self):\n        return self.frame.shape"},{"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.misc.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":309,"header":"def _apply(self, method, *args, **kwargs)","id":9186,"name":"_apply","nodeType":"Function","startLoc":249,"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.misc.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        self_frame = self._sky_coord_frame\n        try:\n            # First turn `self` into a mockup of the thing we want - we can copy\n            # this to get all the right attributes\n            self._sky_coord_frame = self_frame._apply(method, *args, **kwargs)\n            out = SkyCoord(self, representation=self.representation, copy=False)\n            for attr in self._extra_frameattr_names:\n                value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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(out, '_' + 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                out.info = self.info\n\n            return out\n        finally:\n            # now put back the right frame in self\n            self._sky_coord_frame = self_frame"},{"col":4,"comment":"Not possible for unknown uncertainty types.\n        ","endLoc":349,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":9187,"name":"_propagate_add","nodeType":"Function","startLoc":346,"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":352,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":9188,"name":"_propagate_subtract","nodeType":"Function","startLoc":351,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":355,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":9189,"name":"_propagate_multiply","nodeType":"Function","startLoc":354,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\n        return None"},{"col":4,"comment":"null","endLoc":358,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":9190,"name":"_propagate_divide","nodeType":"Function","startLoc":357,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n        return None"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9191,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":9192,"name":"_meta_doc","nodeType":"Attribute","startLoc":16,"text":"_meta_doc"},{"col":0,"comment":"","endLoc":5,"header":"nddata.py#<anonymous>","id":9193,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDData']\n\n_meta_doc = \"\"\"`dict`-like : Additional meta information about the dataset.\"\"\""},{"fileName":"flag_collection.py","filePath":"astropy/nddata","id":9194,"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 ..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 {0} does not match data \"\n                                 \"shape {1}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")\n"},{"col":4,"comment":"null","endLoc":1830,"header":"def _get_single_quote(self, value)","id":9195,"name":"_get_single_quote","nodeType":"Function","startLoc":1823,"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"},{"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":9197,"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 {0} does not match data \"\n                                 \"shape {1}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")"},{"col":4,"comment":"null","endLoc":37,"header":"def __init__(self, *args, **kwargs)","id":9198,"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":"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 loosing 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":485,"header":"def transform_to(self, frame, merge_attributes=True)","id":9199,"name":"transform_to","nodeType":"Function","startLoc":395,"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 loosing 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 and not\n                    (merge_attributes and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None and\n                      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 {0} to {1}'\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        return self.__class__(new_coord, **frame_kwargs)"},{"col":4,"comment":"null","endLoc":1840,"header":"def _get_triple_quote(self, value)","id":9200,"name":"_get_triple_quote","nodeType":"Function","startLoc":1833,"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":"null","endLoc":48,"header":"def __setitem__(self, item, value, **kwargs)","id":9201,"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 {0} does not match data \"\n                                 \"shape {1}\".format(value.shape, self.shape))\n        else:\n            raise TypeError(\"flags should be given as a Numpy array\")"},{"col":4,"comment":"\n        Called by validate. Handles setting the configspec on subsections\n        including sections to be validated by __many__\n        ","endLoc":1973,"header":"def _set_configspec(self, section, copy)","id":9202,"name":"_set_configspec","nodeType":"Function","startLoc":1948,"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":12,"comment":"null","endLoc":29,"id":9203,"name":"shape","nodeType":"Attribute","startLoc":29,"text":"self.shape"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":9204,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":9205,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"flag_collection.py#<anonymous>","id":9206,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['FlagCollection']"},{"fileName":"compat.py","filePath":"astropy/nddata","id":9207,"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 ..units import UnitsError, UnitConversionError, Unit\nfrom .. 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    Parameters\n    -----------\n    data : `~numpy.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 : `~numpy.ndarray`-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 : `~numpy.ndarray`-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 : undefined, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defind 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 self.unit and value._unit:\n                    try:\n                        scaling = (1 * value._unit).to(self.unit)\n                    except UnitsError:\n                        raise UnitConversionError(\n                            'Cannot convert unit of uncertainty to unit of '\n                            '{0} object.'.format(class_name))\n                    value.array *= scaling\n                elif 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 {0} 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 equivalence pairs, optional\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        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":"Write an individual line, for the write method","endLoc":1987,"header":"def _write_line(self, indent_string, entry, this_entry, comment)","id":9208,"name":"_write_line","nodeType":"Function","startLoc":1976,"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))"},{"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":123,"id":9209,"nodeType":"Class","startLoc":10,"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        try:\n            return self.wcs[item]\n        except TypeError:\n            log.info(\"wcs cannot be sliced.\")\n        return self.wcs"},{"col":4,"comment":"null","endLoc":784,"header":"def include(self,tokens)","id":9210,"name":"include","nodeType":"Function","startLoc":743,"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":61,"header":"def __getitem__(self, item)","id":9211,"name":"__getitem__","nodeType":"Function","startLoc":54,"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)"},{"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":94,"header":"def _slice(self, item)","id":9212,"name":"_slice","nodeType":"Function","startLoc":63,"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"},{"col":4,"comment":"null","endLoc":105,"header":"def _slice_uncertainty(self, item)","id":9213,"name":"_slice_uncertainty","nodeType":"Function","startLoc":96,"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":292,"id":9214,"name":"errorok","nodeType":"Attribute","startLoc":292,"text":"self.errorok"},{"attributeType":"null","col":8,"comment":"null","endLoc":388,"id":9215,"name":"statestack","nodeType":"Attribute","startLoc":388,"text":"self.statestack"},{"attributeType":"null","col":8,"comment":"null","endLoc":383,"id":9216,"name":"token","nodeType":"Attribute","startLoc":383,"text":"self.token"},{"col":4,"comment":"null","endLoc":867,"header":"def undef(self,tokens)","id":9217,"name":"undef","nodeType":"Function","startLoc":862,"text":"def undef(self,tokens):\n        id = tokens[0].value\n        try:\n            del self.macros[id]\n        except LookupError:\n            pass"},{"className":"Production","col":0,"comment":"null","endLoc":1375,"id":9218,"nodeType":"Class","startLoc":1309,"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 = 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":1339,"header":"def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0)","id":9219,"name":"__init__","nodeType":"Function","startLoc":1311,"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"},{"col":4,"comment":"null","endLoc":1444,"header":"def __init__(self, frame_attrs)","id":9220,"name":"__init__","nodeType":"Function","startLoc":1438,"text":"def __init__(self, frame_attrs):\n        self.frame_attributes = OrderedDict()\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":114,"header":"def _slice_mask(self, item)","id":9221,"name":"_slice_mask","nodeType":"Function","startLoc":107,"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"},{"col":4,"comment":"null","endLoc":123,"header":"def _slice_wcs(self, item)","id":9222,"name":"_slice_wcs","nodeType":"Function","startLoc":116,"text":"def _slice_wcs(self, item):\n        if self.wcs is None:\n            return None\n        try:\n            return self.wcs[item]\n        except TypeError:\n            log.info(\"wcs cannot be sliced.\")\n        return self.wcs"},{"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 behaviour 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 behaviour.\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":617,"id":9223,"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 behaviour 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 behaviour.\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 : `~numpy.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('Unknown prefix {0} for parameter {1}'\n                               ''.format(splitted[0], 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 : `~numpy.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 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)"},{"col":4,"comment":"null","endLoc":1342,"header":"def __str__(self)","id":9224,"name":"__str__","nodeType":"Function","startLoc":1341,"text":"def __str__(self):\n        return self.str"},{"col":4,"comment":"null","endLoc":1345,"header":"def __repr__(self)","id":9225,"name":"__repr__","nodeType":"Function","startLoc":1344,"text":"def __repr__(self):\n        return 'Production(' + str(self) + ')'"},{"col":4,"comment":"null","endLoc":1348,"header":"def __len__(self)","id":9226,"name":"__len__","nodeType":"Function","startLoc":1347,"text":"def __len__(self):\n        return len(self.prod)"},{"col":4,"comment":"null","endLoc":1351,"header":"def __nonzero__(self)","id":9227,"name":"__nonzero__","nodeType":"Function","startLoc":1350,"text":"def __nonzero__(self):\n        return 1"},{"col":4,"comment":"null","endLoc":1354,"header":"def __getitem__(self, index)","id":9228,"name":"__getitem__","nodeType":"Function","startLoc":1353,"text":"def __getitem__(self, index):\n        return self.prod[index]"},{"col":4,"comment":"null","endLoc":1370,"header":"def lr_item(self, n)","id":9229,"name":"lr_item","nodeType":"Function","startLoc":1357,"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 = 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":"\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 : `~numpy.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":285,"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":9230,"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 : `~numpy.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('Unknown prefix {0} for parameter {1}'\n                               ''.format(splitted[0], 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":1437,"header":"def __init__(self, p, n)","id":9231,"name":"__init__","nodeType":"Function","startLoc":1428,"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":1375,"header":"def bind(self, pdict)","id":9232,"name":"bind","nodeType":"Function","startLoc":1373,"text":"def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1310,"id":9233,"name":"reduced","nodeType":"Attribute","startLoc":1310,"text":"reduced"},{"attributeType":"null","col":8,"comment":"null","endLoc":1313,"id":9234,"name":"prod","nodeType":"Attribute","startLoc":1313,"text":"self.prod"},{"attributeType":"None","col":8,"comment":"null","endLoc":1316,"id":9235,"name":"callable","nodeType":"Attribute","startLoc":1316,"text":"self.callable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1318,"id":9236,"name":"line","nodeType":"Attribute","startLoc":1318,"text":"self.line"},{"col":4,"comment":"Write a section marker line","endLoc":1996,"header":"def _write_marker(self, indent_string, depth, entry, comment)","id":9237,"name":"_write_marker","nodeType":"Function","startLoc":1990,"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":1326,"id":9238,"name":"usyms","nodeType":"Attribute","startLoc":1326,"text":"self.usyms"},{"attributeType":"null","col":12,"comment":"null","endLoc":1339,"id":9239,"name":"str","nodeType":"Attribute","startLoc":1339,"text":"self.str"},{"col":4,"comment":"Deal with a comment.","endLoc":2006,"header":"def _handle_comment(self, comment)","id":9240,"name":"_handle_comment","nodeType":"Function","startLoc":1999,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1314,"id":9241,"name":"number","nodeType":"Attribute","startLoc":1314,"text":"self.number"},{"attributeType":"null","col":8,"comment":"null","endLoc":1317,"id":9242,"name":"file","nodeType":"Attribute","startLoc":1317,"text":"self.file"},{"attributeType":"null","col":8,"comment":"null","endLoc":1315,"id":9243,"name":"func","nodeType":"Attribute","startLoc":1315,"text":"self.func"},{"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":2123,"header":"def write(self, outfile=None, section=None)","id":9244,"name":"write","nodeType":"Function","startLoc":2011,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1319,"id":9245,"name":"prec","nodeType":"Attribute","startLoc":1319,"text":"self.prec"},{"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":486,"header":"def _arithmetic_wcs(self, operation, operand, compare_wcs, **kwds)","id":9246,"name":"_arithmetic_wcs","nodeType":"Function","startLoc":441,"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 self.wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":1323,"id":9247,"name":"len","nodeType":"Attribute","startLoc":1323,"text":"self.len"},{"attributeType":"null","col":8,"comment":"null","endLoc":1312,"id":9248,"name":"name","nodeType":"Attribute","startLoc":1312,"text":"self.name"},{"attributeType":"null","col":8,"comment":"null","endLoc":1332,"id":9249,"name":"lr_items","nodeType":"Attribute","startLoc":1332,"text":"self.lr_items"},{"attributeType":"None","col":8,"comment":"null","endLoc":1333,"id":9250,"name":"lr_next","nodeType":"Attribute","startLoc":1333,"text":"self.lr_next"},{"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 : `~numpy.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":324,"header":"def _arithmetic_data(self, operation, operand, **kwds)","id":9251,"name":"_arithmetic_data","nodeType":"Function","startLoc":287,"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 : `~numpy.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"},{"className":"MiniProduction","col":0,"comment":"null","endLoc":1400,"id":9252,"nodeType":"Class","startLoc":1381,"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":1389,"header":"def __init__(self, str, name, len, func, file, line)","id":9253,"name":"__init__","nodeType":"Function","startLoc":1382,"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":1392,"header":"def __str__(self)","id":9254,"name":"__str__","nodeType":"Function","startLoc":1391,"text":"def __str__(self):\n        return self.str"},{"col":4,"comment":"null","endLoc":1395,"header":"def __repr__(self)","id":9255,"name":"__repr__","nodeType":"Function","startLoc":1394,"text":"def __repr__(self):\n        return 'MiniProduction(%s)' % self.str"},{"col":4,"comment":"null","endLoc":1400,"header":"def bind(self, pdict)","id":9256,"name":"bind","nodeType":"Function","startLoc":1398,"text":"def bind(self, pdict):\n        if self.func:\n            self.callable = pdict[self.func]"},{"attributeType":"null","col":8,"comment":"null","endLoc":1389,"id":9257,"name":"str","nodeType":"Attribute","startLoc":1389,"text":"self.str"},{"attributeType":"None","col":8,"comment":"null","endLoc":1386,"id":9258,"name":"callable","nodeType":"Attribute","startLoc":1386,"text":"self.callable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1387,"id":9259,"name":"file","nodeType":"Attribute","startLoc":1387,"text":"self.file"},{"attributeType":"null","col":8,"comment":"null","endLoc":1384,"id":9260,"name":"len","nodeType":"Attribute","startLoc":1384,"text":"self.len"},{"col":4,"comment":"null","endLoc":876,"header":"def parse(self,input,source=None,ignore={})","id":9261,"name":"parse","nodeType":"Function","startLoc":874,"text":"def parse(self,input,source=None,ignore={}):\n        self.ignore = ignore\n        self.parser = self.parsegen(input,source)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1385,"id":9262,"name":"func","nodeType":"Attribute","startLoc":1385,"text":"self.func"},{"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":396,"header":"def _arithmetic_uncertainty(self, operation, operand, result, correlation,\n                                **kwds)","id":9263,"name":"_arithmetic_uncertainty","nodeType":"Function","startLoc":326,"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":"null","endLoc":62,"header":"def __init__(self, default=None, secondary_attribute='')","id":9264,"name":"__init__","nodeType":"Function","startLoc":59,"text":"def __init__(self, default=None, secondary_attribute=''):\n        self.default = default\n        self.secondary_attribute = secondary_attribute\n        super().__init__()"},{"col":4,"comment":"null","endLoc":890,"header":"def token(self)","id":9265,"name":"token","nodeType":"Function","startLoc":883,"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":8,"comment":"null","endLoc":1388,"id":9266,"name":"line","nodeType":"Attribute","startLoc":1388,"text":"self.line"},{"attributeType":"null","col":12,"comment":"null","endLoc":224,"id":9267,"name":"t_INTEGER","nodeType":"Attribute","startLoc":224,"text":"self.t_INTEGER"},{"attributeType":"null","col":8,"comment":"null","endLoc":163,"id":9268,"name":"macros","nodeType":"Attribute","startLoc":163,"text":"self.macros"},{"attributeType":"null","col":8,"comment":"null","endLoc":623,"id":9269,"name":"source","nodeType":"Attribute","startLoc":623,"text":"self.source"},{"attributeType":"null","col":8,"comment":"null","endLoc":162,"id":9270,"name":"lexer","nodeType":"Attribute","startLoc":162,"text":"self.lexer"},{"attributeType":"None","col":12,"comment":"null","endLoc":247,"id":9271,"name":"t_NEWLINE","nodeType":"Attribute","startLoc":247,"text":"self.t_NEWLINE"},{"attributeType":"null","col":12,"comment":"null","endLoc":216,"id":9272,"name":"t_ID","nodeType":"Attribute","startLoc":216,"text":"self.t_ID"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":9273,"name":"path","nodeType":"Attribute","startLoc":164,"text":"self.path"},{"attributeType":"null","col":8,"comment":"null","endLoc":252,"id":9274,"name":"t_WS","nodeType":"Attribute","startLoc":252,"text":"self.t_WS"},{"attributeType":"null","col":8,"comment":"null","endLoc":1383,"id":9275,"name":"name","nodeType":"Attribute","startLoc":1383,"text":"self.name"},{"className":"LRItem","col":0,"comment":"null","endLoc":1447,"id":9276,"nodeType":"Class","startLoc":1427,"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":1444,"header":"def __str__(self)","id":9277,"name":"__str__","nodeType":"Function","startLoc":1439,"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":4,"comment":"null","endLoc":1447,"header":"def __repr__(self)","id":9278,"name":"__repr__","nodeType":"Function","startLoc":1446,"text":"def __repr__(self):\n        return 'LRItem(' + str(self) + ')'"},{"attributeType":"null","col":8,"comment":"null","endLoc":1431,"id":9279,"name":"number","nodeType":"Attribute","startLoc":1431,"text":"self.number"},{"attributeType":"null","col":8,"comment":"null","endLoc":1435,"id":9280,"name":"prod","nodeType":"Attribute","startLoc":1435,"text":"self.prod"},{"attributeType":"null","col":8,"comment":"null","endLoc":1436,"id":9281,"name":"len","nodeType":"Attribute","startLoc":1436,"text":"self.len"},{"attributeType":"None","col":8,"comment":"null","endLoc":173,"id":9282,"name":"parser","nodeType":"Attribute","startLoc":173,"text":"self.parser"},{"attributeType":"null","col":8,"comment":"null","endLoc":1432,"id":9283,"name":"lr_index","nodeType":"Attribute","startLoc":1432,"text":"self.lr_index"},{"attributeType":"null","col":12,"comment":"null","endLoc":225,"id":9284,"name":"t_INTEGER_TYPE","nodeType":"Attribute","startLoc":225,"text":"self.t_INTEGER_TYPE"},{"attributeType":"null","col":8,"comment":"null","endLoc":875,"id":9285,"name":"ignore","nodeType":"Attribute","startLoc":875,"text":"self.ignore"},{"attributeType":"null","col":8,"comment":"null","endLoc":1433,"id":9286,"name":"lookaheads","nodeType":"Attribute","startLoc":1433,"text":"self.lookaheads"},{"attributeType":"null","col":8,"comment":"null","endLoc":1437,"id":9287,"name":"usyms","nodeType":"Attribute","startLoc":1437,"text":"self.usyms"},{"attributeType":"null","col":12,"comment":"null","endLoc":233,"id":9288,"name":"t_STRING","nodeType":"Attribute","startLoc":233,"text":"self.t_STRING"},{"attributeType":"None","col":12,"comment":"null","endLoc":239,"id":9289,"name":"t_SPACE","nodeType":"Attribute","startLoc":239,"text":"self.t_SPACE"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":9290,"name":"temp_path","nodeType":"Attribute","startLoc":165,"text":"self.temp_path"},{"attributeType":"null","col":8,"comment":"null","endLoc":1429,"id":9291,"name":"name","nodeType":"Attribute","startLoc":1429,"text":"self.name"},{"col":0,"comment":"\\s+","endLoc":36,"header":"def t_CPP_WS(t)","id":9292,"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"},{"className":"GrammarError","col":0,"comment":"null","endLoc":1471,"id":9293,"nodeType":"Class","startLoc":1470,"text":"class GrammarError(YaccError):\n    pass"},{"className":"Grammar","col":0,"comment":"null","endLoc":1958,"id":9294,"nodeType":"Class","startLoc":1473,"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":0,"comment":"(((((0x)|(0X))[0-9a-fA-F]+)|(\\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)","endLoc":47,"header":"def CPP_INTEGER(t)","id":9295,"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":9296,"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":"null","endLoc":1511,"header":"def __len__(self)","id":9297,"name":"__len__","nodeType":"Function","startLoc":1510,"text":"def __len__(self):\n        return len(self.Productions)"},{"col":4,"comment":"null","endLoc":1514,"header":"def __getitem__(self, index)","id":9298,"name":"__getitem__","nodeType":"Function","startLoc":1513,"text":"def __getitem__(self, index):\n        return self.Productions[index]"},{"col":4,"comment":"null","endLoc":1530,"header":"def set_precedence(self, term, assoc, level)","id":9299,"name":"set_precedence","nodeType":"Function","startLoc":1524,"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":0,"comment":"(L)?\\'([^\\\\\\n]|(\\\\(.|\\n)))*?\\'","endLoc":64,"header":"def t_CPP_CHAR(t)","id":9300,"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":"(/\\*(.|\\n)*?\\*/)","endLoc":73,"header":"def t_CPP_COMMENT1(t)","id":9301,"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":4,"comment":"null","endLoc":1624,"header":"def add_production(self, prodname, syms, func=None, file='', line=0)","id":9302,"name":"add_production","nodeType":"Function","startLoc":1549,"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":"\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":439,"header":"def _arithmetic_mask(self, operation, operand, handle_mask, **kwds)","id":9303,"name":"_arithmetic_mask","nodeType":"Function","startLoc":398,"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)"},{"col":0,"comment":"(//.*?(\\n|$))","endLoc":79,"header":"def t_CPP_COMMENT2(t)","id":9304,"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'"},{"col":0,"comment":"null","endLoc":85,"header":"def t_error(t)","id":9305,"name":"t_error","nodeType":"Function","startLoc":81,"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"},{"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":514,"header":"def _arithmetic_meta(self, operation, operand, handle_meta, **kwds)","id":9306,"name":"_arithmetic_meta","nodeType":"Function","startLoc":488,"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":520,"header":"@sharedmethod\n    @format_doc(_arit_doc, name='addition', op='+')\n    def add(self, operand, operand2=None, **kwargs)","id":9307,"name":"add","nodeType":"Function","startLoc":516,"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":526,"header":"@sharedmethod\n    @format_doc(_arit_doc, name='subtraction', op='-')\n    def subtract(self, operand, operand2=None, **kwargs)","id":9308,"name":"subtract","nodeType":"Function","startLoc":522,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":9309,"name":"STRING_TYPES","nodeType":"Attribute","startLoc":16,"text":"STRING_TYPES"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":9310,"name":"STRING_TYPES","nodeType":"Attribute","startLoc":18,"text":"STRING_TYPES"},{"attributeType":"null","col":4,"comment":"null","endLoc":19,"id":9311,"name":"xrange","nodeType":"Attribute","startLoc":19,"text":"xrange"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":9312,"name":"tokens","nodeType":"Attribute","startLoc":26,"text":"tokens"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":9313,"name":"literals","nodeType":"Attribute","startLoc":30,"text":"literals"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":9314,"name":"t_CPP_POUND","nodeType":"Attribute","startLoc":38,"text":"t_CPP_POUND"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":9315,"name":"t_CPP_DPOUND","nodeType":"Attribute","startLoc":39,"text":"t_CPP_DPOUND"},{"attributeType":"null","col":0,"comment":"null","endLoc":42,"id":9316,"name":"t_CPP_ID","nodeType":"Attribute","startLoc":42,"text":"t_CPP_ID"},{"attributeType":"function","col":0,"comment":"null","endLoc":49,"id":9317,"name":"t_CPP_INTEGER","nodeType":"Attribute","startLoc":49,"text":"t_CPP_INTEGER"},{"attributeType":"null","col":0,"comment":"null","endLoc":52,"id":9318,"name":"t_CPP_FLOAT","nodeType":"Attribute","startLoc":52,"text":"t_CPP_FLOAT"},{"attributeType":"null","col":0,"comment":"null","endLoc":109,"id":9319,"name":"_trigraph_pat","nodeType":"Attribute","startLoc":109,"text":"_trigraph_pat"},{"attributeType":"null","col":0,"comment":"null","endLoc":110,"id":9320,"name":"_trigraph_rep","nodeType":"Attribute","startLoc":110,"text":"_trigraph_rep"},{"attributeType":"null","col":22,"comment":"null","endLoc":893,"id":9321,"name":"lex","nodeType":"Attribute","startLoc":893,"text":"lex"},{"attributeType":"null","col":4,"comment":"null","endLoc":894,"id":9322,"name":"lexer","nodeType":"Attribute","startLoc":894,"text":"lexer"},{"col":4,"comment":"null","endLoc":532,"header":"@sharedmethod\n    @format_doc(_arit_doc, name=\"multiplication\", op=\"*\")\n    def multiply(self, operand, operand2=None, **kwargs)","id":9323,"name":"multiply","nodeType":"Function","startLoc":528,"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":898,"id":9324,"name":"f","nodeType":"Attribute","startLoc":898,"text":"f"},{"attributeType":"null","col":4,"comment":"null","endLoc":899,"id":9325,"name":"input","nodeType":"Attribute","startLoc":899,"text":"input"},{"attributeType":"Preprocessor","col":4,"comment":"null","endLoc":901,"id":9326,"name":"p","nodeType":"Attribute","startLoc":901,"text":"p"},{"col":4,"comment":"null","endLoc":538,"header":"@sharedmethod\n    @format_doc(_arit_doc, name=\"division\", op=\"/\")\n    def divide(self, operand, operand2=None, **kwargs)","id":9327,"name":"divide","nodeType":"Function","startLoc":534,"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":"\n        Overrides getattr to return coordinates that this can be transformed\n        to, based on the alias attr in the master transform graph.\n        ","endLoc":517,"header":"def __getattr__(self, attr)","id":9328,"name":"__getattr__","nodeType":"Function","startLoc":487,"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 master transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self.frame.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(\"'{0}' object has no attribute '{1}'\"\n                             .format(self.__class__.__name__, attr))"},{"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":617,"header":"@sharedmethod\n    def _prepare_then_do_arithmetic(self_or_cls, operation, operand, operand2,\n                                    **kwargs)","id":9329,"name":"_prepare_then_do_arithmetic","nodeType":"Function","startLoc":540,"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":"None","col":8,"comment":"null","endLoc":904,"id":9330,"name":"tok","nodeType":"Attribute","startLoc":904,"text":"tok"},{"col":4,"comment":"null","endLoc":544,"header":"def __setattr__(self, attr, val)","id":9331,"name":"__setattr__","nodeType":"Function","startLoc":519,"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.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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)"},{"col":4,"comment":"null","endLoc":570,"header":"def __delattr__(self, attr)","id":9332,"name":"__delattr__","nodeType":"Function","startLoc":546,"text":"def __delattr__(self, attr):\n        # mirror __setattr__ above\n        if '_sky_coord_frame' in self.__dict__:\n            if self.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":378,"id":9333,"name":"uncertainty","nodeType":"Attribute","startLoc":378,"text":"self.uncertainty"},{"col":0,"comment":"","endLoc":10,"header":"cpp.py#<anonymous>","id":9334,"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)"},{"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":37,"id":9335,"nodeType":"Class","startLoc":10,"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\n    @classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\n        Read and parse gridded N-dimensional data and return as an\n        NDData-derived object.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily reading a file in the supported data\n        formats.\n        \"\"\"\n        return io_registry.read(cls, *args, **kwargs)\n\n    def write(self, *args, **kwargs):\n        \"\"\"\n        Write a gridded N-dimensional data object out in specified format.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily writing a file in the supported data\n        formats.\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)"},{"col":4,"comment":"\n        Read and parse gridded N-dimensional data and return as an\n        NDData-derived object.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily reading a file in the supported data\n        formats.\n        ","endLoc":27,"header":"@classmethod\n    def read(cls, *args, **kwargs)","id":9336,"name":"read","nodeType":"Function","startLoc":17,"text":"@classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\n        Read and parse gridded N-dimensional data and return as an\n        NDData-derived object.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily reading a file in the supported data\n        formats.\n        \"\"\"\n        return io_registry.read(cls, *args, **kwargs)"},{"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":593,"header":"@override__dir__\n    def __dir__(self)","id":9337,"name":"__dir__","nodeType":"Function","startLoc":572,"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"},{"fileName":"setup_package.py","filePath":"astropy/nddata","id":9338,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\ndef get_package_data():\n    return {'astropy.nddata.tests': ['data/*.fits']}\n"},{"col":0,"comment":"null","endLoc":5,"header":"def get_package_data()","id":9339,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    return {'astropy.nddata.tests': ['data/*.fits']}"},{"col":4,"comment":"\n        Write a gridded N-dimensional data object out in specified format.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily writing a file in the supported data\n        formats.\n        ","endLoc":37,"header":"def write(self, *args, **kwargs)","id":9340,"name":"write","nodeType":"Function","startLoc":29,"text":"def write(self, *args, **kwargs):\n        \"\"\"\n        Write a gridded N-dimensional data object out in specified format.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily writing a file in the supported data\n        formats.\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)"},{"fileName":"ccddata.py","filePath":"astropy/nddata","id":9341,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"This module implements the base CCDData class.\"\"\"\n\nimport numpy as np\n\nfrom .compat import NDDataArray\nfrom .nduncertainty import StdDevUncertainty, NDUncertainty\nfrom ..io import fits, registry\nfrom .. import units as u\nfrom .. import log\nfrom ..wcs import WCS\nfrom ..utils.decorators import sharedmethod\n\n\n__all__ = ['CCDData', 'fits_ccddata_reader', 'fits_ccddata_writer']\n\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 temporarly 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__ = (\"See `astropy.nddata.NDArithmeticMixin.{}`.\"\n                         \"\".format(func.__name__))\n        return sharedmethod(inner)\n    return decorator\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 `numpy.ndarray`-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`, `numpy.ndarray` or \\\n            None, optional\n        Uncertainties on the data.\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    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\n        # Check if a unit is set. This can be temporarly 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    @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        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):\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        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        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            if self.uncertainty.__class__.__name__ != 'StdDevUncertainty':\n                raise ValueError('only StdDevUncertainty can be saved.')\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 and\n                    self.uncertainty.unit != self.unit):\n                raise ValueError('saving uncertainties with a unit differing'\n                                 'from the data unit is not supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array,\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['HIERARCH {0}'.format(key.upper())] = (\n                short_name, \"Shortened name for {}\".format(key))\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value\n\n\n# This needs to be importable by the tests...\n_KEEP_THESE_KEYWORDS_IN_HEADER = [\n    'JD-OBS',\n    'MJD-OBS',\n    'DATE-OBS'\n]\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 informations 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    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, **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, optional\n        FITS extension from which CCDData should be initialized. If zero and\n        and no data in the primary extension, it will search for the first\n        extension with data. The header will be added to the primary header.\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    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 = 'unsupported keyword: {0}.'.format(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            uncertainty = StdDevUncertainty(hdus[hdu_uncertainty].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.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(\"first HDU with data is extension \"\n                             \"{0}.\".format(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 unit is not None and fits_unit_string:\n            log.info(\"using the unit {0} passed to the FITS reader instead of \"\n                     \"the unit {1} in the FITS file.\".format(unit,\n                                                             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(ccd_data, filename, hdu_mask='MASK',\n                        hdu_uncertainty='UNCERT', hdu_flags=None, **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    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(hdu_mask=hdu_mask, hdu_uncertainty=hdu_uncertainty,\n                          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\ntry:\n    CCDData.read.__doc__ = fits_ccddata_reader.__doc__\nexcept AttributeError:\n    CCDData.read.__func__.__doc__ = fits_ccddata_reader.__doc__\n\ntry:\n    CCDData.write.__doc__ = fits_ccddata_writer.__doc__\nexcept AttributeError:\n    CCDData.write.__func__.__doc__ = fits_ccddata_writer.__doc__\n"},{"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    Parameters\n    -----------\n    data : `~numpy.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 : `~numpy.ndarray`-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 : `~numpy.ndarray`-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 : undefined, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defind 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":296,"id":9342,"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    Parameters\n    -----------\n    data : `~numpy.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 : `~numpy.ndarray`-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 : `~numpy.ndarray`-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 : undefined, optional\n        WCS-object containing the world coordinate system for the data.\n\n        .. warning::\n            This is not yet defind 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 self.unit and value._unit:\n                    try:\n                        scaling = (1 * value._unit).to(self.unit)\n                    except UnitsError:\n                        raise UnitConversionError(\n                            'Cannot convert unit of uncertainty to unit of '\n                            '{0} object.'.format(class_name))\n                    value.array *= scaling\n                elif 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 {0} 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 equivalence pairs, optional\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        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"},{"col":4,"comment":"null","endLoc":103,"header":"def __init__(self, data, *args, flags=None, **kwargs)","id":9343,"name":"__init__","nodeType":"Function","startLoc":82,"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":"null","endLoc":606,"header":"def __repr__(self)","id":9344,"name":"__repr__","nodeType":"Function","startLoc":595,"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())"},{"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],\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":654,"id":9345,"nodeType":"Class","startLoc":361,"text":"class StdDevUncertainty(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],\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\n        if self.array is None:\n            # Formula: sigma = dB\n\n            if other_uncert.unit is not None and (\n                        result_data.unit != 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                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(other_uncert.array)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA\n\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(self.array)\n\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 + 2*cor*dA*dB)\n\n            # Calculate: dA (this) and dB (other)\n            if self.unit != other_uncert.unit:\n                # In case the two uncertainties (or data) have different units\n                # we need to use quantity operations. The case where only one\n                # has a unit and the other doesn't is not possible with\n                # addition and would have raised an exception in the data\n                # computation\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                # Since both units are the same or None we can just use\n                # numpy operations\n                this = self.array\n                other = other_uncert.array\n\n            # Determine the result depending on the correlation\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                result = np.sqrt(this**2 + other**2 + corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n\n            if isinstance(result, Quantity):\n                # In case we worked with quantities we need to return the\n                # uncertainty that has the same unit as the resulting data.\n                # Note that this call is fast if the units are the same.\n                return result.to_value(result_data.unit)\n            else:\n                return result\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        # Since the formulas are equivalent to addition you should look at the\n        # explanations provided in _propagate_add\n\n        if self.array is None:\n            if other_uncert.unit is not None and (\n                        result_data.unit != other_uncert.unit):\n                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                return deepcopy(other_uncert.array)\n        elif other_uncert.array is None:\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                return deepcopy(self.array)\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 - 2*cor*dA*dB)\n            if self.unit != other_uncert.unit:\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                this = self.array\n                other = other_uncert.array\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                # The only difference to addition is that the correlation is\n                # subtracted.\n                result = np.sqrt(this**2 + other**2 - corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n            if isinstance(result, Quantity):\n                return result.to_value(result_data.unit)\n            else:\n                return result\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\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 self.array is None:\n            # Formula: sigma = |A| * dB\n\n            # We want the result to have the same unit as the parent, so we\n            # only need to convert the unit of the other uncertainty if it is\n            # different from its data's unit.\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                other = (other_uncert.array * other_uncert.unit).to(\n                            other_uncert.parent_nddata.unit).value\n            else:\n                other = other_uncert.array\n            return np.abs(self.parent_nddata.data * other)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA * |B|\n\n            # Just the reversed case\n            if self.unit != self.parent_nddata.unit:\n                this = (self.array * self.unit).to(\n                                            self.parent_nddata.unit).value\n            else:\n                this = self.array\n            return np.abs(other_uncert.parent_nddata.data * this)\n\n        else:\n            # Formula: sigma = |AB|*sqrt((dA/A)**2+(dB/B)**2+2*dA/A*dB/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            # Formula: sigma = sqrt((dA*B)**2 + (dB*A)**2 + (2 * cor * ABdAdB))\n\n            # Calculate: dA * B (left)\n            if self.unit != self.parent_nddata.unit:\n                # To get the unit right we need to convert the unit of\n                # each uncertainty to the same unit as it's parent\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value *\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array * other_uncert.parent_nddata.data\n\n            # Calculate: dB * A (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                        other_uncert.parent_nddata.unit).value *\n                        self.parent_nddata.data)\n            else:\n                right = other_uncert.array * self.parent_nddata.data\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = (2 * correlation * left * right)\n                return np.sqrt(left**2 + right**2 + corr)\n            else:\n                return np.sqrt(left**2 + right**2)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n\n        # For division we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if self.array is None:\n            # Formula: sigma = |(A / B) * (dB / B)|\n\n            # Calculate: dB / B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                # We need (dB / B) to be dimensionless so we convert\n                # (if necessary) dB to the same unit as B\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data)\n            else:\n                right = (other_uncert.array / other_uncert.parent_nddata.data)\n            return np.abs(result_data * right)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA / |B|.\n\n            # Calculate: dA\n            if self.unit != self.parent_nddata.unit:\n                # We need to convert dA to the unit of A to have a result that\n                # matches the resulting data's unit.\n                left = (self.array * self.unit).to(\n                        self.parent_nddata.unit).value\n            else:\n                left = self.array\n\n            return np.abs(left / other_uncert.parent_nddata.data)\n\n        else:\n            # Formula: sigma = |A/B|*sqrt((dA/A)**2+(dB/B)**2-2*dA/A*dB/B*cor)\n\n            # As with multiplication this formula creates NaNs where A is zero.\n            # So I'll rewrite it again:\n            # => sigma = sqrt((dA/B)**2 + (AdB/B**2)**2 - 2*cor*AdAdB/B**3)\n\n            # So we need to calculate dA/B in the same units as the result\n            # and the dimensionless dB/B to get a resulting uncertainty with\n            # the same unit as the data.\n\n            # Calculate: dA/B (left)\n            if self.unit != self.parent_nddata.unit:\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value /\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array / other_uncert.parent_nddata.data\n\n            # Calculate: dB/B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data) * result_data\n            else:\n                right = (result_data * other_uncert.array /\n                         other_uncert.parent_nddata.data)\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * left * right\n                # This differs from multiplication because the correlation\n                # term needs to be subtracted\n                return np.sqrt(left**2 + right**2 - corr)\n            else:\n                return np.sqrt(left**2 + right**2)"},{"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":671,"header":"def to_string(self, style='decimal', **kwargs)","id":9346,"name":"to_string","nodeType":"Function","startLoc":608,"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('Invalid style.  Valid options are: {0}'.format(\",\".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                            + \" \" +\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                                 + \" \" +\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"},{"col":0,"comment":"null","endLoc":1460,"header":"def rightmost_terminal(symbols, terminals)","id":9347,"name":"rightmost_terminal","nodeType":"Function","startLoc":1454,"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"},{"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":413,"header":"@property\n    def supports_correlated(self)","id":9348,"name":"supports_correlated","nodeType":"Function","startLoc":405,"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":419,"header":"@property\n    def uncertainty_type(self)","id":9349,"name":"uncertainty_type","nodeType":"Function","startLoc":415,"text":"@property\n    def uncertainty_type(self):\n        \"\"\"``\"std\"`` : `StdDevUncertainty` implements standard deviation.\n        \"\"\"\n        return 'std'"},{"col":4,"comment":"null","endLoc":425,"header":"def _convert_uncertainty(self, other_uncert)","id":9350,"name":"_convert_uncertainty","nodeType":"Function","startLoc":421,"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":486,"header":"def _propagate_add(self, other_uncert, result_data, correlation)","id":9351,"name":"_propagate_add","nodeType":"Function","startLoc":427,"text":"def _propagate_add(self, other_uncert, result_data, correlation):\n\n        if self.array is None:\n            # Formula: sigma = dB\n\n            if other_uncert.unit is not None and (\n                        result_data.unit != 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                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(other_uncert.array)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA\n\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(self.array)\n\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 + 2*cor*dA*dB)\n\n            # Calculate: dA (this) and dB (other)\n            if self.unit != other_uncert.unit:\n                # In case the two uncertainties (or data) have different units\n                # we need to use quantity operations. The case where only one\n                # has a unit and the other doesn't is not possible with\n                # addition and would have raised an exception in the data\n                # computation\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                # Since both units are the same or None we can just use\n                # numpy operations\n                this = self.array\n                other = other_uncert.array\n\n            # Determine the result depending on the correlation\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                result = np.sqrt(this**2 + other**2 + corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n\n            if isinstance(result, Quantity):\n                # In case we worked with quantities we need to return the\n                # uncertainty that has the same unit as the resulting data.\n                # Note that this call is fast if the units are the same.\n                return result.to_value(result_data.unit)\n            else:\n                return result"},{"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":711,"header":"def is_equivalent_frame(self, other)","id":9352,"name":"is_equivalent_frame","nodeType":"Function","startLoc":673,"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 np.any(getattr(self, fattrnm) != 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\")"},{"col":4,"comment":"null","endLoc":109,"header":"@property\n    def uncertainty(self)","id":9353,"name":"uncertainty","nodeType":"Function","startLoc":107,"text":"@property\n    def uncertainty(self):\n        return self._uncertainty"},{"col":4,"comment":"null","endLoc":135,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":9354,"name":"uncertainty","nodeType":"Function","startLoc":111,"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 self.unit and value._unit:\n                    try:\n                        scaling = (1 * value._unit).to(self.unit)\n                    except UnitsError:\n                        raise UnitConversionError(\n                            'Cannot convert unit of uncertainty to unit of '\n                            '{0} object.'.format(class_name))\n                    value.array *= scaling\n                elif 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 {0} 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"},{"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            unintutive 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:`/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":764,"header":"def separation(self, other)","id":9355,"name":"separation","nodeType":"Function","startLoc":714,"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            unintutive 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:`/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                other = other.transform_to(self, merge_attributes=False)\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)"},{"col":4,"comment":"null","endLoc":1640,"header":"def set_start(self, start=None)","id":9356,"name":"set_start","nodeType":"Function","startLoc":1633,"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":"\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:`/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":803,"header":"def separation_3d(self, other)","id":9357,"name":"separation_3d","nodeType":"Function","startLoc":766,"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:`/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                other = other.transform_to(self, merge_attributes=False)\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        return Distance((self.cartesian - other.cartesian).norm())"},{"col":4,"comment":"null","endLoc":522,"header":"def _propagate_subtract(self, other_uncert, result_data, correlation)","id":9358,"name":"_propagate_subtract","nodeType":"Function","startLoc":488,"text":"def _propagate_subtract(self, other_uncert, result_data, correlation):\n        # Since the formulas are equivalent to addition you should look at the\n        # explanations provided in _propagate_add\n\n        if self.array is None:\n            if other_uncert.unit is not None and (\n                        result_data.unit != other_uncert.unit):\n                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                return deepcopy(other_uncert.array)\n        elif other_uncert.array is None:\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                return deepcopy(self.array)\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 - 2*cor*dA*dB)\n            if self.unit != other_uncert.unit:\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                this = self.array\n                other = other_uncert.array\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                # The only difference to addition is that the correlation is\n                # subtracted.\n                result = np.sqrt(this**2 + other**2 - corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n            if isinstance(result, Quantity):\n                return result.to_value(result_data.unit)\n            else:\n                return result"},{"col":4,"comment":"null","endLoc":140,"header":"@property\n    def unit(self)","id":9359,"name":"unit","nodeType":"Function","startLoc":138,"text":"@property\n    def unit(self):\n        return self._unit"},{"col":4,"comment":"null","endLoc":160,"header":"@unit.setter\n    def unit(self, value)","id":9360,"name":"unit","nodeType":"Function","startLoc":142,"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":1662,"header":"def find_unreachable(self)","id":9361,"name":"find_unreachable","nodeType":"Function","startLoc":1649,"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]"},{"attributeType":"null","col":4,"comment":"null","endLoc":473,"id":9362,"name":"parse","nodeType":"Attribute","startLoc":473,"text":"parse"},{"col":4,"comment":"null","endLoc":1727,"header":"def infinite_cycles(self)","id":9364,"name":"infinite_cycles","nodeType":"Function","startLoc":1672,"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":168,"header":"@property\n    def mask(self)","id":9365,"name":"mask","nodeType":"Function","startLoc":163,"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":181,"header":"@mask.setter\n    def mask(self, value)","id":9366,"name":"mask","nodeType":"Function","startLoc":170,"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":188,"header":"@property\n    def shape(self)","id":9367,"name":"shape","nodeType":"Function","startLoc":183,"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":195,"header":"@property\n    def size(self)","id":9368,"name":"size","nodeType":"Function","startLoc":190,"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":202,"header":"@property\n    def dtype(self)","id":9369,"name":"dtype","nodeType":"Function","startLoc":197,"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":209,"header":"@property\n    def ndim(self)","id":9370,"name":"ndim","nodeType":"Function","startLoc":204,"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":213,"header":"@property\n    def flags(self)","id":9371,"name":"flags","nodeType":"Function","startLoc":211,"text":"@property\n    def flags(self):\n        return self._flags"},{"col":4,"comment":"null","endLoc":230,"header":"@flags.setter\n    def flags(self, value)","id":9372,"name":"flags","nodeType":"Function","startLoc":215,"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        Computes angular offsets to go *from* this coordinate *to* another.\n\n        Parameters\n        ----------\n        tocoord : `~astropy.coordinates.BaseCoordinateFrame`\n            The coordinate to offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction (i.e., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction (i.e., 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\n        ","endLoc":850,"header":"def spherical_offsets_to(self, tocoord)","id":9373,"name":"spherical_offsets_to","nodeType":"Function","startLoc":805,"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 offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction (i.e., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction (i.e., 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\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":1745,"header":"def undefined_symbols(self)","id":9374,"name":"undefined_symbols","nodeType":"Function","startLoc":1736,"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        This allows code that requests a Numpy array to use an NDData\n        object as a Numpy array.\n        ","endLoc":240,"header":"def __array__(self)","id":9375,"name":"__array__","nodeType":"Function","startLoc":232,"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        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 : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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":1159,"header":"def skyoffset_frame(self, rotation=None)","id":9376,"name":"skyoffset_frame","nodeType":"Function","startLoc":1143,"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 : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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)"},{"col":4,"comment":"null","endLoc":1759,"header":"def unused_terminals(self)","id":9377,"name":"unused_terminals","nodeType":"Function","startLoc":1753,"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":"\n        This ensures that a masked array is returned if self is masked.\n        ","endLoc":249,"header":"def __array_prepare__(self, array, context=None)","id":9378,"name":"__array_prepare__","nodeType":"Function","startLoc":242,"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":"null","endLoc":584,"header":"def _propagate_multiply(self, other_uncert, result_data, correlation)","id":9379,"name":"_propagate_multiply","nodeType":"Function","startLoc":524,"text":"def _propagate_multiply(self, other_uncert, result_data, correlation):\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 self.array is None:\n            # Formula: sigma = |A| * dB\n\n            # We want the result to have the same unit as the parent, so we\n            # only need to convert the unit of the other uncertainty if it is\n            # different from its data's unit.\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                other = (other_uncert.array * other_uncert.unit).to(\n                            other_uncert.parent_nddata.unit).value\n            else:\n                other = other_uncert.array\n            return np.abs(self.parent_nddata.data * other)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA * |B|\n\n            # Just the reversed case\n            if self.unit != self.parent_nddata.unit:\n                this = (self.array * self.unit).to(\n                                            self.parent_nddata.unit).value\n            else:\n                this = self.array\n            return np.abs(other_uncert.parent_nddata.data * this)\n\n        else:\n            # Formula: sigma = |AB|*sqrt((dA/A)**2+(dB/B)**2+2*dA/A*dB/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            # Formula: sigma = sqrt((dA*B)**2 + (dB*A)**2 + (2 * cor * ABdAdB))\n\n            # Calculate: dA * B (left)\n            if self.unit != self.parent_nddata.unit:\n                # To get the unit right we need to convert the unit of\n                # each uncertainty to the same unit as it's parent\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value *\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array * other_uncert.parent_nddata.data\n\n            # Calculate: dB * A (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                        other_uncert.parent_nddata.unit).value *\n                        self.parent_nddata.data)\n            else:\n                right = other_uncert.array * self.parent_nddata.data\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = (2 * correlation * left * right)\n                return np.sqrt(left**2 + right**2 + corr)\n            else:\n                return np.sqrt(left**2 + right**2)"},{"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 equivalence pairs, optional\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        UnitsError\n            If units are inconsistent.\n\n        ","endLoc":296,"header":"def convert_unit_to(self, unit, equivalencies=[])","id":9380,"name":"convert_unit_to","nodeType":"Function","startLoc":251,"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 equivalence pairs, optional\n           A list of equivalence pairs to try if the units are not\n           directly convertible.  See :ref:`unit_equivalencies`.\n\n        Returns\n        -------\n        result : `~astropy.nddata.NDData`\n            The resulting dataset\n\n        Raises\n        ------\n        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"},{"col":4,"comment":"null","endLoc":1774,"header":"def unused_rules(self)","id":9381,"name":"unused_rules","nodeType":"Function","startLoc":1768,"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":226,"header":"def __init__(self, *args, **kwargs)","id":9382,"name":"__init__","nodeType":"Function","startLoc":216,"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 and hasattr(self.data, 'lon'):\n            self.data.lon.wrap_angle = 180*u.deg\n        if (self.origin is not None and getattr(self.origin.data, 'differentials', None) or\n           (self.has_data and getattr(self.data, 'differentials', None))):\n            raise NotImplementedError('SkyOffsetFrame currently does not '\n                                      'support velocities.')"},{"col":4,"comment":"null","endLoc":1791,"header":"def unused_precedence(self)","id":9383,"name":"unused_precedence","nodeType":"Function","startLoc":1785,"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":1829,"header":"def _first(self, beta)","id":9384,"name":"_first","nodeType":"Function","startLoc":1801,"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":654,"header":"def _propagate_divide(self, other_uncert, result_data, correlation)","id":9385,"name":"_propagate_divide","nodeType":"Function","startLoc":586,"text":"def _propagate_divide(self, other_uncert, result_data, correlation):\n\n        # For division we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if self.array is None:\n            # Formula: sigma = |(A / B) * (dB / B)|\n\n            # Calculate: dB / B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                # We need (dB / B) to be dimensionless so we convert\n                # (if necessary) dB to the same unit as B\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data)\n            else:\n                right = (other_uncert.array / other_uncert.parent_nddata.data)\n            return np.abs(result_data * right)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA / |B|.\n\n            # Calculate: dA\n            if self.unit != self.parent_nddata.unit:\n                # We need to convert dA to the unit of A to have a result that\n                # matches the resulting data's unit.\n                left = (self.array * self.unit).to(\n                        self.parent_nddata.unit).value\n            else:\n                left = self.array\n\n            return np.abs(left / other_uncert.parent_nddata.data)\n\n        else:\n            # Formula: sigma = |A/B|*sqrt((dA/A)**2+(dB/B)**2-2*dA/A*dB/B*cor)\n\n            # As with multiplication this formula creates NaNs where A is zero.\n            # So I'll rewrite it again:\n            # => sigma = sqrt((dA/B)**2 + (AdB/B**2)**2 - 2*cor*AdAdB/B**3)\n\n            # So we need to calculate dA/B in the same units as the result\n            # and the dimensionless dB/B to get a resulting uncertainty with\n            # the same unit as the data.\n\n            # Calculate: dA/B (left)\n            if self.unit != self.parent_nddata.unit:\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value /\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array / other_uncert.parent_nddata.data\n\n            # Calculate: dB/B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data) * result_data\n            else:\n                right = (result_data * other_uncert.array /\n                         other_uncert.parent_nddata.data)\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * left * right\n                # This differs from multiplication because the correlation\n                # term needs to be subtracted\n                return np.sqrt(left**2 + right**2 - corr)\n            else:\n                return np.sqrt(left**2 + right**2)"},{"col":4,"comment":"null","endLoc":1864,"header":"def compute_first(self)","id":9386,"name":"compute_first","nodeType":"Function","startLoc":1836,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":474,"id":9387,"name":"error","nodeType":"Attribute","startLoc":474,"text":"error"},{"col":4,"comment":"null","endLoc":1914,"header":"def compute_follow(self, start=None)","id":9388,"name":"compute_follow","nodeType":"Function","startLoc":1873,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":475,"id":9389,"name":"request","nodeType":"Attribute","startLoc":475,"text":"request"},{"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 `numpy.ndarray`-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`, `numpy.ndarray` or \n            None, optional\n        Uncertainties on the data.\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    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":375,"id":9390,"nodeType":"Class","startLoc":59,"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 `numpy.ndarray`-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`, `numpy.ndarray` or \\\n            None, optional\n        Uncertainties on the data.\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    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\n        # Check if a unit is set. This can be temporarly 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    @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        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):\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        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        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            if self.uncertainty.__class__.__name__ != 'StdDevUncertainty':\n                raise ValueError('only StdDevUncertainty can be saved.')\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 and\n                    self.uncertainty.unit != self.unit):\n                raise ValueError('saving uncertainties with a unit differing'\n                                 'from the data unit is not supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array,\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['HIERARCH {0}'.format(key.upper())] = (\n                short_name, \"Shortened name for {}\".format(key))\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":476,"id":9391,"name":"response","nodeType":"Attribute","startLoc":476,"text":"response"},{"attributeType":"null","col":4,"comment":"null","endLoc":477,"id":9392,"name":"robotparser","nodeType":"Attribute","startLoc":477,"text":"robotparser"},{"className":"Iterator","col":4,"comment":"null","endLoc":558,"id":9393,"nodeType":"Class","startLoc":555,"text":"class Iterator(object):\n\n        def next(self):\n            return type(self).__next__(self)"},{"col":8,"comment":"null","endLoc":558,"header":"def next(self)","id":9394,"name":"next","nodeType":"Function","startLoc":557,"text":"def next(self):\n            return type(self).__next__(self)"},{"col":4,"comment":"null","endLoc":1958,"header":"def build_lritems(self)","id":9395,"name":"build_lritems","nodeType":"Function","startLoc":1932,"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":166,"header":"def __init__(self, *args, **kwd)","id":9396,"name":"__init__","nodeType":"Function","startLoc":155,"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\n        # Check if a unit is set. This can be temporarly 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":"\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:`/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 : integer 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`\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":913,"header":"def match_to_catalog_sky(self, catalogcoord, nthneighbor=1)","id":9397,"name":"match_to_catalog_sky","nodeType":"Function","startLoc":852,"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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self_in_catalog_frame, catalogcoord,\n                                    nthneighbor=nthneighbor,\n                                    storekdtree='_kdtree_sky')\n        return res"},{"col":0,"comment":"null","endLoc":68,"header":"def match_utf8(encoding)","id":9398,"name":"match_utf8","nodeType":"Function","startLoc":67,"text":"def match_utf8(encoding):\n    return BOM_LIST.get(encoding.lower()) == 'utf_8'"},{"attributeType":"NDUncertainty","col":16,"comment":"null","endLoc":129,"id":9399,"name":"_uncertainty","nodeType":"Attribute","startLoc":129,"text":"self._uncertainty"},{"attributeType":"None","col":12,"comment":"null","endLoc":158,"id":9400,"name":"_unit","nodeType":"Attribute","startLoc":158,"text":"self._unit"},{"attributeType":"FlagCollection","col":20,"comment":"null","endLoc":222,"id":9401,"name":"_flags","nodeType":"Attribute","startLoc":222,"text":"self._flags"},{"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 : integer 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`\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":168,"header":"def match_coordinates_sky(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_sky')","id":9402,"name":"match_coordinates_sky","nodeType":"Function","startLoc":87,"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 : integer 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`\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    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"},{"col":0,"comment":"Add documentation to a function.","endLoc":77,"header":"def _add_doc(func, doc)","id":9403,"name":"_add_doc","nodeType":"Function","startLoc":75,"text":"def _add_doc(func, doc):\n    \"\"\"Add documentation to a function.\"\"\"\n    func.__doc__ = doc"},{"col":0,"comment":"Add an item to six.moves.","endLoc":488,"header":"def add_move(move)","id":9404,"name":"add_move","nodeType":"Function","startLoc":486,"text":"def add_move(move):\n    \"\"\"Add an item to six.moves.\"\"\"\n    setattr(_MovedItems, move.name, move)"},{"col":0,"comment":"Remove item from six.moves.","endLoc":499,"header":"def remove_move(name)","id":9405,"name":"remove_move","nodeType":"Function","startLoc":491,"text":"def remove_move(name):\n    \"\"\"Remove item from six.moves.\"\"\"\n    try:\n        delattr(_MovedItems, name)\n    except AttributeError:\n        try:\n            del moves.__dict__[name]\n        except KeyError:\n            raise AttributeError(\"no such move, %r\" % (name,))"},{"attributeType":"null","col":8,"comment":"null","endLoc":1475,"id":9406,"name":"Productions","nodeType":"Attribute","startLoc":1475,"text":"self.Productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":1482,"id":9407,"name":"Prodmap","nodeType":"Attribute","startLoc":1482,"text":"self.Prodmap"},{"attributeType":"null","col":16,"comment":"null","endLoc":178,"id":9408,"name":"_mask","nodeType":"Attribute","startLoc":178,"text":"self._mask"},{"attributeType":"FlagCollection","col":8,"comment":"null","endLoc":103,"id":9409,"name":"flags","nodeType":"Attribute","startLoc":103,"text":"self.flags"},{"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":2329,"header":"def validate(self, validator, preserve_errors=False, copy=False,\n                 section=None)","id":9410,"name":"validate","nodeType":"Function","startLoc":2125,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1498,"id":9411,"name":"Follow","nodeType":"Attribute","startLoc":1498,"text":"self.Follow"},{"attributeType":"null","col":8,"comment":"null","endLoc":1503,"id":9412,"name":"UsedPrecedence","nodeType":"Attribute","startLoc":1503,"text":"self.UsedPrecedence"},{"attributeType":"None","col":8,"comment":"null","endLoc":1507,"id":9413,"name":"Start","nodeType":"Attribute","startLoc":1507,"text":"self.Start"},{"col":4,"comment":"null","endLoc":524,"header":"def advance_iterator(it)","id":9414,"name":"advance_iterator","nodeType":"Function","startLoc":523,"text":"def advance_iterator(it):\n        return it.next()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1493,"id":9415,"name":"Nonterminals","nodeType":"Attribute","startLoc":1493,"text":"self.Nonterminals"},{"attributeType":"null","col":8,"comment":"null","endLoc":1485,"id":9416,"name":"Terminals","nodeType":"Attribute","startLoc":1485,"text":"self.Terminals"},{"attributeType":"null","col":8,"comment":"null","endLoc":1496,"id":9417,"name":"First","nodeType":"Attribute","startLoc":1496,"text":"self.First"},{"attributeType":"null","col":8,"comment":"null","endLoc":1500,"id":9418,"name":"Precedence","nodeType":"Attribute","startLoc":1500,"text":"self.Precedence"},{"attributeType":"null","col":8,"comment":"null","endLoc":1479,"id":9419,"name":"Prodnames","nodeType":"Attribute","startLoc":1479,"text":"self.Prodnames"},{"className":"VersionError","col":0,"comment":"null","endLoc":1969,"id":9420,"nodeType":"Class","startLoc":1968,"text":"class VersionError(YaccError):\n    pass"},{"className":"LRTable","col":0,"comment":"null","endLoc":2028,"id":9421,"nodeType":"Class","startLoc":1971,"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":1996,"header":"def read_table(self, module)","id":9422,"name":"read_table","nodeType":"Function","startLoc":1978,"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":8,"comment":"null","endLoc":90,"id":9423,"name":"uncertainty","nodeType":"Attribute","startLoc":90,"text":"self.uncertainty"},{"col":4,"comment":"null","endLoc":532,"header":"def callable(obj)","id":9424,"name":"callable","nodeType":"Function","startLoc":531,"text":"def callable(obj):\n        return any(\"__call__\" in klass.__dict__ for klass in type(obj).__mro__)"},{"col":4,"comment":"null","endLoc":537,"header":"def get_unbound_function(unbound)","id":9425,"name":"get_unbound_function","nodeType":"Function","startLoc":536,"text":"def get_unbound_function(unbound):\n        return unbound"},{"col":4,"comment":"null","endLoc":542,"header":"def create_unbound_method(func, cls)","id":9426,"name":"create_unbound_method","nodeType":"Function","startLoc":541,"text":"def create_unbound_method(func, cls):\n        return func"},{"col":4,"comment":"null","endLoc":547,"header":"def get_unbound_function(unbound)","id":9427,"name":"get_unbound_function","nodeType":"Function","startLoc":546,"text":"def get_unbound_function(unbound):\n        return unbound.im_func"},{"col":4,"comment":"null","endLoc":550,"header":"def create_bound_method(func, obj)","id":9428,"name":"create_bound_method","nodeType":"Function","startLoc":549,"text":"def create_bound_method(func, obj):\n        return types.MethodType(func, obj, obj.__class__)"},{"col":4,"comment":"null","endLoc":553,"header":"def create_unbound_method(func, cls)","id":9429,"name":"create_unbound_method","nodeType":"Function","startLoc":552,"text":"def create_unbound_method(func, cls):\n        return types.MethodType(func, None, cls)"},{"col":4,"comment":"null","endLoc":575,"header":"def iterkeys(d, **kw)","id":9430,"name":"iterkeys","nodeType":"Function","startLoc":574,"text":"def iterkeys(d, **kw):\n        return iter(d.keys(**kw))"},{"attributeType":"null","col":8,"comment":"null","endLoc":93,"id":9431,"name":"mask","nodeType":"Attribute","startLoc":93,"text":"self.mask"},{"col":4,"comment":"null","endLoc":578,"header":"def itervalues(d, **kw)","id":9432,"name":"itervalues","nodeType":"Function","startLoc":577,"text":"def itervalues(d, **kw):\n        return iter(d.values(**kw))"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":9433,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9434,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"compat.py#<anonymous>","id":9435,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDDataArray']"},{"col":4,"comment":"null","endLoc":581,"header":"def iteritems(d, **kw)","id":9436,"name":"iteritems","nodeType":"Function","startLoc":580,"text":"def iteritems(d, **kw):\n        return iter(d.items(**kw))"},{"col":4,"comment":"null","endLoc":584,"header":"def iterlists(d, **kw)","id":9437,"name":"iterlists","nodeType":"Function","startLoc":583,"text":"def iterlists(d, **kw):\n        return iter(d.lists(**kw))"},{"col":4,"comment":"null","endLoc":593,"header":"def iterkeys(d, **kw)","id":9438,"name":"iterkeys","nodeType":"Function","startLoc":592,"text":"def iterkeys(d, **kw):\n        return d.iterkeys(**kw)"},{"col":4,"comment":"null","endLoc":596,"header":"def itervalues(d, **kw)","id":9439,"name":"itervalues","nodeType":"Function","startLoc":595,"text":"def itervalues(d, **kw):\n        return d.itervalues(**kw)"},{"col":4,"comment":"null","endLoc":2023,"header":"def read_pickle(self, filename)","id":9440,"name":"read_pickle","nodeType":"Function","startLoc":1998,"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":599,"header":"def iteritems(d, **kw)","id":9441,"name":"iteritems","nodeType":"Function","startLoc":598,"text":"def iteritems(d, **kw):\n        return d.iteritems(**kw)"},{"fileName":"__init__.py","filePath":"astropy/nddata","id":9442,"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 .compat import *\nfrom .utils import *\nfrom .ccddata import *\n\nfrom .. 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":602,"header":"def iterlists(d, **kw)","id":9443,"name":"iterlists","nodeType":"Function","startLoc":601,"text":"def iterlists(d, **kw):\n        return d.iterlists(**kw)"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.nddata`.\n    ","endLoc":47,"id":9444,"nodeType":"Class","startLoc":30,"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":620,"header":"def b(s)","id":9445,"name":"b","nodeType":"Function","startLoc":619,"text":"def b(s):\n        return s.encode(\"latin-1\")"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":35,"id":9446,"name":"warn_unsupported_correlated","nodeType":"Attribute","startLoc":35,"text":"warn_unsupported_correlated"},{"col":4,"comment":"null","endLoc":623,"header":"def u(s)","id":9447,"name":"u","nodeType":"Function","startLoc":622,"text":"def u(s):\n        return s"},{"col":4,"comment":"null","endLoc":643,"header":"def b(s)","id":9448,"name":"b","nodeType":"Function","startLoc":642,"text":"def b(s):\n        return s"},{"col":4,"comment":"null","endLoc":647,"header":"def u(s)","id":9449,"name":"u","nodeType":"Function","startLoc":646,"text":"def u(s):\n        return unicode(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")"},{"col":4,"comment":"null","endLoc":652,"header":"def byte2int(bs)","id":9450,"name":"byte2int","nodeType":"Function","startLoc":651,"text":"def byte2int(bs):\n        return ord(bs[0])"},{"col":4,"comment":"null","endLoc":655,"header":"def indexbytes(buf, i)","id":9451,"name":"indexbytes","nodeType":"Function","startLoc":654,"text":"def indexbytes(buf, i):\n        return ord(buf[i])"},{"col":0,"comment":"null","endLoc":667,"header":"def assertCountEqual(self, *args, **kwargs)","id":9452,"name":"assertCountEqual","nodeType":"Function","startLoc":666,"text":"def assertCountEqual(self, *args, **kwargs):\n    return getattr(self, _assertCountEqual)(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":671,"header":"def assertRaisesRegex(self, *args, **kwargs)","id":9453,"name":"assertRaisesRegex","nodeType":"Function","startLoc":670,"text":"def assertRaisesRegex(self, *args, **kwargs):\n    return getattr(self, _assertRaisesRegex)(*args, **kwargs)"},{"col":0,"comment":"null","endLoc":675,"header":"def assertRegex(self, *args, **kwargs)","id":9454,"name":"assertRegex","nodeType":"Function","startLoc":674,"text":"def assertRegex(self, *args, **kwargs):\n    return getattr(self, _assertRegex)(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":686,"header":"def reraise(tp, value, tb=None)","id":9455,"name":"reraise","nodeType":"Function","startLoc":681,"text":"def reraise(tp, value, tb=None):\n        if value is None:\n            value = tp()\n        if value.__traceback__ is not tb:\n            raise value.with_traceback(tb)\n        raise value"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":42,"id":9456,"name":"warn_setting_unit_directly","nodeType":"Attribute","startLoc":42,"text":"warn_setting_unit_directly"},{"col":4,"comment":"null","endLoc":2028,"header":"def bind_callables(self, pdict)","id":9457,"name":"bind_callables","nodeType":"Function","startLoc":2026,"text":"def bind_callables(self, pdict):\n        for p in self.lr_productions:\n            p.bind(pdict)"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":50,"id":9458,"name":"conf","nodeType":"Attribute","startLoc":50,"text":"conf"},{"attributeType":"None","col":8,"comment":"null","endLoc":1976,"id":9459,"name":"lr_method","nodeType":"Attribute","startLoc":1976,"text":"self.lr_method"},{"attributeType":"None","col":8,"comment":"null","endLoc":1975,"id":9460,"name":"lr_productions","nodeType":"Attribute","startLoc":1975,"text":"self.lr_productions"},{"attributeType":"None","col":8,"comment":"null","endLoc":1974,"id":9461,"name":"lr_goto","nodeType":"Attribute","startLoc":1974,"text":"self.lr_goto"},{"attributeType":"None","col":8,"comment":"null","endLoc":1973,"id":9462,"name":"lr_action","nodeType":"Attribute","startLoc":1973,"text":"self.lr_action"},{"className":"LALRError","col":0,"comment":"null","endLoc":2090,"id":9463,"nodeType":"Class","startLoc":2089,"text":"class LALRError(YaccError):\n    pass"},{"col":0,"comment":"","endLoc":9,"header":"__init__.py#<anonymous>","id":9464,"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()"},{"className":"LRGeneratedTable","col":0,"comment":"null","endLoc":2856,"id":9465,"nodeType":"Class","startLoc":2099,"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        dr_set = {}\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                                        sprec, slevel = Productions[st_actionp[a].number].prec\n                                        rprec, rlevel = Precedence.get(a, ('right', 0))\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                                        rprec, rlevel = Productions[st_actionp[a].number].prec\n                                        sprec, slevel = Precedence.get(a, ('right', 0))\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_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)"},{"col":4,"comment":"Execute code in a namespace.","endLoc":699,"header":"def exec_(_code_, _globs_=None, _locs_=None)","id":9466,"name":"exec_","nodeType":"Function","startLoc":689,"text":"def exec_(_code_, _globs_=None, _locs_=None):\n        \"\"\"Execute code in a namespace.\"\"\"\n        if _globs_ is None:\n            frame = sys._getframe(1)\n            _globs_ = frame.f_globals\n            if _locs_ is None:\n                _locs_ = frame.f_locals\n            del frame\n        elif _locs_ is None:\n            _locs_ = _globs_\n        exec(\"\"\"exec _code_ in _globs_, _locs_\"\"\")"},{"fileName":"nduncertainty.py","filePath":"astropy/nddata","id":9467,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\nfrom abc import ABCMeta, abstractmethod\nfrom copy import deepcopy\nimport weakref\n\n# from ..utils.compat import ignored\nfrom .. import log\nfrom ..units import Unit, Quantity\n\n__all__ = ['MissingDataAssociationException',\n           'IncompatibleUncertaintiesException', 'NDUncertainty',\n           'StdDevUncertainty', 'UnknownUncertainty']\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 : `~astropy.units.Unit` or str, 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        Even though it is not enforced the unit should be convertible to the\n        ``parent_nddata`` unit. Otherwise uncertainty propagation might give\n        wrong results.\n\n        If the unit is not set the unit of the parent will be returned.\n        \"\"\"\n        if self._unit is None:\n            if (self._parent_nddata is None or\n                    self.parent_nddata.unit is None):\n                return None\n            else:\n                return self.parent_nddata.unit\n        return self._unit\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        message = \"uncertainty is not associated with an NDData object\"\n        try:\n            if self._parent_nddata is None:\n                raise MissingDataAssociationException(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.\n                if isinstance(self._parent_nddata, weakref.ref):\n                    return self._parent_nddata()\n                else:\n                    log.info(\"parent_nddata should be a weakref to an NDData \"\n                             \"object.\")\n                    return self._parent_nddata\n        except AttributeError:\n            raise MissingDataAssociationException(message)\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        self._parent_nddata = value\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 __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 `numpy.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(\"{0} 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 _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 StdDevUncertainty(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],\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\n        if self.array is None:\n            # Formula: sigma = dB\n\n            if other_uncert.unit is not None and (\n                        result_data.unit != 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                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(other_uncert.array)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA\n\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                # If the uncertainty has a different unit than the result we\n                # need to convert it to the results unit.\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                # Copy the result because _propagate will not copy it but for\n                # arithmetic operations users will expect copies.\n                return deepcopy(self.array)\n\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 + 2*cor*dA*dB)\n\n            # Calculate: dA (this) and dB (other)\n            if self.unit != other_uncert.unit:\n                # In case the two uncertainties (or data) have different units\n                # we need to use quantity operations. The case where only one\n                # has a unit and the other doesn't is not possible with\n                # addition and would have raised an exception in the data\n                # computation\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                # Since both units are the same or None we can just use\n                # numpy operations\n                this = self.array\n                other = other_uncert.array\n\n            # Determine the result depending on the correlation\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                result = np.sqrt(this**2 + other**2 + corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n\n            if isinstance(result, Quantity):\n                # In case we worked with quantities we need to return the\n                # uncertainty that has the same unit as the resulting data.\n                # Note that this call is fast if the units are the same.\n                return result.to_value(result_data.unit)\n            else:\n                return result\n\n    def _propagate_subtract(self, other_uncert, result_data, correlation):\n        # Since the formulas are equivalent to addition you should look at the\n        # explanations provided in _propagate_add\n\n        if self.array is None:\n            if other_uncert.unit is not None and (\n                        result_data.unit != other_uncert.unit):\n                return (other_uncert.array * other_uncert.unit).to(\n                            result_data.unit).value\n            else:\n                return deepcopy(other_uncert.array)\n        elif other_uncert.array is None:\n            if self.unit is not None and self.unit != self.parent_nddata.unit:\n                return self.unit.to(result_data.unit, self.array)\n            else:\n                return deepcopy(self.array)\n        else:\n            # Formula: sigma = sqrt(dA**2 + dB**2 - 2*cor*dA*dB)\n            if self.unit != other_uncert.unit:\n                this = self.array * self.unit\n                other = other_uncert.array * other_uncert.unit\n            else:\n                this = self.array\n                other = other_uncert.array\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * this * other\n                # The only difference to addition is that the correlation is\n                # subtracted.\n                result = np.sqrt(this**2 + other**2 - corr)\n            else:\n                result = np.sqrt(this**2 + other**2)\n            if isinstance(result, Quantity):\n                return result.to_value(result_data.unit)\n            else:\n                return result\n\n    def _propagate_multiply(self, other_uncert, result_data, correlation):\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 self.array is None:\n            # Formula: sigma = |A| * dB\n\n            # We want the result to have the same unit as the parent, so we\n            # only need to convert the unit of the other uncertainty if it is\n            # different from its data's unit.\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                other = (other_uncert.array * other_uncert.unit).to(\n                            other_uncert.parent_nddata.unit).value\n            else:\n                other = other_uncert.array\n            return np.abs(self.parent_nddata.data * other)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA * |B|\n\n            # Just the reversed case\n            if self.unit != self.parent_nddata.unit:\n                this = (self.array * self.unit).to(\n                                            self.parent_nddata.unit).value\n            else:\n                this = self.array\n            return np.abs(other_uncert.parent_nddata.data * this)\n\n        else:\n            # Formula: sigma = |AB|*sqrt((dA/A)**2+(dB/B)**2+2*dA/A*dB/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            # Formula: sigma = sqrt((dA*B)**2 + (dB*A)**2 + (2 * cor * ABdAdB))\n\n            # Calculate: dA * B (left)\n            if self.unit != self.parent_nddata.unit:\n                # To get the unit right we need to convert the unit of\n                # each uncertainty to the same unit as it's parent\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value *\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array * other_uncert.parent_nddata.data\n\n            # Calculate: dB * A (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                        other_uncert.parent_nddata.unit).value *\n                        self.parent_nddata.data)\n            else:\n                right = other_uncert.array * self.parent_nddata.data\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = (2 * correlation * left * right)\n                return np.sqrt(left**2 + right**2 + corr)\n            else:\n                return np.sqrt(left**2 + right**2)\n\n    def _propagate_divide(self, other_uncert, result_data, correlation):\n\n        # For division we don't need the result as quantity\n        if isinstance(result_data, Quantity):\n            result_data = result_data.value\n\n        if self.array is None:\n            # Formula: sigma = |(A / B) * (dB / B)|\n\n            # Calculate: dB / B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                # We need (dB / B) to be dimensionless so we convert\n                # (if necessary) dB to the same unit as B\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data)\n            else:\n                right = (other_uncert.array / other_uncert.parent_nddata.data)\n            return np.abs(result_data * right)\n\n        elif other_uncert.array is None:\n            # Formula: sigma = dA / |B|.\n\n            # Calculate: dA\n            if self.unit != self.parent_nddata.unit:\n                # We need to convert dA to the unit of A to have a result that\n                # matches the resulting data's unit.\n                left = (self.array * self.unit).to(\n                        self.parent_nddata.unit).value\n            else:\n                left = self.array\n\n            return np.abs(left / other_uncert.parent_nddata.data)\n\n        else:\n            # Formula: sigma = |A/B|*sqrt((dA/A)**2+(dB/B)**2-2*dA/A*dB/B*cor)\n\n            # As with multiplication this formula creates NaNs where A is zero.\n            # So I'll rewrite it again:\n            # => sigma = sqrt((dA/B)**2 + (AdB/B**2)**2 - 2*cor*AdAdB/B**3)\n\n            # So we need to calculate dA/B in the same units as the result\n            # and the dimensionless dB/B to get a resulting uncertainty with\n            # the same unit as the data.\n\n            # Calculate: dA/B (left)\n            if self.unit != self.parent_nddata.unit:\n                left = ((self.array * self.unit).to(\n                        self.parent_nddata.unit).value /\n                        other_uncert.parent_nddata.data)\n            else:\n                left = self.array / other_uncert.parent_nddata.data\n\n            # Calculate: dB/B (right)\n            if other_uncert.unit != other_uncert.parent_nddata.unit:\n                right = ((other_uncert.array * other_uncert.unit).to(\n                    other_uncert.parent_nddata.unit).value /\n                    other_uncert.parent_nddata.data) * result_data\n            else:\n                right = (result_data * other_uncert.array /\n                         other_uncert.parent_nddata.data)\n\n            if isinstance(correlation, np.ndarray) or correlation != 0:\n                corr = 2 * correlation * left * right\n                # This differs from multiplication because the correlation\n                # term needs to be subtracted\n                return np.sqrt(left**2 + right**2 - corr)\n            else:\n                return np.sqrt(left**2 + right**2)\n"},{"col":4,"comment":"null","endLoc":2829,"header":"def write_table(self, tabmodule, outputdir='', signature='')","id":9468,"name":"write_table","nodeType":"Function","startLoc":2716,"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_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":4,"comment":"null","endLoc":718,"header":"def raise_from(value, from_value)","id":9469,"name":"raise_from","nodeType":"Function","startLoc":717,"text":"def raise_from(value, from_value):\n        raise value"},{"col":4,"comment":"The new-style print function for Python 2.4 and 2.5.","endLoc":775,"header":"def print_(*args, **kwargs)","id":9470,"name":"print_","nodeType":"Function","startLoc":723,"text":"def print_(*args, **kwargs):\n        \"\"\"The new-style print function for Python 2.4 and 2.5.\"\"\"\n        fp = kwargs.pop(\"file\", sys.stdout)\n        if fp is None:\n            return\n\n        def write(data):\n            if not isinstance(data, basestring):\n                data = str(data)\n            # If the file has an encoding, encode unicode with it.\n            if (isinstance(fp, file) and\n                    isinstance(data, unicode) and\n                    fp.encoding is not None):\n                errors = getattr(fp, \"errors\", None)\n                if errors is None:\n                    errors = \"strict\"\n                data = data.encode(fp.encoding, errors)\n            fp.write(data)\n        want_unicode = False\n        sep = kwargs.pop(\"sep\", None)\n        if sep is not None:\n            if isinstance(sep, unicode):\n                want_unicode = True\n            elif not isinstance(sep, str):\n                raise TypeError(\"sep must be None or a string\")\n        end = kwargs.pop(\"end\", None)\n        if end is not None:\n            if isinstance(end, unicode):\n                want_unicode = True\n            elif not isinstance(end, str):\n                raise TypeError(\"end must be None or a string\")\n        if kwargs:\n            raise TypeError(\"invalid keyword arguments to print()\")\n        if not want_unicode:\n            for arg in args:\n                if isinstance(arg, unicode):\n                    want_unicode = True\n                    break\n        if want_unicode:\n            newline = unicode(\"\\n\")\n            space = unicode(\" \")\n        else:\n            newline = \"\\n\"\n            space = \" \"\n        if sep is None:\n            sep = space\n        if end is None:\n            end = newline\n        for i, arg in enumerate(args):\n            if i:\n                write(sep)\n            write(arg)\n        write(end)"},{"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":21,"id":9471,"nodeType":"Class","startLoc":18,"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    \"\"\""},{"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":27,"id":9472,"nodeType":"Class","startLoc":24,"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    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":9473,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"nduncertainty.py#<anonymous>","id":9474,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['MissingDataAssociationException',\n           'IncompatibleUncertaintiesException', 'NDUncertainty',\n           'StdDevUncertainty', 'UnknownUncertainty']"},{"fileName":"nddata_withmixins.py","filePath":"astropy/nddata","id":9475,"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":9476,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":9477,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"nddata_withmixins.py#<anonymous>","id":9478,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module implements a class based on NDData with all Mixins.\n\"\"\"\n\n__all__ = ['NDDataRef']"},{"id":9479,"name":"astropy/nddata/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/nddata/tests","id":9480,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":170,"header":"@property\n    def data(self)","id":9481,"name":"data","nodeType":"Function","startLoc":168,"text":"@property\n    def data(self):\n        return self._data"},{"col":4,"comment":"null","endLoc":174,"header":"@data.setter\n    def data(self, value)","id":9482,"name":"data","nodeType":"Function","startLoc":172,"text":"@data.setter\n    def data(self, value):\n        self._data = value"},{"col":4,"comment":"null","endLoc":178,"header":"@property\n    def wcs(self)","id":9483,"name":"wcs","nodeType":"Function","startLoc":176,"text":"@property\n    def wcs(self):\n        return self._wcs"},{"col":4,"comment":"null","endLoc":182,"header":"@wcs.setter\n    def wcs(self, value)","id":9484,"name":"wcs","nodeType":"Function","startLoc":180,"text":"@wcs.setter\n    def wcs(self, value):\n        self._wcs = value"},{"col":4,"comment":"null","endLoc":186,"header":"@property\n    def unit(self)","id":9485,"name":"unit","nodeType":"Function","startLoc":184,"text":"@property\n    def unit(self):\n        return self._unit"},{"col":4,"comment":"null","endLoc":190,"header":"@unit.setter\n    def unit(self, value)","id":9486,"name":"unit","nodeType":"Function","startLoc":188,"text":"@unit.setter\n    def unit(self, value):\n        self._unit = u.Unit(value)"},{"id":9487,"name":"astropy/nddata/mixins","nodeType":"Package"},{"fileName":"ndslicing.py","filePath":"astropy/nddata/mixins","id":9488,"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 ... import log\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        try:\n            return self.wcs[item]\n        except TypeError:\n            log.info(\"wcs cannot be sliced.\")\n        return self.wcs\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":9489,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"ndslicing.py#<anonymous>","id":9490,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDSlicingMixin']"},{"fileName":"ndarithmetic.py","filePath":"astropy/nddata/mixins","id":9491,"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 ..nduncertainty import NDUncertainty\nfrom ...units import dimensionless_unscaled\nfrom ...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 or convertible to one.\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 behaviour 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 behaviour.\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 : `~numpy.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('Unknown prefix {0} for parameter {1}'\n                               ''.format(splitted[0], 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 : `~numpy.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 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"},{"col":4,"comment":"null","endLoc":194,"header":"@property\n    def header(self)","id":9492,"name":"header","nodeType":"Function","startLoc":192,"text":"@property\n    def header(self):\n        return self._meta"},{"col":4,"comment":"null","endLoc":198,"header":"@header.setter\n    def header(self, value)","id":9493,"name":"header","nodeType":"Function","startLoc":196,"text":"@header.setter\n    def header(self, value):\n        self.meta = value"},{"col":4,"comment":"null","endLoc":202,"header":"@property\n    def uncertainty(self)","id":9494,"name":"uncertainty","nodeType":"Function","startLoc":200,"text":"@property\n    def uncertainty(self):\n        return self._uncertainty"},{"col":4,"comment":"null","endLoc":223,"header":"@uncertainty.setter\n    def uncertainty(self, value)","id":9495,"name":"uncertainty","nodeType":"Function","startLoc":204,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":9496,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9497,"name":"_arit_doc","nodeType":"Attribute","startLoc":18,"text":"_arit_doc"},{"col":0,"comment":"","endLoc":5,"header":"ndarithmetic.py#<anonymous>","id":9498,"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 or convertible to one.\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":9499,"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 ...io import registry as io_registry\n\n__all__ = ['NDIOMixin']\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\n    @classmethod\n    def read(cls, *args, **kwargs):\n        \"\"\"\n        Read and parse gridded N-dimensional data and return as an\n        NDData-derived object.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily reading a file in the supported data\n        formats.\n        \"\"\"\n        return io_registry.read(cls, *args, **kwargs)\n\n    def write(self, *args, **kwargs):\n        \"\"\"\n        Write a gridded N-dimensional data object out in specified format.\n\n        This function provides the NDDataBase interface to the astropy unified\n        I/O layer.  This allows easily writing a file in the supported data\n        formats.\n        \"\"\"\n        io_registry.write(self, *args, **kwargs)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":9500,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"ndio.py#<anonymous>","id":9501,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['NDIOMixin']"},{"fileName":"__init__.py","filePath":"astropy/nddata/mixins","id":9502,"nodeType":"File","text":""},{"id":9503,"name":"astropy/nddata/mixins/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/nddata/mixins/tests","id":9504,"nodeType":"File","text":""},{"id":9506,"name":"astropy/modeling","nodeType":"Package"},{"fileName":"separable.py","filePath":"astropy/modeling","id":9507,"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, _CompoundModel, ModelDefinitionError\nfrom .mappings import Mapping\n\n\n__all__ = [\"is_separable\"]\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 _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\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={0}, \"\n            \"n_outputs={1}) and right (n_inputs={2}, n_outputs={3}); \"\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 {0}, right coord_matrix is {1}'.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    -------\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 isinstance(transform, _CompoundModel):\n        is_separable = transform._tree.evaluate(_operators)\n    elif isinstance(transform, Model):\n        is_separable = _coord_matrix(transform, 'left', transform.n_outputs)\n    return is_separable\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"},{"col":4,"comment":"null","endLoc":784,"header":"def print_(*args, **kwargs)","id":9508,"name":"print_","nodeType":"Function","startLoc":779,"text":"def print_(*args, **kwargs):\n        fp = kwargs.get(\"file\", sys.stdout)\n        flush = kwargs.pop(\"flush\", False)\n        _print(*args, **kwargs)\n        if flush and fp is not None:\n            fp.flush()"},{"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        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        Returns\n        -------\n        hdulist : `~astropy.io.fits.HDUList`\n        ","endLoc":332,"header":"def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True)","id":9509,"name":"to_hdu","nodeType":"Function","startLoc":225,"text":"def to_hdu(self, hdu_mask='MASK', hdu_uncertainty='UNCERT',\n               hdu_flags=None, wcs_relax=True):\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        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        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            if self.uncertainty.__class__.__name__ != 'StdDevUncertainty':\n                raise ValueError('only StdDevUncertainty can be saved.')\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 and\n                    self.uncertainty.unit != self.unit):\n                raise ValueError('saving uncertainties with a unit differing'\n                                 'from the data unit is not supported.')\n\n            hduUncert = fits.ImageHDU(self.uncertainty.array,\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"},{"className":"_CompoundModel","col":0,"comment":"null","endLoc":2869,"id":9510,"nodeType":"Class","startLoc":2750,"text":"class _CompoundModel(Model, metaclass=_CompoundModelMeta):\n    fit_deriv = None\n    col_fit_deriv = False\n\n    _submodels = None\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 __getattr__(self, attr):\n        # This __getattr__ is necessary, because _CompoundModelMeta creates\n        # Parameter descriptors *lazily*--they do not exist in the class\n        # __dict__ until one of them has been accessed.\n        # However, this is at odds with how Python looks up descriptors (see\n        # (https://docs.python.org/3/reference/datamodel.html#invoking-descriptors)\n        # which is to look directly in the class __dict__\n        # This workaround allows descriptors to work correctly when they are\n        # not initially found in the class __dict__\n        value = getattr(self.__class__, attr)\n        if hasattr(value, '__get__'):\n            # Object is a descriptor, so we should really return the result of\n            # its __get__\n            value = value.__get__(self, self.__class__)\n        return value\n\n    def __getitem__(self, index):\n        index = self.__class__._normalize_index(index)\n        model = self.__class__[index]\n\n        if isinstance(index, slice):\n            param_names = model.param_names\n        else:\n            param_map = self.__class__._param_map_inverse\n            param_names = tuple(param_map[index, name]\n                                for name in model.param_names)\n\n        return model._from_existing(self, param_names)\n\n    @property\n    def submodel_names(self):\n        return self.__class__.submodel_names\n\n    @sharedmethod\n    def n_submodels(self):\n        return len(self.submodel_names)\n\n    @property\n    def param_names(self):\n        return self.__class__.param_names\n\n    @property\n    def fittable(self):\n        return self.__class__.fittable\n\n    @sharedmethod\n    def evaluate(self, *args):\n        return self.__class__.evaluate(*args)\n\n    # TODO: The way this works is highly inefficient--the inverse is created by\n    # making a new model for each operator in the compound model, which could\n    # potentially mean creating a large number of temporary throwaway model\n    # classes.  This can definitely be optimized in the future by implementing\n    # a way to construct a single model class from an existing tree\n    @property\n    def inverse(self):\n        def _not_implemented(oper):\n            def _raise(x, y):\n                raise NotImplementedError(\n                    \"The inverse is not currently defined for compound \"\n                    \"models created using the {0} operator.\".format(oper))\n            return _raise\n\n        operators = dict((oper, _not_implemented(oper))\n                         for oper in ('+', '-', '*', '/', '**'))\n        operators['&'] = operator.and_\n        # Reverse the order of compositions\n        operators['|'] = lambda x, y: operator.or_(y, x)\n\n        leaf_idx = -1\n\n        def getter(idx, model):\n            try:\n                # By indexing on self[] this will return an instance of the\n                # model, with all the appropriate parameters set, which is\n                # currently required to return an inverse\n                return self[idx].inverse\n            except NotImplementedError:\n                raise NotImplementedError(\n                    \"All models in a composite model must have an inverse \"\n                    \"defined in order for the composite model to have an \"\n                    \"inverse.  {0!r} does not have an inverse.\".format(model))\n\n        return self._tree.evaluate(operators, getter=getter)\n\n    @sharedmethod\n    def _get_submodels(self):\n        return self.__class__._get_submodels()\n\n    def _parameter_units_for_data_units(self, input_units, output_units):\n        units_for_data = {}\n        for imodel, model in enumerate(self._submodels):\n            units_for_data_sub = model._parameter_units_for_data_units(input_units, output_units)\n            for param_sub in units_for_data_sub:\n                param = self._param_map_inverse[(imodel, param_sub)]\n                units_for_data[param] = units_for_data_sub[param_sub]\n        return units_for_data\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of a compound model.\n        \"\"\"\n        new_model = self.copy()\n        new_model._submodels = [model.deepcopy() for model in self._submodels]\n        return new_model"},{"col":4,"comment":"null","endLoc":2763,"header":"def __str__(self)","id":9511,"name":"__str__","nodeType":"Function","startLoc":2756,"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)"},{"col":4,"comment":"null","endLoc":2779,"header":"def __getattr__(self, attr)","id":9513,"name":"__getattr__","nodeType":"Function","startLoc":2765,"text":"def __getattr__(self, attr):\n        # This __getattr__ is necessary, because _CompoundModelMeta creates\n        # Parameter descriptors *lazily*--they do not exist in the class\n        # __dict__ until one of them has been accessed.\n        # However, this is at odds with how Python looks up descriptors (see\n        # (https://docs.python.org/3/reference/datamodel.html#invoking-descriptors)\n        # which is to look directly in the class __dict__\n        # This workaround allows descriptors to work correctly when they are\n        # not initially found in the class __dict__\n        value = getattr(self.__class__, attr)\n        if hasattr(value, '__get__'):\n            # Object is a descriptor, so we should really return the result of\n            # its __get__\n            value = value.__get__(self, self.__class__)\n        return value"},{"col":4,"comment":"null","endLoc":795,"header":"def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n              updated=functools.WRAPPER_UPDATES)","id":9514,"name":"wraps","nodeType":"Function","startLoc":789,"text":"def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n              updated=functools.WRAPPER_UPDATES):\n        def wrapper(f):\n            f = functools.wraps(wrapped, assigned, updated)(f)\n            f.__wrapped__ = wrapped\n            return f\n        return wrapper"},{"col":4,"comment":"null","endLoc":2792,"header":"def __getitem__(self, index)","id":9515,"name":"__getitem__","nodeType":"Function","startLoc":2781,"text":"def __getitem__(self, index):\n        index = self.__class__._normalize_index(index)\n        model = self.__class__[index]\n\n        if isinstance(index, slice):\n            param_names = model.param_names\n        else:\n            param_map = self.__class__._param_map_inverse\n            param_names = tuple(param_map[index, name]\n                                for name in model.param_names)\n\n        return model._from_existing(self, param_names)"},{"col":4,"comment":"Clear ConfigObj instance and restore to 'freshly created' state.","endLoc":2340,"header":"def reset(self)","id":9516,"name":"reset","nodeType":"Function","startLoc":2332,"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":0,"comment":"Create a base class with a metaclass.","endLoc":809,"header":"def with_metaclass(meta, *bases)","id":9517,"name":"with_metaclass","nodeType":"Function","startLoc":800,"text":"def with_metaclass(meta, *bases):\n    \"\"\"Create a base class with a metaclass.\"\"\"\n    # This requires a bit of explanation: the basic idea is to make a dummy\n    # metaclass for one level of class instantiation that replaces itself with\n    # the actual metaclass.\n    class metaclass(meta):\n\n        def __new__(cls, name, this_bases, d):\n            return meta(name, bases, d)\n    return type.__new__(metaclass, 'temporary_class', (), {})"},{"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 : integer 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`\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":84,"header":"def match_coordinates_3d(matchcoord, catalogcoord, nthneighbor=1, storekdtree='kdtree_3d')","id":9518,"name":"match_coordinates_3d","nodeType":"Function","startLoc":17,"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 : integer 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`\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    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    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"},{"col":4,"comment":"null","endLoc":2796,"header":"@property\n    def submodel_names(self)","id":9519,"name":"submodel_names","nodeType":"Function","startLoc":2794,"text":"@property\n    def submodel_names(self):\n        return self.__class__.submodel_names"},{"col":4,"comment":"null","endLoc":2800,"header":"@sharedmethod\n    def n_submodels(self)","id":9520,"name":"n_submodels","nodeType":"Function","startLoc":2798,"text":"@sharedmethod\n    def n_submodels(self):\n        return len(self.submodel_names)"},{"col":4,"comment":"null","endLoc":2804,"header":"@property\n    def param_names(self)","id":9521,"name":"param_names","nodeType":"Function","startLoc":2802,"text":"@property\n    def param_names(self):\n        return self.__class__.param_names"},{"col":4,"comment":"null","endLoc":2808,"header":"@property\n    def fittable(self)","id":9522,"name":"fittable","nodeType":"Function","startLoc":2806,"text":"@property\n    def fittable(self):\n        return self.__class__.fittable"},{"col":4,"comment":"null","endLoc":2812,"header":"@sharedmethod\n    def evaluate(self, *args)","id":9523,"name":"evaluate","nodeType":"Function","startLoc":2810,"text":"@sharedmethod\n    def evaluate(self, *args):\n        return self.__class__.evaluate(*args)"},{"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":466,"header":"def _get_cartesian_kdtree(coord, attrname_or_kdt='kdtree', forceunit=None)","id":9524,"name":"_get_cartesian_kdtree","nodeType":"Function","startLoc":401,"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('The `attrname_or_kdt` \"{0}\" is not a scipy KD tree!'.format(attrname_or_kdt))\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        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"},{"col":0,"comment":"Class decorator for creating a class with a metaclass.","endLoc":825,"header":"def add_metaclass(metaclass)","id":9525,"name":"add_metaclass","nodeType":"Function","startLoc":812,"text":"def add_metaclass(metaclass):\n    \"\"\"Class decorator for creating a class with a metaclass.\"\"\"\n    def wrapper(cls):\n        orig_vars = cls.__dict__.copy()\n        slots = orig_vars.get('__slots__')\n        if slots is not None:\n            if isinstance(slots, str):\n                slots = [slots]\n            for slots_var in slots:\n                orig_vars.pop(slots_var)\n        orig_vars.pop('__dict__', None)\n        orig_vars.pop('__weakref__', None)\n        return metaclass(cls.__name__, cls.__bases__, orig_vars)\n    return wrapper"},{"col":4,"comment":"null","endLoc":2848,"header":"@property\n    def inverse(self)","id":9526,"name":"inverse","nodeType":"Function","startLoc":2819,"text":"@property\n    def inverse(self):\n        def _not_implemented(oper):\n            def _raise(x, y):\n                raise NotImplementedError(\n                    \"The inverse is not currently defined for compound \"\n                    \"models created using the {0} operator.\".format(oper))\n            return _raise\n\n        operators = dict((oper, _not_implemented(oper))\n                         for oper in ('+', '-', '*', '/', '**'))\n        operators['&'] = operator.and_\n        # Reverse the order of compositions\n        operators['|'] = lambda x, y: operator.or_(y, x)\n\n        leaf_idx = -1\n\n        def getter(idx, model):\n            try:\n                # By indexing on self[] this will return an instance of the\n                # model, with all the appropriate parameters set, which is\n                # currently required to return an inverse\n                return self[idx].inverse\n            except NotImplementedError:\n                raise NotImplementedError(\n                    \"All models in a composite model must have an inverse \"\n                    \"defined in order for the composite model to have an \"\n                    \"inverse.  {0!r} does not have an inverse.\".format(model))\n\n        return self._tree.evaluate(operators, getter=getter)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1073,"id":9527,"name":"_keyword","nodeType":"Attribute","startLoc":1073,"text":"_keyword"},{"attributeType":"null","col":4,"comment":"null","endLoc":1086,"id":9529,"name":"_sectionmarker","nodeType":"Attribute","startLoc":1086,"text":"_sectionmarker"},{"col":25,"endLoc":2832,"id":9530,"nodeType":"Lambda","startLoc":2832,"text":"lambda x, y: operator.or_(y, x)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1103,"id":9531,"name":"_valueexp","nodeType":"Attribute","startLoc":1103,"text":"_valueexp"},{"attributeType":"null","col":4,"comment":"null","endLoc":1130,"id":9532,"name":"_listvalueexp","nodeType":"Attribute","startLoc":1130,"text":"_listvalueexp"},{"attributeType":"null","col":4,"comment":"null","endLoc":1142,"id":9533,"name":"_nolistvalue","nodeType":"Attribute","startLoc":1142,"text":"_nolistvalue"},{"attributeType":"null","col":4,"comment":"null","endLoc":1154,"id":9534,"name":"_single_line_single","nodeType":"Attribute","startLoc":1154,"text":"_single_line_single"},{"col":4,"comment":"null","endLoc":2852,"header":"@sharedmethod\n    def _get_submodels(self)","id":9535,"name":"_get_submodels","nodeType":"Function","startLoc":2850,"text":"@sharedmethod\n    def _get_submodels(self):\n        return self.__class__._get_submodels()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1155,"id":9536,"name":"_single_line_double","nodeType":"Attribute","startLoc":1155,"text":"_single_line_double"},{"attributeType":"null","col":4,"comment":"null","endLoc":1156,"id":9537,"name":"_multi_line_single","nodeType":"Attribute","startLoc":1156,"text":"_multi_line_single"},{"col":4,"comment":"null","endLoc":2861,"header":"def _parameter_units_for_data_units(self, input_units, output_units)","id":9538,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2854,"text":"def _parameter_units_for_data_units(self, input_units, output_units):\n        units_for_data = {}\n        for imodel, model in enumerate(self._submodels):\n            units_for_data_sub = model._parameter_units_for_data_units(input_units, output_units)\n            for param_sub in units_for_data_sub:\n                param = self._param_map_inverse[(imodel, param_sub)]\n                units_for_data[param] = units_for_data_sub[param_sub]\n        return units_for_data"},{"attributeType":"null","col":4,"comment":"null","endLoc":1157,"id":9539,"name":"_multi_line_double","nodeType":"Attribute","startLoc":1157,"text":"_multi_line_double"},{"col":4,"comment":"\n        Return a deep copy of a compound model.\n        ","endLoc":2869,"header":"def deepcopy(self)","id":9540,"name":"deepcopy","nodeType":"Function","startLoc":2863,"text":"def deepcopy(self):\n        \"\"\"\n        Return a deep copy of a compound model.\n        \"\"\"\n        new_model = self.copy()\n        new_model._submodels = [model.deepcopy() for model in self._submodels]\n        return new_model"},{"attributeType":"null","col":4,"comment":"null","endLoc":1159,"id":9541,"name":"_triple_quote","nodeType":"Attribute","startLoc":1159,"text":"_triple_quote"},{"col":0,"comment":"\n    A decorator that defines __unicode__ and __str__ methods under Python 2.\n    Under Python 3 it does nothing.\n\n    To support Python 2 and 3 with a single code base, define a __str__ method\n    returning text and apply this decorator to the class.\n    ","endLoc":843,"header":"def python_2_unicode_compatible(klass)","id":9542,"name":"python_2_unicode_compatible","nodeType":"Function","startLoc":828,"text":"def python_2_unicode_compatible(klass):\n    \"\"\"\n    A decorator that defines __unicode__ and __str__ methods under Python 2.\n    Under Python 3 it does nothing.\n\n    To support Python 2 and 3 with a single code base, define a __str__ method\n    returning text and apply this decorator to the class.\n    \"\"\"\n    if PY2:\n        if '__str__' not in klass.__dict__:\n            raise ValueError(\"@python_2_unicode_compatible cannot be applied \"\n                             \"to %s because it doesn't define __str__().\" %\n                             klass.__name__)\n        klass.__unicode__ = klass.__str__\n        klass.__str__ = lambda self: self.__unicode__().encode('utf-8')\n    return klass"},{"attributeType":"null","col":4,"comment":"null","endLoc":1165,"id":9543,"name":"_bools","nodeType":"Attribute","startLoc":1165,"text":"_bools"},{"attributeType":"null","col":8,"comment":"null","endLoc":1343,"id":9544,"name":"BOM","nodeType":"Attribute","startLoc":1343,"text":"self.BOM"},{"col":24,"endLoc":842,"id":9545,"nodeType":"Lambda","startLoc":842,"text":"lambda self: self.__unicode__().encode('utf-8')"},{"attributeType":"VdtMissingValue","col":16,"comment":"null","endLoc":2168,"id":9546,"name":"_vdtMissingValue","nodeType":"Attribute","startLoc":2168,"text":"self._vdtMissingValue"},{"attributeType":"null","col":4,"comment":"null","endLoc":2751,"id":9547,"name":"fit_deriv","nodeType":"Attribute","startLoc":2751,"text":"fit_deriv"},{"attributeType":"null","col":4,"comment":"null","endLoc":2752,"id":9548,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":2752,"text":"col_fit_deriv"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":9549,"name":"__author__","nodeType":"Attribute","startLoc":31,"text":"__author__"},{"attributeType":"null","col":4,"comment":"null","endLoc":2754,"id":9550,"name":"_submodels","nodeType":"Attribute","startLoc":2754,"text":"_submodels"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":9551,"name":"__version__","nodeType":"Attribute","startLoc":32,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":36,"id":9552,"name":"PY2","nodeType":"Attribute","startLoc":36,"text":"PY2"},{"className":"ModelDefinitionError","col":0,"comment":"Used for incorrect models definitions","endLoc":56,"id":9553,"nodeType":"Class","startLoc":55,"text":"class ModelDefinitionError(TypeError):\n    \"\"\"Used for incorrect models definitions\"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":9554,"name":"PY3","nodeType":"Attribute","startLoc":37,"text":"PY3"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":9555,"name":"PY34","nodeType":"Attribute","startLoc":38,"text":"PY34"},{"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":9556,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1334,"id":9557,"name":"raise_errors","nodeType":"Attribute","startLoc":1334,"text":"self.raise_errors"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":9558,"name":"string_types","nodeType":"Attribute","startLoc":41,"text":"string_types"},{"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":375,"header":"def _insert_in_metadata_fits_safe(self, key, value)","id":9559,"name":"_insert_in_metadata_fits_safe","nodeType":"Function","startLoc":345,"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['HIERARCH {0}'.format(key.upper())] = (\n                short_name, \"Shortened name for {}\".format(key))\n            self.meta[short_name] = value\n        else:\n            self.meta[key] = value"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":9560,"name":"integer_types","nodeType":"Attribute","startLoc":42,"text":"integer_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":9561,"name":"class_types","nodeType":"Attribute","startLoc":43,"text":"class_types"},{"attributeType":"None","col":16,"comment":"null","endLoc":1273,"id":9562,"name":"configspec","nodeType":"Attribute","startLoc":1273,"text":"self.configspec"},{"attributeType":"null","col":8,"comment":"null","endLoc":1337,"id":9563,"name":"create_empty","nodeType":"Attribute","startLoc":1337,"text":"self.create_empty"},{"attributeType":"null","col":4,"comment":"null","endLoc":44,"id":9564,"name":"text_type","nodeType":"Attribute","startLoc":44,"text":"text_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":45,"id":9565,"name":"binary_type","nodeType":"Attribute","startLoc":45,"text":"binary_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":47,"id":9566,"name":"MAXSIZE","nodeType":"Attribute","startLoc":47,"text":"MAXSIZE"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":9567,"name":"string_types","nodeType":"Attribute","startLoc":49,"text":"string_types"},{"attributeType":"null","col":8,"comment":"null","endLoc":1346,"id":9568,"name":"unrepr","nodeType":"Attribute","startLoc":1346,"text":"self.unrepr"},{"attributeType":"null","col":8,"comment":"null","endLoc":1345,"id":9569,"name":"write_empty_values","nodeType":"Attribute","startLoc":1345,"text":"self.write_empty_values"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":9570,"name":"integer_types","nodeType":"Attribute","startLoc":50,"text":"integer_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":51,"id":9571,"name":"class_types","nodeType":"Attribute","startLoc":51,"text":"class_types"},{"attributeType":"null","col":8,"comment":"null","endLoc":1349,"id":9572,"name":"final_comment","nodeType":"Attribute","startLoc":1349,"text":"self.final_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":9573,"name":"text_type","nodeType":"Attribute","startLoc":52,"text":"text_type"},{"attributeType":"null","col":4,"comment":"null","endLoc":53,"id":9574,"name":"binary_type","nodeType":"Attribute","startLoc":53,"text":"binary_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":57,"id":9575,"name":"MAXSIZE","nodeType":"Attribute","startLoc":57,"text":"MAXSIZE"},{"attributeType":"null","col":8,"comment":"null","endLoc":1227,"id":9576,"name":"_original_configspec","nodeType":"Attribute","startLoc":1227,"text":"self._original_configspec"},{"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    -------\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":271,"header":"def _separable(transform)","id":9577,"name":"_separable","nodeType":"Function","startLoc":252,"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    -------\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 isinstance(transform, _CompoundModel):\n        is_separable = transform._tree.evaluate(_operators)\n    elif isinstance(transform, Model):\n        is_separable = _coord_matrix(transform, 'left', transform.n_outputs)\n    return is_separable"},{"attributeType":"null","col":12,"comment":"null","endLoc":68,"id":9578,"name":"MAXSIZE","nodeType":"Attribute","startLoc":68,"text":"MAXSIZE"},{"attributeType":"null","col":12,"comment":"null","endLoc":71,"id":9579,"name":"MAXSIZE","nodeType":"Attribute","startLoc":71,"text":"MAXSIZE"},{"attributeType":"_SixMetaPathImporter","col":0,"comment":"null","endLoc":226,"id":9580,"name":"_importer","nodeType":"Attribute","startLoc":226,"text":"_importer"},{"attributeType":"null","col":0,"comment":"null","endLoc":235,"id":9581,"name":"_moved_attributes","nodeType":"Attribute","startLoc":235,"text":"_moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":308,"id":9582,"name":"attr","nodeType":"Attribute","startLoc":308,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":314,"id":9583,"name":"_moved_attributes","nodeType":"Attribute","startLoc":314,"text":"_MovedItems._moved_attributes"},{"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":178,"header":"def _coord_matrix(model, pos, noutp)","id":9584,"name":"_coord_matrix","nodeType":"Function","startLoc":133,"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"},{"attributeType":"_MovedItems","col":0,"comment":"null","endLoc":316,"id":9585,"name":"moves","nodeType":"Attribute","startLoc":316,"text":"moves"},{"attributeType":"null","col":0,"comment":"null","endLoc":325,"id":9586,"name":"_urllib_parse_moved_attributes","nodeType":"Attribute","startLoc":325,"text":"_urllib_parse_moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":350,"id":9587,"name":"attr","nodeType":"Attribute","startLoc":350,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":354,"id":9588,"name":"_moved_attributes","nodeType":"Attribute","startLoc":354,"text":"Module_six_moves_urllib_parse._moved_attributes"},{"attributeType":"null","col":0,"comment":"null","endLoc":365,"id":9589,"name":"_urllib_error_moved_attributes","nodeType":"Attribute","startLoc":365,"text":"_urllib_error_moved_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":1341,"id":9590,"name":"encoding","nodeType":"Attribute","startLoc":1341,"text":"self.encoding"},{"attributeType":"null","col":8,"comment":"null","endLoc":1333,"id":9591,"name":"_errors","nodeType":"Attribute","startLoc":1333,"text":"self._errors"},{"attributeType":"null","col":4,"comment":"null","endLoc":370,"id":9592,"name":"attr","nodeType":"Attribute","startLoc":370,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":374,"id":9593,"name":"_moved_attributes","nodeType":"Attribute","startLoc":374,"text":"Module_six_moves_urllib_error._moved_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":1338,"id":9594,"name":"file_error","nodeType":"Attribute","startLoc":1338,"text":"self.file_error"},{"attributeType":"null","col":0,"comment":"null","endLoc":385,"id":9595,"name":"_urllib_request_moved_attributes","nodeType":"Attribute","startLoc":385,"text":"_urllib_request_moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":420,"id":9596,"name":"attr","nodeType":"Attribute","startLoc":420,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":424,"id":9597,"name":"_moved_attributes","nodeType":"Attribute","startLoc":424,"text":"Module_six_moves_urllib_request._moved_attributes"},{"attributeType":"null","col":8,"comment":"null","endLoc":1335,"id":9598,"name":"interpolation","nodeType":"Attribute","startLoc":1335,"text":"self.interpolation"},{"attributeType":"null","col":0,"comment":"null","endLoc":435,"id":9599,"name":"_urllib_response_moved_attributes","nodeType":"Attribute","startLoc":435,"text":"_urllib_response_moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":441,"id":9600,"name":"attr","nodeType":"Attribute","startLoc":441,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":445,"id":9601,"name":"_moved_attributes","nodeType":"Attribute","startLoc":445,"text":"Module_six_moves_urllib_response._moved_attributes"},{"attributeType":"null","col":12,"comment":"null","endLoc":1233,"id":9602,"name":"filename","nodeType":"Attribute","startLoc":1233,"text":"self.filename"},{"attributeType":"null","col":0,"comment":"null","endLoc":456,"id":9603,"name":"_urllib_robotparser_moved_attributes","nodeType":"Attribute","startLoc":456,"text":"_urllib_robotparser_moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":459,"id":9604,"name":"attr","nodeType":"Attribute","startLoc":459,"text":"attr"},{"attributeType":"null","col":0,"comment":"null","endLoc":463,"id":9605,"name":"_moved_attributes","nodeType":"Attribute","startLoc":463,"text":"Module_six_moves_urllib_robotparser._moved_attributes"},{"attributeType":"null","col":4,"comment":"null","endLoc":503,"id":9606,"name":"_meth_func","nodeType":"Attribute","startLoc":503,"text":"_meth_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":1340,"id":9607,"name":"indent_type","nodeType":"Attribute","startLoc":1340,"text":"self.indent_type"},{"attributeType":"null","col":24,"comment":"null","endLoc":1296,"id":9608,"name":"newlines","nodeType":"Attribute","startLoc":1296,"text":"self.newlines"},{"attributeType":"null","col":4,"comment":"null","endLoc":504,"id":9609,"name":"_meth_self","nodeType":"Attribute","startLoc":504,"text":"_meth_self"},{"attributeType":"null","col":4,"comment":"null","endLoc":506,"id":9610,"name":"_func_closure","nodeType":"Attribute","startLoc":506,"text":"_func_closure"},{"attributeType":"null","col":8,"comment":"null","endLoc":1336,"id":9611,"name":"list_values","nodeType":"Attribute","startLoc":1336,"text":"self.list_values"},{"attributeType":"null","col":4,"comment":"null","endLoc":507,"id":9612,"name":"_func_code","nodeType":"Attribute","startLoc":507,"text":"_func_code"},{"attributeType":"null","col":4,"comment":"null","endLoc":508,"id":9613,"name":"_func_defaults","nodeType":"Attribute","startLoc":508,"text":"_func_defaults"},{"attributeType":"null","col":8,"comment":"null","endLoc":1342,"id":9614,"name":"default_encoding","nodeType":"Attribute","startLoc":1342,"text":"self.default_encoding"},{"attributeType":"null","col":8,"comment":"null","endLoc":1348,"id":9615,"name":"initial_comment","nodeType":"Attribute","startLoc":1348,"text":"self.initial_comment"},{"attributeType":"null","col":4,"comment":"null","endLoc":509,"id":9616,"name":"_func_globals","nodeType":"Attribute","startLoc":509,"text":"_func_globals"},{"attributeType":"null","col":8,"comment":"null","endLoc":1339,"id":9617,"name":"stringify","nodeType":"Attribute","startLoc":1339,"text":"self.stringify"},{"attributeType":"null","col":8,"comment":"null","endLoc":1187,"id":9618,"name":"_inspec","nodeType":"Attribute","startLoc":1187,"text":"self._inspec"},{"attributeType":"null","col":4,"comment":"null","endLoc":511,"id":9619,"name":"_meth_func","nodeType":"Attribute","startLoc":511,"text":"_meth_func"},{"attributeType":"null","col":4,"comment":"null","endLoc":512,"id":9620,"name":"_meth_self","nodeType":"Attribute","startLoc":512,"text":"_meth_self"},{"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":2388,"id":9621,"nodeType":"Class","startLoc":2369,"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":2382,"header":"def __init__(self)","id":9622,"name":"__init__","nodeType":"Function","startLoc":2381,"text":"def __init__(self):\n        self.baseErrorClass = ConfigObjError"},{"col":4,"comment":"A dummy check method, always returns the value unchanged.","endLoc":2388,"header":"def check(self, check, member, missing=False)","id":9623,"name":"check","nodeType":"Function","startLoc":2384,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":514,"id":9624,"name":"_func_closure","nodeType":"Attribute","startLoc":514,"text":"_func_closure"},{"attributeType":"null","col":4,"comment":"null","endLoc":515,"id":9625,"name":"_func_code","nodeType":"Attribute","startLoc":515,"text":"_func_code"},{"attributeType":"null","col":4,"comment":"null","endLoc":516,"id":9626,"name":"_func_defaults","nodeType":"Attribute","startLoc":516,"text":"_func_defaults"},{"attributeType":"null","col":4,"comment":"null","endLoc":517,"id":9627,"name":"_func_globals","nodeType":"Attribute","startLoc":517,"text":"_func_globals"},{"attributeType":"ConfigObjError","col":8,"comment":"null","endLoc":2382,"id":9628,"name":"baseErrorClass","nodeType":"Attribute","startLoc":2382,"text":"self.baseErrorClass"},{"col":0,"comment":"null","endLoc":133,"header":"def getObj(s)","id":9629,"name":"getObj","nodeType":"Function","startLoc":127,"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]"},{"attributeType":"null","col":4,"comment":"null","endLoc":521,"id":9630,"name":"advance_iterator","nodeType":"Attribute","startLoc":521,"text":"advance_iterator"},{"col":0,"comment":"null","endLoc":455,"header":"def __newobj__(cls, *args)","id":9631,"name":"__newobj__","nodeType":"Function","startLoc":453,"text":"def __newobj__(cls, *args):\n    # Hack for pickle\n    return cls.__new__(cls, *args)"},{"attributeType":"function","col":0,"comment":"null","endLoc":525,"id":9632,"name":"next","nodeType":"Attribute","startLoc":525,"text":"next"},{"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":2448,"header":"def flatten_errors(cfg, res, levels=None, results=None)","id":9633,"name":"flatten_errors","nodeType":"Function","startLoc":2391,"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), collections.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":"\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":88,"header":"def _compute_n_outputs(left, right)","id":9634,"name":"_compute_n_outputs","nodeType":"Function","startLoc":66,"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":130,"header":"def _arith_oper(left, right)","id":9635,"name":"_arith_oper","nodeType":"Function","startLoc":91,"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\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={0}, \"\n            \"n_outputs={1}) and right (n_inputs={2}, n_outputs={3}); \"\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":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:`/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 : integer 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`\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":979,"header":"def match_to_catalog_3d(self, catalogcoord, nthneighbor=1)","id":9636,"name":"match_to_catalog_3d","nodeType":"Function","startLoc":915,"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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self_in_catalog_frame, catalogcoord,\n                                   nthneighbor=nthneighbor,\n                                   storekdtree='_kdtree_3d')\n\n        return res"},{"attributeType":"null","col":4,"comment":"null","endLoc":529,"id":9637,"name":"callable","nodeType":"Attribute","startLoc":529,"text":"callable"},{"attributeType":"null","col":4,"comment":"null","endLoc":539,"id":9638,"name":"create_bound_method","nodeType":"Attribute","startLoc":539,"text":"create_bound_method"},{"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:`/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        seplimit : `~astropy.units.Quantity` with angle units\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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":1037,"header":"def search_around_sky(self, searcharoundcoords, seplimit)","id":9639,"name":"search_around_sky","nodeType":"Function","startLoc":981,"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:`/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        seplimit : `~astropy.units.Quantity` with angle units\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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')"},{"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 : `~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    seplimit : `~astropy.units.Quantity` with angle units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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":398,"header":"def search_around_sky(coords1, coords2, seplimit, storekdtree='kdtree_sky')","id":9640,"name":"search_around_sky","nodeType":"Function","startLoc":274,"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 : `~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    seplimit : `~astropy.units.Quantity` with angle units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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"},{"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":2474,"header":"def get_extra_values(conf, _prepend=())","id":9641,"name":"get_extra_values","nodeType":"Function","startLoc":2451,"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":"None","col":0,"comment":"null","endLoc":25,"id":9642,"name":"compiler","nodeType":"Attribute","startLoc":25,"text":"compiler"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":9643,"name":"BOMS","nodeType":"Attribute","startLoc":30,"text":"BOMS"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":9644,"name":"BOM_LIST","nodeType":"Attribute","startLoc":39,"text":"BOM_LIST"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":9645,"name":"BOM_SET","nodeType":"Attribute","startLoc":58,"text":"BOM_SET"},{"attributeType":"null","col":0,"comment":"null","endLoc":72,"id":9646,"name":"squot","nodeType":"Attribute","startLoc":72,"text":"squot"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":9647,"name":"dquot","nodeType":"Attribute","startLoc":73,"text":"dquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":9648,"name":"noquot","nodeType":"Attribute","startLoc":74,"text":"noquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":9649,"name":"wspace_plus","nodeType":"Attribute","startLoc":75,"text":"wspace_plus"},{"attributeType":"null","col":0,"comment":"null","endLoc":76,"id":9650,"name":"tsquot","nodeType":"Attribute","startLoc":76,"text":"tsquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":9651,"name":"tdquot","nodeType":"Attribute","startLoc":77,"text":"tdquot"},{"attributeType":"null","col":0,"comment":"null","endLoc":80,"id":9652,"name":"MISSING","nodeType":"Attribute","startLoc":80,"text":"MISSING"},{"attributeType":"null","col":4,"comment":"null","endLoc":544,"id":9653,"name":"Iterator","nodeType":"Attribute","startLoc":544,"text":"Iterator"},{"attributeType":"function","col":4,"comment":"null","endLoc":560,"id":9654,"name":"callable","nodeType":"Attribute","startLoc":560,"text":"callable"},{"attributeType":"null","col":0,"comment":"null","endLoc":82,"id":9655,"name":"__all__","nodeType":"Attribute","startLoc":82,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":9656,"name":"DEFAULT_INTERPOLATION","nodeType":"Attribute","startLoc":103,"text":"DEFAULT_INTERPOLATION"},{"attributeType":"null","col":0,"comment":"null","endLoc":104,"id":9657,"name":"DEFAULT_INDENT_TYPE","nodeType":"Attribute","startLoc":104,"text":"DEFAULT_INDENT_TYPE"},{"attributeType":"null","col":0,"comment":"null","endLoc":105,"id":9658,"name":"MAX_INTERPOL_DEPTH","nodeType":"Attribute","startLoc":105,"text":"MAX_INTERPOL_DEPTH"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":9659,"name":"OPTION_DEFAULTS","nodeType":"Attribute","startLoc":107,"text":"OPTION_DEFAULTS"},{"attributeType":"Builder","col":0,"comment":"null","endLoc":195,"id":9660,"name":"_builder","nodeType":"Attribute","startLoc":195,"text":"_builder"},{"attributeType":"null","col":0,"comment":"null","endLoc":565,"id":9661,"name":"get_method_function","nodeType":"Attribute","startLoc":565,"text":"get_method_function"},{"attributeType":"null","col":0,"comment":"null","endLoc":447,"id":9662,"name":"interpolation_engines","nodeType":"Attribute","startLoc":447,"text":"interpolation_engines"},{"col":0,"comment":"","endLoc":16,"header":"configobj.py#<anonymous>","id":9663,"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":"utils.py","filePath":"astropy/modeling","id":9664,"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\n\nfrom collections import deque, MutableMapping\nfrom inspect import signature\n\nimport numpy as np\n\n\nfrom ..utils import isiterable, check_broadcast\nfrom ..utils.compat import NUMPY_LT_1_14\n\nfrom .. import units as u\n\n__all__ = ['ExpressionTree', 'AliasDict', 'check_broadcast',\n           'poly_map_domain', 'comb', 'ellipse_extent']\n\n\nclass ExpressionTree:\n    __slots__ = ['left', 'right', 'value']\n\n    def __init__(self, value, left=None, right=None):\n        self.value = value\n        self.left = left\n\n        # Two subtrees can't be the same *object* or else traverse_postorder\n        # breaks, so we just always copy the right subtree to subvert that.\n        if right is not None and left is right:\n            right = right.copy()\n\n        self.right = right\n\n    def __getstate__(self):\n        # For some reason the default pickle protocol on Python 2 does not just\n        # do this.  On Python 3 it's not a problem.\n        return dict((slot, getattr(self, slot)) for slot in self.__slots__)\n\n    def __setstate__(self, state):\n        for slot, value in state.items():\n            setattr(self, slot, value)\n\n    @property\n    def isleaf(self):\n        return self.left is None and self.right is None\n\n    def traverse_preorder(self):\n        stack = deque([self])\n        while stack:\n            node = stack.pop()\n            yield node\n\n            if node.right is not None:\n                stack.append(node.right)\n            if node.left is not None:\n                stack.append(node.left)\n\n    def traverse_inorder(self):\n        stack = deque()\n        node = self\n        while stack or node is not None:\n            if node is not None:\n                stack.append(node)\n                node = node.left\n            else:\n                node = stack.pop()\n                yield node\n                node = node.right\n\n    def traverse_postorder(self):\n        stack = deque([self])\n        last = None\n        while stack:\n            node = stack[-1]\n            if last is None or node is last.left or node is last.right:\n                if node.left is not None:\n                    stack.append(node.left)\n                elif node.right is not None:\n                    stack.append(node.right)\n            elif node.left is last and node.right is not None:\n                stack.append(node.right)\n            else:\n                yield stack.pop()\n            last = node\n\n    def evaluate(self, operators, getter=None, start=0, stop=None):\n        \"\"\"Evaluate the expression represented by this tree.\n\n        ``Operators`` should be a dictionary mapping operator names ('tensor',\n        'product', etc.) to a function that implements that operator for the\n        correct number of operands.\n\n        If given, ``getter`` is a function evaluated on each *leaf* node's\n        value before applying the operator between them.  This could be used,\n        for example, to operate on an attribute of the node values rather than\n        directly on the node values.  The ``getter`` is passed both the index\n        of the leaf (a count starting at 0 that is incremented after each leaf\n        is found) and the leaf node itself.\n\n        The ``start`` and ``stop`` arguments allow evaluating a sub-expression\n        within the expression tree.\n\n        TODO: Document this better.\n        \"\"\"\n\n        stack = deque()\n\n        if getter is None:\n            getter = lambda idx, value: value\n\n        if start is None:\n            start = 0\n\n        leaf_idx = 0\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                # For a \"tree\" containing just a single operator at the root\n                # Also push the index of this leaf onto the stack, which will\n                # prove useful for evaluating subexpressions\n                stack.append((getter(leaf_idx, node.value), leaf_idx))\n                leaf_idx += 1\n            else:\n                operator = operators[node.value]\n\n                if len(stack) < 2:\n                    # Skip this operator if there are not enough operands on\n                    # the stack; this can happen if some operands were skipped\n                    # when evaluating a sub-expression\n                    continue\n\n                right = stack.pop()\n                left = stack.pop()\n                operands = []\n\n                for operand in (left, right):\n                    # idx is the leaf index; -1 if not a leaf node\n                    if operand[-1] == -1:\n                        operands.append(operand)\n                    else:\n                        operand, idx = operand\n                        if start <= idx and (stop is None or idx < stop):\n                            operands.append((operand, idx))\n\n                if len(operands) == 2:\n                    # evaluate the operator with the given operands and place\n                    # the result on the stack (with -1 for the \"leaf index\"\n                    # since this result is not a leaf node\n                    left, right = operands\n                    stack.append((operator(left[0], right[0]), -1))\n                elif len(operands) == 0:\n                    # Just push the left one back on the stack\n                    # TODO: Explain and/or refactor this better\n                    # This is here because even if both operands were \"skipped\"\n                    # due to being outside the (start, stop) range, we've only\n                    # skipped one operator.  But there should be at least 2\n                    # operators involving these operands, so we push the one\n                    # from the left back onto the stack so that the next\n                    # operator will be skipped as well.  Should probably come\n                    # up with an easier to follow way to write this algorithm\n                    stack.append(left)\n                else:\n                    # one or more of the operands was not included in the\n                    # sub-expression slice, so don't evaluate the operator;\n                    # instead place left over operands (if any) back on the\n                    # stack for later use\n                    stack.extend(operands)\n\n        return stack.pop()[0]\n\n    def copy(self):\n        # Hopefully this won't blow the stack for any practical case; if such a\n        # case arises that this won't work then I suppose we can find an\n        # iterative approach.\n\n        children = []\n        for child in (self.left, self.right):\n            if isinstance(child, ExpressionTree):\n                children.append(child.copy())\n            else:\n                children.append(child)\n\n        return self.__class__(self.value, left=children[0], right=children[1])\n\n    def format_expression(self, operator_precedence, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: '[{0}]'.format(i)\n\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            oper_order = operator_precedence[node.value]\n            right = operands.pop()\n            left = operands.pop()\n\n            if (node.left is not None and not node.left.isleaf and\n                    operator_precedence[node.left.value] < oper_order):\n                left = '({0})'.format(left)\n            if (node.right is not None and not node.right.isleaf and\n                    operator_precedence[node.right.value] < oper_order):\n                right = '({0})'.format(right)\n\n            operands.append(' '.join((left, node.value, right)))\n\n        return ''.join(operands)\n\n\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        # TODO:\n        # This could be done more efficiently, but at present the use case for\n        # it is narrow if non-existent.\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\nclass _BoundingBox(tuple):\n    \"\"\"\n    Base class for models with custom bounding box templates (methods that\n    return an actual bounding box tuple given some adjustable parameters--see\n    for example `~astropy.modeling.models.Gaussian1D.bounding_box`).\n\n    On these classes the ``bounding_box`` property still returns a `tuple`\n    giving the default bounding box for that instance of the model.  But that\n    tuple may also be a subclass of this class that is callable, and allows\n    a new tuple to be returned using a user-supplied value for any adjustable\n    parameters to the bounding box.\n    \"\"\"\n\n    _model = None\n\n    def __new__(cls, input_, _model=None):\n        self = super().__new__(cls, input_)\n        if _model is not None:\n            # Bind this _BoundingBox (most likely a subclass) to a Model\n            # instance so that its __call__ can access the model\n            self._model = _model\n\n        return self\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    @classmethod\n    def validate(cls, model, bounding_box):\n        \"\"\"\n        Validate a given bounding box sequence against the given model (which\n        may be either a subclass of `~astropy.modeling.Model` or an instance\n        thereof, so long as the ``.inputs`` attribute is defined.\n\n        Currently this just checks that the bounding_box is either a 2-tuple\n        of lower and upper bounds for 1-D models, or an N-tuple of 2-tuples\n        for N-D models.\n\n        This also returns a normalized version of the bounding_box input to\n        ensure it is always an N-tuple (even for the 1-D case).\n        \"\"\"\n\n        nd = model.n_inputs\n\n        if nd == 1:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) not in ((2,), (1, 2))):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"2 consisting of a lower and upper bound, or a 1-tuple \"\n                    \"containing such a sequence as its sole element.\".format(\n                        model.name))\n\n            if len(bounding_box) == 1:\n                return cls((tuple(bounding_box[0]),))\n            else:\n                return cls(tuple(bounding_box))\n        else:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) != (nd, 2)):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"{1} (the number of model inputs) consisting of pairs of \"\n                    \"lower and upper bounds for those inputs on which to \"\n                    \"evaluate the model.\".format(model.name, nd))\n\n            return cls(tuple(bounds) for bounds in bounding_box)\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    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 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    sep = ',' if NUMPY_LT_1_14 else ', '\n    r = np.array2string(array, separator=sep, 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`\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    else:\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 _parameter_with_unit(parameter, unit):\n    if parameter.unit is None:\n        return parameter.value * unit\n    else:\n        return parameter.quantity.to(unit)\n\n\ndef _parameter_without_unit(value, old_unit, new_unit):\n    if old_unit is None:\n        return value\n    else:\n        return value * old_unit.to(new_unit)\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    else:\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    else:\n        return np.rad2deg(value)\n"},{"className":"ExpressionTree","col":0,"comment":"null","endLoc":213,"id":9665,"nodeType":"Class","startLoc":23,"text":"class ExpressionTree:\n    __slots__ = ['left', 'right', 'value']\n\n    def __init__(self, value, left=None, right=None):\n        self.value = value\n        self.left = left\n\n        # Two subtrees can't be the same *object* or else traverse_postorder\n        # breaks, so we just always copy the right subtree to subvert that.\n        if right is not None and left is right:\n            right = right.copy()\n\n        self.right = right\n\n    def __getstate__(self):\n        # For some reason the default pickle protocol on Python 2 does not just\n        # do this.  On Python 3 it's not a problem.\n        return dict((slot, getattr(self, slot)) for slot in self.__slots__)\n\n    def __setstate__(self, state):\n        for slot, value in state.items():\n            setattr(self, slot, value)\n\n    @property\n    def isleaf(self):\n        return self.left is None and self.right is None\n\n    def traverse_preorder(self):\n        stack = deque([self])\n        while stack:\n            node = stack.pop()\n            yield node\n\n            if node.right is not None:\n                stack.append(node.right)\n            if node.left is not None:\n                stack.append(node.left)\n\n    def traverse_inorder(self):\n        stack = deque()\n        node = self\n        while stack or node is not None:\n            if node is not None:\n                stack.append(node)\n                node = node.left\n            else:\n                node = stack.pop()\n                yield node\n                node = node.right\n\n    def traverse_postorder(self):\n        stack = deque([self])\n        last = None\n        while stack:\n            node = stack[-1]\n            if last is None or node is last.left or node is last.right:\n                if node.left is not None:\n                    stack.append(node.left)\n                elif node.right is not None:\n                    stack.append(node.right)\n            elif node.left is last and node.right is not None:\n                stack.append(node.right)\n            else:\n                yield stack.pop()\n            last = node\n\n    def evaluate(self, operators, getter=None, start=0, stop=None):\n        \"\"\"Evaluate the expression represented by this tree.\n\n        ``Operators`` should be a dictionary mapping operator names ('tensor',\n        'product', etc.) to a function that implements that operator for the\n        correct number of operands.\n\n        If given, ``getter`` is a function evaluated on each *leaf* node's\n        value before applying the operator between them.  This could be used,\n        for example, to operate on an attribute of the node values rather than\n        directly on the node values.  The ``getter`` is passed both the index\n        of the leaf (a count starting at 0 that is incremented after each leaf\n        is found) and the leaf node itself.\n\n        The ``start`` and ``stop`` arguments allow evaluating a sub-expression\n        within the expression tree.\n\n        TODO: Document this better.\n        \"\"\"\n\n        stack = deque()\n\n        if getter is None:\n            getter = lambda idx, value: value\n\n        if start is None:\n            start = 0\n\n        leaf_idx = 0\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                # For a \"tree\" containing just a single operator at the root\n                # Also push the index of this leaf onto the stack, which will\n                # prove useful for evaluating subexpressions\n                stack.append((getter(leaf_idx, node.value), leaf_idx))\n                leaf_idx += 1\n            else:\n                operator = operators[node.value]\n\n                if len(stack) < 2:\n                    # Skip this operator if there are not enough operands on\n                    # the stack; this can happen if some operands were skipped\n                    # when evaluating a sub-expression\n                    continue\n\n                right = stack.pop()\n                left = stack.pop()\n                operands = []\n\n                for operand in (left, right):\n                    # idx is the leaf index; -1 if not a leaf node\n                    if operand[-1] == -1:\n                        operands.append(operand)\n                    else:\n                        operand, idx = operand\n                        if start <= idx and (stop is None or idx < stop):\n                            operands.append((operand, idx))\n\n                if len(operands) == 2:\n                    # evaluate the operator with the given operands and place\n                    # the result on the stack (with -1 for the \"leaf index\"\n                    # since this result is not a leaf node\n                    left, right = operands\n                    stack.append((operator(left[0], right[0]), -1))\n                elif len(operands) == 0:\n                    # Just push the left one back on the stack\n                    # TODO: Explain and/or refactor this better\n                    # This is here because even if both operands were \"skipped\"\n                    # due to being outside the (start, stop) range, we've only\n                    # skipped one operator.  But there should be at least 2\n                    # operators involving these operands, so we push the one\n                    # from the left back onto the stack so that the next\n                    # operator will be skipped as well.  Should probably come\n                    # up with an easier to follow way to write this algorithm\n                    stack.append(left)\n                else:\n                    # one or more of the operands was not included in the\n                    # sub-expression slice, so don't evaluate the operator;\n                    # instead place left over operands (if any) back on the\n                    # stack for later use\n                    stack.extend(operands)\n\n        return stack.pop()[0]\n\n    def copy(self):\n        # Hopefully this won't blow the stack for any practical case; if such a\n        # case arises that this won't work then I suppose we can find an\n        # iterative approach.\n\n        children = []\n        for child in (self.left, self.right):\n            if isinstance(child, ExpressionTree):\n                children.append(child.copy())\n            else:\n                children.append(child)\n\n        return self.__class__(self.value, left=children[0], right=children[1])\n\n    def format_expression(self, operator_precedence, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: '[{0}]'.format(i)\n\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            oper_order = operator_precedence[node.value]\n            right = operands.pop()\n            left = operands.pop()\n\n            if (node.left is not None and not node.left.isleaf and\n                    operator_precedence[node.left.value] < oper_order):\n                left = '({0})'.format(left)\n            if (node.right is not None and not node.right.isleaf and\n                    operator_precedence[node.right.value] < oper_order):\n                right = '({0})'.format(right)\n\n            operands.append(' '.join((left, node.value, right)))\n\n        return ''.join(operands)"},{"col":4,"comment":"null","endLoc":35,"header":"def __init__(self, value, left=None, right=None)","id":9666,"name":"__init__","nodeType":"Function","startLoc":26,"text":"def __init__(self, value, left=None, right=None):\n        self.value = value\n        self.left = left\n\n        # Two subtrees can't be the same *object* or else traverse_postorder\n        # breaks, so we just always copy the right subtree to subvert that.\n        if right is not None and left is right:\n            right = right.copy()\n\n        self.right = right"},{"attributeType":"null","col":0,"comment":"null","endLoc":566,"id":9667,"name":"get_method_self","nodeType":"Attribute","startLoc":566,"text":"get_method_self"},{"col":4,"comment":"null","endLoc":40,"header":"def __getstate__(self)","id":9668,"name":"__getstate__","nodeType":"Function","startLoc":37,"text":"def __getstate__(self):\n        # For some reason the default pickle protocol on Python 2 does not just\n        # do this.  On Python 3 it's not a problem.\n        return dict((slot, getattr(self, slot)) for slot in self.__slots__)"},{"col":4,"comment":"null","endLoc":44,"header":"def __setstate__(self, state)","id":9669,"name":"__setstate__","nodeType":"Function","startLoc":42,"text":"def __setstate__(self, state):\n        for slot, value in state.items():\n            setattr(self, slot, value)"},{"attributeType":"null","col":0,"comment":"null","endLoc":567,"id":9670,"name":"get_function_closure","nodeType":"Attribute","startLoc":567,"text":"get_function_closure"},{"col":4,"comment":"null","endLoc":48,"header":"@property\n    def isleaf(self)","id":9671,"name":"isleaf","nodeType":"Function","startLoc":46,"text":"@property\n    def isleaf(self):\n        return self.left is None and self.right is None"},{"col":4,"comment":"null","endLoc":59,"header":"def traverse_preorder(self)","id":9672,"name":"traverse_preorder","nodeType":"Function","startLoc":50,"text":"def traverse_preorder(self):\n        stack = deque([self])\n        while stack:\n            node = stack.pop()\n            yield node\n\n            if node.right is not None:\n                stack.append(node.right)\n            if node.left is not None:\n                stack.append(node.left)"},{"attributeType":"null","col":0,"comment":"null","endLoc":568,"id":9673,"name":"get_function_code","nodeType":"Attribute","startLoc":568,"text":"get_function_code"},{"col":4,"comment":"null","endLoc":71,"header":"def traverse_inorder(self)","id":9674,"name":"traverse_inorder","nodeType":"Function","startLoc":61,"text":"def traverse_inorder(self):\n        stack = deque()\n        node = self\n        while stack or node is not None:\n            if node is not None:\n                stack.append(node)\n                node = node.left\n            else:\n                node = stack.pop()\n                yield node\n                node = node.right"},{"attributeType":"null","col":0,"comment":"null","endLoc":569,"id":9675,"name":"get_function_defaults","nodeType":"Attribute","startLoc":569,"text":"get_function_defaults"},{"attributeType":"null","col":0,"comment":"null","endLoc":570,"id":9676,"name":"get_function_globals","nodeType":"Attribute","startLoc":570,"text":"get_function_globals"},{"attributeType":"null","col":4,"comment":"null","endLoc":586,"id":9678,"name":"viewkeys","nodeType":"Attribute","startLoc":586,"text":"viewkeys"},{"col":4,"comment":"null","endLoc":87,"header":"def traverse_postorder(self)","id":9679,"name":"traverse_postorder","nodeType":"Function","startLoc":73,"text":"def traverse_postorder(self):\n        stack = deque([self])\n        last = None\n        while stack:\n            node = stack[-1]\n            if last is None or node is last.left or node is last.right:\n                if node.left is not None:\n                    stack.append(node.left)\n                elif node.right is not None:\n                    stack.append(node.right)\n            elif node.left is last and node.right is not None:\n                stack.append(node.right)\n            else:\n                yield stack.pop()\n            last = node"},{"attributeType":"null","col":4,"comment":"null","endLoc":588,"id":9680,"name":"viewvalues","nodeType":"Attribute","startLoc":588,"text":"viewvalues"},{"attributeType":"null","col":4,"comment":"null","endLoc":590,"id":9681,"name":"viewitems","nodeType":"Attribute","startLoc":590,"text":"viewitems"},{"attributeType":"null","col":4,"comment":"null","endLoc":604,"id":9682,"name":"viewkeys","nodeType":"Attribute","startLoc":604,"text":"viewkeys"},{"col":4,"comment":"Evaluate the expression represented by this tree.\n\n        ``Operators`` should be a dictionary mapping operator names ('tensor',\n        'product', etc.) to a function that implements that operator for the\n        correct number of operands.\n\n        If given, ``getter`` is a function evaluated on each *leaf* node's\n        value before applying the operator between them.  This could be used,\n        for example, to operate on an attribute of the node values rather than\n        directly on the node values.  The ``getter`` is passed both the index\n        of the leaf (a count starting at 0 that is incremented after each leaf\n        is found) and the leaf node itself.\n\n        The ``start`` and ``stop`` arguments allow evaluating a sub-expression\n        within the expression tree.\n\n        TODO: Document this better.\n        ","endLoc":171,"header":"def evaluate(self, operators, getter=None, start=0, stop=None)","id":9683,"name":"evaluate","nodeType":"Function","startLoc":89,"text":"def evaluate(self, operators, getter=None, start=0, stop=None):\n        \"\"\"Evaluate the expression represented by this tree.\n\n        ``Operators`` should be a dictionary mapping operator names ('tensor',\n        'product', etc.) to a function that implements that operator for the\n        correct number of operands.\n\n        If given, ``getter`` is a function evaluated on each *leaf* node's\n        value before applying the operator between them.  This could be used,\n        for example, to operate on an attribute of the node values rather than\n        directly on the node values.  The ``getter`` is passed both the index\n        of the leaf (a count starting at 0 that is incremented after each leaf\n        is found) and the leaf node itself.\n\n        The ``start`` and ``stop`` arguments allow evaluating a sub-expression\n        within the expression tree.\n\n        TODO: Document this better.\n        \"\"\"\n\n        stack = deque()\n\n        if getter is None:\n            getter = lambda idx, value: value\n\n        if start is None:\n            start = 0\n\n        leaf_idx = 0\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                # For a \"tree\" containing just a single operator at the root\n                # Also push the index of this leaf onto the stack, which will\n                # prove useful for evaluating subexpressions\n                stack.append((getter(leaf_idx, node.value), leaf_idx))\n                leaf_idx += 1\n            else:\n                operator = operators[node.value]\n\n                if len(stack) < 2:\n                    # Skip this operator if there are not enough operands on\n                    # the stack; this can happen if some operands were skipped\n                    # when evaluating a sub-expression\n                    continue\n\n                right = stack.pop()\n                left = stack.pop()\n                operands = []\n\n                for operand in (left, right):\n                    # idx is the leaf index; -1 if not a leaf node\n                    if operand[-1] == -1:\n                        operands.append(operand)\n                    else:\n                        operand, idx = operand\n                        if start <= idx and (stop is None or idx < stop):\n                            operands.append((operand, idx))\n\n                if len(operands) == 2:\n                    # evaluate the operator with the given operands and place\n                    # the result on the stack (with -1 for the \"leaf index\"\n                    # since this result is not a leaf node\n                    left, right = operands\n                    stack.append((operator(left[0], right[0]), -1))\n                elif len(operands) == 0:\n                    # Just push the left one back on the stack\n                    # TODO: Explain and/or refactor this better\n                    # This is here because even if both operands were \"skipped\"\n                    # due to being outside the (start, stop) range, we've only\n                    # skipped one operator.  But there should be at least 2\n                    # operators involving these operands, so we push the one\n                    # from the left back onto the stack so that the next\n                    # operator will be skipped as well.  Should probably come\n                    # up with an easier to follow way to write this algorithm\n                    stack.append(left)\n                else:\n                    # one or more of the operands was not included in the\n                    # sub-expression slice, so don't evaluate the operator;\n                    # instead place left over operands (if any) back on the\n                    # stack for later use\n                    stack.extend(operands)\n\n        return stack.pop()[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":606,"id":9684,"name":"viewvalues","nodeType":"Attribute","startLoc":606,"text":"viewvalues"},{"col":21,"endLoc":112,"id":9685,"nodeType":"Lambda","startLoc":112,"text":"lambda idx, value: value"},{"attributeType":"null","col":4,"comment":"null","endLoc":608,"id":9686,"name":"viewitems","nodeType":"Attribute","startLoc":608,"text":"viewitems"},{"col":4,"comment":"null","endLoc":2856,"header":"def pickle_table(self, filename, signature='')","id":9687,"name":"pickle_table","nodeType":"Function","startLoc":2838,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":624,"id":9688,"name":"unichr","nodeType":"Attribute","startLoc":624,"text":"unichr"},{"attributeType":"null","col":4,"comment":"null","endLoc":626,"id":9689,"name":"int2byte","nodeType":"Attribute","startLoc":626,"text":"int2byte"},{"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":209,"header":"def _cstack(left, right)","id":9690,"name":"_cstack","nodeType":"Function","startLoc":181,"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])"},{"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:`/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` with distance units\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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":1095,"header":"def search_around_3d(self, searcharoundcoords, distlimit)","id":9691,"name":"search_around_3d","nodeType":"Function","startLoc":1039,"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:`/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` with distance units\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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    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":249,"header":"def _cdot(left, right)","id":9692,"name":"_cdot","nodeType":"Function","startLoc":212,"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 {0}, right coord_matrix is {1}'.format(\n                cright, cleft))\n    return result"},{"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` with distance units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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":271,"header":"def search_around_3d(coords1, coords2, distlimit, storekdtree='kdtree_3d')","id":9693,"name":"search_around_3d","nodeType":"Function","startLoc":171,"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` with distance units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":9695,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":276,"id":9696,"name":"_operators","nodeType":"Attribute","startLoc":276,"text":"_operators"},{"col":0,"comment":"","endLoc":16,"header":"separable.py#<anonymous>","id":9697,"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\"]\n\n_operators = {'&': _cstack, '|': _cdot, '+': _arith_oper, '-': _arith_oper,\n              '*': _arith_oper, '/': _arith_oper, '**': _arith_oper}"},{"fileName":"fitting.py","filePath":"astropy/modeling","id":9698,"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\n\nimport abc\nimport inspect\nimport operator\nimport warnings\n\nfrom functools import reduce, wraps\n\nimport numpy as np\n\nfrom .utils import poly_map_domain, _combine_equivalency_dict\nfrom ..units import Quantity\nfrom ..utils.exceptions import AstropyUserWarning\nfrom .optimizers import (SLSQP, Simplex)\nfrom .statistic import (leastsquare)\n\n# Check pkg_resources exists\ntry:\n    from pkg_resources import iter_entry_points\n    HAS_PKG = True\nexcept ImportError:\n    HAS_PKG = False\n\n\n__all__ = ['LinearLSQFitter', 'LevMarLSQFitter', 'FittingWithOutlierRemoval',\n           'SLSQPLSQFitter', 'SimplexLSQFitter', 'JointFitter', 'Fitter']\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\nfrom .optimizers import (DEFAULT_MAXITER, DEFAULT_EPS, DEFAULT_ACC)\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\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['x'], equivalencies=input_units_equivalencies['x'])\n                    if isinstance(y, Quantity) and z is not None:\n                        y = y.to(model.input_units['y'], equivalencies=input_units_equivalencies['y'])\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\n                model = model.without_units_for_data(x=x, y=y, z=z)\n\n                # We strip away the units from the input itself\n\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(y, Quantity):\n                        add_back_units = True\n                        zdata = z.value\n                    else:\n                        zdata = np.asarray(z)\n\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(x=x, y=y, z=z)\n\n                return model_new\n\n            else:\n\n                raise NotImplementedError(\"This model does not support being 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    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    @abc.abstractmethod\n    def __call__(self):\n        \"\"\"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n\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\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    \"\"\"\n\n    supported_constraints = ['fixed']\n\n    def __init__(self):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }\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\n            input coordinates\n        z : array (optional)\n            input coordinates\n        weights : array (optional)\n            weights\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 and keyword-only argument\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        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        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\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        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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices,\n                                                   x=x)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x)\n            else:\n                lhs = 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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices, x=x, y=y)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                    fixparam_indices, x=x, y=y)\n            else:\n                lhs = 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                if z.ndim > 2:\n                    # Basically this code here is making the assumption that if\n                    # z has 3 dimensions it represents multiple models where\n                    # the value of z is one plane per model.  It's then\n                    # flattening each plane and transposing so that the model\n                    # axis is *last*.  That's fine, but this could be\n                    # generalized for other dimensionalities of z.\n                    # TODO: See above comment\n                    rhs = np.array([i.flatten() for i in z]).T\n                else:\n                    rhs = z.T\n            else:\n                rhs = z.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        # 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 co-ordinates, 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            weights = np.asarray(weights, dtype=float)\n            if len(x) != len(weights):\n                raise ValueError(\"x and weights should have the same length\")\n            if rhs.ndim == 2:\n                lhs *= weights[:, np.newaxis]\n                # Don't modify in-place in case rhs was the original dependent\n                # variable array\n                rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        if rcond is None:\n            rcond = len(x) * np.finfo(x.dtype).eps\n\n        scl = (lhs * lhs).sum(0)\n        lacoef, resids, rank, sval = np.linalg.lstsq(lhs / scl, rhs, rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef = (lacoef.T / scl).T\n        self.fit_info['params'] = lacoef\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 rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        _fitter_to_model_params(model_copy, lacoef.flatten())\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 number of iterations ``niter``, outliers are removed\n    and fitting is performed for each iteration.\n\n    Parameters\n    ----------\n    fitter : An Astropy fitter\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter.\n    outlier_func : function\n        A function for outlier removal.\n    niter : int (optional)\n        Number of iterations.\n    outlier_kwargs : dict (optional)\n        Keyword arguments for outlier_func.\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\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\n        Returns\n        -------\n        filtered_data : numpy.ma.core.MaskedArray\n            Data used to perform the fitting after outlier removal.\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        \"\"\"\n\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        if z is None:\n            filtered_data = y\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        else:\n            filtered_data = z\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x, y),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x, y)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               y[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        return filtered_data, fitted_model\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\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    supported_constraints = ['fixed', 'tied', 'bounds']\n    \"\"\"\n    The constraint types supported by this fitter type.\n    \"\"\"\n\n    def __init__(self):\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\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        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    @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\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 and keyword-only argument\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        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n\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        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\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\n            if z is None:\n                full_deriv = np.ravel(weights) * np.array(model.fit_deriv(x, *model.parameters))\n            else:\n                full_deriv = (np.ravel(weights) * np.array(model.fit_deriv(x, y, *model.parameters)).T).T\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                full_deriv = np.asarray(full_deriv).T\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                return [np.ravel(_) for _ in np.ravel(weights) * np.array(model.fit_deriv(x, *params))]\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                else:\n                    return [np.ravel(_) for _ in (weights * np.array(model.fit_deriv(x, y, *params)))]\n\n\nclass SLSQPLSQFitter(Fitter):\n    \"\"\"\n    SLSQP optimization algorithm and least squares statistic.\n\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\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 and keyword-only argument\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        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        p0, _ = _model_to_fit_params(model_copy)\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\n\nclass SimplexLSQFitter(Fitter):\n    \"\"\"\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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional and keyword-only argument\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        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\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        return model_copy\n\n\nclass JointFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Fit models which share a parameter.\n\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    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 = [p.flatten() for p in model.parameters]\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        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(\"Expected >1 models, {} is given\".format(\n                    len(self.models)))\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.asarray(x, dtype=float)\n    y = np.asarray(y, dtype=float)\n\n    if z is not None:\n        z = np.asarray(z, dtype=float)\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:\n        if z is None:\n            if y.shape[model_set_axis] != n_models:\n                raise ValueError(\n                    \"Number of data sets (y array is expected to equal \"\n                    \"the number of parameter sets)\")\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            # http://docs.scipy.org/doc/numpy/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        else:\n            # Shape of z excluding model_set_axis\n            z_shape = z.shape[:model_set_axis] + z.shape[model_set_axis + 1:]\n\n            if not (x.shape == y.shape == z_shape):\n                raise ValueError(\"x, y and z should have the same shape\")\n\n    if z is None:\n        farg = (x, y)\n    else:\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\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        model.parameters[slice_] = values\n        offset += size\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                model.parameters[slice_] = value\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\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    else:\n        return (model.parameters, fitparam_indices)\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\n    entry_points : a list of `~pkg_resources.EntryPoint`\n                  entry_points are objects which encapsulate\n                  importable objects and are defined on the\n                  installation of a package.\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\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('{type} error occurred in entry '\n                                             'point {name}.' .format(type=type(e).__name__, name=name)))\n        else:\n            if not inspect.isclass(entry_point):\n                warnings.warn(AstropyUserWarning(\n                    'Modeling entry point {0} expected to be a '\n                    'Class.' .format(name)))\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 {0} expected to extend '\n                        'astropy.modeling.Fitter' .format(name)))\n\n\n# this is so fitting doesn't choke if pkg_resources doesn't exist\nif HAS_PKG:\n    populate_entry_points(iter_entry_points(group='astropy.modeling', name=None))\n"},{"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":172,"id":9699,"nodeType":"Class","startLoc":94,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":628,"id":9700,"name":"byte2int","nodeType":"Attribute","startLoc":628,"text":"byte2int"},{"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":91,"id":9701,"nodeType":"Class","startLoc":26,"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 = \"{0}()\".format(self.__class__.__name__)\n        return fmt\n\n    @property\n    def opt_method(self):\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":49,"header":"def __init__(self, opt_method)","id":9702,"name":"__init__","nodeType":"Function","startLoc":45,"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":54,"header":"@property\n    def maxiter(self)","id":9703,"name":"maxiter","nodeType":"Function","startLoc":51,"text":"@property\n    def maxiter(self):\n        \"\"\"Maximum number of iterations\"\"\"\n        return self._maxiter"},{"col":4,"comment":"Set maxiter","endLoc":59,"header":"@maxiter.setter\n    def maxiter(self, val)","id":9704,"name":"maxiter","nodeType":"Function","startLoc":56,"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":64,"header":"@property\n    def eps(self)","id":9705,"name":"eps","nodeType":"Function","startLoc":61,"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":69,"header":"@eps.setter\n    def eps(self, val)","id":9706,"name":"eps","nodeType":"Function","startLoc":66,"text":"@eps.setter\n    def eps(self, val):\n        \"\"\"Set eps value\"\"\"\n        self._eps = val"},{"col":4,"comment":"Requested accuracy","endLoc":74,"header":"@property\n    def acc(self)","id":9707,"name":"acc","nodeType":"Function","startLoc":71,"text":"@property\n    def acc(self):\n        \"\"\"Requested accuracy\"\"\"\n        return self._acc"},{"col":4,"comment":"Set accuracy","endLoc":79,"header":"@acc.setter\n    def acc(self, val)","id":9708,"name":"acc","nodeType":"Function","startLoc":76,"text":"@acc.setter\n    def acc(self, val):\n        \"\"\"Set accuracy\"\"\"\n        self._acc = val"},{"col":4,"comment":"null","endLoc":83,"header":"def __repr__(self)","id":9709,"name":"__repr__","nodeType":"Function","startLoc":81,"text":"def __repr__(self):\n        fmt = \"{0}()\".format(self.__class__.__name__)\n        return fmt"},{"col":4,"comment":"null","endLoc":185,"header":"def copy(self)","id":9710,"name":"copy","nodeType":"Function","startLoc":173,"text":"def copy(self):\n        # Hopefully this won't blow the stack for any practical case; if such a\n        # case arises that this won't work then I suppose we can find an\n        # iterative approach.\n\n        children = []\n        for child in (self.left, self.right):\n            if isinstance(child, ExpressionTree):\n                children.append(child.copy())\n            else:\n                children.append(child)\n\n        return self.__class__(self.value, left=children[0], right=children[1])"},{"col":4,"comment":"null","endLoc":87,"header":"@property\n    def opt_method(self)","id":9711,"name":"opt_method","nodeType":"Function","startLoc":85,"text":"@property\n    def opt_method(self):\n        return self._opt_method"},{"col":4,"comment":"null","endLoc":91,"header":"@abc.abstractmethod\n    def __call__(self)","id":9712,"name":"__call__","nodeType":"Function","startLoc":89,"text":"@abc.abstractmethod\n    def __call__(self):\n        raise NotImplementedError(\"Subclasses should implement this method\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":9713,"name":"supported_constraints","nodeType":"Attribute","startLoc":43,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":9714,"name":"_maxiter","nodeType":"Attribute","startLoc":47,"text":"self._maxiter"},{"col":4,"comment":"\n        Return a copy of the CCDData object.\n        ","endLoc":338,"header":"def copy(self)","id":9715,"name":"copy","nodeType":"Function","startLoc":334,"text":"def copy(self):\n        \"\"\"\n        Return a copy of the CCDData object.\n        \"\"\"\n        return self.__class__(self, copy=True)"},{"attributeType":"null","col":4,"comment":"null","endLoc":629,"id":9716,"name":"indexbytes","nodeType":"Attribute","startLoc":629,"text":"indexbytes"},{"attributeType":"null","col":8,"comment":"null","endLoc":48,"id":9717,"name":"_eps","nodeType":"Attribute","startLoc":48,"text":"self._eps"},{"attributeType":"null","col":8,"comment":"null","endLoc":46,"id":9718,"name":"_opt_method","nodeType":"Attribute","startLoc":46,"text":"self._opt_method"},{"attributeType":"null","col":8,"comment":"null","endLoc":49,"id":9719,"name":"_acc","nodeType":"Attribute","startLoc":49,"text":"self._acc"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":340,"id":9720,"name":"add","nodeType":"Attribute","startLoc":340,"text":"add"},{"col":4,"comment":"null","endLoc":116,"header":"def __init__(self)","id":9721,"name":"__init__","nodeType":"Function","startLoc":108,"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":"null","endLoc":213,"header":"def format_expression(self, operator_precedence, format_leaf=None)","id":9722,"name":"format_expression","nodeType":"Function","startLoc":187,"text":"def format_expression(self, operator_precedence, format_leaf=None):\n        leaf_idx = 0\n        operands = deque()\n\n        if format_leaf is None:\n            format_leaf = lambda i, l: '[{0}]'.format(i)\n\n        for node in self.traverse_postorder():\n            if node.isleaf:\n                operands.append(format_leaf(leaf_idx, node))\n                leaf_idx += 1\n                continue\n\n            oper_order = operator_precedence[node.value]\n            right = operands.pop()\n            left = operands.pop()\n\n            if (node.left is not None and not node.left.isleaf and\n                    operator_precedence[node.left.value] < oper_order):\n                left = '({0})'.format(left)\n            if (node.right is not None and not node.right.isleaf and\n                    operator_precedence[node.right.value] < oper_order):\n                right = '({0})'.format(right)\n\n            operands.append(' '.join((left, node.value, right)))\n\n        return ''.join(operands)"},{"col":26,"endLoc":192,"id":9723,"nodeType":"Lambda","startLoc":192,"text":"lambda i, l: '[{0}]'.format(i)"},{"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":1141,"header":"def position_angle(self, other)","id":9724,"name":"position_angle","nodeType":"Function","startLoc":1097,"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":"\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":172,"header":"def __call__(self, objfunc, initval, fargs, **kwargs)","id":9725,"name":"__call__","nodeType":"Function","startLoc":118,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":630,"id":9726,"name":"iterbytes","nodeType":"Attribute","startLoc":630,"text":"iterbytes"},{"attributeType":"null","col":4,"comment":"null","endLoc":632,"id":9727,"name":"StringIO","nodeType":"Attribute","startLoc":632,"text":"StringIO"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":341,"id":9728,"name":"subtract","nodeType":"Attribute","startLoc":341,"text":"subtract"},{"attributeType":"null","col":4,"comment":"null","endLoc":106,"id":9729,"name":"supported_constraints","nodeType":"Attribute","startLoc":106,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":9730,"name":"fit_info","nodeType":"Attribute","startLoc":111,"text":"self.fit_info"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":342,"id":9731,"name":"multiply","nodeType":"Attribute","startLoc":342,"text":"multiply"},{"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":242,"id":9732,"nodeType":"Class","startLoc":175,"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":198,"header":"def __init__(self)","id":9733,"name":"__init__","nodeType":"Function","startLoc":190,"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        }"},{"attributeType":"sharedmethod","col":4,"comment":"null","endLoc":343,"id":9734,"name":"divide","nodeType":"Attribute","startLoc":343,"text":"divide"},{"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":242,"header":"def __call__(self, objfunc, initval, fargs, **kwargs)","id":9735,"name":"__call__","nodeType":"Function","startLoc":200,"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":4,"comment":"null","endLoc":24,"id":9736,"name":"__slots__","nodeType":"Attribute","startLoc":24,"text":"__slots__"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":9737,"name":"left","nodeType":"Attribute","startLoc":28,"text":"self.left"},{"attributeType":"None","col":8,"comment":"null","endLoc":35,"id":9738,"name":"right","nodeType":"Attribute","startLoc":35,"text":"self.right"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":9739,"name":"value","nodeType":"Attribute","startLoc":27,"text":"self.value"},{"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":348,"id":9740,"nodeType":"Class","startLoc":216,"text":"class 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        # TODO:\n        # This could be done more efficiently, but at present the use case for\n        # it is narrow if non-existent.\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":303,"header":"def __getitem__(self, key)","id":9741,"name":"__getitem__","nodeType":"Function","startLoc":296,"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":309,"header":"def __setitem__(self, key, value)","id":9742,"name":"__setitem__","nodeType":"Function","startLoc":305,"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":318,"header":"def __delitem__(self, key)","id":9743,"name":"__delitem__","nodeType":"Function","startLoc":311,"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":331,"header":"def __iter__(self)","id":9744,"name":"__iter__","nodeType":"Function","startLoc":320,"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":"null","col":8,"comment":"null","endLoc":174,"id":9745,"name":"_data","nodeType":"Attribute","startLoc":174,"text":"self._data"},{"col":4,"comment":"null","endLoc":337,"header":"def __len__(self)","id":9746,"name":"__len__","nodeType":"Function","startLoc":333,"text":"def __len__(self):\n        # TODO:\n        # This could be done more efficiently, but at present the use case for\n        # it is narrow if non-existent.\n        return len(list(iter(self)))"},{"col":4,"comment":"null","endLoc":348,"header":"def __repr__(self)","id":9747,"name":"__repr__","nodeType":"Function","startLoc":339,"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":284,"id":9748,"name":"_store_type","nodeType":"Attribute","startLoc":284,"text":"_store_type"},{"attributeType":"null","col":8,"comment":"null","endLoc":292,"id":9749,"name":"_parent","nodeType":"Attribute","startLoc":292,"text":"self._parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":188,"id":9750,"name":"supported_constraints","nodeType":"Attribute","startLoc":188,"text":"supported_constraints"},{"col":0,"comment":"\n    Position Angle (East of North) between two points on a sphere.\n\n    Parameters\n    ----------\n    lon1, lat1, lon2, lat2 : `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":693,"header":"def position_angle(lon1, lat1, lon2, lat2)","id":9751,"name":"position_angle","nodeType":"Function","startLoc":667,"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 : `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":8,"comment":"null","endLoc":193,"id":9752,"name":"fit_info","nodeType":"Attribute","startLoc":193,"text":"self.fit_info"},{"attributeType":"null","col":12,"comment":"null","endLoc":219,"id":9753,"name":"_acc","nodeType":"Attribute","startLoc":219,"text":"self._acc"},{"attributeType":"null","col":8,"comment":"null","endLoc":294,"id":9754,"name":"_aliases","nodeType":"Attribute","startLoc":294,"text":"self._aliases"},{"attributeType":"null","col":8,"comment":"null","endLoc":293,"id":9755,"name":"_store","nodeType":"Attribute","startLoc":293,"text":"self._store"},{"col":0,"comment":"\n    Least square statistic with optional weights.\n\n    Parameters\n    ----------\n    measured_vals : `~numpy.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 : `~numpy.ndarray`\n        Array of weights to apply to each residual.\n    x : `~numpy.ndarray`\n        Independent variable \"x\" to evaluate the model on.\n    y : `~numpy.ndarray`, optional\n        Independent variable \"y\" to evaluate the model on, for 2D models.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n    ","endLoc":42,"header":"def leastsquare(measured_vals, updated_model, weights, x, y=None)","id":9756,"name":"leastsquare","nodeType":"Function","startLoc":12,"text":"def leastsquare(measured_vals, updated_model, weights, x, y=None):\n    \"\"\"\n    Least square statistic with optional weights.\n\n    Parameters\n    ----------\n    measured_vals : `~numpy.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 : `~numpy.ndarray`\n        Array of weights to apply to each residual.\n    x : `~numpy.ndarray`\n        Independent variable \"x\" to evaluate the model on.\n    y : `~numpy.ndarray`, optional\n        Independent variable \"y\" to evaluate the model on, for 2D models.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n    \"\"\"\n\n    if y is None:\n        model_vals = updated_model(x)\n    else:\n        model_vals = updated_model(x, y)\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    else:\n        return np.sum((weights * (model_vals - measured_vals)) ** 2)"},{"className":"_BoundingBox","col":0,"comment":"\n    Base class for models with custom bounding box templates (methods that\n    return an actual bounding box tuple given some adjustable parameters--see\n    for example `~astropy.modeling.models.Gaussian1D.bounding_box`).\n\n    On these classes the ``bounding_box`` property still returns a `tuple`\n    giving the default bounding box for that instance of the model.  But that\n    tuple may also be a subclass of this class that is callable, and allows\n    a new tuple to be returned using a user-supplied value for any adjustable\n    parameters to the bounding box.\n    ","endLoc":419,"id":9757,"nodeType":"Class","startLoc":351,"text":"class _BoundingBox(tuple):\n    \"\"\"\n    Base class for models with custom bounding box templates (methods that\n    return an actual bounding box tuple given some adjustable parameters--see\n    for example `~astropy.modeling.models.Gaussian1D.bounding_box`).\n\n    On these classes the ``bounding_box`` property still returns a `tuple`\n    giving the default bounding box for that instance of the model.  But that\n    tuple may also be a subclass of this class that is callable, and allows\n    a new tuple to be returned using a user-supplied value for any adjustable\n    parameters to the bounding box.\n    \"\"\"\n\n    _model = None\n\n    def __new__(cls, input_, _model=None):\n        self = super().__new__(cls, input_)\n        if _model is not None:\n            # Bind this _BoundingBox (most likely a subclass) to a Model\n            # instance so that its __call__ can access the model\n            self._model = _model\n\n        return self\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    @classmethod\n    def validate(cls, model, bounding_box):\n        \"\"\"\n        Validate a given bounding box sequence against the given model (which\n        may be either a subclass of `~astropy.modeling.Model` or an instance\n        thereof, so long as the ``.inputs`` attribute is defined.\n\n        Currently this just checks that the bounding_box is either a 2-tuple\n        of lower and upper bounds for 1-D models, or an N-tuple of 2-tuples\n        for N-D models.\n\n        This also returns a normalized version of the bounding_box input to\n        ensure it is always an N-tuple (even for the 1-D case).\n        \"\"\"\n\n        nd = model.n_inputs\n\n        if nd == 1:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) not in ((2,), (1, 2))):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"2 consisting of a lower and upper bound, or a 1-tuple \"\n                    \"containing such a sequence as its sole element.\".format(\n                        model.name))\n\n            if len(bounding_box) == 1:\n                return cls((tuple(bounding_box[0]),))\n            else:\n                return cls(tuple(bounding_box))\n        else:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) != (nd, 2)):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"{1} (the number of model inputs) consisting of pairs of \"\n                    \"lower and upper bounds for those inputs on which to \"\n                    \"evaluate the model.\".format(model.name, nd))\n\n            return cls(tuple(bounds) for bounds in bounding_box)"},{"col":4,"comment":"null","endLoc":373,"header":"def __new__(cls, input_, _model=None)","id":9758,"name":"__new__","nodeType":"Function","startLoc":366,"text":"def __new__(cls, input_, _model=None):\n        self = super().__new__(cls, input_)\n        if _model is not None:\n            # Bind this _BoundingBox (most likely a subclass) to a Model\n            # instance so that its __call__ can access the model\n            self._model = _model\n\n        return self"},{"col":4,"comment":"null","endLoc":378,"header":"def __call__(self, *args, **kwargs)","id":9759,"name":"__call__","nodeType":"Function","startLoc":375,"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        Validate a given bounding box sequence against the given model (which\n        may be either a subclass of `~astropy.modeling.Model` or an instance\n        thereof, so long as the ``.inputs`` attribute is defined.\n\n        Currently this just checks that the bounding_box is either a 2-tuple\n        of lower and upper bounds for 1-D models, or an N-tuple of 2-tuples\n        for N-D models.\n\n        This also returns a normalized version of the bounding_box input to\n        ensure it is always an N-tuple (even for the 1-D case).\n        ","endLoc":419,"header":"@classmethod\n    def validate(cls, model, bounding_box)","id":9760,"name":"validate","nodeType":"Function","startLoc":380,"text":"@classmethod\n    def validate(cls, model, bounding_box):\n        \"\"\"\n        Validate a given bounding box sequence against the given model (which\n        may be either a subclass of `~astropy.modeling.Model` or an instance\n        thereof, so long as the ``.inputs`` attribute is defined.\n\n        Currently this just checks that the bounding_box is either a 2-tuple\n        of lower and upper bounds for 1-D models, or an N-tuple of 2-tuples\n        for N-D models.\n\n        This also returns a normalized version of the bounding_box input to\n        ensure it is always an N-tuple (even for the 1-D case).\n        \"\"\"\n\n        nd = model.n_inputs\n\n        if nd == 1:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) not in ((2,), (1, 2))):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"2 consisting of a lower and upper bound, or a 1-tuple \"\n                    \"containing such a sequence as its sole element.\".format(\n                        model.name))\n\n            if len(bounding_box) == 1:\n                return cls((tuple(bounding_box[0]),))\n            else:\n                return cls(tuple(bounding_box))\n        else:\n            if (not isiterable(bounding_box)\n                    or np.shape(bounding_box) != (nd, 2)):\n                raise ValueError(\n                    \"Bounding box for {0} model must be a sequence of length \"\n                    \"{1} (the number of model inputs) consisting of pairs of \"\n                    \"lower and upper bounds for those inputs on which to \"\n                    \"evaluate the model.\".format(model.name, nd))\n\n            return cls(tuple(bounds) for bounds in bounding_box)"},{"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":1195,"header":"def get_constellation(self, short_name=False, constellation_list='iau')","id":9761,"name":"get_constellation","nodeType":"Function","startLoc":1161,"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        return get_constellation(self, short_name, constellation_list)"},{"col":0,"comment":"\n    Determines the constellation(s) a given coordinate object contains.\n\n    Parameters\n    ----------\n    coord : coordinate object\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":281,"header":"def get_constellation(coord, short_name=False, constellation_list='iau')","id":9762,"name":"get_constellation","nodeType":"Function","startLoc":201,"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 object\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    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('Could not find constellation for coordinates {0}'.format(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":0,"comment":"null","endLoc":15,"id":9763,"name":"DEFAULT_MAXITER","nodeType":"Attribute","startLoc":15,"text":"DEFAULT_MAXITER"},{"attributeType":"NDUncertainty","col":16,"comment":"null","endLoc":210,"id":9764,"name":"_uncertainty","nodeType":"Attribute","startLoc":210,"text":"self._uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":190,"id":9765,"name":"_unit","nodeType":"Attribute","startLoc":190,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":182,"id":9766,"name":"_wcs","nodeType":"Attribute","startLoc":182,"text":"self._wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":198,"id":9767,"name":"meta","nodeType":"Attribute","startLoc":198,"text":"self.meta"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":9768,"name":"DEFAULT_EPS","nodeType":"Attribute","startLoc":18,"text":"DEFAULT_EPS"},{"attributeType":"null","col":4,"comment":"null","endLoc":633,"id":9769,"name":"BytesIO","nodeType":"Attribute","startLoc":633,"text":"BytesIO"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":9770,"name":"DEFAULT_ACC","nodeType":"Attribute","startLoc":21,"text":"DEFAULT_ACC"},{"attributeType":"null","col":8,"comment":"null","endLoc":2105,"id":9771,"name":"lr_method","nodeType":"Attribute","startLoc":2105,"text":"self.lr_method"},{"className":"ModelsError","col":0,"comment":"Base class for model exceptions","endLoc":62,"id":9772,"nodeType":"Class","startLoc":61,"text":"class ModelsError(Exception):\n    \"\"\"Base class for model exceptions\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":634,"id":9773,"name":"_assertCountEqual","nodeType":"Attribute","startLoc":634,"text":"_assertCountEqual"},{"className":"ModelLinearityError","col":0,"comment":" Raised when a non-linear model is passed to a linear fitter.","endLoc":66,"id":9774,"nodeType":"Class","startLoc":65,"text":"class ModelLinearityError(ModelsError):\n    \"\"\" Raised when a non-linear model is passed to a linear fitter.\"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":636,"id":9775,"name":"_assertRaisesRegex","nodeType":"Attribute","startLoc":636,"text":"_assertRaisesRegex"},{"attributeType":"null","col":8,"comment":"null","endLoc":637,"id":9776,"name":"_assertRegex","nodeType":"Attribute","startLoc":637,"text":"_assertRegex"},{"attributeType":"null","col":8,"comment":"null","endLoc":639,"id":9777,"name":"_assertRaisesRegex","nodeType":"Attribute","startLoc":639,"text":"_assertRaisesRegex"},{"attributeType":"null","col":8,"comment":"null","endLoc":640,"id":9778,"name":"_assertRegex","nodeType":"Attribute","startLoc":640,"text":"_assertRegex"},{"className":"UnsupportedConstraintError","col":0,"comment":"\n    Raised when a fitter does not support a type of constraint.\n    ","endLoc":72,"id":9779,"nodeType":"Class","startLoc":69,"text":"class UnsupportedConstraintError(ModelsError, ValueError):\n    \"\"\"\n    Raised when a fitter does not support a type of constraint.\n    \"\"\""},{"className":"_FitterMeta","col":0,"comment":"\n    Currently just provides a registry for all Fitter classes.\n    ","endLoc":88,"id":9780,"nodeType":"Class","startLoc":75,"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"},{"col":4,"comment":"null","endLoc":88,"header":"def __new__(mcls, name, bases, members)","id":9781,"name":"__new__","nodeType":"Function","startLoc":82,"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":0,"comment":"Decorator factory which temporarly 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":56,"header":"def _arithmetic(op)","id":9782,"name":"_arithmetic","nodeType":"Function","startLoc":24,"text":"def _arithmetic(op):\n    \"\"\"Decorator factory which temporarly 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__ = (\"See `astropy.nddata.NDArithmeticMixin.{}`.\"\n                         \"\".format(func.__name__))\n        return sharedmethod(inner)\n    return decorator"},{"attributeType":"null","col":4,"comment":"null","endLoc":648,"id":9783,"name":"unichr","nodeType":"Attribute","startLoc":648,"text":"unichr"},{"attributeType":"None","col":4,"comment":"null","endLoc":364,"id":9784,"name":"_model","nodeType":"Attribute","startLoc":364,"text":"_model"},{"attributeType":"NullLogger","col":8,"comment":"null","endLoc":2110,"id":9785,"name":"log","nodeType":"Attribute","startLoc":2110,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":367,"id":9786,"name":"self","nodeType":"Attribute","startLoc":367,"text":"self"},{"attributeType":"null","col":12,"comment":"null","endLoc":371,"id":9787,"name":"_model","nodeType":"Attribute","startLoc":371,"text":"self._model"},{"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":424,"header":"def _generate_wcs_and_update_header(hdr)","id":9788,"name":"_generate_wcs_and_update_header","nodeType":"Function","startLoc":386,"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 informations 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    return (new_hdr, wcs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":9789,"name":"registry","nodeType":"Attribute","startLoc":80,"text":"registry"},{"attributeType":"null","col":8,"comment":"null","endLoc":83,"id":9790,"name":"cls","nodeType":"Attribute","startLoc":83,"text":"cls"},{"attributeType":"null","col":8,"comment":"null","endLoc":2119,"id":9791,"name":"_add_count","nodeType":"Attribute","startLoc":2119,"text":"self._add_count"},{"attributeType":"null","col":4,"comment":"null","endLoc":649,"id":9792,"name":"int2byte","nodeType":"Attribute","startLoc":649,"text":"int2byte"},{"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    ","endLoc":247,"id":9793,"nodeType":"Class","startLoc":183,"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    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    @abc.abstractmethod\n    def __call__(self):\n        \"\"\"\n        This method performs the actual fitting and modifies the parameter list\n        of a model.\n\n        Fitter subclasses should implement this method.\n        \"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this method.\")"},{"col":4,"comment":"null","endLoc":210,"header":"def __init__(self, optimizer, statistic)","id":9794,"name":"__init__","nodeType":"Function","startLoc":195,"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":"null","col":8,"comment":"null","endLoc":2114,"id":9795,"name":"lr_goto","nodeType":"Attribute","startLoc":2114,"text":"self.lr_goto"},{"attributeType":"null","col":8,"comment":"null","endLoc":2113,"id":9796,"name":"lr_action","nodeType":"Attribute","startLoc":2113,"text":"self.lr_action"},{"attributeType":"null","col":8,"comment":"null","endLoc":2117,"id":9797,"name":"lr0_cidhash","nodeType":"Attribute","startLoc":2117,"text":"self.lr0_cidhash"},{"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":446,"header":"def make_binary_operator_eval(oper, f, g)","id":9798,"name":"make_binary_operator_eval","nodeType":"Function","startLoc":422,"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)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":2116,"id":9799,"name":"lr_goto_cache","nodeType":"Attribute","startLoc":2116,"text":"self.lr_goto_cache"},{"attributeType":"null","col":8,"comment":"null","endLoc":2127,"id":9800,"name":"rr_conflicts","nodeType":"Attribute","startLoc":2127,"text":"self.rr_conflicts"},{"attributeType":"null","col":8,"comment":"null","endLoc":2123,"id":9801,"name":"rr_conflict","nodeType":"Attribute","startLoc":2123,"text":"self.rr_conflict"},{"attributeType":"null","col":4,"comment":"null","endLoc":656,"id":9802,"name":"iterbytes","nodeType":"Attribute","startLoc":656,"text":"iterbytes"},{"attributeType":"null","col":8,"comment":"null","endLoc":2122,"id":9803,"name":"sr_conflict","nodeType":"Attribute","startLoc":2122,"text":"self.sr_conflict"},{"attributeType":"{Productions}","col":8,"comment":"null","endLoc":2104,"id":9804,"name":"grammar","nodeType":"Attribute","startLoc":2104,"text":"self.grammar"},{"attributeType":"null","col":8,"comment":"null","endLoc":2115,"id":9805,"name":"lr_productions","nodeType":"Attribute","startLoc":2115,"text":"self.lr_productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":2124,"id":9806,"name":"conflicts","nodeType":"Attribute","startLoc":2124,"text":"self.conflicts"},{"attributeType":"null","col":4,"comment":"null","endLoc":658,"id":9807,"name":"StringIO","nodeType":"Attribute","startLoc":658,"text":"StringIO"},{"attributeType":"null","col":8,"comment":"null","endLoc":2126,"id":9808,"name":"sr_conflicts","nodeType":"Attribute","startLoc":2126,"text":"self.sr_conflicts"},{"className":"ParserReflect","col":0,"comment":"null","endLoc":3204,"id":9809,"nodeType":"Class","startLoc":2926,"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        try:\n            from hashlib import md5\n        except ImportError:\n            from md5 import md5\n        try:\n            sig = md5()\n            if self.start:\n                sig.update(self.start.encode('latin-1'))\n            if self.prec:\n                sig.update(''.join([''.join(p) for p in self.prec]).encode('latin-1'))\n            if self.tokens:\n                sig.update(' '.join(self.tokens).encode('latin-1'))\n            for f in self.pfuncs:\n                if f[3]:\n                    sig.update(f[3].encode('latin-1'))\n        except (TypeError, ValueError):\n            pass\n\n        digest = base64.b16encode(sig.digest())\n        if sys.version_info[0] >= 3:\n            digest = digest.decode('latin-1')\n        return digest\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 = 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":2947,"header":"def get_all(self)","id":9810,"name":"get_all","nodeType":"Function","startLoc":2942,"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()"},{"attributeType":"null","col":15,"comment":"null","endLoc":658,"id":9811,"name":"BytesIO","nodeType":"Attribute","startLoc":658,"text":"BytesIO"},{"attributeType":"null","col":4,"comment":"null","endLoc":659,"id":9812,"name":"_assertCountEqual","nodeType":"Attribute","startLoc":659,"text":"_assertCountEqual"},{"attributeType":"null","col":4,"comment":"null","endLoc":660,"id":9813,"name":"_assertRaisesRegex","nodeType":"Attribute","startLoc":660,"text":"_assertRaisesRegex"},{"attributeType":"null","col":4,"comment":"null","endLoc":661,"id":9814,"name":"_assertRegex","nodeType":"Attribute","startLoc":661,"text":"_assertRegex"},{"attributeType":"null","col":4,"comment":"null","endLoc":679,"id":9815,"name":"exec_","nodeType":"Attribute","startLoc":679,"text":"exec_"},{"col":11,"endLoc":446,"id":9816,"nodeType":"Lambda","startLoc":444,"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    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":512,"header":"def combine_labels(left, right)","id":9817,"name":"combine_labels","nodeType":"Function","startLoc":498,"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":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`\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":576,"header":"def ellipse_extent(a, b, theta)","id":9818,"name":"ellipse_extent","nodeType":"Function","startLoc":515,"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`\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    else:\n        return np.abs([dx, dy])"},{"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":236,"header":"def objective_function(self, fps, *args)","id":9819,"name":"objective_function","nodeType":"Function","startLoc":212,"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":4,"comment":"null","endLoc":3021,"header":"def get_start(self)","id":9820,"name":"get_start","nodeType":"Function","startLoc":3020,"text":"def get_start(self):\n        self.start = self.pdict.get('start')"},{"attributeType":"null","col":12,"comment":"null","endLoc":210,"id":9821,"name":"_stat_method","nodeType":"Attribute","startLoc":210,"text":"self._stat_method"},{"attributeType":"null","col":12,"comment":"null","endLoc":204,"id":9822,"name":"_opt_method","nodeType":"Attribute","startLoc":204,"text":"self._opt_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":721,"id":9823,"name":"print_","nodeType":"Attribute","startLoc":721,"text":"print_"},{"attributeType":"function","col":4,"comment":"null","endLoc":777,"id":9824,"name":"_print","nodeType":"Attribute","startLoc":777,"text":"_print"},{"attributeType":"null","col":4,"comment":"null","endLoc":797,"id":9825,"name":"wraps","nodeType":"Attribute","startLoc":797,"text":"wraps"},{"className":"LinearLSQFitter","col":0,"comment":"\n    A class performing a linear least square fitting.\n\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    ","endLoc":479,"id":9826,"nodeType":"Class","startLoc":253,"text":"class LinearLSQFitter(metaclass=_FitterMeta):\n    \"\"\"\n    A class performing a linear least square fitting.\n\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    \"\"\"\n\n    supported_constraints = ['fixed']\n\n    def __init__(self):\n        self.fit_info = {'residuals': None,\n                         'rank': None,\n                         'singular_values': None,\n                         'params': None\n                         }\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\n            input coordinates\n        z : array (optional)\n            input coordinates\n        weights : array (optional)\n            weights\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 and keyword-only argument\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        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        _validate_constraints(self.supported_constraints, model)\n\n        model_copy = model.copy()\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        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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices,\n                                                   x=x)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                         fixparam_indices,\n                                                         x=x)\n            else:\n                lhs = 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            # 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 = self._deriv_with_constraints(model_copy,\n                                                   fitparam_indices, x=x, y=y)\n                fixderivs = self._deriv_with_constraints(model_copy,\n                                                    fixparam_indices, x=x, y=y)\n            else:\n                lhs = 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                if z.ndim > 2:\n                    # Basically this code here is making the assumption that if\n                    # z has 3 dimensions it represents multiple models where\n                    # the value of z is one plane per model.  It's then\n                    # flattening each plane and transposing so that the model\n                    # axis is *last*.  That's fine, but this could be\n                    # generalized for other dimensionalities of z.\n                    # TODO: See above comment\n                    rhs = np.array([i.flatten() for i in z]).T\n                else:\n                    rhs = z.T\n            else:\n                rhs = z.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        # 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 co-ordinates, 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            weights = np.asarray(weights, dtype=float)\n            if len(x) != len(weights):\n                raise ValueError(\"x and weights should have the same length\")\n            if rhs.ndim == 2:\n                lhs *= weights[:, np.newaxis]\n                # Don't modify in-place in case rhs was the original dependent\n                # variable array\n                rhs = rhs * weights[:, np.newaxis]\n            else:\n                lhs *= weights[:, np.newaxis]\n                rhs = rhs * weights\n\n        if rcond is None:\n            rcond = len(x) * np.finfo(x.dtype).eps\n\n        scl = (lhs * lhs).sum(0)\n        lacoef, resids, rank, sval = np.linalg.lstsq(lhs / scl, rhs, rcond)\n\n        self.fit_info['residuals'] = resids\n        self.fit_info['rank'] = rank\n        self.fit_info['singular_values'] = sval\n\n        lacoef = (lacoef.T / scl).T\n        self.fit_info['params'] = lacoef\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 rank != model_copy._order:\n            warnings.warn(\"The fit may be poorly conditioned\\n\",\n                          AstropyUserWarning)\n\n        _fitter_to_model_params(model_copy, lacoef.flatten())\n        return model_copy"},{"col":4,"comment":"null","endLoc":3031,"header":"def get_error_func(self)","id":9827,"name":"get_error_func","nodeType":"Function","startLoc":3030,"text":"def get_error_func(self):\n        self.error_func = self.pdict.get('p_error')"},{"attributeType":"null","col":4,"comment":"null","endLoc":262,"id":9828,"name":"supported_constraints","nodeType":"Attribute","startLoc":262,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":265,"id":9829,"name":"fit_info","nodeType":"Attribute","startLoc":265,"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 number of iterations ``niter``, outliers are removed\n    and fitting is performed for each iteration.\n\n    Parameters\n    ----------\n    fitter : An Astropy fitter\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter.\n    outlier_func : function\n        A function for outlier removal.\n    niter : int (optional)\n        Number of iterations.\n    outlier_kwargs : dict (optional)\n        Keyword arguments for outlier_func.\n    ","endLoc":571,"id":9830,"nodeType":"Class","startLoc":482,"text":"class FittingWithOutlierRemoval:\n    \"\"\"\n    This class combines an outlier removal technique with a fitting procedure.\n    Basically, given a number of iterations ``niter``, outliers are removed\n    and fitting is performed for each iteration.\n\n    Parameters\n    ----------\n    fitter : An Astropy fitter\n        An instance of any Astropy fitter, i.e., LinearLSQFitter,\n        LevMarLSQFitter, SLSQPLSQFitter, SimplexLSQFitter, JointFitter.\n    outlier_func : function\n        A function for outlier removal.\n    niter : int (optional)\n        Number of iterations.\n    outlier_kwargs : dict (optional)\n        Keyword arguments for outlier_func.\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\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\n        Returns\n        -------\n        filtered_data : numpy.ma.core.MaskedArray\n            Data used to perform the fitting after outlier removal.\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        \"\"\"\n\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        if z is None:\n            filtered_data = y\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        else:\n            filtered_data = z\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x, y),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x, y)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               y[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        return filtered_data, fitted_model"},{"col":4,"comment":"null","endLoc":3073,"header":"def get_tokens(self)","id":9831,"name":"get_tokens","nodeType":"Function","startLoc":3056,"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 = tokens"},{"col":4,"comment":"null","endLoc":505,"header":"def __init__(self, fitter, outlier_func, niter=3, **outlier_kwargs)","id":9832,"name":"__init__","nodeType":"Function","startLoc":501,"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"},{"col":4,"comment":"null","endLoc":512,"header":"def __str__(self)","id":9833,"name":"__str__","nodeType":"Function","startLoc":507,"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":520,"header":"def __repr__(self)","id":9834,"name":"__repr__","nodeType":"Function","startLoc":514,"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\n        Returns\n        -------\n        filtered_data : numpy.ma.core.MaskedArray\n            Data used to perform the fitting after outlier removal.\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        ","endLoc":571,"header":"def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":9835,"name":"__call__","nodeType":"Function","startLoc":522,"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\n        Returns\n        -------\n        filtered_data : numpy.ma.core.MaskedArray\n            Data used to perform the fitting after outlier removal.\n        fitted_model : `~astropy.modeling.FittableModel`\n            Fitted model after outlier removal.\n        \"\"\"\n\n        fitted_model = self.fitter(model, x, y, z, weights=weights, **kwargs)\n        if z is None:\n            filtered_data = y\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        else:\n            filtered_data = z\n            for n in range(self.niter):\n                filtered_data = self.outlier_func(filtered_data - fitted_model(x, y),\n                                                  **self.outlier_kwargs)\n                filtered_data += fitted_model(x, y)\n                fitted_model = self.fitter(fitted_model,\n                               x[~filtered_data.mask],\n                               y[~filtered_data.mask],\n                               filtered_data.data[~filtered_data.mask],\n                               **kwargs)\n        return filtered_data, fitted_model"},{"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":605,"header":"def get_inputs_and_params(func)","id":9836,"name":"get_inputs_and_params","nodeType":"Function","startLoc":579,"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":3091,"header":"def get_precedence(self)","id":9837,"name":"get_precedence","nodeType":"Function","startLoc":3090,"text":"def get_precedence(self):\n        self.prec = self.pdict.get('precedence')"},{"col":4,"comment":"null","endLoc":3143,"header":"def get_pfunctions(self)","id":9838,"name":"get_pfunctions","nodeType":"Function","startLoc":3125,"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"},{"col":0,"comment":"null","endLoc":612,"header":"def _parameter_with_unit(parameter, unit)","id":9839,"name":"_parameter_with_unit","nodeType":"Function","startLoc":608,"text":"def _parameter_with_unit(parameter, unit):\n    if parameter.unit is None:\n        return parameter.value * unit\n    else:\n        return parameter.quantity.to(unit)"},{"col":0,"comment":"null","endLoc":619,"header":"def _parameter_without_unit(value, old_unit, new_unit)","id":9840,"name":"_parameter_without_unit","nodeType":"Function","startLoc":615,"text":"def _parameter_without_unit(value, old_unit, new_unit):\n    if old_unit is None:\n        return value\n    else:\n        return value * old_unit.to(new_unit)"},{"col":0,"comment":" Convert ``value`` to radian. ","endLoc":641,"header":"def _to_radian(value)","id":9841,"name":"_to_radian","nodeType":"Function","startLoc":636,"text":"def _to_radian(value):\n    \"\"\" Convert ``value`` to radian. \"\"\"\n    if isinstance(value, u.Quantity):\n        return value.to(u.rad)\n    else:\n        return np.deg2rad(value)"},{"col":0,"comment":" Convert value with ``raw_unit`` to ``orig_unit``. ","endLoc":649,"header":"def _to_orig_unit(value, raw_unit=None, orig_unit=None)","id":9842,"name":"_to_orig_unit","nodeType":"Function","startLoc":644,"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    else:\n        return np.rad2deg(value)"},{"col":29,"endLoc":3142,"id":9843,"nodeType":"Lambda","startLoc":3138,"text":"lambda p_function: (\n            p_function[0],\n            str(p_function[1]),\n            p_function[2],\n            p_function[3])"},{"col":4,"comment":"null","endLoc":2957,"header":"def validate_all(self)","id":9844,"name":"validate_all","nodeType":"Function","startLoc":2950,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":9845,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"utils.py#<anonymous>","id":9846,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module provides utility functions for the models package\n\"\"\"\n\n__all__ = ['ExpressionTree', 'AliasDict', 'check_broadcast',\n           'poly_map_domain', 'comb', 'ellipse_extent']"},{"col":4,"comment":"null","endLoc":3027,"header":"def validate_start(self)","id":9847,"name":"validate_start","nodeType":"Function","startLoc":3024,"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\")"},{"fileName":"optimizers.py","filePath":"astropy/modeling","id":9848,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nOptimization algorithms used in `~astropy.modeling.fitting`.\n\"\"\"\n\nimport warnings\nimport abc\nimport numpy as np\nfrom ..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 = \"{0}()\".format(self.__class__.__name__)\n        return fmt\n\n    @property\n    def opt_method(self):\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":9849,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":9850,"name":"DEFAULT_BOUNDS","nodeType":"Attribute","startLoc":23,"text":"DEFAULT_BOUNDS"},{"col":0,"comment":"","endLoc":5,"header":"optimizers.py#<anonymous>","id":9851,"name":"<anonymous>","nodeType":"Function","startLoc":3,"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":"functional_models.py","filePath":"astropy/modeling","id":9852,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"Mathematical models.\"\"\"\n\n\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .core import (Fittable1DModel, Fittable2DModel,\n                   ModelDefinitionError)\nfrom .parameters import Parameter, InputParameterError\nfrom .utils import ellipse_extent\nfrom ..stats.funcs import gaussian_sigma_to_fwhm\nfrom .. import units as u\nfrom ..units import Quantity, UnitsError\n\n__all__ = ['AiryDisk2D', 'Moffat1D', 'Moffat2D', 'Box1D', 'Box2D', 'Const1D',\n           'Const2D', 'Ellipse2D', 'Disk2D', 'Gaussian1D',\n           'Gaussian2D', 'Linear1D', 'Lorentz1D',\n           'MexicanHat1D', 'MexicanHat2D', 'RedshiftScaleFactor',\n           'Scale', 'Sersic1D', 'Sersic2D', 'Shift', 'Sine1D', 'Trapezoid1D',\n           'TrapezoidDisk2D', 'Ring2D', 'Voigt1D']\n\nTWOPI = 2 * np.pi\nFLOAT_EPSILON = float(np.finfo(np.float32).tiny)\n\n\nclass Gaussian1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    mean : float\n        Mean of the Gaussian.\n    stddev : float\n        Standard deviation of the Gaussian.\n\n    Notes\n    -----\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)\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    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        else:\n            return {'x': self.mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('mean', inputs_unit['x']),\n                            ('stddev', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n\n\nclass Gaussian2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    x_mean : float\n        Mean of the Gaussian in x.\n    y_mean : float\n        Mean of the Gaussian in y.\n    x_stddev : float 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 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, optional\n        Rotation angle 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    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)\n    x_mean = Parameter(default=0)\n    y_mean = Parameter(default=0)\n    x_stddev = Parameter(default=1)\n    y_stddev = Parameter(default=1)\n    theta = Parameter(default=0.0)\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            else:\n                # Compute principle coordinate system transformation\n                cov_matrix = np.array(cov_matrix)\n\n                if cov_matrix.shape != (2, 2):\n                    # TODO: Maybe it should be possible for the covariance matrix\n                    # to be some (x, y, ..., z, 2, 2) array to be broadcast with\n                    # other parameters of shape (x, y, ..., z)\n                    # But that's maybe a special case to work out if/when needed\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        else:\n            return {'x': self.x_mean.unit,\n                    'y': 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['x'] != inputs_unit['y']:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return OrderedDict([('x_mean', inputs_unit['x']),\n                            ('y_mean', inputs_unit['x']),\n                            ('x_stddev', inputs_unit['x']),\n                            ('y_stddev', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])\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    inputs = ('x',)\n    outputs = ('x',)\n\n    offset = Parameter(default=0)\n    linear = True\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        else:\n            return {'x': self.offset.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n        inv = self.copy()\n        inv.offset *= -1\n        return inv\n\n    @staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        if isinstance(offset, u.Quantity):\n            return_unit = offset.unit\n            offset = offset.value\n        if isinstance(x, u.Quantity):\n            x = x.value\n            return (x + offset) * return_unit\n        else:\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\nclass Scale(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n    \"\"\"\n\n    inputs = ('x',)\n    outputs = ('x',)\n\n    factor = Parameter(default=1)\n    linear = True\n    fittable = True\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        else:\n            return {'x': 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        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            return_unit = factor.unit\n            factor = factor.value\n        if isinstance(x, u.Quantity):\n            return (x.value * factor) * return_unit\n        else:\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\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    @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        return inv\n\n\nclass Sersic1D(Fittable1DModel):\n    r\"\"\"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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)\n    r_eff = Parameter(default=1)\n    n = Parameter(default=4)\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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic1D model requires scipy > 0.11.')\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        else:\n            return {'x': self.r_eff.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('r_eff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n\n\nclass Sine1D(Fittable1DModel):\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    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    amplitude = Parameter(default=1)\n    frequency = Parameter(default=1)\n    phase = Parameter(default=0)\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 input_units(self):\n        if self.frequency.unit is None:\n            return None\n        else:\n            return {'x': 1. / self.frequency.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('frequency', inputs_unit['x'] ** -1),\n                            ('amplitude', outputs_unit['y'])])\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\n    slope = Parameter(default=1)\n    intercept = Parameter(default=0)\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, slope, intercept):\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        else:\n            return {'x': self.intercept.unit / self.slope.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('intercept', outputs_unit['y']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x'])])\n\n\nclass Planar2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the straight line in X\n\n    slope_y : float\n        Slope of the straight line in Y\n\n    intercept : float\n        Z-intercept of the straight line\n\n    See Also\n    --------\n    Linear1D, Polynomial2D\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)\n    slope_y = Parameter(default=1)\n    intercept = Parameter(default=0)\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, slope_x, slope_y, intercept):\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\nclass Lorentz1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Lorentzian model.\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    See Also\n    --------\n    Gaussian1D, Box1D, MexicanHat1D\n\n    Notes\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    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)\n    x_0 = Parameter(default=0)\n    fwhm = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n\n\nclass Voigt1D(Fittable1DModel):\n    \"\"\"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float\n        Position of the peak\n    amplitude_L : float\n        The Lorentzian amplitude\n    fwhm_L : float\n        The Lorentzian full width at half maximum\n    fwhm_G : float\n        The Gaussian full width at half maximum\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Algorithm for the computation taken from\n    McLean, A. B., Mitchell, C. E. J. & Swanston, D. M. Implementation of an\n    efficient analytical approximation to the Voigt function for photoemission\n    lineshape analysis. Journal of Electron Spectroscopy and Related Phenomena\n    69, 125-132 (1994)\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    amplitude_L = Parameter(default=1)\n    fwhm_L = Parameter(default=2/np.pi)\n    fwhm_G = Parameter(default=np.log(2))\n\n    _abcd = np.array([\n        [-1.2150, -1.3509, -1.2150, -1.3509],  # A\n        [1.2359, 0.3786, -1.2359, -0.3786],    # B\n        [-0.3085, 0.5906, -0.3085, 0.5906],    # C\n        [0.0210, -1.1858, -0.0210, 1.1858]])   # D\n\n    @classmethod\n    def evaluate(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[..., np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[..., np.newaxis]\n\n        V = np.sum((C * (Y - A) + D * (X - B))/(((Y - A) ** 2 + (X - B) ** 2)), axis=-1)\n\n        return (fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G) * V\n\n    @classmethod\n    def fit_deriv(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[:, np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[:, np.newaxis]\n        constant = fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G\n\n        alpha = C * (Y - A) + D * (X - B)\n        beta = (Y - A) ** 2 + (X - B) ** 2\n        V = np.sum((alpha / beta), axis=-1)\n        dVdx = np.sum((D/beta - 2 * (X - B) * alpha / np.square(beta)), axis=-1)\n        dVdy = np.sum((C/beta - 2 * (Y - A) * alpha / np.square(beta)), axis=-1)\n\n        dyda = [-constant * dVdx * 2 * sqrt_ln2 / fwhm_G,\n                constant * V / amplitude_L,\n                constant * (V / fwhm_L + dVdy * sqrt_ln2 / fwhm_G),\n                -constant * (V + (sqrt_ln2 / fwhm_G) * (2 * (x - x_0) * dVdx + fwhm_L * dVdy)) / fwhm_G]\n        return dyda\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm_L', inputs_unit['x']),\n                            ('fwhm_G', inputs_unit['x']),\n                            ('amplitude_L', outputs_unit['y'])])\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)\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        else:\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 OrderedDict([('amplitude', outputs_unit['y'])])\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)\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        else:\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 OrderedDict([('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    a = Parameter(default=1)\n    b = Parameter(default=1)\n    theta = Parameter(default=0)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('a', inputs_unit['x']),\n                            ('b', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    R_0 = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    r_in = Parameter(default=1)\n    width = Parameter(default=1)\n\n    def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=r_in.default, width=width.default,\n                 r_out=None, **kwargs):\n        # If outer radius explicitly given, it overrides default width.\n        if r_out is not None:\n            if width != self.width.default:\n                raise InputParameterError(\n                    \"Cannot specify both width and outer radius separately.\")\n            width = r_out - r_in\n        elif width is None:\n            width = self.width.default\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_in', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\n\n\nclass Delta1D(Fittable1DModel):\n    \"\"\"One dimensional Dirac delta function.\"\"\"\n\n    def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")\n\n\nclass Delta2D(Fittable2DModel):\n    \"\"\"Two dimensional Dirac delta function.\"\"\"\n\n    def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")\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)\n    x_0 = Parameter(default=0)\n    width = Parameter(default=1)\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        result = np.select([inside], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        else:\n            return result\n\n    @classmethod\n    def fit_deriv(cls, x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model derivative with respect to parameters\"\"\"\n\n        d_amplitude = cls.evaluate(x, 1, x_0, width)\n        d_x_0 = np.zeros_like(x)\n        d_width = np.zeros_like(x)\n        return [d_amplitude, d_x_0, d_width]\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n\n\nclass Box2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    x_width = Parameter(default=1)\n    y_width = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['y']),\n                            ('x_width', inputs_unit['x']),\n                            ('y_width', inputs_unit['y']),\n                            ('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    width = Parameter(default=1)\n    slope = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    R_0 = Parameter(default=1)\n    slope = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('slope', outputs_unit['z'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\n\n\nclass MexicanHat1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat2D, 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 MexicanHat1D\n\n        plt.figure()\n        s1 = MexicanHat1D()\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)\n    x_0 = Parameter(default=0)\n    sigma = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Mexican Hat 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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n\n\nclass MexicanHat2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional symmetric Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat1D, 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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    sigma = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Mexican Hat 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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    radius = Parameter(default=1)\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            try:\n                from scipy.special import j1, jn_zeros\n                cls._rz = jn_zeros(1, 1)[0] / np.pi\n                cls._j1 = j1\n            except ValueError:\n                raise ImportError('AiryDisk2D model requires scipy > 0.11.')\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('radius', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\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)\n    x_0 = Parameter(default=0)\n    gamma = Parameter(default=1)\n    alpha = Parameter(default=1)\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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * 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        d_A = (1 + (x - x_0) ** 2 / gamma ** 2) ** (-alpha)\n        d_x_0 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * d_A ** alpha))\n        d_gamma = (2 * amplitude * alpha * d_A * (x - x_0) ** 2 /\n                   (gamma ** 3 * d_A ** alpha))\n        d_alpha = -amplitude * d_A * np.log(1 + (x - x_0) ** 2 / gamma ** 2)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    gamma = Parameter(default=1)\n    alpha = Parameter(default=1)\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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * 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 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (-amplitude * alpha * d_A * (-2 * y + 2 * 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 / (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 {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])\n\n\nclass Sersic2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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 (b_n,2n)\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)\n    r_eff = Parameter(default=1)\n    n = Parameter(default=4)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    ellip = Parameter(default=0)\n    theta = Parameter(default=0)\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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic2D model requires scipy > 0.11.')\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_eff', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])\n"},{"col":4,"comment":"null","endLoc":3053,"header":"def validate_error_func(self)","id":9853,"name":"validate_error_func","nodeType":"Function","startLoc":3034,"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":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":1222,"header":"def to_pixel(self, wcs, origin=0, mode='all')","id":9854,"name":"to_pixel","nodeType":"Function","startLoc":1198,"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        return skycoord_to_pixel(self, wcs=wcs, origin=origin, mode=mode)"},{"attributeType":"null","col":8,"comment":"null","endLoc":504,"id":9855,"name":"niter","nodeType":"Attribute","startLoc":504,"text":"self.niter"},{"attributeType":"null","col":8,"comment":"null","endLoc":502,"id":9856,"name":"fitter","nodeType":"Attribute","startLoc":502,"text":"self.fitter"},{"attributeType":"null","col":8,"comment":"null","endLoc":503,"id":9857,"name":"outlier_func","nodeType":"Attribute","startLoc":503,"text":"self.outlier_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":505,"id":9858,"name":"outlier_kwargs","nodeType":"Attribute","startLoc":505,"text":"self.outlier_kwargs"},{"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 `numpy.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 : an instance of this class\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":1253,"header":"@classmethod\n    def from_pixel(cls, xp, yp, wcs, origin=0, mode='all')","id":9859,"name":"from_pixel","nodeType":"Function","startLoc":1224,"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 `numpy.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 : an instance of this class\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        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)"},{"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\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    ","endLoc":760,"id":9860,"nodeType":"Class","startLoc":574,"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\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    supported_constraints = ['fixed', 'tied', 'bounds']\n    \"\"\"\n    The constraint types supported by this fitter type.\n    \"\"\"\n\n    def __init__(self):\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\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        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    @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\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 and keyword-only argument\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        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n\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        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\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\n            if z is None:\n                full_deriv = np.ravel(weights) * np.array(model.fit_deriv(x, *model.parameters))\n            else:\n                full_deriv = (np.ravel(weights) * np.array(model.fit_deriv(x, y, *model.parameters)).T).T\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                full_deriv = np.asarray(full_deriv).T\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                return [np.ravel(_) for _ in np.ravel(weights) * np.array(model.fit_deriv(x, *params))]\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                else:\n                    return [np.ravel(_) for _ in (weights * np.array(model.fit_deriv(x, y, *params)))]"},{"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` with velocity units\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. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n           sc = SkyCoord(1*u.deg, 2*u.deg)\n           vcorr = sc.rv_correction(kind='barycentric', obstime=t, location=loc)\n           rv = rv + vcorr + rv * vcorr / consts.c\n\n        If your target is nearby and/or has finite proper motion you may need to account\n        for terms arising from this. See Wright & Eastmann (2014) for details.\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            sc = SkyCoord(1*u.deg, 2*u.deg)\n            with coord.solar_system_ephemeris.set('jpl'):\n                rv += sc.rv_correction(obstime=t, location=loc)\n\n        ","endLoc":1398,"header":"def radial_velocity_correction(self, kind='barycentric', obstime=None,\n                                   location=None)","id":9861,"name":"radial_velocity_correction","nodeType":"Function","startLoc":1255,"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` with velocity units\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. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n           sc = SkyCoord(1*u.deg, 2*u.deg)\n           vcorr = sc.rv_correction(kind='barycentric', obstime=t, location=loc)\n           rv = rv + vcorr + rv * vcorr / consts.c\n\n        If your target is nearby and/or has finite proper motion you may need to account\n        for terms arising from this. See Wright & Eastmann (2014) for details.\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            sc = SkyCoord(1*u.deg, 2*u.deg)\n            with coord.solar_system_ephemeris.set('jpl'):\n                rv += sc.rv_correction(obstime=t, location=loc)\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel, get_body_barycentric\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        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:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`obstime` argument is passed in and it is '\n                             'inconsistent with the `obstime` frame '\n                             'attribute on the SkyCoord')\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        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = self.icrs.cartesian\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            icrs_cart = self.icrs.cartesian\n            targcart = icrs_cart - 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 + targcart.dot(beta_obs)) / (1 + gr/speed_of_light) - 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":4,"comment":"null","endLoc":616,"header":"def __init__(self)","id":9862,"name":"__init__","nodeType":"Function","startLoc":605,"text":"def __init__(self):\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\n        super().__init__()"},{"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        ","endLoc":637,"header":"def objective_function(self, fps, *args)","id":9863,"name":"objective_function","nodeType":"Function","startLoc":618,"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        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))"},{"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\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 and keyword-only argument\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        ","endLoc":714,"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":9864,"name":"__call__","nodeType":"Function","startLoc":639,"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\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 and keyword-only argument\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        from scipy import optimize\n\n        model_copy = _validate_model(model, self.supported_constraints)\n        farg = (model_copy, weights, ) + _convert_input(x, y, z)\n\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        return model_copy"},{"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\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    The velocity cannot be calculated for the Moon.  To just get the position,\n    use :func:`~astropy.coordinates.get_body_barycentric`.\n\n    ","endLoc":330,"header":"def get_body_barycentric_posvel(body, time, ephemeris=None)","id":9865,"name":"get_body_barycentric_posvel","nodeType":"Function","startLoc":298,"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 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\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    The velocity cannot be calculated for the Moon.  To just get the position,\n    use :func:`~astropy.coordinates.get_body_barycentric`.\n\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris)"},{"col":0,"comment":"\n    Check that model and fitter are compatible and return a copy of the model.\n    ","endLoc":1218,"header":"def _validate_model(model, supported_constraints)","id":9866,"name":"_validate_model","nodeType":"Function","startLoc":1200,"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"},{"col":4,"comment":"null","endLoc":3087,"header":"def validate_tokens(self)","id":9867,"name":"validate_tokens","nodeType":"Function","startLoc":3076,"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":"\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, if they are also\n        followed by a non-alphanumeric character. It will also match columns\n        that *end* with the component name if a non-alphanumeric character is\n        *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\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 : same as this class\n            The new `SkyCoord` (or subclass) object.\n        ","endLoc":1474,"header":"@classmethod\n    def guess_from_table(cls, table, **coord_kwargs)","id":9868,"name":"guess_from_table","nodeType":"Function","startLoc":1401,"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, if they are also\n        followed by a non-alphanumeric character. It will also match columns\n        that *end* with the component name if a non-alphanumeric character is\n        *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\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 : same as this class\n            The new `SkyCoord` (or subclass) object.\n        \"\"\"\n        inital_frame = coord_kwargs.get('frame')\n        frame = _get_frame([], coord_kwargs)\n        coord_kwargs['frame'] = inital_frame\n\n        comp_kwargs = {}\n        for comp_name in frame.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('(' + starts_with_comp + ')|(' + ends_with_comp + ')',\n                             re.IGNORECASE | re.UNICODE)\n\n            for col_name in table.colnames:\n                if rex.match(col_name):\n                    if comp_name in comp_kwargs:\n                        oldname = comp_kwargs[comp_name].name\n                        msg = ('Found at least two matches for  component \"{0}\"'\n                               ': \"{1}\" and \"{2}\". Cannot continue with this '\n                               'ambiguity.')\n                        raise ValueError(msg.format(comp_name, oldname, col_name))\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 \"{0}\" in table, but it was '\n                                 'already provided as \"{1}\" keyword to '\n                                 'guess_from_table function.'.format(v.name, k))\n            else:\n                coord_kwargs[k] = v\n\n        return cls(**coord_kwargs)"},{"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, optional\n        FITS extension from which CCDData should be initialized. If zero and\n        and no data in the primary extension, it will search for the first\n        extension with data. The header will be added to the primary header.\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    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":533,"header":"def fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT',\n                        hdu_mask='MASK', hdu_flags=None, **kwd)","id":9869,"name":"fits_ccddata_reader","nodeType":"Function","startLoc":427,"text":"def fits_ccddata_reader(filename, hdu=0, unit=None, hdu_uncertainty='UNCERT',\n                        hdu_mask='MASK', hdu_flags=None, **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, optional\n        FITS extension from which CCDData should be initialized. If zero and\n        and no data in the primary extension, it will search for the first\n        extension with data. The header will be added to the primary header.\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    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 = 'unsupported keyword: {0}.'.format(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            uncertainty = StdDevUncertainty(hdus[hdu_uncertainty].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.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(\"first HDU with data is extension \"\n                             \"{0}.\".format(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 unit is not None and fits_unit_string:\n            log.info(\"using the unit {0} passed to the FITS reader instead of \"\n                     \"the unit {1} in the FITS file.\".format(unit,\n                                                             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":"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":2097,"id":9870,"nodeType":"Class","startLoc":2087,"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 = ('x',)\n    outputs = ('y',)\n    _separable = True"},{"attributeType":"null","col":4,"comment":"null","endLoc":2095,"id":9871,"name":"inputs","nodeType":"Attribute","startLoc":2095,"text":"inputs"},{"col":4,"comment":"null","endLoc":3122,"header":"def validate_precedence(self)","id":9872,"name":"validate_precedence","nodeType":"Function","startLoc":3094,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":2096,"id":9873,"name":"outputs","nodeType":"Attribute","startLoc":2096,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2097,"id":9874,"name":"_separable","nodeType":"Attribute","startLoc":2097,"text":"_separable"},{"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":2109,"id":9875,"nodeType":"Class","startLoc":2100,"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    inputs = ('x', 'y')\n    outputs = ('z',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2108,"id":9876,"name":"inputs","nodeType":"Attribute","startLoc":2108,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":2109,"id":9877,"name":"outputs","nodeType":"Attribute","startLoc":2109,"text":"outputs"},{"className":"Parameter","col":0,"comment":"\n    Wraps individual parameters.\n\n    This class represents a model's parameter (in a somewhat broad sense).  It\n    acts as both a descriptor that can be assigned to a class attribute to\n    describe the parameters accepted by an individual model (this is called an\n    \"unbound parameter\"), or it can act as a proxy for the parameter values on\n    an individual model instance (called a \"bound parameter\").\n\n    Parameter instances never store the actual value of the parameter directly.\n    Rather, each instance of a model stores its own parameters parameter values\n    in an array.  A *bound* Parameter simply wraps the value in a Parameter\n    proxy which provides some additional information about the parameter such\n    as its constraints.  In other words, this is a high-level interface to a\n    model's adjustable parameter values.\n\n    *Unbound* Parameters are not associated with any specific model instance,\n    and are merely used by model classes to determine the names of their\n    parameters and other information about each parameter such as their default\n    values and default constraints.\n\n    See :ref:`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    model : `Model` instance\n        binds the the `Parameter` instance to a specific model upon\n        instantiation; this should only be used internally for creating bound\n        Parameters, and should not be used for `Parameter` descriptors defined\n        as class attributes\n    ","endLoc":899,"id":9878,"nodeType":"Class","startLoc":131,"text":"class Parameter(OrderedDescriptor):\n    \"\"\"\n    Wraps individual parameters.\n\n    This class represents a model's parameter (in a somewhat broad sense).  It\n    acts as both a descriptor that can be assigned to a class attribute to\n    describe the parameters accepted by an individual model (this is called an\n    \"unbound parameter\"), or it can act as a proxy for the parameter values on\n    an individual model instance (called a \"bound parameter\").\n\n    Parameter instances never store the actual value of the parameter directly.\n    Rather, each instance of a model stores its own parameters parameter values\n    in an array.  A *bound* Parameter simply wraps the value in a Parameter\n    proxy which provides some additional information about the parameter such\n    as its constraints.  In other words, this is a high-level interface to a\n    model's adjustable parameter values.\n\n    *Unbound* Parameters are not associated with any specific model instance,\n    and are merely used by model classes to determine the names of their\n    parameters and other information about each parameter such as their default\n    values and default constraints.\n\n    See :ref:`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    model : `Model` instance\n        binds the the `Parameter` instance to a specific model upon\n        instantiation; this should only be used internally for creating bound\n        Parameters, and should not be used for `Parameter` descriptors defined\n        as class attributes\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).\n    \"\"\"\n\n    # Settings for OrderedDescriptor\n    _class_attribute_ = '_parameters_'\n    _name_attribute_ = '_name'\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, model=None):\n        super().__init__()\n\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 model is None and 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\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\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                    'or max when instantiating Parameter {0}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n\n        self._order = None\n        self._model = None\n\n        # The getter/setter functions take one or two arguments: The first\n        # argument is always the value itself (either the value returned or the\n        # value being set).  The second argument is optional, but if present\n        # will contain a reference to the model object tied to a parameter (if\n        # it exists)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._setter = self._create_value_wrapper(setter, None)\n\n        self._validator = None\n\n        # Only Parameters declared as class-level descriptors require\n        # and ordering ID\n        if model is not None:\n            self._bind(model)\n\n    def __get__(self, obj, objtype):\n        if obj is None:\n            return self\n\n        # All of the Parameter.__init__ work should already have been done for\n        # the class-level descriptor; we can skip that stuff and just copy the\n        # existing __dict__ and then bind to the model instance\n        parameter = self.__class__.__new__(self.__class__)\n        parameter.__dict__.update(self.__dict__)\n        parameter._bind(obj)\n        return parameter\n\n    def __set__(self, obj, value):\n\n        value = _tofloat(value)\n\n        # Check that units are compatible with default or units already set\n        param_unit = obj._param_metrics[self.name]['orig_unit']\n        if param_unit is None:\n            if isinstance(value, Quantity):\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n        else:\n            if not isinstance(value, Quantity):\n                raise UnitsError(\"The '{0}' parameter should be given as a \"\n                                 \"Quantity because it was originally initialized \"\n                                 \"as a Quantity\".format(self._name))\n            else:\n                # We need to make sure we update the unit because the units are\n                # then dropped from the value below.\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n\n        # Call the validator before the setter\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        if self._setter is not None:\n            setter = self._create_value_wrapper(self._setter, obj)\n            if self.unit is not None:\n                value = setter(value * self.unit).value\n            else:\n                value = setter(value)\n        self._set_model_value(obj, value)\n\n    def __len__(self):\n        if self._model is None:\n            raise TypeError('Parameter definitions do not have a length.')\n        return len(self._model)\n\n    def __getitem__(self, key):\n        value = self.value\n        if len(self._model) == 1:\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        n_models = len(self._model)\n\n        # if n_models == 1:\n        #    # Convert the single-dimension value to a list to allow some slices\n        #    # that would be compatible with a length-1 array like [:] and [0:]\n        #    oldvalue = [oldvalue]\n\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{0}'\".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 {0} invalid for {1!r} parameter with \"\n                    \"dimension {2}\".format(key, self.name, n_models))\n\n    def __repr__(self):\n        args = \"'{0}'\".format(self._name)\n        if self._model is None:\n            if self._default is not None:\n                args += ', default={0}'.format(self._default)\n        else:\n            args += ', value={0}'.format(self.value)\n\n        if self.unit is not None:\n            args += ', unit={0}'.format(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 += ', {0}={1}'.format(cons, val)\n\n        return \"{0}({1})\".format(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\n        if (self._model is None or self._default is None or\n                len(self._model) == 1):\n            return self._default\n\n        # Otherwise the model we are providing for has more than one parameter\n        # sets, so ensure that the default is repeated the correct number of\n        # times along the model_set_axis if necessary\n        n_models = len(self._model)\n        model_set_axis = self._model._model_set_axis\n        default = self._default\n        new_shape = (np.shape(default) +\n                     (1,) * (model_set_axis + 1 - np.ndim(default)))\n        default = np.reshape(default, new_shape)\n        # Now roll the new axis into its correct position if necessary\n        default = np.rollaxis(default, -1, model_set_axis)\n        # Finally repeat the last newly-added axis to match n_models\n        default = np.repeat(default, n_models, axis=-1)\n\n        # NOTE: Regardless of what order the last two steps are performed in,\n        # the resulting array will *look* the same, but only if the repeat is\n        # performed last will it result in a *contiguous* array\n\n        return default\n\n    @property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a value')\n\n        value = self._get_model_value(self._model)\n        if self._getter is None:\n            return value\n        else:\n            raw_unit = self._model._param_metrics[self.name]['raw_unit']\n            orig_unit = self._model._param_metrics[self.name]['orig_unit']\n            if raw_unit is not None:\n                return np.float64(self._getter(value, raw_unit, orig_unit).value)\n            else:\n                return self._getter(value)\n\n    @value.setter\n    def value(self, value):\n        if self._model is None:\n            raise AttributeError('Cannot set a value on a parameter '\n                                 'definition')\n\n        if self._setter is not None:\n            val = self._setter(value)\n\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set to \"\n                            \"unitless values, not Quantity objects. To set a \"\n                            \"parameter to a quantity simply set the parameter \"\n                            \"directly without using .value\")\n        self._set_model_value(self._model, value)\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        if self._model is None:\n            return self._unit\n        else:\n            # orig_unit may be undefined early on in model instantiation\n            return self._model._param_metrics[self.name].get('orig_unit',\n                                                             self._unit)\n\n    @unit.setter\n    def unit(self, unit):\n        self._set_unit(unit)\n\n    def _set_unit(self, unit, force=False):\n\n        if self._model is None:\n            raise AttributeError('Cannot set unit on a parameter definition')\n\n        orig_unit = self._model._param_metrics[self.name]['orig_unit']\n\n        if force:\n            self._model._param_metrics[self.name]['orig_unit'] = unit\n        else:\n            if orig_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    @property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is not None:\n            return self.value * self.unit\n        else:\n            return None\n\n    @quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set to a Quantity object\")\n        self.value = quantity.value\n        self._set_unit(quantity.unit, force=True)\n\n    @property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a '\n                                 'shape.')\n\n        shape = self._model._param_metrics[self._name]['shape']\n\n        if len(self._model) > 1:\n            # If we are dealing with a model *set* the shape is the shape of\n            # the parameter within a single model in the set\n            model_axis = self._model._model_set_axis\n\n            if model_axis < 0:\n                model_axis = len(shape) + model_axis\n\n            shape = shape[:model_axis] + shape[model_axis + 1:]\n\n        return shape\n\n    @property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        # TODO: Rather than using self.value this could be determined from the\n        # size of the parameter in _param_metrics\n\n        return np.size(self.value)\n\n    @property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n\n        if self._model is not None:\n            fixed = self._model._constraints['fixed']\n            return fixed.get(self._name, self._fixed)\n        else:\n            return self._fixed\n\n    @fixed.setter\n    def fixed(self, value):\n        \"\"\"Fix a parameter\"\"\"\n        if self._model is not None:\n            if not isinstance(value, bool):\n                raise TypeError(\"Fixed can be True or False\")\n            self._model._constraints['fixed'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'fixed' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            tied = self._model._constraints['tied']\n            return tied.get(self._name, self._tied)\n        else:\n            return self._tied\n\n    @tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if self._model is not None:\n            if not callable(value) and value not in (False, None):\n                raise TypeError(\"Tied must be a callable\")\n            self._model._constraints['tied'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'tied' on Parameter \"\n                                 \"definition\")\n\n    @property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        if self._model is not None:\n            bounds = self._model._constraints['bounds']\n            return bounds.get(self._name, self._bounds)\n        else:\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        if self._model is not None:\n            _min, _max = value\n            if _min is not None:\n                if not isinstance(_min, numbers.Number):\n                    raise TypeError(\"Min value must be a number\")\n                _min = float(_min)\n\n            if _max is not None:\n                if not isinstance(_max, numbers.Number):\n                    raise TypeError(\"Max value must be a number\")\n                _max = float(_max)\n\n            bounds = self._model._constraints.setdefault('bounds', {})\n            self._model._constraints['bounds'][self._name] = (_min, _max)\n        else:\n            raise AttributeError(\"can't set attribute 'bounds' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            self.bounds = (value, self.max)\n        else:\n            raise AttributeError(\"can't set attribute 'min' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            self.bounds = (self.min, value)\n        else:\n            raise AttributeError(\"can't set attribute 'max' on Parameter \"\n                                 \"definition\")\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        The decorator *returns* the `Parameter` instance that the validator\n        is set on, so the underlying validator method should have the same\n        name as the `Parameter` itself (think of this as analogous to\n        ``property.setter``).  For example::\n\n            >>> from astropy.modeling import Fittable1DModel\n            >>> class TestModel(Fittable1DModel):\n            ...     a = Parameter()\n            ...     b = Parameter()\n            ...\n            ...     @a.validator\n            ...     def a(self, value):\n            ...         # Remember, the value can be an array\n            ...         if np.any(value < self.b):\n            ...             raise InputParameterError(\n            ...                 \"parameter 'a' must be greater than or equal \"\n            ...                 \"to parameter 'b'\")\n            ...\n            ...     @staticmethod\n            ...     def evaluate(x, a, b):\n            ...         return a * x + b\n            ...\n            >>> m = TestModel(a=1, b=2)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n            >>> m = TestModel(a=2, b=2)\n            >>> m.a = 0  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n\n        On bound parameters this property returns the validator method itself,\n        as a bound method on the `Parameter`.  This is not often as useful, but\n        it allows validating a parameter value without setting that parameter::\n\n            >>> m.a.validator(42)  # Passes\n            >>> m.a.validator(-42)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n        \"\"\"\n\n        if self._model is None:\n            # For unbound parameters return the validator setter\n            def validator(func, self=self):\n                self._validator = func\n                return self\n\n            return validator\n        else:\n            # Return the validator method, bound to the Parameter instance with\n            # the name \"validator\"\n            def validator(self, value):\n                if self._validator is not None:\n                    return self._validator(self._model, value)\n\n            return types.MethodType(validator, self)\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):\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 _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\n        return self._get_model_value(self._model)\n\n    def _bind(self, model):\n        \"\"\"\n        Bind the `Parameter` to a specific `Model` instance; don't use this\n        directly on *unbound* parameters, i.e. `Parameter` descriptors that\n        are defined in class bodies.\n        \"\"\"\n\n        self._model = model\n        self._getter = self._create_value_wrapper(self._getter, model)\n        self._setter = self._create_value_wrapper(self._setter, model)\n\n    # TODO: These methods should probably be moved to the Model class, since it\n    # has entirely to do with details of how the model stores parameters.\n    # Parameter should just act as a user front-end to this.\n    def _get_model_value(self, model):\n        \"\"\"\n        This method implements how to retrieve the value of this parameter from\n        the model instance.  See also `Parameter._set_model_value`.\n\n        These methods take an explicit model argument rather than using\n        self._model so that they can be used from unbound `Parameter`\n        instances.\n        \"\"\"\n\n        if not hasattr(model, '_parameters'):\n            # The _parameters array hasn't been initialized yet; just translate\n            # this to an AttributeError\n            raise AttributeError(self._name)\n\n        # Use the _param_metrics to extract the parameter value from the\n        # _parameters array\n        param_metrics = model._param_metrics[self._name]\n        param_slice = param_metrics['slice']\n        param_shape = param_metrics['shape']\n        value = model._parameters[param_slice]\n        if param_shape:\n            value = value.reshape(param_shape)\n        else:\n            value = value[0]\n\n        return value\n\n    def _set_model_value(self, model, value):\n        \"\"\"\n        This method implements how to store the value of a parameter on the\n        model instance.\n\n        Currently there is only one storage mechanism (via the ._parameters\n        array) but other mechanisms may be desireable, in which case really the\n        model class itself should dictate this and *not* `Parameter` itself.\n        \"\"\"\n        def _update_parameter_value(model, name, value):\n            # TODO: Maybe handle exception on invalid input shape\n            param_metrics = model._param_metrics[name]\n            param_slice = param_metrics['slice']\n            param_shape = param_metrics['shape']\n            param_size = np.prod(param_shape)\n\n            if np.size(value) != param_size:\n                raise InputParameterError(\n                    \"Input value for parameter {0!r} does not have {1} elements \"\n                    \"as the current value does\".format(name, param_size))\n\n            model._parameters[param_slice] = np.array(value).ravel()\n        _update_parameter_value(model, self._name, value)\n        if hasattr(model, \"_param_map\"):\n            submodel_ind, param_name = model._param_map[self._name]\n            if hasattr(model._submodels[submodel_ind], \"_param_metrics\"):\n                _update_parameter_value(model._submodels[submodel_ind], param_name, value)\n\n    @staticmethod\n    def _create_value_wrapper(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\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, params = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\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        if self._model is None:\n            return True\n        else:\n            return bool(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    __div__ = _binary_arithmetic_operation(operator.truediv)\n    __rdiv__ = _binary_arithmetic_operation(operator.truediv, reflected=True)\n    __truediv__ = _binary_arithmetic_operation(operator.truediv)\n    __rtruediv__ = _binary_arithmetic_operation(operator.truediv, 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":264,"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, model=None)","id":9879,"name":"__init__","nodeType":"Function","startLoc":212,"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, model=None):\n        super().__init__()\n\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 model is None and 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\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\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                    'or max when instantiating Parameter {0}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n\n        self._order = None\n        self._model = None\n\n        # The getter/setter functions take one or two arguments: The first\n        # argument is always the value itself (either the value returned or the\n        # value being set).  The second argument is optional, but if present\n        # will contain a reference to the model object tied to a parameter (if\n        # it exists)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._setter = self._create_value_wrapper(setter, None)\n\n        self._validator = None\n\n        # Only Parameters declared as class-level descriptors require\n        # and ordering ID\n        if model is not None:\n            self._bind(model)"},{"col":4,"comment":"\n        Wraps the method calculating the Jacobian of the function to account\n        for model constraints.\n\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":760,"header":"@staticmethod\n    def _wrap_deriv(params, model, weights, x, y, z=None)","id":9880,"name":"_wrap_deriv","nodeType":"Function","startLoc":716,"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\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\n            if z is None:\n                full_deriv = np.ravel(weights) * np.array(model.fit_deriv(x, *model.parameters))\n            else:\n                full_deriv = (np.ravel(weights) * np.array(model.fit_deriv(x, y, *model.parameters)).T).T\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                full_deriv = np.asarray(full_deriv).T\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                return [np.ravel(_) for _ in np.ravel(weights) * np.array(model.fit_deriv(x, *params))]\n            else:\n                if not model.col_fit_deriv:\n                    return [np.ravel(_) for _ in (np.ravel(weights) * np.array(model.fit_deriv(x, y, *params)).T).T]\n                else:\n                    return [np.ravel(_) for _ in (weights * np.array(model.fit_deriv(x, y, *params)))]"},{"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\n        Returns\n        -------\n        coord : SkyCoord\n            Instance of the SkyCoord class.\n        ","endLoc":1507,"header":"@classmethod\n    def from_name(cls, name, frame='icrs')","id":9881,"name":"from_name","nodeType":"Function","startLoc":1477,"text":"@classmethod\n    def from_name(cls, name, frame='icrs'):\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\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)\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":"\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\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    ","endLoc":173,"header":"def get_icrs_coordinates(name)","id":9882,"name":"get_icrs_coordinates","nodeType":"Function","startLoc":89,"text":"def get_icrs_coordinates(name):\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\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    \"\"\"\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            # Retrieve ascii name resolve data from CDS\n            resp = urllib.request.urlopen(url, timeout=data.conf.remote_timeout)\n            resp_data = resp.read()\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            exceptions.append(e)\n            continue\n\n    # All Sesame URL's failed...\n    else:\n        messages = [\"{url}: {e.reason}\".format(url=url, e=e)\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                               \"below: \\n {}\".format(\"\\n\".join(messages)))\n\n    ra, dec = _parse_response(resp_data)\n\n    if ra is None and dec is None:\n        if db == \"A\":\n            err = \"Unable to find coordinates for name '{0}'\".format(name)\n        else:\n            err = \"Unable to find coordinates for name '{0}' in database {1}\"\\\n                  .format(name, database)\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"},{"col":4,"comment":"null","endLoc":3204,"header":"def validate_pfunctions(self)","id":9883,"name":"validate_pfunctions","nodeType":"Function","startLoc":3146,"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"},{"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\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":863,"header":"@staticmethod\n    def _create_value_wrapper(wrapper, model)","id":9884,"name":"_create_value_wrapper","nodeType":"Function","startLoc":829,"text":"@staticmethod\n    def _create_value_wrapper(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\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, params = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\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":4,"comment":"\n        Bind the `Parameter` to a specific `Model` instance; don't use this\n        directly on *unbound* parameters, i.e. `Parameter` descriptors that\n        are defined in class bodies.\n        ","endLoc":768,"header":"def _bind(self, model)","id":9885,"name":"_bind","nodeType":"Function","startLoc":759,"text":"def _bind(self, model):\n        \"\"\"\n        Bind the `Parameter` to a specific `Model` instance; don't use this\n        directly on *unbound* parameters, i.e. `Parameter` descriptors that\n        are defined in class bodies.\n        \"\"\"\n\n        self._model = model\n        self._getter = self._create_value_wrapper(self._getter, model)\n        self._setter = self._create_value_wrapper(self._setter, model)"},{"attributeType":"null","col":0,"comment":"null","endLoc":849,"id":9886,"name":"__path__","nodeType":"Attribute","startLoc":849,"text":"__path__"},{"attributeType":"null","col":0,"comment":"null","endLoc":850,"id":9887,"name":"__package__","nodeType":"Attribute","startLoc":850,"text":"__package__"},{"attributeType":"null","col":4,"comment":"null","endLoc":852,"id":9888,"name":"submodule_search_locations","nodeType":"Attribute","startLoc":852,"text":"__spec__.submodule_search_locations"},{"attributeType":"null","col":8,"comment":"null","endLoc":857,"id":9889,"name":"i","nodeType":"Attribute","startLoc":857,"text":"i"},{"attributeType":"null","col":11,"comment":"null","endLoc":857,"id":9890,"name":"importer","nodeType":"Attribute","startLoc":857,"text":"importer"},{"col":0,"comment":"","endLoc":1,"header":"six.py#<anonymous>","id":9891,"name":"<anonymous>","nodeType":"Function","startLoc":1,"text":"\"\"\"Utilities for writing code that runs on Python 2 and 3\"\"\"\n\n__author__ = \"Benjamin Peterson <benjamin@python.org>\"\n\n__version__ = \"1.10.0\"\n\nPY2 = sys.version_info[0] == 2\n\nPY3 = sys.version_info[0] == 3\n\nPY34 = sys.version_info[0:2] >= (3, 4)\n\nif PY3:\n    string_types = str,\n    integer_types = int,\n    class_types = type,\n    text_type = str\n    binary_type = bytes\n\n    MAXSIZE = sys.maxsize\nelse:\n    string_types = basestring,\n    integer_types = (int, long)\n    class_types = (type, types.ClassType)\n    text_type = unicode\n    binary_type = str\n\n    if sys.platform.startswith(\"java\"):\n        # Jython always uses 32 bits.\n        MAXSIZE = int((1 << 31) - 1)\n    else:\n        # It's possible to have sizeof(long) != sizeof(Py_ssize_t).\n        class X(object):\n\n            def __len__(self):\n                return 1 << 31\n        try:\n            len(X())\n        except OverflowError:\n            # 32-bit\n            MAXSIZE = int((1 << 31) - 1)\n        else:\n            # 64-bit\n            MAXSIZE = int((1 << 63) - 1)\n        del X\n\n_importer = _SixMetaPathImporter(__name__)\n\n_moved_attributes = [\n    MovedAttribute(\"cStringIO\", \"cStringIO\", \"io\", \"StringIO\"),\n    MovedAttribute(\"filter\", \"itertools\", \"builtins\", \"ifilter\", \"filter\"),\n    MovedAttribute(\"filterfalse\", \"itertools\", \"itertools\", \"ifilterfalse\", \"filterfalse\"),\n    MovedAttribute(\"input\", \"__builtin__\", \"builtins\", \"raw_input\", \"input\"),\n    MovedAttribute(\"intern\", \"__builtin__\", \"sys\"),\n    MovedAttribute(\"map\", \"itertools\", \"builtins\", \"imap\", \"map\"),\n    MovedAttribute(\"getcwd\", \"os\", \"os\", \"getcwdu\", \"getcwd\"),\n    MovedAttribute(\"getcwdb\", \"os\", \"os\", \"getcwd\", \"getcwdb\"),\n    MovedAttribute(\"range\", \"__builtin__\", \"builtins\", \"xrange\", \"range\"),\n    MovedAttribute(\"reload_module\", \"__builtin__\", \"importlib\" if PY34 else \"imp\", \"reload\"),\n    MovedAttribute(\"reduce\", \"__builtin__\", \"functools\"),\n    MovedAttribute(\"shlex_quote\", \"pipes\", \"shlex\", \"quote\"),\n    MovedAttribute(\"StringIO\", \"StringIO\", \"io\"),\n    MovedAttribute(\"UserDict\", \"UserDict\", \"collections\"),\n    MovedAttribute(\"UserList\", \"UserList\", \"collections\"),\n    MovedAttribute(\"UserString\", \"UserString\", \"collections\"),\n    MovedAttribute(\"xrange\", \"__builtin__\", \"builtins\", \"xrange\", \"range\"),\n    MovedAttribute(\"zip\", \"itertools\", \"builtins\", \"izip\", \"zip\"),\n    MovedAttribute(\"zip_longest\", \"itertools\", \"itertools\", \"izip_longest\", \"zip_longest\"),\n    MovedModule(\"builtins\", \"__builtin__\"),\n    MovedModule(\"configparser\", \"ConfigParser\"),\n    MovedModule(\"copyreg\", \"copy_reg\"),\n    MovedModule(\"dbm_gnu\", \"gdbm\", \"dbm.gnu\"),\n    MovedModule(\"_dummy_thread\", \"dummy_thread\", \"_dummy_thread\"),\n    MovedModule(\"http_cookiejar\", \"cookielib\", \"http.cookiejar\"),\n    MovedModule(\"http_cookies\", \"Cookie\", \"http.cookies\"),\n    MovedModule(\"html_entities\", \"htmlentitydefs\", \"html.entities\"),\n    MovedModule(\"html_parser\", \"HTMLParser\", \"html.parser\"),\n    MovedModule(\"http_client\", \"httplib\", \"http.client\"),\n    MovedModule(\"email_mime_multipart\", \"email.MIMEMultipart\", \"email.mime.multipart\"),\n    MovedModule(\"email_mime_nonmultipart\", \"email.MIMENonMultipart\", \"email.mime.nonmultipart\"),\n    MovedModule(\"email_mime_text\", \"email.MIMEText\", \"email.mime.text\"),\n    MovedModule(\"email_mime_base\", \"email.MIMEBase\", \"email.mime.base\"),\n    MovedModule(\"BaseHTTPServer\", \"BaseHTTPServer\", \"http.server\"),\n    MovedModule(\"CGIHTTPServer\", \"CGIHTTPServer\", \"http.server\"),\n    MovedModule(\"SimpleHTTPServer\", \"SimpleHTTPServer\", \"http.server\"),\n    MovedModule(\"cPickle\", \"cPickle\", \"pickle\"),\n    MovedModule(\"queue\", \"Queue\"),\n    MovedModule(\"reprlib\", \"repr\"),\n    MovedModule(\"socketserver\", \"SocketServer\"),\n    MovedModule(\"_thread\", \"thread\", \"_thread\"),\n    MovedModule(\"tkinter\", \"Tkinter\"),\n    MovedModule(\"tkinter_dialog\", \"Dialog\", \"tkinter.dialog\"),\n    MovedModule(\"tkinter_filedialog\", \"FileDialog\", \"tkinter.filedialog\"),\n    MovedModule(\"tkinter_scrolledtext\", \"ScrolledText\", \"tkinter.scrolledtext\"),\n    MovedModule(\"tkinter_simpledialog\", \"SimpleDialog\", \"tkinter.simpledialog\"),\n    MovedModule(\"tkinter_tix\", \"Tix\", \"tkinter.tix\"),\n    MovedModule(\"tkinter_ttk\", \"ttk\", \"tkinter.ttk\"),\n    MovedModule(\"tkinter_constants\", \"Tkconstants\", \"tkinter.constants\"),\n    MovedModule(\"tkinter_dnd\", \"Tkdnd\", \"tkinter.dnd\"),\n    MovedModule(\"tkinter_colorchooser\", \"tkColorChooser\",\n                \"tkinter.colorchooser\"),\n    MovedModule(\"tkinter_commondialog\", \"tkCommonDialog\",\n                \"tkinter.commondialog\"),\n    MovedModule(\"tkinter_tkfiledialog\", \"tkFileDialog\", \"tkinter.filedialog\"),\n    MovedModule(\"tkinter_font\", \"tkFont\", \"tkinter.font\"),\n    MovedModule(\"tkinter_messagebox\", \"tkMessageBox\", \"tkinter.messagebox\"),\n    MovedModule(\"tkinter_tksimpledialog\", \"tkSimpleDialog\",\n                \"tkinter.simpledialog\"),\n    MovedModule(\"urllib_parse\", __name__ + \".moves.urllib_parse\", \"urllib.parse\"),\n    MovedModule(\"urllib_error\", __name__ + \".moves.urllib_error\", \"urllib.error\"),\n    MovedModule(\"urllib\", __name__ + \".moves.urllib\", __name__ + \".moves.urllib\"),\n    MovedModule(\"urllib_robotparser\", \"robotparser\", \"urllib.robotparser\"),\n    MovedModule(\"xmlrpc_client\", \"xmlrpclib\", \"xmlrpc.client\"),\n    MovedModule(\"xmlrpc_server\", \"SimpleXMLRPCServer\", \"xmlrpc.server\"),\n]\n\nif sys.platform == \"win32\":\n    _moved_attributes += [\n        MovedModule(\"winreg\", \"_winreg\"),\n    ]\n\nfor attr in _moved_attributes:\n    setattr(_MovedItems, attr.name, attr)\n    if isinstance(attr, MovedModule):\n        _importer._add_module(attr, \"moves.\" + attr.name)\n\ndel attr\n\n_MovedItems._moved_attributes = _moved_attributes\n\nmoves = _MovedItems(__name__ + \".moves\")\n\n_importer._add_module(moves, \"moves\")\n\n_urllib_parse_moved_attributes = [\n    MovedAttribute(\"ParseResult\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"SplitResult\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"parse_qs\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"parse_qsl\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urldefrag\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urljoin\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlparse\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlsplit\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlunparse\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"urlunsplit\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"quote\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"quote_plus\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"unquote\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"unquote_plus\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"urlencode\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splitquery\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splittag\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"splituser\", \"urllib\", \"urllib.parse\"),\n    MovedAttribute(\"uses_fragment\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_netloc\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_params\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_query\", \"urlparse\", \"urllib.parse\"),\n    MovedAttribute(\"uses_relative\", \"urlparse\", \"urllib.parse\"),\n]\n\nfor attr in _urllib_parse_moved_attributes:\n    setattr(Module_six_moves_urllib_parse, attr.name, attr)\n\ndel attr\n\nModule_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_parse(__name__ + \".moves.urllib_parse\"),\n                      \"moves.urllib_parse\", \"moves.urllib.parse\")\n\n_urllib_error_moved_attributes = [\n    MovedAttribute(\"URLError\", \"urllib2\", \"urllib.error\"),\n    MovedAttribute(\"HTTPError\", \"urllib2\", \"urllib.error\"),\n    MovedAttribute(\"ContentTooShortError\", \"urllib\", \"urllib.error\"),\n]\n\nfor attr in _urllib_error_moved_attributes:\n    setattr(Module_six_moves_urllib_error, attr.name, attr)\n\ndel attr\n\nModule_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_error(__name__ + \".moves.urllib.error\"),\n                      \"moves.urllib_error\", \"moves.urllib.error\")\n\n_urllib_request_moved_attributes = [\n    MovedAttribute(\"urlopen\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"install_opener\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"build_opener\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"pathname2url\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"url2pathname\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"getproxies\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"Request\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"OpenerDirector\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPDefaultErrorHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPRedirectHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPCookieProcessor\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"BaseHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPPasswordMgr\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPPasswordMgrWithDefaultRealm\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"AbstractBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyBasicAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"AbstractDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"ProxyDigestAuthHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPSHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"FileHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"FTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"CacheFTPHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"UnknownHandler\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"HTTPErrorProcessor\", \"urllib2\", \"urllib.request\"),\n    MovedAttribute(\"urlretrieve\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"urlcleanup\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"URLopener\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"FancyURLopener\", \"urllib\", \"urllib.request\"),\n    MovedAttribute(\"proxy_bypass\", \"urllib\", \"urllib.request\"),\n]\n\nfor attr in _urllib_request_moved_attributes:\n    setattr(Module_six_moves_urllib_request, attr.name, attr)\n\ndel attr\n\nModule_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_request(__name__ + \".moves.urllib.request\"),\n                      \"moves.urllib_request\", \"moves.urllib.request\")\n\n_urllib_response_moved_attributes = [\n    MovedAttribute(\"addbase\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addclosehook\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addinfo\", \"urllib\", \"urllib.response\"),\n    MovedAttribute(\"addinfourl\", \"urllib\", \"urllib.response\"),\n]\n\nfor attr in _urllib_response_moved_attributes:\n    setattr(Module_six_moves_urllib_response, attr.name, attr)\n\ndel attr\n\nModule_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_response(__name__ + \".moves.urllib.response\"),\n                      \"moves.urllib_response\", \"moves.urllib.response\")\n\n_urllib_robotparser_moved_attributes = [\n    MovedAttribute(\"RobotFileParser\", \"robotparser\", \"urllib.robotparser\"),\n]\n\nfor attr in _urllib_robotparser_moved_attributes:\n    setattr(Module_six_moves_urllib_robotparser, attr.name, attr)\n\ndel attr\n\nModule_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes\n\n_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + \".moves.urllib.robotparser\"),\n                      \"moves.urllib_robotparser\", \"moves.urllib.robotparser\")\n\n_importer._add_module(Module_six_moves_urllib(__name__ + \".moves.urllib\"),\n                      \"moves.urllib\")\n\nif PY3:\n    _meth_func = \"__func__\"\n    _meth_self = \"__self__\"\n\n    _func_closure = \"__closure__\"\n    _func_code = \"__code__\"\n    _func_defaults = \"__defaults__\"\n    _func_globals = \"__globals__\"\nelse:\n    _meth_func = \"im_func\"\n    _meth_self = \"im_self\"\n\n    _func_closure = \"func_closure\"\n    _func_code = \"func_code\"\n    _func_defaults = \"func_defaults\"\n    _func_globals = \"func_globals\"\n\ntry:\n    advance_iterator = next\nexcept NameError:\n    def advance_iterator(it):\n        return it.next()\n\nnext = advance_iterator\n\ntry:\n    callable = callable\nexcept NameError:\n    def callable(obj):\n        return any(\"__call__\" in klass.__dict__ for klass in type(obj).__mro__)\n\nif PY3:\n    def get_unbound_function(unbound):\n        return unbound\n\n    create_bound_method = types.MethodType\n\n    def create_unbound_method(func, cls):\n        return func\n\n    Iterator = object\nelse:\n    def get_unbound_function(unbound):\n        return unbound.im_func\n\n    def create_bound_method(func, obj):\n        return types.MethodType(func, obj, obj.__class__)\n\n    def create_unbound_method(func, cls):\n        return types.MethodType(func, None, cls)\n\n    class Iterator(object):\n\n        def next(self):\n            return type(self).__next__(self)\n\n    callable = callable\n\n_add_doc(get_unbound_function,\n         \"\"\"Get the function out of a possibly unbound function\"\"\")\n\nget_method_function = operator.attrgetter(_meth_func)\n\nget_method_self = operator.attrgetter(_meth_self)\n\nget_function_closure = operator.attrgetter(_func_closure)\n\nget_function_code = operator.attrgetter(_func_code)\n\nget_function_defaults = operator.attrgetter(_func_defaults)\n\nget_function_globals = operator.attrgetter(_func_globals)\n\nif PY3:\n    def iterkeys(d, **kw):\n        return iter(d.keys(**kw))\n\n    def itervalues(d, **kw):\n        return iter(d.values(**kw))\n\n    def iteritems(d, **kw):\n        return iter(d.items(**kw))\n\n    def iterlists(d, **kw):\n        return iter(d.lists(**kw))\n\n    viewkeys = operator.methodcaller(\"keys\")\n\n    viewvalues = operator.methodcaller(\"values\")\n\n    viewitems = operator.methodcaller(\"items\")\nelse:\n    def iterkeys(d, **kw):\n        return d.iterkeys(**kw)\n\n    def itervalues(d, **kw):\n        return d.itervalues(**kw)\n\n    def iteritems(d, **kw):\n        return d.iteritems(**kw)\n\n    def iterlists(d, **kw):\n        return d.iterlists(**kw)\n\n    viewkeys = operator.methodcaller(\"viewkeys\")\n\n    viewvalues = operator.methodcaller(\"viewvalues\")\n\n    viewitems = operator.methodcaller(\"viewitems\")\n\n_add_doc(iterkeys, \"Return an iterator over the keys of a dictionary.\")\n\n_add_doc(itervalues, \"Return an iterator over the values of a dictionary.\")\n\n_add_doc(iteritems,\n         \"Return an iterator over the (key, value) pairs of a dictionary.\")\n\n_add_doc(iterlists,\n         \"Return an iterator over the (key, [values]) pairs of a dictionary.\")\n\nif PY3:\n    def b(s):\n        return s.encode(\"latin-1\")\n\n    def u(s):\n        return s\n    unichr = chr\n    import struct\n    int2byte = struct.Struct(\">B\").pack\n    del struct\n    byte2int = operator.itemgetter(0)\n    indexbytes = operator.getitem\n    iterbytes = iter\n    import io\n    StringIO = io.StringIO\n    BytesIO = io.BytesIO\n    _assertCountEqual = \"assertCountEqual\"\n    if sys.version_info[1] <= 1:\n        _assertRaisesRegex = \"assertRaisesRegexp\"\n        _assertRegex = \"assertRegexpMatches\"\n    else:\n        _assertRaisesRegex = \"assertRaisesRegex\"\n        _assertRegex = \"assertRegex\"\nelse:\n    def b(s):\n        return s\n    # Workaround for standalone backslash\n\n    def u(s):\n        return unicode(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n    unichr = unichr\n    int2byte = chr\n\n    def byte2int(bs):\n        return ord(bs[0])\n\n    def indexbytes(buf, i):\n        return ord(buf[i])\n    iterbytes = functools.partial(itertools.imap, ord)\n    import StringIO\n    StringIO = BytesIO = StringIO.StringIO\n    _assertCountEqual = \"assertItemsEqual\"\n    _assertRaisesRegex = \"assertRaisesRegexp\"\n    _assertRegex = \"assertRegexpMatches\"\n\n_add_doc(b, \"\"\"Byte literal\"\"\")\n\n_add_doc(u, \"\"\"Text literal\"\"\")\n\nif PY3:\n    exec_ = getattr(moves.builtins, \"exec\")\n\n    def reraise(tp, value, tb=None):\n        if value is None:\n            value = tp()\n        if value.__traceback__ is not tb:\n            raise value.with_traceback(tb)\n        raise value\n\nelse:\n    def exec_(_code_, _globs_=None, _locs_=None):\n        \"\"\"Execute code in a namespace.\"\"\"\n        if _globs_ is None:\n            frame = sys._getframe(1)\n            _globs_ = frame.f_globals\n            if _locs_ is None:\n                _locs_ = frame.f_locals\n            del frame\n        elif _locs_ is None:\n            _locs_ = _globs_\n        exec(\"\"\"exec _code_ in _globs_, _locs_\"\"\")\n\n    exec_(\"\"\"def reraise(tp, value, tb=None):\n    raise tp, value, tb\n\"\"\")\n\nif sys.version_info[:2] == (3, 2):\n    exec_(\"\"\"def raise_from(value, from_value):\n    if from_value is None:\n        raise value\n    raise value from from_value\n\"\"\")\nelif sys.version_info[:2] > (3, 2):\n    exec_(\"\"\"def raise_from(value, from_value):\n    raise value from from_value\n\"\"\")\nelse:\n    def raise_from(value, from_value):\n        raise value\n\nprint_ = getattr(moves.builtins, \"print\", None)\n\nif print_ is None:\n    def print_(*args, **kwargs):\n        \"\"\"The new-style print function for Python 2.4 and 2.5.\"\"\"\n        fp = kwargs.pop(\"file\", sys.stdout)\n        if fp is None:\n            return\n\n        def write(data):\n            if not isinstance(data, basestring):\n                data = str(data)\n            # If the file has an encoding, encode unicode with it.\n            if (isinstance(fp, file) and\n                    isinstance(data, unicode) and\n                    fp.encoding is not None):\n                errors = getattr(fp, \"errors\", None)\n                if errors is None:\n                    errors = \"strict\"\n                data = data.encode(fp.encoding, errors)\n            fp.write(data)\n        want_unicode = False\n        sep = kwargs.pop(\"sep\", None)\n        if sep is not None:\n            if isinstance(sep, unicode):\n                want_unicode = True\n            elif not isinstance(sep, str):\n                raise TypeError(\"sep must be None or a string\")\n        end = kwargs.pop(\"end\", None)\n        if end is not None:\n            if isinstance(end, unicode):\n                want_unicode = True\n            elif not isinstance(end, str):\n                raise TypeError(\"end must be None or a string\")\n        if kwargs:\n            raise TypeError(\"invalid keyword arguments to print()\")\n        if not want_unicode:\n            for arg in args:\n                if isinstance(arg, unicode):\n                    want_unicode = True\n                    break\n        if want_unicode:\n            newline = unicode(\"\\n\")\n            space = unicode(\" \")\n        else:\n            newline = \"\\n\"\n            space = \" \"\n        if sep is None:\n            sep = space\n        if end is None:\n            end = newline\n        for i, arg in enumerate(args):\n            if i:\n                write(sep)\n            write(arg)\n        write(end)\n\nif sys.version_info[:2] < (3, 3):\n    _print = print_\n\n    def print_(*args, **kwargs):\n        fp = kwargs.get(\"file\", sys.stdout)\n        flush = kwargs.pop(\"flush\", False)\n        _print(*args, **kwargs)\n        if flush and fp is not None:\n            fp.flush()\n\n_add_doc(reraise, \"\"\"Reraise an exception.\"\"\")\n\nif sys.version_info[0:2] < (3, 4):\n    def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,\n              updated=functools.WRAPPER_UPDATES):\n        def wrapper(f):\n            f = functools.wraps(wrapped, assigned, updated)(f)\n            f.__wrapped__ = wrapped\n            return f\n        return wrapper\nelse:\n    wraps = functools.wraps\n\n__path__ = []  # required for PEP 302 and PEP 451\n\n__package__ = __name__  # see PEP 366 @ReservedAssignment\n\nif globals().get(\"__spec__\") is not None:\n    __spec__.submodule_search_locations = []  # PEP 451 @UndefinedVariable\n\nif sys.meta_path:\n    for i, importer in enumerate(sys.meta_path):\n        # Here's some real nastiness: Another \"instance\" of the six module might\n        # be floating around. Therefore, we can't use isinstance() to check for\n        # the six meta path importer, since the other six instance will have\n        # inserted an importer with different class.\n        if (type(importer).__name__ == \"_SixMetaPathImporter\" and\n                importer.name == __name__):\n            del sys.meta_path[i]\n            break\n    del i, importer\n\nsys.meta_path.append(_importer)"},{"col":4,"comment":"null","endLoc":276,"header":"def __get__(self, obj, objtype)","id":9892,"name":"__get__","nodeType":"Function","startLoc":266,"text":"def __get__(self, obj, objtype):\n        if obj is None:\n            return self\n\n        # All of the Parameter.__init__ work should already have been done for\n        # the class-level descriptor; we can skip that stuff and just copy the\n        # existing __dict__ and then bind to the model instance\n        parameter = self.__class__.__new__(self.__class__)\n        parameter.__dict__.update(self.__dict__)\n        parameter._bind(obj)\n        return parameter"},{"col":4,"comment":"null","endLoc":307,"header":"def __set__(self, obj, value)","id":9893,"name":"__set__","nodeType":"Function","startLoc":278,"text":"def __set__(self, obj, value):\n\n        value = _tofloat(value)\n\n        # Check that units are compatible with default or units already set\n        param_unit = obj._param_metrics[self.name]['orig_unit']\n        if param_unit is None:\n            if isinstance(value, Quantity):\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n        else:\n            if not isinstance(value, Quantity):\n                raise UnitsError(\"The '{0}' parameter should be given as a \"\n                                 \"Quantity because it was originally initialized \"\n                                 \"as a Quantity\".format(self._name))\n            else:\n                # We need to make sure we update the unit because the units are\n                # then dropped from the value below.\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n\n        # Call the validator before the setter\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        if self._setter is not None:\n            setter = self._create_value_wrapper(self._setter, obj)\n            if self.unit is not None:\n                value = setter(value * self.unit).value\n            else:\n                value = setter(value)\n        self._set_model_value(obj, value)"},{"col":0,"comment":"Convert a parameter to float or float array","endLoc":67,"header":"def _tofloat(value)","id":9894,"name":"_tofloat","nodeType":"Function","startLoc":40,"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                \"Parameter of {0} could not be converted to \"\n                \"float\".format(type(value)))\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)):\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            \"Don't know how to convert parameter of {0} to \"\n            \"float\".format(type(value)))\n    return value"},{"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":86,"header":"def _parse_response(resp_data)","id":9895,"name":"_parse_response","nodeType":"Function","startLoc":61,"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.decode('utf-8'))\n\n    if matched is None:\n        return None, None\n    else:\n        ra, dec = matched.groups()\n        return ra, dec"},{"attributeType":"null","col":4,"comment":"\n    The constraint types supported by this fitter type.\n    ","endLoc":600,"id":9896,"name":"supported_constraints","nodeType":"Attribute","startLoc":600,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":606,"id":9897,"name":"fit_info","nodeType":"Attribute","startLoc":606,"text":"self.fit_info"},{"className":"SLSQPLSQFitter","col":0,"comment":"\n    SLSQP optimization algorithm and least squares statistic.\n\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\n\n    ","endLoc":829,"id":9898,"nodeType":"Class","startLoc":763,"text":"class SLSQPLSQFitter(Fitter):\n    \"\"\"\n    SLSQP optimization algorithm and least squares statistic.\n\n\n    Raises\n    ------\n    ModelLinearityError\n        A linear model is passed to a nonlinear fitter\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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\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 and keyword-only argument\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        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        p0, _ = _model_to_fit_params(model_copy)\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"},{"col":4,"comment":"null","endLoc":779,"header":"def __init__(self)","id":9899,"name":"__init__","nodeType":"Function","startLoc":777,"text":"def __init__(self):\n        super().__init__(optimizer=SLSQP, statistic=leastsquare)\n        self.fit_info = {}"},{"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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\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 and keyword-only argument\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        ","endLoc":829,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":9900,"name":"__call__","nodeType":"Function","startLoc":781,"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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\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 and keyword-only argument\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        model_copy = _validate_model(model, self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n        p0, _ = _model_to_fit_params(model_copy)\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":196,"id":9901,"name":"info","nodeType":"Attribute","startLoc":196,"text":"info"},{"col":0,"comment":"null","endLoc":2917,"header":"def parse_grammar(doc, file, line)","id":9902,"name":"parse_grammar","nodeType":"Function","startLoc":2885,"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":8,"comment":"null","endLoc":211,"id":9903,"name":"_extra_frameattr_names","nodeType":"Attribute","startLoc":211,"text":"self._extra_frameattr_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":775,"id":9904,"name":"supported_constraints","nodeType":"Attribute","startLoc":775,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":779,"id":9905,"name":"fit_info","nodeType":"Attribute","startLoc":779,"text":"self.fit_info"},{"col":4,"comment":"\n        This method implements how to store the value of a parameter on the\n        model instance.\n\n        Currently there is only one storage mechanism (via the ._parameters\n        array) but other mechanisms may be desireable, in which case really the\n        model class itself should dictate this and *not* `Parameter` itself.\n        ","endLoc":827,"header":"def _set_model_value(self, model, value)","id":9906,"name":"_set_model_value","nodeType":"Function","startLoc":801,"text":"def _set_model_value(self, model, value):\n        \"\"\"\n        This method implements how to store the value of a parameter on the\n        model instance.\n\n        Currently there is only one storage mechanism (via the ._parameters\n        array) but other mechanisms may be desireable, in which case really the\n        model class itself should dictate this and *not* `Parameter` itself.\n        \"\"\"\n        def _update_parameter_value(model, name, value):\n            # TODO: Maybe handle exception on invalid input shape\n            param_metrics = model._param_metrics[name]\n            param_slice = param_metrics['slice']\n            param_shape = param_metrics['shape']\n            param_size = np.prod(param_shape)\n\n            if np.size(value) != param_size:\n                raise InputParameterError(\n                    \"Input value for parameter {0!r} does not have {1} elements \"\n                    \"as the current value does\".format(name, param_size))\n\n            model._parameters[param_slice] = np.array(value).ravel()\n        _update_parameter_value(model, self._name, value)\n        if hasattr(model, \"_param_map\"):\n            submodel_ind, param_name = model._param_map[self._name]\n            if hasattr(model._submodels[submodel_ind], \"_param_metrics\"):\n                _update_parameter_value(model._submodels[submodel_ind], param_name, value)"},{"className":"SimplexLSQFitter","col":0,"comment":"\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    ","endLoc":894,"id":9907,"nodeType":"Class","startLoc":832,"text":"class SimplexLSQFitter(Fitter):\n    \"\"\"\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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional and keyword-only argument\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        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\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        return model_copy"},{"col":4,"comment":"null","endLoc":848,"header":"def __init__(self)","id":9908,"name":"__init__","nodeType":"Function","startLoc":846,"text":"def __init__(self):\n        super().__init__(optimizer=Simplex, statistic=leastsquare)\n        self.fit_info = {}"},{"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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional and keyword-only argument\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        ","endLoc":894,"header":"@fitter_unit_support\n    def __call__(self, model, x, y, z=None, weights=None, **kwargs)","id":9909,"name":"__call__","nodeType":"Function","startLoc":850,"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\n        kwargs : dict\n            optional keyword arguments to be passed to the optimizer or the statistic\n\n        maxiter : int\n            maximum number of iterations\n        acc : float\n            Relative error in approximate solution\n        equivalencies : list or None, optional and keyword-only argument\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        model_copy = _validate_model(model,\n                                     self._opt_method.supported_constraints)\n        farg = _convert_input(x, y, z)\n        farg = (model_copy, weights, ) + farg\n\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        return model_copy"},{"col":4,"comment":"null","endLoc":312,"header":"def __len__(self)","id":9911,"name":"__len__","nodeType":"Function","startLoc":309,"text":"def __len__(self):\n        if self._model is None:\n            raise TypeError('Parameter definitions do not have a length.')\n        return len(self._model)"},{"col":4,"comment":"null","endLoc":320,"header":"def __getitem__(self, key)","id":9912,"name":"__getitem__","nodeType":"Function","startLoc":314,"text":"def __getitem__(self, key):\n        value = self.value\n        if len(self._model) == 1:\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":346,"header":"def __setitem__(self, key, value)","id":9913,"name":"__setitem__","nodeType":"Function","startLoc":322,"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        n_models = len(self._model)\n\n        # if n_models == 1:\n        #    # Convert the single-dimension value to a list to allow some slices\n        #    # that would be compatible with a length-1 array like [:] and [0:]\n        #    oldvalue = [oldvalue]\n\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{0}'\".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 {0} invalid for {1!r} parameter with \"\n                    \"dimension {2}\".format(key, self.name, n_models))"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":9914,"name":"_sky_coord_frame","nodeType":"Attribute","startLoc":228,"text":"self._sky_coord_frame"},{"attributeType":"null","col":20,"comment":"null","endLoc":366,"id":9915,"name":"info","nodeType":"Attribute","startLoc":366,"text":"self.info"},{"attributeType":"null","col":4,"comment":"null","endLoc":844,"id":9916,"name":"supported_constraints","nodeType":"Attribute","startLoc":844,"text":"supported_constraints"},{"attributeType":"null","col":8,"comment":"null","endLoc":848,"id":9917,"name":"fit_info","nodeType":"Attribute","startLoc":848,"text":"self.fit_info"},{"className":"JointFitter","col":0,"comment":"\n    Fit models which share a parameter.\n\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    ","endLoc":1043,"id":9918,"nodeType":"Class","startLoc":897,"text":"class JointFitter(metaclass=_FitterMeta):\n    \"\"\"\n    Fit models which share a parameter.\n\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    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 = [p.flatten() for p in model.parameters]\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        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(\"Expected >1 models, {} is given\".format(\n                    len(self.models)))\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":924,"header":"def __init__(self, models, jointparameters, initvals)","id":9919,"name":"__init__","nodeType":"Function","startLoc":914,"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)"},{"col":4,"comment":"null","endLoc":366,"header":"def __repr__(self)","id":9920,"name":"__repr__","nodeType":"Function","startLoc":348,"text":"def __repr__(self):\n        args = \"'{0}'\".format(self._name)\n        if self._model is None:\n            if self._default is not None:\n                args += ', default={0}'.format(self._default)\n        else:\n            args += ', value={0}'.format(self.value)\n\n        if self.unit is not None:\n            args += ', unit={0}'.format(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 += ', {0}={1}'.format(cons, val)\n\n        return \"{0}({1})\".format(self.__class__.__name__, args)"},{"className":"NoOverlapError","col":0,"comment":"Raised when determining the overlap of non-overlapping arrays.","endLoc":23,"id":9921,"nodeType":"Class","startLoc":21,"text":"class NoOverlapError(ValueError):\n    '''Raised when determining the overlap of non-overlapping arrays.'''\n    pass"},{"col":4,"comment":"Parameter name","endLoc":372,"header":"@property\n    def name(self)","id":9922,"name":"name","nodeType":"Function","startLoc":368,"text":"@property\n    def name(self):\n        \"\"\"Parameter name\"\"\"\n\n        return self._name"},{"className":"PartialOverlapError","col":0,"comment":"Raised when arrays only partially overlap.","endLoc":28,"id":9923,"nodeType":"Class","startLoc":26,"text":"class PartialOverlapError(ValueError):\n    '''Raised when arrays only partially overlap.'''\n    pass"},{"col":4,"comment":"Parameter default value","endLoc":400,"header":"@property\n    def default(self)","id":9924,"name":"default","nodeType":"Function","startLoc":374,"text":"@property\n    def default(self):\n        \"\"\"Parameter default value\"\"\"\n\n        if (self._model is None or self._default is None or\n                len(self._model) == 1):\n            return self._default\n\n        # Otherwise the model we are providing for has more than one parameter\n        # sets, so ensure that the default is repeated the correct number of\n        # times along the model_set_axis if necessary\n        n_models = len(self._model)\n        model_set_axis = self._model._model_set_axis\n        default = self._default\n        new_shape = (np.shape(default) +\n                     (1,) * (model_set_axis + 1 - np.ndim(default)))\n        default = np.reshape(default, new_shape)\n        # Now roll the new axis into its correct position if necessary\n        default = np.rollaxis(default, -1, model_set_axis)\n        # Finally repeat the last newly-added axis to match n_models\n        default = np.repeat(default, n_models, axis=-1)\n\n        # NOTE: Regardless of what order the last two steps are performed in,\n        # the resulting array will *look* the same, but only if the repeat is\n        # performed last will it result in a *contiguous* array\n\n        return default"},{"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:`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        <http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : `~numpy.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, `~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 : number, 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 objects\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 objects\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":912,"id":9925,"nodeType":"Class","startLoc":475,"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:`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        <http://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf>`__.\n\n    Parameters\n    ----------\n    data : `~numpy.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, `~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 : number, 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 objects\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 objects\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 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        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    @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 (_round(self.input_position_original[0]),\n                _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 (_round(self.input_position_cutout[0]),\n                _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":"The unadorned value proxied by this parameter.","endLoc":418,"header":"@property\n    def value(self)","id":9926,"name":"value","nodeType":"Function","startLoc":402,"text":"@property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a value')\n\n        value = self._get_model_value(self._model)\n        if self._getter is None:\n            return value\n        else:\n            raw_unit = self._model._param_metrics[self.name]['raw_unit']\n            orig_unit = self._model._param_metrics[self.name]['orig_unit']\n            if raw_unit is not None:\n                return np.float64(self._getter(value, raw_unit, orig_unit).value)\n            else:\n                return self._getter(value)"},{"col":4,"comment":"null","endLoc":736,"header":"def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False)","id":9927,"name":"__init__","nodeType":"Function","startLoc":654,"text":"def __init__(self, data, position, size, wcs=None, mode='trim',\n                 fill_value=np.nan, copy=False):\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        else:\n            self.wcs = None"},{"col":4,"comment":"\n        This method implements how to retrieve the value of this parameter from\n        the model instance.  See also `Parameter._set_model_value`.\n\n        These methods take an explicit model argument rather than using\n        self._model so that they can be used from unbound `Parameter`\n        instances.\n        ","endLoc":799,"header":"def _get_model_value(self, model)","id":9928,"name":"_get_model_value","nodeType":"Function","startLoc":773,"text":"def _get_model_value(self, model):\n        \"\"\"\n        This method implements how to retrieve the value of this parameter from\n        the model instance.  See also `Parameter._set_model_value`.\n\n        These methods take an explicit model argument rather than using\n        self._model so that they can be used from unbound `Parameter`\n        instances.\n        \"\"\"\n\n        if not hasattr(model, '_parameters'):\n            # The _parameters array hasn't been initialized yet; just translate\n            # this to an AttributeError\n            raise AttributeError(self._name)\n\n        # Use the _param_metrics to extract the parameter value from the\n        # _parameters array\n        param_metrics = model._param_metrics[self._name]\n        param_slice = param_metrics['slice']\n        param_shape = param_metrics['shape']\n        value = model._parameters[param_slice]\n        if param_shape:\n            value = value.reshape(param_shape)\n        else:\n            value = value[0]\n\n        return value"},{"col":4,"comment":"null","endLoc":434,"header":"@value.setter\n    def value(self, value)","id":9929,"name":"value","nodeType":"Function","startLoc":420,"text":"@value.setter\n    def value(self, value):\n        if self._model is None:\n            raise AttributeError('Cannot set a value on a parameter '\n                                 'definition')\n\n        if self._setter is not None:\n            val = self._setter(value)\n\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set to \"\n                            \"unitless values, not Quantity objects. To set a \"\n                            \"parameter to a quantity simply set the parameter \"\n                            \"directly without using .value\")\n        self._set_model_value(self._model, value)"},{"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    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":571,"header":"def fits_ccddata_writer(ccd_data, filename, hdu_mask='MASK',\n                        hdu_uncertainty='UNCERT', hdu_flags=None, **kwd)","id":9930,"name":"fits_ccddata_writer","nodeType":"Function","startLoc":536,"text":"def fits_ccddata_writer(ccd_data, filename, hdu_mask='MASK',\n                        hdu_uncertainty='UNCERT', hdu_flags=None, **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    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(hdu_mask=hdu_mask, hdu_uncertainty=hdu_uncertainty,\n                          hdu_flags=hdu_flags)\n    hdu.writeto(filename, **kwd)"},{"col":4,"comment":"null","endLoc":998,"header":"def _verify_input(self)","id":9931,"name":"_verify_input","nodeType":"Function","startLoc":988,"text":"def _verify_input(self):\n        if len(self.models) <= 1:\n            raise TypeError(\"Expected >1 models, {} is given\".format(\n                    len(self.models)))\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)))"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":9932,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":9,"id":9933,"name":"u","nodeType":"Attribute","startLoc":9,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":9934,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":9935,"name":"_config_ccd_requires_unit","nodeType":"Attribute","startLoc":21,"text":"_config_ccd_requires_unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":379,"id":9936,"name":"_KEEP_THESE_KEYWORDS_IN_HEADER","nodeType":"Attribute","startLoc":379,"text":"_KEEP_THESE_KEYWORDS_IN_HEADER"},{"attributeType":"null","col":4,"comment":"null","endLoc":580,"id":9937,"name":"__doc__","nodeType":"Attribute","startLoc":580,"text":"CCDData.read.__doc__"},{"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":451,"header":"@property\n    def unit(self)","id":9938,"name":"unit","nodeType":"Function","startLoc":436,"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        if self._model is None:\n            return self._unit\n        else:\n            # orig_unit may be undefined early on in model instantiation\n            return self._model._param_metrics[self.name].get('orig_unit',\n                                                             self._unit)"},{"attributeType":"null","col":4,"comment":"null","endLoc":582,"id":9939,"name":"__doc__","nodeType":"Attribute","startLoc":582,"text":"CCDData.read.__func__.__doc__"},{"attributeType":"null","col":4,"comment":"null","endLoc":585,"id":9940,"name":"__doc__","nodeType":"Attribute","startLoc":585,"text":"CCDData.write.__doc__"},{"col":4,"comment":"null","endLoc":455,"header":"@unit.setter\n    def unit(self, unit)","id":9941,"name":"unit","nodeType":"Function","startLoc":453,"text":"@unit.setter\n    def unit(self, unit):\n        self._set_unit(unit)"},{"attributeType":"null","col":4,"comment":"null","endLoc":587,"id":9942,"name":"__doc__","nodeType":"Attribute","startLoc":587,"text":"CCDData.write.__func__.__doc__"},{"col":0,"comment":"","endLoc":2,"header":"ccddata.py#<anonymous>","id":9943,"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_config_ccd_requires_unit = True\n\n_KEEP_THESE_KEYWORDS_IN_HEADER = [\n    'JD-OBS',\n    'MJD-OBS',\n    'DATE-OBS'\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\ntry:\n    CCDData.read.__doc__ = fits_ccddata_reader.__doc__\nexcept AttributeError:\n    CCDData.read.__func__.__doc__ = fits_ccddata_reader.__doc__\n\ntry:\n    CCDData.write.__doc__ = fits_ccddata_writer.__doc__\nexcept AttributeError:\n    CCDData.write.__func__.__doc__ = fits_ccddata_writer.__doc__"},{"col":4,"comment":"null","endLoc":472,"header":"def _set_unit(self, unit, force=False)","id":9944,"name":"_set_unit","nodeType":"Function","startLoc":457,"text":"def _set_unit(self, unit, force=False):\n\n        if self._model is None:\n            raise AttributeError('Cannot set unit on a parameter definition')\n\n        orig_unit = self._model._param_metrics[self.name]['orig_unit']\n\n        if force:\n            self._model._param_metrics[self.name]['orig_unit'] = unit\n        else:\n            if orig_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":937,"header":"def _model_to_fit_params(self)","id":9945,"name":"_model_to_fit_params","nodeType":"Function","startLoc":926,"text":"def _model_to_fit_params(self):\n        fparams = []\n        fparams.extend(self.initvals)\n        for model in self.models:\n            params = [p.flatten() for p in model.parameters]\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        ","endLoc":986,"header":"def objective_function(self, fps, *args)","id":9946,"name":"objective_function","nodeType":"Function","startLoc":939,"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        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":4,"comment":"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        ","endLoc":482,"header":"@property\n    def quantity(self)","id":9947,"name":"quantity","nodeType":"Function","startLoc":474,"text":"@property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is not None:\n            return self.value * self.unit\n        else:\n            return None"},{"col":4,"comment":"null","endLoc":489,"header":"@quantity.setter\n    def quantity(self, quantity)","id":9948,"name":"quantity","nodeType":"Function","startLoc":484,"text":"@quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set to a Quantity object\")\n        self.value = quantity.value\n        self._set_unit(quantity.unit, force=True)"},{"col":4,"comment":"\n        Fit data to these models keeping some of the parameters common to the\n        two models.\n        ","endLoc":1043,"header":"def __call__(self, *args)","id":9949,"name":"__call__","nodeType":"Function","startLoc":1000,"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":1008,"id":9950,"nodeType":"Lambda","startLoc":1008,"text":"lambda x, y: x + 1 + y + 1"},{"col":44,"endLoc":1010,"id":9951,"nodeType":"Lambda","startLoc":1010,"text":"lambda x, y: x + 1 + y + 1"},{"col":4,"comment":"null","endLoc":3017,"header":"def validate_modules(self)","id":9952,"name":"validate_modules","nodeType":"Function","startLoc":2995,"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)"},{"fileName":"parameters.py","filePath":"astropy/modeling","id":9953,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module defines two classes that deal with parameters.\n\nIt is unlikely users will need to work with these classes directly, unless they\ndefine their own models.\n\"\"\"\n\n\nimport functools\nimport numbers\nimport types\nimport operator\n\nimport numpy as np\n\nfrom .. import units as u\nfrom ..units import Quantity, UnitsError\nfrom ..utils import isiterable, OrderedDescriptor\nfrom .utils import array_repr_oneline\n\nfrom .utils import get_inputs_and_params\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                \"Parameter of {0} could not be converted to \"\n                \"float\".format(type(value)))\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)):\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            \"Don't know how to convert parameter of {0} to \"\n            \"float\".format(type(value)))\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._model is None:\n            return NotImplemented\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._model is None:\n            if op is operator.lt:\n                # Because OrderedDescriptor uses __lt__ to work, we need to\n                # call the super method, but only when not bound to an instance\n                # anyways\n                return super(self.__class__, self).__lt__(val)\n            else:\n                return NotImplemented\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        if self._model is None:\n            return NotImplemented\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(OrderedDescriptor):\n    \"\"\"\n    Wraps individual parameters.\n\n    This class represents a model's parameter (in a somewhat broad sense).  It\n    acts as both a descriptor that can be assigned to a class attribute to\n    describe the parameters accepted by an individual model (this is called an\n    \"unbound parameter\"), or it can act as a proxy for the parameter values on\n    an individual model instance (called a \"bound parameter\").\n\n    Parameter instances never store the actual value of the parameter directly.\n    Rather, each instance of a model stores its own parameters parameter values\n    in an array.  A *bound* Parameter simply wraps the value in a Parameter\n    proxy which provides some additional information about the parameter such\n    as its constraints.  In other words, this is a high-level interface to a\n    model's adjustable parameter values.\n\n    *Unbound* Parameters are not associated with any specific model instance,\n    and are merely used by model classes to determine the names of their\n    parameters and other information about each parameter such as their default\n    values and default constraints.\n\n    See :ref:`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    model : `Model` instance\n        binds the the `Parameter` instance to a specific model upon\n        instantiation; this should only be used internally for creating bound\n        Parameters, and should not be used for `Parameter` descriptors defined\n        as class attributes\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).\n    \"\"\"\n\n    # Settings for OrderedDescriptor\n    _class_attribute_ = '_parameters_'\n    _name_attribute_ = '_name'\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, model=None):\n        super().__init__()\n\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 model is None and 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\n            unit = default.unit\n            default = default.value\n\n        self._default = default\n        self._unit = unit\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                    'or max when instantiating Parameter {0}'.format(name))\n        else:\n            bounds = (min, max)\n\n        self._fixed = fixed\n        self._tied = tied\n        self._bounds = bounds\n\n        self._order = None\n        self._model = None\n\n        # The getter/setter functions take one or two arguments: The first\n        # argument is always the value itself (either the value returned or the\n        # value being set).  The second argument is optional, but if present\n        # will contain a reference to the model object tied to a parameter (if\n        # it exists)\n        self._getter = self._create_value_wrapper(getter, None)\n        self._setter = self._create_value_wrapper(setter, None)\n\n        self._validator = None\n\n        # Only Parameters declared as class-level descriptors require\n        # and ordering ID\n        if model is not None:\n            self._bind(model)\n\n    def __get__(self, obj, objtype):\n        if obj is None:\n            return self\n\n        # All of the Parameter.__init__ work should already have been done for\n        # the class-level descriptor; we can skip that stuff and just copy the\n        # existing __dict__ and then bind to the model instance\n        parameter = self.__class__.__new__(self.__class__)\n        parameter.__dict__.update(self.__dict__)\n        parameter._bind(obj)\n        return parameter\n\n    def __set__(self, obj, value):\n\n        value = _tofloat(value)\n\n        # Check that units are compatible with default or units already set\n        param_unit = obj._param_metrics[self.name]['orig_unit']\n        if param_unit is None:\n            if isinstance(value, Quantity):\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n        else:\n            if not isinstance(value, Quantity):\n                raise UnitsError(\"The '{0}' parameter should be given as a \"\n                                 \"Quantity because it was originally initialized \"\n                                 \"as a Quantity\".format(self._name))\n            else:\n                # We need to make sure we update the unit because the units are\n                # then dropped from the value below.\n                obj._param_metrics[self.name]['orig_unit'] = value.unit\n\n        # Call the validator before the setter\n        if self._validator is not None:\n            self._validator(obj, value)\n\n        if self._setter is not None:\n            setter = self._create_value_wrapper(self._setter, obj)\n            if self.unit is not None:\n                value = setter(value * self.unit).value\n            else:\n                value = setter(value)\n        self._set_model_value(obj, value)\n\n    def __len__(self):\n        if self._model is None:\n            raise TypeError('Parameter definitions do not have a length.')\n        return len(self._model)\n\n    def __getitem__(self, key):\n        value = self.value\n        if len(self._model) == 1:\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        n_models = len(self._model)\n\n        # if n_models == 1:\n        #    # Convert the single-dimension value to a list to allow some slices\n        #    # that would be compatible with a length-1 array like [:] and [0:]\n        #    oldvalue = [oldvalue]\n\n        if isinstance(key, slice):\n            if len(oldvalue[key]) == 0:\n                raise InputParameterError(\n                    \"Slice assignment outside the parameter dimensions for \"\n                    \"'{0}'\".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 {0} invalid for {1!r} parameter with \"\n                    \"dimension {2}\".format(key, self.name, n_models))\n\n    def __repr__(self):\n        args = \"'{0}'\".format(self._name)\n        if self._model is None:\n            if self._default is not None:\n                args += ', default={0}'.format(self._default)\n        else:\n            args += ', value={0}'.format(self.value)\n\n        if self.unit is not None:\n            args += ', unit={0}'.format(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 += ', {0}={1}'.format(cons, val)\n\n        return \"{0}({1})\".format(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\n        if (self._model is None or self._default is None or\n                len(self._model) == 1):\n            return self._default\n\n        # Otherwise the model we are providing for has more than one parameter\n        # sets, so ensure that the default is repeated the correct number of\n        # times along the model_set_axis if necessary\n        n_models = len(self._model)\n        model_set_axis = self._model._model_set_axis\n        default = self._default\n        new_shape = (np.shape(default) +\n                     (1,) * (model_set_axis + 1 - np.ndim(default)))\n        default = np.reshape(default, new_shape)\n        # Now roll the new axis into its correct position if necessary\n        default = np.rollaxis(default, -1, model_set_axis)\n        # Finally repeat the last newly-added axis to match n_models\n        default = np.repeat(default, n_models, axis=-1)\n\n        # NOTE: Regardless of what order the last two steps are performed in,\n        # the resulting array will *look* the same, but only if the repeat is\n        # performed last will it result in a *contiguous* array\n\n        return default\n\n    @property\n    def value(self):\n        \"\"\"The unadorned value proxied by this parameter.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a value')\n\n        value = self._get_model_value(self._model)\n        if self._getter is None:\n            return value\n        else:\n            raw_unit = self._model._param_metrics[self.name]['raw_unit']\n            orig_unit = self._model._param_metrics[self.name]['orig_unit']\n            if raw_unit is not None:\n                return np.float64(self._getter(value, raw_unit, orig_unit).value)\n            else:\n                return self._getter(value)\n\n    @value.setter\n    def value(self, value):\n        if self._model is None:\n            raise AttributeError('Cannot set a value on a parameter '\n                                 'definition')\n\n        if self._setter is not None:\n            val = self._setter(value)\n\n        if isinstance(value, Quantity):\n            raise TypeError(\"The .value property on parameters should be set to \"\n                            \"unitless values, not Quantity objects. To set a \"\n                            \"parameter to a quantity simply set the parameter \"\n                            \"directly without using .value\")\n        self._set_model_value(self._model, value)\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        if self._model is None:\n            return self._unit\n        else:\n            # orig_unit may be undefined early on in model instantiation\n            return self._model._param_metrics[self.name].get('orig_unit',\n                                                             self._unit)\n\n    @unit.setter\n    def unit(self, unit):\n        self._set_unit(unit)\n\n    def _set_unit(self, unit, force=False):\n\n        if self._model is None:\n            raise AttributeError('Cannot set unit on a parameter definition')\n\n        orig_unit = self._model._param_metrics[self.name]['orig_unit']\n\n        if force:\n            self._model._param_metrics[self.name]['orig_unit'] = unit\n        else:\n            if orig_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    @property\n    def quantity(self):\n        \"\"\"\n        This parameter, as a :class:`~astropy.units.Quantity` instance.\n        \"\"\"\n        if self.unit is not None:\n            return self.value * self.unit\n        else:\n            return None\n\n    @quantity.setter\n    def quantity(self, quantity):\n        if not isinstance(quantity, Quantity):\n            raise TypeError(\"The .quantity attribute should be set to a Quantity object\")\n        self.value = quantity.value\n        self._set_unit(quantity.unit, force=True)\n\n    @property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a '\n                                 'shape.')\n\n        shape = self._model._param_metrics[self._name]['shape']\n\n        if len(self._model) > 1:\n            # If we are dealing with a model *set* the shape is the shape of\n            # the parameter within a single model in the set\n            model_axis = self._model._model_set_axis\n\n            if model_axis < 0:\n                model_axis = len(shape) + model_axis\n\n            shape = shape[:model_axis] + shape[model_axis + 1:]\n\n        return shape\n\n    @property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        # TODO: Rather than using self.value this could be determined from the\n        # size of the parameter in _param_metrics\n\n        return np.size(self.value)\n\n    @property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n\n        if self._model is not None:\n            fixed = self._model._constraints['fixed']\n            return fixed.get(self._name, self._fixed)\n        else:\n            return self._fixed\n\n    @fixed.setter\n    def fixed(self, value):\n        \"\"\"Fix a parameter\"\"\"\n        if self._model is not None:\n            if not isinstance(value, bool):\n                raise TypeError(\"Fixed can be True or False\")\n            self._model._constraints['fixed'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'fixed' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            tied = self._model._constraints['tied']\n            return tied.get(self._name, self._tied)\n        else:\n            return self._tied\n\n    @tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if self._model is not None:\n            if not callable(value) and value not in (False, None):\n                raise TypeError(\"Tied must be a callable\")\n            self._model._constraints['tied'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'tied' on Parameter \"\n                                 \"definition\")\n\n    @property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        if self._model is not None:\n            bounds = self._model._constraints['bounds']\n            return bounds.get(self._name, self._bounds)\n        else:\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        if self._model is not None:\n            _min, _max = value\n            if _min is not None:\n                if not isinstance(_min, numbers.Number):\n                    raise TypeError(\"Min value must be a number\")\n                _min = float(_min)\n\n            if _max is not None:\n                if not isinstance(_max, numbers.Number):\n                    raise TypeError(\"Max value must be a number\")\n                _max = float(_max)\n\n            bounds = self._model._constraints.setdefault('bounds', {})\n            self._model._constraints['bounds'][self._name] = (_min, _max)\n        else:\n            raise AttributeError(\"can't set attribute 'bounds' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            self.bounds = (value, self.max)\n        else:\n            raise AttributeError(\"can't set attribute 'min' on Parameter \"\n                                 \"definition\")\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        if self._model is not None:\n            self.bounds = (self.min, value)\n        else:\n            raise AttributeError(\"can't set attribute 'max' on Parameter \"\n                                 \"definition\")\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        The decorator *returns* the `Parameter` instance that the validator\n        is set on, so the underlying validator method should have the same\n        name as the `Parameter` itself (think of this as analogous to\n        ``property.setter``).  For example::\n\n            >>> from astropy.modeling import Fittable1DModel\n            >>> class TestModel(Fittable1DModel):\n            ...     a = Parameter()\n            ...     b = Parameter()\n            ...\n            ...     @a.validator\n            ...     def a(self, value):\n            ...         # Remember, the value can be an array\n            ...         if np.any(value < self.b):\n            ...             raise InputParameterError(\n            ...                 \"parameter 'a' must be greater than or equal \"\n            ...                 \"to parameter 'b'\")\n            ...\n            ...     @staticmethod\n            ...     def evaluate(x, a, b):\n            ...         return a * x + b\n            ...\n            >>> m = TestModel(a=1, b=2)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n            >>> m = TestModel(a=2, b=2)\n            >>> m.a = 0  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n\n        On bound parameters this property returns the validator method itself,\n        as a bound method on the `Parameter`.  This is not often as useful, but\n        it allows validating a parameter value without setting that parameter::\n\n            >>> m.a.validator(42)  # Passes\n            >>> m.a.validator(-42)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n        \"\"\"\n\n        if self._model is None:\n            # For unbound parameters return the validator setter\n            def validator(func, self=self):\n                self._validator = func\n                return self\n\n            return validator\n        else:\n            # Return the validator method, bound to the Parameter instance with\n            # the name \"validator\"\n            def validator(self, value):\n                if self._validator is not None:\n                    return self._validator(self._model, value)\n\n            return types.MethodType(validator, self)\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):\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 _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\n        return self._get_model_value(self._model)\n\n    def _bind(self, model):\n        \"\"\"\n        Bind the `Parameter` to a specific `Model` instance; don't use this\n        directly on *unbound* parameters, i.e. `Parameter` descriptors that\n        are defined in class bodies.\n        \"\"\"\n\n        self._model = model\n        self._getter = self._create_value_wrapper(self._getter, model)\n        self._setter = self._create_value_wrapper(self._setter, model)\n\n    # TODO: These methods should probably be moved to the Model class, since it\n    # has entirely to do with details of how the model stores parameters.\n    # Parameter should just act as a user front-end to this.\n    def _get_model_value(self, model):\n        \"\"\"\n        This method implements how to retrieve the value of this parameter from\n        the model instance.  See also `Parameter._set_model_value`.\n\n        These methods take an explicit model argument rather than using\n        self._model so that they can be used from unbound `Parameter`\n        instances.\n        \"\"\"\n\n        if not hasattr(model, '_parameters'):\n            # The _parameters array hasn't been initialized yet; just translate\n            # this to an AttributeError\n            raise AttributeError(self._name)\n\n        # Use the _param_metrics to extract the parameter value from the\n        # _parameters array\n        param_metrics = model._param_metrics[self._name]\n        param_slice = param_metrics['slice']\n        param_shape = param_metrics['shape']\n        value = model._parameters[param_slice]\n        if param_shape:\n            value = value.reshape(param_shape)\n        else:\n            value = value[0]\n\n        return value\n\n    def _set_model_value(self, model, value):\n        \"\"\"\n        This method implements how to store the value of a parameter on the\n        model instance.\n\n        Currently there is only one storage mechanism (via the ._parameters\n        array) but other mechanisms may be desireable, in which case really the\n        model class itself should dictate this and *not* `Parameter` itself.\n        \"\"\"\n        def _update_parameter_value(model, name, value):\n            # TODO: Maybe handle exception on invalid input shape\n            param_metrics = model._param_metrics[name]\n            param_slice = param_metrics['slice']\n            param_shape = param_metrics['shape']\n            param_size = np.prod(param_shape)\n\n            if np.size(value) != param_size:\n                raise InputParameterError(\n                    \"Input value for parameter {0!r} does not have {1} elements \"\n                    \"as the current value does\".format(name, param_size))\n\n            model._parameters[param_slice] = np.array(value).ravel()\n        _update_parameter_value(model, self._name, value)\n        if hasattr(model, \"_param_map\"):\n            submodel_ind, param_name = model._param_map[self._name]\n            if hasattr(model._submodels[submodel_ind], \"_param_metrics\"):\n                _update_parameter_value(model._submodels[submodel_ind], param_name, value)\n\n    @staticmethod\n    def _create_value_wrapper(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\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, params = get_inputs_and_params(wrapper)\n            nargs = len(inputs)\n\n            if nargs == 1:\n                pass\n            elif nargs == 2:\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        if self._model is None:\n            return True\n        else:\n            return bool(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    __div__ = _binary_arithmetic_operation(operator.truediv)\n    __rdiv__ = _binary_arithmetic_operation(operator.truediv, reflected=True)\n    __truediv__ = _binary_arithmetic_operation(operator.truediv)\n    __rtruediv__ = _binary_arithmetic_operation(operator.truediv, 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 = '{0} {1!s}'.format(out, param.unit)\n    return out\n"},{"className":"ParameterError","col":0,"comment":"Generic exception class for all exceptions pertaining to Parameters.","endLoc":29,"id":9954,"nodeType":"Class","startLoc":28,"text":"class ParameterError(Exception):\n    \"\"\"Generic exception class for all exceptions pertaining to Parameters.\"\"\""},{"className":"InputParameterError","col":0,"comment":"Used for incorrect input parameter values and definitions.","endLoc":33,"id":9955,"nodeType":"Class","startLoc":32,"text":"class InputParameterError(ValueError, ParameterError):\n    \"\"\"Used for incorrect input parameter values and definitions.\"\"\""},{"col":4,"comment":"null","endLoc":2982,"header":"def signature(self)","id":9956,"name":"signature","nodeType":"Function","startLoc":2960,"text":"def signature(self):\n        try:\n            from hashlib import md5\n        except ImportError:\n            from md5 import md5\n        try:\n            sig = md5()\n            if self.start:\n                sig.update(self.start.encode('latin-1'))\n            if self.prec:\n                sig.update(''.join([''.join(p) for p in self.prec]).encode('latin-1'))\n            if self.tokens:\n                sig.update(' '.join(self.tokens).encode('latin-1'))\n            for f in self.pfuncs:\n                if f[3]:\n                    sig.update(f[3].encode('latin-1'))\n        except (TypeError, ValueError):\n            pass\n\n        digest = base64.b16encode(sig.digest())\n        if sys.version_info[0] >= 3:\n            digest = digest.decode('latin-1')\n        return digest"},{"className":"ParameterDefinitionError","col":0,"comment":"Exception in declaration of class-level Parameters.","endLoc":37,"id":9957,"nodeType":"Class","startLoc":36,"text":"class ParameterDefinitionError(ParameterError):\n    \"\"\"Exception in declaration of class-level Parameters.\"\"\""},{"col":0,"comment":"null","endLoc":89,"header":"def _binary_arithmetic_operation(op, reflected=False)","id":9958,"name":"_binary_arithmetic_operation","nodeType":"Function","startLoc":72,"text":"def _binary_arithmetic_operation(op, reflected=False):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self._model is None:\n            return NotImplemented\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"},{"col":4,"comment":"The shape of this parameter's value array.","endLoc":511,"header":"@property\n    def shape(self)","id":9959,"name":"shape","nodeType":"Function","startLoc":491,"text":"@property\n    def shape(self):\n        \"\"\"The shape of this parameter's value array.\"\"\"\n\n        if self._model is None:\n            raise AttributeError('Parameter definition does not have a '\n                                 'shape.')\n\n        shape = self._model._param_metrics[self._name]['shape']\n\n        if len(self._model) > 1:\n            # If we are dealing with a model *set* the shape is the shape of\n            # the parameter within a single model in the set\n            model_axis = self._model._model_set_axis\n\n            if model_axis < 0:\n                model_axis = len(shape) + model_axis\n\n            shape = shape[:model_axis] + shape[model_axis + 1:]\n\n        return shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":915,"id":9960,"name":"models","nodeType":"Attribute","startLoc":915,"text":"self.models"},{"attributeType":"null","col":8,"comment":"null","endLoc":924,"id":9961,"name":"ndim","nodeType":"Attribute","startLoc":924,"text":"self.ndim"},{"col":4,"comment":"The size of this parameter's value array.","endLoc":520,"header":"@property\n    def size(self)","id":9962,"name":"size","nodeType":"Function","startLoc":513,"text":"@property\n    def size(self):\n        \"\"\"The size of this parameter's value array.\"\"\"\n\n        # TODO: Rather than using self.value this could be determined from the\n        # size of the parameter in _param_metrics\n\n        return np.size(self.value)"},{"col":4,"comment":"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        ","endLoc":532,"header":"@property\n    def fixed(self)","id":9963,"name":"fixed","nodeType":"Function","startLoc":522,"text":"@property\n    def fixed(self):\n        \"\"\"\n        Boolean indicating if the parameter is kept fixed during fitting.\n        \"\"\"\n\n        if self._model is not None:\n            fixed = self._model._constraints['fixed']\n            return fixed.get(self._name, self._fixed)\n        else:\n            return self._fixed"},{"attributeType":"null","col":8,"comment":"null","endLoc":917,"id":9964,"name":"jointparams","nodeType":"Attribute","startLoc":917,"text":"self.jointparams"},{"attributeType":"null","col":8,"comment":"null","endLoc":919,"id":9965,"name":"fitparams","nodeType":"Attribute","startLoc":919,"text":"self.fitparams"},{"attributeType":"null","col":8,"comment":"null","endLoc":922,"id":9966,"name":"modeldims","nodeType":"Attribute","startLoc":922,"text":"self.modeldims"},{"attributeType":"null","col":8,"comment":"null","endLoc":916,"id":9967,"name":"initvals","nodeType":"Attribute","startLoc":916,"text":"self.initvals"},{"col":4,"comment":"Fix a parameter","endLoc":543,"header":"@fixed.setter\n    def fixed(self, value)","id":9968,"name":"fixed","nodeType":"Function","startLoc":534,"text":"@fixed.setter\n    def fixed(self, value):\n        \"\"\"Fix a parameter\"\"\"\n        if self._model is not None:\n            if not isinstance(value, bool):\n                raise TypeError(\"Fixed can be True or False\")\n            self._model._constraints['fixed'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'fixed' on Parameter \"\n                                 \"definition\")"},{"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":180,"header":"def fitter_unit_support(func)","id":9969,"name":"fitter_unit_support","nodeType":"Function","startLoc":91,"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\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['x'], equivalencies=input_units_equivalencies['x'])\n                    if isinstance(y, Quantity) and z is not None:\n                        y = y.to(model.input_units['y'], equivalencies=input_units_equivalencies['y'])\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\n                model = model.without_units_for_data(x=x, y=y, z=z)\n\n                # We strip away the units from the input itself\n\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(y, Quantity):\n                        add_back_units = True\n                        zdata = z.value\n                    else:\n                        zdata = np.asarray(z)\n\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(x=x, y=y, z=z)\n\n                return model_new\n\n            else:\n\n                raise NotImplementedError(\"This model does not support being fit to data with units\")\n\n        else:\n\n            return func(self, model, x, y, z=z, **kwargs)\n\n    return wrapper"},{"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":557,"header":"@property\n    def tied(self)","id":9970,"name":"tied","nodeType":"Function","startLoc":545,"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        if self._model is not None:\n            tied = self._model._constraints['tied']\n            return tied.get(self._name, self._tied)\n        else:\n            return self._tied"},{"col":4,"comment":"Tie a parameter","endLoc":569,"header":"@tied.setter\n    def tied(self, value)","id":9971,"name":"tied","nodeType":"Function","startLoc":559,"text":"@tied.setter\n    def tied(self, value):\n        \"\"\"Tie a parameter\"\"\"\n\n        if self._model is not None:\n            if not callable(value) and value not in (False, None):\n                raise TypeError(\"Tied must be a callable\")\n            self._model._constraints['tied'][self._name] = value\n        else:\n            raise AttributeError(\"can't set attribute 'tied' on Parameter \"\n                                 \"definition\")"},{"col":4,"comment":"The minimum and maximum values of a parameter as a tuple","endLoc":579,"header":"@property\n    def bounds(self)","id":9972,"name":"bounds","nodeType":"Function","startLoc":571,"text":"@property\n    def bounds(self):\n        \"\"\"The minimum and maximum values of a parameter as a tuple\"\"\"\n\n        if self._model is not None:\n            bounds = self._model._constraints['bounds']\n            return bounds.get(self._name, self._bounds)\n        else:\n            return self._bounds"},{"col":4,"comment":"Set the minimum and maximum values of a parameter from a tuple","endLoc":601,"header":"@bounds.setter\n    def bounds(self, value)","id":9973,"name":"bounds","nodeType":"Function","startLoc":581,"text":"@bounds.setter\n    def bounds(self, value):\n        \"\"\"Set the minimum and maximum values of a parameter from a tuple\"\"\"\n\n        if self._model is not None:\n            _min, _max = value\n            if _min is not None:\n                if not isinstance(_min, numbers.Number):\n                    raise TypeError(\"Min value must be a number\")\n                _min = float(_min)\n\n            if _max is not None:\n                if not isinstance(_max, numbers.Number):\n                    raise TypeError(\"Max value must be a number\")\n                _max = float(_max)\n\n            bounds = self._model._constraints.setdefault('bounds', {})\n            self._model._constraints['bounds'][self._name] = (_min, _max)\n        else:\n            raise AttributeError(\"can't set attribute 'bounds' on Parameter \"\n                                 \"definition\")"},{"col":4,"comment":"A value used as a lower bound when fitting a parameter","endLoc":607,"header":"@property\n    def min(self)","id":9974,"name":"min","nodeType":"Function","startLoc":603,"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":617,"header":"@min.setter\n    def min(self, value)","id":9975,"name":"min","nodeType":"Function","startLoc":609,"text":"@min.setter\n    def min(self, value):\n        \"\"\"Set a minimum value of a parameter\"\"\"\n\n        if self._model is not None:\n            self.bounds = (value, self.max)\n        else:\n            raise AttributeError(\"can't set attribute 'min' on Parameter \"\n                                 \"definition\")"},{"col":4,"comment":"A value used as an upper bound when fitting a parameter","endLoc":623,"header":"@property\n    def max(self)","id":9976,"name":"max","nodeType":"Function","startLoc":619,"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":633,"header":"@max.setter\n    def max(self, value)","id":9977,"name":"max","nodeType":"Function","startLoc":625,"text":"@max.setter\n    def max(self, value):\n        \"\"\"Set a maximum value of a parameter.\"\"\"\n\n        if self._model is not None:\n            self.bounds = (self.min, value)\n        else:\n            raise AttributeError(\"can't set attribute 'max' on Parameter \"\n                                 \"definition\")"},{"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        The decorator *returns* the `Parameter` instance that the validator\n        is set on, so the underlying validator method should have the same\n        name as the `Parameter` itself (think of this as analogous to\n        ``property.setter``).  For example::\n\n            >>> from astropy.modeling import Fittable1DModel\n            >>> class TestModel(Fittable1DModel):\n            ...     a = Parameter()\n            ...     b = Parameter()\n            ...\n            ...     @a.validator\n            ...     def a(self, value):\n            ...         # Remember, the value can be an array\n            ...         if np.any(value < self.b):\n            ...             raise InputParameterError(\n            ...                 \"parameter 'a' must be greater than or equal \"\n            ...                 \"to parameter 'b'\")\n            ...\n            ...     @staticmethod\n            ...     def evaluate(x, a, b):\n            ...         return a * x + b\n            ...\n            >>> m = TestModel(a=1, b=2)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n            >>> m = TestModel(a=2, b=2)\n            >>> m.a = 0  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n\n        On bound parameters this property returns the validator method itself,\n        as a bound method on the `Parameter`.  This is not often as useful, but\n        it allows validating a parameter value without setting that parameter::\n\n            >>> m.a.validator(42)  # Passes\n            >>> m.a.validator(-42)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n        ","endLoc":707,"header":"@property\n    def validator(self)","id":9978,"name":"validator","nodeType":"Function","startLoc":635,"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        The decorator *returns* the `Parameter` instance that the validator\n        is set on, so the underlying validator method should have the same\n        name as the `Parameter` itself (think of this as analogous to\n        ``property.setter``).  For example::\n\n            >>> from astropy.modeling import Fittable1DModel\n            >>> class TestModel(Fittable1DModel):\n            ...     a = Parameter()\n            ...     b = Parameter()\n            ...\n            ...     @a.validator\n            ...     def a(self, value):\n            ...         # Remember, the value can be an array\n            ...         if np.any(value < self.b):\n            ...             raise InputParameterError(\n            ...                 \"parameter 'a' must be greater than or equal \"\n            ...                 \"to parameter 'b'\")\n            ...\n            ...     @staticmethod\n            ...     def evaluate(x, a, b):\n            ...         return a * x + b\n            ...\n            >>> m = TestModel(a=1, b=2)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n            >>> m = TestModel(a=2, b=2)\n            >>> m.a = 0  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n\n        On bound parameters this property returns the validator method itself,\n        as a bound method on the `Parameter`.  This is not often as useful, but\n        it allows validating a parameter value without setting that parameter::\n\n            >>> m.a.validator(42)  # Passes\n            >>> m.a.validator(-42)  # doctest: +IGNORE_EXCEPTION_DETAIL\n            Traceback (most recent call last):\n            ...\n            InputParameterError: parameter 'a' must be greater than or equal\n            to parameter 'b'\n        \"\"\"\n\n        if self._model is None:\n            # For unbound parameters return the validator setter\n            def validator(func, self=self):\n                self._validator = func\n                return self\n\n            return validator\n        else:\n            # Return the validator method, bound to the Parameter instance with\n            # the name \"validator\"\n            def validator(self, value):\n                if self._validator is not None:\n                    return self._validator(self._model, value)\n\n            return types.MethodType(validator, self)"},{"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":742,"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)","id":9979,"name":"copy","nodeType":"Function","startLoc":709,"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):\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":"\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":757,"header":"@property\n    def _raw_value(self)","id":9980,"name":"_raw_value","nodeType":"Function","startLoc":744,"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\n        return self._get_model_value(self._model)"},{"col":4,"comment":"null","endLoc":872,"header":"def __array__(self, dtype=None)","id":9981,"name":"__array__","nodeType":"Function","startLoc":865,"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"},{"col":0,"comment":"null","endLoc":112,"header":"def _binary_comparison_operation(op)","id":9982,"name":"_binary_comparison_operation","nodeType":"Function","startLoc":92,"text":"def _binary_comparison_operation(op):\n    @functools.wraps(op)\n    def wrapper(self, val):\n\n        if self._model is None:\n            if op is operator.lt:\n                # Because OrderedDescriptor uses __lt__ to work, we need to\n                # call the super method, but only when not bound to an instance\n                # anyways\n                return super(self.__class__, self).__lt__(val)\n            else:\n                return NotImplemented\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":2933,"id":9983,"name":"grammar","nodeType":"Attribute","startLoc":2933,"text":"self.grammar"},{"col":0,"comment":"null","endLoc":128,"header":"def _unary_arithmetic_operation(op)","id":9984,"name":"_unary_arithmetic_operation","nodeType":"Function","startLoc":115,"text":"def _unary_arithmetic_operation(op):\n    @functools.wraps(op)\n    def wrapper(self):\n        if self._model is None:\n            return NotImplemented\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":3091,"id":9985,"name":"prec","nodeType":"Attribute","startLoc":3091,"text":"self.prec"},{"attributeType":"null","col":12,"comment":"null","endLoc":2939,"id":9986,"name":"log","nodeType":"Attribute","startLoc":2939,"text":"self.log"},{"attributeType":"null","col":8,"comment":"null","endLoc":3122,"id":9987,"name":"preclist","nodeType":"Attribute","startLoc":3122,"text":"self.preclist"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":9988,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"col":0,"comment":"","endLoc":8,"header":"parameters.py#<anonymous>","id":9989,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module defines two classes that deal with parameters.\n\nIt is unlikely users will need to work with these classes directly, unless they\ndefine their own models.\n\"\"\"\n\n__all__ = ['Parameter', 'InputParameterError', 'ParameterError']"},{"col":4,"comment":"null","endLoc":878,"header":"def __bool__(self)","id":9990,"name":"__bool__","nodeType":"Function","startLoc":874,"text":"def __bool__(self):\n        if self._model is None:\n            return True\n        else:\n            return bool(self.value)"},{"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).\n    ","endLoc":201,"id":9991,"name":"constraints","nodeType":"Attribute","startLoc":201,"text":"constraints"},{"attributeType":"None","col":8,"comment":"null","endLoc":2929,"id":9992,"name":"start","nodeType":"Attribute","startLoc":2929,"text":"self.start"},{"attributeType":"None","col":8,"comment":"null","endLoc":2931,"id":9993,"name":"tokens","nodeType":"Attribute","startLoc":2931,"text":"self.tokens"},{"attributeType":"None","col":8,"comment":"null","endLoc":2930,"id":9994,"name":"error_func","nodeType":"Attribute","startLoc":2930,"text":"self.error_func"},{"attributeType":"null","col":8,"comment":"null","endLoc":2934,"id":9995,"name":"error","nodeType":"Attribute","startLoc":2934,"text":"self.error"},{"fileName":"__init__.py","filePath":"astropy/modeling","id":9996,"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"},{"col":0,"comment":"","endLoc":8,"header":"__init__.py#<anonymous>","id":9997,"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\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":209,"id":9998,"name":"_class_attribute_","nodeType":"Attribute","startLoc":209,"text":"_class_attribute_"},{"fileName":"setup_package.py","filePath":"astropy/modeling","id":9999,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom os.path import join\n\nfrom distutils.core import Extension\nfrom distutils import log\n\nfrom astropy_helpers import setup_helpers, utils\nfrom astropy_helpers.version_helpers import get_pkg_version_module\n\nwcs_setup_package = utils.import_file(join('astropy', 'wcs', 'setup_package.py'))\n\n\nMODELING_ROOT = os.path.relpath(os.path.dirname(__file__))\nMODELING_SRC = join(MODELING_ROOT, 'src')\nSRC_FILES = [join(MODELING_SRC, 'projections.c.templ'),\n             __file__]\nGEN_FILES = [join(MODELING_SRC, 'projections.c')]\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\n\ndef pre_build_py_hook(cmd_obj):\n    preprocess_source()\n\n\ndef pre_build_ext_hook(cmd_obj):\n    preprocess_source()\n\n\ndef pre_sdist_hook(cmd_obj):\n    preprocess_source()\n\n\ndef preprocess_source():\n    # TODO: Move this to setup_helpers\n\n    # Generating the wcslib wrappers should only be done if needed. This also\n    # ensures that it is not done for any release tarball since those will\n    # include core.py and core.c.\n    if all(os.path.exists(filename) for filename in GEN_FILES):\n        # Determine modification times\n        src_mtime = max(os.path.getmtime(filename) for filename in SRC_FILES)\n        gen_mtime = min(os.path.getmtime(filename) for filename in GEN_FILES)\n\n        version = get_pkg_version_module('astropy')\n\n        if gen_mtime > src_mtime:\n            # If generated source is recent enough, don't update\n            return\n        elif version.release:\n            # or, if we're on a release, issue a warning, but go ahead and use\n            # the wrappers anyway\n            log.warn('WARNING: The autogenerated wrappers in '\n                     'astropy.modeling._projections seem to be older '\n                     'than the source templates used to create '\n                     'them. Because this is a release version we will '\n                     'use them anyway, but this might be a sign of '\n                     'some sort of version mismatch or other '\n                     'tampering. Or it might just mean you moved '\n                     'some files around or otherwise accidentally '\n                     'changed timestamps.')\n            return\n        # otherwise rebuild the autogenerated files\n\n        # If jinja2 isn't present, then print a warning and use existing files\n        try:\n            import jinja2  # pylint: disable=W0611\n        except ImportError:\n            log.warn(\"WARNING: jinja2 could not be imported, so the existing \"\n                     \"modeling _projections.c file will be used\")\n            return\n\n    from jinja2 import Environment, FileSystemLoader\n\n    # Prepare the jinja2 templating environment\n    env = Environment(loader=FileSystemLoader(MODELING_SRC))\n\n    c_in = env.get_template('projections.c.templ')\n    c_out = c_in.render(projections=projections)\n\n    with open(join(MODELING_SRC, 'projections.c'), 'w') as fd:\n        fd.write(c_out)\n\n\ndef get_package_data():\n    return {\n        'astropy.modeling.tests': ['data/*.fits', 'data/*.hdr',\n                                   '../../wcs/tests/maps/*.hdr']\n    }\n\n\ndef get_extensions():\n    wcslib_files = [  # List of wcslib files to compile\n        'prj.c',\n        'wcserr.c',\n        'wcsprintf.c',\n        'wcsutil.c'\n    ]\n\n    wcslib_config_paths = [\n        join(MODELING_SRC, 'wcsconfig.h')\n    ]\n\n    cfg = setup_helpers.DistutilsExtensionArgs()\n\n    wcs_setup_package.get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)\n\n    cfg['include_dirs'].append(MODELING_SRC)\n\n    astropy_files = [  # List of astropy.modeling files to compile\n        'projections.c'\n    ]\n    cfg['sources'].extend(join(MODELING_SRC, x) for x in astropy_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    return [Extension(str('astropy.modeling._projections'), **cfg)]\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":3143,"id":10000,"name":"pfuncs","nodeType":"Attribute","startLoc":3143,"text":"self.pfuncs"},{"attributeType":"null","col":8,"comment":"null","endLoc":2932,"id":10001,"name":"modules","nodeType":"Attribute","startLoc":2932,"text":"self.modules"},{"attributeType":"null","col":8,"comment":"null","endLoc":2928,"id":10002,"name":"pdict","nodeType":"Attribute","startLoc":2928,"text":"self.pdict"},{"col":0,"comment":"null","endLoc":177,"header":"def errok()","id":10003,"name":"errok","nodeType":"Function","startLoc":175,"text":"def errok():\n    warnings.warn(_warnmsg)\n    return _errok()"},{"attributeType":"null","col":4,"comment":"null","endLoc":210,"id":10004,"name":"_name_attribute_","nodeType":"Attribute","startLoc":210,"text":"_name_attribute_"},{"attributeType":"null","col":4,"comment":"null","endLoc":880,"id":10005,"name":"__add__","nodeType":"Attribute","startLoc":880,"text":"__add__"},{"attributeType":"null","col":4,"comment":"null","endLoc":881,"id":10006,"name":"__radd__","nodeType":"Attribute","startLoc":881,"text":"__radd__"},{"col":0,"comment":"null","endLoc":181,"header":"def restart()","id":10007,"name":"restart","nodeType":"Function","startLoc":179,"text":"def restart():\n    warnings.warn(_warnmsg)\n    return _restart()"},{"attributeType":"null","col":4,"comment":"null","endLoc":882,"id":10008,"name":"__sub__","nodeType":"Attribute","startLoc":882,"text":"__sub__"},{"col":0,"comment":"null","endLoc":185,"header":"def token()","id":10009,"name":"token","nodeType":"Function","startLoc":183,"text":"def token():\n    warnings.warn(_warnmsg)\n    return _token()"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":10010,"name":"__version__","nodeType":"Attribute","startLoc":70,"text":"__version__"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":10011,"name":"__tabversion__","nodeType":"Attribute","startLoc":71,"text":"__tabversion__"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":10012,"name":"yaccdebug","nodeType":"Attribute","startLoc":79,"text":"yaccdebug"},{"attributeType":"null","col":0,"comment":"null","endLoc":82,"id":10013,"name":"debug_file","nodeType":"Attribute","startLoc":82,"text":"debug_file"},{"attributeType":"null","col":4,"comment":"null","endLoc":883,"id":10014,"name":"__rsub__","nodeType":"Attribute","startLoc":883,"text":"__rsub__"},{"attributeType":"null","col":0,"comment":"null","endLoc":83,"id":10015,"name":"tab_module","nodeType":"Attribute","startLoc":83,"text":"tab_module"},{"attributeType":"null","col":0,"comment":"null","endLoc":84,"id":10016,"name":"default_lr","nodeType":"Attribute","startLoc":84,"text":"default_lr"},{"attributeType":"null","col":0,"comment":"null","endLoc":86,"id":10017,"name":"error_count","nodeType":"Attribute","startLoc":86,"text":"error_count"},{"attributeType":"null","col":0,"comment":"null","endLoc":88,"id":10018,"name":"yaccdevel","nodeType":"Attribute","startLoc":88,"text":"yaccdevel"},{"attributeType":"null","col":0,"comment":"null","endLoc":91,"id":10019,"name":"resultlimit","nodeType":"Attribute","startLoc":91,"text":"resultlimit"},{"attributeType":"null","col":0,"comment":"null","endLoc":93,"id":10020,"name":"pickle_protocol","nodeType":"Attribute","startLoc":93,"text":"pickle_protocol"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":10021,"name":"string_types","nodeType":"Attribute","startLoc":97,"text":"string_types"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":10022,"name":"string_types","nodeType":"Attribute","startLoc":99,"text":"string_types"},{"attributeType":"null","col":0,"comment":"null","endLoc":101,"id":10023,"name":"MAXINT","nodeType":"Attribute","startLoc":101,"text":"MAXINT"},{"attributeType":"null","col":4,"comment":"null","endLoc":884,"id":10024,"name":"__mul__","nodeType":"Attribute","startLoc":884,"text":"__mul__"},{"attributeType":"None","col":0,"comment":"null","endLoc":161,"id":10025,"name":"_errok","nodeType":"Attribute","startLoc":161,"text":"_errok"},{"attributeType":"None","col":0,"comment":"null","endLoc":162,"id":10026,"name":"_token","nodeType":"Attribute","startLoc":162,"text":"_token"},{"attributeType":"None","col":0,"comment":"null","endLoc":163,"id":10027,"name":"_restart","nodeType":"Attribute","startLoc":163,"text":"_restart"},{"attributeType":"null","col":0,"comment":"null","endLoc":164,"id":10028,"name":"_warnmsg","nodeType":"Attribute","startLoc":164,"text":"_warnmsg"},{"attributeType":"null","col":0,"comment":"null","endLoc":1283,"id":10029,"name":"_is_identifier","nodeType":"Attribute","startLoc":1283,"text":"_is_identifier"},{"col":0,"comment":"","endLoc":62,"header":"yacc.py#<anonymous>","id":10030,"name":"<anonymous>","nodeType":"Function","startLoc":62,"text":"__version__    = '3.9'\n\n__tabversion__ = '3.8'\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":"null","endLoc":885,"id":10031,"name":"__rmul__","nodeType":"Attribute","startLoc":885,"text":"__rmul__"},{"fileName":"mappings.py","filePath":"astropy/modeling","id":10032,"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\nfrom .core import FittableModel\n\n\n__all__ = ['Mapping', 'Identity']\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:`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        if n_inputs is None:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(max(mapping) + 1))\n        else:\n            self._inputs = tuple('x' + str(idx)\n                                 for idx in range(n_inputs))\n        self._outputs = tuple('x' + str(idx) for idx in range(len(mapping)))\n        self._mapping = mapping\n        super().__init__(name=name, meta=meta)\n\n    @property\n    def inputs(self):\n        \"\"\"\n        The name(s) of the input variable(s) on which a model is evaluated.\n        \"\"\"\n\n        return self._inputs\n\n    @property\n    def outputs(self):\n        \"\"\"The name(s) of the output(s) of the model.\"\"\"\n\n        return self._outputs\n\n    @property\n    def mapping(self):\n        \"\"\"Integers representing indices of the inputs.\"\"\"\n\n        return self._mapping\n\n    def __repr__(self):\n        if self.name is None:\n            return '<Mapping({0})>'.format(self.mapping)\n        else:\n            return '<Mapping({0}, name={1})>'.format(self.mapping, self.name)\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('{0} expects {1} inputs; got {2}'.format(\n                name, self.n_inputs, 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 {0} 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        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 '<Identity({0})>'.format(self.n_inputs)\n        else:\n            return '<Identity({0}, name={1})>'.format(self.n_inputs, self.name)\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"},{"col":0,"comment":"null","endLoc":59,"header":"def pre_build_py_hook(cmd_obj)","id":10033,"name":"pre_build_py_hook","nodeType":"Function","startLoc":58,"text":"def pre_build_py_hook(cmd_obj):\n    preprocess_source()"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":10034,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"mappings.py#<anonymous>","id":10035,"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']"},{"attributeType":"null","col":4,"comment":"null","endLoc":886,"id":10036,"name":"__pow__","nodeType":"Attribute","startLoc":886,"text":"__pow__"},{"fileName":"rotations.py","filePath":"astropy/modeling","id":10037,"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\nimport math\n\nimport numpy as np\n\nfrom .core import Model\nfrom .parameters import Parameter\nfrom ..coordinates.matrix_utilities import rotation_matrix, matrix_product\nfrom .. import units as u\nfrom ..utils.decorators import deprecated\nfrom .utils import _to_radian, _to_orig_unit\n\n__all__ = ['RotateCelestial2Native', 'RotateNative2Celestial', 'Rotation2D',\n           'EulerAngleRotation']\n\n\nclass _EulerRotation:\n    \"\"\"\n    Base class which does the actual computation.\n    \"\"\"\n\n    _separable = False\n\n    def _create_matrix(self, phi, theta, psi, axes_order):\n        matrices = []\n        for angle, axis in zip([phi, theta, psi], axes_order):\n            if isinstance(angle, u.Quantity):\n                angle = angle.value\n            angle = np.asscalar(angle)\n            matrices.append(rotation_matrix(angle, axis, unit=u.rad))\n        result = matrix_product(*matrices[::-1])\n        return result\n\n    @staticmethod\n    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])\n\n    @staticmethod\n    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\n\n    @deprecated(2.0)\n    @staticmethod\n    def rotation_matrix_from_angle(angle):\n        \"\"\"\n        Clockwise rotation matrix.\n\n        Parameters\n        ----------\n        angle : float\n            Rotation angle in radians.\n        \"\"\"\n        return np.array([[math.cos(angle), math.sin(angle)],\n                         [-math.sin(angle), math.cos(angle)]])\n\n    def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray) and alpha.ndim == 2:\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = self.spherical2cartesian(alpha, delta)\n        matrix = self._create_matrix(phi, theta, psi, axes_order)\n        result = np.dot(matrix, inp)\n        a, b = self.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 {'alpha': u.deg, 'delta': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha': u.deg, 'delta': 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`\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    inputs = ('alpha', 'delta')\n    outputs = ('alpha', 'delta')\n\n    phi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    theta = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    psi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\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 {0}\".format(axes_order))\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, 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\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)\n    lat = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    lon_pole = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\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 or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    \"\"\"\n\n    #: Inputs are angles on the native sphere\n    inputs = ('phi_N', 'theta_N')\n\n    #: Outputs are angles on the celestial sphere\n    outputs = ('alpha_C', 'delta_C')\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n    def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles in the Native coordinate system.\n        lon, lat, lon_pole : float (in deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles on the Celestial sphere.\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 or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    \"\"\"\n\n    #: Inputs are angles on the celestial sphere\n    inputs = ('alpha_C', 'delta_C')\n\n    #: Outputs are angles on the native sphere\n    outputs = ('phi_N', 'theta_N')\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n    def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles in the Celestial coordinate frame.\n        lon, lat, lon_pole : float (deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles on the Native sphere.\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`\n        Angle of rotation (if float it should be in deg).\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('x', 'y')\n    _separable = False\n\n    angle = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\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 : ndarray-like\n            Input quantities\n        angle : float (deg) or `~astropy.units.Quantity`\n            Angle of rotations.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\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        if isinstance(x, u.Quantity):\n            unit = x.unit\n        else:\n            unit = None\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.value\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 unit is not None:\n            return u.Quantity(x, unit=unit), u.Quantity(y, unit=unit)\n        else:\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":887,"id":10038,"name":"__rpow__","nodeType":"Attribute","startLoc":887,"text":"__rpow__"},{"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":755,"header":"def to_original_position(self, cutout_position)","id":10039,"name":"to_original_position","nodeType":"Function","startLoc":738,"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":774,"header":"def to_cutout_position(self, original_position)","id":10040,"name":"to_cutout_position","nodeType":"Function","startLoc":757,"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])"},{"attributeType":"null","col":4,"comment":"null","endLoc":888,"id":10041,"name":"__div__","nodeType":"Attribute","startLoc":888,"text":"__div__"},{"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":814,"header":"def plot_on_original(self, ax=None, fill=False, **kwargs)","id":10042,"name":"plot_on_original","nodeType":"Function","startLoc":776,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":889,"id":10043,"name":"__rdiv__","nodeType":"Attribute","startLoc":889,"text":"__rdiv__"},{"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\n    entry_points : a list of `~pkg_resources.EntryPoint`\n                  entry_points are objects which encapsulate\n                  importable objects and are defined on the\n                  installation of a package.\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    ","endLoc":1261,"header":"def populate_entry_points(entry_points)","id":10044,"name":"populate_entry_points","nodeType":"Function","startLoc":1221,"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\n    entry_points : a list of `~pkg_resources.EntryPoint`\n                  entry_points are objects which encapsulate\n                  importable objects and are defined on the\n                  installation of a package.\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\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('{type} error occurred in entry '\n                                             'point {name}.' .format(type=type(e).__name__, name=name)))\n        else:\n            if not inspect.isclass(entry_point):\n                warnings.warn(AstropyUserWarning(\n                    'Modeling entry point {0} expected to be a '\n                    'Class.' .format(name)))\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 {0} expected to extend '\n                        'astropy.modeling.Fitter' .format(name)))"},{"attributeType":"null","col":4,"comment":"null","endLoc":890,"id":10045,"name":"__truediv__","nodeType":"Attribute","startLoc":890,"text":"__truediv__"},{"col":0,"comment":"null","endLoc":118,"header":"def preprocess_source()","id":10046,"name":"preprocess_source","nodeType":"Function","startLoc":70,"text":"def preprocess_source():\n    # TODO: Move this to setup_helpers\n\n    # Generating the wcslib wrappers should only be done if needed. This also\n    # ensures that it is not done for any release tarball since those will\n    # include core.py and core.c.\n    if all(os.path.exists(filename) for filename in GEN_FILES):\n        # Determine modification times\n        src_mtime = max(os.path.getmtime(filename) for filename in SRC_FILES)\n        gen_mtime = min(os.path.getmtime(filename) for filename in GEN_FILES)\n\n        version = get_pkg_version_module('astropy')\n\n        if gen_mtime > src_mtime:\n            # If generated source is recent enough, don't update\n            return\n        elif version.release:\n            # or, if we're on a release, issue a warning, but go ahead and use\n            # the wrappers anyway\n            log.warn('WARNING: The autogenerated wrappers in '\n                     'astropy.modeling._projections seem to be older '\n                     'than the source templates used to create '\n                     'them. Because this is a release version we will '\n                     'use them anyway, but this might be a sign of '\n                     'some sort of version mismatch or other '\n                     'tampering. Or it might just mean you moved '\n                     'some files around or otherwise accidentally '\n                     'changed timestamps.')\n            return\n        # otherwise rebuild the autogenerated files\n\n        # If jinja2 isn't present, then print a warning and use existing files\n        try:\n            import jinja2  # pylint: disable=W0611\n        except ImportError:\n            log.warn(\"WARNING: jinja2 could not be imported, so the existing \"\n                     \"modeling _projections.c file will be used\")\n            return\n\n    from jinja2 import Environment, FileSystemLoader\n\n    # Prepare the jinja2 templating environment\n    env = Environment(loader=FileSystemLoader(MODELING_SRC))\n\n    c_in = env.get_template('projections.c.templ')\n    c_out = c_in.render(projections=projections)\n\n    with open(join(MODELING_SRC, 'projections.c'), 'w') as fd:\n        fd.write(c_out)"},{"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":825,"header":"@staticmethod\n    def _calc_center(slices)","id":10047,"name":"_calc_center","nodeType":"Function","startLoc":816,"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])"},{"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":837,"header":"@staticmethod\n    def _calc_bbox(slices)","id":10048,"name":"_calc_bbox","nodeType":"Function","startLoc":827,"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":847,"header":"@lazyproperty\n    def origin_original(self)","id":10049,"name":"origin_original","nodeType":"Function","startLoc":839,"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":856,"header":"@lazyproperty\n    def origin_cutout(self)","id":10050,"name":"origin_cutout","nodeType":"Function","startLoc":849,"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        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the original array.\n        ","endLoc":865,"header":"@lazyproperty\n    def position_original(self)","id":10051,"name":"position_original","nodeType":"Function","startLoc":858,"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 (_round(self.input_position_original[0]),\n                _round(self.input_position_original[1]))"},{"attributeType":"null","col":4,"comment":"null","endLoc":891,"id":10052,"name":"__rtruediv__","nodeType":"Attribute","startLoc":891,"text":"__rtruediv__"},{"col":4,"comment":"\n        The ``(x, y)`` position index (rounded to the nearest pixel) in\n        the cutout array.\n        ","endLoc":874,"header":"@lazyproperty\n    def position_cutout(self)","id":10053,"name":"position_cutout","nodeType":"Function","startLoc":867,"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 (_round(self.input_position_cutout[0]),\n                _round(self.input_position_cutout[1]))"},{"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":883,"header":"@lazyproperty\n    def center_original(self)","id":10054,"name":"center_original","nodeType":"Function","startLoc":876,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":892,"id":10055,"name":"__eq__","nodeType":"Attribute","startLoc":892,"text":"__eq__"},{"attributeType":"null","col":4,"comment":"null","endLoc":893,"id":10056,"name":"__ne__","nodeType":"Attribute","startLoc":893,"text":"__ne__"},{"attributeType":"null","col":4,"comment":"null","endLoc":894,"id":10057,"name":"__lt__","nodeType":"Attribute","startLoc":894,"text":"__lt__"},{"attributeType":"null","col":4,"comment":"null","endLoc":895,"id":10058,"name":"__gt__","nodeType":"Attribute","startLoc":895,"text":"__gt__"},{"col":0,"comment":"\n    Generate matrices for rotation by some angle around some axis.\n\n    Parameters\n    ----------\n    angle : convertible to `Angle`\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 : UnitBase, 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":98,"header":"def rotation_matrix(angle, axis='z', unit=None)","id":10059,"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 : convertible to `Angle`\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 : UnitBase, 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 unit is None:\n        unit = u.degree\n\n    angle = Angle(angle, unit=unit)\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(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":4,"comment":"null","endLoc":896,"id":10060,"name":"__le__","nodeType":"Attribute","startLoc":896,"text":"__le__"},{"attributeType":"null","col":4,"comment":"null","endLoc":43,"id":10061,"name":"HAS_PKG","nodeType":"Attribute","startLoc":43,"text":"HAS_PKG"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":10062,"name":"__all__","nodeType":"Attribute","startLoc":48,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":10063,"name":"STATISTICS","nodeType":"Attribute","startLoc":53,"text":"STATISTICS"},{"attributeType":"null","col":4,"comment":"null","endLoc":897,"id":10064,"name":"__ge__","nodeType":"Attribute","startLoc":897,"text":"__ge__"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":10065,"name":"OPTIMIZERS","nodeType":"Attribute","startLoc":56,"text":"OPTIMIZERS"},{"col":0,"comment":"","endLoc":22,"header":"fitting.py#<anonymous>","id":10066,"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\ntry:\n    from pkg_resources import iter_entry_points\n    HAS_PKG = True\nexcept ImportError:\n    HAS_PKG = False\n\n__all__ = ['LinearLSQFitter', 'LevMarLSQFitter', 'FittingWithOutlierRemoval',\n           'SLSQPLSQFitter', 'SimplexLSQFitter', 'JointFitter', 'Fitter']\n\nSTATISTICS = [leastsquare]\n\nOPTIMIZERS = [Simplex, SLSQP]\n\nif HAS_PKG:\n    populate_entry_points(iter_entry_points(group='astropy.modeling', name=None))"},{"attributeType":"null","col":4,"comment":"null","endLoc":898,"id":10067,"name":"__neg__","nodeType":"Attribute","startLoc":898,"text":"__neg__"},{"attributeType":"null","col":4,"comment":"null","endLoc":899,"id":10068,"name":"__abs__","nodeType":"Attribute","startLoc":899,"text":"__abs__"},{"fileName":"powerlaws.py","filePath":"astropy/modeling","id":10069,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nPower law model variants\n\"\"\"\n\n\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .core import Fittable1DModel\nfrom .parameters import Parameter, InputParameterError\nfrom ..units import Quantity\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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_break = Parameter(default=1)\n    alpha_1 = Parameter(default=1)\n    alpha_2 = Parameter(default=1)\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        else:\n            return {'x': self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_break = Parameter(default=1)\n    alpha_1 = Parameter(default=-2)\n    alpha_2 = Parameter(default=2)\n    delta = Parameter(default=1, min=1.e-3)\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        else:\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        else:\n            return {'x': self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\n    x_cutoff = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('x_cutoff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\n    beta = Parameter(default=0)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":230,"id":10070,"name":"_default","nodeType":"Attribute","startLoc":230,"text":"self._default"},{"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":892,"header":"@lazyproperty\n    def center_cutout(self)","id":10071,"name":"center_cutout","nodeType":"Function","startLoc":885,"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":0,"comment":"null","endLoc":63,"header":"def pre_build_ext_hook(cmd_obj)","id":10072,"name":"pre_build_ext_hook","nodeType":"Function","startLoc":62,"text":"def pre_build_ext_hook(cmd_obj):\n    preprocess_source()"},{"col":0,"comment":"null","endLoc":67,"header":"def pre_sdist_hook(cmd_obj)","id":10073,"name":"pre_sdist_hook","nodeType":"Function","startLoc":66,"text":"def pre_sdist_hook(cmd_obj):\n    preprocess_source()"},{"col":0,"comment":"null","endLoc":125,"header":"def get_package_data()","id":10074,"name":"get_package_data","nodeType":"Function","startLoc":121,"text":"def get_package_data():\n    return {\n        'astropy.modeling.tests': ['data/*.fits', 'data/*.hdr',\n                                   '../../wcs/tests/maps/*.hdr']\n    }"},{"col":0,"comment":"null","endLoc":154,"header":"def get_extensions()","id":10075,"name":"get_extensions","nodeType":"Function","startLoc":128,"text":"def get_extensions():\n    wcslib_files = [  # List of wcslib files to compile\n        'prj.c',\n        'wcserr.c',\n        'wcsprintf.c',\n        'wcsutil.c'\n    ]\n\n    wcslib_config_paths = [\n        join(MODELING_SRC, 'wcsconfig.h')\n    ]\n\n    cfg = setup_helpers.DistutilsExtensionArgs()\n\n    wcs_setup_package.get_wcslib_cfg(cfg, wcslib_files, wcslib_config_paths)\n\n    cfg['include_dirs'].append(MODELING_SRC)\n\n    astropy_files = [  # List of astropy.modeling files to compile\n        'projections.c'\n    ]\n    cfg['sources'].extend(join(MODELING_SRC, x) for x in astropy_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    return [Extension(str('astropy.modeling._projections'), **cfg)]"},{"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":902,"header":"@lazyproperty\n    def bbox_original(self)","id":10076,"name":"bbox_original","nodeType":"Function","startLoc":894,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":245,"id":10077,"name":"_tied","nodeType":"Attribute","startLoc":245,"text":"self._tied"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":10078,"name":"wcs_setup_package","nodeType":"Attribute","startLoc":12,"text":"wcs_setup_package"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":10079,"name":"MODELING_ROOT","nodeType":"Attribute","startLoc":15,"text":"MODELING_ROOT"},{"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":912,"header":"@lazyproperty\n    def bbox_cutout(self)","id":10080,"name":"bbox_cutout","nodeType":"Function","startLoc":904,"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":0,"comment":"null","endLoc":16,"id":10081,"name":"MODELING_SRC","nodeType":"Attribute","startLoc":16,"text":"MODELING_SRC"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":10082,"name":"SRC_FILES","nodeType":"Attribute","startLoc":17,"text":"SRC_FILES"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":10083,"name":"GEN_FILES","nodeType":"Attribute","startLoc":19,"text":"GEN_FILES"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":10084,"name":"projections","nodeType":"Attribute","startLoc":28,"text":"projections"},{"col":0,"comment":"","endLoc":3,"header":"setup_package.py#<anonymous>","id":10085,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"wcs_setup_package = utils.import_file(join('astropy', 'wcs', 'setup_package.py'))\n\nMODELING_ROOT = os.path.relpath(os.path.dirname(__file__))\n\nMODELING_SRC = join(MODELING_ROOT, 'src')\n\nSRC_FILES = [join(MODELING_SRC, 'projections.c.templ'),\n             __file__]\n\nGEN_FILES = [join(MODELING_SRC, 'projections.c')]\n\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}"},{"attributeType":"null","col":8,"comment":"null","endLoc":709,"id":10086,"name":"input_position_cutout","nodeType":"Attribute","startLoc":709,"text":"self.input_position_cutout"},{"attributeType":"null","col":8,"comment":"null","endLoc":248,"id":10087,"name":"_order","nodeType":"Attribute","startLoc":248,"text":"self._order"},{"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":10088,"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)"},{"fileName":"models.py","filePath":"astropy/modeling","id":10089,"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\nfrom .core import custom_model  # pylint: disable=W0611\nfrom .mappings import *\nfrom .projections import *\nfrom .rotations import *\nfrom .polynomial import *\nfrom .functional_models import *\nfrom .powerlaws import *\nfrom .tabular import *\nfrom .blackbody import BlackBody1D\n\n\n\"\"\"\nAttach a docstring explaining constraints to all models which support them.\n\nNote: add new models to this list\n\"\"\"\n\nCONSTRAINTS_DOC = \"\"\"\n    Other Parameters\n    ----------------\n    fixed : a dict\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\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\n        A dictionary ``{parameter_name: boolean}`` of lower and upper bounds of\n        parameters. Keys  are parameter names. Values  are a list of length 2\n        giving the desired range for the parameter.  Alternatively the\n        `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` properties of a parameter\n        may be used.\n    eqcons : list\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\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, MexicanHat1D, MexicanHat2D,\n    PowerLaw1D, Sersic1D, Sersic2D, Sine1D, Trapezoid1D, TrapezoidDisk2D,\n    Chebyshev1D, Chebyshev2D, Hermite1D, Hermite2D, Legendre2D, Legendre1D,\n    Polynomial1D, Polynomial2D, Voigt1D\n]\n\n\nfor item in MODELS_WITH_CONSTRAINTS:\n    if isinstance(item.__doc__, str):\n        item.__doc__ += CONSTRAINTS_DOC\n"},{"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":76,"id":10090,"nodeType":"Class","startLoc":20,"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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"className":"_EulerRotation","col":0,"comment":"\n    Base class which does the actual computation.\n    ","endLoc":111,"id":10091,"nodeType":"Class","startLoc":37,"text":"class _EulerRotation:\n    \"\"\"\n    Base class which does the actual computation.\n    \"\"\"\n\n    _separable = False\n\n    def _create_matrix(self, phi, theta, psi, axes_order):\n        matrices = []\n        for angle, axis in zip([phi, theta, psi], axes_order):\n            if isinstance(angle, u.Quantity):\n                angle = angle.value\n            angle = np.asscalar(angle)\n            matrices.append(rotation_matrix(angle, axis, unit=u.rad))\n        result = matrix_product(*matrices[::-1])\n        return result\n\n    @staticmethod\n    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])\n\n    @staticmethod\n    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\n\n    @deprecated(2.0)\n    @staticmethod\n    def rotation_matrix_from_angle(angle):\n        \"\"\"\n        Clockwise rotation matrix.\n\n        Parameters\n        ----------\n        angle : float\n            Rotation angle in radians.\n        \"\"\"\n        return np.array([[math.cos(angle), math.sin(angle)],\n                         [-math.sin(angle), math.cos(angle)]])\n\n    def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray) and alpha.ndim == 2:\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = self.spherical2cartesian(alpha, delta)\n        matrix = self._create_matrix(phi, theta, psi, axes_order)\n        result = np.dot(matrix, inp)\n        a, b = self.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 {'alpha': u.deg, 'delta': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha': u.deg, 'delta': u.deg}"},{"attributeType":"null","col":8,"comment":"null","endLoc":217,"id":10092,"name":"_name","nodeType":"Attribute","startLoc":217,"text":"self._name"},{"col":4,"comment":"null","endLoc":52,"header":"def _create_matrix(self, phi, theta, psi, axes_order)","id":10093,"name":"_create_matrix","nodeType":"Function","startLoc":44,"text":"def _create_matrix(self, phi, theta, psi, axes_order):\n        matrices = []\n        for angle, axis in zip([phi, theta, psi], axes_order):\n            if isinstance(angle, u.Quantity):\n                angle = angle.value\n            angle = np.asscalar(angle)\n            matrices.append(rotation_matrix(angle, axis, unit=u.rad))\n        result = matrix_product(*matrices[::-1])\n        return result"},{"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    .. 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    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":2957,"header":"def custom_model(*args, fit_deriv=None, **kwargs)","id":10094,"name":"custom_model","nodeType":"Function","startLoc":2872,"text":"def custom_model(*args, fit_deriv=None, **kwargs):\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    .. 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    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 kwargs:\n        warnings.warn(\n            \"Function received unexpected arguments ({}) these \"\n            \"are ignored but will raise an Exception in the \"\n            \"future.\".format(list(kwargs)),\n            AstropyDeprecationWarning)\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__))"},{"attributeType":"null","col":8,"comment":"null","endLoc":259,"id":10095,"name":"_validator","nodeType":"Attribute","startLoc":259,"text":"self._validator"},{"attributeType":"null","col":8,"comment":"null","endLoc":246,"id":10096,"name":"_bounds","nodeType":"Attribute","startLoc":246,"text":"self._bounds"},{"attributeType":"null","col":10,"comment":"null","endLoc":724,"id":10097,"name":"xmin_cutout","nodeType":"Attribute","startLoc":724,"text":"self.xmin_cutout"},{"col":4,"comment":"null","endLoc":61,"header":"@staticmethod\n    def spherical2cartesian(alpha, delta)","id":10098,"name":"spherical2cartesian","nodeType":"Function","startLoc":54,"text":"@staticmethod\n    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])"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":10099,"name":"_setter","nodeType":"Attribute","startLoc":257,"text":"self._setter"},{"attributeType":"null","col":8,"comment":"null","endLoc":231,"id":10100,"name":"_unit","nodeType":"Attribute","startLoc":231,"text":"self._unit"},{"col":4,"comment":"null","endLoc":68,"header":"@staticmethod\n    def cartesian2spherical(x, y, z)","id":10101,"name":"cartesian2spherical","nodeType":"Function","startLoc":63,"text":"@staticmethod\n    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"},{"col":4,"comment":"\n        Clockwise rotation matrix.\n\n        Parameters\n        ----------\n        angle : float\n            Rotation angle in radians.\n        ","endLoc":82,"header":"@deprecated(2.0)\n    @staticmethod\n    def rotation_matrix_from_angle(angle)","id":10102,"name":"rotation_matrix_from_angle","nodeType":"Function","startLoc":70,"text":"@deprecated(2.0)\n    @staticmethod\n    def rotation_matrix_from_angle(angle):\n        \"\"\"\n        Clockwise rotation matrix.\n\n        Parameters\n        ----------\n        angle : float\n            Rotation angle in radians.\n        \"\"\"\n        return np.array([[math.cos(angle), math.sin(angle)],\n                         [-math.sin(angle), math.cos(angle)]])"},{"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":3018,"header":"def _custom_model_wrapper(func, fit_deriv=None)","id":10103,"name":"_custom_model_wrapper","nodeType":"Function","startLoc":2960,"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, params = get_inputs_and_params(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    # TODO: Maybe have a clever scheme for default output name?\n    if inputs:\n        output_names = (inputs[0].name,)\n    else:\n        output_names = ('x',)\n\n    params = dict((param.name, Parameter(param.name, default=param.default))\n                  for param in params)\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        'inputs': tuple(x.name for x in inputs),\n        'outputs': output_names,\n        'evaluate': staticmethod(func),\n    }\n\n    if fit_deriv is not None:\n        members['fit_deriv'] = staticmethod(fit_deriv)\n\n    members.update(params)\n\n    return type(model_name, (FittableModel,), members)"},{"attributeType":"null","col":8,"comment":"null","endLoc":256,"id":10104,"name":"_getter","nodeType":"Attribute","startLoc":256,"text":"self._getter"},{"attributeType":"null","col":12,"comment":"null","endLoc":614,"id":10105,"name":"bounds","nodeType":"Attribute","startLoc":614,"text":"self.bounds"},{"col":4,"comment":"null","endLoc":97,"header":"def evaluate(self, alpha, delta, phi, theta, psi, axes_order)","id":10106,"name":"evaluate","nodeType":"Function","startLoc":84,"text":"def evaluate(self, alpha, delta, phi, theta, psi, axes_order):\n        shape = None\n        if isinstance(alpha, np.ndarray) and alpha.ndim == 2:\n            alpha = alpha.flatten()\n            delta = delta.flatten()\n            shape = alpha.shape\n        inp = self.spherical2cartesian(alpha, delta)\n        matrix = self._create_matrix(phi, theta, psi, axes_order)\n        result = np.dot(matrix, inp)\n        a, b = self.cartesian2spherical(*result)\n        if shape is not None:\n            a.shape = shape\n            b.shape = shape\n        return a, b"},{"attributeType":"null","col":8,"comment":"null","endLoc":218,"id":10107,"name":"__doc__","nodeType":"Attribute","startLoc":218,"text":"self.__doc__"},{"attributeType":"null","col":8,"comment":"null","endLoc":249,"id":10108,"name":"_model","nodeType":"Attribute","startLoc":249,"text":"self._model"},{"attributeType":"null","col":23,"comment":"null","endLoc":218,"id":10109,"name":"_description","nodeType":"Attribute","startLoc":218,"text":"self._description"},{"col":4,"comment":"One dimensional power law model function","endLoc":53,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha)","id":10110,"name":"evaluate","nodeType":"Function","startLoc":49,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":488,"id":10111,"name":"value","nodeType":"Attribute","startLoc":488,"text":"self.value"},{"attributeType":"null","col":8,"comment":"null","endLoc":244,"id":10112,"name":"_fixed","nodeType":"Attribute","startLoc":244,"text":"self._fixed"},{"col":4,"comment":"One dimensional power law derivative with respect to parameters","endLoc":65,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha)","id":10113,"name":"fit_deriv","nodeType":"Function","startLoc":55,"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]"},{"col":4,"comment":"null","endLoc":72,"header":"@property\n    def input_units(self)","id":10114,"name":"input_units","nodeType":"Function","startLoc":67,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":76,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10115,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":74,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":45,"id":10116,"name":"amplitude","nodeType":"Attribute","startLoc":45,"text":"amplitude"},{"className":"Gaussian1D","col":0,"comment":"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    mean : float\n        Mean of the Gaussian.\n    stddev : float\n        Standard deviation of the Gaussian.\n\n    Notes\n    -----\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":183,"id":10117,"nodeType":"Class","startLoc":29,"text":"class Gaussian1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    mean : float\n        Mean of the Gaussian.\n    stddev : float\n        Standard deviation of the Gaussian.\n\n    Notes\n    -----\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)\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    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        else:\n            return {'x': self.mean.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('mean', inputs_unit['x']),\n                            ('stddev', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"null","col":8,"comment":"null","endLoc":707,"id":10118,"name":"data","nodeType":"Attribute","startLoc":707,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":716,"id":10119,"name":"shape","nodeType":"Attribute","startLoc":716,"text":"self.shape"},{"attributeType":"null","col":8,"comment":"null","endLoc":714,"id":10120,"name":"slices_cutout","nodeType":"Attribute","startLoc":714,"text":"self.slices_cutout"},{"attributeType":"null","col":10,"comment":"null","endLoc":723,"id":10121,"name":"ymin_cutout","nodeType":"Attribute","startLoc":723,"text":"self.ymin_cutout"},{"attributeType":"null","col":28,"comment":"null","endLoc":724,"id":10122,"name":"xmax_cutout","nodeType":"Attribute","startLoc":724,"text":"self.xmax_cutout"},{"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":148,"header":"def bounding_box(self, factor=5.5)","id":10123,"name":"bounding_box","nodeType":"Function","startLoc":118,"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":153,"header":"@property\n    def fwhm(self)","id":10124,"name":"fwhm","nodeType":"Function","startLoc":150,"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":160,"header":"@staticmethod\n    def evaluate(x, amplitude, mean, stddev)","id":10125,"name":"evaluate","nodeType":"Function","startLoc":155,"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)"},{"col":4,"comment":"\n        Gaussian1D model function derivatives.\n        ","endLoc":171,"header":"@staticmethod\n    def fit_deriv(x, amplitude, mean, stddev)","id":10126,"name":"fit_deriv","nodeType":"Function","startLoc":162,"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]"},{"col":4,"comment":"null","endLoc":178,"header":"@property\n    def input_units(self)","id":10127,"name":"input_units","nodeType":"Function","startLoc":173,"text":"@property\n    def input_units(self):\n        if self.mean.unit is None:\n            return None\n        else:\n            return {'x': self.mean.unit}"},{"col":4,"comment":"null","endLoc":183,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10128,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":180,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('mean', inputs_unit['x']),\n                            ('stddev', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":111,"id":10129,"name":"amplitude","nodeType":"Attribute","startLoc":111,"text":"amplitude"},{"attributeType":"None","col":12,"comment":"null","endLoc":736,"id":10130,"name":"wcs","nodeType":"Attribute","startLoc":736,"text":"self.wcs"},{"attributeType":"null","col":8,"comment":"null","endLoc":713,"id":10131,"name":"slices_original","nodeType":"Attribute","startLoc":713,"text":"self.slices_original"},{"col":4,"comment":" Input units. ","endLoc":106,"header":"@property\n    def input_units(self)","id":10132,"name":"input_units","nodeType":"Function","startLoc":103,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'alpha': u.deg, 'delta': u.deg}"},{"col":4,"comment":" Output units. ","endLoc":111,"header":"@property\n    def return_units(self)","id":10133,"name":"return_units","nodeType":"Function","startLoc":108,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha': u.deg, 'delta': u.deg}"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":10134,"name":"_separable","nodeType":"Attribute","startLoc":42,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":10135,"name":"input_units_strict","nodeType":"Attribute","startLoc":99,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":10136,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":101,"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`\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":164,"id":10137,"nodeType":"Class","startLoc":114,"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`\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    inputs = ('alpha', 'delta')\n    outputs = ('alpha', 'delta')\n\n    phi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    theta = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    psi = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\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 {0}\".format(axes_order))\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, 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\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":154,"header":"def __init__(self, phi, theta, psi, axes_order, **kwargs)","id":10138,"name":"__init__","nodeType":"Function","startLoc":139,"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 {0}\".format(axes_order))\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, 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)"},{"attributeType":"null","col":10,"comment":"null","endLoc":720,"id":10139,"name":"ymin_original","nodeType":"Attribute","startLoc":720,"text":"self.ymin_original"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":112,"id":10140,"name":"mean","nodeType":"Attribute","startLoc":112,"text":"mean"},{"className":"BlackBody1D","col":0,"comment":"\n    One dimensional blackbody model.\n\n    Parameters\n    ----------\n    temperature : :class:`~astropy.units.Quantity`\n        Blackbody temperature.\n    bolometric_flux : :class:`~astropy.units.Quantity`\n        The bolometric flux of the blackbody (i.e., the integral over the\n        spectral axis).\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: f(x) = \\pi B_{\\nu} f_{\\text{bolometric}} / (\\sigma  T^{4})\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody1D()\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.3585381201978953e-15 erg / (cm2 Hz s)>\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 BlackBody1D\n        from astropy.modeling.blackbody import FLAM\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody1D(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav).to(FLAM, u.spectral_density(wav))\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.lambda_max.to(u.AA).value, ls='--')\n            plt.show()\n\n    ","endLoc":246,"id":10141,"nodeType":"Class","startLoc":119,"text":"class BlackBody1D(Fittable1DModel):\n    \"\"\"\n    One dimensional blackbody model.\n\n    Parameters\n    ----------\n    temperature : :class:`~astropy.units.Quantity`\n        Blackbody temperature.\n    bolometric_flux : :class:`~astropy.units.Quantity`\n        The bolometric flux of the blackbody (i.e., the integral over the\n        spectral axis).\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: f(x) = \\\\pi B_{\\\\nu} f_{\\\\text{bolometric}} / (\\\\sigma  T^{4})\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody1D()\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.3585381201978953e-15 erg / (cm2 Hz s)>\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 BlackBody1D\n        from astropy.modeling.blackbody import FLAM\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody1D(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav).to(FLAM, u.spectral_density(wav))\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.lambda_max.to(u.AA).value, ls='--')\n            plt.show()\n\n    \"\"\"\n\n    # We parametrize this model with a temperature and a bolometric flux. The\n    # bolometric flux is the integral of the model over the spectral axis. This\n    # is more useful than simply having an amplitude parameter.\n    temperature = Parameter(default=5000, min=0, unit=u.K)\n    bolometric_flux = Parameter(default=1, unit=u.erg / u.cm ** 2 / u.s)\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, bolometric_flux):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\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        bolometric_flux : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Desired integral for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``bolometric_flux``.\n        \"\"\"\n\n        # We need to make sure that we attach units to the temperature if it\n        # doesn't have any units. We do this because even though blackbody_nu\n        # can take temperature values without units, the / temperature ** 4\n        # factor needs units to be defined.\n        if isinstance(temperature, u.Quantity):\n            temperature = temperature.to(u.K, equivalencies=u.temperature())\n        else:\n            temperature = u.Quantity(temperature, u.K)\n\n        # We normalize the returned blackbody so that the integral would be\n        # unity, and we then multiply by the bolometric flux. A normalized\n        # blackbody has f_nu = pi * B_nu / (sigma * T^4), which is what we\n        # calculate here. We convert to 1/Hz to make sure the units are\n        # simplified as much as possible, then we multiply by the bolometric\n        # flux to get the normalization right.\n        fnu = ((np.pi * u.sr * blackbody_nu(x, temperature) /\n                const.sigma_sb / temperature ** 4).to(1 / u.Hz) *\n               bolometric_flux)\n\n        # If the bolometric_flux parameter has no unit, we should drop the /Hz\n        # and return a unitless value. This occurs for instance during fitting,\n        # since we drop the units temporarily.\n        if hasattr(bolometric_flux, 'unit'):\n            return fnu\n        else:\n            return fnu.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 {'x': u.Hz}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('temperature', u.K),\n                            ('bolometric_flux', outputs_unit['y'] * u.Hz)])\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"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":116,"id":10142,"name":"stddev","nodeType":"Attribute","startLoc":116,"text":"stddev"},{"col":4,"comment":"null","endLoc":160,"header":"def inverse(self)","id":10143,"name":"inverse","nodeType":"Function","startLoc":156,"text":"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])"},{"attributeType":"null","col":10,"comment":"null","endLoc":721,"id":10144,"name":"xmin_original","nodeType":"Attribute","startLoc":721,"text":"self.xmin_original"},{"className":"Gaussian2D","col":0,"comment":"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    x_mean : float\n        Mean of the Gaussian in x.\n    y_mean : float\n        Mean of the Gaussian in y.\n    x_stddev : float 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 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, optional\n        Rotation angle 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    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":445,"id":10145,"nodeType":"Class","startLoc":186,"text":"class Gaussian2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Gaussian model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude of the Gaussian.\n    x_mean : float\n        Mean of the Gaussian in x.\n    y_mean : float\n        Mean of the Gaussian in y.\n    x_stddev : float 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 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, optional\n        Rotation angle 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    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)\n    x_mean = Parameter(default=0)\n    y_mean = Parameter(default=0)\n    x_stddev = Parameter(default=1)\n    y_stddev = Parameter(default=1)\n    theta = Parameter(default=0.0)\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            else:\n                # Compute principle coordinate system transformation\n                cov_matrix = np.array(cov_matrix)\n\n                if cov_matrix.shape != (2, 2):\n                    # TODO: Maybe it should be possible for the covariance matrix\n                    # to be some (x, y, ..., z, 2, 2) array to be broadcast with\n                    # other parameters of shape (x, y, ..., z)\n                    # But that's maybe a special case to work out if/when needed\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        else:\n            return {'x': self.x_mean.unit,\n                    'y': 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['x'] != inputs_unit['y']:\n            raise UnitsError(\"Units of 'x' and 'y' inputs should match\")\n        return OrderedDict([('x_mean', inputs_unit['x']),\n                            ('y_mean', inputs_unit['x']),\n                            ('x_stddev', inputs_unit['x']),\n                            ('y_stddev', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"null","endLoc":312,"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":10146,"name":"__init__","nodeType":"Function","startLoc":272,"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            else:\n                # Compute principle coordinate system transformation\n                cov_matrix = np.array(cov_matrix)\n\n                if cov_matrix.shape != (2, 2):\n                    # TODO: Maybe it should be possible for the covariance matrix\n                    # to be some (x, y, ..., z, 2, 2) array to be broadcast with\n                    # other parameters of shape (x, y, ..., z)\n                    # But that's maybe a special case to work out if/when needed\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":"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\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        bolometric_flux : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Desired integral for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``bolometric_flux``.\n        ","endLoc":230,"header":"def evaluate(self, x, temperature, bolometric_flux)","id":10147,"name":"evaluate","nodeType":"Function","startLoc":182,"text":"def evaluate(self, x, temperature, bolometric_flux):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\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        bolometric_flux : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Desired integral for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``bolometric_flux``.\n        \"\"\"\n\n        # We need to make sure that we attach units to the temperature if it\n        # doesn't have any units. We do this because even though blackbody_nu\n        # can take temperature values without units, the / temperature ** 4\n        # factor needs units to be defined.\n        if isinstance(temperature, u.Quantity):\n            temperature = temperature.to(u.K, equivalencies=u.temperature())\n        else:\n            temperature = u.Quantity(temperature, u.K)\n\n        # We normalize the returned blackbody so that the integral would be\n        # unity, and we then multiply by the bolometric flux. A normalized\n        # blackbody has f_nu = pi * B_nu / (sigma * T^4), which is what we\n        # calculate here. We convert to 1/Hz to make sure the units are\n        # simplified as much as possible, then we multiply by the bolometric\n        # flux to get the normalization right.\n        fnu = ((np.pi * u.sr * blackbody_nu(x, temperature) /\n                const.sigma_sb / temperature ** 4).to(1 / u.Hz) *\n               bolometric_flux)\n\n        # If the bolometric_flux parameter has no unit, we should drop the /Hz\n        # and return a unitless value. This occurs for instance during fitting,\n        # since we drop the units temporarily.\n        if hasattr(bolometric_flux, 'unit'):\n            return fnu\n        else:\n            return fnu.value"},{"col":4,"comment":"null","endLoc":164,"header":"def evaluate(self, alpha, delta, phi, theta, psi)","id":10148,"name":"evaluate","nodeType":"Function","startLoc":162,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":728,"id":10149,"name":"_origin_original_true","nodeType":"Attribute","startLoc":728,"text":"self._origin_original_true"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":46,"id":10150,"name":"x_0","nodeType":"Attribute","startLoc":46,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":132,"id":10151,"name":"inputs","nodeType":"Attribute","startLoc":132,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":133,"id":10152,"name":"outputs","nodeType":"Attribute","startLoc":133,"text":"outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":135,"id":10153,"name":"phi","nodeType":"Attribute","startLoc":135,"text":"phi"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":47,"id":10154,"name":"alpha","nodeType":"Attribute","startLoc":47,"text":"alpha"},{"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":150,"id":10155,"nodeType":"Class","startLoc":79,"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)\n    x_break = Parameter(default=1)\n    alpha_1 = Parameter(default=1)\n    alpha_2 = Parameter(default=1)\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        else:\n            return {'x': self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional broken power law model function","endLoc":124,"header":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2)","id":10156,"name":"evaluate","nodeType":"Function","startLoc":118,"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":"One dimensional broken power law derivative with respect to parameters","endLoc":139,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2)","id":10157,"name":"fit_deriv","nodeType":"Function","startLoc":126,"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]"},{"col":4,"comment":"Gaussian full width at half maximum in X.","endLoc":317,"header":"@property\n    def x_fwhm(self)","id":10158,"name":"x_fwhm","nodeType":"Function","startLoc":314,"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":322,"header":"@property\n    def y_fwhm(self)","id":10159,"name":"y_fwhm","nodeType":"Function","startLoc":319,"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":360,"header":"def bounding_box(self, factor=5.5)","id":10160,"name":"bounding_box","nodeType":"Function","startLoc":324,"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":"null","endLoc":146,"header":"@property\n    def input_units(self)","id":10161,"name":"input_units","nodeType":"Function","startLoc":141,"text":"@property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        else:\n            return {'x': self.x_break.unit}"},{"col":4,"comment":"null","endLoc":150,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10162,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":148,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"Two dimensional Gaussian function","endLoc":377,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)","id":10163,"name":"evaluate","nodeType":"Function","startLoc":362,"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":"Parameter","col":4,"comment":"null","endLoc":113,"id":10164,"name":"amplitude","nodeType":"Attribute","startLoc":113,"text":"amplitude"},{"col":4,"comment":"Two dimensional Gaussian function derivative with respect to parameters","endLoc":424,"header":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)","id":10165,"name":"fit_deriv","nodeType":"Function","startLoc":379,"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":30,"comment":"null","endLoc":720,"id":10166,"name":"ymax_original","nodeType":"Attribute","startLoc":720,"text":"self.ymax_original"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":114,"id":10167,"name":"x_break","nodeType":"Attribute","startLoc":114,"text":"x_break"},{"col":4,"comment":"null","endLoc":432,"header":"@property\n    def input_units(self)","id":10168,"name":"input_units","nodeType":"Function","startLoc":426,"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        else:\n            return {'x': self.x_mean.unit,\n                    'y': self.y_mean.unit}"},{"col":4,"comment":"null","endLoc":445,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10169,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":434,"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 OrderedDict([('x_mean', inputs_unit['x']),\n                            ('y_mean', inputs_unit['x']),\n                            ('x_stddev', inputs_unit['x']),\n                            ('y_stddev', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":265,"id":10170,"name":"amplitude","nodeType":"Attribute","startLoc":265,"text":"amplitude"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":115,"id":10171,"name":"alpha_1","nodeType":"Attribute","startLoc":115,"text":"alpha_1"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":266,"id":10172,"name":"x_mean","nodeType":"Attribute","startLoc":266,"text":"x_mean"},{"attributeType":"null","col":8,"comment":"null","endLoc":718,"id":10173,"name":"shape_input","nodeType":"Attribute","startLoc":718,"text":"self.shape_input"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":116,"id":10174,"name":"alpha_2","nodeType":"Attribute","startLoc":116,"text":"alpha_2"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":267,"id":10175,"name":"y_mean","nodeType":"Attribute","startLoc":267,"text":"y_mean"},{"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":386,"id":10176,"nodeType":"Class","startLoc":153,"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)\n    x_break = Parameter(default=1)\n    alpha_1 = Parameter(default=-2)\n    alpha_2 = Parameter(default=2)\n    delta = Parameter(default=1, min=1.e-3)\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        else:\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        else:\n            return {'x': self.x_break.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"null","endLoc":256,"header":"@amplitude.validator\n    def amplitude(self, value)","id":10177,"name":"amplitude","nodeType":"Function","startLoc":252,"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":262,"header":"@delta.validator\n    def delta(self, value)","id":10178,"name":"delta","nodeType":"Function","startLoc":258,"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":0,"comment":"Calculate blackbody flux per steradian, :math:`B_{\\nu}(T)`.\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    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Hz.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\; cm^{-2} s^{-1} Hz^{-1} sr^{-1}`.\n\n    Raises\n    ------\n    ValueError\n        Invalid temperature.\n\n    ZeroDivisionError\n        Wavelength is zero (when converting to frequency).\n\n    ","endLoc":317,"header":"def blackbody_nu(in_x, temperature)","id":10179,"name":"blackbody_nu","nodeType":"Function","startLoc":249,"text":"def blackbody_nu(in_x, temperature):\n    \"\"\"Calculate blackbody flux per steradian, :math:`B_{\\\\nu}(T)`.\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    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Hz.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\\\; cm^{-2} s^{-1} Hz^{-1} sr^{-1}`.\n\n    Raises\n    ------\n    ValueError\n        Invalid temperature.\n\n    ZeroDivisionError\n        Wavelength is zero (when converting to frequency).\n\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(in_x, u.Hz, dtype=np.float64)\n        temp = u.Quantity(temperature, u.K, dtype=np.float64)\n\n    # Check if input values are physically possible\n    if np.any(temp < 0):\n        raise ValueError('Temperature should be positive: {0}'.format(temp))\n    if not np.all(np.isfinite(freq)) or np.any(freq <= 0):\n        warnings.warn('Input contains invalid wavelength/frequency value(s)',\n                      AstropyUserWarning)\n\n    log_boltz = const.h * freq / (const.k_B * temp)\n    boltzm1 = np.expm1(log_boltz)\n\n    if _has_buggy_expm1:\n        # Replace incorrect nan results with infs--any result of 'nan' is\n        # incorrect unless the input (in log_boltz) happened to be nan to begin\n        # with.  (As noted in #4393 ideally this would be replaced by a version\n        # of expm1 that doesn't have this bug, rather than fixing incorrect\n        # results after the fact...)\n        boltzm1_nans = np.isnan(boltzm1)\n        if np.any(boltzm1_nans):\n            if boltzm1.isscalar and not np.isnan(log_boltz):\n                boltzm1 = np.inf\n            else:\n                boltzm1[np.where(~np.isnan(log_boltz) & boltzm1_nans)] = np.inf\n\n    # Calculate blackbody flux\n    bb_nu = (2.0 * const.h * freq ** 3 / (const.c ** 2 * boltzm1))\n    flux = bb_nu.to(FNU, u.spectral_density(freq))\n\n    return flux / u.sr  # Add per steradian to output flux unit"},{"attributeType":"None","col":4,"comment":"null","endLoc":268,"id":10180,"name":"x_stddev","nodeType":"Attribute","startLoc":268,"text":"x_stddev"},{"attributeType":"None","col":4,"comment":"null","endLoc":269,"id":10181,"name":"y_stddev","nodeType":"Attribute","startLoc":269,"text":"y_stddev"},{"col":4,"comment":"One dimensional smoothly broken power law model function","endLoc":318,"header":"@staticmethod\n    def evaluate(x, amplitude, x_break, alpha_1, alpha_2, delta)","id":10182,"name":"evaluate","nodeType":"Function","startLoc":264,"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        else:\n            return f"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":270,"id":10183,"name":"theta","nodeType":"Attribute","startLoc":270,"text":"theta"},{"attributeType":"null","col":8,"comment":"null","endLoc":717,"id":10184,"name":"input_position_original","nodeType":"Attribute","startLoc":717,"text":"self.input_position_original"},{"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":504,"id":10185,"nodeType":"Class","startLoc":448,"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    inputs = ('x',)\n    outputs = ('x',)\n\n    offset = Parameter(default=0)\n    linear = True\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        else:\n            return {'x': self.offset.unit}\n\n    @property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n        inv = self.copy()\n        inv.offset *= -1\n        return inv\n\n    @staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        if isinstance(offset, u.Quantity):\n            return_unit = offset.unit\n            offset = offset.value\n        if isinstance(x, u.Quantity):\n            x = x.value\n            return (x + offset) * return_unit\n        else:\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]"},{"col":4,"comment":"null","endLoc":473,"header":"@property\n    def input_units(self)","id":10186,"name":"input_units","nodeType":"Function","startLoc":468,"text":"@property\n    def input_units(self):\n        if self.offset.unit is None:\n            return None\n        else:\n            return {'x': self.offset.unit}"},{"col":4,"comment":"One dimensional inverse Shift model function","endLoc":480,"header":"@property\n    def inverse(self)","id":10187,"name":"inverse","nodeType":"Function","startLoc":475,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse Shift model function\"\"\"\n        inv = self.copy()\n        inv.offset *= -1\n        return inv"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":136,"id":10188,"name":"theta","nodeType":"Attribute","startLoc":136,"text":"theta"},{"col":4,"comment":"One dimensional Shift model function","endLoc":492,"header":"@staticmethod\n    def evaluate(x, offset)","id":10189,"name":"evaluate","nodeType":"Function","startLoc":482,"text":"@staticmethod\n    def evaluate(x, offset):\n        \"\"\"One dimensional Shift model function\"\"\"\n        if isinstance(offset, u.Quantity):\n            return_unit = offset.unit\n            offset = offset.value\n        if isinstance(x, u.Quantity):\n            x = x.value\n            return (x + offset) * return_unit\n        else:\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":10190,"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":10191,"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]"},{"attributeType":"null","col":30,"comment":"null","endLoc":721,"id":10192,"name":"xmax_original","nodeType":"Attribute","startLoc":721,"text":"self.xmax_original"},{"attributeType":"null","col":4,"comment":"null","endLoc":458,"id":10193,"name":"inputs","nodeType":"Attribute","startLoc":458,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":459,"id":10194,"name":"outputs","nodeType":"Attribute","startLoc":459,"text":"outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":461,"id":10195,"name":"offset","nodeType":"Attribute","startLoc":461,"text":"offset"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":137,"id":10196,"name":"psi","nodeType":"Attribute","startLoc":137,"text":"psi"},{"attributeType":"null","col":28,"comment":"null","endLoc":723,"id":10197,"name":"ymax_cutout","nodeType":"Attribute","startLoc":723,"text":"self.ymax_cutout"},{"attributeType":"null","col":4,"comment":"null","endLoc":462,"id":10198,"name":"linear","nodeType":"Attribute","startLoc":462,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":464,"id":10199,"name":"input_units_strict","nodeType":"Attribute","startLoc":464,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":466,"id":10200,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":466,"text":"input_units_allow_dimensionless"},{"className":"Scale","col":0,"comment":"\n    Multiply a model by a factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n    ","endLoc":558,"id":10201,"nodeType":"Class","startLoc":507,"text":"class Scale(Fittable1DModel):\n    \"\"\"\n    Multiply a model by a factor.\n\n    Parameters\n    ----------\n    factor : float\n        Factor by which to scale a coordinate.\n    \"\"\"\n\n    inputs = ('x',)\n    outputs = ('x',)\n\n    factor = Parameter(default=1)\n    linear = True\n    fittable = True\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        else:\n            return {'x': 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        return inv\n\n    @staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            return_unit = factor.unit\n            factor = factor.value\n        if isinstance(x, u.Quantity):\n            return (x.value * factor) * return_unit\n        else:\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]"},{"col":4,"comment":"null","endLoc":533,"header":"@property\n    def input_units(self)","id":10202,"name":"input_units","nodeType":"Function","startLoc":528,"text":"@property\n    def input_units(self):\n        if self.factor.unit is None:\n            return None\n        else:\n            return {'x': self.factor.unit}"},{"col":4,"comment":"One dimensional inverse Scale model function","endLoc":540,"header":"@property\n    def inverse(self)","id":10203,"name":"inverse","nodeType":"Function","startLoc":535,"text":"@property\n    def inverse(self):\n        \"\"\"One dimensional inverse Scale model function\"\"\"\n        inv = self.copy()\n        inv.factor = 1 / self.factor\n        return inv"},{"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 : `~numpy.ndarray` or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : `~numpy.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":340,"header":"def subpixel_indices(position, subsampling)","id":10204,"name":"subpixel_indices","nodeType":"Function","startLoc":300,"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 : `~numpy.ndarray` or array-like\n        Positions in pixels.\n    subsampling : int\n        Subsampling factor per pixel.\n\n    Returns\n    -------\n    indices : `~numpy.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":8,"comment":"null","endLoc":140,"id":10205,"name":"axes","nodeType":"Attribute","startLoc":140,"text":"self.axes"},{"col":4,"comment":"One dimensional Scale model function","endLoc":551,"header":"@staticmethod\n    def evaluate(x, factor)","id":10206,"name":"evaluate","nodeType":"Function","startLoc":542,"text":"@staticmethod\n    def evaluate(x, factor):\n        \"\"\"One dimensional Scale model function\"\"\"\n        if isinstance(factor, u.Quantity):\n            return_unit = factor.unit\n            factor = factor.value\n        if isinstance(x, u.Quantity):\n            return (x.value * factor) * return_unit\n        else:\n            return factor * x"},{"col":4,"comment":"One dimensional Scale model derivative with respect to parameter","endLoc":558,"header":"@staticmethod\n    def fit_deriv(x, *params)","id":10207,"name":"fit_deriv","nodeType":"Function","startLoc":553,"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]"},{"attributeType":"null","col":4,"comment":"null","endLoc":517,"id":10208,"name":"inputs","nodeType":"Attribute","startLoc":517,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":518,"id":10209,"name":"outputs","nodeType":"Attribute","startLoc":518,"text":"outputs"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":520,"id":10210,"name":"factor","nodeType":"Attribute","startLoc":520,"text":"factor"},{"attributeType":"null","col":4,"comment":"null","endLoc":521,"id":10211,"name":"linear","nodeType":"Attribute","startLoc":521,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":522,"id":10212,"name":"fittable","nodeType":"Attribute","startLoc":522,"text":"fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":524,"id":10213,"name":"input_units_strict","nodeType":"Attribute","startLoc":524,"text":"input_units_strict"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":10214,"name":"axes_order","nodeType":"Attribute","startLoc":149,"text":"self.axes_order"},{"attributeType":"null","col":4,"comment":"null","endLoc":526,"id":10215,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":526,"text":"input_units_allow_dimensionless"},{"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":598,"id":10216,"nodeType":"Class","startLoc":561,"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    @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        return inv"},{"col":4,"comment":"null","endLoc":237,"header":"@property\n    def input_units(self)","id":10217,"name":"input_units","nodeType":"Function","startLoc":232,"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 {'x': u.Hz}"},{"col":4,"comment":"null","endLoc":241,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10218,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":239,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('temperature', u.K),\n                            ('bolometric_flux', outputs_unit['y'] * u.Hz)])"},{"col":4,"comment":"Peak wavelength when the curve is expressed as power density.","endLoc":246,"header":"@property\n    def lambda_max(self)","id":10219,"name":"lambda_max","nodeType":"Function","startLoc":243,"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"},{"attributeType":"Quantity","col":4,"comment":"null","endLoc":172,"id":10220,"name":"temperature","nodeType":"Attribute","startLoc":172,"text":"temperature"},{"col":4,"comment":"One dimensional RedshiftScaleFactor model function","endLoc":583,"header":"@staticmethod\n    def evaluate(x, z)","id":10221,"name":"evaluate","nodeType":"Function","startLoc":579,"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":590,"header":"@staticmethod\n    def fit_deriv(x, z)","id":10222,"name":"fit_deriv","nodeType":"Function","startLoc":585,"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":598,"header":"@property\n    def inverse(self)","id":10223,"name":"inverse","nodeType":"Function","startLoc":592,"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        return inv"},{"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 along which the function is applied.  The\n        default is `~numpy.sum`, which provides block summation (and\n        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.utils import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)    # doctest: +SKIP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)    # doctest: +SKIP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    ","endLoc":411,"header":"@support_nddata\ndef block_reduce(data, block_size, func=np.sum)","id":10224,"name":"block_reduce","nodeType":"Function","startLoc":343,"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 along which the function is applied.  The\n        default is `~numpy.sum`, which provides block summation (and\n        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.utils import block_reduce\n    >>> data = np.arange(16).reshape(4, 4)\n    >>> block_reduce(data, 2)    # doctest: +SKIP\n    array([[10, 18],\n           [42, 50]])\n\n    >>> block_reduce(data, 2, func=np.mean)    # doctest: +SKIP\n    array([[  2.5,   4.5],\n           [ 10.5,  12.5]])\n    \"\"\"\n\n    from skimage.measure import block_reduce\n\n    data = np.asanyarray(data)\n\n    block_size = np.atleast_1d(block_size)\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 `data.shape`')\n\n    block_size = np.array([int(i) for i in block_size])\n    size_resampled = np.array(data.shape) // block_size\n    size_init = size_resampled * block_size\n\n    # trim data if necessary\n    for i in range(data.ndim):\n        if data.shape[i] != size_init[i]:\n            data = data.swapaxes(0, i)\n            data = data[:size_init[i]]\n            data = data.swapaxes(0, i)\n\n    return block_reduce(data, tuple(block_size), func=func)"},{"col":4,"comment":"One dimensional smoothly broken power law derivative with respect\n           to parameters","endLoc":375,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2, delta)","id":10225,"name":"fit_deriv","nodeType":"Function","startLoc":320,"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]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":577,"id":10226,"name":"z","nodeType":"Attribute","startLoc":577,"text":"z"},{"className":"_SkyRotation","col":0,"comment":"\n    Base class for RotateNative2Celestial and RotateCelestial2Native.\n    ","endLoc":191,"id":10227,"nodeType":"Class","startLoc":167,"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)\n    lat = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\n    lon_pole = Parameter(default=0, getter=_to_orig_unit, setter=_to_radian)\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"},{"attributeType":"Quantity","col":4,"comment":"null","endLoc":173,"id":10228,"name":"bolometric_flux","nodeType":"Attribute","startLoc":173,"text":"bolometric_flux"},{"attributeType":"null","col":4,"comment":"null","endLoc":177,"id":10229,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":177,"text":"input_units_allow_dimensionless"},{"col":4,"comment":"null","endLoc":181,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":10230,"name":"__init__","nodeType":"Function","startLoc":176,"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'"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":10231,"name":"input_units_equivalencies","nodeType":"Attribute","startLoc":180,"text":"input_units_equivalencies"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":10232,"name":"CONSTRAINTS_DOC","nodeType":"Attribute","startLoc":25,"text":"CONSTRAINTS_DOC"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":10233,"name":"MODELS_WITH_CONSTRAINTS","nodeType":"Attribute","startLoc":55,"text":"MODELS_WITH_CONSTRAINTS"},{"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.utils 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":472,"header":"@support_nddata\ndef block_replicate(data, block_size, conserve_sum=True)","id":10234,"name":"block_replicate","nodeType":"Function","startLoc":414,"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.utils 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 = np.asanyarray(data)\n\n    block_size = np.atleast_1d(block_size)\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 `data.shape`')\n\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":"null","col":4,"comment":"null","endLoc":66,"id":10235,"name":"item","nodeType":"Attribute","startLoc":66,"text":"item"},{"col":0,"comment":"","endLoc":5,"header":"models.py#<anonymous>","id":10236,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nCreates a common namespace for all pre-defined models.\n\"\"\"\n\n\"\"\"\nAttach a docstring explaining constraints to all models which support them.\n\nNote: add new models to this list\n\"\"\"\n\nCONSTRAINTS_DOC = \"\"\"\n    Other Parameters\n    ----------------\n    fixed : a dict\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\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\n        A dictionary ``{parameter_name: boolean}`` of lower and upper bounds of\n        parameters. Keys  are parameter names. Values  are a list of length 2\n        giving the desired range for the parameter.  Alternatively the\n        `~astropy.modeling.Parameter.min` and\n        `~astropy.modeling.Parameter.max` properties of a parameter\n        may be used.\n    eqcons : list\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\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, MexicanHat1D, MexicanHat2D,\n    PowerLaw1D, Sersic1D, Sersic2D, Sine1D, Trapezoid1D, TrapezoidDisk2D,\n    Chebyshev1D, Chebyshev2D, Hermite1D, Hermite2D, Legendre2D, Legendre1D,\n    Polynomial1D, Polynomial2D, Voigt1D\n]\n\nfor item in MODELS_WITH_CONSTRAINTS:\n    if isinstance(item.__doc__, str):\n        item.__doc__ += CONSTRAINTS_DOC"},{"fileName":"core.py","filePath":"astropy/modeling","id":10237,"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\n\nimport abc\nimport copy\nimport copyreg\nimport inspect\nimport functools\nimport operator\nimport sys\nimport types\nimport warnings\n\nfrom collections import defaultdict, OrderedDict\nfrom contextlib import suppress\nfrom inspect import signature\nfrom itertools import chain, islice\n\nimport numpy as np\n\nfrom ..utils import indent, isinstancemethod, metadata\nfrom ..table import Table\nfrom ..units import Quantity, UnitsError, dimensionless_unscaled\nfrom ..units.utils import quantity_asanyarray\nfrom ..utils import (sharedmethod, find_current_module,\n                     InheritDocstrings, OrderedDescriptorContainer,\n                     check_broadcast, IncompatibleShapeError, isiterable)\nfrom ..utils.codegen import make_function_with_signature\nfrom ..utils.exceptions import AstropyDeprecationWarning\nfrom .utils import (combine_labels, make_binary_operator_eval,\n                    ExpressionTree, AliasDict, get_inputs_and_params,\n                    _BoundingBox, _combine_equivalency_dict)\nfrom ..nddata.utils import add_array, extract_array\n\nfrom .parameters import Parameter, InputParameterError, param_repr_oneline\n\n\n__all__ = ['Model', 'FittableModel', 'Fittable1DModel', 'Fittable2DModel',\n           'custom_model', 'ModelDefinitionError']\n\n\nclass ModelDefinitionError(TypeError):\n    \"\"\"Used for incorrect models definitions\"\"\"\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    Any additional keyword arguments passed in are passed to\n    `_CompoundModelMeta._from_operator`.\n    \"\"\"\n\n    # Note: Originally this used functools.partial, but that won't work when\n    # used in the class definition of _CompoundModelMeta since\n    # _CompoundModelMeta has not been defined yet.\n\n    # Perform an arithmetic operation on two models.\n    return lambda left, right: _CompoundModelMeta._from_operator(oper,\n            left, right, **kwargs)\n\n\nclass _ModelMeta(OrderedDescriptorContainer, InheritDocstrings, 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    _parameters_ = OrderedDict()\n\n    def __new__(mcls, name, bases, members):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n\n        return super().__new__(mcls, name, bases, members)\n\n    def __init__(cls, name, bases, members):\n        # Make sure OrderedDescriptorContainer gets to run before doing\n        # anything else\n        super().__init__(name, bases, members)\n\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(cls._parameters_)\n            else:\n                cls.param_names = tuple(cls._parameters_)\n\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        cls._handle_special_methods(members)\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        else:\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 n_inputs(cls):\n        return len(cls.inputs)\n\n    @property\n    def n_outputs(cls):\n        return len(cls.outputs)\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):\n        \"\"\"\n        Creates a copy of this model class with a new name.\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 '__main__.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            Inputs: ('x', 'y')\n            Outputs: ('x', 'y')\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        new_cls = type(name, (cls,), {})\n        new_cls.__module__ = modname\n\n        if hasattr(cls, '__qualname__'):\n            if new_cls.__module__ == '__main__':\n                # __main__ is not added to a class's qualified name\n                new_cls.__qualname__ = name\n            else:\n                new_cls.__qualname__ = '{0}.{1}'.format(modname, 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 = _BoundingBox.validate(cls, bounding_box)\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            # TODO: Maybe warn in the above case?\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 _BoundingBox 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__ = make_function_with_signature(__call__, ('self',), kwargs)\n\n        return type(str('_{0}BoundingBox'.format(cls.name)), (_BoundingBox,),\n                    {'__call__': __call__})\n\n    def _handle_special_methods(cls, members):\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__ = '{0}.{1}'.format(\n                        cls.__qualname__, wrapper.__name__)\n\n        if ('__call__' not in members and 'inputs' in members and\n                isinstance(members['inputs'], tuple)):\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            inputs = members['inputs']\n            args = ('self',) + inputs\n            new_call = make_function_with_signature(\n                    __call__, args, [('model_set_axis', None),\n                                     ('with_bounding_box', False),\n                                     ('fill_value', np.nan),\n                                     ('equivalencies', None)])\n\n            # The following makes it look like __call__ 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\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional arguments\n            if all(p.default is not None for p in cls._parameters_.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name in cls.param_names:\n                    default = cls._parameters_[param_name].default\n                    unit = cls._parameters_[param_name].unit\n                    # If the unit was specified in the parameter but the default\n                    # is not a Quantity, attach the unit to the 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',) + cls.param_names\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\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 '{0} ({1})'.format(cls.name, ' -> '.join(bases))\n            else:\n                return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('Inputs', cls.inputs),\n                ('Outputs', cls.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('{0}: {1}'.format(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    This class sets the constraints and other properties for all individual\n    parameters and performs parameter validation.\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.\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        Dictionary ``{parameter_name: value}`` of lower and upper bounds of\n        parameters. Keys are parameter names. Values are a list of length 2\n        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    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    inputs = ()\n    \"\"\"The name(s) of the input variable(s) on which a model is evaluated.\"\"\"\n    outputs = ()\n    \"\"\"The name(s) of the output(s) of the model.\"\"\"\n\n    standard_broadcasting = True\n    fittable = False\n    linear = True\n\n    _separable = None\n    \"\"\" A boolean flag to indicate whether a model is separable.\"\"\"\n\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    # 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    # Enforce strict units on inputs to evaluate. If this is set to True, input\n    # values to evaluate have to be in the exact right units specified by\n    # input_units. In this case, if the input quantities are convertible to\n    # input_units, they are converted.\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.\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 model\n    # inputs. Only has an effect if input_units is defined.\n    input_units_equivalencies = None\n\n    def __init__(self, *args, meta=None, name=None, **kwargs):\n        super().__init__()\n        if meta is not None:\n            self.meta = meta\n        self._name = name\n\n        self._initialize_constraints(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\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    def __call__(self, *inputs, **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\n        inputs, format_info = self.prepare_inputs(*inputs, **kwargs)\n\n        # Check whether any of the inputs are quantities\n        inputs_are_quantity = any([isinstance(i, Quantity) for i in inputs])\n\n        parameters = self._param_sets(raw=True, units=True)\n        with_bbox = kwargs.pop('with_bounding_box', False)\n        fill_value = kwargs.pop('fill_value', np.nan)\n        bbox = None\n        if with_bbox:\n            try:\n                bbox = self.bounding_box\n            except NotImplementedError:\n                bbox = None\n            if self.n_inputs > 1 and bbox is not None:\n                # bounding_box is in python order - convert it to the order of the inputs\n                bbox = bbox[::-1]\n            if bbox is None:\n                outputs = self.evaluate(*chain(inputs, parameters))\n            else:\n                if self.n_inputs == 1:\n                    bbox = [bbox]\n                # indices where input is outside the bbox\n                # have a value of 1 in ``nan_ind``\n                nan_ind = np.zeros(inputs[0].shape, dtype=bool)\n                for ind, inp in enumerate(inputs):\n                    # Pass an ``out`` array so that ``axis_ind`` is array for scalars as well.\n                    axis_ind = np.zeros(inp.shape, dtype=bool)\n                    axis_ind = np.logical_or(inp < bbox[ind][0], inp > bbox[ind][1], out=axis_ind)\n                    nan_ind[axis_ind] = 1\n                # get an array with indices of valid inputs\n                valid_ind = np.logical_not(nan_ind).nonzero()\n                # inputs holds only inputs within the bbox\n                args = []\n                for input in inputs:\n                    if not input.shape:\n                        # shape is ()\n                        if nan_ind:\n                            outputs = [fill_value for a in args]\n                        else:\n                            args.append(input)\n                    else:\n                        args.append(input[valid_ind])\n                valid_result = self.evaluate(*chain(args, parameters))\n                if self.n_outputs == 1:\n                    valid_result = [valid_result]\n                # combine the valid results with the ``fill_value`` values\n                # outside the bbox\n                result = [np.zeros(inputs[0].shape) + fill_value for i in range(len(valid_result))]\n                for ind, r in enumerate(valid_result):\n                    if not result[ind].shape:\n                        # shape is ()\n                        result[ind] = r\n                    else:\n                        result[ind][valid_ind] = r\n                # format output\n                if self.n_outputs == 1:\n                    outputs = np.asarray(result[0])\n                else:\n                    outputs = [np.asarray(r) for r in result]\n        else:\n            outputs = self.evaluate(*chain(inputs, parameters))\n        if self.n_outputs == 1:\n            outputs = (outputs,)\n\n        outputs = self.prepare_outputs(format_info, *outputs, **kwargs)\n\n        # If input values were quantities, we use return_units to cast\n        # the return values to the units specified by return_units.\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[out_name], subok=True)\n                             for out, out_name in zip(outputs, self.outputs)])\n\n        if self.n_outputs == 1:\n            return outputs[0]\n        else:\n            return outputs\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\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 n_inputs(self):\n        \"\"\"\n        The number of inputs to this model.\n\n        Equivalent to ``len(model.inputs)``.\n        \"\"\"\n\n        return len(self.inputs)\n\n    @property\n    def n_outputs(self):\n        \"\"\"\n        The number of outputs from this model.\n\n        Equivalent to ``len(model.outputs)``.\n        \"\"\"\n        return len(self.outputs)\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 `Model Sets\n        <http://docs.astropy.org/en/stable/modeling/models.html#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        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\n    @property\n    def fixed(self):\n        \"\"\"\n        A `dict` mapping parameter names to their fixed constraint.\n        \"\"\"\n\n        return self._constraints['fixed']\n\n    @property\n    def tied(self):\n        \"\"\"\n        A `dict` mapping parameter names to their tied constraint.\n        \"\"\"\n\n        return self._constraints['tied']\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.\n        \"\"\"\n\n        return self._constraints['bounds']\n\n    @property\n    def eqcons(self):\n        \"\"\"List of parameter equality constraints.\"\"\"\n\n        return self._constraints['eqcons']\n\n    @property\n    def ineqcons(self):\n        \"\"\"List of parameter inequality constraints.\"\"\"\n\n        return self._constraints['ineqcons']\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\n        if self._user_inverse is not None:\n            return self._user_inverse\n        elif self._inverse is not None:\n            return self._inverse()\n\n        raise NotImplementedError(\"An analytical inverse transform has not \"\n                                  \"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        del self._user_inverse\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\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        `None` 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:`bounding-boxes`\n\n        The limits are ordered according to the `numpy` 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          File \"<stdin>\", line 1, in <module>\n          File \"astropy\\modeling\\core.py\", line 980, in bounding_box\n            \"No bounding box is defined for this model (note: the \"\n        NotImplementedError: No bounding box is defined for this model (note:\n        the bounding box was explicitly disabled for this model; use `del\n        model.bounding_box` to restore the default bounding box, if one is\n        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, _BoundingBox):\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 self._bounding_box()\n        else:\n            # The only other allowed possibility is that it's a _BoundingBox\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(self._bounding_box, type) and\n                issubclass(self._bounding_box, _BoundingBox)):\n            cls = self._bounding_box\n        else:\n            cls = _BoundingBox\n\n        if cls is not None:\n            try:\n                bounding_box = cls.validate(self, bounding_box)\n            except ValueError as exc:\n                raise ValueError(exc.args[0])\n\n        self._user_bounding_box = bounding_box\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 separable(self):\n        \"\"\" A flag indicating whether a model is separable.\"\"\"\n\n        if self._separable is not None:\n            return self._separable\n        else:\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 been\n        converted to the right units for the data, then the units have been\n        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 necessarily\n        the units of the input data, but are derived from them. Model subclasses\n        that 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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, outputs_unit)\n\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        return model\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 of\n        the input data, but are derived from them. Model subclasses that want\n        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\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\n        parameter_units = self._parameter_units_for_data_units(inputs_unit, 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, hence\n        # 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 the\n            returned array. If this is not provided (or None), the model will be\n            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 passed.\n\n        Raises\n        ------\n        ValueError\n            If ``coords`` are not given and the the `Model.bounding_box` of this\n            model is not set.\n\n        Examples\n        --------\n        :ref:`bounding-boxes`\n        \"\"\"\n\n        try:\n            bbox = self.bounding_box\n        except NotImplementedError:\n            bbox = None\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, dtype=float)\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 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 overriden 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    @input_units.setter\n    def input_units(self, input_units):\n        self._input_units = input_units\n\n    @property\n    def return_units(self):\n        \"\"\"\n        This property is used to indicate what units or sets of units the output\n        of evaluate should be in, and returns a dictionary mapping outputs 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 output units, in which case this property should not be\n        overriden 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    @return_units.setter\n    def return_units(self, return_units):\n        self._return_units = return_units\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\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\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        n_models = len(self)\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        _validate_input_shapes(inputs, self.inputs, n_models,\n                               model_set_axis, self.standard_broadcasting)\n\n        # Check that the units are correct, if applicable\n\n        if self.input_units is not None:\n\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                                                                 equivalencies,\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(input_unit, 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 because\n                        # some equivalencies are non-linear, and we need to be\n                        # sure that we evaluate the model in its own frame\n                        # of reference. If input_units_strict is set, we also\n                        # need to convert to the input units.\n                        if len(input_units_equivalencies) > 0 or self.input_units_strict:\n                            inputs[i] = inputs[i].to(input_unit, 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(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required dimensionless \"\n                                             \"input\".format(self.inputs[i],\n                                                            inputs[i].unit,\n                                                            inputs[i].unit.physical_type))\n                        else:\n                            raise UnitsError(\"Units of input '{0}', {1} ({2}), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{3} ({4})\".format(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 and\n                       input_unit is not dimensionless_unscaled and input_unit is not None):\n                        if np.any(inputs[i] != 0):\n                            raise UnitsError(\"Units of input '{0}', (dimensionless), could not be \"\n                                             \"converted to required input units of \"\n                                             \"{1} ({2})\".format(self.inputs[i], input_unit,\n                                                                input_unit.physical_type))\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 n_models == 1:\n            return _prepare_inputs_single_model(self, params, inputs,\n                                                **kwargs)\n        else:\n            return _prepare_inputs_model_set(self, params, inputs, n_models,\n                                             model_set_axis, **kwargs)\n\n    def prepare_outputs(self, format_info, *outputs, **kwargs):\n        if len(self) == 1:\n            return _prepare_outputs_single_model(self, outputs, format_info)\n        else:\n            return _prepare_outputs_model_set(self, outputs, format_info)\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 copy.deepcopy(self)\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    @sharedmethod\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    # *** Internal methods ***\n    @sharedmethod\n    def _from_existing(self, existing, param_names):\n        \"\"\"\n        Creates a new instance of ``cls`` that shares its underlying parameter\n        values with an existing model instance given by ``existing``.\n\n        This is used primarily by compound models to return a view of an\n        individual component of a compound model.  ``param_names`` should be\n        the names of the parameters in the *existing* model to use as the\n        parameters in this new model.  Its length should equal the number of\n        parameters this model takes, so that it can map parameters on the\n        existing model to parameters on this model one-to-one.\n        \"\"\"\n\n        # Basically this is an alternative __init__\n        if isinstance(self, type):\n            # self is a class, not an instance\n            needs_initialization = True\n            dummy_args = (0,) * len(param_names)\n            self = self.__new__(self, *dummy_args)\n        else:\n            needs_initialization = False\n            self = self.copy()\n\n        aliases = dict(zip(self.param_names, param_names))\n        # This is basically an alternative _initialize_constraints\n        constraints = {}\n        for cons_type in self.parameter_constraints:\n            orig = existing._constraints[cons_type]\n            constraints[cons_type] = AliasDict(orig, aliases)\n\n        self._constraints = constraints\n\n        self._n_models = existing._n_models\n        self._model_set_axis = existing._model_set_axis\n        self._parameters = existing._parameters\n\n        self._param_metrics = defaultdict(dict)\n        for param_a, param_b in aliases.items():\n            # Take the param metrics info for the giving parameters in the\n            # existing model, and hand them to the appropriate parameters in\n            # the new model\n            self._param_metrics[param_a] = existing._param_metrics[param_b]\n\n        if needs_initialization:\n            self.__init__(*dummy_args)\n\n        return self\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        if hasattr(self, '_constraints'):\n            # Skip constraint initialization if it has already been handled via\n            # an alternate initialization\n            return\n\n        self._constraints = {}\n        # Pop any constraints off the keyword arguments\n        for constraint in self.parameter_constraints:\n            values = kwargs.pop(constraint, {})\n            self._constraints[constraint] = values.copy()\n\n            # Update with default parameter constraints\n            for param_name in self.param_names:\n                param = getattr(self, param_name)\n\n                # Parameters don't have all constraint types\n                value = getattr(param, constraint)\n                if value is not None:\n                    self._constraints[constraint][param_name] = value\n\n        for constraint in self.model_constraints:\n            values = kwargs.pop(constraint, [])\n            self._constraints[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        if hasattr(self, '_parameters'):\n            # Skip parameter initialization if it has already been handled via\n            # an alternate initialization\n            return\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                    (isinstance(model_set_axis, int) and\n                        not isinstance(model_set_axis, bool))):\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 = {}\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            params[self.param_names[idx]] = quantity_asanyarray(arg, dtype=float)\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 because\n                # if any of the arguments are quantities, we need to return a\n                # Quantity object not a plain Numpy array.\n                params[param_name] = quantity_asanyarray(value, dtype=float)\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, value in params.items():\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(params, max_ndim)\n        else:\n            if n_models is None:\n                n_models = 1\n\n            self._check_param_broadcast(params, None)\n\n        self._n_models = n_models\n        self._initialize_parameter_values(params)\n\n    def _initialize_parameter_values(self, params):\n        # self._param_metrics should have been initialized in\n        # self._initialize_parameters\n        param_metrics = self._param_metrics\n        total_size = 0\n\n        for name in self.param_names:\n            unit = None\n            param_descr = getattr(self, name)\n\n            if params.get(name) is None:\n                default = param_descr.default\n\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(\n                        \"{0}.__init__() requires a value for parameter \"\n                        \"{1!r}\".format(self.__class__.__name__, name))\n\n                value = params[name] = default\n                unit = param_descr.unit\n            else:\n                value = params[name]\n                if isinstance(value, Quantity):\n                    unit = value.unit\n                else:\n                    unit = None\n\n            param_size = np.size(value)\n            param_shape = np.shape(value)\n\n            param_slice = slice(total_size, total_size + param_size)\n\n            param_metrics[name]['slice'] = param_slice\n            param_metrics[name]['shape'] = param_shape\n\n            if unit is None and param_descr.unit is not None:\n                raise InputParameterError(\n                    \"{0}.__init__() requires a Quantity for parameter \"\n                    \"{1!r}\".format(self.__class__.__name__, name))\n\n            param_metrics[name]['orig_unit'] = unit\n            param_metrics[name]['raw_unit'] = None\n            if param_descr._setter is not None:\n                _val = param_descr._setter(value)\n                if isinstance(_val, Quantity):\n                    param_metrics[name]['raw_unit'] = _val.unit\n                else:\n                    param_metrics[name]['raw_unit'] = None\n            total_size += param_size\n\n        self._param_metrics = param_metrics\n        self._parameters = np.empty(total_size, dtype=np.float64)\n\n        # Now set the parameter values (this will also fill\n        # self._parameters)\n        # TODO: This is a bit ugly, but easier to deal with than how this was\n        # done previously.  There's still lots of opportunity for refactoring\n        # though, in particular once we move the _get/set_model_value methods\n        # out of Parameter and into Model (renaming them\n        # _get/set_parameter_value)\n        for name, value in params.items():\n            # value here may be a Quantity object.\n            param_descr = getattr(self, name)\n            unit = param_descr.unit\n            value = np.array(value)\n            orig_unit = param_metrics[name]['orig_unit']\n            if param_descr._setter is not None:\n                if unit is not None:\n                    value = np.asarray(param_descr._setter(value * orig_unit).value)\n                else:\n                    value = param_descr._setter(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        for name in params:\n            param_descr = getattr(self, name)\n            param_descr.validator(param_descr.value)\n\n    def _check_param_broadcast(self, params, 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\n        all_shapes = []\n        param_names = []\n        model_set_axis = self._model_set_axis\n\n        for name in self.param_names:\n            # Previously this just used iteritems(params), but we loop over all\n            # param_names instead just to ensure some determinism in the\n            # ordering behavior\n            if name not in params:\n                continue\n\n            value = params[name]\n            param_names.append(name)\n            # We've already checked that each parameter array is compatible in\n            # the model_set_axis dimension, but now we need to check the\n            # dimensions excluding that axis\n            # Split the array dimensions into the axes before model_set_axis\n            # and after model_set_axis\n            param_shape = np.shape(value)\n\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 = param_names[shape_a_idx]\n            param_b = 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        param_metrics = self._param_metrics\n        values = []\n        shapes = []\n        for name in self.param_names:\n            param = getattr(self, name)\n\n            if raw:\n                value = param._raw_value\n            else:\n                value = param.value\n\n            broadcast_shape = 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 self._param_metrics[name]['raw_unit'] is not None:\n                    unit = self._param_metrics[name]['raw_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        # TODO: Returning an array from this method may be entirely pointless\n        # for internal use--perhaps only the external param_sets method should\n        # return an array (and just for backwards compat--I would prefer to\n        # maybe deprecate that method)\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        # TODO: I think this could be reworked to preset model sets better\n\n        parts = [repr(a) for a in args]\n\n        parts.extend(\n            \"{0}={1}\".format(name,\n                             param_repr_oneline(getattr(self, name)))\n            for name in self.param_names)\n\n        if self.name is not None:\n            parts.append('name={0!r}'.format(self.name))\n\n        for kwarg, value in kwargs.items():\n            if kwarg in defaults and defaults[kwarg] != value:\n                continue\n            parts.append('{0}={1!r}'.format(kwarg, value))\n\n        if len(self) > 1:\n            parts.append(\"n_models={0}\".format(len(self)))\n\n        return '<{0}({1})>'.format(self.__class__.__name__, ', '.join(parts))\n\n    def _format_str(self, keywords=[]):\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 = ['{0}: {1}'.format(keyword, value)\n                 for keyword, value in default_keywords + keywords\n                 if value is not None]\n\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 = ('x',)\n    outputs = ('y',)\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    inputs = ('x', 'y')\n    outputs = ('z',)\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\n# TODO: Support a couple unary operators--at least negation?\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\n\n_ORDER_OF_OPERATORS = [('|',), ('&',), ('+', '-'), ('*', '/'), ('**',)]\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\nclass _CompoundModelMeta(_ModelMeta):\n    _tree = None\n    _submodels = None\n    _submodel_names = None\n    _nextid = 0\n\n    _param_names = None\n    # _param_map is a mapping of the compound model's generated param names to\n    # the parameters of submodels they are associated with.  The values in this\n    # mapping are (idx, name) tuples were idx is the index of the submodel this\n    # parameter is associated with, and name is the same parameter's name on\n    # the submodel\n    # In principle this will allow compound models to give entirely new names\n    # to parameters that don't have to be the same as their original names on\n    # the submodels, but right now that isn't taken advantage of\n    _param_map = None\n\n    _slice_offset = 0\n    # When taking slices of a compound model, this keeps track of how offset\n    # the first model in the slice is from the first model in the original\n    # compound model it was taken from\n\n    # This just inverts _param_map, swapping keys with values.  This is also\n    # useful to have.\n    _param_map_inverse = None\n    _fittable = None\n\n    _evaluate = None\n\n    def __getitem__(cls, index):\n        index = cls._normalize_index(index)\n\n        if isinstance(index, (int, np.integer)):\n            return cls._get_submodels()[index]\n        else:\n            return cls._get_slice(index.start, index.stop)\n\n    def __getattr__(cls, attr):\n        # Make sure the _tree attribute is set; otherwise we are not looking up\n        # an attribute on a concrete compound model class and should just raise\n        # the AttributeError\n        if cls._tree is not None and attr in cls.param_names:\n            cls._init_param_descriptors()\n            return getattr(cls, attr)\n\n        raise AttributeError(attr)\n\n    def __repr__(cls):\n        if cls._tree is None:\n            # This case is mostly for debugging purposes\n            return cls._format_cls_repr()\n\n        expression = cls._format_expression()\n        components = cls._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n\n        return cls._format_cls_repr(keywords=keywords)\n\n    def __dir__(cls):\n        \"\"\"\n        Returns a list of attributes defined on a compound model, including\n        all of its parameters.\n        \"\"\"\n\n        basedir = super().__dir__()\n\n        if cls._tree is not None:\n            for name in cls.param_names:\n                basedir.append(name)\n\n            basedir.sort()\n\n        return basedir\n\n    def __reduce__(cls):\n        rv = super().__reduce__()\n\n        if isinstance(rv, tuple):\n            # Delete _evaluate from the members dict\n            with suppress(KeyError):\n                del rv[1][2]['_evaluate']\n\n        return rv\n\n    @property\n    def submodel_names(cls):\n        if cls._submodel_names is None:\n            seen = {}\n            names = []\n            for idx, submodel in enumerate(cls._get_submodels()):\n                name = str(submodel.name)\n                if name in seen:\n                    names.append('{0}_{1}'.format(name, idx))\n                    if seen[name] >= 0:\n                        jdx = seen[name]\n                        names[jdx] = '{0}_{1}'.format(names[jdx], jdx)\n                        seen[name] = -1\n                else:\n                    names.append(name)\n                    seen[name] = idx\n            cls._submodel_names = tuple(names)\n\n        return cls._submodel_names\n\n    @property\n    def param_names(cls):\n        if cls._param_names is None:\n            cls._init_param_names()\n\n        return cls._param_names\n\n    @property\n    def fittable(cls):\n        if cls._fittable is None:\n            cls._fittable = all(m.fittable for m in cls._get_submodels())\n\n        return cls._fittable\n\n    # TODO: Maybe we could use make_function_with_signature for evaluate, but\n    # it's probably not worth it (and I'm not sure what the limit is on number\n    # of function arguments/local variables but we could break that limit for\n    # complicated compound models...\n    def evaluate(cls, *args):\n        if cls._evaluate is None:\n            func = cls._tree.evaluate(BINARY_OPERATORS,\n                                      getter=cls._model_evaluate_getter)[0]\n            cls._evaluate = func\n        inputs = args[:cls.n_inputs]\n        params = iter(args[cls.n_inputs:])\n        result = cls._evaluate(inputs, params)\n        if cls.n_outputs == 1:\n            return result[0]\n        else:\n            return result\n\n    # TODO: This supports creating a new compound model from two existing\n    # compound models (or normal models) and a single operator.  However, it\n    # ought also to be possible to create a new model from an *entire*\n    # expression, represented as a sequence of operators and their operands (or\n    # an exiting ExpressionTree) and build that into a compound model without\n    # creating an intermediate _CompoundModel class for every single operator\n    # in the expression.  This will prove to be a useful optimization in many\n    # cases\n    @classmethod\n    def _from_operator(mcls, operator, left, right, additional_members={}):\n        \"\"\"\n        Given a Python operator (represented by a string, such as ``'+'``\n        or ``'*'``, and two model classes or instances, return a new compound\n        model that evaluates the given operator on the outputs of the left and\n        right input models.\n\n        If either of the input models are a model *class* (i.e. a subclass of\n        `~astropy.modeling.Model`) then the returned model is a new subclass of\n        `~astropy.modeling.Model` that may be instantiated with any parameter\n        values.  If both input models are *instances* of a model, a new class\n        is still created, but this method returns an *instance* of that class,\n        taking the parameter values from the parameters of the input model\n        instances.\n\n        If given, the ``additional_members`` `dict` may provide additional\n        class members that should be added to the generated\n        `~astropy.modeling.Model` subclass.  Some members that are generated by\n        this method should not be provided by ``additional_members``.  These\n        include ``_tree``, ``inputs``, ``outputs``, ``linear``,\n        ``standard_broadcasting``, and ``__module__`.  This is currently for\n        internal use only.\n        \"\"\"\n        # Note, currently this only supports binary operators, but could be\n        # easily extended to support unary operators (namely '-') if/when\n        # needed\n        children = []\n        for child in (left, right):\n            if isinstance(child, (_CompoundModelMeta, _CompoundModel)):\n                \"\"\"\n                Although the original child models were copied we make another\n                copy here to ensure that changes in this child compound model\n                parameters will not propagate to the reuslt, that is\n                cm1 = Gaussian1D(1, 5, .1) + Gaussian1D()\n                cm2 = cm1 | Scale()\n                cm1.amplitude_0 = 100\n                assert(cm2.amplitude_0 == 1)\n                \"\"\"\n                children.append(copy.deepcopy(child._tree))\n            elif isinstance(child, Model):\n                children.append(ExpressionTree(child.copy()))\n            else:\n                children.append(ExpressionTree(child))\n\n        tree = ExpressionTree(operator, left=children[0], right=children[1])\n\n        name = str('CompoundModel{0}'.format(_CompoundModelMeta._nextid))\n        _CompoundModelMeta._nextid += 1\n\n        mod = find_current_module(3)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        inputs, outputs = mcls._check_inputs_and_outputs(operator, left, right)\n\n        if operator in ('|', '+', '-'):\n            linear = left.linear and right.linear\n        else:\n            # Which is not to say it is *definitely* not linear but it would be\n            # trickier to determine\n            linear = False\n\n        standard_broadcasting = \\\n                left.standard_broadcasting and right.standard_broadcasting\n\n        # Note: If any other members are added here, make sure to mention them\n        # in the docstring of this method.\n        members = additional_members\n        members.update({\n            '_tree': tree,\n            '_is_dynamic': True,  # See docs for _ModelMeta._is_dynamic\n            'inputs': inputs,\n            'outputs': outputs,\n            'linear': linear,\n            'standard_broadcasting': standard_broadcasting,\n            '__module__': str(modname)})\n\n        new_cls = mcls(name, (_CompoundModel,), members)\n\n        if isinstance(left, Model) and isinstance(right, Model):\n            # Both models used in the operator were already instantiated models,\n            # not model *classes*.  As such it's not particularly useful to return\n            # the class itself, but to instead produce a new instance:\n            instance = new_cls()\n\n            # Workaround for https://github.com/astropy/astropy/issues/3542\n            # TODO: Any effort to restructure the tree-like data structure for\n            # compound models should try to obviate this workaround--if\n            # intermediate compound models are stored in the tree as well then\n            # we can immediately check for custom inverses on sub-models when\n            # computing the inverse\n            instance._user_inverse = mcls._make_user_inverse(\n                    operator, left, right)\n\n            if left._n_models == right._n_models:\n                instance._n_models = left._n_models\n            else:\n                raise ValueError('Model sets must have the same number of '\n                                 'components.')\n\n            return instance\n\n        # Otherwise return the new uninstantiated class itself\n        return new_cls\n\n    @classmethod\n    def _check_inputs_and_outputs(mcls, operator, left, right):\n        # TODO: These aren't the full rules for handling inputs and outputs, but\n        # this will handle most basic cases correctly\n        if operator == '|':\n            inputs = left.inputs\n            outputs = right.outputs\n\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        elif operator == '&':\n            inputs = combine_labels(left.inputs, right.inputs)\n            outputs = combine_labels(left.outputs, right.outputs)\n        else:\n            # Without loss of generality\n            inputs = left.inputs\n            outputs = left.outputs\n\n            if (left.n_inputs != right.n_inputs or\n                    left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    \"Unsupported operands for {0}: {1} (n_inputs={2}, \"\n                    \"n_outputs={3}) and {4} (n_inputs={5}, n_outputs={6}); \"\n                    \"models must have the same n_inputs and the same \"\n                    \"n_outputs for this operator\".format(\n                        operator, left.name, left.n_inputs, left.n_outputs,\n                        right.name, right.n_inputs, right.n_outputs))\n\n        return inputs, outputs\n\n    @classmethod\n    def _make_user_inverse(mcls, operator, left, right):\n        \"\"\"\n        Generates an inverse `Model` for this `_CompoundModel` when either\n        model in the operation has a *custom inverse* that was manually\n        assigned by the user.\n\n        If either model has a custom inverse, and in particular if another\n        `_CompoundModel` has a custom inverse, then none of that model's\n        sub-models should be considered at all when computing the inverse.\n        So in that case we just compute the inverse ahead of time and set\n        it as the new compound model's custom inverse.\n\n        Note, this use case only applies when combining model instances,\n        since model classes don't currently have a notion of a \"custom\n        inverse\" (though it could probably be supported by overriding the\n        class's inverse property).\n\n        TODO: Consider fixing things so the aforementioned class-based case\n        works as well.  However, for the present purposes this is good enough.\n        \"\"\"\n\n        if not (operator in ('&', '|') and\n                (left._user_inverse or right._user_inverse)):\n            # These are the only operators that support an inverse right now\n            return None\n\n        try:\n            left_inv = left.inverse\n            right_inv = right.inverse\n        except NotImplementedError:\n            # If either inverse is undefined then just return False; this\n            # means the normal _CompoundModel.inverse routine will fail\n            # naturally anyways, since it requires all sub-models to have\n            # an inverse defined\n            return None\n\n        if operator == '&':\n            return left_inv & right_inv\n        else:\n            return right_inv | left_inv\n\n    # TODO: Perhaps, just perhaps, the post-order (or ???-order) ordering of\n    # leaf nodes is something the ExpressionTree class itself could just know\n    def _get_submodels(cls):\n        # Would make this a lazyproperty but those don't currently work with\n        # type objects\n        if cls._submodels is not None:\n            return cls._submodels\n\n        submodels = [c.value for c in cls._tree.traverse_postorder()\n                     if c.isleaf]\n        cls._submodels = submodels\n        return submodels\n\n    def _init_param_descriptors(cls):\n        \"\"\"\n        This routine sets up the names for all the parameters on a compound\n        model, including figuring out unique names for those parameters and\n        also mapping them back to their associated parameters of the underlying\n        submodels.\n\n        Setting this all up is costly, and only necessary for compound models\n        that a user will directly interact with.  For example when building an\n        expression like::\n\n            >>> M = (Model1 + Model2) * Model3  # doctest: +SKIP\n\n        the user will generally never interact directly with the temporary\n        result of the subexpression ``(Model1 + Model2)``.  So there's no need\n        to setup all the parameters for that temporary throwaway.  Only once\n        the full expression is built and the user initializes or introspects\n        ``M`` is it necessary to determine its full parameterization.\n        \"\"\"\n\n        # Accessing cls.param_names will implicitly call _init_param_names if\n        # needed and thus also set up the _param_map; I'm not crazy about that\n        # design but it stands for now\n        for param_name in cls.param_names:\n            submodel_idx, submodel_param = cls._param_map[param_name]\n            submodel = cls[submodel_idx]\n\n            orig_param = getattr(submodel, submodel_param, None)\n\n            if isinstance(submodel, Model):\n                # Take the parameter's default from the model's value for that\n                # parameter\n                default = orig_param.value\n            else:\n                default = orig_param.default\n\n            # Copy constraints\n            constraints = dict((key, getattr(orig_param, key))\n                               for key in Model.parameter_constraints)\n\n            # Note: Parameter.copy() returns a new unbound Parameter, never\n            # a bound Parameter even if submodel is a Model instance (as\n            # opposed to a Model subclass)\n            new_param = orig_param.copy(name=param_name, default=default,\n                                        unit=orig_param.unit,\n                                        **constraints)\n\n            setattr(cls, param_name, new_param)\n\n    def _init_param_names(cls):\n        \"\"\"\n        This subroutine is solely for setting up the ``param_names`` attribute\n        itself.\n\n        See ``_init_param_descriptors`` for the full parameter setup.\n        \"\"\"\n\n        # Currently this skips over Model *instances* in the expression tree;\n        # basically these are treated as constants and do not add\n        # fittable/tunable parameters to the compound model.\n        # TODO: I'm not 100% happy with this design, and maybe we need some\n        # interface for distinguishing fittable/settable parameters with\n        # *constant* parameters (which would be distinct from parameters with\n        # fixed constraints since they're permanently locked in place). But I'm\n        # not sure if this is really the best way to treat the issue.\n\n        names = []\n        param_map = {}\n\n        # Start counting the suffix indices to put on parameter names from the\n        # slice_offset.  Usually this will just be zero, but for compound\n        # models that were sliced from another compound model this may be > 0\n        param_suffix = cls._slice_offset\n\n        for idx, model in enumerate(cls._get_submodels()):\n            if not model.param_names:\n                # Skip models that don't have parameters in the numbering\n                # TODO: Reevaluate this if it turns out to be confusing, though\n                # parameter-less models are not very common in practice (there\n                # are a few projections that don't take parameters)\n                continue\n\n            for param_name in model.param_names:\n                # This is sort of heuristic, but we want to check that\n                # model.param_name *actually* returns a Parameter descriptor,\n                # and that the model isn't some inconsistent type that happens\n                # to have a param_names attribute but does not actually\n                # implement settable parameters.\n                # In the future we can probably remove this check, but this is\n                # here specifically to support the legacy compat\n                # _CompositeModel which can be considered a pathological case\n                # in the context of the new framework\n                # if not isinstance(getattr(model, param_name, None),\n                #                  Parameter):\n                #    break\n                name = '{0}_{1}'.format(param_name, param_suffix + idx)\n                names.append(name)\n                param_map[name] = (idx, param_name)\n\n        cls._param_names = tuple(names)\n        cls._param_map = param_map\n        cls._param_map_inverse = dict((v, k) for k, v in param_map.items())\n\n    def _format_expression(cls):\n        # TODO: At some point might be useful to make a public version of this,\n        # albeit with more formatting options\n        return cls._tree.format_expression(OPERATOR_PRECEDENCE)\n\n    def _format_components(cls):\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                                 for idx, m in enumerate(cls._get_submodels()))\n\n    def _normalize_index(cls, index):\n        \"\"\"\n        Converts an index given to __getitem__ to either an integer, or\n        a slice with integer start and stop values.\n\n        If the length of the slice is exactly 1 this converts the index to a\n        simple integer lookup.\n\n        Negative integers are converted to positive integers.\n        \"\"\"\n\n        def get_index_from_name(name):\n            try:\n                return cls.submodel_names.index(name)\n            except ValueError:\n                raise IndexError(\n                    'Compound model {0} does not have a component named '\n                    '{1}'.format(cls.name, name))\n\n        def check_for_negative_index(index):\n            if index < 0:\n                new_index = len(cls.submodel_names) + index\n                if new_index < 0:\n                    # If still < 0 then this is an invalid index\n                    raise IndexError(\n                            \"Model index {0} out of range.\".format(index))\n                else:\n                    index = new_index\n\n            return index\n\n        if isinstance(index, str):\n            return get_index_from_name(index)\n        elif isinstance(index, slice):\n            if index.step not in (1, None):\n                # In principle it could be but I can scarcely imagine a case\n                # where it would be useful.  If someone can think of one then\n                # we can enable it.\n                raise ValueError(\n                    \"Step not supported for compound model slicing.\")\n            start = index.start if index.start is not None else 0\n            stop = (index.stop\n                    if index.stop is not None else len(cls.submodel_names))\n            if isinstance(start, (int, np.integer)):\n                start = check_for_negative_index(start)\n            if isinstance(stop, (int, np.integer)):\n                stop = check_for_negative_index(stop)\n            if isinstance(start, str):\n                start = get_index_from_name(start)\n            if isinstance(stop, str):\n                stop = get_index_from_name(stop) + 1\n            length = stop - start\n\n            if length == 1:\n                return start\n            elif length <= 0:\n                raise ValueError(\"Empty slice of a compound model.\")\n\n            return slice(start, stop)\n        elif isinstance(index, (int, np.integer)):\n            if index >= len(cls.submodel_names):\n                raise IndexError(\n                        \"Model index {0} out of range.\".format(index))\n\n            return check_for_negative_index(index)\n\n        raise TypeError(\n            'Submodels can be indexed either by their integer order or '\n            'their name (got {0!r}).'.format(index))\n\n    def _get_slice(cls, start, stop):\n        \"\"\"\n        Return a new model build from a sub-expression of the expression\n        represented by this model.\n\n        Right now this is highly inefficient, as it creates a new temporary\n        model for each operator that appears in the sub-expression.  It would\n        be better if this just built a new expression tree, and the new model\n        instantiated directly from that tree.\n\n        Once tree -> model instantiation is possible this should be fixed to\n        use that instead.\n        \"\"\"\n\n        members = {'_slice_offset': cls._slice_offset + start}\n        operators = dict((oper, _model_oper(oper, additional_members=members))\n                         for oper in BINARY_OPERATORS)\n\n        return cls._tree.evaluate(operators, start=start, stop=stop)\n\n    @staticmethod\n    def _model_evaluate_getter(idx, model):\n        n_params = len(model.param_names)\n        n_inputs = model.n_inputs\n        n_outputs = model.n_outputs\n\n        # There is currently an unfortunate inconsistency in some models, which\n        # requires them to be instantiated for their evaluate to work.  I think\n        # that needs to be reconsidered and fixed somehow, but in the meantime\n        # we need to check for that case\n        if (not isinstance(model, Model) and\n                isinstancemethod(model, model.evaluate)):\n            if n_outputs == 1:\n                # Where previously model was a class, now make an instance\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return (model(*param_values).evaluate(\n                        *chain(inputs, param_values)),)\n            else:\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return model(*param_values).evaluate(\n                        *chain(inputs, param_values))\n        else:\n            evaluate = model.evaluate\n            if n_outputs == 1:\n                f = lambda inputs, params: \\\n                    (evaluate(*chain(inputs, islice(params, n_params))),)\n            else:\n                f = lambda inputs, params: \\\n                    evaluate(*chain(inputs, islice(params, n_params)))\n\n        return (f, n_inputs, n_outputs)\n\n\nclass _CompoundModel(Model, metaclass=_CompoundModelMeta):\n    fit_deriv = None\n    col_fit_deriv = False\n\n    _submodels = None\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 __getattr__(self, attr):\n        # This __getattr__ is necessary, because _CompoundModelMeta creates\n        # Parameter descriptors *lazily*--they do not exist in the class\n        # __dict__ until one of them has been accessed.\n        # However, this is at odds with how Python looks up descriptors (see\n        # (https://docs.python.org/3/reference/datamodel.html#invoking-descriptors)\n        # which is to look directly in the class __dict__\n        # This workaround allows descriptors to work correctly when they are\n        # not initially found in the class __dict__\n        value = getattr(self.__class__, attr)\n        if hasattr(value, '__get__'):\n            # Object is a descriptor, so we should really return the result of\n            # its __get__\n            value = value.__get__(self, self.__class__)\n        return value\n\n    def __getitem__(self, index):\n        index = self.__class__._normalize_index(index)\n        model = self.__class__[index]\n\n        if isinstance(index, slice):\n            param_names = model.param_names\n        else:\n            param_map = self.__class__._param_map_inverse\n            param_names = tuple(param_map[index, name]\n                                for name in model.param_names)\n\n        return model._from_existing(self, param_names)\n\n    @property\n    def submodel_names(self):\n        return self.__class__.submodel_names\n\n    @sharedmethod\n    def n_submodels(self):\n        return len(self.submodel_names)\n\n    @property\n    def param_names(self):\n        return self.__class__.param_names\n\n    @property\n    def fittable(self):\n        return self.__class__.fittable\n\n    @sharedmethod\n    def evaluate(self, *args):\n        return self.__class__.evaluate(*args)\n\n    # TODO: The way this works is highly inefficient--the inverse is created by\n    # making a new model for each operator in the compound model, which could\n    # potentially mean creating a large number of temporary throwaway model\n    # classes.  This can definitely be optimized in the future by implementing\n    # a way to construct a single model class from an existing tree\n    @property\n    def inverse(self):\n        def _not_implemented(oper):\n            def _raise(x, y):\n                raise NotImplementedError(\n                    \"The inverse is not currently defined for compound \"\n                    \"models created using the {0} operator.\".format(oper))\n            return _raise\n\n        operators = dict((oper, _not_implemented(oper))\n                         for oper in ('+', '-', '*', '/', '**'))\n        operators['&'] = operator.and_\n        # Reverse the order of compositions\n        operators['|'] = lambda x, y: operator.or_(y, x)\n\n        leaf_idx = -1\n\n        def getter(idx, model):\n            try:\n                # By indexing on self[] this will return an instance of the\n                # model, with all the appropriate parameters set, which is\n                # currently required to return an inverse\n                return self[idx].inverse\n            except NotImplementedError:\n                raise NotImplementedError(\n                    \"All models in a composite model must have an inverse \"\n                    \"defined in order for the composite model to have an \"\n                    \"inverse.  {0!r} does not have an inverse.\".format(model))\n\n        return self._tree.evaluate(operators, getter=getter)\n\n    @sharedmethod\n    def _get_submodels(self):\n        return self.__class__._get_submodels()\n\n    def _parameter_units_for_data_units(self, input_units, output_units):\n        units_for_data = {}\n        for imodel, model in enumerate(self._submodels):\n            units_for_data_sub = model._parameter_units_for_data_units(input_units, output_units)\n            for param_sub in units_for_data_sub:\n                param = self._param_map_inverse[(imodel, param_sub)]\n                units_for_data[param] = units_for_data_sub[param_sub]\n        return units_for_data\n\n    def deepcopy(self):\n        \"\"\"\n        Return a deep copy of a compound model.\n        \"\"\"\n        new_model = self.copy()\n        new_model._submodels = [model.deepcopy() for model in self._submodels]\n        return new_model\n\n\ndef custom_model(*args, fit_deriv=None, **kwargs):\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    .. 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    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 kwargs:\n        warnings.warn(\n            \"Function received unexpected arguments ({}) these \"\n            \"are ignored but will raise an Exception in the \"\n            \"future.\".format(list(kwargs)),\n            AstropyDeprecationWarning)\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_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, params = get_inputs_and_params(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    # TODO: Maybe have a clever scheme for default output name?\n    if inputs:\n        output_names = (inputs[0].name,)\n    else:\n        output_names = ('x',)\n\n    params = dict((param.name, Parameter(param.name, default=param.default))\n                  for param in params)\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        'inputs': tuple(x.name for x in inputs),\n        'outputs': output_names,\n        'evaluate': staticmethod(func),\n    }\n\n    if fit_deriv is not None:\n        members['fit_deriv'] = staticmethod(fit_deriv)\n\n    members.update(params)\n\n    return type(model_name, (FittableModel,), members)\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 ``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:`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, 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) 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 _prepare_inputs_single_model(model, params, inputs, **kwargs):\n    broadcasts = []\n\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 model.standard_broadcasting:\n                    broadcast = check_broadcast(input_shape, param.shape)\n                else:\n                    broadcast = input_shape\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(model.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 model.n_outputs > model.n_inputs:\n        if len(set(broadcasts)) > 1:\n            raise ValueError(\n                \"For models with n_outputs > n_inputs, the combination of \"\n                \"all inputs and parameters must broadcast to the same shape, \"\n                \"which will be used as the shape of all outputs.  In this \"\n                \"case some of the inputs had different shapes, so it is \"\n                \"ambiguous how to format outputs for this model.  Try using \"\n                \"inputs that are all the same size and shape.\")\n        else:\n            # Extend the broadcasts list to include shapes for all outputs\n            extra_outputs = model.n_outputs - model.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_model)\n                broadcasts.append(None)\n            broadcasts.extend([broadcasts[0]] * extra_outputs)\n\n    return inputs, (broadcasts,)\n\n\ndef _prepare_outputs_single_model(model, outputs, format_info):\n    broadcasts = format_info[0]\n\n    outputs = list(outputs)\n\n    for idx, output in enumerate(outputs):\n        broadcast_shape = broadcasts[idx]\n        if broadcast_shape is not None:\n            if not broadcast_shape:\n                # Shape is (), i.e. a scalar should be returned\n                outputs[idx] = np.asscalar(output)\n            else:\n                outputs[idx] = output.reshape(broadcast_shape)\n\n    return tuple(outputs)\n\n\ndef _prepare_inputs_model_set(model, params, inputs, n_models, model_set_axis,\n                              **kwargs):\n    reshaped = []\n    pivots = []\n\n    for idx, _input in enumerate(inputs):\n        max_param_shape = ()\n\n        if n_models > 1 and model_set_axis is not False:\n            # Use the shape of the input *excluding* the model axis\n            input_shape = (_input.shape[:model_set_axis] +\n                           _input.shape[model_set_axis + 1:])\n        else:\n            input_shape = _input.shape\n\n        for param in params:\n            try:\n                check_broadcast(input_shape, param.shape)\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(model.inputs[idx], input_shape,\n                                    param.name, param.shape))\n\n            if len(param.shape) > len(max_param_shape):\n                max_param_shape = param.shape\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 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.model_set_axis\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 = model.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,\n                                        pivot + 1)\n\n        pivots.append(pivot)\n        reshaped.append(new_input)\n\n    if model.n_inputs < model.n_outputs:\n        pivots.extend([model_set_axis] * (model.n_outputs - model.n_inputs))\n\n    return reshaped, (pivots,)\n\n\ndef _prepare_outputs_model_set(model, outputs, format_info):\n    pivots = format_info[0]\n\n    outputs = list(outputs)\n\n    for idx, output in enumerate(outputs):\n        pivot = pivots[idx]\n        if pivot < output.ndim and pivot != model.model_set_axis:\n            outputs[idx] = np.rollaxis(output, pivot,\n                                       model.model_set_axis)\n\n    return tuple(outputs)\n\n\ndef _validate_input_shapes(inputs, argnames, n_models, model_set_axis,\n                           validate_broadcasting):\n    \"\"\"\n    Perform basic validation of model inputs--that they are mutually\n    broadcastable and that they have the minimum dimensions for the given\n    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 = n_models > 1 and model_set_axis is not False\n\n    if not (validate_broadcasting or check_model_set_axis):\n        # Nothing else needed here\n        return\n\n    all_shapes = []\n\n    for idx, _input in enumerate(inputs):\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                    \"For model_set_axis={0}, all inputs must be at \"\n                    \"least {1}-dimensional.\".format(\n                        model_set_axis, model_set_axis + 1))\n            elif input_shape[model_set_axis] != n_models:\n                raise ValueError(\n                    \"Input argument {0!r} does not have the correct \"\n                    \"dimensions in model_set_axis={1} for a model set with \"\n                    \"n_models={2}.\".format(argnames[idx], model_set_axis,\n                                           n_models))\n        all_shapes.append(input_shape)\n\n    if not validate_broadcasting:\n        return\n\n    try:\n        input_broadcast = check_broadcast(*all_shapes)\n    except IncompatibleShapeError as exc:\n        shape_a, shape_a_idx, shape_b, shape_b_idx = exc.args\n        arg_a = argnames[shape_a_idx]\n        arg_b = argnames[shape_b_idx]\n\n        raise ValueError(\n            \"Model input argument {0!r} of shape {1!r} cannot \"\n            \"be broadcast with input {2!r} of shape {3!r}\".format(\n                arg_a, shape_a, arg_b, shape_b))\n\n    return input_broadcast\n\n\ncopyreg.pickle(_ModelMeta, _ModelMeta.__reduce__)\ncopyreg.pickle(_CompoundModelMeta, _CompoundModelMeta.__reduce__)\n"},{"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":477,"id":10238,"nodeType":"Class","startLoc":78,"text":"class _ModelMeta(OrderedDescriptorContainer, InheritDocstrings, 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    _parameters_ = OrderedDict()\n\n    def __new__(mcls, name, bases, members):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n\n        return super().__new__(mcls, name, bases, members)\n\n    def __init__(cls, name, bases, members):\n        # Make sure OrderedDescriptorContainer gets to run before doing\n        # anything else\n        super().__init__(name, bases, members)\n\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(cls._parameters_)\n            else:\n                cls.param_names = tuple(cls._parameters_)\n\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        cls._handle_special_methods(members)\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        else:\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 n_inputs(cls):\n        return len(cls.inputs)\n\n    @property\n    def n_outputs(cls):\n        return len(cls.outputs)\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):\n        \"\"\"\n        Creates a copy of this model class with a new name.\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 '__main__.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            Inputs: ('x', 'y')\n            Outputs: ('x', 'y')\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        new_cls = type(name, (cls,), {})\n        new_cls.__module__ = modname\n\n        if hasattr(cls, '__qualname__'):\n            if new_cls.__module__ == '__main__':\n                # __main__ is not added to a class's qualified name\n                new_cls.__qualname__ = name\n            else:\n                new_cls.__qualname__ = '{0}.{1}'.format(modname, 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 = _BoundingBox.validate(cls, bounding_box)\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            # TODO: Maybe warn in the above case?\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 _BoundingBox 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__ = make_function_with_signature(__call__, ('self',), kwargs)\n\n        return type(str('_{0}BoundingBox'.format(cls.name)), (_BoundingBox,),\n                    {'__call__': __call__})\n\n    def _handle_special_methods(cls, members):\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__ = '{0}.{1}'.format(\n                        cls.__qualname__, wrapper.__name__)\n\n        if ('__call__' not in members and 'inputs' in members and\n                isinstance(members['inputs'], tuple)):\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            inputs = members['inputs']\n            args = ('self',) + inputs\n            new_call = make_function_with_signature(\n                    __call__, args, [('model_set_axis', None),\n                                     ('with_bounding_box', False),\n                                     ('fill_value', np.nan),\n                                     ('equivalencies', None)])\n\n            # The following makes it look like __call__ 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\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional arguments\n            if all(p.default is not None for p in cls._parameters_.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name in cls.param_names:\n                    default = cls._parameters_[param_name].default\n                    unit = cls._parameters_[param_name].unit\n                    # If the unit was specified in the parameter but the default\n                    # is not a Quantity, attach the unit to the 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',) + cls.param_names\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\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 '{0} ({1})'.format(cls.name, ' -> '.join(bases))\n            else:\n                return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('Inputs', cls.inputs),\n                ('Outputs', cls.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('{0}: {1}'.format(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]"},{"className":"Sersic1D","col":0,"comment":"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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":693,"id":10239,"nodeType":"Class","startLoc":601,"text":"class Sersic1D(Fittable1DModel):\n    r\"\"\"\n    One dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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)\n    r_eff = Parameter(default=1)\n    n = Parameter(default=4)\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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic1D model requires scipy > 0.11.')\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        else:\n            return {'x': self.r_eff.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('r_eff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"null","endLoc":108,"header":"def __new__(mcls, name, bases, members)","id":10240,"name":"__new__","nodeType":"Function","startLoc":103,"text":"def __new__(mcls, name, bases, members):\n        # See the docstring for _is_dynamic above\n        if '_is_dynamic' not in members:\n            members['_is_dynamic'] = mcls._is_dynamic\n\n        return super().__new__(mcls, name, bases, members)"},{"col":4,"comment":"One dimensional Sersic profile function.","endLoc":682,"header":"@classmethod\n    def evaluate(cls, r, amplitude, r_eff, n)","id":10241,"name":"evaluate","nodeType":"Function","startLoc":670,"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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic1D model requires scipy > 0.11.')\n\n        return (amplitude * np.exp(\n            -cls._gammaincinv(2 * n, 0.5) * ((r / r_eff) ** (1 / n) - 1)))"},{"col":4,"comment":"null","endLoc":126,"header":"def __init__(cls, name, bases, members)","id":10242,"name":"__init__","nodeType":"Function","startLoc":110,"text":"def __init__(cls, name, bases, members):\n        # Make sure OrderedDescriptorContainer gets to run before doing\n        # anything else\n        super().__init__(name, bases, members)\n\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(cls._parameters_)\n            else:\n                cls.param_names = tuple(cls._parameters_)\n\n        cls._create_inverse_property(members)\n        cls._create_bounding_box_property(members)\n        cls._handle_special_methods(members)"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10243,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"utils.py#<anonymous>","id":10244,"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', 'block_reduce', 'block_replicate',\n           'NoOverlapError', 'PartialOverlapError', 'Cutout2D']"},{"col":4,"comment":"null","endLoc":191,"header":"def _evaluate(self, phi, theta, lon, lat, lon_pole)","id":10245,"name":"_evaluate","nodeType":"Function","startLoc":183,"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"},{"fileName":"blackbody.py","filePath":"astropy/modeling","id":10246,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nModel and functions related to blackbody radiation.\n\n.. _blackbody-planck-law:\n\nBlackbody Radiation\n-------------------\n\nBlackbody flux is calculated with Planck law\n(:ref:`Rybicki & Lightman 1979 <ref-rybicki1979>`):\n\n.. math::\n\n    B_{\\\\lambda}(T) = \\\\frac{2 h c^{2} / \\\\lambda^{5}}{exp(h c / \\\\lambda k T) - 1}\n\n    B_{\\\\nu}(T) = \\\\frac{2 h \\\\nu^{3} / c^{2}}{exp(h \\\\nu / k T) - 1}\n\nwhere the unit of :math:`B_{\\\\lambda}(T)` is\n:math:`erg \\\\; s^{-1} cm^{-2} \\\\mathring{A}^{-1} sr^{-1}`, and\n:math:`B_{\\\\nu}(T)` is :math:`erg \\\\; s^{-1} cm^{-2} Hz^{-1} sr^{-1}`.\n:func:`~astropy.modeling.blackbody.blackbody_lambda` and\n:func:`~astropy.modeling.blackbody.blackbody_nu` calculate the\nblackbody flux for :math:`B_{\\\\lambda}(T)` and :math:`B_{\\\\nu}(T)`,\nrespectively.\n\nFor blackbody representation as a model, see :class:`BlackBody1D`.\n\n.. _blackbody-examples:\n\nExamples\n^^^^^^^^\n\n>>> import numpy as np\n>>> from astropy import units as u\n>>> from astropy.modeling.blackbody import blackbody_lambda, blackbody_nu\n\nCalculate blackbody flux for 5000 K at 100 and 10000 Angstrom while suppressing\nany Numpy warnings:\n\n>>> wavelengths = [100, 10000] * u.AA\n>>> temperature = 5000 * u.K\n>>> with np.errstate(all='ignore'):\n...     flux_lam = blackbody_lambda(wavelengths, temperature)\n...     flux_nu = blackbody_nu(wavelengths, temperature)\n>>> flux_lam  # doctest: +FLOAT_CMP\n<Quantity [  1.27452545e-108,  7.10190526e+005] erg / (Angstrom cm2 s sr)>\n>>> flux_nu  # doctest: +FLOAT_CMP\n<Quantity [  4.25135927e-123,  2.36894060e-005] erg / (cm2 Hz s sr)>\n\nPlot a blackbody spectrum for 5000 K:\n\n.. plot::\n\n    import matplotlib.pyplot as plt\n    import numpy as np\n    from astropy import constants as const\n    from astropy import units as u\n    from astropy.modeling.blackbody import blackbody_lambda\n\n    temperature = 5000 * u.K\n    wavemax = (const.b_wien / temperature).to(u.AA)  # Wien's displacement law\n    waveset = np.logspace(\n        0, np.log10(wavemax.value + 10 * wavemax.value), num=1000) * u.AA\n    with np.errstate(all='ignore'):\n        flux = blackbody_lambda(waveset, temperature)\n\n    fig, ax = plt.subplots(figsize=(8, 5))\n    ax.plot(waveset.value, flux.value)\n    ax.axvline(wavemax.value, ls='--')\n    ax.get_yaxis().get_major_formatter().set_powerlimits((0, 1))\n    ax.set_xlabel(r'$\\\\lambda$ ({0})'.format(waveset.unit))\n    ax.set_ylabel(r'$B_{\\\\lambda}(T)$')\n    ax.set_title('Blackbody, T = {0}'.format(temperature))\n\nNote that an array of temperatures can also be given instead of a single\ntemperature. In this case, the Numpy broadcasting rules apply: for instance, if\nthe frequency and temperature have the same shape, the output will have this\nshape too, while if the frequency is a 2-d array with shape ``(n, m)`` and the\ntemperature is an array with shape ``(m,)``, the output will have a shape\n``(n, m)``.\n\nSee Also\n^^^^^^^^\n\n.. _ref-rybicki1979:\n\nRybicki, G. B., & Lightman, A. P. 1979, Radiative Processes in Astrophysics (New York, NY: Wiley)\n\n\"\"\"\n\nimport warnings\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .core import Fittable1DModel\nfrom .parameters import Parameter\nfrom .. import constants as const\nfrom .. import units as u\nfrom ..utils.exceptions import AstropyUserWarning\n\n__all__ = ['BlackBody1D', 'blackbody_nu', 'blackbody_lambda']\n\n# Units\nFNU = u.erg / (u.cm**2 * u.s * u.Hz)\nFLAM = u.erg / (u.cm**2 * u.s * u.AA)\n\n# Some platform implementations of expm1() are buggy and Numpy uses\n# them anyways--the bug is that on certain large inputs it returns\n# NaN instead of INF like it should (it should only return NaN on a\n# NaN input\n# See https://github.com/astropy/astropy/issues/4171\nwith warnings.catch_warnings():\n    warnings.simplefilter('ignore', RuntimeWarning)\n    _has_buggy_expm1 = np.isnan(np.expm1(1000))\n\n\nclass BlackBody1D(Fittable1DModel):\n    \"\"\"\n    One dimensional blackbody model.\n\n    Parameters\n    ----------\n    temperature : :class:`~astropy.units.Quantity`\n        Blackbody temperature.\n    bolometric_flux : :class:`~astropy.units.Quantity`\n        The bolometric flux of the blackbody (i.e., the integral over the\n        spectral axis).\n\n    Notes\n    -----\n\n    Model formula:\n\n        .. math:: f(x) = \\\\pi B_{\\\\nu} f_{\\\\text{bolometric}} / (\\\\sigma  T^{4})\n\n    Examples\n    --------\n    >>> from astropy.modeling import models\n    >>> from astropy import units as u\n    >>> bb = models.BlackBody1D()\n    >>> bb(6000 * u.AA)  # doctest: +FLOAT_CMP\n    <Quantity 1.3585381201978953e-15 erg / (cm2 Hz s)>\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 BlackBody1D\n        from astropy.modeling.blackbody import FLAM\n        from astropy import units as u\n        from astropy.visualization import quantity_support\n\n        bb = BlackBody1D(temperature=5778*u.K)\n        wav = np.arange(1000, 110000) * u.AA\n        flux = bb(wav).to(FLAM, u.spectral_density(wav))\n\n        with quantity_support():\n            plt.figure()\n            plt.semilogx(wav, flux)\n            plt.axvline(bb.lambda_max.to(u.AA).value, ls='--')\n            plt.show()\n\n    \"\"\"\n\n    # We parametrize this model with a temperature and a bolometric flux. The\n    # bolometric flux is the integral of the model over the spectral axis. This\n    # is more useful than simply having an amplitude parameter.\n    temperature = Parameter(default=5000, min=0, unit=u.K)\n    bolometric_flux = Parameter(default=1, unit=u.erg / u.cm ** 2 / u.s)\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, bolometric_flux):\n        \"\"\"Evaluate the model.\n\n        Parameters\n        ----------\n        x : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\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        bolometric_flux : float, `~numpy.ndarray`, or `~astropy.units.Quantity`\n            Desired integral for the blackbody.\n\n        Returns\n        -------\n        y : number or ndarray\n            Blackbody spectrum. The units are determined from the units of\n            ``bolometric_flux``.\n        \"\"\"\n\n        # We need to make sure that we attach units to the temperature if it\n        # doesn't have any units. We do this because even though blackbody_nu\n        # can take temperature values without units, the / temperature ** 4\n        # factor needs units to be defined.\n        if isinstance(temperature, u.Quantity):\n            temperature = temperature.to(u.K, equivalencies=u.temperature())\n        else:\n            temperature = u.Quantity(temperature, u.K)\n\n        # We normalize the returned blackbody so that the integral would be\n        # unity, and we then multiply by the bolometric flux. A normalized\n        # blackbody has f_nu = pi * B_nu / (sigma * T^4), which is what we\n        # calculate here. We convert to 1/Hz to make sure the units are\n        # simplified as much as possible, then we multiply by the bolometric\n        # flux to get the normalization right.\n        fnu = ((np.pi * u.sr * blackbody_nu(x, temperature) /\n                const.sigma_sb / temperature ** 4).to(1 / u.Hz) *\n               bolometric_flux)\n\n        # If the bolometric_flux parameter has no unit, we should drop the /Hz\n        # and return a unitless value. This occurs for instance during fitting,\n        # since we drop the units temporarily.\n        if hasattr(bolometric_flux, 'unit'):\n            return fnu\n        else:\n            return fnu.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 {'x': u.Hz}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('temperature', u.K),\n                            ('bolometric_flux', outputs_unit['y'] * u.Hz)])\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\ndef blackbody_nu(in_x, temperature):\n    \"\"\"Calculate blackbody flux per steradian, :math:`B_{\\\\nu}(T)`.\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    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Hz.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\\\; cm^{-2} s^{-1} Hz^{-1} sr^{-1}`.\n\n    Raises\n    ------\n    ValueError\n        Invalid temperature.\n\n    ZeroDivisionError\n        Wavelength is zero (when converting to frequency).\n\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(in_x, u.Hz, dtype=np.float64)\n        temp = u.Quantity(temperature, u.K, dtype=np.float64)\n\n    # Check if input values are physically possible\n    if np.any(temp < 0):\n        raise ValueError('Temperature should be positive: {0}'.format(temp))\n    if not np.all(np.isfinite(freq)) or np.any(freq <= 0):\n        warnings.warn('Input contains invalid wavelength/frequency value(s)',\n                      AstropyUserWarning)\n\n    log_boltz = const.h * freq / (const.k_B * temp)\n    boltzm1 = np.expm1(log_boltz)\n\n    if _has_buggy_expm1:\n        # Replace incorrect nan results with infs--any result of 'nan' is\n        # incorrect unless the input (in log_boltz) happened to be nan to begin\n        # with.  (As noted in #4393 ideally this would be replaced by a version\n        # of expm1 that doesn't have this bug, rather than fixing incorrect\n        # results after the fact...)\n        boltzm1_nans = np.isnan(boltzm1)\n        if np.any(boltzm1_nans):\n            if boltzm1.isscalar and not np.isnan(log_boltz):\n                boltzm1 = np.inf\n            else:\n                boltzm1[np.where(~np.isnan(log_boltz) & boltzm1_nans)] = np.inf\n\n    # Calculate blackbody flux\n    bb_nu = (2.0 * const.h * freq ** 3 / (const.c ** 2 * boltzm1))\n    flux = bb_nu.to(FNU, u.spectral_density(freq))\n\n    return flux / u.sr  # Add per steradian to output flux unit\n\n\ndef blackbody_lambda(in_x, temperature):\n    \"\"\"Like :func:`blackbody_nu` but for :math:`B_{\\\\lambda}(T)`.\n\n    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Angstrom.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\\\; cm^{-2} s^{-1} \\\\mathring{A}^{-1} sr^{-1}`.\n\n    \"\"\"\n    if getattr(in_x, 'unit', None) is None:\n        in_x = u.Quantity(in_x, u.AA)\n\n    bb_nu = blackbody_nu(in_x, temperature) * u.sr  # Remove sr for conversion\n    flux = bb_nu.to(FLAM, u.spectral_density(in_x))\n\n    return flux / u.sr  # Add per steradian to output flux unit\n"},{"col":4,"comment":"null","endLoc":689,"header":"@property\n    def input_units(self)","id":10247,"name":"input_units","nodeType":"Function","startLoc":684,"text":"@property\n    def input_units(self):\n        if self.r_eff.unit is None:\n            return None\n        else:\n            return {'x': self.r_eff.unit}"},{"col":4,"comment":"null","endLoc":693,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10248,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":691,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('r_eff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":665,"id":10249,"name":"amplitude","nodeType":"Attribute","startLoc":665,"text":"amplitude"},{"col":0,"comment":"Like :func:`blackbody_nu` but for :math:`B_{\\lambda}(T)`.\n\n    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Angstrom.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\; cm^{-2} s^{-1} \\mathring{A}^{-1} sr^{-1}`.\n\n    ","endLoc":346,"header":"def blackbody_lambda(in_x, temperature)","id":10250,"name":"blackbody_lambda","nodeType":"Function","startLoc":320,"text":"def blackbody_lambda(in_x, temperature):\n    \"\"\"Like :func:`blackbody_nu` but for :math:`B_{\\\\lambda}(T)`.\n\n    Parameters\n    ----------\n    in_x : number, array-like, or `~astropy.units.Quantity`\n        Frequency, wavelength, or wave number.\n        If not a Quantity, it is assumed to be in Angstrom.\n\n    temperature : number, array-like, or `~astropy.units.Quantity`\n        Blackbody temperature.\n        If not a Quantity, it is assumed to be in Kelvin.\n\n    Returns\n    -------\n    flux : `~astropy.units.Quantity`\n        Blackbody monochromatic flux in\n        :math:`erg \\\\; cm^{-2} s^{-1} \\\\mathring{A}^{-1} sr^{-1}`.\n\n    \"\"\"\n    if getattr(in_x, 'unit', None) is None:\n        in_x = u.Quantity(in_x, u.AA)\n\n    bb_nu = blackbody_nu(in_x, temperature) * u.sr  # Remove sr for conversion\n    flux = bb_nu.to(FLAM, u.spectral_density(in_x))\n\n    return flux / u.sr  # Add per steradian to output flux unit"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":666,"id":10251,"name":"r_eff","nodeType":"Attribute","startLoc":666,"text":"r_eff"},{"col":4,"comment":"null","endLoc":382,"header":"@property\n    def input_units(self)","id":10252,"name":"input_units","nodeType":"Function","startLoc":377,"text":"@property\n    def input_units(self):\n        if self.x_break.unit is None:\n            return None\n        else:\n            return {'x': self.x_break.unit}"},{"col":4,"comment":"null","endLoc":386,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10253,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":384,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_break', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":172,"id":10254,"name":"lon","nodeType":"Attribute","startLoc":172,"text":"lon"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":246,"id":10255,"name":"amplitude","nodeType":"Attribute","startLoc":246,"text":"amplitude"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":667,"id":10256,"name":"n","nodeType":"Attribute","startLoc":667,"text":"n"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":173,"id":10257,"name":"lat","nodeType":"Attribute","startLoc":173,"text":"lat"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":247,"id":10258,"name":"x_break","nodeType":"Attribute","startLoc":247,"text":"x_break"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":174,"id":10259,"name":"lon_pole","nodeType":"Attribute","startLoc":174,"text":"lon_pole"},{"attributeType":"None","col":4,"comment":"null","endLoc":668,"id":10260,"name":"_gammaincinv","nodeType":"Attribute","startLoc":668,"text":"_gammaincinv"},{"attributeType":"null","col":16,"comment":"null","endLoc":677,"id":10261,"name":"_gammaincinv","nodeType":"Attribute","startLoc":677,"text":"cls._gammaincinv"},{"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    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":779,"id":10262,"nodeType":"Class","startLoc":696,"text":"class Sine1D(Fittable1DModel):\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    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    amplitude = Parameter(default=1)\n    frequency = Parameter(default=1)\n    phase = Parameter(default=0)\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 input_units(self):\n        if self.frequency.unit is None:\n            return None\n        else:\n            return {'x': 1. / self.frequency.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('frequency', inputs_unit['x'] ** -1),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":248,"id":10263,"name":"alpha_1","nodeType":"Attribute","startLoc":248,"text":"alpha_1"},{"col":4,"comment":"One dimensional Sine model function","endLoc":757,"header":"@staticmethod\n    def evaluate(x, amplitude, frequency, phase)","id":10264,"name":"evaluate","nodeType":"Function","startLoc":746,"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":"One dimensional Sine model derivative","endLoc":768,"header":"@staticmethod\n    def fit_deriv(x, amplitude, frequency, phase)","id":10265,"name":"fit_deriv","nodeType":"Function","startLoc":759,"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":"null","endLoc":775,"header":"@property\n    def input_units(self)","id":10266,"name":"input_units","nodeType":"Function","startLoc":770,"text":"@property\n    def input_units(self):\n        if self.frequency.unit is None:\n            return None\n        else:\n            return {'x': 1. / self.frequency.unit}"},{"attributeType":"null","col":8,"comment":"null","endLoc":181,"id":10267,"name":"axes_order","nodeType":"Attribute","startLoc":181,"text":"self.axes_order"},{"col":4,"comment":"null","endLoc":779,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10268,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":777,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('frequency', inputs_unit['x'] ** -1),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":742,"id":10269,"name":"amplitude","nodeType":"Attribute","startLoc":742,"text":"amplitude"},{"className":"RotateNative2Celestial","col":0,"comment":"\n    Transform from Native to Celestial Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    ","endLoc":260,"id":10270,"nodeType":"Class","startLoc":194,"text":"class RotateNative2Celestial(_SkyRotation):\n    \"\"\"\n    Transform from Native to Celestial Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    \"\"\"\n\n    #: Inputs are angles on the native sphere\n    inputs = ('phi_N', 'theta_N')\n\n    #: Outputs are angles on the celestial sphere\n    outputs = ('alpha_C', 'delta_C')\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n    def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles in the Native coordinate system.\n        lon, lat, lon_pole : float (in deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles on the Celestial sphere.\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":221,"header":"@property\n    def input_units(self)","id":10271,"name":"input_units","nodeType":"Function","startLoc":218,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}"},{"col":4,"comment":" Output units. ","endLoc":226,"header":"@property\n    def return_units(self)","id":10272,"name":"return_units","nodeType":"Function","startLoc":223,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}"},{"col":4,"comment":"null","endLoc":229,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":10273,"name":"__init__","nodeType":"Function","startLoc":228,"text":"def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":249,"id":10274,"name":"alpha_2","nodeType":"Attribute","startLoc":249,"text":"alpha_2"},{"col":4,"comment":"null","endLoc":250,"header":"def _create_inverse_property(cls, members)","id":10275,"name":"_create_inverse_property","nodeType":"Function","startLoc":233,"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"},{"col":4,"comment":"\n        Parameters\n        ----------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles in the Native coordinate system.\n        lon, lat, lon_pole : float (in deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles on the Celestial sphere.\n        ","endLoc":255,"header":"def evaluate(self, phi_N, theta_N, lon, lat, lon_pole)","id":10276,"name":"evaluate","nodeType":"Function","startLoc":231,"text":"def evaluate(self, phi_N, theta_N, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles in the Native coordinate system.\n        lon, lat, lon_pole : float (in deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles on the Celestial sphere.\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":10277,"name":"__all__","nodeType":"Attribute","startLoc":103,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":10278,"name":"FNU","nodeType":"Attribute","startLoc":106,"text":"FNU"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":250,"id":10279,"name":"delta","nodeType":"Attribute","startLoc":250,"text":"delta"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":743,"id":10280,"name":"frequency","nodeType":"Attribute","startLoc":743,"text":"frequency"},{"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":452,"id":10281,"nodeType":"Class","startLoc":389,"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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\n    x_cutoff = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('x_cutoff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional exponential cutoff power law model function","endLoc":426,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, x_cutoff)","id":10282,"name":"evaluate","nodeType":"Function","startLoc":421,"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)"},{"col":4,"comment":"One dimensional exponential cutoff power law derivative with respect to parameters","endLoc":440,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, x_cutoff)","id":10283,"name":"fit_deriv","nodeType":"Function","startLoc":428,"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]"},{"col":4,"comment":"null","endLoc":260,"header":"@property\n    def inverse(self)","id":10284,"name":"inverse","nodeType":"Function","startLoc":257,"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":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":291,"header":"def _create_bounding_box_property(cls, members)","id":10285,"name":"_create_bounding_box_property","nodeType":"Function","startLoc":252,"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 = _BoundingBox.validate(cls, bounding_box)\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            # TODO: Maybe warn in the above case?\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"},{"col":4,"comment":"null","endLoc":447,"header":"@property\n    def input_units(self)","id":10286,"name":"input_units","nodeType":"Function","startLoc":442,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":452,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10287,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":449,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('x_cutoff', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":10288,"name":"FLAM","nodeType":"Attribute","startLoc":107,"text":"FLAM"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":416,"id":10289,"name":"amplitude","nodeType":"Attribute","startLoc":416,"text":"amplitude"},{"col":4,"comment":"null","endLoc":298,"header":"def __init__(self, lon, lat, lon_pole, **kwargs)","id":10290,"name":"__init__","nodeType":"Function","startLoc":297,"text":"def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":213,"id":10291,"name":"inputs","nodeType":"Attribute","startLoc":213,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":116,"id":10292,"name":"_has_buggy_expm1","nodeType":"Attribute","startLoc":116,"text":"_has_buggy_expm1"},{"attributeType":"null","col":4,"comment":"null","endLoc":216,"id":10293,"name":"outputs","nodeType":"Attribute","startLoc":216,"text":"outputs"},{"className":"RotateCelestial2Native","col":0,"comment":"\n    Transform from Celestial to Native Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    ","endLoc":329,"id":10294,"nodeType":"Class","startLoc":263,"text":"class RotateCelestial2Native(_SkyRotation):\n    \"\"\"\n    Transform from Celestial to Native Spherical Coordinates.\n\n    Parameters\n    ----------\n    lon : float or or `~astropy.units.Quantity`\n        Celestial longitude of the fiducial point.\n    lat : float or or `~astropy.units.Quantity`\n        Celestial latitude of the fiducial point.\n    lon_pole : float or or `~astropy.units.Quantity`\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 in units of deg.\n    \"\"\"\n\n    #: Inputs are angles on the celestial sphere\n    inputs = ('alpha_C', 'delta_C')\n\n    #: Outputs are angles on the native sphere\n    outputs = ('phi_N', 'theta_N')\n\n    @property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}\n\n    @property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}\n\n    def __init__(self, lon, lat, lon_pole, **kwargs):\n        super().__init__(lon, lat, lon_pole, **kwargs)\n\n    def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles in the Celestial coordinate frame.\n        lon, lat, lon_pole : float (deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles on the Native sphere.\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":0,"comment":"","endLoc":90,"header":"blackbody.py#<anonymous>","id":10295,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nModel and functions related to blackbody radiation.\n\n.. _blackbody-planck-law:\n\nBlackbody Radiation\n-------------------\n\nBlackbody flux is calculated with Planck law\n(:ref:`Rybicki & Lightman 1979 <ref-rybicki1979>`):\n\n.. math::\n\n    B_{\\\\lambda}(T) = \\\\frac{2 h c^{2} / \\\\lambda^{5}}{exp(h c / \\\\lambda k T) - 1}\n\n    B_{\\\\nu}(T) = \\\\frac{2 h \\\\nu^{3} / c^{2}}{exp(h \\\\nu / k T) - 1}\n\nwhere the unit of :math:`B_{\\\\lambda}(T)` is\n:math:`erg \\\\; s^{-1} cm^{-2} \\\\mathring{A}^{-1} sr^{-1}`, and\n:math:`B_{\\\\nu}(T)` is :math:`erg \\\\; s^{-1} cm^{-2} Hz^{-1} sr^{-1}`.\n:func:`~astropy.modeling.blackbody.blackbody_lambda` and\n:func:`~astropy.modeling.blackbody.blackbody_nu` calculate the\nblackbody flux for :math:`B_{\\\\lambda}(T)` and :math:`B_{\\\\nu}(T)`,\nrespectively.\n\nFor blackbody representation as a model, see :class:`BlackBody1D`.\n\n.. _blackbody-examples:\n\nExamples\n^^^^^^^^\n\n>>> import numpy as np\n>>> from astropy import units as u\n>>> from astropy.modeling.blackbody import blackbody_lambda, blackbody_nu\n\nCalculate blackbody flux for 5000 K at 100 and 10000 Angstrom while suppressing\nany Numpy warnings:\n\n>>> wavelengths = [100, 10000] * u.AA\n>>> temperature = 5000 * u.K\n>>> with np.errstate(all='ignore'):\n...     flux_lam = blackbody_lambda(wavelengths, temperature)\n...     flux_nu = blackbody_nu(wavelengths, temperature)\n>>> flux_lam  # doctest: +FLOAT_CMP\n<Quantity [  1.27452545e-108,  7.10190526e+005] erg / (Angstrom cm2 s sr)>\n>>> flux_nu  # doctest: +FLOAT_CMP\n<Quantity [  4.25135927e-123,  2.36894060e-005] erg / (cm2 Hz s sr)>\n\nPlot a blackbody spectrum for 5000 K:\n\n.. plot::\n\n    import matplotlib.pyplot as plt\n    import numpy as np\n    from astropy import constants as const\n    from astropy import units as u\n    from astropy.modeling.blackbody import blackbody_lambda\n\n    temperature = 5000 * u.K\n    wavemax = (const.b_wien / temperature).to(u.AA)  # Wien's displacement law\n    waveset = np.logspace(\n        0, np.log10(wavemax.value + 10 * wavemax.value), num=1000) * u.AA\n    with np.errstate(all='ignore'):\n        flux = blackbody_lambda(waveset, temperature)\n\n    fig, ax = plt.subplots(figsize=(8, 5))\n    ax.plot(waveset.value, flux.value)\n    ax.axvline(wavemax.value, ls='--')\n    ax.get_yaxis().get_major_formatter().set_powerlimits((0, 1))\n    ax.set_xlabel(r'$\\\\lambda$ ({0})'.format(waveset.unit))\n    ax.set_ylabel(r'$B_{\\\\lambda}(T)$')\n    ax.set_title('Blackbody, T = {0}'.format(temperature))\n\nNote that an array of temperatures can also be given instead of a single\ntemperature. In this case, the Numpy broadcasting rules apply: for instance, if\nthe frequency and temperature have the same shape, the output will have this\nshape too, while if the frequency is a 2-d array with shape ``(n, m)`` and the\ntemperature is an array with shape ``(m,)``, the output will have a shape\n``(n, m)``.\n\nSee Also\n^^^^^^^^\n\n.. _ref-rybicki1979:\n\nRybicki, G. B., & Lightman, A. P. 1979, Radiative Processes in Astrophysics (New York, NY: Wiley)\n\n\"\"\"\n\n__all__ = ['BlackBody1D', 'blackbody_nu', 'blackbody_lambda']\n\nFNU = u.erg / (u.cm**2 * u.s * u.Hz)\n\nFLAM = u.erg / (u.cm**2 * u.s * u.AA)\n\nwith warnings.catch_warnings():\n    warnings.simplefilter('ignore', RuntimeWarning)\n    _has_buggy_expm1 = np.isnan(np.expm1(1000))"},{"col":4,"comment":" Input units. ","endLoc":290,"header":"@property\n    def input_units(self)","id":10296,"name":"input_units","nodeType":"Function","startLoc":287,"text":"@property\n    def input_units(self):\n        \"\"\" Input units. \"\"\"\n        return {'alpha_C': u.deg, 'delta_C': u.deg}"},{"col":4,"comment":" Output units. ","endLoc":295,"header":"@property\n    def return_units(self)","id":10297,"name":"return_units","nodeType":"Function","startLoc":292,"text":"@property\n    def return_units(self):\n        \"\"\" Output units. \"\"\"\n        return {'phi_N': u.deg, 'theta_N': u.deg}"},{"col":4,"comment":"\n        Parameters\n        ----------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles in the Celestial coordinate frame.\n        lon, lat, lon_pole : float (deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles on the Native sphere.\n\n        ","endLoc":325,"header":"def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole)","id":10298,"name":"evaluate","nodeType":"Function","startLoc":300,"text":"def evaluate(self, alpha_C, delta_C, lon, lat, lon_pole):\n        \"\"\"\n        Parameters\n        ----------\n        alpha_C, delta_C : float (deg) or `~astropy.units.Quantity`\n            Angles in the Celestial coordinate frame.\n        lon, lat, lon_pole : float (deg) or `~astropy.units.Quantity`\n            Parameter values when the model was initialized.\n\n        Returns\n        -------\n        phi_N, theta_N : float (deg) or `~astropy.units.Quantity`\n            Angles on the Native sphere.\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"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":744,"id":10299,"name":"phase","nodeType":"Attribute","startLoc":744,"text":"phase"},{"col":4,"comment":"null","endLoc":329,"header":"@property\n    def inverse(self)","id":10300,"name":"inverse","nodeType":"Function","startLoc":327,"text":"@property\n    def inverse(self):\n        return RotateNative2Celestial(self.lon, self.lat, self.lon_pole)"},{"fileName":"projections.py","filePath":"astropy/modeling","id":10301,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\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\n\nimport numpy as np\n\nfrom .core import Model\nfrom .parameters import Parameter, InputParameterError\n\nfrom .. import units as u\n\nfrom . import _projections\nfrom .utils import _to_radian, _to_orig_unit\n\n\nprojcodes = [\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\n\n__all__ = ['Projection', 'Pix2SkyProjection', 'Sky2PixProjection',\n           'Zenithal', 'Cylindrical', 'PseudoCylindrical', 'Conic',\n           'PseudoConic', 'QuadCube', 'HEALPix',\n           'AffineTransformation2D',\n           'projcodes',\n\n           'Pix2Sky_ZenithalPerspective', 'Sky2Pix_ZenithalPerspective',\n           'Pix2Sky_SlantZenithalPerspective', 'Sky2Pix_SlantZenithalPerspective',\n           'Pix2Sky_Gnomonic', 'Sky2Pix_Gnomonic',\n           'Pix2Sky_Stereographic', 'Sky2Pix_Stereographic',\n           'Pix2Sky_SlantOrthographic', 'Sky2Pix_SlantOrthographic',\n           'Pix2Sky_ZenithalEquidistant', 'Sky2Pix_ZenithalEquidistant',\n           'Pix2Sky_ZenithalEqualArea', 'Sky2Pix_ZenithalEqualArea',\n           'Pix2Sky_Airy', 'Sky2Pix_Airy',\n           'Pix2Sky_CylindricalPerspective', 'Sky2Pix_CylindricalPerspective',\n           'Pix2Sky_CylindricalEqualArea', 'Sky2Pix_CylindricalEqualArea',\n           'Pix2Sky_PlateCarree', 'Sky2Pix_PlateCarree',\n           'Pix2Sky_Mercator', 'Sky2Pix_Mercator',\n           'Pix2Sky_SansonFlamsteed', 'Sky2Pix_SansonFlamsteed',\n           'Pix2Sky_Parabolic', 'Sky2Pix_Parabolic',\n           'Pix2Sky_Molleweide', 'Sky2Pix_Molleweide',\n           'Pix2Sky_HammerAitoff', 'Sky2Pix_HammerAitoff',\n           'Pix2Sky_ConicPerspective', 'Sky2Pix_ConicPerspective',\n           'Pix2Sky_ConicEqualArea', 'Sky2Pix_ConicEqualArea',\n           'Pix2Sky_ConicEquidistant', 'Sky2Pix_ConicEquidistant',\n           'Pix2Sky_ConicOrthomorphic', 'Sky2Pix_ConicOrthomorphic',\n           'Pix2Sky_BonneEqualArea', 'Sky2Pix_BonneEqualArea',\n           'Pix2Sky_Polyconic', 'Sky2Pix_Polyconic',\n           'Pix2Sky_TangentialSphericalCube', 'Sky2Pix_TangentialSphericalCube',\n           'Pix2Sky_COBEQuadSphericalCube', 'Sky2Pix_COBEQuadSphericalCube',\n           'Pix2Sky_QuadSphericalCube', 'Sky2Pix_QuadSphericalCube',\n           'Pix2Sky_HEALPix', 'Sky2Pix_HEALPix',\n           'Pix2Sky_HEALPixPolar', 'Sky2Pix_HEALPixPolar',\n\n           # The following are short FITS WCS aliases\n           'Pix2Sky_AZP', 'Sky2Pix_AZP',\n           'Pix2Sky_SZP', 'Sky2Pix_SZP',\n           'Pix2Sky_TAN', 'Sky2Pix_TAN',\n           'Pix2Sky_STG', 'Sky2Pix_STG',\n           'Pix2Sky_SIN', 'Sky2Pix_SIN',\n           'Pix2Sky_ARC', 'Sky2Pix_ARC',\n           'Pix2Sky_ZEA', 'Sky2Pix_ZEA',\n           'Pix2Sky_AIR', 'Sky2Pix_AIR',\n           'Pix2Sky_CYP', 'Sky2Pix_CYP',\n           'Pix2Sky_CEA', 'Sky2Pix_CEA',\n           'Pix2Sky_CAR', 'Sky2Pix_CAR',\n           'Pix2Sky_MER', 'Sky2Pix_MER',\n           'Pix2Sky_SFL', 'Sky2Pix_SFL',\n           'Pix2Sky_PAR', 'Sky2Pix_PAR',\n           'Pix2Sky_MOL', 'Sky2Pix_MOL',\n           'Pix2Sky_AIT', 'Sky2Pix_AIT',\n           'Pix2Sky_COP', 'Sky2Pix_COP',\n           'Pix2Sky_COE', 'Sky2Pix_COE',\n           'Pix2Sky_COD', 'Sky2Pix_COD',\n           'Pix2Sky_COO', 'Sky2Pix_COO',\n           'Pix2Sky_BON', 'Sky2Pix_BON',\n           'Pix2Sky_PCO', 'Sky2Pix_PCO',\n           'Pix2Sky_TSC', 'Sky2Pix_TSC',\n           'Pix2Sky_CSC', 'Sky2Pix_CSC',\n           'Pix2Sky_QSC', 'Sky2Pix_QSC',\n           'Pix2Sky_HPX', 'Sky2Pix_HPX',\n           'Pix2Sky_XPH', 'Sky2Pix_XPH'\n]\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    @property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\"\n\n\nclass Pix2SkyProjection(Projection):\n    \"\"\"Base class for all Pix2Sky projections.\"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('phi', 'theta')\n\n    input_units_strict = True\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        return {'x': u.deg, 'y': u.deg}\n\n    @property\n    def return_units(self):\n        return {'phi': u.deg, 'theta': u.deg}\n\n\nclass Sky2PixProjection(Projection):\n    \"\"\"Base class for all Sky2Pix projections.\"\"\"\n\n    inputs = ('phi', 'theta')\n    outputs = ('x', 'y')\n\n    input_units_strict = True\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        return {'phi': u.deg, 'theta': u.deg}\n\n    @property\n    def return_units(self):\n        return {'x': u.deg, 'y': u.deg}\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    _separable = False\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 = Parameter(default=0.0)\n    gamma = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    def __init__(self, mu=mu.default, gamma=gamma.default, **kwargs):\n        # units : mu - in spherical radii, gamma - in deg\n        # TODO: Support quantity objects here and in similar contexts\n        super().__init__(mu, gamma, **kwargs)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalPerspective(self.mu.value, self.gamma.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, gamma):\n        return _projections.azpx2s(x, y, mu, _to_orig_unit(gamma))\n\n\nPix2Sky_AZP = Pix2Sky_ZenithalPerspective\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 = Parameter(default=0.0)\n    gamma = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n    @property\n    def inverse(self):\n        return Pix2Sky_AZP(self.mu.value, self.gamma.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, gamma):\n        return _projections.azps2x(\n            phi, theta, mu, _to_orig_unit(gamma))\n\n\nSky2Pix_AZP = Sky2Pix_ZenithalPerspective\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    def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\n                \"Zenithal perspective projection is not defined for mu=-1\")\n        return mu\n\n    mu = Parameter(default=0.0, setter=_validate_mu)\n    phi0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    theta0 = Parameter(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, phi0, theta0):\n        return _projections.szpx2s(\n            x, y, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))\n\n\nPix2Sky_SZP = Pix2Sky_SlantZenithalPerspective\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    def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\"Zenithal perspective projection is not defined for mu=-1\")\n        return mu\n\n    mu = Parameter(default=0.0, setter=_validate_mu)\n    phi0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    theta0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, phi0, theta0):\n        return _projections.szps2x(\n            phi, theta, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))\n\n\nSky2Pix_SZP = Sky2Pix_SlantZenithalPerspective\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    @property\n    def inverse(self):\n        return Sky2Pix_Gnomonic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.tanx2s(x, y)\n\n\nPix2Sky_TAN = Pix2Sky_Gnomonic\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    @property\n    def inverse(self):\n        return Pix2Sky_Gnomonic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tans2x(phi, theta)\n\n\nSky2Pix_TAN = Sky2Pix_Gnomonic\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    @property\n    def inverse(self):\n        return Sky2Pix_Stereographic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.stgx2s(x, y)\n\n\nPix2Sky_STG = Pix2Sky_Stereographic\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    @property\n    def inverse(self):\n        return Pix2Sky_Stereographic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.stgs2x(phi, theta)\n\n\nSky2Pix_STG = Sky2Pix_Stereographic\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 = Parameter(default=0.0)\n    eta = Parameter(default=0.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_SlantOrthographic(self.xi.value, self.eta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, xi, eta):\n        return _projections.sinx2s(x, y, xi, eta)\n\n\nPix2Sky_SIN = Pix2Sky_SlantOrthographic\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 = Parameter(default=0.0)\n    eta = Parameter(default=0.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_SlantOrthographic(self.xi.value, self.eta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, xi, eta):\n        return _projections.sins2x(phi, theta, xi, eta)\n\n\nSky2Pix_SIN = Sky2Pix_SlantOrthographic\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    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalEquidistant()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.arcx2s(x, y)\n\n\nPix2Sky_ARC = Pix2Sky_ZenithalEquidistant\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    @property\n    def inverse(self):\n        return Pix2Sky_ZenithalEquidistant()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.arcs2x(phi, theta)\n\n\nSky2Pix_ARC = Sky2Pix_ZenithalEquidistant\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    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalEqualArea()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.zeax2s(x, y)\n\n\nPix2Sky_ZEA = Pix2Sky_ZenithalEqualArea\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    @property\n    def inverse(self):\n        return Pix2Sky_ZenithalEqualArea()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.zeas2x(phi, theta)\n\n\nSky2Pix_ZEA = Sky2Pix_ZenithalEqualArea\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 = Parameter(default=90.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Airy(self.theta_b.value)\n\n    @classmethod\n    def evaluate(cls, x, y, theta_b):\n        return _projections.airx2s(x, y, theta_b)\n\n\nPix2Sky_AIR = Pix2Sky_Airy\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    theta_b = Parameter(default=90.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Airy(self.theta_b.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, theta_b):\n        return _projections.airs2x(phi, theta, theta_b)\n\n\nSky2Pix_AIR = Sky2Pix_Airy\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 = Parameter(default=1.0)\n    lam = Parameter(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    @property\n    def inverse(self):\n        return Sky2Pix_CylindricalPerspective(self.mu.value, self.lam.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, lam):\n        return _projections.cypx2s(x, y, mu, lam)\n\n\nPix2Sky_CYP = Pix2Sky_CylindricalPerspective\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 = Parameter(default=1.0)\n    lam = Parameter(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    @property\n    def inverse(self):\n        return Pix2Sky_CylindricalPerspective(self.mu, self.lam)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, lam):\n        return _projections.cyps2x(phi, theta, mu, lam)\n\n\nSky2Pix_CYP = Sky2Pix_CylindricalPerspective\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 0.\n    \"\"\"\n\n    lam = Parameter(default=1)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_CylindricalEqualArea(self.lam)\n\n    @classmethod\n    def evaluate(cls, x, y, lam):\n        return _projections.ceax2s(x, y, lam)\n\n\nPix2Sky_CEA = Pix2Sky_CylindricalEqualArea\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\n    lam = Parameter(default=1)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_CylindricalEqualArea(self.lam)\n\n    @classmethod\n    def evaluate(cls, phi, theta, lam):\n        return _projections.ceas2x(phi, theta, lam)\n\n\nSky2Pix_CEA = Sky2Pix_CylindricalEqualArea\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    @property\n    def inverse(self):\n        return Sky2Pix_PlateCarree()\n\n    @staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x, copy=True)\n        theta = np.array(y, copy=True)\n\n        return phi, theta\n\n\nPix2Sky_CAR = Pix2Sky_PlateCarree\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    @property\n    def inverse(self):\n        return Pix2Sky_PlateCarree()\n\n    @staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi, copy=True)\n        y = np.array(theta, copy=True)\n\n        return x, y\n\n\nSky2Pix_CAR = Sky2Pix_PlateCarree\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    @property\n    def inverse(self):\n        return Sky2Pix_Mercator()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.merx2s(x, y)\n\n\nPix2Sky_MER = Pix2Sky_Mercator\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    @property\n    def inverse(self):\n        return Pix2Sky_Mercator()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mers2x(phi, theta)\n\n\nSky2Pix_MER = Sky2Pix_Mercator\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\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    @property\n    def inverse(self):\n        return Sky2Pix_SansonFlamsteed()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.sflx2s(x, y)\n\n\nPix2Sky_SFL = Pix2Sky_SansonFlamsteed\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    @property\n    def inverse(self):\n        return Pix2Sky_SansonFlamsteed()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.sfls2x(phi, theta)\n\n\nSky2Pix_SFL = Sky2Pix_SansonFlamsteed\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Parabolic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.parx2s(x, y)\n\n\nPix2Sky_PAR = Pix2Sky_Parabolic\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Parabolic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pars2x(phi, theta)\n\n\nSky2Pix_PAR = Sky2Pix_Parabolic\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Molleweide()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.molx2s(x, y)\n\n\nPix2Sky_MOL = Pix2Sky_Molleweide\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Molleweide()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mols2x(phi, theta)\n\n\nSky2Pix_MOL = Sky2Pix_Molleweide\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HammerAitoff()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.aitx2s(x, y)\n\n\nPix2Sky_AIT = Pix2Sky_HammerAitoff\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HammerAitoff()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.aits2x(phi, theta)\n\n\nSky2Pix_AIT = Sky2Pix_HammerAitoff\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 = Parameter(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n    delta = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    _separable = False\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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicPerspective(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.copx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nPix2Sky_COP = Pix2Sky_ConicPerspective\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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicPerspective(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cops2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nSky2Pix_COP = Sky2Pix_ConicPerspective\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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicEqualArea(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coex2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nPix2Sky_COE = Pix2Sky_ConicEqualArea\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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicEqualArea(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coes2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nSky2Pix_COE = Sky2Pix_ConicEqualArea\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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicEquidistant(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.codx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nPix2Sky_COD = Pix2Sky_ConicEquidistant\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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicEquidistant(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cods2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nSky2Pix_COD = Sky2Pix_ConicEquidistant\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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicOrthomorphic(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coox2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nPix2Sky_COO = Pix2Sky_ConicOrthomorphic\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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicOrthomorphic(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coos2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))\n\n\nSky2Pix_COO = Sky2Pix_ConicOrthomorphic\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    theta1 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    _separable = True\n\n    @property\n    def inverse(self):\n        return Sky2Pix_BonneEqualArea(self.theta1.value)\n\n    @classmethod\n    def evaluate(cls, x, y, theta1):\n        return _projections.bonx2s(x, y, _to_orig_unit(theta1))\n\n\nPix2Sky_BON = Pix2Sky_BonneEqualArea\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    theta1 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    _separable = True\n\n    @property\n    def inverse(self):\n        return Pix2Sky_BonneEqualArea(self.theta1.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, theta1):\n        return _projections.bons2x(phi, theta,\n                                   _to_orig_unit(theta1))\n\n\nSky2Pix_BON = Sky2Pix_BonneEqualArea\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Polyconic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.pcox2s(x, y)\n\n\nPix2Sky_PCO = Pix2Sky_Polyconic\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Polyconic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pcos2x(phi, theta)\n\n\nSky2Pix_PCO = Sky2Pix_Polyconic\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_TangentialSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.tscx2s(x, y)\n\n\nPix2Sky_TSC = Pix2Sky_TangentialSphericalCube\n\n\nclass Sky2Pix_TangentialSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_TangentialSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tscs2x(phi, theta)\n\n\nSky2Pix_TSC = Sky2Pix_TangentialSphericalCube\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_COBEQuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.cscx2s(x, y)\n\n\nPix2Sky_CSC = Pix2Sky_COBEQuadSphericalCube\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_COBEQuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.cscs2x(phi, theta)\n\n\nSky2Pix_CSC = Sky2Pix_COBEQuadSphericalCube\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_QuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.qscx2s(x, y)\n\n\nPix2Sky_QSC = Pix2Sky_QuadSphericalCube\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_QuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.qscs2x(phi, theta)\n\n\nSky2Pix_QSC = Sky2Pix_QuadSphericalCube\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    _separable = True\n\n    H = Parameter(default=4.0)\n    X = Parameter(default=3.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HEALPix(self.H.value, self.X.value)\n\n    @classmethod\n    def evaluate(cls, x, y, H, X):\n        return _projections.hpxx2s(x, y, H, X)\n\n\nPix2Sky_HPX = Pix2Sky_HEALPix\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    _separable = True\n\n    H = Parameter(default=4.0)\n    X = Parameter(default=3.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HEALPix(self.H.value, self.X.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, H, X):\n        return _projections.hpxs2x(phi, theta, H, X)\n\n\nSky2Pix_HPX = Sky2Pix_HEALPix\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HEALPix()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.xphx2s(x, y)\n\n\nPix2Sky_XPH = Pix2Sky_HEALPixPolar\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    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HEALPix()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.hpxs2x(phi, theta)\n\n\nSky2Pix_XPH = Sky2Pix_HEALPixPolar\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    inputs = ('x', 'y')\n    outputs = ('x', 'y')\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    @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; {0} 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        inarr = np.vstack([x.flatten(), y.flatten(), np.ones(x.size)])\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        else:\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 {'x': self.translation.unit,\n                    'y': self.translation.unit\n                    }\n        else:\n            return {'x': self.matrix.unit,\n                    'y': self.matrix.unit\n                    }\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":282,"id":10302,"name":"inputs","nodeType":"Attribute","startLoc":282,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":285,"id":10303,"name":"outputs","nodeType":"Attribute","startLoc":285,"text":"outputs"},{"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`\n        Angle of rotation (if float it should be in deg).\n    ","endLoc":399,"id":10304,"nodeType":"Class","startLoc":332,"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`\n        Angle of rotation (if float it should be in deg).\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('x', 'y')\n    _separable = False\n\n    angle = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    input_units_strict = True\n\n    input_units_allow_dimensionless = True\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 : ndarray-like\n            Input quantities\n        angle : float (deg) or `~astropy.units.Quantity`\n            Angle of rotations.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\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        if isinstance(x, u.Quantity):\n            unit = x.unit\n        else:\n            unit = None\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.value\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 unit is not None:\n            return u.Quantity(x, unit=unit), u.Quantity(y, unit=unit)\n        else:\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":"Inverse rotation.","endLoc":358,"header":"@property\n    def inverse(self)","id":10305,"name":"inverse","nodeType":"Function","startLoc":354,"text":"@property\n    def inverse(self):\n        \"\"\"Inverse rotation.\"\"\"\n\n        return self.__class__(angle=-self.angle)"},{"col":4,"comment":"\n        For Models that take optional arguments for defining their bounding\n        box, we create a subclass of _BoundingBox 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":338,"header":"def _create_bounding_box_subclass(cls, func, sig)","id":10306,"name":"_create_bounding_box_subclass","nodeType":"Function","startLoc":293,"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 _BoundingBox 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__ = make_function_with_signature(__call__, ('self',), kwargs)\n\n        return type(str('_{0}BoundingBox'.format(cls.name)), (_BoundingBox,),\n                    {'__call__': __call__})"},{"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":838,"id":10307,"nodeType":"Class","startLoc":782,"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\n    slope = Parameter(default=1)\n    intercept = Parameter(default=0)\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, slope, intercept):\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        else:\n            return {'x': self.intercept.unit / self.slope.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('intercept', outputs_unit['y']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":417,"id":10308,"name":"x_0","nodeType":"Attribute","startLoc":417,"text":"x_0"},{"col":4,"comment":"One dimensional Line model function","endLoc":813,"header":"@staticmethod\n    def evaluate(x, slope, intercept)","id":10309,"name":"evaluate","nodeType":"Function","startLoc":809,"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":821,"header":"@staticmethod\n    def fit_deriv(x, slope, intercept)","id":10310,"name":"fit_deriv","nodeType":"Function","startLoc":815,"text":"@staticmethod\n    def fit_deriv(x, slope, intercept):\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":827,"header":"@property\n    def inverse(self)","id":10311,"name":"inverse","nodeType":"Function","startLoc":823,"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)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":418,"id":10312,"name":"alpha","nodeType":"Attribute","startLoc":418,"text":"alpha"},{"col":4,"comment":"null","endLoc":834,"header":"@property\n    def input_units(self)","id":10313,"name":"input_units","nodeType":"Function","startLoc":829,"text":"@property\n    def input_units(self):\n        if self.intercept.unit is None and self.slope.unit is None:\n            return None\n        else:\n            return {'x': self.intercept.unit / self.slope.unit}"},{"col":4,"comment":"null","endLoc":838,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10314,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":836,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('intercept', outputs_unit['y']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":805,"id":10315,"name":"slope","nodeType":"Attribute","startLoc":805,"text":"slope"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":419,"id":10316,"name":"x_cutoff","nodeType":"Attribute","startLoc":419,"text":"x_cutoff"},{"col":4,"comment":"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : ndarray-like\n            Input quantities\n        angle : float (deg) or `~astropy.units.Quantity`\n            Angle of rotations.\n\n        ","endLoc":393,"header":"@classmethod\n    def evaluate(cls, x, y, angle)","id":10317,"name":"evaluate","nodeType":"Function","startLoc":360,"text":"@classmethod\n    def evaluate(cls, x, y, angle):\n        \"\"\"\n        Rotate (x, y) about ``angle``.\n\n        Parameters\n        ----------\n        x, y : ndarray-like\n            Input quantities\n        angle : float (deg) or `~astropy.units.Quantity`\n            Angle of rotations.\n\n        \"\"\"\n\n        if x.shape != y.shape:\n            raise ValueError(\"Expected input arrays to have the same shape\")\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        if isinstance(x, u.Quantity):\n            unit = x.unit\n        else:\n            unit = None\n        inarr = np.array([x.flatten(), y.flatten()])\n        if isinstance(angle, u.Quantity):\n            angle = angle.value\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 unit is not None:\n            return u.Quantity(x, unit=unit), u.Quantity(y, unit=unit)\n        else:\n            return x, y"},{"col":4,"comment":"null","endLoc":415,"header":"def _handle_special_methods(cls, members)","id":10318,"name":"_handle_special_methods","nodeType":"Function","startLoc":340,"text":"def _handle_special_methods(cls, members):\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__ = '{0}.{1}'.format(\n                        cls.__qualname__, wrapper.__name__)\n\n        if ('__call__' not in members and 'inputs' in members and\n                isinstance(members['inputs'], tuple)):\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            inputs = members['inputs']\n            args = ('self',) + inputs\n            new_call = make_function_with_signature(\n                    __call__, args, [('model_set_axis', None),\n                                     ('with_bounding_box', False),\n                                     ('fill_value', np.nan),\n                                     ('equivalencies', None)])\n\n            # The following makes it look like __call__ 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\n            # If *all* the parameters have default values we can make them\n            # keyword arguments; otherwise they must all be positional arguments\n            if all(p.default is not None for p in cls._parameters_.values()):\n                args = ('self',)\n                kwargs = []\n                for param_name in cls.param_names:\n                    default = cls._parameters_[param_name].default\n                    unit = cls._parameters_[param_name].unit\n                    # If the unit was specified in the parameter but the default\n                    # is not a Quantity, attach the unit to the 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',) + cls.param_names\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"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":806,"id":10319,"name":"intercept","nodeType":"Attribute","startLoc":806,"text":"intercept"},{"className":"Projection","col":0,"comment":"Base class for all sky projections.","endLoc":116,"id":10321,"nodeType":"Class","startLoc":102,"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    @property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":807,"id":10322,"name":"linear","nodeType":"Attribute","startLoc":807,"text":"linear"},{"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":518,"id":10323,"nodeType":"Class","startLoc":455,"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)\n    x_0 = Parameter(default=1)\n    alpha = Parameter(default=1)\n    beta = Parameter(default=0)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"className":"Planar2D","col":0,"comment":"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the straight line in X\n\n    slope_y : float\n        Slope of the straight line in Y\n\n    intercept : float\n        Z-intercept of the straight line\n\n    See Also\n    --------\n    Linear1D, Polynomial2D\n\n    Notes\n    -----\n    Model formula:\n\n        .. math:: f(x, y) = a x + b y + c\n    ","endLoc":885,"id":10324,"nodeType":"Class","startLoc":841,"text":"class Planar2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Plane model.\n\n    Parameters\n    ----------\n    slope_x : float\n        Slope of the straight line in X\n\n    slope_y : float\n        Slope of the straight line in Y\n\n    intercept : float\n        Z-intercept of the straight line\n\n    See Also\n    --------\n    Linear1D, Polynomial2D\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)\n    slope_y = Parameter(default=1)\n    intercept = Parameter(default=0)\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, slope_x, slope_y, intercept):\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]"},{"col":4,"comment":"Two dimensional Plane model function","endLoc":876,"header":"@staticmethod\n    def evaluate(x, y, slope_x, slope_y, intercept)","id":10325,"name":"evaluate","nodeType":"Function","startLoc":872,"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":885,"header":"@staticmethod\n    def fit_deriv(x, y, slope_x, slope_y, intercept)","id":10326,"name":"fit_deriv","nodeType":"Function","startLoc":878,"text":"@staticmethod\n    def fit_deriv(x, y, slope_x, slope_y, intercept):\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]"},{"col":4,"comment":"One dimensional log parabola model function","endLoc":493,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, alpha, beta)","id":10327,"name":"evaluate","nodeType":"Function","startLoc":487,"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":"One dimensional log parabola derivative with respect to parameters","endLoc":507,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, alpha, beta)","id":10328,"name":"fit_deriv","nodeType":"Function","startLoc":495,"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":514,"header":"@property\n    def input_units(self)","id":10329,"name":"input_units","nodeType":"Function","startLoc":509,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":518,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10330,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":516,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":867,"id":10331,"name":"slope_x","nodeType":"Attribute","startLoc":867,"text":"slope_x"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":482,"id":10332,"name":"amplitude","nodeType":"Attribute","startLoc":482,"text":"amplitude"},{"col":4,"comment":"\n        Inverse projection--all projection models must provide an inverse.\n        ","endLoc":116,"header":"@property\n    @abc.abstractmethod\n    def inverse(self)","id":10333,"name":"inverse","nodeType":"Function","startLoc":111,"text":"@property\n    @abc.abstractmethod\n    def inverse(self):\n        \"\"\"\n        Inverse projection--all projection models must provide an inverse.\n        \"\"\""},{"col":4,"comment":"null","endLoc":399,"header":"@staticmethod\n    def _compute_matrix(angle)","id":10334,"name":"_compute_matrix","nodeType":"Function","startLoc":395,"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":"null","col":4,"comment":"null","endLoc":107,"id":10335,"name":"r0","nodeType":"Attribute","startLoc":107,"text":"r0"},{"attributeType":"null","col":4,"comment":"null","endLoc":109,"id":10336,"name":"_separable","nodeType":"Attribute","startLoc":109,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":483,"id":10337,"name":"x_0","nodeType":"Attribute","startLoc":483,"text":"x_0"},{"className":"Pix2SkyProjection","col":0,"comment":"Base class for all Pix2Sky projections.","endLoc":134,"id":10338,"nodeType":"Class","startLoc":119,"text":"class Pix2SkyProjection(Projection):\n    \"\"\"Base class for all Pix2Sky projections.\"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('phi', 'theta')\n\n    input_units_strict = True\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        return {'x': u.deg, 'y': u.deg}\n\n    @property\n    def return_units(self):\n        return {'phi': u.deg, 'theta': u.deg}"},{"col":4,"comment":"null","endLoc":130,"header":"@property\n    def input_units(self)","id":10339,"name":"input_units","nodeType":"Function","startLoc":128,"text":"@property\n    def input_units(self):\n        return {'x': u.deg, 'y': u.deg}"},{"col":4,"comment":"null","endLoc":134,"header":"@property\n    def return_units(self)","id":10340,"name":"return_units","nodeType":"Function","startLoc":132,"text":"@property\n    def return_units(self):\n        return {'phi': u.deg, 'theta': u.deg}"},{"attributeType":"null","col":4,"comment":"null","endLoc":122,"id":10341,"name":"inputs","nodeType":"Attribute","startLoc":122,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":123,"id":10342,"name":"outputs","nodeType":"Attribute","startLoc":123,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":125,"id":10343,"name":"input_units_strict","nodeType":"Attribute","startLoc":125,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":126,"id":10344,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":126,"text":"input_units_allow_dimensionless"},{"className":"Sky2PixProjection","col":0,"comment":"Base class for all Sky2Pix projections.","endLoc":152,"id":10345,"nodeType":"Class","startLoc":137,"text":"class Sky2PixProjection(Projection):\n    \"\"\"Base class for all Sky2Pix projections.\"\"\"\n\n    inputs = ('phi', 'theta')\n    outputs = ('x', 'y')\n\n    input_units_strict = True\n    input_units_allow_dimensionless = True\n\n    @property\n    def input_units(self):\n        return {'phi': u.deg, 'theta': u.deg}\n\n    @property\n    def return_units(self):\n        return {'x': u.deg, 'y': u.deg}"},{"col":4,"comment":"null","endLoc":148,"header":"@property\n    def input_units(self)","id":10346,"name":"input_units","nodeType":"Function","startLoc":146,"text":"@property\n    def input_units(self):\n        return {'phi': u.deg, 'theta': u.deg}"},{"col":4,"comment":"null","endLoc":152,"header":"@property\n    def return_units(self)","id":10347,"name":"return_units","nodeType":"Function","startLoc":150,"text":"@property\n    def return_units(self):\n        return {'x': u.deg, 'y': u.deg}"},{"attributeType":"null","col":4,"comment":"null","endLoc":140,"id":10348,"name":"inputs","nodeType":"Attribute","startLoc":140,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":141,"id":10349,"name":"outputs","nodeType":"Attribute","startLoc":141,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":143,"id":10350,"name":"input_units_strict","nodeType":"Attribute","startLoc":143,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":144,"id":10351,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":144,"text":"input_units_allow_dimensionless"},{"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":175,"id":10352,"nodeType":"Class","startLoc":155,"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    \"\"\"\n\n    _separable = False"},{"attributeType":"null","col":4,"comment":"null","endLoc":175,"id":10353,"name":"_separable","nodeType":"Attribute","startLoc":175,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":484,"id":10354,"name":"alpha","nodeType":"Attribute","startLoc":484,"text":"alpha"},{"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    ","endLoc":226,"id":10355,"nodeType":"Class","startLoc":178,"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 = Parameter(default=0.0)\n    gamma = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    def __init__(self, mu=mu.default, gamma=gamma.default, **kwargs):\n        # units : mu - in spherical radii, gamma - in deg\n        # TODO: Support quantity objects here and in similar contexts\n        super().__init__(mu, gamma, **kwargs)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalPerspective(self.mu.value, self.gamma.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, gamma):\n        return _projections.azpx2s(x, y, mu, _to_orig_unit(gamma))"},{"col":4,"comment":"null","endLoc":218,"header":"@mu.validator\n    def mu(self, value)","id":10356,"name":"mu","nodeType":"Function","startLoc":214,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":485,"id":10357,"name":"beta","nodeType":"Attribute","startLoc":485,"text":"beta"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":868,"id":10358,"name":"slope_y","nodeType":"Attribute","startLoc":868,"text":"slope_y"},{"attributeType":"null","col":4,"comment":"null","endLoc":344,"id":10359,"name":"inputs","nodeType":"Attribute","startLoc":344,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":345,"id":10360,"name":"outputs","nodeType":"Attribute","startLoc":345,"text":"outputs"},{"col":4,"comment":"null","endLoc":212,"header":"def __init__(self, mu=mu.default, gamma=gamma.default, **kwargs)","id":10361,"name":"__init__","nodeType":"Function","startLoc":209,"text":"def __init__(self, mu=mu.default, gamma=gamma.default, **kwargs):\n        # units : mu - in spherical radii, gamma - in deg\n        # TODO: Support quantity objects here and in similar contexts\n        super().__init__(mu, gamma, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":346,"id":10362,"name":"_separable","nodeType":"Attribute","startLoc":346,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":348,"id":10363,"name":"angle","nodeType":"Attribute","startLoc":348,"text":"angle"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":869,"id":10364,"name":"intercept","nodeType":"Attribute","startLoc":869,"text":"intercept"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":10365,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"powerlaws.py#<anonymous>","id":10366,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nPower law model variants\n\"\"\"\n\n__all__ = ['PowerLaw1D', 'BrokenPowerLaw1D', 'SmoothlyBrokenPowerLaw1D',\n           'ExponentialCutoffPowerLaw1D', 'LogParabola1D']"},{"fileName":"polynomial.py","filePath":"astropy/modeling","id":10367,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains models representing polynomials and polynomial series.\n\"\"\"\n\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .core import FittableModel, Model\nfrom .functional_models import Shift\nfrom .parameters import Parameter\nfrom .utils import poly_map_domain, comb\nfrom ..utils import indent, check_broadcast\nfrom ..units import Quantity\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    def __getattr__(self, attr):\n        if self._param_names and attr in self._param_names:\n            return Parameter(attr, default=0.0, model=self)\n\n        raise AttributeError(attr)\n\n    def __setattr__(self, attr, value):\n        # TODO: Support a means of specifying default values for coefficients\n        # Check for self._ndim first--if it hasn't been defined then the\n        # instance hasn't been initialized yet and self.param_names probably\n        # won't work.\n        # This has to vaguely duplicate the functionality of\n        # Parameter.__set__.\n        # TODO: I wonder if there might be a way around that though...\n        if attr[0] != '_' and self._param_names and attr in self._param_names:\n            param = Parameter(attr, default=0.0, model=self)\n            # This is a little hackish, but we can actually reuse the\n            # Parameter.__set__ method here\n            param.__set__(self, value)\n        else:\n            super().__setattr__(attr, value)\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\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)\n\n    def __repr__(self):\n        return self._format_repr([self.degree])\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree)])\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('c{0}'.format(n))\n        else:\n            for i in range(self.degree + 1):\n                names.append('c{0}_{1}'.format(i, 0))\n            for i in range(1, self.degree + 1):\n                names.append('c{0}_{1}'.format(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('c{0}_{1}'.format(i, j))\n        return tuple(names)\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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('z',)\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        # TODO: Perhaps some of these other parameters should be properties?\n        # TODO: An awful lot of the functionality in this method is still\n        # shared by PolynomialModel; perhaps some of it can be generalized in\n        # PolynomialBase\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window\n        self._param_names = self._generate_coeff_names()\n\n        super().__init__(\n            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([self.x_degree, self.y_degree])\n\n    def __str__(self):\n        return self._format_str(\n            [('X-Degree', self.x_degree),\n             ('Y-Degree', self.y_degree)])\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        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 = 'c{0}_{1}'.format(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('c{0}_{1}'.format(i, j))\n        return tuple(names)\n\n    def _fcache(self, x, y):\n        # TODO: Write a docstring explaining the actual purpose of this method\n        \"\"\"To be implemented by subclasses\"\"\"\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, format_info = 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), format_info\n\n\nclass Chebyshev1D(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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 = ('x',)\n    outputs = ('y',)\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            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 : throw away parameter\n            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, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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 = ('x')\n    outputs = ('y')\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            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 : throw away parameter\n            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, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 : throw away parameter\n            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(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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    inputs = ('x',)\n    outputs = ('y',)\n    _separable = False\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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 : throw away parameter\n            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(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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    inputs = ('x',)\n    outputs = ('y',)\n    _separable = True\n\n    def __init__(self, degree, domain=[-1, 1], window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), format_info\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 : throw away parameter\n            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 {'x': 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, 'c{0}'.format(i))\n            mapping.append((par.name, outputs_unit['y'] / inputs_unit['x'] ** i))\n        return OrderedDict(mapping)\n\n\nclass Polynomial2D(PolynomialModel):\n    \"\"\"\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    Parameters\n    ----------\n    degree : int\n        highest power of the polynomial,\n        the number of terms is degree+1\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('z',)\n    _separable = False\n\n    def __init__(self, degree, x_domain=[-1, 1], y_domain=[-1, 1],\n                 x_window=[-1, 1], y_window=[-1, 1], 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        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window\n\n    def prepare_inputs(self, x, y, **kwargs):\n        inputs, format_info = 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        return (x, y), format_info\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 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 : throw away parameter\n            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 = 'c{0}_{1}'.format(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 of 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        else:\n            return {'x': self.c0_0.unit / self.c1_0.unit,\n                    'y': 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, 'c{0}_{1}'.format(i, j))\n                mapping.append((par.name, outputs_unit['z'] / inputs_unit['x'] ** i / inputs_unit['y'] ** j))\n        return OrderedDict(mapping)\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\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 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 : throw away parameter\n            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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 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 : throw away parameter\n            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    inputs = ('u', 'v')\n    outputs = ('w',)\n    _separable = False\n\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        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('{0}_{1}_{2}'.format(coeff_prefix, i, 0))\n        for i in range(2, self.order + 1):\n            names.append('{0}_{1}_{2}'.format(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('{0}_{1}_{2}'.format(coeff_prefix, i, j))\n        return 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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(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 ndarray of length(2)\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 <http://adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    \"\"\"\n\n    inputs = ('u', 'v')\n    outputs = ('x', 'y')\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\n    def __repr__(self):\n        return '<{0}({1!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 = ['Model: {0}'.format(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    inputs = ('x', 'y')\n    outputs = ('u', 'v')\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 '<{0}({1!r})>'.format(self.__class__.__name__,\n            [self.sip1d_ap, self.sip1d_bp])\n\n    def __str__(self):\n        parts = ['Model: {0}'.format(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"},{"attributeType":"null","col":4,"comment":"null","endLoc":870,"id":10368,"name":"linear","nodeType":"Attribute","startLoc":870,"text":"linear"},{"className":"Lorentz1D","col":0,"comment":"\n    One dimensional Lorentzian model.\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    See Also\n    --------\n    Gaussian1D, Box1D, MexicanHat1D\n\n    Notes\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    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":984,"id":10369,"nodeType":"Class","startLoc":888,"text":"class Lorentz1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Lorentzian model.\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    See Also\n    --------\n    Gaussian1D, Box1D, MexicanHat1D\n\n    Notes\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    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)\n    x_0 = Parameter(default=0)\n    fwhm = Parameter(default=1)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional Lorentzian model function","endLoc":944,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, fwhm)","id":10370,"name":"evaluate","nodeType":"Function","startLoc":939,"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))"},{"col":4,"comment":"One dimensional Lorentzian model derivative with respect to parameters","endLoc":954,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, fwhm)","id":10371,"name":"fit_deriv","nodeType":"Function","startLoc":946,"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":972,"header":"def bounding_box(self, factor=25)","id":10372,"name":"bounding_box","nodeType":"Function","startLoc":956,"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":979,"header":"@property\n    def input_units(self)","id":10373,"name":"input_units","nodeType":"Function","startLoc":974,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":984,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10374,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":981,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":935,"id":10375,"name":"amplitude","nodeType":"Attribute","startLoc":935,"text":"amplitude"},{"col":4,"comment":"\n        Custom repr for Model subclasses.\n        ","endLoc":133,"header":"def __repr__(cls)","id":10376,"name":"__repr__","nodeType":"Function","startLoc":128,"text":"def __repr__(cls):\n        \"\"\"\n        Custom repr for Model subclasses.\n        \"\"\"\n\n        return cls._format_cls_repr()"},{"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":78,"id":10377,"nodeType":"Class","startLoc":26,"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\n\n    def __getattr__(self, attr):\n        if self._param_names and attr in self._param_names:\n            return Parameter(attr, default=0.0, model=self)\n\n        raise AttributeError(attr)\n\n    def __setattr__(self, attr, value):\n        # TODO: Support a means of specifying default values for coefficients\n        # Check for self._ndim first--if it hasn't been defined then the\n        # instance hasn't been initialized yet and self.param_names probably\n        # won't work.\n        # This has to vaguely duplicate the functionality of\n        # Parameter.__set__.\n        # TODO: I wonder if there might be a way around that though...\n        if attr[0] != '_' and self._param_names and attr in self._param_names:\n            param = Parameter(attr, default=0.0, model=self)\n            # This is a little hackish, but we can actually reuse the\n            # Parameter.__set__ method here\n            param.__set__(self, value)\n        else:\n            super().__setattr__(attr, value)"},{"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":56,"header":"@property\n    def param_names(self)","id":10378,"name":"param_names","nodeType":"Function","startLoc":42,"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"},{"col":4,"comment":"null","endLoc":62,"header":"def __getattr__(self, attr)","id":10379,"name":"__getattr__","nodeType":"Function","startLoc":58,"text":"def __getattr__(self, attr):\n        if self._param_names and attr in self._param_names:\n            return Parameter(attr, default=0.0, model=self)\n\n        raise AttributeError(attr)"},{"attributeType":"null","col":4,"comment":"null","endLoc":350,"id":10380,"name":"input_units_strict","nodeType":"Attribute","startLoc":350,"text":"input_units_strict"},{"attributeType":"null","col":4,"comment":"null","endLoc":352,"id":10381,"name":"input_units_allow_dimensionless","nodeType":"Attribute","startLoc":352,"text":"input_units_allow_dimensionless"},{"attributeType":"null","col":0,"comment":"null","endLoc":33,"id":10382,"name":"__all__","nodeType":"Attribute","startLoc":33,"text":"__all__"},{"col":0,"comment":"","endLoc":20,"header":"rotations.py#<anonymous>","id":10383,"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']"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":936,"id":10384,"name":"x_0","nodeType":"Attribute","startLoc":936,"text":"x_0"},{"fileName":"statistic.py","filePath":"astropy/modeling","id":10385,"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\nimport numpy as np\n\n__all__ = ['leastsquare']\n\n\ndef leastsquare(measured_vals, updated_model, weights, x, y=None):\n    \"\"\"\n    Least square statistic with optional weights.\n\n    Parameters\n    ----------\n    measured_vals : `~numpy.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 : `~numpy.ndarray`\n        Array of weights to apply to each residual.\n    x : `~numpy.ndarray`\n        Independent variable \"x\" to evaluate the model on.\n    y : `~numpy.ndarray`, optional\n        Independent variable \"y\" to evaluate the model on, for 2D models.\n\n    Returns\n    -------\n    res : float\n        The sum of least squares.\n    \"\"\"\n\n    if y is None:\n        model_vals = updated_model(x)\n    else:\n        model_vals = updated_model(x, y)\n    if weights is None:\n        return np.sum((model_vals - measured_vals) ** 2)\n    else:\n        return np.sum((weights * (model_vals - measured_vals)) ** 2)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":10386,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"statistic.py#<anonymous>","id":10387,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nStatistic functions used in `~astropy.modeling.fitting`.\n\"\"\"\n\n__all__ = ['leastsquare']"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":937,"id":10388,"name":"fwhm","nodeType":"Attribute","startLoc":937,"text":"fwhm"},{"fileName":"tabular.py","filePath":"astropy/modeling","id":10389,"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\nimport abc\n\nimport numpy as np\n\nfrom .core import Model\nfrom .. import units as u\nfrom ..utils import minversion\n\ntry:\n    import scipy\n    from scipy.interpolate import interpn\n    has_scipy = True\nexcept ImportError:\n    has_scipy = False\n\nhas_scipy = has_scipy and minversion(scipy, \"0.14\")\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, with shapes (m1, ), ..., (mn, ), optional\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, shape (m1, ..., mn, ...)\n        The data on a regular grid in n dimensions.\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    outputs = ('y',)\n\n    @property\n    @abc.abstractmethod\n    def lookup_table(self):\n        pass\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\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                             \"{0} 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                    \"{0} directions, got {1}.\".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 {0} 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        fmt = \"<{0}(points={1}, lookup_table={2})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)\n        return fmt\n\n    def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.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 = ['{0}: {1}'.format(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        else:\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        else:\n            return {'y': 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        (1, 3)\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ((2, 4), (1, 3))\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 tuple(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 scalars or ndarrays\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        if isinstance(inputs, u.Quantity):\n            inputs = inputs.value\n\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(\"This model requires scipy >= v0.14\")\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        return result\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 'abc.Tabular2D'>\n    Name: Tabular2D\n    Inputs: (u'x0', u'x1')\n    Outputs: (u'y',)\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    inputs = tuple('x{0}'.format(idx) for idx in range(table.ndim))\n    members = {'lookup_table': table, 'inputs': inputs}\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 = 'Tabular{0}'.format(model_id)\n\n    return type(str(name), (_Tabular,), members)\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, with shapes (m1, m2), optional\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, shape (m1, m2)\n        The data on a regular grid in 2 dimensions.\n\n\"\"\" + _tab_docs\n"},{"className":"_Tabular","col":0,"comment":"\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, ), optional\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, shape (m1, ..., mn, ...)\n        The data on a regular grid in n dimensions.\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":232,"id":10390,"nodeType":"Class","startLoc":42,"text":"class _Tabular(Model):\n    \"\"\"\n    Returns an interpolated lookup table value.\n\n    Parameters\n    ----------\n    points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, ), optional\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, shape (m1, ..., mn, ...)\n        The data on a regular grid in n dimensions.\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    outputs = ('y',)\n\n    @property\n    @abc.abstractmethod\n    def lookup_table(self):\n        pass\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\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                             \"{0} 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                    \"{0} directions, got {1}.\".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 {0} 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        fmt = \"<{0}(points={1}, lookup_table={2})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)\n        return fmt\n\n    def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.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 = ['{0}: {1}'.format(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        else:\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        else:\n            return {'y': 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        (1, 3)\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ((2, 4), (1, 3))\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 tuple(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 scalars or ndarrays\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        if isinstance(inputs, u.Quantity):\n            inputs = inputs.value\n\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(\"This model requires scipy >= v0.14\")\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        return result"},{"className":"Voigt1D","col":0,"comment":"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float\n        Position of the peak\n    amplitude_L : float\n        The Lorentzian amplitude\n    fwhm_L : float\n        The Lorentzian full width at half maximum\n    fwhm_G : float\n        The Gaussian full width at half maximum\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Algorithm for the computation taken from\n    McLean, A. B., Mitchell, C. E. J. & Swanston, D. M. Implementation of an\n    efficient analytical approximation to the Voigt function for photoemission\n    lineshape analysis. Journal of Electron Spectroscopy and Related Phenomena\n    69, 125-132 (1994)\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":1089,"id":10391,"nodeType":"Class","startLoc":987,"text":"class Voigt1D(Fittable1DModel):\n    \"\"\"\n    One dimensional model for the Voigt profile.\n\n    Parameters\n    ----------\n    x_0 : float\n        Position of the peak\n    amplitude_L : float\n        The Lorentzian amplitude\n    fwhm_L : float\n        The Lorentzian full width at half maximum\n    fwhm_G : float\n        The Gaussian full width at half maximum\n\n    See Also\n    --------\n    Gaussian1D, Lorentz1D\n\n    Notes\n    -----\n    Algorithm for the computation taken from\n    McLean, A. B., Mitchell, C. E. J. & Swanston, D. M. Implementation of an\n    efficient analytical approximation to the Voigt function for photoemission\n    lineshape analysis. Journal of Electron Spectroscopy and Related Phenomena\n    69, 125-132 (1994)\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    amplitude_L = Parameter(default=1)\n    fwhm_L = Parameter(default=2/np.pi)\n    fwhm_G = Parameter(default=np.log(2))\n\n    _abcd = np.array([\n        [-1.2150, -1.3509, -1.2150, -1.3509],  # A\n        [1.2359, 0.3786, -1.2359, -0.3786],    # B\n        [-0.3085, 0.5906, -0.3085, 0.5906],    # C\n        [0.0210, -1.1858, -0.0210, 1.1858]])   # D\n\n    @classmethod\n    def evaluate(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[..., np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[..., np.newaxis]\n\n        V = np.sum((C * (Y - A) + D * (X - B))/(((Y - A) ** 2 + (X - B) ** 2)), axis=-1)\n\n        return (fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G) * V\n\n    @classmethod\n    def fit_deriv(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[:, np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[:, np.newaxis]\n        constant = fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G\n\n        alpha = C * (Y - A) + D * (X - B)\n        beta = (Y - A) ** 2 + (X - B) ** 2\n        V = np.sum((alpha / beta), axis=-1)\n        dVdx = np.sum((D/beta - 2 * (X - B) * alpha / np.square(beta)), axis=-1)\n        dVdy = np.sum((C/beta - 2 * (Y - A) * alpha / np.square(beta)), axis=-1)\n\n        dyda = [-constant * dVdx * 2 * sqrt_ln2 / fwhm_G,\n                constant * V / amplitude_L,\n                constant * (V / fwhm_L + dVdy * sqrt_ln2 / fwhm_G),\n                -constant * (V + (sqrt_ln2 / fwhm_G) * (2 * (x - x_0) * dVdx + fwhm_L * dVdy)) / fwhm_G]\n        return dyda\n\n    @property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm_L', inputs_unit['x']),\n                            ('fwhm_G', inputs_unit['x']),\n                            ('amplitude_L', outputs_unit['y'])])"},{"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":477,"header":"def _format_cls_repr(cls, keywords=[])","id":10392,"name":"_format_cls_repr","nodeType":"Function","startLoc":428,"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 '{0} ({1})'.format(cls.name, ' -> '.join(bases))\n            else:\n                return cls.name\n\n        try:\n            default_keywords = [\n                ('Name', format_inheritance(cls)),\n                ('Inputs', cls.inputs),\n                ('Outputs', cls.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('{0}: {1}'.format(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]"},{"col":4,"comment":"null","endLoc":1053,"header":"@classmethod\n    def evaluate(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G)","id":10393,"name":"evaluate","nodeType":"Function","startLoc":1041,"text":"@classmethod\n    def evaluate(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[..., np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[..., np.newaxis]\n\n        V = np.sum((C * (Y - A) + D * (X - B))/(((Y - A) ** 2 + (X - B) ** 2)), axis=-1)\n\n        return (fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G) * V"},{"col":4,"comment":"null","endLoc":1076,"header":"@classmethod\n    def fit_deriv(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G)","id":10394,"name":"fit_deriv","nodeType":"Function","startLoc":1055,"text":"@classmethod\n    def fit_deriv(cls, x, x_0, amplitude_L, fwhm_L, fwhm_G):\n\n        A, B, C, D = cls._abcd\n        sqrt_ln2 = np.sqrt(np.log(2))\n        X = (x - x_0) * 2 * sqrt_ln2 / fwhm_G\n        X = np.atleast_1d(X)[:, np.newaxis]\n        Y = fwhm_L * sqrt_ln2 / fwhm_G\n        Y = np.atleast_1d(Y)[:, np.newaxis]\n        constant = fwhm_L * amplitude_L * np.sqrt(np.pi) * sqrt_ln2 / fwhm_G\n\n        alpha = C * (Y - A) + D * (X - B)\n        beta = (Y - A) ** 2 + (X - B) ** 2\n        V = np.sum((alpha / beta), axis=-1)\n        dVdx = np.sum((D/beta - 2 * (X - B) * alpha / np.square(beta)), axis=-1)\n        dVdy = np.sum((C/beta - 2 * (Y - A) * alpha / np.square(beta)), axis=-1)\n\n        dyda = [-constant * dVdx * 2 * sqrt_ln2 / fwhm_G,\n                constant * V / amplitude_L,\n                constant * (V / fwhm_L + dVdy * sqrt_ln2 / fwhm_G),\n                -constant * (V + (sqrt_ln2 / fwhm_G) * (2 * (x - x_0) * dVdx + fwhm_L * dVdy)) / fwhm_G]\n        return dyda"},{"col":4,"comment":"null","endLoc":92,"header":"@property\n    @abc.abstractmethod\n    def lookup_table(self)","id":10395,"name":"lookup_table","nodeType":"Function","startLoc":89,"text":"@property\n    @abc.abstractmethod\n    def lookup_table(self):\n        pass"},{"col":4,"comment":"null","endLoc":141,"header":"def __init__(self, points=None, lookup_table=None, method='linear',\n                 bounds_error=True, fill_value=np.nan, **kwargs)","id":10396,"name":"__init__","nodeType":"Function","startLoc":98,"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\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                             \"{0} 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                    \"{0} directions, got {1}.\".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 {0} 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":"\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":143,"header":"def _repr_pretty_(cls, p, cycle)","id":10398,"name":"_repr_pretty_","nodeType":"Function","startLoc":135,"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))"},{"col":4,"comment":"null","endLoc":163,"header":"def __reduce__(cls)","id":10399,"name":"__reduce__","nodeType":"Function","startLoc":145,"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        else:\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))"},{"col":4,"comment":"null","endLoc":1083,"header":"@property\n    def input_units(self)","id":10400,"name":"input_units","nodeType":"Function","startLoc":1078,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":1089,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10401,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1085,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('fwhm_L', inputs_unit['x']),\n                            ('fwhm_G', inputs_unit['x']),\n                            ('amplitude_L', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1030,"id":10402,"name":"x_0","nodeType":"Attribute","startLoc":1030,"text":"x_0"},{"col":4,"comment":"null","endLoc":222,"header":"@property\n    def inverse(self)","id":10403,"name":"inverse","nodeType":"Function","startLoc":220,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ZenithalPerspective(self.mu.value, self.gamma.value)"},{"col":4,"comment":"null","endLoc":226,"header":"@classmethod\n    def evaluate(cls, x, y, mu, gamma)","id":10404,"name":"evaluate","nodeType":"Function","startLoc":224,"text":"@classmethod\n    def evaluate(cls, x, y, mu, gamma):\n        return _projections.azpx2s(x, y, mu, _to_orig_unit(gamma))"},{"col":4,"comment":"null","endLoc":78,"header":"def __setattr__(self, attr, value)","id":10405,"name":"__setattr__","nodeType":"Function","startLoc":64,"text":"def __setattr__(self, attr, value):\n        # TODO: Support a means of specifying default values for coefficients\n        # Check for self._ndim first--if it hasn't been defined then the\n        # instance hasn't been initialized yet and self.param_names probably\n        # won't work.\n        # This has to vaguely duplicate the functionality of\n        # Parameter.__set__.\n        # TODO: I wonder if there might be a way around that though...\n        if attr[0] != '_' and self._param_names and attr in self._param_names:\n            param = Parameter(attr, default=0.0, model=self)\n            # This is a little hackish, but we can actually reuse the\n            # Parameter.__set__ method here\n            param.__set__(self, value)\n        else:\n            super().__setattr__(attr, value)"},{"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":174,"header":"@property\n    def name(cls)","id":10406,"name":"name","nodeType":"Function","startLoc":165,"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__"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":206,"id":10407,"name":"mu","nodeType":"Attribute","startLoc":206,"text":"mu"},{"col":4,"comment":"null","endLoc":178,"header":"@property\n    def n_inputs(cls)","id":10408,"name":"n_inputs","nodeType":"Function","startLoc":176,"text":"@property\n    def n_inputs(cls):\n        return len(cls.inputs)"},{"col":4,"comment":"null","endLoc":182,"header":"@property\n    def n_outputs(cls)","id":10409,"name":"n_outputs","nodeType":"Function","startLoc":180,"text":"@property\n    def n_outputs(cls):\n        return len(cls.outputs)"},{"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":191,"header":"@property\n    def _is_concrete(cls)","id":10410,"name":"_is_concrete","nodeType":"Function","startLoc":184,"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.\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 '__main__.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            Inputs: ('x', 'y')\n            Outputs: ('x', 'y')\n            Fittable parameters: ('angle',)\n            >>> issubclass(SkyRotation, Rotation2D)\n            True\n            >>> r = SkyRotation(90)\n            >>> isinstance(r, Rotation2D)\n            True\n        ","endLoc":231,"header":"def rename(cls, name)","id":10411,"name":"rename","nodeType":"Function","startLoc":193,"text":"def rename(cls, name):\n        \"\"\"\n        Creates a copy of this model class with a new name.\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 '__main__.SkyRotation'>\n            Name: SkyRotation (Rotation2D)\n            Inputs: ('x', 'y')\n            Outputs: ('x', 'y')\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        new_cls = type(name, (cls,), {})\n        new_cls.__module__ = modname\n\n        if hasattr(cls, '__qualname__'):\n            if new_cls.__module__ == '__main__':\n                # __main__ is not added to a class's qualified name\n                new_cls.__qualname__ = name\n            else:\n                new_cls.__qualname__ = '{0}.{1}'.format(modname, name)\n\n        return new_cls"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1031,"id":10412,"name":"amplitude_L","nodeType":"Attribute","startLoc":1031,"text":"amplitude_L"},{"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":86,"id":10413,"name":"_is_dynamic","nodeType":"Attribute","startLoc":86,"text":"_is_dynamic"},{"attributeType":"null","col":4,"comment":"null","endLoc":101,"id":10414,"name":"_parameters_","nodeType":"Attribute","startLoc":101,"text":"_parameters_"},{"attributeType":"function","col":4,"comment":"null","endLoc":418,"id":10415,"name":"__add__","nodeType":"Attribute","startLoc":418,"text":"__add__"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":10416,"name":"_param_names","nodeType":"Attribute","startLoc":37,"text":"_param_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":10417,"name":"linear","nodeType":"Attribute","startLoc":39,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":10418,"name":"col_fit_deriv","nodeType":"Attribute","startLoc":40,"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":151,"id":10419,"nodeType":"Class","startLoc":81,"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\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis, name=name,\n            meta=meta, **params)\n\n    def __repr__(self):\n        return self._format_repr([self.degree])\n\n    def __str__(self):\n        return self._format_str([('Degree', self.degree)])\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('c{0}'.format(n))\n        else:\n            for i in range(self.degree + 1):\n                names.append('c{0}_{1}'.format(i, 0))\n            for i in range(1, self.degree + 1):\n                names.append('c{0}_{1}'.format(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('c{0}_{1}'.format(i, j))\n        return tuple(names)"},{"col":4,"comment":"null","endLoc":101,"header":"def __repr__(self)","id":10420,"name":"__repr__","nodeType":"Function","startLoc":100,"text":"def __repr__(self):\n        return self._format_repr([self.degree])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1032,"id":10421,"name":"fwhm_L","nodeType":"Attribute","startLoc":1032,"text":"fwhm_L"},{"col":4,"comment":"null","endLoc":104,"header":"def __str__(self)","id":10422,"name":"__str__","nodeType":"Function","startLoc":103,"text":"def __str__(self):\n        return self._format_str([('Degree', self.degree)])"},{"col":4,"comment":"Degree of polynomial.","endLoc":110,"header":"@property\n    def degree(self)","id":10423,"name":"degree","nodeType":"Function","startLoc":106,"text":"@property\n    def degree(self):\n        \"\"\"Degree of polynomial.\"\"\"\n\n        return self._degree"},{"col":4,"comment":"null","endLoc":135,"header":"def _invlex(self)","id":10424,"name":"_invlex","nodeType":"Function","startLoc":128,"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]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1033,"id":10425,"name":"fwhm_G","nodeType":"Attribute","startLoc":1033,"text":"fwhm_G"},{"col":4,"comment":"null","endLoc":146,"header":"def __repr__(self)","id":10426,"name":"__repr__","nodeType":"Function","startLoc":143,"text":"def __repr__(self):\n        fmt = \"<{0}(points={1}, lookup_table={2})>\".format(\n            self.__class__.__name__, self.points, self.lookup_table)\n        return fmt"},{"col":4,"comment":"null","endLoc":166,"header":"def __str__(self)","id":10427,"name":"__str__","nodeType":"Function","startLoc":148,"text":"def __str__(self):\n        default_keywords = [\n            ('Model', self.__class__.__name__),\n            ('Name', self.name),\n            ('Inputs', self.inputs),\n            ('Outputs', self.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 = ['{0}: {1}'.format(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":174,"header":"@property\n    def input_units(self)","id":10428,"name":"input_units","nodeType":"Function","startLoc":168,"text":"@property\n    def input_units(self):\n        pts = self.points[0]\n        if not isinstance(pts, u.Quantity):\n            return None\n        else:\n            return dict([(x, pts.unit) for x in self.inputs])"},{"id":10429,"name":"astropy/modeling/src","nodeType":"Package"},{"id":10430,"name":"projections.c.templ","nodeType":"TextFile","path":"astropy/modeling/src","text":"/* -*- mode: c -*- */\n\n/* Licensed under a 3-clause BSD style license - see LICENSE.rst */\n\n/* \"projections.c\" is auto-generated by erfa_generator.py from the\n   template \"projections.c.templ\". Do *not* edit \"projections.c\"\n   directly. */\n\n#include <Python.h> /* Python */\n\n#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n#include <numpy/arrayobject.h> /* Numpy */\n#include <numpy/npy_math.h> /* Numpy */\n\n#include \"prj.h\" /* from wcslib */\n#include \"wcsmath.h\"\n\n\nstatic void set_error(int status) {\n  switch (status) {\n  case 1:\n    PyErr_SetString(PyExc_MemoryError, \"NULL pointer passed\");\n    break;\n  case 2:\n    PyErr_SetString(PyExc_ValueError, \"Invalid projection parameters\");\n    break;\n  default:\n    PyErr_SetString(PyExc_RuntimeError, \"Unknown error\");\n    break;\n  }\n}\n\n\nstatic PyObject *do_work(struct prjprm *prj, PyObject *in[2],\n                         int (*prjset)(struct prjprm *),\n                         int (*prjtrn)(struct prjprm *, int, int, int, int, const double[], const double[], double[], double[], int[]))\n{\n  PyArrayObject* in_array[2] = { NULL, NULL };\n  PyArrayObject* out_array[2] = { NULL, NULL };\n  PyArrayObject* stat_array = NULL;\n  Py_ssize_t n;\n  Py_ssize_t i;\n  PyObject* result = NULL;\n  int status = -1;\n\n  prj->phi0 = UNDEFINED;\n  prj->theta0 = UNDEFINED;\n\n  if ((status = prjset(prj))) {\n    goto exit;\n  }\n\n  /* TODO: This assumes the same shape for the input arrays.  Instead,\n     we should broadcast */\n\n  for (i = 0; i < 2; ++i) {\n    in_array[i] = (PyArrayObject *) PyArray_ContiguousFromObject(\n        in[i], NPY_DOUBLE, 1, NPY_MAXDIMS);\n    if (in_array[i] == NULL) {\n      goto exit;\n    }\n  }\n\n  if (PyArray_NDIM(in_array[0]) != PyArray_NDIM(in_array[1])) {\n    PyErr_SetString(PyExc_ValueError, \"input array dimensions do not match\");\n    goto exit;\n  }\n\n  n = 1;\n  for (i = 0; i < PyArray_NDIM(in_array[0]); ++i) {\n    if (PyArray_DIM(in_array[0], i) != PyArray_DIM(in_array[1], i)) {\n      PyErr_SetString(PyExc_ValueError, \"input array dimensions do not match\");\n      goto exit;\n    }\n    n *= PyArray_DIM(in_array[0], i);\n  }\n\n  for (i = 0; i < 2; ++i) {\n    out_array[i] = (PyArrayObject *) PyArray_SimpleNew(\n        PyArray_NDIM(in_array[0]), PyArray_DIMS(in_array[0]), NPY_DOUBLE);\n    if (out_array[i] == NULL) {\n      goto exit;\n    }\n  }\n\n  stat_array = (PyArrayObject *) PyArray_SimpleNew(\n      PyArray_NDIM(in_array[0]), PyArray_DIMS(in_array[0]), NPY_INT);\n  if (stat_array == NULL) {\n    goto exit;\n  }\n\n  Py_BEGIN_ALLOW_THREADS\n\n  status = prjtrn(prj, n, 0, 1, 1,\n                  (double *)PyArray_DATA(in_array[0]),\n                  (double *)PyArray_DATA(in_array[1]),\n                  (double *)PyArray_DATA(out_array[0]),\n                  (double *)PyArray_DATA(out_array[1]),\n                  (int *)PyArray_DATA(stat_array));\n\n  Py_END_ALLOW_THREADS\n\n  if (status) {\n    if (status == 3) {\n      for (i = 0; i < n; ++i) {\n        if (((int *)PyArray_DATA(stat_array))[i]) {\n          ((double *)PyArray_DATA(out_array[0]))[i] = NPY_NAN;\n          ((double *)PyArray_DATA(out_array[1]))[i] = NPY_NAN;\n        }\n      }\n      status = 0;\n    } else {\n      goto exit;\n    }\n  }\n\n  result = Py_BuildValue(\"(OO)\", out_array[0], out_array[1]);\n\n exit:\n  if (status > 0) {\n    set_error(status);\n  }\n\n  for (i = 0; i < 2; ++i) {\n    Py_XDECREF(in_array[i]);\n    Py_XDECREF(out_array[i]);\n  }\n  Py_XDECREF(stat_array);\n\n  return result;\n}\n\n\n{% for name, nargs in projections.items() %}\n{% for dir in ['x2s', 's2x'] %}\nstatic PyObject*\nPy_{{ name }}{{ dir }}(PyObject* __, PyObject* args, PyObject* kwds)\n{\n  PyObject* in[2] = { NULL, NULL };\n\n  struct prjprm prj;\n\n  memset(&prj, 0, sizeof(struct prjprm));\n\n  if (!PyArg_ParseTuple(args,\n                        \"OO\"\n                        {% for i in range(nargs) %}\"d\" {% endfor %}\n                        \":{{ name }}{{ dir }}\",\n                        &in[0], &in[1]\n                        {% for i in range(nargs) %}\n                        {% if loop.first %},{% endif %}\n                        &prj.pv[{{i}}{% if name != 'zpn' %} + 1{% endif %}]\n                        {% if not loop.last %},{% endif %}\n                        {% endfor %}\n                        )) {\n    return NULL;\n  }\n\n  return do_work(&prj, in, {{ name }}set, {{ name }}{{ dir }});\n}\n\n{% endfor %}\n{% endfor %}\n\n\n/***************************************************************************\n * Module-level\n ***************************************************************************/\n\nstatic PyMethodDef module_methods[] = {\n  {% for name in projections.keys() %}\n  {% for dir in ['x2s', 's2x'] %}\n  {\"{{ name }}{{ dir }}\", (PyCFunction)Py_{{ name }}{{ dir }}, METH_VARARGS, NULL},\n  {% endfor %}\n  {% endfor %}\n  {NULL}  /* Sentinel */\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    \"_projections\",\n    NULL,\n    sizeof(struct module_state),\n    module_methods,\n    NULL,\n    NULL,\n    NULL,\n    NULL\n};\n\nPyMODINIT_FUNC\nPyInit__projections(void)\n\n{\n  PyObject* m;\n\n  m = PyModule_Create(&moduledef);\n\n  if (m == NULL)\n    return NULL;\n\n  import_array();\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"},{"col":4,"comment":"null","endLoc":181,"header":"@property\n    def return_units(self)","id":10431,"name":"return_units","nodeType":"Function","startLoc":176,"text":"@property\n    def return_units(self):\n        if not isinstance(self.lookup_table, u.Quantity):\n            return None\n        else:\n            return {'y': 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        (1, 3)\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ((2, 4), (1, 3))\n\n        ","endLoc":204,"header":"@property\n    def bounding_box(self)","id":10432,"name":"bounding_box","nodeType":"Function","startLoc":183,"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        (1, 3)\n        >>> t2 = Tabular2D(points=[[1, 2, 3], [2, 3, 4]],\n        ...                lookup_table=[[10, 20, 30], [20, 30, 40]])\n        >>> t2.bounding_box\n        ((2, 4), (1, 3))\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 tuple(bbox)"},{"id":10433,"name":".gitignore","nodeType":"TextFile","path":"astropy/modeling/src","text":"wcsconfig.h\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":1035,"id":10434,"name":"_abcd","nodeType":"Attribute","startLoc":1035,"text":"_abcd"},{"col":4,"comment":"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalars or ndarrays\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        ","endLoc":232,"header":"def evaluate(self, *inputs)","id":10435,"name":"evaluate","nodeType":"Function","startLoc":206,"text":"def evaluate(self, *inputs):\n        \"\"\"\n        Return the interpolated values at the input coordinates.\n\n        Parameters\n        ----------\n        inputs : list of scalars or ndarrays\n            Input coordinates. The number of inputs must be equal\n            to the dimensions of the lookup table.\n        \"\"\"\n        if isinstance(inputs, u.Quantity):\n            inputs = inputs.value\n\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(\"This model requires scipy >= v0.14\")\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        return result"},{"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":1166,"id":10436,"nodeType":"Class","startLoc":1092,"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)\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        else:\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 OrderedDict([('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional Constant model function","endLoc":1152,"header":"@staticmethod\n    def evaluate(x, amplitude)","id":10437,"name":"evaluate","nodeType":"Function","startLoc":1136,"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        else:\n            return x"},{"id":10438,"name":"astropy/modeling/tests","nodeType":"Package"},{"fileName":"irafutil.py","filePath":"astropy/modeling/tests","id":10439,"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 ...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(\"Could not read array field {}\".format(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":"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":10440,"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(\"Could not read array field {}\".format(fieldlist[0].split()[0]))\n        return farr.astype(np.float64)"},{"col":4,"comment":"null","endLoc":74,"header":"def __init__(self, recstr)","id":10441,"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()"},{"attributeType":"null","col":8,"comment":"null","endLoc":93,"id":10442,"name":"_order","nodeType":"Attribute","startLoc":93,"text":"self._order"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":10443,"name":"linear","nodeType":"Attribute","startLoc":83,"text":"linear"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":207,"id":10444,"name":"gamma","nodeType":"Attribute","startLoc":207,"text":"gamma"},{"col":4,"comment":"One dimensional Constant model derivative with respect to parameters","endLoc":1159,"header":"@staticmethod\n    def fit_deriv(x, amplitude)","id":10445,"name":"fit_deriv","nodeType":"Function","startLoc":1154,"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":1163,"header":"@property\n    def input_units(self)","id":10446,"name":"input_units","nodeType":"Function","startLoc":1161,"text":"@property\n    def input_units(self):\n        return None"},{"col":4,"comment":"null","endLoc":1166,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10447,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1165,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1133,"id":10448,"name":"amplitude","nodeType":"Attribute","startLoc":1133,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":84,"id":10449,"name":"fittable","nodeType":"Attribute","startLoc":84,"text":"fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":86,"id":10450,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":86,"text":"standard_broadcasting"},{"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    ","endLoc":273,"id":10451,"nodeType":"Class","startLoc":232,"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 = Parameter(default=0.0)\n    gamma = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")\n\n    @property\n    def inverse(self):\n        return Pix2Sky_AZP(self.mu.value, self.gamma.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, gamma):\n        return _projections.azps2x(\n            phi, theta, mu, _to_orig_unit(gamma))"},{"col":4,"comment":"null","endLoc":264,"header":"@mu.validator\n    def mu(self, value)","id":10452,"name":"mu","nodeType":"Function","startLoc":260,"text":"@mu.validator\n    def mu(self, value):\n        if np.any(value == -1):\n            raise InputParameterError(\n                \"Zenithal perspective projection is not defined for mu = -1\")"},{"col":4,"comment":"null","endLoc":268,"header":"@property\n    def inverse(self)","id":10453,"name":"inverse","nodeType":"Function","startLoc":266,"text":"@property\n    def inverse(self):\n        return Pix2Sky_AZP(self.mu.value, self.gamma.value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1134,"id":10454,"name":"linear","nodeType":"Attribute","startLoc":1134,"text":"linear"},{"attributeType":"null","col":4,"comment":"null","endLoc":87,"id":10455,"name":"outputs","nodeType":"Attribute","startLoc":87,"text":"outputs"},{"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":1215,"id":10456,"nodeType":"Class","startLoc":1169,"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)\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        else:\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 OrderedDict([('amplitude', outputs_unit['z'])])"},{"attributeType":"null","col":8,"comment":"null","endLoc":94,"id":10457,"name":"_param_names","nodeType":"Attribute","startLoc":94,"text":"self._param_names"},{"col":4,"comment":"Two dimensional Constant model function","endLoc":1208,"header":"@staticmethod\n    def evaluate(x, y, amplitude)","id":10458,"name":"evaluate","nodeType":"Function","startLoc":1192,"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        else:\n            return x"},{"attributeType":"null","col":4,"comment":"null","endLoc":94,"id":10459,"name":"_is_dynamic","nodeType":"Attribute","startLoc":94,"text":"_is_dynamic"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":10460,"name":"_degree","nodeType":"Attribute","startLoc":92,"text":"self._degree"},{"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    ","endLoc":315,"id":10461,"nodeType":"Class","startLoc":154,"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        {keyword: value} pairs, representing {parameter_name: value}\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('z',)\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        # TODO: Perhaps some of these other parameters should be properties?\n        # TODO: An awful lot of the functionality in this method is still\n        # shared by PolynomialModel; perhaps some of it can be generalized in\n        # PolynomialBase\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window\n        self._param_names = self._generate_coeff_names()\n\n        super().__init__(\n            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([self.x_degree, self.y_degree])\n\n    def __str__(self):\n        return self._format_str(\n            [('X-Degree', self.x_degree),\n             ('Y-Degree', self.y_degree)])\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        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 = 'c{0}_{1}'.format(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('c{0}_{1}'.format(i, j))\n        return tuple(names)\n\n    def _fcache(self, x, y):\n        # TODO: Write a docstring explaining the actual purpose of this method\n        \"\"\"To be implemented by subclasses\"\"\"\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, format_info = 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), format_info"},{"col":4,"comment":"null","endLoc":200,"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":10462,"name":"__init__","nodeType":"Function","startLoc":182,"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        # TODO: Perhaps some of these other parameters should be properties?\n        # TODO: An awful lot of the functionality in this method is still\n        # shared by PolynomialModel; perhaps some of it can be generalized in\n        # PolynomialBase\n        self.x_degree = x_degree\n        self.y_degree = y_degree\n        self._order = self.get_num_coeff()\n        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window\n        self._param_names = self._generate_coeff_names()\n\n        super().__init__(\n            n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"col":4,"comment":"null","endLoc":273,"header":"@classmethod\n    def evaluate(cls, phi, theta, mu, gamma)","id":10463,"name":"evaluate","nodeType":"Function","startLoc":270,"text":"@classmethod\n    def evaluate(cls, phi, theta, mu, gamma):\n        return _projections.azps2x(\n            phi, theta, mu, _to_orig_unit(gamma))"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":10464,"name":"_id","nodeType":"Attribute","startLoc":96,"text":"_id"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":257,"id":10465,"name":"mu","nodeType":"Attribute","startLoc":257,"text":"mu"},{"col":4,"comment":"null","endLoc":1212,"header":"@property\n    def input_units(self)","id":10466,"name":"input_units","nodeType":"Function","startLoc":1210,"text":"@property\n    def input_units(self):\n        return None"},{"col":4,"comment":"null","endLoc":1215,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10467,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1214,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('amplitude', outputs_unit['z'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1189,"id":10468,"name":"amplitude","nodeType":"Attribute","startLoc":1189,"text":"amplitude"},{"col":4,"comment":"\n        Determine how many coefficients are needed\n\n        Returns\n        -------\n        numc : int\n            number of coefficients\n        ","endLoc":220,"header":"def get_num_coeff(self)","id":10469,"name":"get_num_coeff","nodeType":"Function","startLoc":210,"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        return (self.x_degree + 1) * (self.y_degree + 1)"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":138,"id":10470,"name":"lookup_table","nodeType":"Attribute","startLoc":138,"text":"self.lookup_table"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":258,"id":10471,"name":"gamma","nodeType":"Attribute","startLoc":258,"text":"gamma"},{"attributeType":"null","col":4,"comment":"null","endLoc":1190,"id":10472,"name":"linear","nodeType":"Attribute","startLoc":1190,"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":1348,"id":10473,"nodeType":"Class","startLoc":1218,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    a = Parameter(default=1)\n    b = Parameter(default=1)\n    theta = Parameter(default=0)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('a', inputs_unit['x']),\n                            ('b', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"Two dimensional Ellipse model function.","endLoc":1311,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, a, b, theta)","id":10474,"name":"evaluate","nodeType":"Function","startLoc":1295,"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        else:\n            return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":140,"id":10475,"name":"method","nodeType":"Attribute","startLoc":140,"text":"self.method"},{"col":4,"comment":"null","endLoc":291,"header":"def _generate_coeff_names(self)","id":10476,"name":"_generate_coeff_names","nodeType":"Function","startLoc":286,"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('c{0}_{1}'.format(i, j))\n        return tuple(names)"},{"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    ","endLoc":318,"id":10477,"nodeType":"Class","startLoc":279,"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    def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\n                \"Zenithal perspective projection is not defined for mu=-1\")\n        return mu\n\n    mu = Parameter(default=0.0, setter=_validate_mu)\n    phi0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    theta0 = Parameter(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, phi0, theta0):\n        return _projections.szpx2s(\n            x, y, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))"},{"col":4,"comment":"null","endLoc":304,"header":"def _validate_mu(mu)","id":10478,"name":"_validate_mu","nodeType":"Function","startLoc":300,"text":"def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\n                \"Zenithal perspective projection is not defined for mu=-1\")\n        return mu"},{"attributeType":"null","col":8,"comment":"null","endLoc":139,"id":10479,"name":"bounds_error","nodeType":"Attribute","startLoc":139,"text":"self.bounds_error"},{"col":4,"comment":"null","endLoc":313,"header":"@property\n    def inverse(self)","id":10480,"name":"inverse","nodeType":"Function","startLoc":310,"text":"@property\n    def inverse(self):\n        return Sky2Pix_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":10481,"name":"fill_value","nodeType":"Attribute","startLoc":141,"text":"self.fill_value"},{"col":4,"comment":"null","endLoc":101,"header":"def get_fields(self)","id":10482,"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":10483,"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":10484,"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(\"Could not read array field {}\".format(fieldlist[0].split()[0]))\n        return farr.astype(np.float64)"},{"attributeType":"null","col":8,"comment":"null","endLoc":137,"id":10485,"name":"points","nodeType":"Attribute","startLoc":137,"text":"self.points"},{"col":4,"comment":"null","endLoc":107,"header":"def get_task_name(self)","id":10486,"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":10487,"name":"recstr","nodeType":"Attribute","startLoc":72,"text":"self.recstr"},{"attributeType":"None","col":8,"comment":"null","endLoc":74,"id":10488,"name":"taskname","nodeType":"Attribute","startLoc":74,"text":"self.taskname"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":10489,"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":10490,"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":"null","endLoc":156,"header":"def __init__(self, recstr)","id":10491,"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":31,"id":10492,"name":"has_scipy","nodeType":"Attribute","startLoc":31,"text":"has_scipy"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":10493,"name":"has_scipy","nodeType":"Attribute","startLoc":35,"text":"has_scipy"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":10494,"name":"__all__","nodeType":"Attribute","startLoc":37,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":10495,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":39,"text":"__doctest_requires__"},{"col":4,"comment":"null","endLoc":181,"header":"def get_ydata(self)","id":10496,"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":"null","col":0,"comment":"null","endLoc":294,"id":10497,"name":"Tabular1D","nodeType":"Attribute","startLoc":294,"text":"Tabular1D"},{"col":4,"comment":"null","endLoc":318,"header":"@classmethod\n    def evaluate(cls, x, y, mu, phi0, theta0)","id":10498,"name":"evaluate","nodeType":"Function","startLoc":315,"text":"@classmethod\n    def evaluate(cls, x, y, mu, phi0, theta0):\n        return _projections.szpx2s(\n            x, y, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))"},{"attributeType":"null","col":0,"comment":"null","endLoc":296,"id":10499,"name":"Tabular2D","nodeType":"Attribute","startLoc":296,"text":"Tabular2D"},{"attributeType":"null","col":0,"comment":"null","endLoc":298,"id":10500,"name":"_tab_docs","nodeType":"Attribute","startLoc":298,"text":"_tab_docs"},{"col":0,"comment":"","endLoc":18,"header":"tabular.py#<anonymous>","id":10501,"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    import scipy\n    from scipy.interpolate import interpn\n    has_scipy = True\nexcept ImportError:\n    has_scipy = False\n\nhas_scipy = has_scipy and minversion(scipy, \"0.14\")\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, with shapes (m1, m2), optional\n        The points defining the regular grid in n dimensions.\n    lookup_table : array-like, shape (m1, m2)\n        The data on a regular grid in 2 dimensions.\n\n\"\"\" + _tab_docs"},{"col":4,"comment":"null","endLoc":159,"header":"def get_model_name(self)","id":10502,"name":"get_model_name","nodeType":"Function","startLoc":158,"text":"def get_model_name(self):\n        return iraf_models_map[self._flatcoeff[0]]"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1327,"header":"@property\n    def bounding_box(self)","id":10503,"name":"bounding_box","nodeType":"Function","startLoc":1313,"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":"Parameter","col":4,"comment":"null","endLoc":306,"id":10504,"name":"mu","nodeType":"Attribute","startLoc":306,"text":"mu"},{"col":4,"comment":"null","endLoc":203,"header":"def __repr__(self)","id":10505,"name":"__repr__","nodeType":"Function","startLoc":202,"text":"def __repr__(self):\n        return self._format_repr([self.x_degree, self.y_degree])"},{"col":4,"comment":"null","endLoc":1335,"header":"@property\n    def input_units(self)","id":10506,"name":"input_units","nodeType":"Function","startLoc":1329,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1348,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10507,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1337,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('a', inputs_unit['x']),\n                            ('b', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"fileName":"utils.py","filePath":"astropy/modeling/tests","id":10508,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n# -*- coding: utf-8 -*-\n\n\nimport contextlib\nimport warnings\nfrom ...tests.helper import catch_warnings\n\n\n@contextlib.contextmanager\ndef ignore_non_integer_warning():\n    # We need to ignore this warning on Scipy < 0.14.\n    # When our minimum version of Scipy is bumped up, this can be\n    # removed.\n    with catch_warnings():\n        warnings.filterwarnings(\n            \"always\", \"using a non-integer number instead of an integer \"\n            \"will result in an error in the future\", DeprecationWarning)\n        yield\n"},{"col":4,"comment":"null","endLoc":162,"header":"def get_nterms(self)","id":10509,"name":"get_nterms","nodeType":"Function","startLoc":161,"text":"def get_nterms(self):\n        return self._flatcoeff[1]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1288,"id":10510,"name":"amplitude","nodeType":"Attribute","startLoc":1288,"text":"amplitude"},{"col":0,"comment":"null","endLoc":19,"header":"@contextlib.contextmanager\ndef ignore_non_integer_warning()","id":10511,"name":"ignore_non_integer_warning","nodeType":"Function","startLoc":10,"text":"@contextlib.contextmanager\ndef ignore_non_integer_warning():\n    # We need to ignore this warning on Scipy < 0.14.\n    # When our minimum version of Scipy is bumped up, this can be\n    # removed.\n    with catch_warnings():\n        warnings.filterwarnings(\n            \"always\", \"using a non-integer number instead of an integer \"\n            \"will result in an error in the future\", DeprecationWarning)\n        yield"},{"col":4,"comment":"null","endLoc":208,"header":"def __str__(self)","id":10512,"name":"__str__","nodeType":"Function","startLoc":205,"text":"def __str__(self):\n        return self._format_str(\n            [('X-Degree', self.x_degree),\n             ('Y-Degree', self.y_degree)])"},{"col":4,"comment":"null","endLoc":167,"header":"def get_range(self)","id":10513,"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]"},{"fileName":"example_models.py","filePath":"astropy/modeling/tests","id":10514,"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 ..functional_models import (\n    Gaussian1D, Sine1D, Box1D, Linear1D, Lorentz1D,\n    MexicanHat1D, Trapezoid1D, Const1D, Moffat1D,\n    Gaussian2D, Const2D, Box2D, MexicanHat2D,\n    TrapezoidDisk2D, AiryDisk2D, Moffat2D, Disk2D,\n    Ring2D, Sersic1D, Sersic2D, Voigt1D, Planar2D)\nfrom ..polynomial import Polynomial1D, Polynomial2D\nfrom ..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    },\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    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    },\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    },\n\n    MexicanHat1D: {\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    },\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    },\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, 2, 4, 8, 10],\n        'y_values': [0.520935, 0.017205, 0.003998, 0.000983, 0.000628],\n        'x_lim': [-3, 3]\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    },\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    },\n\n    MexicanHat2D: {\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    },\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    },\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    },\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"},{"col":4,"comment":"null","endLoc":231,"header":"def _invlex(self)","id":10515,"name":"_invlex","nodeType":"Function","startLoc":222,"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])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":307,"id":10516,"name":"phi0","nodeType":"Attribute","startLoc":307,"text":"phi0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1289,"id":10517,"name":"x_0","nodeType":"Attribute","startLoc":1289,"text":"x_0"},{"col":4,"comment":"null","endLoc":242,"header":"def invlex_coeff(self, coeffs)","id":10518,"name":"invlex_coeff","nodeType":"Function","startLoc":233,"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 = 'c{0}_{1}'.format(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":"null","endLoc":254,"header":"def _alpha(self)","id":10519,"name":"_alpha","nodeType":"Function","startLoc":244,"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"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1290,"id":10520,"name":"y_0","nodeType":"Attribute","startLoc":1290,"text":"y_0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":308,"id":10521,"name":"theta0","nodeType":"Attribute","startLoc":308,"text":"theta0"},{"col":4,"comment":"null","endLoc":170,"header":"def get_coeff(self)","id":10522,"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":10523,"name":"mrange","nodeType":"Attribute","startLoc":155,"text":"self.mrange"},{"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":1654,"id":10524,"nodeType":"Class","startLoc":1554,"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)\n    x_0 = Parameter(default=0)\n    width = Parameter(default=1)\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        result = np.select([inside], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        else:\n            return result\n\n    @classmethod\n    def fit_deriv(cls, x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model derivative with respect to parameters\"\"\"\n\n        d_amplitude = cls.evaluate(x, 1, x_0, width)\n        d_x_0 = np.zeros_like(x)\n        d_width = np.zeros_like(x)\n        return [d_amplitude, d_x_0, d_width]\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"null","col":8,"comment":"null","endLoc":153,"id":10525,"name":"modelname","nodeType":"Attribute","startLoc":153,"text":"self.modelname"},{"col":4,"comment":"One dimensional Box model function","endLoc":1621,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, width)","id":10526,"name":"evaluate","nodeType":"Function","startLoc":1611,"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        result = np.select([inside], [amplitude], 0)\n\n        if isinstance(amplitude, Quantity):\n            return Quantity(result, unit=amplitude.unit, copy=False)\n        else:\n            return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":10527,"name":"_flatcoeff","nodeType":"Attribute","startLoc":149,"text":"self._flatcoeff"},{"attributeType":"null","col":8,"comment":"null","endLoc":150,"id":10528,"name":"x","nodeType":"Attribute","startLoc":150,"text":"self.x"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1291,"id":10529,"name":"a","nodeType":"Attribute","startLoc":1291,"text":"a"},{"attributeType":"null","col":8,"comment":"null","endLoc":151,"id":10530,"name":"y","nodeType":"Attribute","startLoc":151,"text":"self.y"},{"attributeType":"function","col":4,"comment":"null","endLoc":419,"id":10531,"name":"__sub__","nodeType":"Attribute","startLoc":419,"text":"__sub__"},{"col":4,"comment":"null","endLoc":284,"header":"def imhorner(self, x, y, coeff)","id":10532,"name":"imhorner","nodeType":"Function","startLoc":256,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":10533,"name":"z","nodeType":"Attribute","startLoc":152,"text":"self.z"},{"attributeType":"function","col":4,"comment":"null","endLoc":420,"id":10534,"name":"__mul__","nodeType":"Attribute","startLoc":420,"text":"__mul__"},{"attributeType":"null","col":8,"comment":"null","endLoc":154,"id":10535,"name":"nterms","nodeType":"Attribute","startLoc":154,"text":"self.nterms"},{"attributeType":"null","col":8,"comment":"null","endLoc":156,"id":10536,"name":"coeff","nodeType":"Attribute","startLoc":156,"text":"self.coeff"},{"attributeType":"function","col":4,"comment":"null","endLoc":421,"id":10537,"name":"__truediv__","nodeType":"Attribute","startLoc":421,"text":"__truediv__"},{"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":10538,"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:]"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1292,"id":10539,"name":"b","nodeType":"Attribute","startLoc":1292,"text":"b"},{"col":4,"comment":"null","endLoc":213,"header":"def __init__(self, recstr)","id":10540,"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()"},{"attributeType":"function","col":4,"comment":"null","endLoc":422,"id":10541,"name":"__pow__","nodeType":"Attribute","startLoc":422,"text":"__pow__"},{"attributeType":"function","col":4,"comment":"null","endLoc":423,"id":10542,"name":"__or__","nodeType":"Attribute","startLoc":423,"text":"__or__"},{"col":4,"comment":"One dimensional Box model derivative with respect to parameters","endLoc":1630,"header":"@classmethod\n    def fit_deriv(cls, x, amplitude, x_0, width)","id":10543,"name":"fit_deriv","nodeType":"Function","startLoc":1623,"text":"@classmethod\n    def fit_deriv(cls, x, amplitude, x_0, width):\n        \"\"\"One dimensional Box model derivative with respect to parameters\"\"\"\n\n        d_amplitude = cls.evaluate(x, 1, x_0, width)\n        d_x_0 = np.zeros_like(x)\n        d_width = np.zeros_like(x)\n        return [d_amplitude, d_x_0, d_width]"},{"attributeType":"function","col":4,"comment":"null","endLoc":424,"id":10544,"name":"__and__","nodeType":"Attribute","startLoc":424,"text":"__and__"},{"attributeType":"null","col":8,"comment":"null","endLoc":249,"id":10545,"name":"_inverse","nodeType":"Attribute","startLoc":249,"text":"cls._inverse"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1293,"id":10546,"name":"theta","nodeType":"Attribute","startLoc":1293,"text":"theta"},{"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    ","endLoc":362,"id":10547,"nodeType":"Class","startLoc":324,"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    def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\"Zenithal perspective projection is not defined for mu=-1\")\n        return mu\n\n    mu = Parameter(default=0.0, setter=_validate_mu)\n    phi0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    theta0 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, phi0, theta0):\n        return _projections.szps2x(\n            phi, theta, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))"},{"col":4,"comment":"null","endLoc":216,"header":"def get_coeff(self)","id":10548,"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":10549,"name":"xorder","nodeType":"Attribute","startLoc":209,"text":"self.xorder"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        ","endLoc":1642,"header":"@property\n    def bounding_box(self)","id":10550,"name":"bounding_box","nodeType":"Function","startLoc":1632,"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)"},{"col":4,"comment":"null","endLoc":1649,"header":"@property\n    def input_units(self)","id":10551,"name":"input_units","nodeType":"Function","startLoc":1644,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":1654,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10552,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1651,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"null","endLoc":348,"header":"def _validate_mu(mu)","id":10553,"name":"_validate_mu","nodeType":"Function","startLoc":345,"text":"def _validate_mu(mu):\n        if np.asarray(mu == -1).any():\n            raise ValueError(\"Zenithal perspective projection is not defined for mu=-1\")\n        return mu"},{"attributeType":"null","col":4,"comment":"null","endLoc":1607,"id":10554,"name":"amplitude","nodeType":"Attribute","startLoc":1607,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":212,"id":10555,"name":"ybounds","nodeType":"Attribute","startLoc":212,"text":"self.ybounds"},{"attributeType":"null","col":4,"comment":"null","endLoc":1608,"id":10556,"name":"x_0","nodeType":"Attribute","startLoc":1608,"text":"x_0"},{"attributeType":"null","col":12,"comment":"null","endLoc":387,"id":10557,"name":"__call__","nodeType":"Attribute","startLoc":387,"text":"cls.__call__"},{"attributeType":"null","col":16,"comment":"null","endLoc":122,"id":10558,"name":"param_names","nodeType":"Attribute","startLoc":122,"text":"cls.param_names"},{"attributeType":"Callable | Callable | Callable | Callable","col":8,"comment":"null","endLoc":290,"id":10559,"name":"_bounding_box","nodeType":"Attribute","startLoc":290,"text":"cls._bounding_box"},{"attributeType":"null","col":8,"comment":"null","endLoc":211,"id":10560,"name":"xbounds","nodeType":"Attribute","startLoc":211,"text":"self.xbounds"},{"attributeType":"null","col":4,"comment":"null","endLoc":1609,"id":10561,"name":"width","nodeType":"Attribute","startLoc":1609,"text":"width"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":10562,"name":"_surface","nodeType":"Attribute","startLoc":207,"text":"self._surface"},{"attributeType":"null","col":8,"comment":"null","endLoc":208,"id":10563,"name":"modelname","nodeType":"Attribute","startLoc":208,"text":"self.modelname"},{"attributeType":"null","col":8,"comment":"null","endLoc":210,"id":10564,"name":"yorder","nodeType":"Attribute","startLoc":210,"text":"self.yorder"},{"col":4,"comment":"null","endLoc":357,"header":"@property\n    def inverse(self)","id":10565,"name":"inverse","nodeType":"Function","startLoc":354,"text":"@property\n    def inverse(self):\n        return Pix2Sky_SlantZenithalPerspective(\n            self.mu.value, self.phi0.value, self.theta0.value)"},{"className":"MexicanHat1D","col":0,"comment":"\n    One dimensional Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat2D, 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 MexicanHat1D\n\n        plt.figure()\n        s1 = MexicanHat1D()\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":2007,"id":10566,"nodeType":"Class","startLoc":1922,"text":"class MexicanHat1D(Fittable1DModel):\n    \"\"\"\n    One dimensional Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat2D, 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 MexicanHat1D\n\n        plt.figure()\n        s1 = MexicanHat1D()\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)\n    x_0 = Parameter(default=0)\n    sigma = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Mexican Hat 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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional Mexican Hat model function","endLoc":1980,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, sigma)","id":10567,"name":"evaluate","nodeType":"Function","startLoc":1975,"text":"@staticmethod\n    def evaluate(x, amplitude, x_0, sigma):\n        \"\"\"One dimensional Mexican Hat 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":213,"id":10568,"name":"coeff","nodeType":"Attribute","startLoc":213,"text":"self.coeff"},{"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":1429,"id":10569,"nodeType":"Class","startLoc":1351,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    R_0 = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"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":1995,"header":"def bounding_box(self, factor=10.0)","id":10570,"name":"bounding_box","nodeType":"Function","startLoc":1982,"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":2002,"header":"@property\n    def input_units(self)","id":10571,"name":"input_units","nodeType":"Function","startLoc":1997,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":2007,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10572,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2004,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"null","col":4,"comment":"null","endLoc":1971,"id":10573,"name":"amplitude","nodeType":"Attribute","startLoc":1971,"text":"amplitude"},{"attributeType":"null","col":12,"comment":"null","endLoc":415,"id":10574,"name":"__init__","nodeType":"Attribute","startLoc":415,"text":"cls.__init__"},{"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":10575,"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":10576,"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)"},{"col":4,"comment":"null","endLoc":362,"header":"@classmethod\n    def evaluate(cls, phi, theta, mu, phi0, theta0)","id":10577,"name":"evaluate","nodeType":"Function","startLoc":359,"text":"@classmethod\n    def evaluate(cls, phi, theta, mu, phi0, theta0):\n        return _projections.szps2x(\n            phi, theta, mu, _to_orig_unit(phi0), _to_orig_unit(theta0))"},{"col":4,"comment":"To be implemented by subclasses","endLoc":297,"header":"def _fcache(self, x, y)","id":10578,"name":"_fcache","nodeType":"Function","startLoc":293,"text":"def _fcache(self, x, y):\n        # TODO: Write a docstring explaining the actual purpose of this method\n        \"\"\"To be implemented by subclasses\"\"\"\n\n        raise NotImplementedError(\"Subclasses should implement this\")"},{"col":4,"comment":"Two dimensional Disk model function","endLoc":1399,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0)","id":10579,"name":"evaluate","nodeType":"Function","startLoc":1389,"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        else:\n            return result"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":350,"id":10580,"name":"mu","nodeType":"Attribute","startLoc":350,"text":"mu"},{"attributeType":"null","col":16,"comment":"null","endLoc":120,"id":10581,"name":"_param_names","nodeType":"Attribute","startLoc":120,"text":"cls._param_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":1972,"id":10582,"name":"x_0","nodeType":"Attribute","startLoc":1972,"text":"x_0"},{"className":"_CompoundModelMeta","col":0,"comment":"null","endLoc":2747,"id":10583,"nodeType":"Class","startLoc":2168,"text":"class _CompoundModelMeta(_ModelMeta):\n    _tree = None\n    _submodels = None\n    _submodel_names = None\n    _nextid = 0\n\n    _param_names = None\n    # _param_map is a mapping of the compound model's generated param names to\n    # the parameters of submodels they are associated with.  The values in this\n    # mapping are (idx, name) tuples were idx is the index of the submodel this\n    # parameter is associated with, and name is the same parameter's name on\n    # the submodel\n    # In principle this will allow compound models to give entirely new names\n    # to parameters that don't have to be the same as their original names on\n    # the submodels, but right now that isn't taken advantage of\n    _param_map = None\n\n    _slice_offset = 0\n    # When taking slices of a compound model, this keeps track of how offset\n    # the first model in the slice is from the first model in the original\n    # compound model it was taken from\n\n    # This just inverts _param_map, swapping keys with values.  This is also\n    # useful to have.\n    _param_map_inverse = None\n    _fittable = None\n\n    _evaluate = None\n\n    def __getitem__(cls, index):\n        index = cls._normalize_index(index)\n\n        if isinstance(index, (int, np.integer)):\n            return cls._get_submodels()[index]\n        else:\n            return cls._get_slice(index.start, index.stop)\n\n    def __getattr__(cls, attr):\n        # Make sure the _tree attribute is set; otherwise we are not looking up\n        # an attribute on a concrete compound model class and should just raise\n        # the AttributeError\n        if cls._tree is not None and attr in cls.param_names:\n            cls._init_param_descriptors()\n            return getattr(cls, attr)\n\n        raise AttributeError(attr)\n\n    def __repr__(cls):\n        if cls._tree is None:\n            # This case is mostly for debugging purposes\n            return cls._format_cls_repr()\n\n        expression = cls._format_expression()\n        components = cls._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n\n        return cls._format_cls_repr(keywords=keywords)\n\n    def __dir__(cls):\n        \"\"\"\n        Returns a list of attributes defined on a compound model, including\n        all of its parameters.\n        \"\"\"\n\n        basedir = super().__dir__()\n\n        if cls._tree is not None:\n            for name in cls.param_names:\n                basedir.append(name)\n\n            basedir.sort()\n\n        return basedir\n\n    def __reduce__(cls):\n        rv = super().__reduce__()\n\n        if isinstance(rv, tuple):\n            # Delete _evaluate from the members dict\n            with suppress(KeyError):\n                del rv[1][2]['_evaluate']\n\n        return rv\n\n    @property\n    def submodel_names(cls):\n        if cls._submodel_names is None:\n            seen = {}\n            names = []\n            for idx, submodel in enumerate(cls._get_submodels()):\n                name = str(submodel.name)\n                if name in seen:\n                    names.append('{0}_{1}'.format(name, idx))\n                    if seen[name] >= 0:\n                        jdx = seen[name]\n                        names[jdx] = '{0}_{1}'.format(names[jdx], jdx)\n                        seen[name] = -1\n                else:\n                    names.append(name)\n                    seen[name] = idx\n            cls._submodel_names = tuple(names)\n\n        return cls._submodel_names\n\n    @property\n    def param_names(cls):\n        if cls._param_names is None:\n            cls._init_param_names()\n\n        return cls._param_names\n\n    @property\n    def fittable(cls):\n        if cls._fittable is None:\n            cls._fittable = all(m.fittable for m in cls._get_submodels())\n\n        return cls._fittable\n\n    # TODO: Maybe we could use make_function_with_signature for evaluate, but\n    # it's probably not worth it (and I'm not sure what the limit is on number\n    # of function arguments/local variables but we could break that limit for\n    # complicated compound models...\n    def evaluate(cls, *args):\n        if cls._evaluate is None:\n            func = cls._tree.evaluate(BINARY_OPERATORS,\n                                      getter=cls._model_evaluate_getter)[0]\n            cls._evaluate = func\n        inputs = args[:cls.n_inputs]\n        params = iter(args[cls.n_inputs:])\n        result = cls._evaluate(inputs, params)\n        if cls.n_outputs == 1:\n            return result[0]\n        else:\n            return result\n\n    # TODO: This supports creating a new compound model from two existing\n    # compound models (or normal models) and a single operator.  However, it\n    # ought also to be possible to create a new model from an *entire*\n    # expression, represented as a sequence of operators and their operands (or\n    # an exiting ExpressionTree) and build that into a compound model without\n    # creating an intermediate _CompoundModel class for every single operator\n    # in the expression.  This will prove to be a useful optimization in many\n    # cases\n    @classmethod\n    def _from_operator(mcls, operator, left, right, additional_members={}):\n        \"\"\"\n        Given a Python operator (represented by a string, such as ``'+'``\n        or ``'*'``, and two model classes or instances, return a new compound\n        model that evaluates the given operator on the outputs of the left and\n        right input models.\n\n        If either of the input models are a model *class* (i.e. a subclass of\n        `~astropy.modeling.Model`) then the returned model is a new subclass of\n        `~astropy.modeling.Model` that may be instantiated with any parameter\n        values.  If both input models are *instances* of a model, a new class\n        is still created, but this method returns an *instance* of that class,\n        taking the parameter values from the parameters of the input model\n        instances.\n\n        If given, the ``additional_members`` `dict` may provide additional\n        class members that should be added to the generated\n        `~astropy.modeling.Model` subclass.  Some members that are generated by\n        this method should not be provided by ``additional_members``.  These\n        include ``_tree``, ``inputs``, ``outputs``, ``linear``,\n        ``standard_broadcasting``, and ``__module__`.  This is currently for\n        internal use only.\n        \"\"\"\n        # Note, currently this only supports binary operators, but could be\n        # easily extended to support unary operators (namely '-') if/when\n        # needed\n        children = []\n        for child in (left, right):\n            if isinstance(child, (_CompoundModelMeta, _CompoundModel)):\n                \"\"\"\n                Although the original child models were copied we make another\n                copy here to ensure that changes in this child compound model\n                parameters will not propagate to the reuslt, that is\n                cm1 = Gaussian1D(1, 5, .1) + Gaussian1D()\n                cm2 = cm1 | Scale()\n                cm1.amplitude_0 = 100\n                assert(cm2.amplitude_0 == 1)\n                \"\"\"\n                children.append(copy.deepcopy(child._tree))\n            elif isinstance(child, Model):\n                children.append(ExpressionTree(child.copy()))\n            else:\n                children.append(ExpressionTree(child))\n\n        tree = ExpressionTree(operator, left=children[0], right=children[1])\n\n        name = str('CompoundModel{0}'.format(_CompoundModelMeta._nextid))\n        _CompoundModelMeta._nextid += 1\n\n        mod = find_current_module(3)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        inputs, outputs = mcls._check_inputs_and_outputs(operator, left, right)\n\n        if operator in ('|', '+', '-'):\n            linear = left.linear and right.linear\n        else:\n            # Which is not to say it is *definitely* not linear but it would be\n            # trickier to determine\n            linear = False\n\n        standard_broadcasting = \\\n                left.standard_broadcasting and right.standard_broadcasting\n\n        # Note: If any other members are added here, make sure to mention them\n        # in the docstring of this method.\n        members = additional_members\n        members.update({\n            '_tree': tree,\n            '_is_dynamic': True,  # See docs for _ModelMeta._is_dynamic\n            'inputs': inputs,\n            'outputs': outputs,\n            'linear': linear,\n            'standard_broadcasting': standard_broadcasting,\n            '__module__': str(modname)})\n\n        new_cls = mcls(name, (_CompoundModel,), members)\n\n        if isinstance(left, Model) and isinstance(right, Model):\n            # Both models used in the operator were already instantiated models,\n            # not model *classes*.  As such it's not particularly useful to return\n            # the class itself, but to instead produce a new instance:\n            instance = new_cls()\n\n            # Workaround for https://github.com/astropy/astropy/issues/3542\n            # TODO: Any effort to restructure the tree-like data structure for\n            # compound models should try to obviate this workaround--if\n            # intermediate compound models are stored in the tree as well then\n            # we can immediately check for custom inverses on sub-models when\n            # computing the inverse\n            instance._user_inverse = mcls._make_user_inverse(\n                    operator, left, right)\n\n            if left._n_models == right._n_models:\n                instance._n_models = left._n_models\n            else:\n                raise ValueError('Model sets must have the same number of '\n                                 'components.')\n\n            return instance\n\n        # Otherwise return the new uninstantiated class itself\n        return new_cls\n\n    @classmethod\n    def _check_inputs_and_outputs(mcls, operator, left, right):\n        # TODO: These aren't the full rules for handling inputs and outputs, but\n        # this will handle most basic cases correctly\n        if operator == '|':\n            inputs = left.inputs\n            outputs = right.outputs\n\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        elif operator == '&':\n            inputs = combine_labels(left.inputs, right.inputs)\n            outputs = combine_labels(left.outputs, right.outputs)\n        else:\n            # Without loss of generality\n            inputs = left.inputs\n            outputs = left.outputs\n\n            if (left.n_inputs != right.n_inputs or\n                    left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    \"Unsupported operands for {0}: {1} (n_inputs={2}, \"\n                    \"n_outputs={3}) and {4} (n_inputs={5}, n_outputs={6}); \"\n                    \"models must have the same n_inputs and the same \"\n                    \"n_outputs for this operator\".format(\n                        operator, left.name, left.n_inputs, left.n_outputs,\n                        right.name, right.n_inputs, right.n_outputs))\n\n        return inputs, outputs\n\n    @classmethod\n    def _make_user_inverse(mcls, operator, left, right):\n        \"\"\"\n        Generates an inverse `Model` for this `_CompoundModel` when either\n        model in the operation has a *custom inverse* that was manually\n        assigned by the user.\n\n        If either model has a custom inverse, and in particular if another\n        `_CompoundModel` has a custom inverse, then none of that model's\n        sub-models should be considered at all when computing the inverse.\n        So in that case we just compute the inverse ahead of time and set\n        it as the new compound model's custom inverse.\n\n        Note, this use case only applies when combining model instances,\n        since model classes don't currently have a notion of a \"custom\n        inverse\" (though it could probably be supported by overriding the\n        class's inverse property).\n\n        TODO: Consider fixing things so the aforementioned class-based case\n        works as well.  However, for the present purposes this is good enough.\n        \"\"\"\n\n        if not (operator in ('&', '|') and\n                (left._user_inverse or right._user_inverse)):\n            # These are the only operators that support an inverse right now\n            return None\n\n        try:\n            left_inv = left.inverse\n            right_inv = right.inverse\n        except NotImplementedError:\n            # If either inverse is undefined then just return False; this\n            # means the normal _CompoundModel.inverse routine will fail\n            # naturally anyways, since it requires all sub-models to have\n            # an inverse defined\n            return None\n\n        if operator == '&':\n            return left_inv & right_inv\n        else:\n            return right_inv | left_inv\n\n    # TODO: Perhaps, just perhaps, the post-order (or ???-order) ordering of\n    # leaf nodes is something the ExpressionTree class itself could just know\n    def _get_submodels(cls):\n        # Would make this a lazyproperty but those don't currently work with\n        # type objects\n        if cls._submodels is not None:\n            return cls._submodels\n\n        submodels = [c.value for c in cls._tree.traverse_postorder()\n                     if c.isleaf]\n        cls._submodels = submodels\n        return submodels\n\n    def _init_param_descriptors(cls):\n        \"\"\"\n        This routine sets up the names for all the parameters on a compound\n        model, including figuring out unique names for those parameters and\n        also mapping them back to their associated parameters of the underlying\n        submodels.\n\n        Setting this all up is costly, and only necessary for compound models\n        that a user will directly interact with.  For example when building an\n        expression like::\n\n            >>> M = (Model1 + Model2) * Model3  # doctest: +SKIP\n\n        the user will generally never interact directly with the temporary\n        result of the subexpression ``(Model1 + Model2)``.  So there's no need\n        to setup all the parameters for that temporary throwaway.  Only once\n        the full expression is built and the user initializes or introspects\n        ``M`` is it necessary to determine its full parameterization.\n        \"\"\"\n\n        # Accessing cls.param_names will implicitly call _init_param_names if\n        # needed and thus also set up the _param_map; I'm not crazy about that\n        # design but it stands for now\n        for param_name in cls.param_names:\n            submodel_idx, submodel_param = cls._param_map[param_name]\n            submodel = cls[submodel_idx]\n\n            orig_param = getattr(submodel, submodel_param, None)\n\n            if isinstance(submodel, Model):\n                # Take the parameter's default from the model's value for that\n                # parameter\n                default = orig_param.value\n            else:\n                default = orig_param.default\n\n            # Copy constraints\n            constraints = dict((key, getattr(orig_param, key))\n                               for key in Model.parameter_constraints)\n\n            # Note: Parameter.copy() returns a new unbound Parameter, never\n            # a bound Parameter even if submodel is a Model instance (as\n            # opposed to a Model subclass)\n            new_param = orig_param.copy(name=param_name, default=default,\n                                        unit=orig_param.unit,\n                                        **constraints)\n\n            setattr(cls, param_name, new_param)\n\n    def _init_param_names(cls):\n        \"\"\"\n        This subroutine is solely for setting up the ``param_names`` attribute\n        itself.\n\n        See ``_init_param_descriptors`` for the full parameter setup.\n        \"\"\"\n\n        # Currently this skips over Model *instances* in the expression tree;\n        # basically these are treated as constants and do not add\n        # fittable/tunable parameters to the compound model.\n        # TODO: I'm not 100% happy with this design, and maybe we need some\n        # interface for distinguishing fittable/settable parameters with\n        # *constant* parameters (which would be distinct from parameters with\n        # fixed constraints since they're permanently locked in place). But I'm\n        # not sure if this is really the best way to treat the issue.\n\n        names = []\n        param_map = {}\n\n        # Start counting the suffix indices to put on parameter names from the\n        # slice_offset.  Usually this will just be zero, but for compound\n        # models that were sliced from another compound model this may be > 0\n        param_suffix = cls._slice_offset\n\n        for idx, model in enumerate(cls._get_submodels()):\n            if not model.param_names:\n                # Skip models that don't have parameters in the numbering\n                # TODO: Reevaluate this if it turns out to be confusing, though\n                # parameter-less models are not very common in practice (there\n                # are a few projections that don't take parameters)\n                continue\n\n            for param_name in model.param_names:\n                # This is sort of heuristic, but we want to check that\n                # model.param_name *actually* returns a Parameter descriptor,\n                # and that the model isn't some inconsistent type that happens\n                # to have a param_names attribute but does not actually\n                # implement settable parameters.\n                # In the future we can probably remove this check, but this is\n                # here specifically to support the legacy compat\n                # _CompositeModel which can be considered a pathological case\n                # in the context of the new framework\n                # if not isinstance(getattr(model, param_name, None),\n                #                  Parameter):\n                #    break\n                name = '{0}_{1}'.format(param_name, param_suffix + idx)\n                names.append(name)\n                param_map[name] = (idx, param_name)\n\n        cls._param_names = tuple(names)\n        cls._param_map = param_map\n        cls._param_map_inverse = dict((v, k) for k, v in param_map.items())\n\n    def _format_expression(cls):\n        # TODO: At some point might be useful to make a public version of this,\n        # albeit with more formatting options\n        return cls._tree.format_expression(OPERATOR_PRECEDENCE)\n\n    def _format_components(cls):\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                                 for idx, m in enumerate(cls._get_submodels()))\n\n    def _normalize_index(cls, index):\n        \"\"\"\n        Converts an index given to __getitem__ to either an integer, or\n        a slice with integer start and stop values.\n\n        If the length of the slice is exactly 1 this converts the index to a\n        simple integer lookup.\n\n        Negative integers are converted to positive integers.\n        \"\"\"\n\n        def get_index_from_name(name):\n            try:\n                return cls.submodel_names.index(name)\n            except ValueError:\n                raise IndexError(\n                    'Compound model {0} does not have a component named '\n                    '{1}'.format(cls.name, name))\n\n        def check_for_negative_index(index):\n            if index < 0:\n                new_index = len(cls.submodel_names) + index\n                if new_index < 0:\n                    # If still < 0 then this is an invalid index\n                    raise IndexError(\n                            \"Model index {0} out of range.\".format(index))\n                else:\n                    index = new_index\n\n            return index\n\n        if isinstance(index, str):\n            return get_index_from_name(index)\n        elif isinstance(index, slice):\n            if index.step not in (1, None):\n                # In principle it could be but I can scarcely imagine a case\n                # where it would be useful.  If someone can think of one then\n                # we can enable it.\n                raise ValueError(\n                    \"Step not supported for compound model slicing.\")\n            start = index.start if index.start is not None else 0\n            stop = (index.stop\n                    if index.stop is not None else len(cls.submodel_names))\n            if isinstance(start, (int, np.integer)):\n                start = check_for_negative_index(start)\n            if isinstance(stop, (int, np.integer)):\n                stop = check_for_negative_index(stop)\n            if isinstance(start, str):\n                start = get_index_from_name(start)\n            if isinstance(stop, str):\n                stop = get_index_from_name(stop) + 1\n            length = stop - start\n\n            if length == 1:\n                return start\n            elif length <= 0:\n                raise ValueError(\"Empty slice of a compound model.\")\n\n            return slice(start, stop)\n        elif isinstance(index, (int, np.integer)):\n            if index >= len(cls.submodel_names):\n                raise IndexError(\n                        \"Model index {0} out of range.\".format(index))\n\n            return check_for_negative_index(index)\n\n        raise TypeError(\n            'Submodels can be indexed either by their integer order or '\n            'their name (got {0!r}).'.format(index))\n\n    def _get_slice(cls, start, stop):\n        \"\"\"\n        Return a new model build from a sub-expression of the expression\n        represented by this model.\n\n        Right now this is highly inefficient, as it creates a new temporary\n        model for each operator that appears in the sub-expression.  It would\n        be better if this just built a new expression tree, and the new model\n        instantiated directly from that tree.\n\n        Once tree -> model instantiation is possible this should be fixed to\n        use that instead.\n        \"\"\"\n\n        members = {'_slice_offset': cls._slice_offset + start}\n        operators = dict((oper, _model_oper(oper, additional_members=members))\n                         for oper in BINARY_OPERATORS)\n\n        return cls._tree.evaluate(operators, start=start, stop=stop)\n\n    @staticmethod\n    def _model_evaluate_getter(idx, model):\n        n_params = len(model.param_names)\n        n_inputs = model.n_inputs\n        n_outputs = model.n_outputs\n\n        # There is currently an unfortunate inconsistency in some models, which\n        # requires them to be instantiated for their evaluate to work.  I think\n        # that needs to be reconsidered and fixed somehow, but in the meantime\n        # we need to check for that case\n        if (not isinstance(model, Model) and\n                isinstancemethod(model, model.evaluate)):\n            if n_outputs == 1:\n                # Where previously model was a class, now make an instance\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return (model(*param_values).evaluate(\n                        *chain(inputs, param_values)),)\n            else:\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return model(*param_values).evaluate(\n                        *chain(inputs, param_values))\n        else:\n            evaluate = model.evaluate\n            if n_outputs == 1:\n                f = lambda inputs, params: \\\n                    (evaluate(*chain(inputs, islice(params, n_params))),)\n            else:\n                f = lambda inputs, params: \\\n                    evaluate(*chain(inputs, islice(params, n_params)))\n\n        return (f, n_inputs, n_outputs)"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1410,"header":"@property\n    def bounding_box(self)","id":10584,"name":"bounding_box","nodeType":"Function","startLoc":1401,"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":1418,"header":"@property\n    def input_units(self)","id":10585,"name":"input_units","nodeType":"Function","startLoc":1412,"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        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1429,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10586,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1420,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"null","endLoc":2203,"header":"def __getitem__(cls, index)","id":10587,"name":"__getitem__","nodeType":"Function","startLoc":2197,"text":"def __getitem__(cls, index):\n        index = cls._normalize_index(index)\n\n        if isinstance(index, (int, np.integer)):\n            return cls._get_submodels()[index]\n        else:\n            return cls._get_slice(index.start, index.stop)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1384,"id":10588,"name":"amplitude","nodeType":"Attribute","startLoc":1384,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":1973,"id":10589,"name":"sigma","nodeType":"Attribute","startLoc":1973,"text":"sigma"},{"col":4,"comment":"null","endLoc":305,"header":"def evaluate(self, x, y, *coeffs)","id":10590,"name":"evaluate","nodeType":"Function","startLoc":299,"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)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":351,"id":10591,"name":"phi0","nodeType":"Attribute","startLoc":351,"text":"phi0"},{"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":1841,"id":10592,"nodeType":"Class","startLoc":1746,"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)\n    x_0 = Parameter(default=0)\n    width = Parameter(default=1)\n    slope = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"One dimensional Trapezoid model function","endLoc":1816,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, width, slope)","id":10593,"name":"evaluate","nodeType":"Function","startLoc":1793,"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        else:\n            return result"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1385,"id":10594,"name":"x_0","nodeType":"Attribute","startLoc":1385,"text":"x_0"},{"col":4,"comment":"null","endLoc":246,"header":"def aslist(self, dtb)","id":10595,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":233,"id":10596,"name":"numrecords","nodeType":"Attribute","startLoc":233,"text":"self.numrecords"},{"attributeType":"null","col":8,"comment":"null","endLoc":232,"id":10597,"name":"records","nodeType":"Attribute","startLoc":232,"text":"self.records"},{"className":"ReidentifyRecord","col":0,"comment":"\n    Represents a database record for the onedspec.reidentify task\n    ","endLoc":263,"id":10598,"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":"\n        Tuple defining the default ``bounding_box`` limits.\n\n        ``(x_low, x_high))``\n        ","endLoc":1828,"header":"@property\n    def bounding_box(self)","id":10599,"name":"bounding_box","nodeType":"Function","startLoc":1818,"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)"},{"col":4,"comment":"null","endLoc":1835,"header":"@property\n    def input_units(self)","id":10600,"name":"input_units","nodeType":"Function","startLoc":1830,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":1841,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10601,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1837,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('slope', outputs_unit['y'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"null","endLoc":258,"header":"def __init__(self, databasestr)","id":10602,"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":1788,"id":10603,"name":"amplitude","nodeType":"Attribute","startLoc":1788,"text":"amplitude"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1386,"id":10604,"name":"y_0","nodeType":"Attribute","startLoc":1386,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":1789,"id":10605,"name":"x_0","nodeType":"Attribute","startLoc":1789,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":1790,"id":10606,"name":"width","nodeType":"Attribute","startLoc":1790,"text":"width"},{"attributeType":"null","col":4,"comment":"null","endLoc":1791,"id":10607,"name":"slope","nodeType":"Attribute","startLoc":1791,"text":"slope"},{"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":2266,"id":10608,"nodeType":"Class","startLoc":2174,"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)\n    x_0 = Parameter(default=0)\n    gamma = Parameter(default=1)\n    alpha = Parameter(default=1)\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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * 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        d_A = (1 + (x - x_0) ** 2 / gamma ** 2) ** (-alpha)\n        d_x_0 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * d_A ** alpha))\n        d_gamma = (2 * amplitude * alpha * d_A * (x - x_0) ** 2 /\n                   (gamma ** 3 * d_A ** alpha))\n        d_alpha = -amplitude * d_A * np.log(1 + (x - x_0) ** 2 / gamma ** 2)\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        else:\n            return {'x': self.x_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"col":4,"comment":"null","endLoc":263,"header":"def get_ydata(self)","id":10609,"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"},{"col":4,"comment":"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        ","endLoc":2236,"header":"@property\n    def fwhm(self)","id":10610,"name":"fwhm","nodeType":"Function","startLoc":2229,"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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * self.gamma * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)"},{"attributeType":"null","col":8,"comment":"null","endLoc":256,"id":10611,"name":"x","nodeType":"Attribute","startLoc":256,"text":"self.x"},{"col":4,"comment":"One dimensional Moffat model function","endLoc":2242,"header":"@staticmethod\n    def evaluate(x, amplitude, x_0, gamma, alpha)","id":10612,"name":"evaluate","nodeType":"Function","startLoc":2238,"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":2254,"header":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha)","id":10613,"name":"fit_deriv","nodeType":"Function","startLoc":2244,"text":"@staticmethod\n    def fit_deriv(x, amplitude, x_0, gamma, alpha):\n        \"\"\"One dimensional Moffat model derivative with respect to parameters\"\"\"\n\n        d_A = (1 + (x - x_0) ** 2 / gamma ** 2) ** (-alpha)\n        d_x_0 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * d_A ** alpha))\n        d_gamma = (2 * amplitude * alpha * d_A * (x - x_0) ** 2 /\n                   (gamma ** 3 * d_A ** alpha))\n        d_alpha = -amplitude * d_A * np.log(1 + (x - x_0) ** 2 / gamma ** 2)\n        return [d_A, d_x_0, d_gamma, d_alpha]"},{"attributeType":"null","col":8,"comment":"null","endLoc":257,"id":10614,"name":"y","nodeType":"Attribute","startLoc":257,"text":"self.y"},{"col":4,"comment":"null","endLoc":2261,"header":"@property\n    def input_units(self)","id":10615,"name":"input_units","nodeType":"Function","startLoc":2256,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit}"},{"col":4,"comment":"null","endLoc":2266,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10616,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2263,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['y'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1387,"id":10617,"name":"R_0","nodeType":"Attribute","startLoc":1387,"text":"R_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2224,"id":10618,"name":"amplitude","nodeType":"Attribute","startLoc":2224,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":258,"id":10619,"name":"z","nodeType":"Attribute","startLoc":258,"text":"self.z"},{"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":10620,"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"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":352,"id":10621,"name":"theta0","nodeType":"Attribute","startLoc":352,"text":"theta0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2225,"id":10622,"name":"x_0","nodeType":"Attribute","startLoc":2225,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2226,"id":10623,"name":"gamma","nodeType":"Attribute","startLoc":2226,"text":"gamma"},{"attributeType":"null","col":4,"comment":"null","endLoc":2227,"id":10624,"name":"alpha","nodeType":"Attribute","startLoc":2227,"text":"alpha"},{"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":10625,"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":"null","col":16,"comment":"null","endLoc":8,"id":10626,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":10627,"name":"iraf_models_map","nodeType":"Attribute","startLoc":11,"text":"iraf_models_map"},{"col":0,"comment":"","endLoc":4,"header":"irafutil.py#<anonymous>","id":10628,"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":"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":1537,"id":10629,"nodeType":"Class","startLoc":1432,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    r_in = Parameter(default=1)\n    width = Parameter(default=1)\n\n    def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=r_in.default, width=width.default,\n                 r_out=None, **kwargs):\n        # If outer radius explicitly given, it overrides default width.\n        if r_out is not None:\n            if width != self.width.default:\n                raise InputParameterError(\n                    \"Cannot specify both width and outer radius separately.\")\n            width = r_out - r_in\n        elif width is None:\n            width = self.width.default\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_in', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"className":"Box2D","col":0,"comment":"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\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":1743,"id":10630,"nodeType":"Class","startLoc":1657,"text":"class Box2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional Box model.\n\n    Parameters\n    ----------\n    amplitude : float\n        Amplitude A\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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    x_width = Parameter(default=1)\n    y_width = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}\n\n    def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['y']),\n                            ('x_width', inputs_unit['x']),\n                            ('y_width', inputs_unit['y']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"null","endLoc":1491,"header":"def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=r_in.default, width=width.default,\n                 r_out=None, **kwargs)","id":10631,"name":"__init__","nodeType":"Function","startLoc":1477,"text":"def __init__(self, amplitude=amplitude.default, x_0=x_0.default,\n                 y_0=y_0.default, r_in=r_in.default, width=width.default,\n                 r_out=None, **kwargs):\n        # If outer radius explicitly given, it overrides default width.\n        if r_out is not None:\n            if width != self.width.default:\n                raise InputParameterError(\n                    \"Cannot specify both width and outer radius separately.\")\n            width = r_out - r_in\n        elif width is None:\n            width = self.width.default\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":"Two dimensional Box model function","endLoc":1714,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, x_width, y_width)","id":10632,"name":"evaluate","nodeType":"Function","startLoc":1700,"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        else:\n            return result"},{"col":4,"comment":"null","endLoc":315,"header":"def prepare_inputs(self, x, y, **kwargs)","id":10633,"name":"prepare_inputs","nodeType":"Function","startLoc":307,"text":"def prepare_inputs(self, x, y, **kwargs):\n        inputs, format_info = 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), format_info"},{"fileName":"__init__.py","filePath":"astropy/modeling/tests","id":10634,"nodeType":"File","text":""},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1728,"header":"@property\n    def bounding_box(self)","id":10635,"name":"bounding_box","nodeType":"Function","startLoc":1716,"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":1736,"header":"@property\n    def input_units(self)","id":10636,"name":"input_units","nodeType":"Function","startLoc":1730,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1743,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10637,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1738,"text":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):\n        return OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['y']),\n                            ('x_width', inputs_unit['x']),\n                            ('y_width', inputs_unit['y']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"Two dimensional Ring model function.","endLoc":1504,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, r_in, width)","id":10638,"name":"evaluate","nodeType":"Function","startLoc":1493,"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        else:\n            return result"},{"attributeType":"null","col":4,"comment":"null","endLoc":1694,"id":10639,"name":"amplitude","nodeType":"Attribute","startLoc":1694,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":179,"id":10640,"name":"inputs","nodeType":"Attribute","startLoc":179,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":10641,"name":"outputs","nodeType":"Attribute","startLoc":180,"text":"outputs"},{"attributeType":"null","col":8,"comment":"null","endLoc":190,"id":10642,"name":"y_degree","nodeType":"Attribute","startLoc":190,"text":"self.y_degree"},{"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":386,"id":10643,"nodeType":"Class","startLoc":368,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Gnomonic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.tanx2s(x, y)"},{"col":4,"comment":"null","endLoc":382,"header":"@property\n    def inverse(self)","id":10644,"name":"inverse","nodeType":"Function","startLoc":380,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Gnomonic()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1695,"id":10645,"name":"x_0","nodeType":"Attribute","startLoc":1695,"text":"x_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":189,"id":10646,"name":"x_degree","nodeType":"Attribute","startLoc":189,"text":"self.x_degree"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1517,"header":"@property\n    def bounding_box(self)","id":10647,"name":"bounding_box","nodeType":"Function","startLoc":1506,"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":1525,"header":"@property\n    def input_units(self)","id":10648,"name":"input_units","nodeType":"Function","startLoc":1519,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1537,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10649,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1527,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_in', inputs_unit['x']),\n                            ('width', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1471,"id":10650,"name":"amplitude","nodeType":"Attribute","startLoc":1471,"text":"amplitude"},{"attributeType":"null","col":8,"comment":"null","endLoc":191,"id":10651,"name":"_order","nodeType":"Attribute","startLoc":191,"text":"self._order"},{"col":4,"comment":"null","endLoc":386,"header":"@classmethod\n    def evaluate(cls, x, y)","id":10652,"name":"evaluate","nodeType":"Function","startLoc":384,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.tanx2s(x, y)"},{"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":410,"id":10653,"nodeType":"Class","startLoc":392,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Gnomonic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tans2x(phi, theta)"},{"col":4,"comment":"null","endLoc":406,"header":"@property\n    def inverse(self)","id":10654,"name":"inverse","nodeType":"Function","startLoc":404,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Gnomonic()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1696,"id":10655,"name":"y_0","nodeType":"Attribute","startLoc":1696,"text":"y_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":193,"id":10656,"name":"y_domain","nodeType":"Attribute","startLoc":193,"text":"self.y_domain"},{"attributeType":"null","col":4,"comment":"null","endLoc":1697,"id":10657,"name":"x_width","nodeType":"Attribute","startLoc":1697,"text":"x_width"},{"attributeType":"null","col":4,"comment":"null","endLoc":1698,"id":10658,"name":"y_width","nodeType":"Attribute","startLoc":1698,"text":"y_width"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1472,"id":10659,"name":"x_0","nodeType":"Attribute","startLoc":1472,"text":"x_0"},{"id":10660,"name":"astropy/modeling/tests/data","nodeType":"Package"},{"id":10661,"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"},{"id":10662,"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 "},{"className":"MexicanHat2D","col":0,"comment":"\n    Two dimensional symmetric Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat1D, 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":2070,"id":10663,"nodeType":"Class","startLoc":2010,"text":"class MexicanHat2D(Fittable2DModel):\n    \"\"\"\n    Two dimensional symmetric Mexican Hat 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 Mexican hat\n\n    See Also\n    --------\n    MexicanHat1D, 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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    sigma = Parameter(default=1)\n\n    @staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Mexican Hat 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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"id":10664,"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":"Two dimensional Mexican Hat model function","endLoc":2051,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma)","id":10665,"name":"evaluate","nodeType":"Function","startLoc":2046,"text":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, sigma):\n        \"\"\"Two dimensional Mexican Hat 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)"},{"col":4,"comment":"null","endLoc":2059,"header":"@property\n    def input_units(self)","id":10666,"name":"input_units","nodeType":"Function","startLoc":2053,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2070,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10667,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2061,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('sigma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"null","col":8,"comment":"null","endLoc":192,"id":10668,"name":"x_domain","nodeType":"Attribute","startLoc":192,"text":"self.x_domain"},{"attributeType":"null","col":4,"comment":"null","endLoc":2041,"id":10669,"name":"amplitude","nodeType":"Attribute","startLoc":2041,"text":"amplitude"},{"attributeType":"null","col":4,"comment":"null","endLoc":2042,"id":10670,"name":"x_0","nodeType":"Attribute","startLoc":2042,"text":"x_0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1473,"id":10671,"name":"y_0","nodeType":"Attribute","startLoc":1473,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2043,"id":10672,"name":"y_0","nodeType":"Attribute","startLoc":2043,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2044,"id":10673,"name":"sigma","nodeType":"Attribute","startLoc":2044,"text":"sigma"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":10674,"name":"y_window","nodeType":"Attribute","startLoc":195,"text":"self.y_window"},{"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":1919,"id":10675,"nodeType":"Class","startLoc":1844,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    R_0 = Parameter(default=1)\n    slope = Parameter(default=1)\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        else:\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('slope', outputs_unit['z'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"Two dimensional Trapezoid Disk model function","endLoc":1886,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, R_0, slope)","id":10676,"name":"evaluate","nodeType":"Function","startLoc":1872,"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        else:\n            return result"},{"attributeType":"null","col":8,"comment":"null","endLoc":196,"id":10677,"name":"_param_names","nodeType":"Attribute","startLoc":196,"text":"self._param_names"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1474,"id":10678,"name":"r_in","nodeType":"Attribute","startLoc":1474,"text":"r_in"},{"attributeType":"null","col":8,"comment":"null","endLoc":194,"id":10679,"name":"x_window","nodeType":"Attribute","startLoc":194,"text":"self.x_window"},{"col":4,"comment":"\n        Tuple defining the default ``bounding_box``.\n\n        ``((y_low, y_high), (x_low, x_high))``\n        ","endLoc":1899,"header":"@property\n    def bounding_box(self)","id":10680,"name":"bounding_box","nodeType":"Function","startLoc":1888,"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":1907,"header":"@property\n    def input_units(self)","id":10681,"name":"input_units","nodeType":"Function","startLoc":1901,"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        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":1919,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10682,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1909,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('R_0', inputs_unit['x']),\n                            ('slope', outputs_unit['z'] / inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"null","endLoc":410,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":10683,"name":"evaluate","nodeType":"Function","startLoc":408,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tans2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1866,"id":10684,"name":"amplitude","nodeType":"Attribute","startLoc":1866,"text":"amplitude"},{"fileName":"__init__.py","filePath":"astropy/modeling/tests/data","id":10685,"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"},{"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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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":422,"id":10686,"nodeType":"Class","startLoc":318,"text":"class Chebyshev1D(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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 = ('x',)\n    outputs = ('y',)\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            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 : throw away parameter\n            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, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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":"Parameter","col":4,"comment":"null","endLoc":1475,"id":10687,"name":"width","nodeType":"Attribute","startLoc":1475,"text":"width"},{"attributeType":"null","col":4,"comment":"null","endLoc":1867,"id":10688,"name":"x_0","nodeType":"Attribute","startLoc":1867,"text":"x_0"},{"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":434,"id":10689,"nodeType":"Class","startLoc":416,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Stereographic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.stgx2s(x, y)"},{"col":4,"comment":"null","endLoc":362,"header":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":10690,"name":"__init__","nodeType":"Function","startLoc":356,"text":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":10691,"name":"dpath","nodeType":"Attribute","startLoc":5,"text":"dpath"},{"attributeType":"null","col":4,"comment":"null","endLoc":1868,"id":10692,"name":"y_0","nodeType":"Attribute","startLoc":1868,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":1869,"id":10693,"name":"R_0","nodeType":"Attribute","startLoc":1869,"text":"R_0"},{"col":4,"comment":"null","endLoc":430,"header":"@property\n    def inverse(self)","id":10694,"name":"inverse","nodeType":"Function","startLoc":428,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Stereographic()"},{"col":0,"comment":"","endLoc":3,"header":"__init__.py#<anonymous>","id":10695,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"dpath = os.path.split(os.path.abspath(__file__))[0]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1870,"id":10696,"name":"slope","nodeType":"Attribute","startLoc":1870,"text":"slope"},{"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":2171,"id":10697,"nodeType":"Class","startLoc":2073,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    radius = Parameter(default=1)\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            try:\n                from scipy.special import j1, jn_zeros\n                cls._rz = jn_zeros(1, 1)[0] / np.pi\n                cls._j1 = j1\n            except ValueError:\n                raise ImportError('AiryDisk2D model requires scipy > 0.11.')\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('radius', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"id":10698,"name":"astropy/constants","nodeType":"Package"},{"fileName":"astropyconst13.py","filePath":"astropy/constants","id":10699,"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\"\"\"\n\n\n\nimport itertools\n\nfrom .constant import Constant\nfrom . import codata2010, iau2012\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2010).items()),\n                               sorted(vars(iau2012).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()):\n        locals()[_c.abbrev] = _c\n"},{"col":4,"comment":"Two dimensional Airy model function","endLoc":2152,"header":"@classmethod\n    def evaluate(cls, x, y, amplitude, x_0, y_0, radius)","id":10700,"name":"evaluate","nodeType":"Function","startLoc":2123,"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            try:\n                from scipy.special import j1, jn_zeros\n                cls._rz = jn_zeros(1, 1)[0] / np.pi\n                cls._j1 = j1\n            except ValueError:\n                raise ImportError('AiryDisk2D model requires scipy > 0.11.')\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":"Delta1D","col":0,"comment":"One dimensional Dirac delta function.","endLoc":1544,"id":10701,"nodeType":"Class","startLoc":1540,"text":"class Delta1D(Fittable1DModel):\n    \"\"\"One dimensional Dirac delta function.\"\"\"\n\n    def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")"},{"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":217,"id":10702,"nodeType":"Class","startLoc":76,"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(\"{} requires a reference.\".format(cls))\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 {0!r} already has a definition in the '\n                              '{1!r} system from {2!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 ('<{0} name={1!r} value={2} uncertainty={3} unit={4!r} '\n                'reference={5!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   = {0}\\n'\n                '  Value  = {1}\\n'\n                '  Uncertainty  = {2}\\n'\n                '  Unit  = {3}\\n'\n                '  Reference = {4}'.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 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)"},{"col":4,"comment":"null","endLoc":434,"header":"@classmethod\n    def evaluate(cls, x, y)","id":10703,"name":"evaluate","nodeType":"Function","startLoc":432,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.stgx2s(x, y)"},{"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":458,"id":10704,"nodeType":"Class","startLoc":440,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Stereographic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.stgs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":454,"header":"@property\n    def inverse(self)","id":10705,"name":"inverse","nodeType":"Function","startLoc":452,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Stereographic()"},{"col":4,"comment":"null","endLoc":1544,"header":"def __init__(self)","id":10706,"name":"__init__","nodeType":"Function","startLoc":1543,"text":"def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")"},{"className":"Delta2D","col":0,"comment":"Two dimensional Dirac delta function.","endLoc":1551,"id":10707,"nodeType":"Class","startLoc":1547,"text":"class Delta2D(Fittable2DModel):\n    \"\"\"Two dimensional Dirac delta function.\"\"\"\n\n    def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")"},{"col":4,"comment":"null","endLoc":1551,"header":"def __init__(self)","id":10708,"name":"__init__","nodeType":"Function","startLoc":1550,"text":"def __init__(self):\n        raise ModelDefinitionError(\"Not implemented\")"},{"col":4,"comment":"null","endLoc":118,"header":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=None, system=None)","id":10709,"name":"__new__","nodeType":"Function","startLoc":85,"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(\"{} requires a reference.\".format(cls))\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 {0!r} already has a definition in the '\n                              '{1!r} system from {2!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":"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":2353,"id":10710,"nodeType":"Class","startLoc":2269,"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)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    gamma = Parameter(default=1)\n    alpha = Parameter(default=1)\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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * 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 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (-amplitude * alpha * d_A * (-2 * y + 2 * 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 / (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 {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"\n        Moffat full width at half maximum.\n        Derivation of the formula is available in\n        `this notebook by Yoonsoo Bach <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        ","endLoc":2313,"header":"@property\n    def fwhm(self)","id":10711,"name":"fwhm","nodeType":"Function","startLoc":2306,"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 <http://nbviewer.jupyter.org/github/ysbach/AO_2017/blob/master/04_Ground_Based_Concept.ipynb#1.2.-Moffat>`_.\n        \"\"\"\n        return 2.0 * self.gamma * np.sqrt(2.0 ** (1.0 / self.alpha) - 1.0)"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":389,"header":"def fit_deriv(self, x, *params)","id":10712,"name":"fit_deriv","nodeType":"Function","startLoc":364,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            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":"Two dimensional Moffat model function","endLoc":2320,"header":"@staticmethod\n    def evaluate(x, y, amplitude, x_0, y_0, gamma, alpha)","id":10713,"name":"evaluate","nodeType":"Function","startLoc":2315,"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":2334,"header":"@staticmethod\n    def fit_deriv(x, y, amplitude, x_0, y_0, gamma, alpha)","id":10714,"name":"fit_deriv","nodeType":"Function","startLoc":2322,"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 = (-amplitude * alpha * d_A * (-2 * x + 2 * x_0) /\n                 (gamma ** 2 * (1 + rr_gg)))\n        d_y_0 = (-amplitude * alpha * d_A * (-2 * y + 2 * 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 / (gamma * (1 + rr_gg)))\n        return [d_A, d_x_0, d_y_0, d_gamma, d_alpha]"},{"col":4,"comment":"null","endLoc":458,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":10715,"name":"evaluate","nodeType":"Function","startLoc":456,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.stgs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":2342,"header":"@property\n    def input_units(self)","id":10716,"name":"input_units","nodeType":"Function","startLoc":2336,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2353,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10717,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2344,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('gamma', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2300,"id":10718,"name":"amplitude","nodeType":"Attribute","startLoc":2300,"text":"amplitude"},{"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    ","endLoc":503,"id":10719,"nodeType":"Class","startLoc":464,"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 = Parameter(default=0.0)\n    eta = Parameter(default=0.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_SlantOrthographic(self.xi.value, self.eta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, xi, eta):\n        return _projections.sinx2s(x, y, xi, eta)"},{"col":4,"comment":"null","endLoc":397,"header":"def prepare_inputs(self, x, **kwargs)","id":10720,"name":"prepare_inputs","nodeType":"Function","startLoc":391,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info"},{"col":4,"comment":"null","endLoc":499,"header":"@property\n    def inverse(self)","id":10721,"name":"inverse","nodeType":"Function","startLoc":497,"text":"@property\n    def inverse(self):\n        return Sky2Pix_SlantOrthographic(self.xi.value, self.eta.value)"},{"col":4,"comment":"\n        Converts an index given to __getitem__ to either an integer, or\n        a slice with integer start and stop values.\n\n        If the length of the slice is exactly 1 this converts the index to a\n        simple integer lookup.\n\n        Negative integers are converted to positive integers.\n        ","endLoc":2693,"header":"def _normalize_index(cls, index)","id":10722,"name":"_normalize_index","nodeType":"Function","startLoc":2625,"text":"def _normalize_index(cls, index):\n        \"\"\"\n        Converts an index given to __getitem__ to either an integer, or\n        a slice with integer start and stop values.\n\n        If the length of the slice is exactly 1 this converts the index to a\n        simple integer lookup.\n\n        Negative integers are converted to positive integers.\n        \"\"\"\n\n        def get_index_from_name(name):\n            try:\n                return cls.submodel_names.index(name)\n            except ValueError:\n                raise IndexError(\n                    'Compound model {0} does not have a component named '\n                    '{1}'.format(cls.name, name))\n\n        def check_for_negative_index(index):\n            if index < 0:\n                new_index = len(cls.submodel_names) + index\n                if new_index < 0:\n                    # If still < 0 then this is an invalid index\n                    raise IndexError(\n                            \"Model index {0} out of range.\".format(index))\n                else:\n                    index = new_index\n\n            return index\n\n        if isinstance(index, str):\n            return get_index_from_name(index)\n        elif isinstance(index, slice):\n            if index.step not in (1, None):\n                # In principle it could be but I can scarcely imagine a case\n                # where it would be useful.  If someone can think of one then\n                # we can enable it.\n                raise ValueError(\n                    \"Step not supported for compound model slicing.\")\n            start = index.start if index.start is not None else 0\n            stop = (index.stop\n                    if index.stop is not None else len(cls.submodel_names))\n            if isinstance(start, (int, np.integer)):\n                start = check_for_negative_index(start)\n            if isinstance(stop, (int, np.integer)):\n                stop = check_for_negative_index(stop)\n            if isinstance(start, str):\n                start = get_index_from_name(start)\n            if isinstance(stop, str):\n                stop = get_index_from_name(stop) + 1\n            length = stop - start\n\n            if length == 1:\n                return start\n            elif length <= 0:\n                raise ValueError(\"Empty slice of a compound model.\")\n\n            return slice(start, stop)\n        elif isinstance(index, (int, np.integer)):\n            if index >= len(cls.submodel_names):\n                raise IndexError(\n                        \"Model index {0} out of range.\".format(index))\n\n            return check_for_negative_index(index)\n\n        raise TypeError(\n            'Submodels can be indexed either by their integer order or '\n            'their name (got {0!r}).'.format(index))"},{"col":4,"comment":"null","endLoc":2160,"header":"@property\n    def input_units(self)","id":10724,"name":"input_units","nodeType":"Function","startLoc":2154,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2171,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10726,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2162,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('radius', inputs_unit['x']),\n                            ('amplitude', outputs_unit['z'])])"},{"col":4,"comment":"null","endLoc":402,"header":"def evaluate(self, x, *coeffs)","id":10727,"name":"evaluate","nodeType":"Function","startLoc":399,"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":"null","endLoc":503,"header":"@classmethod\n    def evaluate(cls, x, y, xi, eta)","id":10728,"name":"evaluate","nodeType":"Function","startLoc":501,"text":"@classmethod\n    def evaluate(cls, x, y, xi, eta):\n        return _projections.sinx2s(x, y, xi, eta)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2301,"id":10729,"name":"x_0","nodeType":"Attribute","startLoc":2301,"text":"x_0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":494,"id":10730,"name":"xi","nodeType":"Attribute","startLoc":494,"text":"xi"},{"col":4,"comment":"null","endLoc":2511,"header":"def _get_submodels(cls)","id":10731,"name":"_get_submodels","nodeType":"Function","startLoc":2502,"text":"def _get_submodels(cls):\n        # Would make this a lazyproperty but those don't currently work with\n        # type objects\n        if cls._submodels is not None:\n            return cls._submodels\n\n        submodels = [c.value for c in cls._tree.traverse_postorder()\n                     if c.isleaf]\n        cls._submodels = submodels\n        return submodels"},{"col":4,"comment":"null","endLoc":124,"header":"def __repr__(self)","id":10732,"name":"__repr__","nodeType":"Function","startLoc":120,"text":"def __repr__(self):\n        return ('<{0} name={1!r} value={2} uncertainty={3} unit={4!r} '\n                'reference={5!r}>'.format(self.__class__, self.name, self.value,\n                                          self.uncertainty, str(self.unit),\n                                          self.reference))"},{"attributeType":"null","col":4,"comment":"null","endLoc":2116,"id":10733,"name":"amplitude","nodeType":"Attribute","startLoc":2116,"text":"amplitude"},{"col":4,"comment":"null","endLoc":133,"header":"def __str__(self)","id":10734,"name":"__str__","nodeType":"Function","startLoc":126,"text":"def __str__(self):\n        return ('  Name   = {0}\\n'\n                '  Value  = {1}\\n'\n                '  Uncertainty  = {2}\\n'\n                '  Unit  = {3}\\n'\n                '  Reference = {4}'.format(self.name, self.value,\n                                           self.uncertainty, self.unit,\n                                           self.reference))"},{"col":4,"comment":"null","endLoc":136,"header":"def __quantity_subclass__(self, unit)","id":10735,"name":"__quantity_subclass__","nodeType":"Function","startLoc":135,"text":"def __quantity_subclass__(self, unit):\n        return super().__quantity_subclass__(unit)[0], False"},{"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":144,"header":"def copy(self)","id":10736,"name":"copy","nodeType":"Function","startLoc":138,"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":153,"header":"@property\n    def abbrev(self)","id":10737,"name":"abbrev","nodeType":"Function","startLoc":147,"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":159,"header":"@property\n    def name(self)","id":10738,"name":"name","nodeType":"Function","startLoc":155,"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":165,"header":"@lazyproperty\n    def _unit(self)","id":10739,"name":"_unit","nodeType":"Function","startLoc":161,"text":"@lazyproperty\n    def _unit(self):\n        \"\"\"The unit(s) in which this constant is defined.\"\"\"\n\n        return Unit(self._unit_string)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2302,"id":10740,"name":"y_0","nodeType":"Attribute","startLoc":2302,"text":"y_0"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":495,"id":10741,"name":"eta","nodeType":"Attribute","startLoc":495,"text":"eta"},{"attributeType":"null","col":4,"comment":"null","endLoc":2117,"id":10742,"name":"x_0","nodeType":"Attribute","startLoc":2117,"text":"x_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2118,"id":10743,"name":"y_0","nodeType":"Attribute","startLoc":2118,"text":"y_0"},{"attributeType":"null","col":4,"comment":"null","endLoc":2119,"id":10744,"name":"radius","nodeType":"Attribute","startLoc":2119,"text":"radius"},{"attributeType":"null","col":4,"comment":"null","endLoc":2120,"id":10745,"name":"_rz","nodeType":"Attribute","startLoc":2120,"text":"_rz"},{"attributeType":"null","col":4,"comment":"null","endLoc":2121,"id":10746,"name":"_j1","nodeType":"Attribute","startLoc":2121,"text":"_j1"},{"attributeType":"null","col":16,"comment":"null","endLoc":2130,"id":10747,"name":"_rz","nodeType":"Attribute","startLoc":2130,"text":"cls._rz"},{"attributeType":"null","col":16,"comment":"null","endLoc":2131,"id":10748,"name":"_j1","nodeType":"Attribute","startLoc":2131,"text":"cls._j1"},{"col":4,"comment":"The known uncertainty in this constant's value.","endLoc":171,"header":"@property\n    def uncertainty(self)","id":10749,"name":"uncertainty","nodeType":"Function","startLoc":167,"text":"@property\n    def uncertainty(self):\n        \"\"\"The known uncertainty in this constant's value.\"\"\"\n\n        return self._uncertainty"},{"col":4,"comment":"The source used for the value of this constant.","endLoc":177,"header":"@property\n    def reference(self)","id":10750,"name":"reference","nodeType":"Function","startLoc":173,"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":186,"header":"@property\n    def system(self)","id":10751,"name":"system","nodeType":"Function","startLoc":179,"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":194,"header":"def _instance_or_super(self, key)","id":10752,"name":"_instance_or_super","nodeType":"Function","startLoc":188,"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)"},{"className":"Sersic2D","col":0,"comment":"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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 (b_n,2n)\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":2476,"id":10753,"nodeType":"Class","startLoc":2356,"text":"class Sersic2D(Fittable2DModel):\n    r\"\"\"\n    Two dimensional Sersic surface brightness profile.\n\n    Parameters\n    ----------\n    amplitude : float\n        Central surface brightness, within 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 (b_n,2n)\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)\n    r_eff = Parameter(default=1)\n    n = Parameter(default=4)\n    x_0 = Parameter(default=0)\n    y_0 = Parameter(default=0)\n    ellip = Parameter(default=0)\n    theta = Parameter(default=0)\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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic2D model requires scipy > 0.11.')\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        else:\n            return {'x': self.x_0.unit,\n                    'y': 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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_eff', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2303,"id":10754,"name":"gamma","nodeType":"Attribute","startLoc":2303,"text":"gamma"},{"col":4,"comment":"\n        Return a new model build from a sub-expression of the expression\n        represented by this model.\n\n        Right now this is highly inefficient, as it creates a new temporary\n        model for each operator that appears in the sub-expression.  It would\n        be better if this just built a new expression tree, and the new model\n        instantiated directly from that tree.\n\n        Once tree -> model instantiation is possible this should be fixed to\n        use that instead.\n        ","endLoc":2713,"header":"def _get_slice(cls, start, stop)","id":10755,"name":"_get_slice","nodeType":"Function","startLoc":2695,"text":"def _get_slice(cls, start, stop):\n        \"\"\"\n        Return a new model build from a sub-expression of the expression\n        represented by this model.\n\n        Right now this is highly inefficient, as it creates a new temporary\n        model for each operator that appears in the sub-expression.  It would\n        be better if this just built a new expression tree, and the new model\n        instantiated directly from that tree.\n\n        Once tree -> model instantiation is possible this should be fixed to\n        use that instead.\n        \"\"\"\n\n        members = {'_slice_offset': cls._slice_offset + start}\n        operators = dict((oper, _model_oper(oper, additional_members=members))\n                         for oper in BINARY_OPERATORS)\n\n        return cls._tree.evaluate(operators, start=start, stop=stop)"},{"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\n    Any additional keyword arguments passed in are passed to\n    `_CompoundModelMeta._from_operator`.\n    ","endLoc":75,"header":"def _model_oper(oper, **kwargs)","id":10756,"name":"_model_oper","nodeType":"Function","startLoc":59,"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    Any additional keyword arguments passed in are passed to\n    `_CompoundModelMeta._from_operator`.\n    \"\"\"\n\n    # Note: Originally this used functools.partial, but that won't work when\n    # used in the class definition of _CompoundModelMeta since\n    # _CompoundModelMeta has not been defined yet.\n\n    # Perform an arithmetic operation on two models.\n    return lambda left, right: _CompoundModelMeta._from_operator(oper,\n            left, right, **kwargs)"},{"col":4,"comment":"\n        Given a Python operator (represented by a string, such as ``'+'``\n        or ``'*'``, and two model classes or instances, return a new compound\n        model that evaluates the given operator on the outputs of the left and\n        right input models.\n\n        If either of the input models are a model *class* (i.e. a subclass of\n        `~astropy.modeling.Model`) then the returned model is a new subclass of\n        `~astropy.modeling.Model` that may be instantiated with any parameter\n        values.  If both input models are *instances* of a model, a new class\n        is still created, but this method returns an *instance* of that class,\n        taking the parameter values from the parameters of the input model\n        instances.\n\n        If given, the ``additional_members`` `dict` may provide additional\n        class members that should be added to the generated\n        `~astropy.modeling.Model` subclass.  Some members that are generated by\n        this method should not be provided by ``additional_members``.  These\n        include ``_tree``, ``inputs``, ``outputs``, ``linear``,\n        ``standard_broadcasting``, and ``__module__`.  This is currently for\n        internal use only.\n        ","endLoc":2420,"header":"@classmethod\n    def _from_operator(mcls, operator, left, right, additional_members={})","id":10757,"name":"_from_operator","nodeType":"Function","startLoc":2314,"text":"@classmethod\n    def _from_operator(mcls, operator, left, right, additional_members={}):\n        \"\"\"\n        Given a Python operator (represented by a string, such as ``'+'``\n        or ``'*'``, and two model classes or instances, return a new compound\n        model that evaluates the given operator on the outputs of the left and\n        right input models.\n\n        If either of the input models are a model *class* (i.e. a subclass of\n        `~astropy.modeling.Model`) then the returned model is a new subclass of\n        `~astropy.modeling.Model` that may be instantiated with any parameter\n        values.  If both input models are *instances* of a model, a new class\n        is still created, but this method returns an *instance* of that class,\n        taking the parameter values from the parameters of the input model\n        instances.\n\n        If given, the ``additional_members`` `dict` may provide additional\n        class members that should be added to the generated\n        `~astropy.modeling.Model` subclass.  Some members that are generated by\n        this method should not be provided by ``additional_members``.  These\n        include ``_tree``, ``inputs``, ``outputs``, ``linear``,\n        ``standard_broadcasting``, and ``__module__`.  This is currently for\n        internal use only.\n        \"\"\"\n        # Note, currently this only supports binary operators, but could be\n        # easily extended to support unary operators (namely '-') if/when\n        # needed\n        children = []\n        for child in (left, right):\n            if isinstance(child, (_CompoundModelMeta, _CompoundModel)):\n                \"\"\"\n                Although the original child models were copied we make another\n                copy here to ensure that changes in this child compound model\n                parameters will not propagate to the reuslt, that is\n                cm1 = Gaussian1D(1, 5, .1) + Gaussian1D()\n                cm2 = cm1 | Scale()\n                cm1.amplitude_0 = 100\n                assert(cm2.amplitude_0 == 1)\n                \"\"\"\n                children.append(copy.deepcopy(child._tree))\n            elif isinstance(child, Model):\n                children.append(ExpressionTree(child.copy()))\n            else:\n                children.append(ExpressionTree(child))\n\n        tree = ExpressionTree(operator, left=children[0], right=children[1])\n\n        name = str('CompoundModel{0}'.format(_CompoundModelMeta._nextid))\n        _CompoundModelMeta._nextid += 1\n\n        mod = find_current_module(3)\n        if mod:\n            modname = mod.__name__\n        else:\n            modname = '__main__'\n\n        inputs, outputs = mcls._check_inputs_and_outputs(operator, left, right)\n\n        if operator in ('|', '+', '-'):\n            linear = left.linear and right.linear\n        else:\n            # Which is not to say it is *definitely* not linear but it would be\n            # trickier to determine\n            linear = False\n\n        standard_broadcasting = \\\n                left.standard_broadcasting and right.standard_broadcasting\n\n        # Note: If any other members are added here, make sure to mention them\n        # in the docstring of this method.\n        members = additional_members\n        members.update({\n            '_tree': tree,\n            '_is_dynamic': True,  # See docs for _ModelMeta._is_dynamic\n            'inputs': inputs,\n            'outputs': outputs,\n            'linear': linear,\n            'standard_broadcasting': standard_broadcasting,\n            '__module__': str(modname)})\n\n        new_cls = mcls(name, (_CompoundModel,), members)\n\n        if isinstance(left, Model) and isinstance(right, Model):\n            # Both models used in the operator were already instantiated models,\n            # not model *classes*.  As such it's not particularly useful to return\n            # the class itself, but to instead produce a new instance:\n            instance = new_cls()\n\n            # Workaround for https://github.com/astropy/astropy/issues/3542\n            # TODO: Any effort to restructure the tree-like data structure for\n            # compound models should try to obviate this workaround--if\n            # intermediate compound models are stored in the tree as well then\n            # we can immediately check for custom inverses on sub-models when\n            # computing the inverse\n            instance._user_inverse = mcls._make_user_inverse(\n                    operator, left, right)\n\n            if left._n_models == right._n_models:\n                instance._n_models = left._n_models\n            else:\n                raise ValueError('Model sets must have the same number of '\n                                 'components.')\n\n            return instance\n\n        # Otherwise return the new uninstantiated class itself\n        return new_cls"},{"col":4,"comment":"null","endLoc":2456,"header":"@classmethod\n    def _check_inputs_and_outputs(mcls, operator, left, right)","id":10758,"name":"_check_inputs_and_outputs","nodeType":"Function","startLoc":2422,"text":"@classmethod\n    def _check_inputs_and_outputs(mcls, operator, left, right):\n        # TODO: These aren't the full rules for handling inputs and outputs, but\n        # this will handle most basic cases correctly\n        if operator == '|':\n            inputs = left.inputs\n            outputs = right.outputs\n\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        elif operator == '&':\n            inputs = combine_labels(left.inputs, right.inputs)\n            outputs = combine_labels(left.outputs, right.outputs)\n        else:\n            # Without loss of generality\n            inputs = left.inputs\n            outputs = left.outputs\n\n            if (left.n_inputs != right.n_inputs or\n                    left.n_outputs != right.n_outputs):\n                raise ModelDefinitionError(\n                    \"Unsupported operands for {0}: {1} (n_inputs={2}, \"\n                    \"n_outputs={3}) and {4} (n_inputs={5}, n_outputs={6}); \"\n                    \"models must have the same n_inputs and the same \"\n                    \"n_outputs for this operator\".format(\n                        operator, left.name, left.n_inputs, left.n_outputs,\n                        right.name, right.n_inputs, right.n_outputs))\n\n        return inputs, outputs"},{"col":4,"comment":"Two dimensional Sersic profile function.","endLoc":2456,"header":"@classmethod\n    def evaluate(cls, x, y, amplitude, r_eff, n, x_0, y_0, ellip, theta)","id":10759,"name":"evaluate","nodeType":"Function","startLoc":2438,"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            try:\n                from scipy.special import gammaincinv\n                cls._gammaincinv = gammaincinv\n            except ValueError:\n                raise ImportError('Sersic2D model requires scipy > 0.11.')\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))"},{"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":202,"header":"@property\n    def si(self)","id":10760,"name":"si","nodeType":"Function","startLoc":196,"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')"},{"col":4,"comment":"Evaluates the polynomial using Clenshaw's algorithm.","endLoc":422,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":10761,"name":"clenshaw","nodeType":"Function","startLoc":404,"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":352,"id":10762,"name":"inputs","nodeType":"Attribute","startLoc":352,"text":"inputs"},{"col":4,"comment":"\n        Generates an inverse `Model` for this `_CompoundModel` when either\n        model in the operation has a *custom inverse* that was manually\n        assigned by the user.\n\n        If either model has a custom inverse, and in particular if another\n        `_CompoundModel` has a custom inverse, then none of that model's\n        sub-models should be considered at all when computing the inverse.\n        So in that case we just compute the inverse ahead of time and set\n        it as the new compound model's custom inverse.\n\n        Note, this use case only applies when combining model instances,\n        since model classes don't currently have a notion of a \"custom\n        inverse\" (though it could probably be supported by overriding the\n        class's inverse property).\n\n        TODO: Consider fixing things so the aforementioned class-based case\n        works as well.  However, for the present purposes this is good enough.\n        ","endLoc":2498,"header":"@classmethod\n    def _make_user_inverse(mcls, operator, left, right)","id":10763,"name":"_make_user_inverse","nodeType":"Function","startLoc":2458,"text":"@classmethod\n    def _make_user_inverse(mcls, operator, left, right):\n        \"\"\"\n        Generates an inverse `Model` for this `_CompoundModel` when either\n        model in the operation has a *custom inverse* that was manually\n        assigned by the user.\n\n        If either model has a custom inverse, and in particular if another\n        `_CompoundModel` has a custom inverse, then none of that model's\n        sub-models should be considered at all when computing the inverse.\n        So in that case we just compute the inverse ahead of time and set\n        it as the new compound model's custom inverse.\n\n        Note, this use case only applies when combining model instances,\n        since model classes don't currently have a notion of a \"custom\n        inverse\" (though it could probably be supported by overriding the\n        class's inverse property).\n\n        TODO: Consider fixing things so the aforementioned class-based case\n        works as well.  However, for the present purposes this is good enough.\n        \"\"\"\n\n        if not (operator in ('&', '|') and\n                (left._user_inverse or right._user_inverse)):\n            # These are the only operators that support an inverse right now\n            return None\n\n        try:\n            left_inv = left.inverse\n            right_inv = right.inverse\n        except NotImplementedError:\n            # If either inverse is undefined then just return False; this\n            # means the normal _CompoundModel.inverse routine will fail\n            # naturally anyways, since it requires all sub-models to have\n            # an inverse defined\n            return None\n\n        if operator == '&':\n            return left_inv & right_inv\n        else:\n            return right_inv | left_inv"},{"col":11,"endLoc":75,"id":10764,"nodeType":"Lambda","startLoc":74,"text":"lambda left, right: _CompoundModelMeta._from_operator(oper,\n            left, right, **kwargs)"},{"col":4,"comment":"null","endLoc":2213,"header":"def __getattr__(cls, attr)","id":10765,"name":"__getattr__","nodeType":"Function","startLoc":2205,"text":"def __getattr__(cls, attr):\n        # Make sure the _tree attribute is set; otherwise we are not looking up\n        # an attribute on a concrete compound model class and should just raise\n        # the AttributeError\n        if cls._tree is not None and attr in cls.param_names:\n            cls._init_param_descriptors()\n            return getattr(cls, attr)\n\n        raise AttributeError(attr)"},{"attributeType":"null","col":4,"comment":"null","endLoc":353,"id":10766,"name":"outputs","nodeType":"Attribute","startLoc":353,"text":"outputs"},{"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":210,"header":"@property\n    def cgs(self)","id":10767,"name":"cgs","nodeType":"Function","startLoc":204,"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":354,"id":10768,"name":"_separable","nodeType":"Attribute","startLoc":354,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":358,"id":10769,"name":"domain","nodeType":"Attribute","startLoc":358,"text":"self.domain"},{"col":4,"comment":"null","endLoc":217,"header":"def __array_finalize__(self, obj)","id":10770,"name":"__array_finalize__","nodeType":"Function","startLoc":212,"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":82,"id":10771,"name":"_registry","nodeType":"Attribute","startLoc":82,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":83,"id":10772,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":83,"text":"_has_incompatible_units"},{"attributeType":"function","col":4,"comment":"null","endLoc":145,"id":10773,"name":"__deepcopy__","nodeType":"Attribute","startLoc":145,"text":"__deepcopy__"},{"col":4,"comment":"\n        This routine sets up the names for all the parameters on a compound\n        model, including figuring out unique names for those parameters and\n        also mapping them back to their associated parameters of the underlying\n        submodels.\n\n        Setting this all up is costly, and only necessary for compound models\n        that a user will directly interact with.  For example when building an\n        expression like::\n\n            >>> M = (Model1 + Model2) * Model3  # doctest: +SKIP\n\n        the user will generally never interact directly with the temporary\n        result of the subexpression ``(Model1 + Model2)``.  So there's no need\n        to setup all the parameters for that temporary throwaway.  Only once\n        the full expression is built and the user initializes or introspects\n        ``M`` is it necessary to determine its full parameterization.\n        ","endLoc":2560,"header":"def _init_param_descriptors(cls)","id":10774,"name":"_init_param_descriptors","nodeType":"Function","startLoc":2513,"text":"def _init_param_descriptors(cls):\n        \"\"\"\n        This routine sets up the names for all the parameters on a compound\n        model, including figuring out unique names for those parameters and\n        also mapping them back to their associated parameters of the underlying\n        submodels.\n\n        Setting this all up is costly, and only necessary for compound models\n        that a user will directly interact with.  For example when building an\n        expression like::\n\n            >>> M = (Model1 + Model2) * Model3  # doctest: +SKIP\n\n        the user will generally never interact directly with the temporary\n        result of the subexpression ``(Model1 + Model2)``.  So there's no need\n        to setup all the parameters for that temporary throwaway.  Only once\n        the full expression is built and the user initializes or introspects\n        ``M`` is it necessary to determine its full parameterization.\n        \"\"\"\n\n        # Accessing cls.param_names will implicitly call _init_param_names if\n        # needed and thus also set up the _param_map; I'm not crazy about that\n        # design but it stands for now\n        for param_name in cls.param_names:\n            submodel_idx, submodel_param = cls._param_map[param_name]\n            submodel = cls[submodel_idx]\n\n            orig_param = getattr(submodel, submodel_param, None)\n\n            if isinstance(submodel, Model):\n                # Take the parameter's default from the model's value for that\n                # parameter\n                default = orig_param.value\n            else:\n                default = orig_param.default\n\n            # Copy constraints\n            constraints = dict((key, getattr(orig_param, key))\n                               for key in Model.parameter_constraints)\n\n            # Note: Parameter.copy() returns a new unbound Parameter, never\n            # a bound Parameter even if submodel is a Model instance (as\n            # opposed to a Model subclass)\n            new_param = orig_param.copy(name=param_name, default=default,\n                                        unit=orig_param.unit,\n                                        **constraints)\n\n            setattr(cls, param_name, new_param)"},{"attributeType":"function","col":19,"comment":"null","endLoc":145,"id":10775,"name":"__copy__","nodeType":"Attribute","startLoc":145,"text":"__copy__"},{"attributeType":"null","col":12,"comment":"null","endLoc":88,"id":10776,"name":"reference","nodeType":"Attribute","startLoc":88,"text":"reference"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":10777,"name":"_uncertainty","nodeType":"Attribute","startLoc":113,"text":"inst._uncertainty"},{"attributeType":"null","col":8,"comment":"null","endLoc":114,"id":10778,"name":"_reference","nodeType":"Attribute","startLoc":114,"text":"inst._reference"},{"col":4,"comment":"null","endLoc":2464,"header":"@property\n    def input_units(self)","id":10779,"name":"input_units","nodeType":"Function","startLoc":2458,"text":"@property\n    def input_units(self):\n        if self.x_0.unit is None:\n            return None\n        else:\n            return {'x': self.x_0.unit,\n                    'y': self.y_0.unit}"},{"col":4,"comment":"null","endLoc":2476,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10780,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":2466,"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 OrderedDict([('x_0', inputs_unit['x']),\n                            ('y_0', inputs_unit['x']),\n                            ('r_eff', inputs_unit['x']),\n                            ('theta', u.rad),\n                            ('amplitude', outputs_unit['z'])])"},{"attributeType":"null","col":4,"comment":"null","endLoc":2429,"id":10781,"name":"amplitude","nodeType":"Attribute","startLoc":2429,"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    ","endLoc":539,"id":10782,"nodeType":"Class","startLoc":509,"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 = Parameter(default=0.0)\n    eta = Parameter(default=0.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_SlantOrthographic(self.xi.value, self.eta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, xi, eta):\n        return _projections.sins2x(phi, theta, xi, eta)"},{"col":4,"comment":"null","endLoc":535,"header":"@property\n    def inverse(self)","id":10783,"name":"inverse","nodeType":"Function","startLoc":533,"text":"@property\n    def inverse(self):\n        return Pix2Sky_SlantOrthographic(self.xi.value, self.eta.value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2430,"id":10784,"name":"r_eff","nodeType":"Attribute","startLoc":2430,"text":"r_eff"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":2304,"id":10785,"name":"alpha","nodeType":"Attribute","startLoc":2304,"text":"alpha"},{"attributeType":"null","col":8,"comment":"null","endLoc":112,"id":10786,"name":"_unit_string","nodeType":"Attribute","startLoc":112,"text":"inst._unit_string"},{"attributeType":"null","col":4,"comment":"null","endLoc":2431,"id":10787,"name":"n","nodeType":"Attribute","startLoc":2431,"text":"n"},{"attributeType":"null","col":8,"comment":"null","endLoc":359,"id":10788,"name":"window","nodeType":"Attribute","startLoc":359,"text":"self.window"},{"col":4,"comment":"null","endLoc":539,"header":"@classmethod\n    def evaluate(cls, phi, theta, xi, eta)","id":10789,"name":"evaluate","nodeType":"Function","startLoc":537,"text":"@classmethod\n    def evaluate(cls, phi, theta, xi, eta):\n        return _projections.sins2x(phi, theta, xi, eta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2432,"id":10790,"name":"x_0","nodeType":"Attribute","startLoc":2432,"text":"x_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":115,"id":10791,"name":"_system","nodeType":"Attribute","startLoc":115,"text":"inst._system"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":530,"id":10792,"name":"xi","nodeType":"Attribute","startLoc":530,"text":"xi"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":10793,"name":"_name","nodeType":"Attribute","startLoc":110,"text":"inst._name"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":10794,"name":"instances","nodeType":"Attribute","startLoc":92,"text":"instances"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":10795,"name":"inst","nodeType":"Attribute","startLoc":95,"text":"inst"},{"attributeType":"null","col":8,"comment":"null","endLoc":109,"id":10796,"name":"_abbrev","nodeType":"Attribute","startLoc":109,"text":"inst._abbrev"},{"attributeType":"null","col":4,"comment":"null","endLoc":2433,"id":10797,"name":"y_0","nodeType":"Attribute","startLoc":2433,"text":"y_0"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":10798,"name":"name_lower","nodeType":"Attribute","startLoc":91,"text":"name_lower"},{"attributeType":"null","col":8,"comment":"null","endLoc":111,"id":10799,"name":"_value","nodeType":"Attribute","startLoc":111,"text":"inst._value"},{"attributeType":"null","col":4,"comment":"null","endLoc":2434,"id":10800,"name":"ellip","nodeType":"Attribute","startLoc":2434,"text":"ellip"},{"col":4,"comment":"null","endLoc":2227,"header":"def __repr__(cls)","id":10801,"name":"__repr__","nodeType":"Function","startLoc":2215,"text":"def __repr__(cls):\n        if cls._tree is None:\n            # This case is mostly for debugging purposes\n            return cls._format_cls_repr()\n\n        expression = cls._format_expression()\n        components = cls._format_components()\n        keywords = [\n            ('Expression', expression),\n            ('Components', '\\n' + indent(components))\n        ]\n\n        return cls._format_cls_repr(keywords=keywords)"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":10802,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":10803,"name":"TWOPI","nodeType":"Attribute","startLoc":25,"text":"TWOPI"},{"attributeType":"null","col":8,"comment":"null","endLoc":117,"id":10804,"name":"_checked_units","nodeType":"Attribute","startLoc":117,"text":"inst._checked_units"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":10805,"name":"FLOAT_EPSILON","nodeType":"Attribute","startLoc":26,"text":"FLOAT_EPSILON"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":10806,"name":"_nm","nodeType":"Attribute","startLoc":15,"text":"_nm"},{"col":0,"comment":"","endLoc":3,"header":"functional_models.py#<anonymous>","id":10807,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"Mathematical models.\"\"\"\n\n__all__ = ['AiryDisk2D', 'Moffat1D', 'Moffat2D', 'Box1D', 'Box2D', 'Const1D',\n           'Const2D', 'Ellipse2D', 'Disk2D', 'Gaussian1D',\n           'Gaussian2D', 'Linear1D', 'Lorentz1D',\n           'MexicanHat1D', 'MexicanHat2D', 'RedshiftScaleFactor',\n           'Scale', 'Sersic1D', 'Sersic2D', 'Shift', 'Sine1D', 'Trapezoid1D',\n           'TrapezoidDisk2D', 'Ring2D', 'Voigt1D']\n\nTWOPI = 2 * np.pi\n\nFLOAT_EPSILON = float(np.finfo(np.float32).tiny)"},{"attributeType":"null","col":4,"comment":"null","endLoc":2435,"id":10808,"name":"theta","nodeType":"Attribute","startLoc":2435,"text":"theta"},{"attributeType":"null","col":9,"comment":"null","endLoc":15,"id":10809,"name":"_c","nodeType":"Attribute","startLoc":15,"text":"_c"},{"col":0,"comment":"","endLoc":6,"header":"astropyconst13.py#<anonymous>","id":10810,"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\nfor _nm, _c in itertools.chain(sorted(vars(codata2010).items()),\n                               sorted(vars(iau2012).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()):\n        locals()[_c.abbrev] = _c"},{"fileName":"si.py","filePath":"astropy/constants","id":10811,"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\n\n\nimport itertools\n\nfrom .constant import Constant\nfrom . import codata2014, iau2015\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).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":"null","endLoc":2619,"header":"def _format_expression(cls)","id":10812,"name":"_format_expression","nodeType":"Function","startLoc":2616,"text":"def _format_expression(cls):\n        # TODO: At some point might be useful to make a public version of this,\n        # albeit with more formatting options\n        return cls._tree.format_expression(OPERATOR_PRECEDENCE)"},{"fileName":"codata2014.py","filePath":"astropy/constants","id":10813,"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\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', 00.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"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":10814,"name":"_nm","nodeType":"Attribute","startLoc":14,"text":"_nm"},{"col":4,"comment":"null","endLoc":2623,"header":"def _format_components(cls)","id":10815,"name":"_format_components","nodeType":"Function","startLoc":2621,"text":"def _format_components(cls):\n        return '\\n\\n'.join('[{0}]: {1!r}'.format(idx, m)\n                                 for idx, m in enumerate(cls._get_submodels()))"},{"attributeType":"null","col":9,"comment":"null","endLoc":14,"id":10816,"name":"_c","nodeType":"Attribute","startLoc":14,"text":"_c"},{"col":0,"comment":"","endLoc":5,"header":"si.py#<anonymous>","id":10817,"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(codata2014).items()),\n                               sorted(vars(iau2015).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()\n         and _c.system == 'si'):\n        locals()[_c.abbrev] = _c"},{"className":"EMConstant","col":0,"comment":"An electromagnetic constant.","endLoc":233,"id":10818,"nodeType":"Class","startLoc":220,"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":233,"header":"@property\n    def cgs(self)","id":10819,"name":"cgs","nodeType":"Function","startLoc":223,"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":"CODATA2014","col":0,"comment":"null","endLoc":17,"id":10820,"nodeType":"Class","startLoc":14,"text":"class CODATA2014(Constant):\n    default_reference = 'CODATA 2014'\n    _registry = {}\n    _has_incompatible_units = set()"},{"attributeType":"null","col":4,"comment":"null","endLoc":2436,"id":10821,"name":"_gammaincinv","nodeType":"Attribute","startLoc":2436,"text":"_gammaincinv"},{"attributeType":"null","col":16,"comment":"null","endLoc":2445,"id":10822,"name":"_gammaincinv","nodeType":"Attribute","startLoc":2445,"text":"cls._gammaincinv"},{"col":4,"comment":"\n        Returns a list of attributes defined on a compound model, including\n        all of its parameters.\n        ","endLoc":2243,"header":"def __dir__(cls)","id":10823,"name":"__dir__","nodeType":"Function","startLoc":2229,"text":"def __dir__(cls):\n        \"\"\"\n        Returns a list of attributes defined on a compound model, including\n        all of its parameters.\n        \"\"\"\n\n        basedir = super().__dir__()\n\n        if cls._tree is not None:\n            for name in cls.param_names:\n                basedir.append(name)\n\n            basedir.sort()\n\n        return basedir"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":10824,"name":"default_reference","nodeType":"Attribute","startLoc":15,"text":"default_reference"},{"fileName":"cgs.py","filePath":"astropy/constants","id":10825,"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\"\"\"\n\nimport itertools\n\nfrom .constant import Constant\nfrom . import codata2014, iau2015\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).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"},{"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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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":855,"id":10826,"nodeType":"Class","startLoc":762,"text":"class Polynomial1D(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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    inputs = ('x',)\n    outputs = ('y',)\n    _separable = True\n\n    def __init__(self, degree, domain=[-1, 1], window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), format_info\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 : throw away parameter\n            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 {'x': 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, 'c{0}'.format(i))\n            mapping.append((par.name, outputs_unit['y'] / inputs_unit['x'] ** i))\n        return OrderedDict(mapping)"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":10827,"name":"_registry","nodeType":"Attribute","startLoc":16,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":10828,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":17,"text":"_has_incompatible_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":12,"id":10829,"name":"_nm","nodeType":"Attribute","startLoc":12,"text":"_nm"},{"col":4,"comment":"null","endLoc":2253,"header":"def __reduce__(cls)","id":10830,"name":"__reduce__","nodeType":"Function","startLoc":2245,"text":"def __reduce__(cls):\n        rv = super().__reduce__()\n\n        if isinstance(rv, tuple):\n            # Delete _evaluate from the members dict\n            with suppress(KeyError):\n                del rv[1][2]['_evaluate']\n\n        return rv"},{"className":"EMCODATA2014","col":0,"comment":"null","endLoc":21,"id":10831,"nodeType":"Class","startLoc":20,"text":"class EMCODATA2014(CODATA2014, EMConstant):\n    _registry = CODATA2014._registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":21,"id":10832,"name":"_registry","nodeType":"Attribute","startLoc":21,"text":"_registry"},{"col":4,"comment":"null","endLoc":801,"header":"def prepare_inputs(self, x, **kwargs)","id":10833,"name":"prepare_inputs","nodeType":"Function","startLoc":797,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = super().prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n        return (x,), format_info"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":531,"id":10834,"name":"eta","nodeType":"Attribute","startLoc":531,"text":"eta"},{"attributeType":"null","col":9,"comment":"null","endLoc":12,"id":10835,"name":"_c","nodeType":"Attribute","startLoc":12,"text":"_c"},{"col":0,"comment":"","endLoc":5,"header":"cgs.py#<anonymous>","id":10836,"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(codata2014).items()),\n                               sorted(vars(iau2015).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"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":10837,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":24,"id":10838,"name":"h","nodeType":"Attribute","startLoc":24,"text":"h"},{"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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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":529,"id":10839,"nodeType":"Class","startLoc":425,"text":"class Hermite1D(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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 = ('x')\n    outputs = ('y')\n    _separable = True\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            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 : throw away parameter\n            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, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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":469,"header":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":10840,"name":"__init__","nodeType":"Function","startLoc":463,"text":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"fileName":"__init__.py","filePath":"astropy/constants","id":10841,"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\"\"\"\n\nimport itertools\n\n# Hack to make circular imports with units work\ntry:\n    from .. import units\n    del units\nexcept ImportError:\n    pass\n\nfrom .constant import Constant, EMConstant\nfrom . import si\nfrom . import cgs\nfrom . import codata2014, iau2015\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\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).items())):\n    if isinstance(_c, Constant) and _c.abbrev not in locals():\n        locals()[_c.abbrev] = _c.__class__(_c.abbrev, _c.name, _c.value,\n                                           _c._unit_string, _c.uncertainty,\n                                           _c.reference)\n\n        _lines.append('{0:^10} {1:^14.9g} {2:^16} {3}'.format(\n            _c.abbrev, _c.value, _c._unit_string, _c.name))\n\n_lines.append(_lines[1])\n\nif __doc__ is not None:\n    __doc__ += '\\n'.join(_lines)\n\ndel _lines, _nm, _c\n"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":496,"header":"def fit_deriv(self, x, *params)","id":10842,"name":"fit_deriv","nodeType":"Function","startLoc":471,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            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":"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":562,"id":10843,"nodeType":"Class","startLoc":545,"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    \"\"\"\n    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalEquidistant()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.arcx2s(x, y)"},{"col":4,"comment":"null","endLoc":806,"header":"def evaluate(self, x, *coeffs)","id":10844,"name":"evaluate","nodeType":"Function","startLoc":803,"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)"},{"col":4,"comment":"null","endLoc":558,"header":"@property\n    def inverse(self)","id":10845,"name":"inverse","nodeType":"Function","startLoc":556,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ZenithalEquidistant()"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":10846,"name":"_lines","nodeType":"Attribute","startLoc":32,"text":"_lines"},{"attributeType":"null","col":4,"comment":"null","endLoc":39,"id":10847,"name":"_nm","nodeType":"Attribute","startLoc":39,"text":"_nm"},{"col":4,"comment":"null","endLoc":2273,"header":"@property\n    def submodel_names(cls)","id":10848,"name":"submodel_names","nodeType":"Function","startLoc":2255,"text":"@property\n    def submodel_names(cls):\n        if cls._submodel_names is None:\n            seen = {}\n            names = []\n            for idx, submodel in enumerate(cls._get_submodels()):\n                name = str(submodel.name)\n                if name in seen:\n                    names.append('{0}_{1}'.format(name, idx))\n                    if seen[name] >= 0:\n                        jdx = seen[name]\n                        names[jdx] = '{0}_{1}'.format(names[jdx], jdx)\n                        seen[name] = -1\n                else:\n                    names.append(name)\n                    seen[name] = idx\n            cls._submodel_names = tuple(names)\n\n        return cls._submodel_names"},{"col":4,"comment":"null","endLoc":2280,"header":"@property\n    def param_names(cls)","id":10849,"name":"param_names","nodeType":"Function","startLoc":2275,"text":"@property\n    def param_names(cls):\n        if cls._param_names is None:\n            cls._init_param_names()\n\n        return cls._param_names"},{"attributeType":"null","col":9,"comment":"null","endLoc":39,"id":10850,"name":"_c","nodeType":"Attribute","startLoc":39,"text":"_c"},{"col":0,"comment":"","endLoc":15,"header":"__init__.py#<anonymous>","id":10851,"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\ntry:\n    from .. import units\n    del units\nexcept ImportError:\n    pass\n\n_lines = [\n    'The following constants are available:\\n',\n    '========== ============== ================ =========================',\n    '   Name        Value            Unit       Description',\n    '========== ============== ================ =========================',\n]\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).items())):\n    if isinstance(_c, Constant) and _c.abbrev not in locals():\n        locals()[_c.abbrev] = _c.__class__(_c.abbrev, _c.name, _c.value,\n                                           _c._unit_string, _c.uncertainty,\n                                           _c.reference)\n\n        _lines.append('{0:^10} {1:^14.9g} {2:^16} {3}'.format(\n            _c.abbrev, _c.value, _c._unit_string, _c.name))\n\n_lines.append(_lines[1])\n\nif __doc__ is not None:\n    __doc__ += '\\n'.join(_lines)\n\ndel _lines, _nm, _c"},{"col":4,"comment":"null","endLoc":504,"header":"def prepare_inputs(self, x, **kwargs)","id":10852,"name":"prepare_inputs","nodeType":"Function","startLoc":498,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info"},{"col":4,"comment":"\n        This subroutine is solely for setting up the ``param_names`` attribute\n        itself.\n\n        See ``_init_param_descriptors`` for the full parameter setup.\n        ","endLoc":2614,"header":"def _init_param_names(cls)","id":10853,"name":"_init_param_names","nodeType":"Function","startLoc":2562,"text":"def _init_param_names(cls):\n        \"\"\"\n        This subroutine is solely for setting up the ``param_names`` attribute\n        itself.\n\n        See ``_init_param_descriptors`` for the full parameter setup.\n        \"\"\"\n\n        # Currently this skips over Model *instances* in the expression tree;\n        # basically these are treated as constants and do not add\n        # fittable/tunable parameters to the compound model.\n        # TODO: I'm not 100% happy with this design, and maybe we need some\n        # interface for distinguishing fittable/settable parameters with\n        # *constant* parameters (which would be distinct from parameters with\n        # fixed constraints since they're permanently locked in place). But I'm\n        # not sure if this is really the best way to treat the issue.\n\n        names = []\n        param_map = {}\n\n        # Start counting the suffix indices to put on parameter names from the\n        # slice_offset.  Usually this will just be zero, but for compound\n        # models that were sliced from another compound model this may be > 0\n        param_suffix = cls._slice_offset\n\n        for idx, model in enumerate(cls._get_submodels()):\n            if not model.param_names:\n                # Skip models that don't have parameters in the numbering\n                # TODO: Reevaluate this if it turns out to be confusing, though\n                # parameter-less models are not very common in practice (there\n                # are a few projections that don't take parameters)\n                continue\n\n            for param_name in model.param_names:\n                # This is sort of heuristic, but we want to check that\n                # model.param_name *actually* returns a Parameter descriptor,\n                # and that the model isn't some inconsistent type that happens\n                # to have a param_names attribute but does not actually\n                # implement settable parameters.\n                # In the future we can probably remove this check, but this is\n                # here specifically to support the legacy compat\n                # _CompositeModel which can be considered a pathological case\n                # in the context of the new framework\n                # if not isinstance(getattr(model, param_name, None),\n                #                  Parameter):\n                #    break\n                name = '{0}_{1}'.format(param_name, param_suffix + idx)\n                names.append(name)\n                param_map[name] = (idx, param_name)\n\n        cls._param_names = tuple(names)\n        cls._param_map = param_map\n        cls._param_map_inverse = dict((v, k) for k, v in param_map.items())"},{"col":4,"comment":"null","endLoc":509,"header":"def evaluate(self, x, *coeffs)","id":10854,"name":"evaluate","nodeType":"Function","startLoc":506,"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":"null","endLoc":562,"header":"@classmethod\n    def evaluate(cls, x, y)","id":10855,"name":"evaluate","nodeType":"Function","startLoc":560,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.arcx2s(x, y)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":27,"id":10856,"name":"hbar","nodeType":"Attribute","startLoc":27,"text":"hbar"},{"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":585,"id":10857,"nodeType":"Class","startLoc":568,"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    \"\"\"\n    @property\n    def inverse(self):\n        return Pix2Sky_ZenithalEquidistant()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.arcs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":581,"header":"@property\n    def inverse(self)","id":10858,"name":"inverse","nodeType":"Function","startLoc":579,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ZenithalEquidistant()"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":30,"id":10859,"name":"k_B","nodeType":"Attribute","startLoc":30,"text":"k_B"},{"col":4,"comment":"null","endLoc":841,"header":"@staticmethod\n    def horner(x, coeffs)","id":10860,"name":"horner","nodeType":"Function","startLoc":833,"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"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":831,"header":"def fit_deriv(self, x, *params)","id":10861,"name":"fit_deriv","nodeType":"Function","startLoc":808,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            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":848,"header":"@property\n    def input_units(self)","id":10862,"name":"input_units","nodeType":"Function","startLoc":843,"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 {'x': self.c0.unit / self.c1.unit}"},{"col":4,"comment":"null","endLoc":855,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10863,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":850,"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, 'c{0}'.format(i))\n            mapping.append((par.name, outputs_unit['y'] / inputs_unit['x'] ** i))\n        return OrderedDict(mapping)"},{"attributeType":"null","col":4,"comment":"null","endLoc":785,"id":10864,"name":"inputs","nodeType":"Attribute","startLoc":785,"text":"inputs"},{"col":4,"comment":"null","endLoc":585,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":10865,"name":"evaluate","nodeType":"Function","startLoc":583,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.arcs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":2287,"header":"@property\n    def fittable(cls)","id":10866,"name":"fittable","nodeType":"Function","startLoc":2282,"text":"@property\n    def fittable(cls):\n        if cls._fittable is None:\n            cls._fittable = all(m.fittable for m in cls._get_submodels())\n\n        return cls._fittable"},{"attributeType":"null","col":4,"comment":"null","endLoc":786,"id":10867,"name":"outputs","nodeType":"Attribute","startLoc":786,"text":"outputs"},{"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":608,"id":10868,"nodeType":"Class","startLoc":591,"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    \"\"\"\n    @property\n    def inverse(self):\n        return Sky2Pix_ZenithalEqualArea()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.zeax2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":787,"id":10869,"name":"_separable","nodeType":"Attribute","startLoc":787,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":791,"id":10870,"name":"domain","nodeType":"Attribute","startLoc":791,"text":"self.domain"},{"col":4,"comment":"null","endLoc":604,"header":"@property\n    def inverse(self)","id":10871,"name":"inverse","nodeType":"Function","startLoc":602,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ZenithalEqualArea()"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":33,"id":10872,"name":"c","nodeType":"Attribute","startLoc":33,"text":"c"},{"col":4,"comment":"null","endLoc":2304,"header":"def evaluate(cls, *args)","id":10873,"name":"evaluate","nodeType":"Function","startLoc":2293,"text":"def evaluate(cls, *args):\n        if cls._evaluate is None:\n            func = cls._tree.evaluate(BINARY_OPERATORS,\n                                      getter=cls._model_evaluate_getter)[0]\n            cls._evaluate = func\n        inputs = args[:cls.n_inputs]\n        params = iter(args[cls.n_inputs:])\n        result = cls._evaluate(inputs, params)\n        if cls.n_outputs == 1:\n            return result[0]\n        else:\n            return result"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":37,"id":10874,"name":"G","nodeType":"Attribute","startLoc":37,"text":"G"},{"col":4,"comment":"null","endLoc":2747,"header":"@staticmethod\n    def _model_evaluate_getter(idx, model)","id":10875,"name":"_model_evaluate_getter","nodeType":"Function","startLoc":2715,"text":"@staticmethod\n    def _model_evaluate_getter(idx, model):\n        n_params = len(model.param_names)\n        n_inputs = model.n_inputs\n        n_outputs = model.n_outputs\n\n        # There is currently an unfortunate inconsistency in some models, which\n        # requires them to be instantiated for their evaluate to work.  I think\n        # that needs to be reconsidered and fixed somehow, but in the meantime\n        # we need to check for that case\n        if (not isinstance(model, Model) and\n                isinstancemethod(model, model.evaluate)):\n            if n_outputs == 1:\n                # Where previously model was a class, now make an instance\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return (model(*param_values).evaluate(\n                        *chain(inputs, param_values)),)\n            else:\n                def f(inputs, params):\n                    param_values = tuple(islice(params, n_params))\n                    return model(*param_values).evaluate(\n                        *chain(inputs, param_values))\n        else:\n            evaluate = model.evaluate\n            if n_outputs == 1:\n                f = lambda inputs, params: \\\n                    (evaluate(*chain(inputs, islice(params, n_params))),)\n            else:\n                f = lambda inputs, params: \\\n                    evaluate(*chain(inputs, islice(params, n_params)))\n\n        return (f, n_inputs, n_outputs)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":40,"id":10876,"name":"g0","nodeType":"Attribute","startLoc":40,"text":"g0"},{"col":4,"comment":"null","endLoc":608,"header":"@classmethod\n    def evaluate(cls, x, y)","id":10877,"name":"evaluate","nodeType":"Function","startLoc":606,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.zeax2s(x, y)"},{"col":4,"comment":"null","endLoc":529,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":10878,"name":"clenshaw","nodeType":"Function","startLoc":511,"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":8,"comment":"null","endLoc":792,"id":10879,"name":"window","nodeType":"Attribute","startLoc":792,"text":"self.window"},{"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":632,"id":10880,"nodeType":"Class","startLoc":614,"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    \"\"\"\n    @property\n    def inverse(self):\n        return Pix2Sky_ZenithalEqualArea()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.zeas2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":459,"id":10881,"name":"inputs","nodeType":"Attribute","startLoc":459,"text":"inputs"},{"col":4,"comment":"null","endLoc":628,"header":"@property\n    def inverse(self)","id":10882,"name":"inverse","nodeType":"Function","startLoc":626,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ZenithalEqualArea()"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":43,"id":10883,"name":"m_p","nodeType":"Attribute","startLoc":43,"text":"m_p"},{"fileName":"constant.py","filePath":"astropy/constants","id":10884,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport functools\nimport types\nimport warnings\nimport numpy as np\n\nfrom ..units.core import Unit, UnitsError\nfrom ..units.quantity import Quantity\nfrom ..utils import lazyproperty\nfrom ..utils.exceptions import AstropyUserWarning\nfrom ..utils.misc import InheritDocstrings\n\n__all__ = ['Constant', 'EMConstant']\n\n\nclass ConstantMeta(InheritDocstrings):\n    \"\"\"Metaclass for the :class:`Constant`. The primary purpose of this is to\n    wrap the double-underscore methods of :class:`Quantity` which is the\n    superclass of :class:`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 {0!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. {1}.{2})'.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        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(\"{} requires a reference.\".format(cls))\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 {0!r} already has a definition in the '\n                              '{1!r} system from {2!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 ('<{0} name={1!r} value={2} uncertainty={3} unit={4!r} '\n                'reference={5!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   = {0}\\n'\n                '  Value  = {1}\\n'\n                '  Uncertainty  = {2}\\n'\n                '  Unit  = {3}\\n'\n                '  Reference = {4}'.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 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"},{"attributeType":"null","col":4,"comment":"null","endLoc":460,"id":10885,"name":"outputs","nodeType":"Attribute","startLoc":460,"text":"outputs"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":46,"id":10886,"name":"m_n","nodeType":"Attribute","startLoc":46,"text":"m_n"},{"className":"ConstantMeta","col":0,"comment":"Metaclass for the :class:`Constant`. The primary purpose of this is to\n    wrap the double-underscore methods of :class:`Quantity` which is the\n    superclass of :class:`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":73,"id":10887,"nodeType":"Class","startLoc":17,"text":"class ConstantMeta(InheritDocstrings):\n    \"\"\"Metaclass for the :class:`Constant`. The primary purpose of this is to\n    wrap the double-underscore methods of :class:`Quantity` which is the\n    superclass of :class:`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 {0!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. {1}.{2})'.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        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":4,"comment":"null","endLoc":73,"header":"def __new__(mcls, name, bases, d)","id":10888,"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 {0!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. {1}.{2})'.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        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":"null","col":4,"comment":"null","endLoc":461,"id":10889,"name":"_separable","nodeType":"Attribute","startLoc":461,"text":"_separable"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":49,"id":10890,"name":"m_e","nodeType":"Attribute","startLoc":49,"text":"m_e"},{"col":4,"comment":"null","endLoc":632,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":10891,"name":"evaluate","nodeType":"Function","startLoc":630,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.zeas2x(phi, theta)"},{"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":660,"id":10892,"nodeType":"Class","startLoc":638,"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 = Parameter(default=90.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Airy(self.theta_b.value)\n\n    @classmethod\n    def evaluate(cls, x, y, theta_b):\n        return _projections.airx2s(x, y, theta_b)"},{"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    Parameters\n    ----------\n    degree : int\n        highest power of the polynomial,\n        the number of terms is degree+1\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    ","endLoc":1023,"id":10893,"nodeType":"Class","startLoc":858,"text":"class Polynomial2D(PolynomialModel):\n    \"\"\"\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    Parameters\n    ----------\n    degree : int\n        highest power of the polynomial,\n        the number of terms is degree+1\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\n    **params : dict\n        keyword: value pairs, representing parameter_name: value\n    \"\"\"\n\n    inputs = ('x', 'y')\n    outputs = ('z',)\n    _separable = False\n\n    def __init__(self, degree, x_domain=[-1, 1], y_domain=[-1, 1],\n                 x_window=[-1, 1], y_window=[-1, 1], 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        self.x_domain = x_domain\n        self.y_domain = y_domain\n        self.x_window = x_window\n        self.y_window = y_window\n\n    def prepare_inputs(self, x, y, **kwargs):\n        inputs, format_info = 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        return (x, y), format_info\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 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 : throw away parameter\n            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 = 'c{0}_{1}'.format(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 of 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        else:\n            return {'x': self.c0_0.unit / self.c1_0.unit,\n                    'y': 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, 'c{0}_{1}'.format(i, j))\n                mapping.append((par.name, outputs_unit['z'] / inputs_unit['x'] ** i / inputs_unit['y'] ** j))\n        return OrderedDict(mapping)"},{"col":4,"comment":"null","endLoc":656,"header":"@property\n    def inverse(self)","id":10894,"name":"inverse","nodeType":"Function","startLoc":654,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Airy(self.theta_b.value)"},{"attributeType":"null","col":8,"comment":"null","endLoc":465,"id":10895,"name":"domain","nodeType":"Attribute","startLoc":465,"text":"self.domain"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":52,"id":10896,"name":"u","nodeType":"Attribute","startLoc":52,"text":"u"},{"col":4,"comment":"null","endLoc":908,"header":"def prepare_inputs(self, x, y, **kwargs)","id":10897,"name":"prepare_inputs","nodeType":"Function","startLoc":901,"text":"def prepare_inputs(self, x, y, **kwargs):\n        inputs, format_info = 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        return (x, y), format_info"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":55,"id":10898,"name":"sigma_sb","nodeType":"Attribute","startLoc":55,"text":"sigma_sb"},{"col":4,"comment":"null","endLoc":660,"header":"@classmethod\n    def evaluate(cls, x, y, theta_b)","id":10899,"name":"evaluate","nodeType":"Function","startLoc":658,"text":"@classmethod\n    def evaluate(cls, x, y, theta_b):\n        return _projections.airx2s(x, y, theta_b)"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":58,"id":10900,"name":"e","nodeType":"Attribute","startLoc":58,"text":"e"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":652,"id":10901,"name":"theta_b","nodeType":"Attribute","startLoc":652,"text":"theta_b"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":61,"id":10902,"name":"eps0","nodeType":"Attribute","startLoc":61,"text":"eps0"},{"col":4,"comment":"null","endLoc":928,"header":"def evaluate(self, x, y, *coeffs)","id":10903,"name":"evaluate","nodeType":"Function","startLoc":910,"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"},{"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    ","endLoc":697,"id":10904,"nodeType":"Class","startLoc":666,"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    theta_b = Parameter(default=90.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Airy(self.theta_b.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, theta_b):\n        return _projections.airs2x(phi, theta, theta_b)"},{"attributeType":"null","col":8,"comment":"null","endLoc":466,"id":10905,"name":"window","nodeType":"Attribute","startLoc":466,"text":"self.window"},{"col":4,"comment":"null","endLoc":693,"header":"@property\n    def inverse(self)","id":10906,"name":"inverse","nodeType":"Function","startLoc":691,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Airy(self.theta_b.value)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":64,"id":10907,"name":"N_A","nodeType":"Attribute","startLoc":64,"text":"N_A"},{"col":4,"comment":"null","endLoc":980,"header":"def invlex_coeff(self, coeffs)","id":10908,"name":"invlex_coeff","nodeType":"Function","startLoc":971,"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 = 'c{0}_{1}'.format(j, i)\n                    coeff = coeffs[self.param_names.index(name)]\n                    invlex_coeffs.append(coeff)\n        return invlex_coeffs[::-1]"},{"col":20,"endLoc":2742,"id":10909,"nodeType":"Lambda","startLoc":2741,"text":"lambda inputs, params: \\\n                    (evaluate(*chain(inputs, islice(params, n_params))),)"},{"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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":653,"id":10910,"nodeType":"Class","startLoc":532,"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 : throw away parameter\n            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":578,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":10911,"name":"__init__","nodeType":"Function","startLoc":572,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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":"CODATA2014","col":0,"comment":"null","endLoc":67,"id":10913,"name":"R","nodeType":"Attribute","startLoc":67,"text":"R"},{"col":20,"endLoc":2745,"id":10914,"nodeType":"Lambda","startLoc":2744,"text":"lambda inputs, params: \\\n                    evaluate(*chain(inputs, islice(params, n_params)))"},{"attributeType":"None","col":4,"comment":"null","endLoc":2169,"id":10915,"name":"_tree","nodeType":"Attribute","startLoc":2169,"text":"_tree"},{"attributeType":"None","col":4,"comment":"null","endLoc":2170,"id":10916,"name":"_submodels","nodeType":"Attribute","startLoc":2170,"text":"_submodels"},{"attributeType":"None","col":4,"comment":"null","endLoc":2171,"id":10917,"name":"_submodel_names","nodeType":"Attribute","startLoc":2171,"text":"_submodel_names"},{"attributeType":"null","col":4,"comment":"null","endLoc":2172,"id":10918,"name":"_nextid","nodeType":"Attribute","startLoc":2172,"text":"_nextid"},{"attributeType":"None","col":4,"comment":"null","endLoc":2174,"id":10919,"name":"_param_names","nodeType":"Attribute","startLoc":2174,"text":"_param_names"},{"attributeType":"null","col":16,"comment":"null","endLoc":38,"id":10920,"name":"instances","nodeType":"Attribute","startLoc":38,"text":"instances"},{"attributeType":"null","col":20,"comment":"null","endLoc":49,"id":10921,"name":"systems","nodeType":"Attribute","startLoc":49,"text":"systems"},{"attributeType":"None","col":4,"comment":"null","endLoc":2183,"id":10922,"name":"_param_map","nodeType":"Attribute","startLoc":2183,"text":"_param_map"},{"attributeType":"null","col":4,"comment":"null","endLoc":2185,"id":10923,"name":"_slice_offset","nodeType":"Attribute","startLoc":2185,"text":"_slice_offset"},{"attributeType":"None","col":4,"comment":"null","endLoc":2192,"id":10924,"name":"_param_map_inverse","nodeType":"Attribute","startLoc":2192,"text":"_param_map_inverse"},{"attributeType":"None","col":4,"comment":"null","endLoc":2193,"id":10925,"name":"_fittable","nodeType":"Attribute","startLoc":2193,"text":"_fittable"},{"attributeType":"null","col":16,"comment":"null","endLoc":37,"id":10926,"name":"name_lower","nodeType":"Attribute","startLoc":37,"text":"name_lower"},{"attributeType":"None","col":4,"comment":"null","endLoc":2195,"id":10927,"name":"_evaluate","nodeType":"Attribute","startLoc":2195,"text":"_evaluate"},{"attributeType":"null","col":12,"comment":"null","endLoc":2285,"id":10928,"name":"_fittable","nodeType":"Attribute","startLoc":2285,"text":"cls._fittable"},{"attributeType":"null","col":8,"comment":"null","endLoc":63,"id":10929,"name":"exclude","nodeType":"Attribute","startLoc":63,"text":"exclude"},{"attributeType":"null","col":12,"comment":"null","endLoc":2297,"id":10930,"name":"_evaluate","nodeType":"Attribute","startLoc":2297,"text":"cls._evaluate"},{"attributeType":"null","col":12,"comment":"null","endLoc":2271,"id":10931,"name":"_submodel_names","nodeType":"Attribute","startLoc":2271,"text":"cls._submodel_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":2613,"id":10932,"name":"_param_map","nodeType":"Attribute","startLoc":2613,"text":"cls._param_map"},{"attributeType":"null","col":20,"comment":"null","endLoc":45,"id":10933,"name":"_checked_units","nodeType":"Attribute","startLoc":45,"text":"self._checked_units"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":10934,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"constant.py#<anonymous>","id":10935,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Constant', 'EMConstant']"},{"attributeType":"null","col":8,"comment":"null","endLoc":2614,"id":10936,"name":"_param_map_inverse","nodeType":"Attribute","startLoc":2614,"text":"cls._param_map_inverse"},{"col":4,"comment":"null","endLoc":697,"header":"@classmethod\n    def evaluate(cls, phi, theta, theta_b)","id":10937,"name":"evaluate","nodeType":"Function","startLoc":695,"text":"@classmethod\n    def evaluate(cls, phi, theta, theta_b):\n        return _projections.airs2x(phi, theta, theta_b)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2510,"id":10938,"name":"_submodels","nodeType":"Attribute","startLoc":2510,"text":"cls._submodels"},{"attributeType":"null","col":8,"comment":"null","endLoc":2612,"id":10939,"name":"_param_names","nodeType":"Attribute","startLoc":2612,"text":"cls._param_names"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":689,"id":10940,"name":"theta_b","nodeType":"Attribute","startLoc":689,"text":"theta_b"},{"col":0,"comment":"null","endLoc":2122,"header":"def _make_arithmetic_operator(oper)","id":10941,"name":"_make_arithmetic_operator","nodeType":"Function","startLoc":2112,"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"},{"fileName":"iau2012.py","filePath":"astropy/constants","id":10942,"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\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"},{"col":0,"comment":"null","endLoc":2133,"header":"def _composition_operator(f, g)","id":10943,"name":"_composition_operator","nodeType":"Function","startLoc":2125,"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])"},{"className":"IAU2012","col":0,"comment":"null","endLoc":17,"id":10944,"nodeType":"Class","startLoc":14,"text":"class IAU2012(Constant):\n    default_reference = 'IAU 2012'\n    _registry = {}\n    _has_incompatible_units = set()"},{"col":12,"endLoc":2132,"id":10945,"nodeType":"Lambda","startLoc":2132,"text":"lambda inputs, params: g[0](f[0](inputs, params), params)"},{"col":0,"comment":"null","endLoc":2145,"header":"def _join_operator(f, g)","id":10946,"name":"_join_operator","nodeType":"Function","startLoc":2136,"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":"null","col":4,"comment":"null","endLoc":15,"id":10947,"name":"default_reference","nodeType":"Attribute","startLoc":15,"text":"default_reference"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":70,"id":10948,"name":"Ryd","nodeType":"Attribute","startLoc":70,"text":"Ryd"},{"col":12,"endLoc":2144,"id":10949,"nodeType":"Lambda","startLoc":2143,"text":"lambda inputs, params: (f[0](inputs[:f[1]], params) +\n                                    g[0](inputs[f[1]:], params))"},{"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 ``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:`bounding-boxes`\n    ","endLoc":3112,"header":"def render_model(model, arr=None, coords=None)","id":10950,"name":"render_model","nodeType":"Function","startLoc":3021,"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 ``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:`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, 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) 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"},{"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":709,"id":10951,"nodeType":"Class","startLoc":703,"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":709,"id":10952,"name":"_separable","nodeType":"Attribute","startLoc":709,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":10953,"name":"_registry","nodeType":"Attribute","startLoc":16,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":10954,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":17,"text":"_has_incompatible_units"},{"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    ","endLoc":758,"id":10955,"nodeType":"Class","startLoc":712,"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 = Parameter(default=1.0)\n    lam = Parameter(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    @property\n    def inverse(self):\n        return Sky2Pix_CylindricalPerspective(self.mu.value, self.lam.value)\n\n    @classmethod\n    def evaluate(cls, x, y, mu, lam):\n        return _projections.cypx2s(x, y, mu, lam)"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":10956,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"col":4,"comment":"\n        Multivariate Horner's scheme\n\n        Parameters\n        ----------\n        x, y : array\n        coeffs : array of coefficients in inverse lexical order\n        ","endLoc":1005,"header":"def multivariate_horner(self, x, y, coeffs)","id":10957,"name":"multivariate_horner","nodeType":"Function","startLoc":982,"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 of 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"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":23,"id":10958,"name":"au","nodeType":"Attribute","startLoc":23,"text":"au"},{"col":4,"comment":"null","endLoc":744,"header":"@mu.validator\n    def mu(self, value)","id":10959,"name":"mu","nodeType":"Function","startLoc":740,"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":750,"header":"@lam.validator\n    def lam(self, value)","id":10960,"name":"lam","nodeType":"Function","startLoc":746,"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":"null","endLoc":754,"header":"@property\n    def inverse(self)","id":10961,"name":"inverse","nodeType":"Function","startLoc":752,"text":"@property\n    def inverse(self):\n        return Sky2Pix_CylindricalPerspective(self.mu.value, self.lam.value)"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":73,"id":10962,"name":"a0","nodeType":"Attribute","startLoc":73,"text":"a0"},{"col":4,"comment":"\n        Calculate the individual Hermite functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":597,"header":"def _fcache(self, x, y)","id":10963,"name":"_fcache","nodeType":"Function","startLoc":580,"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"},{"col":4,"comment":"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        y : ndarray\n            input\n        params : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":969,"header":"def fit_deriv(self, x, y, *params)","id":10964,"name":"fit_deriv","nodeType":"Function","startLoc":930,"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 : throw away parameter\n            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"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":76,"id":10965,"name":"muB","nodeType":"Attribute","startLoc":76,"text":"muB"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":79,"id":10966,"name":"alpha","nodeType":"Attribute","startLoc":79,"text":"alpha"},{"col":4,"comment":"null","endLoc":758,"header":"@classmethod\n    def evaluate(cls, x, y, mu, lam)","id":10967,"name":"evaluate","nodeType":"Function","startLoc":756,"text":"@classmethod\n    def evaluate(cls, x, y, mu, lam):\n        return _projections.cypx2s(x, y, mu, lam)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":737,"id":10968,"name":"mu","nodeType":"Attribute","startLoc":737,"text":"mu"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":82,"id":10969,"name":"atm","nodeType":"Attribute","startLoc":82,"text":"atm"},{"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 : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":638,"header":"def fit_deriv(self, x, y, *params)","id":10970,"name":"fit_deriv","nodeType":"Function","startLoc":599,"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 : throw away parameter\n            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":"CODATA2014","col":0,"comment":"null","endLoc":85,"id":10971,"name":"mu0","nodeType":"Attribute","startLoc":85,"text":"mu0"},{"col":4,"comment":"null","endLoc":1013,"header":"@property\n    def input_units(self)","id":10972,"name":"input_units","nodeType":"Function","startLoc":1007,"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        else:\n            return {'x': self.c0_0.unit / self.c1_0.unit,\n                    'y': self.c0_0.unit / self.c0_1.unit}"},{"col":4,"comment":"null","endLoc":1023,"header":"def _parameter_units_for_data_units(self, inputs_unit, outputs_unit)","id":10973,"name":"_parameter_units_for_data_units","nodeType":"Function","startLoc":1015,"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, 'c{0}_{1}'.format(i, j))\n                mapping.append((par.name, outputs_unit['z'] / inputs_unit['x'] ** i / inputs_unit['y'] ** j))\n        return OrderedDict(mapping)"},{"attributeType":"null","col":4,"comment":"null","endLoc":886,"id":10974,"name":"inputs","nodeType":"Attribute","startLoc":886,"text":"inputs"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":28,"id":10975,"name":"pc","nodeType":"Attribute","startLoc":28,"text":"pc"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":738,"id":10976,"name":"lam","nodeType":"Attribute","startLoc":738,"text":"lam"},{"attributeType":"null","col":4,"comment":"null","endLoc":887,"id":10977,"name":"outputs","nodeType":"Attribute","startLoc":887,"text":"outputs"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":88,"id":10978,"name":"sigma_T","nodeType":"Attribute","startLoc":88,"text":"sigma_T"},{"attributeType":"null","col":4,"comment":"null","endLoc":888,"id":10979,"name":"_separable","nodeType":"Attribute","startLoc":888,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":897,"id":10980,"name":"y_domain","nodeType":"Attribute","startLoc":897,"text":"self.y_domain"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":33,"id":10981,"name":"kpc","nodeType":"Attribute","startLoc":33,"text":"kpc"},{"attributeType":"CODATA2014","col":0,"comment":"null","endLoc":92,"id":10982,"name":"b_wien","nodeType":"Attribute","startLoc":92,"text":"b_wien"},{"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    ","endLoc":805,"id":10983,"nodeType":"Class","startLoc":764,"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 = Parameter(default=1.0)\n    lam = Parameter(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    @property\n    def inverse(self):\n        return Pix2Sky_CylindricalPerspective(self.mu, self.lam)\n\n    @classmethod\n    def evaluate(cls, phi, theta, mu, lam):\n        return _projections.cyps2x(phi, theta, mu, lam)"},{"col":4,"comment":"null","endLoc":791,"header":"@mu.validator\n    def mu(self, value)","id":10984,"name":"mu","nodeType":"Function","startLoc":787,"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\")"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":98,"id":10985,"name":"e_esu","nodeType":"Attribute","startLoc":98,"text":"e_esu"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":39,"id":10986,"name":"L_bol0","nodeType":"Attribute","startLoc":39,"text":"L_bol0"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":101,"id":10987,"name":"e_emu","nodeType":"Attribute","startLoc":101,"text":"e_emu"},{"col":4,"comment":"null","endLoc":797,"header":"@lam.validator\n    def lam(self, value)","id":10988,"name":"lam","nodeType":"Function","startLoc":793,"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":"IAU2012","col":0,"comment":"null","endLoc":46,"id":10989,"name":"L_sun","nodeType":"Attribute","startLoc":46,"text":"L_sun"},{"col":4,"comment":"\n        Derivative of 1D Hermite series\n        ","endLoc":653,"header":"def _hermderiv1d(self, x, deg)","id":10990,"name":"_hermderiv1d","nodeType":"Function","startLoc":640,"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)"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":50,"id":10991,"name":"M_sun","nodeType":"Attribute","startLoc":50,"text":"M_sun"},{"attributeType":"EMCODATA2014","col":0,"comment":"null","endLoc":104,"id":10992,"name":"e_gauss","nodeType":"Attribute","startLoc":104,"text":"e_gauss"},{"attributeType":"null","col":8,"comment":"null","endLoc":896,"id":10993,"name":"x_domain","nodeType":"Attribute","startLoc":896,"text":"self.x_domain"},{"col":0,"comment":"","endLoc":5,"header":"codata2014.py#<anonymous>","id":10994,"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', 00.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":8,"comment":"null","endLoc":899,"id":10995,"name":"y_window","nodeType":"Attribute","startLoc":899,"text":"self.y_window"},{"col":4,"comment":"null","endLoc":801,"header":"@property\n    def inverse(self)","id":10996,"name":"inverse","nodeType":"Function","startLoc":799,"text":"@property\n    def inverse(self):\n        return Pix2Sky_CylindricalPerspective(self.mu, self.lam)"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":54,"id":10997,"name":"R_sun","nodeType":"Attribute","startLoc":54,"text":"R_sun"},{"attributeType":"null","col":0,"comment":"null","endLoc":51,"id":10998,"name":"__all__","nodeType":"Attribute","startLoc":51,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":2149,"id":10999,"name":"BINARY_OPERATORS","nodeType":"Attribute","startLoc":2149,"text":"BINARY_OPERATORS"},{"fileName":"iau2015.py","filePath":"astropy/constants","id":11000,"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\nfrom .codata2014 import G\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\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.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 = IAU2015('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\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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_sun.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_jup.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_earth.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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"},{"attributeType":"null","col":0,"comment":"null","endLoc":2160,"id":11001,"name":"_ORDER_OF_OPERATORS","nodeType":"Attribute","startLoc":2160,"text":"_ORDER_OF_OPERATORS"},{"attributeType":"null","col":0,"comment":"null","endLoc":2161,"id":11002,"name":"OPERATOR_PRECEDENCE","nodeType":"Attribute","startLoc":2161,"text":"OPERATOR_PRECEDENCE"},{"attributeType":"null","col":4,"comment":"null","endLoc":2162,"id":11003,"name":"idx","nodeType":"Attribute","startLoc":2162,"text":"idx"},{"attributeType":"null","col":9,"comment":"null","endLoc":2162,"id":11004,"name":"ops","nodeType":"Attribute","startLoc":2162,"text":"ops"},{"attributeType":"null","col":8,"comment":"null","endLoc":2163,"id":11005,"name":"op","nodeType":"Attribute","startLoc":2163,"text":"op"},{"col":0,"comment":"","endLoc":14,"header":"core.py#<anonymous>","id":11006,"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           'custom_model', 'ModelDefinitionError']\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\n_ORDER_OF_OPERATORS = [('|',), ('&',), ('+', '-'), ('*', '/'), ('**',)]\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\n\ncopyreg.pickle(_ModelMeta, _ModelMeta.__reduce__)\n\ncopyreg.pickle(_CompoundModelMeta, _CompoundModelMeta.__reduce__)"},{"attributeType":"null","col":8,"comment":"null","endLoc":898,"id":11007,"name":"x_window","nodeType":"Attribute","startLoc":898,"text":"self.x_window"},{"className":"IAU2015","col":0,"comment":"null","endLoc":18,"id":11008,"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":16,"id":11009,"name":"default_reference","nodeType":"Attribute","startLoc":16,"text":"default_reference"},{"attributeType":"null","col":16,"comment":"null","endLoc":63,"id":11010,"name":"np","nodeType":"Attribute","startLoc":63,"text":"np"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":11011,"name":"_registry","nodeType":"Attribute","startLoc":17,"text":"_registry"},{"attributeType":"null","col":4,"comment":"null","endLoc":18,"id":11012,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":18,"text":"_has_incompatible_units"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":11013,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":24,"id":11014,"name":"au","nodeType":"Attribute","startLoc":24,"text":"au"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":11015,"name":"models_1D","nodeType":"Attribute","startLoc":66,"text":"models_1D"},{"attributeType":"null","col":4,"comment":"null","endLoc":570,"id":11016,"name":"_separable","nodeType":"Attribute","startLoc":570,"text":"_separable"},{"attributeType":"null","col":0,"comment":"null","endLoc":216,"id":11017,"name":"models_2D","nodeType":"Attribute","startLoc":216,"text":"models_2D"},{"col":0,"comment":"","endLoc":50,"header":"example_models.py#<anonymous>","id":11018,"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    },\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    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    },\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    },\n\n    MexicanHat1D: {\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    },\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    },\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, 2, 4, 8, 10],\n        'y_values': [0.520935, 0.017205, 0.003998, 0.000983, 0.000628],\n        'x_lim': [-3, 3]\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    },\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    },\n\n    MexicanHat2D: {\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    },\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    },\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    },\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}"},{"fileName":"codata2010.py","filePath":"astropy/constants","id":11019,"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\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', 0.0,\n                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"},{"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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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":759,"id":11020,"nodeType":"Class","startLoc":656,"text":"class Legendre1D(PolynomialModel):\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    Parameters\n    ----------\n    degree : int\n        degree of the series\n    domain : list or None, optional\n    window : list 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    inputs = ('x',)\n    outputs = ('y',)\n    _separable = False\n\n    def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)\n\n    def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info\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 : throw away parameter\n            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"},{"className":"CODATA2010","col":0,"comment":"null","endLoc":22,"id":11021,"nodeType":"Class","startLoc":14,"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)"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":29,"id":11022,"name":"pc","nodeType":"Attribute","startLoc":29,"text":"pc"},{"col":4,"comment":"null","endLoc":22,"header":"def __new__(cls, abbrev, name, value, unit, uncertainty,\n                reference=default_reference, system=None)","id":11023,"name":"__new__","nodeType":"Function","startLoc":19,"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":"IAU2015","col":0,"comment":"null","endLoc":34,"id":11024,"name":"kpc","nodeType":"Attribute","startLoc":34,"text":"kpc"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":40,"id":11025,"name":"L_bol0","nodeType":"Attribute","startLoc":40,"text":"L_bol0"},{"col":4,"comment":"null","endLoc":805,"header":"@classmethod\n    def evaluate(cls, phi, theta, mu, lam)","id":11026,"name":"evaluate","nodeType":"Function","startLoc":803,"text":"@classmethod\n    def evaluate(cls, phi, theta, mu, lam):\n        return _projections.cyps2x(phi, theta, mu, lam)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":784,"id":11027,"name":"mu","nodeType":"Attribute","startLoc":784,"text":"mu"},{"fileName":"astropyconst20.py","filePath":"astropy/constants","id":11028,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nAstronomical and physics constants for Astropy v2.0.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\n\n\nimport itertools\n\nfrom .constant import Constant\nfrom . import codata2014, iau2015\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()):\n        locals()[_c.abbrev] = _c\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":11029,"name":"_nm","nodeType":"Attribute","startLoc":14,"text":"_nm"},{"col":4,"comment":"null","endLoc":701,"header":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":11030,"name":"__init__","nodeType":"Function","startLoc":695,"text":"def __init__(self, degree, domain=None, window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params):\n        self.domain = domain\n        self.window = window\n        super().__init__(\n            degree, n_models=n_models, model_set_axis=model_set_axis,\n            name=name, meta=meta, **params)"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":61,"id":11031,"name":"M_jup","nodeType":"Attribute","startLoc":61,"text":"M_jup"},{"attributeType":"null","col":4,"comment":"null","endLoc":15,"id":11032,"name":"default_reference","nodeType":"Attribute","startLoc":15,"text":"default_reference"},{"attributeType":"null","col":4,"comment":"null","endLoc":16,"id":11033,"name":"_registry","nodeType":"Attribute","startLoc":16,"text":"_registry"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":65,"id":11034,"name":"R_jup","nodeType":"Attribute","startLoc":65,"text":"R_jup"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":70,"id":11035,"name":"M_earth","nodeType":"Attribute","startLoc":70,"text":"M_earth"},{"attributeType":"null","col":4,"comment":"null","endLoc":17,"id":11036,"name":"_has_incompatible_units","nodeType":"Attribute","startLoc":17,"text":"_has_incompatible_units"},{"attributeType":"null","col":9,"comment":"null","endLoc":14,"id":11037,"name":"_c","nodeType":"Attribute","startLoc":14,"text":"_c"},{"col":0,"comment":"","endLoc":5,"header":"astropyconst20.py#<anonymous>","id":11038,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nAstronomical and physics constants for Astropy v2.0.  See :mod:`astropy.constants`\nfor a complete listing of constants defined in Astropy.\n\"\"\"\n\nfor _nm, _c in itertools.chain(sorted(vars(codata2014).items()),\n                               sorted(vars(iau2015).items())):\n    if (isinstance(_c, Constant) and _c.abbrev not in locals()):\n        locals()[_c.abbrev] = _c"},{"className":"EMCODATA2010","col":0,"comment":"null","endLoc":26,"id":11039,"nodeType":"Class","startLoc":25,"text":"class EMCODATA2010(CODATA2010, EMConstant):\n    _registry = CODATA2010._registry"},{"attributeType":"IAU2012","col":0,"comment":"null","endLoc":74,"id":11040,"name":"R_earth","nodeType":"Attribute","startLoc":74,"text":"R_earth"},{"attributeType":"null","col":4,"comment":"null","endLoc":26,"id":11041,"name":"_registry","nodeType":"Attribute","startLoc":26,"text":"_registry"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":785,"id":11042,"name":"lam","nodeType":"Attribute","startLoc":785,"text":"lam"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":47,"id":11043,"name":"L_sun","nodeType":"Attribute","startLoc":47,"text":"L_sun"},{"col":0,"comment":"","endLoc":5,"header":"iau2012.py#<anonymous>","id":11044,"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')"},{"id":11045,"name":"astropy/constants/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/constants/tests","id":11046,"nodeType":"File","text":""},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":51,"id":11047,"name":"GM_sun","nodeType":"Attribute","startLoc":51,"text":"GM_sun"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":11048,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":29,"id":11049,"name":"h","nodeType":"Attribute","startLoc":29,"text":"h"},{"id":11050,"name":"astropy/cosmology","nodeType":"Package"},{"fileName":"parameters.py","filePath":"astropy/cosmology","id":11051,"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    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 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\n\"\"\"\n\n# Note: if you add a new cosmology, please also update the table\n# in the 'Built-in Cosmologies' section of astropy/docs/cosmology/index.rst\n# in addition to the list above.  You also need to add them to the 'available'\n# list at the bottom of this file.\n\n# Planck 2015 paper XII Table 4 final column (best fit)\nPlanck15 = dict(\n    Oc0=0.2589,\n    Ob0=0.04860,\n    Om0=0.3075,\n    H0=67.74,\n    n=0.9667,\n    sigma8=0.8159,\n    tau=0.066,\n    z_reion=8.8,\n    t0=13.799,\n    Tcmb0=2.7255,\n    Neff=3.046,\n    flat=True,\n    m_nu=[0., 0., 0.06],\n    reference=(\"Planck Collaboration 2016, A&A, 594, A13 (Paper XIII),\"\n               \" Table 4 (TT, TE, EE + lowP + lensing + ext)\")\n)\n\n# Planck 2013 paper XVI Table 5 penultimate column (best fit)\nPlanck13 = dict(\n    Oc0=0.25886,\n    Ob0=0.048252,\n    Om0=0.30712,\n    H0=67.77,\n    n=0.9611,\n    sigma8=0.8288,\n    tau=0.0952,\n    z_reion=11.52,\n    t0=13.7965,\n    Tcmb0=2.7255,\n    Neff=3.046,\n    flat=True,\n    m_nu=[0., 0., 0.06],\n    reference=(\"Planck Collaboration 2014, A&A, 571, A16 (Paper XVI),\"\n               \" Table 5 (Planck + WP + highL + BAO)\")\n)\n\n\nWMAP9 = dict(\n    Oc0=0.2402,\n    Ob0=0.04628,\n    Om0=0.2865,\n    H0=69.32,\n    n=0.9608,\n    sigma8=0.820,\n    tau=0.081,\n    z_reion=10.1,\n    t0=13.772,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Hinshaw et al. 2013, ApJS, 208, 19, \"\n               \"doi: 10.1088/0067-0049/208/2/19. \"\n               \"Table 4 (WMAP9 + eCMB + BAO + H0, last column)\")\n)\n\nWMAP7 = dict(\n    Oc0=0.226,\n    Ob0=0.0455,\n    Om0=0.272,\n    H0=70.4,\n    n=0.967,\n    sigma8=0.810,\n    tau=0.085,\n    z_reion=10.3,\n    t0=13.76,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Komatsu et al. 2011, ApJS, 192, 18, \"\n               \"doi: 10.1088/0067-0049/192/2/18. \"\n               \"Table 1 (WMAP + BAO + H0 ML).\")\n)\n\nWMAP5 = dict(\n    Oc0=0.231,\n    Ob0=0.0459,\n    Om0=0.277,\n    H0=70.2,\n    n=0.962,\n    sigma8=0.817,\n    tau=0.088,\n    z_reion=11.3,\n    t0=13.72,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Komatsu et al. 2009, ApJS, 180, 330, \"\n               \"doi: 10.1088/0067-0049/180/2/330. \"\n               \"Table 1 (WMAP + BAO + SN ML).\")\n)\n\n# If new parameters are added, this list must be updated\navailable = ['Planck15', 'Planck13', 'WMAP9', 'WMAP7', 'WMAP5']\n"},{"col":4,"comment":"null","endLoc":709,"header":"def prepare_inputs(self, x, **kwargs)","id":11052,"name":"prepare_inputs","nodeType":"Function","startLoc":703,"text":"def prepare_inputs(self, x, **kwargs):\n        inputs, format_info = \\\n                super(PolynomialModel, self).prepare_inputs(x, **kwargs)\n\n        x = inputs[0]\n\n        return (x,), format_info"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":55,"id":11053,"name":"M_sun","nodeType":"Attribute","startLoc":55,"text":"M_sun"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":61,"id":11054,"name":"R_sun","nodeType":"Attribute","startLoc":61,"text":"R_sun"},{"col":4,"comment":"null","endLoc":714,"header":"def evaluate(self, x, *coeffs)","id":11055,"name":"evaluate","nodeType":"Function","startLoc":711,"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":"IAU2015","col":0,"comment":"null","endLoc":68,"id":11056,"name":"GM_jup","nodeType":"Attribute","startLoc":68,"text":"GM_jup"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":72,"id":11057,"name":"M_jup","nodeType":"Attribute","startLoc":72,"text":"M_jup"},{"fileName":"funcs.py","filePath":"astropy/cosmology","id":11058,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"\nConvenience functions for `astropy.cosmology`.\n\"\"\"\n\nimport warnings\nimport numpy as np\n\nfrom .core import CosmologyError\nfrom ..units import Quantity\n\n__all__ = ['z_at_value']\n\n__doctest_requires__ = {'*': ['scipy.integrate']}\n\n\ndef z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500):\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 behaviour of the function that you\n      are trying to invert! Depending on the cosmology, there may not\n      be a unique solution. For example, in the standard Lambda CDM\n      cosmology, there are two redshifts which give an angular\n      diameter distance of 1500 Mpc, z ~ 0.7 and z ~ 3.8. To force\n      ``z_at_value`` to find the solution you are interested in, use the\n      ``zmin`` and ``zmax`` keywords to limit the search range (see the\n      example below).\n\n    Parameters\n    ----------\n    func : function or method\n       A function that takes a redshift as input.\n    fval : astropy.Quantity instance\n       The value of ``func(z)``.\n    zmin : float, 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    zmax : float, optional\n       The upper search limit for ``z`` (default 1000).\n    ztol : float, optional\n       The relative error in ``z`` acceptable for convergence.\n    maxfun : int, optional\n       The maximum number of function evaluations allowed in the\n       optimization routine (default 500).\n\n    Returns\n    -------\n    z : float\n      The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n      fval`` within ``ztol``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient\n    if you want to invert a large number of values for the same\n    cosmology. In this case, it is faster to instead generate an array\n    of values at many closely-spaced redshifts that cover the relevant\n    redshift range, and then use interpolation to find the redshift at\n    each value you're interested in. For example, to efficiently find\n    the redshifts corresponding to 10^6 values of the distance modulus\n    in a Planck13 cosmology, you could do the 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 43 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1e6) * 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.logspace(np.log10(zmin), np.log10(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, zgrid, Dgrid.value)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, 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)\n    3.19812268...\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. Use the zmin and zmax keywords\n    to find the one you're interested in:\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmax=1.5)\n    0.6812769577...\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmin=2.5)\n    3.7914913242...\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    from scipy.optimize import fminbound\n\n    fval_zmin = func(zmin)\n    fval_zmax = func(zmax)\n    if np.sign(fval - fval_zmin) != np.sign(fval_zmax - fval):\n        warnings.warn(\"\"\"\\\nfval is not bracketed by func(zmin) and func(zmax). This means either\nthere is no solution, or that there is more than one solution between\nzmin and zmax satisfying fval = func(z).\"\"\")\n\n    if isinstance(fval_zmin, Quantity):\n        val = fval.to_value(fval_zmin.unit)\n        f = lambda z: abs(func(z).value - val)\n    else:\n        f = lambda z: abs(func(z) - fval)\n\n    zbest, resval, ierr, ncall = fminbound(f, zmin, zmax, maxfun=maxfun,\n                                           full_output=1, xtol=ztol)\n\n    if ierr != 0:\n        warnings.warn('Maximum number of function calls ({}) reached'.format(\n            ncall))\n\n    if np.allclose(zbest, zmax):\n        raise CosmologyError(\"Best guess z is very close the upper z limit.\\n\"\n                             \"Try re-running with a different zmax.\")\n    elif np.allclose(zbest, zmin):\n        raise CosmologyError(\"Best guess z is very close the lower z limit.\\n\"\n                             \"Try re-running with a different zmin.\")\n\n    return zbest\n"},{"className":"CosmologyError","col":0,"comment":"null","endLoc":83,"id":11059,"nodeType":"Class","startLoc":82,"text":"class CosmologyError(Exception):\n    pass"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":32,"id":11060,"name":"hbar","nodeType":"Attribute","startLoc":32,"text":"hbar"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":11061,"name":"Planck15","nodeType":"Attribute","startLoc":50,"text":"Planck15"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":78,"id":11062,"name":"R_jup","nodeType":"Attribute","startLoc":78,"text":"R_jup"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":37,"id":11063,"name":"k_B","nodeType":"Attribute","startLoc":37,"text":"k_B"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":82,"id":11064,"name":"GM_earth","nodeType":"Attribute","startLoc":82,"text":"GM_earth"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":40,"id":11065,"name":"c","nodeType":"Attribute","startLoc":40,"text":"c"},{"attributeType":"null","col":0,"comment":"null","endLoc":69,"id":11066,"name":"Planck13","nodeType":"Attribute","startLoc":69,"text":"Planck13"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":86,"id":11067,"name":"M_earth","nodeType":"Attribute","startLoc":86,"text":"M_earth"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":43,"id":11068,"name":"G","nodeType":"Attribute","startLoc":43,"text":"G"},{"attributeType":"null","col":0,"comment":"null","endLoc":88,"id":11069,"name":"WMAP9","nodeType":"Attribute","startLoc":88,"text":"WMAP9"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":11070,"name":"WMAP7","nodeType":"Attribute","startLoc":107,"text":"WMAP7"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":11071,"name":"WMAP5","nodeType":"Attribute","startLoc":126,"text":"WMAP5"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":46,"id":11072,"name":"g0","nodeType":"Attribute","startLoc":46,"text":"g0"},{"attributeType":"null","col":0,"comment":"null","endLoc":146,"id":11073,"name":"available","nodeType":"Attribute","startLoc":146,"text":"available"},{"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 0.\n    ","endLoc":835,"id":11074,"nodeType":"Class","startLoc":811,"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 0.\n    \"\"\"\n\n    lam = Parameter(default=1)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_CylindricalEqualArea(self.lam)\n\n    @classmethod\n    def evaluate(cls, x, y, lam):\n        return _projections.ceax2s(x, y, lam)"},{"col":0,"comment":"","endLoc":42,"header":"parameters.py#<anonymous>","id":11075,"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    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 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\n\"\"\"\n\nPlanck15 = dict(\n    Oc0=0.2589,\n    Ob0=0.04860,\n    Om0=0.3075,\n    H0=67.74,\n    n=0.9667,\n    sigma8=0.8159,\n    tau=0.066,\n    z_reion=8.8,\n    t0=13.799,\n    Tcmb0=2.7255,\n    Neff=3.046,\n    flat=True,\n    m_nu=[0., 0., 0.06],\n    reference=(\"Planck Collaboration 2016, A&A, 594, A13 (Paper XIII),\"\n               \" Table 4 (TT, TE, EE + lowP + lensing + ext)\")\n)\n\nPlanck13 = dict(\n    Oc0=0.25886,\n    Ob0=0.048252,\n    Om0=0.30712,\n    H0=67.77,\n    n=0.9611,\n    sigma8=0.8288,\n    tau=0.0952,\n    z_reion=11.52,\n    t0=13.7965,\n    Tcmb0=2.7255,\n    Neff=3.046,\n    flat=True,\n    m_nu=[0., 0., 0.06],\n    reference=(\"Planck Collaboration 2014, A&A, 571, A16 (Paper XVI),\"\n               \" Table 5 (Planck + WP + highL + BAO)\")\n)\n\nWMAP9 = dict(\n    Oc0=0.2402,\n    Ob0=0.04628,\n    Om0=0.2865,\n    H0=69.32,\n    n=0.9608,\n    sigma8=0.820,\n    tau=0.081,\n    z_reion=10.1,\n    t0=13.772,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Hinshaw et al. 2013, ApJS, 208, 19, \"\n               \"doi: 10.1088/0067-0049/208/2/19. \"\n               \"Table 4 (WMAP9 + eCMB + BAO + H0, last column)\")\n)\n\nWMAP7 = dict(\n    Oc0=0.226,\n    Ob0=0.0455,\n    Om0=0.272,\n    H0=70.4,\n    n=0.967,\n    sigma8=0.810,\n    tau=0.085,\n    z_reion=10.3,\n    t0=13.76,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Komatsu et al. 2011, ApJS, 192, 18, \"\n               \"doi: 10.1088/0067-0049/192/2/18. \"\n               \"Table 1 (WMAP + BAO + H0 ML).\")\n)\n\nWMAP5 = dict(\n    Oc0=0.231,\n    Ob0=0.0459,\n    Om0=0.277,\n    H0=70.2,\n    n=0.962,\n    sigma8=0.817,\n    tau=0.088,\n    z_reion=11.3,\n    t0=13.72,\n    Tcmb0=2.725,\n    Neff=3.04,\n    m_nu=0.0,\n    flat=True,\n    reference=(\"Komatsu et al. 2009, ApJS, 180, 330, \"\n               \"doi: 10.1088/0067-0049/180/2/330. \"\n               \"Table 1 (WMAP + BAO + SN ML).\")\n)\n\navailable = ['Planck15', 'Planck13', 'WMAP9', 'WMAP7', 'WMAP5']"},{"col":4,"comment":"null","endLoc":831,"header":"@property\n    def inverse(self)","id":11076,"name":"inverse","nodeType":"Function","startLoc":829,"text":"@property\n    def inverse(self):\n        return Sky2Pix_CylindricalEqualArea(self.lam)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":49,"id":11077,"name":"m_p","nodeType":"Attribute","startLoc":49,"text":"m_p"},{"fileName":"__init__.py","filePath":"astropy/cosmology","id":11078,"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<http://docs.astropy.org/en/latest/cosmology/index.html>`_ for more\ndetailed usage examples and references.\n\"\"\"\n\nfrom .core import *\nfrom .funcs import *\n"},{"col":0,"comment":"","endLoc":8,"header":"__init__.py#<anonymous>","id":11079,"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<http://docs.astropy.org/en/latest/cosmology/index.html>`_ for more\ndetailed usage examples and references.\n\"\"\""},{"attributeType":"Constant","col":0,"comment":"null","endLoc":52,"id":11080,"name":"m_n","nodeType":"Attribute","startLoc":52,"text":"m_n"},{"id":11081,"name":"scalar_inv_efuncs.pyx","nodeType":"TextFile","path":"astropy/cosmology","text":"\"\"\" Cython inverse efuncs for cosmology integrals\"\"\"\n#cython boundcheck=False\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":"core.py","filePath":"astropy/cosmology","id":11082,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport sys\nfrom math import sqrt, pi, exp, log, floor\nfrom abc import ABCMeta, abstractmethod\nfrom inspect import signature\n\nimport numpy as np\n\nfrom . import scalar_inv_efuncs\n\nfrom .. import constants as const\nfrom .. import units as u\nfrom ..utils import isiterable\nfrom ..utils.state import ScienceState\n\nfrom . import parameters\n\n# Originally authored by Andrew Becker (becker@astro.washington.edu),\n# and modified by Neil Crighton (neilcrighton@gmail.com) and Roban\n# Kramer (robanhk@gmail.com).\n\n# Many of these adapted from Hogg 1999, astro-ph/9905116\n# and Linder 2003, PRL 90, 91301\n\n__all__ = [\"FLRW\", \"LambdaCDM\", \"FlatLambdaCDM\", \"wCDM\", \"FlatwCDM\",\n           \"Flatw0waCDM\", \"w0waCDM\", \"wpwaCDM\", \"w0wzCDM\",\n           \"default_cosmology\"] + parameters.available\n\n__doctest_requires__ = {'*': ['scipy.integrate']}\n\n# Notes about speeding up integrals:\n# ---------------------------------\n#  The supplied cosmology classes use a few tricks to speed\n#  up distance and time integrals.  It is not necessary for\n#  anyone subclassing FLRW to use these tricks -- but if they\n#  do, such calculations may be a lot faster.\n# The first, more basic, idea is that, in many cases, it's a big deal to\n#  provide explicit formulae for inv_efunc rather than simply\n#  setting up de_energy_scale -- assuming there is a nice expression.\n#  As noted above, almost all of the provided classes do this, and\n#  that template can pretty much be followed directly with the appropriate\n#  formula changes.\n# The second, and more advanced, option is to also explicitly\n#  provide a scalar only version of inv_efunc.  This results in a fairly\n#  large speedup (>10x in most cases) in the distance and age integrals,\n#  even if only done in python,  because testing whether the inputs are\n#  iterable or pure scalars turns out to be rather expensive. To take\n#  advantage of this, the key thing is to explicitly set the\n#  instance variables self._inv_efunc_scalar and self._inv_efunc_scalar_args\n#  in the constructor for the subclass, where the latter are all the\n#  arguments except z to _inv_efunc_scalar.\n#\n#  The provided classes do use this optimization, and in fact go\n#  even further and provide optimizations for no radiation, and for radiation\n#  with massless neutrinos coded in cython.  Consult the subclasses for\n#  details, and scalar_inv_efuncs for the details.\n#\n#  However, the important point is that it is -not- necessary to do this.\n\n# Some conversion constants -- useful to compute them once here\n#  and reuse in the initialization rather than have every object do them\n# Note that the call to cgs is actually extremely expensive,\n#  so we actually skip using the units package directly, and\n#  hardwire the conversion from mks to cgs. This assumes that constants\n#  will always return mks by default -- if this is made faster for simple\n#  cases like this, it should be changed back.\n# Note that the unit tests should catch it if this happens\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.value * 1000)\narcsec_in_radians = pi / (3600. * 180)\narcmin_in_radians = pi / (60. * 180)\n# Radiation parameter over c^2 in cgs (g cm^-3 K^-4)\na_B_c2 = 4e-3 * const.sigma_sb.value / const.c.value ** 3\n# Boltzmann constant in eV / K\nkB_evK = const.k_B.to(u.eV / u.K)\n\n\nclass CosmologyError(Exception):\n    pass\n\n\nclass Cosmology:\n    \"\"\" Placeholder for when a more general Cosmology class is\n    implemented. \"\"\"\n\n\nclass FLRW(Cosmology, metaclass=ABCMeta):\n    \"\"\" A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you can't instantiate\n    examples of this class, but must work with one of its\n    subclasses such as `LambdaCDM` or `wCDM`.\n\n    Parameters\n    ----------\n\n    H0 : float or scalar `~astropy.units.Quantity`\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\n        massive 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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\n\n    Notes\n    -----\n    Class instances are static -- you can't change the values\n    of the parameters.  That is, all of the attributes above are\n    read only.\n    \"\"\"\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        # all densities are in units of the critical density\n        self._Om0 = float(Om0)\n        if self._Om0 < 0.0:\n            raise ValueError(\"Matter density can not be negative\")\n        self._Ode0 = float(Ode0)\n        if Ob0 is not None:\n            self._Ob0 = float(Ob0)\n            if self._Ob0 < 0.0:\n                raise ValueError(\"Baryonic density can not be negative\")\n            if self._Ob0 > self._Om0:\n                raise ValueError(\"Baryonic density can not be larger than \"\n                                 \"total matter density\")\n            self._Odm0 = self._Om0 - self._Ob0\n        else:\n            self._Ob0 = None\n            self._Odm0 = None\n\n        self._Neff = float(Neff)\n        if self._Neff < 0.0:\n            raise ValueError(\"Effective number of neutrinos can \"\n                             \"not be negative\")\n        self.name = name\n\n        # Tcmb may have units\n        self._Tcmb0 = u.Quantity(Tcmb0, unit=u.K)\n        if not self._Tcmb0.isscalar:\n            raise ValueError(\"Tcmb0 is a non-scalar quantity\")\n\n        # Hubble parameter at z=0, km/s/Mpc\n        self._H0 = u.Quantity(H0, unit=u.km / u.s / u.Mpc)\n        if not self._H0.isscalar:\n            raise ValueError(\"H0 is a non-scalar quantity\")\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1; don't use units for speed\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time; again, avoiding units package for speed\n        self._hubble_time = u.Quantity(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 = u.Quantity(cd0value, u.g / u.cm ** 3)\n\n        # Load up neutrino masses.  Note: in Py2.x, floor is floating\n        self._nneutrinos = int(floor(self._Neff))\n\n        # We are going to share Neff between the neutrinos equally.\n        # In detail this is not correct, but it is a standard assumption\n        # because properly calculating it is a) complicated b) depends\n        # on the details of the massive neutrinos (e.g., their weak\n        # interactions, which could be unusual if one is considering sterile\n        # neutrinos)\n        self._massivenu = False\n        if self._nneutrinos > 0 and self._Tcmb0.value > 0:\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # We can't use the u.Quantity constructor as we do above\n            # because it doesn't understand equivalencies\n            if not isinstance(m_nu, u.Quantity):\n                raise ValueError(\"m_nu must be a Quantity\")\n\n            m_nu = m_nu.to(u.eV, equivalencies=u.mass_energy())\n\n            # Now, figure out if we have massive neutrinos to deal with,\n            # and, if so, get the right number of masses\n            # It is worth the effort to keep track of massless ones separately\n            # (since they are quite easy to deal with, and a common use case\n            # is to set only one neutrino to have mass)\n            if m_nu.isscalar:\n                # Assume all neutrinos have the same mass\n                if m_nu.value == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    self._nmasslessnu = 0\n                    self._nmassivenu = self._nneutrinos\n                    self._massivenu_mass = (m_nu.value *\n                                            np.ones(self._nneutrinos))\n            else:\n                # Make sure we have the right number of masses\n                # -unless- they are massless, in which case we cheat a little\n                if m_nu.value.min() < 0:\n                    raise ValueError(\"Invalid (negative) neutrino mass\"\n                                     \" encountered\")\n                if m_nu.value.max() == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    if len(m_nu) != self._nneutrinos:\n                        errstr = \"Unexpected number of neutrino masses\"\n                        raise ValueError(errstr)\n                    # Segregate out the massless ones\n                    self._nmasslessnu = len(np.nonzero(m_nu.value == 0)[0])\n                    self._nmassivenu = self._nneutrinos - self._nmasslessnu\n                    w = np.nonzero(m_nu.value > 0)[0]\n                    self._massivenu_mass = m_nu[w]\n\n        # Compute photon density, Tcmb, neutrino parameters\n        # Tcmb0=0 removes both photons and neutrinos, is handled\n        # as a special case for efficiency\n        if self._Tcmb0.value > 0:\n            # Compute photon density from Tcmb\n            self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 /\\\n                self._critical_density0.value\n\n            # Compute Neutrino temperature\n            # The constant in front is (4/11)^1/3 -- see any\n            #  cosmology book for an explanation -- for example,\n            #  Weinberg 'Cosmology' p 154 eq (3.1.21)\n            self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n            # Compute Neutrino Omega and total relativistic component\n            # for massive neutrinos.  We also store a list version,\n            # since that is more efficient to do integrals with (perhaps\n            # surprisingly!  But small python lists are more efficient\n            # than small numpy arrays).\n            if self._massivenu:\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\n                # The 0.2271... is 7/8 (4/11)^(4/3) -- the temperature\n                # bit ^4 (blackbody energy density) times 7/8 for\n                # FD vs. BE statistics.\n                self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n\n        else:\n            self._Ogamma0 = 0.0\n            self._Tnu0 = u.Quantity(0.0, u.K)\n            self._Onu0 = 0.0\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    def _namelead(self):\n        \"\"\" Helper function for constructing __repr__\"\"\"\n        if self.name is None:\n            return \"{0}(\".format(self.__class__.__name__)\n        else:\n            return \"{0}(name=\\\"{1}\\\", \".format(self.__class__.__name__,\n                                               self.name)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, \"\\\n                 \"Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n    # Set up a set of properties for H0, Om0, Ode0, Ok0, etc. for user access.\n    # Note that we don't let these be set (so, obj.Om0 = value fails)\n\n    @property\n    def H0(self):\n        \"\"\" Return the Hubble constant as an `~astropy.units.Quantity` at z=0\"\"\"\n        return self._H0\n\n    @property\n    def Om0(self):\n        \"\"\" Omega matter; matter density/critical density at z=0\"\"\"\n        return self._Om0\n\n    @property\n    def Ode0(self):\n        \"\"\" Omega dark energy; dark energy density/critical density at z=0\"\"\"\n        return self._Ode0\n\n    @property\n    def Ob0(self):\n        \"\"\" Omega baryon; baryonic matter density/critical density at z=0\"\"\"\n        return self._Ob0\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\n        at z=0\"\"\"\n        return self._Ok0\n\n    @property\n    def Tcmb0(self):\n        \"\"\" Temperature of the CMB as `~astropy.units.Quantity` at z=0\"\"\"\n        return self._Tcmb0\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 Neff(self):\n        \"\"\" Number of effective neutrino species\"\"\"\n        return self._Neff\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 m_nu(self):\n        \"\"\" Mass of neutrino species\"\"\"\n        if self._Tnu0.value == 0:\n            return None\n        if not self._massivenu:\n            # Only massless\n            return u.Quantity(np.zeros(self._nmasslessnu), u.eV)\n        if self._nmasslessnu == 0:\n            # Only massive\n            return u.Quantity(self._massivenu_mass, u.eV)\n        # A mix -- the most complicated case\n        numass = np.append(np.zeros(self._nmasslessnu),\n                           self._massivenu_mass.value)\n        return u.Quantity(numass, u.eV)\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    def clone(self, **kwargs):\n        \"\"\" Returns a copy of this object, potentially with some changes.\n\n        Returns\n        -------\n        newcos : Subclass of FLRW\n        A new instance of this class with the specified changes.\n\n        Notes\n        -----\n        This assumes that the values of all constructor arguments\n        are available as properties, which is true of all the provided\n        subclasses but may not be true of user-provided ones.  You can't\n        change the type of class, so this can't be used to change between\n        flat and non-flat.  If no modifications are requested, then\n        a reference to this object is returned.\n\n        Examples\n        --------\n        To make a copy of the Planck13 cosmology with a different Omega_m\n        and a new name:\n\n        >>> from astropy.cosmology import Planck13\n        >>> newcos = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n        \"\"\"\n\n        # Quick return check, taking advantage of the\n        # immutability of cosmological objects\n        if len(kwargs) == 0:\n            return self\n\n        # Get constructor arguments\n        arglist = signature(self.__init__).parameters.keys()\n\n        # Build the dictionary of values used to construct this\n        #  object.  This -assumes- every argument to __init__ has a\n        #  property.  This is true of all the classes we provide, but\n        #  maybe a user won't do that.  So at least try to have a useful\n        #  error message.\n        argdict = {}\n        for arg in arglist:\n            try:\n                val = getattr(self, arg)\n                argdict[arg] = val\n            except AttributeError:\n                # We didn't find a property -- complain usefully\n                errstr = \"Object did not have property corresponding \"\\\n                         \"to constructor argument '{}'; perhaps it is a \"\\\n                         \"user provided subclass that does not do so\"\n                raise AttributeError(errstr.format(arg))\n\n        # Now substitute in new arguments\n        for newarg in kwargs:\n            if newarg not in argdict:\n                errstr = \"User provided argument '{}' not found in \"\\\n                         \"constructor for this object\"\n                raise AttributeError(errstr.format(newarg))\n            argdict[newarg] = kwargs[newarg]\n\n        return self.__class__(**argdict)\n\n    @abstractmethod\n    def w(self, z):\n        \"\"\" The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")\n\n    def Om(self, z):\n        \"\"\" Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Om : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest; see `Onu`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Om0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ob : ndarray, or float if input scalar\n          The density of baryonic matter relative to the critical density at\n          each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        \"\"\"\n\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ob0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Odm : ndarray, or float if input scalar\n          The density of non-relativistic dark matter relative to the critical\n          density at each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest.\n        \"\"\"\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        if isiterable(z):\n            z = np.asarray(z)\n        return self._Odm0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ok(self, z):\n        \"\"\" Return the equivalent density parameter for curvature\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ok : ndarray, or float if input scalar\n          The equivalent density parameter for curvature at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common enough case to be worth checking explicitly\n            if self._Ok0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ok0 == 0:\n                return 0.0\n\n        return self._Ok0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ode : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common case worth checking\n            if self._Ode0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ode0 == 0:\n                return 0.0\n\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ogamma : ndarray, or float if input scalar\n          The energy density of photons relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ogamma0 * (1. + z) ** 4 * self.inv_efunc(z) ** 2\n\n    def Onu(self, z):\n        \"\"\" Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Onu : ndarray, or float if input scalar\n          The energy density of neutrinos relative to the critical\n          density at each redshift.  Note that this includes their\n          kinetic energy (if they have mass), so it is not equal to\n          the commonly used :math:`\\\\sum \\\\frac{m_{\\\\nu}}{94 eV}`,\n          which does not include kinetic energy.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            if self._Onu0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Onu0 == 0:\n                return 0.0\n\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity`\n          The temperature of the CMB in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tcmb0 * (1. + z)\n\n    def Tnu(self, z):\n        \"\"\" Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity`\n          The temperature of the cosmic neutrino background in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tnu0 * (1. + z)\n\n    def nu_relative_density(self, z):\n        \"\"\" Neutrino density function relative to the energy density in\n        photons.\n\n        Parameters\n        ----------\n        z : array like\n           Redshift\n\n        Returns\n        -------\n         f : ndarray, or float if z is scalar\n           The neutrino density scaling factor relative to the density\n           in photons at each redshift\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\n        for each one. Note that f has the asymptotic behavior :math:`f(0) = 1`.\n        This method returns :math:`0.2271 f` using an\n        analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\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        if not self._massivenu:\n            if np.isscalar(z):\n                return prefac * self._Neff\n            else:\n                return prefac * self._Neff * np.ones(np.asanyarray(z).shape)\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        z = np.asarray(z)\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.\"\"\"\n\n        # See Linder 2003, PRL 90, 91301 eq (5)\n        # Assumes scalar input, since this should only be called\n        # inside an integral\n\n        z = exp(ln1pz) - 1.0\n        return 1.0 + self.w(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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        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\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        #\n        # The integral we actually use (the one given in Linder)\n        # is rewritten in terms of z, so looks slightly different than the\n        # one in the documentation string, but it's the same thing.\n\n        from scipy.integrate import quad\n\n        if isiterable(z):\n            z = np.asarray(z)\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:\n            ival = quad(self._w_integrand, 0, log(1 + z))[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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * self.de_density_scale(z))\n\n    def inv_efunc(self, z):\n        \"\"\"Inverse of efunc.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the inverse Hubble constant.\n        \"\"\"\n\n        # Avoid the function overhead by repeating code\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * self.de_density_scale(z))**(-0.5)\n\n    def _lookback_time_integrand_scalar(self, z):\n        \"\"\" Integrand of the lookback time.\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        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return self._inv_efunc_scalar(z, *args) / (1.0 + z)\n\n    def lookback_time_integrand(self, z):\n        \"\"\" Integrand of the lookback time.\n\n        Parameters\n        ----------\n        z : float or array-like\n          Input redshift.\n\n        Returns\n        -------\n        I : float or array\n          The integrand for the lookback time\n\n        References\n        ----------\n        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n\n        return self.inv_efunc(z) / zp1\n\n    def _abs_distance_integrand_scalar(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float\n          Input redshift.\n\n        Returns\n        -------\n        X : float\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return (1.0 + z) ** 2 * self._inv_efunc_scalar(z, *args)\n\n    def abs_distance_integrand(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float or array\n          Input redshift.\n\n        Returns\n        -------\n        X : float or array\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n        return zp1 ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity`\n          Hubble parameter at each input redshift.\n        \"\"\"\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        a : ndarray, or float if input scalar\n          Scale factor at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return 1. / (1. + 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\n        Universe now and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar, 0, red)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)\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 : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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 : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar,\n                             red, np.inf)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)\n\n    def critical_density(self, z):\n        \"\"\" Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\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\n        redshift.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc to each input redshift.\n        \"\"\"\n\n        return self._comoving_distance_z1z2(0, z)\n\n    def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\" Comoving line-of-sight distance in Mpc between objects at\n        redshifts z1 and z2.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc between each input redshift.\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda z1, z2: quad(self._inv_efunc_scalar, z1, z2,\n                             args=self._inv_efunc_scalar_args)[0]\n        return self._hubble_distance * vectorize_if_needed(f, z1, z2)\n\n    def comoving_transverse_distance(self, z):\n        \"\"\" 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\n        the same as the comoving distance if omega_k is zero (as in\n        the current concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity also called the 'proper motion distance' in some\n        texts.\n        \"\"\"\n\n        return self._comoving_transverse_distance_z1z2(0, z)\n\n    def _comoving_transverse_distance_z1z2(self, z1, z2):\n        \"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift\n        ``z2`` as seen from redshift ``z1`` corresponding to an\n        angular separation of 1 radian. This is the same as the\n        comoving distance if omega_k is zero (as in the current\n        concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in\n        some texts.\n\n        \"\"\"\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``.\n\n        Weinberg, 1972, pp 421-424; Weedman, 1986, pp 65-67; Peebles,\n        1993, pp 325-327.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Angular diameter distance in Mpc at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self.comoving_transverse_distance(z) / (1. + z)\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\n        bolometric flux from an object at redshift ``z`` and its\n        bolometric luminosity.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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        Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return (1. + z) * 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        Useful for gravitational lensing.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts. z2 must be large than z1.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`, shape (N,) or single if input scalar\n          The angular diameter distance between each input redshift\n          pair.\n\n        \"\"\"\n\n        z1 = np.asanyarray(z1)\n        z2 = np.asanyarray(z2)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (1. + z2)\n\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\n        cross section of absorption and number density intersecting a\n        sightline per unit redshift path.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : float or ndarray\n          Absorption distance (dimensionless) at each input redshift.\n\n        References\n        ----------\n        Hogg 1999 Section 11. (astro-ph/9905116)\n        Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda red: quad(self._abs_distance_integrand_scalar, 0, red)[0]\n        return vectorize_if_needed(f, z)\n\n    def distmod(self, z):\n        \"\"\" Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude -\n        absolute magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity`\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\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        \"\"\" Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less\n        than ``z``. For the case of omega_k = 0 it is a sphere of radius\n        `comoving_distance` but it is less intuitive\n        if omega_k is not 0.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n          Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4. / 3. * 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. * pi * dh ** 3 / (2. * 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\n        that has a sensitivity function that changes with redshift.\n        The total comoving volume is given by integrating\n        differential_comoving_volume to redshift z\n        and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n          Differential comoving volume per redshift per steradian at\n          each input redshift.\"\"\"\n        dh = self._hubble_distance\n        da = self.angular_diameter_distance(z)\n        zp1 = 1.0 + z\n        return dh * ((zp1 * da) ** 2.0) / u.Quantity(self.efunc(z),\n                                                          u.steradian)\n\n    def kpc_comoving_per_arcmin(self, z):\n        \"\"\" Separation in transverse comoving kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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) *\n                arcmin_in_radians / u.arcmin)\n\n    def kpc_proper_per_arcmin(self, z):\n        \"\"\" Separation in transverse proper kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          The distance in proper kpc corresponding to an arcmin at each\n          input redshift.\n        \"\"\"\n        return (self.angular_diameter_distance(z).to(u.kpc) *\n                arcmin_in_radians / u.arcmin)\n\n    def arcsec_per_kpc_comoving(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a comoving kpc\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a comoving kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.comoving_transverse_distance(z).to(u.kpc) *\n                           arcsec_in_radians)\n\n    def arcsec_per_kpc_proper(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a proper kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a proper kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.angular_diameter_distance(z).to(u.kpc) *\n                           arcsec_in_radians)\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\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n\n        # Please see \"Notes about speeding up 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        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 w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = -1`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return -1.0\n        else:\n            return -1.0 * np.ones(np.asanyarray(z).shape)\n\n    def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if np.isscalar(z):\n            return 1.\n        else:\n            return np.ones(np.asanyarray(z).shape)\n\n    def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 /\n        E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0)**(-0.5)\n\n\nclass FlatLambdaCDM(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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        LambdaCDM.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name,\n                           Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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        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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n        return (zp1 ** 3 * (Or * zp1 + Om0) + Ode0)**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Tcmb0={3:.4g}, \"\\\n                 \"Neff={4:.3g}, m_nu={5}, Ob0={6:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n\nclass wCDM(FLRW):\n    \"\"\"FLRW cosmology with a constant dark energy equation of state\n    and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    def __init__(self, H0, Om0, Ode0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state\"\"\"\n        return self._w0\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_0`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return self._w0\n        else:\n            return self._w0 * np.ones(np.asanyarray(z).shape)\n\n    def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        return (1. + z) ** (3. * (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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * zp1 ** (3. * (1. + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, w0={4:.3g}, \"\\\n                 \"Tcmb0={5:.4g}, Neff={6:.3g}, m_nu={7}, Ob0={8:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._Tcmb0, self._Neff,\n                             self.m_nu, _float_or_none(self._Ob0))\n\n\nclass FlatwCDM(wCDM):\n    \"\"\"FLRW cosmology with a constant dark energy equation of state\n    and no spatial curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        wCDM.__init__(self, H0, Om0, 0.0, w0, Tcmb0, Neff, m_nu,\n                      name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) +\n                       Ode0 * zp1 ** (3. * (1 + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return (zp1 ** 3 * (Or * zp1 + Om0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, w0={3:.3g}, Tcmb0={4:.4g}, \"\\\n                 \"Neff={5:.3g}, m_nu={6}, Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n\nclass w0waCDM(FLRW):\n    \"\"\"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 Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, Ode0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wa = float(wa)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0\n\n    @property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in 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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wa * z / (1.0 + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        \"\"\"\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1.0 + z\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * \\\n            np.exp(-3 * self._wa * z / zp1)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wa={5:.3g}, Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wa,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n\nclass Flatw0waCDM(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\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        w0waCDM.__init__(self, H0, Om0, 0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"w0={3:.3g}, Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n\nclass wpwaCDM(FLRW):\n    \"\"\"FLRW cosmology with a CPL dark energy equation of state, a pivot\n    redshift, and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003), but modified\n    to have a pivot redshift as in the findings of the Dark Energy\n    Task Force (Albrecht et al. arXiv:0901.0721 (2009)):\n    :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\n    H0 : float or `~astropy.units.Quantity`\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, optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, Ode0, wp=-1., wa=0., zp=0,\n                 Tcmb0=0, Neff=3.04, m_nu=u.Quantity(0.0, u.eV),\n                 Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._wp = float(wp)\n        self._wa = float(wa)\n        self._zp = float(zp)\n\n        # Please see \"Notes about speeding up integrals\" for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp)\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    @property\n    def wp(self):\n        \"\"\" Dark energy equation of state at the pivot redshift zp\"\"\"\n        return self._wp\n\n    @property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa\n\n    @property\n    def zp(self):\n        \"\"\" The pivot redshift, where w(z) = wp\"\"\"\n        return self._zp\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_p + w_a (a_p - a)` where :math:`a = 1/1+z`\n        and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        apiv = 1.0 / (1.0 + self._zp)\n        return self._wp + self._wa * (apiv - 1.0 / (1. + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        apiv = 1. / (1. + self._zp)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, wp={4:.3g}, \"\\\n                 \"wa={5:.3g}, zp={6:.3g}, Tcmb0={7:.4g}, Neff={8:.3g}, \"\\\n                 \"m_nu={9}, Ob0={10:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._wp, self._wa, self._zp,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n\nclass w0wzCDM(FLRW):\n    \"\"\"FLRW cosmology with a variable dark energy equation of state\n    and curvature.\n\n    The equation for the dark energy equation of state uses the\n    simple form: :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    def __init__(self, H0, Om0, Ode0, w0=-1., wz=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None,\n                 name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wz = float(wz)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0\n\n    @property\n    def wz(self):\n        \"\"\" Derivative of the dark energy equation of state w.r.t. z\"\"\"\n        return self._wz\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is given by\n        :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wz * 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) *\\\n            np.exp(-3. * self._wz * z)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wz={5:.3g} Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wz, self._Tcmb0,\n                             self._Neff, self.m_nu, _float_or_none(self._Ob0))\n\n\ndef _float_or_none(x, digits=3):\n    \"\"\" Helper function to format a variable that can be a float or None\"\"\"\n    if x is None:\n        return str(x)\n    fmtstr = \"{0:.{digits}g}\".format(x, digits=digits)\n    return fmtstr.format(x)\n\n\ndef vectorize_if_needed(func, *x):\n    \"\"\" Helper function to vectorize functions on array inputs\"\"\"\n    if any(map(isiterable, x)):\n        return np.vectorize(func)(*x)\n    else:\n        return func(*x)\n\n\n# Pre-defined cosmologies. This loops over the parameter sets in the\n# parameters module and creates a LambdaCDM or FlatLambdaCDM instance\n# with the same name as the parameter set in the current module's namespace.\n# Note this assumes all the cosmologies in parameters are LambdaCDM,\n# which is true at least as of this writing.\n\nfor key in parameters.available:\n    par = getattr(parameters, key)\n    if par['flat']:\n        cosmo = FlatLambdaCDM(par['H0'], par['Om0'], Tcmb0=par['Tcmb0'],\n                              Neff=par['Neff'],\n                              m_nu=u.Quantity(par['m_nu'], u.eV),\n                              name=key,\n                              Ob0=par['Ob0'])\n        docstr = \"{} instance of FlatLambdaCDM cosmology\\n\\n(from {})\"\n        cosmo.__doc__ = docstr.format(key, par['reference'])\n    else:\n        cosmo = LambdaCDM(par['H0'], par['Om0'], par['Ode0'],\n                          Tcmb0=par['Tcmb0'], Neff=par['Neff'],\n                          m_nu=u.Quantity(par['m_nu'], u.eV), name=key,\n                          Ob0=par['Ob0'])\n        docstr = \"{} instance of LambdaCDM cosmology\\n\\n(from {})\"\n        cosmo.__doc__ = docstr.format(key, par['reference'])\n    setattr(sys.modules[__name__], key, cosmo)\n\n# don't leave these variables floating around in the namespace\ndel key, par, cosmo\n\n#########################################################################\n# The science state below contains the current cosmology.\n#########################################################################\n\n\nclass default_cosmology(ScienceState):\n    \"\"\"\n    The default cosmology to use.  To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n    \"\"\"\n    _value = 'WMAP9'\n\n    @staticmethod\n    def get_cosmology_from_string(arg):\n        \"\"\" Return a cosmology instance from a string.\n        \"\"\"\n        if arg == 'no_default':\n            cosmo = None\n        else:\n            try:\n                cosmo = getattr(sys.modules[__name__], arg)\n            except AttributeError:\n                s = \"Unknown cosmology '{}'. Valid cosmologies:\\n{}\".format(\n                    arg, parameters.available)\n                raise ValueError(s)\n        return cosmo\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = 'Planck15'\n        if isinstance(value, str):\n            return cls.get_cosmology_from_string(value)\n        elif isinstance(value, Cosmology):\n            return value\n        else:\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance.\")\n"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":55,"id":11083,"name":"m_e","nodeType":"Attribute","startLoc":55,"text":"m_e"},{"attributeType":"IAU2015","col":0,"comment":"null","endLoc":93,"id":11084,"name":"R_earth","nodeType":"Attribute","startLoc":93,"text":"R_earth"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":58,"id":11085,"name":"u","nodeType":"Attribute","startLoc":58,"text":"u"},{"col":0,"comment":"","endLoc":5,"header":"iau2015.py#<anonymous>","id":11086,"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.tan(np.radians(1. / 3600.)), 'm',\n              au.uncertainty / np.tan(np.radians(1. / 3600.)),\n              \"Derived from au\", system='si')\n\nkpc = IAU2015('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 = 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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_sun.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_jup.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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 / G.value,\n                 'kg', ((G.uncertainty / G.value) *\n                        (GM_earth.value / G.value)),\n                 \"IAU 2015 Resolution B 3 + CODATA 2014\", 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')"},{"col":4,"comment":"null","endLoc":835,"header":"@classmethod\n    def evaluate(cls, x, y, lam)","id":11087,"name":"evaluate","nodeType":"Function","startLoc":833,"text":"@classmethod\n    def evaluate(cls, x, y, lam):\n        return _projections.ceax2s(x, y, lam)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":827,"id":11088,"name":"lam","nodeType":"Attribute","startLoc":827,"text":"lam"},{"id":11089,"name":"astropy/cosmology/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/cosmology/tests","id":11090,"nodeType":"File","text":""},{"id":11091,"name":"astropy/convolution","nodeType":"Package"},{"id":11092,"name":"boundary_fill.pyx","nodeType":"TextFile","path":"astropy/convolution","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\ncimport numpy as np\n\n\nDTYPE = float\nctypedef np.float_t DTYPE_t\n\ncdef extern from \"numpy/npy_math.h\" nogil:\n    bint npy_isnan(double x)\n\ncimport cython\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve1d_boundary_fill(np.ndarray[DTYPE_t, ndim=1] f,\n                             np.ndarray[DTYPE_t, ndim=1] g,\n                             float fill_value,\n                             bint normalize_by_kernel\n                            ):\n\n    if g.shape[0] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int nkx = g.shape[0]\n    cdef int wkx = nkx // 2\n    cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE)\n    cdef unsigned int i, iii\n    cdef int ii\n\n    cdef int iimin, iimax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            top = 0.\n            bot = 0.\n            iimin = i - wkx\n            iimax = i + wkx + 1\n            for ii in range(iimin, iimax):\n                if ii < 0 or ii > nx - 1:\n                    val = fill_value\n                else:\n                    val = f[ii]\n                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i))]\n                if not npy_isnan(val):\n                    top += val * ker\n                    bot += ker\n            if normalize_by_kernel:\n                if bot == 0:\n                    conv[i] = f[i]\n                else:\n                    conv[i] = top / bot\n            else:\n                conv[i] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve2d_boundary_fill(np.ndarray[DTYPE_t, ndim=2] f,\n                             np.ndarray[DTYPE_t, ndim=2] g,\n                             float fill_value,\n                             bint normalize_by_kernel\n                            ):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE)\n    cdef unsigned int i, j, iii, jjj\n    cdef int ii, jj\n\n    cdef int iimin, iimax, jjmin, jjmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                top = 0.\n                bot = 0.\n                iimin = i - wkx\n                iimax = i + wkx + 1\n                jjmin = j - wky\n                jjmax = j + wky + 1\n                for ii in range(iimin, iimax):\n                    for jj in range(jjmin, jjmax):\n                        if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1:\n                            val = fill_value\n                        else:\n                            val = f[ii, jj]\n                        ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                <unsigned int>(nky - 1 - (wky + jj - j))]\n                        if not npy_isnan(val):\n                            top += val * ker\n                            bot += ker\n                if normalize_by_kernel:\n                    if bot == 0:\n                        conv[i, j] = f[i, j]\n                    else:\n                        conv[i, j] = top / bot\n                else:\n                    conv[i, j] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve3d_boundary_fill(np.ndarray[DTYPE_t, ndim=3] f,\n                             np.ndarray[DTYPE_t, ndim=3] g,\n                             float fill_value,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nz = f.shape[2]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int nkz = g.shape[2]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef int wkz = nkz // 2\n    cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE)\n    cdef unsigned int i, j, k, iii, jjj, kkk\n    cdef int ii, jj, kk\n\n    cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                for k in range(nz):\n                    top = 0.\n                    bot = 0.\n                    iimin = i - wkx\n                    iimax = i + wkx + 1\n                    jjmin = j - wky\n                    jjmax = j + wky + 1\n                    kkmin = k - wkz\n                    kkmax = k + wkz + 1\n                    for ii in range(iimin, iimax):\n                        for jj in range(jjmin, jjmax):\n                            for kk in range(kkmin, kkmax):\n                                if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1:\n                                    val = fill_value\n                                else:\n                                    val = f[ii, jj, kk]\n                                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                        <unsigned int>(nky - 1 - (wky + jj - j)),\n                                        <unsigned int>(nkz - 1 - (wkz + kk - k))]\n                                if not npy_isnan(val):\n                                    top += val * ker\n                                    bot += ker\n                    if normalize_by_kernel:\n                        if bot == 0:\n                            conv[i, j, k] = f[i, j, k]\n                        else:\n                            conv[i, j, k] = top / bot\n                    else:\n                        conv[i, j, k] = top\n    # GIl acquired again here\n    return conv\n"},{"col":4,"comment":"null","endLoc":759,"header":"@staticmethod\n    def clenshaw(x, coeffs)","id":11093,"name":"clenshaw","nodeType":"Function","startLoc":742,"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 : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":740,"header":"def fit_deriv(self, x, *params)","id":11094,"name":"fit_deriv","nodeType":"Function","startLoc":716,"text":"def fit_deriv(self, x, *params):\n        \"\"\"\n        Computes the Vandermonde matrix.\n\n        Parameters\n        ----------\n        x : ndarray\n            input\n        params : throw away parameter\n            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)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":61,"id":11095,"name":"sigma_sb","nodeType":"Attribute","startLoc":61,"text":"sigma_sb"},{"fileName":"convolve.py","filePath":"astropy/convolution","id":11096,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport warnings\n\nimport numpy as np\nfrom functools import partial\n\nfrom .core import Kernel, Kernel1D, Kernel2D, MAX_NORMALIZATION\nfrom ..utils.exceptions import AstropyUserWarning\nfrom ..utils.console import human_file_size\nfrom ..utils.decorators import deprecated_renamed_argument\nfrom .. import units as u\nfrom ..nddata import support_nddata\nfrom ..modeling.core import _make_arithmetic_operator, BINARY_OPERATORS\nfrom ..modeling.core import _CompoundModelMeta\n\n\n\n# Disabling all doctests in this module until a better way of handling warnings\n# in doctests can be determined\n__doctest_skip__ = ['*']\n\nBOUNDARY_OPTIONS = [None, 'fill', 'wrap', 'extend']\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 : `numpy.ndarray` or `~astropy.nddata.NDData`\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 (default).\n            * 'fill'\n                Set values outside the array boundary to ``fill_value``.\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 prior to\n        convolving\n    nan_treatment : 'interpolate', 'fill'\n        interpolate will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.\n        'fill' will replace the NaN pixels with a fixed numerical value (default\n        zero, see ``fill_value``) prior to convolution\n        Note that if the kernel has a sum equal to zero, NaN interpolation\n        is not possible and will raise an exception\n    preserve_nan : bool\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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    from .boundary_none import (convolve1d_boundary_none,\n                                convolve2d_boundary_none,\n                                convolve3d_boundary_none)\n\n    from .boundary_extend import (convolve1d_boundary_extend,\n                                  convolve2d_boundary_extend,\n                                  convolve3d_boundary_extend)\n\n    from .boundary_fill import (convolve1d_boundary_fill,\n                                convolve2d_boundary_fill,\n                                convolve3d_boundary_fill)\n\n    from .boundary_wrap import (convolve1d_boundary_wrap,\n                                convolve2d_boundary_wrap,\n                                convolve3d_boundary_wrap)\n\n    if boundary not in BOUNDARY_OPTIONS:\n        raise ValueError(\"Invalid boundary option: must be one of {0}\"\n                         .format(BOUNDARY_OPTIONS))\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # The cython 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\n    # Check if kernel is kernel instance\n    if isinstance(kernel, Kernel):\n        # Check if array is also kernel instance, if so convolve and\n        # return new kernel instance\n        if isinstance(array, Kernel):\n            if isinstance(array, Kernel1D) and isinstance(kernel, Kernel1D):\n                new_array = convolve1d_boundary_fill(array.array, kernel.array,\n                                                     0, True)\n                new_kernel = Kernel1D(array=new_array)\n            elif isinstance(array, Kernel2D) and isinstance(kernel, Kernel2D):\n                new_array = convolve2d_boundary_fill(array.array, kernel.array,\n                                                     0, True)\n                new_kernel = Kernel2D(array=new_array)\n            else:\n                raise Exception(\"Can't convolve 1D and 2D kernel.\")\n            new_kernel._separable = kernel._separable and array._separable\n            new_kernel._is_bool = False\n            return new_kernel\n        kernel = kernel.array\n\n    # Check that the arguments are lists or Numpy arrays\n\n    if isinstance(array, list):\n        array_internal = np.array(array, dtype=float)\n        array_dtype = array_internal.dtype\n    elif isinstance(array, np.ndarray):\n        # Note this won't copy if it doesn't have to -- which is okay\n        # because none of what follows modifies array_internal.\n        array_dtype = array.dtype\n        array_internal = array.astype(float, copy=False)\n    else:\n        raise TypeError(\"array should be a list or a Numpy array\")\n\n    if isinstance(kernel, list):\n        kernel_internal = np.array(kernel, dtype=float)\n    elif isinstance(kernel, np.ndarray):\n        # Note this always makes a copy, since we will be modifying it\n        kernel_internal = kernel.astype(float)\n    else:\n        raise TypeError(\"kernel should be a list or a Numpy array\")\n\n    # Check that the number of dimensions is compatible\n    if array_internal.ndim != kernel_internal.ndim:\n        raise Exception('array and kernel have differing number of '\n                        'dimensions.')\n\n    # anything that's masked must be turned into NaNs for the interpolation.\n    # This requires copying the array_internal\n    array_internal_copied = False\n    if np.ma.is_masked(array):\n        array_internal = array_internal.filled(np.nan)\n        array_internal_copied = True\n    if mask is not None:\n        if not array_internal_copied:\n            array_internal = array_internal.copy()\n            array_internal_copied = True\n        # mask != 0 yields a bool mask for all ints/floats/bool\n        array_internal[mask != 0] = np.nan\n    if np.ma.is_masked(kernel):\n        # *kernel* doesn't support NaN interpolation, so instead we just fill it\n        kernel_internal = kernel.filled(fill_value)\n\n    # Mark the NaN values so we can replace them later if interpolate_nan is\n    # not set\n    if preserve_nan:\n        badvals = np.isnan(array_internal)\n\n    if nan_treatment == 'fill':\n        initially_nan = np.isnan(array_internal)\n        array_internal[initially_nan] = fill_value\n\n    # Because the Cython routines have to normalize the kernel on the fly, we\n    # explicitly normalize the kernel here, and then scale the image at the\n    # end if normalization was not requested.\n    kernel_sum = kernel_internal.sum()\n    kernel_sums_to_zero = np.isclose(kernel_sum, 0, atol=normalization_zero_tol)\n\n    if (kernel_sum < 1. / MAX_NORMALIZATION or kernel_sums_to_zero) and normalize_kernel:\n        raise Exception(\"The kernel can't be normalized, because its sum is \"\n                        \"close to zero. The sum of the given kernel is < {0}\"\n                        .format(1. / MAX_NORMALIZATION))\n\n    if not kernel_sums_to_zero:\n        kernel_internal /= kernel_sum\n    else:\n        kernel_internal = kernel\n\n    renormalize_by_kernel = not kernel_sums_to_zero\n\n    if array_internal.ndim == 0:\n        raise Exception(\"cannot convolve 0-dimensional arrays\")\n    elif array_internal.ndim == 1:\n        if boundary == 'extend':\n            result = convolve1d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel)\n        elif boundary == 'fill':\n            result = convolve1d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel)\n        elif boundary == 'wrap':\n            result = convolve1d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n        elif boundary is None:\n            result = convolve1d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n    elif array_internal.ndim == 2:\n        if boundary == 'extend':\n            result = convolve2d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel,\n                                               )\n        elif boundary == 'fill':\n            result = convolve2d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel,\n                                             )\n        elif boundary == 'wrap':\n            result = convolve2d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel,\n                                             )\n        elif boundary is None:\n            result = convolve2d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel,\n                                             )\n    elif array_internal.ndim == 3:\n        if boundary == 'extend':\n            result = convolve3d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel)\n        elif boundary == 'fill':\n            result = convolve3d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel)\n        elif boundary == 'wrap':\n            result = convolve3d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n        elif boundary is None:\n            result = convolve3d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n    else:\n        raise NotImplementedError('convolve only supports 1, 2, and 3-dimensional '\n                                  'arrays at this time')\n\n    # If normalization was not requested, we need to scale the array (since\n    # the kernel is effectively normalized within the cython functions)\n    if not normalize_kernel and not kernel_sums_to_zero:\n        result *= kernel_sum\n\n    if preserve_nan:\n        result[badvals] = np.nan\n\n    if nan_treatment == 'fill':\n        array_internal[initially_nan] = np.nan\n\n    # Try to preserve the input type if it's a floating point type\n    if array_dtype.kind == 'f':\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@deprecated_renamed_argument('interpolate_nan', 'nan_treatment', 'v2.0.0')\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, quiet=False,\n                 min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex):\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    * (optionally) It pads to the nearest 2^n size to improve FFT speed.\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.python.org/pypi/pyFFTW>`_ or\n      `pyFFTW3 <https://pypi.python.org/pypi/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.fft` and `numpy.fft.ifft`.\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'\n        ``interpolate`` will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.  ``fill`` will replace the NaN pixels with a fixed\n        numerical value (default zero, see ``fill_value``) prior to\n        convolution.  Note that if the kernel has a sum equal to zero, NaN\n        interpolation is not possible and will raise an exception.\n    normalize_kernel : function 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\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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\n\n    Other Parameters\n    ----------------\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    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest 2^n.  With\n        ``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    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    fftn, ifftn : functions, optional\n        The fft and inverse fft functions.  Can be overridden to use your own\n        ffts, e.g. an fftw3 wrapper or scipy's fftn,\n        ``fft=scipy.fftpack.fftn``\n    complex_dtype : numpy.complex, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    quiet : bool, optional\n        Silence warning message about NaN interpolation\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\n    Raises\n    ------\n    ValueError:\n        If the array is bigger than 1 GB after padding, will raise this exception\n        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    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    Notes\n    -----\n        With ``psf_pad=True`` and a large PSF, the resulting data can become\n        very large and consume a lot of memory.  See Issue\n        https://github.com/astropy/astropy/pull/4366 for further detail.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])\n    array([ 1.,  0.,  3.])\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    ...\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([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([ 1.,  2.,  3.])\n\n    >>> import scipy.fftpack  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fftpack.fft, ifftn=scipy.fftpack.ifft)\n    array([ 1.,  2.,  3.])\n\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.  \"\n                            \"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    # Convert array dtype to complex\n    # and ensure that list inputs become arrays\n    array = np.asarray(array, dtype=complex)\n    kernel = np.asarray(kernel, dtype=complex)\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 \"\n                         \"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(\"Size Error: Arrays will be {}.  Use \"\n                         \"allow_huge=True to override this exception.\"\n                         .format(human_file_size(array_size_B.to_value(u.byte))))\n\n    # mask catching - masks must be turned into NaNs for use later in the image\n    if np.ma.is_masked(array):\n        mamask = array.mask\n        array = np.array(array)\n        array[mamask] = np.nan\n    elif mask is not None:\n        # copying here because we have to mask it below.  But no need to copy\n        # if mask is None because we won't modify it.\n        array = np.array(array)\n    if mask is not None:\n        # mask != 0 yields a bool mask for all ints/floats/bool\n        array[mask != 0] = np.nan\n    # the *kernel* doesn't support NaN interpolation, so instead we just fill it\n    if np.ma.is_masked(kernel):\n        kernel = kernel.filled(0)\n\n    # NaN and inf catching\n    nanmaskarray = np.isnan(array) | np.isinf(array)\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 < {0}\"\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(\"psf_pad was set to {0}, which overrides the \"\n                          \"boundary='fill' setting.\".format(psf_pad),\n                          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        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    # find ideal size (power of 2) for fft.\n    # Can add shapes because they are tuples\n    if fft_pad:  # default=True\n        if psf_pad:  # default=False\n            # add the dimensions and then take the max (bigger)\n            fsize = 2 ** np.ceil(np.log2(\n                np.max(np.array(arrayshape) + np.array(kernshape))))\n        else:\n            # add the shape lists (max of a list of length 4) (smaller)\n            # also makes the shapes square\n            fsize = 2 ** np.ceil(np.log2(np.max(arrayshape + kernshape)))\n        newshape = np.array([fsize for ii in range(array.ndim)], dtype=int)\n    else:\n        if psf_pad:\n            # just add the biggest dimensions\n            newshape = np.array(arrayshape) + np.array(kernshape)\n        else:\n            newshape = np.array([np.max([imsh, kernsh])\n                                 for imsh, kernsh in zip(arrayshape, kernshape)])\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(\"Size Error: Arrays will be {}.  Use \"\n                         \"allow_huge=True to override this exception.\"\n                         .format(human_file_size(array_size_C)))\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\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        # curiously, at the floating-point limit, can get slightly negative numbers\n        # they break the min_wt=0 \"flag\" and must therefore be removed\n        bigimwt[bigimwt < 0] = 0\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    # restore NaNs in original image (they were modified inplace earlier)\n    # We don't have to worry about masked arrays - if input was masked, it was\n    # copied\n    array[nanmaskarray] = np.nan\n    kernel[nanmaskkernel] = np.nan\n\n    fftmult *= kernel_scale\n\n    if return_fft:\n        return fftmult\n\n    if interpolate_nan:\n        rifft = (ifftn(fftmult)) / bigimwt\n        if not np.isscalar(bigimwt):\n            rifft[bigimwt < min_wt] = np.nan\n            if min_wt == 0.0:\n                rifft[bigimwt == 0.0] = 0.0\n    else:\n        rifft = (ifftn(fftmult))\n\n    if preserve_nan:\n        rifft[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, **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 : CompoundModel\n        Convolved model\n    \"\"\"\n\n    if mode == 'convolve_fft':\n        BINARY_OPERATORS['convolve_fft'] = _make_arithmetic_operator(partial(convolve_fft, **kwargs))\n    elif mode == 'convolve':\n        BINARY_OPERATORS['convolve'] = _make_arithmetic_operator(partial(convolve, **kwargs))\n    else:\n        raise ValueError('Mode {} is not supported.'.format(mode))\n\n    return _CompoundModelMeta._from_operator(mode, model, kernel)\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":691,"id":11097,"name":"inputs","nodeType":"Attribute","startLoc":691,"text":"inputs"},{"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":865,"id":11098,"nodeType":"Class","startLoc":841,"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\n    lam = Parameter(default=1)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_CylindricalEqualArea(self.lam)\n\n    @classmethod\n    def evaluate(cls, phi, theta, lam):\n        return _projections.ceas2x(phi, theta, lam)"},{"col":4,"comment":"null","endLoc":861,"header":"@property\n    def inverse(self)","id":11099,"name":"inverse","nodeType":"Function","startLoc":859,"text":"@property\n    def inverse(self):\n        return Pix2Sky_CylindricalEqualArea(self.lam)"},{"attributeType":"null","col":4,"comment":"null","endLoc":692,"id":11100,"name":"outputs","nodeType":"Attribute","startLoc":692,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":693,"id":11101,"name":"_separable","nodeType":"Attribute","startLoc":693,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":697,"id":11102,"name":"domain","nodeType":"Attribute","startLoc":697,"text":"self.domain"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":64,"id":11103,"name":"e","nodeType":"Attribute","startLoc":64,"text":"e"},{"col":4,"comment":"null","endLoc":865,"header":"@classmethod\n    def evaluate(cls, phi, theta, lam)","id":11104,"name":"evaluate","nodeType":"Function","startLoc":863,"text":"@classmethod\n    def evaluate(cls, phi, theta, lam):\n        return _projections.ceas2x(phi, theta, lam)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":857,"id":11105,"name":"lam","nodeType":"Attribute","startLoc":857,"text":"lam"},{"attributeType":"null","col":8,"comment":"null","endLoc":698,"id":11106,"name":"window","nodeType":"Attribute","startLoc":698,"text":"self.window"},{"className":"Cosmology","col":0,"comment":" Placeholder for when a more general Cosmology class is\n    implemented. ","endLoc":88,"id":11107,"nodeType":"Class","startLoc":86,"text":"class Cosmology:\n    \"\"\" Placeholder for when a more general Cosmology class is\n    implemented. \"\"\""},{"className":"FLRW","col":0,"comment":" A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you can't instantiate\n    examples of this class, but must work with one of its\n    subclasses such as `LambdaCDM` or `wCDM`.\n\n    Parameters\n    ----------\n\n    H0 : float or scalar `~astropy.units.Quantity`\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\n        massive 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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\n\n    Notes\n    -----\n    Class instances are static -- you can't change the values\n    of the parameters.  That is, all of the attributes above are\n    read only.\n    ","endLoc":1488,"id":11108,"nodeType":"Class","startLoc":91,"text":"class FLRW(Cosmology, metaclass=ABCMeta):\n    \"\"\" A class describing an isotropic and homogeneous\n    (Friedmann-Lemaitre-Robertson-Walker) cosmology.\n\n    This is an abstract base class -- you can't instantiate\n    examples of this class, but must work with one of its\n    subclasses such as `LambdaCDM` or `wCDM`.\n\n    Parameters\n    ----------\n\n    H0 : float or scalar `~astropy.units.Quantity`\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\n        massive 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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\n\n    Notes\n    -----\n    Class instances are static -- you can't change the values\n    of the parameters.  That is, all of the attributes above are\n    read only.\n    \"\"\"\n\n    def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        # all densities are in units of the critical density\n        self._Om0 = float(Om0)\n        if self._Om0 < 0.0:\n            raise ValueError(\"Matter density can not be negative\")\n        self._Ode0 = float(Ode0)\n        if Ob0 is not None:\n            self._Ob0 = float(Ob0)\n            if self._Ob0 < 0.0:\n                raise ValueError(\"Baryonic density can not be negative\")\n            if self._Ob0 > self._Om0:\n                raise ValueError(\"Baryonic density can not be larger than \"\n                                 \"total matter density\")\n            self._Odm0 = self._Om0 - self._Ob0\n        else:\n            self._Ob0 = None\n            self._Odm0 = None\n\n        self._Neff = float(Neff)\n        if self._Neff < 0.0:\n            raise ValueError(\"Effective number of neutrinos can \"\n                             \"not be negative\")\n        self.name = name\n\n        # Tcmb may have units\n        self._Tcmb0 = u.Quantity(Tcmb0, unit=u.K)\n        if not self._Tcmb0.isscalar:\n            raise ValueError(\"Tcmb0 is a non-scalar quantity\")\n\n        # Hubble parameter at z=0, km/s/Mpc\n        self._H0 = u.Quantity(H0, unit=u.km / u.s / u.Mpc)\n        if not self._H0.isscalar:\n            raise ValueError(\"H0 is a non-scalar quantity\")\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1; don't use units for speed\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time; again, avoiding units package for speed\n        self._hubble_time = u.Quantity(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 = u.Quantity(cd0value, u.g / u.cm ** 3)\n\n        # Load up neutrino masses.  Note: in Py2.x, floor is floating\n        self._nneutrinos = int(floor(self._Neff))\n\n        # We are going to share Neff between the neutrinos equally.\n        # In detail this is not correct, but it is a standard assumption\n        # because properly calculating it is a) complicated b) depends\n        # on the details of the massive neutrinos (e.g., their weak\n        # interactions, which could be unusual if one is considering sterile\n        # neutrinos)\n        self._massivenu = False\n        if self._nneutrinos > 0 and self._Tcmb0.value > 0:\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # We can't use the u.Quantity constructor as we do above\n            # because it doesn't understand equivalencies\n            if not isinstance(m_nu, u.Quantity):\n                raise ValueError(\"m_nu must be a Quantity\")\n\n            m_nu = m_nu.to(u.eV, equivalencies=u.mass_energy())\n\n            # Now, figure out if we have massive neutrinos to deal with,\n            # and, if so, get the right number of masses\n            # It is worth the effort to keep track of massless ones separately\n            # (since they are quite easy to deal with, and a common use case\n            # is to set only one neutrino to have mass)\n            if m_nu.isscalar:\n                # Assume all neutrinos have the same mass\n                if m_nu.value == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    self._nmasslessnu = 0\n                    self._nmassivenu = self._nneutrinos\n                    self._massivenu_mass = (m_nu.value *\n                                            np.ones(self._nneutrinos))\n            else:\n                # Make sure we have the right number of masses\n                # -unless- they are massless, in which case we cheat a little\n                if m_nu.value.min() < 0:\n                    raise ValueError(\"Invalid (negative) neutrino mass\"\n                                     \" encountered\")\n                if m_nu.value.max() == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    if len(m_nu) != self._nneutrinos:\n                        errstr = \"Unexpected number of neutrino masses\"\n                        raise ValueError(errstr)\n                    # Segregate out the massless ones\n                    self._nmasslessnu = len(np.nonzero(m_nu.value == 0)[0])\n                    self._nmassivenu = self._nneutrinos - self._nmasslessnu\n                    w = np.nonzero(m_nu.value > 0)[0]\n                    self._massivenu_mass = m_nu[w]\n\n        # Compute photon density, Tcmb, neutrino parameters\n        # Tcmb0=0 removes both photons and neutrinos, is handled\n        # as a special case for efficiency\n        if self._Tcmb0.value > 0:\n            # Compute photon density from Tcmb\n            self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 /\\\n                self._critical_density0.value\n\n            # Compute Neutrino temperature\n            # The constant in front is (4/11)^1/3 -- see any\n            #  cosmology book for an explanation -- for example,\n            #  Weinberg 'Cosmology' p 154 eq (3.1.21)\n            self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n            # Compute Neutrino Omega and total relativistic component\n            # for massive neutrinos.  We also store a list version,\n            # since that is more efficient to do integrals with (perhaps\n            # surprisingly!  But small python lists are more efficient\n            # than small numpy arrays).\n            if self._massivenu:\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\n                # The 0.2271... is 7/8 (4/11)^(4/3) -- the temperature\n                # bit ^4 (blackbody energy density) times 7/8 for\n                # FD vs. BE statistics.\n                self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n\n        else:\n            self._Ogamma0 = 0.0\n            self._Tnu0 = u.Quantity(0.0, u.K)\n            self._Onu0 = 0.0\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    def _namelead(self):\n        \"\"\" Helper function for constructing __repr__\"\"\"\n        if self.name is None:\n            return \"{0}(\".format(self.__class__.__name__)\n        else:\n            return \"{0}(name=\\\"{1}\\\", \".format(self.__class__.__name__,\n                                               self.name)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, \"\\\n                 \"Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))\n\n    # Set up a set of properties for H0, Om0, Ode0, Ok0, etc. for user access.\n    # Note that we don't let these be set (so, obj.Om0 = value fails)\n\n    @property\n    def H0(self):\n        \"\"\" Return the Hubble constant as an `~astropy.units.Quantity` at z=0\"\"\"\n        return self._H0\n\n    @property\n    def Om0(self):\n        \"\"\" Omega matter; matter density/critical density at z=0\"\"\"\n        return self._Om0\n\n    @property\n    def Ode0(self):\n        \"\"\" Omega dark energy; dark energy density/critical density at z=0\"\"\"\n        return self._Ode0\n\n    @property\n    def Ob0(self):\n        \"\"\" Omega baryon; baryonic matter density/critical density at z=0\"\"\"\n        return self._Ob0\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\n        at z=0\"\"\"\n        return self._Ok0\n\n    @property\n    def Tcmb0(self):\n        \"\"\" Temperature of the CMB as `~astropy.units.Quantity` at z=0\"\"\"\n        return self._Tcmb0\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 Neff(self):\n        \"\"\" Number of effective neutrino species\"\"\"\n        return self._Neff\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 m_nu(self):\n        \"\"\" Mass of neutrino species\"\"\"\n        if self._Tnu0.value == 0:\n            return None\n        if not self._massivenu:\n            # Only massless\n            return u.Quantity(np.zeros(self._nmasslessnu), u.eV)\n        if self._nmasslessnu == 0:\n            # Only massive\n            return u.Quantity(self._massivenu_mass, u.eV)\n        # A mix -- the most complicated case\n        numass = np.append(np.zeros(self._nmasslessnu),\n                           self._massivenu_mass.value)\n        return u.Quantity(numass, u.eV)\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    def clone(self, **kwargs):\n        \"\"\" Returns a copy of this object, potentially with some changes.\n\n        Returns\n        -------\n        newcos : Subclass of FLRW\n        A new instance of this class with the specified changes.\n\n        Notes\n        -----\n        This assumes that the values of all constructor arguments\n        are available as properties, which is true of all the provided\n        subclasses but may not be true of user-provided ones.  You can't\n        change the type of class, so this can't be used to change between\n        flat and non-flat.  If no modifications are requested, then\n        a reference to this object is returned.\n\n        Examples\n        --------\n        To make a copy of the Planck13 cosmology with a different Omega_m\n        and a new name:\n\n        >>> from astropy.cosmology import Planck13\n        >>> newcos = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n        \"\"\"\n\n        # Quick return check, taking advantage of the\n        # immutability of cosmological objects\n        if len(kwargs) == 0:\n            return self\n\n        # Get constructor arguments\n        arglist = signature(self.__init__).parameters.keys()\n\n        # Build the dictionary of values used to construct this\n        #  object.  This -assumes- every argument to __init__ has a\n        #  property.  This is true of all the classes we provide, but\n        #  maybe a user won't do that.  So at least try to have a useful\n        #  error message.\n        argdict = {}\n        for arg in arglist:\n            try:\n                val = getattr(self, arg)\n                argdict[arg] = val\n            except AttributeError:\n                # We didn't find a property -- complain usefully\n                errstr = \"Object did not have property corresponding \"\\\n                         \"to constructor argument '{}'; perhaps it is a \"\\\n                         \"user provided subclass that does not do so\"\n                raise AttributeError(errstr.format(arg))\n\n        # Now substitute in new arguments\n        for newarg in kwargs:\n            if newarg not in argdict:\n                errstr = \"User provided argument '{}' not found in \"\\\n                         \"constructor for this object\"\n                raise AttributeError(errstr.format(newarg))\n            argdict[newarg] = kwargs[newarg]\n\n        return self.__class__(**argdict)\n\n    @abstractmethod\n    def w(self, z):\n        \"\"\" The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")\n\n    def Om(self, z):\n        \"\"\" Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Om : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest; see `Onu`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Om0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ob : ndarray, or float if input scalar\n          The density of baryonic matter relative to the critical density at\n          each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        \"\"\"\n\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ob0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Odm : ndarray, or float if input scalar\n          The density of non-relativistic dark matter relative to the critical\n          density at each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest.\n        \"\"\"\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        if isiterable(z):\n            z = np.asarray(z)\n        return self._Odm0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2\n\n    def Ok(self, z):\n        \"\"\" Return the equivalent density parameter for curvature\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ok : ndarray, or float if input scalar\n          The equivalent density parameter for curvature at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common enough case to be worth checking explicitly\n            if self._Ok0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ok0 == 0:\n                return 0.0\n\n        return self._Ok0 * (1. + z) ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ode : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common case worth checking\n            if self._Ode0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ode0 == 0:\n                return 0.0\n\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ogamma : ndarray, or float if input scalar\n          The energy density of photons relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ogamma0 * (1. + z) ** 4 * self.inv_efunc(z) ** 2\n\n    def Onu(self, z):\n        \"\"\" Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Onu : ndarray, or float if input scalar\n          The energy density of neutrinos relative to the critical\n          density at each redshift.  Note that this includes their\n          kinetic energy (if they have mass), so it is not equal to\n          the commonly used :math:`\\\\sum \\\\frac{m_{\\\\nu}}{94 eV}`,\n          which does not include kinetic energy.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            if self._Onu0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Onu0 == 0:\n                return 0.0\n\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity`\n          The temperature of the CMB in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tcmb0 * (1. + z)\n\n    def Tnu(self, z):\n        \"\"\" Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity`\n          The temperature of the cosmic neutrino background in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tnu0 * (1. + z)\n\n    def nu_relative_density(self, z):\n        \"\"\" Neutrino density function relative to the energy density in\n        photons.\n\n        Parameters\n        ----------\n        z : array like\n           Redshift\n\n        Returns\n        -------\n         f : ndarray, or float if z is scalar\n           The neutrino density scaling factor relative to the density\n           in photons at each redshift\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\n        for each one. Note that f has the asymptotic behavior :math:`f(0) = 1`.\n        This method returns :math:`0.2271 f` using an\n        analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\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        if not self._massivenu:\n            if np.isscalar(z):\n                return prefac * self._Neff\n            else:\n                return prefac * self._Neff * np.ones(np.asanyarray(z).shape)\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        z = np.asarray(z)\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.\"\"\"\n\n        # See Linder 2003, PRL 90, 91301 eq (5)\n        # Assumes scalar input, since this should only be called\n        # inside an integral\n\n        z = exp(ln1pz) - 1.0\n        return 1.0 + self.w(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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        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\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        #\n        # The integral we actually use (the one given in Linder)\n        # is rewritten in terms of z, so looks slightly different than the\n        # one in the documentation string, but it's the same thing.\n\n        from scipy.integrate import quad\n\n        if isiterable(z):\n            z = np.asarray(z)\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:\n            ival = quad(self._w_integrand, 0, log(1 + z))[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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * self.de_density_scale(z))\n\n    def inv_efunc(self, z):\n        \"\"\"Inverse of efunc.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the inverse Hubble constant.\n        \"\"\"\n\n        # Avoid the function overhead by repeating code\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * self.de_density_scale(z))**(-0.5)\n\n    def _lookback_time_integrand_scalar(self, z):\n        \"\"\" Integrand of the lookback time.\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        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return self._inv_efunc_scalar(z, *args) / (1.0 + z)\n\n    def lookback_time_integrand(self, z):\n        \"\"\" Integrand of the lookback time.\n\n        Parameters\n        ----------\n        z : float or array-like\n          Input redshift.\n\n        Returns\n        -------\n        I : float or array\n          The integrand for the lookback time\n\n        References\n        ----------\n        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n\n        return self.inv_efunc(z) / zp1\n\n    def _abs_distance_integrand_scalar(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float\n          Input redshift.\n\n        Returns\n        -------\n        X : float\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return (1.0 + z) ** 2 * self._inv_efunc_scalar(z, *args)\n\n    def abs_distance_integrand(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float or array\n          Input redshift.\n\n        Returns\n        -------\n        X : float or array\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n        return zp1 ** 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity`\n          Hubble parameter at each input redshift.\n        \"\"\"\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        a : ndarray, or float if input scalar\n          Scale factor at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return 1. / (1. + 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\n        Universe now and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar, 0, red)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)\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 : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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 : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar,\n                             red, np.inf)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)\n\n    def critical_density(self, z):\n        \"\"\" Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\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\n        redshift.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc to each input redshift.\n        \"\"\"\n\n        return self._comoving_distance_z1z2(0, z)\n\n    def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\" Comoving line-of-sight distance in Mpc between objects at\n        redshifts z1 and z2.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc between each input redshift.\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda z1, z2: quad(self._inv_efunc_scalar, z1, z2,\n                             args=self._inv_efunc_scalar_args)[0]\n        return self._hubble_distance * vectorize_if_needed(f, z1, z2)\n\n    def comoving_transverse_distance(self, z):\n        \"\"\" 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\n        the same as the comoving distance if omega_k is zero (as in\n        the current concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity also called the 'proper motion distance' in some\n        texts.\n        \"\"\"\n\n        return self._comoving_transverse_distance_z1z2(0, z)\n\n    def _comoving_transverse_distance_z1z2(self, z1, z2):\n        \"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift\n        ``z2`` as seen from redshift ``z1`` corresponding to an\n        angular separation of 1 radian. This is the same as the\n        comoving distance if omega_k is zero (as in the current\n        concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in\n        some texts.\n\n        \"\"\"\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``.\n\n        Weinberg, 1972, pp 421-424; Weedman, 1986, pp 65-67; Peebles,\n        1993, pp 325-327.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Angular diameter distance in Mpc at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self.comoving_transverse_distance(z) / (1. + z)\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\n        bolometric flux from an object at redshift ``z`` and its\n        bolometric luminosity.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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        Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return (1. + z) * 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        Useful for gravitational lensing.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts. z2 must be large than z1.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`, shape (N,) or single if input scalar\n          The angular diameter distance between each input redshift\n          pair.\n\n        \"\"\"\n\n        z1 = np.asanyarray(z1)\n        z2 = np.asanyarray(z2)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (1. + z2)\n\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\n        cross section of absorption and number density intersecting a\n        sightline per unit redshift path.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : float or ndarray\n          Absorption distance (dimensionless) at each input redshift.\n\n        References\n        ----------\n        Hogg 1999 Section 11. (astro-ph/9905116)\n        Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda red: quad(self._abs_distance_integrand_scalar, 0, red)[0]\n        return vectorize_if_needed(f, z)\n\n    def distmod(self, z):\n        \"\"\" Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude -\n        absolute magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity`\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\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        \"\"\" Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less\n        than ``z``. For the case of omega_k = 0 it is a sphere of radius\n        `comoving_distance` but it is less intuitive\n        if omega_k is not 0.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n          Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4. / 3. * 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. * pi * dh ** 3 / (2. * 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\n        that has a sensitivity function that changes with redshift.\n        The total comoving volume is given by integrating\n        differential_comoving_volume to redshift z\n        and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n          Differential comoving volume per redshift per steradian at\n          each input redshift.\"\"\"\n        dh = self._hubble_distance\n        da = self.angular_diameter_distance(z)\n        zp1 = 1.0 + z\n        return dh * ((zp1 * da) ** 2.0) / u.Quantity(self.efunc(z),\n                                                          u.steradian)\n\n    def kpc_comoving_per_arcmin(self, z):\n        \"\"\" Separation in transverse comoving kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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) *\n                arcmin_in_radians / u.arcmin)\n\n    def kpc_proper_per_arcmin(self, z):\n        \"\"\" Separation in transverse proper kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          The distance in proper kpc corresponding to an arcmin at each\n          input redshift.\n        \"\"\"\n        return (self.angular_diameter_distance(z).to(u.kpc) *\n                arcmin_in_radians / u.arcmin)\n\n    def arcsec_per_kpc_comoving(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a comoving kpc\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a comoving kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.comoving_transverse_distance(z).to(u.kpc) *\n                           arcsec_in_radians)\n\n    def arcsec_per_kpc_proper(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a proper kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a proper kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.angular_diameter_distance(z).to(u.kpc) *\n                           arcsec_in_radians)"},{"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":892,"id":11109,"nodeType":"Class","startLoc":871,"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    @property\n    def inverse(self):\n        return Sky2Pix_PlateCarree()\n\n    @staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x, copy=True)\n        theta = np.array(y, copy=True)\n\n        return phi, theta"},{"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\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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":1148,"id":11110,"nodeType":"Class","startLoc":1026,"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\n    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 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 : throw away parameter\n            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":884,"header":"@property\n    def inverse(self)","id":11111,"name":"inverse","nodeType":"Function","startLoc":882,"text":"@property\n    def inverse(self):\n        return Sky2Pix_PlateCarree()"},{"col":4,"comment":"null","endLoc":1073,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":11112,"name":"__init__","nodeType":"Function","startLoc":1067,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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":"EMCODATA2010","col":0,"comment":"null","endLoc":67,"id":11113,"name":"eps0","nodeType":"Attribute","startLoc":67,"text":"eps0"},{"col":4,"comment":"\n        Calculate the individual Chebyshev functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":1092,"header":"def _fcache(self, x, y)","id":11114,"name":"_fcache","nodeType":"Function","startLoc":1075,"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"},{"col":4,"comment":"null","endLoc":892,"header":"@staticmethod\n    def evaluate(x, y)","id":11115,"name":"evaluate","nodeType":"Function","startLoc":886,"text":"@staticmethod\n    def evaluate(x, y):\n        # The intermediate variables are only used here for clarity\n        phi = np.array(x, copy=True)\n        theta = np.array(y, copy=True)\n\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":919,"id":11116,"nodeType":"Class","startLoc":898,"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    @property\n    def inverse(self):\n        return Pix2Sky_PlateCarree()\n\n    @staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi, copy=True)\n        y = np.array(theta, copy=True)\n\n        return x, y"},{"col":4,"comment":"null","endLoc":911,"header":"@property\n    def inverse(self)","id":11117,"name":"inverse","nodeType":"Function","startLoc":909,"text":"@property\n    def inverse(self):\n        return Pix2Sky_PlateCarree()"},{"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 : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":1133,"header":"def fit_deriv(self, x, y, *params)","id":11118,"name":"fit_deriv","nodeType":"Function","startLoc":1094,"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 : throw away parameter\n            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"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":70,"id":11119,"name":"N_A","nodeType":"Attribute","startLoc":70,"text":"N_A"},{"col":4,"comment":"null","endLoc":292,"header":"def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":11120,"name":"__init__","nodeType":"Function","startLoc":145,"text":"def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        # all densities are in units of the critical density\n        self._Om0 = float(Om0)\n        if self._Om0 < 0.0:\n            raise ValueError(\"Matter density can not be negative\")\n        self._Ode0 = float(Ode0)\n        if Ob0 is not None:\n            self._Ob0 = float(Ob0)\n            if self._Ob0 < 0.0:\n                raise ValueError(\"Baryonic density can not be negative\")\n            if self._Ob0 > self._Om0:\n                raise ValueError(\"Baryonic density can not be larger than \"\n                                 \"total matter density\")\n            self._Odm0 = self._Om0 - self._Ob0\n        else:\n            self._Ob0 = None\n            self._Odm0 = None\n\n        self._Neff = float(Neff)\n        if self._Neff < 0.0:\n            raise ValueError(\"Effective number of neutrinos can \"\n                             \"not be negative\")\n        self.name = name\n\n        # Tcmb may have units\n        self._Tcmb0 = u.Quantity(Tcmb0, unit=u.K)\n        if not self._Tcmb0.isscalar:\n            raise ValueError(\"Tcmb0 is a non-scalar quantity\")\n\n        # Hubble parameter at z=0, km/s/Mpc\n        self._H0 = u.Quantity(H0, unit=u.km / u.s / u.Mpc)\n        if not self._H0.isscalar:\n            raise ValueError(\"H0 is a non-scalar quantity\")\n\n        # 100 km/s/Mpc * h = H0 (so h is dimensionless)\n        self._h = self._H0.value / 100.\n        # Hubble distance\n        self._hubble_distance = (const.c / self._H0).to(u.Mpc)\n        # H0 in s^-1; don't use units for speed\n        H0_s = self._H0.value * H0units_to_invs\n        # Hubble time; again, avoiding units package for speed\n        self._hubble_time = u.Quantity(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 = u.Quantity(cd0value, u.g / u.cm ** 3)\n\n        # Load up neutrino masses.  Note: in Py2.x, floor is floating\n        self._nneutrinos = int(floor(self._Neff))\n\n        # We are going to share Neff between the neutrinos equally.\n        # In detail this is not correct, but it is a standard assumption\n        # because properly calculating it is a) complicated b) depends\n        # on the details of the massive neutrinos (e.g., their weak\n        # interactions, which could be unusual if one is considering sterile\n        # neutrinos)\n        self._massivenu = False\n        if self._nneutrinos > 0 and self._Tcmb0.value > 0:\n            self._neff_per_nu = self._Neff / self._nneutrinos\n\n            # We can't use the u.Quantity constructor as we do above\n            # because it doesn't understand equivalencies\n            if not isinstance(m_nu, u.Quantity):\n                raise ValueError(\"m_nu must be a Quantity\")\n\n            m_nu = m_nu.to(u.eV, equivalencies=u.mass_energy())\n\n            # Now, figure out if we have massive neutrinos to deal with,\n            # and, if so, get the right number of masses\n            # It is worth the effort to keep track of massless ones separately\n            # (since they are quite easy to deal with, and a common use case\n            # is to set only one neutrino to have mass)\n            if m_nu.isscalar:\n                # Assume all neutrinos have the same mass\n                if m_nu.value == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    self._nmasslessnu = 0\n                    self._nmassivenu = self._nneutrinos\n                    self._massivenu_mass = (m_nu.value *\n                                            np.ones(self._nneutrinos))\n            else:\n                # Make sure we have the right number of masses\n                # -unless- they are massless, in which case we cheat a little\n                if m_nu.value.min() < 0:\n                    raise ValueError(\"Invalid (negative) neutrino mass\"\n                                     \" encountered\")\n                if m_nu.value.max() == 0:\n                    self._nmasslessnu = self._nneutrinos\n                    self._nmassivenu = 0\n                else:\n                    self._massivenu = True\n                    if len(m_nu) != self._nneutrinos:\n                        errstr = \"Unexpected number of neutrino masses\"\n                        raise ValueError(errstr)\n                    # Segregate out the massless ones\n                    self._nmasslessnu = len(np.nonzero(m_nu.value == 0)[0])\n                    self._nmassivenu = self._nneutrinos - self._nmasslessnu\n                    w = np.nonzero(m_nu.value > 0)[0]\n                    self._massivenu_mass = m_nu[w]\n\n        # Compute photon density, Tcmb, neutrino parameters\n        # Tcmb0=0 removes both photons and neutrinos, is handled\n        # as a special case for efficiency\n        if self._Tcmb0.value > 0:\n            # Compute photon density from Tcmb\n            self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 /\\\n                self._critical_density0.value\n\n            # Compute Neutrino temperature\n            # The constant in front is (4/11)^1/3 -- see any\n            #  cosmology book for an explanation -- for example,\n            #  Weinberg 'Cosmology' p 154 eq (3.1.21)\n            self._Tnu0 = 0.7137658555036082 * self._Tcmb0\n\n            # Compute Neutrino Omega and total relativistic component\n            # for massive neutrinos.  We also store a list version,\n            # since that is more efficient to do integrals with (perhaps\n            # surprisingly!  But small python lists are more efficient\n            # than small numpy arrays).\n            if self._massivenu:\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\n                # The 0.2271... is 7/8 (4/11)^(4/3) -- the temperature\n                # bit ^4 (blackbody energy density) times 7/8 for\n                # FD vs. BE statistics.\n                self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0\n\n        else:\n            self._Ogamma0 = 0.0\n            self._Tnu0 = u.Quantity(0.0, u.K)\n            self._Onu0 = 0.0\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 = ()"},{"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 behaviour of the function that you\n      are trying to invert! Depending on the cosmology, there may not\n      be a unique solution. For example, in the standard Lambda CDM\n      cosmology, there are two redshifts which give an angular\n      diameter distance of 1500 Mpc, z ~ 0.7 and z ~ 3.8. To force\n      ``z_at_value`` to find the solution you are interested in, use the\n      ``zmin`` and ``zmax`` keywords to limit the search range (see the\n      example below).\n\n    Parameters\n    ----------\n    func : function or method\n       A function that takes a redshift as input.\n    fval : astropy.Quantity instance\n       The value of ``func(z)``.\n    zmin : float, 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    zmax : float, optional\n       The upper search limit for ``z`` (default 1000).\n    ztol : float, optional\n       The relative error in ``z`` acceptable for convergence.\n    maxfun : int, optional\n       The maximum number of function evaluations allowed in the\n       optimization routine (default 500).\n\n    Returns\n    -------\n    z : float\n      The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n      fval`` within ``ztol``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient\n    if you want to invert a large number of values for the same\n    cosmology. In this case, it is faster to instead generate an array\n    of values at many closely-spaced redshifts that cover the relevant\n    redshift range, and then use interpolation to find the redshift at\n    each value you're interested in. For example, to efficiently find\n    the redshifts corresponding to 10^6 values of the distance modulus\n    in a Planck13 cosmology, you could do the 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 43 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1e6) * 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.logspace(np.log10(zmin), np.log10(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, zgrid, Dgrid.value)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, 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)\n    3.19812268...\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. Use the zmin and zmax keywords\n    to find the one you're interested in:\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmax=1.5)\n    0.6812769577...\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmin=2.5)\n    3.7914913242...\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    ","endLoc":144,"header":"def z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500)","id":11121,"name":"z_at_value","nodeType":"Function","startLoc":17,"text":"def z_at_value(func, fval, zmin=1e-8, zmax=1000, ztol=1e-8, maxfun=500):\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 behaviour of the function that you\n      are trying to invert! Depending on the cosmology, there may not\n      be a unique solution. For example, in the standard Lambda CDM\n      cosmology, there are two redshifts which give an angular\n      diameter distance of 1500 Mpc, z ~ 0.7 and z ~ 3.8. To force\n      ``z_at_value`` to find the solution you are interested in, use the\n      ``zmin`` and ``zmax`` keywords to limit the search range (see the\n      example below).\n\n    Parameters\n    ----------\n    func : function or method\n       A function that takes a redshift as input.\n    fval : astropy.Quantity instance\n       The value of ``func(z)``.\n    zmin : float, 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    zmax : float, optional\n       The upper search limit for ``z`` (default 1000).\n    ztol : float, optional\n       The relative error in ``z`` acceptable for convergence.\n    maxfun : int, optional\n       The maximum number of function evaluations allowed in the\n       optimization routine (default 500).\n\n    Returns\n    -------\n    z : float\n      The redshift ``z`` satisfying ``zmin < z < zmax`` and ``func(z) =\n      fval`` within ``ztol``.\n\n    Notes\n    -----\n    This works for any arbitrary input cosmology, but is inefficient\n    if you want to invert a large number of values for the same\n    cosmology. In this case, it is faster to instead generate an array\n    of values at many closely-spaced redshifts that cover the relevant\n    redshift range, and then use interpolation to find the redshift at\n    each value you're interested in. For example, to efficiently find\n    the redshifts corresponding to 10^6 values of the distance modulus\n    in a Planck13 cosmology, you could do the 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 43 for which we\n    want to find the corresponding redshifts:\n\n    >>> Dvals = (24 + np.random.rand(1e6) * 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.logspace(np.log10(zmin), np.log10(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, zgrid, Dgrid.value)\n\n    Examples\n    --------\n    >>> import astropy.units as u\n    >>> from astropy.cosmology import Planck13, 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)\n    3.19812268...\n\n    The angular diameter is not monotonic however, and there are two\n    redshifts that give a value of 1500 Mpc. Use the zmin and zmax keywords\n    to find the one you're interested in:\n\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmax=1.5)\n    0.6812769577...\n    >>> z_at_value(Planck13.angular_diameter_distance, 1500 * u.Mpc, zmin=2.5)\n    3.7914913242...\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    from scipy.optimize import fminbound\n\n    fval_zmin = func(zmin)\n    fval_zmax = func(zmax)\n    if np.sign(fval - fval_zmin) != np.sign(fval_zmax - fval):\n        warnings.warn(\"\"\"\\\nfval is not bracketed by func(zmin) and func(zmax). This means either\nthere is no solution, or that there is more than one solution between\nzmin and zmax satisfying fval = func(z).\"\"\")\n\n    if isinstance(fval_zmin, Quantity):\n        val = fval.to_value(fval_zmin.unit)\n        f = lambda z: abs(func(z).value - val)\n    else:\n        f = lambda z: abs(func(z) - fval)\n\n    zbest, resval, ierr, ncall = fminbound(f, zmin, zmax, maxfun=maxfun,\n                                           full_output=1, xtol=ztol)\n\n    if ierr != 0:\n        warnings.warn('Maximum number of function calls ({}) reached'.format(\n            ncall))\n\n    if np.allclose(zbest, zmax):\n        raise CosmologyError(\"Best guess z is very close the upper z limit.\\n\"\n                             \"Try re-running with a different zmax.\")\n    elif np.allclose(zbest, zmin):\n        raise CosmologyError(\"Best guess z is very close the lower z limit.\\n\"\n                             \"Try re-running with a different zmin.\")\n\n    return zbest"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":73,"id":11122,"name":"R","nodeType":"Attribute","startLoc":73,"text":"R"},{"col":4,"comment":"\n        Derivative of 1D Chebyshev series\n        ","endLoc":1148,"header":"def _chebderiv1d(self, x, deg)","id":11123,"name":"_chebderiv1d","nodeType":"Function","startLoc":1135,"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)"},{"className":"Kernel","col":0,"comment":"\n    Convolution kernel base class.\n\n    Parameters\n    ----------\n    array : `~numpy.ndarray`\n        Kernel array.\n    ","endLoc":181,"id":11124,"nodeType":"Class","startLoc":31,"text":"class Kernel:\n    \"\"\"\n    Convolution kernel base class.\n\n    Parameters\n    ----------\n    array : `~numpy.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"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":76,"id":11125,"name":"Ryd","nodeType":"Attribute","startLoc":76,"text":"Ryd"},{"attributeType":"null","col":4,"comment":"null","endLoc":1065,"id":11126,"name":"_separable","nodeType":"Attribute","startLoc":1065,"text":"_separable"},{"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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":1273,"id":11127,"nodeType":"Class","startLoc":1151,"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    Parameters\n    ----------\n\n    x_degree : int\n        degree in x\n    y_degree : int\n        degree in y\n    x_domain : list or None, optional\n        domain of the x independent variable\n    y_domain : list or None, optional\n        domain of the y independent variable\n    x_window : list or None, optional\n        range of the x independent variable\n    y_window : list or None, optional\n        range of the y independent variable\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=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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 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 : throw away parameter\n            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)"},{"col":4,"comment":"null","endLoc":1204,"header":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":11128,"name":"__init__","nodeType":"Function","startLoc":1198,"text":"def __init__(self, x_degree, y_degree, x_domain=None, x_window=[-1, 1],\n                 y_domain=None, y_window=[-1, 1], 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":"Constant","col":0,"comment":"null","endLoc":79,"id":11129,"name":"a0","nodeType":"Attribute","startLoc":79,"text":"a0"},{"col":4,"comment":"null","endLoc":919,"header":"@staticmethod\n    def evaluate(phi, theta)","id":11130,"name":"evaluate","nodeType":"Function","startLoc":913,"text":"@staticmethod\n    def evaluate(phi, theta):\n        # The intermediate variables are only used here for clarity\n        x = np.array(phi, copy=True)\n        y = np.array(theta, copy=True)\n\n        return x, y"},{"col":4,"comment":"\n        Calculate the individual Legendre functions once and store them in a\n        dictionary to be reused.\n        ","endLoc":1225,"header":"def _fcache(self, x, y)","id":11131,"name":"_fcache","nodeType":"Function","startLoc":1206,"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":45,"header":"def __init__(self, array)","id":11132,"name":"__init__","nodeType":"Function","startLoc":44,"text":"def __init__(self, array):\n        self._array = np.asanyarray(array)"},{"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":942,"id":11133,"nodeType":"Class","startLoc":925,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Mercator()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.merx2s(x, y)"},{"col":4,"comment":"\n        Deviation from the normalization to one.\n        ","endLoc":52,"header":"@property\n    def truncation(self)","id":11134,"name":"truncation","nodeType":"Function","startLoc":47,"text":"@property\n    def truncation(self):\n        \"\"\"\n        Deviation from the normalization to one.\n        \"\"\"\n        return self._truncation"},{"col":4,"comment":"null","endLoc":938,"header":"@property\n    def inverse(self)","id":11135,"name":"inverse","nodeType":"Function","startLoc":936,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Mercator()"},{"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":62,"header":"@property\n    def is_bool(self)","id":11136,"name":"is_bool","nodeType":"Function","startLoc":54,"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":69,"header":"@property\n    def model(self)","id":11137,"name":"model","nodeType":"Function","startLoc":64,"text":"@property\n    def model(self):\n        \"\"\"\n        Kernel response model.\n        \"\"\"\n        return self._model"},{"col":4,"comment":"\n        Kernel dimension.\n        ","endLoc":76,"header":"@property\n    def dimension(self)","id":11138,"name":"dimension","nodeType":"Function","startLoc":71,"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":83,"header":"@property\n    def center(self)","id":11139,"name":"center","nodeType":"Function","startLoc":78,"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":113,"header":"def normalize(self, mode='integral')","id":11140,"name":"normalize","nodeType":"Function","startLoc":85,"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":12,"endLoc":126,"id":11141,"nodeType":"Lambda","startLoc":126,"text":"lambda z: abs(func(z).value - val)"},{"col":12,"endLoc":128,"id":11142,"nodeType":"Lambda","startLoc":128,"text":"lambda z: abs(func(z) - fval)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":82,"id":11143,"name":"muB","nodeType":"Attribute","startLoc":82,"text":"muB"},{"col":4,"comment":"\n        Shape of the kernel array.\n        ","endLoc":120,"header":"@property\n    def shape(self)","id":11144,"name":"shape","nodeType":"Function","startLoc":115,"text":"@property\n    def shape(self):\n        \"\"\"\n        Shape of the kernel array.\n        \"\"\"\n        return self._array.shape"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":11145,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"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":135,"header":"@property\n    def separable(self)","id":11146,"name":"separable","nodeType":"Function","startLoc":122,"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":142,"header":"@property\n    def array(self)","id":11147,"name":"array","nodeType":"Function","startLoc":137,"text":"@property\n    def array(self):\n        \"\"\"\n        Filter kernel array.\n        \"\"\"\n        return self._array"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":11148,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":11149,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":14,"text":"__doctest_requires__"},{"col":4,"comment":"\n        Add two filter kernels.\n        ","endLoc":148,"header":"def __add__(self, kernel)","id":11150,"name":"__add__","nodeType":"Function","startLoc":144,"text":"def __add__(self, kernel):\n        \"\"\"\n        Add two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'add')"},{"col":0,"comment":"","endLoc":4,"header":"funcs.py#<anonymous>","id":11151,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\nConvenience functions for `astropy.cosmology`.\n\"\"\"\n\n__all__ = ['z_at_value']\n\n__doctest_requires__ = {'*': ['scipy.integrate']}"},{"col":0,"comment":"\n    Add, subtract or multiply two kernels.\n\n    Parameters\n    ----------\n    kernel : `astropy.convolution.Kernel`\n        Kernel instance\n    value : 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":370,"header":"def kernel_arithmetics(kernel, value, operation)","id":11152,"name":"kernel_arithmetics","nodeType":"Function","startLoc":315,"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 : 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"},{"id":11153,"name":"boundary_none.pyx","nodeType":"TextFile","path":"astropy/convolution","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\ncimport numpy as np\n\n\nDTYPE = float\nctypedef np.float_t DTYPE_t\n\ncdef extern from \"numpy/npy_math.h\" nogil:\n    bint npy_isnan(double x)\n\ncimport cython\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f,\n                             np.ndarray[DTYPE_t, ndim=1] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int nkx = g.shape[0]\n    cdef int wkx = nkx // 2\n\n    # The following need to be set to zeros rather than empty because the\n    # boundary does not get reset.\n    cdef np.ndarray[DTYPE_t, ndim=1] conv = np.zeros([nx], dtype=DTYPE)\n\n    cdef unsigned int i, ii\n\n    cdef int iimin, iimax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(wkx, nx - wkx):\n            top = 0.\n            bot = 0.\n            for ii in range(i - wkx, i + wkx + 1):\n                val = f[ii]\n                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i))]\n                if not npy_isnan(val):\n                    top += val * ker\n                    bot += ker\n            if normalize_by_kernel:\n                if bot == 0:\n                    conv[i] = f[i]\n                else:\n                    conv[i] = top / bot\n            else:\n                conv[i] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f,\n                             np.ndarray[DTYPE_t, ndim=2] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n\n    # The following need to be set to zeros rather than empty because the\n    # boundary does not get reset.\n    cdef np.ndarray[DTYPE_t, ndim=2] conv = np.zeros([nx, ny], dtype=DTYPE)\n\n    cdef unsigned int i, j, ii, jj\n\n    cdef int iimin, iimax, jjmin, jjmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(wkx, nx - wkx):\n            for j in range(wky, ny - wky):\n                top = 0.\n                bot = 0.\n                for ii in range(i - wkx, i + wkx + 1):\n                    for jj in range(j - wky, j + wky + 1):\n                        val = f[ii, jj]\n                        ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                <unsigned int>(nky - 1 - (wky + jj - j))]\n                        if not npy_isnan(val):\n                            top += val * ker\n                            bot += ker\n                if normalize_by_kernel:\n                    if bot == 0:\n                        conv[i, j] = f[i, j]\n                    else:\n                        conv[i, j] = top / bot\n                else:\n                    conv[i, j] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f,\n                             np.ndarray[DTYPE_t, ndim=3] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nz = f.shape[2]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int nkz = g.shape[2]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef int wkz = nkz // 2\n\n    # The following need to be set to zeros rather than empty because the\n    # boundary does not get reset.\n    cdef np.ndarray[DTYPE_t, ndim=3] conv = np.zeros([nx, ny, nz], dtype=DTYPE)\n\n    cdef unsigned int i, j, k, ii, jj, kk\n\n    cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(wkx, nx - wkx):\n            for j in range(wky, ny - wky):\n                for k in range(wkz, nz - wkz):\n                    top = 0.\n                    bot = 0.\n                    for ii in range(i - wkx, i + wkx + 1):\n                        for jj in range(j - wky, j + wky + 1):\n                            for kk in range(k - wkz, k + wkz + 1):\n                                val = f[ii, jj, kk]\n                                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                        <unsigned int>(nky - 1 - (wky + jj - j)),\n                                        <unsigned int>(nkz - 1 - (wkz + kk - k))]\n                                if not npy_isnan(val):\n                                    top += val * ker\n                                    bot += ker\n                    if normalize_by_kernel:\n                        if bot == 0:\n                            conv[i, j, k] = f[i, j, k]\n                        else:\n                            conv[i, j, k] = top / bot\n                    else:\n                        conv[i, j, k] = top\n    # GIL acquired again here\n    return conv\n"},{"fileName":"__init__.py","filePath":"astropy/convolution","id":11154,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nfrom .core import *\nfrom .kernels import *\nfrom .utils import discretize_model\n\ntry:\n    # Not guaranteed available at setup time\n    from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n"},{"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":184,"header":"def discretize_model(model, x_range, y_range=None, mode='center', factor=10)","id":11155,"name":"discretize_model","nodeType":"Function","startLoc":72,"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 an 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 an 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    Add two 1D kernel arrays of different size.\n\n    The arrays are added with the centers lying upon each other.\n    ","endLoc":42,"header":"def add_kernel_arrays_1D(array_1, array_2)","id":11156,"name":"add_kernel_arrays_1D","nodeType":"Function","startLoc":22,"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":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 : throw away parameter\n            parameter list returned by non-linear fitters\n\n        Returns\n        -------\n        result : ndarray\n            The Vandermonde matrix\n        ","endLoc":1261,"header":"def fit_deriv(self, x, y, *params)","id":11157,"name":"fit_deriv","nodeType":"Function","startLoc":1227,"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 : throw away parameter\n            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"},{"col":4,"comment":"null","endLoc":942,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11158,"name":"evaluate","nodeType":"Function","startLoc":940,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.merx2s(x, y)"},{"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":965,"id":11159,"nodeType":"Class","startLoc":948,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Mercator()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mers2x(phi, theta)"},{"col":4,"comment":"null","endLoc":961,"header":"@property\n    def inverse(self)","id":11160,"name":"inverse","nodeType":"Function","startLoc":959,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Mercator()"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":85,"id":11161,"name":"alpha","nodeType":"Attribute","startLoc":85,"text":"alpha"},{"col":4,"comment":"Derivative of 1D Legendre polynomial","endLoc":1273,"header":"def _legendderiv1d(self, x, deg)","id":11162,"name":"_legendderiv1d","nodeType":"Function","startLoc":1263,"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)"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":88,"id":11163,"name":"atm","nodeType":"Attribute","startLoc":88,"text":"atm"},{"attributeType":"null","col":4,"comment":"null","endLoc":1196,"id":11164,"name":"_separable","nodeType":"Attribute","startLoc":1196,"text":"_separable"},{"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":1364,"id":11165,"nodeType":"Class","startLoc":1276,"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    inputs = ('u', 'v')\n    outputs = ('w',)\n    _separable = False\n\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        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('{0}_{1}_{2}'.format(coeff_prefix, i, 0))\n        for i in range(2, self.order + 1):\n            names.append('{0}_{1}_{2}'.format(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('{0}_{1}_{2}'.format(coeff_prefix, i, j))\n        return 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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(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":965,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11166,"name":"evaluate","nodeType":"Function","startLoc":963,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mers2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1296,"header":"def __init__(self, order, coeff_prefix, n_models=None,\n                 model_set_axis=None, name=None, meta=None, **params)","id":11167,"name":"__init__","nodeType":"Function","startLoc":1289,"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        super().__init__(n_models=n_models, model_set_axis=model_set_axis,\n                         name=name, meta=meta, **params)"},{"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":980,"id":11168,"nodeType":"Class","startLoc":971,"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\n    _separable = True"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":91,"id":11169,"name":"mu0","nodeType":"Attribute","startLoc":91,"text":"mu0"},{"attributeType":"null","col":4,"comment":"null","endLoc":980,"id":11170,"name":"_separable","nodeType":"Attribute","startLoc":980,"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":1000,"id":11171,"nodeType":"Class","startLoc":983,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Sky2Pix_SansonFlamsteed()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.sflx2s(x, y)"},{"col":4,"comment":"null","endLoc":996,"header":"@property\n    def inverse(self)","id":11172,"name":"inverse","nodeType":"Function","startLoc":994,"text":"@property\n    def inverse(self):\n        return Sky2Pix_SansonFlamsteed()"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":94,"id":11173,"name":"sigma_T","nodeType":"Attribute","startLoc":94,"text":"sigma_T"},{"attributeType":"Constant","col":0,"comment":"null","endLoc":97,"id":11174,"name":"b_wien","nodeType":"Attribute","startLoc":97,"text":"b_wien"},{"col":4,"comment":"null","endLoc":240,"header":"def __init__(self, model=None, x_size=None, array=None, **kwargs)","id":11175,"name":"__init__","nodeType":"Function","startLoc":216,"text":"def __init__(self, model=None, x_size=None, array=None, **kwargs):\n        # Initialize from model\n        if array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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 not None:\n            self._model = None\n\n        super().__init__(array)"},{"col":4,"comment":"null","endLoc":1000,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11176,"name":"evaluate","nodeType":"Function","startLoc":998,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.sflx2s(x, y)"},{"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":1023,"id":11177,"nodeType":"Class","startLoc":1006,"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    \"\"\"\n\n    @property\n    def inverse(self):\n        return Pix2Sky_SansonFlamsteed()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.sfls2x(phi, theta)"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":103,"id":11178,"name":"e_esu","nodeType":"Attribute","startLoc":103,"text":"e_esu"},{"col":4,"comment":"null","endLoc":1019,"header":"@property\n    def inverse(self)","id":11179,"name":"inverse","nodeType":"Function","startLoc":1017,"text":"@property\n    def inverse(self):\n        return Pix2Sky_SansonFlamsteed()"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":106,"id":11180,"name":"e_emu","nodeType":"Attribute","startLoc":106,"text":"e_emu"},{"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":69,"header":"def add_kernel_arrays_2D(array_1, array_2)","id":11181,"name":"add_kernel_arrays_2D","nodeType":"Function","startLoc":45,"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":4,"comment":"null","endLoc":1023,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11182,"name":"evaluate","nodeType":"Function","startLoc":1021,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.sfls2x(phi, theta)"},{"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":1048,"id":11183,"nodeType":"Class","startLoc":1029,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Parabolic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.parx2s(x, y)"},{"col":4,"comment":"null","endLoc":1044,"header":"@property\n    def inverse(self)","id":11184,"name":"inverse","nodeType":"Function","startLoc":1042,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Parabolic()"},{"col":4,"comment":"null","endLoc":1048,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11185,"name":"evaluate","nodeType":"Function","startLoc":1046,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.parx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1040,"id":11186,"name":"_separable","nodeType":"Attribute","startLoc":1040,"text":"_separable"},{"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":1073,"id":11187,"nodeType":"Class","startLoc":1054,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Parabolic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pars2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1069,"header":"@property\n    def inverse(self)","id":11188,"name":"inverse","nodeType":"Function","startLoc":1067,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Parabolic()"},{"col":4,"comment":"null","endLoc":1335,"header":"def _generate_coeff_names(self, coeff_prefix)","id":11189,"name":"_generate_coeff_names","nodeType":"Function","startLoc":1325,"text":"def _generate_coeff_names(self, coeff_prefix):\n        names = []\n        for i in range(2, self.order + 1):\n            names.append('{0}_{1}_{2}'.format(coeff_prefix, i, 0))\n        for i in range(2, self.order + 1):\n            names.append('{0}_{1}_{2}'.format(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('{0}_{1}_{2}'.format(coeff_prefix, i, j))\n        return names"},{"attributeType":"EMCODATA2010","col":0,"comment":"null","endLoc":109,"id":11190,"name":"e_gauss","nodeType":"Attribute","startLoc":109,"text":"e_gauss"},{"col":4,"comment":"null","endLoc":1299,"header":"def __repr__(self)","id":11191,"name":"__repr__","nodeType":"Function","startLoc":1298,"text":"def __repr__(self):\n        return self._format_repr(args=[self.order, self.coeff_prefix])"},{"col":4,"comment":"null","endLoc":312,"header":"def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs)","id":11192,"name":"__init__","nodeType":"Function","startLoc":277,"text":"def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs):\n\n        # Initialize from model\n        if array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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            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 not None:\n            self._model = None\n\n        super().__init__(array)"},{"col":4,"comment":"null","endLoc":1073,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11193,"name":"evaluate","nodeType":"Function","startLoc":1071,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pars2x(phi, theta)"},{"col":0,"comment":"\n    Discretize model by taking the value at the center of the bin.\n    ","endLoc":192,"header":"def discretize_center_1D(model, x_range)","id":11194,"name":"discretize_center_1D","nodeType":"Function","startLoc":187,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1065,"id":11195,"name":"_separable","nodeType":"Attribute","startLoc":1065,"text":"_separable"},{"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":1098,"id":11196,"nodeType":"Class","startLoc":1079,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Molleweide()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.molx2s(x, y)"},{"col":4,"comment":"null","endLoc":1094,"header":"@property\n    def inverse(self)","id":11197,"name":"inverse","nodeType":"Function","startLoc":1092,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Molleweide()"},{"col":4,"comment":"null","endLoc":1304,"header":"def __str__(self)","id":11198,"name":"__str__","nodeType":"Function","startLoc":1301,"text":"def __str__(self):\n        return self._format_str(\n            [('Order', self.order),\n             ('Coeff. Prefix', self.coeff_prefix)])"},{"col":0,"comment":"","endLoc":5,"header":"codata2010.py#<anonymous>","id":11199,"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', 0.0,\n                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')"},{"col":4,"comment":"null","endLoc":1310,"header":"def evaluate(self, x, y, *coeffs)","id":11200,"name":"evaluate","nodeType":"Function","startLoc":1306,"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)"},{"col":4,"comment":"\n        Subtract two filter kernels.\n        ","endLoc":154,"header":"def __sub__(self, kernel)","id":11201,"name":"__sub__","nodeType":"Function","startLoc":150,"text":"def __sub__(self, kernel):\n        \"\"\"\n        Subtract two filter kernels.\n        \"\"\"\n        return kernel_arithmetics(self, kernel, 'sub')"},{"fileName":"core.py","filePath":"astropy/convolution","id":11202,"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 warnings\nimport copy\n\nimport numpy as np\nfrom ..utils.exceptions import AstropyUserWarning\nfrom .utils import (discretize_model, add_kernel_arrays_1D,\n                    add_kernel_arrays_2D)\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 : `~numpy.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 : odd int, optional\n        Size of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\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 array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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 not None:\n            self._model = None\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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\n        Kernel array.\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 array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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            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 not None:\n            self._model = None\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 : 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"},{"col":4,"comment":"\n        Multiply kernel with number or convolve two kernels.\n        ","endLoc":160,"header":"def __mul__(self, value)","id":11203,"name":"__mul__","nodeType":"Function","startLoc":156,"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":"null","endLoc":1098,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11204,"name":"evaluate","nodeType":"Function","startLoc":1096,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.molx2s(x, y)"},{"col":4,"comment":"\n        Multiply kernel with number or convolve two kernels.\n        ","endLoc":166,"header":"def __rmul__(self, value)","id":11205,"name":"__rmul__","nodeType":"Function","startLoc":162,"text":"def __rmul__(self, value):\n        \"\"\"\n        Multiply kernel with number or convolve two kernels.\n        \"\"\"\n        return kernel_arithmetics(self, value, \"mul\")"},{"col":0,"comment":"\n    Discretize model by taking the value at the center of the pixel.\n    ","endLoc":202,"header":"def discretize_center_2D(model, x_range, y_range)","id":11206,"name":"discretize_center_2D","nodeType":"Function","startLoc":195,"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)"},{"col":4,"comment":"\n        Array representation of the kernel.\n        ","endLoc":172,"header":"def __array__(self)","id":11207,"name":"__array__","nodeType":"Function","startLoc":168,"text":"def __array__(self):\n        \"\"\"\n        Array representation of the kernel.\n        \"\"\"\n        return self._array"},{"attributeType":"null","col":4,"comment":"null","endLoc":1090,"id":11208,"name":"_separable","nodeType":"Attribute","startLoc":1090,"text":"_separable"},{"col":4,"comment":"\n        Wrapper for multiplication with numpy arrays.\n        ","endLoc":181,"header":"def __array_wrap__(self, array, context=None)","id":11209,"name":"__array_wrap__","nodeType":"Function","startLoc":174,"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"},{"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":1130,"id":11210,"nodeType":"Class","startLoc":1104,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Molleweide()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mols2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1126,"header":"@property\n    def inverse(self)","id":11211,"name":"inverse","nodeType":"Function","startLoc":1124,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Molleweide()"},{"attributeType":"null","col":4,"comment":"null","endLoc":40,"id":11212,"name":"_separable","nodeType":"Attribute","startLoc":40,"text":"_separable"},{"col":0,"comment":"\n    Discretize model by performing a linear interpolation.\n    ","endLoc":212,"header":"def discretize_linear_1D(model, x_range)","id":11213,"name":"discretize_linear_1D","nodeType":"Function","startLoc":205,"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":"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 : odd int, optional\n        Size of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\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":240,"id":11214,"nodeType":"Class","startLoc":184,"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 : odd int, optional\n        Size of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\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 array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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 not None:\n            self._model = None\n\n        super().__init__(array)"},{"attributeType":"null","col":4,"comment":"null","endLoc":41,"id":11215,"name":"_is_bool","nodeType":"Attribute","startLoc":41,"text":"_is_bool"},{"col":0,"comment":"\n    Discretize model by performing a bilinear interpolation.\n    ","endLoc":231,"header":"def discretize_bilinear_2D(model, x_range, y_range)","id":11216,"name":"discretize_bilinear_2D","nodeType":"Function","startLoc":215,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":11217,"name":"_model","nodeType":"Attribute","startLoc":42,"text":"_model"},{"col":0,"comment":"\n    Discretize model by taking the average on an oversampled grid.\n    ","endLoc":246,"header":"def discretize_oversample_1D(model, x_range, factor=10)","id":11218,"name":"discretize_oversample_1D","nodeType":"Function","startLoc":234,"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.arange(x_range[0] - 0.5 * (1 - 1 / factor),\n                  x_range[1] + 0.5 * (1 + 1 / factor), 1. / 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)[:-1]"},{"col":4,"comment":"null","endLoc":1130,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11219,"name":"evaluate","nodeType":"Function","startLoc":1128,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.mols2x(phi, theta)"},{"attributeType":"null","col":8,"comment":"null","endLoc":45,"id":11220,"name":"_array","nodeType":"Attribute","startLoc":45,"text":"self._array"},{"attributeType":"null","col":8,"comment":"null","endLoc":113,"id":11221,"name":"_kernel_sum","nodeType":"Attribute","startLoc":113,"text":"self._kernel_sum"},{"attributeType":"None","col":12,"comment":"null","endLoc":238,"id":11222,"name":"_model","nodeType":"Attribute","startLoc":238,"text":"self._model"},{"attributeType":"null","col":4,"comment":"null","endLoc":1122,"id":11223,"name":"_separable","nodeType":"Attribute","startLoc":1122,"text":"_separable"},{"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":1155,"id":11224,"nodeType":"Class","startLoc":1136,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HammerAitoff()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.aitx2s(x, y)"},{"col":4,"comment":"null","endLoc":1151,"header":"@property\n    def inverse(self)","id":11225,"name":"inverse","nodeType":"Function","startLoc":1149,"text":"@property\n    def inverse(self):\n        return Sky2Pix_HammerAitoff()"},{"col":0,"comment":"\n    Discretize model by taking the average on an oversampled grid.\n    ","endLoc":265,"header":"def discretize_oversample_2D(model, x_range, y_range, factor=10)","id":11226,"name":"discretize_oversample_2D","nodeType":"Function","startLoc":249,"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.arange(x_range[0] - 0.5 * (1 - 1 / factor),\n                  x_range[1] + 0.5 * (1 + 1 / factor), 1. / factor)\n\n    y = np.arange(y_range[0] - 0.5 * (1 - 1 / factor),\n                  y_range[1] + 0.5 * (1 + 1 / factor), 1. / factor)\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)[:-1, :-1]"},{"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\n        Kernel array.\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":312,"id":11227,"nodeType":"Class","startLoc":243,"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\n    array : `~numpy.ndarray`\n        Kernel array.\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 array is None:\n            if self._model is None:\n                raise TypeError(\"Must specify either array or model.\")\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            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 not None:\n            self._model = None\n\n        super().__init__(array)"},{"attributeType":"null","col":12,"comment":"null","endLoc":310,"id":11228,"name":"_model","nodeType":"Attribute","startLoc":310,"text":"self._model"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":11229,"name":"MAX_NORMALIZATION","nodeType":"Attribute","startLoc":26,"text":"MAX_NORMALIZATION"},{"col":4,"comment":"null","endLoc":1155,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11230,"name":"evaluate","nodeType":"Function","startLoc":1153,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.aitx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1147,"id":11231,"name":"_separable","nodeType":"Attribute","startLoc":1147,"text":"_separable"},{"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 : `numpy.ndarray` or `~astropy.nddata.NDData`\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 (default).\n            * 'fill'\n                Set values outside the array boundary to ``fill_value``.\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 prior to\n        convolving\n    nan_treatment : 'interpolate', 'fill'\n        interpolate will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.\n        'fill' will replace the NaN pixels with a fixed numerical value (default\n        zero, see ``fill_value``) prior to convolution\n        Note that if the kernel has a sum equal to zero, NaN interpolation\n        is not possible and will raise an exception\n    preserve_nan : bool\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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":312,"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":11232,"name":"convolve","nodeType":"Function","startLoc":27,"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 : `numpy.ndarray` or `~astropy.nddata.NDData`\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 (default).\n            * 'fill'\n                Set values outside the array boundary to ``fill_value``.\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 prior to\n        convolving\n    nan_treatment : 'interpolate', 'fill'\n        interpolate will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.\n        'fill' will replace the NaN pixels with a fixed numerical value (default\n        zero, see ``fill_value``) prior to convolution\n        Note that if the kernel has a sum equal to zero, NaN interpolation\n        is not possible and will raise an exception\n    preserve_nan : bool\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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    from .boundary_none import (convolve1d_boundary_none,\n                                convolve2d_boundary_none,\n                                convolve3d_boundary_none)\n\n    from .boundary_extend import (convolve1d_boundary_extend,\n                                  convolve2d_boundary_extend,\n                                  convolve3d_boundary_extend)\n\n    from .boundary_fill import (convolve1d_boundary_fill,\n                                convolve2d_boundary_fill,\n                                convolve3d_boundary_fill)\n\n    from .boundary_wrap import (convolve1d_boundary_wrap,\n                                convolve2d_boundary_wrap,\n                                convolve3d_boundary_wrap)\n\n    if boundary not in BOUNDARY_OPTIONS:\n        raise ValueError(\"Invalid boundary option: must be one of {0}\"\n                         .format(BOUNDARY_OPTIONS))\n\n    if nan_treatment not in ('interpolate', 'fill'):\n        raise ValueError(\"nan_treatment must be one of 'interpolate','fill'\")\n\n    # The cython 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\n    # Check if kernel is kernel instance\n    if isinstance(kernel, Kernel):\n        # Check if array is also kernel instance, if so convolve and\n        # return new kernel instance\n        if isinstance(array, Kernel):\n            if isinstance(array, Kernel1D) and isinstance(kernel, Kernel1D):\n                new_array = convolve1d_boundary_fill(array.array, kernel.array,\n                                                     0, True)\n                new_kernel = Kernel1D(array=new_array)\n            elif isinstance(array, Kernel2D) and isinstance(kernel, Kernel2D):\n                new_array = convolve2d_boundary_fill(array.array, kernel.array,\n                                                     0, True)\n                new_kernel = Kernel2D(array=new_array)\n            else:\n                raise Exception(\"Can't convolve 1D and 2D kernel.\")\n            new_kernel._separable = kernel._separable and array._separable\n            new_kernel._is_bool = False\n            return new_kernel\n        kernel = kernel.array\n\n    # Check that the arguments are lists or Numpy arrays\n\n    if isinstance(array, list):\n        array_internal = np.array(array, dtype=float)\n        array_dtype = array_internal.dtype\n    elif isinstance(array, np.ndarray):\n        # Note this won't copy if it doesn't have to -- which is okay\n        # because none of what follows modifies array_internal.\n        array_dtype = array.dtype\n        array_internal = array.astype(float, copy=False)\n    else:\n        raise TypeError(\"array should be a list or a Numpy array\")\n\n    if isinstance(kernel, list):\n        kernel_internal = np.array(kernel, dtype=float)\n    elif isinstance(kernel, np.ndarray):\n        # Note this always makes a copy, since we will be modifying it\n        kernel_internal = kernel.astype(float)\n    else:\n        raise TypeError(\"kernel should be a list or a Numpy array\")\n\n    # Check that the number of dimensions is compatible\n    if array_internal.ndim != kernel_internal.ndim:\n        raise Exception('array and kernel have differing number of '\n                        'dimensions.')\n\n    # anything that's masked must be turned into NaNs for the interpolation.\n    # This requires copying the array_internal\n    array_internal_copied = False\n    if np.ma.is_masked(array):\n        array_internal = array_internal.filled(np.nan)\n        array_internal_copied = True\n    if mask is not None:\n        if not array_internal_copied:\n            array_internal = array_internal.copy()\n            array_internal_copied = True\n        # mask != 0 yields a bool mask for all ints/floats/bool\n        array_internal[mask != 0] = np.nan\n    if np.ma.is_masked(kernel):\n        # *kernel* doesn't support NaN interpolation, so instead we just fill it\n        kernel_internal = kernel.filled(fill_value)\n\n    # Mark the NaN values so we can replace them later if interpolate_nan is\n    # not set\n    if preserve_nan:\n        badvals = np.isnan(array_internal)\n\n    if nan_treatment == 'fill':\n        initially_nan = np.isnan(array_internal)\n        array_internal[initially_nan] = fill_value\n\n    # Because the Cython routines have to normalize the kernel on the fly, we\n    # explicitly normalize the kernel here, and then scale the image at the\n    # end if normalization was not requested.\n    kernel_sum = kernel_internal.sum()\n    kernel_sums_to_zero = np.isclose(kernel_sum, 0, atol=normalization_zero_tol)\n\n    if (kernel_sum < 1. / MAX_NORMALIZATION or kernel_sums_to_zero) and normalize_kernel:\n        raise Exception(\"The kernel can't be normalized, because its sum is \"\n                        \"close to zero. The sum of the given kernel is < {0}\"\n                        .format(1. / MAX_NORMALIZATION))\n\n    if not kernel_sums_to_zero:\n        kernel_internal /= kernel_sum\n    else:\n        kernel_internal = kernel\n\n    renormalize_by_kernel = not kernel_sums_to_zero\n\n    if array_internal.ndim == 0:\n        raise Exception(\"cannot convolve 0-dimensional arrays\")\n    elif array_internal.ndim == 1:\n        if boundary == 'extend':\n            result = convolve1d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel)\n        elif boundary == 'fill':\n            result = convolve1d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel)\n        elif boundary == 'wrap':\n            result = convolve1d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n        elif boundary is None:\n            result = convolve1d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n    elif array_internal.ndim == 2:\n        if boundary == 'extend':\n            result = convolve2d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel,\n                                               )\n        elif boundary == 'fill':\n            result = convolve2d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel,\n                                             )\n        elif boundary == 'wrap':\n            result = convolve2d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel,\n                                             )\n        elif boundary is None:\n            result = convolve2d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel,\n                                             )\n    elif array_internal.ndim == 3:\n        if boundary == 'extend':\n            result = convolve3d_boundary_extend(array_internal,\n                                                kernel_internal,\n                                                renormalize_by_kernel)\n        elif boundary == 'fill':\n            result = convolve3d_boundary_fill(array_internal,\n                                              kernel_internal,\n                                              float(fill_value),\n                                              renormalize_by_kernel)\n        elif boundary == 'wrap':\n            result = convolve3d_boundary_wrap(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n        elif boundary is None:\n            result = convolve3d_boundary_none(array_internal,\n                                              kernel_internal,\n                                              renormalize_by_kernel)\n    else:\n        raise NotImplementedError('convolve only supports 1, 2, and 3-dimensional '\n                                  'arrays at this time')\n\n    # If normalization was not requested, we need to scale the array (since\n    # the kernel is effectively normalized within the cython functions)\n    if not normalize_kernel and not kernel_sums_to_zero:\n        result *= kernel_sum\n\n    if preserve_nan:\n        result[badvals] = np.nan\n\n    if nan_treatment == 'fill':\n        array_internal[initially_nan] = np.nan\n\n    # Try to preserve the input type if it's a floating point type\n    if array_dtype.kind == 'f':\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"},{"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":1185,"id":11233,"nodeType":"Class","startLoc":1161,"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    \"\"\"\n\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HammerAitoff()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.aits2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1181,"header":"@property\n    def inverse(self)","id":11234,"name":"inverse","nodeType":"Function","startLoc":1179,"text":"@property\n    def inverse(self):\n        return Pix2Sky_HammerAitoff()"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":11235,"name":"__all__","nodeType":"Attribute","startLoc":28,"text":"__all__"},{"col":0,"comment":"","endLoc":16,"header":"core.py#<anonymous>","id":11236,"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":"null","endLoc":1185,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11237,"name":"evaluate","nodeType":"Function","startLoc":1183,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.aits2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1177,"id":11238,"name":"_separable","nodeType":"Attribute","startLoc":1177,"text":"_separable"},{"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":1218,"id":11239,"nodeType":"Class","startLoc":1191,"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 = Parameter(default=90.0, getter=_to_orig_unit, setter=_to_radian)\n    delta = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n\n    _separable = False"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1215,"id":11240,"name":"sigma","nodeType":"Attribute","startLoc":1215,"text":"sigma"},{"col":0,"comment":"\n    Discretize model by integrating numerically the model over the bin.\n    ","endLoc":280,"header":"def discretize_integrate_1D(model, x_range)","id":11241,"name":"discretize_integrate_1D","nodeType":"Function","startLoc":268,"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    # 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"},{"fileName":"utils.py","filePath":"astropy/convolution","id":11242,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport numpy as np\n\nfrom ..modeling.core import FittableModel, custom_model\n\n__all__ = ['discretize_model']\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 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 an 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 an 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.arange(x_range[0] - 0.5 * (1 - 1 / factor),\n                  x_range[1] + 0.5 * (1 + 1 / factor), 1. / 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)[:-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.arange(x_range[0] - 0.5 * (1 - 1 / factor),\n                  x_range[1] + 0.5 * (1 + 1 / factor), 1. / factor)\n\n    y = np.arange(y_range[0] - 0.5 * (1 - 1 / factor),\n                  y_range[1] + 0.5 * (1 + 1 / factor), 1. / factor)\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)[:-1, :-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    # 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    # 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"},{"col":0,"comment":"\n    Discretize model by integrating the model over the pixel.\n    ","endLoc":298,"header":"def discretize_integrate_2D(model, x_range, y_range)","id":11243,"name":"discretize_integrate_2D","nodeType":"Function","startLoc":283,"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    # 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"},{"className":"DiscretizationError","col":0,"comment":"\n    Called when discretization of models goes wrong.\n    ","endLoc":13,"id":11244,"nodeType":"Class","startLoc":10,"text":"class DiscretizationError(Exception):\n    \"\"\"\n    Called when discretization of models goes wrong.\n    \"\"\""},{"col":4,"comment":"null","endLoc":1350,"header":"def _coeff_matrix(self, coeff_prefix, coeffs)","id":11245,"name":"_coeff_matrix","nodeType":"Function","startLoc":1337,"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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(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 = '{0}_{1}_{2}'.format(coeff_prefix, i, j)\n                    mat[i, j] = coeffs[self.param_names.index(attr)]\n        return mat"},{"col":35,"endLoc":296,"id":11246,"nodeType":"Lambda","startLoc":296,"text":"lambda y, x: model(x, y)"},{"col":35,"endLoc":297,"id":11247,"nodeType":"Lambda","startLoc":297,"text":"lambda x: y[j]"},{"col":51,"endLoc":297,"id":11248,"nodeType":"Lambda","startLoc":297,"text":"lambda x: y[j + 1]"},{"className":"KernelSizeError","col":0,"comment":"\n    Called when size of kernels is even.\n    ","endLoc":19,"id":11249,"nodeType":"Class","startLoc":16,"text":"class KernelSizeError(Exception):\n    \"\"\"\n    Called when size of kernels is even.\n    \"\"\""},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":11250,"name":"__all__","nodeType":"Attribute","startLoc":7,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"utils.py#<anonymous>","id":11251,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['discretize_model']"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1216,"id":11252,"name":"delta","nodeType":"Attribute","startLoc":1216,"text":"delta"},{"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    * (optionally) It pads to the nearest 2^n size to improve FFT speed.\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.python.org/pypi/pyFFTW>`_ or\n      `pyFFTW3 <https://pypi.python.org/pypi/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.fft` and `numpy.fft.ifft`.\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'\n        ``interpolate`` will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.  ``fill`` will replace the NaN pixels with a fixed\n        numerical value (default zero, see ``fill_value``) prior to\n        convolution.  Note that if the kernel has a sum equal to zero, NaN\n        interpolation is not possible and will raise an exception.\n    normalize_kernel : function 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\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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\n\n    Other Parameters\n    ----------------\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    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest 2^n.  With\n        ``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    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    fftn, ifftn : functions, optional\n        The fft and inverse fft functions.  Can be overridden to use your own\n        ffts, e.g. an fftw3 wrapper or scipy's fftn,\n        ``fft=scipy.fftpack.fftn``\n    complex_dtype : numpy.complex, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    quiet : bool, optional\n        Silence warning message about NaN interpolation\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\n    Raises\n    ------\n    ValueError:\n        If the array is bigger than 1 GB after padding, will raise this exception\n        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    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    Notes\n    -----\n        With ``psf_pad=True`` and a large PSF, the resulting data can become\n        very large and consume a lot of memory.  See Issue\n        https://github.com/astropy/astropy/pull/4366 for further detail.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])\n    array([ 1.,  0.,  3.])\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    ...\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([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([ 1.,  2.,  3.])\n\n    >>> import scipy.fftpack  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fftpack.fft, ifftn=scipy.fftpack.ifft)\n    array([ 1.,  2.,  3.])\n\n    ","endLoc":740,"header":"@deprecated_renamed_argument('interpolate_nan', 'nan_treatment', 'v2.0.0')\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, quiet=False,\n                 min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex)","id":11253,"name":"convolve_fft","nodeType":"Function","startLoc":315,"text":"@deprecated_renamed_argument('interpolate_nan', 'nan_treatment', 'v2.0.0')\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, quiet=False,\n                 min_wt=0.0, allow_huge=False,\n                 fftn=np.fft.fftn, ifftn=np.fft.ifftn,\n                 complex_dtype=complex):\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    * (optionally) It pads to the nearest 2^n size to improve FFT speed.\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.python.org/pypi/pyFFTW>`_ or\n      `pyFFTW3 <https://pypi.python.org/pypi/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.fft` and `numpy.fft.ifft`.\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'\n        ``interpolate`` will result in renormalization of the kernel at each\n        position ignoring (pixels that are NaN in the image) in both the image\n        and the kernel.  ``fill`` will replace the NaN pixels with a fixed\n        numerical value (default zero, see ``fill_value``) prior to\n        convolution.  Note that if the kernel has a sum equal to zero, NaN\n        interpolation is not possible and will raise an exception.\n    normalize_kernel : function 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\n        After performing convolution, should pixels that were originally NaN\n        again become NaN?\n    mask : `None` or `numpy.ndarray`\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\n\n    Other Parameters\n    ----------------\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    fft_pad : bool, optional\n        Default on.  Zero-pad image to the nearest 2^n.  With\n        ``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    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    fftn, ifftn : functions, optional\n        The fft and inverse fft functions.  Can be overridden to use your own\n        ffts, e.g. an fftw3 wrapper or scipy's fftn,\n        ``fft=scipy.fftpack.fftn``\n    complex_dtype : numpy.complex, optional\n        Which complex dtype to use.  `numpy` has a range of options, from 64 to\n        256.\n    quiet : bool, optional\n        Silence warning message about NaN interpolation\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\n    Raises\n    ------\n    ValueError:\n        If the array is bigger than 1 GB after padding, will raise this exception\n        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    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    Notes\n    -----\n        With ``psf_pad=True`` and a large PSF, the resulting data can become\n        very large and consume a lot of memory.  See Issue\n        https://github.com/astropy/astropy/pull/4366 for further detail.\n\n    Examples\n    --------\n    >>> convolve_fft([1, 0, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1])\n    array([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, 0, 3], [0, 1, 0])\n    array([ 1.,  0.,  3.])\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    ...\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([ 1.,  4.,  3.])\n\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True)\n    array([ 1.,  2.,  3.])\n\n    >>> import scipy.fftpack  # optional - requires scipy\n    >>> convolve_fft([1, np.nan, 3], [1, 1, 1], nan_treatment='interpolate',\n    ...               normalize_kernel=True,\n    ...               fftn=scipy.fftpack.fft, ifftn=scipy.fftpack.ifft)\n    array([ 1.,  2.,  3.])\n\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.  \"\n                            \"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    # Convert array dtype to complex\n    # and ensure that list inputs become arrays\n    array = np.asarray(array, dtype=complex)\n    kernel = np.asarray(kernel, dtype=complex)\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 \"\n                         \"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(\"Size Error: Arrays will be {}.  Use \"\n                         \"allow_huge=True to override this exception.\"\n                         .format(human_file_size(array_size_B.to_value(u.byte))))\n\n    # mask catching - masks must be turned into NaNs for use later in the image\n    if np.ma.is_masked(array):\n        mamask = array.mask\n        array = np.array(array)\n        array[mamask] = np.nan\n    elif mask is not None:\n        # copying here because we have to mask it below.  But no need to copy\n        # if mask is None because we won't modify it.\n        array = np.array(array)\n    if mask is not None:\n        # mask != 0 yields a bool mask for all ints/floats/bool\n        array[mask != 0] = np.nan\n    # the *kernel* doesn't support NaN interpolation, so instead we just fill it\n    if np.ma.is_masked(kernel):\n        kernel = kernel.filled(0)\n\n    # NaN and inf catching\n    nanmaskarray = np.isnan(array) | np.isinf(array)\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 < {0}\"\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(\"psf_pad was set to {0}, which overrides the \"\n                          \"boundary='fill' setting.\".format(psf_pad),\n                          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        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    # find ideal size (power of 2) for fft.\n    # Can add shapes because they are tuples\n    if fft_pad:  # default=True\n        if psf_pad:  # default=False\n            # add the dimensions and then take the max (bigger)\n            fsize = 2 ** np.ceil(np.log2(\n                np.max(np.array(arrayshape) + np.array(kernshape))))\n        else:\n            # add the shape lists (max of a list of length 4) (smaller)\n            # also makes the shapes square\n            fsize = 2 ** np.ceil(np.log2(np.max(arrayshape + kernshape)))\n        newshape = np.array([fsize for ii in range(array.ndim)], dtype=int)\n    else:\n        if psf_pad:\n            # just add the biggest dimensions\n            newshape = np.array(arrayshape) + np.array(kernshape)\n        else:\n            newshape = np.array([np.max([imsh, kernsh])\n                                 for imsh, kernsh in zip(arrayshape, kernshape)])\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(\"Size Error: Arrays will be {}.  Use \"\n                         \"allow_huge=True to override this exception.\"\n                         .format(human_file_size(array_size_C)))\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\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        # curiously, at the floating-point limit, can get slightly negative numbers\n        # they break the min_wt=0 \"flag\" and must therefore be removed\n        bigimwt[bigimwt < 0] = 0\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    # restore NaNs in original image (they were modified inplace earlier)\n    # We don't have to worry about masked arrays - if input was masked, it was\n    # copied\n    array[nanmaskarray] = np.nan\n    kernel[nanmaskkernel] = np.nan\n\n    fftmult *= kernel_scale\n\n    if return_fft:\n        return fftmult\n\n    if interpolate_nan:\n        rifft = (ifftn(fftmult)) / bigimwt\n        if not np.isscalar(bigimwt):\n            rifft[bigimwt < min_wt] = np.nan\n            if min_wt == 0.0:\n                rifft[bigimwt == 0.0] = 0.0\n    else:\n        rifft = (ifftn(fftmult))\n\n    if preserve_nan:\n        rifft[nanmaskarray] = np.nan\n\n    if crop:\n        result = rifft[arrayslices].real\n        return result\n    else:\n        return rifft.real"},{"attributeType":"null","col":4,"comment":"null","endLoc":1218,"id":11254,"name":"_separable","nodeType":"Attribute","startLoc":1218,"text":"_separable"},{"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 formulæ 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":1254,"id":11255,"nodeType":"Class","startLoc":1221,"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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicPerspective(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.copx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1250,"header":"@property\n    def inverse(self)","id":11256,"name":"inverse","nodeType":"Function","startLoc":1248,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ConicPerspective(self.sigma.value, self.delta.value)"},{"id":11257,"name":"boundary_wrap.pyx","nodeType":"TextFile","path":"astropy/convolution","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\ncimport numpy as np\n\nDTYPE = float\nctypedef np.float_t DTYPE_t\n\ncdef extern from \"numpy/npy_math.h\" nogil:\n    bint npy_isnan(double x)\n\ncimport cython\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve1d_boundary_wrap(np.ndarray[DTYPE_t, ndim=1] f,\n                             np.ndarray[DTYPE_t, ndim=1] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int nkx = g.shape[0]\n    cdef int wkx = nkx // 2\n    cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE)\n    cdef unsigned int i, iii\n    cdef int ii\n\n    cdef int iimin, iimax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            top = 0.\n            bot = 0.\n            iimin = i - wkx\n            iimax = i + wkx + 1\n            for ii in range(iimin, iimax):\n                iii = ii % nx\n                val = f[iii]\n                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i))]\n                if not npy_isnan(val):\n                    top += val * ker\n                    bot += ker\n            if normalize_by_kernel:\n                if bot == 0:\n                    conv[i] = f[i]\n                else:\n                    conv[i] = top / bot\n            else:\n                conv[i] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve2d_boundary_wrap(np.ndarray[DTYPE_t, ndim=2] f,\n                             np.ndarray[DTYPE_t, ndim=2] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE)\n    cdef unsigned int i, j, iii, jjj\n    cdef int ii, jj\n\n    cdef int iimin, iimax, jjmin, jjmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                top = 0.\n                bot = 0.\n                iimin = i - wkx\n                iimax = i + wkx + 1\n                jjmin = j - wky\n                jjmax = j + wky + 1\n                for ii in range(iimin, iimax):\n                    for jj in range(jjmin, jjmax):\n                        iii = ii % nx\n                        jjj = jj % ny\n                        val = f[iii, jjj]\n                        ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                <unsigned int>(nky - 1 - (wky + jj - j))]\n                        if not npy_isnan(val):\n                            top += val * ker\n                            bot += ker\n                if normalize_by_kernel:\n                    if bot == 0:\n                        conv[i, j] = f[i, j]\n                    else:\n                        conv[i, j] = top / bot\n                else:\n                    conv[i, j] = top\n    # GIl acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve3d_boundary_wrap(np.ndarray[DTYPE_t, ndim=3] f,\n                             np.ndarray[DTYPE_t, ndim=3] g,\n                             bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nz = f.shape[2]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int nkz = g.shape[2]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef int wkz = nkz // 2\n    cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE)\n    cdef unsigned int i, j, k, iii, jjj, kkk\n    cdef int ii, jj, kk\n\n    cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                for k in range(nz):\n                    top = 0.\n                    bot = 0.\n                    iimin = i - wkx\n                    iimax = i + wkx + 1\n                    jjmin = j - wky\n                    jjmax = j + wky + 1\n                    kkmin = k - wkz\n                    kkmax = k + wkz + 1\n                    for ii in range(iimin, iimax):\n                        for jj in range(jjmin, jjmax):\n                            for kk in range(kkmin, kkmax):\n                                iii = ii % nx\n                                jjj = jj % ny\n                                kkk = kk % nz\n                                val = f[iii, jjj, kkk]\n                                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                        <unsigned int>(nky - 1 - (wky + jj - j)),\n                                        <unsigned int>(nkz - 1 - (wkz + kk - k))]\n                                if not npy_isnan(val):\n                                    top += val * ker\n                                    bot += ker\n                    if normalize_by_kernel:\n                        if bot == 0:\n                            conv[i, j, k] = f[i, j, k]\n                        else:\n                            conv[i, j, k] = top / bot\n                    else:\n                        conv[i, j, k] = top\n    # GIL acquired again here\n    return conv\n"},{"id":11258,"name":"boundary_extend.pyx","nodeType":"TextFile","path":"astropy/convolution","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport numpy as np\ncimport numpy as np\n\nDTYPE = float\nctypedef np.float_t DTYPE_t\n\ncdef inline int int_max(int a, int b) nogil: return a if a >= b else b\ncdef inline int int_min(int a, int b) nogil: return a if a <= b else b\n\ncdef extern from \"numpy/npy_math.h\" nogil:\n    bint npy_isnan(double x)\n\ncimport cython\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve1d_boundary_extend(np.ndarray[DTYPE_t, ndim=1] f,\n                               np.ndarray[DTYPE_t, ndim=1] g,\n                               bint normalize_by_kernel\n                              ):\n\n    if g.shape[0] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int nkx = g.shape[0]\n    cdef int wkx = nkx // 2\n    cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE)\n    cdef unsigned int i, iii\n    cdef int ii\n\n    cdef int iimin, iimax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            top = 0.\n            bot = 0.\n            iimin = i - wkx\n            iimax = i + wkx + 1\n            for ii in range(iimin, iimax):\n                iii = int_min(int_max(ii, 0), nx - 1)\n                val = f[iii]\n                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i))]\n                if not npy_isnan(val):\n                    top += val * ker\n                    bot += ker\n            if normalize_by_kernel:\n                if bot == 0:\n                    conv[i] = f[i]\n                else:\n                    conv[i] = top / bot\n            else:\n                conv[i] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve2d_boundary_extend(np.ndarray[DTYPE_t, ndim=2] f,\n                               np.ndarray[DTYPE_t, ndim=2] g,\n                               bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE)\n    cdef unsigned int i, j, iii, jjj\n    cdef int ii, jj\n\n    cdef int iimin, iimax, jjmin, jjmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                top = 0.\n                bot = 0.\n                iimin = i - wkx\n                iimax = i + wkx + 1\n                jjmin = j - wky\n                jjmax = j + wky + 1\n                for ii in range(iimin, iimax):\n                    for jj in range(jjmin, jjmax):\n                        iii = int_min(int_max(ii, 0), nx - 1)\n                        jjj = int_min(int_max(jj, 0), ny - 1)\n                        val = f[iii, jjj]\n                        ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                <unsigned int>(nky - 1 - (wky + jj - j))]\n                        if not npy_isnan(val):\n                            top += val * ker\n                            bot += ker\n                if normalize_by_kernel:\n                    if bot == 0:\n                        conv[i, j] = f[i, j]\n                    else:\n                        conv[i, j] = top / bot\n                else:\n                    conv[i, j] = top\n    # GIL acquired again here\n    return conv\n\n\n@cython.boundscheck(False)  # turn off bounds-checking for entire function\ndef convolve3d_boundary_extend(np.ndarray[DTYPE_t, ndim=3] f,\n                               np.ndarray[DTYPE_t, ndim=3] g,\n                               bint normalize_by_kernel):\n\n    if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1:\n        raise ValueError(\"Convolution kernel must have odd dimensions\")\n\n    assert f.dtype == DTYPE and g.dtype == DTYPE\n\n    cdef int nx = f.shape[0]\n    cdef int ny = f.shape[1]\n    cdef int nz = f.shape[2]\n    cdef int nkx = g.shape[0]\n    cdef int nky = g.shape[1]\n    cdef int nkz = g.shape[2]\n    cdef int wkx = nkx // 2\n    cdef int wky = nky // 2\n    cdef int wkz = nkz // 2\n    cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE)\n    cdef unsigned int i, j, k, iii, jjj, kkk\n    cdef int ii, jj, kk\n\n    cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax\n\n    cdef DTYPE_t top, bot, ker, val\n\n    # release the GIL\n    with nogil:\n\n        # Now run the proper convolution\n        for i in range(nx):\n            for j in range(ny):\n                for k in range(nz):\n                    top = 0.\n                    bot = 0.\n                    iimin = i - wkx\n                    iimax = i + wkx + 1\n                    jjmin = j - wky\n                    jjmax = j + wky + 1\n                    kkmin = k - wkz\n                    kkmax = k + wkz + 1\n                    for ii in range(iimin, iimax):\n                        for jj in range(jjmin, jjmax):\n                            for kk in range(kkmin, kkmax):\n                                iii = int_min(int_max(ii, 0), nx - 1)\n                                jjj = int_min(int_max(jj, 0), ny - 1)\n                                kkk = int_min(int_max(kk, 0), nz - 1)\n                                val = f[iii, jjj, kkk]\n                                ker = g[<unsigned int>(nkx - 1 - (wkx + ii - i)),\n                                        <unsigned int>(nky - 1 - (wky + jj - j)),\n                                        <unsigned int>(nkz - 1 - (wkz + kk - k))]\n                                if not npy_isnan(val):\n                                    top += val * ker\n                                    bot += ker\n                    if normalize_by_kernel:\n                        if bot == 0:\n                            conv[i, j, k] = f[i, j, k]\n                        else:\n                            conv[i, j, k] = top / bot\n                    else:\n                        conv[i, j, k] = top\n    # GIL acquired again here\n    return conv\n"},{"fileName":"kernels.py","filePath":"astropy/convolution","id":11259,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport math\n\nimport numpy as np\n\nfrom .core import Kernel1D, Kernel2D, Kernel\nfrom .utils import KernelSizeError\nfrom ..modeling import models\nfrom ..modeling.core import Fittable1DModel, Fittable2DModel\nfrom ..utils.decorators import deprecated_renamed_argument\n\n__all__ = ['Gaussian1DKernel', 'Gaussian2DKernel', 'CustomKernel',\n           'Box1DKernel', 'Box2DKernel', 'Tophat2DKernel',\n           'Trapezoid1DKernel', 'MexicanHat1DKernel', 'MexicanHat2DKernel',\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    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : odd int, optional\n        Size of the kernel array. Default = 8 * stddev\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, MexicanHat1DKernel\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    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\n        Rotation angle in radians. The rotation angle increases\n        counterclockwise.\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * stddev.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * stddev.\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, MexicanHat2DKernel, 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    @deprecated_renamed_argument('stddev', 'x_stddev', '3.0')\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    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, MexicanHat1DKernel\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 artifact, when applied repeatedly to the same data.\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, MexicanHat2DKernel, 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    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, MexicanHat2DKernel, 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    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, MexicanHat2DKernel,\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 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    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, MexicanHat1DKernel\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    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, MexicanHat2DKernel,\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 MexicanHat1DKernel(Kernel1D):\n    \"\"\"\n    1D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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 MexicanHat1DKernel\n        mexicanhat_1D_kernel = MexicanHat1DKernel(10)\n        plt.plot(mexicanhat_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.MexicanHat1D(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 MexicanHat2DKernel(Kernel2D):\n    \"\"\"\n    2D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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 MexicanHat2DKernel\n        mexicanhat_2D_kernel = MexicanHat2DKernel(10)\n        plt.imshow(mexicanhat_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.MexicanHat2D(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. This\n    kernel is normalized to a peak value of 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\n    Ring2DKernel, 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 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\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        self._model = models.Moffat2D((gamma - 1.0) / (np.pi * alpha * alpha),\n                                      0, 0, gamma, alpha)\n        fwhm = 2.0 * alpha * (2.0 ** (1.0 / gamma) - 1.0) ** 0.5\n        self._default_size = _round_up_to_odd_integer(4.0 * 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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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    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        odd = all(axes_size % 2 != 0 for axes_size in self.shape)\n        if not odd:\n            raise KernelSizeError(\"Kernel size must be odd in all axes.\")\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"},{"col":4,"comment":"null","endLoc":1254,"header":"@classmethod\n    def evaluate(cls, x, y, sigma, delta)","id":11260,"name":"evaluate","nodeType":"Function","startLoc":1252,"text":"@classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.copx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1294,"id":11261,"nodeType":"Class","startLoc":1260,"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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicPerspective(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cops2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1289,"header":"@property\n    def inverse(self)","id":11262,"name":"inverse","nodeType":"Function","startLoc":1287,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ConicPerspective(self.sigma.value, self.delta.value)"},{"col":4,"comment":"null","endLoc":1364,"header":"def _eval_sip(self, x, y, coef)","id":11263,"name":"_eval_sip","nodeType":"Function","startLoc":1352,"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":1323,"header":"def get_num_coeff(self, ndim)","id":11264,"name":"get_num_coeff","nodeType":"Function","startLoc":1312,"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"},{"col":4,"comment":"null","endLoc":1294,"header":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta)","id":11265,"name":"evaluate","nodeType":"Function","startLoc":1291,"text":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cops2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : odd int, optional\n        Size of the kernel array. Default = 8 * stddev\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, MexicanHat1DKernel\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":88,"id":11266,"nodeType":"Class","startLoc":28,"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    Parameters\n    ----------\n    stddev : number\n        Standard deviation of the Gaussian kernel.\n    x_size : odd int, optional\n        Size of the kernel array. Default = 8 * stddev\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, MexicanHat1DKernel\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())"},{"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 formulæ 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":1338,"id":11267,"nodeType":"Class","startLoc":1300,"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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicEqualArea(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coex2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1334,"header":"@property\n    def inverse(self)","id":11268,"name":"inverse","nodeType":"Function","startLoc":1332,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ConicEqualArea(self.sigma.value, self.delta.value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1284,"id":11269,"name":"inputs","nodeType":"Attribute","startLoc":1284,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1285,"id":11270,"name":"outputs","nodeType":"Attribute","startLoc":1285,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1286,"id":11271,"name":"_separable","nodeType":"Attribute","startLoc":1286,"text":"_separable"},{"col":4,"comment":"null","endLoc":88,"header":"def __init__(self, stddev, **kwargs)","id":11272,"name":"__init__","nodeType":"Function","startLoc":83,"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())"},{"attributeType":"null","col":8,"comment":"null","endLoc":1292,"id":11273,"name":"coeff_prefix","nodeType":"Attribute","startLoc":1292,"text":"self.coeff_prefix"},{"attributeType":"null","col":8,"comment":"null","endLoc":1293,"id":11274,"name":"_param_names","nodeType":"Attribute","startLoc":1293,"text":"self._param_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":1291,"id":11275,"name":"order","nodeType":"Attribute","startLoc":1291,"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 ndarray of length(2)\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 <http://adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    ","endLoc":1450,"id":11276,"nodeType":"Class","startLoc":1367,"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 ndarray of length(2)\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 <http://adsabs.harvard.edu/abs/2005ASPC..347..491S>`_\n    \"\"\"\n\n    inputs = ('u', 'v')\n    outputs = ('x', 'y')\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\n    def __repr__(self):\n        return '<{0}({1!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 = ['Model: {0}'.format(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":1423,"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":11277,"name":"__init__","nodeType":"Function","startLoc":1404,"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)"},{"col":4,"comment":"null","endLoc":1338,"header":"@classmethod\n    def evaluate(cls, x, y, sigma, delta)","id":11278,"name":"evaluate","nodeType":"Function","startLoc":1336,"text":"@classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coex2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1383,"id":11279,"nodeType":"Class","startLoc":1344,"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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicEqualArea(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coes2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1378,"header":"@property\n    def inverse(self)","id":11280,"name":"inverse","nodeType":"Function","startLoc":1376,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ConicEqualArea(self.sigma.value, self.delta.value)"},{"col":4,"comment":"null","endLoc":1383,"header":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta)","id":11281,"name":"evaluate","nodeType":"Function","startLoc":1380,"text":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coes2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1423,"id":11282,"nodeType":"Class","startLoc":1389,"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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicEquidistant(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.codx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1419,"header":"@property\n    def inverse(self)","id":11283,"name":"inverse","nodeType":"Function","startLoc":1417,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ConicEquidistant(self.sigma.value, self.delta.value)"},{"col":0,"comment":"null","endLoc":25,"header":"def _round_up_to_odd_integer(value)","id":11284,"name":"_round_up_to_odd_integer","nodeType":"Function","startLoc":20,"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"},{"col":4,"comment":"null","endLoc":1423,"header":"@classmethod\n    def evaluate(cls, x, y, sigma, delta)","id":11285,"name":"evaluate","nodeType":"Function","startLoc":1421,"text":"@classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.codx2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1464,"id":11286,"nodeType":"Class","startLoc":1429,"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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicEquidistant(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cods2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1459,"header":"@property\n    def inverse(self)","id":11287,"name":"inverse","nodeType":"Function","startLoc":1457,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ConicEquidistant(self.sigma.value, self.delta.value)"},{"col":4,"comment":"null","endLoc":1464,"header":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta)","id":11288,"name":"evaluate","nodeType":"Function","startLoc":1461,"text":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.cods2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1513,"id":11289,"nodeType":"Class","startLoc":1470,"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 formulæ 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    @property\n    def inverse(self):\n        return Sky2Pix_ConicOrthomorphic(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coox2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1509,"header":"@property\n    def inverse(self)","id":11290,"name":"inverse","nodeType":"Function","startLoc":1507,"text":"@property\n    def inverse(self):\n        return Sky2Pix_ConicOrthomorphic(self.sigma.value, self.delta.value)"},{"col":4,"comment":"null","endLoc":1427,"header":"def __repr__(self)","id":11291,"name":"__repr__","nodeType":"Function","startLoc":1425,"text":"def __repr__(self):\n        return '<{0}({1!r})>'.format(self.__class__.__name__,\n            [self.shift_a, self.shift_b, self.sip1d_a, self.sip1d_b])"},{"col":4,"comment":"null","endLoc":1435,"header":"def __str__(self)","id":11292,"name":"__str__","nodeType":"Function","startLoc":1429,"text":"def __str__(self):\n        parts = ['Model: {0}'.format(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)"},{"col":4,"comment":"null","endLoc":1513,"header":"@classmethod\n    def evaluate(cls, x, y, sigma, delta)","id":11293,"name":"evaluate","nodeType":"Function","startLoc":1511,"text":"@classmethod\n    def evaluate(cls, x, y, sigma, delta):\n        return _projections.coox2s(x, y, _to_orig_unit(sigma), _to_orig_unit(delta))"},{"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 formulæ 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":1563,"id":11294,"nodeType":"Class","startLoc":1519,"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 formulæ 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    @property\n    def inverse(self):\n        return Pix2Sky_ConicOrthomorphic(self.sigma.value, self.delta.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coos2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"col":4,"comment":"null","endLoc":1443,"header":"@property\n    def inverse(self)","id":11295,"name":"inverse","nodeType":"Function","startLoc":1437,"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.\")"},{"col":4,"comment":"null","endLoc":1558,"header":"@property\n    def inverse(self)","id":11296,"name":"inverse","nodeType":"Function","startLoc":1556,"text":"@property\n    def inverse(self):\n        return Pix2Sky_ConicOrthomorphic(self.sigma.value, self.delta.value)"},{"col":4,"comment":"null","endLoc":1563,"header":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta)","id":11297,"name":"evaluate","nodeType":"Function","startLoc":1560,"text":"@classmethod\n    def evaluate(cls, phi, theta, sigma, delta):\n        return _projections.coos2x(phi, theta,\n                                   _to_orig_unit(sigma), _to_orig_unit(delta))"},{"className":"PseudoConic","col":0,"comment":"Base class for pseudoconic projections.\n\n    Pseudoconics are a subclass of conics with concentric parallels.\n    ","endLoc":1573,"id":11298,"nodeType":"Class","startLoc":1569,"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":1608,"id":11299,"nodeType":"Class","startLoc":1576,"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    theta1 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    _separable = True\n\n    @property\n    def inverse(self):\n        return Sky2Pix_BonneEqualArea(self.theta1.value)\n\n    @classmethod\n    def evaluate(cls, x, y, theta1):\n        return _projections.bonx2s(x, y, _to_orig_unit(theta1))"},{"col":4,"comment":"null","endLoc":1604,"header":"@property\n    def inverse(self)","id":11300,"name":"inverse","nodeType":"Function","startLoc":1602,"text":"@property\n    def inverse(self):\n        return Sky2Pix_BonneEqualArea(self.theta1.value)"},{"col":4,"comment":"null","endLoc":1608,"header":"@classmethod\n    def evaluate(cls, x, y, theta1)","id":11301,"name":"evaluate","nodeType":"Function","startLoc":1606,"text":"@classmethod\n    def evaluate(cls, x, y, theta1):\n        return _projections.bonx2s(x, y, _to_orig_unit(theta1))"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1599,"id":11302,"name":"theta1","nodeType":"Attribute","startLoc":1599,"text":"theta1"},{"attributeType":"null","col":4,"comment":"null","endLoc":1600,"id":11303,"name":"_separable","nodeType":"Attribute","startLoc":1600,"text":"_separable"},{"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":1646,"id":11304,"nodeType":"Class","startLoc":1614,"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    theta1 = Parameter(default=0.0, getter=_to_orig_unit, setter=_to_radian)\n    _separable = True\n\n    @property\n    def inverse(self):\n        return Pix2Sky_BonneEqualArea(self.theta1.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, theta1):\n        return _projections.bons2x(phi, theta,\n                                   _to_orig_unit(theta1))"},{"col":4,"comment":"null","endLoc":1641,"header":"@property\n    def inverse(self)","id":11305,"name":"inverse","nodeType":"Function","startLoc":1639,"text":"@property\n    def inverse(self):\n        return Pix2Sky_BonneEqualArea(self.theta1.value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":80,"id":11306,"name":"_separable","nodeType":"Attribute","startLoc":80,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":81,"id":11307,"name":"_is_bool","nodeType":"Attribute","startLoc":81,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":11308,"name":"_default_size","nodeType":"Attribute","startLoc":86,"text":"self._default_size"},{"col":4,"comment":"null","endLoc":1646,"header":"@classmethod\n    def evaluate(cls, phi, theta, theta1)","id":11309,"name":"evaluate","nodeType":"Function","startLoc":1643,"text":"@classmethod\n    def evaluate(cls, phi, theta, theta1):\n        return _projections.bons2x(phi, theta,\n                                   _to_orig_unit(theta1))"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1636,"id":11310,"name":"theta1","nodeType":"Attribute","startLoc":1636,"text":"theta1"},{"attributeType":"Gaussian1D","col":8,"comment":"null","endLoc":84,"id":11311,"name":"_model","nodeType":"Attribute","startLoc":84,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":11312,"name":"_truncation","nodeType":"Attribute","startLoc":88,"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    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\n        Rotation angle in radians. The rotation angle increases\n        counterclockwise.\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * stddev.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * stddev.\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, MexicanHat2DKernel, 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":164,"id":11313,"nodeType":"Class","startLoc":91,"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    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\n        Rotation angle in radians. The rotation angle increases\n        counterclockwise.\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * stddev.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * stddev.\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, MexicanHat2DKernel, 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    @deprecated_renamed_argument('stddev', 'x_stddev', '3.0')\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":164,"header":"@deprecated_renamed_argument('stddev', 'x_stddev', '3.0')\n    def __init__(self, x_stddev, y_stddev=None, theta=0.0, **kwargs)","id":11314,"name":"__init__","nodeType":"Function","startLoc":154,"text":"@deprecated_renamed_argument('stddev', 'x_stddev', '3.0')\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":1497,"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":11315,"name":"__init__","nodeType":"Function","startLoc":1474,"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)"},{"col":4,"comment":"null","endLoc":1450,"header":"def evaluate(self, x, y)","id":11316,"name":"evaluate","nodeType":"Function","startLoc":1445,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1637,"id":11317,"name":"_separable","nodeType":"Attribute","startLoc":1637,"text":"_separable"},{"className":"Pix2Sky_Polyconic","col":0,"comment":"\n    Polyconic projection - pixel to sky.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    ","endLoc":1666,"id":11318,"nodeType":"Class","startLoc":1652,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_Polyconic()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.pcox2s(x, y)"},{"col":4,"comment":"null","endLoc":1662,"header":"@property\n    def inverse(self)","id":11319,"name":"inverse","nodeType":"Function","startLoc":1660,"text":"@property\n    def inverse(self):\n        return Sky2Pix_Polyconic()"},{"col":4,"comment":"null","endLoc":1666,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11320,"name":"evaluate","nodeType":"Function","startLoc":1664,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.pcox2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1658,"id":11321,"name":"_separable","nodeType":"Attribute","startLoc":1658,"text":"_separable"},{"className":"Sky2Pix_Polyconic","col":0,"comment":"\n    Polyconic projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    ","endLoc":1686,"id":11322,"nodeType":"Class","startLoc":1672,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_Polyconic()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pcos2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1682,"header":"@property\n    def inverse(self)","id":11323,"name":"inverse","nodeType":"Function","startLoc":1680,"text":"@property\n    def inverse(self):\n        return Pix2Sky_Polyconic()"},{"col":4,"comment":" Neutrino density function relative to the energy density in\n        photons.\n\n        Parameters\n        ----------\n        z : array like\n           Redshift\n\n        Returns\n        -------\n         f : ndarray, or float if z is scalar\n           The neutrino density scaling factor relative to the density\n           in photons at each redshift\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\n        for each one. Note that f has the asymptotic behavior :math:`f(0) = 1`.\n        This method returns :math:`0.2271 f` using an\n        analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18.\n        ","endLoc":783,"header":"def nu_relative_density(self, z)","id":11324,"name":"nu_relative_density","nodeType":"Function","startLoc":715,"text":"def nu_relative_density(self, z):\n        \"\"\" Neutrino density function relative to the energy density in\n        photons.\n\n        Parameters\n        ----------\n        z : array like\n           Redshift\n\n        Returns\n        -------\n         f : ndarray, or float if z is scalar\n           The neutrino density scaling factor relative to the density\n           in photons at each redshift\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\n        for each one. Note that f has the asymptotic behavior :math:`f(0) = 1`.\n        This method returns :math:`0.2271 f` using an\n        analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18.\n        \"\"\"\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        if not self._massivenu:\n            if np.isscalar(z):\n                return prefac * self._Neff\n            else:\n                return prefac * self._Neff * np.ones(np.asanyarray(z).shape)\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        z = np.asarray(z)\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":"null","endLoc":1686,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11325,"name":"evaluate","nodeType":"Function","startLoc":1684,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.pcos2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1678,"id":11326,"name":"_separable","nodeType":"Attribute","startLoc":1678,"text":"_separable"},{"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":1706,"id":11327,"nodeType":"Class","startLoc":1692,"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":1723,"id":11328,"nodeType":"Class","startLoc":1709,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_TangentialSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.tscx2s(x, y)"},{"col":4,"comment":"null","endLoc":1719,"header":"@property\n    def inverse(self)","id":11329,"name":"inverse","nodeType":"Function","startLoc":1717,"text":"@property\n    def inverse(self):\n        return Sky2Pix_TangentialSphericalCube()"},{"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":781,"header":"def interpolate_replace_nans(array, kernel, convolve=convolve, **kwargs)","id":11330,"name":"interpolate_replace_nans","nodeType":"Function","startLoc":743,"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, **kwargs)\n\n    isnan = np.isnan(array)\n    newarray[isnan] = convolved[isnan]\n\n    return newarray"},{"col":4,"comment":"null","endLoc":1723,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11331,"name":"evaluate","nodeType":"Function","startLoc":1721,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.tscx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1715,"id":11332,"name":"_separable","nodeType":"Attribute","startLoc":1715,"text":"_separable"},{"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 : CompoundModel\n        Convolved model\n    ","endLoc":815,"header":"def convolve_models(model, kernel, mode='convolve_fft', **kwargs)","id":11333,"name":"convolve_models","nodeType":"Function","startLoc":784,"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 : CompoundModel\n        Convolved model\n    \"\"\"\n\n    if mode == 'convolve_fft':\n        BINARY_OPERATORS['convolve_fft'] = _make_arithmetic_operator(partial(convolve_fft, **kwargs))\n    elif mode == 'convolve':\n        BINARY_OPERATORS['convolve'] = _make_arithmetic_operator(partial(convolve, **kwargs))\n    else:\n        raise ValueError('Mode {} is not supported.'.format(mode))\n\n    return _CompoundModelMeta._from_operator(mode, model, kernel)"},{"className":"Sky2Pix_TangentialSphericalCube","col":0,"comment":"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    ","endLoc":1743,"id":11334,"nodeType":"Class","startLoc":1729,"text":"class Sky2Pix_TangentialSphericalCube(Sky2PixProjection, QuadCube):\n    r\"\"\"\n    Tangential spherical cube projection - sky to pixel.\n\n    Corresponds to the ``PCO`` projection in FITS WCS.\n    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_TangentialSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tscs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1739,"header":"@property\n    def inverse(self)","id":11335,"name":"inverse","nodeType":"Function","startLoc":1737,"text":"@property\n    def inverse(self):\n        return Pix2Sky_TangentialSphericalCube()"},{"attributeType":"null","col":4,"comment":"null","endLoc":1400,"id":11336,"name":"inputs","nodeType":"Attribute","startLoc":1400,"text":"inputs"},{"col":4,"comment":"null","endLoc":1743,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11337,"name":"evaluate","nodeType":"Function","startLoc":1741,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.tscs2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1401,"id":11338,"name":"outputs","nodeType":"Attribute","startLoc":1401,"text":"outputs"},{"col":4,"comment":" Helper function for constructing __repr__","endLoc":300,"header":"def _namelead(self)","id":11339,"name":"_namelead","nodeType":"Function","startLoc":294,"text":"def _namelead(self):\n        \"\"\" Helper function for constructing __repr__\"\"\"\n        if self.name is None:\n            return \"{0}(\".format(self.__class__.__name__)\n        else:\n            return \"{0}(name=\\\"{1}\\\", \".format(self.__class__.__name__,\n                                               self.name)"},{"col":4,"comment":"null","endLoc":308,"header":"def __repr__(self)","id":11340,"name":"__repr__","nodeType":"Function","startLoc":302,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, \"\\\n                 \"Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":0,"comment":"","endLoc":4,"header":"__init__.py#<anonymous>","id":11341,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"try:\n    # Not guaranteed available at setup time\n    from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise"},{"attributeType":"null","col":4,"comment":"null","endLoc":1402,"id":11342,"name":"_separable","nodeType":"Attribute","startLoc":1402,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":1735,"id":11343,"name":"_separable","nodeType":"Attribute","startLoc":1735,"text":"_separable"},{"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":1763,"id":11344,"nodeType":"Class","startLoc":1749,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_COBEQuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.cscx2s(x, y)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1412,"id":11345,"name":"_ap_order","nodeType":"Attribute","startLoc":1412,"text":"self._ap_order"},{"col":4,"comment":"null","endLoc":1759,"header":"@property\n    def inverse(self)","id":11346,"name":"inverse","nodeType":"Function","startLoc":1757,"text":"@property\n    def inverse(self):\n        return Sky2Pix_COBEQuadSphericalCube()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1411,"id":11347,"name":"_b_coeff","nodeType":"Attribute","startLoc":1411,"text":"self._b_coeff"},{"col":4,"comment":"null","endLoc":1763,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11348,"name":"evaluate","nodeType":"Function","startLoc":1761,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.cscx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1755,"id":11349,"name":"_separable","nodeType":"Attribute","startLoc":1755,"text":"_separable"},{"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":1783,"id":11350,"nodeType":"Class","startLoc":1769,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_COBEQuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.cscs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1779,"header":"@property\n    def inverse(self)","id":11351,"name":"inverse","nodeType":"Function","startLoc":1777,"text":"@property\n    def inverse(self):\n        return Pix2Sky_COBEQuadSphericalCube()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1408,"id":11352,"name":"_a_order","nodeType":"Attribute","startLoc":1408,"text":"self._a_order"},{"col":0,"comment":" Helper function to format a variable that can be a float or None","endLoc":2813,"header":"def _float_or_none(x, digits=3)","id":11353,"name":"_float_or_none","nodeType":"Function","startLoc":2808,"text":"def _float_or_none(x, digits=3):\n    \"\"\" Helper function to format a variable that can be a float or None\"\"\"\n    if x is None:\n        return str(x)\n    fmtstr = \"{0:.{digits}g}\".format(x, digits=digits)\n    return fmtstr.format(x)"},{"col":4,"comment":" Return the Hubble constant as an `~astropy.units.Quantity` at z=0","endLoc":316,"header":"@property\n    def H0(self)","id":11354,"name":"H0","nodeType":"Function","startLoc":313,"text":"@property\n    def H0(self):\n        \"\"\" Return the Hubble constant as an `~astropy.units.Quantity` at z=0\"\"\"\n        return self._H0"},{"col":4,"comment":"null","endLoc":1783,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11355,"name":"evaluate","nodeType":"Function","startLoc":1781,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.cscs2x(phi, theta)"},{"col":4,"comment":" Omega matter; matter density/critical density at z=0","endLoc":321,"header":"@property\n    def Om0(self)","id":11356,"name":"Om0","nodeType":"Function","startLoc":318,"text":"@property\n    def Om0(self):\n        \"\"\" Omega matter; matter density/critical density at z=0\"\"\"\n        return self._Om0"},{"col":4,"comment":" Omega dark energy; dark energy density/critical density at z=0","endLoc":326,"header":"@property\n    def Ode0(self)","id":11357,"name":"Ode0","nodeType":"Function","startLoc":323,"text":"@property\n    def Ode0(self):\n        \"\"\" Omega dark energy; dark energy density/critical density at z=0\"\"\"\n        return self._Ode0"},{"col":4,"comment":" Omega baryon; baryonic matter density/critical density at z=0","endLoc":331,"header":"@property\n    def Ob0(self)","id":11358,"name":"Ob0","nodeType":"Function","startLoc":328,"text":"@property\n    def Ob0(self):\n        \"\"\" Omega baryon; baryonic matter density/critical density at z=0\"\"\"\n        return self._Ob0"},{"col":4,"comment":" Omega dark matter; dark matter density/critical density at z=0","endLoc":336,"header":"@property\n    def Odm0(self)","id":11359,"name":"Odm0","nodeType":"Function","startLoc":333,"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\n        at z=0","endLoc":342,"header":"@property\n    def Ok0(self)","id":11360,"name":"Ok0","nodeType":"Function","startLoc":338,"text":"@property\n    def Ok0(self):\n        \"\"\" Omega curvature; the effective curvature density/critical density\n        at z=0\"\"\"\n        return self._Ok0"},{"col":4,"comment":" Temperature of the CMB as `~astropy.units.Quantity` at z=0","endLoc":347,"header":"@property\n    def Tcmb0(self)","id":11361,"name":"Tcmb0","nodeType":"Function","startLoc":344,"text":"@property\n    def Tcmb0(self):\n        \"\"\" Temperature of the CMB as `~astropy.units.Quantity` at z=0\"\"\"\n        return self._Tcmb0"},{"col":4,"comment":" Temperature of the neutrino background as `~astropy.units.Quantity` at z=0","endLoc":352,"header":"@property\n    def Tnu0(self)","id":11362,"name":"Tnu0","nodeType":"Function","startLoc":349,"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":" Number of effective neutrino species","endLoc":357,"header":"@property\n    def Neff(self)","id":11363,"name":"Neff","nodeType":"Function","startLoc":354,"text":"@property\n    def Neff(self):\n        \"\"\" Number of effective neutrino species\"\"\"\n        return self._Neff"},{"col":4,"comment":" Does this cosmology have at least one massive neutrino species?","endLoc":364,"header":"@property\n    def has_massive_nu(self)","id":11364,"name":"has_massive_nu","nodeType":"Function","startLoc":359,"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":" Mass of neutrino species","endLoc":380,"header":"@property\n    def m_nu(self)","id":11365,"name":"m_nu","nodeType":"Function","startLoc":366,"text":"@property\n    def m_nu(self):\n        \"\"\" Mass of neutrino species\"\"\"\n        if self._Tnu0.value == 0:\n            return None\n        if not self._massivenu:\n            # Only massless\n            return u.Quantity(np.zeros(self._nmasslessnu), u.eV)\n        if self._nmasslessnu == 0:\n            # Only massive\n            return u.Quantity(self._massivenu_mass, u.eV)\n        # A mix -- the most complicated case\n        numass = np.append(np.zeros(self._nmasslessnu),\n                           self._massivenu_mass.value)\n        return u.Quantity(numass, u.eV)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1775,"id":11366,"name":"_separable","nodeType":"Attribute","startLoc":1775,"text":"_separable"},{"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":1803,"id":11367,"nodeType":"Class","startLoc":1789,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_QuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.qscx2s(x, y)"},{"attributeType":"_SIP1D","col":8,"comment":"null","endLoc":1420,"id":11368,"name":"sip1d_b","nodeType":"Attribute","startLoc":1420,"text":"self.sip1d_b"},{"attributeType":"null","col":8,"comment":"null","endLoc":1409,"id":11369,"name":"_b_order","nodeType":"Attribute","startLoc":1409,"text":"self._b_order"},{"col":4,"comment":"null","endLoc":1799,"header":"@property\n    def inverse(self)","id":11370,"name":"inverse","nodeType":"Function","startLoc":1797,"text":"@property\n    def inverse(self):\n        return Sky2Pix_QuadSphericalCube()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1415,"id":11371,"name":"_bp_coeff","nodeType":"Attribute","startLoc":1415,"text":"self._bp_coeff"},{"col":4,"comment":"null","endLoc":1803,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11372,"name":"evaluate","nodeType":"Function","startLoc":1801,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.qscx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1795,"id":11373,"name":"_separable","nodeType":"Attribute","startLoc":1795,"text":"_separable"},{"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":1823,"id":11374,"nodeType":"Class","startLoc":1809,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_QuadSphericalCube()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.qscs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":1819,"header":"@property\n    def inverse(self)","id":11375,"name":"inverse","nodeType":"Function","startLoc":1817,"text":"@property\n    def inverse(self):\n        return Pix2Sky_QuadSphericalCube()"},{"attributeType":"null","col":8,"comment":"null","endLoc":1410,"id":11376,"name":"_a_coeff","nodeType":"Attribute","startLoc":1410,"text":"self._a_coeff"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":11377,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":24,"comment":"null","endLoc":13,"id":11378,"name":"u","nodeType":"Attribute","startLoc":13,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":11379,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":22,"text":"__doctest_skip__"},{"col":4,"comment":"null","endLoc":1823,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11380,"name":"evaluate","nodeType":"Function","startLoc":1821,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.qscs2x(phi, theta)"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":11381,"name":"BOUNDARY_OPTIONS","nodeType":"Attribute","startLoc":24,"text":"BOUNDARY_OPTIONS"},{"col":0,"comment":"","endLoc":4,"header":"convolve.py#<anonymous>","id":11382,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__doctest_skip__ = ['*']\n\nBOUNDARY_OPTIONS = [None, 'fill', 'wrap', 'extend']"},{"attributeType":"null","col":4,"comment":"null","endLoc":1815,"id":11383,"name":"_separable","nodeType":"Attribute","startLoc":1815,"text":"_separable"},{"className":"HEALPix","col":0,"comment":"Base class for HEALPix projections.\n    ","endLoc":1831,"id":11384,"nodeType":"Class","startLoc":1829,"text":"class HEALPix(Projection):\n    r\"\"\"Base class for HEALPix projections.\n    \"\"\""},{"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    ","endLoc":1859,"id":11385,"nodeType":"Class","startLoc":1834,"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    _separable = True\n\n    H = Parameter(default=4.0)\n    X = Parameter(default=3.0)\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HEALPix(self.H.value, self.X.value)\n\n    @classmethod\n    def evaluate(cls, x, y, H, X):\n        return _projections.hpxx2s(x, y, H, X)"},{"attributeType":"null","col":4,"comment":"null","endLoc":151,"id":11386,"name":"_separable","nodeType":"Attribute","startLoc":151,"text":"_separable"},{"attributeType":"_SIP1D","col":8,"comment":"null","endLoc":1418,"id":11387,"name":"sip1d_a","nodeType":"Attribute","startLoc":1418,"text":"self.sip1d_a"},{"attributeType":"null","col":8,"comment":"null","endLoc":1407,"id":11388,"name":"_crpix","nodeType":"Attribute","startLoc":1407,"text":"self._crpix"},{"col":4,"comment":"null","endLoc":1855,"header":"@property\n    def inverse(self)","id":11389,"name":"inverse","nodeType":"Function","startLoc":1853,"text":"@property\n    def inverse(self):\n        return Sky2Pix_HEALPix(self.H.value, self.X.value)"},{"col":4,"comment":" Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc]","endLoc":385,"header":"@property\n    def h(self)","id":11390,"name":"h","nodeType":"Function","startLoc":382,"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":390,"header":"@property\n    def hubble_time(self)","id":11391,"name":"hubble_time","nodeType":"Function","startLoc":387,"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":395,"header":"@property\n    def hubble_distance(self)","id":11392,"name":"hubble_distance","nodeType":"Function","startLoc":392,"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":400,"header":"@property\n    def critical_density0(self)","id":11393,"name":"critical_density0","nodeType":"Function","startLoc":397,"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":405,"header":"@property\n    def Ogamma0(self)","id":11394,"name":"Ogamma0","nodeType":"Function","startLoc":402,"text":"@property\n    def Ogamma0(self):\n        \"\"\" Omega gamma; the density/critical density of photons at z=0\"\"\"\n        return self._Ogamma0"},{"col":4,"comment":" Omega nu; the density/critical density of neutrinos at z=0","endLoc":410,"header":"@property\n    def Onu0(self)","id":11395,"name":"Onu0","nodeType":"Function","startLoc":407,"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":" Returns a copy of this object, potentially with some changes.\n\n        Returns\n        -------\n        newcos : Subclass of FLRW\n        A new instance of this class with the specified changes.\n\n        Notes\n        -----\n        This assumes that the values of all constructor arguments\n        are available as properties, which is true of all the provided\n        subclasses but may not be true of user-provided ones.  You can't\n        change the type of class, so this can't be used to change between\n        flat and non-flat.  If no modifications are requested, then\n        a reference to this object is returned.\n\n        Examples\n        --------\n        To make a copy of the Planck13 cosmology with a different Omega_m\n        and a new name:\n\n        >>> from astropy.cosmology import Planck13\n        >>> newcos = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n        ","endLoc":471,"header":"def clone(self, **kwargs)","id":11396,"name":"clone","nodeType":"Function","startLoc":412,"text":"def clone(self, **kwargs):\n        \"\"\" Returns a copy of this object, potentially with some changes.\n\n        Returns\n        -------\n        newcos : Subclass of FLRW\n        A new instance of this class with the specified changes.\n\n        Notes\n        -----\n        This assumes that the values of all constructor arguments\n        are available as properties, which is true of all the provided\n        subclasses but may not be true of user-provided ones.  You can't\n        change the type of class, so this can't be used to change between\n        flat and non-flat.  If no modifications are requested, then\n        a reference to this object is returned.\n\n        Examples\n        --------\n        To make a copy of the Planck13 cosmology with a different Omega_m\n        and a new name:\n\n        >>> from astropy.cosmology import Planck13\n        >>> newcos = Planck13.clone(name=\"Modified Planck 2013\", Om0=0.35)\n        \"\"\"\n\n        # Quick return check, taking advantage of the\n        # immutability of cosmological objects\n        if len(kwargs) == 0:\n            return self\n\n        # Get constructor arguments\n        arglist = signature(self.__init__).parameters.keys()\n\n        # Build the dictionary of values used to construct this\n        #  object.  This -assumes- every argument to __init__ has a\n        #  property.  This is true of all the classes we provide, but\n        #  maybe a user won't do that.  So at least try to have a useful\n        #  error message.\n        argdict = {}\n        for arg in arglist:\n            try:\n                val = getattr(self, arg)\n                argdict[arg] = val\n            except AttributeError:\n                # We didn't find a property -- complain usefully\n                errstr = \"Object did not have property corresponding \"\\\n                         \"to constructor argument '{}'; perhaps it is a \"\\\n                         \"user provided subclass that does not do so\"\n                raise AttributeError(errstr.format(arg))\n\n        # Now substitute in new arguments\n        for newarg in kwargs:\n            if newarg not in argdict:\n                errstr = \"User provided argument '{}' not found in \"\\\n                         \"constructor for this object\"\n                raise AttributeError(errstr.format(newarg))\n            argdict[newarg] = kwargs[newarg]\n\n        return self.__class__(**argdict)"},{"attributeType":"Shift","col":8,"comment":"null","endLoc":1416,"id":11397,"name":"shift_a","nodeType":"Attribute","startLoc":1416,"text":"self.shift_a"},{"attributeType":"Shift","col":8,"comment":"null","endLoc":1417,"id":11398,"name":"shift_b","nodeType":"Attribute","startLoc":1417,"text":"self.shift_b"},{"attributeType":"null","col":8,"comment":"null","endLoc":1413,"id":11399,"name":"_bp_order","nodeType":"Attribute","startLoc":1413,"text":"self._bp_order"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":11400,"name":"_is_bool","nodeType":"Attribute","startLoc":152,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":161,"id":11401,"name":"_default_size","nodeType":"Attribute","startLoc":161,"text":"self._default_size"},{"id":11402,"name":"astropy/convolution/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/convolution/tests","id":11403,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":1859,"header":"@classmethod\n    def evaluate(cls, x, y, H, X)","id":11404,"name":"evaluate","nodeType":"Function","startLoc":1857,"text":"@classmethod\n    def evaluate(cls, x, y, H, X):\n        return _projections.hpxx2s(x, y, H, X)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1848,"id":11405,"name":"_separable","nodeType":"Attribute","startLoc":1848,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1850,"id":11406,"name":"H","nodeType":"Attribute","startLoc":1850,"text":"H"},{"attributeType":"null","col":8,"comment":"null","endLoc":1414,"id":11407,"name":"_ap_coeff","nodeType":"Attribute","startLoc":1414,"text":"self._ap_coeff"},{"attributeType":"Gaussian2D","col":8,"comment":"null","endLoc":158,"id":11408,"name":"_model","nodeType":"Attribute","startLoc":158,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":164,"id":11409,"name":"_truncation","nodeType":"Attribute","startLoc":164,"text":"self._truncation"},{"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":1514,"id":11410,"nodeType":"Class","startLoc":1453,"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    inputs = ('x', 'y')\n    outputs = ('u', 'v')\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 '<{0}({1!r})>'.format(self.__class__.__name__,\n            [self.sip1d_ap, self.sip1d_bp])\n\n    def __str__(self):\n        parts = ['Model: {0}'.format(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":1501,"header":"def __repr__(self)","id":11411,"name":"__repr__","nodeType":"Function","startLoc":1499,"text":"def __repr__(self):\n        return '<{0}({1!r})>'.format(self.__class__.__name__,\n            [self.sip1d_ap, self.sip1d_bp])"},{"col":4,"comment":"null","endLoc":1509,"header":"def __str__(self)","id":11412,"name":"__str__","nodeType":"Function","startLoc":1503,"text":"def __str__(self):\n        parts = ['Model: {0}'.format(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)"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1851,"id":11413,"name":"X","nodeType":"Attribute","startLoc":1851,"text":"X"},{"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    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, MexicanHat1DKernel\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":232,"id":11414,"nodeType":"Class","startLoc":167,"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    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, MexicanHat1DKernel\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":232,"header":"def __init__(self, width, **kwargs)","id":11415,"name":"__init__","nodeType":"Function","startLoc":226,"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":4,"comment":"null","endLoc":1514,"header":"def evaluate(self, x, y)","id":11416,"name":"evaluate","nodeType":"Function","startLoc":1511,"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"},{"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    ","endLoc":1890,"id":11417,"nodeType":"Class","startLoc":1865,"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    _separable = True\n\n    H = Parameter(default=4.0)\n    X = Parameter(default=3.0)\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HEALPix(self.H.value, self.X.value)\n\n    @classmethod\n    def evaluate(cls, phi, theta, H, X):\n        return _projections.hpxs2x(phi, theta, H, X)"},{"col":4,"comment":"null","endLoc":1886,"header":"@property\n    def inverse(self)","id":11418,"name":"inverse","nodeType":"Function","startLoc":1884,"text":"@property\n    def inverse(self):\n        return Pix2Sky_HEALPix(self.H.value, self.X.value)"},{"col":4,"comment":"null","endLoc":1890,"header":"@classmethod\n    def evaluate(cls, phi, theta, H, X)","id":11419,"name":"evaluate","nodeType":"Function","startLoc":1888,"text":"@classmethod\n    def evaluate(cls, phi, theta, H, X):\n        return _projections.hpxs2x(phi, theta, H, X)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1879,"id":11420,"name":"_separable","nodeType":"Attribute","startLoc":1879,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1881,"id":11421,"name":"H","nodeType":"Attribute","startLoc":1881,"text":"H"},{"id":11422,"name":"astropy/coordinates","nodeType":"Package"},{"fileName":"orbital_elements.py","filePath":"astropy/coordinates","id":11423,"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\n\nfrom .. import units as u\nfrom .. import _erfa as erfa\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\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                                          equinox=t)\n\n    return SkyCoord(ecliptic_coo.transform_to(ICRS))\n"},{"attributeType":"null","col":4,"comment":"null","endLoc":223,"id":11424,"name":"_separable","nodeType":"Attribute","startLoc":223,"text":"_separable"},{"col":4,"comment":" The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in units where c=1.\n\n        This must be overridden by subclasses.\n        ","endLoc":496,"header":"@abstractmethod\n    def w(self, z)","id":11425,"name":"w","nodeType":"Function","startLoc":473,"text":"@abstractmethod\n    def w(self, z):\n        \"\"\" The dark energy equation of state.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.\n\n        This must be overridden by subclasses.\n        \"\"\"\n        raise NotImplementedError(\"w(z) is not implemented\")"},{"className":"GeocentricTrueEcliptic","col":0,"comment":"\n    Geocentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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).\n    ","endLoc":120,"id":11426,"nodeType":"Class","startLoc":97,"text":"class GeocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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).\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)"},{"col":4,"comment":" Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Om : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest; see `Onu`.\n        ","endLoc":521,"header":"def Om(self, z)","id":11427,"name":"Om","nodeType":"Function","startLoc":498,"text":"def Om(self, z):\n        \"\"\" Return the density parameter for non-relativistic matter\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Om : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest; see `Onu`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Om0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2"},{"attributeType":"null","col":4,"comment":"null","endLoc":224,"id":11428,"name":"_is_bool","nodeType":"Attribute","startLoc":224,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":228,"id":11429,"name":"_default_size","nodeType":"Attribute","startLoc":228,"text":"self._default_size"},{"fileName":"angle_lextab.py","filePath":"astropy/coordinates","id":11430,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n_tabversion   = '3.8'\n_lextokens    = set(('UINT', 'SIMPLE_UNIT', 'DEGREE', 'MINUTE', 'HOUR', 'COLON', 'UFLOAT', 'SIGN', 'SECOND'))\n_lexreflags   = 0\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_SIMPLE_UNIT>(?:karcsec)|(?:uarcsec)|(?:Earcmin)|(?:Zdeg)|(?:crad)|(?:cycle)|(?:hectoradian)|(?:Yarcmin)|(?:kiloarcsecond)|(?:zeptoarcminute)|(?:adeg)|(?:darcmin)|(?:ddeg)|(?:exaradian)|(?:parcsec)|(?:yoctoradian)|(?:arcsecond)|(?:petadegree)|(?:petaarcminute)|(?:microarcsecond)|(?:mas)|(?:parcmin)|(?:hdeg)|(?:narcmin)|(?:attodegree)|(?:kilodegree)|(?:zettaradian)|(?:fdeg)|(?:zeptoradian)|(?:microradian)|(?:Gdeg)|(?:hectodegree)|(?:attoarcsecond)|(?:Marcmin)|(?:exadegree)|(?:femtodegree)|(?:yottaradian)|(?:pdeg)|(?:zarcmin)|(?:kiloarcminute)|(?:urad)|(?:teraarcsecond)|(?:nrad)|(?:carcsec)|(?:Pdeg)|(?:Yrad)|(?:yrad)|(?:picoarcsecond)|(?:aarcsec)|(?:dekaradian)|(?:Zrad)|(?:femtoradian)|(?:yarcsec)|(?:arcmin)|(?:arcsec)|(?:yottadegree)|(?:drad)|(?:dekadegree)|(?:zdeg)|(?:zeptoarcsecond)|(?:farcmin)|(?:Parcmin)|(?:decaarcminute)|(?:nanoarcminute)|(?:nanoarcsecond)|(?:Tdeg)|(?:decaarcsecond)|(?:nanodegree)|(?:farcsec)|(?:femtoarcminute)|(?:microdegree)|(?:deciarcsecond)|(?:deciarcminute)|(?:attoradian)|(?:dadeg)|(?:decidegree)|(?:hectoarcminute)|(?:milliarcsecond)|(?:femtoarcsecond)|(?:megaarcminute)|(?:yoctoarcminute)|(?:zrad)|(?:hectoarcsecond)|(?:frad)|(?:centiarcsecond)|(?:carcmin)|(?:Garcmin)|(?:decadegree)|(?:Grad)|(?:petaarcsecond)|(?:gigaarcsecond)|(?:megaradian)|(?:Tarcsec)|(?:Prad)|(?:zettadegree)|(?:yottaarcminute)|(?:mrad)|(?:yottaarcsecond)|(?:exaarcminute)|(?:harcmin)|(?:dekaarcsecond)|(?:cy)|(?:ndeg)|(?:teraradian)|(?:teradegree)|(?:Zarcsec)|(?:gigadegree)|(?:Mdeg)|(?:Mrad)|(?:centiarcminute)|(?:uarcmin)|(?:picoradian)|(?:radian)|(?:ydeg)|(?:milliarcminute)|(?:deciradian)|(?:narcsec)|(?:Trad)|(?:picodegree)|(?:yoctodegree)|(?:zettaarcminute)|(?:daarcmin)|(?:arcminute)|(?:yarcmin)|(?:kdeg)|(?:Earcsec)|(?:Edeg)|(?:harcsec)|(?:rad)|(?:centidegree)|(?:Garcsec)|(?:marcsec)|(?:megaarcsecond)|(?:attoarcminute)|(?:cdeg)|(?:Erad)|(?:kiloradian)|(?:daarcsec)|(?:Parcsec)|(?:megadegree)|(?:millidegree)|(?:centiradian)|(?:uas)|(?:teraarcminute)|(?:prad)|(?:yoctoarcsecond)|(?:hrad)|(?:picoarcminute)|(?:petaradian)|(?:Marcsec)|(?:marcmin)|(?:Tarcmin)|(?:zeptodegree)|(?:Yarcsec)|(?:gigaarcminute)|(?:Zarcmin)|(?:arad)|(?:karcmin)|(?:darcsec)|(?:exaarcsecond)|(?:nanoradian)|(?:udeg)|(?:zarcsec)|(?:Ydeg)|(?:decaradian)|(?:milliradian)|(?:aarcmin)|(?:zettaarcsecond)|(?:darad)|(?:microarcminute)|(?:mdeg)|(?:dekaarcminute)|(?:krad)|(?:gigaradian))|(?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_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":"Box1D","col":8,"comment":"null","endLoc":227,"id":11431,"name":"_model","nodeType":"Attribute","startLoc":227,"text":"self._model"},{"className":"BaseEclipticFrame","col":0,"comment":"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    {params}\n    ","endLoc":90,"id":11432,"nodeType":"Class","startLoc":58,"text":"class BaseEclipticFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    {params}\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_lon_coslat', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_lat', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_lon', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_lat', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\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    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1882,"id":11433,"name":"X","nodeType":"Attribute","startLoc":1882,"text":"X"},{"attributeType":"null","col":4,"comment":"null","endLoc":66,"id":11434,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":66,"text":"frame_specific_representation_info"},{"col":4,"comment":"Inverse of efunc.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the inverse Hubble constant.\n        ","endLoc":904,"header":"def inv_efunc(self, z)","id":11435,"name":"inv_efunc","nodeType":"Function","startLoc":879,"text":"def inv_efunc(self, z):\n        \"\"\"Inverse of efunc.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the inverse Hubble constant.\n        \"\"\"\n\n        # Avoid the function overhead by repeating code\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * self.de_density_scale(z))**(-0.5)"},{"attributeType":"null","col":8,"comment":"null","endLoc":231,"id":11436,"name":"_truncation","nodeType":"Attribute","startLoc":231,"text":"self._truncation"},{"attributeType":"null","col":4,"comment":"null","endLoc":89,"id":11437,"name":"default_representation","nodeType":"Attribute","startLoc":89,"text":"default_representation"},{"attributeType":"null","col":0,"comment":"null","endLoc":4,"id":11438,"name":"_tabversion","nodeType":"Attribute","startLoc":4,"text":"_tabversion"},{"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 artifact, when applied repeatedly to the same data.\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, MexicanHat2DKernel, 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":302,"id":11439,"nodeType":"Class","startLoc":235,"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 artifact, when applied repeatedly to the same data.\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, MexicanHat2DKernel, 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()"},{"col":4,"comment":"null","endLoc":302,"header":"def __init__(self, width, **kwargs)","id":11440,"name":"__init__","nodeType":"Function","startLoc":296,"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":0,"comment":"null","endLoc":5,"id":11441,"name":"_lextokens","nodeType":"Attribute","startLoc":5,"text":"_lextokens"},{"attributeType":"null","col":4,"comment":"null","endLoc":90,"id":11442,"name":"default_differential","nodeType":"Attribute","startLoc":90,"text":"default_differential"},{"attributeType":"null","col":0,"comment":"null","endLoc":6,"id":11443,"name":"_lexreflags","nodeType":"Attribute","startLoc":6,"text":"_lexreflags"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":11444,"name":"_lexliterals","nodeType":"Attribute","startLoc":7,"text":"_lexliterals"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":11445,"name":"_lexstateinfo","nodeType":"Attribute","startLoc":8,"text":"_lexstateinfo"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":11446,"name":"_lexstatere","nodeType":"Attribute","startLoc":9,"text":"_lexstatere"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":11447,"name":"equinox","nodeType":"Attribute","startLoc":120,"text":"equinox"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":11448,"name":"_lexstateignore","nodeType":"Attribute","startLoc":10,"text":"_lexstateignore"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":11449,"name":"_lexstateerrorf","nodeType":"Attribute","startLoc":11,"text":"_lexstateerrorf"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":11450,"name":"_lexstateeoff","nodeType":"Attribute","startLoc":12,"text":"_lexstateeoff"},{"col":0,"comment":"","endLoc":4,"header":"angle_lextab.py#<anonymous>","id":11451,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_tabversion   = '3.8'\n\n_lextokens    = set(('UINT', 'SIMPLE_UNIT', 'DEGREE', 'MINUTE', 'HOUR', 'COLON', 'UFLOAT', 'SIGN', 'SECOND'))\n\n_lexreflags   = 0\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_SIMPLE_UNIT>(?:karcsec)|(?:uarcsec)|(?:Earcmin)|(?:Zdeg)|(?:crad)|(?:cycle)|(?:hectoradian)|(?:Yarcmin)|(?:kiloarcsecond)|(?:zeptoarcminute)|(?:adeg)|(?:darcmin)|(?:ddeg)|(?:exaradian)|(?:parcsec)|(?:yoctoradian)|(?:arcsecond)|(?:petadegree)|(?:petaarcminute)|(?:microarcsecond)|(?:mas)|(?:parcmin)|(?:hdeg)|(?:narcmin)|(?:attodegree)|(?:kilodegree)|(?:zettaradian)|(?:fdeg)|(?:zeptoradian)|(?:microradian)|(?:Gdeg)|(?:hectodegree)|(?:attoarcsecond)|(?:Marcmin)|(?:exadegree)|(?:femtodegree)|(?:yottaradian)|(?:pdeg)|(?:zarcmin)|(?:kiloarcminute)|(?:urad)|(?:teraarcsecond)|(?:nrad)|(?:carcsec)|(?:Pdeg)|(?:Yrad)|(?:yrad)|(?:picoarcsecond)|(?:aarcsec)|(?:dekaradian)|(?:Zrad)|(?:femtoradian)|(?:yarcsec)|(?:arcmin)|(?:arcsec)|(?:yottadegree)|(?:drad)|(?:dekadegree)|(?:zdeg)|(?:zeptoarcsecond)|(?:farcmin)|(?:Parcmin)|(?:decaarcminute)|(?:nanoarcminute)|(?:nanoarcsecond)|(?:Tdeg)|(?:decaarcsecond)|(?:nanodegree)|(?:farcsec)|(?:femtoarcminute)|(?:microdegree)|(?:deciarcsecond)|(?:deciarcminute)|(?:attoradian)|(?:dadeg)|(?:decidegree)|(?:hectoarcminute)|(?:milliarcsecond)|(?:femtoarcsecond)|(?:megaarcminute)|(?:yoctoarcminute)|(?:zrad)|(?:hectoarcsecond)|(?:frad)|(?:centiarcsecond)|(?:carcmin)|(?:Garcmin)|(?:decadegree)|(?:Grad)|(?:petaarcsecond)|(?:gigaarcsecond)|(?:megaradian)|(?:Tarcsec)|(?:Prad)|(?:zettadegree)|(?:yottaarcminute)|(?:mrad)|(?:yottaarcsecond)|(?:exaarcminute)|(?:harcmin)|(?:dekaarcsecond)|(?:cy)|(?:ndeg)|(?:teraradian)|(?:teradegree)|(?:Zarcsec)|(?:gigadegree)|(?:Mdeg)|(?:Mrad)|(?:centiarcminute)|(?:uarcmin)|(?:picoradian)|(?:radian)|(?:ydeg)|(?:milliarcminute)|(?:deciradian)|(?:narcsec)|(?:Trad)|(?:picodegree)|(?:yoctodegree)|(?:zettaarcminute)|(?:daarcmin)|(?:arcminute)|(?:yarcmin)|(?:kdeg)|(?:Earcsec)|(?:Edeg)|(?:harcsec)|(?:rad)|(?:centidegree)|(?:Garcsec)|(?:marcsec)|(?:megaarcsecond)|(?:attoarcminute)|(?:cdeg)|(?:Erad)|(?:kiloradian)|(?:daarcsec)|(?:Parcsec)|(?:megadegree)|(?:millidegree)|(?:centiradian)|(?:uas)|(?:teraarcminute)|(?:prad)|(?:yoctoarcsecond)|(?:hrad)|(?:picoarcminute)|(?:petaradian)|(?:Marcsec)|(?:marcmin)|(?:Tarcmin)|(?:zeptodegree)|(?:Yarcsec)|(?:gigaarcminute)|(?:Zarcmin)|(?:arad)|(?:karcmin)|(?:darcsec)|(?:exaarcsecond)|(?:nanoradian)|(?:udeg)|(?:zarcsec)|(?:Ydeg)|(?:decaradian)|(?:milliradian)|(?:aarcmin)|(?:zettaarcsecond)|(?:darad)|(?:microarcminute)|(?:mdeg)|(?:dekaarcminute)|(?:krad)|(?:gigaradian))|(?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_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 = {}"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":11452,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":11453,"name":"_MOON_L_R","nodeType":"Attribute","startLoc":20,"text":"_MOON_L_R"},{"fileName":"sites.py","filePath":"astropy/coordinates","id":11454,"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 import Mapping\n\nfrom ..utils.data import get_pkg_data_contents, get_file_contents\nfrom .earth import EarthLocation\nfrom .errors import UnknownSiteException\nfrom .. 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]\n            location = EarthLocation.from_geodetic(site_info['longitude'] * u.Unit(site_info['longitude_unit']),\n                                                   site_info['latitude'] * u.Unit(site_info['latitude_unit']),\n                                                   site_info['elevation'] * u.Unit(site_info['elevation_unit']))\n            location.info.name = site_info['name']\n\n            reg.add_site([site] + site_info['aliases'], location)\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    if jsonurl is None:\n        content = get_pkg_data_contents('coordinates/sites.json')\n    else:\n        content = get_file_contents(jsonurl)\n\n    jsondb = json.loads(content)\n    return SiteRegistry.from_json(jsondb)\n"},{"className":"UnknownSiteException","col":0,"comment":"null","endLoc":175,"id":11455,"nodeType":"Class","startLoc":167,"text":"class UnknownSiteException(KeyError):\n    def __init__(self, site, attribute, close_names=None):\n        message = \"Site '{0}' not in database. Use {1} to see available sites.\".format(site, attribute)\n        if close_names:\n            message += \" Did you mean one of: '{0}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)"},{"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":1910,"id":11456,"nodeType":"Class","startLoc":1896,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Sky2Pix_HEALPix()\n\n    @classmethod\n    def evaluate(cls, x, y):\n        return _projections.xphx2s(x, y)"},{"attributeType":"null","col":8,"comment":"null","endLoc":172,"id":11457,"name":"site","nodeType":"Attribute","startLoc":172,"text":"self.site"},{"col":4,"comment":"null","endLoc":1906,"header":"@property\n    def inverse(self)","id":11458,"name":"inverse","nodeType":"Function","startLoc":1904,"text":"@property\n    def inverse(self):\n        return Sky2Pix_HEALPix()"},{"attributeType":"null","col":8,"comment":"null","endLoc":173,"id":11459,"name":"attribute","nodeType":"Attribute","startLoc":173,"text":"self.attribute"},{"attributeType":"null","col":8,"comment":"null","endLoc":174,"id":11460,"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":112,"id":11461,"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]\n            location = EarthLocation.from_geodetic(site_info['longitude'] * u.Unit(site_info['longitude_unit']),\n                                                   site_info['latitude'] * u.Unit(site_info['latitude_unit']),\n                                                   site_info['elevation'] * u.Unit(site_info['elevation_unit']))\n            location.info.name = site_info['name']\n\n            reg.add_site([site] + site_info['aliases'], location)\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":11462,"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()]"},{"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":85,"id":11463,"name":"_MOON_B","nodeType":"Attribute","startLoc":85,"text":"_MOON_B"},{"col":4,"comment":"null","endLoc":1910,"header":"@classmethod\n    def evaluate(cls, x, y)","id":11464,"name":"evaluate","nodeType":"Function","startLoc":1908,"text":"@classmethod\n    def evaluate(cls, x, y):\n        return _projections.xphx2s(x, y)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1902,"id":11465,"name":"_separable","nodeType":"Attribute","startLoc":1902,"text":"_separable"},{"col":4,"comment":"null","endLoc":63,"header":"def __len__(self)","id":11466,"name":"__len__","nodeType":"Function","startLoc":62,"text":"def __len__(self):\n        return len(self._lowercase_names_to_locations)"},{"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":1930,"id":11467,"nodeType":"Class","startLoc":1916,"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    \"\"\"\n    _separable = False\n\n    @property\n    def inverse(self):\n        return Pix2Sky_HEALPix()\n\n    @classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.hpxs2x(phi, theta)"},{"col":4,"comment":"null","endLoc":66,"header":"def __iter__(self)","id":11468,"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":11469,"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":"null","endLoc":1926,"header":"@property\n    def inverse(self)","id":11470,"name":"inverse","nodeType":"Function","startLoc":1924,"text":"@property\n    def inverse(self):\n        return Pix2Sky_HEALPix()"},{"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":11471,"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":11472,"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":0,"comment":"null","endLoc":158,"id":11473,"name":"_coLc","nodeType":"Attribute","startLoc":158,"text":"_coLc"},{"attributeType":"null","col":0,"comment":"null","endLoc":160,"id":11474,"name":"_coD","nodeType":"Attribute","startLoc":160,"text":"_coD"},{"col":4,"comment":"null","endLoc":1930,"header":"@classmethod\n    def evaluate(cls, phi, theta)","id":11475,"name":"evaluate","nodeType":"Function","startLoc":1928,"text":"@classmethod\n    def evaluate(cls, phi, theta):\n        return _projections.hpxs2x(phi, theta)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1922,"id":11476,"name":"_separable","nodeType":"Attribute","startLoc":1922,"text":"_separable"},{"attributeType":"null","col":0,"comment":"null","endLoc":162,"id":11477,"name":"_coM","nodeType":"Attribute","startLoc":162,"text":"_coM"},{"attributeType":"null","col":8,"comment":"null","endLoc":37,"id":11478,"name":"_names","nodeType":"Attribute","startLoc":37,"text":"self._names"},{"attributeType":"null","col":8,"comment":"null","endLoc":35,"id":11479,"name":"_lowercase_names_to_locations","nodeType":"Attribute","startLoc":35,"text":"self._lowercase_names_to_locations"},{"attributeType":"null","col":0,"comment":"null","endLoc":164,"id":11480,"name":"_coMc","nodeType":"Attribute","startLoc":164,"text":"_coMc"},{"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    ","endLoc":2065,"id":11481,"nodeType":"Class","startLoc":1936,"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    inputs = ('x', 'y')\n    outputs = ('x', 'y')\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    @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; {0} 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        inarr = np.vstack([x.flatten(), y.flatten(), np.ones(x.size)])\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        else:\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 {'x': self.translation.unit,\n                    'y': self.translation.unit\n                    }\n        else:\n            return {'x': self.matrix.unit,\n                    'y': self.matrix.unit\n                    }"},{"col":4,"comment":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        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        ","endLoc":843,"header":"def de_density_scale(self, z)","id":11482,"name":"de_density_scale","nodeType":"Function","startLoc":795,"text":"def de_density_scale(self, z):\n        r\"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        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\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        #\n        # The integral we actually use (the one given in Linder)\n        # is rewritten in terms of z, so looks slightly different than the\n        # one in the documentation string, but it's the same thing.\n\n        from scipy.integrate import quad\n\n        if isiterable(z):\n            z = np.asarray(z)\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:\n            ival = quad(self._w_integrand, 0, log(1 + z))[0]\n            return exp(3 * ival)"},{"col":0,"comment":"","endLoc":11,"header":"sites.py#<anonymous>","id":11483,"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":"null","col":0,"comment":"null","endLoc":166,"id":11484,"name":"_coF","nodeType":"Attribute","startLoc":166,"text":"_coF"},{"col":4,"comment":"Validates that the input matrix is a 2x2 2D array.","endLoc":1967,"header":"@matrix.validator\n    def matrix(self, value)","id":11485,"name":"matrix","nodeType":"Function","startLoc":1961,"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":"null","col":0,"comment":"null","endLoc":168,"id":11486,"name":"_coA1","nodeType":"Attribute","startLoc":168,"text":"_coA1"},{"attributeType":"null","col":0,"comment":"null","endLoc":169,"id":11487,"name":"_coA2","nodeType":"Attribute","startLoc":169,"text":"_coA2"},{"attributeType":"null","col":0,"comment":"null","endLoc":170,"id":11488,"name":"_coA3","nodeType":"Attribute","startLoc":170,"text":"_coA3"},{"fileName":"angle_parsetab.py","filePath":"astropy/coordinates","id":11489,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# This file is automatically generated. Do not edit.\n_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'DA395940D76FFEB6A68EA2DB16FC015D'\n    \n_lr_action_items = {'UINT':([0,2,10,12,19,20,22,23,35,36,38,],[-7,12,-6,19,25,27,29,32,25,25,25,]),'MINUTE':([4,6,8,12,13,19,21,24,25,26,27,28,29,31,32,34,40,],[16,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,36,37,38,39,-11,]),'COLON':([12,27,],[20,35,]),'$end':([1,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,],[-4,-1,-32,-5,-14,-2,-15,-3,0,-17,-16,-33,-31,-35,-24,-34,-9,-12,-25,-18,-8,-9,-13,-9,-10,-9,-26,-8,-9,-19,-8,-27,-28,-20,-21,-11,-29,-22,-30,-23,]),'SIMPLE_UNIT':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[14,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'DEGREE':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[15,-14,-15,22,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'UFLOAT':([0,2,10,12,19,20,22,23,35,36,38,],[-7,13,-6,24,24,24,31,34,24,24,24,]),'HOUR':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[17,-14,-15,23,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'SECOND':([4,6,8,12,13,19,21,24,25,26,27,28,40,41,42,],[18,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,-11,43,44,]),'SIGN':([0,],[10,]),}\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 = {'ufloat':([12,19,20,22,23,35,36,38,],[21,26,28,30,33,40,41,42,]),'generic':([0,],[4,]),'arcminute':([0,],[1,]),'simple':([0,],[5,]),'sign':([0,],[2,]),'colon':([0,],[6,]),'dms':([0,],[7,]),'hms':([0,],[3,]),'spaced':([0,],[8,]),'angle':([0,],[11,]),'arcsecond':([0,],[9,]),}\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 -> hms','angle',1,'p_angle','angle_utilities.py',134),\n  ('angle -> dms','angle',1,'p_angle','angle_utilities.py',135),\n  ('angle -> arcsecond','angle',1,'p_angle','angle_utilities.py',136),\n  ('angle -> arcminute','angle',1,'p_angle','angle_utilities.py',137),\n  ('angle -> simple','angle',1,'p_angle','angle_utilities.py',138),\n  ('sign -> SIGN','sign',1,'p_sign','angle_utilities.py',144),\n  ('sign -> <empty>','sign',0,'p_sign','angle_utilities.py',145),\n  ('ufloat -> UFLOAT','ufloat',1,'p_ufloat','angle_utilities.py',154),\n  ('ufloat -> UINT','ufloat',1,'p_ufloat','angle_utilities.py',155),\n  ('colon -> sign UINT COLON ufloat','colon',4,'p_colon','angle_utilities.py',161),\n  ('colon -> sign UINT COLON UINT COLON ufloat','colon',6,'p_colon','angle_utilities.py',162),\n  ('spaced -> sign UINT ufloat','spaced',3,'p_spaced','angle_utilities.py',171),\n  ('spaced -> sign UINT UINT ufloat','spaced',4,'p_spaced','angle_utilities.py',172),\n  ('generic -> colon','generic',1,'p_generic','angle_utilities.py',181),\n  ('generic -> spaced','generic',1,'p_generic','angle_utilities.py',182),\n  ('generic -> sign UFLOAT','generic',2,'p_generic','angle_utilities.py',183),\n  ('generic -> sign UINT','generic',2,'p_generic','angle_utilities.py',184),\n  ('hms -> sign UINT HOUR','hms',3,'p_hms','angle_utilities.py',193),\n  ('hms -> sign UINT HOUR ufloat','hms',4,'p_hms','angle_utilities.py',194),\n  ('hms -> sign UINT HOUR UINT MINUTE','hms',5,'p_hms','angle_utilities.py',195),\n  ('hms -> sign UINT HOUR UFLOAT MINUTE','hms',5,'p_hms','angle_utilities.py',196),\n  ('hms -> sign UINT HOUR UINT MINUTE ufloat','hms',6,'p_hms','angle_utilities.py',197),\n  ('hms -> sign UINT HOUR UINT MINUTE ufloat SECOND','hms',7,'p_hms','angle_utilities.py',198),\n  ('hms -> generic HOUR','hms',2,'p_hms','angle_utilities.py',199),\n  ('dms -> sign UINT DEGREE','dms',3,'p_dms','angle_utilities.py',212),\n  ('dms -> sign UINT DEGREE ufloat','dms',4,'p_dms','angle_utilities.py',213),\n  ('dms -> sign UINT DEGREE UINT MINUTE','dms',5,'p_dms','angle_utilities.py',214),\n  ('dms -> sign UINT DEGREE UFLOAT MINUTE','dms',5,'p_dms','angle_utilities.py',215),\n  ('dms -> sign UINT DEGREE UINT MINUTE ufloat','dms',6,'p_dms','angle_utilities.py',216),\n  ('dms -> sign UINT DEGREE UINT MINUTE ufloat SECOND','dms',7,'p_dms','angle_utilities.py',217),\n  ('dms -> generic DEGREE','dms',2,'p_dms','angle_utilities.py',218),\n  ('simple -> generic','simple',1,'p_simple','angle_utilities.py',231),\n  ('simple -> generic SIMPLE_UNIT','simple',2,'p_simple','angle_utilities.py',232),\n  ('arcsecond -> generic SECOND','arcsecond',2,'p_arcsecond','angle_utilities.py',241),\n  ('arcminute -> generic MINUTE','arcminute',2,'p_arcminute','angle_utilities.py',247),\n]\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":171,"id":11490,"name":"_coE","nodeType":"Attribute","startLoc":171,"text":"_coE"},{"col":0,"comment":"","endLoc":6,"header":"orbital_elements.py#<anonymous>","id":11491,"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)"},{"col":4,"comment":" Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ob : ndarray, or float if input scalar\n          The density of baryonic matter relative to the critical density at\n          each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        ","endLoc":547,"header":"def Ob(self, z)","id":11492,"name":"Ob","nodeType":"Function","startLoc":523,"text":"def Ob(self, z):\n        \"\"\" Return the density parameter for baryonic matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ob : ndarray, or float if input scalar\n          The density of baryonic matter relative to the critical density at\n          each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        \"\"\"\n\n        if self._Ob0 is None:\n            raise ValueError(\"Baryon density not set for this cosmology\")\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ob0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2"},{"attributeType":"null","col":4,"comment":"null","endLoc":293,"id":11493,"name":"_separable","nodeType":"Attribute","startLoc":293,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":294,"id":11494,"name":"_is_bool","nodeType":"Attribute","startLoc":294,"text":"_is_bool"},{"attributeType":"null","col":8,"comment":"null","endLoc":298,"id":11495,"name":"_default_size","nodeType":"Attribute","startLoc":298,"text":"self._default_size"},{"col":4,"comment":" Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Odm : ndarray, or float if input scalar\n          The density of non-relativistic dark matter relative to the critical\n          density at each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest.\n        ","endLoc":578,"header":"def Odm(self, z)","id":11496,"name":"Odm","nodeType":"Function","startLoc":549,"text":"def Odm(self, z):\n        \"\"\" Return the density parameter for dark matter at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Odm : ndarray, or float if input scalar\n          The density of non-relativistic dark matter relative to the critical\n          density at each redshift.\n\n        Raises\n        ------\n        ValueError\n          If Ob0 is None.\n        Notes\n        -----\n        This does not include neutrinos, even if non-relativistic\n        at the redshift of interest.\n        \"\"\"\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        if isiterable(z):\n            z = np.asarray(z)\n        return self._Odm0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2"},{"attributeType":"Box2D","col":8,"comment":"null","endLoc":297,"id":11497,"name":"_model","nodeType":"Attribute","startLoc":297,"text":"self._model"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":11498,"name":"_tabversion","nodeType":"Attribute","startLoc":5,"text":"_tabversion"},{"attributeType":"null","col":8,"comment":"null","endLoc":301,"id":11499,"name":"_truncation","nodeType":"Attribute","startLoc":301,"text":"self._truncation"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":11500,"name":"_lr_method","nodeType":"Attribute","startLoc":7,"text":"_lr_method"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":11501,"name":"_lr_signature","nodeType":"Attribute","startLoc":9,"text":"_lr_signature"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":11502,"name":"_lr_action_items","nodeType":"Attribute","startLoc":11,"text":"_lr_action_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":11503,"name":"_lr_action","nodeType":"Attribute","startLoc":13,"text":"_lr_action"},{"attributeType":"null","col":4,"comment":"null","endLoc":14,"id":11504,"name":"_k","nodeType":"Attribute","startLoc":14,"text":"_k"},{"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    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, MexicanHat2DKernel, 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":360,"id":11505,"nodeType":"Class","startLoc":305,"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    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, MexicanHat2DKernel, 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":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":1981,"header":"@translation.validator\n    def translation(self, value)","id":11506,"name":"translation","nodeType":"Function","startLoc":1969,"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\")"},{"col":4,"comment":"null","endLoc":360,"header":"def __init__(self, radius, **kwargs)","id":11507,"name":"__init__","nodeType":"Function","startLoc":356,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":14,"id":11508,"name":"_v","nodeType":"Attribute","startLoc":14,"text":"_v"},{"attributeType":"null","col":7,"comment":"null","endLoc":15,"id":11509,"name":"_x","nodeType":"Attribute","startLoc":15,"text":"_x"},{"attributeType":"null","col":10,"comment":"null","endLoc":15,"id":11510,"name":"_y","nodeType":"Attribute","startLoc":15,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":11511,"name":"_lr_goto_items","nodeType":"Attribute","startLoc":20,"text":"_lr_goto_items"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":11512,"name":"_lr_goto","nodeType":"Attribute","startLoc":22,"text":"_lr_goto"},{"attributeType":"null","col":4,"comment":"null","endLoc":23,"id":11513,"name":"_k","nodeType":"Attribute","startLoc":23,"text":"_k"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":11514,"name":"_v","nodeType":"Attribute","startLoc":23,"text":"_v"},{"fileName":"earth_orientation.py","filePath":"astropy/coordinates","id":11515,"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 ..time import Time\nfrom .. import units as u\nfrom .matrix_utilities import rotation_matrix, matrix_product, matrix_transpose\n\n\njd1950 = Time('B1950', scale='tai').jd\njd2000 = Time('J2000', scale='utc').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"},{"attributeType":"null","col":7,"comment":"null","endLoc":24,"id":11516,"name":"_x","nodeType":"Attribute","startLoc":24,"text":"_x"},{"col":4,"comment":"\n        Inverse transformation.\n\n        Raises `~astropy.modeling.InputParameterError` if the transformation cannot be inverted.\n        ","endLoc":2003,"header":"@property\n    def inverse(self)","id":11517,"name":"inverse","nodeType":"Function","startLoc":1983,"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; {0} 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":11,"comment":"null","endLoc":24,"id":11518,"name":"_y","nodeType":"Attribute","startLoc":24,"text":"_y"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":11519,"name":"_lr_productions","nodeType":"Attribute","startLoc":28,"text":"_lr_productions"},{"attributeType":"null","col":8,"comment":"null","endLoc":358,"id":11520,"name":"_default_size","nodeType":"Attribute","startLoc":358,"text":"self._default_size"},{"attributeType":"null","col":4,"comment":"null","endLoc":1470,"id":11521,"name":"inputs","nodeType":"Attribute","startLoc":1470,"text":"inputs"},{"col":0,"comment":"","endLoc":5,"header":"angle_parsetab.py#<anonymous>","id":11522,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"_tabversion = '3.8'\n\n_lr_method = 'LALR'\n\n_lr_signature = 'DA395940D76FFEB6A68EA2DB16FC015D'\n\n_lr_action_items = {'UINT':([0,2,10,12,19,20,22,23,35,36,38,],[-7,12,-6,19,25,27,29,32,25,25,25,]),'MINUTE':([4,6,8,12,13,19,21,24,25,26,27,28,29,31,32,34,40,],[16,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,36,37,38,39,-11,]),'COLON':([12,27,],[20,35,]),'$end':([1,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,],[-4,-1,-32,-5,-14,-2,-15,-3,0,-17,-16,-33,-31,-35,-24,-34,-9,-12,-25,-18,-8,-9,-13,-9,-10,-9,-26,-8,-9,-19,-8,-27,-28,-20,-21,-11,-29,-22,-30,-23,]),'SIMPLE_UNIT':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[14,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'DEGREE':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[15,-14,-15,22,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'UFLOAT':([0,2,10,12,19,20,22,23,35,36,38,],[-7,13,-6,24,24,24,31,34,24,24,24,]),'HOUR':([4,6,8,12,13,19,21,24,25,26,27,28,40,],[17,-14,-15,23,-16,-9,-12,-8,-9,-13,-9,-10,-11,]),'SECOND':([4,6,8,12,13,19,21,24,25,26,27,28,40,41,42,],[18,-14,-15,-17,-16,-9,-12,-8,-9,-13,-9,-10,-11,43,44,]),'SIGN':([0,],[10,]),}\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 = {'ufloat':([12,19,20,22,23,35,36,38,],[21,26,28,30,33,40,41,42,]),'generic':([0,],[4,]),'arcminute':([0,],[1,]),'simple':([0,],[5,]),'sign':([0,],[2,]),'colon':([0,],[6,]),'dms':([0,],[7,]),'hms':([0,],[3,]),'spaced':([0,],[8,]),'angle':([0,],[11,]),'arcsecond':([0,],[9,]),}\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 -> hms','angle',1,'p_angle','angle_utilities.py',134),\n  ('angle -> dms','angle',1,'p_angle','angle_utilities.py',135),\n  ('angle -> arcsecond','angle',1,'p_angle','angle_utilities.py',136),\n  ('angle -> arcminute','angle',1,'p_angle','angle_utilities.py',137),\n  ('angle -> simple','angle',1,'p_angle','angle_utilities.py',138),\n  ('sign -> SIGN','sign',1,'p_sign','angle_utilities.py',144),\n  ('sign -> <empty>','sign',0,'p_sign','angle_utilities.py',145),\n  ('ufloat -> UFLOAT','ufloat',1,'p_ufloat','angle_utilities.py',154),\n  ('ufloat -> UINT','ufloat',1,'p_ufloat','angle_utilities.py',155),\n  ('colon -> sign UINT COLON ufloat','colon',4,'p_colon','angle_utilities.py',161),\n  ('colon -> sign UINT COLON UINT COLON ufloat','colon',6,'p_colon','angle_utilities.py',162),\n  ('spaced -> sign UINT ufloat','spaced',3,'p_spaced','angle_utilities.py',171),\n  ('spaced -> sign UINT UINT ufloat','spaced',4,'p_spaced','angle_utilities.py',172),\n  ('generic -> colon','generic',1,'p_generic','angle_utilities.py',181),\n  ('generic -> spaced','generic',1,'p_generic','angle_utilities.py',182),\n  ('generic -> sign UFLOAT','generic',2,'p_generic','angle_utilities.py',183),\n  ('generic -> sign UINT','generic',2,'p_generic','angle_utilities.py',184),\n  ('hms -> sign UINT HOUR','hms',3,'p_hms','angle_utilities.py',193),\n  ('hms -> sign UINT HOUR ufloat','hms',4,'p_hms','angle_utilities.py',194),\n  ('hms -> sign UINT HOUR UINT MINUTE','hms',5,'p_hms','angle_utilities.py',195),\n  ('hms -> sign UINT HOUR UFLOAT MINUTE','hms',5,'p_hms','angle_utilities.py',196),\n  ('hms -> sign UINT HOUR UINT MINUTE ufloat','hms',6,'p_hms','angle_utilities.py',197),\n  ('hms -> sign UINT HOUR UINT MINUTE ufloat SECOND','hms',7,'p_hms','angle_utilities.py',198),\n  ('hms -> generic HOUR','hms',2,'p_hms','angle_utilities.py',199),\n  ('dms -> sign UINT DEGREE','dms',3,'p_dms','angle_utilities.py',212),\n  ('dms -> sign UINT DEGREE ufloat','dms',4,'p_dms','angle_utilities.py',213),\n  ('dms -> sign UINT DEGREE UINT MINUTE','dms',5,'p_dms','angle_utilities.py',214),\n  ('dms -> sign UINT DEGREE UFLOAT MINUTE','dms',5,'p_dms','angle_utilities.py',215),\n  ('dms -> sign UINT DEGREE UINT MINUTE ufloat','dms',6,'p_dms','angle_utilities.py',216),\n  ('dms -> sign UINT DEGREE UINT MINUTE ufloat SECOND','dms',7,'p_dms','angle_utilities.py',217),\n  ('dms -> generic DEGREE','dms',2,'p_dms','angle_utilities.py',218),\n  ('simple -> generic','simple',1,'p_simple','angle_utilities.py',231),\n  ('simple -> generic SIMPLE_UNIT','simple',2,'p_simple','angle_utilities.py',232),\n  ('arcsecond -> generic SECOND','arcsecond',2,'p_arcsecond','angle_utilities.py',241),\n  ('arcminute -> generic MINUTE','arcminute',2,'p_arcminute','angle_utilities.py',247),\n]"},{"attributeType":"null","col":4,"comment":"null","endLoc":1471,"id":11523,"name":"outputs","nodeType":"Attribute","startLoc":1471,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1472,"id":11524,"name":"_separable","nodeType":"Attribute","startLoc":1472,"text":"_separable"},{"attributeType":"null","col":8,"comment":"null","endLoc":1476,"id":11525,"name":"_ap_order","nodeType":"Attribute","startLoc":1476,"text":"self._ap_order"},{"attributeType":"Disk2D","col":8,"comment":"null","endLoc":357,"id":11526,"name":"_model","nodeType":"Attribute","startLoc":357,"text":"self._model"},{"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":11527,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":360,"id":11528,"name":"_truncation","nodeType":"Attribute","startLoc":360,"text":"self._truncation"},{"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":11529,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":1479,"id":11530,"name":"_bp_coeff","nodeType":"Attribute","startLoc":1479,"text":"self._bp_coeff"},{"col":4,"comment":" Return the equivalent density parameter for curvature\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ok : ndarray, or float if input scalar\n          The equivalent density parameter for curvature at each redshift.\n        ","endLoc":604,"header":"def Ok(self, z)","id":11531,"name":"Ok","nodeType":"Function","startLoc":580,"text":"def Ok(self, z):\n        \"\"\" Return the equivalent density parameter for curvature\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ok : ndarray, or float if input scalar\n          The equivalent density parameter for curvature at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common enough case to be worth checking explicitly\n            if self._Ok0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ok0 == 0:\n                return 0.0\n\n        return self._Ok0 * (1. + z) ** 2 * self.inv_efunc(z) ** 2"},{"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    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, MexicanHat2DKernel,\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 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":420,"id":11532,"nodeType":"Class","startLoc":363,"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    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, MexicanHat2DKernel,\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 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"},{"col":4,"comment":"null","endLoc":420,"header":"def __init__(self, radius_in, width, **kwargs)","id":11533,"name":"__init__","nodeType":"Function","startLoc":414,"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":"Polynomial2D","col":8,"comment":"null","endLoc":1490,"id":11534,"name":"sip1d_ap","nodeType":"Attribute","startLoc":1490,"text":"self.sip1d_ap"},{"attributeType":"Polynomial2D","col":8,"comment":"null","endLoc":1493,"id":11535,"name":"sip1d_bp","nodeType":"Attribute","startLoc":1493,"text":"self.sip1d_bp"},{"attributeType":"null","col":8,"comment":"null","endLoc":1477,"id":11536,"name":"_bp_order","nodeType":"Attribute","startLoc":1477,"text":"self._bp_order"},{"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":11537,"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":"\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":2031,"header":"@classmethod\n    def evaluate(cls, x, y, matrix, translation)","id":11538,"name":"evaluate","nodeType":"Function","startLoc":2005,"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        inarr = np.vstack([x.flatten(), y.flatten(), np.ones(x.size)])\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"},{"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":11539,"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."},{"attributeType":"null","col":8,"comment":"null","endLoc":1478,"id":11540,"name":"_ap_coeff","nodeType":"Attribute","startLoc":1478,"text":"self._ap_coeff"},{"fileName":"distances.py","filePath":"astropy/coordinates","id":11541,"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 numpy as np\n\nfrom .. import units as u\nfrom .angles import Angle\n\n__all__ = ['Distance']\n\n\n__doctest_requires__ = {'*': ['scipy.integrate']}\n\n\nclass Distance(u.SpecificTypeQuantity):\n    \"\"\"\n    A one-dimensional distance.\n\n    This can be initialized in one of four ways:\n\n    * A distance ``value`` (array or float) and a ``unit``\n    * A `~astropy.units.Quantity` object\n    * A redshift and (optionally) a cosmology.\n    * Providing a distance modulus\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity`.\n        The value of this distance.\n    unit : `~astropy.units.UnitBase`\n        The units for this distance, *if* ``value`` is not a\n        `~astropy.units.Quantity`. Must have dimensions of 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 : ``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 is some\n        cosmologies).  Default: ``False``.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a distance.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``z`` is provided with a ``unit`` or ``cosmology`` is provided\n        when ``z`` is *not* given, or ``value`` is given as well as ``z``.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy import cosmology\n    >>> from astropy.cosmology import WMAP5, WMAP7\n    >>> cosmology.set_current(WMAP7)\n    >>> d1 = Distance(10, u.Mpc)\n    >>> d2 = Distance(40, unit=u.au)\n    >>> d3 = Distance(value=5, unit=u.kpc)\n    >>> d4 = Distance(z=0.23)\n    >>> d5 = Distance(z=0.23, cosmology=WMAP5)\n    >>> d6 = Distance(distmod=24.47)\n    >>> d7 = Distance(Distance(10 * u.Mpc))\n    >>> d8 = Distance(parallax=21.34*u.mas)\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        if z is not None:\n            if value is not None or distmod is not None:\n                raise ValueError('Should given only one of `value`, `z` '\n                                 'or `distmod` in Distance constructor.')\n\n            if cosmology is None:\n                from ..cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n            # Continue on to take account of unit and other arguments\n            # but a copy is already made, so no longer necessary\n            copy = False\n\n        else:\n            if cosmology is not None:\n                raise ValueError('A `cosmology` was given but `z` was not '\n                                 'provided in Distance constructor')\n\n            value_msg = ('Should given only one of `value`, `z`, `distmod`, or '\n                         '`parallax` in Distance constructor.')\n            n_not_none = np.sum([x is not None\n                                 for x in [value, z, distmod, parallax]])\n            if n_not_none > 1:\n                raise ValueError(value_msg)\n\n            if 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                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif parallax is not None:\n                value = parallax.to(u.pc, equivalencies=u.parallax()).value\n                unit = u.pc\n\n                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif value is None:\n                raise ValueError('None of `value`, `z`, `distmod`, or '\n                                 '`parallax` were given to Distance '\n                                 'constructor')\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        if not allow_negative and np.any(distance.value < 0):\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):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        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\n        Returns\n        -------\n        z : float\n            The redshift of this distance given the provided ``cosmology``.\n        \"\"\"\n\n        if cosmology is None:\n            from ..cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        from ..cosmology import z_at_value\n        return z_at_value(cosmology.luminosity_distance, self, ztol=1.e-10)\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\n\ndef _convert_to_and_validate_length_unit(unit, allow_dimensionless=False):\n    \"\"\"\n    raises UnitsError if not a length unit\n    \"\"\"\n    try:\n        unit = u.Unit(unit)\n        assert (unit.is_equivalent(u.kpc) or\n                allow_dimensionless and unit == u.dimensionless_unscaled)\n    except (TypeError, AssertionError):\n        raise u.UnitsError('Unit \"{0}\" is not a length type'.format(unit))\n\n    return unit\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":11542,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"polynomial.py#<anonymous>","id":11543,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis module contains models representing polynomials and polynomial series.\n\"\"\"\n\n__all__ = [\n    'Chebyshev1D', 'Chebyshev2D', 'Hermite1D', 'Hermite2D',\n    'InverseSIP', 'Legendre1D', 'Legendre2D', 'Polynomial1D',\n    'Polynomial2D', 'SIP', 'OrthoPolynomialBase',\n    'PolynomialModel'\n]"},{"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":11544,"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)"},{"className":"Distance","col":0,"comment":"\n    A one-dimensional distance.\n\n    This can be initialized in one of four ways:\n\n    * A distance ``value`` (array or float) and a ``unit``\n    * A `~astropy.units.Quantity` object\n    * A redshift and (optionally) a cosmology.\n    * Providing a distance modulus\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity`.\n        The value of this distance.\n    unit : `~astropy.units.UnitBase`\n        The units for this distance, *if* ``value`` is not a\n        `~astropy.units.Quantity`. Must have dimensions of 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 : ``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 is some\n        cosmologies).  Default: ``False``.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a distance.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``z`` is provided with a ``unit`` or ``cosmology`` is provided\n        when ``z`` is *not* given, or ``value`` is given as well as ``z``.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy import cosmology\n    >>> from astropy.cosmology import WMAP5, WMAP7\n    >>> cosmology.set_current(WMAP7)\n    >>> d1 = Distance(10, u.Mpc)\n    >>> d2 = Distance(40, unit=u.au)\n    >>> d3 = Distance(value=5, unit=u.kpc)\n    >>> d4 = Distance(z=0.23)\n    >>> d5 = Distance(z=0.23, cosmology=WMAP5)\n    >>> d6 = Distance(distmod=24.47)\n    >>> d7 = Distance(Distance(10 * u.Mpc))\n    >>> d8 = Distance(parallax=21.34*u.mas)\n    ","endLoc":211,"id":11545,"nodeType":"Class","startLoc":19,"text":"class Distance(u.SpecificTypeQuantity):\n    \"\"\"\n    A one-dimensional distance.\n\n    This can be initialized in one of four ways:\n\n    * A distance ``value`` (array or float) and a ``unit``\n    * A `~astropy.units.Quantity` object\n    * A redshift and (optionally) a cosmology.\n    * Providing a distance modulus\n\n    Parameters\n    ----------\n    value : scalar or `~astropy.units.Quantity`.\n        The value of this distance.\n    unit : `~astropy.units.UnitBase`\n        The units for this distance, *if* ``value`` is not a\n        `~astropy.units.Quantity`. Must have dimensions of 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 : ``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 is some\n        cosmologies).  Default: ``False``.\n\n    Raises\n    ------\n    `~astropy.units.UnitsError`\n        If the ``unit`` is not a distance.\n    ValueError\n        If value specified is less than 0 and ``allow_negative=False``.\n\n        If ``z`` is provided with a ``unit`` or ``cosmology`` is provided\n        when ``z`` is *not* given, or ``value`` is given as well as ``z``.\n\n\n    Examples\n    --------\n    >>> from astropy import units as u\n    >>> from astropy import cosmology\n    >>> from astropy.cosmology import WMAP5, WMAP7\n    >>> cosmology.set_current(WMAP7)\n    >>> d1 = Distance(10, u.Mpc)\n    >>> d2 = Distance(40, unit=u.au)\n    >>> d3 = Distance(value=5, unit=u.kpc)\n    >>> d4 = Distance(z=0.23)\n    >>> d5 = Distance(z=0.23, cosmology=WMAP5)\n    >>> d6 = Distance(distmod=24.47)\n    >>> d7 = Distance(Distance(10 * u.Mpc))\n    >>> d8 = Distance(parallax=21.34*u.mas)\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        if z is not None:\n            if value is not None or distmod is not None:\n                raise ValueError('Should given only one of `value`, `z` '\n                                 'or `distmod` in Distance constructor.')\n\n            if cosmology is None:\n                from ..cosmology import default_cosmology\n                cosmology = default_cosmology.get()\n\n            value = cosmology.luminosity_distance(z)\n            # Continue on to take account of unit and other arguments\n            # but a copy is already made, so no longer necessary\n            copy = False\n\n        else:\n            if cosmology is not None:\n                raise ValueError('A `cosmology` was given but `z` was not '\n                                 'provided in Distance constructor')\n\n            value_msg = ('Should given only one of `value`, `z`, `distmod`, or '\n                         '`parallax` in Distance constructor.')\n            n_not_none = np.sum([x is not None\n                                 for x in [value, z, distmod, parallax]])\n            if n_not_none > 1:\n                raise ValueError(value_msg)\n\n            if 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                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif parallax is not None:\n                value = parallax.to(u.pc, equivalencies=u.parallax()).value\n                unit = u.pc\n\n                # Continue on to take account of unit and other arguments\n                # but a copy is already made, so no longer necessary\n                copy = False\n\n            elif value is None:\n                raise ValueError('None of `value`, `z`, `distmod`, or '\n                                 '`parallax` were given to Distance '\n                                 'constructor')\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        if not allow_negative and np.any(distance.value < 0):\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):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        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\n        Returns\n        -------\n        z : float\n            The redshift of this distance given the provided ``cosmology``.\n        \"\"\"\n\n        if cosmology is None:\n            from ..cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        from ..cosmology import z_at_value\n        return z_at_value(cosmology.luminosity_distance, self, ztol=1.e-10)\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":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":11546,"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'))"},{"fileName":"transformations.py","filePath":"astropy/coordinates","id":11547,"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, OrderedDict\nfrom contextlib import suppress\nfrom inspect import signature\n\nimport numpy as np\n\nfrom .. import units as u\nfrom ..utils.exceptions import AstropyWarning\n\nfrom .representation import REPRESENTATION_CLASSES\n\n__all__ = ['TransformGraph', 'CoordinateTransform', 'FunctionTransform',\n           'BaseAffineTransform', 'AffineTransform',\n           'StaticMatrixTransform', 'DynamicMatrixTransform',\n           'FunctionTransformWithFiniteDifference', 'CompositeTransform']\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                    dct[nm] = 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 = frm_set = set()\n            for a in self._graph:\n                frm_set.add(a)\n                for b in self._graph[a]:\n                    frm_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 `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            result = {}\n            for frame_cls in self.frame_set:\n                result.update(frame_cls.frame_attributes)\n            self._cached_frame_attributes = result\n\n        return self._cached_frame_attributes\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._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 or similar callable\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        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 b is transform:\n                        del agraph[b]\n                        break\n            else:\n                raise ValueError('Could not find transform {0} in the '\n                                 'graph'.format(transform))\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 {0} to {1} is not '\n                                     '{2}'.format(fromsys, tosys, transform))\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 classes 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 : number\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        coordcls\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([(v, k) for k, v in self._cached_names.items()])\n        for n in nodes:\n            if n in invclsaliases:\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, invclsaliases[n]))\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('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = 'label = \"{0}\"'.format(weights)\n            else:\n                priority_part = ''\n\n            color_part = 'color = \"{0}\"'.format(color)\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append('{0} -> {1}{2};'.format(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 <http://networkx.lanl.gov/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : `networkx.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_\n            This `TransformGraph` as a `networkx.Graph`_.\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 : number\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\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 : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : number\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.get_frame_attr_names():\n                if from_nm in tosys.get_frame_attr_names():\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 : a 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 : fromsys object\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 : tosys object\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 : number\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\n                and 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('the transformation function yielded {0} but '\n                'should have been of type {1}'.format(res, 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 exsiting differential.\n    finite_difference_dt : `~astropy.units.Quantity` 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 ``_apply_transform()`` method, but have\n    different ``__call__()`` methods. ``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        # 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 coordiante frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {0})\"\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: {0})\"\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: {0}).\"\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\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 : number\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 __call__(self, fromcoord, toframe):\n\n        M, vec = self.transform_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, vec)\n\n        return toframe.realize_frame(newrep)\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 : number\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 __call__(self, fromcoord, toframe):\n        newrep = self._apply_transform(fromcoord, self.matrix, None)\n        return toframe.realize_frame(newrep)\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 : number\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        def _transform_func(fromcoord, toframe):\n            return self.matrix_func(fromcoord, toframe), None\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def __call__(self, fromcoord, toframe):\n        M = self.matrix_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, None)\n        return toframe.realize_frame(newrep)\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` objects\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 : number\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 = np.dot(lasttrans.matrix, currtrans.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            # `fromframe`, or if not there, `toframe`, 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 immutible, so copying is not needed\n        return curr_coord\n\n\n# map class names to colorblind-safe colors\ntrans_to_color = OrderedDict()\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"},{"col":4,"comment":"Short for ``self.compute_z()``","endLoc":171,"header":"@property\n    def z(self)","id":11548,"name":"z","nodeType":"Function","startLoc":168,"text":"@property\n    def z(self):\n        \"\"\"Short for ``self.compute_z()``\"\"\"\n        return self.compute_z()"},{"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":11549,"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'))"},{"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":11550,"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])"},{"attributeType":"null","col":8,"comment":"null","endLoc":418,"id":11551,"name":"_default_size","nodeType":"Attribute","startLoc":418,"text":"self._default_size"},{"attributeType":"Ring2D","col":8,"comment":"null","endLoc":416,"id":11552,"name":"_model","nodeType":"Attribute","startLoc":416,"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 : ``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\n        Returns\n        -------\n        z : float\n            The redshift of this distance given the provided ``cosmology``.\n        ","endLoc":195,"header":"def compute_z(self, cosmology=None)","id":11553,"name":"compute_z","nodeType":"Function","startLoc":173,"text":"def compute_z(self, cosmology=None):\n        \"\"\"\n        The redshift for this distance assuming its physical distance is\n        a luminosity distance.\n\n        Parameters\n        ----------\n        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\n        Returns\n        -------\n        z : float\n            The redshift of this distance given the provided ``cosmology``.\n        \"\"\"\n\n        if cosmology is None:\n            from ..cosmology import default_cosmology\n            cosmology = default_cosmology.get()\n\n        from ..cosmology import z_at_value\n        return z_at_value(cosmology.luminosity_distance, self, ztol=1.e-10)"},{"col":4,"comment":"null","endLoc":2052,"header":"@staticmethod\n    def _create_augmented_matrix(matrix, translation)","id":11554,"name":"_create_augmented_matrix","nodeType":"Function","startLoc":2033,"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        else:\n            return augmented_matrix"},{"col":4,"comment":"null","endLoc":2065,"header":"@property\n    def input_units(self)","id":11555,"name":"input_units","nodeType":"Function","startLoc":2054,"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 {'x': self.translation.unit,\n                    'y': self.translation.unit\n                    }\n        else:\n            return {'x': self.matrix.unit,\n                    'y': self.matrix.unit\n                    }"},{"attributeType":"null","col":4,"comment":"null","endLoc":1951,"id":11556,"name":"inputs","nodeType":"Attribute","startLoc":1951,"text":"inputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1952,"id":11557,"name":"outputs","nodeType":"Attribute","startLoc":1952,"text":"outputs"},{"attributeType":"null","col":4,"comment":"null","endLoc":1954,"id":11558,"name":"standard_broadcasting","nodeType":"Attribute","startLoc":1954,"text":"standard_broadcasting"},{"attributeType":"null","col":8,"comment":"null","endLoc":420,"id":11559,"name":"_truncation","nodeType":"Attribute","startLoc":420,"text":"self._truncation"},{"attributeType":"null","col":4,"comment":"null","endLoc":1956,"id":11560,"name":"_separable","nodeType":"Attribute","startLoc":1956,"text":"_separable"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1958,"id":11561,"name":"matrix","nodeType":"Attribute","startLoc":1958,"text":"matrix"},{"col":4,"comment":"The distance modulus as a `~astropy.units.Quantity`","endLoc":201,"header":"@property\n    def distmod(self)","id":11562,"name":"distmod","nodeType":"Function","startLoc":197,"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)"},{"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":11563,"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":11564,"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":16,"comment":"null","endLoc":12,"id":11565,"name":"np","nodeType":"Attribute","startLoc":12,"text":"np"},{"attributeType":"Parameter","col":4,"comment":"null","endLoc":1959,"id":11566,"name":"translation","nodeType":"Attribute","startLoc":1959,"text":"translation"},{"attributeType":"null","col":24,"comment":"null","endLoc":15,"id":11567,"name":"u","nodeType":"Attribute","startLoc":15,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":11568,"name":"jd1950","nodeType":"Attribute","startLoc":19,"text":"jd1950"},{"className":"Trapezoid1DKernel","col":0,"comment":"\n    1D trapezoid kernel.\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, MexicanHat1DKernel\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":478,"id":11569,"nodeType":"Class","startLoc":423,"text":"class Trapezoid1DKernel(Kernel1D):\n    \"\"\"\n    1D trapezoid kernel.\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, MexicanHat1DKernel\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":478,"header":"def __init__(self, width, slope=1., **kwargs)","id":11570,"name":"__init__","nodeType":"Function","startLoc":473,"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()"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":11571,"name":"projcodes","nodeType":"Attribute","startLoc":30,"text":"projcodes"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":11572,"name":"__all__","nodeType":"Attribute","startLoc":37,"text":"__all__"},{"attributeType":"Pix2Sky_ZenithalPerspective","col":0,"comment":"null","endLoc":229,"id":11573,"name":"Pix2Sky_AZP","nodeType":"Attribute","startLoc":229,"text":"Pix2Sky_AZP"},{"attributeType":"Sky2Pix_ZenithalPerspective","col":0,"comment":"null","endLoc":276,"id":11574,"name":"Sky2Pix_AZP","nodeType":"Attribute","startLoc":276,"text":"Sky2Pix_AZP"},{"attributeType":"Pix2Sky_SlantZenithalPerspective","col":0,"comment":"null","endLoc":321,"id":11575,"name":"Pix2Sky_SZP","nodeType":"Attribute","startLoc":321,"text":"Pix2Sky_SZP"},{"attributeType":"Sky2Pix_SlantZenithalPerspective","col":0,"comment":"null","endLoc":365,"id":11576,"name":"Sky2Pix_SZP","nodeType":"Attribute","startLoc":365,"text":"Sky2Pix_SZP"},{"attributeType":"Pix2Sky_Gnomonic","col":0,"comment":"null","endLoc":389,"id":11577,"name":"Pix2Sky_TAN","nodeType":"Attribute","startLoc":389,"text":"Pix2Sky_TAN"},{"attributeType":"Sky2Pix_Gnomonic","col":0,"comment":"null","endLoc":413,"id":11578,"name":"Sky2Pix_TAN","nodeType":"Attribute","startLoc":413,"text":"Sky2Pix_TAN"},{"attributeType":"Pix2Sky_Stereographic","col":0,"comment":"null","endLoc":437,"id":11579,"name":"Pix2Sky_STG","nodeType":"Attribute","startLoc":437,"text":"Pix2Sky_STG"},{"attributeType":"Sky2Pix_Stereographic","col":0,"comment":"null","endLoc":461,"id":11580,"name":"Sky2Pix_STG","nodeType":"Attribute","startLoc":461,"text":"Sky2Pix_STG"},{"attributeType":"Pix2Sky_SlantOrthographic","col":0,"comment":"null","endLoc":506,"id":11581,"name":"Pix2Sky_SIN","nodeType":"Attribute","startLoc":506,"text":"Pix2Sky_SIN"},{"attributeType":"Sky2Pix_SlantOrthographic","col":0,"comment":"null","endLoc":542,"id":11582,"name":"Sky2Pix_SIN","nodeType":"Attribute","startLoc":542,"text":"Sky2Pix_SIN"},{"attributeType":"Pix2Sky_ZenithalEquidistant","col":0,"comment":"null","endLoc":565,"id":11583,"name":"Pix2Sky_ARC","nodeType":"Attribute","startLoc":565,"text":"Pix2Sky_ARC"},{"attributeType":"Sky2Pix_ZenithalEquidistant","col":0,"comment":"null","endLoc":588,"id":11584,"name":"Sky2Pix_ARC","nodeType":"Attribute","startLoc":588,"text":"Sky2Pix_ARC"},{"attributeType":"Pix2Sky_ZenithalEqualArea","col":0,"comment":"null","endLoc":611,"id":11585,"name":"Pix2Sky_ZEA","nodeType":"Attribute","startLoc":611,"text":"Pix2Sky_ZEA"},{"attributeType":"Sky2Pix_ZenithalEqualArea","col":0,"comment":"null","endLoc":635,"id":11586,"name":"Sky2Pix_ZEA","nodeType":"Attribute","startLoc":635,"text":"Sky2Pix_ZEA"},{"attributeType":"Pix2Sky_Airy","col":0,"comment":"null","endLoc":663,"id":11587,"name":"Pix2Sky_AIR","nodeType":"Attribute","startLoc":663,"text":"Pix2Sky_AIR"},{"attributeType":"Sky2Pix_Airy","col":0,"comment":"null","endLoc":700,"id":11588,"name":"Sky2Pix_AIR","nodeType":"Attribute","startLoc":700,"text":"Sky2Pix_AIR"},{"attributeType":"Pix2Sky_CylindricalPerspective","col":0,"comment":"null","endLoc":761,"id":11589,"name":"Pix2Sky_CYP","nodeType":"Attribute","startLoc":761,"text":"Pix2Sky_CYP"},{"attributeType":"Sky2Pix_CylindricalPerspective","col":0,"comment":"null","endLoc":808,"id":11590,"name":"Sky2Pix_CYP","nodeType":"Attribute","startLoc":808,"text":"Sky2Pix_CYP"},{"attributeType":"Pix2Sky_CylindricalEqualArea","col":0,"comment":"null","endLoc":838,"id":11591,"name":"Pix2Sky_CEA","nodeType":"Attribute","startLoc":838,"text":"Pix2Sky_CEA"},{"attributeType":"Sky2Pix_CylindricalEqualArea","col":0,"comment":"null","endLoc":868,"id":11592,"name":"Sky2Pix_CEA","nodeType":"Attribute","startLoc":868,"text":"Sky2Pix_CEA"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":11593,"name":"REPRESENTATION_CLASSES","nodeType":"Attribute","startLoc":38,"text":"REPRESENTATION_CLASSES"},{"attributeType":"Pix2Sky_PlateCarree","col":0,"comment":"null","endLoc":895,"id":11594,"name":"Pix2Sky_CAR","nodeType":"Attribute","startLoc":895,"text":"Pix2Sky_CAR"},{"className":"TransformGraph","col":0,"comment":"\n    A graph representing the paths between coordinate frames.\n    ","endLoc":589,"id":11595,"nodeType":"Class","startLoc":41,"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                    dct[nm] = 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 = frm_set = set()\n            for a in self._graph:\n                frm_set.add(a)\n                for b in self._graph[a]:\n                    frm_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 `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            result = {}\n            for frame_cls in self.frame_set:\n                result.update(frame_cls.frame_attributes)\n            self._cached_frame_attributes = result\n\n        return self._cached_frame_attributes\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._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 or similar callable\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        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 b is transform:\n                        del agraph[b]\n                        break\n            else:\n                raise ValueError('Could not find transform {0} in the '\n                                 'graph'.format(transform))\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 {0} to {1} is not '\n                                     '{2}'.format(fromsys, tosys, transform))\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 classes 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 : number\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        coordcls\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([(v, k) for k, v in self._cached_names.items()])\n        for n in nodes:\n            if n in invclsaliases:\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, invclsaliases[n]))\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('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = 'label = \"{0}\"'.format(weights)\n            else:\n                priority_part = ''\n\n            color_part = 'color = \"{0}\"'.format(color)\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append('{0} -> {1}{2};'.format(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 <http://networkx.lanl.gov/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : `networkx.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_\n            This `TransformGraph` as a `networkx.Graph`_.\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 : number\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"},{"attributeType":"Sky2Pix_PlateCarree","col":0,"comment":"null","endLoc":922,"id":11596,"name":"Sky2Pix_CAR","nodeType":"Attribute","startLoc":922,"text":"Sky2Pix_CAR"},{"attributeType":"null","col":4,"comment":"null","endLoc":471,"id":11597,"name":"_is_bool","nodeType":"Attribute","startLoc":471,"text":"_is_bool"},{"attributeType":"Pix2Sky_Mercator","col":0,"comment":"null","endLoc":945,"id":11598,"name":"Pix2Sky_MER","nodeType":"Attribute","startLoc":945,"text":"Pix2Sky_MER"},{"attributeType":"Sky2Pix_Mercator","col":0,"comment":"null","endLoc":968,"id":11599,"name":"Sky2Pix_MER","nodeType":"Attribute","startLoc":968,"text":"Sky2Pix_MER"},{"col":4,"comment":"null","endLoc":48,"header":"def __init__(self)","id":11600,"name":"__init__","nodeType":"Function","startLoc":46,"text":"def __init__(self):\n        self._graph = defaultdict(dict)\n        self.invalidate_cache()  # generates cache entries"},{"attributeType":"Pix2Sky_SansonFlamsteed","col":0,"comment":"null","endLoc":1003,"id":11601,"name":"Pix2Sky_SFL","nodeType":"Attribute","startLoc":1003,"text":"Pix2Sky_SFL"},{"attributeType":"null","col":0,"comment":"null","endLoc":20,"id":11602,"name":"jd2000","nodeType":"Attribute","startLoc":20,"text":"jd2000"},{"attributeType":"Sky2Pix_SansonFlamsteed","col":0,"comment":"null","endLoc":1026,"id":11603,"name":"Sky2Pix_SFL","nodeType":"Attribute","startLoc":1026,"text":"Sky2Pix_SFL"},{"attributeType":"null","col":8,"comment":"null","endLoc":475,"id":11604,"name":"_default_size","nodeType":"Attribute","startLoc":475,"text":"self._default_size"},{"attributeType":"Pix2Sky_Parabolic","col":0,"comment":"null","endLoc":1051,"id":11605,"name":"Pix2Sky_PAR","nodeType":"Attribute","startLoc":1051,"text":"Pix2Sky_PAR"},{"attributeType":"Trapezoid1D","col":8,"comment":"null","endLoc":474,"id":11606,"name":"_model","nodeType":"Attribute","startLoc":474,"text":"self._model"},{"col":4,"comment":"The parallax angle as an `~astropy.coordinates.Angle` object","endLoc":211,"header":"@property\n    def parallax(self)","id":11607,"name":"parallax","nodeType":"Function","startLoc":208,"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":0,"comment":"null","endLoc":21,"id":11608,"name":"_asecperrad","nodeType":"Attribute","startLoc":21,"text":"_asecperrad"},{"attributeType":"Sky2Pix_Parabolic","col":0,"comment":"null","endLoc":1076,"id":11609,"name":"Sky2Pix_PAR","nodeType":"Attribute","startLoc":1076,"text":"Sky2Pix_PAR"},{"attributeType":"null","col":8,"comment":"null","endLoc":477,"id":11610,"name":"_truncation","nodeType":"Attribute","startLoc":477,"text":"self._truncation"},{"attributeType":"null","col":0,"comment":"null","endLoc":263,"id":11611,"name":"_nut_data_00b","nodeType":"Attribute","startLoc":263,"text":"_nut_data_00b"},{"attributeType":"null","col":0,"comment":"null","endLoc":344,"id":11612,"name":"_nut_data_00b","nodeType":"Attribute","startLoc":344,"text":"_nut_data_00b"},{"className":"TrapezoidDisk2DKernel","col":0,"comment":"\n    2D trapezoid kernel.\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, MexicanHat2DKernel,\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":538,"id":11613,"nodeType":"Class","startLoc":481,"text":"class TrapezoidDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D trapezoid kernel.\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, MexicanHat2DKernel,\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()"},{"col":4,"comment":"null","endLoc":538,"header":"def __init__(self, radius, slope=1., **kwargs)","id":11614,"name":"__init__","nodeType":"Function","startLoc":533,"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()"},{"col":0,"comment":"","endLoc":9,"header":"earth_orientation.py#<anonymous>","id":11615,"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', scale='tai').jd\n\njd2000 = Time('J2000', scale='utc').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')"},{"fileName":"sky_coordinate.py","filePath":"astropy/coordinates","id":11616,"nodeType":"File","text":"\nimport re\nimport copy\nimport warnings\nimport collections\n\nimport numpy as np\n\nfrom ..utils.compat.misc import override__dir__\nfrom ..units import Unit, IrreducibleUnit\nfrom .. import units as u\nfrom ..constants import c as speed_of_light\nfrom ..wcs.utils import skycoord_to_pixel, pixel_to_skycoord\nfrom ..utils.exceptions import AstropyDeprecationWarning\nfrom ..utils.data_info import MixinInfo\nfrom ..utils import ShapedLikeNDArray\n\nfrom .distances import Distance\nfrom .angles import Angle\nfrom .baseframe import BaseCoordinateFrame, frame_transform_graph, GenericFrame, _get_repr_cls\nfrom .builtin_frames import ICRS, SkyOffsetFrame\nfrom .representation import (BaseRepresentation, SphericalRepresentation,\n                             UnitSphericalRepresentation)\n\n__all__ = ['SkyCoord', 'SkyCoordInfo']\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\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, SphericalRepresentation) and\n                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, in_frame_units=True)\n        return repr_data\n\n    def _represent_as_dict(self):\n        obj = self._parent\n        attrs = (list(obj.representation_component_names) +\n                 list(frame_transform_graph.frame_attributes.keys()))\n\n        # Don't output distance if it is all unitless 1.0\n        if 'distance' in attrs and np.all(obj.distance == 1.0):\n            attrs.remove('distance')\n\n        self._represent_as_dict_attrs = attrs\n\n        out = super()._represent_as_dict()\n\n        out['representation'] = obj.representation.get_name()\n        out['frame'] = obj.frame.name\n        # Note that obj.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\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='cartesian'`` (for example) along with data in\n    ``x``, ``y``, and ``z``.\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], \"icrs\", unit=\"deg\")  # 3 coords\n\n      >>> coords = [\"1:12:43.2 +1:12:43\", \"1 12 43.2 +1 12 43\"]\n      >>> c = SkyCoord(coords, FK4, unit=(u.deg, u.hourangle), obstime=\"J1992.21\")\n\n      >>> c = SkyCoord(\"1h12m43.2s +1d12m43s\", Galactic)  # Units from string\n      >>> c = SkyCoord(\"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(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', representation='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    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 ``LON`` and ``LAT`` values, respectively.  If\n        only one unit is supplied then it applies to both ``LON`` and\n        ``LAT``.\n    obstime : valid `~astropy.time.Time` initializer, optional\n        Time of observation\n    equinox : valid `~astropy.time.Time` initializer, optional\n        Coordinate frame equinox\n    representation : 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 : valid `~astropy.coordinates.Angle` initializer, 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        l, b : valid `~astropy.coordinates.Angle` initializer, 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        x, y, z : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values\n        u, v, w : float or `~astropy.units.Quantity`, optional\n            Cartesian coordinates values for the Galactic frame.\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        # 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        kwargs = self._parse_inputs(args, kwargs)\n\n        frame = kwargs['frame']\n        frame_attr_names = frame.get_frame_attr_names()\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        for attr in kwargs:\n            if (attr not in frame_attr_names and\n                attr in frame_transform_graph.frame_attributes):\n                # Setting it will also validate it.\n                setattr(self, attr, kwargs[attr])\n\n        coord_kwargs = {}\n        if 'representation' in kwargs:\n            coord_kwargs['representation'] = _get_repr_cls(kwargs['representation'])\n        for attr, value in kwargs.items():\n            if value is not None and (attr in frame.representation_component_names\n                                      or attr in frame.get_frame_attr_names()):\n                coord_kwargs[attr] = value\n\n        # Finally make the internal coordinate object.\n        self._sky_coord_frame = frame.__class__(copy=copy, **coord_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(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 _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.misc.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        self_frame = self._sky_coord_frame\n        try:\n            # First turn `self` into a mockup of the thing we want - we can copy\n            # this to get all the right attributes\n            self._sky_coord_frame = self_frame._apply(method, *args, **kwargs)\n            out = SkyCoord(self, representation=self.representation, copy=False)\n            for attr in self._extra_frameattr_names:\n                value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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(out, '_' + 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                out.info = self.info\n\n            return out\n        finally:\n            # now put back the right frame in self\n            self._sky_coord_frame = self_frame\n\n    def _parse_inputs(self, args, kwargs):\n        \"\"\"\n        Assemble a validated and sanitized keyword args dict for instantiating a\n        SkyCoord and coordinate object from the provided `args`, and `kwargs`.\n        \"\"\"\n        valid_kwargs = {}\n\n        # Put the SkyCoord attributes like frame, equinox, obstime, location\n        # into valid_kwargs dict.  `Frame` could come from args or kwargs, so\n        # set valid_kwargs['frame'] accordingly.  The others must be specified\n        # by keyword args or else get a None default.  Pop them off of kwargs\n        # in the process.\n        frame = valid_kwargs['frame'] = _get_frame(args, kwargs)\n        if 'representation' in kwargs:\n            valid_kwargs['representation'] = _get_repr_cls(kwargs.pop('representation'))\n\n        for attr in frame_transform_graph.frame_attributes:\n            if attr in kwargs:\n                valid_kwargs[attr] = kwargs.pop(attr)\n\n        # Get units\n        units = _get_units(args, kwargs)\n\n        # Grab any frame-specific attr names like `ra` or `l` or `distance` from kwargs\n        # and migrate to valid_kwargs.\n        valid_kwargs.update(_get_representation_attrs(frame, units, kwargs))\n\n        # Error if anything is still left in kwargs\n        if kwargs:\n\n            # TODO: remove this when velocities are supported in SkyCoord\n            vel_url = 'http://docs.astropy.org/en/stable/coordinates/velocities.html'\n            for k in kwargs:\n                if k.startswith('pm_') or k == 'radial_velocity':\n                    raise ValueError('Velocity data is currently only supported'\n                                     ' in the coordinate frame objects, not in '\n                                     'SkyCoord. See the velocities '\n                                     'documentation page for more information: '\n                                     '{0}'.format(vel_url))\n\n            raise ValueError('Unrecognized keyword argument(s) {0}'\n                             .format(', '.join(\"'{0}'\".format(key) for key in kwargs)))\n\n        # Finally deal with the unnamed args.  This figures out what the arg[0] is\n        # and returns a dict with appropriate key/values for initializing frame class.\n        if args:\n            if len(args) == 1:\n                # One arg which must be a coordinate.  In this case\n                # coord_kwargs will contain keys like 'ra', 'dec', 'distance'\n                # along with any frame attributes like equinox or obstime which\n                # were explicitly specified in the coordinate object (i.e. non-default).\n                coord_kwargs = _parse_coordinate_arg(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                    self.info = args[0].info\n\n            elif len(args) <= 3:\n                frame_attr_names = frame.representation_component_names.keys()\n                repr_attr_names = frame.representation_component_names.values()\n                coord_kwargs = {}\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.attr_classes[repr_attr_name]\n                    coord_kwargs[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            # Copy the coord_kwargs into the final valid_kwargs dict.  For each\n            # of the coord_kwargs ensure that there is no conflict with a value\n            # specified by the user in the original kwargs.\n            for attr, coord_value in coord_kwargs.items():\n                if (attr in valid_kwargs\n                        and valid_kwargs[attr] is not None\n                        and np.any(valid_kwargs[attr] != coord_value)):\n                    raise ValueError(\"Coordinate attribute '{0}'={1!r} conflicts with \"\n                                     \"keyword argument '{0}'={2!r}\"\n                                     .format(attr, coord_value, valid_kwargs[attr]))\n                valid_kwargs[attr] = coord_value\n\n        return valid_kwargs\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 loosing 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 and not\n                    (merge_attributes and frame.is_frame_attr_default(attr))):\n                    frame_kwargs[attr] = frame_val\n                elif (self_val is not None and\n                      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 {0} to {1}'\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        return self.__class__(new_coord, **frame_kwargs)\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 master transform graph.\n        \"\"\"\n        if '_sky_coord_frame' in self.__dict__:\n            if self.frame.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(\"'{0}' object has no attribute '{1}'\"\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.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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.frame.name == attr:\n                raise AttributeError(\"'{0}' is immutable\".format(attr))\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(\"'{0}' is immutable\".format(attr))\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('Invalid style.  Valid options are: {0}'.format(\",\".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                            + \" \" +\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                                 + \" \" +\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 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 np.any(getattr(self, fattrnm) != 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            unintutive 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:`/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                other = other.transform_to(self, merge_attributes=False)\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:`/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                other = other.transform_to(self, merge_attributes=False)\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        return Distance((self.cartesian - other.cartesian).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 offset to.\n\n        Returns\n        -------\n        lon_offset : `~astropy.coordinates.Angle`\n            The angular offset in the longitude direction (i.e., RA for\n            equatorial coordinates).\n        lat_offset : `~astropy.coordinates.Angle`\n            The angular offset in the latitude direction (i.e., 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\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 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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_sky(self_in_catalog_frame, 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:`/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 : integer 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`\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 (isinstance(catalogcoord, (SkyCoord, BaseCoordinateFrame))\n                and catalogcoord.has_data):\n            self_in_catalog_frame = self.transform_to(catalogcoord)\n        else:\n            raise TypeError('Can only get separation to another SkyCoord or a '\n                            'coordinate frame with data')\n\n        res = match_coordinates_3d(self_in_catalog_frame, 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:`/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        seplimit : `~astropy.units.Quantity` with angle units\n            The on-sky separation to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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:`/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` with distance units\n            The physical radius to search within.\n\n        Returns\n        -------\n        idxsearcharound : integer array\n            Indices into ``self`` that matches to the corresponding element of\n            ``idxself``. Shape matches ``idxself``.\n        idxself : integer array\n            Indices into ``searcharoundcoords`` that matches to the\n            corresponding element 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`\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/>`_ (>=0.12.0) 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 : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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        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        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 `numpy.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 : an instance of this class\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        return pixel_to_skycoord(xp, yp, wcs=wcs, origin=origin, mode=mode, cls=cls)\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` with velocity units\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. Strictly speaking, the barycentric correction is\n        multiplicative and should be applied as::\n\n           sc = SkyCoord(1*u.deg, 2*u.deg)\n           vcorr = sc.rv_correction(kind='barycentric', obstime=t, location=loc)\n           rv = rv + vcorr + rv * vcorr / consts.c\n\n        If your target is nearby and/or has finite proper motion you may need to account\n        for terms arising from this. See Wright & Eastmann (2014) for details.\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            sc = SkyCoord(1*u.deg, 2*u.deg)\n            with coord.solar_system_ephemeris.set('jpl'):\n                rv += sc.rv_correction(obstime=t, location=loc)\n\n        \"\"\"\n        # has to be here to prevent circular imports\n        from .solar_system import get_body_barycentric_posvel, get_body_barycentric\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        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:\n            raise ValueError('Cannot compute radial velocity correction if '\n                             '`obstime` argument is passed in and it is '\n                             'inconsistent with the `obstime` frame '\n                             'attribute on the SkyCoord')\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        if self.data.__class__ is UnitSphericalRepresentation:\n            targcart = self.icrs.cartesian\n        else:\n            # skycoord has distances so apply parallax\n            obs_icrs_cart = pos_earth + gcrs_p\n            icrs_cart = self.icrs.cartesian\n            targcart = icrs_cart - 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 + targcart.dot(beta_obs)) / (1 + gr/speed_of_light) - 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, if they are also\n        followed by a non-alphanumeric character. It will also match columns\n        that *end* with the component name if a non-alphanumeric character is\n        *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\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 : same as this class\n            The new `SkyCoord` (or subclass) object.\n        \"\"\"\n        inital_frame = coord_kwargs.get('frame')\n        frame = _get_frame([], coord_kwargs)\n        coord_kwargs['frame'] = inital_frame\n\n        comp_kwargs = {}\n        for comp_name in frame.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('(' + starts_with_comp + ')|(' + ends_with_comp + ')',\n                             re.IGNORECASE | re.UNICODE)\n\n            for col_name in table.colnames:\n                if rex.match(col_name):\n                    if comp_name in comp_kwargs:\n                        oldname = comp_kwargs[comp_name].name\n                        msg = ('Found at least two matches for  component \"{0}\"'\n                               ': \"{1}\" and \"{2}\". Cannot continue with this '\n                               'ambiguity.')\n                        raise ValueError(msg.format(comp_name, oldname, col_name))\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 \"{0}\" in table, but it was '\n                                 'already provided as \"{1}\" 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'):\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\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)\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\n\n# <----------------Private utility functions below here------------------------->\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    import inspect\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 {0} not in allowed values {1}'\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 class')\n\n    return frame_cls\n\n\ndef _get_frame(args, kwargs):\n    \"\"\"\n    Determine the coordinate frame from input SkyCoord args and kwargs.  This\n    modifies args and/or kwargs in-place to remove the item that provided\n    `frame`.  It also infers the frame if an input coordinate was provided and\n    checks for conflicts.\n\n    This allows for frame to be specified as a string like 'icrs' or a frame\n    class like ICRS, but not an instance ICRS() since the latter could have\n    non-default representation attributes which would require a three-way merge.\n    \"\"\"\n    frame = kwargs.pop('frame', None)\n\n    if frame is None and len(args) > 1:\n\n        # We do not allow frames to be passed as positional arguments if data\n        # is passed separately from frame.\n\n        for arg in args:\n\n            if isinstance(arg, (SkyCoord, BaseCoordinateFrame)):\n                raise ValueError(\"{0} instance cannot be passed as a positional \"\n                                 \"argument for the frame, pass it using the \"\n                                 \"frame= keyword instead.\".format(arg.__class__.__name__))\n\n    # If the frame is an instance or SkyCoord, we split up the attributes and\n    # make it into a class.\n\n    if isinstance(frame, SkyCoord):\n        # Copy any extra attributes if they are not explicitly given.\n        for attr in frame._extra_frameattr_names:\n            kwargs.setdefault(attr, getattr(frame, attr))\n        frame = frame.frame\n\n    if isinstance(frame, BaseCoordinateFrame):\n\n        for attr in frame.get_frame_attr_names():\n            if attr in kwargs:\n                raise ValueError(\"cannot specify frame attribute '{0}' directly in SkyCoord since a frame instance was passed in\".format(attr))\n            else:\n                kwargs[attr] = getattr(frame, attr)\n\n        frame = frame.__class__\n\n    if frame is not None:\n        # Frame was provided as kwarg so validate and coerce into corresponding frame.\n        frame_cls = _get_frame_class(frame)\n        frame_specified_explicitly = True\n    else:\n        # Look for the frame in args\n        for arg in args:\n            try:\n                frame_cls = _get_frame_class(arg)\n                frame_specified_explicitly = True\n            except ValueError:\n                pass\n            else:\n                args.remove(arg)\n                warnings.warn(\"Passing a frame as a positional argument is now \"\n                              \"deprecated, use the frame= keyword argument \"\n                              \"instead.\", AstropyDeprecationWarning)\n                break\n        else:\n            # Not in args nor kwargs - default to icrs\n            frame_cls = ICRS\n            frame_specified_explicitly = False\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, (collections.Sequence, np.ndarray)) and\n             len(args) == 1 and len(arg) > 0):\n            arg = arg[0]\n\n        coord_frame_cls = None\n        if isinstance(arg, BaseCoordinateFrame):\n            coord_frame_cls = arg.__class__\n        elif isinstance(arg, SkyCoord):\n            coord_frame_cls = arg.frame.__class__\n\n        if coord_frame_cls is not None:\n            if not frame_specified_explicitly:\n                frame_cls = coord_frame_cls\n            elif frame_cls is not coord_frame_cls:\n                raise ValueError(\"Cannot override frame='{0}' of input coordinate with \"\n                                 \"new frame='{1}'.  Instead transform the coordinate.\"\n                                 .format(coord_frame_cls.__name__, frame_cls.__name__))\n\n    if 'representation' in kwargs:\n        frame = frame_cls(representation=_get_repr_cls(kwargs['representation']))\n    else:\n        frame = frame_cls()\n\n    return frame\n\n\ndef _get_units(args, kwargs):\n    \"\"\"\n    Get the longitude unit and latitude unit from kwargs.  Possible enhancement\n    is to allow input from args as well.\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:\n            raise ValueError('Unit keyword must have one to three unit values as '\n                             'tuple or comma-separated string')\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    is_scalar = False  # Differentiate between scalar and list input\n    valid_kwargs = {}  # Returned dict of lon, lat, and distance (optional)\n\n    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_names = frame.representation_component_names.values()\n    repr_attr_classes = frame.representation.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)\n\n        values = []  # List of values corresponding to representation attrs\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                continue\n\n            # Get the value from `data` in the eventual representation\n            values.append(getattr(data, repr_attr_name))\n\n        for attr in frame_transform_graph.frame_attributes:\n            value = getattr(coords, attr, None)\n            use_value = (isinstance(coords, SkyCoord)\n                         or attr not in coords._attr_names_with_defaults)\n            if use_value and value is not None:\n                valid_kwargs[attr] = value\n\n    elif isinstance(coords, BaseRepresentation):\n        data = coords.represent_as(frame.representation)\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'\n          and 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, (collections.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: {0} != {1}\".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                valid_kwargs[fattrnm] = getattr(scs[0].frame, fattrnm)\n            for fattrnm in scs[0]._extra_frameattr_names:\n                valid_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:\n                raise ValueError('One or more elements of input sequence does not have a length')\n\n            if len(n_coords) > 1:\n                raise ValueError('Input coordinate values must have same number of elements, found {0}'\n                                 .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 {0} values but '\n                                 'representation {1} only accepts {2}'\n                                 .format(n_coords, frame.representation.get_name(), 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            valid_kwargs[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 \"{0}\" for attribute '\n                         '{1}'.format(value, frame_attr_name), err)\n    return valid_kwargs\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    frame_attr_names = frame.representation_component_names.keys()\n    repr_attr_classes = frame.representation.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            valid_kwargs[frame_attr_name] = repr_attr_class(value, unit=unit)\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 = ('{0} {1} {2}'.\n                         format(coord[0][0:3], coord[0][3:5], coord[0][5:]),\n                         '{0} {1} {2}'.\n                         format(coord[1][0:3], coord[1][3:5], coord[1][5:]))\n            else:\n                coord = ('{0} {1} {2}'.\n                         format(coord[0][0:2], coord[0][2:4], coord[0][4:]),\n                         '{0} {1} {2}'.\n                         format(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":45,"id":11617,"name":"frame_transform_graph","nodeType":"Attribute","startLoc":45,"text":"frame_transform_graph"},{"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":1456,"id":11618,"nodeType":"Class","startLoc":1423,"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 = OrderedDict()\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('no {0}'.format(name))\n\n    def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(\"can't set frame attribute '{0}'\".format(name))\n        else:\n            super().__setattr__(name, value)"},{"col":4,"comment":"null","endLoc":1450,"header":"def __getattr__(self, name)","id":11619,"name":"__getattr__","nodeType":"Function","startLoc":1446,"text":"def __getattr__(self, name):\n        if '_' + name in self.__dict__:\n            return getattr(self, '_' + name)\n        else:\n            raise AttributeError('no {0}'.format(name))"},{"col":4,"comment":"null","endLoc":1456,"header":"def __setattr__(self, name, value)","id":11620,"name":"__setattr__","nodeType":"Function","startLoc":1452,"text":"def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(\"can't set frame attribute '{0}'\".format(name))\n        else:\n            super().__setattr__(name, value)"},{"attributeType":"null","col":4,"comment":"null","endLoc":92,"id":11621,"name":"_equivalent_unit","nodeType":"Attribute","startLoc":92,"text":"_equivalent_unit"},{"attributeType":"null","col":4,"comment":"null","endLoc":531,"id":11622,"name":"_is_bool","nodeType":"Attribute","startLoc":531,"text":"_is_bool"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":11623,"name":"_include_easy_conversion_members","nodeType":"Attribute","startLoc":93,"text":"_include_easy_conversion_members"},{"attributeType":"null","col":8,"comment":"null","endLoc":535,"id":11624,"name":"_default_size","nodeType":"Attribute","startLoc":535,"text":"self._default_size"},{"attributeType":"null","col":12,"comment":"null","endLoc":118,"id":11625,"name":"value_msg","nodeType":"Attribute","startLoc":118,"text":"value_msg"},{"attributeType":"null","col":4,"comment":"null","endLoc":1436,"id":11626,"name":"name","nodeType":"Attribute","startLoc":1436,"text":"name"},{"attributeType":"null","col":16,"comment":"null","endLoc":146,"id":11627,"name":"unit","nodeType":"Attribute","startLoc":146,"text":"unit"},{"attributeType":"Pix2Sky_Molleweide","col":0,"comment":"null","endLoc":1101,"id":11628,"name":"Pix2Sky_MOL","nodeType":"Attribute","startLoc":1101,"text":"Pix2Sky_MOL"},{"attributeType":"null","col":8,"comment":"null","endLoc":1439,"id":11629,"name":"frame_attributes","nodeType":"Attribute","startLoc":1439,"text":"self.frame_attributes"},{"attributeType":"Sky2Pix_Molleweide","col":0,"comment":"null","endLoc":1133,"id":11630,"name":"Sky2Pix_MOL","nodeType":"Attribute","startLoc":1133,"text":"Sky2Pix_MOL"},{"attributeType":"Pix2Sky_HammerAitoff","col":0,"comment":"null","endLoc":1158,"id":11631,"name":"Pix2Sky_AIT","nodeType":"Attribute","startLoc":1158,"text":"Pix2Sky_AIT"},{"attributeType":"TrapezoidDisk2D","col":8,"comment":"null","endLoc":534,"id":11632,"name":"_model","nodeType":"Attribute","startLoc":534,"text":"self._model"},{"attributeType":"Sky2Pix_HammerAitoff","col":0,"comment":"null","endLoc":1188,"id":11633,"name":"Sky2Pix_AIT","nodeType":"Attribute","startLoc":1188,"text":"Sky2Pix_AIT"},{"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-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : `SkyCoord` or low-level coordinate object.\n        the coordinate which specifies the origin of this frame.\n    rotation : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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":226,"id":11634,"nodeType":"Class","startLoc":153,"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-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : `SkyCoord` or low-level coordinate object.\n        the coordinate which specifies the origin of this frame.\n    rotation : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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 and hasattr(self.data, 'lon'):\n            self.data.lon.wrap_angle = 180*u.deg\n        if (self.origin is not None and getattr(self.origin.data, 'differentials', None) or\n           (self.has_data and getattr(self.data, 'differentials', None))):\n            raise NotImplementedError('SkyOffsetFrame currently does not '\n                                      'support velocities.')"},{"attributeType":"Pix2Sky_ConicPerspective","col":0,"comment":"null","endLoc":1257,"id":11635,"name":"Pix2Sky_COP","nodeType":"Attribute","startLoc":1257,"text":"Pix2Sky_COP"},{"attributeType":"Sky2Pix_ConicPerspective","col":0,"comment":"null","endLoc":1297,"id":11636,"name":"Sky2Pix_COP","nodeType":"Attribute","startLoc":1297,"text":"Sky2Pix_COP"},{"col":4,"comment":"null","endLoc":214,"header":"def __new__(cls, *args, **kwargs)","id":11637,"name":"__new__","nodeType":"Function","startLoc":194,"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)"},{"attributeType":"Pix2Sky_ConicEqualArea","col":0,"comment":"null","endLoc":1341,"id":11638,"name":"Pix2Sky_COE","nodeType":"Attribute","startLoc":1341,"text":"Pix2Sky_COE"},{"attributeType":"null","col":8,"comment":"null","endLoc":537,"id":11639,"name":"_truncation","nodeType":"Attribute","startLoc":537,"text":"self._truncation"},{"attributeType":"Sky2Pix_ConicEqualArea","col":0,"comment":"null","endLoc":1386,"id":11640,"name":"Sky2Pix_COE","nodeType":"Attribute","startLoc":1386,"text":"Sky2Pix_COE"},{"attributeType":"Pix2Sky_ConicEquidistant","col":0,"comment":"null","endLoc":1426,"id":11641,"name":"Pix2Sky_COD","nodeType":"Attribute","startLoc":1426,"text":"Pix2Sky_COD"},{"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 : coordinate frame class (i.e., subclass of `~astropy.coordinates.BaseCoordinateFrame`)\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":150,"header":"def make_skyoffset_cls(framecls)","id":11642,"name":"make_skyoffset_cls","nodeType":"Function","startLoc":16,"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 : coordinate frame class (i.e., subclass of `~astropy.coordinates.BaseCoordinateFrame`)\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    # the class of a class object is the metaclass\n    framemeta = framecls.__class__\n\n    class SkyOffsetMeta(framemeta):\n        \"\"\"\n        This metaclass renames the class to be \"SkyOffset<framecls>\" and also\n        adjusts the frame specific representation info so that spherical names\n        are always \"lon\" and \"lat\" (instead of e.g. \"ra\" and \"dec\").\n        \"\"\"\n\n        def __new__(cls, name, bases, members):\n            # Only 'origin' is needed here, to set the origin frame properly.\n            members['origin'] = CoordinateAttribute(frame=framecls, default=None)\n\n            # This has to be done because FrameMeta will set these attributes\n            # to the defaults from BaseCoordinateFrame when it creates the base\n            # SkyOffsetFrame class initially.\n            members['_frame_specific_representation_info'] = framecls._frame_specific_representation_info\n            members['_default_representation'] = framecls._default_representation\n            members['_default_differential'] = framecls._default_differential\n\n            newname = name[:-5] if name.endswith('Frame') else name\n            newname += framecls.__name__\n\n            res = super().__new__(cls, newname, bases, members)\n\n            # now go through all the component names and make any spherical names be \"lon\" and \"lat\"\n            # instead of e.g. \"ra\" and \"dec\"\n\n            lists_done = []\n            for cls_, component_list in res._frame_specific_representation_info.items():\n                if cls_ in (r.SphericalRepresentation,\n                            r.UnitSphericalRepresentation):\n                    gotlatlon = []\n                    for i, comp in enumerate(component_list):\n                        if component_list in lists_done:\n                            # we need this because sometimes the component_\n                            # list's are the exact *same* object for both\n                            # spherical and unitspherical.  So looping then makes\n                            # the change *twice*.  This hack bypasses that.\n                            continue\n\n                        if comp.reprname in ('lon', 'lat'):\n                            dct = namedtuple_asdict(comp)\n                            # this forces the component names to be 'lat' and\n                            # 'lon' regardless of what the actual base frame\n                            # might use\n                            dct['framename'] = comp.reprname\n                            component_list[i] = type(comp)(**dct)\n                            gotlatlon.append(comp.reprname)\n\n                    if 'lon' not in gotlatlon:\n                        rmlon = RepresentationMapping('lon', 'lon', 'recommended')\n                        component_list.insert(0, rmlon)\n\n                    if 'lat' not in gotlatlon:\n                        rmlat = RepresentationMapping('lat', 'lat', 'recommended')\n                        component_list.insert(0, rmlat)\n\n                    # TODO: we could support proper motions / velocities in sky\n                    # offset frames.\n\n                    lists_done.append(component_list)\n\n            return res\n\n    # We need this to handle the intermediate metaclass correctly, otherwise we could\n    # just subclass SkyOffsetFrame.\n    _SkyOffsetFramecls = SkyOffsetMeta('SkyOffsetFrame', (SkyOffsetFrame, framecls),\n                                 {'__doc__': SkyOffsetFrame.__doc__})\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":"Sky2Pix_ConicEquidistant","col":0,"comment":"null","endLoc":1467,"id":11643,"name":"Sky2Pix_COD","nodeType":"Attribute","startLoc":1467,"text":"Sky2Pix_COD"},{"className":"MexicanHat1DKernel","col":0,"comment":"\n    1D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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 MexicanHat1DKernel\n        mexicanhat_1D_kernel = MexicanHat1DKernel(10)\n        plt.plot(mexicanhat_1D_kernel, drawstyle='steps')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('value')\n        plt.show()\n\n    ","endLoc":608,"id":11644,"nodeType":"Class","startLoc":541,"text":"class MexicanHat1DKernel(Kernel1D):\n    \"\"\"\n    1D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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 MexicanHat1DKernel\n        mexicanhat_1D_kernel = MexicanHat1DKernel(10)\n        plt.plot(mexicanhat_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.MexicanHat1D(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)"},{"attributeType":"Pix2Sky_ConicOrthomorphic","col":0,"comment":"null","endLoc":1516,"id":11645,"name":"Pix2Sky_COO","nodeType":"Attribute","startLoc":1516,"text":"Pix2Sky_COO"},{"col":4,"comment":"null","endLoc":608,"header":"def __init__(self, width, **kwargs)","id":11646,"name":"__init__","nodeType":"Function","startLoc":603,"text":"def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.sqrt(2 * np.pi) * width ** 3)\n        self._model = models.MexicanHat1D(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)"},{"attributeType":"Sky2Pix_ConicOrthomorphic","col":0,"comment":"null","endLoc":1566,"id":11647,"name":"Sky2Pix_COO","nodeType":"Attribute","startLoc":1566,"text":"Sky2Pix_COO"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":158,"id":11648,"name":"distance","nodeType":"Attribute","startLoc":158,"text":"distance"},{"attributeType":"Pix2Sky_BonneEqualArea","col":0,"comment":"null","endLoc":1611,"id":11649,"name":"Pix2Sky_BON","nodeType":"Attribute","startLoc":1611,"text":"Pix2Sky_BON"},{"attributeType":"Sky2Pix_BonneEqualArea","col":0,"comment":"null","endLoc":1649,"id":11650,"name":"Sky2Pix_BON","nodeType":"Attribute","startLoc":1649,"text":"Sky2Pix_BON"},{"attributeType":"Pix2Sky_Polyconic","col":0,"comment":"null","endLoc":1669,"id":11651,"name":"Pix2Sky_PCO","nodeType":"Attribute","startLoc":1669,"text":"Pix2Sky_PCO"},{"attributeType":"Sky2Pix_Polyconic","col":0,"comment":"null","endLoc":1689,"id":11652,"name":"Sky2Pix_PCO","nodeType":"Attribute","startLoc":1689,"text":"Sky2Pix_PCO"},{"attributeType":"Pix2Sky_TangentialSphericalCube","col":0,"comment":"null","endLoc":1726,"id":11653,"name":"Pix2Sky_TSC","nodeType":"Attribute","startLoc":1726,"text":"Pix2Sky_TSC"},{"attributeType":"Sky2Pix_TangentialSphericalCube","col":0,"comment":"null","endLoc":1746,"id":11654,"name":"Sky2Pix_TSC","nodeType":"Attribute","startLoc":1746,"text":"Sky2Pix_TSC"},{"attributeType":"Pix2Sky_COBEQuadSphericalCube","col":0,"comment":"null","endLoc":1766,"id":11655,"name":"Pix2Sky_CSC","nodeType":"Attribute","startLoc":1766,"text":"Pix2Sky_CSC"},{"attributeType":"null","col":16,"comment":"null","endLoc":106,"id":11656,"name":"cosmology","nodeType":"Attribute","startLoc":106,"text":"cosmology"},{"attributeType":"Sky2Pix_COBEQuadSphericalCube","col":0,"comment":"null","endLoc":1786,"id":11657,"name":"Sky2Pix_CSC","nodeType":"Attribute","startLoc":1786,"text":"Sky2Pix_CSC"},{"attributeType":"Pix2Sky_QuadSphericalCube","col":0,"comment":"null","endLoc":1806,"id":11658,"name":"Pix2Sky_QSC","nodeType":"Attribute","startLoc":1806,"text":"Pix2Sky_QSC"},{"col":4,"comment":"null","endLoc":390,"header":"def __init__(self, frame, default=None, secondary_attribute='')","id":11659,"name":"__init__","nodeType":"Function","startLoc":388,"text":"def __init__(self, frame, default=None, secondary_attribute=''):\n        self._frame = frame\n        super().__init__(default, secondary_attribute)"},{"attributeType":"Sky2Pix_QuadSphericalCube","col":0,"comment":"null","endLoc":1826,"id":11660,"name":"Sky2Pix_QSC","nodeType":"Attribute","startLoc":1826,"text":"Sky2Pix_QSC"},{"attributeType":"Pix2Sky_HEALPix","col":0,"comment":"null","endLoc":1862,"id":11661,"name":"Pix2Sky_HPX","nodeType":"Attribute","startLoc":1862,"text":"Pix2Sky_HPX"},{"attributeType":"null","col":16,"comment":"null","endLoc":150,"id":11662,"name":"copy","nodeType":"Attribute","startLoc":150,"text":"copy"},{"attributeType":"null","col":12,"comment":"null","endLoc":120,"id":11663,"name":"n_not_none","nodeType":"Attribute","startLoc":120,"text":"n_not_none"},{"attributeType":"null","col":16,"comment":"null","endLoc":145,"id":11664,"name":"value","nodeType":"Attribute","startLoc":145,"text":"value"},{"attributeType":"null","col":20,"comment":"null","endLoc":130,"id":11665,"name":"meanlogval","nodeType":"Attribute","startLoc":130,"text":"meanlogval"},{"attributeType":"Sky2Pix_HEALPix","col":0,"comment":"null","endLoc":1893,"id":11666,"name":"Sky2Pix_HPX","nodeType":"Attribute","startLoc":1893,"text":"Sky2Pix_HPX"},{"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":99,"header":"def invalidate_cache(self)","id":11667,"name":"invalidate_cache","nodeType":"Function","startLoc":88,"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._shortestpaths = {}\n        self._composite_cache = {}"},{"col":4,"comment":"null","endLoc":59,"header":"@property\n    def _cached_names(self)","id":11668,"name":"_cached_names","nodeType":"Function","startLoc":50,"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                    dct[nm] = c\n\n        return self._cached_names_dct"},{"attributeType":"Pix2Sky_HEALPixPolar","col":0,"comment":"null","endLoc":1913,"id":11669,"name":"Pix2Sky_XPH","nodeType":"Attribute","startLoc":1913,"text":"Pix2Sky_XPH"},{"col":4,"comment":"\n        A `set` of all the frame classes present in this `TransformGraph`.\n        ","endLoc":73,"header":"@property\n    def frame_set(self)","id":11670,"name":"frame_set","nodeType":"Function","startLoc":61,"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 = frm_set = set()\n            for a in self._graph:\n                frm_set.add(a)\n                for b in self._graph[a]:\n                    frm_set.add(b)\n\n        return self._cached_frame_set.copy()"},{"attributeType":"Sky2Pix_HEALPixPolar","col":0,"comment":"null","endLoc":1933,"id":11671,"name":"Sky2Pix_XPH","nodeType":"Attribute","startLoc":1933,"text":"Sky2Pix_XPH"},{"col":0,"comment":"","endLoc":14,"header":"projections.py#<anonymous>","id":11672,"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\nprojcodes = [\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\n__all__ = ['Projection', 'Pix2SkyProjection', 'Sky2PixProjection',\n           'Zenithal', 'Cylindrical', 'PseudoCylindrical', 'Conic',\n           'PseudoConic', 'QuadCube', 'HEALPix',\n           'AffineTransformation2D',\n           'projcodes',\n\n           'Pix2Sky_ZenithalPerspective', 'Sky2Pix_ZenithalPerspective',\n           'Pix2Sky_SlantZenithalPerspective', 'Sky2Pix_SlantZenithalPerspective',\n           'Pix2Sky_Gnomonic', 'Sky2Pix_Gnomonic',\n           'Pix2Sky_Stereographic', 'Sky2Pix_Stereographic',\n           'Pix2Sky_SlantOrthographic', 'Sky2Pix_SlantOrthographic',\n           'Pix2Sky_ZenithalEquidistant', 'Sky2Pix_ZenithalEquidistant',\n           'Pix2Sky_ZenithalEqualArea', 'Sky2Pix_ZenithalEqualArea',\n           'Pix2Sky_Airy', 'Sky2Pix_Airy',\n           'Pix2Sky_CylindricalPerspective', 'Sky2Pix_CylindricalPerspective',\n           'Pix2Sky_CylindricalEqualArea', 'Sky2Pix_CylindricalEqualArea',\n           'Pix2Sky_PlateCarree', 'Sky2Pix_PlateCarree',\n           'Pix2Sky_Mercator', 'Sky2Pix_Mercator',\n           'Pix2Sky_SansonFlamsteed', 'Sky2Pix_SansonFlamsteed',\n           'Pix2Sky_Parabolic', 'Sky2Pix_Parabolic',\n           'Pix2Sky_Molleweide', 'Sky2Pix_Molleweide',\n           'Pix2Sky_HammerAitoff', 'Sky2Pix_HammerAitoff',\n           'Pix2Sky_ConicPerspective', 'Sky2Pix_ConicPerspective',\n           'Pix2Sky_ConicEqualArea', 'Sky2Pix_ConicEqualArea',\n           'Pix2Sky_ConicEquidistant', 'Sky2Pix_ConicEquidistant',\n           'Pix2Sky_ConicOrthomorphic', 'Sky2Pix_ConicOrthomorphic',\n           'Pix2Sky_BonneEqualArea', 'Sky2Pix_BonneEqualArea',\n           'Pix2Sky_Polyconic', 'Sky2Pix_Polyconic',\n           'Pix2Sky_TangentialSphericalCube', 'Sky2Pix_TangentialSphericalCube',\n           'Pix2Sky_COBEQuadSphericalCube', 'Sky2Pix_COBEQuadSphericalCube',\n           'Pix2Sky_QuadSphericalCube', 'Sky2Pix_QuadSphericalCube',\n           'Pix2Sky_HEALPix', 'Sky2Pix_HEALPix',\n           'Pix2Sky_HEALPixPolar', 'Sky2Pix_HEALPixPolar',\n\n           # The following are short FITS WCS aliases\n           'Pix2Sky_AZP', 'Sky2Pix_AZP',\n           'Pix2Sky_SZP', 'Sky2Pix_SZP',\n           'Pix2Sky_TAN', 'Sky2Pix_TAN',\n           'Pix2Sky_STG', 'Sky2Pix_STG',\n           'Pix2Sky_SIN', 'Sky2Pix_SIN',\n           'Pix2Sky_ARC', 'Sky2Pix_ARC',\n           'Pix2Sky_ZEA', 'Sky2Pix_ZEA',\n           'Pix2Sky_AIR', 'Sky2Pix_AIR',\n           'Pix2Sky_CYP', 'Sky2Pix_CYP',\n           'Pix2Sky_CEA', 'Sky2Pix_CEA',\n           'Pix2Sky_CAR', 'Sky2Pix_CAR',\n           'Pix2Sky_MER', 'Sky2Pix_MER',\n           'Pix2Sky_SFL', 'Sky2Pix_SFL',\n           'Pix2Sky_PAR', 'Sky2Pix_PAR',\n           'Pix2Sky_MOL', 'Sky2Pix_MOL',\n           'Pix2Sky_AIT', 'Sky2Pix_AIT',\n           'Pix2Sky_COP', 'Sky2Pix_COP',\n           'Pix2Sky_COE', 'Sky2Pix_COE',\n           'Pix2Sky_COD', 'Sky2Pix_COD',\n           'Pix2Sky_COO', 'Sky2Pix_COO',\n           'Pix2Sky_BON', 'Sky2Pix_BON',\n           'Pix2Sky_PCO', 'Sky2Pix_PCO',\n           'Pix2Sky_TSC', 'Sky2Pix_TSC',\n           'Pix2Sky_CSC', 'Sky2Pix_CSC',\n           'Pix2Sky_QSC', 'Sky2Pix_QSC',\n           'Pix2Sky_HPX', 'Sky2Pix_HPX',\n           'Pix2Sky_XPH', 'Sky2Pix_XPH'\n]\n\nPix2Sky_AZP = Pix2Sky_ZenithalPerspective\n\nSky2Pix_AZP = Sky2Pix_ZenithalPerspective\n\nPix2Sky_SZP = Pix2Sky_SlantZenithalPerspective\n\nSky2Pix_SZP = Sky2Pix_SlantZenithalPerspective\n\nPix2Sky_TAN = Pix2Sky_Gnomonic\n\nSky2Pix_TAN = Sky2Pix_Gnomonic\n\nPix2Sky_STG = Pix2Sky_Stereographic\n\nSky2Pix_STG = Sky2Pix_Stereographic\n\nPix2Sky_SIN = Pix2Sky_SlantOrthographic\n\nSky2Pix_SIN = Sky2Pix_SlantOrthographic\n\nPix2Sky_ARC = Pix2Sky_ZenithalEquidistant\n\nSky2Pix_ARC = Sky2Pix_ZenithalEquidistant\n\nPix2Sky_ZEA = Pix2Sky_ZenithalEqualArea\n\nSky2Pix_ZEA = Sky2Pix_ZenithalEqualArea\n\nPix2Sky_AIR = Pix2Sky_Airy\n\nSky2Pix_AIR = Sky2Pix_Airy\n\nPix2Sky_CYP = Pix2Sky_CylindricalPerspective\n\nSky2Pix_CYP = Sky2Pix_CylindricalPerspective\n\nPix2Sky_CEA = Pix2Sky_CylindricalEqualArea\n\nSky2Pix_CEA = Sky2Pix_CylindricalEqualArea\n\nPix2Sky_CAR = Pix2Sky_PlateCarree\n\nSky2Pix_CAR = Sky2Pix_PlateCarree\n\nPix2Sky_MER = Pix2Sky_Mercator\n\nSky2Pix_MER = Sky2Pix_Mercator\n\nPix2Sky_SFL = Pix2Sky_SansonFlamsteed\n\nSky2Pix_SFL = Sky2Pix_SansonFlamsteed\n\nPix2Sky_PAR = Pix2Sky_Parabolic\n\nSky2Pix_PAR = Sky2Pix_Parabolic\n\nPix2Sky_MOL = Pix2Sky_Molleweide\n\nSky2Pix_MOL = Sky2Pix_Molleweide\n\nPix2Sky_AIT = Pix2Sky_HammerAitoff\n\nSky2Pix_AIT = Sky2Pix_HammerAitoff\n\nPix2Sky_COP = Pix2Sky_ConicPerspective\n\nSky2Pix_COP = Sky2Pix_ConicPerspective\n\nPix2Sky_COE = Pix2Sky_ConicEqualArea\n\nSky2Pix_COE = Sky2Pix_ConicEqualArea\n\nPix2Sky_COD = Pix2Sky_ConicEquidistant\n\nSky2Pix_COD = Sky2Pix_ConicEquidistant\n\nPix2Sky_COO = Pix2Sky_ConicOrthomorphic\n\nSky2Pix_COO = Sky2Pix_ConicOrthomorphic\n\nPix2Sky_BON = Pix2Sky_BonneEqualArea\n\nSky2Pix_BON = Sky2Pix_BonneEqualArea\n\nPix2Sky_PCO = Pix2Sky_Polyconic\n\nSky2Pix_PCO = Sky2Pix_Polyconic\n\nPix2Sky_TSC = Pix2Sky_TangentialSphericalCube\n\nSky2Pix_TSC = Sky2Pix_TangentialSphericalCube\n\nPix2Sky_CSC = Pix2Sky_COBEQuadSphericalCube\n\nSky2Pix_CSC = Sky2Pix_COBEQuadSphericalCube\n\nPix2Sky_QSC = Pix2Sky_QuadSphericalCube\n\nSky2Pix_QSC = Sky2Pix_QuadSphericalCube\n\nPix2Sky_HPX = Pix2Sky_HEALPix\n\nSky2Pix_HPX = Sky2Pix_HEALPix\n\nPix2Sky_XPH = Pix2Sky_HEALPixPolar\n\nSky2Pix_XPH = Sky2Pix_HEALPixPolar"},{"attributeType":"null","col":4,"comment":"null","endLoc":601,"id":11673,"name":"_is_bool","nodeType":"Attribute","startLoc":601,"text":"_is_bool"},{"fileName":"representation.py","filePath":"astropy/coordinates","id":11674,"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\n\nimport abc\nimport functools\nimport operator\nfrom collections import OrderedDict\nimport inspect\n\nimport numpy as np\nimport astropy.units as u\n\nfrom .angles import Angle, Longitude, Latitude\nfrom .distances import Distance\nfrom ..utils import ShapedLikeNDArray, classproperty\n\nfrom ..utils.misc import InheritDocstrings\nfrom ..utils.compat import NUMPY_LT_1_12, NUMPY_LT_1_14\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 the metaclass init so all representation and differential\n# classes get registered automatically.\nREPRESENTATION_CLASSES = {}\nDIFFERENTIAL_CLASSES = {}\n\n\ndef _array2string(values, prefix=''):\n    # Mimic numpy >=1.12 array2string, in which structured arrays are\n    # typeset taking into account all printoptions.\n    kwargs = {'separator': ', ', 'prefix': prefix}\n    if NUMPY_LT_1_12:  # pragma: no cover\n        # Mimic StructureFormat from numpy >=1.12 assuming float-only data.\n        from numpy.core.arrayprint import FloatFormat\n        opts = np.get_printoptions()\n        format_functions = [FloatFormat(np.atleast_1d(values[component]).ravel(),\n                                        precision=opts['precision'],\n                                        suppress_small=opts['suppress'])\n                            for component in values.dtype.names]\n\n        def fmt(x):\n            return '({})'.format(', '.join(format_function(field)\n                                           for field, format_function in\n                                           zip(x, format_functions)))\n        # Before 1.12, structures arrays were set as \"numpystr\",\n        # so that is the formmater we need to replace.\n        kwargs['formatter'] = {'numpystr': fmt}\n        kwargs['style'] = fmt\n\n    else:\n        kwargs['formatter'] = {}\n        if NUMPY_LT_1_14:  # in 1.14, style is no longer used (and deprecated)\n            kwargs['style'] = repr\n\n    return np.array2string(values, **kwargs)\n\n\ndef _combine_xyz(x, y, z, xyz_axis=0):\n    \"\"\"\n    Combine components ``x``, ``y``, ``z`` into a single Quantity array.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity`\n        The individual x, y, and z components.\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``, i.e., using the default of ``0``,\n        the shape will be ``(3,) + x.shape``.\n    \"\"\"\n    # Add new axis in x, y, z so one can concatenate them around it.\n    # NOTE: just use np.stack once our minimum numpy version is 1.10.\n    result_ndim = x.ndim + 1\n    if not -result_ndim <= xyz_axis < result_ndim:\n        raise IndexError('xyz_axis {0} out of bounds [-{1}, {1})'\n                         .format(xyz_axis, result_ndim))\n\n    if xyz_axis < 0:\n        xyz_axis += result_ndim\n\n    # Get x, y, z to the same units (this is very fast for identical units)\n    # since np.concatenate cannot deal with quantity.\n    cls = x.__class__\n    y = cls(y, x.unit, copy=False)\n    z = cls(z, x.unit, copy=False)\n\n    sh = x.shape\n    sh = sh[:xyz_axis] + (1,) + sh[xyz_axis:]\n    xyz_value = np.concatenate([c.reshape(sh).value for c in (x, y, z)],\n                               axis=xyz_axis)\n    return cls(xyz_value, unit=x.unit, copy=False)\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 rather than referenced.\n    \"\"\"\n\n    # Ensure multiplication/division with ndarray or Quantity doesn't lead to\n    # object arrays.\n    __array_priority__ = 50000\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        attrs = []\n        for component in components:\n            try:\n                attrs.append(args.pop(0) if args else kwargs.pop(component))\n            except KeyError:\n                raise TypeError('__init__() missing 1 required positional '\n                                'argument: {0!r}'.format(component))\n\n        copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n        if args:\n            raise TypeError('unexpected arguments: {0}'.format(args))\n\n        if kwargs:\n            for component in components:\n                if component in kwargs:\n                    raise TypeError(\"__init__() got multiple values for \"\n                                    \"argument {0!r}\".format(component))\n\n            raise TypeError('unexpected keyword arguments: {0}'.format(kwargs))\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy)\n                 for component, attr in zip(components, attrs)]\n        try:\n            attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError:\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(\"Input parameters {0} cannot be broadcast\"\n                             .format(c_str))\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 : object of this class\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\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 _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.misc.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        return self.__class__(*[apply_method(getattr(self, component))\n                                for component in self.components], copy=False)\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        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 AttributeError:\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 __div__(self, other):  # pragma: py2\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 = '({0})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr\n\n    def __str__(self):\n        return '{0} {1:s}'.format(_array2string(self._values), self._unitstr)\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.: {0})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{0} ({1}) {2:s}\\n{3}{4}{5}>'.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\n# Need to also subclass ABCMeta rather than type, so that this meta class can\n# be combined with a ShapedLikeNDArray subclass (which is an ABC).  Without it:\n# \"TypeError: metaclass conflict: the metaclass of a derived class must be a\n#  (non-strict) subclass of the metaclasses of all its bases\"\nclass MetaBaseRepresentation(InheritDocstrings, abc.ABCMeta):\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if 'attr_classes' not in dct:\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n\n        if repr_name in REPRESENTATION_CLASSES:\n            raise ValueError(\"Representation class {0} already defined\"\n                             .format(repr_name))\n\n        REPRESENTATION_CLASSES[repr_name] = cls\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=(\"The '{0}' component of the points(s).\"\n                                      .format(component))))\n\n\nclass BaseRepresentation(BaseRepresentationOrDifferential,\n                         metaclass=MetaBaseRepresentation):\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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, an `~collections.OrderedDict`\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). Finally, classes can also define a\n    ``recommended_units`` dictionary, which maps component names to the units\n    they are best presented to users in (this is used only in representations\n    of coordinates, and may be overridden by frame classes).\n    \"\"\"\n\n    recommended_units = {}  # subclasses can override\n\n    def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\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:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\")\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 '{0}', expected \"\n                                     \"unit key = '{1}' but received key = '{2}'\"\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 ({0} vs \"\n                                 \"{1})\".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 '{0}' is not supported when \"\n                            \"differentials are attached to a {1}.\"\n                            .format(op_name, self.__class__.__name__))\n\n    @property\n    def _compatible_differentials(self):\n        return [DIFFERENTIAL_CLASSES[self.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(\"{} has not implemented unit vectors\"\n                                  .format(type(self)))\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(\"{} has not implemented scale factors.\"\n                                  .format(type(self)))\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 set(differential_class.keys()) != set(self.differentials.keys()):\n            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:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {0} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {1}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__))\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\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            # The default is to convert via cartesian coordinates\n            new_rep = other_class.from_cartesian(self.to_cartesian())\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_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`\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        newrepr\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        newrepr\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 _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 _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\n        self._raise_if_has_differentials(op.__name__)\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            return self.__class__(*results)\n        except Exception:\n            return NotImplemented\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` 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 : representation\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 : representation\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 : representation\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : representation\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 : `~astropy.units.Unit` or str\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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('x', u.Quantity),\n                                ('y', u.Quantity),\n                                ('z', u.Quantity)])\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 xyz_axis is not None and xyz_axis != 0:\n                x = np.rollaxis(x, xyz_axis, 0)\n            x, y, z = x\n        elif 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        elif (y is None and z is not None) or (y is not None and z is None):\n            raise ValueError(\"x, y, and z are required to instantiate {0}\"\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.physical_type ==\n                self._y.unit.physical_type == self._z.unit.physical_type):\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 OrderedDict(\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 OrderedDict((('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``.\n        \"\"\"\n        return _combine_xyz(self._x, self._y, self._z, xyz_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 : `~numpy.ndarray`\n            A 3x3 transformation matrix, such as a rotation matrix.\n\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\n        # Avoid doing gratuitous np.array for things that look like arrays.\n        try:\n            matrix_shape = matrix.shape\n        except AttributeError:\n            matrix = np.array(matrix)\n            matrix_shape = matrix.shape\n\n        if matrix_shape[-2:] != (3, 3):\n            raise ValueError(\"tried to do matrix multiplication with an array \"\n                             \"that doesn't end in 3x3\")\n\n        # TODO: since this is likely to be a widely used function in coordinate\n        # transforms, it should be optimized (for example in Cython).\n\n        # Get xyz once since it's an expensive operation\n        oldxyz = self.xyz\n        # Note that neither dot nor einsum handles Quantity properly, so we use\n        # the arrays and put the unit back in the end.\n        if self.isscalar and not matrix_shape[:-2]:\n            # a fast path for scalar coordinates.\n            newxyz = matrix.dot(oldxyz.value)\n        else:\n            # Matrix multiply all pmat items and coordinates, broadcasting the\n            # remaining dimensions.\n            newxyz = np.einsum('...ij,j...->i...', matrix, oldxyz.value)\n\n        newxyz = u.Quantity(newxyz, oldxyz.unit, copy=False)\n        # Handle differentials attached to this representation\n        if self.differentials:\n            # TODO: speed this up going via d.d_xyz.\n            new_diffs = dict(\n                (k, d.from_cartesian(d.to_cartesian().transform(matrix)))\n                for k, d in self.differentials.items())\n        else:\n            new_diffs = None\n\n        return self.__class__(*newxyz, copy=False, 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 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 : representation\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:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return functools.reduce(operator.add,\n                                (getattr(self, component) *\n                                 getattr(other_c, component)\n                                 for component in self.components))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : representation\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:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return self.__class__(self.y * other_c.z - self.z * other_c.y,\n                              self.z * other_c.x - self.x * other_c.z,\n                              self.x * other_c.y - self.y * other_c.x)\n\n\nclass UnitSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` 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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('lon', Longitude),\n                                ('lat', Latitude)])\n    recommended_units = {'lon': u.deg, 'lat': u.deg}\n\n    @classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation\n\n    def __init__(self, lon, lat, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)\n\n    @property\n    def _compatible_differentials(self):\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 OrderedDict(\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 OrderedDict((('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        x = np.cos(self.lat) * np.cos(self.lon)\n        y = np.cos(self.lat) * np.sin(self.lon)\n        z = np.sin(self.lat)\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\n        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, 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\n        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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, r=1.0,\n                                   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 __mul__(self, other):\n        self._raise_if_has_differentials('multiplication')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. * other)\n\n    def __truediv__(self, other):\n        self._raise_if_has_differentials('division')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. / other)\n\n    def __neg__(self):\n        self._raise_if_has_differentials('negation')\n        return self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)\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`\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 : representation\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`\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('distance', u.Quantity)])\n\n    def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, copy=copy, differentials=differentials)\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                                  '{0} instances'.format(self.__class__))\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return OrderedDict((('distance', l),))\n\n    def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {0} 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 _scale_operation(self, op, *args):\n        self._raise_if_has_differentials(op.__name__)\n        return op(self.distance, *args)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity`\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\nclass SphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity`\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`\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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('lon', Longitude),\n                                ('lat', Latitude),\n                                ('distance', u.Quantity)])\n    recommended_units = {'lon': u.deg, 'lat': u.deg}\n    _unit_representation = UnitSphericalRepresentation\n\n    def __init__(self, lon, lat, distance, differentials=None, copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if self._distance.unit.physical_type == 'length':\n            self._distance = self._distance.view(Distance)\n\n    @property\n    def _compatible_differentials(self):\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 OrderedDict(\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 OrderedDict((('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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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=self.distance, copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, 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        x = d * np.cos(self.lat) * np.cos(self.lon)\n        y = d * np.cos(self.lat) * np.sin(self.lon)\n        z = d * np.sin(self.lat)\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        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, distance=r, copy=False)\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\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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('phi', Angle),\n                                ('theta', Angle),\n                                ('r', u.Quantity)])\n    recommended_units = {'phi': u.deg, 'theta': u.deg}\n\n    def __init__(self, phi, theta, r, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        if copy:\n            self._phi = self._phi.wrap_at(360 * u.deg)\n        else:\n            # necessary because the above version of `wrap_at` has to be a copy\n            self._phi.wrap_at(360 * u.deg, inplace=True)\n\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 {0}'.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 OrderedDict(\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 OrderedDict((('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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta)\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 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\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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('rho', u.Quantity),\n                                ('phi', Angle),\n                                ('z', u.Quantity)])\n    recommended_units = {'phi': u.deg}\n\n    def __init__(self, rho, phi, z, 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 OrderedDict(\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 OrderedDict((('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\nclass MetaBaseDifferential(InheritDocstrings, abc.ABCMeta):\n    \"\"\"Set default ``attr_classes`` and component getters on a Differential.\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    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if 'base_representation' not in dct:\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 = OrderedDict([('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(\"Differential class {0} already defined\"\n                             .format(repr_name))\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\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=(\"Component '{0}' of the Differential.\"\n                                      .format(component))))\n\n\nclass BaseDifferential(BaseRepresentationOrDifferential,\n                       metaclass=MetaBaseDifferential):\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 rather than referenced.\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    recommended_units = {}  # subclasses can override\n\n    @classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(\"Differential class {0} is not compatible with the \"\n                            \"base (representation) class {1}\"\n                            .format(cls, 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, 'd_{0}'.format(name), None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n                # Get the si unit without a scale by going via Quantity;\n                # `.si` causes the scale to be included in the value.\n                return str(u.Quantity(1., d_unit).si.unit)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential match! Not \"\n                               \"sure how we got into this state.\")\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        This object as a `CartesianDifferential`\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 : 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        A new differential object that is this class' type.\n        \"\"\"\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``, optional\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            base = base.represent_as(other_class.base_representation)\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 _scale_operation(self, op, *args):\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        \"\"\"\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` 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.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\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 rather than referenced.\n    \"\"\"\n    base_representation = CartesianRepresentation\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 xyz_axis is not None and xyz_axis != 0:\n                d_x = np.rollaxis(d_x, xyz_axis, 0)\n            d_x, d_y, d_z = d_x\n        elif 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        elif ((d_y is None and d_z is not None) or\n              (d_y is not None and d_z is None)):\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {0}\"\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 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        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.\n        \"\"\"\n        return _combine_xyz(self._d_x, self._d_y, self._d_z, xyz_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` 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 rather than referenced.\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, 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    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\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 rather than referenced.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalDifferential\n\n    def __init__(self, d_lon, d_lat, d_distance, 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\nclass BaseSphericalCosLatDifferential(BaseDifferential):\n    \"\"\"Differtials 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` 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 rather than referenced.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n    attr_classes = OrderedDict([('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, 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    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\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 rather than referenced.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalCosLatDifferential\n    attr_classes = OrderedDict([('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, d_distance, 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\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 rather than referenced.\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    @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 rather than referenced.\n    \"\"\"\n    base_representation = PhysicsSphericalRepresentation\n\n    def __init__(self, d_phi, d_theta, d_r, 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\nclass CylindricalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of points in cylindrical coordinates.\n\n    Parameters\n    ----------\n    d_rho : `~astropy.units.Quantity`\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity`\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity`\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied rather than referenced.\n    \"\"\"\n    base_representation = CylindricalRepresentation\n\n    def __init__(self, d_rho, d_phi, d_z, 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"},{"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 rather than referenced.\n    ","endLoc":386,"id":11675,"nodeType":"Class","startLoc":113,"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 rather than referenced.\n    \"\"\"\n\n    # Ensure multiplication/division with ndarray or Quantity doesn't lead to\n    # object arrays.\n    __array_priority__ = 50000\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        attrs = []\n        for component in components:\n            try:\n                attrs.append(args.pop(0) if args else kwargs.pop(component))\n            except KeyError:\n                raise TypeError('__init__() missing 1 required positional '\n                                'argument: {0!r}'.format(component))\n\n        copy = args.pop(0) if args else kwargs.pop('copy', True)\n\n        if args:\n            raise TypeError('unexpected arguments: {0}'.format(args))\n\n        if kwargs:\n            for component in components:\n                if component in kwargs:\n                    raise TypeError(\"__init__() got multiple values for \"\n                                    \"argument {0!r}\".format(component))\n\n            raise TypeError('unexpected keyword arguments: {0}'.format(kwargs))\n\n        # Pass attributes through the required initializing classes.\n        attrs = [self.attr_classes[component](attr, copy=copy)\n                 for component, attr in zip(components, attrs)]\n        try:\n            attrs = np.broadcast_arrays(*attrs, subok=True)\n        except ValueError:\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(\"Input parameters {0} cannot be broadcast\"\n                             .format(c_str))\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 : object of this class\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\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 _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.misc.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        return self.__class__(*[apply_method(getattr(self, component))\n                                for component in self.components], copy=False)\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        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 AttributeError:\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 __div__(self, other):  # pragma: py2\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 = '({0})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr\n\n    def __str__(self):\n        return '{0} {1:s}'.format(_array2string(self._values), self._unitstr)\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.: {0})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{0} ({1}) {2:s}\\n{3}{4}{5}>'.format(\n            self.__class__.__name__, ', '.join(self.components),\n            unitstr, prefixstr, arrstr, diffstr)"},{"col":4,"comment":"null","endLoc":206,"header":"def __new__(cls, reprname, framename, defaultunit='recommended')","id":11676,"name":"__new__","nodeType":"Function","startLoc":204,"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":"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":187,"header":"@classmethod\n    def get_name(cls)","id":11677,"name":"get_name","nodeType":"Function","startLoc":171,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":606,"id":11678,"name":"_default_size","nodeType":"Attribute","startLoc":606,"text":"self._default_size"},{"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 : object of this class\n            A new representation of this class's type.\n        ","endLoc":206,"header":"@classmethod\n    @abc.abstractmethod\n    def from_cartesian(cls, other)","id":11679,"name":"from_cartesian","nodeType":"Function","startLoc":190,"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 : object of this class\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":"Convert the representation to its Cartesian form.\n\n        Note that any differentials get dropped.\n\n        Returns\n        -------\n        cartrepr : `CartesianRepresentation`\n            The representation in Cartesian form.\n        ","endLoc":220,"header":"@abc.abstractmethod\n    def to_cartesian(self)","id":11680,"name":"to_cartesian","nodeType":"Function","startLoc":208,"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\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":"A tuple with the in-order names of the coordinate components.","endLoc":225,"header":"@property\n    def components(self)","id":11682,"name":"components","nodeType":"Function","startLoc":222,"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":"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.misc.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":258,"header":"def _apply(self, method, *args, **kwargs)","id":11683,"name":"_apply","nodeType":"Function","startLoc":227,"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.misc.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        return self.__class__(*[apply_method(getattr(self, component))\n                                for component in self.components], copy=False)"},{"col":4,"comment":"\n        A `dict` of all the attributes of all frame classes in this `TransformGraph`.\n        ","endLoc":86,"header":"@property\n    def frame_attributes(self)","id":11684,"name":"frame_attributes","nodeType":"Function","startLoc":75,"text":"@property\n    def frame_attributes(self):\n        \"\"\"\n        A `dict` of all the attributes of all frame classes in this `TransformGraph`.\n        \"\"\"\n        if self._cached_frame_attributes is None:\n            result = {}\n            for frame_cls in self.frame_set:\n                result.update(frame_cls.frame_attributes)\n            self._cached_frame_attributes = result\n\n        return self._cached_frame_attributes"},{"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 or similar callable\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":131,"header":"def add_transform(self, fromsys, tosys, transform)","id":11685,"name":"add_transform","nodeType":"Function","startLoc":101,"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 or similar callable\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        self._graph[fromsys][tosys] = transform\n        self.invalidate_cache()"},{"col":27,"endLoc":253,"id":11686,"nodeType":"Lambda","startLoc":253,"text":"lambda array: method(array, *args, **kwargs)"},{"attributeType":"MexicanHat1D","col":8,"comment":"null","endLoc":605,"id":11687,"name":"_model","nodeType":"Attribute","startLoc":605,"text":"self._model"},{"col":0,"comment":"\n    raises UnitsError if not a length unit\n    ","endLoc":225,"header":"def _convert_to_and_validate_length_unit(unit, allow_dimensionless=False)","id":11688,"name":"_convert_to_and_validate_length_unit","nodeType":"Function","startLoc":214,"text":"def _convert_to_and_validate_length_unit(unit, allow_dimensionless=False):\n    \"\"\"\n    raises UnitsError if not a length unit\n    \"\"\"\n    try:\n        unit = u.Unit(unit)\n        assert (unit.is_equivalent(u.kpc) or\n                allow_dimensionless and unit == u.dimensionless_unscaled)\n    except (TypeError, AssertionError):\n        raise u.UnitsError('Unit \"{0}\" is not a length type'.format(unit))\n\n    return unit"},{"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":179,"header":"def remove_transform(self, fromsys, tosys, transform)","id":11689,"name":"remove_transform","nodeType":"Function","startLoc":133,"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 b is transform:\n                        del agraph[b]\n                        break\n            else:\n                raise ValueError('Could not find transform {0} in the '\n                                 'graph'.format(transform))\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 {0} to {1} is not '\n                                     '{2}'.format(fromsys, tosys, transform))\n        self.invalidate_cache()"},{"attributeType":"null","col":8,"comment":"null","endLoc":608,"id":11690,"name":"_truncation","nodeType":"Attribute","startLoc":608,"text":"self._truncation"},{"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        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":277,"header":"@property\n    def shape(self)","id":11691,"name":"shape","nodeType":"Function","startLoc":260,"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        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":296,"header":"@shape.setter\n    def shape(self, shape)","id":11692,"name":"shape","nodeType":"Function","startLoc":279,"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 AttributeError:\n                    for val2 in reshaped:\n                        val2.shape = oldshape\n                    raise\n                else:\n                    reshaped.append(val)"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":11694,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":11695,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":16,"text":"__doctest_requires__"},{"col":0,"comment":"","endLoc":6,"header":"distances.py#<anonymous>","id":11696,"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.integrate']}"},{"className":"MexicanHat2DKernel","col":0,"comment":"\n    2D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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 MexicanHat2DKernel\n        mexicanhat_2D_kernel = MexicanHat2DKernel(10)\n        plt.imshow(mexicanhat_2D_kernel, interpolation='none', origin='lower')\n        plt.xlabel('x [pixels]')\n        plt.ylabel('y [pixels]')\n        plt.colorbar()\n        plt.show()\n    ","endLoc":681,"id":11697,"nodeType":"Class","startLoc":611,"text":"class MexicanHat2DKernel(Kernel2D):\n    \"\"\"\n    2D Mexican hat filter kernel.\n\n    The Mexican Hat, or inverted Gaussian-Laplace filter, is a\n    bandpass filter. It smoothes 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    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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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 MexicanHat2DKernel\n        mexicanhat_2D_kernel = MexicanHat2DKernel(10)\n        plt.imshow(mexicanhat_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.MexicanHat2D(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":302,"header":"@abc.abstractmethod\n    def _scale_operation(self, op, *args)","id":11698,"name":"_scale_operation","nodeType":"Function","startLoc":300,"text":"@abc.abstractmethod\n    def _scale_operation(self, op, *args):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":305,"header":"def __mul__(self, other)","id":11699,"name":"__mul__","nodeType":"Function","startLoc":304,"text":"def __mul__(self, other):\n        return self._scale_operation(operator.mul, other)"},{"fileName":"matrix_utilities.py","filePath":"astropy/coordinates","id":11700,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nThis module contains utililies used for constructing rotation matrices.\n\"\"\"\nfrom functools import reduce\nimport numpy as np\n\nfrom .. 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 : convertible to `Angle`\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 : UnitBase, 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 unit is None:\n        unit = u.degree\n\n    angle = Angle(angle, unit=unit)\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(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 : `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"},{"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 classes 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 : number\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":297,"header":"def find_shortest_path(self, fromsys, tosys)","id":11701,"name":"find_shortest_path","nodeType":"Function","startLoc":181,"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 classes 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 : number\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":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 : `Angle`\n        The angle of rotation.\n    axis : array\n        The (normalized) axis of rotation (with last dimension 3).\n    ","endLoc":128,"header":"def angle_axis(matrix)","id":11702,"name":"angle_axis","nodeType":"Function","startLoc":101,"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 : `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"},{"col":4,"comment":"null","endLoc":681,"header":"def __init__(self, width, **kwargs)","id":11703,"name":"__init__","nodeType":"Function","startLoc":676,"text":"def __init__(self, width, **kwargs):\n        amplitude = 1.0 / (np.pi * width ** 4)\n        self._model = models.MexicanHat2D(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":308,"header":"def __rmul__(self, other)","id":11704,"name":"__rmul__","nodeType":"Function","startLoc":307,"text":"def __rmul__(self, other):\n        return self.__mul__(other)"},{"attributeType":"null","col":4,"comment":"null","endLoc":191,"id":11705,"name":"rotation","nodeType":"Attribute","startLoc":191,"text":"rotation"},{"attributeType":"null","col":4,"comment":"null","endLoc":192,"id":11706,"name":"origin","nodeType":"Attribute","startLoc":192,"text":"origin"},{"attributeType":"null","col":4,"comment":"null","endLoc":674,"id":11707,"name":"_is_bool","nodeType":"Attribute","startLoc":674,"text":"_is_bool"},{"col":0,"comment":"","endLoc":6,"header":"matrix_utilities.py#<anonymous>","id":11708,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"\"\"\"\nThis module contains utililies used for constructing rotation matrices.\n\"\"\""},{"attributeType":"null","col":12,"comment":"null","endLoc":205,"id":11709,"name":"newcls","nodeType":"Attribute","startLoc":205,"text":"newcls"},{"attributeType":"null","col":16,"comment":"null","endLoc":204,"id":11710,"name":"origin_frame","nodeType":"Attribute","startLoc":204,"text":"origin_frame"},{"attributeType":"null","col":8,"comment":"null","endLoc":679,"id":11711,"name":"_default_size","nodeType":"Attribute","startLoc":679,"text":"self._default_size"},{"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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, an `~collections.OrderedDict`\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). Finally, classes can also define a\n    ``recommended_units`` dictionary, which maps component names to the units\n    they are best presented to users in (this is used only in representations\n    of coordinates, and may be overridden by frame classes).\n    ","endLoc":942,"id":11712,"nodeType":"Class","startLoc":440,"text":"class BaseRepresentation(BaseRepresentationOrDifferential,\n                         metaclass=MetaBaseRepresentation):\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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n\n    Notes\n    -----\n    All representation classes should subclass this base representation class,\n    and define an ``attr_classes`` attribute, an `~collections.OrderedDict`\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). Finally, classes can also define a\n    ``recommended_units`` dictionary, which maps component names to the units\n    they are best presented to users in (this is used only in representations\n    of coordinates, and may be overridden by frame classes).\n    \"\"\"\n\n    recommended_units = {}  # subclasses can override\n\n    def __init__(self, *args, differentials=None, **kwargs):\n        # Handle any differentials passed in.\n        super().__init__(*args, **kwargs)\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:\n                raise TypeError(\"'differentials' argument must be a \"\n                                \"dictionary-like object\")\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 '{0}', expected \"\n                                     \"unit key = '{1}' but received key = '{2}'\"\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 ({0} vs \"\n                                 \"{1})\".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 '{0}' is not supported when \"\n                            \"differentials are attached to a {1}.\"\n                            .format(op_name, self.__class__.__name__))\n\n    @property\n    def _compatible_differentials(self):\n        return [DIFFERENTIAL_CLASSES[self.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(\"{} has not implemented unit vectors\"\n                                  .format(type(self)))\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(\"{} has not implemented scale factors.\"\n                                  .format(type(self)))\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 set(differential_class.keys()) != set(self.differentials.keys()):\n            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:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {0} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {1}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__))\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\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            # The default is to convert via cartesian coordinates\n            new_rep = other_class.from_cartesian(self.to_cartesian())\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_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`\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        newrepr\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        newrepr\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 _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 _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\n        self._raise_if_has_differentials(op.__name__)\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            return self.__class__(*results)\n        except Exception:\n            return NotImplemented\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` 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 : representation\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 : representation\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 : representation\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : representation\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))"},{"fileName":"angle_utilities.py","filePath":"astropy/coordinates","id":11713,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n# Note that  files generated by lex/yacc not always fully py 2/3 compatible.\n# Hence, the ``clean_parse_tables.py`` tool in the astropy-tools\n# (https://github.com/astropy/astropy-tools) repository should be used to fix\n# this when/if lextab/parsetab files are re-generated.\n\n\"\"\"\nThis module contains utility 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\nfrom warnings import warn\n\nimport numpy as np\n\nfrom .errors import (IllegalHourWarning, IllegalHourError,\n                     IllegalMinuteWarning, IllegalMinuteError,\n                     IllegalSecondWarning, IllegalSecondError)\nfrom ..utils import format_exception\nfrom .. 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\n    This class should not be used directly.  Use `parse_angle`\n    instead.\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.__dict__:\n            _AngleParser._parser, _AngleParser._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 list(simple_unit_names)\n\n    @classmethod\n    def _make_parser(cls):\n        from ..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        )\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_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            '(?:{0})'.format(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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        # Build the lexer\n        lexer = lex.lex(optimize=True, lextab='angle_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        def p_angle(p):\n            '''\n            angle : hms\n                  | dms\n                  | arcsecond\n                  | arcminute\n                  | simple\n            '''\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_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = float(p[1])\n\n        def p_colon(p):\n            '''\n            colon : sign UINT COLON ufloat\n                  | sign UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 5:\n                p[0] = (p[1] * p[2], p[4])\n            elif len(p) == 7:\n                p[0] = (p[1] * p[2], p[4], p[6])\n\n        def p_spaced(p):\n            '''\n            spaced : sign UINT ufloat\n                   | sign UINT UINT ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1] * p[2], p[3])\n            elif len(p) == 5:\n                p[0] = (p[1] * p[2], p[3], p[4])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | sign UFLOAT\n                    | sign UINT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] * p[2]\n\n        def p_hms(p):\n            '''\n            hms : sign UINT HOUR\n                | sign UINT HOUR ufloat\n                | sign UINT HOUR UINT MINUTE\n                | sign UINT HOUR UFLOAT MINUTE\n                | sign UINT HOUR UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.hourangle)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.hourangle)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : sign UINT DEGREE\n                | sign UINT DEGREE ufloat\n                | sign UINT DEGREE UINT MINUTE\n                | sign UINT DEGREE UFLOAT MINUTE\n                | sign UINT DEGREE UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.degree)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.degree)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), 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 = yacc.yacc(debug=False, tabmodule='angle_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser, lexer\n\n    def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._parser.parse(\n                angle, lexer=self._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(\"{0} in angle {1!r}\".format(\n                    str(e), angle))\n            else:\n                raise ValueError(\n                    \"Syntax error parsing angle {0!r}\".format(angle))\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:\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))\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:\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))\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    # If the coordinates are negative, we need to take the absolute value of\n    # the (arc)minutes and (arc)seconds. We need to use np.abs because abs(-0)\n    # is -0.\n    values = (values[0], np.abs(values[1]), np.abs(values[2]))\n\n    if pad:\n        # Check to see if values[0] is negative, using np.copysign to handle -0\n        if np.copysign(1.0, values[0]) == -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 ** -4)\n    else:\n        rounding_thresh = 60.0 - (10.0 ** -precision)\n\n    values = list(values)\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 int(values[1]) >= 60.0:\n        values[1] = 0.0\n        values[0] += 1.0\n    elif fields < 2 and int(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 = '{0:.4f}'.format(abs(values[2]))\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(values[0], int(abs(values[1])), abs(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\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 : `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` 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 : `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"},{"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":552,"header":"def _raise_if_has_differentials(self, op_name)","id":11714,"name":"_raise_if_has_differentials","nodeType":"Function","startLoc":544,"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 '{0}' is not supported when \"\n                            \"differentials are attached to a {1}.\"\n                            .format(op_name, self.__class__.__name__))"},{"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":11715,"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 = \"'hour' was found  to be '{0}', which is not in range (-24, 24).\".format(self.hour)\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"col":4,"comment":"null","endLoc":311,"header":"def __truediv__(self, other)","id":11716,"name":"__truediv__","nodeType":"Function","startLoc":310,"text":"def __truediv__(self, other):\n        return self._scale_operation(operator.truediv, other)"},{"col":4,"comment":"null","endLoc":556,"header":"@property\n    def _compatible_differentials(self)","id":11717,"name":"_compatible_differentials","nodeType":"Function","startLoc":554,"text":"@property\n    def _compatible_differentials(self):\n        return [DIFFERENTIAL_CLASSES[self.get_name()]]"},{"col":4,"comment":"null","endLoc":66,"header":"def __str__(self)","id":11718,"name":"__str__","nodeType":"Function","startLoc":62,"text":"def __str__(self):\n        message = \"'hour' was found  to be '{0}', which is not in range (-24, 24).\".format(self.hour)\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"MexicanHat2D","col":8,"comment":"null","endLoc":678,"id":11719,"name":"_model","nodeType":"Attribute","startLoc":678,"text":"self._model"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":11720,"name":"hour","nodeType":"Attribute","startLoc":59,"text":"self.hour"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":11721,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":60,"text":"self.alternativeactionstr"},{"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":568,"header":"@property\n    def differentials(self)","id":11722,"name":"differentials","nodeType":"Function","startLoc":558,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":681,"id":11723,"name":"_truncation","nodeType":"Attribute","startLoc":681,"text":"self._truncation"},{"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":586,"header":"def unit_vectors(self)","id":11724,"name":"unit_vectors","nodeType":"Function","startLoc":573,"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(\"{} has not implemented unit vectors\"\n                                  .format(type(self)))"},{"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":11725,"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 \"An invalid value for 'hours' was found ('{0}'); must be in the range [0,24).\".format(self.hour)"},{"className":"RangeError","col":0,"comment":"\n    Raised when some part of an angle is out of its valid range.\n    ","endLoc":18,"id":11726,"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":11727,"name":"__str__","nodeType":"Function","startLoc":46,"text":"def __str__(self):\n        return \"An invalid value for 'hours' was found ('{0}'); must be in the range [0,24).\".format(self.hour)"},{"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":601,"header":"def scale_factors(self)","id":11728,"name":"scale_factors","nodeType":"Function","startLoc":588,"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(\"{} has not implemented scale factors.\"\n                                  .format(type(self)))"},{"attributeType":"null","col":8,"comment":"null","endLoc":44,"id":11729,"name":"hour","nodeType":"Attribute","startLoc":44,"text":"self.hour"},{"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":649,"header":"def _re_represent_differentials(self, new_rep, differential_class)","id":11730,"name":"_re_represent_differentials","nodeType":"Function","startLoc":603,"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 set(differential_class.keys()) != set(self.differentials.keys()):\n            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:\n                if (differential_class[k] not in\n                        new_rep._compatible_differentials):\n                    raise TypeError(\"Desired differential class {0} is not \"\n                                    \"compatible with the desired \"\n                                    \"representation class {1}\"\n                                    .format(differential_class[k],\n                                            new_rep.__class__))\n                else:\n                    raise\n\n        return new_diffs"},{"className":"AiryDisk2DKernel","col":0,"comment":"\n    2D Airy disk kernel.\n\n    This kernel models the diffraction pattern of a circular aperture. This\n    kernel is normalized to a peak value of 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\n    Ring2DKernel, 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 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":744,"id":11731,"nodeType":"Class","startLoc":684,"text":"class AiryDisk2DKernel(Kernel2D):\n    \"\"\"\n    2D Airy disk kernel.\n\n    This kernel models the diffraction pattern of a circular aperture. This\n    kernel is normalized to a peak value of 1.\n\n    Parameters\n    ----------\n    radius : float\n        The radius of the Airy disk kernel (radius of the first zero).\n    x_size : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\n    Ring2DKernel, 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 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"},{"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":11732,"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 = \"'minute' was found  to be '{0}', which is not in range [0,60).\".format(self.minute)\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"col":4,"comment":"null","endLoc":744,"header":"def __init__(self, radius, **kwargs)","id":11733,"name":"__init__","nodeType":"Function","startLoc":739,"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":4,"comment":"null","endLoc":109,"header":"def __str__(self)","id":11734,"name":"__str__","nodeType":"Function","startLoc":105,"text":"def __str__(self):\n        message = \"'minute' was found  to be '{0}', which is not in range [0,60).\".format(self.minute)\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"null","col":8,"comment":"null","endLoc":103,"id":11735,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":103,"text":"self.alternativeactionstr"},{"col":4,"comment":"null","endLoc":314,"header":"def __div__(self, other)","id":11736,"name":"__div__","nodeType":"Function","startLoc":313,"text":"def __div__(self, other):  # pragma: py2\n        return self._scale_operation(operator.truediv, other)"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":11737,"name":"minute","nodeType":"Attribute","startLoc":102,"text":"self.minute"},{"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":11738,"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 \"An invalid value for 'minute' was found ('{0}'); should be in the range [0,60).\".format(self.minute)"},{"col":4,"comment":"null","endLoc":90,"header":"def __str__(self)","id":11739,"name":"__str__","nodeType":"Function","startLoc":89,"text":"def __str__(self):\n        return \"An invalid value for 'minute' was found ('{0}'); should be in the range [0,60).\".format(self.minute)"},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":11740,"name":"minute","nodeType":"Attribute","startLoc":87,"text":"self.minute"},{"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":11741,"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 = \"'second' was found  to be '{0}', which is not in range [0,60).\".format(self.second)\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":11742,"name":"__str__","nodeType":"Function","startLoc":147,"text":"def __str__(self):\n        message = \"'second' was found  to be '{0}', which is not in range [0,60).\".format(self.second)\n        if self.alternativeactionstr is not None:\n            message += ' ' + self.alternativeactionstr\n        return message"},{"attributeType":"null","col":8,"comment":"null","endLoc":145,"id":11743,"name":"alternativeactionstr","nodeType":"Attribute","startLoc":145,"text":"self.alternativeactionstr"},{"attributeType":"null","col":8,"comment":"null","endLoc":144,"id":11744,"name":"second","nodeType":"Attribute","startLoc":144,"text":"self.second"},{"col":4,"comment":"null","endLoc":317,"header":"def __neg__(self)","id":11745,"name":"__neg__","nodeType":"Function","startLoc":316,"text":"def __neg__(self):\n        return self._scale_operation(operator.neg)"},{"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":11746,"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 \"An invalid value for 'second' was found ('{0}'); should be in the range [0,60).\".format(self.second)"},{"col":4,"comment":"null","endLoc":132,"header":"def __str__(self)","id":11747,"name":"__str__","nodeType":"Function","startLoc":131,"text":"def __str__(self):\n        return \"An invalid value for 'second' was found ('{0}'); should be in the range [0,60).\".format(self.second)"},{"attributeType":"null","col":8,"comment":"null","endLoc":129,"id":11748,"name":"second","nodeType":"Attribute","startLoc":129,"text":"self.second"},{"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        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":682,"header":"def represent_as(self, other_class, differential_class=None)","id":11749,"name":"represent_as","nodeType":"Function","startLoc":651,"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\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            # The default is to convert via cartesian coordinates\n            new_rep = other_class.from_cartesian(self.to_cartesian())\n\n            new_rep._differentials = self._re_represent_differentials(\n                new_rep, differential_class)\n\n            return new_rep"},{"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\n    This class should not be used directly.  Use `parse_angle`\n    instead.\n    ","endLoc":273,"id":11750,"nodeType":"Class","startLoc":27,"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\n    This class should not be used directly.  Use `parse_angle`\n    instead.\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.__dict__:\n            _AngleParser._parser, _AngleParser._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 list(simple_unit_names)\n\n    @classmethod\n    def _make_parser(cls):\n        from ..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        )\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_SIMPLE_UNIT(t):\n            t.value = u.Unit(t.value)\n            return t\n        t_SIMPLE_UNIT.__doc__ = '|'.join(\n            '(?:{0})'.format(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                \"Invalid character at col {0}\".format(t.lexpos))\n\n        # Build the lexer\n        lexer = lex.lex(optimize=True, lextab='angle_lextab',\n                        outputdir=os.path.dirname(__file__))\n\n        def p_angle(p):\n            '''\n            angle : hms\n                  | dms\n                  | arcsecond\n                  | arcminute\n                  | simple\n            '''\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_ufloat(p):\n            '''\n            ufloat : UFLOAT\n                   | UINT\n            '''\n            p[0] = float(p[1])\n\n        def p_colon(p):\n            '''\n            colon : sign UINT COLON ufloat\n                  | sign UINT COLON UINT COLON ufloat\n            '''\n            if len(p) == 5:\n                p[0] = (p[1] * p[2], p[4])\n            elif len(p) == 7:\n                p[0] = (p[1] * p[2], p[4], p[6])\n\n        def p_spaced(p):\n            '''\n            spaced : sign UINT ufloat\n                   | sign UINT UINT ufloat\n            '''\n            if len(p) == 4:\n                p[0] = (p[1] * p[2], p[3])\n            elif len(p) == 5:\n                p[0] = (p[1] * p[2], p[3], p[4])\n\n        def p_generic(p):\n            '''\n            generic : colon\n                    | spaced\n                    | sign UFLOAT\n                    | sign UINT\n            '''\n            if len(p) == 2:\n                p[0] = p[1]\n            else:\n                p[0] = p[1] * p[2]\n\n        def p_hms(p):\n            '''\n            hms : sign UINT HOUR\n                | sign UINT HOUR ufloat\n                | sign UINT HOUR UINT MINUTE\n                | sign UINT HOUR UFLOAT MINUTE\n                | sign UINT HOUR UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.hourangle)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.hourangle)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), u.hourangle)\n\n        def p_dms(p):\n            '''\n            dms : sign UINT DEGREE\n                | sign UINT DEGREE ufloat\n                | sign UINT DEGREE UINT MINUTE\n                | sign UINT DEGREE UFLOAT MINUTE\n                | sign UINT DEGREE UINT MINUTE ufloat\n                | sign 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) == 4:\n                p[0] = (p[1] * p[2], u.degree)\n            elif len(p) in (5, 6):\n                p[0] = ((p[1] * p[2], p[4]), u.degree)\n            elif len(p) in (7, 8):\n                p[0] = ((p[1] * p[2], p[4], p[6]), 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 = yacc.yacc(debug=False, tabmodule='angle_parsetab',\n                           outputdir=os.path.dirname(__file__),\n                           write_tables=True)\n\n        return parser, lexer\n\n    def parse(self, angle, unit, debug=False):\n        try:\n            found_angle, found_unit = self._parser.parse(\n                angle, lexer=self._lexer, debug=debug)\n        except ValueError as e:\n            if str(e):\n                raise ValueError(\"{0} in angle {1!r}\".format(\n                    str(e), angle))\n            else:\n                raise ValueError(\n                    \"Syntax error parsing angle {0!r}\".format(angle))\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":0,"comment":"\n    Convert hour, minute, second to a float degrees value.\n    ","endLoc":429,"header":"def hms_to_degrees(h, m, s)","id":11751,"name":"hms_to_degrees","nodeType":"Function","startLoc":424,"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."},{"col":0,"comment":"\n    Convert hour, minute, second to a float radians value.\n    ","endLoc":437,"header":"def hms_to_radians(h, m, s)","id":11752,"name":"hms_to_radians","nodeType":"Function","startLoc":432,"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":"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        newrepr\n            A shallow copy of this representation, without any differentials.\n            If no differentials were present, no copy is made.\n        ","endLoc":731,"header":"def without_differentials(self)","id":11753,"name":"without_differentials","nodeType":"Function","startLoc":717,"text":"def without_differentials(self):\n        \"\"\"Return a copy of the representation without attached differentials.\n\n        Returns\n        -------\n        newrepr\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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":737,"id":11754,"name":"_is_bool","nodeType":"Attribute","startLoc":737,"text":"_is_bool"},{"col":4,"comment":"null","endLoc":321,"header":"def __pos__(self)","id":11755,"name":"__pos__","nodeType":"Function","startLoc":320,"text":"def __pos__(self):\n        return self.copy()"},{"attributeType":"null","col":8,"comment":"null","endLoc":741,"id":11756,"name":"_default_size","nodeType":"Attribute","startLoc":741,"text":"self._default_size"},{"col":0,"comment":"\n    Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)``\n    tuple.\n    ","endLoc":446,"header":"def hms_to_dms(h, m, s)","id":11757,"name":"hms_to_dms","nodeType":"Function","startLoc":440,"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":0,"comment":"\n    Convert any parseable hour value into a float value.\n    ","endLoc":454,"header":"def hours_to_decimal(h)","id":11758,"name":"hours_to_decimal","nodeType":"Function","startLoc":449,"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":"AiryDisk2D","col":8,"comment":"null","endLoc":740,"id":11759,"name":"_model","nodeType":"Attribute","startLoc":740,"text":"self._model"},{"attributeType":"None","col":8,"comment":"null","endLoc":744,"id":11760,"name":"_truncation","nodeType":"Attribute","startLoc":744,"text":"self._truncation"},{"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`\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        newrepr\n            A copy of this representation, but with the ``differentials`` as\n            its differentials.\n        ","endLoc":715,"header":"def with_differentials(self, differentials)","id":11761,"name":"with_differentials","nodeType":"Function","startLoc":684,"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`\n            The differentials for the new representation to have.\n\n        Returns\n        -------\n        newrepr\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"},{"className":"Moffat2DKernel","col":0,"comment":"\n    2D Moffat kernel.\n\n    This kernel is a typical model for a seeing limited PSF.\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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\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":810,"id":11762,"nodeType":"Class","startLoc":747,"text":"class Moffat2DKernel(Kernel2D):\n    \"\"\"\n    2D Moffat kernel.\n\n    This kernel is a typical model for a seeing limited PSF.\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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * radius.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * radius.\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, MexicanHat2DKernel,\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        self._model = models.Moffat2D((gamma - 1.0) / (np.pi * alpha * alpha),\n                                      0, 0, gamma, alpha)\n        fwhm = 2.0 * alpha * (2.0 ** (1.0 / gamma) - 1.0) ** 0.5\n        self._default_size = _round_up_to_odd_integer(4.0 * fwhm)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"col":4,"comment":"null","endLoc":810,"header":"def __init__(self, gamma, alpha, **kwargs)","id":11763,"name":"__init__","nodeType":"Function","startLoc":803,"text":"def __init__(self, gamma, alpha, **kwargs):\n        self._model = models.Moffat2D((gamma - 1.0) / (np.pi * alpha * alpha),\n                                      0, 0, gamma, alpha)\n        fwhm = 2.0 * alpha * (2.0 ** (1.0 / gamma) - 1.0) ** 0.5\n        self._default_size = _round_up_to_odd_integer(4.0 * fwhm)\n        super().__init__(**kwargs)\n        self.normalize()\n        self._truncation = None"},{"col":4,"comment":" Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ode : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n        ","endLoc":630,"header":"def Ode(self, z)","id":11764,"name":"Ode","nodeType":"Function","startLoc":606,"text":"def Ode(self, z):\n        \"\"\" Return the density parameter for dark energy at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ode : ndarray, or float if input scalar\n          The density of non-relativistic matter relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            # Common case worth checking\n            if self._Ode0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Ode0 == 0:\n                return 0.0\n\n        return self._Ode0 * self.de_density_scale(z) * self.inv_efunc(z) ** 2"},{"col":0,"comment":"\n    Convert an angle in Hours to Radians.\n    ","endLoc":462,"header":"def hours_to_radians(h)","id":11765,"name":"hours_to_radians","nodeType":"Function","startLoc":457,"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)"},{"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":742,"header":"@classmethod\n    def from_representation(cls, representation)","id":11766,"name":"from_representation","nodeType":"Function","startLoc":733,"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)"},{"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":770,"header":"def _apply(self, method, *args, **kwargs)","id":11767,"name":"_apply","nodeType":"Function","startLoc":744,"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":0,"comment":"\n    Convert an angle in Radians to Degrees.\n    ","endLoc":484,"header":"def radians_to_degrees(r)","id":11768,"name":"radians_to_degrees","nodeType":"Function","startLoc":480,"text":"def radians_to_degrees(r):\n    \"\"\"\n    Convert an angle in Radians to Degrees.\n    \"\"\"\n    return u.radian.to(u.degree, r)"},{"col":0,"comment":"\n    Convert an angle in Radians to Hours.\n    ","endLoc":491,"header":"def radians_to_hours(r)","id":11769,"name":"radians_to_hours","nodeType":"Function","startLoc":487,"text":"def radians_to_hours(r):\n    \"\"\"\n    Convert an angle in Radians to Hours.\n    \"\"\"\n    return u.radian.to(u.hourangle, r)"},{"col":0,"comment":"\n    Convert an angle in Radians to an ``(hour, minute, second)`` tuple.\n    ","endLoc":500,"header":"def radians_to_hms(r)","id":11770,"name":"radians_to_hms","nodeType":"Function","startLoc":494,"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":510,"header":"def radians_to_dms(r)","id":11771,"name":"radians_to_dms","nodeType":"Function","startLoc":503,"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)"},{"col":4,"comment":" Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ogamma : ndarray, or float if input scalar\n          The energy density of photons relative to the critical\n          density at each redshift.\n        ","endLoc":649,"header":"def Ogamma(self, z)","id":11772,"name":"Ogamma","nodeType":"Function","startLoc":632,"text":"def Ogamma(self, z):\n        \"\"\" Return the density parameter for photons at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Ogamma : ndarray, or float if input scalar\n          The energy density of photons relative to the critical\n          density at each redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Ogamma0 * (1. + z) ** 4 * self.inv_efunc(z) ** 2"},{"col":0,"comment":"","endLoc":13,"header":"angle_utilities.py#<anonymous>","id":11773,"name":"<anonymous>","nodeType":"Function","startLoc":9,"text":"\"\"\"\nThis module contains utility functions that are for internal use in\nastropy.coordinates.angles. Mainly they are conversions from one format\nof data to another.\n\"\"\""},{"attributeType":"null","col":4,"comment":"null","endLoc":801,"id":11774,"name":"_is_bool","nodeType":"Attribute","startLoc":801,"text":"_is_bool"},{"col":4,"comment":" Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Onu : ndarray, or float if input scalar\n          The energy density of neutrinos relative to the critical\n          density at each redshift.  Note that this includes their\n          kinetic energy (if they have mass), so it is not equal to\n          the commonly used :math:`\\sum \\frac{m_{\\nu}}{94 eV}`,\n          which does not include kinetic energy.\n        ","endLoc":677,"header":"def Onu(self, z)","id":11775,"name":"Onu","nodeType":"Function","startLoc":651,"text":"def Onu(self, z):\n        \"\"\" Return the density parameter for neutrinos at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Onu : ndarray, or float if input scalar\n          The energy density of neutrinos relative to the critical\n          density at each redshift.  Note that this includes their\n          kinetic energy (if they have mass), so it is not equal to\n          the commonly used :math:`\\\\sum \\\\frac{m_{\\\\nu}}{94 eV}`,\n          which does not include kinetic energy.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n            if self._Onu0 == 0:\n                return np.zeros(np.asanyarray(z).shape)\n        else:\n            if self._Onu0 == 0:\n                return 0.0\n\n        return self.Ogamma(z) * self.nu_relative_density(z)"},{"fileName":"funcs.py","filePath":"astropy/coordinates","id":11776,"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\n\nimport numpy as np\n\nfrom .. import units as u\nfrom ..constants import c\nfrom .. import _erfa as erfa\nfrom ..io import ascii\nfrom ..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           'concatenate', 'get_constellation']\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`\n        The latitude in radians\n    lon : `~astropy.units.Quantity`\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`\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity`\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[..., 0, :]\n    earth_v = earth_pv_bary[..., 1, :]\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\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 inhomogenous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate objects\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    return SkyCoord(coords)\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 object\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    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('Could not find constellation for coordinates {0}'.format(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"},{"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":800,"header":"def _scale_operation(self, op, *args)","id":11777,"name":"_scale_operation","nodeType":"Function","startLoc":772,"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\n        self._raise_if_has_differentials(op.__name__)\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            return self.__class__(*results)\n        except Exception:\n            return NotImplemented"},{"attributeType":"null","col":8,"comment":"null","endLoc":807,"id":11778,"name":"_default_size","nodeType":"Attribute","startLoc":807,"text":"self._default_size"},{"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-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <http://aa.usno.navy.mil/publications/docs/Circular_179.php>`_)\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    {params}\n\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    ","endLoc":53,"id":11779,"nodeType":"Class","startLoc":11,"text":"class 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-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <http://aa.usno.navy.mil/publications/docs/Circular_179.php>`_)\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    {params}\n\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    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)"},{"attributeType":"Moffat2D","col":8,"comment":"null","endLoc":804,"id":11780,"name":"_model","nodeType":"Attribute","startLoc":804,"text":"self._model"},{"attributeType":"null","col":4,"comment":"null","endLoc":49,"id":11781,"name":"obstime","nodeType":"Attribute","startLoc":49,"text":"obstime"},{"col":4,"comment":"null","endLoc":327,"header":"@abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False)","id":11782,"name":"_combine_operation","nodeType":"Function","startLoc":325,"text":"@abc.abstractmethod\n    def _combine_operation(self, op, other, reverse=False):\n        raise NotImplementedError()"},{"attributeType":"None","col":8,"comment":"null","endLoc":810,"id":11783,"name":"_truncation","nodeType":"Attribute","startLoc":810,"text":"self._truncation"},{"col":4,"comment":"null","endLoc":330,"header":"def __add__(self, other)","id":11784,"name":"__add__","nodeType":"Function","startLoc":329,"text":"def __add__(self, other):\n        return self._combine_operation(operator.add, other)"},{"attributeType":"null","col":4,"comment":"null","endLoc":50,"id":11785,"name":"obsgeoloc","nodeType":"Attribute","startLoc":50,"text":"obsgeoloc"},{"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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":874,"id":11786,"nodeType":"Class","startLoc":813,"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\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":874,"header":"def __init__(self, model, **kwargs)","id":11787,"name":"__init__","nodeType":"Function","startLoc":869,"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)"},{"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` 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":823,"header":"def _combine_operation(self, op, other, reverse=False)","id":11788,"name":"_combine_operation","nodeType":"Function","startLoc":802,"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` 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":" Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity`\n          The temperature of the CMB in K.\n        ","endLoc":695,"header":"def Tcmb(self, z)","id":11789,"name":"Tcmb","nodeType":"Function","startLoc":679,"text":"def Tcmb(self, z):\n        \"\"\" Return the CMB temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tcmb : `~astropy.units.Quantity`\n          The temperature of the CMB in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tcmb0 * (1. + z)"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":11790,"name":"obsgeovel","nodeType":"Attribute","startLoc":52,"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\n    {params}\n\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 Earth,\n        oriented the same as BCRS/ICRS. Either [0, 0, 0], `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, 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 Earth,\n        oriented the same as BCRS/ICRS. Either 0, `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity units.\n        Defaults to [0, 0, 0], meaning \"true\" Geocentric.\n    ","endLoc":96,"id":11791,"nodeType":"Class","startLoc":62,"text":"class 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    {params}\n\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 Earth,\n        oriented the same as BCRS/ICRS. Either [0, 0, 0], `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, 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 Earth,\n        oriented the same as BCRS/ICRS. Either 0, `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity units.\n        Defaults to [0, 0, 0], meaning \"true\" Geocentric.\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)"},{"col":4,"comment":" Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity`\n          The temperature of the cosmic neutrino background in K.\n        ","endLoc":713,"header":"def Tnu(self, z)","id":11792,"name":"Tnu","nodeType":"Function","startLoc":697,"text":"def Tnu(self, z):\n        \"\"\" Return the neutrino temperature at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        Tnu : `~astropy.units.Quantity`\n          The temperature of the cosmic neutrino background in K.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        return self._Tnu0 * (1. + z)"},{"attributeType":"null","col":4,"comment":"null","endLoc":866,"id":11793,"name":"_separable","nodeType":"Attribute","startLoc":866,"text":"_separable"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":11794,"name":"equinox","nodeType":"Attribute","startLoc":93,"text":"equinox"},{"attributeType":"null","col":4,"comment":"null","endLoc":867,"id":11795,"name":"_is_bool","nodeType":"Attribute","startLoc":867,"text":"_is_bool"},{"col":4,"comment":" Internal convenience function for w(z) integral.","endLoc":793,"header":"def _w_integrand(self, ln1pz)","id":11796,"name":"_w_integrand","nodeType":"Function","startLoc":785,"text":"def _w_integrand(self, ln1pz):\n        \"\"\" Internal convenience function for w(z) integral.\"\"\"\n\n        # See Linder 2003, PRL 90, 91301 eq (5)\n        # Assumes scalar input, since this should only be called\n        # inside an integral\n\n        z = exp(ln1pz) - 1.0\n        return 1.0 + self.w(z)"},{"attributeType":"null","col":4,"comment":"null","endLoc":94,"id":11797,"name":"obstime","nodeType":"Attribute","startLoc":94,"text":"obstime"},{"attributeType":"Fittable1DModel","col":12,"comment":"null","endLoc":871,"id":11798,"name":"_model","nodeType":"Attribute","startLoc":871,"text":"self._model"},{"attributeType":"null","col":4,"comment":"null","endLoc":95,"id":11799,"name":"obsgeoloc","nodeType":"Attribute","startLoc":95,"text":"obsgeoloc"},{"col":4,"comment":"null","endLoc":1133,"header":"def _combine_operation(self, op, other, reverse=False)","id":11800,"name":"_combine_operation","nodeType":"Function","startLoc":1121,"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))"},{"attributeType":"null","col":4,"comment":"null","endLoc":96,"id":11801,"name":"obsgeovel","nodeType":"Attribute","startLoc":96,"text":"obsgeovel"},{"col":4,"comment":" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\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":877,"header":"def efunc(self, z)","id":11802,"name":"efunc","nodeType":"Function","startLoc":845,"text":"def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * self.de_density_scale(z))"},{"className":"SphericalRepresentation","col":0,"comment":"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity`\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`\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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    ","endLoc":1645,"id":11803,"nodeType":"Class","startLoc":1497,"text":"class SphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points in 3D spherical coordinates.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity`\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`\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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('lon', Longitude),\n                                ('lat', Latitude),\n                                ('distance', u.Quantity)])\n    recommended_units = {'lon': u.deg, 'lat': u.deg}\n    _unit_representation = UnitSphericalRepresentation\n\n    def __init__(self, lon, lat, distance, differentials=None, copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if self._distance.unit.physical_type == 'length':\n            self._distance = self._distance.view(Distance)\n\n    @property\n    def _compatible_differentials(self):\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 OrderedDict(\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 OrderedDict((('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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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=self.distance, copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, 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        x = d * np.cos(self.lat) * np.cos(self.lon)\n        y = d * np.cos(self.lat) * np.sin(self.lon)\n        z = d * np.sin(self.lat)\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        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, distance=r, copy=False)\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)"},{"col":4,"comment":"null","endLoc":1539,"header":"def __init__(self, lon, lat, distance, differentials=None, copy=True)","id":11804,"name":"__init__","nodeType":"Function","startLoc":1535,"text":"def __init__(self, lon, lat, distance, differentials=None, copy=True):\n        super().__init__(lon, lat, distance, copy=copy,\n                         differentials=differentials)\n        if self._distance.unit.physical_type == 'length':\n            self._distance = self._distance.view(Distance)"},{"col":4,"comment":"null","endLoc":333,"header":"def __radd__(self, other)","id":11805,"name":"__radd__","nodeType":"Function","startLoc":332,"text":"def __radd__(self, other):\n        return self._combine_operation(operator.add, other, reverse=True)"},{"col":4,"comment":"null","endLoc":336,"header":"def __sub__(self, other)","id":11806,"name":"__sub__","nodeType":"Function","startLoc":335,"text":"def __sub__(self, other):\n        return self._combine_operation(operator.sub, other)"},{"col":4,"comment":"null","endLoc":339,"header":"def __rsub__(self, other)","id":11807,"name":"__rsub__","nodeType":"Function","startLoc":338,"text":"def __rsub__(self, other):\n        return self._combine_operation(operator.sub, other, reverse=True)"},{"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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":942,"id":11808,"nodeType":"Class","startLoc":877,"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 : odd int, optional\n        Size in x direction of the kernel array. Default = 8 * width.\n    y_size : odd int, optional\n        Size in y direction of the kernel array. Default = 8 * width.\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":"null","endLoc":942,"header":"def __init__(self, model, **kwargs)","id":11809,"name":"__init__","nodeType":"Function","startLoc":936,"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":"Turn the coordinates into a record array with the coordinate values.\n\n        The record array fields will have the component names.\n        ","endLoc":352,"header":"@property\n    def _values(self)","id":11810,"name":"_values","nodeType":"Function","startLoc":342,"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":"\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":348,"header":"def get_transform(self, fromsys, tosys)","id":11811,"name":"get_transform","nodeType":"Function","startLoc":299,"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]"},{"col":4,"comment":"Return a dictionary with the units of the coordinate components.","endLoc":358,"header":"@property\n    def _units(self)","id":11812,"name":"_units","nodeType":"Function","startLoc":354,"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":369,"header":"@property\n    def _unitstr(self)","id":11813,"name":"_unitstr","nodeType":"Function","startLoc":360,"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 = '({0})'.format(\n                ', '.join([self._units[component].to_string()\n                           for component in self.components]))\n        return unitstr"},{"attributeType":"null","col":4,"comment":"null","endLoc":933,"id":11814,"name":"_is_bool","nodeType":"Attribute","startLoc":933,"text":"_is_bool"},{"attributeType":"null","col":4,"comment":"null","endLoc":934,"id":11815,"name":"_separable","nodeType":"Attribute","startLoc":934,"text":"_separable"},{"col":4,"comment":"null","endLoc":842,"header":"@BaseRepresentationOrDifferential.shape.setter\n    def shape(self, shape)","id":11816,"name":"shape","nodeType":"Function","startLoc":826,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":937,"id":11817,"name":"_separable","nodeType":"Attribute","startLoc":937,"text":"self._separable"},{"attributeType":"Fittable2DModel","col":12,"comment":"null","endLoc":939,"id":11818,"name":"_model","nodeType":"Attribute","startLoc":939,"text":"self._model"},{"col":4,"comment":"null","endLoc":372,"header":"def __str__(self)","id":11819,"name":"__str__","nodeType":"Function","startLoc":371,"text":"def __str__(self):\n        return '{0} {1:s}'.format(_array2string(self._values), self._unitstr)"},{"col":4,"comment":"null","endLoc":386,"header":"def __repr__(self)","id":11820,"name":"__repr__","nodeType":"Function","startLoc":374,"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.: {0})'.format(\n                ', '.join([repr(key) for key in self.differentials.keys()]))\n\n        unitstr = ('in ' + self._unitstr) if self._unitstr else '[dimensionless]'\n        return '<{0} ({1}) {2:s}\\n{3}{4}{5}>'.format(\n            self.__class__.__name__, ', '.join(self.components),\n            unitstr, prefixstr, arrstr, diffstr)"},{"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 : representation\n            Vector mean, in the same representation as that of the input.\n        ","endLoc":880,"header":"def mean(self, *args, **kwargs)","id":11821,"name":"mean","nodeType":"Function","startLoc":863,"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 : representation\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))"},{"className":"PSFKernel","col":0,"comment":"\n    Initialize filter kernel from astropy PSF instance.\n    ","endLoc":952,"id":11822,"nodeType":"Class","startLoc":945,"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":" Integrand of the lookback time.\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        Eqn 30 from Hogg 1999.\n        ","endLoc":925,"header":"def _lookback_time_integrand_scalar(self, z)","id":11823,"name":"_lookback_time_integrand_scalar","nodeType":"Function","startLoc":906,"text":"def _lookback_time_integrand_scalar(self, z):\n        \"\"\" Integrand of the lookback time.\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        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return self._inv_efunc_scalar(z, *args) / (1.0 + z)"},{"col":4,"comment":"null","endLoc":952,"header":"def __init__(self)","id":11824,"name":"__init__","nodeType":"Function","startLoc":951,"text":"def __init__(self):\n        raise NotImplementedError('Not yet implemented')"},{"attributeType":"null","col":4,"comment":"null","endLoc":949,"id":11825,"name":"_separable","nodeType":"Attribute","startLoc":949,"text":"_separable"},{"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    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":1026,"id":11826,"nodeType":"Class","startLoc":955,"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    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        odd = all(axes_size % 2 != 0 for axes_size in self.shape)\n        if not odd:\n            raise KernelSizeError(\"Kernel size must be odd in all axes.\")\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"},{"attributeType":"null","col":4,"comment":"null","endLoc":127,"id":11827,"name":"__array_priority__","nodeType":"Attribute","startLoc":127,"text":"__array_priority__"},{"className":"MetaBaseRepresentation","col":0,"comment":"null","endLoc":437,"id":11828,"nodeType":"Class","startLoc":411,"text":"class MetaBaseRepresentation(InheritDocstrings, abc.ABCMeta):\n    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if 'attr_classes' not in dct:\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n\n        if repr_name in REPRESENTATION_CLASSES:\n            raise ValueError(\"Representation class {0} already defined\"\n                             .format(repr_name))\n\n        REPRESENTATION_CLASSES[repr_name] = cls\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=(\"The '{0}' component of the points(s).\"\n                                      .format(component))))"},{"col":4,"comment":"null","endLoc":995,"header":"def __init__(self, array)","id":11829,"name":"__init__","nodeType":"Function","startLoc":993,"text":"def __init__(self, array):\n        self.array = array\n        super().__init__(self._array)"},{"col":4,"comment":"null","endLoc":437,"header":"def __init__(cls, name, bases, dct)","id":11830,"name":"__init__","nodeType":"Function","startLoc":412,"text":"def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Register representation name (except for BaseRepresentation)\n        if cls.__name__ == 'BaseRepresentation':\n            return\n\n        if 'attr_classes' not in dct:\n            raise NotImplementedError('Representations must have an '\n                                      '\"attr_classes\" class attribute.')\n\n        repr_name = cls.get_name()\n\n        if repr_name in REPRESENTATION_CLASSES:\n            raise ValueError(\"Representation class {0} already defined\"\n                             .format(repr_name))\n\n        REPRESENTATION_CLASSES[repr_name] = cls\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=(\"The '{0}' component of the points(s).\"\n                                      .format(component))))"},{"col":4,"comment":"\n        Filter kernel array.\n        ","endLoc":1002,"header":"@property\n    def array(self)","id":11831,"name":"array","nodeType":"Function","startLoc":997,"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":1026,"header":"@array.setter\n    def array(self, array)","id":11832,"name":"array","nodeType":"Function","startLoc":1004,"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        odd = all(axes_size % 2 != 0 for axes_size in self.shape)\n        if not odd:\n            raise KernelSizeError(\"Kernel size must be odd in all axes.\")\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":1266,"header":"def __init__(self, transforms, fromsys, tosys, priority=1,\n                 register_graph=None, collapse_static_mats=True)","id":11833,"name":"__init__","nodeType":"Function","startLoc":1258,"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)"},{"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":404,"header":"def _make_getter(component)","id":11834,"name":"_make_getter","nodeType":"Function","startLoc":389,"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":"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":1146,"header":"def mean(self, *args, **kwargs)","id":11835,"name":"mean","nodeType":"Function","startLoc":1135,"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)"},{"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 : `~astropy.units.Unit` or str\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 rather than referenced.\n    ","endLoc":1211,"id":11836,"nodeType":"Class","startLoc":945,"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 : `~astropy.units.Unit` or str\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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('x', u.Quantity),\n                                ('y', u.Quantity),\n                                ('z', u.Quantity)])\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 xyz_axis is not None and xyz_axis != 0:\n                x = np.rollaxis(x, xyz_axis, 0)\n            x, y, z = x\n        elif 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        elif (y is None and z is not None) or (y is not None and z is None):\n            raise ValueError(\"x, y, and z are required to instantiate {0}\"\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.physical_type ==\n                self._y.unit.physical_type == self._z.unit.physical_type):\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 OrderedDict(\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 OrderedDict((('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``.\n        \"\"\"\n        return _combine_xyz(self._x, self._y, self._z, xyz_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 : `~numpy.ndarray`\n            A 3x3 transformation matrix, such as a rotation matrix.\n\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\n        # Avoid doing gratuitous np.array for things that look like arrays.\n        try:\n            matrix_shape = matrix.shape\n        except AttributeError:\n            matrix = np.array(matrix)\n            matrix_shape = matrix.shape\n\n        if matrix_shape[-2:] != (3, 3):\n            raise ValueError(\"tried to do matrix multiplication with an array \"\n                             \"that doesn't end in 3x3\")\n\n        # TODO: since this is likely to be a widely used function in coordinate\n        # transforms, it should be optimized (for example in Cython).\n\n        # Get xyz once since it's an expensive operation\n        oldxyz = self.xyz\n        # Note that neither dot nor einsum handles Quantity properly, so we use\n        # the arrays and put the unit back in the end.\n        if self.isscalar and not matrix_shape[:-2]:\n            # a fast path for scalar coordinates.\n            newxyz = matrix.dot(oldxyz.value)\n        else:\n            # Matrix multiply all pmat items and coordinates, broadcasting the\n            # remaining dimensions.\n            newxyz = np.einsum('...ij,j...->i...', matrix, oldxyz.value)\n\n        newxyz = u.Quantity(newxyz, oldxyz.unit, copy=False)\n        # Handle differentials attached to this representation\n        if self.differentials:\n            # TODO: speed this up going via d.d_xyz.\n            new_diffs = dict(\n                (k, d.from_cartesian(d.to_cartesian().transform(matrix)))\n                for k, d in self.differentials.items())\n        else:\n            new_diffs = None\n\n        return self.__class__(*newxyz, copy=False, 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 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 : representation\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:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return functools.reduce(operator.add,\n                                (getattr(self, component) *\n                                 getattr(other_c, component)\n                                 for component in self.components))\n\n    def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : representation\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:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return self.__class__(self.y * other_c.z - self.z * other_c.y,\n                              self.z * other_c.x - self.x * other_c.z,\n                              self.x * other_c.y - self.y * other_c.x)"},{"col":4,"comment":"null","endLoc":1013,"header":"def unit_vectors(self)","id":11837,"name":"unit_vectors","nodeType":"Function","startLoc":1007,"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 OrderedDict(\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":"null","col":12,"comment":"null","endLoc":1010,"id":11838,"name":"_array","nodeType":"Attribute","startLoc":1010,"text":"self._array"},{"attributeType":"null","col":8,"comment":"null","endLoc":1024,"id":11839,"name":"_is_bool","nodeType":"Attribute","startLoc":1024,"text":"self._is_bool"},{"col":4,"comment":"null","endLoc":639,"header":"def __init__(self, fromsys, tosys, priority=1, register_graph=None)","id":11840,"name":"__init__","nodeType":"Function","startLoc":615,"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.get_frame_attr_names():\n                if from_nm in tosys.get_frame_attr_names():\n                    overlap.append(from_nm)"},{"attributeType":"null","col":8,"comment":"null","endLoc":994,"id":11841,"name":"array","nodeType":"Attribute","startLoc":994,"text":"self.array"},{"attributeType":"null","col":8,"comment":"null","endLoc":1026,"id":11842,"name":"_truncation","nodeType":"Attribute","startLoc":1026,"text":"self._truncation"},{"col":4,"comment":" Integrand of the lookback time.\n\n        Parameters\n        ----------\n        z : float or array-like\n          Input redshift.\n\n        Returns\n        -------\n        I : float or array\n          The integrand for the lookback time\n\n        References\n        ----------\n        Eqn 30 from Hogg 1999.\n        ","endLoc":950,"header":"def lookback_time_integrand(self, z)","id":11843,"name":"lookback_time_integrand","nodeType":"Function","startLoc":927,"text":"def lookback_time_integrand(self, z):\n        \"\"\" Integrand of the lookback time.\n\n        Parameters\n        ----------\n        z : float or array-like\n          Input redshift.\n\n        Returns\n        -------\n        I : float or array\n          The integrand for the lookback time\n\n        References\n        ----------\n        Eqn 30 from Hogg 1999.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n\n        return self.inv_efunc(z) / zp1"},{"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 : representation\n            Vector sum, in the same representation as that of the input.\n        ","endLoc":899,"header":"def sum(self, *args, **kwargs)","id":11844,"name":"sum","nodeType":"Function","startLoc":882,"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 : representation\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))"},{"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 : a TransformGraph object\n            The graph to register this transformation with.\n        ","endLoc":651,"header":"def register(self, graph)","id":11845,"name":"register","nodeType":"Function","startLoc":641,"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 : a TransformGraph object\n            The graph to register this transformation with.\n        \"\"\"\n        graph.add_transform(self.fromsys, self.tosys, self)"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":11846,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":11847,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"kernels.py#<anonymous>","id":11848,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"__all__ = ['Gaussian1DKernel', 'Gaussian2DKernel', 'CustomKernel',\n           'Box1DKernel', 'Box2DKernel', 'Tophat2DKernel',\n           'Trapezoid1DKernel', 'MexicanHat1DKernel', 'MexicanHat2DKernel',\n           'AiryDisk2DKernel', 'Moffat2DKernel', 'Model1DKernel',\n           'Model2DKernel', 'TrapezoidDisk2DKernel', 'Ring2DKernel']"},{"col":4,"comment":"null","endLoc":1545,"header":"@property\n    def _compatible_differentials(self)","id":11849,"name":"_compatible_differentials","nodeType":"Function","startLoc":1541,"text":"@property\n    def _compatible_differentials(self):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]"},{"col":4,"comment":"\n        The longitude of the point(s).\n        ","endLoc":1552,"header":"@property\n    def lon(self)","id":11850,"name":"lon","nodeType":"Function","startLoc":1547,"text":"@property\n    def lon(self):\n        \"\"\"\n        The longitude of the point(s).\n        \"\"\"\n        return self._lon"},{"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":1159,"header":"def sum(self, *args, **kwargs)","id":11851,"name":"sum","nodeType":"Function","startLoc":1148,"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)"},{"col":4,"comment":"\n        The latitude of the point(s).\n        ","endLoc":1559,"header":"@property\n    def lat(self)","id":11852,"name":"lat","nodeType":"Function","startLoc":1554,"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":1566,"header":"@property\n    def distance(self)","id":11853,"name":"distance","nodeType":"Function","startLoc":1561,"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":1576,"header":"def unit_vectors(self)","id":11854,"name":"unit_vectors","nodeType":"Function","startLoc":1568,"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 OrderedDict(\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))))"},{"col":4,"comment":" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float\n          Input redshift.\n\n        Returns\n        -------\n        X : float\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        ","endLoc":971,"header":"def _abs_distance_integrand_scalar(self, z)","id":11855,"name":"_abs_distance_integrand_scalar","nodeType":"Function","startLoc":952,"text":"def _abs_distance_integrand_scalar(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float\n          Input redshift.\n\n        Returns\n        -------\n        X : float\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        args = self._inv_efunc_scalar_args\n        return (1.0 + z) ** 2 * self._inv_efunc_scalar(z, *args)"},{"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":921,"header":"def dot(self, other)","id":11856,"name":"dot","nodeType":"Function","startLoc":901,"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)"},{"col":4,"comment":" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float or array\n          Input redshift.\n\n        Returns\n        -------\n        X : float or array\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        ","endLoc":995,"header":"def abs_distance_integrand(self, z)","id":11857,"name":"abs_distance_integrand","nodeType":"Function","startLoc":973,"text":"def abs_distance_integrand(self, z):\n        \"\"\" Integrand of the absorption distance.\n\n        Parameters\n        ----------\n        z : float or array\n          Input redshift.\n\n        Returns\n        -------\n        X : float or array\n          The integrand for the absorption distance\n\n        References\n        ----------\n        See Hogg 1999 section 11.\n        \"\"\"\n\n        if isiterable(z):\n            zp1 = 1.0 + np.asarray(z)\n        else:\n            zp1 = 1. + z\n        return zp1 ** 2 * self.inv_efunc(z)"},{"col":4,"comment":"null","endLoc":1017,"header":"def scale_factors(self)","id":11858,"name":"scale_factors","nodeType":"Function","startLoc":1015,"text":"def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return OrderedDict((('x', l), ('y', l), ('z', l)))"},{"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``.\n        ","endLoc":1033,"header":"def get_xyz(self, xyz_axis=0)","id":11859,"name":"get_xyz","nodeType":"Function","startLoc":1019,"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``.\n        \"\"\"\n        return _combine_xyz(self._x, self._y, self._z, xyz_axis=xyz_axis)"},{"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 : representation\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":1187,"header":"def dot(self, other)","id":11860,"name":"dot","nodeType":"Function","startLoc":1161,"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 : representation\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:\n            raise TypeError(\"cannot only take dot product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return functools.reduce(operator.add,\n                                (getattr(self, component) *\n                                 getattr(other_c, component)\n                                 for component in self.components))"},{"col":0,"comment":"\n    Combine components ``x``, ``y``, ``z`` into a single Quantity array.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity`\n        The individual x, y, and z components.\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``, i.e., using the default of ``0``,\n        the shape will be ``(3,) + x.shape``.\n    ","endLoc":110,"header":"def _combine_xyz(x, y, z, xyz_axis=0)","id":11861,"name":"_combine_xyz","nodeType":"Function","startLoc":72,"text":"def _combine_xyz(x, y, z, xyz_axis=0):\n    \"\"\"\n    Combine components ``x``, ``y``, ``z`` into a single Quantity array.\n\n    Parameters\n    ----------\n    x, y, z : `~astropy.units.Quantity`\n        The individual x, y, and z components.\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``, i.e., using the default of ``0``,\n        the shape will be ``(3,) + x.shape``.\n    \"\"\"\n    # Add new axis in x, y, z so one can concatenate them around it.\n    # NOTE: just use np.stack once our minimum numpy version is 1.10.\n    result_ndim = x.ndim + 1\n    if not -result_ndim <= xyz_axis < result_ndim:\n        raise IndexError('xyz_axis {0} out of bounds [-{1}, {1})'\n                         .format(xyz_axis, result_ndim))\n\n    if xyz_axis < 0:\n        xyz_axis += result_ndim\n\n    # Get x, y, z to the same units (this is very fast for identical units)\n    # since np.concatenate cannot deal with quantity.\n    cls = x.__class__\n    y = cls(y, x.unit, copy=False)\n    z = cls(z, x.unit, copy=False)\n\n    sh = x.shape\n    sh = sh[:xyz_axis] + (1,) + sh[xyz_axis:]\n    xyz_value = np.concatenate([c.reshape(sh).value for c in (x, y, z)],\n                               axis=xyz_axis)\n    return cls(xyz_value, unit=x.unit, copy=False)"},{"col":4,"comment":" Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity`\n          Hubble parameter at each input redshift.\n        ","endLoc":1011,"header":"def H(self, z)","id":11862,"name":"H","nodeType":"Function","startLoc":997,"text":"def H(self, z):\n        \"\"\" Hubble parameter (km/s/Mpc) at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        H : `~astropy.units.Quantity`\n          Hubble parameter at each input redshift.\n        \"\"\"\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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        a : ndarray, or float if input scalar\n          Scale factor at each input redshift.\n        ","endLoc":1032,"header":"def scale_factor(self, z)","id":11863,"name":"scale_factor","nodeType":"Function","startLoc":1013,"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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        a : ndarray, or float if input scalar\n          Scale factor at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return 1. / (1. + z)"},{"fileName":"solar_system.py","filePath":"astropy/coordinates","id":11864,"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\nfrom collections import OrderedDict\n\nimport numpy as np\n\nfrom .sky_coordinate import SkyCoord\nfrom ..utils.data import download_file\nfrom ..utils.decorators import classproperty\nfrom ..utils.state import ScienceState\nfrom ..utils import indent\nfrom .. import units as u\nfrom .. import _erfa as erfa\nfrom ..constants import c as speed_of_light\nfrom .representation import CartesianRepresentation\nfrom .orbital_elements import calc_moon\nfrom .builtin_frames import GCRS, ICRS\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 = OrderedDict(\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 = OrderedDict(\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_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.python.org/pypi/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    >>> 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' or 'de432s': 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    - `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]_.  Older versions of the JPL\n    ephemerides (such as the widely used de200) can be used via their URL [3]_.\n\n    .. [1] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] http://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    if value.lower() == 'jpl':\n        value = DEFAULT_JPL_EPHEMERIS\n\n    if value.lower() in ('de430', 'de432s'):\n        value = ('http://naif.jpl.nasa.gov/pub/naif/generic_kernels'\n                 '/spk/planets/{:s}.bsp'.format(value.lower()))\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 URL'.format(value))\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.python.org/pypi/jplephem)\")\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    No velocity can be calculated with the built-in ephemeris for the Moon.\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\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n        if ephemeris 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            if get_velocity:\n                raise KeyError(\"the Moon's velocity cannot be calculated with \"\n                               \"the '{0}' ephemeris.\".format(ephemeris))\n            return calc_moon(time).cartesian\n\n        else:\n            sun_pv_bary = 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(\"{0}'s position and velocity cannot be \"\n                                   \"calculated with the '{1}' ephemeris.\"\n                                   .format(body, ephemeris))\n                body_pv_helio = erfa.plan94(jd1, jd2, body_index)\n                body_pv_bary = body_pv_helio + sun_pv_bary\n\n        body_pos_bary = CartesianRepresentation(\n            body_pv_bary[..., 0, :], unit=u.au, xyz_axis=-1, copy=False)\n        if get_velocity:\n            body_vel_bary = CartesianRepresentation(\n                body_pv_bary[..., 1, :], 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(\"{0}'s position cannot be calculated with \"\n                               \"the {1} 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\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 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\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    The velocity cannot be calculated for the Moon.  To just get the position,\n    use :func:`~astropy.coordinates.get_body_barycentric`.\n\n    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris)\n\n\nget_body_barycentric_posvel.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\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 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\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    \"\"\"\n    return _get_body_barycentric_posvel(body, time, ephemeris,\n                                        get_velocity=False)\n\n\nget_body_barycentric.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\n\ndef _get_apparent_body_position(body, time, ephemeris):\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\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n    \"\"\"\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n    # builtin ephemeris and moon is a special case, with no need to account for\n    # light travel time, since this is already included in the Meeus algorithm\n    # used.\n    if ephemeris == 'builtin' and body.lower() == 'moon':\n        return get_body_barycentric(body, time, ephemeris)\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    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\n_get_apparent_body_position.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\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 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    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    \"\"\"\n    if location is None:\n        location = time.location\n\n    cartrep = _get_apparent_body_position(body, time, ephemeris)\n    icrs = ICRS(cartrep)\n    if location is not None:\n        obsgeoloc, obsgeovel = location.get_gcrs_posvel(time)\n        gcrs = icrs.transform_to(GCRS(obstime=time,\n                                      obsgeoloc=obsgeoloc,\n                                      obsgeovel=obsgeovel))\n    else:\n        gcrs = icrs.transform_to(GCRS(obstime=time))\n    return SkyCoord(gcrs)\n\n\nget_body.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\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    \"\"\"\n\n    return get_body('moon', time, location=location, ephemeris=ephemeris)\n\n\nget_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\n\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    jd1, jd2 = get_jd12(skycoord.obstime, 'tt')\n    _, _, _, _, _, _, _, rbpn = erfa.pn00a(jd1, jd2)\n    return SkyCoord(skycoord.frame.realize_frame(\n        skycoord.cartesian.transform(rbpn)))\n"},{"col":4,"comment":" Lookback time in Gyr to redshift ``z``.\n\n        The lookback time is the difference between the age of the\n        Universe now and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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":1057,"header":"def lookback_time(self, z)","id":11865,"name":"lookback_time","nodeType":"Function","startLoc":1034,"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\n        Universe now and the age at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar, 0, red)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)"},{"col":12,"endLoc":1056,"id":11866,"nodeType":"Lambda","startLoc":1056,"text":"lambda red: quad(self._lookback_time_integrand_scalar, 0, red)[0]"},{"col":0,"comment":" Helper function to vectorize functions on array inputs","endLoc":2821,"header":"def vectorize_if_needed(func, *x)","id":11867,"name":"vectorize_if_needed","nodeType":"Function","startLoc":2816,"text":"def vectorize_if_needed(func, *x):\n    \"\"\" Helper function to vectorize functions on array inputs\"\"\"\n    if any(map(isiterable, x)):\n        return np.vectorize(func)(*x)\n    else:\n        return func(*x)"},{"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 : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Lookback distance in Mpc\n        ","endLoc":1076,"header":"def lookback_distance(self, z)","id":11868,"name":"lookback_distance","nodeType":"Function","startLoc":1059,"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 : array-like\n          Input redshifts.  Must be 1D or scalar\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Lookback distance in Mpc\n        \"\"\"\n        return (self.lookback_time(z) * const.c).to(u.Mpc)"},{"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' or 'de432s': 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    - `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]_.  Older versions of the JPL\n    ephemerides (such as the widely used de200) can be used via their URL [3]_.\n\n    .. [1] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/a_old_versions/\n    ","endLoc":141,"id":11869,"nodeType":"Class","startLoc":76,"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' or 'de432s': 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    - `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]_.  Older versions of the JPL\n    ephemerides (such as the widely used de200) can be used via their URL [3]_.\n\n    .. [1] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de430-de431.txt\n    .. [2] http://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/aareadme_de432s.txt\n    .. [3] http://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())"},{"col":4,"comment":"null","endLoc":1039,"header":"@classmethod\n    def from_cartesian(cls, other)","id":11870,"name":"from_cartesian","nodeType":"Function","startLoc":1037,"text":"@classmethod\n    def from_cartesian(cls, other):\n        return other"},{"col":4,"comment":"null","endLoc":1042,"header":"def to_cartesian(self)","id":11871,"name":"to_cartesian","nodeType":"Function","startLoc":1041,"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 : `~numpy.ndarray`\n            A 3x3 transformation matrix, such as a rotation matrix.\n\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":1119,"header":"def transform(self, matrix)","id":11872,"name":"transform","nodeType":"Function","startLoc":1044,"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 : `~numpy.ndarray`\n            A 3x3 transformation matrix, such as a rotation matrix.\n\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\n        # Avoid doing gratuitous np.array for things that look like arrays.\n        try:\n            matrix_shape = matrix.shape\n        except AttributeError:\n            matrix = np.array(matrix)\n            matrix_shape = matrix.shape\n\n        if matrix_shape[-2:] != (3, 3):\n            raise ValueError(\"tried to do matrix multiplication with an array \"\n                             \"that doesn't end in 3x3\")\n\n        # TODO: since this is likely to be a widely used function in coordinate\n        # transforms, it should be optimized (for example in Cython).\n\n        # Get xyz once since it's an expensive operation\n        oldxyz = self.xyz\n        # Note that neither dot nor einsum handles Quantity properly, so we use\n        # the arrays and put the unit back in the end.\n        if self.isscalar and not matrix_shape[:-2]:\n            # a fast path for scalar coordinates.\n            newxyz = matrix.dot(oldxyz.value)\n        else:\n            # Matrix multiply all pmat items and coordinates, broadcasting the\n            # remaining dimensions.\n            newxyz = np.einsum('...ij,j...->i...', matrix, oldxyz.value)\n\n        newxyz = u.Quantity(newxyz, oldxyz.unit, copy=False)\n        # Handle differentials attached to this representation\n        if self.differentials:\n            # TODO: speed this up going via d.d_xyz.\n            new_diffs = dict(\n                (k, d.from_cartesian(d.to_cartesian().transform(matrix)))\n                for k, d in self.differentials.items())\n        else:\n            new_diffs = None\n\n        return self.__class__(*newxyz, copy=False, differentials=new_diffs)"},{"col":4,"comment":"null","endLoc":113,"header":"@classmethod\n    def validate(cls, value)","id":11873,"name":"validate","nodeType":"Function","startLoc":106,"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":" Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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":1099,"header":"def age(self, z)","id":11874,"name":"age","nodeType":"Function","startLoc":1078,"text":"def age(self, z):\n        \"\"\" Age of the universe in Gyr at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        t : `~astropy.units.Quantity`\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\n        from scipy.integrate import quad\n        f = lambda red: quad(self._lookback_time_integrand_scalar,\n                             red, np.inf)[0]\n        return self._hubble_time * vectorize_if_needed(f, z)"},{"col":12,"endLoc":1098,"id":11875,"nodeType":"Lambda","startLoc":1097,"text":"lambda red: quad(self._lookback_time_integrand_scalar,\n                             red, np.inf)[0]"},{"col":4,"comment":" Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        rho : `~astropy.units.Quantity`\n          Critical density in g/cm^3 at each input redshift.\n        ","endLoc":1115,"header":"def critical_density(self, z)","id":11876,"name":"critical_density","nodeType":"Function","startLoc":1101,"text":"def critical_density(self, z):\n        \"\"\" Critical density in grams per cubic cm at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\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"},{"col":4,"comment":" Comoving line-of-sight distance in Mpc at a given\n        redshift.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc to each input redshift.\n        ","endLoc":1136,"header":"def comoving_distance(self, z)","id":11877,"name":"comoving_distance","nodeType":"Function","startLoc":1117,"text":"def comoving_distance(self, z):\n        \"\"\" Comoving line-of-sight distance in Mpc at a given\n        redshift.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc to each input redshift.\n        \"\"\"\n\n        return self._comoving_distance_z1z2(0, z)"},{"col":4,"comment":" Comoving line-of-sight distance in Mpc between objects at\n        redshifts z1 and z2.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc between each input redshift.\n        ","endLoc":1160,"header":"def _comoving_distance_z1z2(self, z1, z2)","id":11878,"name":"_comoving_distance_z1z2","nodeType":"Function","startLoc":1138,"text":"def _comoving_distance_z1z2(self, z1, z2):\n        \"\"\" Comoving line-of-sight distance in Mpc between objects at\n        redshifts z1 and z2.\n\n        The comoving distance along the line-of-sight between two\n        objects remains constant with time for objects in the Hubble\n        flow.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving distance in Mpc between each input redshift.\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda z1, z2: quad(self._inv_efunc_scalar, z1, z2,\n                             args=self._inv_efunc_scalar_args)[0]\n        return self._hubble_distance * vectorize_if_needed(f, z1, z2)"},{"col":12,"endLoc":1159,"id":11879,"nodeType":"Lambda","startLoc":1158,"text":"lambda z1, z2: quad(self._inv_efunc_scalar, z1, z2,\n                             args=self._inv_efunc_scalar_args)[0]"},{"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\n        the same as the comoving distance if omega_k is zero (as in\n        the current concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity also called the 'proper motion distance' in some\n        texts.\n        ","endLoc":1186,"header":"def comoving_transverse_distance(self, z)","id":11880,"name":"comoving_transverse_distance","nodeType":"Function","startLoc":1162,"text":"def comoving_transverse_distance(self, z):\n        \"\"\" 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\n        the same as the comoving distance if omega_k is zero (as in\n        the current concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc at each input redshift.\n\n        Notes\n        -----\n        This quantity also called the 'proper motion distance' in some\n        texts.\n        \"\"\"\n\n        return self._comoving_transverse_distance_z1z2(0, z)"},{"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 : representation\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : representation\n            With vectors perpendicular to both ``self`` and ``other``, in the\n            same type of representation as ``self``.\n        ","endLoc":942,"header":"def cross(self, other)","id":11881,"name":"cross","nodeType":"Function","startLoc":923,"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 : representation\n            The representation to take the cross product with.\n\n        Returns\n        -------\n        cross_product : representation\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":"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift\n        ``z2`` as seen from redshift ``z1`` corresponding to an\n        angular separation of 1 radian. This is the same as the\n        comoving distance if omega_k is zero (as in the current\n        concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in\n        some texts.\n\n        ","endLoc":1223,"header":"def _comoving_transverse_distance_z1z2(self, z1, z2)","id":11882,"name":"_comoving_transverse_distance_z1z2","nodeType":"Function","startLoc":1188,"text":"def _comoving_transverse_distance_z1z2(self, z1, z2):\n        \"\"\"Comoving transverse distance in Mpc between two redshifts.\n\n        This value is the transverse comoving distance at redshift\n        ``z2`` as seen from redshift ``z1`` corresponding to an\n        angular separation of 1 radian. This is the same as the\n        comoving distance if omega_k is zero (as in the current\n        concordance lambda CDM model).\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Comoving transverse distance in Mpc between input redshift.\n\n        Notes\n        -----\n        This quantity is also called the 'proper motion distance' in\n        some texts.\n\n        \"\"\"\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":4,"comment":"\n        Combines together sequences of `StaticMatrixTransform`s into a single\n        transform and returns it.\n        ","endLoc":1285,"header":"def _combine_statics(self, transforms)","id":11883,"name":"_combine_statics","nodeType":"Function","startLoc":1268,"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 = np.dot(lasttrans.matrix, currtrans.matrix)\n                newtrans[-1] = StaticMatrixTransform(combinedmat,\n                                                     lasttrans.fromsys,\n                                                     currtrans.tosys)\n            else:\n                newtrans.append(currtrans)\n        return newtrans"},{"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``.\n\n        Weinberg, 1972, pp 421-424; Weedman, 1986, pp 65-67; Peebles,\n        1993, pp 325-327.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Angular diameter distance in Mpc at each input redshift.\n        ","endLoc":1249,"header":"def angular_diameter_distance(self, z)","id":11884,"name":"angular_diameter_distance","nodeType":"Function","startLoc":1225,"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``.\n\n        Weinberg, 1972, pp 421-424; Weedman, 1986, pp 65-67; Peebles,\n        1993, pp 325-327.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          Angular diameter distance in Mpc at each input redshift.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self.comoving_transverse_distance(z) / (1. + z)"},{"col":4,"comment":"null","endLoc":1171,"header":"def __init__(self, matrix, fromsys, tosys, priority=1, register_graph=None)","id":11885,"name":"__init__","nodeType":"Function","startLoc":1162,"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)"},{"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        coordcls\n            The coordinate class corresponding to the ``name`` or `None` if\n            no such class exists.\n        ","endLoc":366,"header":"def lookup_name(self, name)","id":11886,"name":"lookup_name","nodeType":"Function","startLoc":350,"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        coordcls\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":" Luminosity distance in Mpc at redshift ``z``.\n\n        This is the distance to use when converting between the\n        bolometric flux from an object at redshift ``z`` and its\n        bolometric luminosity.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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        Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        ","endLoc":1280,"header":"def luminosity_distance(self, z)","id":11887,"name":"luminosity_distance","nodeType":"Function","startLoc":1251,"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\n        bolometric flux from an object at redshift ``z`` and its\n        bolometric luminosity.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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        Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return (1. + z) * self.comoving_transverse_distance(z)"},{"col":4,"comment":"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : representation\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":1211,"header":"def cross(self, other)","id":11888,"name":"cross","nodeType":"Function","startLoc":1189,"text":"def cross(self, other):\n        \"\"\"Cross product of two representations.\n\n        Parameters\n        ----------\n        other : representation\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:\n            raise TypeError(\"cannot only take cross product with another \"\n                            \"representation, not a {0} instance.\"\n                            .format(type(other)))\n        return self.__class__(self.y * other_c.z - self.z * other_c.y,\n                              self.z * other_c.x - self.x * other_c.z,\n                              self.x * other_c.y - self.y * other_c.x)"},{"col":4,"comment":"null","endLoc":1584,"header":"def scale_factors(self, omit_coslat=False)","id":11889,"name":"scale_factors","nodeType":"Function","startLoc":1578,"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 OrderedDict((('lon', sf_lon),\n                            ('lat', sf_lat),\n                            ('distance', sf_distance)))"},{"col":4,"comment":" Angular diameter distance between objects at 2 redshifts.\n        Useful for gravitational lensing.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts. z2 must be large than z1.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`, shape (N,) or single if input scalar\n          The angular diameter distance between each input redshift\n          pair.\n\n        ","endLoc":1301,"header":"def angular_diameter_distance_z1z2(self, z1, z2)","id":11890,"name":"angular_diameter_distance_z1z2","nodeType":"Function","startLoc":1282,"text":"def angular_diameter_distance_z1z2(self, z1, z2):\n        \"\"\" Angular diameter distance between objects at 2 redshifts.\n        Useful for gravitational lensing.\n\n        Parameters\n        ----------\n        z1, z2 : array-like, shape (N,)\n          Input redshifts. z2 must be large than z1.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`, shape (N,) or single if input scalar\n          The angular diameter distance between each input redshift\n          pair.\n\n        \"\"\"\n\n        z1 = np.asanyarray(z1)\n        z2 = np.asanyarray(z2)\n        return self._comoving_transverse_distance_z1z2(z1, z2) / (1. + z2)"},{"col":4,"comment":"null","endLoc":1598,"header":"def represent_as(self, other_class, differential_class=None)","id":11891,"name":"represent_as","nodeType":"Function","startLoc":1586,"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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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=self.distance, copy=False)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.lon, lat=self.lat, copy=False)\n\n        return super().represent_as(other_class, differential_class)"},{"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":378,"header":"def get_names(self)","id":11892,"name":"get_names","nodeType":"Function","startLoc":368,"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":"\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":487,"header":"def to_dot_graph(self, priorities=True, addnodes=[], savefn=None,\n                     savelayout='plain', saveformat=None, color_edges=True)","id":11893,"name":"to_dot_graph","nodeType":"Function","startLoc":380,"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([(v, k) for k, v in self._cached_names.items()])\n        for n in nodes:\n            if n in invclsaliases:\n                nodenames.append('{0} [shape=oval label=\"{0}\\\\n`{1}`\"]'.format(n.__name__, invclsaliases[n]))\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('; '.join(nodenames) + ';')\n        for enm1, enm2, weights, color in edgenames:\n            labelstr_fmt = '[ {0} {1} ]'\n\n            if priorities:\n                priority_part = 'label = \"{0}\"'.format(weights)\n            else:\n                priority_part = ''\n\n            color_part = 'color = \"{0}\"'.format(color)\n\n            labelstr = labelstr_fmt.format(priority_part, color_part)\n            lines.append('{0} -> {1}{2};'.format(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":" Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some\n        cross section of absorption and number density intersecting a\n        sightline per unit redshift path.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : float or ndarray\n          Absorption distance (dimensionless) at each input redshift.\n\n        References\n        ----------\n        Hogg 1999 Section 11. (astro-ph/9905116)\n        Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        ","endLoc":1328,"header":"def absorption_distance(self, z)","id":11894,"name":"absorption_distance","nodeType":"Function","startLoc":1303,"text":"def absorption_distance(self, z):\n        \"\"\" Absorption distance at redshift ``z``.\n\n        This is used to calculate the number of objects with some\n        cross section of absorption and number density intersecting a\n        sightline per unit redshift path.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : float or ndarray\n          Absorption distance (dimensionless) at each input redshift.\n\n        References\n        ----------\n        Hogg 1999 Section 11. (astro-ph/9905116)\n        Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B\n        \"\"\"\n\n        from scipy.integrate import quad\n        f = lambda red: quad(self._abs_distance_integrand_scalar, 0, red)[0]\n        return vectorize_if_needed(f, z)"},{"col":12,"endLoc":1327,"id":11895,"nodeType":"Lambda","startLoc":1327,"text":"lambda red: quad(self._abs_distance_integrand_scalar, 0, red)[0]"},{"col":4,"comment":" Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude -\n        absolute magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity`\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":1356,"header":"def distmod(self, z)","id":11896,"name":"distmod","nodeType":"Function","startLoc":1330,"text":"def distmod(self, z):\n        \"\"\" Distance modulus at redshift ``z``.\n\n        The distance modulus is defined as the (apparent magnitude -\n        absolute magnitude) for an object at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        distmod : `~astropy.units.Quantity`\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\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":4,"comment":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":1616,"header":"def to_cartesian(self)","id":11897,"name":"to_cartesian","nodeType":"Function","startLoc":1600,"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        x = d * np.cos(self.lat) * np.cos(self.lon)\n        y = d * np.cos(self.lat) * np.sin(self.lon)\n        z = d * np.sin(self.lat)\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":1631,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":11898,"name":"from_cartesian","nodeType":"Function","startLoc":1618,"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        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, distance=r, copy=False)"},{"col":4,"comment":" Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less\n        than ``z``. For the case of omega_k = 0 it is a sphere of radius\n        `comoving_distance` but it is less intuitive\n        if omega_k is not 0.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n          Comoving volume in :math:`Mpc^3` at each input redshift.\n        ","endLoc":1390,"header":"def comoving_volume(self, z)","id":11899,"name":"comoving_volume","nodeType":"Function","startLoc":1358,"text":"def comoving_volume(self, z):\n        \"\"\" Comoving volume in cubic Mpc at redshift ``z``.\n\n        This is the volume of the universe encompassed by redshifts less\n        than ``z``. For the case of omega_k = 0 it is a sphere of radius\n        `comoving_distance` but it is less intuitive\n        if omega_k is not 0.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        V : `~astropy.units.Quantity`\n          Comoving volume in :math:`Mpc^3` at each input redshift.\n        \"\"\"\n\n        Ok0 = self._Ok0\n        if Ok0 == 0:\n            return 4. / 3. * 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. * pi * dh ** 3 / (2. * 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":4,"comment":"null","endLoc":127,"header":"@classmethod\n    def get_kernel(cls, value)","id":11900,"name":"get_kernel","nodeType":"Function","startLoc":115,"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":131,"header":"@classproperty\n    def kernel(cls)","id":11901,"name":"kernel","nodeType":"Function","startLoc":129,"text":"@classproperty\n    def kernel(cls):\n        return cls.get_kernel(cls._value)"},{"col":4,"comment":"null","endLoc":141,"header":"@classproperty\n    def bodies(cls)","id":11902,"name":"bodies","nodeType":"Function","startLoc":133,"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":4,"comment":"null","endLoc":476,"id":11903,"name":"recommended_units","nodeType":"Attribute","startLoc":476,"text":"recommended_units"},{"attributeType":"null","col":8,"comment":"null","endLoc":481,"id":11904,"name":"_differentials","nodeType":"Attribute","startLoc":481,"text":"self._differentials"},{"className":"UnitSphericalRepresentation","col":0,"comment":"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` 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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    ","endLoc":1415,"id":11905,"nodeType":"Class","startLoc":1214,"text":"class UnitSphericalRepresentation(BaseRepresentation):\n    \"\"\"\n    Representation of points on a unit sphere.\n\n    Parameters\n    ----------\n    lon, lat : `~astropy.units.Quantity` 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, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('lon', Longitude),\n                                ('lat', Latitude)])\n    recommended_units = {'lon': u.deg, 'lat': u.deg}\n\n    @classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation\n\n    def __init__(self, lon, lat, differentials=None, copy=True):\n        super().__init__(lon, lat, differentials=differentials, copy=copy)\n\n    @property\n    def _compatible_differentials(self):\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 OrderedDict(\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 OrderedDict((('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        x = np.cos(self.lat) * np.cos(self.lon)\n        y = np.cos(self.lat) * np.sin(self.lon)\n        z = np.sin(self.lat)\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\n        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, 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\n        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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, r=1.0,\n                                   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 __mul__(self, other):\n        self._raise_if_has_differentials('multiplication')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. * other)\n\n    def __truediv__(self, other):\n        self._raise_if_has_differentials('division')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. / other)\n\n    def __neg__(self):\n        self._raise_if_has_differentials('negation')\n        return self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)\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`\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 : representation\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":"null","endLoc":1247,"header":"@classproperty\n    def _dimensional_representation(cls)","id":11906,"name":"_dimensional_representation","nodeType":"Function","startLoc":1245,"text":"@classproperty\n    def _dimensional_representation(cls):\n        return SphericalRepresentation"},{"col":4,"comment":"null","endLoc":1256,"header":"@property\n    def _compatible_differentials(self)","id":11907,"name":"_compatible_differentials","nodeType":"Function","startLoc":1252,"text":"@property\n    def _compatible_differentials(self):\n        return [UnitSphericalDifferential, UnitSphericalCosLatDifferential,\n                SphericalDifferential, SphericalCosLatDifferential,\n                RadialDifferential]"},{"col":4,"comment":"\n        The longitude of the point(s).\n        ","endLoc":1265,"header":"@property\n    def lon(self)","id":11908,"name":"lon","nodeType":"Function","startLoc":1260,"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":1272,"header":"@property\n    def lat(self)","id":11909,"name":"lat","nodeType":"Function","startLoc":1267,"text":"@property\n    def lat(self):\n        \"\"\"\n        The latitude of the point(s).\n        \"\"\"\n        return self._lat"},{"col":4,"comment":"null","endLoc":1280,"header":"def unit_vectors(self)","id":11910,"name":"unit_vectors","nodeType":"Function","startLoc":1274,"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 OrderedDict(\n            (('lon', CartesianRepresentation(-sinlon, coslon, 0., copy=False)),\n             ('lat', CartesianRepresentation(-sinlat*coslon, -sinlat*sinlon,\n                                             coslat, copy=False))))"},{"attributeType":"null","col":4,"comment":"null","endLoc":103,"id":11911,"name":"_value","nodeType":"Attribute","startLoc":103,"text":"_value"},{"attributeType":"None","col":4,"comment":"null","endLoc":104,"id":11912,"name":"_kernel","nodeType":"Attribute","startLoc":104,"text":"_kernel"},{"attributeType":"None","col":16,"comment":"null","endLoc":122,"id":11913,"name":"_kernel","nodeType":"Attribute","startLoc":122,"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\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n    ","endLoc":413,"header":"def _get_apparent_body_position(body, time, ephemeris)","id":11914,"name":"_get_apparent_body_position","nodeType":"Function","startLoc":370,"text":"def _get_apparent_body_position(body, time, ephemeris):\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\n    Returns\n    -------\n    cartesian_position : `~astropy.coordinates.CartesianRepresentation`\n        Barycentric (ICRS) apparent position of the body in cartesian coordinates\n    \"\"\"\n    if ephemeris is None:\n        ephemeris = solar_system_ephemeris.get()\n    # builtin ephemeris and moon is a special case, with no need to account for\n    # light travel time, since this is already included in the Meeus algorithm\n    # used.\n    if ephemeris == 'builtin' and body.lower() == 'moon':\n        return get_body_barycentric(body, time, ephemeris)\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    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)"},{"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":1645,"header":"def norm(self)","id":11915,"name":"norm","nodeType":"Function","startLoc":1633,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1529,"id":11916,"name":"attr_classes","nodeType":"Attribute","startLoc":1529,"text":"attr_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1532,"id":11917,"name":"recommended_units","nodeType":"Attribute","startLoc":1532,"text":"recommended_units"},{"attributeType":"null","col":4,"comment":"null","endLoc":1533,"id":11918,"name":"_unit_representation","nodeType":"Attribute","startLoc":1533,"text":"_unit_representation"},{"attributeType":"null","col":12,"comment":"null","endLoc":1539,"id":11919,"name":"_distance","nodeType":"Attribute","startLoc":1539,"text":"self._distance"},{"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`\n        The latitude in radians\n    lon : `~astropy.units.Quantity`\n        The longitude in radians\n    ","endLoc":73,"header":"def cartesian_to_spherical(x, y, z)","id":11920,"name":"cartesian_to_spherical","nodeType":"Function","startLoc":28,"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`\n        The latitude in radians\n    lon : `~astropy.units.Quantity`\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"},{"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\n        that has a sensitivity function that changes with redshift.\n        The total comoving volume is given by integrating\n        differential_comoving_volume to redshift z\n        and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n          Differential comoving volume per redshift per steradian at\n          each input redshift.","endLoc":1416,"header":"def differential_comoving_volume(self, z)","id":11921,"name":"differential_comoving_volume","nodeType":"Function","startLoc":1392,"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\n        that has a sensitivity function that changes with redshift.\n        The total comoving volume is given by integrating\n        differential_comoving_volume to redshift z\n        and multiplying by a solid angle.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        dV : `~astropy.units.Quantity`\n          Differential comoving volume per redshift per steradian at\n          each input redshift.\"\"\"\n        dh = self._hubble_distance\n        da = self.angular_diameter_distance(z)\n        zp1 = 1.0 + z\n        return dh * ((zp1 * da) ** 2.0) / u.Quantity(self.efunc(z),\n                                                          u.steradian)"},{"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`\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity`\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":121,"header":"def spherical_to_cartesian(r, lat, lon)","id":11922,"name":"spherical_to_cartesian","nodeType":"Function","startLoc":76,"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`\n        The latitude (in radians if array or scalar)\n    lon : scalar, array-like, or `~astropy.units.Quantity`\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":" Separation in transverse comoving kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          The distance in comoving kpc corresponding to an arcmin at each\n          input redshift.\n        ","endLoc":1434,"header":"def kpc_comoving_per_arcmin(self, z)","id":11923,"name":"kpc_comoving_per_arcmin","nodeType":"Function","startLoc":1418,"text":"def kpc_comoving_per_arcmin(self, z):\n        \"\"\" Separation in transverse comoving kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\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) *\n                arcmin_in_radians / u.arcmin)"},{"col":4,"comment":"null","endLoc":1286,"header":"def scale_factors(self, omit_coslat=False)","id":11924,"name":"scale_factors","nodeType":"Function","startLoc":1282,"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 OrderedDict((('lon', sf_lon),\n                            ('lat', sf_lat)))"},{"col":4,"comment":" Separation in transverse proper kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          The distance in proper kpc corresponding to an arcmin at each\n          input redshift.\n        ","endLoc":1452,"header":"def kpc_proper_per_arcmin(self, z)","id":11925,"name":"kpc_proper_per_arcmin","nodeType":"Function","startLoc":1436,"text":"def kpc_proper_per_arcmin(self, z):\n        \"\"\" Separation in transverse proper kpc corresponding to an\n        arcminute at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        d : `~astropy.units.Quantity`\n          The distance in proper kpc corresponding to an arcmin at each\n          input redshift.\n        \"\"\"\n        return (self.angular_diameter_distance(z).to(u.kpc) *\n                arcmin_in_radians / u.arcmin)"},{"col":4,"comment":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":1297,"header":"def to_cartesian(self)","id":11926,"name":"to_cartesian","nodeType":"Function","startLoc":1288,"text":"def to_cartesian(self):\n        \"\"\"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        \"\"\"\n        x = np.cos(self.lat) * np.cos(self.lon)\n        y = np.cos(self.lat) * np.sin(self.lon)\n        z = np.sin(self.lat)\n\n        return CartesianRepresentation(x=x, y=y, z=z, copy=False)"},{"col":4,"comment":"\n        Converts this transform graph into a networkx graph.\n\n        .. note::\n            You must have the `networkx <http://networkx.lanl.gov/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : `networkx.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_\n            This `TransformGraph` as a `networkx.Graph`_.\n        ","endLoc":523,"header":"def to_networkx_graph(self)","id":11927,"name":"to_networkx_graph","nodeType":"Function","startLoc":489,"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 <http://networkx.lanl.gov/>`_\n            package installed for this to work.\n\n        Returns\n        -------\n        nxgraph : `networkx.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_\n            This `TransformGraph` as a `networkx.Graph`_.\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":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":168,"header":"def get_sun(time)","id":11928,"name":"get_sun","nodeType":"Function","startLoc":124,"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[..., 0, :]\n    earth_v = earth_pv_bary[..., 1, :]\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))"},{"col":4,"comment":" Angular separation in arcsec corresponding to a comoving kpc\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a comoving kpc\n          at each input redshift.\n        ","endLoc":1470,"header":"def arcsec_per_kpc_comoving(self, z)","id":11929,"name":"arcsec_per_kpc_comoving","nodeType":"Function","startLoc":1454,"text":"def arcsec_per_kpc_comoving(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a comoving kpc\n        at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a comoving kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.comoving_transverse_distance(z).to(u.kpc) *\n                           arcsec_in_radians)"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":1311,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":11930,"name":"from_cartesian","nodeType":"Function","startLoc":1299,"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\n        lon = np.arctan2(cart.y, cart.x)\n        lat = np.arctan2(cart.z, s)\n\n        return cls(lon=lon, lat=lat, copy=False)"},{"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 : number\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":589,"header":"def transform(self, transcls, fromsys, tosys, priority=1, **kwargs)","id":11931,"name":"transform","nodeType":"Function","startLoc":525,"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 : number\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":" Angular separation in arcsec corresponding to a proper kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a proper kpc\n          at each input redshift.\n        ","endLoc":1488,"header":"def arcsec_per_kpc_proper(self, z)","id":11932,"name":"arcsec_per_kpc_proper","nodeType":"Function","startLoc":1472,"text":"def arcsec_per_kpc_proper(self, z):\n        \"\"\" Angular separation in arcsec corresponding to a proper kpc at\n        redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.  Must be 1D or scalar.\n\n        Returns\n        -------\n        theta : `~astropy.units.Quantity`\n          The angular separation in arcsec corresponding to a proper kpc\n          at each input redshift.\n        \"\"\"\n        return u.arcsec / (self.angular_diameter_distance(z).to(u.kpc) *\n                           arcsec_in_radians)"},{"attributeType":"null","col":8,"comment":"null","endLoc":99,"id":11933,"name":"_composite_cache","nodeType":"Attribute","startLoc":99,"text":"self._composite_cache"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":177,"id":11934,"name":"_H0","nodeType":"Attribute","startLoc":177,"text":"self._H0"},{"attributeType":"null","col":12,"comment":"null","endLoc":205,"id":11935,"name":"_neff_per_nu","nodeType":"Attribute","startLoc":205,"text":"self._neff_per_nu"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":11936,"name":"_graph","nodeType":"Attribute","startLoc":47,"text":"self._graph"},{"attributeType":"null","col":12,"comment":"null","endLoc":67,"id":11937,"name":"_cached_frame_set","nodeType":"Attribute","startLoc":67,"text":"self._cached_frame_set"},{"attributeType":"null","col":8,"comment":"null","endLoc":98,"id":11938,"name":"_shortestpaths","nodeType":"Attribute","startLoc":98,"text":"self._shortestpaths"},{"attributeType":"null","col":12,"comment":"null","endLoc":84,"id":11939,"name":"_cached_frame_attributes","nodeType":"Attribute","startLoc":84,"text":"self._cached_frame_attributes"},{"attributeType":"null","col":12,"comment":"null","endLoc":53,"id":11940,"name":"_cached_names_dct","nodeType":"Attribute","startLoc":53,"text":"self._cached_names_dct"},{"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 : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : number\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":691,"id":11941,"nodeType":"Class","startLoc":594,"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 : class\n        The coordinate frame class to start from.\n    tosys : class\n        The coordinate frame class to transform into.\n    priority : number\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.get_frame_attr_names():\n                if from_nm in tosys.get_frame_attr_names():\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 : a 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 : fromsys object\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 : tosys object\n            The new coordinate after the transform has been applied.\n        \"\"\""},{"col":4,"comment":"null","endLoc":1326,"header":"def represent_as(self, other_class, differential_class=None)","id":11942,"name":"represent_as","nodeType":"Function","startLoc":1313,"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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\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, r=1.0,\n                                   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        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":668,"header":"def unregister(self, graph)","id":11943,"name":"unregister","nodeType":"Function","startLoc":653,"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)"},{"col":4,"comment":"\n        Does the actual coordinate transformation from the ``fromsys`` class to\n        the ``tosys`` class.\n\n        Parameters\n        ----------\n        fromcoord : fromsys object\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 : tosys object\n            The new coordinate after the transform has been applied.\n        ","endLoc":691,"header":"@abstractmethod\n    def __call__(self, fromcoord, toframe)","id":11944,"name":"__call__","nodeType":"Function","startLoc":670,"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 : fromsys object\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 : tosys object\n            The new coordinate after the transform has been applied.\n        \"\"\""},{"attributeType":"null","col":8,"comment":"null","endLoc":621,"id":11945,"name":"fromsys","nodeType":"Attribute","startLoc":621,"text":"self.fromsys"},{"attributeType":"null","col":4,"comment":"null","endLoc":977,"id":11946,"name":"attr_classes","nodeType":"Attribute","startLoc":977,"text":"attr_classes"},{"col":4,"comment":"null","endLoc":1331,"header":"def __mul__(self, other)","id":11947,"name":"__mul__","nodeType":"Function","startLoc":1328,"text":"def __mul__(self, other):\n        self._raise_if_has_differentials('multiplication')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. * other)"},{"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 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    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    ","endLoc":461,"header":"def get_body(body, time, location=None, ephemeris=None)","id":11948,"name":"get_body","nodeType":"Function","startLoc":419,"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 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    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    \"\"\"\n    if location is None:\n        location = time.location\n\n    cartrep = _get_apparent_body_position(body, time, ephemeris)\n    icrs = ICRS(cartrep)\n    if location is not None:\n        obsgeoloc, obsgeovel = location.get_gcrs_posvel(time)\n        gcrs = icrs.transform_to(GCRS(obstime=time,\n                                      obsgeoloc=obsgeoloc,\n                                      obsgeovel=obsgeovel))\n    else:\n        gcrs = icrs.transform_to(GCRS(obstime=time))\n    return SkyCoord(gcrs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1035,"id":11949,"name":"xyz","nodeType":"Attribute","startLoc":1035,"text":"xyz"},{"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`\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    ","endLoc":1494,"id":11950,"nodeType":"Class","startLoc":1418,"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`\n        The distance of the point(s) from the origin.\n\n    differentials : dict, `BaseDifferential`, optional\n        Any differential classes that should be associated with this\n        representation. The input must either be a single `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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('distance', u.Quantity)])\n\n    def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, copy=copy, differentials=differentials)\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                                  '{0} instances'.format(self.__class__))\n\n    def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return OrderedDict((('distance', l),))\n\n    def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {0} 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 _scale_operation(self, op, *args):\n        self._raise_if_has_differentials(op.__name__)\n        return op(self.distance, *args)\n\n    def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity`\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"},{"col":4,"comment":"null","endLoc":1447,"header":"def __init__(self, distance, differentials=None, copy=True)","id":11951,"name":"__init__","nodeType":"Function","startLoc":1446,"text":"def __init__(self, distance, differentials=None, copy=True):\n        super().__init__(distance, copy=copy, differentials=differentials)"},{"col":4,"comment":"\n        The distance from the origin to the point(s).\n        ","endLoc":1454,"header":"@property\n    def distance(self)","id":11952,"name":"distance","nodeType":"Function","startLoc":1449,"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":1459,"header":"def unit_vectors(self)","id":11953,"name":"unit_vectors","nodeType":"Function","startLoc":1456,"text":"def unit_vectors(self):\n        \"\"\"Cartesian unit vectors are undefined for radial representation.\"\"\"\n        raise NotImplementedError('Cartesian unit vectors are undefined for '\n                                  '{0} instances'.format(self.__class__))"},{"col":4,"comment":"null","endLoc":1463,"header":"def scale_factors(self)","id":11954,"name":"scale_factors","nodeType":"Function","startLoc":1461,"text":"def scale_factors(self):\n        l = np.broadcast_to(1.*u.one, self.shape, subok=True)\n        return OrderedDict((('distance', l),))"},{"col":4,"comment":"Cannot convert radial representation to cartesian.","endLoc":1468,"header":"def to_cartesian(self)","id":11955,"name":"to_cartesian","nodeType":"Function","startLoc":1465,"text":"def to_cartesian(self):\n        \"\"\"Cannot convert radial representation to cartesian.\"\"\"\n        raise NotImplementedError('cannot convert {0} instance to cartesian.'\n                                  .format(self.__class__))"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to radial coordinate.\n        ","endLoc":1475,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":11956,"name":"from_cartesian","nodeType":"Function","startLoc":1470,"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":622,"id":11957,"name":"tosys","nodeType":"Attribute","startLoc":622,"text":"self.tosys"},{"attributeType":"null","col":8,"comment":"null","endLoc":632,"id":11958,"name":"overlapping_frame_attr_names","nodeType":"Attribute","startLoc":632,"text":"self.overlapping_frame_attr_names"},{"attributeType":"null","col":8,"comment":"null","endLoc":623,"id":11959,"name":"priority","nodeType":"Attribute","startLoc":623,"text":"self.priority"},{"attributeType":"null","col":20,"comment":"null","endLoc":245,"id":11960,"name":"_nmasslessnu","nodeType":"Attribute","startLoc":245,"text":"self._nmasslessnu"},{"attributeType":"null","col":16,"comment":"null","endLoc":271,"id":11961,"name":"_nu_y","nodeType":"Attribute","startLoc":271,"text":"self._nu_y"},{"attributeType":"null","col":12,"comment":"null","endLoc":282,"id":11962,"name":"_Ogamma0","nodeType":"Attribute","startLoc":282,"text":"self._Ogamma0"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":188,"id":11963,"name":"_hubble_time","nodeType":"Attribute","startLoc":188,"text":"self._hubble_time"},{"attributeType":"null","col":20,"comment":"null","endLoc":246,"id":11964,"name":"_nmassivenu","nodeType":"Attribute","startLoc":246,"text":"self._nmassivenu"},{"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 : number\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":752,"id":11965,"nodeType":"Class","startLoc":694,"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 : number\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\n                and 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('the transformation function yielded {0} but '\n                'should have been of type {1}'.format(res, 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":1479,"header":"def _scale_operation(self, op, *args)","id":11966,"name":"_scale_operation","nodeType":"Function","startLoc":1477,"text":"def _scale_operation(self, op, *args):\n        self._raise_if_has_differentials(op.__name__)\n        return op(self.distance, *args)"},{"col":4,"comment":"null","endLoc":741,"header":"def __init__(self, func, fromsys, tosys, priority=1, register_graph=None)","id":11967,"name":"__init__","nodeType":"Function","startLoc":727,"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\n                and 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)"},{"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 inhomogenous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate objects\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":194,"header":"def concatenate(coords)","id":11968,"name":"concatenate","nodeType":"Function","startLoc":171,"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 inhomogenous sequences of objects.\n\n    Parameters\n    ----------\n    coords : sequence of coordinate objects\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    return SkyCoord(coords)"},{"col":4,"comment":"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity`\n            Dimensionless ones, with the same shape as the representation.\n        ","endLoc":1491,"header":"def norm(self)","id":11969,"name":"norm","nodeType":"Function","startLoc":1481,"text":"def norm(self):\n        \"\"\"Vector norm.\n\n        Just the distance itself.\n\n        Returns\n        -------\n        norm : `~astropy.units.Quantity`\n            Dimensionless ones, with the same shape as the representation.\n        \"\"\"\n        return self.distance"},{"col":4,"comment":"null","endLoc":1494,"header":"def _combine_operation(self, op, other, reverse=False)","id":11970,"name":"_combine_operation","nodeType":"Function","startLoc":1493,"text":"def _combine_operation(self, op, other, reverse=False):\n        return NotImplemented"},{"attributeType":"null","col":4,"comment":"null","endLoc":1444,"id":11971,"name":"attr_classes","nodeType":"Attribute","startLoc":1444,"text":"attr_classes"},{"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 rather than referenced.\n    ","endLoc":1804,"id":11972,"nodeType":"Class","startLoc":1648,"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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('phi', Angle),\n                                ('theta', Angle),\n                                ('r', u.Quantity)])\n    recommended_units = {'phi': u.deg, 'theta': u.deg}\n\n    def __init__(self, phi, theta, r, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        if copy:\n            self._phi = self._phi.wrap_at(360 * u.deg)\n        else:\n            # necessary because the above version of `wrap_at` has to be a copy\n            self._phi.wrap_at(360 * u.deg, inplace=True)\n\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 {0}'.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 OrderedDict(\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 OrderedDict((('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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta)\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 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)"},{"col":4,"comment":"null","endLoc":1703,"header":"def __init__(self, phi, theta, r, differentials=None, copy=True)","id":11973,"name":"__init__","nodeType":"Function","startLoc":1687,"text":"def __init__(self, phi, theta, r, differentials=None, copy=True):\n        super().__init__(phi, theta, r, copy=copy, differentials=differentials)\n\n        # Wrap/validate phi/theta\n        if copy:\n            self._phi = self._phi.wrap_at(360 * u.deg)\n        else:\n            # necessary because the above version of `wrap_at` has to be a copy\n            self._phi.wrap_at(360 * u.deg, inplace=True)\n\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 {0}'.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":24,"id":11974,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":198,"id":11975,"name":"_constellation_data","nodeType":"Attribute","startLoc":198,"text":"_constellation_data"},{"col":0,"comment":"","endLoc":9,"header":"funcs.py#<anonymous>","id":11976,"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           'concatenate', 'get_constellation']\n\n_constellation_data = {}"},{"col":4,"comment":"null","endLoc":1336,"header":"def __truediv__(self, other)","id":11977,"name":"__truediv__","nodeType":"Function","startLoc":1333,"text":"def __truediv__(self, other):\n        self._raise_if_has_differentials('division')\n        return self._dimensional_representation(lon=self.lon, lat=self.lat,\n                                                distance=1. / other)"},{"col":4,"comment":"null","endLoc":752,"header":"def __call__(self, fromcoord, toframe)","id":11978,"name":"__call__","nodeType":"Function","startLoc":743,"text":"def __call__(self, fromcoord, toframe):\n        res = self.func(fromcoord, toframe)\n        if not isinstance(res, self.tosys):\n            raise TypeError('the transformation function yielded {0} but '\n                'should have been of type {1}'.format(res, 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":1340,"header":"def __neg__(self)","id":11979,"name":"__neg__","nodeType":"Function","startLoc":1338,"text":"def __neg__(self):\n        self._raise_if_has_differentials('negation')\n        return self.__class__(self.lon + 180. * u.deg, -self.lat, copy=False)"},{"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`\n            Dimensionless ones, with the same shape as the representation.\n        ","endLoc":1355,"header":"def norm(self)","id":11980,"name":"norm","nodeType":"Function","startLoc":1342,"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`\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)"},{"attributeType":"None","col":12,"comment":"null","endLoc":163,"id":11981,"name":"_Odm0","nodeType":"Attribute","startLoc":163,"text":"self._Odm0"},{"attributeType":"null","col":8,"comment":"null","endLoc":184,"id":11982,"name":"_hubble_distance","nodeType":"Attribute","startLoc":184,"text":"self._hubble_distance"},{"fileName":"baseframe.py","filePath":"astropy/coordinates","id":11983,"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 abc\nimport copy\nimport inspect\nfrom collections import namedtuple, OrderedDict, defaultdict\nimport warnings\n\n# Dependencies\nimport numpy as np\n\n# Project\nfrom ..utils.compat.misc import override__dir__\nfrom ..utils.decorators import lazyproperty\nfrom ..utils.exceptions import AstropyWarning\nfrom .. import units as u\nfrom ..utils import (OrderedDescriptorContainer, ShapedLikeNDArray,\n                     check_broadcast)\nfrom .transformations import TransformGraph\nfrom . import representation as r\n\nfrom .attributes import Attribute\n\n# Import old names for Attributes so we don't break backwards-compatibility\n# (some users rely on them being here, although that is not encouraged, as this\n# is not the public API location -- see attributes.py).\nfrom .attributes import (\n    TimeFrameAttribute, QuantityFrameAttribute,\n    EarthLocationAttribute, CoordinateAttribute,\n    CartesianRepresentationFrameAttribute)  # pylint: disable=W0611\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 {0!r} but must be a BaseRepresentation class '\n            'or one of the string aliases {1}'.format(\n                value, list(r.REPRESENTATION_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_cls in differentials.items():\n        if differential_cls == 'base':\n            # We don't want to fail for this case.\n            differential_cls = r.DIFFERENTIAL_CLASSES.get(base.get_name(), None)\n\n        elif differential_cls in r.DIFFERENTIAL_CLASSES:\n            differential_cls = r.DIFFERENTIAL_CLASSES[differential_cls]\n\n        elif (differential_cls is not None and\n              (not isinstance(differential_cls, type) or\n               not issubclass(differential_cls, r.BaseDifferential))):\n            raise ValueError(\n                'Differential is {0!r} but must be a BaseDifferential class '\n                'or one of the string aliases {1}'.format(\n                    differential_cls, list(r.DIFFERENTIAL_CLASSES)))\n        repr_classes[name] = differential_cls\n    return repr_classes\n\n\n# Need to subclass ABCMeta as well, so that this meta class can be combined\n# with ShapedLikeNDArray below (which is an ABC); without it, one gets\n# \"TypeError: metaclass conflict: the metaclass of a derived class must be a\n#  (non-strict) subclass of the metaclasses of all its bases\"\nclass FrameMeta(OrderedDescriptorContainer, abc.ABCMeta):\n    def __new__(mcls, name, bases, members):\n        if 'default_representation' in members:\n            default_repr = members.pop('default_representation')\n            found_default_repr = True\n        else:\n            default_repr = None\n            found_default_repr = False\n\n        if 'default_differential' in members:\n            default_diff = members.pop('default_differential')\n            found_default_diff = True\n        else:\n            default_diff = None\n            found_default_diff = False\n\n        if 'frame_specific_representation_info' in members:\n            repr_info = members.pop('frame_specific_representation_info')\n            found_repr_info = True\n        else:\n            repr_info = None\n            found_repr_info = False\n\n        # somewhat hacky, but this is the best way to get the MRO according to\n        # https://mail.python.org/pipermail/python-list/2002-December/167861.html\n        tmp_cls = super().__new__(mcls, name, bases, members)\n\n        # now look through the whole MRO for the class attributes, raw for\n        # frame_attr_names, and leading underscore for others\n        for m in (c.__dict__ for c in tmp_cls.__mro__):\n            if not found_default_repr and '_default_representation' in m:\n                default_repr = m['_default_representation']\n                found_default_repr = True\n\n            if not found_default_diff and '_default_differential' in m:\n                default_diff = m['_default_differential']\n                found_default_diff = True\n\n            if (not found_repr_info and\n                    '_frame_specific_representation_info' in m):\n                repr_info = m['_frame_specific_representation_info']\n                found_repr_info = True\n\n            if found_default_repr and found_default_diff and found_repr_info:\n                break\n        else:\n            raise ValueError(\n                'Could not find all expected BaseCoordinateFrame class '\n                'attributes.  Are you mis-using FrameMeta?')\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        mcls.readonly_prop_factory(members, 'default_representation',\n                                   default_repr)\n        mcls.readonly_prop_factory(members, 'default_differential',\n                                   default_diff)\n        mcls.readonly_prop_factory(members,\n                                   'frame_specific_representation_info',\n                                   copy.deepcopy(repr_info))\n\n        # now set the frame name as lower-case class name, if it isn't explicit\n        if 'name' not in members:\n            members['name'] = name.lower()\n\n        return super().__new__(mcls, name, bases, members)\n\n    @staticmethod\n    def readonly_prop_factory(members, attr, value):\n        private_attr = '_' + attr\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        members[private_attr] = value\n        members[attr] = property(getter)\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'`` (to use whatever\n    the representation's ``recommended_units`` is), or None (to indicate that\n    no unit mapping 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\nclass BaseCoordinateFrame(ShapedLikeNDArray, metaclass=FrameMeta):\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or `None` to have no data (or use the other\n        arguments)\n    *args, **kwargs\n        Coordinates, with names that depend on the subclass.\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\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    \"\"\"\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    _inherit_descriptors_ = (Attribute,)\n\n    frame_attributes = OrderedDict()\n    # Default empty frame_attributes dict\n\n    def __init__(self, *args, copy=True, representation=None,\n                 differential_cls=None,**kwargs):\n        self._attr_names_with_defaults = []\n\n        # TODO: we should be able to deal with an instance, not just a\n        # class or string for representation and differential_cls.\n\n        if representation is not None or differential_cls is not None:\n\n            if representation is None:\n                representation = self.default_representation\n\n            if (inspect.isclass(differential_cls) and\n                    issubclass(differential_cls, r.BaseDifferential)):\n                # TODO: assumes the differential class is for the velocity\n                # differential\n                differential_cls = {'s': differential_cls}\n\n            elif differential_cls is None:\n                differential_cls = {'s': 'base'} # see set_representation_cls()\n\n            self.set_representation_cls(representation, **differential_cls)\n\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)\n            if len(args) > 0:\n                raise TypeError(\n                    'Cannot create a frame with both a representation and '\n                    '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                                     '{0}'.format(diffs))\n\n        elif self.representation:\n            representation_cls = self.representation\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            # TODO: possibly generalize this somehow?\n            if repr_kwargs:\n                if repr_kwargs.get('distance', True) is None:\n                    del repr_kwargs['distance']\n\n                if (issubclass(representation_cls, r.SphericalRepresentation)\n                        and 'distance' not in repr_kwargs):\n                    representation_cls = representation_cls._unit_representation\n\n                representation_data = representation_cls(copy=copy, **repr_kwargs)\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') and\n                        '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                differential_data = differential_cls(copy=copy, **diff_kwargs)\n\n        if len(args) > 0:\n            raise TypeError(\n                '{0}.__init__ had {1} 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            self._data = representation_data.with_differentials(\n                {'s': differential_data})\n        else:\n            self._data = representation_data  # possibly None.\n\n        values = {}\n        for fnm, fdefault in self.get_frame_attr_names().items():\n            # Read-only frame attributes are defined as FrameAttribue\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                'Coordinate frame got unexpected keywords: {0}'.format(\n                    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, 'size', 1) > 1}\n            if shapes:\n                if len(shapes) > 1:\n                    try:\n                        self._no_data_shape = check_broadcast(*shapes.values())\n                    except ValueError:\n                        raise ValueError(\n                            \"non-scalar attributes with inconsistent \"\n                            \"shapes: {0}\".format(shapes))\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        else:\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    @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 \"{0!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 OrderedDict((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 not hasattr(self, '_representation'):\n            self._representation = {'base': self.default_representation,\n                                    's': self.default_differential}\n        return self._representation[which] if which is not None else 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 = 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_represenation_cls`` method.\n        \"\"\")\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\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 in repr_diff_cls.attr_classes.keys():\n                repr_attrs[repr_diff_cls]['names'].append(c)\n                rec_unit = repr_diff_cls.recommended_units.get(c, 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            if isinstance(repr_diff_cls, 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                repr_diff_cls = _get_repr_cls(repr_diff_cls)\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) and\n                            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        return repr_attrs\n\n    @property\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 = OrderedDict()\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 = OrderedDict()\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, 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 overriden 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 : same as this frame\n            Replica of this object, but possibly with new frame attributes.\n        \"\"\"\n        return self._apply('copy' if copy else 'replicate', **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 overriden 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 : same as this frame\n            Replica of this object, but without data and possibly with new frame\n            attributes.\n        \"\"\"\n        kwargs['_framedata'] = None\n        return self._apply('copy' if copy else 'replicate', **kwargs)\n\n    def realize_frame(self, representation):\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        representation : BaseRepresentation\n            The representation to use as the data for the new frame.\n\n        Returns\n        -------\n        frameobj : same as this frame\n            A new object with the same frame attributes as this one, but\n            with the ``representation`` as the data.\n        \"\"\"\n        # Here we pass representation_cls=None to _apply, since we do not want\n        # to insist that the realized frame has the same representation as\n        # self.  [Avoids breaking sunpy; see gh-6208]\n        # TODO: should we expose this, so one has a choice?\n        return self._apply('replicate', _framedata=representation,\n                           representation_cls=None)\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 = 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            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                # 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)) and\n                                comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        elif (isinstance(data_diff, r.RadialDifferential) and\n                              comp not in data_diff.__class__.attr_classes):\n                            continue\n\n                        if new_attr_unit and hasattr(diff, comp):\n                            diffkwargs[comp] = diffkwargs[comp].to(new_attr_unit)\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 .representation and\n                    # .differential_cls don't point to the original classes, if\n                    # the input differential is a RadialDifferential, it usually\n                    # gets turned into a SphericalCosLatDifferential (or\n                    # whatever the default is) with strange units for the d_lon\n                    # and d_lat attributes. This then causes the dictionary key\n                    # check to fail (i.e. comparison against\n                    # `diff._get_deriv_key()`)\n                    data._differentials.update({'s': diff})\n                    # data = data.with_differentials({'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 : class or frame object or SkyCoord object\n            The frame to transform this coordinate frame into.\n\n        Returns\n        -------\n        transframe\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) and\n           hasattr(self, 'obstime') and hasattr(new_frame, 'obstime') and\n           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            # 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 : class or frame object\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\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    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 : 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 np.any(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 = ' ({0})'.format(frameattrs)\n\n        if data_repr:\n            return '<{0} Coordinate{1}: {2}>'.format(self.__class__.__name__,\n                                                     frameattrs, data_repr)\n        else:\n            return '<{0} Frame{1}>'.format(self.__class__.__name__,\n                                           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:\n            if (issubclass(self.representation, r.SphericalRepresentation) and\n                    isinstance(self.data, r.UnitSphericalRepresentation)):\n                rep_cls = self.data.__class__\n            else:\n                rep_cls = self.representation\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            for nmpref, nmrepr in self.representation_component_names.items():\n                data_repr = data_repr.replace(nmrepr, nmpref)\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        return ', '.join([attrnm + '=' + str(getattr(self, attrnm))\n                          for attrnm in self.get_frame_attr_names()])\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.misc.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        if '_framedata' in kwargs:\n            data = kwargs.pop('_framedata')\n        else:\n            data = self.data if self.has_data else None\n\n        # This is to provide a slightly nicer error message if the user tries to\n        # 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\n        # TODO: expose this trickery in docstring?\n        representation_cls = kwargs.pop('representation_cls',\n                                        self.representation)\n\n        differential_cls = kwargs.pop('differential_cls',\n                                      self.get_representation_cls('s'))\n\n        def apply_method(value):\n            if isinstance(value, ShapedLikeNDArray):\n                if method == 'replicate' and not hasattr(value, method):\n                    return value  # reference directly\n                else:\n                    return value._apply(method, *args, **kwargs)\n            else:\n                if callable(method):\n                    return method(value, *args, **kwargs)\n                else:\n                    if method == 'replicate' and not hasattr(value, method):\n                        return value  # reference directly\n                    else:\n                        return getattr(value, method)(*args, **kwargs)\n\n        if data is not None:\n            data = apply_method(data)\n\n        # TODO: change to representation_cls in __init__ - gh-6219.\n        frattrs = {'representation': representation_cls,\n                   'differential_cls': differential_cls}\n        for attr in self.get_frame_attr_names():\n            if attr not in self._attr_names_with_defaults:\n                if (method == 'copy' or method == 'replicate') and attr in kwargs:\n                    value = kwargs[attr]\n                else:\n                    value = getattr(self, attr)\n                if getattr(value, 'size', 1) > 1:\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                frattrs[attr] = value\n\n        return self.__class__(data, **frattrs)\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, 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_cls 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        repr_attr_names = set()\n        if hasattr(self, 'representation_info'):\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                'Cannot set any frame attribute {0}'.format(attr))\n        else:\n            super().__setattr__(attr, 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            unintutive 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        return Distance((self_car - other_car).norm())\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 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        try:\n            v = self.cartesian.differentials['s']\n        except Exception as e:\n            raise ValueError('Could not retrieve a Cartesian velocity. Your '\n                             'frame must include velocity information for this '\n                             'to work.')\n        return v\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 = OrderedDict()\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('no {0}'.format(name))\n\n    def __setattr__(self, name, value):\n        if name in self.get_frame_attr_names():\n            raise AttributeError(\"can't set frame attribute '{0}'\".format(name))\n        else:\n            super().__setattr__(name, value)\n"},{"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":132,"id":11984,"nodeType":"Class","startLoc":20,"text":"class Attribute(OrderedDescriptor):\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    _class_attribute_ = 'frame_attributes'\n    _name_attribute_ = 'name'\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 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\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        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)\n            if instance_shape is not None and (getattr(out, 'size', 1) > 1 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 {0} should be scalar or have shape {1}, \"\n                        \"but is has shape {2} 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')"},{"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\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        ","endLoc":95,"header":"def convert_input(self, value)","id":11985,"name":"convert_input","nodeType":"Function","startLoc":64,"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\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        return value, False"},{"col":4,"comment":"null","endLoc":129,"header":"def __get__(self, instance, frame_cls=None)","id":11986,"name":"__get__","nodeType":"Function","startLoc":97,"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)\n            if instance_shape is not None and (getattr(out, 'size', 1) > 1 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 {0} should be scalar or have shape {1}, \"\n                        \"but is has shape {2} 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":8,"comment":"null","endLoc":195,"id":11987,"name":"_nneutrinos","nodeType":"Attribute","startLoc":195,"text":"self._nneutrinos"},{"attributeType":"null","col":12,"comment":"null","endLoc":284,"id":11988,"name":"_Onu0","nodeType":"Attribute","startLoc":284,"text":"self._Onu0"},{"attributeType":"null","col":8,"comment":"null","endLoc":287,"id":11989,"name":"_Ok0","nodeType":"Attribute","startLoc":287,"text":"self._Ok0"},{"attributeType":"null","col":8,"comment":"null","endLoc":149,"id":11990,"name":"_Om0","nodeType":"Attribute","startLoc":149,"text":"self._Om0"},{"attributeType":"null","col":8,"comment":"null","endLoc":152,"id":11991,"name":"_Ode0","nodeType":"Attribute","startLoc":152,"text":"self._Ode0"},{"attributeType":"function","col":8,"comment":"null","endLoc":291,"id":11992,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":291,"text":"self._inv_efunc_scalar"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":172,"id":11993,"name":"_Tcmb0","nodeType":"Attribute","startLoc":172,"text":"self._Tcmb0"},{"attributeType":"null","col":8,"comment":"null","endLoc":165,"id":11994,"name":"_Neff","nodeType":"Attribute","startLoc":165,"text":"self._Neff"},{"attributeType":"null","col":8,"comment":"null","endLoc":182,"id":11995,"name":"_h","nodeType":"Attribute","startLoc":182,"text":"self._h"},{"attributeType":"null","col":20,"comment":"null","endLoc":248,"id":11996,"name":"_massivenu_mass","nodeType":"Attribute","startLoc":248,"text":"self._massivenu_mass"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":192,"id":11997,"name":"_critical_density0","nodeType":"Attribute","startLoc":192,"text":"self._critical_density0"},{"attributeType":"None","col":12,"comment":"null","endLoc":162,"id":11998,"name":"_Ob0","nodeType":"Attribute","startLoc":162,"text":"self._Ob0"},{"attributeType":"Callable","col":8,"comment":"null","endLoc":738,"id":11999,"name":"func","nodeType":"Attribute","startLoc":738,"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 exsiting differential.\n    finite_difference_dt : `~astropy.units.Quantity` 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":908,"id":12000,"nodeType":"Class","startLoc":755,"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 exsiting differential.\n    finite_difference_dt : `~astropy.units.Quantity` 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":803,"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":12001,"name":"__init__","nodeType":"Function","startLoc":796,"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"},{"attributeType":"null","col":20,"comment":"null","endLoc":240,"id":12002,"name":"_massivenu","nodeType":"Attribute","startLoc":240,"text":"self._massivenu"},{"attributeType":"null","col":8,"comment":"null","endLoc":292,"id":12003,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":292,"text":"self._inv_efunc_scalar_args"},{"col":4,"comment":"null","endLoc":1364,"header":"def _combine_operation(self, op, other, reverse=False)","id":12004,"name":"_combine_operation","nodeType":"Function","startLoc":1357,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":272,"id":12005,"name":"_nu_y_list","nodeType":"Attribute","startLoc":272,"text":"self._nu_y_list"},{"col":4,"comment":"null","endLoc":132,"header":"def __set__(self, instance, val)","id":12006,"name":"__set__","nodeType":"Function","startLoc":131,"text":"def __set__(self, instance, val):\n        raise AttributeError('Cannot set frame attribute')"},{"attributeType":"null","col":4,"comment":"null","endLoc":55,"id":12007,"name":"_class_attribute_","nodeType":"Attribute","startLoc":55,"text":"_class_attribute_"},{"attributeType":"null","col":4,"comment":"null","endLoc":56,"id":12008,"name":"_name_attribute_","nodeType":"Attribute","startLoc":56,"text":"_name_attribute_"},{"col":4,"comment":"\n        The azimuth of the point(s).\n        ","endLoc":1710,"header":"@property\n    def phi(self)","id":12009,"name":"phi","nodeType":"Function","startLoc":1705,"text":"@property\n    def phi(self):\n        \"\"\"\n        The azimuth of the point(s).\n        \"\"\"\n        return self._phi"},{"attributeType":"Quantity","col":12,"comment":"null","endLoc":283,"id":12010,"name":"_Tnu0","nodeType":"Attribute","startLoc":283,"text":"self._Tnu0"},{"attributeType":"null","col":8,"comment":"null","endLoc":169,"id":12011,"name":"name","nodeType":"Attribute","startLoc":169,"text":"self.name"},{"attributeType":"null","col":4,"comment":"null","endLoc":57,"id":12012,"name":"name","nodeType":"Attribute","startLoc":57,"text":"name"},{"col":4,"comment":"\n        The elevation of the point(s).\n        ","endLoc":1717,"header":"@property\n    def theta(self)","id":12013,"name":"theta","nodeType":"Function","startLoc":1712,"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":1724,"header":"@property\n    def r(self)","id":12014,"name":"r","nodeType":"Function","startLoc":1719,"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":1735,"header":"def unit_vectors(self)","id":12015,"name":"unit_vectors","nodeType":"Function","startLoc":1726,"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 OrderedDict(\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))))"},{"attributeType":"null","col":8,"comment":"null","endLoc":60,"id":12016,"name":"default","nodeType":"Attribute","startLoc":60,"text":"self.default"},{"attributeType":"null","col":8,"comment":"null","endLoc":61,"id":12017,"name":"secondary_attribute","nodeType":"Attribute","startLoc":61,"text":"self.secondary_attribute"},{"className":"TimeFrameAttribute","col":0,"comment":"null","endLoc":502,"id":12018,"nodeType":"Class","startLoc":497,"text":"class TimeFrameAttribute(TimeAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"TimeFrameAttribute has been renamed to TimeAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"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":189,"id":12019,"nodeType":"Class","startLoc":135,"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 ..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                    'Invalid time input {0}={1!r}\\n{2}'.format(self.name,\n                                                               value, err))\n            converted = True\n\n        return out, converted"},{"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\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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":1678,"id":12020,"nodeType":"Class","startLoc":1491,"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\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n\n        # Please see \"Notes about speeding up 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        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 w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = -1`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return -1.0\n        else:\n            return -1.0 * np.ones(np.asanyarray(z).shape)\n\n    def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if np.isscalar(z):\n            return 1.\n        else:\n            return np.ones(np.asanyarray(z).shape)\n\n    def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 /\n        E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0)**(-0.5)"},{"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":189,"header":"def convert_input(self, value)","id":12021,"name":"convert_input","nodeType":"Function","startLoc":150,"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 ..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                    'Invalid time input {0}={1!r}\\n{2}'.format(self.name,\n                                                               value, err))\n            converted = True\n\n        return out, converted"},{"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":1379,"header":"def mean(self, *args, **kwargs)","id":12022,"name":"mean","nodeType":"Function","startLoc":1366,"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))"},{"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    ","endLoc":494,"header":"def get_moon(time, location=None, ephemeris=None)","id":12023,"name":"get_moon","nodeType":"Function","startLoc":467,"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    \"\"\"\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":508,"header":"def _apparent_position_in_true_coordinates(skycoord)","id":12024,"name":"_apparent_position_in_true_coordinates","nodeType":"Function","startLoc":500,"text":"def _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    jd1, jd2 = get_jd12(skycoord.obstime, 'tt')\n    _, _, _, _, _, _, _, rbpn = erfa.pn00a(jd1, jd2)\n    return SkyCoord(skycoord.frame.realize_frame(\n        skycoord.cartesian.transform(rbpn)))"},{"col":4,"comment":"null","endLoc":807,"header":"@property\n    def finite_difference_frameattr_name(self)","id":12025,"name":"finite_difference_frameattr_name","nodeType":"Function","startLoc":805,"text":"@property\n    def finite_difference_frameattr_name(self):\n        return self._finite_difference_frameattr_name"},{"col":4,"comment":"null","endLoc":824,"header":"@finite_difference_frameattr_name.setter\n    def finite_difference_frameattr_name(self, value)","id":12026,"name":"finite_difference_frameattr_name","nodeType":"Function","startLoc":809,"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"},{"col":4,"comment":"null","endLoc":908,"header":"def __call__(self, fromcoord, toframe)","id":12027,"name":"__call__","nodeType":"Function","startLoc":826,"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)"},{"col":4,"comment":"null","endLoc":1743,"header":"def scale_factors(self)","id":12028,"name":"scale_factors","nodeType":"Function","startLoc":1737,"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 OrderedDict((('phi', r * sintheta),\n                            ('theta', r),\n                            ('r', l)))"},{"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":1394,"header":"def sum(self, *args, **kwargs)","id":12029,"name":"sum","nodeType":"Function","startLoc":1381,"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":4,"comment":"null","endLoc":1757,"header":"def represent_as(self, other_class, differential_class=None)","id":12030,"name":"represent_as","nodeType":"Function","startLoc":1745,"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        # TODO: this could be optimized to shortcut even if a differential_class\n        # is passed in, using the ._re_represent_differentials() method\n        if inspect.isclass(other_class) and not differential_class:\n            if issubclass(other_class, SphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta,\n                                   distance=self.r)\n            elif issubclass(other_class, UnitSphericalRepresentation):\n                return other_class(lon=self.phi, lat=90 * u.deg - self.theta)\n\n        return super().represent_as(other_class, differential_class)"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":12031,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"attributeType":"null","col":0,"comment":"List of kernel pairs needed to calculate positions of a given object.","endLoc":29,"id":12032,"name":"DEFAULT_JPL_EPHEMERIS","nodeType":"Attribute","startLoc":29,"text":"DEFAULT_JPL_EPHEMERIS"},{"attributeType":"null","col":0,"comment":"Indices to the plan94 routine for the given object.","endLoc":32,"id":12033,"name":"BODY_NAME_TO_KERNEL_SPEC","nodeType":"Attribute","startLoc":32,"text":"BODY_NAME_TO_KERNEL_SPEC"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":12034,"name":"PLAN94_BODY_NAME_TO_PLANET_INDEX","nodeType":"Attribute","startLoc":48,"text":"PLAN94_BODY_NAME_TO_PLANET_INDEX"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":12035,"name":"_EPHEMERIS_NOTE","nodeType":"Attribute","startLoc":58,"text":"_EPHEMERIS_NOTE"},{"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 : representation\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":1415,"header":"def cross(self, other)","id":12036,"name":"cross","nodeType":"Function","startLoc":1396,"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 : representation\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":"null","endLoc":1565,"header":"def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12037,"name":"__init__","nodeType":"Function","startLoc":1545,"text":"def __init__(self, H0, Om0, Ode0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n\n        # Please see \"Notes about speeding up 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        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)"},{"col":0,"comment":"","endLoc":5,"header":"solar_system.py#<anonymous>","id":12038,"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 = OrderedDict(\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 = OrderedDict(\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_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.python.org/pypi/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    >>> solar_system_ephemeris.bodies\n    ('earth', 'sun', 'moon', 'mercury', 'venus', 'earth-moon-barycenter', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune')\n\"\"\"[1:-1]\n\nget_body_barycentric_posvel.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\nget_body_barycentric.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\n_get_apparent_body_position.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\nget_body.__doc__ += indent(_EPHEMERIS_NOTE)[4:]\n\nget_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = -1`.\n        ","endLoc":1592,"header":"def w(self, z)","id":12039,"name":"w","nodeType":"Function","startLoc":1567,"text":"def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = -1`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return -1.0\n        else:\n            return -1.0 * np.ones(np.asanyarray(z).shape)"},{"col":4,"comment":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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":1616,"header":"def de_density_scale(self, z)","id":12040,"name":"de_density_scale","nodeType":"Function","startLoc":1594,"text":"def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if np.isscalar(z):\n            return 1.\n        else:\n            return np.ones(np.asanyarray(z).shape)"},{"col":4,"comment":" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        ","endLoc":1648,"header":"def efunc(self, z)","id":12041,"name":"efunc","nodeType":"Function","startLoc":1618,"text":"def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0)"},{"fileName":"setup_package.py","filePath":"astropy/coordinates","id":12042,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\ndef get_package_data():\n    return {'astropy.coordinates.tests.accuracy': ['*.csv'],\n            'astropy.coordinates': ['data/*.dat', 'data/sites.json']}\n"},{"col":0,"comment":"null","endLoc":6,"header":"def get_package_data()","id":12043,"name":"get_package_data","nodeType":"Function","startLoc":4,"text":"def get_package_data():\n    return {'astropy.coordinates.tests.accuracy': ['*.csv'],\n            'astropy.coordinates': ['data/*.dat', 'data/sites.json']}"},{"fileName":"calculation.py","filePath":"astropy/coordinates","id":12044,"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\nfrom datetime import datetime\nfrom xml.dom.minidom import parse\nfrom urllib.request import urlopen\n\n# Third-party\nfrom .. import time as atime\nfrom ..utils.console import color_print, _color_text\nfrom . import get_sun\n\n__all__ = []\n\n\nclass HumanError(ValueError): pass\n\n\nclass CelestialError(ValueError): 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\ndef horoscope(birthday, corrected=True):\n    \"\"\"\n    Enter your birthday as an `astropy.time.Time` object and\n    receive a mystical horoscope about things to come.\n\n    Parameter\n    ---------\n    birthday : `astropy.time.Time`\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object.\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    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\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    birthday = atime.Time(birthday)\n    today = datetime.now()\n    if corrected:\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 = \"http://www.findyourfate.com/rss/dailyhoroscope-feed.php?sign={sign}&id=45\"\n\n    f = urlopen(url.format(sign=zodiac_sign.capitalize()))\n    try:  # urlopen in py2 is not a decorator\n        doc = parse(f)\n        item = doc.getElementsByTagName('item')[0]\n        desc = item.getElementsByTagName('description')[0].childNodes[0].nodeValue\n    except Exception:\n        raise CelestialError(\"Invalid response from celestial gods (failed to load horoscope).\")\n    finally:\n        f.close()\n\n    print(\"*\"*79)\n    color_print(\"Horoscope for {} on {}:\".format(zodiac_sign.capitalize(), today.strftime(\"%Y-%m-%d\")),\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"},{"col":4,"comment":" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 /\n        E`.\n        ","endLoc":1678,"header":"def inv_efunc(self, z)","id":12045,"name":"inv_efunc","nodeType":"Function","startLoc":1650,"text":"def inv_efunc(self, z):\n        r\"\"\" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 /\n        E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0)**(-0.5)"},{"className":"HumanError","col":0,"comment":"null","endLoc":20,"id":12046,"nodeType":"Class","startLoc":20,"text":"class HumanError(ValueError): pass"},{"className":"CelestialError","col":0,"comment":"null","endLoc":23,"id":12047,"nodeType":"Class","startLoc":23,"text":"class CelestialError(ValueError): pass"},{"col":0,"comment":"\n    ","endLoc":54,"header":"def get_sign(dt)","id":12048,"name":"get_sign","nodeType":"Function","startLoc":26,"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"},{"attributeType":"null","col":4,"comment":"null","endLoc":1241,"id":12049,"name":"attr_classes","nodeType":"Attribute","startLoc":1241,"text":"attr_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1243,"id":12050,"name":"recommended_units","nodeType":"Attribute","startLoc":1243,"text":"recommended_units"},{"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":90,"id":12051,"nodeType":"Class","startLoc":35,"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, SphericalRepresentation) and\n                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, in_frame_units=True)\n        return repr_data\n\n    def _represent_as_dict(self):\n        obj = self._parent\n        attrs = (list(obj.representation_component_names) +\n                 list(frame_transform_graph.frame_attributes.keys()))\n\n        # Don't output distance if it is all unitless 1.0\n        if 'distance' in attrs and np.all(obj.distance == 1.0):\n            attrs.remove('distance')\n\n        self._represent_as_dict_attrs = attrs\n\n        out = super()._represent_as_dict()\n\n        out['representation'] = obj.representation.get_name()\n        out['frame'] = obj.frame.name\n        # Note that obj.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":12,"comment":"null","endLoc":1561,"id":12052,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":1561,"text":"self._inv_efunc_scalar"},{"col":4,"comment":"null","endLoc":49,"header":"@staticmethod\n    def default_format(val)","id":12053,"name":"default_format","nodeType":"Function","startLoc":44,"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":56,"header":"@property\n    def unit(self)","id":12054,"name":"unit","nodeType":"Function","startLoc":51,"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":12055,"name":"_repr_data","nodeType":"Function","startLoc":58,"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, SphericalRepresentation) and\n                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, in_frame_units=True)\n        return repr_data"},{"col":4,"comment":"null","endLoc":502,"header":"def __init__(self, *args, **kwargs)","id":12056,"name":"__init__","nodeType":"Function","startLoc":499,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn(\"TimeFrameAttribute has been renamed to TimeAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1562,"id":12057,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":1562,"text":"self._inv_efunc_scalar_args"},{"className":"QuantityFrameAttribute","col":0,"comment":"null","endLoc":509,"id":12058,"nodeType":"Class","startLoc":504,"text":"class QuantityFrameAttribute(QuantityAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"QuantityFrameAttribute has been renamed to \"\n                      \"QuantityAttribute.\", AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"className":"QuantityAttribute","col":0,"comment":"\n    A frame attribute that is a quantity with specified units and shape\n    (optionally).\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 object 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    shape : tuple or None\n        If given, specifies the shape the attribute must be\n    ","endLoc":315,"id":12059,"nodeType":"Class","startLoc":257,"text":"class QuantityAttribute(Attribute):\n    \"\"\"\n    A frame attribute that is a quantity with specified units and shape\n    (optionally).\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 object 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    shape : tuple or None\n        If given, specifies the shape the attribute must be\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None, shape=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit\n        self.shape = shape\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        if np.all(value == 0) and self.unit is not None:\n            return u.Quantity(np.zeros(self.shape), self.unit), True\n        else:\n            if not hasattr(value, 'unit'):\n                raise TypeError('Tried to set a QuantityAttribute with '\n                                'something that does not have a unit.')\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                raise ValueError('The provided value has shape \"{0}\", but '\n                                 'should have shape \"{1}\"'.format(value.shape,\n                                                                  self.shape))\n            converted = oldvalue is not value\n            return value, converted"},{"col":4,"comment":"null","endLoc":279,"header":"def __init__(self, default=None, secondary_attribute='', unit=None, shape=None)","id":12060,"name":"__init__","nodeType":"Function","startLoc":276,"text":"def __init__(self, default=None, secondary_attribute='', unit=None, shape=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit\n        self.shape = shape"},{"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":315,"header":"def convert_input(self, value)","id":12061,"name":"convert_input","nodeType":"Function","startLoc":281,"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        if np.all(value == 0) and self.unit is not None:\n            return u.Quantity(np.zeros(self.shape), self.unit), True\n        else:\n            if not hasattr(value, 'unit'):\n                raise TypeError('Tried to set a QuantityAttribute with '\n                                'something that does not have a unit.')\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                raise ValueError('The provided value has shape \"{0}\", but '\n                                 'should have shape \"{1}\"'.format(value.shape,\n                                                                  self.shape))\n            converted = oldvalue is not value\n            return value, converted"},{"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    Parameter\n    ---------\n    birthday : `astropy.time.Time`\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object.\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    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":131,"header":"def horoscope(birthday, corrected=True)","id":12062,"name":"horoscope","nodeType":"Function","startLoc":64,"text":"def horoscope(birthday, corrected=True):\n    \"\"\"\n    Enter your birthday as an `astropy.time.Time` object and\n    receive a mystical horoscope about things to come.\n\n    Parameter\n    ---------\n    birthday : `astropy.time.Time`\n        Your birthday as a `datetime.datetime` or `astropy.time.Time` object.\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    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\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    birthday = atime.Time(birthday)\n    today = datetime.now()\n    if corrected:\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 = \"http://www.findyourfate.com/rss/dailyhoroscope-feed.php?sign={sign}&id=45\"\n\n    f = urlopen(url.format(sign=zodiac_sign.capitalize()))\n    try:  # urlopen in py2 is not a decorator\n        doc = parse(f)\n        item = doc.getElementsByTagName('item')[0]\n        desc = item.getElementsByTagName('description')[0].childNodes[0].nodeValue\n    except Exception:\n        raise CelestialError(\"Invalid response from celestial gods (failed to load horoscope).\")\n    finally:\n        f.close()\n\n    print(\"*\"*79)\n    color_print(\"Horoscope for {} on {}:\".format(zodiac_sign.capitalize(), today.strftime(\"%Y-%m-%d\")),\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":90,"header":"def _represent_as_dict(self)","id":12063,"name":"_represent_as_dict","nodeType":"Function","startLoc":71,"text":"def _represent_as_dict(self):\n        obj = self._parent\n        attrs = (list(obj.representation_component_names) +\n                 list(frame_transform_graph.frame_attributes.keys()))\n\n        # Don't output distance if it is all unitless 1.0\n        if 'distance' in attrs and np.all(obj.distance == 1.0):\n            attrs.remove('distance')\n\n        self._represent_as_dict_attrs = attrs\n\n        out = super()._represent_as_dict()\n\n        out['representation'] = obj.representation.get_name()\n        out['frame'] = obj.frame.name\n        # Note that obj.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"},{"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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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":1820,"id":12064,"nodeType":"Class","startLoc":1681,"text":"class FlatLambdaCDM(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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        LambdaCDM.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name,\n                           Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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        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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n        return (zp1 ** 3 * (Or * zp1 + Om0) + Ode0)**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Tcmb0={3:.4g}, \"\\\n                 \"Neff={4:.3g}, m_nu={5}, Ob0={6:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":1753,"header":"def __init__(self, H0, Om0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12065,"name":"__init__","nodeType":"Function","startLoc":1730,"text":"def __init__(self, H0, Om0, Tcmb0=0, Neff=3.04,\n                 m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        LambdaCDM.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name,\n                           Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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        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":"\n        Converts spherical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":1775,"header":"def to_cartesian(self)","id":12066,"name":"to_cartesian","nodeType":"Function","startLoc":1759,"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":4,"comment":"null","endLoc":41,"id":12067,"name":"attrs_from_parent","nodeType":"Attribute","startLoc":41,"text":"attrs_from_parent"},{"attributeType":"null","col":4,"comment":"null","endLoc":42,"id":12068,"name":"_supports_indexing","nodeType":"Attribute","startLoc":42,"text":"_supports_indexing"},{"attributeType":"null","col":8,"comment":"null","endLoc":80,"id":12069,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":80,"text":"self._represent_as_dict_attrs"},{"attributeType":"null","col":8,"comment":"null","endLoc":278,"id":12070,"name":"unit","nodeType":"Attribute","startLoc":278,"text":"self.unit"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":12071,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":12072,"name":"PLUS_MINUS_RE","nodeType":"Attribute","startLoc":27,"text":"PLUS_MINUS_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":28,"id":12073,"name":"J_PREFIXED_RA_DEC_RE","nodeType":"Attribute","startLoc":28,"text":"J_PREFIXED_RA_DEC_RE"},{"attributeType":"None","col":8,"comment":"null","endLoc":279,"id":12074,"name":"shape","nodeType":"Attribute","startLoc":279,"text":"self.shape"},{"col":0,"comment":"","endLoc":2,"header":"sky_coordinate.py#<anonymous>","id":12075,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"__all__ = ['SkyCoord', 'SkyCoordInfo']\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)"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to spherical polar\n        coordinates.\n        ","endLoc":1790,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":12076,"name":"from_cartesian","nodeType":"Function","startLoc":1777,"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)"},{"fileName":"attributes.py","filePath":"astropy/coordinates","id":12077,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# Dependencies\nimport numpy as np\nimport warnings\n\n# Project\nfrom .. import units as u\nfrom ..utils.exceptions import AstropyDeprecationWarning\nfrom ..utils import OrderedDescriptor, ShapedLikeNDArray\n\n__all__ = ['Attribute', 'TimeAttribute', 'QuantityAttribute',\n           'EarthLocationAttribute', 'CoordinateAttribute',\n           'CartesianRepresentationAttribute',\n           'DifferentialAttribute']\n\n\nclass Attribute(OrderedDescriptor):\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    _class_attribute_ = 'frame_attributes'\n    _name_attribute_ = 'name'\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 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\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        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)\n            if instance_shape is not None and (getattr(out, 'size', 1) > 1 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 {0} should be scalar or have shape {1}, \"\n                        \"but is has shape {2} 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 ..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                    'Invalid time input {0}={1!r}\\n{2}'.format(self.name,\n                                                               value, err))\n            converted = True\n\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 object 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, 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 (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 {0} 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    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 object 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    shape : tuple or None\n        If given, specifies the shape the attribute must be\n    \"\"\"\n\n    def __init__(self, default=None, secondary_attribute='', unit=None, shape=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit\n        self.shape = shape\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        if np.all(value == 0) and self.unit is not None:\n            return u.Quantity(np.zeros(self.shape), self.unit), True\n        else:\n            if not hasattr(value, 'unit'):\n                raise TypeError('Tried to set a QuantityAttribute with '\n                                'something that does not have a unit.')\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                raise ValueError('The provided value has shape \"{0}\", but '\n                                 'should have shape \"{1}\"'.format(value.shape,\n                                                                  self.shape))\n            converted = oldvalue is not value\n            return value, converted\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('\"{0}\" 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    low-level frame class *or* a `~astropy.coordinates.SkyCoord`, but will\n    always be converted to the low-level frame class when accessed.\n\n    Parameters\n    ----------\n    frame : a coordinate frame 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        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{0}\" was passed into a '\n                                 'CoordinateAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            transformedobj = value.transform_to(self._frame)\n            if hasattr(transformedobj, 'frame'):\n                transformedobj = transformedobj.frame\n            return transformedobj, 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 not isinstance(value, self.allowed_classes):\n            raise TypeError('Tried to set a DifferentialAttribute with '\n                            'an unsupported Differential type {0}. Allowed '\n                            'classes are: {1}'\n                            .format(value.__class__,\n                                    self.allowed_classes))\n\n        return value, True\n\n\n# Backwards-compatibility: these are the only classes that were previously\n# released in v1.3\nclass FrameAttribute(Attribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"FrameAttribute has been renamed to Attribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n\nclass TimeFrameAttribute(TimeAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"TimeFrameAttribute has been renamed to TimeAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n\nclass QuantityFrameAttribute(QuantityAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"QuantityFrameAttribute has been renamed to \"\n                      \"QuantityAttribute.\", AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\n\nclass CartesianRepresentationFrameAttribute(CartesianRepresentationAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"CartesianRepresentationFrameAttribute has been renamed \"\n                      \"to CartesianRepresentationAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)\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":"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 rather than referenced.\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":2187,"id":12078,"nodeType":"Class","startLoc":1950,"text":"class BaseDifferential(BaseRepresentationOrDifferential,\n                       metaclass=MetaBaseDifferential):\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 rather than referenced.\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    recommended_units = {}  # subclasses can override\n\n    @classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(\"Differential class {0} is not compatible with the \"\n                            \"base (representation) class {1}\"\n                            .format(cls, 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, 'd_{0}'.format(name), None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n                # Get the si unit without a scale by going via Quantity;\n                # `.si` causes the scale to be included in the value.\n                return str(u.Quantity(1., d_unit).si.unit)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential match! Not \"\n                               \"sure how we got into this state.\")\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        This object as a `CartesianDifferential`\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 : 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        A new differential object that is this class' type.\n        \"\"\"\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``, optional\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            base = base.represent_as(other_class.base_representation)\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 _scale_operation(self, op, *args):\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        \"\"\"\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` 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.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return self.to_cartesian(base).norm()"},{"col":4,"comment":"null","endLoc":1984,"header":"@classmethod\n    def _check_base(cls, base)","id":12079,"name":"_check_base","nodeType":"Function","startLoc":1979,"text":"@classmethod\n    def _check_base(cls, base):\n        if cls not in base._compatible_differentials:\n            raise TypeError(\"Differential class {0} is not compatible with the \"\n                            \"base (representation) class {1}\"\n                            .format(cls, 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":2007,"header":"def _get_deriv_key(self, base)","id":12080,"name":"_get_deriv_key","nodeType":"Function","startLoc":1986,"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, 'd_{0}'.format(name), None)\n            if d_comp is not None:\n                d_unit = comp.unit / d_comp.unit\n                # Get the si unit without a scale by going via Quantity;\n                # `.si` causes the scale to be included in the value.\n                return str(u.Quantity(1., d_unit).si.unit)\n\n        else:\n            raise RuntimeError(\"Invalid representation-differential match! Not \"\n                               \"sure how we got into this state.\")"},{"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":1804,"header":"def norm(self)","id":12081,"name":"norm","nodeType":"Function","startLoc":1792,"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)"},{"col":4,"comment":" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        ","endLoc":1785,"header":"def efunc(self, z)","id":12082,"name":"efunc","nodeType":"Function","startLoc":1755,"text":"def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        # We override this because it takes a particularly simple\n        # form for a cosmological constant\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1 + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + Ode0)"},{"col":4,"comment":"null","endLoc":509,"header":"def __init__(self, *args, **kwargs)","id":12083,"name":"__init__","nodeType":"Function","startLoc":506,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn(\"QuantityFrameAttribute has been renamed to \"\n                      \"QuantityAttribute.\", AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"attributeType":"null","col":4,"comment":"null","endLoc":1682,"id":12084,"name":"attr_classes","nodeType":"Attribute","startLoc":1682,"text":"attr_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1685,"id":12085,"name":"recommended_units","nodeType":"Attribute","startLoc":1685,"text":"recommended_units"},{"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":2031,"header":"@classmethod\n    def _get_base_vectors(cls, base)","id":12086,"name":"_get_base_vectors","nodeType":"Function","startLoc":2009,"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()"},{"col":4,"comment":"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":1813,"header":"def inv_efunc(self, z)","id":12087,"name":"inv_efunc","nodeType":"Function","startLoc":1787,"text":"def inv_efunc(self, z):\n        r\"\"\"Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0 = self._Om0, self._Ode0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n        return (zp1 ** 3 * (Or * zp1 + Om0) + Ode0)**(-0.5)"},{"attributeType":"null","col":12,"comment":"null","endLoc":1703,"id":12088,"name":"_r","nodeType":"Attribute","startLoc":1703,"text":"self._r"},{"attributeType":"null","col":12,"comment":"null","endLoc":1692,"id":12089,"name":"_phi","nodeType":"Attribute","startLoc":1692,"text":"self._phi"},{"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 rather than referenced.\n    ","endLoc":1907,"id":12090,"nodeType":"Class","startLoc":1807,"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 rather than referenced.\n    \"\"\"\n\n    attr_classes = OrderedDict([('rho', u.Quantity),\n                                ('phi', Angle),\n                                ('z', u.Quantity)])\n    recommended_units = {'phi': u.deg}\n\n    def __init__(self, rho, phi, z, 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 OrderedDict(\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 OrderedDict((('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)"},{"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        This object as a `CartesianDifferential`\n        ","endLoc":2049,"header":"def to_cartesian(self, base)","id":12091,"name":"to_cartesian","nodeType":"Function","startLoc":2033,"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        This object as a `CartesianDifferential`\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":1847,"header":"def __init__(self, rho, phi, z, differentials=None, copy=True)","id":12092,"name":"__init__","nodeType":"Function","startLoc":1843,"text":"def __init__(self, rho, phi, z, 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\")"},{"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 : 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        A new differential object that is this class' type.\n        ","endLoc":2070,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":12093,"name":"from_cartesian","nodeType":"Function","startLoc":2051,"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 : 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        A new differential object that is this class' type.\n        \"\"\"\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)"},{"col":4,"comment":"null","endLoc":1820,"header":"def __repr__(self)","id":12094,"name":"__repr__","nodeType":"Function","startLoc":1815,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Tcmb0={3:.4g}, \"\\\n                 \"Neff={4:.3g}, m_nu={5}, Ob0={6:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"attributeType":"null","col":12,"comment":"null","endLoc":1749,"id":12095,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":1749,"text":"self._inv_efunc_scalar"},{"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":368,"id":12096,"nodeType":"Class","startLoc":317,"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('\"{0}\" 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":"\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":368,"header":"def convert_input(self, value)","id":12097,"name":"convert_input","nodeType":"Function","startLoc":333,"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('\"{0}\" 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":"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``, optional\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":2096,"header":"def represent_as(self, other_class, base)","id":12098,"name":"represent_as","nodeType":"Function","startLoc":2072,"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``, optional\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            base = base.represent_as(other_class.base_representation)\n            return other_class.from_cartesian(self_cartesian, base)\n        else:\n            return other_class.from_cartesian(self_cartesian)"},{"className":"CoordinateAttribute","col":0,"comment":"\n    A frame attribute which is a coordinate object. It can be given as a\n    low-level frame class *or* a `~astropy.coordinates.SkyCoord`, but will\n    always be converted to the low-level frame class when accessed.\n\n    Parameters\n    ----------\n    frame : a coordinate frame 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":425,"id":12099,"nodeType":"Class","startLoc":371,"text":"class CoordinateAttribute(Attribute):\n    \"\"\"\n    A frame attribute which is a coordinate object. It can be given as a\n    low-level frame class *or* a `~astropy.coordinates.SkyCoord`, but will\n    always be converted to the low-level frame class when accessed.\n\n    Parameters\n    ----------\n    frame : a coordinate frame 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        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{0}\" was passed into a '\n                                 'CoordinateAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            transformedobj = value.transform_to(self._frame)\n            if hasattr(transformedobj, 'frame'):\n                transformedobj = transformedobj.frame\n            return transformedobj, 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":425,"header":"def convert_input(self, value)","id":12100,"name":"convert_input","nodeType":"Function","startLoc":392,"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        if value is None:\n            return None, False\n        elif isinstance(value, self._frame):\n            return value, False\n        else:\n            if not hasattr(value, 'transform_to'):\n                raise ValueError('\"{0}\" was passed into a '\n                                 'CoordinateAttribute, but it does not have '\n                                 '\"transform_to\" method'.format(value))\n            transformedobj = value.transform_to(self._frame)\n            if hasattr(transformedobj, 'frame'):\n                transformedobj = transformedobj.frame\n            return transformedobj, True"},{"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":2117,"header":"@classmethod\n    def from_representation(cls, representation, base)","id":12101,"name":"from_representation","nodeType":"Function","startLoc":2098,"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)"},{"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        ","endLoc":2131,"header":"def _scale_operation(self, op, *args)","id":12102,"name":"_scale_operation","nodeType":"Function","startLoc":2119,"text":"def _scale_operation(self, op, *args):\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        \"\"\"\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        The distance of the point(s) from the z-axis.\n        ","endLoc":1854,"header":"@property\n    def rho(self)","id":12103,"name":"rho","nodeType":"Function","startLoc":1849,"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":1861,"header":"@property\n    def phi(self)","id":12104,"name":"phi","nodeType":"Function","startLoc":1856,"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":1868,"header":"@property\n    def z(self)","id":12105,"name":"z","nodeType":"Function","startLoc":1863,"text":"@property\n    def z(self):\n        \"\"\"\n        The height of the point(s).\n        \"\"\"\n        return self._z"},{"col":4,"comment":"null","endLoc":1876,"header":"def unit_vectors(self)","id":12106,"name":"unit_vectors","nodeType":"Function","startLoc":1870,"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 OrderedDict(\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))))"},{"attributeType":"null","col":8,"comment":"null","endLoc":389,"id":12107,"name":"_frame","nodeType":"Attribute","startLoc":389,"text":"self._frame"},{"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` 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":2161,"header":"def _combine_operation(self, op, other, reverse=False)","id":12108,"name":"_combine_operation","nodeType":"Function","startLoc":2133,"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` 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)"},{"className":"CartesianRepresentationFrameAttribute","col":0,"comment":"null","endLoc":517,"id":12109,"nodeType":"Class","startLoc":511,"text":"class CartesianRepresentationFrameAttribute(CartesianRepresentationAttribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"CartesianRepresentationFrameAttribute has been renamed \"\n                      \"to CartesianRepresentationAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"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 object 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":254,"id":12110,"nodeType":"Class","startLoc":192,"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 object 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, 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 (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 {0} 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":210,"header":"def __init__(self, default=None, secondary_attribute='', unit=None)","id":12111,"name":"__init__","nodeType":"Function","startLoc":208,"text":"def __init__(self, default=None, secondary_attribute='', unit=None):\n        super().__init__(default, secondary_attribute)\n        self.unit = unit"},{"attributeType":"null","col":12,"comment":"null","endLoc":1750,"id":12112,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":1750,"text":"self._inv_efunc_scalar_args"},{"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, 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":254,"header":"def convert_input(self, value)","id":12113,"name":"convert_input","nodeType":"Function","startLoc":212,"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, 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 (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 {0} 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":2167,"header":"def __sub__(self, other)","id":12114,"name":"__sub__","nodeType":"Function","startLoc":2163,"text":"def __sub__(self, other):\n        # avoid \"differential - representation\".\n        if isinstance(other, BaseRepresentation):\n            return NotImplemented\n        return super().__sub__(other)"},{"col":4,"comment":"null","endLoc":1883,"header":"def scale_factors(self)","id":12115,"name":"scale_factors","nodeType":"Function","startLoc":1878,"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 OrderedDict((('rho', l),\n                            ('phi', rho),\n                            ('z', l)))"},{"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.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        ","endLoc":2187,"header":"def norm(self, base=None)","id":12116,"name":"norm","nodeType":"Function","startLoc":2169,"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.\n\n        Returns\n        -------\n        norm : `astropy.units.Quantity`\n            Vector norm, with the same shape as the representation.\n        \"\"\"\n        return self.to_cartesian(base).norm()"},{"col":4,"comment":"\n        Converts 3D rectangular cartesian coordinates to cylindrical polar\n        coordinates.\n        ","endLoc":1896,"header":"@classmethod\n    def from_cartesian(cls, cart)","id":12117,"name":"from_cartesian","nodeType":"Function","startLoc":1885,"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":1977,"id":12118,"name":"recommended_units","nodeType":"Attribute","startLoc":1977,"text":"recommended_units"},{"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":485,"id":12119,"nodeType":"Class","startLoc":428,"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 not isinstance(value, self.allowed_classes):\n            raise TypeError('Tried to set a DifferentialAttribute with '\n                            'an unsupported Differential type {0}. Allowed '\n                            'classes are: {1}'\n                            .format(value.__class__,\n                                    self.allowed_classes))\n\n        return value, True"},{"col":4,"comment":"null","endLoc":454,"header":"def __init__(self, default=None, allowed_classes=None,\n                 secondary_attribute='')","id":12120,"name":"__init__","nodeType":"Function","startLoc":446,"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)"},{"col":4,"comment":"\n        Converts cylindrical polar coordinates to 3D rectangular cartesian\n        coordinates.\n        ","endLoc":1907,"header":"def to_cartesian(self)","id":12121,"name":"to_cartesian","nodeType":"Function","startLoc":1898,"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":"\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":485,"header":"def convert_input(self, value)","id":12122,"name":"convert_input","nodeType":"Function","startLoc":456,"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 not isinstance(value, self.allowed_classes):\n            raise TypeError('Tried to set a DifferentialAttribute with '\n                            'an unsupported Differential type {0}. Allowed '\n                            'classes are: {1}'\n                            .format(value.__class__,\n                                    self.allowed_classes))\n\n        return value, True"},{"attributeType":"BaseDifferential","col":12,"comment":"null","endLoc":452,"id":12123,"name":"allowed_classes","nodeType":"Attribute","startLoc":452,"text":"self.allowed_classes"},{"attributeType":"null","col":4,"comment":"null","endLoc":1838,"id":12124,"name":"attr_classes","nodeType":"Attribute","startLoc":1838,"text":"attr_classes"},{"className":"FrameAttribute","col":0,"comment":"null","endLoc":495,"id":12125,"nodeType":"Class","startLoc":490,"text":"class FrameAttribute(Attribute):\n\n    def __init__(self, *args, **kwargs):\n        warnings.warn(\"FrameAttribute has been renamed to Attribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":495,"header":"def __init__(self, *args, **kwargs)","id":12126,"name":"__init__","nodeType":"Function","startLoc":492,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn(\"FrameAttribute has been renamed to Attribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":12127,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"attributes.py#<anonymous>","id":12128,"name":"<anonymous>","nodeType":"Function","startLoc":6,"text":"__all__ = ['Attribute', 'TimeAttribute', 'QuantityAttribute',\n           'EarthLocationAttribute', 'CoordinateAttribute',\n           'CartesianRepresentationAttribute',\n           'DifferentialAttribute']"},{"attributeType":"null","col":4,"comment":"null","endLoc":1841,"id":12129,"name":"recommended_units","nodeType":"Attribute","startLoc":1841,"text":"recommended_units"},{"attributeType":"None","col":8,"comment":"null","endLoc":801,"id":12130,"name":"finite_difference_frameattr_name","nodeType":"Attribute","startLoc":801,"text":"self.finite_difference_frameattr_name"},{"className":"MetaBaseDifferential","col":0,"comment":"Set default ``attr_classes`` and component getters on a Differential.\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":1947,"id":12131,"nodeType":"Class","startLoc":1910,"text":"class MetaBaseDifferential(InheritDocstrings, abc.ABCMeta):\n    \"\"\"Set default ``attr_classes`` and component getters on a Differential.\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    def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if 'base_representation' not in dct:\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 = OrderedDict([('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(\"Differential class {0} already defined\"\n                             .format(repr_name))\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\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=(\"Component '{0}' of the Differential.\"\n                                      .format(component))))"},{"attributeType":"null","col":8,"comment":"null","endLoc":802,"id":12132,"name":"finite_difference_dt","nodeType":"Attribute","startLoc":802,"text":"self.finite_difference_dt"},{"attributeType":"null","col":8,"comment":"null","endLoc":803,"id":12133,"name":"symmetric_finite_difference","nodeType":"Attribute","startLoc":803,"text":"self.symmetric_finite_difference"},{"col":4,"comment":"null","endLoc":1947,"header":"def __init__(cls, name, bases, dct)","id":12134,"name":"__init__","nodeType":"Function","startLoc":1916,"text":"def __init__(cls, name, bases, dct):\n        super().__init__(name, bases, dct)\n\n        # Don't do anything for base helper classes.\n        if cls.__name__ in ('BaseDifferential', 'BaseSphericalDifferential',\n                            'BaseSphericalCosLatDifferential'):\n            return\n\n        if 'base_representation' not in dct:\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 = OrderedDict([('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(\"Differential class {0} already defined\"\n                             .format(repr_name))\n\n        DIFFERENTIAL_CLASSES[repr_name] = cls\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=(\"Component '{0}' of the Differential.\"\n                                      .format(component))))"},{"attributeType":"None","col":8,"comment":"null","endLoc":824,"id":12135,"name":"_finite_difference_frameattr_name","nodeType":"Attribute","startLoc":824,"text":"self._finite_difference_frameattr_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":210,"id":12136,"name":"unit","nodeType":"Attribute","startLoc":210,"text":"self.unit"},{"col":4,"comment":"null","endLoc":517,"header":"def __init__(self, *args, **kwargs)","id":12137,"name":"__init__","nodeType":"Function","startLoc":513,"text":"def __init__(self, *args, **kwargs):\n        warnings.warn(\"CartesianRepresentationFrameAttribute has been renamed \"\n                      \"to CartesianRepresentationAttribute.\",\n                      AstropyDeprecationWarning)\n        super().__init__(*args, **kwargs)"},{"attributeType":"null","col":41,"comment":"null","endLoc":812,"id":12138,"name":"_diff_attr_in_tosys","nodeType":"Attribute","startLoc":812,"text":"self._diff_attr_in_tosys"},{"attributeType":"null","col":12,"comment":"null","endLoc":1931,"id":12139,"name":"attr_classes","nodeType":"Attribute","startLoc":1931,"text":"cls.attr_classes"},{"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 rather than referenced.\n    ","endLoc":2263,"id":12140,"nodeType":"Class","startLoc":2190,"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 rather than referenced.\n    \"\"\"\n    base_representation = CartesianRepresentation\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 xyz_axis is not None and xyz_axis != 0:\n                d_x = np.rollaxis(d_x, xyz_axis, 0)\n            d_x, d_y, d_z = d_x\n        elif 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        elif ((d_y is None and d_z is not None) or\n              (d_y is not None and d_z is None)):\n            raise ValueError(\"d_x, d_y, and d_z are required to instantiate {0}\"\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 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        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.\n        \"\"\"\n        return _combine_xyz(self._d_x, self._d_y, self._d_z, xyz_axis=xyz_axis)\n\n    d_xyz = property(get_d_xyz)"},{"attributeType":"null","col":12,"comment":"null","endLoc":812,"id":12141,"name":"_diff_attr_in_fromsys","nodeType":"Attribute","startLoc":812,"text":"self._diff_attr_in_fromsys"},{"col":4,"comment":"null","endLoc":2241,"header":"def to_cartesian(self, base=None)","id":12142,"name":"to_cartesian","nodeType":"Function","startLoc":2239,"text":"def to_cartesian(self, base=None):\n        return CartesianRepresentation(*[getattr(self, c) for c\n                                         in self.components])"},{"className":"FrameMeta","col":0,"comment":"null","endLoc":185,"id":12143,"nodeType":"Class","startLoc":109,"text":"class FrameMeta(OrderedDescriptorContainer, abc.ABCMeta):\n    def __new__(mcls, name, bases, members):\n        if 'default_representation' in members:\n            default_repr = members.pop('default_representation')\n            found_default_repr = True\n        else:\n            default_repr = None\n            found_default_repr = False\n\n        if 'default_differential' in members:\n            default_diff = members.pop('default_differential')\n            found_default_diff = True\n        else:\n            default_diff = None\n            found_default_diff = False\n\n        if 'frame_specific_representation_info' in members:\n            repr_info = members.pop('frame_specific_representation_info')\n            found_repr_info = True\n        else:\n            repr_info = None\n            found_repr_info = False\n\n        # somewhat hacky, but this is the best way to get the MRO according to\n        # https://mail.python.org/pipermail/python-list/2002-December/167861.html\n        tmp_cls = super().__new__(mcls, name, bases, members)\n\n        # now look through the whole MRO for the class attributes, raw for\n        # frame_attr_names, and leading underscore for others\n        for m in (c.__dict__ for c in tmp_cls.__mro__):\n            if not found_default_repr and '_default_representation' in m:\n                default_repr = m['_default_representation']\n                found_default_repr = True\n\n            if not found_default_diff and '_default_differential' in m:\n                default_diff = m['_default_differential']\n                found_default_diff = True\n\n            if (not found_repr_info and\n                    '_frame_specific_representation_info' in m):\n                repr_info = m['_frame_specific_representation_info']\n                found_repr_info = True\n\n            if found_default_repr and found_default_diff and found_repr_info:\n                break\n        else:\n            raise ValueError(\n                'Could not find all expected BaseCoordinateFrame class '\n                'attributes.  Are you mis-using FrameMeta?')\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        mcls.readonly_prop_factory(members, 'default_representation',\n                                   default_repr)\n        mcls.readonly_prop_factory(members, 'default_differential',\n                                   default_diff)\n        mcls.readonly_prop_factory(members,\n                                   'frame_specific_representation_info',\n                                   copy.deepcopy(repr_info))\n\n        # now set the frame name as lower-case class name, if it isn't explicit\n        if 'name' not in members:\n            members['name'] = name.lower()\n\n        return super().__new__(mcls, name, bases, members)\n\n    @staticmethod\n    def readonly_prop_factory(members, attr, value):\n        private_attr = '_' + attr\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        members[private_attr] = value\n        members[attr] = property(getter)"},{"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 ``_apply_transform()`` method, but have\n    different ``__call__()`` methods. ``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":1073,"id":12144,"nodeType":"Class","startLoc":911,"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 ``_apply_transform()`` method, but have\n    different ``__call__()`` methods. ``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        # 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 coordiante frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {0})\"\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: {0})\"\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: {0}).\"\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"},{"col":4,"comment":"null","endLoc":1073,"header":"def _apply_transform(self, fromcoord, matrix, offset)","id":12145,"name":"_apply_transform","nodeType":"Function","startLoc":924,"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        # 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 coordiante frame \"\n                            \"is insufficient to do a full-space position \"\n                            \"transformation (representation class: {0})\"\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: {0})\"\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: {0}).\"\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"},{"col":4,"comment":"null","endLoc":175,"header":"def __new__(mcls, name, bases, members)","id":12146,"name":"__new__","nodeType":"Function","startLoc":110,"text":"def __new__(mcls, name, bases, members):\n        if 'default_representation' in members:\n            default_repr = members.pop('default_representation')\n            found_default_repr = True\n        else:\n            default_repr = None\n            found_default_repr = False\n\n        if 'default_differential' in members:\n            default_diff = members.pop('default_differential')\n            found_default_diff = True\n        else:\n            default_diff = None\n            found_default_diff = False\n\n        if 'frame_specific_representation_info' in members:\n            repr_info = members.pop('frame_specific_representation_info')\n            found_repr_info = True\n        else:\n            repr_info = None\n            found_repr_info = False\n\n        # somewhat hacky, but this is the best way to get the MRO according to\n        # https://mail.python.org/pipermail/python-list/2002-December/167861.html\n        tmp_cls = super().__new__(mcls, name, bases, members)\n\n        # now look through the whole MRO for the class attributes, raw for\n        # frame_attr_names, and leading underscore for others\n        for m in (c.__dict__ for c in tmp_cls.__mro__):\n            if not found_default_repr and '_default_representation' in m:\n                default_repr = m['_default_representation']\n                found_default_repr = True\n\n            if not found_default_diff and '_default_differential' in m:\n                default_diff = m['_default_differential']\n                found_default_diff = True\n\n            if (not found_repr_info and\n                    '_frame_specific_representation_info' in m):\n                repr_info = m['_frame_specific_representation_info']\n                found_repr_info = True\n\n            if found_default_repr and found_default_diff and found_repr_info:\n                break\n        else:\n            raise ValueError(\n                'Could not find all expected BaseCoordinateFrame class '\n                'attributes.  Are you mis-using FrameMeta?')\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        mcls.readonly_prop_factory(members, 'default_representation',\n                                   default_repr)\n        mcls.readonly_prop_factory(members, 'default_differential',\n                                   default_diff)\n        mcls.readonly_prop_factory(members,\n                                   'frame_specific_representation_info',\n                                   copy.deepcopy(repr_info))\n\n        # now set the frame name as lower-case class name, if it isn't explicit\n        if 'name' not in members:\n            members['name'] = name.lower()\n\n        return super().__new__(mcls, name, bases, members)"},{"fileName":"matching.py","filePath":"astropy/coordinates","id":12147,"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 .. import units as u\nfrom . import Angle\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 : integer 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`\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    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    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 : integer 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`\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    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` with distance units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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 : `~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    seplimit : `~astropy.units.Quantity` with angle units\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 : integer array\n        Indices into ``coords1`` that matches to the corresponding element of\n        ``idx2``. Shape matches ``idx2``.\n    idx2 : integer 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`\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/>`_ (>=0.12.0)\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('The `attrname_or_kdt` \"{0}\" is not a scipy KD tree!'.format(attrname_or_kdt))\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        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"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12148,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"matching.py#<anonymous>","id":12149,"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']"},{"fileName":"__init__.py","filePath":"astropy/coordinates","id":12150,"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 *\n\n# This is for backwards-compatibility -- can be removed in v3.0 when the\n# deprecation warnings are removed\nfrom .attributes import (TimeFrameAttribute, QuantityFrameAttribute,\n                         CartesianRepresentationFrameAttribute)\n\n__doc__ += builtin_frames._transform_graph_docs + \"\"\"\n\n.. note::\n\n    The ecliptic coordinate systems (added in Astropy v1.1) have not been\n    extensively tested for accuracy or consistency with other implementations of\n    ecliptic coordinates.  We welcome contributions to add such testing, but in\n    the meantime, users who depend on consistency with other implementations may\n    wish to check test inputs against good datasets before using Astropy's\n    ecliptic coordinates.\n\n\"\"\"\n"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":12151,"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\"\"\"\n\n__doc__ += builtin_frames._transform_graph_docs + \"\"\"\n\n.. note::\n\n    The ecliptic coordinate systems (added in Astropy v1.1) have not been\n    extensively tested for accuracy or consistency with other implementations of\n    ecliptic coordinates.  We welcome contributions to add such testing, but in\n    the meantime, users who depend on consistency with other implementations may\n    wish to check test inputs against good datasets before using Astropy's\n    ecliptic coordinates.\n\n\"\"\""},{"fileName":"earth.py","filePath":"astropy/coordinates","id":12152,"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\nfrom .. import units as u\nfrom .. import constants as consts\nfrom ..units.quantity import QuantityInfoBase\nfrom ..utils.exceptions import AstropyUserWarning\nfrom ..utils.compat.numpycompat import NUMPY_LT_1_12\nfrom .angles import Longitude, Latitude\nfrom .representation import CartesianRepresentation, CartesianDifferential\nfrom .errors import UnknownSiteException\nfrom ..utils import data, deprecated\n\ntry:\n    # Not guaranteed available at setup time.\n    from .. import _erfa as erfa\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n\n__all__ = ['EarthLocation']\n\nGeodeticLocation = collections.namedtuple('GeodeticLocation', ['lon', 'lat', 'height'])\n\n# Available ellipsoids (defined in erfam.h, with numbers exposed in erfa).\nELLIPSOIDS = ('WGS84', 'GRS80', 'WGS72')\n\nOMEGA_EARTH = u.Quantity(7.292115855306589e-5, 1./u.s)\n\"\"\"\nRotational velocity of Earth. In UT1 seconds, this would be 2 pi / (24 * 3600),\nbut we need the value in SI seconds.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth Seidelmann (1992),\nUniversity Science Books.\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('Ellipsoid {0} not among known ones ({1})'\n                         .format(ellipsoid, ELLIPSOIDS))\n    return ellipsoid\n\n\ndef _get_json_result(url, err_str):\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\"))\n        else:\n            raise NameResolveError(err_str.format(msg=e.reason))\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    results = resp_data.get('results', [])\n\n    if not results:\n        raise NameResolveError(err_str.format(msg=\"no results returned\"))\n\n    if resp_data.get('status', None) != 'OK':\n        raise NameResolveError(err_str.format(msg=\"unknown failure with Google maps API\"))\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 \"{0}\" and \"{1}\"'\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 : `~astropy.units.UnitBase` object 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.\")\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` 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        lon = Longitude(lon, u.degree, wrap_angle=180*u.degree, copy=False)\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        # convert to float in units required for erfa routine, and ensure\n        # all broadcast to same shape, and are at least 1-dimensional.\n        _lon, _lat, _height = np.broadcast_arrays(lon.to_value(u.radian),\n                                                  lat.to_value(u.radian),\n                                                  height.to_value(u.m))\n        # get geocentric coordinates. Have to give one-dimensional array.\n        xyz = erfa.gd2gc(getattr(erfa, ellipsoid), _lon.ravel(),\n                                 _lat.ravel(), _height.ravel())\n        self = xyz.view(cls._location_dtype, cls).reshape(_lon.shape)\n        self._unit = u.meter\n        self._ellipsoid = ellipsoid\n        return self.to(height.unit)\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        .. 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 : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the observatory.\n\n        See Also\n        --------\n        get_site_names : the list of sites that this function can access\n        \"\"\"\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', close_names=e.close_names)\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):\n        \"\"\"\n        Return an object of this class for a given address by querying the Google\n        maps geocoding API.\n\n        This is intended as a quick convenience function to get fast access to\n        locations. In the background, this just issues a query to the Google maps\n        geocoding API. It is not meant to be abused! Google uses IP-based query\n        limiting and will ban your IP if you send more than a few thousand queries\n        per hour [1]_.\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** returned\n            location.\n\n        Parameters\n        ----------\n        address : str\n            The address to get the location for. As per the Google maps API, this\n            can be a fully specified street address (e.g., 123 Main St., New York,\n            NY) or a city name (e.g., Danbury, CT), or etc.\n        get_height : bool (optional)\n            Use the retrieved location to perform a second query to the Google maps\n            elevation API to retrieve the height of the input address [2]_.\n\n        Returns\n        -------\n        location : This class (a `~astropy.coordinates.EarthLocation` or subclass)\n            The location of the input address.\n\n        References\n        ----------\n        .. [1] https://developers.google.com/maps/documentation/geocoding/intro\n        .. [2] https://developers.google.com/maps/documentation/elevation/intro\n\n        \"\"\"\n\n        pars = urllib.parse.urlencode({'address': address})\n        geo_url = \"https://maps.googleapis.com/maps/api/geocode/json?{0}\".format(pars)\n\n        # get longitude and latitude location\n        err_str = (\"Unable to retrieve coordinates for address '{address}'; {{msg}}\"\n                   .format(address=address))\n        geo_result = _get_json_result(geo_url, err_str=err_str)\n        loc = geo_result[0]['geometry']['location']\n\n        if get_height:\n            pars = {'locations': '{lat:.8f},{lng:.8f}'.format(lat=loc['lat'],\n                                                              lng=loc['lng'])}\n            pars = urllib.parse.urlencode(pars)\n            ele_url = \"https://maps.googleapis.com/maps/api/elevation/json?{0}\".format(pars)\n\n            err_str = (\"Unable to retrieve elevation for address '{address}'; {{msg}}\"\n                       .format(address=address))\n            ele_result = _get_json_result(ele_url, err_str=err_str)\n            height = ele_result[0]['elevation']*u.meter\n\n        else:\n            height = 0.\n\n        return cls.from_geodetic(lon=loc['lng']*u.degree,\n                                 lat=loc['lat']*u.degree,\n                                 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        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) : tuple\n            The tuple contains 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        self_array = self.to(u.meter).view(self._array_dtype, np.ndarray)\n        lon, lat, height = erfa.gc2gd(getattr(erfa, ellipsoid), self_array)\n        return GeodeticLocation(\n            Longitude(lon * u.radian, u.degree,\n                      wrap_angle=180.*u.degree, copy=False),\n            Latitude(lat * u.radian, u.degree, copy=False),\n            u.Quantity(height * u.meter, self.unit, copy=False))\n\n    @property\n    @deprecated('2.0', alternative='`lon`', obj_type='property')\n    def longitude(self):\n        \"\"\"Longitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[0]\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    @deprecated('2.0', alternative='`lat`', obj_type='property')\n    def latitude(self):\n        \"\"\"Latitude of the location, for the default ellipsoid.\"\"\"\n        return self.geodetic[1]\n\n    @property\n    def lat(self):\n        \"\"\"Longitude 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.size > 1:\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\n        itrs = self.get_itrs(obstime)\n        # Assume the observatory itself is fixed on the ground.\n        # We do a direct assignment rather than an update to avoid validation\n        # and creation of a new object.\n        zeros = np.broadcast_to(0. * u.km / u.s, (3,) + itrs.shape, subok=True)\n        itrs.data.differentials['s'] = CartesianDifferential(zeros)\n        return itrs.transform_to(GCRS(obstime=obstime))\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        # GCRS position\n        gcrs_data = self._get_gcrs(obstime).data\n        obsgeopos = gcrs_data.without_differentials()\n        obsgeovel = gcrs_data.differentials['s'].to_cartesian()\n        return obsgeopos, obsgeovel\n\n    def _gravitational_redshift(self, obstime):\n        \"\"\"Return the gravitational redshift at this EarthLocation.\n\n        Calculates the gravitational redshift, of order 3 m/s, due to the Sun,\n        Jupiter, the Moon, and the Earth itself.\n\n        Parameters\n        ----------\n        obstime : `~astropy.time.Time`\n            The ``obstime`` to calculate the redshift at.\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        names = ('sun', 'jupiter', 'moon', 'earth')\n        GM_moon = consts.G * 7.34767309e22*u.kg\n        masses = (consts.GM_sun, consts.GM_jup, GM_moon, consts.GM_earth)\n        positions = [get_body_barycentric(name, obstime) for name in names]\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(masses, distances)]\n        return sum(redshifts)\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    if NUMPY_LT_1_12:\n        def __repr__(self):\n            # Use the numpy >=1.12 way to format structured arrays.\n            from .representation import _array2string\n            prefixstr = '<' + self.__class__.__name__ + ' '\n            arrstr = _array2string(self.view(np.ndarray), prefix=prefixstr)\n            return '{0}{1}{2:s}>'.format(prefixstr, arrstr, self._unitstr)\n\n\n# need to do this here at the bottom to avoid circular dependencies\nfrom .sites import get_builtin_sites, get_downloaded_sites\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":1737,"id":12153,"name":"_Ok0","nodeType":"Attribute","startLoc":1737,"text":"self._Ok0"},{"col":4,"comment":"null","endLoc":2245,"header":"@classmethod\n    def from_cartesian(cls, other, base=None)","id":12154,"name":"from_cartesian","nodeType":"Function","startLoc":2243,"text":"@classmethod\n    def from_cartesian(cls, other, base=None):\n        return cls(*[getattr(other, c) for c in other.components])"},{"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":149,"id":12155,"nodeType":"Class","startLoc":87,"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":101,"header":"def _construct_from_dict(self, map)","id":12156,"name":"_construct_from_dict","nodeType":"Function","startLoc":95,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":1736,"id":12157,"name":"_Ode0","nodeType":"Attribute","startLoc":1736,"text":"self._Ode0"},{"className":"wCDM","col":0,"comment":"FLRW cosmology with a constant dark energy equation of state\n    and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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":2029,"id":12158,"nodeType":"Class","startLoc":1823,"text":"class wCDM(FLRW):\n    \"\"\"FLRW cosmology with a constant dark energy equation of state\n    and curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    def __init__(self, H0, Om0, Ode0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state\"\"\"\n        return self._w0\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_0`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return self._w0\n        else:\n            return self._w0 * np.ones(np.asanyarray(z).shape)\n\n    def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        return (1. + z) ** (3. * (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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * zp1 ** (3. * (1. + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, w0={4:.3g}, \"\\\n                 \"Tcmb0={5:.4g}, Neff={6:.3g}, m_nu={7}, Ob0={8:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._Tcmb0, self._Neff,\n                             self.m_nu, _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":1906,"header":"def __init__(self, H0, Om0, Ode0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12159,"name":"__init__","nodeType":"Function","startLoc":1883,"text":"def __init__(self, H0, Om0, Ode0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n\n        # Please see \"Notes about speeding up 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)"},{"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":149,"header":"def new_like(self, cols, length, metadata_conflicts='warn', name=None)","id":12160,"name":"new_like","nodeType":"Function","startLoc":103,"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"},{"col":4,"comment":" Dark energy equation of state","endLoc":1911,"header":"@property\n    def w0(self)","id":12161,"name":"w0","nodeType":"Function","startLoc":1908,"text":"@property\n    def w0(self):\n        \"\"\" Dark energy equation of state\"\"\"\n        return self._w0"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_0`.\n        ","endLoc":1938,"header":"def w(self, z)","id":12162,"name":"w","nodeType":"Function","startLoc":1913,"text":"def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_0`.\n        \"\"\"\n\n        if np.isscalar(z):\n            return self._w0\n        else:\n            return self._w0 * np.ones(np.asanyarray(z).shape)"},{"col":4,"comment":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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":1962,"header":"def de_density_scale(self, z)","id":12163,"name":"de_density_scale","nodeType":"Function","startLoc":1940,"text":"def de_density_scale(self, z):\n        \"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        return (1. + z) ** (3. * (1. + self._w0))"},{"col":4,"comment":"null","endLoc":185,"header":"@staticmethod\n    def readonly_prop_factory(members, attr, value)","id":12164,"name":"readonly_prop_factory","nodeType":"Function","startLoc":177,"text":"@staticmethod\n    def readonly_prop_factory(members, attr, value):\n        private_attr = '_' + attr\n\n        def getter(self):\n            return getattr(self, private_attr)\n\n        members[private_attr] = value\n        members[attr] = property(getter)"},{"col":4,"comment":" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        ","endLoc":1992,"header":"def efunc(self, z)","id":12165,"name":"efunc","nodeType":"Function","startLoc":1964,"text":"def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                       Ode0 * zp1 ** (3. * (1. + w0)))"},{"attributeType":"null","col":16,"comment":"null","endLoc":145,"id":12166,"name":"found_default_diff","nodeType":"Attribute","startLoc":145,"text":"found_default_diff"},{"attributeType":"null","col":16,"comment":"null","endLoc":144,"id":12167,"name":"default_diff","nodeType":"Attribute","startLoc":144,"text":"default_diff"},{"attributeType":"null","col":16,"comment":"null","endLoc":149,"id":12168,"name":"repr_info","nodeType":"Attribute","startLoc":149,"text":"repr_info"},{"attributeType":"null","col":16,"comment":"null","endLoc":141,"id":12169,"name":"found_default_repr","nodeType":"Attribute","startLoc":141,"text":"found_default_repr"},{"attributeType":"null","col":16,"comment":"null","endLoc":150,"id":12170,"name":"found_repr_info","nodeType":"Attribute","startLoc":150,"text":"found_repr_info"},{"attributeType":"null","col":8,"comment":"null","endLoc":134,"id":12171,"name":"tmp_cls","nodeType":"Attribute","startLoc":134,"text":"tmp_cls"},{"attributeType":"null","col":16,"comment":"null","endLoc":140,"id":12172,"name":"default_repr","nodeType":"Attribute","startLoc":140,"text":"default_repr"},{"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'`` (to use whatever\n    the representation's ``recommended_units`` is), or None (to indicate that\n    no unit mapping should be done).\n    ","endLoc":206,"id":12173,"nodeType":"Class","startLoc":193,"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'`` (to use whatever\n    the representation's ``recommended_units`` is), or None (to indicate that\n    no unit mapping 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":40,"id":12174,"name":"__all__","nodeType":"Attribute","startLoc":40,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":188,"id":12175,"name":"_RepresentationMappingBase","nodeType":"Attribute","startLoc":188,"text":"_RepresentationMappingBase"},{"col":0,"comment":"","endLoc":6,"header":"baseframe.py#<anonymous>","id":12176,"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'))"},{"col":4,"comment":" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":2022,"header":"def inv_efunc(self, z)","id":12177,"name":"inv_efunc","nodeType":"Function","startLoc":1994,"text":"def inv_efunc(self, z):\n        r\"\"\" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1.0 + z\n\n        return (zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)"},{"fileName":"angles.py","filePath":"astropy/coordinates","id":12178,"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 math\nfrom collections import namedtuple\n\nimport numpy as np\n\nfrom . import angle_utilities as util\nfrom .. import units as u\nfrom ..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\n      Angle('10.2345d')\n      Angle(['10.2345d', '-20d'])\n      Angle('1:2:30.43 degrees')\n      Angle('1 2 0 hours')\n      Angle(np.arange(1, 8), unit=u.deg)\n      Angle('1°2′3″')\n      Angle('1d2m3.4s')\n      Angle('-1h2m3s')\n      Angle('-1h2.5m')\n      Angle('-1:2.5', unit=u.deg)\n      Angle((10, 11, 12), unit='hourangle')  # (h, m, s)\n      Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)\n      Angle(10.2345 * u.deg)\n      Angle(Angle(10.2345 * u.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 : `~astropy.units.UnitBase`, str, 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):\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 = util.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\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 util.hms_to_hours(*angle)\n        elif unit == u.degree:\n            return util.dms_to_degrees(*angle)\n        else:\n            raise u.UnitsError(\"Can not parse '{0}' as unit '{1}'\"\n                               .format(angle, 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(*util.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(*util.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                                *util.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(\"Unknown format '{0}'\".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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'dms'\n                values = self.degree\n                func = lambda x: util.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 = '{0:g}'.format\n            else:\n                if sep == 'fromunit':\n                    sep = 'hms'\n                values = self.hour\n                func = lambda x: util.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 = \"{0: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 \"{0:g}{1}\".format(val, unit_string)\n                    func = plain_unit_format\n            else:\n                raise ValueError(\n                    \"'{0}' can not be represented in sexagesimal \"\n                    \"notation\".format(\n                        unit.name))\n\n        else:\n            raise u.UnitsError(\n                \"The unit value provided is not an angular unit.\")\n\n        def do_format(val):\n            s = func(float(val))\n            if alwayssign and not s.startswith('-'):\n                s = '+' + s\n            if format == 'latex':\n                s = '${0}$'.format(s)\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, inplace=False):\n        \"\"\"\n        Wrap the `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 `Angle` object is wrapped in\n        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 : str, `Angle`, angular `~astropy.units.Quantity`\n            Specifies a single value for the wrap angle.  This can be any\n            object that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``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 `Angle`\n\n        Returns\n        -------\n        out : Angle or `None`\n            If ``inplace is False`` (default), return new `Angle` object\n            with angles wrapped accordingly.  Otherwise wrap in place and\n            return `None`.\n        \"\"\"\n        wrap_angle = Angle(wrap_angle)  # Convert to an Angle\n        wrapped = np.mod(self - wrap_angle, 360.0 * u.deg) - (360.0 * u.deg - wrap_angle)\n\n        if inplace:\n            self[()] = wrapped\n        else:\n            return wrapped\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 : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies lower bound for checking.  This can be any object\n            that can initialize an `Angle` object, e.g. ``'180d'``,\n            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.\n        upper : str, `Angle`, angular `~astropy.units.Quantity`, `None`\n            Specifies upper bound for checking.  This can be any object\n            that can initialize an `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__(self):\n        return str(self.to_string())\n\n    def _repr_latex_(self):\n        if self.isscalar:\n            return self.to_string(format='latex')\n        else:\n            # Need to do a magic incantation to convert to str.  Regular str\n            # or array2string causes all backslashes to get doubled.\n            return np.array2string(self.to_string(format='latex'),\n                                   formatter={'str_kind': lambda x: x})\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 Latitute 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, Angle) 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`, `Angle`. The\n        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\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 : :class:`~astropy.units.UnitBase`, str, 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        if np.any(angles.value < lower) or np.any(angles.value > upper):\n            raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '\n                             'got {0}'.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        self._validate_angles(value)\n        super().__setitem__(item, value)\n\n    # Any calculation should drop to Angle\n    def __array_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)\n\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 : array, list, scalar, `~astropy.units.Quantity`,\n        :class:`~astropy.coordinates.Angle` The angle value(s). If a tuple,\n        will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending\n        on ``unit``. If a string, it will be interpreted following the\n        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 : :class:`~astropy.units.UnitBase`, str, 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 : :class:`~astropy.coordinates.Angle` or equivalent, or None\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\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_internal()\n\n    def _wrap_internal(self):\n        \"\"\"\n        Wrap the internal values in the Longitude object. Using the\n        :meth:`~astropy.coordinates.Angle.wrap_at` method causes\n        recursion.\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 = self.wrap_angle.to_value(self.unit)\n        wrap_angle_floor = wrap_angle - a360\n        self_angle = self.value\n        # Do the wrapping, but only if any angles need to be wrapped\n        if np.any(self_angle < wrap_angle_floor) or np.any(self_angle >= wrap_angle):\n            wrapped = np.mod(self_angle - wrap_angle, a360) + wrap_angle_floor\n            value = u.Quantity(wrapped, self.unit)\n            super().__setitem__((), value)\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)\n        self._wrap_internal()\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_wrap__(self, obj, context=None):\n        obj = super().__array_wrap__(obj, context=context)\n        return _no_angle_subclass(obj)\n\n    def __array_ufunc__(self, *args, **kwargs):\n        results = super().__array_ufunc__(*args, **kwargs)\n        return _no_angle_subclass(results)\n"},{"col":4,"comment":"null","endLoc":2029,"header":"def __repr__(self)","id":12179,"name":"__repr__","nodeType":"Function","startLoc":2024,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, w0={4:.3g}, \"\\\n                 \"Tcmb0={5:.4g}, Neff={6:.3g}, m_nu={7}, Ob0={8:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._Tcmb0, self._Neff,\n                             self.m_nu, _float_or_none(self._Ob0))"},{"col":0,"comment":"null","endLoc":136,"header":"def inject_horoscope()","id":12180,"name":"inject_horoscope","nodeType":"Function","startLoc":134,"text":"def inject_horoscope():\n    import astropy\n    astropy._yourfuture = horoscope"},{"attributeType":"null","col":0,"comment":"null","endLoc":17,"id":12181,"name":"__all__","nodeType":"Attribute","startLoc":17,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":12182,"name":"_VALID_SIGNS","nodeType":"Attribute","startLoc":57,"text":"_VALID_SIGNS"},{"attributeType":"null","col":0,"comment":"null","endLoc":61,"id":12183,"name":"_CONST_TO_SIGNS","nodeType":"Attribute","startLoc":61,"text":"_CONST_TO_SIGNS"},{"col":0,"comment":"","endLoc":6,"header":"calculation.py#<anonymous>","id":12184,"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\ninject_horoscope()"},{"className":"LongitudeInfo","col":0,"comment":"null","endLoc":543,"id":12185,"nodeType":"Class","startLoc":542,"text":"class LongitudeInfo(u.QuantityInfo):\n    _represent_as_dict_attrs = u.QuantityInfo._represent_as_dict_attrs + ('wrap_angle',)"},{"attributeType":"null","col":4,"comment":"null","endLoc":93,"id":12186,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":93,"text":"_represent_as_dict_attrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":29,"id":12187,"name":"__all__","nodeType":"Attribute","startLoc":29,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":12188,"name":"GeodeticLocation","nodeType":"Attribute","startLoc":31,"text":"GeodeticLocation"},{"attributeType":"null","col":12,"comment":"null","endLoc":1902,"id":12189,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":1902,"text":"self._inv_efunc_scalar"},{"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``.\n        ","endLoc":2261,"header":"def get_d_xyz(self, xyz_axis=0)","id":12190,"name":"get_d_xyz","nodeType":"Function","startLoc":2247,"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        xyz : `~astropy.units.Quantity`\n            With dimension 3 along ``xyz_axis``.\n        \"\"\"\n        return _combine_xyz(self._d_x, self._d_y, self._d_z, xyz_axis=xyz_axis)"},{"attributeType":"null","col":0,"comment":"null","endLoc":34,"id":12191,"name":"ELLIPSOIDS","nodeType":"Attribute","startLoc":34,"text":"ELLIPSOIDS"},{"attributeType":"null","col":4,"comment":"null","endLoc":543,"id":12192,"name":"_represent_as_dict_attrs","nodeType":"Attribute","startLoc":543,"text":"_represent_as_dict_attrs"},{"attributeType":"Quantity","col":0,"comment":"\nRotational velocity of Earth. In UT1 seconds, this would be 2 pi / (24 * 3600),\nbut we need the value in SI seconds.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth Seidelmann (1992),\nUniversity Science Books.\n","endLoc":36,"id":12193,"name":"OMEGA_EARTH","nodeType":"Attribute","startLoc":36,"text":"OMEGA_EARTH"},{"attributeType":"CartesianRepresentation","col":4,"comment":"null","endLoc":2210,"id":12194,"name":"base_representation","nodeType":"Attribute","startLoc":2210,"text":"base_representation"},{"attributeType":"null","col":0,"comment":"null","endLoc":18,"id":12195,"name":"__all__","nodeType":"Attribute","startLoc":18,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":12196,"name":"hms_tuple","nodeType":"Attribute","startLoc":22,"text":"hms_tuple"},{"attributeType":"null","col":4,"comment":"null","endLoc":2263,"id":12197,"name":"d_xyz","nodeType":"Attribute","startLoc":2263,"text":"d_xyz"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":12198,"name":"dms_tuple","nodeType":"Attribute","startLoc":23,"text":"dms_tuple"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12199,"name":"signed_dms_tuple","nodeType":"Attribute","startLoc":24,"text":"signed_dms_tuple"},{"col":0,"comment":"","endLoc":7,"header":"angles.py#<anonymous>","id":12200,"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'))"},{"fileName":"errors.py","filePath":"astropy/coordinates","id":12201,"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 ..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 \"An invalid value for 'hours' was found ('{0}'); must be in the range [0,24).\".format(self.hour)\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 = \"'hour' was found  to be '{0}', which is not in range (-24, 24).\".format(self.hour)\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 \"An invalid value for 'minute' was found ('{0}'); should be in the range [0,60).\".format(self.minute)\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 = \"'minute' was found  to be '{0}', which is not in range [0,60).\".format(self.minute)\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 \"An invalid value for 'second' was found ('{0}'); should be in the range [0,60).\".format(self.second)\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 = \"'second' was found  to be '{0}', which is not in range [0,60).\".format(self.second)\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 = \"Site '{0}' not in database. Use {1} to see available sites.\".format(site, attribute)\n        if close_names:\n            message += \" Did you mean one of: '{0}'?'\".format(\"', '\".join(close_names))\n        self.site = site\n        self.attribute = attribute\n        self.close_names = close_names\n        return super().__init__(message)\n"},{"col":0,"comment":"","endLoc":3,"header":"earth.py#<anonymous>","id":12202,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"try:\n    # Not guaranteed available at setup time.\n    from .. import _erfa as erfa\nexcept ImportError:\n    if not _ASTROPY_SETUP_:\n        raise\n\n__all__ = ['EarthLocation']\n\nGeodeticLocation = collections.namedtuple('GeodeticLocation', ['lon', 'lat', 'height'])\n\nELLIPSOIDS = ('WGS84', 'GRS80', 'WGS72')\n\nOMEGA_EARTH = u.Quantity(7.292115855306589e-5, 1./u.s)\n\n\"\"\"\nRotational velocity of Earth. In UT1 seconds, this would be 2 pi / (24 * 3600),\nbut we need the value in SI seconds.\nSee Explanatory Supplement to the Astronomical Almanac, ed. P. Kenneth Seidelmann (1992),\nUniversity Science Books.\n\"\"\""},{"className":"BoundsError","col":0,"comment":"\n    Raised when an angle is outside of its user-specified bounds.\n    ","endLoc":24,"id":12203,"nodeType":"Class","startLoc":21,"text":"class BoundsError(RangeError):\n    \"\"\"\n    Raised when an angle is outside of its user-specified bounds.\n    \"\"\""},{"fileName":"name_resolve.py","filePath":"astropy/coordinates","id":12204,"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 .. import units as u\nfrom .sky_coordinate import SkyCoord\nfrom ..utils import data\nfrom ..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(\"Unknown database '{0}'\".format(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.decode('utf-8'))\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):\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\n    Returns\n    -------\n    coord : `astropy.coordinates.ICRS` object\n        The object's coordinates in the ICRS frame.\n\n    \"\"\"\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            # Retrieve ascii name resolve data from CDS\n            resp = urllib.request.urlopen(url, timeout=data.conf.remote_timeout)\n            resp_data = resp.read()\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            exceptions.append(e)\n            continue\n\n    # All Sesame URL's failed...\n    else:\n        messages = [\"{url}: {e.reason}\".format(url=url, e=e)\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                               \"below: \\n {}\".format(\"\\n\".join(messages)))\n\n    ra, dec = _parse_response(resp_data)\n\n    if ra is None and dec is None:\n        if db == \"A\":\n            err = \"Unable to find coordinates for name '{0}'\".format(name)\n        else:\n            err = \"Unable to find coordinates for name '{0}' in database {1}\"\\\n                  .format(name, database)\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"},{"className":"UnitsError","col":0,"comment":"\n    Raised if units are missing or invalid.\n    ","endLoc":158,"id":12205,"nodeType":"Class","startLoc":155,"text":"class UnitsError(ValueError):\n    \"\"\"\n    Raised if units are missing or invalid.\n    \"\"\""},{"className":"ConvertError","col":0,"comment":"\n    Raised if a coordinate system cannot be converted to another\n    ","endLoc":164,"id":12206,"nodeType":"Class","startLoc":161,"text":"class ConvertError(Exception):\n    \"\"\"\n    Raised if a coordinate system cannot be converted to another\n    \"\"\""},{"className":"sesame_url","col":0,"comment":"\n    The URL(s) to Sesame's web-queryable database.\n    ","endLoc":38,"id":12207,"nodeType":"Class","startLoc":28,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":9,"id":12208,"name":"__all__","nodeType":"Attribute","startLoc":9,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"errors.py#<anonymous>","id":12209,"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']"},{"className":"BaseSphericalDifferential","col":0,"comment":"null","endLoc":2324,"id":12210,"nodeType":"Class","startLoc":2266,"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` 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":"null","endLoc":38,"header":"@classmethod\n    def validate(cls, value)","id":12211,"name":"validate","nodeType":"Function","startLoc":35,"text":"@classmethod\n    def validate(cls, value):\n        # TODO: Implement me\n        return value"},{"attributeType":"null","col":4,"comment":"null","endLoc":32,"id":12212,"name":"_value","nodeType":"Attribute","startLoc":32,"text":"_value"},{"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":2276,"header":"def _d_lon_coslat(self, base)","id":12213,"name":"_d_lon_coslat","nodeType":"Function","startLoc":2267,"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)"},{"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":54,"id":12214,"nodeType":"Class","startLoc":41,"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(\"Unknown database '{0}'\".format(value))\n        return value"},{"col":4,"comment":"null","endLoc":54,"header":"@classmethod\n    def validate(cls, value)","id":12215,"name":"validate","nodeType":"Function","startLoc":50,"text":"@classmethod\n    def validate(cls, value):\n        if value not in ['all', 'simbad', 'ned', 'vizier']:\n            raise ValueError(\"Unknown database '{0}'\".format(value))\n        return value"},{"attributeType":"null","col":4,"comment":"null","endLoc":48,"id":12216,"name":"_value","nodeType":"Attribute","startLoc":48,"text":"_value"},{"id":12217,"name":"astropy/coordinates/data","nodeType":"Package"},{"id":12218,"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"},{"className":"NameResolveError","col":0,"comment":"null","endLoc":58,"id":12219,"nodeType":"Class","startLoc":57,"text":"class NameResolveError(Exception):\n    pass"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":12220,"name":"__all__","nodeType":"Attribute","startLoc":25,"text":"__all__"},{"col":0,"comment":"","endLoc":9,"header":"name_resolve.py#<anonymous>","id":12221,"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":"null","col":12,"comment":"null","endLoc":1903,"id":12222,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":1903,"text":"self._inv_efunc_scalar_args"},{"id":12223,"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"},{"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":2290,"header":"@classmethod\n    def _get_d_lon(cls, d_lon_coslat, base)","id":12224,"name":"_get_d_lon","nodeType":"Function","startLoc":2278,"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)"},{"id":12225,"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"},{"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` 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":2324,"header":"def _combine_operation(self, op, other, reverse=False)","id":12226,"name":"_combine_operation","nodeType":"Function","startLoc":2292,"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` 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)"},{"id":12227,"name":"astropy/coordinates/tests","nodeType":"Package"},{"fileName":"utils.py","filePath":"astropy/coordinates/tests","id":12228,"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 ... import units as u\nfrom ...utils import NumpyRNGContext\n\n\ndef randomly_sample_sphere(ntosample, randomseed=12345):\n    \"\"\"\n    Generates a set of spherical coordinates uniformly distributed over the\n    sphere in a way that gives the same answer for the same seed.  Also\n    generates a random distance vector on [0, 1] (no units)\n\n    This simply returns (lon, lat, r) instead of a representation to avoid\n    failures due to the representation module.\n    \"\"\"\n    with NumpyRNGContext(randomseed):\n        lat = np.arcsin(np.random.rand(ntosample)*2-1)\n        lon = np.random.rand(ntosample)*np.pi*2\n        r = np.random.rand(ntosample)\n\n    return lon*u.rad, lat*u.rad, r\n"},{"col":0,"comment":"\n    Generates a set of spherical coordinates uniformly distributed over the\n    sphere in a way that gives the same answer for the same seed.  Also\n    generates a random distance vector on [0, 1] (no units)\n\n    This simply returns (lon, lat, r) instead of a representation to avoid\n    failures due to the representation module.\n    ","endLoc":25,"header":"def randomly_sample_sphere(ntosample, randomseed=12345)","id":12229,"name":"randomly_sample_sphere","nodeType":"Function","startLoc":11,"text":"def randomly_sample_sphere(ntosample, randomseed=12345):\n    \"\"\"\n    Generates a set of spherical coordinates uniformly distributed over the\n    sphere in a way that gives the same answer for the same seed.  Also\n    generates a random distance vector on [0, 1] (no units)\n\n    This simply returns (lon, lat, r) instead of a representation to avoid\n    failures due to the representation module.\n    \"\"\"\n    with NumpyRNGContext(randomseed):\n        lat = np.arcsin(np.random.rand(ntosample)*2-1)\n        lon = np.random.rand(ntosample)*np.pi*2\n        r = np.random.rand(ntosample)\n\n    return lon*u.rad, lat*u.rad, r"},{"fileName":"__init__.py","filePath":"astropy/coordinates/tests","id":12230,"nodeType":"File","text":""},{"col":4,"comment":"null","endLoc":2400,"header":"def __init__(self, d_lon, d_lat, d_distance, copy=True)","id":12231,"name":"__init__","nodeType":"Function","startLoc":2397,"text":"def __init__(self, d_lon, d_lat, d_distance, 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.')"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":12232,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":7,"id":12233,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"null","col":8,"comment":"null","endLoc":1888,"id":12234,"name":"_w0","nodeType":"Attribute","startLoc":1888,"text":"self._w0"},{"className":"FlatwCDM","col":0,"comment":"FLRW cosmology with a constant dark energy equation of state\n    and no spatial curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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":2180,"id":12235,"nodeType":"Class","startLoc":2032,"text":"class FlatwCDM(wCDM):\n    \"\"\"FLRW cosmology with a constant dark energy equation of state\n    and no spatial curvature.\n\n    This has one additional attribute beyond those of FLRW.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        wCDM.__init__(self, H0, Om0, 0.0, w0, Tcmb0, Neff, m_nu,\n                      name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) +\n                       Ode0 * zp1 ** (3. * (1 + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return (zp1 ** 3 * (Or * zp1 + Om0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, w0={3:.3g}, Tcmb0={4:.4g}, \"\\\n                 \"Neff={5:.3g}, m_nu={6}, Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":2113,"header":"def __init__(self, H0, Om0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12236,"name":"__init__","nodeType":"Function","startLoc":2088,"text":"def __init__(self, H0, Om0, w0=-1., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        wCDM.__init__(self, H0, Om0, 0.0, w0, Tcmb0, Neff, m_nu,\n                      name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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)"},{"id":12237,"name":"astropy/coordinates/tests/accuracy","nodeType":"Package"},{"id":12238,"name":"galactic_fk4.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy","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"},{"fileName":"__init__.py","filePath":"astropy/coordinates/tests/accuracy","id":12239,"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":12240,"name":"N_ACCURACY_TESTS","nodeType":"Attribute","startLoc":9,"text":"N_ACCURACY_TESTS"},{"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 rather than referenced.\n    ","endLoc":2379,"id":12241,"nodeType":"Class","startLoc":2327,"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 rather than referenced.\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, 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    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)"},{"col":4,"comment":"null","endLoc":2341,"header":"@classproperty\n    def _dimensional_differential(cls)","id":12242,"name":"_dimensional_differential","nodeType":"Function","startLoc":2339,"text":"@classproperty\n    def _dimensional_differential(cls):\n        return SphericalDifferential"},{"col":4,"comment":"null","endLoc":2346,"header":"def __init__(self, d_lon, d_lat, copy=True)","id":12243,"name":"__init__","nodeType":"Function","startLoc":2343,"text":"def __init__(self, d_lon, d_lat, 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.')"},{"id":12244,"name":"fk4_no_e_fk5.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy","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"},{"col":0,"comment":"","endLoc":7,"header":"__init__.py#<anonymous>","id":12245,"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":12246,"nodeType":"File","text":"\"\"\"\nThis series of functions are used to generate the reference CSV files\nused by the accuracy tests.  Running this as a comand-line script will\ngenerate them all.\n\"\"\"\n\nimport os\n\nimport numpy as np\n\nfrom ....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 = [\"B{0:7.2f}\".format(x) 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('System=FK4-NO-E,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i]))\n        frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i]))\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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1925., 1975., N)]\n    equinox_fk5 = [\"J{0:7.2f}\".format(x) 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('System=FK4-NO-E,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=equinox_fk4[i]))\n        frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [\"J{0:7.2f}\".format(x) 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('System=Galactic,Epoch={epoch}'.format(epoch=obstime[i]))\n        frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk5 = [\"J{0:7.2f}\".format(x) 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('System=ICRS,Epoch={epoch}'.format(epoch=obstime[i]))\n        frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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"},{"col":4,"comment":" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        ","endLoc":2143,"header":"def efunc(self, z)","id":12247,"name":"efunc","nodeType":"Function","startLoc":2115,"text":"def efunc(self, z):\n        \"\"\" Function used to calculate H(z), the Hubble parameter.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H(z) = H_0 E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) +\n                       Ode0 * zp1 ** (3. * (1 + w0)))"},{"col":4,"comment":"null","endLoc":2357,"header":"def to_cartesian(self, base)","id":12248,"name":"to_cartesian","nodeType":"Function","startLoc":2348,"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)"},{"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 : number\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":1126,"id":12249,"nodeType":"Class","startLoc":1076,"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 : number\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 __call__(self, fromcoord, toframe):\n\n        M, vec = self.transform_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, vec)\n\n        return toframe.realize_frame(newrep)"},{"id":12250,"name":"icrs_fk5.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy","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"},{"col":4,"comment":"null","endLoc":1119,"header":"def __init__(self, transform_func, fromsys, tosys, priority=1,\n                 register_graph=None)","id":12251,"name":"__init__","nodeType":"Function","startLoc":1111,"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)"},{"col":4,"comment":"null","endLoc":1126,"header":"def __call__(self, fromcoord, toframe)","id":12252,"name":"__call__","nodeType":"Function","startLoc":1121,"text":"def __call__(self, fromcoord, toframe):\n\n        M, vec = self.transform_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, vec)\n\n        return toframe.realize_frame(newrep)"},{"id":12253,"name":"fk4_no_e_fk4.csv","nodeType":"TextFile","path":"astropy/coordinates/tests/accuracy","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":12254,"name":"astropy/coordinates/builtin_frames","nodeType":"Package"},{"fileName":"itrs.py","filePath":"astropy/coordinates/builtin_frames","id":12255,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..representation import CartesianRepresentation, CartesianDifferential\nfrom ..baseframe import BaseCoordinateFrame\nfrom ..attributes import TimeAttribute\nfrom .utils import DEFAULT_OBSTIME\n\n\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-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 ..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":27,"id":12256,"name":"DEFAULT_OBSTIME","nodeType":"Attribute","startLoc":27,"text":"DEFAULT_OBSTIME"},{"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-coordinates-seealso` section of the documentation.\n    ","endLoc":32,"id":12257,"nodeType":"Class","startLoc":10,"text":"class 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-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 ..earth import EarthLocation\n\n        cart = self.represent_as(CartesianRepresentation)\n        return EarthLocation(x=cart.x, y=cart.y, z=cart.z)"},{"col":4,"comment":"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        ","endLoc":32,"header":"@property\n    def earth_location(self)","id":12258,"name":"earth_location","nodeType":"Function","startLoc":24,"text":"@property\n    def earth_location(self):\n        \"\"\"\n        The data in this frame as an `~astropy.coordinates.EarthLocation` class.\n        \"\"\"\n        from ..earth import EarthLocation\n\n        cart = self.represent_as(CartesianRepresentation)\n        return EarthLocation(x=cart.x, y=cart.y, z=cart.z)"},{"fileName":"gcrs.py","filePath":"astropy/coordinates/builtin_frames","id":12259,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom ..attributes import (TimeAttribute,\n                          CartesianRepresentationAttribute)\nfrom .utils import DEFAULT_OBSTIME, EQUINOX_J2000\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\n\n\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-coordinates-seealso` section of the documentation. (Of\n    particular note is Section 1.2 of\n    `USNO Circular 179 <http://aa.usno.navy.mil/publications/docs/Circular_179.php>`_)\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    {params}\n\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    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\nGCRS.__doc__ = GCRS.__doc__.format(params=_base_radec_docstring)\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\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    {params}\n\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 Earth,\n        oriented the same as BCRS/ICRS. Either [0, 0, 0], `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, 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 Earth,\n        oriented the same as BCRS/ICRS. Either 0, `~astropy.coordinates.CartesianRepresentation`,\n        or proper input for one, i.e., a `~astropy.units.Quantity` with shape (3, ...) and velocity units.\n        Defaults to [0, 0, 0], meaning \"true\" Geocentric.\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\n\nPrecessedGeocentric.__doc__ = PrecessedGeocentric.__doc__.format(\n    params=_base_radec_docstring)\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":12260,"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 = [\"B{0:7.2f}\".format(x) 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('System=FK4-NO-E,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i]))\n        frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i]))\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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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":22,"id":12261,"name":"EQUINOX_J2000","nodeType":"Attribute","startLoc":22,"text":"EQUINOX_J2000"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":12262,"name":"_base_radec_docstring","nodeType":"Attribute","startLoc":10,"text":"_base_radec_docstring"},{"col":0,"comment":"","endLoc":4,"header":"gcrs.py#<anonymous>","id":12263,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"GCRS.__doc__ = GCRS.__doc__.format(params=_base_radec_docstring)\n\nPrecessedGeocentric.__doc__ = PrecessedGeocentric.__doc__.format(\n    params=_base_radec_docstring)"},{"attributeType":"CartesianRepresentation","col":4,"comment":"null","endLoc":19,"id":12264,"name":"default_representation","nodeType":"Attribute","startLoc":19,"text":"default_representation"},{"col":4,"comment":" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        ","endLoc":2173,"header":"def inv_efunc(self, z)","id":12265,"name":"inv_efunc","nodeType":"Function","startLoc":2145,"text":"def inv_efunc(self, z):\n        r\"\"\" Function used to calculate :math:`\\frac{1}{H_z}`.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        E : ndarray, or float if input scalar\n          The inverse redshift scaling of the Hubble constant.\n\n        Notes\n        -----\n        The return value, E, is defined such that :math:`H_z = H_0 / E`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n        Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0\n        if self._massivenu:\n            Or = self._Ogamma0 * (1. + self.nu_relative_density(z))\n        else:\n            Or = self._Ogamma0 + self._Onu0\n        zp1 = 1. + z\n\n        return (zp1 ** 3 * (Or * zp1 + Om0) +\n                Ode0 * zp1 ** (3. * (1. + w0)))**(-0.5)"},{"attributeType":"CartesianDifferential","col":4,"comment":"null","endLoc":20,"id":12266,"name":"default_differential","nodeType":"Attribute","startLoc":20,"text":"default_differential"},{"attributeType":"Callable","col":8,"comment":"null","endLoc":1116,"id":12267,"name":"transform_func","nodeType":"Attribute","startLoc":1116,"text":"self.transform_func"},{"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 : number\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":1175,"id":12268,"nodeType":"Class","startLoc":1129,"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 : number\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 __call__(self, fromcoord, toframe):\n        newrep = self._apply_transform(fromcoord, self.matrix, None)\n        return toframe.realize_frame(newrep)"},{"col":4,"comment":"null","endLoc":1175,"header":"def __call__(self, fromcoord, toframe)","id":12269,"name":"__call__","nodeType":"Function","startLoc":1173,"text":"def __call__(self, fromcoord, toframe):\n        newrep = self._apply_transform(fromcoord, self.matrix, None)\n        return toframe.realize_frame(newrep)"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":22,"id":12270,"name":"obstime","nodeType":"Attribute","startLoc":22,"text":"obstime"},{"attributeType":"null","col":8,"comment":"null","endLoc":1165,"id":12271,"name":"matrix","nodeType":"Attribute","startLoc":1165,"text":"self.matrix"},{"col":4,"comment":"null","endLoc":2180,"header":"def __repr__(self)","id":12272,"name":"__repr__","nodeType":"Function","startLoc":2175,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, w0={3:.3g}, Tcmb0={4:.4g}, \"\\\n                 \"Neff={5:.3g}, m_nu={6}, Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"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 : number\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":1225,"id":12273,"nodeType":"Class","startLoc":1178,"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 : number\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        def _transform_func(fromcoord, toframe):\n            return self.matrix_func(fromcoord, toframe), None\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)\n\n    def __call__(self, fromcoord, toframe):\n        M = self.matrix_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, None)\n        return toframe.realize_frame(newrep)"},{"col":4,"comment":"null","endLoc":1220,"header":"def __init__(self, matrix_func, fromsys, tosys, priority=1,\n                 register_graph=None)","id":12274,"name":"__init__","nodeType":"Function","startLoc":1210,"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        def _transform_func(fromcoord, toframe):\n            return self.matrix_func(fromcoord, toframe), None\n\n        super().__init__(fromsys, tosys, priority=priority,\n                         register_graph=register_graph)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2109,"id":12275,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2109,"text":"self._inv_efunc_scalar"},{"fileName":"skyoffset.py","filePath":"astropy/coordinates/builtin_frames","id":12276,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom ... import units as u\nfrom ...utils.compat import namedtuple_asdict\nfrom .. import representation as r\nfrom ..transformations import DynamicMatrixTransform, FunctionTransform\nfrom ..baseframe import (frame_transform_graph, RepresentationMapping,\n                         BaseCoordinateFrame)\nfrom ..attributes import CoordinateAttribute, QuantityAttribute\nfrom ..matrix_utilities import (rotation_matrix,\n                                matrix_product, 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 : coordinate frame class (i.e., subclass of `~astropy.coordinates.BaseCoordinateFrame`)\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    # the class of a class object is the metaclass\n    framemeta = framecls.__class__\n\n    class SkyOffsetMeta(framemeta):\n        \"\"\"\n        This metaclass renames the class to be \"SkyOffset<framecls>\" and also\n        adjusts the frame specific representation info so that spherical names\n        are always \"lon\" and \"lat\" (instead of e.g. \"ra\" and \"dec\").\n        \"\"\"\n\n        def __new__(cls, name, bases, members):\n            # Only 'origin' is needed here, to set the origin frame properly.\n            members['origin'] = CoordinateAttribute(frame=framecls, default=None)\n\n            # This has to be done because FrameMeta will set these attributes\n            # to the defaults from BaseCoordinateFrame when it creates the base\n            # SkyOffsetFrame class initially.\n            members['_frame_specific_representation_info'] = framecls._frame_specific_representation_info\n            members['_default_representation'] = framecls._default_representation\n            members['_default_differential'] = framecls._default_differential\n\n            newname = name[:-5] if name.endswith('Frame') else name\n            newname += framecls.__name__\n\n            res = super().__new__(cls, newname, bases, members)\n\n            # now go through all the component names and make any spherical names be \"lon\" and \"lat\"\n            # instead of e.g. \"ra\" and \"dec\"\n\n            lists_done = []\n            for cls_, component_list in res._frame_specific_representation_info.items():\n                if cls_ in (r.SphericalRepresentation,\n                            r.UnitSphericalRepresentation):\n                    gotlatlon = []\n                    for i, comp in enumerate(component_list):\n                        if component_list in lists_done:\n                            # we need this because sometimes the component_\n                            # list's are the exact *same* object for both\n                            # spherical and unitspherical.  So looping then makes\n                            # the change *twice*.  This hack bypasses that.\n                            continue\n\n                        if comp.reprname in ('lon', 'lat'):\n                            dct = namedtuple_asdict(comp)\n                            # this forces the component names to be 'lat' and\n                            # 'lon' regardless of what the actual base frame\n                            # might use\n                            dct['framename'] = comp.reprname\n                            component_list[i] = type(comp)(**dct)\n                            gotlatlon.append(comp.reprname)\n\n                    if 'lon' not in gotlatlon:\n                        rmlon = RepresentationMapping('lon', 'lon', 'recommended')\n                        component_list.insert(0, rmlon)\n\n                    if 'lat' not in gotlatlon:\n                        rmlat = RepresentationMapping('lat', 'lat', 'recommended')\n                        component_list.insert(0, rmlat)\n\n                    # TODO: we could support proper motions / velocities in sky\n                    # offset frames.\n\n                    lists_done.append(component_list)\n\n            return res\n\n    # We need this to handle the intermediate metaclass correctly, otherwise we could\n    # just subclass SkyOffsetFrame.\n    _SkyOffsetFramecls = SkyOffsetMeta('SkyOffsetFrame', (SkyOffsetFrame, framecls),\n                                 {'__doc__': SkyOffsetFrame.__doc__})\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-skyoffset-frames`.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    origin : `SkyCoord` or low-level coordinate object.\n        the coordinate which specifies the origin of this frame.\n    rotation : `~astropy.coordinates.Angle` or `~astropy.units.Quantity` with angle units\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 and hasattr(self.data, 'lon'):\n            self.data.lon.wrap_angle = 180*u.deg\n        if (self.origin is not None and getattr(self.origin.data, 'differentials', None) or\n           (self.has_data and getattr(self.data, 'differentials', None))):\n            raise NotImplementedError('SkyOffsetFrame currently does not '\n                                      'support velocities.')\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12277,"name":"_skyoffset_cache","nodeType":"Attribute","startLoc":13,"text":"_skyoffset_cache"},{"col":0,"comment":"","endLoc":3,"header":"skyoffset.py#<anonymous>","id":12278,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"_skyoffset_cache = {}"},{"fileName":"fk4.py","filePath":"astropy/coordinates/builtin_frames","id":12279,"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 ... import units as u\nfrom ..baseframe import frame_transform_graph\nfrom ..attributes import TimeAttribute\nfrom ..transformations import (FunctionTransformWithFiniteDifference,\n                               FunctionTransform, DynamicMatrixTransform)\nfrom ..representation import (CartesianRepresentation,\n                              UnitSphericalRepresentation)\nfrom .. import earth_orientation as earth\n\nfrom .utils import EQUINOX_B1950\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\n\n\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    {params}\n\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    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')\n\n\nFK4.__doc__ = FK4.__doc__.format(params=_base_radec_docstring)\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\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    {params}\n\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    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\nFK4NoETerms.__doc__ = FK4NoETerms.__doc__.format(params=_base_radec_docstring)\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 aberation 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"},{"fileName":"icrs_cirs_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12280,"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 ... import units as u\nfrom ..baseframe import frame_transform_graph\nfrom ..transformations import FunctionTransformWithFiniteDifference, AffineTransform\nfrom ..representation import (SphericalRepresentation, CartesianRepresentation,\n                              UnitSphericalRepresentation)\nfrom ... import _erfa as erfa\n\nfrom .icrs import ICRS\nfrom .gcrs import GCRS\nfrom .cirs import CIRS\nfrom .hcrs import HCRS\nfrom .utils import get_jd12, aticq, atciqz, get_cip, prepare_earth_position_vel\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    jd1, jd2 = get_jd12(cirs_frame.obstime, 'tdb')\n    x, y, s = get_cip(jd1, jd2)\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(cirs_frame.obstime)\n    astrom = erfa.apci(jd1, jd2, earth_pv, earth_heliocentric, x, y, s)\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        usrepr = icrs_coo.represent_as(UnitSphericalRepresentation)\n        i_ra = usrepr.lon.to_value(u.radian)\n        i_dec = usrepr.lat.to_value(u.radian)\n        cirs_ra, cirs_dec = atciqz(i_ra, i_dec, 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\n        srepr = newcart.represent_as(SphericalRepresentation)\n        i_ra = srepr.lon.to_value(u.radian)\n        i_dec = srepr.lat.to_value(u.radian)\n        cirs_ra, cirs_dec = atciqz(i_ra, i_dec, 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    srepr = cirs_coo.represent_as(SphericalRepresentation)\n    cirs_ra = srepr.lon.to_value(u.radian)\n    cirs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->cirs and then convert to\n    # astrometric coordinate direction\n    jd1, jd2 = get_jd12(cirs_coo.obstime, 'tdb')\n    x, y, s = get_cip(jd1, jd2)\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(cirs_coo.obstime)\n    astrom = erfa.apci(jd1, jd2, earth_pv, earth_heliocentric, x, y, s)\n    i_ra, i_dec = aticq(cirs_ra, cirs_dec, 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@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, CIRS)\ndef cirs_to_cirs(from_coo, to_frame):\n    if np.all(from_coo.obstime == to_frame.obstime):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # the CIRS<-> CIRS transform actually goes through ICRS.  This 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.\n        return from_coo.transform_to(ICRS).transform_to(to_frame)\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. There are a few steps...\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    # (Note could use np.stack once our minimum numpy version is >=1.10.)\n    pv = np.concatenate(\n        (gcrs_frame.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_frame.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    # find the position and velocity of earth\n    jd1, jd2 = get_jd12(gcrs_frame.obstime, 'tdb')\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_frame.obstime)\n\n    # get astrometry context object, astrom.\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\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        usrepr = icrs_coo.represent_as(UnitSphericalRepresentation)\n        i_ra = usrepr.lon.to_value(u.radian)\n        i_dec = usrepr.lat.to_value(u.radian)\n        gcrs_ra, gcrs_dec = atciqz(i_ra, i_dec, 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        i_ra = srepr.lon.to_value(u.radian)\n        i_dec = srepr.lat.to_value(u.radian)\n        gcrs_ra, gcrs_dec = atciqz(i_ra, i_dec, 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    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    gcrs_ra = srepr.lon.to_value(u.radian)\n    gcrs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to BCRS\n    # coordinate direction\n    pv = np.concatenate(\n        (gcrs_coo.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_coo.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    jd1, jd2 = get_jd12(gcrs_coo.obstime, 'tdb')\n\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_coo.obstime)\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\n\n    i_ra, i_dec = aticq(gcrs_ra, gcrs_dec, 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, GCRS)\ndef gcrs_to_gcrs(from_coo, to_frame):\n    if (np.all(from_coo.obstime == to_frame.obstime)\n        and np.all(from_coo.obsgeoloc == to_frame.obsgeoloc)):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # like CIRS, we do this self-transform via ICRS\n        return from_coo.transform_to(ICRS).transform_to(to_frame)\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    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    gcrs_ra = srepr.lon.to_value(u.radian)\n    gcrs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to ICRS\n    # coordinate direction\n    pv = np.concatenate(\n        (gcrs_coo.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_coo.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    jd1, jd2 = get_jd12(hcrs_frame.obstime, 'tdb')\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_coo.obstime)\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\n\n    i_ra, i_dec = aticq(gcrs_ra, gcrs_dec, 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    if hcrs_coo.data.differentials:\n        from ..solar_system import get_body_barycentric_posvel\n        bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel('sun',\n                                                                 hcrs_coo.obstime)\n        bary_sun_pos = bary_sun_pos.with_differentials(bary_sun_vel)\n\n    else:\n        from ..solar_system import get_body_barycentric\n        bary_sun_pos = get_body_barycentric('sun', hcrs_coo.obstime)\n        bary_sun_vel = None\n\n    return None, bary_sun_pos\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    if icrs_coo.data.differentials:\n        from ..solar_system import get_body_barycentric_posvel\n        bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel('sun',\n                                                                 hcrs_frame.obstime)\n        bary_sun_pos = -bary_sun_pos.with_differentials(-bary_sun_vel)\n\n    else:\n        from ..solar_system import get_body_barycentric\n        bary_sun_pos = -get_body_barycentric('sun', hcrs_frame.obstime)\n        bary_sun_vel = None\n\n    return None, bary_sun_pos\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HCRS, HCRS)\ndef hcrs_to_hcrs(from_coo, to_frame):\n    if np.all(from_coo.obstime == to_frame.obstime):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # like CIRS, we do this self-transform via ICRS\n        return from_coo.transform_to(ICRS).transform_to(to_frame)\n"},{"col":4,"comment":"null","endLoc":1225,"header":"def __call__(self, fromcoord, toframe)","id":12281,"name":"__call__","nodeType":"Function","startLoc":1222,"text":"def __call__(self, fromcoord, toframe):\n        M = self.matrix_func(fromcoord, toframe)\n        newrep = self._apply_transform(fromcoord, M, None)\n        return toframe.realize_frame(newrep)"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":12282,"name":"EQUINOX_B1950","nodeType":"Attribute","startLoc":23,"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\n    {params}\n\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    ","endLoc":40,"id":12283,"nodeType":"Class","startLoc":19,"text":"class 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    {params}\n\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    equinox = TimeAttribute(default=EQUINOX_B1950)\n    obstime = TimeAttribute(default=None, secondary_attribute='equinox')"},{"attributeType":"Callable","col":8,"comment":"null","endLoc":1214,"id":12284,"name":"matrix_func","nodeType":"Attribute","startLoc":1214,"text":"self.matrix_func"},{"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` objects\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 : number\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":1309,"id":12285,"nodeType":"Class","startLoc":1228,"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` objects\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 : number\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 = np.dot(lasttrans.matrix, currtrans.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            # `fromframe`, or if not there, `toframe`, 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 immutible, so copying is not needed\n        return curr_coord"},{"col":4,"comment":"null","endLoc":1309,"header":"def __call__(self, fromcoord, toframe)","id":12286,"name":"__call__","nodeType":"Function","startLoc":1287,"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            # `fromframe`, or if not there, `toframe`, 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 immutible, so copying is not needed\n        return curr_coord"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":39,"id":12287,"name":"equinox","nodeType":"Attribute","startLoc":39,"text":"equinox"},{"attributeType":"null","col":12,"comment":"null","endLoc":2110,"id":12288,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2110,"text":"self._inv_efunc_scalar_args"},{"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\n    {params}\n\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    ","endLoc":25,"id":12289,"nodeType":"Class","startLoc":10,"text":"class 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    {params}\n\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    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"col":4,"comment":"null","endLoc":2364,"header":"def represent_as(self, other_class, base=None)","id":12290,"name":"represent_as","nodeType":"Function","startLoc":2359,"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":1266,"id":12291,"name":"transforms","nodeType":"Attribute","startLoc":1266,"text":"self.transforms"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":12292,"name":"__all__","nodeType":"Attribute","startLoc":35,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":1313,"id":12293,"name":"trans_to_color","nodeType":"Attribute","startLoc":1313,"text":"trans_to_color"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":40,"id":12294,"name":"obstime","nodeType":"Attribute","startLoc":40,"text":"obstime"},{"col":0,"comment":"","endLoc":15,"header":"transformations.py#<anonymous>","id":12295,"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 = OrderedDict()\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":25,"id":12296,"name":"obstime","nodeType":"Attribute","startLoc":25,"text":"obstime"},{"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\n    {params}\n\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    ","endLoc":96,"id":12297,"nodeType":"Class","startLoc":57,"text":"class 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    {params}\n\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    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)"},{"fileName":"cirs_observed_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12298,"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.\nCurrently that just means AltAz.\n\"\"\"\n\nimport numpy as np\n\nfrom ... import units as u\nfrom ..baseframe import frame_transform_graph\nfrom ..transformations import FunctionTransformWithFiniteDifference\nfrom ..representation import (SphericalRepresentation,\n                              UnitSphericalRepresentation)\nfrom ... import _erfa as erfa\n\nfrom .cirs import CIRS\nfrom .altaz import AltAz\nfrom .utils import get_polar_motion, get_dut1utc, get_jd12, PIOVER2\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\ndef cirs_to_altaz(cirs_coo, altaz_frame):\n    if np.any(cirs_coo.obstime != altaz_frame.obstime):\n        # the only frame attribute for the current CIRS is the obstime, but this\n        # would need to be updated if a future change allowed specifying an\n        # Earth location algorithm or something\n        cirs_coo = cirs_coo.transform_to(CIRS(obstime=altaz_frame.obstime))\n\n    # we use the same obstime everywhere now that we know they're the same\n    obstime = cirs_coo.obstime\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    if is_unitspherical:\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    else:\n        # compute an \"astrometric\" ra/dec -i.e., the direction of the\n        # displacement vector from the observer to the target in CIRS\n        loccirs = altaz_frame.location.get_itrs(cirs_coo.obstime).transform_to(cirs_coo)\n        diffrepr = (cirs_coo.cartesian - loccirs.cartesian).represent_as(UnitSphericalRepresentation)\n\n        cirs_ra = diffrepr.lon.to_value(u.radian)\n        cirs_dec = diffrepr.lat.to_value(u.radian)\n\n    lon, lat, height = altaz_frame.location.to_geodetic('WGS84')\n    xp, yp = get_polar_motion(obstime)\n\n    # first set up the astrometry context for CIRS<->AltAz\n    jd1, jd2 = get_jd12(obstime, 'utc')\n    astrom = erfa.apio13(jd1, jd2,\n                         get_dut1utc(obstime),\n                         lon.to_value(u.radian), lat.to_value(u.radian),\n                         height.to_value(u.m),\n                         xp, yp,  # polar motion\n                         # all below are already in correct units because they are QuantityFrameAttribues\n                         altaz_frame.pressure.value,\n                         altaz_frame.temperature.value,\n                         altaz_frame.relative_humidity,\n                         altaz_frame.obswl.value)\n\n    az, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        rep = UnitSphericalRepresentation(lat=u.Quantity(PIOVER2 - zen, u.radian, copy=False),\n                                          lon=u.Quantity(az, u.radian, copy=False),\n                                          copy=False)\n    else:\n        # now we get the distance as the cartesian distance from the earth\n        # location to the coordinate location\n        locitrs = altaz_frame.location.get_itrs(obstime)\n        distance = locitrs.separation_3d(cirs_coo)\n        rep = SphericalRepresentation(lat=u.Quantity(PIOVER2 - zen, u.radian, copy=False),\n                                      lon=u.Quantity(az, u.radian, copy=False),\n                                      distance=distance,\n                                      copy=False)\n    return altaz_frame.realize_frame(rep)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\ndef altaz_to_cirs(altaz_coo, cirs_frame):\n    usrepr = altaz_coo.represent_as(UnitSphericalRepresentation)\n    az = usrepr.lon.to_value(u.radian)\n    zen = PIOVER2 - usrepr.lat.to_value(u.radian)\n\n    lon, lat, height = altaz_coo.location.to_geodetic('WGS84')\n    xp, yp = get_polar_motion(altaz_coo.obstime)\n\n    # first set up the astrometry context for ICRS<->CIRS at the altaz_coo time\n    jd1, jd2 = get_jd12(altaz_coo.obstime, 'utc')\n    astrom = erfa.apio13(jd1, jd2,\n                         get_dut1utc(altaz_coo.obstime),\n                         lon.to_value(u.radian), lat.to_value(u.radian),\n                         height.to_value(u.m),\n                         xp, yp,  # polar motion\n                         # all below are already in correct units because they are QuantityFrameAttribues\n                         altaz_coo.pressure.value,\n                         altaz_coo.temperature.value,\n                         altaz_coo.relative_humidity,\n                         altaz_coo.obswl.value)\n\n    # the 'A' indicates zen/az inputs\n    cirs_ra, cirs_dec = erfa.atoiq('A', az, zen, astrom)*u.radian\n    if isinstance(altaz_coo.data, UnitSphericalRepresentation) or altaz_coo.cartesian.x.unit == u.one:\n        cirs_at_aa_time = CIRS(ra=cirs_ra, dec=cirs_dec, distance=None,\n                               obstime=altaz_coo.obstime)\n    else:\n        # treat the output of atoiq as an \"astrometric\" RA/DEC, so to get the\n        # actual RA/Dec from the observers vantage point, we have to reverse\n        # the vector operation of cirs_to_altaz (see there for more detail)\n\n        loccirs = altaz_coo.location.get_itrs(altaz_coo.obstime).transform_to(cirs_frame)\n\n        astrometric_rep = SphericalRepresentation(lon=cirs_ra, lat=cirs_dec,\n                                                  distance=altaz_coo.distance)\n        newrepr = astrometric_rep + loccirs.cartesian\n        cirs_at_aa_time = CIRS(newrepr, obstime=altaz_coo.obstime)\n\n    # this final transform may be a no-op if the obstimes are the same\n    return cirs_at_aa_time.transform_to(cirs_frame)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, AltAz)\ndef altaz_to_altaz(from_coo, to_frame):\n    # for now we just implement this through CIRS to make sure we get everything\n    # covered\n    return from_coo.transform_to(CIRS(obstime=from_coo.obstime)).transform_to(to_frame)\n"},{"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":96,"header":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox)","id":12299,"name":"_precession_matrix","nodeType":"Function","startLoc":78,"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":75,"id":12300,"name":"equinox","nodeType":"Attribute","startLoc":75,"text":"equinox"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":76,"id":12301,"name":"obstime","nodeType":"Attribute","startLoc":76,"text":"obstime"},{"className":"AltAz","col":0,"comment":"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates).  Azimuth is oriented East of North (i.e., N=0, E=90 degrees).\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\n    az : `Angle`, optional, must be keyword\n        The Azimuth for this object (``alt`` must also be given and\n        ``representation`` must be None).\n    alt : `Angle`, optional, must be keyword\n        The Altitude for this object (``az`` must also be given and\n        ``representation`` must be None).\n    distance : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_az_cosalt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in azimuth (including the ``cos(alt)`` factor) for\n        this object (``pm_alt`` must also be given).\n    pm_alt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in altitude for this object (``pm_az_cosalt`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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`\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`\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity`` : numeric\n        The relative humidity as a number from 0 to 1.  This is necessary for\n        performing refraction corrections.\n    obswl : `~astropy.units.Quantity`\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 discrepent\n    results.  For much better numerical stability, leaving the ``pressure`` at\n    ``0`` (the default), disabling the refraction correction (yielding\n    \"topocentric\" horizontal coordinates).\n\n    ","endLoc":153,"id":12302,"nodeType":"Class","startLoc":15,"text":"class AltAz(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates).  Azimuth is oriented East of North (i.e., N=0, E=90 degrees).\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\n    az : `Angle`, optional, must be keyword\n        The Azimuth for this object (``alt`` must also be given and\n        ``representation`` must be None).\n    alt : `Angle`, optional, must be keyword\n        The Altitude for this object (``az`` must also be given and\n        ``representation`` must be None).\n    distance : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_az_cosalt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in azimuth (including the ``cos(alt)`` factor) for\n        this object (``pm_alt`` must also be given).\n    pm_alt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in altitude for this object (``pm_az_cosalt`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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`\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`\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity`` : numeric\n        The relative humidity as a number from 0 to 1.  This is necessary for\n        performing refraction corrections.\n    obswl : `~astropy.units.Quantity`\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 discrepent\n    results.  For much better numerical stability, leaving the ``pressure`` at\n    ``0`` (the default), disabling the refraction correction (yielding\n    \"topocentric\" horizontal coordinates).\n\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'az'),\n            RepresentationMapping('lat', 'alt')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_az_cosalt', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_alt', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_az', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_alt', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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 = Attribute(default=0)\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 if the zenith angle for this coordinate, a common estimate of the\n        airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)\n\n    @property\n    def zen(self):\n        \"\"\"\n        The zenith angle for this coordinate\n        \"\"\"\n        return _90DEG.to(self.alt.unit) - self.alt"},{"col":0,"comment":"null","endLoc":54,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4)\ndef fk4_to_fk4(fk4coord1, fk4frame2)","id":12303,"name":"fk4_to_fk4","nodeType":"Function","startLoc":48,"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":138,"header":"def __init__(self, *args, **kwargs)","id":12304,"name":"__init__","nodeType":"Function","startLoc":137,"text":"def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)"},{"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-coordinates-seealso` section of\n    the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\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    ","endLoc":37,"id":12305,"nodeType":"Class","startLoc":9,"text":"class 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-coordinates-seealso` section of\n    the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\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    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2095,"id":12306,"name":"_Ok0","nodeType":"Attribute","startLoc":2095,"text":"self._Ok0"},{"attributeType":"null","col":4,"comment":"null","endLoc":37,"id":12307,"name":"obstime","nodeType":"Attribute","startLoc":37,"text":"obstime"},{"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    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    Parameters\n    ----------\n    ri : float or `~numpy.ndarray`\n        right ascension, radians\n    di : float or `~numpy.ndarray`\n        declination, radians\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    dc : float or `~numpy.ndarray`\n    ","endLoc":208,"header":"def aticq(ri, di, astrom)","id":12308,"name":"aticq","nodeType":"Function","startLoc":154,"text":"def aticq(ri, di, 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    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    Parameters\n    ----------\n    ri : float or `~numpy.ndarray`\n        right ascension, radians\n    di : float or `~numpy.ndarray`\n        declination, radians\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    dc : float or `~numpy.ndarray`\n    \"\"\"\n    # RA, Dec to cartesian unit vectors\n    pos = erfa.s2c(ri, di)\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        after = erfa.ld(1.0, before, before, astrom['eh'], astrom['em'], 5e-8)\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":8,"comment":"null","endLoc":2094,"id":12309,"name":"_Ode0","nodeType":"Attribute","startLoc":2094,"text":"self._Ode0"},{"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 Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    ","endLoc":2348,"id":12310,"nodeType":"Class","startLoc":2183,"text":"class w0waCDM(FLRW):\n    \"\"\"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 Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\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 `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, Ode0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wa = float(wa)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0\n\n    @property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in 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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wa * z / (1.0 + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        \"\"\"\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1.0 + z\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * \\\n            np.exp(-3 * self._wa * z / zp1)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wa={5:.3g}, Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wa,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":2272,"header":"def __init__(self, H0, Om0, Ode0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12311,"name":"__init__","nodeType":"Function","startLoc":2247,"text":"def __init__(self, H0, Om0, Ode0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wa = float(wa)\n\n        # Please see \"Notes about speeding up 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)"},{"col":0,"comment":"null","endLoc":106,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK4NoETerms)\ndef fk4noe_to_fk4noe(fk4necoord1, fk4neframe2)","id":12312,"name":"fk4noe_to_fk4noe","nodeType":"Function","startLoc":104,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK4NoETerms)\ndef fk4noe_to_fk4noe(fk4necoord1, fk4neframe2):\n    return fk4necoord1._precession_matrix(fk4necoord1.equinox, fk4neframe2.equinox)"},{"col":0,"comment":"\n    Return the e-terms of aberation vector\n\n    Parameters\n    ----------\n    equinox : Time object\n        The equinox for which to compute the e-terms\n    ","endLoc":141,"header":"def fk4_e_terms(equinox)","id":12313,"name":"fk4_e_terms","nodeType":"Function","startLoc":114,"text":"def fk4_e_terms(equinox):\n    \"\"\"\n    Return the e-terms of aberation 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":4,"comment":"null","endLoc":2545,"header":"def __init__(self, d_lon_coslat, d_lat, copy=True)","id":12314,"name":"__init__","nodeType":"Function","startLoc":2541,"text":"def __init__(self, d_lon_coslat, d_lat, 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.')"},{"col":4,"comment":" Dark energy equation of state at z=0","endLoc":2277,"header":"@property\n    def w0(self)","id":12315,"name":"w0","nodeType":"Function","startLoc":2274,"text":"@property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0"},{"col":4,"comment":" Negative derivative of dark energy equation of state w.r.t. a","endLoc":2282,"header":"@property\n    def wa(self)","id":12316,"name":"wa","nodeType":"Function","startLoc":2279,"text":"@property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in 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":2309,"header":"def w(self, z)","id":12317,"name":"w","nodeType":"Function","startLoc":2284,"text":"def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in 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\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wa * z / (1.0 + z)"},{"col":0,"comment":"\n    Normalise a p-vector.\n    ","endLoc":122,"header":"def norm(p)","id":12318,"name":"norm","nodeType":"Function","startLoc":118,"text":"def norm(p):\n    \"\"\"\n    Normalise a p-vector.\n    \"\"\"\n    return p/np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]"},{"col":0,"comment":"null","endLoc":178,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4, FK4NoETerms)\ndef fk4_to_fk4_no_e(fk4coord, fk4noeframe)","id":12319,"name":"fk4_to_fk4_no_e","nodeType":"Function","startLoc":144,"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":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        ","endLoc":2339,"header":"def de_density_scale(self, z)","id":12320,"name":"de_density_scale","nodeType":"Function","startLoc":2311,"text":"def de_density_scale(self, z):\n        r\"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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        \"\"\"\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1.0 + z\n        return zp1 ** (3 * (1 + self._w0 + self._wa)) * \\\n            np.exp(-3 * self._wa * z / zp1)"},{"col":4,"comment":"null","endLoc":2348,"header":"def __repr__(self)","id":12321,"name":"__repr__","nodeType":"Function","startLoc":2341,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wa={5:.3g}, Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wa,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"\n        Secant if the zenith angle for this coordinate, a common estimate of the\n        airmass.\n        ","endLoc":146,"header":"@property\n    def secz(self)","id":12322,"name":"secz","nodeType":"Function","startLoc":140,"text":"@property\n    def secz(self):\n        \"\"\"\n        Secant if the zenith angle for this coordinate, a common estimate of the\n        airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)"},{"col":4,"comment":"\n        The zenith angle for this coordinate\n        ","endLoc":153,"header":"@property\n    def zen(self)","id":12323,"name":"zen","nodeType":"Function","startLoc":148,"text":"@property\n    def zen(self):\n        \"\"\"\n        The zenith angle for this coordinate\n        \"\"\"\n        return _90DEG.to(self.alt.unit) - self.alt"},{"attributeType":"null","col":12,"comment":"null","endLoc":2267,"id":12324,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2267,"text":"self._inv_efunc_scalar"},{"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    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    Parameters\n    ----------\n    rc : float or `~numpy.ndarray`\n        right ascension, radians\n    dc : float or `~numpy.ndarray`\n        declination, radians\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    di : float or `~numpy.ndarray`\n    ","endLoc":256,"header":"def atciqz(rc, dc, astrom)","id":12325,"name":"atciqz","nodeType":"Function","startLoc":211,"text":"def atciqz(rc, dc, 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    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    Parameters\n    ----------\n    rc : float or `~numpy.ndarray`\n        right ascension, radians\n    dc : float or `~numpy.ndarray`\n        declination, radians\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    di : float or `~numpy.ndarray`\n    \"\"\"\n    # BCRS coordinate direction (unit vector).\n    pco = erfa.s2c(rc, dc)\n\n    # Light deflection by the Sun, giving BCRS natural direction.\n    pnat = erfa.ld(1.0, pco, pco, astrom['eh'], astrom['em'], 5e-8)\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"},{"col":4,"comment":"null","endLoc":2379,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12326,"name":"from_representation","nodeType":"Function","startLoc":2366,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":99,"id":12327,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":99,"text":"frame_specific_representation_info"},{"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":151,"header":"def get_cip(jd1, jd2)","id":12328,"name":"get_cip","nodeType":"Function","startLoc":125,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":2268,"id":12329,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2268,"text":"self._inv_efunc_scalar_args"},{"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":292,"header":"def prepare_earth_position_vel(time)","id":12330,"name":"prepare_earth_position_vel","nodeType":"Function","startLoc":259,"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 ..solar_system import (get_body_barycentric, get_body_barycentric_posvel)\n    # get barycentric position and velocity of earth\n    earth_pv = 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_pv[0] -\n                          sun).get_xyz(xyz_axis=-1).to_value(u.au)\n\n    # Also prepare earth_pv for passing to erfa, which wants xyz in last\n    # dimension, and pos/vel in one-but-last.\n    # (Note could use np.stack once our minimum numpy version is >=1.10.)\n    earth_pv = np.concatenate((earth_pv[0].get_xyz(xyz_axis=-1).to(u.au)\n                               [..., np.newaxis, :].value,\n                               earth_pv[1].get_xyz(xyz_axis=-1).to(u.au/u.d)\n                               [..., np.newaxis, :].value), axis=-2)\n    return earth_pv, earth_heliocentric"},{"col":0,"comment":"null","endLoc":61,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, CIRS)\ndef icrs_to_cirs(icrs_coo, cirs_frame)","id":12331,"name":"icrs_to_cirs","nodeType":"Function","startLoc":25,"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    jd1, jd2 = get_jd12(cirs_frame.obstime, 'tdb')\n    x, y, s = get_cip(jd1, jd2)\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(cirs_frame.obstime)\n    astrom = erfa.apci(jd1, jd2, earth_pv, earth_heliocentric, x, y, s)\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        usrepr = icrs_coo.represent_as(UnitSphericalRepresentation)\n        i_ra = usrepr.lon.to_value(u.radian)\n        i_dec = usrepr.lat.to_value(u.radian)\n        cirs_ra, cirs_dec = atciqz(i_ra, i_dec, 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\n        srepr = newcart.represent_as(SphericalRepresentation)\n        i_ra = srepr.lon.to_value(u.radian)\n        i_dec = srepr.lat.to_value(u.radian)\n        cirs_ra, cirs_dec = atciqz(i_ra, i_dec, 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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":127,"id":12332,"name":"default_representation","nodeType":"Attribute","startLoc":127,"text":"default_representation"},{"attributeType":"null","col":8,"comment":"null","endLoc":2253,"id":12333,"name":"_wa","nodeType":"Attribute","startLoc":2253,"text":"self._wa"},{"attributeType":"null","col":8,"comment":"null","endLoc":2252,"id":12334,"name":"_w0","nodeType":"Attribute","startLoc":2252,"text":"self._w0"},{"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\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    ","endLoc":2447,"id":12335,"nodeType":"Class","startLoc":2351,"text":"class Flatw0waCDM(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\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003):\n    :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        w0waCDM.__init__(self, H0, Om0, 0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"w0={3:.3g}, Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":2439,"header":"def __init__(self, H0, Om0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None)","id":12336,"name":"__init__","nodeType":"Function","startLoc":2413,"text":"def __init__(self, H0, Om0, w0=-1., wa=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None, name=None):\n\n        w0waCDM.__init__(self, H0, Om0, 0.0, w0=w0, wa=wa, Tcmb0=Tcmb0,\n                         Neff=Neff, m_nu=m_nu, name=name, Ob0=Ob0)\n        # Do some twiddling after the fact to get flatness\n        self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0\n        self._Ok0 = 0.0\n\n        # Please see \"Notes about speeding up 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":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":12337,"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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1925., 1975., N)]\n    equinox_fk5 = [\"J{0:7.2f}\".format(x) 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('System=FK4-NO-E,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=equinox_fk4[i]))\n        frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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":4,"comment":"null","endLoc":128,"id":12338,"name":"default_differential","nodeType":"Attribute","startLoc":128,"text":"default_differential"},{"attributeType":"UnitSphericalRepresentation","col":4,"comment":"null","endLoc":2337,"id":12339,"name":"base_representation","nodeType":"Attribute","startLoc":2337,"text":"base_representation"},{"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 rather than referenced.\n    ","endLoc":2430,"id":12340,"nodeType":"Class","startLoc":2382,"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 rather than referenced.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalDifferential\n\n    def __init__(self, d_lon, d_lat, d_distance, 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)"},{"col":4,"comment":"null","endLoc":2417,"header":"def represent_as(self, other_class, base=None)","id":12341,"name":"represent_as","nodeType":"Function","startLoc":2402,"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)"},{"attributeType":"null","col":4,"comment":"null","endLoc":130,"id":12342,"name":"obstime","nodeType":"Attribute","startLoc":130,"text":"obstime"},{"attributeType":"null","col":4,"comment":"null","endLoc":131,"id":12343,"name":"location","nodeType":"Attribute","startLoc":131,"text":"location"},{"attributeType":"null","col":4,"comment":"null","endLoc":132,"id":12344,"name":"pressure","nodeType":"Attribute","startLoc":132,"text":"pressure"},{"attributeType":"null","col":4,"comment":"null","endLoc":133,"id":12345,"name":"temperature","nodeType":"Attribute","startLoc":133,"text":"temperature"},{"attributeType":"null","col":4,"comment":"null","endLoc":134,"id":12346,"name":"relative_humidity","nodeType":"Attribute","startLoc":134,"text":"relative_humidity"},{"col":0,"comment":"null","endLoc":217,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, FK4NoETerms, FK4)\ndef fk4_no_e_to_fk4(fk4noecoord, fk4frame)","id":12347,"name":"fk4_no_e_to_fk4","nodeType":"Function","startLoc":181,"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)"},{"col":4,"comment":"null","endLoc":2604,"header":"def __init__(self, d_lon_coslat, d_lat, d_distance, copy=True)","id":12348,"name":"__init__","nodeType":"Function","startLoc":2600,"text":"def __init__(self, d_lon_coslat, d_lat, d_distance, 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.')"},{"attributeType":"null","col":4,"comment":"null","endLoc":135,"id":12349,"name":"obswl","nodeType":"Attribute","startLoc":135,"text":"obswl"},{"col":0,"comment":"\n    gets the two polar motion components in radians for use with apio13\n    ","endLoc":62,"header":"def get_polar_motion(time)","id":12350,"name":"get_polar_motion","nodeType":"Function","startLoc":35,"text":"def get_polar_motion(time):\n    \"\"\"\n    gets the two polar motion components in radians for use with apio13\n    \"\"\"\n    # Get the polar motion from the IERS table\n    xp, yp, status = iers.IERS_Auto.open().pm_xy(time, return_status=True)\n\n    wmsg = None\n    if np.any(status == iers.TIME_BEFORE_IERS_RANGE):\n        wmsg = ('Tried to get polar motions for times before IERS data is '\n                'valid. Defaulting to polar motion from the 50-yr mean for those. '\n                'This may affect precision at the 10s of arcsec level')\n        xp.ravel()[status.ravel() == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[0]\n        yp.ravel()[status.ravel() == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg, AstropyWarning)\n\n    if np.any(status == iers.TIME_BEYOND_IERS_RANGE):\n        wmsg = ('Tried to get polar motions for times after IERS data is '\n                'valid. Defaulting to polar motion from the 50-yr mean for those. '\n                'This may affect precision at the 10s of arcsec level')\n\n        xp.ravel()[status.ravel() == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[0]\n        yp.ravel()[status.ravel() == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg, AstropyWarning)\n\n    return xp.to_value(u.radian), yp.to_value(u.radian)"},{"col":4,"comment":"null","endLoc":2706,"header":"def __init__(self, d_phi, d_theta, d_r, copy=True)","id":12351,"name":"__init__","nodeType":"Function","startLoc":2702,"text":"def __init__(self, d_phi, d_theta, d_r, 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.')"},{"col":0,"comment":"","endLoc":4,"header":"fk4.py#<anonymous>","id":12352,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"FK4.__doc__ = FK4.__doc__.format(params=_base_radec_docstring)\n\nFK4NoETerms.__doc__ = FK4NoETerms.__doc__.format(params=_base_radec_docstring)"},{"col":4,"comment":"null","endLoc":2430,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12353,"name":"from_representation","nodeType":"Function","startLoc":2419,"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":"null","endLoc":2447,"header":"def __repr__(self)","id":12354,"name":"__repr__","nodeType":"Function","startLoc":2441,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"w0={3:.3g}, Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6}, \"\\\n                 \"Ob0={7:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0, self._w0,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"fileName":"intermediate_rotation_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12355,"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, 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\n\nfrom ..baseframe import frame_transform_graph\nfrom ..transformations import FunctionTransformWithFiniteDifference\nfrom ..matrix_utilities import matrix_transpose\nfrom ... import _erfa as erfa\n\nfrom .gcrs import GCRS, PrecessedGeocentric\nfrom .cirs import CIRS\nfrom .itrs import ITRS\nfrom .utils import get_polar_motion, get_jd12\n\n# # first define helper functions\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 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\n# now the actual transforms\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame):\n    # first get us to a 0 pos/vel GCRS at the target obstime\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=cirs_frame.obstime))\n\n    # now get the pmatrix\n    pmat = gcrs_to_cirs_mat(cirs_frame.obstime)\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    gcrs = GCRS(newrepr, obstime=cirs_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(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame):\n    # first get us to CIRS at the target obstime\n    cirs_coo2 = cirs_coo.transform_to(CIRS(obstime=itrs_frame.obstime))\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@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, ITRS)\ndef itrs_to_itrs(from_coo, to_frame):\n    # this self-transform goes through CIRS right now, which implicitly also\n    # goes back to ICRS\n    return from_coo.transform_to(CIRS).transform_to(to_frame)\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, obstime=to_frame.obstime,\n                           obsgeoloc=to_frame.obsgeoloc,\n                           obsgeovel=to_frame.obsgeovel)\n\n    # then move to the GCRS that's actually desired\n    return gcrs_coo.transform_to(to_frame)\n"},{"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":87,"header":"def get_dut1utc(time)","id":12356,"name":"get_dut1utc","nodeType":"Function","startLoc":77,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2434,"id":12357,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2434,"text":"self._inv_efunc_scalar"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":2394,"id":12358,"name":"base_representation","nodeType":"Attribute","startLoc":2394,"text":"base_representation"},{"attributeType":"UnitSphericalDifferential","col":4,"comment":"null","endLoc":2395,"id":12359,"name":"_unit_differential","nodeType":"Attribute","startLoc":2395,"text":"_unit_differential"},{"col":0,"comment":"null","endLoc":26,"header":"def gcrs_to_cirs_mat(time)","id":12360,"name":"gcrs_to_cirs_mat","nodeType":"Function","startLoc":24,"text":"def gcrs_to_cirs_mat(time):\n    # celestial-to-intermediate matrix\n    return erfa.c2i06a(*get_jd12(time, 'tt'))"},{"className":"BaseSphericalCosLatDifferential","col":0,"comment":"Differtials from points on a spherical base representation.\n\n    With cos(lat) assumed to be included in the longitude differential.\n    ","endLoc":2520,"id":12361,"nodeType":"Class","startLoc":2433,"text":"class BaseSphericalCosLatDifferential(BaseDifferential):\n    \"\"\"Differtials 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` 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":"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":2461,"header":"@classmethod\n    def _get_base_vectors(cls, base)","id":12362,"name":"_get_base_vectors","nodeType":"Function","startLoc":2438,"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":0,"comment":"null","endLoc":29,"id":12363,"name":"PIOVER2","nodeType":"Attribute","startLoc":29,"text":"PIOVER2"},{"col":0,"comment":"null","endLoc":81,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\ndef cirs_to_altaz(cirs_coo, altaz_frame)","id":12364,"name":"cirs_to_altaz","nodeType":"Function","startLoc":22,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, AltAz)\ndef cirs_to_altaz(cirs_coo, altaz_frame):\n    if np.any(cirs_coo.obstime != altaz_frame.obstime):\n        # the only frame attribute for the current CIRS is the obstime, but this\n        # would need to be updated if a future change allowed specifying an\n        # Earth location algorithm or something\n        cirs_coo = cirs_coo.transform_to(CIRS(obstime=altaz_frame.obstime))\n\n    # we use the same obstime everywhere now that we know they're the same\n    obstime = cirs_coo.obstime\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    if is_unitspherical:\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    else:\n        # compute an \"astrometric\" ra/dec -i.e., the direction of the\n        # displacement vector from the observer to the target in CIRS\n        loccirs = altaz_frame.location.get_itrs(cirs_coo.obstime).transform_to(cirs_coo)\n        diffrepr = (cirs_coo.cartesian - loccirs.cartesian).represent_as(UnitSphericalRepresentation)\n\n        cirs_ra = diffrepr.lon.to_value(u.radian)\n        cirs_dec = diffrepr.lat.to_value(u.radian)\n\n    lon, lat, height = altaz_frame.location.to_geodetic('WGS84')\n    xp, yp = get_polar_motion(obstime)\n\n    # first set up the astrometry context for CIRS<->AltAz\n    jd1, jd2 = get_jd12(obstime, 'utc')\n    astrom = erfa.apio13(jd1, jd2,\n                         get_dut1utc(obstime),\n                         lon.to_value(u.radian), lat.to_value(u.radian),\n                         height.to_value(u.m),\n                         xp, yp,  # polar motion\n                         # all below are already in correct units because they are QuantityFrameAttribues\n                         altaz_frame.pressure.value,\n                         altaz_frame.temperature.value,\n                         altaz_frame.relative_humidity,\n                         altaz_frame.obswl.value)\n\n    az, zen, _, _, _ = erfa.atioq(cirs_ra, cirs_dec, astrom)\n\n    if is_unitspherical:\n        rep = UnitSphericalRepresentation(lat=u.Quantity(PIOVER2 - zen, u.radian, copy=False),\n                                          lon=u.Quantity(az, u.radian, copy=False),\n                                          copy=False)\n    else:\n        # now we get the distance as the cartesian distance from the earth\n        # location to the coordinate location\n        locitrs = altaz_frame.location.get_itrs(obstime)\n        distance = locitrs.separation_3d(cirs_coo)\n        rep = SphericalRepresentation(lat=u.Quantity(PIOVER2 - zen, u.radian, copy=False),\n                                      lon=u.Quantity(az, u.radian, copy=False),\n                                      distance=distance,\n                                      copy=False)\n    return altaz_frame.realize_frame(rep)"},{"col":0,"comment":"null","endLoc":41,"header":"def cirs_to_itrs_mat(time)","id":12365,"name":"cirs_to_itrs_mat","nodeType":"Function","startLoc":29,"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":"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":2472,"header":"def _d_lon(self, base)","id":12366,"name":"_d_lon","nodeType":"Function","startLoc":2463,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2435,"id":12367,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2435,"text":"self._inv_efunc_scalar_args"},{"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":2486,"header":"@classmethod\n    def _get_d_lon_coslat(cls, d_lon, base)","id":12368,"name":"_get_d_lon_coslat","nodeType":"Function","startLoc":2474,"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":0,"comment":"null","endLoc":46,"header":"def gcrs_precession_mat(equinox)","id":12369,"name":"gcrs_precession_mat","nodeType":"Function","startLoc":44,"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)"},{"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` 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":2520,"header":"def _combine_operation(self, op, other, reverse=False)","id":12370,"name":"_combine_operation","nodeType":"Function","startLoc":2488,"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` 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":0,"comment":"null","endLoc":59,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame)","id":12371,"name":"gcrs_to_cirs","nodeType":"Function","startLoc":51,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, CIRS)\ndef gcrs_to_cirs(gcrs_coo, cirs_frame):\n    # first get us to a 0 pos/vel GCRS at the target obstime\n    gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=cirs_frame.obstime))\n\n    # now get the pmatrix\n    pmat = gcrs_to_cirs_mat(cirs_frame.obstime)\n    crepr = gcrs_coo2.cartesian.transform(pmat)\n    return cirs_frame.realize_frame(crepr)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2420,"id":12372,"name":"_Ok0","nodeType":"Attribute","startLoc":2420,"text":"self._Ok0"},{"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 rather than referenced.\n    ","endLoc":2579,"id":12373,"nodeType":"Class","startLoc":2523,"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 rather than referenced.\n    \"\"\"\n    base_representation = UnitSphericalRepresentation\n    attr_classes = OrderedDict([('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, 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    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)"},{"col":4,"comment":"null","endLoc":2539,"header":"@classproperty\n    def _dimensional_differential(cls)","id":12374,"name":"_dimensional_differential","nodeType":"Function","startLoc":2537,"text":"@classproperty\n    def _dimensional_differential(cls):\n        return SphericalCosLatDifferential"},{"col":4,"comment":"null","endLoc":2556,"header":"def to_cartesian(self, base)","id":12375,"name":"to_cartesian","nodeType":"Function","startLoc":2547,"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":2419,"id":12376,"name":"_Ode0","nodeType":"Attribute","startLoc":2419,"text":"self._Ode0"},{"className":"wpwaCDM","col":0,"comment":"FLRW cosmology with a CPL dark energy equation of state, a pivot\n    redshift, and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003), but modified\n    to have a pivot redshift as in the findings of the Dark Energy\n    Task Force (Albrecht et al. arXiv:0901.0721 (2009)):\n    :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\n    H0 : float or `~astropy.units.Quantity`\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, optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    ","endLoc":2635,"id":12377,"nodeType":"Class","startLoc":2450,"text":"class wpwaCDM(FLRW):\n    \"\"\"FLRW cosmology with a CPL dark energy equation of state, a pivot\n    redshift, and curvature.\n\n    The equation for the dark energy equation of state uses the\n    CPL form as described in Chevallier & Polarski Int. J. Mod. Phys.\n    D10, 213 (2001) and Linder PRL 90, 91301 (2003), but modified\n    to have a pivot redshift as in the findings of the Dark Energy\n    Task Force (Albrecht et al. arXiv:0901.0721 (2009)):\n    :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\n    H0 : float or `~astropy.units.Quantity`\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, optional\n        Pivot redshift -- the redshift where w(z) = wp\n\n    Tcmb0 : float or scalar `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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\n    def __init__(self, H0, Om0, Ode0, wp=-1., wa=0., zp=0,\n                 Tcmb0=0, Neff=3.04, m_nu=u.Quantity(0.0, u.eV),\n                 Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._wp = float(wp)\n        self._wa = float(wa)\n        self._zp = float(zp)\n\n        # Please see \"Notes about speeding up integrals\" for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp)\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    @property\n    def wp(self):\n        \"\"\" Dark energy equation of state at the pivot redshift zp\"\"\"\n        return self._wp\n\n    @property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa\n\n    @property\n    def zp(self):\n        \"\"\" The pivot redshift, where w(z) = wp\"\"\"\n        return self._zp\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_p + w_a (a_p - a)` where :math:`a = 1/1+z`\n        and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        apiv = 1.0 / (1.0 + self._zp)\n        return self._wp + self._wa * (apiv - 1.0 / (1. + 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        apiv = 1. / (1. + self._zp)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, wp={4:.3g}, \"\\\n                 \"wa={5:.3g}, zp={6:.3g}, Tcmb0={7:.4g}, Neff={8:.3g}, \"\\\n                 \"m_nu={9}, Ob0={10:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._wp, self._wa, self._zp,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":2549,"header":"def __init__(self, H0, Om0, Ode0, wp=-1., wa=0., zp=0,\n                 Tcmb0=0, Neff=3.04, m_nu=u.Quantity(0.0, u.eV),\n                 Ob0=None, name=None)","id":12378,"name":"__init__","nodeType":"Function","startLoc":2521,"text":"def __init__(self, H0, Om0, Ode0, wp=-1., wa=0., zp=0,\n                 Tcmb0=0, Neff=3.04, m_nu=u.Quantity(0.0, u.eV),\n                 Ob0=None, name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._wp = float(wp)\n        self._wa = float(wa)\n        self._zp = float(zp)\n\n        # Please see \"Notes about speeding up integrals\" for discussion\n        # about what is being done here.\n        apiv = 1.0 / (1.0 + self._zp)\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":"null","endLoc":70,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, GCRS)\ndef cirs_to_gcrs(cirs_coo, gcrs_frame)","id":12379,"name":"cirs_to_gcrs","nodeType":"Function","startLoc":62,"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    gcrs = GCRS(newrepr, obstime=cirs_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":99,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ICRS)\ndef cirs_to_icrs(cirs_coo, icrs_frame)","id":12380,"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    srepr = cirs_coo.represent_as(SphericalRepresentation)\n    cirs_ra = srepr.lon.to_value(u.radian)\n    cirs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->cirs and then convert to\n    # astrometric coordinate direction\n    jd1, jd2 = get_jd12(cirs_coo.obstime, 'tdb')\n    x, y, s = get_cip(jd1, jd2)\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(cirs_coo.obstime)\n    astrom = erfa.apci(jd1, jd2, earth_pv, earth_heliocentric, x, y, s)\n    i_ra, i_dec = aticq(cirs_ra, cirs_dec, 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)"},{"col":4,"comment":" Dark energy equation of state at the pivot redshift zp","endLoc":2554,"header":"@property\n    def wp(self)","id":12381,"name":"wp","nodeType":"Function","startLoc":2551,"text":"@property\n    def wp(self):\n        \"\"\" Dark energy equation of state at the pivot redshift zp\"\"\"\n        return self._wp"},{"col":4,"comment":" Negative derivative of dark energy equation of state w.r.t. a","endLoc":2559,"header":"@property\n    def wa(self)","id":12382,"name":"wa","nodeType":"Function","startLoc":2556,"text":"@property\n    def wa(self):\n        \"\"\" Negative derivative of dark energy equation of state w.r.t. a\"\"\"\n        return self._wa"},{"col":4,"comment":" The pivot redshift, where w(z) = wp","endLoc":2564,"header":"@property\n    def zp(self)","id":12383,"name":"zp","nodeType":"Function","startLoc":2561,"text":"@property\n    def zp(self):\n        \"\"\" The pivot redshift, where w(z) = wp\"\"\"\n        return self._zp"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_p + w_a (a_p - a)` where :math:`a = 1/1+z`\n        and :math:`a_p = 1 / 1 + z_p`.\n        ","endLoc":2593,"header":"def w(self, z)","id":12384,"name":"w","nodeType":"Function","startLoc":2566,"text":"def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is\n        :math:`w(z) = w_p + w_a (a_p - a)` where :math:`a = 1/1+z`\n        and :math:`a_p = 1 / 1 + z_p`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        apiv = 1.0 / (1.0 + self._zp)\n        return self._wp + self._wa * (apiv - 1.0 / (1. + z))"},{"col":4,"comment":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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":2626,"header":"def de_density_scale(self, z)","id":12385,"name":"de_density_scale","nodeType":"Function","startLoc":2595,"text":"def de_density_scale(self, z):\n        r\"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        apiv = 1. / (1. + self._zp)\n        return zp1 ** (3. * (1. + self._wp + apiv * self._wa)) * \\\n            np.exp(-3. * self._wa * z / zp1)"},{"col":4,"comment":"null","endLoc":2635,"header":"def __repr__(self)","id":12386,"name":"__repr__","nodeType":"Function","startLoc":2628,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, wp={4:.3g}, \"\\\n                 \"wa={5:.3g}, zp={6:.3g}, Tcmb0={7:.4g}, Neff={8:.3g}, \"\\\n                 \"m_nu={9}, Ob0={10:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._wp, self._wa, self._zp,\n                             self._Tcmb0, self._Neff, self.m_nu,\n                             _float_or_none(self._Ob0))"},{"attributeType":"null","col":12,"comment":"null","endLoc":2544,"id":12387,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2544,"text":"self._inv_efunc_scalar"},{"col":4,"comment":"null","endLoc":2563,"header":"def represent_as(self, other_class, base=None)","id":12388,"name":"represent_as","nodeType":"Function","startLoc":2558,"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":12,"comment":"null","endLoc":2545,"id":12389,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2545,"text":"self._inv_efunc_scalar_args"},{"col":0,"comment":"null","endLoc":81,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame)","id":12390,"name":"cirs_to_itrs","nodeType":"Function","startLoc":73,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, ITRS)\ndef cirs_to_itrs(cirs_coo, itrs_frame):\n    # first get us to CIRS at the target obstime\n    cirs_coo2 = cirs_coo.transform_to(CIRS(obstime=itrs_frame.obstime))\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":"null","col":8,"comment":"null","endLoc":2529,"id":12391,"name":"_zp","nodeType":"Attribute","startLoc":2529,"text":"self._zp"},{"attributeType":"null","col":8,"comment":"null","endLoc":2528,"id":12392,"name":"_wa","nodeType":"Attribute","startLoc":2528,"text":"self._wa"},{"attributeType":"null","col":8,"comment":"null","endLoc":2527,"id":12393,"name":"_wp","nodeType":"Attribute","startLoc":2527,"text":"self._wp"},{"className":"w0wzCDM","col":0,"comment":"FLRW cosmology with a variable dark energy equation of state\n    and curvature.\n\n    The equation for the dark energy equation of state uses the\n    simple form: :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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":2805,"id":12394,"nodeType":"Class","startLoc":2638,"text":"class w0wzCDM(FLRW):\n    \"\"\"FLRW cosmology with a variable dark energy equation of state\n    and curvature.\n\n    The equation for the dark energy equation of state uses the\n    simple form: :math:`w(z) = w_0 + w_z z`.\n\n    This form is not recommended for z > 1.\n\n    Parameters\n    ----------\n\n    H0 : float or `~astropy.units.Quantity`\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 `~astropy.units.Quantity`, optional\n        Temperature of the CMB z=0. If a float, must be in [K].\n        Default: 0 [K]. Setting this to zero will turn off both photons\n        and neutrinos (even massive ones).\n\n    Neff : float, optional\n        Effective number of Neutrino species. Default 3.04.\n\n    m_nu : `~astropy.units.Quantity`, optional\n        Mass of each neutrino species. If this is a scalar Quantity, then all\n        neutrino species are assumed to have that mass. Otherwise, the mass of\n        each species. The actual number of neutrino species (and hence the\n        number of elements of m_nu if it is not scalar) must be the floor of\n        Neff. Typically this means you should provide three neutrino masses\n        unless you are considering something like 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\n        computation that requires its value will raise an exception.\n\n    name : str, optional\n        Name for this cosmological object.\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    def __init__(self, H0, Om0, Ode0, w0=-1., wz=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None,\n                 name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wz = float(wz)\n\n        # Please see \"Notes about speeding up 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    @property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0\n\n    @property\n    def wz(self):\n        \"\"\" Derivative of the dark energy equation of state w.r.t. z\"\"\"\n        return self._wz\n\n    def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is given by\n        :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wz * 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 : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) *\\\n            np.exp(-3. * self._wz * z)\n\n    def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wz={5:.3g} Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wz, self._Tcmb0,\n                             self._Neff, self.m_nu, _float_or_none(self._Ob0))"},{"col":4,"comment":"null","endLoc":2730,"header":"def __init__(self, H0, Om0, Ode0, w0=-1., wz=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None,\n                 name=None)","id":12395,"name":"__init__","nodeType":"Function","startLoc":2704,"text":"def __init__(self, H0, Om0, Ode0, w0=-1., wz=0., Tcmb0=0,\n                 Neff=3.04, m_nu=u.Quantity(0.0, u.eV), Ob0=None,\n                 name=None):\n\n        FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name,\n                      Ob0=Ob0)\n        self._w0 = float(w0)\n        self._wz = float(wz)\n\n        # Please see \"Notes about speeding up 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)"},{"col":4,"comment":"null","endLoc":2579,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12396,"name":"from_representation","nodeType":"Function","startLoc":2565,"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)"},{"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":12397,"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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk4 = [\"J{0:7.2f}\".format(x) 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('System=Galactic,Epoch={epoch}'.format(epoch=obstime[i]))\n        frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} 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":113,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, CIRS)\ndef cirs_to_cirs(from_coo, to_frame)","id":12398,"name":"cirs_to_cirs","nodeType":"Function","startLoc":102,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, CIRS, CIRS)\ndef cirs_to_cirs(from_coo, to_frame):\n    if np.all(from_coo.obstime == to_frame.obstime):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # the CIRS<-> CIRS transform actually goes through ICRS.  This 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.\n        return from_coo.transform_to(ICRS).transform_to(to_frame)"},{"col":0,"comment":"null","endLoc":164,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ICRS, GCRS)\ndef icrs_to_gcrs(icrs_coo, gcrs_frame)","id":12399,"name":"icrs_to_gcrs","nodeType":"Function","startLoc":118,"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. There are a few steps...\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    # (Note could use np.stack once our minimum numpy version is >=1.10.)\n    pv = np.concatenate(\n        (gcrs_frame.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_frame.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    # find the position and velocity of earth\n    jd1, jd2 = get_jd12(gcrs_frame.obstime, 'tdb')\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_frame.obstime)\n\n    # get astrometry context object, astrom.\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\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        usrepr = icrs_coo.represent_as(UnitSphericalRepresentation)\n        i_ra = usrepr.lon.to_value(u.radian)\n        i_dec = usrepr.lat.to_value(u.radian)\n        gcrs_ra, gcrs_dec = atciqz(i_ra, i_dec, 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        i_ra = srepr.lon.to_value(u.radian)\n        i_dec = srepr.lat.to_value(u.radian)\n        gcrs_ra, gcrs_dec = atciqz(i_ra, i_dec, 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":4,"comment":" Dark energy equation of state at z=0","endLoc":2735,"header":"@property\n    def w0(self)","id":12400,"name":"w0","nodeType":"Function","startLoc":2732,"text":"@property\n    def w0(self):\n        \"\"\" Dark energy equation of state at z=0\"\"\"\n        return self._w0"},{"col":0,"comment":"null","endLoc":92,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, CIRS)\ndef itrs_to_cirs(itrs_coo, cirs_frame)","id":12401,"name":"itrs_to_cirs","nodeType":"Function","startLoc":84,"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":4,"comment":" Derivative of the dark energy equation of state w.r.t. z","endLoc":2740,"header":"@property\n    def wz(self)","id":12402,"name":"wz","nodeType":"Function","startLoc":2737,"text":"@property\n    def wz(self):\n        \"\"\" Derivative of the dark energy equation of state w.r.t. z\"\"\"\n        return self._wz"},{"col":4,"comment":"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is given by\n        :math:`w(z) = w_0 + w_z z`.\n        ","endLoc":2767,"header":"def w(self, z)","id":12403,"name":"w","nodeType":"Function","startLoc":2742,"text":"def w(self, z):\n        \"\"\"Returns dark energy equation of state at redshift ``z``.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        w : ndarray, or float if input scalar\n          The dark energy equation of state\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\n        pressure at redshift z and :math:`\\\\rho(z)` is the density\n        at redshift z, both in units where c=1.  Here this is given by\n        :math:`w(z) = w_0 + w_z z`.\n        \"\"\"\n\n        if isiterable(z):\n            z = np.asarray(z)\n\n        return self._w0 + self._wz * z"},{"col":0,"comment":"null","endLoc":124,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\ndef altaz_to_cirs(altaz_coo, cirs_frame)","id":12404,"name":"altaz_to_cirs","nodeType":"Function","startLoc":84,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, CIRS)\ndef altaz_to_cirs(altaz_coo, cirs_frame):\n    usrepr = altaz_coo.represent_as(UnitSphericalRepresentation)\n    az = usrepr.lon.to_value(u.radian)\n    zen = PIOVER2 - usrepr.lat.to_value(u.radian)\n\n    lon, lat, height = altaz_coo.location.to_geodetic('WGS84')\n    xp, yp = get_polar_motion(altaz_coo.obstime)\n\n    # first set up the astrometry context for ICRS<->CIRS at the altaz_coo time\n    jd1, jd2 = get_jd12(altaz_coo.obstime, 'utc')\n    astrom = erfa.apio13(jd1, jd2,\n                         get_dut1utc(altaz_coo.obstime),\n                         lon.to_value(u.radian), lat.to_value(u.radian),\n                         height.to_value(u.m),\n                         xp, yp,  # polar motion\n                         # all below are already in correct units because they are QuantityFrameAttribues\n                         altaz_coo.pressure.value,\n                         altaz_coo.temperature.value,\n                         altaz_coo.relative_humidity,\n                         altaz_coo.obswl.value)\n\n    # the 'A' indicates zen/az inputs\n    cirs_ra, cirs_dec = erfa.atoiq('A', az, zen, astrom)*u.radian\n    if isinstance(altaz_coo.data, UnitSphericalRepresentation) or altaz_coo.cartesian.x.unit == u.one:\n        cirs_at_aa_time = CIRS(ra=cirs_ra, dec=cirs_dec, distance=None,\n                               obstime=altaz_coo.obstime)\n    else:\n        # treat the output of atoiq as an \"astrometric\" RA/DEC, so to get the\n        # actual RA/Dec from the observers vantage point, we have to reverse\n        # the vector operation of cirs_to_altaz (see there for more detail)\n\n        loccirs = altaz_coo.location.get_itrs(altaz_coo.obstime).transform_to(cirs_frame)\n\n        astrometric_rep = SphericalRepresentation(lon=cirs_ra, lat=cirs_dec,\n                                                  distance=altaz_coo.distance)\n        newrepr = astrometric_rep + loccirs.cartesian\n        cirs_at_aa_time = CIRS(newrepr, obstime=altaz_coo.obstime)\n\n    # this final transform may be a no-op if the obstimes are the same\n    return cirs_at_aa_time.transform_to(cirs_frame)"},{"attributeType":"UnitSphericalRepresentation","col":4,"comment":"null","endLoc":2533,"id":12405,"name":"base_representation","nodeType":"Attribute","startLoc":2533,"text":"base_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":2534,"id":12406,"name":"attr_classes","nodeType":"Attribute","startLoc":2534,"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 rather than referenced.\n    ","endLoc":2635,"id":12407,"nodeType":"Class","startLoc":2582,"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 rather than referenced.\n    \"\"\"\n    base_representation = SphericalRepresentation\n    _unit_differential = UnitSphericalCosLatDifferential\n    attr_classes = OrderedDict([('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, d_distance, 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)"},{"col":4,"comment":"null","endLoc":2620,"header":"def represent_as(self, other_class, base=None)","id":12408,"name":"represent_as","nodeType":"Function","startLoc":2606,"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":4,"comment":" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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":2797,"header":"def de_density_scale(self, z)","id":12409,"name":"de_density_scale","nodeType":"Function","startLoc":2769,"text":"def de_density_scale(self, z):\n        r\"\"\" Evaluates the redshift dependence of the dark energy density.\n\n        Parameters\n        ----------\n        z : array-like\n          Input redshifts.\n\n        Returns\n        -------\n        I : ndarray, or float if input scalar\n          The scaling of the energy density of dark energy with redshift.\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\n        if isiterable(z):\n            z = np.asarray(z)\n        zp1 = 1. + z\n        return zp1 ** (3. * (1. + self._w0 - self._wz)) *\\\n            np.exp(-3. * self._wz * z)"},{"col":4,"comment":"null","endLoc":2805,"header":"def __repr__(self)","id":12410,"name":"__repr__","nodeType":"Function","startLoc":2799,"text":"def __repr__(self):\n        retstr = \"{0}H0={1:.3g}, Om0={2:.3g}, \"\\\n                 \"Ode0={3:.3g}, w0={4:.3g}, wz={5:.3g} Tcmb0={6:.4g}, \"\\\n                 \"Neff={7:.3g}, m_nu={8}, Ob0={9:s})\"\n        return retstr.format(self._namelead(), self._H0, self._Om0,\n                             self._Ode0, self._w0, self._wz, self._Tcmb0,\n                             self._Neff, self.m_nu, _float_or_none(self._Ob0))"},{"attributeType":"null","col":12,"comment":"null","endLoc":2725,"id":12411,"name":"_inv_efunc_scalar","nodeType":"Attribute","startLoc":2725,"text":"self._inv_efunc_scalar"},{"col":4,"comment":"null","endLoc":2635,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12412,"name":"from_representation","nodeType":"Function","startLoc":2622,"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)"},{"col":0,"comment":"null","endLoc":99,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, ITRS)\ndef itrs_to_itrs(from_coo, to_frame)","id":12413,"name":"itrs_to_itrs","nodeType":"Function","startLoc":95,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, ITRS, ITRS)\ndef itrs_to_itrs(from_coo, to_frame):\n    # this self-transform goes through CIRS right now, which implicitly also\n    # goes back to ICRS\n    return from_coo.transform_to(CIRS).transform_to(to_frame)"},{"col":0,"comment":"null","endLoc":117,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, PrecessedGeocentric)\ndef gcrs_to_precessedgeo(from_coo, to_frame)","id":12414,"name":"gcrs_to_precessedgeo","nodeType":"Function","startLoc":107,"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":130,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, PrecessedGeocentric, GCRS)\ndef precessedgeo_to_gcrs(from_coo, to_frame)","id":12415,"name":"precessedgeo_to_gcrs","nodeType":"Function","startLoc":120,"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, obstime=to_frame.obstime,\n                           obsgeoloc=to_frame.obsgeoloc,\n                           obsgeovel=to_frame.obsgeovel)\n\n    # then move to the GCRS that's actually desired\n    return gcrs_coo.transform_to(to_frame)"},{"attributeType":"null","col":12,"comment":"null","endLoc":2726,"id":12416,"name":"_inv_efunc_scalar_args","nodeType":"Attribute","startLoc":2726,"text":"self._inv_efunc_scalar_args"},{"col":0,"comment":"null","endLoc":131,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, AltAz)\ndef altaz_to_altaz(from_coo, to_frame)","id":12417,"name":"altaz_to_altaz","nodeType":"Function","startLoc":127,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, AltAz)\ndef altaz_to_altaz(from_coo, to_frame):\n    # for now we just implement this through CIRS to make sure we get everything\n    # covered\n    return from_coo.transform_to(CIRS(obstime=from_coo.obstime)).transform_to(to_frame)"},{"col":0,"comment":"null","endLoc":209,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, ICRS)\ndef gcrs_to_icrs(gcrs_coo, icrs_frame)","id":12418,"name":"gcrs_to_icrs","nodeType":"Function","startLoc":167,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, ICRS)\ndef gcrs_to_icrs(gcrs_coo, icrs_frame):\n    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    gcrs_ra = srepr.lon.to_value(u.radian)\n    gcrs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to BCRS\n    # coordinate direction\n    pv = np.concatenate(\n        (gcrs_coo.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_coo.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    jd1, jd2 = get_jd12(gcrs_coo.obstime, 'tdb')\n\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_coo.obstime)\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\n\n    i_ra, i_dec = aticq(gcrs_ra, gcrs_dec, 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":"null","col":16,"comment":"null","endLoc":8,"id":12419,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":10,"id":12420,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"attributeType":"null","col":25,"comment":"null","endLoc":15,"id":12421,"name":"erfa","nodeType":"Attribute","startLoc":15,"text":"erfa"},{"col":0,"comment":"","endLoc":6,"header":"cirs_observed_transforms.py#<anonymous>","id":12422,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to \"observed\" systems from CIRS.\nCurrently that just means AltAz.\n\"\"\""},{"fileName":"galactocentric.py","filePath":"astropy/coordinates/builtin_frames","id":12423,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport warnings\n\nimport numpy as np\n\nfrom ... import units as u\nfrom ...utils.exceptions import AstropyDeprecationWarning\nfrom ..angles import Angle\nfrom ..matrix_utilities import rotation_matrix, matrix_product, matrix_transpose\nfrom .. import representation as r\nfrom ..baseframe import (BaseCoordinateFrame, frame_transform_graph,\n                         RepresentationMapping)\nfrom ..attributes import (Attribute, CoordinateAttribute,\n                          QuantityAttribute,\n                          DifferentialAttribute)\nfrom ..transformations import AffineTransform\nfrom ..errors import ConvertError\n\nfrom .icrs import ICRS\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 Galactocentric(BaseCoordinateFrame):\n    r\"\"\"\n    A coordinate or frame in the Galactocentric system. This frame\n    requires specifying the Sun-Galactic center distance, and optionally\n    the height of the Sun above the Galactic midplane.\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    The default position of the Galactic Center in ICRS coordinates is\n    taken from Reid et al. 2004,\n    http://adsabs.harvard.edu/abs/2004ApJ...616..872R.\n\n    .. math::\n\n        {\\rm RA} = 17:45:37.224~{\\rm hr}\\\\\n        {\\rm Dec} = -28:56:10.23~{\\rm deg}\n\n    The default distance to the Galactic Center is 8.3 kpc, e.g.,\n    Gillessen et al. (2009),\n    https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G/abstract\n\n    The default height of the Sun above the Galactic midplane is taken to\n    be 27 pc, as measured by Chen et al. (2001),\n    https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C/abstract\n\n    The default solar motion relative to the Galactic center is taken from a\n    combination of Schönrich et al. (2010) [for the peculiar velocity] and\n    Bovy (2015) [for the circular velocity at the solar radius],\n    https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S/abstract\n    https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B/abstract\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.representation.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\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    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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\n    Other parameters\n    ----------------\n    galcen_coord : `ICRS`, optional, must be keyword\n        The ICRS coordinates of the Galactic center.\n    galcen_distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic center.\n    galcen_v_sun : `~astropy.coordinates.representation.CartesianDifferential`, optional, must be keyword\n        The velocity of the sun *in the Galactocentric frame* as Cartesian\n        velocity components.\n    z_sun : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic midplane.\n    roll : `Angle`, optional, must be keyword\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    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 coordinate frame or\n    `~astropy.coordinates.SkyCoord` object::\n\n        >>> import astropy.units as u\n        >>> import astropy.coordinates as coord\n        >>> c = coord.ICRS(ra=[158.3122, 24.5] * u.degree,\n        ...                dec=[-17.3, 81.52] * u.degree,\n        ...                distance=[11.5, 24.12] * u.kpc)\n        >>> c.transform_to(coord.Galactocentric) # doctest: +FLOAT_CMP\n        <Galactocentric Coordinate (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): (x, y, z) in kpc\n            [( -9.6083819 ,  -9.40062188,  6.52056066),\n             (-21.28302307,  18.76334013,  7.84693855)]>\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        <Galactocentric Coordinate (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            ( 266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=( 11.1,  232.24,  7.25) km / s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.40785924,  -9.40062188,  6.52066574),\n             (-21.08239383,  18.76334013,  7.84798135)]>\n\n    Similarly, transforming from the Galactocentric frame to another coordinate frame::\n\n        >>> c = coord.Galactocentric(x=[-8.3, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[0.027, 24.12] * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n            [(  86.22349059, 28.83894138,  4.39157788e-05),\n             ( 289.66802652, 49.88763881,  8.59640735e+01)]>\n\n    Or, with custom specification of the Galactic center::\n\n        >>> c = coord.Galactocentric(x=[-8.0, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[21.0, 24120.0] * u.pc,\n        ...                          z_sun=21 * u.pc, galcen_distance=8. * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (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    frame_specific_representation_info = {\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.CartesianRepresentation\n    default_differential = r.CartesianDifferential\n\n    # frame attributes\n    galcen_coord = CoordinateAttribute(default=ICRS(ra=266.4051*u.degree,\n                                                    dec=-28.936175*u.degree),\n                                       frame=ICRS)\n    galcen_distance = QuantityAttribute(default=8.3*u.kpc)\n\n    galcen_v_sun = DifferentialAttribute(\n        default=r.CartesianDifferential([11.1, 220+12.24, 7.25] * u.km/u.s),\n        allowed_classes=[r.CartesianDifferential])\n\n    z_sun = QuantityAttribute(default=27.*u.pc)\n    roll = QuantityAttribute(default=0.*u.deg)\n\n    def __init__(self, *args, **kwargs):\n\n        # backwards-compatibility\n        if ('galcen_ra' in kwargs or 'galcen_dec' in kwargs):\n            warnings.warn(\"The arguments 'galcen_ra', and 'galcen_dec' are \"\n                          \"deprecated in favor of specifying the sky coordinate\"\n                          \" as a CoordinateAttribute using the 'galcen_coord' \"\n                          \"argument\", AstropyDeprecationWarning)\n\n            galcen_kw = dict()\n            galcen_kw['ra'] = kwargs.pop('galcen_ra', self.galcen_coord.ra)\n            galcen_kw['dec'] = kwargs.pop('galcen_dec', self.galcen_coord.dec)\n            kwargs['galcen_coord'] = ICRS(**galcen_kw)\n\n        super().__init__(*args, **kwargs)\n\n    @property\n    def galcen_ra(self):\n        warnings.warn(\"The attribute 'galcen_ra' is deprecated. Use \"\n                      \"'.galcen_coord.ra' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.ra\n\n    @property\n    def galcen_dec(self):\n        warnings.warn(\"The attribute 'galcen_dec' is deprecated. Use \"\n                      \"'.galcen_coord.dec' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.dec\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 accessable 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"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":2594,"id":12424,"name":"base_representation","nodeType":"Attribute","startLoc":2594,"text":"base_representation"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":12425,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":14,"id":12426,"name":"erfa","nodeType":"Attribute","startLoc":14,"text":"erfa"},{"col":0,"comment":"","endLoc":7,"header":"intermediate_rotation_transforms.py#<anonymous>","id":12427,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nContains the transformation functions for getting to/from ITRS, GCRS, and CIRS.\nThese are distinct from the ICRS and AltAz functions because they are just\nrotations without aberration corrections or offsets.\n\"\"\""},{"fileName":"cirs.py","filePath":"astropy/coordinates/builtin_frames","id":12428,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..attributes import TimeAttribute\n\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\nfrom .utils import DEFAULT_OBSTIME\n\n\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    {params}\n\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    \"\"\"\n\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\nCIRS.__doc__ = CIRS.__doc__.format(params=_base_radec_docstring)\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":"","endLoc":4,"header":"cirs.py#<anonymous>","id":12429,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"CIRS.__doc__ = CIRS.__doc__.format(params=_base_radec_docstring)"},{"attributeType":"UnitSphericalCosLatDifferential","col":4,"comment":"null","endLoc":2595,"id":12430,"name":"_unit_differential","nodeType":"Attribute","startLoc":2595,"text":"_unit_differential"},{"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":12431,"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 = [\"B{0:7.2f}\".format(x) for x in np.random.uniform(1950., 2000., N)]\n    equinox_fk5 = [\"J{0:7.2f}\".format(x) 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('System=ICRS,Epoch={epoch}'.format(epoch=obstime[i]))\n        frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=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(fnout, 'wb')\n    f.write(\"# This file was generated with the {0} script, and the reference \"\n            \"values were computed using AST\\n\".format(os.path.basename(__file__)))\n    t.write(f, format='ascii', delimiter=',')"},{"fileName":"altaz.py","filePath":"astropy/coordinates/builtin_frames","id":12432,"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 ... import units as u\nfrom .. import representation as r\nfrom ..baseframe import BaseCoordinateFrame, RepresentationMapping\nfrom ..attributes import (Attribute, TimeAttribute,\n                          QuantityAttribute, EarthLocationAttribute)\n\n_90DEG = 90*u.deg\n\n\nclass AltAz(BaseCoordinateFrame):\n    \"\"\"\n    A coordinate or frame in the Altitude-Azimuth system (Horizontal\n    coordinates).  Azimuth is oriented East of North (i.e., N=0, E=90 degrees).\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\n    az : `Angle`, optional, must be keyword\n        The Azimuth for this object (``alt`` must also be given and\n        ``representation`` must be None).\n    alt : `Angle`, optional, must be keyword\n        The Altitude for this object (``az`` must also be given and\n        ``representation`` must be None).\n    distance : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_az_cosalt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in azimuth (including the ``cos(alt)`` factor) for\n        this object (``pm_alt`` must also be given).\n    pm_alt : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in altitude for this object (``pm_az_cosalt`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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`\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`\n        The ground-level temperature as an `~astropy.units.Quantity` in\n        deg C.  This is necessary for performing refraction corrections.\n    relative_humidity`` : numeric\n        The relative humidity as a number from 0 to 1.  This is necessary for\n        performing refraction corrections.\n    obswl : `~astropy.units.Quantity`\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 discrepent\n    results.  For much better numerical stability, leaving the ``pressure`` at\n    ``0`` (the default), disabling the refraction correction (yielding\n    \"topocentric\" horizontal coordinates).\n\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'az'),\n            RepresentationMapping('lat', 'alt')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_az_cosalt', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_alt', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_az', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_alt', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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 = Attribute(default=0)\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 if the zenith angle for this coordinate, a common estimate of the\n        airmass.\n        \"\"\"\n        return 1/np.sin(self.alt)\n\n    @property\n    def zen(self):\n        \"\"\"\n        The zenith angle 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":12,"id":12433,"name":"_90DEG","nodeType":"Attribute","startLoc":12,"text":"_90DEG"},{"col":0,"comment":"","endLoc":4,"header":"altaz.py#<anonymous>","id":12434,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_90DEG = 90*u.deg"},{"attributeType":"null","col":4,"comment":"null","endLoc":2596,"id":12435,"name":"attr_classes","nodeType":"Attribute","startLoc":2596,"text":"attr_classes"},{"fileName":"lsr.py","filePath":"astropy/coordinates/builtin_frames","id":12436,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom ...time import Time\nfrom .. import representation as r\nfrom ..baseframe import (BaseCoordinateFrame, RepresentationMapping,\n                         frame_transform_graph)\nfrom ..transformations import AffineTransform\nfrom ..attributes import DifferentialAttribute\n\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\nfrom .icrs import ICRS\nfrom .galactic import Galactic\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']\n\n\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    {params}\n\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    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010,\n                                   allowed_classes=[r.CartesianDifferential])\n\n\nLSR.__doc__ = LSR.__doc__.format(params=_base_radec_docstring)\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\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_l_cosb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_l', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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"},{"className":"Galactocentric","col":0,"comment":"\n    A coordinate or frame in the Galactocentric system. This frame\n    requires specifying the Sun-Galactic center distance, and optionally\n    the height of the Sun above the Galactic midplane.\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    The default position of the Galactic Center in ICRS coordinates is\n    taken from Reid et al. 2004,\n    http://adsabs.harvard.edu/abs/2004ApJ...616..872R.\n\n    .. math::\n\n        {\\rm RA} = 17:45:37.224~{\\rm hr}\\\\\n        {\\rm Dec} = -28:56:10.23~{\\rm deg}\n\n    The default distance to the Galactic Center is 8.3 kpc, e.g.,\n    Gillessen et al. (2009),\n    https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G/abstract\n\n    The default height of the Sun above the Galactic midplane is taken to\n    be 27 pc, as measured by Chen et al. (2001),\n    https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C/abstract\n\n    The default solar motion relative to the Galactic center is taken from a\n    combination of Schönrich et al. (2010) [for the peculiar velocity] and\n    Bovy (2015) [for the circular velocity at the solar radius],\n    https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S/abstract\n    https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B/abstract\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.representation.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\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    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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\n    Other parameters\n    ----------------\n    galcen_coord : `ICRS`, optional, must be keyword\n        The ICRS coordinates of the Galactic center.\n    galcen_distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic center.\n    galcen_v_sun : `~astropy.coordinates.representation.CartesianDifferential`, optional, must be keyword\n        The velocity of the sun *in the Galactocentric frame* as Cartesian\n        velocity components.\n    z_sun : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic midplane.\n    roll : `Angle`, optional, must be keyword\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    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 coordinate frame or\n    `~astropy.coordinates.SkyCoord` object::\n\n        >>> import astropy.units as u\n        >>> import astropy.coordinates as coord\n        >>> c = coord.ICRS(ra=[158.3122, 24.5] * u.degree,\n        ...                dec=[-17.3, 81.52] * u.degree,\n        ...                distance=[11.5, 24.12] * u.kpc)\n        >>> c.transform_to(coord.Galactocentric) # doctest: +FLOAT_CMP\n        <Galactocentric Coordinate (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): (x, y, z) in kpc\n            [( -9.6083819 ,  -9.40062188,  6.52056066),\n             (-21.28302307,  18.76334013,  7.84693855)]>\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        <Galactocentric Coordinate (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            ( 266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=( 11.1,  232.24,  7.25) km / s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.40785924,  -9.40062188,  6.52066574),\n             (-21.08239383,  18.76334013,  7.84798135)]>\n\n    Similarly, transforming from the Galactocentric frame to another coordinate frame::\n\n        >>> c = coord.Galactocentric(x=[-8.3, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[0.027, 24.12] * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n            [(  86.22349059, 28.83894138,  4.39157788e-05),\n             ( 289.66802652, 49.88763881,  8.59640735e+01)]>\n\n    Or, with custom specification of the Galactic center::\n\n        >>> c = coord.Galactocentric(x=[-8.0, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[21.0, 24120.0] * u.pc,\n        ...                          z_sun=21 * u.pc, galcen_distance=8. * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (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    ","endLoc":234,"id":12437,"nodeType":"Class","startLoc":30,"text":"class Galactocentric(BaseCoordinateFrame):\n    r\"\"\"\n    A coordinate or frame in the Galactocentric system. This frame\n    requires specifying the Sun-Galactic center distance, and optionally\n    the height of the Sun above the Galactic midplane.\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    The default position of the Galactic Center in ICRS coordinates is\n    taken from Reid et al. 2004,\n    http://adsabs.harvard.edu/abs/2004ApJ...616..872R.\n\n    .. math::\n\n        {\\rm RA} = 17:45:37.224~{\\rm hr}\\\\\n        {\\rm Dec} = -28:56:10.23~{\\rm deg}\n\n    The default distance to the Galactic Center is 8.3 kpc, e.g.,\n    Gillessen et al. (2009),\n    https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G/abstract\n\n    The default height of the Sun above the Galactic midplane is taken to\n    be 27 pc, as measured by Chen et al. (2001),\n    https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C/abstract\n\n    The default solar motion relative to the Galactic center is taken from a\n    combination of Schönrich et al. (2010) [for the peculiar velocity] and\n    Bovy (2015) [for the circular velocity at the solar radius],\n    https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S/abstract\n    https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B/abstract\n\n    For a more detailed look at the math behind this transformation, see\n    the document :ref:`coordinates-galactocentric`.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    Parameters\n    ----------\n    representation : `~astropy.coordinates.representation.BaseRepresentation` or None\n        A representation object or None to have no data (or use the other\n        keywords)\n\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    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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\n    Other parameters\n    ----------------\n    galcen_coord : `ICRS`, optional, must be keyword\n        The ICRS coordinates of the Galactic center.\n    galcen_distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic center.\n    galcen_v_sun : `~astropy.coordinates.representation.CartesianDifferential`, optional, must be keyword\n        The velocity of the sun *in the Galactocentric frame* as Cartesian\n        velocity components.\n    z_sun : `~astropy.units.Quantity`, optional, must be keyword\n        The distance from the sun to the Galactic midplane.\n    roll : `Angle`, optional, must be keyword\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    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 coordinate frame or\n    `~astropy.coordinates.SkyCoord` object::\n\n        >>> import astropy.units as u\n        >>> import astropy.coordinates as coord\n        >>> c = coord.ICRS(ra=[158.3122, 24.5] * u.degree,\n        ...                dec=[-17.3, 81.52] * u.degree,\n        ...                distance=[11.5, 24.12] * u.kpc)\n        >>> c.transform_to(coord.Galactocentric) # doctest: +FLOAT_CMP\n        <Galactocentric Coordinate (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): (x, y, z) in kpc\n            [( -9.6083819 ,  -9.40062188,  6.52056066),\n             (-21.28302307,  18.76334013,  7.84693855)]>\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        <Galactocentric Coordinate (galcen_coord=<ICRS Coordinate: (ra, dec) in deg\n            ( 266.4051, -28.936175)>, galcen_distance=8.1 kpc, galcen_v_sun=( 11.1,  232.24,  7.25) km / s, z_sun=27.0 pc, roll=0.0 deg): (x, y, z) in kpc\n            [( -9.40785924,  -9.40062188,  6.52066574),\n             (-21.08239383,  18.76334013,  7.84798135)]>\n\n    Similarly, transforming from the Galactocentric frame to another coordinate frame::\n\n        >>> c = coord.Galactocentric(x=[-8.3, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[0.027, 24.12] * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (ra, dec, distance) in (deg, deg, kpc)\n            [(  86.22349059, 28.83894138,  4.39157788e-05),\n             ( 289.66802652, 49.88763881,  8.59640735e+01)]>\n\n    Or, with custom specification of the Galactic center::\n\n        >>> c = coord.Galactocentric(x=[-8.0, 4.5] * u.kpc,\n        ...                          y=[0., 81.52] * u.kpc,\n        ...                          z=[21.0, 24120.0] * u.pc,\n        ...                          z_sun=21 * u.pc, galcen_distance=8. * u.kpc)\n        >>> c.transform_to(coord.ICRS) # doctest: +FLOAT_CMP\n        <ICRS Coordinate: (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    frame_specific_representation_info = {\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.CartesianRepresentation\n    default_differential = r.CartesianDifferential\n\n    # frame attributes\n    galcen_coord = CoordinateAttribute(default=ICRS(ra=266.4051*u.degree,\n                                                    dec=-28.936175*u.degree),\n                                       frame=ICRS)\n    galcen_distance = QuantityAttribute(default=8.3*u.kpc)\n\n    galcen_v_sun = DifferentialAttribute(\n        default=r.CartesianDifferential([11.1, 220+12.24, 7.25] * u.km/u.s),\n        allowed_classes=[r.CartesianDifferential])\n\n    z_sun = QuantityAttribute(default=27.*u.pc)\n    roll = QuantityAttribute(default=0.*u.deg)\n\n    def __init__(self, *args, **kwargs):\n\n        # backwards-compatibility\n        if ('galcen_ra' in kwargs or 'galcen_dec' in kwargs):\n            warnings.warn(\"The arguments 'galcen_ra', and 'galcen_dec' are \"\n                          \"deprecated in favor of specifying the sky coordinate\"\n                          \" as a CoordinateAttribute using the 'galcen_coord' \"\n                          \"argument\", AstropyDeprecationWarning)\n\n            galcen_kw = dict()\n            galcen_kw['ra'] = kwargs.pop('galcen_ra', self.galcen_coord.ra)\n            galcen_kw['dec'] = kwargs.pop('galcen_dec', self.galcen_coord.dec)\n            kwargs['galcen_coord'] = ICRS(**galcen_kw)\n\n        super().__init__(*args, **kwargs)\n\n    @property\n    def galcen_ra(self):\n        warnings.warn(\"The attribute 'galcen_ra' is deprecated. Use \"\n                      \"'.galcen_coord.ra' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.ra\n\n    @property\n    def galcen_dec(self):\n        warnings.warn(\"The attribute 'galcen_dec' is deprecated. Use \"\n                      \"'.galcen_coord.dec' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.dec\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 accessable from Galactocentric\n        return _ROLL0"},{"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 rather than referenced.\n    ","endLoc":2685,"id":12438,"nodeType":"Class","startLoc":2638,"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 rather than referenced.\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    @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)"},{"col":4,"comment":"null","endLoc":2652,"header":"def to_cartesian(self, base)","id":12439,"name":"to_cartesian","nodeType":"Function","startLoc":2650,"text":"def to_cartesian(self, base):\n        return self.d_distance * base.represent_as(\n            UnitSphericalRepresentation).to_cartesian()"},{"col":0,"comment":"null","endLoc":219,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, GCRS)\ndef gcrs_to_gcrs(from_coo, to_frame)","id":12440,"name":"gcrs_to_gcrs","nodeType":"Function","startLoc":212,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, GCRS)\ndef gcrs_to_gcrs(from_coo, to_frame):\n    if (np.all(from_coo.obstime == to_frame.obstime)\n        and np.all(from_coo.obsgeoloc == to_frame.obsgeoloc)):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # like CIRS, we do this self-transform via ICRS\n        return from_coo.transform_to(ICRS).transform_to(to_frame)"},{"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\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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 <http://adsabs.harvard.edu/abs/1960MNRAS.121..123B>`_.\n    ","endLoc":121,"id":12441,"nodeType":"Class","startLoc":14,"text":"class 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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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 <http://adsabs.harvard.edu/abs/1960MNRAS.121..123B>`_.\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        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_l_cosb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_l', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ]\n    }\n    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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)"},{"col":0,"comment":"null","endLoc":277,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GCRS, HCRS)\ndef gcrs_to_hcrs(gcrs_coo, hcrs_frame)","id":12442,"name":"gcrs_to_hcrs","nodeType":"Function","startLoc":222,"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    srepr = gcrs_coo.represent_as(SphericalRepresentation)\n    gcrs_ra = srepr.lon.to_value(u.radian)\n    gcrs_dec = srepr.lat.to_value(u.radian)\n\n    # set up the astrometry context for ICRS<->GCRS and then convert to ICRS\n    # coordinate direction\n    pv = np.concatenate(\n        (gcrs_coo.obsgeoloc.get_xyz(xyz_axis=-1).value[..., np.newaxis, :],\n         gcrs_coo.obsgeovel.get_xyz(xyz_axis=-1).value[..., np.newaxis, :]),\n        axis=-2)\n\n    jd1, jd2 = get_jd12(hcrs_frame.obstime, 'tdb')\n    earth_pv, earth_heliocentric = prepare_earth_position_vel(gcrs_coo.obstime)\n    astrom = erfa.apcs(jd1, jd2, pv, earth_pv, earth_heliocentric)\n\n    i_ra, i_dec = aticq(gcrs_ra, gcrs_dec, 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":4,"comment":"null","endLoc":68,"id":12443,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":68,"text":"frame_specific_representation_info"},{"col":4,"comment":"null","endLoc":2657,"header":"@classmethod\n    def from_cartesian(cls, other, base)","id":12444,"name":"from_cartesian","nodeType":"Function","startLoc":2654,"text":"@classmethod\n    def from_cartesian(cls, other, base):\n        return cls(other.dot(base.represent_as(UnitSphericalRepresentation)),\n                   copy=False)"},{"col":4,"comment":"null","endLoc":209,"header":"def __init__(self, *args, **kwargs)","id":12445,"name":"__init__","nodeType":"Function","startLoc":195,"text":"def __init__(self, *args, **kwargs):\n\n        # backwards-compatibility\n        if ('galcen_ra' in kwargs or 'galcen_dec' in kwargs):\n            warnings.warn(\"The arguments 'galcen_ra', and 'galcen_dec' are \"\n                          \"deprecated in favor of specifying the sky coordinate\"\n                          \" as a CoordinateAttribute using the 'galcen_coord' \"\n                          \"argument\", AstropyDeprecationWarning)\n\n            galcen_kw = dict()\n            galcen_kw['ra'] = kwargs.pop('galcen_ra', self.galcen_coord.ra)\n            galcen_kw['dec'] = kwargs.pop('galcen_dec', self.galcen_coord.dec)\n            kwargs['galcen_coord'] = ICRS(**galcen_kw)\n\n        super().__init__(*args, **kwargs)"},{"col":4,"comment":"null","endLoc":2667,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12446,"name":"from_representation","nodeType":"Function","startLoc":2659,"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":4,"comment":"null","endLoc":101,"id":12447,"name":"default_representation","nodeType":"Attribute","startLoc":101,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":102,"id":12448,"name":"default_differential","nodeType":"Attribute","startLoc":102,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":108,"id":12449,"name":"_ngp_B1950","nodeType":"Attribute","startLoc":108,"text":"_ngp_B1950"},{"col":4,"comment":"null","endLoc":2685,"header":"def _combine_operation(self, op, other, reverse=False)","id":12450,"name":"_combine_operation","nodeType":"Function","startLoc":2669,"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":4,"comment":"null","endLoc":109,"id":12451,"name":"_lon0_B1950","nodeType":"Attribute","startLoc":109,"text":"_lon0_B1950"},{"attributeType":"null","col":4,"comment":"null","endLoc":120,"id":12452,"name":"_ngp_J2000","nodeType":"Attribute","startLoc":120,"text":"_ngp_J2000"},{"attributeType":"null","col":4,"comment":"null","endLoc":121,"id":12453,"name":"_lon0_J2000","nodeType":"Attribute","startLoc":121,"text":"_lon0_J2000"},{"attributeType":"null","col":8,"comment":"null","endLoc":2711,"id":12454,"name":"_wz","nodeType":"Attribute","startLoc":2711,"text":"self._wz"},{"attributeType":"null","col":8,"comment":"null","endLoc":2710,"id":12455,"name":"_w0","nodeType":"Attribute","startLoc":2710,"text":"self._w0"},{"className":"default_cosmology","col":0,"comment":"\n    The default cosmology to use.  To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n    ","endLoc":2896,"id":12456,"nodeType":"Class","startLoc":2857,"text":"class default_cosmology(ScienceState):\n    \"\"\"\n    The default cosmology to use.  To change it::\n\n        >>> from astropy.cosmology import default_cosmology, WMAP7\n        >>> with default_cosmology.set(WMAP7):\n        ...     # WMAP7 cosmology in effect\n\n    Or, you may use a string::\n\n        >>> with default_cosmology.set('WMAP7'):\n        ...     # WMAP7 cosmology in effect\n    \"\"\"\n    _value = 'WMAP9'\n\n    @staticmethod\n    def get_cosmology_from_string(arg):\n        \"\"\" Return a cosmology instance from a string.\n        \"\"\"\n        if arg == 'no_default':\n            cosmo = None\n        else:\n            try:\n                cosmo = getattr(sys.modules[__name__], arg)\n            except AttributeError:\n                s = \"Unknown cosmology '{}'. Valid cosmologies:\\n{}\".format(\n                    arg, parameters.available)\n                raise ValueError(s)\n        return cosmo\n\n    @classmethod\n    def validate(cls, value):\n        if value is None:\n            value = 'Planck15'\n        if isinstance(value, str):\n            return cls.get_cosmology_from_string(value)\n        elif isinstance(value, Cosmology):\n            return value\n        else:\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance.\")"},{"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\n    {params}\n\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    ","endLoc":59,"id":12457,"nodeType":"Class","startLoc":24,"text":"class 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    {params}\n\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    # frame attributes:\n    v_bary = DifferentialAttribute(default=v_bary_Schoenrich2010,\n                                   allowed_classes=[r.CartesianDifferential])"},{"col":4,"comment":" Return a cosmology instance from a string.\n        ","endLoc":2885,"header":"@staticmethod\n    def get_cosmology_from_string(arg)","id":12458,"name":"get_cosmology_from_string","nodeType":"Function","startLoc":2872,"text":"@staticmethod\n    def get_cosmology_from_string(arg):\n        \"\"\" Return a cosmology instance from a string.\n        \"\"\"\n        if arg == 'no_default':\n            cosmo = None\n        else:\n            try:\n                cosmo = getattr(sys.modules[__name__], arg)\n            except AttributeError:\n                s = \"Unknown cosmology '{}'. Valid cosmologies:\\n{}\".format(\n                    arg, parameters.available)\n                raise ValueError(s)\n        return cosmo"},{"attributeType":"DifferentialAttribute","col":4,"comment":"null","endLoc":58,"id":12459,"name":"v_bary","nodeType":"Attribute","startLoc":58,"text":"v_bary"},{"col":4,"comment":"null","endLoc":2896,"header":"@classmethod\n    def validate(cls, value)","id":12460,"name":"validate","nodeType":"Function","startLoc":2887,"text":"@classmethod\n    def validate(cls, value):\n        if value is None:\n            value = 'Planck15'\n        if isinstance(value, str):\n            return cls.get_cosmology_from_string(value)\n        elif isinstance(value, Cosmology):\n            return value\n        else:\n            raise TypeError(\"default_cosmology must be a string or Cosmology instance.\")"},{"attributeType":"RadialRepresentation","col":4,"comment":"null","endLoc":2648,"id":12461,"name":"base_representation","nodeType":"Attribute","startLoc":2648,"text":"base_representation"},{"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 rather than referenced.\n    ","endLoc":2742,"id":12462,"nodeType":"Class","startLoc":2688,"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 rather than referenced.\n    \"\"\"\n    base_representation = PhysicsSphericalRepresentation\n\n    def __init__(self, d_phi, d_theta, d_r, 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)"},{"col":4,"comment":"null","endLoc":2727,"header":"def represent_as(self, other_class, base=None)","id":12463,"name":"represent_as","nodeType":"Function","startLoc":2708,"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)"},{"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\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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    ","endLoc":184,"id":12464,"nodeType":"Class","startLoc":85,"text":"class 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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'l'),\n            RepresentationMapping('lat', 'b')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_l_cosb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_l', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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":2870,"id":12465,"name":"_value","nodeType":"Attribute","startLoc":2870,"text":"_value"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":12466,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":152,"text":"frame_specific_representation_info"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":12467,"name":"__all__","nodeType":"Attribute","startLoc":27,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":31,"id":12468,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":31,"text":"__doctest_requires__"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":12469,"name":"H0units_to_invs","nodeType":"Attribute","startLoc":70,"text":"H0units_to_invs"},{"attributeType":"null","col":0,"comment":"null","endLoc":71,"id":12470,"name":"sec_to_Gyr","nodeType":"Attribute","startLoc":71,"text":"sec_to_Gyr"},{"attributeType":"null","col":0,"comment":"null","endLoc":73,"id":12471,"name":"critdens_const","nodeType":"Attribute","startLoc":73,"text":"critdens_const"},{"col":4,"comment":"null","endLoc":215,"header":"@property\n    def galcen_ra(self)","id":12472,"name":"galcen_ra","nodeType":"Function","startLoc":211,"text":"@property\n    def galcen_ra(self):\n        warnings.warn(\"The attribute 'galcen_ra' is deprecated. Use \"\n                      \"'.galcen_coord.ra' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.ra"},{"col":4,"comment":"null","endLoc":221,"header":"@property\n    def galcen_dec(self)","id":12473,"name":"galcen_dec","nodeType":"Function","startLoc":217,"text":"@property\n    def galcen_dec(self):\n        warnings.warn(\"The attribute 'galcen_dec' is deprecated. Use \"\n                      \"'.galcen_coord.dec' instead.\", AstropyDeprecationWarning)\n        return self.galcen_coord.dec"},{"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":234,"header":"@classmethod\n    def get_roll0(cls)","id":12474,"name":"get_roll0","nodeType":"Function","startLoc":223,"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 accessable from Galactocentric\n        return _ROLL0"},{"attributeType":"null","col":4,"comment":"null","endLoc":171,"id":12475,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":171,"text":"frame_specific_representation_info"},{"attributeType":"null","col":0,"comment":"null","endLoc":74,"id":12476,"name":"arcsec_in_radians","nodeType":"Attribute","startLoc":74,"text":"arcsec_in_radians"},{"attributeType":"null","col":0,"comment":"null","endLoc":75,"id":12477,"name":"arcmin_in_radians","nodeType":"Attribute","startLoc":75,"text":"arcmin_in_radians"},{"attributeType":"null","col":0,"comment":"null","endLoc":77,"id":12478,"name":"a_B_c2","nodeType":"Attribute","startLoc":77,"text":"a_B_c2"},{"attributeType":"null","col":0,"comment":"null","endLoc":79,"id":12479,"name":"kB_evK","nodeType":"Attribute","startLoc":79,"text":"kB_evK"},{"attributeType":"null","col":4,"comment":"null","endLoc":2830,"id":12480,"name":"key","nodeType":"Attribute","startLoc":2830,"text":"key"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":180,"id":12481,"name":"default_representation","nodeType":"Attribute","startLoc":180,"text":"default_representation"},{"attributeType":"null","col":4,"comment":"null","endLoc":2831,"id":12482,"name":"par","nodeType":"Attribute","startLoc":2831,"text":"par"},{"attributeType":"FlatLambdaCDM","col":8,"comment":"null","endLoc":2833,"id":12483,"name":"cosmo","nodeType":"Attribute","startLoc":2833,"text":"cosmo"},{"attributeType":"CartesianRepresentation","col":4,"comment":"null","endLoc":179,"id":12484,"name":"default_representation","nodeType":"Attribute","startLoc":179,"text":"default_representation"},{"col":4,"comment":"null","endLoc":2742,"header":"@classmethod\n    def from_representation(cls, representation, base=None)","id":12485,"name":"from_representation","nodeType":"Function","startLoc":2729,"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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":2838,"id":12486,"name":"docstr","nodeType":"Attribute","startLoc":2838,"text":"docstr"},{"attributeType":"LambdaCDM","col":8,"comment":"null","endLoc":2841,"id":12487,"name":"cosmo","nodeType":"Attribute","startLoc":2841,"text":"cosmo"},{"attributeType":"null","col":8,"comment":"null","endLoc":2845,"id":12488,"name":"docstr","nodeType":"Attribute","startLoc":2845,"text":"docstr"},{"col":0,"comment":"","endLoc":4,"header":"core.py#<anonymous>","id":12489,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = [\"FLRW\", \"LambdaCDM\", \"FlatLambdaCDM\", \"wCDM\", \"FlatwCDM\",\n           \"Flatw0waCDM\", \"w0waCDM\", \"wpwaCDM\", \"w0wzCDM\",\n           \"default_cosmology\"] + parameters.available\n\n__doctest_requires__ = {'*': ['scipy.integrate']}\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.value * 1000)\n\narcsec_in_radians = pi / (3600. * 180)\n\narcmin_in_radians = pi / (60. * 180)\n\na_B_c2 = 4e-3 * const.sigma_sb.value / const.c.value ** 3\n\nkB_evK = const.k_B.to(u.eV / u.K)\n\nfor key in parameters.available:\n    par = getattr(parameters, key)\n    if par['flat']:\n        cosmo = FlatLambdaCDM(par['H0'], par['Om0'], Tcmb0=par['Tcmb0'],\n                              Neff=par['Neff'],\n                              m_nu=u.Quantity(par['m_nu'], u.eV),\n                              name=key,\n                              Ob0=par['Ob0'])\n        docstr = \"{} instance of FlatLambdaCDM cosmology\\n\\n(from {})\"\n        cosmo.__doc__ = docstr.format(key, par['reference'])\n    else:\n        cosmo = LambdaCDM(par['H0'], par['Om0'], par['Ode0'],\n                          Tcmb0=par['Tcmb0'], Neff=par['Neff'],\n                          m_nu=u.Quantity(par['m_nu'], u.eV), name=key,\n                          Ob0=par['Ob0'])\n        docstr = \"{} instance of LambdaCDM cosmology\\n\\n(from {})\"\n        cosmo.__doc__ = docstr.format(key, par['reference'])\n    setattr(sys.modules[__name__], key, cosmo)\n\ndel key, par, cosmo"},{"attributeType":"PhysicsSphericalRepresentation","col":4,"comment":"null","endLoc":2700,"id":12490,"name":"base_representation","nodeType":"Attribute","startLoc":2700,"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`\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity`\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity`\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied rather than referenced.\n    ","endLoc":2764,"id":12491,"nodeType":"Class","startLoc":2745,"text":"class CylindricalDifferential(BaseDifferential):\n    \"\"\"Differential(s) of points in cylindrical coordinates.\n\n    Parameters\n    ----------\n    d_rho : `~astropy.units.Quantity`\n        The differential cylindrical radius.\n    d_phi : `~astropy.units.Quantity`\n        The differential azimuth.\n    d_z : `~astropy.units.Quantity`\n        The differential height.\n    copy : bool, optional\n        If `True` (default), arrays will be copied rather than referenced.\n    \"\"\"\n    base_representation = CylindricalRepresentation\n\n    def __init__(self, d_rho, d_phi, d_z, 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":2764,"header":"def __init__(self, d_rho, d_phi, d_z, copy=False)","id":12492,"name":"__init__","nodeType":"Function","startLoc":2761,"text":"def __init__(self, d_rho, d_phi, d_z, 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":"CartesianDifferential","col":4,"comment":"null","endLoc":180,"id":12493,"name":"default_differential","nodeType":"Attribute","startLoc":180,"text":"default_differential"},{"attributeType":"CylindricalRepresentation","col":4,"comment":"null","endLoc":2759,"id":12494,"name":"base_representation","nodeType":"Attribute","startLoc":2759,"text":"base_representation"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12495,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":39,"id":12496,"name":"DIFFERENTIAL_CLASSES","nodeType":"Attribute","startLoc":39,"text":"DIFFERENTIAL_CLASSES"},{"col":0,"comment":"","endLoc":5,"header":"representation.py#<anonymous>","id":12497,"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 = {}"},{"attributeType":"CoordinateAttribute","col":4,"comment":"null","endLoc":183,"id":12498,"name":"galcen_coord","nodeType":"Attribute","startLoc":183,"text":"galcen_coord"},{"fileName":"galactic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12499,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..matrix_utilities import (rotation_matrix,\n                                matrix_product, matrix_transpose)\nfrom ..baseframe import frame_transform_graph\nfrom ..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\n    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\n    ","endLoc":50,"id":12500,"nodeType":"Class","startLoc":13,"text":"class 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\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":50,"header":"@staticmethod\n    def _precession_matrix(oldequinox, newequinox)","id":12501,"name":"_precession_matrix","nodeType":"Function","startLoc":32,"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)"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":186,"id":12502,"name":"galcen_distance","nodeType":"Attribute","startLoc":186,"text":"galcen_distance"},{"attributeType":"null","col":4,"comment":"null","endLoc":30,"id":12503,"name":"equinox","nodeType":"Attribute","startLoc":30,"text":"equinox"},{"col":0,"comment":"null","endLoc":25,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, Galactic)\ndef fk5_to_gal(fk5coord, galframe)","id":12504,"name":"fk5_to_gal","nodeType":"Function","startLoc":17,"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":303,"header":"@frame_transform_graph.transform(AffineTransform, HCRS, ICRS)\ndef hcrs_to_icrs(hcrs_coo, icrs_frame)","id":12505,"name":"hcrs_to_icrs","nodeType":"Function","startLoc":286,"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    if hcrs_coo.data.differentials:\n        from ..solar_system import get_body_barycentric_posvel\n        bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel('sun',\n                                                                 hcrs_coo.obstime)\n        bary_sun_pos = bary_sun_pos.with_differentials(bary_sun_vel)\n\n    else:\n        from ..solar_system import get_body_barycentric\n        bary_sun_pos = get_body_barycentric('sun', hcrs_coo.obstime)\n        bary_sun_vel = None\n\n    return None, bary_sun_pos"},{"attributeType":"DifferentialAttribute","col":4,"comment":"null","endLoc":188,"id":12506,"name":"galcen_v_sun","nodeType":"Attribute","startLoc":188,"text":"galcen_v_sun"},{"col":0,"comment":"null","endLoc":30,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK5)\ndef _gal_to_fk5(galcoord, fk5frame)","id":12507,"name":"_gal_to_fk5","nodeType":"Function","startLoc":28,"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":"null","endLoc":40,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, Galactic)\ndef fk4_to_gal(fk4coords, galframe)","id":12508,"name":"fk4_to_gal","nodeType":"Function","startLoc":33,"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)"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":192,"id":12509,"name":"z_sun","nodeType":"Attribute","startLoc":192,"text":"z_sun"},{"col":0,"comment":"null","endLoc":45,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK4NoETerms)\ndef gal_to_fk4(galcoords, fk4frame)","id":12510,"name":"gal_to_fk4","nodeType":"Function","startLoc":43,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, Galactic, FK4NoETerms)\ndef gal_to_fk4(galcoords, fk4frame):\n    return matrix_transpose(fk4_to_gal(fk4frame, galcoords))"},{"col":0,"comment":"null","endLoc":323,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, HCRS)\ndef icrs_to_hcrs(icrs_coo, hcrs_frame)","id":12511,"name":"icrs_to_hcrs","nodeType":"Function","startLoc":306,"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    if icrs_coo.data.differentials:\n        from ..solar_system import get_body_barycentric_posvel\n        bary_sun_pos, bary_sun_vel = get_body_barycentric_posvel('sun',\n                                                                 hcrs_frame.obstime)\n        bary_sun_pos = -bary_sun_pos.with_differentials(-bary_sun_vel)\n\n    else:\n        from ..solar_system import get_body_barycentric\n        bary_sun_pos = -get_body_barycentric('sun', hcrs_frame.obstime)\n        bary_sun_vel = None\n\n    return None, bary_sun_pos"},{"attributeType":"QuantityAttribute","col":4,"comment":"null","endLoc":193,"id":12512,"name":"roll","nodeType":"Attribute","startLoc":193,"text":"roll"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":12513,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"col":0,"comment":"","endLoc":5,"header":"generate_ref_ast.py#<anonymous>","id":12514,"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 comand-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()"},{"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":281,"header":"def get_matrix_vectors(galactocentric_frame, inverse=False)","id":12515,"name":"get_matrix_vectors","nodeType":"Function","startLoc":239,"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"},{"fileName":"icrs.py","filePath":"astropy/coordinates/builtin_frames","id":12516,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\n\n\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 the\n    references provided in the  :ref:`astropy-coordinates-seealso` section of the\n    documentation.\n\n    {params}\n    \"\"\"\n\n\nICRS.__doc__ = ICRS.__doc__.format(params=_base_radec_docstring)\n"},{"col":0,"comment":"","endLoc":4,"header":"icrs.py#<anonymous>","id":12517,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"ICRS.__doc__ = ICRS.__doc__.format(params=_base_radec_docstring)"},{"col":0,"comment":"null","endLoc":332,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HCRS, HCRS)\ndef hcrs_to_hcrs(from_coo, to_frame)","id":12518,"name":"hcrs_to_hcrs","nodeType":"Function","startLoc":326,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HCRS, HCRS)\ndef hcrs_to_hcrs(from_coo, to_frame):\n    if np.all(from_coo.obstime == to_frame.obstime):\n        return to_frame.realize_frame(from_coo.data)\n    else:\n        # like CIRS, we do this self-transform via ICRS\n        return from_coo.transform_to(ICRS).transform_to(to_frame)"},{"fileName":"utils.py","filePath":"astropy/coordinates/builtin_frames","id":12519,"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 numpy as np\n\nfrom ... import units as u\nfrom ... import _erfa as erfa\nfrom ...time import Time\nfrom ...utils import iers\nfrom ...utils.exceptions import AstropyWarning\n\n\n# The UTC time scale is not properly defined prior to 1960, so Time('B1950',\n# scale='utc') will emit a warning. Instead, we use Time('B1950', scale='tai')\n# which is equivalent, but does not emit a warning.\nEQUINOX_J2000 = Time('J2000', scale='utc')\nEQUINOX_B1950 = Time('B1950', scale='tai')\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='utc')\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 apio13\n    \"\"\"\n    # Get the polar motion from the IERS table\n    xp, yp, status = iers.IERS_Auto.open().pm_xy(time, return_status=True)\n\n    wmsg = None\n    if np.any(status == iers.TIME_BEFORE_IERS_RANGE):\n        wmsg = ('Tried to get polar motions for times before IERS data is '\n                'valid. Defaulting to polar motion from the 50-yr mean for those. '\n                'This may affect precision at the 10s of arcsec level')\n        xp.ravel()[status.ravel() == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[0]\n        yp.ravel()[status.ravel() == iers.TIME_BEFORE_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg, AstropyWarning)\n\n    if np.any(status == iers.TIME_BEYOND_IERS_RANGE):\n        wmsg = ('Tried to get polar motions for times after IERS data is '\n                'valid. Defaulting to polar motion from the 50-yr mean for those. '\n                'This may affect precision at the 10s of arcsec level')\n\n        xp.ravel()[status.ravel() == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[0]\n        yp.ravel()[status.ravel() == iers.TIME_BEYOND_IERS_RANGE] = _DEFAULT_PM[1]\n\n        warnings.warn(wmsg, 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 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(ri, di, 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    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    Parameters\n    ----------\n    ri : float or `~numpy.ndarray`\n        right ascension, radians\n    di : float or `~numpy.ndarray`\n        declination, radians\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    dc : float or `~numpy.ndarray`\n    \"\"\"\n    # RA, Dec to cartesian unit vectors\n    pos = erfa.s2c(ri, di)\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        after = erfa.ld(1.0, before, before, astrom['eh'], astrom['em'], 5e-8)\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(rc, dc, 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    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    Parameters\n    ----------\n    rc : float or `~numpy.ndarray`\n        right ascension, radians\n    dc : float or `~numpy.ndarray`\n        declination, radians\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    di : float or `~numpy.ndarray`\n    \"\"\"\n    # BCRS coordinate direction (unit vector).\n    pco = erfa.s2c(rc, dc)\n\n    # Light deflection by the Sun, giving BCRS natural direction.\n    pnat = erfa.ld(1.0, pco, pco, astrom['eh'], astrom['em'], 5e-8)\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 ..solar_system import (get_body_barycentric, get_body_barycentric_posvel)\n    # get barycentric position and velocity of earth\n    earth_pv = 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_pv[0] -\n                          sun).get_xyz(xyz_axis=-1).to_value(u.au)\n\n    # Also prepare earth_pv for passing to erfa, which wants xyz in last\n    # dimension, and pos/vel in one-but-last.\n    # (Note could use np.stack once our minimum numpy version is >=1.10.)\n    earth_pv = np.concatenate((earth_pv[0].get_xyz(xyz_axis=-1).to(u.au)\n                               [..., np.newaxis, :].value,\n                               earth_pv[1].get_xyz(xyz_axis=-1).to(u.au/u.d)\n                               [..., np.newaxis, :].value), axis=-2)\n    return earth_pv, earth_heliocentric\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":12520,"name":"_DEFAULT_PM","nodeType":"Attribute","startLoc":32,"text":"_DEFAULT_PM"},{"fileName":"ecliptic.py","filePath":"astropy/coordinates/builtin_frames","id":12521,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom .. import representation as r\nfrom ..baseframe import BaseCoordinateFrame, RepresentationMapping\nfrom ..attributes import TimeAttribute\nfrom .utils import EQUINOX_J2000, DEFAULT_OBSTIME\n\n__all__ = ['GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic', 'BaseEclipticFrame']\n\n_base_ecliptic_docstring = \"\"\".. 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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    lon : `Angle`, optional, must be keyword\n        The ecliptic longitude for this object (``lat`` must also be given and\n        ``representation`` must be None).\n    lat : `Angle`, optional, must be keyword\n        The ecliptic latitude for this object (``lon`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\n    pm_lon_coslat : `Angle`, optional, must be keyword\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 : `Angle`, optional, must be keyword\n        The proper motion in the ecliptic latitude for this object\n        (``pm_lon_coslat`` must also be given).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\"\"\"\n\n\nclass BaseEclipticFrame(BaseCoordinateFrame):\n    \"\"\"\n    A base class for frames that have names and conventions like that of\n    ecliptic frames.\n\n    {params}\n    \"\"\"\n\n    frame_specific_representation_info = {\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_lon_coslat', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_lat', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_lon', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_lat', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\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    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n\nBaseEclipticFrame.__doc__ = BaseEclipticFrame.__doc__.format(\n    params=_base_ecliptic_docstring)\n\n\nclass GeocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Geocentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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).\n    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n\nGeocentricTrueEcliptic.__doc__ = GeocentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"geocenter\"))\n\n\nclass BarycentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n\n\nBarycentricTrueEcliptic.__doc__ = BarycentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"sun's center\"))\n\n\nclass HeliocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric 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    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\nHeliocentricTrueEcliptic.__doc__ = HeliocentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"sun's center\"))\n"},{"attributeType":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":181,"id":12522,"name":"default_differential","nodeType":"Attribute","startLoc":181,"text":"default_differential"},{"fileName":"supergalactic.py","filePath":"astropy/coordinates/builtin_frames","id":12523,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom .. import representation as r\nfrom ..baseframe import BaseCoordinateFrame, RepresentationMapping\nfrom .galactic import Galactic\n\n\nclass Supergalactic(BaseCoordinateFrame):\n    \"\"\"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <http://adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    sgl : `Angle`, optional, must be keyword\n        The supergalactic longitude for this object (``sgb`` must also be given and\n        ``representation`` must be None).\n    sgb : `Angle`, optional, must be keyword\n        The supergalactic latitude for this object (``sgl`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_sgl_cossgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Right Ascension for this object (``pm_sgb`` must\n        also be given).\n    pm_sgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_sgl_cossgb`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\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.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_sgl_cossgb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_sgb', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_sgl', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_sgb', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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"},{"className":"BarycentricTrueEcliptic","col":0,"comment":"\n    Barycentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    ","endLoc":146,"id":12524,"nodeType":"Class","startLoc":127,"text":"class BarycentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Barycentric 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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)"},{"className":"Supergalactic","col":0,"comment":"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <http://adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    sgl : `Angle`, optional, must be keyword\n        The supergalactic longitude for this object (``sgb`` must also be given and\n        ``representation`` must be None).\n    sgb : `Angle`, optional, must be keyword\n        The supergalactic latitude for this object (``sgl`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_sgl_cossgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Right Ascension for this object (``pm_sgb`` must\n        also be given).\n    pm_sgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_sgl_cossgb`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n    ","endLoc":90,"id":12525,"nodeType":"Class","startLoc":10,"text":"class Supergalactic(BaseCoordinateFrame):\n    \"\"\"\n    Supergalactic Coordinates\n    (see Lahav et al. 2000, <http://adsabs.harvard.edu/abs/2000MNRAS.312..166L>,\n    and references therein).\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    sgl : `Angle`, optional, must be keyword\n        The supergalactic longitude for this object (``sgb`` must also be given and\n        ``representation`` must be None).\n    sgb : `Angle`, optional, must be keyword\n        The supergalactic latitude for this object (``sgl`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_sgl_cossgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Right Ascension for this object (``pm_sgb`` must\n        also be given).\n    pm_sgb : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Declination for this object (``pm_sgl_cossgb`` must\n        also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\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.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_sgl_cossgb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_sgb', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_sgl', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_sgb', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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":"DifferentialAttribute","col":4,"comment":"null","endLoc":184,"id":12526,"name":"v_bary","nodeType":"Attribute","startLoc":184,"text":"v_bary"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":146,"id":12527,"name":"equinox","nodeType":"Attribute","startLoc":146,"text":"equinox"},{"attributeType":"null","col":4,"comment":"null","endLoc":52,"id":12528,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":52,"text":"frame_specific_representation_info"},{"col":0,"comment":"null","endLoc":71,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, LSR)\ndef icrs_to_lsr(icrs_coord, lsr_frame)","id":12529,"name":"icrs_to_lsr","nodeType":"Function","startLoc":65,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":8,"id":12530,"name":"np","nodeType":"Attribute","startLoc":8,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":10,"id":12531,"name":"u","nodeType":"Attribute","startLoc":10,"text":"u"},{"attributeType":"null","col":25,"comment":"null","endLoc":15,"id":12532,"name":"erfa","nodeType":"Attribute","startLoc":15,"text":"erfa"},{"attributeType":"null","col":0,"comment":"null","endLoc":280,"id":12533,"name":"_NEED_ORIGIN_HINT","nodeType":"Attribute","startLoc":280,"text":"_NEED_ORIGIN_HINT"},{"col":0,"comment":"","endLoc":6,"header":"icrs_cirs_transforms.py#<anonymous>","id":12534,"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.\")"},{"className":"HeliocentricTrueEcliptic","col":0,"comment":"\n    Heliocentric 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    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    ","endLoc":173,"id":12535,"nodeType":"Class","startLoc":153,"text":"class HeliocentricTrueEcliptic(BaseEclipticFrame):\n    \"\"\"\n    Heliocentric 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    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\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    \"\"\"\n\n    equinox = TimeAttribute(default=EQUINOX_J2000)\n    obstime = TimeAttribute(default=DEFAULT_OBSTIME)"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":85,"id":12536,"name":"default_representation","nodeType":"Attribute","startLoc":85,"text":"default_representation"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":172,"id":12537,"name":"equinox","nodeType":"Attribute","startLoc":172,"text":"equinox"},{"fileName":"fk4_fk5_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12538,"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 ..baseframe import frame_transform_graph\nfrom ..transformations import DynamicMatrixTransform\nfrom ..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"},{"attributeType":"TimeAttribute","col":4,"comment":"null","endLoc":173,"id":12539,"name":"obstime","nodeType":"Attribute","startLoc":173,"text":"obstime"},{"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":12540,"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"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":12541,"name":"__all__","nodeType":"Attribute","startLoc":10,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12542,"name":"_base_ecliptic_docstring","nodeType":"Attribute","startLoc":13,"text":"_base_ecliptic_docstring"},{"col":0,"comment":"null","endLoc":54,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK4NoETerms, FK5)\ndef fk4_no_e_to_fk5(fk4noecoord, fk5frame)","id":12543,"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)"},{"col":0,"comment":"","endLoc":4,"header":"ecliptic.py#<anonymous>","id":12544,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['GeocentricTrueEcliptic', 'BarycentricTrueEcliptic',\n           'HeliocentricTrueEcliptic', 'BaseEclipticFrame']\n\n_base_ecliptic_docstring = \"\"\".. 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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    lon : `Angle`, optional, must be keyword\n        The ecliptic longitude for this object (``lat`` must also be given and\n        ``representation`` must be None).\n    lat : `Angle`, optional, must be keyword\n        The ecliptic latitude for this object (``lon`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\n    pm_lon_coslat : `Angle`, optional, must be keyword\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 : `Angle`, optional, must be keyword\n        The proper motion in the ecliptic latitude for this object\n        (``pm_lon_coslat`` must also be given).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The distance for this object from the {0}.\n        (``representation`` must be None).\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\"\"\"\n\nBaseEclipticFrame.__doc__ = BaseEclipticFrame.__doc__.format(\n    params=_base_ecliptic_docstring)\n\nGeocentricTrueEcliptic.__doc__ = GeocentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"geocenter\"))\n\nBarycentricTrueEcliptic.__doc__ = BarycentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"sun's center\"))\n\nHeliocentricTrueEcliptic.__doc__ = HeliocentricTrueEcliptic.__doc__.format(\n    params=_base_ecliptic_docstring.format(\"sun's center\"))"},{"col":0,"comment":"null","endLoc":69,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK4NoETerms)\ndef fk5_to_fk4_no_e(fk5coord, fk4noeframe)","id":12545,"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)"},{"col":0,"comment":"","endLoc":6,"header":"utils.py#<anonymous>","id":12546,"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='utc')\n\nEQUINOX_B1950 = Time('B1950', scale='tai')\n\nDEFAULT_OBSTIME = Time('J2000', scale='utc')\n\nPIOVER2 = np.pi / 2.\n\n_DEFAULT_PM = (0.035, 0.29)*u.arcsec"},{"attributeType":"null","col":16,"comment":"null","endLoc":5,"id":12547,"name":"np","nodeType":"Attribute","startLoc":5,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":12548,"name":"_B1950_TO_J2000_M","nodeType":"Attribute","startLoc":19,"text":"_B1950_TO_J2000_M"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":12549,"name":"_FK4_CORR","nodeType":"Attribute","startLoc":24,"text":"_FK4_CORR"},{"col":0,"comment":"","endLoc":5,"header":"fk4_fk5_transforms.py#<anonymous>","id":12550,"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"},{"fileName":"hcrs.py","filePath":"astropy/coordinates/builtin_frames","id":12551,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..attributes import TimeAttribute\nfrom .utils import DEFAULT_OBSTIME\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\n\n\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-coordinates-seealso` section of\n    the documentation.\n\n    The frame attributes are listed under **Other Parameters**.\n\n    {params}\n\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    obstime = TimeAttribute(default=DEFAULT_OBSTIME)\n\n\nHCRS.__doc__ = HCRS.__doc__.format(params=_base_radec_docstring)\n\n# Transformations are defined in icrs_circ_transforms.py\n"},{"col":0,"comment":"","endLoc":4,"header":"hcrs.py#<anonymous>","id":12552,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"HCRS.__doc__ = HCRS.__doc__.format(params=_base_radec_docstring)"},{"fileName":"ecliptic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12553,"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\"\"\"\n\nfrom ... import units as u\nfrom ..baseframe import frame_transform_graph\nfrom ..transformations import FunctionTransformWithFiniteDifference, DynamicMatrixTransform\nfrom ..matrix_utilities import (rotation_matrix,\n                                matrix_product, matrix_transpose)\nfrom ..representation import CartesianRepresentation\nfrom ... import _erfa as erfa\n\nfrom .icrs import ICRS\nfrom .gcrs import GCRS\nfrom .ecliptic import GeocentricTrueEcliptic, BarycentricTrueEcliptic, HeliocentricTrueEcliptic\nfrom .utils import get_jd12\nfrom ..errors import UnitsError\n\n\ndef _ecliptic_rotation_matrix(equinox):\n    # This code calls pmat06 from ERFA, which retrieves the precession\n    # matrix (including frame bias) according to the IAU 2006 model, but\n    # leaves out the nutation. This matches what ERFA does in the ecm06\n    # function and also brings the results closer to what other libraries\n    # give (see https://github.com/astropy/astropy/pull/6508). However,\n    # notice that this makes the name \"TrueEcliptic\" misleading, and might\n    # be changed in the future (discussion in the same pull request)\n    jd1, jd2 = get_jd12(equinox, 'tt')\n    rbp = erfa.pmat06(jd1, jd2)\n    obl = erfa.obl06(jd1, jd2)*u.radian\n    return matrix_product(rotation_matrix(obl, 'x'), rbp)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\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.equinox))\n\n    rmat = _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 geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.equinox)\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_baryecliptic(from_coo, to_frame):\n    return _ecliptic_rotation_matrix(to_frame.equinox)\n\n\n@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, 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(FunctionTransformWithFiniteDifference,\n                                 ICRS, HeliocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\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 barycentric sun coordinate\n    # this goes here to avoid circular import errors\n    from ..solar_system import get_body_barycentric\n    bary_sun_pos = get_body_barycentric('sun', to_frame.obstime)\n\n    # offset to heliocentric\n    heliocart = from_coo.cartesian - bary_sun_pos\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _ecliptic_rotation_matrix(to_frame.equinox)\n\n    newrepr = heliocart.transform(rmat)\n    return to_frame.realize_frame(newrepr)\n\n\n@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 HeliocentricTrueEcliptic, ICRS,\n                                 finite_difference_frameattr_name='equinox')\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 = _ecliptic_rotation_matrix(from_coo.equinox)\n    intermed_repr = from_coo.cartesian.transform(matrix_transpose(rmat))\n\n    # now offset back to barycentric, which is the correct center for ICRS\n\n    # this goes here to avoid circular import errors\n    from ..solar_system import get_body_barycentric\n\n    # get barycentric sun coordinate\n    bary_sun_pos = get_body_barycentric('sun', from_coo.obstime)\n\n    newrepr = intermed_repr + bary_sun_pos\n    return to_frame.realize_frame(newrepr)\n"},{"fileName":"__init__.py","filePath":"astropy/coordinates/builtin_frames","id":12554,"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 actually 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 trasnformation 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\nfrom .lsr import LSR, GalacticLSR\nfrom .supergalactic import Supergalactic\nfrom .altaz import AltAz\nfrom .gcrs import GCRS, PrecessedGeocentric\nfrom .cirs import CIRS\nfrom .itrs import ITRS\nfrom .hcrs import HCRS\nfrom .ecliptic import (GeocentricTrueEcliptic, BarycentricTrueEcliptic,\n                       HeliocentricTrueEcliptic, BaseEclipticFrame)\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 intermediate_rotation_transforms\nfrom . import ecliptic_transforms\n\n# we define an __all__ because otherwise the transformation modules get included\n__all__ = ['ICRS', 'FK5', 'FK4', 'FK4NoETerms', 'Galactic', 'Galactocentric',\n           'Supergalactic', 'AltAz', 'GCRS', 'CIRS', 'ITRS', 'HCRS',\n           'PrecessedGeocentric', 'GeocentricTrueEcliptic',\n           'BarycentricTrueEcliptic', 'HeliocentricTrueEcliptic',\n           'SkyOffsetFrame', 'GalacticLSR', 'LSR',\n           'BaseEclipticFrame', 'BaseRADecFrame']\n\n\ndef _make_transform_graph_docs():\n    \"\"\"\n    Generates a string for use with the coordinate package's docstring\n    to show the available transforms and coordinate systems\n    \"\"\"\n    import inspect\n    from textwrap import dedent\n    from ..baseframe import BaseCoordinateFrame, frame_transform_graph\n\n    isclass = inspect.isclass\n    coosys = [item for item in globals().values()\n              if isclass(item) and issubclass(item, BaseCoordinateFrame)]\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 = frame_transform_graph.to_dot_graph(addnodes=coosys,\n                                                  priorities=False)\n\n    docstr = \"\"\"\n    The diagram below shows all of the coordinate systems built into the\n    `~astropy.coordinates` package, their aliases (useful for converting\n    other coordinates to them using attribute-style access) and the\n    pre-defined transformations between them.  The user is free to\n    override any of these transformations by defining new transformations\n    between these systems, but the pre-defined transformations should be\n    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\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 ..transformations import trans_to_color\n    html_list_items = []\n    for cls, color in trans_to_color.items():\n        block = u\"\"\"\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>{0}:</b>\n                    <span style=\"font-size: 24px; color: {1};\"><b>➝</b></span>\n                </p>\n            </li>\n        \"\"\".format(cls.__name__, color)\n        html_list_items.append(block)\n\n    graph_legend = u\"\"\"\n    .. raw:: html\n\n        <ul>\n            {}\n        </ul>\n    \"\"\".format(\"\\n\".join(html_list_items))\n    docstr = docstr + dedent(graph_legend)\n\n    return docstr\n\n\n_transform_graph_docs = _make_transform_graph_docs()\n"},{"fileName":"galactic.py","filePath":"astropy/coordinates/builtin_frames","id":12555,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom ..angles import Angle\nfrom .. import representation as r\nfrom ..baseframe import BaseCoordinateFrame, RepresentationMapping\n\n# these are needed for defining the NGP\nfrom .fk5 import FK5\nfrom .fk4 import FK4NoETerms\n\n\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    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n\n    l : `Angle`, optional, must be keyword\n        The Galactic longitude for this object (``b`` must also be given and\n        ``representation`` must be None).\n    b : `Angle`, optional, must be keyword\n        The Galactic latitude for this object (``l`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n\n    pm_l_cosb : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The proper motion in Galactic latitude for this object (``pm_l_cosb``\n        must also be given).\n    radial_velocity : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\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 <http://adsabs.harvard.edu/abs/1960MNRAS.121..123B>`_.\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        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_l_cosb', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_l', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_b', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s),\n        ]\n    }\n    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\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"},{"col":0,"comment":"null","endLoc":33,"header":"def _ecliptic_rotation_matrix(equinox)","id":12556,"name":"_ecliptic_rotation_matrix","nodeType":"Function","startLoc":22,"text":"def _ecliptic_rotation_matrix(equinox):\n    # This code calls pmat06 from ERFA, which retrieves the precession\n    # matrix (including frame bias) according to the IAU 2006 model, but\n    # leaves out the nutation. This matches what ERFA does in the ecm06\n    # function and also brings the results closer to what other libraries\n    # give (see https://github.com/astropy/astropy/pull/6508). However,\n    # notice that this makes the name \"TrueEcliptic\" misleading, and might\n    # be changed in the future (discussion in the same pull request)\n    jd1, jd2 = get_jd12(equinox, 'tt')\n    rbp = erfa.pmat06(jd1, jd2)\n    obl = erfa.obl06(jd1, jd2)*u.radian\n    return matrix_product(rotation_matrix(obl, 'x'), rbp)"},{"fileName":"fk5.py","filePath":"astropy/coordinates/builtin_frames","id":12557,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..baseframe import frame_transform_graph\nfrom ..attributes import TimeAttribute\nfrom ..transformations import DynamicMatrixTransform\nfrom .. import earth_orientation as earth\n\nfrom .baseradec import _base_radec_docstring, BaseRADecFrame\nfrom .utils import EQUINOX_J2000\n\n\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    {params}\n\n    Other parameters\n    ----------------\n    equinox : `~astropy.time.Time`\n        The equinox of this frame.\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\nFK5.__doc__ = FK5.__doc__.format(params=_base_radec_docstring)\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"},{"col":0,"comment":"null","endLoc":61,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK5)\ndef fk5_to_fk5(fk5coord1, fk5frame2)","id":12558,"name":"fk5_to_fk5","nodeType":"Function","startLoc":59,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, FK5)\ndef fk5_to_fk5(fk5coord1, fk5frame2):\n    return fk5coord1._precession_matrix(fk5coord1.equinox, fk5frame2.equinox)"},{"col":0,"comment":"null","endLoc":297,"header":"def _check_coord_repr_diff_types(c)","id":12559,"name":"_check_coord_repr_diff_types","nodeType":"Function","startLoc":284,"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":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":86,"id":12560,"name":"default_differential","nodeType":"Attribute","startLoc":86,"text":"default_differential"},{"col":0,"comment":"null","endLoc":303,"header":"@frame_transform_graph.transform(AffineTransform, ICRS, Galactocentric)\ndef icrs_to_galactocentric(icrs_coord, galactocentric_frame)","id":12561,"name":"icrs_to_galactocentric","nodeType":"Function","startLoc":300,"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)"},{"col":0,"comment":"null","endLoc":45,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef gcrs_to_geoecliptic(gcrs_coo, to_frame)","id":12562,"name":"gcrs_to_geoecliptic","nodeType":"Function","startLoc":36,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 GCRS, GeocentricTrueEcliptic,\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.equinox))\n\n    rmat = _ecliptic_rotation_matrix(to_frame.equinox)\n    newrepr = gcrs_coo2.cartesian.transform(rmat)\n    return to_frame.realize_frame(newrepr)"},{"attributeType":"Galactic","col":4,"comment":"null","endLoc":90,"id":12563,"name":"_nsgp_gal","nodeType":"Attribute","startLoc":90,"text":"_nsgp_gal"},{"col":0,"comment":"","endLoc":4,"header":"fk5.py#<anonymous>","id":12564,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"FK5.__doc__ = FK5.__doc__.format(params=_base_radec_docstring)"},{"fileName":"supergalactic_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12565,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..matrix_utilities import (rotation_matrix,\n                                matrix_product, matrix_transpose)\nfrom ..baseframe import frame_transform_graph\nfrom ..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"},{"col":0,"comment":"null","endLoc":18,"header":"@frame_transform_graph.transform(StaticMatrixTransform, Galactic, Supergalactic)\ndef gal_to_supergal()","id":12566,"name":"gal_to_supergal","nodeType":"Function","startLoc":13,"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)"},{"attributeType":"null","col":25,"comment":"null","endLoc":4,"id":12567,"name":"u","nodeType":"Attribute","startLoc":4,"text":"u"},{"col":0,"comment":"null","endLoc":23,"header":"@frame_transform_graph.transform(StaticMatrixTransform, Supergalactic, Galactic)\ndef supergal_to_gal()","id":12568,"name":"supergal_to_gal","nodeType":"Function","startLoc":21,"text":"@frame_transform_graph.transform(StaticMatrixTransform, Supergalactic, Galactic)\ndef supergal_to_gal():\n    return matrix_transpose(gal_to_supergal())"},{"attributeType":"null","col":33,"comment":"null","endLoc":5,"id":12569,"name":"r","nodeType":"Attribute","startLoc":5,"text":"r"},{"col":0,"comment":"\n    Generates a string for use with the coordinate package's docstring\n    to show the available transforms and coordinate systems\n    ","endLoc":123,"header":"def _make_transform_graph_docs()","id":12570,"name":"_make_transform_graph_docs","nodeType":"Function","startLoc":62,"text":"def _make_transform_graph_docs():\n    \"\"\"\n    Generates a string for use with the coordinate package's docstring\n    to show the available transforms and coordinate systems\n    \"\"\"\n    import inspect\n    from textwrap import dedent\n    from ..baseframe import BaseCoordinateFrame, frame_transform_graph\n\n    isclass = inspect.isclass\n    coosys = [item for item in globals().values()\n              if isclass(item) and issubclass(item, BaseCoordinateFrame)]\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 = frame_transform_graph.to_dot_graph(addnodes=coosys,\n                                                  priorities=False)\n\n    docstr = \"\"\"\n    The diagram below shows all of the coordinate systems built into the\n    `~astropy.coordinates` package, their aliases (useful for converting\n    other coordinates to them using attribute-style access) and the\n    pre-defined transformations between them.  The user is free to\n    override any of these transformations by defining new transformations\n    between these systems, but the pre-defined transformations should be\n    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\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 ..transformations import trans_to_color\n    html_list_items = []\n    for cls, color in trans_to_color.items():\n        block = u\"\"\"\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>{0}:</b>\n                    <span style=\"font-size: 24px; color: {1};\"><b>➝</b></span>\n                </p>\n            </li>\n        \"\"\".format(cls.__name__, color)\n        html_list_items.append(block)\n\n    graph_legend = u\"\"\"\n    .. raw:: html\n\n        <ul>\n            {}\n        </ul>\n    \"\"\".format(\"\\n\".join(html_list_items))\n    docstr = docstr + dedent(graph_legend)\n\n    return docstr"},{"fileName":"baseradec.py","filePath":"astropy/coordinates/builtin_frames","id":12571,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ... import units as u\nfrom .. import representation as r\nfrom ..baseframe import BaseCoordinateFrame, RepresentationMapping\n\n__all__ = ['BaseRADecFrame']\n\n_base_radec_docstring = \"\"\"Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or ``None`` to have no data (or use the other\n        keywords below).\n\n    ra : `Angle`, optional, must be keyword\n        The RA for this object (``dec`` must also be given and ``representation``\n        must be None).\n    dec : `Angle`, optional, must be keyword\n        The Declination for this object (``ra`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_ra_cosdec : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\"\"\"\n\n\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    {params}\n    \"\"\"\n    frame_specific_representation_info = {\n        r.SphericalRepresentation: [\n            RepresentationMapping('lon', 'ra'),\n            RepresentationMapping('lat', 'dec')\n        ],\n        r.SphericalCosLatDifferential: [\n            RepresentationMapping('d_lon_coslat', 'pm_ra_cosdec', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_dec', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\n        ],\n        r.SphericalDifferential: [\n            RepresentationMapping('d_lon', 'pm_ra', u.mas/u.yr),\n            RepresentationMapping('d_lat', 'pm_dec', u.mas/u.yr),\n            RepresentationMapping('d_distance', 'radial_velocity', u.km/u.s)\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    frame_specific_representation_info[r.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[r.SphericalRepresentation]\n    frame_specific_representation_info[r.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[r.SphericalCosLatDifferential]\n    frame_specific_representation_info[r.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[r.SphericalDifferential]\n\n    default_representation = r.SphericalRepresentation\n    default_differential = r.SphericalCosLatDifferential\n\n\nBaseRADecFrame.__doc__ = BaseRADecFrame.__doc__.format(\n    params=_base_radec_docstring)\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":12572,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"baseradec.py#<anonymous>","id":12573,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['BaseRADecFrame']\n\n_base_radec_docstring = \"\"\"Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or ``None`` to have no data (or use the other\n        keywords below).\n\n    ra : `Angle`, optional, must be keyword\n        The RA for this object (``dec`` must also be given and ``representation``\n        must be None).\n    dec : `Angle`, optional, must be keyword\n        The Declination for this object (``ra`` must also be given and\n        ``representation`` must be None).\n    distance : `~astropy.units.Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n        (``representation`` must be None).\n\n    pm_ra_cosdec : :class:`~astropy.units.Quantity`, optional, must be keyword\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 : :class:`~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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\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\n    differential_cls : `BaseDifferential`, dict, optional\n        A differential class or dictionary of differential classes (currently\n        only a velocity differential with key 's' is supported). This sets\n        the expected input differential class, thereby changing the expected\n        keyword arguments of the data passed in. For example, passing\n        ``differential_cls=CartesianDifferential`` will make the classes\n        expect velocity data with the argument names ``v_x, v_y, v_z``.\n\"\"\"\n\nBaseRADecFrame.__doc__ = BaseRADecFrame.__doc__.format(\n    params=_base_radec_docstring)"},{"fileName":"icrs_fk5_transforms.py","filePath":"astropy/coordinates/builtin_frames","id":12574,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom ..matrix_utilities import (rotation_matrix,\n                                matrix_product, matrix_transpose)\nfrom ..baseframe import frame_transform_graph\nfrom ..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"},{"col":0,"comment":"null","endLoc":55,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricTrueEcliptic, GCRS)\ndef geoecliptic_to_gcrs(from_coo, gcrs_frame)","id":12575,"name":"geoecliptic_to_gcrs","nodeType":"Function","startLoc":48,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, GeocentricTrueEcliptic, GCRS)\ndef geoecliptic_to_gcrs(from_coo, gcrs_frame):\n    rmat = _ecliptic_rotation_matrix(from_coo.equinox)\n    newrepr = from_coo.cartesian.transform(matrix_transpose(rmat))\n    gcrs = GCRS(newrepr, obstime=from_coo.equinox)\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":"\n    B-matrix from USNO circular 179.  Used by the ICRS->FK5 transformation\n    functions.\n    ","endLoc":28,"header":"def _icrs_to_fk5_matrix()","id":12576,"name":"_icrs_to_fk5_matrix","nodeType":"Function","startLoc":14,"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":39,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, FK5)\ndef icrs_to_fk5(icrscoord, fk5frame)","id":12577,"name":"icrs_to_fk5","nodeType":"Function","startLoc":35,"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)"},{"col":0,"comment":"null","endLoc":309,"header":"@frame_transform_graph.transform(AffineTransform, Galactocentric, ICRS)\ndef galactocentric_to_icrs(galactocentric_coord, icrs_frame)","id":12578,"name":"galactocentric_to_icrs","nodeType":"Function","startLoc":306,"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":47,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, FK5, ICRS)\ndef fk5_to_icrs(fk5coord, icrsframe)","id":12579,"name":"fk5_to_icrs","nodeType":"Function","startLoc":43,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":12580,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":8,"id":12581,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"attributeType":"null","col":33,"comment":"null","endLoc":12,"id":12582,"name":"r","nodeType":"Attribute","startLoc":12,"text":"r"},{"attributeType":"Angle","col":0,"comment":"null","endLoc":27,"id":12583,"name":"_ROLL0","nodeType":"Attribute","startLoc":27,"text":"_ROLL0"},{"col":0,"comment":"null","endLoc":60,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricTrueEcliptic)\ndef icrs_to_baryecliptic(from_coo, to_frame)","id":12584,"name":"icrs_to_baryecliptic","nodeType":"Function","startLoc":58,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, ICRS, BarycentricTrueEcliptic)\ndef icrs_to_baryecliptic(from_coo, to_frame):\n    return _ecliptic_rotation_matrix(to_frame.equinox)"},{"col":0,"comment":"","endLoc":4,"header":"galactocentric.py#<anonymous>","id":12585,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_ROLL0 = Angle(58.5986320306*u.degree)"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":12586,"name":"_ICRS_TO_FK5_J2000_MAT","nodeType":"Attribute","startLoc":32,"text":"_ICRS_TO_FK5_J2000_MAT"},{"col":0,"comment":"null","endLoc":65,"header":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, ICRS)\ndef baryecliptic_to_icrs(from_coo, to_frame)","id":12587,"name":"baryecliptic_to_icrs","nodeType":"Function","startLoc":63,"text":"@frame_transform_graph.transform(DynamicMatrixTransform, BarycentricTrueEcliptic, ICRS)\ndef baryecliptic_to_icrs(from_coo, to_frame):\n    return matrix_transpose(icrs_to_baryecliptic(to_frame, from_coo))"},{"col":0,"comment":"","endLoc":5,"header":"icrs_fk5_transforms.py#<anonymous>","id":12588,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"_ICRS_TO_FK5_J2000_MAT = _icrs_to_fk5_matrix()"},{"col":0,"comment":"null","endLoc":93,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 ICRS, HeliocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\ndef icrs_to_helioecliptic(from_coo, to_frame)","id":12589,"name":"icrs_to_helioecliptic","nodeType":"Function","startLoc":74,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 ICRS, HeliocentricTrueEcliptic,\n                                 finite_difference_frameattr_name='equinox')\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 barycentric sun coordinate\n    # this goes here to avoid circular import errors\n    from ..solar_system import get_body_barycentric\n    bary_sun_pos = get_body_barycentric('sun', to_frame.obstime)\n\n    # offset to heliocentric\n    heliocart = from_coo.cartesian - bary_sun_pos\n\n    # now compute the matrix to precess to the right orientation\n    rmat = _ecliptic_rotation_matrix(to_frame.equinox)\n\n    newrepr = heliocart.transform(rmat)\n    return to_frame.realize_frame(newrepr)"},{"id":12590,"name":"astropy/visualization","nodeType":"Package"},{"fileName":"mpl_style.py","filePath":"astropy/visualization","id":12591,"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\nfrom ..utils import minversion\n\n# This returns False if matplotlib cannot be imported\nMATPLOTLIB_GE_1_5 = minversion('matplotlib', '1.5')\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\nif MATPLOTLIB_GE_1_5:\n    # This is a dependency of matplotlib, so should be present.\n    from cycler import cycler\n    astropy_mpl_style_1['axes.prop_cycle'] = cycler('color', color_cycle)\nelse:\n    astropy_mpl_style_1['axes.color_cycle'] = color_cycle\n\nastropy_mpl_style = astropy_mpl_style_1\n\"\"\"The most recent version of the astropy plotting style.\"\"\"\n"},{"fileName":"transform.py","filePath":"astropy/visualization","id":12592,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\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    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 CompositeTransform(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":12593,"nodeType":"Class","startLoc":8,"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    def __add__(self, other):\n        return CompositeTransform(other, self)"},{"col":4,"comment":"null","endLoc":16,"header":"def __add__(self, other)","id":12594,"name":"__add__","nodeType":"Function","startLoc":15,"text":"def __add__(self, other):\n        return CompositeTransform(other, self)"},{"attributeType":"null","col":0,"comment":"null","endLoc":10,"id":12595,"name":"MATPLOTLIB_GE_1_5","nodeType":"Attribute","startLoc":10,"text":"MATPLOTLIB_GE_1_5"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":12596,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":12597,"name":"astropy_mpl_style_1","nodeType":"Attribute","startLoc":15,"text":"astropy_mpl_style_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":70,"id":12598,"name":"color_cycle","nodeType":"Attribute","startLoc":70,"text":"color_cycle"},{"attributeType":"null","col":0,"comment":"The most recent version of the astropy plotting style.","endLoc":85,"id":12599,"name":"astropy_mpl_style","nodeType":"Attribute","startLoc":85,"text":"astropy_mpl_style"},{"col":0,"comment":"","endLoc":7,"header":"mpl_style.py#<anonymous>","id":12600,"name":"<anonymous>","nodeType":"Function","startLoc":7,"text":"MATPLOTLIB_GE_1_5 = minversion('matplotlib', '1.5')\n\n__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\nif MATPLOTLIB_GE_1_5:\n    # This is a dependency of matplotlib, so should be present.\n    from cycler import cycler\n    astropy_mpl_style_1['axes.prop_cycle'] = cycler('color', color_cycle)\nelse:\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.\"\"\""},{"fileName":"hist.py","filePath":"astropy/visualization","id":12601,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\nfrom inspect import signature\nfrom ..stats import histogram\n\n__all__ = ['hist']\n\n\ndef hist(x, bins=10, ax=None, **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: http://astroML.org/\n\n    Parameters\n    ----------\n    x : array_like\n        array of data to be histogrammed\n\n    bins : int or 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 : 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    **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    # arguments of np.histogram should be passed to astropy.stats.histogram\n    arglist = list(signature(np.histogram).parameters.keys())[1:]\n    np_hist_kwds = dict((key, kwargs[key]) for key in arglist if key in kwargs)\n    hist, bins = histogram(x, bins, **np_hist_kwds)\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":"null","endLoc":116,"header":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 HeliocentricTrueEcliptic, ICRS,\n                                 finite_difference_frameattr_name='equinox')\ndef helioecliptic_to_icrs(from_coo, to_frame)","id":12602,"name":"helioecliptic_to_icrs","nodeType":"Function","startLoc":96,"text":"@frame_transform_graph.transform(FunctionTransformWithFiniteDifference,\n                                 HeliocentricTrueEcliptic, ICRS,\n                                 finite_difference_frameattr_name='equinox')\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 = _ecliptic_rotation_matrix(from_coo.equinox)\n    intermed_repr = from_coo.cartesian.transform(matrix_transpose(rmat))\n\n    # now offset back to barycentric, which is the correct center for ICRS\n\n    # this goes here to avoid circular import errors\n    from ..solar_system import get_body_barycentric\n\n    # get barycentric sun coordinate\n    bary_sun_pos = get_body_barycentric('sun', from_coo.obstime)\n\n    newrepr = intermed_repr + bary_sun_pos\n    return to_frame.realize_frame(newrepr)"},{"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: http://astroML.org/\n\n    Parameters\n    ----------\n    x : array_like\n        array of data to be histogrammed\n\n    bins : int or 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 : 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    **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":62,"header":"def hist(x, bins=10, ax=None, **kwargs)","id":12603,"name":"hist","nodeType":"Function","startLoc":11,"text":"def hist(x, bins=10, ax=None, **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: http://astroML.org/\n\n    Parameters\n    ----------\n    x : array_like\n        array of data to be histogrammed\n\n    bins : int or 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 : 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    **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    # arguments of np.histogram should be passed to astropy.stats.histogram\n    arglist = list(signature(np.histogram).parameters.keys())[1:]\n    np_hist_kwds = dict((key, kwargs[key]) for key in arglist if key in kwargs)\n    hist, bins = histogram(x, bins, **np_hist_kwds)\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":80,"header":"@frame_transform_graph.transform(AffineTransform, LSR, ICRS)\ndef lsr_to_icrs(lsr_coord, icrs_frame)","id":12604,"name":"lsr_to_icrs","nodeType":"Function","startLoc":74,"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"},{"fileName":"interval.py","filePath":"astropy/visualization","id":12605,"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\n\nimport abc\nimport numpy as np\n\nfrom ..utils.misc import InheritDocstrings\nfrom .transform import BaseTransform\n\n\n__all__ = ['BaseInterval', 'ManualInterval', 'MinMaxInterval',\n           'AsymmetricPercentileInterval', 'PercentileInterval',\n           'ZScaleInterval']\n\n\nclass BaseInterval(BaseTransform, metaclass=InheritDocstrings):\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 : `~numpy.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    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 : `~numpy.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 : `~numpy.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        vmin = np.nanmin(values) if self.vmin is None else self.vmin\n        vmax = np.nanmax(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        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    http://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://trac.stsci.edu/ssb/stsci_python/browser/stsci_python/trunk/numdisplay/lib/stsci/numdisplay/zscale.py?rev=19347\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 less than ``min_npixels`` pixels are rejected, then the\n        returned values are the minimum and maximum of the data.\n        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 niter 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        slope, intercept = fit\n\n        if ngoodpix >= minpix:\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"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":12606,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":12607,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"hist.py#<anonymous>","id":12608,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['hist']"},{"attributeType":"null","col":25,"comment":"null","endLoc":7,"id":12609,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"null","col":25,"comment":"null","endLoc":13,"id":12610,"name":"erfa","nodeType":"Attribute","startLoc":13,"text":"erfa"},{"attributeType":"null","col":0,"comment":"null","endLoc":68,"id":12611,"name":"_NEED_ORIGIN_HINT","nodeType":"Attribute","startLoc":68,"text":"_NEED_ORIGIN_HINT"},{"col":0,"comment":"","endLoc":5,"header":"ecliptic_transforms.py#<anonymous>","id":12612,"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.\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":12613,"name":"__all__","nodeType":"Attribute","startLoc":54,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":12614,"name":"_transform_graph_docs","nodeType":"Attribute","startLoc":126,"text":"_transform_graph_docs"},{"fileName":"__init__.py","filePath":"astropy/visualization","id":12615,"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 .lupton_rgb import *\n"},{"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":12616,"nodeType":"Class","startLoc":21,"text":"class BaseInterval(BaseTransform, metaclass=InheritDocstrings):\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 : `~numpy.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    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 : `~numpy.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 : `~numpy.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":"stretch.py","filePath":"astropy/visualization","id":12617,"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\n\nimport numpy as np\n\nfrom ..utils.misc import InheritDocstrings\nfrom .transform import BaseTransform\n\n\n__all__ = [\"BaseStretch\", \"LinearStretch\", \"SqrtStretch\", \"PowerStretch\",\n           \"PowerDistStretch\", \"SquaredStretch\", \"LogStretch\", \"AsinhStretch\",\n           \"SinhStretch\", \"HistEqStretch\", \"ContrastBiasStretch\"]\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, metaclass=InheritDocstrings):\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    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 : `~numpy.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 : `~numpy.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.\n\n    The stretch is given by:\n\n    .. math::\n        y = x\n    \"\"\"\n\n    def __call__(self, values, clip=True, out=None):\n        return _prepare(values, clip=clip, out=out)\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch()\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    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.sqrt(values, out=values)\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).\n    \"\"\"\n\n    def __init__(self, a):\n        super().__init__()\n        self.power = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(values, self.power, out=values)\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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a 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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a 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.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\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, 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        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} (a + 1) -1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a):\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, 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.  Must be in the range between 0 and 1.\n        Default is 0.1\n    \"\"\"\n\n    def __init__(self, a=0.1):\n        super().__init__()\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.  Default is 1/3.\n    \"\"\"\n\n    def __init__(self, a=1./3.):\n        super().__init__()\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\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\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\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"},{"fileName":"lupton_rgb.py","filePath":"astropy/visualization","id":12618,"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 : http://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 : `~numpy.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 : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to green.\n    image_b : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : `~numpy.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 : `~numpy.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 : `~numpy.ndarray`\n            Image to map to red.\n        image_g : `~numpy.ndarray`\n            Image to map to green.\n        image_b : `~numpy.ndarray`\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : `~numpy.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 : `~numpy.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 : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to green.\n        image_b : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : `~numpy.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 : `~numpy.ndarray`\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : `~numpy.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            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 http://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 : `~numpy.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 : `~numpy.ndarray`, optional\n        the second image to analyse (must be specified with image3).\n    image3 : `~numpy.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-visualization-rgb`.\n\n    Parameters\n    ----------\n\n    image_r : `~numpy.ndarray`\n        Image to map to red.\n    image_g : `~numpy.ndarray`\n        Image to map to green.\n    image_b : `~numpy.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 : `~numpy.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":4,"comment":"\n        Return the minimum and maximum value in the interval based on\n        the values provided.\n\n        Parameters\n        ----------\n        values : `~numpy.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":12619,"name":"get_limits","nodeType":"Function","startLoc":28,"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 : `~numpy.ndarray`\n            The image values.\n\n        Returns\n        -------\n        vmin, vmax : float\n            The mininium and maximum image value in the interval.\n        \"\"\""},{"col":0,"comment":"","endLoc":25,"header":"__init__.py#<anonymous>","id":12620,"name":"<anonymous>","nodeType":"Function","startLoc":3,"text":"\"\"\"\nThis package contains the coordinate frames actually 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 trasnformation 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           'Supergalactic', 'AltAz', 'GCRS', 'CIRS', 'ITRS', 'HCRS',\n           'PrecessedGeocentric', 'GeocentricTrueEcliptic',\n           'BarycentricTrueEcliptic', 'HeliocentricTrueEcliptic',\n           'SkyOffsetFrame', 'GalacticLSR', 'LSR',\n           'BaseEclipticFrame', 'BaseRADecFrame']\n\n_transform_graph_docs = _make_transform_graph_docs()"},{"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 : `~numpy.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 : `~numpy.ndarray`\n            The transformed values.\n        ","endLoc":82,"header":"def __call__(self, values, clip=True, out=None)","id":12621,"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 : `~numpy.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 : `~numpy.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":"mpl_normalize.py","filePath":"astropy/visualization","id":12622,"nodeType":"File","text":"\"\"\"\nNormalization class for Matplotlib that can be used to produce\ncolorbars.\n\"\"\"\n\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\n    # On older versions of matplotlib Normalize is an old-style class\n    if not isinstance(Normalize, type):\n        class Normalize(Normalize, object):\n            pass\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']\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 : `~numpy.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\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, optional\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False):\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        if data is not None and interval is not None:\n            _vmin, _vmax = 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        if stretch is not None and 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\n    def __call__(self, values, clip=None):\n        if clip is None:\n            clip = self.clip\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        # Set default values for vmin and vmax if not specified\n        self.autoscale_None(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 self.clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\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):\n        # Find unstretched values in range 0 to 1\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=True):\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 : `~numpy.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` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\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()\n    elif stretch == 'asinh':\n        stretch = AsinhStretch(asinh_a)\n    else:\n        raise ValueError('Unknown stretch: {0}.'.format(stretch))\n\n    vmin, vmax = interval.get_limits(data)\n\n    return ImageNormalize(vmin=vmin, vmax=vmax, stretch=stretch, clip=clip)\n"},{"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":78,"id":12623,"nodeType":"Class","startLoc":47,"text":"class BaseStretch(BaseTransform, metaclass=InheritDocstrings):\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    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 : `~numpy.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 : `~numpy.ndarray`\n            The transformed values.\n        \"\"\"\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\""},{"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":178,"id":12624,"nodeType":"Class","startLoc":159,"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)"},{"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":156,"id":12625,"nodeType":"Class","startLoc":118,"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":138,"header":"def __init__(self, lower_percentile, upper_percentile, n_samples=None)","id":12626,"name":"__init__","nodeType":"Function","startLoc":135,"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":156,"header":"def get_limits(self, values)","id":12627,"name":"get_limits","nodeType":"Function","startLoc":140,"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"},{"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 : `~numpy.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 : `~numpy.ndarray`\n            The transformed values.\n        ","endLoc":74,"header":"def __call__(self, values, clip=True, out=None)","id":12628,"name":"__call__","nodeType":"Function","startLoc":54,"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 : `~numpy.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 : `~numpy.ndarray`\n            The transformed values.\n        \"\"\""},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":78,"header":"@property\n    def inverse(self)","id":12629,"name":"inverse","nodeType":"Function","startLoc":76,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\""},{"className":"LinearStretch","col":0,"comment":"\n    A linear stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = x\n    ","endLoc":97,"id":12630,"nodeType":"Class","startLoc":81,"text":"class LinearStretch(BaseStretch):\n    \"\"\"\n    A linear stretch.\n\n    The stretch is given by:\n\n    .. math::\n        y = x\n    \"\"\"\n\n    def __call__(self, values, clip=True, out=None):\n        return _prepare(values, clip=clip, out=out)\n\n    @property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch()"},{"attributeType":"null","col":8,"comment":"null","endLoc":137,"id":12631,"name":"upper_percentile","nodeType":"Attribute","startLoc":137,"text":"self.upper_percentile"},{"col":4,"comment":"null","endLoc":92,"header":"def __call__(self, values, clip=True, out=None)","id":12632,"name":"__call__","nodeType":"Function","startLoc":91,"text":"def __call__(self, values, clip=True, out=None):\n        return _prepare(values, clip=clip, out=out)"},{"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":12633,"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"},{"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":106,"id":12634,"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        vmin = np.nanmin(values) if self.vmin is None else self.vmin\n        vmax = np.nanmax(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":12635,"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":106,"header":"def get_limits(self, values)","id":12636,"name":"get_limits","nodeType":"Function","startLoc":103,"text":"def get_limits(self, values):\n        vmin = np.nanmin(values) if self.vmin is None else self.vmin\n        vmax = np.nanmax(values) if self.vmax is None else self.vmax\n        return vmin, vmax"},{"attributeType":"null","col":8,"comment":"null","endLoc":136,"id":12637,"name":"lower_percentile","nodeType":"Attribute","startLoc":136,"text":"self.lower_percentile"},{"attributeType":"null","col":8,"comment":"null","endLoc":101,"id":12638,"name":"vmax","nodeType":"Attribute","startLoc":101,"text":"self.vmax"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":97,"header":"@property\n    def inverse(self)","id":12639,"name":"inverse","nodeType":"Function","startLoc":94,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return LinearStretch()"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":12640,"name":"vmin","nodeType":"Attribute","startLoc":100,"text":"self.vmin"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":12641,"name":"n_samples","nodeType":"Attribute","startLoc":138,"text":"self.n_samples"},{"className":"MinMaxInterval","col":0,"comment":"\n    Interval based on the minimum and maximum values in the data.\n    ","endLoc":115,"id":12642,"nodeType":"Class","startLoc":109,"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        return np.min(values), np.max(values)"},{"col":4,"comment":"null","endLoc":115,"header":"def get_limits(self, values)","id":12643,"name":"get_limits","nodeType":"Function","startLoc":114,"text":"def get_limits(self, values):\n        return np.min(values), np.max(values)"},{"className":"ZScaleInterval","col":0,"comment":"\n    Interval based on IRAF's zscale.\n\n    http://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://trac.stsci.edu/ssb/stsci_python/browser/stsci_python/trunk/numdisplay/lib/stsci/numdisplay/zscale.py?rev=19347\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 less than ``min_npixels`` pixels are rejected, then the\n        returned values are the minimum and maximum of the data.\n        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":284,"id":12644,"nodeType":"Class","startLoc":181,"text":"class ZScaleInterval(BaseInterval):\n    \"\"\"\n    Interval based on IRAF's zscale.\n\n    http://iraf.net/forum/viewtopic.php?showtopic=134139\n\n    Original implementation:\n    https://trac.stsci.edu/ssb/stsci_python/browser/stsci_python/trunk/numdisplay/lib/stsci/numdisplay/zscale.py?rev=19347\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 less than ``min_npixels`` pixels are rejected, then the\n        returned values are the minimum and maximum of the data.\n        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 niter 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        slope, intercept = fit\n\n        if ngoodpix >= minpix:\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":"null","endLoc":224,"header":"def __init__(self, nsamples=1000, contrast=0.25, max_reject=0.5,\n                 min_npixels=5, krej=2.5, max_iterations=5)","id":12645,"name":"__init__","nodeType":"Function","startLoc":217,"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":284,"header":"def get_limits(self, values)","id":12646,"name":"get_limits","nodeType":"Function","startLoc":226,"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 niter 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        slope, intercept = fit\n\n        if ngoodpix >= minpix:\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"},{"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":118,"id":12647,"nodeType":"Class","startLoc":100,"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    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.sqrt(values, out=values)\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":113,"header":"def __call__(self, values, clip=True, out=None)","id":12648,"name":"__call__","nodeType":"Function","startLoc":110,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.sqrt(values, out=values)\n        return values"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":118,"header":"@property\n    def inverse(self)","id":12649,"name":"inverse","nodeType":"Function","startLoc":115,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(2)"},{"col":4,"comment":"null","endLoc":34,"header":"def __init__(self, transform_1, transform_2)","id":12650,"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":0,"comment":"null","endLoc":192,"header":"@frame_transform_graph.transform(AffineTransform, Galactic, GalacticLSR)\ndef galactic_to_galacticlsr(galactic_coord, lsr_frame)","id":12651,"name":"galactic_to_galacticlsr","nodeType":"Function","startLoc":187,"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":4,"comment":"null","endLoc":178,"header":"def __init__(self, percentile, n_samples=None)","id":12652,"name":"__init__","nodeType":"Function","startLoc":174,"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)"},{"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":12653,"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 CompositeTransform(self.transform_2.inverse,\n                                  self.transform_1.inverse)"},{"col":4,"comment":"null","endLoc":37,"header":"def __call__(self, values, clip=True)","id":12654,"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)"},{"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 : `~numpy.ndarray`, optional\n        An image used to calculate some parameters of some mappings.\n    ","endLoc":175,"id":12655,"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 : `~numpy.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 : `~numpy.ndarray`\n            Image to map to red.\n        image_g : `~numpy.ndarray`\n            Image to map to green.\n        image_b : `~numpy.ndarray`\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : `~numpy.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 : `~numpy.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 : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to green.\n        image_b : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : `~numpy.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 : `~numpy.ndarray`\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : `~numpy.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            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":12656,"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)"},{"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).\n    ","endLoc":148,"id":12657,"nodeType":"Class","startLoc":121,"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).\n    \"\"\"\n\n    def __init__(self, a):\n        super().__init__()\n        self.power = a\n\n    def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(values, self.power, out=values)\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":138,"header":"def __init__(self, a)","id":12658,"name":"__init__","nodeType":"Function","startLoc":136,"text":"def __init__(self, a):\n        super().__init__()\n        self.power = a"},{"col":4,"comment":"null","endLoc":143,"header":"def __call__(self, values, clip=True, out=None)","id":12659,"name":"__call__","nodeType":"Function","startLoc":140,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\n        np.power(values, self.power, out=values)\n        return values"},{"col":4,"comment":"null","endLoc":42,"header":"@property\n    def inverse(self)","id":12660,"name":"inverse","nodeType":"Function","startLoc":39,"text":"@property\n    def inverse(self):\n        return CompositeTransform(self.transform_2.inverse,\n                                  self.transform_1.inverse)"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":148,"header":"@property\n    def inverse(self)","id":12661,"name":"inverse","nodeType":"Function","startLoc":145,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return PowerStretch(1. / self.power)"},{"attributeType":"BaseTransform","col":8,"comment":"null","endLoc":34,"id":12662,"name":"transform_2","nodeType":"Attribute","startLoc":34,"text":"self.transform_2"},{"attributeType":"BaseTransform","col":8,"comment":"null","endLoc":33,"id":12663,"name":"transform_1","nodeType":"Attribute","startLoc":33,"text":"self.transform_1"},{"attributeType":"null","col":0,"comment":"null","endLoc":5,"id":12664,"name":"__all__","nodeType":"Attribute","startLoc":5,"text":"__all__"},{"col":0,"comment":"","endLoc":5,"header":"transform.py#<anonymous>","id":12665,"name":"<anonymous>","nodeType":"Function","startLoc":5,"text":"__all__ = ['BaseTransform', 'CompositeTransform']"},{"attributeType":"null","col":8,"comment":"null","endLoc":138,"id":12666,"name":"power","nodeType":"Attribute","startLoc":138,"text":"self.power"},{"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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    ","endLoc":183,"id":12667,"nodeType":"Class","startLoc":151,"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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a 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)"},{"fileName":"units.py","filePath":"astropy/visualization","id":12668,"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 .. import units as u\n\n    from matplotlib import units\n    from matplotlib import ticker\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 '{0}π'.format(n / 2)\n        else:\n            return '{0}π/2'.format(n)\n\n    class MplQuantityConverter(units.ConversionInterface):\n        def __init__(self):\n            if u.Quantity not in units.registry:\n                units.registry[u.Quantity] = self\n                self._remove = True\n            else:\n                self._remove = False\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            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            if self._remove:\n                del units.registry[u.Quantity]\n\n    return MplQuantityConverter()\n"},{"col":0,"comment":"null","endLoc":200,"header":"@frame_transform_graph.transform(AffineTransform, GalacticLSR, Galactic)\ndef galacticlsr_to_galactic(lsr_coord, galactic_frame)","id":12669,"name":"galacticlsr_to_galactic","nodeType":"Function","startLoc":195,"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"},{"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.  Default is 1000.\n    ","endLoc":271,"id":12670,"nodeType":"Class","startLoc":241,"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.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\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, 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        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":171,"header":"def __init__(self, a=1000.0)","id":12671,"name":"__init__","nodeType":"Function","startLoc":167,"text":"def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a cannot be set to 1\")\n        super().__init__()\n        self.exp = a"},{"col":4,"comment":"null","endLoc":258,"header":"def __init__(self, a=1000.0)","id":12672,"name":"__init__","nodeType":"Function","startLoc":256,"text":"def __init__(self, a=1000.0):\n        super().__init__()\n        self.exp = a"},{"col":4,"comment":"null","endLoc":266,"header":"def __call__(self, values, clip=True, out=None)","id":12673,"name":"__call__","nodeType":"Function","startLoc":260,"text":"def __call__(self, values, clip=True, out=None):\n        values = _prepare(values, clip=clip, out=out)\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        return values"},{"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":99,"header":"def quantity_support(format='latex_inline')","id":12674,"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 .. import units as u\n\n    from matplotlib import units\n    from matplotlib import ticker\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 '{0}π'.format(n / 2)\n        else:\n            return '{0}π/2'.format(n)\n\n    class MplQuantityConverter(units.ConversionInterface):\n        def __init__(self):\n            if u.Quantity not in units.registry:\n                units.registry[u.Quantity] = self\n                self._remove = True\n            else:\n                self._remove = False\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            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            if self._remove:\n                del units.registry[u.Quantity]\n\n    return MplQuantityConverter()"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":271,"header":"@property\n    def inverse(self)","id":12675,"name":"inverse","nodeType":"Function","startLoc":268,"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":178,"header":"def __call__(self, values, clip=True, out=None)","id":12676,"name":"__call__","nodeType":"Function","startLoc":173,"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":4,"comment":"null","endLoc":291,"header":"def __init__(self, a)","id":12677,"name":"__init__","nodeType":"Function","startLoc":289,"text":"def __init__(self, a):\n        super().__init__()\n        self.exp = a"},{"attributeType":"null","col":8,"comment":"null","endLoc":258,"id":12678,"name":"exp","nodeType":"Attribute","startLoc":258,"text":"self.exp"},{"attributeType":"null","col":25,"comment":"null","endLoc":4,"id":12679,"name":"u","nodeType":"Attribute","startLoc":4,"text":"u"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":183,"header":"@property\n    def inverse(self)","id":12680,"name":"inverse","nodeType":"Function","startLoc":180,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return InvertedPowerDistStretch(a=self.exp)"},{"attributeType":"null","col":33,"comment":"null","endLoc":6,"id":12681,"name":"r","nodeType":"Attribute","startLoc":6,"text":"r"},{"attributeType":"Time","col":0,"comment":"null","endLoc":17,"id":12682,"name":"J2000","nodeType":"Attribute","startLoc":17,"text":"J2000"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":19,"id":12683,"name":"v_bary_Schoenrich2010","nodeType":"Attribute","startLoc":19,"text":"v_bary_Schoenrich2010"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":12684,"name":"__all__","nodeType":"Attribute","startLoc":21,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":62,"id":12685,"name":"__doc__","nodeType":"Attribute","startLoc":62,"text":"LSR.__doc__"},{"col":0,"comment":"","endLoc":4,"header":"lsr.py#<anonymous>","id":12686,"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']\n\nLSR.__doc__ = LSR.__doc__.format(params=_base_radec_docstring)"},{"col":4,"comment":"null","endLoc":207,"header":"def __init__(self, a=1000.0)","id":12687,"name":"__init__","nodeType":"Function","startLoc":203,"text":"def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a cannot be set to 1\")\n        super().__init__()\n        self.exp = a"},{"attributeType":"null","col":8,"comment":"null","endLoc":171,"id":12688,"name":"exp","nodeType":"Attribute","startLoc":171,"text":"self.exp"},{"attributeType":"null","col":8,"comment":"null","endLoc":224,"id":12689,"name":"max_iterations","nodeType":"Attribute","startLoc":224,"text":"self.max_iterations"},{"id":12690,"name":"astropy/visualization/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/visualization/tests","id":12691,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    ","endLoc":219,"id":12692,"nodeType":"Class","startLoc":186,"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.  Default is 1000.\n        ``a`` cannot be set to 1.\n    \"\"\"\n\n    def __init__(self, a=1000.0):\n        if a == 1:  # singularity\n            raise ValueError(\"a 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)"},{"col":4,"comment":"null","endLoc":214,"header":"def __call__(self, values, clip=True, out=None)","id":12693,"name":"__call__","nodeType":"Function","startLoc":209,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":219,"id":12694,"name":"nsamples","nodeType":"Attribute","startLoc":219,"text":"self.nsamples"},{"col":0,"comment":"Calculate the log base n of x.","endLoc":28,"header":"def _logn(n, x, out=None)","id":12695,"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"},{"id":12696,"name":"astropy/visualization/scripts","nodeType":"Package"},{"fileName":"fits2bitmap.py","filePath":"astropy/visualization/scripts","id":12697,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport os\nfrom distutils.version import LooseVersion\n\nfrom ..mpl_normalize import simple_norm\nfrom ... import log\nfrom ...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('data in FITS extension {0} is not a 2D array'\n                     .format(ext))\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    # need to explicitly define the output format due to a bug in\n    # matplotlib (<= 2.1), otherwise the format will always be PNG\n    out_format = os.path.splitext(out_fn)[1][1:]\n\n    # workaround for matplotlib 2.0.0 bug where png images are inverted\n    # (mpl-#7656)\n    if (out_format.lower() == 'png' and\n            LooseVersion(matplotlib.__version__) == LooseVersion('2.0.0')):\n        image = image[::-1]\n\n    if cmap not in cm.datad:\n        log.critical('{0} is not a valid matplotlib colormap name.'\n                     .format(cmap))\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('Saved file to {0}.'.format(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"},{"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.  Must be in the range between 0 and 1.\n        Default is 0.1\n    ","endLoc":340,"id":12698,"nodeType":"Class","startLoc":307,"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.  Must be in the range between 0 and 1.\n        Default is 0.1\n    \"\"\"\n\n    def __init__(self, a=0.1):\n        super().__init__()\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":328,"header":"def __init__(self, a=0.1)","id":12699,"name":"__init__","nodeType":"Function","startLoc":326,"text":"def __init__(self, a=0.1):\n        super().__init__()\n        self.a = a"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":219,"header":"@property\n    def inverse(self)","id":12700,"name":"inverse","nodeType":"Function","startLoc":216,"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":335,"header":"def __call__(self, values, clip=True, out=None)","id":12701,"name":"__call__","nodeType":"Function","startLoc":330,"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":4,"comment":"A stretch object that performs the inverse operation.","endLoc":340,"header":"@property\n    def inverse(self)","id":12702,"name":"inverse","nodeType":"Function","startLoc":337,"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))"},{"attributeType":"null","col":0,"comment":"null","endLoc":7,"id":12704,"name":"__doctest_skip__","nodeType":"Attribute","startLoc":7,"text":"__doctest_skip__"},{"attributeType":"null","col":8,"comment":"null","endLoc":207,"id":12705,"name":"exp","nodeType":"Attribute","startLoc":207,"text":"self.exp"},{"col":0,"comment":"","endLoc":4,"header":"units.py#<anonymous>","id":12706,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__doctest_skip__ = ['quantity_support']"},{"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 : `~numpy.ndarray`\n            Image to map to red.\n        image_g : `~numpy.ndarray`\n            Image to map to green.\n        image_b : `~numpy.ndarray`\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : `~numpy.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":12707,"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 : `~numpy.ndarray`\n            Image to map to red.\n        image_g : `~numpy.ndarray`\n            Image to map to green.\n        image_b : `~numpy.ndarray`\n            Image to map to blue.\n\n        Returns\n        -------\n        RGBimage : `~numpy.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)"},{"fileName":"__init__.py","filePath":"astropy/visualization/scripts","id":12708,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"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":238,"id":12709,"nodeType":"Class","startLoc":222,"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()"},{"col":4,"comment":"null","endLoc":233,"header":"def __init__(self)","id":12710,"name":"__init__","nodeType":"Function","startLoc":232,"text":"def __init__(self):\n        super().__init__(2)"},{"id":12711,"name":"astropy/visualization/scripts/tests","nodeType":"Package"},{"fileName":"__init__.py","filePath":"astropy/visualization/scripts/tests","id":12712,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n"},{"id":12713,"name":"astropy/visualization/wcsaxes","nodeType":"Package"},{"fileName":"ticks.py","filePath":"astropy/visualization/wcsaxes","id":12714,"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, 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.color`\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_tick_out(rcParams.get('xtick.direction', 'in') == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         # For the linewidth we need to set a default since old versions of\n                         # matplotlib don't have this.\n                         'linewidth': rcParams.get('xtick.major.width', 1)}\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_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\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 = offset * 0.5  # for 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        gc.restore()\n"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":238,"header":"@property\n    def inverse(self)","id":12715,"name":"inverse","nodeType":"Function","startLoc":235,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return SqrtStretch()"},{"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} (a + 1) -1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  Default is 1000.\n    ","endLoc":304,"id":12716,"nodeType":"Class","startLoc":274,"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} (a + 1) -1}{a}\n\n    Parameters\n    ----------\n    a : float, optional\n        The ``a`` parameter used in the above formula.  Default is 1000.\n    \"\"\"\n\n    def __init__(self, a):\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, 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":299,"header":"def __call__(self, values, clip=True, out=None)","id":12717,"name":"__call__","nodeType":"Function","startLoc":293,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":221,"id":12718,"name":"max_reject","nodeType":"Attribute","startLoc":221,"text":"self.max_reject"},{"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 : `~numpy.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` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\n\n    Returns\n    -------\n    result : `ImageNormalize` instance\n        An `ImageNormalize` instance that can be used for displaying\n        images with Matplotlib.\n    ","endLoc":233,"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=True)","id":12719,"name":"simple_norm","nodeType":"Function","startLoc":136,"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=True):\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 : `~numpy.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` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\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()\n    elif stretch == 'asinh':\n        stretch = AsinhStretch(asinh_a)\n    else:\n        raise ValueError('Unknown stretch: {0}.'.format(stretch))\n\n    vmin, vmax = interval.get_limits(data)\n\n    return ImageNormalize(vmin=vmin, vmax=vmax, stretch=stretch, clip=clip)"},{"attributeType":"null","col":8,"comment":"null","endLoc":220,"id":12720,"name":"contrast","nodeType":"Attribute","startLoc":220,"text":"self.contrast"},{"attributeType":"null","col":8,"comment":"null","endLoc":222,"id":12721,"name":"min_npixels","nodeType":"Attribute","startLoc":222,"text":"self.min_npixels"},{"col":4,"comment":"null","endLoc":360,"header":"def __init__(self, a=1./3.)","id":12722,"name":"__init__","nodeType":"Function","startLoc":358,"text":"def __init__(self, a=1./3.):\n        super().__init__()\n        self.a = a"},{"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.color`\n    ","endLoc":180,"id":12723,"nodeType":"Class","startLoc":11,"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.color`\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_tick_out(rcParams.get('xtick.direction', 'in') == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         # For the linewidth we need to set a default since old versions of\n                         # matplotlib don't have this.\n                         'linewidth': rcParams.get('xtick.major.width', 1)}\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_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\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 = offset * 0.5  # for 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        gc.restore()"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":304,"header":"@property\n    def inverse(self)","id":12724,"name":"inverse","nodeType":"Function","startLoc":301,"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":223,"id":12725,"name":"krej","nodeType":"Attribute","startLoc":223,"text":"self.krej"},{"attributeType":"null","col":8,"comment":"null","endLoc":328,"id":12726,"name":"a","nodeType":"Attribute","startLoc":328,"text":"self.a"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":12727,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":16,"id":12728,"name":"__all__","nodeType":"Attribute","startLoc":16,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"interval.py#<anonymous>","id":12729,"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":"frame.py","filePath":"astropy/visualization/wcsaxes","id":12730,"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.lines import Line2D, Path\nfrom matplotlib.patches import PathPatch\n\n__all__ = ['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            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\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    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 = 1\n        self._color = 'black'\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = Spine(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='white', 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] = Spine(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, data[:, 0]),\n                                          np.interp(p_new, p, data[:, 1])]).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 : string\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 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":47,"header":"def __init__(self, ticksize=None, tick_out=None, **kwargs)","id":12731,"name":"__init__","nodeType":"Function","startLoc":34,"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_tick_out(rcParams.get('xtick.direction', 'in') == 'out')\n        self.clear()\n        line2d_kwargs = {'color': rcParams['xtick.color'],\n                         # For the linewidth we need to set a default since old versions of\n                         # matplotlib don't have this.\n                         'linewidth': rcParams.get('xtick.major.width', 1)}\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"},{"className":"Normalize","col":8,"comment":"null","endLoc":22,"id":12732,"nodeType":"Class","startLoc":21,"text":"class Normalize(Normalize, object):\n            pass"},{"col":4,"comment":"Use the mapping to convert images image_r, image_g, and image_b to a triplet of uint8 images","endLoc":175,"header":"def _convert_images_to_uint8(self, image_r, image_g, image_b)","id":12733,"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            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 : `~numpy.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 : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to green.\n        image_b : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : `~numpy.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":12734,"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 : `~numpy.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 : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to green.\n        image_b : `~numpy.ndarray`, optional\n            Intensity of image to be mapped to blue.\n\n        Returns\n        -------\n        intensity : `~numpy.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)"},{"className":"Normalize","col":4,"comment":"null","endLoc":27,"id":12735,"nodeType":"Class","startLoc":24,"text":"class Normalize:\n        def __init__(self, *args, **kwargs):\n            raise ImportError('matplotlib is required in order to use this '\n                              'class.')"},{"attributeType":"null","col":8,"comment":"null","endLoc":291,"id":12736,"name":"exp","nodeType":"Attribute","startLoc":291,"text":"self.exp"},{"col":8,"comment":"null","endLoc":27,"header":"def __init__(self, *args, **kwargs)","id":12737,"name":"__init__","nodeType":"Function","startLoc":25,"text":"def __init__(self, *args, **kwargs):\n            raise ImportError('matplotlib is required in order to use this '\n                              'class.')"},{"col":0,"comment":"\n    Return a naive total intensity from the red, blue, and green intensities.\n\n    Parameters\n    ----------\n    image_r : `~numpy.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 : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to green.\n    image_b : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : `~numpy.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":12738,"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 : `~numpy.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 : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to green.\n    image_b : `~numpy.ndarray`, optional\n        Intensity of image to be mapped to blue.\n\n    Returns\n    -------\n    intensity : `~numpy.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)"},{"className":"ImageNormalize","col":0,"comment":"\n    Normalization class to be used with Matplotlib.\n\n    Parameters\n    ----------\n    data : `~numpy.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\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, optional\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\n    ","endLoc":133,"id":12739,"nodeType":"Class","startLoc":35,"text":"class ImageNormalize(Normalize):\n    \"\"\"\n    Normalization class to be used with Matplotlib.\n\n    Parameters\n    ----------\n    data : `~numpy.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\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, optional\n        The stretch object to apply to the data.  The default is\n        `~astropy.visualization.LinearStretch`.\n    clip : bool, optional\n        If `True` (default), data values outside the [0:1] range are\n        clipped to the [0:1] range.\n    \"\"\"\n\n    def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False):\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        if data is not None and interval is not None:\n            _vmin, _vmax = 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        if stretch is not None and 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\n    def __call__(self, values, clip=None):\n        if clip is None:\n            clip = self.clip\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        # Set default values for vmin and vmax if not specified\n        self.autoscale_None(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 self.clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\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):\n        # Find unstretched values in range 0 to 1\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"},{"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 : `~numpy.ndarray`\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : `~numpy.ndarray`\n            ``I`` mapped to uint8\n        ","endLoc":144,"header":"def map_intensity_to_uint8(self, I)","id":12740,"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 : `~numpy.ndarray`\n            Intensity to be mapped.\n\n        Returns\n        -------\n        mapped_I : `~numpy.ndarray`\n            ``I`` mapped to uint8\n        \"\"\"\n        with np.errstate(invalid='ignore', divide='ignore'):\n            return np.clip(I, 0, self._uint8Max)"},{"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":85,"id":12741,"nodeType":"Class","startLoc":16,"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            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))"},{"col":4,"comment":"null","endLoc":31,"header":"def __init__(self, parent_axes, transform)","id":12742,"name":"__init__","nodeType":"Function","startLoc":24,"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":35,"header":"@property\n    def data(self)","id":12743,"name":"data","nodeType":"Function","startLoc":33,"text":"@property\n    def data(self):\n        return self._data"},{"col":4,"comment":"null","endLoc":47,"header":"@data.setter\n    def data(self, value)","id":12744,"name":"data","nodeType":"Function","startLoc":37,"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            self._world = self.transform.transform(self._data)\n            self._update_normal()"},{"col":4,"comment":"null","endLoc":89,"header":"def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False)","id":12745,"name":"__init__","nodeType":"Function","startLoc":64,"text":"def __init__(self, data=None, interval=None, vmin=None, vmax=None,\n                 stretch=LinearStretch(), clip=False):\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        if data is not None and interval is not None:\n            _vmin, _vmax = 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        if stretch is not None and 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":62,"id":12746,"name":"_uint8Max","nodeType":"Attribute","startLoc":62,"text":"self._uint8Max"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":12747,"name":"_image","nodeType":"Attribute","startLoc":72,"text":"self._image"},{"attributeType":"null","col":8,"comment":"null","endLoc":71,"id":12748,"name":"minimum","nodeType":"Attribute","startLoc":71,"text":"self.minimum"},{"col":4,"comment":"null","endLoc":126,"header":"def __call__(self, values, clip=None)","id":12749,"name":"__call__","nodeType":"Function","startLoc":91,"text":"def __call__(self, values, clip=None):\n        if clip is None:\n            clip = self.clip\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        # Set default values for vmin and vmax if not specified\n        self.autoscale_None(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 self.clip:\n            values = np.clip(values, 0., 1., out=values)\n\n        # Stretch values\n        values = self.stretch(values, out=values, clip=False)\n\n        # Convert to masked array for matplotlib\n        return ma.array(values, mask=mask)"},{"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.  Default is 1/3.\n    ","endLoc":372,"id":12750,"nodeType":"Class","startLoc":343,"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.  Default is 1/3.\n    \"\"\"\n\n    def __init__(self, a=1./3.):\n        super().__init__()\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":367,"header":"def __call__(self, values, clip=True, out=None)","id":12751,"name":"__call__","nodeType":"Function","startLoc":362,"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"},{"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":216,"id":12752,"nodeType":"Class","startLoc":178,"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":211,"header":"def __init__(self, minimum=None, maximum=None, image=None)","id":12753,"name":"__init__","nodeType":"Function","startLoc":193,"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)"},{"col":4,"comment":"null","endLoc":85,"header":"def _update_normal(self)","id":12754,"name":"_update_normal","nodeType":"Function","startLoc":81,"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))"},{"col":4,"comment":"null","endLoc":51,"header":"@property\n    def pixel(self)","id":12755,"name":"pixel","nodeType":"Function","startLoc":49,"text":"@property\n    def pixel(self):\n        return self._pixel"},{"col":4,"comment":"null","endLoc":63,"header":"@pixel.setter\n    def pixel(self, value)","id":12756,"name":"pixel","nodeType":"Function","startLoc":53,"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":"A stretch object that performs the inverse operation.","endLoc":372,"header":"@property\n    def inverse(self)","id":12757,"name":"inverse","nodeType":"Function","startLoc":369,"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":360,"id":12758,"name":"a","nodeType":"Attribute","startLoc":360,"text":"self.a"},{"col":4,"comment":"\n        set length of the ticks in points.\n        ","endLoc":71,"header":"def set_ticksize(self, ticksize)","id":12759,"name":"set_ticksize","nodeType":"Function","startLoc":67,"text":"def set_ticksize(self, ticksize):\n        \"\"\"\n        set length of the ticks in points.\n        \"\"\"\n        self._ticksize = ticksize"},{"col":4,"comment":"null","endLoc":67,"header":"@property\n    def world(self)","id":12760,"name":"world","nodeType":"Function","startLoc":65,"text":"@property\n    def world(self):\n        return self._world"},{"col":4,"comment":"null","endLoc":79,"header":"@world.setter\n    def world(self, value)","id":12761,"name":"world","nodeType":"Function","startLoc":69,"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":"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":410,"id":12762,"nodeType":"Class","startLoc":375,"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\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\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":400,"header":"def __init__(self, data, values=None)","id":12763,"name":"__init__","nodeType":"Function","startLoc":388,"text":"def __init__(self, data, values=None):\n\n        # Assume data is not necessarily normalized at this point\n        self.data = np.sort(data.ravel())\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        set True if tick need to be rotated by 180 degree.\n        ","endLoc":59,"header":"def set_tick_out(self, tick_out)","id":12764,"name":"set_tick_out","nodeType":"Function","startLoc":55,"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":96,"header":"def clear(self)","id":12765,"name":"clear","nodeType":"Function","startLoc":88,"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 = {}"},{"attributeType":"null","col":8,"comment":"null","endLoc":26,"id":12766,"name":"parent_axes","nodeType":"Attribute","startLoc":26,"text":"self.parent_axes"},{"attributeType":"None","col":12,"comment":"null","endLoc":40,"id":12767,"name":"_data","nodeType":"Attribute","startLoc":40,"text":"self._data"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":12768,"name":"transform","nodeType":"Attribute","startLoc":27,"text":"self.transform"},{"attributeType":"None","col":8,"comment":"null","endLoc":31,"id":12769,"name":"world","nodeType":"Attribute","startLoc":31,"text":"self.world"},{"attributeType":"None","col":8,"comment":"null","endLoc":29,"id":12770,"name":"data","nodeType":"Attribute","startLoc":29,"text":"self.data"},{"attributeType":"null","col":8,"comment":"null","endLoc":85,"id":12771,"name":"normal_angle","nodeType":"Attribute","startLoc":85,"text":"self.normal_angle"},{"attributeType":"None","col":8,"comment":"null","endLoc":30,"id":12772,"name":"pixel","nodeType":"Attribute","startLoc":30,"text":"self.pixel"},{"attributeType":"None","col":12,"comment":"null","endLoc":42,"id":12773,"name":"_world","nodeType":"Attribute","startLoc":42,"text":"self._world"},{"attributeType":"None","col":12,"comment":"null","endLoc":41,"id":12774,"name":"_pixel","nodeType":"Attribute","startLoc":41,"text":"self._pixel"},{"className":"BaseFrame","col":0,"comment":"\n    Base class for frames, which are collections of\n    :class:`~astropy.visualization.wcsaxes.frame.Spine` instances.\n    ","endLoc":195,"id":12775,"nodeType":"Class","startLoc":88,"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    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 = 1\n        self._color = 'black'\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = Spine(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='white', 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] = Spine(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, data[:, 0]),\n                                          np.interp(p_new, p, data[:, 1])]).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 : string\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":216,"header":"def map_intensity_to_uint8(self, I)","id":12776,"name":"map_intensity_to_uint8","nodeType":"Function","startLoc":213,"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))"},{"col":4,"comment":"null","endLoc":105,"header":"def __init__(self, parent_axes, transform, path=None)","id":12777,"name":"__init__","nodeType":"Function","startLoc":94,"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 = 1\n        self._color = 'black'\n        self._path = path\n\n        for axis in self.spine_names:\n            self[axis] = Spine(parent_axes, transform)"},{"attributeType":"null","col":8,"comment":"null","endLoc":204,"id":12778,"name":"maximum","nodeType":"Attribute","startLoc":204,"text":"self.maximum"},{"col":4,"comment":"null","endLoc":110,"header":"@property\n    def origin(self)","id":12779,"name":"origin","nodeType":"Function","startLoc":107,"text":"@property\n    def origin(self):\n        ymin, ymax = self.parent_axes.get_ylim()\n        return 'lower' if ymin < ymax else 'upper'"},{"col":4,"comment":"null","endLoc":80,"header":"def set_visible_axes(self, visible_axes)","id":12780,"name":"set_visible_axes","nodeType":"Function","startLoc":79,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes"},{"col":4,"comment":"null","endLoc":50,"header":"def display_minor_ticks(self, display_minor_ticks)","id":12781,"name":"display_minor_ticks","nodeType":"Function","startLoc":49,"text":"def display_minor_ticks(self, display_minor_ticks):\n        self._display_minor_ticks = display_minor_ticks"},{"col":4,"comment":"null","endLoc":53,"header":"def get_display_minor_ticks(self)","id":12782,"name":"get_display_minor_ticks","nodeType":"Function","startLoc":52,"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":65,"header":"def get_tick_out(self)","id":12783,"name":"get_tick_out","nodeType":"Function","startLoc":61,"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":77,"header":"def get_ticksize(self)","id":12784,"name":"get_ticksize","nodeType":"Function","startLoc":73,"text":"def get_ticksize(self):\n        \"\"\"\n        Return length of the ticks in points.\n        \"\"\"\n        return self._ticksize"},{"col":4,"comment":"null","endLoc":86,"header":"def get_visible_axes(self)","id":12785,"name":"get_visible_axes","nodeType":"Function","startLoc":82,"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]"},{"attributeType":"null","col":12,"comment":"null","endLoc":211,"id":12786,"name":"_range","nodeType":"Attribute","startLoc":211,"text":"self._range"},{"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 http://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":258,"id":12787,"nodeType":"Class","startLoc":219,"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 http://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":254,"header":"def __init__(self, minimum, stretch, Q=8)","id":12788,"name":"__init__","nodeType":"Function","startLoc":240,"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":"null","endLoc":114,"header":"@property\n    def transform(self)","id":12789,"name":"transform","nodeType":"Function","startLoc":112,"text":"@property\n    def transform(self):\n        return self._transform"},{"col":4,"comment":"null","endLoc":120,"header":"@transform.setter\n    def transform(self, value)","id":12790,"name":"transform","nodeType":"Function","startLoc":116,"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":134,"header":"def _update_patch_path(self)","id":12791,"name":"_update_patch_path","nodeType":"Function","startLoc":122,"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"},{"col":4,"comment":"null","endLoc":405,"header":"def __call__(self, values, clip=True, out=None)","id":12792,"name":"__call__","nodeType":"Function","startLoc":402,"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":258,"header":"def map_intensity_to_uint8(self, I)","id":12793,"name":"map_intensity_to_uint8","nodeType":"Function","startLoc":256,"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)"},{"col":4,"comment":"null","endLoc":195,"header":"@abc.abstractmethod\n    def update_spines(self)","id":12794,"name":"update_spines","nodeType":"Function","startLoc":193,"text":"@abc.abstractmethod\n    def update_spines(self):\n        raise NotImplementedError(\"\")"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":410,"header":"@property\n    def inverse(self)","id":12795,"name":"inverse","nodeType":"Function","startLoc":407,"text":"@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":133,"header":"def inverse(self, values)","id":12796,"name":"inverse","nodeType":"Function","startLoc":128,"text":"def inverse(self, values):\n        # Find unstretched values in range 0 to 1\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":254,"id":12797,"name":"_soften","nodeType":"Attribute","startLoc":254,"text":"self._soften"},{"col":4,"comment":"null","endLoc":140,"header":"@property\n    def patch(self)","id":12798,"name":"patch","nodeType":"Function","startLoc":136,"text":"@property\n    def patch(self):\n        self._update_patch_path()\n        return PathPatch(self._path, transform=self.parent_axes.transData,\n                         facecolor='white', edgecolor='white')"},{"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":118,"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":12799,"name":"fits2bitmap","nodeType":"Function","startLoc":11,"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('data in FITS extension {0} is not a 2D array'\n                     .format(ext))\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    # need to explicitly define the output format due to a bug in\n    # matplotlib (<= 2.1), otherwise the format will always be PNG\n    out_format = os.path.splitext(out_fn)[1][1:]\n\n    # workaround for matplotlib 2.0.0 bug where png images are inverted\n    # (mpl-#7656)\n    if (out_format.lower() == 'png' and\n            LooseVersion(matplotlib.__version__) == LooseVersion('2.0.0')):\n        image = image[::-1]\n\n    if cmap not in cm.datad:\n        log.critical('{0} is not a valid matplotlib colormap name.'\n                     .format(cmap))\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('Saved file to {0}.'.format(out_fn))"},{"attributeType":"null","col":8,"comment":"null","endLoc":252,"id":12800,"name":"_slope","nodeType":"Attribute","startLoc":252,"text":"self._slope"},{"col":4,"comment":"null","endLoc":146,"header":"def draw(self, renderer)","id":12801,"name":"draw","nodeType":"Function","startLoc":142,"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":431,"header":"def __init__(self, data, values=None)","id":12802,"name":"__init__","nodeType":"Function","startLoc":426,"text":"def __init__(self, data, values=None):\n        self.data = data\n        if values is None:\n            self.values = np.linspace(0., 1., len(self.data))\n        else:\n            self.values = values"},{"col":4,"comment":"null","endLoc":163,"header":"def sample(self, n_samples)","id":12803,"name":"sample","nodeType":"Function","startLoc":148,"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] = Spine(self.parent_axes, self.transform)\n            spines[axis].data = np.array([np.interp(p_new, p, data[:, 0]),\n                                          np.interp(p_new, p, data[:, 1])]).transpose()\n\n        return spines"},{"attributeType":"null","col":8,"comment":"null","endLoc":394,"id":12804,"name":"data","nodeType":"Attribute","startLoc":394,"text":"self.data"},{"attributeType":"BaseStretch","col":8,"comment":"null","endLoc":81,"id":12805,"name":"stretch","nodeType":"Attribute","startLoc":81,"text":"self.stretch"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":12806,"name":"inverse_stretch","nodeType":"Attribute","startLoc":88,"text":"self.inverse_stretch"},{"attributeType":"null","col":16,"comment":"null","endLoc":76,"id":12807,"name":"vmax","nodeType":"Attribute","startLoc":76,"text":"self.vmax"},{"col":4,"comment":"null","endLoc":108,"header":"def add(self, axis, world, pixel, angle, axis_displacement)","id":12808,"name":"add","nodeType":"Function","startLoc":98,"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)"},{"attributeType":"null","col":12,"comment":"null","endLoc":400,"id":12809,"name":"values","nodeType":"Attribute","startLoc":400,"text":"self.values"},{"col":4,"comment":"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : string\n            The color of the frame.\n        ","endLoc":174,"header":"def set_color(self, color)","id":12810,"name":"set_color","nodeType":"Function","startLoc":165,"text":"def set_color(self, color):\n        \"\"\"\n        Sets the color of the frame.\n\n        Parameters\n        ----------\n        color : string\n            The color of the frame.\n        \"\"\"\n        self._color = color"},{"col":4,"comment":"null","endLoc":177,"header":"def get_color(self)","id":12811,"name":"get_color","nodeType":"Function","startLoc":176,"text":"def get_color(self):\n        return self._color"},{"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":441,"id":12812,"nodeType":"Class","startLoc":413,"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\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":"\n        Sets the linewidth of the frame.\n\n        Parameters\n        ----------\n        linewidth : float\n            The linewidth of the frame in points.\n        ","endLoc":188,"header":"def set_linewidth(self, linewidth)","id":12813,"name":"set_linewidth","nodeType":"Function","startLoc":179,"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":191,"header":"def get_linewidth(self)","id":12814,"name":"get_linewidth","nodeType":"Function","startLoc":190,"text":"def get_linewidth(self):\n        return self._linewidth"},{"attributeType":"null","col":8,"comment":"null","endLoc":98,"id":12815,"name":"parent_axes","nodeType":"Attribute","startLoc":98,"text":"self.parent_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":99,"id":12816,"name":"_transform","nodeType":"Attribute","startLoc":99,"text":"self._transform"},{"col":4,"comment":"null","endLoc":436,"header":"def __call__(self, values, clip=True, out=None)","id":12817,"name":"__call__","nodeType":"Function","startLoc":433,"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":441,"header":"@property\n    def inverse(self)","id":12818,"name":"inverse","nodeType":"Function","startLoc":438,"text":"@property\n    def inverse(self):\n        \"\"\"A stretch object that performs the inverse operation.\"\"\"\n        return HistEqStretch(self.data, values=self.values)"},{"attributeType":"BaseInterval","col":8,"comment":"null","endLoc":86,"id":12819,"name":"interval","nodeType":"Attribute","startLoc":86,"text":"self.interval"},{"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 : `~numpy.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 : `~numpy.ndarray`, optional\n        the second image to analyse (must be specified with image3).\n    image3 : `~numpy.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":326,"id":12820,"nodeType":"Class","startLoc":261,"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 : `~numpy.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 : `~numpy.ndarray`, optional\n        the second image to analyse (must be specified with image3).\n    image3 : `~numpy.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"},{"attributeType":"null","col":8,"comment":"null","endLoc":427,"id":12821,"name":"data","nodeType":"Attribute","startLoc":427,"text":"self.data"},{"col":4,"comment":"\n        ","endLoc":326,"header":"def __init__(self, image1, image2=None, image3=None, Q=8, pedestal=None)","id":12822,"name":"__init__","nodeType":"Function","startLoc":287,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":431,"id":12823,"name":"values","nodeType":"Attribute","startLoc":431,"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":486,"id":12824,"nodeType":"Class","startLoc":444,"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":467,"header":"def __init__(self, contrast, bias)","id":12825,"name":"__init__","nodeType":"Function","startLoc":464,"text":"def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias"},{"col":4,"comment":"null","endLoc":481,"header":"def __call__(self, values, clip=True, out=None)","id":12826,"name":"__call__","nodeType":"Function","startLoc":469,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":100,"id":12827,"name":"_linewidth","nodeType":"Attribute","startLoc":100,"text":"self._linewidth"},{"col":4,"comment":"null","endLoc":111,"header":"def get_minor_world(self)","id":12828,"name":"get_minor_world","nodeType":"Function","startLoc":110,"text":"def get_minor_world(self):\n        return self.minor_world"},{"col":4,"comment":"null","endLoc":124,"header":"def add_minor(self, minor_axis, minor_world, minor_pixel, minor_angle,\n                  minor_axis_displacement)","id":12829,"name":"add_minor","nodeType":"Function","startLoc":113,"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":101,"id":12830,"name":"_color","nodeType":"Attribute","startLoc":101,"text":"self._color"},{"attributeType":"null","col":8,"comment":"null","endLoc":102,"id":12831,"name":"_path","nodeType":"Attribute","startLoc":102,"text":"self._path"},{"className":"RectangularFrame","col":0,"comment":"\n    A classic rectangular frame.\n    ","endLoc":213,"id":12832,"nodeType":"Class","startLoc":198,"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":213,"header":"def update_spines(self)","id":12833,"name":"update_spines","nodeType":"Function","startLoc":205,"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]))"},{"attributeType":"null","col":16,"comment":"null","endLoc":74,"id":12834,"name":"vmin","nodeType":"Attribute","startLoc":74,"text":"self.vmin"},{"col":4,"comment":"A stretch object that performs the inverse operation.","endLoc":486,"header":"@property\n    def inverse(self)","id":12835,"name":"inverse","nodeType":"Function","startLoc":483,"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":4,"comment":"null","endLoc":203,"id":12836,"name":"spine_names","nodeType":"Attribute","startLoc":203,"text":"spine_names"},{"className":"EllipticalFrame","col":0,"comment":"\n    An elliptical frame.\n    ","endLoc":263,"id":12837,"nodeType":"Class","startLoc":216,"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":240,"header":"def update_spines(self)","id":12838,"name":"update_spines","nodeType":"Function","startLoc":223,"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()"},{"col":4,"comment":"null","endLoc":127,"header":"def __len__(self)","id":12839,"name":"__len__","nodeType":"Function","startLoc":126,"text":"def __len__(self):\n        return len(self.world)"},{"col":4,"comment":"\n        Draw the ticks.\n        ","endLoc":143,"header":"def draw(self, renderer)","id":12840,"name":"draw","nodeType":"Function","startLoc":131,"text":"def draw(self, renderer):\n        \"\"\"\n        Draw the ticks.\n        \"\"\"\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 = offset * 0.5  # for minor ticksize\n            self._draw_ticks(renderer, self.minor_pixel, self.minor_angle, offset)"},{"col":4,"comment":"null","endLoc":507,"header":"def __init__(self, contrast, bias)","id":12841,"name":"__init__","nodeType":"Function","startLoc":504,"text":"def __init__(self, contrast, bias):\n        super().__init__()\n        self.contrast = contrast\n        self.bias = bias"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":12842,"name":"clip","nodeType":"Attribute","startLoc":89,"text":"self.clip"},{"attributeType":"null","col":16,"comment":"null","endLoc":7,"id":12843,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":30,"id":12844,"name":"__all__","nodeType":"Attribute","startLoc":30,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":32,"id":12845,"name":"__doctest_requires__","nodeType":"Attribute","startLoc":32,"text":"__doctest_requires__"},{"attributeType":"null","col":8,"comment":"null","endLoc":466,"id":12846,"name":"contrast","nodeType":"Attribute","startLoc":466,"text":"self.contrast"},{"col":0,"comment":"","endLoc":4,"header":"mpl_normalize.py#<anonymous>","id":12847,"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\n    # On older versions of matplotlib Normalize is an old-style class\n    if not isinstance(Normalize, type):\n        class Normalize(Normalize, object):\n            pass\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']\n\n__doctest_requires__ = {'*': ['matplotlib']}"},{"col":4,"comment":"Override path patch to include only the outer ellipse,\n        not the major and minor axes in the middle.","endLoc":252,"header":"def _update_patch_path(self)","id":12848,"name":"_update_patch_path","nodeType":"Function","startLoc":242,"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"},{"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":263,"header":"def draw(self, renderer)","id":12849,"name":"draw","nodeType":"Function","startLoc":254,"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":221,"id":12850,"name":"spine_names","nodeType":"Attribute","startLoc":221,"text":"spine_names"},{"attributeType":"null","col":12,"comment":"null","endLoc":250,"id":12851,"name":"_path","nodeType":"Attribute","startLoc":250,"text":"self._path"},{"col":0,"comment":"null","endLoc":172,"header":"def main(args=None)","id":12852,"name":"main","nodeType":"Function","startLoc":121,"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":"null","col":16,"comment":"null","endLoc":7,"id":12853,"name":"np","nodeType":"Attribute","startLoc":7,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":13,"id":12854,"name":"__all__","nodeType":"Attribute","startLoc":13,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"frame.py#<anonymous>","id":12855,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['Spine', 'BaseFrame', 'RectangularFrame', 'EllipticalFrame']"},{"fileName":"utils.py","filePath":"astropy/visualization/wcsaxes","id":12856,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom ... import units as u\nfrom ...coordinates import BaseCoordinateFrame\n\n# Modified from axis_artist, supports astropy.units\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(\"Unknown frame: {0}\".format(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 coord_type_from_ctype(ctype):\n    \"\"\"\n    Determine whether a particular WCS ctype corresponds to an angle or scalar\n    coordinate.\n    \"\"\"\n    if ctype[:4] in ['RA--'] or ctype[1:4] == 'LON':\n        return 'longitude', None\n    elif ctype[:4] in ['HPLN']:\n        return 'longitude', 180.\n    elif ctype[:4] in ['DEC-', 'HPLT'] or ctype[1:4] == 'LAT':\n        return 'latitude', None\n    else:\n        return 'scalar', None\n"},{"col":4,"comment":"\n        Draw the minor ticks.\n        ","endLoc":180,"header":"def _draw_ticks(self, renderer, pixel_array, angle_array, offset)","id":12857,"name":"_draw_ticks","nodeType":"Function","startLoc":145,"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        gc.restore()"},{"col":0,"comment":"null","endLoc":46,"header":"def select_step_degree(dv)","id":12858,"name":"select_step_degree","nodeType":"Function","startLoc":12,"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":8,"comment":"null","endLoc":467,"id":12859,"name":"bias","nodeType":"Attribute","startLoc":467,"text":"self.bias"},{"attributeType":"null","col":8,"comment":"null","endLoc":326,"id":12860,"name":"_image","nodeType":"Attribute","startLoc":326,"text":"self._image"},{"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":525,"id":12861,"nodeType":"Class","startLoc":489,"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)"},{"fileName":"patches.py","filePath":"astropy/visualization/wcsaxes","id":12862,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\nfrom matplotlib.patches import Polygon\n\nfrom ... import units as u\nfrom ...coordinates.representation import UnitSphericalRepresentation\nfrom ...coordinates.matrix_utilities import rotation_matrix, matrix_product\n\n\n__all__ = ['SphericalCircle']\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`\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    radius : `~astropy.units.Quantity`\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 tuple of two quantities, or\n        # a single 2-element Quantity.\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"},{"col":4,"comment":"null","endLoc":520,"header":"def __call__(self, values, clip=True, out=None)","id":12863,"name":"__call__","nodeType":"Function","startLoc":509,"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"},{"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`\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    radius : `~astropy.units.Quantity`\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":90,"id":12864,"nodeType":"Class","startLoc":40,"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`\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    radius : `~astropy.units.Quantity`\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 tuple of two quantities, or\n        # a single 2-element Quantity.\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":"A stretch object that performs the inverse operation.","endLoc":525,"header":"@property\n    def inverse(self)","id":12865,"name":"inverse","nodeType":"Function","startLoc":522,"text":"@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":90,"header":"def __init__(self, center, radius, resolution=100, vertex_unit=u.degree, **kwargs)","id":12866,"name":"__init__","nodeType":"Function","startLoc":71,"text":"def __init__(self, center, radius, 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 = 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":"\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-visualization-rgb`.\n\n    Parameters\n    ----------\n\n    image_r : `~numpy.ndarray`\n        Image to map to red.\n    image_g : `~numpy.ndarray`\n        Image to map to green.\n    image_b : `~numpy.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 : `~numpy.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":12867,"name":"make_lupton_rgb","nodeType":"Function","startLoc":329,"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-visualization-rgb`.\n\n    Parameters\n    ----------\n\n    image_r : `~numpy.ndarray`\n        Image to map to red.\n    image_g : `~numpy.ndarray`\n        Image to map to green.\n    image_b : `~numpy.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 : `~numpy.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"},{"attributeType":"null","col":8,"comment":"null","endLoc":506,"id":12868,"name":"contrast","nodeType":"Attribute","startLoc":506,"text":"self.contrast"},{"col":0,"comment":"null","endLoc":95,"header":"def select_step_scalar(dv)","id":12869,"name":"select_step_scalar","nodeType":"Function","startLoc":84,"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])"},{"attributeType":"null","col":8,"comment":"null","endLoc":507,"id":12870,"name":"bias","nodeType":"Attribute","startLoc":507,"text":"self.bias"},{"col":0,"comment":"null","endLoc":81,"header":"def select_step_hour(dv)","id":12871,"name":"select_step_hour","nodeType":"Function","startLoc":49,"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)"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":12872,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":15,"id":12873,"name":"__all__","nodeType":"Attribute","startLoc":15,"text":"__all__"},{"col":0,"comment":"","endLoc":6,"header":"stretch.py#<anonymous>","id":12874,"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\"]"},{"attributeType":"null","col":4,"comment":"null","endLoc":129,"id":12875,"name":"_tickvert_path","nodeType":"Attribute","startLoc":129,"text":"_tickvert_path"},{"attributeType":"null","col":16,"comment":"null","endLoc":10,"id":12876,"name":"np","nodeType":"Attribute","startLoc":10,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":12877,"name":"__all__","nodeType":"Attribute","startLoc":14,"text":"__all__"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":12878,"name":"minor_disp","nodeType":"Attribute","startLoc":96,"text":"self.minor_disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":12879,"name":"world","nodeType":"Attribute","startLoc":89,"text":"self.world"},{"col":0,"comment":"","endLoc":8,"header":"lupton_rgb.py#<anonymous>","id":12880,"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 : http://adsabs.harvard.edu/abs/2004PASP..116..133L\n\"\"\"\n\n__all__ = ['make_lupton_rgb']"},{"attributeType":"null","col":8,"comment":"null","endLoc":94,"id":12881,"name":"minor_pixel","nodeType":"Attribute","startLoc":94,"text":"self.minor_pixel"},{"attributeType":"null","col":8,"comment":"null","endLoc":80,"id":12882,"name":"_visible_axes","nodeType":"Attribute","startLoc":80,"text":"self._visible_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":93,"id":12883,"name":"minor_world","nodeType":"Attribute","startLoc":93,"text":"self.minor_world"},{"attributeType":"null","col":8,"comment":"null","endLoc":47,"id":12884,"name":"_display_minor_ticks","nodeType":"Attribute","startLoc":47,"text":"self._display_minor_ticks"},{"attributeType":"null","col":8,"comment":"null","endLoc":59,"id":12885,"name":"_tick_out","nodeType":"Attribute","startLoc":59,"text":"self._tick_out"},{"attributeType":"null","col":8,"comment":"null","endLoc":71,"id":12886,"name":"_ticksize","nodeType":"Attribute","startLoc":71,"text":"self._ticksize"},{"attributeType":"null","col":8,"comment":"null","endLoc":91,"id":12887,"name":"angle","nodeType":"Attribute","startLoc":91,"text":"self.angle"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":12888,"name":"pixel","nodeType":"Attribute","startLoc":90,"text":"self.pixel"},{"attributeType":"null","col":8,"comment":"null","endLoc":92,"id":12889,"name":"disp","nodeType":"Attribute","startLoc":92,"text":"self.disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":12890,"name":"minor_angle","nodeType":"Attribute","startLoc":95,"text":"self.minor_angle"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":12891,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"fileName":"coordinate_helpers.py","filePath":"astropy/visualization/wcsaxes","id":12892,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n\"\"\"\nThis file defines the classes used to represent a 'coordinate', which includes\naxes, ticks, tick labels, and grid lines.\n\"\"\"\n\nimport numpy as np\n\nfrom matplotlib.ticker import Formatter\nfrom matplotlib.transforms import Affine2D, ScaledTranslation\nfrom matplotlib.patches import PathPatch\nfrom matplotlib import rcParams\n\nfrom ... import units as u\n\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\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    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, coord_index=None,\n                 coord_type='scalar', coord_unit=None, coord_wrap=None, frame=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.frame = frame\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(False)\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        #\n        # Matplotlib's gridlines use Line2D, but ours use PathPatch.\n        # Patches take a slightly different format of linestyle argument.\n        lines_to_patches_linestyle = {'-': 'solid',\n                                      '--': 'dashed',\n                                      '-.': 'dashdot',\n                                      ':': 'dotted',\n                                      'none': 'none',\n                                      'None': 'none',\n                                      ' ': 'none',\n                                      '': 'none'}\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.get('grid.alpha', 1.0),\n                                  'transform': self.parent_axes.transData}\n\n    def grid(self, draw_grid=True, grid_type='lines', **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.\n        \"\"\"\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_unit_scale = 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_unit_scale = None\n            else:\n                self._coord_unit_scale = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator()\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 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):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\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_unit_scale is not None:\n                value *= self._coord_unit_scale\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)\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 : The separator between numbers in sexagesimal\n        representation. Can be either a string or a tuple.\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) or isinstance(separator, tuple):\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string or a tuple\")\n\n    def set_format_unit(self, unit):\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        \"\"\"\n        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._formatter_locator.format_unit = unit\n\n    def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, exclude_overlapping=False):\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\n            A valid Matplotlib color for the ticks\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\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        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, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        kwargs\n            Keyword arguments 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        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        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)\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_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    @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\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        renderer.open_group('ticks')\n\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox)\n\n        renderer.close_group('ticks')\n\n    def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox_list=ticklabels_bbox,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')\n\n    def _update_ticks(self):\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        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        # http://matplotlib.org/users/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            # 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            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            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            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_unit_scale is not None:\n                dx *= self._coord_unit_scale\n                dy *= self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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_unit_scale is not None:\n                w1 = w1 * self._coord_unit_scale\n                w2 = w2 * self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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, tick_angle, ticks='major'):\n        tick_world_coordinates_values = tick_world_coordinates.value\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\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                    world = wrap_angle_at(t, self.coord_wrap)\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(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        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.value\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        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        # Currently xy_world is in deg, but transform function needs it in\n        # native units\n        if self._coord_unit_scale is not None:\n            xy_world /= self._coord_unit_scale\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 _update_grid_contour(self):\n\n        if hasattr(self, '_grid'):\n            for line in self._grid.collections:\n                line.remove()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x, y, field = self.transform.get_coord_slices(xmin, xmax, ymin, ymax, 200, 200)\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        field = field[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            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            self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None\n"},{"col":0,"comment":"null","endLoc":119,"header":"def get_coord_meta(frame)","id":12893,"name":"get_coord_meta","nodeType":"Function","startLoc":98,"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(\"Unknown frame: {0}\".format(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"},{"fileName":"__init__.py","filePath":"astropy/visualization/wcsaxes","id":12894,"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 ... 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\nconf = Conf()\n"},{"fileName":"formatter_locator.py","filePath":"astropy/visualization/wcsaxes","id":12895,"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 ... import units as u\nfrom ...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\nclass BaseFormatterLocator:\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None):\n\n        if (values, number, spacing).count(None) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specifed\")\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        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    @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        self._unit = u.degree\n        self._sep = None\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)\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._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._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._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._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._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(\"Invalid format: {0}\".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._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._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).\n            if value_min == value_max:\n                return [] * u.deg, 0 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_deg = self.spacing.to_value(u.degree)\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 * u.degree\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_deg = self.base_spacing.to_value(u.degree)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self._unit is u.degree:\n                        from .utils import select_step_degree\n                        spacing_deg = select_step_degree(dv).to_value(u.degree)\n                    else:\n                        from .utils import select_step_hour\n                        spacing_deg = select_step_hour(dv).to_value(u.degree)\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_deg)\n            return values * spacing_deg * u.degree, spacing_deg * u.degree\n\n    def formatter(self, values, spacing):\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            if self.format is None:\n                spacing = spacing.to_value(u.arcsec)\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                decimal = False\n                unit = u.degree\n            else:\n                fields = self._fields\n                precision = self._precision\n                decimal = self._decimal\n                unit = self._unit\n\n            if decimal:\n                sep = None\n            elif self._sep is not None:\n                sep = self._sep\n            else:\n                if unit == u.degree:\n                    if rcParams['text.usetex']:\n                        deg = r'$^\\circ$'\n                    else:\n                        deg = '\\xb0'\n                    sep = (deg, \"'\", '\"')\n                else:\n                    sep = ('h', 'm', 's')\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep).tolist()\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, unit=None):\n        if unit is not None:\n            self._unit = unit\n            self._format_unit = unit\n        elif spacing is not None:\n            self._unit = spacing.unit\n            self._format_unit = spacing.unit\n        elif values is not None:\n            self._unit = values.unit\n            self._format_unit = values.unit\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)\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        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._format_unit = 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(\"Invalid format: {0}\".format(value))\n\n    @property\n    def base_spacing(self):\n        return self._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\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing.value:\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)\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):\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"},{"fileName":"ticklabels.py","filePath":"astropy/visualization/wcsaxes","id":12896,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\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.pad = 0.3\n        self._exclude_overlapping = False\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\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\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                    self.text[axis][i] = self.text[axis][i][start:]\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 set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping\n\n    def draw(self, renderer, bboxes, ticklabels_bbox):\n\n        if not self.get_visible():\n            return\n\n        self.simplify_labels()\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\n\n            for i in range(len(self.world[axis])):\n\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                self.set_text(self.text[axis][i])\n\n                x, y = self.pixel[axis][i]\n\n                if isinstance(self._frame, RectangularFrame):\n\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = - text_size * 0.5\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 * 1.5\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = text_size * 0.5\n                        dy = - text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = text_size * 0.2\n\n                    self.set_position((x + dx, y + dy))\n                    self.set_ha(ha)\n                    self.set_va(va)\n\n                else:\n\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\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 * text_size * self.pad\n                    dy += ddy * text_size * self.pad\n\n                    self.set_position((x - dx, y - dy))\n                    self.set_ha('center')\n                    self.set_va('center')\n\n                bb = super().get_window_extent(renderer)\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.append(bb)\n"},{"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":37,"header":"def _rotate_polygon(lon, lat, lon0, lat0)","id":12897,"name":"_rotate_polygon","nodeType":"Function","startLoc":15,"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":0,"comment":"\n    Determine whether a particular WCS ctype corresponds to an angle or scalar\n    coordinate.\n    ","endLoc":134,"header":"def coord_type_from_ctype(ctype)","id":12898,"name":"coord_type_from_ctype","nodeType":"Function","startLoc":122,"text":"def coord_type_from_ctype(ctype):\n    \"\"\"\n    Determine whether a particular WCS ctype corresponds to an angle or scalar\n    coordinate.\n    \"\"\"\n    if ctype[:4] in ['RA--'] or ctype[1:4] == 'LON':\n        return 'longitude', None\n    elif ctype[:4] in ['HPLN']:\n        return 'longitude', 180.\n    elif ctype[:4] in ['DEC-', 'HPLT'] or ctype[1:4] == 'LAT':\n        return 'latitude', None\n    else:\n        return 'scalar', None"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":12899,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":6,"id":12900,"name":"u","nodeType":"Attribute","startLoc":6,"text":"u"},{"fileName":"core.py","filePath":"astropy/visualization/wcsaxes","id":12901,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\nfrom matplotlib.axes import Axes, subplot_class_factory\nfrom matplotlib.transforms import Affine2D, Bbox, Transform\n\nfrom ...coordinates import SkyCoord, BaseCoordinateFrame\nfrom ...wcs import WCS\nfrom ...wcs.utils import wcs_to_celestial_frame\n\nfrom .transforms import (WCSPixel2WorldTransform, WCSWorld2PixelTransform,\n                         CoordinateTransform)\nfrom .coordinates_map import CoordinatesMap\nfrom .utils import get_coord_meta\nfrom .frame import EllipticalFrame, RectangularFrame\n\n__all__ = ['WCSAxes', 'WCSAxesSubplot']\n\nVISUAL_PROPERTIES = ['facecolor', 'edgecolor', 'linewidth', 'alpha', 'linestyle']\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\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.\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=RectangularFrame,\n                 **kwargs):\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        self.frame_class = frame_class\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._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 \"%s %s (pixel)\" % (x, y)\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        xw = coords[self._x_index].format_coord(world[self._x_index])\n        yw = coords[self._y_index].format_coord(world[self._y_index])\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = \"world, overlay {0}\".format(self._display_coords_index)\n\n        coord_string = \"%s %s (%s)\" % (xw, yw, 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        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.get('origin', None)\n\n        if 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                kwargs['origin'] = 'lower'\n\n        return super().imshow(X, *args, **kwargs)\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\n        matplotlib.axes.Axes.plot : 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            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.data.lon.to_value(coord.coord_unit))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.data.lat.to_value(coord.coord_unit))\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(frame0)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        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                wcs.wcs.set()\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        self.coords = CoordinatesMap(self, wcs=self.wcs, slice=slices,\n                                     transform=transform, coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\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        if slices is None:\n            self.slices = ('x', 'y')\n            self._x_index = 0\n            self._y_index = 1\n        else:\n            self.slices = slices\n            self._x_index = self.slices.index('x')\n            self._y_index = self.slices.index('y')\n\n        # Common default settings for Rectangular Frame\n        if self.frame_class is RectangularFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('b')\n                    self.coords[coord_index].set_ticklabel_position('b')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_axislabel_position('l')\n                    self.coords[coord_index].set_ticklabel_position('l')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')\n        # Common default settings for Elliptical Frame\n        elif self.frame_class is EllipticalFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('h')\n                    self.coords[coord_index].set_ticklabel_position('h')\n                    self.coords[coord_index].set_ticks_position('h')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_ticks_position('c')\n                    self.coords[coord_index].set_axislabel_position('c')\n                    self.coords[coord_index].set_ticklabel_position('c')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')\n\n    def draw(self, renderer, inframe=False):\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        # 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, inframe)\n\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        self._ticklabels_bbox = []\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=self._ticklabels_bbox)\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=self._ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)\n\n        self._drawn = True\n\n    def set_xlabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._x_index].set_axislabel(label, minpad=labelpad, **kwargs)\n\n    def set_ylabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._y_index].set_axislabel(label, minpad=labelpad, **kwargs)\n\n    def get_xlabel(self):\n        return self.coords[self._x_index].get_axislabel()\n\n    def get_ylabel(self):\n        return self.coords[self._y_index].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            coords = CoordinatesMap(self, frame, frame_class=self.frame_class)\n        else:\n            if coord_meta is None:\n                coord_meta = get_coord_meta(frame)\n            transform = self._get_transform_no_transdata(frame)\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 self.wcs is None and frame != 'pixel':\n            raise ValueError('No WCS specified, so only pixel coordinates are available')\n\n        if isinstance(frame, WCS):\n\n            coord_in = wcs_to_celestial_frame(self.wcs)\n            coord_out = wcs_to_celestial_frame(frame)\n\n            if coord_in == coord_out:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        WCSWorld2PixelTransform(frame))\n\n            else:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        CoordinateTransform(self.wcs, frame) +\n                        WCSWorld2PixelTransform(frame))\n\n        elif frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            return pixel2world + frame\n\n        else:\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            if frame == 'world':\n\n                return pixel2world\n\n            else:\n                coordinate_transform = CoordinateTransform(self.wcs, frame)\n\n                if coordinate_transform.same_frames:\n                    return pixel2world\n                else:\n                    return pixel2world + CoordinateTransform(self.wcs, frame)\n\n    def get_tightbbox(self, renderer):\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\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        \"\"\"\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# 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"},{"className":"TickLabels","col":0,"comment":"null","endLoc":210,"id":12902,"nodeType":"Class","startLoc":15,"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.pad = 0.3\n        self._exclude_overlapping = False\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\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\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                    self.text[axis][i] = self.text[axis][i][start:]\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 set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping\n\n    def draw(self, renderer, bboxes, ticklabels_bbox):\n\n        if not self.get_visible():\n            return\n\n        self.simplify_labels()\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\n\n            for i in range(len(self.world[axis])):\n\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                self.set_text(self.text[axis][i])\n\n                x, y = self.pixel[axis][i]\n\n                if isinstance(self._frame, RectangularFrame):\n\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = - text_size * 0.5\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 * 1.5\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = text_size * 0.5\n                        dy = - text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = text_size * 0.2\n\n                    self.set_position((x + dx, y + dy))\n                    self.set_ha(ha)\n                    self.set_va(va)\n\n                else:\n\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\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 * text_size * self.pad\n                    dy += ddy * text_size * self.pad\n\n                    self.set_position((x - dx, y - dy))\n                    self.set_ha('center')\n                    self.set_va('center')\n\n                bb = super().get_window_extent(renderer)\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.append(bb)"},{"className":"BaseFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":98,"id":12903,"nodeType":"Class","startLoc":29,"text":"class BaseFormatterLocator:\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None):\n\n        if (values, number, spacing).count(None) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specifed\")\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        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    @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":48,"header":"def __init__(self, values=None, number=None, spacing=None, format=None)","id":12904,"name":"__init__","nodeType":"Function","startLoc":34,"text":"def __init__(self, values=None, number=None, spacing=None, format=None):\n\n        if (values, number, spacing).count(None) < 2:\n            raise ValueError(\"At most one of values/number/spacing can be specifed\")\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"},{"col":4,"comment":"null","endLoc":24,"header":"def __init__(self, frame, *args, **kwargs)","id":12905,"name":"__init__","nodeType":"Function","startLoc":17,"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.pad = 0.3\n        self._exclude_overlapping = False"},{"className":"WCSPixel2WorldTransform","col":0,"comment":"\n    WCS transformation from pixel to world coordinates\n    ","endLoc":187,"id":12906,"nodeType":"Class","startLoc":116,"text":"class WCSPixel2WorldTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from pixel to world coordinates\n    \"\"\"\n\n    def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        self.slice = slice\n        if self.slice is not None:\n            self.x_index = slice.index('x')\n            self.y_index = slice.index('y')\n\n    @property\n    def output_dims(self):\n        return self.wcs.wcs.naxis\n\n    def get_coord_slices(self, xmin, xmax, ymin, ymax, nx, ny):\n        \"\"\"\n        Get a coordinate slice\n        \"\"\"\n        x = np.linspace(xmin, xmax, nx)\n        y = np.linspace(ymin, ymax, ny)\n        Y, X = np.meshgrid(y, x)\n        pixel = np.array([X.ravel(), Y.ravel()]).transpose()\n        world = self.transform(pixel)\n        return X, Y, [world[:, i].reshape(nx, ny).transpose() for i in range(self.wcs.wcs.naxis)]\n\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 in\n        the WCS\n        \"\"\"\n\n        if self.slice is None:\n            pixel_full = pixel.copy()\n        else:\n            pixel_full = []\n            for index in self.slice:\n                if index == 'x':\n                    pixel_full.append(pixel[:, 0])\n                elif index == 'y':\n                    pixel_full.append(pixel[:, 1])\n                else:\n                    pixel_full.append(index)\n            pixel_full = np.array(np.broadcast_arrays(*pixel_full)).transpose()\n\n        pixel_full += 1\n\n        if pixel_full.shape[0] == 0:\n            world = np.zeros((0, 2))\n        else:\n            world = self.wcs.wcs_pix2world(pixel_full, 1)\n\n        # At the moment, one has to manually check that the transformation\n        # round-trips, otherwise it should be considered invalid.\n        pixel_check = self.wcs.wcs_world2pix(world, 1)\n        with np.errstate(invalid='ignore'):\n            invalid = np.any(np.abs(pixel_check - pixel_full) > 1., axis=1)\n        world[invalid] = np.nan\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, slice=self.slice)"},{"col":4,"comment":"null","endLoc":52,"header":"@property\n    def values(self)","id":12907,"name":"values","nodeType":"Function","startLoc":50,"text":"@property\n    def values(self):\n        return self._values"},{"col":4,"comment":"null","endLoc":60,"header":"@values.setter\n    def values(self, values)","id":12908,"name":"values","nodeType":"Function","startLoc":54,"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        self._number = None\n        self._spacing = None\n        self._values = values"},{"col":4,"comment":"null","endLoc":64,"header":"@property\n    def number(self)","id":12909,"name":"number","nodeType":"Function","startLoc":62,"text":"@property\n    def number(self):\n        return self._number"},{"col":4,"comment":"null","endLoc":70,"header":"@number.setter\n    def number(self, number)","id":12910,"name":"number","nodeType":"Function","startLoc":66,"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":74,"header":"@property\n    def spacing(self)","id":12911,"name":"spacing","nodeType":"Function","startLoc":72,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":80,"header":"@spacing.setter\n    def spacing(self, spacing)","id":12912,"name":"spacing","nodeType":"Function","startLoc":76,"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":91,"header":"def minor_locator(self, spacing, frequency, value_min, value_max)","id":12913,"name":"minor_locator","nodeType":"Function","startLoc":82,"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":31,"header":"def clear(self)","id":12914,"name":"clear","nodeType":"Function","startLoc":26,"text":"def clear(self):\n        self.world = {}\n        self.pixel = {}\n        self.angle = {}\n        self.text = {}\n        self.disp = {}"},{"col":4,"comment":"null","endLoc":86,"header":"def set_visible_axes(self, visible_axes)","id":12915,"name":"set_visible_axes","nodeType":"Function","startLoc":85,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes"},{"col":4,"comment":"null","endLoc":45,"header":"def add(self, axis, world, pixel, angle, text, axis_displacement)","id":12916,"name":"add","nodeType":"Function","startLoc":33,"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)"},{"col":4,"comment":"null","endLoc":98,"header":"@staticmethod\n    def _locate_values(value_min, value_max, spacing)","id":12917,"name":"_locate_values","nodeType":"Function","startLoc":93,"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"},{"attributeType":"None","col":8,"comment":"null","endLoc":58,"id":12918,"name":"_number","nodeType":"Attribute","startLoc":58,"text":"self._number"},{"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    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":779,"id":12919,"nodeType":"Class","startLoc":34,"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    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, coord_index=None,\n                 coord_type='scalar', coord_unit=None, coord_wrap=None, frame=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.frame = frame\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(False)\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        #\n        # Matplotlib's gridlines use Line2D, but ours use PathPatch.\n        # Patches take a slightly different format of linestyle argument.\n        lines_to_patches_linestyle = {'-': 'solid',\n                                      '--': 'dashed',\n                                      '-.': 'dashdot',\n                                      ':': 'dotted',\n                                      'none': 'none',\n                                      'None': 'none',\n                                      ' ': 'none',\n                                      '': 'none'}\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.get('grid.alpha', 1.0),\n                                  'transform': self.parent_axes.transData}\n\n    def grid(self, draw_grid=True, grid_type='lines', **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.\n        \"\"\"\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_unit_scale = 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_unit_scale = None\n            else:\n                self._coord_unit_scale = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator()\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 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):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\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_unit_scale is not None:\n                value *= self._coord_unit_scale\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)\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 : The separator between numbers in sexagesimal\n        representation. Can be either a string or a tuple.\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) or isinstance(separator, tuple):\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string or a tuple\")\n\n    def set_format_unit(self, unit):\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        \"\"\"\n        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._formatter_locator.format_unit = unit\n\n    def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, exclude_overlapping=False):\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\n            A valid Matplotlib color for the ticks\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\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        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, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        kwargs\n            Keyword arguments 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        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        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)\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_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    @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\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        renderer.open_group('ticks')\n\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox)\n\n        renderer.close_group('ticks')\n\n    def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox_list=ticklabels_bbox,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')\n\n    def _update_ticks(self):\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        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        # http://matplotlib.org/users/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            # 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            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            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            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_unit_scale is not None:\n                dx *= self._coord_unit_scale\n                dy *= self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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_unit_scale is not None:\n                w1 = w1 * self._coord_unit_scale\n                w2 = w2 * self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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, tick_angle, ticks='major'):\n        tick_world_coordinates_values = tick_world_coordinates.value\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\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                    world = wrap_angle_at(t, self.coord_wrap)\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(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        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.value\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        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        # Currently xy_world is in deg, but transform function needs it in\n        # native units\n        if self._coord_unit_scale is not None:\n            xy_world /= self._coord_unit_scale\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 _update_grid_contour(self):\n\n        if hasattr(self, '_grid'):\n            for line in self._grid.collections:\n                line.remove()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x, y, field = self.transform.get_coord_slices(xmin, xmax, ymin, ymax, 200, 200)\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        field = field[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            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            self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None"},{"attributeType":"null","col":12,"comment":"null","endLoc":46,"id":12920,"name":"number","nodeType":"Attribute","startLoc":46,"text":"self.number"},{"className":"AngleFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":323,"id":12921,"nodeType":"Class","startLoc":101,"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        self._unit = u.degree\n        self._sep = None\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)\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._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._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._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._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._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(\"Invalid format: {0}\".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._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._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).\n            if value_min == value_max:\n                return [] * u.deg, 0 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_deg = self.spacing.to_value(u.degree)\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 * u.degree\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_deg = self.base_spacing.to_value(u.degree)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self._unit is u.degree:\n                        from .utils import select_step_degree\n                        spacing_deg = select_step_degree(dv).to_value(u.degree)\n                    else:\n                        from .utils import select_step_hour\n                        spacing_deg = select_step_hour(dv).to_value(u.degree)\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_deg)\n            return values * spacing_deg * u.degree, spacing_deg * u.degree\n\n    def formatter(self, values, spacing):\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            if self.format is None:\n                spacing = spacing.to_value(u.arcsec)\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                decimal = False\n                unit = u.degree\n            else:\n                fields = self._fields\n                precision = self._precision\n                decimal = self._decimal\n                unit = self._unit\n\n            if decimal:\n                sep = None\n            elif self._sep is not None:\n                sep = self._sep\n            else:\n                if unit == u.degree:\n                    if rcParams['text.usetex']:\n                        deg = r'$^\\circ$'\n                    else:\n                        deg = '\\xb0'\n                    sep = (deg, \"'\", '\"')\n                else:\n                    sep = ('h', 'm', 's')\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep).tolist()\n            return string\n        else:\n            return []"},{"attributeType":"null","col":12,"comment":"null","endLoc":44,"id":12922,"name":"spacing","nodeType":"Attribute","startLoc":44,"text":"self.spacing"},{"attributeType":"None","col":8,"comment":"null","endLoc":59,"id":12923,"name":"_spacing","nodeType":"Attribute","startLoc":59,"text":"self._spacing"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":60,"id":12924,"name":"_values","nodeType":"Attribute","startLoc":60,"text":"self._values"},{"col":4,"comment":"null","endLoc":110,"header":"def __init__(self, values=None, number=None, spacing=None, format=None)","id":12925,"name":"__init__","nodeType":"Function","startLoc":106,"text":"def __init__(self, values=None, number=None, spacing=None, format=None):\n        self._unit = u.degree\n        self._sep = None\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)"},{"col":4,"comment":"null","endLoc":116,"header":"def __init__(self, parent_axes=None, parent_map=None, transform=None, coord_index=None,\n                 coord_type='scalar', coord_unit=None, coord_wrap=None, frame=None)","id":12926,"name":"__init__","nodeType":"Function","startLoc":64,"text":"def __init__(self, parent_axes=None, parent_map=None, transform=None, coord_index=None,\n                 coord_type='scalar', coord_unit=None, coord_wrap=None, frame=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.frame = frame\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(False)\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        #\n        # Matplotlib's gridlines use Line2D, but ours use PathPatch.\n        # Patches take a slightly different format of linestyle argument.\n        lines_to_patches_linestyle = {'-': 'solid',\n                                      '--': 'dashed',\n                                      '-.': 'dashdot',\n                                      ':': 'dotted',\n                                      'none': 'none',\n                                      'None': 'none',\n                                      ' ': 'none',\n                                      '': 'none'}\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.get('grid.alpha', 1.0),\n                                  'transform': self.parent_axes.transData}"},{"className":"CurvedTransform","col":0,"comment":"\n    Abstract base class for non-affine curved transforms\n    ","endLoc":58,"id":12927,"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    @abc.abstractmethod\n    def transform(self, input):\n        raise NotImplementedError(\"\")\n\n    @abc.abstractmethod\n    def inverted(self):\n        raise NotImplementedError(\"\")"},{"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":12928,"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":114,"header":"@property\n    def spacing(self)","id":12929,"name":"spacing","nodeType":"Function","startLoc":112,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":124,"header":"@spacing.setter\n    def spacing(self, spacing)","id":12930,"name":"spacing","nodeType":"Function","startLoc":116,"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"},{"attributeType":"null","col":12,"comment":"null","endLoc":40,"id":12931,"name":"values","nodeType":"Attribute","startLoc":40,"text":"self.values"},{"col":4,"comment":"null","endLoc":128,"header":"@property\n    def sep(self)","id":12932,"name":"sep","nodeType":"Function","startLoc":126,"text":"@property\n    def sep(self):\n        return self._sep"},{"col":4,"comment":"null","endLoc":132,"header":"@sep.setter\n    def sep(self, separator)","id":12933,"name":"sep","nodeType":"Function","startLoc":130,"text":"@sep.setter\n    def sep(self, separator):\n        self._sep = separator"},{"col":4,"comment":"null","endLoc":136,"header":"@property\n    def format(self)","id":12934,"name":"format","nodeType":"Function","startLoc":134,"text":"@property\n    def format(self):\n        return self._format"},{"col":4,"comment":"null","endLoc":202,"header":"@format.setter\n    def format(self, value)","id":12935,"name":"format","nodeType":"Function","startLoc":138,"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._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._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._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._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._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(\"Invalid format: {0}\".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))"},{"attributeType":"null","col":8,"comment":"null","endLoc":48,"id":12936,"name":"format","nodeType":"Attribute","startLoc":48,"text":"self.format"},{"col":4,"comment":"null","endLoc":54,"header":"@abc.abstractmethod\n    def transform(self, input)","id":12937,"name":"transform","nodeType":"Function","startLoc":52,"text":"@abc.abstractmethod\n    def transform(self, input):\n        raise NotImplementedError(\"\")"},{"className":"ScalarFormatterLocator","col":0,"comment":"\n    A joint formatter/locator\n    ","endLoc":460,"id":12938,"nodeType":"Class","startLoc":326,"text":"class ScalarFormatterLocator(BaseFormatterLocator):\n    \"\"\"\n    A joint formatter/locator\n    \"\"\"\n\n    def __init__(self, values=None, number=None, spacing=None, format=None, unit=None):\n        if unit is not None:\n            self._unit = unit\n            self._format_unit = unit\n        elif spacing is not None:\n            self._unit = spacing.unit\n            self._format_unit = spacing.unit\n        elif values is not None:\n            self._unit = values.unit\n            self._format_unit = values.unit\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)\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        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._format_unit = 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(\"Invalid format: {0}\".format(value))\n\n    @property\n    def base_spacing(self):\n        return self._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\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing.value:\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)\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):\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":342,"header":"def __init__(self, values=None, number=None, spacing=None, format=None, unit=None)","id":12939,"name":"__init__","nodeType":"Function","startLoc":331,"text":"def __init__(self, values=None, number=None, spacing=None, format=None, unit=None):\n        if unit is not None:\n            self._unit = unit\n            self._format_unit = unit\n        elif spacing is not None:\n            self._unit = spacing.unit\n            self._format_unit = spacing.unit\n        elif values is not None:\n            self._unit = values.unit\n            self._format_unit = values.unit\n        super().__init__(values=values, number=number, spacing=spacing,\n                         format=format)"},{"col":4,"comment":"null","endLoc":58,"header":"@abc.abstractmethod\n    def inverted(self)","id":12940,"name":"inverted","nodeType":"Function","startLoc":56,"text":"@abc.abstractmethod\n    def inverted(self):\n        raise NotImplementedError(\"\")"},{"attributeType":"null","col":4,"comment":"null","endLoc":30,"id":12941,"name":"input_dims","nodeType":"Attribute","startLoc":30,"text":"input_dims"},{"attributeType":"null","col":4,"comment":"null","endLoc":31,"id":12942,"name":"output_dims","nodeType":"Attribute","startLoc":31,"text":"output_dims"},{"attributeType":"null","col":4,"comment":"null","endLoc":32,"id":12943,"name":"is_separable","nodeType":"Attribute","startLoc":32,"text":"is_separable"},{"attributeType":"function","col":4,"comment":"null","endLoc":50,"id":12944,"name":"transform_path_non_affine","nodeType":"Attribute","startLoc":50,"text":"transform_path_non_affine"},{"col":4,"comment":"null","endLoc":127,"header":"def __init__(self, wcs, slice=None)","id":12945,"name":"__init__","nodeType":"Function","startLoc":121,"text":"def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        self.slice = slice\n        if self.slice is not None:\n            self.x_index = slice.index('x')\n            self.y_index = slice.index('y')"},{"col":4,"comment":"null","endLoc":346,"header":"@property\n    def format_unit(self)","id":12946,"name":"format_unit","nodeType":"Function","startLoc":344,"text":"@property\n    def format_unit(self):\n        return self._format_unit"},{"col":4,"comment":"null","endLoc":352,"header":"@format_unit.setter\n    def format_unit(self, unit)","id":12947,"name":"format_unit","nodeType":"Function","startLoc":348,"text":"@format_unit.setter\n    def format_unit(self, unit):\n        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._format_unit = unit"},{"col":4,"comment":"null","endLoc":356,"header":"@property\n    def spacing(self)","id":12948,"name":"spacing","nodeType":"Function","startLoc":354,"text":"@property\n    def spacing(self):\n        return self._spacing"},{"col":4,"comment":"null","endLoc":364,"header":"@spacing.setter\n    def spacing(self, spacing)","id":12949,"name":"spacing","nodeType":"Function","startLoc":358,"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":368,"header":"@property\n    def format(self)","id":12950,"name":"format","nodeType":"Function","startLoc":366,"text":"@property\n    def format(self):\n        return self._format"},{"col":4,"comment":"null","endLoc":398,"header":"@format.setter\n    def format(self, value)","id":12951,"name":"format","nodeType":"Function","startLoc":370,"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(\"Invalid format: {0}\".format(value))"},{"col":4,"comment":"null","endLoc":131,"header":"@property\n    def output_dims(self)","id":12952,"name":"output_dims","nodeType":"Function","startLoc":129,"text":"@property\n    def output_dims(self):\n        return self.wcs.wcs.naxis"},{"col":4,"comment":"\n        Get a coordinate slice\n        ","endLoc":142,"header":"def get_coord_slices(self, xmin, xmax, ymin, ymax, nx, ny)","id":12953,"name":"get_coord_slices","nodeType":"Function","startLoc":133,"text":"def get_coord_slices(self, xmin, xmax, ymin, ymax, nx, ny):\n        \"\"\"\n        Get a coordinate slice\n        \"\"\"\n        x = np.linspace(xmin, xmax, nx)\n        y = np.linspace(ymin, ymax, ny)\n        Y, X = np.meshgrid(y, x)\n        pixel = np.array([X.ravel(), Y.ravel()]).transpose()\n        world = self.transform(pixel)\n        return X, Y, [world[:, i].reshape(nx, ny).transpose() for i in range(self.wcs.wcs.naxis)]"},{"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 in\n        the WCS\n        ","endLoc":179,"header":"def transform(self, pixel)","id":12954,"name":"transform","nodeType":"Function","startLoc":144,"text":"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 in\n        the WCS\n        \"\"\"\n\n        if self.slice is None:\n            pixel_full = pixel.copy()\n        else:\n            pixel_full = []\n            for index in self.slice:\n                if index == 'x':\n                    pixel_full.append(pixel[:, 0])\n                elif index == 'y':\n                    pixel_full.append(pixel[:, 1])\n                else:\n                    pixel_full.append(index)\n            pixel_full = np.array(np.broadcast_arrays(*pixel_full)).transpose()\n\n        pixel_full += 1\n\n        if pixel_full.shape[0] == 0:\n            world = np.zeros((0, 2))\n        else:\n            world = self.wcs.wcs_pix2world(pixel_full, 1)\n\n        # At the moment, one has to manually check that the transformation\n        # round-trips, otherwise it should be considered invalid.\n        pixel_check = self.wcs.wcs_world2pix(world, 1)\n        with np.errstate(invalid='ignore'):\n            invalid = np.any(np.abs(pixel_check - pixel_full) > 1., axis=1)\n        world[invalid] = np.nan\n\n        return world"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":12955,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"col":4,"comment":"null","endLoc":226,"header":"@property\n    def base_spacing(self)","id":12956,"name":"base_spacing","nodeType":"Function","startLoc":204,"text":"@property\n    def base_spacing(self):\n\n        if self._decimal:\n\n            spacing = self._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._unit is u.hourangle:\n            spacing *= 15\n\n        return spacing"},{"col":4,"comment":"null","endLoc":271,"header":"def locator(self, value_min, value_max)","id":12957,"name":"locator","nodeType":"Function","startLoc":228,"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).\n            if value_min == value_max:\n                return [] * u.deg, 0 * u.arcsec\n\n            if self.spacing is not None:\n\n                # spacing was manually specified\n                spacing_deg = self.spacing.to_value(u.degree)\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 * u.degree\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_deg = self.base_spacing.to_value(u.degree)\n                else:\n                    # otherwise we clip to the nearest 'sensible' spacing\n                    if self._unit is u.degree:\n                        from .utils import select_step_degree\n                        spacing_deg = select_step_degree(dv).to_value(u.degree)\n                    else:\n                        from .utils import select_step_hour\n                        spacing_deg = select_step_hour(dv).to_value(u.degree)\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_deg)\n            return values * spacing_deg * u.degree, spacing_deg * u.degree"},{"attributeType":"null","col":25,"comment":"null","endLoc":7,"id":12958,"name":"u","nodeType":"Attribute","startLoc":7,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":12,"id":12959,"name":"__all__","nodeType":"Attribute","startLoc":12,"text":"__all__"},{"col":0,"comment":"","endLoc":4,"header":"patches.py#<anonymous>","id":12960,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['SphericalCircle']"},{"col":4,"comment":"\n        Sort by axis displacement, which allows us to figure out which parts\n        of labels to not repeat.\n        ","endLoc":57,"header":"def sort(self)","id":12961,"name":"sort","nodeType":"Function","startLoc":47,"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])"},{"fileName":"coordinate_range.py","filePath":"astropy/visualization/wcsaxes","id":12962,"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 ... import units as u\n\n# Algorithm inspired by PGSBOX from WCSLIB by M. Calabretta\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):\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    \"\"\"\n\n    # Sample coordinates on a NX x NY grid.\n    from . import conf\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    world = transform.transform(np.vstack([xp.ravel(), yp.ravel()]).transpose())\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 ['longitude', 'latitude']:\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 ['longitude', 'latitude']:\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 ['longitude', 'latitude']:\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 = 0.\n                xw_max = 360 - 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        ranges.append((xw_min, xw_max))\n\n    return ranges\n"},{"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":188,"header":"def set_coord_type(self, coord_type, coord_wrap=None)","id":12963,"name":"set_coord_type","nodeType":"Function","startLoc":155,"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_unit_scale = 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_unit_scale = None\n            else:\n                self._coord_unit_scale = self.coord_unit.to(u.deg)\n            self._formatter_locator = AngleFormatterLocator()\n        else:\n            raise ValueError(\"coord_type should be one of 'scalar', 'longitude', or 'latitude'\")"},{"col":0,"comment":"null","endLoc":12,"header":"def sort_using(X, Y)","id":12964,"name":"sort_using","nodeType":"Function","startLoc":11,"text":"def sort_using(X, Y):\n    return [x for (y, x) in sorted(zip(Y, X))]"},{"col":0,"comment":"null","endLoc":17,"header":"def wrap_180(values)","id":12965,"name":"wrap_180","nodeType":"Function","startLoc":13,"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        Return the inverse of the transform\n        ","endLoc":187,"header":"def inverted(self)","id":12966,"name":"inverted","nodeType":"Function","startLoc":183,"text":"def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSWorld2PixelTransform(self.wcs, slice=self.slice)"},{"col":4,"comment":"\n        Figure out which parts of labels can be dropped to avoid repetition.\n        ","endLoc":83,"header":"def simplify_labels(self)","id":12967,"name":"simplify_labels","nodeType":"Function","startLoc":59,"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                    self.text[axis][i] = self.text[axis][i][start:]"},{"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    ","endLoc":125,"header":"def find_coordinate_range(transform, extent, coord_types, coord_units)","id":12968,"name":"find_coordinate_range","nodeType":"Function","startLoc":20,"text":"def find_coordinate_range(transform, extent, coord_types, coord_units):\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    \"\"\"\n\n    # Sample coordinates on a NX x NY grid.\n    from . import conf\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    world = transform.transform(np.vstack([xp.ravel(), yp.ravel()]).transpose())\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 ['longitude', 'latitude']:\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 ['longitude', 'latitude']:\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 ['longitude', 'latitude']:\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 = 0.\n                xw_max = 360 - 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        ranges.append((xw_min, xw_max))\n\n    return ranges"},{"col":4,"comment":"null","endLoc":80,"header":"def __init__(self, wcs, slice=None)","id":12969,"name":"__init__","nodeType":"Function","startLoc":66,"text":"def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        if self.wcs.wcs.naxis > 2:\n            if slice is None:\n                raise ValueError(\"WCS has more than 2 dimensions, so ``slice`` should be set\")\n            elif len(slice) != self.wcs.wcs.naxis:\n                raise ValueError(\"slice should have as many elements as WCS \"\n                                 \"has dimensions (should be {0})\".format(self.wcs.wcs.naxis))\n            else:\n                self.slice = slice\n                self.x_index = slice.index('x')\n                self.y_index = slice.index('y')\n        else:\n            self.slice = None"},{"attributeType":"function","col":4,"comment":"null","endLoc":181,"id":12970,"name":"transform_non_affine","nodeType":"Attribute","startLoc":181,"text":"transform_non_affine"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":12971,"name":"slice","nodeType":"Attribute","startLoc":124,"text":"self.slice"},{"attributeType":"null","col":12,"comment":"null","endLoc":127,"id":12972,"name":"y_index","nodeType":"Attribute","startLoc":127,"text":"self.y_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":12973,"name":"wcs","nodeType":"Attribute","startLoc":123,"text":"self.wcs"},{"attributeType":"null","col":12,"comment":"null","endLoc":126,"id":12974,"name":"x_index","nodeType":"Attribute","startLoc":126,"text":"self.x_index"},{"className":"WCSWorld2PixelTransform","col":0,"comment":"\n    WCS transformation from world to pixel coordinates\n    ","endLoc":113,"id":12975,"nodeType":"Class","startLoc":61,"text":"class WCSWorld2PixelTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from world to pixel coordinates\n    \"\"\"\n\n    def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        if self.wcs.wcs.naxis > 2:\n            if slice is None:\n                raise ValueError(\"WCS has more than 2 dimensions, so ``slice`` should be set\")\n            elif len(slice) != self.wcs.wcs.naxis:\n                raise ValueError(\"slice should have as many elements as WCS \"\n                                 \"has dimensions (should be {0})\".format(self.wcs.wcs.naxis))\n            else:\n                self.slice = slice\n                self.x_index = slice.index('x')\n                self.y_index = slice.index('y')\n        else:\n            self.slice = None\n\n    @property\n    def input_dims(self):\n        return self.wcs.wcs.naxis\n\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 in the WCS. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\"\n\n        if world.shape[1] != self.wcs.wcs.naxis:\n            raise ValueError(\"Second dimension of input values should match number of WCS coordinates\")\n\n        if world.shape[0] == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.wcs_world2pix(world, 1) - 1\n\n        if self.slice is None:\n            return pixel\n        else:\n            return pixel[:, (self.x_index, self.y_index)]\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, slice=self.slice)"},{"col":4,"comment":"null","endLoc":84,"header":"@property\n    def input_dims(self)","id":12976,"name":"input_dims","nodeType":"Function","startLoc":82,"text":"@property\n    def input_dims(self):\n        return self.wcs.wcs.naxis"},{"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 in the WCS. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        ","endLoc":105,"header":"def transform(self, world)","id":12977,"name":"transform","nodeType":"Function","startLoc":86,"text":"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 in the WCS. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\"\n\n        if world.shape[1] != self.wcs.wcs.naxis:\n            raise ValueError(\"Second dimension of input values should match number of WCS coordinates\")\n\n        if world.shape[0] == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.wcs_world2pix(world, 1) - 1\n\n        if self.slice is None:\n            return pixel\n        else:\n            return pixel[:, (self.x_index, self.y_index)]"},{"col":4,"comment":"null","endLoc":92,"header":"def get_visible_axes(self)","id":12978,"name":"get_visible_axes","nodeType":"Function","startLoc":88,"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":95,"header":"def set_exclude_overlapping(self, exclude_overlapping)","id":12979,"name":"set_exclude_overlapping","nodeType":"Function","startLoc":94,"text":"def set_exclude_overlapping(self, exclude_overlapping):\n        self._exclude_overlapping = exclude_overlapping"},{"col":4,"comment":"null","endLoc":210,"header":"def draw(self, renderer, bboxes, ticklabels_bbox)","id":12980,"name":"draw","nodeType":"Function","startLoc":97,"text":"def draw(self, renderer, bboxes, ticklabels_bbox):\n\n        if not self.get_visible():\n            return\n\n        self.simplify_labels()\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\n\n            for i in range(len(self.world[axis])):\n\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                self.set_text(self.text[axis][i])\n\n                x, y = self.pixel[axis][i]\n\n                if isinstance(self._frame, RectangularFrame):\n\n                    # This is just to preserve the current results, but can be\n                    # removed next time the reference images are re-generated.\n\n                    if np.abs(self.angle[axis][i]) < 45.:\n                        ha = 'right'\n                        va = 'bottom'\n                        dx = - text_size * 0.5\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 * 1.5\n                    elif np.abs(self.angle[axis][i] - 180.) < 45:\n                        ha = 'left'\n                        va = 'bottom'\n                        dx = text_size * 0.5\n                        dy = - text_size * 0.5\n                    else:\n                        ha = 'center'\n                        va = 'bottom'\n                        dx = 0\n                        dy = text_size * 0.2\n\n                    self.set_position((x + dx, y + dy))\n                    self.set_ha(ha)\n                    self.set_va(va)\n\n                else:\n\n                    # This is the more general code for arbitrarily oriented\n                    # axes\n\n                    # Set initial position and find bounding box\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 * text_size * self.pad\n                    dy += ddy * text_size * self.pad\n\n                    self.set_position((x - dx, y - dy))\n                    self.set_ha('center')\n                    self.set_va('center')\n\n                bb = super().get_window_extent(renderer)\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.append(bb)"},{"col":4,"comment":"\n        Return the inverse of the transform\n        ","endLoc":113,"header":"def inverted(self)","id":12981,"name":"inverted","nodeType":"Function","startLoc":109,"text":"def inverted(self):\n        \"\"\"\n        Return the inverse of the transform\n        \"\"\"\n        return WCSPixel2WorldTransform(self.wcs, slice=self.slice)"},{"col":4,"comment":"null","endLoc":402,"header":"@property\n    def base_spacing(self)","id":12982,"name":"base_spacing","nodeType":"Function","startLoc":400,"text":"@property\n    def base_spacing(self):\n        return self._unit / (10. ** self._precision)"},{"col":4,"comment":"null","endLoc":442,"header":"def locator(self, value_min, value_max)","id":12983,"name":"locator","nodeType":"Function","startLoc":404,"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\n\n                if self.format is not None and (not self.format.startswith('%')) and dv < self.base_spacing.value:\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)\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":323,"header":"def formatter(self, values, spacing)","id":12984,"name":"formatter","nodeType":"Function","startLoc":273,"text":"def formatter(self, values, spacing):\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            if self.format is None:\n                spacing = spacing.to_value(u.arcsec)\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                decimal = False\n                unit = u.degree\n            else:\n                fields = self._fields\n                precision = self._precision\n                decimal = self._decimal\n                unit = self._unit\n\n            if decimal:\n                sep = None\n            elif self._sep is not None:\n                sep = self._sep\n            else:\n                if unit == u.degree:\n                    if rcParams['text.usetex']:\n                        deg = r'$^\\circ$'\n                    else:\n                        deg = '\\xb0'\n                    sep = (deg, \"'\", '\"')\n                else:\n                    sep = ('h', 'm', 's')\n\n            angles = Angle(values)\n            string = angles.to_string(unit=unit,\n                                      precision=precision,\n                                      decimal=decimal,\n                                      fields=fields,\n                                      sep=sep).tolist()\n            return string\n        else:\n            return []"},{"attributeType":"function","col":4,"comment":"null","endLoc":107,"id":12985,"name":"transform_non_affine","nodeType":"Attribute","startLoc":107,"text":"transform_non_affine"},{"attributeType":"null","col":12,"comment":"null","endLoc":80,"id":12986,"name":"slice","nodeType":"Attribute","startLoc":80,"text":"self.slice"},{"attributeType":"null","col":16,"comment":"null","endLoc":78,"id":12987,"name":"y_index","nodeType":"Attribute","startLoc":78,"text":"self.y_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":68,"id":12988,"name":"wcs","nodeType":"Attribute","startLoc":68,"text":"self.wcs"},{"attributeType":"null","col":16,"comment":"null","endLoc":77,"id":12989,"name":"x_index","nodeType":"Attribute","startLoc":77,"text":"self.x_index"},{"className":"CoordinateTransform","col":0,"comment":"null","endLoc":265,"id":12990,"nodeType":"Class","startLoc":190,"text":"class CoordinateTransform(CurvedTransform):\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, WCS):\n            self.input_system = wcs_to_celestial_frame(self._input_system_name)\n        elif isinstance(self._input_system_name, str):\n            self.input_system = frame_transform_graph.lookup_name(self._input_system_name)\n            if self.input_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._input_system_name))\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, WCS):\n            self.output_system = wcs_to_celestial_frame(self._output_system_name)\n        elif isinstance(self._output_system_name, str):\n            self.output_system = frame_transform_graph.lookup_name(self._output_system_name)\n            if self.output_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._output_system_name))\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        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(x_in, y_in, unit=(u.deg, u.deg),\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        if issubclass(c_out.representation, (SphericalRepresentation, UnitSphericalRepresentation)):\n            lon = c_out.data.lon.deg\n            lat = c_out.data.lat.deg\n        else:\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":222,"header":"def __init__(self, input_system, output_system)","id":12991,"name":"__init__","nodeType":"Function","startLoc":192,"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, WCS):\n            self.input_system = wcs_to_celestial_frame(self._input_system_name)\n        elif isinstance(self._input_system_name, str):\n            self.input_system = frame_transform_graph.lookup_name(self._input_system_name)\n            if self.input_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._input_system_name))\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, WCS):\n            self.output_system = wcs_to_celestial_frame(self._output_system_name)\n        elif isinstance(self._output_system_name, str):\n            self.output_system = frame_transform_graph.lookup_name(self._output_system_name)\n            if self.output_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._output_system_name))\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":460,"header":"def formatter(self, values, spacing)","id":12992,"name":"formatter","nodeType":"Function","startLoc":444,"text":"def formatter(self, values, spacing):\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":226,"header":"@property\n    def same_frames(self)","id":12993,"name":"same_frames","nodeType":"Function","startLoc":224,"text":"@property\n    def same_frames(self):\n        return self._same_frames"},{"col":4,"comment":"null","endLoc":230,"header":"@same_frames.setter\n    def same_frames(self, same_frames)","id":12994,"name":"same_frames","nodeType":"Function","startLoc":228,"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":257,"header":"def transform(self, input_coords)","id":12995,"name":"transform","nodeType":"Function","startLoc":232,"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        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(x_in, y_in, unit=(u.deg, u.deg),\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        if issubclass(c_out.representation, (SphericalRepresentation, UnitSphericalRepresentation)):\n            lon = c_out.data.lon.deg\n            lat = c_out.data.lat.deg\n        else:\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)"},{"attributeType":"null","col":8,"comment":"null","endLoc":122,"id":12996,"name":"_number","nodeType":"Attribute","startLoc":122,"text":"self._number"},{"attributeType":"null","col":8,"comment":"null","endLoc":107,"id":12997,"name":"_unit","nodeType":"Attribute","startLoc":107,"text":"self._unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":108,"id":12998,"name":"_sep","nodeType":"Attribute","startLoc":108,"text":"self._sep"},{"attributeType":"function","col":12,"comment":"null","endLoc":193,"id":12999,"name":"spacing","nodeType":"Attribute","startLoc":193,"text":"self.spacing"},{"attributeType":"null","col":8,"comment":"null","endLoc":123,"id":13000,"name":"_spacing","nodeType":"Attribute","startLoc":123,"text":"self._spacing"},{"col":4,"comment":"null","endLoc":21,"header":"def __init__(self, frame, minpad=1, *args, **kwargs)","id":13001,"name":"__init__","nodeType":"Function","startLoc":14,"text":"def __init__(self, frame, minpad=1, *args, **kwargs):\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"},{"attributeType":"null","col":16,"comment":"null","endLoc":6,"id":13002,"name":"np","nodeType":"Attribute","startLoc":6,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":8,"id":13003,"name":"u","nodeType":"Attribute","startLoc":8,"text":"u"},{"attributeType":"null","col":8,"comment":"null","endLoc":124,"id":13004,"name":"_values","nodeType":"Attribute","startLoc":124,"text":"self._values"},{"attributeType":"null","col":16,"comment":"null","endLoc":150,"id":13005,"name":"_precision","nodeType":"Attribute","startLoc":150,"text":"self._precision"},{"attributeType":"null","col":12,"comment":"null","endLoc":340,"id":13006,"name":"_format_unit","nodeType":"Attribute","startLoc":340,"text":"self._format_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":141,"id":13007,"name":"_format","nodeType":"Attribute","startLoc":141,"text":"self._format"},{"fileName":"grid_paths.py","filePath":"astropy/visualization/wcsaxes","id":13008,"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 ...coordinates.angle_utilities import angular_separation\n\n# Tolerance for WCS round-tripping\nROUND_TRIP_TOL = 1e-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 : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.ndarray`\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : `~numpy.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    with np.errstate(invalid='ignore'):\n\n        sep[sep > np.pi] -= 2. * np.pi\n\n        mask = np.abs(sep > ROUND_TRIP_TOL)\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 : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.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"},{"col":0,"comment":"\n    Draw a curve, taking into account discontinuities.\n\n    Parameters\n    ----------\n    lon_lat : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.ndarray`\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : `~numpy.ndarray`\n        The world coordinates derived from converting from ``pixel``, which is\n        used to ensure round-tripping.\n    ","endLoc":85,"header":"def get_lon_lat_path(lon_lat, pixel, lon_lat_check)","id":13009,"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 : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.ndarray`\n        The pixel coordinates corresponding to ``lon_lat``\n    lon_lat_check : `~numpy.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    with np.errstate(invalid='ignore'):\n\n        sep[sep > np.pi] -= 2. * np.pi\n\n        mask = np.abs(sep > ROUND_TRIP_TOL)\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":"\n        Return the inverse of the transform\n        ","endLoc":265,"header":"def inverted(self)","id":13010,"name":"inverted","nodeType":"Function","startLoc":261,"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":"None","col":8,"comment":"null","endLoc":362,"id":13011,"name":"_number","nodeType":"Attribute","startLoc":362,"text":"self._number"},{"attributeType":"null","col":16,"comment":"null","endLoc":151,"id":13012,"name":"_fields","nodeType":"Attribute","startLoc":151,"text":"self._fields"},{"col":4,"comment":"null","endLoc":30,"header":"def set_visible_axes(self, visible_axes)","id":13013,"name":"set_visible_axes","nodeType":"Function","startLoc":29,"text":"def set_visible_axes(self, visible_axes):\n        self._visible_axes = visible_axes"},{"attributeType":"null","col":12,"comment":"null","endLoc":147,"id":13014,"name":"_decimal","nodeType":"Attribute","startLoc":147,"text":"self._decimal"},{"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.\n        ","endLoc":153,"header":"def grid(self, draw_grid=True, grid_type='lines', **kwargs)","id":13015,"name":"grid","nodeType":"Function","startLoc":118,"text":"def grid(self, draw_grid=True, grid_type='lines', **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.\n        \"\"\"\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":12,"comment":"null","endLoc":339,"id":13016,"name":"_unit","nodeType":"Attribute","startLoc":339,"text":"self._unit"},{"attributeType":"null","col":16,"comment":"null","endLoc":386,"id":13017,"name":"spacing","nodeType":"Attribute","startLoc":386,"text":"self.spacing"},{"className":"AxisLabels","col":0,"comment":"null","endLoc":125,"id":13018,"nodeType":"Class","startLoc":12,"text":"class AxisLabels(Text):\n\n    def __init__(self, frame, minpad=1, *args, **kwargs):\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\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 draw(self, renderer, bboxes, ticklabels_bbox_list, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\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_disp, y_disp = self._frame[axis].pixel[:, 0], self._frame[axis].pixel[:, 1]\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._frame[axis].normal_angle[imin] + 180.\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:\n                    ticklabels_bbox = mtransforms.Bbox.union(ticklabels_bbox_list)\n                else:\n                    ticklabels_bbox = None\n\n                if axis == 'l':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        left = ticklabels_bbox.xmin\n                    else:\n                        left = xcen\n                    xpos = left - padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'r':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        right = ticklabels_bbox.x1\n                    else:\n                        right = xcen\n                    xpos = right + padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'b':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        bottom = ticklabels_bbox.ymin\n                    else:\n                        bottom = ycen\n                    ypos = bottom - padding\n                    self.set_position((xcen, ypos))\n\n                elif axis == 't':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        top = ticklabels_bbox.y1\n                    else:\n                        top = ycen\n                    ypos = top + padding\n                    self.set_position((xcen, ypos))\n\n            else:  # arbitrary axis\n\n                dx = np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                dy = np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n                self.set_position((xcen + dx, ycen + dy))\n\n            super().draw(renderer)\n\n            bb = super().get_window_extent(renderer)\n            bboxes.append(bb)"},{"attributeType":"function","col":4,"comment":"null","endLoc":259,"id":13019,"name":"transform_non_affine","nodeType":"Attribute","startLoc":259,"text":"transform_non_affine"},{"col":4,"comment":"null","endLoc":27,"header":"def get_minpad(self, axis)","id":13020,"name":"get_minpad","nodeType":"Function","startLoc":23,"text":"def get_minpad(self, axis):\n        try:\n            return self._minpad[axis]\n        except TypeError:\n            return self._minpad"},{"attributeType":"null","col":12,"comment":"null","endLoc":215,"id":13021,"name":"output_system","nodeType":"Attribute","startLoc":215,"text":"self.output_system"},{"attributeType":"Quantity","col":8,"comment":"null","endLoc":363,"id":13022,"name":"_spacing","nodeType":"Attribute","startLoc":363,"text":"self._spacing"},{"attributeType":"None","col":8,"comment":"null","endLoc":364,"id":13023,"name":"_values","nodeType":"Attribute","startLoc":364,"text":"self._values"},{"col":4,"comment":"null","endLoc":36,"header":"def get_visible_axes(self)","id":13024,"name":"get_visible_axes","nodeType":"Function","startLoc":32,"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]"},{"attributeType":"null","col":12,"comment":"null","endLoc":222,"id":13025,"name":"same_frames","nodeType":"Attribute","startLoc":222,"text":"self.same_frames"},{"attributeType":"null","col":8,"comment":"null","endLoc":195,"id":13026,"name":"_output_system_name","nodeType":"Attribute","startLoc":195,"text":"self._output_system_name"},{"attributeType":"null","col":8,"comment":"null","endLoc":194,"id":13027,"name":"_input_system_name","nodeType":"Attribute","startLoc":194,"text":"self._input_system_name"},{"col":0,"comment":"\n    Draw a grid line\n\n    Parameters\n    ----------\n    world : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.ndarray`\n        The pixel coordinates corresponding to ``lon_lat``\n    ","endLoc":120,"header":"def get_gridline_path(world, pixel)","id":13028,"name":"get_gridline_path","nodeType":"Function","startLoc":88,"text":"def get_gridline_path(world, pixel):\n    \"\"\"\n    Draw a grid line\n\n    Parameters\n    ----------\n    world : `~numpy.ndarray`\n        The longitude and latitude values along the curve, given as a (n,2)\n        array.\n    pixel : `~numpy.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"},{"attributeType":"null","col":16,"comment":"null","endLoc":380,"id":13029,"name":"_precision","nodeType":"Attribute","startLoc":380,"text":"self._precision"},{"attributeType":"{startswith} | None","col":8,"comment":"null","endLoc":373,"id":13030,"name":"_format","nodeType":"Attribute","startLoc":373,"text":"self._format"},{"attributeType":"null","col":8,"comment":"null","endLoc":230,"id":13031,"name":"_same_frames","nodeType":"Attribute","startLoc":230,"text":"self._same_frames"},{"attributeType":"null","col":16,"comment":"null","endLoc":14,"id":13032,"name":"np","nodeType":"Attribute","startLoc":14,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":18,"id":13033,"name":"u","nodeType":"Attribute","startLoc":18,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":13034,"name":"DMS_RE","nodeType":"Attribute","startLoc":21,"text":"DMS_RE"},{"attributeType":"null","col":12,"comment":"null","endLoc":204,"id":13035,"name":"input_system","nodeType":"Attribute","startLoc":204,"text":"self.input_system"},{"col":4,"comment":"\n        Set the formatter to use for the major tick labels.\n\n        Parameters\n        ----------\n        formatter : str or Formatter\n            The format or formatter to use.\n        ","endLoc":205,"header":"def set_major_formatter(self, formatter)","id":13036,"name":"set_major_formatter","nodeType":"Function","startLoc":190,"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 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        ","endLoc":231,"header":"def format_coord(self, value)","id":13037,"name":"format_coord","nodeType":"Function","startLoc":207,"text":"def format_coord(self, value):\n        \"\"\"\n        Given the value of a coordinate, will format it according to the\n        format of the formatter_locator.\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_unit_scale is not None:\n                value *= self._coord_unit_scale\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)\n\n        return string[0]"},{"attributeType":"null","col":0,"comment":"null","endLoc":22,"id":13038,"name":"HMS_RE","nodeType":"Attribute","startLoc":22,"text":"HMS_RE"},{"col":4,"comment":"null","endLoc":39,"header":"def set_minpad(self, minpad)","id":13039,"name":"set_minpad","nodeType":"Function","startLoc":38,"text":"def set_minpad(self, minpad):\n        self._minpad = minpad"},{"col":4,"comment":"null","endLoc":125,"header":"def draw(self, renderer, bboxes, ticklabels_bbox_list, visible_ticks)","id":13040,"name":"draw","nodeType":"Function","startLoc":41,"text":"def draw(self, renderer, bboxes, ticklabels_bbox_list, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\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_disp, y_disp = self._frame[axis].pixel[:, 0], self._frame[axis].pixel[:, 1]\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._frame[axis].normal_angle[imin] + 180.\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:\n                    ticklabels_bbox = mtransforms.Bbox.union(ticklabels_bbox_list)\n                else:\n                    ticklabels_bbox = None\n\n                if axis == 'l':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        left = ticklabels_bbox.xmin\n                    else:\n                        left = xcen\n                    xpos = left - padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'r':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        right = ticklabels_bbox.x1\n                    else:\n                        right = xcen\n                    xpos = right + padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'b':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        bottom = ticklabels_bbox.ymin\n                    else:\n                        bottom = ycen\n                    ypos = bottom - padding\n                    self.set_position((xcen, ypos))\n\n                elif axis == 't':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        top = ticklabels_bbox.y1\n                    else:\n                        top = ycen\n                    ypos = top + padding\n                    self.set_position((xcen, ypos))\n\n            else:  # arbitrary axis\n\n                dx = np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                dy = np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n                self.set_position((xcen + dx, ycen + dy))\n\n            super().draw(renderer)\n\n            bb = super().get_window_extent(renderer)\n            bboxes.append(bb)"},{"attributeType":"null","col":0,"comment":"null","endLoc":23,"id":13041,"name":"DDEC_RE","nodeType":"Attribute","startLoc":23,"text":"DDEC_RE"},{"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    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.\n    slice : 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    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":161,"id":13042,"nodeType":"Class","startLoc":12,"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    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.\n    slice : 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    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, wcs=None, transform=None, coord_meta=None,\n                 slice=None, frame_class=RectangularFrame,\n                 previous_frame_path=None):\n\n        # Keep track of parent axes and WCS\n        self._axes = axes\n\n        if wcs is None:\n            if transform is None:\n                raise ValueError(\"Either `wcs` or `transform` are required\")\n            if coord_meta is None:\n                raise ValueError(\"`coord_meta` is required when \"\n                                 \"`transform` is passed\")\n            self._transform = transform\n            naxis = 2\n        else:\n            if transform is not None:\n                raise ValueError(\"Cannot specify both `wcs` and `transform`\")\n            if coord_meta is not None:\n                raise ValueError(\"Cannot pass `coord_meta` if passing `wcs`\")\n            self._transform = WCSPixel2WorldTransform(wcs, slice=slice)\n            naxis = wcs.wcs.naxis\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        for coord_index in range(naxis):\n\n            # Extract coordinate metadata from WCS object or transform\n            if wcs is not None:\n                coord_type, coord_wrap = coord_type_from_ctype(wcs.wcs.ctype[coord_index])\n                coord_unit = wcs.wcs.cunit[coord_index]\n                name = wcs.wcs.ctype[coord_index][:4].replace('-', '')\n            else:\n                try:\n                    coord_type = coord_meta['type'][coord_index]\n                    coord_wrap = coord_meta['wrap'][coord_index]\n                    coord_unit = coord_meta['unit'][coord_index]\n                    name = coord_meta['name'][coord_index]\n                except IndexError:\n                    raise ValueError(\"coord_meta items should have a length of {0}\".format(len(wcs.wcs.naxis)))\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                                                 frame=self.frame))\n\n            # Set up aliases for coordinates\n            self._aliases[name.lower()] = coord_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 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='lines', **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.\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        ymin, ymax = self._axes.get_ylim()\n        return find_coordinate_range(self._transform,\n                                     [xmin, xmax, ymin, ymax],\n                                     [coord.coord_type for coord in self],\n                                     [coord.coord_unit for coord in self])"},{"col":0,"comment":"null","endLoc":31,"header":"def wrap_angle_at(values, coord_wrap)","id":13043,"name":"wrap_angle_at","nodeType":"Function","startLoc":27,"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":0,"comment":"null","endLoc":24,"id":13044,"name":"DMIN_RE","nodeType":"Attribute","startLoc":24,"text":"DMIN_RE"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":13045,"name":"DSEC_RE","nodeType":"Attribute","startLoc":25,"text":"DSEC_RE"},{"col":4,"comment":"null","endLoc":117,"header":"def __init__(self, axes, wcs=None, transform=None, coord_meta=None,\n                 slice=None, frame_class=RectangularFrame,\n                 previous_frame_path=None)","id":13046,"name":"__init__","nodeType":"Function","startLoc":62,"text":"def __init__(self, axes, wcs=None, transform=None, coord_meta=None,\n                 slice=None, frame_class=RectangularFrame,\n                 previous_frame_path=None):\n\n        # Keep track of parent axes and WCS\n        self._axes = axes\n\n        if wcs is None:\n            if transform is None:\n                raise ValueError(\"Either `wcs` or `transform` are required\")\n            if coord_meta is None:\n                raise ValueError(\"`coord_meta` is required when \"\n                                 \"`transform` is passed\")\n            self._transform = transform\n            naxis = 2\n        else:\n            if transform is not None:\n                raise ValueError(\"Cannot specify both `wcs` and `transform`\")\n            if coord_meta is not None:\n                raise ValueError(\"Cannot pass `coord_meta` if passing `wcs`\")\n            self._transform = WCSPixel2WorldTransform(wcs, slice=slice)\n            naxis = wcs.wcs.naxis\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        for coord_index in range(naxis):\n\n            # Extract coordinate metadata from WCS object or transform\n            if wcs is not None:\n                coord_type, coord_wrap = coord_type_from_ctype(wcs.wcs.ctype[coord_index])\n                coord_unit = wcs.wcs.cunit[coord_index]\n                name = wcs.wcs.ctype[coord_index][:4].replace('-', '')\n            else:\n                try:\n                    coord_type = coord_meta['type'][coord_index]\n                    coord_wrap = coord_meta['wrap'][coord_index]\n                    coord_unit = coord_meta['unit'][coord_index]\n                    name = coord_meta['name'][coord_index]\n                except IndexError:\n                    raise ValueError(\"coord_meta items should have a length of {0}\".format(len(wcs.wcs.naxis)))\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                                                 frame=self.frame))\n\n            # Set up aliases for coordinates\n            self._aliases[name.lower()] = coord_index"},{"col":4,"comment":"\n        Set the separator to use for the angle major tick labels.\n\n        Parameters\n        ----------\n        separator : The separator between numbers in sexagesimal\n        representation. Can be either a string or a tuple.\n        ","endLoc":247,"header":"def set_separator(self, separator)","id":13047,"name":"set_separator","nodeType":"Function","startLoc":233,"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 : The separator between numbers in sexagesimal\n        representation. Can be either a string or a tuple.\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) or isinstance(separator, tuple):\n            self._formatter_locator.sep = separator\n        else:\n            raise TypeError(\"separator should be a string or a tuple\")"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":13048,"name":"SCAL_RE","nodeType":"Attribute","startLoc":26,"text":"SCAL_RE"},{"col":0,"comment":"","endLoc":11,"header":"formatter_locator.py#<anonymous>","id":13049,"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)+)?$')"},{"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        ","endLoc":260,"header":"def set_format_unit(self, unit)","id":13050,"name":"set_format_unit","nodeType":"Function","startLoc":249,"text":"def set_format_unit(self, unit):\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        \"\"\"\n        if not issubclass(unit.__class__, u.UnitBase):\n            raise TypeError(\"unit should be an astropy UnitBase subclass\")\n        self._formatter_locator.format_unit = 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\n            A valid Matplotlib color for the ticks\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\n        ","endLoc":309,"header":"def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, exclude_overlapping=False)","id":13051,"name":"set_ticks","nodeType":"Function","startLoc":262,"text":"def set_ticks(self, values=None, spacing=None, number=None, size=None,\n                  width=None, color=None, alpha=None, exclude_overlapping=False):\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\n            A valid Matplotlib color for the ticks\n        exclude_overlapping : bool, optional\n            Whether to exclude tick labels that overlap over each other.\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        self.ticklabels.set_exclude_overlapping(exclude_overlapping)"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":13052,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"fileName":"transforms.py","filePath":"astropy/visualization/wcsaxes","id":13053,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n# Note: This file incldues code dervived 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 ... import units as u\nfrom ...wcs import WCS\nfrom ...wcs.utils import wcs_to_celestial_frame\nfrom ...coordinates import (SkyCoord, frame_transform_graph,\n                            SphericalRepresentation,\n                            UnitSphericalRepresentation,\n                            BaseCoordinateFrame)\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    @abc.abstractmethod\n    def transform(self, input):\n        raise NotImplementedError(\"\")\n\n    @abc.abstractmethod\n    def inverted(self):\n        raise NotImplementedError(\"\")\n\n\nclass WCSWorld2PixelTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from world to pixel coordinates\n    \"\"\"\n\n    def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        if self.wcs.wcs.naxis > 2:\n            if slice is None:\n                raise ValueError(\"WCS has more than 2 dimensions, so ``slice`` should be set\")\n            elif len(slice) != self.wcs.wcs.naxis:\n                raise ValueError(\"slice should have as many elements as WCS \"\n                                 \"has dimensions (should be {0})\".format(self.wcs.wcs.naxis))\n            else:\n                self.slice = slice\n                self.x_index = slice.index('x')\n                self.y_index = slice.index('y')\n        else:\n            self.slice = None\n\n    @property\n    def input_dims(self):\n        return self.wcs.wcs.naxis\n\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 in the WCS. This then returns the (x, y) pixel coordinates\n        as a Nx2 array.\n        \"\"\"\n\n        if world.shape[1] != self.wcs.wcs.naxis:\n            raise ValueError(\"Second dimension of input values should match number of WCS coordinates\")\n\n        if world.shape[0] == 0:\n            pixel = np.zeros((0, 2))\n        else:\n            pixel = self.wcs.wcs_world2pix(world, 1) - 1\n\n        if self.slice is None:\n            return pixel\n        else:\n            return pixel[:, (self.x_index, self.y_index)]\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, slice=self.slice)\n\n\nclass WCSPixel2WorldTransform(CurvedTransform):\n    \"\"\"\n    WCS transformation from pixel to world coordinates\n    \"\"\"\n\n    def __init__(self, wcs, slice=None):\n        super().__init__()\n        self.wcs = wcs\n        self.slice = slice\n        if self.slice is not None:\n            self.x_index = slice.index('x')\n            self.y_index = slice.index('y')\n\n    @property\n    def output_dims(self):\n        return self.wcs.wcs.naxis\n\n    def get_coord_slices(self, xmin, xmax, ymin, ymax, nx, ny):\n        \"\"\"\n        Get a coordinate slice\n        \"\"\"\n        x = np.linspace(xmin, xmax, nx)\n        y = np.linspace(ymin, ymax, ny)\n        Y, X = np.meshgrid(y, x)\n        pixel = np.array([X.ravel(), Y.ravel()]).transpose()\n        world = self.transform(pixel)\n        return X, Y, [world[:, i].reshape(nx, ny).transpose() for i in range(self.wcs.wcs.naxis)]\n\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 in\n        the WCS\n        \"\"\"\n\n        if self.slice is None:\n            pixel_full = pixel.copy()\n        else:\n            pixel_full = []\n            for index in self.slice:\n                if index == 'x':\n                    pixel_full.append(pixel[:, 0])\n                elif index == 'y':\n                    pixel_full.append(pixel[:, 1])\n                else:\n                    pixel_full.append(index)\n            pixel_full = np.array(np.broadcast_arrays(*pixel_full)).transpose()\n\n        pixel_full += 1\n\n        if pixel_full.shape[0] == 0:\n            world = np.zeros((0, 2))\n        else:\n            world = self.wcs.wcs_pix2world(pixel_full, 1)\n\n        # At the moment, one has to manually check that the transformation\n        # round-trips, otherwise it should be considered invalid.\n        pixel_check = self.wcs.wcs_world2pix(world, 1)\n        with np.errstate(invalid='ignore'):\n            invalid = np.any(np.abs(pixel_check - pixel_full) > 1., axis=1)\n        world[invalid] = np.nan\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, slice=self.slice)\n\n\nclass CoordinateTransform(CurvedTransform):\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, WCS):\n            self.input_system = wcs_to_celestial_frame(self._input_system_name)\n        elif isinstance(self._input_system_name, str):\n            self.input_system = frame_transform_graph.lookup_name(self._input_system_name)\n            if self.input_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._input_system_name))\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, WCS):\n            self.output_system = wcs_to_celestial_frame(self._output_system_name)\n        elif isinstance(self._output_system_name, str):\n            self.output_system = frame_transform_graph.lookup_name(self._output_system_name)\n            if self.output_system is None:\n                raise ValueError(\"Frame {0} not found\".format(self._output_system_name))\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        x_in, y_in = input_coords[:, 0], input_coords[:, 1]\n\n        c_in = SkyCoord(x_in, y_in, unit=(u.deg, u.deg),\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        if issubclass(c_out.representation, (SphericalRepresentation, UnitSphericalRepresentation)):\n            lon = c_out.data.lon.deg\n            lat = c_out.data.lat.deg\n        else:\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":11,"id":13054,"name":"ROUND_TRIP_TOL","nodeType":"Attribute","startLoc":11,"text":"ROUND_TRIP_TOL"},{"attributeType":"null","col":0,"comment":"null","endLoc":14,"id":13055,"name":"DISCONT_FACTOR","nodeType":"Attribute","startLoc":14,"text":"DISCONT_FACTOR"},{"col":0,"comment":"","endLoc":4,"header":"grid_paths.py#<anonymous>","id":13056,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"ROUND_TRIP_TOL = 1e-1\n\nDISCONT_FACTOR = 10."},{"fileName":"axislabels.py","filePath":"astropy/visualization/wcsaxes","id":13057,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\nimport numpy as np\n\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        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\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 draw(self, renderer, bboxes, ticklabels_bbox_list, visible_ticks):\n\n        if not self.get_visible():\n            return\n\n        text_size = renderer.points_to_pixels(self.get_size())\n\n        for axis in self.get_visible_axes():\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_disp, y_disp = self._frame[axis].pixel[:, 0], self._frame[axis].pixel[:, 1]\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._frame[axis].normal_angle[imin] + 180.\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:\n                    ticklabels_bbox = mtransforms.Bbox.union(ticklabels_bbox_list)\n                else:\n                    ticklabels_bbox = None\n\n                if axis == 'l':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        left = ticklabels_bbox.xmin\n                    else:\n                        left = xcen\n                    xpos = left - padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'r':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        right = ticklabels_bbox.x1\n                    else:\n                        right = xcen\n                    xpos = right + padding\n                    self.set_position((xpos, ycen))\n\n                elif axis == 'b':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        bottom = ticklabels_bbox.ymin\n                    else:\n                        bottom = ycen\n                    ypos = bottom - padding\n                    self.set_position((xcen, ypos))\n\n                elif axis == 't':\n                    if axis in visible_ticks and ticklabels_bbox is not None:\n                        top = ticklabels_bbox.y1\n                    else:\n                        top = ycen\n                    ypos = top + padding\n                    self.set_position((xcen, ypos))\n\n            else:  # arbitrary axis\n\n                dx = np.cos(np.radians(normal_angle)) * (padding + text_size * 1.5)\n                dy = np.sin(np.radians(normal_angle)) * (padding + text_size * 1.5)\n\n                self.set_position((xcen + dx, ycen + dy))\n\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":13058,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\n\nfrom .coordinate_helpers import CoordinateHelper\nfrom .transforms import WCSPixel2WorldTransform\nfrom .utils import coord_type_from_ctype\nfrom .frame import RectangularFrame\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    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.\n    slice : 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    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, wcs=None, transform=None, coord_meta=None,\n                 slice=None, frame_class=RectangularFrame,\n                 previous_frame_path=None):\n\n        # Keep track of parent axes and WCS\n        self._axes = axes\n\n        if wcs is None:\n            if transform is None:\n                raise ValueError(\"Either `wcs` or `transform` are required\")\n            if coord_meta is None:\n                raise ValueError(\"`coord_meta` is required when \"\n                                 \"`transform` is passed\")\n            self._transform = transform\n            naxis = 2\n        else:\n            if transform is not None:\n                raise ValueError(\"Cannot specify both `wcs` and `transform`\")\n            if coord_meta is not None:\n                raise ValueError(\"Cannot pass `coord_meta` if passing `wcs`\")\n            self._transform = WCSPixel2WorldTransform(wcs, slice=slice)\n            naxis = wcs.wcs.naxis\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        for coord_index in range(naxis):\n\n            # Extract coordinate metadata from WCS object or transform\n            if wcs is not None:\n                coord_type, coord_wrap = coord_type_from_ctype(wcs.wcs.ctype[coord_index])\n                coord_unit = wcs.wcs.cunit[coord_index]\n                name = wcs.wcs.ctype[coord_index][:4].replace('-', '')\n            else:\n                try:\n                    coord_type = coord_meta['type'][coord_index]\n                    coord_wrap = coord_meta['wrap'][coord_index]\n                    coord_unit = coord_meta['unit'][coord_index]\n                    name = coord_meta['name'][coord_index]\n                except IndexError:\n                    raise ValueError(\"coord_meta items should have a length of {0}\".format(len(wcs.wcs.naxis)))\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                                                 frame=self.frame))\n\n            # Set up aliases for coordinates\n            self._aliases[name.lower()] = coord_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 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='lines', **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.\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        ymin, ymax = self._axes.get_ylim()\n        return find_coordinate_range(self._transform,\n                                     [xmin, xmax, ymin, ymax],\n                                     [coord.coord_type for coord in self],\n                                     [coord.coord_unit for coord in self])\n"},{"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":323,"header":"def set_ticks_position(self, position)","id":13059,"name":"set_ticks_position","nodeType":"Function","startLoc":311,"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":"\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":335,"header":"def set_ticks_visible(self, visible)","id":13060,"name":"set_ticks_visible","nodeType":"Function","startLoc":325,"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        kwargs\n            Keyword arguments 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":348,"header":"def set_ticklabel(self, **kwargs)","id":13061,"name":"set_ticklabel","nodeType":"Function","startLoc":337,"text":"def set_ticklabel(self, **kwargs):\n        \"\"\"\n        Set the visual properties for the tick labels.\n\n        Parameters\n        ----------\n        kwargs\n            Keyword arguments 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        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":362,"header":"def set_ticklabel_position(self, position)","id":13062,"name":"set_ticklabel_position","nodeType":"Function","startLoc":350,"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":374,"header":"def set_ticklabel_visible(self, visible)","id":13063,"name":"set_ticklabel_visible","nodeType":"Function","startLoc":364,"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":393,"header":"def set_axislabel(self, text, minpad=1, **kwargs)","id":13064,"name":"set_axislabel","nodeType":"Function","startLoc":376,"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        self.axislabels.set_text(text)\n        self.axislabels.set_minpad(minpad)\n        self.axislabels.set(**kwargs)"},{"col":4,"comment":"\n        Get the text for the axis label\n\n        Returns\n        -------\n        label : str\n            The axis label\n        ","endLoc":404,"header":"def get_axislabel(self)","id":13065,"name":"get_axislabel","nodeType":"Function","startLoc":395,"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()"},{"id":13066,"name":"astropy/visualization/wcsaxes/tests","nodeType":"Package"},{"fileName":"datasets.py","filePath":"astropy/visualization/wcsaxes/tests","id":13067,"nodeType":"File","text":"# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\"\"\"Downloads the FITS files that are used in image testing and for building documentation.\n\"\"\"\n\nfrom ....utils.data import get_pkg_data_filename\nfrom ....io import fits\n\n__all__ = ['fetch_msx_hdu',\n           'fetch_rosat_hdu',\n           'fetch_twoMASS_k_hdu',\n           'fetch_l1448_co_hdu',\n           'fetch_bolocam_hdu',\n           ]\n\n\ndef fetch_hdu(filename):\n    \"\"\"\n    Download a FITS file to the cache and open HDU 0.\n    \"\"\"\n    path = get_pkg_data_filename(filename)\n    return fits.open(path)[0]\n\n\ndef fetch_msx_hdu():\n    \"\"\"Fetch the MSX example dataset HDU.\n\n    Returns\n    -------\n    hdu : `~astropy.io.fits.ImageHDU`\n        Image HDU\n    \"\"\"\n    return fetch_hdu('galactic_center/gc_msx_e.fits')\n\n\ndef fetch_rosat_hdu():\n    return fetch_hdu('allsky/allsky_rosat.fits')\n\n\ndef fetch_twoMASS_k_hdu():\n    return fetch_hdu('galactic_center/gc_2mass_k.fits')\n\n\ndef fetch_l1448_co_hdu():\n    return fetch_hdu('l1448/l1448_13co.fits')\n\n\ndef fetch_bolocam_hdu():\n    return fetch_hdu('galactic_center/gc_bolocam_gps.fits')\n"},{"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":418,"header":"def set_axislabel_position(self, position)","id":13068,"name":"set_axislabel_position","nodeType":"Function","startLoc":406,"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)"},{"col":4,"comment":"null","endLoc":422,"header":"@property\n    def locator(self)","id":13069,"name":"locator","nodeType":"Function","startLoc":420,"text":"@property\n    def locator(self):\n        return self._formatter_locator.locator"},{"col":4,"comment":"null","endLoc":426,"header":"@property\n    def formatter(self)","id":13070,"name":"formatter","nodeType":"Function","startLoc":424,"text":"@property\n    def formatter(self):\n        return self._formatter_locator.formatter"},{"col":4,"comment":"null","endLoc":455,"header":"def _draw_grid(self, renderer)","id":13071,"name":"_draw_grid","nodeType":"Function","startLoc":428,"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\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')"},{"fileName":"setup_package.py","filePath":"astropy/visualization/wcsaxes/tests","id":13072,"nodeType":"File","text":"def get_package_data():\n    return {'astropy.visualization.wcsaxes.tests': ['baseline_images/*/*.png', 'data/*']}\n"},{"col":4,"comment":"null","endLoc":586,"header":"def _update_ticks(self)","id":13073,"name":"_update_ticks","nodeType":"Function","startLoc":477,"text":"def _update_ticks(self):\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        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        # http://matplotlib.org/users/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            # 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            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            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            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_unit_scale is not None:\n                dx *= self._coord_unit_scale\n                dy *= self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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_unit_scale is not None:\n                w1 = w1 * self._coord_unit_scale\n                w2 = w2 * self._coord_unit_scale\n\n            if self.coord_type == 'longitude':\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            # 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":"null","endLoc":2,"header":"def get_package_data()","id":13074,"name":"get_package_data","nodeType":"Function","startLoc":1,"text":"def get_package_data():\n    return {'astropy.visualization.wcsaxes.tests': ['baseline_images/*/*.png', 'data/*']}"},{"col":4,"comment":"null","endLoc":123,"header":"def __getitem__(self, item)","id":13075,"name":"__getitem__","nodeType":"Function","startLoc":119,"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":161,"header":"def get_coord_range(self)","id":13076,"name":"get_coord_range","nodeType":"Function","startLoc":155,"text":"def get_coord_range(self):\n        xmin, xmax = self._axes.get_xlim()\n        ymin, ymax = self._axes.get_ylim()\n        return find_coordinate_range(self._transform,\n                                     [xmin, xmax, ymin, ymax],\n                                     [coord.coord_type for coord in self],\n                                     [coord.coord_unit for coord in self])"},{"col":4,"comment":"null","endLoc":126,"header":"def set_visible(self, visibility)","id":13077,"name":"set_visible","nodeType":"Function","startLoc":125,"text":"def set_visible(self, visibility):\n        raise NotImplementedError()"},{"col":4,"comment":"null","endLoc":130,"header":"def __iter__(self)","id":13078,"name":"__iter__","nodeType":"Function","startLoc":128,"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.\n        ","endLoc":153,"header":"def grid(self, draw_grid=True, grid_type='lines', **kwargs)","id":13079,"name":"grid","nodeType":"Function","startLoc":132,"text":"def grid(self, draw_grid=True, grid_type='lines', **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.\n        \"\"\"\n        for coord in self:\n            coord.grid(draw_grid=draw_grid, grid_type=grid_type, **kwargs)"},{"attributeType":"null","col":12,"comment":"null","endLoc":82,"id":13080,"name":"_transform","nodeType":"Attribute","startLoc":82,"text":"self._transform"},{"col":0,"comment":"\n    Download a FITS file to the cache and open HDU 0.\n    ","endLoc":21,"header":"def fetch_hdu(filename)","id":13081,"name":"fetch_hdu","nodeType":"Function","startLoc":16,"text":"def fetch_hdu(filename):\n    \"\"\"\n    Download a FITS file to the cache and open HDU 0.\n    \"\"\"\n    path = get_pkg_data_filename(filename)\n    return fits.open(path)[0]"},{"attributeType":"null","col":8,"comment":"null","endLoc":89,"id":13082,"name":"_aliases","nodeType":"Attribute","startLoc":89,"text":"self._aliases"},{"attributeType":"WCSAxes","col":8,"comment":"null","endLoc":67,"id":13083,"name":"_axes","nodeType":"Attribute","startLoc":67,"text":"self._axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":88,"id":13084,"name":"_coords","nodeType":"Attribute","startLoc":88,"text":"self._coords"},{"attributeType":"null","col":8,"comment":"null","endLoc":85,"id":13085,"name":"frame","nodeType":"Attribute","startLoc":85,"text":"self.frame"},{"col":4,"comment":"null","endLoc":671,"header":"def get_minor_frequency(self)","id":13086,"name":"get_minor_frequency","nodeType":"Function","startLoc":670,"text":"def get_minor_frequency(self):\n        return self.minor_frequency"},{"fileName":"__init__.py","filePath":"astropy/visualization/wcsaxes/tests","id":13087,"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.python.org/pypi/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"},{"col":0,"comment":"Fetch the MSX example dataset HDU.\n\n    Returns\n    -------\n    hdu : `~astropy.io.fits.ImageHDU`\n        Image HDU\n    ","endLoc":32,"header":"def fetch_msx_hdu()","id":13088,"name":"fetch_msx_hdu","nodeType":"Function","startLoc":24,"text":"def fetch_msx_hdu():\n    \"\"\"Fetch the MSX example dataset HDU.\n\n    Returns\n    -------\n    hdu : `~astropy.io.fits.ImageHDU`\n        Image HDU\n    \"\"\"\n    return fetch_hdu('galactic_center/gc_msx_e.fits')"},{"attributeType":"null","col":8,"comment":"null","endLoc":19,"id":13089,"name":"_frame","nodeType":"Attribute","startLoc":19,"text":"self._frame"},{"col":0,"comment":"null","endLoc":36,"header":"def fetch_rosat_hdu()","id":13090,"name":"fetch_rosat_hdu","nodeType":"Function","startLoc":35,"text":"def fetch_rosat_hdu():\n    return fetch_hdu('allsky/allsky_rosat.fits')"},{"col":0,"comment":"null","endLoc":40,"header":"def fetch_twoMASS_k_hdu()","id":13091,"name":"fetch_twoMASS_k_hdu","nodeType":"Function","startLoc":39,"text":"def fetch_twoMASS_k_hdu():\n    return fetch_hdu('galactic_center/gc_2mass_k.fits')"},{"col":0,"comment":"null","endLoc":44,"header":"def fetch_l1448_co_hdu()","id":13092,"name":"fetch_l1448_co_hdu","nodeType":"Function","startLoc":43,"text":"def fetch_l1448_co_hdu():\n    return fetch_hdu('l1448/l1448_13co.fits')"},{"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.\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":521,"id":13093,"nodeType":"Class","startLoc":30,"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.\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=RectangularFrame,\n                 **kwargs):\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        self.frame_class = frame_class\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._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 \"%s %s (pixel)\" % (x, y)\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        xw = coords[self._x_index].format_coord(world[self._x_index])\n        yw = coords[self._y_index].format_coord(world[self._y_index])\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = \"world, overlay {0}\".format(self._display_coords_index)\n\n        coord_string = \"%s %s (%s)\" % (xw, yw, 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        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.get('origin', None)\n\n        if 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                kwargs['origin'] = 'lower'\n\n        return super().imshow(X, *args, **kwargs)\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\n        matplotlib.axes.Axes.plot : 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            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.data.lon.to_value(coord.coord_unit))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.data.lat.to_value(coord.coord_unit))\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(frame0)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        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                wcs.wcs.set()\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        self.coords = CoordinatesMap(self, wcs=self.wcs, slice=slices,\n                                     transform=transform, coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\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        if slices is None:\n            self.slices = ('x', 'y')\n            self._x_index = 0\n            self._y_index = 1\n        else:\n            self.slices = slices\n            self._x_index = self.slices.index('x')\n            self._y_index = self.slices.index('y')\n\n        # Common default settings for Rectangular Frame\n        if self.frame_class is RectangularFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('b')\n                    self.coords[coord_index].set_ticklabel_position('b')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_axislabel_position('l')\n                    self.coords[coord_index].set_ticklabel_position('l')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')\n        # Common default settings for Elliptical Frame\n        elif self.frame_class is EllipticalFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('h')\n                    self.coords[coord_index].set_ticklabel_position('h')\n                    self.coords[coord_index].set_ticks_position('h')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_ticks_position('c')\n                    self.coords[coord_index].set_axislabel_position('c')\n                    self.coords[coord_index].set_ticklabel_position('c')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')\n\n    def draw(self, renderer, inframe=False):\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        # 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, inframe)\n\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        self._ticklabels_bbox = []\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=self._ticklabels_bbox)\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=self._ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)\n\n        self._drawn = True\n\n    def set_xlabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._x_index].set_axislabel(label, minpad=labelpad, **kwargs)\n\n    def set_ylabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._y_index].set_axislabel(label, minpad=labelpad, **kwargs)\n\n    def get_xlabel(self):\n        return self.coords[self._x_index].get_axislabel()\n\n    def get_ylabel(self):\n        return self.coords[self._y_index].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            coords = CoordinatesMap(self, frame, frame_class=self.frame_class)\n        else:\n            if coord_meta is None:\n                coord_meta = get_coord_meta(frame)\n            transform = self._get_transform_no_transdata(frame)\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 self.wcs is None and frame != 'pixel':\n            raise ValueError('No WCS specified, so only pixel coordinates are available')\n\n        if isinstance(frame, WCS):\n\n            coord_in = wcs_to_celestial_frame(self.wcs)\n            coord_out = wcs_to_celestial_frame(frame)\n\n            if coord_in == coord_out:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        WCSWorld2PixelTransform(frame))\n\n            else:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        CoordinateTransform(self.wcs, frame) +\n                        WCSWorld2PixelTransform(frame))\n\n        elif frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            return pixel2world + frame\n\n        else:\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            if frame == 'world':\n\n                return pixel2world\n\n            else:\n                coordinate_transform = CoordinateTransform(self.wcs, frame)\n\n                if coordinate_transform.same_frames:\n                    return pixel2world\n                else:\n                    return pixel2world + CoordinateTransform(self.wcs, frame)\n\n    def get_tightbbox(self, renderer):\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\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        \"\"\"\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')"},{"col":0,"comment":"null","endLoc":48,"header":"def fetch_bolocam_hdu()","id":13094,"name":"fetch_bolocam_hdu","nodeType":"Function","startLoc":47,"text":"def fetch_bolocam_hdu():\n    return fetch_hdu('galactic_center/gc_bolocam_gps.fits')"},{"attributeType":"null","col":0,"comment":"null","endLoc":8,"id":13095,"name":"__all__","nodeType":"Attribute","startLoc":8,"text":"__all__"},{"col":0,"comment":"","endLoc":3,"header":"datasets.py#<anonymous>","id":13096,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"Downloads the FITS files that are used in image testing and for building documentation.\n\"\"\"\n\n__all__ = ['fetch_msx_hdu',\n           'fetch_rosat_hdu',\n           'fetch_twoMASS_k_hdu',\n           'fetch_l1448_co_hdu',\n           'fetch_bolocam_hdu',\n           ]"},{"col":4,"comment":"null","endLoc":97,"header":"def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=RectangularFrame,\n                 **kwargs)","id":13097,"name":"__init__","nodeType":"Function","startLoc":77,"text":"def __init__(self, fig, rect, wcs=None, transform=None, coord_meta=None,\n                 transData=None, slices=None, frame_class=RectangularFrame,\n                 **kwargs):\n\n        super().__init__(fig, rect, **kwargs)\n        self._bboxes = []\n\n        self.frame_class = frame_class\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._drawn = False"},{"id":13098,"name":"astropy/visualization/wcsaxes/tests/data","nodeType":"Package"},{"id":13099,"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":13100,"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":13101,"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":13102,"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":13103,"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":13104,"name":"cextern","nodeType":"Package"},{"id":13105,"name":".gitignore","nodeType":"TextFile","path":"cextern","text":"!*.c\n"},{"id":13106,"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"},{"attributeType":"null","col":8,"comment":"null","endLoc":23,"id":13107,"name":"pad","nodeType":"Attribute","startLoc":23,"text":"self.pad"},{"id":13108,"name":"trim_cfitsio.sh","nodeType":"TextFile","path":"cextern","text":"#!/bin/sh\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\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 -f cfitsio/[^L]*.*\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"},{"attributeType":"null","col":8,"comment":"null","endLoc":27,"id":13109,"name":"world","nodeType":"Attribute","startLoc":27,"text":"self.world"},{"attributeType":"null","col":8,"comment":"null","endLoc":86,"id":13110,"name":"_visible_axes","nodeType":"Attribute","startLoc":86,"text":"self._visible_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":29,"id":13111,"name":"angle","nodeType":"Attribute","startLoc":29,"text":"self.angle"},{"attributeType":"null","col":8,"comment":"null","endLoc":30,"id":13112,"name":"text","nodeType":"Attribute","startLoc":30,"text":"self.text"},{"attributeType":"null","col":8,"comment":"null","endLoc":28,"id":13113,"name":"pixel","nodeType":"Attribute","startLoc":28,"text":"self.pixel"},{"attributeType":"null","col":8,"comment":"null","endLoc":31,"id":13114,"name":"disp","nodeType":"Attribute","startLoc":31,"text":"self.disp"},{"attributeType":"null","col":8,"comment":"null","endLoc":24,"id":13115,"name":"_exclude_overlapping","nodeType":"Attribute","startLoc":24,"text":"self._exclude_overlapping"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":13116,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"id":13117,"name":"cextern/erfa","nodeType":"Package"},{"id":13118,"name":"zr.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraZr(double r[3][3])\n/*\n**  - - - - - -\n**   e r a Z r\n**  - - - - - -\n**\n**  Initialize an r-matrix to the null matrix.\n**\n**  Returned:\n**     r        double[3][3]    r-matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   r[0][0] = 0.0;\n   r[0][1] = 0.0;\n   r[0][2] = 0.0;\n   r[1][0] = 0.0;\n   r[1][1] = 0.0;\n   r[1][2] = 0.0;\n   r[2][0] = 0.0;\n   r[2][1] = 0.0;\n   r[2][2] = 0.0;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":15,"id":13119,"name":"_frame","nodeType":"Attribute","startLoc":15,"text":"self._frame"},{"attributeType":"null","col":8,"comment":"null","endLoc":30,"id":13120,"name":"_visible_axes","nodeType":"Attribute","startLoc":30,"text":"self._visible_axes"},{"id":13121,"name":"nut00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNut00a(double date1, double date2, double *dpsi, double *deps)\n/*\n**  - - - - - - - - - -\n**   e r a N u t 0 0 a\n**  - - - - - - - - - -\n**\n**  Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation\n**  with free core nutation omitted).\n**\n**  Given:\n**     date1,date2   double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps     double   nutation, luni-solar + planetary (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The nutation components in longitude and obliquity are in radians\n**     and with respect to the equinox and ecliptic of date.  The\n**     obliquity at J2000.0 is assumed to be the Lieske et al. (1977)\n**     value of 84381.448 arcsec.\n**\n**     Both the luni-solar and planetary nutations are included.  The\n**     latter are due to direct planetary nutations and the\n**     perturbations of the lunar and terrestrial orbits.\n**\n**  3) The function computes the MHB2000 nutation series with the\n**     associated corrections for planetary nutations.  It is an\n**     implementation of the nutation part of the IAU 2000A precession-\n**     nutation model, formally adopted by the IAU General Assembly in\n**     2000, namely MHB2000 (Mathews et al. 2002), but with the free\n**     core nutation (FCN - see Note 4) omitted.\n**\n**  4) The full MHB2000 model also contains contributions to the\n**     nutations in longitude and obliquity due to the free-excitation\n**     of the free-core-nutation during the period 1979-2000.  These FCN\n**     terms, which are time-dependent and unpredictable, are NOT\n**     included in the present function and, if required, must be\n**     independently computed.  With the FCN corrections included, the\n**     present function delivers a pole which is at current epochs\n**     accurate to a few hundred microarcseconds.  The omission of FCN\n**     introduces further errors of about that size.\n**\n**  5) The present function provides classical nutation.  The MHB2000\n**     algorithm, from which it is adapted, deals also with (i) the\n**     offsets between the GCRS and mean poles and (ii) the adjustments\n**     in longitude and obliquity due to the changed precession rates.\n**     These additional functions, namely frame bias and precession\n**     adjustments, are supported by the ERFA functions eraBi00  and\n**     eraPr00.\n**\n**  6) The MHB2000 algorithm also provides \"total\" nutations, comprising\n**     the arithmetic sum of the frame bias, precession adjustments,\n**     luni-solar nutation and planetary nutation.  These total\n**     nutations can be used in combination with an existing IAU 1976\n**     precession implementation, such as eraPmat76,  to deliver GCRS-\n**     to-true predictions of sub-mas accuracy at current dates.\n**     However, there are three shortcomings in the MHB2000 model that\n**     must be taken into account if more accurate or definitive results\n**     are required (see Wallace 2002):\n**\n**       (i) The MHB2000 total nutations are simply arithmetic sums,\n**           yet in reality the various components are successive Euler\n**           rotations.  This slight lack of rigor leads to cross terms\n**           that exceed 1 mas after a century.  The rigorous procedure\n**           is to form the GCRS-to-true rotation matrix by applying the\n**           bias, precession and nutation in that order.\n**\n**      (ii) Although the precession adjustments are stated to be with\n**           respect to Lieske et al. (1977), the MHB2000 model does\n**           not specify which set of Euler angles are to be used and\n**           how the adjustments are to be applied.  The most literal\n**           and straightforward procedure is to adopt the 4-rotation\n**           epsilon_0, psi_A, omega_A, xi_A option, and to add DPSIPR\n**           to psi_A and DEPSPR to both omega_A and eps_A.\n**\n**     (iii) The MHB2000 model predates the determination by Chapront\n**           et al. (2002) of a 14.6 mas displacement between the\n**           J2000.0 mean equinox and the origin of the ICRS frame.  It\n**           should, however, be noted that neglecting this displacement\n**           when calculating star coordinates does not lead to a\n**           14.6 mas change in right ascension, only a small second-\n**           order distortion in the pattern of the precession-nutation\n**           effect.\n**\n**     For these reasons, the ERFA functions do not generate the \"total\n**     nutations\" directly, though they can of course easily be\n**     generated by calling eraBi00, eraPr00 and the present function\n**     and adding the results.\n**\n**  7) The MHB2000 model contains 41 instances where the same frequency\n**     appears multiple times, of which 38 are duplicates and three are\n**     triplicates.  To keep the present code close to the original MHB\n**     algorithm, this small inefficiency has not been corrected.\n**\n**  Called:\n**     eraFal03     mean anomaly of the Moon\n**     eraFaf03     mean argument of the latitude of the Moon\n**     eraFaom03    mean longitude of the Moon's ascending node\n**     eraFame03    mean longitude of Mercury\n**     eraFave03    mean longitude of Venus\n**     eraFae03     mean longitude of Earth\n**     eraFama03    mean longitude of Mars\n**     eraFaju03    mean longitude of Jupiter\n**     eraFasa03    mean longitude of Saturn\n**     eraFaur03    mean longitude of Uranus\n**     eraFapa03    general accumulated precession in longitude\n**\n**  References:\n**\n**     Chapront, J., Chapront-Touze, M. & Francou, G. 2002,\n**     Astron.Astrophys. 387, 700\n**\n**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,\n**     Astron.Astrophys. 58, 1-16\n**\n**     Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.\n**     107, B4.  The MHB_2000 code itself was obtained on 9th September\n**     2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**     Wallace, P.T., \"Software for Implementing the IAU 2000\n**     Resolutions\", in IERS Workshop 5.1 (2002)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double t, el, elp, f, d, om, arg, dp, de, sarg, carg,\n          al, af, ad, aom, alme, alve, alea, alma,\n          alju, alsa, alur, alne, apa, dpsils, depsls,\n          dpsipl, depspl;\n\n/* Units of 0.1 microarcsecond to radians */\n   const double U2R = ERFA_DAS2R / 1e7;\n\n/* ------------------------- */\n/* Luni-Solar nutation model */\n/* ------------------------- */\n\n/* The units for the sine and cosine coefficients are */\n/* 0.1 microarcsecond and the same per Julian century */\n\n   static const struct {\n      int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */\n      double sp,spt,cp;     /* longitude sin, t*sin, cos coefficients */\n      double ce,cet,se;     /* obliquity cos, t*cos, sin coefficients */\n   } xls[] = {\n\n   /* 1- 10 */\n      { 0, 0, 0, 0, 1,\n         -172064161.0, -174666.0, 33386.0, 92052331.0, 9086.0, 15377.0},\n      { 0, 0, 2,-2, 2,\n           -13170906.0, -1675.0, -13696.0, 5730336.0, -3015.0, -4587.0},\n      { 0, 0, 2, 0, 2,-2276413.0,-234.0,2796.0,978459.0,-485.0, 1374.0},\n      { 0, 0, 0, 0, 2,2074554.0, 207.0, -698.0,-897492.0,470.0, -291.0},\n      { 0, 1, 0, 0, 0,1475877.0,-3633.0,11817.0,73871.0,-184.0,-1924.0},\n      { 0, 1, 2,-2, 2,-516821.0,1226.0, -524.0,224386.0,-677.0, -174.0},\n      { 1, 0, 0, 0, 0, 711159.0,  73.0, -872.0,  -6750.0,  0.0,  358.0},\n      { 0, 0, 2, 0, 1,-387298.0,-367.0,  380.0, 200728.0, 18.0,  318.0},\n      { 1, 0, 2, 0, 2,-301461.0, -36.0,  816.0, 129025.0,-63.0,  367.0},\n      { 0,-1, 2,-2, 2, 215829.0,-494.0,  111.0, -95929.0,299.0,  132.0},\n\n   /* 11-20 */\n      { 0, 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},\n      { 1, 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},\n      { 1, 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},\n      { 0, 0, 0, 2, 0,  63384.0,  11.0, -150.0,  -1220.0,  0.0,   29.0},\n      { 0, 0, 2, 2, 2, -38571.0,  -1.0,  158.0,  16452.0,-11.0,   68.0},\n\n   /* 21-30 */\n      { 0,-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},\n      { 2, 0, 2, 0, 2, -31046.0,  -1.0,  131.0,  13238.0,-11.0,   59.0},\n      { 1, 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},\n      { 2, 0, 0, 0, 0,  29243.0,   0.0,  -74.0,   -609.0,  0.0,   13.0},\n      { 0, 0, 2, 0, 0,  25887.0,   0.0,  -66.0,   -550.0,  0.0,   11.0},\n      { 0, 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},\n      { 0, 2, 2,-2, 2, -15794.0,  72.0,  -16.0,   6850.0,-42.0,   -5.0},\n\n   /* 31-40 */\n      { 0, 0,-2, 2, 0,  21783.0,   0.0,   13.0,   -167.0,  0.0,   13.0},\n      { 1, 0, 0,-2, 1, -12873.0, -10.0,  -37.0,   6953.0,  0.0,  -14.0},\n      { 0,-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},\n      { 0, 2, 0, 0, 0,  16707.0, -85.0,  -10.0,    168.0, -1.0,   10.0},\n      { 1, 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},\n      { 0, 1, 2, 0, 2,   7566.0, -21.0,  -11.0,  -3250.0,  0.0,   -5.0},\n      { 0, 0, 2, 2, 1,  -6637.0, -11.0,   25.0,   3353.0,  0.0,   14.0},\n      { 0,-1, 2, 0, 2,  -7141.0,  21.0,    8.0,   3070.0,  0.0,    4.0},\n\n   /* 41-50 */\n      { 0, 0, 0, 2, 1,  -6302.0, -11.0,    2.0,   3272.0,  0.0,    4.0},\n      { 1, 0, 2,-2, 1,   5800.0,  10.0,    2.0,  -3045.0,  0.0,   -1.0},\n      { 2, 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},\n      { 2, 0, 2, 0, 1,  -5350.0,   0.0,   21.0,   2695.0,  0.0,   12.0},\n      { 0,-1, 2,-2, 1,  -4752.0, -11.0,   -3.0,   2719.0,  0.0,   -3.0},\n      { 0, 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},\n      { 2, 0, 0,-2, 1,   4065.0,   0.0,    6.0,  -2206.0,  0.0,    1.0},\n      { 1, 0, 0, 2, 0,   6579.0,   0.0,  -24.0,   -199.0,  0.0,    2.0},\n\n   /* 51-60 */\n      { 0, 1, 2,-2, 1,   3579.0,   0.0,    5.0,  -1900.0,  0.0,    1.0},\n      { 1,-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},\n      { 3, 0, 2, 0, 2,  -2904.0,   0.0,   15.0,   1233.0,  0.0,    7.0},\n      { 0,-1, 0, 2, 0,   4348.0,   0.0,  -10.0,    -81.0,  0.0,    2.0},\n      { 1,-1, 2, 0, 2,  -2878.0,   0.0,    8.0,   1232.0,  0.0,    4.0},\n      { 0, 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},\n      { 0,-1, 2, 2, 2,  -2647.0,   0.0,   11.0,   1129.0,  0.0,    5.0},\n\n   /* 61-70 */\n      {-2, 0, 0, 0, 1,  -2294.0,   0.0,  -10.0,   1266.0,  0.0,   -4.0},\n      { 1, 1, 2, 0, 2,   2481.0,   0.0,   -7.0,  -1062.0,  0.0,   -3.0},\n      { 2, 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},\n      { 1, 1, 0, 0, 0,  -3389.0,   0.0,    5.0,     35.0,  0.0,   -2.0},\n      { 1, 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},\n      { 1, 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},\n      { 0, 0, 2, 1, 2,   1660.0,   0.0,   -5.0,   -710.0,  0.0,   -2.0},\n\n   /* 71-80 */\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},\n      { 0,-2, 2,-2, 1,  -1283.0,   0.0,    0.0,    672.0,  0.0,    0.0},\n      { 1, 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},\n      { 1, 1, 2,-2, 2,   1290.0,   0.0,    0.0,   -556.0,  0.0,    0.0},\n      {-2, 0, 2, 4, 2,  -1214.0,   0.0,    5.0,    518.0,  0.0,    2.0},\n      {-1, 0, 4, 0, 2,   1146.0,   0.0,   -3.0,   -490.0,  0.0,   -1.0},\n      { 2, 0, 2,-2, 1,   1019.0,   0.0,   -1.0,   -527.0,  0.0,   -1.0},\n\n   /* 81-90 */\n      { 2, 0, 2, 2, 2,  -1100.0,   0.0,    9.0,    465.0,  0.0,    4.0},\n      { 1, 0, 0, 2, 1,   -970.0,   0.0,    2.0,    496.0,  0.0,    1.0},\n      { 3, 0, 0, 0, 0,   1575.0,   0.0,   -6.0,    -50.0,  0.0,    0.0},\n      { 3, 0, 2,-2, 2,    934.0,   0.0,   -3.0,   -399.0,  0.0,   -1.0},\n      { 0, 0, 4,-2, 2,    922.0,   0.0,   -1.0,   -395.0,  0.0,   -1.0},\n      { 0, 1, 2, 0, 1,    815.0,   0.0,   -1.0,   -422.0,  0.0,   -1.0},\n      { 0, 0,-2, 2, 1,    834.0,   0.0,    2.0,   -440.0,  0.0,    1.0},\n      { 0, 0, 2,-2, 3,   1248.0,   0.0,    0.0,   -170.0,  0.0,    1.0},\n      {-1, 0, 0, 4, 0,   1338.0,   0.0,   -5.0,    -39.0,  0.0,    0.0},\n      { 2, 0,-2, 0, 1,    716.0,   0.0,   -2.0,   -389.0,  0.0,   -1.0},\n\n   /* 91-100 */\n      {-2, 0, 0, 4, 0,   1282.0,   0.0,   -3.0,    -23.0,  0.0,    1.0},\n      {-1,-1, 0, 2, 1,    742.0,   0.0,    1.0,   -391.0,  0.0,    0.0},\n      {-1, 0, 0, 1, 1,   1020.0,   0.0,  -25.0,   -495.0,  0.0,  -10.0},\n      { 0, 1, 0, 0, 2,    715.0,   0.0,   -4.0,   -326.0,  0.0,    2.0},\n      { 0, 0,-2, 0, 1,   -666.0,   0.0,   -3.0,    369.0,  0.0,   -1.0},\n      { 0,-1, 2, 0, 1,   -667.0,   0.0,    1.0,    346.0,  0.0,    1.0},\n      { 0, 0, 2,-1, 2,   -704.0,   0.0,    0.0,    304.0,  0.0,    0.0},\n      { 0, 0, 2, 4, 2,   -694.0,   0.0,    5.0,    294.0,  0.0,    2.0},\n      {-2,-1, 0, 2, 0,  -1014.0,   0.0,   -1.0,      4.0,  0.0,   -1.0},\n      { 1, 1, 0,-2, 1,   -585.0,   0.0,   -2.0,    316.0,  0.0,   -1.0},\n\n   /* 101-110 */\n      {-1, 1, 0, 2, 0,   -949.0,   0.0,    1.0,      8.0,  0.0,   -1.0},\n      {-1, 1, 0, 1, 2,   -595.0,   0.0,    0.0,    258.0,  0.0,    0.0},\n      { 1,-1, 0, 0, 1,    528.0,   0.0,    0.0,   -279.0,  0.0,    0.0},\n      { 1,-1, 2, 2, 2,   -590.0,   0.0,    4.0,    252.0,  0.0,    2.0},\n      {-1, 1, 2, 2, 2,    570.0,   0.0,   -2.0,   -244.0,  0.0,   -1.0},\n      { 3, 0, 2, 0, 1,   -502.0,   0.0,    3.0,    250.0,  0.0,    2.0},\n      { 0, 1,-2, 2, 0,   -875.0,   0.0,    1.0,     29.0,  0.0,    0.0},\n      {-1, 0, 0,-2, 1,   -492.0,   0.0,   -3.0,    275.0,  0.0,   -1.0},\n      { 0, 1, 2, 2, 2,    535.0,   0.0,   -2.0,   -228.0,  0.0,   -1.0},\n      {-1,-1, 2, 2, 1,   -467.0,   0.0,    1.0,    240.0,  0.0,    1.0},\n\n   /* 111-120 */\n      { 0,-1, 0, 0, 2,    591.0,   0.0,    0.0,   -253.0,  0.0,    0.0},\n      { 1, 0, 2,-4, 1,   -453.0,   0.0,   -1.0,    244.0,  0.0,   -1.0},\n      {-1, 0,-2, 2, 0,    766.0,   0.0,    1.0,      9.0,  0.0,    0.0},\n      { 0,-1, 2, 2, 1,   -446.0,   0.0,    2.0,    225.0,  0.0,    1.0},\n      { 2,-1, 2, 0, 2,   -488.0,   0.0,    2.0,    207.0,  0.0,    1.0},\n      { 0, 0, 0, 2, 2,   -468.0,   0.0,    0.0,    201.0,  0.0,    0.0},\n      { 1,-1, 2, 0, 1,   -421.0,   0.0,    1.0,    216.0,  0.0,    1.0},\n      {-1, 1, 2, 0, 2,    463.0,   0.0,    0.0,   -200.0,  0.0,    0.0},\n      { 0, 1, 0, 2, 0,   -673.0,   0.0,    2.0,     14.0,  0.0,    0.0},\n      { 0,-1,-2, 2, 0,    658.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 121-130 */\n      { 0, 3, 2,-2, 2,   -438.0,   0.0,    0.0,    188.0,  0.0,    0.0},\n      { 0, 0, 0, 1, 1,   -390.0,   0.0,    0.0,    205.0,  0.0,    0.0},\n      {-1, 0, 2, 2, 0,    639.0, -11.0,   -2.0,    -19.0,  0.0,    0.0},\n      { 2, 1, 2, 0, 2,    412.0,   0.0,   -2.0,   -176.0,  0.0,   -1.0},\n      { 1, 1, 0, 0, 1,   -361.0,   0.0,    0.0,    189.0,  0.0,    0.0},\n      { 1, 1, 2, 0, 1,    360.0,   0.0,   -1.0,   -185.0,  0.0,   -1.0},\n      { 2, 0, 0, 2, 0,    588.0,   0.0,   -3.0,    -24.0,  0.0,    0.0},\n      { 1, 0,-2, 2, 0,   -578.0,   0.0,    1.0,      5.0,  0.0,    0.0},\n      {-1, 0, 0, 2, 2,   -396.0,   0.0,    0.0,    171.0,  0.0,    0.0},\n      { 0, 1, 0, 1, 0,    565.0,   0.0,   -1.0,     -6.0,  0.0,    0.0},\n\n   /* 131-140 */\n      { 0, 1, 0,-2, 1,   -335.0,   0.0,   -1.0,    184.0,  0.0,   -1.0},\n      {-1, 0, 2,-2, 2,    357.0,   0.0,    1.0,   -154.0,  0.0,    0.0},\n      { 0, 0, 0,-1, 1,    321.0,   0.0,    1.0,   -174.0,  0.0,    0.0},\n      {-1, 1, 0, 0, 1,   -301.0,   0.0,   -1.0,    162.0,  0.0,    0.0},\n      { 1, 0, 2,-1, 2,   -334.0,   0.0,    0.0,    144.0,  0.0,    0.0},\n      { 1,-1, 0, 2, 0,    493.0,   0.0,   -2.0,    -15.0,  0.0,    0.0},\n      { 0, 0, 0, 4, 0,    494.0,   0.0,   -2.0,    -19.0,  0.0,    0.0},\n      { 1, 0, 2, 1, 2,    337.0,   0.0,   -1.0,   -143.0,  0.0,   -1.0},\n      { 0, 0, 2, 1, 1,    280.0,   0.0,   -1.0,   -144.0,  0.0,    0.0},\n      { 1, 0, 0,-2, 2,    309.0,   0.0,    1.0,   -134.0,  0.0,    0.0},\n\n   /* 141-150 */\n      {-1, 0, 2, 4, 1,   -263.0,   0.0,    2.0,    131.0,  0.0,    1.0},\n      { 1, 0,-2, 0, 1,    253.0,   0.0,    1.0,   -138.0,  0.0,    0.0},\n      { 1, 1, 2,-2, 1,    245.0,   0.0,    0.0,   -128.0,  0.0,    0.0},\n      { 0, 0, 2, 2, 0,    416.0,   0.0,   -2.0,    -17.0,  0.0,    0.0},\n      {-1, 0, 2,-1, 1,   -229.0,   0.0,    0.0,    128.0,  0.0,    0.0},\n      {-2, 0, 2, 2, 1,    231.0,   0.0,    0.0,   -120.0,  0.0,    0.0},\n      { 4, 0, 2, 0, 2,   -259.0,   0.0,    2.0,    109.0,  0.0,    1.0},\n      { 2,-1, 0, 0, 0,    375.0,   0.0,   -1.0,     -8.0,  0.0,    0.0},\n      { 2, 1, 2,-2, 2,    252.0,   0.0,    0.0,   -108.0,  0.0,    0.0},\n      { 0, 1, 2, 1, 2,   -245.0,   0.0,    1.0,    104.0,  0.0,    0.0},\n\n   /* 151-160 */\n      { 1, 0, 4,-2, 2,    243.0,   0.0,   -1.0,   -104.0,  0.0,    0.0},\n      {-1,-1, 0, 0, 1,    208.0,   0.0,    1.0,   -112.0,  0.0,    0.0},\n      { 0, 1, 0, 2, 1,    199.0,   0.0,    0.0,   -102.0,  0.0,    0.0},\n      {-2, 0, 2, 4, 1,   -208.0,   0.0,    1.0,    105.0,  0.0,    0.0},\n      { 2, 0, 2, 0, 0,    335.0,   0.0,   -2.0,    -14.0,  0.0,    0.0},\n      { 1, 0, 0, 1, 0,   -325.0,   0.0,    1.0,      7.0,  0.0,    0.0},\n      {-1, 0, 0, 4, 1,   -187.0,   0.0,    0.0,     96.0,  0.0,    0.0},\n      {-1, 0, 4, 0, 1,    197.0,   0.0,   -1.0,   -100.0,  0.0,    0.0},\n      { 2, 0, 2, 2, 1,   -192.0,   0.0,    2.0,     94.0,  0.0,    1.0},\n      { 0, 0, 2,-3, 2,   -188.0,   0.0,    0.0,     83.0,  0.0,    0.0},\n\n   /* 161-170 */\n      {-1,-2, 0, 2, 0,    276.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 1, 0, 0, 0,   -286.0,   0.0,    1.0,      6.0,  0.0,    0.0},\n      { 0, 0, 4, 0, 2,    186.0,   0.0,   -1.0,    -79.0,  0.0,    0.0},\n      { 0, 0, 0, 0, 3,   -219.0,   0.0,    0.0,     43.0,  0.0,    0.0},\n      { 0, 3, 0, 0, 0,    276.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 2,-4, 1,   -153.0,   0.0,   -1.0,     84.0,  0.0,    0.0},\n      { 0,-1, 0, 2, 1,   -156.0,   0.0,    0.0,     81.0,  0.0,    0.0},\n      { 0, 0, 0, 4, 1,   -154.0,   0.0,    1.0,     78.0,  0.0,    0.0},\n      {-1,-1, 2, 4, 2,   -174.0,   0.0,    1.0,     75.0,  0.0,    0.0},\n      { 1, 0, 2, 4, 2,   -163.0,   0.0,    2.0,     69.0,  0.0,    1.0},\n\n   /* 171-180 */\n      {-2, 2, 0, 2, 0,   -228.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-2,-1, 2, 0, 1,     91.0,   0.0,   -4.0,    -54.0,  0.0,   -2.0},\n      {-2, 0, 0, 2, 2,    175.0,   0.0,    0.0,    -75.0,  0.0,    0.0},\n      {-1,-1, 2, 0, 2,   -159.0,   0.0,    0.0,     69.0,  0.0,    0.0},\n      { 0, 0, 4,-2, 1,    141.0,   0.0,    0.0,    -72.0,  0.0,    0.0},\n      { 3, 0, 2,-2, 1,    147.0,   0.0,    0.0,    -75.0,  0.0,    0.0},\n      {-2,-1, 0, 2, 1,   -132.0,   0.0,    0.0,     69.0,  0.0,    0.0},\n      { 1, 0, 0,-1, 1,    159.0,   0.0,  -28.0,    -54.0,  0.0,   11.0},\n      { 0,-2, 0, 2, 0,    213.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      {-2, 0, 0, 4, 1,    123.0,   0.0,    0.0,    -64.0,  0.0,    0.0},\n\n   /* 181-190 */\n      {-3, 0, 0, 0, 1,   -118.0,   0.0,   -1.0,     66.0,  0.0,    0.0},\n      { 1, 1, 2, 2, 2,    144.0,   0.0,   -1.0,    -61.0,  0.0,    0.0},\n      { 0, 0, 2, 4, 1,   -121.0,   0.0,    1.0,     60.0,  0.0,    0.0},\n      { 3, 0, 2, 2, 2,   -134.0,   0.0,    1.0,     56.0,  0.0,    1.0},\n      {-1, 1, 2,-2, 1,   -105.0,   0.0,    0.0,     57.0,  0.0,    0.0},\n      { 2, 0, 0,-4, 1,   -102.0,   0.0,    0.0,     56.0,  0.0,    0.0},\n      { 0, 0, 0,-2, 2,    120.0,   0.0,    0.0,    -52.0,  0.0,    0.0},\n      { 2, 0, 2,-4, 1,    101.0,   0.0,    0.0,    -54.0,  0.0,    0.0},\n      {-1, 1, 0, 2, 1,   -113.0,   0.0,    0.0,     59.0,  0.0,    0.0},\n      { 0, 0, 2,-1, 1,   -106.0,   0.0,    0.0,     61.0,  0.0,    0.0},\n\n   /* 191-200 */\n      { 0,-2, 2, 2, 2,   -129.0,   0.0,    1.0,     55.0,  0.0,    0.0},\n      { 2, 0, 0, 2, 1,   -114.0,   0.0,    0.0,     57.0,  0.0,    0.0},\n      { 4, 0, 2,-2, 2,    113.0,   0.0,   -1.0,    -49.0,  0.0,    0.0},\n      { 2, 0, 0,-2, 2,   -102.0,   0.0,    0.0,     44.0,  0.0,    0.0},\n      { 0, 2, 0, 0, 1,    -94.0,   0.0,    0.0,     51.0,  0.0,    0.0},\n      { 1, 0, 0,-4, 1,   -100.0,   0.0,   -1.0,     56.0,  0.0,    0.0},\n      { 0, 2, 2,-2, 1,     87.0,   0.0,    0.0,    -47.0,  0.0,    0.0},\n      {-3, 0, 0, 4, 0,    161.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-1, 1, 2, 0, 1,     96.0,   0.0,    0.0,    -50.0,  0.0,    0.0},\n      {-1,-1, 0, 4, 0,    151.0,   0.0,   -1.0,     -5.0,  0.0,    0.0},\n\n   /* 201-210 */\n      {-1,-2, 2, 2, 2,   -104.0,   0.0,    0.0,     44.0,  0.0,    0.0},\n      {-2,-1, 2, 4, 2,   -110.0,   0.0,    0.0,     48.0,  0.0,    0.0},\n      { 1,-1, 2, 2, 1,   -100.0,   0.0,    1.0,     50.0,  0.0,    0.0},\n      {-2, 1, 0, 2, 0,     92.0,   0.0,   -5.0,     12.0,  0.0,   -2.0},\n      {-2, 1, 2, 0, 1,     82.0,   0.0,    0.0,    -45.0,  0.0,    0.0},\n      { 2, 1, 0,-2, 1,     82.0,   0.0,    0.0,    -45.0,  0.0,    0.0},\n      {-3, 0, 2, 0, 1,    -78.0,   0.0,    0.0,     41.0,  0.0,    0.0},\n      {-2, 0, 2,-2, 1,    -77.0,   0.0,    0.0,     43.0,  0.0,    0.0},\n      {-1, 1, 0, 2, 2,      2.0,   0.0,    0.0,     54.0,  0.0,    0.0},\n      { 0,-1, 2,-1, 2,     94.0,   0.0,    0.0,    -40.0,  0.0,    0.0},\n\n   /* 211-220 */\n      {-1, 0, 4,-2, 2,    -93.0,   0.0,    0.0,     40.0,  0.0,    0.0},\n      { 0,-2, 2, 0, 2,    -83.0,   0.0,   10.0,     40.0,  0.0,   -2.0},\n      {-1, 0, 2, 1, 2,     83.0,   0.0,    0.0,    -36.0,  0.0,    0.0},\n      { 2, 0, 0, 0, 2,    -91.0,   0.0,    0.0,     39.0,  0.0,    0.0},\n      { 0, 0, 2, 0, 3,    128.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-2, 0, 4, 0, 2,    -79.0,   0.0,    0.0,     34.0,  0.0,    0.0},\n      {-1, 0,-2, 0, 1,    -83.0,   0.0,    0.0,     47.0,  0.0,    0.0},\n      {-1, 1, 2, 2, 1,     84.0,   0.0,    0.0,    -44.0,  0.0,    0.0},\n      { 3, 0, 0, 0, 1,     83.0,   0.0,    0.0,    -43.0,  0.0,    0.0},\n      {-1, 0, 2, 3, 2,     91.0,   0.0,    0.0,    -39.0,  0.0,    0.0},\n\n   /* 221-230 */\n      { 2,-1, 2, 0, 1,    -77.0,   0.0,    0.0,     39.0,  0.0,    0.0},\n      { 0, 1, 2, 2, 1,     84.0,   0.0,    0.0,    -43.0,  0.0,    0.0},\n      { 0,-1, 2, 4, 2,    -92.0,   0.0,    1.0,     39.0,  0.0,    0.0},\n      { 2,-1, 2, 2, 2,    -92.0,   0.0,    1.0,     39.0,  0.0,    0.0},\n      { 0, 2,-2, 2, 0,    -94.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 2,-1, 1,     68.0,   0.0,    0.0,    -36.0,  0.0,    0.0},\n      { 0,-2, 0, 0, 1,    -61.0,   0.0,    0.0,     32.0,  0.0,    0.0},\n      { 1, 0, 2,-4, 2,     71.0,   0.0,    0.0,    -31.0,  0.0,    0.0},\n      { 1,-1, 0,-2, 1,     62.0,   0.0,    0.0,    -34.0,  0.0,    0.0},\n      {-1,-1, 2, 0, 1,    -63.0,   0.0,    0.0,     33.0,  0.0,    0.0},\n\n   /* 231-240 */\n      { 1,-1, 2,-2, 2,    -73.0,   0.0,    0.0,     32.0,  0.0,    0.0},\n      {-2,-1, 0, 4, 0,    115.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 0, 0, 3, 0,   -103.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2,-1, 2, 2, 2,     63.0,   0.0,    0.0,    -28.0,  0.0,    0.0},\n      { 0, 2, 2, 0, 2,     74.0,   0.0,    0.0,    -32.0,  0.0,    0.0},\n      { 1, 1, 0, 2, 0,   -103.0,   0.0,   -3.0,      3.0,  0.0,   -1.0},\n      { 2, 0, 2,-1, 2,    -69.0,   0.0,    0.0,     30.0,  0.0,    0.0},\n      { 1, 0, 2, 1, 1,     57.0,   0.0,    0.0,    -29.0,  0.0,    0.0},\n      { 4, 0, 0, 0, 0,     94.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 2, 1, 2, 0, 1,     64.0,   0.0,    0.0,    -33.0,  0.0,    0.0},\n\n   /* 241-250 */\n      { 3,-1, 2, 0, 2,    -63.0,   0.0,    0.0,     26.0,  0.0,    0.0},\n      {-2, 2, 0, 2, 1,    -38.0,   0.0,    0.0,     20.0,  0.0,    0.0},\n      { 1, 0, 2,-3, 1,    -43.0,   0.0,    0.0,     24.0,  0.0,    0.0},\n      { 1, 1, 2,-4, 1,    -45.0,   0.0,    0.0,     23.0,  0.0,    0.0},\n      {-1,-1, 2,-2, 1,     47.0,   0.0,    0.0,    -24.0,  0.0,    0.0},\n      { 0,-1, 0,-1, 1,    -48.0,   0.0,    0.0,     25.0,  0.0,    0.0},\n      { 0,-1, 0,-2, 1,     45.0,   0.0,    0.0,    -26.0,  0.0,    0.0},\n      {-2, 0, 0, 0, 2,     56.0,   0.0,    0.0,    -25.0,  0.0,    0.0},\n      {-2, 0,-2, 2, 0,     88.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 0,-2, 4, 0,    -75.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 251-260 */\n      { 1,-2, 0, 0, 0,     85.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 0, 1, 1,     49.0,   0.0,    0.0,    -26.0,  0.0,    0.0},\n      {-1, 2, 0, 2, 0,    -74.0,   0.0,   -3.0,     -1.0,  0.0,   -1.0},\n      { 1,-1, 2,-2, 1,    -39.0,   0.0,    0.0,     21.0,  0.0,    0.0},\n      { 1, 2, 2,-2, 2,     45.0,   0.0,    0.0,    -20.0,  0.0,    0.0},\n      { 2,-1, 2,-2, 2,     51.0,   0.0,    0.0,    -22.0,  0.0,    0.0},\n      { 1, 0, 2,-1, 1,    -40.0,   0.0,    0.0,     21.0,  0.0,    0.0},\n      { 2, 1, 2,-2, 1,     41.0,   0.0,    0.0,    -21.0,  0.0,    0.0},\n      {-2, 0, 0,-2, 1,    -42.0,   0.0,    0.0,     24.0,  0.0,    0.0},\n      { 1,-2, 2, 0, 2,    -51.0,   0.0,    0.0,     22.0,  0.0,    0.0},\n\n   /* 261-270 */\n      { 0, 1, 2, 1, 1,    -42.0,   0.0,    0.0,     22.0,  0.0,    0.0},\n      { 1, 0, 4,-2, 1,     39.0,   0.0,    0.0,    -21.0,  0.0,    0.0},\n      {-2, 0, 4, 2, 2,     46.0,   0.0,    0.0,    -18.0,  0.0,    0.0},\n      { 1, 1, 2, 1, 2,    -53.0,   0.0,    0.0,     22.0,  0.0,    0.0},\n      { 1, 0, 0, 4, 0,     82.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 1, 0, 2, 2, 0,     81.0,   0.0,   -1.0,     -4.0,  0.0,    0.0},\n      { 2, 0, 2, 1, 2,     47.0,   0.0,    0.0,    -19.0,  0.0,    0.0},\n      { 3, 1, 2, 0, 2,     53.0,   0.0,    0.0,    -23.0,  0.0,    0.0},\n      { 4, 0, 2, 0, 1,    -45.0,   0.0,    0.0,     22.0,  0.0,    0.0},\n      {-2,-1, 2, 0, 0,    -44.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 271-280 */\n      { 0, 1,-2, 2, 1,    -33.0,   0.0,    0.0,     16.0,  0.0,    0.0},\n      { 1, 0,-2, 1, 0,    -61.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 0,-1,-2, 2, 1,     28.0,   0.0,    0.0,    -15.0,  0.0,    0.0},\n      { 2,-1, 0,-2, 1,    -38.0,   0.0,    0.0,     19.0,  0.0,    0.0},\n      {-1, 0, 2,-1, 2,    -33.0,   0.0,    0.0,     21.0,  0.0,    0.0},\n      { 1, 0, 2,-3, 2,    -60.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 2,-2, 3,     48.0,   0.0,    0.0,    -10.0,  0.0,    0.0},\n      { 0, 0, 2,-3, 1,     27.0,   0.0,    0.0,    -14.0,  0.0,    0.0},\n      {-1, 0,-2, 2, 1,     38.0,   0.0,    0.0,    -20.0,  0.0,    0.0},\n      { 0, 0, 2,-4, 2,     31.0,   0.0,    0.0,    -13.0,  0.0,    0.0},\n\n   /* 281-290 */\n      {-2, 1, 0, 0, 1,    -29.0,   0.0,    0.0,     15.0,  0.0,    0.0},\n      {-1, 0, 0,-1, 1,     28.0,   0.0,    0.0,    -15.0,  0.0,    0.0},\n      { 2, 0, 2,-4, 2,    -32.0,   0.0,    0.0,     15.0,  0.0,    0.0},\n      { 0, 0, 4,-4, 4,     45.0,   0.0,    0.0,     -8.0,  0.0,    0.0},\n      { 0, 0, 4,-4, 2,    -44.0,   0.0,    0.0,     19.0,  0.0,    0.0},\n      {-1,-2, 0, 2, 1,     28.0,   0.0,    0.0,    -15.0,  0.0,    0.0},\n      {-2, 0, 0, 3, 0,    -51.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0,-2, 2, 1,    -36.0,   0.0,    0.0,     20.0,  0.0,    0.0},\n      {-3, 0, 2, 2, 2,     44.0,   0.0,    0.0,    -19.0,  0.0,    0.0},\n      {-3, 0, 2, 2, 1,     26.0,   0.0,    0.0,    -14.0,  0.0,    0.0},\n\n   /* 291-300 */\n      {-2, 0, 2, 2, 0,    -60.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2,-1, 0, 0, 1,     35.0,   0.0,    0.0,    -18.0,  0.0,    0.0},\n      {-2, 1, 2, 2, 2,    -27.0,   0.0,    0.0,     11.0,  0.0,    0.0},\n      { 1, 1, 0, 1, 0,     47.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0, 1, 4,-2, 2,     36.0,   0.0,    0.0,    -15.0,  0.0,    0.0},\n      {-1, 1, 0,-2, 1,    -36.0,   0.0,    0.0,     20.0,  0.0,    0.0},\n      { 0, 0, 0,-4, 1,    -35.0,   0.0,    0.0,     19.0,  0.0,    0.0},\n      { 1,-1, 0, 2, 1,    -37.0,   0.0,    0.0,     19.0,  0.0,    0.0},\n      { 1, 1, 0, 2, 1,     32.0,   0.0,    0.0,    -16.0,  0.0,    0.0},\n      {-1, 2, 2, 2, 2,     35.0,   0.0,    0.0,    -14.0,  0.0,    0.0},\n\n   /* 301-310 */\n      { 3, 1, 2,-2, 2,     32.0,   0.0,    0.0,    -13.0,  0.0,    0.0},\n      { 0,-1, 0, 4, 0,     65.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2,-1, 0, 2, 0,     47.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0, 0, 4, 0, 1,     32.0,   0.0,    0.0,    -16.0,  0.0,    0.0},\n      { 2, 0, 4,-2, 2,     37.0,   0.0,    0.0,    -16.0,  0.0,    0.0},\n      {-1,-1, 2, 4, 1,    -30.0,   0.0,    0.0,     15.0,  0.0,    0.0},\n      { 1, 0, 0, 4, 1,    -32.0,   0.0,    0.0,     16.0,  0.0,    0.0},\n      { 1,-2, 2, 2, 2,    -31.0,   0.0,    0.0,     13.0,  0.0,    0.0},\n      { 0, 0, 2, 3, 2,     37.0,   0.0,    0.0,    -16.0,  0.0,    0.0},\n      {-1, 1, 2, 4, 2,     31.0,   0.0,    0.0,    -13.0,  0.0,    0.0},\n\n   /* 311-320 */\n      { 3, 0, 0, 2, 0,     49.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 0, 4, 2, 2,     32.0,   0.0,    0.0,    -13.0,  0.0,    0.0},\n      { 1, 1, 2, 2, 1,     23.0,   0.0,    0.0,    -12.0,  0.0,    0.0},\n      {-2, 0, 2, 6, 2,    -43.0,   0.0,    0.0,     18.0,  0.0,    0.0},\n      { 2, 1, 2, 2, 2,     26.0,   0.0,    0.0,    -11.0,  0.0,    0.0},\n      {-1, 0, 2, 6, 2,    -32.0,   0.0,    0.0,     14.0,  0.0,    0.0},\n      { 1, 0, 2, 4, 1,    -29.0,   0.0,    0.0,     14.0,  0.0,    0.0},\n      { 2, 0, 2, 4, 2,    -27.0,   0.0,    0.0,     12.0,  0.0,    0.0},\n      { 1, 1,-2, 1, 0,     30.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3, 1, 2, 1, 2,    -11.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n\n   /* 321-330 */\n      { 2, 0,-2, 0, 2,    -21.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      {-1, 0, 0, 1, 2,    -34.0,   0.0,    0.0,     15.0,  0.0,    0.0},\n      {-4, 0, 2, 2, 1,    -10.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      {-1,-1, 0, 1, 0,    -36.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0,-2, 2, 2,     -9.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 1, 0, 0,-1, 2,    -12.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 0,-1, 2,-2, 3,    -21.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      {-2, 1, 2, 0, 0,    -29.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0, 0, 2,-2, 4,    -15.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-2,-2, 0, 2, 0,    -20.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 331-340 */\n      {-2, 0,-2, 4, 0,     28.0,   0.0,    0.0,      0.0,  0.0,   -2.0},\n      { 0,-2,-2, 2, 0,     17.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 2, 0,-2, 1,    -22.0,   0.0,    0.0,     12.0,  0.0,    0.0},\n      { 3, 0, 0,-4, 1,    -14.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n      {-1, 1, 2,-2, 2,     24.0,   0.0,    0.0,    -11.0,  0.0,    0.0},\n      { 1,-1, 2,-4, 1,     11.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      { 1, 1, 0,-2, 2,     14.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      {-3, 0, 2, 0, 0,     24.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3, 0, 2, 0, 2,     18.0,   0.0,    0.0,     -8.0,  0.0,    0.0},\n      {-2, 0, 0, 1, 0,    -38.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 341-350 */\n      { 0, 0,-2, 1, 0,    -31.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3, 0, 0, 2, 1,    -16.0,   0.0,    0.0,      8.0,  0.0,    0.0},\n      {-1,-1,-2, 2, 0,     29.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 2,-4, 1,    -18.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      { 2, 1, 0,-4, 1,    -10.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 0, 2, 0,-2, 1,    -17.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      { 1, 0, 0,-3, 1,      9.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      {-2, 0, 2,-2, 2,     16.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      {-2,-1, 0, 0, 1,     22.0,   0.0,    0.0,    -12.0,  0.0,    0.0},\n      {-4, 0, 0, 2, 0,     20.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 351-360 */\n      { 1, 1, 0,-4, 1,    -13.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      {-1, 0, 2,-4, 1,    -17.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      { 0, 0, 4,-4, 1,    -14.0,   0.0,    0.0,      8.0,  0.0,    0.0},\n      { 0, 3, 2,-2, 2,      0.0,   0.0,    0.0,     -7.0,  0.0,    0.0},\n      {-3,-1, 0, 4, 0,     14.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3, 0, 0, 4, 1,     19.0,   0.0,    0.0,    -10.0,  0.0,    0.0},\n      { 1,-1,-2, 2, 0,    -34.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 0, 2, 2,    -20.0,   0.0,    0.0,      8.0,  0.0,    0.0},\n      { 1,-2, 0, 0, 1,      9.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n      { 1,-1, 0, 0, 2,    -18.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n\n   /* 361-370 */\n      { 0, 0, 0, 1, 2,     13.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      {-1,-1, 2, 0, 0,     17.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1,-2, 2,-2, 2,    -12.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 0,-1, 2,-1, 1,     15.0,   0.0,    0.0,     -8.0,  0.0,    0.0},\n      {-1, 0, 2, 0, 3,    -11.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 1, 1, 0, 0, 2,     13.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n      {-1, 1, 2, 0, 0,    -18.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 2, 0, 0, 0,    -35.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 2, 2, 0, 2,      9.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      {-1, 0, 4,-2, 1,    -19.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n\n   /* 371-380 */\n      { 3, 0, 2,-4, 2,    -26.0,   0.0,    0.0,     11.0,  0.0,    0.0},\n      { 1, 2, 2,-2, 1,      8.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 1, 0, 4,-4, 2,    -10.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      {-2,-1, 0, 4, 1,     10.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      { 0,-1, 0, 2, 2,    -21.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      {-2, 1, 0, 4, 0,    -15.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2,-1, 2, 2, 1,      9.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n      { 2, 0,-2, 2, 0,    -29.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 0, 1, 1,    -19.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      { 0, 1, 0, 2, 2,     12.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n\n   /* 381-390 */\n      { 1,-1, 2,-1, 2,     22.0,   0.0,    0.0,     -9.0,  0.0,    0.0},\n      {-2, 0, 4, 0, 1,    -10.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 2, 1, 0, 0, 1,    -20.0,   0.0,    0.0,     11.0,  0.0,    0.0},\n      { 0, 1, 2, 0, 0,    -20.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0,-1, 4,-2, 2,    -17.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n      { 0, 0, 4,-2, 4,     15.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 0, 2, 2, 0, 1,      8.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      {-3, 0, 0, 6, 0,     14.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 0, 4, 1,    -12.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      { 1,-2, 0, 2, 0,     25.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 391-400 */\n      {-1, 0, 0, 4, 2,    -13.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      {-1,-2, 2, 2, 1,    -14.0,   0.0,    0.0,      8.0,  0.0,    0.0},\n      {-1, 0, 0,-2, 2,     13.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n      { 1, 0,-2,-2, 1,    -17.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      { 0, 0,-2,-2, 1,    -12.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      {-2, 0,-2, 0, 1,    -10.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 0, 0, 0, 3, 1,     10.0,   0.0,    0.0,     -6.0,  0.0,    0.0},\n      { 0, 0, 0, 3, 0,    -15.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 1, 0, 4, 0,    -22.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 2, 2, 0,     28.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n\n   /* 401-410 */\n      {-2, 0, 2, 3, 2,     15.0,   0.0,    0.0,     -7.0,  0.0,    0.0},\n      { 1, 0, 0, 2, 2,     23.0,   0.0,    0.0,    -10.0,  0.0,    0.0},\n      { 0,-1, 2, 1, 2,     12.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n      { 3,-1, 0, 0, 0,     29.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 2, 0, 0, 1, 0,    -25.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 1,-1, 2, 0, 0,     22.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0, 2, 1, 0,    -18.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 2, 0, 3,     15.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 3, 1, 0, 0, 0,    -23.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 3,-1, 2,-2, 2,     12.0,   0.0,    0.0,     -5.0,  0.0,    0.0},\n\n   /* 411-420 */\n      { 2, 0, 2,-1, 1,     -8.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 1, 1, 2, 0, 0,    -19.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0, 4,-1, 2,    -10.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 1, 2, 2, 0, 2,     21.0,   0.0,    0.0,     -9.0,  0.0,    0.0},\n      {-2, 0, 0, 6, 0,     23.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0,-1, 0, 4, 1,    -16.0,   0.0,    0.0,      8.0,  0.0,    0.0},\n      {-2,-1, 2, 4, 1,    -19.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      { 0,-2, 2, 2, 1,    -22.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      { 0,-1, 2, 2, 0,     27.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-1, 0, 2, 3, 1,     16.0,   0.0,    0.0,     -8.0,  0.0,    0.0},\n\n   /* 421-430 */\n      {-2, 1, 2, 4, 2,     19.0,   0.0,    0.0,     -8.0,  0.0,    0.0},\n      { 2, 0, 0, 2, 2,      9.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 2,-2, 2, 0, 2,     -9.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      {-1, 1, 2, 3, 2,     -9.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 3, 0, 2,-1, 2,     -8.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 4, 0, 2,-2, 1,     18.0,   0.0,    0.0,     -9.0,  0.0,    0.0},\n      {-1, 0, 0, 6, 0,     16.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-1,-2, 2, 4, 2,    -10.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      {-3, 0, 2, 6, 2,    -23.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      {-1, 0, 2, 4, 0,     16.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n\n   /* 431-440 */\n      { 3, 0, 0, 2, 1,    -12.0,   0.0,    0.0,      6.0,  0.0,    0.0},\n      { 3,-1, 2, 0, 1,     -8.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 3, 0, 2, 0, 0,     30.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 1, 0, 4, 0, 2,     24.0,   0.0,    0.0,    -10.0,  0.0,    0.0},\n      { 5, 0, 2,-2, 2,     10.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 0,-1, 2, 4, 1,    -16.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n      { 2,-1, 2, 2, 1,    -16.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n      { 0, 1, 2, 4, 2,     17.0,   0.0,    0.0,     -7.0,  0.0,    0.0},\n      { 1,-1, 2, 4, 2,    -24.0,   0.0,    0.0,     10.0,  0.0,    0.0},\n      { 3,-1, 2, 2, 2,    -12.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n\n   /* 441-450 */\n      { 3, 0, 2, 2, 1,    -24.0,   0.0,    0.0,     11.0,  0.0,    0.0},\n      { 5, 0, 2, 0, 2,    -23.0,   0.0,    0.0,      9.0,  0.0,    0.0},\n      { 0, 0, 2, 6, 2,    -13.0,   0.0,    0.0,      5.0,  0.0,    0.0},\n      { 4, 0, 2, 2, 2,    -15.0,   0.0,    0.0,      7.0,  0.0,    0.0},\n      { 0,-1, 1,-1, 1,      0.0,   0.0,-1988.0,      0.0,  0.0,-1679.0},\n      {-1, 0, 1, 0, 3,      0.0,   0.0,  -63.0,      0.0,  0.0,  -27.0},\n      { 0,-2, 2,-2, 3,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0,-1, 0, 1,      0.0,   0.0,    5.0,      0.0,  0.0,    4.0},\n      { 2,-2, 0,-2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-1, 0, 1, 0, 2,      0.0,   0.0,  364.0,      0.0,  0.0,  176.0},\n\n   /* 451-460 */\n      {-1, 0, 1, 0, 1,      0.0,   0.0,-1044.0,      0.0,  0.0, -891.0},\n      {-1,-1, 2,-1, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-2, 2, 0, 2, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 0, 1, 0, 0,      0.0,   0.0,  330.0,      0.0,  0.0,    0.0},\n      {-4, 1, 2, 2, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-3, 0, 2, 1, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-2,-1, 2, 0, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 1, 0,-2, 1, 1,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2,-1,-2, 0, 1,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-4, 0, 2, 2, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 461-470 */\n      {-3, 1, 0, 3, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 0,-1, 2, 0,      0.0,   0.0,    5.0,      0.0,  0.0,    0.0},\n      { 0,-2, 0, 0, 2,      0.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 0,-2, 0, 0, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-3, 0, 0, 3, 0,      6.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2,-1, 0, 2, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 0,-2, 3, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-4, 0, 0, 4, 0,    -12.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 1,-2, 0, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 2,-1, 0,-2, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n\n   /* 471-480 */\n      { 0, 0, 1,-1, 0,     -5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 2, 0, 1, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 1, 2, 0, 2,     -7.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 1, 1, 0,-1, 1,      7.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 1, 0, 1,-2, 1,      0.0,   0.0,  -12.0,      0.0,  0.0,  -10.0},\n      { 0, 2, 0, 0, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 1,-1, 2,-3, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 1, 2,-1, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2, 0, 4,-2, 2,     -7.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-2, 0, 4,-2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n\n   /* 481-490 */\n      {-2,-2, 0, 2, 1,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-2, 0,-2, 4, 0,      0.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 2, 2,-4, 1,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 1, 1, 2,-4, 2,      7.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-1, 2, 2,-2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2, 0, 0,-3, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 2, 0, 0, 1,     -5.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 0, 0, 0,-2, 0,      5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 2,-2, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 1, 0, 0, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 491-500 */\n      { 0, 0, 0,-1, 2,     -8.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-2, 1, 0, 1, 0,      9.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1,-2, 0,-2, 1,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 1, 0,-2, 0, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-3, 1, 0, 2, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 1,-2, 2, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 0, 0, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-3, 0, 0, 2, 0,      5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3,-1, 0, 2, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 0, 2,-6, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n\n   /* 501-510 */\n      { 0, 1, 2,-4, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 0, 0,-4, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-2, 1, 2,-2, 1,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0,-1, 2,-4, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 0, 1, 0,-2, 2,      9.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-1, 0, 0,-2, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 0,-2,-2, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-4, 0, 2, 0, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1,-1, 0,-1, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0,-2, 0, 2,      9.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n\n   /* 511-520 */\n      {-3, 0, 0, 1, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 0,-2, 1, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 0,-2, 2, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 0, 0,-4, 2, 0,      8.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2,-1,-2, 2, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 2,-6, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 0, 2,-4, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 1, 0, 0,-4, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 2, 1, 2,-4, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 2, 1, 2,-4, 1,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n\n   /* 521-530 */\n      { 0, 1, 4,-4, 4,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 4,-4, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-1,-1,-2, 4, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-3, 0, 2, 0,      9.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 0,-2, 4, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2,-1, 0, 3, 0,     -3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0,-2, 3, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 0, 0, 3, 1,     -5.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 0,-1, 0, 1, 0,    -13.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3, 0, 2, 2, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 531-540 */\n      { 1, 1,-2, 2, 0,     10.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 1, 0, 2, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 1,-2, 2,-2, 1,     10.0,   0.0,   13.0,      6.0,  0.0,   -5.0},\n      { 0, 0, 1, 0, 2,      0.0,   0.0,   30.0,      0.0,  0.0,   14.0},\n      { 0, 0, 1, 0, 1,      0.0,   0.0, -162.0,      0.0,  0.0, -138.0},\n      { 0, 0, 1, 0, 0,      0.0,   0.0,   75.0,      0.0,  0.0,    0.0},\n      {-1, 2, 0, 2, 1,     -7.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      { 0, 0, 2, 0, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2, 0, 2, 0, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 0, 0,-1, 1,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 541-550 */\n      { 3, 0, 0,-2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 1, 0, 2,-2, 3,     -3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 2, 0, 0, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2, 0, 2,-3, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 1, 4,-2, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2,-2, 0, 4, 0,      6.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0,-3, 0, 2, 0,      9.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0,-2, 4, 0,      5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 0, 3, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 0, 0, 4, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n\n   /* 551-560 */\n      {-1, 0, 0, 3, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2,-2, 0, 0, 0,      7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1,-1, 0, 1, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 0, 0, 2, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0,-2, 2, 0, 1,     -6.0,   0.0,   -3.0,      3.0,  0.0,    1.0},\n      {-1, 0, 1, 2, 1,      0.0,   0.0,   -3.0,      0.0,  0.0,   -2.0},\n      {-1, 1, 0, 3, 0,     11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-1, 2, 1, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0,-1, 2, 0, 0,     11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 1, 2, 2, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n\n   /* 561-570 */\n      { 2,-2, 2,-2, 2,     -1.0,   0.0,    3.0,      3.0,  0.0,   -1.0},\n      { 1, 1, 0, 1, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 1, 0, 1, 0, 1,      0.0,   0.0,  -13.0,      0.0,  0.0,  -11.0},\n      { 1, 0, 1, 0, 0,      3.0,   0.0,    6.0,      0.0,  0.0,    0.0},\n      { 0, 2, 0, 2, 0,     -7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2,-1, 2,-2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 0,-1, 4,-2, 1,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 0, 0, 4,-2, 3,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 4,-2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 4, 0, 2,-4, 2,     -7.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n\n   /* 571-580 */\n      { 2, 2, 2,-2, 2,      8.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 2, 0, 4,-4, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1,-2, 0, 4, 0,     11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1,-3, 2, 2, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-3, 0, 2, 4, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-3, 0, 2,-2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1,-1, 0,-2, 1,      8.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      {-3, 0, 0, 0, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-3, 0,-2, 2, 0,     11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 0,-4, 1,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n\n   /* 581-590 */\n      {-2, 1, 0,-2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-4, 0, 0, 0, 1,     -8.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n      {-1, 0, 0,-4, 1,     -7.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-3, 0, 0,-2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 0, 3, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-1, 1, 0, 4, 1,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 1,-2, 2, 0, 1,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 0, 1, 0, 3, 0,      6.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-1, 0, 2, 2, 3,      6.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 0, 0, 2, 2, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 591-600 */\n      {-2, 0, 2, 2, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 1, 2, 2, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 3, 0, 0, 0, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2, 1, 0, 1, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2,-1, 2,-1, 2,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 0, 0, 2, 0, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 3, 0, 3,      0.0,   0.0,  -26.0,      0.0,  0.0,  -11.0},\n      { 0, 0, 3, 0, 2,      0.0,   0.0,  -10.0,      0.0,  0.0,   -5.0},\n      {-1, 2, 2, 2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-1, 0, 4, 0, 0,    -13.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 601-610 */\n      { 1, 2, 2, 0, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 3, 1, 2,-2, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 1, 1, 4,-2, 2,      7.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-2,-1, 0, 6, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0,-2, 0, 4, 0,      5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-2, 0, 0, 6, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2,-2, 2, 4, 2,     -6.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0,-3, 2, 2, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 0, 4, 2,     -7.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-1,-1, 2, 3, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 611-620 */\n      {-2, 0, 2, 4, 0,     13.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2,-1, 0, 2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 1, 0, 0, 3, 0,     -3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 0, 4, 1,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 0, 1, 0, 4, 0,    -11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1,-1, 2, 1, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 0, 0, 2, 2, 3,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 2, 2, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-1, 0, 2, 2, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-2, 0, 4, 2, 1,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n\n   /* 621-630 */\n      { 2, 1, 0, 2, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 1, 0, 2, 0,    -12.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2,-1, 2, 0, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 2, 1, 0,     -3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 1, 2, 2, 0,     -4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 0, 2, 0, 3,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 3, 0, 2, 0, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 1, 0, 2, 0, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 1, 0, 3, 0, 3,      0.0,   0.0,   -5.0,      0.0,  0.0,   -2.0},\n      { 1, 1, 2, 1, 1,     -7.0,   0.0,    0.0,      4.0,  0.0,    0.0},\n\n   /* 631-640 */\n      { 0, 2, 2, 2, 2,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 2, 1, 2, 0, 0,     -3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 0, 4,-2, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 4, 1, 2,-2, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      {-1,-1, 0, 6, 0,      3.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      {-3,-1, 2, 6, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      {-1, 0, 0, 6, 1,     -5.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-3, 0, 2, 6, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 1,-1, 0, 4, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 1,-1, 0, 4, 0,     12.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 641-650 */\n      {-2, 0, 2, 5, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 1,-2, 2, 2, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 3,-1, 0, 2, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1,-1, 2, 2, 0,      6.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0, 2, 3, 1,      5.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      {-1, 1, 2, 4, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 0, 1, 2, 3, 2,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-1, 0, 4, 2, 1,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 0, 2, 1, 1,      6.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 5, 0, 0, 0, 0,      6.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 651-660 */\n      { 2, 1, 2, 1, 2,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 1, 0, 4, 0, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 3, 1, 2, 0, 1,      7.0,   0.0,    0.0,     -4.0,  0.0,    0.0},\n      { 3, 0, 4,-2, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      {-2,-1, 2, 6, 2,     -5.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 0, 6, 0,      5.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0,-2, 2, 4, 2,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      {-2, 0, 2, 6, 1,     -6.0,   0.0,    0.0,      3.0,  0.0,    0.0},\n      { 2, 0, 0, 4, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 2, 0, 0, 4, 0,     10.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n\n   /* 661-670 */\n      { 2,-2, 2, 2, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 0, 0, 2, 4, 0,      7.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 1, 0, 2, 3, 2,      7.0,   0.0,    0.0,     -3.0,  0.0,    0.0},\n      { 4, 0, 0, 2, 0,      4.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 2, 0, 2, 2, 0,     11.0,   0.0,    0.0,      0.0,  0.0,    0.0},\n      { 0, 0, 4, 2, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 4,-1, 2, 0, 2,     -6.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 3, 0, 2, 1, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 2, 1, 2, 2, 1,      3.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 4, 1, 2, 0, 2,      5.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n\n   /* 671-678 */\n      {-1,-1, 2, 6, 2,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      {-1, 0, 2, 6, 1,     -4.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 1,-1, 2, 4, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0},\n      { 1, 1, 2, 4, 2,      4.0,   0.0,    0.0,     -2.0,  0.0,    0.0},\n      { 3, 1, 2, 2, 2,      3.0,   0.0,    0.0,     -1.0,  0.0,    0.0},\n      { 5, 0, 2, 0, 1,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 2,-1, 2, 4, 2,     -3.0,   0.0,    0.0,      1.0,  0.0,    0.0},\n      { 2, 0, 2, 4, 1,     -3.0,   0.0,    0.0,      2.0,  0.0,    0.0}\n   };\n\n/* Number of terms in the luni-solar nutation model */\n   const int NLS = (int) (sizeof xls / sizeof xls[0]);\n\n/* ------------------------ */\n/* Planetary nutation model */\n/* ------------------------ */\n\n/* The units for the sine and cosine coefficients are */\n/* 0.1 microarcsecond                                 */\n\n   static const struct {\n      int nl,               /* coefficients of l, F, D and Omega */\n          nf,\n          nd,\n          nom,\n          nme,              /* coefficients of planetary longitudes */\n          nve,\n          nea,\n          nma,\n          nju,\n          nsa,\n          nur,\n          nne,\n          npa;              /* coefficient of general precession */\n      int sp,cp;            /* longitude sin, cos coefficients */\n      int se,ce;            /* obliquity sin, cos coefficients */\n   } xpl[] = {\n\n   /* 1-10 */\n      { 0, 0, 0, 0, 0,  0,  8,-16, 4, 5, 0, 0, 0, 1440,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -8, 16,-4,-5, 0, 0, 2,   56,-117,  -42, -40},\n      { 0, 0, 0, 0, 0,  0,  8,-16, 4, 5, 0, 0, 2,  125, -43,    0, -54},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0,-1, 2, 2,    0,   5,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -4,  8,-1,-5, 0, 0, 2,    3,  -7,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  4, -8, 3, 0, 0, 0, 1,    3,   0,    0,  -2},\n      { 0, 1,-1, 1, 0,  0,  3, -8, 3, 0, 0, 0, 0, -114,   0,    0,  61},\n      {-1, 0, 0, 0, 0, 10, -3,  0, 0, 0, 0, 0, 0, -219,  89,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0,-2, 6,-3, 0, 2,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0, -462,1604,    0,   0},\n\n   /* 11-20 */\n      { 0, 1,-1, 1, 0,  0, -5,  8,-3, 0, 0, 0, 0,   99,   0,    0, -53},\n      { 0, 0, 0, 0, 0,  0, -4,  8,-3, 0, 0, 0, 1,   -3,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  4, -8, 1, 5, 0, 0, 2,    0,   6,    2,   0},\n      { 0, 0, 0, 0, 0, -5,  6,  4, 0, 0, 0, 0, 2,    3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2,-5, 0, 0, 2,  -12,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2,-5, 0, 0, 1,   14,-218,  117,   8},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 2,-5, 0, 0, 0,   31,-481, -257, -17},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2,-5, 0, 0, 0, -491, 128,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0,-2, 5, 0, 0, 0,-3084,5123, 2735,1647},\n      { 0, 0, 0, 0, 0,  0,  0,  0,-2, 5, 0, 0, 1,-1444,2409,-1286,-771},\n\n   /* 21-30 */\n      { 0, 0, 0, 0, 0,  0,  0,  0,-2, 5, 0, 0, 2,   11, -24,  -11,  -9},\n      { 2,-1,-1, 0, 0,  0,  3, -7, 0, 0, 0, 0, 0,   26,  -9,    0,   0},\n      { 1, 0,-2, 0, 0, 19,-21,  3, 0, 0, 0, 0, 0,  103, -60,    0,   0},\n      { 0, 1,-1, 1, 0,  2, -4,  0,-3, 0, 0, 0, 0,    0, -13,   -7,   0},\n      { 1, 0,-1, 1, 0,  0, -1,  0, 2, 0, 0, 0, 0,  -26, -29,  -16,  14},\n      { 0, 1,-1, 1, 0,  0, -1,  0,-4,10, 0, 0, 0,    9, -27,  -14,  -5},\n      {-2, 0, 2, 1, 0,  0,  2,  0, 0,-5, 0, 0, 0,   12,   0,    0,  -6},\n      { 0, 0, 0, 0, 0,  3, -7,  4, 0, 0, 0, 0, 0,   -7,   0,    0,   0},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 1,-1, 0, 0, 0,    0,  24,    0,   0},\n      {-2, 0, 2, 1, 0,  0,  2,  0,-2, 0, 0, 0, 0,  284,   0,    0,-151},\n\n   /* 31-40 */\n      {-1, 0, 0, 0, 0, 18,-16,  0, 0, 0, 0, 0, 0,  226, 101,    0,   0},\n      {-2, 1, 1, 2, 0,  0,  1,  0,-2, 0, 0, 0, 0,    0,  -8,   -2,   0},\n      {-1, 1,-1, 1, 0, 18,-17,  0, 0, 0, 0, 0, 0,    0,  -6,   -3,   0},\n      {-1, 0, 1, 1, 0,  0,  2, -2, 0, 0, 0, 0, 0,    5,   0,    0,  -3},\n      { 0, 0, 0, 0, 0, -8, 13,  0, 0, 0, 0, 0, 2,  -41, 175,   76,  17},\n      { 0, 2,-2, 2, 0, -8, 11,  0, 0, 0, 0, 0, 0,    0,  15,    6,   0},\n      { 0, 0, 0, 0, 0, -8, 13,  0, 0, 0, 0, 0, 1,  425, 212, -133, 269},\n      { 0, 1,-1, 1, 0, -8, 12,  0, 0, 0, 0, 0, 0, 1200, 598,  319,-641},\n      { 0, 0, 0, 0, 0,  8,-13,  0, 0, 0, 0, 0, 0,  235, 334,    0,   0},\n      { 0, 1,-1, 1, 0,  8,-14,  0, 0, 0, 0, 0, 0,   11, -12,   -7,  -6},\n\n   /* 41-50 */\n      { 0, 0, 0, 0, 0,  8,-13,  0, 0, 0, 0, 0, 1,    5,  -6,    3,   3},\n      {-2, 0, 2, 1, 0,  0,  2,  0,-4, 5, 0, 0, 0,   -5,   0,    0,   3},\n      {-2, 0, 2, 2, 0,  3, -3,  0, 0, 0, 0, 0, 0,    6,   0,    0,  -3},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-3, 1, 0, 0, 0,   15,   0,    0,   0},\n      { 0, 0, 0, 1, 0,  3, -5,  0, 2, 0, 0, 0, 0,   13,   0,    0,  -7},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-4, 3, 0, 0, 0,   -6,  -9,    0,   0},\n      { 0,-1, 1, 0, 0,  0,  0,  2, 0, 0, 0, 0, 0,  266, -78,    0,   0},\n      { 0, 0, 0, 1, 0,  0, -1,  2, 0, 0, 0, 0, 0, -460,-435, -232, 246},\n      { 0, 1,-1, 2, 0,  0, -2,  2, 0, 0, 0, 0, 0,    0,  15,    7,   0},\n      {-1, 1, 0, 1, 0,  3, -5,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   2},\n\n   /* 51-60 */\n      {-1, 0, 1, 0, 0,  3, -4,  0, 0, 0, 0, 0, 0,    0, 131,    0,   0},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-2,-2, 0, 0, 0,    4,   0,    0,   0},\n      {-2, 2, 0, 2, 0,  0, -5,  9, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 0,-1, 0, 0,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 1, 0, 0,    0,   3,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 0, 0, 2, 0,  -17, -19,  -10,   9},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 0, 2, 1,   -9, -11,    6,  -5},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 0, 2, 2,   -6,   0,    0,   3},\n      {-1, 0, 1, 0, 0,  0,  3, -4, 0, 0, 0, 0, 0,  -16,   8,    0,   0},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 0, 2, 0, 0, 0,    0,   3,    0,   0},\n\n   /* 61-70 */\n      { 0, 1,-1, 2, 0,  0, -1,  0, 0, 2, 0, 0, 0,   11,  24,   11,  -5},\n      { 0, 0, 0, 1, 0,  0, -9, 17, 0, 0, 0, 0, 0,   -3,  -4,   -2,   1},\n      { 0, 0, 0, 2, 0, -3,  5,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 1,-1, 1, 0,  0, -1,  0,-1, 2, 0, 0, 0,    0,  -8,   -4,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 1,-2, 0, 0, 0,    0,   3,    0,   0},\n      { 1, 0,-2, 0, 0, 17,-16,  0,-2, 0, 0, 0, 0,    0,   5,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 1,-3, 0, 0, 0,    0,   3,    2,   0},\n      {-2, 0, 2, 1, 0,  0,  5, -6, 0, 0, 0, 0, 0,   -6,   4,    2,   3},\n      { 0,-2, 2, 0, 0,  0,  9,-13, 0, 0, 0, 0, 0,   -3,  -5,    0,   0},\n      { 0, 1,-1, 2, 0,  0, -1,  0, 0, 1, 0, 0, 0,   -5,   0,    0,   2},\n\n   /* 71-80 */\n      { 0, 0, 0, 1, 0,  0,  0,  0, 0, 1, 0, 0, 0,    4,  24,   13,  -2},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 0, 1, 0, 0, 0,  -42,  20,    0,   0},\n      { 0,-2, 2, 0, 0,  5, -6,  0, 0, 0, 0, 0, 0,  -10, 233,    0,   0},\n      { 0,-1, 1, 1, 0,  5, -7,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n      {-2, 0, 2, 0, 0,  6, -8,  0, 0, 0, 0, 0, 0,   78, -18,    0,   0},\n      { 2, 1,-3, 1, 0, -6,  7,  0, 0, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 0, 0, 2, 0,  0,  0,  0, 1, 0, 0, 0, 0,    0,  -3,   -1,   0},\n      { 0,-1, 1, 1, 0,  0,  1,  0, 1, 0, 0, 0, 0,    0,  -4,   -2,   1},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 0, 2, 0, 0,    0,  -8,   -4,  -1},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 2, 0, 1,    0,  -5,    3,   0},\n\n   /* 81-90 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 2, 0, 2,   -7,   0,    0,   3},\n      { 0, 0, 0, 0, 0,  0, -8, 15, 0, 0, 0, 0, 2,  -14,   8,    3,   6},\n      { 0, 0, 0, 0, 0,  0, -8, 15, 0, 0, 0, 0, 1,    0,   8,   -4,   0},\n      { 0, 1,-1, 1, 0,  0, -9, 15, 0, 0, 0, 0, 0,    0,  19,   10,   0},\n      { 0, 0, 0, 0, 0,  0,  8,-15, 0, 0, 0, 0, 0,   45, -22,    0,   0},\n      { 1,-1,-1, 0, 0,  0,  8,-15, 0, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 2, 0,-2, 0, 0,  2, -5,  0, 0, 0, 0, 0, 0,    0,  -3,    0,   0},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-5, 5, 0, 0, 0,    0,   3,    0,   0},\n      { 2, 0,-2, 1, 0,  0, -6,  8, 0, 0, 0, 0, 0,    3,   5,    3,  -2},\n      { 2, 0,-2, 1, 0,  0, -2,  0, 3, 0, 0, 0, 0,   89, -16,   -9, -48},\n\n   /* 91-100 */\n      {-2, 1, 1, 0, 0,  0,  1,  0,-3, 0, 0, 0, 0,    0,   3,    0,   0},\n      {-2, 1, 1, 1, 0,  0,  1,  0,-3, 0, 0, 0, 0,   -3,   7,    4,   2},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-3, 0, 0, 0, 0, -349, -62,    0,   0},\n      {-2, 0, 2, 0, 0,  0,  6, -8, 0, 0, 0, 0, 0,  -15,  22,    0,   0},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-1,-5, 0, 0, 0,   -3,   0,    0,   0},\n      {-1, 0, 1, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,  -53,   0,    0,   0},\n      {-1, 1, 1, 1, 0,-20, 20,  0, 0, 0, 0, 0, 0,    5,   0,    0,  -3},\n      { 1, 0,-2, 0, 0, 20,-21,  0, 0, 0, 0, 0, 0,    0,  -8,    0,   0},\n      { 0, 0, 0, 1, 0,  0,  8,-15, 0, 0, 0, 0, 0,   15,  -7,   -4,  -8},\n      { 0, 2,-2, 1, 0,  0,-10, 15, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n\n   /* 101-110 */\n      { 0,-1, 1, 0, 0,  0,  1,  0, 1, 0, 0, 0, 0,  -21, -78,    0,   0},\n      { 0, 0, 0, 1, 0,  0,  0,  0, 1, 0, 0, 0, 0,   20, -70,  -37, -11},\n      { 0, 1,-1, 2, 0,  0, -1,  0, 1, 0, 0, 0, 0,    0,   6,    3,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0,-2, 4, 0, 0, 0,    5,   3,    2,  -2},\n      { 2, 0,-2, 1, 0, -6,  8,  0, 0, 0, 0, 0, 0,  -17,  -4,   -2,   9},\n      { 0,-2, 2, 1, 0,  5, -6,  0, 0, 0, 0, 0, 0,    0,   6,    3,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0,-1, 0, 0, 1,   32,  15,   -8,  17},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0,-1, 0, 0, 0,  174,  84,   45, -93},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 1, 0, 0, 0,   11,  56,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 1, 0, 0, 0,  -66, -12,   -6,  35},\n\n   /* 111-120 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 1, 0, 0, 1,   47,   8,    4, -25},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 1, 0, 0, 2,    0,   8,    4,   0},\n      { 0, 2,-2, 1, 0,  0, -9, 13, 0, 0, 0, 0, 0,   10, -22,  -12,  -5},\n      { 0, 0, 0, 1, 0,  0,  7,-13, 0, 0, 0, 0, 0,   -3,   0,    0,   2},\n      {-2, 0, 2, 0, 0,  0,  5, -6, 0, 0, 0, 0, 0,  -24,  12,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  9,-17, 0, 0, 0, 0, 0,    5,  -6,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -9, 17, 0, 0, 0, 0, 2,    3,   0,    0,  -2},\n      { 1, 0,-1, 1, 0,  0, -3,  4, 0, 0, 0, 0, 0,    4,   3,    1,  -2},\n      { 1, 0,-1, 1, 0, -3,  4,  0, 0, 0, 0, 0, 0,    0,  29,   15,   0},\n      { 0, 0, 0, 2, 0,  0, -1,  2, 0, 0, 0, 0, 0,   -5,  -4,   -2,   2},\n\n   /* 121-130 */\n      { 0,-1, 1, 1, 0,  0,  0,  2, 0, 0, 0, 0, 0,    8,  -3,   -1,  -5},\n      { 0,-2, 2, 0, 1,  0, -2,  0, 0, 0, 0, 0, 0,    0,  -3,    0,   0},\n      { 0, 0, 0, 0, 0,  3, -5,  0, 2, 0, 0, 0, 0,   10,   0,    0,   0},\n      {-2, 0, 2, 1, 0,  0,  2,  0,-3, 1, 0, 0, 0,    3,   0,    0,  -2},\n      {-2, 0, 2, 1, 0,  3, -3,  0, 0, 0, 0, 0, 0,   -5,   0,    0,   3},\n      { 0, 0, 0, 1, 0,  8,-13,  0, 0, 0, 0, 0, 0,   46,  66,   35, -25},\n      { 0,-1, 1, 0, 0,  8,-12,  0, 0, 0, 0, 0, 0,  -14,   7,    0,   0},\n      { 0, 2,-2, 1, 0, -8, 11,  0, 0, 0, 0, 0, 0,    0,   3,    2,   0},\n      {-1, 0, 1, 0, 0,  0,  2, -2, 0, 0, 0, 0, 0,   -5,   0,    0,   0},\n      {-1, 0, 0, 1, 0, 18,-16,  0, 0, 0, 0, 0, 0,  -68, -34,  -18,  36},\n\n   /* 131-140 */\n      { 0, 1,-1, 1, 0,  0, -1,  0,-1, 1, 0, 0, 0,    0,  14,    7,   0},\n      { 0, 0, 0, 1, 0,  3, -7,  4, 0, 0, 0, 0, 0,   10,  -6,   -3,  -5},\n      {-2, 1, 1, 1, 0,  0, -3,  7, 0, 0, 0, 0, 0,   -5,  -4,   -2,   3},\n      { 0, 1,-1, 2, 0,  0, -1,  0,-2, 5, 0, 0, 0,   -3,   5,    2,   1},\n      { 0, 0, 0, 1, 0,  0,  0,  0,-2, 5, 0, 0, 0,   76,  17,    9, -41},\n      { 0, 0, 0, 1, 0,  0, -4,  8,-3, 0, 0, 0, 0,   84, 298,  159, -45},\n      { 1, 0, 0, 1, 0,-10,  3,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 2,-2, 1, 0,  0, -2,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   2},\n      {-1, 0, 0, 1, 0, 10, -3,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n      { 0, 0, 0, 1, 0,  0,  4, -8, 3, 0, 0, 0, 0,  -82, 292,  156,  44},\n\n   /* 141-150 */\n      { 0, 0, 0, 1, 0,  0,  0,  0, 2,-5, 0, 0, 0,  -73,  17,    9,  39},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 2,-5, 0, 0, 0,   -9, -16,    0,   0},\n      { 2,-1,-1, 1, 0,  0,  3, -7, 0, 0, 0, 0, 0,    3,   0,   -1,  -2},\n      {-2, 0, 2, 0, 0,  0,  2,  0, 0,-5, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 1, 0, -3,  7, -4, 0, 0, 0, 0, 0,   -9,  -5,   -3,   5},\n      {-2, 0, 2, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0, -439,   0,    0,   0},\n      { 1, 0, 0, 1, 0,-18, 16,  0, 0, 0, 0, 0, 0,   57, -28,  -15, -30},\n      {-2, 1, 1, 1, 0,  0,  1,  0,-2, 0, 0, 0, 0,    0,  -6,   -3,   0},\n      { 0, 1,-1, 2, 0, -8, 12,  0, 0, 0, 0, 0, 0,   -4,   0,    0,   2},\n      { 0, 0, 0, 1, 0, -8, 13,  0, 0, 0, 0, 0, 0,  -40,  57,   30,  21},\n\n   /* 151-160 */\n      { 0, 0, 0, 0, 0,  0,  1, -2, 0, 0, 0, 0, 1,   23,   7,    3, -13},\n      { 0, 1,-1, 1, 0,  0,  0, -2, 0, 0, 0, 0, 0,  273,  80,   43,-146},\n      { 0, 0, 0, 0, 0,  0,  1, -2, 0, 0, 0, 0, 0, -449, 430,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -2,  2, 0, 0, 0, 0, 0,   -8, -47,  -25,   4},\n      { 0, 0, 0, 0, 0,  0, -1,  2, 0, 0, 0, 0, 1,    6,  47,   25,  -3},\n      {-1, 0, 1, 1, 0,  3, -4,  0, 0, 0, 0, 0, 0,    0,  23,   13,   0},\n      {-1, 0, 1, 1, 0,  0,  3, -4, 0, 0, 0, 0, 0,   -3,   0,    0,   2},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0,-2, 0, 0, 0,    3,  -4,   -2,  -2},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 2, 0, 0, 0,  -48,-110,  -59,  26},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 2, 0, 0, 1,   51, 114,   61, -27},\n\n   /* 161-170 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 2, 0, 0, 2, -133,   0,    0,  57},\n      { 0, 1,-1, 0, 0,  3, -6,  0, 0, 0, 0, 0, 0,    0,   4,    0,   0},\n      { 0, 0, 0, 1, 0, -3,  5,  0, 0, 0, 0, 0, 0,  -21,  -6,   -3,  11},\n      { 0, 1,-1, 2, 0, -3,  4,  0, 0, 0, 0, 0, 0,    0,  -3,   -1,   0},\n      { 0, 0, 0, 1, 0,  0, -2,  4, 0, 0, 0, 0, 0,  -11, -21,  -11,   6},\n      { 0, 2,-2, 1, 0, -5,  6,  0, 0, 0, 0, 0, 0,  -18,-436, -233,   9},\n      { 0,-1, 1, 0, 0,  5, -7,  0, 0, 0, 0, 0, 0,   35,  -7,    0,   0},\n      { 0, 0, 0, 1, 0,  5, -8,  0, 0, 0, 0, 0, 0,    0,   5,    3,   0},\n      {-2, 0, 2, 1, 0,  6, -8,  0, 0, 0, 0, 0, 0,   11,  -3,   -1,  -6},\n      { 0, 0, 0, 1, 0,  0, -8, 15, 0, 0, 0, 0, 0,   -5,  -3,   -1,   3},\n\n   /* 171-180 */\n      {-2, 0, 2, 1, 0,  0,  2,  0,-3, 0, 0, 0, 0,  -53,  -9,   -5,  28},\n      {-2, 0, 2, 1, 0,  0,  6, -8, 0, 0, 0, 0, 0,    0,   3,    2,   1},\n      { 1, 0,-1, 1, 0,  0, -1,  0, 1, 0, 0, 0, 0,    4,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 3,-5, 0, 0, 0,    0,  -4,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0,-1, 0, 0, 0, 0,  -50, 194,  103,  27},\n      { 0, 0, 0, 0, 0,  0,  0,  0,-1, 0, 0, 0, 1,  -13,  52,   28,   7},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 1, 0, 0, 0, 0,  -91, 248,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 1, 0, 0, 0, 1,    6,  49,   26,  -3},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 1, 0, 0, 0, 0,   -6, -47,  -25,   3},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 1, 0, 0, 0, 1,    0,   5,    3,   0},\n\n   /* 181-190 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 1, 0, 0, 0, 2,   52,  23,   10, -23},\n      { 0, 1,-1, 2, 0,  0, -1,  0, 0,-1, 0, 0, 0,   -3,   0,    0,   1},\n      { 0, 0, 0, 1, 0,  0,  0,  0, 0,-1, 0, 0, 0,    0,   5,    3,   0},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 0,-1, 0, 0, 0,   -4,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -7, 13, 0, 0, 0, 0, 2,   -4,   8,    3,   2},\n      { 0, 0, 0, 0, 0,  0,  7,-13, 0, 0, 0, 0, 0,   10,   0,    0,   0},\n      { 2, 0,-2, 1, 0,  0, -5,  6, 0, 0, 0, 0, 0,    3,   0,    0,  -2},\n      { 0, 2,-2, 1, 0,  0, -8, 11, 0, 0, 0, 0, 0,    0,   8,    4,   0},\n      { 0, 2,-2, 1,-1,  0,  2,  0, 0, 0, 0, 0, 0,    0,   8,    4,   1},\n      {-2, 0, 2, 0, 0,  0,  4, -4, 0, 0, 0, 0, 0,   -4,   0,    0,   0},\n\n   /* 191-200 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2,-2, 0, 0, 0,   -4,   0,    0,   0},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 0, 3, 0, 0, 0,   -8,   4,    2,   4},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 3, 0, 0, 1,    8,  -4,   -2,  -4},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 3, 0, 0, 2,    0,  15,    7,   0},\n      {-2, 0, 2, 0, 0,  3, -3,  0, 0, 0, 0, 0, 0, -138,   0,    0,   0},\n      { 0, 0, 0, 2, 0,  0, -4,  8,-3, 0, 0, 0, 0,    0,  -7,   -3,   0},\n      { 0, 0, 0, 2, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,  -7,   -3,   0},\n      { 2, 0,-2, 1, 0,  0, -2,  0, 2, 0, 0, 0, 0,   54,   0,    0, -29},\n      { 0, 1,-1, 2, 0,  0, -1,  0, 2, 0, 0, 0, 0,    0,  10,    4,   0},\n      { 0, 1,-1, 2, 0,  0,  0, -2, 0, 0, 0, 0, 0,   -7,   0,    0,   3},\n\n   /* 201-210 */\n      { 0, 0, 0, 1, 0,  0,  1, -2, 0, 0, 0, 0, 0,  -37,  35,   19,  20},\n      { 0,-1, 1, 0, 0,  0,  2, -2, 0, 0, 0, 0, 0,    0,   4,    0,   0},\n      { 0,-1, 1, 0, 0,  0,  1,  0, 0,-2, 0, 0, 0,   -4,   9,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -2,  0, 0, 2, 0, 0, 0,    8,   0,    0,  -4},\n      { 0, 1,-1, 1, 0,  3, -6,  0, 0, 0, 0, 0, 0,   -9, -14,   -8,   5},\n      { 0, 0, 0, 0, 0,  3, -5,  0, 0, 0, 0, 0, 1,   -3,  -9,   -5,   3},\n      { 0, 0, 0, 0, 0,  3, -5,  0, 0, 0, 0, 0, 0, -145,  47,    0,   0},\n      { 0, 1,-1, 1, 0, -3,  4,  0, 0, 0, 0, 0, 0,  -10,  40,   21,   5},\n      { 0, 0, 0, 0, 0, -3,  5,  0, 0, 0, 0, 0, 1,   11, -49,  -26,  -7},\n      { 0, 0, 0, 0, 0, -3,  5,  0, 0, 0, 0, 0, 2,-2150,   0,    0, 932},\n\n   /* 211-220 */\n      { 0, 2,-2, 2, 0, -3,  3,  0, 0, 0, 0, 0, 0,  -12,   0,    0,   5},\n      { 0, 0, 0, 0, 0, -3,  5,  0, 0, 0, 0, 0, 2,   85,   0,    0, -37},\n      { 0, 0, 0, 0, 0,  0,  2, -4, 0, 0, 0, 0, 1,    4,   0,    0,  -2},\n      { 0, 1,-1, 1, 0,  0,  1, -4, 0, 0, 0, 0, 0,    3,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  2, -4, 0, 0, 0, 0, 0,  -86, 153,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -2,  4, 0, 0, 0, 0, 1,   -6,   9,    5,   3},\n      { 0, 1,-1, 1, 0,  0, -3,  4, 0, 0, 0, 0, 0,    9, -13,   -7,  -5},\n      { 0, 0, 0, 0, 0,  0, -2,  4, 0, 0, 0, 0, 1,   -8,  12,    6,   4},\n      { 0, 0, 0, 0, 0,  0, -2,  4, 0, 0, 0, 0, 2,  -51,   0,    0,  22},\n      { 0, 0, 0, 0, 0, -5,  8,  0, 0, 0, 0, 0, 2,  -11,-268, -116,   5},\n\n   /* 221-230 */\n      { 0, 2,-2, 2, 0, -5,  6,  0, 0, 0, 0, 0, 0,    0,  12,    5,   0},\n      { 0, 0, 0, 0, 0, -5,  8,  0, 0, 0, 0, 0, 2,    0,   7,    3,   0},\n      { 0, 0, 0, 0, 0, -5,  8,  0, 0, 0, 0, 0, 1,   31,   6,    3, -17},\n      { 0, 1,-1, 1, 0, -5,  7,  0, 0, 0, 0, 0, 0,  140,  27,   14, -75},\n      { 0, 0, 0, 0, 0, -5,  8,  0, 0, 0, 0, 0, 1,   57,  11,    6, -30},\n      { 0, 0, 0, 0, 0,  5, -8,  0, 0, 0, 0, 0, 0,  -14, -39,    0,   0},\n      { 0, 1,-1, 2, 0,  0, -1,  0,-1, 0, 0, 0, 0,    0,  -6,   -2,   0},\n      { 0, 0, 0, 1, 0,  0,  0,  0,-1, 0, 0, 0, 0,    4,  15,    8,  -2},\n      { 0,-1, 1, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,    0,   4,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -2,  0, 1, 0, 0, 0, 0,   -3,   0,    0,   1},\n\n   /* 231-240 */\n      { 0, 0, 0, 0, 0,  0, -6, 11, 0, 0, 0, 0, 2,    0,  11,    5,   0},\n      { 0, 0, 0, 0, 0,  0,  6,-11, 0, 0, 0, 0, 0,    9,   6,    0,   0},\n      { 0, 0, 0, 0,-1,  0,  4,  0, 0, 0, 0, 0, 2,   -4,  10,    4,   2},\n      { 0, 0, 0, 0, 1,  0, -4,  0, 0, 0, 0, 0, 0,    5,   3,    0,   0},\n      { 2, 0,-2, 1, 0, -3,  3,  0, 0, 0, 0, 0, 0,   16,   0,    0,  -9},\n      {-2, 0, 2, 0, 0,  0,  2,  0, 0,-2, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -7,  9, 0, 0, 0, 0, 0,    0,   3,    2,  -1},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 4,-5, 0, 0, 2,    7,   0,    0,  -3},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2, 0, 0, 0, 0,  -25,  22,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2, 0, 0, 0, 1,   42, 223,  119, -22},\n\n   /* 241-250 */\n      { 0, 1,-1, 1, 0,  0, -1,  0, 2, 0, 0, 0, 0,  -27,-143,  -77,  14},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2, 0, 0, 0, 1,    9,  49,   26,  -5},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 2, 0, 0, 0, 2,-1166,   0,    0, 505},\n      { 0, 2,-2, 2, 0,  0, -2,  0, 2, 0, 0, 0, 0,   -5,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 5, 0, 0, 2,   -6,   0,    0,   3},\n      { 0, 0, 0, 1, 0,  3, -5,  0, 0, 0, 0, 0, 0,   -8,   0,    1,   4},\n      { 0,-1, 1, 0, 0,  3, -4,  0, 0, 0, 0, 0, 0,    0,  -4,    0,   0},\n      { 0, 2,-2, 1, 0, -3,  3,  0, 0, 0, 0, 0, 0,  117,   0,    0, -63},\n      { 0, 0, 0, 1, 0,  0,  2, -4, 0, 0, 0, 0, 0,   -4,   8,    4,   2},\n      { 0, 2,-2, 1, 0,  0, -4,  4, 0, 0, 0, 0, 0,    3,   0,    0,  -2},\n\n   /* 251-260 */\n      { 0, 1,-1, 2, 0, -5,  7,  0, 0, 0, 0, 0, 0,   -5,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  3, -6, 0, 0, 0, 0, 0,    0,  31,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -3,  6, 0, 0, 0, 0, 1,   -5,   0,    1,   3},\n      { 0, 1,-1, 1, 0,  0, -4,  6, 0, 0, 0, 0, 0,    4,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0, -3,  6, 0, 0, 0, 0, 1,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0, -3,  6, 0, 0, 0, 0, 2,  -24, -13,   -6,  10},\n      { 0,-1, 1, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0,    3,   0,    0,   0},\n      { 0, 0, 0, 1, 0,  2, -3,  0, 0, 0, 0, 0, 0,    0, -32,  -17,   0},\n      { 0, 0, 0, 0, 0,  0, -5,  9, 0, 0, 0, 0, 2,    8,  12,    5,  -3},\n      { 0, 0, 0, 0, 0,  0, -5,  9, 0, 0, 0, 0, 1,    3,   0,    0,  -1},\n\n   /* 261-270 */\n      { 0, 0, 0, 0, 0,  0,  5, -9, 0, 0, 0, 0, 0,    7,  13,    0,   0},\n      { 0,-1, 1, 0, 0,  0,  1,  0,-2, 0, 0, 0, 0,   -3,  16,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -2,  0, 2, 0, 0, 0, 0,   50,   0,    0, -27},\n      {-2, 1, 1, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,  -5,   -3,   0},\n      { 0,-2, 2, 0, 0,  3, -3,  0, 0, 0, 0, 0, 0,   13,   0,    0,   0},\n      { 0, 0, 0, 0, 0, -6, 10,  0, 0, 0, 0, 0, 1,    0,   5,    3,   1},\n      { 0, 0, 0, 0, 0, -6, 10,  0, 0, 0, 0, 0, 2,   24,   5,    2, -11},\n      { 0, 0, 0, 0, 0, -2,  3,  0, 0, 0, 0, 0, 2,    5, -11,   -5,  -2},\n      { 0, 0, 0, 0, 0, -2,  3,  0, 0, 0, 0, 0, 1,   30,  -3,   -2, -16},\n      { 0, 1,-1, 1, 0, -2,  2,  0, 0, 0, 0, 0, 0,   18,   0,    0,  -9},\n\n   /* 271-280 */\n      { 0, 0, 0, 0, 0,  2, -3,  0, 0, 0, 0, 0, 0,    8, 614,    0,   0},\n      { 0, 0, 0, 0, 0,  2, -3,  0, 0, 0, 0, 0, 1,    3,  -3,   -1,  -2},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 3, 0, 0, 0, 1,    6,  17,    9,  -3},\n      { 0, 1,-1, 1, 0,  0, -1,  0, 3, 0, 0, 0, 0,   -3,  -9,   -5,   2},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 3, 0, 0, 0, 1,    0,   6,    3,  -1},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 3, 0, 0, 0, 2, -127,  21,    9,  55},\n      { 0, 0, 0, 0, 0,  0,  4, -8, 0, 0, 0, 0, 0,    3,   5,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -4,  8, 0, 0, 0, 0, 2,   -6, -10,   -4,   3},\n      { 0,-2, 2, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,    5,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -4,  7, 0, 0, 0, 0, 2,   16,   9,    4,  -7},\n\n   /* 281-290 */\n      { 0, 0, 0, 0, 0,  0, -4,  7, 0, 0, 0, 0, 1,    3,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  4, -7, 0, 0, 0, 0, 0,    0,  22,    0,   0},\n      { 0, 0, 0, 1, 0, -2,  3,  0, 0, 0, 0, 0, 0,    0,  19,   10,   0},\n      { 0, 2,-2, 1, 0,  0, -2,  0, 3, 0, 0, 0, 0,    7,   0,    0,  -4},\n      { 0, 0, 0, 0, 0,  0, -5, 10, 0, 0, 0, 0, 2,    0,  -5,   -2,   0},\n      { 0, 0, 0, 1, 0, -1,  2,  0, 0, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  0, 4, 0, 0, 0, 2,   -9,   3,    1,   4},\n      { 0, 0, 0, 0, 0,  0, -3,  5, 0, 0, 0, 0, 2,   17,   0,    0,  -7},\n      { 0, 0, 0, 0, 0,  0, -3,  5, 0, 0, 0, 0, 1,    0,  -3,   -2,  -1},\n      { 0, 0, 0, 0, 0,  0,  3, -5, 0, 0, 0, 0, 0,  -20,  34,    0,   0},\n\n   /* 291-300 */\n      { 0, 0, 0, 0, 0,  1, -2,  0, 0, 0, 0, 0, 1,  -10,   0,    1,   5},\n      { 0, 1,-1, 1, 0,  1, -3,  0, 0, 0, 0, 0, 0,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  1, -2,  0, 0, 0, 0, 0, 0,   22, -87,    0,   0},\n      { 0, 0, 0, 0, 0, -1,  2,  0, 0, 0, 0, 0, 1,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0, -1,  2,  0, 0, 0, 0, 0, 2,   -3,  -6,   -2,   1},\n      { 0, 0, 0, 0, 0, -7, 11,  0, 0, 0, 0, 0, 2,  -16,  -3,   -1,   7},\n      { 0, 0, 0, 0, 0, -7, 11,  0, 0, 0, 0, 0, 1,    0,  -3,   -2,   0},\n      { 0,-2, 2, 0, 0,  4, -4,  0, 0, 0, 0, 0, 0,    4,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  2, -3, 0, 0, 0, 0, 0,  -68,  39,    0,   0},\n      { 0, 2,-2, 1, 0, -4,  4,  0, 0, 0, 0, 0, 0,   27,   0,    0, -14},\n\n   /* 301-310 */\n      { 0,-1, 1, 0, 0,  4, -5,  0, 0, 0, 0, 0, 0,    0,  -4,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1, -1, 0, 0, 0, 0, 0,  -25,   0,    0,   0},\n      { 0, 0, 0, 0, 0, -4,  7,  0, 0, 0, 0, 0, 1,  -12,  -3,   -2,   6},\n      { 0, 1,-1, 1, 0, -4,  6,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0, -4,  7,  0, 0, 0, 0, 0, 2,    3,  66,   29,  -1},\n      { 0, 0, 0, 0, 0, -4,  6,  0, 0, 0, 0, 0, 2,  490,   0,    0,-213},\n      { 0, 0, 0, 0, 0, -4,  6,  0, 0, 0, 0, 0, 1,  -22,  93,   49,  12},\n      { 0, 1,-1, 1, 0, -4,  5,  0, 0, 0, 0, 0, 0,   -7,  28,   15,   4},\n      { 0, 0, 0, 0, 0, -4,  6,  0, 0, 0, 0, 0, 1,   -3,  13,    7,   2},\n      { 0, 0, 0, 0, 0,  4, -6,  0, 0, 0, 0, 0, 0,  -46,  14,    0,   0},\n\n   /* 311-320 */\n      {-2, 0, 2, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0,   -5,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  1, 0, 0, 0, 0, 0,    2,   1,    0,   0},\n      { 0,-1, 1, 0, 0,  1,  0,  0, 0, 0, 0, 0, 0,    0,  -3,    0,   0},\n      { 0, 0, 0, 1, 0,  1, -1,  0, 0, 0, 0, 0, 0,  -28,   0,    0,  15},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 5, 0, 0, 0, 2,    5,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  1, -3, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -1,  3, 0, 0, 0, 0, 2,  -11,   0,    0,   5},\n      { 0, 0, 0, 0, 0,  0, -7, 12, 0, 0, 0, 0, 2,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0, -1,  1,  0, 0, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0, -1,  1,  0, 0, 0, 0, 0, 1,   25, 106,   57, -13},\n\n   /* 321-330 */\n      { 0, 1,-1, 1, 0, -1,  0,  0, 0, 0, 0, 0, 0,    5,  21,   11,  -3},\n      { 0, 0, 0, 0, 0,  1, -1,  0, 0, 0, 0, 0, 0, 1485,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  1, -1,  0, 0, 0, 0, 0, 1,   -7, -32,  -17,   4},\n      { 0, 1,-1, 1, 0,  1, -2,  0, 0, 0, 0, 0, 0,    0,   5,    3,   0},\n      { 0, 0, 0, 0, 0,  0, -2,  5, 0, 0, 0, 0, 2,   -6,  -3,   -2,   3},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 4, 0, 0, 0, 2,   30,  -6,   -2, -13},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-4, 0, 0, 0, 0,   -4,   4,    0,   0},\n      { 0, 0, 0, 1, 0, -1,  1,  0, 0, 0, 0, 0, 0,  -19,   0,    0,  10},\n      { 0, 0, 0, 0, 0,  0, -6, 10, 0, 0, 0, 0, 2,    0,   4,    2,  -1},\n      { 0, 0, 0, 0, 0,  0, -6, 10, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n\n   /* 331-340 */\n      { 0, 2,-2, 1, 0,  0, -3,  0, 3, 0, 0, 0, 0,    4,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0, -3,  7, 0, 0, 0, 0, 2,    0,  -3,   -1,   0},\n      {-2, 0, 2, 0, 0,  4, -4,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -5,  8, 0, 0, 0, 0, 2,    5,   3,    1,  -2},\n      { 0, 0, 0, 0, 0,  0,  5, -8, 0, 0, 0, 0, 0,    0,  11,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 3, 0, 0, 0, 2,  118,   0,    0, -52},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 3, 0, 0, 0, 1,    0,  -5,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-3, 0, 0, 0, 0,  -28,  36,    0,   0},\n      { 0, 0, 0, 0, 0,  2, -4,  0, 0, 0, 0, 0, 0,    5,  -5,    0,   0},\n      { 0, 0, 0, 0, 0, -2,  4,  0, 0, 0, 0, 0, 1,   14, -59,  -31,  -8},\n\n   /* 341-350 */\n      { 0, 1,-1, 1, 0, -2,  3,  0, 0, 0, 0, 0, 0,    0,   9,    5,   1},\n      { 0, 0, 0, 0, 0, -2,  4,  0, 0, 0, 0, 0, 2, -458,   0,    0, 198},\n      { 0, 0, 0, 0, 0, -6,  9,  0, 0, 0, 0, 0, 2,    0, -45,  -20,   0},\n      { 0, 0, 0, 0, 0, -6,  9,  0, 0, 0, 0, 0, 1,    9,   0,    0,  -5},\n      { 0, 0, 0, 0, 0,  6, -9,  0, 0, 0, 0, 0, 0,    0,  -3,    0,   0},\n      { 0, 0, 0, 1, 0,  0,  1,  0,-2, 0, 0, 0, 0,    0,  -4,   -2,  -1},\n      { 0, 2,-2, 1, 0, -2,  2,  0, 0, 0, 0, 0, 0,   11,   0,    0,  -6},\n      { 0, 0, 0, 0, 0,  0, -4,  6, 0, 0, 0, 0, 2,    6,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  4, -6, 0, 0, 0, 0, 0,  -16,  23,    0,   0},\n      { 0, 0, 0, 1, 0,  3, -4,  0, 0, 0, 0, 0, 0,    0,  -4,   -2,   0},\n\n   /* 351-360 */\n      { 0, 0, 0, 0, 0,  0, -1,  0, 2, 0, 0, 0, 2,   -5,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-2, 0, 0, 0, 0, -166, 269,    0,   0},\n      { 0, 0, 0, 1, 0,  0,  1,  0,-1, 0, 0, 0, 0,   15,   0,    0,  -8},\n      { 0, 0, 0, 0, 0, -5,  9,  0, 0, 0, 0, 0, 2,   10,   0,    0,  -4},\n      { 0, 0, 0, 0, 0,  0,  3, -4, 0, 0, 0, 0, 0,  -78,  45,    0,   0},\n      { 0, 0, 0, 0, 0, -3,  4,  0, 0, 0, 0, 0, 2,    0,  -5,   -2,   0},\n      { 0, 0, 0, 0, 0, -3,  4,  0, 0, 0, 0, 0, 1,    7,   0,    0,  -4},\n      { 0, 0, 0, 0, 0,  3, -4,  0, 0, 0, 0, 0, 0,   -5, 328,    0,   0},\n      { 0, 0, 0, 0, 0,  3, -4,  0, 0, 0, 0, 0, 1,    3,   0,    0,  -2},\n      { 0, 0, 0, 1, 0,  0,  2, -2, 0, 0, 0, 0, 0,    5,   0,    0,  -2},\n\n   /* 361-370 */\n      { 0, 0, 0, 1, 0,  0, -1,  0, 2, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0,-3, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 1,-5, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 1, 0, 0, 0, 1,    0,  -4,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,-1223, -26,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-1, 0, 0, 0, 1,    0,   7,    3,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-3, 5, 0, 0, 0,    3,   0,    0,   0},\n      { 0, 0, 0, 1, 0, -3,  4,  0, 0, 0, 0, 0, 0,    0,   3,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0,-2, 0, 0, 0,   -6,  20,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  2, -2, 0, 0, 0, 0, 0, -368,   0,    0,   0},\n\n   /* 371-380 */\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0,-1, 0, 0, 0,  -75,   0,    0,   0},\n      { 0, 0, 0, 1, 0,  0, -1,  0, 1, 0, 0, 0, 0,   11,   0,    0,  -6},\n      { 0, 0, 0, 1, 0,  0, -2,  2, 0, 0, 0, 0, 0,    3,   0,    0,  -2},\n      { 0, 0, 0, 0, 0, -8, 14,  0, 0, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 2,-5, 0, 0, 0,  -13, -30,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -8, 3, 0, 0, 0, 0,   21,   3,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -8, 3, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 0, 0, 0, 0, 1,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0, 0, 0, 0, 0,    8, -27,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  3, -8, 3, 0, 0, 0, 0,  -19, -11,    0,   0},\n\n   /* 381-390 */\n      { 0, 0, 0, 0, 0,  0, -3,  8,-3, 0, 0, 0, 2,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  1,  0,-2, 5, 0, 0, 2,    0,   5,    2,   0},\n      { 0, 0, 0, 0, 0, -8, 12,  0, 0, 0, 0, 0, 2,   -6,   0,    0,   2},\n      { 0, 0, 0, 0, 0, -8, 12,  0, 0, 0, 0, 0, 0,   -8,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 1,-2, 0, 0, 0,   -1,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0, 1, 0, 0, 2,  -14,   0,    0,   6},\n      { 0, 0, 0, 0, 0,  0,  0,  2, 0, 0, 0, 0, 0,    6,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  0,  2, 0, 0, 0, 0, 2,  -74,   0,    0,  32},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 0, 2, 0, 0, 2,    0,  -3,   -1,   0},\n      { 0, 2,-2, 1, 0, -5,  5,  0, 0, 0, 0, 0, 0,    4,   0,    0,  -2},\n\n   /* 391-400 */\n      { 0, 0, 0, 0, 0,  0,  1,  0, 1, 0, 0, 0, 0,    8,  11,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 1, 0, 0, 0, 1,    0,   3,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 1, 0, 0, 0, 2, -262,   0,    0, 114},\n      { 0, 0, 0, 0, 0,  3, -6,  0, 0, 0, 0, 0, 0,    0,  -4,    0,   0},\n      { 0, 0, 0, 0, 0, -3,  6,  0, 0, 0, 0, 0, 1,   -7,   0,    0,   4},\n      { 0, 0, 0, 0, 0, -3,  6,  0, 0, 0, 0, 0, 2,    0, -27,  -12,   0},\n      { 0, 0, 0, 0, 0,  0, -1,  4, 0, 0, 0, 0, 2,  -19,  -8,   -4,   8},\n      { 0, 0, 0, 0, 0, -5,  7,  0, 0, 0, 0, 0, 2,  202,   0,    0, -87},\n      { 0, 0, 0, 0, 0, -5,  7,  0, 0, 0, 0, 0, 1,   -8,  35,   19,   5},\n      { 0, 1,-1, 1, 0, -5,  6,  0, 0, 0, 0, 0, 0,    0,   4,    2,   0},\n\n   /* 401-410 */\n      { 0, 0, 0, 0, 0,  5, -7,  0, 0, 0, 0, 0, 0,   16,  -5,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -1,  0, 1, 0, 0, 0, 0,    5,   0,    0,  -3},\n      { 0, 0, 0, 0, 0,  0, -1,  0, 1, 0, 0, 0, 0,    0,  -3,    0,   0},\n      { 0, 0, 0, 0,-1,  0,  3,  0, 0, 0, 0, 0, 2,    1,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 2, 0, 0, 0, 2,  -35, -48,  -21,  15},\n      { 0, 0, 0, 0, 0,  0, -2,  6, 0, 0, 0, 0, 2,   -3,  -5,   -2,   1},\n      { 0, 0, 0, 1, 0,  2, -2,  0, 0, 0, 0, 0, 0,    6,   0,    0,  -3},\n      { 0, 0, 0, 0, 0,  0, -6,  9, 0, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  0,  6, -9, 0, 0, 0, 0, 0,    0,  -5,    0,   0},\n      { 0, 0, 0, 0, 0, -2,  2,  0, 0, 0, 0, 0, 1,   12,  55,   29,  -6},\n\n   /* 411-420 */\n      { 0, 1,-1, 1, 0, -2,  1,  0, 0, 0, 0, 0, 0,    0,   5,    3,   0},\n      { 0, 0, 0, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0, -598,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  2, -2,  0, 0, 0, 0, 0, 1,   -3, -13,   -7,   1},\n      { 0, 0, 0, 0, 0,  0,  1,  0, 3, 0, 0, 0, 2,   -5,  -7,   -3,   2},\n      { 0, 0, 0, 0, 0,  0, -5,  7, 0, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  0,  5, -7, 0, 0, 0, 0, 0,    5,  -7,    0,   0},\n      { 0, 0, 0, 1, 0, -2,  2,  0, 0, 0, 0, 0, 0,    4,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  4, -5, 0, 0, 0, 0, 0,   16,  -6,    0,   0},\n      { 0, 0, 0, 0, 0,  1, -3,  0, 0, 0, 0, 0, 0,    8,  -3,    0,   0},\n      { 0, 0, 0, 0, 0, -1,  3,  0, 0, 0, 0, 0, 1,    8, -31,  -16,  -4},\n\n   /* 421-430 */\n      { 0, 1,-1, 1, 0, -1,  2,  0, 0, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0, -1,  3,  0, 0, 0, 0, 0, 2,  113,   0,    0, -49},\n      { 0, 0, 0, 0, 0, -7, 10,  0, 0, 0, 0, 0, 2,    0, -24,  -10,   0},\n      { 0, 0, 0, 0, 0, -7, 10,  0, 0, 0, 0, 0, 1,    4,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  3, -3, 0, 0, 0, 0, 0,   27,   0,    0,   0},\n      { 0, 0, 0, 0, 0, -4,  8,  0, 0, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0, -4,  5,  0, 0, 0, 0, 0, 2,    0,  -4,   -2,   0},\n      { 0, 0, 0, 0, 0, -4,  5,  0, 0, 0, 0, 0, 1,    5,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  4, -5,  0, 0, 0, 0, 0, 0,    0,  -3,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  1, 0, 0, 0, 0, 2,  -13,   0,    0,   6},\n\n   /* 431-440 */\n      { 0, 0, 0, 0, 0,  0, -2,  0, 5, 0, 0, 0, 2,    5,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  0,  0,  3, 0, 0, 0, 0, 2,  -18, -10,   -4,   8},\n      { 0, 0, 0, 0, 0,  1,  0,  0, 0, 0, 0, 0, 0,   -4, -28,    0,   0},\n      { 0, 0, 0, 0, 0,  1,  0,  0, 0, 0, 0, 0, 2,   -5,   6,    3,   2},\n      { 0, 0, 0, 0, 0, -9, 13,  0, 0, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0,  0, -1,  5, 0, 0, 0, 0, 2,   -5,  -9,   -4,   2},\n      { 0, 0, 0, 0, 0,  0, -2,  0, 4, 0, 0, 0, 2,   17,   0,    0,  -7},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-4, 0, 0, 0, 0,   11,   4,    0,   0},\n      { 0, 0, 0, 0, 0,  0, -2,  7, 0, 0, 0, 0, 2,    0,  -6,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-3, 0, 0, 0, 0,   83,  15,    0,   0},\n\n   /* 441-450 */\n      { 0, 0, 0, 0, 0, -2,  5,  0, 0, 0, 0, 0, 1,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0, -2,  5,  0, 0, 0, 0, 0, 2,    0,-114,  -49,   0},\n      { 0, 0, 0, 0, 0, -6,  8,  0, 0, 0, 0, 0, 2,  117,   0,    0, -51},\n      { 0, 0, 0, 0, 0, -6,  8,  0, 0, 0, 0, 0, 1,   -5,  19,   10,   2},\n      { 0, 0, 0, 0, 0,  6, -8,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 1, 0,  0,  2,  0,-2, 0, 0, 0, 0,   -3,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0, -3,  9, 0, 0, 0, 0, 2,    0,  -3,   -1,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -6, 0, 0, 0, 0, 0,    3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -6, 0, 0, 0, 0, 2,    0,  -6,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,  393,   3,    0,   0},\n\n   /* 451-460 */\n      { 0, 0, 0, 0, 0,  0,  2,  0,-2, 0, 0, 0, 1,   -4,  21,   11,   2},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-2, 0, 0, 0, 2,   -6,   0,   -1,   3},\n      { 0, 0, 0, 0, 0, -5, 10,  0, 0, 0, 0, 0, 2,   -3,   8,    4,   1},\n      { 0, 0, 0, 0, 0,  0,  4, -4, 0, 0, 0, 0, 0,    8,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  4, -4, 0, 0, 0, 0, 2,   18, -29,  -13,  -8},\n      { 0, 0, 0, 0, 0, -3,  3,  0, 0, 0, 0, 0, 1,    8,  34,   18,  -4},\n      { 0, 0, 0, 0, 0,  3, -3,  0, 0, 0, 0, 0, 0,   89,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  3, -3,  0, 0, 0, 0, 0, 1,    3,  12,    6,  -1},\n      { 0, 0, 0, 0, 0,  3, -3,  0, 0, 0, 0, 0, 2,   54, -15,   -7, -24},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0,-3, 0, 0, 0,    0,   3,    0,   0},\n\n   /* 461-470 */\n      { 0, 0, 0, 0, 0,  0, -5, 13, 0, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-1, 0, 0, 0, 0,    0,  35,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-1, 0, 0, 0, 2, -154, -30,  -13,  67},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0,-2, 0, 0, 0,   15,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0,-2, 0, 0, 1,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  3, -2, 0, 0, 0, 0, 0,    0,   9,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  3, -2, 0, 0, 0, 0, 2,   80, -71,  -31, -35},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0,-1, 0, 0, 2,    0, -20,   -9,   0},\n      { 0, 0, 0, 0, 0,  0, -6, 15, 0, 0, 0, 0, 2,   11,   5,    2,  -5},\n      { 0, 0, 0, 0, 0, -8, 15,  0, 0, 0, 0, 0, 2,   61, -96,  -42, -27},\n\n   /* 471-480 */\n      { 0, 0, 0, 0, 0, -3,  9, -4, 0, 0, 0, 0, 2,   14,   9,    4,  -6},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 2,-5, 0, 0, 2,  -11,  -6,   -3,   5},\n      { 0, 0, 0, 0, 0,  0, -2,  8,-1,-5, 0, 0, 2,    0,  -3,   -1,   0},\n      { 0, 0, 0, 0, 0,  0,  6, -8, 3, 0, 0, 0, 2,  123,-415, -180, -53},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 0, 0, 0, 0,    0,   0,    0, -35},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 0, 0, 0, 0,   -5,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 0, 0, 0, 1,    7, -32,  -17,  -4},\n      { 0, 1,-1, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,  -9,   -5,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 0, 0, 0, 1,    0,  -4,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 0, 0, 0, 2,  -89,   0,    0,  38},\n\n   /* 481-490 */\n      { 0, 0, 0, 0, 0,  0, -6, 16,-4,-5, 0, 0, 2,    0, -86,  -19,  -6},\n      { 0, 0, 0, 0, 0,  0, -2,  8,-3, 0, 0, 0, 2,    0,   0,  -19,   6},\n      { 0, 0, 0, 0, 0,  0, -2,  8,-3, 0, 0, 0, 2, -123,-416, -180,  53},\n      { 0, 0, 0, 0, 0,  0,  6, -8, 1, 5, 0, 0, 2,    0,  -3,   -1,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-2, 5, 0, 0, 2,   12,  -6,   -3,  -5},\n      { 0, 0, 0, 0, 0,  3, -5,  4, 0, 0, 0, 0, 2,  -13,   9,    4,   6},\n      { 0, 0, 0, 0, 0, -8, 11,  0, 0, 0, 0, 0, 2,    0, -15,   -7,   0},\n      { 0, 0, 0, 0, 0, -8, 11,  0, 0, 0, 0, 0, 1,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0, -8, 11,  0, 0, 0, 0, 0, 2,  -62, -97,  -42,  27},\n      { 0, 0, 0, 0, 0,  0, 11,  0, 0, 0, 0, 0, 2,  -11,   5,    2,   5},\n\n   /* 491-500 */\n      { 0, 0, 0, 0, 0,  0,  2,  0, 0, 1, 0, 0, 2,    0, -19,   -8,   0},\n      { 0, 0, 0, 0, 0,  3, -3,  0, 2, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 2,-2, 1, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,   4,    2,   0},\n      { 0, 1,-1, 0, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n      { 0, 2,-2, 1, 0,  0, -4,  8,-3, 0, 0, 0, 0,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  1,  2, 0, 0, 0, 0, 2,  -85, -70,  -31,  37},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 1, 0, 0, 0, 2,  163, -12,   -5, -72},\n      { 0, 0, 0, 0, 0, -3,  7,  0, 0, 0, 0, 0, 2,  -63, -16,   -7,  28},\n      { 0, 0, 0, 0, 0,  0,  0,  4, 0, 0, 0, 0, 2,  -21, -32,  -14,   9},\n      { 0, 0, 0, 0, 0, -5,  6,  0, 0, 0, 0, 0, 2,    0,  -3,   -1,   0},\n\n   /* 501-510 */\n      { 0, 0, 0, 0, 0, -5,  6,  0, 0, 0, 0, 0, 1,    3,   0,    0,  -2},\n      { 0, 0, 0, 0, 0,  5, -6,  0, 0, 0, 0, 0, 0,    0,   8,    0,   0},\n      { 0, 0, 0, 0, 0,  5, -6,  0, 0, 0, 0, 0, 2,    3,  10,    4,  -1},\n      { 0, 0, 0, 0, 0,  0,  2,  0, 2, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  0, -1,  6, 0, 0, 0, 0, 2,    0,  -7,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  7, -9, 0, 0, 0, 0, 2,    0,  -4,   -2,   0},\n      { 0, 0, 0, 0, 0,  2, -1,  0, 0, 0, 0, 0, 0,    6,  19,    0,   0},\n      { 0, 0, 0, 0, 0,  2, -1,  0, 0, 0, 0, 0, 2,    5,-173,  -75,  -2},\n      { 0, 0, 0, 0, 0,  0,  6, -7, 0, 0, 0, 0, 2,    0,  -7,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -5, 0, 0, 0, 0, 2,    7, -12,   -5,  -3},\n\n   /* 511-520 */\n      { 0, 0, 0, 0, 0, -1,  4,  0, 0, 0, 0, 0, 1,   -3,   0,    0,   2},\n      { 0, 0, 0, 0, 0, -1,  4,  0, 0, 0, 0, 0, 2,    3,  -4,   -2,  -1},\n      { 0, 0, 0, 0, 0, -7,  9,  0, 0, 0, 0, 0, 2,   74,   0,    0, -32},\n      { 0, 0, 0, 0, 0, -7,  9,  0, 0, 0, 0, 0, 1,   -3,  12,    6,   2},\n      { 0, 0, 0, 0, 0,  0,  4, -3, 0, 0, 0, 0, 2,   26, -14,   -6, -11},\n      { 0, 0, 0, 0, 0,  0,  3, -1, 0, 0, 0, 0, 2,   19,   0,    0,  -8},\n      { 0, 0, 0, 0, 0, -4,  4,  0, 0, 0, 0, 0, 1,    6,  24,   13,  -3},\n      { 0, 0, 0, 0, 0,  4, -4,  0, 0, 0, 0, 0, 0,   83,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  4, -4,  0, 0, 0, 0, 0, 1,    0, -10,   -5,   0},\n      { 0, 0, 0, 0, 0,  4, -4,  0, 0, 0, 0, 0, 2,   11,  -3,   -1,  -5},\n\n   /* 521-530 */\n      { 0, 0, 0, 0, 0,  0,  2,  1, 0, 0, 0, 0, 2,    3,   0,    1,  -1},\n      { 0, 0, 0, 0, 0,  0, -3,  0, 5, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  1,  1,  0, 0, 0, 0, 0, 0,   -4,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  1,  1,  0, 0, 0, 0, 0, 1,    5, -23,  -12,  -3},\n      { 0, 0, 0, 0, 0,  1,  1,  0, 0, 0, 0, 0, 2, -339,   0,    0, 147},\n      { 0, 0, 0, 0, 0, -9, 12,  0, 0, 0, 0, 0, 2,    0, -10,   -5,   0},\n      { 0, 0, 0, 0, 0,  0,  3,  0,-4, 0, 0, 0, 0,    5,   0,    0,   0},\n      { 0, 2,-2, 1, 0,  1, -1,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  0,  7, -8, 0, 0, 0, 0, 2,    0,  -4,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  3,  0,-3, 0, 0, 0, 0,   18,  -3,    0,   0},\n\n   /* 531-540 */\n      { 0, 0, 0, 0, 0,  0,  3,  0,-3, 0, 0, 0, 2,    9, -11,   -5,  -4},\n      { 0, 0, 0, 0, 0, -2,  6,  0, 0, 0, 0, 0, 2,   -8,   0,    0,   4},\n      { 0, 0, 0, 0, 0, -6,  7,  0, 0, 0, 0, 0, 1,    3,   0,    0,  -1},\n      { 0, 0, 0, 0, 0,  6, -7,  0, 0, 0, 0, 0, 0,    0,   9,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  6, -6, 0, 0, 0, 0, 2,    6,  -9,   -4,  -2},\n      { 0, 0, 0, 0, 0,  0,  3,  0,-2, 0, 0, 0, 0,   -4, -12,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  3,  0,-2, 0, 0, 0, 2,   67, -91,  -39, -29},\n      { 0, 0, 0, 0, 0,  0,  5, -4, 0, 0, 0, 0, 2,   30, -18,   -8, -13},\n      { 0, 0, 0, 0, 0,  3, -2,  0, 0, 0, 0, 0, 0,    0,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  3, -2,  0, 0, 0, 0, 0, 2,    0,-114,  -50,   0},\n\n   /* 541-550 */\n      { 0, 0, 0, 0, 0,  0,  3,  0,-1, 0, 0, 0, 2,    0,   0,    0,  23},\n      { 0, 0, 0, 0, 0,  0,  3,  0,-1, 0, 0, 0, 2,  517,  16,    7,-224},\n      { 0, 0, 0, 0, 0,  0,  3,  0, 0,-2, 0, 0, 2,    0,  -7,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  4, -2, 0, 0, 0, 0, 2,  143,  -3,   -1, -62},\n      { 0, 0, 0, 0, 0,  0,  3,  0, 0,-1, 0, 0, 2,   29,   0,    0, -13},\n      { 0, 2,-2, 1, 0,  0,  1,  0,-1, 0, 0, 0, 0,   -4,   0,    0,   2},\n      { 0, 0, 0, 0, 0, -8, 16,  0, 0, 0, 0, 0, 2,   -6,   0,    0,   3},\n      { 0, 0, 0, 0, 0,  0,  3,  0, 2,-5, 0, 0, 2,    5,  12,    5,  -2},\n      { 0, 0, 0, 0, 0,  0,  7, -8, 3, 0, 0, 0, 2,  -25,   0,    0,  11},\n      { 0, 0, 0, 0, 0,  0, -5, 16,-4,-5, 0, 0, 2,   -3,   0,    0,   1},\n\n   /* 551-560 */\n      { 0, 0, 0, 0, 0,  0,  3,  0, 0, 0, 0, 0, 2,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0,  0, -1,  8,-3, 0, 0, 0, 2,  -22,  12,    5,  10},\n      { 0, 0, 0, 0, 0, -8, 10,  0, 0, 0, 0, 0, 2,   50,   0,    0, -22},\n      { 0, 0, 0, 0, 0, -8, 10,  0, 0, 0, 0, 0, 1,    0,   7,    4,   0},\n      { 0, 0, 0, 0, 0, -8, 10,  0, 0, 0, 0, 0, 2,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0,  0,  2,  2, 0, 0, 0, 0, 2,   -4,   4,    2,   2},\n      { 0, 0, 0, 0, 0,  0,  3,  0, 1, 0, 0, 0, 2,   -5, -11,   -5,   2},\n      { 0, 0, 0, 0, 0, -3,  8,  0, 0, 0, 0, 0, 2,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0, -5,  5,  0, 0, 0, 0, 0, 1,    4,  17,    9,  -2},\n      { 0, 0, 0, 0, 0,  5, -5,  0, 0, 0, 0, 0, 0,   59,   0,    0,   0},\n\n   /* 561-570 */\n      { 0, 0, 0, 0, 0,  5, -5,  0, 0, 0, 0, 0, 1,    0,  -4,   -2,   0},\n      { 0, 0, 0, 0, 0,  5, -5,  0, 0, 0, 0, 0, 2,   -8,   0,    0,   4},\n      { 0, 0, 0, 0, 0,  2,  0,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  2,  0,  0, 0, 0, 0, 0, 1,    4, -15,   -8,  -2},\n      { 0, 0, 0, 0, 0,  2,  0,  0, 0, 0, 0, 0, 2,  370,  -8,    0,-160},\n      { 0, 0, 0, 0, 0,  0,  7, -7, 0, 0, 0, 0, 2,    0,   0,   -3,   0},\n      { 0, 0, 0, 0, 0,  0,  7, -7, 0, 0, 0, 0, 2,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0,  0,  6, -5, 0, 0, 0, 0, 2,   -6,   3,    1,   3},\n      { 0, 0, 0, 0, 0,  7, -8,  0, 0, 0, 0, 0, 0,    0,   6,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  5, -3, 0, 0, 0, 0, 2,  -10,   0,    0,   4},\n\n   /* 571-580 */\n      { 0, 0, 0, 0, 0,  4, -3,  0, 0, 0, 0, 0, 2,    0,   9,    4,   0},\n      { 0, 0, 0, 0, 0,  1,  2,  0, 0, 0, 0, 0, 2,    4,  17,    7,  -2},\n      { 0, 0, 0, 0, 0, -9, 11,  0, 0, 0, 0, 0, 2,   34,   0,    0, -15},\n      { 0, 0, 0, 0, 0, -9, 11,  0, 0, 0, 0, 0, 1,    0,   5,    3,   0},\n      { 0, 0, 0, 0, 0,  0,  4,  0,-4, 0, 0, 0, 2,   -5,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  4,  0,-3, 0, 0, 0, 2,  -37,  -7,   -3,  16},\n      { 0, 0, 0, 0, 0, -6,  6,  0, 0, 0, 0, 0, 1,    3,  13,    7,  -2},\n      { 0, 0, 0, 0, 0,  6, -6,  0, 0, 0, 0, 0, 0,   40,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  6, -6,  0, 0, 0, 0, 0, 1,    0,  -3,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  4,  0,-2, 0, 0, 0, 2, -184,  -3,   -1,  80},\n\n   /* 581-590 */\n      { 0, 0, 0, 0, 0,  0,  6, -4, 0, 0, 0, 0, 2,   -3,   0,    0,   1},\n      { 0, 0, 0, 0, 0,  3, -1,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  3, -1,  0, 0, 0, 0, 0, 1,    0, -10,   -6,  -1},\n      { 0, 0, 0, 0, 0,  3, -1,  0, 0, 0, 0, 0, 2,   31,  -6,    0, -13},\n      { 0, 0, 0, 0, 0,  0,  4,  0,-1, 0, 0, 0, 2,   -3, -32,  -14,   1},\n      { 0, 0, 0, 0, 0,  0,  4,  0, 0,-2, 0, 0, 2,   -7,   0,    0,   3},\n      { 0, 0, 0, 0, 0,  0,  5, -2, 0, 0, 0, 0, 2,    0,  -8,   -4,   0},\n      { 0, 0, 0, 0, 0,  0,  4,  0, 0, 0, 0, 0, 0,    3,  -4,    0,   0},\n      { 0, 0, 0, 0, 0,  8, -9,  0, 0, 0, 0, 0, 0,    0,   4,    0,   0},\n      { 0, 0, 0, 0, 0,  5, -4,  0, 0, 0, 0, 0, 2,    0,   3,    1,   0},\n\n   /* 591-600 */\n      { 0, 0, 0, 0, 0,  2,  1,  0, 0, 0, 0, 0, 2,   19, -23,  -10,   2},\n      { 0, 0, 0, 0, 0,  2,  1,  0, 0, 0, 0, 0, 1,    0,   0,    0, -10},\n      { 0, 0, 0, 0, 0,  2,  1,  0, 0, 0, 0, 0, 1,    0,   3,    2,   0},\n      { 0, 0, 0, 0, 0, -7,  7,  0, 0, 0, 0, 0, 1,    0,   9,    5,  -1},\n      { 0, 0, 0, 0, 0,  7, -7,  0, 0, 0, 0, 0, 0,   28,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  4, -2,  0, 0, 0, 0, 0, 1,    0,  -7,   -4,   0},\n      { 0, 0, 0, 0, 0,  4, -2,  0, 0, 0, 0, 0, 2,    8,  -4,    0,  -4},\n      { 0, 0, 0, 0, 0,  4, -2,  0, 0, 0, 0, 0, 0,    0,   0,   -2,   0},\n      { 0, 0, 0, 0, 0,  4, -2,  0, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  5,  0,-4, 0, 0, 0, 2,   -3,   0,    0,   1},\n\n   /* 601-610 */\n      { 0, 0, 0, 0, 0,  0,  5,  0,-3, 0, 0, 0, 2,   -9,   0,    1,   4},\n      { 0, 0, 0, 0, 0,  0,  5,  0,-2, 0, 0, 0, 2,    3,  12,    5,  -1},\n      { 0, 0, 0, 0, 0,  3,  0,  0, 0, 0, 0, 0, 2,   17,  -3,   -1,   0},\n      { 0, 0, 0, 0, 0, -8,  8,  0, 0, 0, 0, 0, 1,    0,   7,    4,   0},\n      { 0, 0, 0, 0, 0,  8, -8,  0, 0, 0, 0, 0, 0,   19,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  5, -3,  0, 0, 0, 0, 0, 1,    0,  -5,   -3,   0},\n      { 0, 0, 0, 0, 0,  5, -3,  0, 0, 0, 0, 0, 2,   14,  -3,    0,  -1},\n      { 0, 0, 0, 0, 0, -9,  9,  0, 0, 0, 0, 0, 1,    0,   0,   -1,   0},\n      { 0, 0, 0, 0, 0, -9,  9,  0, 0, 0, 0, 0, 1,    0,   0,    0,  -5},\n      { 0, 0, 0, 0, 0, -9,  9,  0, 0, 0, 0, 0, 1,    0,   5,    3,   0},\n\n   /* 611-620 */\n      { 0, 0, 0, 0, 0,  9, -9,  0, 0, 0, 0, 0, 0,   13,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  6, -4,  0, 0, 0, 0, 0, 1,    0,  -3,   -2,   0},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 2,    2,   9,    4,   3},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 0,    0,   0,    0,  -4},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 0,    8,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 1,    0,   4,    2,   0},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 2,    6,   0,    0,  -3},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 0,    6,   0,    0,   0},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 1,    0,   3,    1,   0},\n      { 0, 0, 0, 0, 0,  0,  6,  0, 0, 0, 0, 0, 2,    5,   0,    0,  -2},\n\n   /* 621-630 */\n      { 0, 0, 0, 0, 0,  0,  0,  0, 0, 0, 0, 0, 2,    3,   0,    0,  -1},\n      { 1, 0,-2, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 1, 0,-2, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0,    6,   0,    0,   0},\n      { 1, 0,-2, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,    7,   0,    0,   0},\n      { 1, 0,-2, 0, 0,  1, -1,  0, 0, 0, 0, 0, 0,   -4,   0,    0,   0},\n      {-1, 0, 0, 0, 0,  3, -3,  0, 0, 0, 0, 0, 0,    4,   0,    0,   0},\n      {-1, 0, 0, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,    6,   0,    0,   0},\n      {-1, 0, 2, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,  -4,    0,   0},\n      { 1, 0,-2, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,  -4,    0,   0},\n      {-2, 0, 2, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0,    5,   0,    0,   0},\n\n   /* 631-640 */\n      {-1, 0, 0, 0, 0,  0,  2,  0,-3, 0, 0, 0, 0,   -3,   0,    0,   0},\n      {-1, 0, 0, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,    4,   0,    0,   0},\n      {-1, 0, 0, 0, 0,  1, -1,  0, 0, 0, 0, 0, 0,   -5,   0,    0,   0},\n      {-1, 0, 2, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0,    4,   0,    0,   0},\n      { 1,-1, 1, 0, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,   3,    0,   0},\n      {-1, 0, 2, 0, 0,  0,  2,  0,-3, 0, 0, 0, 0,   13,   0,    0,   0},\n      {-2, 0, 0, 0, 0,  0,  2,  0,-3, 0, 0, 0, 0,   21,  11,    0,   0},\n      { 1, 0, 0, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,  -5,    0,   0},\n      {-1, 1,-1, 1, 0,  0, -1,  0, 0, 0, 0, 0, 0,    0,  -5,   -2,   0},\n      { 1, 1,-1, 1, 0,  0, -1,  0, 0, 0, 0, 0, 0,    0,   5,    3,   0},\n\n   /* 641-650 */\n      {-1, 0, 0, 0, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,  -5,    0,   0},\n      {-1, 0, 2, 1, 0,  0,  2,  0,-2, 0, 0, 0, 0,   -3,   0,    0,   2},\n      { 0, 0, 0, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,   20,  10,    0,   0},\n      {-1, 0, 2, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,  -34,   0,    0,   0},\n      {-1, 0, 2, 0, 0,  3, -3,  0, 0, 0, 0, 0, 0,  -19,   0,    0,   0},\n      { 1, 0,-2, 1, 0,  0, -2,  0, 2, 0, 0, 0, 0,    3,   0,    0,  -2},\n      { 1, 2,-2, 2, 0, -3,  3,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n      { 1, 2,-2, 2, 0,  0, -2,  0, 2, 0, 0, 0, 0,   -6,   0,    0,   3},\n      { 1, 0, 0, 0, 0,  1, -1,  0, 0, 0, 0, 0, 0,   -4,   0,    0,   0},\n      { 1, 0, 0, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,    3,   0,    0,   0},\n\n   /* 651-660 */\n      { 0, 0,-2, 0, 0,  2, -2,  0, 0, 0, 0, 0, 0,    3,   0,    0,   0},\n      { 0, 0,-2, 0, 0,  0,  1,  0,-1, 0, 0, 0, 0,    4,   0,    0,   0},\n      { 0, 2, 0, 2, 0, -2,  2,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 2, 0, 2, 0,  0, -1,  0, 1, 0, 0, 0, 0,    6,   0,    0,  -3},\n      { 0, 2, 0, 2, 0, -1,  1,  0, 0, 0, 0, 0, 0,   -8,   0,    0,   3},\n      { 0, 2, 0, 2, 0, -2,  3,  0, 0, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 0, 2, 0, 0,  0,  2,  0,-2, 0, 0, 0, 0,   -3,   0,    0,   0},\n      { 0, 1, 1, 2, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,  -3,   -2,   0},\n      { 1, 2, 0, 2, 0,  0,  1,  0, 0, 0, 0, 0, 0,  126, -63,  -27, -55},\n      {-1, 2, 0, 2, 0, 10, -3,  0, 0, 0, 0, 0, 0,   -5,   0,    1,   2},\n\n   /* 661-670 */\n      { 0, 1, 1, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,   -3,  28,   15,   2},\n      { 1, 2, 0, 2, 0,  0,  1,  0, 0, 0, 0, 0, 0,    5,   0,    1,  -2},\n      { 0, 2, 0, 2, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,   9,    4,   1},\n      { 0, 2, 0, 2, 0,  0, -4,  8,-3, 0, 0, 0, 0,    0,   9,    4,  -1},\n      {-1, 2, 0, 2, 0,  0, -4,  8,-3, 0, 0, 0, 0, -126, -63,  -27,  55},\n      { 2, 2,-2, 2, 0,  0, -2,  0, 3, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 1, 2, 0, 1, 0,  0, -2,  0, 3, 0, 0, 0, 0,   21, -11,   -6, -11},\n      { 0, 1, 1, 0, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,  -4,    0,   0},\n      {-1, 2, 0, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,  -21, -11,   -6,  11},\n      {-2, 2, 2, 2, 0,  0,  2,  0,-2, 0, 0, 0, 0,   -3,   0,    0,   1},\n\n   /* 671-680 */\n      { 0, 2, 0, 2, 0,  2, -3,  0, 0, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 0, 2, 0, 2, 0,  1, -1,  0, 0, 0, 0, 0, 0,    8,   0,    0,  -4},\n      { 0, 2, 0, 2, 0,  0,  1,  0,-1, 0, 0, 0, 0,   -6,   0,    0,   3},\n      { 0, 2, 0, 2, 0,  2, -2,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n      {-1, 2, 2, 2, 0,  0, -1,  0, 1, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 1, 2, 0, 2, 0, -1,  1,  0, 0, 0, 0, 0, 0,   -3,   0,    0,   1},\n      {-1, 2, 2, 2, 0,  0,  2,  0,-3, 0, 0, 0, 0,   -5,   0,    0,   2},\n      { 2, 2, 0, 2, 0,  0,  2,  0,-3, 0, 0, 0, 0,   24, -12,   -5, -11},\n      { 1, 2, 0, 2, 0,  0, -4,  8,-3, 0, 0, 0, 0,    0,   3,    1,   0},\n      { 1, 2, 0, 2, 0,  0,  4, -8, 3, 0, 0, 0, 0,    0,   3,    1,   0},\n\n   /* 681-687 */\n      { 1, 1, 1, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,    0,   3,    2,   0},\n      { 0, 2, 0, 2, 0,  0,  1,  0, 0, 0, 0, 0, 0,  -24, -12,   -5,  10},\n      { 2, 2, 0, 1, 0,  0,  1,  0, 0, 0, 0, 0, 0,    4,   0,   -1,  -2},\n      {-1, 2, 2, 2, 0,  0,  2,  0,-2, 0, 0, 0, 0,   13,   0,    0,  -6},\n      {-1, 2, 2, 2, 0,  3, -3,  0, 0, 0, 0, 0, 0,    7,   0,    0,  -3},\n      { 1, 2, 0, 2, 0,  1, -1,  0, 0, 0, 0, 0, 0,    3,   0,    0,  -1},\n      { 0, 2, 2, 2, 0,  0,  2,  0,-2, 0, 0, 0, 0,    3,   0,    0,  -1}\n   };\n\n/* Number of terms in the planetary nutation model */\n   const int NPL = (int) (sizeof xpl / sizeof xpl[0]);\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* ------------------- */\n/* LUNI-SOLAR NUTATION */\n/* ------------------- */\n\n/* Fundamental (Delaunay) arguments */\n\n/* Mean anomaly of the Moon (IERS 2003). */\n   el = eraFal03(t);\n\n/* Mean anomaly of the Sun (MHB2000). */\n   elp = fmod(1287104.79305  +\n            t * (129596581.0481  +\n            t * (-0.5532  +\n            t * (0.000136  +\n            t * (-0.00001149)))), ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean longitude of the Moon minus that of the ascending node */\n/* (IERS 2003. */\n   f = eraFaf03(t);\n\n/* Mean elongation of the Moon from the Sun (MHB2000). */\n   d = fmod(1072260.70369  +\n          t * (1602961601.2090  +\n          t * (-6.3706  +\n          t * (0.006593  +\n          t * (-0.00003169)))), ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean longitude of the ascending node of the Moon (IERS 2003). */\n   om = eraFaom03(t);\n\n/* Initialize the nutation values. */\n   dp = 0.0;\n   de = 0.0;\n\n/* Summation of luni-solar nutation series (in reverse order). */\n   for (i = NLS-1; i >= 0; i--) {\n\n   /* Argument and functions. */\n      arg = fmod((double)xls[i].nl  * el +\n                 (double)xls[i].nlp * elp +\n                 (double)xls[i].nf  * f +\n                 (double)xls[i].nd  * d +\n                 (double)xls[i].nom * om, ERFA_D2PI);\n      sarg = sin(arg);\n      carg = cos(arg);\n\n   /* Term. */\n      dp += (xls[i].sp + xls[i].spt * t) * sarg + xls[i].cp * carg;\n      de += (xls[i].ce + xls[i].cet * t) * carg + xls[i].se * sarg;\n   }\n\n/* Convert from 0.1 microarcsec units to radians. */\n   dpsils = dp * U2R;\n   depsls = de * U2R;\n\n/* ------------------ */\n/* PLANETARY NUTATION */\n/* ------------------ */\n\n/* n.b.  The MHB2000 code computes the luni-solar and planetary nutation */\n/* in different functions, using slightly different Delaunay */\n/* arguments in the two cases.  This behaviour is faithfully */\n/* reproduced here.  Use of the IERS 2003 expressions for both */\n/* cases leads to negligible changes, well below */\n/* 0.1 microarcsecond. */\n\n/* Mean anomaly of the Moon (MHB2000). */\n   al = fmod(2.35555598 + 8328.6914269554 * t, ERFA_D2PI);\n\n/* Mean longitude of the Moon minus that of the ascending node */\n/*(MHB2000). */\n   af = fmod(1.627905234 + 8433.466158131 * t, ERFA_D2PI);\n\n/* Mean elongation of the Moon from the Sun (MHB2000). */\n   ad = fmod(5.198466741 + 7771.3771468121 * t, ERFA_D2PI);\n\n/* Mean longitude of the ascending node of the Moon (MHB2000). */\n   aom = fmod(2.18243920 - 33.757045 * t, ERFA_D2PI);\n\n/* General accumulated precession in longitude (IERS 2003). */\n   apa = eraFapa03(t);\n\n/* Planetary longitudes, Mercury through Uranus (IERS 2003). */\n   alme = eraFame03(t);\n   alve = eraFave03(t);\n   alea = eraFae03(t);\n   alma = eraFama03(t);\n   alju = eraFaju03(t);\n   alsa = eraFasa03(t);\n   alur = eraFaur03(t);\n\n/* Neptune longitude (MHB2000). */\n   alne = fmod(5.321159000 + 3.8127774000 * t, ERFA_D2PI);\n\n/* Initialize the nutation values. */\n   dp = 0.0;\n   de = 0.0;\n\n/* Summation of planetary nutation series (in reverse order). */\n   for (i = NPL-1; i >= 0; i--) {\n\n   /* Argument and functions. */\n      arg = fmod((double)xpl[i].nl  * al   +\n                 (double)xpl[i].nf  * af   +\n                 (double)xpl[i].nd  * ad   +\n                 (double)xpl[i].nom * aom  +\n                 (double)xpl[i].nme * alme +\n                 (double)xpl[i].nve * alve +\n                 (double)xpl[i].nea * alea +\n                 (double)xpl[i].nma * alma +\n                 (double)xpl[i].nju * alju +\n                 (double)xpl[i].nsa * alsa +\n                 (double)xpl[i].nur * alur +\n                 (double)xpl[i].nne * alne +\n                 (double)xpl[i].npa * apa, ERFA_D2PI);\n      sarg = sin(arg);\n      carg = cos(arg);\n\n   /* Term. */\n      dp += (double)xpl[i].sp * sarg + (double)xpl[i].cp * carg;\n      de += (double)xpl[i].se * sarg + (double)xpl[i].ce * carg;\n\n   }\n\n/* Convert from 0.1 microarcsec units to radians. */\n   dpsipl = dp * U2R;\n   depspl = de * U2R;\n\n/* ------- */\n/* RESULTS */\n/* ------- */\n\n/* Add luni-solar and planetary components. */\n   *dpsi = dpsils + dpsipl;\n   *deps = depsls + depspl;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":21,"id":13122,"name":"_minpad","nodeType":"Attribute","startLoc":21,"text":"self._minpad"},{"id":13123,"name":"rxp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRxp(double r[3][3], double p[3], double rp[3])\n/*\n**  - - - - - - -\n**   e r a R x p\n**  - - - - - - -\n**\n**  Multiply a p-vector by an r-matrix.\n**\n**  Given:\n**     r        double[3][3]    r-matrix\n**     p        double[3]       p-vector\n**\n**  Returned:\n**     rp       double[3]       r * p\n**\n**  Note:\n**     It is permissible for p and rp to be the same array.\n**\n**  Called:\n**     eraCp        copy p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double w, wrp[3];\n   int i, j;\n\n\n/* Matrix r * vector p. */\n   for (j = 0; j < 3; j++) {\n       w = 0.0;\n       for (i = 0; i < 3; i++) {\n           w += r[j][i] * p[i];\n       }\n       wrp[j] = w;\n   }\n\n/* Return the result. */\n   eraCp(wrp, rp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13124,"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"},{"attributeType":"null","col":16,"comment":"null","endLoc":9,"id":13125,"name":"np","nodeType":"Attribute","startLoc":9,"text":"np"},{"attributeType":"null","col":25,"comment":"null","endLoc":16,"id":13126,"name":"u","nodeType":"Attribute","startLoc":16,"text":"u"},{"id":13127,"name":"pmat00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPmat00(double date1, double date2, double rbp[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P m a t 0 0\n**  - - - - - - - - - -\n**\n**  Precession matrix (including frame bias) from GCRS to a specified\n**  date, IAU 2000 model.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rbp          double[3][3]    bias-precession matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rbp * V(GCRS), where\n**     the p-vector V(GCRS) is with respect to the Geocentric Celestial\n**     Reference System (IAU, 2000) and the p-vector V(date) is with\n**     respect to the mean equatorial triad of the given date.\n**\n**  Called:\n**     eraBp00      frame bias and precession matrices, IAU 2000\n**\n**  Reference:\n**\n**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.\n**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.\n**     (2000)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rb[3][3], rp[3][3];\n\n\n/* Obtain the required matrix (discarding others). */\n   eraBp00(date1, date2, rb, rp, rbp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13128,"name":"aticqn.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAticqn(double ri, double di, eraASTROM *astrom,\n               int n, eraLDBODY b[], double *rc, double *dc)\n/*\n**  - - - - - - - - -\n**   e r a A t i c q n\n**  - - - - - - - - -\n**\n**  Quick CIRS to ICRS astrometric place transformation, given the star-\n**  independent astrometry parameters plus a list of light-deflecting\n**  bodies.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are all to be transformed for one date.\n**  The star-independent astrometry parameters can be obtained by\n**  calling one of the functions eraApci[13], eraApcg[13], eraApco[13]\n**  or eraApcs[13].\n*\n*  If the only light-deflecting body to be taken into account is the\n*  Sun, the eraAticq function can be used instead.\n**\n**  Given:\n**     ri,di  double      CIRS RA,Dec (radians)\n**     astrom eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**      n     int           number of bodies (Note 3)\n**      b     eraLDBODY[n] data for each of the n bodies (Notes 3,4):\n**       bm    double       mass of the body (solar masses, Note 5)\n**       dl    double       deflection limiter (Note 6)\n**       pv    [2][3]       barycentric PV of the body (au, au/day)\n**\n**  Returned:\n**     rc,dc  double     ICRS astrometric RA,Dec (radians)\n**\n**  Notes:\n**\n**  1) Iterative techniques are used for the aberration and light\n**     deflection corrections so that the functions eraAticqn and\n**     eraAtciqn are accurate inverses; even at the edge of the Sun's\n**     disk the discrepancy is only about 1 nanoarcsecond.\n**\n**  2) If the only light-deflecting body to be taken into account is the\n**     Sun, the eraAticq function can be used instead.\n**\n**  3) The struct b contains n entries, one for each body to be\n**     considered.  If n = 0, no gravitational light deflection will be\n**     applied, not even for the Sun.\n**\n**  4) The struct b should include an entry for the Sun as well as for\n**     any planet or other body to be taken into account.  The entries\n**     should be in the order in which the light passes the body.\n**\n**  5) In the entry in the b struct for body i, the mass parameter\n**     b[i].bm can, as required, be adjusted in order to allow for such\n**     effects as quadrupole field.\n**\n**  6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is\n**     the angular separation (in radians) between star and body at\n**     which limiting is applied.  As phi shrinks below the chosen\n**     threshold, the deflection is artificially reduced, reaching zero\n**     for phi = 0.   Example values suitable for a terrestrial\n**     observer, together with masses, are as follows:\n**\n**        body i     b[i].bm        b[i].dl\n**\n**        Sun        1.0            6e-6\n**        Jupiter    0.00095435     3e-9\n**        Saturn     0.00028574     3e-10\n**\n**  7) For efficiency, validation of the contents of the b array is\n**     omitted.  The supplied masses must be greater than zero, the\n**     position and velocity vectors must be right, and the deflection\n**     limiter greater than zero.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraZp        zero p-vector\n**     eraAb        stellar aberration\n**     eraLdn       light deflection by n bodies\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range +/- pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j, i;\n   double pi[3], ppr[3], pnat[3], pco[3], w, d[3], before[3], r2, r,\n          after[3];\n\n\n/* CIRS RA,Dec to Cartesian. */\n   eraS2c(ri, di, pi);\n\n/* Bias-precession-nutation, giving GCRS proper direction. */\n   eraTrxp(astrom->bpn, pi, ppr);\n\n/* Aberration, giving GCRS natural direction. */\n   eraZp(d);\n   for (j = 0; j < 2; j++) {\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         w = ppr[i] - d[i];\n         before[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         before[i] /= r;\n      }\n      eraAb(before, astrom->v, astrom->em, astrom->bm1, after);\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         d[i] = after[i] - before[i];\n         w = ppr[i] - d[i];\n         pnat[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         pnat[i] /= r;\n      }\n   }\n\n/* Light deflection, giving BCRS coordinate direction. */\n   eraZp(d);\n   for (j = 0; j < 5; j++) {\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         w = pnat[i] - d[i];\n         before[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         before[i] /= r;\n      }\n      eraLdn(n, b, astrom->eb, before, after);\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         d[i] = after[i] - before[i];\n         w = pnat[i] - d[i];\n         pco[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         pco[i] /= r;\n      }\n   }\n\n/* ICRS astrometric RA,Dec. */\n   eraC2s(pco, &w, dc);\n   *rc = eraAnp(w);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13129,"name":"eceq06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraEceq06(double date1, double date2, double dl, double db,\n               double *dr, double *dd)\n/*\n**  - - - - - - - - - -\n**   e r a E c e q 0 6\n**  - - - - - - - - - -\n**\n**  Transformation from ecliptic coordinates (mean equinox and ecliptic\n**  of date) to ICRS RA,Dec, using the IAU 2006 precession model.\n**\n**  Given:\n**     date1,date2 double TT as a 2-part Julian date (Note 1)\n**     dl,db       double ecliptic longitude and latitude (radians)\n**\n**  Returned:\n**     dr,dd       double ICRS right ascension and declination (radians)\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) No assumptions are made about whether the coordinates represent\n**     starlight and embody astrometric effects such as parallax or\n**     aberration.\n**\n**  3) The transformation is approximately that from ecliptic longitude\n**     and latitude (mean equinox and ecliptic of date) to mean J2000.0\n**     right ascension and declination, with only frame bias (always\n**     less than 25 mas) to disturb this classical picture.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraC2s       unit vector to spherical coordinates\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rm[3][3], v1[3], v2[3], a, b;\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dl, db, v1);\n\n/* Rotation matrix, ICRS equatorial to ecliptic. */\n   eraEcm06(date1, date2, rm);\n\n/* The transformation from ecliptic to ICRS. */\n   eraTrxp(rm, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, &a, &b);\n\n/* Express in conventional ranges. */\n   *dr = eraAnp(a);\n   *dd = eraAnpm(b);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13130,"name":"cr.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraCr(double r[3][3], double c[3][3])\n/*\n**  - - - - - -\n**   e r a C r\n**  - - - - - -\n**\n**  Copy an r-matrix.\n**\n**  Given:\n**     r        double[3][3]    r-matrix to be copied\n**\n**  Returned:\n**     c        double[3][3]    copy\n**\n**  Called:\n**     eraCp        copy p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraCp(r[0], c[0]);\n   eraCp(r[1], c[1]);\n   eraCp(r[2], c[2]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13131,"name":"tf2a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n#include <stdlib.h>\n\nint eraTf2a(char s, int ihour, int imin, double sec, double *rad)\n/*\n**  - - - - - - - -\n**   e r a T f 2 a\n**  - - - - - - - -\n**\n**  Convert hours, minutes, seconds to radians.\n**\n**  Given:\n**     s         char    sign:  '-' = negative, otherwise positive\n**     ihour     int     hours\n**     imin      int     minutes\n**     sec       double  seconds\n**\n**  Returned:\n**     rad       double  angle in radians\n**\n**  Returned (function value):\n**               int     status:  0 = OK\n**                                1 = ihour outside range 0-23\n**                                2 = imin outside range 0-59\n**                                3 = sec outside range 0-59.999...\n**\n**  Notes:\n**\n**  1)  The result is computed even if any of the range checks fail.\n**\n**  2)  Negative ihour, imin and/or sec produce a warning status, but\n**      the absolute value is used in the conversion.\n**\n**  3)  If there are multiple errors, the status value reflects only the\n**      first, the smallest taking precedence.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Compute the interval. */\n   *rad  = ( s == '-' ? -1.0 : 1.0 ) *\n           ( 60.0 * ( 60.0 * ( (double) abs(ihour) ) +\n                             ( (double) abs(imin) ) ) +\n                                        fabs(sec) ) * ERFA_DS2R;\n\n/* Validate arguments and return status. */\n   if ( ihour < 0 || ihour > 23 ) return 1;\n   if ( imin < 0 || imin > 59 ) return 2;\n   if ( sec < 0.0 || sec >= 60.0 ) return 3;\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13132,"name":"rv2m.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRv2m(double w[3], double r[3][3])\n/*\n**  - - - - - - - -\n**   e r a R v 2 m\n**  - - - - - - - -\n**\n**  Form the r-matrix corresponding to a given r-vector.\n**\n**  Given:\n**     w        double[3]      rotation vector (Note 1)\n**\n**  Returned:\n**     r        double[3][3]    rotation matrix\n**\n**  Notes:\n**\n**  1) A rotation matrix describes a rotation through some angle about\n**     some arbitrary axis called the Euler axis.  The \"rotation vector\"\n**     supplied to This function has the same direction as the Euler\n**     axis, and its magnitude is the angle in radians.\n**\n**  2) If w is null, the unit matrix is returned.\n**\n**  3) The reference frame rotates clockwise as seen looking along the\n**     rotation vector from the origin.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y, z, phi, s, c, f;\n\n\n/* Euler angle (magnitude of rotation vector) and functions. */\n   x = w[0];\n   y = w[1];\n   z = w[2];\n   phi = sqrt(x*x + y*y + z*z);\n   s = sin(phi);\n   c = cos(phi);\n   f = 1.0 - c;\n\n/* Euler axis (direction of rotation vector), perhaps null. */\n   if (phi > 0.0) {\n       x /= phi;\n       y /= phi;\n       z /= phi;\n   }\n\n/* Form the rotation matrix. */\n   r[0][0] = x*x*f + c;\n   r[0][1] = x*y*f + z*s;\n   r[0][2] = x*z*f - y*s;\n   r[1][0] = y*x*f - z*s;\n   r[1][1] = y*y*f + c;\n   r[1][2] = y*z*f + x*s;\n   r[2][0] = z*x*f + y*s;\n   r[2][1] = z*y*f - x*s;\n   r[2][2] = z*z*f + c;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13133,"name":"atoc13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraAtoc13(const char *type, double ob1, double ob2,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *rc, double *dc)\n/*\n**  - - - - - - - - - -\n**   e r a A t o c 1 3\n**  - - - - - - - - - -\n**\n**  Observed place at a groundbased site to to ICRS astrometric RA,Dec.\n**  The caller supplies UTC, site coordinates, ambient air conditions\n**  and observing wavelength.\n**\n**  Given:\n**     type   char[]   type of coordinates - \"R\", \"H\" or \"A\" (Notes 1,2)\n**     ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)\n**     ob2    double   observed ZD or Dec (radians)\n**     utc1   double   UTC as a 2-part...\n**     utc2   double   ...quasi Julian Date (Notes 3,4)\n**     dut1   double   UT1-UTC (seconds, Note 5)\n**     elong  double   longitude (radians, east +ve, Note 6)\n**     phi    double   geodetic latitude (radians, Note 6)\n**     hm     double   height above ellipsoid (m, geodetic Notes 6,8)\n**     xp,yp  double   polar motion coordinates (radians, Note 7)\n**     phpa   double   pressure at the observer (hPa = mB, Note 8)\n**     tc     double   ambient temperature at the observer (deg C)\n**     rh     double   relative humidity at the observer (range 0-1)\n**     wl     double   wavelength (micrometers, Note 9)\n**\n**  Returned:\n**     rc,dc  double   ICRS astrometric RA,Dec (radians)\n**\n**  Returned (function value):\n**            int      status: +1 = dubious year (Note 4)\n**                              0 = OK\n**                             -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  \"Observed\" Az,ZD means the position that would be seen by a\n**      perfect geodetically aligned theodolite.  (Zenith distance is\n**      used rather than altitude in order to reflect the fact that no\n**      allowance is made for depression of the horizon.)  This is\n**      related to the observed HA,Dec via the standard rotation, using\n**      the geodetic latitude (corrected for polar motion), while the\n**      observed HA and RA are related simply through the Earth rotation\n**      angle and the site longitude.  \"Observed\" RA,Dec or HA,Dec thus\n**      means the position that would be seen by a perfect equatorial\n**      with its polar axis aligned to the Earth's axis of rotation.\n**\n**  2)  Only the first character of the type argument is significant.\n**      \"R\" or \"r\" indicates that ob1 and ob2 are the observed right\n**      ascension and declination;  \"H\" or \"h\" indicates that they are\n**      hour angle (west +ve) and declination;  anything else (\"A\" or\n**      \"a\" is recommended) indicates that ob1 and ob2 are azimuth\n**      (north zero, east 90 deg) and zenith distance.\n**\n**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  4)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the\n**      future to be trusted.  See eraDat for further details.\n**\n**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  6)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many\n**      applications, xp and yp can be set to zero.\n**\n**  8)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB), is\n**      available, an adequate estimate of hm can be obtained from the\n**      expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to\n**      the pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  9)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  10) The accuracy of the result is limited by the corrections for\n**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**      Providing the meteorological parameters are known accurately and\n**      there are no gross local effects, the predicted astrometric\n**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**      (radio) for a zenith distance of less than 70 degrees, better\n**      than 30 arcsec (optical or radio) at 85 degrees and better\n**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**      Without refraction, the complementary functions eraAtco13 and\n**      eraAtoc13 are self-consistent to better than 1 microarcsecond\n**      all over the celestial sphere.  With refraction included,\n**      consistency falls off at high zenith distances, but is still\n**      better than 0.05 arcsec at 85 degrees.\n**\n**  11) It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  Called:\n**     eraApco13    astrometry parameters, ICRS-observed\n**     eraAtoiq     quick observed to CIRS\n**     eraAticq     quick CIRS to ICRS\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   eraASTROM astrom;\n   double eo, ri, di;\n\n\n/* Star-independent astrometry parameters. */\n   j = eraApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp,\n                 phpa, tc, rh, wl, &astrom, &eo);\n\n/* Abort if bad UTC. */\n   if ( j < 0 ) return j;\n\n/* Transform observed to CIRS. */\n   eraAtoiq(type, ob1, ob2, &astrom, &ri, &di);\n\n/* Transform CIRS to ICRS. */\n   eraAticq(ri, di, &astrom, rc, dc);\n\n/* Return OK/warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13134,"name":"a2tf.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraA2tf(int ndp, double angle, char *sign, int ihmsf[4])\n/*\n**  - - - - - - - -\n**   e r a A 2 t f\n**  - - - - - - - -\n**\n**  Decompose radians into hours, minutes, seconds, fraction.\n**\n**  Given:\n**     ndp     int     resolution (Note 1)\n**     angle   double  angle in radians\n**\n**  Returned:\n**     sign    char    '+' or '-'\n**     ihmsf   int[4]  hours, minutes, seconds, fraction\n**\n**  Called:\n**     eraD2tf      decompose days to hms\n**\n**  Notes:\n**\n**  1) The argument ndp is interpreted as follows:\n**\n**     ndp         resolution\n**      :      ...0000 00 00\n**     -7         1000 00 00\n**     -6          100 00 00\n**     -5           10 00 00\n**     -4            1 00 00\n**     -3            0 10 00\n**     -2            0 01 00\n**     -1            0 00 10\n**      0            0 00 01\n**      1            0 00 00.1\n**      2            0 00 00.01\n**      3            0 00 00.001\n**      :            0 00 00.000...\n**\n**  2) The largest positive useful value for ndp is determined by the\n**     size of angle, the format of doubles on the target platform, and\n**     the risk of overflowing ihmsf[3].  On a typical platform, for\n**     angle up to 2pi, the available floating-point precision might\n**     correspond to ndp=12.  However, the practical limit is typically\n**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is\n**     only 16 bits.\n**\n**  3) The absolute value of angle may exceed 2pi.  In cases where it\n**     does not, it is up to the caller to test for and handle the\n**     case where angle is very nearly 2pi and rounds up to 24 hours,\n**     by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Scale then use days to h,m,s function. */\n   eraD2tf(ndp, angle/ERFA_D2PI, sign, ihmsf);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13135,"name":"tttai.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTttai(double tt1, double tt2, double *tai1, double *tai2)\n/*\n**  - - - - - - - - -\n**   e r a T t t a i\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Terrestrial Time, TT, to International\n**  Atomic Time, TAI.\n**\n**  Given:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned:\n**     tai1,tai2  double    TAI as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Note:\n**\n**     tt1+tt2 is Julian Date, apportioned in any convenient way between\n**     the two arguments, for example where tt1 is the Julian Day Number\n**     and tt2 is the fraction of a day.  The returned tai1,tai2 follow\n**     suit.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* TT minus TAI (days). */\n   static const double dtat = ERFA_TTMTAI/ERFA_DAYSEC;\n\n\n/* Result, safeguarding precision. */\n   if ( tt1 > tt2 ) {\n      *tai1 = tt1;\n      *tai2 = tt2 - dtat;\n   } else {\n      *tai1 = tt1 - dtat;\n      *tai2 = tt2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13136,"name":"pn00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn00a(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3])\n/*\n**  - - - - - - - - -\n**   e r a P n 0 0 a\n**  - - - - - - - - -\n**\n**  Precession-nutation, IAU 2000A model:  a multi-purpose function,\n**  supporting classical (equinox-based) use directly and CIO-based\n**  use indirectly.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps    double          nutation (Note 2)\n**     epsa         double          mean obliquity (Note 3)\n**     rb           double[3][3]    frame bias matrix (Note 4)\n**     rp           double[3][3]    precession matrix (Note 5)\n**     rbp          double[3][3]    bias-precession matrix (Note 6)\n**     rn           double[3][3]    nutation matrix (Note 7)\n**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)\n**\n**  Notes:\n**\n**  1)  The TT date date1+date2 is a Julian Date, apportioned in any\n**      convenient way between the two arguments.  For example,\n**      JD(TT)=2450123.7 could be expressed in any of these ways,\n**      among others:\n**\n**             date1          date2\n**\n**          2450123.7           0.0       (JD method)\n**          2451545.0       -1421.3       (J2000 method)\n**          2400000.5       50123.2       (MJD method)\n**          2450123.5           0.2       (date & time method)\n**\n**      The JD method is the most natural and convenient to use in\n**      cases where the loss of several decimal digits of resolution\n**      is acceptable.  The J2000 method is best matched to the way\n**      the argument is handled internally and will deliver the\n**      optimum resolution.  The MJD method and the date & time methods\n**      are both good compromises between resolution and convenience.\n**\n**  2)  The nutation components (luni-solar + planetary, IAU 2000A) in\n**      longitude and obliquity are in radians and with respect to the\n**      equinox and ecliptic of date.  Free core nutation is omitted;\n**      for the utmost accuracy, use the eraPn00  function, where the\n**      nutation components are caller-specified.  For faster but\n**      slightly less accurate results, use the eraPn00b function.\n**\n**  3)  The mean obliquity is consistent with the IAU 2000 precession.\n**\n**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean\n**      equator and equinox by applying frame bias.\n**\n**  5)  The matrix rp transforms vectors from J2000.0 mean equator and\n**      equinox to mean equator and equinox of date by applying\n**      precession.\n**\n**  6)  The matrix rbp transforms vectors from GCRS to mean equator and\n**      equinox of date by applying frame bias then precession.  It is\n**      the product rp x rb.\n**\n**  7)  The matrix rn transforms vectors from mean equator and equinox\n**      of date to true equator and equinox of date by applying the\n**      nutation (luni-solar + planetary).\n**\n**  8)  The matrix rbpn transforms vectors from GCRS to true equator and\n**      equinox of date.  It is the product rn x rbp, applying frame\n**      bias, precession and nutation in that order.\n**\n**  9)  The X,Y,Z coordinates of the IAU 2000A Celestial Intermediate\n**      Pole are elements (3,1-3) of the GCRS-to-true matrix,\n**      i.e. rbpn[2][0-2].\n**\n**  10) It is permissible to re-use the same array in the returned\n**      arguments.  The arrays are filled in the order given.\n**\n**  Called:\n**     eraNut00a    nutation, IAU 2000A\n**     eraPn00      bias/precession/nutation results, IAU 2000\n**\n**  Reference:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Nutation. */\n   eraNut00a(date1, date2, dpsi, deps);\n\n/* Remaining results. */\n   eraPn00(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13137,"name":"pn00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn00(double date1, double date2, double dpsi, double deps,\n             double *epsa,\n             double rb[3][3], double rp[3][3], double rbp[3][3],\n             double rn[3][3], double rbpn[3][3])\n/*\n**  - - - - - - - -\n**   e r a P n 0 0\n**  - - - - - - - -\n**\n**  Precession-nutation, IAU 2000 model:  a multi-purpose function,\n**  supporting classical (equinox-based) use directly and CIO-based\n**  use indirectly.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**     dpsi,deps    double          nutation (Note 2)\n**\n**  Returned:\n**     epsa         double          mean obliquity (Note 3)\n**     rb           double[3][3]    frame bias matrix (Note 4)\n**     rp           double[3][3]    precession matrix (Note 5)\n**     rbp          double[3][3]    bias-precession matrix (Note 6)\n**     rn           double[3][3]    nutation matrix (Note 7)\n**     rbpn         double[3][3]    GCRS-to-true matrix (Note 8)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The caller is responsible for providing the nutation components;\n**     they are in longitude and obliquity, in radians and are with\n**     respect to the equinox and ecliptic of date.  For high-accuracy\n**     applications, free core nutation should be included as well as\n**     any other relevant corrections to the position of the CIP.\n**\n**  3) The returned mean obliquity is consistent with the IAU 2000\n**     precession-nutation models.\n**\n**  4) The matrix rb transforms vectors from GCRS to J2000.0 mean\n**     equator and equinox by applying frame bias.\n**\n**  5) The matrix rp transforms vectors from J2000.0 mean equator and\n**     equinox to mean equator and equinox of date by applying\n**     precession.\n**\n**  6) The matrix rbp transforms vectors from GCRS to mean equator and\n**     equinox of date by applying frame bias then precession.  It is\n**     the product rp x rb.\n**\n**  7) The matrix rn transforms vectors from mean equator and equinox of\n**     date to true equator and equinox of date by applying the nutation\n**     (luni-solar + planetary).\n**\n**  8) The matrix rbpn transforms vectors from GCRS to true equator and\n**     equinox of date.  It is the product rn x rbp, applying frame\n**     bias, precession and nutation in that order.\n**\n**  9) It is permissible to re-use the same array in the returned\n**     arguments.  The arrays are filled in the order given.\n**\n**  Called:\n**     eraPr00      IAU 2000 precession adjustments\n**     eraObl80     mean obliquity, IAU 1980\n**     eraBp00      frame bias and precession matrices, IAU 2000\n**     eraCr        copy r-matrix\n**     eraNumat     form nutation matrix\n**     eraRxr       product of two r-matrices\n**\n**  Reference:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsipr, depspr, rbpw[3][3], rnw[3][3];\n\n\n/* IAU 2000 precession-rate adjustments. */\n   eraPr00(date1, date2, &dpsipr, &depspr);\n\n/* Mean obliquity, consistent with IAU 2000 precession-nutation. */\n   *epsa = eraObl80(date1, date2) + depspr;\n\n/* Frame bias and precession matrices and their product. */\n   eraBp00(date1, date2, rb, rp, rbpw);\n   eraCr(rbpw, rbp);\n\n/* Nutation matrix. */\n   eraNumat(*epsa, dpsi, deps, rnw);\n   eraCr(rnw, rn);\n\n/* Bias-precession-nutation matrix (classical). */\n   eraRxr(rnw, rbpw, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":13138,"name":"__all__","nodeType":"Attribute","startLoc":24,"text":"__all__"},{"id":13139,"name":"seps.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraSeps(double al, double ap, double bl, double bp)\n/*\n**  - - - - - - - -\n**   e r a S e p s\n**  - - - - - - - -\n**\n**  Angular separation between two sets of spherical coordinates.\n**\n**  Given:\n**     al     double       first longitude (radians)\n**     ap     double       first latitude (radians)\n**     bl     double       second longitude (radians)\n**     bp     double       second latitude (radians)\n**\n**  Returned (function value):\n**            double       angular separation (radians)\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraSepp      angular separation between two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ac[3], bc[3], s;\n\n\n/* Spherical to Cartesian. */\n   eraS2c(al, ap, ac);\n   eraS2c(bl, bp, bc);\n\n/* Angle between the vectors. */\n   s = eraSepp(ac, bc);\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":0,"comment":"","endLoc":7,"header":"coordinate_helpers.py#<anonymous>","id":13140,"name":"<anonymous>","nodeType":"Function","startLoc":4,"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']"},{"id":13141,"name":"pmpx.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPmpx(double rc, double dc, double pr, double pd,\n             double px, double rv, double pmt, double pob[3],\n             double pco[3])\n/*\n**  - - - - - - - -\n**   e r a P m p x\n**  - - - - - - - -\n**\n**  Proper motion and parallax.\n**\n**  Given:\n**     rc,dc  double     ICRS RA,Dec at catalog epoch (radians)\n**     pr     double     RA proper motion (radians/year; Note 1)\n**     pd     double     Dec proper motion (radians/year)\n**     px     double     parallax (arcsec)\n**     rv     double     radial velocity (km/s, +ve if receding)\n**     pmt    double     proper motion time interval (SSB, Julian years)\n**     pob    double[3]  SSB to observer vector (au)\n**\n**  Returned:\n**     pco    double[3]  coordinate direction (BCRS unit vector)\n**\n**  Notes:\n**\n**  1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  2) The proper motion time interval is for when the starlight\n**     reaches the solar system barycenter.\n**\n**  3) To avoid the need for iteration, the Roemer effect (i.e. the\n**     small annual modulation of the proper motion coming from the\n**     changing light time) is applied approximately, using the\n**     direction of the star at the catalog epoch.\n**\n**  References:\n**\n**     1984 Astronomical Almanac, pp B39-B41.\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013), Section 7.2.\n**\n**  Called:\n**     eraPdp       scalar product of two p-vectors\n**     eraPn        decompose p-vector into modulus and direction\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Km/s to au/year */\n   const double VF = ERFA_DAYSEC*ERFA_DJM/ERFA_DAU;\n\n/* Light time for 1 au, Julian years */\n   const double AULTY = ERFA_AULT/ERFA_DAYSEC/ERFA_DJY;\n\n   int i;\n   double sr, cr, sd, cd, x, y, z, p[3], dt, pxr, w, pdz, pm[3];\n\n\n/* Spherical coordinates to unit vector (and useful functions). */\n   sr = sin(rc);\n   cr = cos(rc);\n   sd = sin(dc);\n   cd = cos(dc);\n   p[0] = x = cr*cd;\n   p[1] = y = sr*cd;\n   p[2] = z = sd;\n\n/* Proper motion time interval (y) including Roemer effect. */\n   dt = pmt + eraPdp(p,pob)*AULTY;\n\n/* Space motion (radians per year). */\n   pxr = px * ERFA_DAS2R;\n   w = VF * rv * pxr;\n   pdz = pd * z;\n   pm[0] = - pr*y - pdz*cr + w*x;\n   pm[1] =   pr*x - pdz*sr + w*y;\n   pm[2] =   pd*cd + w*z;\n\n/* Coordinate direction of star (unit vector, BCRS). */\n   for (i = 0; i < 3; i++) {\n      p[i] += dt*pm[i] - pxr*pob[i];\n   }\n   eraPn(p, &w, pco);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13142,"name":"trxpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraTrxpv(double r[3][3], double pv[2][3], double trpv[2][3])\n/*\n**  - - - - - - - - -\n**   e r a T r x p v\n**  - - - - - - - - -\n**\n**  Multiply a pv-vector by the transpose of an r-matrix.\n**\n**  Given:\n**     r        double[3][3]    r-matrix\n**     pv       double[2][3]    pv-vector\n**\n**  Returned:\n**     trpv     double[2][3]    r * pv\n**\n**  Note:\n**     It is permissible for pv and trpv to be the same array.\n**\n**  Called:\n**     eraTr        transpose r-matrix\n**     eraRxpv      product of r-matrix and pv-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double tr[3][3];\n\n\n/* Transpose of matrix r. */\n   eraTr(r, tr);\n\n/* Matrix tr * vector pv -> vector trpv. */\n   eraRxpv(tr, pv, trpv);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13143,"name":"apcg13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApcg13(double date1, double date2, eraASTROM *astrom)\n/*\n**  - - - - - - - - - -\n**   e r a A p c g 1 3\n**  - - - - - - - - - -\n**\n**  For a geocentric observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and GCRS coordinates.\n**  The caller supplies the date, and ERFA models are used to predict\n**  the Earth ephemeris.\n**\n**  The parameters produced by this function are required in the\n**  parallax, light deflection and aberration parts of the astrometric\n**  transformation chain.\n**\n**  Given:\n**     date1  double     TDB as a 2-part...\n**     date2  double     ...Julian Date (Note 1)\n**\n**  Returned:\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) In cases where the caller wishes to supply his own Earth\n**     ephemeris, the function eraApcg can be used instead of the present\n**     function.\n**\n**  4) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  5) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraEpv00     Earth position and velocity\n**     eraApcg      astrometry parameters, ICRS-GCRS, geocenter\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ehpv[2][3], ebpv[2][3];\n\n\n/* Earth barycentric & heliocentric position/velocity (au, au/d). */\n   (void) eraEpv00(date1, date2, ehpv, ebpv);\n\n/* Compute the star-independent astrometry parameters. */\n   eraApcg(date1, date2, ebpv, ehpv[0], astrom);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13144,"name":"starpm.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraStarpm(double ra1, double dec1,\n              double pmr1, double pmd1, double px1, double rv1,\n              double ep1a, double ep1b, double ep2a, double ep2b,\n              double *ra2, double *dec2,\n              double *pmr2, double *pmd2, double *px2, double *rv2)\n/*\n**  - - - - - - - - - -\n**   e r a S t a r p m\n**  - - - - - - - - - -\n**\n**  Star proper motion:  update star catalog data for space motion.\n**\n**  Given:\n**     ra1    double     right ascension (radians), before\n**     dec1   double     declination (radians), before\n**     pmr1   double     RA proper motion (radians/year), before\n**     pmd1   double     Dec proper motion (radians/year), before\n**     px1    double     parallax (arcseconds), before\n**     rv1    double     radial velocity (km/s, +ve = receding), before\n**     ep1a   double     \"before\" epoch, part A (Note 1)\n**     ep1b   double     \"before\" epoch, part B (Note 1)\n**     ep2a   double     \"after\" epoch, part A (Note 1)\n**     ep2b   double     \"after\" epoch, part B (Note 1)\n**\n**  Returned:\n**     ra2    double     right ascension (radians), after\n**     dec2   double     declination (radians), after\n**     pmr2   double     RA proper motion (radians/year), after\n**     pmd2   double     Dec proper motion (radians/year), after\n**     px2    double     parallax (arcseconds), after\n**     rv2    double     radial velocity (km/s, +ve = receding), after\n**\n**  Returned (function value):\n**            int        status:\n**                          -1 = system error (should not occur)\n**                           0 = no warnings or errors\n**                           1 = distance overridden (Note 6)\n**                           2 = excessive velocity (Note 7)\n**                           4 = solution didn't converge (Note 8)\n**                        else = binary logical OR of the above warnings\n**\n**  Notes:\n**\n**  1) The starting and ending TDB dates ep1a+ep1b and ep2a+ep2b are\n**     Julian Dates, apportioned in any convenient way between the two\n**     parts (A and B).  For example, JD(TDB)=2450123.7 could be\n**     expressed in any of these ways, among others:\n**\n**             epna          epnb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) In accordance with normal star-catalog conventions, the object's\n**     right ascension and declination are freed from the effects of\n**     secular aberration.  The frame, which is aligned to the catalog\n**     equator and equinox, is Lorentzian and centered on the SSB.\n**\n**     The proper motions are the rate of change of the right ascension\n**     and declination at the catalog epoch and are in radians per TDB\n**     Julian year.\n**\n**     The parallax and radial velocity are in the same frame.\n**\n**  3) Care is needed with units.  The star coordinates are in radians\n**     and the proper motions in radians per Julian year, but the\n**     parallax is in arcseconds.\n**\n**  4) The RA proper motion is in terms of coordinate angle, not true\n**     angle.  If the catalog uses arcseconds for both RA and Dec proper\n**     motions, the RA proper motion will need to be divided by cos(Dec)\n**     before use.\n**\n**  5) Straight-line motion at constant speed, in the inertial frame,\n**     is assumed.\n**\n**  6) An extremely small (or zero or negative) parallax is interpreted\n**     to mean that the object is on the \"celestial sphere\", the radius\n**     of which is an arbitrary (large) value (see the eraStarpv\n**     function for the value used).  When the distance is overridden in\n**     this way, the status, initially zero, has 1 added to it.\n**\n**  7) If the space velocity is a significant fraction of c (see the\n**     constant VMAX in the function eraStarpv), it is arbitrarily set\n**     to zero.  When this action occurs, 2 is added to the status.\n**\n**  8) The relativistic adjustment carried out in the eraStarpv function\n**     involves an iterative calculation.  If the process fails to\n**     converge within a set number of iterations, 4 is added to the\n**     status.\n**\n**  Called:\n**     eraStarpv    star catalog data to space motion pv-vector\n**     eraPvu       update a pv-vector\n**     eraPdp       scalar product of two p-vectors\n**     eraPvstar    space motion pv-vector to star catalog data\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double pv1[2][3], tl1, dt, pv[2][3], r2, rdv, v2, c2mv2, tl2,\n          pv2[2][3];\n   int j1, j2, j;\n\n\n/* RA,Dec etc. at the \"before\" epoch to space motion pv-vector. */\n   j1 = eraStarpv(ra1, dec1, pmr1, pmd1, px1, rv1, pv1);\n\n/* Light time when observed (days). */\n   tl1 = eraPm(pv1[0]) / ERFA_DC;\n\n/* Time interval, \"before\" to \"after\" (days). */\n   dt = (ep2a - ep1a) + (ep2b - ep1b);\n\n/* Move star along track from the \"before\" observed position to the */\n/* \"after\" geometric position. */\n   eraPvu(dt + tl1, pv1, pv);\n\n/* From this geometric position, deduce the observed light time (days) */\n/* at the \"after\" epoch (with theoretically unneccessary error check). */\n   r2 = eraPdp(pv[0], pv[0]);\n   rdv = eraPdp(pv[0], pv[1]);\n   v2 = eraPdp(pv[1], pv[1]);\n   c2mv2 = ERFA_DC*ERFA_DC - v2;\n   if (c2mv2 <=  0) return -1;\n   tl2 = (-rdv + sqrt(rdv*rdv + c2mv2*r2)) / c2mv2;\n\n/* Move the position along track from the observed place at the */\n/* \"before\" epoch to the observed place at the \"after\" epoch. */\n   eraPvu(dt + (tl1 - tl2), pv1, pv2);\n\n/* Space motion pv-vector to RA,Dec etc. at the \"after\" epoch. */\n   j2 = eraPvstar(pv2, ra2, dec2, pmr2, pmd2, px2, rv2);\n\n/* Final status. */\n   j = (j2 == 0) ? j1 : -1;\n\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13145,"name":"c2teqx.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2teqx(double rbpn[3][3], double gst, double rpom[3][3],\n               double rc2t[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 t e q x\n**  - - - - - - - - - -\n**\n**  Assemble the celestial to terrestrial matrix from equinox-based\n**  components (the celestial-to-true matrix, the Greenwich Apparent\n**  Sidereal Time and the polar motion matrix).\n**\n**  Given:\n**     rbpn   double[3][3]  celestial-to-true matrix\n**     gst    double        Greenwich (apparent) Sidereal Time (radians)\n**     rpom   double[3][3]  polar-motion matrix\n**\n**  Returned:\n**     rc2t   double[3][3]  celestial-to-terrestrial matrix (Note 2)\n**\n**  Notes:\n**\n**  1) This function constructs the rotation matrix that transforms\n**     vectors in the celestial system into vectors in the terrestrial\n**     system.  It does so starting from precomputed components, namely\n**     the matrix which rotates from celestial coordinates to the\n**     true equator and equinox of date, the Greenwich Apparent Sidereal\n**     Time and the polar motion matrix.  One use of the present function\n**     is when generating a series of celestial-to-terrestrial matrices\n**     where only the Sidereal Time changes, avoiding the considerable\n**     overhead of recomputing the precession-nutation more often than\n**     necessary to achieve given accuracy objectives.\n**\n**  2) The relationship between the arguments is as follows:\n**\n**        [TRS] = rpom * R_3(gst) * rbpn * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003).\n**\n**  Called:\n**     eraCr        copy r-matrix\n**     eraRz        rotate around Z-axis\n**     eraRxr       product of two r-matrices\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r[3][3];\n\n\n/* Construct the matrix. */\n   eraCr(rbpn, r);\n   eraRz(gst, r);\n   eraRxr(rpom, r, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13146,"name":"fave03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFave03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a v e 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Venus.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Venus, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Venus (IERS Conventions 2003). */\n   a = fmod(3.176146697 + 1021.3285546211 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13147,"name":"tttdb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTttdb(double tt1, double tt2, double dtr,\n             double *tdb1, double *tdb2)\n/*\n**  - - - - - - - - -\n**   e r a T t t d b\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Terrestrial Time, TT, to Barycentric\n**  Dynamical Time, TDB.\n**\n**  Given:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**     dtr        double    TDB-TT in seconds\n**\n**  Returned:\n**     tdb1,tdb2  double    TDB as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tt1+tt2 is Julian Date, apportioned in any convenient way between\n**     the two arguments, for example where tt1 is the Julian Day Number\n**     and tt2 is the fraction of a day.  The returned tdb1,tdb2 follow\n**     suit.\n**\n**  2) The argument dtr represents the quasi-periodic component of the\n**     GR transformation between TT and TCB.  It is dependent upon the\n**     adopted solar-system ephemeris, and can be obtained by numerical\n**     integration, by interrogating a precomputed time ephemeris or by\n**     evaluating a model such as that implemented in the ERFA function\n**     eraDtdb.   The quantity is dominated by an annual term of 1.7 ms\n**     amplitude.\n**\n**  3) TDB is essentially the same as Teph, the time argument for the JPL\n**     solar system ephemerides.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     IAU 2006 Resolution 3\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtrd;\n\n\n/* Result, safeguarding precision. */\n   dtrd = dtr / ERFA_DAYSEC;\n   if ( tt1 > tt2 ) {\n      *tdb1 = tt1;\n      *tdb2 = tt2 + dtrd;\n   } else {\n      *tdb1 = tt1 + dtrd;\n      *tdb2 = tt2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13148,"name":"c2ibpn.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2ibpn(double date1, double date2, double rbpn[3][3],\n               double rc2i[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 i b p n\n**  - - - - - - - - - -\n**\n**  Form the celestial-to-intermediate matrix for a given date given\n**  the bias-precession-nutation matrix.  IAU 2000.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**     rbpn        double[3][3] celestial-to-true matrix (Note 2)\n**\n**  Returned:\n**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rbpn transforms vectors from GCRS to true equator (and\n**     CIO or equinox) of date.  Only the CIP (bottom row) is used.\n**\n**  3) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**              = RC2T * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  4) Although its name does not include \"00\", This function is in fact\n**     specific to the IAU 2000 models.\n**\n**  Called:\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraC2ixy     celestial-to-intermediate matrix, given X,Y\n**\n**  References:\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y;\n\n\n/* Extract the X,Y coordinates. */\n   eraBpn2xy(rbpn, &x, &y);\n\n/* Form the celestial-to-intermediate matrix (n.b. IAU 2000 specific). */\n   eraC2ixy(date1, date2, x, y, rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13149,"name":"atciq.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtciq(double rc, double dc,\n              double pr, double pd, double px, double rv,\n              eraASTROM *astrom, double *ri, double *di)\n/*\n**  - - - - - - - - -\n**   e r a A t c i q\n**  - - - - - - - - -\n**\n**  Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed\n**  star-independent astrometry parameters.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are to be transformed for one date.  The\n**  star-independent parameters can be obtained by calling one of the\n**  functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].\n**\n**  If the parallax and proper motions are zero the eraAtciqz function\n**  can be used instead.\n**\n**  Given:\n**     rc,dc  double     ICRS RA,Dec at J2000.0 (radians)\n**     pr     double     RA proper motion (radians/year; Note 3)\n**     pd     double     Dec proper motion (radians/year)\n**     px     double     parallax (arcsec)\n**     rv     double     radial velocity (km/s, +ve if receding)\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned:\n**     ri,di   double    CIRS RA,Dec (radians)\n**\n**  Notes:\n**\n**  1) All the vectors are with respect to BCRS axes.\n**\n**  2) Star data for an epoch other than J2000.0 (for example from the\n**     Hipparcos catalog, which has an epoch of J1991.25) will require a\n**     preliminary call to eraPmsafe before use.\n**\n**  3) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  Called:\n**     eraPmpx      proper motion and parallax\n**     eraLdsun     light deflection by the Sun\n**     eraAb        stellar aberration\n**     eraRxp       product of r-matrix and pv-vector\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double pco[3], pnat[3], ppr[3], pi[3], w;\n\n\n/* Proper motion and parallax, giving BCRS coordinate direction. */\n   eraPmpx(rc, dc, pr, pd, px, rv, astrom->pmt, astrom->eb, pco);\n\n/* Light deflection by the Sun, giving BCRS natural direction. */\n   eraLdsun(pco, astrom->eh, astrom->em, pnat);\n\n/* Aberration, giving GCRS proper direction. */\n   eraAb(pnat, astrom->v, astrom->em, astrom->bm1, ppr);\n\n/* Bias-precession-nutation, giving CIRS proper direction. */\n   eraRxp(astrom->bpn, ppr, pi);\n\n/* CIRS RA,Dec. */\n   eraC2s(pi, &w, di);\n   *ri = eraAnp(w);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13150,"name":"bpn2xy.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraBpn2xy(double rbpn[3][3], double *x, double *y)\n/*\n**  - - - - - - - - - -\n**   e r a B p n 2 x y\n**  - - - - - - - - - -\n**\n**  Extract from the bias-precession-nutation matrix the X,Y coordinates\n**  of the Celestial Intermediate Pole.\n**\n**  Given:\n**     rbpn      double[3][3]  celestial-to-true matrix (Note 1)\n**\n**  Returned:\n**     x,y       double        Celestial Intermediate Pole (Note 2)\n**\n**  Notes:\n**\n**  1) The matrix rbpn transforms vectors from GCRS to true equator (and\n**     CIO or equinox) of date, and therefore the Celestial Intermediate\n**     Pole unit vector is the bottom row of the matrix.\n**\n**  2) The arguments x,y are components of the Celestial Intermediate\n**     Pole unit vector in the Geocentric Celestial Reference System.\n**\n**  Reference:\n**\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154\n**     (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Extract the X,Y coordinates. */\n   *x = rbpn[2][0];\n   *y = rbpn[2][1];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13151,"name":"faju03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFaju03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a j u 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Jupiter.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Jupiter, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Jupiter (IERS Conventions 2003). */\n   a = fmod(0.599546497 + 52.9690962641 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13152,"name":"bi00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraBi00(double *dpsibi, double *depsbi, double *dra)\n/*\n**  - - - - - - - -\n**   e r a B i 0 0\n**  - - - - - - - -\n**\n**  Frame bias components of IAU 2000 precession-nutation models (part\n**  of MHB2000 with additions).\n**\n**  Returned:\n**     dpsibi,depsbi  double  longitude and obliquity corrections\n**     dra            double  the ICRS RA of the J2000.0 mean equinox\n**\n**  Notes:\n**\n**  1) The frame bias corrections in longitude and obliquity (radians)\n**     are required in order to correct for the offset between the GCRS\n**     pole and the mean J2000.0 pole.  They define, with respect to the\n**     GCRS frame, a J2000.0 mean pole that is consistent with the rest\n**     of the IAU 2000A precession-nutation model.\n**\n**  2) In addition to the displacement of the pole, the complete\n**     description of the frame bias requires also an offset in right\n**     ascension.  This is not part of the IAU 2000A model, and is from\n**     Chapront et al. (2002).  It is returned in radians.\n**\n**  3) This is a supplemented implementation of one aspect of the IAU\n**     2000A nutation model, formally adopted by the IAU General\n**     Assembly in 2000, namely MHB2000 (Mathews et al. 2002).\n**\n**  References:\n**\n**     Chapront, J., Chapront-Touze, M. & Francou, G., Astron.\n**     Astrophys., 387, 700, 2002.\n**\n**     Mathews, P.M., Herring, T.A., Buffet, B.A., \"Modeling of nutation\n**     and precession   New nutation series for nonrigid Earth and\n**     insights into the Earth's interior\", J.Geophys.Res., 107, B4,\n**     2002.  The MHB2000 code itself was obtained on 9th September 2002\n**     from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* The frame bias corrections in longitude and obliquity */\n   const double DPBIAS = -0.041775  * ERFA_DAS2R,\n                DEBIAS = -0.0068192 * ERFA_DAS2R;\n\n/* The ICRS RA of the J2000.0 equinox (Chapront et al., 2002) */\n   const double DRA0 = -0.0146 * ERFA_DAS2R;\n\n\n/* Return the results (which are fixed). */\n   *dpsibi = DPBIAS;\n   *depsbi = DEBIAS;\n   *dra = DRA0;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13153,"name":"h2fk5.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraH2fk5(double rh, double dh,\n              double drh, double ddh, double pxh, double rvh,\n              double *r5, double *d5,\n              double *dr5, double *dd5, double *px5, double *rv5)\n/*\n**  - - - - - - - - -\n**   e r a H 2 f k 5\n**  - - - - - - - - -\n**\n**  Transform Hipparcos star data into the FK5 (J2000.0) system.\n**\n**  Given (all Hipparcos, epoch J2000.0):\n**     rh      double    RA (radians)\n**     dh      double    Dec (radians)\n**     drh     double    proper motion in RA (dRA/dt, rad/Jyear)\n**     ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)\n**     pxh     double    parallax (arcsec)\n**     rvh     double    radial velocity (km/s, positive = receding)\n**\n**  Returned (all FK5, equinox J2000.0, epoch J2000.0):\n**     r5      double    RA (radians)\n**     d5      double    Dec (radians)\n**     dr5     double    proper motion in RA (dRA/dt, rad/Jyear)\n**     dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)\n**     px5     double    parallax (arcsec)\n**     rv5     double    radial velocity (km/s, positive = receding)\n**\n**  Notes:\n**\n**  1) This function transforms Hipparcos star positions and proper\n**     motions into FK5 J2000.0.\n**\n**  2) The proper motions in RA are dRA/dt rather than\n**     cos(Dec)*dRA/dt, and are per year rather than per century.\n**\n**  3) The FK5 to Hipparcos transformation is modeled as a pure\n**     rotation and spin;  zonal errors in the FK5 catalog are not\n**     taken into account.\n**\n**  4) See also eraFk52h, eraFk5hz, eraHfk5z.\n**\n**  Called:\n**     eraStarpv    star catalog data to space motion pv-vector\n**     eraFk5hip    FK5 to Hipparcos rotation and spin\n**     eraRv2m      r-vector to r-matrix\n**     eraRxp       product of r-matrix and p-vector\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraPxp       vector product of two p-vectors\n**     eraPmp       p-vector minus p-vector\n**     eraPvstar    space motion pv-vector to star catalog data\n**\n**  Reference:\n**\n**     F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double pvh[2][3], r5h[3][3], s5h[3], sh[3], wxp[3], vv[3], pv5[2][3];\n\n\n/* Hipparcos barycentric position/velocity pv-vector (normalized). */\n   eraStarpv(rh, dh, drh, ddh, pxh, rvh, pvh);\n\n/* FK5 to Hipparcos orientation matrix and spin vector. */\n   eraFk5hip(r5h, s5h);\n\n/* Make spin units per day instead of per year. */\n   for ( i = 0; i < 3; s5h[i++] /= 365.25 );\n\n/* Orient the spin into the Hipparcos system. */\n   eraRxp(r5h, s5h, sh);\n\n/* De-orient the Hipparcos position into the FK5 system. */\n   eraTrxp(r5h, pvh[0], pv5[0]);\n\n/* Apply spin to the position giving an extra space motion component. */\n   eraPxp(pvh[0], sh, wxp);\n\n/* Subtract this component from the Hipparcos space motion. */\n   eraPmp(pvh[1], wxp, vv);\n\n/* De-orient the Hipparcos space motion into the FK5 system. */\n   eraTrxp(r5h, vv, pv5[1]);\n\n/* FK5 pv-vector to spherical. */\n   eraPvstar(pv5, r5, d5, dr5, dd5, px5, rv5);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13154,"name":"gc2gd.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraGc2gd ( int n, double xyz[3],\n               double *elong, double *phi, double *height )\n/*\n**  - - - - - - - - -\n**   e r a G c 2 g d\n**  - - - - - - - - -\n**\n**  Transform geocentric coordinates to geodetic using the specified\n**  reference ellipsoid.\n**\n**  Given:\n**     n       int        ellipsoid identifier (Note 1)\n**     xyz     double[3]  geocentric vector (Note 2)\n**\n**  Returned:\n**     elong   double     longitude (radians, east +ve, Note 3)\n**     phi     double     latitude (geodetic, radians, Note 3)\n**     height  double     height above ellipsoid (geodetic, Notes 2,3)\n**\n**  Returned (function value):\n**            int         status:  0 = OK\n**                                -1 = illegal identifier (Note 3)\n**                                -2 = internal error (Note 3)\n**\n**  Notes:\n**\n**  1) The identifier n is a number that specifies the choice of\n**     reference ellipsoid.  The following are supported:\n**\n**        n    ellipsoid\n**\n**        1     ERFA_WGS84\n**        2     ERFA_GRS80\n**        3     ERFA_WGS72\n**\n**     The n value has no significance outside the ERFA software.  For\n**     convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.\n**\n**  2) The geocentric vector (xyz, given) and height (height, returned)\n**     are in meters.\n**\n**  3) An error status -1 means that the identifier n is illegal.  An\n**     error status -2 is theoretically impossible.  In all error cases,\n**     all three results are set to -1e9.\n**\n**  4) The inverse transformation is performed in the function eraGd2gc.\n**\n**  Called:\n**     eraEform     Earth reference ellipsoids\n**     eraGc2gde    geocentric to geodetic transformation, general\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   double a, f;\n\n\n/* Obtain reference ellipsoid parameters. */\n   j = eraEform ( n, &a, &f );\n\n/* If OK, transform x,y,z to longitude, geodetic latitude, height. */\n   if ( j == 0 ) {\n      j = eraGc2gde ( a, f, xyz, elong, phi, height );\n      if ( j < 0 ) j = -2;\n   }\n\n/* Deal with any errors. */\n   if ( j < 0 ) {\n      *elong = -1e9;\n      *phi = -1e9;\n      *height = -1e9;\n   }\n\n/* Return the status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13155,"name":"nutm80.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNutm80(double date1, double date2, double rmatn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a N u t m 8 0\n**  - - - - - - - - - -\n**\n**  Form the matrix of nutation for a given date, IAU 1980 model.\n**\n**  Given:\n**     date1,date2    double          TDB date (Note 1)\n**\n**  Returned:\n**     rmatn          double[3][3]    nutation matrix\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(true) = rmatn * V(mean),\n**     where the p-vector V(true) is with respect to the true\n**     equatorial triad of date and the p-vector V(mean) is with\n**     respect to the mean equatorial triad of date.\n**\n**  Called:\n**     eraNut80     nutation, IAU 1980\n**     eraObl80     mean obliquity, IAU 1980\n**     eraNumat     form nutation matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsi, deps, epsa;\n\n\n/* Nutation components and mean obliquity. */\n   eraNut80(date1, date2, &dpsi, &deps);\n   epsa = eraObl80(date1, date2);\n\n/* Build the rotation matrix. */\n   eraNumat(epsa, dpsi, deps, rmatn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13156,"name":"ut1tai.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraUt1tai(double ut11, double ut12, double dta,\n              double *tai1, double *tai2)\n/*\n**  - - - - - - - - - -\n**   e r a U t 1 t a i\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Universal Time, UT1, to International\n**  Atomic Time, TAI.\n**\n**  Given:\n**     ut11,ut12  double    UT1 as a 2-part Julian Date\n**     dta        double    UT1-TAI in seconds\n**\n**  Returned:\n**     tai1,tai2  double    TAI as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) ut11+ut12 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where ut11 is the Julian\n**     Day Number and ut12 is the fraction of a day.  The returned\n**     tai1,tai2 follow suit.\n**\n**  2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is\n**     available from IERS tabulations.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtad;\n\n\n/* Result, safeguarding precision. */\n   dtad = dta / ERFA_DAYSEC;\n   if ( ut11 > ut12 ) {\n      *tai1 = ut11;\n      *tai2 = ut12 - dtad;\n   } else {\n      *tai1 = ut11 - dtad;\n      *tai2 = ut12;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13157,"name":"trxp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraTrxp(double r[3][3], double p[3], double trp[3])\n/*\n**  - - - - - - - -\n**   e r a T r x p\n**  - - - - - - - -\n**\n**  Multiply a p-vector by the transpose of an r-matrix.\n**\n**  Given:\n**     r        double[3][3]   r-matrix\n**     p        double[3]      p-vector\n**\n**  Returned:\n**     trp      double[3]      r * p\n**\n**  Note:\n**     It is permissible for p and trp to be the same array.\n**\n**  Called:\n**     eraTr        transpose r-matrix\n**     eraRxp       product of r-matrix and p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double tr[3][3];\n\n\n/* Transpose of matrix r. */\n   eraTr(r, tr);\n\n/* Matrix tr * vector p -> vector trp. */\n   eraRxp(tr, p, trp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13158,"name":"ir.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraIr(double r[3][3])\n/*\n**  - - - - - -\n**   e r a I r\n**  - - - - - -\n**\n**  Initialize an r-matrix to the identity matrix.\n**\n**  Returned:\n**     r       double[3][3]    r-matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   r[0][0] = 1.0;\n   r[0][1] = 0.0;\n   r[0][2] = 0.0;\n   r[1][0] = 0.0;\n   r[1][1] = 1.0;\n   r[1][2] = 0.0;\n   r[2][0] = 0.0;\n   r[2][1] = 0.0;\n   r[2][2] = 1.0;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13159,"name":"pmat76.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPmat76(double date1, double date2, double rmatp[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P m a t 7 6\n**  - - - - - - - - - -\n**\n**  Precession matrix from J2000.0 to a specified date, IAU 1976 model.\n**\n**  Given:\n**     date1,date2 double       ending date, TT (Note 1)\n**\n**  Returned:\n**     rmatp       double[3][3] precession matrix, J2000.0 -> date1+date2\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = RMATP * V(J2000),\n**     where the p-vector V(J2000) is with respect to the mean\n**     equatorial triad of epoch J2000.0 and the p-vector V(date)\n**     is with respect to the mean equatorial triad of the given\n**     date.\n**\n**  3) Though the matrix method itself is rigorous, the precession\n**     angles are expressed through canonical polynomials which are\n**     valid only for a limited time span.  In addition, the IAU 1976\n**     precession rate is known to be imperfect.  The absolute accuracy\n**     of the present formulation is better than 0.1 arcsec from\n**     1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD,\n**     and remains below 3 arcsec for the whole of the period\n**     500BC to 3000AD.  The errors exceed 10 arcsec outside the\n**     range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to\n**     5600AD and exceed 1000 arcsec outside 6800BC to 8200AD.\n**\n**  Called:\n**     eraPrec76    accumulated precession angles, IAU 1976\n**     eraIr        initialize r-matrix to identity\n**     eraRz        rotate around Z-axis\n**     eraRy        rotate around Y-axis\n**     eraCr        copy r-matrix\n**\n**  References:\n**\n**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.\n**      equations (6) & (7), p283.\n**\n**     Kaplan,G.H., 1981. USNO circular no. 163, pA2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double zeta, z, theta, wmat[3][3];\n\n\n/* Precession Euler angles, J2000.0 to specified date. */\n   eraPrec76(ERFA_DJ00, 0.0, date1, date2, &zeta, &z, &theta);\n\n/* Form the rotation matrix. */\n   eraIr(  wmat);\n   eraRz( -zeta, wmat);\n   eraRy(  theta, wmat);\n   eraRz( -z, wmat);\n   eraCr( wmat, rmatp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13160,"name":"pdp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraPdp(double a[3], double b[3])\n/*\n**  - - - - - - -\n**   e r a P d p\n**  - - - - - - -\n**\n**  p-vector inner (=scalar=dot) product.\n**\n**  Given:\n**     a      double[3]     first p-vector\n**     b      double[3]     second p-vector\n**\n**  Returned (function value):\n**            double        a . b\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double w;\n\n\n   w  = a[0] * b[0]\n      + a[1] * b[1]\n      + a[2] * b[2];\n\n   return w;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13161,"name":"gst06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGst06a(double uta, double utb, double tta, double ttb)\n/*\n**  - - - - - - - - - -\n**   e r a G s t 0 6 a\n**  - - - - - - - - - -\n**\n**  Greenwich apparent sidereal time (consistent with IAU 2000 and 2006\n**  resolutions).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich apparent sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both\n**     Julian Dates, apportioned in any convenient way between the\n**     argument pairs.  For example, JD=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**            Part A        Part B\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable (in the case of UT;  the TT is not at all critical\n**     in this respect).  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     rotation angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation\n**     and TT to predict the effects of precession-nutation.  If UT1 is\n**     used for both purposes, errors of order 100 microarcseconds\n**     result.\n**\n**  3) This GAST is compatible with the IAU 2000/2006 resolutions and\n**     must be used only in conjunction with IAU 2006 precession and\n**     IAU 2000A nutation.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  Called:\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraGst06     Greenwich apparent ST, IAU 2006, given NPB matrix\n**\n**  Reference:\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rnpb[3][3], gst;\n\n\n/* Classical nutation x precession x bias matrix, IAU 2000A. */\n   eraPnm06a(tta, ttb, rnpb);\n\n/* Greenwich apparent sidereal time. */\n   gst = eraGst06(uta, utb, tta, ttb, rnpb);\n\n   return gst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13162,"name":"faf03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFaf03(double t)\n/*\n**  - - - - - - - - -\n**   e r a F a f 0 3\n**  - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of the Moon minus mean longitude of the ascending\n**  node.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    F, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of the Moon minus that of the ascending node */\n/* (IERS Conventions 2003).                                    */\n   a = fmod(           335779.526232 +\n             t * ( 1739527262.8478 +\n             t * (       - 12.7512 +\n             t * (        - 0.001037 +\n             t * (          0.00000417 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R;\n\n   return a;\n\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13163,"name":"pn00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn00b(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3])\n/*\n**  - - - - - - - - -\n**   e r a P n 0 0 b\n**  - - - - - - - - -\n**\n**  Precession-nutation, IAU 2000B model:  a multi-purpose function,\n**  supporting classical (equinox-based) use directly and CIO-based\n**  use indirectly.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps    double          nutation (Note 2)\n**     epsa         double          mean obliquity (Note 3)\n**     rb           double[3][3]    frame bias matrix (Note 4)\n**     rp           double[3][3]    precession matrix (Note 5)\n**     rbp          double[3][3]    bias-precession matrix (Note 6)\n**     rn           double[3][3]    nutation matrix (Note 7)\n**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)\n**\n**  Notes:\n**\n**  1)  The TT date date1+date2 is a Julian Date, apportioned in any\n**      convenient way between the two arguments.  For example,\n**      JD(TT)=2450123.7 could be expressed in any of these ways,\n**      among others:\n**\n**             date1          date2\n**\n**          2450123.7           0.0       (JD method)\n**          2451545.0       -1421.3       (J2000 method)\n**          2400000.5       50123.2       (MJD method)\n**          2450123.5           0.2       (date & time method)\n**\n**      The JD method is the most natural and convenient to use in\n**      cases where the loss of several decimal digits of resolution\n**      is acceptable.  The J2000 method is best matched to the way\n**      the argument is handled internally and will deliver the\n**      optimum resolution.  The MJD method and the date & time methods\n**      are both good compromises between resolution and convenience.\n**\n**  2)  The nutation components (luni-solar + planetary, IAU 2000B) in\n**      longitude and obliquity are in radians and with respect to the\n**      equinox and ecliptic of date.  For more accurate results, but\n**      at the cost of increased computation, use the eraPn00a function.\n**      For the utmost accuracy, use the eraPn00  function, where the\n**      nutation components are caller-specified.\n**\n**  3)  The mean obliquity is consistent with the IAU 2000 precession.\n**\n**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean\n**      equator and equinox by applying frame bias.\n**\n**  5)  The matrix rp transforms vectors from J2000.0 mean equator and\n**      equinox to mean equator and equinox of date by applying\n**      precession.\n**\n**  6)  The matrix rbp transforms vectors from GCRS to mean equator and\n**      equinox of date by applying frame bias then precession.  It is\n**      the product rp x rb.\n**\n**  7)  The matrix rn transforms vectors from mean equator and equinox\n**      of date to true equator and equinox of date by applying the\n**      nutation (luni-solar + planetary).\n**\n**  8)  The matrix rbpn transforms vectors from GCRS to true equator and\n**      equinox of date.  It is the product rn x rbp, applying frame\n**      bias, precession and nutation in that order.\n**\n**  9)  The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate\n**      Pole are elements (3,1-3) of the GCRS-to-true matrix,\n**      i.e. rbpn[2][0-2].\n**\n**  10) It is permissible to re-use the same array in the returned\n**      arguments.  The arrays are filled in the stated order.\n**\n**  Called:\n**     eraNut00b    nutation, IAU 2000B\n**     eraPn00      bias/precession/nutation results, IAU 2000\n**\n**  Reference:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003).\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Nutation. */\n   eraNut00b(date1, date2, dpsi, deps);\n\n/* Remaining results. */\n   eraPn00(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13164,"name":"erfam.h","nodeType":"TextFile","path":"cextern/erfa","text":"#ifndef ERFAMHDEF\n#define ERFAMHDEF\n\n/*\n**  - - - - - - - -\n**   e r f a m . h\n**  - - - - - - - -\n**\n**  Macros used by ERFA library.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n\n/* Star-independent astrometry parameters */\ntypedef struct {\n   double pmt;        /* PM time interval (SSB, Julian years) */\n   double eb[3];      /* SSB to observer (vector, au) */\n   double eh[3];      /* Sun to observer (unit vector) */\n   double em;         /* distance from Sun to observer (au) */\n   double v[3];       /* barycentric observer velocity (vector, c) */\n   double bm1;        /* sqrt(1-|v|^2): reciprocal of Lorenz factor */\n   double bpn[3][3];  /* bias-precession-nutation matrix */\n   double along;      /* longitude + s' + dERA(DUT) (radians) */\n   double phi;        /* geodetic latitude (radians) */\n   double xpl;        /* polar motion xp wrt local meridian (radians) */\n   double ypl;        /* polar motion yp wrt local meridian (radians) */\n   double sphi;       /* sine of geodetic latitude */\n   double cphi;       /* cosine of geodetic latitude */\n   double diurab;     /* magnitude of diurnal aberration vector */\n   double eral;       /* \"local\" Earth rotation angle (radians) */\n   double refa;       /* refraction constant A (radians) */\n   double refb;       /* refraction constant B (radians) */\n} eraASTROM;\n/* (Vectors eb, eh, em and v are all with respect to BCRS axes.) */\n\n/* Body parameters for light deflection */\ntypedef struct {\n   double bm;         /* mass of the body (solar masses) */\n   double dl;         /* deflection limiter (radians^2/2) */\n   double pv[2][3];   /* barycentric PV of the body (au, au/day) */\n} eraLDBODY;\n\n/* Pi */\n#define ERFA_DPI (3.141592653589793238462643)\n\n/* 2Pi */\n#define ERFA_D2PI (6.283185307179586476925287)\n\n/* Radians to degrees */\n#define ERFA_DR2D (57.29577951308232087679815)\n\n/* Degrees to radians */\n#define ERFA_DD2R (1.745329251994329576923691e-2)\n\n/* Radians to arcseconds */\n#define ERFA_DR2AS (206264.8062470963551564734)\n\n/* Arcseconds to radians */\n#define ERFA_DAS2R (4.848136811095359935899141e-6)\n\n/* Seconds of time to radians */\n#define ERFA_DS2R (7.272205216643039903848712e-5)\n\n/* Arcseconds in a full circle */\n#define ERFA_TURNAS (1296000.0)\n\n/* Milliarcseconds to radians */\n#define ERFA_DMAS2R (ERFA_DAS2R / 1e3)\n\n/* Length of tropical year B1900 (days) */\n#define ERFA_DTY (365.242198781)\n\n/* Seconds per day. */\n#define ERFA_DAYSEC (86400.0)\n\n/* Days per Julian year */\n#define ERFA_DJY (365.25)\n\n/* Days per Julian century */\n#define ERFA_DJC (36525.0)\n\n/* Days per Julian millennium */\n#define ERFA_DJM (365250.0)\n\n/* Reference epoch (J2000.0), Julian Date */\n#define ERFA_DJ00 (2451545.0)\n\n/* Julian Date of Modified Julian Date zero */\n#define ERFA_DJM0 (2400000.5)\n\n/* Reference epoch (J2000.0), Modified Julian Date */\n#define ERFA_DJM00 (51544.5)\n\n/* 1977 Jan 1.0 as MJD */\n#define ERFA_DJM77 (43144.0)\n\n/* TT minus TAI (s) */\n#define ERFA_TTMTAI (32.184)\n\n/* Astronomical unit (m, IAU 2012) */\n#define ERFA_DAU (149597870.7e3)\n\n/* Speed of light (m/s) */\n#define ERFA_CMPS 299792458.0\n\n/* Light time for 1 au (s) */\n#define ERFA_AULT (ERFA_DAU/ERFA_CMPS)\n\n/* Speed of light (au per day) */\n#define ERFA_DC (ERFA_DAYSEC/ERFA_AULT)\n\n/* L_G = 1 - d(TT)/d(TCG) */\n#define ERFA_ELG (6.969290134e-10)\n\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#define ERFA_TDB0 (-6.55e-5)\n\n/* Schwarzschild radius of the Sun (au) */\n/* = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11 */\n#define ERFA_SRS 1.97412574336e-8\n\n/* ERFA_DINT(A) - truncate to nearest whole number towards zero (double) */\n#define ERFA_DINT(A) ((A)<0.0?ceil(A):floor(A))\n\n/* ERFA_DNINT(A) - round to nearest whole number (double) */\n#define ERFA_DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))\n\n/* ERFA_DSIGN(A,B) - magnitude of A with sign of B (double) */\n#define ERFA_DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A))\n\n/* max(A,B) - larger (most +ve) of two numbers (generic) */\n#define ERFA_GMAX(A,B) (((A)>(B))?(A):(B))\n\n/* min(A,B) - smaller (least +ve) of two numbers (generic) */\n#define ERFA_GMIN(A,B) (((A)<(B))?(A):(B))\n\n/* Reference ellipsoids */\n#define ERFA_WGS84 1\n#define ERFA_GRS80 2\n#define ERFA_WGS72 3\n\n#endif\n\n\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13165,"name":"pvmpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvmpv(double a[2][3], double b[2][3], double amb[2][3])\n/*\n**  - - - - - - - - -\n**   e r a P v m p v\n**  - - - - - - - - -\n**\n**  Subtract one pv-vector from another.\n**\n**  Given:\n**     a       double[2][3]      first pv-vector\n**     b       double[2][3]      second pv-vector\n**\n**  Returned:\n**     amb     double[2][3]      a - b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Called:\n**     eraPmp       p-vector minus p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraPmp(a[0], b[0], amb[0]);\n   eraPmp(a[1], b[1], amb[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13166,"name":"pv2s.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPv2s(double pv[2][3],\n             double *theta, double *phi, double *r,\n             double *td, double *pd, double *rd)\n/*\n**  - - - - - - - -\n**   e r a P v 2 s\n**  - - - - - - - -\n**\n**  Convert position/velocity from Cartesian to spherical coordinates.\n**\n**  Given:\n**     pv       double[2][3]  pv-vector\n**\n**  Returned:\n**     theta    double        longitude angle (radians)\n**     phi      double        latitude angle (radians)\n**     r        double        radial distance\n**     td       double        rate of change of theta\n**     pd       double        rate of change of phi\n**     rd       double        rate of change of r\n**\n**  Notes:\n**\n**  1) If the position part of pv is null, theta, phi, td and pd\n**     are indeterminate.  This is handled by extrapolating the\n**     position through unit time by using the velocity part of\n**     pv.  This moves the origin without changing the direction\n**     of the velocity component.  If the position and velocity\n**     components of pv are both null, zeroes are returned for all\n**     six results.\n**\n**  2) If the position is a pole, theta, td and pd are indeterminate.\n**     In such cases zeroes are returned for all three.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y, z, xd, yd, zd, rxy2, rxy, r2, rtrue, rw, xyp;\n\n\n/* Components of position/velocity vector. */\n   x  = pv[0][0];\n   y  = pv[0][1];\n   z  = pv[0][2];\n   xd = pv[1][0];\n   yd = pv[1][1];\n   zd = pv[1][2];\n\n/* Component of r in XY plane squared. */\n   rxy2 = x*x + y*y;\n\n/* Modulus squared. */\n   r2 = rxy2 + z*z;\n\n/* Modulus. */\n   rtrue = sqrt(r2);\n\n/* If null vector, move the origin along the direction of movement. */\n   rw = rtrue;\n   if (rtrue == 0.0) {\n       x = xd;\n       y = yd;\n       z = zd;\n       rxy2 = x*x + y*y;\n       r2 = rxy2 + z*z;\n       rw = sqrt(r2);\n   }\n\n/* Position and velocity in spherical coordinates. */\n   rxy = sqrt(rxy2);\n   xyp = x*xd + y*yd;\n   if (rxy2 != 0.0) {\n       *theta = atan2(y, x);\n       *phi = atan2(z, rxy);\n       *td = (x*yd - y*xd) / rxy2;\n       *pd = (zd*rxy2 - z*xyp) / (r2*rxy);\n   } else {\n       *theta = 0.0;\n       *phi = (z != 0.0) ? atan2(z, rxy) : 0.0;\n       *td = 0.0;\n       *pd = 0.0;\n   }\n   *r = rtrue;\n   *rd = (rw != 0.0) ? (xyp + z*zd) / rw : 0.0;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13167,"name":"apci.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApci(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             double x, double y, double s,\n             eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p c i\n**  - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and geocentric CIRS\n**  coordinates.  The Earth ephemeris and CIP/CIO are supplied by the\n**  caller.\n**\n**  The parameters produced by this function are required in the\n**  parallax, light deflection, aberration, and bias-precession-nutation\n**  parts of the astrometric transformation chain.\n**\n**  Given:\n**     date1  double       TDB as a 2-part...\n**     date2  double       ...Julian Date (Note 1)\n**     ebpv   double[2][3] Earth barycentric position/velocity (au, au/day)\n**     ehp    double[3]    Earth heliocentric position (au)\n**     x,y    double       CIP X,Y (components of unit vector)\n**     s      double       the CIO locator s (radians)\n**\n**  Returned:\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) In cases where the caller does not wish to provide the Earth\n**     ephemeris and CIP/CIO, the function eraApci13 can be used instead\n**     of the present function.  This computes the required quantities\n**     using other ERFA functions.\n**\n**  4) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  5) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraApcg      astrometry parameters, ICRS-GCRS, geocenter\n**     eraC2ixys    celestial-to-intermediate matrix, given X,Y and s\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Star-independent astrometry parameters for geocenter. */\n   eraApcg(date1, date2, ebpv, ehp, astrom);\n\n/* CIO based BPN matrix. */\n   eraC2ixys(x, y, s, astrom->bpn);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13168,"name":"atio13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraAtio13(double ri, double di,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *aob, double *zob, double *hob,\n              double *dob, double *rob)\n/*\n**  - - - - - - - - - -\n**   e r a A t i o 1 3\n**  - - - - - - - - - -\n**\n**  CIRS RA,Dec to observed place.  The caller supplies UTC, site\n**  coordinates, ambient air conditions and observing wavelength.\n**\n**  Given:\n**     ri     double   CIRS right ascension (CIO-based, radians)\n**     di     double   CIRS declination (radians)\n**     utc1   double   UTC as a 2-part...\n**     utc2   double   ...quasi Julian Date (Notes 1,2)\n**     dut1   double   UT1-UTC (seconds, Note 3)\n**     elong  double   longitude (radians, east +ve, Note 4)\n**     phi    double   geodetic latitude (radians, Note 4)\n**     hm     double   height above ellipsoid (m, geodetic Notes 4,6)\n**     xp,yp  double   polar motion coordinates (radians, Note 5)\n**     phpa   double   pressure at the observer (hPa = mB, Note 6)\n**     tc     double   ambient temperature at the observer (deg C)\n**     rh     double   relative humidity at the observer (range 0-1)\n**     wl     double   wavelength (micrometers, Note 7)\n**\n**  Returned:\n**     aob    double*  observed azimuth (radians: N=0,E=90)\n**     zob    double*  observed zenith distance (radians)\n**     hob    double*  observed hour angle (radians)\n**     dob    double*  observed declination (radians)\n**     rob    double*  observed right ascension (CIO-based, radians)\n**\n**  Returned (function value):\n**            int      status: +1 = dubious year (Note 2)\n**                              0 = OK\n**                             -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  2)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the\n**      future to be trusted.  See eraDat for further details.\n**\n**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  4)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many\n**      applications, xp and yp can be set to zero.\n**\n**  6)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB), is\n**      available, an adequate estimate of hm can be obtained from the\n**      expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to\n**      the pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  7)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  8)  \"Observed\" Az,ZD means the position that would be seen by a\n**      perfect geodetically aligned theodolite.  (Zenith distance is\n**      used rather than altitude in order to reflect the fact that no\n**      allowance is made for depression of the horizon.)  This is\n**      related to the observed HA,Dec via the standard rotation, using\n**      the geodetic latitude (corrected for polar motion), while the\n**      observed HA and RA are related simply through the Earth rotation\n**      angle and the site longitude.  \"Observed\" RA,Dec or HA,Dec thus\n**      means the position that would be seen by a perfect equatorial\n**      with its polar axis aligned to the Earth's axis of rotation.\n**\n**  9)  The accuracy of the result is limited by the corrections for\n**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**      Providing the meteorological parameters are known accurately and\n**      there are no gross local effects, the predicted astrometric\n**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**      (radio) for a zenith distance of less than 70 degrees, better\n**      than 30 arcsec (optical or radio) at 85 degrees and better\n**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**  10) The complementary functions eraAtio13 and eraAtoi13 are self-\n**      consistent to better than 1 microarcsecond all over the\n**      celestial sphere.\n**\n**  11) It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  Called:\n**     eraApio13    astrometry parameters, CIRS-observed, 2013\n**     eraAtioq     quick CIRS to observed\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   eraASTROM astrom;\n\n\n/* Star-independent astrometry parameters for CIRS->observed. */\n   j = eraApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp,\n                 phpa, tc, rh, wl, &astrom);\n\n/* Abort if bad UTC. */\n   if ( j < 0 ) return j;\n\n/* Transform CIRS to observed. */\n   eraAtioq(ri, di, &astrom, aob, zob, hob, dob, rob);\n\n/* Return OK/warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13169,"name":"ppp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPpp(double a[3], double b[3], double apb[3])\n/*\n**  - - - - - - -\n**   e r a P p p\n**  - - - - - - -\n**\n**  P-vector addition.\n**\n**  Given:\n**     a        double[3]      first p-vector\n**     b        double[3]      second p-vector\n**\n**  Returned:\n**     apb      double[3]      a + b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   apb[0] = a[0] + b[0];\n   apb[1] = a[1] + b[1];\n   apb[2] = a[2] + b[2];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13170,"name":"fk5hz.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraFk5hz(double r5, double d5, double date1, double date2,\n              double *rh, double *dh)\n/*\n**  - - - - - - - - -\n**   e r a F k 5 h z\n**  - - - - - - - - -\n**\n**  Transform an FK5 (J2000.0) star position into the system of the\n**  Hipparcos catalogue, assuming zero Hipparcos proper motion.\n**\n**  Given:\n**     r5           double   FK5 RA (radians), equinox J2000.0, at date\n**     d5           double   FK5 Dec (radians), equinox J2000.0, at date\n**     date1,date2  double   TDB date (Notes 1,2)\n**\n**  Returned:\n**     rh           double   Hipparcos RA (radians)\n**     dh           double   Hipparcos Dec (radians)\n**\n**  Notes:\n**\n**  1) This function converts a star position from the FK5 system to\n**     the Hipparcos system, in such a way that the Hipparcos proper\n**     motion is zero.  Because such a star has, in general, a non-zero\n**     proper motion in the FK5 system, the function requires the date\n**     at which the position in the FK5 system was determined.\n**\n**  2) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  3) The FK5 to Hipparcos transformation is modeled as a pure\n**     rotation and spin;  zonal errors in the FK5 catalogue are not\n**     taken into account.\n**\n**  4) The position returned by this function is in the Hipparcos\n**     reference system but at date date1+date2.\n**\n**  5) See also eraFk52h, eraH2fk5, eraHfk5z.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraFk5hip    FK5 to Hipparcos rotation and spin\n**     eraSxp       multiply p-vector by scalar\n**     eraRv2m      r-vector to r-matrix\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraPxp       vector product of two p-vectors\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Reference:\n**\n**     F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, p5e[3], r5h[3][3], s5h[3], vst[3], rst[3][3], p5[3],\n          ph[3], w;\n\n\n/* Interval from given date to fundamental epoch J2000.0 (JY). */\n   t = - ((date1 - ERFA_DJ00) + date2) / ERFA_DJY;\n\n/* FK5 barycentric position vector. */\n   eraS2c(r5, d5, p5e);\n\n/* FK5 to Hipparcos orientation matrix and spin vector. */\n   eraFk5hip(r5h, s5h);\n\n/* Accumulated Hipparcos wrt FK5 spin over that interval. */\n   eraSxp(t, s5h, vst);\n\n/* Express the accumulated spin as a rotation matrix. */\n   eraRv2m(vst, rst);\n\n/* Derotate the vector's FK5 axes back to date. */\n   eraTrxp(rst, p5e, p5);\n\n/* Rotate the vector into the Hipparcos system. */\n   eraRxp(r5h, p5, ph);\n\n/* Hipparcos vector to spherical. */\n   eraC2s(ph, &w, dh);\n   *rh = eraAnp(w);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13171,"name":"c2t00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2t00b(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 t 0 0 b\n**  - - - - - - - - - -\n**\n**  Form the celestial to terrestrial matrix given the date, the UT1 and\n**  the polar motion, using the IAU 2000B nutation model.\n**\n**  Given:\n**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)\n**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)\n**     xp,yp    double         coordinates of the pole (radians, Note 2)\n**\n**  Returned:\n**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,\n**     apportioned in any convenient way between the arguments uta and\n**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of\n**     these ways, among others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  In the case of uta,utb, the\n**     date & time method is best matched to the Earth rotation angle\n**     algorithm used:  maximum precision is delivered when the uta\n**     argument is for 0hrs UT1 on the day in question and the utb\n**     argument lies in the range 0 to 1, or vice versa.\n**\n**  2) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  3) The matrix rc2t transforms from celestial to terrestrial\n**     coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), RC2I is the\n**     celestial-to-intermediate matrix, ERA is the Earth rotation\n**     angle and RPOM is the polar motion matrix.\n**\n**  4) The present function is faster, but slightly less accurate (about\n**     1 mas), than the eraC2t00a function.\n**\n**  Called:\n**     eraC2i00b    celestial-to-intermediate matrix, IAU 2000B\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraPom00     polar motion matrix\n**     eraC2tcio    form CIO-based celestial-to-terrestrial matrix\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rc2i[3][3], era, rpom[3][3];\n\n\n/* Form the celestial-to-intermediate matrix for this TT (IAU 2000B). */\n   eraC2i00b(tta, ttb, rc2i);\n\n/* Predict the Earth rotation angle for this UT1. */\n   era = eraEra00(uta, utb);\n\n/* Form the polar motion matrix (neglecting s'). */\n   eraPom00(xp, yp, 0.0, rpom);\n\n/* Combine to form the celestial-to-terrestrial matrix. */\n   eraC2tcio(rc2i, era, rpom, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13172,"name":"aper.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAper(double theta, eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p e r\n**  - - - - - - - -\n**\n**  In the star-independent astrometry parameters, update only the\n**  Earth rotation angle, supplied by the caller explicitly.\n**\n**  Given:\n**     theta   double      Earth rotation angle (radians, Note 2)\n**     astrom  eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       not used\n**      eb     double[3]    not used\n**      eh     double[3]    not used\n**      em     double       not used\n**      v      double[3]    not used\n**      bm1    double       not used\n**      bpn    double[3][3] not used\n**      along  double       longitude + s' (radians)\n**      xpl    double       not used\n**      ypl    double       not used\n**      sphi   double       not used\n**      cphi   double       not used\n**      diurab double       not used\n**      eral   double       not used\n**      refa   double       not used\n**      refb   double       not used\n**\n**  Returned:\n**     astrom  eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       unchanged\n**      eb     double[3]    unchanged\n**      eh     double[3]    unchanged\n**      em     double       unchanged\n**      v      double[3]    unchanged\n**      bm1    double       unchanged\n**      bpn    double[3][3] unchanged\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) This function exists to enable sidereal-tracking applications to\n**     avoid wasteful recomputation of the bulk of the astrometry\n**     parameters:  only the Earth rotation is updated.\n**\n**  2) For targets expressed as equinox based positions, such as\n**     classical geocentric apparent (RA,Dec), the supplied theta can be\n**     Greenwich apparent sidereal time rather than Earth rotation\n**     angle.\n**\n**  3) The function eraAper13 can be used instead of the present\n**     function, and starts from UT1 rather than ERA itself.\n**\n**  4) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   astrom->eral = theta + astrom->along;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13173,"name":"utcut1.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraUtcut1(double utc1, double utc2, double dut1,\n              double *ut11, double *ut12)\n/*\n**  - - - - - - - - - -\n**   e r a U t c u t 1\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Coordinated Universal Time, UTC, to\n**  Universal Time, UT1.\n**\n**  Given:\n**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)\n**     dut1       double   Delta UT1 = UT1-UTC in seconds (Note 5)\n**\n**  Returned:\n**     ut11,ut12  double   UT1 as a 2-part Julian Date (Note 6)\n**\n**  Returned (function value):\n**                int      status: +1 = dubious year (Note 3)\n**                                  0 = OK\n**                                 -1 = unacceptable date\n**\n**  Notes:\n**\n**  1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**     convenient way between the two arguments, for example where utc1\n**     is the Julian Day Number and utc2 is the fraction of a day.\n**\n**  2) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The convention in the present\n**     function is that the JD day represents UTC days whether the\n**     length is 86399, 86400 or 86401 SI seconds.\n**\n**  3) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  4) The function eraDtf2d converts from calendar date and time of\n**     day into 2-part Julian Date, and in the case of UTC implements\n**     the leap-second-ambiguity convention described above.\n**\n**  5) Delta UT1 can be obtained from tabulations provided by the\n**     International Earth Rotation and Reference Systems Service.\n**     It is the caller's responsibility to supply a dut1 argument\n**     containing the UT1-UTC value that matches the given UTC.\n**\n**  6) The returned ut11,ut12 are such that their sum is the UT1 Julian\n**     Date.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Called:\n**     eraJd2cal    JD to Gregorian calendar\n**     eraDat       delta(AT) = TAI-UTC\n**     eraUtctai    UTC to TAI\n**     eraTaiut1    TAI to UT1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int iy, im, id, js, jw;\n   double w, dat, dta, tai1, tai2;\n\n\n/* Look up TAI-UTC. */\n   if ( eraJd2cal(utc1, utc2, &iy, &im, &id, &w) ) return -1;\n   js = eraDat ( iy, im, id, 0.0, &dat);\n   if ( js < 0 ) return -1;\n\n/* Form UT1-TAI. */\n   dta = dut1 - dat;\n\n/* UTC to TAI to UT1. */\n   jw = eraUtctai(utc1, utc2, &tai1, &tai2);\n   if ( jw < 0 ) {\n      return -1;\n   } else if ( jw > 0 ) {\n      js = jw;\n   }\n   if ( eraTaiut1(tai1, tai2, dta, ut11, ut12) ) return -1;\n\n/* Status. */\n   return js;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13174,"name":"pn06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn06(double date1, double date2, double dpsi, double deps,\n             double *epsa,\n             double rb[3][3], double rp[3][3], double rbp[3][3],\n             double rn[3][3], double rbpn[3][3])\n/*\n**  - - - - - - - -\n**   e r a P n 0 6\n**  - - - - - - - -\n**\n**  Precession-nutation, IAU 2006 model:  a multi-purpose function,\n**  supporting classical (equinox-based) use directly and CIO-based use\n**  indirectly.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**     dpsi,deps    double          nutation (Note 2)\n**\n**  Returned:\n**     epsa         double          mean obliquity (Note 3)\n**     rb           double[3][3]    frame bias matrix (Note 4)\n**     rp           double[3][3]    precession matrix (Note 5)\n**     rbp          double[3][3]    bias-precession matrix (Note 6)\n**     rn           double[3][3]    nutation matrix (Note 7)\n**     rbpn         double[3][3]    GCRS-to-true matrix (Note 8)\n**\n**  Notes:\n**\n**  1)  The TT date date1+date2 is a Julian Date, apportioned in any\n**      convenient way between the two arguments.  For example,\n**      JD(TT)=2450123.7 could be expressed in any of these ways,\n**      among others:\n**\n**             date1          date2\n**\n**          2450123.7           0.0       (JD method)\n**          2451545.0       -1421.3       (J2000 method)\n**          2400000.5       50123.2       (MJD method)\n**          2450123.5           0.2       (date & time method)\n**\n**      The JD method is the most natural and convenient to use in\n**      cases where the loss of several decimal digits of resolution\n**      is acceptable.  The J2000 method is best matched to the way\n**      the argument is handled internally and will deliver the\n**      optimum resolution.  The MJD method and the date & time methods\n**      are both good compromises between resolution and convenience.\n**\n**  2)  The caller is responsible for providing the nutation components;\n**      they are in longitude and obliquity, in radians and are with\n**      respect to the equinox and ecliptic of date.  For high-accuracy\n**      applications, free core nutation should be included as well as\n**      any other relevant corrections to the position of the CIP.\n**\n**  3)  The returned mean obliquity is consistent with the IAU 2006\n**      precession.\n**\n**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean\n**      equator and equinox by applying frame bias.\n**\n**  5)  The matrix rp transforms vectors from J2000.0 mean equator and\n**      equinox to mean equator and equinox of date by applying\n**      precession.\n**\n**  6)  The matrix rbp transforms vectors from GCRS to mean equator and\n**      equinox of date by applying frame bias then precession.  It is\n**      the product rp x rb.\n**\n**  7)  The matrix rn transforms vectors from mean equator and equinox\n**      of date to true equator and equinox of date by applying the\n**      nutation (luni-solar + planetary).\n**\n**  8)  The matrix rbpn transforms vectors from GCRS to true equator and\n**      equinox of date.  It is the product rn x rbp, applying frame\n**      bias, precession and nutation in that order.\n**\n**  9)  The X,Y,Z coordinates of the Celestial Intermediate Pole are\n**      elements (3,1-3) of the GCRS-to-true matrix, i.e. rbpn[2][0-2].\n**\n**  10) It is permissible to re-use the same array in the returned\n**      arguments.  The arrays are filled in the stated order.\n**\n**  Called:\n**     eraPfw06     bias-precession F-W angles, IAU 2006\n**     eraFw2m      F-W angles to r-matrix\n**     eraCr        copy r-matrix\n**     eraTr        transpose r-matrix\n**     eraRxr       product of two r-matrices\n**\n**  References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gamb, phib, psib, eps, r1[3][3], r2[3][3], rt[3][3];\n\n\n/* Bias-precession Fukushima-Williams angles of J2000.0 = frame bias. */\n   eraPfw06(ERFA_DJM0, ERFA_DJM00, &gamb, &phib, &psib, &eps);\n\n/* B matrix. */\n   eraFw2m(gamb, phib, psib, eps, r1);\n   eraCr(r1, rb);\n\n/* Bias-precession Fukushima-Williams angles of date. */\n   eraPfw06(date1, date2, &gamb, &phib, &psib, &eps);\n\n/* Bias-precession matrix. */\n   eraFw2m(gamb, phib, psib, eps, r2);\n   eraCr(r2, rbp);\n\n/* Solve for precession matrix. */\n   eraTr(r1, rt);\n   eraRxr(r2, rt, rp);\n\n/* Equinox-based bias-precession-nutation matrix. */\n   eraFw2m(gamb, phib, psib + dpsi, eps + deps, r1);\n   eraCr(r1, rbpn);\n\n/* Solve for nutation matrix. */\n   eraTr(r2, rt);\n   eraRxr(r1, rt, rn);\n\n/* Obliquity, mean of date. */\n   *epsa = eps;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13175,"name":"pnm80.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPnm80(double date1, double date2, double rmatpn[3][3])\n/*\n**  - - - - - - - - -\n**   e r a P n m 8 0\n**  - - - - - - - - -\n**\n**  Form the matrix of precession/nutation for a given date, IAU 1976\n**  precession model, IAU 1980 nutation model.\n**\n**  Given:\n**     date1,date2    double         TDB date (Note 1)\n**\n**  Returned:\n**     rmatpn         double[3][3]   combined precession/nutation matrix\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rmatpn * V(J2000),\n**     where the p-vector V(date) is with respect to the true equatorial\n**     triad of date date1+date2 and the p-vector V(J2000) is with\n**     respect to the mean equatorial triad of epoch J2000.0.\n**\n**  Called:\n**     eraPmat76    precession matrix, IAU 1976\n**     eraNutm80    nutation matrix, IAU 1980\n**     eraRxr       product of two r-matrices\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.3 (p145).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rmatp[3][3], rmatn[3][3];\n\n\n/* Precession matrix, J2000.0 to date. */\n   eraPmat76(date1, date2, rmatp);\n\n/* Nutation matrix. */\n   eraNutm80(date1, date2, rmatn);\n\n/* Combine the matrices:  PN = N x P. */\n   eraRxr(rmatn, rmatp, rmatpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13176,"name":"falp03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFalp03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a l p 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean anomaly of the Sun.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    l', radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean anomaly of the Sun (IERS Conventions 2003). */\n   a = fmod(         1287104.793048 +\n             t * ( 129596581.0481 +\n             t * (       - 0.5532 +\n             t * (         0.000136 +\n             t * (       - 0.00001149 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R;\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13177,"name":"ecm06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraEcm06(double date1, double date2, double rm[3][3])\n/*\n**  - - - - - - - - -\n**   e r a E c m 0 6\n**  - - - - - - - - -\n**\n**  ICRS equatorial to ecliptic rotation matrix, IAU 2006.\n**\n**  Given:\n**     date1,date2  double         TT as a 2-part Julian date (Note 1)\n**\n**  Returned:\n**     rm           double[3][3]   ICRS to ecliptic rotation matrix\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  1) The matrix is in the sense\n**\n**        E_ep = rm x P_ICRS,\n**\n**     where P_ICRS is a vector with respect to ICRS right ascension\n**     and declination axes and E_ep is the same vector with respect to\n**     the (inertial) ecliptic and equinox of date.\n**\n**  2) P_ICRS is a free vector, merely a direction, typically of unit\n**     magnitude, and not bound to any particular spatial origin, such\n**     as the Earth, Sun or SSB.  No assumptions are made about whether\n**     it represents starlight and embodies astrometric effects such as\n**     parallax or aberration.  The transformation is approximately that\n**     between mean J2000.0 right ascension and declination and ecliptic\n**     longitude and latitude, with only frame bias (always less than\n**     25 mas) to disturb this classical picture.\n**\n**  Called:\n**     eraObl06     mean obliquity, IAU 2006\n**     eraPmat06    PB matrix, IAU 2006\n**     eraIr        initialize r-matrix to identity\n**     eraRx        rotate around X-axis\n**     eraRxr       product of two r-matrices\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ob, bp[3][3], e[3][3];\n\n\n/* Obliquity, IAU 2006. */\n   ob = eraObl06(date1, date2);\n\n/* Precession-bias matrix, IAU 2006. */\n   eraPmat06(date1, date2, bp);\n\n/* Equatorial of date to ecliptic matrix. */\n   eraIr(e);\n   eraRx(ob, e);\n\n/* ICRS to ecliptic coordinates rotation matrix, IAU 2006. */\n   eraRxr(e, bp, rm);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13178,"name":"tr.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraTr(double r[3][3], double rt[3][3])\n/*\n**  - - - - - -\n**   e r a T r\n**  - - - - - -\n**\n**  Transpose an r-matrix.\n**\n**  Given:\n**     r        double[3][3]    r-matrix\n**\n**  Returned:\n**     rt       double[3][3]    transpose\n**\n**  Note:\n**     It is permissible for r and rt to be the same array.\n**\n**  Called:\n**     eraCr        copy r-matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double wm[3][3];\n   int i, j;\n\n\n   for (i = 0; i < 3; i++) {\n      for (j = 0; j < 3; j++) {\n         wm[i][j] = r[j][i];\n      }\n   }\n   eraCr(wm, rt);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":4,"comment":"null","endLoc":657,"header":"def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2, tick_angle, ticks='major')","id":13179,"name":"_compute_ticks","nodeType":"Function","startLoc":588,"text":"def _compute_ticks(self, tick_world_coordinates, spine, axis, w1, w2, tick_angle, ticks='major'):\n        tick_world_coordinates_values = tick_world_coordinates.value\n        if self.coord_type == 'longitude':\n            tick_world_coordinates_values = np.hstack([tick_world_coordinates_values,\n                                                       tick_world_coordinates_values + 360])\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                    world = wrap_angle_at(t, self.coord_wrap)\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":13180,"name":"numat.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNumat(double epsa, double dpsi, double deps, double rmatn[3][3])\n/*\n**  - - - - - - - - -\n**   e r a N u m a t\n**  - - - - - - - - -\n**\n**  Form the matrix of nutation.\n**\n**  Given:\n**     epsa        double         mean obliquity of date (Note 1)\n**     dpsi,deps   double         nutation (Note 2)\n**\n**  Returned:\n**     rmatn       double[3][3]   nutation matrix (Note 3)\n**\n**  Notes:\n**\n**\n**  1) The supplied mean obliquity epsa, must be consistent with the\n**     precession-nutation models from which dpsi and deps were obtained.\n**\n**  2) The caller is responsible for providing the nutation components;\n**     they are in longitude and obliquity, in radians and are with\n**     respect to the equinox and ecliptic of date.\n**\n**  3) The matrix operates in the sense V(true) = rmatn * V(mean),\n**     where the p-vector V(true) is with respect to the true\n**     equatorial triad of date and the p-vector V(mean) is with\n**     respect to the mean equatorial triad of date.\n**\n**  Called:\n**     eraIr        initialize r-matrix to identity\n**     eraRx        rotate around X-axis\n**     eraRz        rotate around Z-axis\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.222-3 (p114).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Build the rotation matrix. */\n   eraIr(rmatn);\n   eraRx(epsa, rmatn);\n   eraRz(-dpsi, rmatn);\n   eraRx(-(epsa + deps), rmatn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13181,"name":"pfw06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPfw06(double date1, double date2,\n              double *gamb, double *phib, double *psib, double *epsa)\n/*\n**  - - - - - - - - -\n**   e r a P f w 0 6\n**  - - - - - - - - -\n**\n**  Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation).\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     gamb         double   F-W angle gamma_bar (radians)\n**     phib         double   F-W angle phi_bar (radians)\n**     psib         double   F-W angle psi_bar (radians)\n**     epsa         double   F-W angle epsilon_A (radians)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) Naming the following points:\n**\n**           e = J2000.0 ecliptic pole,\n**           p = GCRS pole,\n**           E = mean ecliptic pole of date,\n**     and   P = mean pole of date,\n**\n**     the four Fukushima-Williams angles are as follows:\n**\n**        gamb = gamma_bar = epE\n**        phib = phi_bar = pE\n**        psib = psi_bar = pEP\n**        epsa = epsilon_A = EP\n**\n**  3) The matrix representing the combined effects of frame bias and\n**     precession is:\n**\n**        PxB = R_1(-epsa).R_3(-psib).R_1(phib).R_3(gamb)\n**\n**  4) The matrix representing the combined effects of frame bias,\n**     precession and nutation is simply:\n**\n**        NxPxB = R_1(-epsa-dE).R_3(-psib-dP).R_1(phib).R_3(gamb)\n**\n**     where dP and dE are the nutation components with respect to the\n**     ecliptic of date.\n**\n**  Reference:\n**\n**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351\n**\n**  Called:\n**     eraObl06     mean obliquity, IAU 2006\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t;\n\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* P03 bias+precession angles. */\n   *gamb = (    -0.052928     +\n           (    10.556378     +\n           (     0.4932044    +\n           (    -0.00031238   +\n           (    -0.000002788  +\n           (     0.0000000260 )\n           * t) * t) * t) * t) * t) * ERFA_DAS2R;\n   *phib = ( 84381.412819     +\n           (   -46.811016     +\n           (     0.0511268    +\n           (     0.00053289   +\n           (    -0.000000440  +\n           (    -0.0000000176 )\n           * t) * t) * t) * t) * t) * ERFA_DAS2R;\n   *psib = (    -0.041775     +\n           (  5038.481484     +\n           (     1.5584175    +\n           (    -0.00018522   +\n           (    -0.000026452  +\n           (    -0.0000000148 )\n           * t) * t) * t) * t) * t) * ERFA_DAS2R;\n   *epsa =  eraObl06(date1, date2);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13182,"name":"apio.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApio(double sp, double theta,\n             double elong, double phi, double hm, double xp, double yp,\n             double refa, double refb,\n             eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p i o\n**  - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between CIRS and observed\n**  coordinates.  The caller supplies the Earth orientation information\n**  and the refraction constants as well as the site coordinates.\n**\n**  Given:\n**     sp     double      the TIO locator s' (radians, Note 1)\n**     theta  double      Earth rotation angle (radians)\n**     elong  double      longitude (radians, east +ve, Note 2)\n**     phi    double      geodetic latitude (radians, Note 2)\n**     hm     double      height above ellipsoid (m, geodetic Note 2)\n**     xp,yp  double      polar motion coordinates (radians, Note 3)\n**     refa   double      refraction constant A (radians, Note 4)\n**     refb   double      refraction constant B (radians, Note 4)\n**\n**  Returned:\n**     astrom eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       unchanged\n**      eb     double[3]    unchanged\n**      eh     double[3]    unchanged\n**      em     double       unchanged\n**      v      double[3]    unchanged\n**      bm1    double       unchanged\n**      bpn    double[3][3] unchanged\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Notes:\n**\n**  1) sp, the TIO locator s', is a tiny quantity needed only by the\n**     most precise applications.  It can either be set to zero or\n**     predicted using the ERFA function eraSp00.\n**\n**  2) The geographical coordinates are with respect to the ERFA_WGS84\n**     reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**     longitude required by the present function is east-positive\n**     (i.e. right-handed), in accordance with geographical convention.\n**\n**  3) The polar motion xp,yp can be obtained from IERS bulletins.  The\n**     values are the coordinates (in radians) of the Celestial\n**     Intermediate Pole with respect to the International Terrestrial\n**     Reference System (see IERS Conventions 2003), measured along the\n**     meridians 0 and 90 deg west respectively.  For many applications,\n**     xp and yp can be set to zero.\n**\n**     Internally, the polar motion is stored in a form rotated onto the\n**     local meridian.\n**\n**  4) The refraction constants refa and refb are for use in a\n**     dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed\n**     (i.e. refracted) zenith distance and dZ is the amount of\n**     refraction.\n**\n**  5) It is advisable to take great care with units, as even unlikely\n**     values of the input parameters are accepted and processed in\n**     accordance with the models used.\n**\n**  6) In cases where the caller does not wish to provide the Earth\n**     rotation information and refraction constants, the function\n**     eraApio13 can be used instead of the present function.  This\n**     starts from UTC and weather readings etc. and computes suitable\n**     values using other ERFA functions.\n**\n**  7) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  8) The context structure astrom produced by this function is used by\n**     eraAtioq and eraAtoiq.\n**\n**  Called:\n**     eraPvtob     position/velocity of terrestrial station\n**     eraAper      astrometry parameters: update ERA\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double sl, cl, pv[2][3];\n\n\n/* Longitude with adjustment for TIO locator s'. */\n   astrom->along = elong + sp;\n\n/* Polar motion, rotated onto the local meridian. */\n   sl = sin(astrom->along);\n   cl = cos(astrom->along);\n   astrom->xpl = xp*cl - yp*sl;\n   astrom->ypl = xp*sl + yp*cl;\n\n/* Functions of latitude. */\n   astrom->sphi = sin(phi);\n   astrom->cphi = cos(phi);\n\n/* Observer's geocentric position and velocity (m, m/s, CIRS). */\n   eraPvtob(elong, phi, hm, xp, yp, sp, theta, pv);\n\n/* Magnitude of diurnal aberration vector. */\n   astrom->diurab = sqrt(pv[1][0]*pv[1][0]+pv[1][1]*pv[1][1]) / ERFA_CMPS;\n\n/* Refraction constants. */\n   astrom->refa = refa;\n   astrom->refb = refb;\n\n/* Local Earth rotation angle. */\n   eraAper(theta, astrom);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13183,"name":"pap.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraPap(double a[3], double b[3])\n/*\n**  - - - - - - -\n**   e r a P a p\n**  - - - - - - -\n**\n**  Position-angle from two p-vectors.\n**\n**  Given:\n**     a      double[3]  direction of reference point\n**     b      double[3]  direction of point whose PA is required\n**\n**  Returned (function value):\n**            double     position angle of b with respect to a (radians)\n**\n**  Notes:\n**\n**  1) The result is the position angle, in radians, of direction b with\n**     respect to direction a.  It is in the range -pi to +pi.  The\n**     sense is such that if b is a small distance \"north\" of a the\n**     position angle is approximately zero, and if b is a small\n**     distance \"east\" of a the position angle is approximately +pi/2.\n**\n**  2) The vectors a and b need not be of unit length.\n**\n**  3) Zero is returned if the two directions are the same or if either\n**     vector is null.\n**\n**  4) If vector a is at a pole, the result is ill-defined.\n**\n**  Called:\n**     eraPn        decompose p-vector into modulus and direction\n**     eraPm        modulus of p-vector\n**     eraPxp       vector product of two p-vectors\n**     eraPmp       p-vector minus p-vector\n**     eraPdp       scalar product of two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double am, au[3], bm, st, ct, xa, ya, za, eta[3], xi[3], a2b[3], pa;\n\n\n/* Modulus and direction of the a vector. */\n   eraPn(a, &am, au);\n\n/* Modulus of the b vector. */\n   bm = eraPm(b);\n\n/* Deal with the case of a null vector. */\n   if ((am == 0.0) || (bm == 0.0)) {\n      st = 0.0;\n      ct = 1.0;\n   } else {\n\n   /* The \"north\" axis tangential from a (arbitrary length). */\n      xa = a[0];\n      ya = a[1];\n      za = a[2];\n      eta[0] = -xa * za;\n      eta[1] = -ya * za;\n      eta[2] =  xa*xa + ya*ya;\n\n   /* The \"east\" axis tangential from a (same length). */\n      eraPxp(eta, au, xi);\n\n   /* The vector from a to b. */\n      eraPmp(b, a, a2b);\n\n   /* Resolve into components along the north and east axes. */\n      st = eraPdp(a2b, xi);\n      ct = eraPdp(a2b, eta);\n\n   /* Deal with degenerate cases. */\n      if ((st == 0.0) && (ct == 0.0)) ct = 1.0;\n   }\n\n/* Position angle. */\n   pa = atan2(st, ct);\n\n   return pa;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13184,"name":"nut00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNut00b(double date1, double date2, double *dpsi, double *deps)\n/*\n**  - - - - - - - - - -\n**   e r a N u t 0 0 b\n**  - - - - - - - - - -\n**\n**  Nutation, IAU 2000B model.\n**\n**  Given:\n**     date1,date2   double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps     double    nutation, luni-solar + planetary (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The nutation components in longitude and obliquity are in radians\n**     and with respect to the equinox and ecliptic of date.  The\n**     obliquity at J2000.0 is assumed to be the Lieske et al. (1977)\n**     value of 84381.448 arcsec.  (The errors that result from using\n**     this function with the IAU 2006 value of 84381.406 arcsec can be\n**     neglected.)\n**\n**     The nutation model consists only of luni-solar terms, but\n**     includes also a fixed offset which compensates for certain long-\n**     period planetary terms (Note 7).\n**\n**  3) This function is an implementation of the IAU 2000B abridged\n**     nutation model formally adopted by the IAU General Assembly in\n**     2000.  The function computes the MHB_2000_SHORT luni-solar\n**     nutation series (Luzum 2001), but without the associated\n**     corrections for the precession rate adjustments and the offset\n**     between the GCRS and J2000.0 mean poles.\n**\n**  4) The full IAU 2000A (MHB2000) nutation model contains nearly 1400\n**     terms.  The IAU 2000B model (McCarthy & Luzum 2003) contains only\n**     77 terms, plus additional simplifications, yet still delivers\n**     results of 1 mas accuracy at present epochs.  This combination of\n**     accuracy and size makes the IAU 2000B abridged nutation model\n**     suitable for most practical applications.\n**\n**     The function delivers a pole accurate to 1 mas from 1900 to 2100\n**     (usually better than 1 mas, very occasionally just outside\n**     1 mas).  The full IAU 2000A model, which is implemented in the\n**     function eraNut00a (q.v.), delivers considerably greater accuracy\n**     at current dates;  however, to realize this improved accuracy,\n**     corrections for the essentially unpredictable free-core-nutation\n**     (FCN) must also be included.\n**\n**  5) The present function provides classical nutation.  The\n**     MHB_2000_SHORT algorithm, from which it is adapted, deals also\n**     with (i) the offsets between the GCRS and mean poles and (ii) the\n**     adjustments in longitude and obliquity due to the changed\n**     precession rates.  These additional functions, namely frame bias\n**     and precession adjustments, are supported by the ERFA functions\n**     eraBi00  and eraPr00.\n**\n**  6) The MHB_2000_SHORT algorithm also provides \"total\" nutations,\n**     comprising the arithmetic sum of the frame bias, precession\n**     adjustments, and nutation (luni-solar + planetary).  These total\n**     nutations can be used in combination with an existing IAU 1976\n**     precession implementation, such as eraPmat76,  to deliver GCRS-\n**     to-true predictions of mas accuracy at current epochs.  However,\n**     for symmetry with the eraNut00a  function (q.v. for the reasons),\n**     the ERFA functions do not generate the \"total nutations\"\n**     directly.  Should they be required, they could of course easily\n**     be generated by calling eraBi00, eraPr00 and the present function\n**     and adding the results.\n**\n**  7) The IAU 2000B model includes \"planetary bias\" terms that are\n**     fixed in size but compensate for long-period nutations.  The\n**     amplitudes quoted in McCarthy & Luzum (2003), namely\n**     Dpsi = -1.5835 mas and Depsilon = +1.6339 mas, are optimized for\n**     the \"total nutations\" method described in Note 6.  The Luzum\n**     (2001) values used in this ERFA implementation, namely -0.135 mas\n**     and +0.388 mas, are optimized for the \"rigorous\" method, where\n**     frame bias, precession and nutation are applied separately and in\n**     that order.  During the interval 1995-2050, the ERFA\n**     implementation delivers a maximum error of 1.001 mas (not\n**     including FCN).\n**\n**  References:\n**\n**     Lieske, J.H., Lederle, T., Fricke, W., Morando, B., \"Expressions\n**     for the precession quantities based upon the IAU /1976/ system of\n**     astronomical constants\", Astron.Astrophys. 58, 1-2, 1-16. (1977)\n**\n**     Luzum, B., private communication, 2001 (Fortran code\n**     MHB_2000_SHORT)\n**\n**     McCarthy, D.D. & Luzum, B.J., \"An abridged model of the\n**     precession-nutation of the celestial pole\", Cel.Mech.Dyn.Astron.\n**     85, 37-49 (2003)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J., Astron.Astrophys. 282, 663-683 (1994)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, el, elp, f, d, om, arg, dp, de, sarg, carg,\n          dpsils, depsls, dpsipl, depspl;\n   int i;\n\n/* Units of 0.1 microarcsecond to radians */\n   static const double U2R = ERFA_DAS2R / 1e7;\n\n/* ---------------------------------------- */\n/* Fixed offsets in lieu of planetary terms */\n/* ---------------------------------------- */\n\n   static const double DPPLAN = -0.135 * ERFA_DMAS2R;\n   static const double DEPLAN =  0.388 * ERFA_DMAS2R;\n\n/* --------------------------------------------------- */\n/* Luni-solar nutation: argument and term coefficients */\n/* --------------------------------------------------- */\n\n/* The units for the sine and cosine coefficients are */\n/* 0.1 microarcsec and the same per Julian century    */\n\n   static const struct {\n      int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */\n      double ps,pst,pc;     /* longitude sin, t*sin, cos coefficients */\n      double ec,ect,es;     /* obliquity cos, t*cos, sin coefficients */\n\n   } x[] = {\n\n   /* 1-10 */\n      { 0, 0, 0, 0,1,\n         -172064161.0, -174666.0, 33386.0, 92052331.0, 9086.0, 15377.0},\n      { 0, 0, 2,-2,2,\n           -13170906.0, -1675.0, -13696.0, 5730336.0, -3015.0, -4587.0},\n      { 0, 0, 2, 0,2,-2276413.0,-234.0, 2796.0, 978459.0,-485.0,1374.0},\n      { 0, 0, 0, 0,2,2074554.0,  207.0, -698.0,-897492.0, 470.0,-291.0},\n      { 0, 1, 0, 0,0,1475877.0,-3633.0,11817.0, 73871.0,-184.0,-1924.0},\n      { 0, 1, 2,-2,2,-516821.0, 1226.0, -524.0, 224386.0,-677.0,-174.0},\n      { 1, 0, 0, 0,0, 711159.0,   73.0, -872.0,  -6750.0,   0.0, 358.0},\n      { 0, 0, 2, 0,1,-387298.0, -367.0,  380.0, 200728.0,  18.0, 318.0},\n      { 1, 0, 2, 0,2,-301461.0,  -36.0,  816.0, 129025.0, -63.0, 367.0},\n      { 0,-1, 2,-2,2, 215829.0, -494.0,  111.0, -95929.0, 299.0, 132.0},\n\n   /* 11-20 */\n      { 0, 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},\n      { 1, 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},\n      { 1, 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},\n      { 0, 0, 0, 2,0,  63384.0,   11.0, -150.0,  -1220.0,   0.0,  29.0},\n      { 0, 0, 2, 2,2, -38571.0,   -1.0,  158.0,  16452.0, -11.0,  68.0},\n\n   /* 21-30 */\n      { 0,-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},\n      { 2, 0, 2, 0,2, -31046.0,   -1.0,  131.0,  13238.0, -11.0,  59.0},\n      { 1, 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},\n      { 2, 0, 0, 0,0,  29243.0,    0.0,  -74.0,   -609.0,   0.0,  13.0},\n      { 0, 0, 2, 0,0,  25887.0,    0.0,  -66.0,   -550.0,   0.0,  11.0},\n      { 0, 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},\n      { 0, 2, 2,-2,2, -15794.0,   72.0,  -16.0,   6850.0, -42.0,  -5.0},\n\n   /* 31-40 */\n      { 0, 0,-2, 2,0,  21783.0,    0.0,   13.0,   -167.0,   0.0,  13.0},\n      { 1, 0, 0,-2,1, -12873.0,  -10.0,  -37.0,   6953.0,   0.0, -14.0},\n      { 0,-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},\n      { 0, 2, 0, 0,0,  16707.0,  -85.0,  -10.0,    168.0,  -1.0,  10.0},\n      { 1, 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},\n      { 0, 1, 2, 0,2,   7566.0,  -21.0,  -11.0,  -3250.0,   0.0,  -5.0},\n      { 0, 0, 2, 2,1,  -6637.0,  -11.0,   25.0,   3353.0,   0.0,  14.0},\n      { 0,-1, 2, 0,2,  -7141.0,   21.0,    8.0,   3070.0,   0.0,   4.0},\n\n   /* 41-50 */\n      { 0, 0, 0, 2,1,  -6302.0,  -11.0,    2.0,   3272.0,   0.0,   4.0},\n      { 1, 0, 2,-2,1,   5800.0,   10.0,    2.0,  -3045.0,   0.0,  -1.0},\n      { 2, 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},\n      { 2, 0, 2, 0,1,  -5350.0,    0.0,   21.0,   2695.0,   0.0,  12.0},\n      { 0,-1, 2,-2,1,  -4752.0,  -11.0,   -3.0,   2719.0,   0.0,  -3.0},\n      { 0, 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},\n      { 2, 0, 0,-2,1,   4065.0,    0.0,    6.0,  -2206.0,   0.0,   1.0},\n      { 1, 0, 0, 2,0,   6579.0,    0.0,  -24.0,   -199.0,   0.0,   2.0},\n\n   /* 51-60 */\n      { 0, 1, 2,-2,1,   3579.0,    0.0,    5.0,  -1900.0,   0.0,   1.0},\n      { 1,-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},\n      { 3, 0, 2, 0,2,  -2904.0,    0.0,   15.0,   1233.0,   0.0,   7.0},\n      { 0,-1, 0, 2,0,   4348.0,    0.0,  -10.0,    -81.0,   0.0,   2.0},\n      { 1,-1, 2, 0,2,  -2878.0,    0.0,    8.0,   1232.0,   0.0,   4.0},\n      { 0, 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},\n      { 0,-1, 2, 2,2,  -2647.0,    0.0,   11.0,   1129.0,   0.0,   5.0},\n\n   /* 61-70 */\n      {-2, 0, 0, 0,1,  -2294.0,    0.0,  -10.0,   1266.0,   0.0,  -4.0},\n      { 1, 1, 2, 0,2,   2481.0,    0.0,   -7.0,  -1062.0,   0.0,  -3.0},\n      { 2, 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},\n      { 1, 1, 0, 0,0,  -3389.0,    0.0,    5.0,     35.0,   0.0,  -2.0},\n      { 1, 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},\n      { 1, 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},\n      { 0, 0, 2, 1,2,   1660.0,    0.0,   -5.0,   -710.0,   0.0,  -2.0},\n\n   /* 71-77 */\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},\n      { 0,-2, 2,-2,1,  -1283.0,    0.0,    0.0,    672.0,   0.0,   0.0},\n      { 1, 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},\n      { 1, 1, 2,-2,2,   1290.0,    0.0,    0.0,   -556.0,   0.0,   0.0}\n   };\n\n/* Number of terms in the series */\n   const int NLS = (int) (sizeof x / sizeof x[0]);\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental epoch J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* --------------------*/\n/* LUNI-SOLAR NUTATION */\n/* --------------------*/\n\n/* Fundamental (Delaunay) arguments from Simon et al. (1994) */\n\n/* Mean anomaly of the Moon. */\n   el = fmod(485868.249036 + (1717915923.2178) * t, ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean anomaly of the Sun. */\n   elp = fmod(1287104.79305 + (129596581.0481) * t, ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean argument of the latitude of the Moon. */\n   f = fmod(335779.526232 + (1739527262.8478) * t, ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean elongation of the Moon from the Sun. */\n   d = fmod(1072260.70369 + (1602961601.2090) * t, ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Mean longitude of the ascending node of the Moon. */\n   om = fmod(450160.398036 + (-6962890.5431) * t, ERFA_TURNAS) * ERFA_DAS2R;\n\n/* Initialize the nutation values. */\n   dp = 0.0;\n   de = 0.0;\n\n/* Summation of luni-solar nutation series (smallest terms first). */\n   for (i = NLS-1; i >= 0; i--) {\n\n   /* Argument and functions. */\n      arg = fmod( (double)x[i].nl  * el  +\n                  (double)x[i].nlp * elp +\n                  (double)x[i].nf  * f   +\n                  (double)x[i].nd  * d   +\n                  (double)x[i].nom * om, ERFA_D2PI  );\n      sarg = sin(arg);\n      carg = cos(arg);\n\n   /* Term. */\n      dp += (x[i].ps + x[i].pst * t) * sarg + x[i].pc * carg;\n      de += (x[i].ec + x[i].ect * t) * carg + x[i].es * sarg;\n   }\n\n/* Convert from 0.1 microarcsec units to radians. */\n   dpsils = dp * U2R;\n   depsls = de * U2R;\n\n/* ------------------------------*/\n/* IN LIEU OF PLANETARY NUTATION */\n/* ------------------------------*/\n\n/* Fixed offset to correct for missing terms in truncated series. */\n   dpsipl = DPPLAN;\n   depspl = DEPLAN;\n\n/* --------*/\n/* RESULTS */\n/* --------*/\n\n/* Add luni-solar and planetary components. */\n   *dpsi = dpsils + dpsipl;\n   *deps = depsls + depspl;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13185,"name":"rm2v.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRm2v(double r[3][3], double w[3])\n/*\n**  - - - - - - - -\n**   e r a R m 2 v\n**  - - - - - - - -\n**\n**  Express an r-matrix as an r-vector.\n**\n**  Given:\n**     r        double[3][3]    rotation matrix\n**\n**  Returned:\n**     w        double[3]       rotation vector (Note 1)\n**\n**  Notes:\n**\n**  1) A rotation matrix describes a rotation through some angle about\n**     some arbitrary axis called the Euler axis.  The \"rotation vector\"\n**     returned by this function has the same direction as the Euler axis,\n**     and its magnitude is the angle in radians.  (The magnitude and\n**     direction can be separated by means of the function eraPn.)\n**\n**  2) If r is null, so is the result.  If r is not a rotation matrix\n**     the result is undefined;  r must be proper (i.e. have a positive\n**     determinant) and real orthogonal (inverse = transpose).\n**\n**  3) The reference frame rotates clockwise as seen looking along\n**     the rotation vector from the origin.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y, z, s2, c2, phi, f;\n\n\n   x = r[1][2] - r[2][1];\n   y = r[2][0] - r[0][2];\n   z = r[0][1] - r[1][0];\n   s2 = sqrt(x*x + y*y + z*z);\n   if (s2 > 0) {\n      c2 = r[0][0] + r[1][1] + r[2][2] - 1.0;\n      phi = atan2(s2, c2);\n      f =  phi / s2;\n      w[0] = x * f;\n      w[1] = y * f;\n      w[2] = z * f;\n   } else {\n      w[0] = 0.0;\n      w[1] = 0.0;\n      w[2] = 0.0;\n   }\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13186,"name":"epv00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraEpv00(double date1, double date2,\n             double pvh[2][3], double pvb[2][3])\n/*\n**  - - - - - - - - -\n**   e r a E p v 0 0\n**  - - - - - - - - -\n**\n**  Earth position and velocity, heliocentric and barycentric, with\n**  respect to the Barycentric Celestial Reference System.\n**\n**  Given:\n**     date1,date2  double        TDB date (Note 1)\n**\n**  Returned:\n**     pvh          double[2][3]  heliocentric Earth position/velocity\n**     pvb          double[2][3]  barycentric Earth position/velocity\n**\n**  Returned (function value):\n**                  int           status: 0 = OK\n**                                       +1 = warning: date outside\n**                                            the range 1900-2100 AD\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  However,\n**     the accuracy of the result is more likely to be limited by the\n**     algorithm itself than the way the date has been expressed.\n**\n**     n.b. TT can be used instead of TDB in most applications.\n**\n**  2) On return, the arrays pvh and pvb contain the following:\n**\n**        pvh[0][0]  x       }\n**        pvh[0][1]  y       } heliocentric position, au\n**        pvh[0][2]  z       }\n**\n**        pvh[1][0]  xdot    }\n**        pvh[1][1]  ydot    } heliocentric velocity, au/d\n**        pvh[1][2]  zdot    }\n**\n**        pvb[0][0]  x       }\n**        pvb[0][1]  y       } barycentric position, au\n**        pvb[0][2]  z       }\n**\n**        pvb[1][0]  xdot    }\n**        pvb[1][1]  ydot    } barycentric velocity, au/d\n**        pvb[1][2]  zdot    }\n**\n**     The vectors are with respect to the Barycentric Celestial\n**     Reference System.  The time unit is one day in TDB.\n**\n**  3) The function is a SIMPLIFIED SOLUTION from the planetary theory\n**     VSOP2000 (X. Moisson, P. Bretagnon, 2001, Celes. Mechanics &\n**     Dyn. Astron., 80, 3/4, 205-213) and is an adaptation of original\n**     Fortran code supplied by P. Bretagnon (private comm., 2000).\n**\n**  4) Comparisons over the time span 1900-2100 with this simplified\n**     solution and the JPL DE405 ephemeris give the following results:\n**\n**                                RMS    max\n**           Heliocentric:\n**              position error    3.7   11.2   km\n**              velocity error    1.4    5.0   mm/s\n**\n**           Barycentric:\n**              position error    4.6   13.4   km\n**              velocity error    1.4    4.9   mm/s\n**\n**     Comparisons with the JPL DE406 ephemeris show that by 1800 and\n**     2200 the position errors are approximately double their 1900-2100\n**     size.  By 1500 and 2500 the deterioration is a factor of 10 and\n**     by 1000 and 3000 a factor of 60.  The velocity accuracy falls off\n**     at about half that rate.\n**\n**  5) It is permissible to use the same array for pvh and pvb, which\n**     will receive the barycentric values.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/*\n** Matrix elements for orienting the analytical model to DE405.\n**\n** The corresponding Euler angles are:\n**\n**                       d  '  \"\n**   1st rotation    -  23 26 21.4091 about the x-axis  (obliquity)\n**   2nd rotation    +         0.0475 about the z-axis  (RA offset)\n**\n** These were obtained empirically, by comparisons with DE405 over\n** 1900-2100.\n*/\n   static const double am12 =  0.000000211284,\n                       am13 = -0.000000091603,\n                       am21 = -0.000000230286,\n                       am22 =  0.917482137087,\n                       am23 = -0.397776982902,\n                       am32 =  0.397776982902,\n                       am33 =  0.917482137087;\n\n/*\n** ----------------------\n** Ephemeris Coefficients\n** ----------------------\n**\n** The ephemeris consists of harmonic terms for predicting (i) the Sun\n** to Earth vector and (ii) the Solar-System-barycenter to Sun vector\n** respectively.  The coefficients are stored in arrays which, although\n** 1-demensional, contain groups of three.  Each triplet of\n** coefficients is the amplitude, phase and frequency for one term in\n** the model, and each array contains the number of terms called for by\n** the model.\n**\n** There are eighteen such arrays, named as follows:\n**\n**     array         model      power of T      component\n**\n**      e0x      Sun-to-Earth        0              x\n**      e0y      Sun-to-Earth        0              y\n**      e0z      Sun-to-Earth        0              z\n**\n**      e1x      Sun-to-Earth        1              x\n**      e1y      Sun-to-Earth        1              y\n**      e1z      Sun-to-Earth        1              z\n**\n**      e2x      Sun-to-Earth        2              x\n**      e2y      Sun-to-Earth        2              y\n**      e2z      Sun-to-Earth        2              z\n**\n**      s0x      SSB-to-Sun          0              x\n**      s0y      SSB-to-Sun          0              y\n**      s0z      SSB-to-Sun          0              z\n**\n**      s1x      SSB-to-Sun          1              x\n**      s1y      SSB-to-Sun          1              y\n**      s1z      SSB-to-Sun          1              z\n**\n**      s2x      SSB-to-Sun          2              x\n**      s2y      SSB-to-Sun          2              y\n**      s2z      SSB-to-Sun          2              z\n*/\n\n/* Sun-to-Earth, T^0, X */\n   static const double e0x[] = {\n      0.9998292878132e+00, 0.1753485171504e+01, 0.6283075850446e+01,\n      0.8352579567414e-02, 0.1710344404582e+01, 0.1256615170089e+02,\n      0.5611445335148e-02, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.1046664295572e-03, 0.1667225416770e+01, 0.1884922755134e+02,\n      0.3110842534677e-04, 0.6687513390251e+00, 0.8399684731857e+02,\n      0.2552413503550e-04, 0.5830637358413e+00, 0.5296909721118e+00,\n      0.2137207845781e-04, 0.1092330954011e+01, 0.1577343543434e+01,\n      0.1680240182951e-04, 0.4955366134987e+00, 0.6279552690824e+01,\n      0.1679012370795e-04, 0.6153014091901e+01, 0.6286599010068e+01,\n      0.1445526946777e-04, 0.3472744100492e+01, 0.2352866153506e+01,\n\n      0.1091038246184e-04, 0.3689845786119e+01, 0.5223693906222e+01,\n      0.9344399733932e-05, 0.6073934645672e+01, 0.1203646072878e+02,\n      0.8993182910652e-05, 0.3175705249069e+01, 0.1021328554739e+02,\n      0.5665546034116e-05, 0.2152484672246e+01, 0.1059381944224e+01,\n      0.6844146703035e-05, 0.1306964099750e+01, 0.5753384878334e+01,\n      0.7346610905565e-05, 0.4354980070466e+01, 0.3981490189893e+00,\n      0.6815396474414e-05, 0.2218229211267e+01, 0.4705732307012e+01,\n      0.6112787253053e-05, 0.5384788425458e+01, 0.6812766822558e+01,\n      0.4518120711239e-05, 0.6087604012291e+01, 0.5884926831456e+01,\n      0.4521963430706e-05, 0.1279424524906e+01, 0.6256777527156e+01,\n\n      0.4497426764085e-05, 0.5369129144266e+01, 0.6309374173736e+01,\n      0.4062190566959e-05, 0.5436473303367e+00, 0.6681224869435e+01,\n      0.5412193480192e-05, 0.7867838528395e+00, 0.7755226100720e+00,\n      0.5469839049386e-05, 0.1461440311134e+01, 0.1414349524433e+02,\n      0.5205264083477e-05, 0.4432944696116e+01, 0.7860419393880e+01,\n      0.2149759935455e-05, 0.4502237496846e+01, 0.1150676975667e+02,\n      0.2279109618501e-05, 0.1239441308815e+01, 0.7058598460518e+01,\n      0.2259282939683e-05, 0.3272430985331e+01, 0.4694002934110e+01,\n      0.2558950271319e-05, 0.2265471086404e+01, 0.1216800268190e+02,\n      0.2561581447555e-05, 0.1454740653245e+01, 0.7099330490126e+00,\n\n      0.1781441115440e-05, 0.2962068630206e+01, 0.7962980379786e+00,\n      0.1612005874644e-05, 0.1473255041006e+01, 0.5486777812467e+01,\n      0.1818630667105e-05, 0.3743903293447e+00, 0.6283008715021e+01,\n      0.1818601377529e-05, 0.6274174354554e+01, 0.6283142985870e+01,\n      0.1554475925257e-05, 0.1624110906816e+01, 0.2513230340178e+02,\n      0.2090948029241e-05, 0.5852052276256e+01, 0.1179062909082e+02,\n      0.2000176345460e-05, 0.4072093298513e+01, 0.1778984560711e+02,\n      0.1289535917759e-05, 0.5217019331069e+01, 0.7079373888424e+01,\n      0.1281135307881e-05, 0.4802054538934e+01, 0.3738761453707e+01,\n      0.1518229005692e-05, 0.8691914742502e+00, 0.2132990797783e+00,\n\n      0.9450128579027e-06, 0.4601859529950e+01, 0.1097707878456e+02,\n      0.7781119494996e-06, 0.1844352816694e+01, 0.8827390247185e+01,\n      0.7733407759912e-06, 0.3582790154750e+01, 0.5507553240374e+01,\n      0.7350644318120e-06, 0.2695277788230e+01, 0.1589072916335e+01,\n      0.6535928827023e-06, 0.3651327986142e+01, 0.1176985366291e+02,\n      0.6324624183656e-06, 0.2241302375862e+01, 0.6262300422539e+01,\n      0.6298565300557e-06, 0.4407122406081e+01, 0.6303851278352e+01,\n      0.8587037089179e-06, 0.3024307223119e+01, 0.1672837615881e+03,\n      0.8299954491035e-06, 0.6192539428237e+01, 0.3340612434717e+01,\n      0.6311263503401e-06, 0.2014758795416e+01, 0.7113454667900e-02,\n\n      0.6005646745452e-06, 0.3399500503397e+01, 0.4136910472696e+01,\n      0.7917715109929e-06, 0.2493386877837e+01, 0.6069776770667e+01,\n      0.7556958099685e-06, 0.4159491740143e+01, 0.6496374930224e+01,\n      0.6773228244949e-06, 0.4034162934230e+01, 0.9437762937313e+01,\n      0.5370708577847e-06, 0.1562219163734e+01, 0.1194447056968e+01,\n      0.5710804266203e-06, 0.2662730803386e+01, 0.6282095334605e+01,\n      0.5709824583726e-06, 0.3985828430833e+01, 0.6284056366286e+01,\n      0.5143950896447e-06, 0.1308144688689e+01, 0.6290189305114e+01,\n      0.5088010604546e-06, 0.5352817214804e+01, 0.6275962395778e+01,\n      0.4960369085172e-06, 0.2644267922349e+01, 0.6127655567643e+01,\n\n      0.4803137891183e-06, 0.4008844192080e+01, 0.6438496133249e+01,\n      0.5731747768225e-06, 0.3794550174597e+01, 0.3154687086868e+01,\n      0.4735947960579e-06, 0.6107118308982e+01, 0.3128388763578e+01,\n      0.4808348796625e-06, 0.4771458618163e+01, 0.8018209333619e+00,\n      0.4115073743137e-06, 0.3327111335159e+01, 0.8429241228195e+01,\n      0.5230575889287e-06, 0.5305708551694e+01, 0.1336797263425e+02,\n      0.5133977889215e-06, 0.5784230738814e+01, 0.1235285262111e+02,\n      0.5065815825327e-06, 0.2052064793679e+01, 0.1185621865188e+02,\n      0.4339831593868e-06, 0.3644994195830e+01, 0.1726015463500e+02,\n      0.3952928638953e-06, 0.4930376436758e+01, 0.5481254917084e+01,\n\n      0.4898498111942e-06, 0.4542084219731e+00, 0.9225539266174e+01,\n      0.4757490209328e-06, 0.3161126388878e+01, 0.5856477690889e+01,\n      0.4727701669749e-06, 0.6214993845446e+00, 0.2544314396739e+01,\n      0.3800966681863e-06, 0.3040132339297e+01, 0.4265981595566e+00,\n      0.3257301077939e-06, 0.8064977360087e+00, 0.3930209696940e+01,\n      0.3255810528674e-06, 0.1974147981034e+01, 0.2146165377750e+01,\n      0.3252029748187e-06, 0.2845924913135e+01, 0.4164311961999e+01,\n      0.3255505635308e-06, 0.3017900824120e+01, 0.5088628793478e+01,\n      0.2801345211990e-06, 0.6109717793179e+01, 0.1256967486051e+02,\n      0.3688987740970e-06, 0.2911550235289e+01, 0.1807370494127e+02,\n\n      0.2475153429458e-06, 0.2179146025856e+01, 0.2629832328990e-01,\n      0.3033457749150e-06, 0.1994161050744e+01, 0.4535059491685e+01,\n      0.2186743763110e-06, 0.5125687237936e+01, 0.1137170464392e+02,\n      0.2764777032774e-06, 0.4822646860252e+00, 0.1256262854127e+02,\n      0.2199028768592e-06, 0.4637633293831e+01, 0.1255903824622e+02,\n      0.2046482824760e-06, 0.1467038733093e+01, 0.7084896783808e+01,\n      0.2611209147507e-06, 0.3044718783485e+00, 0.7143069561767e+02,\n      0.2286079656818e-06, 0.4764220356805e+01, 0.8031092209206e+01,\n      0.1855071202587e-06, 0.3383637774428e+01, 0.1748016358760e+01,\n      0.2324669506784e-06, 0.6189088449251e+01, 0.1831953657923e+02,\n\n      0.1709528015688e-06, 0.5874966729774e+00, 0.4933208510675e+01,\n      0.2168156875828e-06, 0.4302994009132e+01, 0.1044738781244e+02,\n      0.2106675556535e-06, 0.3800475419891e+01, 0.7477522907414e+01,\n      0.1430213830465e-06, 0.1294660846502e+01, 0.2942463415728e+01,\n      0.1388396901944e-06, 0.4594797202114e+01, 0.8635942003952e+01,\n      0.1922258844190e-06, 0.4943044543591e+00, 0.1729818233119e+02,\n      0.1888460058292e-06, 0.2426943912028e+01, 0.1561374759853e+03,\n      0.1789449386107e-06, 0.1582973303499e+00, 0.1592596075957e+01,\n      0.1360803685374e-06, 0.5197240440504e+01, 0.1309584267300e+02,\n      0.1504038014709e-06, 0.3120360916217e+01, 0.1649636139783e+02,\n\n      0.1382769533389e-06, 0.6164702888205e+01, 0.7632943190217e+01,\n      0.1438059769079e-06, 0.1437423770979e+01, 0.2042657109477e+02,\n      0.1326303260037e-06, 0.3609688799679e+01, 0.1213955354133e+02,\n      0.1159244950540e-06, 0.5463018167225e+01, 0.5331357529664e+01,\n      0.1433118149136e-06, 0.6028909912097e+01, 0.7342457794669e+01,\n      0.1234623148594e-06, 0.3109645574997e+01, 0.6279485555400e+01,\n      0.1233949875344e-06, 0.3539359332866e+01, 0.6286666145492e+01,\n      0.9927196061299e-07, 0.1259321569772e+01, 0.7234794171227e+01,\n      0.1242302191316e-06, 0.1065949392609e+01, 0.1511046609763e+02,\n      0.1098402195201e-06, 0.2192508743837e+01, 0.1098880815746e+02,\n\n      0.1158191395315e-06, 0.4054411278650e+01, 0.5729506548653e+01,\n      0.9048475596241e-07, 0.5429764748518e+01, 0.9623688285163e+01,\n      0.8889853269023e-07, 0.5046586206575e+01, 0.6148010737701e+01,\n      0.1048694242164e-06, 0.2628858030806e+01, 0.6836645152238e+01,\n      0.1112308378646e-06, 0.4177292719907e+01, 0.1572083878776e+02,\n      0.8631729709901e-07, 0.1601345232557e+01, 0.6418140963190e+01,\n      0.8527816951664e-07, 0.2463888997513e+01, 0.1471231707864e+02,\n      0.7892139456991e-07, 0.3154022088718e+01, 0.2118763888447e+01,\n      0.1051782905236e-06, 0.4795035816088e+01, 0.1349867339771e+01,\n      0.1048219943164e-06, 0.2952983395230e+01, 0.5999216516294e+01,\n\n      0.7435760775143e-07, 0.5420547991464e+01, 0.6040347114260e+01,\n      0.9869574106949e-07, 0.3695646753667e+01, 0.6566935184597e+01,\n      0.9156886364226e-07, 0.3922675306609e+01, 0.5643178611111e+01,\n      0.7006834356188e-07, 0.1233968624861e+01, 0.6525804586632e+01,\n      0.9806170182601e-07, 0.1919542280684e+01, 0.2122839202813e+02,\n      0.9052289673607e-07, 0.4615902724369e+01, 0.4690479774488e+01,\n      0.7554200867893e-07, 0.1236863719072e+01, 0.1253985337760e+02,\n      0.8215741286498e-07, 0.3286800101559e+00, 0.1097355562493e+02,\n      0.7185178575397e-07, 0.5880942158367e+01, 0.6245048154254e+01,\n      0.7130726476180e-07, 0.7674871987661e+00, 0.6321103546637e+01,\n\n      0.6650894461162e-07, 0.6987129150116e+00, 0.5327476111629e+01,\n      0.7396888823688e-07, 0.3576824794443e+01, 0.5368044267797e+00,\n      0.7420588884775e-07, 0.5033615245369e+01, 0.2354323048545e+02,\n      0.6141181642908e-07, 0.9449927045673e+00, 0.1296430071988e+02,\n      0.6373557924058e-07, 0.6206342280341e+01, 0.9517183207817e+00,\n      0.6359474329261e-07, 0.5036079095757e+01, 0.1990745094947e+01,\n      0.5740173582646e-07, 0.6105106371350e+01, 0.9555997388169e+00,\n      0.7019864084602e-07, 0.7237747359018e+00, 0.5225775174439e+00,\n      0.6398054487042e-07, 0.3976367969666e+01, 0.2407292145756e+02,\n      0.7797092650498e-07, 0.4305423910623e+01, 0.2200391463820e+02,\n\n      0.6466760000900e-07, 0.3500136825200e+01, 0.5230807360890e+01,\n      0.7529417043890e-07, 0.3514779246100e+01, 0.1842262939178e+02,\n      0.6924571140892e-07, 0.2743457928679e+01, 0.1554202828031e+00,\n      0.6220798650222e-07, 0.2242598118209e+01, 0.1845107853235e+02,\n      0.5870209391853e-07, 0.2332832707527e+01, 0.6398972393349e+00,\n      0.6263953473888e-07, 0.2191105358956e+01, 0.6277552955062e+01,\n      0.6257781390012e-07, 0.4457559396698e+01, 0.6288598745829e+01,\n      0.5697304945123e-07, 0.3499234761404e+01, 0.1551045220144e+01,\n      0.6335438746791e-07, 0.6441691079251e+00, 0.5216580451554e+01,\n      0.6377258441152e-07, 0.2252599151092e+01, 0.5650292065779e+01,\n\n      0.6484841818165e-07, 0.1992812417646e+01, 0.1030928125552e+00,\n      0.4735551485250e-07, 0.3744672082942e+01, 0.1431416805965e+02,\n      0.4628595996170e-07, 0.1334226211745e+01, 0.5535693017924e+00,\n      0.6258152336933e-07, 0.4395836159154e+01, 0.2608790314060e+02,\n      0.6196171366594e-07, 0.2587043007997e+01, 0.8467247584405e+02,\n      0.6159556952126e-07, 0.4782499769128e+01, 0.2394243902548e+03,\n      0.4987741172394e-07, 0.7312257619924e+00, 0.7771377146812e+02,\n      0.5459280703142e-07, 0.3001376372532e+01, 0.6179983037890e+01,\n      0.4863461189999e-07, 0.3767222128541e+01, 0.9027992316901e+02,\n      0.5349912093158e-07, 0.3663594450273e+01, 0.6386168663001e+01,\n\n      0.5673725607806e-07, 0.4331187919049e+01, 0.6915859635113e+01,\n      0.4745485060512e-07, 0.5816195745518e+01, 0.6282970628506e+01,\n      0.4745379005326e-07, 0.8323672435672e+00, 0.6283181072386e+01,\n      0.4049002796321e-07, 0.3785023976293e+01, 0.6254626709878e+01,\n      0.4247084014515e-07, 0.2378220728783e+01, 0.7875671926403e+01,\n      0.4026912363055e-07, 0.2864103423269e+01, 0.6311524991013e+01,\n      0.4062935011774e-07, 0.2415408595975e+01, 0.3634620989887e+01,\n      0.5347771048509e-07, 0.3343479309801e+01, 0.2515860172507e+02,\n      0.4829494136505e-07, 0.2821742398262e+01, 0.5760498333002e+01,\n      0.4342554404599e-07, 0.5624662458712e+01, 0.7238675589263e+01,\n\n      0.4021599184361e-07, 0.5557250275009e+00, 0.1101510648075e+02,\n      0.4104900474558e-07, 0.3296691780005e+01, 0.6709674010002e+01,\n      0.4376532905131e-07, 0.3814443999443e+01, 0.6805653367890e+01,\n      0.3314590480650e-07, 0.3560229189250e+01, 0.1259245002418e+02,\n      0.3232421839643e-07, 0.5185389180568e+01, 0.1066495398892e+01,\n      0.3541176318876e-07, 0.3921381909679e+01, 0.9917696840332e+01,\n      0.3689831242681e-07, 0.4190658955386e+01, 0.1192625446156e+02,\n      0.3890605376774e-07, 0.5546023371097e+01, 0.7478166569050e-01,\n      0.3038559339780e-07, 0.6231032794494e+01, 0.1256621883632e+02,\n      0.3137083969782e-07, 0.6207063419190e+01, 0.4292330755499e+01,\n\n      0.4024004081854e-07, 0.1195257375713e+01, 0.1334167431096e+02,\n      0.3300234879283e-07, 0.1804694240998e+01, 0.1057540660594e+02,\n      0.3635399155575e-07, 0.5597811343500e+01, 0.6208294184755e+01,\n      0.3032668691356e-07, 0.3191059366530e+01, 0.1805292951336e+02,\n      0.2809652069058e-07, 0.4094348032570e+01, 0.3523159621801e-02,\n      0.3696955383823e-07, 0.5219282738794e+01, 0.5966683958112e+01,\n      0.3562894142503e-07, 0.1037247544554e+01, 0.6357857516136e+01,\n      0.3510598524148e-07, 0.1430020816116e+01, 0.6599467742779e+01,\n      0.3617736142953e-07, 0.3002911403677e+01, 0.6019991944201e+01,\n      0.2624524910730e-07, 0.2437046757292e+01, 0.6702560555334e+01,\n\n      0.2535824204490e-07, 0.1581594689647e+01, 0.3141537925223e+02,\n      0.3519787226257e-07, 0.5379863121521e+01, 0.2505706758577e+03,\n      0.2578406709982e-07, 0.4904222639329e+01, 0.1673046366289e+02,\n      0.3423887981473e-07, 0.3646448997315e+01, 0.6546159756691e+01,\n      0.2776083886467e-07, 0.3307829300144e+01, 0.1272157198369e+02,\n      0.3379592818379e-07, 0.1747541251125e+01, 0.1494531617769e+02,\n      0.3050255426284e-07, 0.1784689432607e-01, 0.4732030630302e+01,\n      0.2652378350236e-07, 0.4420055276260e+01, 0.5863591145557e+01,\n      0.2374498173768e-07, 0.3629773929208e+01, 0.2388894113936e+01,\n      0.2716451255140e-07, 0.3079623706780e+01, 0.1202934727411e+02,\n\n      0.3038583699229e-07, 0.3312487903507e+00, 0.1256608456547e+02,\n      0.2220681228760e-07, 0.5265520401774e+01, 0.1336244973887e+02,\n      0.3044156540912e-07, 0.4766664081250e+01, 0.2908881142201e+02,\n      0.2731859923561e-07, 0.5069146530691e+01, 0.1391601904066e+02,\n      0.2285603018171e-07, 0.5954935112271e+01, 0.6076890225335e+01,\n      0.2025006454555e-07, 0.4061789589267e+01, 0.4701116388778e+01,\n      0.2012597519804e-07, 0.2485047705241e+01, 0.6262720680387e+01,\n      0.2003406962258e-07, 0.4163779209320e+01, 0.6303431020504e+01,\n      0.2207863441371e-07, 0.6923839133828e+00, 0.6489261475556e+01,\n      0.2481374305624e-07, 0.5944173595676e+01, 0.1204357418345e+02,\n\n      0.2130923288870e-07, 0.4641013671967e+01, 0.5746271423666e+01,\n      0.2446370543391e-07, 0.6125796518757e+01, 0.1495633313810e+00,\n      0.1932492759052e-07, 0.2234572324504e+00, 0.1352175143971e+02,\n      0.2600122568049e-07, 0.4281012405440e+01, 0.4590910121555e+01,\n      0.2431754047488e-07, 0.1429943874870e+00, 0.1162474756779e+01,\n      0.1875902869209e-07, 0.9781803816948e+00, 0.6279194432410e+01,\n      0.1874381139426e-07, 0.5670368130173e+01, 0.6286957268481e+01,\n      0.2156696047173e-07, 0.2008985006833e+01, 0.1813929450232e+02,\n      0.1965076182484e-07, 0.2566186202453e+00, 0.4686889479442e+01,\n      0.2334816372359e-07, 0.4408121891493e+01, 0.1002183730415e+02,\n\n      0.1869937408802e-07, 0.5272745038656e+01, 0.2427287361862e+00,\n      0.2436236460883e-07, 0.4407720479029e+01, 0.9514313292143e+02,\n      0.1761365216611e-07, 0.1943892315074e+00, 0.1351787002167e+02,\n      0.2156289480503e-07, 0.1418570924545e+01, 0.6037244212485e+01,\n      0.2164748979255e-07, 0.4724603439430e+01, 0.2301353951334e+02,\n      0.2222286670853e-07, 0.2400266874598e+01, 0.1266924451345e+02,\n      0.2070901414929e-07, 0.5230348028732e+01, 0.6528907488406e+01,\n      0.1792745177020e-07, 0.2099190328945e+01, 0.6819880277225e+01,\n      0.1841802068445e-07, 0.3467527844848e+00, 0.6514761976723e+02,\n      0.1578401631718e-07, 0.7098642356340e+00, 0.2077542790660e-01,\n\n      0.1561690152531e-07, 0.5943349620372e+01, 0.6272439236156e+01,\n      0.1558591045463e-07, 0.7040653478980e+00, 0.6293712464735e+01,\n      0.1737356469576e-07, 0.4487064760345e+01, 0.1765478049437e+02,\n      0.1434755619991e-07, 0.2993391570995e+01, 0.1102062672231e+00,\n      0.1482187806654e-07, 0.2278049198251e+01, 0.1052268489556e+01,\n      0.1424812827089e-07, 0.1682114725827e+01, 0.1311972100268e+02,\n      0.1380282448623e-07, 0.3262668602579e+01, 0.1017725758696e+02,\n      0.1811481244566e-07, 0.3187771221777e+01, 0.1887552587463e+02,\n      0.1504446185696e-07, 0.5650162308647e+01, 0.7626583626240e-01,\n      0.1740776154137e-07, 0.5487068607507e+01, 0.1965104848470e+02,\n\n      0.1374339536251e-07, 0.5745688172201e+01, 0.6016468784579e+01,\n      0.1761377477704e-07, 0.5748060203659e+01, 0.2593412433514e+02,\n      0.1535138225795e-07, 0.6226848505790e+01, 0.9411464614024e+01,\n      0.1788140543676e-07, 0.6189318878563e+01, 0.3301902111895e+02,\n      0.1375002807996e-07, 0.5371812884394e+01, 0.6327837846670e+00,\n      0.1242115758632e-07, 0.1471687569712e+01, 0.3894181736510e+01,\n      0.1450977333938e-07, 0.4143836662127e+01, 0.1277945078067e+02,\n      0.1297579575023e-07, 0.9003477661957e+00, 0.6549682916313e+01,\n      0.1462667934821e-07, 0.5760505536428e+01, 0.1863592847156e+02,\n      0.1381774374799e-07, 0.1085471729463e+01, 0.2379164476796e+01,\n\n      0.1682333169307e-07, 0.5409870870133e+01, 0.1620077269078e+02,\n      0.1190812918837e-07, 0.1397205174601e+01, 0.1149965630200e+02,\n      0.1221434762106e-07, 0.9001804809095e+00, 0.1257326515556e+02,\n      0.1549934644860e-07, 0.4262528275544e+01, 0.1820933031200e+02,\n      0.1252138953050e-07, 0.1411642012027e+01, 0.6993008899458e+01,\n      0.1237078905387e-07, 0.2844472403615e+01, 0.2435678079171e+02,\n      0.1446953389615e-07, 0.5295835522223e+01, 0.3813291813120e-01,\n      0.1388446457170e-07, 0.4969428135497e+01, 0.2458316379602e+00,\n      0.1019339179228e-07, 0.2491369561806e+01, 0.6112403035119e+01,\n      0.1258880815343e-07, 0.4679426248976e+01, 0.5429879531333e+01,\n\n      0.1297768238261e-07, 0.1074509953328e+01, 0.1249137003520e+02,\n      0.9913505718094e-08, 0.4735097918224e+01, 0.6247047890016e+01,\n      0.9830453155969e-08, 0.4158649187338e+01, 0.6453748665772e+01,\n      0.1192615865309e-07, 0.3438208613699e+01, 0.6290122169689e+01,\n      0.9835874798277e-08, 0.1913300781229e+01, 0.6319103810876e+01,\n      0.9639087569277e-08, 0.9487683644125e+00, 0.8273820945392e+01,\n      0.1175716107001e-07, 0.3228141664287e+01, 0.6276029531202e+01,\n      0.1018926508678e-07, 0.2216607854300e+01, 0.1254537627298e+02,\n      0.9500087869225e-08, 0.2625116459733e+01, 0.1256517118505e+02,\n      0.9664192916575e-08, 0.5860562449214e+01, 0.6259197520765e+01,\n\n      0.9612858712203e-08, 0.7885682917381e+00, 0.6306954180126e+01,\n      0.1117645675413e-07, 0.3932148831189e+01, 0.1779695906178e+02,\n      0.1158864052160e-07, 0.9995605521691e+00, 0.1778273215245e+02,\n      0.9021043467028e-08, 0.5263769742673e+01, 0.6172869583223e+01,\n      0.8836134773563e-08, 0.1496843220365e+01, 0.1692165728891e+01,\n      0.1045872200691e-07, 0.7009039517214e+00, 0.2204125344462e+00,\n      0.1211463487798e-07, 0.4041544938511e+01, 0.8257698122054e+02,\n      0.8541990804094e-08, 0.1447586692316e+01, 0.6393282117669e+01,\n      0.1038720703636e-07, 0.4594249718112e+00, 0.1550861511662e+02,\n      0.1126722351445e-07, 0.3925550579036e+01, 0.2061856251104e+00,\n\n      0.8697373859631e-08, 0.4411341856037e+01, 0.9491756770005e+00,\n      0.8869380028441e-08, 0.2402659724813e+01, 0.3903911373650e+01,\n      0.9247014693258e-08, 0.1401579743423e+01, 0.6267823317922e+01,\n      0.9205062930950e-08, 0.5245978000814e+01, 0.6298328382969e+01,\n      0.8000745038049e-08, 0.3590803356945e+01, 0.2648454860559e+01,\n      0.9168973650819e-08, 0.2470150501679e+01, 0.1498544001348e+03,\n      0.1075444949238e-07, 0.1328606161230e+01, 0.3694923081589e+02,\n      0.7817298525817e-08, 0.6162256225998e+01, 0.4804209201333e+01,\n      0.9541469226356e-08, 0.3942568967039e+01, 0.1256713221673e+02,\n      0.9821910122027e-08, 0.2360246287233e+00, 0.1140367694411e+02,\n\n      0.9897822023777e-08, 0.4619805634280e+01, 0.2280573557157e+02,\n      0.7737289283765e-08, 0.3784727847451e+01, 0.7834121070590e+01,\n      0.9260204034710e-08, 0.2223352487601e+01, 0.2787043132925e+01,\n      0.7320252888486e-08, 0.1288694636874e+01, 0.6282655592598e+01,\n      0.7319785780946e-08, 0.5359869567774e+01, 0.6283496108294e+01,\n      0.7147219933778e-08, 0.5516616675856e+01, 0.1725663147538e+02,\n      0.7946502829878e-08, 0.2630459984567e+01, 0.1241073141809e+02,\n      0.9001711808932e-08, 0.2849815827227e+01, 0.6281591679874e+01,\n      0.8994041507257e-08, 0.3795244450750e+01, 0.6284560021018e+01,\n      0.8298582787358e-08, 0.5236413127363e+00, 0.1241658836951e+02,\n\n      0.8526596520710e-08, 0.4794605424426e+01, 0.1098419223922e+02,\n      0.8209822103197e-08, 0.1578752370328e+01, 0.1096996532989e+02,\n      0.6357049861094e-08, 0.5708926113761e+01, 0.1596186371003e+01,\n      0.7370473179049e-08, 0.3842402530241e+01, 0.4061219149443e+01,\n      0.7232154664726e-08, 0.3067548981535e+01, 0.1610006857377e+03,\n      0.6328765494903e-08, 0.1313930030069e+01, 0.1193336791622e+02,\n      0.8030064908595e-08, 0.3488500408886e+01, 0.8460828644453e+00,\n      0.6275464259232e-08, 0.1532061626198e+01, 0.8531963191132e+00,\n      0.7051897446325e-08, 0.3285859929993e+01, 0.5849364236221e+01,\n      0.6161593705428e-08, 0.1477341999464e+01, 0.5573142801433e+01,\n\n      0.7754683957278e-08, 0.1586118663096e+01, 0.8662240327241e+01,\n      0.5889928990701e-08, 0.1304887868803e+01, 0.1232342296471e+02,\n      0.5705756047075e-08, 0.4555333589350e+01, 0.1258692712880e+02,\n      0.5964178808332e-08, 0.3001762842062e+01, 0.5333900173445e+01,\n      0.6712446027467e-08, 0.4886780007595e+01, 0.1171295538178e+02,\n      0.5941809275464e-08, 0.4701509603824e+01, 0.9779108567966e+01,\n      0.5466993627395e-08, 0.4588357817278e+01, 0.1884211409667e+02,\n      0.6340512090980e-08, 0.1164543038893e+01, 0.5217580628120e+02,\n      0.6325505710045e-08, 0.3919171259645e+01, 0.1041998632314e+02,\n      0.6164789509685e-08, 0.2143828253542e+01, 0.6151533897323e+01,\n\n      0.5263330812430e-08, 0.6066564434241e+01, 0.1885275071096e+02,\n      0.5597087780221e-08, 0.2926316429472e+01, 0.4337116142245e+00,\n      0.5396556236817e-08, 0.3244303591505e+01, 0.6286362197481e+01,\n      0.5396615148223e-08, 0.3404304703662e+01, 0.6279789503410e+01,\n      0.7091832443341e-08, 0.8532377803192e+00, 0.4907302013889e+01,\n      0.6572352589782e-08, 0.4901966774419e+01, 0.1176433076753e+02,\n      0.5960236060795e-08, 0.1874672315797e+01, 0.1422690933580e-01,\n      0.5125480043511e-08, 0.3735726064334e+01, 0.1245594543367e+02,\n      0.5928241866410e-08, 0.4502033899935e+01, 0.6414617803568e+01,\n      0.5249600357424e-08, 0.4372334799878e+01, 0.1151388321134e+02,\n\n      0.6059171276087e-08, 0.2581617302908e+01, 0.6062663316000e+01,\n      0.5295235081662e-08, 0.2974811513158e+01, 0.3496032717521e+01,\n      0.5820561875933e-08, 0.1796073748244e+00, 0.2838593341516e+00,\n      0.4754696606440e-08, 0.1981998136973e+01, 0.3104930017775e+01,\n      0.6385053548955e-08, 0.2559174171605e+00, 0.6133512519065e+01,\n      0.6589828273941e-08, 0.2750967106776e+01, 0.4087944051283e+02,\n      0.5383376567189e-08, 0.6325947523578e+00, 0.2248384854122e+02,\n      0.5928941683538e-08, 0.1672304519067e+01, 0.1581959461667e+01,\n      0.4816060709794e-08, 0.3512566172575e+01, 0.9388005868221e+01,\n      0.6003381586512e-08, 0.5610932219189e+01, 0.5326786718777e+01,\n\n      0.5504225393105e-08, 0.4037501131256e+01, 0.6503488384892e+01,\n      0.5353772620129e-08, 0.6122774968240e+01, 0.1735668374386e+03,\n      0.5786253768544e-08, 0.5527984999515e+01, 0.1350651127443e+00,\n      0.5065706702002e-08, 0.9980765573624e+00, 0.1248988586463e+02,\n      0.5972838885276e-08, 0.6044489493203e+01, 0.2673594526851e+02,\n      0.5323585877961e-08, 0.3924265998147e+01, 0.4171425416666e+01,\n      0.5210772682858e-08, 0.6220111376901e+01, 0.2460261242967e+02,\n      0.4726549040535e-08, 0.3716043206862e+01, 0.7232251527446e+01,\n      0.6029425105059e-08, 0.8548704071116e+00, 0.3227113045244e+03,\n      0.4481542826513e-08, 0.1426925072829e+01, 0.5547199253223e+01,\n\n      0.5836024505068e-08, 0.7135651752625e-01, 0.7285056171570e+02,\n      0.4137046613272e-08, 0.5330767643283e+01, 0.1087398597200e+02,\n      0.5171977473924e-08, 0.4494262335353e+00, 0.1884570439172e+02,\n      0.5694429833732e-08, 0.2952369582215e+01, 0.9723862754494e+02,\n      0.4009158925298e-08, 0.3500003416535e+01, 0.6244942932314e+01,\n      0.4784939596873e-08, 0.6196709413181e+01, 0.2929661536378e+02,\n      0.3983725022610e-08, 0.5103690031897e+01, 0.4274518229222e+01,\n      0.3870535232462e-08, 0.3187569587401e+01, 0.6321208768577e+01,\n      0.5140501213951e-08, 0.1668924357457e+01, 0.1232032006293e+02,\n      0.3849034819355e-08, 0.4445722510309e+01, 0.1726726808967e+02,\n\n      0.4002383075060e-08, 0.5226224152423e+01, 0.7018952447668e+01,\n      0.3890719543549e-08, 0.4371166550274e+01, 0.1491901785440e+02,\n      0.4887084607881e-08, 0.5973556689693e+01, 0.1478866649112e+01,\n      0.3739939287592e-08, 0.2089084714600e+01, 0.6922973089781e+01,\n      0.5031925918209e-08, 0.4658371936827e+01, 0.1715706182245e+02,\n      0.4387748764954e-08, 0.4825580552819e+01, 0.2331413144044e+03,\n      0.4147398098865e-08, 0.3739003524998e+01, 0.1376059875786e+02,\n      0.3719089993586e-08, 0.1148941386536e+01, 0.6297302759782e+01,\n      0.3934238461056e-08, 0.1559893008343e+01, 0.7872148766781e+01,\n      0.3672471375622e-08, 0.5516145383612e+01, 0.6268848941110e+01,\n\n      0.3768911277583e-08, 0.6116053700563e+01, 0.4157198507331e+01,\n      0.4033388417295e-08, 0.5076821746017e+01, 0.1567108171867e+02,\n      0.3764194617832e-08, 0.8164676232075e+00, 0.3185192151914e+01,\n      0.4840628226284e-08, 0.1360479453671e+01, 0.1252801878276e+02,\n      0.4949443923785e-08, 0.2725622229926e+01, 0.1617106187867e+03,\n      0.4117393089971e-08, 0.6054459628492e+00, 0.5642198095270e+01,\n      0.3925754020428e-08, 0.8570462135210e+00, 0.2139354194808e+02,\n      0.3630551757923e-08, 0.3552067338279e+01, 0.6294805223347e+01,\n      0.3627274802357e-08, 0.3096565085313e+01, 0.6271346477544e+01,\n      0.3806143885093e-08, 0.6367751709777e+00, 0.1725304118033e+02,\n\n      0.4433254641565e-08, 0.4848461503937e+01, 0.7445550607224e+01,\n      0.3712319846576e-08, 0.1331950643655e+01, 0.4194847048887e+00,\n      0.3849847534783e-08, 0.4958368297746e+00, 0.9562891316684e+00,\n      0.3483955430165e-08, 0.2237215515707e+01, 0.1161697602389e+02,\n      0.3961912730982e-08, 0.3332402188575e+01, 0.2277943724828e+02,\n      0.3419978244481e-08, 0.5785600576016e+01, 0.1362553364512e+02,\n      0.3329417758177e-08, 0.9812676559709e-01, 0.1685848245639e+02,\n      0.4207206893193e-08, 0.9494780468236e+00, 0.2986433403208e+02,\n      0.3268548976410e-08, 0.1739332095686e+00, 0.5749861718712e+01,\n      0.3321880082685e-08, 0.1423354800666e+01, 0.6279143387820e+01,\n\n      0.4503173010852e-08, 0.2314972675293e+00, 0.1385561574497e+01,\n      0.4316599090954e-08, 0.1012646782616e+00, 0.4176041334900e+01,\n      0.3283493323850e-08, 0.5233306881265e+01, 0.6287008313071e+01,\n      0.3164033542343e-08, 0.4005597257511e+01, 0.2099539292909e+02,\n      0.4159720956725e-08, 0.5365676242020e+01, 0.5905702259363e+01,\n      0.3565176892217e-08, 0.4284440620612e+01, 0.3932462625300e-02,\n      0.3514440950221e-08, 0.4270562636575e+01, 0.7335344340001e+01,\n      0.3540596871909e-08, 0.5953553201060e+01, 0.1234573916645e+02,\n      0.2960769905118e-08, 0.1115180417718e+01, 0.2670964694522e+02,\n      0.2962213739684e-08, 0.3863811918186e+01, 0.6408777551755e+00,\n\n      0.3883556700251e-08, 0.1268617928302e+01, 0.6660449441528e+01,\n      0.2919225516346e-08, 0.4908605223265e+01, 0.1375773836557e+01,\n      0.3115158863370e-08, 0.3744519976885e+01, 0.3802769619140e-01,\n      0.4099438144212e-08, 0.4173244670532e+01, 0.4480965020977e+02,\n      0.2899531858964e-08, 0.5910601428850e+01, 0.2059724391010e+02,\n      0.3289733429855e-08, 0.2488050078239e+01, 0.1081813534213e+02,\n      0.3933075612875e-08, 0.1122363652883e+01, 0.3773735910827e+00,\n      0.3021403764467e-08, 0.4951973724904e+01, 0.2982630633589e+02,\n      0.2798598949757e-08, 0.5117057845513e+01, 0.1937891852345e+02,\n      0.3397421302707e-08, 0.6104159180476e+01, 0.6923953605621e+01,\n\n      0.3720398002179e-08, 0.1184933429829e+01, 0.3066615496545e+02,\n      0.3598484186267e-08, 0.3505282086105e+01, 0.6147450479709e+01,\n      0.3694594027310e-08, 0.2286651088141e+01, 0.2636725487657e+01,\n      0.2680444152969e-08, 0.1871816775482e+00, 0.6816289982179e+01,\n      0.3497574865641e-08, 0.3143251755431e+01, 0.6418701221183e+01,\n      0.3130274129494e-08, 0.2462167316018e+01, 0.1235996607578e+02,\n      0.3241119069551e-08, 0.4256374004686e+01, 0.1652265972112e+02,\n      0.2601960842061e-08, 0.4970362941425e+01, 0.1045450126711e+02,\n      0.2690601527504e-08, 0.2372657824898e+01, 0.3163918923335e+00,\n      0.2908688152664e-08, 0.4232652627721e+01, 0.2828699048865e+02,\n\n      0.3120456131875e-08, 0.3925747001137e+00, 0.2195415756911e+02,\n      0.3148855423384e-08, 0.3093478330445e+01, 0.1172006883645e+02,\n      0.3051044261017e-08, 0.5560948248212e+01, 0.6055599646783e+01,\n      0.2826006876660e-08, 0.5072790310072e+01, 0.5120601093667e+01,\n      0.3100034191711e-08, 0.4998530231096e+01, 0.1799603123222e+02,\n      0.2398771640101e-08, 0.2561739802176e+01, 0.6255674361143e+01,\n      0.2384002842728e-08, 0.4087420284111e+01, 0.6310477339748e+01,\n      0.2842146517568e-08, 0.2515048217955e+01, 0.5469525544182e+01,\n      0.2847674371340e-08, 0.5235326497443e+01, 0.1034429499989e+02,\n      0.2903722140764e-08, 0.1088200795797e+01, 0.6510552054109e+01,\n\n      0.3187610710605e-08, 0.4710624424816e+01, 0.1693792562116e+03,\n      0.3048869992813e-08, 0.2857975896445e+00, 0.8390110365991e+01,\n      0.2860216950984e-08, 0.2241619020815e+01, 0.2243449970715e+00,\n      0.2701117683113e-08, 0.6651573305272e-01, 0.6129297044991e+01,\n      0.2509891590152e-08, 0.1285135324585e+01, 0.1044027435778e+02,\n      0.2623200252223e-08, 0.2981229834530e+00, 0.6436854655901e+01,\n      0.2622541669202e-08, 0.6122470726189e+01, 0.9380959548977e+01,\n      0.2818435667099e-08, 0.4251087148947e+01, 0.5934151399930e+01,\n      0.2365196797465e-08, 0.3465070460790e+01, 0.2470570524223e+02,\n      0.2358704646143e-08, 0.5791603815350e+01, 0.8671969964381e+01,\n\n      0.2388299481390e-08, 0.4142483772941e+01, 0.7096626156709e+01,\n      0.1996041217224e-08, 0.2101901889496e+01, 0.1727188400790e+02,\n      0.2687593060336e-08, 0.1526689456959e+01, 0.7075506709219e+02,\n      0.2618913670810e-08, 0.2397684236095e+01, 0.6632000300961e+01,\n      0.2571523050364e-08, 0.5751929456787e+00, 0.6206810014183e+01,\n      0.2582135006946e-08, 0.5595464352926e+01, 0.4873985990671e+02,\n      0.2372530190361e-08, 0.5092689490655e+01, 0.1590676413561e+02,\n      0.2357178484712e-08, 0.4444363527851e+01, 0.3097883698531e+01,\n      0.2451590394723e-08, 0.3108251687661e+01, 0.6612329252343e+00,\n      0.2370045949608e-08, 0.2608133861079e+01, 0.3459636466239e+02,\n\n      0.2268997267358e-08, 0.3639717753384e+01, 0.2844914056730e-01,\n      0.1731432137906e-08, 0.1741898445707e+00, 0.2019909489111e+02,\n      0.1629869741622e-08, 0.3902225646724e+01, 0.3035599730800e+02,\n      0.2206215801974e-08, 0.4971131250731e+01, 0.6281667977667e+01,\n      0.2205469554680e-08, 0.1677462357110e+01, 0.6284483723224e+01,\n      0.2148792362509e-08, 0.4236259604006e+01, 0.1980482729015e+02,\n      0.1873733657847e-08, 0.5926814998687e+01, 0.2876692439167e+02,\n      0.2026573758959e-08, 0.4349643351962e+01, 0.2449240616245e+02,\n      0.1807770325110e-08, 0.5700940482701e+01, 0.2045286941806e+02,\n      0.1881174408581e-08, 0.6601286363430e+00, 0.2358125818164e+02,\n\n      0.1368023671690e-08, 0.2211098592752e+01, 0.2473415438279e+02,\n      0.1720017916280e-08, 0.4942488551129e+01, 0.1679593901136e+03,\n      0.1702427665131e-08, 0.1452233856386e+01, 0.3338575901272e+03,\n      0.1414032510054e-08, 0.5525357721439e+01, 0.1624205518357e+03,\n      0.1652626045364e-08, 0.4108794283624e+01, 0.8956999012000e+02,\n      0.1642957769686e-08, 0.7344335209984e+00, 0.5267006960365e+02,\n      0.1614952403624e-08, 0.3541213951363e+01, 0.3332657872986e+02,\n      0.1535988291188e-08, 0.4031094072151e+01, 0.3852657435933e+02,\n      0.1593193738177e-08, 0.4185136203609e+01, 0.2282781046519e+03,\n      0.1074569126382e-08, 0.1720485636868e+01, 0.8397383534231e+02,\n\n      0.1074408214509e-08, 0.2758613420318e+01, 0.8401985929482e+02,\n      0.9700199670465e-09, 0.4216686842097e+01, 0.7826370942180e+02,\n      0.1258433517061e-08, 0.2575068876639e+00, 0.3115650189215e+03,\n      0.1240303229539e-08, 0.4800844956756e+00, 0.1784300471910e+03,\n      0.9018345948127e-09, 0.3896756361552e+00, 0.5886454391678e+02,\n      0.1135301432805e-08, 0.3700805023550e+00, 0.7842370451713e+02,\n      0.9215887951370e-09, 0.4364579276638e+01, 0.1014262087719e+03,\n      0.1055401054147e-08, 0.2156564222111e+01, 0.5660027930059e+02,\n      0.1008725979831e-08, 0.5454015785234e+01, 0.4245678405627e+02,\n      0.7217398104321e-09, 0.1597772562175e+01, 0.2457074661053e+03,\n\n      0.6912033134447e-09, 0.5824090621461e+01, 0.1679936946371e+03,\n      0.6833881523549e-09, 0.3578778482835e+01, 0.6053048899753e+02,\n      0.4887304205142e-09, 0.3724362812423e+01, 0.9656299901946e+02,\n      0.5173709754788e-09, 0.5422427507933e+01, 0.2442876000072e+03,\n      0.4671353097145e-09, 0.2396106924439e+01, 0.1435713242844e+03,\n      0.5652608439480e-09, 0.2804028838685e+01, 0.8365903305582e+02,\n      0.5604061331253e-09, 0.1638816006247e+01, 0.8433466158131e+02,\n      0.4712723365400e-09, 0.8979003224474e+00, 0.3164282286739e+03,\n      0.4909967465112e-09, 0.3210426725516e+01, 0.4059982187939e+03,\n      0.4771358267658e-09, 0.5308027211629e+01, 0.1805255418145e+03,\n\n      0.3943451445989e-09, 0.2195145341074e+01, 0.2568537517081e+03,\n      0.3952109120244e-09, 0.5081189491586e+01, 0.2449975330562e+03,\n      0.3788134594789e-09, 0.4345171264441e+01, 0.1568131045107e+03,\n      0.3738330190479e-09, 0.2613062847997e+01, 0.3948519331910e+03,\n      0.3099866678136e-09, 0.2846760817689e+01, 0.1547176098872e+03,\n      0.2002962716768e-09, 0.4921360989412e+01, 0.2268582385539e+03,\n      0.2198291338754e-09, 0.1130360117454e+00, 0.1658638954901e+03,\n      0.1491958330784e-09, 0.4228195232278e+01, 0.2219950288015e+03,\n      0.1475384076173e-09, 0.3005721811604e+00, 0.3052819430710e+03,\n      0.1661626624624e-09, 0.7830125621203e+00, 0.2526661704812e+03,\n\n      0.9015823460025e-10, 0.3807792942715e+01, 0.4171445043968e+03 };\n\n/* Sun-to-Earth, T^0, Y */\n   static const double e0y[] = {\n      0.9998921098898e+00, 0.1826583913846e+00, 0.6283075850446e+01,\n     -0.2442700893735e-01, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.8352929742915e-02, 0.1395277998680e+00, 0.1256615170089e+02,\n      0.1046697300177e-03, 0.9641423109763e-01, 0.1884922755134e+02,\n      0.3110841876663e-04, 0.5381140401712e+01, 0.8399684731857e+02,\n      0.2570269094593e-04, 0.5301016407128e+01, 0.5296909721118e+00,\n      0.2147389623610e-04, 0.2662510869850e+01, 0.1577343543434e+01,\n      0.1680344384050e-04, 0.5207904119704e+01, 0.6279552690824e+01,\n      0.1679117312193e-04, 0.4582187486968e+01, 0.6286599010068e+01,\n      0.1440512068440e-04, 0.1900688517726e+01, 0.2352866153506e+01,\n\n      0.1135139664999e-04, 0.5273108538556e+01, 0.5223693906222e+01,\n      0.9345482571018e-05, 0.4503047687738e+01, 0.1203646072878e+02,\n      0.9007418719568e-05, 0.1605621059637e+01, 0.1021328554739e+02,\n      0.5671536712314e-05, 0.5812849070861e+00, 0.1059381944224e+01,\n      0.7451401861666e-05, 0.2807346794836e+01, 0.3981490189893e+00,\n      0.6393470057114e-05, 0.6029224133855e+01, 0.5753384878334e+01,\n      0.6814275881697e-05, 0.6472990145974e+00, 0.4705732307012e+01,\n      0.6113705628887e-05, 0.3813843419700e+01, 0.6812766822558e+01,\n      0.4503851367273e-05, 0.4527804370996e+01, 0.5884926831456e+01,\n      0.4522249141926e-05, 0.5991783029224e+01, 0.6256777527156e+01,\n\n      0.4501794307018e-05, 0.3798703844397e+01, 0.6309374173736e+01,\n      0.5514927480180e-05, 0.3961257833388e+01, 0.5507553240374e+01,\n      0.4062862799995e-05, 0.5256247296369e+01, 0.6681224869435e+01,\n      0.5414900429712e-05, 0.5499032014097e+01, 0.7755226100720e+00,\n      0.5463153987424e-05, 0.6173092454097e+01, 0.1414349524433e+02,\n      0.5071611859329e-05, 0.2870244247651e+01, 0.7860419393880e+01,\n      0.2195112094455e-05, 0.2952338617201e+01, 0.1150676975667e+02,\n      0.2279139233919e-05, 0.5951775132933e+01, 0.7058598460518e+01,\n      0.2278386100876e-05, 0.4845456398785e+01, 0.4694002934110e+01,\n      0.2559088003308e-05, 0.6945321117311e+00, 0.1216800268190e+02,\n\n      0.2561079286856e-05, 0.6167224608301e+01, 0.7099330490126e+00,\n      0.1792755796387e-05, 0.1400122509632e+01, 0.7962980379786e+00,\n      0.1818715656502e-05, 0.4703347611830e+01, 0.6283142985870e+01,\n      0.1818744924791e-05, 0.5086748900237e+01, 0.6283008715021e+01,\n      0.1554518791390e-05, 0.5331008042713e-01, 0.2513230340178e+02,\n      0.2063265737239e-05, 0.4283680484178e+01, 0.1179062909082e+02,\n      0.1497613520041e-05, 0.6074207826073e+01, 0.5486777812467e+01,\n      0.2000617940427e-05, 0.2501426281450e+01, 0.1778984560711e+02,\n      0.1289731195580e-05, 0.3646340599536e+01, 0.7079373888424e+01,\n      0.1282657998934e-05, 0.3232864804902e+01, 0.3738761453707e+01,\n\n      0.1528915968658e-05, 0.5581433416669e+01, 0.2132990797783e+00,\n      0.1187304098432e-05, 0.5453576453694e+01, 0.9437762937313e+01,\n      0.7842782928118e-06, 0.2823953922273e+00, 0.8827390247185e+01,\n      0.7352892280868e-06, 0.1124369580175e+01, 0.1589072916335e+01,\n      0.6570189360797e-06, 0.2089154042840e+01, 0.1176985366291e+02,\n      0.6324967590410e-06, 0.6704855581230e+00, 0.6262300422539e+01,\n      0.6298289872283e-06, 0.2836414855840e+01, 0.6303851278352e+01,\n      0.6476686465855e-06, 0.4852433866467e+00, 0.7113454667900e-02,\n      0.8587034651234e-06, 0.1453511005668e+01, 0.1672837615881e+03,\n      0.8068948788113e-06, 0.9224087798609e+00, 0.6069776770667e+01,\n\n      0.8353786011661e-06, 0.4631707184895e+01, 0.3340612434717e+01,\n      0.6009324532132e-06, 0.1829498827726e+01, 0.4136910472696e+01,\n      0.7558158559566e-06, 0.2588596800317e+01, 0.6496374930224e+01,\n      0.5809279504503e-06, 0.5516818853476e+00, 0.1097707878456e+02,\n      0.5374131950254e-06, 0.6275674734960e+01, 0.1194447056968e+01,\n      0.5711160507326e-06, 0.1091905956872e+01, 0.6282095334605e+01,\n      0.5710183170746e-06, 0.2415001635090e+01, 0.6284056366286e+01,\n      0.5144373590610e-06, 0.6020336443438e+01, 0.6290189305114e+01,\n      0.5103108927267e-06, 0.3775634564605e+01, 0.6275962395778e+01,\n      0.4960654697891e-06, 0.1073450946756e+01, 0.6127655567643e+01,\n\n      0.4786385689280e-06, 0.2431178012310e+01, 0.6438496133249e+01,\n      0.6109911263665e-06, 0.5343356157914e+01, 0.3154687086868e+01,\n      0.4839898944024e-06, 0.5830833594047e-01, 0.8018209333619e+00,\n      0.4734822623919e-06, 0.4536080134821e+01, 0.3128388763578e+01,\n      0.4834741473290e-06, 0.2585090489754e+00, 0.7084896783808e+01,\n      0.5134858581156e-06, 0.4213317172603e+01, 0.1235285262111e+02,\n      0.5064004264978e-06, 0.4814418806478e+00, 0.1185621865188e+02,\n      0.3753476772761e-06, 0.1599953399788e+01, 0.8429241228195e+01,\n      0.4935264014283e-06, 0.2157417556873e+01, 0.2544314396739e+01,\n      0.3950929600897e-06, 0.3359394184254e+01, 0.5481254917084e+01,\n\n      0.4895849789777e-06, 0.5165704376558e+01, 0.9225539266174e+01,\n      0.4215241688886e-06, 0.2065368800993e+01, 0.1726015463500e+02,\n      0.3796773731132e-06, 0.1468606346612e+01, 0.4265981595566e+00,\n      0.3114178142515e-06, 0.3615638079474e+01, 0.2146165377750e+01,\n      0.3260664220838e-06, 0.4417134922435e+01, 0.4164311961999e+01,\n      0.3976996123008e-06, 0.4700866883004e+01, 0.5856477690889e+01,\n      0.2801459672924e-06, 0.4538902060922e+01, 0.1256967486051e+02,\n      0.3638931868861e-06, 0.1334197991475e+01, 0.1807370494127e+02,\n      0.2487013269476e-06, 0.3749275558275e+01, 0.2629832328990e-01,\n      0.3034165481994e-06, 0.4236622030873e+00, 0.4535059491685e+01,\n\n      0.2676278825586e-06, 0.5970848007811e+01, 0.3930209696940e+01,\n      0.2764903818918e-06, 0.5194636754501e+01, 0.1256262854127e+02,\n      0.2485149930507e-06, 0.1002434207846e+01, 0.5088628793478e+01,\n      0.2199305540941e-06, 0.3066773098403e+01, 0.1255903824622e+02,\n      0.2571106500435e-06, 0.7588312459063e+00, 0.1336797263425e+02,\n      0.2049751817158e-06, 0.3444977434856e+01, 0.1137170464392e+02,\n      0.2599707296297e-06, 0.1873128542205e+01, 0.7143069561767e+02,\n      0.1785018072217e-06, 0.5015891306615e+01, 0.1748016358760e+01,\n      0.2324833891115e-06, 0.4618271239730e+01, 0.1831953657923e+02,\n      0.1709711119545e-06, 0.5300003455669e+01, 0.4933208510675e+01,\n\n      0.2107159351716e-06, 0.2229819815115e+01, 0.7477522907414e+01,\n      0.1750333080295e-06, 0.6161485880008e+01, 0.1044738781244e+02,\n      0.2000598210339e-06, 0.2967357299999e+01, 0.8031092209206e+01,\n      0.1380920248681e-06, 0.3027007923917e+01, 0.8635942003952e+01,\n      0.1412460470299e-06, 0.6037597163798e+01, 0.2942463415728e+01,\n      0.1888459803001e-06, 0.8561476243374e+00, 0.1561374759853e+03,\n      0.1788370542585e-06, 0.4869736290209e+01, 0.1592596075957e+01,\n      0.1360893296167e-06, 0.3626411886436e+01, 0.1309584267300e+02,\n      0.1506846530160e-06, 0.1550975377427e+01, 0.1649636139783e+02,\n      0.1800913376176e-06, 0.2075826033190e+01, 0.1729818233119e+02,\n\n      0.1436261390649e-06, 0.6148876420255e+01, 0.2042657109477e+02,\n      0.1220227114151e-06, 0.4382583879906e+01, 0.7632943190217e+01,\n      0.1337883603592e-06, 0.2036644327361e+01, 0.1213955354133e+02,\n      0.1159326650738e-06, 0.3892276994687e+01, 0.5331357529664e+01,\n      0.1352853128569e-06, 0.1447950649744e+01, 0.1673046366289e+02,\n      0.1433408296083e-06, 0.4457854692961e+01, 0.7342457794669e+01,\n      0.1234701666518e-06, 0.1538818147151e+01, 0.6279485555400e+01,\n      0.1234027192007e-06, 0.1968523220760e+01, 0.6286666145492e+01,\n      0.1244024091797e-06, 0.5779803499985e+01, 0.1511046609763e+02,\n      0.1097934945516e-06, 0.6210975221388e+00, 0.1098880815746e+02,\n\n      0.1254611329856e-06, 0.2591963807998e+01, 0.1572083878776e+02,\n      0.1158247286784e-06, 0.2483612812670e+01, 0.5729506548653e+01,\n      0.9039078252960e-07, 0.3857554579796e+01, 0.9623688285163e+01,\n      0.9108024978836e-07, 0.5826368512984e+01, 0.7234794171227e+01,\n      0.8887068108436e-07, 0.3475694573987e+01, 0.6148010737701e+01,\n      0.8632374035438e-07, 0.3059070488983e-01, 0.6418140963190e+01,\n      0.7893186992967e-07, 0.1583194837728e+01, 0.2118763888447e+01,\n      0.8297650201172e-07, 0.8519770534637e+00, 0.1471231707864e+02,\n      0.1019759578988e-06, 0.1319598738732e+00, 0.1349867339771e+01,\n      0.1010037696236e-06, 0.9937860115618e+00, 0.6836645152238e+01,\n\n      0.1047727548266e-06, 0.1382138405399e+01, 0.5999216516294e+01,\n      0.7351993881086e-07, 0.3833397851735e+01, 0.6040347114260e+01,\n      0.9868771092341e-07, 0.2124913814390e+01, 0.6566935184597e+01,\n      0.7007321959390e-07, 0.5946305343763e+01, 0.6525804586632e+01,\n      0.6861411679709e-07, 0.4574654977089e+01, 0.7238675589263e+01,\n      0.7554519809614e-07, 0.5949232686844e+01, 0.1253985337760e+02,\n      0.9541880448335e-07, 0.3495242990564e+01, 0.2122839202813e+02,\n      0.7185606722155e-07, 0.4310113471661e+01, 0.6245048154254e+01,\n      0.7131360871710e-07, 0.5480309323650e+01, 0.6321103546637e+01,\n      0.6651142021039e-07, 0.5411097713654e+01, 0.5327476111629e+01,\n\n      0.8538618213667e-07, 0.1827849973951e+01, 0.1101510648075e+02,\n      0.8634954288044e-07, 0.5443584943349e+01, 0.5643178611111e+01,\n      0.7449415051484e-07, 0.2011535459060e+01, 0.5368044267797e+00,\n      0.7421047599169e-07, 0.3464562529249e+01, 0.2354323048545e+02,\n      0.6140694354424e-07, 0.5657556228815e+01, 0.1296430071988e+02,\n      0.6353525143033e-07, 0.3463816593821e+01, 0.1990745094947e+01,\n      0.6221964013447e-07, 0.1532259498697e+01, 0.9517183207817e+00,\n      0.5852480257244e-07, 0.1375396598875e+01, 0.9555997388169e+00,\n      0.6398637498911e-07, 0.2405645801972e+01, 0.2407292145756e+02,\n      0.7039744069878e-07, 0.5397541799027e+01, 0.5225775174439e+00,\n\n      0.6977997694382e-07, 0.4762347105419e+01, 0.1097355562493e+02,\n      0.7460629558396e-07, 0.2711944692164e+01, 0.2200391463820e+02,\n      0.5376577536101e-07, 0.2352980430239e+01, 0.1431416805965e+02,\n      0.7530607893556e-07, 0.1943940180699e+01, 0.1842262939178e+02,\n      0.6822928971605e-07, 0.4337651846959e+01, 0.1554202828031e+00,\n      0.6220772380094e-07, 0.6716871369278e+00, 0.1845107853235e+02,\n      0.6586950799043e-07, 0.2229714460505e+01, 0.5216580451554e+01,\n      0.5873800565771e-07, 0.7627013920580e+00, 0.6398972393349e+00,\n      0.6264346929745e-07, 0.6202785478961e+00, 0.6277552955062e+01,\n      0.6257929115669e-07, 0.2886775596668e+01, 0.6288598745829e+01,\n\n      0.5343536033409e-07, 0.1977241012051e+01, 0.4690479774488e+01,\n      0.5587849781714e-07, 0.1922923484825e+01, 0.1551045220144e+01,\n      0.6905100845603e-07, 0.3570757164631e+01, 0.1030928125552e+00,\n      0.6178957066649e-07, 0.5197558947765e+01, 0.5230807360890e+01,\n      0.6187270224331e-07, 0.8193497368922e+00, 0.5650292065779e+01,\n      0.5385664291426e-07, 0.5406336665586e+01, 0.7771377146812e+02,\n      0.6329363917926e-07, 0.2837760654536e+01, 0.2608790314060e+02,\n      0.4546018761604e-07, 0.2933580297050e+01, 0.5535693017924e+00,\n      0.6196091049375e-07, 0.4157871494377e+01, 0.8467247584405e+02,\n      0.6159555108218e-07, 0.3211703561703e+01, 0.2394243902548e+03,\n\n      0.4995340539317e-07, 0.1459098102922e+01, 0.4732030630302e+01,\n      0.5457031243572e-07, 0.1430457676136e+01, 0.6179983037890e+01,\n      0.4863461418397e-07, 0.2196425916730e+01, 0.9027992316901e+02,\n      0.5342947626870e-07, 0.2086612890268e+01, 0.6386168663001e+01,\n      0.5674296648439e-07, 0.2760204966535e+01, 0.6915859635113e+01,\n      0.4745783120161e-07, 0.4245368971862e+01, 0.6282970628506e+01,\n      0.4745676961198e-07, 0.5544725787016e+01, 0.6283181072386e+01,\n      0.4049796869973e-07, 0.2213984363586e+01, 0.6254626709878e+01,\n      0.4248333596940e-07, 0.8075781952896e+00, 0.7875671926403e+01,\n      0.4027178070205e-07, 0.1293268540378e+01, 0.6311524991013e+01,\n\n      0.4066543943476e-07, 0.3986141175804e+01, 0.3634620989887e+01,\n      0.4858863787880e-07, 0.1276112738231e+01, 0.5760498333002e+01,\n      0.5277398263530e-07, 0.4916111741527e+01, 0.2515860172507e+02,\n      0.4105635656559e-07, 0.1725805864426e+01, 0.6709674010002e+01,\n      0.4376781925772e-07, 0.2243642442106e+01, 0.6805653367890e+01,\n      0.3235827894693e-07, 0.3614135118271e+01, 0.1066495398892e+01,\n      0.3073244740308e-07, 0.2460873393460e+01, 0.5863591145557e+01,\n      0.3088609271373e-07, 0.5678431771790e+01, 0.9917696840332e+01,\n      0.3393022279836e-07, 0.3814017477291e+01, 0.1391601904066e+02,\n      0.3038686508802e-07, 0.4660216229171e+01, 0.1256621883632e+02,\n\n      0.4019677752497e-07, 0.5906906243735e+01, 0.1334167431096e+02,\n      0.3288834998232e-07, 0.9536146445882e+00, 0.1620077269078e+02,\n      0.3889973794631e-07, 0.3942205097644e+01, 0.7478166569050e-01,\n      0.3050438987141e-07, 0.1624810271286e+01, 0.1805292951336e+02,\n      0.3601142564638e-07, 0.4030467142575e+01, 0.6208294184755e+01,\n      0.3689015557141e-07, 0.3648878818694e+01, 0.5966683958112e+01,\n      0.3563471893565e-07, 0.5749584017096e+01, 0.6357857516136e+01,\n      0.2776183170667e-07, 0.2630124187070e+01, 0.3523159621801e-02,\n      0.2922350530341e-07, 0.1790346403629e+01, 0.1272157198369e+02,\n      0.3511076917302e-07, 0.6142198301611e+01, 0.6599467742779e+01,\n\n      0.3619351007632e-07, 0.1432421386492e+01, 0.6019991944201e+01,\n      0.2561254711098e-07, 0.2302822475792e+01, 0.1259245002418e+02,\n      0.2626903942920e-07, 0.8660470994571e+00, 0.6702560555334e+01,\n      0.2550187397083e-07, 0.6069721995383e+01, 0.1057540660594e+02,\n      0.2535873526138e-07, 0.1079020331795e-01, 0.3141537925223e+02,\n      0.3519786153847e-07, 0.3809066902283e+01, 0.2505706758577e+03,\n      0.3424651492873e-07, 0.2075435114417e+01, 0.6546159756691e+01,\n      0.2372676630861e-07, 0.2057803120154e+01, 0.2388894113936e+01,\n      0.2710980779541e-07, 0.1510068488010e+01, 0.1202934727411e+02,\n      0.3038710889704e-07, 0.5043617528901e+01, 0.1256608456547e+02,\n\n      0.2220364130585e-07, 0.3694793218205e+01, 0.1336244973887e+02,\n      0.3025880825460e-07, 0.5450618999049e-01, 0.2908881142201e+02,\n      0.2784493486864e-07, 0.3381164084502e+01, 0.1494531617769e+02,\n      0.2294414142438e-07, 0.4382309025210e+01, 0.6076890225335e+01,\n      0.2012723294724e-07, 0.9142212256518e+00, 0.6262720680387e+01,\n      0.2036357831958e-07, 0.5676172293154e+01, 0.4701116388778e+01,\n      0.2003474823288e-07, 0.2592767977625e+01, 0.6303431020504e+01,\n      0.2207144900109e-07, 0.5404976271180e+01, 0.6489261475556e+01,\n      0.2481664905135e-07, 0.4373284587027e+01, 0.1204357418345e+02,\n      0.2674949182295e-07, 0.5859182188482e+01, 0.4590910121555e+01,\n\n      0.2450554720322e-07, 0.4555381557451e+01, 0.1495633313810e+00,\n      0.2601975986457e-07, 0.3933165584959e+01, 0.1965104848470e+02,\n      0.2199860022848e-07, 0.5227977189087e+01, 0.1351787002167e+02,\n      0.2448121172316e-07, 0.4858060353949e+01, 0.1162474756779e+01,\n      0.1876014864049e-07, 0.5690546553605e+01, 0.6279194432410e+01,\n      0.1874513219396e-07, 0.4099539297446e+01, 0.6286957268481e+01,\n      0.2156380842559e-07, 0.4382594769913e+00, 0.1813929450232e+02,\n      0.1981691240061e-07, 0.1829784152444e+01, 0.4686889479442e+01,\n      0.2329992648539e-07, 0.2836254278973e+01, 0.1002183730415e+02,\n      0.1765184135302e-07, 0.2803494925833e+01, 0.4292330755499e+01,\n\n      0.2436368366085e-07, 0.2836897959677e+01, 0.9514313292143e+02,\n      0.2164089203889e-07, 0.6127522446024e+01, 0.6037244212485e+01,\n      0.1847755034221e-07, 0.3683163635008e+01, 0.2427287361862e+00,\n      0.1674798769966e-07, 0.3316993867246e+00, 0.1311972100268e+02,\n      0.2222542124356e-07, 0.8294097805480e+00, 0.1266924451345e+02,\n      0.2071074505925e-07, 0.3659492220261e+01, 0.6528907488406e+01,\n      0.1608224471835e-07, 0.4774492067182e+01, 0.1352175143971e+02,\n      0.1857583439071e-07, 0.2873120597682e+01, 0.8662240327241e+01,\n      0.1793018836159e-07, 0.5282441177929e+00, 0.6819880277225e+01,\n      0.1575391221692e-07, 0.1320789654258e+01, 0.1102062672231e+00,\n\n      0.1840132009557e-07, 0.1917110916256e+01, 0.6514761976723e+02,\n      0.1760917288281e-07, 0.2972635937132e+01, 0.5746271423666e+01,\n      0.1561779518516e-07, 0.4372569261981e+01, 0.6272439236156e+01,\n      0.1558687885205e-07, 0.5416424926425e+01, 0.6293712464735e+01,\n      0.1951359382579e-07, 0.3094448898752e+01, 0.2301353951334e+02,\n      0.1569144275614e-07, 0.2802103689808e+01, 0.1765478049437e+02,\n      0.1479130389462e-07, 0.2136435020467e+01, 0.2077542790660e-01,\n      0.1467828510764e-07, 0.7072627435674e+00, 0.1052268489556e+01,\n      0.1627627337440e-07, 0.3947607143237e+01, 0.6327837846670e+00,\n      0.1503498479758e-07, 0.4079248909190e+01, 0.7626583626240e-01,\n\n      0.1297967708237e-07, 0.6269637122840e+01, 0.1149965630200e+02,\n      0.1374416896634e-07, 0.4175657970702e+01, 0.6016468784579e+01,\n      0.1783812325219e-07, 0.1476540547560e+01, 0.3301902111895e+02,\n      0.1525884228756e-07, 0.4653477715241e+01, 0.9411464614024e+01,\n      0.1451067396763e-07, 0.2573001128225e+01, 0.1277945078067e+02,\n      0.1297713111950e-07, 0.5612799618771e+01, 0.6549682916313e+01,\n      0.1462784012820e-07, 0.4189661623870e+01, 0.1863592847156e+02,\n      0.1384185980007e-07, 0.2656915472196e+01, 0.2379164476796e+01,\n      0.1221497599801e-07, 0.5612515760138e+01, 0.1257326515556e+02,\n      0.1560574525896e-07, 0.4783414317919e+01, 0.1887552587463e+02,\n\n      0.1544598372036e-07, 0.2694431138063e+01, 0.1820933031200e+02,\n      0.1531678928696e-07, 0.4105103489666e+01, 0.2593412433514e+02,\n      0.1349321503795e-07, 0.3082437194015e+00, 0.5120601093667e+01,\n      0.1252030290917e-07, 0.6124072334087e+01, 0.6993008899458e+01,\n      0.1459243816687e-07, 0.3733103981697e+01, 0.3813291813120e-01,\n      0.1226103625262e-07, 0.1267127706817e+01, 0.2435678079171e+02,\n      0.1019449641504e-07, 0.4367790112269e+01, 0.1725663147538e+02,\n      0.1380789433607e-07, 0.3387201768700e+01, 0.2458316379602e+00,\n      0.1019453421658e-07, 0.9204143073737e+00, 0.6112403035119e+01,\n      0.1297929434405e-07, 0.5786874896426e+01, 0.1249137003520e+02,\n\n      0.9912677786097e-08, 0.3164232870746e+01, 0.6247047890016e+01,\n      0.9829386098599e-08, 0.2586762413351e+01, 0.6453748665772e+01,\n      0.1226807746104e-07, 0.6239068436607e+01, 0.5429879531333e+01,\n      0.1192691755997e-07, 0.1867380051424e+01, 0.6290122169689e+01,\n      0.9836499227081e-08, 0.3424716293727e+00, 0.6319103810876e+01,\n      0.9642862564285e-08, 0.5661372990657e+01, 0.8273820945392e+01,\n      0.1165184404862e-07, 0.5768367239093e+01, 0.1778273215245e+02,\n      0.1175794418818e-07, 0.1657351222943e+01, 0.6276029531202e+01,\n      0.1018948635601e-07, 0.6458292350865e+00, 0.1254537627298e+02,\n      0.9500383606676e-08, 0.1054306140741e+01, 0.1256517118505e+02,\n\n      0.1227512202906e-07, 0.2505278379114e+01, 0.2248384854122e+02,\n      0.9664792009993e-08, 0.4289737277000e+01, 0.6259197520765e+01,\n      0.9613285666331e-08, 0.5500597673141e+01, 0.6306954180126e+01,\n      0.1117906736211e-07, 0.2361405953468e+01, 0.1779695906178e+02,\n      0.9611378640782e-08, 0.2851310576269e+01, 0.2061856251104e+00,\n      0.8845354852370e-08, 0.6208777705343e+01, 0.1692165728891e+01,\n      0.1054046966600e-07, 0.5413091423934e+01, 0.2204125344462e+00,\n      0.1215539124483e-07, 0.5613969479755e+01, 0.8257698122054e+02,\n      0.9932460955209e-08, 0.1106124877015e+01, 0.1017725758696e+02,\n      0.8785804715043e-08, 0.2869224476477e+01, 0.9491756770005e+00,\n\n      0.8538084097562e-08, 0.6159640899344e+01, 0.6393282117669e+01,\n      0.8648994369529e-08, 0.1374901198784e+01, 0.4804209201333e+01,\n      0.1039063219067e-07, 0.5171080641327e+01, 0.1550861511662e+02,\n      0.8867983926439e-08, 0.8317320304902e+00, 0.3903911373650e+01,\n      0.8327495955244e-08, 0.3605591969180e+01, 0.6172869583223e+01,\n      0.9243088356133e-08, 0.6114299196843e+01, 0.6267823317922e+01,\n      0.9205657357835e-08, 0.3675153683737e+01, 0.6298328382969e+01,\n      0.1033269714606e-07, 0.3313328813024e+01, 0.5573142801433e+01,\n      0.8001706275552e-08, 0.2019980960053e+01, 0.2648454860559e+01,\n      0.9171858254191e-08, 0.8992015524177e+00, 0.1498544001348e+03,\n\n      0.1075327150242e-07, 0.2898669963648e+01, 0.3694923081589e+02,\n      0.9884866689828e-08, 0.4946715904478e+01, 0.1140367694411e+02,\n      0.9541835576677e-08, 0.2371787888469e+01, 0.1256713221673e+02,\n      0.7739903376237e-08, 0.2213775190612e+01, 0.7834121070590e+01,\n      0.7311962684106e-08, 0.3429378787739e+01, 0.1192625446156e+02,\n      0.9724904869624e-08, 0.6195878564404e+01, 0.2280573557157e+02,\n      0.9251628983612e-08, 0.6511509527390e+00, 0.2787043132925e+01,\n      0.7320763787842e-08, 0.6001083639421e+01, 0.6282655592598e+01,\n      0.7320296650962e-08, 0.3789073265087e+01, 0.6283496108294e+01,\n      0.7947032271039e-08, 0.1059659582204e+01, 0.1241073141809e+02,\n\n      0.9005277053115e-08, 0.1280315624361e+01, 0.6281591679874e+01,\n      0.8995601652048e-08, 0.2224439106766e+01, 0.6284560021018e+01,\n      0.8288040568796e-08, 0.5234914433867e+01, 0.1241658836951e+02,\n      0.6359381347255e-08, 0.4137989441490e+01, 0.1596186371003e+01,\n      0.8699572228626e-08, 0.1758411009497e+01, 0.6133512519065e+01,\n      0.6456797542736e-08, 0.5919285089994e+01, 0.1685848245639e+02,\n      0.7424573475452e-08, 0.5414616938827e+01, 0.4061219149443e+01,\n      0.7235671196168e-08, 0.1496516557134e+01, 0.1610006857377e+03,\n      0.8104015182733e-08, 0.1919918242764e+01, 0.8460828644453e+00,\n      0.8098576535937e-08, 0.3819615855458e+01, 0.3894181736510e+01,\n\n      0.6275292346625e-08, 0.6244264115141e+01, 0.8531963191132e+00,\n      0.6052432989112e-08, 0.5037731872610e+00, 0.1567108171867e+02,\n      0.5705651535817e-08, 0.2984557271995e+01, 0.1258692712880e+02,\n      0.5789650115138e-08, 0.6087038140697e+01, 0.1193336791622e+02,\n      0.5512132153377e-08, 0.5855668994076e+01, 0.1232342296471e+02,\n      0.7388890819102e-08, 0.2443128574740e+01, 0.4907302013889e+01,\n      0.5467593991798e-08, 0.3017561234194e+01, 0.1884211409667e+02,\n      0.6388519802999e-08, 0.5887386712935e+01, 0.5217580628120e+02,\n      0.6106777149944e-08, 0.3483461059895e+00, 0.1422690933580e-01,\n      0.7383420275489e-08, 0.5417387056707e+01, 0.2358125818164e+02,\n\n      0.5505208141738e-08, 0.2848193644783e+01, 0.1151388321134e+02,\n      0.6310757462877e-08, 0.2349882520828e+01, 0.1041998632314e+02,\n      0.6166904929691e-08, 0.5728575944077e+00, 0.6151533897323e+01,\n      0.5263442042754e-08, 0.4495796125937e+01, 0.1885275071096e+02,\n      0.5591828082629e-08, 0.1355441967677e+01, 0.4337116142245e+00,\n      0.5397051680497e-08, 0.1673422864307e+01, 0.6286362197481e+01,\n      0.5396992745159e-08, 0.1833502206373e+01, 0.6279789503410e+01,\n      0.6572913000726e-08, 0.3331122065824e+01, 0.1176433076753e+02,\n      0.5123421866413e-08, 0.2165327142679e+01, 0.1245594543367e+02,\n      0.5930495725999e-08, 0.2931146089284e+01, 0.6414617803568e+01,\n\n      0.6431797403933e-08, 0.4134407994088e+01, 0.1350651127443e+00,\n      0.5003182207604e-08, 0.3805420303749e+01, 0.1096996532989e+02,\n      0.5587731032504e-08, 0.1082469260599e+01, 0.6062663316000e+01,\n      0.5935263407816e-08, 0.8384333678401e+00, 0.5326786718777e+01,\n      0.4756019827760e-08, 0.3552588749309e+01, 0.3104930017775e+01,\n      0.6599951172637e-08, 0.4320826409528e+01, 0.4087944051283e+02,\n      0.5902606868464e-08, 0.4811879454445e+01, 0.5849364236221e+01,\n      0.5921147809031e-08, 0.9942628922396e-01, 0.1581959461667e+01,\n      0.5505382581266e-08, 0.2466557607764e+01, 0.6503488384892e+01,\n      0.5353771071862e-08, 0.4551978748683e+01, 0.1735668374386e+03,\n\n      0.5063282210946e-08, 0.5710812312425e+01, 0.1248988586463e+02,\n      0.5926120403383e-08, 0.1333998428358e+01, 0.2673594526851e+02,\n      0.5211016176149e-08, 0.4649315360760e+01, 0.2460261242967e+02,\n      0.5347075084894e-08, 0.5512754081205e+01, 0.4171425416666e+01,\n      0.4872609773574e-08, 0.1308025299938e+01, 0.5333900173445e+01,\n      0.4727711321420e-08, 0.2144908368062e+01, 0.7232251527446e+01,\n      0.6029426018652e-08, 0.5567259412084e+01, 0.3227113045244e+03,\n      0.4321485284369e-08, 0.5230667156451e+01, 0.9388005868221e+01,\n      0.4476406760553e-08, 0.6134081115303e+01, 0.5547199253223e+01,\n      0.5835268277420e-08, 0.4783808492071e+01, 0.7285056171570e+02,\n\n      0.5172183602748e-08, 0.5161817911099e+01, 0.1884570439172e+02,\n      0.5693571465184e-08, 0.1381646203111e+01, 0.9723862754494e+02,\n      0.4060634965349e-08, 0.3876705259495e+00, 0.4274518229222e+01,\n      0.3967398770473e-08, 0.5029491776223e+01, 0.3496032717521e+01,\n      0.3943754005255e-08, 0.1923162955490e+01, 0.6244942932314e+01,\n      0.4781323427824e-08, 0.4633332586423e+01, 0.2929661536378e+02,\n      0.3871483781204e-08, 0.1616650009743e+01, 0.6321208768577e+01,\n      0.5141741733997e-08, 0.9817316704659e-01, 0.1232032006293e+02,\n      0.4002385978497e-08, 0.3656161212139e+01, 0.7018952447668e+01,\n      0.4901092604097e-08, 0.4404098713092e+01, 0.1478866649112e+01,\n\n      0.3740932630345e-08, 0.5181188732639e+00, 0.6922973089781e+01,\n      0.4387283718538e-08, 0.3254859566869e+01, 0.2331413144044e+03,\n      0.5019197802033e-08, 0.3086773224677e+01, 0.1715706182245e+02,\n      0.3834931695175e-08, 0.2797882673542e+01, 0.1491901785440e+02,\n      0.3760413942497e-08, 0.2892676280217e+01, 0.1726726808967e+02,\n      0.3719717204628e-08, 0.5861046025739e+01, 0.6297302759782e+01,\n      0.4145623530149e-08, 0.2168239627033e+01, 0.1376059875786e+02,\n      0.3932788425380e-08, 0.6271811124181e+01, 0.7872148766781e+01,\n      0.3686377476857e-08, 0.3936853151404e+01, 0.6268848941110e+01,\n      0.3779077950339e-08, 0.1404148734043e+01, 0.4157198507331e+01,\n\n      0.4091334550598e-08, 0.2452436180854e+01, 0.9779108567966e+01,\n      0.3926694536146e-08, 0.6102292739040e+01, 0.1098419223922e+02,\n      0.4841000253289e-08, 0.6072760457276e+01, 0.1252801878276e+02,\n      0.4949340130240e-08, 0.1154832815171e+01, 0.1617106187867e+03,\n      0.3761557737360e-08, 0.5527545321897e+01, 0.3185192151914e+01,\n      0.3647396268188e-08, 0.1525035688629e+01, 0.6271346477544e+01,\n      0.3932405074189e-08, 0.5570681040569e+01, 0.2139354194808e+02,\n      0.3631322501141e-08, 0.1981240601160e+01, 0.6294805223347e+01,\n      0.4130007425139e-08, 0.2050060880201e+01, 0.2195415756911e+02,\n      0.4433905965176e-08, 0.3277477970321e+01, 0.7445550607224e+01,\n\n      0.3851814176947e-08, 0.5210690074886e+01, 0.9562891316684e+00,\n      0.3485807052785e-08, 0.6653274904611e+00, 0.1161697602389e+02,\n      0.3979772816991e-08, 0.1767941436148e+01, 0.2277943724828e+02,\n      0.3402607460500e-08, 0.3421746306465e+01, 0.1087398597200e+02,\n      0.4049993000926e-08, 0.1127144787547e+01, 0.3163918923335e+00,\n      0.3420511182382e-08, 0.4214794779161e+01, 0.1362553364512e+02,\n      0.3640772365012e-08, 0.5324905497687e+01, 0.1725304118033e+02,\n      0.3323037987501e-08, 0.6135761838271e+01, 0.6279143387820e+01,\n      0.4503141663637e-08, 0.1802305450666e+01, 0.1385561574497e+01,\n      0.4314560055588e-08, 0.4812299731574e+01, 0.4176041334900e+01,\n\n      0.3294226949110e-08, 0.3657547059723e+01, 0.6287008313071e+01,\n      0.3215657197281e-08, 0.4866676894425e+01, 0.5749861718712e+01,\n      0.4129362656266e-08, 0.3809342558906e+01, 0.5905702259363e+01,\n      0.3137762976388e-08, 0.2494635174443e+01, 0.2099539292909e+02,\n      0.3514010952384e-08, 0.2699961831678e+01, 0.7335344340001e+01,\n      0.3327607571530e-08, 0.3318457714816e+01, 0.5436992986000e+01,\n      0.3541066946675e-08, 0.4382703582466e+01, 0.1234573916645e+02,\n      0.3216179847052e-08, 0.5271066317054e+01, 0.3802769619140e-01,\n      0.2959045059570e-08, 0.5819591585302e+01, 0.2670964694522e+02,\n      0.3884040326665e-08, 0.5980934960428e+01, 0.6660449441528e+01,\n\n      0.2922027539886e-08, 0.3337290282483e+01, 0.1375773836557e+01,\n      0.4110846382042e-08, 0.5742978187327e+01, 0.4480965020977e+02,\n      0.2934508411032e-08, 0.2278075804200e+01, 0.6408777551755e+00,\n      0.3966896193000e-08, 0.5835747858477e+01, 0.3773735910827e+00,\n      0.3286695827610e-08, 0.5838898193902e+01, 0.3932462625300e-02,\n      0.3720643094196e-08, 0.1122212337858e+01, 0.1646033343740e+02,\n      0.3285508906174e-08, 0.9182250996416e+00, 0.1081813534213e+02,\n      0.3753880575973e-08, 0.5174761973266e+01, 0.5642198095270e+01,\n      0.3022129385587e-08, 0.3381611020639e+01, 0.2982630633589e+02,\n      0.2798569205621e-08, 0.3546193723922e+01, 0.1937891852345e+02,\n\n      0.3397872070505e-08, 0.4533203197934e+01, 0.6923953605621e+01,\n      0.3708099772977e-08, 0.2756168198616e+01, 0.3066615496545e+02,\n      0.3599283541510e-08, 0.1934395469918e+01, 0.6147450479709e+01,\n      0.3688702753059e-08, 0.7149920971109e+00, 0.2636725487657e+01,\n      0.2681084724003e-08, 0.4899819493154e+01, 0.6816289982179e+01,\n      0.3495993460759e-08, 0.1572418915115e+01, 0.6418701221183e+01,\n      0.3130770324995e-08, 0.8912190180489e+00, 0.1235996607578e+02,\n      0.2744353821941e-08, 0.3800821940055e+01, 0.2059724391010e+02,\n      0.2842732906341e-08, 0.2644717440029e+01, 0.2828699048865e+02,\n      0.3046882682154e-08, 0.3987793020179e+01, 0.6055599646783e+01,\n\n      0.2399072455143e-08, 0.9908826440764e+00, 0.6255674361143e+01,\n      0.2384306274204e-08, 0.2516149752220e+01, 0.6310477339748e+01,\n      0.2977324500559e-08, 0.5849195642118e+01, 0.1652265972112e+02,\n      0.3062835258972e-08, 0.1681660100162e+01, 0.1172006883645e+02,\n      0.3109682589231e-08, 0.5804143987737e+00, 0.2751146787858e+02,\n      0.2903920355299e-08, 0.5800768280123e+01, 0.6510552054109e+01,\n      0.2823221989212e-08, 0.9241118370216e+00, 0.5469525544182e+01,\n      0.3187949696649e-08, 0.3139776445735e+01, 0.1693792562116e+03,\n      0.2922559771655e-08, 0.3549440782984e+01, 0.2630839062450e+00,\n      0.2436302066603e-08, 0.4735540696319e+01, 0.3946258593675e+00,\n\n      0.3049473043606e-08, 0.4998289124561e+01, 0.8390110365991e+01,\n      0.2863682575784e-08, 0.6709515671102e+00, 0.2243449970715e+00,\n      0.2641750517966e-08, 0.5410978257284e+01, 0.2986433403208e+02,\n      0.2704093466243e-08, 0.4778317207821e+01, 0.6129297044991e+01,\n      0.2445522177011e-08, 0.6009020662222e+01, 0.1171295538178e+02,\n      0.2623608810230e-08, 0.5010449777147e+01, 0.6436854655901e+01,\n      0.2079259704053e-08, 0.5980943768809e+01, 0.2019909489111e+02,\n      0.2820225596771e-08, 0.2679965110468e+01, 0.5934151399930e+01,\n      0.2365221950927e-08, 0.1894231148810e+01, 0.2470570524223e+02,\n      0.2359682077149e-08, 0.4220752950780e+01, 0.8671969964381e+01,\n\n      0.2387577137206e-08, 0.2571783940617e+01, 0.7096626156709e+01,\n      0.1982102089816e-08, 0.5169765997119e+00, 0.1727188400790e+02,\n      0.2687502389925e-08, 0.6239078264579e+01, 0.7075506709219e+02,\n      0.2207751669135e-08, 0.2031184412677e+01, 0.4377611041777e+01,\n      0.2618370214274e-08, 0.8266079985979e+00, 0.6632000300961e+01,\n      0.2591951887361e-08, 0.8819350522008e+00, 0.4873985990671e+02,\n      0.2375055656248e-08, 0.3520944177789e+01, 0.1590676413561e+02,\n      0.2472019978911e-08, 0.1551431908671e+01, 0.6612329252343e+00,\n      0.2368157127199e-08, 0.4178610147412e+01, 0.3459636466239e+02,\n      0.1764846605693e-08, 0.1506764000157e+01, 0.1980094587212e+02,\n\n      0.2291769608798e-08, 0.2118250611782e+01, 0.2844914056730e-01,\n      0.2209997316943e-08, 0.3363255261678e+01, 0.2666070658668e+00,\n      0.2292699097923e-08, 0.4200423956460e+00, 0.1484170571900e-02,\n      0.1629683015329e-08, 0.2331362582487e+01, 0.3035599730800e+02,\n      0.2206492862426e-08, 0.3400274026992e+01, 0.6281667977667e+01,\n      0.2205746568257e-08, 0.1066051230724e+00, 0.6284483723224e+01,\n      0.2026310767991e-08, 0.2779066487979e+01, 0.2449240616245e+02,\n      0.1762977622163e-08, 0.9951450691840e+00, 0.2045286941806e+02,\n      0.1368535049606e-08, 0.6402447365817e+00, 0.2473415438279e+02,\n      0.1720598775450e-08, 0.2303524214705e+00, 0.1679593901136e+03,\n\n      0.1702429015449e-08, 0.6164622655048e+01, 0.3338575901272e+03,\n      0.1414033197685e-08, 0.3954561185580e+01, 0.1624205518357e+03,\n      0.1573768958043e-08, 0.2028286308984e+01, 0.3144167757552e+02,\n      0.1650705184447e-08, 0.2304040666128e+01, 0.5267006960365e+02,\n      0.1651087618855e-08, 0.2538461057280e+01, 0.8956999012000e+02,\n      0.1616409518983e-08, 0.5111054348152e+01, 0.3332657872986e+02,\n      0.1537175173581e-08, 0.5601130666603e+01, 0.3852657435933e+02,\n      0.1593191980553e-08, 0.2614340453411e+01, 0.2282781046519e+03,\n      0.1499480170643e-08, 0.3624721577264e+01, 0.2823723341956e+02,\n      0.1493807843235e-08, 0.4214569879008e+01, 0.2876692439167e+02,\n\n      0.1074571199328e-08, 0.1496911744704e+00, 0.8397383534231e+02,\n      0.1074406983417e-08, 0.1187817671922e+01, 0.8401985929482e+02,\n      0.9757576855851e-09, 0.2655703035858e+01, 0.7826370942180e+02,\n      0.1258432887565e-08, 0.4969896184844e+01, 0.3115650189215e+03,\n      0.1240336343282e-08, 0.5192460776926e+01, 0.1784300471910e+03,\n      0.9016107005164e-09, 0.1960356923057e+01, 0.5886454391678e+02,\n      0.1135392360918e-08, 0.5082427809068e+01, 0.7842370451713e+02,\n      0.9216046089565e-09, 0.2793775037273e+01, 0.1014262087719e+03,\n      0.1061276615030e-08, 0.3726144311409e+01, 0.5660027930059e+02,\n      0.1010110596263e-08, 0.7404080708937e+00, 0.4245678405627e+02,\n\n      0.7217424756199e-09, 0.2697449980577e-01, 0.2457074661053e+03,\n      0.6912003846756e-09, 0.4253296276335e+01, 0.1679936946371e+03,\n      0.6871814664847e-09, 0.5148072412354e+01, 0.6053048899753e+02,\n      0.4887158016343e-09, 0.2153581148294e+01, 0.9656299901946e+02,\n      0.5161802866314e-09, 0.3852750634351e+01, 0.2442876000072e+03,\n      0.5652599559057e-09, 0.1233233356270e+01, 0.8365903305582e+02,\n      0.4710812608586e-09, 0.5610486976767e+01, 0.3164282286739e+03,\n      0.4909977500324e-09, 0.1639629524123e+01, 0.4059982187939e+03,\n      0.4772641839378e-09, 0.3737100368583e+01, 0.1805255418145e+03,\n      0.4487562567153e-09, 0.1158417054478e+00, 0.8433466158131e+02,\n\n      0.3943441230497e-09, 0.6243502862796e+00, 0.2568537517081e+03,\n      0.3952236913598e-09, 0.3510377382385e+01, 0.2449975330562e+03,\n      0.3788898363417e-09, 0.5916128302299e+01, 0.1568131045107e+03,\n      0.3738329328831e-09, 0.1042266763456e+01, 0.3948519331910e+03,\n      0.2451199165151e-09, 0.1166788435700e+01, 0.1435713242844e+03,\n      0.2436734402904e-09, 0.3254726114901e+01, 0.2268582385539e+03,\n      0.2213605274325e-09, 0.1687210598530e+01, 0.1658638954901e+03,\n      0.1491521204829e-09, 0.2657541786794e+01, 0.2219950288015e+03,\n      0.1474995329744e-09, 0.5013089805819e+01, 0.3052819430710e+03,\n      0.1661939475656e-09, 0.5495315428418e+01, 0.2526661704812e+03,\n\n      0.9015946748003e-10, 0.2236989966505e+01, 0.4171445043968e+03 };\n\n/* Sun-to-Earth, T^0, Z */\n   static const double e0z[] = {\n      0.2796207639075e-05, 0.3198701560209e+01, 0.8433466158131e+02,\n      0.1016042198142e-05, 0.5422360395913e+01, 0.5507553240374e+01,\n      0.8044305033647e-06, 0.3880222866652e+01, 0.5223693906222e+01,\n      0.4385347909274e-06, 0.3704369937468e+01, 0.2352866153506e+01,\n      0.3186156414906e-06, 0.3999639363235e+01, 0.1577343543434e+01,\n      0.2272412285792e-06, 0.3984738315952e+01, 0.1047747311755e+01,\n      0.1645620103007e-06, 0.3565412516841e+01, 0.5856477690889e+01,\n      0.1815836921166e-06, 0.4984507059020e+01, 0.6283075850446e+01,\n      0.1447461676364e-06, 0.3702753570108e+01, 0.9437762937313e+01,\n      0.1430760876382e-06, 0.3409658712357e+01, 0.1021328554739e+02,\n\n      0.1120445753226e-06, 0.4829561570246e+01, 0.1414349524433e+02,\n      0.1090232840797e-06, 0.2080729178066e+01, 0.6812766822558e+01,\n      0.9715727346551e-07, 0.3476295881948e+01, 0.4694002934110e+01,\n      0.1036267136217e-06, 0.4056639536648e+01, 0.7109288135493e+02,\n      0.8752665271340e-07, 0.4448159519911e+01, 0.5753384878334e+01,\n      0.8331864956004e-07, 0.4991704044208e+01, 0.7084896783808e+01,\n      0.6901658670245e-07, 0.4325358994219e+01, 0.6275962395778e+01,\n      0.9144536848998e-07, 0.1141826375363e+01, 0.6620890113188e+01,\n      0.7205085037435e-07, 0.3624344170143e+01, 0.5296909721118e+00,\n      0.7697874654176e-07, 0.5554257458998e+01, 0.1676215758509e+03,\n\n      0.5197545738384e-07, 0.6251760961735e+01, 0.1807370494127e+02,\n      0.5031345378608e-07, 0.2497341091913e+01, 0.4705732307012e+01,\n      0.4527110205840e-07, 0.2335079920992e+01, 0.6309374173736e+01,\n      0.4753355798089e-07, 0.7094148987474e+00, 0.5884926831456e+01,\n      0.4296951977516e-07, 0.1101916352091e+01, 0.6681224869435e+01,\n      0.3855341568387e-07, 0.1825495405486e+01, 0.5486777812467e+01,\n      0.5253930970990e-07, 0.4424740687208e+01, 0.7860419393880e+01,\n      0.4024630496471e-07, 0.5120498157053e+01, 0.1336797263425e+02,\n      0.4061069791453e-07, 0.6029771435451e+01, 0.3930209696940e+01,\n      0.3797883804205e-07, 0.4435193600836e+00, 0.3154687086868e+01,\n\n      0.2933033225587e-07, 0.5124157356507e+01, 0.1059381944224e+01,\n      0.3503000930426e-07, 0.5421830162065e+01, 0.6069776770667e+01,\n      0.3670096214050e-07, 0.4582101667297e+01, 0.1219403291462e+02,\n      0.2905609437008e-07, 0.1926566420072e+01, 0.1097707878456e+02,\n      0.2466827821713e-07, 0.6090174539834e+00, 0.6496374930224e+01,\n      0.2691647295332e-07, 0.1393432595077e+01, 0.2200391463820e+02,\n      0.2150554667946e-07, 0.4308671715951e+01, 0.5643178611111e+01,\n      0.2237481922680e-07, 0.8133968269414e+00, 0.8635942003952e+01,\n      0.1817741038157e-07, 0.3755205127454e+01, 0.3340612434717e+01,\n      0.2227820762132e-07, 0.2759558596664e+01, 0.1203646072878e+02,\n\n      0.1944713772307e-07, 0.5699645869121e+01, 0.1179062909082e+02,\n      0.1527340520662e-07, 0.1986749091746e+01, 0.3981490189893e+00,\n      0.1577282574914e-07, 0.3205017217983e+01, 0.5088628793478e+01,\n      0.1424738825424e-07, 0.6256747903666e+01, 0.2544314396739e+01,\n      0.1616563121701e-07, 0.2601671259394e+00, 0.1729818233119e+02,\n      0.1401210391692e-07, 0.4686939173506e+01, 0.7058598460518e+01,\n      0.1488726974214e-07, 0.2815862451372e+01, 0.2593412433514e+02,\n      0.1692626442388e-07, 0.4956894109797e+01, 0.1564752902480e+03,\n      0.1123571582910e-07, 0.2381192697696e+01, 0.3738761453707e+01,\n      0.9903308606317e-08, 0.4294851657684e+01, 0.9225539266174e+01,\n\n      0.9174533187191e-08, 0.3075171510642e+01, 0.4164311961999e+01,\n      0.8645985631457e-08, 0.5477534821633e+00, 0.8429241228195e+01,\n     -0.1085876492688e-07, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.9264309077815e-08, 0.5968571670097e+01, 0.7079373888424e+01,\n      0.8243116984954e-08, 0.1489098777643e+01, 0.1044738781244e+02,\n      0.8268102113708e-08, 0.3512977691983e+01, 0.1150676975667e+02,\n      0.9043613988227e-08, 0.1290704408221e+00, 0.1101510648075e+02,\n      0.7432912038789e-08, 0.1991086893337e+01, 0.2608790314060e+02,\n      0.8586233727285e-08, 0.4238357924414e+01, 0.2986433403208e+02,\n      0.7612230060131e-08, 0.2911090150166e+01, 0.4732030630302e+01,\n\n      0.7097787751408e-08, 0.1908938392390e+01, 0.8031092209206e+01,\n      0.7640237040175e-08, 0.6129219000168e+00, 0.7962980379786e+00,\n      0.7070445688081e-08, 0.1380417036651e+01, 0.2146165377750e+01,\n      0.7690770957702e-08, 0.1680504249084e+01, 0.2122839202813e+02,\n      0.8051292542594e-08, 0.5127423484511e+01, 0.2942463415728e+01,\n      0.5902709104515e-08, 0.2020274190917e+01, 0.7755226100720e+00,\n      0.5134567496462e-08, 0.2606778676418e+01, 0.1256615170089e+02,\n      0.5525802046102e-08, 0.1613011769663e+01, 0.8018209333619e+00,\n      0.5880724784221e-08, 0.4604483417236e+01, 0.4690479774488e+01,\n      0.5211699081370e-08, 0.5718964114193e+01, 0.8827390247185e+01,\n\n      0.4891849573562e-08, 0.3689658932196e+01, 0.2132990797783e+00,\n      0.5150246069997e-08, 0.4099769855122e+01, 0.6480980550449e+02,\n      0.5102434319633e-08, 0.5660834602509e+01, 0.3379454372902e+02,\n      0.5083405254252e-08, 0.9842221218974e+00, 0.4136910472696e+01,\n      0.4206562585682e-08, 0.1341363634163e+00, 0.3128388763578e+01,\n      0.4663249683579e-08, 0.8130132735866e+00, 0.5216580451554e+01,\n      0.4099474416530e-08, 0.5791497770644e+01, 0.4265981595566e+00,\n      0.4628251220767e-08, 0.1249802769331e+01, 0.1572083878776e+02,\n      0.5024068728142e-08, 0.4795684802743e+01, 0.6290189305114e+01,\n      0.5120234327758e-08, 0.3810420387208e+01, 0.5230807360890e+01,\n\n      0.5524029815280e-08, 0.1029264714351e+01, 0.2397622045175e+03,\n      0.4757415718860e-08, 0.3528044781779e+01, 0.1649636139783e+02,\n      0.3915786131127e-08, 0.5593889282646e+01, 0.1589072916335e+01,\n      0.4869053149991e-08, 0.3299636454433e+01, 0.7632943190217e+01,\n      0.3649365703729e-08, 0.1286049002584e+01, 0.6206810014183e+01,\n      0.3992493949002e-08, 0.3100307589464e+01, 0.2515860172507e+02,\n      0.3320247477418e-08, 0.6212683940807e+01, 0.1216800268190e+02,\n      0.3287123739696e-08, 0.4699118445928e+01, 0.7234794171227e+01,\n      0.3472776811103e-08, 0.2630507142004e+01, 0.7342457794669e+01,\n      0.3423253294767e-08, 0.2946432844305e+01, 0.9623688285163e+01,\n\n      0.3896173898244e-08, 0.1224834179264e+01, 0.6438496133249e+01,\n      0.3388455337924e-08, 0.1543807616351e+01, 0.1494531617769e+02,\n      0.3062704716523e-08, 0.1191777572310e+01, 0.8662240327241e+01,\n      0.3270075600400e-08, 0.5483498767737e+01, 0.1194447056968e+01,\n      0.3101209215259e-08, 0.8000833804348e+00, 0.3772475342596e+02,\n      0.2780883347311e-08, 0.4077980721888e+00, 0.5863591145557e+01,\n      0.2903605931824e-08, 0.2617490302147e+01, 0.1965104848470e+02,\n      0.2682014743119e-08, 0.2634703158290e+01, 0.7238675589263e+01,\n      0.2534360108492e-08, 0.6102446114873e+01, 0.6836645152238e+01,\n      0.2392564882509e-08, 0.3681820208691e+01, 0.5849364236221e+01,\n\n      0.2656667254856e-08, 0.6216045388886e+01, 0.6133512519065e+01,\n      0.2331242096773e-08, 0.5864949777744e+01, 0.4535059491685e+01,\n      0.2287898363668e-08, 0.4566628532802e+01, 0.7477522907414e+01,\n      0.2336944521306e-08, 0.2442722126930e+01, 0.1137170464392e+02,\n      0.3156632236269e-08, 0.1626628050682e+01, 0.2509084901204e+03,\n      0.2982612402766e-08, 0.2803604512609e+01, 0.1748016358760e+01,\n      0.2774031674807e-08, 0.4654002897158e+01, 0.8223916695780e+02,\n      0.2295236548638e-08, 0.4326518333253e+01, 0.3378142627421e+00,\n      0.2190714699873e-08, 0.4519614578328e+01, 0.2908881142201e+02,\n      0.2191495845045e-08, 0.3012626912549e+01, 0.1673046366289e+02,\n\n      0.2492901628386e-08, 0.1290101424052e+00, 0.1543797956245e+03,\n      0.1993778064319e-08, 0.3864046799414e+01, 0.1778984560711e+02,\n      0.1898146479022e-08, 0.5053777235891e+01, 0.2042657109477e+02,\n      0.1918280127634e-08, 0.2222470192548e+01, 0.4165496312290e+02,\n      0.1916351061607e-08, 0.8719067257774e+00, 0.7737595720538e+02,\n      0.1834720181466e-08, 0.4031491098040e+01, 0.2358125818164e+02,\n      0.1249201523806e-08, 0.5938379466835e+01, 0.3301902111895e+02,\n      0.1477304050539e-08, 0.6544722606797e+00, 0.9548094718417e+02,\n      0.1264316431249e-08, 0.2059072853236e+01, 0.8399684731857e+02,\n      0.1203526495039e-08, 0.3644813532605e+01, 0.4558517281984e+02,\n\n      0.9221681059831e-09, 0.3241815055602e+01, 0.7805158573086e+02,\n      0.7849278367646e-09, 0.5043812342457e+01, 0.5217580628120e+02,\n      0.7983392077387e-09, 0.5000024502753e+01, 0.1501922143975e+03,\n      0.7925395431654e-09, 0.1398734871821e-01, 0.9061773743175e+02,\n      0.7640473285886e-09, 0.5067111723130e+01, 0.4951538251678e+02,\n      0.5398937754482e-09, 0.5597382200075e+01, 0.1613385000004e+03,\n      0.5626247550193e-09, 0.2601338209422e+01, 0.7318837597844e+02,\n      0.5525197197855e-09, 0.5814832109256e+01, 0.1432335100216e+03,\n      0.5407629837898e-09, 0.3384820609076e+01, 0.3230491187871e+03,\n      0.3856739119801e-09, 0.1072391840473e+01, 0.2334791286671e+03,\n\n      0.3856425239987e-09, 0.2369540393327e+01, 0.1739046517013e+03,\n      0.4350867755983e-09, 0.5255575751082e+01, 0.1620484330494e+03,\n      0.3844113924996e-09, 0.5482356246182e+01, 0.9757644180768e+02,\n      0.2854869155431e-09, 0.9573634763143e+00, 0.1697170704744e+03,\n      0.1719227671416e-09, 0.1887203025202e+01, 0.2265204242912e+03,\n      0.1527846879755e-09, 0.3982183931157e+01, 0.3341954043900e+03,\n      0.1128229264847e-09, 0.2787457156298e+01, 0.3119028331842e+03 };\n\n/* Sun-to-Earth, T^1, X */\n   static const double e1x[] = {\n      0.1234046326004e-05, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.5150068824701e-06, 0.6002664557501e+01, 0.1256615170089e+02,\n      0.1290743923245e-07, 0.5959437664199e+01, 0.1884922755134e+02,\n      0.1068615564952e-07, 0.2015529654209e+01, 0.6283075850446e+01,\n      0.2079619142538e-08, 0.1732960531432e+01, 0.6279552690824e+01,\n      0.2078009243969e-08, 0.4915604476996e+01, 0.6286599010068e+01,\n      0.6206330058856e-09, 0.3616457953824e+00, 0.4705732307012e+01,\n      0.5989335313746e-09, 0.3802607304474e+01, 0.6256777527156e+01,\n      0.5958495663840e-09, 0.2845866560031e+01, 0.6309374173736e+01,\n      0.4866923261539e-09, 0.5213203771824e+01, 0.7755226100720e+00,\n\n      0.4267785823142e-09, 0.4368189727818e+00, 0.1059381944224e+01,\n      0.4610675141648e-09, 0.1837249181372e-01, 0.7860419393880e+01,\n      0.3626989993973e-09, 0.2161590545326e+01, 0.5753384878334e+01,\n      0.3563071194389e-09, 0.1452631954746e+01, 0.5884926831456e+01,\n      0.3557015642807e-09, 0.4470593393054e+01, 0.6812766822558e+01,\n      0.3210412089122e-09, 0.5195926078314e+01, 0.6681224869435e+01,\n      0.2875473577986e-09, 0.5916256610193e+01, 0.2513230340178e+02,\n      0.2842913681629e-09, 0.1149902426047e+01, 0.6127655567643e+01,\n      0.2751248215916e-09, 0.5502088574662e+01, 0.6438496133249e+01,\n      0.2481432881127e-09, 0.2921989846637e+01, 0.5486777812467e+01,\n\n      0.2059885976560e-09, 0.3718070376585e+01, 0.7079373888424e+01,\n      0.2015522342591e-09, 0.5979395259740e+01, 0.6290189305114e+01,\n      0.1995364084253e-09, 0.6772087985494e+00, 0.6275962395778e+01,\n      0.1957436436943e-09, 0.2899210654665e+01, 0.5507553240374e+01,\n      0.1651609818948e-09, 0.6228206482192e+01, 0.1150676975667e+02,\n      0.1822980550699e-09, 0.1469348746179e+01, 0.1179062909082e+02,\n      0.1675223159760e-09, 0.3813910555688e+01, 0.7058598460518e+01,\n      0.1706491764745e-09, 0.3004380506684e+00, 0.7113454667900e-02,\n      0.1392952362615e-09, 0.1440393973406e+01, 0.7962980379786e+00,\n      0.1209868266342e-09, 0.4150425791727e+01, 0.4694002934110e+01,\n\n      0.1009827202611e-09, 0.3290040429843e+01, 0.3738761453707e+01,\n      0.1047261388602e-09, 0.4229590090227e+01, 0.6282095334605e+01,\n      0.1047006652004e-09, 0.2418967680575e+01, 0.6284056366286e+01,\n      0.9609993143095e-10, 0.4627943659201e+01, 0.6069776770667e+01,\n      0.9590900593873e-10, 0.1894393939924e+01, 0.4136910472696e+01,\n      0.9146249188071e-10, 0.2010647519562e+01, 0.6496374930224e+01,\n      0.8545274480290e-10, 0.5529846956226e-01, 0.1194447056968e+01,\n      0.8224377881194e-10, 0.1254304102174e+01, 0.1589072916335e+01,\n      0.6183529510410e-10, 0.3360862168815e+01, 0.8827390247185e+01,\n      0.6259255147141e-10, 0.4755628243179e+01, 0.8429241228195e+01,\n\n      0.5539291694151e-10, 0.5371746955142e+01, 0.4933208510675e+01,\n      0.7328259466314e-10, 0.4927699613906e+00, 0.4535059491685e+01,\n      0.6017835843560e-10, 0.5776682001734e-01, 0.1255903824622e+02,\n      0.7079827775243e-10, 0.4395059432251e+01, 0.5088628793478e+01,\n      0.5170358878213e-10, 0.5154062619954e+01, 0.1176985366291e+02,\n      0.4872301838682e-10, 0.6289611648973e+00, 0.6040347114260e+01,\n      0.5249869411058e-10, 0.5617272046949e+01, 0.3154687086868e+01,\n      0.4716172354411e-10, 0.3965901800877e+01, 0.5331357529664e+01,\n      0.4871214940964e-10, 0.4627507050093e+01, 0.1256967486051e+02,\n      0.4598076850751e-10, 0.6023631226459e+01, 0.6525804586632e+01,\n\n      0.4562196089485e-10, 0.4138562084068e+01, 0.3930209696940e+01,\n      0.4325493872224e-10, 0.1330845906564e+01, 0.7632943190217e+01,\n      0.5673781176748e-10, 0.2558752615657e+01, 0.5729506548653e+01,\n      0.3961436642503e-10, 0.2728071734630e+01, 0.7234794171227e+01,\n      0.5101868209058e-10, 0.4113444965144e+01, 0.6836645152238e+01,\n      0.5257043167676e-10, 0.6195089830590e+01, 0.8031092209206e+01,\n      0.5076613989393e-10, 0.2305124132918e+01, 0.7477522907414e+01,\n      0.3342169352778e-10, 0.5415998155071e+01, 0.1097707878456e+02,\n      0.3545881983591e-10, 0.3727160564574e+01, 0.4164311961999e+01,\n      0.3364063738599e-10, 0.2901121049204e+00, 0.1137170464392e+02,\n\n      0.3357039670776e-10, 0.1652229354331e+01, 0.5223693906222e+01,\n      0.4307412268687e-10, 0.4938909587445e+01, 0.1592596075957e+01,\n      0.3405769115435e-10, 0.2408890766511e+01, 0.3128388763578e+01,\n      0.3001926198480e-10, 0.4862239006386e+01, 0.1748016358760e+01,\n      0.2778264787325e-10, 0.5241168661353e+01, 0.7342457794669e+01,\n      0.2676159480666e-10, 0.3423593942199e+01, 0.2146165377750e+01,\n      0.2954273399939e-10, 0.1881721265406e+01, 0.5368044267797e+00,\n      0.3309362888795e-10, 0.1931525677349e+01, 0.8018209333619e+00,\n      0.2810283608438e-10, 0.2414659495050e+01, 0.5225775174439e+00,\n      0.3378045637764e-10, 0.4238019163430e+01, 0.1554202828031e+00,\n\n      0.2558134979840e-10, 0.1828225235805e+01, 0.5230807360890e+01,\n      0.2273755578447e-10, 0.5858184283998e+01, 0.7084896783808e+01,\n      0.2294176037690e-10, 0.4514589779057e+01, 0.1726015463500e+02,\n      0.2533506099435e-10, 0.2355717851551e+01, 0.5216580451554e+01,\n      0.2716685375812e-10, 0.2221003625100e+01, 0.8635942003952e+01,\n      0.2419043435198e-10, 0.5955704951635e+01, 0.4690479774488e+01,\n      0.2521232544812e-10, 0.1395676848521e+01, 0.5481254917084e+01,\n      0.2630195021491e-10, 0.5727468918743e+01, 0.2629832328990e-01,\n      0.2548395840944e-10, 0.2628351859400e-03, 0.1349867339771e+01 };\n\n/* Sun-to-Earth, T^1, Y */\n   static const double e1y[] = {\n      0.9304690546528e-06, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.5150715570663e-06, 0.4431807116294e+01, 0.1256615170089e+02,\n      0.1290825411056e-07, 0.4388610039678e+01, 0.1884922755134e+02,\n      0.4645466665386e-08, 0.5827263376034e+01, 0.6283075850446e+01,\n      0.2079625310718e-08, 0.1621698662282e+00, 0.6279552690824e+01,\n      0.2078189850907e-08, 0.3344713435140e+01, 0.6286599010068e+01,\n      0.6207190138027e-09, 0.5074049319576e+01, 0.4705732307012e+01,\n      0.5989826532569e-09, 0.2231842216620e+01, 0.6256777527156e+01,\n      0.5961360812618e-09, 0.1274975769045e+01, 0.6309374173736e+01,\n      0.4874165471016e-09, 0.3642277426779e+01, 0.7755226100720e+00,\n\n      0.4283834034360e-09, 0.5148765510106e+01, 0.1059381944224e+01,\n      0.4652389287529e-09, 0.4715794792175e+01, 0.7860419393880e+01,\n      0.3751707476401e-09, 0.6617207370325e+00, 0.5753384878334e+01,\n      0.3559998806198e-09, 0.6155548875404e+01, 0.5884926831456e+01,\n      0.3558447558857e-09, 0.2898827297664e+01, 0.6812766822558e+01,\n      0.3211116927106e-09, 0.3625813502509e+01, 0.6681224869435e+01,\n      0.2875609914672e-09, 0.4345435813134e+01, 0.2513230340178e+02,\n      0.2843109704069e-09, 0.5862263940038e+01, 0.6127655567643e+01,\n      0.2744676468427e-09, 0.3926419475089e+01, 0.6438496133249e+01,\n      0.2481285237789e-09, 0.1351976572828e+01, 0.5486777812467e+01,\n\n      0.2060338481033e-09, 0.2147556998591e+01, 0.7079373888424e+01,\n      0.2015822358331e-09, 0.4408358972216e+01, 0.6290189305114e+01,\n      0.2001195944195e-09, 0.5385829822531e+01, 0.6275962395778e+01,\n      0.1953667642377e-09, 0.1304933746120e+01, 0.5507553240374e+01,\n      0.1839744078713e-09, 0.6173567228835e+01, 0.1179062909082e+02,\n      0.1643334294845e-09, 0.4635942997523e+01, 0.1150676975667e+02,\n      0.1768051018652e-09, 0.5086283558874e+01, 0.7113454667900e-02,\n      0.1674874205489e-09, 0.2243332137241e+01, 0.7058598460518e+01,\n      0.1421445397609e-09, 0.6186899771515e+01, 0.7962980379786e+00,\n      0.1255163958267e-09, 0.5730238465658e+01, 0.4694002934110e+01,\n\n      0.1013945281961e-09, 0.1726055228402e+01, 0.3738761453707e+01,\n      0.1047294335852e-09, 0.2658801228129e+01, 0.6282095334605e+01,\n      0.1047103879392e-09, 0.8481047835035e+00, 0.6284056366286e+01,\n      0.9530343962826e-10, 0.3079267149859e+01, 0.6069776770667e+01,\n      0.9604637611690e-10, 0.3258679792918e+00, 0.4136910472696e+01,\n      0.9153518537177e-10, 0.4398599886584e+00, 0.6496374930224e+01,\n      0.8562458214922e-10, 0.4772686794145e+01, 0.1194447056968e+01,\n      0.8232525360654e-10, 0.5966220721679e+01, 0.1589072916335e+01,\n      0.6150223411438e-10, 0.1780985591923e+01, 0.8827390247185e+01,\n      0.6272087858000e-10, 0.3184305429012e+01, 0.8429241228195e+01,\n\n      0.5540476311040e-10, 0.3801260595433e+01, 0.4933208510675e+01,\n      0.7331901699361e-10, 0.5205948591865e+01, 0.4535059491685e+01,\n      0.6018528702791e-10, 0.4770139083623e+01, 0.1255903824622e+02,\n      0.5150530724804e-10, 0.3574796899585e+01, 0.1176985366291e+02,\n      0.6471933741811e-10, 0.2679787266521e+01, 0.5088628793478e+01,\n      0.5317460644174e-10, 0.9528763345494e+00, 0.3154687086868e+01,\n      0.4832187748783e-10, 0.5329322498232e+01, 0.6040347114260e+01,\n      0.4716763555110e-10, 0.2395235316466e+01, 0.5331357529664e+01,\n      0.4871509139861e-10, 0.3056663648823e+01, 0.1256967486051e+02,\n      0.4598417696768e-10, 0.4452762609019e+01, 0.6525804586632e+01,\n\n      0.5674189533175e-10, 0.9879680872193e+00, 0.5729506548653e+01,\n      0.4073560328195e-10, 0.5939127696986e+01, 0.7632943190217e+01,\n      0.5040994945359e-10, 0.4549875824510e+01, 0.8031092209206e+01,\n      0.5078185134679e-10, 0.7346659893982e+00, 0.7477522907414e+01,\n      0.3769343537061e-10, 0.1071317188367e+01, 0.7234794171227e+01,\n      0.4980331365299e-10, 0.2500345341784e+01, 0.6836645152238e+01,\n      0.3458236594757e-10, 0.3825159450711e+01, 0.1097707878456e+02,\n      0.3578859493602e-10, 0.5299664791549e+01, 0.4164311961999e+01,\n      0.3370504646419e-10, 0.5002316301593e+01, 0.1137170464392e+02,\n      0.3299873338428e-10, 0.2526123275282e+01, 0.3930209696940e+01,\n\n      0.4304917318409e-10, 0.3368078557132e+01, 0.1592596075957e+01,\n      0.3402418753455e-10, 0.8385495425800e+00, 0.3128388763578e+01,\n      0.2778460572146e-10, 0.3669905203240e+01, 0.7342457794669e+01,\n      0.2782710128902e-10, 0.2691664812170e+00, 0.1748016358760e+01,\n      0.2711725179646e-10, 0.4707487217718e+01, 0.5296909721118e+00,\n      0.2981760946340e-10, 0.3190260867816e+00, 0.5368044267797e+00,\n      0.2811672977772e-10, 0.3196532315372e+01, 0.7084896783808e+01,\n      0.2863454474467e-10, 0.2263240324780e+00, 0.5223693906222e+01,\n      0.3333464634051e-10, 0.3498451685065e+01, 0.8018209333619e+00,\n      0.3312991747609e-10, 0.5839154477412e+01, 0.1554202828031e+00,\n\n      0.2813255564006e-10, 0.8268044346621e+00, 0.5225775174439e+00,\n      0.2665098083966e-10, 0.3934021725360e+01, 0.5216580451554e+01,\n      0.2349795705216e-10, 0.5197620913779e+01, 0.2146165377750e+01,\n      0.2330352293961e-10, 0.2984999231807e+01, 0.1726015463500e+02,\n      0.2728001683419e-10, 0.6521679638544e+00, 0.8635942003952e+01,\n      0.2484061007669e-10, 0.3468955561097e+01, 0.5230807360890e+01,\n      0.2646328768427e-10, 0.1013724533516e+01, 0.2629832328990e-01,\n      0.2518630264831e-10, 0.6108081057122e+01, 0.5481254917084e+01,\n      0.2421901455384e-10, 0.1651097776260e+01, 0.1349867339771e+01,\n      0.6348533267831e-11, 0.3220226560321e+01, 0.8433466158131e+02 };\n\n/* Sun-to-Earth, T^1, Z */\n   static const double e1z[] = {\n      0.2278290449966e-05, 0.3413716033863e+01, 0.6283075850446e+01,\n      0.5429458209830e-07, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.1903240492525e-07, 0.3370592358297e+01, 0.1256615170089e+02,\n      0.2385409276743e-09, 0.3327914718416e+01, 0.1884922755134e+02,\n      0.8676928342573e-10, 0.1824006811264e+01, 0.5223693906222e+01,\n      0.7765442593544e-10, 0.3888564279247e+01, 0.5507553240374e+01,\n      0.7066158332715e-10, 0.5194267231944e+01, 0.2352866153506e+01,\n      0.7092175288657e-10, 0.2333246960021e+01, 0.8399684731857e+02,\n      0.5357582213535e-10, 0.2224031176619e+01, 0.5296909721118e+00,\n      0.3828035865021e-10, 0.2156710933584e+01, 0.6279552690824e+01,\n\n      0.3824857220427e-10, 0.1529755219915e+01, 0.6286599010068e+01,\n      0.3286995181628e-10, 0.4879512900483e+01, 0.1021328554739e+02 };\n\n/* Sun-to-Earth, T^2, X */\n   static const double e2x[] = {\n     -0.4143818297913e-10, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.2171497694435e-10, 0.4398225628264e+01, 0.1256615170089e+02,\n      0.9845398442516e-11, 0.2079720838384e+00, 0.6283075850446e+01,\n      0.9256833552682e-12, 0.4191264694361e+01, 0.1884922755134e+02,\n      0.1022049384115e-12, 0.5381133195658e+01, 0.8399684731857e+02 };\n\n/* Sun-to-Earth, T^2, Y */\n   static const double e2y[] = {\n      0.5063375872532e-10, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.2173815785980e-10, 0.2827805833053e+01, 0.1256615170089e+02,\n      0.1010231999920e-10, 0.4634612377133e+01, 0.6283075850446e+01,\n      0.9259745317636e-12, 0.2620612076189e+01, 0.1884922755134e+02,\n      0.1022202095812e-12, 0.3809562326066e+01, 0.8399684731857e+02 };\n\n/* Sun-to-Earth, T^2, Z */\n   static const double e2z[] = {\n      0.9722666114891e-10, 0.5152219582658e+01, 0.6283075850446e+01,\n     -0.3494819171909e-11, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.6713034376076e-12, 0.6440188750495e+00, 0.1256615170089e+02 };\n\n/* SSB-to-Sun, T^0, X */\n   static const double s0x[] = {\n      0.4956757536410e-02, 0.3741073751789e+01, 0.5296909721118e+00,\n      0.2718490072522e-02, 0.4016011511425e+01, 0.2132990797783e+00,\n      0.1546493974344e-02, 0.2170528330642e+01, 0.3813291813120e-01,\n      0.8366855276341e-03, 0.2339614075294e+01, 0.7478166569050e-01,\n      0.2936777942117e-03, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.1201317439469e-03, 0.4090736353305e+01, 0.1059381944224e+01,\n      0.7578550887230e-04, 0.3241518088140e+01, 0.4265981595566e+00,\n      0.1941787367773e-04, 0.1012202064330e+01, 0.2061856251104e+00,\n      0.1889227765991e-04, 0.3892520416440e+01, 0.2204125344462e+00,\n      0.1937896968613e-04, 0.4797779441161e+01, 0.1495633313810e+00,\n\n      0.1434506110873e-04, 0.3868960697933e+01, 0.5225775174439e+00,\n      0.1406659911580e-04, 0.4759766557397e+00, 0.5368044267797e+00,\n      0.1179022300202e-04, 0.7774961520598e+00, 0.7626583626240e-01,\n      0.8085864460959e-05, 0.3254654471465e+01, 0.3664874755930e-01,\n      0.7622752967615e-05, 0.4227633103489e+01, 0.3961708870310e-01,\n      0.6209171139066e-05, 0.2791828325711e+00, 0.7329749511860e-01,\n      0.4366435633970e-05, 0.4440454875925e+01, 0.1589072916335e+01,\n      0.3792124889348e-05, 0.5156393842356e+01, 0.7113454667900e-02,\n      0.3154548963402e-05, 0.6157005730093e+01, 0.4194847048887e+00,\n      0.3088359882942e-05, 0.2494567553163e+01, 0.6398972393349e+00,\n\n      0.2788440902136e-05, 0.4934318747989e+01, 0.1102062672231e+00,\n      0.3039928456376e-05, 0.4895077702640e+01, 0.6283075850446e+01,\n      0.2272258457679e-05, 0.5278394064764e+01, 0.1030928125552e+00,\n      0.2162007057957e-05, 0.5802978019099e+01, 0.3163918923335e+00,\n      0.1767632855737e-05, 0.3415346595193e-01, 0.1021328554739e+02,\n      0.1349413459362e-05, 0.2001643230755e+01, 0.1484170571900e-02,\n      0.1170141900476e-05, 0.2424750491620e+01, 0.6327837846670e+00,\n      0.1054355266820e-05, 0.3123311487576e+01, 0.4337116142245e+00,\n      0.9800822461610e-06, 0.3026258088130e+01, 0.1052268489556e+01,\n      0.1091203749931e-05, 0.3157811670347e+01, 0.1162474756779e+01,\n\n      0.6960236715913e-06, 0.8219570542313e+00, 0.1066495398892e+01,\n      0.5689257296909e-06, 0.1323052375236e+01, 0.9491756770005e+00,\n      0.6613172135802e-06, 0.2765348881598e+00, 0.8460828644453e+00,\n      0.6277702517571e-06, 0.5794064466382e+01, 0.1480791608091e+00,\n      0.6304884066699e-06, 0.7323555380787e+00, 0.2243449970715e+00,\n      0.4897850467382e-06, 0.3062464235399e+01, 0.3340612434717e+01,\n      0.3759148598786e-06, 0.4588290469664e+01, 0.3516457698740e-01,\n      0.3110520548195e-06, 0.1374299536572e+01, 0.6373574839730e-01,\n      0.3064708359780e-06, 0.4222267485047e+01, 0.1104591729320e-01,\n      0.2856347168241e-06, 0.3714202944973e+01, 0.1510475019529e+00,\n\n      0.2840945514288e-06, 0.2847972875882e+01, 0.4110125927500e-01,\n      0.2378951599405e-06, 0.3762072563388e+01, 0.2275259891141e+00,\n      0.2714229481417e-06, 0.1036049980031e+01, 0.2535050500000e-01,\n      0.2323551717307e-06, 0.4682388599076e+00, 0.8582758298370e-01,\n      0.1881790512219e-06, 0.4790565425418e+01, 0.2118763888447e+01,\n      0.2261353968371e-06, 0.1669144912212e+01, 0.7181332454670e-01,\n      0.2214546389848e-06, 0.3937717281614e+01, 0.2968341143800e-02,\n      0.2184915594933e-06, 0.1129169845099e+00, 0.7775000683430e-01,\n      0.2000164937936e-06, 0.4030009638488e+01, 0.2093666171530e+00,\n      0.1966105136719e-06, 0.8745955786834e+00, 0.2172315424036e+00,\n\n      0.1904742332624e-06, 0.5919743598964e+01, 0.2022531624851e+00,\n      0.1657399705031e-06, 0.2549141484884e+01, 0.7358765972222e+00,\n      0.1574070533987e-06, 0.5277533020230e+01, 0.7429900518901e+00,\n      0.1832261651039e-06, 0.3064688127777e+01, 0.3235053470014e+00,\n      0.1733615346569e-06, 0.3011432799094e+01, 0.1385174140878e+00,\n      0.1549124014496e-06, 0.4005569132359e+01, 0.5154640627760e+00,\n      0.1637044713838e-06, 0.1831375966632e+01, 0.8531963191132e+00,\n      0.1123420082383e-06, 0.1180270407578e+01, 0.1990721704425e+00,\n      0.1083754165740e-06, 0.3414101320863e+00, 0.5439178814476e+00,\n      0.1156638012655e-06, 0.6130479452594e+00, 0.5257585094865e+00,\n\n      0.1142548785134e-06, 0.3724761948846e+01, 0.5336234347371e+00,\n      0.7921463895965e-07, 0.2435425589361e+01, 0.1478866649112e+01,\n      0.7428600285231e-07, 0.3542144398753e+01, 0.2164800718209e+00,\n      0.8323211246747e-07, 0.3525058072354e+01, 0.1692165728891e+01,\n      0.7257595116312e-07, 0.1364299431982e+01, 0.2101180877357e+00,\n      0.7111185833236e-07, 0.2460478875808e+01, 0.4155522422634e+00,\n      0.6868090383716e-07, 0.4397327670704e+01, 0.1173197218910e+00,\n      0.7226419974175e-07, 0.4042647308905e+01, 0.1265567569334e+01,\n      0.6955642383177e-07, 0.2865047906085e+01, 0.9562891316684e+00,\n      0.7492139296331e-07, 0.5014278994215e+01, 0.1422690933580e-01,\n\n      0.6598363128857e-07, 0.2376730020492e+01, 0.6470106940028e+00,\n      0.7381147293385e-07, 0.3272990384244e+01, 0.1581959461667e+01,\n      0.6402909624032e-07, 0.5302290955138e+01, 0.9597935788730e-01,\n      0.6237454263857e-07, 0.5444144425332e+01, 0.7084920306520e-01,\n      0.5241198544016e-07, 0.4215359579205e+01, 0.5265099800692e+00,\n      0.5144463853918e-07, 0.1218916689916e+00, 0.5328719641544e+00,\n      0.5868164772299e-07, 0.2369402002213e+01, 0.7871412831580e-01,\n      0.6233195669151e-07, 0.1254922242403e+01, 0.2608790314060e+02,\n      0.6068463791422e-07, 0.5679713760431e+01, 0.1114304132498e+00,\n      0.4359361135065e-07, 0.6097219641646e+00, 0.1375773836557e+01,\n\n      0.4686510366826e-07, 0.4786231041431e+01, 0.1143987543936e+00,\n      0.3758977287225e-07, 0.1167368068139e+01, 0.1596186371003e+01,\n      0.4282051974778e-07, 0.1519471064319e+01, 0.2770348281756e+00,\n      0.5153765386113e-07, 0.1860532322984e+01, 0.2228608264996e+00,\n      0.4575129387188e-07, 0.7632857887158e+00, 0.1465949902372e+00,\n      0.3326844933286e-07, 0.1298219485285e+01, 0.5070101000000e-01,\n      0.3748617450984e-07, 0.1046510321062e+01, 0.4903339079539e+00,\n      0.2816756661499e-07, 0.3434522346190e+01, 0.2991266627620e+00,\n      0.3412750405039e-07, 0.2523766270318e+01, 0.3518164938661e+00,\n      0.2655796761776e-07, 0.2904422260194e+01, 0.6256703299991e+00,\n\n      0.2963597929458e-07, 0.5923900431149e+00, 0.1099462426779e+00,\n      0.2539523734781e-07, 0.4851947722567e+01, 0.1256615170089e+02,\n      0.2283087914139e-07, 0.3400498595496e+01, 0.6681224869435e+01,\n      0.2321309799331e-07, 0.5789099148673e+01, 0.3368040641550e-01,\n      0.2549657649750e-07, 0.3991856479792e-01, 0.1169588211447e+01,\n      0.2290462303977e-07, 0.2788567577052e+01, 0.1045155034888e+01,\n      0.1945398522914e-07, 0.3290896998176e+01, 0.1155361302111e+01,\n      0.1849171512638e-07, 0.2698060129367e+01, 0.4452511715700e-02,\n      0.1647199834254e-07, 0.3016735644085e+01, 0.4408250688924e+00,\n      0.1529530765273e-07, 0.5573043116178e+01, 0.6521991896920e-01,\n\n      0.1433199339978e-07, 0.1481192356147e+01, 0.9420622223326e+00,\n      0.1729134193602e-07, 0.1422817538933e+01, 0.2108507877249e+00,\n      0.1716463931346e-07, 0.3469468901855e+01, 0.2157473718317e+00,\n      0.1391206061378e-07, 0.6122436220547e+01, 0.4123712502208e+00,\n      0.1404746661924e-07, 0.1647765641936e+01, 0.4258542984690e-01,\n      0.1410452399455e-07, 0.5989729161964e+01, 0.2258291676434e+00,\n      0.1089828772168e-07, 0.2833705509371e+01, 0.4226656969313e+00,\n      0.1047374564948e-07, 0.5090690007331e+00, 0.3092784376656e+00,\n      0.1358279126532e-07, 0.5128990262836e+01, 0.7923417740620e-01,\n      0.1020456476148e-07, 0.9632772880808e+00, 0.1456308687557e+00,\n\n      0.1033428735328e-07, 0.3223779318418e+01, 0.1795258541446e+01,\n      0.1412435841540e-07, 0.2410271572721e+01, 0.1525316725248e+00,\n      0.9722759371574e-08, 0.2333531395690e+01, 0.8434341241180e-01,\n      0.9657334084704e-08, 0.6199270974168e+01, 0.1272681024002e+01,\n      0.1083641148690e-07, 0.2864222292929e+01, 0.7032915397480e-01,\n      0.1067318403838e-07, 0.5833458866568e+00, 0.2123349582968e+00,\n      0.1062366201976e-07, 0.4307753989494e+01, 0.2142632012598e+00,\n      0.1236364149266e-07, 0.2873917870593e+01, 0.1847279083684e+00,\n      0.1092759489593e-07, 0.2959887266733e+01, 0.1370332435159e+00,\n      0.8912069362899e-08, 0.5141213702562e+01, 0.2648454860559e+01,\n\n      0.9656467707970e-08, 0.4532182462323e+01, 0.4376440768498e+00,\n      0.8098386150135e-08, 0.2268906338379e+01, 0.2880807454688e+00,\n      0.7857714675000e-08, 0.4055544260745e+01, 0.2037373330570e+00,\n      0.7288455940646e-08, 0.5357901655142e+01, 0.1129145838217e+00,\n      0.9450595950552e-08, 0.4264926963939e+01, 0.5272426800584e+00,\n      0.9381718247537e-08, 0.7489366976576e-01, 0.5321392641652e+00,\n      0.7079052646038e-08, 0.1923311052874e+01, 0.6288513220417e+00,\n      0.9259004415344e-08, 0.2970256853438e+01, 0.1606092486742e+00,\n      0.8259801499742e-08, 0.3327056314697e+01, 0.8389694097774e+00,\n      0.6476334355779e-08, 0.2954925505727e+01, 0.2008557621224e+01,\n\n      0.5984021492007e-08, 0.9138753105829e+00, 0.2042657109477e+02,\n      0.5989546863181e-08, 0.3244464082031e+01, 0.2111650433779e+01,\n      0.6233108606023e-08, 0.4995232638403e+00, 0.4305306221819e+00,\n      0.6877299149965e-08, 0.2834987233449e+01, 0.9561746721300e-02,\n      0.8311234227190e-08, 0.2202951835758e+01, 0.3801276407308e+00,\n      0.6599472832414e-08, 0.4478581462618e+01, 0.1063314406849e+01,\n      0.6160491096549e-08, 0.5145858696411e+01, 0.1368660381889e+01,\n      0.6164772043891e-08, 0.3762976697911e+00, 0.4234171675140e+00,\n      0.6363248684450e-08, 0.3162246718685e+01, 0.1253008786510e-01,\n      0.6448587520999e-08, 0.3442693302119e+01, 0.5287268506303e+00,\n\n      0.6431662283977e-08, 0.8977549136606e+00, 0.5306550935933e+00,\n      0.6351223158474e-08, 0.4306447410369e+01, 0.5217580628120e+02,\n      0.5476721393451e-08, 0.3888529177855e+01, 0.2221856701002e+01,\n      0.5341772572619e-08, 0.2655560662512e+01, 0.7466759693650e-01,\n      0.5337055758302e-08, 0.5164990735946e+01, 0.7489573444450e-01,\n      0.5373120816787e-08, 0.6041214553456e+01, 0.1274714967946e+00,\n      0.5392351705426e-08, 0.9177763485932e+00, 0.1055449481598e+01,\n      0.6688495850205e-08, 0.3089608126937e+01, 0.2213766559277e+00,\n      0.5072003660362e-08, 0.4311316541553e+01, 0.2132517061319e+00,\n      0.5070726650455e-08, 0.5790675464444e+00, 0.2133464534247e+00,\n\n      0.5658012950032e-08, 0.2703945510675e+01, 0.7287631425543e+00,\n      0.4835509924854e-08, 0.2975422976065e+01, 0.7160067364790e-01,\n      0.6479821978012e-08, 0.1324168733114e+01, 0.2209183458640e-01,\n      0.6230636494980e-08, 0.2860103632836e+01, 0.3306188016693e+00,\n      0.4649239516213e-08, 0.4832259763403e+01, 0.7796265773310e-01,\n      0.6487325792700e-08, 0.2726165825042e+01, 0.3884652414254e+00,\n      0.4682823682770e-08, 0.6966602455408e+00, 0.1073608853559e+01,\n      0.5704230804976e-08, 0.5669634104606e+01, 0.8731175355560e-01,\n      0.6125413585489e-08, 0.1513386538915e+01, 0.7605151500000e-01,\n      0.6035825038187e-08, 0.1983509168227e+01, 0.9846002785331e+00,\n\n      0.4331123462303e-08, 0.2782892992807e+01, 0.4297791515992e+00,\n      0.4681107685143e-08, 0.5337232886836e+01, 0.2127790306879e+00,\n      0.4669105829655e-08, 0.5837133792160e+01, 0.2138191288687e+00,\n      0.5138823602365e-08, 0.3080560200507e+01, 0.7233337363710e-01,\n      0.4615856664534e-08, 0.1661747897471e+01, 0.8603097737811e+00,\n      0.4496916702197e-08, 0.2112508027068e+01, 0.7381754420900e-01,\n      0.4278479042945e-08, 0.5716528462627e+01, 0.7574578717200e-01,\n      0.3840525503932e-08, 0.6424172726492e+00, 0.3407705765729e+00,\n      0.4866636509685e-08, 0.4919244697715e+01, 0.7722995774390e-01,\n      0.3526100639296e-08, 0.2550821052734e+01, 0.6225157782540e-01,\n\n      0.3939558488075e-08, 0.3939331491710e+01, 0.5268983110410e-01,\n      0.4041268772576e-08, 0.2275337571218e+01, 0.3503323232942e+00,\n      0.3948761842853e-08, 0.1999324200790e+01, 0.1451108196653e+00,\n      0.3258394550029e-08, 0.9121001378200e+00, 0.5296435984654e+00,\n      0.3257897048761e-08, 0.3428428660869e+01, 0.5297383457582e+00,\n      0.3842559031298e-08, 0.6132927720035e+01, 0.9098186128426e+00,\n      0.3109920095448e-08, 0.7693650193003e+00, 0.3932462625300e-02,\n      0.3132237775119e-08, 0.3621293854908e+01, 0.2346394437820e+00,\n      0.3942189421510e-08, 0.4841863659733e+01, 0.3180992042600e-02,\n      0.3796972285340e-08, 0.1814174994268e+01, 0.1862120789403e+00,\n\n      0.3995640233688e-08, 0.1386990406091e+01, 0.4549093064213e+00,\n      0.2875013727414e-08, 0.9178318587177e+00, 0.1905464808669e+01,\n      0.3073719932844e-08, 0.2688923811835e+01, 0.3628624111593e+00,\n      0.2731016580075e-08, 0.1188259127584e+01, 0.2131850110243e+00,\n      0.2729549896546e-08, 0.3702160634273e+01, 0.2134131485323e+00,\n      0.3339372892449e-08, 0.7199163960331e+00, 0.2007689919132e+00,\n      0.2898833764204e-08, 0.1916709364999e+01, 0.5291709230214e+00,\n      0.2894536549362e-08, 0.2424043195547e+01, 0.5302110212022e+00,\n      0.3096872473843e-08, 0.4445894977497e+01, 0.2976424921901e+00,\n      0.2635672326810e-08, 0.3814366984117e+01, 0.1485980103780e+01,\n\n      0.3649302697001e-08, 0.2924200596084e+01, 0.6044726378023e+00,\n      0.3127954585895e-08, 0.1842251648327e+01, 0.1084620721060e+00,\n      0.2616040173947e-08, 0.4155841921984e+01, 0.1258454114666e+01,\n      0.2597395859860e-08, 0.1158045978874e+00, 0.2103781122809e+00,\n      0.2593286172210e-08, 0.4771850408691e+01, 0.2162200472757e+00,\n      0.2481823585747e-08, 0.4608842558889e+00, 0.1062562936266e+01,\n      0.2742219550725e-08, 0.1538781127028e+01, 0.5651155736444e+00,\n      0.3199558469610e-08, 0.3226647822878e+00, 0.7036329877322e+00,\n      0.2666088542957e-08, 0.1967991731219e+00, 0.1400015846597e+00,\n      0.2397067430580e-08, 0.3707036669873e+01, 0.2125476091956e+00,\n\n      0.2376570772738e-08, 0.1182086628042e+01, 0.2140505503610e+00,\n      0.2547228007887e-08, 0.4906256820629e+01, 0.1534957940063e+00,\n      0.2265575594114e-08, 0.3414949866857e+01, 0.2235935264888e+00,\n      0.2464381430585e-08, 0.4599122275378e+01, 0.2091065926078e+00,\n      0.2433408527044e-08, 0.2830751145445e+00, 0.2174915669488e+00,\n      0.2443605509076e-08, 0.4212046432538e+01, 0.1739420156204e+00,\n      0.2319779262465e-08, 0.9881978408630e+00, 0.7530171478090e-01,\n      0.2284622835465e-08, 0.5565347331588e+00, 0.7426161660010e-01,\n      0.2467268750783e-08, 0.5655708150766e+00, 0.2526561439362e+00,\n      0.2808513492782e-08, 0.1418405053408e+01, 0.5636314030725e+00,\n\n      0.2329528932532e-08, 0.4069557545675e+01, 0.1056200952181e+01,\n      0.9698639532817e-09, 0.1074134313634e+01, 0.7826370942180e+02 };\n\n/* SSB-to-Sun, T^0, Y */\n   static const double s0y[] = {\n      0.4955392320126e-02, 0.2170467313679e+01, 0.5296909721118e+00,\n      0.2722325167392e-02, 0.2444433682196e+01, 0.2132990797783e+00,\n      0.1546579925346e-02, 0.5992779281546e+00, 0.3813291813120e-01,\n      0.8363140252966e-03, 0.7687356310801e+00, 0.7478166569050e-01,\n      0.3385792683603e-03, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.1201192221613e-03, 0.2520035601514e+01, 0.1059381944224e+01,\n      0.7587125720554e-04, 0.1669954006449e+01, 0.4265981595566e+00,\n      0.1964155361250e-04, 0.5707743963343e+01, 0.2061856251104e+00,\n      0.1891900364909e-04, 0.2320960679937e+01, 0.2204125344462e+00,\n      0.1937373433356e-04, 0.3226940689555e+01, 0.1495633313810e+00,\n\n      0.1437139941351e-04, 0.2301626908096e+01, 0.5225775174439e+00,\n      0.1406267683099e-04, 0.5188579265542e+01, 0.5368044267797e+00,\n      0.1178703080346e-04, 0.5489483248476e+01, 0.7626583626240e-01,\n      0.8079835186041e-05, 0.1683751835264e+01, 0.3664874755930e-01,\n      0.7623253594652e-05, 0.2656400462961e+01, 0.3961708870310e-01,\n      0.6248667483971e-05, 0.4992775362055e+01, 0.7329749511860e-01,\n      0.4366353695038e-05, 0.2869706279678e+01, 0.1589072916335e+01,\n      0.3829101568895e-05, 0.3572131359950e+01, 0.7113454667900e-02,\n      0.3175733773908e-05, 0.4535372530045e+01, 0.4194847048887e+00,\n      0.3092437902159e-05, 0.9230153317909e+00, 0.6398972393349e+00,\n\n      0.2874168812154e-05, 0.3363143761101e+01, 0.1102062672231e+00,\n      0.3040119321826e-05, 0.3324250895675e+01, 0.6283075850446e+01,\n      0.2699723308006e-05, 0.2917882441928e+00, 0.1030928125552e+00,\n      0.2134832683534e-05, 0.4220997202487e+01, 0.3163918923335e+00,\n      0.1770412139433e-05, 0.4747318496462e+01, 0.1021328554739e+02,\n      0.1377264209373e-05, 0.4305058462401e+00, 0.1484170571900e-02,\n      0.1127814538960e-05, 0.8538177240740e+00, 0.6327837846670e+00,\n      0.1055608090130e-05, 0.1551800742580e+01, 0.4337116142245e+00,\n      0.9802673861420e-06, 0.1459646735377e+01, 0.1052268489556e+01,\n      0.1090329461951e-05, 0.1587351228711e+01, 0.1162474756779e+01,\n\n      0.6959590025090e-06, 0.5534442628766e+01, 0.1066495398892e+01,\n      0.5664914529542e-06, 0.6030673003297e+01, 0.9491756770005e+00,\n      0.6607787763599e-06, 0.4989507233927e+01, 0.8460828644453e+00,\n      0.6269725742838e-06, 0.4222951804572e+01, 0.1480791608091e+00,\n      0.6301889697863e-06, 0.5444316669126e+01, 0.2243449970715e+00,\n      0.4891042662861e-06, 0.1490552839784e+01, 0.3340612434717e+01,\n      0.3457083123290e-06, 0.3030475486049e+01, 0.3516457698740e-01,\n      0.3032559967314e-06, 0.2652038793632e+01, 0.1104591729320e-01,\n      0.2841133988903e-06, 0.1276744786829e+01, 0.4110125927500e-01,\n      0.2855564444432e-06, 0.2143368674733e+01, 0.1510475019529e+00,\n\n      0.2765157135038e-06, 0.5444186109077e+01, 0.6373574839730e-01,\n      0.2382312465034e-06, 0.2190521137593e+01, 0.2275259891141e+00,\n      0.2808060365077e-06, 0.5735195064841e+01, 0.2535050500000e-01,\n      0.2332175234405e-06, 0.9481985524859e-01, 0.7181332454670e-01,\n      0.2322488199659e-06, 0.5180499361533e+01, 0.8582758298370e-01,\n      0.1881850258423e-06, 0.3219788273885e+01, 0.2118763888447e+01,\n      0.2196111392808e-06, 0.2366941159761e+01, 0.2968341143800e-02,\n      0.2183810335519e-06, 0.4825445110915e+01, 0.7775000683430e-01,\n      0.2002733093326e-06, 0.2457148995307e+01, 0.2093666171530e+00,\n      0.1967111767229e-06, 0.5586291545459e+01, 0.2172315424036e+00,\n\n      0.1568473250543e-06, 0.3708003123320e+01, 0.7429900518901e+00,\n      0.1852528314300e-06, 0.4310638151560e+01, 0.2022531624851e+00,\n      0.1832111226447e-06, 0.1494665322656e+01, 0.3235053470014e+00,\n      0.1746805502310e-06, 0.1451378500784e+01, 0.1385174140878e+00,\n      0.1555730966650e-06, 0.1068040418198e+01, 0.7358765972222e+00,\n      0.1554883462559e-06, 0.2442579035461e+01, 0.5154640627760e+00,\n      0.1638380568746e-06, 0.2597913420625e+00, 0.8531963191132e+00,\n      0.1159938593640e-06, 0.5834512021280e+01, 0.1990721704425e+00,\n      0.1083427965695e-06, 0.5054033177950e+01, 0.5439178814476e+00,\n      0.1156480369431e-06, 0.5325677432457e+01, 0.5257585094865e+00,\n\n      0.1141308860095e-06, 0.2153403923857e+01, 0.5336234347371e+00,\n      0.7913146470946e-07, 0.8642846847027e+00, 0.1478866649112e+01,\n      0.7439752463733e-07, 0.1970628496213e+01, 0.2164800718209e+00,\n      0.7280277104079e-07, 0.6073307250609e+01, 0.2101180877357e+00,\n      0.8319567719136e-07, 0.1954371928334e+01, 0.1692165728891e+01,\n      0.7137705549290e-07, 0.8904989440909e+00, 0.4155522422634e+00,\n      0.6900825396225e-07, 0.2825717714977e+01, 0.1173197218910e+00,\n      0.7245757216635e-07, 0.2481677513331e+01, 0.1265567569334e+01,\n      0.6961165696255e-07, 0.1292955312978e+01, 0.9562891316684e+00,\n      0.7571804456890e-07, 0.3427517575069e+01, 0.1422690933580e-01,\n\n      0.6605425721904e-07, 0.8052192701492e+00, 0.6470106940028e+00,\n      0.7375477357248e-07, 0.1705076390088e+01, 0.1581959461667e+01,\n      0.7041664951470e-07, 0.4848356967891e+00, 0.9597935788730e-01,\n      0.6322199535763e-07, 0.3878069473909e+01, 0.7084920306520e-01,\n      0.5244380279191e-07, 0.2645560544125e+01, 0.5265099800692e+00,\n      0.5143125704988e-07, 0.4834486101370e+01, 0.5328719641544e+00,\n      0.5871866319373e-07, 0.7981472548900e+00, 0.7871412831580e-01,\n      0.6300822573871e-07, 0.5979398788281e+01, 0.2608790314060e+02,\n      0.6062154271548e-07, 0.4108655402756e+01, 0.1114304132498e+00,\n      0.4361912339976e-07, 0.5322624319280e+01, 0.1375773836557e+01,\n\n      0.4417005920067e-07, 0.6240817359284e+01, 0.2770348281756e+00,\n      0.4686806749936e-07, 0.3214977301156e+01, 0.1143987543936e+00,\n      0.3758892132305e-07, 0.5879809634765e+01, 0.1596186371003e+01,\n      0.5151351332319e-07, 0.2893377688007e+00, 0.2228608264996e+00,\n      0.4554683578572e-07, 0.5475427144122e+01, 0.1465949902372e+00,\n      0.3442381385338e-07, 0.5992034796640e+01, 0.5070101000000e-01,\n      0.2831093954933e-07, 0.5367350273914e+01, 0.3092784376656e+00,\n      0.3756267090084e-07, 0.5758171285420e+01, 0.4903339079539e+00,\n      0.2816374679892e-07, 0.1863718700923e+01, 0.2991266627620e+00,\n      0.3419307025569e-07, 0.9524347534130e+00, 0.3518164938661e+00,\n\n      0.2904250494239e-07, 0.5304471615602e+01, 0.1099462426779e+00,\n      0.2471734511206e-07, 0.1297069793530e+01, 0.6256703299991e+00,\n      0.2539620831872e-07, 0.3281126083375e+01, 0.1256615170089e+02,\n      0.2281017868007e-07, 0.1829122133165e+01, 0.6681224869435e+01,\n      0.2275319473335e-07, 0.5797198160181e+01, 0.3932462625300e-02,\n      0.2547755368442e-07, 0.4752697708330e+01, 0.1169588211447e+01,\n      0.2285979669317e-07, 0.1223205292886e+01, 0.1045155034888e+01,\n      0.1913386560994e-07, 0.1757532993389e+01, 0.1155361302111e+01,\n      0.1809020525147e-07, 0.4246116108791e+01, 0.3368040641550e-01,\n      0.1649213300201e-07, 0.1445162890627e+01, 0.4408250688924e+00,\n\n      0.1834972793932e-07, 0.1126917567225e+01, 0.4452511715700e-02,\n      0.1439550648138e-07, 0.6160756834764e+01, 0.9420622223326e+00,\n      0.1487645457041e-07, 0.4358761931792e+01, 0.4123712502208e+00,\n      0.1731729516660e-07, 0.6134456753344e+01, 0.2108507877249e+00,\n      0.1717747163567e-07, 0.1898186084455e+01, 0.2157473718317e+00,\n      0.1418190430374e-07, 0.4180286741266e+01, 0.6521991896920e-01,\n      0.1404844134873e-07, 0.7654053565412e-01, 0.4258542984690e-01,\n      0.1409842846538e-07, 0.4418612420312e+01, 0.2258291676434e+00,\n      0.1090948346291e-07, 0.1260615686131e+01, 0.4226656969313e+00,\n      0.1357577323612e-07, 0.3558248818690e+01, 0.7923417740620e-01,\n\n      0.1018154061960e-07, 0.5676087241256e+01, 0.1456308687557e+00,\n      0.1412073972109e-07, 0.8394392632422e+00, 0.1525316725248e+00,\n      0.1030938326496e-07, 0.1653593274064e+01, 0.1795258541446e+01,\n      0.1180081567104e-07, 0.1285802592036e+01, 0.7032915397480e-01,\n      0.9708510575650e-08, 0.7631889488106e+00, 0.8434341241180e-01,\n      0.9637689663447e-08, 0.4630642649176e+01, 0.1272681024002e+01,\n      0.1068910429389e-07, 0.5294934032165e+01, 0.2123349582968e+00,\n      0.1063716179336e-07, 0.2736266800832e+01, 0.2142632012598e+00,\n      0.1234858713814e-07, 0.1302891146570e+01, 0.1847279083684e+00,\n      0.8912631189738e-08, 0.3570415993621e+01, 0.2648454860559e+01,\n\n      0.1036378285534e-07, 0.4236693440949e+01, 0.1370332435159e+00,\n      0.9667798501561e-08, 0.2960768892398e+01, 0.4376440768498e+00,\n      0.8108314201902e-08, 0.6987781646841e+00, 0.2880807454688e+00,\n      0.7648364324628e-08, 0.2499017863863e+01, 0.2037373330570e+00,\n      0.7286136828406e-08, 0.3787426951665e+01, 0.1129145838217e+00,\n      0.9448237743913e-08, 0.2694354332983e+01, 0.5272426800584e+00,\n      0.9374276106428e-08, 0.4787121277064e+01, 0.5321392641652e+00,\n      0.7100226287462e-08, 0.3530238792101e+00, 0.6288513220417e+00,\n      0.9253056659571e-08, 0.1399478925664e+01, 0.1606092486742e+00,\n      0.6636432145504e-08, 0.3479575438447e+01, 0.1368660381889e+01,\n\n      0.6469975312932e-08, 0.1383669964800e+01, 0.2008557621224e+01,\n      0.7335849729765e-08, 0.1243698166898e+01, 0.9561746721300e-02,\n      0.8743421205855e-08, 0.3776164289301e+01, 0.3801276407308e+00,\n      0.5993635744494e-08, 0.5627122113596e+01, 0.2042657109477e+02,\n      0.5981008479693e-08, 0.1674336636752e+01, 0.2111650433779e+01,\n      0.6188535145838e-08, 0.5214925208672e+01, 0.4305306221819e+00,\n      0.6596074017566e-08, 0.2907653268124e+01, 0.1063314406849e+01,\n      0.6630815126226e-08, 0.2127643669658e+01, 0.8389694097774e+00,\n      0.6156772830040e-08, 0.5082160803295e+01, 0.4234171675140e+00,\n      0.6446960563014e-08, 0.1872100916905e+01, 0.5287268506303e+00,\n\n      0.6429324424668e-08, 0.5610276103577e+01, 0.5306550935933e+00,\n      0.6302232396465e-08, 0.1592152049607e+01, 0.1253008786510e-01,\n      0.6399244436159e-08, 0.2746214421532e+01, 0.5217580628120e+02,\n      0.5474965172558e-08, 0.2317666374383e+01, 0.2221856701002e+01,\n      0.5339293190692e-08, 0.1084724961156e+01, 0.7466759693650e-01,\n      0.5334733683389e-08, 0.3594106067745e+01, 0.7489573444450e-01,\n      0.5392665782110e-08, 0.5630254365606e+01, 0.1055449481598e+01,\n      0.6682075673789e-08, 0.1518480041732e+01, 0.2213766559277e+00,\n      0.5079130495960e-08, 0.2739765115711e+01, 0.2132517061319e+00,\n      0.5077759793261e-08, 0.5290711290094e+01, 0.2133464534247e+00,\n\n      0.4832037368310e-08, 0.1404473217200e+01, 0.7160067364790e-01,\n      0.6463279674802e-08, 0.6038381695210e+01, 0.2209183458640e-01,\n      0.6240592771560e-08, 0.1290170653666e+01, 0.3306188016693e+00,\n      0.4672013521493e-08, 0.3261895939677e+01, 0.7796265773310e-01,\n      0.6500650750348e-08, 0.1154522312095e+01, 0.3884652414254e+00,\n      0.6344161389053e-08, 0.6206111545062e+01, 0.7605151500000e-01,\n      0.4682518370646e-08, 0.5409118796685e+01, 0.1073608853559e+01,\n      0.5329460015591e-08, 0.1202985784864e+01, 0.7287631425543e+00,\n      0.5701588675898e-08, 0.4098715257064e+01, 0.8731175355560e-01,\n      0.6030690867211e-08, 0.4132033218460e+00, 0.9846002785331e+00,\n\n      0.4336256312655e-08, 0.1211415991827e+01, 0.4297791515992e+00,\n      0.4688498808975e-08, 0.3765479072409e+01, 0.2127790306879e+00,\n      0.4675578609335e-08, 0.4265540037226e+01, 0.2138191288687e+00,\n      0.4225578112158e-08, 0.5237566010676e+01, 0.3407705765729e+00,\n      0.5139422230028e-08, 0.1507173079513e+01, 0.7233337363710e-01,\n      0.4619995093571e-08, 0.9023957449848e-01, 0.8603097737811e+00,\n      0.4494776255461e-08, 0.5414930552139e+00, 0.7381754420900e-01,\n      0.4274026276788e-08, 0.4145735303659e+01, 0.7574578717200e-01,\n      0.5018141789353e-08, 0.3344408829055e+01, 0.3180992042600e-02,\n      0.4866163952181e-08, 0.3348534657607e+01, 0.7722995774390e-01,\n\n      0.4111986020501e-08, 0.4198823597220e+00, 0.1451108196653e+00,\n      0.3356142784950e-08, 0.5609144747180e+01, 0.1274714967946e+00,\n      0.4070575554551e-08, 0.7028411059224e+00, 0.3503323232942e+00,\n      0.3257451857278e-08, 0.5624697983086e+01, 0.5296435984654e+00,\n      0.3256973703026e-08, 0.1857842076707e+01, 0.5297383457582e+00,\n      0.3830771508640e-08, 0.4562887279931e+01, 0.9098186128426e+00,\n      0.3725024005962e-08, 0.2358058692652e+00, 0.1084620721060e+00,\n      0.3136763921756e-08, 0.2049731526845e+01, 0.2346394437820e+00,\n      0.3795147256194e-08, 0.2432356296933e+00, 0.1862120789403e+00,\n      0.2877342229911e-08, 0.5631101279387e+01, 0.1905464808669e+01,\n\n      0.3076931798805e-08, 0.1117615737392e+01, 0.3628624111593e+00,\n      0.2734765945273e-08, 0.5899826516955e+01, 0.2131850110243e+00,\n      0.2733405296885e-08, 0.2130562964070e+01, 0.2134131485323e+00,\n      0.2898552353410e-08, 0.3462387048225e+00, 0.5291709230214e+00,\n      0.2893736103681e-08, 0.8534352781543e+00, 0.5302110212022e+00,\n      0.3095717734137e-08, 0.2875061429041e+01, 0.2976424921901e+00,\n      0.2636190425832e-08, 0.2242512846659e+01, 0.1485980103780e+01,\n      0.3645512095537e-08, 0.1354016903958e+01, 0.6044726378023e+00,\n      0.2808173547723e-08, 0.6705114365631e-01, 0.6225157782540e-01,\n      0.2625012866888e-08, 0.4775705748482e+01, 0.5268983110410e-01,\n\n      0.2572233995651e-08, 0.2638924216139e+01, 0.1258454114666e+01,\n      0.2604238824792e-08, 0.4826358927373e+01, 0.2103781122809e+00,\n      0.2596886385239e-08, 0.3200388483118e+01, 0.2162200472757e+00,\n      0.3228057304264e-08, 0.5384848409563e+01, 0.2007689919132e+00,\n      0.2481601798252e-08, 0.5173373487744e+01, 0.1062562936266e+01,\n      0.2745977498864e-08, 0.6250966149853e+01, 0.5651155736444e+00,\n      0.2669878833811e-08, 0.4906001352499e+01, 0.1400015846597e+00,\n      0.3203986611711e-08, 0.5034333010005e+01, 0.7036329877322e+00,\n      0.3354961227212e-08, 0.6108262423137e+01, 0.4549093064213e+00,\n      0.2400407324558e-08, 0.2135399294955e+01, 0.2125476091956e+00,\n\n      0.2379905859802e-08, 0.5893721933961e+01, 0.2140505503610e+00,\n      0.2550844302187e-08, 0.3331940762063e+01, 0.1534957940063e+00,\n      0.2268824211001e-08, 0.1843418461035e+01, 0.2235935264888e+00,\n      0.2464700891204e-08, 0.3029548547230e+01, 0.2091065926078e+00,\n      0.2436814726024e-08, 0.4994717970364e+01, 0.2174915669488e+00,\n      0.2443623894745e-08, 0.2645102591375e+01, 0.1739420156204e+00,\n      0.2318701783838e-08, 0.5700547397897e+01, 0.7530171478090e-01,\n      0.2284448700256e-08, 0.5268898905872e+01, 0.7426161660010e-01,\n      0.2468848123510e-08, 0.5276280575078e+01, 0.2526561439362e+00,\n      0.2814052350303e-08, 0.6130168623475e+01, 0.5636314030725e+00,\n\n      0.2243662755220e-08, 0.6631692457995e+00, 0.8886590321940e-01,\n      0.2330795855941e-08, 0.2499435487702e+01, 0.1056200952181e+01,\n      0.9757679038404e-09, 0.5796846023126e+01, 0.7826370942180e+02 };\n\n/* SSB-to-Sun, T^0, Z */\n   static const double s0z[] = {\n      0.1181255122986e-03, 0.4607918989164e+00, 0.2132990797783e+00,\n      0.1127777651095e-03, 0.4169146331296e+00, 0.5296909721118e+00,\n      0.4777754401806e-04, 0.4582657007130e+01, 0.3813291813120e-01,\n      0.1129354285772e-04, 0.5758735142480e+01, 0.7478166569050e-01,\n     -0.1149543637123e-04, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.3298730512306e-05, 0.5978801994625e+01, 0.4265981595566e+00,\n      0.2733376706079e-05, 0.7665413691040e+00, 0.1059381944224e+01,\n      0.9426389657270e-06, 0.3710201265838e+01, 0.2061856251104e+00,\n      0.8187517749552e-06, 0.3390675605802e+00, 0.2204125344462e+00,\n      0.4080447871819e-06, 0.4552296640088e+00, 0.5225775174439e+00,\n\n      0.3169973017028e-06, 0.3445455899321e+01, 0.5368044267797e+00,\n      0.2438098615549e-06, 0.5664675150648e+01, 0.3664874755930e-01,\n      0.2601897517235e-06, 0.1931894095697e+01, 0.1495633313810e+00,\n      0.2314558080079e-06, 0.3666319115574e+00, 0.3961708870310e-01,\n      0.1962549548002e-06, 0.3167411699020e+01, 0.7626583626240e-01,\n      0.2180518287925e-06, 0.1544420746580e+01, 0.7113454667900e-02,\n      0.1451382442868e-06, 0.1583756740070e+01, 0.1102062672231e+00,\n      0.1358439007389e-06, 0.5239941758280e+01, 0.6398972393349e+00,\n      0.1050585898028e-06, 0.2266958352859e+01, 0.3163918923335e+00,\n      0.1050029870186e-06, 0.2711495250354e+01, 0.4194847048887e+00,\n\n      0.9934920679800e-07, 0.1116208151396e+01, 0.1589072916335e+01,\n      0.1048395331560e-06, 0.3408619600206e+01, 0.1021328554739e+02,\n      0.8370147196668e-07, 0.3810459401087e+01, 0.2535050500000e-01,\n      0.7989856510998e-07, 0.3769910473647e+01, 0.7329749511860e-01,\n      0.5441221655233e-07, 0.2416994903374e+01, 0.1030928125552e+00,\n      0.4610812906784e-07, 0.5858503336994e+01, 0.4337116142245e+00,\n      0.3923022803444e-07, 0.3354170010125e+00, 0.1484170571900e-02,\n      0.2610725582128e-07, 0.5410600646324e+01, 0.6327837846670e+00,\n      0.2455279767721e-07, 0.6120216681403e+01, 0.1162474756779e+01,\n      0.2375530706525e-07, 0.6055443426143e+01, 0.1052268489556e+01,\n\n      0.1782967577553e-07, 0.3146108708004e+01, 0.8460828644453e+00,\n      0.1581687095238e-07, 0.6255496089819e+00, 0.3340612434717e+01,\n      0.1594657672461e-07, 0.3782604300261e+01, 0.1066495398892e+01,\n      0.1563448615040e-07, 0.1997775733196e+01, 0.2022531624851e+00,\n      0.1463624258525e-07, 0.1736316792088e+00, 0.3516457698740e-01,\n      0.1331585056673e-07, 0.4331941830747e+01, 0.9491756770005e+00,\n      0.1130634557637e-07, 0.6152017751825e+01, 0.2968341143800e-02,\n      0.1028949607145e-07, 0.2101792614637e+00, 0.2275259891141e+00,\n      0.1024074971618e-07, 0.4071833211074e+01, 0.5070101000000e-01,\n      0.8826956060303e-08, 0.4861633688145e+00, 0.2093666171530e+00,\n\n      0.8572230171541e-08, 0.5268190724302e+01, 0.4110125927500e-01,\n      0.7649332643544e-08, 0.5134543417106e+01, 0.2608790314060e+02,\n      0.8581673291033e-08, 0.2920218146681e+01, 0.1480791608091e+00,\n      0.8430589300938e-08, 0.3604576619108e+01, 0.2172315424036e+00,\n      0.7776165501012e-08, 0.3772942249792e+01, 0.6373574839730e-01,\n      0.8311070234408e-08, 0.6200412329888e+01, 0.3235053470014e+00,\n      0.6927365212582e-08, 0.4543353113437e+01, 0.8531963191132e+00,\n      0.6791574208598e-08, 0.2882188406238e+01, 0.7181332454670e-01,\n      0.5593100811839e-08, 0.1776646892780e+01, 0.7429900518901e+00,\n      0.4553381853021e-08, 0.3949617611240e+01, 0.7775000683430e-01,\n\n      0.5758000450068e-08, 0.3859251775075e+01, 0.1990721704425e+00,\n      0.4281283457133e-08, 0.1466294631206e+01, 0.2118763888447e+01,\n      0.4206935661097e-08, 0.5421776011706e+01, 0.1104591729320e-01,\n      0.4213751641837e-08, 0.3412048993322e+01, 0.2243449970715e+00,\n      0.5310506239878e-08, 0.5421641370995e+00, 0.5154640627760e+00,\n      0.3827450341320e-08, 0.8887314524995e+00, 0.1510475019529e+00,\n      0.4292435241187e-08, 0.1405043757194e+01, 0.1422690933580e-01,\n      0.3189780702289e-08, 0.1060049293445e+01, 0.1173197218910e+00,\n      0.3226611928069e-08, 0.6270858897442e+01, 0.2164800718209e+00,\n      0.2893897608830e-08, 0.5117563223301e+01, 0.6470106940028e+00,\n\n      0.3239852024578e-08, 0.4079092237983e+01, 0.2101180877357e+00,\n      0.2956892222200e-08, 0.1594917021704e+01, 0.3092784376656e+00,\n      0.2980177912437e-08, 0.5258787667564e+01, 0.4155522422634e+00,\n      0.3163725690776e-08, 0.3854589225479e+01, 0.8582758298370e-01,\n      0.2662262399118e-08, 0.3561326430187e+01, 0.5257585094865e+00,\n      0.2766689135729e-08, 0.3180732086830e+00, 0.1385174140878e+00,\n      0.2411600278464e-08, 0.3324798335058e+01, 0.5439178814476e+00,\n      0.2483527695131e-08, 0.4169069291947e+00, 0.5336234347371e+00,\n      0.7788777276590e-09, 0.1900569908215e+01, 0.5217580628120e+02 };\n\n/* SSB-to-Sun, T^1, X */\n   static const double s1x[] = {\n     -0.1296310361520e-07, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.8975769009438e-08, 0.1128891609250e+01, 0.4265981595566e+00,\n      0.7771113441307e-08, 0.2706039877077e+01, 0.2061856251104e+00,\n      0.7538303866642e-08, 0.2191281289498e+01, 0.2204125344462e+00,\n      0.6061384579336e-08, 0.3248167319958e+01, 0.1059381944224e+01,\n      0.5726994235594e-08, 0.5569981398610e+01, 0.5225775174439e+00,\n      0.5616492836424e-08, 0.5057386614909e+01, 0.5368044267797e+00,\n      0.1010881584769e-08, 0.3473577116095e+01, 0.7113454667900e-02,\n      0.7259606157626e-09, 0.3651858593665e+00, 0.6398972393349e+00,\n      0.8755095026935e-09, 0.1662835408338e+01, 0.4194847048887e+00,\n\n      0.5370491182812e-09, 0.1327673878077e+01, 0.4337116142245e+00,\n      0.5743773887665e-09, 0.4250200846687e+01, 0.2132990797783e+00,\n      0.4408103140300e-09, 0.3598752574277e+01, 0.1589072916335e+01,\n      0.3101892374445e-09, 0.4887822983319e+01, 0.1052268489556e+01,\n      0.3209453713578e-09, 0.9702272295114e+00, 0.5296909721118e+00,\n      0.3017228286064e-09, 0.5484462275949e+01, 0.1066495398892e+01,\n      0.3200700038601e-09, 0.2846613338643e+01, 0.1495633313810e+00,\n      0.2137637279911e-09, 0.5692163292729e+00, 0.3163918923335e+00,\n      0.1899686386727e-09, 0.2061077157189e+01, 0.2275259891141e+00,\n      0.1401994545308e-09, 0.4177771136967e+01, 0.1102062672231e+00,\n\n      0.1578057810499e-09, 0.5782460597335e+01, 0.7626583626240e-01,\n      0.1237713253351e-09, 0.5705900866881e+01, 0.5154640627760e+00,\n      0.1313076837395e-09, 0.5163438179576e+01, 0.3664874755930e-01,\n      0.1184963304860e-09, 0.3054804427242e+01, 0.6327837846670e+00,\n      0.1238130878565e-09, 0.2317292575962e+01, 0.3961708870310e-01,\n      0.1015959527736e-09, 0.2194643645526e+01, 0.7329749511860e-01,\n      0.9017954423714e-10, 0.2868603545435e+01, 0.1990721704425e+00,\n      0.8668024955603e-10, 0.4923849675082e+01, 0.5439178814476e+00,\n      0.7756083930103e-10, 0.3014334135200e+01, 0.9491756770005e+00,\n      0.7536503401741e-10, 0.2704886279769e+01, 0.1030928125552e+00,\n\n      0.5483308679332e-10, 0.6010983673799e+01, 0.8531963191132e+00,\n      0.5184339620428e-10, 0.1952704573291e+01, 0.2093666171530e+00,\n      0.5108658712030e-10, 0.2958575786649e+01, 0.2172315424036e+00,\n      0.5019424524650e-10, 0.1736317621318e+01, 0.2164800718209e+00,\n      0.4909312625978e-10, 0.3167216416257e+01, 0.2101180877357e+00,\n      0.4456638901107e-10, 0.7697579923471e+00, 0.3235053470014e+00,\n      0.4227030350925e-10, 0.3490910137928e+01, 0.6373574839730e-01,\n      0.4095456040093e-10, 0.5178888984491e+00, 0.6470106940028e+00,\n      0.4990537041422e-10, 0.3323887668974e+01, 0.1422690933580e-01,\n      0.4321170010845e-10, 0.4288484987118e+01, 0.7358765972222e+00,\n\n      0.3544072091802e-10, 0.6021051579251e+01, 0.5265099800692e+00,\n      0.3480198638687e-10, 0.4600027054714e+01, 0.5328719641544e+00,\n      0.3440287244435e-10, 0.4349525970742e+01, 0.8582758298370e-01,\n      0.3330628322713e-10, 0.2347391505082e+01, 0.1104591729320e-01,\n      0.2973060707184e-10, 0.4789409286400e+01, 0.5257585094865e+00,\n      0.2932606766089e-10, 0.5831693799927e+01, 0.5336234347371e+00,\n      0.2876972310953e-10, 0.2692638514771e+01, 0.1173197218910e+00,\n      0.2827488278556e-10, 0.2056052487960e+01, 0.2022531624851e+00,\n      0.2515028239756e-10, 0.7411863262449e+00, 0.9597935788730e-01,\n      0.2853033744415e-10, 0.3948481024894e+01, 0.2118763888447e+01 };\n\n/* SSB-to-Sun, T^1, Y */\n   static const double s1y[] = {\n      0.8989047573576e-08, 0.5840593672122e+01, 0.4265981595566e+00,\n      0.7815938401048e-08, 0.1129664707133e+01, 0.2061856251104e+00,\n      0.7550926713280e-08, 0.6196589104845e+00, 0.2204125344462e+00,\n      0.6056556925895e-08, 0.1677494667846e+01, 0.1059381944224e+01,\n      0.5734142698204e-08, 0.4000920852962e+01, 0.5225775174439e+00,\n      0.5614341822459e-08, 0.3486722577328e+01, 0.5368044267797e+00,\n      0.1028678147656e-08, 0.1877141024787e+01, 0.7113454667900e-02,\n      0.7270792075266e-09, 0.5077167301739e+01, 0.6398972393349e+00,\n      0.8734141726040e-09, 0.9069550282609e-01, 0.4194847048887e+00,\n      0.5377371402113e-09, 0.6039381844671e+01, 0.4337116142245e+00,\n\n      0.4729719431571e-09, 0.2153086311760e+01, 0.2132990797783e+00,\n      0.4458052820973e-09, 0.5059830025565e+01, 0.5296909721118e+00,\n      0.4406855467908e-09, 0.2027971692630e+01, 0.1589072916335e+01,\n      0.3101659310977e-09, 0.3317677981860e+01, 0.1052268489556e+01,\n      0.3016749232545e-09, 0.3913703482532e+01, 0.1066495398892e+01,\n      0.3198541352656e-09, 0.1275513098525e+01, 0.1495633313810e+00,\n      0.2142065389871e-09, 0.5301351614597e+01, 0.3163918923335e+00,\n      0.1902615247592e-09, 0.4894943352736e+00, 0.2275259891141e+00,\n      0.1613410990871e-09, 0.2449891130437e+01, 0.1102062672231e+00,\n      0.1576992165097e-09, 0.4211421447633e+01, 0.7626583626240e-01,\n\n      0.1241637259894e-09, 0.4140803368133e+01, 0.5154640627760e+00,\n      0.1313974830355e-09, 0.3591920305503e+01, 0.3664874755930e-01,\n      0.1181697118258e-09, 0.1506314382788e+01, 0.6327837846670e+00,\n      0.1238239742779e-09, 0.7461405378404e+00, 0.3961708870310e-01,\n      0.1010107068241e-09, 0.6271010795475e+00, 0.7329749511860e-01,\n      0.9226316616509e-10, 0.1259158839583e+01, 0.1990721704425e+00,\n      0.8664946419555e-10, 0.3353244696934e+01, 0.5439178814476e+00,\n      0.7757230468978e-10, 0.1447677295196e+01, 0.9491756770005e+00,\n      0.7693168628139e-10, 0.1120509896721e+01, 0.1030928125552e+00,\n      0.5487897454612e-10, 0.4439380426795e+01, 0.8531963191132e+00,\n\n      0.5196118677218e-10, 0.3788856619137e+00, 0.2093666171530e+00,\n      0.5110853339935e-10, 0.1386879372016e+01, 0.2172315424036e+00,\n      0.5027804534813e-10, 0.1647881805466e+00, 0.2164800718209e+00,\n      0.4922485922674e-10, 0.1594315079862e+01, 0.2101180877357e+00,\n      0.6155599524400e-10, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.4447147832161e-10, 0.5480720918976e+01, 0.3235053470014e+00,\n      0.4144691276422e-10, 0.1931371033660e+01, 0.6373574839730e-01,\n      0.4099950625452e-10, 0.5229611294335e+01, 0.6470106940028e+00,\n      0.5060541682953e-10, 0.1731112486298e+01, 0.1422690933580e-01,\n      0.4293615946300e-10, 0.2714571038925e+01, 0.7358765972222e+00,\n\n      0.3545659845763e-10, 0.4451041444634e+01, 0.5265099800692e+00,\n      0.3479112041196e-10, 0.3029385448081e+01, 0.5328719641544e+00,\n      0.3438516493570e-10, 0.2778507143731e+01, 0.8582758298370e-01,\n      0.3297341285033e-10, 0.7898709807584e+00, 0.1104591729320e-01,\n      0.2972585818015e-10, 0.3218785316973e+01, 0.5257585094865e+00,\n      0.2931707295017e-10, 0.4260731012098e+01, 0.5336234347371e+00,\n      0.2897198149403e-10, 0.1120753978101e+01, 0.1173197218910e+00,\n      0.2832293240878e-10, 0.4597682717827e+00, 0.2022531624851e+00,\n      0.2864348326612e-10, 0.2169939928448e+01, 0.9597935788730e-01,\n      0.2852714675471e-10, 0.2377659870578e+01, 0.2118763888447e+01 };\n\n/* SSB-to-Sun, T^1, Z */\n   static const double s1z[] = {\n      0.5444220475678e-08, 0.1803825509310e+01, 0.2132990797783e+00,\n      0.3883412695596e-08, 0.4668616389392e+01, 0.5296909721118e+00,\n      0.1334341434551e-08, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.3730001266883e-09, 0.5401405918943e+01, 0.2061856251104e+00,\n      0.2894929197956e-09, 0.4932415609852e+01, 0.2204125344462e+00,\n      0.2857950357701e-09, 0.3154625362131e+01, 0.7478166569050e-01,\n      0.2499226432292e-09, 0.3657486128988e+01, 0.4265981595566e+00,\n      0.1937705443593e-09, 0.5740434679002e+01, 0.1059381944224e+01,\n      0.1374894396320e-09, 0.1712857366891e+01, 0.5368044267797e+00,\n      0.1217248678408e-09, 0.2312090870932e+01, 0.5225775174439e+00,\n\n      0.7961052740870e-10, 0.5283368554163e+01, 0.3813291813120e-01,\n      0.4979225949689e-10, 0.4298290471860e+01, 0.4194847048887e+00,\n      0.4388552286597e-10, 0.6145515047406e+01, 0.7113454667900e-02,\n      0.2586835212560e-10, 0.3019448001809e+01, 0.6398972393349e+00 };\n\n/* SSB-to-Sun, T^2, X */\n   static const double s2x[] = {\n      0.1603551636587e-11, 0.4404109410481e+01, 0.2061856251104e+00,\n      0.1556935889384e-11, 0.4818040873603e+00, 0.2204125344462e+00,\n      0.1182594414915e-11, 0.9935762734472e+00, 0.5225775174439e+00,\n      0.1158794583180e-11, 0.3353180966450e+01, 0.5368044267797e+00,\n      0.9597358943932e-12, 0.5567045358298e+01, 0.2132990797783e+00,\n      0.6511516579605e-12, 0.5630872420788e+01, 0.4265981595566e+00,\n      0.7419792747688e-12, 0.2156188581957e+01, 0.5296909721118e+00,\n      0.3951972655848e-12, 0.1981022541805e+01, 0.1059381944224e+01,\n      0.4478223877045e-12, 0.0000000000000e+00, 0.0000000000000e+00 };\n\n/* SSB-to-Sun, T^2, Y */\n   static const double s2y[] = {\n      0.1609114495091e-11, 0.2831096993481e+01, 0.2061856251104e+00,\n      0.1560330784946e-11, 0.5193058213906e+01, 0.2204125344462e+00,\n      0.1183535479202e-11, 0.5707003443890e+01, 0.5225775174439e+00,\n      0.1158183066182e-11, 0.1782400404928e+01, 0.5368044267797e+00,\n      0.1032868027407e-11, 0.4036925452011e+01, 0.2132990797783e+00,\n      0.6540142847741e-12, 0.4058241056717e+01, 0.4265981595566e+00,\n      0.7305236491596e-12, 0.6175401942957e+00, 0.5296909721118e+00,\n     -0.5580725052968e-12, 0.0000000000000e+00, 0.0000000000000e+00,\n      0.3946122651015e-12, 0.4108265279171e+00, 0.1059381944224e+01 };\n\n/* SSB-to-Sun, T^2, Z */\n   static const double s2z[] = {\n      0.3749920358054e-12, 0.3230285558668e+01, 0.2132990797783e+00,\n      0.2735037220939e-12, 0.6154322683046e+01, 0.5296909721118e+00 };\n\n/* Pointers to coefficient arrays, in x,y,z sets */\n   static const double *ce0[] = { e0x, e0y, e0z },\n                       *ce1[] = { e1x, e1y, e1z },\n                       *ce2[] = { e2x, e2y, e2z },\n                       *cs0[] = { s0x, s0y, s0z },\n                       *cs1[] = { s1x, s1y, s1z },\n                       *cs2[] = { s2x, s2y, s2z };\n   const double *coeffs;\n\n/* Numbers of terms for each component of the model, in x,y,z sets */\n   static const int ne0[3] = {(int)(sizeof e0x / sizeof (double) / 3),\n                              (int)(sizeof e0y / sizeof (double) / 3),\n                              (int)(sizeof e0z / sizeof (double) / 3) },\n                    ne1[3] = {(int)(sizeof e1x / sizeof (double) / 3),\n                              (int)(sizeof e1y / sizeof (double) / 3),\n                              (int)(sizeof e1z / sizeof (double) / 3) },\n                    ne2[3] = {(int)(sizeof e2x / sizeof (double) / 3),\n                              (int)(sizeof e2y / sizeof (double) / 3),\n                              (int)(sizeof e2z / sizeof (double) / 3) },\n                    ns0[3] = {(int)(sizeof s0x / sizeof (double) / 3),\n                              (int)(sizeof s0y / sizeof (double) / 3),\n                              (int)(sizeof s0z / sizeof (double) / 3) },\n                    ns1[3] = {(int)(sizeof s1x / sizeof (double) / 3),\n                              (int)(sizeof s1y / sizeof (double) / 3),\n                              (int)(sizeof s1z / sizeof (double) / 3) },\n                    ns2[3] = {(int)(sizeof s2x / sizeof (double) / 3),\n                              (int)(sizeof s2y / sizeof (double) / 3),\n                              (int)(sizeof s2z / sizeof (double) / 3) };\n   int nterms;\n\n/* Miscellaneous */\n   int jstat, i, j;\n   double t, t2, xyz, xyzd, a, b, c, ct, p, cp,\n          ph[3], vh[3], pb[3], vb[3], x, y, z;\n\n/*--------------------------------------------------------------------*/\n\n/* Time since reference epoch, Julian years. */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY;\n   t2 = t*t;\n\n/* Set status. */\n   jstat = fabs(t) <= 100.0 ? 0 : 1;\n\n/* X then Y then Z. */\n   for (i = 0; i < 3; i++) {\n\n   /* Initialize position and velocity component. */\n      xyz = 0.0;\n      xyzd = 0.0;\n\n   /* ------------------------------------------------ */\n   /* Obtain component of Sun to Earth ecliptic vector */\n   /* ------------------------------------------------ */\n\n   /* Sun to Earth, T^0 terms. */\n      coeffs = ce0[i];\n      nterms = ne0[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         p = b + c*t;\n         xyz  += a*cos(p);\n         xyzd -= a*c*sin(p);\n      }\n\n   /* Sun to Earth, T^1 terms. */\n      coeffs = ce1[i];\n      nterms = ne1[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         ct = c*t;\n         p = b + ct;\n         cp = cos(p);\n         xyz  += a*t*cp;\n         xyzd += a*( cp - ct*sin(p) );\n      }\n\n   /* Sun to Earth, T^2 terms. */\n      coeffs = ce2[i];\n      nterms = ne2[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         ct = c*t;\n         p = b + ct;\n         cp = cos(p);\n         xyz  += a*t2*cp;\n         xyzd += a*t*( 2.0*cp - ct*sin(p) );\n      }\n\n   /* Heliocentric Earth position and velocity component. */\n      ph[i] = xyz;\n      vh[i] = xyzd / ERFA_DJY;\n\n   /* ------------------------------------------------ */\n   /* Obtain component of SSB to Earth ecliptic vector */\n   /* ------------------------------------------------ */\n\n   /* SSB to Sun, T^0 terms. */\n      coeffs = cs0[i];\n      nterms = ns0[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         p = b + c*t;\n         xyz  += a*cos(p);\n         xyzd -= a*c*sin(p);\n      }\n\n   /* SSB to Sun, T^1 terms. */\n      coeffs = cs1[i];\n      nterms = ns1[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         ct = c*t;\n         p = b + ct;\n         cp = cos(p);\n         xyz  += a*t*cp;\n         xyzd += a*(cp - ct*sin(p));\n      }\n\n   /* SSB to Sun, T^2 terms. */\n      coeffs = cs2[i];\n      nterms = ns2[i];\n      for (j = 0; j < nterms; j++) {\n         a = *coeffs++;\n         b = *coeffs++;\n         c = *coeffs++;\n         ct = c*t;\n         p = b + ct;\n         cp = cos(p);\n         xyz  += a*t2*cp;\n         xyzd += a*t*(2.0*cp - ct*sin(p));\n     }\n\n   /* Barycentric Earth position and velocity component. */\n     pb[i] = xyz;\n     vb[i] = xyzd / ERFA_DJY;\n\n   /* Next Cartesian component. */\n   }\n\n/* Rotate from ecliptic to BCRS coordinates. */\n\n   x = ph[0];\n   y = ph[1];\n   z = ph[2];\n   pvh[0][0] =      x + am12*y + am13*z;\n   pvh[0][1] = am21*x + am22*y + am23*z;\n   pvh[0][2] =          am32*y + am33*z;\n\n   x = vh[0];\n   y = vh[1];\n   z = vh[2];\n   pvh[1][0] =      x + am12*y + am13*z;\n   pvh[1][1] = am21*x + am22*y + am23*z;\n   pvh[1][2] =          am32*y + am33*z;\n\n   x = pb[0];\n   y = pb[1];\n   z = pb[2];\n   pvb[0][0] =      x + am12*y + am13*z;\n   pvb[0][1] = am21*x + am22*y + am23*z;\n   pvb[0][2] =          am32*y + am33*z;\n\n   x = vb[0];\n   y = vb[1];\n   z = vb[2];\n   pvb[1][0] =      x + am12*y + am13*z;\n   pvb[1][1] = am21*x + am22*y + am23*z;\n   pvb[1][2] =          am32*y + am33*z;\n\n/* Return the status. */\n   return jstat;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13187,"name":"s2pv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraS2pv(double theta, double phi, double r,\n             double td, double pd, double rd,\n             double pv[2][3])\n/*\n**  - - - - - - - -\n**   e r a S 2 p v\n**  - - - - - - - -\n**\n**  Convert position/velocity from spherical to Cartesian coordinates.\n**\n**  Given:\n**     theta    double          longitude angle (radians)\n**     phi      double          latitude angle (radians)\n**     r        double          radial distance\n**     td       double          rate of change of theta\n**     pd       double          rate of change of phi\n**     rd       double          rate of change of r\n**\n**  Returned:\n**     pv       double[2][3]    pv-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double st, ct, sp, cp, rcp, x, y, rpd, w;\n\n\n   st = sin(theta);\n   ct = cos(theta);\n   sp = sin(phi);\n   cp = cos(phi);\n   rcp = r * cp;\n   x = rcp * ct;\n   y = rcp * st;\n   rpd = r * pd;\n   w = rpd*sp - cp*rd;\n\n   pv[0][0] = x;\n   pv[0][1] = y;\n   pv[0][2] = r * sp;\n   pv[1][0] = -y*td - w*ct;\n   pv[1][1] =  x*td - w*st;\n   pv[1][2] = rpd*cp + sp*rd;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13188,"name":"zp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraZp(double p[3])\n/*\n**  - - - - - -\n**   e r a Z p\n**  - - - - - -\n**\n**  Zero a p-vector.\n**\n**  Returned:\n**     p        double[3]      p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   p[0] = 0.0;\n   p[1] = 0.0;\n   p[2] = 0.0;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13189,"name":"pxp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPxp(double a[3], double b[3], double axb[3])\n/*\n**  - - - - - - -\n**   e r a P x p\n**  - - - - - - -\n**\n**  p-vector outer (=vector=cross) product.\n**\n**  Given:\n**     a        double[3]      first p-vector\n**     b        double[3]      second p-vector\n**\n**  Returned:\n**     axb      double[3]      a x b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double xa, ya, za, xb, yb, zb;\n\n\n   xa = a[0];\n   ya = a[1];\n   za = a[2];\n   xb = b[0];\n   yb = b[1];\n   zb = b[2];\n   axb[0] = ya*zb - za*yb;\n   axb[1] = za*xb - xa*zb;\n   axb[2] = xa*yb - ya*xb;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13190,"name":"cp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraCp(double p[3], double c[3])\n/*\n**  - - - - - -\n**   e r a C p\n**  - - - - - -\n**\n**  Copy a p-vector.\n**\n**  Given:\n**     p        double[3]     p-vector to be copied\n**\n**  Returned:\n**     c        double[3]     copy\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   c[0] = p[0];\n   c[1] = p[1];\n   c[2] = p[2];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13191,"name":"fasa03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFasa03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a s a 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Saturn.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Saturn, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Saturn (IERS Conventions 2003). */\n   a = fmod(0.874016757 + 21.3299104960 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13192,"name":"pvdpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvdpv(double a[2][3], double b[2][3], double adb[2])\n/*\n**  - - - - - - - - -\n**   e r a P v d p v\n**  - - - - - - - - -\n**\n**  Inner (=scalar=dot) product of two pv-vectors.\n**\n**  Given:\n**     a        double[2][3]      first pv-vector\n**     b        double[2][3]      second pv-vector\n**\n**  Returned:\n**     adb      double[2]         a . b (see note)\n**\n**  Note:\n**\n**     If the position and velocity components of the two pv-vectors are\n**     ( ap, av ) and ( bp, bv ), the result, a . b, is the pair of\n**     numbers ( ap . bp , ap . bv + av . bp ).  The two numbers are the\n**     dot-product of the two p-vectors and its derivative.\n**\n**  Called:\n**     eraPdp       scalar product of two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double adbd, addb;\n\n\n/* a . b = constant part of result. */\n   adb[0] = eraPdp(a[0], b[0]);\n\n/* a . bdot */\n   adbd = eraPdp(a[0], b[1]);\n\n/* adot . b */\n   addb = eraPdp(a[1], b[0]);\n\n/* Velocity part of result. */\n   adb[1] = adbd + addb;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13193,"name":"ut1utc.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraUt1utc(double ut11, double ut12, double dut1,\n              double *utc1, double *utc2)\n/*\n**  - - - - - - - - - -\n**   e r a U t 1 u t c\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Universal Time, UT1, to Coordinated\n**  Universal Time, UTC.\n**\n**  Given:\n**     ut11,ut12  double   UT1 as a 2-part Julian Date (Note 1)\n**     dut1       double   Delta UT1: UT1-UTC in seconds (Note 2)\n**\n**  Returned:\n**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 3,4)\n**\n**  Returned (function value):\n**                int      status: +1 = dubious year (Note 5)\n**                                  0 = OK\n**                                 -1 = unacceptable date\n**\n**  Notes:\n**\n**  1) ut11+ut12 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where ut11 is the Julian\n**     Day Number and ut12 is the fraction of a day.  The returned utc1\n**     and utc2 form an analogous pair, except that a special convention\n**     is used, to deal with the problem of leap seconds - see Note 3.\n**\n**  2) Delta UT1 can be obtained from tabulations provided by the\n**     International Earth Rotation and Reference Systems Service.  The\n**     value changes abruptly by 1s at a leap second;  however, close to\n**     a leap second the algorithm used here is tolerant of the \"wrong\"\n**     choice of value being made.\n**\n**  3) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The convention in the present\n**     function is that the returned quasi JD day UTC1+UTC2 represents\n**     UTC days whether the length is 86399, 86400 or 86401 SI seconds.\n**\n**  4) The function eraD2dtf can be used to transform the UTC quasi-JD\n**     into calendar date and clock time, including UTC leap second\n**     handling.\n**\n**  5) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  Called:\n**     eraJd2cal    JD to Gregorian calendar\n**     eraDat       delta(AT) = TAI-UTC\n**     eraCal2jd    Gregorian calendar to JD\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int big1;\n   int i, iy, im, id, js;\n   double duts, u1, u2, d1, dats1, d2, fd, dats2, ddats, us1, us2, du;\n\n\n/* UT1-UTC in seconds. */\n   duts = dut1;\n\n/* Put the two parts of the UT1 into big-first order. */\n   big1 = ( ut11 >= ut12 );\n   if ( big1 ) {\n      u1 = ut11;\n      u2 = ut12;\n   } else {\n      u1 = ut12;\n      u2 = ut11;\n   }\n\n/* See if the UT1 can possibly be in a leap-second day. */\n   d1 = u1;\n   dats1 = 0;\n   for ( i = -1; i <= 3; i++ ) {\n      d2 = u2 + (double) i;\n      if ( eraJd2cal(d1, d2, &iy, &im, &id, &fd) ) return -1;\n      js = eraDat(iy, im, id, 0.0, &dats2);\n      if ( js < 0 ) return -1;\n      if ( i == - 1 ) dats1 = dats2;\n      ddats = dats2 - dats1;\n      if ( fabs(ddats) >= 0.5 ) {\n\n      /* Yes, leap second nearby: ensure UT1-UTC is \"before\" value. */\n         if ( ddats * duts >= 0 ) duts -= ddats;\n\n      /* UT1 for the start of the UTC day that ends in a leap. */\n         if ( eraCal2jd(iy, im, id, &d1, &d2) ) return -1;\n         us1 = d1;\n         us2 = d2 - 1.0 + duts/ERFA_DAYSEC;\n\n      /* Is the UT1 after this point? */\n         du = u1 - us1;\n         du += u2 - us2;\n         if ( du > 0 ) {\n\n         /* Yes:  fraction of the current UTC day that has elapsed. */\n            fd = du * ERFA_DAYSEC / ( ERFA_DAYSEC + ddats );\n\n         /* Ramp UT1-UTC to bring about ERFA's JD(UTC) convention. */\n            duts += ddats * ( fd <= 1.0 ? fd : 1.0 );\n         }\n\n      /* Done. */\n         break;\n      }\n      dats1 = dats2;\n   }\n\n/* Subtract the (possibly adjusted) UT1-UTC from UT1 to give UTC. */\n   u2 -= duts / ERFA_DAYSEC;\n\n/* Result, safeguarding precision. */\n   if ( big1 ) {\n      *utc1 = u1;\n      *utc2 = u2;\n   } else {\n      *utc1 = u2;\n      *utc2 = u1;\n   }\n\n/* Status. */\n   return js;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13194,"name":"atoiq.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtoiq(const char *type,\n              double ob1, double ob2, eraASTROM *astrom,\n              double *ri, double *di)\n/*\n**  - - - - - - - - -\n**   e r a A t o i q\n**  - - - - - - - - -\n**\n**  Quick observed place to CIRS, given the star-independent astrometry\n**  parameters.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are all to be transformed for one date.\n**  The star-independent astrometry parameters can be obtained by\n**  calling eraApio[13] or eraApco[13].\n**\n**  Given:\n**     type   char[]     type of coordinates: \"R\", \"H\" or \"A\" (Note 1)\n**     ob1    double     observed Az, HA or RA (radians; Az is N=0,E=90)\n**     ob2    double     observed ZD or Dec (radians)\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned:\n**     ri     double*    CIRS right ascension (CIO-based, radians)\n**     di     double*    CIRS declination (radians)\n**\n**  Notes:\n**\n**  1) \"Observed\" Az,El means the position that would be seen by a\n**     perfect geodetically aligned theodolite.  This is related to\n**     the observed HA,Dec via the standard rotation, using the geodetic\n**     latitude (corrected for polar motion), while the observed HA and\n**     RA are related simply through the Earth rotation angle and the\n**     site longitude.  \"Observed\" RA,Dec or HA,Dec thus means the\n**     position that would be seen by a perfect equatorial with its\n**     polar axis aligned to the Earth's axis of rotation.  By removing\n**     from the observed place the effects of atmospheric refraction and\n**     diurnal aberration, the CIRS RA,Dec is obtained.\n**\n**  2) Only the first character of the type argument is significant.\n**     \"R\" or \"r\" indicates that ob1 and ob2 are the observed right\n**     ascension and declination;  \"H\" or \"h\" indicates that they are\n**     hour angle (west +ve) and declination;  anything else (\"A\" or\n**     \"a\" is recommended) indicates that ob1 and ob2 are azimuth (north\n**     zero, east 90 deg) and zenith distance.  (Zenith distance is used\n**     rather than altitude in order to reflect the fact that no\n**     allowance is made for depression of the horizon.)\n**\n**  3) The accuracy of the result is limited by the corrections for\n**     refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**     Providing the meteorological parameters are known accurately and\n**     there are no gross local effects, the predicted observed\n**     coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**     (radio) for a zenith distance of less than 70 degrees, better\n**     than 30 arcsec (optical or radio) at 85 degrees and better than\n**     20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**     Without refraction, the complementary functions eraAtioq and\n**     eraAtoiq are self-consistent to better than 1 microarcsecond all\n**     over the celestial sphere.  With refraction included, consistency\n**     falls off at high zenith distances, but is still better than\n**     0.05 arcsec at 85 degrees.\n**\n**  4) It is advisable to take great care with units, as even unlikely\n**     values of the input parameters are accepted and processed in\n**     accordance with the models used.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int c;\n   double c1, c2, sphi, cphi, ce, xaeo, yaeo, zaeo, v[3],\n          xmhdo, ymhdo, zmhdo, az, sz, zdo, refa, refb, tz, dref,\n          zdt, xaet, yaet, zaet, xmhda, ymhda, zmhda,\n          f, xhd, yhd, zhd, xpl, ypl, w, hma;\n\n\n/* Coordinate type. */\n   c = (int) type[0];\n\n/* Coordinates. */\n   c1 = ob1;\n   c2 = ob2;\n\n/* Sin, cos of latitude. */\n   sphi = astrom->sphi;\n   cphi = astrom->cphi;\n\n/* Standardize coordinate type. */\n   if ( c == 'r' || c == 'R' ) {\n      c = 'R';\n   } else if ( c == 'h' || c == 'H' ) {\n      c = 'H';\n   } else {\n      c = 'A';\n   }\n\n/* If Az,ZD, convert to Cartesian (S=0,E=90). */\n   if ( c == 'A' ) {\n      ce = sin(c2);\n      xaeo = - cos(c1) * ce;\n      yaeo = sin(c1) * ce;\n      zaeo = cos(c2);\n\n   } else {\n\n   /* If RA,Dec, convert to HA,Dec. */\n      if ( c == 'R' ) c1 = astrom->eral - c1;\n\n   /* To Cartesian -HA,Dec. */\n      eraS2c ( -c1, c2, v );\n      xmhdo = v[0];\n      ymhdo = v[1];\n      zmhdo = v[2];\n\n   /* To Cartesian Az,El (S=0,E=90). */\n      xaeo = sphi*xmhdo - cphi*zmhdo;\n      yaeo = ymhdo;\n      zaeo = cphi*xmhdo + sphi*zmhdo;\n   }\n\n/* Azimuth (S=0,E=90). */\n   az = ( xaeo != 0.0 || yaeo != 0.0 ) ? atan2(yaeo,xaeo) : 0.0;\n\n/* Sine of observed ZD, and observed ZD. */\n   sz = sqrt ( xaeo*xaeo + yaeo*yaeo );\n   zdo = atan2 ( sz, zaeo );\n\n/*\n** Refraction\n** ----------\n*/\n\n/* Fast algorithm using two constant model. */\n   refa = astrom->refa;\n   refb = astrom->refb;\n   tz = sz / zaeo;\n   dref = ( refa + refb*tz*tz ) * tz;\n   zdt = zdo + dref;\n\n/* To Cartesian Az,ZD. */\n   ce = sin(zdt);\n   xaet = cos(az) * ce;\n   yaet = sin(az) * ce;\n   zaet = cos(zdt);\n\n/* Cartesian Az,ZD to Cartesian -HA,Dec. */\n   xmhda = sphi*xaet + cphi*zaet;\n   ymhda = yaet;\n   zmhda = - cphi*xaet + sphi*zaet;\n\n/* Diurnal aberration. */\n   f = ( 1.0 + astrom->diurab*ymhda );\n   xhd = f * xmhda;\n   yhd = f * ( ymhda - astrom->diurab );\n   zhd = f * zmhda;\n\n/* Polar motion. */\n   xpl = astrom->xpl;\n   ypl = astrom->ypl;\n   w = xpl*xhd - ypl*yhd + zhd;\n   v[0] = xhd - xpl*w;\n   v[1] = yhd + ypl*w;\n   v[2] = w - ( xpl*xpl + ypl*ypl ) * zhd;\n\n/* To spherical -HA,Dec. */\n   eraC2s(v, &hma, di);\n\n/* Right ascension. */\n   *ri = eraAnp(astrom->eral + hma);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13195,"name":"dtdb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraDtdb(double date1, double date2,\n               double ut, double elong, double u, double v)\n/*\n**  - - - - - - - -\n**   e r a D t d b\n**  - - - - - - - -\n**\n**  An approximation to TDB-TT, the difference between barycentric\n**  dynamical time and terrestrial time, for an observer on the Earth.\n**\n**  The different time scales - proper, coordinate and realized - are\n**  related to each other:\n**\n**            TAI             <-  physically realized\n**             :\n**          offset            <-  observed (nominally +32.184s)\n**             :\n**            TT              <-  terrestrial time\n**             :\n**    rate adjustment (L_G)   <-  definition of TT\n**             :\n**            TCG             <-  time scale for GCRS\n**             :\n**      \"periodic\" terms      <-  eraDtdb  is an implementation\n**             :\n**    rate adjustment (L_C)   <-  function of solar-system ephemeris\n**             :\n**            TCB             <-  time scale for BCRS\n**             :\n**    rate adjustment (-L_B)  <-  definition of TDB\n**             :\n**            TDB             <-  TCB scaled to track TT\n**             :\n**      \"periodic\" terms      <-  -eraDtdb is an approximation\n**             :\n**            TT              <-  terrestrial time\n**\n**  Adopted values for the various constants can be found in the IERS\n**  Conventions (McCarthy & Petit 2003).\n**\n**  Given:\n**     date1,date2   double  date, TDB (Notes 1-3)\n**     ut            double  universal time (UT1, fraction of one day)\n**     elong         double  longitude (east positive, radians)\n**     u             double  distance from Earth spin axis (km)\n**     v             double  distance north of equatorial plane (km)\n**\n**  Returned (function value):\n**                   double  TDB-TT (seconds)\n**\n**  Notes:\n**\n**  1) The date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**     Although the date is, formally, barycentric dynamical time (TDB),\n**     the terrestrial dynamical time (TT) can be used with no practical\n**     effect on the accuracy of the prediction.\n**\n**  2) TT can be regarded as a coordinate time that is realized as an\n**     offset of 32.184s from International Atomic Time, TAI.  TT is a\n**     specific linear transformation of geocentric coordinate time TCG,\n**     which is the time scale for the Geocentric Celestial Reference\n**     System, GCRS.\n**\n**  3) TDB is a coordinate time, and is a specific linear transformation\n**     of barycentric coordinate time TCB, which is the time scale for\n**     the Barycentric Celestial Reference System, BCRS.\n**\n**  4) The difference TCG-TCB depends on the masses and positions of the\n**     bodies of the solar system and the velocity of the Earth.  It is\n**     dominated by a rate difference, the residual being of a periodic\n**     character.  The latter, which is modeled by the present function,\n**     comprises a main (annual) sinusoidal term of amplitude\n**     approximately 0.00166 seconds, plus planetary terms up to about\n**     20 microseconds, and lunar and diurnal terms up to 2 microseconds.\n**     These effects come from the changing transverse Doppler effect\n**     and gravitational red-shift as the observer (on the Earth's\n**     surface) experiences variations in speed (with respect to the\n**     BCRS) and gravitational potential.\n**\n**  5) TDB can be regarded as the same as TCB but with a rate adjustment\n**     to keep it close to TT, which is convenient for many applications.\n**     The history of successive attempts to define TDB is set out in\n**     Resolution 3 adopted by the IAU General Assembly in 2006, which\n**     defines a fixed TDB(TCB) transformation that is consistent with\n**     contemporary solar-system ephemerides.  Future ephemerides will\n**     imply slightly changed transformations between TCG and TCB, which\n**     could introduce a linear drift between TDB and TT;  however, any\n**     such drift is unlikely to exceed 1 nanosecond per century.\n**\n**  6) The geocentric TDB-TT model used in the present function is that of\n**     Fairhead & Bretagnon (1990), in its full form.  It was originally\n**     supplied by Fairhead (private communications with P.T.Wallace,\n**     1990) as a Fortran subroutine.  The present C function contains an\n**     adaptation of the Fairhead code.  The numerical results are\n**     essentially unaffected by the changes, the differences with\n**     respect to the Fairhead & Bretagnon original being at the 1e-20 s\n**     level.\n**\n**     The topocentric part of the model is from Moyer (1981) and\n**     Murray (1983), with fundamental arguments adapted from\n**     Simon et al. 1994.  It is an approximation to the expression\n**     ( v / c ) . ( r / c ), where v is the barycentric velocity of\n**     the Earth, r is the geocentric position of the observer and\n**     c is the speed of light.\n**\n**     By supplying zeroes for u and v, the topocentric part of the\n**     model can be nullified, and the function will return the Fairhead\n**     & Bretagnon result alone.\n**\n**  7) During the interval 1950-2050, the absolute accuracy is better\n**     than +/- 3 nanoseconds relative to time ephemerides obtained by\n**     direct numerical integrations based on the JPL DE405 solar system\n**     ephemeris.\n**\n**  8) It must be stressed that the present function is merely a model,\n**     and that numerical integration of solar-system ephemerides is the\n**     definitive method for predicting the relationship between TCG and\n**     TCB and hence between TT and TDB.\n**\n**  References:\n**\n**     Fairhead, L., & Bretagnon, P., Astron.Astrophys., 229, 240-247\n**     (1990).\n**\n**     IAU 2006 Resolution 3.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Moyer, T.D., Cel.Mech., 23, 33 (1981).\n**\n**     Murray, C.A., Vectorial Astrometry, Adam Hilger (1983).\n**\n**     Seidelmann, P.K. et al., Explanatory Supplement to the\n**     Astronomical Almanac, Chapter 2, University Science Books (1992).\n**\n**     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G. & Laskar, J., Astron.Astrophys., 282, 663-683 (1994).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, tsol, w, elsun, emsun, d, elj, els, wt, w0, w1, w2, w3, w4,\n          wf, wj;\n   int j;\n\n/*\n** =====================\n** Fairhead et al. model\n** =====================\n**\n** 787 sets of three coefficients.\n**\n** Each set is\n**    amplitude (microseconds)\n**      frequency (radians per Julian millennium since J2000.0)\n**      phase (radians)\n**\n** Sets   1-474 are the T**0 terms\n**  \"   475-679  \"   \"  T**1\n**  \"   680-764  \"   \"  T**2\n**  \"   765-784  \"   \"  T**3\n**  \"   785-787  \"   \"  T**4\n*/\n\n   static const double fairhd[787][3] = {\n   /* 1, 10 */\n      { 1656.674564e-6,     6283.075849991,  6.240054195 },\n      {   22.417471e-6,     5753.384884897,  4.296977442 },\n      {   13.839792e-6,    12566.151699983,  6.196904410 },\n      {    4.770086e-6,      529.690965095,  0.444401603 },\n      {    4.676740e-6,     6069.776754553,  4.021195093 },\n      {    2.256707e-6,      213.299095438,  5.543113262 },\n      {    1.694205e-6,      -3.523118349,   5.025132748 },\n      {    1.554905e-6,    77713.771467920,  5.198467090 },\n      {    1.276839e-6,     7860.419392439,  5.988822341 },\n      {    1.193379e-6,     5223.693919802,  3.649823730 },\n   /* 11, 20 */\n      {    1.115322e-6,     3930.209696220,  1.422745069 },\n      {    0.794185e-6,    11506.769769794,  2.322313077 },\n      {    0.447061e-6,       26.298319800,  3.615796498 },\n      {    0.435206e-6,     -398.149003408,  4.349338347 },\n      {    0.600309e-6,     1577.343542448,  2.678271909 },\n      {    0.496817e-6,     6208.294251424,  5.696701824 },\n      {    0.486306e-6,     5884.926846583,  0.520007179 },\n      {    0.432392e-6,       74.781598567,  2.435898309 },\n      {    0.468597e-6,     6244.942814354,  5.866398759 },\n      {    0.375510e-6,     5507.553238667,  4.103476804 },\n   /* 21, 30 */\n      {    0.243085e-6,     -775.522611324,  3.651837925 },\n      {    0.173435e-6,    18849.227549974,  6.153743485 },\n      {    0.230685e-6,     5856.477659115,  4.773852582 },\n      {    0.203747e-6,    12036.460734888,  4.333987818 },\n      {    0.143935e-6,     -796.298006816,  5.957517795 },\n      {    0.159080e-6,    10977.078804699,  1.890075226 },\n      {    0.119979e-6,       38.133035638,  4.551585768 },\n      {    0.118971e-6,     5486.777843175,  1.914547226 },\n      {    0.116120e-6,     1059.381930189,  0.873504123 },\n      {    0.137927e-6,    11790.629088659,  1.135934669 },\n   /* 31, 40 */\n      {    0.098358e-6,     2544.314419883,  0.092793886 },\n      {    0.101868e-6,    -5573.142801634,  5.984503847 },\n      {    0.080164e-6,      206.185548437,  2.095377709 },\n      {    0.079645e-6,     4694.002954708,  2.949233637 },\n      {    0.062617e-6,       20.775395492,  2.654394814 },\n      {    0.075019e-6,     2942.463423292,  4.980931759 },\n      {    0.064397e-6,     5746.271337896,  1.280308748 },\n      {    0.063814e-6,     5760.498431898,  4.167901731 },\n      {    0.048042e-6,     2146.165416475,  1.495846011 },\n      {    0.048373e-6,      155.420399434,  2.251573730 },\n   /* 41, 50 */\n      {    0.058844e-6,      426.598190876,  4.839650148 },\n      {    0.046551e-6,       -0.980321068,  0.921573539 },\n      {    0.054139e-6,    17260.154654690,  3.411091093 },\n      {    0.042411e-6,     6275.962302991,  2.869567043 },\n      {    0.040184e-6,       -7.113547001,  3.565975565 },\n      {    0.036564e-6,     5088.628839767,  3.324679049 },\n      {    0.040759e-6,    12352.852604545,  3.981496998 },\n      {    0.036507e-6,      801.820931124,  6.248866009 },\n      {    0.036955e-6,     3154.687084896,  5.071801441 },\n      {    0.042732e-6,      632.783739313,  5.720622217 },\n   /* 51, 60 */\n      {    0.042560e-6,   161000.685737473,  1.270837679 },\n      {    0.040480e-6,    15720.838784878,  2.546610123 },\n      {    0.028244e-6,    -6286.598968340,  5.069663519 },\n      {    0.033477e-6,     6062.663207553,  4.144987272 },\n      {    0.034867e-6,      522.577418094,  5.210064075 },\n      {    0.032438e-6,     6076.890301554,  0.749317412 },\n      {    0.030215e-6,     7084.896781115,  3.389610345 },\n      {    0.029247e-6,   -71430.695617928,  4.183178762 },\n      {    0.033529e-6,     9437.762934887,  2.404714239 },\n      {    0.032423e-6,     8827.390269875,  5.541473556 },\n   /* 61, 70 */\n      {    0.027567e-6,     6279.552731642,  5.040846034 },\n      {    0.029862e-6,    12139.553509107,  1.770181024 },\n      {    0.022509e-6,    10447.387839604,  1.460726241 },\n      {    0.020937e-6,     8429.241266467,  0.652303414 },\n      {    0.020322e-6,      419.484643875,  3.735430632 },\n      {    0.024816e-6,    -1194.447010225,  1.087136918 },\n      {    0.025196e-6,     1748.016413067,  2.901883301 },\n      {    0.021691e-6,    14143.495242431,  5.952658009 },\n      {    0.017673e-6,     6812.766815086,  3.186129845 },\n      {    0.022567e-6,     6133.512652857,  3.307984806 },\n   /* 71, 80 */\n      {    0.016155e-6,    10213.285546211,  1.331103168 },\n      {    0.014751e-6,     1349.867409659,  4.308933301 },\n      {    0.015949e-6,     -220.412642439,  4.005298270 },\n      {    0.015974e-6,    -2352.866153772,  6.145309371 },\n      {    0.014223e-6,    17789.845619785,  2.104551349 },\n      {    0.017806e-6,       73.297125859,  3.475975097 },\n      {    0.013671e-6,     -536.804512095,  5.971672571 },\n      {    0.011942e-6,     8031.092263058,  2.053414715 },\n      {    0.014318e-6,    16730.463689596,  3.016058075 },\n      {    0.012462e-6,      103.092774219,  1.737438797 },\n   /* 81, 90 */\n      {    0.010962e-6,        3.590428652,  2.196567739 },\n      {    0.015078e-6,    19651.048481098,  3.969480770 },\n      {    0.010396e-6,      951.718406251,  5.717799605 },\n      {    0.011707e-6,    -4705.732307544,  2.654125618 },\n      {    0.010453e-6,     5863.591206116,  1.913704550 },\n      {    0.012420e-6,     4690.479836359,  4.734090399 },\n      {    0.011847e-6,     5643.178563677,  5.489005403 },\n      {    0.008610e-6,     3340.612426700,  3.661698944 },\n      {    0.011622e-6,     5120.601145584,  4.863931876 },\n      {    0.010825e-6,      553.569402842,  0.842715011 },\n   /* 91, 100 */\n      {    0.008666e-6,     -135.065080035,  3.293406547 },\n      {    0.009963e-6,      149.563197135,  4.870690598 },\n      {    0.009858e-6,     6309.374169791,  1.061816410 },\n      {    0.007959e-6,      316.391869657,  2.465042647 },\n      {    0.010099e-6,      283.859318865,  1.942176992 },\n      {    0.007147e-6,     -242.728603974,  3.661486981 },\n      {    0.007505e-6,     5230.807466803,  4.920937029 },\n      {    0.008323e-6,    11769.853693166,  1.229392026 },\n      {    0.007490e-6,    -6256.777530192,  3.658444681 },\n      {    0.009370e-6,   149854.400134205,  0.673880395 },\n   /* 101, 110 */\n      {    0.007117e-6,       38.027672636,  5.294249518 },\n      {    0.007857e-6,    12168.002696575,  0.525733528 },\n      {    0.007019e-6,     6206.809778716,  0.837688810 },\n      {    0.006056e-6,      955.599741609,  4.194535082 },\n      {    0.008107e-6,    13367.972631107,  3.793235253 },\n      {    0.006731e-6,     5650.292110678,  5.639906583 },\n      {    0.007332e-6,       36.648562930,  0.114858677 },\n      {    0.006366e-6,     4164.311989613,  2.262081818 },\n      {    0.006858e-6,     5216.580372801,  0.642063318 },\n      {    0.006919e-6,     6681.224853400,  6.018501522 },\n   /* 111, 120 */\n      {    0.006826e-6,     7632.943259650,  3.458654112 },\n      {    0.005308e-6,    -1592.596013633,  2.500382359 },\n      {    0.005096e-6,    11371.704689758,  2.547107806 },\n      {    0.004841e-6,     5333.900241022,  0.437078094 },\n      {    0.005582e-6,     5966.683980335,  2.246174308 },\n      {    0.006304e-6,    11926.254413669,  2.512929171 },\n      {    0.006603e-6,    23581.258177318,  5.393136889 },\n      {    0.005123e-6,       -1.484472708,  2.999641028 },\n      {    0.004648e-6,     1589.072895284,  1.275847090 },\n      {    0.005119e-6,     6438.496249426,  1.486539246 },\n   /* 121, 130 */\n      {    0.004521e-6,     4292.330832950,  6.140635794 },\n      {    0.005680e-6,    23013.539539587,  4.557814849 },\n      {    0.005488e-6,       -3.455808046,  0.090675389 },\n      {    0.004193e-6,     7234.794256242,  4.869091389 },\n      {    0.003742e-6,     7238.675591600,  4.691976180 },\n      {    0.004148e-6,     -110.206321219,  3.016173439 },\n      {    0.004553e-6,    11499.656222793,  5.554998314 },\n      {    0.004892e-6,     5436.993015240,  1.475415597 },\n      {    0.004044e-6,     4732.030627343,  1.398784824 },\n      {    0.004164e-6,    12491.370101415,  5.650931916 },\n   /* 131, 140 */\n      {    0.004349e-6,    11513.883316794,  2.181745369 },\n      {    0.003919e-6,    12528.018664345,  5.823319737 },\n      {    0.003129e-6,     6836.645252834,  0.003844094 },\n      {    0.004080e-6,    -7058.598461315,  3.690360123 },\n      {    0.003270e-6,       76.266071276,  1.517189902 },\n      {    0.002954e-6,     6283.143160294,  4.447203799 },\n      {    0.002872e-6,       28.449187468,  1.158692983 },\n      {    0.002881e-6,      735.876513532,  0.349250250 },\n      {    0.003279e-6,     5849.364112115,  4.893384368 },\n      {    0.003625e-6,     6209.778724132,  1.473760578 },\n   /* 141, 150 */\n      {    0.003074e-6,      949.175608970,  5.185878737 },\n      {    0.002775e-6,     9917.696874510,  1.030026325 },\n      {    0.002646e-6,    10973.555686350,  3.918259169 },\n      {    0.002575e-6,    25132.303399966,  6.109659023 },\n      {    0.003500e-6,      263.083923373,  1.892100742 },\n      {    0.002740e-6,    18319.536584880,  4.320519510 },\n      {    0.002464e-6,      202.253395174,  4.698203059 },\n      {    0.002409e-6,        2.542797281,  5.325009315 },\n      {    0.003354e-6,   -90955.551694697,  1.942656623 },\n      {    0.002296e-6,     6496.374945429,  5.061810696 },\n   /* 151, 160 */\n      {    0.003002e-6,     6172.869528772,  2.797822767 },\n      {    0.003202e-6,    27511.467873537,  0.531673101 },\n      {    0.002954e-6,    -6283.008539689,  4.533471191 },\n      {    0.002353e-6,      639.897286314,  3.734548088 },\n      {    0.002401e-6,    16200.772724501,  2.605547070 },\n      {    0.003053e-6,   233141.314403759,  3.029030662 },\n      {    0.003024e-6,    83286.914269554,  2.355556099 },\n      {    0.002863e-6,    17298.182327326,  5.240963796 },\n      {    0.002103e-6,    -7079.373856808,  5.756641637 },\n      {    0.002303e-6,    83996.847317911,  2.013686814 },\n   /* 161, 170 */\n      {    0.002303e-6,    18073.704938650,  1.089100410 },\n      {    0.002381e-6,       63.735898303,  0.759188178 },\n      {    0.002493e-6,     6386.168624210,  0.645026535 },\n      {    0.002366e-6,        3.932153263,  6.215885448 },\n      {    0.002169e-6,    11015.106477335,  4.845297676 },\n      {    0.002397e-6,     6243.458341645,  3.809290043 },\n      {    0.002183e-6,     1162.474704408,  6.179611691 },\n      {    0.002353e-6,     6246.427287062,  4.781719760 },\n      {    0.002199e-6,     -245.831646229,  5.956152284 },\n      {    0.001729e-6,     3894.181829542,  1.264976635 },\n   /* 171, 180 */\n      {    0.001896e-6,    -3128.388765096,  4.914231596 },\n      {    0.002085e-6,       35.164090221,  1.405158503 },\n      {    0.002024e-6,    14712.317116458,  2.752035928 },\n      {    0.001737e-6,     6290.189396992,  5.280820144 },\n      {    0.002229e-6,      491.557929457,  1.571007057 },\n      {    0.001602e-6,    14314.168113050,  4.203664806 },\n      {    0.002186e-6,      454.909366527,  1.402101526 },\n      {    0.001897e-6,    22483.848574493,  4.167932508 },\n      {    0.001825e-6,    -3738.761430108,  0.545828785 },\n      {    0.001894e-6,     1052.268383188,  5.817167450 },\n   /* 181, 190 */\n      {    0.001421e-6,       20.355319399,  2.419886601 },\n      {    0.001408e-6,    10984.192351700,  2.732084787 },\n      {    0.001847e-6,    10873.986030480,  2.903477885 },\n      {    0.001391e-6,    -8635.942003763,  0.593891500 },\n      {    0.001388e-6,       -7.046236698,  1.166145902 },\n      {    0.001810e-6,   -88860.057071188,  0.487355242 },\n      {    0.001288e-6,    -1990.745017041,  3.913022880 },\n      {    0.001297e-6,    23543.230504682,  3.063805171 },\n      {    0.001335e-6,     -266.607041722,  3.995764039 },\n      {    0.001376e-6,    10969.965257698,  5.152914309 },\n   /* 191, 200 */\n      {    0.001745e-6,   244287.600007027,  3.626395673 },\n      {    0.001649e-6,    31441.677569757,  1.952049260 },\n      {    0.001416e-6,     9225.539273283,  4.996408389 },\n      {    0.001238e-6,     4804.209275927,  5.503379738 },\n      {    0.001472e-6,     4590.910180489,  4.164913291 },\n      {    0.001169e-6,     6040.347246017,  5.841719038 },\n      {    0.001039e-6,     5540.085789459,  2.769753519 },\n      {    0.001004e-6,     -170.672870619,  0.755008103 },\n      {    0.001284e-6,    10575.406682942,  5.306538209 },\n      {    0.001278e-6,       71.812653151,  4.713486491 },\n   /* 201, 210 */\n      {    0.001321e-6,    18209.330263660,  2.624866359 },\n      {    0.001297e-6,    21228.392023546,  0.382603541 },\n      {    0.000954e-6,     6282.095528923,  0.882213514 },\n      {    0.001145e-6,     6058.731054289,  1.169483931 },\n      {    0.000979e-6,     5547.199336460,  5.448375984 },\n      {    0.000987e-6,    -6262.300454499,  2.656486959 },\n      {    0.001070e-6,  -154717.609887482,  1.827624012 },\n      {    0.000991e-6,     4701.116501708,  4.387001801 },\n      {    0.001155e-6,      -14.227094002,  3.042700750 },\n      {    0.001176e-6,      277.034993741,  3.335519004 },\n   /* 211, 220 */\n      {    0.000890e-6,    13916.019109642,  5.601498297 },\n      {    0.000884e-6,    -1551.045222648,  1.088831705 },\n      {    0.000876e-6,     5017.508371365,  3.969902609 },\n      {    0.000806e-6,    15110.466119866,  5.142876744 },\n      {    0.000773e-6,    -4136.910433516,  0.022067765 },\n      {    0.001077e-6,      175.166059800,  1.844913056 },\n      {    0.000954e-6,    -6284.056171060,  0.968480906 },\n      {    0.000737e-6,     5326.786694021,  4.923831588 },\n      {    0.000845e-6,     -433.711737877,  4.749245231 },\n      {    0.000819e-6,     8662.240323563,  5.991247817 },\n   /* 221, 230 */\n      {    0.000852e-6,      199.072001436,  2.189604979 },\n      {    0.000723e-6,    17256.631536341,  6.068719637 },\n      {    0.000940e-6,     6037.244203762,  6.197428148 },\n      {    0.000885e-6,    11712.955318231,  3.280414875 },\n      {    0.000706e-6,    12559.038152982,  2.824848947 },\n      {    0.000732e-6,     2379.164473572,  2.501813417 },\n      {    0.000764e-6,    -6127.655450557,  2.236346329 },\n      {    0.000908e-6,      131.541961686,  2.521257490 },\n      {    0.000907e-6,    35371.887265976,  3.370195967 },\n      {    0.000673e-6,     1066.495477190,  3.876512374 },\n   /* 231, 240 */\n      {    0.000814e-6,    17654.780539750,  4.627122566 },\n      {    0.000630e-6,       36.027866677,  0.156368499 },\n      {    0.000798e-6,      515.463871093,  5.151962502 },\n      {    0.000798e-6,      148.078724426,  5.909225055 },\n      {    0.000806e-6,      309.278322656,  6.054064447 },\n      {    0.000607e-6,      -39.617508346,  2.839021623 },\n      {    0.000601e-6,      412.371096874,  3.984225404 },\n      {    0.000646e-6,    11403.676995575,  3.852959484 },\n      {    0.000704e-6,    13521.751441591,  2.300991267 },\n      {    0.000603e-6,   -65147.619767937,  4.140083146 },\n   /* 241, 250 */\n      {    0.000609e-6,    10177.257679534,  0.437122327 },\n      {    0.000631e-6,     5767.611978898,  4.026532329 },\n      {    0.000576e-6,    11087.285125918,  4.760293101 },\n      {    0.000674e-6,    14945.316173554,  6.270510511 },\n      {    0.000726e-6,     5429.879468239,  6.039606892 },\n      {    0.000710e-6,    28766.924424484,  5.672617711 },\n      {    0.000647e-6,    11856.218651625,  3.397132627 },\n      {    0.000678e-6,    -5481.254918868,  6.249666675 },\n      {    0.000618e-6,    22003.914634870,  2.466427018 },\n      {    0.000738e-6,     6134.997125565,  2.242668890 },\n   /* 251, 260 */\n      {    0.000660e-6,      625.670192312,  5.864091907 },\n      {    0.000694e-6,     3496.032826134,  2.668309141 },\n      {    0.000531e-6,     6489.261398429,  1.681888780 },\n      {    0.000611e-6,  -143571.324284214,  2.424978312 },\n      {    0.000575e-6,    12043.574281889,  4.216492400 },\n      {    0.000553e-6,    12416.588502848,  4.772158039 },\n      {    0.000689e-6,     4686.889407707,  6.224271088 },\n      {    0.000495e-6,     7342.457780181,  3.817285811 },\n      {    0.000567e-6,     3634.621024518,  1.649264690 },\n      {    0.000515e-6,    18635.928454536,  3.945345892 },\n   /* 261, 270 */\n      {    0.000486e-6,     -323.505416657,  4.061673868 },\n      {    0.000662e-6,    25158.601719765,  1.794058369 },\n      {    0.000509e-6,      846.082834751,  3.053874588 },\n      {    0.000472e-6,   -12569.674818332,  5.112133338 },\n      {    0.000461e-6,     6179.983075773,  0.513669325 },\n      {    0.000641e-6,    83467.156352816,  3.210727723 },\n      {    0.000520e-6,    10344.295065386,  2.445597761 },\n      {    0.000493e-6,    18422.629359098,  1.676939306 },\n      {    0.000478e-6,     1265.567478626,  5.487314569 },\n      {    0.000472e-6,      -18.159247265,  1.999707589 },\n   /* 271, 280 */\n      {    0.000559e-6,    11190.377900137,  5.783236356 },\n      {    0.000494e-6,     9623.688276691,  3.022645053 },\n      {    0.000463e-6,     5739.157790895,  1.411223013 },\n      {    0.000432e-6,    16858.482532933,  1.179256434 },\n      {    0.000574e-6,    72140.628666286,  1.758191830 },\n      {    0.000484e-6,    17267.268201691,  3.290589143 },\n      {    0.000550e-6,     4907.302050146,  0.864024298 },\n      {    0.000399e-6,       14.977853527,  2.094441910 },\n      {    0.000491e-6,      224.344795702,  0.878372791 },\n      {    0.000432e-6,    20426.571092422,  6.003829241 },\n   /* 281, 290 */\n      {    0.000481e-6,     5749.452731634,  4.309591964 },\n      {    0.000480e-6,     5757.317038160,  1.142348571 },\n      {    0.000485e-6,     6702.560493867,  0.210580917 },\n      {    0.000426e-6,     6055.549660552,  4.274476529 },\n      {    0.000480e-6,     5959.570433334,  5.031351030 },\n      {    0.000466e-6,    12562.628581634,  4.959581597 },\n      {    0.000520e-6,    39302.096962196,  4.788002889 },\n      {    0.000458e-6,    12132.439962106,  1.880103788 },\n      {    0.000470e-6,    12029.347187887,  1.405611197 },\n      {    0.000416e-6,    -7477.522860216,  1.082356330 },\n   /* 291, 300 */\n      {    0.000449e-6,    11609.862544012,  4.179989585 },\n      {    0.000465e-6,    17253.041107690,  0.353496295 },\n      {    0.000362e-6,    -4535.059436924,  1.583849576 },\n      {    0.000383e-6,    21954.157609398,  3.747376371 },\n      {    0.000389e-6,       17.252277143,  1.395753179 },\n      {    0.000331e-6,    18052.929543158,  0.566790582 },\n      {    0.000430e-6,    13517.870106233,  0.685827538 },\n      {    0.000368e-6,    -5756.908003246,  0.731374317 },\n      {    0.000330e-6,    10557.594160824,  3.710043680 },\n      {    0.000332e-6,    20199.094959633,  1.652901407 },\n   /* 301, 310 */\n      {    0.000384e-6,    11933.367960670,  5.827781531 },\n      {    0.000387e-6,    10454.501386605,  2.541182564 },\n      {    0.000325e-6,    15671.081759407,  2.178850542 },\n      {    0.000318e-6,      138.517496871,  2.253253037 },\n      {    0.000305e-6,     9388.005909415,  0.578340206 },\n      {    0.000352e-6,     5749.861766548,  3.000297967 },\n      {    0.000311e-6,     6915.859589305,  1.693574249 },\n      {    0.000297e-6,    24072.921469776,  1.997249392 },\n      {    0.000363e-6,     -640.877607382,  5.071820966 },\n      {    0.000323e-6,    12592.450019783,  1.072262823 },\n   /* 311, 320 */\n      {    0.000341e-6,    12146.667056108,  4.700657997 },\n      {    0.000290e-6,     9779.108676125,  1.812320441 },\n      {    0.000342e-6,     6132.028180148,  4.322238614 },\n      {    0.000329e-6,     6268.848755990,  3.033827743 },\n      {    0.000374e-6,    17996.031168222,  3.388716544 },\n      {    0.000285e-6,     -533.214083444,  4.687313233 },\n      {    0.000338e-6,     6065.844601290,  0.877776108 },\n      {    0.000276e-6,       24.298513841,  0.770299429 },\n      {    0.000336e-6,    -2388.894020449,  5.353796034 },\n      {    0.000290e-6,     3097.883822726,  4.075291557 },\n   /* 321, 330 */\n      {    0.000318e-6,      709.933048357,  5.941207518 },\n      {    0.000271e-6,    13095.842665077,  3.208912203 },\n      {    0.000331e-6,     6073.708907816,  4.007881169 },\n      {    0.000292e-6,      742.990060533,  2.714333592 },\n      {    0.000362e-6,    29088.811415985,  3.215977013 },\n      {    0.000280e-6,    12359.966151546,  0.710872502 },\n      {    0.000267e-6,    10440.274292604,  4.730108488 },\n      {    0.000262e-6,      838.969287750,  1.327720272 },\n      {    0.000250e-6,    16496.361396202,  0.898769761 },\n      {    0.000325e-6,    20597.243963041,  0.180044365 },\n   /* 331, 340 */\n      {    0.000268e-6,     6148.010769956,  5.152666276 },\n      {    0.000284e-6,     5636.065016677,  5.655385808 },\n      {    0.000301e-6,     6080.822454817,  2.135396205 },\n      {    0.000294e-6,     -377.373607916,  3.708784168 },\n      {    0.000236e-6,     2118.763860378,  1.733578756 },\n      {    0.000234e-6,     5867.523359379,  5.575209112 },\n      {    0.000268e-6,  -226858.238553767,  0.069432392 },\n      {    0.000265e-6,   167283.761587465,  4.369302826 },\n      {    0.000280e-6,    28237.233459389,  5.304829118 },\n      {    0.000292e-6,    12345.739057544,  4.096094132 },\n   /* 341, 350 */\n      {    0.000223e-6,    19800.945956225,  3.069327406 },\n      {    0.000301e-6,    43232.306658416,  6.205311188 },\n      {    0.000264e-6,    18875.525869774,  1.417263408 },\n      {    0.000304e-6,    -1823.175188677,  3.409035232 },\n      {    0.000301e-6,      109.945688789,  0.510922054 },\n      {    0.000260e-6,      813.550283960,  2.389438934 },\n      {    0.000299e-6,   316428.228673312,  5.384595078 },\n      {    0.000211e-6,     5756.566278634,  3.789392838 },\n      {    0.000209e-6,     5750.203491159,  1.661943545 },\n      {    0.000240e-6,    12489.885628707,  5.684549045 },\n   /* 351, 360 */\n      {    0.000216e-6,     6303.851245484,  3.862942261 },\n      {    0.000203e-6,     1581.959348283,  5.549853589 },\n      {    0.000200e-6,     5642.198242609,  1.016115785 },\n      {    0.000197e-6,      -70.849445304,  4.690702525 },\n      {    0.000227e-6,     6287.008003254,  2.911891613 },\n      {    0.000197e-6,      533.623118358,  1.048982898 },\n      {    0.000205e-6,    -6279.485421340,  1.829362730 },\n      {    0.000209e-6,   -10988.808157535,  2.636140084 },\n      {    0.000208e-6,     -227.526189440,  4.127883842 },\n      {    0.000191e-6,      415.552490612,  4.401165650 },\n   /* 361, 370 */\n      {    0.000190e-6,    29296.615389579,  4.175658539 },\n      {    0.000264e-6,    66567.485864652,  4.601102551 },\n      {    0.000256e-6,    -3646.350377354,  0.506364778 },\n      {    0.000188e-6,    13119.721102825,  2.032195842 },\n      {    0.000185e-6,     -209.366942175,  4.694756586 },\n      {    0.000198e-6,    25934.124331089,  3.832703118 },\n      {    0.000195e-6,     4061.219215394,  3.308463427 },\n      {    0.000234e-6,     5113.487598583,  1.716090661 },\n      {    0.000188e-6,     1478.866574064,  5.686865780 },\n      {    0.000222e-6,    11823.161639450,  1.942386641 },\n   /* 371, 380 */\n      {    0.000181e-6,    10770.893256262,  1.999482059 },\n      {    0.000171e-6,     6546.159773364,  1.182807992 },\n      {    0.000206e-6,       70.328180442,  5.934076062 },\n      {    0.000169e-6,    20995.392966449,  2.169080622 },\n      {    0.000191e-6,    10660.686935042,  5.405515999 },\n      {    0.000228e-6,    33019.021112205,  4.656985514 },\n      {    0.000184e-6,    -4933.208440333,  3.327476868 },\n      {    0.000220e-6,     -135.625325010,  1.765430262 },\n      {    0.000166e-6,    23141.558382925,  3.454132746 },\n      {    0.000191e-6,     6144.558353121,  5.020393445 },\n   /* 381, 390 */\n      {    0.000180e-6,     6084.003848555,  0.602182191 },\n      {    0.000163e-6,    17782.732072784,  4.960593133 },\n      {    0.000225e-6,    16460.333529525,  2.596451817 },\n      {    0.000222e-6,     5905.702242076,  3.731990323 },\n      {    0.000204e-6,      227.476132789,  5.636192701 },\n      {    0.000159e-6,    16737.577236597,  3.600691544 },\n      {    0.000200e-6,     6805.653268085,  0.868220961 },\n      {    0.000187e-6,    11919.140866668,  2.629456641 },\n      {    0.000161e-6,      127.471796607,  2.862574720 },\n      {    0.000205e-6,     6286.666278643,  1.742882331 },\n   /* 391, 400 */\n      {    0.000189e-6,      153.778810485,  4.812372643 },\n      {    0.000168e-6,    16723.350142595,  0.027860588 },\n      {    0.000149e-6,    11720.068865232,  0.659721876 },\n      {    0.000189e-6,     5237.921013804,  5.245313000 },\n      {    0.000143e-6,     6709.674040867,  4.317625647 },\n      {    0.000146e-6,     4487.817406270,  4.815297007 },\n      {    0.000144e-6,     -664.756045130,  5.381366880 },\n      {    0.000175e-6,     5127.714692584,  4.728443327 },\n      {    0.000162e-6,     6254.626662524,  1.435132069 },\n      {    0.000187e-6,    47162.516354635,  1.354371923 },\n   /* 401, 410 */\n      {    0.000146e-6,    11080.171578918,  3.369695406 },\n      {    0.000180e-6,     -348.924420448,  2.490902145 },\n      {    0.000148e-6,      151.047669843,  3.799109588 },\n      {    0.000157e-6,     6197.248551160,  1.284375887 },\n      {    0.000167e-6,      146.594251718,  0.759969109 },\n      {    0.000133e-6,    -5331.357443741,  5.409701889 },\n      {    0.000154e-6,       95.979227218,  3.366890614 },\n      {    0.000148e-6,    -6418.140930027,  3.384104996 },\n      {    0.000128e-6,    -6525.804453965,  3.803419985 },\n      {    0.000130e-6,    11293.470674356,  0.939039445 },\n   /* 411, 420 */\n      {    0.000152e-6,    -5729.506447149,  0.734117523 },\n      {    0.000138e-6,      210.117701700,  2.564216078 },\n      {    0.000123e-6,     6066.595360816,  4.517099537 },\n      {    0.000140e-6,    18451.078546566,  0.642049130 },\n      {    0.000126e-6,    11300.584221356,  3.485280663 },\n      {    0.000119e-6,    10027.903195729,  3.217431161 },\n      {    0.000151e-6,     4274.518310832,  4.404359108 },\n      {    0.000117e-6,     6072.958148291,  0.366324650 },\n      {    0.000165e-6,    -7668.637425143,  4.298212528 },\n      {    0.000117e-6,    -6245.048177356,  5.379518958 },\n   /* 421, 430 */\n      {    0.000130e-6,    -5888.449964932,  4.527681115 },\n      {    0.000121e-6,     -543.918059096,  6.109429504 },\n      {    0.000162e-6,     9683.594581116,  5.720092446 },\n      {    0.000141e-6,     6219.339951688,  0.679068671 },\n      {    0.000118e-6,    22743.409379516,  4.881123092 },\n      {    0.000129e-6,     1692.165669502,  0.351407289 },\n      {    0.000126e-6,     5657.405657679,  5.146592349 },\n      {    0.000114e-6,      728.762966531,  0.520791814 },\n      {    0.000120e-6,       52.596639600,  0.948516300 },\n      {    0.000115e-6,       65.220371012,  3.504914846 },\n   /* 431, 440 */\n      {    0.000126e-6,     5881.403728234,  5.577502482 },\n      {    0.000158e-6,   163096.180360983,  2.957128968 },\n      {    0.000134e-6,    12341.806904281,  2.598576764 },\n      {    0.000151e-6,    16627.370915377,  3.985702050 },\n      {    0.000109e-6,     1368.660252845,  0.014730471 },\n      {    0.000131e-6,     6211.263196841,  0.085077024 },\n      {    0.000146e-6,     5792.741760812,  0.708426604 },\n      {    0.000146e-6,      -77.750543984,  3.121576600 },\n      {    0.000107e-6,     5341.013788022,  0.288231904 },\n      {    0.000138e-6,     6281.591377283,  2.797450317 },\n   /* 441, 450 */\n      {    0.000113e-6,    -6277.552925684,  2.788904128 },\n      {    0.000115e-6,     -525.758811831,  5.895222200 },\n      {    0.000138e-6,     6016.468808270,  6.096188999 },\n      {    0.000139e-6,    23539.707386333,  2.028195445 },\n      {    0.000146e-6,    -4176.041342449,  4.660008502 },\n      {    0.000107e-6,    16062.184526117,  4.066520001 },\n      {    0.000142e-6,    83783.548222473,  2.936315115 },\n      {    0.000128e-6,     9380.959672717,  3.223844306 },\n      {    0.000135e-6,     6205.325306007,  1.638054048 },\n      {    0.000101e-6,     2699.734819318,  5.481603249 },\n   /* 451, 460 */\n      {    0.000104e-6,     -568.821874027,  2.205734493 },\n      {    0.000103e-6,     6321.103522627,  2.440421099 },\n      {    0.000119e-6,     6321.208885629,  2.547496264 },\n      {    0.000138e-6,     1975.492545856,  2.314608466 },\n      {    0.000121e-6,      137.033024162,  4.539108237 },\n      {    0.000123e-6,    19402.796952817,  4.538074405 },\n      {    0.000119e-6,    22805.735565994,  2.869040566 },\n      {    0.000133e-6,    64471.991241142,  6.056405489 },\n      {    0.000129e-6,      -85.827298831,  2.540635083 },\n      {    0.000131e-6,    13613.804277336,  4.005732868 },\n   /* 461, 470 */\n      {    0.000104e-6,     9814.604100291,  1.959967212 },\n      {    0.000112e-6,    16097.679950283,  3.589026260 },\n      {    0.000123e-6,     2107.034507542,  1.728627253 },\n      {    0.000121e-6,    36949.230808424,  6.072332087 },\n      {    0.000108e-6,   -12539.853380183,  3.716133846 },\n      {    0.000113e-6,    -7875.671863624,  2.725771122 },\n      {    0.000109e-6,     4171.425536614,  4.033338079 },\n      {    0.000101e-6,     6247.911759770,  3.441347021 },\n      {    0.000113e-6,     7330.728427345,  0.656372122 },\n      {    0.000113e-6,    51092.726050855,  2.791483066 },\n   /* 471, 480 */\n      {    0.000106e-6,     5621.842923210,  1.815323326 },\n      {    0.000101e-6,      111.430161497,  5.711033677 },\n      {    0.000103e-6,      909.818733055,  2.812745443 },\n      {    0.000101e-6,     1790.642637886,  1.965746028 },\n\n   /* T */\n      {  102.156724e-6,     6283.075849991,  4.249032005 },\n      {    1.706807e-6,    12566.151699983,  4.205904248 },\n      {    0.269668e-6,      213.299095438,  3.400290479 },\n      {    0.265919e-6,      529.690965095,  5.836047367 },\n      {    0.210568e-6,       -3.523118349,  6.262738348 },\n      {    0.077996e-6,     5223.693919802,  4.670344204 },\n   /* 481, 490 */\n      {    0.054764e-6,     1577.343542448,  4.534800170 },\n      {    0.059146e-6,       26.298319800,  1.083044735 },\n      {    0.034420e-6,     -398.149003408,  5.980077351 },\n      {    0.032088e-6,    18849.227549974,  4.162913471 },\n      {    0.033595e-6,     5507.553238667,  5.980162321 },\n      {    0.029198e-6,     5856.477659115,  0.623811863 },\n      {    0.027764e-6,      155.420399434,  3.745318113 },\n      {    0.025190e-6,     5746.271337896,  2.980330535 },\n      {    0.022997e-6,     -796.298006816,  1.174411803 },\n      {    0.024976e-6,     5760.498431898,  2.467913690 },\n   /* 491, 500 */\n      {    0.021774e-6,      206.185548437,  3.854787540 },\n      {    0.017925e-6,     -775.522611324,  1.092065955 },\n      {    0.013794e-6,      426.598190876,  2.699831988 },\n      {    0.013276e-6,     6062.663207553,  5.845801920 },\n      {    0.011774e-6,    12036.460734888,  2.292832062 },\n      {    0.012869e-6,     6076.890301554,  5.333425680 },\n      {    0.012152e-6,     1059.381930189,  6.222874454 },\n      {    0.011081e-6,       -7.113547001,  5.154724984 },\n      {    0.010143e-6,     4694.002954708,  4.044013795 },\n      {    0.009357e-6,     5486.777843175,  3.416081409 },\n   /* 501, 510 */\n      {    0.010084e-6,      522.577418094,  0.749320262 },\n      {    0.008587e-6,    10977.078804699,  2.777152598 },\n      {    0.008628e-6,     6275.962302991,  4.562060226 },\n      {    0.008158e-6,     -220.412642439,  5.806891533 },\n      {    0.007746e-6,     2544.314419883,  1.603197066 },\n      {    0.007670e-6,     2146.165416475,  3.000200440 },\n      {    0.007098e-6,       74.781598567,  0.443725817 },\n      {    0.006180e-6,     -536.804512095,  1.302642751 },\n      {    0.005818e-6,     5088.628839767,  4.827723531 },\n      {    0.004945e-6,    -6286.598968340,  0.268305170 },\n   /* 511, 520 */\n      {    0.004774e-6,     1349.867409659,  5.808636673 },\n      {    0.004687e-6,     -242.728603974,  5.154890570 },\n      {    0.006089e-6,     1748.016413067,  4.403765209 },\n      {    0.005975e-6,    -1194.447010225,  2.583472591 },\n      {    0.004229e-6,      951.718406251,  0.931172179 },\n      {    0.005264e-6,      553.569402842,  2.336107252 },\n      {    0.003049e-6,     5643.178563677,  1.362634430 },\n      {    0.002974e-6,     6812.766815086,  1.583012668 },\n      {    0.003403e-6,    -2352.866153772,  2.552189886 },\n      {    0.003030e-6,      419.484643875,  5.286473844 },\n   /* 521, 530 */\n      {    0.003210e-6,       -7.046236698,  1.863796539 },\n      {    0.003058e-6,     9437.762934887,  4.226420633 },\n      {    0.002589e-6,    12352.852604545,  1.991935820 },\n      {    0.002927e-6,     5216.580372801,  2.319951253 },\n      {    0.002425e-6,     5230.807466803,  3.084752833 },\n      {    0.002656e-6,     3154.687084896,  2.487447866 },\n      {    0.002445e-6,    10447.387839604,  2.347139160 },\n      {    0.002990e-6,     4690.479836359,  6.235872050 },\n      {    0.002890e-6,     5863.591206116,  0.095197563 },\n      {    0.002498e-6,     6438.496249426,  2.994779800 },\n   /* 531, 540 */\n      {    0.001889e-6,     8031.092263058,  3.569003717 },\n      {    0.002567e-6,      801.820931124,  3.425611498 },\n      {    0.001803e-6,   -71430.695617928,  2.192295512 },\n      {    0.001782e-6,        3.932153263,  5.180433689 },\n      {    0.001694e-6,    -4705.732307544,  4.641779174 },\n      {    0.001704e-6,    -1592.596013633,  3.997097652 },\n      {    0.001735e-6,     5849.364112115,  0.417558428 },\n      {    0.001643e-6,     8429.241266467,  2.180619584 },\n      {    0.001680e-6,       38.133035638,  4.164529426 },\n      {    0.002045e-6,     7084.896781115,  0.526323854 },\n   /* 541, 550 */\n      {    0.001458e-6,     4292.330832950,  1.356098141 },\n      {    0.001437e-6,       20.355319399,  3.895439360 },\n      {    0.001738e-6,     6279.552731642,  0.087484036 },\n      {    0.001367e-6,    14143.495242431,  3.987576591 },\n      {    0.001344e-6,     7234.794256242,  0.090454338 },\n      {    0.001438e-6,    11499.656222793,  0.974387904 },\n      {    0.001257e-6,     6836.645252834,  1.509069366 },\n      {    0.001358e-6,    11513.883316794,  0.495572260 },\n      {    0.001628e-6,     7632.943259650,  4.968445721 },\n      {    0.001169e-6,      103.092774219,  2.838496795 },\n   /* 551, 560 */\n      {    0.001162e-6,     4164.311989613,  3.408387778 },\n      {    0.001092e-6,     6069.776754553,  3.617942651 },\n      {    0.001008e-6,    17789.845619785,  0.286350174 },\n      {    0.001008e-6,      639.897286314,  1.610762073 },\n      {    0.000918e-6,    10213.285546211,  5.532798067 },\n      {    0.001011e-6,    -6256.777530192,  0.661826484 },\n      {    0.000753e-6,    16730.463689596,  3.905030235 },\n      {    0.000737e-6,    11926.254413669,  4.641956361 },\n      {    0.000694e-6,     3340.612426700,  2.111120332 },\n      {    0.000701e-6,     3894.181829542,  2.760823491 },\n   /* 561, 570 */\n      {    0.000689e-6,     -135.065080035,  4.768800780 },\n      {    0.000700e-6,    13367.972631107,  5.760439898 },\n      {    0.000664e-6,     6040.347246017,  1.051215840 },\n      {    0.000654e-6,     5650.292110678,  4.911332503 },\n      {    0.000788e-6,     6681.224853400,  4.699648011 },\n      {    0.000628e-6,     5333.900241022,  5.024608847 },\n      {    0.000755e-6,     -110.206321219,  4.370971253 },\n      {    0.000628e-6,     6290.189396992,  3.660478857 },\n      {    0.000635e-6,    25132.303399966,  4.121051532 },\n      {    0.000534e-6,     5966.683980335,  1.173284524 },\n   /* 571, 580 */\n      {    0.000543e-6,     -433.711737877,  0.345585464 },\n      {    0.000517e-6,    -1990.745017041,  5.414571768 },\n      {    0.000504e-6,     5767.611978898,  2.328281115 },\n      {    0.000485e-6,     5753.384884897,  1.685874771 },\n      {    0.000463e-6,     7860.419392439,  5.297703006 },\n      {    0.000604e-6,      515.463871093,  0.591998446 },\n      {    0.000443e-6,    12168.002696575,  4.830881244 },\n      {    0.000570e-6,      199.072001436,  3.899190272 },\n      {    0.000465e-6,    10969.965257698,  0.476681802 },\n      {    0.000424e-6,    -7079.373856808,  1.112242763 },\n   /* 581, 590 */\n      {    0.000427e-6,      735.876513532,  1.994214480 },\n      {    0.000478e-6,    -6127.655450557,  3.778025483 },\n      {    0.000414e-6,    10973.555686350,  5.441088327 },\n      {    0.000512e-6,     1589.072895284,  0.107123853 },\n      {    0.000378e-6,    10984.192351700,  0.915087231 },\n      {    0.000402e-6,    11371.704689758,  4.107281715 },\n      {    0.000453e-6,     9917.696874510,  1.917490952 },\n      {    0.000395e-6,      149.563197135,  2.763124165 },\n      {    0.000371e-6,     5739.157790895,  3.112111866 },\n      {    0.000350e-6,    11790.629088659,  0.440639857 },\n   /* 591, 600 */\n      {    0.000356e-6,     6133.512652857,  5.444568842 },\n      {    0.000344e-6,      412.371096874,  5.676832684 },\n      {    0.000383e-6,      955.599741609,  5.559734846 },\n      {    0.000333e-6,     6496.374945429,  0.261537984 },\n      {    0.000340e-6,     6055.549660552,  5.975534987 },\n      {    0.000334e-6,     1066.495477190,  2.335063907 },\n      {    0.000399e-6,    11506.769769794,  5.321230910 },\n      {    0.000314e-6,    18319.536584880,  2.313312404 },\n      {    0.000424e-6,     1052.268383188,  1.211961766 },\n      {    0.000307e-6,       63.735898303,  3.169551388 },\n   /* 601, 610 */\n      {    0.000329e-6,       29.821438149,  6.106912080 },\n      {    0.000357e-6,     6309.374169791,  4.223760346 },\n      {    0.000312e-6,    -3738.761430108,  2.180556645 },\n      {    0.000301e-6,      309.278322656,  1.499984572 },\n      {    0.000268e-6,    12043.574281889,  2.447520648 },\n      {    0.000257e-6,    12491.370101415,  3.662331761 },\n      {    0.000290e-6,      625.670192312,  1.272834584 },\n      {    0.000256e-6,     5429.879468239,  1.913426912 },\n      {    0.000339e-6,     3496.032826134,  4.165930011 },\n      {    0.000283e-6,     3930.209696220,  4.325565754 },\n   /* 611, 620 */\n      {    0.000241e-6,    12528.018664345,  3.832324536 },\n      {    0.000304e-6,     4686.889407707,  1.612348468 },\n      {    0.000259e-6,    16200.772724501,  3.470173146 },\n      {    0.000238e-6,    12139.553509107,  1.147977842 },\n      {    0.000236e-6,     6172.869528772,  3.776271728 },\n      {    0.000296e-6,    -7058.598461315,  0.460368852 },\n      {    0.000306e-6,    10575.406682942,  0.554749016 },\n      {    0.000251e-6,    17298.182327326,  0.834332510 },\n      {    0.000290e-6,     4732.030627343,  4.759564091 },\n      {    0.000261e-6,     5884.926846583,  0.298259862 },\n   /* 621, 630 */\n      {    0.000249e-6,     5547.199336460,  3.749366406 },\n      {    0.000213e-6,    11712.955318231,  5.415666119 },\n      {    0.000223e-6,     4701.116501708,  2.703203558 },\n      {    0.000268e-6,     -640.877607382,  0.283670793 },\n      {    0.000209e-6,     5636.065016677,  1.238477199 },\n      {    0.000193e-6,    10177.257679534,  1.943251340 },\n      {    0.000182e-6,     6283.143160294,  2.456157599 },\n      {    0.000184e-6,     -227.526189440,  5.888038582 },\n      {    0.000182e-6,    -6283.008539689,  0.241332086 },\n      {    0.000228e-6,    -6284.056171060,  2.657323816 },\n   /* 631, 640 */\n      {    0.000166e-6,     7238.675591600,  5.930629110 },\n      {    0.000167e-6,     3097.883822726,  5.570955333 },\n      {    0.000159e-6,     -323.505416657,  5.786670700 },\n      {    0.000154e-6,    -4136.910433516,  1.517805532 },\n      {    0.000176e-6,    12029.347187887,  3.139266834 },\n      {    0.000167e-6,    12132.439962106,  3.556352289 },\n      {    0.000153e-6,      202.253395174,  1.463313961 },\n      {    0.000157e-6,    17267.268201691,  1.586837396 },\n      {    0.000142e-6,    83996.847317911,  0.022670115 },\n      {    0.000152e-6,    17260.154654690,  0.708528947 },\n   /* 641, 650 */\n      {    0.000144e-6,     6084.003848555,  5.187075177 },\n      {    0.000135e-6,     5756.566278634,  1.993229262 },\n      {    0.000134e-6,     5750.203491159,  3.457197134 },\n      {    0.000144e-6,     5326.786694021,  6.066193291 },\n      {    0.000160e-6,    11015.106477335,  1.710431974 },\n      {    0.000133e-6,     3634.621024518,  2.836451652 },\n      {    0.000134e-6,    18073.704938650,  5.453106665 },\n      {    0.000134e-6,     1162.474704408,  5.326898811 },\n      {    0.000128e-6,     5642.198242609,  2.511652591 },\n      {    0.000160e-6,      632.783739313,  5.628785365 },\n   /* 651, 660 */\n      {    0.000132e-6,    13916.019109642,  0.819294053 },\n      {    0.000122e-6,    14314.168113050,  5.677408071 },\n      {    0.000125e-6,    12359.966151546,  5.251984735 },\n      {    0.000121e-6,     5749.452731634,  2.210924603 },\n      {    0.000136e-6,     -245.831646229,  1.646502367 },\n      {    0.000120e-6,     5757.317038160,  3.240883049 },\n      {    0.000134e-6,    12146.667056108,  3.059480037 },\n      {    0.000137e-6,     6206.809778716,  1.867105418 },\n      {    0.000141e-6,    17253.041107690,  2.069217456 },\n      {    0.000129e-6,    -7477.522860216,  2.781469314 },\n   /* 661, 670 */\n      {    0.000116e-6,     5540.085789459,  4.281176991 },\n      {    0.000116e-6,     9779.108676125,  3.320925381 },\n      {    0.000129e-6,     5237.921013804,  3.497704076 },\n      {    0.000113e-6,     5959.570433334,  0.983210840 },\n      {    0.000122e-6,     6282.095528923,  2.674938860 },\n      {    0.000140e-6,      -11.045700264,  4.957936982 },\n      {    0.000108e-6,    23543.230504682,  1.390113589 },\n      {    0.000106e-6,   -12569.674818332,  0.429631317 },\n      {    0.000110e-6,     -266.607041722,  5.501340197 },\n      {    0.000115e-6,    12559.038152982,  4.691456618 },\n   /* 671, 680 */\n      {    0.000134e-6,    -2388.894020449,  0.577313584 },\n      {    0.000109e-6,    10440.274292604,  6.218148717 },\n      {    0.000102e-6,     -543.918059096,  1.477842615 },\n      {    0.000108e-6,    21228.392023546,  2.237753948 },\n      {    0.000101e-6,    -4535.059436924,  3.100492232 },\n      {    0.000103e-6,       76.266071276,  5.594294322 },\n      {    0.000104e-6,      949.175608970,  5.674287810 },\n      {    0.000101e-6,    13517.870106233,  2.196632348 },\n      {    0.000100e-6,    11933.367960670,  4.056084160 },\n\n   /* T^2 */\n      {    4.322990e-6,     6283.075849991,  2.642893748 },\n   /* 681, 690 */\n      {    0.406495e-6,        0.000000000,  4.712388980 },\n      {    0.122605e-6,    12566.151699983,  2.438140634 },\n      {    0.019476e-6,      213.299095438,  1.642186981 },\n      {    0.016916e-6,      529.690965095,  4.510959344 },\n      {    0.013374e-6,       -3.523118349,  1.502210314 },\n      {    0.008042e-6,       26.298319800,  0.478549024 },\n      {    0.007824e-6,      155.420399434,  5.254710405 },\n      {    0.004894e-6,     5746.271337896,  4.683210850 },\n      {    0.004875e-6,     5760.498431898,  0.759507698 },\n      {    0.004416e-6,     5223.693919802,  6.028853166 },\n   /* 691, 700 */\n      {    0.004088e-6,       -7.113547001,  0.060926389 },\n      {    0.004433e-6,    77713.771467920,  3.627734103 },\n      {    0.003277e-6,    18849.227549974,  2.327912542 },\n      {    0.002703e-6,     6062.663207553,  1.271941729 },\n      {    0.003435e-6,     -775.522611324,  0.747446224 },\n      {    0.002618e-6,     6076.890301554,  3.633715689 },\n      {    0.003146e-6,      206.185548437,  5.647874613 },\n      {    0.002544e-6,     1577.343542448,  6.232904270 },\n      {    0.002218e-6,     -220.412642439,  1.309509946 },\n      {    0.002197e-6,     5856.477659115,  2.407212349 },\n   /* 701, 710 */\n      {    0.002897e-6,     5753.384884897,  5.863842246 },\n      {    0.001766e-6,      426.598190876,  0.754113147 },\n      {    0.001738e-6,     -796.298006816,  2.714942671 },\n      {    0.001695e-6,      522.577418094,  2.629369842 },\n      {    0.001584e-6,     5507.553238667,  1.341138229 },\n      {    0.001503e-6,     -242.728603974,  0.377699736 },\n      {    0.001552e-6,     -536.804512095,  2.904684667 },\n      {    0.001370e-6,     -398.149003408,  1.265599125 },\n      {    0.001889e-6,    -5573.142801634,  4.413514859 },\n      {    0.001722e-6,     6069.776754553,  2.445966339 },\n   /* 711, 720 */\n      {    0.001124e-6,     1059.381930189,  5.041799657 },\n      {    0.001258e-6,      553.569402842,  3.849557278 },\n      {    0.000831e-6,      951.718406251,  2.471094709 },\n      {    0.000767e-6,     4694.002954708,  5.363125422 },\n      {    0.000756e-6,     1349.867409659,  1.046195744 },\n      {    0.000775e-6,      -11.045700264,  0.245548001 },\n      {    0.000597e-6,     2146.165416475,  4.543268798 },\n      {    0.000568e-6,     5216.580372801,  4.178853144 },\n      {    0.000711e-6,     1748.016413067,  5.934271972 },\n      {    0.000499e-6,    12036.460734888,  0.624434410 },\n   /* 721, 730 */\n      {    0.000671e-6,    -1194.447010225,  4.136047594 },\n      {    0.000488e-6,     5849.364112115,  2.209679987 },\n      {    0.000621e-6,     6438.496249426,  4.518860804 },\n      {    0.000495e-6,    -6286.598968340,  1.868201275 },\n      {    0.000456e-6,     5230.807466803,  1.271231591 },\n      {    0.000451e-6,     5088.628839767,  0.084060889 },\n      {    0.000435e-6,     5643.178563677,  3.324456609 },\n      {    0.000387e-6,    10977.078804699,  4.052488477 },\n      {    0.000547e-6,   161000.685737473,  2.841633844 },\n      {    0.000522e-6,     3154.687084896,  2.171979966 },\n   /* 731, 740 */\n      {    0.000375e-6,     5486.777843175,  4.983027306 },\n      {    0.000421e-6,     5863.591206116,  4.546432249 },\n      {    0.000439e-6,     7084.896781115,  0.522967921 },\n      {    0.000309e-6,     2544.314419883,  3.172606705 },\n      {    0.000347e-6,     4690.479836359,  1.479586566 },\n      {    0.000317e-6,      801.820931124,  3.553088096 },\n      {    0.000262e-6,      419.484643875,  0.606635550 },\n      {    0.000248e-6,     6836.645252834,  3.014082064 },\n      {    0.000245e-6,    -1592.596013633,  5.519526220 },\n      {    0.000225e-6,     4292.330832950,  2.877956536 },\n   /* 741, 750 */\n      {    0.000214e-6,     7234.794256242,  1.605227587 },\n      {    0.000205e-6,     5767.611978898,  0.625804796 },\n      {    0.000180e-6,    10447.387839604,  3.499954526 },\n      {    0.000229e-6,      199.072001436,  5.632304604 },\n      {    0.000214e-6,      639.897286314,  5.960227667 },\n      {    0.000175e-6,     -433.711737877,  2.162417992 },\n      {    0.000209e-6,      515.463871093,  2.322150893 },\n      {    0.000173e-6,     6040.347246017,  2.556183691 },\n      {    0.000184e-6,     6309.374169791,  4.732296790 },\n      {    0.000227e-6,   149854.400134205,  5.385812217 },\n   /* 751, 760 */\n      {    0.000154e-6,     8031.092263058,  5.120720920 },\n      {    0.000151e-6,     5739.157790895,  4.815000443 },\n      {    0.000197e-6,     7632.943259650,  0.222827271 },\n      {    0.000197e-6,       74.781598567,  3.910456770 },\n      {    0.000138e-6,     6055.549660552,  1.397484253 },\n      {    0.000149e-6,    -6127.655450557,  5.333727496 },\n      {    0.000137e-6,     3894.181829542,  4.281749907 },\n      {    0.000135e-6,     9437.762934887,  5.979971885 },\n      {    0.000139e-6,    -2352.866153772,  4.715630782 },\n      {    0.000142e-6,     6812.766815086,  0.513330157 },\n   /* 761, 770 */\n      {    0.000120e-6,    -4705.732307544,  0.194160689 },\n      {    0.000131e-6,   -71430.695617928,  0.000379226 },\n      {    0.000124e-6,     6279.552731642,  2.122264908 },\n      {    0.000108e-6,    -6256.777530192,  0.883445696 },\n\n   /* T^3 */\n      {    0.143388e-6,     6283.075849991,  1.131453581 },\n      {    0.006671e-6,    12566.151699983,  0.775148887 },\n      {    0.001480e-6,      155.420399434,  0.480016880 },\n      {    0.000934e-6,      213.299095438,  6.144453084 },\n      {    0.000795e-6,      529.690965095,  2.941595619 },\n      {    0.000673e-6,     5746.271337896,  0.120415406 },\n   /* 771, 780 */\n      {    0.000672e-6,     5760.498431898,  5.317009738 },\n      {    0.000389e-6,     -220.412642439,  3.090323467 },\n      {    0.000373e-6,     6062.663207553,  3.003551964 },\n      {    0.000360e-6,     6076.890301554,  1.918913041 },\n      {    0.000316e-6,      -21.340641002,  5.545798121 },\n      {    0.000315e-6,     -242.728603974,  1.884932563 },\n      {    0.000278e-6,      206.185548437,  1.266254859 },\n      {    0.000238e-6,     -536.804512095,  4.532664830 },\n      {    0.000185e-6,      522.577418094,  4.578313856 },\n      {    0.000245e-6,    18849.227549974,  0.587467082 },\n   /* 781, 787 */\n      {    0.000180e-6,      426.598190876,  5.151178553 },\n      {    0.000200e-6,      553.569402842,  5.355983739 },\n      {    0.000141e-6,     5223.693919802,  1.336556009 },\n      {    0.000104e-6,     5856.477659115,  4.239842759 },\n\n   /* T^4 */\n      {    0.003826e-6,     6283.075849991,  5.705257275 },\n      {    0.000303e-6,    12566.151699983,  5.407132842 },\n      {    0.000209e-6,      155.420399434,  1.989815753 }\n   };\n\n\n/* Time since J2000.0 in Julian millennia. */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJM;\n\n/* ================= */\n/* Topocentric terms */\n/* ================= */\n\n/* Convert UT to local solar time in radians. */\n   tsol = fmod(ut, 1.0) * ERFA_D2PI + elong;\n\n/* FUNDAMENTAL ARGUMENTS:  Simon et al. 1994. */\n\n/* Combine time argument (millennia) with deg/arcsec factor. */\n   w = t / 3600.0;\n\n/* Sun Mean Longitude. */\n   elsun = fmod(280.46645683 + 1296027711.03429 * w, 360.0) * ERFA_DD2R;\n\n/* Sun Mean Anomaly. */\n   emsun = fmod(357.52910918 + 1295965810.481 * w, 360.0) * ERFA_DD2R;\n\n/* Mean Elongation of Moon from Sun. */\n   d = fmod(297.85019547 + 16029616012.090 * w, 360.0) * ERFA_DD2R;\n\n/* Mean Longitude of Jupiter. */\n   elj = fmod(34.35151874 + 109306899.89453 * w, 360.0) * ERFA_DD2R;\n\n/* Mean Longitude of Saturn. */\n   els = fmod(50.07744430 + 44046398.47038 * w, 360.0) * ERFA_DD2R;\n\n/* TOPOCENTRIC TERMS:  Moyer 1981 and Murray 1983. */\n   wt =   +  0.00029e-10 * u * sin(tsol + elsun - els)\n          +  0.00100e-10 * u * sin(tsol - 2.0 * emsun)\n          +  0.00133e-10 * u * sin(tsol - d)\n          +  0.00133e-10 * u * sin(tsol + elsun - elj)\n          -  0.00229e-10 * u * sin(tsol + 2.0 * elsun + emsun)\n          -  0.02200e-10 * v * cos(elsun + emsun)\n          +  0.05312e-10 * u * sin(tsol - emsun)\n          -  0.13677e-10 * u * sin(tsol + 2.0 * elsun)\n          -  1.31840e-10 * v * cos(elsun)\n          +  3.17679e-10 * u * sin(tsol);\n\n/* ===================== */\n/* Fairhead et al. model */\n/* ===================== */\n\n/* T**0 */\n   w0 = 0;\n   for (j = 473; j >= 0; j--) {\n      w0 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]);\n   }\n\n/* T**1 */\n   w1 = 0;\n   for (j = 678; j >= 474; j--) {\n      w1 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]);\n   }\n\n/* T**2 */\n   w2 = 0;\n   for (j = 763; j >= 679; j--) {\n      w2 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]);\n   }\n\n/* T**3 */\n   w3 = 0;\n   for (j = 783; j >= 764; j--) {\n      w3 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]);\n   }\n\n/* T**4 */\n   w4 = 0;\n   for (j = 786; j >= 784; j--) {\n      w4 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]);\n   }\n\n/* Multiply by powers of T and combine. */\n   wf = t * (t * (t * (t * w4 + w3) + w2) + w1) + w0;\n\n/* Adjustments to use JPL planetary masses instead of IAU. */\n   wj =   0.00065e-6 * sin(6069.776754 * t + 4.021194) +\n          0.00033e-6 * sin( 213.299095 * t + 5.543132) +\n        (-0.00196e-6 * sin(6208.294251 * t + 5.696701)) +\n        (-0.00173e-6 * sin(  74.781599 * t + 2.435900)) +\n          0.03638e-6 * t * t;\n\n/* ============ */\n/* Final result */\n/* ============ */\n\n/* TDB-TT in seconds. */\n   w = wt + wf + wj;\n\n   return w;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13196,"name":"gd2gc.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraGd2gc ( int n, double elong, double phi, double height,\n               double xyz[3] )\n/*\n**  - - - - - - - - -\n**   e r a G d 2 g c\n**  - - - - - - - - -\n**\n**  Transform geodetic coordinates to geocentric using the specified\n**  reference ellipsoid.\n**\n**  Given:\n**     n       int        ellipsoid identifier (Note 1)\n**     elong   double     longitude (radians, east +ve)\n**     phi     double     latitude (geodetic, radians, Note 3)\n**     height  double     height above ellipsoid (geodetic, Notes 2,3)\n**\n**  Returned:\n**     xyz     double[3]  geocentric vector (Note 2)\n**\n**  Returned (function value):\n**             int        status:  0 = OK\n**                                -1 = illegal identifier (Note 3)\n**                                -2 = illegal case (Note 3)\n**\n**  Notes:\n**\n**  1) The identifier n is a number that specifies the choice of\n**     reference ellipsoid.  The following are supported:\n**\n**        n    ellipsoid\n**\n**        1     ERFA_WGS84\n**        2     ERFA_GRS80\n**        3     ERFA_WGS72\n**\n**     The n value has no significance outside the ERFA software.  For\n**     convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.\n**\n**  2) The height (height, given) and the geocentric vector (xyz,\n**     returned) are in meters.\n**\n**  3) No validation is performed on the arguments elong, phi and\n**     height.  An error status -1 means that the identifier n is\n**     illegal.  An error status -2 protects against cases that would\n**     lead to arithmetic exceptions.  In all error cases, xyz is set\n**     to zeros.\n**\n**  4) The inverse transformation is performed in the function eraGc2gd.\n**\n**  Called:\n**     eraEform     Earth reference ellipsoids\n**     eraGd2gce    geodetic to geocentric transformation, general\n**     eraZp        zero p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   double a, f;\n\n\n/* Obtain reference ellipsoid parameters. */\n   j = eraEform ( n, &a, &f );\n\n/* If OK, transform longitude, geodetic latitude, height to x,y,z. */\n   if ( j == 0 ) {\n      j = eraGd2gce ( a, f, elong, phi, height, xyz );\n      if ( j != 0 ) j = -2;\n   }\n\n/* Deal with any errors. */\n   if ( j != 0 ) eraZp ( xyz );\n\n/* Return the status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13197,"name":"pnm00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPnm00b(double date1, double date2, double rbpn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P n m 0 0 b\n**  - - - - - - - - - -\n**\n**  Form the matrix of precession-nutation for a given date (including\n**  frame bias), equinox-based, IAU 2000B model.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rbpn        double[3][3] bias-precession-nutation matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where\n**     the p-vector V(date) is with respect to the true equatorial triad\n**     of date date1+date2 and the p-vector V(GCRS) is with respect to\n**     the Geocentric Celestial Reference System (IAU, 2000).\n**\n**  3) The present function is faster, but slightly less accurate (about\n**     1 mas), than the eraPnm00a function.\n**\n**  Called:\n**     eraPn00b     bias/precession/nutation, IAU 2000B\n**\n**  Reference:\n**\n**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.\n**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.\n**     (2000)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3];\n\n\n/* Obtain the required matrix (discarding other results). */\n   eraPn00b(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13198,"name":"a2af.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraA2af(int ndp, double angle, char *sign, int idmsf[4])\n/*\n**  - - - - - - - -\n**   e r a A 2 a f\n**  - - - - - - - -\n**\n**  Decompose radians into degrees, arcminutes, arcseconds, fraction.\n**\n**  Given:\n**     ndp     int     resolution (Note 1)\n**     angle   double  angle in radians\n**\n**  Returned:\n**     sign    char    '+' or '-'\n**     idmsf   int[4]  degrees, arcminutes, arcseconds, fraction\n**\n**  Called:\n**     eraD2tf      decompose days to hms\n**\n**  Notes:\n**\n**  1) The argument ndp is interpreted as follows:\n**\n**     ndp         resolution\n**      :      ...0000 00 00\n**     -7         1000 00 00\n**     -6          100 00 00\n**     -5           10 00 00\n**     -4            1 00 00\n**     -3            0 10 00\n**     -2            0 01 00\n**     -1            0 00 10\n**      0            0 00 01\n**      1            0 00 00.1\n**      2            0 00 00.01\n**      3            0 00 00.001\n**      :            0 00 00.000...\n**\n**  2) The largest positive useful value for ndp is determined by the\n**     size of angle, the format of doubles on the target platform, and\n**     the risk of overflowing idmsf[3].  On a typical platform, for\n**     angle up to 2pi, the available floating-point precision might\n**     correspond to ndp=12.  However, the practical limit is typically\n**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is\n**     only 16 bits.\n**\n**  3) The absolute value of angle may exceed 2pi.  In cases where it\n**     does not, it is up to the caller to test for and handle the\n**     case where angle is very nearly 2pi and rounds up to 360 degrees,\n**     by testing for idmsf[0]=360 and setting idmsf[0-3] to zero.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Hours to degrees * radians to turns */\n   const double F = 15.0 / ERFA_D2PI;\n\n\n/* Scale then use days to h,m,s function. */\n   eraD2tf(ndp, angle*F, sign, idmsf);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13199,"name":"fk52h.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraFk52h(double r5, double d5,\n              double dr5, double dd5, double px5, double rv5,\n              double *rh, double *dh,\n              double *drh, double *ddh, double *pxh, double *rvh)\n/*\n**  - - - - - - - - -\n**   e r a F k 5 2 h\n**  - - - - - - - - -\n**\n**  Transform FK5 (J2000.0) star data into the Hipparcos system.\n**\n**  Given (all FK5, equinox J2000.0, epoch J2000.0):\n**     r5      double    RA (radians)\n**     d5      double    Dec (radians)\n**     dr5     double    proper motion in RA (dRA/dt, rad/Jyear)\n**     dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)\n**     px5     double    parallax (arcsec)\n**     rv5     double    radial velocity (km/s, positive = receding)\n**\n**  Returned (all Hipparcos, epoch J2000.0):\n**     rh      double    RA (radians)\n**     dh      double    Dec (radians)\n**     drh     double    proper motion in RA (dRA/dt, rad/Jyear)\n**     ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)\n**     pxh     double    parallax (arcsec)\n**     rvh     double    radial velocity (km/s, positive = receding)\n**\n**  Notes:\n**\n**  1) This function transforms FK5 star positions and proper motions\n**     into the system of the Hipparcos catalog.\n**\n**  2) The proper motions in RA are dRA/dt rather than\n**     cos(Dec)*dRA/dt, and are per year rather than per century.\n**\n**  3) The FK5 to Hipparcos transformation is modeled as a pure\n**     rotation and spin;  zonal errors in the FK5 catalog are not\n**     taken into account.\n**\n**  4) See also eraH2fk5, eraFk5hz, eraHfk5z.\n**\n**  Called:\n**     eraStarpv    star catalog data to space motion pv-vector\n**     eraFk5hip    FK5 to Hipparcos rotation and spin\n**     eraRxp       product of r-matrix and p-vector\n**     eraPxp       vector product of two p-vectors\n**     eraPpp       p-vector plus p-vector\n**     eraPvstar    space motion pv-vector to star catalog data\n**\n**  Reference:\n**\n**     F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double pv5[2][3], r5h[3][3], s5h[3], wxp[3], vv[3], pvh[2][3];\n\n\n/* FK5 barycentric position/velocity pv-vector (normalized). */\n   eraStarpv(r5, d5, dr5, dd5, px5, rv5, pv5);\n\n/* FK5 to Hipparcos orientation matrix and spin vector. */\n   eraFk5hip(r5h, s5h);\n\n/* Make spin units per day instead of per year. */\n   for ( i = 0; i < 3; s5h[i++] /= 365.25 );\n\n/* Orient the FK5 position into the Hipparcos system. */\n   eraRxp(r5h, pv5[0], pvh[0]);\n\n/* Apply spin to the position giving an extra space motion component. */\n   eraPxp(pv5[0], s5h, wxp);\n\n/* Add this component to the FK5 space motion. */\n   eraPpp(wxp, pv5[1], vv);\n\n/* Orient the FK5 space motion into the Hipparcos system. */\n   eraRxp(r5h, vv, pvh[1]);\n\n/* Hipparcos pv-vector to spherical. */\n   eraPvstar(pvh, rh, dh, drh, ddh, pxh, rvh);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13200,"name":"epj.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEpj(double dj1, double dj2)\n/*\n**  - - - - - - -\n**   e r a E p j\n**  - - - - - - -\n**\n**  Julian Date to Julian Epoch.\n**\n**  Given:\n**     dj1,dj2    double     Julian Date (see note)\n**\n**  Returned (function value):\n**                double     Julian Epoch\n**\n**  Note:\n**\n**     The Julian Date is supplied in two pieces, in the usual ERFA\n**     manner, which is designed to preserve time resolution.  The\n**     Julian Date is available as a single number by adding dj1 and\n**     dj2.  The maximum resolution is achieved if dj1 is 2451545.0\n**     (J2000.0).\n**\n**  Reference:\n**\n**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double epj;\n\n\n   epj = 2000.0 + ((dj1 - ERFA_DJ00) + dj2) / ERFA_DJY;\n\n   return epj;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13201,"name":"gst00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGst00a(double uta, double utb, double tta, double ttb)\n/*\n**  - - - - - - - - - -\n**   e r a G s t 0 0 a\n**  - - - - - - - - - -\n**\n**  Greenwich apparent sidereal time (consistent with IAU 2000\n**  resolutions).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich apparent sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both\n**     Julian Dates, apportioned in any convenient way between the\n**     argument pairs.  For example, JD=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**            Part A        Part B\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable (in the case of UT;  the TT is not at all critical\n**     in this respect).  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     Rotation Angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation\n**     and TT to predict the effects of precession-nutation.  If UT1 is\n**     used for both purposes, errors of order 100 microarcseconds\n**     result.\n**\n**  3) This GAST is compatible with the IAU 2000 resolutions and must be\n**     used only in conjunction with other IAU 2000 compatible\n**     components such as precession-nutation.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  5) The algorithm is from Capitaine et al. (2003) and IERS\n**     Conventions 2003.\n**\n**  Called:\n**     eraGmst00    Greenwich mean sidereal time, IAU 2000\n**     eraEe00a     equation of the equinoxes, IAU 2000A\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gmst00, ee00a, gst;\n\n\n   gmst00 = eraGmst00(uta, utb, tta, ttb);\n   ee00a = eraEe00a(tta, ttb);\n   gst = eraAnp(gmst00 + ee00a);\n\n   return gst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13202,"name":"gst94.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGst94(double uta, double utb)\n/*\n**  - - - - - - - - -\n**   e r a G s t 9 4\n**  - - - - - - - - -\n**\n**  Greenwich apparent sidereal time (consistent with IAU 1982/94\n**  resolutions).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich apparent sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 date uta+utb is a Julian Date, apportioned in any\n**     convenient way between the argument pair.  For example,\n**     JD=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     Rotation Angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) The result is compatible with the IAU 1982 and 1994 resolutions,\n**     except that accuracy has been compromised for the sake of\n**     convenience in that UT is used instead of TDB (or TT) to compute\n**     the equation of the equinoxes.\n**\n**  3) This GAST must be used only in conjunction with contemporaneous\n**     IAU standards such as 1976 precession, 1980 obliquity and 1982\n**     nutation.  It is not compatible with the IAU 2000 resolutions.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  Called:\n**     eraGmst82    Greenwich mean sidereal time, IAU 1982\n**     eraEqeq94    equation of the equinoxes, IAU 1994\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**     IAU Resolution C7, Recommendation 3 (1994)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gmst82, eqeq94, gst;\n\n\n   gmst82 = eraGmst82(uta, utb);\n   eqeq94 = eraEqeq94(uta, utb);\n   gst = eraAnp(gmst82  + eqeq94);\n\n   return gst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13203,"name":"s00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraS00(double date1, double date2, double x, double y)\n/*\n**  - - - - - - -\n**   e r a S 0 0\n**  - - - - - - -\n**\n**  The CIO locator s, positioning the Celestial Intermediate Origin on\n**  the equator of the Celestial Intermediate Pole, given the CIP's X,Y\n**  coordinates.  Compatible with IAU 2000A precession-nutation.\n**\n**  Given:\n**     date1,date2   double    TT as a 2-part Julian Date (Note 1)\n**     x,y           double    CIP coordinates (Note 3)\n**\n**  Returned (function value):\n**                   double    the CIO locator s in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The CIO locator s is the difference between the right ascensions\n**     of the same point in two systems:  the two systems are the GCRS\n**     and the CIP,CIO, and the point is the ascending node of the\n**     CIP equator.  The quantity s remains below 0.1 arcsecond\n**     throughout 1900-2100.\n**\n**  3) The series used to compute s is in fact for s+XY/2, where X and Y\n**     are the x and y components of the CIP unit vector;  this series\n**     is more compact than a direct series for s would be.  This\n**     function requires X,Y to be supplied by the caller, who is\n**     responsible for providing values that are consistent with the\n**     supplied date.\n**\n**  4) The model is consistent with the IAU 2000A precession-nutation.\n**\n**  Called:\n**     eraFal03     mean anomaly of the Moon\n**     eraFalp03    mean anomaly of the Sun\n**     eraFaf03     mean argument of the latitude of the Moon\n**     eraFad03     mean elongation of the Moon from the Sun\n**     eraFaom03    mean longitude of the Moon's ascending node\n**     eraFave03    mean longitude of Venus\n**     eraFae03     mean longitude of Earth\n**     eraFapa03    general accumulated precession in longitude\n**\n**  References:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Time since J2000.0, in Julian centuries */\n   double t;\n\n/* Miscellaneous */\n   int i, j;\n   double a, w0, w1, w2, w3, w4, w5;\n\n/* Fundamental arguments */\n   double fa[8];\n\n/* Returned value */\n   double s;\n\n/* --------------------- */\n/* The series for s+XY/2 */\n/* --------------------- */\n\n   typedef struct {\n      int nfa[8];      /* coefficients of l,l',F,D,Om,LVe,LE,pA */\n      double s, c;     /* sine and cosine coefficients */\n   } TERM;\n\n/* Polynomial coefficients */\n   static const double sp[] = {\n\n   /* 1-6 */\n          94.00e-6,\n        3808.35e-6,\n        -119.94e-6,\n      -72574.09e-6,\n          27.70e-6,\n          15.61e-6\n   };\n\n/* Terms of order t^0 */\n   static const TERM s0[] = {\n\n   /* 1-10 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0}, -2640.73e-6,   0.39e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},   -63.53e-6,   0.02e-6 },\n      {{ 0,  0,  2, -2,  3,  0,  0,  0},   -11.75e-6,  -0.01e-6 },\n      {{ 0,  0,  2, -2,  1,  0,  0,  0},   -11.21e-6,  -0.01e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},     4.57e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  3,  0,  0,  0},    -2.02e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  1,  0,  0,  0},    -1.98e-6,   0.00e-6 },\n      {{ 0,  0,  0,  0,  3,  0,  0,  0},     1.72e-6,   0.00e-6 },\n      {{ 0,  1,  0,  0,  1,  0,  0,  0},     1.41e-6,   0.01e-6 },\n      {{ 0,  1,  0,  0, -1,  0,  0,  0},     1.26e-6,   0.01e-6 },\n\n   /* 11-20 */\n      {{ 1,  0,  0,  0, -1,  0,  0,  0},     0.63e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0,  1,  0,  0,  0},     0.63e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  3,  0,  0,  0},    -0.46e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  1,  0,  0,  0},    -0.45e-6,   0.00e-6 },\n      {{ 0,  0,  4, -4,  4,  0,  0,  0},    -0.36e-6,   0.00e-6 },\n      {{ 0,  0,  1, -1,  1, -8, 12,  0},     0.24e-6,   0.12e-6 },\n      {{ 0,  0,  2,  0,  0,  0,  0,  0},    -0.32e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},    -0.28e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  3,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  1,  0,  0,  0},    -0.26e-6,   0.00e-6 },\n\n   /* 21-30 */\n      {{ 0,  0,  2, -2,  0,  0,  0,  0},     0.21e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -3,  0,  0,  0},    -0.19e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -1,  0,  0,  0},    -0.18e-6,   0.00e-6 },\n      {{ 0,  0,  0,  0,  0,  8,-13, -1},     0.10e-6,  -0.05e-6 },\n      {{ 0,  0,  0,  2,  0,  0,  0,  0},    -0.15e-6,   0.00e-6 },\n      {{ 2,  0, -2,  0, -1,  0,  0,  0},     0.14e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  2,  0,  0,  0},     0.14e-6,   0.00e-6 },\n      {{ 1,  0,  0, -2,  1,  0,  0,  0},    -0.14e-6,   0.00e-6 },\n      {{ 1,  0,  0, -2, -1,  0,  0,  0},    -0.14e-6,   0.00e-6 },\n      {{ 0,  0,  4, -2,  4,  0,  0,  0},    -0.13e-6,   0.00e-6 },\n\n   /* 31-33 */\n      {{ 0,  0,  2, -2,  4,  0,  0,  0},     0.11e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -3,  0,  0,  0},    -0.11e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -1,  0,  0,  0},    -0.11e-6,   0.00e-6 }\n   };\n\n/* Terms of order t^1 */\n   static const TERM s1[] ={\n\n   /* 1-3 */\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},    -0.07e-6,   3.57e-6 },\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},     1.71e-6,  -0.03e-6 },\n      {{ 0,  0,  2, -2,  3,  0,  0,  0},     0.00e-6,   0.48e-6 }\n   };\n\n/* Terms of order t^2 */\n   static const TERM s2[] ={\n\n   /* 1-10 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},   743.53e-6,  -0.17e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},    56.91e-6,   0.06e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},     9.84e-6,  -0.01e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},    -8.85e-6,   0.01e-6 },\n      {{ 0,  1,  0,  0,  0,  0,  0,  0},    -6.38e-6,  -0.05e-6 },\n      {{ 1,  0,  0,  0,  0,  0,  0,  0},    -3.07e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  2,  0,  0,  0},     2.23e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  1,  0,  0,  0},     1.67e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  2,  0,  0,  0},     1.30e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -2,  0,  0,  0},     0.93e-6,   0.00e-6 },\n\n   /* 11-20 */\n      {{ 1,  0,  0, -2,  0,  0,  0,  0},     0.68e-6,   0.00e-6 },\n      {{ 0,  0,  2, -2,  1,  0,  0,  0},    -0.55e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -2,  0,  0,  0},     0.53e-6,   0.00e-6 },\n      {{ 0,  0,  0,  2,  0,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0,  1,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0, -2, -2, -2,  0,  0,  0},    -0.26e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0, -1,  0,  0,  0},    -0.25e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  1,  0,  0,  0},     0.22e-6,   0.00e-6 },\n      {{ 2,  0,  0, -2,  0,  0,  0,  0},    -0.21e-6,   0.00e-6 },\n      {{ 2,  0, -2,  0, -1,  0,  0,  0},     0.20e-6,   0.00e-6 },\n\n   /* 21-25 */\n      {{ 0,  0,  2,  2,  2,  0,  0,  0},     0.17e-6,   0.00e-6 },\n      {{ 2,  0,  2,  0,  2,  0,  0,  0},     0.13e-6,   0.00e-6 },\n      {{ 2,  0,  0,  0,  0,  0,  0,  0},    -0.13e-6,   0.00e-6 },\n      {{ 1,  0,  2, -2,  2,  0,  0,  0},    -0.12e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  0,  0,  0,  0},    -0.11e-6,   0.00e-6 }\n   };\n\n/* Terms of order t^3 */\n   static const TERM s3[] ={\n\n   /* 1-4 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},     0.30e-6, -23.51e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},    -0.03e-6,  -1.39e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},    -0.01e-6,  -0.24e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},     0.00e-6,   0.22e-6 }\n   };\n\n/* Terms of order t^4 */\n   static const TERM s4[] ={\n\n   /* 1-1 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},    -0.26e-6,  -0.01e-6 }\n   };\n\n/* Number of terms in the series */\n   const int NS0 = (int) (sizeof s0 / sizeof (TERM));\n   const int NS1 = (int) (sizeof s1 / sizeof (TERM));\n   const int NS2 = (int) (sizeof s2 / sizeof (TERM));\n   const int NS3 = (int) (sizeof s3 / sizeof (TERM));\n   const int NS4 = (int) (sizeof s4 / sizeof (TERM));\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental epoch J2000.0 and current date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Fundamental Arguments (from IERS Conventions 2003) */\n\n/* Mean anomaly of the Moon. */\n   fa[0] = eraFal03(t);\n\n/* Mean anomaly of the Sun. */\n   fa[1] = eraFalp03(t);\n\n/* Mean longitude of the Moon minus that of the ascending node. */\n   fa[2] = eraFaf03(t);\n\n/* Mean elongation of the Moon from the Sun. */\n   fa[3] = eraFad03(t);\n\n/* Mean longitude of the ascending node of the Moon. */\n   fa[4] = eraFaom03(t);\n\n/* Mean longitude of Venus. */\n   fa[5] = eraFave03(t);\n\n/* Mean longitude of Earth. */\n   fa[6] = eraFae03(t);\n\n/* General precession in longitude. */\n   fa[7] = eraFapa03(t);\n\n/* Evaluate s. */\n   w0 = sp[0];\n   w1 = sp[1];\n   w2 = sp[2];\n   w3 = sp[3];\n   w4 = sp[4];\n   w5 = sp[5];\n\n   for (i = NS0-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n       a += (double)s0[i].nfa[j] * fa[j];\n   }\n   w0 += s0[i].s * sin(a) + s0[i].c * cos(a);\n   }\n\n   for (i = NS1-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n       a += (double)s1[i].nfa[j] * fa[j];\n   }\n   w1 += s1[i].s * sin(a) + s1[i].c * cos(a);\n   }\n\n   for (i = NS2-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n       a += (double)s2[i].nfa[j] * fa[j];\n   }\n   w2 += s2[i].s * sin(a) + s2[i].c * cos(a);\n   }\n\n   for (i = NS3-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n       a += (double)s3[i].nfa[j] * fa[j];\n   }\n   w3 += s3[i].s * sin(a) + s3[i].c * cos(a);\n   }\n\n   for (i = NS4-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n       a += (double)s4[i].nfa[j] * fa[j];\n   }\n   w4 += s4[i].s * sin(a) + s4[i].c * cos(a);\n   }\n\n   s = (w0 +\n       (w1 +\n       (w2 +\n       (w3 +\n       (w4 +\n        w5 * t) * t) * t) * t) * t) * ERFA_DAS2R - x*y/2.0;\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13204,"name":"dat.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraDat(int iy, int im, int id, double fd, double *deltat )\n/*\n**  - - - - - - -\n**   e r a D a t\n**  - - - - - - -\n**\n**  For a given UTC date, calculate delta(AT) = TAI-UTC.\n**\n**     :------------------------------------------:\n**     :                                          :\n**     :                 IMPORTANT                :\n**     :                                          :\n**     :  A new version of this function must be  :\n**     :  produced whenever a new leap second is  :\n**     :  announced.  There are four items to     :\n**     :  change on each such occasion:           :\n**     :                                          :\n**     :  1) A new line must be added to the set  :\n**     :     of statements that initialize the    :\n**     :     array \"changes\".                     :\n**     :                                          :\n**     :  2) The constant IYV must be set to the  :\n**     :     current year.                        :\n**     :                                          :\n**     :  3) The \"Latest leap second\" comment     :\n**     :     below must be set to the new leap    :\n**     :     second date.                         :\n**     :                                          :\n**     :  4) The \"This revision\" comment, later,  :\n**     :     must be set to the current date.     :\n**     :                                          :\n**     :  Change (2) must also be carried out     :\n**     :  whenever the function is re-issued,     :\n**     :  even if no leap seconds have been       :\n**     :  added.                                  :\n**     :                                          :\n**     :  Latest leap second:  2016 December 31   :\n**     :                                          :\n**     :__________________________________________:\n**\n**  Given:\n**     iy     int      UTC:  year (Notes 1 and 2)\n**     im     int            month (Note 2)\n**     id     int            day (Notes 2 and 3)\n**     fd     double         fraction of day (Note 4)\n**\n**  Returned:\n**     deltat double   TAI minus UTC, seconds\n**\n**  Returned (function value):\n**            int      status (Note 5):\n**                       1 = dubious year (Note 1)\n**                       0 = OK\n**                      -1 = bad year\n**                      -2 = bad month\n**                      -3 = bad day (Note 3)\n**                      -4 = bad fraction (Note 4)\n**                      -5 = internal error (Note 5)\n**\n**  Notes:\n**\n**  1) UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper\n**     to call the function with an earlier date.  If this is attempted,\n**     zero is returned together with a warning status.\n**\n**     Because leap seconds cannot, in principle, be predicted in\n**     advance, a reliable check for dates beyond the valid range is\n**     impossible.  To guard against gross errors, a year five or more\n**     after the release year of the present function (see the constant\n**     IYV) is considered dubious.  In this case a warning status is\n**     returned but the result is computed in the normal way.\n**\n**     For both too-early and too-late years, the warning status is +1.\n**     This is distinct from the error status -1, which signifies a year\n**     so early that JD could not be computed.\n**\n**  2) If the specified date is for a day which ends with a leap second,\n**     the TAI-UTC value returned is for the period leading up to the\n**     leap second.  If the date is for a day which begins as a leap\n**     second ends, the TAI-UTC returned is for the period following the\n**     leap second.\n**\n**  3) The day number must be in the normal calendar range, for example\n**     1 through 30 for April.  The \"almanac\" convention of allowing\n**     such dates as January 0 and December 32 is not supported in this\n**     function, in order to avoid confusion near leap seconds.\n**\n**  4) The fraction of day is used only for dates before the\n**     introduction of leap seconds, the first of which occurred at the\n**     end of 1971.  It is tested for validity (0 to 1 is the valid\n**     range) even if not used;  if invalid, zero is used and status -4\n**     is returned.  For many applications, setting fd to zero is\n**     acceptable;  the resulting error is always less than 3 ms (and\n**     occurs only pre-1972).\n**\n**  5) The status value returned in the case where there are multiple\n**     errors refers to the first error detected.  For example, if the\n**     month and day are 13 and 32 respectively, status -2 (bad month)\n**     will be returned.  The \"internal error\" status refers to a\n**     case that is impossible but causes some compilers to issue a\n**     warning.\n**\n**  6) In cases where a valid result is not available, zero is returned.\n**\n**  References:\n**\n**  1) For dates from 1961 January 1 onwards, the expressions from the\n**     file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.\n**\n**  2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of\n**     the 1992 Explanatory Supplement.\n**\n**  Called:\n**     eraCal2jd    Gregorian calendar to JD\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Release year for this version of eraDat */\n   enum { IYV = 2016};\n\n/* Reference dates (MJD) and drift rates (s/day), pre leap seconds */\n   static const double drift[][2] = {\n      { 37300.0, 0.0012960 },\n      { 37300.0, 0.0012960 },\n      { 37300.0, 0.0012960 },\n      { 37665.0, 0.0011232 },\n      { 37665.0, 0.0011232 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 38761.0, 0.0012960 },\n      { 39126.0, 0.0025920 },\n      { 39126.0, 0.0025920 }\n   };\n\n/* Number of Delta(AT) expressions before leap seconds were introduced */\n   enum { NERA1 = (int) (sizeof drift / sizeof (double) / 2) };\n\n/* Dates and Delta(AT)s */\n   static const struct {\n      int iyear, month;\n      double delat;\n   } changes[] = {\n      { 1960,  1,  1.4178180 },\n      { 1961,  1,  1.4228180 },\n      { 1961,  8,  1.3728180 },\n      { 1962,  1,  1.8458580 },\n      { 1963, 11,  1.9458580 },\n      { 1964,  1,  3.2401300 },\n      { 1964,  4,  3.3401300 },\n      { 1964,  9,  3.4401300 },\n      { 1965,  1,  3.5401300 },\n      { 1965,  3,  3.6401300 },\n      { 1965,  7,  3.7401300 },\n      { 1965,  9,  3.8401300 },\n      { 1966,  1,  4.3131700 },\n      { 1968,  2,  4.2131700 },\n      { 1972,  1, 10.0       },\n      { 1972,  7, 11.0       },\n      { 1973,  1, 12.0       },\n      { 1974,  1, 13.0       },\n      { 1975,  1, 14.0       },\n      { 1976,  1, 15.0       },\n      { 1977,  1, 16.0       },\n      { 1978,  1, 17.0       },\n      { 1979,  1, 18.0       },\n      { 1980,  1, 19.0       },\n      { 1981,  7, 20.0       },\n      { 1982,  7, 21.0       },\n      { 1983,  7, 22.0       },\n      { 1985,  7, 23.0       },\n      { 1988,  1, 24.0       },\n      { 1990,  1, 25.0       },\n      { 1991,  1, 26.0       },\n      { 1992,  7, 27.0       },\n      { 1993,  7, 28.0       },\n      { 1994,  7, 29.0       },\n      { 1996,  1, 30.0       },\n      { 1997,  7, 31.0       },\n      { 1999,  1, 32.0       },\n      { 2006,  1, 33.0       },\n      { 2009,  1, 34.0       },\n      { 2012,  7, 35.0       },\n      { 2015,  7, 36.0       },\n      { 2017,  1, 37.0       }\n   };\n\n/* Number of Delta(AT) changes */\n   enum { NDAT = (int) (sizeof changes / sizeof changes[0]) };\n\n/* Miscellaneous local variables */\n   int j, i, m;\n   double da, djm0, djm;\n\n\n/* Initialize the result to zero. */\n   *deltat = da = 0.0;\n\n/* If invalid fraction of a day, set error status and give up. */\n   if (fd < 0.0 || fd > 1.0) return -4;\n\n/* Convert the date into an MJD. */\n   j = eraCal2jd(iy, im, id, &djm0, &djm);\n\n/* If invalid year, month, or day, give up. */\n   if (j < 0) return j;\n\n/* If pre-UTC year, set warning status and give up. */\n   if (iy < changes[0].iyear) return 1;\n\n/* If suspiciously late year, set warning status but proceed. */\n   if (iy > IYV + 5) j = 1;\n\n/* Combine year and month to form a date-ordered integer... */\n   m = 12*iy + im;\n\n/* ...and use it to find the preceding table entry. */\n   for (i = NDAT-1; i >=0; i--) {\n      if (m >= (12 * changes[i].iyear + changes[i].month)) break;\n   }\n\n/* Prevent underflow warnings. */\n   if (i < 0) return -5;\n\n/* Get the Delta(AT). */\n   da = changes[i].delat;\n\n/* If pre-1972, adjust for drift. */\n   if (i < NERA1) da += (djm + fd - drift[i][0]) * drift[i][1];\n\n/* Return the Delta(AT) value. */\n   *deltat = da;\n\n/* Return the status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13205,"name":"pvu.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvu(double dt, double pv[2][3], double upv[2][3])\n/*\n**  - - - - - - -\n**   e r a P v u\n**  - - - - - - -\n**\n**  Update a pv-vector.\n**\n**  Given:\n**     dt       double           time interval\n**     pv       double[2][3]     pv-vector\n**\n**  Returned:\n**     upv      double[2][3]     p updated, v unchanged\n**\n**  Notes:\n**\n**  1) \"Update\" means \"refer the position component of the vector\n**     to a new date dt time units from the existing date\".\n**\n**  2) The time units of dt must match those of the velocity.\n**\n**  3) It is permissible for pv and upv to be the same array.\n**\n**  Called:\n**     eraPpsp      p-vector plus scaled p-vector\n**     eraCp        copy p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraPpsp(pv[0], dt, pv[1], upv[0]);\n   eraCp(pv[1], upv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":4,"comment":"null","endLoc":733,"header":"def _update_grid_lines(self)","id":13206,"name":"_update_grid_lines","nodeType":"Function","startLoc":684,"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        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.value\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        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        # Currently xy_world is in deg, but transform function needs it in\n        # native units\n        if self._coord_unit_scale is not None:\n            xy_world /= self._coord_unit_scale\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]))"},{"id":13207,"name":"ld.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLd(double bm, double p[3], double q[3], double e[3],\n           double em, double dlim, double p1[3])\n/*\n**  - - - - - -\n**   e r a L d\n**  - - - - - -\n**\n**  Apply light deflection by a solar-system body, as part of\n**  transforming coordinate direction into natural direction.\n**\n**  Given:\n**     bm     double     mass of the gravitating body (solar masses)\n**     p      double[3]  direction from observer to source (unit vector)\n**     q      double[3]  direction from body to source (unit vector)\n**     e      double[3]  direction from body to observer (unit vector)\n**     em     double     distance from body to observer (au)\n**     dlim   double     deflection limiter (Note 4)\n**\n**  Returned:\n**     p1     double[3]  observer to deflected source (unit vector)\n**\n**  Notes:\n**\n**  1) The algorithm is based on Expr. (70) in Klioner (2003) and\n**     Expr. (7.63) in the Explanatory Supplement (Urban & Seidelmann\n**     2013), with some rearrangement to minimize the effects of machine\n**     precision.\n**\n**  2) The mass parameter bm can, as required, be adjusted in order to\n**     allow for such effects as quadrupole field.\n**\n**  3) The barycentric position of the deflecting body should ideally\n**     correspond to the time of closest approach of the light ray to\n**     the body.\n**\n**  4) The deflection limiter parameter dlim is phi^2/2, where phi is\n**     the angular separation (in radians) between source and body at\n**     which limiting is applied.  As phi shrinks below the chosen\n**     threshold, the deflection is artificially reduced, reaching zero\n**     for phi = 0.\n**\n**  5) The returned vector p1 is not normalized, but the consequential\n**     departure from unit magnitude is always negligible.\n**\n**  6) The arguments p and p1 can be the same array.\n**\n**  7) To accumulate total light deflection taking into account the\n**     contributions from several bodies, call the present function for\n**     each body in succession, in decreasing order of distance from the\n**     observer.\n**\n**  8) For efficiency, validation is omitted.  The supplied vectors must\n**     be of unit magnitude, and the deflection limiter non-zero and\n**     positive.\n**\n**  References:\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013).\n**\n**     Klioner, Sergei A., \"A practical relativistic model for micro-\n**     arcsecond astrometry in space\", Astr. J. 125, 1580-1597 (2003).\n**\n**  Called:\n**     eraPdp       scalar product of two p-vectors\n**     eraPxp       vector product of two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double qpe[3], qdqpe, w, eq[3], peq[3];\n\n\n/* q . (q + e). */\n   for (i = 0; i < 3; i++) {\n      qpe[i] = q[i] + e[i];\n   }\n   qdqpe = eraPdp(q, qpe);\n\n/* 2 x G x bm / ( em x c^2 x ( q . (q + e) ) ). */\n   w = bm * ERFA_SRS / em / ERFA_GMAX(qdqpe,dlim);\n\n/* p x (e x q). */\n   eraPxp(e, q, eq);\n   eraPxp(p, eq, peq);\n\n/* Apply the deflection. */\n   for (i = 0; i < 3; i++) {\n      p1[i] = p[i] + w*peq[i];\n   }\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13208,"name":"pvm.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvm(double pv[2][3], double *r, double *s)\n/*\n**  - - - - - - -\n**   e r a P v m\n**  - - - - - - -\n**\n**  Modulus of pv-vector.\n**\n**  Given:\n**     pv     double[2][3]   pv-vector\n**\n**  Returned:\n**     r      double         modulus of position component\n**     s      double         modulus of velocity component\n**\n**  Called:\n**     eraPm        modulus of p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Distance. */\n   *r = eraPm(pv[0]);\n\n/* Speed. */\n   *s = eraPm(pv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13209,"name":"s2p.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraS2p(double theta, double phi, double r, double p[3])\n/*\n**  - - - - - - -\n**   e r a S 2 p\n**  - - - - - - -\n**\n**  Convert spherical polar coordinates to p-vector.\n**\n**  Given:\n**     theta   double       longitude angle (radians)\n**     phi     double       latitude angle (radians)\n**     r       double       radial distance\n**\n**  Returned:\n**     p       double[3]    Cartesian coordinates\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraSxp       multiply p-vector by scalar\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double u[3];\n\n\n   eraS2c(theta, phi, u);\n   eraSxp(r, u, p);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13210,"name":"ltpecl.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLtpecl(double epj, double vec[3])\n/*\n**  - - - - - - - - - -\n**   e r a L t p e c l\n**  - - - - - - - - - -\n**\n**  Long-term precession of the ecliptic.\n**\n**  Given:\n**     epj     double         Julian epoch (TT)\n**\n**  Returned:\n**     vec     double[3]      ecliptic pole unit vector\n**\n**  Notes:\n**\n**  1) The returned vector is with respect to the J2000.0 mean equator\n**     and equinox.\n**\n**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Obliquity at J2000.0 (radians). */\n   static const double eps0 = 84381.406 * ERFA_DAS2R;\n\n/* Polynomial coefficients */\n   enum { NPOL = 4 };\n   static const double pqpol[2][NPOL] = {\n      { 5851.607687,\n          -0.1189000,\n          -0.00028913,\n           0.000000101},\n      {-1600.886300,\n           1.1689818,\n          -0.00000020,\n          -0.000000437}\n   };\n\n/* Periodic coefficients */\n   static const double pqper[][5] = {\n      { 708.15,-5486.751211,-684.661560,  667.666730,-5523.863691},\n      {2309.00,  -17.127623,2446.283880,-2354.886252, -549.747450},\n      {1620.00, -617.517403, 399.671049, -428.152441, -310.998056},\n      { 492.20,  413.442940,-356.652376,  376.202861,  421.535876},\n      {1183.00,   78.614193,-186.387003,  184.778874,  -36.776172},\n      { 622.00, -180.732815,-316.800070,  335.321713, -145.278396},\n      { 882.00,  -87.676083, 198.296701, -185.138669,  -34.744450},\n      { 547.00,   46.140315, 101.135679, -120.972830,   22.885731}\n   };\n   static const int NPER = (int) ( sizeof pqper / 5 / sizeof (double) );\n\n/* Miscellaneous */\n   int i;\n   double t, p, q, w, a, s, c;\n\n\n/* Centuries since J2000. */\n   t  = ( epj - 2000.0 ) / 100.0;\n\n/* Initialize P_A and Q_A accumulators. */\n   p = 0.0;\n   q = 0.0;\n\n/* Periodic terms. */\n   w = ERFA_D2PI*t;\n   for ( i = 0; i < NPER; i++ ) {\n      a = w/pqper[i][0];\n      s = sin(a);\n      c = cos(a);\n      p += c*pqper[i][1] + s*pqper[i][3];\n      q += c*pqper[i][2] + s*pqper[i][4];\n   }\n\n/* Polynomial terms. */\n   w = 1.0;\n   for ( i = 0; i < NPOL; i++ ) {\n      p += pqpol[0][i]*w;\n      q += pqpol[1][i]*w;\n      w *= t;\n   }\n\n/* P_A and Q_A (radians). */\n   p *= ERFA_DAS2R;\n   q *= ERFA_DAS2R;\n\n/* Form the ecliptic pole vector. */\n   w = 1.0 - p*p - q*q;\n   w = w < 0.0 ? 0.0 : sqrt(w);\n   s = sin(eps0);\n   c = cos(eps0);\n   vec[0] = p;\n   vec[1] = - q*c - w*s;\n   vec[2] = - q*s + w*c;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13211,"name":"ee06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEe06a(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a E e 0 6 a\n**  - - - - - - - - -\n**\n**  Equation of the equinoxes, compatible with IAU 2000 resolutions and\n**  IAU 2006/2000A precession-nutation.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    equation of the equinoxes (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result, which is in radians, operates in the following sense:\n**\n**        Greenwich apparent ST = GMST + equation of the equinoxes\n**\n**  Called:\n**     eraAnpm      normalize angle into range +/- pi\n**     eraGst06a    Greenwich apparent sidereal time, IAU 2006/2000A\n**     eraGmst06    Greenwich mean sidereal time, IAU 2006\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gst06a, gmst06, ee;\n\n\n/* Apparent and mean sidereal times. */\n   gst06a = eraGst06a(0.0, 0.0, date1, date2);\n   gmst06 = eraGmst06(0.0, 0.0, date1, date2);\n\n/* Equation of the equinoxes. */\n   ee  = eraAnpm(gst06a - gmst06);\n\n   return ee;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13212,"name":"s00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraS00a(double date1, double date2)\n/*\n**  - - - - - - - -\n**   e r a S 0 0 a\n**  - - - - - - - -\n**\n**  The CIO locator s, positioning the Celestial Intermediate Origin on\n**  the equator of the Celestial Intermediate Pole, using the IAU 2000A\n**  precession-nutation model.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    the CIO locator s in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The CIO locator s is the difference between the right ascensions\n**     of the same point in two systems.  The two systems are the GCRS\n**     and the CIP,CIO, and the point is the ascending node of the\n**     CIP equator.  The CIO locator s remains a small fraction of\n**     1 arcsecond throughout 1900-2100.\n**\n**  3) The series used to compute s is in fact for s+XY/2, where X and Y\n**     are the x and y components of the CIP unit vector;  this series\n**     is more compact than a direct series for s would be.  The present\n**     function uses the full IAU 2000A nutation model when predicting\n**     the CIP position.  Faster results, with no significant loss of\n**     accuracy, can be obtained via the function eraS00b, which uses\n**     instead the IAU 2000B truncated model.\n**\n**  Called:\n**     eraPnm00a    classical NPB matrix, IAU 2000A\n**     eraBnp2xy    extract CIP X,Y from the BPN matrix\n**     eraS00       the CIO locator s, given X,Y, IAU 2000A\n**\n**  References:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3], x, y, s;\n\n\n/* Bias-precession-nutation-matrix, IAU 2000A. */\n   eraPnm00a(date1, date2, rbpn);\n\n/* Extract the CIP coordinates. */\n   eraBpn2xy(rbpn, &x, &y);\n\n/* Compute the CIO locator s, given the CIP coordinates. */\n   s = eraS00(date1, date2, x, y);\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13213,"name":"c2ixy.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2ixy(double date1, double date2, double x, double y,\n              double rc2i[3][3])\n/*\n**  - - - - - - - - -\n**   e r a C 2 i x y\n**  - - - - - - - - -\n**\n**  Form the celestial to intermediate-frame-of-date matrix for a given\n**  date when the CIP X,Y coordinates are known.  IAU 2000.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**     x,y         double       Celestial Intermediate Pole (Note 2)\n**\n**  Returned:\n**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The Celestial Intermediate Pole coordinates are the x,y components\n**     of the unit vector in the Geocentric Celestial Reference System.\n**\n**  3) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**              = RC2T * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  4) Although its name does not include \"00\", This function is in fact\n**     specific to the IAU 2000 models.\n**\n**  Called:\n**     eraC2ixys    celestial-to-intermediate matrix, given X,Y and s\n**     eraS00       the CIO locator s, given X,Y, IAU 2000A\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n\n{\n/* Compute s and then the matrix. */\n   eraC2ixys(x, y, eraS00(date1, date2, x, y), rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13214,"name":"obl80.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraObl80(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a O b l 8 0\n**  - - - - - - - - -\n**\n**  Mean obliquity of the ecliptic, IAU 1980 model.\n**\n**  Given:\n**     date1,date2   double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                   double    obliquity of the ecliptic (radians, Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result is the angle between the ecliptic and mean equator of\n**     date date1+date2.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Expression 3.222-1 (p114).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, eps0;\n\n\n/* Interval between fundamental epoch J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Mean obliquity of date. */\n   eps0 = ERFA_DAS2R * (84381.448  +\n                  (-46.8150   +\n                  (-0.00059   +\n                  ( 0.001813) * t) * t) * t);\n\n   return eps0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13215,"name":"starpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraStarpv(double ra, double dec,\n              double pmr, double pmd, double px, double rv,\n              double pv[2][3])\n/*\n**  - - - - - - - - - -\n**   e r a S t a r p v\n**  - - - - - - - - - -\n**\n**  Convert star catalog coordinates to position+velocity vector.\n**\n**  Given (Note 1):\n**     ra     double        right ascension (radians)\n**     dec    double        declination (radians)\n**     pmr    double        RA proper motion (radians/year)\n**     pmd    double        Dec proper motion (radians/year)\n**     px     double        parallax (arcseconds)\n**     rv     double        radial velocity (km/s, positive = receding)\n**\n**  Returned (Note 2):\n**     pv     double[2][3]  pv-vector (au, au/day)\n**\n**  Returned (function value):\n**            int           status:\n**                              0 = no warnings\n**                              1 = distance overridden (Note 6)\n**                              2 = excessive speed (Note 7)\n**                              4 = solution didn't converge (Note 8)\n**                           else = binary logical OR of the above\n**\n**  Notes:\n**\n**  1) The star data accepted by this function are \"observables\" for an\n**     imaginary observer at the solar-system barycenter.  Proper motion\n**     and radial velocity are, strictly, in terms of barycentric\n**     coordinate time, TCB.  For most practical applications, it is\n**     permissible to neglect the distinction between TCB and ordinary\n**     \"proper\" time on Earth (TT/TAI).  The result will, as a rule, be\n**     limited by the intrinsic accuracy of the proper-motion and\n**     radial-velocity data;  moreover, the pv-vector is likely to be\n**     merely an intermediate result, so that a change of time unit\n**     would cancel out overall.\n**\n**     In accordance with normal star-catalog conventions, the object's\n**     right ascension and declination are freed from the effects of\n**     secular aberration.  The frame, which is aligned to the catalog\n**     equator and equinox, is Lorentzian and centered on the SSB.\n**\n**  2) The resulting position and velocity pv-vector is with respect to\n**     the same frame and, like the catalog coordinates, is freed from\n**     the effects of secular aberration.  Should the \"coordinate\n**     direction\", where the object was located at the catalog epoch, be\n**     required, it may be obtained by calculating the magnitude of the\n**     position vector pv[0][0-2] dividing by the speed of light in\n**     au/day to give the light-time, and then multiplying the space\n**     velocity pv[1][0-2] by this light-time and adding the result to\n**     pv[0][0-2].\n**\n**     Summarizing, the pv-vector returned is for most stars almost\n**     identical to the result of applying the standard geometrical\n**     \"space motion\" transformation.  The differences, which are the\n**     subject of the Stumpff paper referenced below, are:\n**\n**     (i) In stars with significant radial velocity and proper motion,\n**     the constantly changing light-time distorts the apparent proper\n**     motion.  Note that this is a classical, not a relativistic,\n**     effect.\n**\n**     (ii) The transformation complies with special relativity.\n**\n**  3) Care is needed with units.  The star coordinates are in radians\n**     and the proper motions in radians per Julian year, but the\n**     parallax is in arcseconds; the radial velocity is in km/s, but\n**     the pv-vector result is in au and au/day.\n**\n**  4) The RA proper motion is in terms of coordinate angle, not true\n**     angle.  If the catalog uses arcseconds for both RA and Dec proper\n**     motions, the RA proper motion will need to be divided by cos(Dec)\n**     before use.\n**\n**  5) Straight-line motion at constant speed, in the inertial frame,\n**     is assumed.\n**\n**  6) An extremely small (or zero or negative) parallax is interpreted\n**     to mean that the object is on the \"celestial sphere\", the radius\n**     of which is an arbitrary (large) value (see the constant PXMIN).\n**     When the distance is overridden in this way, the status,\n**     initially zero, has 1 added to it.\n**\n**  7) If the space velocity is a significant fraction of c (see the\n**     constant VMAX), it is arbitrarily set to zero.  When this action\n**     occurs, 2 is added to the status.\n**\n**  8) The relativistic adjustment involves an iterative calculation.\n**     If the process fails to converge within a set number (IMAX) of\n**     iterations, 4 is added to the status.\n**\n**  9) The inverse transformation is performed by the function\n**     eraPvstar.\n**\n**  Called:\n**     eraS2pv      spherical coordinates to pv-vector\n**     eraPm        modulus of p-vector\n**     eraZp        zero p-vector\n**     eraPn        decompose p-vector into modulus and direction\n**     eraPdp       scalar product of two p-vectors\n**     eraSxp       multiply p-vector by scalar\n**     eraPmp       p-vector minus p-vector\n**     eraPpp       p-vector plus p-vector\n**\n**  Reference:\n**\n**     Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Smallest allowed parallax */\n   static const double PXMIN = 1e-7;\n\n/* Largest allowed speed (fraction of c) */\n   static const double VMAX = 0.5;\n\n/* Maximum number of iterations for relativistic solution */\n   static const int IMAX = 100;\n\n   int i, iwarn;\n   double w, r, rd, rad, decd, v, x[3], usr[3], ust[3],\n          vsr, vst, betst, betsr, bett, betr,\n          dd, ddel, ur[3], ut[3],\n          d = 0.0, del = 0.0,       /* to prevent */\n          odd = 0.0, oddel = 0.0,   /* compiler   */\n          od = 0.0, odel = 0.0;     /* warnings   */\n\n\n/* Distance (au). */\n   if (px >= PXMIN) {\n      w = px;\n      iwarn = 0;\n   } else {\n      w = PXMIN;\n      iwarn = 1;\n   }\n   r = ERFA_DR2AS / w;\n\n/* Radial velocity (au/day). */\n   rd = ERFA_DAYSEC * rv * 1e3 / ERFA_DAU;\n\n/* Proper motion (radian/day). */\n   rad = pmr / ERFA_DJY;\n   decd = pmd / ERFA_DJY;\n\n/* To pv-vector (au,au/day). */\n   eraS2pv(ra, dec, r, rad, decd, rd, pv);\n\n/* If excessive velocity, arbitrarily set it to zero. */\n   v = eraPm(pv[1]);\n   if (v / ERFA_DC > VMAX) {\n      eraZp(pv[1]);\n      iwarn += 2;\n   }\n\n/* Isolate the radial component of the velocity (au/day). */\n   eraPn(pv[0], &w, x);\n   vsr = eraPdp(x, pv[1]);\n   eraSxp(vsr, x, usr);\n\n/* Isolate the transverse component of the velocity (au/day). */\n   eraPmp(pv[1], usr, ust);\n   vst = eraPm(ust);\n\n/* Special-relativity dimensionless parameters. */\n   betsr = vsr / ERFA_DC;\n   betst = vst / ERFA_DC;\n\n/* Determine the inertial-to-observed relativistic correction terms. */\n   bett = betst;\n   betr = betsr;\n   for (i = 0; i < IMAX; i++) {\n      d = 1.0 + betr;\n      w = betr*betr + bett*bett;\n      del = - w / (sqrt(1.0 - w) + 1.0);\n      betr = d * betsr + del;\n      bett = d * betst;\n      if (i > 0) {\n         dd = fabs(d - od);\n         ddel = fabs(del - odel);\n         if ((i > 1) && (dd >= odd) && (ddel >= oddel)) break;\n         odd = dd;\n         oddel = ddel;\n      }\n      od = d;\n      odel = del;\n   }\n   if (i >= IMAX) iwarn += 4;\n\n/* Replace observed radial velocity with inertial value. */\n   w = (betsr != 0.0) ? d + del / betsr : 1.0;\n   eraSxp(w, usr, ur);\n\n/* Replace observed tangential velocity with inertial value. */\n   eraSxp(d, ust, ut);\n\n/* Combine the two to obtain the inertial space velocity. */\n   eraPpp(ur, ut, pv[1]);\n\n/* Return the status. */\n   return iwarn;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13216,"name":"atoi13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraAtoi13(const char *type, double ob1, double ob2,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *ri, double *di)\n/*\n**  - - - - - - - - - -\n**   e r a A t o i 1 3\n**  - - - - - - - - - -\n**\n**  Observed place to CIRS.  The caller supplies UTC, site coordinates,\n**  ambient air conditions and observing wavelength.\n**\n**  Given:\n**     type   char[]   type of coordinates - \"R\", \"H\" or \"A\" (Notes 1,2)\n**     ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)\n**     ob2    double   observed ZD or Dec (radians)\n**     utc1   double   UTC as a 2-part...\n**     utc2   double   ...quasi Julian Date (Notes 3,4)\n**     dut1   double   UT1-UTC (seconds, Note 5)\n**     elong  double   longitude (radians, east +ve, Note 6)\n**     phi    double   geodetic latitude (radians, Note 6)\n**     hm     double   height above the ellipsoid (meters, Notes 6,8)\n**     xp,yp  double   polar motion coordinates (radians, Note 7)\n**     phpa   double   pressure at the observer (hPa = mB, Note 8)\n**     tc     double   ambient temperature at the observer (deg C)\n**     rh     double   relative humidity at the observer (range 0-1)\n**     wl     double   wavelength (micrometers, Note 9)\n**\n**  Returned:\n**     ri     double*  CIRS right ascension (CIO-based, radians)\n**     di     double*  CIRS declination (radians)\n**\n**  Returned (function value):\n**            int      status: +1 = dubious year (Note 2)\n**                              0 = OK\n**                             -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  \"Observed\" Az,ZD means the position that would be seen by a\n**      perfect geodetically aligned theodolite.  (Zenith distance is\n**      used rather than altitude in order to reflect the fact that no\n**      allowance is made for depression of the horizon.)  This is\n**      related to the observed HA,Dec via the standard rotation, using\n**      the geodetic latitude (corrected for polar motion), while the\n**      observed HA and RA are related simply through the Earth rotation\n**      angle and the site longitude.  \"Observed\" RA,Dec or HA,Dec thus\n**      means the position that would be seen by a perfect equatorial\n**      with its polar axis aligned to the Earth's axis of rotation.\n**\n**  2)  Only the first character of the type argument is significant.\n**      \"R\" or \"r\" indicates that ob1 and ob2 are the observed right\n**      ascension and declination;  \"H\" or \"h\" indicates that they are\n**      hour angle (west +ve) and declination;  anything else (\"A\" or\n**      \"a\" is recommended) indicates that ob1 and ob2 are azimuth\n**      (north zero, east 90 deg) and zenith distance.\n**\n**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  4)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the\n**      future to be trusted.  See eraDat for further details.\n**\n**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  6)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many\n**      applications, xp and yp can be set to zero.\n**\n**  8)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB), is\n**      available, an adequate estimate of hm can be obtained from the\n**      expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to\n**      the pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  9)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  10) The accuracy of the result is limited by the corrections for\n**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**      Providing the meteorological parameters are known accurately and\n**      there are no gross local effects, the predicted astrometric\n**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**      (radio) for a zenith distance of less than 70 degrees, better\n**      than 30 arcsec (optical or radio) at 85 degrees and better\n**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**      Without refraction, the complementary functions eraAtio13 and\n**      eraAtoi13 are self-consistent to better than 1 microarcsecond\n**      all over the celestial sphere.  With refraction included,\n**      consistency falls off at high zenith distances, but is still\n**      better than 0.05 arcsec at 85 degrees.\n**\n**  12) It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  Called:\n**     eraApio13    astrometry parameters, CIRS-observed, 2013\n**     eraAtoiq     quick observed to CIRS\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   eraASTROM astrom;\n\n\n/* Star-independent astrometry parameters for CIRS->observed. */\n   j = eraApio13(utc1, utc2, dut1, elong, phi, hm, xp, yp,\n                 phpa, tc, rh, wl, &astrom);\n\n/* Abort if bad UTC. */\n   if ( j < 0 ) return j;\n\n/* Transform observed to CIRS. */\n   eraAtoiq(type, ob1, ob2, &astrom, ri, di);\n\n/* Return OK/warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13217,"name":"eqeq94.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEqeq94(double date1, double date2)\n/*\n**  - - - - - - - - - -\n**   e r a E q e q 9 4\n**  - - - - - - - - - -\n**\n**  Equation of the equinoxes, IAU 1994 model.\n**\n**  Given:\n**     date1,date2   double     TDB date (Note 1)\n**\n**  Returned (function value):\n**                   double     equation of the equinoxes (Note 2)\n**\n**  Notes:\n**\n**  1) The date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result, which is in radians, operates in the following sense:\n**\n**        Greenwich apparent ST = GMST + equation of the equinoxes\n**\n**  Called:\n**     eraAnpm      normalize angle into range +/- pi\n**     eraNut80     nutation, IAU 1980\n**     eraObl80     mean obliquity, IAU 1980\n**\n**  References:\n**\n**     IAU Resolution C7, Recommendation 3 (1994).\n**\n**     Capitaine, N. & Gontier, A.-M., 1993, Astron. Astrophys., 275,\n**     645-650.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t,  om,  dpsi,  deps,  eps0, ee;\n\n\n/* Interval between fundamental epoch J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Longitude of the mean ascending node of the lunar orbit on the */\n/* ecliptic, measured from the mean equinox of date. */\n   om = eraAnpm((450160.280 + (-482890.539\n           + (7.455 + 0.008 * t) * t) * t) * ERFA_DAS2R\n           + fmod(-5.0 * t, 1.0) * ERFA_D2PI);\n\n/* Nutation components and mean obliquity. */\n   eraNut80(date1, date2, &dpsi, &deps);\n   eps0 = eraObl80(date1, date2);\n\n/* Equation of the equinoxes. */\n   ee = dpsi*cos(eps0) + ERFA_DAS2R*(0.00264*sin(om) + 0.000063*sin(om+om));\n\n   return ee;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":4,"comment":"\n        Reset the current Axes, to use a new WCS object.\n        ","endLoc":308,"header":"def reset_wcs(self, wcs=None, slices=None, transform=None, coord_meta=None)","id":13218,"name":"reset_wcs","nodeType":"Function","startLoc":229,"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                wcs.wcs.set()\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        self.coords = CoordinatesMap(self, wcs=self.wcs, slice=slices,\n                                     transform=transform, coord_meta=coord_meta,\n                                     frame_class=self.frame_class,\n                                     previous_frame_path=previous_frame['path'])\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        if slices is None:\n            self.slices = ('x', 'y')\n            self._x_index = 0\n            self._y_index = 1\n        else:\n            self.slices = slices\n            self._x_index = self.slices.index('x')\n            self._y_index = self.slices.index('y')\n\n        # Common default settings for Rectangular Frame\n        if self.frame_class is RectangularFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('b')\n                    self.coords[coord_index].set_ticklabel_position('b')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_axislabel_position('l')\n                    self.coords[coord_index].set_ticklabel_position('l')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')\n        # Common default settings for Elliptical Frame\n        elif self.frame_class is EllipticalFrame:\n            for coord_index in range(len(self.slices)):\n                if self.slices[coord_index] == 'x':\n                    self.coords[coord_index].set_axislabel_position('h')\n                    self.coords[coord_index].set_ticklabel_position('h')\n                    self.coords[coord_index].set_ticks_position('h')\n                elif self.slices[coord_index] == 'y':\n                    self.coords[coord_index].set_ticks_position('c')\n                    self.coords[coord_index].set_axislabel_position('c')\n                    self.coords[coord_index].set_ticklabel_position('c')\n                else:\n                    self.coords[coord_index].set_axislabel_position('')\n                    self.coords[coord_index].set_ticklabel_position('')\n                    self.coords[coord_index].set_ticks_position('')"},{"id":13219,"name":"apci13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApci13(double date1, double date2,\n               eraASTROM *astrom, double *eo)\n/*\n**  - - - - - - - - - -\n**   e r a A p c i 1 3\n**  - - - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and geocentric CIRS\n**  coordinates.  The caller supplies the date, and ERFA models are used\n**  to predict the Earth ephemeris and CIP/CIO.\n**\n**  The parameters produced by this function are required in the\n**  parallax, light deflection, aberration, and bias-precession-nutation\n**  parts of the astrometric transformation chain.\n**\n**  Given:\n**     date1  double      TDB as a 2-part...\n**     date2  double      ...Julian Date (Note 1)\n**\n**  Returned:\n**     astrom eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**     eo     double*     equation of the origins (ERA-GST)\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) In cases where the caller wishes to supply his own Earth\n**     ephemeris and CIP/CIO, the function eraApci can be used instead\n**     of the present function.\n**\n**  4) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  5) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraEpv00     Earth position and velocity\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**     eraApci      astrometry parameters, ICRS-CIRS\n**     eraEors      equation of the origins, given NPB matrix and s\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ehpv[2][3], ebpv[2][3], r[3][3], x, y, s;\n\n\n/* Earth barycentric & heliocentric position/velocity (au, au/d). */\n   (void) eraEpv00(date1, date2, ehpv, ebpv);\n\n/* Form the equinox based BPN matrix, IAU 2006/2000A. */\n   eraPnm06a(date1, date2, r);\n\n/* Extract CIP X,Y. */\n   eraBpn2xy(r, &x, &y);\n\n/* Obtain CIO locator s. */\n   s = eraS06(date1, date2, x, y);\n\n/* Compute the star-independent astrometry parameters. */\n   eraApci(date1, date2, ebpv, ehpv[0], x, y, s, astrom);\n\n/* Equation of the origins. */\n   *eo = eraEors(r, s);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13220,"name":"icrs2g.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraIcrs2g ( double dr, double dd, double *dl, double *db )\n/*\n**  - - - - - - - - - -\n**   e r a I c r s 2 g\n**  - - - - - - - - - -\n**\n**  Transformation from ICRS to Galactic Coordinates.\n**\n**  Given:\n**     dr     double      ICRS right ascension (radians)\n**     dd     double      ICRS declination (radians)\n**\n**  Returned:\n**     dl     double      galactic longitude (radians)\n**     db     double      galactic latitude (radians)\n**\n**  Notes:\n**\n**  1) The IAU 1958 system of Galactic coordinates was defined with\n**     respect to the now obsolete reference system FK4 B1950.0.  When\n**     interpreting the system in a modern context, several factors have\n**     to be taken into account:\n**\n**     . The inclusion in FK4 positions of the E-terms of aberration.\n**\n**     . The distortion of the FK4 proper motion system by differential\n**       Galactic rotation.\n**\n**     . The use of the B1950.0 equinox rather than the now-standard\n**       J2000.0.\n**\n**     . The frame bias between ICRS and the J2000.0 mean place system.\n**\n**     The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation\n**     matrix that transforms directly between ICRS and Galactic\n**     coordinates with the above factors taken into account.  The\n**     matrix is derived from three angles, namely the ICRS coordinates\n**     of the Galactic pole and the longitude of the ascending node of\n**     the galactic equator on the ICRS equator.  They are given in\n**     degrees to five decimal places and for canonical purposes are\n**     regarded as exact.  In the Hipparcos Catalogue the matrix\n**     elements are given to 10 decimal places (about 20 microarcsec).\n**     In the present ERFA function the matrix elements have been\n**     recomputed from the canonical three angles and are given to 30\n**     decimal places.\n**\n**  2) The inverse transformation is performed by the function eraG2icrs.\n**\n**  Called:\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**     eraS2c       spherical coordinates to unit vector\n**     eraRxp       product of r-matrix and p-vector\n**     eraC2s       p-vector to spherical\n**\n**  Reference:\n**     Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho\n**     catalogues.  Astrometric and photometric star catalogues\n**     derived from the ESA Hipparcos Space Astrometry Mission.  ESA\n**     Publications Division, Noordwijk, Netherlands.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double v1[3], v2[3];\n\n/*\n**  L2,B2 system of galactic coordinates in the form presented in the\n**  Hipparcos Catalogue.  In degrees:\n**\n**  P = 192.85948    right ascension of the Galactic north pole in ICRS\n**  Q =  27.12825    declination of the Galactic north pole in ICRS\n**  R =  32.93192    longitude of the ascending node of the Galactic\n**                   plane on the ICRS equator\n**\n**  ICRS to galactic rotation matrix, obtained by computing\n**  R_3(-R) R_1(pi/2-Q) R_3(pi/2+P) to the full precision shown:\n*/\n   double r[3][3] = { { -0.054875560416215368492398900454,\n                        -0.873437090234885048760383168409,\n                        -0.483835015548713226831774175116 },\n                      { +0.494109427875583673525222371358,\n                        -0.444829629960011178146614061616,\n                        +0.746982244497218890527388004556 },\n                      { -0.867666149019004701181616534570,\n                        -0.198076373431201528180486091412,\n                        +0.455983776175066922272100478348 } };\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dr, dd, v1);\n\n/* ICRS to Galactic. */\n   eraRxp(r, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, dl, db);\n\n/* Express in conventional ranges. */\n   *dl = eraAnp(*dl);\n   *db = eraAnpm(*db);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13221,"name":"s2c.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraS2c(double theta, double phi, double c[3])\n/*\n**  - - - - - - -\n**   e r a S 2 c\n**  - - - - - - -\n**\n**  Convert spherical coordinates to Cartesian.\n**\n**  Given:\n**     theta    double       longitude angle (radians)\n**     phi      double       latitude angle (radians)\n**\n**  Returned:\n**     c        double[3]    direction cosines\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double cp;\n\n\n   cp = cos(phi);\n   c[0] = cos(theta) * cp;\n   c[1] = sin(theta) * cp;\n   c[2] = sin(phi);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13222,"name":"cpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraCpv(double pv[2][3], double c[2][3])\n/*\n**  - - - - - - -\n**   e r a C p v\n**  - - - - - - -\n**\n**  Copy a position/velocity vector.\n**\n**  Given:\n**     pv     double[2][3]    position/velocity vector to be copied\n**\n**  Returned:\n**     c      double[2][3]    copy\n**\n**  Called:\n**     eraCp        copy p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraCp(pv[0], c[0]);\n   eraCp(pv[1], c[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13223,"name":"fad03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFad03(double t)\n/*\n**  - - - - - - - - -\n**   e r a F a d 0 3\n**  - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean elongation of the Moon from the Sun.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    D, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean elongation of the Moon from the Sun (IERS Conventions 2003). */\n   a = fmod(          1072260.703692 +\n             t * ( 1602961601.2090 +\n             t * (        - 6.3706 +\n             t * (          0.006593 +\n             t * (        - 0.00003169 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R;\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13224,"name":"epb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEpb(double dj1, double dj2)\n/*\n**  - - - - - - -\n**   e r a E p b\n**  - - - - - - -\n**\n**  Julian Date to Besselian Epoch.\n**\n**  Given:\n**     dj1,dj2    double     Julian Date (see note)\n**\n**  Returned (function value):\n**                double     Besselian Epoch.\n**\n**  Note:\n**\n**     The Julian Date is supplied in two pieces, in the usual ERFA\n**     manner, which is designed to preserve time resolution.  The\n**     Julian Date is available as a single number by adding dj1 and\n**     dj2.  The maximum resolution is achieved if dj1 is 2451545.0\n**     (J2000.0).\n**\n**  Reference:\n**\n**     Lieske, J.H., 1979. Astron.Astrophys., 73, 282.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* J2000.0-B1900.0 (2415019.81352) in days */\n   const double D1900 = 36524.68648;\n\n   return 1900.0 + ((dj1 - ERFA_DJ00) + (dj2 + D1900)) / ERFA_DTY;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13225,"name":"atci13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtci13(double rc, double dc,\n               double pr, double pd, double px, double rv,\n               double date1, double date2,\n               double *ri, double *di, double *eo)\n/*\n**  - - - - - - - - - -\n**   e r a A t c i 1 3\n**  - - - - - - - - - -\n**\n**  Transform ICRS star data, epoch J2000.0, to CIRS.\n**\n**  Given:\n**     rc     double   ICRS right ascension at J2000.0 (radians, Note 1)\n**     dc     double   ICRS declination at J2000.0 (radians, Note 1)\n**     pr     double   RA proper motion (radians/year; Note 2)\n**     pd     double   Dec proper motion (radians/year)\n**     px     double   parallax (arcsec)\n**     rv     double   radial velocity (km/s, +ve if receding)\n**     date1  double   TDB as a 2-part...\n**     date2  double   ...Julian Date (Note 3)\n**\n**  Returned:\n**     ri,di  double*  CIRS geocentric RA,Dec (radians)\n**     eo     double*  equation of the origins (ERA-GST, Note 5)\n**\n**  Notes:\n**\n**  1) Star data for an epoch other than J2000.0 (for example from the\n**     Hipparcos catalog, which has an epoch of J1991.25) will require a\n**     preliminary call to eraPmsafe before use.\n**\n**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  3) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  4) The available accuracy is better than 1 milliarcsecond, limited\n**     mainly by the precession-nutation model that is used, namely\n**     IAU 2000A/2006.  Very close to solar system bodies, additional\n**     errors of up to several milliarcseconds can occur because of\n**     unmodeled light deflection;  however, the Sun's contribution is\n**     taken into account, to first order.  The accuracy limitations of\n**     the ERFA function eraEpv00 (used to compute Earth position and\n**     velocity) can contribute aberration errors of up to\n**     5 microarcseconds.  Light deflection at the Sun's limb is\n**     uncertain at the 0.4 mas level.\n**\n**  5) Should the transformation to (equinox based) apparent place be\n**     required rather than (CIO based) intermediate place, subtract the\n**     equation of the origins from the returned right ascension:\n**     RA = RI - EO. (The eraAnp function can then be applied, as\n**     required, to keep the result in the conventional 0-2pi range.)\n**\n**  Called:\n**     eraApci13    astrometry parameters, ICRS-CIRS, 2013\n**     eraAtciq     quick ICRS to CIRS\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Star-independent astrometry parameters */\n   eraASTROM astrom;\n\n\n/* The transformation parameters. */\n   eraApci13(date1, date2, &astrom, eo);\n\n/* ICRS (epoch J2000.0) to CIRS. */\n   eraAtciq(rc, dc, pr, pd, px, rv, &astrom, ri, di);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13226,"name":"c2ixys.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2ixys(double x, double y, double s, double rc2i[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 i x y s\n**  - - - - - - - - - -\n**\n**  Form the celestial to intermediate-frame-of-date matrix given the CIP\n**  X,Y and the CIO locator s.\n**\n**  Given:\n**     x,y      double         Celestial Intermediate Pole (Note 1)\n**     s        double         the CIO locator s (Note 2)\n**\n**  Returned:\n**     rc2i     double[3][3]   celestial-to-intermediate matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The Celestial Intermediate Pole coordinates are the x,y\n**     components of the unit vector in the Geocentric Celestial\n**     Reference System.\n**\n**  2) The CIO locator s (in radians) positions the Celestial\n**     Intermediate Origin on the equator of the CIP.\n**\n**  3) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**              = RC2T * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  Called:\n**     eraIr        initialize r-matrix to identity\n**     eraRz        rotate around Z-axis\n**     eraRy        rotate around Y-axis\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r2, e, d;\n\n\n/* Obtain the spherical angles E and d. */\n   r2 = x*x + y*y;\n   e = (r2 > 0.0) ? atan2(y, x) : 0.0;\n   d = atan(sqrt(r2 / (1.0 - r2)));\n\n/* Form the matrix. */\n   eraIr(rc2i);\n   eraRz(e, rc2i);\n   eraRy(d, rc2i);\n   eraRz(-(e+s), rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13227,"name":"apcg.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApcg(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p c g\n**  - - - - - - - -\n**\n**  For a geocentric observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and GCRS coordinates.\n**  The Earth ephemeris is supplied by the caller.\n**\n**  The parameters produced by this function are required in the\n**  parallax, light deflection and aberration parts of the astrometric\n**  transformation chain.\n**\n**  Given:\n**     date1  double       TDB as a 2-part...\n**     date2  double       ...Julian Date (Note 1)\n**     ebpv   double[2][3] Earth barycentric pos/vel (au, au/day)\n**     ehp    double[3]    Earth heliocentric position (au)\n**\n**  Returned:\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  4) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraApcs      astrometry parameters, ICRS-GCRS, space observer\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Geocentric observer */\n   double pv[2][3] = { { 0.0, 0.0, 0.0 },\n                       { 0.0, 0.0, 0.0 } };\n\n\n/* Compute the star-independent astrometry parameters. */\n   eraApcs(date1, date2, pv, ebpv, ehp, astrom);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":4,"comment":"null","endLoc":739,"header":"def _get_gridline(self, xy_world, pixel, xy_world_round)","id":13228,"name":"_get_gridline","nodeType":"Function","startLoc":735,"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)"},{"id":13229,"name":"ltpb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLtpb(double epj, double rpb[3][3])\n/*\n**  - - - - - - - -\n**   e r a L t p b\n**  - - - - - - - -\n**\n**  Long-term precession matrix, including ICRS frame bias.\n**\n**  Given:\n**     epj     double         Julian epoch (TT)\n**\n**  Returned:\n**     rpb     double[3][3]   precession-bias matrix, J2000.0 to date\n**\n**  Notes:\n**\n**  1) The matrix is in the sense\n**\n**        P_date = rpb x P_ICRS,\n**\n**     where P_ICRS is a vector in the Geocentric Celestial Reference\n**     System, and P_date is the vector with respect to the Celestial\n**     Intermediate Reference System at that date but with nutation\n**     neglected.\n**\n**  2) A first order frame bias formulation is used, of sub-\n**     microarcsecond accuracy compared with a full 3D rotation.\n**\n**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Frame bias (IERS Conventions 2010, Eqs. 5.21 and 5.33) */\n   const double dx = -0.016617 * ERFA_DAS2R,\n                de = -0.0068192 * ERFA_DAS2R,\n                dr = -0.0146 * ERFA_DAS2R;\n\n   int i;\n   double rp[3][3];\n\n\n/* Precession matrix. */\n   eraLtp(epj, rp);\n\n/* Apply the bias. */\n   for ( i = 0; i < 3; i++ ) {\n      rpb[i][0] =  rp[i][0]    - rp[i][1]*dr + rp[i][2]*dx;\n      rpb[i][1] =  rp[i][0]*dr + rp[i][1]    + rp[i][2]*de;\n      rpb[i][2] = -rp[i][0]*dx - rp[i][1]*de + rp[i][2];\n   }\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13230,"name":"pvppv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvppv(double a[2][3], double b[2][3], double apb[2][3])\n/*\n**  - - - - - - - - -\n**   e r a P v p p v\n**  - - - - - - - - -\n**\n**  Add one pv-vector to another.\n**\n**  Given:\n**     a        double[2][3]      first pv-vector\n**     b        double[2][3]      second pv-vector\n**\n**  Returned:\n**     apb      double[2][3]      a + b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Called:\n**     eraPpp       p-vector plus p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraPpp(a[0], b[0], apb[0]);\n   eraPpp(a[1], b[1], apb[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13231,"name":"rx.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRx(double phi, double r[3][3])\n/*\n**  - - - - - -\n**   e r a R x\n**  - - - - - -\n**\n**  Rotate an r-matrix about the x-axis.\n**\n**  Given:\n**     phi    double          angle (radians)\n**\n**  Given and returned:\n**     r      double[3][3]    r-matrix, rotated\n**\n**  Notes:\n**\n**  1) Calling this function with positive phi incorporates in the\n**     supplied r-matrix r an additional rotation, about the x-axis,\n**     anticlockwise as seen looking towards the origin from positive x.\n**\n**  2) The additional rotation can be represented by this matrix:\n**\n**         (  1        0            0      )\n**         (                               )\n**         (  0   + cos(phi)   + sin(phi)  )\n**         (                               )\n**         (  0   - sin(phi)   + cos(phi)  )\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double s, c, a10, a11, a12, a20, a21, a22;\n\n\n   s = sin(phi);\n   c = cos(phi);\n\n   a10 =   c*r[1][0] + s*r[2][0];\n   a11 =   c*r[1][1] + s*r[2][1];\n   a12 =   c*r[1][2] + s*r[2][2];\n   a20 = - s*r[1][0] + c*r[2][0];\n   a21 = - s*r[1][1] + c*r[2][1];\n   a22 = - s*r[1][2] + c*r[2][2];\n\n   r[1][0] = a10;\n   r[1][1] = a11;\n   r[1][2] = a12;\n   r[2][0] = a20;\n   r[2][1] = a21;\n   r[2][2] = a22;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13232,"name":"c2tpe.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2tpe(double tta, double ttb, double uta, double utb,\n              double dpsi, double deps, double xp, double yp,\n              double rc2t[3][3])\n/*\n**  - - - - - - - - -\n**   e r a C 2 t p e\n**  - - - - - - - - -\n**\n**  Form the celestial to terrestrial matrix given the date, the UT1,\n**  the nutation and the polar motion.  IAU 2000.\n**\n**  Given:\n**     tta,ttb    double        TT as a 2-part Julian Date (Note 1)\n**     uta,utb    double        UT1 as a 2-part Julian Date (Note 1)\n**     dpsi,deps  double        nutation (Note 2)\n**     xp,yp      double        coordinates of the pole (radians, Note 3)\n**\n**  Returned:\n**     rc2t       double[3][3]  celestial-to-terrestrial matrix (Note 4)\n**\n**  Notes:\n**\n**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,\n**     apportioned in any convenient way between the arguments uta and\n**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of\n**     these ways, among others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  In the case of uta,utb, the\n**     date & time method is best matched to the Earth rotation angle\n**     algorithm used:  maximum precision is delivered when the uta\n**     argument is for 0hrs UT1 on the day in question and the utb\n**     argument lies in the range 0 to 1, or vice versa.\n**\n**  2) The caller is responsible for providing the nutation components;\n**     they are in longitude and obliquity, in radians and are with\n**     respect to the equinox and ecliptic of date.  For high-accuracy\n**     applications, free core nutation should be included as well as\n**     any other relevant corrections to the position of the CIP.\n**\n**  3) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  4) The matrix rc2t transforms from celestial to terrestrial\n**     coordinates:\n**\n**        [TRS] = RPOM * R_3(GST) * RBPN * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), RBPN is the\n**     bias-precession-nutation matrix, GST is the Greenwich (apparent)\n**     Sidereal Time and RPOM is the polar motion matrix.\n**\n**  5) Although its name does not include \"00\", This function is in fact\n**     specific to the IAU 2000 models.\n**\n**  Called:\n**     eraPn00      bias/precession/nutation results, IAU 2000\n**     eraGmst00    Greenwich mean sidereal time, IAU 2000\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraEe00      equation of the equinoxes, IAU 2000\n**     eraPom00     polar motion matrix\n**     eraC2teqx    form equinox-based celestial-to-terrestrial matrix\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3],\n          rbpn[3][3], gmst, ee, sp, rpom[3][3];\n\n\n/* Form the celestial-to-true matrix for this TT. */\n   eraPn00(tta, ttb, dpsi, deps, &epsa, rb, rp, rbp, rn, rbpn);\n\n/* Predict the Greenwich Mean Sidereal Time for this UT1 and TT. */\n   gmst = eraGmst00(uta, utb, tta, ttb);\n\n/* Predict the equation of the equinoxes given TT and nutation. */\n   ee = eraEe00(tta, ttb, epsa, dpsi);\n\n/* Estimate s'. */\n   sp = eraSp00(tta, ttb);\n\n/* Form the polar motion matrix. */\n   eraPom00(xp, yp, sp, rpom);\n\n/* Combine to form the celestial-to-terrestrial matrix. */\n   eraC2teqx(rbpn, gmst + ee, rpom, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13233,"name":"faom03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFaom03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a o m 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of the Moon's ascending node.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    Omega, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of the Moon's ascending node */\n/* (IERS Conventions 2003).                    */\n   a = fmod(          450160.398036 +\n             t * ( - 6962890.5431 +\n             t * (         7.4722 +\n             t * (         0.007702 +\n             t * (       - 0.00005939 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R;\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13234,"name":"apcs13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApcs13(double date1, double date2, double pv[2][3],\n               eraASTROM *astrom)\n/*\n**  - - - - - - - - - -\n**   e r a A p c s 1 3\n**  - - - - - - - - - -\n**\n**  For an observer whose geocentric position and velocity are known,\n**  prepare star-independent astrometry parameters for transformations\n**  between ICRS and GCRS.  The Earth ephemeris is from ERFA models.\n**\n**  The parameters produced by this function are required in the space\n**  motion, parallax, light deflection and aberration parts of the\n**  astrometric transformation chain.\n**\n**  Given:\n**     date1  double       TDB as a 2-part...\n**     date2  double       ...Julian Date (Note 1)\n**     pv     double[2][3] observer's geocentric pos/vel (Note 3)\n**\n**  Returned:\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) The observer's position and velocity pv are geocentric but with\n**     respect to BCRS axes, and in units of m and m/s.  No assumptions\n**     are made about proximity to the Earth, and the function can be\n**     used for deep space applications as well as Earth orbit and\n**     terrestrial.\n**\n**  4) In cases where the caller wishes to supply his own Earth\n**     ephemeris, the function eraApcs can be used instead of the present\n**     function.\n**\n**  5) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  6) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraEpv00     Earth position and velocity\n**     eraApcs      astrometry parameters, ICRS-GCRS, space observer\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ehpv[2][3], ebpv[2][3];\n\n\n/* Earth barycentric & heliocentric position/velocity (au, au/d). */\n   (void) eraEpv00(date1, date2, ehpv, ebpv);\n\n/* Compute the star-independent astrometry parameters. */\n   eraApcs(date1, date2, pv, ebpv, ehpv[0], astrom);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13235,"name":"pvxpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvxpv(double a[2][3], double b[2][3], double axb[2][3])\n/*\n**  - - - - - - - - -\n**   e r a P v x p v\n**  - - - - - - - - -\n**\n**  Outer (=vector=cross) product of two pv-vectors.\n**\n**  Given:\n**     a        double[2][3]      first pv-vector\n**     b        double[2][3]      second pv-vector\n**\n**  Returned:\n**     axb      double[2][3]      a x b\n**\n**  Notes:\n**\n**  1) If the position and velocity components of the two pv-vectors are\n**     ( ap, av ) and ( bp, bv ), the result, a x b, is the pair of\n**     vectors ( ap x bp, ap x bv + av x bp ).  The two vectors are the\n**     cross-product of the two p-vectors and its derivative.\n**\n**  2) It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Called:\n**     eraCpv       copy pv-vector\n**     eraPxp       vector product of two p-vectors\n**     eraPpp       p-vector plus p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double wa[2][3], wb[2][3], axbd[3], adxb[3];\n\n\n/* Make copies of the inputs. */\n   eraCpv(a, wa);\n   eraCpv(b, wb);\n\n/* a x b = position part of result. */\n   eraPxp(wa[0], wb[0], axb[0]);\n\n/* a x bdot + adot x b = velocity part of result. */\n   eraPxp(wa[0], wb[1], axbd);\n   eraPxp(wa[1], wb[0], adxb);\n   eraPpp(axbd, adxb, axb[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13236,"name":"c2s.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2s(double p[3], double *theta, double *phi)\n/*\n**  - - - - - - -\n**   e r a C 2 s\n**  - - - - - - -\n**\n**  P-vector to spherical coordinates.\n**\n**  Given:\n**     p      double[3]    p-vector\n**\n**  Returned:\n**     theta  double       longitude angle (radians)\n**     phi    double       latitude angle (radians)\n**\n**  Notes:\n**\n**  1) The vector p can have any magnitude; only its direction is used.\n**\n**  2) If p is null, zero theta and phi are returned.\n**\n**  3) At either pole, zero theta is returned.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y, z, d2;\n\n\n   x  = p[0];\n   y  = p[1];\n   z  = p[2];\n   d2 = x*x + y*y;\n\n   *theta = (d2 == 0.0) ? 0.0 : atan2(y, x);\n   *phi = (z == 0.0) ? 0.0 : atan2(z, sqrt(d2));\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13237,"name":"obl06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraObl06(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a O b l 0 6\n**  - - - - - - - - -\n**\n**  Mean obliquity of the ecliptic, IAU 2006 precession model.\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double   obliquity of the ecliptic (radians, Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result is the angle between the ecliptic and mean equator of\n**     date date1+date2.\n**\n**  Reference:\n**\n**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, eps0;\n\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Mean obliquity. */\n   eps0 = (84381.406     +\n          (-46.836769    +\n          ( -0.0001831   +\n          (  0.00200340  +\n          ( -0.000000576 +\n          ( -0.0000000434) * t) * t) * t) * t) * t) * ERFA_DAS2R;\n\n   return eps0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13238,"name":"g2icrs.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraG2icrs ( double dl, double db, double *dr, double *dd )\n/*\n**  - - - - - - - - - -\n**   e r a G 2 i c r s\n**  - - - - - - - - - -\n**\n**  Transformation from Galactic Coordinates to ICRS.\n**\n**  Given:\n**     dl     double      galactic longitude (radians)\n**     db     double      galactic latitude (radians)\n**\n**  Returned:\n**     dr     double      ICRS right ascension (radians)\n**     dd     double      ICRS declination (radians)\n**\n**  Notes:\n**\n**  1) The IAU 1958 system of Galactic coordinates was defined with\n**     respect to the now obsolete reference system FK4 B1950.0.  When\n**     interpreting the system in a modern context, several factors have\n**     to be taken into account:\n**\n**     . The inclusion in FK4 positions of the E-terms of aberration.\n**\n**     . The distortion of the FK4 proper motion system by differential\n**       Galactic rotation.\n**\n**     . The use of the B1950.0 equinox rather than the now-standard\n**       J2000.0.\n**\n**     . The frame bias between ICRS and the J2000.0 mean place system.\n**\n**     The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation\n**     matrix that transforms directly between ICRS and Galactic\n**     coordinates with the above factors taken into account.  The\n**     matrix is derived from three angles, namely the ICRS coordinates\n**     of the Galactic pole and the longitude of the ascending node of\n**     the galactic equator on the ICRS equator.  They are given in\n**     degrees to five decimal places and for canonical purposes are\n**     regarded as exact.  In the Hipparcos Catalogue the matrix\n**     elements are given to 10 decimal places (about 20 microarcsec).\n**     In the present ERFA function the matrix elements have been\n**     recomputed from the canonical three angles and are given to 30\n**     decimal places.\n**\n**  2) The inverse transformation is performed by the function eraIcrs2g.\n**\n**  Called:\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**     eraS2c       spherical coordinates to unit vector\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraC2s       p-vector to spherical\n**\n**  Reference:\n**     Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho\n**     catalogues.  Astrometric and photometric star catalogues\n**     derived from the ESA Hipparcos Space Astrometry Mission.  ESA\n**     Publications Division, Noordwijk, Netherlands.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double v1[3], v2[3];\n\n/*\n**  L2,B2 system of galactic coordinates in the form presented in the\n**  Hipparcos Catalogue.  In degrees:\n**\n**  P = 192.85948    right ascension of the Galactic north pole in ICRS\n**  Q =  27.12825    declination of the Galactic north pole in ICRS\n**  R =  32.93192    longitude of the ascending node of the Galactic\n**                   plane on the ICRS equator\n**\n**  ICRS to galactic rotation matrix, obtained by computing\n**  R_3(-R) R_1(pi/2-Q) R_3(pi/2+P) to the full precision shown:\n*/\n   double r[3][3] = { { -0.054875560416215368492398900454,\n                        -0.873437090234885048760383168409,\n                        -0.483835015548713226831774175116 },\n                      { +0.494109427875583673525222371358,\n                        -0.444829629960011178146614061616,\n                        +0.746982244497218890527388004556 },\n                      { -0.867666149019004701181616534570,\n                        -0.198076373431201528180486091412,\n                        +0.455983776175066922272100478348 } };\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dl, db, v1);\n\n/* Galactic to ICRS. */\n   eraTrxp(r, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, dr, dd);\n\n/* Express in conventional ranges. */\n   *dr = eraAnp(*dr);\n   *dd = eraAnpm(*dd);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13239,"name":"pvup.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvup(double dt, double pv[2][3], double p[3])\n/*\n**  - - - - - - - -\n**   e r a P v u p\n**  - - - - - - - -\n**\n**  Update a pv-vector, discarding the velocity component.\n**\n**  Given:\n**     dt       double            time interval\n**     pv       double[2][3]      pv-vector\n**\n**  Returned:\n**     p        double[3]         p-vector\n**\n**  Notes:\n**\n**  1) \"Update\" means \"refer the position component of the vector to a\n**     new date dt time units from the existing date\".\n**\n**  2) The time units of dt must match those of the velocity.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   p[0] = pv[0][0] + dt * pv[1][0];\n   p[1] = pv[0][1] + dt * pv[1][1];\n   p[2] = pv[0][2] + dt * pv[1][2];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13240,"name":"fama03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFama03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a m a 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Mars.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Mars, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Mars (IERS Conventions 2003). */\n   a = fmod(6.203480913 + 334.0612426700 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13241,"name":"apco.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApco(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             double x, double y, double s, double theta,\n             double elong, double phi, double hm,\n             double xp, double yp, double sp,\n             double refa, double refb,\n             eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p c o\n**  - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and observed\n**  coordinates.  The caller supplies the Earth ephemeris, the Earth\n**  rotation information and the refraction constants as well as the\n**  site coordinates.\n**\n**  Given:\n**     date1  double       TDB as a 2-part...\n**     date2  double       ...Julian Date (Note 1)\n**     ebpv   double[2][3] Earth barycentric PV (au, au/day, Note 2)\n**     ehp    double[3]    Earth heliocentric P (au, Note 2)\n**     x,y    double       CIP X,Y (components of unit vector)\n**     s      double       the CIO locator s (radians)\n**     theta  double       Earth rotation angle (radians)\n**     elong  double       longitude (radians, east +ve, Note 3)\n**     phi    double       latitude (geodetic, radians, Note 3)\n**     hm     double       height above ellipsoid (m, geodetic, Note 3)\n**     xp,yp  double       polar motion coordinates (radians, Note 4)\n**     sp     double       the TIO locator s' (radians, Note 4)\n**     refa   double       refraction constant A (radians, Note 5)\n**     refb   double       refraction constant B (radians, Note 5)\n**\n**  Returned:\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) The vectors eb, eh, and all the astrom vectors, are with respect\n**     to BCRS axes.\n**\n**  3) The geographical coordinates are with respect to the ERFA_WGS84\n**     reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN\n**     CONVENTION:  the longitude required by the present function is\n**     right-handed, i.e. east-positive, in accordance with geographical\n**     convention.\n**\n**  4) xp and yp are the coordinates (in radians) of the Celestial\n**     Intermediate Pole with respect to the International Terrestrial\n**     Reference System (see IERS Conventions), measured along the\n**     meridians 0 and 90 deg west respectively.  sp is the TIO locator\n**     s', in radians, which positions the Terrestrial Intermediate\n**     Origin on the equator.  For many applications, xp, yp and\n**     (especially) sp can be set to zero.\n**\n**     Internally, the polar motion is stored in a form rotated onto the\n**     local meridian.\n**\n**  5) The refraction constants refa and refb are for use in a\n**     dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed\n**     (i.e. refracted) zenith distance and dZ is the amount of\n**     refraction.\n**\n**  6) It is advisable to take great care with units, as even unlikely\n**     values of the input parameters are accepted and processed in\n**     accordance with the models used.\n**\n**  7) In cases where the caller does not wish to provide the Earth\n**     Ephemeris, the Earth rotation information and refraction\n**     constants, the function eraApco13 can be used instead of the\n**     present function.  This starts from UTC and weather readings etc.\n**     and computes suitable values using other ERFA functions.\n**\n**  8) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  9) The context structure astrom produced by this function is used by\n**     eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraAper      astrometry parameters: update ERA\n**     eraC2ixys    celestial-to-intermediate matrix, given X,Y and s\n**     eraPvtob     position/velocity of terrestrial station\n**     eraTrxpv     product of transpose of r-matrix and pv-vector\n**     eraApcs      astrometry parameters, ICRS-GCRS, space observer\n**     eraCr        copy r-matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double sl, cl, r[3][3], pvc[2][3], pv[2][3];\n\n\n/* Longitude with adjustment for TIO locator s'. */\n   astrom->along = elong + sp;\n\n/* Polar motion, rotated onto the local meridian. */\n   sl = sin(astrom->along);\n   cl = cos(astrom->along);\n   astrom->xpl = xp*cl - yp*sl;\n   astrom->ypl = xp*sl + yp*cl;\n\n/* Functions of latitude. */\n   astrom->sphi = sin(phi);\n   astrom->cphi = cos(phi);\n\n/* Refraction constants. */\n   astrom->refa = refa;\n   astrom->refb = refb;\n\n/* Local Earth rotation angle. */\n   eraAper(theta, astrom);\n\n/* Disable the (redundant) diurnal aberration step. */\n   astrom->diurab = 0.0;\n\n/* CIO based BPN matrix. */\n   eraC2ixys(x, y, s, r);\n\n/* Observer's geocentric position and velocity (m, m/s, CIRS). */\n   eraPvtob(elong, phi, hm, xp, yp, sp, theta, pvc);\n\n/* Rotate into GCRS. */\n   eraTrxpv(r, pvc, pv);\n\n/* ICRS <-> GCRS parameters. */\n   eraApcs(date1, date2, pv, ebpv, ehp, astrom);\n\n/* Store the CIO based BPN matrix. */\n   eraCr(r, astrom->bpn );\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13242,"name":"faur03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFaur03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a u r 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Uranus.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned  (function value):\n**           double    mean longitude of Uranus, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is adapted from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Uranus (IERS Conventions 2003). */\n   a = fmod(5.481293872 + 7.4781598567 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13243,"name":"fal03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFal03(double t)\n/*\n**  - - - - - - - - -\n**   e r a F a l 0 3\n**  - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean anomaly of the Moon.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    l, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean anomaly of the Moon (IERS Conventions 2003). */\n   a = fmod(           485868.249036  +\n             t * ( 1717915923.2178 +\n             t * (         31.8792 +\n             t * (          0.051635 +\n             t * (        - 0.00024470 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R;\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13244,"name":"atioq.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtioq(double ri, double di, eraASTROM *astrom,\n              double *aob, double *zob,\n              double *hob, double *dob, double *rob)\n/*\n**  - - - - - - - - -\n**   e r a A t i o q\n**  - - - - - - - - -\n**\n**  Quick CIRS to observed place transformation.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are all to be transformed for one date.\n**  The star-independent astrometry parameters can be obtained by\n**  calling eraApio[13] or eraApco[13].\n**\n**  Given:\n**     ri     double     CIRS right ascension\n**     di     double     CIRS declination\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned:\n**     aob    double*    observed azimuth (radians: N=0,E=90)\n**     zob    double*    observed zenith distance (radians)\n**     hob    double*    observed hour angle (radians)\n**     dob    double*    observed declination (radians)\n**     rob    double*    observed right ascension (CIO-based, radians)\n**\n**  Notes:\n**\n**  1) This function returns zenith distance rather than altitude in\n**     order to reflect the fact that no allowance is made for\n**     depression of the horizon.\n**\n**  2) The accuracy of the result is limited by the corrections for\n**     refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**     Providing the meteorological parameters are known accurately and\n**     there are no gross local effects, the predicted observed\n**     coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**     (radio) for a zenith distance of less than 70 degrees, better\n**     than 30 arcsec (optical or radio) at 85 degrees and better\n**     than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**     Without refraction, the complementary functions eraAtioq and\n**     eraAtoiq are self-consistent to better than 1 microarcsecond all\n**     over the celestial sphere.  With refraction included, consistency\n**     falls off at high zenith distances, but is still better than\n**     0.05 arcsec at 85 degrees.\n**\n**  3) It is advisable to take great care with units, as even unlikely\n**     values of the input parameters are accepted and processed in\n**     accordance with the models used.\n**\n**  4) The CIRS RA,Dec is obtained from a star catalog mean place by\n**     allowing for space motion, parallax, the Sun's gravitational lens\n**     effect, annual aberration and precession-nutation.  For star\n**     positions in the ICRS, these effects can be applied by means of\n**     the eraAtci13 (etc.) functions.  Starting from classical \"mean\n**     place\" systems, additional transformations will be needed first.\n**\n**  5) \"Observed\" Az,El means the position that would be seen by a\n**     perfect geodetically aligned theodolite.  This is obtained from\n**     the CIRS RA,Dec by allowing for Earth orientation and diurnal\n**     aberration, rotating from equator to horizon coordinates, and\n**     then adjusting for refraction.  The HA,Dec is obtained by\n**     rotating back into equatorial coordinates, and is the position\n**     that would be seen by a perfect equatorial with its polar axis\n**     aligned to the Earth's axis of rotation.  Finally, the RA is\n**     obtained by subtracting the HA from the local ERA.\n**\n**  6) The star-independent CIRS-to-observed-place parameters in ASTROM\n**     may be computed with eraApio[13] or eraApco[13].  If nothing has\n**     changed significantly except the time, eraAper[13] may be used to\n**     perform the requisite adjustment to the astrom structure.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Minimum cos(alt) and sin(alt) for refraction purposes */\n   const double CELMIN = 1e-6;\n   const double SELMIN = 0.05;\n\n   double v[3], x, y, z, xhd, yhd, zhd, f, xhdt, yhdt, zhdt,\n          xaet, yaet, zaet, azobs, r, tz, w, del, cosdel,\n          xaeo, yaeo, zaeo, zdobs, hmobs, dcobs, raobs;\n\n\n/* CIRS RA,Dec to Cartesian -HA,Dec. */\n   eraS2c(ri-astrom->eral, di, v);\n   x = v[0];\n   y = v[1];\n   z = v[2];\n\n/* Polar motion. */\n   xhd = x + astrom->xpl*z;\n   yhd = y - astrom->ypl*z;\n   zhd = z - astrom->xpl*x + astrom->ypl*y;\n\n/* Diurnal aberration. */\n   f = ( 1.0 - astrom->diurab*yhd );\n   xhdt = f * xhd;\n   yhdt = f * ( yhd + astrom->diurab );\n   zhdt = f * zhd;\n\n/* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90). */\n   xaet = astrom->sphi*xhdt - astrom->cphi*zhdt;\n   yaet = yhdt;\n   zaet = astrom->cphi*xhdt + astrom->sphi*zhdt;\n\n/* Azimuth (N=0,E=90). */\n   azobs = ( xaet != 0.0 || yaet != 0.0 ) ? atan2(yaet,-xaet) : 0.0;\n\n/* ---------- */\n/* Refraction */\n/* ---------- */\n\n/* Cosine and sine of altitude, with precautions. */\n   r = sqrt(xaet*xaet + yaet*yaet);\n   r = r > CELMIN ? r : CELMIN;\n   z = zaet > SELMIN ? zaet : SELMIN;\n\n/* A*tan(z)+B*tan^3(z) model, with Newton-Raphson correction. */\n   tz = r/z;\n   w = astrom->refb*tz*tz;\n   del = ( astrom->refa + w ) * tz /\n         ( 1.0 + ( astrom->refa + 3.0*w ) / ( z*z ) );\n\n/* Apply the change, giving observed vector. */\n   cosdel = 1.0 - del*del/2.0;\n   f = cosdel - del*z/r;\n   xaeo = xaet*f;\n   yaeo = yaet*f;\n   zaeo = cosdel*zaet + del*r;\n\n/* Observed ZD. */\n   zdobs = atan2(sqrt(xaeo*xaeo+yaeo*yaeo), zaeo);\n\n/* Az/El vector to HA,Dec vector (both right-handed). */\n   v[0] = astrom->sphi*xaeo + astrom->cphi*zaeo;\n   v[1] = yaeo;\n   v[2] = - astrom->cphi*xaeo + astrom->sphi*zaeo;\n\n/* To spherical -HA,Dec. */\n   eraC2s ( v, &hmobs, &dcobs );\n\n/* Right ascension (with respect to CIO). */\n   raobs = astrom->eral + hmobs;\n\n/* Return the results. */\n   *aob = eraAnp(azobs);\n   *zob = zdobs;\n   *hob = -hmobs;\n   *dob = dcobs;\n   *rob = eraAnp(raobs);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13245,"name":"c2i00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2i00b(double date1, double date2, double rc2i[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 i 0 0 b\n**  - - - - - - - - - -\n**\n**  Form the celestial-to-intermediate matrix for a given date using the\n**  IAU 2000B precession-nutation model.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**               =  rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  3) The present function is faster, but slightly less accurate (about\n**     1 mas), than the eraC2i00a function.\n**\n**  Called:\n**     eraPnm00b    classical NPB matrix, IAU 2000B\n**     eraC2ibpn    celestial-to-intermediate matrix, given NPB matrix\n**\n**  References:\n**\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154\n**     (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3];\n\n\n/* Obtain the celestial-to-true matrix (IAU 2000B). */\n   eraPnm00b(date1, date2, rbpn);\n\n/* Form the celestial-to-intermediate matrix. */\n   eraC2ibpn(date1, date2, rbpn, rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13246,"name":"pr00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPr00(double date1, double date2, double *dpsipr, double *depspr)\n/*\n**  - - - - - - - -\n**   e r a P r 0 0\n**  - - - - - - - -\n**\n**  Precession-rate part of the IAU 2000 precession-nutation models\n**  (part of MHB2000).\n**\n**  Given:\n**     date1,date2    double  TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsipr,depspr  double  precession corrections (Notes 2,3)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The precession adjustments are expressed as \"nutation\n**     components\", corrections in longitude and obliquity with respect\n**     to the J2000.0 equinox and ecliptic.\n**\n**  3) Although the precession adjustments are stated to be with respect\n**     to Lieske et al. (1977), the MHB2000 model does not specify which\n**     set of Euler angles are to be used and how the adjustments are to\n**     be applied.  The most literal and straightforward procedure is to\n**     adopt the 4-rotation epsilon_0, psi_A, omega_A, xi_A option, and\n**     to add dpsipr to psi_A and depspr to both omega_A and eps_A.\n**\n**  4) This is an implementation of one aspect of the IAU 2000A nutation\n**     model, formally adopted by the IAU General Assembly in 2000,\n**     namely MHB2000 (Mathews et al. 2002).\n**\n**  References:\n**\n**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B., \"Expressions\n**     for the precession quantities based upon the IAU (1976) System of\n**     Astronomical Constants\", Astron.Astrophys., 58, 1-16 (1977)\n**\n**     Mathews, P.M., Herring, T.A., Buffet, B.A., \"Modeling of nutation\n**     and precession   New nutation series for nonrigid Earth and\n**     insights into the Earth's interior\", J.Geophys.Res., 107, B4,\n**     2002.  The MHB2000 code itself was obtained on 9th September 2002\n**     from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.\n**\n**     Wallace, P.T., \"Software for Implementing the IAU 2000\n**     Resolutions\", in IERS Workshop 5.1 (2002).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t;\n\n/* Precession and obliquity corrections (radians per century) */\n   static const double PRECOR = -0.29965 * ERFA_DAS2R,\n                       OBLCOR = -0.02524 * ERFA_DAS2R;\n\n\n/* Interval between fundamental epoch J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Precession rate contributions with respect to IAU 1976/80. */\n   *dpsipr = PRECOR * t;\n   *depspr = OBLCOR * t;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13247,"name":"tdbtt.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTdbtt(double tdb1, double tdb2, double dtr,\n             double *tt1, double *tt2 )\n/*\n**  - - - - - - - - -\n**   e r a T d b t t\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Barycentric Dynamical Time, TDB, to\n**  Terrestrial Time, TT.\n**\n**  Given:\n**     tdb1,tdb2  double    TDB as a 2-part Julian Date\n**     dtr        double    TDB-TT in seconds\n**\n**  Returned:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tdb1+tdb2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tdb1 is the Julian\n**     Day Number and tdb2 is the fraction of a day.  The returned\n**     tt1,tt2 follow suit.\n**\n**  2) The argument dtr represents the quasi-periodic component of the\n**     GR transformation between TT and TCB.  It is dependent upon the\n**     adopted solar-system ephemeris, and can be obtained by numerical\n**     integration, by interrogating a precomputed time ephemeris or by\n**     evaluating a model such as that implemented in the ERFA function\n**     eraDtdb.   The quantity is dominated by an annual term of 1.7 ms\n**     amplitude.\n**\n**  3) TDB is essentially the same as Teph, the time argument for the\n**     JPL solar system ephemerides.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     IAU 2006 Resolution 3\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtrd;\n\n\n/* Result, safeguarding precision. */\n   dtrd = dtr / ERFA_DAYSEC;\n   if ( tdb1 > tdb2 ) {\n      *tt1 = tdb1;\n      *tt2 = tdb2 - dtrd;\n   } else {\n      *tt1 = tdb1 - dtrd;\n      *tt2 = tdb2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13248,"name":"anpm.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraAnpm(double a)\n/*\n**  - - - - - - - -\n**   e r a A n p m\n**  - - - - - - - -\n**\n**  Normalize angle into the range -pi <= a < +pi.\n**\n**  Given:\n**     a        double     angle (radians)\n**\n**  Returned (function value):\n**              double     angle in range +/-pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double w;\n\n\n   w = fmod(a, ERFA_D2PI);\n   if (fabs(w) >= ERFA_DPI) w -= ERFA_DSIGN(ERFA_D2PI, a);\n\n   return w;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13249,"name":"eo06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEo06a(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a E o 0 6 a\n**  - - - - - - - - -\n**\n**  Equation of the origins, IAU 2006 precession and IAU 2000A nutation.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    equation of the origins in radians\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The equation of the origins is the distance between the true\n**     equinox and the celestial intermediate origin and, equivalently,\n**     the difference between Earth rotation angle and Greenwich\n**     apparent sidereal time (ERA-GST).  It comprises the precession\n**     (since J2000.0) in right ascension plus the equation of the\n**     equinoxes (including the small correction terms).\n**\n**  Called:\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**     eraEors      equation of the origins, given NPB matrix and s\n**\n**  References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r[3][3], x, y, s, eo;\n\n\n/* Classical nutation x precession x bias matrix. */\n   eraPnm06a(date1, date2, r);\n\n/* Extract CIP coordinates. */\n   eraBpn2xy(r, &x, &y);\n\n/* The CIO locator, s. */\n   s = eraS06(date1, date2, x, y);\n\n/* Solve for the EO. */\n   eo = eraEors(r, s);\n\n   return eo;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13250,"name":"aper13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAper13(double ut11, double ut12, eraASTROM *astrom)\n/*\n**  - - - - - - - - - -\n**   e r a A p e r 1 3\n**  - - - - - - - - - -\n**\n**  In the star-independent astrometry parameters, update only the\n**  Earth rotation angle.  The caller provides UT1, (n.b. not UTC).\n**\n**  Given:\n**     ut11    double      UT1 as a 2-part...\n**     ut12    double      ...Julian Date (Note 1)\n**     astrom  eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       not used\n**      eb     double[3]    not used\n**      eh     double[3]    not used\n**      em     double       not used\n**      v      double[3]    not used\n**      bm1    double       not used\n**      bpn    double[3][3] not used\n**      along  double       longitude + s' (radians)\n**      xpl    double       not used\n**      ypl    double       not used\n**      sphi   double       not used\n**      cphi   double       not used\n**      diurab double       not used\n**      eral   double       not used\n**      refa   double       not used\n**      refb   double       not used\n**\n**  Returned:\n**     astrom  eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       unchanged\n**      eb     double[3]    unchanged\n**      eh     double[3]    unchanged\n**      em     double       unchanged\n**      v      double[3]    unchanged\n**      bm1    double       unchanged\n**      bpn    double[3][3] unchanged\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The UT1 date (n.b. not UTC) ut11+ut12 is a Julian Date,\n**     apportioned in any convenient way between the arguments ut11 and\n**     ut12.  For example, JD(UT1)=2450123.7 could be expressed in any\n**     of these ways, among others:\n**\n**            ut11           ut12\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  The date & time method is\n**     best matched to the algorithm used:  maximum precision is\n**     delivered when the ut11 argument is for 0hrs UT1 on the day in\n**     question and the ut12 argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) If the caller wishes to provide the Earth rotation angle itself,\n**     the function eraAper can be used instead.  One use of this\n**     technique is to substitute Greenwich apparent sidereal time and\n**     thereby to support equinox based transformations directly.\n**\n**  3) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  Called:\n**     eraAper      astrometry parameters: update ERA\n**     eraEra00     Earth rotation angle, IAU 2000\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraAper(eraEra00(ut11,ut12), astrom);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13251,"name":"tcgtt.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTcgtt(double tcg1, double tcg2, double *tt1, double *tt2)\n/*\n**  - - - - - - - - -\n**   e r a T c g t t\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Geocentric Coordinate Time, TCG, to\n**  Terrestrial Time, TT.\n**\n**  Given:\n**     tcg1,tcg2  double    TCG as a 2-part Julian Date\n**\n**  Returned:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Note:\n**\n**     tcg1+tcg2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tcg1 is the Julian\n**     Day Number and tcg22 is the fraction of a day.  The returned\n**     tt1,tt2 follow suit.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),.\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     IAU 2000 Resolution B1.9\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* 1977 Jan 1 00:00:32.184 TT, as MJD */\n   static const double t77t = ERFA_DJM77 + ERFA_TTMTAI/ERFA_DAYSEC;\n\n\n/* Result, safeguarding precision. */\n   if ( tcg1 > tcg2 ) {\n      *tt1 = tcg1;\n      *tt2 = tcg2 - ( ( tcg1 - ERFA_DJM0 ) + ( tcg2 - t77t ) ) * ERFA_ELG;\n   } else {\n      *tt1 = tcg1 - ( ( tcg2 - ERFA_DJM0 ) + ( tcg1 - t77t ) ) * ERFA_ELG;\n      *tt2 = tcg2;\n   }\n\n/* OK status. */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13252,"name":"sp00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraSp00(double date1, double date2)\n/*\n**  - - - - - - - -\n**   e r a S p 0 0\n**  - - - - - - - -\n**\n**  The TIO locator s', positioning the Terrestrial Intermediate Origin\n**  on the equator of the Celestial Intermediate Pole.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    the TIO locator s' in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The TIO locator s' is obtained from polar motion observations by\n**     numerical integration, and so is in essence unpredictable.\n**     However, it is dominated by a secular drift of about\n**     47 microarcseconds per century, which is the approximation\n**     evaluated by the present function.\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, sp;\n\n\n/* Interval between fundamental epoch J2000.0 and current date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Approximate s'. */\n   sp = -47e-6 * t * ERFA_DAS2R;\n\n   return sp;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13253,"name":"fae03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFae03(double t)\n/*\n**  - - - - - - - - -\n**   e r a F a e 0 3\n**  - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Earth.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Earth, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Earth (IERS Conventions 2003). */\n   a = fmod(1.753470314 + 628.3075849991 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13254,"name":"atco13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraAtco13(double rc, double dc,\n              double pr, double pd, double px, double rv,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *aob, double *zob, double *hob,\n              double *dob, double *rob, double *eo)\n/*\n**  - - - - - - - - - -\n**   e r a A t c o 1 3\n**  - - - - - - - - - -\n**\n**  ICRS RA,Dec to observed place.  The caller supplies UTC, site\n**  coordinates, ambient air conditions and observing wavelength.\n**\n**  ERFA models are used for the Earth ephemeris, bias-precession-\n**  nutation, Earth orientation and refraction.\n**\n**  Given:\n**     rc,dc  double   ICRS right ascension at J2000.0 (radians, Note 1)\n**     pr     double   RA proper motion (radians/year; Note 2)\n**     pd     double   Dec proper motion (radians/year)\n**     px     double   parallax (arcsec)\n**     rv     double   radial velocity (km/s, +ve if receding)\n**     utc1   double   UTC as a 2-part...\n**     utc2   double   ...quasi Julian Date (Notes 3-4)\n**     dut1   double   UT1-UTC (seconds, Note 5)\n**     elong  double   longitude (radians, east +ve, Note 6)\n**     phi    double   latitude (geodetic, radians, Note 6)\n**     hm     double   height above ellipsoid (m, geodetic, Notes 6,8)\n**     xp,yp  double   polar motion coordinates (radians, Note 7)\n**     phpa   double   pressure at the observer (hPa = mB, Note 8)\n**     tc     double   ambient temperature at the observer (deg C)\n**     rh     double   relative humidity at the observer (range 0-1)\n**     wl     double   wavelength (micrometers, Note 9)\n**\n**  Returned:\n**     aob    double*  observed azimuth (radians: N=0,E=90)\n**     zob    double*  observed zenith distance (radians)\n**     hob    double*  observed hour angle (radians)\n**     dob    double*  observed declination (radians)\n**     rob    double*  observed right ascension (CIO-based, radians)\n**     eo     double*  equation of the origins (ERA-GST)\n**\n**  Returned (function value):\n**            int      status: +1 = dubious year (Note 4)\n**                              0 = OK\n**                             -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  Star data for an epoch other than J2000.0 (for example from the\n**      Hipparcos catalog, which has an epoch of J1991.25) will require\n**      a preliminary call to eraPmsafe before use.\n**\n**  2)  The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  4)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the\n**      future to be trusted.  See eraDat for further details.\n**\n**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  6)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many\n**      applications, xp and yp can be set to zero.\n**\n**  8)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB),\n**      is available, an adequate estimate of hm can be obtained from\n**      the expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to\n**      the pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  9)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  10) The accuracy of the result is limited by the corrections for\n**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.\n**      Providing the meteorological parameters are known accurately and\n**      there are no gross local effects, the predicted observed\n**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec\n**      (radio) for a zenith distance of less than 70 degrees, better\n**      than 30 arcsec (optical or radio) at 85 degrees and better\n**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.\n**\n**      Without refraction, the complementary functions eraAtco13 and\n**      eraAtoc13 are self-consistent to better than 1 microarcsecond\n**      all over the celestial sphere.  With refraction included,\n**      consistency falls off at high zenith distances, but is still\n**      better than 0.05 arcsec at 85 degrees.\n**\n**  11) \"Observed\" Az,ZD means the position that would be seen by a\n**      perfect geodetically aligned theodolite.  (Zenith distance is\n**      used rather than altitude in order to reflect the fact that no\n**      allowance is made for depression of the horizon.)  This is\n**      related to the observed HA,Dec via the standard rotation, using\n**      the geodetic latitude (corrected for polar motion), while the\n**      observed HA and RA are related simply through the Earth rotation\n**      angle and the site longitude.  \"Observed\" RA,Dec or HA,Dec thus\n**      means the position that would be seen by a perfect equatorial\n**      with its polar axis aligned to the Earth's axis of rotation.\n**\n**  12) It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  Called:\n**     eraApco13    astrometry parameters, ICRS-observed, 2013\n**     eraAtciq     quick ICRS to CIRS\n**     eraAtioq     quick CIRS to observed\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   eraASTROM astrom;\n   double ri, di;\n\n\n/* Star-independent astrometry parameters. */\n   j = eraApco13(utc1, utc2, dut1, elong, phi, hm, xp, yp,\n                 phpa, tc, rh, wl, &astrom, eo);\n\n/* Abort if bad UTC. */\n   if ( j < 0 ) return j;\n\n/* Transform ICRS to CIRS. */\n   eraAtciq(rc, dc, pr, pd, px, rv, &astrom, &ri, &di);\n\n/* Transform CIRS to observed. */\n   eraAtioq(ri, di, &astrom, aob, zob, hob, dob, rob);\n\n/* Return OK/warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13255,"name":"zpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraZpv(double pv[2][3])\n/*\n**  - - - - - - -\n**   e r a Z p v\n**  - - - - - - -\n**\n**  Zero a pv-vector.\n**\n**  Returned:\n**     pv       double[2][3]      pv-vector\n**\n**  Called:\n**     eraZp        zero p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraZp(pv[0]);\n   eraZp(pv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13256,"name":"s06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraS06a(double date1, double date2)\n/*\n**  - - - - - - - -\n**   e r a S 0 6 a\n**  - - - - - - - -\n**\n**  The CIO locator s, positioning the Celestial Intermediate Origin on\n**  the equator of the Celestial Intermediate Pole, using the IAU 2006\n**  precession and IAU 2000A nutation models.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    the CIO locator s in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The CIO locator s is the difference between the right ascensions\n**     of the same point in two systems.  The two systems are the GCRS\n**     and the CIP,CIO, and the point is the ascending node of the\n**     CIP equator.  The CIO locator s remains a small fraction of\n**     1 arcsecond throughout 1900-2100.\n**\n**  3) The series used to compute s is in fact for s+XY/2, where X and Y\n**     are the x and y components of the CIP unit vector;  this series is\n**     more compact than a direct series for s would be.  The present\n**     function uses the full IAU 2000A nutation model when predicting\n**     the CIP position.\n**\n**  Called:\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**\n**  References:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rnpb[3][3], x, y, s;\n\n\n/* Bias-precession-nutation-matrix, IAU 20006/2000A. */\n   eraPnm06a(date1, date2, rnpb);\n\n/* Extract the CIP coordinates. */\n   eraBpn2xy(rnpb, &x, &y);\n\n/* Compute the CIO locator s, given the CIP coordinates. */\n   s = eraS06(date1, date2, x, y);\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13257,"name":"pn.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn(double p[3], double *r, double u[3])\n/*\n**  - - - - - -\n**   e r a P n\n**  - - - - - -\n**\n**  Convert a p-vector into modulus and unit vector.\n**\n**  Given:\n**     p        double[3]      p-vector\n**\n**  Returned:\n**     r        double         modulus\n**     u        double[3]      unit vector\n**\n**  Notes:\n**\n**  1) If p is null, the result is null.  Otherwise the result is a unit\n**     vector.\n**\n**  2) It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Called:\n**     eraPm        modulus of p-vector\n**     eraZp        zero p-vector\n**     eraSxp       multiply p-vector by scalar\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double w;\n\n\n/* Obtain the modulus and test for zero. */\n   w = eraPm(p);\n   if (w == 0.0) {\n\n   /* Null vector. */\n      eraZp(u);\n\n   } else {\n\n   /* Unit vector. */\n      eraSxp(1.0/w, p, u);\n   }\n\n/* Return the modulus. */\n   *r = w;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13258,"name":"apcs.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraApcs(double date1, double date2, double pv[2][3],\n             double ebpv[2][3], double ehp[3],\n             eraASTROM *astrom)\n/*\n**  - - - - - - - -\n**   e r a A p c s\n**  - - - - - - - -\n**\n**  For an observer whose geocentric position and velocity are known,\n**  prepare star-independent astrometry parameters for transformations\n**  between ICRS and GCRS.  The Earth ephemeris is supplied by the\n**  caller.\n**\n**  The parameters produced by this function are required in the space\n**  motion, parallax, light deflection and aberration parts of the\n**  astrometric transformation chain.\n**\n**  Given:\n**     date1  double       TDB as a 2-part...\n**     date2  double       ...Julian Date (Note 1)\n**     pv     double[2][3] observer's geocentric pos/vel (m, m/s)\n**     ebpv   double[2][3] Earth barycentric PV (au, au/day)\n**     ehp    double[3]    Earth heliocentric P (au)\n**\n**  Returned:\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       unchanged\n**      xpl    double       unchanged\n**      ypl    double       unchanged\n**      sphi   double       unchanged\n**      cphi   double       unchanged\n**      diurab double       unchanged\n**      eral   double       unchanged\n**      refa   double       unchanged\n**      refb   double       unchanged\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) All the vectors are with respect to BCRS axes.\n**\n**  3) Providing separate arguments for (i) the observer's geocentric\n**     position and velocity and (ii) the Earth ephemeris is done for\n**     convenience in the geocentric, terrestrial and Earth orbit cases.\n**     For deep space applications it maybe more convenient to specify\n**     zero geocentric position and velocity and to supply the\n**     observer's position and velocity information directly instead of\n**     with respect to the Earth.  However, note the different units:\n**     m and m/s for the geocentric vectors, au and au/day for the\n**     heliocentric and barycentric vectors.\n**\n**  4) In cases where the caller does not wish to provide the Earth\n**     ephemeris, the function eraApcs13 can be used instead of the\n**     present function.  This computes the Earth ephemeris using the\n**     ERFA function eraEpv00.\n**\n**  5) This is one of several functions that inserts into the astrom\n**     structure star-independent parameters needed for the chain of\n**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**     The various functions support different classes of observer and\n**     portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**     Those with names ending in \"13\" use contemporary ERFA models to\n**     compute the various ephemerides.  The others accept ephemerides\n**     supplied by the caller.\n**\n**     The transformation from ICRS to GCRS covers space motion,\n**     parallax, light deflection, and aberration.  From GCRS to CIRS\n**     comprises frame bias and precession-nutation.  From CIRS to\n**     observed takes account of Earth rotation, polar motion, diurnal\n**     aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**     transformation), and atmospheric refraction.\n**\n**  6) The context structure astrom produced by this function is used by\n**     eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraCp        copy p-vector\n**     eraPm        modulus of p-vector\n**     eraPn        decompose p-vector into modulus and direction\n**     eraIr        initialize r-matrix to identity\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* au/d to m/s */\n   const double AUDMS = ERFA_DAU/ERFA_DAYSEC;\n\n/* Light time for 1 au (day) */\n   const double CR = ERFA_AULT/ERFA_DAYSEC;\n\n   int i;\n   double dp, dv, pb[3], vb[3], ph[3], v2, w;\n\n\n/* Time since reference epoch, years (for proper motion calculation). */\n   astrom->pmt = ( (date1 - ERFA_DJ00) + date2 ) / ERFA_DJY;\n\n/* Adjust Earth ephemeris to observer. */\n   for (i = 0; i < 3; i++) {\n      dp = pv[0][i] / ERFA_DAU;\n      dv = pv[1][i] / AUDMS;\n      pb[i] = ebpv[0][i] + dp;\n      vb[i] = ebpv[1][i] + dv;\n      ph[i] = ehp[i] + dp;\n   }\n\n/* Barycentric position of observer (au). */\n   eraCp(pb, astrom->eb);\n\n/* Heliocentric direction and distance (unit vector and au). */\n   eraPn(ph, &astrom->em, astrom->eh);\n\n/* Barycentric vel. in units of c, and reciprocal of Lorenz factor. */\n   v2 = 0.0;\n   for (i = 0; i < 3; i++) {\n      w = vb[i] * CR;\n      astrom->v[i] = w;\n      v2 += w*w;\n   }\n   astrom->bm1 = sqrt(1.0 - v2);\n\n/* Reset the NPB matrix. */\n   eraIr(astrom->bpn);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13259,"name":"era00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEra00(double dj1, double dj2)\n/*\n**  - - - - - - - - -\n**   e r a E r a 0 0\n**  - - - - - - - - -\n**\n**  Earth rotation angle (IAU 2000 model).\n**\n**  Given:\n**     dj1,dj2   double    UT1 as a 2-part Julian Date (see note)\n**\n**  Returned (function value):\n**               double    Earth rotation angle (radians), range 0-2pi\n**\n**  Notes:\n**\n**  1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any\n**     convenient way between the arguments dj1 and dj2.  For example,\n**     JD(UT1)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**             dj1            dj2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  The date & time method is\n**     best matched to the algorithm used:  maximum precision is\n**     delivered when the dj1 argument is for 0hrs UT1 on the day in\n**     question and the dj2 argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) The algorithm is adapted from Expression 22 of Capitaine et al.\n**     2000.  The time argument has been expressed in days directly,\n**     and, to retain precision, integer contributions have been\n**     eliminated.  The same formulation is given in IERS Conventions\n**     (2003), Chap. 5, Eq. 14.\n**\n**  Called:\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Capitaine N., Guinot B. and McCarthy D.D, 2000, Astron.\n**     Astrophys., 355, 398-405.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double d1, d2, t, f, theta;\n\n\n/* Days since fundamental epoch. */\n   if (dj1 < dj2) {\n      d1 = dj1;\n      d2 = dj2;\n   } else {\n      d1 = dj2;\n      d2 = dj1;\n   }\n   t = d1 + (d2- ERFA_DJ00);\n\n/* Fractional part of T (days). */\n   f = fmod(d1, 1.0) + fmod(d2, 1.0);\n\n/* Earth rotation angle at this UT1. */\n   theta = eraAnp(ERFA_D2PI * (f + 0.7790572732640\n                            + 0.00273781191135448 * t));\n\n   return theta;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13260,"name":"ltp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLtp(double epj, double rp[3][3])\n/*\n**  - - - - - - -\n**   e r a L t p\n**  - - - - - - -\n**\n**  Long-term precession matrix.\n**\n**  Given:\n**     epj     double         Julian epoch (TT)\n**\n**  Returned:\n**     rp      double[3][3]   precession matrix, J2000.0 to date\n**\n**  Notes:\n**\n**  1) The matrix is in the sense\n**\n**        P_date = rp x P_J2000,\n**\n**     where P_J2000 is a vector with respect to the J2000.0 mean\n**     equator and equinox and P_date is the same vector with respect to\n**     the equator and equinox of epoch epj.\n**\n**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  Called:\n**     eraLtpequ    equator pole, long term\n**     eraLtpecl    ecliptic pole, long term\n**     eraPxp       vector product\n**     eraPn        normalize vector\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double peqr[3], pecl[3], v[3], w, eqx[3];\n\n\n/* Equator pole (bottom row of matrix). */\n   eraLtpequ(epj, peqr);\n\n/* Ecliptic pole. */\n   eraLtpecl(epj, pecl);\n\n/* Equinox (top row of matrix). */\n   eraPxp(peqr, pecl, v);\n   eraPn(v, &w, eqx);\n\n/* Middle row of matrix. */\n   eraPxp(peqr, eqx, v);\n\n/* Assemble the matrix. */\n   for ( i = 0; i < 3; i++ ) {\n      rp[0][i] = eqx[i];\n      rp[1][i] = v[i];\n      rp[2][i] = peqr[i];\n   }\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13261,"name":"pv2p.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPv2p(double pv[2][3], double p[3])\n/*\n**  - - - - - - - -\n**   e r a P v 2 p\n**  - - - - - - - -\n**\n**  Discard velocity component of a pv-vector.\n**\n**  Given:\n**     pv      double[2][3]     pv-vector\n**\n**  Returned:\n**     p       double[3]        p-vector\n**\n**  Called:\n**     eraCp        copy p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraCp(pv[0], p);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13262,"name":"taiut1.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTaiut1(double tai1, double tai2, double dta,\n              double *ut11, double *ut12)\n/*\n**  - - - - - - - - - -\n**   e r a T a i u t 1\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  International Atomic Time, TAI, to\n**  Universal Time, UT1.\n**\n**  Given:\n**     tai1,tai2  double    TAI as a 2-part Julian Date\n**     dta        double    UT1-TAI in seconds\n**\n**  Returned:\n**     ut11,ut12  double    UT1 as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tai1+tai2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tai1 is the Julian\n**     Day Number and tai2 is the fraction of a day.  The returned\n**     UT11,UT12 follow suit.\n**\n**  2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is\n**     available from IERS tabulations.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtad;\n\n\n/* Result, safeguarding precision. */\n   dtad = dta / ERFA_DAYSEC;\n   if ( tai1 > tai2 ) {\n      *ut11 = tai1;\n      *ut12 = tai2 + dtad;\n   } else {\n      *ut11 = tai1 + dtad;\n      *ut12 = tai2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13263,"name":"num00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNum00a(double date1, double date2, double rmatn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a N u m 0 0 a\n**  - - - - - - - - - -\n**\n**  Form the matrix of nutation for a given date, IAU 2000A model.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rmatn        double[3][3]    nutation matrix\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where\n**     the p-vector V(true) is with respect to the true equatorial triad\n**     of date and the p-vector V(mean) is with respect to the mean\n**     equatorial triad of date.\n**\n**  3) A faster, but slightly less accurate result (about 1 mas), can be\n**     obtained by using instead the eraNum00b function.\n**\n**  Called:\n**     eraPn00a     bias/precession/nutation, IAU 2000A\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.222-3 (p114).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rbpn[3][3];\n\n\n/* Obtain the required matrix (discarding other results). */\n   eraPn00a(date1, date2,\n            &dpsi, &deps, &epsa, rb, rp, rbp, rmatn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13264,"name":"hfk5z.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraHfk5z(double rh, double dh, double date1, double date2,\n              double *r5, double *d5, double *dr5, double *dd5)\n/*\n**  - - - - - - - - -\n**   e r a H f k 5 z\n**  - - - - - - - - -\n**\n**  Transform a Hipparcos star position into FK5 J2000.0, assuming\n**  zero Hipparcos proper motion.\n**\n**  Given:\n**     rh            double    Hipparcos RA (radians)\n**     dh            double    Hipparcos Dec (radians)\n**     date1,date2   double    TDB date (Note 1)\n**\n**  Returned (all FK5, equinox J2000.0, date date1+date2):\n**     r5            double    RA (radians)\n**     d5            double    Dec (radians)\n**     dr5           double    FK5 RA proper motion (rad/year, Note 4)\n**     dd5           double    Dec proper motion (rad/year, Note 4)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  3) The FK5 to Hipparcos transformation is modeled as a pure rotation\n**     and spin;  zonal errors in the FK5 catalogue are not taken into\n**     account.\n**\n**  4) It was the intention that Hipparcos should be a close\n**     approximation to an inertial frame, so that distant objects have\n**     zero proper motion;  such objects have (in general) non-zero\n**     proper motion in FK5, and this function returns those fictitious\n**     proper motions.\n**\n**  5) The position returned by this function is in the FK5 J2000.0\n**     reference system but at date date1+date2.\n**\n**  6) See also eraFk52h, eraH2fk5, eraFk5zhz.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraFk5hip    FK5 to Hipparcos rotation and spin\n**     eraRxp       product of r-matrix and p-vector\n**     eraSxp       multiply p-vector by scalar\n**     eraRxr       product of two r-matrices\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraPxp       vector product of two p-vectors\n**     eraPv2s      pv-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Reference:\n**\n**     F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, ph[3], r5h[3][3], s5h[3], sh[3], vst[3],\n   rst[3][3], r5ht[3][3], pv5e[2][3], vv[3],\n   w, r, v;\n\n\n/* Time interval from fundamental epoch J2000.0 to given date (JY). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY;\n\n/* Hipparcos barycentric position vector (normalized). */\n   eraS2c(rh, dh, ph);\n\n/* FK5 to Hipparcos orientation matrix and spin vector. */\n   eraFk5hip(r5h, s5h);\n\n/* Rotate the spin into the Hipparcos system. */\n   eraRxp(r5h, s5h, sh);\n\n/* Accumulated Hipparcos wrt FK5 spin over that interval. */\n   eraSxp(t, s5h, vst);\n\n/* Express the accumulated spin as a rotation matrix. */\n   eraRv2m(vst, rst);\n\n/* Rotation matrix:  accumulated spin, then FK5 to Hipparcos. */\n   eraRxr(r5h, rst, r5ht);\n\n/* De-orient & de-spin the Hipparcos position into FK5 J2000.0. */\n   eraTrxp(r5ht, ph, pv5e[0]);\n\n/* Apply spin to the position giving a space motion. */\n   eraPxp(sh, ph, vv);\n\n/* De-orient & de-spin the Hipparcos space motion into FK5 J2000.0. */\n   eraTrxp(r5ht, vv, pv5e[1]);\n\n/* FK5 position/velocity pv-vector to spherical. */\n   eraPv2s(pv5e, &w, d5, &r, dr5, dd5, &v);\n   *r5 = eraAnp(w);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13265,"name":"bp06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraBp06(double date1, double date2,\n             double rb[3][3], double rp[3][3], double rbp[3][3])\n/*\n**  - - - - - - - -\n**   e r a B p 0 6\n**  - - - - - - - -\n**\n**  Frame bias and precession, IAU 2006.\n**\n**  Given:\n**     date1,date2  double         TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rb           double[3][3]   frame bias matrix (Note 2)\n**     rp           double[3][3]   precession matrix (Note 3)\n**     rbp          double[3][3]   bias-precession matrix (Note 4)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**             date1         date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rb transforms vectors from GCRS to mean J2000.0 by\n**     applying frame bias.\n**\n**  3) The matrix rp transforms vectors from mean J2000.0 to mean of\n**     date by applying precession.\n**\n**  4) The matrix rbp transforms vectors from GCRS to mean of date by\n**     applying frame bias then precession.  It is the product rp x rb.\n**\n**  5) It is permissible to re-use the same array in the returned\n**     arguments.  The arrays are filled in the order given.\n**\n**  Called:\n**     eraPfw06     bias-precession F-W angles, IAU 2006\n**     eraFw2m      F-W angles to r-matrix\n**     eraPmat06    PB matrix, IAU 2006\n**     eraTr        transpose r-matrix\n**     eraRxr       product of two r-matrices\n**     eraCr        copy r-matrix\n**\n**  References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gamb, phib, psib, epsa, rbpw[3][3], rbt[3][3];\n\n\n/* B matrix. */\n   eraPfw06(ERFA_DJM0, ERFA_DJM00, &gamb, &phib, &psib, &epsa);\n   eraFw2m(gamb, phib, psib, epsa, rb);\n\n/* PxB matrix (temporary). */\n   eraPmat06(date1, date2, rbpw);\n\n/* P matrix. */\n   eraTr(rb, rbt);\n   eraRxr(rbpw, rbt, rp);\n\n/* PxB matrix. */\n   eraCr(rbpw, rbp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13266,"name":"erfa.h","nodeType":"TextFile","path":"cextern/erfa","text":"#ifndef ERFAHDEF\n#define ERFAHDEF\n\n/*\n**  - - - - - - -\n**   e r f a . h\n**  - - - - - - -\n**\n**  Prototype function declarations for ERFA library.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n\n#include \"erfam.h\"\n#include \"math.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Astronomy/Calendars */\nint eraCal2jd(int iy, int im, int id, double *djm0, double *djm);\ndouble eraEpb(double dj1, double dj2);\nvoid eraEpb2jd(double epb, double *djm0, double *djm);\ndouble eraEpj(double dj1, double dj2);\nvoid eraEpj2jd(double epj, double *djm0, double *djm);\nint eraJd2cal(double dj1, double dj2,\n                     int *iy, int *im, int *id, double *fd);\nint eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4]);\n\n/* Astronomy/Astrometry */\nvoid eraAb(double pnat[3], double v[3], double s, double bm1,\n           double ppr[3]);\nvoid eraApcg(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             eraASTROM *astrom);\nvoid eraApcg13(double date1, double date2, eraASTROM *astrom);\nvoid eraApci(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             double x, double y, double s,\n             eraASTROM *astrom);\nvoid eraApci13(double date1, double date2,\n               eraASTROM *astrom, double *eo);\nvoid eraApco(double date1, double date2,\n             double ebpv[2][3], double ehp[3],\n             double x, double y, double s, double theta,\n             double elong, double phi, double hm,\n             double xp, double yp, double sp,\n             double refa, double refb,\n             eraASTROM *astrom);\nint eraApco13(double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              eraASTROM *astrom, double *eo);\nvoid eraApcs(double date1, double date2, double pv[2][3],\n             double ebpv[2][3], double ehp[3],\n             eraASTROM *astrom);\nvoid eraApcs13(double date1, double date2, double pv[2][3],\n               eraASTROM *astrom);\nvoid eraAper(double theta, eraASTROM *astrom);\nvoid eraAper13(double ut11, double ut12, eraASTROM *astrom);\nvoid eraApio(double sp, double theta,\n             double elong, double phi, double hm, double xp, double yp,\n             double refa, double refb,\n             eraASTROM *astrom);\nint eraApio13(double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              eraASTROM *astrom);\nvoid eraAtci13(double rc, double dc,\n               double pr, double pd, double px, double rv,\n               double date1, double date2,\n               double *ri, double *di, double *eo);\nvoid eraAtciq(double rc, double dc, double pr, double pd,\n              double px, double rv, eraASTROM *astrom,\n              double *ri, double *di);\nvoid eraAtciqn(double rc, double dc, double pr, double pd,\n               double px, double rv, eraASTROM *astrom,\n               int n, eraLDBODY b[], double *ri, double *di);\nvoid eraAtciqz(double rc, double dc, eraASTROM *astrom,\n               double *ri, double *di);\nint eraAtco13(double rc, double dc,\n              double pr, double pd, double px, double rv,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *aob, double *zob, double *hob,\n              double *dob, double *rob, double *eo);\nvoid eraAtic13(double ri, double di,\n               double date1, double date2,\n               double *rc, double *dc, double *eo);\nvoid eraAticq(double ri, double di, eraASTROM *astrom,\n              double *rc, double *dc);\nvoid eraAticqn(double ri, double di, eraASTROM *astrom,\n               int n, eraLDBODY b[], double *rc, double *dc);\nint eraAtio13(double ri, double di,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *aob, double *zob, double *hob,\n              double *dob, double *rob);\nvoid eraAtioq(double ri, double di, eraASTROM *astrom,\n              double *aob, double *zob,\n              double *hob, double *dob, double *rob);\nint eraAtoc13(const char *type, double ob1, double ob2,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *rc, double *dc);\nint eraAtoi13(const char *type, double ob1, double ob2,\n              double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              double *ri, double *di);\nvoid eraAtoiq(const char *type,\n              double ob1, double ob2, eraASTROM *astrom,\n              double *ri, double *di);\nvoid eraLd(double bm, double p[3], double q[3], double e[3],\n           double em, double dlim, double p1[3]);\nvoid eraLdn(int n, eraLDBODY b[], double ob[3], double sc[3],\n            double sn[3]);\nvoid eraLdsun(double p[3], double e[3], double em, double p1[3]);\nvoid eraPmpx(double rc, double dc, double pr, double pd,\n             double px, double rv, double pmt, double pob[3],\n             double pco[3]);\nint eraPmsafe(double ra1, double dec1, double pmr1, double pmd1,\n              double px1, double rv1,\n              double ep1a, double ep1b, double ep2a, double ep2b,\n              double *ra2, double *dec2, double *pmr2, double *pmd2,\n              double *px2, double *rv2);\nvoid eraPvtob(double elong, double phi, double height, double xp,\n              double yp, double sp, double theta, double pv[2][3]);\nvoid eraRefco(double phpa, double tc, double rh, double wl,\n              double *refa, double *refb);\n\n/* Astronomy/Ephemerides */\nint eraEpv00(double date1, double date2,\n             double pvh[2][3], double pvb[2][3]);\nint eraPlan94(double date1, double date2, int np, double pv[2][3]);\n\n/* Astronomy/FundamentalArgs */\ndouble eraFad03(double t);\ndouble eraFae03(double t);\ndouble eraFaf03(double t);\ndouble eraFaju03(double t);\ndouble eraFal03(double t);\ndouble eraFalp03(double t);\ndouble eraFama03(double t);\ndouble eraFame03(double t);\ndouble eraFane03(double t);\ndouble eraFaom03(double t);\ndouble eraFapa03(double t);\ndouble eraFasa03(double t);\ndouble eraFaur03(double t);\ndouble eraFave03(double t);\n\n/* Astronomy/PrecNutPolar */\nvoid eraBi00(double *dpsibi, double *depsbi, double *dra);\nvoid eraBp00(double date1, double date2,\n             double rb[3][3], double rp[3][3], double rbp[3][3]);\nvoid eraBp06(double date1, double date2,\n             double rb[3][3], double rp[3][3], double rbp[3][3]);\nvoid eraBpn2xy(double rbpn[3][3], double *x, double *y);\nvoid eraC2i00a(double date1, double date2, double rc2i[3][3]);\nvoid eraC2i00b(double date1, double date2, double rc2i[3][3]);\nvoid eraC2i06a(double date1, double date2, double rc2i[3][3]);\nvoid eraC2ibpn(double date1, double date2, double rbpn[3][3],\n               double rc2i[3][3]);\nvoid eraC2ixy(double date1, double date2, double x, double y,\n              double rc2i[3][3]);\nvoid eraC2ixys(double x, double y, double s, double rc2i[3][3]);\nvoid eraC2t00a(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3]);\nvoid eraC2t00b(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3]);\nvoid eraC2t06a(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3]);\nvoid eraC2tcio(double rc2i[3][3], double era, double rpom[3][3],\n               double rc2t[3][3]);\nvoid eraC2teqx(double rbpn[3][3], double gst, double rpom[3][3],\n               double rc2t[3][3]);\nvoid eraC2tpe(double tta, double ttb, double uta, double utb,\n              double dpsi, double deps, double xp, double yp,\n              double rc2t[3][3]);\nvoid eraC2txy(double tta, double ttb, double uta, double utb,\n              double x, double y, double xp, double yp,\n              double rc2t[3][3]);\ndouble eraEo06a(double date1, double date2);\ndouble eraEors(double rnpb[3][3], double s);\nvoid eraFw2m(double gamb, double phib, double psi, double eps,\n             double r[3][3]);\nvoid eraFw2xy(double gamb, double phib, double psi, double eps,\n              double *x, double *y);\nvoid eraLtp(double epj, double rp[3][3]);\nvoid eraLtpb(double epj, double rpb[3][3]);\nvoid eraLtpecl(double epj, double vec[3]);\nvoid eraLtpequ(double epj, double veq[3]);\nvoid eraNum00a(double date1, double date2, double rmatn[3][3]);\nvoid eraNum00b(double date1, double date2, double rmatn[3][3]);\nvoid eraNum06a(double date1, double date2, double rmatn[3][3]);\nvoid eraNumat(double epsa, double dpsi, double deps, double rmatn[3][3]);\nvoid eraNut00a(double date1, double date2, double *dpsi, double *deps);\nvoid eraNut00b(double date1, double date2, double *dpsi, double *deps);\nvoid eraNut06a(double date1, double date2, double *dpsi, double *deps);\nvoid eraNut80(double date1, double date2, double *dpsi, double *deps);\nvoid eraNutm80(double date1, double date2, double rmatn[3][3]);\ndouble eraObl06(double date1, double date2);\ndouble eraObl80(double date1, double date2);\nvoid eraP06e(double date1, double date2,\n             double *eps0, double *psia, double *oma, double *bpa,\n             double *bqa, double *pia, double *bpia,\n             double *epsa, double *chia, double *za, double *zetaa,\n             double *thetaa, double *pa,\n             double *gam, double *phi, double *psi);\nvoid eraPb06(double date1, double date2,\n             double *bzeta, double *bz, double *btheta);\nvoid eraPfw06(double date1, double date2,\n              double *gamb, double *phib, double *psib, double *epsa);\nvoid eraPmat00(double date1, double date2, double rbp[3][3]);\nvoid eraPmat06(double date1, double date2, double rbp[3][3]);\nvoid eraPmat76(double date1, double date2, double rmatp[3][3]);\nvoid eraPn00(double date1, double date2, double dpsi, double deps,\n             double *epsa,\n             double rb[3][3], double rp[3][3], double rbp[3][3],\n             double rn[3][3], double rbpn[3][3]);\nvoid eraPn00a(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3]);\nvoid eraPn00b(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3]);\nvoid eraPn06(double date1, double date2, double dpsi, double deps,\n             double *epsa,\n             double rb[3][3], double rp[3][3], double rbp[3][3],\n             double rn[3][3], double rbpn[3][3]);\nvoid eraPn06a(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3]);\nvoid eraPnm00a(double date1, double date2, double rbpn[3][3]);\nvoid eraPnm00b(double date1, double date2, double rbpn[3][3]);\nvoid eraPnm06a(double date1, double date2, double rnpb[3][3]);\nvoid eraPnm80(double date1, double date2, double rmatpn[3][3]);\nvoid eraPom00(double xp, double yp, double sp, double rpom[3][3]);\nvoid eraPr00(double date1, double date2,\n             double *dpsipr, double *depspr);\nvoid eraPrec76(double date01, double date02,\n               double date11, double date12,\n               double *zeta, double *z, double *theta);\ndouble eraS00(double date1, double date2, double x, double y);\ndouble eraS00a(double date1, double date2);\ndouble eraS00b(double date1, double date2);\ndouble eraS06(double date1, double date2, double x, double y);\ndouble eraS06a(double date1, double date2);\ndouble eraSp00(double date1, double date2);\nvoid eraXy06(double date1, double date2, double *x, double *y);\nvoid eraXys00a(double date1, double date2,\n               double *x, double *y, double *s);\nvoid eraXys00b(double date1, double date2,\n               double *x, double *y, double *s);\nvoid eraXys06a(double date1, double date2,\n               double *x, double *y, double *s);\n\n/* Astronomy/RotationAndTime */\ndouble eraEe00(double date1, double date2, double epsa, double dpsi);\ndouble eraEe00a(double date1, double date2);\ndouble eraEe00b(double date1, double date2);\ndouble eraEe06a(double date1, double date2);\ndouble eraEect00(double date1, double date2);\ndouble eraEqeq94(double date1, double date2);\ndouble eraEra00(double dj1, double dj2);\ndouble eraGmst00(double uta, double utb, double tta, double ttb);\ndouble eraGmst06(double uta, double utb, double tta, double ttb);\ndouble eraGmst82(double dj1, double dj2);\ndouble eraGst00a(double uta, double utb, double tta, double ttb);\ndouble eraGst00b(double uta, double utb);\ndouble eraGst06(double uta, double utb, double tta, double ttb,\n                double rnpb[3][3]);\ndouble eraGst06a(double uta, double utb, double tta, double ttb);\ndouble eraGst94(double uta, double utb);\n\n/* Astronomy/SpaceMotion */\nint eraPvstar(double pv[2][3], double *ra, double *dec,\n              double *pmr, double *pmd, double *px, double *rv);\nint eraStarpv(double ra, double dec,\n              double pmr, double pmd, double px, double rv,\n              double pv[2][3]);\n\n/* Astronomy/StarCatalogs */\nvoid eraFk52h(double r5, double d5,\n              double dr5, double dd5, double px5, double rv5,\n              double *rh, double *dh,\n              double *drh, double *ddh, double *pxh, double *rvh);\nvoid eraFk5hip(double r5h[3][3], double s5h[3]);\nvoid eraFk5hz(double r5, double d5, double date1, double date2,\n              double *rh, double *dh);\nvoid eraH2fk5(double rh, double dh,\n              double drh, double ddh, double pxh, double rvh,\n              double *r5, double *d5,\n              double *dr5, double *dd5, double *px5, double *rv5);\nvoid eraHfk5z(double rh, double dh, double date1, double date2,\n              double *r5, double *d5, double *dr5, double *dd5);\nint eraStarpm(double ra1, double dec1,\n              double pmr1, double pmd1, double px1, double rv1,\n              double ep1a, double ep1b, double ep2a, double ep2b,\n              double *ra2, double *dec2,\n              double *pmr2, double *pmd2, double *px2, double *rv2);\n\n/* Astronomy/EclipticCoordinates */\nvoid eraEceq06(double date1, double date2, double dl, double db,\n               double *dr, double *dd);\nvoid eraEcm06(double date1, double date2, double rm[3][3]);\nvoid eraEqec06(double date1, double date2, double dr, double dd,\n               double *dl, double *db);\nvoid eraLteceq(double epj, double dl, double db, double *dr, double *dd);\nvoid eraLtecm(double epj, double rm[3][3]);\nvoid eraLteqec(double epj, double dr, double dd, double *dl, double *db);\n\n/* Astronomy/GalacticCoordinates */\nvoid eraG2icrs(double dl, double db, double *dr, double *dd);\nvoid eraIcrs2g(double dr, double dd, double *dl, double *db);\n\n/* Astronomy/GeodeticGeocentric */\nint eraEform(int n, double *a, double *f);\nint eraGc2gd(int n, double xyz[3],\n             double *elong, double *phi, double *height);\nint eraGc2gde(double a, double f, double xyz[3],\n              double *elong, double *phi, double *height);\nint eraGd2gc(int n, double elong, double phi, double height,\n             double xyz[3]);\nint eraGd2gce(double a, double f,\n              double elong, double phi, double height, double xyz[3]);\n\n/* Astronomy/Timescales */\nint eraD2dtf(const char *scale, int ndp, double d1, double d2,\n             int *iy, int *im, int *id, int ihmsf[4]);\nint eraDat(int iy, int im, int id, double fd, double *deltat);\ndouble eraDtdb(double date1, double date2,\n               double ut, double elong, double u, double v);\nint eraDtf2d(const char *scale, int iy, int im, int id,\n             int ihr, int imn, double sec, double *d1, double *d2);\nint eraTaitt(double tai1, double tai2, double *tt1, double *tt2);\nint eraTaiut1(double tai1, double tai2, double dta,\n              double *ut11, double *ut12);\nint eraTaiutc(double tai1, double tai2, double *utc1, double *utc2);\nint eraTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2);\nint eraTcgtt(double tcg1, double tcg2, double *tt1, double *tt2);\nint eraTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2);\nint eraTdbtt(double tdb1, double tdb2, double dtr,\n             double *tt1, double *tt2);\nint eraTttai(double tt1, double tt2, double *tai1, double *tai2);\nint eraTttcg(double tt1, double tt2, double *tcg1, double *tcg2);\nint eraTttdb(double tt1, double tt2, double dtr,\n             double *tdb1, double *tdb2);\nint eraTtut1(double tt1, double tt2, double dt,\n             double *ut11, double *ut12);\nint eraUt1tai(double ut11, double ut12, double dta,\n              double *tai1, double *tai2);\nint eraUt1tt(double ut11, double ut12, double dt,\n             double *tt1, double *tt2);\nint eraUt1utc(double ut11, double ut12, double dut1,\n              double *utc1, double *utc2);\nint eraUtctai(double utc1, double utc2, double *tai1, double *tai2);\nint eraUtcut1(double utc1, double utc2, double dut1,\n              double *ut11, double *ut12);\n\n/* VectorMatrix/AngleOps */\nvoid eraA2af(int ndp, double angle, char *sign, int idmsf[4]);\nvoid eraA2tf(int ndp, double angle, char *sign, int ihmsf[4]);\nint eraAf2a(char s, int ideg, int iamin, double asec, double *rad);\ndouble eraAnp(double a);\ndouble eraAnpm(double a);\nvoid eraD2tf(int ndp, double days, char *sign, int ihmsf[4]);\nint eraTf2a(char s, int ihour, int imin, double sec, double *rad);\nint eraTf2d(char s, int ihour, int imin, double sec, double *days);\n\n/* VectorMatrix/BuildRotations */\nvoid eraRx(double phi, double r[3][3]);\nvoid eraRy(double theta, double r[3][3]);\nvoid eraRz(double psi, double r[3][3]);\n\n/* VectorMatrix/CopyExtendExtract */\nvoid eraCp(double p[3], double c[3]);\nvoid eraCpv(double pv[2][3], double c[2][3]);\nvoid eraCr(double r[3][3], double c[3][3]);\nvoid eraP2pv(double p[3], double pv[2][3]);\nvoid eraPv2p(double pv[2][3], double p[3]);\n\n/* VectorMatrix/Initialization */\nvoid eraIr(double r[3][3]);\nvoid eraZp(double p[3]);\nvoid eraZpv(double pv[2][3]);\nvoid eraZr(double r[3][3]);\n\n/* VectorMatrix/MatrixOps */\nvoid eraRxr(double a[3][3], double b[3][3], double atb[3][3]);\nvoid eraTr(double r[3][3], double rt[3][3]);\n\n/* VectorMatrix/MatrixVectorProducts */\nvoid eraRxp(double r[3][3], double p[3], double rp[3]);\nvoid eraRxpv(double r[3][3], double pv[2][3], double rpv[2][3]);\nvoid eraTrxp(double r[3][3], double p[3], double trp[3]);\nvoid eraTrxpv(double r[3][3], double pv[2][3], double trpv[2][3]);\n\n/* VectorMatrix/RotationVectors */\nvoid eraRm2v(double r[3][3], double w[3]);\nvoid eraRv2m(double w[3], double r[3][3]);\n\n/* VectorMatrix/SeparationAndAngle */\ndouble eraPap(double a[3], double b[3]);\ndouble eraPas(double al, double ap, double bl, double bp);\ndouble eraSepp(double a[3], double b[3]);\ndouble eraSeps(double al, double ap, double bl, double bp);\n\n/* VectorMatrix/SphericalCartesian */\nvoid eraC2s(double p[3], double *theta, double *phi);\nvoid eraP2s(double p[3], double *theta, double *phi, double *r);\nvoid eraPv2s(double pv[2][3],\n             double *theta, double *phi, double *r,\n             double *td, double *pd, double *rd);\nvoid eraS2c(double theta, double phi, double c[3]);\nvoid eraS2p(double theta, double phi, double r, double p[3]);\nvoid eraS2pv(double theta, double phi, double r,\n             double td, double pd, double rd,\n             double pv[2][3]);\n\n/* VectorMatrix/VectorOps */\ndouble eraPdp(double a[3], double b[3]);\ndouble eraPm(double p[3]);\nvoid eraPmp(double a[3], double b[3], double amb[3]);\nvoid eraPn(double p[3], double *r, double u[3]);\nvoid eraPpp(double a[3], double b[3], double apb[3]);\nvoid eraPpsp(double a[3], double s, double b[3], double apsb[3]);\nvoid eraPvdpv(double a[2][3], double b[2][3], double adb[2]);\nvoid eraPvm(double pv[2][3], double *r, double *s);\nvoid eraPvmpv(double a[2][3], double b[2][3], double amb[2][3]);\nvoid eraPvppv(double a[2][3], double b[2][3], double apb[2][3]);\nvoid eraPvu(double dt, double pv[2][3], double upv[2][3]);\nvoid eraPvup(double dt, double pv[2][3], double p[3]);\nvoid eraPvxpv(double a[2][3], double b[2][3], double axb[2][3]);\nvoid eraPxp(double a[3], double b[3], double axb[3]);\nvoid eraS2xpv(double s1, double s2, double pv[2][3], double spv[2][3]);\nvoid eraSxp(double s, double p[3], double sp[3]);\nvoid eraSxpv(double s, double pv[2][3], double spv[2][3]);\n\n#ifdef __cplusplus\n}\n#endif\n\n\n#include \"erfaextra.h\"\n\n#endif\n\n\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13267,"name":"c2txy.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2txy(double tta, double ttb, double uta, double utb,\n              double x, double y, double xp, double yp,\n              double rc2t[3][3])\n/*\n**  - - - - - - - - -\n**   e r a C 2 t x y\n**  - - - - - - - - -\n**\n**  Form the celestial to terrestrial matrix given the date, the UT1,\n**  the CIP coordinates and the polar motion.  IAU 2000.\n**\n**  Given:\n**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)\n**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)\n**     x,y      double         Celestial Intermediate Pole (Note 2)\n**     xp,yp    double         coordinates of the pole (radians, Note 3)\n**\n**  Returned:\n**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 4)\n**\n**  Notes:\n**\n**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,\n**     apportioned in any convenient way between the arguments uta and\n**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any o\n**     these ways, among others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  In the case of uta,utb, the\n**     date & time method is best matched to the Earth rotation angle\n**     algorithm used:  maximum precision is delivered when the uta\n**     argument is for 0hrs UT1 on the day in question and the utb\n**     argument lies in the range 0 to 1, or vice versa.\n**\n**  2) The Celestial Intermediate Pole coordinates are the x,y\n**     components of the unit vector in the Geocentric Celestial\n**     Reference System.\n**\n**  3) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  4) The matrix rc2t transforms from celestial to terrestrial\n**     coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  5) Although its name does not include \"00\", This function is in fact\n**     specific to the IAU 2000 models.\n**\n**  Called:\n**     eraC2ixy     celestial-to-intermediate matrix, given X,Y\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraPom00     polar motion matrix\n**     eraC2tcio    form CIO-based celestial-to-terrestrial matrix\n**\n** Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rc2i[3][3], era, sp, rpom[3][3];\n\n\n/* Form the celestial-to-intermediate matrix for this TT. */\n   eraC2ixy(tta, ttb, x, y, rc2i);\n\n/* Predict the Earth rotation angle for this UT1. */\n   era = eraEra00(uta, utb);\n\n/* Estimate s'. */\n   sp = eraSp00(tta, ttb);\n\n/* Form the polar motion matrix. */\n   eraPom00(xp, yp, sp, rpom);\n\n/* Combine to form the celestial-to-terrestrial matrix. */\n   eraC2tcio(rc2i, era, rpom, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13268,"name":"xy06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraXy06(double date1, double date2, double *x, double *y)\n/*\n**  - - - - - - - -\n**   e r a X y 0 6\n**  - - - - - - - -\n**\n**  X,Y coordinates of celestial intermediate pole from series based\n**  on IAU 2006 precession and IAU 2000A nutation.\n**\n**  Given:\n**     date1,date2  double     TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     x,y          double     CIP X,Y coordinates (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The X,Y coordinates are those of the unit vector towards the\n**     celestial intermediate pole.  They represent the combined effects\n**     of frame bias, precession and nutation.\n**\n**  3) The fundamental arguments used are as adopted in IERS Conventions\n**     (2003) and are from Simon et al. (1994) and Souchay et al.\n**     (1999).\n**\n**  4) This is an alternative to the angles-based method, via the ERFA\n**     function eraFw2xy and as used in eraXys06a for example.  The two\n**     methods agree at the 1 microarcsecond level (at present), a\n**     negligible amount compared with the intrinsic accuracy of the\n**     models.  However, it would be unwise to mix the two methods\n**     (angles-based and series-based) in a single application.\n**\n**  Called:\n**     eraFal03     mean anomaly of the Moon\n**     eraFalp03    mean anomaly of the Sun\n**     eraFaf03     mean argument of the latitude of the Moon\n**     eraFad03     mean elongation of the Moon from the Sun\n**     eraFaom03    mean longitude of the Moon's ascending node\n**     eraFame03    mean longitude of Mercury\n**     eraFave03    mean longitude of Venus\n**     eraFae03     mean longitude of Earth\n**     eraFama03    mean longitude of Mars\n**     eraFaju03    mean longitude of Jupiter\n**     eraFasa03    mean longitude of Saturn\n**     eraFaur03    mean longitude of Uranus\n**     eraFane03    mean longitude of Neptune\n**     eraFapa03    general accumulated precession in longitude\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. & Chapront, J., 2003,\n**     Astron.Astrophys., 412, 567\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M., 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Maximum power of T in the polynomials for X and Y */\n   enum { MAXPT = 5 };\n\n/* Polynomial coefficients (arcsec, X then Y). */\n   static const double xyp[2][MAXPT+1] = {\n\n      {    -0.016617,\n         2004.191898,\n           -0.4297829,\n           -0.19861834,\n            0.000007578,\n            0.0000059285\n      },\n      {    -0.006951,\n           -0.025896,\n          -22.4072747,\n            0.00190059,\n            0.001112526,\n            0.0000001358\n      }\n   };\n\n/* Fundamental-argument multipliers:  luni-solar terms */\n   static const int mfals[][5] = {\n\n   /* 1-10 */\n      {  0,   0,   0,   0,   1 },\n      {  0,   0,   2,  -2,   2 },\n      {  0,   0,   2,   0,   2 },\n      {  0,   0,   0,   0,   2 },\n      {  0,   1,   0,   0,   0 },\n      {  0,   1,   2,  -2,   2 },\n      {  1,   0,   0,   0,   0 },\n      {  0,   0,   2,   0,   1 },\n      {  1,   0,   2,   0,   2 },\n      {  0,   1,  -2,   2,  -2 },\n\n   /* 11-20 */\n      {  0,   0,   2,  -2,   1 },\n      {  1,   0,  -2,   0,  -2 },\n      {  1,   0,   0,  -2,   0 },\n      {  1,   0,   0,   0,   1 },\n      {  1,   0,   0,   0,  -1 },\n      {  1,   0,  -2,  -2,  -2 },\n      {  1,   0,   2,   0,   1 },\n      {  2,   0,  -2,   0,  -1 },\n      {  0,   0,   0,   2,   0 },\n      {  0,   0,   2,   2,   2 },\n\n   /* 21-30 */\n      {  2,   0,   0,  -2,   0 },\n      {  0,   2,  -2,   2,  -2 },\n      {  2,   0,   2,   0,   2 },\n      {  1,   0,   2,  -2,   2 },\n      {  1,   0,  -2,   0,  -1 },\n      {  2,   0,   0,   0,   0 },\n      {  0,   0,   2,   0,   0 },\n      {  0,   1,   0,   0,   1 },\n      {  1,   0,   0,  -2,  -1 },\n      {  0,   2,   2,  -2,   2 },\n\n   /* 31-40 */\n      {  0,   0,   2,  -2,   0 },\n      {  1,   0,   0,  -2,   1 },\n      {  0,   1,   0,   0,  -1 },\n      {  0,   2,   0,   0,   0 },\n      {  1,   0,  -2,  -2,  -1 },\n      {  1,   0,   2,   2,   2 },\n      {  0,   1,   2,   0,   2 },\n      {  2,   0,  -2,   0,   0 },\n      {  0,   0,   2,   2,   1 },\n      {  0,   1,  -2,   0,  -2 },\n\n   /* 41-50 */\n      {  0,   0,   0,   2,   1 },\n      {  1,   0,   2,  -2,   1 },\n      {  2,   0,   0,  -2,  -1 },\n      {  2,   0,   2,  -2,   2 },\n      {  2,   0,   2,   0,   1 },\n      {  0,   0,   0,   2,  -1 },\n      {  0,   1,  -2,   2,  -1 },\n      {  1,   1,   0,  -2,   0 },\n      {  2,   0,   0,  -2,   1 },\n      {  1,   0,   0,   2,   0 },\n\n   /* 51-60 */\n      {  0,   1,   2,  -2,   1 },\n      {  1,  -1,   0,   0,   0 },\n      {  0,   1,  -1,   1,  -1 },\n      {  2,   0,  -2,   0,  -2 },\n      {  0,   1,   0,  -2,   0 },\n      {  1,   0,   0,  -1,   0 },\n      {  3,   0,   2,   0,   2 },\n      {  0,   0,   0,   1,   0 },\n      {  1,  -1,   2,   0,   2 },\n      {  1,   1,  -2,  -2,  -2 },\n\n   /* 61-70 */\n      {  1,   0,  -2,   0,   0 },\n      {  2,   0,   0,   0,  -1 },\n      {  0,   1,  -2,  -2,  -2 },\n      {  1,   1,   2,   0,   2 },\n      {  2,   0,   0,   0,   1 },\n      {  1,   1,   0,   0,   0 },\n      {  1,   0,  -2,   2,  -1 },\n      {  1,   0,   2,   0,   0 },\n      {  1,  -1,   0,  -1,   0 },\n      {  1,   0,   0,   0,   2 },\n\n   /* 71-80 */\n      {  1,   0,  -1,   0,  -1 },\n      {  0,   0,   2,   1,   2 },\n      {  1,   0,  -2,  -4,  -2 },\n      {  1,  -1,   0,  -1,  -1 },\n      {  1,   0,   2,   2,   1 },\n      {  0,   2,  -2,   2,  -1 },\n      {  1,   0,   0,   0,  -2 },\n      {  2,   0,  -2,  -2,  -2 },\n      {  1,   1,   2,  -2,   2 },\n      {  2,   0,  -2,  -4,  -2 },\n\n   /* 81-90 */\n      {  1,   0,  -4,   0,  -2 },\n      {  2,   0,   2,  -2,   1 },\n      {  1,   0,   0,  -1,  -1 },\n      {  2,   0,   2,   2,   2 },\n      {  3,   0,   0,   0,   0 },\n      {  1,   0,   0,   2,   1 },\n      {  0,   0,   2,  -2,  -1 },\n      {  3,   0,   2,  -2,   2 },\n      {  0,   0,   4,  -2,   2 },\n      {  1,   0,   0,  -4,   0 },\n\n   /* 91-100 */\n      {  0,   1,   2,   0,   1 },\n      {  2,   0,   0,  -4,   0 },\n      {  1,   1,   0,  -2,  -1 },\n      {  2,   0,  -2,   0,   1 },\n      {  0,   0,   2,   0,  -1 },\n      {  0,   1,  -2,   0,  -1 },\n      {  0,   1,   0,   0,   2 },\n      {  0,   0,   2,  -1,   2 },\n      {  0,   0,   2,   4,   2 },\n      {  2,   1,   0,  -2,   0 },\n\n   /* 101-110 */\n      {  1,   1,   0,  -2,   1 },\n      {  1,  -1,   0,  -2,   0 },\n      {  1,  -1,   0,  -1,  -2 },\n      {  1,  -1,   0,   0,   1 },\n      {  0,   1,  -2,   2,   0 },\n      {  0,   1,   0,   0,  -2 },\n      {  1,  -1,   2,   2,   2 },\n      {  1,   0,   0,   2,  -1 },\n      {  1,  -1,  -2,  -2,  -2 },\n      {  3,   0,   2,   0,   1 },\n\n   /* 111-120 */\n      {  0,   1,   2,   2,   2 },\n      {  1,   0,   2,  -2,   0 },\n      {  1,   1,  -2,  -2,  -1 },\n      {  1,   0,   2,  -4,   1 },\n      {  0,   1,  -2,  -2,  -1 },\n      {  2,  -1,   2,   0,   2 },\n      {  0,   0,   0,   2,   2 },\n      {  1,  -1,   2,   0,   1 },\n      {  1,  -1,  -2,   0,  -2 },\n      {  0,   1,   0,   2,   0 },\n\n   /* 121-130 */\n      {  0,   1,   2,  -2,   0 },\n      {  0,   0,   0,   1,   1 },\n      {  1,   0,  -2,  -2,   0 },\n      {  0,   3,   2,  -2,   2 },\n      {  2,   1,   2,   0,   2 },\n      {  1,   1,   0,   0,   1 },\n      {  2,   0,   0,   2,   0 },\n      {  1,   1,   2,   0,   1 },\n      {  1,   0,   0,  -2,  -2 },\n      {  1,   0,  -2,   2,   0 },\n\n   /* 131-140 */\n      {  1,   0,  -1,   0,  -2 },\n      {  0,   1,   0,  -2,   1 },\n      {  0,   1,   0,   1,   0 },\n      {  0,   0,   0,   1,  -1 },\n      {  1,   0,  -2,   2,  -2 },\n      {  1,  -1,   0,   0,  -1 },\n      {  0,   0,   0,   4,   0 },\n      {  1,  -1,   0,   2,   0 },\n      {  1,   0,   2,   1,   2 },\n      {  1,   0,   2,  -1,   2 },\n\n   /* 141-150 */\n      {  0,   0,   2,   1,   1 },\n      {  1,   0,   0,  -2,   2 },\n      {  1,   0,  -2,   0,   1 },\n      {  1,   0,  -2,  -4,  -1 },\n      {  0,   0,   2,   2,   0 },\n      {  1,   1,   2,  -2,   1 },\n      {  1,   0,  -2,   1,  -1 },\n      {  0,   0,   1,   0,   1 },\n      {  2,   0,  -2,  -2,  -1 },\n      {  4,   0,   2,   0,   2 },\n\n   /* 151-160 */\n      {  2,  -1,   0,   0,   0 },\n      {  2,   1,   2,  -2,   2 },\n      {  0,   1,   2,   1,   2 },\n      {  1,   0,   4,  -2,   2 },\n      {  1,   1,   0,   0,  -1 },\n      {  2,   0,   2,   0,   0 },\n      {  2,   0,  -2,  -4,  -1 },\n      {  1,   0,  -1,   0,   0 },\n      {  1,   0,   0,   1,   0 },\n      {  0,   1,   0,   2,   1 },\n\n   /* 161-170 */\n      {  1,   0,  -4,   0,  -1 },\n      {  1,   0,   0,  -4,  -1 },\n      {  2,   0,   2,   2,   1 },\n      {  2,   1,   0,   0,   0 },\n      {  0,   0,   2,  -3,   2 },\n      {  1,   2,   0,  -2,   0 },\n      {  0,   3,   0,   0,   0 },\n      {  0,   0,   4,   0,   2 },\n      {  0,   0,   2,  -4,   1 },\n      {  2,   0,   0,  -2,  -2 },\n\n   /* 171-180 */\n      {  1,   1,  -2,  -4,  -2 },\n      {  0,   1,   0,  -2,  -1 },\n      {  0,   0,   0,   4,   1 },\n      {  3,   0,   2,  -2,   1 },\n      {  1,   0,   2,   4,   2 },\n      {  1,   1,  -2,   0,  -2 },\n      {  0,   0,   4,  -2,   1 },\n      {  2,  -2,   0,  -2,   0 },\n      {  2,   1,   0,  -2,  -1 },\n      {  0,   2,   0,  -2,   0 },\n\n   /* 181-190 */\n      {  1,   0,   0,  -1,   1 },\n      {  1,   1,   2,   2,   2 },\n      {  3,   0,   0,   0,  -1 },\n      {  2,   0,   0,  -4,  -1 },\n      {  3,   0,   2,   2,   2 },\n      {  0,   0,   2,   4,   1 },\n      {  0,   2,  -2,  -2,  -2 },\n      {  1,  -1,   0,  -2,  -1 },\n      {  0,   0,   2,  -1,   1 },\n      {  2,   0,   0,   2,   1 },\n\n   /* 191-200 */\n      {  1,  -1,  -2,   2,  -1 },\n      {  0,   0,   0,   2,  -2 },\n      {  2,   0,   0,  -4,   1 },\n      {  1,   0,   0,  -4,   1 },\n      {  2,   0,   2,  -4,   1 },\n      {  4,   0,   2,  -2,   2 },\n      {  2,   1,  -2,   0,  -1 },\n      {  2,   1,  -2,  -4,  -2 },\n      {  3,   0,   0,  -4,   0 },\n      {  1,  -1,   2,   2,   1 },\n\n   /* 201-210 */\n      {  1,  -1,  -2,   0,  -1 },\n      {  0,   2,   0,   0,   1 },\n      {  1,   2,  -2,  -2,  -2 },\n      {  1,   1,   0,  -4,   0 },\n      {  2,   0,   0,  -2,   2 },\n      {  0,   2,   2,  -2,   1 },\n      {  1,   0,   2,   0,  -1 },\n      {  2,   1,   0,  -2,   1 },\n      {  2,  -1,  -2,   0,  -1 },\n      {  1,  -1,  -2,  -2,  -1 },\n\n   /* 211-220 */\n      {  0,   1,  -2,   1,  -2 },\n      {  1,   0,  -4,   2,  -2 },\n      {  0,   1,   2,   2,   1 },\n      {  3,   0,   0,   0,   1 },\n      {  2,  -1,   2,   2,   2 },\n      {  0,   1,  -2,  -4,  -2 },\n      {  1,   0,  -2,  -3,  -2 },\n      {  2,   0,   0,   0,   2 },\n      {  1,  -1,   0,  -2,  -2 },\n      {  2,   0,  -2,   2,  -1 },\n\n   /* 221-230 */\n      {  0,   2,  -2,   0,  -2 },\n      {  3,   0,  -2,   0,  -1 },\n      {  2,  -1,   2,   0,   1 },\n      {  1,   0,  -2,  -1,  -2 },\n      {  0,   0,   2,   0,   3 },\n      {  2,   0,  -4,   0,  -2 },\n      {  2,   1,   0,  -4,   0 },\n      {  1,   1,  -2,   1,  -1 },\n      {  0,   2,   2,   0,   2 },\n      {  1,  -1,   2,  -2,   2 },\n\n   /* 231-240 */\n      {  1,  -1,   0,  -2,   1 },\n      {  2,   1,   2,   0,   1 },\n      {  1,   0,   2,  -4,   2 },\n      {  1,   1,  -2,   0,  -1 },\n      {  1,   1,   0,   2,   0 },\n      {  1,   0,   0,  -3,   0 },\n      {  2,   0,   2,  -1,   2 },\n      {  0,   2,   0,   0,  -1 },\n      {  2,  -1,   0,  -2,   0 },\n      {  4,   0,   0,   0,   0 },\n\n   /* 241-250 */\n      {  2,   1,  -2,  -2,  -2 },\n      {  0,   2,  -2,   2,   0 },\n      {  1,   0,   2,   1,   1 },\n      {  1,   0,  -1,   0,  -3 },\n      {  3,  -1,   2,   0,   2 },\n      {  2,   0,   2,  -2,   0 },\n      {  1,  -2,   0,   0,   0 },\n      {  2,   0,   0,   0,  -2 },\n      {  1,   0,   0,   4,   0 },\n      {  0,   1,   0,   1,   1 },\n\n   /* 251-260 */\n      {  1,   0,   2,   2,   0 },\n      {  0,   1,   0,   2,  -1 },\n      {  0,   1,   0,   1,  -1 },\n      {  0,   0,   2,  -2,   3 },\n      {  3,   1,   2,   0,   2 },\n      {  1,   1,   2,   1,   2 },\n      {  1,   1,  -2,   2,  -1 },\n      {  2,  -1,   2,  -2,   2 },\n      {  1,  -2,   2,   0,   2 },\n      {  1,   0,   2,  -4,   0 },\n\n   /* 261-270 */\n      {  0,   0,   1,   0,   0 },\n      {  1,   0,   2,  -3,   1 },\n      {  1,  -2,   0,  -2,   0 },\n      {  2,   0,   0,   2,  -1 },\n      {  1,   1,   2,  -4,   1 },\n      {  4,   0,   2,   0,   1 },\n      {  0,   1,   2,   1,   1 },\n      {  1,   2,   2,  -2,   2 },\n      {  2,   0,   2,   1,   2 },\n      {  2,   1,   2,  -2,   1 },\n\n   /* 271-280 */\n      {  1,   0,   2,  -1,   1 },\n      {  1,   0,   4,  -2,   1 },\n      {  1,  -1,   2,  -2,   1 },\n      {  0,   1,   0,  -4,   0 },\n      {  3,   0,  -2,  -2,  -2 },\n      {  0,   0,   4,  -4,   2 },\n      {  2,   0,  -4,  -2,  -2 },\n      {  2,  -2,   0,  -2,  -1 },\n      {  1,   0,   2,  -2,  -1 },\n      {  2,   0,  -2,  -6,  -2 },\n\n   /* 281-290 */\n      {  1,   0,  -2,   1,  -2 },\n      {  1,   0,  -2,   2,   1 },\n      {  1,  -1,   0,   2,  -1 },\n      {  1,   0,  -2,   1,   0 },\n      {  2,  -1,   0,  -2,   1 },\n      {  1,  -1,   0,   2,   1 },\n      {  2,   0,  -2,  -2,   0 },\n      {  1,   0,   2,  -3,   2 },\n      {  0,   0,   0,   4,  -1 },\n      {  2,  -1,   0,   0,   1 },\n\n   /* 291-300 */\n      {  2,   0,   4,  -2,   2 },\n      {  0,   0,   2,   3,   2 },\n      {  0,   1,   4,  -2,   2 },\n      {  0,   1,  -2,   2,   1 },\n      {  1,   1,   0,   2,   1 },\n      {  1,   0,   0,   4,   1 },\n      {  0,   0,   4,   0,   1 },\n      {  2,   0,   0,  -3,   0 },\n      {  1,   0,   0,  -1,  -2 },\n      {  1,  -2,  -2,  -2,  -2 },\n\n   /* 301-310 */\n      {  3,   0,   0,   2,   0 },\n      {  2,   0,   2,  -4,   2 },\n      {  1,   1,  -2,  -4,  -1 },\n      {  1,   0,  -2,  -6,  -2 },\n      {  2,  -1,   0,   0,  -1 },\n      {  2,  -1,   0,   2,   0 },\n      {  0,   1,   2,  -2,  -1 },\n      {  1,   1,   0,   1,   0 },\n      {  1,   2,   0,  -2,  -1 },\n      {  1,   0,   0,   1,  -1 },\n\n   /* 311-320 */\n      {  0,   0,   1,   0,   2 },\n      {  3,   1,   2,  -2,   2 },\n      {  1,   0,  -4,  -2,  -2 },\n      {  1,   0,   2,   4,   1 },\n      {  1,  -2,   2,   2,   2 },\n      {  1,  -1,  -2,  -4,  -2 },\n      {  0,   0,   2,  -4,   2 },\n      {  0,   0,   2,  -3,   1 },\n      {  2,   1,  -2,   0,   0 },\n      {  3,   0,  -2,  -2,  -1 },\n\n   /* 321-330 */\n      {  2,   0,   2,   4,   2 },\n      {  0,   0,   0,   0,   3 },\n      {  2,  -1,  -2,  -2,  -2 },\n      {  2,   0,   0,  -1,   0 },\n      {  3,   0,   2,  -4,   2 },\n      {  2,   1,   2,   2,   2 },\n      {  0,   0,   3,   0,   3 },\n      {  1,   1,   2,   2,   1 },\n      {  2,   1,   0,   0,  -1 },\n      {  1,   2,   0,  -2,   1 },\n\n   /* 331-340 */\n      {  3,   0,   2,   2,   1 },\n      {  1,  -1,  -2,   2,  -2 },\n      {  1,   1,   0,  -1,   0 },\n      {  1,   2,   0,   0,   0 },\n      {  1,   0,   4,   0,   2 },\n      {  1,  -1,   2,   4,   2 },\n      {  2,   1,   0,   0,   1 },\n      {  1,   0,   0,   2,   2 },\n      {  1,  -1,  -2,   2,   0 },\n      {  0,   2,  -2,  -2,  -1 },\n\n   /* 341-350 */\n      {  2,   0,  -2,   0,   2 },\n      {  5,   0,   2,   0,   2 },\n      {  3,   0,  -2,  -6,  -2 },\n      {  1,  -1,   2,  -1,   2 },\n      {  3,   0,   0,  -4,  -1 },\n      {  1,   0,   0,   1,   1 },\n      {  1,   0,  -4,   2,  -1 },\n      {  0,   1,   2,  -4,   1 },\n      {  1,   2,   2,   0,   2 },\n      {  0,   1,   0,  -2,  -2 },\n\n   /* 351-360 */\n      {  0,   0,   2,  -1,   0 },\n      {  1,   0,   1,   0,   1 },\n      {  0,   2,   0,  -2,   1 },\n      {  3,   0,   2,   0,   0 },\n      {  1,   1,  -2,   1,   0 },\n      {  2,   1,  -2,  -4,  -1 },\n      {  3,  -1,   0,   0,   0 },\n      {  2,  -1,  -2,   0,   0 },\n      {  4,   0,   2,  -2,   1 },\n      {  2,   0,  -2,   2,   0 },\n\n   /* 361-370 */\n      {  1,   1,   2,  -2,   0 },\n      {  1,   0,  -2,   4,  -1 },\n      {  1,   0,  -2,  -2,   1 },\n      {  2,   0,   2,  -4,   0 },\n      {  1,   1,   0,  -2,  -2 },\n      {  1,   1,  -2,  -2,   0 },\n      {  1,   0,   1,  -2,   1 },\n      {  2,  -1,  -2,  -4,  -2 },\n      {  3,   0,  -2,   0,  -2 },\n      {  0,   1,  -2,  -2,   0 },\n\n   /* 371-380 */\n      {  3,   0,   0,  -2,  -1 },\n      {  1,   0,  -2,  -3,  -1 },\n      {  0,   1,   0,  -4,  -1 },\n      {  1,  -2,   2,  -2,   1 },\n      {  0,   1,  -2,   1,  -1 },\n      {  1,  -1,   0,   0,   2 },\n      {  2,   0,   0,   1,   0 },\n      {  1,  -2,   0,   2,   0 },\n      {  1,   2,  -2,  -2,  -1 },\n      {  0,   0,   4,  -4,   1 },\n\n   /* 381-390 */\n      {  0,   1,   2,   4,   2 },\n      {  0,   1,  -4,   2,  -2 },\n      {  3,   0,  -2,   0,   0 },\n      {  2,  -1,   2,   2,   1 },\n      {  0,   1,  -2,  -4,  -1 },\n      {  4,   0,   2,   2,   2 },\n      {  2,   0,  -2,  -3,  -2 },\n      {  2,   0,   0,  -6,   0 },\n      {  1,   0,   2,   0,   3 },\n      {  3,   1,   0,   0,   0 },\n\n   /* 391-400 */\n      {  3,   0,   0,  -4,   1 },\n      {  1,  -1,   2,   0,   0 },\n      {  1,  -1,   0,  -4,   0 },\n      {  2,   0,  -2,   2,  -2 },\n      {  1,   1,   0,  -2,   2 },\n      {  4,   0,   0,  -2,   0 },\n      {  2,   2,   0,  -2,   0 },\n      {  0,   1,   2,   0,   0 },\n      {  1,   1,   0,  -4,   1 },\n      {  1,   0,   0,  -4,  -2 },\n\n   /* 401-410 */\n      {  0,   0,   0,   1,   2 },\n      {  3,   0,   0,   2,   1 },\n      {  1,   1,   0,  -4,  -1 },\n      {  0,   0,   2,   2,  -1 },\n      {  1,   1,   2,   0,   0 },\n      {  1,  -1,   2,  -4,   1 },\n      {  1,   1,   0,   0,   2 },\n      {  0,   0,   2,   6,   2 },\n      {  4,   0,  -2,  -2,  -1 },\n      {  2,   1,   0,  -4,  -1 },\n\n   /* 411-420 */\n      {  0,   0,   0,   3,   1 },\n      {  1,  -1,  -2,   0,   0 },\n      {  0,   0,   2,   1,   0 },\n      {  1,   0,   0,   2,  -2 },\n      {  3,  -1,   2,   2,   2 },\n      {  3,  -1,   2,  -2,   2 },\n      {  1,   0,   0,  -1,   2 },\n      {  1,  -2,   2,  -2,   2 },\n      {  0,   1,   0,   2,   2 },\n      {  0,   1,  -2,  -1,  -2 },\n\n   /* 421-430 */\n      {  1,   1,  -2,   0,   0 },\n      {  0,   2,   2,  -2,   0 },\n      {  3,  -1,  -2,  -1,  -2 },\n      {  1,   0,   0,  -6,   0 },\n      {  1,   0,  -2,  -4,   0 },\n      {  2,   1,   0,  -4,   1 },\n      {  2,   0,   2,   0,  -1 },\n      {  2,   0,  -4,   0,  -1 },\n      {  0,   0,   3,   0,   2 },\n      {  2,   1,  -2,  -2,  -1 },\n\n   /* 431-440 */\n      {  1,  -2,   0,   0,   1 },\n      {  2,  -1,   0,  -4,   0 },\n      {  0,   0,   0,   3,   0 },\n      {  5,   0,   2,  -2,   2 },\n      {  1,   2,  -2,  -4,  -2 },\n      {  1,   0,   4,  -4,   2 },\n      {  0,   0,   4,  -1,   2 },\n      {  3,   1,   0,  -4,   0 },\n      {  3,   0,   0,  -6,   0 },\n      {  2,   0,   0,   2,   2 },\n\n   /* 441-450 */\n      {  2,  -2,   2,   0,   2 },\n      {  1,   0,   0,  -3,   1 },\n      {  1,  -2,  -2,   0,  -2 },\n      {  1,  -1,  -2,  -3,  -2 },\n      {  0,   0,   2,  -2,  -2 },\n      {  2,   0,  -2,  -4,   0 },\n      {  1,   0,  -4,   0,   0 },\n      {  0,   1,   0,  -1,   0 },\n      {  4,   0,   0,   0,  -1 },\n      {  3,   0,   2,  -1,   2 },\n\n   /* 451-460 */\n      {  3,  -1,   2,   0,   1 },\n      {  2,   0,   2,  -1,   1 },\n      {  1,   2,   2,  -2,   1 },\n      {  1,   1,   0,   2,  -1 },\n      {  0,   2,   2,   0,   1 },\n      {  3,   1,   2,   0,   1 },\n      {  1,   1,   2,   1,   1 },\n      {  1,   1,   0,  -1,   1 },\n      {  1,  -2,   0,  -2,  -1 },\n      {  4,   0,   0,  -4,   0 },\n\n   /* 461-470 */\n      {  2,   1,   0,   2,   0 },\n      {  1,  -1,   0,   4,   0 },\n      {  0,   1,   0,  -2,   2 },\n      {  0,   0,   2,   0,  -2 },\n      {  1,   0,  -1,   0,   1 },\n      {  3,   0,   2,  -2,   0 },\n      {  2,   0,   2,   2,   0 },\n      {  1,   2,   0,  -4,   0 },\n      {  1,  -1,   0,  -3,   0 },\n      {  0,   1,   0,   4,   0 },\n\n   /* 471 - 480 */\n      {  0,   1,  -2,   0,   0 },\n      {  2,   2,   2,  -2,   2 },\n      {  0,   0,   0,   1,  -2 },\n      {  0,   2,  -2,   0,  -1 },\n      {  4,   0,   2,  -4,   2 },\n      {  2,   0,  -4,   2,  -2 },\n      {  2,  -1,  -2,   0,  -2 },\n      {  1,   1,   4,  -2,   2 },\n      {  1,   1,   2,  -4,   2 },\n      {  1,   0,   2,   3,   2 },\n\n   /* 481-490 */\n      {  1,   0,   0,   4,  -1 },\n      {  0,   0,   0,   4,   2 },\n      {  2,   0,   0,   4,   0 },\n      {  1,   1,  -2,   2,   0 },\n      {  2,   1,   2,   1,   2 },\n      {  2,   1,   2,  -4,   1 },\n      {  2,   0,   2,   1,   1 },\n      {  2,   0,  -4,  -2,  -1 },\n      {  2,   0,  -2,  -6,  -1 },\n      {  2,  -1,   2,  -1,   2 },\n\n   /* 491-500 */\n      {  1,  -2,   2,   0,   1 },\n      {  1,  -2,   0,  -2,   1 },\n      {  1,  -1,   0,  -4,  -1 },\n      {  0,   2,   2,   2,   2 },\n      {  0,   2,  -2,  -4,  -2 },\n      {  0,   1,   2,   3,   2 },\n      {  0,   1,   0,  -4,   1 },\n      {  3,   0,   0,  -2,   1 },\n      {  2,   1,  -2,   0,   1 },\n      {  2,   0,   4,  -2,   1 },\n\n   /* 501-510 */\n      {  2,   0,   0,  -3,  -1 },\n      {  2,  -2,   0,  -2,   1 },\n      {  2,  -1,   2,  -2,   1 },\n      {  1,   0,   0,  -6,  -1 },\n      {  1,  -2,   0,   0,  -1 },\n      {  1,  -2,  -2,  -2,  -1 },\n      {  0,   1,   4,  -2,   1 },\n      {  0,   0,   2,   3,   1 },\n      {  2,  -1,   0,  -1,   0 },\n      {  1,   3,   0,  -2,   0 },\n\n   /* 511-520 */\n      {  0,   3,   0,  -2,   0 },\n      {  2,  -2,   2,  -2,   2 },\n      {  0,   0,   4,  -2,   0 },\n      {  4,  -1,   2,   0,   2 },\n      {  2,   2,  -2,  -4,  -2 },\n      {  4,   1,   2,   0,   2 },\n      {  4,  -1,  -2,  -2,  -2 },\n      {  2,   1,   0,  -2,  -2 },\n      {  2,   1,  -2,  -6,  -2 },\n      {  2,   0,   0,  -1,   1 },\n\n   /* 521-530 */\n      {  2,  -1,  -2,   2,  -1 },\n      {  1,   1,  -2,   2,  -2 },\n      {  1,   1,  -2,  -3,  -2 },\n      {  1,   0,   3,   0,   3 },\n      {  1,   0,  -2,   1,   1 },\n      {  1,   0,  -2,   0,   2 },\n      {  1,  -1,   2,   1,   2 },\n      {  1,  -1,   0,   0,  -2 },\n      {  1,  -1,  -4,   2,  -2 },\n      {  0,   3,  -2,  -2,  -2 },\n\n   /* 531-540 */\n      {  0,   1,   0,   4,   1 },\n      {  0,   0,   4,   2,   2 },\n      {  3,   0,  -2,  -2,   0 },\n      {  2,  -2,   0,   0,   0 },\n      {  1,   1,   2,  -4,   0 },\n      {  1,   1,   0,  -3,   0 },\n      {  1,   0,   2,  -3,   0 },\n      {  1,  -1,   2,  -2,   0 },\n      {  0,   2,   0,   2,   0 },\n      {  0,   0,   2,   4,   0 },\n\n   /* 541-550 */\n      {  1,   0,   1,   0,   0 },\n      {  3,   1,   2,  -2,   1 },\n      {  3,   0,   4,  -2,   2 },\n      {  3,   0,   2,   1,   2 },\n      {  3,   0,   0,   2,  -1 },\n      {  3,   0,   0,   0,   2 },\n      {  3,   0,  -2,   2,  -1 },\n      {  2,   0,   4,  -4,   2 },\n      {  2,   0,   2,  -3,   2 },\n      {  2,   0,   0,   4,   1 },\n\n   /* 551-560 */\n      {  2,   0,   0,  -3,   1 },\n      {  2,   0,  -4,   2,  -1 },\n      {  2,   0,  -2,  -2,   1 },\n      {  2,  -2,   2,   2,   2 },\n      {  2,  -2,   0,  -2,  -2 },\n      {  2,  -1,   0,   2,   1 },\n      {  2,  -1,   0,   2,  -1 },\n      {  1,   1,   2,   4,   2 },\n      {  1,   1,   0,   1,   1 },\n      {  1,   1,   0,   1,  -1 },\n\n   /* 561-570 */\n      {  1,   1,  -2,  -6,  -2 },\n      {  1,   0,   0,  -3,  -1 },\n      {  1,   0,  -4,  -2,  -1 },\n      {  1,   0,  -2,  -6,  -1 },\n      {  1,  -2,   2,   2,   1 },\n      {  1,  -2,  -2,   2,  -1 },\n      {  1,  -1,  -2,  -4,  -1 },\n      {  0,   2,   0,   0,   2 },\n      {  0,   1,   2,  -4,   2 },\n      {  0,   1,  -2,   4,  -1 },\n\n   /* 571-580 */\n      {  5,   0,   0,   0,   0 },\n      {  3,   0,   0,  -3,   0 },\n      {  2,   2,   0,  -4,   0 },\n      {  1,  -1,   2,   2,   0 },\n      {  0,   1,   0,   3,   0 },\n      {  4,   0,  -2,   0,  -1 },\n      {  3,   0,  -2,  -6,  -1 },\n      {  3,   0,  -2,  -1,  -1 },\n      {  2,   1,   2,   2,   1 },\n      {  2,   1,   0,   2,   1 },\n\n   /* 581-590 */\n      {  2,   0,   2,   4,   1 },\n      {  2,   0,   2,  -6,   1 },\n      {  2,   0,   2,  -2,  -1 },\n      {  2,   0,   0,  -6,  -1 },\n      {  2,  -1,  -2,  -2,  -1 },\n      {  1,   2,   2,   0,   1 },\n      {  1,   2,   0,   0,   1 },\n      {  1,   0,   4,   0,   1 },\n      {  1,   0,   2,  -6,   1 },\n      {  1,   0,   2,  -4,  -1 },\n\n   /* 591-600 */\n      {  1,   0,  -1,  -2,  -1 },\n      {  1,  -1,   2,   4,   1 },\n      {  1,  -1,   2,  -3,   1 },\n      {  1,  -1,   0,   4,   1 },\n      {  1,  -1,  -2,   1,  -1 },\n      {  0,   1,   2,  -2,   3 },\n      {  3,   0,   0,  -2,   0 },\n      {  1,   0,   1,  -2,   0 },\n      {  0,   2,   0,  -4,   0 },\n      {  0,   0,   2,  -4,   0 },\n\n   /* 601-610 */\n      {  0,   0,   1,  -1,   0 },\n      {  0,   0,   0,   6,   0 },\n      {  0,   2,   0,   0,  -2 },\n      {  0,   1,  -2,   2,  -3 },\n      {  4,   0,   0,   2,   0 },\n      {  3,   0,   0,  -1,   0 },\n      {  3,  -1,   0,   2,   0 },\n      {  2,   1,   0,   1,   0 },\n      {  2,   1,   0,  -6,   0 },\n      {  2,  -1,   2,   0,   0 },\n\n   /* 611-620 */\n      {  1,   0,   2,  -1,   0 },\n      {  1,  -1,   0,   1,   0 },\n      {  1,  -1,  -2,  -2,   0 },\n      {  0,   1,   2,   2,   0 },\n      {  0,   0,   2,  -3,   0 },\n      {  2,   2,   0,  -2,  -1 },\n      {  2,  -1,  -2,   0,   1 },\n      {  1,   2,   2,  -4,   1 },\n      {  0,   1,   4,  -4,   2 },\n      {  0,   0,   0,   3,   2 },\n\n   /* 621-630 */\n      {  5,   0,   2,   0,   1 },\n      {  4,   1,   2,  -2,   2 },\n      {  4,   0,  -2,  -2,   0 },\n      {  3,   1,   2,   2,   2 },\n      {  3,   1,   0,  -2,   0 },\n      {  3,   1,  -2,  -6,  -2 },\n      {  3,   0,   0,   0,  -2 },\n      {  3,   0,  -2,  -4,  -2 },\n      {  3,  -1,   0,  -3,   0 },\n      {  3,  -1,   0,  -2,   0 },\n\n   /* 631-640 */\n      {  2,   1,   2,   0,   0 },\n      {  2,   1,   2,  -4,   2 },\n      {  2,   1,   2,  -2,   0 },\n      {  2,   1,   0,  -3,   0 },\n      {  2,   1,  -2,   0,  -2 },\n      {  2,   0,   0,  -4,   2 },\n      {  2,   0,   0,  -4,  -2 },\n      {  2,   0,  -2,  -5,  -2 },\n      {  2,  -1,   2,   4,   2 },\n      {  2,  -1,   0,  -2,   2 },\n\n   /* 641-650 */\n      {  1,   3,  -2,  -2,  -2 },\n      {  1,   1,   0,   0,  -2 },\n      {  1,   1,   0,  -6,   0 },\n      {  1,   1,  -2,   1,  -2 },\n      {  1,   1,  -2,  -1,  -2 },\n      {  1,   0,   2,   1,   0 },\n      {  1,   0,   0,   3,   0 },\n      {  1,   0,   0,  -4,   2 },\n      {  1,   0,  -2,   4,  -2 },\n      {  1,  -2,   0,  -1,   0 },\n\n   /* 651-NFLS */\n      {  0,   1,  -4,   2,  -1 },\n      {  1,   0,  -2,   0,  -3 },\n      {  0,   0,   4,  -4,   4 }\n   };\n\n/* Number of frequencies:  luni-solar */\n   static const int NFLS = (int) (sizeof mfals / sizeof (int) / 5);\n\n/* Fundamental-argument multipliers:  planetary terms */\n   static const int mfapl[][14] = {\n\n   /* 1-10 */\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -2,  5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0, -8, 12,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  8,-16,  4,  5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -1,  2,  0,  0,  0,  0,  0 },\n\n   /* 11-20 */\n      {  0,  0,  0,  0,  0,  0,  8,-13,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  2, -5,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0, -5,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -6,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -1,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -8,  3,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6, -8,  3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2, -3,  0,  0,  0,  0,  0,  0 },\n\n   /* 21-30 */\n      {  0,  0,  0,  0,  0,  0,  2, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  1,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  1, -1,  1,  0,  0,  0, -2,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2, -1,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n\n   /* 31-40 */\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-13,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  5, -8,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  1 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0, -1,  0,  0,  0 },\n\n   /* 41-50 */\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -7,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  0,  0,  0,  0, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0, -2,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  8,-13,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2, -1,  0,  0,  0,  0,  0,  2 },\n      {  1,  0,  0,  0,  0,  0,-18, 16,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  2 },\n\n   /* 51-60 */\n      {  0,  0,  1, -1,  1,  0, -5,  7,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,-10,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0,  0, -5,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -1,  0,  0,  0,  2 },\n      {  1,  0,  2,  0,  2,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -2,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  1 },\n      {  1,  0, -2,  0, -2,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  2,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n\n   /* 61-70 */\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  8,-16,  4,  5,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0,  0,  3, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-11,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  8,-16,  4,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  4, -6,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -3,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0,  0 },\n\n   /* 71-80 */\n      {  0,  0,  0,  0,  0,  0,  6, -8,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  3, -2,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  8,-15,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  1, -3,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -2,  0,  0,  0,  2 },\n      {  0,  0,  1, -1,  1,  0,  0, -5,  8, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -2,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0,  0,  0 },\n\n   /* 81-90 */\n      {  2,  0,  0, -2,  1,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -8,  0,  0,  0,  0,  0, -1 },\n      {  2,  0,  0, -2,  0,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  8,-13,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0, -2,  5,  0,  0,  0 },\n      {  1,  0,  0, -1,  0,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  2 },\n      {  1,  0,  0,  0, -1,  0,-18, 16,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0,  2, -5,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0 },\n\n   /* 91-100 */\n      {  1,  0,  0, -2,  0,  0, 19,-21,  3,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -8, 13,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7, -9,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  2 },\n      {  1,  0,  0,  0,  1,  0,-18, 16,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-16,  4,  5,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  4, -7,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  3, -7,  0,  0,  0,  0,  0, -2 },\n\n   /* 101-110 */\n      {  0,  0,  0,  0,  0,  0,  2, -2,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1 },\n      {  2,  0,  0, -2,  1,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -4,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2, -1,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  2 },\n\n   /* 111-120 */\n      {  0,  0,  0,  0,  1,  0,  0,  1, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2 },\n      {  0,  0,  2, -2,  1,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  3, -3,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0, -1,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0, -6,  8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n\n   /* 121-130 */\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  1 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -3,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0, -1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-10,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6, -9,  0,  0,  0,  0,  0, -2 },\n      {  1,  0,  0, -1,  1,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n\n   /* 131-140 */\n      {  0,  0,  0,  0,  0,  0,  5, -7,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  5, -5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  3, -3,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0, -3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  1,  0,  2, -3,  0,  0,  0,  0,  0,  0 },\n\n   /* 141-150 */\n      {  1,  0,  0, -1,  0,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -3,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -4,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  9,-11,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -3,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  8,-15,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -4,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0, -1,  0,  0,  0,  2 },\n\n   /* 151-160 */\n      {  1,  0,  0, -1,  1,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -4, 10,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  0, -1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -1,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -4,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0, -2 },\n      {  0,  0,  2, -2,  1,  0, -4,  4,  0,  0,  0,  0,  0,  0 },\n\n   /* 161-170 */\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0,  0, -1,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -3,  0,  0,  0,  0,  2 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  0,  0,  2,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  5, -8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -9, 13,  0,  0,  0,  0,  0 },\n      {  2,  0,  2,  0,  2,  0,  0,  2,  0, -3,  0,  0,  0,  0 },\n\n   /* 171-180 */\n      {  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0,  0,  2,  0,  0,  0 },\n      {  1,  0,  0, -1, -1,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  6, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  1 },\n      {  1,  0,  2,  0,  1,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  1,  0, -2,  0, -1,  0,  0, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -2,  4,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0,  0 },\n\n   /* 181-190 */\n      {  0,  0,  0,  0,  0,  0,  2,  1,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  2,  0,  2,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -8,  3,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  6,-10,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  7, -8,  3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  1,  0, -3,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -1,  0,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0, -5,  7,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -2,  0,  0,  0,  1 },\n\n   /* 191-200 */\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7,-10,  0,  0,  0,  0,  0, -2 },\n      {  1,  0,  0, -2,  0,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  2, -5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6, -8,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1,  1,  0,  0, -9, 15,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -2,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -1,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0,  0 },\n\n   /* 201-210 */\n      {  0,  0,  0,  0,  0,  0,  0,  1, -4,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0, -1,  0,  0,  2 },\n      {  2,  0,  0, -2,  1,  0, -6,  8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -5,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1,  1,  0,  3, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  8,-14,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n\n   /* 211-220 */\n      {  0,  0,  0,  0,  1,  0,  0,  8,-15,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -6,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7, -7,  0,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  1,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -1,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  1,  0,  0,  2 },\n      {  2,  0, -1, -1,  0,  0,  0,  3, -7,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -7,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -3,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -3,  4,  0,  0,  0,  0,  0 },\n\n   /* 221-230 */\n      {  2,  0,  0, -2,  0,  0,  0, -6,  8,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -5,  6,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  2,  1,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  1,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -9,  4,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0, -2 },\n\n   /* 231-240 */\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -4,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  1 },\n      {  0,  0,  0,  0,  0,  0,  7,-11,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  3, -5,  4,  0,  0,  0,  0,  2 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0, -1,  1,  0,  0,  0 },\n      {  2,  0,  0,  0,  0,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  8,-15,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  2,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  6, -6,  0,  0,  0,  0,  0, -1 },\n\n   /* 241-250 */\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -1,  1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2, -2,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -7,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  2, -4,  0, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  3, -5,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -3,  0,  0,  0,  2 },\n      {  0,  0,  2, -2,  2,  0, -8, 11,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0, -2,  0,  0,  0 },\n\n   /* 251-260 */\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  1,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -9,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -5,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  7, -9,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  4, -7,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  2, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0, -2, -2, -2,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -2,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  3, -3,  0,  0,  0,  0,  0,  1 },\n\n   /* 261-270 */\n      {  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  2, -5,  0,  0,  2 },\n      {  2,  0,  0, -2, -1,  0,  0, -2,  0,  0,  5,  0,  0,  0 },\n      {  2,  0,  0, -2, -1,  0, -6,  8,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8, -8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0,  2, -5,  0,  0,  2 },\n      {  0,  0,  0,  0,  1,  0,  3, -7,  4,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n\n   /* 271-280 */\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0, -2,  5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -1,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  2, -3,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-15,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0,  1,  0,  0,  0,  2 },\n      {  1,  0,  0, -1,  0,  0,  0, -3,  4,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -3,  7, -4,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,  0, -2,  0,  0,  0,  2 },\n\n   /* 281-290 */\n      {  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  2, -2,  2,  0, -5,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  2,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -5,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -7,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-11,  0,  0,  0,  0, -2 },\n\n   /* 291-300 */\n      {  0,  0,  0,  0,  0,  0,  0,  1, -3,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  9,-12,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  1, -1,  0,  0, -8, 12,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -2,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7, -7,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0, -1 },\n\n   /* 301-310 */\n      {  0,  0,  0,  0,  0,  0,  0,  6, -6,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  1,  0, -4,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6, -9,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1, -1,  0,  0,  0, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -5,  0,  0,  0,  0, -2 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  3, -1,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0, -2,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -9,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  0,  2 },\n\n   /* 311-320 */\n      {  0,  0,  0,  0,  0,  0,  9, -9,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  3,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  2, -4,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -3,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  1 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -9,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -3,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  2 },\n      {  0,  0,  2,  0,  2,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n\n   /* 321-330 */\n      {  0,  0,  2,  0,  2,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,  0, -3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0 },\n      {  2,  0, -1, -1, -1,  0,  0, -1,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -3,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  4, -2,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  5,-10,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  8,-13,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  2, -2,  1, -1,  0,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  0,  2,  0,  0 },\n\n   /* 331-340 */\n      {  0,  0,  0,  0,  1,  0,  3, -5,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  9, -9,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -8, 11,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -2,  0,  0,  2,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -1,  2,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -5,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  2, -6,  0,  0,  0,  0,  0, -2 },\n\n   /* 341-350 */\n      {  0,  0,  0,  0,  0,  0,  0,  8,-15,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -2,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  7,-13,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  2 },\n      {  0,  0,  2, -2,  1,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8, -8,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  8,-10,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  4, -2,  0,  0,  0,  0,  0,  1 },\n\n   /* 351-360 */\n      {  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  3, -4,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -4,  0,  0,  0,  0 },\n      {  2,  0,  0, -2, -1,  0,  0, -5,  6,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  0,  0, -2 },\n      {  2,  0, -1, -1, -1,  0,  0,  3, -7,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -8,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0, -1,  1,  0,  0,  0,  0,  0,  0 },\n\n   /* 361-370 */\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  4, -3,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-11,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  1,  0,  0, -6,  8,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  1,  5,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6, -5,  0,  0,  0,  0,  2 },\n      {  1,  0, -2, -2, -2,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0,  0,  0, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  2,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  2,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  1 },\n\n   /* 371-380 */\n      {  0,  0,  0,  0,  0,  0,  0,  6, -7,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0,  0, -2,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0,  0, -2,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -1,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1, -6,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  4, -5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  3, -5,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  7,-13,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -2,  0,  0,  0,  2 },\n\n   /* 381-390 */\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  0,  2,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -8, 15,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2, -2,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  2,  0, -1, -1, -1,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  1,  0,  2, -2,  2,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  1,  0, -1,  1, -1,  0,-18, 17,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  2, -2, -1,  0, -5,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n\n   /* 391-400 */\n      {  0,  0,  0,  0,  1,  0,  2, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-16,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2 },\n      {  0,  0,  0,  0,  2,  0,  0, -1,  2,  0,  0,  0,  0,  0 },\n      {  2,  0, -1, -1, -2,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6,-10,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0, -2,  4,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  2,  0,  0,  0,  0,  2 },\n      {  2,  0,  0, -2, -1,  0,  0, -2,  0,  4, -5,  0,  0,  0 },\n\n   /* 401-410 */\n      {  2,  0,  0, -2, -1,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  2,  0, -1, -1, -1,  0,  0, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  1, -1,  1,  0,  0, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -1, -1,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n      {  1,  0, -1, -1, -1,  0, 20,-20,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  1, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -2,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  5, -8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, -1,  0,  0,  0 },\n\n   /* 411-420 */\n      {  0,  0,  0,  0,  0,  0,  9,-11,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  5, -3,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -3,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  6, -7,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0, -2,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0, -2,  5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -7,  0,  0,  0,  0,  0 },\n\n   /* 421-430 */\n      {  0,  0,  0,  0,  0,  0,  1, -3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -8,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -6,  0,  0,  0,  0, -2 },\n      {  1,  0,  0, -2,  0,  0, 20,-21,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-12,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -4,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  8,-12,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  9,-17,  0,  0,  0,  0,  0 },\n\n   /* 431-440 */\n      {  0,  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  1,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -6,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -7,  0,  0,  0,  0, -2 },\n      {  1,  0,  0, -1,  1,  0,  0, -3,  4,  0,  0,  0,  0,  0 },\n      {  1,  0, -2,  0, -2,  0,-10,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -9, 17,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -4,  0,  0,  0,  0,  0, -2 },\n      {  1,  0, -2, -2, -2,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  1,  0, -1,  1, -1,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n\n   /* 441-450 */\n      {  0,  0,  2, -2,  2,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0,  0,  1,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0, -5,  7,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  2, -2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  4, -5,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  3, -4,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,-10,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0, -4,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0, -5,  0,  0,  0, -2 },\n\n   /* 451-460 */\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -5,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -2,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -2,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -3,  0,  0,  0,  0,  0,  1 },\n      {  1,  0,  0, -2,  0,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -7,  4,  0,  0,  0,  0,  0 },\n      {  2,  0,  2,  0,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1, -1,  0,  0, -1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  1,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-10,  0,  0,  0,  0, -2 },\n\n   /* 461-470 */\n      {  1,  0,  0, -1,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -3,  0,  3,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0, -5,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  1, -3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -4,  6,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  0,  0, -1,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -5,  6,  0,  0,  0,  0,  0,  0 },\n\n   /* 471-480 */\n      {  0,  0,  0,  0,  1,  0,  3, -4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7,-10,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  5, -5,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  4, -5,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  3, -8,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  2, -5,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  7, -9,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  7, -8,  0,  0,  0,  0,  2 },\n\n   /* 481-490 */\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -8,  3,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0, -2,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -4,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -1,  0,  0,  0, -1 },\n      {  2,  0,  0, -2, -1,  0,  0, -6,  8,  0,  0,  0,  0,  0 },\n      {  2,  0, -1, -1,  1,  0,  0,  3, -7,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -7,  9,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0,  0, -1 },\n\n   /* 491-500 */\n      {  0,  0,  1, -1,  2,  0, -8, 12,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  2, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7, -8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  1,  0,  0, -5,  6,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2, -1,  0,  0, -2,  0,  3, -1,  0,  0,  0 },\n      {  1,  0,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  1,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  1,  0,  0, -2, -1,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n\n   /* 501-510 */\n      {  1,  0,  0, -1, -1,  0,  0, -3,  4,  0,  0,  0,  0,  0 },\n      {  1,  0, -1,  0, -1,  0, -3,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -4,  4,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0, -8, 11,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0,  0,  0, -9, 13,  0,  0,  0,  0,  0 },\n      {  0,  0,  1,  1,  2,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0,  1, -4,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0,  0, -1,  0,  1, -3,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0,  7,-13,  0,  0,  0,  0,  0 },\n\n   /* 511-520 */\n      {  0,  0,  0,  0,  1,  0,  0,  2,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  1,  0, -4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  7,-11,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  6, -6,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  6, -4,  0,  0,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  4, -2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -4,  0,  0,  0,  0,  0,  1 },\n\n   /* 521-530 */\n      {  0,  0,  0,  0,  0,  0,  1, -4,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  9,-17,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  7, -7,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  3,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  3,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -8,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4, -7,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -4,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n\n   /* 531-540 */\n      {  2,  0,  0, -2,  0,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0, -1,  1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0, 17,-16,  0, -2,  0,  0,  0,  0 },\n      {  1,  0,  0, -1,  0,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  6, -9,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -4,  0,  0,  0,  0 },\n\n   /* 541-550 */\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, -2, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  1,  0,  0,  0,  0,  2 },\n      {  2,  0,  0, -2,  0,  0,  0, -4,  4,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  2,  2,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n\n   /* 551-560 */\n      {  1,  0,  0, -2,  0,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0,  0, -4,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  3, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -2,  2,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  0,  1,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0, -4,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  2,  0,  0,  0, -1,  0,  1,  0,  0,  0,  0 },\n\n   /* 561-570 */\n      {  0,  0,  0,  0,  0,  0,  8, -9,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, -5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -2,  0,  0,  0 },\n      {  2,  0, -2, -2, -2,  0,  0, -2,  0,  2,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  1,  0,-10,  3,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0, -1,  0,-10,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0,  2, -3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0,  2, -2,  0,  0,  0,  0,  0,  0 },\n\n   /* 571-580 */\n      {  0,  0,  2,  0,  2,  0, -2,  3,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  0,  2,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  2,  0,  0,  0,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0,  0, -1,  0,  2,  0,  0,  0,  0 },\n      {  2,  0,  2, -2,  2,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  2,  0,  1, -3,  1,  0, -6,  7,  0,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  2, -5,  0,  0,  0,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  5, -5,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  1,  5,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  0,  5,  0,  0,  0 },\n\n   /* 581-590 */\n      {  2,  0,  0, -2,  0,  0,  0, -2,  0,  0,  2,  0,  0,  0 },\n      {  2,  0,  0, -2,  0,  0, -4,  4,  0,  0,  0,  0,  0,  0 },\n      {  2,  0, -2,  0, -2,  0,  0,  5, -9,  0,  0,  0,  0,  0 },\n      {  2,  0, -1, -1,  0,  0,  0, -1,  0,  3,  0,  0,  0,  0 },\n      {  1,  0,  2,  0,  2,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  2,  0,  2,  0,  0,  4, -8,  3,  0,  0,  0,  0 },\n      {  1,  0,  2,  0,  2,  0,  0, -4,  8, -3,  0,  0,  0,  0 },\n      {  1,  0,  2,  0,  2,  0, -1,  1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  2, -2,  2,  0, -3,  3,  0,  0,  0,  0,  0,  0 },\n      {  1,  0,  0,  0,  0,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n\n   /* 591-600 */\n      {  1,  0,  0,  0,  0,  0,  0, -2,  0,  3,  0,  0,  0,  0 },\n      {  1,  0,  0, -2,  0,  0,  0,  2,  0, -2,  0,  0,  0,  0 },\n      {  1,  0, -2, -2, -2,  0,  0,  1,  0, -1,  0,  0,  0,  0 },\n      {  1,  0, -1,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  1,  0, -1, -1,  0,  0,  0,  8,-15,  0,  0,  0,  0,  0 },\n      {  0,  0,  2,  2,  2,  0,  0,  2,  0, -2,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  1, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0, -2,  0,  1,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  1,  0,  0,-10, 15,  0,  0,  0,  0,  0 },\n      {  0,  0,  2, -2,  0, -1,  0,  2,  0,  0,  0,  0,  0,  0 },\n\n   /* 601-610 */\n      {  0,  0,  1, -1,  2,  0,  0, -1,  0,  0, -1,  0,  0,  0 },\n      {  0,  0,  1, -1,  2,  0, -3,  4,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -4,  6,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  1,  0, -1,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0,  0, -1,  0,  0, -2,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1,  0,  0, -1,  0,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  1, -1, -1,  0, -5,  7,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  2,  0,  0,  0,  2,  0, -2,  0,  0,  0,  0 },\n\n   /* 611-620 */\n      {  0,  0,  0,  2,  0,  0, -2,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  2,  0, -3,  5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  1,  0, -1,  2,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  9,-13,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  8,-14,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  8,-11,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  6, -9,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6, -8,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  6, -7,  0,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  0, -2 },\n\n   /* 621-630 */\n      {  0,  0,  0,  0,  0,  0,  5, -6, -4,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  5, -4,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  4, -8,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  4, -5,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  3, -3,  0,  2,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  3, -1,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  7,-12,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6, -9,  0,  0,  0,  0, -2 },\n\n   /* 631-640 */\n      {  0,  0,  0,  0,  0,  0,  0,  6, -8,  1,  5,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6, -4,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  6,-10,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,  0, -4,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -9,  0,  0,  0,  0, -1 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -8,  3,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -7,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5, -6,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,-16,  4,  5,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  5,-13,  0,  0,  0,  0, -2 },\n\n   /* 641-650 */\n      {  0,  0,  0,  0,  0,  0,  0,  3,  0, -5,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -9,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  3, -7,  0,  0,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  2,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  2,  0,  0, -3,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  2, -8,  1,  5,  0,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  1, -5,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0,  0, -3,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  1,  0, -3,  5,  0,  0,  0 },\n\n   /* 651-NFPL */\n      {  0,  0,  0,  0,  0,  0,  0,  1, -3,  0,  0,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  2, -6,  3,  0, -2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, -2,  0,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2 },\n      {  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0 }\n   };\n\n/* Number of frequencies:  planetary */\n   static const int NFPL = (int) (sizeof mfapl / sizeof (int) / 14);\n\n/* Pointers into amplitudes array, one pointer per frequency */\n   static const int nc[] = {\n\n   /* 1-100 */\n       1,    21,    37,    51,    65,    79,    91,   103,   115,   127,\n     139,   151,   163,   172,   184,   196,   207,   219,   231,   240,\n     252,   261,   273,   285,   297,   309,   318,   327,   339,   351,\n     363,   372,   384,   396,   405,   415,   423,   435,   444,   452,\n     460,   467,   474,   482,   490,   498,   506,   513,   521,   528,\n     536,   543,   551,   559,   566,   574,   582,   590,   597,   605,\n     613,   620,   628,   636,   644,   651,   658,   666,   674,   680,\n     687,   695,   702,   710,   717,   725,   732,   739,   746,   753,\n     760,   767,   774,   782,   790,   798,   805,   812,   819,   826,\n     833,   840,   846,   853,   860,   867,   874,   881,   888,   895,\n\n   /* 101-200 */\n     901,   908,   914,   921,   928,   934,   941,   948,   955,   962,\n     969,   976,   982,   989,   996,  1003,  1010,  1017,  1024,  1031,\n    1037,  1043,  1050,  1057,  1064,  1071,  1078,  1084,  1091,  1098,\n    1104,  1112,  1118,  1124,  1131,  1138,  1145,  1151,  1157,  1164,\n    1171,  1178,  1185,  1192,  1199,  1205,  1212,  1218,  1226,  1232,\n    1239,  1245,  1252,  1259,  1266,  1272,  1278,  1284,  1292,  1298,\n    1304,  1310,  1316,  1323,  1329,  1335,  1341,  1347,  1353,  1359,\n    1365,  1371,  1377,  1383,  1389,  1396,  1402,  1408,  1414,  1420,\n    1426,  1434,  1440,  1446,  1452,  1459,  1465,  1471,  1477,  1482,\n    1488,  1493,  1499,  1504,  1509,  1514,  1520,  1527,  1532,  1538,\n\n   /* 201-300 */\n    1543,  1548,  1553,  1558,  1564,  1569,  1574,  1579,  1584,  1589,\n    1594,  1596,  1598,  1600,  1602,  1605,  1608,  1610,  1612,  1617,\n    1619,  1623,  1625,  1627,  1629,  1632,  1634,  1640,  1642,  1644,\n    1646,  1648,  1650,  1652,  1654,  1658,  1660,  1662,  1664,  1668,\n    1670,  1672,  1673,  1675,  1679,  1681,  1683,  1684,  1686,  1688,\n    1690,  1693,  1695,  1697,  1701,  1703,  1705,  1707,  1709,  1711,\n    1712,  1715,  1717,  1721,  1723,  1725,  1727,  1729,  1731,  1733,\n    1735,  1737,  1739,  1741,  1743,  1745,  1747,  1749,  1751,  1753,\n    1755,  1757,  1759,  1761,  1762,  1764,  1766,  1768,  1769,  1771,\n    1773,  1775,  1777,  1779,  1781,  1783,  1785,  1787,  1788,  1790,\n\n   /* 301-400 */\n    1792,  1794,  1796,  1798,  1800,  1802,  1804,  1806,  1807,  1809,\n    1811,  1815,  1817,  1819,  1821,  1823,  1825,  1827,  1829,  1831,\n    1833,  1835,  1837,  1839,  1840,  1842,  1844,  1848,  1850,  1852,\n    1854,  1856,  1858,  1859,  1860,  1862,  1864,  1866,  1868,  1869,\n    1871,  1873,  1875,  1877,  1879,  1881,  1883,  1885,  1887,  1889,\n    1891,  1892,  1896,  1898,  1900,  1901,  1903,  1905,  1907,  1909,\n    1910,  1911,  1913,  1915,  1919,  1921,  1923,  1927,  1929,  1931,\n    1933,  1935,  1937,  1939,  1943,  1945,  1947,  1948,  1949,  1951,\n    1953,  1955,  1957,  1958,  1960,  1962,  1964,  1966,  1968,  1970,\n    1971,  1973,  1974,  1975,  1977,  1979,  1980,  1981,  1982,  1984,\n\n   /* 401-500 */\n    1986,  1988,  1990,  1992,  1994,  1995,  1997,  1999,  2001,  2003,\n    2005,  2007,  2008,  2009,  2011,  2013,  2015,  2017,  2019,  2021,\n    2023,  2024,  2025,  2027,  2029,  2031,  2033,  2035,  2037,  2041,\n    2043,  2045,  2046,  2047,  2049,  2051,  2053,  2055,  2056,  2057,\n    2059,  2061,  2063,  2065,  2067,  2069,  2070,  2071,  2072,  2074,\n    2076,  2078,  2080,  2082,  2084,  2086,  2088,  2090,  2092,  2094,\n    2095,  2096,  2097,  2099,  2101,  2105,  2106,  2107,  2108,  2109,\n    2110,  2111,  2113,  2115,  2119,  2121,  2123,  2125,  2127,  2129,\n    2131,  2133,  2135,  2136,  2137,  2139,  2141,  2143,  2145,  2147,\n    2149,  2151,  2153,  2155,  2157,  2159,  2161,  2163,  2165,  2167,\n\n   /* 501-600 */\n    2169,  2171,  2173,  2175,  2177,  2179,  2181,  2183,  2185,  2186,\n    2187,  2188,  2192,  2193,  2195,  2197,  2199,  2201,  2203,  2205,\n    2207,  2209,  2211,  2213,  2217,  2219,  2221,  2223,  2225,  2227,\n    2229,  2231,  2233,  2234,  2235,  2236,  2237,  2238,  2239,  2240,\n    2241,  2244,  2246,  2248,  2250,  2252,  2254,  2256,  2258,  2260,\n    2262,  2264,  2266,  2268,  2270,  2272,  2274,  2276,  2278,  2280,\n    2282,  2284,  2286,  2288,  2290,  2292,  2294,  2296,  2298,  2300,\n    2302,  2303,  2304,  2305,  2306,  2307,  2309,  2311,  2313,  2315,\n    2317,  2319,  2321,  2323,  2325,  2327,  2329,  2331,  2333,  2335,\n    2337,  2341,  2343,  2345,  2347,  2349,  2351,  2352,  2355,  2356,\n\n   /* 601-700 */\n    2357,  2358,  2359,  2361,  2363,  2364,  2365,  2366,  2367,  2368,\n    2369,  2370,  2371,  2372,  2373,  2374,  2376,  2378,  2380,  2382,\n    2384,  2385,  2386,  2387,  2388,  2389,  2390,  2391,  2392,  2393,\n    2394,  2395,  2396,  2397,  2398,  2399,  2400,  2401,  2402,  2403,\n    2404,  2405,  2406,  2407,  2408,  2409,  2410,  2411,  2412,  2413,\n    2414,  2415,  2417,  2418,  2430,  2438,  2445,  2453,  2460,  2468,\n    2474,  2480,  2488,  2496,  2504,  2512,  2520,  2527,  2535,  2543,\n    2550,  2558,  2566,  2574,  2580,  2588,  2596,  2604,  2612,  2619,\n    2627,  2634,  2642,  2648,  2656,  2664,  2671,  2679,  2685,  2693,\n    2701,  2709,  2717,  2725,  2733,  2739,  2747,  2753,  2761,  2769,\n\n   /* 701-800 */\n    2777,  2785,  2793,  2801,  2809,  2817,  2825,  2833,  2841,  2848,\n    2856,  2864,  2872,  2878,  2884,  2892,  2898,  2906,  2914,  2922,\n    2930,  2938,  2944,  2952,  2958,  2966,  2974,  2982,  2988,  2996,\n    3001,  3009,  3017,  3025,  3032,  3039,  3045,  3052,  3059,  3067,\n    3069,  3076,  3083,  3090,  3098,  3105,  3109,  3111,  3113,  3120,\n    3124,  3128,  3132,  3136,  3140,  3144,  3146,  3150,  3158,  3161,\n    3165,  3166,  3168,  3172,  3176,  3180,  3182,  3185,  3189,  3193,\n    3194,  3197,  3200,  3204,  3208,  3212,  3216,  3219,  3221,  3222,\n    3226,  3230,  3234,  3238,  3242,  3243,  3247,  3251,  3254,  3258,\n    3262,  3266,  3270,  3274,  3275,  3279,  3283,  3287,  3289,  3293,\n\n   /* 801-900 */\n    3296,  3300,  3303,  3307,  3311,  3315,  3319,  3321,  3324,  3327,\n    3330,  3334,  3338,  3340,  3342,  3346,  3350,  3354,  3358,  3361,\n    3365,  3369,  3373,  3377,  3381,  3385,  3389,  3393,  3394,  3398,\n    3402,  3406,  3410,  3413,  3417,  3421,  3425,  3429,  3433,  3435,\n    3439,  3443,  3446,  3450,  3453,  3457,  3458,  3461,  3464,  3468,\n    3472,  3476,  3478,  3481,  3485,  3489,  3493,  3497,  3501,  3505,\n    3507,  3511,  3514,  3517,  3521,  3524,  3525,  3527,  3529,  3533,\n    3536,  3540,  3541,  3545,  3548,  3551,  3555,  3559,  3563,  3567,\n    3569,  3570,  3574,  3576,  3578,  3582,  3586,  3590,  3593,  3596,\n    3600,  3604,  3608,  3612,  3616,  3620,  3623,  3626,  3630,  3632,\n\n   /* 901-1000 */\n    3636,  3640,  3643,  3646,  3648,  3652,  3656,  3660,  3664,  3667,\n    3669,  3671,  3675,  3679,  3683,  3687,  3689,  3693,  3694,  3695,\n    3699,  3703,  3705,  3707,  3710,  3713,  3717,  3721,  3725,  3729,\n    3733,  3736,  3740,  3744,  3748,  3752,  3754,  3757,  3759,  3763,\n    3767,  3770,  3773,  3777,  3779,  3783,  3786,  3790,  3794,  3798,\n    3801,  3805,  3809,  3813,  3817,  3821,  3825,  3827,  3831,  3835,\n    3836,  3837,  3840,  3844,  3848,  3852,  3856,  3859,  3863,  3867,\n    3869,  3871,  3875,  3879,  3883,  3887,  3890,  3894,  3898,  3901,\n    3905,  3909,  3913,  3917,  3921,  3922,  3923,  3924,  3926,  3930,\n    3932,  3936,  3938,  3940,  3944,  3948,  3952,  3956,  3959,  3963,\n\n   /* 1001-1100 */\n    3965,  3969,  3973,  3977,  3979,  3981,  3982,  3986,  3989,  3993,\n    3997,  4001,  4004,  4006,  4009,  4012,  4016,  4020,  4024,  4026,\n    4028,  4032,  4036,  4040,  4044,  4046,  4050,  4054,  4058,  4060,\n    4062,  4063,  4064,  4068,  4071,  4075,  4077,  4081,  4083,  4087,\n    4089,  4091,  4095,  4099,  4101,  4103,  4105,  4107,  4111,  4115,\n    4119,  4123,  4127,  4129,  4131,  4135,  4139,  4141,  4143,  4145,\n    4149,  4153,  4157,  4161,  4165,  4169,  4173,  4177,  4180,  4183,\n    4187,  4191,  4195,  4198,  4201,  4205,  4209,  4212,  4213,  4216,\n    4217,  4221,  4223,  4226,  4230,  4234,  4236,  4240,  4244,  4248,\n    4252,  4256,  4258,  4262,  4264,  4266,  4268,  4270,  4272,  4276,\n\n   /* 1101-1200 */\n    4279,  4283,  4285,  4287,  4289,  4293,  4295,  4299,  4300,  4301,\n    4305,  4309,  4313,  4317,  4319,  4323,  4325,  4329,  4331,  4333,\n    4335,  4337,  4341,  4345,  4349,  4351,  4353,  4357,  4361,  4365,\n    4367,  4369,  4373,  4377,  4381,  4383,  4387,  4389,  4391,  4395,\n    4399,  4403,  4407,  4411,  4413,  4414,  4415,  4418,  4419,  4421,\n    4423,  4427,  4429,  4431,  4433,  4435,  4437,  4439,  4443,  4446,\n    4450,  4452,  4456,  4458,  4460,  4462,  4466,  4469,  4473,  4477,\n    4481,  4483,  4487,  4489,  4491,  4493,  4497,  4499,  4501,  4504,\n    4506,  4510,  4513,  4514,  4515,  4518,  4521,  4522,  4525,  4526,\n    4527,  4530,  4533,  4534,  4537,  4541,  4542,  4543,  4544,  4545,\n\n   /* 1201-1300 */\n    4546,  4547,  4550,  4553,  4554,  4555,  4558,  4561,  4564,  4567,\n    4568,  4571,  4574,  4575,  4578,  4581,  4582,  4585,  4586,  4588,\n    4590,  4592,  4596,  4598,  4602,  4604,  4608,  4612,  4613,  4616,\n    4619,  4622,  4623,  4624,  4625,  4626,  4629,  4632,  4633,  4636,\n    4639,  4640,  4641,  4642,  4643,  4644,  4645,  4648,  4649,  4650,\n    4651,  4652,  4653,  4656,  4657,  4660,  4661,  4664,  4667,  4670,\n    4671,  4674,  4675,  4676,  4677,  4678,  4681,  4682,  4683,  4684,\n    4687,  4688,  4689,  4692,  4693,  4696,  4697,  4700,  4701,  4702,\n    4703,  4704,  4707,  4708,  4711,  4712,  4715,  4716,  4717,  4718,\n    4719,  4720,  4721,  4722,  4723,  4726,  4729,  4730,  4733,  4736,\n\n   /* 1301-(NFLS+NFPL) */\n    4737,  4740,  4741,  4742,  4745,  4746,  4749,  4752,  4753\n   };\n\n/* Amplitude coefficients (microarcsec);  indexed using the nc array. */\n   static const double a[] = {\n\n   /* 1-105 */\n         -6844318.44,     9205236.26,1328.67,1538.18,      205833.11,\n           153041.79,       -3309.73, 853.32,2037.98,       -2301.27,\n       81.46, 120.56, -20.39, -15.22,   1.73,  -1.61,  -0.10,   0.11,\n       -0.02,  -0.02,     -523908.04,      573033.42,-544.75,-458.66,\n            12814.01,       11714.49, 198.97,-290.91, 155.74,-143.27,\n       -2.75,  -1.03,  -1.27,  -1.16,   0.00,  -0.01,      -90552.22,\n            97846.69, 111.23, 137.41,2187.91,2024.68,  41.44, -51.26,\n       26.92, -24.46,  -0.46,  -0.28,  -0.22,  -0.20,       82168.76,\n           -89618.24, -27.64, -29.05,       -2004.36,       -1837.32,\n      -36.07,  48.00, -24.43,  22.41,   0.47,   0.24,   0.20,   0.18,\n            58707.02,7387.02, 470.05,-192.40, 164.33,       -1312.21,\n     -179.73, -28.93, -17.36,  -1.83,  -0.50,   3.57,   0.00,   0.13,\n           -20557.78,       22438.42, -20.84, -17.40, 501.82, 459.68,\n       59.20, -67.30,   6.08,  -5.61,  -1.36,  -1.19,       28288.28,\n     -674.99, -34.69,  35.80, -15.07,-632.54, -11.19,   0.78,  -8.41,\n        0.17,   0.01,   0.07,      -15406.85,       20069.50,  15.12,\n\n   /* 106-219 */\n       31.80, 448.76, 344.50,  -5.77,   1.41,   4.59,  -5.02,   0.17,\n        0.24,      -11991.74,       12902.66,  32.46,  36.70, 288.49,\n      268.14,   5.70,  -7.06,   3.57,  -3.23,  -0.06,  -0.04,\n            -8584.95,       -9592.72,   4.42, -13.20,-214.50, 192.06,\n       23.87,  29.83,   2.54,   2.40,   0.60,  -0.48,5095.50,\n            -6918.22,   7.19,   3.92,-154.91,-113.94,   2.86,  -1.04,\n       -1.52,   1.73,  -0.07,  -0.10,       -4910.93,       -5331.13,\n        0.76,   0.40,-119.21, 109.81,   2.16,   3.20,   1.46,   1.33,\n        0.04,  -0.02,       -6245.02,-123.48,  -6.68,  -8.20,  -2.76,\n      139.64,   2.71,   0.15,   1.86,2511.85,       -3323.89,   1.07,\n       -0.90, -74.33, -56.17,   1.16,  -0.01,  -0.75,   0.83,  -0.02,\n       -0.04,2307.58,3143.98,  -7.52,   7.50,  70.31, -51.60,   1.46,\n        0.16,  -0.69,  -0.79,   0.02,  -0.05,2372.58,2554.51,   5.93,\n       -6.60,  57.12, -53.05,  -0.96,  -1.24,  -0.71,  -0.64,  -0.01,\n            -2053.16,2636.13,   5.13,   7.80,  58.94,  45.91,  -0.42,\n       -0.12,   0.61,  -0.66,   0.02,   0.03,       -1825.49,\n\n   /* 220-339 */\n            -2423.59,   1.23,  -2.00, -54.19,  40.82,  -1.07,  -1.02,\n        0.54,   0.61,  -0.04,   0.04,2521.07,-122.28,  -5.97,   2.90,\n       -2.73, -56.37,  -0.82,   0.13,  -0.75,       -1534.09,1645.01,\n        6.29,   6.80,  36.78,  34.30,   0.92,  -1.25,   0.46,  -0.41,\n       -0.02,  -0.01,1898.27,  47.70,  -0.72,   2.50,   1.07, -42.45,\n       -0.94,   0.02,  -0.56,       -1292.02,       -1387.00,   0.00,\n        0.00, -31.01,  28.89,   0.68,   0.00,   0.38,   0.35,  -0.01,\n       -0.01,       -1234.96,1323.81,   5.21,   5.90,  29.60,  27.61,\n        0.74,  -1.22,   0.37,  -0.33,  -0.02,  -0.01,1137.48,\n            -1233.89,  -0.04,  -0.30, -27.59, -25.43,  -0.61,   1.00,\n       -0.34,   0.31,   0.01,   0.01,-813.13,       -1075.60,   0.40,\n        0.30, -24.05,  18.18,  -0.40,  -0.01,   0.24,   0.27,  -0.01,\n        0.01,1163.22, -60.90,  -2.94,   1.30,  -1.36, -26.01,  -0.58,\n        0.07,  -0.35,1029.70, -55.55,  -2.63,   1.10,  -1.25, -23.02,\n       -0.52,   0.06,  -0.31,-556.26, 852.85,   3.16,  -4.48,  19.06,\n       12.44,  -0.81,  -0.27,   0.17,  -0.21,   0.00,   0.02,-603.52,\n\n   /* 340-467 */\n     -800.34,   0.44,   0.10, -17.90,  13.49,  -0.08,  -0.01,   0.18,\n        0.20,  -0.01,   0.01,-628.24, 684.99,  -0.64,  -0.50,  15.32,\n       14.05,   3.18,  -4.19,   0.19,  -0.17,  -0.09,  -0.07,-866.48,\n      -16.26,   0.52,  -1.30,  -0.36,  19.37,   0.43,  -0.01,   0.26,\n     -512.37, 695.54,  -1.47,  -1.40,  15.55,  11.46,  -0.16,   0.03,\n        0.15,  -0.17,   0.01,   0.01, 506.65, 643.75,   2.54,  -2.62,\n       14.40, -11.33,  -0.77,  -0.06,  -0.15,  -0.16,   0.00,   0.01,\n      664.57,  16.81,  -0.40,   1.00,   0.38, -14.86,  -3.71,  -0.09,\n       -0.20, 405.91, 522.11,   0.99,  -1.50,  11.67,  -9.08,  -0.25,\n       -0.02,  -0.12,  -0.13,-305.78, 326.60,   1.75,   1.90,   7.30,\n        6.84,   0.20,  -0.04, 300.99,-325.03,  -0.44,  -0.50,  -7.27,\n       -6.73,  -1.01,   0.01,   0.00,   0.08,   0.00,   0.02, 438.51,\n       10.47,  -0.56,  -0.20,   0.24,  -9.81,  -0.24,   0.01,  -0.13,\n     -264.02, 335.24,   0.99,   1.40,   7.49,   5.90,  -0.27,  -0.02,\n      284.09, 307.03,   0.32,  -0.40,   6.87,  -6.35,  -0.99,  -0.01,\n     -250.54, 327.11,   0.08,   0.40,   7.31,   5.60,  -0.30, 230.72,\n\n   /* 468-595 */\n     -304.46,   0.08,  -0.10,  -6.81,  -5.16,   0.27, 229.78, 304.17,\n       -0.60,   0.50,   6.80,  -5.14,   0.33,   0.01, 256.30,-276.81,\n       -0.28,  -0.40,  -6.19,  -5.73,  -0.14,   0.01,-212.82, 269.45,\n        0.84,   1.20,   6.02,   4.76,   0.14,  -0.02, 196.64, 272.05,\n       -0.84,   0.90,   6.08,  -4.40,   0.35,   0.02, 188.95, 272.22,\n       -0.12,   0.30,   6.09,  -4.22,   0.34,-292.37,  -5.10,  -0.32,\n       -0.40,  -0.11,   6.54,   0.14,   0.01, 161.79,-220.67,   0.24,\n        0.10,  -4.93,  -3.62,  -0.08, 261.54, -19.94,  -0.95,   0.20,\n       -0.45,  -5.85,  -0.13,   0.02, 142.16,-190.79,   0.20,   0.10,\n       -4.27,  -3.18,  -0.07, 187.95,  -4.11,  -0.24,   0.30,  -0.09,\n       -4.20,  -0.09,   0.01,   0.00,   0.00, -79.08, 167.90,   0.04,\n        0.00,   3.75,   1.77, 121.98, 131.04,  -0.08,   0.10,   2.93,\n       -2.73,  -0.06,-172.95,  -8.11,  -0.40,  -0.20,  -0.18,   3.87,\n        0.09,   0.01,-160.15, -55.30, -14.04,  13.90,  -1.23,   3.58,\n        0.40,   0.31,-115.40, 123.20,   0.60,   0.70,   2.75,   2.58,\n        0.08,  -0.01,-168.26,  -2.00,   0.20,  -0.20,  -0.04,   3.76,\n\n   /* 596-723 */\n        0.08,-114.49, 123.20,   0.32,   0.40,   2.75,   2.56,   0.07,\n       -0.01, 112.14, 120.70,   0.28,  -0.30,   2.70,  -2.51,  -0.07,\n       -0.01, 161.34,   4.03,   0.20,   0.20,   0.09,  -3.61,  -0.08,\n       91.31, 126.64,  -0.40,   0.40,   2.83,  -2.04,  -0.04,   0.01,\n      105.29, 112.90,   0.44,  -0.50,   2.52,  -2.35,  -0.07,  -0.01,\n       98.69,-106.20,  -0.28,  -0.30,  -2.37,  -2.21,  -0.06,   0.01,\n       86.74,-112.94,  -0.08,  -0.20,  -2.53,  -1.94,  -0.05,-134.81,\n        3.51,   0.20,  -0.20,   0.08,   3.01,   0.07,  79.03, 107.31,\n       -0.24,   0.20,   2.40,  -1.77,  -0.04,   0.01, 132.81, -10.77,\n       -0.52,   0.10,  -0.24,  -2.97,  -0.07,   0.01,-130.31,  -0.90,\n        0.04,   0.00,   0.00,   2.91, -78.56,  85.32,   0.00,   0.00,\n        1.91,   1.76,   0.04,   0.00,   0.00, -41.53,  89.10,   0.02,\n        0.00,   1.99,   0.93,  66.03, -71.00,  -0.20,  -0.20,  -1.59,\n       -1.48,  -0.04,  60.50,  64.70,   0.36,  -0.40,   1.45,  -1.35,\n       -0.04,  -0.01, -52.27, -70.01,   0.00,   0.00,  -1.57,   1.17,\n        0.03, -52.95,  66.29,   0.32,   0.40,   1.48,   1.18,   0.04,\n\n   /* 724-851 */\n       -0.01,  51.02,  67.25,   0.00,   0.00,   1.50,  -1.14,  -0.03,\n      -55.66, -60.92,   0.16,  -0.20,  -1.36,   1.24,   0.03, -54.81,\n      -59.20,  -0.08,   0.20,  -1.32,   1.23,   0.03,  51.32, -55.60,\n        0.00,   0.00,  -1.24,  -1.15,  -0.03,  48.29,  51.80,   0.20,\n       -0.20,   1.16,  -1.08,  -0.03, -45.59, -49.00,  -0.12,   0.10,\n       -1.10,   1.02,   0.03,  40.54, -52.69,  -0.04,  -0.10,  -1.18,\n       -0.91,  -0.02, -40.58, -49.51,  -1.00,   1.00,  -1.11,   0.91,\n        0.04,   0.02, -43.76,  46.50,   0.36,   0.40,   1.04,   0.98,\n        0.03,  -0.01,  62.65,  -5.00,  -0.24,   0.00,  -0.11,  -1.40,\n       -0.03,   0.01, -38.57,  49.59,   0.08,   0.10,   1.11,   0.86,\n        0.02, -33.22, -44.04,   0.08,  -0.10,  -0.98,   0.74,   0.02,\n       37.15, -39.90,  -0.12,  -0.10,  -0.89,  -0.83,  -0.02,  36.68,\n      -39.50,  -0.04,  -0.10,  -0.88,  -0.82,  -0.02, -53.22,  -3.91,\n       -0.20,   0.00,  -0.09,   1.19,   0.03,  32.43, -42.19,  -0.04,\n       -0.10,  -0.94,  -0.73,  -0.02, -51.00,  -2.30,  -0.12,  -0.10,\n        0.00,   1.14, -29.53, -39.11,   0.04,   0.00,  -0.87,   0.66,\n\n   /* 852-979 */\n        0.02,  28.50, -38.92,  -0.08,  -0.10,  -0.87,  -0.64,  -0.02,\n       26.54,  36.95,  -0.12,   0.10,   0.83,  -0.59,  -0.01,  26.54,\n       34.59,   0.04,  -0.10,   0.77,  -0.59,  -0.02,  28.35, -32.55,\n       -0.16,   0.20,  -0.73,  -0.63,  -0.01, -28.00,  30.40,   0.00,\n        0.00,   0.68,   0.63,   0.01, -27.61,  29.40,   0.20,   0.20,\n        0.66,   0.62,   0.02,  40.33,   0.40,  -0.04,   0.10,   0.00,\n       -0.90, -23.28,  31.61,  -0.08,  -0.10,   0.71,   0.52,   0.01,\n       37.75,   0.80,   0.04,   0.10,   0.00,  -0.84,  23.66,  25.80,\n        0.00,   0.00,   0.58,  -0.53,  -0.01,  21.01, -27.91,   0.00,\n        0.00,  -0.62,  -0.47,  -0.01, -34.81,   2.89,   0.04,   0.00,\n        0.00,   0.78, -23.49, -25.31,   0.00,   0.00,  -0.57,   0.53,\n        0.01, -23.47,  25.20,   0.16,   0.20,   0.56,   0.52,   0.02,\n       19.58,  27.50,  -0.12,   0.10,   0.62,  -0.44,  -0.01, -22.67,\n      -24.40,  -0.08,   0.10,  -0.55,   0.51,   0.01, -19.97,  25.00,\n        0.12,   0.20,   0.56,   0.45,   0.01,  21.28, -22.80,  -0.08,\n       -0.10,  -0.51,  -0.48,  -0.01, -30.47,   0.91,   0.04,   0.00,\n\n   /* 980-1107 */\n        0.00,   0.68,  18.58,  24.00,   0.04,  -0.10,   0.54,  -0.42,\n       -0.01, -18.02,  24.40,  -0.04,  -0.10,   0.55,   0.40,   0.01,\n       17.74,  22.50,   0.08,  -0.10,   0.50,  -0.40,  -0.01, -19.41,\n       20.70,   0.08,   0.10,   0.46,   0.43,   0.01, -18.64,  20.11,\n        0.00,   0.00,   0.45,   0.42,   0.01, -16.75,  21.60,   0.04,\n        0.10,   0.48,   0.37,   0.01, -18.42, -20.00,   0.00,   0.00,\n       -0.45,   0.41,   0.01, -26.77,   1.41,   0.08,   0.00,   0.00,\n        0.60, -26.17,  -0.19,   0.00,   0.00,   0.00,   0.59, -15.52,\n       20.51,   0.00,   0.00,   0.46,   0.35,   0.01, -25.42,  -1.91,\n       -0.08,   0.00,  -0.04,   0.57,   0.45, -17.42,  18.10,   0.00,\n        0.00,   0.40,   0.39,   0.01,  16.39, -17.60,  -0.08,  -0.10,\n       -0.39,  -0.37,  -0.01, -14.37,  18.91,   0.00,   0.00,   0.42,\n        0.32,   0.01,  23.39,  -2.40,  -0.12,   0.00,   0.00,  -0.52,\n       14.32, -18.50,  -0.04,  -0.10,  -0.41,  -0.32,  -0.01,  15.69,\n       17.08,   0.00,   0.00,   0.38,  -0.35,  -0.01, -22.99,   0.50,\n        0.04,   0.00,   0.00,   0.51,   0.00,   0.00,  14.47, -17.60,\n\n   /* 1108-1235 */\n       -0.01,   0.00,  -0.39,  -0.32, -13.33,  18.40,  -0.04,  -0.10,\n        0.41,   0.30,  22.47,  -0.60,  -0.04,   0.00,   0.00,  -0.50,\n      -12.78, -17.41,   0.04,   0.00,  -0.39,   0.29,   0.01, -14.10,\n      -15.31,   0.04,   0.00,  -0.34,   0.32,   0.01,  11.98,  16.21,\n       -0.04,   0.00,   0.36,  -0.27,  -0.01,  19.65,  -1.90,  -0.08,\n        0.00,   0.00,  -0.44,  19.61,  -1.50,  -0.08,   0.00,   0.00,\n       -0.44,  13.41, -14.30,  -0.04,  -0.10,  -0.32,  -0.30,  -0.01,\n      -13.29,  14.40,   0.00,   0.00,   0.32,   0.30,   0.01,  11.14,\n      -14.40,  -0.04,   0.00,  -0.32,  -0.25,  -0.01,  12.24, -13.38,\n        0.04,   0.00,  -0.30,  -0.27,  -0.01,  10.07, -13.81,   0.04,\n        0.00,  -0.31,  -0.23,  -0.01,  10.46,  13.10,   0.08,  -0.10,\n        0.29,  -0.23,  -0.01,  16.55,  -1.71,  -0.08,   0.00,   0.00,\n       -0.37,   9.75, -12.80,   0.00,   0.00,  -0.29,  -0.22,  -0.01,\n        9.11,  12.80,   0.00,   0.00,   0.29,  -0.20,   0.00,   0.00,\n       -6.44, -13.80,   0.00,   0.00,  -0.31,   0.14,  -9.19, -12.00,\n        0.00,   0.00,  -0.27,   0.21, -10.30,  10.90,   0.08,   0.10,\n\n   /* 1236-1363 */\n        0.24,   0.23,   0.01,  14.92,  -0.80,  -0.04,   0.00,   0.00,\n       -0.33,  10.02, -10.80,   0.00,   0.00,  -0.24,  -0.22,  -0.01,\n       -9.75,  10.40,   0.04,   0.00,   0.23,   0.22,   0.01,   9.67,\n      -10.40,  -0.04,   0.00,  -0.23,  -0.22,  -0.01,  -8.28, -11.20,\n        0.04,   0.00,  -0.25,   0.19,  13.32,  -1.41,  -0.08,   0.00,\n        0.00,  -0.30,   8.27,  10.50,   0.04,   0.00,   0.23,  -0.19,\n        0.00,   0.00,  13.13,   0.00,   0.00,   0.00,   0.00,  -0.29,\n      -12.93,   0.70,   0.04,   0.00,   0.00,   0.29,   7.91, -10.20,\n        0.00,   0.00,  -0.23,  -0.18,  -7.84, -10.00,  -0.04,   0.00,\n       -0.22,   0.18,   7.44,   9.60,   0.00,   0.00,   0.21,  -0.17,\n       -7.64,   9.40,   0.08,   0.10,   0.21,   0.17,   0.01, -11.38,\n        0.60,   0.04,   0.00,   0.00,   0.25,  -7.48,   8.30,   0.00,\n        0.00,   0.19,   0.17, -10.98,  -0.20,   0.00,   0.00,   0.00,\n        0.25,  10.98,   0.20,   0.00,   0.00,   0.00,  -0.25,   7.40,\n       -7.90,  -0.04,   0.00,  -0.18,  -0.17,  -6.09,   8.40,  -0.04,\n        0.00,   0.19,   0.14,  -6.94,  -7.49,   0.00,   0.00,  -0.17,\n\n   /* 1364-1491 */\n        0.16,   6.92,   7.50,   0.04,   0.00,   0.17,  -0.15,   6.20,\n        8.09,   0.00,   0.00,   0.18,  -0.14,  -6.12,   7.80,   0.04,\n        0.00,   0.17,   0.14,   5.85,  -7.50,   0.00,   0.00,  -0.17,\n       -0.13,  -6.48,   6.90,   0.08,   0.10,   0.15,   0.14,   0.01,\n        6.32,   6.90,   0.00,   0.00,   0.15,  -0.14,   5.61,  -7.20,\n        0.00,   0.00,  -0.16,  -0.13,   9.07,   0.00,   0.00,   0.00,\n        0.00,  -0.20,   5.25,   6.90,   0.00,   0.00,   0.15,  -0.12,\n       -8.47,  -0.40,   0.00,   0.00,   0.00,   0.19,   6.32,  -5.39,\n       -1.11,   1.10,  -0.12,  -0.14,   0.02,   0.02,   5.73,  -6.10,\n       -0.04,   0.00,  -0.14,  -0.13,   4.70,   6.60,  -0.04,   0.00,\n        0.15,  -0.11,  -4.90,  -6.40,   0.00,   0.00,  -0.14,   0.11,\n       -5.33,   5.60,   0.04,   0.10,   0.13,   0.12,   0.01,  -4.81,\n        6.00,   0.04,   0.00,   0.13,   0.11,   5.13,   5.50,   0.04,\n        0.00,   0.12,  -0.11,   4.50,   5.90,   0.00,   0.00,   0.13,\n       -0.10,  -4.22,   6.10,   0.00,   0.00,   0.14,  -4.53,   5.70,\n        0.00,   0.00,   0.13,   0.10,   4.18,   5.70,   0.00,   0.00,\n\n   /* 1492-1619 */\n        0.13,  -4.75,  -5.19,   0.00,   0.00,  -0.12,   0.11,  -4.06,\n        5.60,   0.00,   0.00,   0.13,  -3.98,   5.60,  -0.04,   0.00,\n        0.13,   4.02,  -5.40,   0.00,   0.00,  -0.12,   4.49,  -4.90,\n       -0.04,   0.00,  -0.11,  -0.10,  -3.62,  -5.40,  -0.16,   0.20,\n       -0.12,   0.00,   0.01,   4.38,   4.80,   0.00,   0.00,   0.11,\n       -6.40,  -0.10,   0.00,   0.00,   0.00,   0.14,  -3.98,   5.00,\n        0.04,   0.00,   0.11,  -3.82,  -5.00,   0.00,   0.00,  -0.11,\n       -3.71,   5.07,   0.00,   0.00,   0.11,   4.14,   4.40,   0.00,\n        0.00,   0.10,  -6.01,  -0.50,  -0.04,   0.00,   0.00,   0.13,\n       -4.04,   4.39,   0.00,   0.00,   0.10,   3.45,  -4.72,   0.00,\n        0.00,  -0.11,   3.31,   4.71,   0.00,   0.00,   0.11,   3.26,\n       -4.50,   0.00,   0.00,  -0.10,  -3.26,  -4.50,   0.00,   0.00,\n       -0.10,  -3.34,  -4.40,   0.00,   0.00,  -0.10,  -3.74,  -4.00,\n        3.70,   4.00,   3.34,  -4.30,   3.30,  -4.30,  -3.66,   3.90,\n        0.04,   3.66,   3.90,   0.04,  -3.62,  -3.90,  -3.61,   3.90,\n       -0.20,   5.30,   0.00,   0.00,   0.12,   3.06,   4.30,   3.30,\n\n   /* 1620-1747 */\n        4.00,   0.40,   0.20,   3.10,   4.10,  -3.06,   3.90,  -3.30,\n       -3.60,  -3.30,   3.36,   0.01,   3.14,   3.40,  -4.57,  -0.20,\n        0.00,   0.00,   0.00,   0.10,  -2.70,  -3.60,   2.94,  -3.20,\n       -2.90,   3.20,   2.47,  -3.40,   2.55,  -3.30,   2.80,  -3.08,\n        2.51,   3.30,  -4.10,   0.30,  -0.12,  -0.10,   4.10,   0.20,\n       -2.74,   3.00,   2.46,   3.23,  -3.66,   1.20,  -0.20,   0.20,\n        3.74,  -0.40,  -2.51,  -2.80,  -3.74,   2.27,  -2.90,   0.00,\n        0.00,  -2.50,   2.70,  -2.51,   2.60,  -3.50,   0.20,   3.38,\n       -2.22,  -2.50,   3.26,  -0.40,   1.95,  -2.60,   3.22,  -0.40,\n       -0.04,  -1.79,  -2.60,   1.91,   2.50,   0.74,   3.05,  -0.04,\n        0.08,   2.11,  -2.30,  -2.11,   2.20,  -1.87,  -2.40,   2.03,\n       -2.20,  -2.03,   2.20,   2.98,   0.00,   0.00,   2.98,  -1.71,\n        2.40,   2.94,  -0.10,  -0.12,   0.10,   1.67,   2.40,  -1.79,\n        2.30,  -1.79,   2.20,  -1.67,   2.20,   1.79,  -2.00,   1.87,\n       -1.90,   1.63,  -2.10,  -1.59,   2.10,   1.55,  -2.10,  -1.55,\n        2.10,  -2.59,  -0.20,  -1.75,  -1.90,  -1.75,   1.90,  -1.83,\n\n   /* 1748-1875 */\n       -1.80,   1.51,   2.00,  -1.51,  -2.00,   1.71,   1.80,   1.31,\n        2.10,  -1.43,   2.00,   1.43,   2.00,  -2.43,  -1.51,   1.90,\n       -1.47,   1.90,   2.39,   0.20,  -2.39,   1.39,   1.90,   1.39,\n       -1.80,   1.47,  -1.60,   1.47,  -1.60,   1.43,  -1.50,  -1.31,\n        1.60,   1.27,  -1.60,  -1.27,   1.60,   1.27,  -1.60,   2.03,\n        1.35,   1.50,  -1.39,  -1.40,   1.95,  -0.20,  -1.27,   1.49,\n        1.19,   1.50,   1.27,   1.40,   1.15,   1.50,   1.87,  -0.10,\n       -1.12,  -1.50,   1.87,  -1.11,  -1.50,  -1.11,  -1.50,   0.00,\n        0.00,   1.19,   1.40,   1.27,  -1.30,  -1.27,  -1.30,  -1.15,\n        1.40,  -1.23,   1.30,  -1.23,  -1.30,   1.22,  -1.29,   1.07,\n       -1.40,   1.75,  -0.20,  -1.03,  -1.40,  -1.07,   1.20,  -1.03,\n        1.15,   1.07,   1.10,   1.51,  -1.03,   1.10,   1.03,  -1.10,\n        0.00,   0.00,  -1.03,  -1.10,   0.91,  -1.20,  -0.88,  -1.20,\n       -0.88,   1.20,  -0.95,   1.10,  -0.95,  -1.10,   1.43,  -1.39,\n        0.95,  -1.00,  -0.95,   1.00,  -0.80,   1.10,   0.91,  -1.00,\n       -1.35,   0.88,   1.00,  -0.83,   1.00,  -0.91,   0.90,   0.91,\n\n   /* 1876-2003 */\n        0.90,   0.88,  -0.90,  -0.76,  -1.00,  -0.76,   1.00,   0.76,\n        1.00,  -0.72,   1.00,   0.84,  -0.90,   0.84,   0.90,   1.23,\n        0.00,   0.00,  -0.52,  -1.10,  -0.68,   1.00,   1.19,  -0.20,\n        1.19,   0.76,   0.90,   1.15,  -0.10,   1.15,  -0.10,   0.72,\n       -0.90,  -1.15,  -1.15,   0.68,   0.90,  -0.68,   0.90,  -1.11,\n        0.00,   0.00,   0.20,   0.79,   0.80,  -1.11,  -0.10,   0.00,\n        0.00,  -0.48,  -1.00,  -0.76,  -0.80,  -0.72,  -0.80,  -1.07,\n       -0.10,   0.64,   0.80,  -0.64,  -0.80,   0.64,   0.80,   0.40,\n        0.60,   0.52,  -0.50,  -0.60,  -0.80,  -0.71,   0.70,  -0.99,\n        0.99,   0.56,   0.80,  -0.56,   0.80,   0.68,  -0.70,   0.68,\n        0.70,  -0.95,  -0.64,   0.70,   0.64,   0.70,  -0.60,   0.70,\n       -0.60,  -0.70,  -0.91,  -0.10,  -0.51,   0.76,  -0.91,  -0.56,\n        0.70,   0.88,   0.88,  -0.63,  -0.60,   0.55,  -0.60,  -0.80,\n        0.80,  -0.80,  -0.52,   0.60,   0.52,   0.60,   0.52,  -0.60,\n       -0.48,   0.60,   0.48,   0.60,   0.48,   0.60,  -0.76,   0.44,\n       -0.60,   0.52,  -0.50,  -0.52,   0.50,   0.40,   0.60,  -0.40,\n\n   /* 2004-2131 */\n       -0.60,   0.40,  -0.60,   0.72,  -0.72,  -0.51,  -0.50,  -0.48,\n        0.50,   0.48,  -0.50,  -0.48,   0.50,  -0.48,   0.50,   0.48,\n       -0.50,  -0.48,  -0.50,  -0.68,  -0.68,   0.44,   0.50,  -0.64,\n       -0.10,  -0.64,  -0.10,  -0.40,   0.50,   0.40,   0.50,   0.40,\n        0.50,   0.00,   0.00,  -0.40,  -0.50,  -0.36,  -0.50,   0.36,\n       -0.50,   0.60,  -0.60,   0.40,  -0.40,   0.40,   0.40,  -0.40,\n        0.40,  -0.40,   0.40,  -0.56,  -0.56,   0.36,  -0.40,  -0.36,\n        0.40,   0.36,  -0.40,  -0.36,  -0.40,   0.36,   0.40,   0.36,\n        0.40,  -0.52,   0.52,   0.52,   0.32,   0.40,  -0.32,   0.40,\n       -0.32,   0.40,  -0.32,   0.40,   0.32,  -0.40,  -0.32,  -0.40,\n        0.32,  -0.40,   0.28,  -0.40,  -0.28,   0.40,   0.28,  -0.40,\n        0.28,   0.40,   0.48,  -0.48,   0.48,   0.36,  -0.30,  -0.36,\n       -0.30,   0.00,   0.00,   0.20,   0.40,  -0.44,   0.44,  -0.44,\n       -0.44,  -0.44,  -0.44,   0.32,  -0.30,   0.32,   0.30,   0.24,\n        0.30,  -0.12,  -0.10,  -0.28,   0.30,   0.28,   0.30,   0.28,\n        0.30,   0.28,  -0.30,   0.28,  -0.30,   0.28,  -0.30,   0.28,\n\n   /* 2132-2259 */\n        0.30,  -0.28,   0.30,   0.40,   0.40,  -0.24,   0.30,   0.24,\n       -0.30,   0.24,  -0.30,  -0.24,  -0.30,   0.24,   0.30,   0.24,\n       -0.30,  -0.24,   0.30,   0.24,  -0.30,  -0.24,  -0.30,   0.24,\n       -0.30,   0.24,   0.30,  -0.24,   0.30,  -0.24,   0.30,   0.20,\n       -0.30,   0.20,  -0.30,   0.20,  -0.30,   0.20,   0.30,   0.20,\n       -0.30,   0.20,  -0.30,   0.20,   0.30,   0.20,   0.30,  -0.20,\n       -0.30,   0.20,  -0.30,   0.20,  -0.30,  -0.36,  -0.36,  -0.36,\n       -0.04,   0.30,   0.12,  -0.10,  -0.32,  -0.24,   0.20,   0.24,\n        0.20,   0.20,  -0.20,  -0.20,  -0.20,  -0.20,  -0.20,   0.20,\n        0.20,   0.20,  -0.20,   0.20,   0.20,   0.20,   0.20,  -0.20,\n       -0.20,   0.00,   0.00,  -0.20,  -0.20,  -0.20,   0.20,  -0.20,\n        0.20,   0.20,  -0.20,  -0.20,  -0.20,   0.20,   0.20,   0.20,\n        0.20,   0.20,  -0.20,   0.20,  -0.20,   0.28,   0.28,   0.28,\n        0.28,   0.28,   0.28,  -0.28,   0.28,   0.12,   0.00,   0.24,\n        0.16,  -0.20,   0.16,  -0.20,   0.16,  -0.20,   0.16,   0.20,\n       -0.16,   0.20,   0.16,   0.20,  -0.16,   0.20,  -0.16,   0.20,\n\n   /* 2260-2387 */\n       -0.16,   0.20,   0.16,  -0.20,   0.16,   0.20,   0.16,  -0.20,\n       -0.16,   0.20,  -0.16,  -0.20,  -0.16,   0.20,   0.16,   0.20,\n        0.16,  -0.20,   0.16,  -0.20,   0.16,   0.20,   0.16,   0.20,\n        0.16,   0.20,  -0.16,  -0.20,   0.16,   0.20,  -0.16,   0.20,\n        0.16,   0.20,  -0.16,  -0.20,   0.16,  -0.20,   0.16,  -0.20,\n       -0.16,  -0.20,   0.24,  -0.24,  -0.24,   0.24,   0.24,   0.12,\n        0.20,   0.12,   0.20,  -0.12,  -0.20,   0.12,  -0.20,   0.12,\n       -0.20,  -0.12,   0.20,  -0.12,   0.20,  -0.12,  -0.20,   0.12,\n        0.20,   0.12,   0.20,   0.12,  -0.20,  -0.12,   0.20,   0.12,\n       -0.20,  -0.12,   0.20,   0.12,   0.20,   0.00,   0.00,  -0.12,\n        0.20,  -0.12,   0.20,   0.12,  -0.20,  -0.12,   0.20,   0.12,\n        0.20,   0.00,  -0.21,  -0.20,   0.00,   0.00,   0.20,  -0.20,\n       -0.20,  -0.20,   0.20,  -0.16,  -0.10,   0.00,   0.17,   0.16,\n        0.16,   0.16,   0.16,  -0.16,   0.16,   0.16,  -0.16,   0.16,\n       -0.16,   0.16,   0.12,   0.10,   0.12,  -0.10,  -0.12,   0.10,\n       -0.12,   0.10,   0.12,  -0.10,  -0.12,   0.12,  -0.12,   0.12,\n\n   /* 2388-2515 */\n       -0.12,   0.12,  -0.12,  -0.12,  -0.12,  -0.12,  -0.12,  -0.12,\n       -0.12,   0.12,   0.12,   0.12,   0.12,  -0.12,  -0.12,   0.12,\n        0.12,   0.12,  -0.12,   0.12,  -0.12,  -0.12,  -0.12,   0.12,\n       -0.12,  -0.12,   0.12,   0.00,   0.11,   0.11,-122.67, 164.70,\n      203.78, 273.50,   3.58,   2.74,   6.18,  -4.56,   0.00,  -0.04,\n        0.00,  -0.07,  57.44, -77.10,  95.82, 128.60,  -1.77,  -1.28,\n        2.85,  -2.14,  82.14,  89.50,   0.00,   0.00,   2.00,  -1.84,\n       -0.04,  47.73, -64.10,  23.79,  31.90,  -1.45,  -1.07,   0.69,\n       -0.53, -46.38,  50.50,   0.00,   0.00,   1.13,   1.04,   0.02,\n      -18.38,   0.00,  63.80,   0.00,   0.00,   0.41,   0.00,  -1.43,\n       59.07,   0.00,   0.00,   0.00,   0.00,  -1.32,  57.28,   0.00,\n        0.00,   0.00,   0.00,  -1.28, -48.65,   0.00,  -1.15,   0.00,\n        0.00,   1.09,   0.00,   0.03, -18.30,  24.60, -17.30, -23.20,\n        0.56,   0.41,  -0.51,   0.39, -16.91,  26.90,   8.43,  13.30,\n        0.60,   0.38,   0.31,  -0.19,   1.23,  -1.70, -19.13, -25.70,\n       -0.03,  -0.03,  -0.58,   0.43,  -0.72,   0.90, -17.34, -23.30,\n\n   /* 2516-2643 */\n        0.03,   0.02,  -0.52,   0.39, -19.49, -21.30,   0.00,   0.00,\n       -0.48,   0.44,   0.01,  20.57, -20.10,   0.64,   0.70,  -0.45,\n       -0.46,   0.00,  -0.01,   4.89,   5.90, -16.55,  19.90,   0.14,\n       -0.11,   0.44,   0.37,  18.22,  19.80,   0.00,   0.00,   0.44,\n       -0.41,  -0.01,   4.89,  -5.30, -16.51, -18.00,  -0.11,  -0.11,\n       -0.41,   0.37, -17.86,   0.00,  17.10,   0.00,   0.00,   0.40,\n        0.00,  -0.38,   0.32,   0.00,  24.42,   0.00,   0.00,  -0.01,\n        0.00,  -0.55, -23.79,   0.00,   0.00,   0.00,   0.00,   0.53,\n       14.72, -16.00,  -0.32,   0.00,  -0.36,  -0.33,  -0.01,   0.01,\n        3.34,  -4.50,  11.86,  15.90,  -0.11,  -0.07,   0.35,  -0.27,\n       -3.26,   4.40,  11.62,  15.60,   0.09,   0.07,   0.35,  -0.26,\n      -19.53,   0.00,   5.09,   0.00,   0.00,   0.44,   0.00,  -0.11,\n      -13.48,  14.70,   0.00,   0.00,   0.33,   0.30,   0.01,  10.86,\n      -14.60,   3.18,   4.30,  -0.33,  -0.24,   0.09,  -0.07, -11.30,\n      -15.10,   0.00,   0.00,  -0.34,   0.25,   0.01,   2.03,  -2.70,\n       10.82,  14.50,  -0.07,  -0.05,   0.32,  -0.24,  17.46,   0.00,\n\n   /* 2644-2771 */\n        0.00,   0.00,   0.00,  -0.39,  16.43,   0.00,   0.52,   0.00,\n        0.00,  -0.37,   0.00,  -0.01,   9.35,   0.00,  13.29,   0.00,\n        0.00,  -0.21,   0.00,  -0.30, -10.42,  11.40,   0.00,   0.00,\n        0.25,   0.23,   0.01,   0.44,   0.50, -10.38,  11.30,   0.02,\n       -0.01,   0.25,   0.23, -14.64,   0.00,   0.00,   0.00,   0.00,\n        0.33,   0.56,   0.80,  -8.67,  11.70,   0.02,  -0.01,   0.26,\n        0.19,  13.88,   0.00,  -2.47,   0.00,   0.00,  -0.31,   0.00,\n        0.06,  -1.99,   2.70,   7.72,  10.30,   0.06,   0.04,   0.23,\n       -0.17,  -0.20,   0.00,  13.05,   0.00,   0.00,   0.00,   0.00,\n       -0.29,   6.92,  -9.30,   3.34,   4.50,  -0.21,  -0.15,   0.10,\n       -0.07,  -6.60,   0.00,  10.70,   0.00,   0.00,   0.15,   0.00,\n       -0.24,  -8.04,  -8.70,   0.00,   0.00,  -0.19,   0.18, -10.58,\n        0.00,  -3.10,   0.00,   0.00,   0.24,   0.00,   0.07,  -7.32,\n        8.00,  -0.12,  -0.10,   0.18,   0.16,   1.63,   1.70,   6.96,\n       -7.60,   0.03,  -0.04,  -0.17,  -0.16,  -3.62,   0.00,   9.86,\n        0.00,   0.00,   0.08,   0.00,  -0.22,   0.20,  -0.20,  -6.88,\n\n   /* 2772-2899 */\n       -7.50,   0.00,   0.00,  -0.17,   0.15,  -8.99,   0.00,   4.02,\n        0.00,   0.00,   0.20,   0.00,  -0.09,  -1.07,   1.40,  -5.69,\n       -7.70,   0.03,   0.02,  -0.17,   0.13,   6.48,  -7.20,  -0.48,\n       -0.50,  -0.16,  -0.14,  -0.01,   0.01,   5.57,  -7.50,   1.07,\n        1.40,  -0.17,  -0.12,   0.03,  -0.02,   8.71,   0.00,   3.54,\n        0.00,   0.00,  -0.19,   0.00,  -0.08,   0.40,   0.00,   9.27,\n        0.00,   0.00,  -0.01,   0.00,  -0.21,  -6.13,   6.70,  -1.19,\n       -1.30,   0.15,   0.14,  -0.03,   0.03,   5.21,  -5.70,  -2.51,\n       -2.60,  -0.13,  -0.12,  -0.06,   0.06,   5.69,  -6.20,  -0.12,\n       -0.10,  -0.14,  -0.13,  -0.01,   2.03,  -2.70,   4.53,   6.10,\n       -0.06,  -0.05,   0.14,  -0.10,   5.01,   5.50,  -2.51,   2.70,\n        0.12,  -0.11,   0.06,   0.06,  -1.91,   2.60,  -4.38,  -5.90,\n        0.06,   0.04,  -0.13,   0.10,   4.65,  -6.30,   0.00,   0.00,\n       -0.14,  -0.10,  -5.29,   5.70,   0.00,   0.00,   0.13,   0.12,\n       -2.23,  -4.00,  -4.65,   4.20,  -0.09,   0.05,   0.10,   0.10,\n       -4.53,   6.10,   0.00,   0.00,   0.14,   0.10,   2.47,   2.70,\n\n   /* 2900-3027 */\n       -4.46,   4.90,   0.06,  -0.06,   0.11,   0.10,  -5.05,   5.50,\n        0.84,   0.90,   0.12,   0.11,   0.02,  -0.02,   4.97,  -5.40,\n       -1.71,   0.00,  -0.12,  -0.11,   0.00,   0.04,  -0.99,  -1.30,\n        4.22,  -5.70,  -0.03,   0.02,  -0.13,  -0.09,   0.99,   1.40,\n        4.22,  -5.60,   0.03,  -0.02,  -0.13,  -0.09,  -4.69,  -5.20,\n        0.00,   0.00,  -0.12,   0.10,  -3.42,   0.00,   6.09,   0.00,\n        0.00,   0.08,   0.00,  -0.14,  -4.65,  -5.10,   0.00,   0.00,\n       -0.11,   0.10,   0.00,   0.00,  -4.53,  -5.00,   0.00,   0.00,\n       -0.11,   0.10,  -2.43,  -2.70,  -3.82,   4.20,  -0.06,   0.05,\n        0.10,   0.09,   0.00,   0.00,  -4.53,   4.90,   0.00,   0.00,\n        0.11,   0.10,  -4.49,  -4.90,   0.00,   0.00,  -0.11,   0.10,\n        2.67,  -2.90,  -3.62,  -3.90,  -0.06,  -0.06,  -0.09,   0.08,\n        3.94,  -5.30,   0.00,   0.00,  -0.12,  -3.38,   3.70,  -2.78,\n       -3.10,   0.08,   0.08,  -0.07,   0.06,   3.18,  -3.50,  -2.82,\n       -3.10,  -0.08,  -0.07,  -0.07,   0.06,  -5.77,   0.00,   1.87,\n        0.00,   0.00,   0.13,   0.00,  -0.04,   3.54,  -4.80,  -0.64,\n\n   /* 3028-3155 */\n       -0.90,  -0.11,   0.00,  -0.02,  -3.50,  -4.70,   0.68,  -0.90,\n       -0.11,   0.00,  -0.02,   5.49,   0.00,   0.00,   0.00,   0.00,\n       -0.12,   1.83,  -2.50,   2.63,   3.50,  -0.06,   0.00,   0.08,\n        3.02,  -4.10,   0.68,   0.90,  -0.09,   0.00,   0.02,   0.00,\n        0.00,   5.21,   0.00,   0.00,   0.00,   0.00,  -0.12,  -3.54,\n        3.80,   2.70,   3.60,  -1.35,   1.80,   0.08,   0.00,   0.04,\n       -2.90,   3.90,   0.68,   0.90,   0.09,   0.00,   0.02,   0.80,\n       -1.10,  -2.78,  -3.70,  -0.02,   0.00,  -0.08,   4.10,   0.00,\n       -2.39,   0.00,   0.00,  -0.09,   0.00,   0.05,  -1.59,   2.10,\n        2.27,   3.00,   0.05,   0.00,   0.07,  -2.63,   3.50,  -0.48,\n       -0.60,  -2.94,  -3.20,  -2.94,   3.20,   2.27,  -3.00,  -1.11,\n       -1.50,  -0.07,   0.00,  -0.03,  -0.56,  -0.80,  -2.35,   3.10,\n        0.00,  -0.60,  -3.42,   1.90,  -0.12,  -0.10,   2.63,  -2.90,\n        2.51,   2.80,  -0.64,   0.70,  -0.48,  -0.60,   2.19,  -2.90,\n        0.24,  -0.30,   2.15,   2.90,   2.15,  -2.90,   0.52,   0.70,\n        2.07,  -2.80,  -3.10,   0.00,   1.79,   0.00,   0.00,   0.07,\n\n   /* 3156-3283 */\n        0.00,  -0.04,   0.88,   0.00,  -3.46,   2.11,   2.80,  -0.36,\n        0.50,   3.54,  -0.20,  -3.50,  -1.39,   1.50,  -1.91,  -2.10,\n       -1.47,   2.00,   1.39,   1.90,   2.07,  -2.30,   0.91,   1.00,\n        1.99,  -2.70,   3.30,   0.00,   0.60,  -0.44,  -0.70,  -1.95,\n        2.60,   2.15,  -2.40,  -0.60,  -0.70,   3.30,   0.84,   0.00,\n       -3.10,  -3.10,   0.00,  -0.72,  -0.32,   0.40,  -1.87,  -2.50,\n        1.87,  -2.50,   0.32,   0.40,  -0.24,   0.30,  -1.87,  -2.50,\n       -0.24,  -0.30,   1.87,  -2.50,  -2.70,   0.00,   1.55,   2.03,\n        2.20,  -2.98,  -1.99,  -2.20,   0.12,  -0.10,  -0.40,   0.50,\n        1.59,   2.10,   0.00,   0.00,  -1.79,   2.00,  -1.03,   1.40,\n       -1.15,  -1.60,   0.32,   0.50,   1.39,  -1.90,   2.35,  -1.27,\n        1.70,   0.60,   0.80,  -0.32,  -0.40,   1.35,  -1.80,   0.44,\n        0.00,   2.23,  -0.84,   0.90,  -1.27,  -1.40,  -1.47,   1.60,\n       -0.28,  -0.30,  -0.28,   0.40,  -1.27,  -1.70,   0.28,  -0.40,\n       -1.43,  -1.50,   0.00,   0.00,  -1.27,  -1.70,   2.11,  -0.32,\n       -0.40,  -1.23,   1.60,   1.19,  -1.30,  -0.72,  -0.80,   0.72,\n\n   /* 3284-3411 */\n       -0.80,  -1.15,  -1.30,  -1.35,  -1.50,  -1.19,  -1.60,  -0.12,\n        0.20,   1.79,   0.00,  -0.88,  -0.28,   0.40,   1.11,   1.50,\n       -1.83,   0.00,   0.56,  -0.12,   0.10,  -1.27,  -1.40,   0.00,\n        0.00,   1.15,   1.50,  -0.12,   0.20,   1.11,   1.50,   0.36,\n       -0.50,  -1.07,  -1.40,  -1.11,   1.50,   1.67,   0.00,   0.80,\n       -1.11,   0.00,   1.43,   1.23,  -1.30,  -0.24,  -1.19,  -1.30,\n       -0.24,   0.20,  -0.44,  -0.90,  -0.95,   1.10,   1.07,  -1.40,\n        1.15,  -1.30,   1.03,  -1.10,  -0.56,  -0.60,  -0.68,   0.90,\n       -0.76,  -1.00,  -0.24,  -0.30,   0.95,  -1.30,   0.56,   0.70,\n        0.84,  -1.10,  -0.56,   0.00,  -1.55,   0.91,  -1.30,   0.28,\n        0.30,   0.16,  -0.20,   0.95,   1.30,   0.40,  -0.50,  -0.88,\n       -1.20,   0.95,  -1.10,  -0.48,  -0.50,   0.00,   0.00,  -1.07,\n        1.20,   0.44,  -0.50,   0.95,   1.10,   0.00,   0.00,   0.92,\n       -1.30,   0.95,   1.00,  -0.52,   0.60,   1.59,   0.24,  -0.40,\n        0.91,   1.20,   0.84,  -1.10,  -0.44,  -0.60,   0.84,   1.10,\n       -0.44,   0.60,  -0.44,   0.60,  -0.84,  -1.10,  -0.80,   0.00,\n\n   /* 3412-3539 */\n        1.35,   0.76,   0.20,  -0.91,  -1.00,   0.20,  -0.30,  -0.91,\n       -1.20,  -0.95,   1.00,  -0.48,  -0.50,   0.88,   1.00,   0.48,\n       -0.50,  -0.95,  -1.10,   0.20,  -0.20,  -0.99,   1.10,  -0.84,\n        1.10,  -0.24,  -0.30,   0.20,  -0.30,   0.84,   1.10,  -1.39,\n        0.00,  -0.28,  -0.16,   0.20,   0.84,   1.10,   0.00,   0.00,\n        1.39,   0.00,   0.00,  -0.95,   1.00,   1.35,  -0.99,   0.00,\n        0.88,  -0.52,   0.00,  -1.19,   0.20,   0.20,   0.76,  -1.00,\n        0.00,   0.00,   0.76,   1.00,   0.00,   0.00,   0.76,   1.00,\n       -0.76,   1.00,   0.00,   0.00,   1.23,   0.76,   0.80,  -0.32,\n        0.40,  -0.72,   0.80,  -0.40,  -0.40,   0.00,   0.00,  -0.80,\n       -0.90,  -0.68,   0.90,  -0.16,  -0.20,  -0.16,  -0.20,   0.68,\n       -0.90,  -0.36,   0.50,  -0.56,  -0.80,   0.72,  -0.90,   0.44,\n       -0.60,  -0.48,  -0.70,  -0.16,   0.00,  -1.11,   0.32,   0.00,\n       -1.07,   0.60,  -0.80,  -0.28,  -0.40,  -0.64,   0.00,   0.91,\n        1.11,   0.64,  -0.90,   0.76,  -0.80,   0.00,   0.00,  -0.76,\n       -0.80,   1.03,   0.00,  -0.36,  -0.64,  -0.70,   0.36,  -0.40,\n\n   /* 3540-3667 */\n        1.07,   0.36,  -0.50,  -0.52,  -0.70,   0.60,   0.00,   0.88,\n        0.95,   0.00,   0.48,   0.16,  -0.20,   0.60,   0.80,   0.16,\n       -0.20,  -0.60,  -0.80,   0.00,  -1.00,   0.12,   0.20,   0.16,\n       -0.20,   0.68,   0.70,   0.59,  -0.80,  -0.99,  -0.56,  -0.60,\n        0.36,  -0.40,  -0.68,  -0.70,  -0.68,  -0.70,  -0.36,  -0.50,\n       -0.44,   0.60,   0.64,   0.70,  -0.12,   0.10,  -0.52,   0.60,\n        0.36,   0.40,   0.00,   0.00,   0.95,  -0.84,   0.00,   0.44,\n        0.56,   0.60,   0.32,  -0.30,   0.00,   0.00,   0.60,   0.70,\n        0.00,   0.00,   0.60,   0.70,  -0.12,  -0.20,   0.52,  -0.70,\n        0.00,   0.00,   0.56,   0.70,  -0.12,   0.10,  -0.52,  -0.70,\n        0.00,   0.00,   0.88,  -0.76,   0.00,  -0.44,   0.00,   0.00,\n       -0.52,  -0.70,   0.52,  -0.70,   0.36,  -0.40,  -0.44,  -0.50,\n        0.00,   0.00,   0.60,   0.60,   0.84,   0.00,   0.12,  -0.24,\n        0.00,   0.80,  -0.56,   0.60,  -0.32,  -0.30,   0.48,  -0.50,\n        0.28,  -0.30,  -0.48,  -0.50,   0.12,   0.20,   0.48,  -0.60,\n        0.48,   0.60,  -0.12,   0.20,   0.24,   0.00,   0.76,  -0.52,\n\n   /* 3668-3795 */\n       -0.60,  -0.52,   0.60,   0.48,  -0.50,  -0.24,  -0.30,   0.12,\n       -0.10,   0.48,   0.60,   0.52,  -0.20,   0.36,   0.40,  -0.44,\n        0.50,  -0.24,  -0.30,  -0.48,  -0.60,  -0.44,  -0.60,  -0.12,\n        0.10,   0.76,   0.76,   0.20,  -0.20,   0.48,   0.50,   0.40,\n       -0.50,  -0.24,  -0.30,   0.44,  -0.60,   0.44,  -0.60,   0.36,\n        0.00,  -0.64,   0.72,   0.00,  -0.12,   0.00,  -0.10,  -0.40,\n       -0.60,  -0.20,  -0.20,  -0.44,   0.50,  -0.44,   0.50,   0.20,\n        0.20,  -0.44,  -0.50,   0.20,  -0.20,  -0.20,   0.20,  -0.44,\n       -0.50,   0.64,   0.00,   0.32,  -0.36,   0.50,  -0.20,  -0.30,\n        0.12,  -0.10,   0.48,   0.50,  -0.12,   0.30,  -0.36,  -0.50,\n        0.00,   0.00,   0.48,   0.50,  -0.48,   0.50,   0.68,   0.00,\n       -0.12,   0.56,  -0.40,   0.44,  -0.50,  -0.12,  -0.10,   0.24,\n        0.30,  -0.40,   0.40,   0.64,   0.00,  -0.24,   0.64,   0.00,\n       -0.20,   0.00,   0.00,   0.44,  -0.50,   0.44,   0.50,  -0.12,\n        0.20,  -0.36,  -0.50,   0.12,   0.00,   0.64,  -0.40,   0.50,\n        0.00,   0.10,   0.00,   0.00,  -0.40,   0.50,   0.00,   0.00,\n\n   /* 3796-3923 */\n       -0.40,  -0.50,   0.56,   0.00,   0.28,   0.00,   0.10,   0.36,\n        0.50,   0.00,  -0.10,   0.36,  -0.50,   0.36,   0.50,   0.00,\n       -0.10,   0.24,  -0.20,  -0.36,  -0.40,   0.16,   0.20,   0.40,\n       -0.40,   0.00,   0.00,  -0.36,  -0.50,  -0.36,  -0.50,  -0.32,\n       -0.50,  -0.12,   0.10,   0.20,   0.20,  -0.36,   0.40,  -0.60,\n        0.60,   0.28,   0.00,   0.52,   0.12,  -0.10,   0.40,   0.40,\n        0.00,  -0.50,   0.20,  -0.20,  -0.32,   0.40,   0.16,   0.20,\n       -0.16,   0.20,   0.32,   0.40,   0.56,   0.00,  -0.12,   0.32,\n       -0.40,  -0.16,  -0.20,   0.00,   0.00,   0.40,   0.40,  -0.40,\n       -0.40,  -0.40,   0.40,  -0.36,   0.40,   0.12,   0.10,   0.00,\n        0.10,   0.36,   0.40,   0.00,  -0.10,   0.36,   0.40,  -0.36,\n        0.40,   0.00,   0.10,   0.32,   0.00,   0.44,   0.12,   0.20,\n        0.28,  -0.40,   0.00,   0.00,   0.36,   0.40,   0.32,  -0.40,\n       -0.16,   0.12,   0.10,   0.32,  -0.40,   0.20,   0.30,  -0.24,\n        0.30,   0.00,   0.10,   0.32,   0.40,   0.00,  -0.10,  -0.32,\n       -0.40,  -0.32,   0.40,   0.00,   0.10,  -0.52,  -0.52,   0.52,\n\n   /* 3924-4051 */\n        0.32,  -0.40,   0.00,   0.00,   0.32,   0.40,   0.32,  -0.40,\n        0.00,   0.00,  -0.32,  -0.40,  -0.32,   0.40,   0.32,   0.40,\n        0.00,   0.00,   0.32,   0.40,   0.00,   0.00,  -0.32,  -0.40,\n        0.00,   0.00,   0.32,   0.40,   0.16,   0.20,   0.32,  -0.30,\n       -0.16,   0.00,  -0.48,  -0.20,   0.20,  -0.28,  -0.30,   0.28,\n       -0.40,   0.00,   0.00,   0.28,  -0.40,   0.00,   0.00,   0.28,\n       -0.40,   0.00,   0.00,  -0.28,  -0.40,   0.28,   0.40,  -0.28,\n       -0.40,  -0.48,  -0.20,   0.20,   0.24,   0.30,   0.44,   0.00,\n        0.16,   0.24,   0.30,   0.16,  -0.20,   0.24,   0.30,  -0.12,\n        0.20,   0.20,   0.30,  -0.16,   0.20,   0.00,   0.00,   0.44,\n       -0.32,   0.30,   0.24,   0.00,  -0.36,   0.36,   0.00,   0.24,\n        0.12,  -0.20,   0.20,   0.30,  -0.12,   0.00,  -0.28,   0.30,\n       -0.24,   0.30,   0.12,   0.10,  -0.28,  -0.30,  -0.28,   0.30,\n        0.00,   0.00,  -0.28,  -0.30,   0.00,   0.00,  -0.28,  -0.30,\n        0.00,   0.00,   0.28,   0.30,   0.00,   0.00,  -0.28,  -0.30,\n       -0.28,   0.30,   0.00,   0.00,  -0.28,  -0.30,   0.00,   0.00,\n\n   /* 4052-4179 */\n        0.28,   0.30,   0.00,   0.00,  -0.28,   0.30,   0.28,  -0.30,\n       -0.28,   0.30,   0.40,   0.40,  -0.24,   0.30,   0.00,  -0.10,\n        0.16,   0.00,   0.36,  -0.20,   0.30,  -0.12,  -0.10,  -0.24,\n       -0.30,   0.00,   0.00,  -0.24,   0.30,  -0.24,   0.30,   0.00,\n        0.00,  -0.24,   0.30,  -0.24,   0.30,   0.24,  -0.30,   0.00,\n        0.00,   0.24,  -0.30,   0.00,   0.00,   0.24,   0.30,   0.24,\n       -0.30,   0.24,   0.30,  -0.24,   0.30,  -0.24,   0.30,  -0.20,\n        0.20,  -0.16,  -0.20,   0.00,   0.00,  -0.32,   0.20,   0.00,\n        0.10,   0.20,  -0.30,   0.20,  -0.20,   0.12,   0.20,  -0.16,\n        0.20,   0.16,   0.20,   0.20,   0.30,   0.20,   0.30,   0.00,\n        0.00,  -0.20,   0.30,   0.00,   0.00,   0.20,   0.30,  -0.20,\n       -0.30,  -0.20,  -0.30,   0.20,  -0.30,   0.00,   0.00,   0.20,\n        0.30,   0.00,   0.00,   0.20,   0.30,   0.00,   0.00,   0.20,\n        0.30,   0.00,   0.00,   0.20,   0.30,   0.00,   0.00,   0.20,\n       -0.30,   0.00,   0.00,  -0.20,  -0.30,   0.00,   0.00,  -0.20,\n        0.30,   0.00,   0.00,  -0.20,   0.30,   0.00,   0.00,   0.36,\n\n   /* 4180-4307 */\n        0.00,   0.00,   0.36,   0.12,   0.10,  -0.24,   0.20,   0.12,\n       -0.20,  -0.16,  -0.20,  -0.13,   0.10,   0.22,   0.21,   0.20,\n        0.00,  -0.28,   0.32,   0.00,  -0.12,  -0.20,  -0.20,   0.12,\n       -0.10,   0.12,   0.10,  -0.20,   0.20,   0.00,   0.00,  -0.32,\n        0.32,   0.00,   0.00,   0.32,   0.32,   0.00,   0.00,  -0.24,\n       -0.20,   0.24,   0.20,   0.20,   0.00,  -0.24,   0.00,   0.00,\n       -0.24,  -0.20,   0.00,   0.00,   0.24,   0.20,  -0.24,  -0.20,\n        0.00,   0.00,  -0.24,   0.20,   0.16,  -0.20,   0.12,   0.10,\n        0.20,   0.20,   0.00,  -0.10,  -0.12,   0.10,  -0.16,  -0.20,\n       -0.12,  -0.10,  -0.16,   0.20,   0.20,   0.20,   0.00,   0.00,\n       -0.20,   0.20,  -0.20,   0.20,  -0.20,   0.20,  -0.20,   0.20,\n        0.20,  -0.20,  -0.20,  -0.20,   0.00,   0.00,  -0.20,   0.20,\n        0.20,   0.00,  -0.20,   0.00,   0.00,  -0.20,   0.20,  -0.20,\n        0.20,  -0.20,  -0.20,  -0.20,  -0.20,   0.00,   0.00,   0.20,\n        0.20,   0.20,   0.20,   0.12,  -0.20,  -0.12,  -0.10,   0.28,\n       -0.28,   0.16,  -0.20,   0.00,  -0.10,   0.00,   0.10,  -0.16,\n\n   /* 4308-4435 */\n        0.20,   0.00,  -0.10,  -0.16,  -0.20,   0.00,  -0.10,   0.16,\n       -0.20,   0.16,  -0.20,   0.00,   0.00,   0.16,   0.20,  -0.16,\n        0.20,   0.00,   0.00,   0.16,   0.20,   0.16,  -0.20,   0.16,\n       -0.20,  -0.16,   0.20,   0.16,  -0.20,   0.00,   0.00,   0.16,\n        0.20,   0.00,   0.00,   0.16,   0.20,   0.00,   0.00,  -0.16,\n       -0.20,   0.16,  -0.20,  -0.16,  -0.20,   0.00,   0.00,  -0.16,\n       -0.20,   0.00,   0.00,  -0.16,   0.20,   0.00,   0.00,   0.16,\n       -0.20,   0.16,   0.20,   0.16,   0.20,   0.00,   0.00,  -0.16,\n       -0.20,   0.00,   0.00,  -0.16,  -0.20,   0.00,   0.00,   0.16,\n        0.20,   0.16,   0.20,   0.00,   0.00,   0.16,   0.20,   0.16,\n       -0.20,   0.16,   0.20,   0.00,   0.00,  -0.16,   0.20,   0.00,\n        0.10,   0.12,  -0.20,   0.12,  -0.20,   0.00,  -0.10,   0.00,\n       -0.10,   0.12,   0.20,   0.00,  -0.10,  -0.12,   0.20,  -0.15,\n        0.20,  -0.24,   0.24,   0.00,   0.00,   0.24,   0.24,   0.12,\n       -0.20,  -0.12,  -0.20,   0.00,   0.00,   0.12,   0.20,   0.12,\n       -0.20,   0.12,   0.20,   0.12,   0.20,   0.12,   0.20,   0.12,\n\n   /* 4436-4563 */\n       -0.20,  -0.12,   0.20,   0.00,   0.00,   0.12,   0.20,   0.12,\n        0.00,  -0.20,   0.00,   0.00,  -0.12,  -0.20,   0.12,  -0.20,\n        0.00,   0.00,   0.12,   0.20,  -0.12,   0.20,  -0.12,   0.20,\n        0.12,  -0.20,   0.00,   0.00,   0.12,   0.20,   0.20,   0.00,\n        0.12,   0.00,   0.00,  -0.12,   0.20,   0.00,   0.00,  -0.12,\n       -0.20,   0.00,   0.00,  -0.12,  -0.20,  -0.12,  -0.20,   0.00,\n        0.00,   0.12,  -0.20,   0.12,  -0.20,   0.12,   0.20,  -0.12,\n       -0.20,   0.00,   0.00,   0.12,  -0.20,   0.12,  -0.20,   0.12,\n        0.20,   0.12,   0.00,   0.20,  -0.12,  -0.20,   0.00,   0.00,\n        0.12,   0.20,  -0.16,   0.00,   0.16,  -0.20,   0.20,   0.00,\n        0.00,  -0.20,   0.00,   0.00,  -0.20,   0.20,   0.00,   0.00,\n        0.20,   0.20,  -0.20,   0.00,   0.00,  -0.20,   0.12,   0.00,\n       -0.16,   0.20,   0.00,   0.00,   0.20,   0.12,  -0.10,   0.00,\n        0.10,   0.16,  -0.16,  -0.16,  -0.16,  -0.16,  -0.16,   0.00,\n        0.00,  -0.16,   0.00,   0.00,  -0.16,  -0.16,  -0.16,   0.00,\n        0.00,  -0.16,   0.00,   0.00,   0.16,   0.00,   0.00,   0.16,\n\n   /* 4564-4691 */\n        0.00,   0.00,   0.16,   0.16,   0.00,   0.00,  -0.16,   0.00,\n        0.00,  -0.16,  -0.16,   0.00,   0.00,   0.16,   0.00,   0.00,\n       -0.16,  -0.16,   0.00,   0.00,  -0.16,  -0.16,   0.12,   0.10,\n        0.12,  -0.10,   0.12,   0.10,   0.00,   0.00,   0.12,   0.10,\n       -0.12,   0.10,   0.00,   0.00,   0.12,   0.10,   0.12,  -0.10,\n        0.00,   0.00,  -0.12,  -0.10,   0.00,   0.00,   0.12,   0.10,\n        0.12,   0.00,   0.00,   0.12,   0.00,   0.00,  -0.12,   0.00,\n        0.00,   0.12,   0.12,   0.12,   0.12,   0.12,   0.00,   0.00,\n        0.12,   0.00,   0.00,   0.12,   0.12,   0.00,   0.00,   0.12,\n        0.00,   0.00,   0.12,  -0.12,  -0.12,   0.12,   0.12,  -0.12,\n       -0.12,   0.00,   0.00,   0.12,  -0.12,   0.12,   0.12,  -0.12,\n       -0.12,   0.00,   0.00,  -0.12,  -0.12,   0.00,   0.00,  -0.12,\n        0.12,   0.00,   0.00,   0.12,   0.00,   0.00,   0.12,   0.00,\n        0.00,   0.12,  -0.12,   0.00,   0.00,  -0.12,   0.12,  -0.12,\n       -0.12,   0.12,   0.00,   0.00,   0.12,   0.12,   0.12,  -0.12,\n        0.00,   0.00,  -0.12,  -0.12,  -0.12,   0.00,   0.00,  -0.12,\n\n   /* 4692-NA */\n       -0.12,   0.00,   0.00,   0.12,   0.12,   0.00,   0.00,  -0.12,\n       -0.12,  -0.12,  -0.12,   0.12,   0.00,   0.00,   0.12,  -0.12,\n        0.00,   0.00,  -0.12,  -0.12,   0.00,   0.00,   0.12,  -0.12,\n       -0.12,  -0.12,  -0.12,   0.12,   0.12,  -0.12,  -0.12,   0.00,\n        0.00,  -0.12,   0.00,   0.00,  -0.12,   0.12,   0.00,   0.00,\n        0.12,   0.00,   0.00,  -0.12,  -0.12,   0.00,   0.00,  -0.12,\n       -0.12,   0.12,   0.00,   0.00,   0.12,   0.12,   0.00,   0.00,\n        0.12,   0.00,   0.00,   0.12,   0.12,   0.08,   0.00,   0.04\n   };\n\n/* Number of amplitude coefficients */\n   static const int NA = (int) (sizeof a / sizeof (double));\n\n/* Amplitude usage: X or Y, sin or cos, power of T. */\n   static const int jaxy[] = {0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1};\n   static const int jasc[] = {0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0};\n   static const int japt[] = {0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4};\n\n/* Miscellaneous */\n   double t, w, pt[MAXPT+1], fa[14], xypr[2], xypl[2], xyls[2], arg,\n          sc[2];\n   int jpt, i, j, jxy, ialast, ifreq, m, ia, jsc;\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Powers of T. */\n   w = 1.0;\n   for (jpt = 0; jpt <= MAXPT; jpt++) {\n      pt[jpt] = w;\n      w *= t;\n   }\n\n/* Initialize totals in X and Y:  polynomial, luni-solar, planetary. */\n   for (jxy = 0; jxy < 2; jxy++) {\n      xypr[jxy] = 0.0;\n      xyls[jxy] = 0.0;\n      xypl[jxy] = 0.0;\n   }\n\n/* --------------------------------- */\n/* Fundamental arguments (IERS 2003) */\n/* --------------------------------- */\n\n/* Mean anomaly of the Moon. */\n   fa[0] = eraFal03(t);\n\n/* Mean anomaly of the Sun. */\n   fa[1] = eraFalp03(t);\n\n/* Mean argument of the latitude of the Moon. */\n   fa[2] = eraFaf03(t);\n\n/* Mean elongation of the Moon from the Sun. */\n   fa[3] = eraFad03(t);\n\n/* Mean longitude of the ascending node of the Moon. */\n   fa[4] = eraFaom03(t);\n\n/* Planetary longitudes, Mercury through Neptune. */\n   fa[5] = eraFame03(t);\n   fa[6] = eraFave03(t);\n   fa[7] = eraFae03(t);\n   fa[8] = eraFama03(t);\n   fa[9] = eraFaju03(t);\n   fa[10] = eraFasa03(t);\n   fa[11] = eraFaur03(t);\n   fa[12] = eraFane03(t);\n\n/* General accumulated precession in longitude. */\n   fa[13] = eraFapa03(t);\n\n/* -------------------------------------- */\n/* Polynomial part of precession-nutation */\n/* -------------------------------------- */\n\n   for (jxy = 0; jxy < 2; jxy++) {\n      for (j = MAXPT; j >= 0; j--) {\n         xypr[jxy] += xyp[jxy][j] * pt[j];\n      }\n   }\n\n/* ---------------------------------- */\n/* Nutation periodic terms, planetary */\n/* ---------------------------------- */\n\n/* Work backwards through the coefficients per frequency list. */\n   ialast = NA;\n   for (ifreq = NFPL-1; ifreq >= 0; ifreq--) {\n\n   /* Obtain the argument functions. */\n      arg = 0.0;\n      for (i = 0; i < 14; i++) {\n         m = mfapl[ifreq][i];\n         if (m != 0) arg += (double)m * fa[i];\n      }\n      sc[0] = sin(arg);\n      sc[1] = cos(arg);\n\n   /* Work backwards through the amplitudes at this frequency. */\n      ia = nc[ifreq+NFLS];\n      for (i = ialast; i >= ia; i--) {\n\n      /* Coefficient number (0 = 1st). */\n         j = i-ia;\n\n      /* X or Y. */\n         jxy = jaxy[j];\n\n      /* Sin or cos. */\n         jsc = jasc[j];\n\n      /* Power of T. */\n         jpt = japt[j];\n\n      /* Accumulate the component. */\n         xypl[jxy] += a[i-1] * sc[jsc] * pt[jpt];\n      }\n      ialast = ia-1;\n   }\n\n/* ----------------------------------- */\n/* Nutation periodic terms, luni-solar */\n/* ----------------------------------- */\n\n/* Continue working backwards through the number of coefficients list. */\n   for (ifreq = NFLS-1; ifreq >= 0; ifreq--) {\n\n   /* Obtain the argument functions. */\n      arg = 0.0;\n      for (i = 0; i < 5; i++) {\n         m = mfals[ifreq][i];\n         if (m != 0) arg += (double)m * fa[i];\n      }\n      sc[0] = sin(arg);\n      sc[1] = cos(arg);\n\n   /* Work backwards through the amplitudes at this frequency. */\n      ia = nc[ifreq];\n      for (i = ialast; i >= ia; i--) {\n\n      /* Coefficient number (0 = 1st). */\n         j = i-ia;\n\n      /* X or Y. */\n         jxy = jaxy[j];\n\n      /* Sin or cos. */\n         jsc = jasc[j];\n\n      /* Power of T. */\n         jpt = japt[j];\n\n      /* Accumulate the component. */\n         xyls[jxy] += a[i-1] * sc[jsc] * pt[jpt];\n      }\n      ialast = ia-1;\n   }\n\n/* ------------------------------------ */\n/* Results:  CIP unit vector components */\n/* ------------------------------------ */\n\n   *x = ERFA_DAS2R * (xypr[0] + (xyls[0] + xypl[0]) / 1e6);\n   *y = ERFA_DAS2R * (xypr[1] + (xyls[1] + xypl[1]) / 1e6);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"col":4,"comment":"null","endLoc":779,"header":"def _update_grid_contour(self)","id":13269,"name":"_update_grid_contour","nodeType":"Function","startLoc":741,"text":"def _update_grid_contour(self):\n\n        if hasattr(self, '_grid'):\n            for line in self._grid.collections:\n                line.remove()\n\n        xmin, xmax = self.parent_axes.get_xlim()\n        ymin, ymax = self.parent_axes.get_ylim()\n\n        x, y, field = self.transform.get_coord_slices(xmin, xmax, ymin, ymax, 200, 200)\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        field = field[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            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            self._grid = self.parent_axes.contour(x, y, field.transpose(), levels=np.sort(tick_world_coordinates_values))\n        else:\n            self._grid = None"},{"id":13270,"name":"pnm06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPnm06a(double date1, double date2, double rnpb[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P n m 0 6 a\n**  - - - - - - - - - -\n**\n**  Form the matrix of precession-nutation for a given date (including\n**  frame bias), IAU 2006 precession and IAU 2000A nutation models.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rnpb        double[3][3] bias-precession-nutation matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rnpb * V(GCRS), where\n**     the p-vector V(date) is with respect to the true equatorial triad\n**     of date date1+date2 and the p-vector V(GCRS) is with respect to\n**     the Geocentric Celestial Reference System (IAU, 2000).\n**\n**  Called:\n**     eraPfw06     bias-precession F-W angles, IAU 2006\n**     eraNut06a    nutation, IAU 2006/2000A\n**     eraFw2m      F-W angles to r-matrix\n**\n**  Reference:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gamb, phib, psib, epsa, dp, de;\n\n\n/* Fukushima-Williams angles for frame bias and precession. */\n   eraPfw06(date1, date2, &gamb, &phib, &psib, &epsa);\n\n/* Nutation components. */\n   eraNut06a(date1, date2, &dp, &de);\n\n/* Equinox based nutation x precession x bias matrix. */\n   eraFw2m(gamb, phib, psib + dp, epsa + de, rnpb);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13271,"name":"xys00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraXys00a(double date1, double date2,\n               double *x, double *y, double *s)\n/*\n**  - - - - - - - - - -\n**   e r a X y s 0 0 a\n**  - - - - - - - - - -\n**\n**  For a given TT date, compute the X,Y coordinates of the Celestial\n**  Intermediate Pole and the CIO locator s, using the IAU 2000A\n**  precession-nutation model.\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     x,y          double   Celestial Intermediate Pole (Note 2)\n**     s            double   the CIO locator s (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The Celestial Intermediate Pole coordinates are the x,y\n**     components of the unit vector in the Geocentric Celestial\n**     Reference System.\n**\n**  3) The CIO locator s (in radians) positions the Celestial\n**     Intermediate Origin on the equator of the CIP.\n**\n**  4) A faster, but slightly less accurate result (about 1 mas for\n**     X,Y), can be obtained by using instead the eraXys00b function.\n**\n**  Called:\n**     eraPnm00a    classical NPB matrix, IAU 2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS00       the CIO locator s, given X,Y, IAU 2000A\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3];\n\n\n/* Form the bias-precession-nutation matrix, IAU 2000A. */\n   eraPnm00a(date1, date2, rbpn);\n\n/* Extract X,Y. */\n   eraBpn2xy(rbpn, x, y);\n\n/* Obtain s. */\n   *s = eraS00(date1, date2, *x, *y);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13272,"name":"c2i00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2i00a(double date1, double date2, double rc2i[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 i 0 0 a\n**  - - - - - - - - - -\n**\n**  Form the celestial-to-intermediate matrix for a given date using the\n**  IAU 2000A precession-nutation model.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**               =  rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  3) A faster, but slightly less accurate result (about 1 mas), can be\n**     obtained by using instead the eraC2i00b function.\n**\n**  Called:\n**     eraPnm00a    classical NPB matrix, IAU 2000A\n**     eraC2ibpn    celestial-to-intermediate matrix, given NPB matrix\n**\n**  References:\n**\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154\n**     (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3];\n\n\n/* Obtain the celestial-to-true matrix (IAU 2000A). */\n   eraPnm00a(date1, date2, rbpn);\n\n/* Form the celestial-to-intermediate matrix. */\n   eraC2ibpn(date1, date2, rbpn, rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13273,"name":"p2s.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraP2s(double p[3], double *theta, double *phi, double *r)\n/*\n**  - - - - - - -\n**   e r a P 2 s\n**  - - - - - - -\n**\n**  P-vector to spherical polar coordinates.\n**\n**  Given:\n**     p        double[3]    p-vector\n**\n**  Returned:\n**     theta    double       longitude angle (radians)\n**     phi      double       latitude angle (radians)\n**     r        double       radial distance\n**\n**  Notes:\n**\n**  1) If P is null, zero theta, phi and r are returned.\n**\n**  2) At either pole, zero theta is returned.\n**\n**  Called:\n**     eraC2s       p-vector to spherical\n**     eraPm        modulus of p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraC2s(p, theta, phi);\n   *r = eraPm(p);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13274,"name":"ry.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRy(double theta, double r[3][3])\n/*\n**  - - - - - -\n**   e r a R y\n**  - - - - - -\n**\n**  Rotate an r-matrix about the y-axis.\n**\n**  Given:\n**     theta  double          angle (radians)\n**\n**  Given and returned:\n**     r      double[3][3]    r-matrix, rotated\n**\n**  Notes:\n**\n**  1) Calling this function with positive theta incorporates in the\n**     supplied r-matrix r an additional rotation, about the y-axis,\n**     anticlockwise as seen looking towards the origin from positive y.\n**\n**  2) The additional rotation can be represented by this matrix:\n**\n**         (  + cos(theta)     0      - sin(theta)  )\n**         (                                        )\n**         (       0           1           0        )\n**         (                                        )\n**         (  + sin(theta)     0      + cos(theta)  )\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double s, c, a00, a01, a02, a20, a21, a22;\n\n\n   s = sin(theta);\n   c = cos(theta);\n\n   a00 = c*r[0][0] - s*r[2][0];\n   a01 = c*r[0][1] - s*r[2][1];\n   a02 = c*r[0][2] - s*r[2][2];\n   a20 = s*r[0][0] + c*r[2][0];\n   a21 = s*r[0][1] + c*r[2][1];\n   a22 = s*r[0][2] + c*r[2][2];\n\n   r[0][0] = a00;\n   r[0][1] = a01;\n   r[0][2] = a02;\n   r[2][0] = a20;\n   r[2][1] = a21;\n   r[2][2] = a22;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13275,"name":"atciqz.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtciqz(double rc, double dc, eraASTROM *astrom,\n               double *ri, double *di)\n/*\n**  - - - - - - - - - -\n**   e r a A t c i q z\n**  - - - - - - - - - -\n**\n**  Quick ICRS to CIRS transformation, given precomputed star-\n**  independent astrometry parameters, and assuming zero parallax and\n**  proper motion.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are to be transformed for one date.  The\n**  star-independent parameters can be obtained by calling one of the\n**  functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].\n**\n**  The corresponding function for the case of non-zero parallax and\n**  proper motion is eraAtciq.\n**\n**  Given:\n**     rc,dc  double     ICRS astrometric RA,Dec (radians)\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned:\n**     ri,di  double     CIRS RA,Dec (radians)\n**\n**  Note:\n**\n**     All the vectors are with respect to BCRS axes.\n**\n**  References:\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013).\n**\n**     Klioner, Sergei A., \"A practical relativistic model for micro-\n**     arcsecond astrometry in space\", Astr. J. 125, 1580-1597 (2003).\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraLdsun     light deflection due to Sun\n**     eraAb        stellar aberration\n**     eraRxp       product of r-matrix and p-vector\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range +/- pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double pco[3], pnat[3], ppr[3], pi[3], w;\n\n\n/* BCRS coordinate direction (unit vector). */\n   eraS2c(rc, dc, pco);\n\n/* Light deflection by the Sun, giving BCRS natural direction. */\n   eraLdsun(pco, astrom->eh, astrom->em, pnat);\n\n/* Aberration, giving GCRS proper direction. */\n   eraAb(pnat, astrom->v, astrom->em, astrom->bm1, ppr);\n\n/* Bias-precession-nutation, giving CIRS proper direction. */\n   eraRxp(astrom->bpn, ppr, pi);\n\n/* CIRS RA,Dec. */\n   eraC2s(pi, &w, di);\n   *ri = eraAnp(w);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13276,"name":"sepp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraSepp(double a[3], double b[3])\n/*\n**  - - - - - - - -\n**   e r a S e p p\n**  - - - - - - - -\n**\n**  Angular separation between two p-vectors.\n**\n**  Given:\n**     a      double[3]    first p-vector (not necessarily unit length)\n**     b      double[3]    second p-vector (not necessarily unit length)\n**\n**  Returned (function value):\n**            double       angular separation (radians, always positive)\n**\n**  Notes:\n**\n**  1) If either vector is null, a zero result is returned.\n**\n**  2) The angular separation is most simply formulated in terms of\n**     scalar product.  However, this gives poor accuracy for angles\n**     near zero and pi.  The present algorithm uses both cross product\n**     and dot product, to deliver full accuracy whatever the size of\n**     the angle.\n**\n**  Called:\n**     eraPxp       vector product of two p-vectors\n**     eraPm        modulus of p-vector\n**     eraPdp       scalar product of two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double axb[3], ss, cs, s;\n\n\n/* Sine of angle between the vectors, multiplied by the two moduli. */\n   eraPxp(a, b, axb);\n   ss = eraPm(axb);\n\n/* Cosine of the angle, multiplied by the two moduli. */\n   cs = eraPdp(a, b);\n\n/* The angle. */\n   s = ((ss != 0.0) || (cs != 0.0)) ? atan2(ss, cs) : 0.0;\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13277,"name":"lteqec.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLteqec(double epj, double dr, double dd, double *dl, double *db)\n/*\n**  - - - - - - - - - -\n**   e r a L t e q e c\n**  - - - - - - - - - -\n**\n**  Transformation from ICRS equatorial coordinates to ecliptic\n**  coordinates (mean equinox and ecliptic of date) using a long-term\n**  precession model.\n**\n**  Given:\n**     epj     double     Julian epoch (TT)\n**     dr,dd   double     ICRS right ascension and declination (radians)\n**\n**  Returned:\n**     dl,db   double     ecliptic longitude and latitude (radians)\n**\n**  1) No assumptions are made about whether the coordinates represent\n**     starlight and embody astrometric effects such as parallax or\n**     aberration.\n**\n**  2) The transformation is approximately that from mean J2000.0 right\n**     ascension and declination to ecliptic longitude and latitude\n**     (mean equinox and ecliptic of date), with only frame bias (always\n**     less than 25 mas) to disturb this classical picture.\n**\n**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraLtecm     J2000.0 to ecliptic rotation matrix, long term\n**     eraRxp       product of r-matrix and p-vector\n**     eraC2s       unit vector to spherical coordinates\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rm[3][3], v1[3], v2[3], a, b;\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dr, dd, v1);\n\n/* Rotation matrix, ICRS equatorial to ecliptic. */\n   eraLtecm(epj, rm);\n\n/* The transformation from ICRS to ecliptic. */\n   eraRxp(rm, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, &a, &b);\n\n/* Express in conventional ranges. */\n   *dl = eraAnp(a);\n   *db = eraAnpm(b);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13278,"name":"gd2gce.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraGd2gce ( double a, double f, double elong, double phi,\n                double height, double xyz[3] )\n/*\n**  - - - - - - - - - -\n**   e r a G d 2 g c e\n**  - - - - - - - - - -\n**\n**  Transform geodetic coordinates to geocentric for a reference\n**  ellipsoid of specified form.\n**\n**  Given:\n**     a       double     equatorial radius (Notes 1,4)\n**     f       double     flattening (Notes 2,4)\n**     elong   double     longitude (radians, east +ve)\n**     phi     double     latitude (geodetic, radians, Note 4)\n**     height  double     height above ellipsoid (geodetic, Notes 3,4)\n**\n**  Returned:\n**     xyz     double[3]  geocentric vector (Note 3)\n**\n**  Returned (function value):\n**             int        status:  0 = OK\n**                                -1 = illegal case (Note 4)\n**  Notes:\n**\n**  1) The equatorial radius, a, can be in any units, but meters is\n**     the conventional choice.\n**\n**  2) The flattening, f, is (for the Earth) a value around 0.00335,\n**     i.e. around 1/298.\n**\n**  3) The equatorial radius, a, and the height, height, must be\n**     given in the same units, and determine the units of the\n**     returned geocentric vector, xyz.\n**\n**  4) No validation is performed on individual arguments.  The error\n**     status -1 protects against (unrealistic) cases that would lead\n**     to arithmetic exceptions.  If an error occurs, xyz is unchanged.\n**\n**  5) The inverse transformation is performed in the function\n**     eraGc2gde.\n**\n**  6) The transformation for a standard ellipsoid (such as ERFA_WGS84) can\n**     more conveniently be performed by calling eraGd2gc,  which uses a\n**     numerical code to identify the required a and f values.\n**\n**  References:\n**\n**     Green, R.M., Spherical Astronomy, Cambridge University Press,\n**     (1985) Section 4.5, p96.\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 4.22, p202.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double sp, cp, w, d, ac, as, r;\n\n\n/* Functions of geodetic latitude. */\n   sp = sin(phi);\n   cp = cos(phi);\n   w = 1.0 - f;\n   w = w * w;\n   d = cp*cp + w*sp*sp;\n   if ( d <= 0.0 ) return -1;\n   ac = a / sqrt(d);\n   as = w * ac;\n\n/* Geocentric vector. */\n   r = (ac + height) * cp;\n   xyz[0] = r * cos(elong);\n   xyz[1] = r * sin(elong);\n   xyz[2] = (as + height) * sp;\n\n/* Success. */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13279,"name":"ut1tt.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraUt1tt(double ut11, double ut12, double dt,\n             double *tt1, double *tt2)\n/*\n**  - - - - - - - - -\n**   e r a U t 1 t t\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Universal Time, UT1, to Terrestrial\n**  Time, TT.\n**\n**  Given:\n**     ut11,ut12  double    UT1 as a 2-part Julian Date\n**     dt         double    TT-UT1 in seconds\n**\n**  Returned:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) ut11+ut12 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where ut11 is the Julian\n**     Day Number and ut12 is the fraction of a day.  The returned\n**     tt1,tt2 follow suit.\n**\n**  2) The argument dt is classical Delta T.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtd;\n\n\n/* Result, safeguarding precision. */\n   dtd = dt / ERFA_DAYSEC;\n   if ( ut11 > ut12 ) {\n      *tt1 = ut11;\n      *tt2 = ut12 + dtd;\n   } else {\n      *tt1 = ut11 + dtd;\n      *tt2 = ut12;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13280,"name":"c2i06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2i06a(double date1, double date2, double rc2i[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 i 0 6 a\n**  - - - - - - - - - -\n**\n**  Form the celestial-to-intermediate matrix for a given date using the\n**  IAU 2006 precession and IAU 2000A nutation models.\n**\n**  Given:\n**     date1,date2 double       TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rc2i is the first stage in the transformation from\n**     celestial to terrestrial coordinates:\n**\n**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**               =  RC2T * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), ERA is the Earth\n**     Rotation Angle and RPOM is the polar motion matrix.\n**\n**  Called:\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**     eraC2ixys    celestial-to-intermediate matrix, given X,Y and s\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3], x, y, s;\n\n\n/* Obtain the celestial-to-true matrix (IAU 2006/2000A). */\n   eraPnm06a(date1, date2, rbpn);\n\n/* Extract the X,Y coordinates. */\n   eraBpn2xy(rbpn, &x, &y);\n\n/* Obtain the CIO locator. */\n   s = eraS06(date1, date2, x, y);\n\n/* Form the celestial-to-intermediate matrix. */\n   eraC2ixys(x, y, s, rc2i);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13281,"name":"ldn.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLdn(int n, eraLDBODY b[], double ob[3], double sc[3],\n            double sn[3])\n/*+\n**  - - - - - - -\n**   e r a L d n\n**  - - - - - - -\n**\n**  For a star, apply light deflection by multiple solar-system bodies,\n**  as part of transforming coordinate direction into natural direction.\n**\n**  Given:\n**     n    int           number of bodies (note 1)\n**     b    eraLDBODY[n]  data for each of the n bodies (Notes 1,2):\n**      bm   double         mass of the body (solar masses, Note 3)\n**      dl   double         deflection limiter (Note 4)\n**      pv   [2][3]         barycentric PV of the body (au, au/day)\n**     ob   double[3]     barycentric position of the observer (au)\n**     sc   double[3]     observer to star coord direction (unit vector)\n**\n**  Returned:\n**     sn    double[3]      observer to deflected star (unit vector)\n**\n**  1) The array b contains n entries, one for each body to be\n**     considered.  If n = 0, no gravitational light deflection will be\n**     applied, not even for the Sun.\n**\n**  2) The array b should include an entry for the Sun as well as for\n**     any planet or other body to be taken into account.  The entries\n**     should be in the order in which the light passes the body.\n**\n**  3) In the entry in the b array for body i, the mass parameter\n**     b[i].bm can, as required, be adjusted in order to allow for such\n**     effects as quadrupole field.\n**\n**  4) The deflection limiter parameter b[i].dl is phi^2/2, where phi is\n**     the angular separation (in radians) between star and body at\n**     which limiting is applied.  As phi shrinks below the chosen\n**     threshold, the deflection is artificially reduced, reaching zero\n**     for phi = 0.   Example values suitable for a terrestrial\n**     observer, together with masses, are as follows:\n**\n**        body i     b[i].bm        b[i].dl\n**\n**        Sun        1.0            6e-6\n**        Jupiter    0.00095435     3e-9\n**        Saturn     0.00028574     3e-10\n**\n**  5) For cases where the starlight passes the body before reaching the\n**     observer, the body is placed back along its barycentric track by\n**     the light time from that point to the observer.  For cases where\n**     the body is \"behind\" the observer no such shift is applied.  If\n**     a different treatment is preferred, the user has the option of\n**     instead using the eraLd function.  Similarly, eraLd can be used\n**     for cases where the source is nearby, not a star.\n**\n**  6) The returned vector sn is not normalized, but the consequential\n**     departure from unit magnitude is always negligible.\n**\n**  7) The arguments sc and sn can be the same array.\n**\n**  8) For efficiency, validation is omitted.  The supplied masses must\n**     be greater than zero, the position and velocity vectors must be\n**     right, and the deflection limiter greater than zero.\n**\n**  Reference:\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013), Section 7.2.4.\n**\n**  Called:\n**     eraCp        copy p-vector\n**     eraPdp       scalar product of two p-vectors\n**     eraPmp       p-vector minus p-vector\n**     eraPpsp      p-vector plus scaled p-vector\n**     eraPn        decompose p-vector into modulus and direction\n**     eraLd        light deflection by a solar-system body\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Light time for 1 au (days) */\n   const double CR = ERFA_AULT/ERFA_DAYSEC;\n\n   int i;\n   double  v[3], dt, ev[3], em, e[3];\n\n\n/* Star direction prior to deflection. */\n   eraCp(sc, sn);\n\n/* Body by body. */\n   for ( i = 0; i < n; i++ ) {\n\n   /* Body to observer vector at epoch of observation (au). */\n      eraPmp ( ob, b[i].pv[0], v );\n\n   /* Minus the time since the light passed the body (days). */\n      dt = eraPdp(sn,v) * CR;\n\n   /* Neutralize if the star is \"behind\" the observer. */\n      dt = ERFA_GMIN(dt, 0.0);\n\n   /* Backtrack the body to the time the light was passing the body. */\n      eraPpsp(v, -dt, b[i].pv[1], ev);\n\n   /* Body to observer vector as magnitude and direction. */\n      eraPn(ev, &em, e);\n\n   /* Apply light deflection for this body. */\n      eraLd ( b[i].bm, sn, sn, e, em, b[i].dl, sn );\n\n   /* Next body. */\n   }\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13282,"name":"xys00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraXys00b(double date1, double date2,\n               double *x, double *y, double *s)\n/*\n**  - - - - - - - - - -\n**   e r a X y s 0 0 b\n**  - - - - - - - - - -\n**\n**  For a given TT date, compute the X,Y coordinates of the Celestial\n**  Intermediate Pole and the CIO locator s, using the IAU 2000B\n**  precession-nutation model.\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     x,y          double   Celestial Intermediate Pole (Note 2)\n**     s            double   the CIO locator s (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The Celestial Intermediate Pole coordinates are the x,y\n**     components of the unit vector in the Geocentric Celestial\n**     Reference System.\n**\n**  3) The CIO locator s (in radians) positions the Celestial\n**     Intermediate Origin on the equator of the CIP.\n**\n**  4) The present function is faster, but slightly less accurate (about\n**     1 mas in X,Y), than the eraXys00a function.\n**\n**  Called:\n**     eraPnm00b    classical NPB matrix, IAU 2000B\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS00       the CIO locator s, given X,Y, IAU 2000A\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3];\n\n\n/* Form the bias-precession-nutation matrix, IAU 2000A. */\n   eraPnm00b(date1, date2, rbpn);\n\n/* Extract X,Y. */\n   eraBpn2xy(rbpn, x, y);\n\n/* Obtain s. */\n   *s = eraS00(date1, date2, *x, *y);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13283,"name":"nut80.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNut80(double date1, double date2, double *dpsi, double *deps)\n/*\n**  - - - - - - - - -\n**   e r a N u t 8 0\n**  - - - - - - - - -\n**\n**  Nutation, IAU 1980 model.\n**\n**  Given:\n**     date1,date2   double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi          double    nutation in longitude (radians)\n**     deps          double    nutation in obliquity (radians)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The nutation components are with respect to the ecliptic of\n**     date.\n**\n**  Called:\n**     eraAnpm      normalize angle into range +/- pi\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.222 (p111).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, el, elp, f, d, om, dp, de, arg, s, c;\n   int j;\n\n/* Units of 0.1 milliarcsecond to radians */\n   const double U2R = ERFA_DAS2R / 1e4;\n\n/* ------------------------------------------------ */\n/* Table of multiples of arguments and coefficients */\n/* ------------------------------------------------ */\n\n/* The units for the sine and cosine coefficients are 0.1 mas and */\n/* the same per Julian century */\n\n   static const struct {\n      int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */\n      double sp,spt;        /* longitude sine, 1 and t coefficients */\n      double ce,cet;        /* obliquity cosine, 1 and t coefficients */\n   } x[] = {\n\n   /* 1-10 */\n      {  0,  0,  0,  0,  1, -171996.0, -174.2,  92025.0,    8.9 },\n      {  0,  0,  0,  0,  2,    2062.0,    0.2,   -895.0,    0.5 },\n      { -2,  0,  2,  0,  1,      46.0,    0.0,    -24.0,    0.0 },\n      {  2,  0, -2,  0,  0,      11.0,    0.0,      0.0,    0.0 },\n      { -2,  0,  2,  0,  2,      -3.0,    0.0,      1.0,    0.0 },\n      {  1, -1,  0, -1,  0,      -3.0,    0.0,      0.0,    0.0 },\n      {  0, -2,  2, -2,  1,      -2.0,    0.0,      1.0,    0.0 },\n      {  2,  0, -2,  0,  1,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  2, -2,  2,  -13187.0,   -1.6,   5736.0,   -3.1 },\n      {  0,  1,  0,  0,  0,    1426.0,   -3.4,     54.0,   -0.1 },\n\n   /* 11-20 */\n      {  0,  1,  2, -2,  2,    -517.0,    1.2,    224.0,   -0.6 },\n      {  0, -1,  2, -2,  2,     217.0,   -0.5,    -95.0,    0.3 },\n      {  0,  0,  2, -2,  1,     129.0,    0.1,    -70.0,    0.0 },\n      {  2,  0,  0, -2,  0,      48.0,    0.0,      1.0,    0.0 },\n      {  0,  0,  2, -2,  0,     -22.0,    0.0,      0.0,    0.0 },\n      {  0,  2,  0,  0,  0,      17.0,   -0.1,      0.0,    0.0 },\n      {  0,  1,  0,  0,  1,     -15.0,    0.0,      9.0,    0.0 },\n      {  0,  2,  2, -2,  2,     -16.0,    0.1,      7.0,    0.0 },\n      {  0, -1,  0,  0,  1,     -12.0,    0.0,      6.0,    0.0 },\n      { -2,  0,  0,  2,  1,      -6.0,    0.0,      3.0,    0.0 },\n\n   /* 21-30 */\n      {  0, -1,  2, -2,  1,      -5.0,    0.0,      3.0,    0.0 },\n      {  2,  0,  0, -2,  1,       4.0,    0.0,     -2.0,    0.0 },\n      {  0,  1,  2, -2,  1,       4.0,    0.0,     -2.0,    0.0 },\n      {  1,  0,  0, -1,  0,      -4.0,    0.0,      0.0,    0.0 },\n      {  2,  1,  0, -2,  0,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  0, -2,  2,  1,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  1, -2,  2,  0,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  0,  0,  2,       1.0,    0.0,      0.0,    0.0 },\n      { -1,  0,  0,  1,  1,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  2, -2,  0,      -1.0,    0.0,      0.0,    0.0 },\n\n   /* 31-40 */\n      {  0,  0,  2,  0,  2,   -2274.0,   -0.2,    977.0,   -0.5 },\n      {  1,  0,  0,  0,  0,     712.0,    0.1,     -7.0,    0.0 },\n      {  0,  0,  2,  0,  1,    -386.0,   -0.4,    200.0,    0.0 },\n      {  1,  0,  2,  0,  2,    -301.0,    0.0,    129.0,   -0.1 },\n      {  1,  0,  0, -2,  0,    -158.0,    0.0,     -1.0,    0.0 },\n      { -1,  0,  2,  0,  2,     123.0,    0.0,    -53.0,    0.0 },\n      {  0,  0,  0,  2,  0,      63.0,    0.0,     -2.0,    0.0 },\n      {  1,  0,  0,  0,  1,      63.0,    0.1,    -33.0,    0.0 },\n      { -1,  0,  0,  0,  1,     -58.0,   -0.1,     32.0,    0.0 },\n      { -1,  0,  2,  2,  2,     -59.0,    0.0,     26.0,    0.0 },\n\n   /* 41-50 */\n      {  1,  0,  2,  0,  1,     -51.0,    0.0,     27.0,    0.0 },\n      {  0,  0,  2,  2,  2,     -38.0,    0.0,     16.0,    0.0 },\n      {  2,  0,  0,  0,  0,      29.0,    0.0,     -1.0,    0.0 },\n      {  1,  0,  2, -2,  2,      29.0,    0.0,    -12.0,    0.0 },\n      {  2,  0,  2,  0,  2,     -31.0,    0.0,     13.0,    0.0 },\n      {  0,  0,  2,  0,  0,      26.0,    0.0,     -1.0,    0.0 },\n      { -1,  0,  2,  0,  1,      21.0,    0.0,    -10.0,    0.0 },\n      { -1,  0,  0,  2,  1,      16.0,    0.0,     -8.0,    0.0 },\n      {  1,  0,  0, -2,  1,     -13.0,    0.0,      7.0,    0.0 },\n      { -1,  0,  2,  2,  1,     -10.0,    0.0,      5.0,    0.0 },\n\n   /* 51-60 */\n      {  1,  1,  0, -2,  0,      -7.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  2,  0,  2,       7.0,    0.0,     -3.0,    0.0 },\n      {  0, -1,  2,  0,  2,      -7.0,    0.0,      3.0,    0.0 },\n      {  1,  0,  2,  2,  2,      -8.0,    0.0,      3.0,    0.0 },\n      {  1,  0,  0,  2,  0,       6.0,    0.0,      0.0,    0.0 },\n      {  2,  0,  2, -2,  2,       6.0,    0.0,     -3.0,    0.0 },\n      {  0,  0,  0,  2,  1,      -6.0,    0.0,      3.0,    0.0 },\n      {  0,  0,  2,  2,  1,      -7.0,    0.0,      3.0,    0.0 },\n      {  1,  0,  2, -2,  1,       6.0,    0.0,     -3.0,    0.0 },\n      {  0,  0,  0, -2,  1,      -5.0,    0.0,      3.0,    0.0 },\n\n   /* 61-70 */\n      {  1, -1,  0,  0,  0,       5.0,    0.0,      0.0,    0.0 },\n      {  2,  0,  2,  0,  1,      -5.0,    0.0,      3.0,    0.0 },\n      {  0,  1,  0, -2,  0,      -4.0,    0.0,      0.0,    0.0 },\n      {  1,  0, -2,  0,  0,       4.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  0,  1,  0,      -4.0,    0.0,      0.0,    0.0 },\n      {  1,  1,  0,  0,  0,      -3.0,    0.0,      0.0,    0.0 },\n      {  1,  0,  2,  0,  0,       3.0,    0.0,      0.0,    0.0 },\n      {  1, -1,  2,  0,  2,      -3.0,    0.0,      1.0,    0.0 },\n      { -1, -1,  2,  2,  2,      -3.0,    0.0,      1.0,    0.0 },\n      { -2,  0,  0,  0,  1,      -2.0,    0.0,      1.0,    0.0 },\n\n   /* 71-80 */\n      {  3,  0,  2,  0,  2,      -3.0,    0.0,      1.0,    0.0 },\n      {  0, -1,  2,  2,  2,      -3.0,    0.0,      1.0,    0.0 },\n      {  1,  1,  2,  0,  2,       2.0,    0.0,     -1.0,    0.0 },\n      { -1,  0,  2, -2,  1,      -2.0,    0.0,      1.0,    0.0 },\n      {  2,  0,  0,  0,  1,       2.0,    0.0,     -1.0,    0.0 },\n      {  1,  0,  0,  0,  2,      -2.0,    0.0,      1.0,    0.0 },\n      {  3,  0,  0,  0,  0,       2.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  2,  1,  2,       2.0,    0.0,     -1.0,    0.0 },\n      { -1,  0,  0,  0,  2,       1.0,    0.0,     -1.0,    0.0 },\n      {  1,  0,  0, -4,  0,      -1.0,    0.0,      0.0,    0.0 },\n\n   /* 81-90 */\n      { -2,  0,  2,  2,  2,       1.0,    0.0,     -1.0,    0.0 },\n      { -1,  0,  2,  4,  2,      -2.0,    0.0,      1.0,    0.0 },\n      {  2,  0,  0, -4,  0,      -1.0,    0.0,      0.0,    0.0 },\n      {  1,  1,  2, -2,  2,       1.0,    0.0,     -1.0,    0.0 },\n      {  1,  0,  2,  2,  1,      -1.0,    0.0,      1.0,    0.0 },\n      { -2,  0,  2,  4,  2,      -1.0,    0.0,      1.0,    0.0 },\n      { -1,  0,  4,  0,  2,       1.0,    0.0,      0.0,    0.0 },\n      {  1, -1,  0, -2,  0,       1.0,    0.0,      0.0,    0.0 },\n      {  2,  0,  2, -2,  1,       1.0,    0.0,     -1.0,    0.0 },\n      {  2,  0,  2,  2,  2,      -1.0,    0.0,      0.0,    0.0 },\n\n   /* 91-100 */\n      {  1,  0,  0,  2,  1,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  4, -2,  2,       1.0,    0.0,      0.0,    0.0 },\n      {  3,  0,  2, -2,  2,       1.0,    0.0,      0.0,    0.0 },\n      {  1,  0,  2, -2,  0,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  2,  0,  1,       1.0,    0.0,      0.0,    0.0 },\n      { -1, -1,  0,  2,  1,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  0, -2,  0,  1,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  2, -1,  2,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  0,  2,  0,      -1.0,    0.0,      0.0,    0.0 },\n      {  1,  0, -2, -2,  0,      -1.0,    0.0,      0.0,    0.0 },\n\n   /* 101-106 */\n      {  0, -1,  2,  0,  1,      -1.0,    0.0,      0.0,    0.0 },\n      {  1,  1,  0, -2,  1,      -1.0,    0.0,      0.0,    0.0 },\n      {  1,  0, -2,  2,  0,      -1.0,    0.0,      0.0,    0.0 },\n      {  2,  0,  0,  2,  0,       1.0,    0.0,      0.0,    0.0 },\n      {  0,  0,  2,  4,  2,      -1.0,    0.0,      0.0,    0.0 },\n      {  0,  1,  0,  1,  0,       1.0,    0.0,      0.0,    0.0 }\n   };\n\n/* Number of terms in the series */\n   const int NT = (int) (sizeof x / sizeof x[0]);\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental epoch J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* --------------------- */\n/* Fundamental arguments */\n/* --------------------- */\n\n/* Mean longitude of Moon minus mean longitude of Moon's perigee. */\n   el = eraAnpm(\n        (485866.733 + (715922.633 + (31.310 + 0.064 * t) * t) * t)\n        * ERFA_DAS2R + fmod(1325.0 * t, 1.0) * ERFA_D2PI);\n\n/* Mean longitude of Sun minus mean longitude of Sun's perigee. */\n   elp = eraAnpm(\n         (1287099.804 + (1292581.224 + (-0.577 - 0.012 * t) * t) * t)\n         * ERFA_DAS2R + fmod(99.0 * t, 1.0) * ERFA_D2PI);\n\n/* Mean longitude of Moon minus mean longitude of Moon's node. */\n   f = eraAnpm(\n       (335778.877 + (295263.137 + (-13.257 + 0.011 * t) * t) * t)\n       * ERFA_DAS2R + fmod(1342.0 * t, 1.0) * ERFA_D2PI);\n\n/* Mean elongation of Moon from Sun. */\n   d = eraAnpm(\n       (1072261.307 + (1105601.328 + (-6.891 + 0.019 * t) * t) * t)\n       * ERFA_DAS2R + fmod(1236.0 * t, 1.0) * ERFA_D2PI);\n\n/* Longitude of the mean ascending node of the lunar orbit on the */\n/* ecliptic, measured from the mean equinox of date. */\n   om = eraAnpm(\n        (450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t)\n        * ERFA_DAS2R + fmod(-5.0 * t, 1.0) * ERFA_D2PI);\n\n/* --------------- */\n/* Nutation series */\n/* --------------- */\n\n/* Initialize nutation components. */\n   dp = 0.0;\n   de = 0.0;\n\n/* Sum the nutation terms, ending with the biggest. */\n   for (j = NT-1; j >= 0; j--) {\n\n   /* Form argument for current term. */\n      arg = (double)x[j].nl  * el\n          + (double)x[j].nlp * elp\n          + (double)x[j].nf  * f\n          + (double)x[j].nd  * d\n          + (double)x[j].nom * om;\n\n   /* Accumulate current nutation term. */\n      s = x[j].sp + x[j].spt * t;\n      c = x[j].ce + x[j].cet * t;\n      if (s != 0.0) dp += s * sin(arg);\n      if (c != 0.0) de += c * cos(arg);\n   }\n\n/* Convert results from 0.1 mas units to radians. */\n   *dpsi = dp * U2R;\n   *deps = de * U2R;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13284,"name":"ttut1.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTtut1(double tt1, double tt2, double dt,\n             double *ut11, double *ut12)\n/*\n**  - - - - - - - - -\n**   e r a T t u t 1\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Terrestrial Time, TT, to Universal Time,\n**  UT1.\n**\n**  Given:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**     dt         double    TT-UT1 in seconds\n**\n**  Returned:\n**     ut11,ut12  double    UT1 as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tt1+tt2 is Julian Date, apportioned in any convenient way between\n**     the two arguments, for example where tt1 is the Julian Day Number\n**     and tt2 is the fraction of a day.  The returned ut11,ut12 follow\n**     suit.\n**\n**  2) The argument dt is classical Delta T.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dtd;\n\n\n/* Result, safeguarding precision. */\n   dtd = dt / ERFA_DAYSEC;\n   if ( tt1 > tt2 ) {\n      *ut11 = tt1;\n      *ut12 = tt2 - dtd;\n   } else {\n      *ut11 = tt1 - dtd;\n      *ut12 = tt2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13285,"name":"ee00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEe00a(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a E e 0 0 a\n**  - - - - - - - - -\n**\n**  Equation of the equinoxes, compatible with IAU 2000 resolutions.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    equation of the equinoxes (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result, which is in radians, operates in the following sense:\n**\n**        Greenwich apparent ST = GMST + equation of the equinoxes\n**\n**  3) The result is compatible with the IAU 2000 resolutions.  For\n**     further details, see IERS Conventions 2003 and Capitaine et al.\n**     (2002).\n**\n**  Called:\n**     eraPr00      IAU 2000 precession adjustments\n**     eraObl80     mean obliquity, IAU 1980\n**     eraNut00a    nutation, IAU 2000A\n**     eraEe00      equation of the equinoxes, IAU 2000\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003).\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsipr, depspr, epsa, dpsi, deps, ee;\n\n\n/* IAU 2000 precession-rate adjustments. */\n   eraPr00(date1, date2, &dpsipr, &depspr);\n\n/* Mean obliquity, consistent with IAU 2000 precession-nutation. */\n   epsa = eraObl80(date1, date2) + depspr;\n\n/* Nutation in longitude. */\n   eraNut00a(date1, date2, &dpsi, &deps);\n\n/* Equation of the equinoxes. */\n   ee = eraEe00(date1, date2, epsa, dpsi);\n\n   return ee;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13286,"name":"eqec06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraEqec06(double date1, double date2, double dr, double dd,\n               double *dl, double *db)\n/*\n**  - - - - - - - - - -\n**   e r a E q e c 0 6\n**  - - - - - - - - - -\n**\n**  Transformation from ICRS equatorial coordinates to ecliptic\n**  coordinates (mean equinox and ecliptic of date) using IAU 2006\n**  precession model.\n**\n**  Given:\n**     date1,date2 double TT as a 2-part Julian date (Note 1)\n**     dr,dd       double ICRS right ascension and declination (radians)\n**\n**  Returned:\n**     dl,db       double ecliptic longitude and latitude (radians)\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) No assumptions are made about whether the coordinates represent\n**     starlight and embody astrometric effects such as parallax or\n**     aberration.\n**\n**  3) The transformation is approximately that from mean J2000.0 right\n**     ascension and declination to ecliptic longitude and latitude\n**     (mean equinox and ecliptic of date), with only frame bias (always\n**     less than 25 mas) to disturb this classical picture.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006\n**     eraRxp       product of r-matrix and p-vector\n**     eraC2s       unit vector to spherical coordinates\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rm[3][3], v1[3], v2[3], a, b;\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dr, dd, v1);\n\n/* Rotation matrix, ICRS equatorial to ecliptic. */\n   eraEcm06(date1, date2, rm);\n\n/* The transformation from ICRS to ecliptic. */\n   eraRxp(rm, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, &a, &b);\n\n/* Express in conventional ranges. */\n   *dl = eraAnp(a);\n   *db = eraAnpm(b);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13287,"name":"jdcalf.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4])\n/*\n**  - - - - - - - - - -\n**   e r a J d c a l f\n**  - - - - - - - - - -\n**\n**  Julian Date to Gregorian Calendar, expressed in a form convenient\n**  for formatting messages:  rounded to a specified precision.\n**\n**  Given:\n**     ndp       int      number of decimal places of days in fraction\n**     dj1,dj2   double   dj1+dj2 = Julian Date (Note 1)\n**\n**  Returned:\n**     iymdf     int[4]   year, month, day, fraction in Gregorian\n**                        calendar\n**\n**  Returned (function value):\n**               int      status:\n**                          -1 = date out of range\n**                           0 = OK\n**                          +1 = NDP not 0-9 (interpreted as 0)\n**\n**  Notes:\n**\n**  1) The Julian Date is apportioned in any convenient way between\n**     the arguments dj1 and dj2.  For example, JD=2450123.7 could\n**     be expressed in any of these ways, among others:\n**\n**             dj1            dj2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**  2) In early eras the conversion is from the \"Proleptic Gregorian\n**     Calendar\";  no account is taken of the date(s) of adoption of\n**     the Gregorian Calendar, nor is the AD/BC numbering convention\n**     observed.\n**\n**  3) Refer to the function eraJd2cal.\n**\n**  4) NDP should be 4 or less if internal overflows are to be\n**     avoided on machines which use 16-bit integers.\n**\n**  Called:\n**     eraJd2cal    JD to Gregorian calendar\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 12.92 (p604).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j, js;\n   double denom, d1, d2, f1, f2, f;\n\n\n/* Denominator of fraction (e.g. 100 for 2 decimal places). */\n   if ((ndp >= 0) && (ndp <= 9)) {\n      j = 0;\n      denom = pow(10.0, ndp);\n   } else {\n      j = 1;\n      denom = 1.0;\n   }\n\n/* Copy the date, big then small, and realign to midnight. */\n   if (dj1 >= dj2) {\n      d1 = dj1;\n      d2 = dj2;\n   } else {\n      d1 = dj2;\n      d2 = dj1;\n   }\n   d2 -= 0.5;\n\n/* Separate days and fractions. */\n   f1 = fmod(d1, 1.0);\n   f2 = fmod(d2, 1.0);\n   d1 = ERFA_DNINT(d1-f1);\n   d2 = ERFA_DNINT(d2-f2);\n\n/* Round the total fraction to the specified number of places. */\n   f = ERFA_DNINT((f1+f2)*denom) / denom;\n\n/* Re-assemble the rounded date and re-align to noon. */\n   d2 += f + 0.5;\n\n/* Convert to Gregorian calendar. */\n   js = eraJd2cal(d1, d2, &iymdf[0], &iymdf[1], &iymdf[2], &f);\n   if (js == 0) {\n      iymdf[3] = (int) (f * denom);\n   } else {\n      j = js;\n   }\n\n/* Return the status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13288,"name":"c2t06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2t06a(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 t 0 6 a\n**  - - - - - - - - - -\n**\n**  Form the celestial to terrestrial matrix given the date, the UT1 and\n**  the polar motion, using the IAU 2006 precession and IAU 2000A\n**  nutation models.\n**\n**  Given:\n**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)\n**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)\n**     xp,yp    double         coordinates of the pole (radians, Note 2)\n**\n**  Returned:\n**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,\n**     apportioned in any convenient way between the arguments uta and\n**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of\n**     these ways, among others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  In the case of uta,utb, the\n**     date & time method is best matched to the Earth rotation angle\n**     algorithm used:  maximum precision is delivered when the uta\n**     argument is for 0hrs UT1 on the day in question and the utb\n**     argument lies in the range 0 to 1, or vice versa.\n**\n**  2) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  3) The matrix rc2t transforms from celestial to terrestrial\n**     coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), RC2I is the\n**     celestial-to-intermediate matrix, ERA is the Earth rotation\n**     angle and RPOM is the polar motion matrix.\n**\n**  Called:\n**     eraC2i06a    celestial-to-intermediate matrix, IAU 2006/2000A\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraPom00     polar motion matrix\n**     eraC2tcio    form CIO-based celestial-to-terrestrial matrix\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rc2i[3][3], era, sp, rpom[3][3];\n\n\n/* Form the celestial-to-intermediate matrix for this TT. */\n   eraC2i06a(tta, ttb, rc2i);\n\n/* Predict the Earth rotation angle for this UT1. */\n   era = eraEra00(uta, utb);\n\n/* Estimate s'. */\n   sp = eraSp00(tta, ttb);\n\n/* Form the polar motion matrix. */\n   eraPom00(xp, yp, sp, rpom);\n\n/* Combine to form the celestial-to-terrestrial matrix. */\n   eraC2tcio(rc2i, era, rpom, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13289,"name":"rz.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRz(double psi, double r[3][3])\n/*\n**  - - - - - -\n**   e r a R z\n**  - - - - - -\n**\n**  Rotate an r-matrix about the z-axis.\n**\n**  Given:\n**     psi    double          angle (radians)\n**\n**  Given and returned:\n**     r      double[3][3]    r-matrix, rotated\n**\n**  Notes:\n**\n**  1) Calling this function with positive psi incorporates in the\n**     supplied r-matrix r an additional rotation, about the z-axis,\n**     anticlockwise as seen looking towards the origin from positive z.\n**\n**  2) The additional rotation can be represented by this matrix:\n**\n**         (  + cos(psi)   + sin(psi)     0  )\n**         (                                 )\n**         (  - sin(psi)   + cos(psi)     0  )\n**         (                                 )\n**         (       0            0         1  )\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double s, c, a00, a01, a02, a10, a11, a12;\n\n\n   s = sin(psi);\n   c = cos(psi);\n\n   a00 =   c*r[0][0] + s*r[1][0];\n   a01 =   c*r[0][1] + s*r[1][1];\n   a02 =   c*r[0][2] + s*r[1][2];\n   a10 = - s*r[0][0] + c*r[1][0];\n   a11 = - s*r[0][1] + c*r[1][1];\n   a12 = - s*r[0][2] + c*r[1][2];\n\n   r[0][0] = a00;\n   r[0][1] = a01;\n   r[0][2] = a02;\n   r[1][0] = a10;\n   r[1][1] = a11;\n   r[1][2] = a12;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13290,"name":"s2xpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraS2xpv(double s1, double s2, double pv[2][3], double spv[2][3])\n/*\n**  - - - - - - - - -\n**   e r a S 2 x p v\n**  - - - - - - - - -\n**\n**  Multiply a pv-vector by two scalars.\n**\n**  Given:\n**     s1     double         scalar to multiply position component by\n**     s2     double         scalar to multiply velocity component by\n**     pv     double[2][3]   pv-vector\n**\n**  Returned:\n**     spv    double[2][3]   pv-vector: p scaled by s1, v scaled by s2\n**\n**  Note:\n**     It is permissible for pv and spv to be the same array.\n**\n**  Called:\n**     eraSxp       multiply p-vector by scalar\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraSxp(s1, pv[0], spv[0]);\n   eraSxp(s2, pv[1], spv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13291,"name":"pas.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraPas(double al, double ap, double bl, double bp)\n/*\n**  - - - - - - -\n**   e r a P a s\n**  - - - - - - -\n**\n**  Position-angle from spherical coordinates.\n**\n**  Given:\n**     al     double     longitude of point A (e.g. RA) in radians\n**     ap     double     latitude of point A (e.g. Dec) in radians\n**     bl     double     longitude of point B\n**     bp     double     latitude of point B\n**\n**  Returned (function value):\n**            double     position angle of B with respect to A\n**\n**  Notes:\n**\n**  1) The result is the bearing (position angle), in radians, of point\n**     B with respect to point A.  It is in the range -pi to +pi.  The\n**     sense is such that if B is a small distance \"east\" of point A,\n**     the bearing is approximately +pi/2.\n**\n**  2) Zero is returned if the two points are coincident.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dl, x, y, pa;\n\n\n   dl = bl - al;\n   y = sin(dl) * cos(bp);\n   x = sin(bp) * cos(ap) - cos(bp) * sin(ap) * cos(dl);\n   pa = ((x != 0.0) || (y != 0.0)) ? atan2(y, x) : 0.0;\n\n   return pa;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13292,"name":"refco.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRefco(double phpa, double tc, double rh, double wl,\n              double *refa, double *refb)\n/*\n**  - - - - - - - - -\n**   e r a R e f c o\n**  - - - - - - - - -\n**\n**  Determine the constants A and B in the atmospheric refraction model\n**  dZ = A tan Z + B tan^3 Z.\n**\n**  Z is the \"observed\" zenith distance (i.e. affected by refraction)\n**  and dZ is what to add to Z to give the \"topocentric\" (i.e. in vacuo)\n**  zenith distance.\n**\n**  Given:\n**    phpa   double    pressure at the observer (hPa = millibar)\n**    tc     double    ambient temperature at the observer (deg C)\n**    rh     double    relative humidity at the observer (range 0-1)\n**    wl     double    wavelength (micrometers)\n**\n**  Returned:\n**    refa   double*   tan Z coefficient (radians)\n**    refb   double*   tan^3 Z coefficient (radians)\n**\n**  Notes:\n**\n**  1) The model balances speed and accuracy to give good results in\n**     applications where performance at low altitudes is not paramount.\n**     Performance is maintained across a range of conditions, and\n**     applies to both optical/IR and radio.\n**\n**  2) The model omits the effects of (i) height above sea level (apart\n**     from the reduced pressure itself), (ii) latitude (i.e. the\n**     flattening of the Earth), (iii) variations in tropospheric lapse\n**     rate and (iv) dispersive effects in the radio.\n**\n**     The model was tested using the following range of conditions:\n**\n**       lapse rates 0.0055, 0.0065, 0.0075 deg/meter\n**       latitudes 0, 25, 50, 75 degrees\n**       heights 0, 2500, 5000 meters ASL\n**       pressures mean for height -10% to +5% in steps of 5%\n**       temperatures -10 deg to +20 deg with respect to 280 deg at SL\n**       relative humidity 0, 0.5, 1\n**       wavelengths 0.4, 0.6, ... 2 micron, + radio\n**       zenith distances 15, 45, 75 degrees\n**\n**     The accuracy with respect to raytracing through a model\n**     atmosphere was as follows:\n**\n**                            worst         RMS\n**\n**       optical/IR           62 mas       8 mas\n**       radio               319 mas      49 mas\n**\n**     For this particular set of conditions:\n**\n**       lapse rate 0.0065 K/meter\n**       latitude 50 degrees\n**       sea level\n**       pressure 1005 mb\n**       temperature 280.15 K\n**       humidity 80%\n**       wavelength 5740 Angstroms\n**\n**     the results were as follows:\n**\n**       ZD       raytrace     eraRefco   Saastamoinen\n**\n**       10         10.27        10.27        10.27\n**       20         21.19        21.20        21.19\n**       30         33.61        33.61        33.60\n**       40         48.82        48.83        48.81\n**       45         58.16        58.18        58.16\n**       50         69.28        69.30        69.27\n**       55         82.97        82.99        82.95\n**       60        100.51       100.54       100.50\n**       65        124.23       124.26       124.20\n**       70        158.63       158.68       158.61\n**       72        177.32       177.37       177.31\n**       74        200.35       200.38       200.32\n**       76        229.45       229.43       229.42\n**       78        267.44       267.29       267.41\n**       80        319.13       318.55       319.10\n**\n**      deg        arcsec       arcsec       arcsec\n**\n**     The values for Saastamoinen's formula (which includes terms\n**     up to tan^5) are taken from Hohenkerk and Sinclair (1985).\n**\n**  3) A wl value in the range 0-100 selects the optical/IR case and is\n**     wavelength in micrometers.  Any value outside this range selects\n**     the radio case.\n**\n**  4) Outlandish input parameters are silently limited to\n**     mathematically safe values.  Zero pressure is permissible, and\n**     causes zeroes to be returned.\n**\n**  5) The algorithm draws on several sources, as follows:\n**\n**     a) The formula for the saturation vapour pressure of water as\n**        a function of temperature and temperature is taken from\n**        Equations (A4.5-A4.7) of Gill (1982).\n**\n**     b) The formula for the water vapour pressure, given the\n**        saturation pressure and the relative humidity, is from\n**        Crane (1976), Equation (2.5.5).\n**\n**     c) The refractivity of air is a function of temperature,\n**        total pressure, water-vapour pressure and, in the case\n**        of optical/IR, wavelength.  The formulae for the two cases are\n**        developed from Hohenkerk & Sinclair (1985) and Rueger (2002).\n**\n**     d) The formula for beta, the ratio of the scale height of the\n**        atmosphere to the geocentric distance of the observer, is\n**        an adaption of Equation (9) from Stone (1996).  The\n**        adaptations, arrived at empirically, consist of (i) a small\n**        adjustment to the coefficient and (ii) a humidity term for the\n**        radio case only.\n**\n**     e) The formulae for the refraction constants as a function of\n**        n-1 and beta are from Green (1987), Equation (4.31).\n**\n**  References:\n**\n**     Crane, R.K., Meeks, M.L. (ed), \"Refraction Effects in the Neutral\n**     Atmosphere\", Methods of Experimental Physics: Astrophysics 12B,\n**     Academic Press, 1976.\n**\n**     Gill, Adrian E., \"Atmosphere-Ocean Dynamics\", Academic Press,\n**     1982.\n**\n**     Green, R.M., \"Spherical Astronomy\", Cambridge University Press,\n**     1987.\n**\n**     Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63,\n**     1985.\n**\n**     Rueger, J.M., \"Refractive Index Formulae for Electronic Distance\n**     Measurement with Radio and Millimetre Waves\", in Unisurv Report\n**     S-68, School of Surveying and Spatial Information Systems,\n**     University of New South Wales, Sydney, Australia, 2002.\n**\n**     Stone, Ronald C., P.A.S.P. 108, 1051-1058, 1996.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int optic;\n   double p, t, r, w, ps, pw, tk, wlsq, gamma, beta;\n\n\n/* Decide whether optical/IR or radio case:  switch at 100 microns. */\n   optic = ( wl <= 100.0 );\n\n/* Restrict parameters to safe values. */\n   t = ERFA_GMAX ( tc, -150.0 );\n   t = ERFA_GMIN ( t, 200.0 );\n   p = ERFA_GMAX ( phpa, 0.0 );\n   p = ERFA_GMIN ( p, 10000.0 );\n   r = ERFA_GMAX ( rh, 0.0 );\n   r = ERFA_GMIN ( r, 1.0 );\n   w = ERFA_GMAX ( wl, 0.1 );\n   w = ERFA_GMIN ( w, 1e6 );\n\n/* Water vapour pressure at the observer. */\n   if ( p > 0.0 ) {\n      ps = pow ( 10.0, ( 0.7859 + 0.03477*t ) /\n                          ( 1.0 + 0.00412*t ) ) *\n                 ( 1.0 + p * ( 4.5e-6 + 6e-10*t*t )  );\n      pw = r * ps / ( 1.0 - (1.0-r)*ps/p );\n   } else {\n      pw = 0.0;\n   }\n\n/* Refractive index minus 1 at the observer. */\n   tk = t + 273.15;\n   if ( optic ) {\n      wlsq = w * w;\n      gamma = ( ( 77.53484e-6 +\n                 ( 4.39108e-7 + 3.666e-9/wlsq ) / wlsq ) * p\n                    - 11.2684e-6*pw ) / tk;\n   } else {\n      gamma = ( 77.6890e-6*p - ( 6.3938e-6 - 0.375463/tk ) * pw ) / tk;\n   }\n\n/* Formula for beta from Stone, with empirical adjustments. */\n   beta = 4.4474e-6 * tk;\n   if ( ! optic ) beta -= 0.0074 * pw * beta;\n\n/* Refraction constants from Green. */\n   *refa = gamma * ( 1.0 - beta );\n   *refb = - gamma * ( beta - gamma / 2.0 );\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13293,"name":"taitt.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTaitt(double tai1, double tai2, double *tt1, double *tt2)\n/*\n**  - - - - - - - - -\n**   e r a T a i t t\n**  - - - - - - - - -\n**\n**  Time scale transformation:  International Atomic Time, TAI, to\n**  Terrestrial Time, TT.\n**\n**  Given:\n**     tai1,tai2  double    TAI as a 2-part Julian Date\n**\n**  Returned:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Note:\n**\n**     tai1+tai2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tai1 is the Julian\n**     Day Number and tai2 is the fraction of a day.  The returned\n**     tt1,tt2 follow suit.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* TT minus TAI (days). */\n   static const double dtat = ERFA_TTMTAI/ERFA_DAYSEC;\n\n\n/* Result, safeguarding precision. */\n   if ( tai1 > tai2 ) {\n      *tt1 = tai1;\n      *tt2 = tai2 + dtat;\n   } else {\n      *tt1 = tai1 + dtat;\n      *tt2 = tai2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13294,"name":"jd2cal.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraJd2cal(double dj1, double dj2,\n              int *iy, int *im, int *id, double *fd)\n/*\n**  - - - - - - - - - -\n**   e r a J d 2 c a l\n**  - - - - - - - - - -\n**\n**  Julian Date to Gregorian year, month, day, and fraction of a day.\n**\n**  Given:\n**     dj1,dj2   double   Julian Date (Notes 1, 2)\n**\n**  Returned (arguments):\n**     iy        int      year\n**     im        int      month\n**     id        int      day\n**     fd        double   fraction of day\n**\n**  Returned (function value):\n**               int      status:\n**                           0 = OK\n**                          -1 = unacceptable date (Note 1)\n**\n**  Notes:\n**\n**  1) The earliest valid date is -68569.5 (-4900 March 1).  The\n**     largest value accepted is 1e9.\n**\n**  2) The Julian Date is apportioned in any convenient way between\n**     the arguments dj1 and dj2.  For example, JD=2450123.7 could\n**     be expressed in any of these ways, among others:\n**\n**            dj1             dj2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**  3) In early eras the conversion is from the \"proleptic Gregorian\n**     calendar\";  no account is taken of the date(s) of adoption of\n**     the Gregorian calendar, nor is the AD/BC numbering convention\n**     observed.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 12.92 (p604).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Minimum and maximum allowed JD */\n   const double DJMIN = -68569.5;\n   const double DJMAX = 1e9;\n\n   long jd, l, n, i, k;\n   double dj, d1, d2, f1, f2, f, d;\n\n\n/* Verify date is acceptable. */\n   dj = dj1 + dj2;\n   if (dj < DJMIN || dj > DJMAX) return -1;\n\n/* Copy the date, big then small, and re-align to midnight. */\n   if (dj1 >= dj2) {\n      d1 = dj1;\n      d2 = dj2;\n   } else {\n      d1 = dj2;\n      d2 = dj1;\n   }\n   d2 -= 0.5;\n\n/* Separate day and fraction. */\n   f1 = fmod(d1, 1.0);\n   f2 = fmod(d2, 1.0);\n   f = fmod(f1 + f2, 1.0);\n   if (f < 0.0) f += 1.0;\n   d = ERFA_DNINT(d1-f1) + ERFA_DNINT(d2-f2) + ERFA_DNINT(f1+f2-f);\n   jd = (long) ERFA_DNINT(d) + 1L;\n\n/* Express day in Gregorian calendar. */\n   l = jd + 68569L;\n   n = (4L * l) / 146097L;\n   l -= (146097L * n + 3L) / 4L;\n   i = (4000L * (l + 1L)) / 1461001L;\n   l -= (1461L * i) / 4L - 31L;\n   k = (80L * l) / 2447L;\n   *id = (int) (l - (2447L * k) / 80L);\n   l = k / 11L;\n   *im = (int) (k + 2L - 12L * l);\n   *iy = (int) (100L * (n - 49L) + i + l);\n   *fd = f;\n\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13295,"name":"anp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraAnp(double a)\n/*\n**  - - - - - - -\n**   e r a A n p\n**  - - - - - - -\n**\n**  Normalize angle into the range 0 <= a < 2pi.\n**\n**  Given:\n**     a        double     angle (radians)\n**\n**  Returned (function value):\n**              double     angle in range 0-2pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double w;\n\n\n   w = fmod(a, ERFA_D2PI);\n   if (w < 0) w += ERFA_D2PI;\n\n   return w;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13296,"name":"taiutc.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTaiutc(double tai1, double tai2, double *utc1, double *utc2)\n/*\n**  - - - - - - - - - -\n**   e r a T a i u t c\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  International Atomic Time, TAI, to\n**  Coordinated Universal Time, UTC.\n**\n**  Given:\n**     tai1,tai2  double   TAI as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-3)\n**\n**  Returned (function value):\n**                int      status: +1 = dubious year (Note 4)\n**                                  0 = OK\n**                                 -1 = unacceptable date\n**\n**  Notes:\n**\n**  1) tai1+tai2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tai1 is the Julian\n**     Day Number and tai2 is the fraction of a day.  The returned utc1\n**     and utc2 form an analogous pair, except that a special convention\n**     is used, to deal with the problem of leap seconds - see the next\n**     note.\n**\n**  2) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The convention in the present\n**     function is that the JD day represents UTC days whether the\n**     length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era\n**     there were smaller jumps (in either direction) each time the\n**     linear UTC(TAI) expression was changed, and these \"mini-leaps\"\n**     are also included in the ERFA convention.\n**\n**  3) The function eraD2dtf can be used to transform the UTC quasi-JD\n**     into calendar date and clock time, including UTC leap second\n**     handling.\n**\n**  4) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  Called:\n**     eraUtctai    UTC to TAI\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int big1;\n   int i, j;\n   double a1, a2, u1, u2, g1, g2;\n\n\n/* Put the two parts of the TAI into big-first order. */\n   big1 = ( tai1 >= tai2 );\n   if ( big1 ) {\n      a1 = tai1;\n      a2 = tai2;\n   } else {\n      a1 = tai2;\n      a2 = tai1;\n   }\n\n/* Initial guess for UTC. */\n   u1 = a1;\n   u2 = a2;\n\n/* Iterate (though in most cases just once is enough). */\n   for ( i = 0; i < 3; i++ ) {\n\n   /* Guessed UTC to TAI. */\n      j = eraUtctai(u1, u2, &g1, &g2);\n      if ( j < 0 ) return j;\n\n   /* Adjust guessed UTC. */\n      u2 += a1 - g1;\n      u2 += a2 - g2;\n   }\n\n/* Return the UTC result, preserving the TAI order. */\n   if ( big1 ) {\n      *utc1 = u1;\n      *utc2 = u2;\n   } else {\n      *utc1 = u2;\n      *utc2 = u1;\n   }\n\n/* Status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13297,"name":"README.rst","nodeType":"TextFile","path":"cextern/erfa","text":"This is the source code repository for ERFA (Essential Routines for\nFundamental Astronomy).  ERFA is a C library containing key algorithms for\nastronomy, and is based on the `SOFA library <http://www.iausofa.org/>`_ published by the International\nAstronomical Union (IAU).\n\nERFA is intended to replicate the functionality of SOFA (aside from possible\nbugfixes in ERFA that have not yet been included in SOFA), but is licensed\nunder a three-clause BSD license to enable its compatibility with a wide\nrange of open source licenses. Permission for this release has been\nobtained from the SOFA board, and is avilable in the ``LICENSE`` file included\nin this source distribution.\n\nDifferences from SOFA\n---------------------\n\nThis version of ERFA (v1.3.0) is based on SOFA version \"20160503_a\", with the\ndifferences outlined below.\n\nERFA branding\n^^^^^^^^^^^^^\n\nAll references to \"SOFA\" in the source code have been changed to ERFA, and\nfunctions have the prefix ``era`` instead of ``iau``.\n\nC macro prefixes\n^^^^^^^^^^^^^^^^\n\nAll C macros used in ERFA are the same as their SOFA equivalents, but with an\n``ERFA_`` prefix to prevent namespace collisions.\n\nBugfixes\n^^^^^^^^\n\nERFA includes smaller changes that may or may not eventually make it into SOFA,\naddressing localized bugs or similar smaller issues:\n\n* ERFA 1.4.0 and SOFA \"20170420\"\n\n  + ERFA 1.4.0 adds the ``eraVersion`` and ``eraSofaVersion`` functions to\n    determine the installed version of ERFA (and the SOFA version it is derived\n    from).\n\n  + ERFA 1.4.0 includes some bug fixes contributed to ERFA after 1.3.0 but\n    before 1.4.0.  These were incorporated (with modification) into\n    SOFA \"20170420\" (without attribution) and hence these are not differences\n    between ERFA and SOFA. (See https://github.com/liberfa/erfa/issues/40 and\n    https://github.com/liberfa/erfa/issues/41)\n\n* ERFA 1.3.0 and SOFA \"20160503_a\"\n\n  + There are no differences between ERFA 1.3.0 and SOFA \"20160503_a\".\n\n* ERFA 1.2.0 and SOFA \"20150209_a\"\n\n  + Typos have been corrected in the documentation of atco13 and atio13 (see https://github.com/liberfa/erfa/issues/29).\n\nNote that issues identified in ERFA should generally also be reported upstream to SOFA at sofa@ukho.gov.uk.\n\nBuilding and installing ERFA\n----------------------------\n\nTo build and install a released version of ERFA in your OS's standard\nlocation, simply do::\n\n    ./configure\n    make\n    make install\n\nIf you want to run the tests to make sure ERFA built correctly, before\ninstalling do::\n\n    make check\n\n\nFor developers\n^^^^^^^^^^^^^^\n\nIf you are using a developer version from github, you will need to first do\n``./bootstrap.sh`` before the above commands. This requires ``autoconf`` and\n``libtool``.\n\nIf you wish to build against the ERFA static library without installing, you\nwill find it in ``$ERFAROOT/src/.libs/liberfa.a`` after running ``make``.\n\nCreating a single-file version of the source code\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAlternatively, if you wish to bundle the ERFA source code with a separate\npackage, you can use the ``source_flattener.py`` script from the\n`erfa-fetch repository`_ to combine\nthe ERFA source code into just two files: a ``erfa.c`` source file, and an\n``erfa.h`` include file.  You should run this script like this::\n\n    cd /path/to/erfa-source-code\n    python /path/to/erfa-fetch/source_flattener.py src -n erfa\n\nIf possible, however, it is recommended that you provide an option to use any\ncopy of the ERFA library that is already installed on the system.\n\nTravis build status\n-------------------\n.. image:: https://travis-ci.org/liberfa/erfa.png\n    :target: https://travis-ci.org/liberfa/erfa\n\n.. _erfa-fetch repository: https://github.com/liberfa/erfa-fetch\n"},{"id":13298,"name":"ee00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEe00b(double date1, double date2)\n/*\n**  - - - - - - - - -\n**   e r a E e 0 0 b\n**  - - - - - - - - -\n**\n**  Equation of the equinoxes, compatible with IAU 2000 resolutions but\n**  using the truncated nutation model IAU 2000B.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    equation of the equinoxes (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The result, which is in radians, operates in the following sense:\n**\n**        Greenwich apparent ST = GMST + equation of the equinoxes\n**\n**  3) The result is compatible with the IAU 2000 resolutions except\n**     that accuracy has been compromised for the sake of speed.  For\n**     further details, see McCarthy & Luzum (2001), IERS Conventions\n**     2003 and Capitaine et al. (2003).\n**\n**  Called:\n**     eraPr00      IAU 2000 precession adjustments\n**     eraObl80     mean obliquity, IAU 1980\n**     eraNut00b    nutation, IAU 2000B\n**     eraEe00      equation of the equinoxes, IAU 2000\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     McCarthy, D.D. & Luzum, B.J., \"An abridged model of the\n**     precession-nutation of the celestial pole\", Celestial Mechanics &\n**     Dynamical Astronomy, 85, 37-49 (2003)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsipr, depspr, epsa, dpsi, deps, ee;\n\n\n/* IAU 2000 precession-rate adjustments. */\n   eraPr00(date1, date2, &dpsipr, &depspr);\n\n/* Mean obliquity, consistent with IAU 2000 precession-nutation. */\n   epsa = eraObl80(date1, date2) + depspr;\n\n/* Nutation in longitude. */\n   eraNut00b(date1, date2, &dpsi, &deps);\n\n/* Equation of the equinoxes. */\n   ee = eraEe00(date1, date2, epsa, dpsi);\n\n   return ee;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13299,"name":"tf2d.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n#include <stdlib.h>\n\nint eraTf2d(char s, int ihour, int imin, double sec, double *days)\n/*\n**  - - - - - - - -\n**   e r a T f 2 d\n**  - - - - - - - -\n**\n**  Convert hours, minutes, seconds to days.\n**\n**  Given:\n**     s         char    sign:  '-' = negative, otherwise positive\n**     ihour     int     hours\n**     imin      int     minutes\n**     sec       double  seconds\n**\n**  Returned:\n**     days      double  interval in days\n**\n**  Returned (function value):\n**               int     status:  0 = OK\n**                                1 = ihour outside range 0-23\n**                                2 = imin outside range 0-59\n**                                3 = sec outside range 0-59.999...\n**\n**  Notes:\n**\n**  1)  The result is computed even if any of the range checks fail.\n**\n**  2)  Negative ihour, imin and/or sec produce a warning status, but\n**      the absolute value is used in the conversion.\n**\n**  3)  If there are multiple errors, the status value reflects only the\n**      first, the smallest taking precedence.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Compute the interval. */\n   *days  = ( s == '-' ? -1.0 : 1.0 ) *\n            ( 60.0 * ( 60.0 * ( (double) abs(ihour) ) +\n                              ( (double) abs(imin) ) ) +\n                                         fabs(sec) ) / ERFA_DAYSEC;\n\n/* Validate arguments and return status. */\n   if ( ihour < 0 || ihour > 23 ) return 1;\n   if ( imin < 0 || imin > 59 ) return 2;\n   if ( sec < 0.0 || sec >= 60.0 ) return 3;\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13300,"name":"utctai.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraUtctai(double utc1, double utc2, double *tai1, double *tai2)\n/*\n**  - - - - - - - - - -\n**   e r a U t c t a i\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Coordinated Universal Time, UTC, to\n**  International Atomic Time, TAI.\n**\n**  Given:\n**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)\n**\n**  Returned:\n**     tai1,tai2  double   TAI as a 2-part Julian Date (Note 5)\n**\n**  Returned (function value):\n**                int      status: +1 = dubious year (Note 3)\n**                                  0 = OK\n**                                 -1 = unacceptable date\n**\n**  Notes:\n**\n**  1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**     convenient way between the two arguments, for example where utc1\n**     is the Julian Day Number and utc2 is the fraction of a day.\n**\n**  2) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The convention in the present\n**     function is that the JD day represents UTC days whether the\n**     length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era\n**     there were smaller jumps (in either direction) each time the\n**     linear UTC(TAI) expression was changed, and these \"mini-leaps\"\n**     are also included in the ERFA convention.\n**\n**  3) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  4) The function eraDtf2d converts from calendar date and time of day\n**     into 2-part Julian Date, and in the case of UTC implements the\n**     leap-second-ambiguity convention described above.\n**\n**  5) The returned TAI1,TAI2 are such that their sum is the TAI Julian\n**     Date.\n**\n**  Called:\n**     eraJd2cal    JD to Gregorian calendar\n**     eraDat       delta(AT) = TAI-UTC\n**     eraCal2jd    Gregorian calendar to JD\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int big1;\n   int iy, im, id, j, iyt, imt, idt;\n   double u1, u2, fd, dat0, dat12, w, dat24, dlod, dleap, z1, z2, a2;\n\n\n/* Put the two parts of the UTC into big-first order. */\n   big1 = ( utc1 >= utc2 );\n   if ( big1 ) {\n      u1 = utc1;\n      u2 = utc2;\n   } else {\n      u1 = utc2;\n      u2 = utc1;\n   }\n\n/* Get TAI-UTC at 0h today. */\n   j = eraJd2cal(u1, u2, &iy, &im, &id, &fd);\n   if ( j ) return j;\n   j = eraDat(iy, im, id, 0.0, &dat0);\n   if ( j < 0 ) return j;\n\n/* Get TAI-UTC at 12h today (to detect drift). */\n   j = eraDat(iy, im, id, 0.5, &dat12);\n   if ( j < 0 ) return j;\n\n/* Get TAI-UTC at 0h tomorrow (to detect jumps). */\n   j = eraJd2cal(u1+1.5, u2-fd, &iyt, &imt, &idt, &w);\n   if ( j ) return j;\n   j = eraDat(iyt, imt, idt, 0.0, &dat24);\n   if ( j < 0 ) return j;\n\n/* Separate TAI-UTC change into per-day (DLOD) and any jump (DLEAP). */\n   dlod = 2.0 * (dat12 - dat0);\n   dleap = dat24 - (dat0 + dlod);\n\n/* Remove any scaling applied to spread leap into preceding day. */\n   fd *= (ERFA_DAYSEC+dleap)/ERFA_DAYSEC;\n\n/* Scale from (pre-1972) UTC seconds to SI seconds. */\n   fd *= (ERFA_DAYSEC+dlod)/ERFA_DAYSEC;\n\n/* Today's calendar date to 2-part JD. */\n   if ( eraCal2jd(iy, im, id, &z1, &z2) ) return -1;\n\n/* Assemble the TAI result, preserving the UTC split and order. */\n   a2 = z1 - u1;\n   a2 += z2;\n   a2 += fd + dat0/ERFA_DAYSEC;\n   if ( big1 ) {\n      *tai1 = u1;\n      *tai2 = a2;\n   } else {\n      *tai1 = a2;\n      *tai2 = u1;\n   }\n\n/* Status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13301,"name":"fane03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFane03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a n e 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Neptune.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Neptune, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     is adapted from Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Neptune (IERS Conventions 2003). */\n   a = fmod(5.311886287 + 3.8133035638 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13302,"name":"gmst06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGmst06(double uta, double utb, double tta, double ttb)\n/*\n**  - - - - - - - - - -\n**   e r a G m s t 0 6\n**  - - - - - - - - - -\n**\n**  Greenwich mean sidereal time (consistent with IAU 2006 precession).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich mean sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both\n**     Julian Dates, apportioned in any convenient way between the\n**     argument pairs.  For example, JD=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**            Part A        Part B\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable (in the case of UT;  the TT is not at all critical\n**     in this respect).  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     rotation angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation\n**     and TT to predict the effects of precession.  If UT1 is used for\n**     both purposes, errors of order 100 microarcseconds result.\n**\n**  3) This GMST is compatible with the IAU 2006 precession and must not\n**     be used with other precession models.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  Called:\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Reference:\n**\n**     Capitaine, N., Wallace, P.T. & Chapront, J., 2005,\n**     Astron.Astrophys. 432, 355\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, gmst;\n\n\n/* TT Julian centuries since J2000.0. */\n   t = ((tta - ERFA_DJ00) + ttb) / ERFA_DJC;\n\n/* Greenwich mean sidereal time, IAU 2006. */\n   gmst = eraAnp(eraEra00(uta, utb) +\n                  (    0.014506     +\n                  (  4612.156534    +\n                  (     1.3915817   +\n                  (    -0.00000044  +\n                  (    -0.000029956 +\n                  (    -0.0000000368 )\n          * t) * t) * t) * t) * t) * ERFA_DAS2R);\n\n   return gmst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13303,"name":"atciqn.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtciqn(double rc, double dc, double pr, double pd,\n               double px, double rv, eraASTROM *astrom,\n               int n, eraLDBODY b[], double *ri, double *di)\n/*\n**  - - - - - - - - - -\n**   e r a A t c i q n\n**  - - - - - - - - - -\n**\n**  Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed\n**  star-independent astrometry parameters plus a list of light-\n**  deflecting bodies.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are to be transformed for one date.  The\n**  star-independent parameters can be obtained by calling one of the\n**  functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].\n**\n**\n**  If the only light-deflecting body to be taken into account is the\n**  Sun, the eraAtciq function can be used instead.  If in addition the\n**  parallax and proper motions are zero, the eraAtciqz function can be\n**  used.\n**\n**  Given:\n**     rc,dc  double       ICRS RA,Dec at J2000.0 (radians)\n**     pr     double       RA proper motion (radians/year; Note 3)\n**     pd     double       Dec proper motion (radians/year)\n**     px     double       parallax (arcsec)\n**     rv     double       radial velocity (km/s, +ve if receding)\n**     astrom eraASTROM*   star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**      n     int           number of bodies (Note 3)\n**      b     eraLDBODY[n] data for each of the n bodies (Notes 3,4):\n**       bm    double        mass of the body (solar masses, Note 5)\n**       dl    double        deflection limiter (Note 6)\n**       pv    [2][3]        barycentric PV of the body (au, au/day)\n**\n**  Returned:\n**     ri,di   double    CIRS RA,Dec (radians)\n**\n**  Notes:\n**\n**  1) Star data for an epoch other than J2000.0 (for example from the\n**     Hipparcos catalog, which has an epoch of J1991.25) will require a\n**     preliminary call to eraPmsafe before use.\n**\n**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.\n**\n**  3) The struct b contains n entries, one for each body to be\n**     considered.  If n = 0, no gravitational light deflection will be\n**     applied, not even for the Sun.\n**\n**  4) The struct b should include an entry for the Sun as well as for\n**     any planet or other body to be taken into account.  The entries\n**     should be in the order in which the light passes the body.\n**\n**  5) In the entry in the b struct for body i, the mass parameter\n**     b[i].bm can, as required, be adjusted in order to allow for such\n**     effects as quadrupole field.\n**\n**  6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is\n**     the angular separation (in radians) between star and body at\n**     which limiting is applied.  As phi shrinks below the chosen\n**     threshold, the deflection is artificially reduced, reaching zero\n**     for phi = 0.   Example values suitable for a terrestrial\n**     observer, together with masses, are as follows:\n**\n**        body i     b[i].bm        b[i].dl\n**\n**        Sun        1.0            6e-6\n**        Jupiter    0.00095435     3e-9\n**        Saturn     0.00028574     3e-10\n**\n**  7) For efficiency, validation of the contents of the b array is\n**     omitted.  The supplied masses must be greater than zero, the\n**     position and velocity vectors must be right, and the deflection\n**     limiter greater than zero.\n**\n**  Called:\n**     eraPmpx      proper motion and parallax\n**     eraLdn       light deflection by n bodies\n**     eraAb        stellar aberration\n**     eraRxp       product of r-matrix and pv-vector\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double pco[3], pnat[3], ppr[3], pi[3], w;\n\n\n/* Proper motion and parallax, giving BCRS coordinate direction. */\n   eraPmpx(rc, dc, pr, pd, px, rv, astrom->pmt, astrom->eb, pco);\n\n/* Light deflection, giving BCRS natural direction. */\n   eraLdn(n, b, astrom->eb, pco, pnat);\n\n/* Aberration, giving GCRS proper direction. */\n   eraAb(pnat, astrom->v, astrom->em, astrom->bm1, ppr);\n\n/* Bias-precession-nutation, giving CIRS proper direction. */\n   eraRxp(astrom->bpn, ppr, pi);\n\n/* CIRS RA,Dec. */\n   eraC2s(pi, &w, di);\n   *ri = eraAnp(w);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13304,"name":"rxpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRxpv(double r[3][3], double pv[2][3], double rpv[2][3])\n/*\n**  - - - - - - - -\n**   e r a R x p v\n**  - - - - - - - -\n**\n**  Multiply a pv-vector by an r-matrix.\n**\n**  Given:\n**     r        double[3][3]    r-matrix\n**     pv       double[2][3]    pv-vector\n**\n**  Returned:\n**     rpv      double[2][3]    r * pv\n**\n**  Note:\n**     It is permissible for pv and rpv to be the same array.\n**\n**  Called:\n**     eraRxp       product of r-matrix and p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraRxp(r, pv[0], rpv[0]);\n   eraRxp(r, pv[1], rpv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13305,"name":"tdbtcb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2)\n/*\n**  - - - - - - - - - -\n**   e r a T d b t c b\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Barycentric Dynamical Time, TDB, to\n**  Barycentric Coordinate Time, TCB.\n**\n**  Given:\n**     tdb1,tdb2  double    TDB as a 2-part Julian Date\n**\n**  Returned:\n**     tcb1,tcb2  double    TCB as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tdb1+tdb2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tdb1 is the Julian\n**     Day Number and tdb2 is the fraction of a day.  The returned\n**     tcb1,tcb2 follow suit.\n**\n**  2) The 2006 IAU General Assembly introduced a conventional linear\n**     transformation between TDB and TCB.  This transformation\n**     compensates for the drift between TCB and terrestrial time TT,\n**     and keeps TDB approximately centered on TT.  Because the\n**     relationship between TT and TCB depends on the adopted solar\n**     system ephemeris, the degree of alignment between TDB and TT over\n**     long intervals will vary according to which ephemeris is used.\n**     Former definitions of TDB attempted to avoid this problem by\n**     stipulating that TDB and TT should differ only by periodic\n**     effects.  This is a good description of the nature of the\n**     relationship but eluded precise mathematical formulation.  The\n**     conventional linear relationship adopted in 2006 sidestepped\n**     these difficulties whilst delivering a TDB that in practice was\n**     consistent with values before that date.\n**\n**  3) TDB is essentially the same as Teph, the time argument for the\n**     JPL solar system ephemerides.\n**\n**  Reference:\n**\n**     IAU 2006 Resolution B3\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* 1977 Jan 1 00:00:32.184 TT, as two-part JD */\n   static const double t77td = ERFA_DJM0 + ERFA_DJM77;\n   static const double t77tf = ERFA_TTMTAI/ERFA_DAYSEC;\n\n/* TDB (days) at TAI 1977 Jan 1.0 */\n   static const double tdb0 = ERFA_TDB0/ERFA_DAYSEC;\n\n/* TDB to TCB rate */\n   static const double elbb = ERFA_ELB/(1.0-ERFA_ELB);\n\n   double d, f;\n\n\n/* Result, preserving date format but safeguarding precision. */\n   if ( tdb1 > tdb2 ) {\n      d = t77td - tdb1;\n      f  = tdb2 - tdb0;\n      *tcb1 = tdb1;\n      *tcb2 = f - ( d - ( f - t77tf ) ) * elbb;\n   } else {\n      d = t77td - tdb2;\n      f  = tdb1 - tdb0;\n      *tcb1 = f + ( d - ( f - t77tf ) ) * elbb;\n      *tcb2 = tdb2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13306,"name":"p06e.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraP06e(double date1, double date2,\n             double *eps0, double *psia, double *oma, double *bpa,\n             double *bqa, double *pia, double *bpia,\n             double *epsa, double *chia, double *za, double *zetaa,\n             double *thetaa, double *pa,\n             double *gam, double *phi, double *psi)\n/*\n**  - - - - - - - -\n**   e r a P 0 6 e\n**  - - - - - - - -\n**\n**  Precession angles, IAU 2006, equinox based.\n**\n**  Given:\n**     date1,date2   double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (see Note 2):\n**     eps0          double   epsilon_0\n**     psia          double   psi_A\n**     oma           double   omega_A\n**     bpa           double   P_A\n**     bqa           double   Q_A\n**     pia           double   pi_A\n**     bpia          double   Pi_A\n**     epsa          double   obliquity epsilon_A\n**     chia          double   chi_A\n**     za            double   z_A\n**     zetaa         double   zeta_A\n**     thetaa        double   theta_A\n**     pa            double   p_A\n**     gam           double   F-W angle gamma_J2000\n**     phi           double   F-W angle phi_J2000\n**     psi           double   F-W angle psi_J2000\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) This function returns the set of equinox based angles for the\n**     Capitaine et al. \"P03\" precession theory, adopted by the IAU in\n**     2006.  The angles are set out in Table 1 of Hilton et al. (2006):\n**\n**     eps0   epsilon_0   obliquity at J2000.0\n**     psia   psi_A       luni-solar precession\n**     oma    omega_A     inclination of equator wrt J2000.0 ecliptic\n**     bpa    P_A         ecliptic pole x, J2000.0 ecliptic triad\n**     bqa    Q_A         ecliptic pole -y, J2000.0 ecliptic triad\n**     pia    pi_A        angle between moving and J2000.0 ecliptics\n**     bpia   Pi_A        longitude of ascending node of the ecliptic\n**     epsa   epsilon_A   obliquity of the ecliptic\n**     chia   chi_A       planetary precession\n**     za     z_A         equatorial precession: -3rd 323 Euler angle\n**     zetaa  zeta_A      equatorial precession: -1st 323 Euler angle\n**     thetaa theta_A     equatorial precession: 2nd 323 Euler angle\n**     pa     p_A         general precession\n**     gam    gamma_J2000 J2000.0 RA difference of ecliptic poles\n**     phi    phi_J2000   J2000.0 codeclination of ecliptic pole\n**     psi    psi_J2000   longitude difference of equator poles, J2000.0\n**\n**     The returned values are all radians.\n**\n**  3) Hilton et al. (2006) Table 1 also contains angles that depend on\n**     models distinct from the P03 precession theory itself, namely the\n**     IAU 2000A frame bias and nutation.  The quoted polynomials are\n**     used in other ERFA functions:\n**\n**     . eraXy06  contains the polynomial parts of the X and Y series.\n**\n**     . eraS06  contains the polynomial part of the s+XY/2 series.\n**\n**     . eraPfw06  implements the series for the Fukushima-Williams\n**       angles that are with respect to the GCRS pole (i.e. the variants\n**       that include frame bias).\n**\n**  4) The IAU resolution stipulated that the choice of parameterization\n**     was left to the user, and so an IAU compliant precession\n**     implementation can be constructed using various combinations of\n**     the angles returned by the present function.\n**\n**  5) The parameterization used by ERFA is the version of the Fukushima-\n**     Williams angles that refers directly to the GCRS pole.  These\n**     angles may be calculated by calling the function eraPfw06.  ERFA\n**     also supports the direct computation of the CIP GCRS X,Y by\n**     series, available by calling eraXy06.\n**\n**  6) The agreement between the different parameterizations is at the\n**     1 microarcsecond level in the present era.\n**\n**  7) When constructing a precession formulation that refers to the GCRS\n**     pole rather than the dynamical pole, it may (depending on the\n**     choice of angles) be necessary to introduce the frame bias\n**     explicitly.\n**\n**  8) It is permissible to re-use the same variable in the returned\n**     arguments.  The quantities are stored in the stated order.\n**\n**  Reference:\n**\n**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351\n**\n**  Called:\n**     eraObl06     mean obliquity, IAU 2006\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t;\n\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Obliquity at J2000.0. */\n\n   *eps0 = 84381.406 * ERFA_DAS2R;\n\n/* Luni-solar precession. */\n\n   *psia = ( 5038.481507     +\n           (   -1.0790069    +\n           (   -0.00114045   +\n           (    0.000132851  +\n           (   -0.0000000951 )\n           * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Inclination of mean equator with respect to the J2000.0 ecliptic. */\n\n   *oma = *eps0 + ( -0.025754     +\n                  (  0.0512623    +\n                  ( -0.00772503   +\n                  ( -0.000000467  +\n                  (  0.0000003337 )\n                  * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Ecliptic pole x, J2000.0 ecliptic triad. */\n\n   *bpa = (  4.199094     +\n          (  0.1939873    +\n          ( -0.00022466   +\n          ( -0.000000912  +\n          (  0.0000000120 )\n          * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Ecliptic pole -y, J2000.0 ecliptic triad. */\n\n   *bqa = ( -46.811015     +\n          (   0.0510283    +\n          (   0.00052413   +\n          (  -0.000000646  +\n          (  -0.0000000172 )\n          * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Angle between moving and J2000.0 ecliptics. */\n\n   *pia = ( 46.998973     +\n          ( -0.0334926    +\n          ( -0.00012559   +\n          (  0.000000113  +\n          ( -0.0000000022 )\n          * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Longitude of ascending node of the moving ecliptic. */\n\n   *bpia = ( 629546.7936      +\n           (   -867.95758     +\n           (      0.157992    +\n           (     -0.0005371   +\n           (     -0.00004797  +\n           (      0.000000072 )\n           * t) * t) * t) * t) * t) * ERFA_DAS2R;\n\n/* Mean obliquity of the ecliptic. */\n\n   *epsa = eraObl06(date1, date2);\n\n/* Planetary precession. */\n\n   *chia = ( 10.556403     +\n           ( -2.3814292    +\n           ( -0.00121197   +\n           (  0.000170663  +\n           ( -0.0000000560 )\n           * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Equatorial precession: minus the third of the 323 Euler angles. */\n\n   *za = (   -2.650545     +\n         ( 2306.077181     +\n         (    1.0927348    +\n         (    0.01826837   +\n         (   -0.000028596  +\n         (   -0.0000002904 )\n         * t) * t) * t) * t) * t) * ERFA_DAS2R;\n\n/* Equatorial precession: minus the first of the 323 Euler angles. */\n\n   *zetaa = (    2.650545     +\n            ( 2306.083227     +\n            (    0.2988499    +\n            (    0.01801828   +\n            (   -0.000005971  +\n            (   -0.0000003173 )\n            * t) * t) * t) * t) * t) * ERFA_DAS2R;\n\n/* Equatorial precession: second of the 323 Euler angles. */\n\n   *thetaa = ( 2004.191903     +\n             (   -0.4294934    +\n             (   -0.04182264   +\n             (   -0.000007089  +\n             (   -0.0000001274 )\n             * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* General precession. */\n\n   *pa = ( 5028.796195     +\n         (    1.1054348    +\n         (    0.00007964   +\n         (   -0.000023857  +\n         (    0.0000000383 )\n         * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n/* Fukushima-Williams angles for precession. */\n\n   *gam = ( 10.556403     +\n          (  0.4932044    +\n          ( -0.00031238   +\n          ( -0.000002788  +\n          (  0.0000000260 )\n          * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n   *phi = *eps0 + ( -46.811015     +\n                  (   0.0511269    +\n                  (   0.00053289   +\n                  (  -0.000000440  +\n                  (  -0.0000000176 )\n                  * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n   *psi = ( 5038.481507     +\n          (    1.5584176    +\n          (   -0.00018522   +\n          (   -0.000026452  +\n          (   -0.0000000148 )\n          * t) * t) * t) * t) * t * ERFA_DAS2R;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13307,"name":"d2tf.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraD2tf(int ndp, double days, char *sign, int ihmsf[4])\n/*\n**  - - - - - - - -\n**   e r a D 2 t f\n**  - - - - - - - -\n**\n**  Decompose days to hours, minutes, seconds, fraction.\n**\n**  Given:\n**     ndp     int     resolution (Note 1)\n**     days    double  interval in days\n**\n**  Returned:\n**     sign    char    '+' or '-'\n**     ihmsf   int[4]  hours, minutes, seconds, fraction\n**\n**  Notes:\n**\n**  1) The argument ndp is interpreted as follows:\n**\n**     ndp         resolution\n**      :      ...0000 00 00\n**     -7         1000 00 00\n**     -6          100 00 00\n**     -5           10 00 00\n**     -4            1 00 00\n**     -3            0 10 00\n**     -2            0 01 00\n**     -1            0 00 10\n**      0            0 00 01\n**      1            0 00 00.1\n**      2            0 00 00.01\n**      3            0 00 00.001\n**      :            0 00 00.000...\n**\n**  2) The largest positive useful value for ndp is determined by the\n**     size of days, the format of double on the target platform, and\n**     the risk of overflowing ihmsf[3].  On a typical platform, for\n**     days up to 1.0, the available floating-point precision might\n**     correspond to ndp=12.  However, the practical limit is typically\n**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is\n**     only 16 bits.\n**\n**  3) The absolute value of days may exceed 1.0.  In cases where it\n**     does not, it is up to the caller to test for and handle the\n**     case where days is very nearly 1.0 and rounds up to 24 hours,\n**     by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int nrs, n;\n   double rs, rm, rh, a, w, ah, am, as, af;\n\n\n/* Handle sign. */\n   *sign = (char) ( ( days >= 0.0 ) ? '+' : '-' );\n\n/* Interval in seconds. */\n   a = ERFA_DAYSEC * fabs(days);\n\n/* Pre-round if resolution coarser than 1s (then pretend ndp=1). */\n   if (ndp < 0) {\n      nrs = 1;\n      for (n = 1; n <= -ndp; n++) {\n          nrs *= (n == 2 || n == 4) ? 6 : 10;\n      }\n      rs = (double) nrs;\n      w = a / rs;\n      a = rs * ERFA_DNINT(w);\n   }\n\n/* Express the unit of each field in resolution units. */\n   nrs = 1;\n   for (n = 1; n <= ndp; n++) {\n      nrs *= 10;\n   }\n   rs = (double) nrs;\n   rm = rs * 60.0;\n   rh = rm * 60.0;\n\n/* Round the interval and express in resolution units. */\n   a = ERFA_DNINT(rs * a);\n\n/* Break into fields. */\n   ah = a / rh;\n   ah = ERFA_DINT(ah);\n   a -= ah * rh;\n   am = a / rm;\n   am = ERFA_DINT(am);\n   a -= am * rm;\n   as = a / rs;\n   as = ERFA_DINT(as);\n   af = a - as * rs;\n\n/* Return results. */\n   ihmsf[0] = (int) ah;\n   ihmsf[1] = (int) am;\n   ihmsf[2] = (int) as;\n   ihmsf[3] = (int) af;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13308,"name":"c2t00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2t00a(double tta, double ttb, double uta, double utb,\n               double xp, double yp, double rc2t[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 t 0 0 a\n**  - - - - - - - - - -\n**\n**  Form the celestial to terrestrial matrix given the date, the UT1 and\n**  the polar motion, using the IAU 2000A nutation model.\n**\n**  Given:\n**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)\n**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)\n**     xp,yp    double         coordinates of the pole (radians, Note 2)\n**\n**  Returned:\n**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,\n**     apportioned in any convenient way between the arguments uta and\n**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of\n**     these ways, among others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  In the case of uta,utb, the\n**     date & time method is best matched to the Earth rotation angle\n**     algorithm used:  maximum precision is delivered when the uta\n**     argument is for 0hrs UT1 on the day in question and the utb\n**     argument lies in the range 0 to 1, or vice versa.\n**\n**  2) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  3) The matrix rc2t transforms from celestial to terrestrial\n**     coordinates:\n**\n**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003), RC2I is the\n**     celestial-to-intermediate matrix, ERA is the Earth rotation\n**     angle and RPOM is the polar motion matrix.\n**\n**  4) A faster, but slightly less accurate result (about 1 mas), can\n**     be obtained by using instead the eraC2t00b function.\n**\n**  Called:\n**     eraC2i00a    celestial-to-intermediate matrix, IAU 2000A\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraPom00     polar motion matrix\n**     eraC2tcio    form CIO-based celestial-to-terrestrial matrix\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rc2i[3][3], era, sp, rpom[3][3];\n\n\n/* Form the celestial-to-intermediate matrix for this TT (IAU 2000A). */\n   eraC2i00a(tta, ttb, rc2i );\n\n/* Predict the Earth rotation angle for this UT1. */\n   era = eraEra00(uta, utb);\n\n/* Estimate s'. */\n   sp = eraSp00(tta, ttb);\n\n/* Form the polar motion matrix. */\n   eraPom00(xp, yp, sp, rpom);\n\n/* Combine to form the celestial-to-terrestrial matrix. */\n   eraC2tcio(rc2i, era, rpom, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13309,"name":"gmst00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGmst00(double uta, double utb, double tta, double ttb)\n/*\n**  - - - - - - - - - -\n**   e r a G m s t 0 0\n**  - - - - - - - - - -\n**\n**  Greenwich mean sidereal time (model consistent with IAU 2000\n**  resolutions).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich mean sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both\n**     Julian Dates, apportioned in any convenient way between the\n**     argument pairs.  For example, JD=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**            Part A         Part B\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable (in the case of UT;  the TT is not at all critical\n**     in this respect).  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     Rotation Angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation\n**     and TT to predict the effects of precession.  If UT1 is used for\n**     both purposes, errors of order 100 microarcseconds result.\n**\n**  3) This GMST is compatible with the IAU 2000 resolutions and must be\n**     used only in conjunction with other IAU 2000 compatible\n**     components such as precession-nutation and equation of the\n**     equinoxes.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  5) The algorithm is from Capitaine et al. (2003) and IERS\n**     Conventions 2003.\n**\n**  Called:\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, gmst;\n\n\n/* TT Julian centuries since J2000.0. */\n   t = ((tta - ERFA_DJ00) + ttb) / ERFA_DJC;\n\n/* Greenwich Mean Sidereal Time, IAU 2000. */\n   gmst = eraAnp(eraEra00(uta, utb) +\n                   (     0.014506   +\n                   (  4612.15739966 +\n                   (     1.39667721 +\n                   (    -0.00009344 +\n                   (     0.00001882 )\n          * t) * t) * t) * t) * ERFA_DAS2R);\n\n   return gmst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13310,"name":"sxp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraSxp(double s, double p[3], double sp[3])\n/*\n**  - - - - - - -\n**   e r a S x p\n**  - - - - - - -\n**\n**  Multiply a p-vector by a scalar.\n**\n**  Given:\n**     s      double        scalar\n**     p      double[3]     p-vector\n**\n**  Returned:\n**     sp     double[3]     s * p\n**\n**  Note:\n**     It is permissible for p and sp to be the same array.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   sp[0] = s * p[0];\n   sp[1] = s * p[1];\n   sp[2] = s * p[2];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13311,"name":"fame03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFame03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a m e 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  mean longitude of Mercury.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    mean longitude of Mercury, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003) and\n**     comes from Souchay et al. (1999) after Simon et al. (1994).\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* Mean longitude of Mercury (IERS Conventions 2003). */\n   a = fmod(4.402608842 + 2608.7903141574 * t, ERFA_D2PI);\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13312,"name":"pvstar.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraPvstar(double pv[2][3], double *ra, double *dec,\n              double *pmr, double *pmd, double *px, double *rv)\n/*\n**  - - - - - - - - - -\n**   e r a P v s t a r\n**  - - - - - - - - - -\n**\n**  Convert star position+velocity vector to catalog coordinates.\n**\n**  Given (Note 1):\n**     pv     double[2][3]   pv-vector (au, au/day)\n**\n**  Returned (Note 2):\n**     ra     double         right ascension (radians)\n**     dec    double         declination (radians)\n**     pmr    double         RA proper motion (radians/year)\n**     pmd    double         Dec proper motion (radians/year)\n**     px     double         parallax (arcsec)\n**     rv     double         radial velocity (km/s, positive = receding)\n**\n**  Returned (function value):\n**            int            status:\n**                              0 = OK\n**                             -1 = superluminal speed (Note 5)\n**                             -2 = null position vector\n**\n**  Notes:\n**\n**  1) The specified pv-vector is the coordinate direction (and its rate\n**     of change) for the date at which the light leaving the star\n**     reached the solar-system barycenter.\n**\n**  2) The star data returned by this function are \"observables\" for an\n**     imaginary observer at the solar-system barycenter.  Proper motion\n**     and radial velocity are, strictly, in terms of barycentric\n**     coordinate time, TCB.  For most practical applications, it is\n**     permissible to neglect the distinction between TCB and ordinary\n**     \"proper\" time on Earth (TT/TAI).  The result will, as a rule, be\n**     limited by the intrinsic accuracy of the proper-motion and\n**     radial-velocity data;  moreover, the supplied pv-vector is likely\n**     to be merely an intermediate result (for example generated by the\n**     function eraStarpv), so that a change of time unit will cancel\n**     out overall.\n**\n**     In accordance with normal star-catalog conventions, the object's\n**     right ascension and declination are freed from the effects of\n**     secular aberration.  The frame, which is aligned to the catalog\n**     equator and equinox, is Lorentzian and centered on the SSB.\n**\n**     Summarizing, the specified pv-vector is for most stars almost\n**     identical to the result of applying the standard geometrical\n**     \"space motion\" transformation to the catalog data.  The\n**     differences, which are the subject of the Stumpff paper cited\n**     below, are:\n**\n**     (i) In stars with significant radial velocity and proper motion,\n**     the constantly changing light-time distorts the apparent proper\n**     motion.  Note that this is a classical, not a relativistic,\n**     effect.\n**\n**     (ii) The transformation complies with special relativity.\n**\n**  3) Care is needed with units.  The star coordinates are in radians\n**     and the proper motions in radians per Julian year, but the\n**     parallax is in arcseconds; the radial velocity is in km/s, but\n**     the pv-vector result is in au and au/day.\n**\n**  4) The proper motions are the rate of change of the right ascension\n**     and declination at the catalog epoch and are in radians per Julian\n**     year.  The RA proper motion is in terms of coordinate angle, not\n**     true angle, and will thus be numerically larger at high\n**     declinations.\n**\n**  5) Straight-line motion at constant speed in the inertial frame is\n**     assumed.  If the speed is greater than or equal to the speed of\n**     light, the function aborts with an error status.\n**\n**  6) The inverse transformation is performed by the function eraStarpv.\n**\n**  Called:\n**     eraPn        decompose p-vector into modulus and direction\n**     eraPdp       scalar product of two p-vectors\n**     eraSxp       multiply p-vector by scalar\n**     eraPmp       p-vector minus p-vector\n**     eraPm        modulus of p-vector\n**     eraPpp       p-vector plus p-vector\n**     eraPv2s      pv-vector to spherical\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Reference:\n**\n**     Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r, x[3], vr, ur[3], vt, ut[3], bett, betr, d, w, del,\n          usr[3], ust[3], a, rad, decd, rd;\n\n\n/* Isolate the radial component of the velocity (au/day, inertial). */\n   eraPn(pv[0], &r, x);\n   vr = eraPdp(x, pv[1]);\n   eraSxp(vr, x, ur);\n\n/* Isolate the transverse component of the velocity (au/day, inertial). */\n   eraPmp(pv[1], ur, ut);\n   vt = eraPm(ut);\n\n/* Special-relativity dimensionless parameters. */\n   bett = vt / ERFA_DC;\n   betr = vr / ERFA_DC;\n\n/* The inertial-to-observed correction terms. */\n   d = 1.0 + betr;\n   w = betr*betr + bett*bett;\n   if (d == 0.0 || w > 1.0) return -1;\n   del = - w / (sqrt(1.0-w) + 1.0);\n\n/* Apply relativistic correction factor to radial velocity component. */\n   w = (betr != 0) ? (betr - del) / (betr * d) : 1.0;\n   eraSxp(w, ur, usr);\n\n/* Apply relativistic correction factor to tangential velocity */\n/* component.                                                  */\n   eraSxp(1.0/d, ut, ust);\n\n/* Combine the two to obtain the observed velocity vector (au/day). */\n   eraPpp(usr, ust, pv[1]);\n\n/* Cartesian to spherical. */\n   eraPv2s(pv, &a, dec, &r, &rad, &decd, &rd);\n   if (r == 0.0) return -2;\n\n/* Return RA in range 0 to 2pi. */\n   *ra = eraAnp(a);\n\n/* Return proper motions in radians per year. */\n   *pmr = rad * ERFA_DJY;\n   *pmd = decd * ERFA_DJY;\n\n/* Return parallax in arcsec. */\n   *px = ERFA_DR2AS / r;\n\n/* Return radial velocity in km/s. */\n   *rv = 1e-3 * rd * ERFA_DAU / ERFA_DAYSEC;\n\n/* OK status. */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13313,"name":"pm.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraPm(double p[3])\n/*\n**  - - - - - -\n**   e r a P m\n**  - - - - - -\n**\n**  Modulus of p-vector.\n**\n**  Given:\n**     p      double[3]     p-vector\n**\n**  Returned (function value):\n**            double        modulus\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   return sqrt( p[0]*p[0] + p[1]*p[1] + p[2]*p[2] );\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13314,"name":"gst06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGst06(double uta, double utb, double tta, double ttb,\n                double rnpb[3][3])\n/*\n**  - - - - - - - - -\n**   e r a G s t 0 6\n**  - - - - - - - - -\n**\n**  Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.\n**\n**  Given:\n**     uta,utb  double        UT1 as a 2-part Julian Date (Notes 1,2)\n**     tta,ttb  double        TT as a 2-part Julian Date (Notes 1,2)\n**     rnpb     double[3][3]  nutation x precession x bias matrix\n**\n**  Returned (function value):\n**              double        Greenwich apparent sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both\n**     Julian Dates, apportioned in any convenient way between the\n**     argument pairs.  For example, JD=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**            Part A        Part B\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable (in the case of UT;  the TT is not at all critical\n**     in this respect).  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     rotation angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation\n**     and TT to predict the effects of precession-nutation.  If UT1 is\n**     used for both purposes, errors of order 100 microarcseconds\n**     result.\n**\n**  3) Although the function uses the IAU 2006 series for s+XY/2, it is\n**     otherwise independent of the precession-nutation model and can in\n**     practice be used with any equinox-based NPB matrix.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  Called:\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraEors      equation of the origins, given NPB matrix and s\n**\n**  Reference:\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, y, s, era, eors, gst;\n\n\n/* Extract CIP coordinates. */\n   eraBpn2xy(rnpb, &x, &y);\n\n/* The CIO locator, s. */\n   s = eraS06(tta, ttb, x, y);\n\n/* Greenwich apparent sidereal time. */\n   era = eraEra00(uta, utb);\n   eors = eraEors(rnpb, s);\n   gst = eraAnp(era - eors);\n\n   return gst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13315,"name":"pn06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPn06a(double date1, double date2,\n              double *dpsi, double *deps, double *epsa,\n              double rb[3][3], double rp[3][3], double rbp[3][3],\n              double rn[3][3], double rbpn[3][3])\n/*\n**  - - - - - - - - -\n**   e r a P n 0 6 a\n**  - - - - - - - - -\n**\n**  Precession-nutation, IAU 2006/2000A models:  a multi-purpose function,\n**  supporting classical (equinox-based) use directly and CIO-based use\n**  indirectly.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps    double          nutation (Note 2)\n**     epsa         double          mean obliquity (Note 3)\n**     rb           double[3][3]    frame bias matrix (Note 4)\n**     rp           double[3][3]    precession matrix (Note 5)\n**     rbp          double[3][3]    bias-precession matrix (Note 6)\n**     rn           double[3][3]    nutation matrix (Note 7)\n**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)\n**\n**  Notes:\n**\n**  1)  The TT date date1+date2 is a Julian Date, apportioned in any\n**      convenient way between the two arguments.  For example,\n**      JD(TT)=2450123.7 could be expressed in any of these ways,\n**      among others:\n**\n**             date1          date2\n**\n**          2450123.7           0.0       (JD method)\n**          2451545.0       -1421.3       (J2000 method)\n**          2400000.5       50123.2       (MJD method)\n**          2450123.5           0.2       (date & time method)\n**\n**      The JD method is the most natural and convenient to use in\n**      cases where the loss of several decimal digits of resolution\n**      is acceptable.  The J2000 method is best matched to the way\n**      the argument is handled internally and will deliver the\n**      optimum resolution.  The MJD method and the date & time methods\n**      are both good compromises between resolution and convenience.\n**\n**  2)  The nutation components (luni-solar + planetary, IAU 2000A) in\n**      longitude and obliquity are in radians and with respect to the\n**      equinox and ecliptic of date.  Free core nutation is omitted;\n**      for the utmost accuracy, use the eraPn06 function, where the\n**      nutation components are caller-specified.\n**\n**  3)  The mean obliquity is consistent with the IAU 2006 precession.\n**\n**  4)  The matrix rb transforms vectors from GCRS to mean J2000.0 by\n**      applying frame bias.\n**\n**  5)  The matrix rp transforms vectors from mean J2000.0 to mean of\n**      date by applying precession.\n**\n**  6)  The matrix rbp transforms vectors from GCRS to mean of date by\n**      applying frame bias then precession.  It is the product rp x rb.\n**\n**  7)  The matrix rn transforms vectors from mean of date to true of\n**      date by applying the nutation (luni-solar + planetary).\n**\n**  8)  The matrix rbpn transforms vectors from GCRS to true of date\n**      (CIP/equinox).  It is the product rn x rbp, applying frame bias,\n**      precession and nutation in that order.\n**\n**  9)  The X,Y,Z coordinates of the IAU 2006/2000A Celestial\n**      Intermediate Pole are elements (3,1-3) of the GCRS-to-true\n**      matrix, i.e. rbpn[2][0-2].\n**\n**  10) It is permissible to re-use the same array in the returned\n**      arguments.  The arrays are filled in the stated order.\n**\n**  Called:\n**     eraNut06a    nutation, IAU 2006/2000A\n**     eraPn06      bias/precession/nutation results, IAU 2006\n**\n**  Reference:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Nutation. */\n   eraNut06a(date1, date2, dpsi, deps);\n\n/* Remaining results. */\n   eraPn06(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13316,"name":"epj2jd.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraEpj2jd(double epj, double *djm0, double *djm)\n/*\n**  - - - - - - - - - -\n**   e r a E p j 2 j d\n**  - - - - - - - - - -\n**\n**  Julian Epoch to Julian Date.\n**\n**  Given:\n**     epj      double    Julian Epoch (e.g. 1996.8)\n**\n**  Returned:\n**     djm0     double    MJD zero-point: always 2400000.5\n**     djm      double    Modified Julian Date\n**\n**  Note:\n**\n**     The Julian Date is returned in two pieces, in the usual ERFA\n**     manner, which is designed to preserve time resolution.  The\n**     Julian Date is available as a single number by adding djm0 and\n**     djm.\n**\n**  Reference:\n**\n**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   *djm0 = ERFA_DJM0;\n   *djm  = ERFA_DJM00 + (epj - 2000.0) * 365.25;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13317,"name":"xys06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraXys06a(double date1, double date2,\n               double *x, double *y, double *s)\n/*\n**  - - - - - - - - - -\n**   e r a X y s 0 6 a\n**  - - - - - - - - - -\n**\n**  For a given TT date, compute the X,Y coordinates of the Celestial\n**  Intermediate Pole and the CIO locator s, using the IAU 2006\n**  precession and IAU 2000A nutation models.\n**\n**  Given:\n**     date1,date2  double  TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     x,y          double  Celestial Intermediate Pole (Note 2)\n**     s            double  the CIO locator s (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The Celestial Intermediate Pole coordinates are the x,y components\n**     of the unit vector in the Geocentric Celestial Reference System.\n**\n**  3) The CIO locator s (in radians) positions the Celestial\n**     Intermediate Origin on the equator of the CIP.\n**\n**  4) Series-based solutions for generating X and Y are also available:\n**     see Capitaine & Wallace (2006) and eraXy06.\n**\n**  Called:\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**\n**  References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3];\n\n\n/* Form the bias-precession-nutation matrix, IAU 2006/2000A. */\n   eraPnm06a(date1, date2, rbpn);\n\n/* Extract X,Y. */\n   eraBpn2xy(rbpn, x, y);\n\n/* Obtain s. */\n   *s = eraS06(date1, date2, *x, *y);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13318,"name":"ltecm.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLtecm(double epj, double rm[3][3])\n/*\n**  - - - - - - - - -\n**   e r a L t e c m\n**  - - - - - - - - -\n**\n**  ICRS equatorial to ecliptic rotation matrix, long-term.\n**\n**  Given:\n**     epj     double         Julian epoch (TT)\n**\n**  Returned:\n**     rm      double[3][3]   ICRS to ecliptic rotation matrix\n**\n**  Notes:\n**\n**  1) The matrix is in the sense\n**\n**        E_ep = rm x P_ICRS,\n**\n**     where P_ICRS is a vector with respect to ICRS right ascension\n**     and declination axes and E_ep is the same vector with respect to\n**     the (inertial) ecliptic and equinox of epoch epj.\n**\n**  2) P_ICRS is a free vector, merely a direction, typically of unit\n**     magnitude, and not bound to any particular spatial origin, such\n**     as the Earth, Sun or SSB.  No assumptions are made about whether\n**     it represents starlight and embodies astrometric effects such as\n**     parallax or aberration.  The transformation is approximately that\n**     between mean J2000.0 right ascension and declination and ecliptic\n**     longitude and latitude, with only frame bias (always less than\n**     25 mas) to disturb this classical picture.\n**\n**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  Called:\n**     eraLtpequ    equator pole, long term\n**     eraLtpecl    ecliptic pole, long term\n**     eraPxp       vector product\n**     eraPn        normalize vector\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Frame bias (IERS Conventions 2010, Eqs. 5.21 and 5.33) */\n   const double dx = -0.016617 * ERFA_DAS2R,\n                de = -0.0068192 * ERFA_DAS2R,\n                dr = -0.0146 * ERFA_DAS2R;\n\n   double p[3], z[3], w[3], s, x[3], y[3];\n\n\n/* Equator pole. */\n   eraLtpequ(epj, p);\n\n/* Ecliptic pole (bottom row of equatorial to ecliptic matrix). */\n   eraLtpecl(epj, z);\n\n/* Equinox (top row of matrix). */\n   eraPxp(p, z, w);\n   eraPn(w, &s, x);\n\n/* Middle row of matrix. */\n   eraPxp(z, x, y);\n\n/* Combine with frame bias. */\n   rm[0][0] =   x[0]    - x[1]*dr + x[2]*dx;\n   rm[0][1] =   x[0]*dr + x[1]    + x[2]*de;\n   rm[0][2] = - x[0]*dx - x[1]*de + x[2];\n   rm[1][0] =   y[0]    - y[1]*dr + y[2]*dx;\n   rm[1][1] =   y[0]*dr + y[1]    + y[2]*de;\n   rm[1][2] = - y[0]*dx - y[1]*de + y[2];\n   rm[2][0] =   z[0]    - z[1]*dr + z[2]*dx;\n   rm[2][1] =   z[0]*dr + z[1]    + z[2]*de;\n   rm[2][2] = - z[0]*dx - z[1]*de + z[2];\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13319,"name":"ltpequ.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLtpequ(double epj, double veq[3])\n/*\n**  - - - - - - - - - -\n**   e r a L t p e q u\n**  - - - - - - - - - -\n**\n**  Long-term precession of the equator.\n**\n**  Given:\n**     epj     double         Julian epoch (TT)\n**\n**  Returned:\n**     veq     double[3]      equator pole unit vector\n**\n**  Notes:\n**\n**  1) The returned vector is with respect to the J2000.0 mean equator\n**     and equinox.\n**\n**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Polynomial coefficients */\n   enum { NPOL = 4 };\n   static const double xypol[2][NPOL] = {\n      {  5453.282155,\n            0.4252841,\n           -0.00037173,\n           -0.000000152},\n      {-73750.930350,\n           -0.7675452,\n           -0.00018725,\n            0.000000231}\n   };\n\n/* Periodic coefficients */\n   static const double xyper[][5] = {\n      { 256.75, -819.940624,75004.344875,81491.287984, 1558.515853},\n      { 708.15,-8444.676815,  624.033993,  787.163481, 7774.939698},\n      { 274.20, 2600.009459, 1251.136893, 1251.296102,-2219.534038},\n      { 241.45, 2755.175630,-1102.212834,-1257.950837,-2523.969396},\n      {2309.00, -167.659835,-2660.664980,-2966.799730,  247.850422},\n      { 492.20,  871.855056,  699.291817,  639.744522, -846.485643},\n      { 396.10,   44.769698,  153.167220,  131.600209,-1393.124055},\n      { 288.90, -512.313065, -950.865637, -445.040117,  368.526116},\n      { 231.10, -819.415595,  499.754645,  584.522874,  749.045012},\n      {1610.00, -538.071099, -145.188210,  -89.756563,  444.704518},\n      { 620.00, -189.793622,  558.116553,  524.429630,  235.934465},\n      { 157.87, -402.922932,  -23.923029,  -13.549067,  374.049623},\n      { 220.30,  179.516345, -165.405086, -210.157124, -171.330180},\n      {1200.00,   -9.814756,    9.344131,  -44.919798,  -22.899655}\n   };\n   static const int NPER = (int) ( sizeof xyper / 5 / sizeof (double) );\n\n/* Miscellaneous */\n   int i;\n   double t, x, y, w, a, s, c;\n\n\n/* Centuries since J2000. */\n   t  = ( epj - 2000.0 ) / 100.0;\n\n/* Initialize X and Y accumulators. */\n   x = 0.0;\n   y = 0.0;\n\n/* Periodic terms. */\n   w = ERFA_D2PI * t;\n   for ( i = 0; i < NPER; i++ ) {\n      a = w / xyper[i][0];\n      s = sin(a);\n      c = cos(a);\n      x += c*xyper[i][1] + s*xyper[i][3];\n      y += c*xyper[i][2] + s*xyper[i][4];\n   }\n\n/* Polynomial terms. */\n   w = 1.0;\n   for ( i = 0; i < NPOL; i++ ) {\n      x += xypol[0][i]*w;\n      y += xypol[1][i]*w;\n      w *= t;\n   }\n\n/* X and Y (direction cosines). */\n   x *= ERFA_DAS2R;\n   y *= ERFA_DAS2R;\n\n/* Form the equator pole vector. */\n   veq[0] = x;\n   veq[1] = y;\n   w = 1.0 - x*x - y*y;\n   veq[2] = w < 0.0 ? 0.0 : sqrt(w);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13320,"name":"ldsun.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLdsun(double p[3], double e[3], double em, double p1[3])\n/*\n**  - - - - - - - - -\n**   e r a L d s u n\n**  - - - - - - - - -\n**\n**  Deflection of starlight by the Sun.\n**\n**  Given:\n**     p      double[3]  direction from observer to star (unit vector)\n**     e      double[3]  direction from Sun to observer (unit vector)\n**     em     double     distance from Sun to observer (au)\n**\n**  Returned:\n**     p1     double[3]  observer to deflected star (unit vector)\n**\n**  Notes:\n**\n**  1) The source is presumed to be sufficiently distant that its\n**     directions seen from the Sun and the observer are essentially\n**     the same.\n**\n**  2) The deflection is restrained when the angle between the star and\n**     the center of the Sun is less than a threshold value, falling to\n**     zero deflection for zero separation.  The chosen threshold value\n**     is within the solar limb for all solar-system applications, and\n**     is about 5 arcminutes for the case of a terrestrial observer.\n**\n**  3) The arguments p and p1 can be the same array.\n**\n**  Called:\n**     eraLd        light deflection by a solar-system body\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double em2, dlim;\n\n\n/* Deflection limiter (smaller for distant observers). */\n   em2 = em*em;\n   if ( em2 < 1.0 ) em2 = 1.0;\n   dlim = 1e-6 / (em2 > 1.0 ? em2 : 1.0);\n\n/* Apply the deflection. */\n   eraLd(1.0, p, p, e, em, dlim, p1);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13321,"name":"ee00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEe00(double date1, double date2, double epsa, double dpsi)\n/*\n**  - - - - - - - -\n**   e r a E e 0 0\n**  - - - - - - - -\n**\n**  The equation of the equinoxes, compatible with IAU 2000 resolutions,\n**  given the nutation in longitude and the mean obliquity.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**     epsa         double    mean obliquity (Note 2)\n**     dpsi         double    nutation in longitude (Note 3)\n**\n**  Returned (function value):\n**                  double    equation of the equinoxes (Note 4)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The obliquity, in radians, is mean of date.\n**\n**  3) The result, which is in radians, operates in the following sense:\n**\n**        Greenwich apparent ST = GMST + equation of the equinoxes\n**\n**  4) The result is compatible with the IAU 2000 resolutions.  For\n**     further details, see IERS Conventions 2003 and Capitaine et al.\n**     (2002).\n**\n**  Called:\n**     eraEect00    equation of the equinoxes complementary terms\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double ee;\n\n\n/* Equation of the equinoxes. */\n   ee = dpsi * cos(epsa) + eraEect00(date1, date2);\n\n   return ee;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13322,"name":"sxpv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraSxpv(double s, double pv[2][3], double spv[2][3])\n/*\n**  - - - - - - - -\n**   e r a S x p v\n**  - - - - - - - -\n**\n**  Multiply a pv-vector by a scalar.\n**\n**  Given:\n**     s       double          scalar\n**     pv      double[2][3]    pv-vector\n**\n**  Returned:\n**     spv     double[2][3]    s * pv\n**\n**  Note:\n**     It is permissible for pv and spv to be the same array\n**\n**  Called:\n**     eraS2xpv     multiply pv-vector by two scalars\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraS2xpv(s, s, pv, spv);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13323,"name":"fw2m.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraFw2m(double gamb, double phib, double psi, double eps,\n             double r[3][3])\n/*\n**  - - - - - - - -\n**   e r a F w 2 m\n**  - - - - - - - -\n**\n**  Form rotation matrix given the Fukushima-Williams angles.\n**\n**  Given:\n**     gamb     double         F-W angle gamma_bar (radians)\n**     phib     double         F-W angle phi_bar (radians)\n**     psi      double         F-W angle psi (radians)\n**     eps      double         F-W angle epsilon (radians)\n**\n**  Returned:\n**     r        double[3][3]   rotation matrix\n**\n**  Notes:\n**\n**  1) Naming the following points:\n**\n**           e = J2000.0 ecliptic pole,\n**           p = GCRS pole,\n**           E = ecliptic pole of date,\n**     and   P = CIP,\n**\n**     the four Fukushima-Williams angles are as follows:\n**\n**        gamb = gamma = epE\n**        phib = phi = pE\n**        psi = psi = pEP\n**        eps = epsilon = EP\n**\n**  2) The matrix representing the combined effects of frame bias,\n**     precession and nutation is:\n**\n**        NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb)\n**\n**  3) Three different matrices can be constructed, depending on the\n**     supplied angles:\n**\n**     o  To obtain the nutation x precession x frame bias matrix,\n**        generate the four precession angles, generate the nutation\n**        components and add them to the psi_bar and epsilon_A angles,\n**        and call the present function.\n**\n**     o  To obtain the precession x frame bias matrix, generate the\n**        four precession angles and call the present function.\n**\n**     o  To obtain the frame bias matrix, generate the four precession\n**        angles for date J2000.0 and call the present function.\n**\n**     The nutation-only and precession-only matrices can if necessary\n**     be obtained by combining these three appropriately.\n**\n**  Called:\n**     eraIr        initialize r-matrix to identity\n**     eraRz        rotate around Z-axis\n**     eraRx        rotate around X-axis\n**\n**  Reference:\n**\n**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Construct the matrix. */\n   eraIr(r);\n   eraRz(gamb, r);\n   eraRx(phib, r);\n   eraRz(-psi, r);\n   eraRx(-eps, r);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13324,"name":"pvtob.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPvtob(double elong, double phi, double hm,\n              double xp, double yp, double sp, double theta,\n              double pv[2][3])\n/*\n**  - - - - - - - - -\n**   e r a P v t o b\n**  - - - - - - - - -\n**\n**  Position and velocity of a terrestrial observing station.\n**\n**  Given:\n**     elong   double       longitude (radians, east +ve, Note 1)\n**     phi     double       latitude (geodetic, radians, Note 1)\n**     hm      double       height above ref. ellipsoid (geodetic, m)\n**     xp,yp   double       coordinates of the pole (radians, Note 2)\n**     sp      double       the TIO locator s' (radians, Note 2)\n**     theta   double       Earth rotation angle (radians, Note 3)\n**\n**  Returned:\n**     pv      double[2][3] position/velocity vector (m, m/s, CIRS)\n**\n**  Notes:\n**\n**  1) The terrestrial coordinates are with respect to the ERFA_WGS84\n**     reference ellipsoid.\n**\n**  2) xp and yp are the coordinates (in radians) of the Celestial\n**     Intermediate Pole with respect to the International Terrestrial\n**     Reference System (see IERS Conventions), measured along the\n**     meridians 0 and 90 deg west respectively.  sp is the TIO locator\n**     s', in radians, which positions the Terrestrial Intermediate\n**     Origin on the equator.  For many applications, xp, yp and\n**     (especially) sp can be set to zero.\n**\n**  3) If theta is Greenwich apparent sidereal time instead of Earth\n**     rotation angle, the result is with respect to the true equator\n**     and equinox of date, i.e. with the x-axis at the equinox rather\n**     than the celestial intermediate origin.\n**\n**  4) The velocity units are meters per UT1 second, not per SI second.\n**     This is unlikely to have any practical consequences in the modern\n**     era.\n**\n**  5) No validation is performed on the arguments.  Error cases that\n**     could lead to arithmetic exceptions are trapped by the eraGd2gc\n**     function, and the result set to zeros.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013), Section 7.4.3.3.\n**\n**  Called:\n**     eraGd2gc     geodetic to geocentric transformation\n**     eraPom00     polar motion matrix\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Earth rotation rate in radians per UT1 second */\n   const double OM = 1.00273781191135448 * ERFA_D2PI / ERFA_DAYSEC;\n\n   double xyzm[3], rpm[3][3], xyz[3], x, y, z, s, c;\n\n\n/* Geodetic to geocentric transformation (ERFA_WGS84). */\n   (void) eraGd2gc(1, elong, phi, hm, xyzm);\n\n/* Polar motion and TIO position. */\n   eraPom00(xp, yp, sp, rpm);\n   eraTrxp(rpm, xyzm, xyz);\n   x = xyz[0];\n   y = xyz[1];\n   z = xyz[2];\n\n/* Functions of ERA. */\n   s = sin(theta);\n   c = cos(theta);\n\n/* Position. */\n   pv[0][0] = c*x - s*y;\n   pv[0][1] = s*x + c*y;\n   pv[0][2] = z;\n\n/* Velocity. */\n   pv[1][0] = OM * ( -s*x - c*y );\n   pv[1][1] = OM * (  c*x - s*y );\n   pv[1][2] = 0.0;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13325,"name":"erfaextra.h","nodeType":"TextFile","path":"cextern/erfa","text":"/*\n** Copyright (C) 2016-2017, NumFOCUS Foundation. \n**\n** Licensed under a 3-clause BSD style license - see LICENSE\n**\n** This file is NOT derived from SOFA sources\n*/\n\n\n#ifndef _ERFA_EXTRA_H\n#define _ERFA_EXTRA_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* \n** Returns the package version\n** as defined in configure.ac\n** in string format\n*/\nconst char* eraVersion(void);\n\n/* \n** Returns the package major version\n** as defined in configure.ac\n** as integer\n*/\nint eraVersionMajor(void);\n\n/* \n** Returns the package minor version\n** as defined in configure.ac\n** as integer\n*/\nint eraVersionMinor(void);\n\n/* \n** Returns the package micro version\n** as defined in configure.ac\n** as integer\n*/\nint eraVersionMicro(void);\n\n/* \n** Returns the orresponding SOFA version\n** as defined in configure.ac\n** in string format\n*/\nconst char* eraSofaVersion(void);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ERFA_EXTRA_H */\n\n"},{"id":13326,"name":"tcbtdb.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2)\n/*\n**  - - - - - - - - - -\n**   e r a T c b t d b\n**  - - - - - - - - - -\n**\n**  Time scale transformation:  Barycentric Coordinate Time, TCB, to\n**  Barycentric Dynamical Time, TDB.\n**\n**  Given:\n**     tcb1,tcb2  double    TCB as a 2-part Julian Date\n**\n**  Returned:\n**     tdb1,tdb2  double    TDB as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Notes:\n**\n**  1) tcb1+tcb2 is Julian Date, apportioned in any convenient way\n**     between the two arguments, for example where tcb1 is the Julian\n**     Day Number and tcb2 is the fraction of a day.  The returned\n**     tdb1,tdb2 follow suit.\n**\n**  2) The 2006 IAU General Assembly introduced a conventional linear\n**     transformation between TDB and TCB.  This transformation\n**     compensates for the drift between TCB and terrestrial time TT,\n**     and keeps TDB approximately centered on TT.  Because the\n**     relationship between TT and TCB depends on the adopted solar\n**     system ephemeris, the degree of alignment between TDB and TT over\n**     long intervals will vary according to which ephemeris is used.\n**     Former definitions of TDB attempted to avoid this problem by\n**     stipulating that TDB and TT should differ only by periodic\n**     effects.  This is a good description of the nature of the\n**     relationship but eluded precise mathematical formulation.  The\n**     conventional linear relationship adopted in 2006 sidestepped\n**     these difficulties whilst delivering a TDB that in practice was\n**     consistent with values before that date.\n**\n**  3) TDB is essentially the same as Teph, the time argument for the\n**     JPL solar system ephemerides.\n**\n**  Reference:\n**\n**     IAU 2006 Resolution B3\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* 1977 Jan 1 00:00:32.184 TT, as two-part JD */\n   static const double t77td = ERFA_DJM0 + ERFA_DJM77;\n   static const double t77tf = ERFA_TTMTAI/ERFA_DAYSEC;\n\n/* TDB (days) at TAI 1977 Jan 1.0 */\n   static const double tdb0 = ERFA_TDB0/ERFA_DAYSEC;\n\n   double d;\n\n\n/* Result, safeguarding precision. */\n   if ( tcb1 > tcb2 ) {\n      d = tcb1 - t77td;\n      *tdb1 = tcb1;\n      *tdb2 = tcb2 + tdb0 - ( d + ( tcb2 - t77tf ) ) * ERFA_ELB;\n   } else {\n      d = tcb2 - t77td;\n      *tdb1 = tcb1 + tdb0 - ( d + ( tcb1 - t77tf ) ) * ERFA_ELB;\n      *tdb2 = tcb2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13327,"name":"af2a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n#include <stdlib.h>\n\nint eraAf2a(char s, int ideg, int iamin, double asec, double *rad)\n/*\n**  - - - - - - - -\n**   e r a A f 2 a\n**  - - - - - - - -\n**\n**  Convert degrees, arcminutes, arcseconds to radians.\n**\n**  Given:\n**     s         char    sign:  '-' = negative, otherwise positive\n**     ideg      int     degrees\n**     iamin     int     arcminutes\n**     asec      double  arcseconds\n**\n**  Returned:\n**     rad       double  angle in radians\n**\n**  Returned (function value):\n**               int     status:  0 = OK\n**                                1 = ideg outside range 0-359\n**                                2 = iamin outside range 0-59\n**                                3 = asec outside range 0-59.999...\n**\n**  Notes:\n**\n**  1)  The result is computed even if any of the range checks fail.\n**\n**  2)  Negative ideg, iamin and/or asec produce a warning status, but\n**      the absolute value is used in the conversion.\n**\n**  3)  If there are multiple errors, the status value reflects only the\n**      first, the smallest taking precedence.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Compute the interval. */\n   *rad  = ( s == '-' ? -1.0 : 1.0 ) *\n           ( 60.0 * ( 60.0 * ( (double) abs(ideg) ) +\n                             ( (double) abs(iamin) ) ) +\n                                        fabs(asec) ) * ERFA_DAS2R;\n\n/* Validate arguments and return status. */\n   if ( ideg < 0 || ideg > 359 ) return 1;\n   if ( iamin < 0 || iamin > 59 ) return 2;\n   if ( asec < 0.0 || asec >= 60.0 ) return 3;\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13328,"name":"prec76.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPrec76(double date01, double date02, double date11, double date12,\n               double *zeta, double *z, double *theta)\n/*\n**  - - - - - - - - - -\n**   e r a P r e c 7 6\n**  - - - - - - - - - -\n**\n**  IAU 1976 precession model.\n**\n**  This function forms the three Euler angles which implement general\n**  precession between two dates, using the IAU 1976 model (as for the\n**  FK5 catalog).\n**\n**  Given:\n**     date01,date02   double    TDB starting date (Note 1)\n**     date11,date12   double    TDB ending date (Note 1)\n**\n**  Returned:\n**     zeta            double    1st rotation: radians cw around z\n**     z               double    3rd rotation: radians cw around z\n**     theta           double    2nd rotation: radians ccw around y\n**\n**  Notes:\n**\n**  1) The dates date01+date02 and date11+date12 are Julian Dates,\n**     apportioned in any convenient way between the arguments daten1\n**     and daten2.  For example, JD(TDB)=2450123.7 could be expressed in\n**     any of these ways, among others:\n**\n**           daten1        daten2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**     The two dates may be expressed using different methods, but at\n**     the risk of losing some resolution.\n**\n**  2) The accumulated precession angles zeta, z, theta are expressed\n**     through canonical polynomials which are valid only for a limited\n**     time span.  In addition, the IAU 1976 precession rate is known to\n**     be imperfect.  The absolute accuracy of the present formulation\n**     is better than 0.1 arcsec from 1960AD to 2040AD, better than\n**     1 arcsec from 1640AD to 2360AD, and remains below 3 arcsec for\n**     the whole of the period 500BC to 3000AD.  The errors exceed\n**     10 arcsec outside the range 1200BC to 3900AD, exceed 100 arcsec\n**     outside 4200BC to 5600AD and exceed 1000 arcsec outside 6800BC to\n**     8200AD.\n**\n**  3) The three angles are returned in the conventional order, which\n**     is not the same as the order of the corresponding Euler\n**     rotations.  The precession matrix is\n**     R_3(-z) x R_2(+theta) x R_3(-zeta).\n**\n**  Reference:\n**\n**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282, equations\n**     (6) & (7), p283.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t0, t, tas2r, w;\n\n\n/* Interval between fundamental epoch J2000.0 and start date (JC). */\n   t0 = ((date01 - ERFA_DJ00) + date02) / ERFA_DJC;\n\n/* Interval over which precession required (JC). */\n   t = ((date11 - date01) + (date12 - date02)) / ERFA_DJC;\n\n/* Euler angles. */\n   tas2r = t * ERFA_DAS2R;\n   w = 2306.2181 + (1.39656 - 0.000139 * t0) * t0;\n\n   *zeta = (w + ((0.30188 - 0.000344 * t0) + 0.017998 * t) * t) * tas2r;\n\n   *z = (w + ((1.09468 + 0.000066 * t0) + 0.018203 * t) * t) * tas2r;\n\n   *theta = ((2004.3109 + (-0.85330 - 0.000217 * t0) * t0)\n          + ((-0.42665 - 0.000217 * t0) - 0.041833 * t) * t) * tas2r;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13329,"name":"pmat06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPmat06(double date1, double date2, double rbp[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P m a t 0 6\n**  - - - - - - - - - -\n**\n**  Precession matrix (including frame bias) from GCRS to a specified\n**  date, IAU 2006 model.\n**\n**  Given:\n**     date1,date2  double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rbp          double[3][3]    bias-precession matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rbp * V(GCRS), where\n**     the p-vector V(GCRS) is with respect to the Geocentric Celestial\n**     Reference System (IAU, 2000) and the p-vector V(date) is with\n**     respect to the mean equatorial triad of the given date.\n**\n**  Called:\n**     eraPfw06     bias-precession F-W angles, IAU 2006\n**     eraFw2m      F-W angles to r-matrix\n**\n**  References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gamb, phib, psib, epsa;\n\n\n/* Bias-precession Fukushima-Williams angles. */\n   eraPfw06(date1, date2, &gamb, &phib, &psib, &epsa);\n\n/* Form the matrix. */\n   eraFw2m(gamb, phib, psib, epsa, rbp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13330,"name":"ab.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAb(double pnat[3], double v[3], double s, double bm1,\n           double ppr[3])\n/*\n**  - - - - - -\n**   e r a A b\n**  - - - - - -\n**\n**  Apply aberration to transform natural direction into proper\n**  direction.\n**\n**  Given:\n**    pnat    double[3]   natural direction to the source (unit vector)\n**    v       double[3]   observer barycentric velocity in units of c\n**    s       double      distance between the Sun and the observer (au)\n**    bm1     double      sqrt(1-|v|^2): reciprocal of Lorenz factor\n**\n**  Returned:\n**    ppr     double[3]   proper direction to source (unit vector)\n**\n**  Notes:\n**\n**  1) The algorithm is based on Expr. (7.40) in the Explanatory\n**     Supplement (Urban & Seidelmann 2013), but with the following\n**     changes:\n**\n**     o  Rigorous rather than approximate normalization is applied.\n**\n**     o  The gravitational potential term from Expr. (7) in\n**        Klioner (2003) is added, taking into account only the Sun's\n**        contribution.  This has a maximum effect of about\n**        0.4 microarcsecond.\n**\n**  2) In almost all cases, the maximum accuracy will be limited by the\n**     supplied velocity.  For example, if the ERFA eraEpv00 function is\n**     used, errors of up to 5 microarcseconds could occur.\n**\n**  References:\n**\n**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to\n**     the Astronomical Almanac, 3rd ed., University Science Books\n**     (2013).\n**\n**     Klioner, Sergei A., \"A practical relativistic model for micro-\n**     arcsecond astrometry in space\", Astr. J. 125, 1580-1597 (2003).\n**\n**  Called:\n**     eraPdp       scalar product of two p-vectors\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i;\n   double pdv, w1, w2, r2, w, p[3], r;\n\n\n   pdv = eraPdp(pnat, v);\n   w1 = 1.0 + pdv/(1.0 + bm1);\n   w2 = ERFA_SRS/s;\n   r2 = 0.0;\n   for (i = 0; i < 3; i++) {\n      w = pnat[i]*bm1 + w1*v[i] + w2*(v[i] - pdv*pnat[i]);\n      p[i] = w;\n      r2 = r2 + w*w;\n   }\n   r = sqrt(r2);\n   for (i = 0; i < 3; i++) {\n      ppr[i] = p[i]/r;\n   }\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13331,"name":"nut06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNut06a(double date1, double date2, double *dpsi, double *deps)\n/*\n**  - - - - - - - - - -\n**   e r a N u t 0 6 a\n**  - - - - - - - - - -\n**\n**  IAU 2000A nutation with adjustments to match the IAU 2006\n**  precession.\n**\n**  Given:\n**     date1,date2   double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     dpsi,deps     double   nutation, luni-solar + planetary (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The nutation components in longitude and obliquity are in radians\n**     and with respect to the mean equinox and ecliptic of date,\n**     IAU 2006 precession model (Hilton et al. 2006, Capitaine et al.\n**     2005).\n**\n**  3) The function first computes the IAU 2000A nutation, then applies\n**     adjustments for (i) the consequences of the change in obliquity\n**     from the IAU 1980 ecliptic to the IAU 2006 ecliptic and (ii) the\n**     secular variation in the Earth's dynamical form factor J2.\n**\n**  4) The present function provides classical nutation, complementing\n**     the IAU 2000 frame bias and IAU 2006 precession.  It delivers a\n**     pole which is at current epochs accurate to a few tens of\n**     microarcseconds, apart from the free core nutation.\n**\n**  Called:\n**     eraNut00a    nutation, IAU 2000A\n**\n**  References:\n**\n**     Chapront, J., Chapront-Touze, M. & Francou, G. 2002,\n**     Astron.Astrophys. 387, 700\n**\n**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,\n**     Astron.Astrophys. 58, 1-16\n**\n**     Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.\n**     107, B4.  The MHB_2000 code itself was obtained on 9th September\n**     2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.\n**\n**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,\n**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683\n**\n**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,\n**     Astron.Astrophys.Supp.Ser. 135, 111\n**\n**     Wallace, P.T., \"Software for Implementing the IAU 2000\n**     Resolutions\", in IERS Workshop 5.1 (2002)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double t, fj2, dp, de;\n\n\n/* Interval between fundamental date J2000.0 and given date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Factor correcting for secular variation of J2. */\n   fj2 = -2.7774e-6 * t;\n\n/* Obtain IAU 2000A nutation. */\n   eraNut00a(date1, date2, &dp, &de);\n\n/* Apply P03 adjustments (Wallace & Capitaine, 2006, Eqs.5). */\n   *dpsi = dp + dp * (0.4697e-6 + fj2);\n   *deps = de + de * fj2;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13332,"name":"rxr.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraRxr(double a[3][3], double b[3][3], double atb[3][3])\n/*\n**  - - - - - - -\n**   e r a R x r\n**  - - - - - - -\n**\n**  Multiply two r-matrices.\n**\n**  Given:\n**     a        double[3][3]    first r-matrix\n**     b        double[3][3]    second r-matrix\n**\n**  Returned:\n**     atb      double[3][3]    a * b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Called:\n**     eraCr        copy r-matrix\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int i, j, k;\n   double w, wm[3][3];\n\n\n   for (i = 0; i < 3; i++) {\n      for (j = 0; j < 3; j++) {\n         w = 0.0;\n         for (k = 0; k < 3; k++) {\n            w +=  a[i][k] * b[k][j];\n         }\n         wm[i][j] = w;\n      }\n   }\n   eraCr(wm, atb);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13333,"name":"bp00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraBp00(double date1, double date2,\n             double rb[3][3], double rp[3][3], double rbp[3][3])\n/*\n**  - - - - - - - -\n**   e r a B p 0 0\n**  - - - - - - - -\n**\n**  Frame bias and precession, IAU 2000.\n**\n**  Given:\n**     date1,date2  double         TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rb           double[3][3]   frame bias matrix (Note 2)\n**     rp           double[3][3]   precession matrix (Note 3)\n**     rbp          double[3][3]   bias-precession matrix (Note 4)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**             date1         date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix rb transforms vectors from GCRS to mean J2000.0 by\n**     applying frame bias.\n**\n**  3) The matrix rp transforms vectors from J2000.0 mean equator and\n**     equinox to mean equator and equinox of date by applying\n**     precession.\n**\n**  4) The matrix rbp transforms vectors from GCRS to mean equator and\n**     equinox of date by applying frame bias then precession.  It is\n**     the product rp x rb.\n**\n**  5) It is permissible to re-use the same array in the returned\n**     arguments.  The arrays are filled in the order given.\n**\n**  Called:\n**     eraBi00      frame bias components, IAU 2000\n**     eraPr00      IAU 2000 precession adjustments\n**     eraIr        initialize r-matrix to identity\n**     eraRx        rotate around X-axis\n**     eraRy        rotate around Y-axis\n**     eraRz        rotate around Z-axis\n**     eraCr        copy r-matrix\n**     eraRxr       product of two r-matrices\n**\n**  Reference:\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* J2000.0 obliquity (Lieske et al. 1977) */\n   const double EPS0 = 84381.448 * ERFA_DAS2R;\n\n   double t, dpsibi, depsbi, dra0, psia77, oma77, chia,\n          dpsipr, depspr, psia, oma, rbw[3][3];\n\n\n/* Interval between fundamental epoch J2000.0 and current date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Frame bias. */\n   eraBi00(&dpsibi, &depsbi, &dra0);\n\n/* Precession angles (Lieske et al. 1977) */\n   psia77 = (5038.7784 + (-1.07259 + (-0.001147) * t) * t) * t * ERFA_DAS2R;\n   oma77  =       EPS0 + ((0.05127 + (-0.007726) * t) * t) * t * ERFA_DAS2R;\n   chia   = (  10.5526 + (-2.38064 + (-0.001125) * t) * t) * t * ERFA_DAS2R;\n\n/* Apply IAU 2000 precession corrections. */\n   eraPr00(date1, date2, &dpsipr, &depspr);\n   psia = psia77 + dpsipr;\n   oma  = oma77  + depspr;\n\n/* Frame bias matrix: GCRS to J2000.0. */\n   eraIr(rbw);\n   eraRz(dra0, rbw);\n   eraRy(dpsibi*sin(EPS0), rbw);\n   eraRx(-depsbi, rbw);\n   eraCr(rbw, rb);\n\n/* Precession matrix: J2000.0 to mean of date. */\n   eraIr(rp);\n   eraRx(EPS0, rp);\n   eraRz(-psia, rp);\n   eraRx(-oma, rp);\n   eraRz(chia, rp);\n\n/* Bias-precession matrix: GCRS to mean of date. */\n   eraRxr(rp, rbw, rbp);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13334,"name":"epb2jd.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraEpb2jd(double epb, double *djm0, double *djm)\n/*\n**  - - - - - - - - - -\n**   e r a E p b 2 j d\n**  - - - - - - - - - -\n**\n**  Besselian Epoch to Julian Date.\n**\n**  Given:\n**     epb      double    Besselian Epoch (e.g. 1957.3)\n**\n**  Returned:\n**     djm0     double    MJD zero-point: always 2400000.5\n**     djm      double    Modified Julian Date\n**\n**  Note:\n**\n**     The Julian Date is returned in two pieces, in the usual ERFA\n**     manner, which is designed to preserve time resolution.  The\n**     Julian Date is available as a single number by adding djm0 and\n**     djm.\n**\n**  Reference:\n**\n**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   *djm0 = ERFA_DJM0;\n   *djm  =   15019.81352 + (epb - 1900.0) * ERFA_DTY;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13335,"name":"plan94.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraPlan94(double date1, double date2, int np, double pv[2][3])\n/*\n**  - - - - - - - - - -\n**   e r a P l a n 9 4\n**  - - - - - - - - - -\n**\n**  Approximate heliocentric position and velocity of a nominated major\n**  planet:  Mercury, Venus, EMB, Mars, Jupiter, Saturn, Uranus or\n**  Neptune (but not the Earth itself).\n**\n**  Given:\n**     date1  double       TDB date part A (Note 1)\n**     date2  double       TDB date part B (Note 1)\n**     np     int          planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars,\n**                             5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune)\n**\n**  Returned (argument):\n**     pv     double[2][3] planet p,v (heliocentric, J2000.0, au,au/d)\n**\n**  Returned (function value):\n**            int          status: -1 = illegal NP (outside 1-8)\n**                                  0 = OK\n**                                 +1 = warning: year outside 1000-3000\n**                                 +2 = warning: failed to converge\n**\n**  Notes:\n**\n**  1) The date date1+date2 is in the TDB time scale (in practice TT can\n**     be used) and is a Julian Date, apportioned in any convenient way\n**     between the two arguments.  For example, JD(TDB)=2450123.7 could\n**     be expressed in any of these ways, among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  The limited\n**     accuracy of the present algorithm is such that any of the methods\n**     is satisfactory.\n**\n**  2) If an np value outside the range 1-8 is supplied, an error status\n**     (function value -1) is returned and the pv vector set to zeroes.\n**\n**  3) For np=3 the result is for the Earth-Moon Barycenter.  To obtain\n**     the heliocentric position and velocity of the Earth, use instead\n**     the ERFA function eraEpv00.\n**\n**  4) On successful return, the array pv contains the following:\n**\n**        pv[0][0]   x      }\n**        pv[0][1]   y      } heliocentric position, au\n**        pv[0][2]   z      }\n**\n**        pv[1][0]   xdot   }\n**        pv[1][1]   ydot   } heliocentric velocity, au/d\n**        pv[1][2]   zdot   }\n**\n**     The reference frame is equatorial and is with respect to the\n**     mean equator and equinox of epoch J2000.0.\n**\n**  5) The algorithm is due to J.L. Simon, P. Bretagnon, J. Chapront,\n**     M. Chapront-Touze, G. Francou and J. Laskar (Bureau des\n**     Longitudes, Paris, France).  From comparisons with JPL\n**     ephemeris DE102, they quote the following maximum errors\n**     over the interval 1800-2050:\n**\n**                     L (arcsec)    B (arcsec)      R (km)\n**\n**        Mercury          4             1             300\n**        Venus            5             1             800\n**        EMB              6             1            1000\n**        Mars            17             1            7700\n**        Jupiter         71             5           76000\n**        Saturn          81            13          267000\n**        Uranus          86             7          712000\n**        Neptune         11             1          253000\n**\n**     Over the interval 1000-3000, they report that the accuracy is no\n**     worse than 1.5 times that over 1800-2050.  Outside 1000-3000 the\n**     accuracy declines.\n**\n**     Comparisons of the present function with the JPL DE200 ephemeris\n**     give the following RMS errors over the interval 1960-2025:\n**\n**                      position (km)     velocity (m/s)\n**\n**        Mercury            334               0.437\n**        Venus             1060               0.855\n**        EMB               2010               0.815\n**        Mars              7690               1.98\n**        Jupiter          71700               7.70\n**        Saturn          199000              19.4\n**        Uranus          564000              16.4\n**        Neptune         158000              14.4\n**\n**     Comparisons against DE200 over the interval 1800-2100 gave the\n**     following maximum absolute differences.  (The results using\n**     DE406 were essentially the same.)\n**\n**                   L (arcsec)   B (arcsec)     R (km)   Rdot (m/s)\n**\n**        Mercury        7            1            500       0.7\n**        Venus          7            1           1100       0.9\n**        EMB            9            1           1300       1.0\n**        Mars          26            1           9000       2.5\n**        Jupiter       78            6          82000       8.2\n**        Saturn        87           14         263000      24.6\n**        Uranus        86            7         661000      27.4\n**        Neptune       11            2         248000      21.4\n**\n**  6) The present ERFA re-implementation of the original Simon et al.\n**     Fortran code differs from the original in the following respects:\n**\n**       *  C instead of Fortran.\n**\n**       *  The date is supplied in two parts.\n**\n**       *  The result is returned only in equatorial Cartesian form;\n**          the ecliptic longitude, latitude and radius vector are not\n**          returned.\n**\n**       *  The result is in the J2000.0 equatorial frame, not ecliptic.\n**\n**       *  More is done in-line: there are fewer calls to subroutines.\n**\n**       *  Different error/warning status values are used.\n**\n**       *  A different Kepler's-equation-solver is used (avoiding\n**          use of double precision complex).\n**\n**       *  Polynomials in t are nested to minimize rounding errors.\n**\n**       *  Explicit double constants are used to avoid mixed-mode\n**          expressions.\n**\n**     None of the above changes affects the result significantly.\n**\n**  7) The returned status indicates the most serious condition\n**     encountered during execution of the function.  Illegal np is\n**     considered the most serious, overriding failure to converge,\n**     which in turn takes precedence over the remote date warning.\n**\n**  Called:\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  Reference:  Simon, J.L, Bretagnon, P., Chapront, J.,\n**              Chapront-Touze, M., Francou, G., and Laskar, J.,\n**              Astron. Astrophys. 282, 663 (1994).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Gaussian constant */\n   static const double GK = 0.017202098950;\n\n/* Sin and cos of J2000.0 mean obliquity (IAU 1976) */\n   static const double SINEPS = 0.3977771559319137;\n   static const double COSEPS = 0.9174820620691818;\n\n/* Maximum number of iterations allowed to solve Kepler's equation */\n   static const int KMAX = 10;\n\n   int jstat, i, k;\n   double t, da, dl, de, dp, di, dom, dmu, arga, argl, am,\n          ae, dae, ae2, at, r, v, si2, xq, xp, tl, xsw,\n          xcw, xm2, xf, ci2, xms, xmc, xpxq2, x, y, z;\n\n/* Planetary inverse masses */\n   static const double amas[] = { 6023600.0,       /* Mercury */\n                                   408523.5,       /* Venus   */\n                                   328900.5,       /* EMB     */\n                                  3098710.0,       /* Mars    */\n                                     1047.355,     /* Jupiter */\n                                     3498.5,       /* Saturn  */\n                                    22869.0,       /* Uranus  */\n                                    19314.0 };     /* Neptune */\n\n/*\n** Tables giving the mean Keplerian elements, limited to t^2 terms:\n**\n**   a       semi-major axis (au)\n**   dlm     mean longitude (degree and arcsecond)\n**   e       eccentricity\n**   pi      longitude of the perihelion (degree and arcsecond)\n**   dinc    inclination (degree and arcsecond)\n**   omega   longitude of the ascending node (degree and arcsecond)\n*/\n\n   static const double a[][3] = {\n       {  0.3870983098,           0.0,     0.0 },  /* Mercury */\n       {  0.7233298200,           0.0,     0.0 },  /* Venus   */\n       {  1.0000010178,           0.0,     0.0 },  /* EMB     */\n       {  1.5236793419,         3e-10,     0.0 },  /* Mars    */\n       {  5.2026032092,     19132e-10, -39e-10 },  /* Jupiter */\n       {  9.5549091915, -0.0000213896, 444e-10 },  /* Saturn  */\n       { 19.2184460618,     -3716e-10, 979e-10 },  /* Uranus  */\n       { 30.1103868694,    -16635e-10, 686e-10 }   /* Neptune */\n   };\n\n   static const double dlm[][3] = {\n       { 252.25090552, 5381016286.88982,  -1.92789 },\n       { 181.97980085, 2106641364.33548,   0.59381 },\n       { 100.46645683, 1295977422.83429,  -2.04411 },\n       { 355.43299958,  689050774.93988,   0.94264 },\n       {  34.35151874,  109256603.77991, -30.60378 },\n       {  50.07744430,   43996098.55732,  75.61614 },\n       { 314.05500511,   15424811.93933,  -1.75083 },\n       { 304.34866548,    7865503.20744,   0.21103 }\n   };\n\n   static const double e[][3] = {\n       { 0.2056317526,  0.0002040653,    -28349e-10 },\n       { 0.0067719164, -0.0004776521,     98127e-10 },\n       { 0.0167086342, -0.0004203654, -0.0000126734 },\n       { 0.0934006477,  0.0009048438,    -80641e-10 },\n       { 0.0484979255,  0.0016322542, -0.0000471366 },\n       { 0.0555481426, -0.0034664062, -0.0000643639 },\n       { 0.0463812221, -0.0002729293,  0.0000078913 },\n       { 0.0094557470,  0.0000603263,           0.0 }\n   };\n\n   static const double pi[][3] = {\n       {  77.45611904,  5719.11590,   -4.83016 },\n       { 131.56370300,   175.48640, -498.48184 },\n       { 102.93734808, 11612.35290,   53.27577 },\n       { 336.06023395, 15980.45908,  -62.32800 },\n       {  14.33120687,  7758.75163,  259.95938 },\n       {  93.05723748, 20395.49439,  190.25952 },\n       { 173.00529106,  3215.56238,  -34.09288 },\n       {  48.12027554,  1050.71912,   27.39717 }\n   };\n\n   static const double dinc[][3] = {\n       { 7.00498625, -214.25629,   0.28977 },\n       { 3.39466189,  -30.84437, -11.67836 },\n       {        0.0,  469.97289,  -3.35053 },\n       { 1.84972648, -293.31722,  -8.11830 },\n       { 1.30326698,  -71.55890,  11.95297 },\n       { 2.48887878,   91.85195, -17.66225 },\n       { 0.77319689,  -60.72723,   1.25759 },\n       { 1.76995259,    8.12333,   0.08135 }\n   };\n\n   static const double omega[][3] = {\n       {  48.33089304,  -4515.21727,  -31.79892 },\n       {  76.67992019, -10008.48154,  -51.32614 },\n       { 174.87317577,  -8679.27034,   15.34191 },\n       {  49.55809321, -10620.90088, -230.57416 },\n       { 100.46440702,   6362.03561,  326.52178 },\n       { 113.66550252,  -9240.19942,  -66.23743 },\n       {  74.00595701,   2669.15033,  145.93964 },\n       { 131.78405702,   -221.94322,   -0.78728 }\n   };\n\n/* Tables for trigonometric terms to be added to the mean elements of */\n/* the semi-major axes */\n\n   static const double kp[][9] = {\n    {   69613, 75645, 88306, 59899, 15746, 71087, 142173,  3086,    0 },\n    {   21863, 32794, 26934, 10931, 26250, 43725,  53867, 28939,    0 },\n    {   16002, 21863, 32004, 10931, 14529, 16368,  15318, 32794,    0 },\n    {    6345,  7818, 15636,  7077,  8184, 14163,   1107,  4872,    0 },\n    {    1760,  1454,  1167,   880,   287,  2640,     19,  2047, 1454 },\n    {     574,     0,   880,   287,    19,  1760,   1167,   306,  574 },\n    {     204,     0,   177,  1265,     4,   385,    200,   208,  204 },\n    {       0,   102,   106,     4,    98,  1367,    487,   204,    0 }\n   };\n\n   static const double ca[][9] = {\n    {       4,    -13,    11,   -9,    -9,   -3,     -1,     4,     0 },\n    {    -156,     59,   -42,    6,    19,  -20,    -10,   -12,     0 },\n    {      64,   -152,    62,   -8,    32,  -41,     19,   -11,     0 },\n    {     124,    621,  -145,  208,    54,  -57,     30,    15,     0 },\n    {  -23437,  -2634,  6601, 6259, -1507,-1821,   2620, -2115, -1489 },\n    {   62911,-119919, 79336,17814,-24241,12068,   8306, -4893,  8902 },\n    {  389061,-262125,-44088, 8387,-22976,-2093,   -615, -9720,  6633 },\n    { -412235,-157046,-31430,37817, -9740,  -13,  -7449,  9644,     0 }\n   };\n\n   static const double sa[][9] = {\n    {     -29,    -1,     9,     6,    -6,     5,     4,     0,     0 },\n    {     -48,  -125,   -26,   -37,    18,   -13,   -20,    -2,     0 },\n    {    -150,   -46,    68,    54,    14,    24,   -28,    22,     0 },\n    {    -621,   532,  -694,   -20,   192,   -94,    71,   -73,     0 },\n    {  -14614,-19828, -5869,  1881, -4372, -2255,   782,   930,   913 },\n    {  139737,     0, 24667, 51123, -5102,  7429, -4095, -1976, -9566 },\n    { -138081,     0, 37205,-49039,-41901,-33872,-27037,-12474, 18797 },\n    {       0, 28492,133236, 69654, 52322,-49577,-26430, -3593,     0 }\n   };\n\n/* Tables giving the trigonometric terms to be added to the mean */\n/* elements of the mean longitudes */\n\n   static const double kq[][10] = {\n    {   3086,15746,69613,59899,75645,88306, 12661,  2658,    0,     0 },\n    {  21863,32794,10931,   73, 4387,26934,  1473,  2157,    0,     0 },\n    {     10,16002,21863,10931, 1473,32004,  4387,    73,    0,     0 },\n    {     10, 6345, 7818, 1107,15636, 7077,  8184,   532,   10,     0 },\n    {     19, 1760, 1454,  287, 1167,  880,   574,  2640,   19,  1454 },\n    {     19,  574,  287,  306, 1760,   12,    31,    38,   19,   574 },\n    {      4,  204,  177,    8,   31,  200,  1265,   102,    4,   204 },\n    {      4,  102,  106,    8,   98, 1367,   487,   204,    4,   102 }\n   };\n\n   static const double cl[][10] = {\n    {      21,   -95, -157,   41,   -5,   42,  23,  30,      0,     0 },\n    {    -160,  -313, -235,   60,  -74,  -76, -27,  34,      0,     0 },\n    {    -325,  -322,  -79,  232,  -52,   97,  55, -41,      0,     0 },\n    {    2268,  -979,  802,  602, -668,  -33, 345, 201,    -55,     0 },\n    {    7610, -4997,-7689,-5841,-2617, 1115,-748,-607,   6074,   354 },\n    {  -18549, 30125,20012, -730,  824,   23,1289,-352, -14767, -2062 },\n    { -135245,-14594, 4197,-4030,-5630,-2898,2540,-306,   2939,  1986 },\n    {   89948,  2103, 8963, 2695, 3682, 1648, 866,-154,  -1963,  -283 }\n   };\n\n   static const double sl[][10] = {\n    {   -342,   136,  -23,   62,   66,  -52, -33,    17,     0,     0 },\n    {    524,  -149,  -35,  117,  151,  122, -71,   -62,     0,     0 },\n    {   -105,  -137,  258,   35, -116,  -88,-112,   -80,     0,     0 },\n    {    854,  -205, -936, -240,  140, -341, -97,  -232,   536,     0 },\n    { -56980,  8016, 1012, 1448,-3024,-3710, 318,   503,  3767,   577 },\n    { 138606,-13478,-4964, 1441,-1319,-1482, 427,  1236, -9167, -1918 },\n    {  71234,-41116, 5334,-4935,-1848,   66, 434, -1748,  3780,  -701 },\n    { -47645, 11647, 2166, 3194,  679,    0,-244,  -419, -2531,    48 }\n   };\n\n/*--------------------------------------------------------------------*/\n\n/* Validate the planet number. */\n   if ((np < 1) || (np > 8)) {\n      jstat = -1;\n\n   /* Reset the result in case of failure. */\n      for (k = 0; k < 2; k++) {\n         for (i = 0; i < 3; i++) {\n            pv[k][i] = 0.0;\n         }\n      }\n\n   } else {\n\n   /* Decrement the planet number to start at zero. */\n      np--;\n\n   /* Time: Julian millennia since J2000.0. */\n      t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJM;\n\n   /* OK status unless remote date. */\n      jstat = fabs(t) <= 1.0 ? 0 : 1;\n\n   /* Compute the mean elements. */\n      da = a[np][0] +\n          (a[np][1] +\n           a[np][2] * t) * t;\n      dl = (3600.0 * dlm[np][0] +\n                    (dlm[np][1] +\n                     dlm[np][2] * t) * t) * ERFA_DAS2R;\n      de = e[np][0] +\n         ( e[np][1] +\n           e[np][2] * t) * t;\n      dp = eraAnpm((3600.0 * pi[np][0] +\n                            (pi[np][1] +\n                             pi[np][2] * t) * t) * ERFA_DAS2R);\n      di = (3600.0 * dinc[np][0] +\n                    (dinc[np][1] +\n                     dinc[np][2] * t) * t) * ERFA_DAS2R;\n      dom = eraAnpm((3600.0 * omega[np][0] +\n                             (omega[np][1] +\n                              omega[np][2] * t) * t) * ERFA_DAS2R);\n\n   /* Apply the trigonometric terms. */\n      dmu = 0.35953620 * t;\n      for (k = 0; k < 8; k++) {\n         arga = kp[np][k] * dmu;\n         argl = kq[np][k] * dmu;\n         da += (ca[np][k] * cos(arga) +\n                sa[np][k] * sin(arga)) * 1e-7;\n         dl += (cl[np][k] * cos(argl) +\n                sl[np][k] * sin(argl)) * 1e-7;\n      }\n      arga = kp[np][8] * dmu;\n      da += t * (ca[np][8] * cos(arga) +\n                 sa[np][8] * sin(arga)) * 1e-7;\n      for (k = 8; k < 10; k++) {\n         argl = kq[np][k] * dmu;\n         dl += t * (cl[np][k] * cos(argl) +\n                    sl[np][k] * sin(argl)) * 1e-7;\n      }\n      dl = fmod(dl, ERFA_D2PI);\n\n   /* Iterative soln. of Kepler's equation to get eccentric anomaly. */\n      am = dl - dp;\n      ae = am + de * sin(am);\n      k = 0;\n      dae = 1.0;\n      while (k < KMAX && fabs(dae) > 1e-12) {\n         dae = (am - ae + de * sin(ae)) / (1.0 - de * cos(ae));\n         ae += dae;\n         k++;\n         if (k == KMAX-1) jstat = 2;\n      }\n\n   /* True anomaly. */\n      ae2 = ae / 2.0;\n      at = 2.0 * atan2(sqrt((1.0 + de) / (1.0 - de)) * sin(ae2),\n                                                       cos(ae2));\n\n   /* Distance (au) and speed (radians per day). */\n      r = da * (1.0 - de * cos(ae));\n      v = GK * sqrt((1.0 + 1.0 / amas[np]) / (da * da * da));\n\n      si2 = sin(di / 2.0);\n      xq = si2 * cos(dom);\n      xp = si2 * sin(dom);\n      tl = at + dp;\n      xsw = sin(tl);\n      xcw = cos(tl);\n      xm2 = 2.0 * (xp * xcw - xq * xsw);\n      xf = da / sqrt(1  -  de * de);\n      ci2 = cos(di / 2.0);\n      xms = (de * sin(dp) + xsw) * xf;\n      xmc = (de * cos(dp) + xcw) * xf;\n      xpxq2 = 2 * xp * xq;\n\n   /* Position (J2000.0 ecliptic x,y,z in au). */\n      x = r * (xcw - xm2 * xp);\n      y = r * (xsw + xm2 * xq);\n      z = r * (-xm2 * ci2);\n\n   /* Rotate to equatorial. */\n      pv[0][0] = x;\n      pv[0][1] = y * COSEPS - z * SINEPS;\n      pv[0][2] = y * SINEPS + z * COSEPS;\n\n   /* Velocity (J2000.0 ecliptic xdot,ydot,zdot in au/d). */\n      x = v * (( -1.0 + 2.0 * xp * xp) * xms + xpxq2 * xmc);\n      y = v * ((  1.0 - 2.0 * xq * xq) * xmc - xpxq2 * xms);\n      z = v * (2.0 * ci2 * (xp * xms + xq * xmc));\n\n   /* Rotate to equatorial. */\n      pv[1][0] = x;\n      pv[1][1] = y * COSEPS - z * SINEPS;\n      pv[1][2] = y * SINEPS + z * COSEPS;\n\n   }\n\n/* Return the status. */\n   return jstat;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13336,"name":"eform.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraEform ( int n, double *a, double *f )\n/*\n**  - - - - - - - - -\n**   e r a E f o r m\n**  - - - - - - - - -\n**\n**  Earth reference ellipsoids.\n**\n**  Given:\n**     n    int         ellipsoid identifier (Note 1)\n**\n**  Returned:\n**     a    double      equatorial radius (meters, Note 2)\n**     f    double      flattening (Note 2)\n**\n**  Returned (function value):\n**          int         status:  0 = OK\n**                              -1 = illegal identifier (Note 3)\n**\n**  Notes:\n**\n**  1) The identifier n is a number that specifies the choice of\n**     reference ellipsoid.  The following are supported:\n**\n**        n    ellipsoid\n**\n**        1     ERFA_WGS84\n**        2     ERFA_GRS80\n**        3     ERFA_WGS72\n**\n**     The n value has no significance outside the ERFA software.  For\n**     convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.\n**\n**  2) The ellipsoid parameters are returned in the form of equatorial\n**     radius in meters (a) and flattening (f).  The latter is a number\n**     around 0.00335, i.e. around 1/298.\n**\n**  3) For the case where an unsupported n value is supplied, zero a and\n**     f are returned, as well as error status.\n**\n**  References:\n**\n**     Department of Defense World Geodetic System 1984, National\n**     Imagery and Mapping Agency Technical Report 8350.2, Third\n**     Edition, p3-2.\n**\n**     Moritz, H., Bull. Geodesique 66-2, 187 (1992).\n**\n**     The Department of Defense World Geodetic System 1972, World\n**     Geodetic System Committee, May 1974.\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     p220.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Look up a and f for the specified reference ellipsoid. */\n   switch ( n ) {\n\n   case ERFA_WGS84:\n      *a = 6378137.0;\n      *f = 1.0 / 298.257223563;\n      break;\n\n   case ERFA_GRS80:\n      *a = 6378137.0;\n      *f = 1.0 / 298.257222101;\n      break;\n\n   case ERFA_WGS72:\n      *a = 6378135.0;\n      *f = 1.0 / 298.26;\n      break;\n\n   default:\n\n   /* Invalid identifier. */\n      *a = 0.0;\n      *f = 0.0;\n      return -1;\n\n   }\n\n/* OK status. */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13337,"name":"num00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNum00b(double date1, double date2, double rmatn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a N u m 0 0 b\n**  - - - - - - - - - -\n**\n**  Form the matrix of nutation for a given date, IAU 2000B model.\n**\n**  Given:\n**     date1,date2  double         TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rmatn        double[3][3]   nutation matrix\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where\n**     the p-vector V(true) is with respect to the true equatorial triad\n**     of date and the p-vector V(mean) is with respect to the mean\n**     equatorial triad of date.\n**\n**  3) The present function is faster, but slightly less accurate (about\n**     1 mas), than the eraNum00a function.\n**\n**  Called:\n**     eraPn00b     bias/precession/nutation, IAU 2000B\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.222-3 (p114).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rbpn[3][3];\n\n\n/* Obtain the required matrix (discarding other results). */\n   eraPn00b(date1, date2,\n            &dpsi, &deps, &epsa, rb, rp, rbp, rmatn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13338,"name":"apco13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraApco13(double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              eraASTROM *astrom, double *eo)\n/*\n**  - - - - - - - - - -\n**   e r a A p c o 1 3\n**  - - - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between ICRS and observed\n**  coordinates.  The caller supplies UTC, site coordinates, ambient air\n**  conditions and observing wavelength, and ERFA models are used to\n**  obtain the Earth ephemeris, CIP/CIO and refraction constants.\n**\n**  The parameters produced by this function are required in the\n**  parallax, light deflection, aberration, and bias-precession-nutation\n**  parts of the ICRS/CIRS transformations.\n**\n**  Given:\n**     utc1   double     UTC as a 2-part...\n**     utc2   double     ...quasi Julian Date (Notes 1,2)\n**     dut1   double     UT1-UTC (seconds, Note 3)\n**     elong  double     longitude (radians, east +ve, Note 4)\n**     phi    double     latitude (geodetic, radians, Note 4)\n**     hm     double     height above ellipsoid (m, geodetic, Notes 4,6)\n**     xp,yp  double     polar motion coordinates (radians, Note 5)\n**     phpa   double     pressure at the observer (hPa = mB, Note 6)\n**     tc     double     ambient temperature at the observer (deg C)\n**     rh     double     relative humidity at the observer (range 0-1)\n**     wl     double     wavelength (micrometers, Note 7)\n**\n**  Returned:\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**     eo     double*    equation of the origins (ERA-GST)\n**\n**  Returned (function value):\n**            int        status: +1 = dubious year (Note 2)\n**                                0 = OK\n**                               -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  2)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the\n**      future to be trusted.  See eraDat for further details.\n**\n**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  4)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many\n**      applications, xp and yp can be set to zero.\n**\n**      Internally, the polar motion is stored in a form rotated onto\n**      the local meridian.\n**\n**  6)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB), is\n**      available, an adequate estimate of hm can be obtained from the\n**      expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to\n**      the pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  7)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  8)  It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  9)  In cases where the caller wishes to supply his own Earth\n**      ephemeris, Earth rotation information and refraction constants,\n**      the function eraApco can be used instead of the present function.\n**\n**  10) This is one of several functions that inserts into the astrom\n**      structure star-independent parameters needed for the chain of\n**      astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**      The various functions support different classes of observer and\n**      portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**      Those with names ending in \"13\" use contemporary ERFA models to\n**      compute the various ephemerides.  The others accept ephemerides\n**      supplied by the caller.\n**\n**      The transformation from ICRS to GCRS covers space motion,\n**      parallax, light deflection, and aberration.  From GCRS to CIRS\n**      comprises frame bias and precession-nutation.  From CIRS to\n**      observed takes account of Earth rotation, polar motion, diurnal\n**      aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**      transformation), and atmospheric refraction.\n**\n**  11) The context structure astrom produced by this function is used\n**      by eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.\n**\n**  Called:\n**     eraUtctai    UTC to TAI\n**     eraTaitt     TAI to TT\n**     eraUtcut1    UTC to UT1\n**     eraEpv00     Earth position and velocity\n**     eraPnm06a    classical NPB matrix, IAU 2006/2000A\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**     eraS06       the CIO locator s, given X,Y, IAU 2006\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraRefco     refraction constants for given ambient conditions\n**     eraApco      astrometry parameters, ICRS-observed\n**     eraEors      equation of the origins, given NPB matrix and s\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   double tai1, tai2, tt1, tt2, ut11, ut12, ehpv[2][3], ebpv[2][3],\n          r[3][3], x, y, s, theta, sp, refa, refb;\n\n\n/* UTC to other time scales. */\n   j = eraUtctai(utc1, utc2, &tai1, &tai2);\n   if ( j < 0 ) return -1;\n   j = eraTaitt(tai1, tai2, &tt1, &tt2);\n   j = eraUtcut1(utc1, utc2, dut1, &ut11, &ut12);\n   if ( j < 0 ) return -1;\n\n/* Earth barycentric & heliocentric position/velocity (au, au/d). */\n   (void) eraEpv00(tt1, tt2, ehpv, ebpv);\n\n/* Form the equinox based BPN matrix, IAU 2006/2000A. */\n   eraPnm06a(tt1, tt2, r);\n\n/* Extract CIP X,Y. */\n   eraBpn2xy(r, &x, &y);\n\n/* Obtain CIO locator s. */\n   s = eraS06(tt1, tt2, x, y);\n\n/* Earth rotation angle. */\n   theta = eraEra00(ut11, ut12);\n\n/* TIO locator s'. */\n   sp = eraSp00(tt1, tt2);\n\n/* Refraction constants A and B. */\n   eraRefco(phpa, tc, rh, wl, &refa, &refb);\n\n/* Compute the star-independent astrometry parameters. */\n   eraApco(tt1, tt2, ebpv, ehpv[0], x, y, s, theta,\n           elong, phi, hm, xp, yp, sp, refa, refb, astrom);\n\n/* Equation of the origins. */\n   *eo = eraEors(r, s);\n\n/* Return any warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13339,"name":"eect00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEect00(double date1, double date2)\n/*\n**  - - - - - - - - - -\n**   e r a E e c t 0 0\n**  - - - - - - - - - -\n**\n**  Equation of the equinoxes complementary terms, consistent with\n**  IAU 2000 resolutions.\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double   complementary terms (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The \"complementary terms\" are part of the equation of the\n**     equinoxes (EE), classically the difference between apparent and\n**     mean Sidereal Time:\n**\n**        GAST = GMST + EE\n**\n**     with:\n**\n**        EE = dpsi * cos(eps)\n**\n**     where dpsi is the nutation in longitude and eps is the obliquity\n**     of date.  However, if the rotation of the Earth were constant in\n**     an inertial frame the classical formulation would lead to\n**     apparent irregularities in the UT1 timescale traceable to side-\n**     effects of precession-nutation.  In order to eliminate these\n**     effects from UT1, \"complementary terms\" were introduced in 1994\n**     (IAU, 1994) and took effect from 1997 (Capitaine and Gontier,\n**     1993):\n**\n**        GAST = GMST + CT + EE\n**\n**     By convention, the complementary terms are included as part of\n**     the equation of the equinoxes rather than as part of the mean\n**     Sidereal Time.  This slightly compromises the \"geometrical\"\n**     interpretation of mean sidereal time but is otherwise\n**     inconsequential.\n**\n**     The present function computes CT in the above expression,\n**     compatible with IAU 2000 resolutions (Capitaine et al., 2002, and\n**     IERS Conventions 2003).\n**\n**  Called:\n**     eraFal03     mean anomaly of the Moon\n**     eraFalp03    mean anomaly of the Sun\n**     eraFaf03     mean argument of the latitude of the Moon\n**     eraFad03     mean elongation of the Moon from the Sun\n**     eraFaom03    mean longitude of the Moon's ascending node\n**     eraFave03    mean longitude of Venus\n**     eraFae03     mean longitude of Earth\n**     eraFapa03    general accumulated precession in longitude\n**\n**  References:\n**\n**     Capitaine, N. & Gontier, A.-M., Astron. Astrophys., 275,\n**     645-650 (1993)\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     IAU Resolution C7, Recommendation 3 (1994)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Time since J2000.0, in Julian centuries */\n   double t;\n\n/* Miscellaneous */\n   int i, j;\n   double a, s0, s1;\n\n/* Fundamental arguments */\n   double fa[14];\n\n/* Returned value. */\n   double eect;\n\n/* ----------------------------------------- */\n/* The series for the EE complementary terms */\n/* ----------------------------------------- */\n\n   typedef struct {\n      int nfa[8];      /* coefficients of l,l',F,D,Om,LVe,LE,pA */\n      double s, c;     /* sine and cosine coefficients */\n   } TERM;\n\n/* Terms of order t^0 */\n   static const TERM e0[] = {\n\n   /* 1-10 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0}, 2640.96e-6, -0.39e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},   63.52e-6, -0.02e-6 },\n      {{ 0,  0,  2, -2,  3,  0,  0,  0},   11.75e-6,  0.01e-6 },\n      {{ 0,  0,  2, -2,  1,  0,  0,  0},   11.21e-6,  0.01e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},   -4.55e-6,  0.00e-6 },\n      {{ 0,  0,  2,  0,  3,  0,  0,  0},    2.02e-6,  0.00e-6 },\n      {{ 0,  0,  2,  0,  1,  0,  0,  0},    1.98e-6,  0.00e-6 },\n      {{ 0,  0,  0,  0,  3,  0,  0,  0},   -1.72e-6,  0.00e-6 },\n      {{ 0,  1,  0,  0,  1,  0,  0,  0},   -1.41e-6, -0.01e-6 },\n      {{ 0,  1,  0,  0, -1,  0,  0,  0},   -1.26e-6, -0.01e-6 },\n\n   /* 11-20 */\n      {{ 1,  0,  0,  0, -1,  0,  0,  0},   -0.63e-6,  0.00e-6 },\n      {{ 1,  0,  0,  0,  1,  0,  0,  0},   -0.63e-6,  0.00e-6 },\n      {{ 0,  1,  2, -2,  3,  0,  0,  0},    0.46e-6,  0.00e-6 },\n      {{ 0,  1,  2, -2,  1,  0,  0,  0},    0.45e-6,  0.00e-6 },\n      {{ 0,  0,  4, -4,  4,  0,  0,  0},    0.36e-6,  0.00e-6 },\n      {{ 0,  0,  1, -1,  1, -8, 12,  0},   -0.24e-6, -0.12e-6 },\n      {{ 0,  0,  2,  0,  0,  0,  0,  0},    0.32e-6,  0.00e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},    0.28e-6,  0.00e-6 },\n      {{ 1,  0,  2,  0,  3,  0,  0,  0},    0.27e-6,  0.00e-6 },\n      {{ 1,  0,  2,  0,  1,  0,  0,  0},    0.26e-6,  0.00e-6 },\n\n   /* 21-30 */\n      {{ 0,  0,  2, -2,  0,  0,  0,  0},   -0.21e-6,  0.00e-6 },\n      {{ 0,  1, -2,  2, -3,  0,  0,  0},    0.19e-6,  0.00e-6 },\n      {{ 0,  1, -2,  2, -1,  0,  0,  0},    0.18e-6,  0.00e-6 },\n      {{ 0,  0,  0,  0,  0,  8,-13, -1},   -0.10e-6,  0.05e-6 },\n      {{ 0,  0,  0,  2,  0,  0,  0,  0},    0.15e-6,  0.00e-6 },\n      {{ 2,  0, -2,  0, -1,  0,  0,  0},   -0.14e-6,  0.00e-6 },\n      {{ 1,  0,  0, -2,  1,  0,  0,  0},    0.14e-6,  0.00e-6 },\n      {{ 0,  1,  2, -2,  2,  0,  0,  0},   -0.14e-6,  0.00e-6 },\n      {{ 1,  0,  0, -2, -1,  0,  0,  0},    0.14e-6,  0.00e-6 },\n      {{ 0,  0,  4, -2,  4,  0,  0,  0},    0.13e-6,  0.00e-6 },\n\n   /* 31-33 */\n      {{ 0,  0,  2, -2,  4,  0,  0,  0},   -0.11e-6,  0.00e-6 },\n      {{ 1,  0, -2,  0, -3,  0,  0,  0},    0.11e-6,  0.00e-6 },\n      {{ 1,  0, -2,  0, -1,  0,  0,  0},    0.11e-6,  0.00e-6 }\n   };\n\n/* Terms of order t^1 */\n   static const TERM e1[] = {\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},    -0.87e-6,  0.00e-6 }\n   };\n\n/* Number of terms in the series */\n   const int NE0 = (int) (sizeof e0 / sizeof (TERM));\n   const int NE1 = (int) (sizeof e1 / sizeof (TERM));\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental epoch J2000.0 and current date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Fundamental Arguments (from IERS Conventions 2003) */\n\n/* Mean anomaly of the Moon. */\n   fa[0] = eraFal03(t);\n\n/* Mean anomaly of the Sun. */\n   fa[1] = eraFalp03(t);\n\n/* Mean longitude of the Moon minus that of the ascending node. */\n   fa[2] = eraFaf03(t);\n\n/* Mean elongation of the Moon from the Sun. */\n   fa[3] = eraFad03(t);\n\n/* Mean longitude of the ascending node of the Moon. */\n   fa[4] = eraFaom03(t);\n\n/* Mean longitude of Venus. */\n   fa[5] = eraFave03(t);\n\n/* Mean longitude of Earth. */\n   fa[6] = eraFae03(t);\n\n/* General precession in longitude. */\n   fa[7] = eraFapa03(t);\n\n/* Evaluate the EE complementary terms. */\n   s0 = 0.0;\n   s1 = 0.0;\n\n   for (i = NE0-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)(e0[i].nfa[j]) * fa[j];\n      }\n      s0 += e0[i].s * sin(a) + e0[i].c * cos(a);\n   }\n\n   for (i = NE1-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)(e1[i].nfa[j]) * fa[j];\n      }\n      s1 += e1[i].s * sin(a) + e1[i].c * cos(a);\n   }\n\n   eect = (s0 + s1 * t ) * ERFA_DAS2R;\n\n   return eect;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13340,"name":"pmp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPmp(double a[3], double b[3], double amb[3])\n/*\n**  - - - - - - -\n**   e r a P m p\n**  - - - - - - -\n**\n**  P-vector subtraction.\n**\n**  Given:\n**     a        double[3]      first p-vector\n**     b        double[3]      second p-vector\n**\n**  Returned:\n**     amb      double[3]      a - b\n**\n**  Note:\n**     It is permissible to re-use the same array for any of the\n**     arguments.\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   amb[0] = a[0] - b[0];\n   amb[1] = a[1] - b[1];\n   amb[2] = a[2] - b[2];\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13341,"name":"eors.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraEors(double rnpb[3][3], double s)\n/*\n**  - - - - - - - -\n**   e r a E o r s\n**  - - - - - - - -\n**\n**  Equation of the origins, given the classical NPB matrix and the\n**  quantity s.\n**\n**  Given:\n**     rnpb  double[3][3]  classical nutation x precession x bias matrix\n**     s     double        the quantity s (the CIO locator)\n**\n**  Returned (function value):\n**           double        the equation of the origins in radians.\n**\n**  Notes:\n**\n**  1)  The equation of the origins is the distance between the true\n**      equinox and the celestial intermediate origin and, equivalently,\n**      the difference between Earth rotation angle and Greenwich\n**      apparent sidereal time (ERA-GST).  It comprises the precession\n**      (since J2000.0) in right ascension plus the equation of the\n**      equinoxes (including the small correction terms).\n**\n**  2)  The algorithm is from Wallace & Capitaine (2006).\n**\n** References:\n**\n**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855\n**\n**     Wallace, P. & Capitaine, N., 2006, Astron.Astrophys. 459, 981\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double x, ax, xs, ys, zs, p, q, eo;\n\n\n/* Evaluate Wallace & Capitaine (2006) expression (16). */\n   x = rnpb[2][0];\n   ax = x / (1.0 + rnpb[2][2]);\n   xs = 1.0 - ax * x;\n   ys = -ax * rnpb[2][1];\n   zs = -x;\n   p = rnpb[0][0] * xs + rnpb[0][1] * ys + rnpb[0][2] * zs;\n   q = rnpb[1][0] * xs + rnpb[1][1] * ys + rnpb[1][2] * zs;\n   eo = ((p != 0) || (q != 0)) ? s - atan2(q, p) : s;\n\n   return eo;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13342,"name":"d2dtf.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n#include <string.h>\n\nint eraD2dtf(const char *scale, int ndp, double d1, double d2,\n             int *iy, int *im, int *id, int ihmsf[4])\n/*\n**  - - - - - - - - -\n**   e r a D 2 d t f\n**  - - - - - - - - -\n**\n**  Format for output a 2-part Julian Date (or in the case of UTC a\n**  quasi-JD form that includes special provision for leap seconds).\n**\n**  Given:\n**     scale     char[]  time scale ID (Note 1)\n**     ndp       int     resolution (Note 2)\n**     d1,d2     double  time as a 2-part Julian Date (Notes 3,4)\n**\n**  Returned:\n**     iy,im,id  int     year, month, day in Gregorian calendar (Note 5)\n**     ihmsf     int[4]  hours, minutes, seconds, fraction (Note 1)\n**\n**  Returned (function value):\n**               int     status: +1 = dubious year (Note 5)\n**                                0 = OK\n**                               -1 = unacceptable date (Note 6)\n**\n**  Notes:\n**\n**  1) scale identifies the time scale.  Only the value \"UTC\" (in upper\n**     case) is significant, and enables handling of leap seconds (see\n**     Note 4).\n**\n**  2) ndp is the number of decimal places in the seconds field, and can\n**     have negative as well as positive values, such as:\n**\n**     ndp         resolution\n**     -4            1 00 00\n**     -3            0 10 00\n**     -2            0 01 00\n**     -1            0 00 10\n**      0            0 00 01\n**      1            0 00 00.1\n**      2            0 00 00.01\n**      3            0 00 00.001\n**\n**     The limits are platform dependent, but a safe range is -5 to +9.\n**\n**  3) d1+d2 is Julian Date, apportioned in any convenient way between\n**     the two arguments, for example where d1 is the Julian Day Number\n**     and d2 is the fraction of a day.  In the case of UTC, where the\n**     use of JD is problematical, special conventions apply:  see the\n**     next note.\n**\n**  4) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The ERFA internal convention is that\n**     the quasi-JD day represents UTC days whether the length is 86399,\n**     86400 or 86401 SI seconds.  In the 1960-1972 era there were\n**     smaller jumps (in either direction) each time the linear UTC(TAI)\n**     expression was changed, and these \"mini-leaps\" are also included\n**     in the ERFA convention.\n**\n**  5) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  6) For calendar conventions and limitations, see eraCal2jd.\n**\n**  Called:\n**     eraJd2cal    JD to Gregorian calendar\n**     eraD2tf      decompose days to hms\n**     eraDat       delta(AT) = TAI-UTC\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int leap;\n   char s;\n   int iy1, im1, id1, js, iy2, im2, id2, ihmsf1[4], i;\n   double a1, b1, fd, dat0, dat12, w, dat24, dleap;\n\n\n/* The two-part JD. */\n   a1 = d1;\n   b1 = d2;\n\n/* Provisional calendar date. */\n   js = eraJd2cal(a1, b1, &iy1, &im1, &id1, &fd);\n   if ( js ) return -1;\n\n/* Is this a leap second day? */\n   leap = 0;\n   if ( ! strcmp(scale,\"UTC\") ) {\n\n   /* TAI-UTC at 0h today. */\n      js = eraDat(iy1, im1, id1, 0.0, &dat0);\n      if ( js < 0 ) return -1;\n\n   /* TAI-UTC at 12h today (to detect drift). */\n      js = eraDat(iy1, im1, id1, 0.5, &dat12);\n      if ( js < 0 ) return -1;\n\n   /* TAI-UTC at 0h tomorrow (to detect jumps). */\n      js = eraJd2cal(a1+1.5, b1-fd, &iy2, &im2, &id2, &w);\n      if ( js ) return -1;\n      js = eraDat(iy2, im2, id2, 0.0, &dat24);\n      if ( js < 0 ) return -1;\n\n   /* Any sudden change in TAI-UTC (seconds). */\n      dleap = dat24 - (2.0*dat12 - dat0);\n\n   /* If leap second day, scale the fraction of a day into SI. */\n      leap = (dleap != 0.0);\n      if (leap) fd += fd * dleap/ERFA_DAYSEC;\n   }\n\n/* Provisional time of day. */\n   eraD2tf ( ndp, fd, &s, ihmsf1 );\n\n/* Has the (rounded) time gone past 24h? */\n   if ( ihmsf1[0] > 23 ) {\n\n   /* Yes.  We probably need tomorrow's calendar date. */\n      js = eraJd2cal(a1+1.5, b1-fd, &iy2, &im2, &id2, &w);\n      if ( js ) return -1;\n\n   /* Is today a leap second day? */\n      if ( ! leap ) {\n\n      /* No.  Use 0h tomorrow. */\n         iy1 = iy2;\n         im1 = im2;\n         id1 = id2;\n         ihmsf1[0] = 0;\n         ihmsf1[1] = 0;\n         ihmsf1[2] = 0;\n\n      } else {\n\n      /* Yes.  Are we past the leap second itself? */\n         if ( ihmsf1[2] > 0 ) {\n\n         /* Yes.  Use tomorrow but allow for the leap second. */\n            iy1 = iy2;\n            im1 = im2;\n            id1 = id2;\n            ihmsf1[0] = 0;\n            ihmsf1[1] = 0;\n            ihmsf1[2] = 0;\n\n         } else {\n\n         /* No.  Use 23 59 60... today. */\n            ihmsf1[0] = 23;\n            ihmsf1[1] = 59;\n            ihmsf1[2] = 60;\n         }\n\n      /* If rounding to 10s or coarser always go up to new day. */\n         if ( ndp < 0 && ihmsf1[2] == 60 ) {\n            iy1 = iy2;\n            im1 = im2;\n            id1 = id2;\n            ihmsf1[0] = 0;\n            ihmsf1[1] = 0;\n            ihmsf1[2] = 0;\n         }\n      }\n   }\n\n/* Results. */\n   *iy = iy1;\n   *im = im1;\n   *id = id1;\n   for ( i = 0; i < 4; i++ ) {\n      ihmsf[i] = ihmsf1[i];\n   }\n\n/* Status. */\n   return js;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13343,"name":"dtf2d.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n#include <string.h>\n\nint eraDtf2d(const char *scale, int iy, int im, int id,\n             int ihr, int imn, double sec, double *d1, double *d2)\n/*\n**  - - - - - - - - -\n**   e r a D t f 2 d\n**  - - - - - - - - -\n**\n**  Encode date and time fields into 2-part Julian Date (or in the case\n**  of UTC a quasi-JD form that includes special provision for leap\n**  seconds).\n**\n**  Given:\n**     scale     char[]  time scale ID (Note 1)\n**     iy,im,id  int     year, month, day in Gregorian calendar (Note 2)\n**     ihr,imn   int     hour, minute\n**     sec       double  seconds\n**\n**  Returned:\n**     d1,d2     double  2-part Julian Date (Notes 3,4)\n**\n**  Returned (function value):\n**               int     status: +3 = both of next two\n**                               +2 = time is after end of day (Note 5)\n**                               +1 = dubious year (Note 6)\n**                                0 = OK\n**                               -1 = bad year\n**                               -2 = bad month\n**                               -3 = bad day\n**                               -4 = bad hour\n**                               -5 = bad minute\n**                               -6 = bad second (<0)\n**\n**  Notes:\n**\n**  1) scale identifies the time scale.  Only the value \"UTC\" (in upper\n**     case) is significant, and enables handling of leap seconds (see\n**     Note 4).\n**\n**  2) For calendar conventions and limitations, see eraCal2jd.\n**\n**  3) The sum of the results, d1+d2, is Julian Date, where normally d1\n**     is the Julian Day Number and d2 is the fraction of a day.  In the\n**     case of UTC, where the use of JD is problematical, special\n**     conventions apply:  see the next note.\n**\n**  4) JD cannot unambiguously represent UTC during a leap second unless\n**     special measures are taken.  The ERFA internal convention is that\n**     the quasi-JD day represents UTC days whether the length is 86399,\n**     86400 or 86401 SI seconds.  In the 1960-1972 era there were\n**     smaller jumps (in either direction) each time the linear UTC(TAI)\n**     expression was changed, and these \"mini-leaps\" are also included\n**     in the ERFA convention.\n**\n**  5) The warning status \"time is after end of day\" usually means that\n**     the sec argument is greater than 60.0.  However, in a day ending\n**     in a leap second the limit changes to 61.0 (or 59.0 in the case\n**     of a negative leap second).\n**\n**  6) The warning status \"dubious year\" flags UTCs that predate the\n**     introduction of the time scale or that are too far in the future\n**     to be trusted.  See eraDat for further details.\n**\n**  7) Only in the case of continuous and regular time scales (TAI, TT,\n**     TCG, TCB and TDB) is the result d1+d2 a Julian Date, strictly\n**     speaking.  In the other cases (UT1 and UTC) the result must be\n**     used with circumspection;  in particular the difference between\n**     two such results cannot be interpreted as a precise time\n**     interval.\n**\n**  Called:\n**     eraCal2jd    Gregorian calendar to JD\n**     eraDat       delta(AT) = TAI-UTC\n**     eraJd2cal    JD to Gregorian calendar\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int js, iy2, im2, id2;\n   double dj, w, day, seclim, dat0, dat12, dat24, dleap, time;\n\n\n/* Today's Julian Day Number. */\n   js = eraCal2jd(iy, im, id, &dj, &w);\n   if ( js ) return js;\n   dj += w;\n\n/* Day length and final minute length in seconds (provisional). */\n   day = ERFA_DAYSEC;\n   seclim = 60.0;\n\n/* Deal with the UTC leap second case. */\n   if ( ! strcmp(scale,\"UTC\") ) {\n\n   /* TAI-UTC at 0h today. */\n      js = eraDat(iy, im, id, 0.0, &dat0);\n      if ( js < 0 ) return js;\n\n   /* TAI-UTC at 12h today (to detect drift). */\n      js = eraDat(iy, im, id, 0.5, &dat12);\n      if ( js < 0 ) return js;\n\n   /* TAI-UTC at 0h tomorrow (to detect jumps). */\n      js = eraJd2cal ( dj, 1.5, &iy2, &im2, &id2, &w);\n      if ( js ) return js;\n      js = eraDat(iy2, im2, id2, 0.0, &dat24);\n      if ( js < 0 ) return js;\n\n   /* Any sudden change in TAI-UTC between today and tomorrow. */\n      dleap = dat24 - (2.0*dat12 - dat0);\n\n   /* If leap second day, correct the day and final minute lengths. */\n      day += dleap;\n      if ( ihr == 23 && imn == 59 ) seclim += dleap;\n\n   /* End of UTC-specific actions. */\n   }\n\n/* Validate the time. */\n   if ( ihr >= 0 && ihr <= 23 ) {\n      if ( imn >= 0 && imn <= 59 ) {\n         if ( sec >= 0 ) {\n            if ( sec >= seclim ) {\n               js += 2;\n            }\n         } else {\n            js = -6;\n         }\n      } else {\n         js = -5;\n      }\n   } else {\n      js = -4;\n   }\n   if ( js < 0 ) return js;\n\n/* The time in days. */\n   time  = ( 60.0 * ( (double) ( 60 * ihr + imn ) ) + sec ) / day;\n\n/* Return the date and time. */\n   *d1 = dj;\n   *d2 = time;\n\n/* Status. */\n   return js;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13344,"name":"pmsafe.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraPmsafe(double ra1, double dec1, double pmr1, double pmd1,\n              double px1, double rv1,\n              double ep1a, double ep1b, double ep2a, double ep2b,\n              double *ra2, double *dec2, double *pmr2, double *pmd2,\n              double *px2, double *rv2)\n/*\n**  - - - - - - - - - -\n**   e r a P m s a f e\n**  - - - - - - - - - -\n**\n**  Star proper motion:  update star catalog data for space motion, with\n**  special handling to handle the zero parallax case.\n**\n**  Given:\n**     ra1    double      right ascension (radians), before\n**     dec1   double      declination (radians), before\n**     pmr1   double      RA proper motion (radians/year), before\n**     pmd1   double      Dec proper motion (radians/year), before\n**     px1    double      parallax (arcseconds), before\n**     rv1    double      radial velocity (km/s, +ve = receding), before\n**     ep1a   double      \"before\" epoch, part A (Note 1)\n**     ep1b   double      \"before\" epoch, part B (Note 1)\n**     ep2a   double      \"after\" epoch, part A (Note 1)\n**     ep2b   double      \"after\" epoch, part B (Note 1)\n**\n**  Returned:\n**     ra2    double      right ascension (radians), after\n**     dec2   double      declination (radians), after\n**     pmr2   double      RA proper motion (radians/year), after\n**     pmd2   double      Dec proper motion (radians/year), after\n**     px2    double      parallax (arcseconds), after\n**     rv2    double      radial velocity (km/s, +ve = receding), after\n**\n**  Returned (function value):\n**            int         status:\n**                         -1 = system error (should not occur)\n**                          0 = no warnings or errors\n**                          1 = distance overridden (Note 6)\n**                          2 = excessive velocity (Note 7)\n**                          4 = solution didn't converge (Note 8)\n**                       else = binary logical OR of the above warnings\n**\n**  Notes:\n**\n**  1) The starting and ending TDB epochs ep1a+ep1b and ep2a+ep2b are\n**     Julian Dates, apportioned in any convenient way between the two\n**     parts (A and B).  For example, JD(TDB)=2450123.7 could be\n**     expressed in any of these ways, among others:\n**\n**            epNa            epNb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.\n**\n**  2) In accordance with normal star-catalog conventions, the object's\n**     right ascension and declination are freed from the effects of\n**     secular aberration.  The frame, which is aligned to the catalog\n**     equator and equinox, is Lorentzian and centered on the SSB.\n**\n**     The proper motions are the rate of change of the right ascension\n**     and declination at the catalog epoch and are in radians per TDB\n**     Julian year.\n**\n**     The parallax and radial velocity are in the same frame.\n**\n**  3) Care is needed with units.  The star coordinates are in radians\n**     and the proper motions in radians per Julian year, but the\n**     parallax is in arcseconds.\n**\n**  4) The RA proper motion is in terms of coordinate angle, not true\n**     angle.  If the catalog uses arcseconds for both RA and Dec proper\n**     motions, the RA proper motion will need to be divided by cos(Dec)\n**     before use.\n**\n**  5) Straight-line motion at constant speed, in the inertial frame, is\n**     assumed.\n**\n**  6) An extremely small (or zero or negative) parallax is overridden\n**     to ensure that the object is at a finite but very large distance,\n**     but not so large that the proper motion is equivalent to a large\n**     but safe speed (about 0.1c using the chosen constant).  A warning\n**     status of 1 is added to the status if this action has been taken.\n**\n**  7) If the space velocity is a significant fraction of c (see the\n**     constant VMAX in the function eraStarpv), it is arbitrarily set\n**     to zero.  When this action occurs, 2 is added to the status.\n**\n**  8) The relativistic adjustment carried out in the eraStarpv function\n**     involves an iterative calculation.  If the process fails to\n**     converge within a set number of iterations, 4 is added to the\n**     status.\n**\n**  Called:\n**     eraSeps      angle between two points\n**     eraStarpm    update star catalog data for space motion\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Minimum allowed parallax (arcsec) */\n   const double PXMIN = 5e-7;\n\n/* Factor giving maximum allowed transverse speed of about 1% c */\n   const double F = 326.0;\n\n   int jpx, j;\n   double pm, px1a;\n\n\n/* Proper motion in one year (radians). */\n   pm = eraSeps(ra1, dec1, ra1+pmr1, dec1+pmd1);\n\n/* Override the parallax to reduce the chances of a warning status. */\n   jpx = 0;\n   px1a = px1;\n   pm *= F;\n   if (px1a < pm) {jpx = 1; px1a = pm;}\n   if (px1a < PXMIN) {jpx = 1; px1a = PXMIN;}\n\n/* Carry out the transformation using the modified parallax. */\n   j = eraStarpm(ra1, dec1, pmr1, pmd1, px1a, rv1,\n                 ep1a, ep1b, ep2a, ep2b,\n                 ra2, dec2, pmr2, pmd2, px2, rv2);\n\n/* Revise and return the status. */\n   if ( !(j%2) ) j += jpx;\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13345,"name":"fw2xy.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraFw2xy(double gamb, double phib, double psi, double eps,\n              double *x, double *y)\n/*\n**  - - - - - - - - -\n**   e r a F w 2 x y\n**  - - - - - - - - -\n**\n**  CIP X,Y given Fukushima-Williams bias-precession-nutation angles.\n**\n**  Given:\n**     gamb     double    F-W angle gamma_bar (radians)\n**     phib     double    F-W angle phi_bar (radians)\n**     psi      double    F-W angle psi (radians)\n**     eps      double    F-W angle epsilon (radians)\n**\n**  Returned:\n**     x,y      double    CIP unit vector X,Y\n**\n**  Notes:\n**\n**  1) Naming the following points:\n**\n**           e = J2000.0 ecliptic pole,\n**           p = GCRS pole\n**           E = ecliptic pole of date,\n**     and   P = CIP,\n**\n**     the four Fukushima-Williams angles are as follows:\n**\n**        gamb = gamma = epE\n**        phib = phi = pE\n**        psi = psi = pEP\n**        eps = epsilon = EP\n**\n**  2) The matrix representing the combined effects of frame bias,\n**     precession and nutation is:\n**\n**        NxPxB = R_1(-epsA).R_3(-psi).R_1(phib).R_3(gamb)\n**\n**     The returned values x,y are elements [2][0] and [2][1] of the\n**     matrix.  Near J2000.0, they are essentially angles in radians.\n**\n**  Called:\n**     eraFw2m      F-W angles to r-matrix\n**     eraBpn2xy    extract CIP X,Y coordinates from NPB matrix\n**\n**  Reference:\n**\n**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r[3][3];\n\n\n/* Form NxPxB matrix. */\n   eraFw2m(gamb, phib, psi, eps, r);\n\n/* Extract CIP X,Y. */\n   eraBpn2xy(r, x, y);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13346,"name":"fk5hip.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraFk5hip(double r5h[3][3], double s5h[3])\n/*\n**  - - - - - - - - - -\n**   e r a F k 5 h i p\n**  - - - - - - - - - -\n**\n**  FK5 to Hipparcos rotation and spin.\n**\n**  Returned:\n**     r5h   double[3][3]  r-matrix: FK5 rotation wrt Hipparcos (Note 2)\n**     s5h   double[3]     r-vector: FK5 spin wrt Hipparcos (Note 3)\n**\n**  Notes:\n**\n**  1) This function models the FK5 to Hipparcos transformation as a\n**     pure rotation and spin;  zonal errors in the FK5 catalogue are\n**     not taken into account.\n**\n**  2) The r-matrix r5h operates in the sense:\n**\n**           P_Hipparcos = r5h x P_FK5\n**\n**     where P_FK5 is a p-vector in the FK5 frame, and P_Hipparcos is\n**     the equivalent Hipparcos p-vector.\n**\n**  3) The r-vector s5h represents the time derivative of the FK5 to\n**     Hipparcos rotation.  The units are radians per year (Julian,\n**     TDB).\n**\n**  Called:\n**     eraRv2m      r-vector to r-matrix\n**\n**  Reference:\n**\n**     F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double v[3];\n\n/* FK5 wrt Hipparcos orientation and spin (radians, radians/year) */\n   double epx, epy, epz;\n   double omx, omy, omz;\n\n\n   epx = -19.9e-3 * ERFA_DAS2R;\n   epy =  -9.1e-3 * ERFA_DAS2R;\n   epz =  22.9e-3 * ERFA_DAS2R;\n\n   omx = -0.30e-3 * ERFA_DAS2R;\n   omy =  0.60e-3 * ERFA_DAS2R;\n   omz =  0.70e-3 * ERFA_DAS2R;\n\n/* FK5 to Hipparcos orientation expressed as an r-vector. */\n   v[0] = epx;\n   v[1] = epy;\n   v[2] = epz;\n\n/* Re-express as an r-matrix. */\n   eraRv2m(v, r5h);\n\n/* Hipparcos wrt FK5 spin expressed as an r-vector. */\n   s5h[0] = omx;\n   s5h[1] = omy;\n   s5h[2] = omz;\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13347,"name":"ppsp.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPpsp(double a[3], double s, double b[3], double apsb[3])\n/*\n**  - - - - - - - -\n**   e r a P p s p\n**  - - - - - - - -\n**\n**  P-vector plus scaled p-vector.\n**\n**  Given:\n**     a      double[3]     first p-vector\n**     s      double        scalar (multiplier for b)\n**     b      double[3]     second p-vector\n**\n**  Returned:\n**     apsb   double[3]     a + s*b\n**\n**  Note:\n**     It is permissible for any of a, b and apsb to be the same array.\n**\n**  Called:\n**     eraSxp       multiply p-vector by scalar\n**     eraPpp       p-vector plus p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double sb[3];\n\n\n/* s*b. */\n   eraSxp(s, b, sb);\n\n/* a + s*b. */\n   eraPpp(a, sb, apsb);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13348,"name":"gmst82.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGmst82(double dj1, double dj2)\n/*\n**  - - - - - - - - - -\n**   e r a G m s t 8 2\n**  - - - - - - - - - -\n**\n**  Universal Time to Greenwich mean sidereal time (IAU 1982 model).\n**\n**  Given:\n**     dj1,dj2    double    UT1 Julian Date (see note)\n**\n**  Returned (function value):\n**                double    Greenwich mean sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any\n**     convenient way between the arguments dj1 and dj2.  For example,\n**     JD(UT1)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**             dj1            dj2\n**\n**         2450123.7          0          (JD method)\n**          2451545        -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5         0.2         (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  The date & time method is\n**     best matched to the algorithm used:  maximum accuracy (or, at\n**     least, minimum noise) is delivered when the dj1 argument is for\n**     0hrs UT1 on the day in question and the dj2 argument lies in the\n**     range 0 to 1, or vice versa.\n**\n**  2) The algorithm is based on the IAU 1982 expression.  This is\n**     always described as giving the GMST at 0 hours UT1.  In fact, it\n**     gives the difference between the GMST and the UT, the steady\n**     4-minutes-per-day drawing-ahead of ST with respect to UT.  When\n**     whole days are ignored, the expression happens to equal the GMST\n**     at 0 hours UT1 each day.\n**\n**  3) In this function, the entire UT1 (the sum of the two arguments\n**     dj1 and dj2) is used directly as the argument for the standard\n**     formula, the constant term of which is adjusted by 12 hours to\n**     take account of the noon phasing of Julian Date.  The UT1 is then\n**     added, but omitting whole days to conserve accuracy.\n**\n**  Called:\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Transactions of the International Astronomical Union,\n**     XVIII B, 67 (1983).\n**\n**     Aoki et al., Astron. Astrophys. 105, 359-361 (1982).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Coefficients of IAU 1982 GMST-UT1 model */\n   double A = 24110.54841  -  ERFA_DAYSEC / 2.0;\n   double B = 8640184.812866;\n   double C = 0.093104;\n   double D =  -6.2e-6;\n\n/* Note: the first constant, A, has to be adjusted by 12 hours */\n/* because the UT1 is supplied as a Julian date, which begins  */\n/* at noon.                                                    */\n\n   double d1, d2, t, f, gmst;\n\n\n/* Julian centuries since fundamental epoch. */\n   if (dj1 < dj2) {\n      d1 = dj1;\n      d2 = dj2;\n   } else {\n      d1 = dj2;\n      d2 = dj1;\n   }\n   t = (d1 + (d2 - ERFA_DJ00)) / ERFA_DJC;\n\n/* Fractional part of JD(UT1), in seconds. */\n   f = ERFA_DAYSEC * (fmod(d1, 1.0) + fmod(d2, 1.0));\n\n/* GMST at this UT1. */\n   gmst = eraAnp(ERFA_DS2R * ((A + (B + (C + D * t) * t) * t) + f));\n\n   return gmst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13349,"name":"c2tcio.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraC2tcio(double rc2i[3][3], double era, double rpom[3][3],\n               double rc2t[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a C 2 t c i o\n**  - - - - - - - - - -\n**\n**  Assemble the celestial to terrestrial matrix from CIO-based\n**  components (the celestial-to-intermediate matrix, the Earth Rotation\n**  Angle and the polar motion matrix).\n**\n**  Given:\n**     rc2i     double[3][3]    celestial-to-intermediate matrix\n**     era      double          Earth rotation angle (radians)\n**     rpom     double[3][3]    polar-motion matrix\n**\n**  Returned:\n**     rc2t     double[3][3]    celestial-to-terrestrial matrix\n**\n**  Notes:\n**\n**  1) This function constructs the rotation matrix that transforms\n**     vectors in the celestial system into vectors in the terrestrial\n**     system.  It does so starting from precomputed components, namely\n**     the matrix which rotates from celestial coordinates to the\n**     intermediate frame, the Earth rotation angle and the polar motion\n**     matrix.  One use of the present function is when generating a\n**     series of celestial-to-terrestrial matrices where only the Earth\n**     Rotation Angle changes, avoiding the considerable overhead of\n**     recomputing the precession-nutation more often than necessary to\n**     achieve given accuracy objectives.\n**\n**  2) The relationship between the arguments is as follows:\n**\n**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]\n**\n**              = rc2t * [CRS]\n**\n**     where [CRS] is a vector in the Geocentric Celestial Reference\n**     System and [TRS] is a vector in the International Terrestrial\n**     Reference System (see IERS Conventions 2003).\n**\n**  Called:\n**     eraCr        copy r-matrix\n**     eraRz        rotate around Z-axis\n**     eraRxr       product of two r-matrices\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r[3][3];\n\n\n/* Construct the matrix. */\n   eraCr(rc2i, r);\n   eraRz(era, r);\n   eraRxr(rpom, r, rc2t);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13350,"name":"pb06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPb06(double date1, double date2,\n             double *bzeta, double *bz, double *btheta)\n/*\n**  - - - - - - - -\n**   e r a P b 0 6\n**  - - - - - - - -\n**\n**  This function forms three Euler angles which implement general\n**  precession from epoch J2000.0, using the IAU 2006 model.  Frame\n**  bias (the offset between ICRS and mean J2000.0) is included.\n**\n**  Given:\n**     date1,date2  double   TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     bzeta        double   1st rotation: radians cw around z\n**     bz           double   3rd rotation: radians cw around z\n**     btheta       double   2nd rotation: radians ccw around y\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The traditional accumulated precession angles zeta_A, z_A,\n**     theta_A cannot be obtained in the usual way, namely through\n**     polynomial expressions, because of the frame bias.  The latter\n**     means that two of the angles undergo rapid changes near this\n**     date.  They are instead the results of decomposing the\n**     precession-bias matrix obtained by using the Fukushima-Williams\n**     method, which does not suffer from the problem.  The\n**     decomposition returns values which can be used in the\n**     conventional formulation and which include frame bias.\n**\n**  3) The three angles are returned in the conventional order, which\n**     is not the same as the order of the corresponding Euler\n**     rotations.  The precession-bias matrix is\n**     R_3(-z) x R_2(+theta) x R_3(-zeta).\n**\n**  4) Should zeta_A, z_A, theta_A angles be required that do not\n**     contain frame bias, they are available by calling the ERFA\n**     function eraP06e.\n**\n**  Called:\n**     eraPmat06    PB matrix, IAU 2006\n**     eraRz        rotate around Z-axis\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double r[3][3], r31, r32;\n\n\n/* Precession matrix via Fukushima-Williams angles. */\n   eraPmat06(date1, date2, r);\n\n/* Solve for z. */\n   *bz = atan2(r[1][2], r[0][2]);\n\n/* Remove it from the matrix. */\n   eraRz(*bz, r);\n\n/* Solve for the remaining two angles. */\n   *bzeta = atan2 (r[1][0], r[1][1]);\n   r31 = r[2][0];\n   r32 = r[2][1];\n   *btheta = atan2(-ERFA_DSIGN(sqrt(r31 * r31 + r32 * r32), r[0][2]),\n                   r[2][2]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13351,"name":"num06a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraNum06a(double date1, double date2, double rmatn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a N u m 0 6 a\n**  - - - - - - - - - -\n**\n**  Form the matrix of nutation for a given date, IAU 2006/2000A model.\n**\n**  Given:\n**     date1,date2   double          TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rmatn         double[3][3]    nutation matrix\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where\n**     the p-vector V(true) is with respect to the true equatorial triad\n**     of date and the p-vector V(mean) is with respect to the mean\n**     equatorial triad of date.\n**\n**  Called:\n**     eraObl06     mean obliquity, IAU 2006\n**     eraNut06a    nutation, IAU 2006/2000A\n**     eraNumat     form nutation matrix\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 3.222-3 (p114).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double eps, dp, de;\n\n\n/* Mean obliquity. */\n   eps = eraObl06(date1, date2);\n\n/* Nutation components. */\n   eraNut06a(date1, date2, &dp, &de);\n\n/* Nutation matrix. */\n   eraNumat(eps, dp, de, rmatn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13352,"name":"erfaversion.c","nodeType":"TextFile","path":"cextern/erfa","text":"/*\n** Copyright (C) 2016-2017, NumFOCUS Foundation.\n**\n** Licensed under a 3-clause BSD style license - see LICENSE\n**\n** This file is NOT derived from SOFA sources\n*/\n\n\n/* Define to the version of this package. */\n#define PACKAGE_VERSION \"1.4.0\"\n\n/* Define to the major version of this package. */\n#define PACKAGE_VERSION_MAJOR 1\n\n/* Define to the micro version of this package. */\n#define PACKAGE_VERSION_MICRO 0\n\n/* Define to the minor version of this package. */\n#define PACKAGE_VERSION_MINOR 4\n\n/* Define to the version of SOFA */\n#define SOFA_VERSION \"20170420\"\n\n\n#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif /* HAVE_CONFIG_H */\n\n\nconst char* eraVersion(void) {\n  return PACKAGE_VERSION;\n}\n\n\nint eraVersionMajor(void) {\n  return PACKAGE_VERSION_MAJOR;\n}\n\n\nint eraVersionMinor(void) {\n  return PACKAGE_VERSION_MINOR;\n}\n\n\nint eraVersionMicro(void) {\n  return PACKAGE_VERSION_MICRO;\n}\n\n\nconst char* eraSofaVersion(void) {\n  return SOFA_VERSION;\n}\n"},{"id":13353,"name":"aticq.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAticq(double ri, double di, eraASTROM *astrom,\n              double *rc, double *dc)\n/*\n**  - - - - - - - - -\n**   e r a A t i c q\n**  - - - - - - - - -\n**\n**  Quick CIRS RA,Dec to ICRS astrometric place, given the star-\n**  independent astrometry parameters.\n**\n**  Use of this function is appropriate when efficiency is important and\n**  where many star positions are all to be transformed for one date.\n**  The star-independent astrometry parameters can be obtained by\n**  calling one of the functions eraApci[13], eraApcg[13], eraApco[13]\n**  or eraApcs[13].\n**\n**  Given:\n**     ri,di  double     CIRS RA,Dec (radians)\n**     astrom eraASTROM* star-independent astrometry parameters:\n**      pmt    double       PM time interval (SSB, Julian years)\n**      eb     double[3]    SSB to observer (vector, au)\n**      eh     double[3]    Sun to observer (unit vector)\n**      em     double       distance from Sun to observer (au)\n**      v      double[3]    barycentric observer velocity (vector, c)\n**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor\n**      bpn    double[3][3] bias-precession-nutation matrix\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned:\n**     rc,dc  double     ICRS astrometric RA,Dec (radians)\n**\n**  Notes:\n**\n**  1) Only the Sun is taken into account in the light deflection\n**     correction.\n**\n**  2) Iterative techniques are used for the aberration and light\n**     deflection corrections so that the functions eraAtic13 (or\n**     eraAticq) and eraAtci13 (or eraAtciq) are accurate inverses;\n**     even at the edge of the Sun's disk the discrepancy is only about\n**     1 nanoarcsecond.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraZp        zero p-vector\n**     eraAb        stellar aberration\n**     eraLdsun     light deflection by the Sun\n**     eraC2s       p-vector to spherical\n**     eraAnp       normalize angle into range +/- pi\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j, i;\n   double pi[3], ppr[3], pnat[3], pco[3], w, d[3], before[3], r2, r,\n          after[3];\n\n\n/* CIRS RA,Dec to Cartesian. */\n   eraS2c(ri, di, pi);\n\n/* Bias-precession-nutation, giving GCRS proper direction. */\n   eraTrxp(astrom->bpn, pi, ppr);\n\n/* Aberration, giving GCRS natural direction. */\n   eraZp(d);\n   for (j = 0; j < 2; j++) {\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         w = ppr[i] - d[i];\n         before[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         before[i] /= r;\n      }\n      eraAb(before, astrom->v, astrom->em, astrom->bm1, after);\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         d[i] = after[i] - before[i];\n         w = ppr[i] - d[i];\n         pnat[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         pnat[i] /= r;\n      }\n   }\n\n/* Light deflection by the Sun, giving BCRS coordinate direction. */\n   eraZp(d);\n   for (j = 0; j < 5; j++) {\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         w = pnat[i] - d[i];\n         before[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         before[i] /= r;\n      }\n      eraLdsun(before, astrom->eh, astrom->em, after);\n      r2 = 0.0;\n      for (i = 0; i < 3; i++) {\n         d[i] = after[i] - before[i];\n         w = pnat[i] - d[i];\n         pco[i] = w;\n         r2 += w*w;\n      }\n      r = sqrt(r2);\n      for (i = 0; i < 3; i++) {\n         pco[i] /= r;\n      }\n   }\n\n/* ICRS astrometric RA,Dec. */\n   eraC2s(pco, &w, dc);\n   *rc = eraAnp(w);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13354,"name":"atic13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraAtic13(double ri, double di, double date1, double date2,\n               double *rc, double *dc, double *eo)\n/*\n**  - - - - - - - - - -\n**   e r a A t i c 1 3\n**  - - - - - - - - - -\n**\n**  Transform star RA,Dec from geocentric CIRS to ICRS astrometric.\n**\n**  Given:\n**     ri,di  double  CIRS geocentric RA,Dec (radians)\n**     date1  double  TDB as a 2-part...\n**     date2  double  ...Julian Date (Note 1)\n**\n**  Returned:\n**     rc,dc  double  ICRS astrometric RA,Dec (radians)\n**     eo     double  equation of the origins (ERA-GST, Note 4)\n**\n**  Notes:\n**\n**  1) The TDB date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TDB)=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 method is best matched to the way the\n**     argument is handled internally and will deliver the optimum\n**     resolution.  The MJD method and the date & time methods are both\n**     good compromises between resolution and convenience.  For most\n**     applications of this function the choice will not be at all\n**     critical.\n**\n**     TT can be used instead of TDB without any significant impact on\n**     accuracy.\n**\n**  2) Iterative techniques are used for the aberration and light\n**     deflection corrections so that the functions eraAtic13 (or\n**     eraAticq) and eraAtci13 (or eraAtciq) are accurate inverses;\n**     even at the edge of the Sun's disk the discrepancy is only about\n**     1 nanoarcsecond.\n**\n**  3) The available accuracy is better than 1 milliarcsecond, limited\n**     mainly by the precession-nutation model that is used, namely\n**     IAU 2000A/2006.  Very close to solar system bodies, additional\n**     errors of up to several milliarcseconds can occur because of\n**     unmodeled light deflection;  however, the Sun's contribution is\n**     taken into account, to first order.  The accuracy limitations of\n**     the ERFA function eraEpv00 (used to compute Earth position and\n**     velocity) can contribute aberration errors of up to\n**     5 microarcseconds.  Light deflection at the Sun's limb is\n**     uncertain at the 0.4 mas level.\n**\n**  4) Should the transformation to (equinox based) J2000.0 mean place\n**     be required rather than (CIO based) ICRS coordinates, subtract the\n**     equation of the origins from the returned right ascension:\n**     RA = RI - EO.  (The eraAnp function can then be applied, as\n**     required, to keep the result in the conventional 0-2pi range.)\n**\n**  Called:\n**     eraApci13    astrometry parameters, ICRS-CIRS, 2013\n**     eraAticq     quick CIRS to ICRS astrometric\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Star-independent astrometry parameters */\n   eraASTROM astrom;\n\n\n/* Star-independent astrometry parameters. */\n   eraApci13(date1, date2, &astrom, eo);\n\n/* CIRS to ICRS astrometric. */\n   eraAticq(ri, di, &astrom, rc, dc);\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13355,"name":"s00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraS00b(double date1, double date2)\n/*\n**  - - - - - - - -\n**   e r a S 0 0 b\n**  - - - - - - - -\n**\n**  The CIO locator s, positioning the Celestial Intermediate Origin on\n**  the equator of the Celestial Intermediate Pole, using the IAU 2000B\n**  precession-nutation model.\n**\n**  Given:\n**     date1,date2  double    TT as a 2-part Julian Date (Note 1)\n**\n**  Returned (function value):\n**                  double    the CIO locator s in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The CIO locator s is the difference between the right ascensions\n**     of the same point in two systems.  The two systems are the GCRS\n**     and the CIP,CIO, and the point is the ascending node of the\n**     CIP equator.  The CIO locator s remains a small fraction of\n**     1 arcsecond throughout 1900-2100.\n**\n**  3) The series used to compute s is in fact for s+XY/2, where X and Y\n**     are the x and y components of the CIP unit vector;  this series\n**     is more compact than a direct series for s would be.  The present\n**     function uses the IAU 2000B truncated nutation model when\n**     predicting the CIP position.  The function eraS00a uses instead\n**     the full IAU 2000A model, but with no significant increase in\n**     accuracy and at some cost in speed.\n**\n**  Called:\n**     eraPnm00b    classical NPB matrix, IAU 2000B\n**     eraBnp2xy    extract CIP X,Y from the BPN matrix\n**     eraS00       the CIO locator s, given X,Y, IAU 2000A\n**\n**  References:\n**\n**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,\n**     \"Expressions for the Celestial Intermediate Pole and Celestial\n**     Ephemeris Origin consistent with the IAU 2000A precession-\n**     nutation model\", Astron.Astrophys. 400, 1145-1154 (2003)\n**\n**     n.b. The celestial ephemeris origin (CEO) was renamed \"celestial\n**          intermediate origin\" (CIO) by IAU 2006 Resolution 2.\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rbpn[3][3], x, y, s;\n\n\n/* Bias-precession-nutation-matrix, IAU 2000B. */\n   eraPnm00b(date1, date2, rbpn);\n\n/* Extract the CIP coordinates. */\n   eraBpn2xy(rbpn, &x, &y);\n\n/* Compute the CIO locator s, given the CIP coordinates. */\n   s = eraS00(date1, date2, x, y);\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13356,"name":"lteceq.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraLteceq(double epj, double dl, double db, double *dr, double *dd)\n/*\n**  - - - - - - - - - -\n**   e r a L t e c e q\n**  - - - - - - - - - -\n**\n**  Transformation from ecliptic coordinates (mean equinox and ecliptic\n**  of date) to ICRS RA,Dec, using a long-term precession model.\n**\n**  Given:\n**     epj     double     Julian epoch (TT)\n**     dl,db   double     ecliptic longitude and latitude (radians)\n**\n**  Returned:\n**     dr,dd   double     ICRS right ascension and declination (radians)\n**\n**  1) No assumptions are made about whether the coordinates represent\n**     starlight and embody astrometric effects such as parallax or\n**     aberration.\n**\n**  2) The transformation is approximately that from ecliptic longitude\n**     and latitude (mean equinox and ecliptic of date) to mean J2000.0\n**     right ascension and declination, with only frame bias (always\n**     less than 25 mas) to disturb this classical picture.\n**\n**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model\n**     agrees with the IAU 2006 precession at J2000.0 and stays within\n**     100 microarcseconds during the 20th and 21st centuries.  It is\n**     accurate to a few arcseconds throughout the historical period,\n**     worsening to a few tenths of a degree at the end of the\n**     +/- 200,000 year time span.\n**\n**  Called:\n**     eraS2c       spherical coordinates to unit vector\n**     eraLtecm     J2000.0 to ecliptic rotation matrix, long term\n**     eraTrxp      product of transpose of r-matrix and p-vector\n**     eraC2s       unit vector to spherical coordinates\n**     eraAnp       normalize angle into range 0 to 2pi\n**     eraAnpm      normalize angle into range +/- pi\n**\n**  References:\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession\n**    expressions, valid for long time intervals, Astron.Astrophys. 534,\n**    A22\n**\n**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession\n**    expressions, valid for long time intervals (Corrigendum),\n**    Astron.Astrophys. 541, C1\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double rm[3][3], v1[3], v2[3], a, b;\n\n\n/* Spherical to Cartesian. */\n   eraS2c(dl, db, v1);\n\n/* Rotation matrix, ICRS equatorial to ecliptic. */\n   eraLtecm(epj, rm);\n\n/* The transformation from ecliptic to ICRS. */\n   eraTrxp(rm, v1, v2);\n\n/* Cartesian to spherical. */\n   eraC2s(v2, &a, &b);\n\n/* Express in conventional ranges. */\n   *dr = eraAnp(a);\n   *dd = eraAnpm(b);\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13357,"name":"pnm00a.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPnm00a(double date1, double date2, double rbpn[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P n m 0 0 a\n**  - - - - - - - - - -\n**\n**  Form the matrix of precession-nutation for a given date (including\n**  frame bias), equinox-based, IAU 2000A model.\n**\n**  Given:\n**     date1,date2  double     TT as a 2-part Julian Date (Note 1)\n**\n**  Returned:\n**     rbpn         double[3][3]    classical NPB matrix (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where\n**     the p-vector V(date) is with respect to the true equatorial triad\n**     of date date1+date2 and the p-vector V(GCRS) is with respect to\n**     the Geocentric Celestial Reference System (IAU, 2000).\n**\n**  3) A faster, but slightly less accurate result (about 1 mas), can be\n**     obtained by using instead the eraPnm00b function.\n**\n**  Called:\n**     eraPn00a     bias/precession/nutation, IAU 2000A\n**\n**  Reference:\n**\n**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.\n**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.\n**     (2000)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3];\n\n\n/* Obtain the required matrix (discarding other results). */\n   eraPn00a(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13358,"name":"p2pv.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraP2pv(double p[3], double pv[2][3])\n/*\n**  - - - - - - - -\n**   e r a P 2 p v\n**  - - - - - - - -\n**\n**  Extend a p-vector to a pv-vector by appending a zero velocity.\n**\n**  Given:\n**     p        double[3]       p-vector\n**\n**  Returned:\n**     pv       double[2][3]    pv-vector\n**\n**  Called:\n**     eraCp        copy p-vector\n**     eraZp        zero p-vector\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   eraCp(p, pv[0]);\n   eraZp(pv[1]);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13359,"name":"s06.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraS06(double date1, double date2, double x, double y)\n/*\n**  - - - - - - -\n**   e r a S 0 6\n**  - - - - - - -\n**\n**  The CIO locator s, positioning the Celestial Intermediate Origin on\n**  the equator of the Celestial Intermediate Pole, given the CIP's X,Y\n**  coordinates.  Compatible with IAU 2006/2000A precession-nutation.\n**\n**  Given:\n**     date1,date2   double    TT as a 2-part Julian Date (Note 1)\n**     x,y           double    CIP coordinates (Note 3)\n**\n**  Returned (function value):\n**                   double    the CIO locator s in radians (Note 2)\n**\n**  Notes:\n**\n**  1) The TT date date1+date2 is a Julian Date, apportioned in any\n**     convenient way between the two arguments.  For example,\n**     JD(TT)=2450123.7 could be expressed in any of these ways,\n**     among others:\n**\n**            date1          date2\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in\n**     cases where the loss of several decimal digits of resolution\n**     is acceptable.  The J2000 method is best matched to the way\n**     the argument is handled internally and will deliver the\n**     optimum resolution.  The MJD method and the date & time methods\n**     are both good compromises between resolution and convenience.\n**\n**  2) The CIO locator s is the difference between the right ascensions\n**     of the same point in two systems:  the two systems are the GCRS\n**     and the CIP,CIO, and the point is the ascending node of the\n**     CIP equator.  The quantity s remains below 0.1 arcsecond\n**     throughout 1900-2100.\n**\n**  3) The series used to compute s is in fact for s+XY/2, where X and Y\n**     are the x and y components of the CIP unit vector;  this series\n**     is more compact than a direct series for s would be.  This\n**     function requires X,Y to be supplied by the caller, who is\n**     responsible for providing values that are consistent with the\n**     supplied date.\n**\n**  4) The model is consistent with the \"P03\" precession (Capitaine et\n**     al. 2003), adopted by IAU 2006 Resolution 1, 2006, and the\n**     IAU 2000A nutation (with P03 adjustments).\n**\n**  Called:\n**     eraFal03     mean anomaly of the Moon\n**     eraFalp03    mean anomaly of the Sun\n**     eraFaf03     mean argument of the latitude of the Moon\n**     eraFad03     mean elongation of the Moon from the Sun\n**     eraFaom03    mean longitude of the Moon's ascending node\n**     eraFave03    mean longitude of Venus\n**     eraFae03     mean longitude of Earth\n**     eraFapa03    general accumulated precession in longitude\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. & Chapront, J., 2003, Astron.\n**     Astrophys. 432, 355\n**\n**     McCarthy, D.D., Petit, G. (eds.) 2004, IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n/* Time since J2000.0, in Julian centuries */\n   double t;\n\n/* Miscellaneous */\n   int i, j;\n   double a, w0, w1, w2, w3, w4, w5;\n\n/* Fundamental arguments */\n   double fa[8];\n\n/* Returned value */\n   double s;\n\n/* --------------------- */\n/* The series for s+XY/2 */\n/* --------------------- */\n\n   typedef struct {\n      int nfa[8];      /* coefficients of l,l',F,D,Om,LVe,LE,pA */\n      double s, c;     /* sine and cosine coefficients */\n   } TERM;\n\n/* Polynomial coefficients */\n   static const double sp[] = {\n\n   /* 1-6 */\n          94.00e-6,\n        3808.65e-6,\n        -122.68e-6,\n      -72574.11e-6,\n          27.98e-6,\n          15.62e-6\n   };\n\n/* Terms of order t^0 */\n   static const TERM s0[] = {\n\n   /* 1-10 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0}, -2640.73e-6,   0.39e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},   -63.53e-6,   0.02e-6 },\n      {{ 0,  0,  2, -2,  3,  0,  0,  0},   -11.75e-6,  -0.01e-6 },\n      {{ 0,  0,  2, -2,  1,  0,  0,  0},   -11.21e-6,  -0.01e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},     4.57e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  3,  0,  0,  0},    -2.02e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  1,  0,  0,  0},    -1.98e-6,   0.00e-6 },\n      {{ 0,  0,  0,  0,  3,  0,  0,  0},     1.72e-6,   0.00e-6 },\n      {{ 0,  1,  0,  0,  1,  0,  0,  0},     1.41e-6,   0.01e-6 },\n      {{ 0,  1,  0,  0, -1,  0,  0,  0},     1.26e-6,   0.01e-6 },\n\n   /* 11-20 */\n      {{ 1,  0,  0,  0, -1,  0,  0,  0},     0.63e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0,  1,  0,  0,  0},     0.63e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  3,  0,  0,  0},    -0.46e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  1,  0,  0,  0},    -0.45e-6,   0.00e-6 },\n      {{ 0,  0,  4, -4,  4,  0,  0,  0},    -0.36e-6,   0.00e-6 },\n      {{ 0,  0,  1, -1,  1, -8, 12,  0},     0.24e-6,   0.12e-6 },\n      {{ 0,  0,  2,  0,  0,  0,  0,  0},    -0.32e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},    -0.28e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  3,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  1,  0,  0,  0},    -0.26e-6,   0.00e-6 },\n\n   /* 21-30 */\n      {{ 0,  0,  2, -2,  0,  0,  0,  0},     0.21e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -3,  0,  0,  0},    -0.19e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -1,  0,  0,  0},    -0.18e-6,   0.00e-6 },\n      {{ 0,  0,  0,  0,  0,  8,-13, -1},     0.10e-6,  -0.05e-6 },\n      {{ 0,  0,  0,  2,  0,  0,  0,  0},    -0.15e-6,   0.00e-6 },\n      {{ 2,  0, -2,  0, -1,  0,  0,  0},     0.14e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  2,  0,  0,  0},     0.14e-6,   0.00e-6 },\n      {{ 1,  0,  0, -2,  1,  0,  0,  0},    -0.14e-6,   0.00e-6 },\n      {{ 1,  0,  0, -2, -1,  0,  0,  0},    -0.14e-6,   0.00e-6 },\n      {{ 0,  0,  4, -2,  4,  0,  0,  0},    -0.13e-6,   0.00e-6 },\n\n   /* 31-33 */\n      {{ 0,  0,  2, -2,  4,  0,  0,  0},     0.11e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -3,  0,  0,  0},    -0.11e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -1,  0,  0,  0},    -0.11e-6,   0.00e-6 }\n   };\n\n/* Terms of order t^1 */\n   static const TERM s1[] = {\n\n   /* 1 - 3 */\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},    -0.07e-6,   3.57e-6 },\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},     1.73e-6,  -0.03e-6 },\n      {{ 0,  0,  2, -2,  3,  0,  0,  0},     0.00e-6,   0.48e-6 }\n   };\n\n/* Terms of order t^2 */\n   static const TERM s2[] = {\n\n   /* 1-10 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},   743.52e-6,  -0.17e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},    56.91e-6,   0.06e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},     9.84e-6,  -0.01e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},    -8.85e-6,   0.01e-6 },\n      {{ 0,  1,  0,  0,  0,  0,  0,  0},    -6.38e-6,  -0.05e-6 },\n      {{ 1,  0,  0,  0,  0,  0,  0,  0},    -3.07e-6,   0.00e-6 },\n      {{ 0,  1,  2, -2,  2,  0,  0,  0},     2.23e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  1,  0,  0,  0},     1.67e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  2,  0,  0,  0},     1.30e-6,   0.00e-6 },\n      {{ 0,  1, -2,  2, -2,  0,  0,  0},     0.93e-6,   0.00e-6 },\n\n   /* 11-20 */\n      {{ 1,  0,  0, -2,  0,  0,  0,  0},     0.68e-6,   0.00e-6 },\n      {{ 0,  0,  2, -2,  1,  0,  0,  0},    -0.55e-6,   0.00e-6 },\n      {{ 1,  0, -2,  0, -2,  0,  0,  0},     0.53e-6,   0.00e-6 },\n      {{ 0,  0,  0,  2,  0,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0,  1,  0,  0,  0},    -0.27e-6,   0.00e-6 },\n      {{ 1,  0, -2, -2, -2,  0,  0,  0},    -0.26e-6,   0.00e-6 },\n      {{ 1,  0,  0,  0, -1,  0,  0,  0},    -0.25e-6,   0.00e-6 },\n      {{ 1,  0,  2,  0,  1,  0,  0,  0},     0.22e-6,   0.00e-6 },\n      {{ 2,  0,  0, -2,  0,  0,  0,  0},    -0.21e-6,   0.00e-6 },\n      {{ 2,  0, -2,  0, -1,  0,  0,  0},     0.20e-6,   0.00e-6 },\n\n   /* 21-25 */\n      {{ 0,  0,  2,  2,  2,  0,  0,  0},     0.17e-6,   0.00e-6 },\n      {{ 2,  0,  2,  0,  2,  0,  0,  0},     0.13e-6,   0.00e-6 },\n      {{ 2,  0,  0,  0,  0,  0,  0,  0},    -0.13e-6,   0.00e-6 },\n      {{ 1,  0,  2, -2,  2,  0,  0,  0},    -0.12e-6,   0.00e-6 },\n      {{ 0,  0,  2,  0,  0,  0,  0,  0},    -0.11e-6,   0.00e-6 }\n   };\n\n/* Terms of order t^3 */\n   static const TERM s3[] = {\n\n   /* 1-4 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},     0.30e-6, -23.42e-6 },\n      {{ 0,  0,  2, -2,  2,  0,  0,  0},    -0.03e-6,  -1.46e-6 },\n      {{ 0,  0,  2,  0,  2,  0,  0,  0},    -0.01e-6,  -0.25e-6 },\n      {{ 0,  0,  0,  0,  2,  0,  0,  0},     0.00e-6,   0.23e-6 }\n   };\n\n/* Terms of order t^4 */\n   static const TERM s4[] = {\n\n   /* 1-1 */\n      {{ 0,  0,  0,  0,  1,  0,  0,  0},    -0.26e-6,  -0.01e-6 }\n   };\n\n/* Number of terms in the series */\n   static const int NS0 = (int) (sizeof s0 / sizeof (TERM));\n   static const int NS1 = (int) (sizeof s1 / sizeof (TERM));\n   static const int NS2 = (int) (sizeof s2 / sizeof (TERM));\n   static const int NS3 = (int) (sizeof s3 / sizeof (TERM));\n   static const int NS4 = (int) (sizeof s4 / sizeof (TERM));\n\n/*--------------------------------------------------------------------*/\n\n/* Interval between fundamental epoch J2000.0 and current date (JC). */\n   t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;\n\n/* Fundamental Arguments (from IERS Conventions 2003) */\n\n/* Mean anomaly of the Moon. */\n   fa[0] = eraFal03(t);\n\n/* Mean anomaly of the Sun. */\n   fa[1] = eraFalp03(t);\n\n/* Mean longitude of the Moon minus that of the ascending node. */\n   fa[2] = eraFaf03(t);\n\n/* Mean elongation of the Moon from the Sun. */\n   fa[3] = eraFad03(t);\n\n/* Mean longitude of the ascending node of the Moon. */\n   fa[4] = eraFaom03(t);\n\n/* Mean longitude of Venus. */\n   fa[5] = eraFave03(t);\n\n/* Mean longitude of Earth. */\n   fa[6] = eraFae03(t);\n\n/* General precession in longitude. */\n   fa[7] = eraFapa03(t);\n\n/* Evaluate s. */\n   w0 = sp[0];\n   w1 = sp[1];\n   w2 = sp[2];\n   w3 = sp[3];\n   w4 = sp[4];\n   w5 = sp[5];\n\n   for (i = NS0-1; i >= 0; i--) {\n   a = 0.0;\n   for (j = 0; j < 8; j++) {\n      a += (double)s0[i].nfa[j] * fa[j];\n   }\n   w0 += s0[i].s * sin(a) + s0[i].c * cos(a);\n   }\n\n   for (i = NS1-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)s1[i].nfa[j] * fa[j];\n      }\n      w1 += s1[i].s * sin(a) + s1[i].c * cos(a);\n   }\n\n   for (i = NS2-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)s2[i].nfa[j] * fa[j];\n      }\n      w2 += s2[i].s * sin(a) + s2[i].c * cos(a);\n   }\n\n   for (i = NS3-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)s3[i].nfa[j] * fa[j];\n      }\n      w3 += s3[i].s * sin(a) + s3[i].c * cos(a);\n   }\n\n   for (i = NS4-1; i >= 0; i--) {\n      a = 0.0;\n      for (j = 0; j < 8; j++) {\n         a += (double)s4[i].nfa[j] * fa[j];\n      }\n      w4 += s4[i].s * sin(a) + s4[i].c * cos(a);\n   }\n\n   s = (w0 +\n       (w1 +\n       (w2 +\n       (w3 +\n       (w4 +\n        w5 * t) * t) * t) * t) * t) * ERFA_DAS2R - x*y/2.0;\n\n   return s;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13360,"name":"gc2gde.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraGc2gde ( double a, double f, double xyz[3],\n                double *elong, double *phi, double *height )\n/*\n**  - - - - - - - - - -\n**   e r a G c 2 g d e\n**  - - - - - - - - - -\n**\n**  Transform geocentric coordinates to geodetic for a reference\n**  ellipsoid of specified form.\n**\n**  Given:\n**     a       double     equatorial radius (Notes 2,4)\n**     f       double     flattening (Note 3)\n**     xyz     double[3]  geocentric vector (Note 4)\n**\n**  Returned:\n**     elong   double     longitude (radians, east +ve)\n**     phi     double     latitude (geodetic, radians)\n**     height  double     height above ellipsoid (geodetic, Note 4)\n**\n**  Returned (function value):\n**             int        status:  0 = OK\n**                                -1 = illegal f\n**                                -2 = illegal a\n**\n**  Notes:\n**\n**  1) This function is based on the GCONV2H Fortran subroutine by\n**     Toshio Fukushima (see reference).\n**\n**  2) The equatorial radius, a, can be in any units, but meters is\n**     the conventional choice.\n**\n**  3) The flattening, f, is (for the Earth) a value around 0.00335,\n**     i.e. around 1/298.\n**\n**  4) The equatorial radius, a, and the geocentric vector, xyz,\n**     must be given in the same units, and determine the units of\n**     the returned height, height.\n**\n**  5) If an error occurs (status < 0), elong, phi and height are\n**     unchanged.\n**\n**  6) The inverse transformation is performed in the function\n**     eraGd2gce.\n**\n**  7) The transformation for a standard ellipsoid (such as ERFA_WGS84) can\n**     more conveniently be performed by calling eraGc2gd, which uses a\n**     numerical code to identify the required A and F values.\n**\n**  Reference:\n**\n**     Fukushima, T., \"Transformation from Cartesian to geodetic\n**     coordinates accelerated by Halley's method\", J.Geodesy (2006)\n**     79: 689-693\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double aeps2, e2, e4t, ec2, ec, b, x, y, z, p2, absz, p, s0, pn, zc,\n                 c0, c02, c03, s02, s03, a02, a0, a03, d0, f0, b0, s1,\n                 cc, s12, cc2;\n\n\n/* ------------- */\n/* Preliminaries */\n/* ------------- */\n\n/* Validate ellipsoid parameters. */\n   if ( f < 0.0 || f >= 1.0 ) return -1;\n   if ( a <= 0.0 ) return -2;\n\n/* Functions of ellipsoid parameters (with further validation of f). */\n   aeps2 = a*a * 1e-32;\n   e2 = (2.0 - f) * f;\n   e4t = e2*e2 * 1.5;\n   ec2 = 1.0 - e2;\n   if ( ec2 <= 0.0 ) return -1;\n   ec = sqrt(ec2);\n   b = a * ec;\n\n/* Cartesian components. */\n   x = xyz[0];\n   y = xyz[1];\n   z = xyz[2];\n\n/* Distance from polar axis squared. */\n   p2 = x*x + y*y;\n\n/* Longitude. */\n   *elong = p2 > 0.0 ? atan2(y, x) : 0.0;\n\n/* Unsigned z-coordinate. */\n   absz = fabs(z);\n\n/* Proceed unless polar case. */\n   if ( p2 > aeps2 ) {\n\n   /* Distance from polar axis. */\n      p = sqrt(p2);\n\n   /* Normalization. */\n      s0 = absz / a;\n      pn = p / a;\n      zc = ec * s0;\n\n   /* Prepare Newton correction factors. */\n      c0 = ec * pn;\n      c02 = c0 * c0;\n      c03 = c02 * c0;\n      s02 = s0 * s0;\n      s03 = s02 * s0;\n      a02 = c02 + s02;\n      a0 = sqrt(a02);\n      a03 = a02 * a0;\n      d0 = zc*a03 + e2*s03;\n      f0 = pn*a03 - e2*c03;\n\n   /* Prepare Halley correction factor. */\n      b0 = e4t * s02 * c02 * pn * (a0 - ec);\n      s1 = d0*f0 - b0*s0;\n      cc = ec * (f0*f0 - b0*c0);\n\n   /* Evaluate latitude and height. */\n      *phi = atan(s1/cc);\n      s12 = s1 * s1;\n      cc2 = cc * cc;\n      *height = (p*cc + absz*s1 - a * sqrt(ec2*s12 + cc2)) /\n                                                        sqrt(s12 + cc2);\n   } else {\n\n   /* Exception: pole. */\n      *phi = ERFA_DPI / 2.0;\n      *height = absz - b;\n   }\n\n/* Restore sign of latitude. */\n   if ( z < 0 ) *phi = -*phi;\n\n/* OK status. */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13361,"name":"gst00b.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraGst00b(double uta, double utb)\n/*\n**  - - - - - - - - - -\n**   e r a G s t 0 0 b\n**  - - - - - - - - - -\n**\n**  Greenwich apparent sidereal time (consistent with IAU 2000\n**  resolutions but using the truncated nutation model IAU 2000B).\n**\n**  Given:\n**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)\n**\n**  Returned (function value):\n**                double    Greenwich apparent sidereal time (radians)\n**\n**  Notes:\n**\n**  1) The UT1 date uta+utb is a Julian Date, apportioned in any\n**     convenient way between the argument pair.  For example,\n**     JD=2450123.7 could be expressed in any of these ways, among\n**     others:\n**\n**             uta            utb\n**\n**         2450123.7           0.0       (JD method)\n**         2451545.0       -1421.3       (J2000 method)\n**         2400000.5       50123.2       (MJD method)\n**         2450123.5           0.2       (date & time method)\n**\n**     The JD method is the most natural and convenient to use in cases\n**     where the loss of several decimal digits of resolution is\n**     acceptable.  The J2000 and MJD methods are good compromises\n**     between resolution and convenience.  For UT, the date & time\n**     method is best matched to the algorithm that is used by the Earth\n**     Rotation Angle function, called internally:  maximum precision is\n**     delivered when the uta argument is for 0hrs UT1 on the day in\n**     question and the utb argument lies in the range 0 to 1, or vice\n**     versa.\n**\n**  2) The result is compatible with the IAU 2000 resolutions, except\n**     that accuracy has been compromised for the sake of speed and\n**     convenience in two respects:\n**\n**     . UT is used instead of TDB (or TT) to compute the precession\n**       component of GMST and the equation of the equinoxes.  This\n**       results in errors of order 0.1 mas at present.\n**\n**     . The IAU 2000B abridged nutation model (McCarthy & Luzum, 2001)\n**       is used, introducing errors of up to 1 mas.\n**\n**  3) This GAST is compatible with the IAU 2000 resolutions and must be\n**     used only in conjunction with other IAU 2000 compatible\n**     components such as precession-nutation.\n**\n**  4) The result is returned in the range 0 to 2pi.\n**\n**  5) The algorithm is from Capitaine et al. (2003) and IERS\n**     Conventions 2003.\n**\n**  Called:\n**     eraGmst00    Greenwich mean sidereal time, IAU 2000\n**     eraEe00b     equation of the equinoxes, IAU 2000B\n**     eraAnp       normalize angle into range 0 to 2pi\n**\n**  References:\n**\n**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., \"Expressions to\n**     implement the IAU 2000 definition of UT1\", Astronomy &\n**     Astrophysics, 406, 1135-1149 (2003)\n**\n**     McCarthy, D.D. & Luzum, B.J., \"An abridged model of the\n**     precession-nutation of the celestial pole\", Celestial Mechanics &\n**     Dynamical Astronomy, 85, 37-49 (2003)\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double gmst00, ee00b, gst;\n\n\n   gmst00 = eraGmst00(uta, utb, uta, utb);\n   ee00b = eraEe00b(uta, utb);\n   gst = eraAnp(gmst00 + ee00b);\n\n   return gst;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13362,"name":"apio13.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraApio13(double utc1, double utc2, double dut1,\n              double elong, double phi, double hm, double xp, double yp,\n              double phpa, double tc, double rh, double wl,\n              eraASTROM *astrom)\n/*\n**  - - - - - - - - - -\n**   e r a A p i o 1 3\n**  - - - - - - - - - -\n**\n**  For a terrestrial observer, prepare star-independent astrometry\n**  parameters for transformations between CIRS and observed\n**  coordinates.  The caller supplies UTC, site coordinates, ambient air\n**  conditions and observing wavelength.\n**\n**  Given:\n**     utc1   double      UTC as a 2-part...\n**     utc2   double      ...quasi Julian Date (Notes 1,2)\n**     dut1   double      UT1-UTC (seconds)\n**     elong  double      longitude (radians, east +ve, Note 3)\n**     phi    double      geodetic latitude (radians, Note 3)\n**     hm     double      height above ellipsoid (m, geodetic Notes 4,6)\n**     xp,yp  double      polar motion coordinates (radians, Note 5)\n**     phpa   double      pressure at the observer (hPa = mB, Note 6)\n**     tc     double      ambient temperature at the observer (deg C)\n**     rh     double      relative humidity at the observer (range 0-1)\n**     wl     double      wavelength (micrometers, Note 7)\n**\n**  Returned:\n**     astrom eraASTROM*  star-independent astrometry parameters:\n**      pmt    double       unchanged\n**      eb     double[3]    unchanged\n**      eh     double[3]    unchanged\n**      em     double       unchanged\n**      v      double[3]    unchanged\n**      bm1    double       unchanged\n**      bpn    double[3][3] unchanged\n**      along  double       longitude + s' (radians)\n**      xpl    double       polar motion xp wrt local meridian (radians)\n**      ypl    double       polar motion yp wrt local meridian (radians)\n**      sphi   double       sine of geodetic latitude\n**      cphi   double       cosine of geodetic latitude\n**      diurab double       magnitude of diurnal aberration vector\n**      eral   double       \"local\" Earth rotation angle (radians)\n**      refa   double       refraction constant A (radians)\n**      refb   double       refraction constant B (radians)\n**\n**  Returned (function value):\n**            int         status: +1 = dubious year (Note 2)\n**                                 0 = OK\n**                                -1 = unacceptable date\n**\n**  Notes:\n**\n**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any\n**      convenient way between the two arguments, for example where utc1\n**      is the Julian Day Number and utc2 is the fraction of a day.\n**\n**      However, JD cannot unambiguously represent UTC during a leap\n**      second unless special measures are taken.  The convention in the\n**      present function is that the JD day represents UTC days whether\n**      the length is 86399, 86400 or 86401 SI seconds.\n**\n**      Applications should use the function eraDtf2d to convert from\n**      calendar date and time of day into 2-part quasi Julian Date, as\n**      it implements the leap-second-ambiguity convention just\n**      described.\n**\n**  2)  The warning status \"dubious year\" flags UTCs that predate the\n**      introduction of the time scale or that are too far in the future\n**      to be trusted.  See eraDat for further details.\n**\n**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly\n**      one second at the end of each positive UTC leap second,\n**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This\n**      practice is under review, and in the future UT1-UTC may grow\n**      essentially without limit.\n**\n**  4)  The geographical coordinates are with respect to the ERFA_WGS84\n**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the\n**      longitude required by the present function is east-positive\n**      (i.e. right-handed), in accordance with geographical convention.\n**\n**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The\n**      values are the coordinates (in radians) of the Celestial\n**      Intermediate Pole with respect to the International Terrestrial\n**      Reference System (see IERS Conventions 2003), measured along the\n**      meridians 0 and 90 deg west respectively.  For many applications,\n**      xp and yp can be set to zero.\n**\n**      Internally, the polar motion is stored in a form rotated onto\n**      the local meridian.\n**\n**  6)  If hm, the height above the ellipsoid of the observing station\n**      in meters, is not known but phpa, the pressure in hPa (=mB), is\n**      available, an adequate estimate of hm can be obtained from the\n**      expression\n**\n**            hm = -29.3 * tsl * log ( phpa / 1013.25 );\n**\n**      where tsl is the approximate sea-level air temperature in K\n**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section\n**      52).  Similarly, if the pressure phpa is not known, it can be\n**      estimated from the height of the observing station, hm, as\n**      follows:\n**\n**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );\n**\n**      Note, however, that the refraction is nearly proportional to the\n**      pressure and that an accurate phpa value is important for\n**      precise work.\n**\n**  7)  The argument wl specifies the observing wavelength in\n**      micrometers.  The transition from optical to radio is assumed to\n**      occur at 100 micrometers (about 3000 GHz).\n**\n**  8)  It is advisable to take great care with units, as even unlikely\n**      values of the input parameters are accepted and processed in\n**      accordance with the models used.\n**\n**  9)  In cases where the caller wishes to supply his own Earth\n**      rotation information and refraction constants, the function\n**      eraApc can be used instead of the present function.\n**\n**  10) This is one of several functions that inserts into the astrom\n**      structure star-independent parameters needed for the chain of\n**      astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.\n**\n**      The various functions support different classes of observer and\n**      portions of the transformation chain:\n**\n**          functions         observer        transformation\n**\n**       eraApcg eraApcg13    geocentric      ICRS <-> GCRS\n**       eraApci eraApci13    terrestrial     ICRS <-> CIRS\n**       eraApco eraApco13    terrestrial     ICRS <-> observed\n**       eraApcs eraApcs13    space           ICRS <-> GCRS\n**       eraAper eraAper13    terrestrial     update Earth rotation\n**       eraApio eraApio13    terrestrial     CIRS <-> observed\n**\n**      Those with names ending in \"13\" use contemporary ERFA models to\n**      compute the various ephemerides.  The others accept ephemerides\n**      supplied by the caller.\n**\n**      The transformation from ICRS to GCRS covers space motion,\n**      parallax, light deflection, and aberration.  From GCRS to CIRS\n**      comprises frame bias and precession-nutation.  From CIRS to\n**      observed takes account of Earth rotation, polar motion, diurnal\n**      aberration and parallax (unless subsumed into the ICRS <-> GCRS\n**      transformation), and atmospheric refraction.\n**\n**  11) The context structure astrom produced by this function is used\n**      by eraAtioq and eraAtoiq.\n**\n**  Called:\n**     eraUtctai    UTC to TAI\n**     eraTaitt     TAI to TT\n**     eraUtcut1    UTC to UT1\n**     eraSp00      the TIO locator s', IERS 2000\n**     eraEra00     Earth rotation angle, IAU 2000\n**     eraRefco     refraction constants for given ambient conditions\n**     eraApio      astrometry parameters, CIRS-observed\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j;\n   double tai1, tai2, tt1, tt2, ut11, ut12, sp, theta, refa, refb;\n\n\n/* UTC to other time scales. */\n   j = eraUtctai(utc1, utc2, &tai1, &tai2);\n   if ( j < 0 ) return -1;\n   j = eraTaitt(tai1, tai2, &tt1, &tt2);\n   j = eraUtcut1(utc1, utc2, dut1, &ut11, &ut12);\n   if ( j < 0 ) return -1;\n\n/* TIO locator s'. */\n   sp = eraSp00(tt1, tt2);\n\n/* Earth rotation angle. */\n   theta = eraEra00(ut11, ut12);\n\n/* Refraction constants A and B. */\n   eraRefco(phpa, tc, rh, wl, &refa, &refb);\n\n/* CIRS <-> observed astrometry parameters. */\n   eraApio(sp, theta, elong, phi, hm, xp, yp, refa, refb, astrom);\n\n/* Return any warning status. */\n   return j;\n\n/* Finished. */\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13363,"name":"fapa03.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\ndouble eraFapa03(double t)\n/*\n**  - - - - - - - - - -\n**   e r a F a p a 0 3\n**  - - - - - - - - - -\n**\n**  Fundamental argument, IERS Conventions (2003):\n**  general accumulated precession in longitude.\n**\n**  Given:\n**     t     double    TDB, Julian centuries since J2000.0 (Note 1)\n**\n**  Returned (function value):\n**           double    general precession in longitude, radians (Note 2)\n**\n**  Notes:\n**\n**  1) Though t is strictly TDB, it is usually more convenient to use\n**     TT, which makes no significant difference.\n**\n**  2) The expression used is as adopted in IERS Conventions (2003).  It\n**     is taken from Kinoshita & Souchay (1990) and comes originally\n**     from Lieske et al. (1977).\n**\n**  References:\n**\n**     Kinoshita, H. and Souchay J. 1990, Celest.Mech. and Dyn.Astron.\n**     48, 187\n**\n**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,\n**     Astron.Astrophys. 58, 1-16\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   double a;\n\n\n/* General accumulated precession in longitude. */\n   a = (0.024381750 + 0.00000538691 * t) * t;\n\n   return a;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13364,"name":"tttcg.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraTttcg(double tt1, double tt2, double *tcg1, double *tcg2)\n/*\n**  - - - - - - - - -\n**   e r a T t t c g\n**  - - - - - - - - -\n**\n**  Time scale transformation:  Terrestrial Time, TT, to Geocentric\n**  Coordinate Time, TCG.\n**\n**  Given:\n**     tt1,tt2    double    TT as a 2-part Julian Date\n**\n**  Returned:\n**     tcg1,tcg2  double    TCG as a 2-part Julian Date\n**\n**  Returned (function value):\n**                int       status:  0 = OK\n**\n**  Note:\n**\n**     tt1+tt2 is Julian Date, apportioned in any convenient way between\n**     the two arguments, for example where tt1 is the Julian Day Number\n**     and tt2 is the fraction of a day.  The returned tcg1,tcg2 follow\n**     suit.\n**\n**  References:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**     IAU 2000 Resolution B1.9\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* 1977 Jan 1 00:00:32.184 TT, as MJD */\n   static const double t77t = ERFA_DJM77 + ERFA_TTMTAI/ERFA_DAYSEC;\n\n/* TT to TCG rate */\n   static const double elgg = ERFA_ELG/(1.0-ERFA_ELG);\n\n\n/* Result, safeguarding precision. */\n   if ( tt1 > tt2 ) {\n      *tcg1 = tt1;\n      *tcg2 = tt2 + ( ( tt1 - ERFA_DJM0 ) + ( tt2 - t77t ) ) * elgg;\n   } else {\n      *tcg1 = tt1 + ( ( tt2 - ERFA_DJM0 ) + ( tt1 - t77t ) ) * elgg;\n      *tcg2 = tt2;\n   }\n\n/* Status (always OK). */\n   return 0;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13365,"name":"pom00.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nvoid eraPom00(double xp, double yp, double sp, double rpom[3][3])\n/*\n**  - - - - - - - - - -\n**   e r a P o m 0 0\n**  - - - - - - - - - -\n**\n**  Form the matrix of polar motion for a given date, IAU 2000.\n**\n**  Given:\n**     xp,yp    double    coordinates of the pole (radians, Note 1)\n**     sp       double    the TIO locator s' (radians, Note 2)\n**\n**  Returned:\n**     rpom     double[3][3]   polar-motion matrix (Note 3)\n**\n**  Notes:\n**\n**  1) The arguments xp and yp are the coordinates (in radians) of the\n**     Celestial Intermediate Pole with respect to the International\n**     Terrestrial Reference System (see IERS Conventions 2003),\n**     measured along the meridians to 0 and 90 deg west respectively.\n**\n**  2) The argument sp is the TIO locator s', in radians, which\n**     positions the Terrestrial Intermediate Origin on the equator.  It\n**     is obtained from polar motion observations by numerical\n**     integration, and so is in essence unpredictable.  However, it is\n**     dominated by a secular drift of about 47 microarcseconds per\n**     century, and so can be taken into account by using s' = -47*t,\n**     where t is centuries since J2000.0.  The function eraSp00\n**     implements this approximation.\n**\n**  3) The matrix operates in the sense V(TRS) = rpom * V(CIP), meaning\n**     that it is the final rotation when computing the pointing\n**     direction to a celestial source.\n**\n**  Called:\n**     eraIr        initialize r-matrix to identity\n**     eraRz        rotate around Z-axis\n**     eraRy        rotate around Y-axis\n**     eraRx        rotate around X-axis\n**\n**  Reference:\n**\n**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),\n**     IERS Technical Note No. 32, BKG (2004)\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n\n/* Construct the matrix. */\n   eraIr(rpom);\n   eraRz(sp, rpom);\n   eraRy(-xp, rpom);\n   eraRx(-yp, rpom);\n\n   return;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13366,"name":"cextern/expat","nodeType":"Package"},{"id":13367,"name":"CMake.README","nodeType":"TextFile","path":"cextern/expat","text":"== How to build expat with cmake (experimental) ==\n\nThe cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual \nStudio) and should work on all other platform cmake supports.\n\nAssuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory\nbuild and change into that directory:\n~/expat-2.1.0$ mkdir build && cd build\n~/expat-2.1.0/build$\n\nFrom that directory, call cmake first, then call make, make test and \nmake install in the usual way:\n~/expat-2.1.0/build$ cmake ..\n-- The C compiler identification is GNU\n-- The CXX compiler identification is GNU\n....\n-- Configuring done\n-- Generating done\n-- Build files have been written to: /home/patrick/expat-2.1.0/build\n\nIf you want to specify the install location for your files, append \n-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.\n\n~/expat-2.1.0/build$ make && make test && make install\nScanning dependencies of target expat\n[  5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o\n[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o\n....\n-- Installing: /usr/local/lib/pkgconfig/expat.pc\n-- Installing: /usr/local/bin/xmlwf\n-- Installing: /usr/local/share/man/man1/xmlwf.1\n\nFor Windows builds, you must make sure to call cmake from an environment where \nyour compiler is reachable, that means either you call it from the \nVisual Studio Command Prompt or when using mingw, you must open a cmd.exe and\nmake sure that gcc can be called. On Windows, you also might want to specify a \nspecial Generator for CMake:\nfor Visual Studio builds do: \ncmake .. -G \"Visual Studio 10\" && vcexpress expat.sln\nfor mingw builds do: \ncmake .. -G \"MinGW Makefiles\" -DCMAKE_INSTALL_PREFIX=D:\\expat-install \n    && gmake && gmake install\n"},{"id":13368,"name":"Makefile.in","nodeType":"TextFile","path":"cextern/expat","text":"################################################################\n# Process this file with top-level configure script to produce Makefile\n#\n# Copyright 2000 Clark Cooper\n#\n#  This file is part of EXPAT.\n#\n#  EXPAT is free software; you can redistribute it and/or modify it\n#  under the terms of the License (based on the MIT/X license) contained\n#  in the file COPYING that comes with this distribution.\n#\n# EXPAT 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.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT.\n#\n\nSHELL = @SHELL@\n\nsrcdir = @srcdir@\ntop_srcdir = @top_srcdir@\nVPATH = @srcdir@\n\nprefix = @prefix@\nexec_prefix = @exec_prefix@\n\nbindir = @bindir@\nlibdir = @libdir@\nincludedir = @includedir@\nman1dir = @mandir@/man1\npkgconfigdir = $(libdir)/pkgconfig\n\ntop_builddir = .\n\n\nINSTALL = @INSTALL@\nINSTALL_PROGRAM = @INSTALL_PROGRAM@\nINSTALL_DATA = @INSTALL_DATA@\nmkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs\n\nMANFILE = $(srcdir)/doc/xmlwf.1\nAPIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h\nLIBRARY = libexpat.la\n\nDESTDIR = $(INSTALL_ROOT)\n\ndefault:  buildlib xmlwf/xmlwf@EXEEXT@\n\nbuildlib: $(LIBRARY) expat.pc\n\nall: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline\n\nclean:\n\tcd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs\n\tcd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs\n\tcd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs\n\tcd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@\n\tcd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@\n\trm -rf .libs libexpat.la\n\trm -f examples/core tests/core xmlwf/core\n\nclobber: clean\n\ndistclean: clean\n\trm -f expat_config.h config.status config.log config.cache libtool\n\trm -f Makefile expat.pc\n\nextraclean: distclean\n\trm -f expat_config.h.in configure\n\trm -f aclocal.m4 m4/*\n\trm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub\n\ncheck: tests/runtests tests/runtestspp\n\ttests/runtests\n\ttests/runtestspp\n\ninstall: xmlwf/xmlwf@EXEEXT@ installlib\n\t$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)\n\t$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf\n\t$(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir)\n\ninstalllib: $(LIBRARY) $(APIHEADER) expat.pc\n\t$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir)\n\t$(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY)\n\tfor FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done\n\t$(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc\n\nuninstall: uninstalllib\n\t$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@\n\trm -f $(DESTDIR)$(man1dir)/xmlwf.1\n\nuninstalllib:\n\t$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY)\n\trm -f $(DESTDIR)$(includedir)/expat.h\n\trm -f $(DESTDIR)$(includedir)/expat_external.h\n\trm -f $(DESTDIR)$(pkgconfigdir)/expat.pc\n\n# for VPATH builds (invoked by configure)\nmkdir-init:\n\t@for d in lib xmlwf examples tests ; do \\\n\t\t(mkdir $$d 2> /dev/null || test 1) ; \\\n\tdone\n\nCC = @CC@\nCXX = @CXX@\nLIBTOOL = @LIBTOOL@\n\nINCLUDES = -I$(srcdir)/lib -I.\nLDFLAGS = @LDFLAGS@\nCPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H\nCFLAGS = @CFLAGS@\nCXXFLAGS = @CXXFLAGS@\nVSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@\n\n### autoconf this?\nLTFLAGS = --silent\n\nCOMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS)\nCXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS)\nLTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)\nLINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@\nLINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@\nLINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@\n\nLIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo\n$(LIBRARY): $(LIB_OBJS)\n\t$(LINK_LIB) $(LIB_OBJS)\n\nexpat.pc: $(top_builddir)/config.status\n\tcd $(top_builddir) && $(SHELL) ./config.status $@\n\nlib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \\\n\t$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h\n\nlib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \\\n\t$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h\n\nlib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \\\n\tlib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \\\n\tlib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \\\n\t$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h\n\n\nXMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@\nxmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c\nxmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c\nxmlwf/codepage.@OBJEXT@: xmlwf/codepage.c\nxmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c\nxmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY)\n\t$(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY)\n\nexamples/elements.@OBJEXT@: examples/elements.c\nexamples/elements: examples/elements.@OBJEXT@ $(LIBRARY)\n\t$(LINK_EXE) $< $(LIBRARY)\n\nexamples/outline.@OBJEXT@: examples/outline.c\nexamples/outline: examples/outline.@OBJEXT@ $(LIBRARY)\n\t$(LINK_EXE) $< $(LIBRARY)\n\ntests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h\ntests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h\ntests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h\ntests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)\n\t$(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)\ntests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h\ntests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)\n\t$(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY)\n\ntests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c\ntests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY)\n\t$(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY)\n\nrun-benchmark: tests/benchmark/benchmark\n\ttests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3\n\ntests/xmlts.zip:\n\twget --output-document=tests/xmlts.zip \\\n\t\thttp://www.w3.org/XML/Test/xmlts20080827.zip\n\ntests/XML-Test-Suite: tests/xmlts.zip\n\tcd tests && unzip -q xmlts.zip\n\nrun-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite\n\ttests/xmltest.sh\n\n.SUFFIXES: .c .cpp .lo .@OBJEXT@\n\n.cpp.@OBJEXT@:\n\t$(CXXCOMPILE) -o $@ -c $<\n.c.@OBJEXT@:\n\t$(COMPILE) -o $@ -c $<\n.c.lo:\n\t$(LTCOMPILE) -o $@ -c $<\n\n.PHONY: buildlib all \\\n\tclean distclean extraclean maintainer-clean \\\n\tdist distdir \\\n\tinstall uninstall\n"},{"id":13369,"name":"configure.in","nodeType":"TextFile","path":"cextern/expat","text":"dnl   configuration script for expat\ndnl   Process this file with autoconf to produce a configure script.\ndnl\ndnl   Copyright 2000 Clark Cooper\ndnl\ndnl   This file is part of EXPAT.\ndnl\ndnl   EXPAT is free software; you can redistribute it and/or modify it\ndnl   under the terms of the License (based on the MIT/X license) contained\ndnl   in the file COPYING that comes with this distribution.\ndnl\n\ndnl Ensure that Expat is configured with autoconf 2.58 or newer\nAC_PREREQ(2.58)\n\ndnl Get the version number of Expat, using m4's esyscmd() command to run\ndnl the command at m4-generation time. This allows us to create an m4\ndnl symbol holding the correct version number. AC_INIT() requires the\ndnl version number at m4-time, rather than when ./configure is run, so\ndnl all this must happen as part of m4, not as part of the shell code\ndnl contained in ./configure.\ndnl\ndnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate\ndnl test. I believe this test will work, but I don't have a place with non-\ndnl GNU M4 to test it right now.\ndefine([expat_version], ifdef([__gnu__],\n                              [esyscmd(conftools/get-version.sh lib/expat.h)],\n                              [2.1.x]))\nAC_INIT(expat, expat_version, expat-bugs@libexpat.org)\nundefine([expat_version])\n\nAC_CONFIG_SRCDIR(Makefile.in)\nAC_CONFIG_AUX_DIR(conftools)\nAC_CONFIG_MACRO_DIR([m4])\n\n\ndnl\ndnl Increment LIBREVISION if source code has changed at all\ndnl\ndnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0\ndnl\ndnl If the API changes compatibly (i.e. simply adding a new function\ndnl without changing or removing earlier interfaces), then increment LIBAGE.\ndnl \ndnl If the API changes incompatibly set LIBAGE back to 0\ndnl\n\nLIBCURRENT=7\nLIBREVISION=0\nLIBAGE=6\n\nAC_CONFIG_HEADER(expat_config.h)\n\nsinclude(conftools/ac_c_bigendian_cross.m4)\n\nAC_LIBTOOL_WIN32_DLL\nAC_PROG_LIBTOOL\n\nAC_SUBST(LIBCURRENT)\nAC_SUBST(LIBREVISION)\nAC_SUBST(LIBAGE)\n\ndnl Checks for programs.\nAC_PROG_CC\nAC_PROG_CXX\nAC_PROG_INSTALL\n\nif test \"$GCC\" = yes ; then\n    dnl\n    dnl Be careful about adding the -fexceptions option; some versions of\n    dnl GCC don't support it and it causes extra warnings that are only\n    dnl distracting; avoid.\n    dnl\n    OLDCFLAGS=\"$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes\"\n    CFLAGS=\"$OLDCFLAGS -fexceptions\"\n    AC_MSG_CHECKING(whether $CC accepts -fexceptions)\n    AC_TRY_LINK( , ,\n                   AC_MSG_RESULT(yes),\n                   AC_MSG_RESULT(no); CFLAGS=\"$OLDCFLAGS\")\n    CXXFLAGS=`echo \"$CFLAGS\" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`\nfi\n\ndnl Checks for header files.\nAC_HEADER_STDC\n\ndnl Checks for typedefs, structures, and compiler characteristics.\n\ndnl Note: Avoid using AC_C_BIGENDIAN because it does not\ndnl work in a cross compile.\nAC_C_BIGENDIAN_CROSS\n\nAC_C_CONST\nAC_TYPE_SIZE_T\nAC_CHECK_FUNCS(memmove bcopy)\n\ndnl Only needed for xmlwf:\nAC_CHECK_HEADERS(fcntl.h unistd.h)\nAC_TYPE_OFF_T\nAC_FUNC_MMAP\n\nif test \"$ac_cv_func_mmap_fixed_mapped\" = \"yes\"; then\n    FILEMAP=unixfilemap\nelse\n    FILEMAP=readfilemap\nfi\nAC_SUBST(FILEMAP)\n\ndnl Needed for the test support code; this was found at\ndnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html\n\n# AC_CPP_FUNC\n# ------------------ #\n# Checks to see if ANSI C99 CPP variable __func__ works.\n# If not, perhaps __FUNCTION__ works instead. \n# If not, we'll just define __func__ to \"\". \nAC_DEFUN([AC_CPP_FUNC],\n[AC_REQUIRE([AC_PROG_CC_STDC])dnl\nAC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,\n[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],\n[[char *foo = __func__;]])],\n  [ac_cv_cpp_func=yes], \n  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],\n[[char *foo = __FUNCTION__;]])],\n  [ac_cv_cpp_func=__FUNCTION__], \n  [ac_cv_cpp_func=no])])])\nif test $ac_cv_cpp_func = __FUNCTION__; then\n  AC_DEFINE(__func__,__FUNCTION__,\n            [Define to __FUNCTION__ or \"\" if `__func__' does not conform to \nANSI C.])\nelif test $ac_cv_cpp_func = no; then\n  AC_DEFINE(__func__,\"\",\n            [Define to __FUNCTION__ or \"\" if `__func__' does not conform to \nANSI C.])\nfi\n])# AC_CPP_FUNC\n\nAC_CPP_FUNC\n\n\ndnl Some basic configuration:\nAC_DEFINE([XML_NS], 1,\n          [Define to make XML Namespaces functionality available.])\nAC_DEFINE([XML_DTD], 1,\n          [Define to make parameter entity parsing functionality available.])\nAC_DEFINE([XML_CONTEXT_BYTES], 1024,\n          [Define to specify how much context to retain around the current parse point.])\n\nAC_CONFIG_FILES([Makefile expat.pc])\nAC_OUTPUT\n\nabs_srcdir=\"`cd $srcdir && pwd`\"\nabs_builddir=\"`pwd`\"\nif test \"$abs_srcdir\" != \"$abs_builddir\"; then\n  make mkdir-init\nfi\n"},{"id":13370,"name":"cal2jd.c","nodeType":"TextFile","path":"cextern/erfa","text":"#include \"erfa.h\"\n\nint eraCal2jd(int iy, int im, int id, double *djm0, double *djm)\n/*\n**  - - - - - - - - - -\n**   e r a C a l 2 j d\n**  - - - - - - - - - -\n**\n**  Gregorian Calendar to Julian Date.\n**\n**  Given:\n**     iy,im,id  int     year, month, day in Gregorian calendar (Note 1)\n**\n**  Returned:\n**     djm0      double  MJD zero-point: always 2400000.5\n**     djm       double  Modified Julian Date for 0 hrs\n**\n**  Returned (function value):\n**               int     status:\n**                           0 = OK\n**                          -1 = bad year   (Note 3: JD not computed)\n**                          -2 = bad month  (JD not computed)\n**                          -3 = bad day    (JD computed)\n**\n**  Notes:\n**\n**  1) The algorithm used is valid from -4800 March 1, but this\n**     implementation rejects dates before -4799 January 1.\n**\n**  2) The Julian Date is returned in two pieces, in the usual ERFA\n**     manner, which is designed to preserve time resolution.  The\n**     Julian Date is available as a single number by adding djm0 and\n**     djm.\n**\n**  3) In early eras the conversion is from the \"Proleptic Gregorian\n**     Calendar\";  no account is taken of the date(s) of adoption of\n**     the Gregorian Calendar, nor is the AD/BC numbering convention\n**     observed.\n**\n**  Reference:\n**\n**     Explanatory Supplement to the Astronomical Almanac,\n**     P. Kenneth Seidelmann (ed), University Science Books (1992),\n**     Section 12.92 (p604).\n**\n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  Derived, with permission, from the SOFA library.  See notes at end of file.\n*/\n{\n   int j, ly, my;\n   long iypmy;\n\n/* Earliest year allowed (4800BC) */\n   const int IYMIN = -4799;\n\n/* Month lengths in days */\n   static const int mtab[]\n                     = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\n\n/* Preset status. */\n   j = 0;\n\n/* Validate year and month. */\n   if (iy < IYMIN) return -1;\n   if (im < 1 || im > 12) return -2;\n\n/* If February in a leap year, 1, otherwise 0. */\n   ly = ((im == 2) && !(iy%4) && (iy%100 || !(iy%400)));\n\n/* Validate day, taking into account leap years. */\n   if ( (id < 1) || (id > (mtab[im-1] + ly))) j = -3;\n\n/* Return result. */\n   my = (im - 14) / 12;\n   iypmy = (long) (iy + my);\n   *djm0 = ERFA_DJM0;\n   *djm = (double)((1461L * (iypmy + 4800L)) / 4L\n                 + (367L * (long) (im - 2 - 12 * my)) / 12L\n                 - (3L * ((iypmy + 4900L) / 100L)) / 4L\n                 + (long) id - 2432076L);\n\n/* Return status. */\n   return j;\n\n}\n/*----------------------------------------------------------------------\n**  \n**  \n**  Copyright (C) 2013-2017, NumFOCUS Foundation.\n**  All rights reserved.\n**  \n**  This library is derived, with permission, from the International\n**  Astronomical Union's \"Standards of Fundamental Astronomy\" library,\n**  available from http://www.iausofa.org.\n**  \n**  The ERFA version is intended to retain identical functionality to\n**  the SOFA library, but made distinct through different function and\n**  file names, as set out in the SOFA license conditions.  The SOFA\n**  original has a role as a reference standard for the IAU and IERS,\n**  and consequently redistribution is permitted only in its unaltered\n**  state.  The ERFA version is not subject to this restriction and\n**  therefore can be included in distributions which do not support the\n**  concept of \"read only\" software.\n**  \n**  Although the intent is to replicate the SOFA API (other than\n**  replacement of prefix names) and results (with the exception of\n**  bugs;  any that are discovered will be fixed), SOFA is not\n**  responsible for any errors found in this version of the library.\n**  \n**  If you wish to acknowledge the SOFA heritage, please acknowledge\n**  that you are using a library derived from SOFA, rather than SOFA\n**  itself.\n**  \n**  \n**  TERMS AND CONDITIONS\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**  \n**  2 Redistributions in binary form must reproduce the above copyright\n**    notice, this list of conditions and the following disclaimer in\n**    the documentation and/or other materials provided with the\n**    distribution.\n**  \n**  3 Neither the name of the Standards Of Fundamental Astronomy Board,\n**    the International Astronomical Union nor the names of its\n**    contributors may be used to endorse or promote products derived\n**    from this software without 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\n**  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\n**  COPYRIGHT HOLDER OR CONTRIBUTORS 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;\n**  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n**  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n**  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n**  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n**  POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n"},{"id":13371,"name":"MANIFEST","nodeType":"TextFile","path":"cextern/expat","text":"amiga/launch.c\namiga/expat_68k.c\namiga/expat_68k.h\namiga/expat_68k_handler_stubs.c\namiga/expat_base.h\namiga/expat_vectors.c\namiga/expat_lib.c\namiga/expat.xml\namiga/README.txt\namiga/Makefile\namiga/include/proto/expat.h\namiga/include/libraries/expat.h\namiga/include/interfaces/expat.h\namiga/include/inline4/expat.h\nbcb5/README.txt\nbcb5/all_projects.bpg\nbcb5/elements.bpf\nbcb5/elements.bpr\nbcb5/elements.mak\nbcb5/expat.bpf\nbcb5/expat.bpr\nbcb5/expat.mak\nbcb5/expat_static.bpf\nbcb5/expat_static.bpr\nbcb5/expat_static.mak\nbcb5/expatw.bpf\nbcb5/expatw.bpr\nbcb5/expatw.mak\nbcb5/expatw_static.bpf\nbcb5/expatw_static.bpr\nbcb5/expatw_static.mak\nbcb5/libexpat_mtd.def\nbcb5/libexpatw_mtd.def\nbcb5/makefile.mak\nbcb5/outline.bpf\nbcb5/outline.bpr\nbcb5/outline.mak\nbcb5/setup.bat\nbcb5/xmlwf.bpf\nbcb5/xmlwf.bpr\nbcb5/xmlwf.mak\ndoc/expat.png\ndoc/reference.html\ndoc/style.css\ndoc/valid-xhtml10.png\ndoc/xmlwf.1\ndoc/xmlwf.sgml\nCMakeLists.txt\nCMake.README\nCOPYING\nChanges\nConfigureChecks.cmake\nMANIFEST\nMakefile.in\nREADME\nconfigure\nconfigure.in\nexpat_config.h.in\nexpat_config.h.cmake\nexpat.pc.in\nexpat.dsw\naclocal.m4\nconftools/PrintPath\nconftools/ac_c_bigendian_cross.m4\nconftools/expat.m4\nconftools/get-version.sh\nconftools/mkinstalldirs\nconftools/config.guess\nconftools/config.sub\nconftools/install-sh\nconftools/ltmain.sh\nm4/libtool.m4\nm4/ltversion.m4\nm4/ltoptions.m4\nm4/ltsugar.m4\nm4/lt~obsolete.m4\nexamples/elements.c\nexamples/elements.dsp\nexamples/outline.c\nexamples/outline.dsp\nlib/Makefile.MPW\nlib/amigaconfig.h\nlib/ascii.h\nlib/asciitab.h\nlib/expat.dsp\nlib/expat.h\nlib/expat_external.h\nlib/expat_static.dsp\nlib/expatw.dsp\nlib/expatw_static.dsp\nlib/iasciitab.h\nlib/internal.h\nlib/latin1tab.h\nlib/libexpat.def\nlib/libexpatw.def\nlib/macconfig.h\nlib/nametab.h\nlib/utf8tab.h\nlib/winconfig.h\nlib/xmlparse.c\nlib/xmlrole.c\nlib/xmlrole.h\nlib/xmltok.c\nlib/xmltok.h\nlib/xmltok_impl.c\nlib/xmltok_impl.h\nlib/xmltok_ns.c\ntests/benchmark/README.txt\ntests/benchmark/benchmark.c\ntests/benchmark/benchmark.dsp\ntests/benchmark/benchmark.dsw\ntests/README.txt\ntests/chardata.c\ntests/chardata.h\ntests/minicheck.c\ntests/minicheck.h\ntests/runtests.c\ntests/runtestspp.cpp\ntests/xmltest.sh\nvms/README.vms\nvms/descrip.mms\nvms/expat_config.h\nwin32/MANIFEST.txt\nwin32/README.txt\nwin32/expat.iss\nxmlwf/codepage.c\nxmlwf/codepage.h\nxmlwf/ct.c\nxmlwf/filemap.h\nxmlwf/readfilemap.c\nxmlwf/unixfilemap.c\nxmlwf/win32filemap.c\nxmlwf/xmlfile.c\nxmlwf/xmlfile.h\nxmlwf/xmlmime.c\nxmlwf/xmlmime.h\nxmlwf/xmltchar.h\nxmlwf/xmlurl.h\nxmlwf/xmlwf.c\nxmlwf/xmlwf.dsp\nxmlwf/xmlwin32url.cxx\n"},{"id":13372,"name":"COPYING","nodeType":"TextFile","path":"cextern/expat","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":13373,"name":"CMakeLists.txt","nodeType":"TextFile","path":"cextern/expat","text":"# This file is copyrighted under the BSD-license for buildsystem files of KDE\n# copyright 2010, Patrick Spendrin <ps_ml@gmx.de>\n\nproject(expat)\n\ncmake_minimum_required(VERSION 2.6)\nset(PACKAGE_BUGREPORT \"expat-bugs@libexpat.org\")\nset(PACKAGE_NAME \"expat\")\nset(PACKAGE_VERSION \"2.1.0\")\nset(PACKAGE_STRING \"${PACKAGE_NAME} ${PACKAGE_VERSION}\")\nset(PACKAGE_TARNAME \"${PACKAGE_NAME}\")\n\noption(BUILD_tools \"build the xmlwf tool for expat library\" ON)\noption(BUILD_examples \"build the examples for expat library\" ON)\noption(BUILD_tests \"build the tests for expat library\" ON)\noption(BUILD_shared \"build a shared expat library\" ON)\n\n# configuration options\nset(XML_CONTEXT_BYTES 1024 CACHE STRING \"Define to specify how much context to retain around the current parse point\")\noption(XML_DTD \"Define to make parameter entity parsing functionality available\" ON)\noption(XML_NS \"Define to make XML Namespaces functionality available\" ON)\n\nif(XML_DTD)\n    set(XML_DTD 1)\nelse(XML_DTD)\n    set(XML_DTD 0)\nendif(XML_DTD)\nif(XML_NS)\n    set(XML_NS 1)\nelse(XML_NS)\n    set(XML_NS 0)\nendif(XML_NS)\n\nif(BUILD_tests)\n    enable_testing()\nendif(BUILD_tests)\n\ninclude(ConfigureChecks.cmake)\n\ninclude_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)\nif(MSVC)\n    add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)\nendif(MSVC)\n\nset(expat_SRCS\n    lib/xmlparse.c\n    lib/xmlrole.c\n    lib/xmltok.c \n    lib/xmltok_impl.c \n    lib/xmltok_ns.c\n)\n\nif(WIN32 AND BUILD_shared)\n    set(expat_SRCS ${expat_SRCS} lib/libexpat.def)\nendif(WIN32 AND BUILD_shared)\n\nif(BUILD_shared)\n    set(_SHARED SHARED)\nelse(BUILD_shared)\n    set(_SHARED STATIC)\nendif(BUILD_shared)\n\nadd_library(expat ${_SHARED} ${expat_SRCS})\n\ninstall(TARGETS expat RUNTIME DESTINATION bin\n                      LIBRARY DESTINATION lib\n                      ARCHIVE DESTINATION lib)\n\nset(prefix ${CMAKE_INSTALL_PREFIX})\nset(exec_prefix \"\\${prefix}/bin\")\nset(libdir \"\\${prefix}/lib\")\nset(includedir \"\\${prefix}/include\")\nconfigure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)\n\ninstall(FILES lib/expat.h lib/expat_external.h DESTINATION include)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)\n\n\n\nif(BUILD_tools AND NOT WINCE)\n    set(xmlwf_SRCS\n        xmlwf/xmlwf.c\n        xmlwf/xmlfile.c\n        xmlwf/codepage.c\n        xmlwf/readfilemap.c\n    )\n\n    add_executable(xmlwf ${xmlwf_SRCS})\n    target_link_libraries(xmlwf expat)\n    install(TARGETS xmlwf DESTINATION bin)\n    install(FILES doc/xmlwf.1 DESTINATION share/man/man1)\nendif(BUILD_tools AND NOT WINCE)\n\nif(BUILD_examples)\n    add_executable(elements examples/elements.c)\n    target_link_libraries(elements expat)\n\n    add_executable(outline examples/outline.c)\n    target_link_libraries(outline expat)\nendif(BUILD_examples)\n\nif(BUILD_tests)\n    ## these are unittests that can be run on any platform\n    add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)\n    target_link_libraries(runtests expat)\n    add_test(runtests runtests)\n\n    add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)\n    target_link_libraries(runtestspp expat)\n    add_test(runtestspp runtestspp)\nendif(BUILD_tests)\n"},{"id":13374,"name":"ConfigureChecks.cmake","nodeType":"TextFile","path":"cextern/expat","text":"include(CheckIncludeFile)\ninclude(CheckIncludeFiles)\ninclude(CheckFunctionExists)\ninclude(CheckSymbolExists)\ninclude(TestBigEndian)\n\ncheck_include_file(\"dlfcn.h\" HAVE_DLFCN_H)\ncheck_include_file(\"fcntl.h\" HAVE_FCNTL_H)\ncheck_include_file(\"inttypes.h\" HAVE_INTTYPES_H)\ncheck_include_file(\"memory.h\" HAVE_MEMORY_H)\ncheck_include_file(\"stdint.h\" HAVE_STDINT_H)\ncheck_include_file(\"stdlib.h\" HAVE_STDLIB_H)\ncheck_include_file(\"strings.h\" HAVE_STRINGS_H)\ncheck_include_file(\"string.h\" HAVE_STRING_H)\ncheck_include_file(\"sys/stat.h\" HAVE_SYS_STAT_H)\ncheck_include_file(\"sys/types.h\" HAVE_SYS_TYPES_H)\ncheck_include_file(\"unistd.h\" HAVE_UNISTD_H)\n\ncheck_function_exists(\"getpagesize\" HAVE_GETPAGESIZE)\ncheck_function_exists(\"bcopy\" HAVE_BCOPY)\ncheck_symbol_exists(\"memmove\" \"string.h\" HAVE_MEMMOVE)\ncheck_function_exists(\"mmap\" HAVE_MMAP)\n\n#/* Define to 1 if you have the ANSI C header files. */\ncheck_include_files(\"stdlib.h;stdarg.h;string.h;float.h\" STDC_HEADERS)\n\ntest_big_endian(WORDS_BIGENDIAN)\n#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\nif(WORDS_BIGENDIAN)\n    set(BYTEORDER 4321)\nelse(WORDS_BIGENDIAN)\n    set(BYTEORDER 1234)\nendif(WORDS_BIGENDIAN)\n\nif(HAVE_SYS_TYPES_H)\n    check_symbol_exists(\"off_t\" \"sys/types.h\" OFF_T)\n    check_symbol_exists(\"size_t\" \"sys/types.h\" SIZE_T)\nelse(HAVE_SYS_TYPES_H)\n    set(OFF_T \"long\")\n    set(SIZE_T \"unsigned\")\nendif(HAVE_SYS_TYPES_H)\n\nconfigure_file(expat_config.h.cmake expat_config.h)\nadd_definitions(-DHAVE_EXPAT_CONFIG_H)\n"},{"id":13375,"name":"expat.pc.in","nodeType":"TextFile","path":"cextern/expat","text":"prefix=@prefix@\nexec_prefix=@exec_prefix@\nlibdir=@libdir@\nincludedir=@includedir@\n\nName: expat\nVersion: @PACKAGE_VERSION@\nDescription: expat XML parser\nURL: http://www.libexpat.org\nLibs: -L${libdir} -lexpat\nCflags: -I${includedir}\n"},{"id":13376,"name":"Changes","nodeType":"TextFile","path":"cextern/expat","text":"Release 2.1.0 Sat March 24 2012\n        - Bug Fixes:\n          #1742315: Harmful XML_ParserCreateNS suggestion.\n          #2895533: CVE-2012-1147 - Resource leak in readfilemap.c.\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          #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences.\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          #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8().\n          #2958794: CVE-2012-1148 - Memory leak in poolGrow.\n          #2990652: CMake support.\n          #3010819: UNEXPECTED_STATE with a trailing \"%\" in entity value.\n          #3206497: Unitialized memory returned from XML_Parse.\n          #3287849: make check fails on mingw-w64.\n          #3496608: CVE-2012-0876 - Hash DOS attack.\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 intial\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":13377,"name":"README","nodeType":"TextFile","path":"cextern/expat","text":"\n                        Expat, Release 2.1.0\n\nThis is Expat, a C library for parsing XML, written by James Clark.\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\nWindows users should use the expat_win32bin package, which includes\nboth precompiled libraries and executables, and source code for\ndevelopers.\n\nExpat is free software.  You may copy, distribute, and modify it under\nthe terms of the License contained in the file COPYING distributed\nwith this package.  This license is the same as the MIT/X Consortium\nlicense.\n\nVersions of Expat that have an odd minor version (the middle number in\nthe release above), are development releases and should be considered\nas beta software.  Releases with even minor version numbers are\nintended to be production grade software.\n\nIf you are building Expat from a check-out from the CVS repository,\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        ./buildconf.sh\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        ./configure\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\nxmlwf 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        ./configure --prefix=/home/me/mystuff\n        \nAnother interesting option is to enable 64-bit integer support for\nline and column numbers and the over-all byte index:\n\n        ./configure CPPFLAGS=-DXML_LARGE_SIZE\n        \nHowever, such a modification would be a breaking change to the ABI\nand is therefore not recommended for general use - e.g. as part of\na Linux distribution - 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\"):\n\n        1. For UTF-16 output as unsigned short (and version/error\n           strings as char), run:\n\n               ./configure CPPFLAGS=-DXML_UNICODE\n\n           For UTF-16 output as wchar_t (incl. version/error strings),\n           run:\n\n               ./configure CFLAGS=\"-g -O2 -fshort-wchar\" \\\n                           CPPFLAGS=-DXML_UNICODE_WCHAR_T\n\n        2. Edit the MakeFile, changing:\n\n               LIBRARY = libexpat.la\n\n           to:\n\n               LIBRARY = libexpatw.la\n\n           (Note the additional \"w\" in the library name.)\n\n        3. Run \"make buildlib\" (which builds the library only).\n           Or, to save step 2, run \"make buildlib LIBRARY=libexpatw.la\".\n\n        4. Run \"make installlib\" (which installs the library only).\n           Or, if step 2 was omitted, run \"make installlib LIBRARY=libexpatw.la\".\n           \nUsing DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default\nvalue for DESTDIR, and the rest of the make file using only DESTDIR.\nIt works as follows:\n   $ make install DESTDIR=/path/to/image\noverrides the in-makefile set DESTDIR, while both\n   $ INSTALL_ROOT=/path/to/image make install\n   $ make install INSTALL_ROOT=/path/to/image\nuse DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the\nenvironment, because variable-setting priority is\n1) commandline\n2) in-makefile\n3) 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\nNote for Solaris users:  The \"ar\" command is usually located in\n\"/usr/ccs/bin\", which is not in the default PATH.  You will need to\nadd this to your path for the \"make\" command, and probably also switch\nto GNU make (the \"make\" found in /usr/ccs/bin does not seem to work\nproperly -- appearantly it does not understand .PHONY directives).  If\nyou're using ksh or bash, use this command to build:\n\n        PATH=/usr/ccs/bin:$PATH make\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\nThe homepage for this project is http://www.libexpat.org/.  There\nare links there to connect you to the bug reports page.  If you need\nto report a bug when you don't have access to a browser, you may also\nsend a bug report by email to expat-bugs@mail.libexpat.org.\n\nDiscussion related to the direction of future expat development takes\nplace on expat-discuss@mail.libexpat.org.  Archives of this list and\nother Expat-related lists may be found at:\n\n        http://mail.libexpat.org/mailman/listinfo/\n"},{"id":13378,"name":"expat_config.h.in","nodeType":"TextFile","path":"cextern/expat","text":"/* expat_config.h.in.  Generated from configure.in by autoheader.  */\n\n/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\n#undef BYTEORDER\n\n/* Define to 1 if you have the `bcopy' function. */\n#undef HAVE_BCOPY\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 <inttypes.h> header file. */\n#undef HAVE_INTTYPES_H\n\n/* Define to 1 if you have the `memmove' function. */\n#undef HAVE_MEMMOVE\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 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 in which libtool stores uninstalled libraries.\n   */\n#undef LT_OBJDIR\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/* whether byteorder is bigendian */\n#undef WORDS_BIGENDIAN\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 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 __FUNCTION__ or \"\" if `__func__' does not conform to ANSI C. */\n#undef __func__\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":13379,"name":"expat.dsw","nodeType":"TextFile","path":"cextern/expat","text":"Microsoft Developer Studio Workspace File, Format Version 6.00\n# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n###############################################################################\n\nProject: \"elements\"=.\\examples\\elements.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n    Begin Project Dependency\n    Project_Dep_Name expat_static\n    End Project Dependency\n}}}\n\n###############################################################################\n\nProject: \"expat\"=.\\lib\\expat.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n}}}\n\n###############################################################################\n\nProject: \"expat_static\"=.\\lib\\expat_static.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n}}}\n\n###############################################################################\n\nProject: \"expatw\"=.\\lib\\expatw.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n}}}\n\n###############################################################################\n\nProject: \"expatw_static\"=.\\lib\\expatw_static.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n}}}\n\n###############################################################################\n\nProject: \"outline\"=.\\examples\\outline.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n    Begin Project Dependency\n    Project_Dep_Name expat\n    End Project Dependency\n}}}\n\n###############################################################################\n\nProject: \"xmlwf\"=.\\xmlwf\\xmlwf.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n    Begin Project Dependency\n    Project_Dep_Name expat\n    End Project Dependency\n}}}\n\n###############################################################################\n\nGlobal:\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<3>\n{{{\n}}}\n\n###############################################################################\n\n"},{"id":13380,"name":"cextern/expat/m4","nodeType":"Package"},{"id":13381,"name":"expat_config.h.cmake","nodeType":"TextFile","path":"cextern/expat","text":"/* expat_config.h.in.  Generated from configure.in by autoheader.  */\n\n/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\n#cmakedefine BYTEORDER @BYTEORDER@\n\n/* Define to 1 if you have the `bcopy' function. */\n#cmakedefine HAVE_BCOPY\n\n/* Define to 1 if you have the <dlfcn.h> header file. */\n#cmakedefine HAVE_DLFCN_H\n\n/* Define to 1 if you have the <fcntl.h> header file. */\n#cmakedefine HAVE_FCNTL_H\n\n/* Define to 1 if you have the `getpagesize' function. */\n#cmakedefine HAVE_GETPAGESIZE\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#cmakedefine HAVE_INTTYPES_H\n\n/* Define to 1 if you have the `memmove' function. */\n#cmakedefine HAVE_MEMMOVE\n\n/* Define to 1 if you have the <memory.h> header file. */\n#cmakedefine HAVE_MEMORY_H\n\n/* Define to 1 if you have a working `mmap' system call. */\n#cmakedefine HAVE_MMAP\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#cmakedefine HAVE_STDINT_H\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#cmakedefine HAVE_STDLIB_H\n\n/* Define to 1 if you have the <strings.h> header file. */\n#cmakedefine HAVE_STRINGS_H\n\n/* Define to 1 if you have the <string.h> header file. */\n#cmakedefine HAVE_STRING_H\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#cmakedefine HAVE_SYS_STAT_H\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#cmakedefine HAVE_SYS_TYPES_H\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#cmakedefine HAVE_UNISTD_H\n\n/* Define to the address where bug reports for this package should be sent. */\n#cmakedefine PACKAGE_BUGREPORT\n\n/* Define to the full name of this package. */\n#cmakedefine PACKAGE_NAME\n\n/* Define to the full name and version of this package. */\n#cmakedefine PACKAGE_STRING\n\n/* Define to the one symbol short name of this package. */\n#cmakedefine PACKAGE_TARNAME\n\n/* Define to the version of this package. */\n#cmakedefine PACKAGE_VERSION\n\n/* Define to 1 if you have the ANSI C header files. */\n#cmakedefine STDC_HEADERS\n\n/* whether byteorder is bigendian */\n#cmakedefine WORDS_BIGENDIAN\n\n/* Define to specify how much context to retain around the current parse\n   point. */\n#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@\n\n/* Define to make parameter entity parsing functionality available. */\n#cmakedefine XML_DTD\n\n/* Define to make XML Namespaces functionality available. */\n#cmakedefine XML_NS\n\n/* Define to __FUNCTION__ or \"\" if `__func__' does not conform to ANSI C. */\n#ifdef _MSC_VER\n# define __func__ __FUNCTION__\n#endif\n\n/* Define to `long' if <sys/types.h> does not define. */\n#cmakedefine off_t @OFF_T@\n\n/* Define to `unsigned' if <sys/types.h> does not define. */\n#cmakedefine size_t @SIZE_T@\n"},{"id":13382,"name":"ltversion.m4","nodeType":"TextFile","path":"cextern/expat/m4","text":"# ltversion.m4 -- version numbers\t\t\t-*- Autoconf -*-\n#\n#   Copyright (C) 2004 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# @configure_input@\n\n# serial 3293 ltversion.m4\n# This file is part of GNU Libtool\n\nm4_define([LT_PACKAGE_VERSION], [2.4])\nm4_define([LT_PACKAGE_REVISION], [1.3293])\n\nAC_DEFUN([LTVERSION_VERSION],\n[macro_version='2.4'\nmacro_revision='1.3293'\n_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])\n_LT_DECL(, macro_revision, 0)\n])\n"},{"id":13383,"name":"lt~obsolete.m4","nodeType":"TextFile","path":"cextern/expat/m4","text":"# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004.\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 5 lt~obsolete.m4\n\n# These exist entirely to fool aclocal when bootstrapping libtool.\n#\n# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)\n# which have later been changed to m4_define as they aren't part of the\n# exported API, or moved to Autoconf or Automake where they belong.\n#\n# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN\n# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us\n# using a macro with the same name in our local m4/libtool.m4 it'll\n# pull the old libtool.m4 in (it doesn't see our shiny new m4_define\n# and doesn't know about Autoconf macros at all.)\n#\n# So we provide this file, which has a silly filename so it's always\n# included after everything else.  This provides aclocal with the\n# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything\n# because those macros already exist, or will be overwritten later.\n# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. \n#\n# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.\n# Yes, that means every name once taken will need to remain here until\n# we give up compatibility with versions before 1.7, at which point\n# we need to keep only those names which we still refer to.\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])\n\nm4_ifndef([AC_LIBTOOL_LINKER_OPTION],\t[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])\nm4_ifndef([AC_PROG_EGREP],\t\t[AC_DEFUN([AC_PROG_EGREP])])\nm4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_AC_SHELL_INIT],\t\t[AC_DEFUN([_LT_AC_SHELL_INIT])])\nm4_ifndef([_LT_AC_SYS_LIBPATH_AIX],\t[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])\nm4_ifndef([_LT_PROG_LTMAIN],\t\t[AC_DEFUN([_LT_PROG_LTMAIN])])\nm4_ifndef([_LT_AC_TAGVAR],\t\t[AC_DEFUN([_LT_AC_TAGVAR])])\nm4_ifndef([AC_LTDL_ENABLE_INSTALL],\t[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])\nm4_ifndef([AC_LTDL_PREOPEN],\t\t[AC_DEFUN([AC_LTDL_PREOPEN])])\nm4_ifndef([_LT_AC_SYS_COMPILER],\t[AC_DEFUN([_LT_AC_SYS_COMPILER])])\nm4_ifndef([_LT_AC_LOCK],\t\t[AC_DEFUN([_LT_AC_LOCK])])\nm4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],\t[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])\nm4_ifndef([_LT_AC_TRY_DLOPEN_SELF],\t[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])\nm4_ifndef([AC_LIBTOOL_PROG_CC_C_O],\t[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])\nm4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])\nm4_ifndef([AC_LIBTOOL_OBJDIR],\t\t[AC_DEFUN([AC_LIBTOOL_OBJDIR])])\nm4_ifndef([AC_LTDL_OBJDIR],\t\t[AC_DEFUN([AC_LTDL_OBJDIR])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])\nm4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],\t[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])\nm4_ifndef([AC_PATH_MAGIC],\t\t[AC_DEFUN([AC_PATH_MAGIC])])\nm4_ifndef([AC_PROG_LD_GNU],\t\t[AC_DEFUN([AC_PROG_LD_GNU])])\nm4_ifndef([AC_PROG_LD_RELOAD_FLAG],\t[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])\nm4_ifndef([AC_DEPLIBS_CHECK_METHOD],\t[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])\nm4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],\t[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])\nm4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],\t[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])\nm4_ifndef([LT_AC_PROG_EGREP],\t\t[AC_DEFUN([LT_AC_PROG_EGREP])])\nm4_ifndef([LT_AC_PROG_SED],\t\t[AC_DEFUN([LT_AC_PROG_SED])])\nm4_ifndef([_LT_CC_BASENAME],\t\t[AC_DEFUN([_LT_CC_BASENAME])])\nm4_ifndef([_LT_COMPILER_BOILERPLATE],\t[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])\nm4_ifndef([_LT_LINKER_BOILERPLATE],\t[AC_DEFUN([_LT_LINKER_BOILERPLATE])])\nm4_ifndef([_AC_PROG_LIBTOOL],\t\t[AC_DEFUN([_AC_PROG_LIBTOOL])])\nm4_ifndef([AC_LIBTOOL_SETUP],\t\t[AC_DEFUN([AC_LIBTOOL_SETUP])])\nm4_ifndef([_LT_AC_CHECK_DLFCN],\t\t[AC_DEFUN([_LT_AC_CHECK_DLFCN])])\nm4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],\t[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])\nm4_ifndef([_LT_AC_TAGCONFIG],\t\t[AC_DEFUN([_LT_AC_TAGCONFIG])])\nm4_ifndef([AC_DISABLE_FAST_INSTALL],\t[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])\nm4_ifndef([_LT_AC_LANG_CXX],\t\t[AC_DEFUN([_LT_AC_LANG_CXX])])\nm4_ifndef([_LT_AC_LANG_F77],\t\t[AC_DEFUN([_LT_AC_LANG_F77])])\nm4_ifndef([_LT_AC_LANG_GCJ],\t\t[AC_DEFUN([_LT_AC_LANG_GCJ])])\nm4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])\nm4_ifndef([_LT_AC_LANG_C_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])\nm4_ifndef([_LT_AC_LANG_CXX_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])\nm4_ifndef([_LT_AC_LANG_F77_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])\nm4_ifndef([_LT_AC_LANG_GCJ_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])\nm4_ifndef([_LT_AC_LANG_RC_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])\nm4_ifndef([AC_LIBTOOL_CONFIG],\t\t[AC_DEFUN([AC_LIBTOOL_CONFIG])])\nm4_ifndef([_LT_AC_FILE_LTDLL_C],\t[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])\nm4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],\t[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])\nm4_ifndef([_LT_AC_PROG_CXXCPP],\t\t[AC_DEFUN([_LT_AC_PROG_CXXCPP])])\nm4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],\t[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])\nm4_ifndef([_LT_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_PROG_F77],\t\t[AC_DEFUN([_LT_PROG_F77])])\nm4_ifndef([_LT_PROG_FC],\t\t[AC_DEFUN([_LT_PROG_FC])])\nm4_ifndef([_LT_PROG_CXX],\t\t[AC_DEFUN([_LT_PROG_CXX])])\n"},{"id":13384,"name":"ltsugar.m4","nodeType":"TextFile","path":"cextern/expat/m4","text":"# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-\n#\n# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.\n# Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 6 ltsugar.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])\n\n\n# lt_join(SEP, ARG1, [ARG2...])\n# -----------------------------\n# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their\n# associated separator.\n# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier\n# versions in m4sugar had bugs.\nm4_define([lt_join],\n[m4_if([$#], [1], [],\n       [$#], [2], [[$2]],\n       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])\nm4_define([_lt_join],\n[m4_if([$#$2], [2], [],\n       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])\n\n\n# lt_car(LIST)\n# lt_cdr(LIST)\n# ------------\n# Manipulate m4 lists.\n# These macros are necessary as long as will still need to support\n# Autoconf-2.59 which quotes differently.\nm4_define([lt_car], [[$1]])\nm4_define([lt_cdr],\n[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],\n       [$#], 1, [],\n       [m4_dquote(m4_shift($@))])])\nm4_define([lt_unquote], $1)\n\n\n# lt_append(MACRO-NAME, STRING, [SEPARATOR])\n# ------------------------------------------\n# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.\n# Note that neither SEPARATOR nor STRING are expanded; they are appended\n# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).\n# No SEPARATOR is output if MACRO-NAME was previously undefined (different\n# than defined and empty).\n#\n# This macro is needed until we can rely on Autoconf 2.62, since earlier\n# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.\nm4_define([lt_append],\n[m4_define([$1],\n\t   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])\n\n\n\n# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])\n# ----------------------------------------------------------\n# Produce a SEP delimited list of all paired combinations of elements of\n# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list\n# has the form PREFIXmINFIXSUFFIXn.\n# Needed until we can rely on m4_combine added in Autoconf 2.62.\nm4_define([lt_combine],\n[m4_if(m4_eval([$# > 3]), [1],\n       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl\n[[m4_foreach([_Lt_prefix], [$2],\n\t     [m4_foreach([_Lt_suffix],\n\t\t]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,\n\t[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])\n\n\n# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])\n# -----------------------------------------------------------------------\n# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited\n# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.\nm4_define([lt_if_append_uniq],\n[m4_ifdef([$1],\n\t  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],\n\t\t [lt_append([$1], [$2], [$3])$4],\n\t\t [$5])],\n\t  [lt_append([$1], [$2], [$3])$4])])\n\n\n# lt_dict_add(DICT, KEY, VALUE)\n# -----------------------------\nm4_define([lt_dict_add],\n[m4_define([$1($2)], [$3])])\n\n\n# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)\n# --------------------------------------------\nm4_define([lt_dict_add_subkey],\n[m4_define([$1($2:$3)], [$4])])\n\n\n# lt_dict_fetch(DICT, KEY, [SUBKEY])\n# ----------------------------------\nm4_define([lt_dict_fetch],\n[m4_ifval([$3],\n\tm4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),\n    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])\n\n\n# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])\n# -----------------------------------------------------------------\nm4_define([lt_if_dict_fetch],\n[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],\n\t[$5],\n    [$6])])\n\n\n# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])\n# --------------------------------------------------------------\nm4_define([lt_dict_filter],\n[m4_if([$5], [], [],\n  [lt_join(m4_quote(m4_default([$4], [[, ]])),\n           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),\n\t\t      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl\n])\n"},{"id":13385,"name":"ltoptions.m4","nodeType":"TextFile","path":"cextern/expat/m4","text":"# Helper functions for option handling.                    -*- Autoconf -*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,\n#   Inc.\n#   Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 7 ltoptions.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])\n\n\n# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)\n# ------------------------------------------\nm4_define([_LT_MANGLE_OPTION],\n[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])\n\n\n# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)\n# ---------------------------------------\n# Set option OPTION-NAME for macro MACRO-NAME, and if there is a\n# matching handler defined, dispatch to it.  Other OPTION-NAMEs are\n# saved as a flag.\nm4_define([_LT_SET_OPTION],\n[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl\nm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),\n        _LT_MANGLE_DEFUN([$1], [$2]),\n    [m4_warning([Unknown $1 option `$2'])])[]dnl\n])\n\n\n# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])\n# ------------------------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nm4_define([_LT_IF_OPTION],\n[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])\n\n\n# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)\n# -------------------------------------------------------\n# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME\n# are set.\nm4_define([_LT_UNLESS_OPTIONS],\n[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n\t    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),\n\t\t      [m4_define([$0_found])])])[]dnl\nm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3\n])[]dnl\n])\n\n\n# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)\n# ----------------------------------------\n# OPTION-LIST is a space-separated list of Libtool options associated\n# with MACRO-NAME.  If any OPTION has a matching handler declared with\n# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about\n# the unknown option and exit.\nm4_defun([_LT_SET_OPTIONS],\n[# Set options\nm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n    [_LT_SET_OPTION([$1], _LT_Option)])\n\nm4_if([$1],[LT_INIT],[\n  dnl\n  dnl Simply set some default values (i.e off) if boolean options were not\n  dnl specified:\n  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no\n  ])\n  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no\n  ])\n  dnl\n  dnl If no reference was made to various pairs of opposing options, then\n  dnl we run the default mode handler for the pair.  For example, if neither\n  dnl `shared' nor `disable-shared' was passed, we enable building of shared\n  dnl archives by default:\n  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])\n  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],\n  \t\t   [_LT_ENABLE_FAST_INSTALL])\n  ])\n])# _LT_SET_OPTIONS\n\n\n## --------------------------------- ##\n## Macros to handle LT_INIT options. ##\n## --------------------------------- ##\n\n# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)\n# -----------------------------------------\nm4_define([_LT_MANGLE_DEFUN],\n[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])\n\n\n# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)\n# -----------------------------------------------\nm4_define([LT_OPTION_DEFINE],\n[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl\n])# LT_OPTION_DEFINE\n\n\n# dlopen\n# ------\nLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes\n])\n\nAU_DEFUN([AC_LIBTOOL_DLOPEN],\n[_LT_SET_OPTION([LT_INIT], [dlopen])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `dlopen' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])\n\n\n# win32-dll\n# ---------\n# Declare package support for building win32 dll's.\nLT_OPTION_DEFINE([LT_INIT], [win32-dll],\n[enable_win32_dll=yes\n\ncase $host in\n*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)\n  AC_CHECK_TOOL(AS, as, false)\n  AC_CHECK_TOOL(DLLTOOL, dlltool, false)\n  AC_CHECK_TOOL(OBJDUMP, objdump, false)\n  ;;\nesac\n\ntest -z \"$AS\" && AS=as\n_LT_DECL([], [AS],      [1], [Assembler program])dnl\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl\n])# win32-dll\n\nAU_DEFUN([AC_LIBTOOL_WIN32_DLL],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n_LT_SET_OPTION([LT_INIT], [win32-dll])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `win32-dll' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])\n\n\n# _LT_ENABLE_SHARED([DEFAULT])\n# ----------------------------\n# implement the --enable-shared flag, and supports the `shared' and\n# `disable-shared' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_SHARED],\n[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([shared],\n    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],\n\t[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)\n\n    _LT_DECL([build_libtool_libs], [enable_shared], [0],\n\t[Whether or not to build shared libraries])\n])# _LT_ENABLE_SHARED\n\nLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])\n])\n\nAC_DEFUN([AC_DISABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], [disable-shared])\n])\n\nAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])\nAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_SHARED], [])\ndnl AC_DEFUN([AM_DISABLE_SHARED], [])\n\n\n\n# _LT_ENABLE_STATIC([DEFAULT])\n# ----------------------------\n# implement the --enable-static flag, and support the `static' and\n# `disable-static' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_STATIC],\n[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([static],\n    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],\n\t[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)\n\n    _LT_DECL([build_old_libs], [enable_static], [0],\n\t[Whether or not to build static libraries])\n])# _LT_ENABLE_STATIC\n\nLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])\n])\n\nAC_DEFUN([AC_DISABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], [disable-static])\n])\n\nAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])\nAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_STATIC], [])\ndnl AC_DEFUN([AM_DISABLE_STATIC], [])\n\n\n\n# _LT_ENABLE_FAST_INSTALL([DEFAULT])\n# ----------------------------------\n# implement the --enable-fast-install flag, and support the `fast-install'\n# and `disable-fast-install' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_FAST_INSTALL],\n[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([fast-install],\n    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],\n    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)\n\n_LT_DECL([fast_install], [enable_fast_install], [0],\n\t [Whether or not to optimize for fast installation])dnl\n])# _LT_ENABLE_FAST_INSTALL\n\nLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])\n\n# Old names:\nAU_DEFUN([AC_ENABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `fast-install' option into LT_INIT's first parameter.])\n])\n\nAU_DEFUN([AC_DISABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], [disable-fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `disable-fast-install' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])\ndnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])\n\n\n# _LT_WITH_PIC([MODE])\n# --------------------\n# implement the --with-pic flag, and support the `pic-only' and `no-pic'\n# LT_INIT options.\n# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.\nm4_define([_LT_WITH_PIC],\n[AC_ARG_WITH([pic],\n    [AS_HELP_STRING([--with-pic],\n\t[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],\n    [pic_mode=\"$withval\"],\n    [pic_mode=default])\n\ntest -z \"$pic_mode\" && pic_mode=m4_default([$1], [default])\n\n_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl\n])# _LT_WITH_PIC\n\nLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])\n\n# Old name:\nAU_DEFUN([AC_LIBTOOL_PICMODE],\n[_LT_SET_OPTION([LT_INIT], [pic-only])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `pic-only' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])\n\n## ----------------- ##\n## LTDL_INIT Options ##\n## ----------------- ##\n\nm4_define([_LTDL_MODE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],\n\t\t [m4_define([_LTDL_MODE], [nonrecursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [recursive],\n\t\t [m4_define([_LTDL_MODE], [recursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [subproject],\n\t\t [m4_define([_LTDL_MODE], [subproject])])\n\nm4_define([_LTDL_TYPE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [installable],\n\t\t [m4_define([_LTDL_TYPE], [installable])])\nLT_OPTION_DEFINE([LTDL_INIT], [convenience],\n\t\t [m4_define([_LTDL_TYPE], [convenience])])\n"},{"id":13386,"name":"aclocal.m4","nodeType":"TextFile","path":"cextern/expat","text":"# generated automatically by aclocal 1.11.1 -*- Autoconf -*-\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,\n# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.\n# This file 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# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,\n#                 Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\nm4_define([_LT_COPYING], [dnl\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,\n#                 Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n])\n\n# serial 57 LT_INIT\n\n\n# LT_PREREQ(VERSION)\n# ------------------\n# Complain and exit if this libtool version is less that VERSION.\nm4_defun([LT_PREREQ],\n[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,\n       [m4_default([$3],\n\t\t   [m4_fatal([Libtool version $1 or higher is required],\n\t\t             63)])],\n       [$2])])\n\n\n# _LT_CHECK_BUILDDIR\n# ------------------\n# Complain if the absolute build directory name contains unusual characters\nm4_defun([_LT_CHECK_BUILDDIR],\n[case `pwd` in\n  *\\ * | *\\\t*)\n    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;\nesac\n])\n\n\n# LT_INIT([OPTIONS])\n# ------------------\nAC_DEFUN([LT_INIT],\n[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT\nAC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl\nAC_BEFORE([$0], [LT_LANG])dnl\nAC_BEFORE([$0], [LT_OUTPUT])dnl\nAC_BEFORE([$0], [LTDL_INIT])dnl\nm4_require([_LT_CHECK_BUILDDIR])dnl\n\ndnl Autoconf doesn't catch unexpanded LT_ macros by default:\nm4_pattern_forbid([^_?LT_[A-Z_]+$])dnl\nm4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl\ndnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4\ndnl unless we require an AC_DEFUNed macro:\nAC_REQUIRE([LTOPTIONS_VERSION])dnl\nAC_REQUIRE([LTSUGAR_VERSION])dnl\nAC_REQUIRE([LTVERSION_VERSION])dnl\nAC_REQUIRE([LTOBSOLETE_VERSION])dnl\nm4_require([_LT_PROG_LTMAIN])dnl\n\n_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])\n\ndnl Parse OPTIONS\n_LT_SET_OPTIONS([$0], [$1])\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\nAC_SUBST(LIBTOOL)dnl\n\n_LT_SETUP\n\n# Only expand once:\nm4_define([LT_INIT])\n])# LT_INIT\n\n# Old names:\nAU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])\nAU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PROG_LIBTOOL], [])\ndnl AC_DEFUN([AM_PROG_LIBTOOL], [])\n\n\n# _LT_CC_BASENAME(CC)\n# -------------------\n# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.\nm4_defun([_LT_CC_BASENAME],\n[for cc_temp in $1\"\"; do\n  case $cc_temp in\n    compile | *[[\\\\/]]compile | ccache | *[[\\\\/]]ccache ) ;;\n    distcc | *[[\\\\/]]distcc | purify | *[[\\\\/]]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"$cc_temp\" | $SED \"s%.*/%%; s%^$host_alias-%%\"`\n])\n\n\n# _LT_FILEUTILS_DEFAULTS\n# ----------------------\n# It is okay to use these file commands and assume they have been set\n# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.\nm4_defun([_LT_FILEUTILS_DEFAULTS],\n[: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n])# _LT_FILEUTILS_DEFAULTS\n\n\n# _LT_SETUP\n# ---------\nm4_defun([_LT_SETUP],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl\n\n_LT_DECL([], [host_alias], [0], [The host system])dnl\n_LT_DECL([], [host], [0])dnl\n_LT_DECL([], [host_os], [0])dnl\ndnl\n_LT_DECL([], [build_alias], [0], [The build system])dnl\n_LT_DECL([], [build], [0])dnl\n_LT_DECL([], [build_os], [0])dnl\ndnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\ndnl\nAC_REQUIRE([AC_PROG_LN_S])dnl\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl\ndnl\nAC_REQUIRE([LT_CMD_MAX_LEN])dnl\n_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally \"o\")])dnl\n_LT_DECL([], [exeext], [0], [Executable file suffix (normally \"\")])dnl\ndnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nm4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl\nm4_require([_LT_CMD_RELOAD])dnl\nm4_require([_LT_CHECK_MAGIC_METHOD])dnl\nm4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl\nm4_require([_LT_CMD_OLD_ARCHIVE])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_WITH_SYSROOT])dnl\n\n_LT_CONFIG_LIBTOOL_INIT([\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n])\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n_LT_CHECK_OBJDIR\n\nm4_require([_LT_TAG_COMPILER])dnl\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\n_LT_CC_BASENAME([$compiler])\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    _LT_PATH_MAGIC\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\nLT_SUPPORTED_TAG([CC])\n_LT_LANG_C_CONFIG\n_LT_LANG_DEFAULT_CONFIG\n_LT_CONFIG_COMMANDS\n])# _LT_SETUP\n\n\n# _LT_PREPARE_SED_QUOTE_VARS\n# --------------------------\n# Define a few sed substitution that help us do robust quoting.\nm4_defun([_LT_PREPARE_SED_QUOTE_VARS],\n[# Backslashify metacharacters that are still active within\n# double-quoted strings.\nsed_quote_subst='s/\\([[\"`$\\\\]]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([[\"`\\\\]]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n])\n\n# _LT_PROG_LTMAIN\n# ---------------\n# Note that this code is called both from `configure', and `config.status'\n# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,\n# `config.status' has no value for ac_aux_dir unless we are using Automake,\n# so we pass a copy along to make sure it has a sensible value anyway.\nm4_defun([_LT_PROG_LTMAIN],\n[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl\n_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])\nltmain=\"$ac_aux_dir/ltmain.sh\"\n])# _LT_PROG_LTMAIN\n\n\n\n# So that we can recreate a full libtool script including additional\n# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS\n# in macros and then make a single call at the end using the `libtool'\n# label.\n\n\n# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])\n# ----------------------------------------\n# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL_INIT],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_INIT])\n\n\n# _LT_CONFIG_LIBTOOL([COMMANDS])\n# ------------------------------\n# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])\n\n\n# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])\n# -----------------------------------------------------\nm4_defun([_LT_CONFIG_SAVE_COMMANDS],\n[_LT_CONFIG_LIBTOOL([$1])\n_LT_CONFIG_LIBTOOL_INIT([$2])\n])\n\n\n# _LT_FORMAT_COMMENT([COMMENT])\n# -----------------------------\n# Add leading comment marks to the start of each line, and a trailing\n# full-stop to the whole comment if one is not present already.\nm4_define([_LT_FORMAT_COMMENT],\n[m4_ifval([$1], [\nm4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],\n              [['`$\\]], [\\\\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])\n)])\n\n\n\n\n\n# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])\n# -------------------------------------------------------------------\n# CONFIGNAME is the name given to the value in the libtool script.\n# VARNAME is the (base) name used in the configure script.\n# VALUE may be 0, 1 or 2 for a computed quote escaped value based on\n# VARNAME.  Any other value will be used directly.\nm4_define([_LT_DECL],\n[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],\n    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],\n\t[m4_ifval([$1], [$1], [$2])])\n    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])\n    m4_ifval([$4],\n\t[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])\n    lt_dict_add_subkey([lt_decl_dict], [$2],\n\t[tagged?], [m4_ifval([$5], [yes], [no])])])\n])\n\n\n# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])\n# --------------------------------------------------------\nm4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])\n\n\n# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_tag_varnames],\n[_lt_decl_filter([tagged?], [yes], $@)])\n\n\n# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])\n# ---------------------------------------------------------\nm4_define([_lt_decl_filter],\n[m4_case([$#],\n  [0], [m4_fatal([$0: too few arguments: $#])],\n  [1], [m4_fatal([$0: too few arguments: $#: $1])],\n  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],\n  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],\n  [lt_dict_filter([lt_decl_dict], $@)])[]dnl\n])\n\n\n# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])\n# --------------------------------------------------\nm4_define([lt_decl_quote_varnames],\n[_lt_decl_filter([value], [1], $@)])\n\n\n# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_dquote_varnames],\n[_lt_decl_filter([value], [2], $@)])\n\n\n# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_varnames_tagged],\n[m4_assert([$# <= 2])dnl\n_$0(m4_quote(m4_default([$1], [[, ]])),\n    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),\n    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])\nm4_define([_lt_decl_varnames_tagged],\n[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])\n\n\n# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_all_varnames],\n[_$0(m4_quote(m4_default([$1], [[, ]])),\n     m4_if([$2], [],\n\t   m4_quote(lt_decl_varnames),\n\tm4_quote(m4_shift($@))))[]dnl\n])\nm4_define([_lt_decl_all_varnames],\n[lt_join($@, lt_decl_varnames_tagged([$1],\n\t\t\tlt_decl_tag_varnames([[, ]], m4_shift($@))))dnl\n])\n\n\n# _LT_CONFIG_STATUS_DECLARE([VARNAME])\n# ------------------------------------\n# Quote a variable value, and forward it to `config.status' so that its\n# declaration there will have the same value as in `configure'.  VARNAME\n# must have a single quote delimited value for this to work.\nm4_define([_LT_CONFIG_STATUS_DECLARE],\n[$1='`$ECHO \"$][$1\" | $SED \"$delay_single_quote_subst\"`'])\n\n\n# _LT_CONFIG_STATUS_DECLARATIONS\n# ------------------------------\n# We delimit libtool config variables with single quotes, so when\n# we write them to config.status, we have to be sure to quote all\n# embedded single quotes properly.  In configure, this macro expands\n# each variable declared with _LT_DECL (and _LT_TAGDECL) into:\n#\n#    <var>='`$ECHO \"$<var>\" | $SED \"$delay_single_quote_subst\"`'\nm4_defun([_LT_CONFIG_STATUS_DECLARATIONS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),\n    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAGS\n# ----------------\n# Output comment and list of tags supported by the script\nm4_defun([_LT_LIBTOOL_TAGS],\n[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl\navailable_tags=\"_LT_TAGS\"dnl\n])\n\n\n# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])\n# -----------------------------------\n# Extract the dictionary values for VARNAME (optionally with TAG) and\n# expand to a commented shell variable setting:\n#\n#    # Some comment about what VAR is for.\n#    visible_name=$lt_internal_name\nm4_define([_LT_LIBTOOL_DECLARE],\n[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],\n\t\t\t\t\t   [description])))[]dnl\nm4_pushdef([_libtool_name],\n    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl\nm4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),\n    [0], [_libtool_name=[$]$1],\n    [1], [_libtool_name=$lt_[]$1],\n    [2], [_libtool_name=$lt_[]$1],\n    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl\nm4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl\n])\n\n\n# _LT_LIBTOOL_CONFIG_VARS\n# -----------------------\n# Produce commented declarations of non-tagged libtool config variables\n# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'\n# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG\n# section) are produced by _LT_LIBTOOL_TAG_VARS.\nm4_defun([_LT_LIBTOOL_CONFIG_VARS],\n[m4_foreach([_lt_var],\n    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAG_VARS(TAG)\n# -------------------------\nm4_define([_LT_LIBTOOL_TAG_VARS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])\n\n\n# _LT_TAGVAR(VARNAME, [TAGNAME])\n# ------------------------------\nm4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])\n\n\n# _LT_CONFIG_COMMANDS\n# -------------------\n# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of\n# variables for single and double quote escaping we saved from calls\n# to _LT_DECL, we can put quote escaped variables declarations\n# into `config.status', and then the shell code to quote escape them in\n# for loops in `config.status'.  Finally, any additional code accumulated\n# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.\nm4_defun([_LT_CONFIG_COMMANDS],\n[AC_PROVIDE_IFELSE([LT_OUTPUT],\n\tdnl If the libtool generation code has been placed in $CONFIG_LT,\n\tdnl instead of duplicating it all over again into config.status,\n\tdnl then we will have config.status run $CONFIG_LT later, so it\n\tdnl needs to know what name is stored there:\n        [AC_CONFIG_COMMANDS([libtool],\n            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],\n    dnl If the libtool generation code is destined for config.status,\n    dnl expand the accumulated commands and init code now:\n    [AC_CONFIG_COMMANDS([libtool],\n        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])\n])#_LT_CONFIG_COMMANDS\n\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],\n[\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\n_LT_CONFIG_STATUS_DECLARATIONS\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$[]1\n_LTECHO_EOF'\n}\n\n# Quote evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_quote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_dquote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n_LT_OUTPUT_LIBTOOL_INIT\n])\n\n# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])\n# ------------------------------------\n# Generate a child script FILE with all initialization necessary to\n# reuse the environment learned by the parent script, and make the\n# file executable.  If COMMENT is supplied, it is inserted after the\n# `#!' sequence but before initialization text begins.  After this\n# macro, additional text can be appended to FILE to form the body of\n# the child script.  The macro ends with non-zero status if the\n# file could not be fully written (such as if the disk is full).\nm4_ifdef([AS_INIT_GENERATED],\n[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],\n[m4_defun([_LT_GENERATED_FILE_INIT],\n[m4_require([AS_PREPARE])]dnl\n[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl\n[lt_write_fail=0\ncat >$1 <<_ASEOF || lt_write_fail=1\n#! $SHELL\n# Generated by $as_me.\n$2\nSHELL=\\${CONFIG_SHELL-$SHELL}\nexport SHELL\n_ASEOF\ncat >>$1 <<\\_ASEOF || lt_write_fail=1\nAS_SHELL_SANITIZE\n_AS_PREPARE\nexec AS_MESSAGE_FD>&1\n_ASEOF\ntest $lt_write_fail = 0 && chmod +x $1[]dnl\nm4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT\n\n# LT_OUTPUT\n# ---------\n# This macro allows early generation of the libtool script (before\n# AC_OUTPUT is called), incase it is used in configure for compilation\n# tests.\nAC_DEFUN([LT_OUTPUT],\n[: ${CONFIG_LT=./config.lt}\nAC_MSG_NOTICE([creating $CONFIG_LT])\n_LT_GENERATED_FILE_INIT([\"$CONFIG_LT\"],\n[# Run this file to recreate a libtool stub with the current configuration.])\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nlt_cl_silent=false\nexec AS_MESSAGE_LOG_FD>>config.log\n{\n  echo\n  AS_BOX([Running $as_me.])\n} >&AS_MESSAGE_LOG_FD\n\nlt_cl_help=\"\\\n\\`$as_me' creates a local libtool stub from the current configuration,\nfor use in further configure time tests before the real libtool is\ngenerated.\n\nUsage: $[0] [[OPTIONS]]\n\n  -h, --help      print this help, then exit\n  -V, --version   print version number, then exit\n  -q, --quiet     do not print progress messages\n  -d, --debug     don't remove temporary files\n\nReport bugs to <bug-libtool@gnu.org>.\"\n\nlt_cl_version=\"\\\nm4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl\nm4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])\nconfigured by $[0], generated by m4_PACKAGE_STRING.\n\nCopyright (C) 2010 Free Software Foundation, Inc.\nThis config.lt script is free software; the Free Software Foundation\ngives unlimited permision to copy, distribute and modify it.\"\n\nwhile test $[#] != 0\ndo\n  case $[1] in\n    --version | --v* | -V )\n      echo \"$lt_cl_version\"; exit 0 ;;\n    --help | --h* | -h )\n      echo \"$lt_cl_help\"; exit 0 ;;\n    --debug | --d* | -d )\n      debug=: ;;\n    --quiet | --q* | --silent | --s* | -q )\n      lt_cl_silent=: ;;\n\n    -*) AC_MSG_ERROR([unrecognized option: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n\n    *) AC_MSG_ERROR([unrecognized argument: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n  esac\n  shift\ndone\n\nif $lt_cl_silent; then\n  exec AS_MESSAGE_FD>/dev/null\nfi\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<_LTEOF\n_LT_OUTPUT_LIBTOOL_COMMANDS_INIT\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nAC_MSG_NOTICE([creating $ofile])\n_LT_OUTPUT_LIBTOOL_COMMANDS\nAS_EXIT(0)\n_LTEOF\nchmod +x \"$CONFIG_LT\"\n\n# configure is writing to config.log, but config.lt does its own redirection,\n# appending to config.log, which fails on DOS, as config.log is still kept\n# open by configure.  Here we exec the FD to /dev/null, effectively closing\n# config.log, so it can be properly (re)opened and appended to by config.lt.\nlt_cl_success=:\ntest \"$silent\" = yes &&\n  lt_config_lt_args=\"$lt_config_lt_args --quiet\"\nexec AS_MESSAGE_LOG_FD>/dev/null\n$SHELL \"$CONFIG_LT\" $lt_config_lt_args || lt_cl_success=false\nexec AS_MESSAGE_LOG_FD>>config.log\n$lt_cl_success || AS_EXIT(1)\n])# LT_OUTPUT\n\n\n# _LT_CONFIG(TAG)\n# ---------------\n# If TAG is the built-in tag, create an initial libtool script with a\n# default configuration from the untagged config vars.  Otherwise add code\n# to config.status for appending the configuration named by TAG from the\n# matching tagged config vars.\nm4_defun([_LT_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_CONFIG_SAVE_COMMANDS([\n  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl\n  m4_if(_LT_TAG, [C], [\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n_LT_COPYING\n_LT_LIBTOOL_TAGS\n\n# ### BEGIN LIBTOOL CONFIG\n_LT_LIBTOOL_CONFIG_VARS\n_LT_LIBTOOL_TAG_VARS\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n  _LT_PROG_LTMAIN\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '$q' \"$ltmain\" >> \"$cfgfile\" \\\n     || (rm -f \"$cfgfile\"; exit 1)\n\n  _LT_PROG_REPLACE_SHELLFNS\n\n   mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n],\n[cat <<_LT_EOF >> \"$ofile\"\n\ndnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded\ndnl in a comment (ie after a #).\n# ### BEGIN LIBTOOL TAG CONFIG: $1\n_LT_LIBTOOL_TAG_VARS(_LT_TAG)\n# ### END LIBTOOL TAG CONFIG: $1\n_LT_EOF\n])dnl /m4_if\n],\n[m4_if([$1], [], [\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'], [])\n])dnl /_LT_CONFIG_SAVE_COMMANDS\n])# _LT_CONFIG\n\n\n# LT_SUPPORTED_TAG(TAG)\n# ---------------------\n# Trace this macro to discover what tags are supported by the libtool\n# --tag option, using:\n#    autoconf --trace 'LT_SUPPORTED_TAG:$1'\nAC_DEFUN([LT_SUPPORTED_TAG], [])\n\n\n# C support is built-in for now\nm4_define([_LT_LANG_C_enabled], [])\nm4_define([_LT_TAGS], [])\n\n\n# LT_LANG(LANG)\n# -------------\n# Enable libtool support for the given language if not already enabled.\nAC_DEFUN([LT_LANG],\n[AC_BEFORE([$0], [LT_OUTPUT])dnl\nm4_case([$1],\n  [C],\t\t\t[_LT_LANG(C)],\n  [C++],\t\t[_LT_LANG(CXX)],\n  [Java],\t\t[_LT_LANG(GCJ)],\n  [Fortran 77],\t\t[_LT_LANG(F77)],\n  [Fortran],\t\t[_LT_LANG(FC)],\n  [Windows Resource],\t[_LT_LANG(RC)],\n  [m4_ifdef([_LT_LANG_]$1[_CONFIG],\n    [_LT_LANG($1)],\n    [m4_fatal([$0: unsupported language: \"$1\"])])])dnl\n])# LT_LANG\n\n\n# _LT_LANG(LANGNAME)\n# ------------------\nm4_defun([_LT_LANG],\n[m4_ifdef([_LT_LANG_]$1[_enabled], [],\n  [LT_SUPPORTED_TAG([$1])dnl\n  m4_append([_LT_TAGS], [$1 ])dnl\n  m4_define([_LT_LANG_]$1[_enabled], [])dnl\n  _LT_LANG_$1_CONFIG($1)])dnl\n])# _LT_LANG\n\n\n# _LT_LANG_DEFAULT_CONFIG\n# -----------------------\nm4_defun([_LT_LANG_DEFAULT_CONFIG],\n[AC_PROVIDE_IFELSE([AC_PROG_CXX],\n  [LT_LANG(CXX)],\n  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_F77],\n  [LT_LANG(F77)],\n  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_FC],\n  [LT_LANG(FC)],\n  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])\n\ndnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal\ndnl pulling things in needlessly.\nAC_PROVIDE_IFELSE([AC_PROG_GCJ],\n  [LT_LANG(GCJ)],\n  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],\n    [LT_LANG(GCJ)],\n    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],\n      [LT_LANG(GCJ)],\n      [m4_ifdef([AC_PROG_GCJ],\n\t[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([A][M_PROG_GCJ],\n\t[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([LT_PROG_GCJ],\n\t[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])\n\nAC_PROVIDE_IFELSE([LT_PROG_RC],\n  [LT_LANG(RC)],\n  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])\n])# _LT_LANG_DEFAULT_CONFIG\n\n# Obsolete macros:\nAU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])\nAU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])\nAU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])\nAU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])\nAU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_CXX], [])\ndnl AC_DEFUN([AC_LIBTOOL_F77], [])\ndnl AC_DEFUN([AC_LIBTOOL_FC], [])\ndnl AC_DEFUN([AC_LIBTOOL_GCJ], [])\ndnl AC_DEFUN([AC_LIBTOOL_RC], [])\n\n\n# _LT_TAG_COMPILER\n# ----------------\nm4_defun([_LT_TAG_COMPILER],\n[AC_REQUIRE([AC_PROG_CC])dnl\n\n_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl\n_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl\n_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl\n_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n])# _LT_TAG_COMPILER\n\n\n# _LT_COMPILER_BOILERPLATE\n# ------------------------\n# Check for compiler boilerplate output or warnings with\n# the simple compiler test code.\nm4_defun([_LT_COMPILER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n])# _LT_COMPILER_BOILERPLATE\n\n\n# _LT_LINKER_BOILERPLATE\n# ----------------------\n# Check for linker boilerplate output or warnings with\n# the simple link test code.\nm4_defun([_LT_LINKER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n])# _LT_LINKER_BOILERPLATE\n\n# _LT_REQUIRED_DARWIN_CHECKS\n# -------------------------\nm4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[\n  case $host_os in\n    rhapsody* | darwin*)\n    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])\n    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])\n    AC_CHECK_TOOL([LIPO], [lipo], [:])\n    AC_CHECK_TOOL([OTOOL], [otool], [:])\n    AC_CHECK_TOOL([OTOOL64], [otool64], [:])\n    _LT_DECL([], [DSYMUTIL], [1],\n      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])\n    _LT_DECL([], [NMEDIT], [1],\n      [Tool to change global to local symbols on Mac OS X])\n    _LT_DECL([], [LIPO], [1],\n      [Tool to manipulate fat objects and archives on Mac OS X])\n    _LT_DECL([], [OTOOL], [1],\n      [ldd/readelf like tool for Mach-O binaries on Mac OS X])\n    _LT_DECL([], [OTOOL64], [1],\n      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])\n\n    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],\n      [lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&AS_MESSAGE_LOG_FD\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\tif test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&AS_MESSAGE_LOG_FD\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi])\n    AC_CACHE_CHECK([for -exported_symbols_list linker flag],\n      [lt_cv_ld_exported_symbols_list],\n      [lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n\t[lt_cv_ld_exported_symbols_list=yes],\n\t[lt_cv_ld_exported_symbols_list=no])\n\tLDFLAGS=\"$save_LDFLAGS\"\n    ])\n    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],\n      [lt_cv_ld_force_load=no\n      cat > conftest.c << _LT_EOF\nint forced_loaded() { return 2;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS -c -o conftest.o conftest.c\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD\n      echo \"$AR cru libconftest.a conftest.o\" >&AS_MESSAGE_LOG_FD\n      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD\n      echo \"$RANLIB libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD\n      cat > conftest.c << _LT_EOF\nint main() { return 0;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err\n      _lt_result=$?\n      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then\n\tlt_cv_ld_force_load=yes\n      else\n\tcat conftest.err >&AS_MESSAGE_LOG_FD\n      fi\n        rm -f conftest.err libconftest.a conftest conftest.c\n        rm -rf conftest.dSYM\n    ])\n    case $host_os in\n    rhapsody* | darwin1.[[012]])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[[012]]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\" && test \"$lt_cv_ld_force_load\" = \"no\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n])\n\n\n# _LT_DARWIN_LINKER_FEATURES\n# --------------------------\n# Checks for linker and compiler features on darwin\nm4_defun([_LT_DARWIN_LINKER_FEATURES],\n[\n  m4_require([_LT_REQUIRED_DARWIN_CHECKS])\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_automatic, $1)=yes\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  if test \"$lt_cv_ld_force_load\" = \"yes\"; then\n    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience ${wl}-force_load,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"`'\n  else\n    _LT_TAGVAR(whole_archive_flag_spec, $1)=''\n  fi\n  _LT_TAGVAR(link_all_deplibs, $1)=yes\n  _LT_TAGVAR(allow_undefined_flag, $1)=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=func_echo_all\n    _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    _LT_TAGVAR(module_cmds, $1)=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    _LT_TAGVAR(module_expsym_cmds, $1)=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n    m4_if([$1], [CXX],\n[   if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n],[])\n  else\n  _LT_TAGVAR(ld_shlibs, $1)=no\n  fi\n])\n\n# _LT_SYS_MODULE_PATH_AIX([TAGNAME])\n# ----------------------------------\n# Links a minimal program and checks the executable\n# for the system default hardcoded library path. In most cases,\n# this is /usr/lib:/lib, but when the MPI compilers are used\n# the location of the communication and MPI libs are included too.\n# If we don't find anything, use the default library path according\n# to the aix ld manual.\n# Store the results from the different compilers for each TAGNAME.\n# Allow to override them for all tags through lt_cv_aix_libpath.\nm4_defun([_LT_SYS_MODULE_PATH_AIX],\n[m4_require([_LT_DECL_SED])dnl\nif test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],\n  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[\n  lt_aix_libpath_sed='[\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }]'\n  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi],[])\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=\"/usr/lib:/lib\"\n  fi\n  ])\n  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\nfi\n])# _LT_SYS_MODULE_PATH_AIX\n\n\n# _LT_SHELL_INIT(ARG)\n# -------------------\nm4_define([_LT_SHELL_INIT],\n[m4_divert_text([M4SH-INIT], [$1\n])])# _LT_SHELL_INIT\n\n\n\n# _LT_PROG_ECHO_BACKSLASH\n# -----------------------\n# Find how we can fake an echo command that does not interpret backslash.\n# In particular, with Autoconf 2.60 or later we add some code to the start\n# of the generated configure script which will find a shell with a builtin\n# printf (which we can use as an echo command).\nm4_defun([_LT_PROG_ECHO_BACKSLASH],\n[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n\nAC_MSG_CHECKING([how to print strings])\n# Test print first, because it will be a builtin if present.\nif test \"X`( print -r -- -n ) 2>/dev/null`\" = X-n && \\\n   test \"X`print -r -- $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='print -r --'\nelif test \"X`printf %s $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='printf %s\\n'\nelse\n  # Use this function as a fallback that always works.\n  func_fallback_echo ()\n  {\n    eval 'cat <<_LTECHO_EOF\n$[]1\n_LTECHO_EOF'\n  }\n  ECHO='func_fallback_echo'\nfi\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"$*\" \n}\n\ncase \"$ECHO\" in\n  printf*) AC_MSG_RESULT([printf]) ;;\n  print*) AC_MSG_RESULT([print -r]) ;;\n  *) AC_MSG_RESULT([cat]) ;;\nesac\n\nm4_ifdef([_AS_DETECT_SUGGESTED],\n[_AS_DETECT_SUGGESTED([\n  test -n \"${ZSH_VERSION+set}${BASH_VERSION+set}\" || (\n    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n    PATH=/empty FPATH=/empty; export PATH FPATH\n    test \"X`printf %s $ECHO`\" = \"X$ECHO\" \\\n      || test \"X`print -r -- $ECHO`\" = \"X$ECHO\" )])])\n\n_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])\n_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])\n])# _LT_PROG_ECHO_BACKSLASH\n\n\n# _LT_WITH_SYSROOT\n# ----------------\nAC_DEFUN([_LT_WITH_SYSROOT],\n[AC_MSG_CHECKING([for sysroot])\nAC_ARG_WITH([sysroot],\n[  --with-sysroot[=DIR] Search for dependent libraries within DIR\n                        (or the compiler's sysroot if not specified).],\n[], [with_sysroot=no])\n\ndnl lt_sysroot will always be passed unquoted.  We quote it here\ndnl in case the user passed a directory name.\nlt_sysroot=\ncase ${with_sysroot} in #(\n yes)\n   if test \"$GCC\" = yes; then\n     lt_sysroot=`$CC --print-sysroot 2>/dev/null`\n   fi\n   ;; #(\n /*)\n   lt_sysroot=`echo \"$with_sysroot\" | sed -e \"$sed_quote_subst\"`\n   ;; #(\n no|'')\n   ;; #(\n *)\n   AC_MSG_RESULT([${with_sysroot}])\n   AC_MSG_ERROR([The sysroot must be an absolute path.])\n   ;;\nesac\n\n AC_MSG_RESULT([${lt_sysroot:-no}])\n_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl\n[dependent libraries, and in which our libraries should be installed.])])\n\n# _LT_ENABLE_LOCK\n# ---------------\nm4_defun([_LT_ENABLE_LOCK],\n[AC_ARG_ENABLE([libtool-lock],\n  [AS_HELP_STRING([--disable-libtool-lock],\n    [avoid locking (might break parallel builds)])])\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '[#]line '$LINENO' \"configure\"' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,\n    [AC_LANG_PUSH(C)\n     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])\n     AC_LANG_POP])\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\nsparc*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*) LD=\"${LD-ld} -m elf64_sparc\" ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n])# _LT_ENABLE_LOCK\n\n\n# _LT_PROG_AR\n# -----------\nm4_defun([_LT_PROG_AR],\n[AC_CHECK_TOOLS(AR, [ar], false)\n: ${AR=ar}\n: ${AR_FLAGS=cru}\n_LT_DECL([], [AR], [1], [The archiver])\n_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])\n\nAC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],\n  [lt_cv_ar_at_file=no\n   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],\n     [echo conftest.$ac_objext > conftest.lst\n      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'\n      AC_TRY_EVAL([lt_ar_try])\n      if test \"$ac_status\" -eq 0; then\n\t# Ensure the archiver fails upon bogus file names.\n\trm -f conftest.$ac_objext libconftest.a\n\tAC_TRY_EVAL([lt_ar_try])\n\tif test \"$ac_status\" -ne 0; then\n          lt_cv_ar_at_file=@\n        fi\n      fi\n      rm -f conftest.* libconftest.a\n     ])\n  ])\n\nif test \"x$lt_cv_ar_at_file\" = xno; then\n  archiver_list_spec=\nelse\n  archiver_list_spec=$lt_cv_ar_at_file\nfi\n_LT_DECL([], [archiver_list_spec], [1],\n  [How to feed a file listing to the archiver])\n])# _LT_PROG_AR\n\n\n# _LT_CMD_OLD_ARCHIVE\n# -------------------\nm4_defun([_LT_CMD_OLD_ARCHIVE],\n[_LT_PROG_AR\n\nAC_CHECK_TOOL(STRIP, strip, :)\ntest -z \"$STRIP\" && STRIP=:\n_LT_DECL([], [STRIP], [1], [A symbol stripping program])\n\nAC_CHECK_TOOL(RANLIB, ranlib, :)\ntest -z \"$RANLIB\" && RANLIB=:\n_LT_DECL([], [RANLIB], [1],\n    [Commands used to install an old-style archive])\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$oldlib\"\nfi\n\ncase $host_os in\n  darwin*)\n    lock_old_archive_extraction=yes ;;\n  *)\n    lock_old_archive_extraction=no ;;\nesac\n_LT_DECL([], [old_postinstall_cmds], [2])\n_LT_DECL([], [old_postuninstall_cmds], [2])\n_LT_TAGDECL([], [old_archive_cmds], [2],\n    [Commands used to build an old-style archive])\n_LT_DECL([], [lock_old_archive_extraction], [0],\n    [Whether to use a lock for old archive extraction])\n])# _LT_CMD_OLD_ARCHIVE\n\n\n# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#\t\t[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------------------\n# Check whether the given compiler option works\nAC_DEFUN([_LT_COMPILER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$3\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       $2=yes\n     fi\n   fi\n   $RM conftest*\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$5], , :, [$5])\nelse\n    m4_if([$6], , :, [$6])\nfi\n])# _LT_COMPILER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])\n\n\n# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#                  [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------\n# Check whether the given linker option works\nAC_DEFUN([_LT_LINKER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $3\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&AS_MESSAGE_LOG_FD\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         $2=yes\n       fi\n     else\n       $2=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$4], , :, [$4])\nelse\n    m4_if([$5], , :, [$5])\nfi\n])# _LT_LINKER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])\n\n\n# LT_CMD_MAX_LEN\n#---------------\nAC_DEFUN([LT_CMD_MAX_LEN],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n# find the maximum length of command line arguments\nAC_MSG_CHECKING([the maximum length of command line arguments])\nAC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl\n  i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  mint*)\n    # On MiNT this can take a long time and run out of memory.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[\t ]]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`func_fallback_echo \"$teststring$teststring\" 2>/dev/null` \\\n\t         = \"X$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n])\nif test -n $lt_cv_sys_max_cmd_len ; then\n  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)\nelse\n  AC_MSG_RESULT(none)\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n_LT_DECL([], [max_cmd_len], [0],\n    [What is the maximum length of a command?])\n])# LT_CMD_MAX_LEN\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])\n\n\n# _LT_HEADER_DLFCN\n# ----------------\nm4_defun([_LT_HEADER_DLFCN],\n[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl\n])# _LT_HEADER_DLFCN\n\n\n# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,\n#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)\n# ----------------------------------------------------------------\nm4_defun([_LT_TRY_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"$cross_compiling\" = yes; then :\n  [$4]\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n[#line $LINENO \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* When -fvisbility=hidden is used, assume the code has been annotated\n   correspondingly for the symbols needed.  */\n#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))\nint fnord () __attribute__((visibility(\"default\")));\n#endif\n\nint fnord () { return 42; }\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else\n        {\n\t  if (dlsym( self,\"_fnord\"))  status = $lt_dlneed_uscore;\n          else puts (dlerror ());\n\t}\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}]\n_LT_EOF\n  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) $1 ;;\n      x$lt_dlneed_uscore) $2 ;;\n      x$lt_dlunknown|x*) $3 ;;\n    esac\n  else :\n    # compilation failed\n    $3\n  fi\nfi\nrm -fr conftest*\n])# _LT_TRY_DLOPEN_SELF\n\n\n# LT_SYS_DLOPEN_SELF\n# ------------------\nAC_DEFUN([LT_SYS_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],[\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ])\n    ;;\n\n  *)\n    AC_CHECK_FUNC([shl_load],\n\t  [lt_cv_dlopen=\"shl_load\"],\n      [AC_CHECK_LIB([dld], [shl_load],\n\t    [lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"],\n\t[AC_CHECK_FUNC([dlopen],\n\t      [lt_cv_dlopen=\"dlopen\"],\n\t  [AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],\n\t    [AC_CHECK_LIB([svld], [dlopen],\n\t\t  [lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"],\n\t      [AC_CHECK_LIB([dld], [dld_link],\n\t\t    [lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"])\n\t      ])\n\t    ])\n\t  ])\n\t])\n      ])\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    AC_CACHE_CHECK([whether a program can dlopen itself],\n\t  lt_cv_dlopen_self, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,\n\t    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)\n    ])\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],\n\t  lt_cv_dlopen_self_static, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,\n\t    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)\n      ])\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n_LT_DECL([dlopen_support], [enable_dlopen], [0],\n\t [Whether dlopen is supported])\n_LT_DECL([dlopen_self], [enable_dlopen_self], [0],\n\t [Whether dlopen of programs is supported])\n_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],\n\t [Whether dlopen of statically linked programs is supported])\n])# LT_SYS_DLOPEN_SELF\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])\n\n\n# _LT_COMPILER_C_O([TAGNAME])\n# ---------------------------\n# Check to see if options -c and -o are simultaneously supported by compiler.\n# This macro does not hard code the compiler like AC_PROG_CC_C_O.\nm4_defun([_LT_COMPILER_C_O],\n[m4_require([_LT_DECL_SED])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n     fi\n   fi\n   chmod u+w . 2>&AS_MESSAGE_LOG_FD\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n])\n_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],\n\t[Does compiler simultaneously support -c and -o options?])\n])# _LT_COMPILER_C_O\n\n\n# _LT_COMPILER_FILE_LOCKS([TAGNAME])\n# ----------------------------------\n# Check to see if we can do hard links to lock some files if needed\nm4_defun([_LT_COMPILER_FILE_LOCKS],\n[m4_require([_LT_ENABLE_LOCK])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_COMPILER_C_O([$1])\n\nhard_links=\"nottested\"\nif test \"$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  AC_MSG_CHECKING([if we can lock with hard links])\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  AC_MSG_RESULT([$hard_links])\n  if test \"$hard_links\" = no; then\n    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])\n])# _LT_COMPILER_FILE_LOCKS\n\n\n# _LT_CHECK_OBJDIR\n# ----------------\nm4_defun([_LT_CHECK_OBJDIR],\n[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],\n[rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null])\nobjdir=$lt_cv_objdir\n_LT_DECL([], [objdir], [0],\n         [The name of the directory that contains temporary libtool files])dnl\nm4_pattern_allow([LT_OBJDIR])dnl\nAC_DEFINE_UNQUOTED(LT_OBJDIR, \"$lt_cv_objdir/\",\n  [Define to the sub-directory in which libtool stores uninstalled libraries.])\n])# _LT_CHECK_OBJDIR\n\n\n# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])\n# --------------------------------------\n# Check hardcoding attributes.\nm4_defun([_LT_LINKER_HARDCODE_LIBPATH],\n[AC_MSG_CHECKING([how to hardcode library paths into programs])\n_LT_TAGVAR(hardcode_action, $1)=\nif test -n \"$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\" ||\n   test -n \"$_LT_TAGVAR(runpath_var, $1)\" ||\n   test \"X$_LT_TAGVAR(hardcode_automatic, $1)\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$_LT_TAGVAR(hardcode_direct, $1)\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, $1)\" != no &&\n     test \"$_LT_TAGVAR(hardcode_minus_L, $1)\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    _LT_TAGVAR(hardcode_action, $1)=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    _LT_TAGVAR(hardcode_action, $1)=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  _LT_TAGVAR(hardcode_action, $1)=unsupported\nfi\nAC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])\n\nif test \"$_LT_TAGVAR(hardcode_action, $1)\" = relink ||\n   test \"$_LT_TAGVAR(inherit_rpath, $1)\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n_LT_TAGDECL([], [hardcode_action], [0],\n    [How to hardcode a shared library path into an executable])\n])# _LT_LINKER_HARDCODE_LIBPATH\n\n\n# _LT_CMD_STRIPLIB\n# ----------------\nm4_defun([_LT_CMD_STRIPLIB],\n[m4_require([_LT_DECL_EGREP])\nstriplib=\nold_striplib=\nAC_MSG_CHECKING([whether stripping libraries is possible])\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  AC_MSG_RESULT([yes])\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      AC_MSG_RESULT([yes])\n    else\n      AC_MSG_RESULT([no])\n    fi\n    ;;\n  *)\n    AC_MSG_RESULT([no])\n    ;;\n  esac\nfi\n_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])\n_LT_DECL([], [striplib], [1])\n])# _LT_CMD_STRIPLIB\n\n\n# _LT_SYS_DYNAMIC_LINKER([TAG])\n# -----------------------------\n# PORTME Fill in your ld.so characteristics\nm4_defun([_LT_SYS_DYNAMIC_LINKER],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_OBJDUMP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nAC_MSG_CHECKING([dynamic linker characteristics])\nm4_if([$1],\n\t[], [\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  case $host_os in\n    mingw* | cegcc*) lt_sed_strip_eq=\"s,=\\([[A-Za-z]]:\\),\\1,g\" ;;\n    *) lt_sed_strip_eq=\"s,=/,/,g\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e $lt_sed_strip_eq`\n  case $lt_search_path_spec in\n  *\\;*)\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED 's/;/ /g'`\n    ;;\n  *)\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED \"s/$PATH_SEPARATOR/ /g\"`\n    ;;\n  esac\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO \"$lt_tmp_lt_search_path_spec\" | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[[lt_foo]]++; }\n  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }\n}'`\n  # AWK program above erroneously prepends '/' to C:/dos/paths\n  # for these hosts.\n  case $host_os in\n    mingw* | cegcc*) lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" |\\\n      $SED 's,/\\([[A-Za-z]]:\\),\\1,g'` ;;\n  esac\n  sys_lib_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $lt_NL2SP`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi])\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[[4-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[[01]] | aix4.[[01]].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all \"$lib\" | $SED '\\''s%^.*/\\([[^/]]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[[45]]*)\n  version_type=linux\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$cc_basename in\n  yes,*)\n    # gcc\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\nm4_if([$1], [],[\n      sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/lib/w32api\"])\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    dynamic_linker='Win32 ld.exe'\n    ;;\n\n  *,cl*)\n    # Native MSVC\n    libname_spec='$name'\n    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n    library_names_spec='${libname}.dll.lib'\n\n    case $build_os in\n    mingw*)\n      sys_lib_search_path_spec=\n      lt_save_ifs=$IFS\n      IFS=';'\n      for lt_path in $LIB\n      do\n        IFS=$lt_save_ifs\n        # Let DOS variable expansion print the short 8.3 style file name.\n        lt_path=`cd \"$lt_path\" 2>/dev/null && cmd //C \"for %i in (\".\") do @echo %~si\"`\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec $lt_path\"\n      done\n      IFS=$lt_save_ifs\n      # Convert to MSYS style.\n      sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | sed -e 's|\\\\\\\\|/|g' -e 's| \\\\([[a-zA-Z]]\\\\):| /\\\\1|g' -e 's|^ ||'`\n      ;;\n    cygwin*)\n      # Convert to unix form, then to dos form, then back to unix form\n      # but this time dos style (no spaces!) so that the unix form looks\n      # like /cygdrive/c/PROGRA~1:/cygdr...\n      sys_lib_search_path_spec=`cygpath --path --unix \"$LIB\"`\n      sys_lib_search_path_spec=`cygpath --path --dos \"$sys_lib_search_path_spec\" 2>/dev/null`\n      sys_lib_search_path_spec=`cygpath --path --unix \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      ;;\n    *)\n      sys_lib_search_path_spec=\"$LIB\"\n      if $ECHO \"$sys_lib_search_path_spec\" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then\n        # It is most probably a Windows format PATH.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      # FIXME: find the short name or the path components, as spaces are\n      # common. (e.g. \"Program Files\" -> \"PROGRA~1\")\n      ;;\n    esac\n\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n    dynamic_linker='Win32 link.exe'\n    ;;\n\n  *)\n    # Assume MSVC wrapper\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    dynamic_linker='Win32 ld.exe'\n    ;;\n  esac\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\nm4_if([$1], [],[\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"])\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd1*)\n  dynamic_linker=no\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[[123]]*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[[01]]* | freebsdelf3.[[01]]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \\\n  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nhaiku*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  dynamic_linker=\"$host_os runtime_loader\"\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...\n  postinstall_cmds='chmod 555 $lib'\n  # or fails outright, so override atomically:\n  install_override_mode=555\n  ;;\n\ninterix[[3-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n\n  # Some binutils ld are patched to set DT_RUNPATH\n  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],\n    [lt_cv_shlibpath_overrides_runpath=no\n    save_LDFLAGS=$LDFLAGS\n    save_libdir=$libdir\n    eval \"libdir=/foo; wl=\\\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\\\"; \\\n\t LDFLAGS=\\\"\\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\\\"\"\n    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null],\n\t [lt_cv_shlibpath_overrides_runpath=yes])])\n    LDFLAGS=$save_LDFLAGS\n    libdir=$save_libdir\n    ])\n  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\[$]2)); skip = 1; } { if (!skip) print \\[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/\"//g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsdelf*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='NetBSD ld.elf_so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[[89]] | openbsd2.[[89]].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\nAC_MSG_RESULT([$dynamic_linker])\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n_LT_DECL([], [variables_saved_for_relink], [1],\n    [Variables whose values should be saved in libtool wrapper scripts and\n    restored at link time])\n_LT_DECL([], [need_lib_prefix], [0],\n    [Do we need the \"lib\" prefix for modules?])\n_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])\n_LT_DECL([], [version_type], [0], [Library versioning type])\n_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])\n_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])\n_LT_DECL([], [shlibpath_overrides_runpath], [0],\n    [Is shlibpath searched before the hard-coded library search path?])\n_LT_DECL([], [libname_spec], [1], [Format of library name prefix])\n_LT_DECL([], [library_names_spec], [1],\n    [[List of archive names.  First name is the real one, the rest are links.\n    The last name is the one that the linker finds with -lNAME]])\n_LT_DECL([], [soname_spec], [1],\n    [[The coded name of the library, if different from the real name]])\n_LT_DECL([], [install_override_mode], [1],\n    [Permission mode override for installation of shared libraries])\n_LT_DECL([], [postinstall_cmds], [2],\n    [Command to use after installation of a shared archive])\n_LT_DECL([], [postuninstall_cmds], [2],\n    [Command to use after uninstallation of a shared archive])\n_LT_DECL([], [finish_cmds], [2],\n    [Commands used to finish a libtool library installation in a directory])\n_LT_DECL([], [finish_eval], [1],\n    [[As \"finish_cmds\", except a single script fragment to be evaled but\n    not shown]])\n_LT_DECL([], [hardcode_into_libs], [0],\n    [Whether we should hardcode library paths into libraries])\n_LT_DECL([], [sys_lib_search_path_spec], [2],\n    [Compile-time system search path for libraries])\n_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],\n    [Run-time system search path for libraries])\n])# _LT_SYS_DYNAMIC_LINKER\n\n\n# _LT_PATH_TOOL_PREFIX(TOOL)\n# --------------------------\n# find a file program which can recognize shared library\nAC_DEFUN([_LT_PATH_TOOL_PREFIX],\n[m4_require([_LT_DECL_EGREP])dnl\nAC_MSG_CHECKING([for $1])\nAC_CACHE_VAL(lt_cv_path_MAGIC_CMD,\n[case $MAGIC_CMD in\n[[\\\\/*] |  ?:[\\\\/]*])\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\ndnl $ac_dummy forces splitting on constant user-supplied paths.\ndnl POSIX.2 word splitting is done only on the output of word expansions,\ndnl not every word.  This closes a longstanding sh security hole.\n  ac_dummy=\"m4_if([$2], , $PATH, [$2])\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/$1; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/$1\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac])\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  AC_MSG_RESULT($MAGIC_CMD)\nelse\n  AC_MSG_RESULT(no)\nfi\n_LT_DECL([], [MAGIC_CMD], [0],\n\t [Used to examine libraries when file_magic_cmd begins with \"file\"])dnl\n])# _LT_PATH_TOOL_PREFIX\n\n# Old name:\nAU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])\n\n\n# _LT_PATH_MAGIC\n# --------------\n# find a file program which can recognize a shared library\nm4_defun([_LT_PATH_MAGIC],\n[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)\n  else\n    MAGIC_CMD=:\n  fi\nfi\n])# _LT_PATH_MAGIC\n\n\n# LT_PATH_LD\n# ----------\n# find the pathname to the GNU or non-GNU linker\nAC_DEFUN([LT_PATH_LD],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PROG_ECHO_BACKSLASH])dnl\n\nAC_ARG_WITH([gnu-ld],\n    [AS_HELP_STRING([--with-gnu-ld],\n\t[assume the C compiler uses GNU ld @<:@default=no@:>@])],\n    [test \"$withval\" = no || with_gnu_ld=yes],\n    [with_gnu_ld=no])dnl\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  AC_MSG_CHECKING([for ld used by $CC])\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [[\\\\/]]* | ?:[[\\\\/]]*)\n      re_direlt='/[[^/]][[^/]]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  AC_MSG_CHECKING([for GNU ld])\nelse\n  AC_MSG_CHECKING([for non-GNU ld])\nfi\nAC_CACHE_VAL(lt_cv_path_LD,\n[if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi])\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  AC_MSG_RESULT($LD)\nelse\n  AC_MSG_RESULT(no)\nfi\ntest -z \"$LD\" && AC_MSG_ERROR([no acceptable ld found in \\$PATH])\n_LT_PATH_LD_GNU\nAC_SUBST([LD])\n\n_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])\n])# LT_PATH_LD\n\n# Old names:\nAU_ALIAS([AM_PROG_LD], [LT_PATH_LD])\nAU_ALIAS([AC_PROG_LD], [LT_PATH_LD])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_LD], [])\ndnl AC_DEFUN([AC_PROG_LD], [])\n\n\n# _LT_PATH_LD_GNU\n#- --------------\nm4_defun([_LT_PATH_LD_GNU],\n[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,\n[# I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac])\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n])# _LT_PATH_LD_GNU\n\n\n# _LT_CMD_RELOAD\n# --------------\n# find reload flag for linker\n#   -- PORTME Some linkers may need a different reload flag.\nm4_defun([_LT_CMD_RELOAD],\n[AC_CACHE_CHECK([for $LD option to reload object files],\n  lt_cv_ld_reload_flag,\n  [lt_cv_ld_reload_flag='-r'])\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    if test \"$GCC\" != yes; then\n      reload_cmds=false\n    fi\n    ;;\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl\n_LT_TAGDECL([], [reload_cmds], [2])dnl\n])# _LT_CMD_RELOAD\n\n\n# _LT_CHECK_MAGIC_METHOD\n# ----------------------\n# how to check for library dependencies\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_MAGIC_METHOD],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nAC_CACHE_CHECK([how to recognize dependent libraries],\nlt_cv_deplibs_check_method,\n[lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[[4-9]]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[[45]]*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.\n  if ( test \"$lt_cv_nm_interface\" = \"BSD nm\" && file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    # Keep this pattern in sync with the one in func_win32_libid.\n    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc*)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhaiku*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\\.[0-9]']\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\\.[[0-9]]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[[3-9]]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd* | netbsdelf*-gnu)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n])\n\nfile_magic_glob=\nwant_nocaseglob=no\nif test \"$build\" = \"$host\"; then\n  case $host_os in\n  mingw* | pw32*)\n    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then\n      want_nocaseglob=yes\n    else\n      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e \"s/\\(..\\)/s\\/[[\\1]]\\/[[\\1]]\\/g;/g\"`\n    fi\n    ;;\n  esac\nfi\n\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n_LT_DECL([], [deplibs_check_method], [1],\n    [Method to check whether dependent libraries are shared objects])\n_LT_DECL([], [file_magic_cmd], [1],\n    [Command to use when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [file_magic_glob], [1],\n    [How to find potential files when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [want_nocaseglob], [1],\n    [Find potential files using nocaseglob when deplibs_check_method = \"file_magic\"])\n])# _LT_CHECK_MAGIC_METHOD\n\n\n# LT_PATH_NM\n# ----------\n# find the pathname to a BSD- or MS-compatible name lister\nAC_DEFUN([LT_PATH_NM],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,\n[if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi])\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  if test -n \"$DUMPBIN\"; then :\n    # Let the user override the test.\n  else\n    AC_CHECK_TOOLS(DUMPBIN, [dumpbin \"link -dump\"], :)\n    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in\n    *COFF*)\n      DUMPBIN=\"$DUMPBIN -symbols\"\n      ;;\n    *)\n      DUMPBIN=:\n      ;;\n    esac\n  fi\n  AC_SUBST([DUMPBIN])\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\nAC_SUBST([NM])\n_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl\n\nAC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],\n  [lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:$LINENO: $ac_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: output\\\"\" >&AS_MESSAGE_LOG_FD)\n  cat conftest.out >&AS_MESSAGE_LOG_FD\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*])\n])# LT_PATH_NM\n\n# Old names:\nAU_ALIAS([AM_PROG_NM], [LT_PATH_NM])\nAU_ALIAS([AC_PROG_NM], [LT_PATH_NM])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_NM], [])\ndnl AC_DEFUN([AC_PROG_NM], [])\n\n# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n# --------------------------------\n# how to determine the name of the shared library\n# associated with a specific link library.\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nm4_require([_LT_DECL_DLLTOOL])\nAC_CACHE_CHECK([how to associate runtime and link libraries],\nlt_cv_sharedlib_from_linklib_cmd,\n[lt_cv_sharedlib_from_linklib_cmd='unknown'\n\ncase $host_os in\ncygwin* | mingw* | pw32* | cegcc*)\n  # two different shell functions defined in ltmain.sh\n  # decide which to use based on capabilities of $DLLTOOL\n  case `$DLLTOOL --help 2>&1` in\n  *--identify-strict*)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib\n    ;;\n  *)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback\n    ;;\n  esac\n  ;;\n*)\n  # fallback: assume linklib IS sharedlib\n  lt_cv_sharedlib_from_linklib_cmd=\"$ECHO\"\n  ;;\nesac\n])\nsharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd\ntest -z \"$sharedlib_from_linklib_cmd\" && sharedlib_from_linklib_cmd=$ECHO\n\n_LT_DECL([], [sharedlib_from_linklib_cmd], [1],\n    [Command to associate shared and link libraries])\n])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n\n\n# _LT_PATH_MANIFEST_TOOL\n# ----------------------\n# locate the manifest tool\nm4_defun([_LT_PATH_MANIFEST_TOOL],\n[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)\ntest -z \"$MANIFEST_TOOL\" && MANIFEST_TOOL=mt\nAC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],\n  [lt_cv_path_mainfest_tool=no\n  echo \"$as_me:$LINENO: $MANIFEST_TOOL '-?'\" >&AS_MESSAGE_LOG_FD\n  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  if $GREP 'Manifest Tool' conftest.out > /dev/null; then\n    lt_cv_path_mainfest_tool=yes\n  fi\n  rm -f conftest*])\nif test \"x$lt_cv_path_mainfest_tool\" != xyes; then\n  MANIFEST_TOOL=:\nfi\n_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl\n])# _LT_PATH_MANIFEST_TOOL\n\n\n# LT_LIB_M\n# --------\n# check for math library\nAC_DEFUN([LT_LIB_M],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nLIBM=\ncase $host in\n*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)\n  # These system don't have libm, or don't need it\n  ;;\n*-ncr-sysv4.3*)\n  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=\"-lmw\")\n  AC_CHECK_LIB(m, cos, LIBM=\"$LIBM -lm\")\n  ;;\n*)\n  AC_CHECK_LIB(m, cos, LIBM=\"-lm\")\n  ;;\nesac\nAC_SUBST([LIBM])\n])# LT_LIB_M\n\n# Old name:\nAU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_CHECK_LIBM], [])\n\n\n# _LT_COMPILER_NO_RTTI([TAGNAME])\n# -------------------------------\nm4_defun([_LT_COMPILER_NO_RTTI],\n[m4_require([_LT_TAG_COMPILER])dnl\n\n_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n\nif test \"$GCC\" = yes; then\n  case $cc_basename in\n  nvcc*)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;\n  esac\n\n  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],\n    lt_cv_prog_compiler_rtti_exceptions,\n    [-fno-rtti -fno-exceptions], [],\n    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\"$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions\"])\nfi\n_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],\n\t[Compiler flag to turn off builtin functions])\n])# _LT_COMPILER_NO_RTTI\n\n\n# _LT_CMD_GLOBAL_SYMBOLS\n# ----------------------\nm4_defun([_LT_CMD_GLOBAL_SYMBOLS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_PROG_AWK])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_TAG_COMPILER])dnl\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\nAC_MSG_CHECKING([command to parse $NM output from $compiler object])\nAC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],\n[\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[[BCDEGRST]]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([[_A-Za-z]][[_A-Za-z0-9]]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[[BCDT]]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[[ABCDGISTW]]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[[ABCDEGRST]]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[[BCDEGRST]]'\n  ;;\nosf*)\n  symcode='[[BCDEGQRST]]'\n  ;;\nsolaris*)\n  symcode='[[BDRT]]'\n  ;;\nsco3.2v5*)\n  symcode='[[DT]]'\n  ;;\nsysv4.2uw2*)\n  symcode='[[DT]]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[[ABDT]]'\n  ;;\nsysv4)\n  symcode='[[DFNSTU]]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[[ABCDGIRSTW]]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\(lib[[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK ['\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx]\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[[\t ]]\\($symcode$symcode*\\)[[\t ]][[\t ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n  lt_cv_sys_global_symbol_pipe=\"$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'\"\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if AC_TRY_EVAL(ac_compile); then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if AC_TRY_EVAL(NM conftest.$ac_objext \\| \"$lt_cv_sys_global_symbol_pipe\" \\> $nlist) && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT@&t@_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT@&t@_DLSYM_CONST\n#else\n# define LT@&t@_DLSYM_CONST const\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nLT@&t@_DLSYM_CONST struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[[]] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_globsym_save_LIBS=$LIBS\n\t  lt_globsym_save_CFLAGS=$CFLAGS\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)\"\n\t  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=$lt_globsym_save_LIBS\n\t  CFLAGS=$lt_globsym_save_CFLAGS\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&AS_MESSAGE_LOG_FD\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&AS_MESSAGE_LOG_FD\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&AS_MESSAGE_LOG_FD\n    fi\n  else\n    echo \"$progname: failed program was:\" >&AS_MESSAGE_LOG_FD\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n])\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  AC_MSG_RESULT(failed)\nelse\n  AC_MSG_RESULT(ok)\nfi\n\n# Response file support.\nif test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n  nm_file_list_spec='@'\nelif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then\n  nm_file_list_spec='@'\nfi\n\n_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],\n    [Take the output of nm and produce a listing of raw symbols and C names])\n_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],\n    [Transform the output of nm in a proper C declaration])\n_LT_DECL([global_symbol_to_c_name_address],\n    [lt_cv_sys_global_symbol_to_c_name_address], [1],\n    [Transform the output of nm in a C name address pair])\n_LT_DECL([global_symbol_to_c_name_address_lib_prefix],\n    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],\n    [Transform the output of nm in a C name address pair when lib prefix is needed])\n_LT_DECL([], [nm_file_list_spec], [1],\n    [Specify filename containing input files for $NM])\n]) # _LT_CMD_GLOBAL_SYMBOLS\n\n\n# _LT_COMPILER_PIC([TAGNAME])\n# ---------------------------\nm4_defun([_LT_COMPILER_PIC],\n[m4_require([_LT_TAG_COMPILER])dnl\n_LT_TAGVAR(lt_prog_compiler_wl, $1)=\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n_LT_TAGVAR(lt_prog_compiler_static, $1)=\n\nm4_if([$1], [CXX], [\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n      ;;\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[[4-9]]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\telse\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, $1)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      mingw* | cygwin* | os2* | pw32* | cegcc*)\n\t# This hack is so that the source file can tell whether it is being\n\t# built for inclusion in a dll (and should export symbols for example).\n\tm4_if([$1], [GCJ], [],\n\t  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)\n\t    # IBM XL 8.0, 9.0 on PPC and BlueGene\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd* | netbsdelf*-gnu)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n\t;;\n    esac\n  fi\n],\n[\n  if test \"$GCC\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n\n    case $cc_basename in\n    nvcc*) # Cuda Compiler Driver 2.2\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      else\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC (with -KPIC) is the default.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu | kopensolaris*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'\n\t;;\n      nagfor*)\n\t# NAG Fortran compiler\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n        ;;\n      ccc*)\n        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n        # All Alpha code is PIC.\n        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n        ;;\n      xl* | bgxl* | bgf* | mpixl*)\n\t# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ F* | *Sun*Fortran*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''\n\t  ;;\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # All OSF/1 code is PIC.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    rdos*)\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    unicos*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n    esac\n  fi\n])\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n    ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\"$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])\"\n    ;;\nesac\n\nAC_CACHE_CHECK([for $compiler option to produce PIC],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$_LT_TAGVAR(lt_prog_compiler_pic, $1)\"; then\n  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],\n    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],\n    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],\n    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in\n     \"\" | \" \"*) ;;\n     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=\" $_LT_TAGVAR(lt_prog_compiler_pic, $1)\" ;;\n     esac],\n    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])\nfi\n_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],\n\t[Additional compiler flags for building library objects])\n\n_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],\n\t[How to pass a linker flag through the compiler])\n#\n# Check to make sure the static flag actually works.\n#\nwl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\\\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\\\"\n_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],\n  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),\n  $lt_tmp_static_flag,\n  [],\n  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])\n_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],\n\t[Compiler flag to prevent dynamic linking])\n])# _LT_COMPILER_PIC\n\n\n# _LT_LINKER_SHLIBS([TAGNAME])\n# ----------------------------\n# See if the linker supports building shared libraries.\nm4_defun([_LT_LINKER_SHLIBS],\n[AC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\nm4_if([$1], [CXX], [\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  case $host_os in\n  aix[[4-9]]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    # Also, AIX nm treats weak defined symbols like other global defined\n    # symbols, whereas GNU nm marks them as \"W\".\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    _LT_TAGVAR(export_symbols_cmds, $1)=\"$ltdll_cmds\"\n    ;;\n  cygwin* | mingw* | cegcc*)\n    case $cc_basename in\n    cl*) ;;\n    *)\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n      ;;\n    esac\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  *)\n    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n    ;;\n  esac\n], [\n  runpath_var=\n  _LT_TAGVAR(allow_undefined_flag, $1)=\n  _LT_TAGVAR(always_export_symbols, $1)=no\n  _LT_TAGVAR(archive_cmds, $1)=\n  _LT_TAGVAR(archive_expsym_cmds, $1)=\n  _LT_TAGVAR(compiler_needs_object, $1)=no\n  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n  _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(hardcode_automatic, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_direct_absolute, $1)=no\n  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n  _LT_TAGVAR(hardcode_minus_L, $1)=no\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  _LT_TAGVAR(inherit_rpath, $1)=no\n  _LT_TAGVAR(link_all_deplibs, $1)=unknown\n  _LT_TAGVAR(module_cmds, $1)=\n  _LT_TAGVAR(module_expsym_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_new_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=\n  _LT_TAGVAR(thread_safe_flag_spec, $1)=\n  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  _LT_TAGVAR(include_expsyms, $1)=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\ndnl Note also adjust exclude_expsyms for C++ above.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  esac\n\n  _LT_TAGVAR(ld_shlibs, $1)=yes\n\n  # On some targets, GNU ld is compatible enough with the native linker\n  # that we're better off using the native interface for both.\n  lt_use_gnu_ld_interface=no\n  if test \"$with_gnu_ld\" = yes; then\n    case $host_os in\n      aix*)\n\t# The AIX port of GNU ld has always aspired to compatibility\n\t# with the native linker.  However, as the warning in the GNU ld\n\t# block says, versions before 2.19.5* couldn't really create working\n\t# shared libraries, regardless of the interface used.\n\tcase `$LD -v 2>&1` in\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.19.5*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.[[2-9]]*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ [[3-9]]*) ;;\n\t  *)\n\t    lt_use_gnu_ld_interface=yes\n\t    ;;\n\tesac\n\t;;\n      *)\n\tlt_use_gnu_ld_interface=yes\n\t;;\n    esac\n  fi\n\n  if test \"$lt_use_gnu_ld_interface\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *GNU\\ gold*) supports_anon_versioning=yes ;;\n      *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[[3-9]]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.19, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to install binutils\n*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.\n*** You will then need to restart the configuration process.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n      # as there is no search path for DLLs.\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=no\n      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    haiku*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    interix[[3-9]]*)\n      _LT_TAGVAR(hardcode_direct, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      _LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=' $pic_flag'\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95* | pgfortran*)\n\t\t\t\t\t# Portland Group f77 and f90 compilers\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n\t  tmp_sharedflag='--shared' ;;\n\txl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tnvcc*)\t# Cuda Compiler Driver 2.2\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\t_LT_TAGVAR(archive_cmds, $1)='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf* | bgf* | bgxlf* | mpixlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        _LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.1[[0-5]].*)\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n    esac\n\n    if test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no; then\n      runpath_var=\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\t_LT_TAGVAR(hardcode_direct, $1)=unsupported\n      fi\n      ;;\n\n    aix[[4-9]]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\t# Also, AIX nm treats weak defined symbols like other global\n\t# defined symbols, whereas GNU nm marks them as \"W\".\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      _LT_TAGVAR(archive_cmds, $1)=''\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[[012]]|aix4.[[012]].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n\t_LT_TAGVAR(link_all_deplibs, $1)=no\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\t_LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        _LT_SYS_MODULE_PATH_AIX([$1])\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t _LT_SYS_MODULE_PATH_AIX([$1])\n\t _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t  if test \"$with_gnu_ld\" = yes; then\n\t    # We only use this code for GNU lds that support --whole-archive.\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t  else\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t  fi\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[[45]]*)\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      case $cc_basename in\n      cl*)\n\t# Native MSVC\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t_LT_TAGVAR(always_export_symbols, $1)=yes\n\t_LT_TAGVAR(file_list_spec, $1)='@'\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    sed -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t  else\n\t    sed -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t  fi~\n\t  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t  linknames='\n\t# The linker will not automatically build a static lib if we build a DLL.\n\t# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1,DATA/'\\'' | $SED -e '\\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\\'' | sort | uniq > $export_symbols'\n\t# Don't use ranlib\n\t_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t  lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t  case $lt_outputfile in\n\t    *.exe|*.EXE) ;;\n\t    *)\n\t      lt_outputfile=\"$lt_outputfile.exe\"\n\t      lt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t      ;;\n\t  esac~\n\t  if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t    $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t    $RM \"$lt_outputfile.manifest\";\n\t  fi'\n\t;;\n      *)\n\t# Assume MSVC wrapper\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all \"$deplibs\" | $SED '\\''s/ -lc$//'\\''` -link -dll~linknames='\n\t# The linker will automatically build a .lib file if we build a DLL.\n\t_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t# FIXME: Should let the user specify the lib program.\n\t_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t;;\n      esac\n      ;;\n\n    darwin* | rhapsody*)\n      _LT_DARWIN_LINKER_FEATURES($1)\n      ;;\n\n    dgux*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    freebsd1*)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\t_LT_TAGVAR(hardcode_minus_L, $1)=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\tm4_if($1, [], [\n\t  # Older versions of the 11.00 compiler do not understand -b yet\n\t  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)\n\t  _LT_LINKER_OPTION([if $CC understands -b],\n\t    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],\n\t  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n\t# This should be the same for all languages, so no per-tag cache variable.\n\tAC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],\n\t  [lt_cv_irix_exported_symbol],\n\t  [save_LDFLAGS=\"$LDFLAGS\"\n\t   LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n\t   AC_LINK_IFELSE(\n\t     [AC_LANG_SOURCE(\n\t        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],\n\t\t\t      [C++], [[int foo (void) { return 0; }]],\n\t\t\t      [Fortran 77], [[\n      subroutine foo\n      end]],\n\t\t\t      [Fortran], [[\n      subroutine foo\n      end]])])],\n\t      [lt_cv_irix_exported_symbol=yes],\n\t      [lt_cv_irix_exported_symbol=no])\n           LDFLAGS=\"$save_LDFLAGS\"])\n\tif test \"$lt_cv_irix_exported_symbol\" = yes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n\tfi\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(inherit_rpath, $1)=yes\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)\n\t     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t     ;;\n\t   *)\n\t     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    os2*)\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(archive_cmds, $1)='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      case $host_os in\n      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n        ;;\n\tmotorola)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4.3*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\t_LT_TAGVAR(ld_shlibs, $1)=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n])\nAC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\ntest \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld\n\n_LT_DECL([], [libext], [0], [Old archive suffix (normally \"a\")])dnl\n_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally \".so\")])dnl\n_LT_DECL([], [extract_expsyms_cmds], [2],\n    [The commands to extract the exported symbol list from a shared archive])\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$_LT_TAGVAR(archive_cmds_need_lc, $1)\" in\nx|xyes)\n  # Assume -lc should be added\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $_LT_TAGVAR(archive_cmds, $1) in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      AC_CACHE_CHECK([whether -lc should be explicitly linked in],\n\t[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),\n\t[$RM conftest*\n\techo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n\tif AC_TRY_EVAL(ac_compile) 2>conftest.err; then\n\t  soname=conftest\n\t  lib=conftest\n\t  libobjs=conftest.$ac_objext\n\t  deplibs=\n\t  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)\n\t  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)\n\t  compiler_flags=-v\n\t  linker_flags=-v\n\t  verstring=\n\t  output_objdir=.\n\t  libname=conftest\n\t  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\n\t  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1)\n\t  then\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t  else\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  fi\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag\n\telse\n\t  cat conftest.err 1>&5\n\tfi\n\t$RM conftest*\n\t])\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],\n    [Whether or not to add -lc for building shared libraries])\n_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],\n    [enable_shared_with_static_runtimes], [0],\n    [Whether or not to disallow shared libs when runtime libs are static])\n_LT_TAGDECL([], [export_dynamic_flag_spec], [1],\n    [Compiler flag to allow reflexive dlopens])\n_LT_TAGDECL([], [whole_archive_flag_spec], [1],\n    [Compiler flag to generate shared objects directly from archives])\n_LT_TAGDECL([], [compiler_needs_object], [1],\n    [Whether the compiler copes with passing no objects directly])\n_LT_TAGDECL([], [old_archive_from_new_cmds], [2],\n    [Create an old-style archive from a shared archive])\n_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],\n    [Create a temporary old-style archive to link instead of a shared archive])\n_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])\n_LT_TAGDECL([], [archive_expsym_cmds], [2])\n_LT_TAGDECL([], [module_cmds], [2],\n    [Commands used to build a loadable module if different from building\n    a shared archive.])\n_LT_TAGDECL([], [module_expsym_cmds], [2])\n_LT_TAGDECL([], [with_gnu_ld], [1],\n    [Whether we are building with GNU ld or not])\n_LT_TAGDECL([], [allow_undefined_flag], [1],\n    [Flag that allows shared libraries with undefined symbols to be built])\n_LT_TAGDECL([], [no_undefined_flag], [1],\n    [Flag that enforces no undefined symbols])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],\n    [Flag to hardcode $libdir into a binary during linking.\n    This must work even if $libdir does not exist])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],\n    [[If ld is used when linking, flag to hardcode $libdir into a binary\n    during linking.  This must work even if $libdir does not exist]])\n_LT_TAGDECL([], [hardcode_libdir_separator], [1],\n    [Whether we need a single \"-rpath\" flag with a separated argument])\n_LT_TAGDECL([], [hardcode_direct], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary])\n_LT_TAGDECL([], [hardcode_direct_absolute], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary and the resulting library dependency is\n    \"absolute\", i.e impossible to change by setting ${shlibpath_var} if the\n    library is relocated])\n_LT_TAGDECL([], [hardcode_minus_L], [0],\n    [Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_shlibpath_var], [0],\n    [Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_automatic], [0],\n    [Set to \"yes\" if building a shared library automatically hardcodes DIR\n    into the library and all subsequent libraries and executables linked\n    against it])\n_LT_TAGDECL([], [inherit_rpath], [0],\n    [Set to yes if linker adds runtime paths of dependent libraries\n    to runtime path list])\n_LT_TAGDECL([], [link_all_deplibs], [0],\n    [Whether libtool must link a program against all its dependency libraries])\n_LT_TAGDECL([], [always_export_symbols], [0],\n    [Set to \"yes\" if exported symbols are required])\n_LT_TAGDECL([], [export_symbols_cmds], [2],\n    [The commands to list exported symbols])\n_LT_TAGDECL([], [exclude_expsyms], [1],\n    [Symbols that should not be listed in the preloaded symbols])\n_LT_TAGDECL([], [include_expsyms], [1],\n    [Symbols that must always be exported])\n_LT_TAGDECL([], [prelink_cmds], [2],\n    [Commands necessary for linking programs (against libraries) with templates])\n_LT_TAGDECL([], [postlink_cmds], [2],\n    [Commands necessary for finishing linking programs])\n_LT_TAGDECL([], [file_list_spec], [1],\n    [Specify filename containing input files])\ndnl FIXME: Not yet implemented\ndnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],\ndnl    [Compiler flag to generate thread safe objects])\n])# _LT_LINKER_SHLIBS\n\n\n# _LT_LANG_C_CONFIG([TAG])\n# ------------------------\n# Ensure that the configuration variables for a C compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_C_CONFIG],\n[m4_require([_LT_DECL_EGREP])dnl\nlt_save_CC=\"$CC\"\nAC_LANG_PUSH(C)\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n_LT_TAG_COMPILER\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_SYS_DYNAMIC_LINKER($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n  LT_SYS_DLOPEN_SELF\n  _LT_CMD_STRIPLIB\n\n  # Report which library types will actually be built\n  AC_MSG_CHECKING([if libtool supports shared libraries])\n  AC_MSG_RESULT([$can_build_shared])\n\n  AC_MSG_CHECKING([whether to build shared libraries])\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[[4-9]]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  AC_MSG_RESULT([$enable_shared])\n\n  AC_MSG_CHECKING([whether to build static libraries])\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  AC_MSG_RESULT([$enable_static])\n\n  _LT_CONFIG($1)\nfi\nAC_LANG_POP\nCC=\"$lt_save_CC\"\n])# _LT_LANG_C_CONFIG\n\n\n# _LT_LANG_CXX_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a C++ compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_CXX_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nif test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  AC_PROG_CXXCPP\nelse\n  _lt_caught_CXX_error=yes\nfi\n\nAC_LANG_PUSH(C++)\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(compiler_needs_object, $1)=no\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_CFLAGS=$CFLAGS\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  CFLAGS=$CXXFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'\n    else\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n      LT_PATH_LD\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\n    _LT_TAGVAR(ld_shlibs, $1)=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n      aix[[4-9]]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        _LT_TAGVAR(archive_cmds, $1)=''\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[[012]]|aix4.[[012]].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        _LT_TAGVAR(always_export_symbols, $1)=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          _LT_SYS_MODULE_PATH_AIX([$1])\n          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    _LT_SYS_MODULE_PATH_AIX([$1])\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t    if test \"$with_gnu_ld\" = yes; then\n\t      # We only use this code for GNU lds that support --whole-archive.\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    else\n\t      # Exported symbols can be pulled into shared objects from archives\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t    fi\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n\tcase $GXX,$cc_basename in\n\t,cl* | no,cl*)\n\t  # Native MSVC\n\t  # hardcode_libdir_flag_spec is actually meaningless, as there is\n\t  # no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=yes\n\t  _LT_TAGVAR(file_list_spec, $1)='@'\n\t  # Tell ltmain to make .lib files, not .a files.\n\t  libext=lib\n\t  # Tell ltmain to make .dll files, not .so files.\n\t  shrext_cmds=\".dll\"\n\t  # FIXME: Setting linknames here is a bad hack.\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      $SED -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t    else\n\t      $SED -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t    fi~\n\t    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t    linknames='\n\t  # The linker will not automatically build a static lib if we build a DLL.\n\t  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t  # Don't use ranlib\n\t  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t    lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t    case $lt_outputfile in\n\t      *.exe|*.EXE) ;;\n\t      *)\n\t\tlt_outputfile=\"$lt_outputfile.exe\"\n\t\tlt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t\t;;\n\t    esac~\n\t    func_to_tool_file \"$lt_outputfile\"~\n\t    if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t      $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t      $RM \"$lt_outputfile.manifest\";\n\t    fi'\n\t  ;;\n\t*)\n\t  # g++\n\t  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n\t  # as there is no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=no\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\n\t  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t    # If the export-symbols file already is a .def file (1st line\n\t    # is EXPORTS), use it as is; otherwise, prepend...\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      cp $export_symbols $output_objdir/$soname.def;\n\t    else\n\t      echo EXPORTS > $output_objdir/$soname.def;\n\t      cat $export_symbols >> $output_objdir/$soname.def;\n\t    fi~\n\t    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t  ;;\n\tesac\n\t;;\n      darwin* | rhapsody*)\n        _LT_DARWIN_LINKER_FEATURES($1)\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd[[12]]*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      freebsd-elf*)\n        _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      haiku*)\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        ;;\n\n      hpux9*)\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            _LT_TAGVAR(ld_shlibs, $1)=no\n            ;;\n          aCC*)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              _LT_TAGVAR(ld_shlibs, $1)=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            _LT_TAGVAR(hardcode_direct, $1)=no\n            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n            ;;\n          *)\n            _LT_TAGVAR(hardcode_direct, $1)=yes\n            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[[3-9]]*)\n\t_LT_TAGVAR(hardcode_direct, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` -o $lib'\n\t      fi\n\t    fi\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\t    ;;\n        esac\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(inherit_rpath, $1)=yes\n        ;;\n\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [[1-5]].* | *pgcpp\\ [[1-5]].*)\n\t      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | sort | $NL2SP`\"'\n\t      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | sort | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 and above use weak symbols\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"X$list\" | $Xsed'\n\t    ;;\n\t  xl* | mpixl* | bgxl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      _LT_TAGVAR(compiler_needs_object, $1)=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='func_echo_all'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=func_echo_all\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t    case $host_os in\n\t      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\t_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\n\t    output_verbose_link_cmd='func_echo_all'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      fi\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t\t*)\n\t\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\t_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n\t_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n\t_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n\t_LT_TAGVAR(link_all_deplibs, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~\n\t      '\"$_LT_TAGVAR(old_archive_cmds, $1)\"\n\t    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~\n\t      '\"$_LT_TAGVAR(reload_cmds, $1)\"\n\t    ;;\n\t  *)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n    esac\n\n    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\n    test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n    _LT_TAGVAR(GCC, $1)=\"$GXX\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_CXX_CONFIG\n\n\n# _LT_FUNC_STRIPNAME_CNF\n# ----------------------\n# func_stripname_cnf prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n#\n# This function is identical to the (non-XSI) version of func_stripname,\n# except this one can be used by m4 code that may be executed by configure,\n# rather than the libtool script.\nm4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl\nAC_REQUIRE([_LT_DECL_SED])\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])\nfunc_stripname_cnf ()\n{\n  case ${2} in\n  .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n  *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n  esac\n} # func_stripname_cnf\n])# _LT_FUNC_STRIPNAME_CNF\n\n# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])\n# ---------------------------------\n# Figure out \"hidden\" library dependencies from verbose\n# compiler output when linking a shared library.\n# Parse the compiler output and extract the necessary\n# objects, libraries and library flags.\nm4_defun([_LT_SYS_HIDDEN_LIBDEPS],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nAC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl\n# Dependencies to place before and after the object being linked:\n_LT_TAGVAR(predep_objects, $1)=\n_LT_TAGVAR(postdep_objects, $1)=\n_LT_TAGVAR(predeps, $1)=\n_LT_TAGVAR(postdeps, $1)=\n_LT_TAGVAR(compiler_lib_search_path, $1)=\n\ndnl we can't use the lt_simple_compile_test_code here,\ndnl because it contains code intended for an executable,\ndnl not a library.  It's possible we should let each\ndnl tag define a new lt_????_link_test_code variable,\ndnl but it's only used here...\nm4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF\nint a;\nvoid foo (void) { a = 0; }\n_LT_EOF\n], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer*4 a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF\npublic class foo {\n  private int a;\n  public void bar (void) {\n    a = 0;\n  }\n};\n_LT_EOF\n])\n\n_lt_libdeps_save_CFLAGS=$CFLAGS\ncase \"$CC $CFLAGS \" in #(\n*\\ -flto*\\ *) CFLAGS=\"$CFLAGS -fno-lto\" ;;\n*\\ -fwhopr*\\ *) CFLAGS=\"$CFLAGS -fno-whopr\" ;;\nesac\n\ndnl Parse the compiler output and extract the necessary\ndnl objects, libraries and library flags.\nif AC_TRY_EVAL(ac_compile); then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case ${prev}${p} in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       fi\n\n       # Expand the sysroot to ease extracting the directories later.\n       if test -z \"$prev\"; then\n         case $p in\n         -L*) func_stripname_cnf '-L' '' \"$p\"; prev=-L; p=$func_stripname_result ;;\n         -R*) func_stripname_cnf '-R' '' \"$p\"; prev=-R; p=$func_stripname_result ;;\n         -l*) func_stripname_cnf '-l' '' \"$p\"; prev=-l; p=$func_stripname_result ;;\n         esac\n       fi\n       case $p in\n       =*) func_stripname_cnf '=' '' \"$p\"; p=$lt_sysroot$func_stripname_result ;;\n       esac\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case ${prev} in\n\t -L | -R)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$_LT_TAGVAR(compiler_lib_search_path, $1)\"; then\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${prev}${p}\"\n\t   else\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$_LT_TAGVAR(postdeps, $1)\"; then\n\t   _LT_TAGVAR(postdeps, $1)=\"${prev}${p}\"\n\t else\n\t   _LT_TAGVAR(postdeps, $1)=\"${_LT_TAGVAR(postdeps, $1)} ${prev}${p}\"\n\t fi\n       fi\n       prev=\n       ;;\n\n    *.lto.$objext) ;; # Ignore GCC LTO objects\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$_LT_TAGVAR(predep_objects, $1)\"; then\n\t   _LT_TAGVAR(predep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(predep_objects, $1)=\"$_LT_TAGVAR(predep_objects, $1) $p\"\n\t fi\n       else\n\t if test -z \"$_LT_TAGVAR(postdep_objects, $1)\"; then\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$_LT_TAGVAR(postdep_objects, $1) $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling $1 test program\"\nfi\n\n$RM -f confest.$objext\nCFLAGS=$_lt_libdeps_save_CFLAGS\n\n# PORTME: override above test on systems where it is broken\nm4_if([$1], [CXX],\n[case $host_os in\ninterix[[3-9]]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  _LT_TAGVAR(predep_objects,$1)=\n  _LT_TAGVAR(postdep_objects,$1)=\n  _LT_TAGVAR(postdeps,$1)=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC* | sunCC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n])\n\ncase \" $_LT_TAGVAR(postdeps, $1) \" in\n*\" -lc \"*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;\nesac\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=\nif test -n \"${_LT_TAGVAR(compiler_lib_search_path, $1)}\"; then\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo \" ${_LT_TAGVAR(compiler_lib_search_path, $1)}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n_LT_TAGDECL([], [compiler_lib_search_dirs], [1],\n    [The directories searched by this compiler when creating a shared library])\n_LT_TAGDECL([], [predep_objects], [1],\n    [Dependencies to place before and after the objects being linked to\n    create a shared library])\n_LT_TAGDECL([], [postdep_objects], [1])\n_LT_TAGDECL([], [predeps], [1])\n_LT_TAGDECL([], [postdeps], [1])\n_LT_TAGDECL([], [compiler_lib_search_path], [1],\n    [The library search path used internally by the compiler when linking\n    a shared library])\n])# _LT_SYS_HIDDEN_LIBDEPS\n\n\n# _LT_LANG_F77_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a Fortran 77 compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_F77_CONFIG],\n[AC_LANG_PUSH(Fortran 77)\nif test -z \"$F77\" || test \"X$F77\" = \"Xno\"; then\n  _lt_disable_F77=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for f77 test sources.\nac_ext=f\n\n# Object file extension for compiled f77 test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the F77 compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_F77\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${F77-\"f77\"}\n  CFLAGS=$FFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n  GCC=$G77\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$G77\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=\"$lt_save_CC\"\n  CFLAGS=\"$lt_save_CFLAGS\"\nfi # test \"$_lt_disable_F77\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_F77_CONFIG\n\n\n# _LT_LANG_FC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for a Fortran compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_FC_CONFIG],\n[AC_LANG_PUSH(Fortran)\n\nif test -z \"$FC\" || test \"X$FC\" = \"Xno\"; then\n  _lt_disable_FC=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for fc test sources.\nac_ext=${ac_fc_srcext-f}\n\n# Object file extension for compiled fc test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the FC compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_FC\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${FC-\"f95\"}\n  CFLAGS=$FCFLAGS\n  compiler=$CC\n  GCC=$ac_cv_fc_compiler_gnu\n\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$ac_cv_fc_compiler_gnu\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\nfi # test \"$_lt_disable_FC\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_FC_CONFIG\n\n\n# _LT_LANG_GCJ_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for the GNU Java Compiler compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_GCJ_CONFIG],\n[AC_REQUIRE([LT_PROG_GCJ])dnl\nAC_LANG_SAVE\n\n# Source file extension for Java test sources.\nac_ext=java\n\n# Object file extension for compiled Java test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"class foo {}\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=$CC\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=yes\nCC=${GCJ-\"gcj\"}\nCFLAGS=$GCJFLAGS\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_TAGVAR(LD, $1)=\"$LD\"\n_LT_CC_BASENAME([$compiler])\n\n# GCJ did not exist at the time GCC didn't implicitly link libc in.\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n\n  _LT_CONFIG($1)\nfi\n\nAC_LANG_RESTORE\n\nGCC=$lt_save_GCC\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_GCJ_CONFIG\n\n\n# _LT_LANG_RC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for the Windows resource compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_RC_CONFIG],\n[AC_REQUIRE([LT_PROG_RC])dnl\nAC_LANG_SAVE\n\n# Source file extension for RC test sources.\nac_ext=rc\n\n# Object file extension for compiled RC test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code='sample MENU { MENUITEM \"&Soup\", 100, CHECKED }'\n\n# Code to be used in simple link tests\nlt_simple_link_test_code=\"$lt_simple_compile_test_code\"\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=\"$CC\"\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=\nCC=${RC-\"windres\"}\nCFLAGS=\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_CC_BASENAME([$compiler])\n_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n\nif test -n \"$compiler\"; then\n  :\n  _LT_CONFIG($1)\nfi\n\nGCC=$lt_save_GCC\nAC_LANG_RESTORE\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_RC_CONFIG\n\n\n# LT_PROG_GCJ\n# -----------\nAC_DEFUN([LT_PROG_GCJ],\n[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],\n  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],\n    [AC_CHECK_TOOL(GCJ, gcj,)\n      test \"x${GCJFLAGS+set}\" = xset || GCJFLAGS=\"-g -O2\"\n      AC_SUBST(GCJFLAGS)])])[]dnl\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_GCJ], [])\n\n\n# LT_PROG_RC\n# ----------\nAC_DEFUN([LT_PROG_RC],\n[AC_CHECK_TOOL(RC, windres,)\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_RC], [])\n\n\n# _LT_DECL_EGREP\n# --------------\n# If we don't have a new enough Autoconf to choose the best grep\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_EGREP],\n[AC_REQUIRE([AC_PROG_EGREP])dnl\nAC_REQUIRE([AC_PROG_FGREP])dnl\ntest -z \"$GREP\" && GREP=grep\n_LT_DECL([], [GREP], [1], [A grep program that handles long lines])\n_LT_DECL([], [EGREP], [1], [An ERE matcher])\n_LT_DECL([], [FGREP], [1], [A literal string matcher])\ndnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too\nAC_SUBST([GREP])\n])\n\n\n# _LT_DECL_OBJDUMP\n# --------------\n# If we don't have a new enough Autoconf to choose the best objdump\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_OBJDUMP],\n[AC_CHECK_TOOL(OBJDUMP, objdump, false)\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])\nAC_SUBST([OBJDUMP])\n])\n\n# _LT_DECL_DLLTOOL\n# ----------------\n# Ensure DLLTOOL variable is set.\nm4_defun([_LT_DECL_DLLTOOL],\n[AC_CHECK_TOOL(DLLTOOL, dlltool, false)\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])\nAC_SUBST([DLLTOOL])\n])\n\n# _LT_DECL_SED\n# ------------\n# Check for a fully-functional sed program, that truncates\n# as few characters as possible.  Prefer GNU sed if found.\nm4_defun([_LT_DECL_SED],\n[AC_PROG_SED\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n_LT_DECL([], [SED], [1], [A sed program that does not truncate output])\n_LT_DECL([], [Xsed], [\"\\$SED -e 1s/^X//\"],\n    [Sed that helps us avoid accidentally triggering echo(1) options like -n])\n])# _LT_DECL_SED\n\nm4_ifndef([AC_PROG_SED], [\n# NOTE: This macro has been submitted for inclusion into   #\n#  GNU Autoconf as AC_PROG_SED.  When it is available in   #\n#  a released version of Autoconf we should remove this    #\n#  macro and use it instead.                               #\n\nm4_defun([AC_PROG_SED],\n[AC_MSG_CHECKING([for a sed that does not truncate output])\nAC_CACHE_VAL(lt_cv_path_SED,\n[# Loop through the user's path and test for sed and gsed.\n# Then use that list of sed's as ones to test for truncation.\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  for lt_ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      if $as_executable_p \"$as_dir/$lt_ac_prog$ac_exec_ext\"; then\n        lt_ac_sed_list=\"$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext\"\n      fi\n    done\n  done\ndone\nIFS=$as_save_IFS\nlt_ac_max=0\nlt_ac_count=0\n# Add /usr/xpg4/bin/sed as it is typically found on Solaris\n# along with /bin/sed that truncates output.\nfor lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do\n  test ! -f $lt_ac_sed && continue\n  cat /dev/null > conftest.in\n  lt_ac_count=0\n  echo $ECHO_N \"0123456789$ECHO_C\" >conftest.in\n  # Check for GNU sed and select it if it is found.\n  if \"$lt_ac_sed\" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then\n    lt_cv_path_SED=$lt_ac_sed\n    break\n  fi\n  while true; do\n    cat conftest.in conftest.in >conftest.tmp\n    mv conftest.tmp conftest.in\n    cp conftest.in conftest.nl\n    echo >>conftest.nl\n    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break\n    cmp -s conftest.out conftest.nl || break\n    # 10000 chars as input seems more than enough\n    test $lt_ac_count -gt 10 && break\n    lt_ac_count=`expr $lt_ac_count + 1`\n    if test $lt_ac_count -gt $lt_ac_max; then\n      lt_ac_max=$lt_ac_count\n      lt_cv_path_SED=$lt_ac_sed\n    fi\n  done\ndone\n])\nSED=$lt_cv_path_SED\nAC_SUBST([SED])\nAC_MSG_RESULT([$SED])\n])#AC_PROG_SED\n])#m4_ifndef\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_SED], [])\n\n\n# _LT_CHECK_SHELL_FEATURES\n# ------------------------\n# Find out whether the shell is Bourne or XSI compatible,\n# or has some other useful features.\nm4_defun([_LT_CHECK_SHELL_FEATURES],\n[AC_MSG_CHECKING([whether the shell understands some XSI constructs])\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,b/c, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\nAC_MSG_RESULT([$xsi_shell])\n_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])\n\nAC_MSG_CHECKING([whether the shell understands \"+=\"])\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$[1]+=\\$[2]\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\nAC_MSG_RESULT([$lt_shell_append])\n_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n_LT_DECL([], [lt_unset], [0], [whether the shell understands \"unset\"])dnl\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl\n_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl\n])# _LT_CHECK_SHELL_FEATURES\n\n\n# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)\n# ------------------------------------------------------\n# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and\n# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.\nm4_defun([_LT_PROG_FUNCTION_REPLACE],\n[dnl {\nsed -e '/^$1 ()$/,/^} # $1 /c\\\n$1 ()\\\n{\\\nm4_bpatsubsts([$2], [$], [\\\\], [^\\([\t ]\\)], [\\\\\\1])\n} # Extended-shell $1 implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n])\n\n\n# _LT_PROG_REPLACE_SHELLFNS\n# -------------------------\n# Replace existing portable implementations of several shell functions with\n# equivalent extended shell implementations where those features are available..\nm4_defun([_LT_PROG_REPLACE_SHELLFNS],\n[if test x\"$xsi_shell\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl\n    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\n    # positional parameters, so assign one to ordinary parameter first.\n    func_stripname_result=${3}\n    func_stripname_result=${func_stripname_result#\"${1}\"}\n    func_stripname_result=${func_stripname_result%\"${2}\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl\n    func_split_long_opt_name=${1%%=*}\n    func_split_long_opt_arg=${1#*=}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl\n    func_split_short_opt_arg=${1#??}\n    func_split_short_opt_name=${1%\"$func_split_short_opt_arg\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl\n    case ${1} in\n      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\n      *)    func_lo2o_result=${1} ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])\n\n  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])\n\n  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])\nfi\n\nif test x\"$lt_shell_append\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval \"${1}+=\\\\${2}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl\n    func_quote_for_eval \"${2}\"\ndnl m4 expansion turns \\\\\\\\ into \\\\, and then the shell eval turns that into \\\n    eval \"${1}+=\\\\\\\\ \\\\$func_quote_for_eval_result\"])\n\n  # Save a `func_append' function call where possible by direct use of '+='\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1+=\"%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nelse\n  # Save a `func_append' function call even when '+=' is not available\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1=\"$\\1%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nfi\n\nif test x\"$_lt_function_replace_fail\" = x\":\"; then\n  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])\nfi\n])\n\n# _LT_PATH_CONVERSION_FUNCTIONS\n# -----------------------------\n# Determine which file name conversion functions should be used by\n# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed\n# for certain cross-compile configurations and native mingw.\nm4_defun([_LT_PATH_CONVERSION_FUNCTIONS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_MSG_CHECKING([how to convert $build file names to $host format])\nAC_CACHE_VAL(lt_cv_to_host_file_cmd,\n[case $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32\n        ;;\n    esac\n    ;;\n  *-*-cygwin* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_noop\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin\n        ;;\n    esac\n    ;;\n  * ) # unhandled hosts (and \"normal\" native builds)\n    lt_cv_to_host_file_cmd=func_convert_file_noop\n    ;;\nesac\n])\nto_host_file_cmd=$lt_cv_to_host_file_cmd\nAC_MSG_RESULT([$lt_cv_to_host_file_cmd])\n_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],\n         [0], [convert $build file names to $host format])dnl\n\nAC_MSG_CHECKING([how to convert $build file names to toolchain format])\nAC_CACHE_VAL(lt_cv_to_tool_file_cmd,\n[#assume ordinary cross tools, or native build.\nlt_cv_to_tool_file_cmd=func_convert_file_noop\ncase $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32\n        ;;\n    esac\n    ;;\nesac\n])\nto_tool_file_cmd=$lt_cv_to_tool_file_cmd\nAC_MSG_RESULT([$lt_cv_to_tool_file_cmd])\n_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],\n         [0], [convert $build files to toolchain format])dnl\n])# _LT_PATH_CONVERSION_FUNCTIONS\n\n# Helper functions for option handling.                    -*- Autoconf -*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,\n#   Inc.\n#   Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 7 ltoptions.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])\n\n\n# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)\n# ------------------------------------------\nm4_define([_LT_MANGLE_OPTION],\n[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])\n\n\n# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)\n# ---------------------------------------\n# Set option OPTION-NAME for macro MACRO-NAME, and if there is a\n# matching handler defined, dispatch to it.  Other OPTION-NAMEs are\n# saved as a flag.\nm4_define([_LT_SET_OPTION],\n[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl\nm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),\n        _LT_MANGLE_DEFUN([$1], [$2]),\n    [m4_warning([Unknown $1 option `$2'])])[]dnl\n])\n\n\n# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])\n# ------------------------------------------------------------\n# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.\nm4_define([_LT_IF_OPTION],\n[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])\n\n\n# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)\n# -------------------------------------------------------\n# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME\n# are set.\nm4_define([_LT_UNLESS_OPTIONS],\n[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n\t    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),\n\t\t      [m4_define([$0_found])])])[]dnl\nm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3\n])[]dnl\n])\n\n\n# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)\n# ----------------------------------------\n# OPTION-LIST is a space-separated list of Libtool options associated\n# with MACRO-NAME.  If any OPTION has a matching handler declared with\n# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about\n# the unknown option and exit.\nm4_defun([_LT_SET_OPTIONS],\n[# Set options\nm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),\n    [_LT_SET_OPTION([$1], _LT_Option)])\n\nm4_if([$1],[LT_INIT],[\n  dnl\n  dnl Simply set some default values (i.e off) if boolean options were not\n  dnl specified:\n  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no\n  ])\n  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no\n  ])\n  dnl\n  dnl If no reference was made to various pairs of opposing options, then\n  dnl we run the default mode handler for the pair.  For example, if neither\n  dnl `shared' nor `disable-shared' was passed, we enable building of shared\n  dnl archives by default:\n  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])\n  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])\n  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],\n  \t\t   [_LT_ENABLE_FAST_INSTALL])\n  ])\n])# _LT_SET_OPTIONS\n\n\n\n# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)\n# -----------------------------------------\nm4_define([_LT_MANGLE_DEFUN],\n[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])\n\n\n# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)\n# -----------------------------------------------\nm4_define([LT_OPTION_DEFINE],\n[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl\n])# LT_OPTION_DEFINE\n\n\n# dlopen\n# ------\nLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes\n])\n\nAU_DEFUN([AC_LIBTOOL_DLOPEN],\n[_LT_SET_OPTION([LT_INIT], [dlopen])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `dlopen' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])\n\n\n# win32-dll\n# ---------\n# Declare package support for building win32 dll's.\nLT_OPTION_DEFINE([LT_INIT], [win32-dll],\n[enable_win32_dll=yes\n\ncase $host in\n*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)\n  AC_CHECK_TOOL(AS, as, false)\n  AC_CHECK_TOOL(DLLTOOL, dlltool, false)\n  AC_CHECK_TOOL(OBJDUMP, objdump, false)\n  ;;\nesac\n\ntest -z \"$AS\" && AS=as\n_LT_DECL([], [AS],      [1], [Assembler program])dnl\n\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl\n\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl\n])# win32-dll\n\nAU_DEFUN([AC_LIBTOOL_WIN32_DLL],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n_LT_SET_OPTION([LT_INIT], [win32-dll])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `win32-dll' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])\n\n\n# _LT_ENABLE_SHARED([DEFAULT])\n# ----------------------------\n# implement the --enable-shared flag, and supports the `shared' and\n# `disable-shared' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_SHARED],\n[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([shared],\n    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],\n\t[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_shared=yes ;;\n    no) enable_shared=no ;;\n    *)\n      enable_shared=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_shared=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)\n\n    _LT_DECL([build_libtool_libs], [enable_shared], [0],\n\t[Whether or not to build shared libraries])\n])# _LT_ENABLE_SHARED\n\nLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])\n])\n\nAC_DEFUN([AC_DISABLE_SHARED],\n[_LT_SET_OPTION([LT_INIT], [disable-shared])\n])\n\nAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])\nAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_SHARED], [])\ndnl AC_DEFUN([AM_DISABLE_SHARED], [])\n\n\n\n# _LT_ENABLE_STATIC([DEFAULT])\n# ----------------------------\n# implement the --enable-static flag, and support the `static' and\n# `disable-static' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_STATIC],\n[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([static],\n    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],\n\t[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_static=yes ;;\n    no) enable_static=no ;;\n    *)\n     enable_static=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_static=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)\n\n    _LT_DECL([build_old_libs], [enable_static], [0],\n\t[Whether or not to build static libraries])\n])# _LT_ENABLE_STATIC\n\nLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])\n\n# Old names:\nAC_DEFUN([AC_ENABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])\n])\n\nAC_DEFUN([AC_DISABLE_STATIC],\n[_LT_SET_OPTION([LT_INIT], [disable-static])\n])\n\nAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])\nAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_ENABLE_STATIC], [])\ndnl AC_DEFUN([AM_DISABLE_STATIC], [])\n\n\n\n# _LT_ENABLE_FAST_INSTALL([DEFAULT])\n# ----------------------------------\n# implement the --enable-fast-install flag, and support the `fast-install'\n# and `disable-fast-install' LT_INIT options.\n# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.\nm4_define([_LT_ENABLE_FAST_INSTALL],\n[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl\nAC_ARG_ENABLE([fast-install],\n    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],\n    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],\n    [p=${PACKAGE-default}\n    case $enableval in\n    yes) enable_fast_install=yes ;;\n    no) enable_fast_install=no ;;\n    *)\n      enable_fast_install=no\n      # Look at the argument we got.  We use all the common list separators.\n      lt_save_ifs=\"$IFS\"; IFS=\"${IFS}$PATH_SEPARATOR,\"\n      for pkg in $enableval; do\n\tIFS=\"$lt_save_ifs\"\n\tif test \"X$pkg\" = \"X$p\"; then\n\t  enable_fast_install=yes\n\tfi\n      done\n      IFS=\"$lt_save_ifs\"\n      ;;\n    esac],\n    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)\n\n_LT_DECL([fast_install], [enable_fast_install], [0],\n\t [Whether or not to optimize for fast installation])dnl\n])# _LT_ENABLE_FAST_INSTALL\n\nLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])\nLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])\n\n# Old names:\nAU_DEFUN([AC_ENABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `fast-install' option into LT_INIT's first parameter.])\n])\n\nAU_DEFUN([AC_DISABLE_FAST_INSTALL],\n[_LT_SET_OPTION([LT_INIT], [disable-fast-install])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you put\nthe `disable-fast-install' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])\ndnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])\n\n\n# _LT_WITH_PIC([MODE])\n# --------------------\n# implement the --with-pic flag, and support the `pic-only' and `no-pic'\n# LT_INIT options.\n# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.\nm4_define([_LT_WITH_PIC],\n[AC_ARG_WITH([pic],\n    [AS_HELP_STRING([--with-pic],\n\t[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],\n    [pic_mode=\"$withval\"],\n    [pic_mode=default])\n\ntest -z \"$pic_mode\" && pic_mode=m4_default([$1], [default])\n\n_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl\n])# _LT_WITH_PIC\n\nLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])\nLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])\n\n# Old name:\nAU_DEFUN([AC_LIBTOOL_PICMODE],\n[_LT_SET_OPTION([LT_INIT], [pic-only])\nAC_DIAGNOSE([obsolete],\n[$0: Remove this warning and the call to _LT_SET_OPTION when you\nput the `pic-only' option into LT_INIT's first parameter.])\n])\n\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])\n\n\nm4_define([_LTDL_MODE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],\n\t\t [m4_define([_LTDL_MODE], [nonrecursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [recursive],\n\t\t [m4_define([_LTDL_MODE], [recursive])])\nLT_OPTION_DEFINE([LTDL_INIT], [subproject],\n\t\t [m4_define([_LTDL_MODE], [subproject])])\n\nm4_define([_LTDL_TYPE], [])\nLT_OPTION_DEFINE([LTDL_INIT], [installable],\n\t\t [m4_define([_LTDL_TYPE], [installable])])\nLT_OPTION_DEFINE([LTDL_INIT], [convenience],\n\t\t [m4_define([_LTDL_TYPE], [convenience])])\n\n# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-\n#\n# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.\n# Written by Gary V. Vaughan, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 6 ltsugar.m4\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])\n\n\n# lt_join(SEP, ARG1, [ARG2...])\n# -----------------------------\n# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their\n# associated separator.\n# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier\n# versions in m4sugar had bugs.\nm4_define([lt_join],\n[m4_if([$#], [1], [],\n       [$#], [2], [[$2]],\n       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])\nm4_define([_lt_join],\n[m4_if([$#$2], [2], [],\n       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])\n\n\n# lt_car(LIST)\n# lt_cdr(LIST)\n# ------------\n# Manipulate m4 lists.\n# These macros are necessary as long as will still need to support\n# Autoconf-2.59 which quotes differently.\nm4_define([lt_car], [[$1]])\nm4_define([lt_cdr],\n[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],\n       [$#], 1, [],\n       [m4_dquote(m4_shift($@))])])\nm4_define([lt_unquote], $1)\n\n\n# lt_append(MACRO-NAME, STRING, [SEPARATOR])\n# ------------------------------------------\n# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.\n# Note that neither SEPARATOR nor STRING are expanded; they are appended\n# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).\n# No SEPARATOR is output if MACRO-NAME was previously undefined (different\n# than defined and empty).\n#\n# This macro is needed until we can rely on Autoconf 2.62, since earlier\n# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.\nm4_define([lt_append],\n[m4_define([$1],\n\t   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])\n\n\n\n# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])\n# ----------------------------------------------------------\n# Produce a SEP delimited list of all paired combinations of elements of\n# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list\n# has the form PREFIXmINFIXSUFFIXn.\n# Needed until we can rely on m4_combine added in Autoconf 2.62.\nm4_define([lt_combine],\n[m4_if(m4_eval([$# > 3]), [1],\n       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl\n[[m4_foreach([_Lt_prefix], [$2],\n\t     [m4_foreach([_Lt_suffix],\n\t\t]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,\n\t[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])\n\n\n# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])\n# -----------------------------------------------------------------------\n# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited\n# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.\nm4_define([lt_if_append_uniq],\n[m4_ifdef([$1],\n\t  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],\n\t\t [lt_append([$1], [$2], [$3])$4],\n\t\t [$5])],\n\t  [lt_append([$1], [$2], [$3])$4])])\n\n\n# lt_dict_add(DICT, KEY, VALUE)\n# -----------------------------\nm4_define([lt_dict_add],\n[m4_define([$1($2)], [$3])])\n\n\n# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)\n# --------------------------------------------\nm4_define([lt_dict_add_subkey],\n[m4_define([$1($2:$3)], [$4])])\n\n\n# lt_dict_fetch(DICT, KEY, [SUBKEY])\n# ----------------------------------\nm4_define([lt_dict_fetch],\n[m4_ifval([$3],\n\tm4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),\n    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])\n\n\n# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])\n# -----------------------------------------------------------------\nm4_define([lt_if_dict_fetch],\n[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],\n\t[$5],\n    [$6])])\n\n\n# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])\n# --------------------------------------------------------------\nm4_define([lt_dict_filter],\n[m4_if([$5], [], [],\n  [lt_join(m4_quote(m4_default([$4], [[, ]])),\n           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),\n\t\t      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl\n])\n\n# ltversion.m4 -- version numbers\t\t\t-*- Autoconf -*-\n#\n#   Copyright (C) 2004 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# @configure_input@\n\n# serial 3293 ltversion.m4\n# This file is part of GNU Libtool\n\nm4_define([LT_PACKAGE_VERSION], [2.4])\nm4_define([LT_PACKAGE_REVISION], [1.3293])\n\nAC_DEFUN([LTVERSION_VERSION],\n[macro_version='2.4'\nmacro_revision='1.3293'\n_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])\n_LT_DECL(, macro_revision, 0)\n])\n\n# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-\n#\n#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.\n#   Written by Scott James Remnant, 2004.\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\n# serial 5 lt~obsolete.m4\n\n# These exist entirely to fool aclocal when bootstrapping libtool.\n#\n# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)\n# which have later been changed to m4_define as they aren't part of the\n# exported API, or moved to Autoconf or Automake where they belong.\n#\n# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN\n# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us\n# using a macro with the same name in our local m4/libtool.m4 it'll\n# pull the old libtool.m4 in (it doesn't see our shiny new m4_define\n# and doesn't know about Autoconf macros at all.)\n#\n# So we provide this file, which has a silly filename so it's always\n# included after everything else.  This provides aclocal with the\n# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything\n# because those macros already exist, or will be overwritten later.\n# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. \n#\n# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.\n# Yes, that means every name once taken will need to remain here until\n# we give up compatibility with versions before 1.7, at which point\n# we need to keep only those names which we still refer to.\n\n# This is to help aclocal find these macros, as it can't see m4_define.\nAC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])\n\nm4_ifndef([AC_LIBTOOL_LINKER_OPTION],\t[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])\nm4_ifndef([AC_PROG_EGREP],\t\t[AC_DEFUN([AC_PROG_EGREP])])\nm4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_AC_SHELL_INIT],\t\t[AC_DEFUN([_LT_AC_SHELL_INIT])])\nm4_ifndef([_LT_AC_SYS_LIBPATH_AIX],\t[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])\nm4_ifndef([_LT_PROG_LTMAIN],\t\t[AC_DEFUN([_LT_PROG_LTMAIN])])\nm4_ifndef([_LT_AC_TAGVAR],\t\t[AC_DEFUN([_LT_AC_TAGVAR])])\nm4_ifndef([AC_LTDL_ENABLE_INSTALL],\t[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])\nm4_ifndef([AC_LTDL_PREOPEN],\t\t[AC_DEFUN([AC_LTDL_PREOPEN])])\nm4_ifndef([_LT_AC_SYS_COMPILER],\t[AC_DEFUN([_LT_AC_SYS_COMPILER])])\nm4_ifndef([_LT_AC_LOCK],\t\t[AC_DEFUN([_LT_AC_LOCK])])\nm4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],\t[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])\nm4_ifndef([_LT_AC_TRY_DLOPEN_SELF],\t[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])\nm4_ifndef([AC_LIBTOOL_PROG_CC_C_O],\t[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])\nm4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])\nm4_ifndef([AC_LIBTOOL_OBJDIR],\t\t[AC_DEFUN([AC_LIBTOOL_OBJDIR])])\nm4_ifndef([AC_LTDL_OBJDIR],\t\t[AC_DEFUN([AC_LTDL_OBJDIR])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])\nm4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],\t[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])\nm4_ifndef([AC_PATH_MAGIC],\t\t[AC_DEFUN([AC_PATH_MAGIC])])\nm4_ifndef([AC_PROG_LD_GNU],\t\t[AC_DEFUN([AC_PROG_LD_GNU])])\nm4_ifndef([AC_PROG_LD_RELOAD_FLAG],\t[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])\nm4_ifndef([AC_DEPLIBS_CHECK_METHOD],\t[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])\nm4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])\nm4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])\nm4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],\t[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])\nm4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],\t[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])\nm4_ifndef([LT_AC_PROG_EGREP],\t\t[AC_DEFUN([LT_AC_PROG_EGREP])])\nm4_ifndef([LT_AC_PROG_SED],\t\t[AC_DEFUN([LT_AC_PROG_SED])])\nm4_ifndef([_LT_CC_BASENAME],\t\t[AC_DEFUN([_LT_CC_BASENAME])])\nm4_ifndef([_LT_COMPILER_BOILERPLATE],\t[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])\nm4_ifndef([_LT_LINKER_BOILERPLATE],\t[AC_DEFUN([_LT_LINKER_BOILERPLATE])])\nm4_ifndef([_AC_PROG_LIBTOOL],\t\t[AC_DEFUN([_AC_PROG_LIBTOOL])])\nm4_ifndef([AC_LIBTOOL_SETUP],\t\t[AC_DEFUN([AC_LIBTOOL_SETUP])])\nm4_ifndef([_LT_AC_CHECK_DLFCN],\t\t[AC_DEFUN([_LT_AC_CHECK_DLFCN])])\nm4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],\t[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])\nm4_ifndef([_LT_AC_TAGCONFIG],\t\t[AC_DEFUN([_LT_AC_TAGCONFIG])])\nm4_ifndef([AC_DISABLE_FAST_INSTALL],\t[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])\nm4_ifndef([_LT_AC_LANG_CXX],\t\t[AC_DEFUN([_LT_AC_LANG_CXX])])\nm4_ifndef([_LT_AC_LANG_F77],\t\t[AC_DEFUN([_LT_AC_LANG_F77])])\nm4_ifndef([_LT_AC_LANG_GCJ],\t\t[AC_DEFUN([_LT_AC_LANG_GCJ])])\nm4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])\nm4_ifndef([_LT_AC_LANG_C_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])\nm4_ifndef([_LT_AC_LANG_CXX_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])\nm4_ifndef([_LT_AC_LANG_F77_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])\nm4_ifndef([_LT_AC_LANG_GCJ_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])\nm4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],\t[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])\nm4_ifndef([_LT_AC_LANG_RC_CONFIG],\t[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])\nm4_ifndef([AC_LIBTOOL_CONFIG],\t\t[AC_DEFUN([AC_LIBTOOL_CONFIG])])\nm4_ifndef([_LT_AC_FILE_LTDLL_C],\t[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])\nm4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],\t[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])\nm4_ifndef([_LT_AC_PROG_CXXCPP],\t\t[AC_DEFUN([_LT_AC_PROG_CXXCPP])])\nm4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],\t[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])\nm4_ifndef([_LT_PROG_ECHO_BACKSLASH],\t[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])\nm4_ifndef([_LT_PROG_F77],\t\t[AC_DEFUN([_LT_PROG_F77])])\nm4_ifndef([_LT_PROG_FC],\t\t[AC_DEFUN([_LT_PROG_FC])])\nm4_ifndef([_LT_PROG_CXX],\t\t[AC_DEFUN([_LT_PROG_CXX])])\n\n"},{"id":13387,"name":"cextern/expat/doc","nodeType":"Package"},{"id":13388,"name":"style.css","nodeType":"TextFile","path":"cextern/expat/doc","text":"body {\n  background-color: white;\n  border: 0px;\n  margin: 0px;\n  padding: 0px;\n}\n\n.corner {\n  width: 200px;\n  height: 80px;\n  text-align: center;\n}\n\n.banner {\n  background-color: rgb(110,139,61);\n  color: rgb(255,236,176);\n  padding-left: 2em;\n}\n\n.banner h1 {\n  font-size: 200%;\n}\n\n.content {\n  padding: 0em 2em 1em 2em;\n}\n\n.releaseno {\n  background-color: rgb(110,139,61);\n  color: rgb(255,236,176);\n  padding-bottom: 0.3em;\n  padding-top: 0.5em;\n  text-align: center;\n  font-weight: bold;\n}\n\n.noborder {\n  border-width: 0px;\n}\n\n.eg {\n  padding-left: 1em;\n  padding-top: .5em;\n  padding-bottom: .5em;\n  border: solid thin;\n  margin: 1em 0;\n  background-color: tan;\n  margin-left: 2em;\n  margin-right: 10%;\n}\n\n.pseudocode {\n  padding-left: 1em;\n  padding-top: .5em;\n  padding-bottom: .5em;\n  border: solid thin;\n  margin: 1em 0;\n  background-color: rgb(250,220,180);\n  margin-left: 2em;\n  margin-right: 10%;\n}\n\n.handler {\n  width: 100%;\n  border-top-width: thin;  \n  margin-bottom: 1em;\n}\n\n.handler p {\n  margin-left: 2em;\n}\n\n.setter {\n  font-weight: bold;\n}\n\n.signature {\n  color: navy;\n}\n\n.fcndec {\n  width: 100%;\n  border-top-width: thin;\n  font-weight: bold;\n}\n\n.fcndef {\n  margin-left: 2em;\n  margin-bottom: 2em;\n}\n\ndd {\n  margin-bottom: 2em;\n}\n\n.cpp-symbols dt {\n  font-family: monospace;\n}\n.cpp-symbols dd {\n  margin-bottom: 1em;\n}\n"},{"id":13389,"name":"xmlwf.sgml","nodeType":"TextFile","path":"cextern/expat/doc","text":"<!doctype refentry PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\" [\n\n<!-- Process this file with docbook-to-man to generate an nroff manual\n     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view\n     the manual page with: `docbook-to-man manpage.sgml | nroff -man |\n     less'.  A typical entry in a Makefile or Makefile.am is:\n\nmanpage.1: manpage.sgml\n\tdocbook-to-man $< > $@\n  -->\n\n  <!-- Fill in your name for FIRSTNAME and SURNAME. -->\n  <!ENTITY dhfirstname \"<firstname>Scott</firstname>\">\n  <!ENTITY dhsurname   \"<surname>Bronson</surname>\">\n  <!-- Please adjust the date whenever revising the manpage. -->\n  <!ENTITY dhdate      \"<date>December  5, 2001</date>\">\n  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are\n       allowed: see man(7), man(1). -->\n  <!ENTITY dhsection   \"<manvolnum>1</manvolnum>\">\n  <!ENTITY dhemail     \"<email>bronson@rinspin.com</email>\">\n  <!ENTITY dhusername  \"Scott Bronson\">\n  <!ENTITY dhucpackage \"<refentrytitle>XMLWF</refentrytitle>\">\n  <!ENTITY dhpackage   \"xmlwf\">\n\n  <!ENTITY debian      \"<productname>Debian GNU/Linux</productname>\">\n  <!ENTITY gnu         \"<acronym>GNU</acronym>\">\n]>\n\n<refentry>\n  <refentryinfo>\n    <address>\n      &dhemail;\n    </address>\n    <author>\n      &dhfirstname;\n      &dhsurname;\n    </author>\n    <copyright>\n      <year>2001</year>\n      <holder>&dhusername;</holder>\n    </copyright>\n    &dhdate;\n  </refentryinfo>\n  <refmeta>\n    &dhucpackage;\n\n    &dhsection;\n  </refmeta>\n  <refnamediv>\n    <refname>&dhpackage;</refname>\n\n    <refpurpose>Determines if an XML document is well-formed</refpurpose>\n  </refnamediv>\n  <refsynopsisdiv>\n    <cmdsynopsis>\n      <command>&dhpackage;</command>\n\t  <arg><option>-s</option></arg>\n\t  <arg><option>-n</option></arg>\n\t  <arg><option>-p</option></arg>\n\t  <arg><option>-x</option></arg>\n\n\t  <arg><option>-e <replaceable>encoding</replaceable></option></arg>\n\t  <arg><option>-w</option></arg>\n\n\t  <arg><option>-d <replaceable>output-dir</replaceable></option></arg>\n\t  <arg><option>-c</option></arg>\n\t  <arg><option>-m</option></arg>\n\n\t  <arg><option>-r</option></arg>\n\t  <arg><option>-t</option></arg>\n\n\t  <arg><option>-v</option></arg>\n\n\t  <arg>file ...</arg>\n    </cmdsynopsis>\n  </refsynopsisdiv>\n \n  <refsect1>\n    <title>DESCRIPTION</title>\n\n    <para>\n\t<command>&dhpackage;</command> uses the Expat library to\n\tdetermine if an XML document is well-formed.  It is\n\tnon-validating.\n\t</para>\n\n\t<para>\n\tIf you do not specify any files on the command-line, and you\n\thave a recent version of <command>&dhpackage;</command>, the\n\tinput file will be read from standard input.\n\t</para>\n\n  </refsect1>\n\n  <refsect1>\n    <title>WELL-FORMED DOCUMENTS</title>\n\n\t<para>\n\t  A well-formed document must adhere to the\n\t  following rules:\n\t</para>\n\n\t<itemizedlist>\n      <listitem><para>\n\t    The file begins with an XML declaration.  For instance,\n\t\t<literal>&lt;?xml version=\"1.0\" standalone=\"yes\"?&gt;</literal>.\n\t\t<emphasis>NOTE:</emphasis>\n\t\t<command>&dhpackage;</command> does not currently\n\t\tcheck for a valid XML declaration.\n      </para></listitem>\n      <listitem><para>\n\t\tEvery start tag is either empty (&lt;tag/&gt;)\n\t\tor has a corresponding end tag.\n      </para></listitem>\n      <listitem><para>\n\t    There is exactly one root element.  This element must contain\n\t\tall other elements in the document.  Only comments, white\n\t\tspace, and processing instructions may come after the close\n\t\tof the root element.\n      </para></listitem>\n      <listitem><para>\n\t\tAll elements nest properly.\n      </para></listitem>\n      <listitem><para>\n\t\tAll attribute values are enclosed in quotes (either single\n\t\tor double).\n      </para></listitem>\n    </itemizedlist>\n\n\t<para>\n\t  If the document has a DTD, and it strictly complies with that\n\t  DTD, then the document is also considered <emphasis>valid</emphasis>.\n\t  <command>&dhpackage;</command> is a non-validating parser --\n\t  it does not check the DTD.  However, it does support\n\t  external entities (see the <option>-x</option> option).\n\t</para>\n  </refsect1>\n\n  <refsect1>\n    <title>OPTIONS</title>\n\n<para>\nWhen an option includes an argument, you may specify the argument either\nseparately (\"<option>-d</option> output\") or concatenated with the\noption (\"<option>-d</option>output\").  <command>&dhpackage;</command>\nsupports both.\n</para>\n\n    <variablelist>\n\n      <varlistentry>\n        <term><option>-c</option></term>\n        <listitem>\n\t\t<para>\n  If the input file is well-formed and <command>&dhpackage;</command>\n  doesn't encounter any errors, the input file is simply copied to\n  the output directory unchanged.\n  This implies no namespaces (turns off <option>-n</option>) and\n  requires <option>-d</option> to specify an output file.\n  \t\t</para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-d output-dir</option></term>\n        <listitem>\n\t\t<para>\n  Specifies a directory to contain transformed\n  representations of the input files.\n  By default, <option>-d</option> outputs a canonical representation\n  (described below).\n  You can select different output formats using <option>-c</option>\n  and <option>-m</option>.\n\t  </para>\n\t  <para>\n  The output filenames will\n  be exactly the same as the input filenames or \"STDIN\" if the input is\n  coming from standard input.  Therefore, you must be careful that the\n  output file does not go into the same directory as the input\n  file.  Otherwise, <command>&dhpackage;</command> will delete the\n  input file before it generates the output file (just like running\n  <literal>cat &lt; file &gt; file</literal> in most shells).\n\t  </para>\n\t  <para> \n  Two structurally equivalent XML documents have a byte-for-byte\n  identical canonical XML representation.\n  Note that ignorable white space is considered significant and\n  is treated equivalently to data.\n  More on canonical XML can be found at\n  http://www.jclark.com/xml/canonxml.html .\n\t  </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-e encoding</option></term>\n        <listitem>\n\t\t<para>\n   Specifies the character encoding for the document, overriding\n   any document encoding declaration.  <command>&dhpackage;</command>\n   supports four built-in encodings:\n   \t<literal>US-ASCII</literal>,\n\t<literal>UTF-8</literal>,\n\t<literal>UTF-16</literal>, and\n\t<literal>ISO-8859-1</literal>.\n   Also see the <option>-w</option> option.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-m</option></term>\n        <listitem>\n\t\t<para>\n  Outputs some strange sort of XML file that completely\n  describes the the input file, including character postitions.\n  Requires <option>-d</option> to specify an output file.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-n</option></term>\n        <listitem>\n\t\t<para>\n  Turns on namespace processing.  (describe namespaces)\n  <option>-c</option> disables namespaces.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-p</option></term>\n        <listitem>\n\t\t<para>\n    Tells xmlwf to process external DTDs and parameter\n    entities.\n\t </para>\n\t <para>\n   Normally <command>&dhpackage;</command> never parses parameter\n   entities.  <option>-p</option> tells it to always parse them.\n   <option>-p</option> implies <option>-x</option>.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-r</option></term>\n        <listitem>\n\t\t<para>\n   Normally <command>&dhpackage;</command> memory-maps the XML file\n   before parsing; this can result in faster parsing on many\n   platforms.\n   <option>-r</option> turns off memory-mapping and uses normal file\n   IO calls instead.\n   Of course, memory-mapping is automatically turned off\n   when reading from standard input.\n\t   </para>\n\t\t<para>\n   Use of memory-mapping can cause some platforms to report\n   substantially higher memory usage for\n   <command>&dhpackage;</command>, but this appears to be a matter of\n   the operating system reporting memory in a strange way; there is\n   not a leak in <command>&dhpackage;</command>.\n           </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-s</option></term>\n        <listitem>\n\t\t<para>\n  Prints an error if the document is not standalone. \n  A document is standalone if it has no external subset and no\n  references to parameter entities.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-t</option></term>\n        <listitem>\n\t\t<para>\n  Turns on timings.  This tells Expat to parse the entire file,\n  but not perform any processing.\n  This gives a fairly accurate idea of the raw speed of Expat itself\n  without client overhead.\n  <option>-t</option> turns off most of the output options\n  (<option>-d</option>, <option>-m</option>, <option>-c</option>,\n  ...).\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-v</option></term>\n        <listitem>\n\t\t<para>\n  Prints the version of the Expat library being used, including some\n  information on the compile-time configuration of the library, and\n  then exits.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-w</option></term>\n        <listitem>\n\t\t<para>\n  Enables support for Windows code pages.\n  Normally, <command>&dhpackage;</command> will throw an error if it\n  runs across an encoding that it is not equipped to handle itself.  With\n  <option>-w</option>, &dhpackage; will try to use a Windows code\n  page.  See also <option>-e</option>.\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>-x</option></term>\n        <listitem>\n\t\t<para>\n  Turns on parsing external entities.\n  </para>\n<para>\n  Non-validating parsers are not required to resolve external\n  entities, or even expand entities at all.\n  Expat always expands internal entities (?),\n  but external entity parsing must be enabled explicitly.\n  </para>\n  <para>\n  External entities are simply entities that obtain their\n  data from outside the XML file currently being parsed.\n  </para>\n  <para>\n  This is an example of an internal entity:\n<literallayout>\n&lt;!ENTITY vers '1.0.2'&gt;\n</literallayout>\n  </para>\n  <para>\n  And here are some examples of external entities:\n\n<literallayout>\n&lt;!ENTITY header SYSTEM \"header-&amp;vers;.xml\"&gt;  (parsed)\n&lt;!ENTITY logo SYSTEM \"logo.png\" PNG&gt;         (unparsed)\n</literallayout>\n\n\t   </para>\n        </listitem>\n      </varlistentry>\n\n      <varlistentry>\n        <term><option>--</option></term>\n        <listitem>\n\t\t<para>\n    (Two hyphens.)\n    Terminates the list of options.  This is only needed if a filename\n    starts with a hyphen.  For example:\n\t   </para>\n<literallayout>\n&dhpackage; -- -myfile.xml\n</literallayout>\n\t\t<para>\n    will run <command>&dhpackage;</command> on the file\n    <filename>-myfile.xml</filename>.\n\t   </para>\n        </listitem>\n      </varlistentry>\n    </variablelist>\n\n\t<para>\n    Older versions of <command>&dhpackage;</command> do not support\n    reading from standard input.\n\t</para>\n  </refsect1>\n\n  <refsect1>\n  <title>OUTPUT</title>\n    <para>\n\tIf an input file is not well-formed,\n\t<command>&dhpackage;</command> prints a single line describing\n\tthe problem to standard output.  If a file is well formed,\n\t<command>&dhpackage;</command> outputs nothing.\n\tNote that the result code is <emphasis>not</emphasis> set.\n\t</para>\n  </refsect1>\n  \n  <refsect1>\n    <title>BUGS</title>\n\t<para>\n\t<command>&dhpackage;</command> returns a 0 - noerr result,\n\teven if the file is not well-formed.  There is no good way for\n\ta program to use <command>&dhpackage;</command> to quickly\n\tcheck a file -- it must parse <command>&dhpackage;</command>'s\n\tstandard output.\n\t</para>\n\t<para>\n\tThe errors should go to standard error, not standard output.\n\t</para>\n\t<para>\n\tThere should be a way to get <option>-d</option> to send its\n\toutput to standard output rather than forcing the user to send\n\tit to a file.\n\t</para>\n\t<para>\n\tI have no idea why anyone would want to use the\n\t<option>-d</option>, <option>-c</option>, and\n\t<option>-m</option> options.  If someone could explain it to\n\tme, I'd like to add this information to this manpage.\n\t</para>\n  </refsect1>\n\n  <refsect1>\n    <title>ALTERNATIVES</title>\n\t<para>\n\t  Here are some XML validators on the web:\n\n<literallayout>\nhttp://www.hcrc.ed.ac.uk/~richard/xml-check.html\nhttp://www.stg.brown.edu/service/xmlvalid/\nhttp://www.scripting.com/frontier5/xml/code/xmlValidator.html\nhttp://www.xml.com/pub/a/tools/ruwf/check.html\n</literallayout>\n\n\t\t </para>\n  </refsect1>\n\n  <refsect1>\n    <title>SEE ALSO</title>\n\t<para>\n\n<literallayout>\nThe Expat home page:        http://www.libexpat.org/\nThe W3 XML specification:   http://www.w3.org/TR/REC-xml\n</literallayout>\n\n\t</para>\n  </refsect1>\n\n  <refsect1>\n    <title>AUTHOR</title>\n    <para>\n\t  This manual page was written by &dhusername; &dhemail; for\n      the &debian; system (but may be used by others).  Permission is\n      granted to copy, distribute and/or modify this document under\n      the terms of the <acronym>GNU</acronym> Free Documentation\n      License, Version 1.1.\n\t</para>\n  </refsect1>\n</refentry>\n\n<!-- Keep this comment at the end of the file\nLocal variables:\nmode: sgml\nsgml-omittag:t\nsgml-shorttag:t\nsgml-minimize-attributes:nil\nsgml-always-quote-attributes:t\nsgml-indent-step:2\nsgml-indent-data:t\nsgml-parent-document:nil\nsgml-default-dtd-file:nil\nsgml-exposed-tags:nil\nsgml-local-catalogs:nil\nsgml-local-ecat-files:nil\nEnd:\n-->\n"},{"id":13390,"name":"xmlwf.1","nodeType":"TextFile","path":"cextern/expat/doc","text":".\\\" This manpage has been automatically generated by docbook2man \n.\\\" from a DocBook document.  This tool can be found at:\n.\\\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> \n.\\\" Please send any bug reports, improvements, comments, patches, \n.\\\" etc. to Steve Cheng <steve@ggi-project.org>.\n.TH \"XMLWF\" \"1\" \"24 January 2003\" \"\" \"\"\n.SH NAME\nxmlwf \\- Determines if an XML document is well-formed\n.SH SYNOPSIS\n\n\\fBxmlwf\\fR [ \\fB-s\\fR]  [ \\fB-n\\fR]  [ \\fB-p\\fR]  [ \\fB-x\\fR]  [ \\fB-e \\fIencoding\\fB\\fR]  [ \\fB-w\\fR]  [ \\fB-d \\fIoutput-dir\\fB\\fR]  [ \\fB-c\\fR]  [ \\fB-m\\fR]  [ \\fB-r\\fR]  [ \\fB-t\\fR]  [ \\fB-v\\fR]  [ \\fBfile ...\\fR] \n\n.SH \"DESCRIPTION\"\n.PP\n\\fBxmlwf\\fR uses the Expat library to\ndetermine if an XML document is well-formed.  It is\nnon-validating.\n.PP\nIf you do not specify any files on the command-line, and you\nhave a recent version of \\fBxmlwf\\fR, the\ninput file will be read from standard input.\n.SH \"WELL-FORMED DOCUMENTS\"\n.PP\nA well-formed document must adhere to the\nfollowing rules:\n.TP 0.2i\n\\(bu\nThe file begins with an XML declaration.  For instance,\n<?xml version=\"1.0\" standalone=\"yes\"?>.\n\\fBNOTE:\\fR\n\\fBxmlwf\\fR does not currently\ncheck for a valid XML declaration.\n.TP 0.2i\n\\(bu\nEvery start tag is either empty (<tag/>)\nor has a corresponding end tag.\n.TP 0.2i\n\\(bu\nThere is exactly one root element.  This element must contain\nall other elements in the document.  Only comments, white\nspace, and processing instructions may come after the close\nof the root element.\n.TP 0.2i\n\\(bu\nAll elements nest properly.\n.TP 0.2i\n\\(bu\nAll attribute values are enclosed in quotes (either single\nor double).\n.PP\nIf the document has a DTD, and it strictly complies with that\nDTD, then the document is also considered \\fBvalid\\fR.\n\\fBxmlwf\\fR is a non-validating parser --\nit does not check the DTD.  However, it does support\nexternal entities (see the \\fB-x\\fR option).\n.SH \"OPTIONS\"\n.PP\nWhen an option includes an argument, you may specify the argument either\nseparately (\"\\fB-d\\fR output\") or concatenated with the\noption (\"\\fB-d\\fRoutput\").  \\fBxmlwf\\fR\nsupports both.\n.TP\n\\fB-c\\fR\nIf the input file is well-formed and \\fBxmlwf\\fR\ndoesn't encounter any errors, the input file is simply copied to\nthe output directory unchanged.\nThis implies no namespaces (turns off \\fB-n\\fR) and\nrequires \\fB-d\\fR to specify an output file.\n.TP\n\\fB-d output-dir\\fR\nSpecifies a directory to contain transformed\nrepresentations of the input files.\nBy default, \\fB-d\\fR outputs a canonical representation\n(described below).\nYou can select different output formats using \\fB-c\\fR\nand \\fB-m\\fR.\n\nThe output filenames will\nbe exactly the same as the input filenames or \"STDIN\" if the input is\ncoming from standard input.  Therefore, you must be careful that the\noutput file does not go into the same directory as the input\nfile.  Otherwise, \\fBxmlwf\\fR will delete the\ninput file before it generates the output file (just like running\ncat < file > file in most shells).\n\nTwo structurally equivalent XML documents have a byte-for-byte\nidentical canonical XML representation.\nNote that ignorable white space is considered significant and\nis treated equivalently to data.\nMore on canonical XML can be found at\nhttp://www.jclark.com/xml/canonxml.html .\n.TP\n\\fB-e encoding\\fR\nSpecifies the character encoding for the document, overriding\nany document encoding declaration.  \\fBxmlwf\\fR\nsupports four built-in encodings:\nUS-ASCII,\nUTF-8,\nUTF-16, and\nISO-8859-1.\nAlso see the \\fB-w\\fR option.\n.TP\n\\fB-m\\fR\nOutputs some strange sort of XML file that completely\ndescribes the input file, including character positions.\nRequires \\fB-d\\fR to specify an output file.\n.TP\n\\fB-n\\fR\nTurns on namespace processing.  (describe namespaces)\n\\fB-c\\fR disables namespaces.\n.TP\n\\fB-p\\fR\nTells xmlwf to process external DTDs and parameter\nentities.\n\nNormally \\fBxmlwf\\fR never parses parameter\nentities.  \\fB-p\\fR tells it to always parse them.\n\\fB-p\\fR implies \\fB-x\\fR.\n.TP\n\\fB-r\\fR\nNormally \\fBxmlwf\\fR memory-maps the XML file\nbefore parsing; this can result in faster parsing on many\nplatforms.\n\\fB-r\\fR turns off memory-mapping and uses normal file\nIO calls instead.\nOf course, memory-mapping is automatically turned off\nwhen reading from standard input.\n\nUse of memory-mapping can cause some platforms to report\nsubstantially higher memory usage for\n\\fBxmlwf\\fR, but this appears to be a matter of\nthe operating system reporting memory in a strange way; there is\nnot a leak in \\fBxmlwf\\fR.\n.TP\n\\fB-s\\fR\nPrints an error if the document is not standalone. \nA document is standalone if it has no external subset and no\nreferences to parameter entities.\n.TP\n\\fB-t\\fR\nTurns on timings.  This tells Expat to parse the entire file,\nbut not perform any processing.\nThis gives a fairly accurate idea of the raw speed of Expat itself\nwithout client overhead.\n\\fB-t\\fR turns off most of the output options\n(\\fB-d\\fR, \\fB-m\\fR, \\fB-c\\fR,\n\\&...).\n.TP\n\\fB-v\\fR\nPrints the version of the Expat library being used, including some\ninformation on the compile-time configuration of the library, and\nthen exits.\n.TP\n\\fB-w\\fR\nEnables support for Windows code pages.\nNormally, \\fBxmlwf\\fR will throw an error if it\nruns across an encoding that it is not equipped to handle itself.  With\n\\fB-w\\fR, xmlwf will try to use a Windows code\npage.  See also \\fB-e\\fR.\n.TP\n\\fB-x\\fR\nTurns on parsing external entities.\n\nNon-validating parsers are not required to resolve external\nentities, or even expand entities at all.\nExpat always expands internal entities (?),\nbut external entity parsing must be enabled explicitly.\n\nExternal entities are simply entities that obtain their\ndata from outside the XML file currently being parsed.\n\nThis is an example of an internal entity:\n\n.nf\n<!ENTITY vers '1.0.2'>\n.fi\n\nAnd here are some examples of external entities:\n\n.nf\n<!ENTITY header SYSTEM \"header-&vers;.xml\">  (parsed)\n<!ENTITY logo SYSTEM \"logo.png\" PNG>         (unparsed)\n.fi\n.TP\n\\fB--\\fR\n(Two hyphens.)\nTerminates the list of options.  This is only needed if a filename\nstarts with a hyphen.  For example:\n\n.nf\nxmlwf -- -myfile.xml\n.fi\n\nwill run \\fBxmlwf\\fR on the file\n\\fI-myfile.xml\\fR.\n.PP\nOlder versions of \\fBxmlwf\\fR do not support\nreading from standard input.\n.SH \"OUTPUT\"\n.PP\nIf an input file is not well-formed,\n\\fBxmlwf\\fR prints a single line describing\nthe problem to standard output.  If a file is well formed,\n\\fBxmlwf\\fR outputs nothing.\nNote that the result code is \\fBnot\\fR set.\n.SH \"BUGS\"\n.PP\nAccording to the W3C standard, an XML file without a\ndeclaration at the beginning is not considered well-formed.\nHowever, \\fBxmlwf\\fR allows this to pass.\n.PP\n\\fBxmlwf\\fR returns a 0 - noerr result,\neven if the file is not well-formed.  There is no good way for\na program to use \\fBxmlwf\\fR to quickly\ncheck a file -- it must parse \\fBxmlwf\\fR's\nstandard output.\n.PP\nThe errors should go to standard error, not standard output.\n.PP\nThere should be a way to get \\fB-d\\fR to send its\noutput to standard output rather than forcing the user to send\nit to a file.\n.PP\nI have no idea why anyone would want to use the\n\\fB-d\\fR, \\fB-c\\fR, and\n\\fB-m\\fR options.  If someone could explain it to\nme, I'd like to add this information to this manpage.\n.SH \"ALTERNATIVES\"\n.PP\nHere are some XML validators on the web:\n\n.nf\nhttp://www.hcrc.ed.ac.uk/~richard/xml-check.html\nhttp://www.stg.brown.edu/service/xmlvalid/\nhttp://www.scripting.com/frontier5/xml/code/xmlValidator.html\nhttp://www.xml.com/pub/a/tools/ruwf/check.html\n.fi\n.SH \"SEE ALSO\"\n.PP\n\n.nf\nThe Expat home page:        http://www.libexpat.org/\nThe W3 XML specification:   http://www.w3.org/TR/REC-xml\n.fi\n.SH \"AUTHOR\"\n.PP\nThis manual page was written by Scott Bronson <bronson@rinspin.com> for\nthe Debian GNU/Linux system (but may be used by others).  Permission is\ngranted to copy, distribute and/or modify this document under\nthe terms of the GNU Free Documentation\nLicense, Version 1.1.\n"},{"id":13391,"name":"libtool.m4","nodeType":"TextFile","path":"cextern/expat/m4","text":"# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-\n#\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,\n#                 Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n# This file is free software; the Free Software Foundation gives\n# unlimited permission to copy and/or distribute it, with or without\n# modifications, as long as this notice is preserved.\n\nm4_define([_LT_COPYING], [dnl\n#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,\n#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,\n#                 Inc.\n#   Written by Gordon Matzigkeit, 1996\n#\n#   This file is part of GNU Libtool.\n#\n# GNU Libtool is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License as\n# published by the Free Software Foundation; either version 2 of\n# the License, or (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html, or\n# obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n])\n\n# serial 57 LT_INIT\n\n\n# LT_PREREQ(VERSION)\n# ------------------\n# Complain and exit if this libtool version is less that VERSION.\nm4_defun([LT_PREREQ],\n[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,\n       [m4_default([$3],\n\t\t   [m4_fatal([Libtool version $1 or higher is required],\n\t\t             63)])],\n       [$2])])\n\n\n# _LT_CHECK_BUILDDIR\n# ------------------\n# Complain if the absolute build directory name contains unusual characters\nm4_defun([_LT_CHECK_BUILDDIR],\n[case `pwd` in\n  *\\ * | *\\\t*)\n    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;\nesac\n])\n\n\n# LT_INIT([OPTIONS])\n# ------------------\nAC_DEFUN([LT_INIT],\n[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT\nAC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl\nAC_BEFORE([$0], [LT_LANG])dnl\nAC_BEFORE([$0], [LT_OUTPUT])dnl\nAC_BEFORE([$0], [LTDL_INIT])dnl\nm4_require([_LT_CHECK_BUILDDIR])dnl\n\ndnl Autoconf doesn't catch unexpanded LT_ macros by default:\nm4_pattern_forbid([^_?LT_[A-Z_]+$])dnl\nm4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl\ndnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4\ndnl unless we require an AC_DEFUNed macro:\nAC_REQUIRE([LTOPTIONS_VERSION])dnl\nAC_REQUIRE([LTSUGAR_VERSION])dnl\nAC_REQUIRE([LTVERSION_VERSION])dnl\nAC_REQUIRE([LTOBSOLETE_VERSION])dnl\nm4_require([_LT_PROG_LTMAIN])dnl\n\n_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])\n\ndnl Parse OPTIONS\n_LT_SET_OPTIONS([$0], [$1])\n\n# This can be used to rebuild libtool when needed\nLIBTOOL_DEPS=\"$ltmain\"\n\n# Always use our own libtool.\nLIBTOOL='$(SHELL) $(top_builddir)/libtool'\nAC_SUBST(LIBTOOL)dnl\n\n_LT_SETUP\n\n# Only expand once:\nm4_define([LT_INIT])\n])# LT_INIT\n\n# Old names:\nAU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])\nAU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PROG_LIBTOOL], [])\ndnl AC_DEFUN([AM_PROG_LIBTOOL], [])\n\n\n# _LT_CC_BASENAME(CC)\n# -------------------\n# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.\nm4_defun([_LT_CC_BASENAME],\n[for cc_temp in $1\"\"; do\n  case $cc_temp in\n    compile | *[[\\\\/]]compile | ccache | *[[\\\\/]]ccache ) ;;\n    distcc | *[[\\\\/]]distcc | purify | *[[\\\\/]]purify ) ;;\n    \\-*) ;;\n    *) break;;\n  esac\ndone\ncc_basename=`$ECHO \"$cc_temp\" | $SED \"s%.*/%%; s%^$host_alias-%%\"`\n])\n\n\n# _LT_FILEUTILS_DEFAULTS\n# ----------------------\n# It is okay to use these file commands and assume they have been set\n# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.\nm4_defun([_LT_FILEUTILS_DEFAULTS],\n[: ${CP=\"cp -f\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n])# _LT_FILEUTILS_DEFAULTS\n\n\n# _LT_SETUP\n# ---------\nm4_defun([_LT_SETUP],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl\n\n_LT_DECL([], [host_alias], [0], [The host system])dnl\n_LT_DECL([], [host], [0])dnl\n_LT_DECL([], [host_os], [0])dnl\ndnl\n_LT_DECL([], [build_alias], [0], [The build system])dnl\n_LT_DECL([], [build], [0])dnl\n_LT_DECL([], [build_os], [0])dnl\ndnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\ndnl\nAC_REQUIRE([AC_PROG_LN_S])dnl\ntest -z \"$LN_S\" && LN_S=\"ln -s\"\n_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl\ndnl\nAC_REQUIRE([LT_CMD_MAX_LEN])dnl\n_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally \"o\")])dnl\n_LT_DECL([], [exeext], [0], [Executable file suffix (normally \"\")])dnl\ndnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nm4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl\nm4_require([_LT_CMD_RELOAD])dnl\nm4_require([_LT_CHECK_MAGIC_METHOD])dnl\nm4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl\nm4_require([_LT_CMD_OLD_ARCHIVE])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_WITH_SYSROOT])dnl\n\n_LT_CONFIG_LIBTOOL_INIT([\n# See if we are running on zsh, and set the options which allow our\n# commands through without removal of \\ escapes INIT.\nif test -n \"\\${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n])\nif test -n \"${ZSH_VERSION+set}\" ; then\n   setopt NO_GLOB_SUBST\nfi\n\n_LT_CHECK_OBJDIR\n\nm4_require([_LT_TAG_COMPILER])dnl\n\ncase $host_os in\naix3*)\n  # AIX sometimes has problems with the GCC collect2 program.  For some\n  # reason, if we set the COLLECT_NAMES environment variable, the problems\n  # vanish in a puff of smoke.\n  if test \"X${COLLECT_NAMES+set}\" != Xset; then\n    COLLECT_NAMES=\n    export COLLECT_NAMES\n  fi\n  ;;\nesac\n\n# Global variables:\nofile=libtool\ncan_build_shared=yes\n\n# All known linkers require a `.a' archive for static linking (except MSVC,\n# which needs '.lib').\nlibext=a\n\nwith_gnu_ld=\"$lt_cv_prog_gnu_ld\"\n\nold_CC=\"$CC\"\nold_CFLAGS=\"$CFLAGS\"\n\n# Set sane defaults for various variables\ntest -z \"$CC\" && CC=cc\ntest -z \"$LTCC\" && LTCC=$CC\ntest -z \"$LTCFLAGS\" && LTCFLAGS=$CFLAGS\ntest -z \"$LD\" && LD=ld\ntest -z \"$ac_objext\" && ac_objext=o\n\n_LT_CC_BASENAME([$compiler])\n\n# Only perform the check for file, if the check method requires it\ntest -z \"$MAGIC_CMD\" && MAGIC_CMD=file\ncase $deplibs_check_method in\nfile_magic*)\n  if test \"$file_magic_cmd\" = '$MAGIC_CMD'; then\n    _LT_PATH_MAGIC\n  fi\n  ;;\nesac\n\n# Use C for the default configuration in the libtool script\nLT_SUPPORTED_TAG([CC])\n_LT_LANG_C_CONFIG\n_LT_LANG_DEFAULT_CONFIG\n_LT_CONFIG_COMMANDS\n])# _LT_SETUP\n\n\n# _LT_PREPARE_SED_QUOTE_VARS\n# --------------------------\n# Define a few sed substitution that help us do robust quoting.\nm4_defun([_LT_PREPARE_SED_QUOTE_VARS],\n[# Backslashify metacharacters that are still active within\n# double-quoted strings.\nsed_quote_subst='s/\\([[\"`$\\\\]]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([[\"`\\\\]]\\)/\\\\\\1/g'\n\n# Sed substitution to delay expansion of an escaped shell variable in a\n# double_quote_subst'ed string.\ndelay_variable_subst='s/\\\\\\\\\\\\\\\\\\\\\\$/\\\\\\\\\\\\$/g'\n\n# Sed substitution to delay expansion of an escaped single quote.\ndelay_single_quote_subst='s/'\\''/'\\'\\\\\\\\\\\\\\'\\''/g'\n\n# Sed substitution to avoid accidental globbing in evaled expressions\nno_glob_subst='s/\\*/\\\\\\*/g'\n])\n\n# _LT_PROG_LTMAIN\n# ---------------\n# Note that this code is called both from `configure', and `config.status'\n# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,\n# `config.status' has no value for ac_aux_dir unless we are using Automake,\n# so we pass a copy along to make sure it has a sensible value anyway.\nm4_defun([_LT_PROG_LTMAIN],\n[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl\n_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])\nltmain=\"$ac_aux_dir/ltmain.sh\"\n])# _LT_PROG_LTMAIN\n\n\n## ------------------------------------- ##\n## Accumulate code for creating libtool. ##\n## ------------------------------------- ##\n\n# So that we can recreate a full libtool script including additional\n# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS\n# in macros and then make a single call at the end using the `libtool'\n# label.\n\n\n# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])\n# ----------------------------------------\n# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL_INIT],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_INIT])\n\n\n# _LT_CONFIG_LIBTOOL([COMMANDS])\n# ------------------------------\n# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.\nm4_define([_LT_CONFIG_LIBTOOL],\n[m4_ifval([$1],\n          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],\n                     [$1\n])])])\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])\n\n\n# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])\n# -----------------------------------------------------\nm4_defun([_LT_CONFIG_SAVE_COMMANDS],\n[_LT_CONFIG_LIBTOOL([$1])\n_LT_CONFIG_LIBTOOL_INIT([$2])\n])\n\n\n# _LT_FORMAT_COMMENT([COMMENT])\n# -----------------------------\n# Add leading comment marks to the start of each line, and a trailing\n# full-stop to the whole comment if one is not present already.\nm4_define([_LT_FORMAT_COMMENT],\n[m4_ifval([$1], [\nm4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],\n              [['`$\\]], [\\\\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])\n)])\n\n\n\n## ------------------------ ##\n## FIXME: Eliminate VARNAME ##\n## ------------------------ ##\n\n\n# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])\n# -------------------------------------------------------------------\n# CONFIGNAME is the name given to the value in the libtool script.\n# VARNAME is the (base) name used in the configure script.\n# VALUE may be 0, 1 or 2 for a computed quote escaped value based on\n# VARNAME.  Any other value will be used directly.\nm4_define([_LT_DECL],\n[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],\n    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],\n\t[m4_ifval([$1], [$1], [$2])])\n    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])\n    m4_ifval([$4],\n\t[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])\n    lt_dict_add_subkey([lt_decl_dict], [$2],\n\t[tagged?], [m4_ifval([$5], [yes], [no])])])\n])\n\n\n# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])\n# --------------------------------------------------------\nm4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])\n\n\n# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_tag_varnames],\n[_lt_decl_filter([tagged?], [yes], $@)])\n\n\n# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])\n# ---------------------------------------------------------\nm4_define([_lt_decl_filter],\n[m4_case([$#],\n  [0], [m4_fatal([$0: too few arguments: $#])],\n  [1], [m4_fatal([$0: too few arguments: $#: $1])],\n  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],\n  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],\n  [lt_dict_filter([lt_decl_dict], $@)])[]dnl\n])\n\n\n# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])\n# --------------------------------------------------\nm4_define([lt_decl_quote_varnames],\n[_lt_decl_filter([value], [1], $@)])\n\n\n# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_dquote_varnames],\n[_lt_decl_filter([value], [2], $@)])\n\n\n# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])\n# ---------------------------------------------------\nm4_define([lt_decl_varnames_tagged],\n[m4_assert([$# <= 2])dnl\n_$0(m4_quote(m4_default([$1], [[, ]])),\n    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),\n    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])\nm4_define([_lt_decl_varnames_tagged],\n[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])\n\n\n# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])\n# ------------------------------------------------\nm4_define([lt_decl_all_varnames],\n[_$0(m4_quote(m4_default([$1], [[, ]])),\n     m4_if([$2], [],\n\t   m4_quote(lt_decl_varnames),\n\tm4_quote(m4_shift($@))))[]dnl\n])\nm4_define([_lt_decl_all_varnames],\n[lt_join($@, lt_decl_varnames_tagged([$1],\n\t\t\tlt_decl_tag_varnames([[, ]], m4_shift($@))))dnl\n])\n\n\n# _LT_CONFIG_STATUS_DECLARE([VARNAME])\n# ------------------------------------\n# Quote a variable value, and forward it to `config.status' so that its\n# declaration there will have the same value as in `configure'.  VARNAME\n# must have a single quote delimited value for this to work.\nm4_define([_LT_CONFIG_STATUS_DECLARE],\n[$1='`$ECHO \"$][$1\" | $SED \"$delay_single_quote_subst\"`'])\n\n\n# _LT_CONFIG_STATUS_DECLARATIONS\n# ------------------------------\n# We delimit libtool config variables with single quotes, so when\n# we write them to config.status, we have to be sure to quote all\n# embedded single quotes properly.  In configure, this macro expands\n# each variable declared with _LT_DECL (and _LT_TAGDECL) into:\n#\n#    <var>='`$ECHO \"$<var>\" | $SED \"$delay_single_quote_subst\"`'\nm4_defun([_LT_CONFIG_STATUS_DECLARATIONS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),\n    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAGS\n# ----------------\n# Output comment and list of tags supported by the script\nm4_defun([_LT_LIBTOOL_TAGS],\n[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl\navailable_tags=\"_LT_TAGS\"dnl\n])\n\n\n# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])\n# -----------------------------------\n# Extract the dictionary values for VARNAME (optionally with TAG) and\n# expand to a commented shell variable setting:\n#\n#    # Some comment about what VAR is for.\n#    visible_name=$lt_internal_name\nm4_define([_LT_LIBTOOL_DECLARE],\n[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],\n\t\t\t\t\t   [description])))[]dnl\nm4_pushdef([_libtool_name],\n    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl\nm4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),\n    [0], [_libtool_name=[$]$1],\n    [1], [_libtool_name=$lt_[]$1],\n    [2], [_libtool_name=$lt_[]$1],\n    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl\nm4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl\n])\n\n\n# _LT_LIBTOOL_CONFIG_VARS\n# -----------------------\n# Produce commented declarations of non-tagged libtool config variables\n# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'\n# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG\n# section) are produced by _LT_LIBTOOL_TAG_VARS.\nm4_defun([_LT_LIBTOOL_CONFIG_VARS],\n[m4_foreach([_lt_var],\n    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])\n\n\n# _LT_LIBTOOL_TAG_VARS(TAG)\n# -------------------------\nm4_define([_LT_LIBTOOL_TAG_VARS],\n[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),\n    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])\n\n\n# _LT_TAGVAR(VARNAME, [TAGNAME])\n# ------------------------------\nm4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])\n\n\n# _LT_CONFIG_COMMANDS\n# -------------------\n# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of\n# variables for single and double quote escaping we saved from calls\n# to _LT_DECL, we can put quote escaped variables declarations\n# into `config.status', and then the shell code to quote escape them in\n# for loops in `config.status'.  Finally, any additional code accumulated\n# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.\nm4_defun([_LT_CONFIG_COMMANDS],\n[AC_PROVIDE_IFELSE([LT_OUTPUT],\n\tdnl If the libtool generation code has been placed in $CONFIG_LT,\n\tdnl instead of duplicating it all over again into config.status,\n\tdnl then we will have config.status run $CONFIG_LT later, so it\n\tdnl needs to know what name is stored there:\n        [AC_CONFIG_COMMANDS([libtool],\n            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],\n    dnl If the libtool generation code is destined for config.status,\n    dnl expand the accumulated commands and init code now:\n    [AC_CONFIG_COMMANDS([libtool],\n        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])\n])#_LT_CONFIG_COMMANDS\n\n\n# Initialize.\nm4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],\n[\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nsed_quote_subst='$sed_quote_subst'\ndouble_quote_subst='$double_quote_subst'\ndelay_variable_subst='$delay_variable_subst'\n_LT_CONFIG_STATUS_DECLARATIONS\nLTCC='$LTCC'\nLTCFLAGS='$LTCFLAGS'\ncompiler='$compiler_DEFAULT'\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$[]1\n_LTECHO_EOF'\n}\n\n# Quote evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_quote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED \\\\\"\\\\\\$sed_quote_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n# Double-quote double-evaled strings.\nfor var in lt_decl_all_varnames([[ \\\n]], lt_decl_dquote_varnames); do\n    case \\`eval \\\\\\\\\\$ECHO \\\\\\\\\"\"\\\\\\\\\\$\\$var\"\\\\\\\\\"\\` in\n    *[[\\\\\\\\\\\\\\`\\\\\"\\\\\\$]]*)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\`\\\\\\$ECHO \\\\\"\\\\\\$\\$var\\\\\" | \\\\\\$SED -e \\\\\"\\\\\\$double_quote_subst\\\\\" -e \\\\\"\\\\\\$sed_quote_subst\\\\\" -e \\\\\"\\\\\\$delay_variable_subst\\\\\"\\\\\\`\\\\\\\\\\\\\"\"\n      ;;\n    *)\n      eval \"lt_\\$var=\\\\\\\\\\\\\"\\\\\\$\\$var\\\\\\\\\\\\\"\"\n      ;;\n    esac\ndone\n\n_LT_OUTPUT_LIBTOOL_INIT\n])\n\n# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])\n# ------------------------------------\n# Generate a child script FILE with all initialization necessary to\n# reuse the environment learned by the parent script, and make the\n# file executable.  If COMMENT is supplied, it is inserted after the\n# `#!' sequence but before initialization text begins.  After this\n# macro, additional text can be appended to FILE to form the body of\n# the child script.  The macro ends with non-zero status if the\n# file could not be fully written (such as if the disk is full).\nm4_ifdef([AS_INIT_GENERATED],\n[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],\n[m4_defun([_LT_GENERATED_FILE_INIT],\n[m4_require([AS_PREPARE])]dnl\n[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl\n[lt_write_fail=0\ncat >$1 <<_ASEOF || lt_write_fail=1\n#! $SHELL\n# Generated by $as_me.\n$2\nSHELL=\\${CONFIG_SHELL-$SHELL}\nexport SHELL\n_ASEOF\ncat >>$1 <<\\_ASEOF || lt_write_fail=1\nAS_SHELL_SANITIZE\n_AS_PREPARE\nexec AS_MESSAGE_FD>&1\n_ASEOF\ntest $lt_write_fail = 0 && chmod +x $1[]dnl\nm4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT\n\n# LT_OUTPUT\n# ---------\n# This macro allows early generation of the libtool script (before\n# AC_OUTPUT is called), incase it is used in configure for compilation\n# tests.\nAC_DEFUN([LT_OUTPUT],\n[: ${CONFIG_LT=./config.lt}\nAC_MSG_NOTICE([creating $CONFIG_LT])\n_LT_GENERATED_FILE_INIT([\"$CONFIG_LT\"],\n[# Run this file to recreate a libtool stub with the current configuration.])\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nlt_cl_silent=false\nexec AS_MESSAGE_LOG_FD>>config.log\n{\n  echo\n  AS_BOX([Running $as_me.])\n} >&AS_MESSAGE_LOG_FD\n\nlt_cl_help=\"\\\n\\`$as_me' creates a local libtool stub from the current configuration,\nfor use in further configure time tests before the real libtool is\ngenerated.\n\nUsage: $[0] [[OPTIONS]]\n\n  -h, --help      print this help, then exit\n  -V, --version   print version number, then exit\n  -q, --quiet     do not print progress messages\n  -d, --debug     don't remove temporary files\n\nReport bugs to <bug-libtool@gnu.org>.\"\n\nlt_cl_version=\"\\\nm4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl\nm4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])\nconfigured by $[0], generated by m4_PACKAGE_STRING.\n\nCopyright (C) 2010 Free Software Foundation, Inc.\nThis config.lt script is free software; the Free Software Foundation\ngives unlimited permision to copy, distribute and modify it.\"\n\nwhile test $[#] != 0\ndo\n  case $[1] in\n    --version | --v* | -V )\n      echo \"$lt_cl_version\"; exit 0 ;;\n    --help | --h* | -h )\n      echo \"$lt_cl_help\"; exit 0 ;;\n    --debug | --d* | -d )\n      debug=: ;;\n    --quiet | --q* | --silent | --s* | -q )\n      lt_cl_silent=: ;;\n\n    -*) AC_MSG_ERROR([unrecognized option: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n\n    *) AC_MSG_ERROR([unrecognized argument: $[1]\nTry \\`$[0] --help' for more information.]) ;;\n  esac\n  shift\ndone\n\nif $lt_cl_silent; then\n  exec AS_MESSAGE_FD>/dev/null\nfi\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<_LTEOF\n_LT_OUTPUT_LIBTOOL_COMMANDS_INIT\n_LTEOF\n\ncat >>\"$CONFIG_LT\" <<\\_LTEOF\nAC_MSG_NOTICE([creating $ofile])\n_LT_OUTPUT_LIBTOOL_COMMANDS\nAS_EXIT(0)\n_LTEOF\nchmod +x \"$CONFIG_LT\"\n\n# configure is writing to config.log, but config.lt does its own redirection,\n# appending to config.log, which fails on DOS, as config.log is still kept\n# open by configure.  Here we exec the FD to /dev/null, effectively closing\n# config.log, so it can be properly (re)opened and appended to by config.lt.\nlt_cl_success=:\ntest \"$silent\" = yes &&\n  lt_config_lt_args=\"$lt_config_lt_args --quiet\"\nexec AS_MESSAGE_LOG_FD>/dev/null\n$SHELL \"$CONFIG_LT\" $lt_config_lt_args || lt_cl_success=false\nexec AS_MESSAGE_LOG_FD>>config.log\n$lt_cl_success || AS_EXIT(1)\n])# LT_OUTPUT\n\n\n# _LT_CONFIG(TAG)\n# ---------------\n# If TAG is the built-in tag, create an initial libtool script with a\n# default configuration from the untagged config vars.  Otherwise add code\n# to config.status for appending the configuration named by TAG from the\n# matching tagged config vars.\nm4_defun([_LT_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_CONFIG_SAVE_COMMANDS([\n  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl\n  m4_if(_LT_TAG, [C], [\n    # See if we are running on zsh, and set the options which allow our\n    # commands through without removal of \\ escapes.\n    if test -n \"${ZSH_VERSION+set}\" ; then\n      setopt NO_GLOB_SUBST\n    fi\n\n    cfgfile=\"${ofile}T\"\n    trap \"$RM \\\"$cfgfile\\\"; exit 1\" 1 2 15\n    $RM \"$cfgfile\"\n\n    cat <<_LT_EOF >> \"$cfgfile\"\n#! $SHELL\n\n# `$ECHO \"$ofile\" | sed 's%^.*/%%'` - Provide generalized library-building support services.\n# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION\n# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:\n# NOTE: Changes made to this file will be lost: look at ltmain.sh.\n#\n_LT_COPYING\n_LT_LIBTOOL_TAGS\n\n# ### BEGIN LIBTOOL CONFIG\n_LT_LIBTOOL_CONFIG_VARS\n_LT_LIBTOOL_TAG_VARS\n# ### END LIBTOOL CONFIG\n\n_LT_EOF\n\n  case $host_os in\n  aix3*)\n    cat <<\\_LT_EOF >> \"$cfgfile\"\n# AIX sometimes has problems with the GCC collect2 program.  For some\n# reason, if we set the COLLECT_NAMES environment variable, the problems\n# vanish in a puff of smoke.\nif test \"X${COLLECT_NAMES+set}\" != Xset; then\n  COLLECT_NAMES=\n  export COLLECT_NAMES\nfi\n_LT_EOF\n    ;;\n  esac\n\n  _LT_PROG_LTMAIN\n\n  # We use sed instead of cat because bash on DJGPP gets confused if\n  # if finds mixed CR/LF and LF-only lines.  Since sed operates in\n  # text mode, it properly converts lines to CR/LF.  This bash problem\n  # is reportedly fixed, but why not run on old versions too?\n  sed '$q' \"$ltmain\" >> \"$cfgfile\" \\\n     || (rm -f \"$cfgfile\"; exit 1)\n\n  _LT_PROG_REPLACE_SHELLFNS\n\n   mv -f \"$cfgfile\" \"$ofile\" ||\n    (rm -f \"$ofile\" && cp \"$cfgfile\" \"$ofile\" && rm -f \"$cfgfile\")\n  chmod +x \"$ofile\"\n],\n[cat <<_LT_EOF >> \"$ofile\"\n\ndnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded\ndnl in a comment (ie after a #).\n# ### BEGIN LIBTOOL TAG CONFIG: $1\n_LT_LIBTOOL_TAG_VARS(_LT_TAG)\n# ### END LIBTOOL TAG CONFIG: $1\n_LT_EOF\n])dnl /m4_if\n],\n[m4_if([$1], [], [\n    PACKAGE='$PACKAGE'\n    VERSION='$VERSION'\n    TIMESTAMP='$TIMESTAMP'\n    RM='$RM'\n    ofile='$ofile'], [])\n])dnl /_LT_CONFIG_SAVE_COMMANDS\n])# _LT_CONFIG\n\n\n# LT_SUPPORTED_TAG(TAG)\n# ---------------------\n# Trace this macro to discover what tags are supported by the libtool\n# --tag option, using:\n#    autoconf --trace 'LT_SUPPORTED_TAG:$1'\nAC_DEFUN([LT_SUPPORTED_TAG], [])\n\n\n# C support is built-in for now\nm4_define([_LT_LANG_C_enabled], [])\nm4_define([_LT_TAGS], [])\n\n\n# LT_LANG(LANG)\n# -------------\n# Enable libtool support for the given language if not already enabled.\nAC_DEFUN([LT_LANG],\n[AC_BEFORE([$0], [LT_OUTPUT])dnl\nm4_case([$1],\n  [C],\t\t\t[_LT_LANG(C)],\n  [C++],\t\t[_LT_LANG(CXX)],\n  [Java],\t\t[_LT_LANG(GCJ)],\n  [Fortran 77],\t\t[_LT_LANG(F77)],\n  [Fortran],\t\t[_LT_LANG(FC)],\n  [Windows Resource],\t[_LT_LANG(RC)],\n  [m4_ifdef([_LT_LANG_]$1[_CONFIG],\n    [_LT_LANG($1)],\n    [m4_fatal([$0: unsupported language: \"$1\"])])])dnl\n])# LT_LANG\n\n\n# _LT_LANG(LANGNAME)\n# ------------------\nm4_defun([_LT_LANG],\n[m4_ifdef([_LT_LANG_]$1[_enabled], [],\n  [LT_SUPPORTED_TAG([$1])dnl\n  m4_append([_LT_TAGS], [$1 ])dnl\n  m4_define([_LT_LANG_]$1[_enabled], [])dnl\n  _LT_LANG_$1_CONFIG($1)])dnl\n])# _LT_LANG\n\n\n# _LT_LANG_DEFAULT_CONFIG\n# -----------------------\nm4_defun([_LT_LANG_DEFAULT_CONFIG],\n[AC_PROVIDE_IFELSE([AC_PROG_CXX],\n  [LT_LANG(CXX)],\n  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_F77],\n  [LT_LANG(F77)],\n  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])\n\nAC_PROVIDE_IFELSE([AC_PROG_FC],\n  [LT_LANG(FC)],\n  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])\n\ndnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal\ndnl pulling things in needlessly.\nAC_PROVIDE_IFELSE([AC_PROG_GCJ],\n  [LT_LANG(GCJ)],\n  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],\n    [LT_LANG(GCJ)],\n    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],\n      [LT_LANG(GCJ)],\n      [m4_ifdef([AC_PROG_GCJ],\n\t[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([A][M_PROG_GCJ],\n\t[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])\n       m4_ifdef([LT_PROG_GCJ],\n\t[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])\n\nAC_PROVIDE_IFELSE([LT_PROG_RC],\n  [LT_LANG(RC)],\n  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])\n])# _LT_LANG_DEFAULT_CONFIG\n\n# Obsolete macros:\nAU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])\nAU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])\nAU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])\nAU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])\nAU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_CXX], [])\ndnl AC_DEFUN([AC_LIBTOOL_F77], [])\ndnl AC_DEFUN([AC_LIBTOOL_FC], [])\ndnl AC_DEFUN([AC_LIBTOOL_GCJ], [])\ndnl AC_DEFUN([AC_LIBTOOL_RC], [])\n\n\n# _LT_TAG_COMPILER\n# ----------------\nm4_defun([_LT_TAG_COMPILER],\n[AC_REQUIRE([AC_PROG_CC])dnl\n\n_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl\n_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl\n_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl\n_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl\n\n# If no C compiler was specified, use CC.\nLTCC=${LTCC-\"$CC\"}\n\n# If no C compiler flags were specified, use CFLAGS.\nLTCFLAGS=${LTCFLAGS-\"$CFLAGS\"}\n\n# Allow CC to be a program name with arguments.\ncompiler=$CC\n])# _LT_TAG_COMPILER\n\n\n# _LT_COMPILER_BOILERPLATE\n# ------------------------\n# Check for compiler boilerplate output or warnings with\n# the simple compiler test code.\nm4_defun([_LT_COMPILER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_compile_test_code\" >conftest.$ac_ext\neval \"$ac_compile\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_compiler_boilerplate=`cat conftest.err`\n$RM conftest*\n])# _LT_COMPILER_BOILERPLATE\n\n\n# _LT_LINKER_BOILERPLATE\n# ----------------------\n# Check for linker boilerplate output or warnings with\n# the simple link test code.\nm4_defun([_LT_LINKER_BOILERPLATE],\n[m4_require([_LT_DECL_SED])dnl\nac_outfile=conftest.$ac_objext\necho \"$lt_simple_link_test_code\" >conftest.$ac_ext\neval \"$ac_link\" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err\n_lt_linker_boilerplate=`cat conftest.err`\n$RM -r conftest*\n])# _LT_LINKER_BOILERPLATE\n\n# _LT_REQUIRED_DARWIN_CHECKS\n# -------------------------\nm4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[\n  case $host_os in\n    rhapsody* | darwin*)\n    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])\n    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])\n    AC_CHECK_TOOL([LIPO], [lipo], [:])\n    AC_CHECK_TOOL([OTOOL], [otool], [:])\n    AC_CHECK_TOOL([OTOOL64], [otool64], [:])\n    _LT_DECL([], [DSYMUTIL], [1],\n      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])\n    _LT_DECL([], [NMEDIT], [1],\n      [Tool to change global to local symbols on Mac OS X])\n    _LT_DECL([], [LIPO], [1],\n      [Tool to manipulate fat objects and archives on Mac OS X])\n    _LT_DECL([], [OTOOL], [1],\n      [ldd/readelf like tool for Mach-O binaries on Mac OS X])\n    _LT_DECL([], [OTOOL64], [1],\n      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])\n\n    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],\n      [lt_cv_apple_cc_single_mod=no\n      if test -z \"${LT_MULTI_MODULE}\"; then\n\t# By default we will add the -single_module flag. You can override\n\t# by either setting the environment variable LT_MULTI_MODULE\n\t# non-empty at configure time, or by adding -multi_module to the\n\t# link flags.\n\trm -rf libconftest.dylib*\n\techo \"int foo(void){return 1;}\" > conftest.c\n\techo \"$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n-dynamiclib -Wl,-single_module conftest.c\" >&AS_MESSAGE_LOG_FD\n\t$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \\\n\t  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err\n        _lt_result=$?\n\tif test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then\n\t  lt_cv_apple_cc_single_mod=yes\n\telse\n\t  cat conftest.err >&AS_MESSAGE_LOG_FD\n\tfi\n\trm -rf libconftest.dylib*\n\trm -f conftest.*\n      fi])\n    AC_CACHE_CHECK([for -exported_symbols_list linker flag],\n      [lt_cv_ld_exported_symbols_list],\n      [lt_cv_ld_exported_symbols_list=no\n      save_LDFLAGS=$LDFLAGS\n      echo \"_main\" > conftest.sym\n      LDFLAGS=\"$LDFLAGS -Wl,-exported_symbols_list,conftest.sym\"\n      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n\t[lt_cv_ld_exported_symbols_list=yes],\n\t[lt_cv_ld_exported_symbols_list=no])\n\tLDFLAGS=\"$save_LDFLAGS\"\n    ])\n    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],\n      [lt_cv_ld_force_load=no\n      cat > conftest.c << _LT_EOF\nint forced_loaded() { return 2;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS -c -o conftest.o conftest.c\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD\n      echo \"$AR cru libconftest.a conftest.o\" >&AS_MESSAGE_LOG_FD\n      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD\n      echo \"$RANLIB libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD\n      cat > conftest.c << _LT_EOF\nint main() { return 0;}\n_LT_EOF\n      echo \"$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a\" >&AS_MESSAGE_LOG_FD\n      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err\n      _lt_result=$?\n      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then\n\tlt_cv_ld_force_load=yes\n      else\n\tcat conftest.err >&AS_MESSAGE_LOG_FD\n      fi\n        rm -f conftest.err libconftest.a conftest conftest.c\n        rm -rf conftest.dSYM\n    ])\n    case $host_os in\n    rhapsody* | darwin1.[[012]])\n      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;\n    darwin1.*)\n      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n    darwin*) # darwin 5.x on\n      # if running on 10.5 or later, the deployment target defaults\n      # to the OS version, if on x86, and 10.4, the deployment\n      # target defaults to 10.4. Don't you love it?\n      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in\n\t10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n\t10.[[012]]*)\n\t  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;\n\t10.*)\n\t  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;\n      esac\n    ;;\n  esac\n    if test \"$lt_cv_apple_cc_single_mod\" = \"yes\"; then\n      _lt_dar_single_mod='$single_module'\n    fi\n    if test \"$lt_cv_ld_exported_symbols_list\" = \"yes\"; then\n      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'\n    else\n      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'\n    fi\n    if test \"$DSYMUTIL\" != \":\" && test \"$lt_cv_ld_force_load\" = \"no\"; then\n      _lt_dsymutil='~$DSYMUTIL $lib || :'\n    else\n      _lt_dsymutil=\n    fi\n    ;;\n  esac\n])\n\n\n# _LT_DARWIN_LINKER_FEATURES\n# --------------------------\n# Checks for linker and compiler features on darwin\nm4_defun([_LT_DARWIN_LINKER_FEATURES],\n[\n  m4_require([_LT_REQUIRED_DARWIN_CHECKS])\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_automatic, $1)=yes\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  if test \"$lt_cv_ld_force_load\" = \"yes\"; then\n    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience ${wl}-force_load,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"`'\n  else\n    _LT_TAGVAR(whole_archive_flag_spec, $1)=''\n  fi\n  _LT_TAGVAR(link_all_deplibs, $1)=yes\n  _LT_TAGVAR(allow_undefined_flag, $1)=\"$_lt_dar_allow_undefined\"\n  case $cc_basename in\n     ifort*) _lt_dar_can_shared=yes ;;\n     *) _lt_dar_can_shared=$GCC ;;\n  esac\n  if test \"$_lt_dar_can_shared\" = \"yes\"; then\n    output_verbose_link_cmd=func_echo_all\n    _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring $_lt_dar_single_mod${_lt_dsymutil}\"\n    _LT_TAGVAR(module_cmds, $1)=\"\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dsymutil}\"\n    _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}\"\n    _LT_TAGVAR(module_expsym_cmds, $1)=\"sed -e 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC \\$allow_undefined_flag -o \\$lib -bundle \\$libobjs \\$deplibs \\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}\"\n    m4_if([$1], [CXX],\n[   if test \"$lt_cv_apple_cc_single_mod\" != \"yes\"; then\n      _LT_TAGVAR(archive_cmds, $1)=\"\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dsymutil}\"\n      _LT_TAGVAR(archive_expsym_cmds, $1)=\"sed 's,^,_,' < \\$export_symbols > \\$output_objdir/\\${libname}-symbols.expsym~\\$CC -r -keep_private_externs -nostdlib -o \\${lib}-master.o \\$libobjs~\\$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\${lib}-master.o \\$deplibs \\$compiler_flags -install_name \\$rpath/\\$soname \\$verstring${_lt_dar_export_syms}${_lt_dsymutil}\"\n    fi\n],[])\n  else\n  _LT_TAGVAR(ld_shlibs, $1)=no\n  fi\n])\n\n# _LT_SYS_MODULE_PATH_AIX([TAGNAME])\n# ----------------------------------\n# Links a minimal program and checks the executable\n# for the system default hardcoded library path. In most cases,\n# this is /usr/lib:/lib, but when the MPI compilers are used\n# the location of the communication and MPI libs are included too.\n# If we don't find anything, use the default library path according\n# to the aix ld manual.\n# Store the results from the different compilers for each TAGNAME.\n# Allow to override them for all tags through lt_cv_aix_libpath.\nm4_defun([_LT_SYS_MODULE_PATH_AIX],\n[m4_require([_LT_DECL_SED])dnl\nif test \"${lt_cv_aix_libpath+set}\" = set; then\n  aix_libpath=$lt_cv_aix_libpath\nelse\n  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],\n  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[\n  lt_aix_libpath_sed='[\n      /Import File Strings/,/^$/ {\n\t  /^0/ {\n\t      s/^0  *\\([^ ]*\\) *$/\\1/\n\t      p\n\t  }\n      }]'\n  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  # Check for a 64-bit object if we didn't find anything.\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e \"$lt_aix_libpath_sed\"`\n  fi],[])\n  if test -z \"$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\"; then\n    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=\"/usr/lib:/lib\"\n  fi\n  ])\n  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])\nfi\n])# _LT_SYS_MODULE_PATH_AIX\n\n\n# _LT_SHELL_INIT(ARG)\n# -------------------\nm4_define([_LT_SHELL_INIT],\n[m4_divert_text([M4SH-INIT], [$1\n])])# _LT_SHELL_INIT\n\n\n\n# _LT_PROG_ECHO_BACKSLASH\n# -----------------------\n# Find how we can fake an echo command that does not interpret backslash.\n# In particular, with Autoconf 2.60 or later we add some code to the start\n# of the generated configure script which will find a shell with a builtin\n# printf (which we can use as an echo command).\nm4_defun([_LT_PROG_ECHO_BACKSLASH],\n[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\nECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n\nAC_MSG_CHECKING([how to print strings])\n# Test print first, because it will be a builtin if present.\nif test \"X`( print -r -- -n ) 2>/dev/null`\" = X-n && \\\n   test \"X`print -r -- $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='print -r --'\nelif test \"X`printf %s $ECHO 2>/dev/null`\" = \"X$ECHO\"; then\n  ECHO='printf %s\\n'\nelse\n  # Use this function as a fallback that always works.\n  func_fallback_echo ()\n  {\n    eval 'cat <<_LTECHO_EOF\n$[]1\n_LTECHO_EOF'\n  }\n  ECHO='func_fallback_echo'\nfi\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"$*\" \n}\n\ncase \"$ECHO\" in\n  printf*) AC_MSG_RESULT([printf]) ;;\n  print*) AC_MSG_RESULT([print -r]) ;;\n  *) AC_MSG_RESULT([cat]) ;;\nesac\n\nm4_ifdef([_AS_DETECT_SUGGESTED],\n[_AS_DETECT_SUGGESTED([\n  test -n \"${ZSH_VERSION+set}${BASH_VERSION+set}\" || (\n    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO\n    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO\n    PATH=/empty FPATH=/empty; export PATH FPATH\n    test \"X`printf %s $ECHO`\" = \"X$ECHO\" \\\n      || test \"X`print -r -- $ECHO`\" = \"X$ECHO\" )])])\n\n_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])\n_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])\n])# _LT_PROG_ECHO_BACKSLASH\n\n\n# _LT_WITH_SYSROOT\n# ----------------\nAC_DEFUN([_LT_WITH_SYSROOT],\n[AC_MSG_CHECKING([for sysroot])\nAC_ARG_WITH([sysroot],\n[  --with-sysroot[=DIR] Search for dependent libraries within DIR\n                        (or the compiler's sysroot if not specified).],\n[], [with_sysroot=no])\n\ndnl lt_sysroot will always be passed unquoted.  We quote it here\ndnl in case the user passed a directory name.\nlt_sysroot=\ncase ${with_sysroot} in #(\n yes)\n   if test \"$GCC\" = yes; then\n     lt_sysroot=`$CC --print-sysroot 2>/dev/null`\n   fi\n   ;; #(\n /*)\n   lt_sysroot=`echo \"$with_sysroot\" | sed -e \"$sed_quote_subst\"`\n   ;; #(\n no|'')\n   ;; #(\n *)\n   AC_MSG_RESULT([${with_sysroot}])\n   AC_MSG_ERROR([The sysroot must be an absolute path.])\n   ;;\nesac\n\n AC_MSG_RESULT([${lt_sysroot:-no}])\n_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl\n[dependent libraries, and in which our libraries should be installed.])])\n\n# _LT_ENABLE_LOCK\n# ---------------\nm4_defun([_LT_ENABLE_LOCK],\n[AC_ARG_ENABLE([libtool-lock],\n  [AS_HELP_STRING([--disable-libtool-lock],\n    [avoid locking (might break parallel builds)])])\ntest \"x$enable_libtool_lock\" != xno && enable_libtool_lock=yes\n\n# Some flags need to be propagated to the compiler or linker for good\n# libtool support.\ncase $host in\nia64-*-hpux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.$ac_objext` in\n      *ELF-32*)\n\tHPUX_IA64_MODE=\"32\"\n\t;;\n      *ELF-64*)\n\tHPUX_IA64_MODE=\"64\"\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n*-*-irix6*)\n  # Find out which ABI we are using.\n  echo '[#]line '$LINENO' \"configure\"' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    if test \"$lt_cv_prog_gnu_ld\" = yes; then\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -melf32bsmip\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -melf32bmipn32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -melf64bmip\"\n\t;;\n      esac\n    else\n      case `/usr/bin/file conftest.$ac_objext` in\n\t*32-bit*)\n\t  LD=\"${LD-ld} -32\"\n\t  ;;\n\t*N32*)\n\t  LD=\"${LD-ld} -n32\"\n\t  ;;\n\t*64-bit*)\n\t  LD=\"${LD-ld} -64\"\n\t  ;;\n      esac\n    fi\n  fi\n  rm -rf conftest*\n  ;;\n\nx86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \\\ns390*-*linux*|s390*-*tpf*|sparc*-*linux*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n      *32-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_i386_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_i386\"\n\t    ;;\n\t  ppc64-*linux*|powerpc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32ppclinux\"\n\t    ;;\n\t  s390x-*linux*)\n\t    LD=\"${LD-ld} -m elf_s390\"\n\t    ;;\n\t  sparc64-*linux*)\n\t    LD=\"${LD-ld} -m elf32_sparc\"\n\t    ;;\n\tesac\n\t;;\n      *64-bit*)\n\tcase $host in\n\t  x86_64-*kfreebsd*-gnu)\n\t    LD=\"${LD-ld} -m elf_x86_64_fbsd\"\n\t    ;;\n\t  x86_64-*linux*)\n\t    LD=\"${LD-ld} -m elf_x86_64\"\n\t    ;;\n\t  ppc*-*linux*|powerpc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64ppc\"\n\t    ;;\n\t  s390*-*linux*|s390*-*tpf*)\n\t    LD=\"${LD-ld} -m elf64_s390\"\n\t    ;;\n\t  sparc*-*linux*)\n\t    LD=\"${LD-ld} -m elf64_sparc\"\n\t    ;;\n\tesac\n\t;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\n\n*-*-sco3.2v5*)\n  # On SCO OpenServer 5, we need -belf to get full-featured binaries.\n  SAVE_CFLAGS=\"$CFLAGS\"\n  CFLAGS=\"$CFLAGS -belf\"\n  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,\n    [AC_LANG_PUSH(C)\n     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])\n     AC_LANG_POP])\n  if test x\"$lt_cv_cc_needs_belf\" != x\"yes\"; then\n    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf\n    CFLAGS=\"$SAVE_CFLAGS\"\n  fi\n  ;;\nsparc*-*solaris*)\n  # Find out which ABI we are using.\n  echo 'int i;' > conftest.$ac_ext\n  if AC_TRY_EVAL(ac_compile); then\n    case `/usr/bin/file conftest.o` in\n    *64-bit*)\n      case $lt_cv_prog_gnu_ld in\n      yes*) LD=\"${LD-ld} -m elf64_sparc\" ;;\n      *)\n\tif ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then\n\t  LD=\"${LD-ld} -64\"\n\tfi\n\t;;\n      esac\n      ;;\n    esac\n  fi\n  rm -rf conftest*\n  ;;\nesac\n\nneed_locks=\"$enable_libtool_lock\"\n])# _LT_ENABLE_LOCK\n\n\n# _LT_PROG_AR\n# -----------\nm4_defun([_LT_PROG_AR],\n[AC_CHECK_TOOLS(AR, [ar], false)\n: ${AR=ar}\n: ${AR_FLAGS=cru}\n_LT_DECL([], [AR], [1], [The archiver])\n_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])\n\nAC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],\n  [lt_cv_ar_at_file=no\n   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],\n     [echo conftest.$ac_objext > conftest.lst\n      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'\n      AC_TRY_EVAL([lt_ar_try])\n      if test \"$ac_status\" -eq 0; then\n\t# Ensure the archiver fails upon bogus file names.\n\trm -f conftest.$ac_objext libconftest.a\n\tAC_TRY_EVAL([lt_ar_try])\n\tif test \"$ac_status\" -ne 0; then\n          lt_cv_ar_at_file=@\n        fi\n      fi\n      rm -f conftest.* libconftest.a\n     ])\n  ])\n\nif test \"x$lt_cv_ar_at_file\" = xno; then\n  archiver_list_spec=\nelse\n  archiver_list_spec=$lt_cv_ar_at_file\nfi\n_LT_DECL([], [archiver_list_spec], [1],\n  [How to feed a file listing to the archiver])\n])# _LT_PROG_AR\n\n\n# _LT_CMD_OLD_ARCHIVE\n# -------------------\nm4_defun([_LT_CMD_OLD_ARCHIVE],\n[_LT_PROG_AR\n\nAC_CHECK_TOOL(STRIP, strip, :)\ntest -z \"$STRIP\" && STRIP=:\n_LT_DECL([], [STRIP], [1], [A symbol stripping program])\n\nAC_CHECK_TOOL(RANLIB, ranlib, :)\ntest -z \"$RANLIB\" && RANLIB=:\n_LT_DECL([], [RANLIB], [1],\n    [Commands used to install an old-style archive])\n\n# Determine commands to create old-style static archives.\nold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'\nold_postinstall_cmds='chmod 644 $oldlib'\nold_postuninstall_cmds=\n\nif test -n \"$RANLIB\"; then\n  case $host_os in\n  openbsd*)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB -t \\$oldlib\"\n    ;;\n  *)\n    old_postinstall_cmds=\"$old_postinstall_cmds~\\$RANLIB \\$oldlib\"\n    ;;\n  esac\n  old_archive_cmds=\"$old_archive_cmds~\\$RANLIB \\$oldlib\"\nfi\n\ncase $host_os in\n  darwin*)\n    lock_old_archive_extraction=yes ;;\n  *)\n    lock_old_archive_extraction=no ;;\nesac\n_LT_DECL([], [old_postinstall_cmds], [2])\n_LT_DECL([], [old_postuninstall_cmds], [2])\n_LT_TAGDECL([], [old_archive_cmds], [2],\n    [Commands used to build an old-style archive])\n_LT_DECL([], [lock_old_archive_extraction], [0],\n    [Whether to use a lock for old archive extraction])\n])# _LT_CMD_OLD_ARCHIVE\n\n\n# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#\t\t[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------------------\n# Check whether the given compiler option works\nAC_DEFUN([_LT_COMPILER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n   lt_compiler_flag=\"$3\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   # The option is referenced via a variable to avoid confusing sed.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>conftest.err)\n   ac_status=$?\n   cat conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s \"$ac_outfile\"; then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings other than the usual output.\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' >conftest.exp\n     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then\n       $2=yes\n     fi\n   fi\n   $RM conftest*\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$5], , :, [$5])\nelse\n    m4_if([$6], , :, [$6])\nfi\n])# _LT_COMPILER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])\n\n\n# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,\n#                  [ACTION-SUCCESS], [ACTION-FAILURE])\n# ----------------------------------------------------\n# Check whether the given linker option works\nAC_DEFUN([_LT_LINKER_OPTION],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_SED])dnl\nAC_CACHE_CHECK([$1], [$2],\n  [$2=no\n   save_LDFLAGS=\"$LDFLAGS\"\n   LDFLAGS=\"$LDFLAGS $3\"\n   echo \"$lt_simple_link_test_code\" > conftest.$ac_ext\n   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then\n     # The linker can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     if test -s conftest.err; then\n       # Append any errors to the config.log.\n       cat conftest.err 1>&AS_MESSAGE_LOG_FD\n       $ECHO \"$_lt_linker_boilerplate\" | $SED '/^$/d' > conftest.exp\n       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2\n       if diff conftest.exp conftest.er2 >/dev/null; then\n         $2=yes\n       fi\n     else\n       $2=yes\n     fi\n   fi\n   $RM -r conftest*\n   LDFLAGS=\"$save_LDFLAGS\"\n])\n\nif test x\"[$]$2\" = xyes; then\n    m4_if([$4], , :, [$4])\nelse\n    m4_if([$5], , :, [$5])\nfi\n])# _LT_LINKER_OPTION\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])\n\n\n# LT_CMD_MAX_LEN\n#---------------\nAC_DEFUN([LT_CMD_MAX_LEN],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\n# find the maximum length of command line arguments\nAC_MSG_CHECKING([the maximum length of command line arguments])\nAC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl\n  i=0\n  teststring=\"ABCD\"\n\n  case $build_os in\n  msdosdjgpp*)\n    # On DJGPP, this test can blow up pretty badly due to problems in libc\n    # (any single argument exceeding 2000 bytes causes a buffer overrun\n    # during glob expansion).  Even if it were fixed, the result of this\n    # check would be larger than it should be.\n    lt_cv_sys_max_cmd_len=12288;    # 12K is about right\n    ;;\n\n  gnu*)\n    # Under GNU Hurd, this test is not required because there is\n    # no limit to the length of command line arguments.\n    # Libtool will interpret -1 as no limit whatsoever\n    lt_cv_sys_max_cmd_len=-1;\n    ;;\n\n  cygwin* | mingw* | cegcc*)\n    # On Win9x/ME, this test blows up -- it succeeds, but takes\n    # about 5 minutes as the teststring grows exponentially.\n    # Worse, since 9x/ME are not pre-emptively multitasking,\n    # you end up with a \"frozen\" computer, even though with patience\n    # the test eventually succeeds (with a max line length of 256k).\n    # Instead, let's just punt: use the minimum linelength reported by\n    # all of the supported platforms: 8192 (on NT/2K/XP).\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  mint*)\n    # On MiNT this can take a long time and run out of memory.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  amigaos*)\n    # On AmigaOS with pdksh, this test takes hours, literally.\n    # So we just punt and use a minimum line length of 8192.\n    lt_cv_sys_max_cmd_len=8192;\n    ;;\n\n  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)\n    # This has been around since 386BSD, at least.  Likely further.\n    if test -x /sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`\n    elif test -x /usr/sbin/sysctl; then\n      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`\n    else\n      lt_cv_sys_max_cmd_len=65536\t# usable default for all BSDs\n    fi\n    # And add a safety zone\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    ;;\n\n  interix*)\n    # We know the value 262144 and hardcode it with a safety zone (like BSD)\n    lt_cv_sys_max_cmd_len=196608\n    ;;\n\n  osf*)\n    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure\n    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not\n    # nice to cause kernel panics so lets avoid the loop below.\n    # First set a reasonable default.\n    lt_cv_sys_max_cmd_len=16384\n    #\n    if test -x /sbin/sysconfig; then\n      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in\n        *1*) lt_cv_sys_max_cmd_len=-1 ;;\n      esac\n    fi\n    ;;\n  sco3.2v5*)\n    lt_cv_sys_max_cmd_len=102400\n    ;;\n  sysv5* | sco5v6* | sysv4.2uw2*)\n    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`\n    if test -n \"$kargmax\"; then\n      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[\t ]]//'`\n    else\n      lt_cv_sys_max_cmd_len=32768\n    fi\n    ;;\n  *)\n    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`\n    if test -n \"$lt_cv_sys_max_cmd_len\"; then\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 4`\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\* 3`\n    else\n      # Make teststring a little bigger before we do anything with it.\n      # a 1K string should be a reasonable start.\n      for i in 1 2 3 4 5 6 7 8 ; do\n        teststring=$teststring$teststring\n      done\n      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}\n      # If test is not a shell built-in, we'll probably end up computing a\n      # maximum length that is only half of the actual maximum length, but\n      # we can't tell.\n      while { test \"X\"`func_fallback_echo \"$teststring$teststring\" 2>/dev/null` \\\n\t         = \"X$teststring$teststring\"; } >/dev/null 2>&1 &&\n\t      test $i != 17 # 1/2 MB should be enough\n      do\n        i=`expr $i + 1`\n        teststring=$teststring$teststring\n      done\n      # Only check the string length outside the loop.\n      lt_cv_sys_max_cmd_len=`expr \"X$teststring\" : \".*\" 2>&1`\n      teststring=\n      # Add a significant safety factor because C++ compilers can tack on\n      # massive amounts of additional arguments before passing them to the\n      # linker.  It appears as though 1/2 is a usable value.\n      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \\/ 2`\n    fi\n    ;;\n  esac\n])\nif test -n $lt_cv_sys_max_cmd_len ; then\n  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)\nelse\n  AC_MSG_RESULT(none)\nfi\nmax_cmd_len=$lt_cv_sys_max_cmd_len\n_LT_DECL([], [max_cmd_len], [0],\n    [What is the maximum length of a command?])\n])# LT_CMD_MAX_LEN\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])\n\n\n# _LT_HEADER_DLFCN\n# ----------------\nm4_defun([_LT_HEADER_DLFCN],\n[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl\n])# _LT_HEADER_DLFCN\n\n\n# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,\n#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)\n# ----------------------------------------------------------------\nm4_defun([_LT_TRY_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"$cross_compiling\" = yes; then :\n  [$4]\nelse\n  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2\n  lt_status=$lt_dlunknown\n  cat > conftest.$ac_ext <<_LT_EOF\n[#line $LINENO \"configure\"\n#include \"confdefs.h\"\n\n#if HAVE_DLFCN_H\n#include <dlfcn.h>\n#endif\n\n#include <stdio.h>\n\n#ifdef RTLD_GLOBAL\n#  define LT_DLGLOBAL\t\tRTLD_GLOBAL\n#else\n#  ifdef DL_GLOBAL\n#    define LT_DLGLOBAL\t\tDL_GLOBAL\n#  else\n#    define LT_DLGLOBAL\t\t0\n#  endif\n#endif\n\n/* We may have to define LT_DLLAZY_OR_NOW in the command line if we\n   find out it does not work in some platform. */\n#ifndef LT_DLLAZY_OR_NOW\n#  ifdef RTLD_LAZY\n#    define LT_DLLAZY_OR_NOW\t\tRTLD_LAZY\n#  else\n#    ifdef DL_LAZY\n#      define LT_DLLAZY_OR_NOW\t\tDL_LAZY\n#    else\n#      ifdef RTLD_NOW\n#        define LT_DLLAZY_OR_NOW\tRTLD_NOW\n#      else\n#        ifdef DL_NOW\n#          define LT_DLLAZY_OR_NOW\tDL_NOW\n#        else\n#          define LT_DLLAZY_OR_NOW\t0\n#        endif\n#      endif\n#    endif\n#  endif\n#endif\n\n/* When -fvisbility=hidden is used, assume the code has been annotated\n   correspondingly for the symbols needed.  */\n#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))\nint fnord () __attribute__((visibility(\"default\")));\n#endif\n\nint fnord () { return 42; }\nint main ()\n{\n  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);\n  int status = $lt_dlunknown;\n\n  if (self)\n    {\n      if (dlsym (self,\"fnord\"))       status = $lt_dlno_uscore;\n      else\n        {\n\t  if (dlsym( self,\"_fnord\"))  status = $lt_dlneed_uscore;\n          else puts (dlerror ());\n\t}\n      /* dlclose (self); */\n    }\n  else\n    puts (dlerror ());\n\n  return status;\n}]\n_LT_EOF\n  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then\n    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null\n    lt_status=$?\n    case x$lt_status in\n      x$lt_dlno_uscore) $1 ;;\n      x$lt_dlneed_uscore) $2 ;;\n      x$lt_dlunknown|x*) $3 ;;\n    esac\n  else :\n    # compilation failed\n    $3\n  fi\nfi\nrm -fr conftest*\n])# _LT_TRY_DLOPEN_SELF\n\n\n# LT_SYS_DLOPEN_SELF\n# ------------------\nAC_DEFUN([LT_SYS_DLOPEN_SELF],\n[m4_require([_LT_HEADER_DLFCN])dnl\nif test \"x$enable_dlopen\" != xyes; then\n  enable_dlopen=unknown\n  enable_dlopen_self=unknown\n  enable_dlopen_self_static=unknown\nelse\n  lt_cv_dlopen=no\n  lt_cv_dlopen_libs=\n\n  case $host_os in\n  beos*)\n    lt_cv_dlopen=\"load_add_on\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ;;\n\n  mingw* | pw32* | cegcc*)\n    lt_cv_dlopen=\"LoadLibrary\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  cygwin*)\n    lt_cv_dlopen=\"dlopen\"\n    lt_cv_dlopen_libs=\n    ;;\n\n  darwin*)\n  # if libdl is installed we need to link against it\n    AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],[\n    lt_cv_dlopen=\"dyld\"\n    lt_cv_dlopen_libs=\n    lt_cv_dlopen_self=yes\n    ])\n    ;;\n\n  *)\n    AC_CHECK_FUNC([shl_load],\n\t  [lt_cv_dlopen=\"shl_load\"],\n      [AC_CHECK_LIB([dld], [shl_load],\n\t    [lt_cv_dlopen=\"shl_load\" lt_cv_dlopen_libs=\"-ldld\"],\n\t[AC_CHECK_FUNC([dlopen],\n\t      [lt_cv_dlopen=\"dlopen\"],\n\t  [AC_CHECK_LIB([dl], [dlopen],\n\t\t[lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-ldl\"],\n\t    [AC_CHECK_LIB([svld], [dlopen],\n\t\t  [lt_cv_dlopen=\"dlopen\" lt_cv_dlopen_libs=\"-lsvld\"],\n\t      [AC_CHECK_LIB([dld], [dld_link],\n\t\t    [lt_cv_dlopen=\"dld_link\" lt_cv_dlopen_libs=\"-ldld\"])\n\t      ])\n\t    ])\n\t  ])\n\t])\n      ])\n    ;;\n  esac\n\n  if test \"x$lt_cv_dlopen\" != xno; then\n    enable_dlopen=yes\n  else\n    enable_dlopen=no\n  fi\n\n  case $lt_cv_dlopen in\n  dlopen)\n    save_CPPFLAGS=\"$CPPFLAGS\"\n    test \"x$ac_cv_header_dlfcn_h\" = xyes && CPPFLAGS=\"$CPPFLAGS -DHAVE_DLFCN_H\"\n\n    save_LDFLAGS=\"$LDFLAGS\"\n    wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $export_dynamic_flag_spec\\\"\n\n    save_LIBS=\"$LIBS\"\n    LIBS=\"$lt_cv_dlopen_libs $LIBS\"\n\n    AC_CACHE_CHECK([whether a program can dlopen itself],\n\t  lt_cv_dlopen_self, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,\n\t    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)\n    ])\n\n    if test \"x$lt_cv_dlopen_self\" = xyes; then\n      wl=$lt_prog_compiler_wl eval LDFLAGS=\\\"\\$LDFLAGS $lt_prog_compiler_static\\\"\n      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],\n\t  lt_cv_dlopen_self_static, [dnl\n\t  _LT_TRY_DLOPEN_SELF(\n\t    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,\n\t    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)\n      ])\n    fi\n\n    CPPFLAGS=\"$save_CPPFLAGS\"\n    LDFLAGS=\"$save_LDFLAGS\"\n    LIBS=\"$save_LIBS\"\n    ;;\n  esac\n\n  case $lt_cv_dlopen_self in\n  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;\n  *) enable_dlopen_self=unknown ;;\n  esac\n\n  case $lt_cv_dlopen_self_static in\n  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;\n  *) enable_dlopen_self_static=unknown ;;\n  esac\nfi\n_LT_DECL([dlopen_support], [enable_dlopen], [0],\n\t [Whether dlopen is supported])\n_LT_DECL([dlopen_self], [enable_dlopen_self], [0],\n\t [Whether dlopen of programs is supported])\n_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],\n\t [Whether dlopen of statically linked programs is supported])\n])# LT_SYS_DLOPEN_SELF\n\n# Old name:\nAU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])\n\n\n# _LT_COMPILER_C_O([TAGNAME])\n# ---------------------------\n# Check to see if options -c and -o are simultaneously supported by compiler.\n# This macro does not hard code the compiler like AC_PROG_CC_C_O.\nm4_defun([_LT_COMPILER_C_O],\n[m4_require([_LT_DECL_SED])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no\n   $RM -r conftest 2>/dev/null\n   mkdir conftest\n   cd conftest\n   mkdir out\n   echo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n   lt_compiler_flag=\"-o out/conftest2.$ac_objext\"\n   # Insert the option either (1) after the last *FLAGS variable, or\n   # (2) before a word containing \"conftest.\", or (3) at the end.\n   # Note that $ac_compile itself does not contain backslashes and begins\n   # with a dollar sign (not a hyphen), so the echo should work correctly.\n   lt_compile=`echo \"$ac_compile\" | $SED \\\n   -e 's:.*FLAGS}\\{0,1\\} :&$lt_compiler_flag :; t' \\\n   -e 's: [[^ ]]*conftest\\.: $lt_compiler_flag&:; t' \\\n   -e 's:$: $lt_compiler_flag:'`\n   (eval echo \"\\\"\\$as_me:$LINENO: $lt_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n   (eval \"$lt_compile\" 2>out/conftest.err)\n   ac_status=$?\n   cat out/conftest.err >&AS_MESSAGE_LOG_FD\n   echo \"$as_me:$LINENO: \\$? = $ac_status\" >&AS_MESSAGE_LOG_FD\n   if (exit $ac_status) && test -s out/conftest2.$ac_objext\n   then\n     # The compiler can only warn and ignore the option if not recognized\n     # So say no if there are warnings\n     $ECHO \"$_lt_compiler_boilerplate\" | $SED '/^$/d' > out/conftest.exp\n     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2\n     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then\n       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n     fi\n   fi\n   chmod u+w . 2>&AS_MESSAGE_LOG_FD\n   $RM conftest*\n   # SGI C++ compiler will create directory out/ii_files/ for\n   # template instantiation\n   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files\n   $RM out/* && rmdir out\n   cd ..\n   $RM -r conftest\n   $RM conftest*\n])\n_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],\n\t[Does compiler simultaneously support -c and -o options?])\n])# _LT_COMPILER_C_O\n\n\n# _LT_COMPILER_FILE_LOCKS([TAGNAME])\n# ----------------------------------\n# Check to see if we can do hard links to lock some files if needed\nm4_defun([_LT_COMPILER_FILE_LOCKS],\n[m4_require([_LT_ENABLE_LOCK])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\n_LT_COMPILER_C_O([$1])\n\nhard_links=\"nottested\"\nif test \"$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)\" = no && test \"$need_locks\" != no; then\n  # do not overwrite the value of need_locks provided by the user\n  AC_MSG_CHECKING([if we can lock with hard links])\n  hard_links=yes\n  $RM conftest*\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  touch conftest.a\n  ln conftest.a conftest.b 2>&5 || hard_links=no\n  ln conftest.a conftest.b 2>/dev/null && hard_links=no\n  AC_MSG_RESULT([$hard_links])\n  if test \"$hard_links\" = no; then\n    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])\n    need_locks=warn\n  fi\nelse\n  need_locks=no\nfi\n_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])\n])# _LT_COMPILER_FILE_LOCKS\n\n\n# _LT_CHECK_OBJDIR\n# ----------------\nm4_defun([_LT_CHECK_OBJDIR],\n[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],\n[rm -f .libs 2>/dev/null\nmkdir .libs 2>/dev/null\nif test -d .libs; then\n  lt_cv_objdir=.libs\nelse\n  # MS-DOS does not allow filenames that begin with a dot.\n  lt_cv_objdir=_libs\nfi\nrmdir .libs 2>/dev/null])\nobjdir=$lt_cv_objdir\n_LT_DECL([], [objdir], [0],\n         [The name of the directory that contains temporary libtool files])dnl\nm4_pattern_allow([LT_OBJDIR])dnl\nAC_DEFINE_UNQUOTED(LT_OBJDIR, \"$lt_cv_objdir/\",\n  [Define to the sub-directory in which libtool stores uninstalled libraries.])\n])# _LT_CHECK_OBJDIR\n\n\n# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])\n# --------------------------------------\n# Check hardcoding attributes.\nm4_defun([_LT_LINKER_HARDCODE_LIBPATH],\n[AC_MSG_CHECKING([how to hardcode library paths into programs])\n_LT_TAGVAR(hardcode_action, $1)=\nif test -n \"$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\" ||\n   test -n \"$_LT_TAGVAR(runpath_var, $1)\" ||\n   test \"X$_LT_TAGVAR(hardcode_automatic, $1)\" = \"Xyes\" ; then\n\n  # We can hardcode non-existent directories.\n  if test \"$_LT_TAGVAR(hardcode_direct, $1)\" != no &&\n     # If the only mechanism to avoid hardcoding is shlibpath_var, we\n     # have to relink, otherwise we might link with an installed library\n     # when we should be linking with a yet-to-be-installed one\n     ## test \"$_LT_TAGVAR(hardcode_shlibpath_var, $1)\" != no &&\n     test \"$_LT_TAGVAR(hardcode_minus_L, $1)\" != no; then\n    # Linking always hardcodes the temporary library directory.\n    _LT_TAGVAR(hardcode_action, $1)=relink\n  else\n    # We can link without hardcoding, and we can hardcode nonexisting dirs.\n    _LT_TAGVAR(hardcode_action, $1)=immediate\n  fi\nelse\n  # We cannot hardcode anything, or else we can only hardcode existing\n  # directories.\n  _LT_TAGVAR(hardcode_action, $1)=unsupported\nfi\nAC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])\n\nif test \"$_LT_TAGVAR(hardcode_action, $1)\" = relink ||\n   test \"$_LT_TAGVAR(inherit_rpath, $1)\" = yes; then\n  # Fast installation is not supported\n  enable_fast_install=no\nelif test \"$shlibpath_overrides_runpath\" = yes ||\n     test \"$enable_shared\" = no; then\n  # Fast installation is not necessary\n  enable_fast_install=needless\nfi\n_LT_TAGDECL([], [hardcode_action], [0],\n    [How to hardcode a shared library path into an executable])\n])# _LT_LINKER_HARDCODE_LIBPATH\n\n\n# _LT_CMD_STRIPLIB\n# ----------------\nm4_defun([_LT_CMD_STRIPLIB],\n[m4_require([_LT_DECL_EGREP])\nstriplib=\nold_striplib=\nAC_MSG_CHECKING([whether stripping libraries is possible])\nif test -n \"$STRIP\" && $STRIP -V 2>&1 | $GREP \"GNU strip\" >/dev/null; then\n  test -z \"$old_striplib\" && old_striplib=\"$STRIP --strip-debug\"\n  test -z \"$striplib\" && striplib=\"$STRIP --strip-unneeded\"\n  AC_MSG_RESULT([yes])\nelse\n# FIXME - insert some real tests, host_os isn't really good enough\n  case $host_os in\n  darwin*)\n    if test -n \"$STRIP\" ; then\n      striplib=\"$STRIP -x\"\n      old_striplib=\"$STRIP -S\"\n      AC_MSG_RESULT([yes])\n    else\n      AC_MSG_RESULT([no])\n    fi\n    ;;\n  *)\n    AC_MSG_RESULT([no])\n    ;;\n  esac\nfi\n_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])\n_LT_DECL([], [striplib], [1])\n])# _LT_CMD_STRIPLIB\n\n\n# _LT_SYS_DYNAMIC_LINKER([TAG])\n# -----------------------------\n# PORTME Fill in your ld.so characteristics\nm4_defun([_LT_SYS_DYNAMIC_LINKER],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_OBJDUMP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CHECK_SHELL_FEATURES])dnl\nAC_MSG_CHECKING([dynamic linker characteristics])\nm4_if([$1],\n\t[], [\nif test \"$GCC\" = yes; then\n  case $host_os in\n    darwin*) lt_awk_arg=\"/^libraries:/,/LR/\" ;;\n    *) lt_awk_arg=\"/^libraries:/\" ;;\n  esac\n  case $host_os in\n    mingw* | cegcc*) lt_sed_strip_eq=\"s,=\\([[A-Za-z]]:\\),\\1,g\" ;;\n    *) lt_sed_strip_eq=\"s,=/,/,g\" ;;\n  esac\n  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e \"s/^libraries://\" -e $lt_sed_strip_eq`\n  case $lt_search_path_spec in\n  *\\;*)\n    # if the path contains \";\" then we assume it to be the separator\n    # otherwise default to the standard path separator (i.e. \":\") - it is\n    # assumed that no part of a normal pathname contains \";\" but that should\n    # okay in the real world where \";\" in dirpaths is itself problematic.\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED 's/;/ /g'`\n    ;;\n  *)\n    lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $SED \"s/$PATH_SEPARATOR/ /g\"`\n    ;;\n  esac\n  # Ok, now we have the path, separated by spaces, we can step through it\n  # and add multilib dir if necessary.\n  lt_tmp_lt_search_path_spec=\n  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`\n  for lt_sys_path in $lt_search_path_spec; do\n    if test -d \"$lt_sys_path/$lt_multi_os_dir\"; then\n      lt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir\"\n    else\n      test -d \"$lt_sys_path\" && \\\n\tlt_tmp_lt_search_path_spec=\"$lt_tmp_lt_search_path_spec $lt_sys_path\"\n    fi\n  done\n  lt_search_path_spec=`$ECHO \"$lt_tmp_lt_search_path_spec\" | awk '\nBEGIN {RS=\" \"; FS=\"/|\\n\";} {\n  lt_foo=\"\";\n  lt_count=0;\n  for (lt_i = NF; lt_i > 0; lt_i--) {\n    if ($lt_i != \"\" && $lt_i != \".\") {\n      if ($lt_i == \"..\") {\n        lt_count++;\n      } else {\n        if (lt_count == 0) {\n          lt_foo=\"/\" $lt_i lt_foo;\n        } else {\n          lt_count--;\n        }\n      }\n    }\n  }\n  if (lt_foo != \"\") { lt_freq[[lt_foo]]++; }\n  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }\n}'`\n  # AWK program above erroneously prepends '/' to C:/dos/paths\n  # for these hosts.\n  case $host_os in\n    mingw* | cegcc*) lt_search_path_spec=`$ECHO \"$lt_search_path_spec\" |\\\n      $SED 's,/\\([[A-Za-z]]:\\),\\1,g'` ;;\n  esac\n  sys_lib_search_path_spec=`$ECHO \"$lt_search_path_spec\" | $lt_NL2SP`\nelse\n  sys_lib_search_path_spec=\"/lib /usr/lib /usr/local/lib\"\nfi])\nlibrary_names_spec=\nlibname_spec='lib$name'\nsoname_spec=\nshrext_cmds=\".so\"\npostinstall_cmds=\npostuninstall_cmds=\nfinish_cmds=\nfinish_eval=\nshlibpath_var=\nshlibpath_overrides_runpath=unknown\nversion_type=none\ndynamic_linker=\"$host_os ld.so\"\nsys_lib_dlsearch_path_spec=\"/lib /usr/lib\"\nneed_lib_prefix=unknown\nhardcode_into_libs=no\n\n# when you set need_version to no, make sure it does not cause -set_version\n# flags to be left without arguments\nneed_version=unknown\n\ncase $host_os in\naix3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'\n  shlibpath_var=LIBPATH\n\n  # AIX 3 has no versioning support, so we append a major version to the name.\n  soname_spec='${libname}${release}${shared_ext}$major'\n  ;;\n\naix[[4-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  hardcode_into_libs=yes\n  if test \"$host_cpu\" = ia64; then\n    # AIX 5 supports IA64\n    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'\n    shlibpath_var=LD_LIBRARY_PATH\n  else\n    # With GCC up to 2.95.x, collect2 would create an import file\n    # for dependence libraries.  The import file would start with\n    # the line `#! .'.  This would cause the generated library to\n    # depend on `.', always an invalid library.  This was fixed in\n    # development snapshots of GCC prior to 3.0.\n    case $host_os in\n      aix4 | aix4.[[01]] | aix4.[[01]].*)\n      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'\n\t   echo ' yes '\n\t   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then\n\t:\n      else\n\tcan_build_shared=no\n      fi\n      ;;\n    esac\n    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct\n    # soname into executable. Probably we can add versioning support to\n    # collect2, so additional links can be useful in future.\n    if test \"$aix_use_runtimelinking\" = yes; then\n      # If using run time linking (on AIX 4.2 or later) use lib<name>.so\n      # instead of lib<name>.a to let people know that these are not\n      # typical AIX shared libraries.\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    else\n      # We preserve .a as extension for shared libraries through AIX4.2\n      # and later when we are not doing run time linking.\n      library_names_spec='${libname}${release}.a $libname.a'\n      soname_spec='${libname}${release}${shared_ext}$major'\n    fi\n    shlibpath_var=LIBPATH\n  fi\n  ;;\n\namigaos*)\n  case $host_cpu in\n  powerpc)\n    # Since July 2007 AmigaOS4 officially supports .so libraries.\n    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    ;;\n  m68k)\n    library_names_spec='$libname.ixlibrary $libname.a'\n    # Create ${libname}_ixlibrary.a entries in /sys/libs.\n    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all \"$lib\" | $SED '\\''s%^.*/\\([[^/]]*\\)\\.ixlibrary$%\\1%'\\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show \"cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a\"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'\n    ;;\n  esac\n  ;;\n\nbeos*)\n  library_names_spec='${libname}${shared_ext}'\n  dynamic_linker=\"$host_os ld.so\"\n  shlibpath_var=LIBRARY_PATH\n  ;;\n\nbsdi[[45]]*)\n  version_type=linux\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib\"\n  sys_lib_dlsearch_path_spec=\"/shlib /usr/lib /usr/local/lib\"\n  # the default ld.so.conf also contains /usr/contrib/lib and\n  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow\n  # libtool to hard-code these into programs\n  ;;\n\ncygwin* | mingw* | pw32* | cegcc*)\n  version_type=windows\n  shrext_cmds=\".dll\"\n  need_version=no\n  need_lib_prefix=no\n\n  case $GCC,$cc_basename in\n  yes,*)\n    # gcc\n    library_names_spec='$libname.dll.a'\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname~\n      chmod a+x \\$dldir/$dlname~\n      if test -n '\\''$stripme'\\'' && test -n '\\''$striplib'\\''; then\n        eval '\\''$striplib \\$dldir/$dlname'\\'' || exit \\$?;\n      fi'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n\n    case $host_os in\n    cygwin*)\n      # Cygwin DLLs use 'cyg' prefix rather than 'lib'\n      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\nm4_if([$1], [],[\n      sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/lib/w32api\"])\n      ;;\n    mingw* | cegcc*)\n      # MinGW DLLs use traditional 'lib' prefix\n      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    pw32*)\n      # pw32 DLLs use 'pw' prefix rather than 'lib'\n      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n      ;;\n    esac\n    dynamic_linker='Win32 ld.exe'\n    ;;\n\n  *,cl*)\n    # Native MSVC\n    libname_spec='$name'\n    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'\n    library_names_spec='${libname}.dll.lib'\n\n    case $build_os in\n    mingw*)\n      sys_lib_search_path_spec=\n      lt_save_ifs=$IFS\n      IFS=';'\n      for lt_path in $LIB\n      do\n        IFS=$lt_save_ifs\n        # Let DOS variable expansion print the short 8.3 style file name.\n        lt_path=`cd \"$lt_path\" 2>/dev/null && cmd //C \"for %i in (\".\") do @echo %~si\"`\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec $lt_path\"\n      done\n      IFS=$lt_save_ifs\n      # Convert to MSYS style.\n      sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | sed -e 's|\\\\\\\\|/|g' -e 's| \\\\([[a-zA-Z]]\\\\):| /\\\\1|g' -e 's|^ ||'`\n      ;;\n    cygwin*)\n      # Convert to unix form, then to dos form, then back to unix form\n      # but this time dos style (no spaces!) so that the unix form looks\n      # like /cygdrive/c/PROGRA~1:/cygdr...\n      sys_lib_search_path_spec=`cygpath --path --unix \"$LIB\"`\n      sys_lib_search_path_spec=`cygpath --path --dos \"$sys_lib_search_path_spec\" 2>/dev/null`\n      sys_lib_search_path_spec=`cygpath --path --unix \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      ;;\n    *)\n      sys_lib_search_path_spec=\"$LIB\"\n      if $ECHO \"$sys_lib_search_path_spec\" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then\n        # It is most probably a Windows format PATH.\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e 's/;/ /g'`\n      else\n        sys_lib_search_path_spec=`$ECHO \"$sys_lib_search_path_spec\" | $SED -e \"s/$PATH_SEPARATOR/ /g\"`\n      fi\n      # FIXME: find the short name or the path components, as spaces are\n      # common. (e.g. \"Program Files\" -> \"PROGRA~1\")\n      ;;\n    esac\n\n    # DLL is installed to $(libdir)/../bin by postinstall_cmds\n    postinstall_cmds='base_file=`basename \\${file}`~\n      dlpath=`$SHELL 2>&1 -c '\\''. $dir/'\\''\\${base_file}'\\''i; echo \\$dlname'\\''`~\n      dldir=$destdir/`dirname \\$dlpath`~\n      test -d \\$dldir || mkdir -p \\$dldir~\n      $install_prog $dir/$dlname \\$dldir/$dlname'\n    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\\''. $file; echo \\$dlname'\\''`~\n      dlpath=$dir/\\$dldll~\n       $RM \\$dlpath'\n    shlibpath_overrides_runpath=yes\n    dynamic_linker='Win32 link.exe'\n    ;;\n\n  *)\n    # Assume MSVC wrapper\n    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'\n    dynamic_linker='Win32 ld.exe'\n    ;;\n  esac\n  # FIXME: first we should search . and the directory the executable is in\n  shlibpath_var=PATH\n  ;;\n\ndarwin* | rhapsody*)\n  dynamic_linker=\"$host_os dyld\"\n  version_type=darwin\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'\n  soname_spec='${libname}${release}${major}$shared_ext'\n  shlibpath_overrides_runpath=yes\n  shlibpath_var=DYLD_LIBRARY_PATH\n  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'\nm4_if([$1], [],[\n  sys_lib_search_path_spec=\"$sys_lib_search_path_spec /usr/local/lib\"])\n  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'\n  ;;\n\ndgux*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\nfreebsd1*)\n  dynamic_linker=no\n  ;;\n\nfreebsd* | dragonfly*)\n  # DragonFly does not have aout.  When/if they implement a new\n  # versioning mechanism, adjust this.\n  if test -x /usr/bin/objformat; then\n    objformat=`/usr/bin/objformat`\n  else\n    case $host_os in\n    freebsd[[123]]*) objformat=aout ;;\n    *) objformat=elf ;;\n    esac\n  fi\n  version_type=freebsd-$objformat\n  case $version_type in\n    freebsd-elf*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n      need_version=no\n      need_lib_prefix=no\n      ;;\n    freebsd-*)\n      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'\n      need_version=yes\n      ;;\n  esac\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_os in\n  freebsd2*)\n    shlibpath_overrides_runpath=yes\n    ;;\n  freebsd3.[[01]]* | freebsdelf3.[[01]]*)\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \\\n  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)\n    shlibpath_overrides_runpath=no\n    hardcode_into_libs=yes\n    ;;\n  *) # from 4.6 on, and DragonFly\n    shlibpath_overrides_runpath=yes\n    hardcode_into_libs=yes\n    ;;\n  esac\n  ;;\n\ngnu*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nhaiku*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  dynamic_linker=\"$host_os runtime_loader\"\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'\n  hardcode_into_libs=yes\n  ;;\n\nhpux9* | hpux10* | hpux11*)\n  # Give a soname corresponding to the major version so that dld.sl refuses to\n  # link against other versions.\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  case $host_cpu in\n  ia64*)\n    shrext_cmds='.so'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.so\"\n    shlibpath_var=LD_LIBRARY_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    if test \"X$HPUX_IA64_MODE\" = X32; then\n      sys_lib_search_path_spec=\"/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib\"\n    else\n      sys_lib_search_path_spec=\"/usr/lib/hpux64 /usr/local/lib/hpux64\"\n    fi\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  hppa*64*)\n    shrext_cmds='.sl'\n    hardcode_into_libs=yes\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH\n    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    sys_lib_search_path_spec=\"/usr/lib/pa20_64 /usr/ccs/lib/pa20_64\"\n    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec\n    ;;\n  *)\n    shrext_cmds='.sl'\n    dynamic_linker=\"$host_os dld.sl\"\n    shlibpath_var=SHLIB_PATH\n    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    ;;\n  esac\n  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...\n  postinstall_cmds='chmod 555 $lib'\n  # or fails outright, so override atomically:\n  install_override_mode=555\n  ;;\n\ninterix[[3-9]]*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $host_os in\n    nonstopux*) version_type=nonstopux ;;\n    *)\n\tif test \"$lt_cv_prog_gnu_ld\" = yes; then\n\t\tversion_type=linux\n\telse\n\t\tversion_type=irix\n\tfi ;;\n  esac\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'\n  case $host_os in\n  irix5* | nonstopux*)\n    libsuff= shlibsuff=\n    ;;\n  *)\n    case $LD in # libtool.m4 will add one of these switches to LD\n    *-32|*\"-32 \"|*-melf32bsmip|*\"-melf32bsmip \")\n      libsuff= shlibsuff= libmagic=32-bit;;\n    *-n32|*\"-n32 \"|*-melf32bmipn32|*\"-melf32bmipn32 \")\n      libsuff=32 shlibsuff=N32 libmagic=N32;;\n    *-64|*\"-64 \"|*-melf64bmip|*\"-melf64bmip \")\n      libsuff=64 shlibsuff=64 libmagic=64-bit;;\n    *) libsuff= shlibsuff= libmagic=never-match;;\n    esac\n    ;;\n  esac\n  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH\n  shlibpath_overrides_runpath=no\n  sys_lib_search_path_spec=\"/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}\"\n  sys_lib_dlsearch_path_spec=\"/usr/lib${libsuff} /lib${libsuff}\"\n  hardcode_into_libs=yes\n  ;;\n\n# No shared lib support for Linux oldld, aout, or coff.\nlinux*oldld* | linux*aout* | linux*coff*)\n  dynamic_linker=no\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -n $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n\n  # Some binutils ld are patched to set DT_RUNPATH\n  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],\n    [lt_cv_shlibpath_overrides_runpath=no\n    save_LDFLAGS=$LDFLAGS\n    save_libdir=$libdir\n    eval \"libdir=/foo; wl=\\\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\\\"; \\\n\t LDFLAGS=\\\"\\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\\\"\"\n    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],\n      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep \"RUNPATH.*$libdir\" >/dev/null],\n\t [lt_cv_shlibpath_overrides_runpath=yes])])\n    LDFLAGS=$save_LDFLAGS\n    libdir=$save_libdir\n    ])\n  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath\n\n  # This implies no fast_install, which is unacceptable.\n  # Some rework will be needed to allow for fast_install\n  # before this can be enabled.\n  hardcode_into_libs=yes\n\n  # Append ld.so.conf contents to the search path\n  if test -f /etc/ld.so.conf; then\n    lt_ld_extra=`awk '/^include / { system(sprintf(\"cd /etc; cat %s 2>/dev/null\", \\[$]2)); skip = 1; } { if (!skip) print \\[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[\t ]*hwcap[\t ]/d;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/\"//g;/^$/d' | tr '\\n' ' '`\n    sys_lib_dlsearch_path_spec=\"/lib /usr/lib $lt_ld_extra\"\n  fi\n\n  # We used to test for /lib/ld.so.1 and disable shared libraries on\n  # powerpc, because MkLinux only supported shared libraries with the\n  # GNU dynamic linker.  Since this was broken with cross compilers,\n  # most powerpc-linux boxes support dynamic linking these days and\n  # people can always --disable-shared, the test was removed, and we\n  # assume the GNU/Linux dynamic linker is in use.\n  dynamic_linker='GNU/Linux ld.so'\n  ;;\n\nnetbsdelf*-gnu)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='NetBSD ld.elf_so'\n  ;;\n\nnetbsd*)\n  version_type=sunos\n  need_lib_prefix=no\n  need_version=no\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n    finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n    dynamic_linker='NetBSD (a.out) ld.so'\n  else\n    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'\n    soname_spec='${libname}${release}${shared_ext}$major'\n    dynamic_linker='NetBSD ld.elf_so'\n  fi\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  ;;\n\nnewsos6)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  ;;\n\n*nto* | *qnx*)\n  version_type=qnx\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  dynamic_linker='ldqnx.so'\n  ;;\n\nopenbsd*)\n  version_type=sunos\n  sys_lib_dlsearch_path_spec=\"/usr/lib\"\n  need_lib_prefix=no\n  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.\n  case $host_os in\n    openbsd3.3 | openbsd3.3.*)\tneed_version=yes ;;\n    *)\t\t\t\tneed_version=no  ;;\n  esac\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/sbin\" ldconfig -m $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    case $host_os in\n      openbsd2.[[89]] | openbsd2.[[89]].*)\n\tshlibpath_overrides_runpath=no\n\t;;\n      *)\n\tshlibpath_overrides_runpath=yes\n\t;;\n      esac\n  else\n    shlibpath_overrides_runpath=yes\n  fi\n  ;;\n\nos2*)\n  libname_spec='$name'\n  shrext_cmds=\".dll\"\n  need_lib_prefix=no\n  library_names_spec='$libname${shared_ext} $libname.a'\n  dynamic_linker='OS/2 ld.exe'\n  shlibpath_var=LIBPATH\n  ;;\n\nosf3* | osf4* | osf5*)\n  version_type=osf\n  need_lib_prefix=no\n  need_version=no\n  soname_spec='${libname}${release}${shared_ext}$major'\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  sys_lib_search_path_spec=\"/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib\"\n  sys_lib_dlsearch_path_spec=\"$sys_lib_search_path_spec\"\n  ;;\n\nrdos*)\n  dynamic_linker=no\n  ;;\n\nsolaris*)\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  # ldd complains unless libraries are executable\n  postinstall_cmds='chmod +x $lib'\n  ;;\n\nsunos4*)\n  version_type=sunos\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'\n  finish_cmds='PATH=\"\\$PATH:/usr/etc\" ldconfig $libdir'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  if test \"$with_gnu_ld\" = yes; then\n    need_lib_prefix=no\n  fi\n  need_version=yes\n  ;;\n\nsysv4 | sysv4.3*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  case $host_vendor in\n    sni)\n      shlibpath_overrides_runpath=no\n      need_lib_prefix=no\n      runpath_var=LD_RUN_PATH\n      ;;\n    siemens)\n      need_lib_prefix=no\n      ;;\n    motorola)\n      need_lib_prefix=no\n      need_version=no\n      shlibpath_overrides_runpath=no\n      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'\n      ;;\n  esac\n  ;;\n\nsysv4*MP*)\n  if test -d /usr/nec ;then\n    version_type=linux\n    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'\n    soname_spec='$libname${shared_ext}.$major'\n    shlibpath_var=LD_LIBRARY_PATH\n  fi\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  version_type=freebsd-elf\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=yes\n  hardcode_into_libs=yes\n  if test \"$with_gnu_ld\" = yes; then\n    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'\n  else\n    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'\n    case $host_os in\n      sco3.2v5*)\n        sys_lib_search_path_spec=\"$sys_lib_search_path_spec /lib\"\n\t;;\n    esac\n  fi\n  sys_lib_dlsearch_path_spec='/usr/lib'\n  ;;\n\ntpf*)\n  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.\n  version_type=linux\n  need_lib_prefix=no\n  need_version=no\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  shlibpath_var=LD_LIBRARY_PATH\n  shlibpath_overrides_runpath=no\n  hardcode_into_libs=yes\n  ;;\n\nuts4*)\n  version_type=linux\n  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'\n  soname_spec='${libname}${release}${shared_ext}$major'\n  shlibpath_var=LD_LIBRARY_PATH\n  ;;\n\n*)\n  dynamic_linker=no\n  ;;\nesac\nAC_MSG_RESULT([$dynamic_linker])\ntest \"$dynamic_linker\" = no && can_build_shared=no\n\nvariables_saved_for_relink=\"PATH $shlibpath_var $runpath_var\"\nif test \"$GCC\" = yes; then\n  variables_saved_for_relink=\"$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH\"\nfi\n\nif test \"${lt_cv_sys_lib_search_path_spec+set}\" = set; then\n  sys_lib_search_path_spec=\"$lt_cv_sys_lib_search_path_spec\"\nfi\nif test \"${lt_cv_sys_lib_dlsearch_path_spec+set}\" = set; then\n  sys_lib_dlsearch_path_spec=\"$lt_cv_sys_lib_dlsearch_path_spec\"\nfi\n\n_LT_DECL([], [variables_saved_for_relink], [1],\n    [Variables whose values should be saved in libtool wrapper scripts and\n    restored at link time])\n_LT_DECL([], [need_lib_prefix], [0],\n    [Do we need the \"lib\" prefix for modules?])\n_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])\n_LT_DECL([], [version_type], [0], [Library versioning type])\n_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])\n_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])\n_LT_DECL([], [shlibpath_overrides_runpath], [0],\n    [Is shlibpath searched before the hard-coded library search path?])\n_LT_DECL([], [libname_spec], [1], [Format of library name prefix])\n_LT_DECL([], [library_names_spec], [1],\n    [[List of archive names.  First name is the real one, the rest are links.\n    The last name is the one that the linker finds with -lNAME]])\n_LT_DECL([], [soname_spec], [1],\n    [[The coded name of the library, if different from the real name]])\n_LT_DECL([], [install_override_mode], [1],\n    [Permission mode override for installation of shared libraries])\n_LT_DECL([], [postinstall_cmds], [2],\n    [Command to use after installation of a shared archive])\n_LT_DECL([], [postuninstall_cmds], [2],\n    [Command to use after uninstallation of a shared archive])\n_LT_DECL([], [finish_cmds], [2],\n    [Commands used to finish a libtool library installation in a directory])\n_LT_DECL([], [finish_eval], [1],\n    [[As \"finish_cmds\", except a single script fragment to be evaled but\n    not shown]])\n_LT_DECL([], [hardcode_into_libs], [0],\n    [Whether we should hardcode library paths into libraries])\n_LT_DECL([], [sys_lib_search_path_spec], [2],\n    [Compile-time system search path for libraries])\n_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],\n    [Run-time system search path for libraries])\n])# _LT_SYS_DYNAMIC_LINKER\n\n\n# _LT_PATH_TOOL_PREFIX(TOOL)\n# --------------------------\n# find a file program which can recognize shared library\nAC_DEFUN([_LT_PATH_TOOL_PREFIX],\n[m4_require([_LT_DECL_EGREP])dnl\nAC_MSG_CHECKING([for $1])\nAC_CACHE_VAL(lt_cv_path_MAGIC_CMD,\n[case $MAGIC_CMD in\n[[\\\\/*] |  ?:[\\\\/]*])\n  lt_cv_path_MAGIC_CMD=\"$MAGIC_CMD\" # Let the user override the test with a path.\n  ;;\n*)\n  lt_save_MAGIC_CMD=\"$MAGIC_CMD\"\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\ndnl $ac_dummy forces splitting on constant user-supplied paths.\ndnl POSIX.2 word splitting is done only on the output of word expansions,\ndnl not every word.  This closes a longstanding sh security hole.\n  ac_dummy=\"m4_if([$2], , $PATH, [$2])\"\n  for ac_dir in $ac_dummy; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f $ac_dir/$1; then\n      lt_cv_path_MAGIC_CMD=\"$ac_dir/$1\"\n      if test -n \"$file_magic_test_file\"; then\n\tcase $deplibs_check_method in\n\t\"file_magic \"*)\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"file_magic \\(.*\\)\"`\n\t  MAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\n\t  if eval $file_magic_cmd \\$file_magic_test_file 2> /dev/null |\n\t    $EGREP \"$file_magic_regex\" > /dev/null; then\n\t    :\n\t  else\n\t    cat <<_LT_EOF 1>&2\n\n*** Warning: the command libtool uses to detect shared libraries,\n*** $file_magic_cmd, produces output that libtool cannot recognize.\n*** The result is that libtool may fail to recognize shared libraries\n*** as such.  This will affect the creation of libtool libraries that\n*** depend on shared libraries, but programs linked with such libtool\n*** libraries will work regardless of this problem.  Nevertheless, you\n*** may want to report the problem to your system manager and/or to\n*** bug-libtool@gnu.org\n\n_LT_EOF\n\t  fi ;;\n\tesac\n      fi\n      break\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\n  MAGIC_CMD=\"$lt_save_MAGIC_CMD\"\n  ;;\nesac])\nMAGIC_CMD=\"$lt_cv_path_MAGIC_CMD\"\nif test -n \"$MAGIC_CMD\"; then\n  AC_MSG_RESULT($MAGIC_CMD)\nelse\n  AC_MSG_RESULT(no)\nfi\n_LT_DECL([], [MAGIC_CMD], [0],\n\t [Used to examine libraries when file_magic_cmd begins with \"file\"])dnl\n])# _LT_PATH_TOOL_PREFIX\n\n# Old name:\nAU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])\n\n\n# _LT_PATH_MAGIC\n# --------------\n# find a file program which can recognize a shared library\nm4_defun([_LT_PATH_MAGIC],\n[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)\nif test -z \"$lt_cv_path_MAGIC_CMD\"; then\n  if test -n \"$ac_tool_prefix\"; then\n    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)\n  else\n    MAGIC_CMD=:\n  fi\nfi\n])# _LT_PATH_MAGIC\n\n\n# LT_PATH_LD\n# ----------\n# find the pathname to the GNU or non-GNU linker\nAC_DEFUN([LT_PATH_LD],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PROG_ECHO_BACKSLASH])dnl\n\nAC_ARG_WITH([gnu-ld],\n    [AS_HELP_STRING([--with-gnu-ld],\n\t[assume the C compiler uses GNU ld @<:@default=no@:>@])],\n    [test \"$withval\" = no || with_gnu_ld=yes],\n    [with_gnu_ld=no])dnl\n\nac_prog=ld\nif test \"$GCC\" = yes; then\n  # Check if gcc -print-prog-name=ld gives a path.\n  AC_MSG_CHECKING([for ld used by $CC])\n  case $host in\n  *-*-mingw*)\n    # gcc leaves a trailing carriage return which upsets mingw\n    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\\015'` ;;\n  *)\n    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;\n  esac\n  case $ac_prog in\n    # Accept absolute paths.\n    [[\\\\/]]* | ?:[[\\\\/]]*)\n      re_direlt='/[[^/]][[^/]]*/\\.\\./'\n      # Canonicalize the pathname of ld\n      ac_prog=`$ECHO \"$ac_prog\"| $SED 's%\\\\\\\\%/%g'`\n      while $ECHO \"$ac_prog\" | $GREP \"$re_direlt\" > /dev/null 2>&1; do\n\tac_prog=`$ECHO $ac_prog| $SED \"s%$re_direlt%/%\"`\n      done\n      test -z \"$LD\" && LD=\"$ac_prog\"\n      ;;\n  \"\")\n    # If it fails, then pretend we aren't using GCC.\n    ac_prog=ld\n    ;;\n  *)\n    # If it is relative, then search for the first ld in PATH.\n    with_gnu_ld=unknown\n    ;;\n  esac\nelif test \"$with_gnu_ld\" = yes; then\n  AC_MSG_CHECKING([for GNU ld])\nelse\n  AC_MSG_CHECKING([for non-GNU ld])\nfi\nAC_CACHE_VAL(lt_cv_path_LD,\n[if test -z \"$LD\"; then\n  lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n  for ac_dir in $PATH; do\n    IFS=\"$lt_save_ifs\"\n    test -z \"$ac_dir\" && ac_dir=.\n    if test -f \"$ac_dir/$ac_prog\" || test -f \"$ac_dir/$ac_prog$ac_exeext\"; then\n      lt_cv_path_LD=\"$ac_dir/$ac_prog\"\n      # Check to see if the program is GNU ld.  I'd rather use --version,\n      # but apparently some variants of GNU ld only accept -v.\n      # Break only if it was the GNU/non-GNU ld that we prefer.\n      case `\"$lt_cv_path_LD\" -v 2>&1 </dev/null` in\n      *GNU* | *'with BFD'*)\n\ttest \"$with_gnu_ld\" != no && break\n\t;;\n      *)\n\ttest \"$with_gnu_ld\" != yes && break\n\t;;\n      esac\n    fi\n  done\n  IFS=\"$lt_save_ifs\"\nelse\n  lt_cv_path_LD=\"$LD\" # Let the user override the test with a path.\nfi])\nLD=\"$lt_cv_path_LD\"\nif test -n \"$LD\"; then\n  AC_MSG_RESULT($LD)\nelse\n  AC_MSG_RESULT(no)\nfi\ntest -z \"$LD\" && AC_MSG_ERROR([no acceptable ld found in \\$PATH])\n_LT_PATH_LD_GNU\nAC_SUBST([LD])\n\n_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])\n])# LT_PATH_LD\n\n# Old names:\nAU_ALIAS([AM_PROG_LD], [LT_PATH_LD])\nAU_ALIAS([AC_PROG_LD], [LT_PATH_LD])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_LD], [])\ndnl AC_DEFUN([AC_PROG_LD], [])\n\n\n# _LT_PATH_LD_GNU\n#- --------------\nm4_defun([_LT_PATH_LD_GNU],\n[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,\n[# I'd rather use --version here, but apparently some GNU lds only accept -v.\ncase `$LD -v 2>&1 </dev/null` in\n*GNU* | *'with BFD'*)\n  lt_cv_prog_gnu_ld=yes\n  ;;\n*)\n  lt_cv_prog_gnu_ld=no\n  ;;\nesac])\nwith_gnu_ld=$lt_cv_prog_gnu_ld\n])# _LT_PATH_LD_GNU\n\n\n# _LT_CMD_RELOAD\n# --------------\n# find reload flag for linker\n#   -- PORTME Some linkers may need a different reload flag.\nm4_defun([_LT_CMD_RELOAD],\n[AC_CACHE_CHECK([for $LD option to reload object files],\n  lt_cv_ld_reload_flag,\n  [lt_cv_ld_reload_flag='-r'])\nreload_flag=$lt_cv_ld_reload_flag\ncase $reload_flag in\n\"\" | \" \"*) ;;\n*) reload_flag=\" $reload_flag\" ;;\nesac\nreload_cmds='$LD$reload_flag -o $output$reload_objs'\ncase $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    if test \"$GCC\" != yes; then\n      reload_cmds=false\n    fi\n    ;;\n  darwin*)\n    if test \"$GCC\" = yes; then\n      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'\n    else\n      reload_cmds='$LD$reload_flag -o $output$reload_objs'\n    fi\n    ;;\nesac\n_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl\n_LT_TAGDECL([], [reload_cmds], [2])dnl\n])# _LT_CMD_RELOAD\n\n\n# _LT_CHECK_MAGIC_METHOD\n# ----------------------\n# how to check for library dependencies\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_MAGIC_METHOD],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nAC_CACHE_CHECK([how to recognize dependent libraries],\nlt_cv_deplibs_check_method,\n[lt_cv_file_magic_cmd='$MAGIC_CMD'\nlt_cv_file_magic_test_file=\nlt_cv_deplibs_check_method='unknown'\n# Need to set the preceding variable on all platforms that support\n# interlibrary dependencies.\n# 'none' -- dependencies not supported.\n# `unknown' -- same as none, but documents that we really don't know.\n# 'pass_all' -- all dependencies passed with no checks.\n# 'test_compile' -- check by making test program.\n# 'file_magic [[regex]]' -- check by looking for files in library path\n# which responds to the $file_magic_cmd with a given extended regex.\n# If you have `file' or equivalent on your system and you're not sure\n# whether `pass_all' will *always* work, you probably want this one.\n\ncase $host_os in\naix[[4-9]]*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbeos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nbsdi[[45]]*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'\n  lt_cv_file_magic_cmd='/usr/bin/file -L'\n  lt_cv_file_magic_test_file=/shlib/libc.so\n  ;;\n\ncygwin*)\n  # func_win32_libid is a shell function defined in ltmain.sh\n  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n  lt_cv_file_magic_cmd='func_win32_libid'\n  ;;\n\nmingw* | pw32*)\n  # Base MSYS/MinGW do not provide the 'file' command needed by\n  # func_win32_libid shell function, so use a weaker test based on 'objdump',\n  # unless we find 'file', for example because we are cross-compiling.\n  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.\n  if ( test \"$lt_cv_nm_interface\" = \"BSD nm\" && file / ) >/dev/null 2>&1; then\n    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'\n    lt_cv_file_magic_cmd='func_win32_libid'\n  else\n    # Keep this pattern in sync with the one in func_win32_libid.\n    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'\n    lt_cv_file_magic_cmd='$OBJDUMP -f'\n  fi\n  ;;\n\ncegcc*)\n  # use the weaker test based on 'objdump'. See mingw*.\n  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'\n  lt_cv_file_magic_cmd='$OBJDUMP -f'\n  ;;\n\ndarwin* | rhapsody*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nfreebsd* | dragonfly*)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    case $host_cpu in\n    i*86 )\n      # Not sure whether the presence of OpenBSD here was a mistake.\n      # Let's accept both of them until this is cleared up.\n      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'\n      lt_cv_file_magic_cmd=/usr/bin/file\n      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`\n      ;;\n    esac\n  else\n    lt_cv_deplibs_check_method=pass_all\n  fi\n  ;;\n\ngnu*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhaiku*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nhpux10.20* | hpux11*)\n  lt_cv_file_magic_cmd=/usr/bin/file\n  case $host_cpu in\n  ia64*)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'\n    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so\n    ;;\n  hppa*64*)\n    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\\.[0-9]']\n    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl\n    ;;\n  *)\n    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\\.[[0-9]]) shared library'\n    lt_cv_file_magic_test_file=/usr/lib/libc.sl\n    ;;\n  esac\n  ;;\n\ninterix[[3-9]]*)\n  # PIC code is broken on Interix 3.x, that's why |\\.a not |_pic\\.a here\n  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|\\.a)$'\n  ;;\n\nirix5* | irix6* | nonstopux*)\n  case $LD in\n  *-32|*\"-32 \") libmagic=32-bit;;\n  *-n32|*\"-n32 \") libmagic=N32;;\n  *-64|*\"-64 \") libmagic=64-bit;;\n  *) libmagic=never-match;;\n  esac\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\n# This must be Linux ELF.\nlinux* | k*bsd*-gnu | kopensolaris*-gnu)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nnetbsd* | netbsdelf*-gnu)\n  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so|_pic\\.a)$'\n  fi\n  ;;\n\nnewos6*)\n  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'\n  lt_cv_file_magic_cmd=/usr/bin/file\n  lt_cv_file_magic_test_file=/usr/lib/libnls.so\n  ;;\n\n*nto* | *qnx*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nopenbsd*)\n  if test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|\\.so|_pic\\.a)$'\n  else\n    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\\.so\\.[[0-9]]+\\.[[0-9]]+|_pic\\.a)$'\n  fi\n  ;;\n\nosf3* | osf4* | osf5*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nrdos*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsolaris*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\n\nsysv4 | sysv4.3*)\n  case $host_vendor in\n  motorola)\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'\n    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`\n    ;;\n  ncr)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  sequent)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'\n    ;;\n  sni)\n    lt_cv_file_magic_cmd='/bin/file'\n    lt_cv_deplibs_check_method=\"file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib\"\n    lt_cv_file_magic_test_file=/lib/libc.so\n    ;;\n  siemens)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  pc)\n    lt_cv_deplibs_check_method=pass_all\n    ;;\n  esac\n  ;;\n\ntpf*)\n  lt_cv_deplibs_check_method=pass_all\n  ;;\nesac\n])\n\nfile_magic_glob=\nwant_nocaseglob=no\nif test \"$build\" = \"$host\"; then\n  case $host_os in\n  mingw* | pw32*)\n    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then\n      want_nocaseglob=yes\n    else\n      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e \"s/\\(..\\)/s\\/[[\\1]]\\/[[\\1]]\\/g;/g\"`\n    fi\n    ;;\n  esac\nfi\n\nfile_magic_cmd=$lt_cv_file_magic_cmd\ndeplibs_check_method=$lt_cv_deplibs_check_method\ntest -z \"$deplibs_check_method\" && deplibs_check_method=unknown\n\n_LT_DECL([], [deplibs_check_method], [1],\n    [Method to check whether dependent libraries are shared objects])\n_LT_DECL([], [file_magic_cmd], [1],\n    [Command to use when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [file_magic_glob], [1],\n    [How to find potential files when deplibs_check_method = \"file_magic\"])\n_LT_DECL([], [want_nocaseglob], [1],\n    [Find potential files using nocaseglob when deplibs_check_method = \"file_magic\"])\n])# _LT_CHECK_MAGIC_METHOD\n\n\n# LT_PATH_NM\n# ----------\n# find the pathname to a BSD- or MS-compatible name lister\nAC_DEFUN([LT_PATH_NM],\n[AC_REQUIRE([AC_PROG_CC])dnl\nAC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,\n[if test -n \"$NM\"; then\n  # Let the user override the test.\n  lt_cv_path_NM=\"$NM\"\nelse\n  lt_nm_to_check=\"${ac_tool_prefix}nm\"\n  if test -n \"$ac_tool_prefix\" && test \"$build\" = \"$host\"; then\n    lt_nm_to_check=\"$lt_nm_to_check nm\"\n  fi\n  for lt_tmp_nm in $lt_nm_to_check; do\n    lt_save_ifs=\"$IFS\"; IFS=$PATH_SEPARATOR\n    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do\n      IFS=\"$lt_save_ifs\"\n      test -z \"$ac_dir\" && ac_dir=.\n      tmp_nm=\"$ac_dir/$lt_tmp_nm\"\n      if test -f \"$tmp_nm\" || test -f \"$tmp_nm$ac_exeext\" ; then\n\t# Check to see if the nm accepts a BSD-compat flag.\n\t# Adding the `sed 1q' prevents false positives on HP-UX, which says:\n\t#   nm: unknown option \"B\" ignored\n\t# Tru64's nm complains that /dev/null is an invalid object file\n\tcase `\"$tmp_nm\" -B /dev/null 2>&1 | sed '1q'` in\n\t*/dev/null* | *'Invalid file or object type'*)\n\t  lt_cv_path_NM=\"$tmp_nm -B\"\n\t  break\n\t  ;;\n\t*)\n\t  case `\"$tmp_nm\" -p /dev/null 2>&1 | sed '1q'` in\n\t  */dev/null*)\n\t    lt_cv_path_NM=\"$tmp_nm -p\"\n\t    break\n\t    ;;\n\t  *)\n\t    lt_cv_path_NM=${lt_cv_path_NM=\"$tmp_nm\"} # keep the first match, but\n\t    continue # so that we can try to find one that supports BSD flags\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n      fi\n    done\n    IFS=\"$lt_save_ifs\"\n  done\n  : ${lt_cv_path_NM=no}\nfi])\nif test \"$lt_cv_path_NM\" != \"no\"; then\n  NM=\"$lt_cv_path_NM\"\nelse\n  # Didn't find any BSD compatible name lister, look for dumpbin.\n  if test -n \"$DUMPBIN\"; then :\n    # Let the user override the test.\n  else\n    AC_CHECK_TOOLS(DUMPBIN, [dumpbin \"link -dump\"], :)\n    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in\n    *COFF*)\n      DUMPBIN=\"$DUMPBIN -symbols\"\n      ;;\n    *)\n      DUMPBIN=:\n      ;;\n    esac\n  fi\n  AC_SUBST([DUMPBIN])\n  if test \"$DUMPBIN\" != \":\"; then\n    NM=\"$DUMPBIN\"\n  fi\nfi\ntest -z \"$NM\" && NM=nm\nAC_SUBST([NM])\n_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl\n\nAC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],\n  [lt_cv_nm_interface=\"BSD nm\"\n  echo \"int some_variable = 0;\" > conftest.$ac_ext\n  (eval echo \"\\\"\\$as_me:$LINENO: $ac_compile\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$ac_compile\" 2>conftest.err)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: $NM \\\\\\\"conftest.$ac_objext\\\\\\\"\\\"\" >&AS_MESSAGE_LOG_FD)\n  (eval \"$NM \\\"conftest.$ac_objext\\\"\" 2>conftest.err > conftest.out)\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  (eval echo \"\\\"\\$as_me:$LINENO: output\\\"\" >&AS_MESSAGE_LOG_FD)\n  cat conftest.out >&AS_MESSAGE_LOG_FD\n  if $GREP 'External.*some_variable' conftest.out > /dev/null; then\n    lt_cv_nm_interface=\"MS dumpbin\"\n  fi\n  rm -f conftest*])\n])# LT_PATH_NM\n\n# Old names:\nAU_ALIAS([AM_PROG_NM], [LT_PATH_NM])\nAU_ALIAS([AC_PROG_NM], [LT_PATH_NM])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AM_PROG_NM], [])\ndnl AC_DEFUN([AC_PROG_NM], [])\n\n# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n# --------------------------------\n# how to determine the name of the shared library\n# associated with a specific link library.\n#  -- PORTME fill in with the dynamic library characteristics\nm4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],\n[m4_require([_LT_DECL_EGREP])\nm4_require([_LT_DECL_OBJDUMP])\nm4_require([_LT_DECL_DLLTOOL])\nAC_CACHE_CHECK([how to associate runtime and link libraries],\nlt_cv_sharedlib_from_linklib_cmd,\n[lt_cv_sharedlib_from_linklib_cmd='unknown'\n\ncase $host_os in\ncygwin* | mingw* | pw32* | cegcc*)\n  # two different shell functions defined in ltmain.sh\n  # decide which to use based on capabilities of $DLLTOOL\n  case `$DLLTOOL --help 2>&1` in\n  *--identify-strict*)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib\n    ;;\n  *)\n    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback\n    ;;\n  esac\n  ;;\n*)\n  # fallback: assume linklib IS sharedlib\n  lt_cv_sharedlib_from_linklib_cmd=\"$ECHO\"\n  ;;\nesac\n])\nsharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd\ntest -z \"$sharedlib_from_linklib_cmd\" && sharedlib_from_linklib_cmd=$ECHO\n\n_LT_DECL([], [sharedlib_from_linklib_cmd], [1],\n    [Command to associate shared and link libraries])\n])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB\n\n\n# _LT_PATH_MANIFEST_TOOL\n# ----------------------\n# locate the manifest tool\nm4_defun([_LT_PATH_MANIFEST_TOOL],\n[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)\ntest -z \"$MANIFEST_TOOL\" && MANIFEST_TOOL=mt\nAC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],\n  [lt_cv_path_mainfest_tool=no\n  echo \"$as_me:$LINENO: $MANIFEST_TOOL '-?'\" >&AS_MESSAGE_LOG_FD\n  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out\n  cat conftest.err >&AS_MESSAGE_LOG_FD\n  if $GREP 'Manifest Tool' conftest.out > /dev/null; then\n    lt_cv_path_mainfest_tool=yes\n  fi\n  rm -f conftest*])\nif test \"x$lt_cv_path_mainfest_tool\" != xyes; then\n  MANIFEST_TOOL=:\nfi\n_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl\n])# _LT_PATH_MANIFEST_TOOL\n\n\n# LT_LIB_M\n# --------\n# check for math library\nAC_DEFUN([LT_LIB_M],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nLIBM=\ncase $host in\n*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)\n  # These system don't have libm, or don't need it\n  ;;\n*-ncr-sysv4.3*)\n  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=\"-lmw\")\n  AC_CHECK_LIB(m, cos, LIBM=\"$LIBM -lm\")\n  ;;\n*)\n  AC_CHECK_LIB(m, cos, LIBM=\"-lm\")\n  ;;\nesac\nAC_SUBST([LIBM])\n])# LT_LIB_M\n\n# Old name:\nAU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([AC_CHECK_LIBM], [])\n\n\n# _LT_COMPILER_NO_RTTI([TAGNAME])\n# -------------------------------\nm4_defun([_LT_COMPILER_NO_RTTI],\n[m4_require([_LT_TAG_COMPILER])dnl\n\n_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n\nif test \"$GCC\" = yes; then\n  case $cc_basename in\n  nvcc*)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;\n  esac\n\n  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],\n    lt_cv_prog_compiler_rtti_exceptions,\n    [-fno-rtti -fno-exceptions], [],\n    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\"$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions\"])\nfi\n_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],\n\t[Compiler flag to turn off builtin functions])\n])# _LT_COMPILER_NO_RTTI\n\n\n# _LT_CMD_GLOBAL_SYMBOLS\n# ----------------------\nm4_defun([_LT_CMD_GLOBAL_SYMBOLS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_PROG_CC])dnl\nAC_REQUIRE([AC_PROG_AWK])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nAC_REQUIRE([LT_PATH_LD])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_TAG_COMPILER])dnl\n\n# Check for command to grab the raw symbol name followed by C symbol from nm.\nAC_MSG_CHECKING([command to parse $NM output from $compiler object])\nAC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],\n[\n# These are sane defaults that work on at least a few old systems.\n# [They come from Ultrix.  What could be older than Ultrix?!! ;)]\n\n# Character class describing NM global symbol codes.\nsymcode='[[BCDEGRST]]'\n\n# Regexp to match symbols that can be accessed directly from C.\nsympat='\\([[_A-Za-z]][[_A-Za-z0-9]]*\\)'\n\n# Define system-specific variables.\ncase $host_os in\naix*)\n  symcode='[[BCDT]]'\n  ;;\ncygwin* | mingw* | pw32* | cegcc*)\n  symcode='[[ABCDGISTW]]'\n  ;;\nhpux*)\n  if test \"$host_cpu\" = ia64; then\n    symcode='[[ABCDEGRST]]'\n  fi\n  ;;\nirix* | nonstopux*)\n  symcode='[[BCDEGRST]]'\n  ;;\nosf*)\n  symcode='[[BCDEGQRST]]'\n  ;;\nsolaris*)\n  symcode='[[BDRT]]'\n  ;;\nsco3.2v5*)\n  symcode='[[DT]]'\n  ;;\nsysv4.2uw2*)\n  symcode='[[DT]]'\n  ;;\nsysv5* | sco5v6* | unixware* | OpenUNIX*)\n  symcode='[[ABDT]]'\n  ;;\nsysv4)\n  symcode='[[DFNSTU]]'\n  ;;\nesac\n\n# If we're using GNU nm, then use its standard symbol codes.\ncase `$NM -V 2>&1` in\n*GNU* | *'with BFD'*)\n  symcode='[[ABCDGIRSTW]]' ;;\nesac\n\n# Transform an extracted symbol line into a proper C declaration.\n# Some systems (esp. on ia64) link data and code symbols differently,\n# so use this general approach.\nlt_cv_sys_global_symbol_to_cdecl=\"sed -n -e 's/^T .* \\(.*\\)$/extern int \\1();/p' -e 's/^$symcode* .* \\(.*\\)$/extern char \\1;/p'\"\n\n# Transform an extracted symbol line into symbol name and symbol address\nlt_cv_sys_global_symbol_to_c_name_address=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p'\"\nlt_cv_sys_global_symbol_to_c_name_address_lib_prefix=\"sed -n -e 's/^: \\([[^ ]]*\\)[[ ]]*$/  {\\\\\\\"\\1\\\\\\\", (void *) 0},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\(lib[[^ ]]*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/p' -e 's/^$symcode* \\([[^ ]]*\\) \\([[^ ]]*\\)$/  {\\\"lib\\2\\\", (void *) \\&\\2},/p'\"\n\n# Handle CRLF in mingw tool chain\nopt_cr=\ncase $build_os in\nmingw*)\n  opt_cr=`$ECHO 'x\\{0,1\\}' | tr x '\\015'` # option cr in regexp\n  ;;\nesac\n\n# Try without a prefix underscore, then with it.\nfor ac_symprfx in \"\" \"_\"; do\n\n  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.\n  symxfrm=\"\\\\1 $ac_symprfx\\\\2 \\\\2\"\n\n  # Write the raw and C identifiers.\n  if test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n    # Fake it for dumpbin and say T for any non-static function\n    # and D for any global variable.\n    # Also find C++ and __fastcall symbols from MSVC++,\n    # which start with @ or ?.\n    lt_cv_sys_global_symbol_pipe=\"$AWK ['\"\\\n\"     {last_section=section; section=\\$ 3};\"\\\n\"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};\"\\\n\"     \\$ 0!~/External *\\|/{next};\"\\\n\"     / 0+ UNDEF /{next}; / UNDEF \\([^|]\\)*()/{next};\"\\\n\"     {if(hide[section]) next};\"\\\n\"     {f=0}; \\$ 0~/\\(\\).*\\|/{f=1}; {printf f ? \\\"T \\\" : \\\"D \\\"};\"\\\n\"     {split(\\$ 0, a, /\\||\\r/); split(a[2], s)};\"\\\n\"     s[1]~/^[@?]/{print s[1], s[1]; next};\"\\\n\"     s[1]~prfx {split(s[1],t,\\\"@\\\"); print t[1], substr(t[1],length(prfx))}\"\\\n\"     ' prfx=^$ac_symprfx]\"\n  else\n    lt_cv_sys_global_symbol_pipe=\"sed -n -e 's/^.*[[\t ]]\\($symcode$symcode*\\)[[\t ]][[\t ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'\"\n  fi\n  lt_cv_sys_global_symbol_pipe=\"$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'\"\n\n  # Check to see that the pipe works correctly.\n  pipe_works=no\n\n  rm -f conftest*\n  cat > conftest.$ac_ext <<_LT_EOF\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nchar nm_test_var;\nvoid nm_test_func(void);\nvoid nm_test_func(void){}\n#ifdef __cplusplus\n}\n#endif\nint main(){nm_test_var='a';nm_test_func();return(0);}\n_LT_EOF\n\n  if AC_TRY_EVAL(ac_compile); then\n    # Now try to grab the symbols.\n    nlist=conftest.nm\n    if AC_TRY_EVAL(NM conftest.$ac_objext \\| \"$lt_cv_sys_global_symbol_pipe\" \\> $nlist) && test -s \"$nlist\"; then\n      # Try sorting and uniquifying the output.\n      if sort \"$nlist\" | uniq > \"$nlist\"T; then\n\tmv -f \"$nlist\"T \"$nlist\"\n      else\n\trm -f \"$nlist\"T\n      fi\n\n      # Make sure that we snagged all the symbols we need.\n      if $GREP ' nm_test_var$' \"$nlist\" >/dev/null; then\n\tif $GREP ' nm_test_func$' \"$nlist\" >/dev/null; then\n\t  cat <<_LT_EOF > conftest.$ac_ext\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT@&t@_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT@&t@_DLSYM_CONST\n#else\n# define LT@&t@_DLSYM_CONST const\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n_LT_EOF\n\t  # Now generate the symbol file.\n\t  eval \"$lt_cv_sys_global_symbol_to_cdecl\"' < \"$nlist\" | $GREP -v main >> conftest.$ac_ext'\n\n\t  cat <<_LT_EOF >> conftest.$ac_ext\n\n/* The mapping between symbol names and symbols.  */\nLT@&t@_DLSYM_CONST struct {\n  const char *name;\n  void       *address;\n}\nlt__PROGRAM__LTX_preloaded_symbols[[]] =\n{\n  { \"@PROGRAM@\", (void *) 0 },\n_LT_EOF\n\t  $SED \"s/^$symcode$symcode* \\(.*\\) \\(.*\\)$/  {\\\"\\2\\\", (void *) \\&\\2},/\" < \"$nlist\" | $GREP -v main >> conftest.$ac_ext\n\t  cat <<\\_LT_EOF >> conftest.$ac_ext\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt__PROGRAM__LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n_LT_EOF\n\t  # Now try linking the two files.\n\t  mv conftest.$ac_objext conftstm.$ac_objext\n\t  lt_globsym_save_LIBS=$LIBS\n\t  lt_globsym_save_CFLAGS=$CFLAGS\n\t  LIBS=\"conftstm.$ac_objext\"\n\t  CFLAGS=\"$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)\"\n\t  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then\n\t    pipe_works=yes\n\t  fi\n\t  LIBS=$lt_globsym_save_LIBS\n\t  CFLAGS=$lt_globsym_save_CFLAGS\n\telse\n\t  echo \"cannot find nm_test_func in $nlist\" >&AS_MESSAGE_LOG_FD\n\tfi\n      else\n\techo \"cannot find nm_test_var in $nlist\" >&AS_MESSAGE_LOG_FD\n      fi\n    else\n      echo \"cannot run $lt_cv_sys_global_symbol_pipe\" >&AS_MESSAGE_LOG_FD\n    fi\n  else\n    echo \"$progname: failed program was:\" >&AS_MESSAGE_LOG_FD\n    cat conftest.$ac_ext >&5\n  fi\n  rm -rf conftest* conftst*\n\n  # Do not use the global_symbol_pipe unless it works.\n  if test \"$pipe_works\" = yes; then\n    break\n  else\n    lt_cv_sys_global_symbol_pipe=\n  fi\ndone\n])\nif test -z \"$lt_cv_sys_global_symbol_pipe\"; then\n  lt_cv_sys_global_symbol_to_cdecl=\nfi\nif test -z \"$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl\"; then\n  AC_MSG_RESULT(failed)\nelse\n  AC_MSG_RESULT(ok)\nfi\n\n# Response file support.\nif test \"$lt_cv_nm_interface\" = \"MS dumpbin\"; then\n  nm_file_list_spec='@'\nelif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then\n  nm_file_list_spec='@'\nfi\n\n_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],\n    [Take the output of nm and produce a listing of raw symbols and C names])\n_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],\n    [Transform the output of nm in a proper C declaration])\n_LT_DECL([global_symbol_to_c_name_address],\n    [lt_cv_sys_global_symbol_to_c_name_address], [1],\n    [Transform the output of nm in a C name address pair])\n_LT_DECL([global_symbol_to_c_name_address_lib_prefix],\n    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],\n    [Transform the output of nm in a C name address pair when lib prefix is needed])\n_LT_DECL([], [nm_file_list_spec], [1],\n    [Specify filename containing input files for $NM])\n]) # _LT_CMD_GLOBAL_SYMBOLS\n\n\n# _LT_COMPILER_PIC([TAGNAME])\n# ---------------------------\nm4_defun([_LT_COMPILER_PIC],\n[m4_require([_LT_TAG_COMPILER])dnl\n_LT_TAGVAR(lt_prog_compiler_wl, $1)=\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n_LT_TAGVAR(lt_prog_compiler_static, $1)=\n\nm4_if([$1], [CXX], [\n  # C++ specific cases for pic, static, wl, etc.\n  if test \"$GXX\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n    aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n    mingw* | cygwin* | os2* | pw32* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n    *djgpp*)\n      # DJGPP does not support shared libraries at all\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n      ;;\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n    *qnx* | *nto*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n  else\n    case $host_os in\n      aix[[4-9]]*)\n\t# All AIX code is PIC.\n\tif test \"$host_cpu\" = ia64; then\n\t  # AIX 5 now supports IA64 processor\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\telse\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n\tfi\n\t;;\n      chorus*)\n\tcase $cc_basename in\n\tcxch68*)\n\t  # Green Hills C++ Compiler\n\t  # _LT_TAGVAR(lt_prog_compiler_static, $1)=\"--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a\"\n\t  ;;\n\tesac\n\t;;\n      mingw* | cygwin* | os2* | pw32* | cegcc*)\n\t# This hack is so that the source file can tell whether it is being\n\t# built for inclusion in a dll (and should export symbols for example).\n\tm4_if([$1], [GCJ], [],\n\t  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n\t;;\n      dgux*)\n\tcase $cc_basename in\n\t  ec++*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  ghcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      freebsd* | dragonfly*)\n\t# FreeBSD uses GNU C++\n\t;;\n      hpux9* | hpux10* | hpux11*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    if test \"$host_cpu\" != ia64; then\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t    fi\n\t    ;;\n\t  aCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n\t    case $host_cpu in\n\t    hppa*64*|ia64*)\n\t      # +Z the default\n\t      ;;\n\t    *)\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t      ;;\n\t    esac\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      interix*)\n\t# This is c89, which is MS Visual C++ (no shared libs)\n\t# Anyone wants to do a port?\n\t;;\n      irix5* | irix6* | nonstopux*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    # CC pic flag -KPIC is the default.\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n\tcase $cc_basename in\n\t  KCC*)\n\t    # KAI C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    ;;\n\t  ecpc* )\n\t    # old Intel C++ for x86_64 which still supported -KPIC.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  icpc* )\n\t    # Intel C++, used to be incompatible with GCC.\n\t    # ICC 10 doesn't accept -KPIC any more.\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\t    ;;\n\t  pgCC* | pgcpp*)\n\t    # Portland Group C++ compiler\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)\n\t    # IBM XL 8.0, 9.0 on PPC and BlueGene\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n      lynxos*)\n\t;;\n      m88k*)\n\t;;\n      mvs*)\n\tcase $cc_basename in\n\t  cxx*)\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      netbsd* | netbsdelf*-gnu)\n\t;;\n      *qnx* | *nto*)\n        # QNX uses GNU C++, but need to define -shared option too, otherwise\n        # it will coredump.\n        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n        ;;\n      osf3* | osf4* | osf5*)\n\tcase $cc_basename in\n\t  KCC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'\n\t    ;;\n\t  RCC*)\n\t    # Rational C++ 2.4.1\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  cxx*)\n\t    # Digital/Compaq C++\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    # Make sure the PIC flag is empty.  It appears that all Alpha\n\t    # Linux and Compaq Tru64 Unix objects are PIC.\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      psos*)\n\t;;\n      solaris*)\n\tcase $cc_basename in\n\t  CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n\t    ;;\n\t  gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sunos4*)\n\tcase $cc_basename in\n\t  CC*)\n\t    # Sun C++ 4.x\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\t  lcc*)\n\t    # Lucid\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n\tcase $cc_basename in\n\t  CC*)\n\t    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t    ;;\n\tesac\n\t;;\n      tandem*)\n\tcase $cc_basename in\n\t  NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t    ;;\n\t  *)\n\t    ;;\n\tesac\n\t;;\n      vxworks*)\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n\t;;\n    esac\n  fi\n],\n[\n  if test \"$GCC\" = yes; then\n    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n\n    case $host_os in\n      aix*)\n      # All AIX code is PIC.\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n        ;;\n      m68k)\n            # FIXME: we need at least 68020 code to build shared libraries, but\n            # adding the `-m68020' flag to GCC prevents building anything better,\n            # like `-m68040'.\n            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'\n        ;;\n      esac\n      ;;\n\n    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)\n      # PIC is the default for these OSes.\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      # Although the cygwin gcc ignores -fPIC, still need this for old-style\n      # (--disable-auto-import) libraries\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    darwin* | rhapsody*)\n      # PIC is the default on this platform\n      # Common symbols not allowed in MH_DYLIB files\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'\n      ;;\n\n    haiku*)\n      # PIC is the default for Haiku.\n      # The \"-static\" flag exists, but is broken.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)=\n      ;;\n\n    hpux*)\n      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit\n      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag\n      # sets the default TLS model and affects inlining.\n      case $host_cpu in\n      hppa*64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t;;\n      esac\n      ;;\n\n    interix[[3-9]]*)\n      # Interix 3.x gcc -fpic/-fPIC options generate broken code.\n      # Instead, we relocate shared libraries at runtime.\n      ;;\n\n    msdosdjgpp*)\n      # Just because we use GCC doesn't mean we suddenly get shared libraries\n      # on systems that don't support them.\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      enable_shared=no\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic\n      fi\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n      ;;\n    esac\n\n    case $cc_basename in\n    nvcc*) # Cuda Compiler Driver 2.2\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'\n      ;;\n    esac\n  else\n    # PORTME Check for flag to pass linker flags through the system compiler.\n    case $host_os in\n    aix*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      if test \"$host_cpu\" = ia64; then\n\t# AIX 5 now supports IA64 processor\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      else\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'\n      fi\n      ;;\n\n    mingw* | cygwin* | pw32* | os2* | cegcc*)\n      # This hack is so that the source file can tell whether it is being\n      # built for inclusion in a dll (and should export symbols for example).\n      m4_if([$1], [GCJ], [],\n\t[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])\n      ;;\n\n    hpux9* | hpux10* | hpux11*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but\n      # not for PA HP-UX.\n      case $host_cpu in\n      hppa*64*|ia64*)\n\t# +Z the default\n\t;;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'\n\t;;\n      esac\n      # Is there a better lt_prog_compiler_static that works with the bundled CC?\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # PIC (with -KPIC) is the default.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    linux* | k*bsd*-gnu | kopensolaris*-gnu)\n      case $cc_basename in\n      # old Intel for x86_64 which still supported -KPIC.\n      ecc*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # icc used to be incompatible with GCC.\n      # ICC 10 doesn't accept -KPIC any more.\n      icc* | ifort*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'\n        ;;\n      # Lahey Fortran 8.1.\n      lf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'\n\t;;\n      nagfor*)\n\t# NAG Fortran compiler\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t;;\n      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)\n        # Portland Group compilers (*not* the Pentium gcc compiler,\n\t# which looks to be a dead project)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n        ;;\n      ccc*)\n        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n        # All Alpha code is PIC.\n        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n        ;;\n      xl* | bgxl* | bgf* | mpixl*)\n\t# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'\n\t;;\n      *)\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ F* | *Sun*Fortran*)\n\t  # Sun Fortran 8.3 passes all unrecognized flags to the linker\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''\n\t  ;;\n\t*Sun\\ C*)\n\t  # Sun C 5.9\n\t  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n\t  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n\t  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n\t  ;;\n\tesac\n\t;;\n      esac\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *nto* | *qnx*)\n      # QNX uses GNU C++, but need to define -shared option too, otherwise\n      # it will coredump.\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'\n      ;;\n\n    osf3* | osf4* | osf5*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      # All OSF/1 code is PIC.\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    rdos*)\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      case $cc_basename in\n      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;\n      *)\n\t_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4 | sysv4.2uw2* | sysv4.3*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec ;then\n\t_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'\n\t_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      fi\n      ;;\n\n    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    unicos*)\n      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'\n      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'\n      ;;\n\n    *)\n      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no\n      ;;\n    esac\n  fi\n])\ncase $host_os in\n  # For platforms which do not support PIC, -DPIC is meaningless:\n  *djgpp*)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\n    ;;\n  *)\n    _LT_TAGVAR(lt_prog_compiler_pic, $1)=\"$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])\"\n    ;;\nesac\n\nAC_CACHE_CHECK([for $compiler option to produce PIC],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],\n  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])\n_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)\n\n#\n# Check to make sure the PIC flag actually works.\n#\nif test -n \"$_LT_TAGVAR(lt_prog_compiler_pic, $1)\"; then\n  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],\n    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],\n    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],\n    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in\n     \"\" | \" \"*) ;;\n     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=\" $_LT_TAGVAR(lt_prog_compiler_pic, $1)\" ;;\n     esac],\n    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=\n     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])\nfi\n_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],\n\t[Additional compiler flags for building library objects])\n\n_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],\n\t[How to pass a linker flag through the compiler])\n#\n# Check to make sure the static flag actually works.\n#\nwl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\\\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\\\"\n_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],\n  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),\n  $lt_tmp_static_flag,\n  [],\n  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])\n_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],\n\t[Compiler flag to prevent dynamic linking])\n])# _LT_COMPILER_PIC\n\n\n# _LT_LINKER_SHLIBS([TAGNAME])\n# ----------------------------\n# See if the linker supports building shared libraries.\nm4_defun([_LT_LINKER_SHLIBS],\n[AC_REQUIRE([LT_PATH_LD])dnl\nAC_REQUIRE([LT_PATH_NM])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nm4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_DECL_SED])dnl\nm4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl\nm4_require([_LT_TAG_COMPILER])dnl\nAC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\nm4_if([$1], [CXX], [\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  case $host_os in\n  aix[[4-9]]*)\n    # If we're using GNU nm, then we don't want the \"-C\" option.\n    # -C means demangle to AIX nm, but means don't demangle with GNU nm\n    # Also, AIX nm treats weak defined symbols like other global defined\n    # symbols, whereas GNU nm marks them as \"W\".\n    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    else\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n    fi\n    ;;\n  pw32*)\n    _LT_TAGVAR(export_symbols_cmds, $1)=\"$ltdll_cmds\"\n    ;;\n  cygwin* | mingw* | cegcc*)\n    case $cc_basename in\n    cl*) ;;\n    *)\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n      ;;\n    esac\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  *)\n    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n    ;;\n  esac\n], [\n  runpath_var=\n  _LT_TAGVAR(allow_undefined_flag, $1)=\n  _LT_TAGVAR(always_export_symbols, $1)=no\n  _LT_TAGVAR(archive_cmds, $1)=\n  _LT_TAGVAR(archive_expsym_cmds, $1)=\n  _LT_TAGVAR(compiler_needs_object, $1)=no\n  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n  _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\\''s/.* //'\\'' | sort | uniq > $export_symbols'\n  _LT_TAGVAR(hardcode_automatic, $1)=no\n  _LT_TAGVAR(hardcode_direct, $1)=no\n  _LT_TAGVAR(hardcode_direct_absolute, $1)=no\n  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n  _LT_TAGVAR(hardcode_minus_L, $1)=no\n  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n  _LT_TAGVAR(inherit_rpath, $1)=no\n  _LT_TAGVAR(link_all_deplibs, $1)=unknown\n  _LT_TAGVAR(module_cmds, $1)=\n  _LT_TAGVAR(module_expsym_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_new_cmds, $1)=\n  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=\n  _LT_TAGVAR(thread_safe_flag_spec, $1)=\n  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n  # include_expsyms should be a list of space-separated symbols to be *always*\n  # included in the symbol list\n  _LT_TAGVAR(include_expsyms, $1)=\n  # exclude_expsyms can be an extended regexp of symbols to exclude\n  # it will be wrapped by ` (' and `)$', so one must not match beginning or\n  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',\n  # as well as any symbol that contains `d'.\n  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']\n  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out\n  # platforms (ab)use it in PIC code, but their linkers get confused if\n  # the symbol is explicitly referenced.  Since portable code cannot\n  # rely on this symbol name, it's probably fine to never include it in\n  # preloaded symbol tables.\n  # Exclude shared library initialization/finalization symbols.\ndnl Note also adjust exclude_expsyms for C++ above.\n  extract_expsyms_cmds=\n\n  case $host_os in\n  cygwin* | mingw* | pw32* | cegcc*)\n    # FIXME: the MSVC++ port hasn't been tested in a loooong time\n    # When not using gcc, we currently assume that we are using\n    # Microsoft Visual C++.\n    if test \"$GCC\" != yes; then\n      with_gnu_ld=no\n    fi\n    ;;\n  interix*)\n    # we just hope/assume this is gcc and not c89 (= MSVC++)\n    with_gnu_ld=yes\n    ;;\n  openbsd*)\n    with_gnu_ld=no\n    ;;\n  linux* | k*bsd*-gnu | gnu*)\n    _LT_TAGVAR(link_all_deplibs, $1)=no\n    ;;\n  esac\n\n  _LT_TAGVAR(ld_shlibs, $1)=yes\n\n  # On some targets, GNU ld is compatible enough with the native linker\n  # that we're better off using the native interface for both.\n  lt_use_gnu_ld_interface=no\n  if test \"$with_gnu_ld\" = yes; then\n    case $host_os in\n      aix*)\n\t# The AIX port of GNU ld has always aspired to compatibility\n\t# with the native linker.  However, as the warning in the GNU ld\n\t# block says, versions before 2.19.5* couldn't really create working\n\t# shared libraries, regardless of the interface used.\n\tcase `$LD -v 2>&1` in\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.19.5*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ 2.[[2-9]]*) ;;\n\t  *\\ \\(GNU\\ Binutils\\)\\ [[3-9]]*) ;;\n\t  *)\n\t    lt_use_gnu_ld_interface=yes\n\t    ;;\n\tesac\n\t;;\n      *)\n\tlt_use_gnu_ld_interface=yes\n\t;;\n    esac\n  fi\n\n  if test \"$lt_use_gnu_ld_interface\" = yes; then\n    # If archive_cmds runs LD, not CC, wlarc should be empty\n    wlarc='${wl}'\n\n    # Set some defaults for GNU ld with shared library support. These\n    # are reset later if shared libraries are not supported. Putting them\n    # here allows them to be overridden if necessary.\n    runpath_var=LD_RUN_PATH\n    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n    # ancient GNU ld didn't support --whole-archive et. al.\n    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n    else\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n    supports_anon_versioning=no\n    case `$LD -v 2>&1` in\n      *GNU\\ gold*) supports_anon_versioning=yes ;;\n      *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.10.*) ;; # catch versions < 2.11\n      *\\ 2.11.93.0.2\\ *) supports_anon_versioning=yes ;; # RH7.3 ...\n      *\\ 2.11.92.0.12\\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...\n      *\\ 2.11.*) ;; # other 2.11 versions\n      *) supports_anon_versioning=yes ;;\n    esac\n\n    # See if GNU ld supports shared libraries.\n    case $host_os in\n    aix[[3-9]]*)\n      # On AIX/PPC, the GNU linker is very broken\n      if test \"$host_cpu\" != ia64; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: the GNU linker, at least up to release 2.19, is reported\n*** to be unable to reliably create shared libraries on AIX.\n*** Therefore, libtool is disabling shared libraries support.  If you\n*** really care for shared libraries, you may want to install binutils\n*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.\n*** You will then need to restart the configuration process.\n\n_LT_EOF\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    beos*)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t# support --undefined.  This deserves some investigation.  FIXME\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n      # as there is no search path for DLLs.\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=no\n      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1 DATA/;s/^.*[[ ]]__nm__\\([[^ ]]*\\)[[ ]][[^ ]]*/\\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\\'' | sort | uniq > $export_symbols'\n      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']\n\n      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t# If the export-symbols file already is a .def file (1st line\n\t# is EXPORTS), use it as is; otherwise, prepend...\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t  cp $export_symbols $output_objdir/$soname.def;\n\telse\n\t  echo EXPORTS > $output_objdir/$soname.def;\n\t  cat $export_symbols >> $output_objdir/$soname.def;\n\tfi~\n\t$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    haiku*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    interix[[3-9]]*)\n      _LT_TAGVAR(hardcode_direct, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n      # Instead, shared libraries are loaded at an image base (0x10000000 by\n      # default) and relocated if they conflict, which is a slow very memory\n      # consuming and fragmenting process.  To avoid this, we pick a random,\n      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      _LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n      ;;\n\n    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)\n      tmp_diet=no\n      if test \"$host_os\" = linux-dietlibc; then\n\tcase $cc_basename in\n\t  diet\\ *) tmp_diet=yes;;\t# linux-dietlibc with static linking (!diet-dyn)\n\tesac\n      fi\n      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \\\n\t && test \"$tmp_diet\" = no\n      then\n\ttmp_addflag=' $pic_flag'\n\ttmp_sharedflag='-shared'\n\tcase $cc_basename,$host_cpu in\n        pgcc*)\t\t\t\t# Portland Group C compiler\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag'\n\t  ;;\n\tpgf77* | pgf90* | pgf95* | pgfortran*)\n\t\t\t\t\t# Portland Group f77 and f90 compilers\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  tmp_addflag=' $pic_flag -Mnomain' ;;\n\tecc*,ia64* | icc*,ia64*)\t# Intel C compiler on ia64\n\t  tmp_addflag=' -i_dynamic' ;;\n\tefc*,ia64* | ifort*,ia64*)\t# Intel Fortran compiler on ia64\n\t  tmp_addflag=' -i_dynamic -nofor_main' ;;\n\tifc* | ifort*)\t\t\t# Intel Fortran compiler\n\t  tmp_addflag=' -nofor_main' ;;\n\tlf95*)\t\t\t\t# Lahey Fortran 8.1\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)=\n\t  tmp_sharedflag='--shared' ;;\n\txl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)\n\t  tmp_sharedflag='-qmkshrobj'\n\t  tmp_addflag= ;;\n\tnvcc*)\t# Cuda Compiler Driver 2.2\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  ;;\n\tesac\n\tcase `$CC -V 2>&1 | sed 5q` in\n\t*Sun\\ C*)\t\t\t# Sun C 5.9\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t  _LT_TAGVAR(compiler_needs_object, $1)=yes\n\t  tmp_sharedflag='-G' ;;\n\t*Sun\\ F*)\t\t\t# Sun Fortran 8.3\n\t  tmp_sharedflag='-G' ;;\n\tesac\n\t_LT_TAGVAR(archive_cmds, $1)='$CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\n        if test \"x$supports_anon_versioning\" = xyes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t    cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t    echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t    $CC '\"$tmp_sharedflag\"\"$tmp_addflag\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n        fi\n\n\tcase $cc_basename in\n\txlf* | bgf* | bgxlf* | mpixlf*)\n\t  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'\n\t  if test \"x$supports_anon_versioning\" = xyes; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t      cat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t      echo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'\n\t  fi\n\t  ;;\n\tesac\n      else\n        _LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'\n\twlarc=\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      fi\n      ;;\n\n    solaris*)\n      if $LD -v 2>&1 | $GREP 'BFD 2\\.8' > /dev/null; then\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: The releases 2.8.* of the GNU linker cannot reliably\n*** create shared libraries on Solaris systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.9.1 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)\n      case `$LD -v 2>&1` in\n        *\\ [[01]].* | *\\ 2.[[0-9]].* | *\\ 2.1[[0-5]].*)\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\tcat <<_LT_EOF 1>&2\n\n*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not\n*** reliably create shared libraries on SCO systems.  Therefore, libtool\n*** is disabling shared libraries support.  We urge you to upgrade GNU\n*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify\n*** your PATH or compiler configuration so that the native linker is\n*** used, and then restart.\n\n_LT_EOF\n\t;;\n\t*)\n\t  # For security reasons, it is highly recommended that you always\n\t  # use absolute paths for naming shared libraries, and exclude the\n\t  # DT_RUNPATH tag from executables and libraries.  But doing so\n\t  # requires that you compile everything twice, which is a pain.\n\t  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t;;\n      esac\n      ;;\n\n    sunos4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      wlarc=\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n    esac\n\n    if test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no; then\n      runpath_var=\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=\n      _LT_TAGVAR(whole_archive_flag_spec, $1)=\n    fi\n  else\n    # PORTME fill in a description of your system's linker (not GNU ld)\n    case $host_os in\n    aix3*)\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'\n      # Note: this linker hardcodes the directories in LIBPATH if there\n      # are no directories specified by -L.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      if test \"$GCC\" = yes && test -z \"$lt_prog_compiler_static\"; then\n\t# Neither direct hardcoding nor static linking is supported with a\n\t# broken collect2.\n\t_LT_TAGVAR(hardcode_direct, $1)=unsupported\n      fi\n      ;;\n\n    aix[[4-9]]*)\n      if test \"$host_cpu\" = ia64; then\n\t# On IA64, the linker does run time linking by default, so we don't\n\t# have to do anything special.\n\taix_use_runtimelinking=no\n\texp_sym_flag='-Bexport'\n\tno_entry_flag=\"\"\n      else\n\t# If we're using GNU nm, then we don't want the \"-C\" option.\n\t# -C means demangle to AIX nm, but means don't demangle with GNU nm\n\t# Also, AIX nm treats weak defined symbols like other global\n\t# defined symbols, whereas GNU nm marks them as \"W\".\n\tif $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\") || (\\$ 2 == \"W\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\telse\n\t  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\\''{ if (((\\$ 2 == \"T\") || (\\$ 2 == \"D\") || (\\$ 2 == \"B\")) && ([substr](\\$ 3,1,1) != \".\")) { print \\$ 3 } }'\\'' | sort -u > $export_symbols'\n\tfi\n\taix_use_runtimelinking=no\n\n\t# Test if we are trying to use run time linking or normal\n\t# AIX style linking. If -brtl is somewhere in LDFLAGS, we\n\t# need to do runtime linking.\n\tcase $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t  for ld_flag in $LDFLAGS; do\n\t  if (test $ld_flag = \"-brtl\" || test $ld_flag = \"-Wl,-brtl\"); then\n\t    aix_use_runtimelinking=yes\n\t    break\n\t  fi\n\t  done\n\t  ;;\n\tesac\n\n\texp_sym_flag='-bexport'\n\tno_entry_flag='-bnoentry'\n      fi\n\n      # When large executables or shared objects are built, AIX ld can\n      # have problems creating the table of contents.  If linking a library\n      # or program results in \"error TOC overflow\" add -mminimal-toc to\n      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n      _LT_TAGVAR(archive_cmds, $1)=''\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n      if test \"$GCC\" = yes; then\n\tcase $host_os in aix4.[[012]]|aix4.[[012]].*)\n\t# We only want to do this on AIX 4.2 and lower, the check\n\t# below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t   strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t  # We have reworked collect2\n\t  :\n\t  else\n\t  # We have old collect2\n\t  _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t  # It fails to find uninstalled libraries when the uninstalled\n\t  # path is not listed in the libpath.  Setting hardcode_minus_L\n\t  # to unsupported forces relinking\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n\t  ;;\n\tesac\n\tshared_flag='-shared'\n\tif test \"$aix_use_runtimelinking\" = yes; then\n\t  shared_flag=\"$shared_flag \"'${wl}-G'\n\tfi\n\t_LT_TAGVAR(link_all_deplibs, $1)=no\n      else\n\t# not using gcc\n\tif test \"$host_cpu\" = ia64; then\n\t# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t# chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n\telse\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag='${wl}-G'\n\t  else\n\t    shared_flag='${wl}-bM:SRE'\n\t  fi\n\tfi\n      fi\n\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n      # It seems that -bexpall does not export symbols beginning with\n      # underscore (_), so it is better to generate a list of symbols to export.\n      _LT_TAGVAR(always_export_symbols, $1)=yes\n      if test \"$aix_use_runtimelinking\" = yes; then\n\t# Warning - without using the other runtime loading flags (-brtl),\n\t# -berok will link without error, but may produce a broken library.\n\t_LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n        # Determine the default libpath from the value encoded in an\n        # empty executable.\n        _LT_SYS_MODULE_PATH_AIX([$1])\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n      else\n\tif test \"$host_cpu\" = ia64; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n\telse\n\t # Determine the default libpath from the value encoded in an\n\t # empty executable.\n\t _LT_SYS_MODULE_PATH_AIX([$1])\n\t _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t  # Warning - without using the other run time loading flags,\n\t  # -berok will link without error, but may produce a broken library.\n\t  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t  if test \"$with_gnu_ld\" = yes; then\n\t    # We only use this code for GNU lds that support --whole-archive.\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t  else\n\t    # Exported symbols can be pulled into shared objects from archives\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t  fi\n\t  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  # This is similar to how AIX traditionally builds its shared libraries.\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n\tfi\n      fi\n      ;;\n\n    amigaos*)\n      case $host_cpu in\n      powerpc)\n            # see comment about AmigaOS4 .so support\n            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n            _LT_TAGVAR(archive_expsym_cmds, $1)=''\n        ;;\n      m68k)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO \"#define NAME $libname\" > $output_objdir/a2ixlibrary.data~$ECHO \"#define LIBRARY_ID 1\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define VERSION $major\" >> $output_objdir/a2ixlibrary.data~$ECHO \"#define REVISION $revision\" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'\n            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes\n        ;;\n      esac\n      ;;\n\n    bsdi[[45]]*)\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic\n      ;;\n\n    cygwin* | mingw* | pw32* | cegcc*)\n      # When not using gcc, we currently assume that we are using\n      # Microsoft Visual C++.\n      # hardcode_libdir_flag_spec is actually meaningless, as there is\n      # no search path for DLLs.\n      case $cc_basename in\n      cl*)\n\t# Native MSVC\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t_LT_TAGVAR(always_export_symbols, $1)=yes\n\t_LT_TAGVAR(file_list_spec, $1)='@'\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t    sed -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t  else\n\t    sed -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t  fi~\n\t  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t  linknames='\n\t# The linker will not automatically build a static lib if we build a DLL.\n\t# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\\([[^ ]]*\\)/\\1,DATA/'\\'' | $SED -e '\\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\\'' | sort | uniq > $export_symbols'\n\t# Don't use ranlib\n\t_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t  lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t  case $lt_outputfile in\n\t    *.exe|*.EXE) ;;\n\t    *)\n\t      lt_outputfile=\"$lt_outputfile.exe\"\n\t      lt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t      ;;\n\t  esac~\n\t  if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t    $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t    $RM \"$lt_outputfile.manifest\";\n\t  fi'\n\t;;\n      *)\n\t# Assume MSVC wrapper\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t_LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t# Tell ltmain to make .lib files, not .a files.\n\tlibext=lib\n\t# Tell ltmain to make .dll files, not .so files.\n\tshrext_cmds=\".dll\"\n\t# FIXME: Setting linknames here is a bad hack.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all \"$deplibs\" | $SED '\\''s/ -lc$//'\\''` -link -dll~linknames='\n\t# The linker will automatically build a .lib file if we build a DLL.\n\t_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t# FIXME: Should let the user specify the lib program.\n\t_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'\n\t_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t;;\n      esac\n      ;;\n\n    darwin* | rhapsody*)\n      _LT_DARWIN_LINKER_FEATURES($1)\n      ;;\n\n    dgux*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    freebsd1*)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n\n    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor\n    # support.  Future versions do this automatically, but an explicit c++rt0.o\n    # does not break anything, and helps significantly (at the cost of a little\n    # extra space).\n    freebsd2.2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # Unfortunately, older versions of FreeBSD 2 do not have this feature.\n    freebsd2*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.\n    freebsd* | dragonfly*)\n      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    hpux9*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n\n      # hardcode_minus_L: Not really in the search PATH,\n      # but as the default location of the library.\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n      ;;\n\n    hpux10*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# hardcode_minus_L: Not really in the search PATH,\n\t# but as the default location of the library.\n\t_LT_TAGVAR(hardcode_minus_L, $1)=yes\n      fi\n      ;;\n\n    hpux11*)\n      if test \"$GCC\" = yes && test \"$with_gnu_ld\" = no; then\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tesac\n      else\n\tcase $host_cpu in\n\thppa*64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\tia64*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\tm4_if($1, [], [\n\t  # Older versions of the 11.00 compiler do not understand -b yet\n\t  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)\n\t  _LT_LINKER_OPTION([if $CC understands -b],\n\t    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],\n\t    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],\n\t  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])\n\t  ;;\n\tesac\n      fi\n      if test \"$with_gnu_ld\" = no; then\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\tcase $host_cpu in\n\thppa*64*|ia64*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\n\t  # hardcode_minus_L: Not really in the search PATH,\n\t  # but as the default location of the library.\n\t  _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t  ;;\n\tesac\n      fi\n      ;;\n\n    irix5* | irix6* | nonstopux*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t# Try to use the -exported_symbol ld option, if it does not\n\t# work, assume that -exports_file does not work either and\n\t# implicitly export all symbols.\n\t# This should be the same for all languages, so no per-tag cache variable.\n\tAC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],\n\t  [lt_cv_irix_exported_symbol],\n\t  [save_LDFLAGS=\"$LDFLAGS\"\n\t   LDFLAGS=\"$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null\"\n\t   AC_LINK_IFELSE(\n\t     [AC_LANG_SOURCE(\n\t        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],\n\t\t\t      [C++], [[int foo (void) { return 0; }]],\n\t\t\t      [Fortran 77], [[\n      subroutine foo\n      end]],\n\t\t\t      [Fortran], [[\n      subroutine foo\n      end]])])],\n\t      [lt_cv_irix_exported_symbol=yes],\n\t      [lt_cv_irix_exported_symbol=no])\n           LDFLAGS=\"$save_LDFLAGS\"])\n\tif test \"$lt_cv_irix_exported_symbol\" = yes; then\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'\n\tfi\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(inherit_rpath, $1)=yes\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    netbsd* | netbsdelf*-gnu)\n      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    newsos6)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *nto* | *qnx*)\n      ;;\n\n    openbsd*)\n      if test -f /usr/libexec/ld.so; then\n\t_LT_TAGVAR(hardcode_direct, $1)=yes\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\tif test -z \"`echo __ELF__ | $CC -E - | $GREP __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\telse\n\t  case $host_os in\n\t   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)\n\t     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t     ;;\n\t   *)\n\t     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'\n\t     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t     ;;\n\t  esac\n\tfi\n      else\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n      fi\n      ;;\n\n    os2*)\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n      _LT_TAGVAR(archive_cmds, $1)='$ECHO \"LIBRARY $libname INITINSTANCE\" > $output_objdir/$libname.def~$ECHO \"DESCRIPTION \\\"$libname\\\"\" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo \" SINGLE NONSHARED\" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'\n      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'\n      ;;\n\n    osf3*)\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    osf4* | osf5*)\t# as osf3* with the addition of -msym flag\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n      else\n\t_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done; printf \"%s\\\\n\" \"-hidden\">> $lib.exp~\n\t$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'\n\n\t# Both c and cxx compiler support -rpath directly\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n      fi\n      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n      ;;\n\n    solaris*)\n      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'\n      if test \"$GCC\" = yes; then\n\twlarc='${wl}'\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n      else\n\tcase `$CC -V 2>&1` in\n\t*\"Compilers 5.0\"*)\n\t  wlarc=''\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'\n\t  ;;\n\t*)\n\t  wlarc='${wl}'\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'\n\t  ;;\n\tesac\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      case $host_os in\n      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n      *)\n\t# The compiler driver will combine and reorder linker options,\n\t# but understands `-z linker_flag'.  GCC discards it without `$wl',\n\t# but is careful enough not to reorder.\n\t# Supported since Solaris 2.6 (maybe 2.5.1?)\n\tif test \"$GCC\" = yes; then\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\telse\n\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\tfi\n\t;;\n      esac\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      ;;\n\n    sunos4*)\n      if test \"x$host_vendor\" = xsequent; then\n\t# Use $CC to link under sequent, because it throws in some extra .o\n\t# files that make .init and .fini sections work.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'\n      fi\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_direct, $1)=yes\n      _LT_TAGVAR(hardcode_minus_L, $1)=yes\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4)\n      case $host_vendor in\n\tsni)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???\n\t;;\n\tsiemens)\n\t  ## LD is ld it makes a PLAMLIB\n\t  ## CC just makes a GrossModule.\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no\n        ;;\n\tmotorola)\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie\n\t;;\n      esac\n      runpath_var='LD_RUN_PATH'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    sysv4.3*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'\n      ;;\n\n    sysv4*MP*)\n      if test -d /usr/nec; then\n\t_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\trunpath_var=LD_RUN_PATH\n\thardcode_runpath_var=yes\n\t_LT_TAGVAR(ld_shlibs, $1)=yes\n      fi\n      ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    sysv5* | sco3.2v5* | sco5v6*)\n      # Note: We can NOT use -z defs as we might desire, because we do not\n      # link with -lc, and that would cause any symbols used from libc to\n      # always be unresolved, which means just about no library would\n      # ever link correctly.  If we're not using GNU ld we use -z text\n      # though, which does catch some bad symbols but isn't as heavy-handed\n      # as -z defs.\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n      _LT_TAGVAR(link_all_deplibs, $1)=yes\n      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n      runpath_var='LD_RUN_PATH'\n\n      if test \"$GCC\" = yes; then\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      else\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n      fi\n      ;;\n\n    uts4*)\n      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'\n      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      ;;\n\n    *)\n      _LT_TAGVAR(ld_shlibs, $1)=no\n      ;;\n    esac\n\n    if test x$host_vendor = xsni; then\n      case $host in\n      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'\n\t;;\n      esac\n    fi\n  fi\n])\nAC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\ntest \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld\n\n_LT_DECL([], [libext], [0], [Old archive suffix (normally \"a\")])dnl\n_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally \".so\")])dnl\n_LT_DECL([], [extract_expsyms_cmds], [2],\n    [The commands to extract the exported symbol list from a shared archive])\n\n#\n# Do we need to explicitly link libc?\n#\ncase \"x$_LT_TAGVAR(archive_cmds_need_lc, $1)\" in\nx|xyes)\n  # Assume -lc should be added\n  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\n  if test \"$enable_shared\" = yes && test \"$GCC\" = yes; then\n    case $_LT_TAGVAR(archive_cmds, $1) in\n    *'~'*)\n      # FIXME: we may have to deal with multi-command sequences.\n      ;;\n    '$CC '*)\n      # Test whether the compiler implicitly links with -lc since on some\n      # systems, -lgcc has to come before -lc. If gcc already passes -lc\n      # to ld, don't add -lc before -lgcc.\n      AC_CACHE_CHECK([whether -lc should be explicitly linked in],\n\t[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),\n\t[$RM conftest*\n\techo \"$lt_simple_compile_test_code\" > conftest.$ac_ext\n\n\tif AC_TRY_EVAL(ac_compile) 2>conftest.err; then\n\t  soname=conftest\n\t  lib=conftest\n\t  libobjs=conftest.$ac_objext\n\t  deplibs=\n\t  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)\n\t  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)\n\t  compiler_flags=-v\n\t  linker_flags=-v\n\t  verstring=\n\t  output_objdir=.\n\t  libname=conftest\n\t  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=\n\t  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\\>\\&1 \\| $GREP \\\" -lc \\\" \\>/dev/null 2\\>\\&1)\n\t  then\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t  else\n\t    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t  fi\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag\n\telse\n\t  cat conftest.err 1>&5\n\tfi\n\t$RM conftest*\n\t])\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)\n      ;;\n    esac\n  fi\n  ;;\nesac\n\n_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],\n    [Whether or not to add -lc for building shared libraries])\n_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],\n    [enable_shared_with_static_runtimes], [0],\n    [Whether or not to disallow shared libs when runtime libs are static])\n_LT_TAGDECL([], [export_dynamic_flag_spec], [1],\n    [Compiler flag to allow reflexive dlopens])\n_LT_TAGDECL([], [whole_archive_flag_spec], [1],\n    [Compiler flag to generate shared objects directly from archives])\n_LT_TAGDECL([], [compiler_needs_object], [1],\n    [Whether the compiler copes with passing no objects directly])\n_LT_TAGDECL([], [old_archive_from_new_cmds], [2],\n    [Create an old-style archive from a shared archive])\n_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],\n    [Create a temporary old-style archive to link instead of a shared archive])\n_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])\n_LT_TAGDECL([], [archive_expsym_cmds], [2])\n_LT_TAGDECL([], [module_cmds], [2],\n    [Commands used to build a loadable module if different from building\n    a shared archive.])\n_LT_TAGDECL([], [module_expsym_cmds], [2])\n_LT_TAGDECL([], [with_gnu_ld], [1],\n    [Whether we are building with GNU ld or not])\n_LT_TAGDECL([], [allow_undefined_flag], [1],\n    [Flag that allows shared libraries with undefined symbols to be built])\n_LT_TAGDECL([], [no_undefined_flag], [1],\n    [Flag that enforces no undefined symbols])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],\n    [Flag to hardcode $libdir into a binary during linking.\n    This must work even if $libdir does not exist])\n_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],\n    [[If ld is used when linking, flag to hardcode $libdir into a binary\n    during linking.  This must work even if $libdir does not exist]])\n_LT_TAGDECL([], [hardcode_libdir_separator], [1],\n    [Whether we need a single \"-rpath\" flag with a separated argument])\n_LT_TAGDECL([], [hardcode_direct], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary])\n_LT_TAGDECL([], [hardcode_direct_absolute], [0],\n    [Set to \"yes\" if using DIR/libNAME${shared_ext} during linking hardcodes\n    DIR into the resulting binary and the resulting library dependency is\n    \"absolute\", i.e impossible to change by setting ${shlibpath_var} if the\n    library is relocated])\n_LT_TAGDECL([], [hardcode_minus_L], [0],\n    [Set to \"yes\" if using the -LDIR flag during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_shlibpath_var], [0],\n    [Set to \"yes\" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR\n    into the resulting binary])\n_LT_TAGDECL([], [hardcode_automatic], [0],\n    [Set to \"yes\" if building a shared library automatically hardcodes DIR\n    into the library and all subsequent libraries and executables linked\n    against it])\n_LT_TAGDECL([], [inherit_rpath], [0],\n    [Set to yes if linker adds runtime paths of dependent libraries\n    to runtime path list])\n_LT_TAGDECL([], [link_all_deplibs], [0],\n    [Whether libtool must link a program against all its dependency libraries])\n_LT_TAGDECL([], [always_export_symbols], [0],\n    [Set to \"yes\" if exported symbols are required])\n_LT_TAGDECL([], [export_symbols_cmds], [2],\n    [The commands to list exported symbols])\n_LT_TAGDECL([], [exclude_expsyms], [1],\n    [Symbols that should not be listed in the preloaded symbols])\n_LT_TAGDECL([], [include_expsyms], [1],\n    [Symbols that must always be exported])\n_LT_TAGDECL([], [prelink_cmds], [2],\n    [Commands necessary for linking programs (against libraries) with templates])\n_LT_TAGDECL([], [postlink_cmds], [2],\n    [Commands necessary for finishing linking programs])\n_LT_TAGDECL([], [file_list_spec], [1],\n    [Specify filename containing input files])\ndnl FIXME: Not yet implemented\ndnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],\ndnl    [Compiler flag to generate thread safe objects])\n])# _LT_LINKER_SHLIBS\n\n\n# _LT_LANG_C_CONFIG([TAG])\n# ------------------------\n# Ensure that the configuration variables for a C compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_C_CONFIG],\n[m4_require([_LT_DECL_EGREP])dnl\nlt_save_CC=\"$CC\"\nAC_LANG_PUSH(C)\n\n# Source file extension for C test sources.\nac_ext=c\n\n# Object file extension for compiled C test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"int some_variable = 0;\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='int main(){return(0);}'\n\n_LT_TAG_COMPILER\n# Save the default compiler, since it gets overwritten when the other\n# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.\ncompiler_DEFAULT=$CC\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_SYS_DYNAMIC_LINKER($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n  LT_SYS_DLOPEN_SELF\n  _LT_CMD_STRIPLIB\n\n  # Report which library types will actually be built\n  AC_MSG_CHECKING([if libtool supports shared libraries])\n  AC_MSG_RESULT([$can_build_shared])\n\n  AC_MSG_CHECKING([whether to build shared libraries])\n  test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n  # On AIX, shared libraries and static libraries use the same namespace, and\n  # are all built from PIC.\n  case $host_os in\n  aix3*)\n    test \"$enable_shared\" = yes && enable_static=no\n    if test -n \"$RANLIB\"; then\n      archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n      postinstall_cmds='$RANLIB $lib'\n    fi\n    ;;\n\n  aix[[4-9]]*)\n    if test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n      test \"$enable_shared\" = yes && enable_static=no\n    fi\n    ;;\n  esac\n  AC_MSG_RESULT([$enable_shared])\n\n  AC_MSG_CHECKING([whether to build static libraries])\n  # Make sure either enable_shared or enable_static is yes.\n  test \"$enable_shared\" = yes || enable_static=yes\n  AC_MSG_RESULT([$enable_static])\n\n  _LT_CONFIG($1)\nfi\nAC_LANG_POP\nCC=\"$lt_save_CC\"\n])# _LT_LANG_C_CONFIG\n\n\n# _LT_LANG_CXX_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a C++ compiler are suitably\n# defined.  These variables are subsequently used by _LT_CONFIG to write\n# the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_CXX_CONFIG],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nm4_require([_LT_DECL_EGREP])dnl\nm4_require([_LT_PATH_MANIFEST_TOOL])dnl\nif test -n \"$CXX\" && ( test \"X$CXX\" != \"Xno\" &&\n    ( (test \"X$CXX\" = \"Xg++\" && `g++ -v >/dev/null 2>&1` ) ||\n    (test \"X$CXX\" != \"Xg++\"))) ; then\n  AC_PROG_CXXCPP\nelse\n  _lt_caught_CXX_error=yes\nfi\n\nAC_LANG_PUSH(C++)\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(compiler_needs_object, $1)=no\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for C++ test sources.\nac_ext=cpp\n\n# Object file extension for compiled C++ test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the CXX compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_caught_CXX_error\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"int some_variable = 0;\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=$CC\n  lt_save_CFLAGS=$CFLAGS\n  lt_save_LD=$LD\n  lt_save_GCC=$GCC\n  GCC=$GXX\n  lt_save_with_gnu_ld=$with_gnu_ld\n  lt_save_path_LD=$lt_cv_path_LD\n  if test -n \"${lt_cv_prog_gnu_ldcxx+set}\"; then\n    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx\n  else\n    $as_unset lt_cv_prog_gnu_ld\n  fi\n  if test -n \"${lt_cv_path_LDCXX+set}\"; then\n    lt_cv_path_LD=$lt_cv_path_LDCXX\n  else\n    $as_unset lt_cv_path_LD\n  fi\n  test -z \"${LDCXX+set}\" || LD=$LDCXX\n  CC=${CXX-\"c++\"}\n  CFLAGS=$CXXFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    # We don't want -fno-exception when compiling C++ code, so set the\n    # no_builtin_flag separately\n    if test \"$GXX\" = yes; then\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'\n    else\n      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=\n    fi\n\n    if test \"$GXX\" = yes; then\n      # Set up default GNU C++ configuration\n\n      LT_PATH_LD\n\n      # Check if GNU C++ uses GNU ld as the underlying linker, since the\n      # archiving commands below assume that GNU ld is being used.\n      if test \"$with_gnu_ld\" = yes; then\n        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n        # If archive_cmds runs LD, not CC, wlarc should be empty\n        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to\n        #     investigate it a little bit more. (MM)\n        wlarc='${wl}'\n\n        # ancient GNU ld didn't support --whole-archive et. al.\n        if eval \"`$CC -print-prog-name=ld` --help 2>&1\" |\n\t  $GREP 'no-whole-archive' > /dev/null; then\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n        else\n          _LT_TAGVAR(whole_archive_flag_spec, $1)=\n        fi\n      else\n        with_gnu_ld=no\n        wlarc=\n\n        # A generic and very simple default shared library creation\n        # command for GNU C++ for the case where it uses the native\n        # linker, instead of GNU ld.  If possible, this setting should\n        # overridden to take advantage of the native linker features on\n        # the platform it is being used on.\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n      fi\n\n      # Commands to make compiler produce verbose output that lists\n      # what \"hidden\" libraries, object files and flags are used when\n      # linking a shared library.\n      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n    else\n      GXX=no\n      with_gnu_ld=no\n      wlarc=\n    fi\n\n    # PORTME: fill in a description of your system's C++ link characteristics\n    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])\n    _LT_TAGVAR(ld_shlibs, $1)=yes\n    case $host_os in\n      aix3*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n      aix[[4-9]]*)\n        if test \"$host_cpu\" = ia64; then\n          # On IA64, the linker does run time linking by default, so we don't\n          # have to do anything special.\n          aix_use_runtimelinking=no\n          exp_sym_flag='-Bexport'\n          no_entry_flag=\"\"\n        else\n          aix_use_runtimelinking=no\n\n          # Test if we are trying to use run time linking or normal\n          # AIX style linking. If -brtl is somewhere in LDFLAGS, we\n          # need to do runtime linking.\n          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)\n\t    for ld_flag in $LDFLAGS; do\n\t      case $ld_flag in\n\t      *-brtl*)\n\t        aix_use_runtimelinking=yes\n\t        break\n\t        ;;\n\t      esac\n\t    done\n\t    ;;\n          esac\n\n          exp_sym_flag='-bexport'\n          no_entry_flag='-bnoentry'\n        fi\n\n        # When large executables or shared objects are built, AIX ld can\n        # have problems creating the table of contents.  If linking a library\n        # or program results in \"error TOC overflow\" add -mminimal-toc to\n        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not\n        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.\n\n        _LT_TAGVAR(archive_cmds, $1)=''\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'\n\n        if test \"$GXX\" = yes; then\n          case $host_os in aix4.[[012]]|aix4.[[012]].*)\n          # We only want to do this on AIX 4.2 and lower, the check\n          # below for broken collect2 doesn't work under 4.3+\n\t  collect2name=`${CC} -print-prog-name=collect2`\n\t  if test -f \"$collect2name\" &&\n\t     strings \"$collect2name\" | $GREP resolve_lib_name >/dev/null\n\t  then\n\t    # We have reworked collect2\n\t    :\n\t  else\n\t    # We have old collect2\n\t    _LT_TAGVAR(hardcode_direct, $1)=unsupported\n\t    # It fails to find uninstalled libraries when the uninstalled\n\t    # path is not listed in the libpath.  Setting hardcode_minus_L\n\t    # to unsupported forces relinking\n\t    _LT_TAGVAR(hardcode_minus_L, $1)=yes\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=\n\t  fi\n          esac\n          shared_flag='-shared'\n\t  if test \"$aix_use_runtimelinking\" = yes; then\n\t    shared_flag=\"$shared_flag \"'${wl}-G'\n\t  fi\n        else\n          # not using gcc\n          if test \"$host_cpu\" = ia64; then\n\t  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release\n\t  # chokes on -Wl,-G. The following line is correct:\n\t  shared_flag='-G'\n          else\n\t    if test \"$aix_use_runtimelinking\" = yes; then\n\t      shared_flag='${wl}-G'\n\t    else\n\t      shared_flag='${wl}-bM:SRE'\n\t    fi\n          fi\n        fi\n\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'\n        # It seems that -bexpall does not export symbols beginning with\n        # underscore (_), so it is better to generate a list of symbols to\n\t# export.\n        _LT_TAGVAR(always_export_symbols, $1)=yes\n        if test \"$aix_use_runtimelinking\" = yes; then\n          # Warning - without using the other runtime loading flags (-brtl),\n          # -berok will link without error, but may produce a broken library.\n          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'\n          # Determine the default libpath from the value encoded in an empty\n          # executable.\n          _LT_SYS_MODULE_PATH_AIX([$1])\n          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\n          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags `if test \"x${allow_undefined_flag}\" != \"x\"; then func_echo_all \"${wl}${allow_undefined_flag}\"; else :; fi` '\"\\${wl}$exp_sym_flag:\\$export_symbols $shared_flag\"\n        else\n          if test \"$host_cpu\" = ia64; then\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=\"-z nodefs\"\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs '\"\\${wl}$no_entry_flag\"' $compiler_flags ${wl}${allow_undefined_flag} '\"\\${wl}$exp_sym_flag:\\$export_symbols\"\n          else\n\t    # Determine the default libpath from the value encoded in an\n\t    # empty executable.\n\t    _LT_SYS_MODULE_PATH_AIX([$1])\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'\"$aix_libpath\"\n\t    # Warning - without using the other run time loading flags,\n\t    # -berok will link without error, but may produce a broken library.\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'\n\t    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'\n\t    if test \"$with_gnu_ld\" = yes; then\n\t      # We only use this code for GNU lds that support --whole-archive.\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    else\n\t      # Exported symbols can be pulled into shared objects from archives\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'\n\t    fi\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes\n\t    # This is similar to how AIX traditionally builds its shared\n\t    # libraries.\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)=\"\\$CC $shared_flag\"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'\n          fi\n        fi\n        ;;\n\n      beos*)\n\tif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc\n\t  # support --undefined.  This deserves some investigation.  FIXME\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      chorus*)\n        case $cc_basename in\n          *)\n\t  # FIXME: insert proper C++ library support\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\t  ;;\n        esac\n        ;;\n\n      cygwin* | mingw* | pw32* | cegcc*)\n\tcase $GXX,$cc_basename in\n\t,cl* | no,cl*)\n\t  # Native MSVC\n\t  # hardcode_libdir_flag_spec is actually meaningless, as there is\n\t  # no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=yes\n\t  _LT_TAGVAR(file_list_spec, $1)='@'\n\t  # Tell ltmain to make .lib files, not .a files.\n\t  libext=lib\n\t  # Tell ltmain to make .dll files, not .so files.\n\t  shrext_cmds=\".dll\"\n\t  # FIXME: Setting linknames here is a bad hack.\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      $SED -n -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' -e '1\\\\\\!p' < $export_symbols > $output_objdir/$soname.exp;\n\t    else\n\t      $SED -e 's/\\\\\\\\\\\\\\(.*\\\\\\\\\\\\\\)/-link\\\\\\ -EXPORT:\\\\\\\\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;\n\t    fi~\n\t    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs \"@$tool_output_objdir$soname.exp\" -Wl,-DLL,-IMPLIB:\"$tool_output_objdir$libname.dll.lib\"~\n\t    linknames='\n\t  # The linker will not automatically build a static lib if we build a DLL.\n\t  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\t  # Don't use ranlib\n\t  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'\n\t  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile=\"@OUTPUT@\"~\n\t    lt_tool_outputfile=\"@TOOL_OUTPUT@\"~\n\t    case $lt_outputfile in\n\t      *.exe|*.EXE) ;;\n\t      *)\n\t\tlt_outputfile=\"$lt_outputfile.exe\"\n\t\tlt_tool_outputfile=\"$lt_tool_outputfile.exe\"\n\t\t;;\n\t    esac~\n\t    func_to_tool_file \"$lt_outputfile\"~\n\t    if test \"$MANIFEST_TOOL\" != \":\" && test -f \"$lt_outputfile.manifest\"; then\n\t      $MANIFEST_TOOL -manifest \"$lt_tool_outputfile.manifest\" -outputresource:\"$lt_tool_outputfile\" || exit 1;\n\t      $RM \"$lt_outputfile.manifest\";\n\t    fi'\n\t  ;;\n\t*)\n\t  # g++\n\t  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,\n\t  # as there is no search path for DLLs.\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'\n\t  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'\n\t  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported\n\t  _LT_TAGVAR(always_export_symbols, $1)=no\n\t  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes\n\n\t  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t    # If the export-symbols file already is a .def file (1st line\n\t    # is EXPORTS), use it as is; otherwise, prepend...\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='if test \"x`$SED 1q $export_symbols`\" = xEXPORTS; then\n\t      cp $export_symbols $output_objdir/$soname.def;\n\t    else\n\t      echo EXPORTS > $output_objdir/$soname.def;\n\t      cat $export_symbols >> $output_objdir/$soname.def;\n\t    fi~\n\t    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'\n\t  else\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t  fi\n\t  ;;\n\tesac\n\t;;\n      darwin* | rhapsody*)\n        _LT_DARWIN_LINKER_FEATURES($1)\n\t;;\n\n      dgux*)\n        case $cc_basename in\n          ec++*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          ghcx*)\n\t    # Green Hills C++ Compiler\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      freebsd[[12]]*)\n        # C++ shared libraries reported to be fairly broken before\n\t# switch to ELF\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      freebsd-elf*)\n        _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n        ;;\n\n      freebsd* | dragonfly*)\n        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF\n        # conventions\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n        ;;\n\n      gnu*)\n        ;;\n\n      haiku*)\n        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n        _LT_TAGVAR(link_all_deplibs, $1)=yes\n        ;;\n\n      hpux9*)\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n        _LT_TAGVAR(hardcode_direct, $1)=yes\n        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t             # but as the default\n\t\t\t\t             # location of the library.\n\n        case $cc_basename in\n          CC*)\n            # FIXME: insert proper C++ library support\n            _LT_TAGVAR(ld_shlibs, $1)=no\n            ;;\n          aCC*)\n            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            # Commands to make compiler produce verbose output that lists\n            # what \"hidden\" libraries, object files and flags are used when\n            # linking a shared library.\n            #\n            # There doesn't appear to be a way to prevent this compiler from\n            # explicitly linking system object files so we need to strip them\n            # from the output so that they don't get included in the library\n            # dependencies.\n            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n            ;;\n          *)\n            if test \"$GXX\" = yes; then\n              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'\n            else\n              # FIXME: insert proper C++ library support\n              _LT_TAGVAR(ld_shlibs, $1)=no\n            fi\n            ;;\n        esac\n        ;;\n\n      hpux10*|hpux11*)\n        if test $with_gnu_ld = no; then\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'\n\t  _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n          case $host_cpu in\n            hppa*64*|ia64*)\n              ;;\n            *)\n\t      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n              ;;\n          esac\n        fi\n        case $host_cpu in\n          hppa*64*|ia64*)\n            _LT_TAGVAR(hardcode_direct, $1)=no\n            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n            ;;\n          *)\n            _LT_TAGVAR(hardcode_direct, $1)=yes\n            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,\n\t\t\t\t\t         # but as the default\n\t\t\t\t\t         # location of the library.\n            ;;\n        esac\n\n        case $cc_basename in\n          CC*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          aCC*)\n\t    case $host_cpu in\n\t      hppa*64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      ia64*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t      *)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t        ;;\n\t    esac\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP \"\\-L\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test $with_gnu_ld = no; then\n\t        case $host_cpu in\n\t          hppa*64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          ia64*)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t          *)\n\t            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t            ;;\n\t        esac\n\t      fi\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      interix[[3-9]]*)\n\t_LT_TAGVAR(hardcode_direct, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.\n\t# Instead, shared libraries are loaded at an image base (0x10000000 by\n\t# default) and relocated if they conflict, which is a slow very memory\n\t# consuming and fragmenting process.  To avoid this, we pick a random,\n\t# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link\n\t# time.  Moving up from 0x10000000 also allows more sbrk(2) space.\n\t_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t_LT_TAGVAR(archive_expsym_cmds, $1)='sed \"s,^,_,\" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \\* 262144 + 1342177280` -o $lib'\n\t;;\n      irix5* | irix6*)\n        case $cc_basename in\n          CC*)\n\t    # SGI C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -ar\", where \"CC\" is the IRIX C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    if test \"$GXX\" = yes; then\n\t      if test \"$with_gnu_ld\" = no; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t      else\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` -o $lib'\n\t      fi\n\t    fi\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\t    ;;\n        esac\n        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n        _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n        _LT_TAGVAR(inherit_rpath, $1)=yes\n        ;;\n\n      linux* | k*bsd*-gnu | kopensolaris*-gnu)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo $lib | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib ${wl}-retain-symbols-file,$export_symbols; mv \\$templib $lib'\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP \"ld\"`; rm -f libconftest$shared_ext; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -Bstatic\", where \"CC\" is the KAI C++ compiler.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'\n\t    ;;\n\t  icpc* | ecpc* )\n\t    # Intel C++\n\t    with_gnu_ld=yes\n\t    # version 8.0 and above of icpc choke on multiply defined symbols\n\t    # if we add $predep_objects and $postdep_objects, however 7.1 and\n\t    # earlier do not add the objects themselves.\n\t    case `$CC -V 2>&1` in\n\t      *\"Version 7.\"*)\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t      *)  # Version 8.0 or newer\n\t        tmp_idyn=\n\t        case $host_cpu in\n\t\t  ia64*) tmp_idyn=' -i_dynamic';;\n\t\tesac\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t\t_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'\"$tmp_idyn\"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'\n\t\t;;\n\t    esac\n\t    _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'\n\t    ;;\n          pgCC* | pgcpp*)\n            # Portland Group C++ compiler\n\t    case `$CC -V` in\n\t    *pgCC\\ [[1-5]].* | *pgcpp\\ [[1-5]].*)\n\t      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~\n\t\tcompile_command=\"$compile_command `find $tpldir -name \\*.o | sort | $NL2SP`\"'\n\t      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~\n\t\t$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \\*.o | sort | $NL2SP`~\n\t\t$RANLIB $oldlib'\n\t      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~\n\t\trm -rf $tpldir~\n\t\t$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~\n\t\t$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \\*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    *) # Version 6 and above use weak symbols\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'\n\t      ;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\\\"\\\"; do test  -n \\\"$conv\\\" && new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n            ;;\n\t  cxx*)\n\t    # Compaq C++\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'\n\n\t    runpath_var=LD_RUN_PATH\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld .*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"X$list\" | $Xsed'\n\t    ;;\n\t  xl* | mpixl* | bgxl*)\n\t    # IBM XL 8.0 on PPC, with GNU ld\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'\n\t    if test \"x$supports_anon_versioning\" = xyes; then\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $output_objdir/$libname.ver~\n\t\tcat $export_symbols | sed -e \"s/\\(.*\\)/\\1;/\" >> $output_objdir/$libname.ver~\n\t\techo \"local: *; };\" >> $output_objdir/$libname.ver~\n\t\t$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'\n\t    fi\n\t    ;;\n\t  *)\n\t    case `$CC -V 2>&1 | sed 5q` in\n\t    *Sun\\ C*)\n\t      # Sun C++ 5.9\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\\\"\\\"; do test -z \\\"$conv\\\" || new_convenience=\\\"$new_convenience,$conv\\\"; done; func_echo_all \\\"$new_convenience\\\"` ${wl}--no-whole-archive'\n\t      _LT_TAGVAR(compiler_needs_object, $1)=yes\n\n\t      # Not sure whether something based on\n\t      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1\n\t      # would be better.\n\t      output_verbose_link_cmd='func_echo_all'\n\n\t      # Archives containing C++ object files must be created using\n\t      # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t      # necessary to make sure instantiated templates are included\n\t      # in the archive.\n\t      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t      ;;\n\t    esac\n\t    ;;\n\tesac\n\t;;\n\n      lynxos*)\n        # FIXME: insert proper C++ library support\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      m88k*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      mvs*)\n        case $cc_basename in\n          cxx*)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\t  *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n\tesac\n\t;;\n\n      netbsd*)\n        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then\n\t  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'\n\t  wlarc=\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\tfi\n\t# Workaround some broken pre-1.5 toolchains\n\toutput_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e \"s:-lgcc -lc -lgcc::\"'\n\t;;\n\n      *nto* | *qnx*)\n        _LT_TAGVAR(ld_shlibs, $1)=yes\n\t;;\n\n      openbsd2*)\n        # C++ shared libraries are fairly broken\n\t_LT_TAGVAR(ld_shlibs, $1)=no\n\t;;\n\n      openbsd*)\n\tif test -f /usr/libexec/ld.so; then\n\t  _LT_TAGVAR(hardcode_direct, $1)=yes\n\t  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'\n\t  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t  if test -z \"`echo __ELF__ | $CC -E - | grep __ELF__`\" || test \"$host_os-$host_cpu\" = \"openbsd2.8-powerpc\"; then\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'\n\t    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'\n\t    _LT_TAGVAR(whole_archive_flag_spec, $1)=\"$wlarc\"'--whole-archive$convenience '\"$wlarc\"'--no-whole-archive'\n\t  fi\n\t  output_verbose_link_cmd=func_echo_all\n\telse\n\t  _LT_TAGVAR(ld_shlibs, $1)=no\n\tfi\n\t;;\n\n      osf3* | osf4* | osf5*)\n        case $cc_basename in\n          KCC*)\n\t    # Kuck and Associates, Inc. (KAI) C++ Compiler\n\n\t    # KCC will only create a shared library if the output file\n\t    # ends with \".so\" (or \".sl\" for HP-UX), so rename the library\n\t    # to its proper name (with version) after linking.\n\t    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\\''s/\\([[^()0-9A-Za-z{}]]\\)/\\\\\\\\\\1/g'\\''`; templib=`echo \"$lib\" | $SED -e \"s/\\${tempext}\\..*/.so/\"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \\$templib; mv \\$templib $lib'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Archives containing C++ object files must be created using\n\t    # the KAI C++ compiler.\n\t    case $host in\n\t      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;\n\t      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;\n\t    esac\n\t    ;;\n          RCC*)\n\t    # Rational C++ 2.4.1\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          cxx*)\n\t    case $host in\n\t      osf3*)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t\t;;\n\t      *)\n\t        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \\*'\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n \"$verstring\" && func_echo_all \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf \"%s %s\\\\n\" -exported_symbol \"\\$i\" >> $lib.exp; done~\n\t          echo \"-hidden\">> $lib.exp~\n\t          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n \"$verstring\" && $ECHO \"-set_version $verstring\"` -update_registry ${output_objdir}/so_locations -o $lib~\n\t          $RM $lib.exp'\n\t        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'\n\t\t;;\n\t    esac\n\n\t    _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t    # Commands to make compiler produce verbose output that lists\n\t    # what \"hidden\" libraries, object files and flags are used when\n\t    # linking a shared library.\n\t    #\n\t    # There doesn't appear to be a way to prevent this compiler from\n\t    # explicitly linking system object files so we need to strip them\n\t    # from the output so that they don't get included in the library\n\t    # dependencies.\n\t    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP \"ld\" | $GREP -v \"ld:\"`; templist=`func_echo_all \"$templist\" | $SED \"s/\\(^.*ld.*\\)\\( .*ld.*$\\)/\\1/\"`; list=\"\"; for z in $templist; do case $z in conftest.$objext) list=\"$list $z\";; *.$objext);; *) list=\"$list $z\";;esac; done; func_echo_all \"$list\"'\n\t    ;;\n\t  *)\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\\*'\n\t      case $host in\n\t        osf3*)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t        *)\n\t          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n \"$verstring\" && func_echo_all \"${wl}-set_version ${wl}$verstring\"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'\n\t\t  ;;\n\t      esac\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'\n\t      _LT_TAGVAR(hardcode_libdir_separator, $1)=:\n\n\t      # Commands to make compiler produce verbose output that lists\n\t      # what \"hidden\" libraries, object files and flags are used when\n\t      # linking a shared library.\n\t      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\n\t    else\n\t      # FIXME: insert proper C++ library support\n\t      _LT_TAGVAR(ld_shlibs, $1)=no\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n      psos*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      sunos4*)\n        case $cc_basename in\n          CC*)\n\t    # Sun C++ 4.x\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          lcc*)\n\t    # Lucid\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      solaris*)\n        case $cc_basename in\n          CC* | sunCC*)\n\t    # Sun C++ 4.2, 5.x and Centerline C++\n            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes\n\t    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'\n\t    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t    case $host_os in\n\t      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t      *)\n\t\t# The compiler driver will combine and reorder linker options,\n\t\t# but understands `-z linker_flag'.\n\t        # Supported since Solaris 2.6 (maybe 2.5.1?)\n\t\t_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'\n\t        ;;\n\t    esac\n\t    _LT_TAGVAR(link_all_deplibs, $1)=yes\n\n\t    output_verbose_link_cmd='func_echo_all'\n\n\t    # Archives containing C++ object files must be created using\n\t    # \"CC -xar\", where \"CC\" is the Sun C++ compiler.  This is\n\t    # necessary to make sure instantiated templates are included\n\t    # in the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'\n\t    ;;\n          gcx*)\n\t    # Green Hills C++ Compiler\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\n\t    # The C++ compiler must be used to create the archive.\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'\n\t    ;;\n          *)\n\t    # GNU C++ compiler with Solaris linker\n\t    if test \"$GXX\" = yes && test \"$with_gnu_ld\" = no; then\n\t      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'\n\t      if $CC --version | $GREP -v '^2\\.7' > /dev/null; then\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      else\n\t        # g++ 2.7 appears to require `-G' NOT `-shared' on this\n\t        # platform.\n\t        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'\n\t        _LT_TAGVAR(archive_expsym_cmds, $1)='echo \"{ global:\" > $lib.exp~cat $export_symbols | $SED -e \"s/\\(.*\\)/\\1;/\" >> $lib.exp~echo \"local: *; };\" >> $lib.exp~\n\t\t  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'\n\n\t        # Commands to make compiler produce verbose output that lists\n\t        # what \"hidden\" libraries, object files and flags are used when\n\t        # linking a shared library.\n\t        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v \"^Configured with:\" | $GREP \"\\-L\"'\n\t      fi\n\n\t      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'\n\t      case $host_os in\n\t\tsolaris2.[[0-5]] | solaris2.[[0-5]].*) ;;\n\t\t*)\n\t\t  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'\n\t\t  ;;\n\t      esac\n\t    fi\n\t    ;;\n        esac\n        ;;\n\n    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)\n      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n      _LT_TAGVAR(archive_cmds_need_lc, $1)=no\n      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n      runpath_var='LD_RUN_PATH'\n\n      case $cc_basename in\n        CC*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n\t*)\n\t  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t  ;;\n      esac\n      ;;\n\n      sysv5* | sco3.2v5* | sco5v6*)\n\t# Note: We can NOT use -z defs as we might desire, because we do not\n\t# link with -lc, and that would cause any symbols used from libc to\n\t# always be unresolved, which means just about no library would\n\t# ever link correctly.  If we're not using GNU ld we use -z text\n\t# though, which does catch some bad symbols but isn't as heavy-handed\n\t# as -z defs.\n\t_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'\n\t_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'\n\t_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\t_LT_TAGVAR(hardcode_shlibpath_var, $1)=no\n\t_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'\n\t_LT_TAGVAR(hardcode_libdir_separator, $1)=':'\n\t_LT_TAGVAR(link_all_deplibs, $1)=yes\n\t_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'\n\trunpath_var='LD_RUN_PATH'\n\n\tcase $cc_basename in\n          CC*)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~\n\t      '\"$_LT_TAGVAR(old_archive_cmds, $1)\"\n\t    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~\n\t      '\"$_LT_TAGVAR(reload_cmds, $1)\"\n\t    ;;\n\t  *)\n\t    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'\n\t    ;;\n\tesac\n      ;;\n\n      tandem*)\n        case $cc_basename in\n          NCC*)\n\t    # NonStop-UX NCC 3.20\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n          *)\n\t    # FIXME: insert proper C++ library support\n\t    _LT_TAGVAR(ld_shlibs, $1)=no\n\t    ;;\n        esac\n        ;;\n\n      vxworks*)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n\n      *)\n        # FIXME: insert proper C++ library support\n        _LT_TAGVAR(ld_shlibs, $1)=no\n        ;;\n    esac\n\n    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])\n    test \"$_LT_TAGVAR(ld_shlibs, $1)\" = no && can_build_shared=no\n\n    _LT_TAGVAR(GCC, $1)=\"$GXX\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\n  LDCXX=$LD\n  LD=$lt_save_LD\n  GCC=$lt_save_GCC\n  with_gnu_ld=$lt_save_with_gnu_ld\n  lt_cv_path_LDCXX=$lt_cv_path_LD\n  lt_cv_path_LD=$lt_save_path_LD\n  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld\n  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld\nfi # test \"$_lt_caught_CXX_error\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_CXX_CONFIG\n\n\n# _LT_FUNC_STRIPNAME_CNF\n# ----------------------\n# func_stripname_cnf prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n#\n# This function is identical to the (non-XSI) version of func_stripname,\n# except this one can be used by m4 code that may be executed by configure,\n# rather than the libtool script.\nm4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl\nAC_REQUIRE([_LT_DECL_SED])\nAC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])\nfunc_stripname_cnf ()\n{\n  case ${2} in\n  .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n  *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n  esac\n} # func_stripname_cnf\n])# _LT_FUNC_STRIPNAME_CNF\n\n# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])\n# ---------------------------------\n# Figure out \"hidden\" library dependencies from verbose\n# compiler output when linking a shared library.\n# Parse the compiler output and extract the necessary\n# objects, libraries and library flags.\nm4_defun([_LT_SYS_HIDDEN_LIBDEPS],\n[m4_require([_LT_FILEUTILS_DEFAULTS])dnl\nAC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl\n# Dependencies to place before and after the object being linked:\n_LT_TAGVAR(predep_objects, $1)=\n_LT_TAGVAR(postdep_objects, $1)=\n_LT_TAGVAR(predeps, $1)=\n_LT_TAGVAR(postdeps, $1)=\n_LT_TAGVAR(compiler_lib_search_path, $1)=\n\ndnl we can't use the lt_simple_compile_test_code here,\ndnl because it contains code intended for an executable,\ndnl not a library.  It's possible we should let each\ndnl tag define a new lt_????_link_test_code variable,\ndnl but it's only used here...\nm4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF\nint a;\nvoid foo (void) { a = 0; }\n_LT_EOF\n], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF\nclass Foo\n{\npublic:\n  Foo (void) { a = 0; }\nprivate:\n  int a;\n};\n_LT_EOF\n], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer*4 a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF\n      subroutine foo\n      implicit none\n      integer a\n      a=0\n      return\n      end\n_LT_EOF\n], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF\npublic class foo {\n  private int a;\n  public void bar (void) {\n    a = 0;\n  }\n};\n_LT_EOF\n])\n\n_lt_libdeps_save_CFLAGS=$CFLAGS\ncase \"$CC $CFLAGS \" in #(\n*\\ -flto*\\ *) CFLAGS=\"$CFLAGS -fno-lto\" ;;\n*\\ -fwhopr*\\ *) CFLAGS=\"$CFLAGS -fno-whopr\" ;;\nesac\n\ndnl Parse the compiler output and extract the necessary\ndnl objects, libraries and library flags.\nif AC_TRY_EVAL(ac_compile); then\n  # Parse the compiler output and extract the necessary\n  # objects, libraries and library flags.\n\n  # Sentinel used to keep track of whether or not we are before\n  # the conftest object file.\n  pre_test_object_deps_done=no\n\n  for p in `eval \"$output_verbose_link_cmd\"`; do\n    case ${prev}${p} in\n\n    -L* | -R* | -l*)\n       # Some compilers place space between \"-{L,R}\" and the path.\n       # Remove the space.\n       if test $p = \"-L\" ||\n          test $p = \"-R\"; then\n\t prev=$p\n\t continue\n       fi\n\n       # Expand the sysroot to ease extracting the directories later.\n       if test -z \"$prev\"; then\n         case $p in\n         -L*) func_stripname_cnf '-L' '' \"$p\"; prev=-L; p=$func_stripname_result ;;\n         -R*) func_stripname_cnf '-R' '' \"$p\"; prev=-R; p=$func_stripname_result ;;\n         -l*) func_stripname_cnf '-l' '' \"$p\"; prev=-l; p=$func_stripname_result ;;\n         esac\n       fi\n       case $p in\n       =*) func_stripname_cnf '=' '' \"$p\"; p=$lt_sysroot$func_stripname_result ;;\n       esac\n       if test \"$pre_test_object_deps_done\" = no; then\n\t case ${prev} in\n\t -L | -R)\n\t   # Internal compiler library paths should come after those\n\t   # provided the user.  The postdeps already come after the\n\t   # user supplied libs so there is no need to process them.\n\t   if test -z \"$_LT_TAGVAR(compiler_lib_search_path, $1)\"; then\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${prev}${p}\"\n\t   else\n\t     _LT_TAGVAR(compiler_lib_search_path, $1)=\"${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}\"\n\t   fi\n\t   ;;\n\t # The \"-l\" case would never come before the object being\n\t # linked, so don't bother handling this case.\n\t esac\n       else\n\t if test -z \"$_LT_TAGVAR(postdeps, $1)\"; then\n\t   _LT_TAGVAR(postdeps, $1)=\"${prev}${p}\"\n\t else\n\t   _LT_TAGVAR(postdeps, $1)=\"${_LT_TAGVAR(postdeps, $1)} ${prev}${p}\"\n\t fi\n       fi\n       prev=\n       ;;\n\n    *.lto.$objext) ;; # Ignore GCC LTO objects\n    *.$objext)\n       # This assumes that the test object file only shows up\n       # once in the compiler output.\n       if test \"$p\" = \"conftest.$objext\"; then\n\t pre_test_object_deps_done=yes\n\t continue\n       fi\n\n       if test \"$pre_test_object_deps_done\" = no; then\n\t if test -z \"$_LT_TAGVAR(predep_objects, $1)\"; then\n\t   _LT_TAGVAR(predep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(predep_objects, $1)=\"$_LT_TAGVAR(predep_objects, $1) $p\"\n\t fi\n       else\n\t if test -z \"$_LT_TAGVAR(postdep_objects, $1)\"; then\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$p\"\n\t else\n\t   _LT_TAGVAR(postdep_objects, $1)=\"$_LT_TAGVAR(postdep_objects, $1) $p\"\n\t fi\n       fi\n       ;;\n\n    *) ;; # Ignore the rest.\n\n    esac\n  done\n\n  # Clean up.\n  rm -f a.out a.exe\nelse\n  echo \"libtool.m4: error: problem compiling $1 test program\"\nfi\n\n$RM -f confest.$objext\nCFLAGS=$_lt_libdeps_save_CFLAGS\n\n# PORTME: override above test on systems where it is broken\nm4_if([$1], [CXX],\n[case $host_os in\ninterix[[3-9]]*)\n  # Interix 3.5 installs completely hosed .la files for C++, so rather than\n  # hack all around it, let's just trust \"g++\" to DTRT.\n  _LT_TAGVAR(predep_objects,$1)=\n  _LT_TAGVAR(postdep_objects,$1)=\n  _LT_TAGVAR(postdeps,$1)=\n  ;;\n\nlinux*)\n  case `$CC -V 2>&1 | sed 5q` in\n  *Sun\\ C*)\n    # Sun C++ 5.9\n\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\n\nsolaris*)\n  case $cc_basename in\n  CC* | sunCC*)\n    # The more standards-conforming stlport4 library is\n    # incompatible with the Cstd library. Avoid specifying\n    # it if it's in CXXFLAGS. Ignore libCrun as\n    # -library=stlport4 depends on it.\n    case \" $CXX $CXXFLAGS \" in\n    *\" -library=stlport4 \"*)\n      solaris_use_stlport4=yes\n      ;;\n    esac\n\n    # Adding this requires a known-good setup of shared libraries for\n    # Sun compiler versions before 5.6, else PIC objects from an old\n    # archive will be linked into the output, leading to subtle bugs.\n    if test \"$solaris_use_stlport4\" != yes; then\n      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'\n    fi\n    ;;\n  esac\n  ;;\nesac\n])\n\ncase \" $_LT_TAGVAR(postdeps, $1) \" in\n*\" -lc \"*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;\nesac\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=\nif test -n \"${_LT_TAGVAR(compiler_lib_search_path, $1)}\"; then\n _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo \" ${_LT_TAGVAR(compiler_lib_search_path, $1)}\" | ${SED} -e 's! -L! !g' -e 's!^ !!'`\nfi\n_LT_TAGDECL([], [compiler_lib_search_dirs], [1],\n    [The directories searched by this compiler when creating a shared library])\n_LT_TAGDECL([], [predep_objects], [1],\n    [Dependencies to place before and after the objects being linked to\n    create a shared library])\n_LT_TAGDECL([], [postdep_objects], [1])\n_LT_TAGDECL([], [predeps], [1])\n_LT_TAGDECL([], [postdeps], [1])\n_LT_TAGDECL([], [compiler_lib_search_path], [1],\n    [The library search path used internally by the compiler when linking\n    a shared library])\n])# _LT_SYS_HIDDEN_LIBDEPS\n\n\n# _LT_LANG_F77_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for a Fortran 77 compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_F77_CONFIG],\n[AC_LANG_PUSH(Fortran 77)\nif test -z \"$F77\" || test \"X$F77\" = \"Xno\"; then\n  _lt_disable_F77=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for f77 test sources.\nac_ext=f\n\n# Object file extension for compiled f77 test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the F77 compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_F77\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${F77-\"f77\"}\n  CFLAGS=$FFLAGS\n  compiler=$CC\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n  GCC=$G77\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$G77\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=\"$lt_save_CC\"\n  CFLAGS=\"$lt_save_CFLAGS\"\nfi # test \"$_lt_disable_F77\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_F77_CONFIG\n\n\n# _LT_LANG_FC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for a Fortran compiler are\n# suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_FC_CONFIG],\n[AC_LANG_PUSH(Fortran)\n\nif test -z \"$FC\" || test \"X$FC\" = \"Xno\"; then\n  _lt_disable_FC=yes\nfi\n\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n_LT_TAGVAR(allow_undefined_flag, $1)=\n_LT_TAGVAR(always_export_symbols, $1)=no\n_LT_TAGVAR(archive_expsym_cmds, $1)=\n_LT_TAGVAR(export_dynamic_flag_spec, $1)=\n_LT_TAGVAR(hardcode_direct, $1)=no\n_LT_TAGVAR(hardcode_direct_absolute, $1)=no\n_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=\n_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=\n_LT_TAGVAR(hardcode_libdir_separator, $1)=\n_LT_TAGVAR(hardcode_minus_L, $1)=no\n_LT_TAGVAR(hardcode_automatic, $1)=no\n_LT_TAGVAR(inherit_rpath, $1)=no\n_LT_TAGVAR(module_cmds, $1)=\n_LT_TAGVAR(module_expsym_cmds, $1)=\n_LT_TAGVAR(link_all_deplibs, $1)=unknown\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n_LT_TAGVAR(no_undefined_flag, $1)=\n_LT_TAGVAR(whole_archive_flag_spec, $1)=\n_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no\n\n# Source file extension for fc test sources.\nac_ext=${ac_fc_srcext-f}\n\n# Object file extension for compiled fc test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# No sense in running all these tests if we already determined that\n# the FC compiler isn't working.  Some variables (like enable_shared)\n# are currently assumed to apply to all compilers on this platform,\n# and will be corrupted by setting them based on a non-working compiler.\nif test \"$_lt_disable_FC\" != yes; then\n  # Code to be used in simple compile tests\n  lt_simple_compile_test_code=\"\\\n      subroutine t\n      return\n      end\n\"\n\n  # Code to be used in simple link tests\n  lt_simple_link_test_code=\"\\\n      program t\n      end\n\"\n\n  # ltmain only uses $CC for tagged configurations so make sure $CC is set.\n  _LT_TAG_COMPILER\n\n  # save warnings/boilerplate of simple test code\n  _LT_COMPILER_BOILERPLATE\n  _LT_LINKER_BOILERPLATE\n\n  # Allow CC to be a program name with arguments.\n  lt_save_CC=\"$CC\"\n  lt_save_GCC=$GCC\n  lt_save_CFLAGS=$CFLAGS\n  CC=${FC-\"f95\"}\n  CFLAGS=$FCFLAGS\n  compiler=$CC\n  GCC=$ac_cv_fc_compiler_gnu\n\n  _LT_TAGVAR(compiler, $1)=$CC\n  _LT_CC_BASENAME([$compiler])\n\n  if test -n \"$compiler\"; then\n    AC_MSG_CHECKING([if libtool supports shared libraries])\n    AC_MSG_RESULT([$can_build_shared])\n\n    AC_MSG_CHECKING([whether to build shared libraries])\n    test \"$can_build_shared\" = \"no\" && enable_shared=no\n\n    # On AIX, shared libraries and static libraries use the same namespace, and\n    # are all built from PIC.\n    case $host_os in\n      aix3*)\n        test \"$enable_shared\" = yes && enable_static=no\n        if test -n \"$RANLIB\"; then\n          archive_cmds=\"$archive_cmds~\\$RANLIB \\$lib\"\n          postinstall_cmds='$RANLIB $lib'\n        fi\n        ;;\n      aix[[4-9]]*)\n\tif test \"$host_cpu\" != ia64 && test \"$aix_use_runtimelinking\" = no ; then\n\t  test \"$enable_shared\" = yes && enable_static=no\n\tfi\n        ;;\n    esac\n    AC_MSG_RESULT([$enable_shared])\n\n    AC_MSG_CHECKING([whether to build static libraries])\n    # Make sure either enable_shared or enable_static is yes.\n    test \"$enable_shared\" = yes || enable_static=yes\n    AC_MSG_RESULT([$enable_static])\n\n    _LT_TAGVAR(GCC, $1)=\"$ac_cv_fc_compiler_gnu\"\n    _LT_TAGVAR(LD, $1)=\"$LD\"\n\n    ## CAVEAT EMPTOR:\n    ## There is no encapsulation within the following macros, do not change\n    ## the running order or otherwise move them around unless you know exactly\n    ## what you are doing...\n    _LT_SYS_HIDDEN_LIBDEPS($1)\n    _LT_COMPILER_PIC($1)\n    _LT_COMPILER_C_O($1)\n    _LT_COMPILER_FILE_LOCKS($1)\n    _LT_LINKER_SHLIBS($1)\n    _LT_SYS_DYNAMIC_LINKER($1)\n    _LT_LINKER_HARDCODE_LIBPATH($1)\n\n    _LT_CONFIG($1)\n  fi # test -n \"$compiler\"\n\n  GCC=$lt_save_GCC\n  CC=$lt_save_CC\n  CFLAGS=$lt_save_CFLAGS\nfi # test \"$_lt_disable_FC\" != yes\n\nAC_LANG_POP\n])# _LT_LANG_FC_CONFIG\n\n\n# _LT_LANG_GCJ_CONFIG([TAG])\n# --------------------------\n# Ensure that the configuration variables for the GNU Java Compiler compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_GCJ_CONFIG],\n[AC_REQUIRE([LT_PROG_GCJ])dnl\nAC_LANG_SAVE\n\n# Source file extension for Java test sources.\nac_ext=java\n\n# Object file extension for compiled Java test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code=\"class foo {}\"\n\n# Code to be used in simple link tests\nlt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=$CC\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=yes\nCC=${GCJ-\"gcj\"}\nCFLAGS=$GCJFLAGS\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_TAGVAR(LD, $1)=\"$LD\"\n_LT_CC_BASENAME([$compiler])\n\n# GCJ did not exist at the time GCC didn't implicitly link libc in.\n_LT_TAGVAR(archive_cmds_need_lc, $1)=no\n\n_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds\n_LT_TAGVAR(reload_flag, $1)=$reload_flag\n_LT_TAGVAR(reload_cmds, $1)=$reload_cmds\n\n## CAVEAT EMPTOR:\n## There is no encapsulation within the following macros, do not change\n## the running order or otherwise move them around unless you know exactly\n## what you are doing...\nif test -n \"$compiler\"; then\n  _LT_COMPILER_NO_RTTI($1)\n  _LT_COMPILER_PIC($1)\n  _LT_COMPILER_C_O($1)\n  _LT_COMPILER_FILE_LOCKS($1)\n  _LT_LINKER_SHLIBS($1)\n  _LT_LINKER_HARDCODE_LIBPATH($1)\n\n  _LT_CONFIG($1)\nfi\n\nAC_LANG_RESTORE\n\nGCC=$lt_save_GCC\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_GCJ_CONFIG\n\n\n# _LT_LANG_RC_CONFIG([TAG])\n# -------------------------\n# Ensure that the configuration variables for the Windows resource compiler\n# are suitably defined.  These variables are subsequently used by _LT_CONFIG\n# to write the compiler configuration to `libtool'.\nm4_defun([_LT_LANG_RC_CONFIG],\n[AC_REQUIRE([LT_PROG_RC])dnl\nAC_LANG_SAVE\n\n# Source file extension for RC test sources.\nac_ext=rc\n\n# Object file extension for compiled RC test sources.\nobjext=o\n_LT_TAGVAR(objext, $1)=$objext\n\n# Code to be used in simple compile tests\nlt_simple_compile_test_code='sample MENU { MENUITEM \"&Soup\", 100, CHECKED }'\n\n# Code to be used in simple link tests\nlt_simple_link_test_code=\"$lt_simple_compile_test_code\"\n\n# ltmain only uses $CC for tagged configurations so make sure $CC is set.\n_LT_TAG_COMPILER\n\n# save warnings/boilerplate of simple test code\n_LT_COMPILER_BOILERPLATE\n_LT_LINKER_BOILERPLATE\n\n# Allow CC to be a program name with arguments.\nlt_save_CC=\"$CC\"\nlt_save_CFLAGS=$CFLAGS\nlt_save_GCC=$GCC\nGCC=\nCC=${RC-\"windres\"}\nCFLAGS=\ncompiler=$CC\n_LT_TAGVAR(compiler, $1)=$CC\n_LT_CC_BASENAME([$compiler])\n_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes\n\nif test -n \"$compiler\"; then\n  :\n  _LT_CONFIG($1)\nfi\n\nGCC=$lt_save_GCC\nAC_LANG_RESTORE\nCC=$lt_save_CC\nCFLAGS=$lt_save_CFLAGS\n])# _LT_LANG_RC_CONFIG\n\n\n# LT_PROG_GCJ\n# -----------\nAC_DEFUN([LT_PROG_GCJ],\n[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],\n  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],\n    [AC_CHECK_TOOL(GCJ, gcj,)\n      test \"x${GCJFLAGS+set}\" = xset || GCJFLAGS=\"-g -O2\"\n      AC_SUBST(GCJFLAGS)])])[]dnl\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_GCJ], [])\n\n\n# LT_PROG_RC\n# ----------\nAC_DEFUN([LT_PROG_RC],\n[AC_CHECK_TOOL(RC, windres,)\n])\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_RC], [])\n\n\n# _LT_DECL_EGREP\n# --------------\n# If we don't have a new enough Autoconf to choose the best grep\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_EGREP],\n[AC_REQUIRE([AC_PROG_EGREP])dnl\nAC_REQUIRE([AC_PROG_FGREP])dnl\ntest -z \"$GREP\" && GREP=grep\n_LT_DECL([], [GREP], [1], [A grep program that handles long lines])\n_LT_DECL([], [EGREP], [1], [An ERE matcher])\n_LT_DECL([], [FGREP], [1], [A literal string matcher])\ndnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too\nAC_SUBST([GREP])\n])\n\n\n# _LT_DECL_OBJDUMP\n# --------------\n# If we don't have a new enough Autoconf to choose the best objdump\n# available, choose the one first in the user's PATH.\nm4_defun([_LT_DECL_OBJDUMP],\n[AC_CHECK_TOOL(OBJDUMP, objdump, false)\ntest -z \"$OBJDUMP\" && OBJDUMP=objdump\n_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])\nAC_SUBST([OBJDUMP])\n])\n\n# _LT_DECL_DLLTOOL\n# ----------------\n# Ensure DLLTOOL variable is set.\nm4_defun([_LT_DECL_DLLTOOL],\n[AC_CHECK_TOOL(DLLTOOL, dlltool, false)\ntest -z \"$DLLTOOL\" && DLLTOOL=dlltool\n_LT_DECL([], [DLLTOOL], [1], [DLL creation program])\nAC_SUBST([DLLTOOL])\n])\n\n# _LT_DECL_SED\n# ------------\n# Check for a fully-functional sed program, that truncates\n# as few characters as possible.  Prefer GNU sed if found.\nm4_defun([_LT_DECL_SED],\n[AC_PROG_SED\ntest -z \"$SED\" && SED=sed\nXsed=\"$SED -e 1s/^X//\"\n_LT_DECL([], [SED], [1], [A sed program that does not truncate output])\n_LT_DECL([], [Xsed], [\"\\$SED -e 1s/^X//\"],\n    [Sed that helps us avoid accidentally triggering echo(1) options like -n])\n])# _LT_DECL_SED\n\nm4_ifndef([AC_PROG_SED], [\n############################################################\n# NOTE: This macro has been submitted for inclusion into   #\n#  GNU Autoconf as AC_PROG_SED.  When it is available in   #\n#  a released version of Autoconf we should remove this    #\n#  macro and use it instead.                               #\n############################################################\n\nm4_defun([AC_PROG_SED],\n[AC_MSG_CHECKING([for a sed that does not truncate output])\nAC_CACHE_VAL(lt_cv_path_SED,\n[# Loop through the user's path and test for sed and gsed.\n# Then use that list of sed's as ones to test for truncation.\nas_save_IFS=$IFS; IFS=$PATH_SEPARATOR\nfor as_dir in $PATH\ndo\n  IFS=$as_save_IFS\n  test -z \"$as_dir\" && as_dir=.\n  for lt_ac_prog in sed gsed; do\n    for ac_exec_ext in '' $ac_executable_extensions; do\n      if $as_executable_p \"$as_dir/$lt_ac_prog$ac_exec_ext\"; then\n        lt_ac_sed_list=\"$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext\"\n      fi\n    done\n  done\ndone\nIFS=$as_save_IFS\nlt_ac_max=0\nlt_ac_count=0\n# Add /usr/xpg4/bin/sed as it is typically found on Solaris\n# along with /bin/sed that truncates output.\nfor lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do\n  test ! -f $lt_ac_sed && continue\n  cat /dev/null > conftest.in\n  lt_ac_count=0\n  echo $ECHO_N \"0123456789$ECHO_C\" >conftest.in\n  # Check for GNU sed and select it if it is found.\n  if \"$lt_ac_sed\" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then\n    lt_cv_path_SED=$lt_ac_sed\n    break\n  fi\n  while true; do\n    cat conftest.in conftest.in >conftest.tmp\n    mv conftest.tmp conftest.in\n    cp conftest.in conftest.nl\n    echo >>conftest.nl\n    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break\n    cmp -s conftest.out conftest.nl || break\n    # 10000 chars as input seems more than enough\n    test $lt_ac_count -gt 10 && break\n    lt_ac_count=`expr $lt_ac_count + 1`\n    if test $lt_ac_count -gt $lt_ac_max; then\n      lt_ac_max=$lt_ac_count\n      lt_cv_path_SED=$lt_ac_sed\n    fi\n  done\ndone\n])\nSED=$lt_cv_path_SED\nAC_SUBST([SED])\nAC_MSG_RESULT([$SED])\n])#AC_PROG_SED\n])#m4_ifndef\n\n# Old name:\nAU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])\ndnl aclocal-1.4 backwards compatibility:\ndnl AC_DEFUN([LT_AC_PROG_SED], [])\n\n\n# _LT_CHECK_SHELL_FEATURES\n# ------------------------\n# Find out whether the shell is Bourne or XSI compatible,\n# or has some other useful features.\nm4_defun([_LT_CHECK_SHELL_FEATURES],\n[AC_MSG_CHECKING([whether the shell understands some XSI constructs])\n# Try some XSI features\nxsi_shell=no\n( _lt_dummy=\"a/b/c\"\n  test \"${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}\"${_lt_dummy%\"$_lt_dummy\"}, \\\n      = c,a/b,b/c, \\\n    && eval 'test $(( 1 + 1 )) -eq 2 \\\n    && test \"${#_lt_dummy}\" -eq 5' ) >/dev/null 2>&1 \\\n  && xsi_shell=yes\nAC_MSG_RESULT([$xsi_shell])\n_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])\n\nAC_MSG_CHECKING([whether the shell understands \"+=\"])\nlt_shell_append=no\n( foo=bar; set foo baz; eval \"$[1]+=\\$[2]\" && test \"$foo\" = barbaz ) \\\n    >/dev/null 2>&1 \\\n  && lt_shell_append=yes\nAC_MSG_RESULT([$lt_shell_append])\n_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])\n\nif ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then\n  lt_unset=unset\nelse\n  lt_unset=false\nfi\n_LT_DECL([], [lt_unset], [0], [whether the shell understands \"unset\"])dnl\n\n# test EBCDIC or ASCII\ncase `echo X|tr X '\\101'` in\n A) # ASCII based system\n    # \\n is not interpreted correctly by Solaris 8 /usr/ucb/tr\n  lt_SP2NL='tr \\040 \\012'\n  lt_NL2SP='tr \\015\\012 \\040\\040'\n  ;;\n *) # EBCDIC based system\n  lt_SP2NL='tr \\100 \\n'\n  lt_NL2SP='tr \\r\\n \\100\\100'\n  ;;\nesac\n_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl\n_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl\n])# _LT_CHECK_SHELL_FEATURES\n\n\n# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)\n# ------------------------------------------------------\n# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and\n# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.\nm4_defun([_LT_PROG_FUNCTION_REPLACE],\n[dnl {\nsed -e '/^$1 ()$/,/^} # $1 /c\\\n$1 ()\\\n{\\\nm4_bpatsubsts([$2], [$], [\\\\], [^\\([\t ]\\)], [\\\\\\1])\n} # Extended-shell $1 implementation' \"$cfgfile\" > $cfgfile.tmp \\\n  && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n    || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\ntest 0 -eq $? || _lt_function_replace_fail=:\n])\n\n\n# _LT_PROG_REPLACE_SHELLFNS\n# -------------------------\n# Replace existing portable implementations of several shell functions with\n# equivalent extended shell implementations where those features are available..\nm4_defun([_LT_PROG_REPLACE_SHELLFNS],\n[if test x\"$xsi_shell\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl\n    case ${1} in\n      */*) func_dirname_result=\"${1%/*}${2}\" ;;\n      *  ) func_dirname_result=\"${3}\" ;;\n    esac\n    func_basename_result=\"${1##*/}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl\n    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\n    # positional parameters, so assign one to ordinary parameter first.\n    func_stripname_result=${3}\n    func_stripname_result=${func_stripname_result#\"${1}\"}\n    func_stripname_result=${func_stripname_result%\"${2}\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl\n    func_split_long_opt_name=${1%%=*}\n    func_split_long_opt_arg=${1#*=}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl\n    func_split_short_opt_arg=${1#??}\n    func_split_short_opt_name=${1%\"$func_split_short_opt_arg\"}])\n\n  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl\n    case ${1} in\n      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\n      *)    func_lo2o_result=${1} ;;\n    esac])\n\n  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])\n\n  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])\n\n  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])\nfi\n\nif test x\"$lt_shell_append\" = xyes; then\n  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval \"${1}+=\\\\${2}\"])\n\n  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl\n    func_quote_for_eval \"${2}\"\ndnl m4 expansion turns \\\\\\\\ into \\\\, and then the shell eval turns that into \\\n    eval \"${1}+=\\\\\\\\ \\\\$func_quote_for_eval_result\"])\n\n  # Save a `func_append' function call where possible by direct use of '+='\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1+=\"%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nelse\n  # Save a `func_append' function call even when '+=' is not available\n  sed -e 's%func_append \\([[a-zA-Z_]]\\{1,\\}\\) \"%\\1=\"$\\1%g' $cfgfile > $cfgfile.tmp \\\n    && mv -f \"$cfgfile.tmp\" \"$cfgfile\" \\\n      || (rm -f \"$cfgfile\" && cp \"$cfgfile.tmp\" \"$cfgfile\" && rm -f \"$cfgfile.tmp\")\n  test 0 -eq $? || _lt_function_replace_fail=:\nfi\n\nif test x\"$_lt_function_replace_fail\" = x\":\"; then\n  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])\nfi\n])\n\n# _LT_PATH_CONVERSION_FUNCTIONS\n# -----------------------------\n# Determine which file name conversion functions should be used by\n# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed\n# for certain cross-compile configurations and native mingw.\nm4_defun([_LT_PATH_CONVERSION_FUNCTIONS],\n[AC_REQUIRE([AC_CANONICAL_HOST])dnl\nAC_REQUIRE([AC_CANONICAL_BUILD])dnl\nAC_MSG_CHECKING([how to convert $build file names to $host format])\nAC_CACHE_VAL(lt_cv_to_host_file_cmd,\n[case $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32\n        ;;\n    esac\n    ;;\n  *-*-cygwin* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin\n        ;;\n      *-*-cygwin* )\n        lt_cv_to_host_file_cmd=func_convert_file_noop\n        ;;\n      * ) # otherwise, assume *nix\n        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin\n        ;;\n    esac\n    ;;\n  * ) # unhandled hosts (and \"normal\" native builds)\n    lt_cv_to_host_file_cmd=func_convert_file_noop\n    ;;\nesac\n])\nto_host_file_cmd=$lt_cv_to_host_file_cmd\nAC_MSG_RESULT([$lt_cv_to_host_file_cmd])\n_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],\n         [0], [convert $build file names to $host format])dnl\n\nAC_MSG_CHECKING([how to convert $build file names to toolchain format])\nAC_CACHE_VAL(lt_cv_to_tool_file_cmd,\n[#assume ordinary cross tools, or native build.\nlt_cv_to_tool_file_cmd=func_convert_file_noop\ncase $host in\n  *-*-mingw* )\n    case $build in\n      *-*-mingw* ) # actually msys\n        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32\n        ;;\n    esac\n    ;;\nesac\n])\nto_tool_file_cmd=$lt_cv_to_tool_file_cmd\nAC_MSG_RESULT([$lt_cv_to_tool_file_cmd])\n_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],\n         [0], [convert $build files to toolchain format])dnl\n])# _LT_PATH_CONVERSION_FUNCTIONS\n"},{"id":13392,"name":"cextern/expat/lib","nodeType":"Package"},{"id":13393,"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"},{"id":13394,"name":"examples","nodeType":"Package"},{"id":13395,"name":"README.txt","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\nhttp://tutorials.astropy.org (and can be submitted at\n`the associated github repository <https://github.com/astropy/astropy-tutorials>`_).\n\n"},{"id":13396,"name":"reference.html","nodeType":"TextFile","path":"cextern/expat/doc","text":"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n                      \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html>\n<head>\n<!-- Copyright 1999,2000 Clark Cooper <coopercc@netheaven.com>\n     All rights reserved.\n     This is free software. You may distribute or modify according to\n     the terms of the MIT/X License -->\n  <title>Expat XML Parser</title>\n  <meta name=\"author\" content=\"Clark Cooper, coopercc@netheaven.com\" />\n  <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n  <link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />\n</head>\n<body>\n  <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n    <tr>\n      <td class=\"corner\"><img src=\"expat.png\" alt=\"(Expat logo)\" /></td>\n      <td class=\"banner\"><h1>The Expat XML Parser</h1></td>\n    </tr>\n    <tr>\n      <td class=\"releaseno\">Release 2.0.1</td>\n      <td></td>\n    </tr>\n  </table>\n<div class=\"content\">\n\n<p>Expat is a library, written in C, for parsing XML documents. It's\nthe underlying XML parser for the open source Mozilla project, Perl's\n<code>XML::Parser</code>, Python's <code>xml.parsers.expat</code>, and\nother open-source XML parsers.</p>\n\n<p>This library is the creation of James Clark, who's also given us\ngroff (an nroff look-alike), Jade (an implemention of ISO's DSSSL\nstylesheet language for SGML), XP (a Java XML parser package), XT (a\nJava XSL engine).  James was also the technical lead on the XML\nWorking Group at W3C that produced the XML specification.</p>\n\n<p>This is free software, licensed under the <a\nhref=\"../COPYING\">MIT/X Consortium license</a>. You may download it\nfrom <a href=\"http://www.libexpat.org/\">the Expat home page</a>.\n</p>\n\n<p>The bulk of this document was originally commissioned as an article\nby <a href=\"http://www.xml.com/\">XML.com</a>. They graciously allowed\nClark Cooper to retain copyright and to distribute it with Expat.\nThis version has been substantially extended to include documentation\non features which have been added since the original article was\npublished, and additional information on using the original\ninterface.</p>\n\n<hr />\n<h2>Table of Contents</h2>\n<ul>\n  <li><a href=\"#overview\">Overview</a></li>\n  <li><a href=\"#building\">Building and Installing</a></li>\n  <li><a href=\"#using\">Using Expat</a></li>\n  <li><a href=\"#reference\">Reference</a>\n  <ul>\n    <li><a href=\"#creation\">Parser Creation Functions</a>\n    <ul>\n      <li><a href=\"#XML_ParserCreate\">XML_ParserCreate</a></li>\n      <li><a href=\"#XML_ParserCreateNS\">XML_ParserCreateNS</a></li>\n      <li><a href=\"#XML_ParserCreate_MM\">XML_ParserCreate_MM</a></li>\n      <li><a href=\"#XML_ExternalEntityParserCreate\">XML_ExternalEntityParserCreate</a></li>\n      <li><a href=\"#XML_ParserFree\">XML_ParserFree</a></li>\n      <li><a href=\"#XML_ParserReset\">XML_ParserReset</a></li>\n    </ul>\n    </li>\n    <li><a href=\"#parsing\">Parsing Functions</a>\n    <ul>\n      <li><a href=\"#XML_Parse\">XML_Parse</a></li>\n      <li><a href=\"#XML_ParseBuffer\">XML_ParseBuffer</a></li>\n      <li><a href=\"#XML_GetBuffer\">XML_GetBuffer</a></li>\n      <li><a href=\"#XML_StopParser\">XML_StopParser</a></li>\n      <li><a href=\"#XML_ResumeParser\">XML_ResumeParser</a></li>\n      <li><a href=\"#XML_GetParsingStatus\">XML_GetParsingStatus</a></li>\n    </ul>\n    </li>\n    <li><a href=\"#setting\">Handler Setting Functions</a>\n    <ul>\n      <li><a href=\"#XML_SetStartElementHandler\">XML_SetStartElementHandler</a></li>\n      <li><a href=\"#XML_SetEndElementHandler\">XML_SetEndElementHandler</a></li>\n      <li><a href=\"#XML_SetElementHandler\">XML_SetElementHandler</a></li>\n      <li><a href=\"#XML_SetCharacterDataHandler\">XML_SetCharacterDataHandler</a></li>\n      <li><a href=\"#XML_SetProcessingInstructionHandler\">XML_SetProcessingInstructionHandler</a></li>\n      <li><a href=\"#XML_SetCommentHandler\">XML_SetCommentHandler</a></li>\n      <li><a href=\"#XML_SetStartCdataSectionHandler\">XML_SetStartCdataSectionHandler</a></li>\n      <li><a href=\"#XML_SetEndCdataSectionHandler\">XML_SetEndCdataSectionHandler</a></li>\n      <li><a href=\"#XML_SetCdataSectionHandler\">XML_SetCdataSectionHandler</a></li>\n      <li><a href=\"#XML_SetDefaultHandler\">XML_SetDefaultHandler</a></li>\n      <li><a href=\"#XML_SetDefaultHandlerExpand\">XML_SetDefaultHandlerExpand</a></li>\n      <li><a href=\"#XML_SetExternalEntityRefHandler\">XML_SetExternalEntityRefHandler</a></li>\n      <li><a href=\"#XML_SetExternalEntityRefHandlerArg\">XML_SetExternalEntityRefHandlerArg</a></li>\n      <li><a href=\"#XML_SetSkippedEntityHandler\">XML_SetSkippedEntityHandler</a></li>\n      <li><a href=\"#XML_SetUnknownEncodingHandler\">XML_SetUnknownEncodingHandler</a></li>\n      <li><a href=\"#XML_SetStartNamespaceDeclHandler\">XML_SetStartNamespaceDeclHandler</a></li>\n      <li><a href=\"#XML_SetEndNamespaceDeclHandler\">XML_SetEndNamespaceDeclHandler</a></li>\n      <li><a href=\"#XML_SetNamespaceDeclHandler\">XML_SetNamespaceDeclHandler</a></li>\n      <li><a href=\"#XML_SetXmlDeclHandler\">XML_SetXmlDeclHandler</a></li>\t\t  \n      <li><a href=\"#XML_SetStartDoctypeDeclHandler\">XML_SetStartDoctypeDeclHandler</a></li>\n      <li><a href=\"#XML_SetEndDoctypeDeclHandler\">XML_SetEndDoctypeDeclHandler</a></li>\n      <li><a href=\"#XML_SetDoctypeDeclHandler\">XML_SetDoctypeDeclHandler</a></li>\n      <li><a href=\"#XML_SetElementDeclHandler\">XML_SetElementDeclHandler</a></li>\n      <li><a href=\"#XML_SetAttlistDeclHandler\">XML_SetAttlistDeclHandler</a></li>\n      <li><a href=\"#XML_SetEntityDeclHandler\">XML_SetEntityDeclHandler</a></li>\n      <li><a href=\"#XML_SetUnparsedEntityDeclHandler\">XML_SetUnparsedEntityDeclHandler</a></li>\n      <li><a href=\"#XML_SetNotationDeclHandler\">XML_SetNotationDeclHandler</a></li>\n      <li><a href=\"#XML_SetNotStandaloneHandler\">XML_SetNotStandaloneHandler</a></li>\n    </ul>\n    </li>\n    <li><a href=\"#position\">Parse Position and Error Reporting Functions</a>\n    <ul>\n      <li><a href=\"#XML_GetErrorCode\">XML_GetErrorCode</a></li>\n      <li><a href=\"#XML_ErrorString\">XML_ErrorString</a></li>\n      <li><a href=\"#XML_GetCurrentByteIndex\">XML_GetCurrentByteIndex</a></li>\n      <li><a href=\"#XML_GetCurrentLineNumber\">XML_GetCurrentLineNumber</a></li>\n      <li><a href=\"#XML_GetCurrentColumnNumber\">XML_GetCurrentColumnNumber</a></li>\n      <li><a href=\"#XML_GetCurrentByteCount\">XML_GetCurrentByteCount</a></li>\n      <li><a href=\"#XML_GetInputContext\">XML_GetInputContext</a></li>\n    </ul>\n    </li>\n    <li><a href=\"#miscellaneous\">Miscellaneous Functions</a>\n    <ul>\n      <li><a href=\"#XML_SetUserData\">XML_SetUserData</a></li>\n      <li><a href=\"#XML_GetUserData\">XML_GetUserData</a></li>\n      <li><a href=\"#XML_UseParserAsHandlerArg\">XML_UseParserAsHandlerArg</a></li>\n      <li><a href=\"#XML_SetBase\">XML_SetBase</a></li>\n      <li><a href=\"#XML_GetBase\">XML_GetBase</a></li>\n      <li><a href=\"#XML_GetSpecifiedAttributeCount\">XML_GetSpecifiedAttributeCount</a></li>\n      <li><a href=\"#XML_GetIdAttributeIndex\">XML_GetIdAttributeIndex</a></li>\n      <li><a href=\"#XML_GetAttributeInfo\">XML_GetAttributeInfo</a></li>\n      <li><a href=\"#XML_SetEncoding\">XML_SetEncoding</a></li>\n      <li><a href=\"#XML_SetParamEntityParsing\">XML_SetParamEntityParsing</a></li>\n      <li><a href=\"#XML_SetHashSalt\">XML_SetHashSalt</a></li>\n      <li><a href=\"#XML_UseForeignDTD\">XML_UseForeignDTD</a></li>\n      <li><a href=\"#XML_SetReturnNSTriplet\">XML_SetReturnNSTriplet</a></li>\n      <li><a href=\"#XML_DefaultCurrent\">XML_DefaultCurrent</a></li>\n      <li><a href=\"#XML_ExpatVersion\">XML_ExpatVersion</a></li>\n      <li><a href=\"#XML_ExpatVersionInfo\">XML_ExpatVersionInfo</a></li>\n      <li><a href=\"#XML_GetFeatureList\">XML_GetFeatureList</a></li>\n      <li><a href=\"#XML_FreeContentModel\">XML_FreeContentModel</a></li>\n      <li><a href=\"#XML_MemMalloc\">XML_MemMalloc</a></li>\n      <li><a href=\"#XML_MemRealloc\">XML_MemRealloc</a></li>\n      <li><a href=\"#XML_MemFree\">XML_MemFree</a></li>\n    </ul>\n    </li>\n  </ul>  \n  </li>\n</ul>\n\n<hr />\n<h2><a name=\"overview\">Overview</a></h2>\n\n<p>Expat is a stream-oriented parser. You register callback (or\nhandler) functions with the parser and then start feeding it the\ndocument.  As the parser recognizes parts of the document, it will\ncall the appropriate handler for that part (if you've registered one.) \nThe document is fed to the parser in pieces, so you can start parsing\nbefore you have all the document. This also allows you to parse really\nhuge documents that won't fit into memory.</p>\n\n<p>Expat can be intimidating due to the many kinds of handlers and\noptions you can set. But you only need to learn four functions in\norder to do 90% of what you'll want to do with it:</p>\n\n<dl>\n\n<dt><code><a href= \"#XML_ParserCreate\"\n             >XML_ParserCreate</a></code></dt>\n  <dd>Create a new parser object.</dd>\n\n<dt><code><a href= \"#XML_SetElementHandler\"\n             >XML_SetElementHandler</a></code></dt>\n  <dd>Set handlers for start and end tags.</dd>\n\n<dt><code><a href= \"#XML_SetCharacterDataHandler\"\n             >XML_SetCharacterDataHandler</a></code></dt>\n  <dd>Set handler for text.</dd>\n\n<dt><code><a href= \"#XML_Parse\"\n             >XML_Parse</a></code></dt>\n  <dd>Pass a buffer full of document to the parser</dd>\n</dl>\n\n<p>These functions and others are described in the <a\nhref=\"#reference\">reference</a> part of this document. The reference\nsection also describes in detail the parameters passed to the\ndifferent types of handlers.</p>\n\n<p>Let's look at a very simple example program that only uses 3 of the\nabove functions (it doesn't need to set a character handler.) The\nprogram <a href=\"../examples/outline.c\">outline.c</a> prints an\nelement outline, indenting child elements to distinguish them from the\nparent element that contains them. The start handler does all the\nwork.  It prints two indenting spaces for every level of ancestor\nelements, then it prints the element and attribute\ninformation. Finally it increments the global <code>Depth</code>\nvariable.</p>\n\n<pre class=\"eg\">\nint Depth;\n\nvoid XMLCALL\nstart(void *data, const char *el, const char **attr) {\n  int i;\n\n  for (i = 0; i &lt; Depth; i++)\n    printf(\"  \");\n\n  printf(\"%s\", el);\n\n  for (i = 0; attr[i]; i += 2) {\n    printf(\" %s='%s'\", attr[i], attr[i + 1]);\n  }\n\n  printf(\"\\n\");\n  Depth++;\n}  /* End of start handler */\n</pre>\n\n<p>The end tag simply does the bookkeeping work of decrementing\n<code>Depth</code>.</p>\n<pre class=\"eg\">\nvoid XMLCALL\nend(void *data, const char *el) {\n  Depth--;\n}  /* End of end handler */\n</pre>\n\n<p>Note the <code>XMLCALL</code> annotation used for the callbacks.\nThis is used to ensure that the Expat and the callbacks are using the\nsame calling convention in case the compiler options used for Expat\nitself and the client code are different.  Expat tries not to care\nwhat the default calling convention is, though it may require that it\nbe compiled with a default convention of \"cdecl\" on some platforms.\nFor code which uses Expat, however, the calling convention is\nspecified by the <code>XMLCALL</code> annotation on most platforms;\ncallbacks should be defined using this annotation.</p>\n\n<p>The <code>XMLCALL</code> annotation was added in Expat 1.95.7, but\nexisting working Expat applications don't need to add it (since they\nare already using the \"cdecl\" calling convention, or they wouldn't be\nworking).  The annotation is only needed if the default calling\nconvention may be something other than \"cdecl\".  To use the annotation\nsafely with older versions of Expat, you can conditionally define it\n<em>after</em> including Expat's header file:</p>\n\n<pre class=\"eg\">\n#include &lt;expat.h&gt;\n\n#ifndef XMLCALL\n#if defined(_MSC_EXTENSIONS) &amp;&amp; !defined(__BEOS__) &amp;&amp; !defined(__CYGWIN__)\n#define XMLCALL __cdecl\n#elif defined(__GNUC__)\n#define XMLCALL __attribute__((cdecl))\n#else\n#define XMLCALL\n#endif\n#endif\n</pre>\n\n<p>After creating the parser, the main program just has the job of\nshoveling the document to the parser so that it can do its work.</p>\n\n<hr />\n<h2><a name=\"building\">Building and Installing Expat</a></h2>\n\n<p>The Expat distribution comes as a compressed (with GNU gzip) tar\nfile.  You may download the latest version from <a href=\n\"http://sourceforge.net/projects/expat/\" >Source Forge</a>.  After\nunpacking this, cd into the directory. Then follow either the Win32\ndirections or Unix directions below.</p>\n\n<h3>Building under Win32</h3>\n\n<p>If you're using the GNU compiler under cygwin, follow the Unix\ndirections in the next section. Otherwise if you have Microsoft's\nDeveloper Studio installed, then from Windows Explorer double-click on\n\"expat.dsp\" in the lib directory and build and install in the usual\nmanner.</p>\n\n<p>Alternatively, you may download the Win32 binary package that\ncontains the \"expat.h\" include file and a pre-built DLL.</p>\n\n<h3>Building under Unix (or GNU)</h3>\n\n<p>First you'll need to run the configure shell script in order to\nconfigure the Makefiles and headers for your system.</p>\n\n<p>If you're happy with all the defaults that configure picks for you,\nand you have permission on your system to install into /usr/local, you\ncan install Expat with this sequence of commands:</p>\n\n<pre class=\"eg\">\n./configure\nmake\nmake install\n</pre>\n\n<p>There are some options that you can provide to this script, but the\nonly one we'll mention here is the <code>--prefix</code> option. You\ncan find out all the options available by running configure with just\nthe <code>--help</code> option.</p>\n\n<p>By default, the configure script sets things up so that the library\ngets installed in <code>/usr/local/lib</code> and the associated\nheader file in <code>/usr/local/include</code>.  But if you were to\ngive the option, <code>--prefix=/home/me/mystuff</code>, then the\nlibrary and header would get installed in\n<code>/home/me/mystuff/lib</code> and\n<code>/home/me/mystuff/include</code> respectively.</p>\n\n<h3>Configuring Expat Using the Pre-Processor</h3>\n\n<p>Expat's feature set can be configured using a small number of\npre-processor definitions.  The definition of this symbols does not\naffect the set of entry points for Expat, only the behavior of the API\nand the definition of character types in the case of\n<code>XML_UNICODE_WCHAR_T</code>.  The symbols are:</p>\n\n<dl class=\"cpp-symbols\">\n<dt>XML_DTD</dt>\n<dd>Include support for using and reporting DTD-based content.  If\nthis is defined, default attribute values from an external DTD subset\nare reported and attribute value normalization occurs based on the\ntype of attributes defined in the external subset.  Without\nthis, Expat has a smaller memory footprint and can be faster, but will\nnot load external entities or process conditional sections.  This does\nnot affect the set of functions available in the API.</dd>\n\n<dt>XML_NS</dt>\n<dd>When defined, support for the <cite><a href=\n\"http://www.w3.org/TR/REC-xml-names/\" >Namespaces in XML</a></cite>\nspecification is included.</dd>\n\n<dt>XML_UNICODE</dt>\n<dd>When defined, character data reported to the application is\nencoded in UTF-16 using wide characters of the type\n<code>XML_Char</code>.  This is implied if\n<code>XML_UNICODE_WCHAR_T</code> is defined.</dd>\n\n<dt>XML_UNICODE_WCHAR_T</dt>\n<dd>If defined, causes the <code>XML_Char</code> character type to be\ndefined using the <code>wchar_t</code> type; otherwise, <code>unsigned\nshort</code> is used.  Defining this implies\n<code>XML_UNICODE</code>.</dd>\n\n<dt>XML_LARGE_SIZE</dt>\n<dd>If defined, causes the <code>XML_Size</code> and <code>XML_Index</code>\ninteger types to be at least 64 bits in size. This is intended to support\nprocessing of very large input streams, where the return values of\n<code><a href=\"#XML_GetCurrentByteIndex\" >XML_GetCurrentByteIndex</a></code>,\n<code><a href=\"#XML_GetCurrentLineNumber\" >XML_GetCurrentLineNumber</a></code> and\n<code><a href=\"#XML_GetCurrentColumnNumber\" >XML_GetCurrentColumnNumber</a></code>\ncould overflow. It may not be supported by all compilers, and is turned\noff by default.</dd>\n\n<dt>XML_CONTEXT_BYTES</dt>\n<dd>The number of input bytes of markup context which the parser will\nensure are available for reporting via <code><a href=\n\"#XML_GetInputContext\" >XML_GetInputContext</a></code>.  This is\nnormally set to 1024, and must be set to a positive interger.  If this\nis not defined, the input context will not be available and <code><a\nhref= \"#XML_GetInputContext\" >XML_GetInputContext</a></code> will\nalways report NULL.  Without this, Expat has a smaller memory\nfootprint and can be faster.</dd>\n\n<dt>XML_STATIC</dt>\n<dd>On Windows, this should be set if Expat is going to be linked\nstatically with the code that calls it; this is required to get all\nthe right MSVC magic annotations correct.  This is ignored on other\nplatforms.</dd>\n\n<dt>XML_ATTR_INFO</dt>\n<dd>If defined, makes the the additional function <code><a href=\n\"#XML_GetAttributeInfo\" >XML_GetAttributeInfo</a></code> available\nfor reporting attribute byte offsets.</dd>\n</dl>\n\n<hr />\n<h2><a name=\"using\">Using Expat</a></h2>\n\n<h3>Compiling and Linking Against Expat</h3>\n\n<p>Unless you installed Expat in a location not expected by your\ncompiler and linker, all you have to do to use Expat in your programs\nis to include the Expat header (<code>#include &lt;expat.h&gt;</code>)\nin your files that make calls to it and to tell the linker that it\nneeds to link against the Expat library.  On Unix systems, this would\nusually be done with the <code>-lexpat</code> argument.  Otherwise,\nyou'll need to tell the compiler where to look for the Expat header\nand the linker where to find the Expat library.  You may also need to\ntake steps to tell the operating system where to find this library at\nrun time.</p>\n\n<p>On a Unix-based system, here's what a Makefile might look like when\nExpat is installed in a standard location:</p>\n\n<pre class=\"eg\">\nCC=cc\nLDFLAGS=\nLIBS= -lexpat\nxmlapp: xmlapp.o\n        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)\n</pre>\n\n<p>If you installed Expat in, say, <code>/home/me/mystuff</code>, then\nthe Makefile would look like this:</p>\n\n<pre class=\"eg\">\nCC=cc\nCFLAGS= -I/home/me/mystuff/include\nLDFLAGS=\nLIBS= -L/home/me/mystuff/lib -lexpat\nxmlapp: xmlapp.o\n        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)\n</pre>\n\n<p>You'd also have to set the environment variable\n<code>LD_LIBRARY_PATH</code> to <code>/home/me/mystuff/lib</code> (or\nto <code>${LD_LIBRARY_PATH}:/home/me/mystuff/lib</code> if\nLD_LIBRARY_PATH already has some directories in it) in order to run\nyour application.</p>\n\n<h3>Expat Basics</h3>\n\n<p>As we saw in the example in the overview, the first step in parsing\nan XML document with Expat is to create a parser object. There are <a\nhref=\"#creation\">three functions</a> in the Expat API for creating a\nparser object.  However, only two of these (<code><a href=\n\"#XML_ParserCreate\" >XML_ParserCreate</a></code> and <code><a href=\n\"#XML_ParserCreateNS\" >XML_ParserCreateNS</a></code>) can be used for\nconstructing a parser for a top-level document.  The object returned\nby these functions is an opaque pointer (i.e. \"expat.h\" declares it as\nvoid *) to data with further internal structure. In order to free the\nmemory associated with this object you must call <code><a href=\n\"#XML_ParserFree\" >XML_ParserFree</a></code>. Note that if you have\nprovided any <a href=\"#userdata\">user data</a> that gets stored in the\nparser, then your application is responsible for freeing it prior to\ncalling <code>XML_ParserFree</code>.</p>\n\n<p>The objects returned by the parser creation functions are good for\nparsing only one XML document or external parsed entity. If your\napplication needs to parse many XML documents, then it needs to create\na parser object for each one. The best way to deal with this is to\ncreate a higher level object that contains all the default\ninitialization you want for your parser objects.</p>\n\n<p>Walking through a document hierarchy with a stream oriented parser\nwill require a good stack mechanism in order to keep track of current\ncontext.  For instance, to answer the simple question, \"What element\ndoes this text belong to?\" requires a stack, since the parser may have\ndescended into other elements that are children of the current one and\nhas encountered this text on the way out.</p>\n\n<p>The things you're likely to want to keep on a stack are the\ncurrently opened element and it's attributes. You push this\ninformation onto the stack in the start handler and you pop it off in\nthe end handler.</p>\n\n<p>For some tasks, it is sufficient to just keep information on what\nthe depth of the stack is (or would be if you had one.) The outline\nprogram shown above presents one example. Another such task would be\nskipping over a complete element. When you see the start tag for the\nelement you want to skip, you set a skip flag and record the depth at\nwhich the element started.  When the end tag handler encounters the\nsame depth, the skipped element has ended and the flag may be\ncleared. If you follow the convention that the root element starts at\n1, then you can use the same variable for skip flag and skip\ndepth.</p>\n\n<pre class=\"eg\">\nvoid\ninit_info(Parseinfo *info) {\n  info->skip = 0;\n  info->depth = 1;\n  /* Other initializations here */\n}  /* End of init_info */\n\nvoid XMLCALL\nrawstart(void *data, const char *el, const char **attr) {\n  Parseinfo *inf = (Parseinfo *) data;\n\n  if (! inf->skip) {\n    if (should_skip(inf, el, attr)) {\n      inf->skip = inf->depth;\n    }\n    else\n      start(inf, el, attr);     /* This does rest of start handling */\n  }\n\n  inf->depth++;\n}  /* End of rawstart */\n\nvoid XMLCALL\nrawend(void *data, const char *el) {\n  Parseinfo *inf = (Parseinfo *) data;\n\n  inf->depth--;\n\n  if (! inf->skip)\n    end(inf, el);              /* This does rest of end handling */\n\n  if (inf->skip == inf->depth)\n    inf->skip = 0;\n}  /* End rawend */\n</pre>\n\n<p>Notice in the above example the difference in how depth is\nmanipulated in the start and end handlers. The end tag handler should\nbe the mirror image of the start tag handler. This is necessary to\nproperly model containment. Since, in the start tag handler, we\nincremented depth <em>after</em> the main body of start tag code, then\nin the end handler, we need to manipulate it <em>before</em> the main\nbody.  If we'd decided to increment it first thing in the start\nhandler, then we'd have had to decrement it last thing in the end\nhandler.</p>\n\n<h3 id=\"userdata\">Communicating between handlers</h3>\n\n<p>In order to be able to pass information between different handlers\nwithout using globals, you'll need to define a data structure to hold\nthe shared variables. You can then tell Expat (with the <code><a href=\n\"#XML_SetUserData\" >XML_SetUserData</a></code> function) to pass a\npointer to this structure to the handlers.  This is the first\nargument received by most handlers.  In the <a href=\"#reference\"\n>reference section</a>, an argument to a callback function is named\n<code>userData</code> and have type <code>void *</code> if the user\ndata is passed; it will have the type <code>XML_Parser</code> if the\nparser itself is passed.  When the parser is passed, the user data may\nbe retrieved using <code><a href=\"#XML_GetUserData\"\n>XML_GetUserData</a></code>.</p>\n\n<p>One common case where multiple calls to a single handler may need\nto communicate using an application data structure is the case when\ncontent passed to the character data handler (set by <code><a href=\n\"#XML_SetCharacterDataHandler\"\n>XML_SetCharacterDataHandler</a></code>) needs to be accumulated.  A\ncommon first-time mistake with any of the event-oriented interfaces to\nan XML parser is to expect all the text contained in an element to be\nreported by a single call to the character data handler.  Expat, like\nmany other XML parsers, reports such data as a sequence of calls;\nthere's no way to know when the end of the sequence is reached until a\ndifferent callback is made.  A buffer referenced by the user data\nstructure proves both an effective and convenient place to accumulate\ncharacter data.</p>\n\n<!-- XXX example needed here -->\n\n\n<h3>XML Version</h3>\n\n<p>Expat is an XML 1.0 parser, and as such never complains based on\nthe value of the <code>version</code> pseudo-attribute in the XML\ndeclaration, if present.</p>\n\n<p>If an application needs to check the version number (to support\nalternate processing), it should use the <code><a href=\n\"#XML_SetXmlDeclHandler\" >XML_SetXmlDeclHandler</a></code> function to\nset a handler that uses the information in the XML declaration to\ndetermine what to do.  This example shows how to check that only a\nversion number of <code>\"1.0\"</code> is accepted:</p>\n\n<pre class=\"eg\">\nstatic int wrong_version;\nstatic XML_Parser parser;\n\nstatic void XMLCALL\nxmldecl_handler(void            *userData,\n                const XML_Char  *version,\n                const XML_Char  *encoding,\n                int              standalone)\n{\n  static const XML_Char Version_1_0[] = {'1', '.', '0', 0};\n\n  int i;\n\n  for (i = 0; i &lt; (sizeof(Version_1_0) / sizeof(Version_1_0[0])); ++i) {\n    if (version[i] != Version_1_0[i]) {\n      wrong_version = 1;\n      /* also clear all other handlers: */\n      XML_SetCharacterDataHandler(parser, NULL);\n      ...\n      return;\n    }\n  }\n  ...\n}\n</pre>\n\n<h3>Namespace Processing</h3>\n\n<p>When the parser is created using the <code><a href=\n\"#XML_ParserCreateNS\" >XML_ParserCreateNS</a></code>, function, Expat\nperforms namespace processing. Under namespace processing, Expat\nconsumes <code>xmlns</code> and <code>xmlns:...</code> attributes,\nwhich declare namespaces for the scope of the element in which they\noccur. This means that your start handler will not see these\nattributes.  Your application can still be informed of these\ndeclarations by setting namespace declaration handlers with <a href=\n\"#XML_SetNamespaceDeclHandler\"\n><code>XML_SetNamespaceDeclHandler</code></a>.</p>\n\n<p>Element type and attribute names that belong to a given namespace\nare passed to the appropriate handler in expanded form. By default\nthis expanded form is a concatenation of the namespace URI, the\nseparator character (which is the 2nd argument to <code><a href=\n\"#XML_ParserCreateNS\" >XML_ParserCreateNS</a></code>), and the local\nname (i.e. the part after the colon). Names with undeclared prefixes\nare not well-formed when namespace processing is enabled, and will\ntrigger an error. Unprefixed attribute names are never expanded,\nand unprefixed element names are only expanded when they are in the\nscope of a default namespace.</p>\n\n<p>However if <code><a href= \"#XML_SetReturnNSTriplet\"\n>XML_SetReturnNSTriplet</a></code> has been called with a non-zero\n<code>do_nst</code> parameter, then the expanded form for names with\nan explicit prefix is a concatenation of: URI, separator, local name,\nseparator, prefix.</p>\n\n<p>You can set handlers for the start of a namespace declaration and\nfor the end of a scope of a declaration with the <code><a href=\n\"#XML_SetNamespaceDeclHandler\" >XML_SetNamespaceDeclHandler</a></code>\nfunction.  The StartNamespaceDeclHandler is called prior to the start\ntag handler and the EndNamespaceDeclHandler is called after the\ncorresponding end tag that ends the namespace's scope.  The namespace\nstart handler gets passed the prefix and URI for the namespace.  For a\ndefault namespace declaration (xmlns='...'), the prefix will be null.\nThe URI will be null for the case where the default namespace is being\nunset.  The namespace end handler just gets the prefix for the closing\nscope.</p>\n\n<p>These handlers are called for each declaration. So if, for\ninstance, a start tag had three namespace declarations, then the\nStartNamespaceDeclHandler would be called three times before the start\ntag handler is called, once for each declaration.</p>\n\n<h3>Character Encodings</h3>\n\n<p>While XML is based on Unicode, and every XML processor is required\nto recognized UTF-8 and UTF-16 (1 and 2 byte encodings of Unicode),\nother encodings may be declared in XML documents or entities. For the\nmain document, an XML declaration may contain an encoding\ndeclaration:</p>\n<pre>\n&lt;?xml version=\"1.0\" encoding=\"ISO-8859-2\"?&gt;\n</pre>\n\n<p>External parsed entities may begin with a text declaration, which\nlooks like an XML declaration with just an encoding declaration:</p>\n<pre>\n&lt;?xml encoding=\"Big5\"?&gt;\n</pre>\n\n<p>With Expat, you may also specify an encoding at the time of\ncreating a parser. This is useful when the encoding information may\ncome from a source outside the document itself (like a higher level\nprotocol.)</p>\n\n<p><a name=\"builtin_encodings\"></a>There are four built-in encodings\nin Expat:</p>\n<ul>\n<li>UTF-8</li>\n<li>UTF-16</li>\n<li>ISO-8859-1</li>\n<li>US-ASCII</li>\n</ul>\n\n<p>Anything else discovered in an encoding declaration or in the\nprotocol encoding specified in the parser constructor, triggers a call\nto the <code>UnknownEncodingHandler</code>. This handler gets passed\nthe encoding name and a pointer to an <code>XML_Encoding</code> data\nstructure. Your handler must fill in this structure and return\n<code>XML_STATUS_OK</code> if it knows how to deal with the\nencoding. Otherwise the handler should return\n<code>XML_STATUS_ERROR</code>.  The handler also gets passed a pointer\nto an optional application data structure that you may indicate when\nyou set the handler.</p>\n\n<p>Expat places restrictions on character encodings that it can\nsupport by filling in the <code>XML_Encoding</code> structure.\ninclude file:</p>\n<ol>\n<li>Every ASCII character that can appear in a well-formed XML document\nmust be represented by a single byte, and that byte must correspond to\nit's ASCII encoding (except for the characters $@\\^'{}~)</li>\n<li>Characters must be encoded in 4 bytes or less.</li>\n<li>All characters encoded must have Unicode scalar values less than or\nequal to 65535 (0xFFFF)<em>This does not apply to the built-in support\nfor UTF-16 and UTF-8</em></li>\n<li>No character may be encoded by more that one distinct sequence of\nbytes</li>\n</ol>\n\n<p><code>XML_Encoding</code> contains an array of integers that\ncorrespond to the 1st byte of an encoding sequence. If the value in\nthe array for a byte is zero or positive, then the byte is a single\nbyte encoding that encodes the Unicode scalar value contained in the\narray. A -1 in this array indicates a malformed byte. If the value is\n-2, -3, or -4, then the byte is the beginning of a 2, 3, or 4 byte\nsequence respectively. Multi-byte sequences are sent to the convert\nfunction pointed at in the <code>XML_Encoding</code> structure. This\nfunction should return the Unicode scalar value for the sequence or -1\nif the sequence is malformed.</p>\n\n<p>One pitfall that novice Expat users are likely to fall into is that\nalthough Expat may accept input in various encodings, the strings that\nit passes to the handlers are always encoded in UTF-8 or UTF-16\n(depending on how Expat was compiled). Your application is responsible\nfor any translation of these strings into other encodings.</p>\n\n<h3>Handling External Entity References</h3>\n\n<p>Expat does not read or parse external entities directly. Note that\nany external DTD is a special case of an external entity.  If you've\nset no <code>ExternalEntityRefHandler</code>, then external entity\nreferences are silently ignored. Otherwise, it calls your handler with\nthe information needed to read and parse the external entity.</p>\n\n<p>Your handler isn't actually responsible for parsing the entity, but\nit is responsible for creating a subsidiary parser with <code><a href=\n\"#XML_ExternalEntityParserCreate\"\n>XML_ExternalEntityParserCreate</a></code> that will do the job. This\nreturns an instance of <code>XML_Parser</code> that has handlers and\nother data structures initialized from the parent parser. You may then\nuse <code><a href= \"#XML_Parse\" >XML_Parse</a></code> or <code><a\nhref= \"#XML_ParseBuffer\">XML_ParseBuffer</a></code> calls against this\nparser.  Since external entities my refer to other external entities,\nyour handler should be prepared to be called recursively.</p>\n\n<h3>Parsing DTDs</h3>\n\n<p>In order to parse parameter entities, before starting the parse,\nyou must call <code><a href= \"#XML_SetParamEntityParsing\"\n>XML_SetParamEntityParsing</a></code> with one of the following\narguments:</p>\n<dl>\n<dt><code>XML_PARAM_ENTITY_PARSING_NEVER</code></dt>\n<dd>Don't parse parameter entities or the external subset</dd>\n<dt><code>XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE</code></dt>\n<dd>Parse parameter entites and the external subset unless\n<code>standalone</code> was set to \"yes\" in the XML declaration.</dd>\n<dt><code>XML_PARAM_ENTITY_PARSING_ALWAYS</code></dt>\n<dd>Always parse parameter entities and the external subset</dd>\n</dl>\n\n<p>In order to read an external DTD, you also have to set an external\nentity reference handler as described above.</p>\n\n<h3 id=\"stop-resume\">Temporarily Stopping Parsing</h3>\n\n<p>Expat 1.95.8 introduces a new feature: its now possible to stop\nparsing temporarily from within a handler function, even if more data\nhas already been passed into the parser.  Applications for this\ninclude</p>\n\n<ul>\n  <li>Supporting the <a href= \"http://www.w3.org/TR/xinclude/\"\n  >XInclude</a> specification.</li>\n\n  <li>Delaying further processing until additional information is\n  available from some other source.</li>\n\n  <li>Adjusting processor load as task priorities shift within an\n  application.</li>\n\n  <li>Stopping parsing completely (simply free or reset the parser\n  instead of resuming in the outer parsing loop).  This can be useful\n  if a application-domain error is found in the XML being parsed or if\n  the result of the parse is determined not to be useful after\n  all.</li>\n</ul>\n\n<p>To take advantage of this feature, the main parsing loop of an\napplication needs to support this specifically.  It cannot be\nsupported with a parsing loop compatible with Expat 1.95.7 or\nearlier (though existing loops will continue to work without\nsupporting the stop/resume feature).</p>\n\n<p>An application that uses this feature for a single parser will have\nthe rough structure (in pseudo-code):</p>\n\n<pre class=\"pseudocode\">\nfd = open_input()\np = create_parser()\n\nif parse_xml(p, fd) {\n  /* suspended */\n\n  int suspended = 1;\n\n  while (suspended) {\n    do_something_else()\n    if ready_to_resume() {\n      suspended = continue_parsing(p, fd);\n    }\n  }\n}\n</pre>\n\n<p>An application that may resume any of several parsers based on\ninput (either from the XML being parsed or some other source) will\ncertainly have more interesting control structures.</p>\n\n<p>This C function could be used for the <code>parse_xml</code>\nfunction mentioned in the pseudo-code above:</p>\n\n<pre class=\"eg\">\n#define BUFF_SIZE 10240\n\n/* Parse a document from the open file descriptor 'fd' until the parse\n   is complete (the document has been completely parsed, or there's\n   been an error), or the parse is stopped.  Return non-zero when\n   the parse is merely suspended.\n*/\nint\nparse_xml(XML_Parser p, int fd)\n{\n  for (;;) {\n    int last_chunk;\n    int bytes_read;\n    enum XML_Status status;\n\n    void *buff = XML_GetBuffer(p, BUFF_SIZE);\n    if (buff == NULL) {\n      /* handle error... */\n      return 0;\n    }\n    bytes_read = read(fd, buff, BUFF_SIZE);\n    if (bytes_read &lt; 0) {\n      /* handle error... */\n      return 0;\n    }\n    status = XML_ParseBuffer(p, bytes_read, bytes_read == 0);\n    switch (status) {\n      case XML_STATUS_ERROR:\n        /* handle error... */\n        return 0;\n      case XML_STATUS_SUSPENDED:\n        return 1;\n    }\n    if (bytes_read == 0)\n      return 0;\n  }\n}\n</pre>\n\n<p>The corresponding <code>continue_parsing</code> function is\nsomewhat simpler, since it only need deal with the return code from\n<code><a href= \"#XML_ResumeParser\">XML_ResumeParser</a></code>; it can\ndelegate the input handling to the <code>parse_xml</code>\nfunction:</p>\n\n<pre class=\"eg\">\n/* Continue parsing a document which had been suspended.  The 'p' and\n   'fd' arguments are the same as passed to parse_xml().  Return\n   non-zero when the parse is suspended.\n*/\nint\ncontinue_parsing(XML_Parser p, int fd)\n{\n  enum XML_Status status = XML_ResumeParser(p);\n  switch (status) {\n    case XML_STATUS_ERROR:\n      /* handle error... */\n      return 0;\n    case XML_ERROR_NOT_SUSPENDED:\n      /* handle error... */\n      return 0;.\n    case XML_STATUS_SUSPENDED:\n      return 1;\n  }\n  return parse_xml(p, fd);\n}\n</pre>\n\n<p>Now that we've seen what a mess the top-level parsing loop can\nbecome, what have we gained?  Very simply, we can now use the <code><a\nhref= \"#XML_StopParser\" >XML_StopParser</a></code> function to stop\nparsing, without having to go to great lengths to avoid additional\nprocessing that we're expecting to ignore.  As a bonus, we get to stop\nparsing <em>temporarily</em>, and come back to it when we're\nready.</p>\n\n<p>To stop parsing from a handler function, use the <code><a href=\n\"#XML_StopParser\" >XML_StopParser</a></code> function.  This function\ntakes two arguments; the parser being stopped and a flag indicating\nwhether the parse can be resumed in the future.</p>\n\n<!-- XXX really need more here -->\n\n\n<hr />\n<!-- ================================================================ -->\n\n<h2><a name=\"reference\">Expat Reference</a></h2>\n\n<h3><a name=\"creation\">Parser Creation</a></h3>\n\n<pre class=\"fcndec\" id=\"XML_ParserCreate\">\nXML_Parser XMLCALL\nXML_ParserCreate(const XML_Char *encoding);\n</pre>\n<div class=\"fcndef\">\nConstruct a new parser. If encoding is non-null, it specifies a\ncharacter encoding to use for the document. This overrides the document\nencoding declaration. There are four built-in encodings:\n<ul>\n<li>US-ASCII</li>\n<li>UTF-8</li>\n<li>UTF-16</li>\n<li>ISO-8859-1</li>\n</ul>\nAny other value will invoke a call to the UnknownEncodingHandler.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ParserCreateNS\">\nXML_Parser XMLCALL\nXML_ParserCreateNS(const XML_Char *encoding,\n                   XML_Char sep);\n</pre>\n<div class=\"fcndef\">\nConstructs a new parser that has namespace processing in effect. Namespace\nexpanded element names and attribute names are returned as a concatenation\nof the namespace URI, <em>sep</em>, and the local part of the name. This\nmeans that you should pick a character for <em>sep</em> that can't be part\nof an URI. Since Expat does not check namespace URIs for conformance, the\nonly safe choice for a namespace separator is a character that is illegal\nin XML. For instance, <code>'\\xFF'</code> is not legal in UTF-8, and\n<code>'\\xFFFF'</code> is not legal in UTF-16. There is a special case when\n<em>sep</em> is the null character <code>'\\0'</code>: the namespace URI and\nthe local part will be concatenated without any separator - this is intended\nto support RDF processors. It is a programming error to use the null separator\nwith <a href= \"#XML_SetReturnNSTriplet\">namespace triplets</a>.</div>\n\n<pre class=\"fcndec\" id=\"XML_ParserCreate_MM\">\nXML_Parser XMLCALL\nXML_ParserCreate_MM(const XML_Char *encoding,\n                    const XML_Memory_Handling_Suite *ms,\n\t\t    const XML_Char *sep);\n</pre>\n<pre class=\"signature\">\ntypedef struct {\n  void *(XMLCALL *malloc_fcn)(size_t size);\n  void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);\n  void (XMLCALL *free_fcn)(void *ptr);\n} XML_Memory_Handling_Suite;\n</pre>\n<div class=\"fcndef\">\n<p>Construct a new parser using the suite of memory handling functions\nspecified in <code>ms</code>. If <code>ms</code> is NULL, then use the\nstandard set of memory management functions. If <code>sep</code> is\nnon NULL, then namespace processing is enabled in the created parser\nand the character pointed at by sep is used as the separator between\nthe namespace URI and the local part of the name.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ExternalEntityParserCreate\">\nXML_Parser XMLCALL\nXML_ExternalEntityParserCreate(XML_Parser p,\n                               const XML_Char *context,\n                               const XML_Char *encoding);\n</pre>\n<div class=\"fcndef\">\nConstruct a new <code>XML_Parser</code> object for parsing an external\ngeneral entity. Context is the context argument passed in a call to a\nExternalEntityRefHandler. Other state information such as handlers,\nuser data, namespace processing is inherited from the parser passed as\nthe 1st argument. So you shouldn't need to call any of the behavior\nchanging functions on this parser (unless you want it to act\ndifferently than the parent parser).\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ParserFree\">\nvoid XMLCALL\nXML_ParserFree(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nFree memory used by the parser. Your application is responsible for\nfreeing any memory associated with <a href=\"#userdata\">user data</a>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ParserReset\">\nXML_Bool XMLCALL\nXML_ParserReset(XML_Parser p,\n                const XML_Char *encoding);\n</pre>\n<div class=\"fcndef\">\nClean up the memory structures maintained by the parser so that it may\nbe used again.  After this has been called, <code>parser</code> is\nready to start parsing a new document.  All handlers are cleared from\nthe parser, except for the unknownEncodingHandler.  The parser's external\nstate is re-initialized except for the values of ns and ns_triplets.\nThis function may not be used on a parser created using <code><a href=\n\"#XML_ExternalEntityParserCreate\" >XML_ExternalEntityParserCreate</a\n></code>; it will return <code>XML_FALSE</code> in that case.  Returns\n<code>XML_TRUE</code> on success.  Your application is responsible for\ndealing with any memory associated with <a href=\"#userdata\">user data</a>.\n</div>\n\n<h3><a name=\"parsing\">Parsing</a></h3>\n\n<p>To state the obvious: the three parsing functions <code><a href=\n\"#XML_Parse\" >XML_Parse</a></code>, <code><a href= \"#XML_ParseBuffer\">\nXML_ParseBuffer</a></code> and <code><a href= \"#XML_GetBuffer\">\nXML_GetBuffer</a></code> must not be called from within a handler\nunless they operate on a separate parser instance, that is, one that\ndid not call the handler. For example, it is OK to call the parsing\nfunctions from within an <code>XML_ExternalEntityRefHandler</code>,\nif they apply to the parser created by\n<code><a href= \"#XML_ExternalEntityParserCreate\"\n>XML_ExternalEntityParserCreate</a></code>.</p>\n\n<p>Note: the <code>len</code> argument passed to these functions\nshould be considerably less than the maximum value for an integer,\nas it could create an integer overflow situation if the added\nlengths of a buffer and the unprocessed portion of the previous buffer\nexceed the maximum integer value. Input data at the end of a buffer\nwill remain unprocessed if it is part of an XML token for which the\nend is not part of that buffer.</p>\n\n<pre class=\"fcndec\" id=\"XML_Parse\">\nenum XML_Status XMLCALL\nXML_Parse(XML_Parser p,\n          const char *s,\n          int len,\n          int isFinal);\n</pre>\n<pre class=\"signature\">\nenum XML_Status {\n  XML_STATUS_ERROR = 0,\n  XML_STATUS_OK = 1\n};\n</pre>\n<div class=\"fcndef\">\nParse some more of the document. The string <code>s</code> is a buffer\ncontaining part (or perhaps all) of the document. The number of bytes of s\nthat are part of the document is indicated by <code>len</code>. This means\nthat <code>s</code> doesn't have to be null terminated. It also means that\nif <code>len</code> is larger than the number of bytes in the block of\nmemory that <code>s</code> points at, then a memory fault is likely. The\n<code>isFinal</code> parameter informs the parser that this is the last\npiece of the document. Frequently, the last piece is empty (i.e.\n<code>len</code> is zero.)\nIf a parse error occurred, it returns <code>XML_STATUS_ERROR</code>.\nOtherwise it returns <code>XML_STATUS_OK</code> value.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ParseBuffer\">\nenum XML_Status XMLCALL\nXML_ParseBuffer(XML_Parser p,\n                int len,\n                int isFinal);\n</pre>\n<div class=\"fcndef\">\nThis is just like <code><a href= \"#XML_Parse\" >XML_Parse</a></code>,\nexcept in this case Expat provides the buffer.  By obtaining the\nbuffer from Expat with the <code><a href= \"#XML_GetBuffer\"\n>XML_GetBuffer</a></code> function, the application can avoid double\ncopying of the input.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetBuffer\">\nvoid * XMLCALL\nXML_GetBuffer(XML_Parser p,\n              int len);\n</pre>\n<div class=\"fcndef\">\nObtain a buffer of size <code>len</code> to read a piece of the document\ninto. A NULL value is returned if Expat can't allocate enough memory for\nthis buffer. This has to be called prior to every call to\n<code><a href= \"#XML_ParseBuffer\" >XML_ParseBuffer</a></code>. A\ntypical use would look like this:\n\n<pre class=\"eg\">\nfor (;;) {\n  int bytes_read;\n  void *buff = XML_GetBuffer(p, BUFF_SIZE);\n  if (buff == NULL) {\n    /* handle error */\n  }\n\n  bytes_read = read(docfd, buff, BUFF_SIZE);\n  if (bytes_read &lt; 0) {\n    /* handle error */\n  }\n\n  if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) {\n    /* handle parse error */\n  }\n\n  if (bytes_read == 0)\n    break;\n}\n</pre>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_StopParser\">\nenum XML_Status XMLCALL\nXML_StopParser(XML_Parser p,\n               XML_Bool resumable);\n</pre>\n<div class=\"fcndef\">\n\n<p>Stops parsing, causing <code><a href= \"#XML_Parse\"\n>XML_Parse</a></code> or <code><a href= \"#XML_ParseBuffer\"\n>XML_ParseBuffer</a></code> to return.  Must be called from within a\ncall-back handler, except when aborting (when <code>resumable</code>\nis <code>XML_FALSE</code>) an already suspended parser.  Some\ncall-backs may still follow because they would otherwise get\nlost, including\n<ul>\n  <li> the end element handler for empty elements when stopped in the\n       start element handler,</li>\n  <li> the end namespace declaration handler when stopped in the end\n       element handler,</li>\n  <li> the character data handler when stopped in the character data handler\n       while making multiple call-backs on a contiguous chunk of characters,</li>\n</ul>\nand possibly others.</p>\n\n<p>This can be called from most handlers, including DTD related\ncall-backs, except when parsing an external parameter entity and\n<code>resumable</code> is <code>XML_TRUE</code>.  Returns\n<code>XML_STATUS_OK</code> when successful,\n<code>XML_STATUS_ERROR</code> otherwise.  The possible error codes\nare:</p>\n<dl>\n  <dt><code>XML_ERROR_SUSPENDED</code></dt>\n  <dd>when suspending an already suspended parser.</dd>\n  <dt><code>XML_ERROR_FINISHED</code></dt>\n  <dd>when the parser has already finished.</dd>\n  <dt><code>XML_ERROR_SUSPEND_PE</code></dt>\n  <dd>when suspending while parsing an external PE.</dd>\n</dl>\n\n<p>Since the stop/resume feature requires application support in the\nouter parsing loop, it is an error to call this function for a parser\nnot being handled appropriately; see <a href= \"#stop-resume\"\n>Temporarily Stopping Parsing</a> for more information.</p>\n\n<p>When <code>resumable</code> is <code>XML_TRUE</code> then parsing\nis <em>suspended</em>, that is, <code><a href= \"#XML_Parse\"\n>XML_Parse</a></code> and <code><a href= \"#XML_ParseBuffer\"\n>XML_ParseBuffer</a></code> return <code>XML_STATUS_SUSPENDED</code>.\nOtherwise, parsing is <em>aborted</em>, that is, <code><a href=\n\"#XML_Parse\" >XML_Parse</a></code> and <code><a href=\n\"#XML_ParseBuffer\" >XML_ParseBuffer</a></code> return\n<code>XML_STATUS_ERROR</code> with error code\n<code>XML_ERROR_ABORTED</code>.</p>\n\n<p><strong>Note:</strong>\nThis will be applied to the current parser instance only, that is, if\nthere is a parent parser then it will continue parsing when the\nexternal entity reference handler returns.  It is up to the\nimplementation of that handler to call <code><a href=\n\"#XML_StopParser\" >XML_StopParser</a></code> on the parent parser\n(recursively), if one wants to stop parsing altogether.</p>\n\n<p>When suspended, parsing can be resumed by calling <code><a href=\n\"#XML_ResumeParser\" >XML_ResumeParser</a></code>.</p>\n\n<p>New in Expat 1.95.8.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ResumeParser\">\nenum XML_Status XMLCALL\nXML_ResumeParser(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\n<p>Resumes parsing after it has been suspended with <code><a href=\n\"#XML_StopParser\" >XML_StopParser</a></code>.  Must not be called from\nwithin a handler call-back.  Returns same status codes as <code><a\nhref= \"#XML_Parse\">XML_Parse</a></code> or <code><a href=\n\"#XML_ParseBuffer\" >XML_ParseBuffer</a></code>.  An additional error\ncode, <code>XML_ERROR_NOT_SUSPENDED</code>, will be returned if the\nparser was not currently suspended.</p>\n\n<p><strong>Note:</strong>\nThis must be called on the most deeply nested child parser instance\nfirst, and on its parent parser only after the child parser has\nfinished, to be applied recursively until the document entity's parser\nis restarted.  That is, the parent parser will not resume by itself\nand it is up to the application to call <code><a href=\n\"#XML_ResumeParser\" >XML_ResumeParser</a></code> on it at the\nappropriate moment.</p>\n\n<p>New in Expat 1.95.8.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetParsingStatus\">\nvoid XMLCALL\nXML_GetParsingStatus(XML_Parser p,\n                     XML_ParsingStatus *status);\n</pre>\n<pre class=\"signature\">\nenum XML_Parsing {\n  XML_INITIALIZED,\n  XML_PARSING,\n  XML_FINISHED,\n  XML_SUSPENDED\n};\n\ntypedef struct {\n  enum XML_Parsing parsing;\n  XML_Bool finalBuffer;\n} XML_ParsingStatus;\n</pre>\n<div class=\"fcndef\">\n<p>Returns status of parser with respect to being initialized,\nparsing, finished, or suspended, and whether the final buffer is being\nprocessed.  The <code>status</code> parameter <em>must not</em> be\nNULL.</p>\n\n<p>New in Expat 1.95.8.</p>\n</div>\n\n\n<h3><a name=\"setting\">Handler Setting</a></h3>\n\n<p>Although handlers are typically set prior to parsing and left alone, an\napplication may choose to set or change the handler for a parsing event\nwhile the parse is in progress. For instance, your application may choose\nto ignore all text not descended from a <code>para</code> element. One\nway it could do this is to set the character handler when a para start tag\nis seen, and unset it for the corresponding end tag.</p>\n\n<p>A handler may be <em>unset</em> by providing a NULL pointer to the\nappropriate handler setter. None of the handler setting functions have\na return value.</p>\n\n<p>Your handlers will be receiving strings in arrays of type\n<code>XML_Char</code>. This type is conditionally defined in expat.h as\neither <code>char</code>, <code>wchar_t</code> or <code>unsigned short</code>.\nThe former implies UTF-8 encoding, the latter two imply UTF-16 encoding.\nNote that you'll receive them in this form independent of the original\nencoding of the document.</p>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetStartElementHandler\">\nvoid XMLCALL\nXML_SetStartElementHandler(XML_Parser p,\n                           XML_StartElementHandler start);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_StartElementHandler)(void *userData,\n                                   const XML_Char *name,\n                                   const XML_Char **atts);\n</pre>\n<p>Set handler for start (and empty) tags. Attributes are passed to the start\nhandler as a pointer to a vector of char pointers. Each attribute seen in\na start (or empty) tag occupies 2 consecutive places in this vector: the\nattribute name followed by the attribute value. These pairs are terminated\nby a null pointer.</p>\n<p>Note that an empty tag generates a call to both start and end handlers\n(in that order).</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetEndElementHandler\">\nvoid XMLCALL\nXML_SetEndElementHandler(XML_Parser p,\n                         XML_EndElementHandler);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_EndElementHandler)(void *userData,\n                                 const XML_Char *name);\n</pre>\n<p>Set handler for end (and empty) tags. As noted above, an empty tag\ngenerates a call to both start and end handlers.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetElementHandler\">\nvoid XMLCALL\nXML_SetElementHandler(XML_Parser p,\n                      XML_StartElementHandler start,\n                      XML_EndElementHandler end);\n</pre>\n<p>Set handlers for start and end tags with one call.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetCharacterDataHandler\">\nvoid XMLCALL\nXML_SetCharacterDataHandler(XML_Parser p,\n                            XML_CharacterDataHandler charhndl)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_CharacterDataHandler)(void *userData,\n                                    const XML_Char *s,\n                                    int len);\n</pre>\n<p>Set a text handler. The string your handler receives\nis <em>NOT nul-terminated</em>. You have to use the length argument\nto deal with the end of the string. A single block of contiguous text\nfree of markup may still result in a sequence of calls to this handler.\nIn other words, if you're searching for a pattern in the text, it may\nbe split across calls to this handler. Note: Setting this handler to NULL\nmay <em>NOT immediately</em> terminate call-backs if the parser is currently\nprocessing such a single block of contiguous markup-free text, as the parser\nwill continue calling back until the end of the block is reached.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetProcessingInstructionHandler\">\nvoid XMLCALL\nXML_SetProcessingInstructionHandler(XML_Parser p,\n                                    XML_ProcessingInstructionHandler proc)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,\n                                            const XML_Char *target,\n                                            const XML_Char *data);\n\n</pre>\n<p>Set a handler for processing instructions. The target is the first word\nin the processing instruction. The data is the rest of the characters in\nit after skipping all whitespace after the initial word.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetCommentHandler\">\nvoid XMLCALL\nXML_SetCommentHandler(XML_Parser p,\n                      XML_CommentHandler cmnt)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_CommentHandler)(void *userData,\n                              const XML_Char *data);\n</pre>\n<p>Set a handler for comments. The data is all text inside the comment\ndelimiters.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetStartCdataSectionHandler\">\nvoid XMLCALL\nXML_SetStartCdataSectionHandler(XML_Parser p,\n                                XML_StartCdataSectionHandler start);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_StartCdataSectionHandler)(void *userData);\n</pre>\n<p>Set a handler that gets called at the beginning of a CDATA section.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetEndCdataSectionHandler\">\nvoid XMLCALL\nXML_SetEndCdataSectionHandler(XML_Parser p,\n                              XML_EndCdataSectionHandler end);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_EndCdataSectionHandler)(void *userData);\n</pre>\n<p>Set a handler that gets called at the end of a CDATA section.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetCdataSectionHandler\">\nvoid XMLCALL\nXML_SetCdataSectionHandler(XML_Parser p,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end)\n</pre>\n<p>Sets both CDATA section handlers with one call.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetDefaultHandler\">\nvoid XMLCALL\nXML_SetDefaultHandler(XML_Parser p,\n                      XML_DefaultHandler hndl)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_DefaultHandler)(void *userData,\n                              const XML_Char *s,\n                              int len);\n</pre>\n\n<p>Sets a handler for any characters in the document which wouldn't\notherwise be handled. This includes both data for which no handlers\ncan be set (like some kinds of DTD declarations) and data which could\nbe reported but which currently has no handler set.  The characters\nare passed exactly as they were present in the XML document except\nthat they will be encoded in UTF-8 or UTF-16. Line boundaries are not\nnormalized. Note that a byte order mark character is not passed to the\ndefault handler. There are no guarantees about how characters are\ndivided between calls to the default handler: for example, a comment\nmight be split between multiple calls.  Setting the handler with\nthis call has the side effect of turning off expansion of references\nto internally defined general entities. Instead these references are\npassed to the default handler.</p>\n\n<p>See also <code><a\nhref=\"#XML_DefaultCurrent\">XML_DefaultCurrent</a></code>.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetDefaultHandlerExpand\">\nvoid XMLCALL\nXML_SetDefaultHandlerExpand(XML_Parser p,\n                            XML_DefaultHandler hndl)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_DefaultHandler)(void *userData,\n                              const XML_Char *s,\n                              int len);\n</pre>\n<p>This sets a default handler, but doesn't inhibit the expansion of\ninternal entity references.  The entity reference will not be passed\nto the default handler.</p>\n\n<p>See also <code><a\nhref=\"#XML_DefaultCurrent\">XML_DefaultCurrent</a></code>.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetExternalEntityRefHandler\">\nvoid XMLCALL\nXML_SetExternalEntityRefHandler(XML_Parser p,\n                                XML_ExternalEntityRefHandler hndl)\n</pre>\n<pre class=\"signature\">\ntypedef int\n(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser p,\n                                        const XML_Char *context,\n                                        const XML_Char *base,\n                                        const XML_Char *systemId,\n                                        const XML_Char *publicId);\n</pre>\n<p>Set an external entity reference handler. This handler is also\ncalled for processing an external DTD subset if parameter entity parsing\nis in effect. (See <a href=\"#XML_SetParamEntityParsing\">\n<code>XML_SetParamEntityParsing</code></a>.)</p>\n\n<p>The <code>context</code> parameter specifies the parsing context in\nthe format expected by the <code>context</code> argument to <code><a\nhref=\"#XML_ExternalEntityParserCreate\"\n>XML_ExternalEntityParserCreate</a></code>.  <code>code</code> is\nvalid only until the handler returns, so if the referenced entity is\nto be parsed later, it must be copied.  <code>context</code> is NULL\nonly when the entity is a parameter entity, which is how one can\ndifferentiate between general and parameter entities.</p>\n\n<p>The <code>base</code> parameter is the base to use for relative\nsystem identifiers.  It is set by <code><a\nhref=\"#XML_SetBase\">XML_SetBase</a></code> and may be NULL. The\n<code>publicId</code> parameter is the public id given in the entity\ndeclaration and may be NULL.  <code>systemId</code> is the system\nidentifier specified in the entity declaration and is never NULL.</p>\n\n<p>There are a couple of ways in which this handler differs from\nothers.  First, this handler returns a status indicator (an\ninteger). <code>XML_STATUS_OK</code> should be returned for successful\nhandling of the external entity reference.  Returning\n<code>XML_STATUS_ERROR</code> indicates failure, and causes the\ncalling parser to return an\n<code>XML_ERROR_EXTERNAL_ENTITY_HANDLING</code> error.</p>\n\n<p>Second, instead of having the user data as its first argument, it\nreceives the parser that encountered the entity reference. This, along\nwith the context parameter, may be used as arguments to a call to\n<code><a href= \"#XML_ExternalEntityParserCreate\"\n>XML_ExternalEntityParserCreate</a></code>.  Using the returned\nparser, the body of the external entity can be recursively parsed.</p>\n\n<p>Since this handler may be called recursively, it should not be saving\ninformation into global or static variables.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetExternalEntityRefHandlerArg\">\nvoid XMLCALL\nXML_SetExternalEntityRefHandlerArg(XML_Parser p,\n                                   void *arg)\n</pre>\n<div class=\"fcndef\">\n<p>Set the argument passed to the ExternalEntityRefHandler.  If\n<code>arg</code> is not NULL, it is the new value passed to the\nhandler set using <code><a href=\"#XML_SetExternalEntityRefHandler\"\n>XML_SetExternalEntityRefHandler</a></code>; if <code>arg</code> is\nNULL, the argument passed to the handler function will be the parser\nobject itself.</p>\n\n<p><strong>Note:</strong>\nThe type of <code>arg</code> and the type of the first argument to the\nExternalEntityRefHandler do not match.  This function takes a\n<code>void *</code> to be passed to the handler, while the handler\naccepts an <code>XML_Parser</code>.  This is a historical accident,\nbut will not be corrected before Expat 2.0 (at the earliest) to avoid\ncausing compiler warnings for code that's known to work with this\nAPI.  It is the responsibility of the application code to know the\nactual type of the argument passed to the handler and to manage it\nproperly.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetSkippedEntityHandler\">\nvoid XMLCALL\nXML_SetSkippedEntityHandler(XML_Parser p,\n                            XML_SkippedEntityHandler handler)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_SkippedEntityHandler)(void *userData,\n                                    const XML_Char *entityName,\n                                    int is_parameter_entity);\n</pre>\n<p>Set a skipped entity handler. This is called in two situations:</p>\n<ol>\n   <li>An entity reference is encountered for which no declaration\n       has been read <em>and</em> this is not an error.</li>\n   <li>An internal entity reference is read, but not expanded, because\n       <a href=\"#XML_SetDefaultHandler\"><code>XML_SetDefaultHandler</code></a>\n\t   has been called.</li>\n</ol>\n<p>The <code>is_parameter_entity</code> argument will be non-zero for\na parameter entity and zero for a general entity.</p> <p>Note: skipped\nparameter entities in declarations and skipped general entities in\nattribute values cannot be reported, because the event would be out of\nsync with the reporting of the declarations or attribute values</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetUnknownEncodingHandler\">\nvoid XMLCALL\nXML_SetUnknownEncodingHandler(XML_Parser p,\n                              XML_UnknownEncodingHandler enchandler,\n\t\t\t      void *encodingHandlerData)\n</pre>\n<pre class=\"signature\">\ntypedef int\n(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,\n                                      const XML_Char *name,\n                                      XML_Encoding *info);\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</pre>\n<p>Set a handler to deal with encodings other than the <a\nhref=\"#builtin_encodings\">built in set</a>. This should be done before\n<code><a href= \"#XML_Parse\" >XML_Parse</a></code> or <code><a href=\n\"#XML_ParseBuffer\" >XML_ParseBuffer</a></code> have been called on the\ngiven parser.</p> <p>If the handler knows how to deal with an encoding\nwith the given name, it should fill in the <code>info</code> data\nstructure and return <code>XML_STATUS_OK</code>. Otherwise it\nshould return <code>XML_STATUS_ERROR</code>. The handler will be called\nat most once per parsed (external) entity. The optional application\ndata pointer <code>encodingHandlerData</code> will be passed back to\nthe handler.</p>\n\n<p>The map array contains information for every possible possible leading\nbyte in a byte sequence. If the corresponding value is &gt;= 0, then it's\na single byte sequence and the byte encodes that Unicode value. If the\nvalue is -1, then that byte is invalid as the initial byte in a sequence.\nIf the value is -n, where n is an integer &gt; 1, then n is the number of\nbytes in the sequence and the actual conversion is accomplished by a\ncall to the function pointed at by convert. This function may return -1\nif the sequence itself is invalid. The convert pointer may be null if\nthere are only single byte codes. The data parameter passed to the convert\nfunction is the data pointer from <code>XML_Encoding</code>. The\nstring s is <em>NOT</em> nul-terminated and points at the sequence of\nbytes to be converted.</p>\n\n<p>The function pointed at by <code>release</code> is called by the\nparser when it is finished with the encoding. It may be NULL.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetStartNamespaceDeclHandler\">\nvoid XMLCALL\nXML_SetStartNamespaceDeclHandler(XML_Parser p,\n\t\t\t         XML_StartNamespaceDeclHandler start);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,\n                                         const XML_Char *prefix,\n                                         const XML_Char *uri);\n</pre>\n<p>Set a handler to be called when a namespace is declared. Namespace\ndeclarations occur inside start tags. But the namespace declaration start\nhandler is called before the start tag handler for each namespace declared\nin that start tag.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetEndNamespaceDeclHandler\">\nvoid XMLCALL\nXML_SetEndNamespaceDeclHandler(XML_Parser p,\n\t\t\t       XML_EndNamespaceDeclHandler end);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,\n                                       const XML_Char *prefix);\n</pre>\n<p>Set a handler to be called when leaving the scope of a namespace\ndeclaration. This will be called, for each namespace declaration,\nafter the handler for the end tag of the element in which the\nnamespace was declared.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetNamespaceDeclHandler\">\nvoid XMLCALL\nXML_SetNamespaceDeclHandler(XML_Parser p,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end)\n</pre>\n<p>Sets both namespace declaration handlers with a single call.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetXmlDeclHandler\">\nvoid XMLCALL\nXML_SetXmlDeclHandler(XML_Parser p,\n\t\t      XML_XmlDeclHandler xmldecl);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_XmlDeclHandler)(void            *userData,\n                              const XML_Char  *version,\n                              const XML_Char  *encoding,\n                              int             standalone);\n</pre>\n<p>Sets a handler that is called for XML declarations and also for\ntext declarations discovered in external entities. The way to\ndistinguish is that the <code>version</code> parameter will be NULL\nfor text declarations. The <code>encoding</code> parameter may be NULL\nfor an XML declaration. The <code>standalone</code> argument will\ncontain -1, 0, or 1 indicating respectively that there was no\nstandalone parameter in the declaration, that it was given as no, or\nthat it was given as yes.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetStartDoctypeDeclHandler\">\nvoid XMLCALL\nXML_SetStartDoctypeDeclHandler(XML_Parser p,\n\t\t\t       XML_StartDoctypeDeclHandler start);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(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</pre>\n<p>Set a handler that is called at the start of a DOCTYPE declaration,\nbefore any external or internal subset is parsed. Both <code>sysid</code>\nand <code>pubid</code> may be NULL. The <code>has_internal_subset</code>\nwill be non-zero if the DOCTYPE declaration has an internal subset.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetEndDoctypeDeclHandler\">\nvoid XMLCALL\nXML_SetEndDoctypeDeclHandler(XML_Parser p,\n\t\t\t     XML_EndDoctypeDeclHandler end);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);\n</pre>\n<p>Set a handler that is called at the end of a DOCTYPE declaration,\nafter parsing any external subset.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetDoctypeDeclHandler\">\nvoid XMLCALL\nXML_SetDoctypeDeclHandler(XML_Parser p,\n\t\t\t  XML_StartDoctypeDeclHandler start,\n\t\t\t  XML_EndDoctypeDeclHandler end);\n</pre>\n<p>Set both doctype handlers with one call.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetElementDeclHandler\">\nvoid XMLCALL\nXML_SetElementDeclHandler(XML_Parser p,\n\t\t\t  XML_ElementDeclHandler eldecl);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_ElementDeclHandler)(void *userData,\n                                  const XML_Char *name,\n                                  XML_Content *model);\n</pre>\n<pre class=\"signature\">\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\ntypedef struct XML_cp XML_Content;\n\nstruct XML_cp {\n  enum XML_Content_Type\t\ttype;\n  enum XML_Content_Quant\tquant;\n  const XML_Char *\t\tname;\n  unsigned int\t\t\tnumchildren;\n  XML_Content *\t\t\tchildren;\n};\n</pre>\n<p>Sets a handler for element declarations in a DTD. The handler gets\ncalled with the name of the element in the declaration and a pointer\nto a structure that contains the element model. It is the\napplication's responsibility to free this data structure using\n<code><a href=\"#XML_FreeContentModel\"\n>XML_FreeContentModel</a></code>.</p>\n\n<p>The <code>model</code> argument is the root of a tree of\n<code>XML_Content</code> nodes. If <code>type</code> equals\n<code>XML_CTYPE_EMPTY</code> or <code>XML_CTYPE_ANY</code>, then\n<code>quant</code> will be <code>XML_CQUANT_NONE</code>, and the other\nfields will be zero or NULL.  If <code>type</code> is\n<code>XML_CTYPE_MIXED</code>, then <code>quant</code> will be\n<code>XML_CQUANT_NONE</code> or <code>XML_CQUANT_REP</code> and\n<code>numchildren</code> will contain the number of elements that are\nallowed to be mixed in and <code>children</code> points to an array of\n<code>XML_Content</code> structures that will all have type\nXML_CTYPE_NAME with no quantification.  Only the root node can be type\n<code>XML_CTYPE_EMPTY</code>, <code>XML_CTYPE_ANY</code>, or\n<code>XML_CTYPE_MIXED</code>.</p>\n\n<p>For type <code>XML_CTYPE_NAME</code>, the <code>name</code> field\npoints to the name and the <code>numchildren</code> and\n<code>children</code> fields will be zero and NULL. The\n<code>quant</code> field will indicate any quantifiers placed on the\nname.</p>\n\n<p>Types <code>XML_CTYPE_CHOICE</code> and <code>XML_CTYPE_SEQ</code>\nindicate a choice or sequence respectively. The\n<code>numchildren</code> field indicates how many nodes in the choice\nor sequence and <code>children</code> points to the nodes.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetAttlistDeclHandler\">\nvoid XMLCALL\nXML_SetAttlistDeclHandler(XML_Parser p,\n                          XML_AttlistDeclHandler attdecl);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_AttlistDeclHandler)(void           *userData,\n                                  const XML_Char *elname,\n                                  const XML_Char *attname,\n                                  const XML_Char *att_type,\n                                  const XML_Char *dflt,\n                                  int            isrequired);\n</pre>\n<p>Set a handler for attlist declarations in the DTD. This handler is\ncalled for <em>each</em> attribute. So a single attlist declaration\nwith multiple attributes declared will generate multiple calls to this\nhandler. The <code>elname</code> parameter returns the name of the\nelement for which the attribute is being declared. The attribute name\nis in the <code>attname</code> parameter. The attribute type is in the\n<code>att_type</code> parameter.  It is the string representing the\ntype in the declaration with whitespace removed.</p>\n\n<p>The <code>dflt</code> parameter holds the default value. It will be\nNULL in the case of \"#IMPLIED\" or \"#REQUIRED\" attributes. You can\ndistinguish these two cases by checking the <code>isrequired</code>\nparameter, which will be true in the case of \"#REQUIRED\" attributes.\nAttributes which are \"#FIXED\" will have also have a true\n<code>isrequired</code>, but they will have the non-NULL fixed value\nin the <code>dflt</code> parameter.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetEntityDeclHandler\">\nvoid XMLCALL\nXML_SetEntityDeclHandler(XML_Parser p,\n\t\t\t XML_EntityDeclHandler handler);\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_EntityDeclHandler)(void           *userData,\n                                 const XML_Char *entityName,\n                                 int            is_parameter_entity,\n                                 const XML_Char *value,\n                                 int            value_length, \n                                 const XML_Char *base,\n                                 const XML_Char *systemId,\n                                 const XML_Char *publicId,\n                                 const XML_Char *notationName);\n</pre>\n<p>Sets a handler that will be called for all entity declarations.\nThe <code>is_parameter_entity</code> argument will be non-zero in the\ncase of parameter entities and zero otherwise.</p>\n\n<p>For internal entities (<code>&lt;!ENTITY foo \"bar\"&gt;</code>),\n<code>value</code> will be non-NULL and <code>systemId</code>,\n<code>publicId</code>, and <code>notationName</code> will all be NULL.\nThe value string is <em>not</em> NULL terminated; the length is\nprovided in the <code>value_length</code> parameter. Do not use\n<code>value_length</code> to test for internal entities, since it is\nlegal to have zero-length values. Instead check for whether or not\n<code>value</code> is NULL.</p> <p>The <code>notationName</code>\nargument will have a non-NULL value only for unparsed entity\ndeclarations.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetUnparsedEntityDeclHandler\">\nvoid XMLCALL\nXML_SetUnparsedEntityDeclHandler(XML_Parser p,\n                                 XML_UnparsedEntityDeclHandler h)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(XMLCALL *XML_UnparsedEntityDeclHandler)(void *userData,\n                                         const XML_Char *entityName, \n                                         const XML_Char *base,\n                                         const XML_Char *systemId,\n                                         const XML_Char *publicId,\n                                         const XML_Char *notationName);\n</pre>\n<p>Set a handler that receives declarations of unparsed entities. These\nare entity declarations that have a notation (NDATA) field:</p>\n\n<div id=\"eg\"><pre>\n&lt;!ENTITY logo SYSTEM \"images/logo.gif\" NDATA gif&gt;\n</pre></div>\n<p>This handler is obsolete and is provided for backwards\ncompatibility.  Use instead <a href= \"#XML_SetEntityDeclHandler\"\n>XML_SetEntityDeclHandler</a>.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetNotationDeclHandler\">\nvoid XMLCALL\nXML_SetNotationDeclHandler(XML_Parser p,\n                           XML_NotationDeclHandler h)\n</pre>\n<pre class=\"signature\">\ntypedef void\n(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</pre>\n<p>Set a handler that receives notation declarations.</p>\n</div>\n\n<div class=\"handler\">\n<pre class=\"setter\" id=\"XML_SetNotStandaloneHandler\">\nvoid XMLCALL\nXML_SetNotStandaloneHandler(XML_Parser p,\n                            XML_NotStandaloneHandler h)\n</pre>\n<pre class=\"signature\">\ntypedef int \n(XMLCALL *XML_NotStandaloneHandler)(void *userData);\n</pre>\n<p>Set a handler that is called if the document is not \"standalone\".\nThis happens when there is an external subset or a reference to a\nparameter entity, but does not have standalone set to \"yes\" in an XML\ndeclaration.  If this handler returns <code>XML_STATUS_ERROR</code>,\nthen the parser will throw an <code>XML_ERROR_NOT_STANDALONE</code>\nerror.</p>\n</div>\n\n<h3><a name=\"position\">Parse position and error reporting functions</a></h3>\n\n<p>These are the functions you'll want to call when the parse\nfunctions return <code>XML_STATUS_ERROR</code> (a parse error has\noccurred), although the position reporting functions are useful outside\nof errors. The position reported is the byte position (in the original\ndocument or entity encoding) of the first of the sequence of\ncharacters that generated the current event (or the error that caused\nthe parse functions to return <code>XML_STATUS_ERROR</code>.)  The\nexceptions are callbacks trigged by declarations in the document\nprologue, in which case they exact position reported is somewhere in the\nrelevant markup, but not necessarily as meaningful as for other\nevents.</p>\n\n<p>The position reporting functions are accurate only outside of the\nDTD.  In other words, they usually return bogus information when\ncalled from within a DTD declaration handler.</p>\n\n<pre class=\"fcndec\" id=\"XML_GetErrorCode\">\nenum XML_Error XMLCALL\nXML_GetErrorCode(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn what type of error has occurred.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ErrorString\">\nconst XML_LChar * XMLCALL\nXML_ErrorString(enum XML_Error code);\n</pre>\n<div class=\"fcndef\">\nReturn a string describing the error corresponding to code.\nThe code should be one of the enums that can be returned from\n<code><a href= \"#XML_GetErrorCode\" >XML_GetErrorCode</a></code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetCurrentByteIndex\">\nXML_Index XMLCALL\nXML_GetCurrentByteIndex(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn the byte offset of the position.  This always corresponds to\nthe values returned by <code><a href= \"#XML_GetCurrentLineNumber\"\n>XML_GetCurrentLineNumber</a></code> and <code><a href=\n\"#XML_GetCurrentColumnNumber\" >XML_GetCurrentColumnNumber</a></code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetCurrentLineNumber\">\nXML_Size XMLCALL\nXML_GetCurrentLineNumber(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn the line number of the position.  The first line is reported as\n<code>1</code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetCurrentColumnNumber\">\nXML_Size XMLCALL\nXML_GetCurrentColumnNumber(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn the offset, from the beginning of the current line, of\nthe position.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetCurrentByteCount\">\nint XMLCALL\nXML_GetCurrentByteCount(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn the number of bytes in the current event. Returns\n<code>0</code> if the event is inside a reference to an internal\nentity and for the end-tag event for empty element tags (the later can\nbe used to distinguish empty-element tags from empty elements using\nseparate start and end tags).\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetInputContext\">\nconst char * XMLCALL\nXML_GetInputContext(XML_Parser p,\n                    int *offset,\n                    int *size);\n</pre>\n<div class=\"fcndef\">\n\n<p>Returns the parser's input buffer, sets the integer pointed at by\n<code>offset</code> to the offset within this buffer of the current\nparse position, and set the integer pointed at by <code>size</code> to\nthe size of the returned buffer.</p>\n\n<p>This should only be called from within a handler during an active\nparse and the returned buffer should only be referred to from within\nthe handler that made the call. This input buffer contains the\nuntranslated bytes of the input.</p>\n\n<p>Only a limited amount of context is kept, so if the event\ntriggering a call spans over a very large amount of input, the actual\nparse position may be before the beginning of the buffer.</p>\n\n<p>If <code>XML_CONTEXT_BYTES</code> is not defined, this will always\nreturn NULL.</p>\n</div>\n\n<h3><a name=\"miscellaneous\">Miscellaneous functions</a></h3>\n\n<p>The functions in this section either obtain state information from\nthe parser or can be used to dynamicly set parser options.</p>\n\n<pre class=\"fcndec\" id=\"XML_SetUserData\">\nvoid XMLCALL\nXML_SetUserData(XML_Parser p,\n                void *userData);\n</pre>\n<div class=\"fcndef\">\nThis sets the user data pointer that gets passed to handlers.  It\noverwrites any previous value for this pointer. Note that the\napplication is responsible for freeing the memory associated with\n<code>userData</code> when it is finished with the parser. So if you\ncall this when there's already a pointer there, and you haven't freed\nthe memory associated with it, then you've probably just leaked\nmemory.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetUserData\">\nvoid * XMLCALL\nXML_GetUserData(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nThis returns the user data pointer that gets passed to handlers.\nIt is actually implemented as a macro.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_UseParserAsHandlerArg\">\nvoid XMLCALL\nXML_UseParserAsHandlerArg(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nAfter this is called, handlers receive the parser in their\n<code>userData</code> arguments.  The user data can still be obtained\nusing the <code><a href= \"#XML_GetUserData\"\n>XML_GetUserData</a></code> function.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetBase\">\nenum XML_Status XMLCALL\nXML_SetBase(XML_Parser p,\n            const XML_Char *base);\n</pre>\n<div class=\"fcndef\">\nSet the base to be used for resolving relative URIs in system\nidentifiers.  The return value is <code>XML_STATUS_ERROR</code> if\nthere's no memory to store base, otherwise it's\n<code>XML_STATUS_OK</code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetBase\">\nconst XML_Char * XMLCALL\nXML_GetBase(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturn the base for resolving relative URIs.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetSpecifiedAttributeCount\">\nint XMLCALL\nXML_GetSpecifiedAttributeCount(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nWhen attributes are reported to the start handler in the atts vector,\nattributes that were explicitly set in the element occur before any\nattributes that receive their value from default information in an\nATTLIST declaration. This function returns the number of attributes\nthat were explicitly set times two, thus giving the offset in the\n<code>atts</code> array passed to the start tag handler of the first\nattribute set due to defaults. It supplies information for the last\ncall to a start handler. If called inside a start handler, then that\nmeans the current call.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetIdAttributeIndex\">\nint XMLCALL\nXML_GetIdAttributeIndex(XML_Parser p);\n</pre>\n<div class=\"fcndef\">\nReturns the index of the ID attribute passed in the atts array in the\nlast call to <code><a href= \"#XML_StartElementHandler\"\n>XML_StartElementHandler</a></code>, or -1 if there is no ID\nattribute. If called inside a start handler, then that means the\ncurrent call.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetAttributeInfo\">\nconst XML_AttrInfo * XMLCALL\nXML_GetAttributeInfo(XML_Parser parser);\n</pre>\n<pre class=\"signature\">\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</pre>\n<div class=\"fcndef\">\nReturns an array of <code>XML_AttrInfo</code> structures for the\nattribute/value pairs passed in the last call to the\n<code>XML_StartElementHandler</code> that were specified\nin the start-tag rather than defaulted. Each attribute/value pair counts\nas 1; thus the number of entries in the array is\n<code>XML_GetSpecifiedAttributeCount(parser) / 2</code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetEncoding\">\nenum XML_Status XMLCALL\nXML_SetEncoding(XML_Parser p,\n                const XML_Char *encoding);\n</pre>\n<div class=\"fcndef\">\nSet the encoding to be used by the parser. It is equivalent to\npassing a non-null encoding argument to the parser creation functions.\nIt must not be called after <code><a href= \"#XML_Parse\"\n>XML_Parse</a></code> or <code><a href= \"#XML_ParseBuffer\"\n>XML_ParseBuffer</a></code> have been called on the given parser.\nReturns <code>XML_STATUS_OK</code> on success or\n<code>XML_STATUS_ERROR</code> on error.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetParamEntityParsing\">\nint XMLCALL\nXML_SetParamEntityParsing(XML_Parser p,\n                          enum XML_ParamEntityParsing code);\n</pre>\n<div class=\"fcndef\">\nThis enables parsing of parameter entities, including the external\nparameter entity that is the external DTD subset, according to\n<code>code</code>.\nThe choices for <code>code</code> are:\n<ul>\n<li><code>XML_PARAM_ENTITY_PARSING_NEVER</code></li>\n<li><code>XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE</code></li>\n<li><code>XML_PARAM_ENTITY_PARSING_ALWAYS</code></li>\n</ul>\n<b>Note:</b> If <code>XML_SetParamEntityParsing</code> is called after \n<code>XML_Parse</code> or <code>XML_ParseBuffer</code>, then it has\nno effect and will always return 0.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetHashSalt\">\nint XMLCALL\nXML_SetHashSalt(XML_Parser p,\n                unsigned long hash_salt);\n</pre>\n<div class=\"fcndef\">\nSets the hash salt to use for internal hash calculations.\nHelps in preventing DoS attacks based on predicting hash\nfunction behavior. In order to have an effect this must be called\nbefore parsing has started. Returns 1 if successful, 0 when called\nafter <code>XML_Parse</code> or <code>XML_ParseBuffer</code>.\n<p><b>Note:</b> This call is optional, as the parser will auto-generate a new\nrandom salt value if no value has been set at the start of parsing.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_UseForeignDTD\">\nenum XML_Error XMLCALL\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);\n</pre>\n<div class=\"fcndef\">\n<p>This function allows an application to provide an external subset\nfor the document type declaration for documents which do not specify\nan external subset of their own.  For documents which specify an\nexternal subset in their DOCTYPE declaration, the application-provided\nsubset will be ignored.  If the document does not contain a DOCTYPE\ndeclaration at all and <code>useDTD</code> is true, the\napplication-provided subset will be parsed, but the\n<code>startDoctypeDeclHandler</code> and\n<code>endDoctypeDeclHandler</code> functions, if set, will not be\ncalled.  The setting of parameter entity parsing, controlled using\n<code><a href= \"#XML_SetParamEntityParsing\"\n>XML_SetParamEntityParsing</a></code>, will be honored.</p>\n\n<p>The application-provided external subset is read by calling the\nexternal entity reference handler set via <code><a href=\n\"#XML_SetExternalEntityRefHandler\"\n>XML_SetExternalEntityRefHandler</a></code> with both\n<code>publicId</code> and <code>systemId</code> set to NULL.</p>\n\n<p>If this function is called after parsing has begun, it returns\n<code>XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING</code> and ignores\n<code>useDTD</code>.  If called when Expat has been compiled without\nDTD support, it returns\n<code>XML_ERROR_FEATURE_REQUIRES_XML_DTD</code>.  Otherwise, it\nreturns <code>XML_ERROR_NONE</code>.</p>\n\n<p><b>Note:</b> For the purpose of checking WFC: Entity Declared, passing\n<code>useDTD == XML_TRUE</code> will make the parser behave as if\nthe document had a DTD with an external subset. This holds true even if\nthe external entity reference handler returns without action.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_SetReturnNSTriplet\">\nvoid XMLCALL\nXML_SetReturnNSTriplet(XML_Parser parser,\n                       int        do_nst);\n</pre>\n<div class=\"fcndef\">\n<p>\nThis function only has an effect when using a parser created with\n<code><a href= \"#XML_ParserCreateNS\" >XML_ParserCreateNS</a></code>,\ni.e. when namespace processing is in effect. The <code>do_nst</code>\nsets whether or not prefixes are returned with names qualified with a\nnamespace prefix. If this function is called with <code>do_nst</code>\nnon-zero, then afterwards namespace qualified names (that is qualified\nwith a prefix as opposed to belonging to a default namespace) are\nreturned as a triplet with the three parts separated by the namespace\nseparator specified when the parser was created.  The order of\nreturned parts is URI, local name, and prefix.</p> <p>If\n<code>do_nst</code> is zero, then namespaces are reported in the\ndefault manner, URI then local_name separated by the namespace\nseparator.</p>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_DefaultCurrent\">\nvoid XMLCALL\nXML_DefaultCurrent(XML_Parser parser);\n</pre>\n<div class=\"fcndef\">\nThis can be called within a handler for a start element, end element,\nprocessing instruction or character data.  It causes the corresponding\nmarkup to be passed to the default handler set by <code><a\nhref=\"#XML_SetDefaultHandler\" >XML_SetDefaultHandler</a></code> or\n<code><a href=\"#XML_SetDefaultHandlerExpand\"\n>XML_SetDefaultHandlerExpand</a></code>.  It does nothing if there is\nnot a default handler.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ExpatVersion\">\nXML_LChar * XMLCALL\nXML_ExpatVersion();\n</pre>\n<div class=\"fcndef\">\nReturn the library version as a string (e.g. <code>\"expat_1.95.1\"</code>).\n</div>\n\n<pre class=\"fcndec\" id=\"XML_ExpatVersionInfo\">\nstruct XML_Expat_Version XMLCALL\nXML_ExpatVersionInfo();\n</pre>\n<pre class=\"signature\">\ntypedef struct {\n  int major;\n  int minor;\n  int micro;\n} XML_Expat_Version;\n</pre>\n<div class=\"fcndef\">\nReturn the library version information as a structure.\nSome macros are also defined that support compile-time tests of the\nlibrary version:\n<ul>\n<li><code>XML_MAJOR_VERSION</code></li>\n<li><code>XML_MINOR_VERSION</code></li>\n<li><code>XML_MICRO_VERSION</code></li>\n</ul>\nTesting these constants is currently the best way to determine if\nparticular parts of the Expat API are available.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_GetFeatureList\">\nconst XML_Feature * XMLCALL\nXML_GetFeatureList();\n</pre>\n<pre class=\"signature\">\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};\n\ntypedef struct {\n  enum XML_FeatureEnum  feature;\n  XML_LChar            *name;\n  long int              value;\n} XML_Feature;\n</pre>\n<div class=\"fcndef\">\n<p>Returns a list of \"feature\" records, providing details on how\nExpat was configured at compile time.  Most applications should not\nneed to worry about this, but this information is otherwise not\navailable from Expat.  This function allows code that does need to\ncheck these features to do so at runtime.</p>\n\n<p>The return value is an array of <code>XML_Feature</code>,\nterminated by a record with a <code>feature</code> of\n<code>XML_FEATURE_END</code> and <code>name</code> of NULL,\nidentifying the feature-test macros Expat was compiled with.  Since an\napplication that requires this kind of information needs to determine\nthe type of character the <code>name</code> points to, records for the\n<code>XML_FEATURE_SIZEOF_XML_CHAR</code> and\n<code>XML_FEATURE_SIZEOF_XML_LCHAR</code> will be located at the\nbeginning of the list, followed by <code>XML_FEATURE_UNICODE</code>\nand <code>XML_FEATURE_UNICODE_WCHAR_T</code>, if they are present at\nall.</p>\n\n<p>Some features have an associated value.  If there isn't an\nassociated value, the <code>value</code> field is set to 0.  At this\ntime, the following features have been defined to have values:</p>\n\n<dl>\n  <dt><code>XML_FEATURE_SIZEOF_XML_CHAR</code></dt>\n  <dd>The number of bytes occupied by one <code>XML_Char</code>\n  character.</dd>\n  <dt><code>XML_FEATURE_SIZEOF_XML_LCHAR</code></dt>\n  <dd>The number of bytes occupied by one <code>XML_LChar</code>\n  character.</dd>\n  <dt><code>XML_FEATURE_CONTEXT_BYTES</code></dt>\n  <dd>The maximum number of characters of context which can be\n  reported by <code><a href= \"#XML_GetInputContext\"\n  >XML_GetInputContext</a></code>.</dd>\n</dl>\n</div>\n\n<pre class=\"fcndec\" id=\"XML_FreeContentModel\">\nvoid XMLCALL\nXML_FreeContentModel(XML_Parser parser, XML_Content *model);\n</pre>\n<div class=\"fcndef\">\nFunction to deallocate the <code>model</code> argument passed to the\n<code>XML_ElementDeclHandler</code> callback set using <code><a\nhref=\"#XML_SetElementDeclHandler\" >XML_ElementDeclHandler</a></code>.\nThis function should not be used for any other purpose.\n</div>\n\n<p>The following functions allow external code to share the memory\nallocator an <code>XML_Parser</code> has been configured to use.  This\nis especially useful for third-party libraries that interact with a\nparser object created by application code, or heavily layered\napplications.  This can be essential when using dynamically loaded\nlibraries which use different C standard libraries (this can happen on\nWindows, at least).</p>\n\n<pre class=\"fcndec\" id=\"XML_MemMalloc\">\nvoid * XMLCALL\nXML_MemMalloc(XML_Parser parser, size_t size);\n</pre>\n<div class=\"fcndef\">\nAllocate <code>size</code> bytes of memory using the allocator the\n<code>parser</code> object has been configured to use.  Returns a\npointer to the memory or NULL on failure.  Memory allocated in this\nway must be freed using <code><a href=\"#XML_MemFree\"\n>XML_MemFree</a></code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_MemRealloc\">\nvoid * XMLCALL\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size);\n</pre>\n<div class=\"fcndef\">\nAllocate <code>size</code> bytes of memory using the allocator the\n<code>parser</code> object has been configured to use.\n<code>ptr</code> must point to a block of memory allocated by <code><a\nhref=\"#XML_MemMalloc\" >XML_MemMalloc</a></code> or\n<code>XML_MemRealloc</code>, or be NULL.  This function tries to\nexpand the block pointed to by <code>ptr</code> if possible.  Returns\na pointer to the memory or NULL on failure.  On success, the original\nblock has either been expanded or freed.  On failure, the original\nblock has not been freed; the caller is responsible for freeing the\noriginal block.  Memory allocated in this way must be freed using\n<code><a href=\"#XML_MemFree\"\n>XML_MemFree</a></code>.\n</div>\n\n<pre class=\"fcndec\" id=\"XML_MemFree\">\nvoid XMLCALL\nXML_MemFree(XML_Parser parser, void *ptr);\n</pre>\n<div class=\"fcndef\">\nFree a block of memory pointed to by <code>ptr</code>.  The block must\nhave been allocated by <code><a href=\"#XML_MemMalloc\"\n>XML_MemMalloc</a></code> or <code>XML_MemRealloc</code>, or be NULL.\n</div>\n\n<hr />\n<p><a href=\"http://validator.w3.org/check/referer\"><img\n        src=\"valid-xhtml10.png\" alt=\"Valid XHTML 1.0!\"\n        height=\"31\" width=\"88\" class=\"noborder\" /></a></p>\n</div>\n</body>\n</html>\n"},{"id":13397,"name":"xmlrole.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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,\n                          int tok,\n                          const char *ptr,\n                          const char *end,\n                          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":13398,"name":"expatw_static.dsp","nodeType":"TextFile","path":"cextern/expat/lib","text":"# Microsoft Developer Studio Project File - Name=\"expatw_static\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n\nCFG=expatw_static - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"expatw_static.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"expatw_static.mak\" CFG=\"expatw_static - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"expatw_static - Win32 Release\" (based on \"Win32 (x86) Static Library\")\n!MESSAGE \"expatw_static - Win32 Debug\" (based on \"Win32 (x86) Static Library\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"expatw_static - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"expatw_static___Win32_Release\"\n# PROP BASE Intermediate_Dir \"expatw_static___Win32_Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release-w_static\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_MBCS\" /D \"_LIB\" /YX /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /D \"WIN32\" /D \"_WINDOWS\" /D \"NDEBUG\" /D \"_MBCS\" /D \"_LIB\" /D \"COMPILED_FROM_DSP\" /D \"XML_UNICODE_WCHAR_T\" /FD /c\n# SUBTRACT CPP /YX\n# ADD BASE RSC /l 0x1009 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLIB32=link.exe -lib\n# ADD BASE LIB32 /nologo\n# ADD LIB32 /nologo /out:\"..\\win32\\bin\\Release\\libexpatwMT.lib\"\n\n!ELSEIF  \"$(CFG)\" == \"expatw_static - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"expatw_static___Win32_Debug\"\n# PROP BASE Intermediate_Dir \"expatw_static___Win32_Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug-w_static\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_MBCS\" /D \"_LIB\" /YX /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_LIB\" /D \"COMPILED_FROM_DSP\" /D \"XML_UNICODE_WCHAR_T\" /FR /FD /GZ /c\n# SUBTRACT CPP /YX\n# ADD BASE RSC /l 0x1009 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLIB32=link.exe -lib\n# ADD BASE LIB32 /nologo\n# ADD LIB32 /nologo /out:\"..\\win32\\bin\\Debug\\libexpatwMT.lib\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"expatw_static - Win32 Release\"\n# Name \"expatw_static - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\xmlparse.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_ns.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# Begin Source File\n\nSOURCE=.\\ascii.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\asciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat_external.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\iasciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\internal.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\latin1tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\nametab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\utf8tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.h\n# End Source File\n# End Group\n# End Target\n# End Project\n"},{"id":13399,"name":"nametab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"static const unsigned namingBitmap[] = {\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,\n0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,\n0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,\n0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,\n0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,\n0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,\n0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,\n0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,\n0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,\n0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,\n0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,\n0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,\n0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,\n0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,\n0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,\n0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,\n0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,\n0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,\n0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,\n0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,\n0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,\n0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,\n0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,\n0x40000000, 0xF580C900, 0x00000007, 0x02010800,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,\n0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,\n0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,\n0x00000000, 0x00004C40, 0x00000000, 0x00000000,\n0x00000007, 0x00000000, 0x00000000, 0x00000000,\n0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,\n0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,\n0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,\n0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,\n0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,\n0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,\n0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,\n0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,\n0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,\n0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,\n0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,\n0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,\n0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,\n0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,\n0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,\n0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,\n0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,\n0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,\n0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,\n0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,\n0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,\n0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,\n0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,\n0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,\n0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,\n0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,\n0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,\n0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,\n0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,\n0x00000000, 0x00000000, 0x00000000, 0x00000000,\n0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,\n0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,\n0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,\n};\nstatic const unsigned char nmstrtPages[] = {\n0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,\n0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,\n0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,\n0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n};\nstatic const unsigned char namePages[] = {\n0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,\n0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,\n0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,\n0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n};\n"},{"id":13400,"name":"asciitab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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":13401,"name":"macconfig.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*================================================================\n** Copyright 2000, Clark Cooper\n** All rights reserved.\n**\n** This is free software. You are permitted to copy, distribute, or modify\n** it under the terms of the MIT/X license (contained in the COPYING file\n** with this distribution.)\n**\n*/\n\n#ifndef MACCONFIG_H\n#define MACCONFIG_H\n\n\n/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\n#define BYTEORDER  4321\n\n/* Define to 1 if you have the `bcopy' function. */\n#undef HAVE_BCOPY\n\n/* Define to 1 if you have the `memmove' function. */\n#define HAVE_MEMMOVE\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 <unistd.h> header file. */\n#undef HAVE_UNISTD_H\n\n/* whether byteorder is bigendian */\n#define WORDS_BIGENDIAN\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 make parameter entity parsing functionality available. */\n#define XML_DTD\n\n/* Define to make XML Namespaces functionality available. */\n#define XML_NS\n\n/* Define to empty if `const' does not conform to ANSI C. */\n#undef const\n\n/* Define to `long' if <sys/types.h> does not define. */\n#define off_t  long\n\n/* Define to `unsigned' if <sys/types.h> does not define. */\n#undef size_t\n\n\n#endif /* ifndef MACCONFIG_H */\n"},{"id":13402,"name":"latin1tab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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":13403,"name":"expat.dsp","nodeType":"TextFile","path":"cextern/expat/lib","text":"# Microsoft Developer Studio Project File - Name=\"expat\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n\nCFG=expat - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"expat.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"expat.mak\" CFG=\"expat - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"expat - Win32 Release\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \"expat - Win32 Debug\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nMTL=midl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"expat - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release\"\n# PROP BASE Intermediate_Dir \"Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"EXPAT_EXPORTS\" /Yu\"stdafx.h\" /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /D \"NDEBUG\" /D \"WIN32\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"COMPILED_FROM_DSP\" /FD /c\n# SUBTRACT CPP /YX /Yc /Yu\n# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /dll /machine:I386\n# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:\"..\\win32\\bin\\Release\\libexpat.dll\"\n\n!ELSEIF  \"$(CFG)\" == \"expat - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug\"\n# PROP BASE Intermediate_Dir \"Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"EXPAT_EXPORTS\" /Yu\"stdafx.h\" /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D \"_DEBUG\" /D \"COMPILED_FROM_DSP\" /D \"WIN32\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /FR /FD /GZ /c\n# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept\n# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:\"..\\win32\\bin\\Debug\\libexpat.dll\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"expat - Win32 Release\"\n# Name \"expat - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\libexpat.def\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlparse.c\n\n!IF  \"$(CFG)\" == \"expat - Win32 Release\"\n\n!ELSEIF  \"$(CFG)\" == \"expat - Win32 Debug\"\n\n# ADD CPP /GX- /Od\n\n!ENDIF \n\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_ns.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# Begin Source File\n\nSOURCE=.\\ascii.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\asciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat_external.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\iasciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\internal.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\latin1tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\nametab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\utf8tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.h\n# End Source File\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"},{"id":13404,"name":"expat_external.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#ifndef Expat_External_INCLUDED\n#define Expat_External_INCLUDED 1\n\n/* External API definitions */\n\n#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)\n#define XML_USE_MSC_EXTENSIONS 1\n#endif\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\n#if !defined(XML_STATIC) && !defined(XMLIMPORT)\n#ifndef XML_BUILDING_EXPAT\n/* using Expat from an application */\n\n#ifdef XML_USE_MSC_EXTENSIONS\n#define XMLIMPORT __declspec(dllimport)\n#endif\n\n#endif\n#endif  /* not defined XML_STATIC */\n\n\n/* If we didn't define it above, define it away: */\n#ifndef XMLIMPORT\n#define XMLIMPORT\n#endif\n\n\n#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef XML_UNICODE_WCHAR_T\n#define XML_UNICODE\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. */\n#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400\ntypedef __int64 XML_Index; \ntypedef unsigned __int64 XML_Size;\n#else\ntypedef long long XML_Index;\ntypedef unsigned long long XML_Size;\n#endif\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":13405,"name":"winconfig.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*================================================================\n** Copyright 2000, Clark Cooper\n** All rights reserved.\n**\n** This is free software. You are permitted to copy, distribute, or modify\n** it under the terms of the MIT/X license (contained in the COPYING file\n** with this distribution.)\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#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/* Windows has memmove() available. */\n#define HAVE_MEMMOVE\n\n#endif /* ndef WINCONFIG_H */\n"},{"id":13406,"name":"xmlrole.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stddef.h>\n\n#ifdef COMPILED_FROM_DSP\n#include \"winconfig.h\"\n#elif defined(MACOS_CLASSIC)\n#include \"macconfig.h\"\n#elif defined(__amigaos__)\n#include \"amigaconfig.h\"\n#elif defined(__WATCOMC__)\n#include \"watcomconfig.h\"\n#else\n#ifdef HAVE_EXPAT_CONFIG_H\n#include <expat_config.h>\n#endif\n#endif /* ndef COMPILED_FROM_DSP */\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[] = {\n    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[] = {\n    ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S,\n    '\\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[] = {\n    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[] = {\n    ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S,\n    '\\0' };\nstatic const char KW_NOTATION[] =\n    { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N,\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[] = {\n    ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D,\n    '\\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 = ((state)->documentEntity \\\n                       ? internalSubset \\\n                       : 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,\n                                   int tok,\n                                   const char *ptr,\n                                   const char *end,\n                                   const ENCODING *enc);\n\nstatic PROLOG_HANDLER\n  prolog0, prolog1, prolog2,\n  doctype0, doctype1, doctype2, doctype3, doctype4, doctype5,\n  internalSubset,\n  entity0, entity1, entity2, entity3, entity4, entity5, entity6,\n  entity7, entity8, entity9, entity10,\n  notation0, notation1, notation2, notation3, notation4,\n  attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6,\n  attlist7, attlist8, attlist9,\n  element0, element1, element2, element3, element4, element5, element6,\n  element7,\n#ifdef XML_DTD\n  externalSubset0, externalSubset1,\n  condSect0, condSect1, condSect2,\n#endif /* XML_DTD */\n  declClose,\n  error;\n\nstatic int FASTCALL common(PROLOG_STATE *state, int tok);\n\nstatic int PTRCALL\nprolog0(PROLOG_STATE *state,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n                             ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                             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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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    return XML_ROLE_NONE;\n  case XML_TOK_DECL_OPEN:\n    if (!XmlNameMatchesAscii(enc,\n                             ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                             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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n               int tok,\n               const char *ptr,\n               const char *end,\n               const ENCODING *enc)\n{\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_NONE;\n  case XML_TOK_DECL_OPEN:\n    if (XmlNameMatchesAscii(enc,\n                            ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                            end,\n                            KW_ENTITY)) {\n      state->handler = entity0;\n      return XML_ROLE_ENTITY_NONE;\n    }\n    if (XmlNameMatchesAscii(enc,\n                            ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                            end,\n                            KW_ATTLIST)) {\n      state->handler = attlist0;\n      return XML_ROLE_ATTLIST_NONE;\n    }\n    if (XmlNameMatchesAscii(enc,\n                            ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                            end,\n                            KW_ELEMENT)) {\n      state->handler = element0;\n      return XML_ROLE_ELEMENT_NONE;\n    }\n    if (XmlNameMatchesAscii(enc,\n                            ptr + 2 * MIN_BYTES_PER_CHAR(enc),\n                            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,\n                int tok,\n                const char *ptr,\n                const char *end,\n                const ENCODING *enc)\n{\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,\n                int tok,\n                const char *ptr,\n                const char *end,\n                const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n        int tok,\n        const char *ptr,\n        const char *end,\n        const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\n  switch (tok) {\n  case XML_TOK_PROLOG_S:\n    return XML_ROLE_ATTLIST_NONE;\n  case XML_TOK_NAME:\n    {\n      static const char * const types[] = {\n        KW_CDATA,\n        KW_ID,\n        KW_IDREF,\n        KW_IDREFS,\n        KW_ENTITY,\n        KW_ENTITIES,\n        KW_NMTOKEN,\n        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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n                            ptr + MIN_BYTES_PER_CHAR(enc),\n                            end,\n                            KW_IMPLIED)) {\n      state->handler = attlist1;\n      return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;\n    }\n    if (XmlNameMatchesAscii(enc,\n                            ptr + MIN_BYTES_PER_CHAR(enc),\n                            end,\n                            KW_REQUIRED)) {\n      state->handler = attlist1;\n      return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;\n    }\n    if (XmlNameMatchesAscii(enc,\n                            ptr + MIN_BYTES_PER_CHAR(enc),\n                            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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n                            ptr + MIN_BYTES_PER_CHAR(enc),\n                            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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n         int tok,\n         const char *ptr,\n         const char *end,\n         const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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,\n          int tok,\n          const char *ptr,\n          const char *end,\n          const ENCODING *enc)\n{\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\nstatic int PTRCALL\nerror(PROLOG_STATE *state,\n      int tok,\n      const char *ptr,\n      const char *end,\n      const ENCODING *enc)\n{\n  return XML_ROLE_NONE;\n}\n\nstatic int FASTCALL\ncommon(PROLOG_STATE *state, int tok)\n{\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{\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{\n  state->handler = externalSubset0;\n  state->documentEntity = 0;\n  state->includeLevel = 0;\n}\n\n#endif /* XML_DTD */\n"},{"id":13407,"name":"xmlparse.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stddef.h>\n#include <string.h>                     /* memset(), memcpy() */\n#include <assert.h>\n#include <limits.h>                     /* UINT_MAX */\n#include <time.h>                       /* time() */\n\n#define XML_BUILDING_EXPAT 1\n\n#ifdef COMPILED_FROM_DSP\n#include \"winconfig.h\"\n#elif defined(MACOS_CLASSIC)\n#include \"macconfig.h\"\n#elif defined(__amigaos__)\n#include \"amigaconfig.h\"\n#elif defined(__WATCOMC__)\n#include \"watcomconfig.h\"\n#elif defined(HAVE_EXPAT_CONFIG_H)\n#include <expat_config.h>\n#endif /* ndef COMPILED_FROM_DSP */\n\n#include \"ascii.h\"\n#include \"expat.h\"\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) (!(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\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/* Handle the case where memmove() doesn't exist. */\n#ifndef HAVE_MEMMOVE\n#ifdef HAVE_BCOPY\n#define memmove(d,s,l) bcopy((s),(d),(l))\n#else\n#error memmove does not exist on this platform, nor is a substitute available\n#endif /* HAVE_BCOPY */\n#endif /* HAVE_MEMMOVE */\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\n/* Basic character hash algorithm, taken from Python's string hash:\n   h = h * 1000003 ^ character, the constant being a prime number.\n\n*/\n#ifdef XML_UNICODE\n#define CHAR_HASH(h, c) \\\n  (((h) * 0xF4243) ^ (unsigned short)(c))\n#else\n#define CHAR_HASH(h, c) \\\n  (((h) * 0xF4243) ^ (unsigned char)(c))\n#endif\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,\n                                         const char *start,\n                                         const char *end,\n                                         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\nhandleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);\nstatic enum XML_Error\nprocessXmlDecl(XML_Parser parser, int isGeneralTextEntity,\n               const char *s, const char *next);\nstatic enum XML_Error\ninitializeEncoding(XML_Parser parser);\nstatic enum XML_Error\ndoProlog(XML_Parser parser, const ENCODING *enc, const char *s,\n         const char *end, int tok, const char *next, const char **nextPtr,\n         XML_Bool haveMore);\nstatic enum XML_Error\nprocessInternalEntity(XML_Parser parser, ENTITY *entity,\n                      XML_Bool betweenDecl);\nstatic enum XML_Error\ndoContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,\n          const char *start, const char *end, const char **endPtr,\n          XML_Bool haveMore);\nstatic enum XML_Error\ndoCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr,\n               const char *end, const char **nextPtr, XML_Bool haveMore);\n#ifdef XML_DTD\nstatic enum XML_Error\ndoIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr,\n                const char *end, const char **nextPtr, XML_Bool haveMore);\n#endif /* XML_DTD */\n\nstatic enum XML_Error\nstoreAtts(XML_Parser parser, const ENCODING *, const char *s,\n          TAG_NAME *tagNamePtr, BINDING **bindingsPtr);\nstatic enum XML_Error\naddBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,\n           const XML_Char *uri, BINDING **bindingsPtr);\nstatic int\ndefineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata,\n                XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser);\nstatic enum XML_Error\nstoreAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,\n                    const char *, const char *, STRING_POOL *);\nstatic enum XML_Error\nappendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,\n                     const char *, const char *, STRING_POOL *);\nstatic ATTRIBUTE_ID *\ngetAttributeId(XML_Parser parser, const ENCODING *enc, const char *start,\n               const char *end);\nstatic int\nsetElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);\nstatic enum XML_Error\nstoreEntityValue(XML_Parser parser, const ENCODING *enc, const char *start,\n                 const char *end);\nstatic int\nreportProcessingInstruction(XML_Parser parser, const ENCODING *enc,\n                            const char *start, const char *end);\nstatic int\nreportComment(XML_Parser parser, const ENCODING *enc, const char *start,\n              const char *end);\nstatic void\nreportDefault(XML_Parser parser, const ENCODING *enc, const char *start,\n              const char *end);\n\nstatic const XML_Char * getContext(XML_Parser parser);\nstatic XML_Bool\nsetContext(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 parentParser != NULL */\nstatic void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms);\nstatic void\ndtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms);\nstatic int\ndtdCopy(XML_Parser oldParser,\n        DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);\nstatic int\ncopyEntityTable(XML_Parser oldParser,\n                HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);\nstatic NAMED *\nlookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize);\nstatic void FASTCALL\nhashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms);\nstatic void FASTCALL hashTableClear(HASH_TABLE *);\nstatic void FASTCALL hashTableDestroy(HASH_TABLE *);\nstatic void FASTCALL\nhashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);\nstatic NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *);\n\nstatic void FASTCALL\npoolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms);\nstatic void FASTCALL poolClear(STRING_POOL *);\nstatic void FASTCALL poolDestroy(STRING_POOL *);\nstatic XML_Char *\npoolAppend(STRING_POOL *pool, const ENCODING *enc,\n           const char *ptr, const char *end);\nstatic XML_Char *\npoolStoreString(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\npoolCopyString(STRING_POOL *pool, const XML_Char *s);\nstatic const XML_Char *\npoolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);\nstatic const XML_Char * FASTCALL\npoolAppendString(STRING_POOL *pool, const XML_Char *s);\n\nstatic int FASTCALL nextScaffoldPart(XML_Parser parser);\nstatic XML_Content * build_model(XML_Parser parser);\nstatic ELEMENT_TYPE *\ngetElementType(XML_Parser parser, const ENCODING *enc,\n               const char *ptr, const char *end);\n\nstatic unsigned long generate_hash_secret_salt(void);\nstatic XML_Bool startParsing(XML_Parser parser);\n\nstatic XML_Parser\nparserCreate(const XML_Char *encodingName,\n             const XML_Memory_Handling_Suite *memsuite,\n             const XML_Char *nameSep,\n             DTD *dtd);\n\nstatic void\nparserInit(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 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 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(s) (parser->m_mem.malloc_fcn((s)))\n#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s)))\n#define FREE(p) (parser->m_mem.free_fcn((p)))\n\n#define userData (parser->m_userData)\n#define handlerArg (parser->m_handlerArg)\n#define startElementHandler (parser->m_startElementHandler)\n#define endElementHandler (parser->m_endElementHandler)\n#define characterDataHandler (parser->m_characterDataHandler)\n#define processingInstructionHandler \\\n        (parser->m_processingInstructionHandler)\n#define commentHandler (parser->m_commentHandler)\n#define startCdataSectionHandler \\\n        (parser->m_startCdataSectionHandler)\n#define endCdataSectionHandler (parser->m_endCdataSectionHandler)\n#define defaultHandler (parser->m_defaultHandler)\n#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler)\n#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler)\n#define unparsedEntityDeclHandler \\\n        (parser->m_unparsedEntityDeclHandler)\n#define notationDeclHandler (parser->m_notationDeclHandler)\n#define startNamespaceDeclHandler \\\n        (parser->m_startNamespaceDeclHandler)\n#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler)\n#define notStandaloneHandler (parser->m_notStandaloneHandler)\n#define externalEntityRefHandler \\\n        (parser->m_externalEntityRefHandler)\n#define externalEntityRefHandlerArg \\\n        (parser->m_externalEntityRefHandlerArg)\n#define internalEntityRefHandler \\\n        (parser->m_internalEntityRefHandler)\n#define skippedEntityHandler (parser->m_skippedEntityHandler)\n#define unknownEncodingHandler (parser->m_unknownEncodingHandler)\n#define elementDeclHandler (parser->m_elementDeclHandler)\n#define attlistDeclHandler (parser->m_attlistDeclHandler)\n#define entityDeclHandler (parser->m_entityDeclHandler)\n#define xmlDeclHandler (parser->m_xmlDeclHandler)\n#define encoding (parser->m_encoding)\n#define initEncoding (parser->m_initEncoding)\n#define internalEncoding (parser->m_internalEncoding)\n#define unknownEncodingMem (parser->m_unknownEncodingMem)\n#define unknownEncodingData (parser->m_unknownEncodingData)\n#define unknownEncodingHandlerData \\\n  (parser->m_unknownEncodingHandlerData)\n#define unknownEncodingRelease (parser->m_unknownEncodingRelease)\n#define protocolEncodingName (parser->m_protocolEncodingName)\n#define ns (parser->m_ns)\n#define ns_triplets (parser->m_ns_triplets)\n#define prologState (parser->m_prologState)\n#define processor (parser->m_processor)\n#define errorCode (parser->m_errorCode)\n#define eventPtr (parser->m_eventPtr)\n#define eventEndPtr (parser->m_eventEndPtr)\n#define positionPtr (parser->m_positionPtr)\n#define position (parser->m_position)\n#define openInternalEntities (parser->m_openInternalEntities)\n#define freeInternalEntities (parser->m_freeInternalEntities)\n#define defaultExpandInternalEntities \\\n        (parser->m_defaultExpandInternalEntities)\n#define tagLevel (parser->m_tagLevel)\n#define buffer (parser->m_buffer)\n#define bufferPtr (parser->m_bufferPtr)\n#define bufferEnd (parser->m_bufferEnd)\n#define parseEndByteIndex (parser->m_parseEndByteIndex)\n#define parseEndPtr (parser->m_parseEndPtr)\n#define bufferLim (parser->m_bufferLim)\n#define dataBuf (parser->m_dataBuf)\n#define dataBufEnd (parser->m_dataBufEnd)\n#define _dtd (parser->m_dtd)\n#define curBase (parser->m_curBase)\n#define declEntity (parser->m_declEntity)\n#define doctypeName (parser->m_doctypeName)\n#define doctypeSysid (parser->m_doctypeSysid)\n#define doctypePubid (parser->m_doctypePubid)\n#define declAttributeType (parser->m_declAttributeType)\n#define declNotationName (parser->m_declNotationName)\n#define declNotationPublicId (parser->m_declNotationPublicId)\n#define declElementType (parser->m_declElementType)\n#define declAttributeId (parser->m_declAttributeId)\n#define declAttributeIsCdata (parser->m_declAttributeIsCdata)\n#define declAttributeIsId (parser->m_declAttributeIsId)\n#define freeTagList (parser->m_freeTagList)\n#define freeBindingList (parser->m_freeBindingList)\n#define inheritedBindings (parser->m_inheritedBindings)\n#define tagStack (parser->m_tagStack)\n#define atts (parser->m_atts)\n#define attsSize (parser->m_attsSize)\n#define nSpecifiedAtts (parser->m_nSpecifiedAtts)\n#define idAttIndex (parser->m_idAttIndex)\n#define nsAtts (parser->m_nsAtts)\n#define nsAttsVersion (parser->m_nsAttsVersion)\n#define nsAttsPower (parser->m_nsAttsPower)\n#define attInfo (parser->m_attInfo)\n#define tempPool (parser->m_tempPool)\n#define temp2Pool (parser->m_temp2Pool)\n#define groupConnector (parser->m_groupConnector)\n#define groupSize (parser->m_groupSize)\n#define namespaceSeparator (parser->m_namespaceSeparator)\n#define parentParser (parser->m_parentParser)\n#define ps_parsing (parser->m_parsingStatus.parsing)\n#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer)\n#ifdef XML_DTD\n#define isParamEntity (parser->m_isParamEntity)\n#define useForeignDTD (parser->m_useForeignDTD)\n#define paramEntityParsing (parser->m_paramEntityParsing)\n#endif /* XML_DTD */\n#define hash_secret_salt (parser->m_hash_secret_salt)\n\nXML_Parser XMLCALL\nXML_ParserCreate(const XML_Char *encodingName)\n{\n  return XML_ParserCreate_MM(encodingName, NULL, NULL);\n}\n\nXML_Parser XMLCALL\nXML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)\n{\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, ASCII_t, ASCII_t, ASCII_p,\n  ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,\n  ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,\n  ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,\n  ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,\n  ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\\0'\n};\n\nstatic unsigned long\ngenerate_hash_secret_salt(void)\n{\n  unsigned int seed = time(NULL) % UINT_MAX;\n  srand(seed);\n  return rand();\n}\n\nstatic XML_Bool  /* only valid for root parser */\nstartParsing(XML_Parser parser)\n{\n    /* hash functions must be initialized before setContext() is called */\n    if (hash_secret_salt == 0)\n      hash_secret_salt = generate_hash_secret_salt();\n    if (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{\n  return parserCreate(encodingName, memsuite, nameSep, NULL);\n}\n\nstatic XML_Parser\nparserCreate(const XML_Char *encodingName,\n             const XML_Memory_Handling_Suite *memsuite,\n             const XML_Char *nameSep,\n             DTD *dtd)\n{\n  XML_Parser parser;\n\n  if (memsuite) {\n    XML_Memory_Handling_Suite *mtemp;\n    parser = (XML_Parser)\n      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  }\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  buffer = NULL;\n  bufferLim = NULL;\n\n  attsSize = INIT_ATTS_SIZE;\n  atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE));\n  if (atts == NULL) {\n    FREE(parser);\n    return NULL;\n  }\n#ifdef XML_ATTR_INFO\n  attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo));\n  if (attInfo == NULL) {\n    FREE(atts);\n    FREE(parser);\n    return NULL;\n  }\n#endif\n  dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));\n  if (dataBuf == NULL) {\n    FREE(atts);\n#ifdef XML_ATTR_INFO\n    FREE(attInfo);\n#endif\n    FREE(parser);\n    return NULL;\n  }\n  dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;\n\n  if (dtd)\n    _dtd = dtd;\n  else {\n    _dtd = dtdCreate(&parser->m_mem);\n    if (_dtd == NULL) {\n      FREE(dataBuf);\n      FREE(atts);\n#ifdef XML_ATTR_INFO\n      FREE(attInfo);\n#endif\n      FREE(parser);\n      return NULL;\n    }\n  }\n\n  freeBindingList = NULL;\n  freeTagList = NULL;\n  freeInternalEntities = NULL;\n\n  groupSize = 0;\n  groupConnector = NULL;\n\n  unknownEncodingHandler = NULL;\n  unknownEncodingHandlerData = NULL;\n\n  namespaceSeparator = ASCII_EXCL;\n  ns = XML_FALSE;\n  ns_triplets = XML_FALSE;\n\n  nsAtts = NULL;\n  nsAttsVersion = 0;\n  nsAttsPower = 0;\n\n  poolInit(&tempPool, &(parser->m_mem));\n  poolInit(&temp2Pool, &(parser->m_mem));\n  parserInit(parser, encodingName);\n\n  if (encodingName && !protocolEncodingName) {\n    XML_ParserFree(parser);\n    return NULL;\n  }\n\n  if (nameSep) {\n    ns = XML_TRUE;\n    internalEncoding = XmlGetInternalEncodingNS();\n    namespaceSeparator = *nameSep;\n  }\n  else {\n    internalEncoding = XmlGetInternalEncoding();\n  }\n\n  return parser;\n}\n\nstatic void\nparserInit(XML_Parser parser, const XML_Char *encodingName)\n{\n  processor = prologInitProcessor;\n  XmlPrologStateInit(&prologState);\n  protocolEncodingName = (encodingName != NULL\n                          ? poolCopyString(&tempPool, encodingName)\n                          : NULL);\n  curBase = NULL;\n  XmlInitEncoding(&initEncoding, &encoding, 0);\n  userData = NULL;\n  handlerArg = NULL;\n  startElementHandler = NULL;\n  endElementHandler = NULL;\n  characterDataHandler = NULL;\n  processingInstructionHandler = NULL;\n  commentHandler = NULL;\n  startCdataSectionHandler = NULL;\n  endCdataSectionHandler = NULL;\n  defaultHandler = NULL;\n  startDoctypeDeclHandler = NULL;\n  endDoctypeDeclHandler = NULL;\n  unparsedEntityDeclHandler = NULL;\n  notationDeclHandler = NULL;\n  startNamespaceDeclHandler = NULL;\n  endNamespaceDeclHandler = NULL;\n  notStandaloneHandler = NULL;\n  externalEntityRefHandler = NULL;\n  externalEntityRefHandlerArg = parser;\n  skippedEntityHandler = NULL;\n  elementDeclHandler = NULL;\n  attlistDeclHandler = NULL;\n  entityDeclHandler = NULL;\n  xmlDeclHandler = NULL;\n  bufferPtr = buffer;\n  bufferEnd = buffer;\n  parseEndByteIndex = 0;\n  parseEndPtr = NULL;\n  declElementType = NULL;\n  declAttributeId = NULL;\n  declEntity = NULL;\n  doctypeName = NULL;\n  doctypeSysid = NULL;\n  doctypePubid = NULL;\n  declAttributeType = NULL;\n  declNotationName = NULL;\n  declNotationPublicId = NULL;\n  declAttributeIsCdata = XML_FALSE;\n  declAttributeIsId = XML_FALSE;\n  memset(&position, 0, sizeof(POSITION));\n  errorCode = XML_ERROR_NONE;\n  eventPtr = NULL;\n  eventEndPtr = NULL;\n  positionPtr = NULL;\n  openInternalEntities = NULL;\n  defaultExpandInternalEntities = XML_TRUE;\n  tagLevel = 0;\n  tagStack = NULL;\n  inheritedBindings = NULL;\n  nSpecifiedAtts = 0;\n  unknownEncodingMem = NULL;\n  unknownEncodingRelease = NULL;\n  unknownEncodingData = NULL;\n  parentParser = NULL;\n  ps_parsing = XML_INITIALIZED;\n#ifdef XML_DTD\n  isParamEntity = XML_FALSE;\n  useForeignDTD = XML_FALSE;\n  paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;\n#endif\n  hash_secret_salt = 0;\n}\n\n/* moves list of bindings to freeBindingList */\nstatic void FASTCALL\nmoveToFreeBindingList(XML_Parser parser, BINDING *bindings)\n{\n  while (bindings) {\n    BINDING *b = bindings;\n    bindings = bindings->nextTagBinding;\n    b->nextTagBinding = freeBindingList;\n    freeBindingList = b;\n  }\n}\n\nXML_Bool XMLCALL\nXML_ParserReset(XML_Parser parser, const XML_Char *encodingName)\n{\n  TAG *tStk;\n  OPEN_INTERNAL_ENTITY *openEntityList;\n  if (parentParser)\n    return XML_FALSE;\n  /* move tagStack to freeTagList */\n  tStk = tagStack;\n  while (tStk) {\n    TAG *tag = tStk;\n    tStk = tStk->parent;\n    tag->parent = freeTagList;\n    moveToFreeBindingList(parser, tag->bindings);\n    tag->bindings = NULL;\n    freeTagList = tag;\n  }\n  /* move openInternalEntities to freeInternalEntities */\n  openEntityList = openInternalEntities;\n  while (openEntityList) {\n    OPEN_INTERNAL_ENTITY *openEntity = openEntityList;\n    openEntityList = openEntity->next;\n    openEntity->next = freeInternalEntities;\n    freeInternalEntities = openEntity;\n  }\n  moveToFreeBindingList(parser, inheritedBindings);\n  FREE(unknownEncodingMem);\n  if (unknownEncodingRelease)\n    unknownEncodingRelease(unknownEncodingData);\n  poolClear(&tempPool);\n  poolClear(&temp2Pool);\n  parserInit(parser, encodingName);\n  dtdReset(_dtd, &parser->m_mem);\n  return XML_TRUE;\n}\n\nenum XML_Status XMLCALL\nXML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)\n{\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 (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)\n    return XML_STATUS_ERROR;\n  if (encodingName == NULL)\n    protocolEncodingName = NULL;\n  else {\n    protocolEncodingName = poolCopyString(&tempPool, encodingName);\n    if (!protocolEncodingName)\n      return XML_STATUS_ERROR;\n  }\n  return XML_STATUS_OK;\n}\n\nXML_Parser XMLCALL\nXML_ExternalEntityParserCreate(XML_Parser oldParser,\n                               const XML_Char *context,\n                               const XML_Char *encodingName)\n{\n  XML_Parser parser = oldParser;\n  DTD *newDtd = NULL;\n  DTD *oldDtd = _dtd;\n  XML_StartElementHandler oldStartElementHandler = startElementHandler;\n  XML_EndElementHandler oldEndElementHandler = endElementHandler;\n  XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;\n  XML_ProcessingInstructionHandler oldProcessingInstructionHandler\n      = processingInstructionHandler;\n  XML_CommentHandler oldCommentHandler = commentHandler;\n  XML_StartCdataSectionHandler oldStartCdataSectionHandler\n      = startCdataSectionHandler;\n  XML_EndCdataSectionHandler oldEndCdataSectionHandler\n      = endCdataSectionHandler;\n  XML_DefaultHandler oldDefaultHandler = defaultHandler;\n  XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler\n      = unparsedEntityDeclHandler;\n  XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;\n  XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler\n      = startNamespaceDeclHandler;\n  XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler\n      = endNamespaceDeclHandler;\n  XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;\n  XML_ExternalEntityRefHandler oldExternalEntityRefHandler\n      = externalEntityRefHandler;\n  XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler;\n  XML_UnknownEncodingHandler oldUnknownEncodingHandler\n      = unknownEncodingHandler;\n  XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler;\n  XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler;\n  XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler;\n  XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;\n  ELEMENT_TYPE * oldDeclElementType = declElementType;\n\n  void *oldUserData = userData;\n  void *oldHandlerArg = handlerArg;\n  XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities;\n  XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;\n#ifdef XML_DTD\n  enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;\n  int oldInEntityValue = prologState.inEntityValue;\n#endif\n  XML_Bool oldns_triplets = 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  unsigned long oldhash_secret_salt = 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 (ns) {\n    XML_Char tmp[2];\n    *tmp = namespaceSeparator;\n    parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd);\n  }\n  else {\n    parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd);\n  }\n\n  if (!parser)\n    return NULL;\n\n  startElementHandler = oldStartElementHandler;\n  endElementHandler = oldEndElementHandler;\n  characterDataHandler = oldCharacterDataHandler;\n  processingInstructionHandler = oldProcessingInstructionHandler;\n  commentHandler = oldCommentHandler;\n  startCdataSectionHandler = oldStartCdataSectionHandler;\n  endCdataSectionHandler = oldEndCdataSectionHandler;\n  defaultHandler = oldDefaultHandler;\n  unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;\n  notationDeclHandler = oldNotationDeclHandler;\n  startNamespaceDeclHandler = oldStartNamespaceDeclHandler;\n  endNamespaceDeclHandler = oldEndNamespaceDeclHandler;\n  notStandaloneHandler = oldNotStandaloneHandler;\n  externalEntityRefHandler = oldExternalEntityRefHandler;\n  skippedEntityHandler = oldSkippedEntityHandler;\n  unknownEncodingHandler = oldUnknownEncodingHandler;\n  elementDeclHandler = oldElementDeclHandler;\n  attlistDeclHandler = oldAttlistDeclHandler;\n  entityDeclHandler = oldEntityDeclHandler;\n  xmlDeclHandler = oldXmlDeclHandler;\n  declElementType = oldDeclElementType;\n  userData = oldUserData;\n  if (oldUserData == oldHandlerArg)\n    handlerArg = userData;\n  else\n    handlerArg = parser;\n  if (oldExternalEntityRefHandlerArg != oldParser)\n    externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;\n  defaultExpandInternalEntities = oldDefaultExpandInternalEntities;\n  ns_triplets = oldns_triplets;\n  hash_secret_salt = oldhash_secret_salt;\n  parentParser = oldParser;\n#ifdef XML_DTD\n  paramEntityParsing = oldParamEntityParsing;\n  prologState.inEntityValue = oldInEntityValue;\n  if (context) {\n#endif /* XML_DTD */\n    if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem)\n      || !setContext(parser, context)) {\n      XML_ParserFree(parser);\n      return NULL;\n    }\n    processor = externalEntityInitProcessor;\n#ifdef XML_DTD\n  }\n  else {\n    /* The DTD instance referenced by _dtd is shared between the document's\n       root parser and external PE parsers, therefore one does not need to\n       call setContext. In addition, one also *must* not call setContext,\n       because this would overwrite existing prefix->binding pointers in\n       _dtd with ones that get destroyed with the external PE parser.\n       This would leave those prefixes with dangling pointers.\n    */\n    isParamEntity = XML_TRUE;\n    XmlPrologStateInitExternalEntity(&prologState);\n    processor = externalParEntInitProcessor;\n  }\n#endif /* XML_DTD */\n  return parser;\n}\n\nstatic void FASTCALL\ndestroyBindings(BINDING *bindings, XML_Parser parser)\n{\n  for (;;) {\n    BINDING *b = bindings;\n    if (!b)\n      break;\n    bindings = b->nextTagBinding;\n    FREE(b->uri);\n    FREE(b);\n  }\n}\n\nvoid XMLCALL\nXML_ParserFree(XML_Parser parser)\n{\n  TAG *tagList;\n  OPEN_INTERNAL_ENTITY *entityList;\n  if (parser == NULL)\n    return;\n  /* free tagStack and freeTagList */\n  tagList = tagStack;\n  for (;;) {\n    TAG *p;\n    if (tagList == NULL) {\n      if (freeTagList == NULL)\n        break;\n      tagList = freeTagList;\n      freeTagList = NULL;\n    }\n    p = tagList;\n    tagList = tagList->parent;\n    FREE(p->buf);\n    destroyBindings(p->bindings, parser);\n    FREE(p);\n  }\n  /* free openInternalEntities and freeInternalEntities */\n  entityList = openInternalEntities;\n  for (;;) {\n    OPEN_INTERNAL_ENTITY *openEntity;\n    if (entityList == NULL) {\n      if (freeInternalEntities == NULL)\n        break;\n      entityList = freeInternalEntities;\n      freeInternalEntities = NULL;\n    }\n    openEntity = entityList;\n    entityList = entityList->next;\n    FREE(openEntity);\n  }\n\n  destroyBindings(freeBindingList, parser);\n  destroyBindings(inheritedBindings, parser);\n  poolDestroy(&tempPool);\n  poolDestroy(&temp2Pool);\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 (!isParamEntity && _dtd)\n#else\n  if (_dtd)\n#endif /* XML_DTD */\n    dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem);\n  FREE((void *)atts);\n#ifdef XML_ATTR_INFO\n  FREE((void *)attInfo);\n#endif\n  FREE(groupConnector);\n  FREE(buffer);\n  FREE(dataBuf);\n  FREE(nsAtts);\n  FREE(unknownEncodingMem);\n  if (unknownEncodingRelease)\n    unknownEncodingRelease(unknownEncodingData);\n  FREE(parser);\n}\n\nvoid XMLCALL\nXML_UseParserAsHandlerArg(XML_Parser parser)\n{\n  handlerArg = parser;\n}\n\nenum XML_Error XMLCALL\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)\n{\n#ifdef XML_DTD\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)\n    return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;\n  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{\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)\n    return;\n  ns_triplets = do_nst ? XML_TRUE : XML_FALSE;\n}\n\nvoid XMLCALL\nXML_SetUserData(XML_Parser parser, void *p)\n{\n  if (handlerArg == userData)\n    handlerArg = userData = p;\n  else\n    userData = p;\n}\n\nenum XML_Status XMLCALL\nXML_SetBase(XML_Parser parser, const XML_Char *p)\n{\n  if (p) {\n    p = poolCopyString(&_dtd->pool, p);\n    if (!p)\n      return XML_STATUS_ERROR;\n    curBase = p;\n  }\n  else\n    curBase = NULL;\n  return XML_STATUS_OK;\n}\n\nconst XML_Char * XMLCALL\nXML_GetBase(XML_Parser parser)\n{\n  return curBase;\n}\n\nint XMLCALL\nXML_GetSpecifiedAttributeCount(XML_Parser parser)\n{\n  return nSpecifiedAtts;\n}\n\nint XMLCALL\nXML_GetIdAttributeIndex(XML_Parser parser)\n{\n  return idAttIndex;\n}\n\n#ifdef XML_ATTR_INFO\nconst XML_AttrInfo * XMLCALL\nXML_GetAttributeInfo(XML_Parser parser)\n{\n  return attInfo;\n}\n#endif\n\nvoid XMLCALL\nXML_SetElementHandler(XML_Parser parser,\n                      XML_StartElementHandler start,\n                      XML_EndElementHandler end)\n{\n  startElementHandler = start;\n  endElementHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartElementHandler(XML_Parser parser,\n                           XML_StartElementHandler start) {\n  startElementHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndElementHandler(XML_Parser parser,\n                         XML_EndElementHandler end) {\n  endElementHandler = end;\n}\n\nvoid XMLCALL\nXML_SetCharacterDataHandler(XML_Parser parser,\n                            XML_CharacterDataHandler handler)\n{\n  characterDataHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetProcessingInstructionHandler(XML_Parser parser,\n                                    XML_ProcessingInstructionHandler handler)\n{\n  processingInstructionHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetCommentHandler(XML_Parser parser,\n                      XML_CommentHandler handler)\n{\n  commentHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetCdataSectionHandler(XML_Parser parser,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end)\n{\n  startCdataSectionHandler = start;\n  endCdataSectionHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartCdataSectionHandler(XML_Parser parser,\n                                XML_StartCdataSectionHandler start) {\n  startCdataSectionHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndCdataSectionHandler(XML_Parser parser,\n                              XML_EndCdataSectionHandler end) {\n  endCdataSectionHandler = end;\n}\n\nvoid XMLCALL\nXML_SetDefaultHandler(XML_Parser parser,\n                      XML_DefaultHandler handler)\n{\n  defaultHandler = handler;\n  defaultExpandInternalEntities = XML_FALSE;\n}\n\nvoid XMLCALL\nXML_SetDefaultHandlerExpand(XML_Parser parser,\n                            XML_DefaultHandler handler)\n{\n  defaultHandler = handler;\n  defaultExpandInternalEntities = XML_TRUE;\n}\n\nvoid XMLCALL\nXML_SetDoctypeDeclHandler(XML_Parser parser,\n                          XML_StartDoctypeDeclHandler start,\n                          XML_EndDoctypeDeclHandler end)\n{\n  startDoctypeDeclHandler = start;\n  endDoctypeDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartDoctypeDeclHandler(XML_Parser parser,\n                               XML_StartDoctypeDeclHandler start) {\n  startDoctypeDeclHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndDoctypeDeclHandler(XML_Parser parser,\n                             XML_EndDoctypeDeclHandler end) {\n  endDoctypeDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler)\n{\n  unparsedEntityDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetNotationDeclHandler(XML_Parser parser,\n                           XML_NotationDeclHandler handler)\n{\n  notationDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetNamespaceDeclHandler(XML_Parser parser,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end)\n{\n  startNamespaceDeclHandler = start;\n  endNamespaceDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetStartNamespaceDeclHandler(XML_Parser parser,\n                                 XML_StartNamespaceDeclHandler start) {\n  startNamespaceDeclHandler = start;\n}\n\nvoid XMLCALL\nXML_SetEndNamespaceDeclHandler(XML_Parser parser,\n                               XML_EndNamespaceDeclHandler end) {\n  endNamespaceDeclHandler = end;\n}\n\nvoid XMLCALL\nXML_SetNotStandaloneHandler(XML_Parser parser,\n                            XML_NotStandaloneHandler handler)\n{\n  notStandaloneHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetExternalEntityRefHandler(XML_Parser parser,\n                                XML_ExternalEntityRefHandler handler)\n{\n  externalEntityRefHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)\n{\n  if (arg)\n    externalEntityRefHandlerArg = (XML_Parser)arg;\n  else\n    externalEntityRefHandlerArg = parser;\n}\n\nvoid XMLCALL\nXML_SetSkippedEntityHandler(XML_Parser parser,\n                            XML_SkippedEntityHandler handler)\n{\n  skippedEntityHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetUnknownEncodingHandler(XML_Parser parser,\n                              XML_UnknownEncodingHandler handler,\n                              void *data)\n{\n  unknownEncodingHandler = handler;\n  unknownEncodingHandlerData = data;\n}\n\nvoid XMLCALL\nXML_SetElementDeclHandler(XML_Parser parser,\n                          XML_ElementDeclHandler eldecl)\n{\n  elementDeclHandler = eldecl;\n}\n\nvoid XMLCALL\nXML_SetAttlistDeclHandler(XML_Parser parser,\n                          XML_AttlistDeclHandler attdecl)\n{\n  attlistDeclHandler = attdecl;\n}\n\nvoid XMLCALL\nXML_SetEntityDeclHandler(XML_Parser parser,\n                         XML_EntityDeclHandler handler)\n{\n  entityDeclHandler = handler;\n}\n\nvoid XMLCALL\nXML_SetXmlDeclHandler(XML_Parser parser,\n                      XML_XmlDeclHandler handler) {\n  xmlDeclHandler = handler;\n}\n\nint XMLCALL\nXML_SetParamEntityParsing(XML_Parser parser,\n                          enum XML_ParamEntityParsing peParsing)\n{\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)\n    return 0;\n#ifdef XML_DTD\n  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,\n                unsigned long hash_salt)\n{\n  /* block after XML_Parse()/XML_ParseBuffer() has been called */\n  if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)\n    return 0;\n  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{\n  switch (ps_parsing) {\n  case XML_SUSPENDED:\n    errorCode = XML_ERROR_SUSPENDED;\n    return XML_STATUS_ERROR;\n  case XML_FINISHED:\n    errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  case XML_INITIALIZED:\n    if (parentParser == NULL && !startParsing(parser)) {\n      errorCode = XML_ERROR_NO_MEMORY;\n      return XML_STATUS_ERROR;\n    }\n  default:\n    ps_parsing = XML_PARSING;\n  }\n\n  if (len == 0) {\n    ps_finalBuffer = (XML_Bool)isFinal;\n    if (!isFinal)\n      return XML_STATUS_OK;\n    positionPtr = bufferPtr;\n    parseEndPtr = 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    errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);\n\n    if (errorCode == XML_ERROR_NONE) {\n      switch (ps_parsing) {\n      case XML_SUSPENDED:\n        XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);\n        positionPtr = bufferPtr;\n        return XML_STATUS_SUSPENDED;\n      case XML_INITIALIZED:\n      case XML_PARSING:\n        ps_parsing = XML_FINISHED;\n        /* fall through */\n      default:\n        return XML_STATUS_OK;\n      }\n    }\n    eventEndPtr = eventPtr;\n    processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  }\n#ifndef XML_CONTEXT_BYTES\n  else if (bufferPtr == bufferEnd) {\n    const char *end;\n    int nLeftOver;\n    enum XML_Error result;\n    parseEndByteIndex += len;\n    positionPtr = s;\n    ps_finalBuffer = (XML_Bool)isFinal;\n\n    errorCode = processor(parser, s, parseEndPtr = s + len, &end);\n\n    if (errorCode != XML_ERROR_NONE) {\n      eventEndPtr = eventPtr;\n      processor = errorProcessor;\n      return XML_STATUS_ERROR;\n    }\n    else {\n      switch (ps_parsing) {\n      case XML_SUSPENDED:\n        result = XML_STATUS_SUSPENDED;\n        break;\n      case XML_INITIALIZED:\n      case XML_PARSING:\n        if (isFinal) {\n          ps_parsing = XML_FINISHED;\n          return XML_STATUS_OK;\n        }\n      /* fall through */\n      default:\n        result = XML_STATUS_OK;\n      }\n    }\n\n    XmlUpdatePosition(encoding, positionPtr, end, &position);\n    nLeftOver = s + len - end;\n    if (nLeftOver) {\n      if (buffer == NULL || nLeftOver > bufferLim - buffer) {\n        /* FIXME avoid integer overflow */\n        char *temp;\n        temp = (buffer == NULL\n                ? (char *)MALLOC(len * 2)\n                : (char *)REALLOC(buffer, len * 2));\n        if (temp == NULL) {\n          errorCode = XML_ERROR_NO_MEMORY;\n          eventPtr = eventEndPtr = NULL;\n          processor = errorProcessor;\n          return XML_STATUS_ERROR;\n        }\n        buffer = temp;\n        bufferLim = buffer + len * 2;\n      }\n      memcpy(buffer, end, nLeftOver);\n    }\n    bufferPtr = buffer;\n    bufferEnd = buffer + nLeftOver;\n    positionPtr = bufferPtr;\n    parseEndPtr = bufferEnd;\n    eventPtr = bufferPtr;\n    eventEndPtr = 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{\n  const char *start;\n  enum XML_Status result = XML_STATUS_OK;\n\n  switch (ps_parsing) {\n  case XML_SUSPENDED:\n    errorCode = XML_ERROR_SUSPENDED;\n    return XML_STATUS_ERROR;\n  case XML_FINISHED:\n    errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  case XML_INITIALIZED:\n    if (parentParser == NULL && !startParsing(parser)) {\n      errorCode = XML_ERROR_NO_MEMORY;\n      return XML_STATUS_ERROR;\n    }\n  default:\n    ps_parsing = XML_PARSING;\n  }\n\n  start = bufferPtr;\n  positionPtr = start;\n  bufferEnd += len;\n  parseEndPtr = bufferEnd;\n  parseEndByteIndex += len;\n  ps_finalBuffer = (XML_Bool)isFinal;\n\n  errorCode = processor(parser, start, parseEndPtr, &bufferPtr);\n\n  if (errorCode != XML_ERROR_NONE) {\n    eventEndPtr = eventPtr;\n    processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  }\n  else {\n    switch (ps_parsing) {\n    case XML_SUSPENDED:\n      result = XML_STATUS_SUSPENDED;\n      break;\n    case XML_INITIALIZED:\n    case XML_PARSING:\n      if (isFinal) {\n        ps_parsing = XML_FINISHED;\n        return result;\n      }\n    default: ;  /* should not happen */\n    }\n  }\n\n  XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);\n  positionPtr = bufferPtr;\n  return result;\n}\n\nvoid * XMLCALL\nXML_GetBuffer(XML_Parser parser, int len)\n{\n  switch (ps_parsing) {\n  case XML_SUSPENDED:\n    errorCode = XML_ERROR_SUSPENDED;\n    return NULL;\n  case XML_FINISHED:\n    errorCode = XML_ERROR_FINISHED;\n    return NULL;\n  default: ;\n  }\n\n  if (len > bufferLim - bufferEnd) {\n    /* FIXME avoid integer overflow */\n    int neededSize = len + (int)(bufferEnd - bufferPtr);\n#ifdef XML_CONTEXT_BYTES\n    int keep = (int)(bufferPtr - buffer);\n\n    if (keep > XML_CONTEXT_BYTES)\n      keep = XML_CONTEXT_BYTES;\n    neededSize += keep;\n#endif  /* defined XML_CONTEXT_BYTES */\n    if (neededSize  <= bufferLim - buffer) {\n#ifdef XML_CONTEXT_BYTES\n      if (keep < bufferPtr - buffer) {\n        int offset = (int)(bufferPtr - buffer) - keep;\n        memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);\n        bufferEnd -= offset;\n        bufferPtr -= offset;\n      }\n#else\n      memmove(buffer, bufferPtr, bufferEnd - bufferPtr);\n      bufferEnd = buffer + (bufferEnd - bufferPtr);\n      bufferPtr = buffer;\n#endif  /* not defined XML_CONTEXT_BYTES */\n    }\n    else {\n      char *newBuf;\n      int bufferSize = (int)(bufferLim - bufferPtr);\n      if (bufferSize == 0)\n        bufferSize = INIT_BUFFER_SIZE;\n      do {\n        bufferSize *= 2;\n      } while (bufferSize < neededSize);\n      newBuf = (char *)MALLOC(bufferSize);\n      if (newBuf == 0) {\n        errorCode = XML_ERROR_NO_MEMORY;\n        return NULL;\n      }\n      bufferLim = newBuf + bufferSize;\n#ifdef XML_CONTEXT_BYTES\n      if (bufferPtr) {\n        int keep = (int)(bufferPtr - buffer);\n        if (keep > XML_CONTEXT_BYTES)\n          keep = XML_CONTEXT_BYTES;\n        memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);\n        FREE(buffer);\n        buffer = newBuf;\n        bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;\n        bufferPtr = buffer + keep;\n      }\n      else {\n        bufferEnd = newBuf + (bufferEnd - bufferPtr);\n        bufferPtr = buffer = newBuf;\n      }\n#else\n      if (bufferPtr) {\n        memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);\n        FREE(buffer);\n      }\n      bufferEnd = newBuf + (bufferEnd - bufferPtr);\n      bufferPtr = buffer = newBuf;\n#endif  /* not defined XML_CONTEXT_BYTES */\n    }\n    eventPtr = eventEndPtr = NULL;\n    positionPtr = NULL;\n  }\n  return bufferEnd;\n}\n\nenum XML_Status XMLCALL\nXML_StopParser(XML_Parser parser, XML_Bool resumable)\n{\n  switch (ps_parsing) {\n  case XML_SUSPENDED:\n    if (resumable) {\n      errorCode = XML_ERROR_SUSPENDED;\n      return XML_STATUS_ERROR;\n    }\n    ps_parsing = XML_FINISHED;\n    break;\n  case XML_FINISHED:\n    errorCode = XML_ERROR_FINISHED;\n    return XML_STATUS_ERROR;\n  default:\n    if (resumable) {\n#ifdef XML_DTD\n      if (isParamEntity) {\n        errorCode = XML_ERROR_SUSPEND_PE;\n        return XML_STATUS_ERROR;\n      }\n#endif\n      ps_parsing = XML_SUSPENDED;\n    }\n    else\n      ps_parsing = XML_FINISHED;\n  }\n  return XML_STATUS_OK;\n}\n\nenum XML_Status XMLCALL\nXML_ResumeParser(XML_Parser parser)\n{\n  enum XML_Status result = XML_STATUS_OK;\n\n  if (ps_parsing != XML_SUSPENDED) {\n    errorCode = XML_ERROR_NOT_SUSPENDED;\n    return XML_STATUS_ERROR;\n  }\n  ps_parsing = XML_PARSING;\n\n  errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);\n\n  if (errorCode != XML_ERROR_NONE) {\n    eventEndPtr = eventPtr;\n    processor = errorProcessor;\n    return XML_STATUS_ERROR;\n  }\n  else {\n    switch (ps_parsing) {\n    case XML_SUSPENDED:\n      result = XML_STATUS_SUSPENDED;\n      break;\n    case XML_INITIALIZED:\n    case XML_PARSING:\n      if (ps_finalBuffer) {\n        ps_parsing = XML_FINISHED;\n        return result;\n      }\n    default: ;\n    }\n  }\n\n  XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);\n  positionPtr = bufferPtr;\n  return result;\n}\n\nvoid XMLCALL\nXML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status)\n{\n  assert(status != NULL);\n  *status = parser->m_parsingStatus;\n}\n\nenum XML_Error XMLCALL\nXML_GetErrorCode(XML_Parser parser)\n{\n  return errorCode;\n}\n\nXML_Index XMLCALL\nXML_GetCurrentByteIndex(XML_Parser parser)\n{\n  if (eventPtr)\n    return parseEndByteIndex - (parseEndPtr - eventPtr);\n  return -1;\n}\n\nint XMLCALL\nXML_GetCurrentByteCount(XML_Parser parser)\n{\n  if (eventEndPtr && eventPtr)\n    return (int)(eventEndPtr - eventPtr);\n  return 0;\n}\n\nconst char * XMLCALL\nXML_GetInputContext(XML_Parser parser, int *offset, int *size)\n{\n#ifdef XML_CONTEXT_BYTES\n  if (eventPtr && buffer) {\n    *offset = (int)(eventPtr - buffer);\n    *size   = (int)(bufferEnd - buffer);\n    return buffer;\n  }\n#endif /* defined XML_CONTEXT_BYTES */\n  return (char *) 0;\n}\n\nXML_Size XMLCALL\nXML_GetCurrentLineNumber(XML_Parser parser)\n{\n  if (eventPtr && eventPtr >= positionPtr) {\n    XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);\n    positionPtr = eventPtr;\n  }\n  return position.lineNumber + 1;\n}\n\nXML_Size XMLCALL\nXML_GetCurrentColumnNumber(XML_Parser parser)\n{\n  if (eventPtr && eventPtr >= positionPtr) {\n    XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);\n    positionPtr = eventPtr;\n  }\n  return position.columnNumber;\n}\n\nvoid XMLCALL\nXML_FreeContentModel(XML_Parser parser, XML_Content *model)\n{\n  FREE(model);\n}\n\nvoid * XMLCALL\nXML_MemMalloc(XML_Parser parser, size_t size)\n{\n  return MALLOC(size);\n}\n\nvoid * XMLCALL\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size)\n{\n  return REALLOC(ptr, size);\n}\n\nvoid XMLCALL\nXML_MemFree(XML_Parser parser, void *ptr)\n{\n  FREE(ptr);\n}\n\nvoid XMLCALL\nXML_DefaultCurrent(XML_Parser parser)\n{\n  if (defaultHandler) {\n    if (openInternalEntities)\n      reportDefault(parser,\n                    internalEncoding,\n                    openInternalEntities->internalEventPtr,\n                    openInternalEntities->internalEventEndPtr);\n    else\n      reportDefault(parser, encoding, eventPtr, eventEndPtr);\n  }\n}\n\nconst XML_LChar * XMLCALL\nXML_ErrorString(enum XML_Error code)\n{\n  static const XML_LChar* const message[] = {\n    0,\n    XML_L(\"out of memory\"),\n    XML_L(\"syntax error\"),\n    XML_L(\"no element found\"),\n    XML_L(\"not well-formed (invalid token)\"),\n    XML_L(\"unclosed token\"),\n    XML_L(\"partial character\"),\n    XML_L(\"mismatched tag\"),\n    XML_L(\"duplicate attribute\"),\n    XML_L(\"junk after document element\"),\n    XML_L(\"illegal parameter entity reference\"),\n    XML_L(\"undefined entity\"),\n    XML_L(\"recursive entity reference\"),\n    XML_L(\"asynchronous entity\"),\n    XML_L(\"reference to invalid character number\"),\n    XML_L(\"reference to binary entity\"),\n    XML_L(\"reference to external entity in attribute\"),\n    XML_L(\"XML or text declaration not at start of entity\"),\n    XML_L(\"unknown encoding\"),\n    XML_L(\"encoding specified in XML declaration is incorrect\"),\n    XML_L(\"unclosed CDATA section\"),\n    XML_L(\"error in processing external entity reference\"),\n    XML_L(\"document is not standalone\"),\n    XML_L(\"unexpected parser state - please send a bug report\"),\n    XML_L(\"entity declared in parameter entity\"),\n    XML_L(\"requested feature requires XML_DTD support in Expat\"),\n    XML_L(\"cannot change setting once parsing has begun\"),\n    XML_L(\"unbound prefix\"),\n    XML_L(\"must not undeclare prefix\"),\n    XML_L(\"incomplete markup in parameter entity\"),\n    XML_L(\"XML declaration not well-formed\"),\n    XML_L(\"text declaration not well-formed\"),\n    XML_L(\"illegal character(s) in public id\"),\n    XML_L(\"parser suspended\"),\n    XML_L(\"parser not suspended\"),\n    XML_L(\"parsing aborted\"),\n    XML_L(\"parsing finished\"),\n    XML_L(\"cannot suspend in external parameter entity\"),\n    XML_L(\"reserved prefix (xml) must not be undeclared or bound to another namespace name\"),\n    XML_L(\"reserved prefix (xmlns) must not be declared or undeclared\"),\n    XML_L(\"prefix must not be bound to one of the reserved namespace names\")\n  };\n  if (code > 0 && code < sizeof(message)/sizeof(message[0]))\n    return message[code];\n  return NULL;\n}\n\nconst XML_LChar * XMLCALL\nXML_ExpatVersion(void) {\n\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{\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{\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\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{\n  TAG *tag = 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 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(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 = (XML_Char *)temp + (tag->name.localPart -\n                                                  (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,\n                 const char *start,\n                 const char *end,\n                 const char **endPtr)\n{\n  enum XML_Error result = doContent(parser, 0, encoding, start, end,\n                                    endPtr, (XML_Bool)!ps_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,\n                            const char *start,\n                            const char *end,\n                            const char **endPtr)\n{\n  enum XML_Error result = initializeEncoding(parser);\n  if (result != XML_ERROR_NONE)\n    return result;\n  processor = externalEntityInitProcessor2;\n  return externalEntityInitProcessor2(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityInitProcessor2(XML_Parser parser,\n                             const char *start,\n                             const char *end,\n                             const char **endPtr)\n{\n  const char *next = start; /* XmlContentTok doesn't always set the last arg */\n  int tok = XmlContentTok(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 && !ps_finalBuffer) {\n      *endPtr = next;\n      return XML_ERROR_NONE;\n    }\n    start = next;\n    break;\n  case XML_TOK_PARTIAL:\n    if (!ps_finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    eventPtr = start;\n    return XML_ERROR_UNCLOSED_TOKEN;\n  case XML_TOK_PARTIAL_CHAR:\n    if (!ps_finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    eventPtr = start;\n    return XML_ERROR_PARTIAL_CHAR;\n  }\n  processor = externalEntityInitProcessor3;\n  return externalEntityInitProcessor3(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityInitProcessor3(XML_Parser parser,\n                             const char *start,\n                             const char *end,\n                             const char **endPtr)\n{\n  int tok;\n  const char *next = start; /* XmlContentTok doesn't always set the last arg */\n  eventPtr = start;\n  tok = XmlContentTok(encoding, start, end, &next);\n  eventEndPtr = next;\n\n  switch (tok) {\n  case XML_TOK_XML_DECL:\n    {\n      enum XML_Error result;\n      result = processXmlDecl(parser, 1, start, next);\n      if (result != XML_ERROR_NONE)\n        return result;\n      switch (ps_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    }\n    break;\n  case XML_TOK_PARTIAL:\n    if (!ps_finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_UNCLOSED_TOKEN;\n  case XML_TOK_PARTIAL_CHAR:\n    if (!ps_finalBuffer) {\n      *endPtr = start;\n      return XML_ERROR_NONE;\n    }\n    return XML_ERROR_PARTIAL_CHAR;\n  }\n  processor = externalEntityContentProcessor;\n  tagLevel = 1;\n  return externalEntityContentProcessor(parser, start, end, endPtr);\n}\n\nstatic enum XML_Error PTRCALL\nexternalEntityContentProcessor(XML_Parser parser,\n                               const char *start,\n                               const char *end,\n                               const char **endPtr)\n{\n  enum XML_Error result = doContent(parser, 1, encoding, start, end,\n                                    endPtr, (XML_Bool)!ps_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,\n          int startTagLevel,\n          const ENCODING *enc,\n          const char *s,\n          const char *end,\n          const char **nextPtr,\n          XML_Bool haveMore)\n{\n  /* save one level of indirection */\n  DTD * const dtd = _dtd;\n\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == encoding) {\n    eventPP = &eventPtr;\n    eventEndPP = &eventEndPtr;\n  }\n  else {\n    eventPP = &(openInternalEntities->internalEventPtr);\n    eventEndPP = &(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 (characterDataHandler) {\n        XML_Char c = 0xA;\n        characterDataHandler(handlerArg, &c, 1);\n      }\n      else if (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 (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 (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      {\n        const XML_Char *name;\n        ENTITY *entity;\n        XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,\n                                              s + enc->minBytesPerChar,\n                                              next - enc->minBytesPerChar);\n        if (ch) {\n          if (characterDataHandler)\n            characterDataHandler(handlerArg, &ch, 1);\n          else if (defaultHandler)\n            reportDefault(parser, enc, s, next);\n          break;\n        }\n        name = poolStoreString(&dtd->pool, enc,\n                                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        }\n        else if (!entity) {\n          if (skippedEntityHandler)\n            skippedEntityHandler(handlerArg, name, 0);\n          else if (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 (!defaultExpandInternalEntities) {\n            if (skippedEntityHandler)\n              skippedEntityHandler(handlerArg, entity->name, 0);\n            else if (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        }\n        else if (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 (!externalEntityRefHandler(externalEntityRefHandlerArg,\n                                        context,\n                                        entity->base,\n                                        entity->systemId,\n                                        entity->publicId))\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          poolDiscard(&tempPool);\n        }\n        else if (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      {\n        TAG *tag;\n        enum XML_Error result;\n        XML_Char *toPtr;\n        if (freeTagList) {\n          tag = freeTagList;\n          freeTagList = freeTagList->parent;\n        }\n        else {\n          tag = (TAG *)MALLOC(sizeof(TAG));\n          if (!tag)\n            return XML_ERROR_NO_MEMORY;\n          tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE);\n          if (!tag->buf) {\n            FREE(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 = tagStack;\n        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        ++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            XmlConvert(enc,\n                       &fromPtr, rawNameEnd,\n                       (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);\n            convLen = (int)(toPtr - (XML_Char *)tag->buf);\n            if (fromPtr == rawNameEnd) {\n              tag->name.strLen = convLen;\n              break;\n            }\n            bufSize = (int)(tag->bufEnd - tag->buf) << 1;\n            {\n              char *temp = (char *)REALLOC(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 (startElementHandler)\n          startElementHandler(handlerArg, tag->name.str,\n                              (const XML_Char **)atts);\n        else if (defaultHandler)\n          reportDefault(parser, enc, s, next);\n        poolClear(&tempPool);\n        break;\n      }\n    case XML_TOK_EMPTY_ELEMENT_NO_ATTS:\n      /* fall through */\n    case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:\n      {\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(&tempPool, enc, rawName,\n                                   rawName + XmlNameLength(enc, rawName));\n        if (!name.str)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&tempPool);\n        result = storeAtts(parser, enc, s, &name, &bindings);\n        if (result)\n          return result;\n        poolFinish(&tempPool);\n        if (startElementHandler) {\n          startElementHandler(handlerArg, name.str, (const XML_Char **)atts);\n          noElmHandlers = XML_FALSE;\n        }\n        if (endElementHandler) {\n          if (startElementHandler)\n            *eventPP = *eventEndPP;\n          endElementHandler(handlerArg, name.str);\n          noElmHandlers = XML_FALSE;\n        }\n        if (noElmHandlers && defaultHandler)\n          reportDefault(parser, enc, s, next);\n        poolClear(&tempPool);\n        while (bindings) {\n          BINDING *b = bindings;\n          if (endNamespaceDeclHandler)\n            endNamespaceDeclHandler(handlerArg, b->prefix->name);\n          bindings = bindings->nextTagBinding;\n          b->nextTagBinding = freeBindingList;\n          freeBindingList = b;\n          b->prefix->binding = b->prevPrefixBinding;\n        }\n      }\n      if (tagLevel == 0)\n        return epilogProcessor(parser, next, end, nextPtr);\n      break;\n    case XML_TOK_END_TAG:\n      if (tagLevel == startTagLevel)\n        return XML_ERROR_ASYNC_ENTITY;\n      else {\n        int len;\n        const char *rawName;\n        TAG *tag = tagStack;\n        tagStack = tag->parent;\n        tag->parent = freeTagList;\n        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        --tagLevel;\n        if (endElementHandler) {\n          const XML_Char *localPart;\n          const XML_Char *prefix;\n          XML_Char *uri;\n          localPart = tag->name.localPart;\n          if (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) *uri++ = *localPart++;\n            prefix = (XML_Char *)tag->name.prefix;\n            if (ns_triplets && prefix) {\n              *uri++ = namespaceSeparator;\n              while (*prefix) *uri++ = *prefix++;\n             }\n            *uri = XML_T('\\0');\n          }\n          endElementHandler(handlerArg, tag->name.str);\n        }\n        else if (defaultHandler)\n          reportDefault(parser, enc, s, next);\n        while (tag->bindings) {\n          BINDING *b = tag->bindings;\n          if (endNamespaceDeclHandler)\n            endNamespaceDeclHandler(handlerArg, b->prefix->name);\n          tag->bindings = tag->bindings->nextTagBinding;\n          b->nextTagBinding = freeBindingList;\n          freeBindingList = b;\n          b->prefix->binding = b->prevPrefixBinding;\n        }\n        if (tagLevel == 0)\n          return epilogProcessor(parser, next, end, nextPtr);\n      }\n      break;\n    case XML_TOK_CHAR_REF:\n      {\n        int n = XmlCharRefNumber(enc, s);\n        if (n < 0)\n          return XML_ERROR_BAD_CHAR_REF;\n        if (characterDataHandler) {\n          XML_Char buf[XML_ENCODE_MAX];\n          characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));\n        }\n        else if (defaultHandler)\n          reportDefault(parser, enc, s, next);\n      }\n      break;\n    case XML_TOK_XML_DECL:\n      return XML_ERROR_MISPLACED_XML_PI;\n    case XML_TOK_DATA_NEWLINE:\n      if (characterDataHandler) {\n        XML_Char c = 0xA;\n        characterDataHandler(handlerArg, &c, 1);\n      }\n      else if (defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    case XML_TOK_CDATA_SECT_OPEN:\n      {\n        enum XML_Error result;\n        if (startCdataSectionHandler)\n          startCdataSectionHandler(handlerArg);\n#if 0\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 (characterDataHandler)\n          characterDataHandler(handlerArg, dataBuf, 0);\n#endif\n        else if (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          processor = cdataSectionProcessor;\n          return result;\n        }\n      }\n      break;\n    case XML_TOK_TRAILING_RSQB:\n      if (haveMore) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      if (characterDataHandler) {\n        if (MUST_CONVERT(enc, s)) {\n          ICHAR *dataPtr = (ICHAR *)dataBuf;\n          XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);\n          characterDataHandler(handlerArg, dataBuf,\n                               (int)(dataPtr - (ICHAR *)dataBuf));\n        }\n        else\n          characterDataHandler(handlerArg,\n                               (XML_Char *)s,\n                               (int)((XML_Char *)end - (XML_Char *)s));\n      }\n      else if (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 (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      {\n        XML_CharacterDataHandler charDataHandler = characterDataHandler;\n        if (charDataHandler) {\n          if (MUST_CONVERT(enc, s)) {\n            for (;;) {\n              ICHAR *dataPtr = (ICHAR *)dataBuf;\n              XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);\n              *eventEndPP = s;\n              charDataHandler(handlerArg, dataBuf,\n                              (int)(dataPtr - (ICHAR *)dataBuf));\n              if (s == next)\n                break;\n              *eventPP = s;\n            }\n          }\n          else\n            charDataHandler(handlerArg,\n                            (XML_Char *)s,\n                            (int)((XML_Char *)next - (XML_Char *)s));\n        }\n        else if (defaultHandler)\n          reportDefault(parser, enc, s, next);\n      }\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      if (defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    }\n    *eventPP = s = next;\n    switch (ps_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/* 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,\n          const char *attStr, TAG_NAME *tagNamePtr,\n          BINDING **bindingsPtr)\n{\n  DTD * const dtd = _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 = (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 (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, attsSize, atts);\n  if (n + nDefaultAtts > attsSize) {\n    int oldAttsSize = attsSize;\n    ATTRIBUTE *temp;\n#ifdef XML_ATTR_INFO\n    XML_AttrInfo *temp2;\n#endif\n    attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;\n    temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));\n    if (temp == NULL)\n      return XML_ERROR_NO_MEMORY;\n    atts = temp;\n#ifdef XML_ATTR_INFO\n    temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo));\n    if (temp2 == NULL)\n      return XML_ERROR_NO_MEMORY;\n    attInfo = temp2;\n#endif\n    if (n > oldAttsSize)\n      XmlGetAttributes(enc, attStr, n, atts);\n  }\n\n  appAtts = (const XML_Char **)atts;\n  for (i = 0; i < n; i++) {\n    ATTRIBUTE *currAtt = &atts[i];\n#ifdef XML_ATTR_INFO\n    XML_AttrInfo *currAttInfo = &attInfo[i];\n#endif\n    /* add the name and value to the attribute list */\n    ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name,\n                                         currAtt->name\n                                         + XmlNameLength(enc, currAtt->name));\n    if (!attId)\n      return XML_ERROR_NO_MEMORY;\n#ifdef XML_ATTR_INFO\n    currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name);\n    currAttInfo->nameEnd = currAttInfo->nameStart +\n                           XmlNameLength(enc, currAtt->name);\n    currAttInfo->valueStart = parseEndByteIndex -\n                            (parseEndPtr - currAtt->valuePtr);\n    currAttInfo->valueEnd = parseEndByteIndex - (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 == encoding)\n        eventPtr = atts[i].name;\n      return XML_ERROR_DUPLICATE_ATTRIBUTE;\n    }\n    (attId->name)[-1] = 1;\n    appAtts[attIndex++] = attId->name;\n    if (!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(parser, enc, isCdata,\n                                   atts[i].valuePtr, atts[i].valueEnd,\n                                   &tempPool);\n      if (result)\n        return result;\n      appAtts[attIndex] = poolStart(&tempPool);\n      poolFinish(&tempPool);\n    }\n    else {\n      /* the value did not need normalizing */\n      appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr,\n                                          atts[i].valueEnd);\n      if (appAtts[attIndex] == 0)\n        return XML_ERROR_NO_MEMORY;\n      poolFinish(&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      }\n      else {\n        /* deal with other prefixed names later */\n        attIndex++;\n        nPrefixes++;\n        (attId->name)[-1] = 2;\n      }\n    }\n    else\n      attIndex++;\n  }\n\n  /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */\n  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        idAttIndex = i;\n        break;\n      }\n  }\n  else\n    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        }\n        else {\n          (da->id->name)[-1] = 2;\n          nPrefixes++;\n          appAtts[attIndex++] = da->id->name;\n          appAtts[attIndex++] = da->value;\n        }\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 = nsAttsVersion;\n    int nsAttsSize = (int)1 << nsAttsPower;\n    /* size of hash table must be at least 2 * (# of prefixed attributes) */\n    if ((nPrefixes << 1) >> nsAttsPower) {  /* true for nsAttsPower = 0 */\n      NS_ATT *temp;\n      /* hash table size must also be a power of 2 and >= 8 */\n      while (nPrefixes >> nsAttsPower++);\n      if (nsAttsPower < 3)\n        nsAttsPower = 3;\n      nsAttsSize = (int)1 << nsAttsPower;\n      temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT));\n      if (!temp)\n        return XML_ERROR_NO_MEMORY;\n      nsAtts = temp;\n      version = 0;  /* force re-initialization of nsAtts hash table */\n    }\n    /* using a version flag saves us from initializing 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        nsAtts[--j].version = version;\n    }\n    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 = hash_secret_salt;\n        ((XML_Char *)s)[-1] = 0;  /* clear flag */\n        id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);\n        b = id->prefix->binding;\n        if (!b)\n          return XML_ERROR_UNBOUND_PREFIX;\n\n        /* as we expand the name we also calculate its hash value */\n        for (j = 0; j < b->uriLen; j++) {\n          const XML_Char c = b->uri[j];\n          if (!poolAppendChar(&tempPool, c))\n            return XML_ERROR_NO_MEMORY;\n          uriHash = CHAR_HASH(uriHash, c);\n        }\n        while (*s++ != XML_T(ASCII_COLON))\n          ;\n        do {  /* copies null terminator */\n          const XML_Char c = *s;\n          if (!poolAppendChar(&tempPool, *s))\n            return XML_ERROR_NO_MEMORY;\n          uriHash = CHAR_HASH(uriHash, c);\n        } while (*s++);\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 (nsAtts[j].version == version) {\n            /* for speed we compare stored hash values first */\n            if (uriHash == nsAtts[j].hash) {\n              const XML_Char *s1 = poolStart(&tempPool);\n              const XML_Char *s2 = nsAtts[j].uriName;\n              /* s1 is null terminated, but not s2 */\n              for (; *s1 == *s2 && *s1 != 0; s1++, s2++);\n              if (*s1 == 0)\n                return XML_ERROR_DUPLICATE_ATTRIBUTE;\n            }\n            if (!step)\n              step = PROBE_STEP(uriHash, mask, nsAttsPower);\n            j < step ? (j += nsAttsSize - step) : (j -= step);\n          }\n        }\n\n        if (ns_triplets) {  /* append namespace separator and prefix */\n          tempPool.ptr[-1] = namespaceSeparator;\n          s = b->prefix->name;\n          do {\n            if (!poolAppendChar(&tempPool, *s))\n              return XML_ERROR_NO_MEMORY;\n          } while (*s++);\n        }\n\n        /* store expanded name in attribute list */\n        s = poolStart(&tempPool);\n        poolFinish(&tempPool);\n        appAtts[i] = s;\n\n        /* fill empty slot with new version, uriName and hash value */\n        nsAtts[j].version = version;\n        nsAtts[j].hash = uriHash;\n        nsAtts[j].uriName = s;\n\n        if (!--nPrefixes) {\n          i += 2;\n          break;\n        }\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 (!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  }\n  else if (dtd->defaultPrefix.binding) {\n    binding = dtd->defaultPrefix.binding;\n    localPart = tagNamePtr->str;\n  }\n  else\n    return XML_ERROR_NONE;\n  prefixLen = 0;\n  if (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((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 = tagStack; p; p = p->parent)\n      if (p->name.str == binding->uri)\n        p->name.str = uri;\n    FREE(binding->uri);\n    binding->uri = uri;\n  }\n  /* if 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 = 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{\n  static const XML_Char xmlNamespace[] = {\n    ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,\n    ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,\n    ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L,\n    ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH,\n    ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c,\n    ASCII_e, '\\0'\n  };\n  static const int xmlLen =\n    (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, ASCII_SLASH,\n    ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,\n    ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0,\n    ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s,\n    ASCII_SLASH, '\\0'\n  };\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\n      && prefix->name[0] == XML_T(ASCII_x)\n      && prefix->name[1] == XML_T(ASCII_m)\n      && prefix->name[2] == XML_T(ASCII_l)) {\n\n    /* Not allowed to bind xmlns */\n    if (prefix->name[3] == XML_T(ASCII_n)\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 (namespaceSeparator)\n    len++;\n  if (freeBindingList) {\n    b = freeBindingList;\n    if (len > b->uriAlloc) {\n      XML_Char *temp = (XML_Char *)REALLOC(b->uri,\n                          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    freeBindingList = b->nextTagBinding;\n  }\n  else {\n    b = (BINDING *)MALLOC(sizeof(BINDING));\n    if (!b)\n      return XML_ERROR_NO_MEMORY;\n    b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));\n    if (!b->uri) {\n      FREE(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 (namespaceSeparator)\n    b->uri[len - 1] = 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 == &_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 && startNamespaceDeclHandler)\n    startNamespaceDeclHandler(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,\n                      const char *start,\n                      const char *end,\n                      const char **endPtr)\n{\n  enum XML_Error result = doCdataSection(parser, encoding, &start, end,\n                                         endPtr, (XML_Bool)!ps_finalBuffer);\n  if (result != XML_ERROR_NONE)\n    return result;\n  if (start) {\n    if (parentParser) {  /* we are parsing an external entity */\n      processor = externalEntityContentProcessor;\n      return externalEntityContentProcessor(parser, start, end, endPtr);\n    }\n    else {\n      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,\n               const ENCODING *enc,\n               const char **startPtr,\n               const char *end,\n               const char **nextPtr,\n               XML_Bool haveMore)\n{\n  const char *s = *startPtr;\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == encoding) {\n    eventPP = &eventPtr;\n    *eventPP = s;\n    eventEndPP = &eventEndPtr;\n  }\n  else {\n    eventPP = &(openInternalEntities->internalEventPtr);\n    eventEndPP = &(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 (endCdataSectionHandler)\n        endCdataSectionHandler(handlerArg);\n#if 0\n      /* see comment under XML_TOK_CDATA_SECT_OPEN */\n      else if (characterDataHandler)\n        characterDataHandler(handlerArg, dataBuf, 0);\n#endif\n      else if (defaultHandler)\n        reportDefault(parser, enc, s, next);\n      *startPtr = next;\n      *nextPtr = next;\n      if (ps_parsing == XML_FINISHED)\n        return XML_ERROR_ABORTED;\n      else\n        return XML_ERROR_NONE;\n    case XML_TOK_DATA_NEWLINE:\n      if (characterDataHandler) {\n        XML_Char c = 0xA;\n        characterDataHandler(handlerArg, &c, 1);\n      }\n      else if (defaultHandler)\n        reportDefault(parser, enc, s, next);\n      break;\n    case XML_TOK_DATA_CHARS:\n      {\n        XML_CharacterDataHandler charDataHandler = characterDataHandler;\n        if (charDataHandler) {\n          if (MUST_CONVERT(enc, s)) {\n            for (;;) {\n              ICHAR *dataPtr = (ICHAR *)dataBuf;\n              XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);\n              *eventEndPP = next;\n              charDataHandler(handlerArg, dataBuf,\n                              (int)(dataPtr - (ICHAR *)dataBuf));\n              if (s == next)\n                break;\n              *eventPP = s;\n            }\n          }\n          else\n            charDataHandler(handlerArg,\n                            (XML_Char *)s,\n                            (int)((XML_Char *)next - (XML_Char *)s));\n        }\n        else if (defaultHandler)\n          reportDefault(parser, enc, s, next);\n      }\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      *eventPP = next;\n      return XML_ERROR_UNEXPECTED_STATE;\n    }\n\n    *eventPP = s = next;\n    switch (ps_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,\n                       const char *start,\n                       const char *end,\n                       const char **endPtr)\n{\n  enum XML_Error result = doIgnoreSection(parser, encoding, &start, end,\n                                          endPtr, (XML_Bool)!ps_finalBuffer);\n  if (result != XML_ERROR_NONE)\n    return result;\n  if (start) {\n    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,\n                const ENCODING *enc,\n                const char **startPtr,\n                const char *end,\n                const char **nextPtr,\n                XML_Bool haveMore)\n{\n  const char *next;\n  int tok;\n  const char *s = *startPtr;\n  const char **eventPP;\n  const char **eventEndPP;\n  if (enc == encoding) {\n    eventPP = &eventPtr;\n    *eventPP = s;\n    eventEndPP = &eventEndPtr;\n  }\n  else {\n    eventPP = &(openInternalEntities->internalEventPtr);\n    eventEndPP = &(openInternalEntities->internalEventEndPtr);\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 (defaultHandler)\n      reportDefault(parser, enc, s, next);\n    *startPtr = next;\n    *nextPtr = next;\n    if (ps_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    *eventPP = next;\n    return XML_ERROR_UNEXPECTED_STATE;\n  }\n  /* not reached */\n}\n\n#endif /* XML_DTD */\n\nstatic enum XML_Error\ninitializeEncoding(XML_Parser parser)\n{\n  const char *s;\n#ifdef XML_UNICODE\n  char encodingBuf[128];\n  if (!protocolEncodingName)\n    s = NULL;\n  else {\n    int i;\n    for (i = 0; protocolEncodingName[i]; i++) {\n      if (i == sizeof(encodingBuf) - 1\n          || (protocolEncodingName[i] & ~0x7f) != 0) {\n        encodingBuf[0] = '\\0';\n        break;\n      }\n      encodingBuf[i] = (char)protocolEncodingName[i];\n    }\n    encodingBuf[i] = '\\0';\n    s = encodingBuf;\n  }\n#else\n  s = protocolEncodingName;\n#endif\n  if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))\n    return XML_ERROR_NONE;\n  return handleUnknownEncoding(parser, protocolEncodingName);\n}\n\nstatic enum XML_Error\nprocessXmlDecl(XML_Parser parser, int isGeneralTextEntity,\n               const char *s, const char *next)\n{\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 (!(ns\n        ? XmlParseXmlDeclNS\n        : XmlParseXmlDecl)(isGeneralTextEntity,\n                           encoding,\n                           s,\n                           next,\n                           &eventPtr,\n                           &version,\n                           &versionend,\n                           &encodingName,\n                           &newEncoding,\n                           &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    _dtd->standalone = XML_TRUE;\n#ifdef XML_DTD\n    if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)\n      paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;\n#endif /* XML_DTD */\n  }\n  if (xmlDeclHandler) {\n    if (encodingName != NULL) {\n      storedEncName = poolStoreString(&temp2Pool,\n                                      encoding,\n                                      encodingName,\n                                      encodingName\n                                      + XmlNameLength(encoding, encodingName));\n      if (!storedEncName)\n              return XML_ERROR_NO_MEMORY;\n      poolFinish(&temp2Pool);\n    }\n    if (version) {\n      storedversion = poolStoreString(&temp2Pool,\n                                      encoding,\n                                      version,\n                                      versionend - encoding->minBytesPerChar);\n      if (!storedversion)\n        return XML_ERROR_NO_MEMORY;\n    }\n    xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone);\n  }\n  else if (defaultHandler)\n    reportDefault(parser, encoding, s, next);\n  if (protocolEncodingName == NULL) {\n    if (newEncoding) {\n      if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {\n        eventPtr = encodingName;\n        return XML_ERROR_INCORRECT_ENCODING;\n      }\n      encoding = newEncoding;\n    }\n    else if (encodingName) {\n      enum XML_Error result;\n      if (!storedEncName) {\n        storedEncName = poolStoreString(\n          &temp2Pool, encoding, encodingName,\n          encodingName + XmlNameLength(encoding, encodingName));\n        if (!storedEncName)\n          return XML_ERROR_NO_MEMORY;\n      }\n      result = handleUnknownEncoding(parser, storedEncName);\n      poolClear(&temp2Pool);\n      if (result == XML_ERROR_UNKNOWN_ENCODING)\n        eventPtr = encodingName;\n      return result;\n    }\n  }\n\n  if (storedEncName || storedversion)\n    poolClear(&temp2Pool);\n\n  return XML_ERROR_NONE;\n}\n\nstatic enum XML_Error\nhandleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)\n{\n  if (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 (unknownEncodingHandler(unknownEncodingHandlerData, encodingName,\n                               &info)) {\n      ENCODING *enc;\n      unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding());\n      if (!unknownEncodingMem) {\n        if (info.release)\n          info.release(info.data);\n        return XML_ERROR_NO_MEMORY;\n      }\n      enc = (ns\n             ? XmlInitUnknownEncodingNS\n             : XmlInitUnknownEncoding)(unknownEncodingMem,\n                                       info.map,\n                                       info.convert,\n                                       info.data);\n      if (enc) {\n        unknownEncodingData = info.data;\n        unknownEncodingRelease = info.release;\n        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,\n                    const char *s,\n                    const char *end,\n                    const char **nextPtr)\n{\n  enum XML_Error result = initializeEncoding(parser);\n  if (result != XML_ERROR_NONE)\n    return result;\n  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,\n                            const char *s,\n                            const char *end,\n                            const char **nextPtr)\n{\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  _dtd->paramEntityRead = XML_TRUE;\n\n  if (prologState.inEntityValue) {\n    processor = entityValueInitProcessor;\n    return entityValueInitProcessor(parser, s, end, nextPtr);\n  }\n  else {\n    processor = externalParEntProcessor;\n    return externalParEntProcessor(parser, s, end, nextPtr);\n  }\n}\n\nstatic enum XML_Error PTRCALL\nentityValueInitProcessor(XML_Parser parser,\n                         const char *s,\n                         const char *end,\n                         const char **nextPtr)\n{\n  int tok;\n  const char *start = s;\n  const char *next = start;\n  eventPtr = start;\n\n  for (;;) {\n    tok = XmlPrologTok(encoding, start, end, &next);\n    eventEndPtr = next;\n    if (tok <= 0) {\n      if (!ps_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, encoding, s, end);\n    }\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      switch (ps_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        *nextPtr = next;\n      }\n      /* stop scanning for text declaration - we found one */\n      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 && !ps_finalBuffer) {\n      *nextPtr = next;\n      return XML_ERROR_NONE;\n    }\n    start = next;\n    eventPtr = start;\n  }\n}\n\nstatic enum XML_Error PTRCALL\nexternalParEntProcessor(XML_Parser parser,\n                        const char *s,\n                        const char *end,\n                        const char **nextPtr)\n{\n  const char *next = s;\n  int tok;\n\n  tok = XmlPrologTok(encoding, s, end, &next);\n  if (tok <= 0) {\n    if (!ps_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(encoding, s, end, &next);\n  }\n\n  processor = prologProcessor;\n  return doProlog(parser, encoding, s, end, tok, next,\n                  nextPtr, (XML_Bool)!ps_finalBuffer);\n}\n\nstatic enum XML_Error PTRCALL\nentityValueProcessor(XML_Parser parser,\n                     const char *s,\n                     const char *end,\n                     const char **nextPtr)\n{\n  const char *start = s;\n  const char *next = s;\n  const ENCODING *enc = encoding;\n  int tok;\n\n  for (;;) {\n    tok = XmlPrologTok(enc, start, end, &next);\n    if (tok <= 0) {\n      if (!ps_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,\n                const char *s,\n                const char *end,\n                const char **nextPtr)\n{\n  const char *next = s;\n  int tok = XmlPrologTok(encoding, s, end, &next);\n  return doProlog(parser, encoding, s, end, tok, next,\n                  nextPtr, (XML_Bool)!ps_finalBuffer);\n}\n\nstatic enum XML_Error\ndoProlog(XML_Parser parser,\n         const ENCODING *enc,\n         const char *s,\n         const char *end,\n         int tok,\n         const char *next,\n         const char **nextPtr,\n         XML_Bool haveMore)\n{\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[] = { ASCII_E, ASCII_N,\n      ASCII_T, ASCII_I, ASCII_T, 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[] = { ASCII_N, ASCII_M, ASCII_T,\n      ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\\0' };\n  static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,\n      ASCII_A, ASCII_T, 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 = _dtd;\n\n  const char **eventPP;\n  const char **eventEndPP;\n  enum XML_Content_Quant quant;\n\n  if (enc == encoding) {\n    eventPP = &eventPtr;\n    eventEndPP = &eventEndPtr;\n  }\n  else {\n    eventPP = &(openInternalEntities->internalEventPtr);\n    eventEndPP = &(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 != encoding && !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 (isParamEntity || enc != encoding) {\n          if (XmlTokenRole(&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(&prologState, tok, s, next, enc);\n    switch (role) {\n    case XML_ROLE_XML_DECL:\n      {\n        enum XML_Error result = processXmlDecl(parser, 0, s, next);\n        if (result != XML_ERROR_NONE)\n          return result;\n        enc = encoding;\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_DOCTYPE_NAME:\n      if (startDoctypeDeclHandler) {\n        doctypeName = poolStoreString(&tempPool, enc, s, next);\n        if (!doctypeName)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&tempPool);\n        doctypePubid = NULL;\n        handleDefault = XML_FALSE;\n      }\n      doctypeSysid = NULL; /* always initialize to NULL */\n      break;\n    case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:\n      if (startDoctypeDeclHandler) {\n        startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid,\n                                doctypePubid, 1);\n        doctypeName = NULL;\n        poolClear(&tempPool);\n        handleDefault = XML_FALSE;\n      }\n      break;\n#ifdef XML_DTD\n    case XML_ROLE_TEXT_DECL:\n      {\n        enum XML_Error result = processXmlDecl(parser, 1, s, next);\n        if (result != XML_ERROR_NONE)\n          return result;\n        enc = encoding;\n        handleDefault = XML_FALSE;\n      }\n      break;\n#endif /* XML_DTD */\n    case XML_ROLE_DOCTYPE_PUBLIC_ID:\n#ifdef XML_DTD\n      useForeignDTD = XML_FALSE;\n      declEntity = (ENTITY *)lookup(parser,\n                                    &dtd->paramEntities,\n                                    externalSubsetName,\n                                    sizeof(ENTITY));\n      if (!declEntity)\n        return XML_ERROR_NO_MEMORY;\n#endif /* XML_DTD */\n      dtd->hasParamEntityRefs = XML_TRUE;\n      if (startDoctypeDeclHandler) {\n        XML_Char *pubId;\n        if (!XmlIsPublicId(enc, s, next, eventPP))\n          return XML_ERROR_PUBLICID;\n        pubId = poolStoreString(&tempPool, enc,\n                                s + enc->minBytesPerChar,\n                                next - enc->minBytesPerChar);\n        if (!pubId)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(pubId);\n        poolFinish(&tempPool);\n        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 && declEntity) {\n        XML_Char *tem = poolStoreString(&dtd->pool,\n                                        enc,\n                                        s + enc->minBytesPerChar,\n                                        next - enc->minBytesPerChar);\n        if (!tem)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(tem);\n        declEntity->publicId = tem;\n        poolFinish(&dtd->pool);\n        if (entityDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_DOCTYPE_CLOSE:\n      if (doctypeName) {\n        startDoctypeDeclHandler(handlerArg, doctypeName,\n                                doctypeSysid, doctypePubid, 0);\n        poolClear(&tempPool);\n        handleDefault = XML_FALSE;\n      }\n      /* doctypeSysid will be non-NULL in the case of a previous\n         XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler\n         was not set, indicating an external subset\n      */\n#ifdef XML_DTD\n      if (doctypeSysid || useForeignDTD) {\n        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;\n        dtd->hasParamEntityRefs = XML_TRUE;\n        if (paramEntityParsing && externalEntityRefHandler) {\n          ENTITY *entity = (ENTITY *)lookup(parser,\n                                            &dtd->paramEntities,\n                                            externalSubsetName,\n                                            sizeof(ENTITY));\n          if (!entity)\n            return XML_ERROR_NO_MEMORY;\n          if (useForeignDTD)\n            entity->base = curBase;\n          dtd->paramEntityRead = XML_FALSE;\n          if (!externalEntityRefHandler(externalEntityRefHandlerArg,\n                                        0,\n                                        entity->base,\n                                        entity->systemId,\n                                        entity->publicId))\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          if (dtd->paramEntityRead) {\n            if (!dtd->standalone &&\n                notStandaloneHandler &&\n                !notStandaloneHandler(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 (!doctypeSysid)\n            dtd->hasParamEntityRefs = hadParamEntityRefs;\n          /* end of DTD - no need to update dtd->keepProcessing */\n        }\n        useForeignDTD = XML_FALSE;\n      }\n#endif /* XML_DTD */\n      if (endDoctypeDeclHandler) {\n        endDoctypeDeclHandler(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 (useForeignDTD) {\n        XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;\n        dtd->hasParamEntityRefs = XML_TRUE;\n        if (paramEntityParsing && externalEntityRefHandler) {\n          ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities,\n                                            externalSubsetName,\n                                            sizeof(ENTITY));\n          if (!entity)\n            return XML_ERROR_NO_MEMORY;\n          entity->base = curBase;\n          dtd->paramEntityRead = XML_FALSE;\n          if (!externalEntityRefHandler(externalEntityRefHandlerArg,\n                                        0,\n                                        entity->base,\n                                        entity->systemId,\n                                        entity->publicId))\n            return XML_ERROR_EXTERNAL_ENTITY_HANDLING;\n          if (dtd->paramEntityRead) {\n            if (!dtd->standalone &&\n                notStandaloneHandler &&\n                !notStandaloneHandler(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      processor = contentProcessor;\n      return contentProcessor(parser, s, end, nextPtr);\n    case XML_ROLE_ATTLIST_ELEMENT_NAME:\n      declElementType = getElementType(parser, enc, s, next);\n      if (!declElementType)\n        return XML_ERROR_NO_MEMORY;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_NAME:\n      declAttributeId = getAttributeId(parser, enc, s, next);\n      if (!declAttributeId)\n        return XML_ERROR_NO_MEMORY;\n      declAttributeIsCdata = XML_FALSE;\n      declAttributeType = NULL;\n      declAttributeIsId = XML_FALSE;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_CDATA:\n      declAttributeIsCdata = XML_TRUE;\n      declAttributeType = atypeCDATA;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ID:\n      declAttributeIsId = XML_TRUE;\n      declAttributeType = atypeID;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_IDREF:\n      declAttributeType = atypeIDREF;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:\n      declAttributeType = atypeIDREFS;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:\n      declAttributeType = atypeENTITY;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:\n      declAttributeType = atypeENTITIES;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:\n      declAttributeType = atypeNMTOKEN;\n      goto checkAttListDeclHandler;\n    case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:\n      declAttributeType = atypeNMTOKENS;\n    checkAttListDeclHandler:\n      if (dtd->keepProcessing && 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 && attlistDeclHandler) {\n        const XML_Char *prefix;\n        if (declAttributeType) {\n          prefix = enumValueSep;\n        }\n        else {\n          prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE\n                    ? notationPrefix\n                    : enumValueStart);\n        }\n        if (!poolAppendString(&tempPool, prefix))\n          return XML_ERROR_NO_MEMORY;\n        if (!poolAppend(&tempPool, enc, s, next))\n          return XML_ERROR_NO_MEMORY;\n        declAttributeType = 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(declElementType, declAttributeId,\n                             declAttributeIsCdata, declAttributeIsId,\n                             0, parser))\n          return XML_ERROR_NO_MEMORY;\n        if (attlistDeclHandler && declAttributeType) {\n          if (*declAttributeType == XML_T(ASCII_LPAREN)\n              || (*declAttributeType == XML_T(ASCII_N)\n                  && declAttributeType[1] == XML_T(ASCII_O))) {\n            /* Enumerated or Notation type */\n            if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))\n                || !poolAppendChar(&tempPool, XML_T('\\0')))\n              return XML_ERROR_NO_MEMORY;\n            declAttributeType = tempPool.start;\n            poolFinish(&tempPool);\n          }\n          *eventEndPP = s;\n          attlistDeclHandler(handlerArg, declElementType->name,\n                             declAttributeId->name, declAttributeType,\n                             0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);\n          poolClear(&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 =\n          storeAttributeValue(parser, enc, declAttributeIsCdata,\n                              s + enc->minBytesPerChar,\n                              next - enc->minBytesPerChar,\n                              &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(declElementType, declAttributeId,\n                             declAttributeIsCdata, XML_FALSE, attVal, parser))\n          return XML_ERROR_NO_MEMORY;\n        if (attlistDeclHandler && declAttributeType) {\n          if (*declAttributeType == XML_T(ASCII_LPAREN)\n              || (*declAttributeType == XML_T(ASCII_N)\n                  && declAttributeType[1] == XML_T(ASCII_O))) {\n            /* Enumerated or Notation type */\n            if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))\n                || !poolAppendChar(&tempPool, XML_T('\\0')))\n              return XML_ERROR_NO_MEMORY;\n            declAttributeType = tempPool.start;\n            poolFinish(&tempPool);\n          }\n          *eventEndPP = s;\n          attlistDeclHandler(handlerArg, declElementType->name,\n                             declAttributeId->name, declAttributeType,\n                             attVal,\n                             role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);\n          poolClear(&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(parser, enc,\n                                            s + enc->minBytesPerChar,\n                                            next - enc->minBytesPerChar);\n        if (declEntity) {\n          declEntity->textPtr = poolStart(&dtd->entityValuePool);\n          declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));\n          poolFinish(&dtd->entityValuePool);\n          if (entityDeclHandler) {\n            *eventEndPP = s;\n            entityDeclHandler(handlerArg,\n                              declEntity->name,\n                              declEntity->is_param,\n                              declEntity->textPtr,\n                              declEntity->textLen,\n                              curBase, 0, 0, 0);\n            handleDefault = XML_FALSE;\n          }\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      useForeignDTD = XML_FALSE;\n#endif /* XML_DTD */\n      dtd->hasParamEntityRefs = XML_TRUE;\n      if (startDoctypeDeclHandler) {\n        doctypeSysid = poolStoreString(&tempPool, enc,\n                                       s + enc->minBytesPerChar,\n                                       next - enc->minBytesPerChar);\n        if (doctypeSysid == NULL)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&tempPool);\n        handleDefault = XML_FALSE;\n      }\n#ifdef XML_DTD\n      else\n        /* use externalSubsetName to make doctypeSysid non-NULL\n           for the case where no startDoctypeDeclHandler is set */\n        doctypeSysid = externalSubsetName;\n#endif /* XML_DTD */\n      if (!dtd->standalone\n#ifdef XML_DTD\n          && !paramEntityParsing\n#endif /* XML_DTD */\n          && notStandaloneHandler\n          && !notStandaloneHandler(handlerArg))\n        return XML_ERROR_NOT_STANDALONE;\n#ifndef XML_DTD\n      break;\n#else /* XML_DTD */\n      if (!declEntity) {\n        declEntity = (ENTITY *)lookup(parser,\n                                      &dtd->paramEntities,\n                                      externalSubsetName,\n                                      sizeof(ENTITY));\n        if (!declEntity)\n          return XML_ERROR_NO_MEMORY;\n        declEntity->publicId = NULL;\n      }\n      /* fall through */\n#endif /* XML_DTD */\n    case XML_ROLE_ENTITY_SYSTEM_ID:\n      if (dtd->keepProcessing && declEntity) {\n        declEntity->systemId = poolStoreString(&dtd->pool, enc,\n                                               s + enc->minBytesPerChar,\n                                               next - enc->minBytesPerChar);\n        if (!declEntity->systemId)\n          return XML_ERROR_NO_MEMORY;\n        declEntity->base = curBase;\n        poolFinish(&dtd->pool);\n        if (entityDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_ENTITY_COMPLETE:\n      if (dtd->keepProcessing && declEntity && entityDeclHandler) {\n        *eventEndPP = s;\n        entityDeclHandler(handlerArg,\n                          declEntity->name,\n                          declEntity->is_param,\n                          0,0,\n                          declEntity->base,\n                          declEntity->systemId,\n                          declEntity->publicId,\n                          0);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_ENTITY_NOTATION_NAME:\n      if (dtd->keepProcessing && declEntity) {\n        declEntity->notation = poolStoreString(&dtd->pool, enc, s, next);\n        if (!declEntity->notation)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&dtd->pool);\n        if (unparsedEntityDeclHandler) {\n          *eventEndPP = s;\n          unparsedEntityDeclHandler(handlerArg,\n                                    declEntity->name,\n                                    declEntity->base,\n                                    declEntity->systemId,\n                                    declEntity->publicId,\n                                    declEntity->notation);\n          handleDefault = XML_FALSE;\n        }\n        else if (entityDeclHandler) {\n          *eventEndPP = s;\n          entityDeclHandler(handlerArg,\n                            declEntity->name,\n                            0,0,0,\n                            declEntity->base,\n                            declEntity->systemId,\n                            declEntity->publicId,\n                            declEntity->notation);\n          handleDefault = XML_FALSE;\n        }\n      }\n      break;\n    case XML_ROLE_GENERAL_ENTITY_NAME:\n      {\n        if (XmlPredefinedEntityName(enc, s, next)) {\n          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          declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name,\n                                        sizeof(ENTITY));\n          if (!declEntity)\n            return XML_ERROR_NO_MEMORY;\n          if (declEntity->name != name) {\n            poolDiscard(&dtd->pool);\n            declEntity = NULL;\n          }\n          else {\n            poolFinish(&dtd->pool);\n            declEntity->publicId = NULL;\n            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            declEntity->is_internal = !(parentParser || openInternalEntities);\n            if (entityDeclHandler)\n              handleDefault = XML_FALSE;\n          }\n        }\n        else {\n          poolDiscard(&dtd->pool);\n          declEntity = NULL;\n        }\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        declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities,\n                                           name, sizeof(ENTITY));\n        if (!declEntity)\n          return XML_ERROR_NO_MEMORY;\n        if (declEntity->name != name) {\n          poolDiscard(&dtd->pool);\n          declEntity = NULL;\n        }\n        else {\n          poolFinish(&dtd->pool);\n          declEntity->publicId = NULL;\n          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          declEntity->is_internal = !(parentParser || openInternalEntities);\n          if (entityDeclHandler)\n            handleDefault = XML_FALSE;\n        }\n      }\n      else {\n        poolDiscard(&dtd->pool);\n        declEntity = NULL;\n      }\n#else /* not XML_DTD */\n      declEntity = NULL;\n#endif /* XML_DTD */\n      break;\n    case XML_ROLE_NOTATION_NAME:\n      declNotationPublicId = NULL;\n      declNotationName = NULL;\n      if (notationDeclHandler) {\n        declNotationName = poolStoreString(&tempPool, enc, s, next);\n        if (!declNotationName)\n          return XML_ERROR_NO_MEMORY;\n        poolFinish(&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 (declNotationName) {  /* means notationDeclHandler != NULL */\n        XML_Char *tem = poolStoreString(&tempPool,\n                                        enc,\n                                        s + enc->minBytesPerChar,\n                                        next - enc->minBytesPerChar);\n        if (!tem)\n          return XML_ERROR_NO_MEMORY;\n        normalizePublicId(tem);\n        declNotationPublicId = tem;\n        poolFinish(&tempPool);\n        handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_NOTATION_SYSTEM_ID:\n      if (declNotationName && notationDeclHandler) {\n        const XML_Char *systemId\n          = poolStoreString(&tempPool, enc,\n                            s + enc->minBytesPerChar,\n                            next - enc->minBytesPerChar);\n        if (!systemId)\n          return XML_ERROR_NO_MEMORY;\n        *eventEndPP = s;\n        notationDeclHandler(handlerArg,\n                            declNotationName,\n                            curBase,\n                            systemId,\n                            declNotationPublicId);\n        handleDefault = XML_FALSE;\n      }\n      poolClear(&tempPool);\n      break;\n    case XML_ROLE_NOTATION_NO_SYSTEM_ID:\n      if (declNotationPublicId && notationDeclHandler) {\n        *eventEndPP = s;\n        notationDeclHandler(handlerArg,\n                            declNotationName,\n                            curBase,\n                            0,\n                            declNotationPublicId);\n        handleDefault = XML_FALSE;\n      }\n      poolClear(&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      {\n        enum XML_Error result;\n        if (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          processor = ignoreSectionProcessor;\n          return result;\n        }\n      }\n      break;\n#endif /* XML_DTD */\n    case XML_ROLE_GROUP_OPEN:\n      if (prologState.level >= groupSize) {\n        if (groupSize) {\n          char *temp = (char *)REALLOC(groupConnector, groupSize *= 2);\n          if (temp == NULL)\n            return XML_ERROR_NO_MEMORY;\n          groupConnector = temp;\n          if (dtd->scaffIndex) {\n            int *temp = (int *)REALLOC(dtd->scaffIndex,\n                          groupSize * sizeof(int));\n            if (temp == NULL)\n              return XML_ERROR_NO_MEMORY;\n            dtd->scaffIndex = temp;\n          }\n        }\n        else {\n          groupConnector = (char *)MALLOC(groupSize = 32);\n          if (!groupConnector)\n            return XML_ERROR_NO_MEMORY;\n        }\n      }\n      groupConnector[prologState.level] = 0;\n      if (dtd->in_eldecl) {\n        int myindex = nextScaffoldPart(parser);\n        if (myindex < 0)\n          return XML_ERROR_NO_MEMORY;\n        dtd->scaffIndex[dtd->scaffLevel] = myindex;\n        dtd->scaffLevel++;\n        dtd->scaffold[myindex].type = XML_CTYPE_SEQ;\n        if (elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      break;\n    case XML_ROLE_GROUP_SEQUENCE:\n      if (groupConnector[prologState.level] == ASCII_PIPE)\n        return XML_ERROR_SYNTAX;\n      groupConnector[prologState.level] = ASCII_COMMA;\n      if (dtd->in_eldecl && elementDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_GROUP_CHOICE:\n      if (groupConnector[prologState.level] == ASCII_COMMA)\n        return XML_ERROR_SYNTAX;\n      if (dtd->in_eldecl\n          && !groupConnector[prologState.level]\n          && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type\n              != XML_CTYPE_MIXED)\n          ) {\n        dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type\n            = XML_CTYPE_CHOICE;\n        if (elementDeclHandler)\n          handleDefault = XML_FALSE;\n      }\n      groupConnector[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 (!paramEntityParsing)\n        dtd->keepProcessing = dtd->standalone;\n      else {\n        const XML_Char *name;\n        ENTITY *entity;\n        name = poolStoreString(&dtd->pool, enc,\n                                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 (prologState.documentEntity &&\n            (dtd->standalone\n             ? !openInternalEntities\n             : !dtd->hasParamEntityRefs)) {\n          if (!entity)\n            return XML_ERROR_UNDEFINED_ENTITY;\n          else if (!entity->is_internal)\n            return XML_ERROR_ENTITY_DECLARED_IN_PE;\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) && skippedEntityHandler) {\n            skippedEntityHandler(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 (externalEntityRefHandler) {\n          dtd->paramEntityRead = XML_FALSE;\n          entity->open = XML_TRUE;\n          if (!externalEntityRefHandler(externalEntityRefHandlerArg,\n                                        0,\n                                        entity->base,\n                                        entity->systemId,\n                                        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        }\n        else {\n          dtd->keepProcessing = dtd->standalone;\n          break;\n        }\n      }\n#endif /* XML_DTD */\n      if (!dtd->standalone &&\n          notStandaloneHandler &&\n          !notStandaloneHandler(handlerArg))\n        return XML_ERROR_NOT_STANDALONE;\n      break;\n\n    /* Element declaration stuff */\n\n    case XML_ROLE_ELEMENT_NAME:\n      if (elementDeclHandler) {\n        declElementType = getElementType(parser, enc, s, next);\n        if (!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 (elementDeclHandler) {\n          XML_Content * content = (XML_Content *) MALLOC(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) ?\n                           XML_CTYPE_ANY :\n                           XML_CTYPE_EMPTY);\n          *eventEndPP = s;\n          elementDeclHandler(handlerArg, 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 (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 = (quant == XML_CQUANT_NONE\n                           ? next\n                           : 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        dtd->contentStringLen +=  nameLen;\n        if (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 (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            elementDeclHandler(handlerArg, 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 (startDoctypeDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ENTITY_NONE:\n      if (dtd->keepProcessing && entityDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_NOTATION_NONE:\n      if (notationDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ATTLIST_NONE:\n      if (dtd->keepProcessing && attlistDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    case XML_ROLE_ELEMENT_NONE:\n      if (elementDeclHandler)\n        handleDefault = XML_FALSE;\n      break;\n    } /* end of big switch */\n\n    if (handleDefault && defaultHandler)\n      reportDefault(parser, enc, s, next);\n\n    switch (ps_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,\n                const char *s,\n                const char *end,\n                const char **nextPtr)\n{\n  processor = epilogProcessor;\n  eventPtr = s;\n  for (;;) {\n    const char *next = NULL;\n    int tok = XmlPrologTok(encoding, s, end, &next);\n    eventEndPtr = next;\n    switch (tok) {\n    /* report partial linebreak - it might be the last token */\n    case -XML_TOK_PROLOG_S:\n      if (defaultHandler) {\n        reportDefault(parser, encoding, s, next);\n        if (ps_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 (defaultHandler)\n        reportDefault(parser, encoding, s, next);\n      break;\n    case XML_TOK_PI:\n      if (!reportProcessingInstruction(parser, encoding, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_COMMENT:\n      if (!reportComment(parser, encoding, s, next))\n        return XML_ERROR_NO_MEMORY;\n      break;\n    case XML_TOK_INVALID:\n      eventPtr = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      if (!ps_finalBuffer) {\n        *nextPtr = s;\n        return XML_ERROR_NONE;\n      }\n      return XML_ERROR_UNCLOSED_TOKEN;\n    case XML_TOK_PARTIAL_CHAR:\n      if (!ps_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    eventPtr = s = next;\n    switch (ps_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,\n                      XML_Bool betweenDecl)\n{\n  const char *textStart, *textEnd;\n  const char *next;\n  enum XML_Error result;\n  OPEN_INTERNAL_ENTITY *openEntity;\n\n  if (freeInternalEntities) {\n    openEntity = freeInternalEntities;\n    freeInternalEntities = openEntity->next;\n  }\n  else {\n    openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(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 = openInternalEntities;\n  openInternalEntities = openEntity;\n  openEntity->entity = entity;\n  openEntity->startTagLevel = 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\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);\n    result = doProlog(parser, internalEncoding, textStart, textEnd, tok,\n                      next, &next, XML_FALSE);\n  }\n  else\n#endif /* XML_DTD */\n    result = doContent(parser, tagLevel, internalEncoding, textStart,\n                       textEnd, &next, XML_FALSE);\n\n  if (result == XML_ERROR_NONE) {\n    if (textEnd != next && ps_parsing == XML_SUSPENDED) {\n      entity->processed = (int)(next - textStart);\n      processor = internalEntityProcessor;\n    }\n    else {\n      entity->open = XML_FALSE;\n      openInternalEntities = openEntity->next;\n      /* put openEntity back in list of free instances */\n      openEntity->next = freeInternalEntities;\n      freeInternalEntities = openEntity;\n    }\n  }\n  return result;\n}\n\nstatic enum XML_Error PTRCALL\ninternalEntityProcessor(XML_Parser parser,\n                        const char *s,\n                        const char *end,\n                        const char **nextPtr)\n{\n  ENTITY *entity;\n  const char *textStart, *textEnd;\n  const char *next;\n  enum XML_Error result;\n  OPEN_INTERNAL_ENTITY *openEntity = 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\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);\n    result = doProlog(parser, internalEncoding, textStart, textEnd, tok,\n                      next, &next, XML_FALSE);\n  }\n  else\n#endif /* XML_DTD */\n    result = doContent(parser, openEntity->startTagLevel, internalEncoding,\n                       textStart, textEnd, &next, XML_FALSE);\n\n  if (result != XML_ERROR_NONE)\n    return result;\n  else if (textEnd != next && ps_parsing == XML_SUSPENDED) {\n    entity->processed = (int)(next - (char *)entity->textPtr);\n    return result;\n  }\n  else {\n    entity->open = XML_FALSE;\n    openInternalEntities = openEntity->next;\n    /* put openEntity back in list of free instances */\n    openEntity->next = freeInternalEntities;\n    freeInternalEntities = openEntity;\n  }\n\n#ifdef XML_DTD\n  if (entity->is_param) {\n    int tok;\n    processor = prologProcessor;\n    tok = XmlPrologTok(encoding, s, end, &next);\n    return doProlog(parser, encoding, s, end, tok, next, nextPtr,\n                    (XML_Bool)!ps_finalBuffer);\n  }\n  else\n#endif /* XML_DTD */\n  {\n    processor = contentProcessor;\n    /* see externalEntityContentProcessor vs contentProcessor */\n    return doContent(parser, parentParser ? 1 : 0, encoding, s, end,\n                     nextPtr, (XML_Bool)!ps_finalBuffer);\n  }\n}\n\nstatic enum XML_Error PTRCALL\nerrorProcessor(XML_Parser parser,\n               const char *s,\n               const char *end,\n               const char **nextPtr)\n{\n  return errorCode;\n}\n\nstatic enum XML_Error\nstoreAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,\n                    const char *ptr, const char *end,\n                    STRING_POOL *pool)\n{\n  enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr,\n                                               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,\n                     STRING_POOL *pool)\n{\n  DTD * const dtd = _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 == encoding)\n        eventPtr = next;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_PARTIAL:\n      if (enc == encoding)\n        eventPtr = ptr;\n      return XML_ERROR_INVALID_TOKEN;\n    case XML_TOK_CHAR_REF:\n      {\n        XML_Char buf[XML_ENCODE_MAX];\n        int i;\n        int n = XmlCharRefNumber(enc, ptr);\n        if (n < 0) {\n          if (enc == encoding)\n            eventPtr = ptr;\n          return XML_ERROR_BAD_CHAR_REF;\n        }\n        if (!isCdata\n            && n == 0x20 /* space */\n            && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))\n          break;\n        n = XmlEncode(n, (ICHAR *)buf);\n        if (!n) {\n          if (enc == encoding)\n            eventPtr = ptr;\n          return XML_ERROR_BAD_CHAR_REF;\n        }\n        for (i = 0; i < n; i++) {\n          if (!poolAppendChar(pool, buf[i]))\n            return XML_ERROR_NO_MEMORY;\n        }\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      {\n        const XML_Char *name;\n        ENTITY *entity;\n        char checkEntityDecl;\n        XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,\n                                              ptr + enc->minBytesPerChar,\n                                              next - enc->minBytesPerChar);\n        if (ch) {\n          if (!poolAppendChar(pool, ch))\n                return XML_ERROR_NO_MEMORY;\n          break;\n        }\n        name = poolStoreString(&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(&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              prologState.documentEntity &&\n#endif /* XML_DTD */\n              (dtd->standalone\n               ? !openInternalEntities\n               : !dtd->hasParamEntityRefs);\n        else /* if (pool == &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        }\n        else if (!entity) {\n          /* Cannot report skipped entity here - see comments on\n             skippedEntityHandler.\n          if (skippedEntityHandler)\n            skippedEntityHandler(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 == &tempPool) && defaultHandler)\n            reportDefault(parser, enc, ptr, next);\n          */\n          break;\n        }\n        if (entity->open) {\n          if (enc == encoding)\n            eventPtr = ptr;\n          return XML_ERROR_RECURSIVE_ENTITY_REF;\n        }\n        if (entity->notation) {\n          if (enc == encoding)\n            eventPtr = ptr;\n          return XML_ERROR_BINARY_ENTITY_REF;\n        }\n        if (!entity->textPtr) {\n          if (enc == encoding)\n            eventPtr = ptr;\n          return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;\n        }\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, internalEncoding, isCdata,\n                                        (char *)entity->textPtr,\n                                        (char *)textEnd, pool);\n          entity->open = XML_FALSE;\n          if (result)\n            return result;\n        }\n      }\n      break;\n    default:\n      if (enc == encoding)\n        eventPtr = ptr;\n      return XML_ERROR_UNEXPECTED_STATE;\n    }\n    ptr = next;\n  }\n  /* not reached */\n}\n\nstatic enum XML_Error\nstoreEntityValue(XML_Parser parser,\n                 const ENCODING *enc,\n                 const char *entityTextPtr,\n                 const char *entityTextEnd)\n{\n  DTD * const dtd = _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 = prologState.inEntityValue;\n  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 (isParamEntity || enc != encoding) {\n        const XML_Char *name;\n        ENTITY *entity;\n        name = poolStoreString(&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(&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             skippedEntityHandler\n          if (skippedEntityHandler)\n            skippedEntityHandler(handlerArg, name, 0);\n          */\n          dtd->keepProcessing = dtd->standalone;\n          goto endEntityValue;\n        }\n        if (entity->open) {\n          if (enc == encoding)\n            eventPtr = entityTextPtr;\n          result = XML_ERROR_RECURSIVE_ENTITY_REF;\n          goto endEntityValue;\n        }\n        if (entity->systemId) {\n          if (externalEntityRefHandler) {\n            dtd->paramEntityRead = XML_FALSE;\n            entity->open = XML_TRUE;\n            if (!externalEntityRefHandler(externalEntityRefHandlerArg,\n                                          0,\n                                          entity->base,\n                                          entity->systemId,\n                                          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          }\n          else\n            dtd->keepProcessing = dtd->standalone;\n        }\n        else {\n          entity->open = XML_TRUE;\n          result = storeEntityValue(parser,\n                                    internalEncoding,\n                                    (char *)entity->textPtr,\n                                    (char *)(entity->textPtr\n                                             + 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      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      {\n        XML_Char buf[XML_ENCODE_MAX];\n        int i;\n        int n = XmlCharRefNumber(enc, entityTextPtr);\n        if (n < 0) {\n          if (enc == encoding)\n            eventPtr = entityTextPtr;\n          result = XML_ERROR_BAD_CHAR_REF;\n          goto endEntityValue;\n        }\n        n = XmlEncode(n, (ICHAR *)buf);\n        if (!n) {\n          if (enc == encoding)\n            eventPtr = entityTextPtr;\n          result = XML_ERROR_BAD_CHAR_REF;\n          goto endEntityValue;\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      }\n      break;\n    case XML_TOK_PARTIAL:\n      if (enc == encoding)\n        eventPtr = entityTextPtr;\n      result = XML_ERROR_INVALID_TOKEN;\n      goto endEntityValue;\n    case XML_TOK_INVALID:\n      if (enc == encoding)\n        eventPtr = next;\n      result = XML_ERROR_INVALID_TOKEN;\n      goto endEntityValue;\n    default:\n      if (enc == encoding)\n        eventPtr = entityTextPtr;\n      result = XML_ERROR_UNEXPECTED_STATE;\n      goto endEntityValue;\n    }\n    entityTextPtr = next;\n  }\nendEntityValue:\n#ifdef XML_DTD\n  prologState.inEntityValue = oldInEntityValue;\n#endif /* XML_DTD */\n  return result;\n}\n\nstatic void FASTCALL\nnormalizeLines(XML_Char *s)\n{\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    }\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{\n  const XML_Char *target;\n  XML_Char *data;\n  const char *tem;\n  if (!processingInstructionHandler) {\n    if (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(&tempPool, enc, start, tem);\n  if (!target)\n    return 0;\n  poolFinish(&tempPool);\n  data = poolStoreString(&tempPool, enc,\n                        XmlSkipS(enc, tem),\n                        end - enc->minBytesPerChar*2);\n  if (!data)\n    return 0;\n  normalizeLines(data);\n  processingInstructionHandler(handlerArg, target, data);\n  poolClear(&tempPool);\n  return 1;\n}\n\nstatic int\nreportComment(XML_Parser parser, const ENCODING *enc,\n              const char *start, const char *end)\n{\n  XML_Char *data;\n  if (!commentHandler) {\n    if (defaultHandler)\n      reportDefault(parser, enc, start, end);\n    return 1;\n  }\n  data = poolStoreString(&tempPool,\n                         enc,\n                         start + enc->minBytesPerChar * 4,\n                         end - enc->minBytesPerChar * 3);\n  if (!data)\n    return 0;\n  normalizeLines(data);\n  commentHandler(handlerArg, data);\n  poolClear(&tempPool);\n  return 1;\n}\n\nstatic void\nreportDefault(XML_Parser parser, const ENCODING *enc,\n              const char *s, const char *end)\n{\n  if (MUST_CONVERT(enc, s)) {\n    const char **eventPP;\n    const char **eventEndPP;\n    if (enc == encoding) {\n      eventPP = &eventPtr;\n      eventEndPP = &eventEndPtr;\n    }\n    else {\n      eventPP = &(openInternalEntities->internalEventPtr);\n      eventEndPP = &(openInternalEntities->internalEventEndPtr);\n    }\n    do {\n      ICHAR *dataPtr = (ICHAR *)dataBuf;\n      XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);\n      *eventEndPP = s;\n      defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));\n      *eventPP = s;\n    } while (s != end);\n  }\n  else\n    defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));\n}\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{\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(type->allocDefaultAtts\n                            * sizeof(DEFAULT_ATTRIBUTE));\n      if (!type->defaultAtts)\n        return 0;\n    }\n    else {\n      DEFAULT_ATTRIBUTE *temp;\n      int count = type->allocDefaultAtts * 2;\n      temp = (DEFAULT_ATTRIBUTE *)\n        REALLOC(type->defaultAtts, (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{\n  DTD * const dtd = _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\n    }\n  }\n  return 1;\n}\n\nstatic ATTRIBUTE_ID *\ngetAttributeId(XML_Parser parser, const ENCODING *enc,\n               const char *start, const char *end)\n{\n  DTD * const dtd = _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, 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 (!ns)\n      ;\n    else if (name[0] == XML_T(ASCII_x)\n        && name[1] == XML_T(ASCII_m)\n        && name[2] == XML_T(ASCII_l)\n        && 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, sizeof(PREFIX));\n      id->xmlns = XML_TRUE;\n    }\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, poolStart(&dtd->pool),\n                                        sizeof(PREFIX));\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{\n  DTD * const dtd = _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(&tempPool, XML_T(ASCII_EQUALS)))\n      return NULL;\n    len = dtd->defaultPrefix.binding->uriLen;\n    if (namespaceSeparator)\n      len--;\n    for (i = 0; i < len; i++)\n      if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i]))\n        return NULL;\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      continue;\n    if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))\n      return NULL;\n    for (s = prefix->name; *s; s++)\n      if (!poolAppendChar(&tempPool, *s))\n        return NULL;\n    if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS)))\n      return NULL;\n    len = prefix->binding->uriLen;\n    if (namespaceSeparator)\n      len--;\n    for (i = 0; i < len; i++)\n      if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))\n        return NULL;\n    needSep = XML_TRUE;\n  }\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(&tempPool, CONTEXT_SEP))\n      return NULL;\n    for (s = e->name; *s; s++)\n      if (!poolAppendChar(&tempPool, *s))\n        return 0;\n    needSep = XML_TRUE;\n  }\n\n  if (!poolAppendChar(&tempPool, XML_T('\\0')))\n    return NULL;\n  return tempPool.start;\n}\n\nstatic XML_Bool\nsetContext(XML_Parser parser, const XML_Char *context)\n{\n  DTD * const dtd = _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(&tempPool, XML_T('\\0')))\n        return XML_FALSE;\n      e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0);\n      if (e)\n        e->open = XML_TRUE;\n      if (*s != XML_T('\\0'))\n        s++;\n      context = s;\n      poolDiscard(&tempPool);\n    }\n    else if (*s == XML_T(ASCII_EQUALS)) {\n      PREFIX *prefix;\n      if (poolLength(&tempPool) == 0)\n        prefix = &dtd->defaultPrefix;\n      else {\n        if (!poolAppendChar(&tempPool, XML_T('\\0')))\n          return XML_FALSE;\n        prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool),\n                                  sizeof(PREFIX));\n        if (!prefix)\n          return XML_FALSE;\n        if (prefix->name == poolStart(&tempPool)) {\n          prefix->name = poolCopyString(&dtd->pool, prefix->name);\n          if (!prefix->name)\n            return XML_FALSE;\n        }\n        poolDiscard(&tempPool);\n      }\n      for (context = s + 1;\n           *context != CONTEXT_SEP && *context != XML_T('\\0');\n           context++)\n        if (!poolAppendChar(&tempPool, *context))\n          return XML_FALSE;\n      if (!poolAppendChar(&tempPool, XML_T('\\0')))\n        return XML_FALSE;\n      if (addBinding(parser, prefix, NULL, poolStart(&tempPool),\n                     &inheritedBindings) != XML_ERROR_NONE)\n        return XML_FALSE;\n      poolDiscard(&tempPool);\n      if (*context != XML_T('\\0'))\n        ++context;\n      s = context;\n    }\n    else {\n      if (!poolAppendChar(&tempPool, *s))\n        return XML_FALSE;\n      s++;\n    }\n  }\n  return XML_TRUE;\n}\n\nstatic void FASTCALL\nnormalizePublicId(XML_Char *publicId)\n{\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{\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{\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{\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, const XML_Memory_Handling_Suite *ms)\n{\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 *)\n          ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));\n      if (!newE->defaultAtts) {\n        ms->free_fcn(newE);\n        return 0;\n      }\n    }\n    if (oldE->idAtt)\n      newE->idAtt = (ATTRIBUTE_ID *)\n          lookup(oldParser, &(newDtd->attributeIds), 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 *)\n          lookup(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      }\n      else\n        newE->defaultAtts[i].value = NULL;\n    }\n  }\n\n  /* Copy the entity tables. */\n  if (!copyEntityTable(oldParser,\n                       &(newDtd->generalEntities),\n                       &(newDtd->pool),\n                       &(oldDtd->generalEntities)))\n      return 0;\n\n#ifdef XML_DTD\n  if (!copyEntityTable(oldParser,\n                       &(newDtd->paramEntities),\n                       &(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,\n                HASH_TABLE *newTable,\n                STRING_POOL *newPool,\n                const HASH_TABLE *oldTable)\n{\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    }\n    else {\n      const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr,\n                                            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{\n  for (; *s1 == *s2; s1++, s2++)\n    if (*s1 == 0)\n      return XML_TRUE;\n  return XML_FALSE;\n}\n\nstatic unsigned long FASTCALL\nhash(XML_Parser parser, KEY s)\n{\n  unsigned long h = hash_secret_salt;\n  while (*s)\n    h = CHAR_HASH(h, *s++);\n  return h;\n}\n\nstatic NAMED *\nlookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize)\n{\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  }\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{\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{\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{\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{\n  iter->p = table->v;\n  iter->end = iter->p + table->size;\n}\n\nstatic NAMED * FASTCALL\nhashTableIterNext(HASH_TABLE_ITER *iter)\n{\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{\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{\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{\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,\n           const char *ptr, const char *end)\n{\n  if (!pool->ptr && !poolGrow(pool))\n    return NULL;\n  for (;;) {\n    XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);\n    if (ptr == end)\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{\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{\n  if (!pool->ptr && !poolGrow(pool))\n    return NULL;\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{\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,\n                const char *ptr, const char *end)\n{\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 XML_Bool FASTCALL\npoolGrow(STRING_POOL *pool)\n{\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    int blockSize = (int)(pool->end - pool->start)*2;\n    BLOCK *temp = (BLOCK *)\n      pool->mem->realloc_fcn(pool->blocks,\n                             (offsetof(BLOCK, s)\n                              + blockSize * sizeof(XML_Char)));\n    if (temp == NULL)\n      return XML_FALSE;\n    pool->blocks = temp;\n    pool->blocks->size = blockSize;\n    pool->ptr = pool->blocks->s + (pool->ptr - pool->start);\n    pool->start = pool->blocks->s;\n    pool->end = pool->start + blockSize;\n  }\n  else {\n    BLOCK *tem;\n    int blockSize = (int)(pool->end - pool->start);\n    if (blockSize < INIT_BLOCK_SIZE)\n      blockSize = INIT_BLOCK_SIZE;\n    else\n      blockSize *= 2;\n    tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s)\n                                        + blockSize * sizeof(XML_Char));\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,\n             (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{\n  DTD * const dtd = _dtd;  /* save one level of indirection */\n  CONTENT_SCAFFOLD * me;\n  int next;\n\n  if (!dtd->scaffIndex) {\n    dtd->scaffIndex = (int *)MALLOC(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 *)\n        REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD));\n      if (temp == NULL)\n        return -1;\n      dtd->scaffSize *= 2;\n    }\n    else {\n      temp = (CONTENT_SCAFFOLD *)MALLOC(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 = &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,\n           int src_node,\n           XML_Content *dest,\n           XML_Content **contpos,\n           XML_Char **strpos)\n{\n  DTD * const dtd = _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  }\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;\n         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{\n  DTD * const dtd = _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(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,\n               const ENCODING *enc,\n               const char *ptr,\n               const char *end)\n{\n  DTD * const dtd = _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, 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"},{"id":13408,"name":"xmltok_ns.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n/* This file is included! */\n#ifdef XML_TOK_NS_C\n\nconst ENCODING *\nNS(XmlGetUtf8InternalEncoding)(void)\n{\n  return &ns(internal_utf8_encoding).enc;\n}\n\nconst ENCODING *\nNS(XmlGetUtf16InternalEncoding)(void)\n{\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\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,\n  &ns(ascii_encoding).enc,\n  &ns(utf8_encoding).enc,\n  &ns(big2_encoding).enc,\n  &ns(big2_encoding).enc,\n  &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{\n  return initScan(NS(encodings), (const INIT_ENCODING *)enc,\n                  XML_PROLOG_STATE, ptr, end, nextTokPtr);\n}\n\nstatic int PTRCALL\nNS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,\n                    const char **nextTokPtr)\n{\n  return initScan(NS(encodings), (const INIT_ENCODING *)enc,\n                  XML_CONTENT_STATE, ptr, end, nextTokPtr);\n}\n\nint\nNS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,\n                    const char *name)\n{\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{\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,\n                    const ENCODING *enc,\n                    const char *ptr,\n                    const char *end,\n                    const char **badPtr,\n                    const char **versionPtr,\n                    const char **versionEndPtr,\n                    const char **encodingName,\n                    const ENCODING **encoding,\n                    int *standalone)\n{\n  return doParseXmlDecl(NS(findEncoding),\n                        isGeneralTextEntity,\n                        enc,\n                        ptr,\n                        end,\n                        badPtr,\n                        versionPtr,\n                        versionEndPtr,\n                        encodingName,\n                        encoding,\n                        standalone);\n}\n\n#endif /* XML_TOK_NS_C */\n"},{"id":13409,"name":"ascii.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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":13410,"name":"xmltok_impl.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n/* This file is included! */\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  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  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/* ptr points to character following \"<!-\" */\n\nstatic int PTRCALL\nPREFIX(scanComment)(const ENCODING *enc, const char *ptr,\n                    const char *end, const char **nextTokPtr)\n{\n  if (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 (ptr != end) {\n      switch (BYTE_TYPE(enc, ptr)) {\n      INVALID_CASES(ptr, nextTokPtr)\n      case BT_MINUS:\n        if ((ptr += MINBPC(enc)) == end)\n          return XML_TOK_PARTIAL;\n        if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {\n          if ((ptr += MINBPC(enc)) == end)\n            return XML_TOK_PARTIAL;\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,\n                 const char *end, const char **nextTokPtr)\n{\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    case BT_PERCNT:\n      if (ptr + MINBPC(enc) == end)\n        return XML_TOK_PARTIAL;\n      /* don't allow <!ENTITY% foo \"whatever\"> */\n      switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {\n      case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:\n        *nextTokPtr = ptr;\n        return XML_TOK_INVALID;\n      }\n      /* fall through */\n    case BT_S: case BT_CR: 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,\n                      const char *end, int *tokPtr)\n{\n  int upper = 0;\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,\n               const char *end, const char **nextTokPtr)\n{\n  int tok;\n  const char *target = ptr;\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_S: case BT_CR: 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 (ptr != end) {\n        switch (BYTE_TYPE(enc, ptr)) {\n        INVALID_CASES(ptr, nextTokPtr)\n        case BT_QUEST:\n          ptr += MINBPC(enc);\n          if (ptr == end)\n            return XML_TOK_PARTIAL;\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      if (ptr == end)\n        return XML_TOK_PARTIAL;\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,\n                         const char *end, const char **nextTokPtr)\n{\n  static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A,\n                                     ASCII_T, ASCII_A, ASCII_LSQB };\n  int i;\n  /* CDATA[ */\n  if (end - ptr < 6 * MINBPC(enc))\n    return XML_TOK_PARTIAL;\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,\n                        const char *end, const char **nextTokPtr)\n{\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    if (ptr == end)\n      return XML_TOK_PARTIAL;\n    if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))\n      break;\n    ptr += MINBPC(enc);\n    if (ptr == end)\n      return XML_TOK_PARTIAL;\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    if (ptr == end)\n      return XML_TOK_PARTIAL;\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 (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) LEAD_CASE(3) 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,\n                   const char *end, const char **nextTokPtr)\n{\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_S: case BT_CR: case BT_LF:\n      for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {\n        switch (BYTE_TYPE(enc, ptr)) {\n        case BT_S: case BT_CR: 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,\n                       const char *end, const char **nextTokPtr)\n{\n  if (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); 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,\n                    const char *end, const char **nextTokPtr)\n{\n  if (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); 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{\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\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 (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{\n#ifdef XML_NS\n  int hadColon = 0;\n#endif\n  while (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      if (ptr == end)\n        return XML_TOK_PARTIAL;\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: case BT_CR: case BT_LF:\n      for (;;) {\n        int t;\n\n        ptr += MINBPC(enc);\n        if (ptr == end)\n          return XML_TOK_PARTIAL;\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      {\n        int open;\n#ifdef XML_NS\n        hadColon = 0;\n#endif\n        for (;;) {\n          ptr += MINBPC(enc);\n          if (ptr == end)\n            return XML_TOK_PARTIAL;\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          if (ptr == end)\n            return XML_TOK_PARTIAL;\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            {\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        if (ptr == end)\n          return XML_TOK_PARTIAL;\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          if (ptr == end)\n            return XML_TOK_PARTIAL;\n          switch (BYTE_TYPE(enc, ptr)) {\n          CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n          case BT_S: case BT_CR: 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            if (ptr == end)\n              return XML_TOK_PARTIAL;\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{\n#ifdef XML_NS\n  int hadColon;\n#endif\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\n  switch (BYTE_TYPE(enc, ptr)) {\n  CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  case BT_EXCL:\n    if ((ptr += MINBPC(enc)) == end)\n      return XML_TOK_PARTIAL;\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),\n                                      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 (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      if (ptr == end)\n        return XML_TOK_PARTIAL;\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: case BT_CR: case BT_LF:\n      {\n        ptr += MINBPC(enc);\n        while (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: case BT_CR: 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      if (ptr == end)\n        return XML_TOK_PARTIAL;\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{\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 (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 (ptr == end)\n      return XML_TOK_TRAILING_RSQB;\n    if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))\n      break;\n    ptr += MINBPC(enc);\n    if (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 (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) LEAD_CASE(3) LEAD_CASE(4)\n#undef LEAD_CASE\n    case BT_RSQB:\n      if (ptr + MINBPC(enc) != end) {\n         if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {\n           ptr += MINBPC(enc);\n           break;\n         }\n         if (ptr + 2*MINBPC(enc) != end) {\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{\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\n  switch (BYTE_TYPE(enc, ptr)) {\n  CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)\n  case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:\n    *nextTokPtr = ptr;\n    return XML_TOK_PERCENT;\n  default:\n    *nextTokPtr = ptr;\n    return XML_TOK_INVALID;\n  }\n  while (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{\n  if (ptr == end)\n    return XML_TOK_PARTIAL;\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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_CR: case BT_LF: case BT_S:\n    case BT_RPAR: case BT_GT: case BT_PERCNT: 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,\n                const char *ptr, const char *end,\n                const char **nextTokPtr)\n{\n  while (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 (ptr == end)\n        return -XML_TOK_LITERAL;\n      *nextTokPtr = ptr;\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_S: case BT_CR: case BT_LF:\n      case BT_GT: case BT_PERCNT: 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{\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    {\n      ptr += MINBPC(enc);\n      if (ptr == end)\n        return XML_TOK_PARTIAL;\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: case BT_LF:\n    for (;;) {\n      ptr += MINBPC(enc);\n      if (ptr == end)\n        break;\n      switch (BYTE_TYPE(enc, ptr)) {\n      case BT_S: 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 (ptr == end)\n      return -XML_TOK_CLOSE_BRACKET;\n    if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {\n      if (ptr + MINBPC(enc) == end)\n        return XML_TOK_PARTIAL;\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 (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: case BT_LF: case BT_S:\n    case BT_GT: case BT_COMMA: 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) LEAD_CASE(3) 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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)\n    case BT_GT: case BT_RPAR: case BT_COMMA:\n    case BT_VERBAR: case BT_LSQB: case BT_PERCNT:\n    case BT_S: case BT_CR: 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        if (ptr == end)\n          return XML_TOK_PARTIAL;\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,\n                          const char *end, const char **nextTokPtr)\n{\n  const char *start;\n  if (ptr == end)\n    return XML_TOK_NONE;\n  start = ptr;\n  while (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#define LEAD_CASE(n) \\\n    case BT_LEAD ## n: ptr += n; break;\n    LEAD_CASE(2) LEAD_CASE(3) 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 (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,\n                       const char *end, const char **nextTokPtr)\n{\n  const char *start;\n  if (ptr == end)\n    return XML_TOK_NONE;\n  start = ptr;\n  while (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#define LEAD_CASE(n) \\\n    case BT_LEAD ## n: ptr += n; break;\n    LEAD_CASE(2) LEAD_CASE(3) 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),\n                                       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 (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,\n                         const char *end, const char **nextTokPtr)\n{\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 (ptr != end) {\n    switch (BYTE_TYPE(enc, ptr)) {\n    INVALID_CASES(ptr, nextTokPtr)\n    case BT_LT:\n      if ((ptr += MINBPC(enc)) == end)\n        return XML_TOK_PARTIAL;\n      if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {\n        if ((ptr += MINBPC(enc)) == end)\n          return XML_TOK_PARTIAL;\n        if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {\n          ++level;\n          ptr += MINBPC(enc);\n        }\n      }\n      break;\n    case BT_RSQB:\n      if ((ptr += MINBPC(enc)) == end)\n        return XML_TOK_PARTIAL;\n      if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {\n        if ((ptr += MINBPC(enc)) == end)\n          return XML_TOK_PARTIAL;\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{\n  ptr += MINBPC(enc);\n  end -= MINBPC(enc);\n  for (; 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    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,\n                int attsMax, ATTRIBUTE *atts)\n{\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: START_NAME ptr += (n - MINBPC(enc)); break;\n    LEAD_CASE(2) LEAD_CASE(3) 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      }\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      }\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\n               && nAtts < attsMax\n               && 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: 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{\n  int result = 0;\n  /* skip &# */\n  ptr += 2*MINBPC(enc);\n  if (CHAR_MATCHES(enc, ptr, ASCII_x)) {\n    for (ptr += MINBPC(enc);\n         !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: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4:\n      case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9:\n        result <<= 4;\n        result |= (c - ASCII_0);\n        break;\n      case ASCII_A: case ASCII_B: case ASCII_C:\n      case ASCII_D: case ASCII_E: case ASCII_F:\n        result <<= 4;\n        result += 10 + (c - ASCII_A);\n        break;\n      case ASCII_a: case ASCII_b: case ASCII_c:\n      case ASCII_d: case ASCII_e: case ASCII_f:\n        result <<= 4;\n        result += 10 + (c - ASCII_a);\n        break;\n      }\n      if (result >= 0x110000)\n        return -1;\n    }\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{\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(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)\n{\n  for (;;) {\n    switch (BYTE_TYPE(enc, ptr1)) {\n#define LEAD_CASE(n) \\\n    case BT_LEAD ## n: \\\n      if (*ptr1++ != *ptr2++) \\\n        return 0;\n    LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2)\n#undef LEAD_CASE\n      /* fall through */\n      if (*ptr1++ != *ptr2++)\n        return 0;\n      break;\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      if (*ptr2++ != *ptr1++)\n        return 0;\n      if (MINBPC(enc) > 1) {\n        if (*ptr2++ != *ptr1++)\n          return 0;\n        if (MINBPC(enc) > 2) {\n          if (*ptr2++ != *ptr1++)\n            return 0;\n          if (MINBPC(enc) > 3) {\n            if (*ptr2++ != *ptr1++)\n              return 0;\n          }\n        }\n      }\n      break;\n    default:\n      if (MINBPC(enc) == 1 && *ptr1 == *ptr2)\n        return 1;\n      switch (BYTE_TYPE(enc, ptr2)) {\n      case BT_LEAD2:\n      case BT_LEAD3:\n      case BT_LEAD4:\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        return 0;\n      default:\n        return 1;\n      }\n    }\n  }\n  /* not reached */\n}\n\nstatic int PTRCALL\nPREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,\n                         const char *end1, const char *ptr2)\n{\n  for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {\n    if (ptr1 == end1)\n      return 0;\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{\n  const char *start = ptr;\n  for (;;) {\n    switch (BYTE_TYPE(enc, ptr)) {\n#define LEAD_CASE(n) \\\n    case BT_LEAD ## n: ptr += n; break;\n    LEAD_CASE(2) LEAD_CASE(3) 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{\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,\n                       const char *ptr,\n                       const char *end,\n                       POSITION *pos)\n{\n  while (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) LEAD_CASE(3) 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 (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":13411,"name":"expatw.dsp","nodeType":"TextFile","path":"cextern/expat/lib","text":"# Microsoft Developer Studio Project File - Name=\"expatw\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n\nCFG=expatw - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"expatw.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"expatw.mak\" CFG=\"expatw - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"expatw - Win32 Release\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \"expatw - Win32 Debug\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nMTL=midl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"expatw - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release\"\n# PROP BASE Intermediate_Dir \"Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release-w\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"EXPAT_EXPORTS\" /Yu\"stdafx.h\" /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /D \"NDEBUG\" /D \"COMPILED_FROM_DSP\" /D \"WIN32\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"XML_UNICODE_WCHAR_T\" /FD /c\n# SUBTRACT CPP /YX /Yc /Yu\n# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\n# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /dll /machine:I386\n# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:\"..\\win32\\bin\\Release\\libexpatw.dll\"\n\n!ELSEIF  \"$(CFG)\" == \"expatw - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug\"\n# PROP BASE Intermediate_Dir \"Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug-w\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"EXPAT_EXPORTS\" /Yu\"stdafx.h\" /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D \"_DEBUG\" /D \"COMPILED_FROM_DSP\" /D \"WIN32\" /D \"_WINDOWS\" /D \"_MBCS\" /D \"_USRDLL\" /D \"XML_UNICODE_WCHAR_T\" /FR /FD /GZ /c\n# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\n# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept\n# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:\"..\\win32\\bin\\Debug\\libexpatw.dll\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"expatw - Win32 Release\"\n# Name \"expatw - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\libexpatw.def\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlparse.c\n\n!IF  \"$(CFG)\" == \"expatw - Win32 Release\"\n\n!ELSEIF  \"$(CFG)\" == \"expatw - Win32 Debug\"\n\n# ADD CPP /GX- /Od\n\n!ENDIF \n\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_ns.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# Begin Source File\n\nSOURCE=.\\ascii.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\asciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat_external.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\iasciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\internal.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\latin1tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\nametab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\utf8tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.h\n# End Source File\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"},{"id":13412,"name":"expat_static.dsp","nodeType":"TextFile","path":"cextern/expat/lib","text":"# Microsoft Developer Studio Project File - Name=\"expat_static\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Static Library\" 0x0104\n\nCFG=expat_static - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"expat_static.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"expat_static.mak\" CFG=\"expat_static - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"expat_static - Win32 Release\" (based on \"Win32 (x86) Static Library\")\n!MESSAGE \"expat_static - Win32 Debug\" (based on \"Win32 (x86) Static Library\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"expat_static - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"expat_static___Win32_Release\"\n# PROP BASE Intermediate_Dir \"expat_static___Win32_Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release_static\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_MBCS\" /D \"_LIB\" /YX /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /D \"WIN32\" /D \"_WINDOWS\" /D \"NDEBUG\" /D \"_MBCS\" /D \"_LIB\" /D \"COMPILED_FROM_DSP\" /FD /c\n# SUBTRACT CPP /YX\n# ADD BASE RSC /l 0x1009 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLIB32=link.exe -lib\n# ADD BASE LIB32 /nologo\n# ADD LIB32 /nologo /out:\"..\\win32\\bin\\Release\\libexpatMT.lib\"\n\n!ELSEIF  \"$(CFG)\" == \"expat_static - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"expat_static___Win32_Debug\"\n# PROP BASE Intermediate_Dir \"expat_static___Win32_Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug_static\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_MBCS\" /D \"_LIB\" /YX /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"COMPILED_FROM_DSP\" /D \"_MBCS\" /D \"_LIB\" /FR /FD /GZ /c\n# SUBTRACT CPP /YX\n# ADD BASE RSC /l 0x1009 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLIB32=link.exe -lib\n# ADD BASE LIB32 /nologo\n# ADD LIB32 /nologo /out:\"..\\win32\\bin\\Debug\\libexpatMT.lib\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"expat_static - Win32 Release\"\n# Name \"expat_static - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\xmlparse.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_ns.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# Begin Source File\n\nSOURCE=.\\ascii.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\asciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\expat_external.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\iasciitab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\internal.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\latin1tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\nametab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\utf8tab.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlrole.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltok_impl.h\n# End Source File\n# End Group\n# End Target\n# End Project\n"},{"id":13413,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#ifndef Expat_INCLUDED\n#define Expat_INCLUDED 1\n\n#ifdef __VMS\n/*      0        1         2         3      0        1         2         3\n        1234567890123456789012345678901     1234567890123456789012345678901 */\n#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler\n#define XML_SetUnparsedEntityDeclHandler    XML_SetUnparsedEntDeclHandler\n#define XML_SetStartNamespaceDeclHandler    XML_SetStartNamespcDeclHandler\n#define XML_SetExternalEntityRefHandlerArg  XML_SetExternalEntRefHandlerArg\n#endif\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\n/* Should this be defined using stdbool.h when C99 is available? */\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};\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\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,\n                          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,\n                                    const XML_Char  *elname,\n                                    const XML_Char  *attname,\n                                    const XML_Char  *att_type,\n                                    const XML_Char  *dflt,\n                                    int              isrequired);\n\nXMLPARSEAPI(void)\nXML_SetAttlistDeclHandler(XML_Parser parser,\n                          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,\n                      XML_XmlDeclHandler xmldecl);\n\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\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 disproportionatly 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\n/* s is not 0 terminated. */\ntypedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,\n                                                  const XML_Char *s,\n                                                  int len);\n\n/* target and data are 0 terminated */\ntypedef void (XMLCALL *XML_ProcessingInstructionHandler) (\n                                                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,\n                                            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,\n                                            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) (\n                                            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,\n                              const XML_Char *entityName,\n                              int is_parameter_entity,\n                              const XML_Char *value,\n                              int value_length,\n                              const XML_Char *base,\n                              const XML_Char *systemId,\n                              const XML_Char *publicId,\n                              const XML_Char *notationName);\n\nXMLPARSEAPI(void)\nXML_SetEntityDeclHandler(XML_Parser parser,\n                         XML_EntityDeclHandler handler);\n\n/* OBSOLETE -- OBSOLETE -- OBSOLETE\n   This handler has been superceded 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,\n                                    const XML_Char *entityName,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    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) (\n                                    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) (\n                                    void *userData,\n                                    const XML_Char *prefix,\n                                    const XML_Char *uri);\n\ntypedef void (XMLCALL *XML_EndNamespaceDeclHandler) (\n                                    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) (\n                                    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) (\n                                    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) (\n                                    void *encodingHandlerData,\n                                    const XML_Char *name,\n                                    XML_Encoding *info);\n\nXMLPARSEAPI(void)\nXML_SetElementHandler(XML_Parser parser,\n                      XML_StartElementHandler start,\n                      XML_EndElementHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartElementHandler(XML_Parser parser,\n                           XML_StartElementHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetEndElementHandler(XML_Parser parser,\n                         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,\n                      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,\n                      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,\n                            XML_DefaultHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetDoctypeDeclHandler(XML_Parser parser,\n                          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,\n                             XML_EndDoctypeDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetNotationDeclHandler(XML_Parser parser,\n                           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,\n                                   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*/\nXMLPARSEAPI(enum XML_Error)\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);\n\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.\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.  Each\n   attribute/value pair counts as 2; thus this correspondds to an\n   index into the atts array passed to the 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 {\n  XML_INITIALIZED,\n  XML_PARSING,\n  XML_FINISHED,\n  XML_SUSPENDED\n};\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,\n                               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*/\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*/\nXMLPARSEAPI(int)\nXML_SetHashSalt(XML_Parser parser,\n                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*/\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,\n                    int *offset,\n                    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_MemMalloc(XML_Parser parser, size_t size);\n\nXMLPARSEAPI(void *)\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\n/* Expat follows the GNU/Linux convention of odd number minor version for\n   beta/development releases and even number minor version for stable\n   releases. Micro is bumped with each release, and set to 0 with each\n   change to major or minor version.\n*/\n#define XML_MAJOR_VERSION 2\n#define XML_MINOR_VERSION 1\n#define XML_MICRO_VERSION 0\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not Expat_INCLUDED */\n"},{"id":13414,"name":"amigaconfig.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"#ifndef AMIGACONFIG_H\n#define AMIGACONFIG_H\n\n/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */\n#define BYTEORDER 4321\n\n/* Define to 1 if you have the `bcopy' function. */\n#define HAVE_BCOPY 1\n\n/* Define to 1 if you have the <check.h> header file. */\n#undef HAVE_CHECK_H\n\n/* Define to 1 if you have the `memmove' function. */\n#define HAVE_MEMMOVE 1\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define HAVE_UNISTD_H 1\n\n/* whether byteorder is bigendian */\n#define WORDS_BIGENDIAN\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 make parameter entity parsing functionality available. */\n#define XML_DTD\n\n/* Define to make XML Namespaces functionality available. */\n#define XML_NS\n\n#endif  /* AMIGACONFIG_H */\n"},{"id":13415,"name":"utf8tab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\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"},{"id":13416,"name":"xmltok_impl.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/*\nCopyright (c) 1998, 1999 Thai Open Source Software Center Ltd\nSee the file COPYING for copying permission.\n*/\n\nenum {\n  BT_NONXML,\n  BT_MALFORM,\n  BT_LT,\n  BT_AMP,\n  BT_RSQB,\n  BT_LEAD2,\n  BT_LEAD3,\n  BT_LEAD4,\n  BT_TRAIL,\n  BT_CR,\n  BT_LF,\n  BT_GT,\n  BT_QUOT,\n  BT_APOS,\n  BT_EQUALS,\n  BT_QUEST,\n  BT_EXCL,\n  BT_SOL,\n  BT_SEMI,\n  BT_NUM,\n  BT_LSQB,\n  BT_S,\n  BT_NMSTRT,\n  BT_COLON,\n  BT_HEX,\n  BT_DIGIT,\n  BT_NAME,\n  BT_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,\n  BT_LPAR,\n  BT_RPAR,\n  BT_AST,\n  BT_PLUS,\n  BT_COMMA,\n  BT_VERBAR\n};\n\n#include <stddef.h>\n"},{"id":13417,"name":"xmltok.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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 -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 -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 *,\n                               const char *,\n                               const char *,\n                               const char **);\n\nstruct encoding {\n  SCANNER scanners[XML_N_STATES];\n  SCANNER literalScanners[XML_N_LITERAL_TYPES];\n  int (PTRCALL *sameName)(const ENCODING *,\n                          const char *,\n                          const char *);\n  int (PTRCALL *nameMatchesAscii)(const ENCODING *,\n                                  const char *,\n                                  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,\n                         const char *ptr,\n                         int attsMax,\n                         ATTRIBUTE *atts);\n  int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);\n  int (PTRCALL *predefinedEntityName)(const ENCODING *,\n                                      const char *,\n                                      const char *);\n  void (PTRCALL *updatePosition)(const ENCODING *,\n                                 const char *ptr,\n                                 const char *end,\n                                 POSITION *);\n  int (PTRCALL *isPublicId)(const ENCODING *enc,\n                            const char *ptr,\n                            const char *end,\n                            const char **badPtr);\n  void (PTRCALL *utf8Convert)(const ENCODING *enc,\n                              const char **fromP,\n                              const char *fromLim,\n                              char **toP,\n                              const char *toLim);\n  void (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\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 XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))\n\n#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \\\n  (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))\n\n#define XmlNameLength(enc, ptr) \\\n  (((enc)->nameLength)(enc, ptr))\n\n#define XmlSkipS(enc, ptr) \\\n  (((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) \\\n  (((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,\n                    const ENCODING *enc,\n                    const char *ptr,\n                    const char *end,\n                    const char **badPtr,\n                    const char **versionPtr,\n                    const char **versionEndPtr,\n                    const char **encodingNamePtr,\n                    const ENCODING **namedEncodingPtr,\n                    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\n\ntypedef int (XMLCALL *CONVERTER) (void *userData, const char *p);\n\nENCODING *\nXmlInitUnknownEncoding(void *mem,\n                       int *table,\n                       CONVERTER convert,\n                       void *userData);\n\nint XmlParseXmlDeclNS(int isGeneralTextEntity,\n                      const ENCODING *enc,\n                      const char *ptr,\n                      const char *end,\n                      const char **badPtr,\n                      const char **versionPtr,\n                      const char **versionEndPtr,\n                      const char **encodingNamePtr,\n                      const ENCODING **namedEncodingPtr,\n                      int *standalonePtr);\n\nint XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);\nconst ENCODING *XmlGetUtf8InternalEncodingNS(void);\nconst ENCODING *XmlGetUtf16InternalEncodingNS(void);\nENCODING *\nXmlInitUnknownEncodingNS(void *mem,\n                         int *table,\n                         CONVERTER convert,\n                         void *userData);\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not XmlTok_INCLUDED */\n"},{"id":13418,"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#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"},{"id":13419,"name":"xmltok.c","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stddef.h>\n\n#ifdef COMPILED_FROM_DSP\n#include \"winconfig.h\"\n#elif defined(MACOS_CLASSIC)\n#include \"macconfig.h\"\n#elif defined(__amigaos__)\n#include \"amigaconfig.h\"\n#elif defined(__WATCOMC__)\n#include \"watcomconfig.h\"\n#else\n#ifdef HAVE_EXPAT_CONFIG_H\n#include <expat_config.h>\n#endif\n#endif /* ndef COMPILED_FROM_DSP */\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(sameName), \\\n  PREFIX(nameMatchesAscii), \\\n  PREFIX(nameLength), \\\n  PREFIX(skipS), \\\n  PREFIX(getAtts), \\\n  PREFIX(charRefNumber), \\\n  PREFIX(predefinedEntityName), \\\n  PREFIX(updatePosition), \\\n  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)] & (1 << ((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) \\\n                      + ((((byte)[1]) >> 5) & 1)] \\\n         & (1 << (((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[((pages)[((((byte)[0]) & 0xF) << 4) \\\n                             + ((((byte)[1]) >> 2) & 0xF)] \\\n                       << 3) \\\n                      + ((((byte)[1]) & 3) << 1) \\\n                      + ((((byte)[2]) >> 5) & 1)] \\\n         & (1 << (((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 \\\n     ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \\\n     : 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  || \\\n  ((*p) == 0xEF && (p)[1] == 0xBF \\\n    ? \\\n    (p)[2] > 0xBD \\\n    : \\\n    ((p)[2] & 0xC0) == 0xC0) \\\n  || \\\n  ((*p) == 0xE0 \\\n    ? \\\n    (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \\\n    : \\\n    ((p)[1] & 0x80) == 0 \\\n    || \\\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 \\\n  || \\\n  ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \\\n  || \\\n  ((*p) == 0xF0 \\\n    ? \\\n    (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \\\n    : \\\n    ((p)[1] & 0x80) == 0 \\\n    || \\\n    ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))\n\nstatic int PTRFASTCALL\nisNever(const ENCODING *enc, const char *p)\n{\n  return 0;\n}\n\nstatic int PTRFASTCALL\nutf8_isName2(const ENCODING *enc, const char *p)\n{\n  return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isName3(const ENCODING *enc, const char *p)\n{\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{\n  return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isNmstrt3(const ENCODING *enc, const char *p)\n{\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{\n  return UTF8_INVALID2((const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isInvalid3(const ENCODING *enc, const char *p)\n{\n  return UTF8_INVALID3((const unsigned char *)p);\n}\n\nstatic int PTRFASTCALL\nutf8_isInvalid4(const ENCODING *enc, const char *p)\n{\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, \\\n E ## isNameMin, \\\n E ## isNmstrtMin, \\\n E ## byteToAscii, \\\n 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, \\\n E ## isName3, \\\n E ## isName4, \\\n E ## isNmstrt2, \\\n E ## isNmstrt3, \\\n E ## isNmstrt4, \\\n E ## isInvalid2, \\\n E ## isInvalid3, \\\n E ## isInvalid4\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{\n  return SB_BYTE_TYPE(enc, p);\n}\n#define BYTE_TYPE(enc, p) \\\n (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) \\\n (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))\nstatic int PTRFASTCALL\nsb_byteToAscii(const ENCODING *enc, const char *p)\n{\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) \\\n (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p))\n#define IS_NMSTRT_CHAR(enc, p, n) \\\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{\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\nstatic void PTRCALL\nutf8_toUtf8(const ENCODING *enc,\n            const char **fromP, const char *fromLim,\n            char **toP, const char *toLim)\n{\n  char *to;\n  const char *from;\n  if (fromLim - *fromP > toLim - *toP) {\n    /* Avoid copying partial characters. */\n    for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)\n      if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)\n        break;\n  }\n  for (to = *toP, from = *fromP; from != fromLim; from++, to++)\n    *to = *from;\n  *fromP = from;\n  *toP = to;\n}\n\nstatic void PTRCALL\nutf8_toUtf16(const ENCODING *enc,\n             const char **fromP, const char *fromLim,\n             unsigned short **toP, const unsigned short *toLim)\n{\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      *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));\n      from += 2;\n      break;\n    case BT_LEAD3:\n      *to++ = (unsigned short)(((from[0] & 0xf) << 12)\n                               | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f));\n      from += 3;\n      break;\n    case BT_LEAD4:\n      {\n        unsigned long n;\n        if (to + 1 == toLim)\n          goto after;\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      }\n      break;\n    default:\n      *to++ = *from++;\n      break;\n    }\n  }\nafter:\n  *fromP = from;\n  *toP = to;\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};\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\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\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};\n\nstatic void PTRCALL\nlatin1_toUtf8(const ENCODING *enc,\n              const char **fromP, const char *fromLim,\n              char **toP, const char *toLim)\n{\n  for (;;) {\n    unsigned char c;\n    if (*fromP == fromLim)\n      break;\n    c = (unsigned char)**fromP;\n    if (c & 0x80) {\n      if (toLim - *toP < 2)\n        break;\n      *(*toP)++ = (char)((c >> 6) | UTF8_cval2);\n      *(*toP)++ = (char)((c & 0x3f) | 0x80);\n      (*fromP)++;\n    }\n    else {\n      if (*toP == toLim)\n        break;\n      *(*toP)++ = *(*fromP)++;\n    }\n  }\n}\n\nstatic void PTRCALL\nlatin1_toUtf16(const ENCODING *enc,\n               const char **fromP, const char *fromLim,\n               unsigned short **toP, const unsigned short *toLim)\n{\n  while (*fromP != fromLim && *toP != toLim)\n    *(*toP)++ = (unsigned char)*(*fromP)++;\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_)\n};\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_)\n};\n\nstatic void PTRCALL\nascii_toUtf8(const ENCODING *enc,\n             const char **fromP, const char *fromLim,\n             char **toP, const char *toLim)\n{\n  while (*fromP != fromLim && *toP != toLim)\n    *(*toP)++ = *(*fromP)++;\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_)\n};\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_)\n};\n\nstatic int PTRFASTCALL\nunicode_byte_type(char hi, char lo)\n{\n  switch ((unsigned char)hi) {\n  case 0xD8: case 0xD9: case 0xDA: case 0xDB:\n    return BT_LEAD4;\n  case 0xDC: case 0xDD: case 0xDE: case 0xDF:\n    return BT_TRAIL;\n  case 0xFF:\n    switch ((unsigned char)lo) {\n    case 0xFF:\n    case 0xFE:\n      return BT_NONXML;\n    }\n    break;\n  }\n  return BT_NONASCII;\n}\n\n#define DEFINE_UTF16_TO_UTF8(E) \\\nstatic void  PTRCALL \\\nE ## toUtf8(const ENCODING *enc, \\\n            const char **fromP, const char *fromLim, \\\n            char **toP, const char *toLim) \\\n{ \\\n  const char *from; \\\n  for (from = *fromP; 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; \\\n        } \\\n        *(*toP)++ = lo; \\\n        break; \\\n      } \\\n      /* fall through */ \\\n    case 0x1: case 0x2: case 0x3: \\\n    case 0x4: case 0x5: case 0x6: case 0x7: \\\n      if (toLim -  *toP < 2) { \\\n        *fromP = from; \\\n        return; \\\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; \\\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: case 0xD9: case 0xDA: case 0xDB: \\\n      if (toLim -  *toP < 4) { \\\n        *fromP = from; \\\n        return; \\\n      } \\\n      plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \\\n      *(*toP)++ = ((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) \\\n                   | ((GET_HI(from) & 0x3) << 2) \\\n                   | (lo2 >> 6) \\\n                   | 0x80); \\\n      *(*toP)++ = ((lo2 & 0x3f) | 0x80); \\\n      break; \\\n    } \\\n  } \\\n  *fromP = from; \\\n}\n\n#define DEFINE_UTF16_TO_UTF16(E) \\\nstatic void  PTRCALL \\\nE ## toUtf16(const ENCODING *enc, \\\n             const char **fromP, const char *fromLim, \\\n             unsigned short **toP, const unsigned short *toLim) \\\n{ \\\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  for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \\\n    *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \\\n}\n\n#define SET2(ptr, ch) \\\n  (((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) \\\n  (((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 \\\n  ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \\\n  : unicode_byte_type((p)[1], (p)[0]))\n#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)\n#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)\n#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \\\n  UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])\n#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, 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{\n  return LITTLE2_BYTE_TYPE(enc, p);\n}\n\nstatic int PTRFASTCALL\nlittle2_byteToAscii(const ENCODING *enc, const char *p)\n{\n  return LITTLE2_BYTE_TO_ASCII(enc, p);\n}\n\nstatic int PTRCALL\nlittle2_charMatches(const ENCODING *enc, const char *p, int c)\n{\n  return LITTLE2_CHAR_MATCHES(enc, p, c);\n}\n\nstatic int PTRFASTCALL\nlittle2_isNameMin(const ENCODING *enc, const char *p)\n{\n  return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);\n}\n\nstatic int PTRFASTCALL\nlittle2_isNmstrtMin(const ENCODING *enc, const char *p)\n{\n  return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, 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(enc, p)\n#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)\n#define IS_NAME_CHAR(enc, p, n) 0\n#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)\n#define IS_NMSTRT_CHAR(enc, p, n) (0)\n#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, 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_)\n};\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_)\n};\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_)\n};\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_)\n};\n\n#endif\n\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(enc, p) ((p)[0] == 0 ? (p)[1] : -1)\n#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)\n#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \\\n  UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])\n#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, 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{\n  return BIG2_BYTE_TYPE(enc, p);\n}\n\nstatic int PTRFASTCALL\nbig2_byteToAscii(const ENCODING *enc, const char *p)\n{\n  return BIG2_BYTE_TO_ASCII(enc, p);\n}\n\nstatic int PTRCALL\nbig2_charMatches(const ENCODING *enc, const char *p, int c)\n{\n  return BIG2_CHAR_MATCHES(enc, p, c);\n}\n\nstatic int PTRFASTCALL\nbig2_isNameMin(const ENCODING *enc, const char *p)\n{\n  return BIG2_IS_NAME_CHAR_MINBPC(enc, p);\n}\n\nstatic int PTRFASTCALL\nbig2_isNmstrtMin(const ENCODING *enc, const char *p)\n{\n  return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, 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(enc, p)\n#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)\n#define IS_NAME_CHAR(enc, p, n) 0\n#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)\n#define IS_NMSTRT_CHAR(enc, p, n) (0)\n#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, 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_)\n};\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_)\n};\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_)\n};\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_)\n};\n\n#endif\n\n#undef PREFIX\n\nstatic int FASTCALL\nstreqci(const char *s1, const char *s2)\n{\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      c2 += ASCII_A - ASCII_a;\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,\n                   const char *end, POSITION *pos)\n{\n  normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);\n}\n\nstatic int\ntoAscii(const ENCODING *enc, const char *ptr, const char *end)\n{\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{\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,\n                     const char *ptr,\n                     const char *end,\n                     const char **namePtr,\n                     const char **nameEndPtr,\n                     const char **valPtr,\n                     const char **nextTokPtr)\n{\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)\n        && !(ASCII_A <= c && c <= ASCII_Z)\n        && !(ASCII_0 <= c && c <= ASCII_9)\n        && c != ASCII_PERIOD\n        && c != ASCII_MINUS\n        && 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};\n\nstatic const char KW_encoding[] = {\n  ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\\0'\n};\n\nstatic const char KW_standalone[] = {\n  ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o,\n  ASCII_n, ASCII_e, '\\0'\n};\n\nstatic const char KW_yes[] = {\n  ASCII_y, ASCII_e, ASCII_s,  '\\0'\n};\n\nstatic const char KW_no[] = {\n  ASCII_n, ASCII_o,  '\\0'\n};\n\nstatic int\ndoParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,\n                                                 const char *,\n                                                 const char *),\n               int isGeneralTextEntity,\n               const ENCODING *enc,\n               const char *ptr,\n               const char *end,\n               const char **badPtr,\n               const char **versionPtr,\n               const char **versionEndPtr,\n               const char **encodingName,\n               const ENCODING **encoding,\n               int *standalone)\n{\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  }\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  }\n  else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {\n    if (standalone)\n      *standalone = 0;\n  }\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{\n  switch (result >> 8) {\n  case 0xD8: case 0xD9: case 0xDA: case 0xDB:\n  case 0xDC: case 0xDD: case 0xDE: 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{\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;\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;\n}\n\nint FASTCALL\nXmlUtf16Encode(int charNum, unsigned short *buf)\n{\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{\n  return sizeof(struct unknown_encoding);\n}\n\nstatic int PTRFASTCALL\nunknown_isName(const ENCODING *enc, const char *p)\n{\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{\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{\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 void PTRCALL\nunknown_toUtf8(const ENCODING *enc,\n               const char **fromP, const char *fromLim,\n               char **toP, const char *toLim)\n{\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      break;\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        break;\n      utf8 = buf;\n      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]\n                 - (BT_LEAD2 - 2));\n    }\n    else {\n      if (n > toLim - *toP)\n        break;\n      (*fromP)++;\n    }\n    do {\n      *(*toP)++ = *utf8++;\n    } while (--n != 0);\n  }\n}\n\nstatic void PTRCALL\nunknown_toUtf16(const ENCODING *enc,\n                const char **fromP, const char *fromLim,\n                unsigned short **toP, const unsigned short *toLim)\n{\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)\n          uenc->convert(uenc->userData, *fromP);\n      *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]\n                 - (BT_LEAD2 - 2));\n    }\n    else\n      (*fromP)++;\n    *(*toP)++ = c;\n  }\n}\n\nENCODING *\nXmlInitUnknownEncoding(void *mem,\n                       int *table,\n                       CONVERTER convert,\n                       void *userData)\n{\n  int i;\n  struct unknown_encoding *e = (struct unknown_encoding *)mem;\n  for (i = 0; i < (int)sizeof(struct normal_encoding); i++)\n    ((char *)mem)[i] = ((char *)&latin1_encoding)[i];\n  for (i = 0; i < 128; i++)\n    if (latin1_encoding.type[i] != BT_OTHER\n        && latin1_encoding.type[i] != BT_NONXML\n        && 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    }\n    else if (c < 0) {\n      if (c < -4)\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    }\n    else if (c < 0x80) {\n      if (latin1_encoding.type[c] != BT_OTHER\n          && latin1_encoding.type[c] != BT_NONXML\n          && 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    }\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    }\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, ASCII_5, ASCII_9,\n  ASCII_MINUS, ASCII_1, '\\0'\n};\nstatic const char KW_US_ASCII[] = {\n  ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I,\n  '\\0'\n};\nstatic const char KW_UTF_8[] =  {\n  ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\\0'\n};\nstatic const char KW_UTF_16[] = {\n  ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\\0'\n};\nstatic const char KW_UTF_16BE[] = {\n  ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E,\n  '\\0'\n};\nstatic const char KW_UTF_16LE[] = {\n  ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E,\n  '\\0'\n};\n\nstatic int FASTCALL\ngetEncodingIndex(const char *name)\n{\n  static const char * const encodingNames[] = {\n    KW_ISO_8859_1,\n    KW_US_ASCII,\n    KW_UTF_8,\n    KW_UTF_16,\n    KW_UTF_16BE,\n    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\n\nstatic int\ninitScan(const ENCODING * const *encodingTable,\n         const INIT_ENCODING *enc,\n         int state,\n         const char *ptr,\n         const char *end,\n         const char **nextTokPtr)\n{\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\n          && state == XML_CONTENT_STATE)\n        break;\n      /* fall through */\n    case 0x00:\n    case 0x3C:\n      return XML_TOK_PARTIAL;\n    }\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\n          && 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\n          && 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\n            || e == UTF_16LE_ENC || 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      }\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\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,\n                         int *table,\n                         CONVERTER convert,\n                         void *userData)\n{\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":13420,"name":"cextern/expat/vms","nodeType":"Package"},{"id":13421,"name":"expat_config.h","nodeType":"TextFile","path":"cextern/expat/vms","text":"/* Copyright 2000, Clark Cooper\n   All rights reserved.\n\n   This is free software. You are permitted to copy, distribute, or modify\n   it under the terms of the MIT/X license (contained in the COPYING file\n   with this distribution.)\n*/\n\n/* Define to empty if the keyword does not work.  */\n#undef const\n\n/* Define if you have a working `mmap' system call.  */\n#undef HAVE_MMAP\n\n/* Define to `long' if <sys/types.h> doesn't define.  */\n#undef off_t\n\n/* Define to `unsigned' if <sys/types.h> doesn't define.  */\n#undef size_t\n\n/* Define if your processor stores words with the most significant\n   byte first (like Motorola and SPARC, unlike Intel and VAX).  */\n#undef WORDS_BIGENDIAN\n\n/* Define if you have the bcopy function.  */\n#undef HAVE_BCOPY\n\n/* Define if you have the memmove function.  */\n#define HAVE_MEMMOVE 1\n\n/* Define if you have the <unistd.h> header file.  */\n#define HAVE_UNISTD_H 1\n\n#define XML_NS\n#define XML_DTD\n\n#ifdef WORDS_BIGENDIAN\n#define XML_BYTE_ORDER 21\n#else\n#define XML_BYTE_ORDER 12\n#endif\n\n#define XML_CONTEXT_BYTES 1024\n\n#ifndef HAVE_MEMMOVE\n#ifdef HAVE_BCOPY\n#define memmove(d,s,l) bcopy((s),(d),(l))\n#else\n#define memmove(d,s,l) ;punting on memmove;\n#endif\n\n#endif\n"},{"id":13422,"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"},{"id":13423,"name":"descrip.mms","nodeType":"TextFile","path":"cextern/expat/vms","text":"# Bare bones description file (Makefile) for OpenVMS\n\nPACKAGE = expat\nVERSION = 1.95.8\nEXPAT_MAJOR_VERSION=1\nEXPAT_MINOR_VERSION=95\nEXPAT_EDIT=8\n\nO = .obj\nOLB = .olb\n \nLIBRARY = expat$(OLB)\nLIBDIR = [.lib]\nSOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c\nOBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O)\n \nTEMPLATES = xmltok_impl.c xmltok_ns.c\nAPIHEADER = $(LIBDIR)expat.h\nHEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \\\n\t$(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \\\n\t$(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h\n \nCONFIG_HEADER = expat_config.h\nINCLUDES = /INCLUDE=([],[.lib])\nDEFS = /DEFINE=(PACKAGE=\"\"\"$(PACKAGE)\"\"\",VERSION=\"\"\"$(PACKAGE)_$(VERSION)\"\"\",HAVE_EXPAT_CONFIG_H)\nLIBREVISION = 0\nLIBCURRENT  = 1\nLIBAGE      = 0\n# \nCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)\n# \n# DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) \n# \n# TAR = gtar\n# GZIP_ENV = --best\n# \n.FIRST :\n       IF F$SEARCH(\"$(LIBRARY)\") .EQS. \"\" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY)\n\nall : $(LIBRARY)\n        @ write sys$output \"All made.\"\n \n.SUFFIXES : \n.SUFFIXES : $(OLB) $(O) .C .H  \n \n.c$(O) :\n       $(COMPILE) $(MMS$SOURCE)\n \n$(O)$(OLB) :\n        @ IF F$SEARCH(\"$(MMS$TARGET)\") .EQS. \"\" -\n                THEN LIBRARY/CREATE/LOG $(MMS$TARGET)\n        @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE)\n \nclean :\n       DELETE $(LIBRARY);*,*$(O);*\n \n$(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) \n       $(LIBR) /COMPRESS $(MMS$TARGET)\n\n$(CONFIG_HEADER) : [.vms]expat_config.h\n        COPY/LOG $(MMS$SOURCE) $(MMS$TARGET)\n\nxmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER)\n \nxmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER)\n \nxmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \\\n        $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \\\n\t$(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER)\n\n"},{"id":13424,"name":"iasciitab.h","nodeType":"TextFile","path":"cextern/expat/lib","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\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":13425,"name":"licenses","nodeType":"Package"},{"id":13426,"name":"FUTURES_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright 2009 Brian Quinlan. All 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   1. Redistributions of source code must retain the above copyright notice,\n      this list of conditions and the following disclaimer.\n   2. 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\nTHIS SOFTWARE IS PROVIDED BY BRIAN QUINLAN \"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 DISCLAIMED. IN NO EVENT\nHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, 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 NEGLIGENCE\nOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE."},{"id":13427,"name":"README.vms","nodeType":"TextFile","path":"cextern/expat/vms","text":"4-jun-2002\tCraig A. Berry\n\t\tAdded rudimentary build procedures for \n\t\tOpenVMS based on work by Martin Vorlaender.\n\n\nYou'll need MMS or its freeware equivalent MMK.  Just go to the \ntop-level directory and type\n\n$ MMS/DESCRIPTION=[.vms]\n \n  or\n\n$ MMK/DESCRIPTION=[.vms]\n\nYou'll end up with the object library expat.olb.  For now, installation\nconsists merely of copying the object library, include files, and\ndocumentation to a suitable location.  \n\nTo-do list:\n\n\t-- create a shareable image\n\t-- build and run the tests and build the xmlwf utility\n\t-- create an install target\n"},{"id":13428,"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":13429,"name":"SIX_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 2010-2013 Benjamin Peterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"},{"id":13430,"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":13431,"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":13432,"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":13433,"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"},{"id":13434,"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":13435,"name":"SYMPY.rst","nodeType":"TextFile","path":"licenses","text":"Copyright (c) 2006-2014 SymPy Development Team\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n  a. Redistributions of source code must retain the above copyright notice,\n     this list of conditions and the following disclaimer.\n  b. 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  c. Neither the name of SymPy 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\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\nOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n"},{"id":13436,"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":13437,"name":"SPHINXEXT_LICENSES.rst","nodeType":"TextFile","path":"licenses","text":"This file details liceses for some of the files in astropy/sphinx/ext\nthat are adapted from other projects:\n\n\n=========\nLicense 1\n=========\n\n    The files\n    - numpydoc.py\n    - docscrape.py\n    - docscrape_sphinx.py\n    - phantom_import.py\n    have the following license:\n\nCopyright (C) 2008 Stefan van der Walt <stefan@mentat.za.net>, Pauli Virtanen <pav@iki.fi>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\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\n    the documentation and/or other materials provided with the\n    distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n=========\nLicense 2\n=========\n\n    The files\n    - compiler_unparse.py\n    - comment_eater.py\n    - traitsdoc.py\n    have the following license:\n\nThis software is OSI Certified Open Source Software.\nOSI Certified is a certification mark of the Open Source Initiative.\n\nCopyright (c) 2006, Enthought, Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are 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,\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 Enthought, Inc. nor the names of its contributors may\n   be 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 OWNER 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\n\n"},{"id":13438,"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"},{"col":4,"comment":"null","endLoc":465,"header":"def _draw_ticks(self, renderer, bboxes, ticklabels_bbox)","id":13439,"name":"_draw_ticks","nodeType":"Function","startLoc":457,"text":"def _draw_ticks(self, renderer, bboxes, ticklabels_bbox):\n\n        renderer.open_group('ticks')\n\n        self.ticks.draw(renderer)\n        self.ticklabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox=ticklabels_bbox)\n\n        renderer.close_group('ticks')"},{"id":13440,"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":13441,"name":"PYTEST_LICENSE.rst","nodeType":"TextFile","path":"licenses","text":"\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 deal\n  in the Software without restriction, including without limitation the rights\n  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n  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 all\n  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  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n  SOFTWARE.\n"},{"id":13442,"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":13443,"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":13444,"name":"cextern/expat/bcb5","nodeType":"Package"},{"id":13445,"name":"expat_static.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\libexpats_mtd.lib\"/>\n    <OBJFILES value=\"Release\\obj\\libexpat_static\\xmlparse.obj \n      Release\\obj\\libexpat_static\\xmlrole.obj \n      Release\\obj\\libexpat_static\\xmltok.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"\"/>\n    <PATHCPP value=\".;..\\lib\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"TLib\"/>\n    <USERDEFINES value=\"_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"expat_static.bpf\"/>\n    <INCLUDEPATH value=\"..\\lib;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-rch -w-par -w-8027 -w-8026 -w-ccc\"/>\n    <LISTFILE value=\"\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-O2 -X- -a8 -b -k- -vi -q -tWM -c\"/>\n    <PFLAGS value=\"-N2Release\\obj\\libexpat_static -N0Release\\obj\\libexpat_static -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"$(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES)\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\lib;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=5\nItem0=..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\lib;$(BCB)\\lib;..\\lib\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=7\nItem0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC\nItem1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC\nItem2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC\nItem3=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG\nItem4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP\nItem5=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_MBCS\nItem6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP\n\n[HistoryLists\\hlIntOutputDir]\nCount=6\nItem0=Release\\obj\\libexpat_static\nItem1=Release\\obj\\mts\nItem2=Release\\obj\\mt\nItem3=Release\nItem4=..\\lib\\Release_static\nItem5=Release_static\n\n[HistoryLists\\hlFinalOutputDir]\nCount=3\nItem0=Release\\\nItem1=Release\nItem2=Release_static\\\n\n[HistoryLists\\hlTlibPageSize]\nCount=1\nItem0=0x0010\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"id":13446,"name":"expatw.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\libexpatw_mtd.dll\"/>\n    <OBJFILES value=\"Release\\obj\\libexpatw\\xmlparse.obj Release\\obj\\libexpatw\\xmlrole.obj \n      Release\\obj\\libexpatw\\xmltok.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"libexpatw_mtd.def\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \n      ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \n      VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \n      dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\"/>\n    <PATHCPP value=\".;..\\lib\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"ilink32\"/>\n    <USERDEFINES value=\"_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"expatw.bpf\"/>\n    <INCLUDEPATH value=\"..\\lib;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-rch -w-par -w-8027 -w-8026 -w-ccc\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD\"/>\n    <PFLAGS value=\"-N2Release\\obj\\libexpatw -N0Release\\obj\\libexpatw -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"-IRelease\\obj\\libexpatw -D&quot;&quot; -aa -Tpd -x -Gn -Gi -w -q\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"c0d32w.obj $(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\lib;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=5\nItem0=..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\lib;$(BCB)\\lib;..\\lib\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=9\nItem0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T\nItem1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T\nItem2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T\nItem3=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T\nItem4=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG\nItem5=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG\nItem6=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T\nItem7=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE\nItem8=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T\n\n[HistoryLists\\hlIntOutputDir]\nCount=8\nItem0=Release\\obj\\libexpatw\nItem1=Release\\obj\\libexpat\nItem2=Release\\obj\\mtd\nItem3=Release\\obj\\mt\nItem4=Release_w\\obj\nItem5=Release-w\\obj\nItem6=Release-w\nItem7=..\\lib\\Release-w\n\n[HistoryLists\\hlFinalOutputDir]\nCount=5\nItem0=Release\\\nItem1=Release\nItem2=Release_w\\\nItem3=Release-w\\\nItem4=Release-w\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"id":13447,"name":"all_projects.bpg","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"#------------------------------------------------------------------------------\nVERSION = BWS.01\n#------------------------------------------------------------------------------\n!ifndef ROOT\nROOT = $(MAKEDIR)\\..\n!endif\n#------------------------------------------------------------------------------\nMAKE = $(ROOT)\\bin\\make.exe -$(MAKEFLAGS) -f$**\nDCC = $(ROOT)\\bin\\dcc32.exe $**\nBRCC = $(ROOT)\\bin\\brcc32.exe $**\n#------------------------------------------------------------------------------\nPROJECTS = setup libexpat_mtd.dll libexpats_mtd.lib libexpatw_mtd.dll \\\n  libexpatws_mtd.lib elements.exe outline.exe xmlwf.exe\n#------------------------------------------------------------------------------\ndefault: $(PROJECTS)\n#------------------------------------------------------------------------------\n\nlibexpat_mtd.dll: expat.bpr\n  $(ROOT)\\bin\\bpr2mak $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nlibexpats_mtd.lib: expat_static.bpr\n  $(ROOT)\\bin\\bpr2mak -t$(ROOT)\\bin\\deflib.bmk $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nlibexpatw_mtd.dll: expatw.bpr\n  $(ROOT)\\bin\\bpr2mak $**                                    \n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nlibexpatws_mtd.lib: expatw_static.bpr\n  $(ROOT)\\bin\\bpr2mak -t$(ROOT)\\bin\\deflib.bmk $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nelements.exe: elements.bpr\n  $(ROOT)\\bin\\bpr2mak $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\noutline.exe: outline.bpr\n  $(ROOT)\\bin\\bpr2mak $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nxmlwf.exe: xmlwf.bpr\n  $(ROOT)\\bin\\bpr2mak $**\n  $(ROOT)\\bin\\make -$(MAKEFLAGS) -f$*.mak\n\nsetup: setup.bat\n  call $**\n\n\n"},{"id":13448,"name":"outline.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\outline.exe\nOBJFILES = Release\\obj\\examples\\outline.obj\nRESFILES = \nMAINSOURCE = outline.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = Release\\libexpat_mtd.lib\nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \\\n    ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \\\n    VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \\\n    dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\nSPARELIBS = \nDEFFILE = \n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\examples\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = WIN32;NDEBUG;_CONSOLE\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\examples;$(BCB)\\include\nLIBPATH = ..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS= -w-par -w-8027 -w-8026\n# ---------------------------------------------------------------------------\nCFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\\lib -c\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\examples -N0Release\\obj\\examples -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = -IRelease\\obj\\examples -D\"\" -ap -Tpe -x -Gn -q\n# ---------------------------------------------------------------------------\nALLOBJ = c0x32.obj $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = ilink32\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) @&&!\n    $(LFLAGS) -L$(LIBPATH) +\n    $(ALLOBJ), +\n    $(PROJECT),, +\n    $(ALLLIB), +\n    $(DEFFILE), +\n    $(ALLRES)\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13449,"name":"elements.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\examples\\elements.c\");\nUSELIB(\"Release\\libexpats_mtd.lib\");\n//---------------------------------------------------------------------------\nmain\n"},{"id":13450,"name":"expat.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\lib\\xmlparse.c\");\nUSEUNIT(\"..\\lib\\xmlrole.c\");\nUSEUNIT(\"..\\lib\\xmltok.c\");\nUSEDEF(\"libexpat_mtd.def\");\n//---------------------------------------------------------------------------\n#define DllEntryPoint\n"},{"id":13451,"name":"libexpatw_mtd.def","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"; DEF file for BCB5\nLIBRARY   LIBEXPATW_MTD\nDESCRIPTION \"Implements an XML parser.\"\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\n; Aliases for MS compatible names\n  XML_DefaultCurrent = _XML_DefaultCurrent\n  XML_ErrorString = _XML_ErrorString\n  XML_ExpatVersion = _XML_ExpatVersion\n  XML_ExpatVersionInfo = _XML_ExpatVersionInfo\n  XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate\n  XML_GetBase = _XML_GetBase\n  XML_GetBuffer = _XML_GetBuffer\n  XML_GetCurrentByteCount = _XML_GetCurrentByteCount\n  XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex\n  XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber\n  XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber\n  XML_GetErrorCode = _XML_GetErrorCode\n  XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex\n  XML_GetInputContext = _XML_GetInputContext\n  XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount\n  XML_Parse = _XML_Parse\n  XML_ParseBuffer = _XML_ParseBuffer\n  XML_ParserCreate = _XML_ParserCreate\n  XML_ParserCreateNS = _XML_ParserCreateNS\n  XML_ParserCreate_MM = _XML_ParserCreate_MM\n  XML_ParserFree = _XML_ParserFree\n  XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler\n  XML_SetBase = _XML_SetBase\n  XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler\n  XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler\n  XML_SetCommentHandler = _XML_SetCommentHandler\n  XML_SetDefaultHandler = _XML_SetDefaultHandler\n  XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand\n  XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler\n  XML_SetElementDeclHandler = _XML_SetElementDeclHandler\n  XML_SetElementHandler = _XML_SetElementHandler\n  XML_SetEncoding = _XML_SetEncoding\n  XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler\n  XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler\n  XML_SetEndElementHandler = _XML_SetEndElementHandler\n  XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler\n  XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler\n  XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler\n  XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg\n  XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler\n  XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler\n  XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler\n  XML_SetParamEntityParsing = _XML_SetParamEntityParsing\n  XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler\n  XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet\n  XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler\n  XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler\n  XML_SetStartElementHandler = _XML_SetStartElementHandler\n  XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler\n  XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler\n  XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler\n  XML_SetUserData = _XML_SetUserData\n  XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler\n  XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg\n  XML_ParserReset = _XML_ParserReset\n  XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler\n  XML_GetFeatureList = _XML_GetFeatureList\n  XML_UseForeignDTD = _XML_UseForeignDTD\n  XML_FreeContentModel = _XML_FreeContentModel\n  XML_MemMalloc = _XML_MemMalloc\n  XML_MemRealloc = _XML_MemRealloc\n  XML_MemFree = _XML_MemFree\n  XML_StopParser = _XML_StopParser\n  XML_ResumeParser = _XML_ResumeParser\n  XML_GetParsingStatus = _XML_GetParsingStatus\n"},{"id":13452,"name":"expat_static.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\libexpats_mtd.lib\nOBJFILES = Release\\obj\\libexpat_static\\xmlparse.obj \\\n    Release\\obj\\libexpat_static\\xmlrole.obj \\\n    Release\\obj\\libexpat_static\\xmltok.obj\nRESFILES = \nMAINSOURCE = expat_static.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = \nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = \nSPARELIBS = \nDEFFILE = \n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\lib\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nLINKER = TLib\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\lib;$(BCB)\\include\nLIBPATH = ..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc\nLISTFILE = \n# ---------------------------------------------------------------------------\nCFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\libexpat_static -N0Release\\obj\\libexpat_static -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = \n# ---------------------------------------------------------------------------\nALLOBJ = $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES)\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = TLib\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n!if \"$(LISTFILE)\" ==  \"\"\nCOMMA =\n!else\nCOMMA = ,\n!endif\n\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) /u $@ @&&!\n    $(LFLAGS) $? $(COMMA) $(LISTFILE)\n\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13453,"name":"expatw.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\libexpatw_mtd.dll\nOBJFILES = Release\\obj\\libexpatw\\xmlparse.obj Release\\obj\\libexpatw\\xmlrole.obj \\\n    Release\\obj\\libexpatw\\xmltok.obj\nRESFILES = \nMAINSOURCE = expatw.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = \nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \\\n    ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \\\n    VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \\\n    dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\nSPARELIBS = \nDEFFILE = libexpatw_mtd.def\n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\lib\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\lib;$(BCB)\\include\nLIBPATH = ..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc\n# ---------------------------------------------------------------------------\nCFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\libexpatw -N0Release\\obj\\libexpatw -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = -IRelease\\obj\\libexpatw -D\"\" -aa -Tpd -x -Gn -Gi -w -q\n# ---------------------------------------------------------------------------\nALLOBJ = c0d32w.obj $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = ilink32\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) @&&!\n    $(LFLAGS) -L$(LIBPATH) +\n    $(ALLOBJ), +\n    $(PROJECT),, +\n    $(ALLLIB), +\n    $(DEFFILE), +\n    $(ALLRES)\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13454,"name":"makefile.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"all: setup expat expatw expat_static expatw_static elements outline xmlwf\n\nsetup:\n setup\n\nexpat:\n make -l -fexpat.mak\n\nexpatw:\n make -l -fexpatw.mak\n\nexpat_static:\n make -l -fexpat_static.mak\n\nexpatw_static:\n make -l -fexpatw_static.mak\n\nelements:\n make -l -felements.mak\n\noutline:\n make -l -foutline.mak\n\nxmlwf:\n make -l -fxmlwf.mak\n\nclean:\n# works on Win98/ME\n# deltree /y release\\obj\n# works on WinNT/2000\n del /s/f/q release\\obj\n\ndistclean:\n# works on Win98/ME\n# deltree /y release\\*.*\n# works on WinNT/2000\n del /s/f/q release\\*\n"},{"col":4,"comment":"null","endLoc":475,"header":"def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks)","id":13455,"name":"_draw_axislabels","nodeType":"Function","startLoc":467,"text":"def _draw_axislabels(self, renderer, bboxes, ticklabels_bbox, visible_ticks):\n\n        renderer.open_group('axis labels')\n\n        self.axislabels.draw(renderer, bboxes=bboxes,\n                             ticklabels_bbox_list=ticklabels_bbox,\n                             visible_ticks=visible_ticks)\n\n        renderer.close_group('axis labels')"},{"id":13456,"name":"expat.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\libexpat_mtd.dll\nOBJFILES = Release\\obj\\libexpat\\xmlparse.obj Release\\obj\\libexpat\\xmlrole.obj \\\n    Release\\obj\\libexpat\\xmltok.obj\nRESFILES = \nMAINSOURCE = expat.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = \nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \\\n    ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \\\n    VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \\\n    dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\nSPARELIBS = \nDEFFILE = libexpat_mtd.def\n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\lib\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\lib;$(BCB)\\include\nLIBPATH = ..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc\n# ---------------------------------------------------------------------------\nCFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\libexpat -N0Release\\obj\\libexpat -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = -IRelease\\obj\\libexpat -D\"\" -aa -Tpd -x -Gn -Gi -q\n# ---------------------------------------------------------------------------\nALLOBJ = c0d32.obj $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = ilink32\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) @&&!\n    $(LFLAGS) -L$(LIBPATH) +\n    $(ALLOBJ), +\n    $(PROJECT),, +\n    $(ALLLIB), +\n    $(DEFFILE), +\n    $(ALLRES)\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13457,"name":"expat_static.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\lib\\xmlparse.c\");\nUSEUNIT(\"..\\lib\\xmlrole.c\");\nUSEUNIT(\"..\\lib\\xmltok.c\");\n//---------------------------------------------------------------------------\n#define Library\n"},{"id":13458,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"\n                   Using a Borland compiler product\n\nThe files in this directory support using both the free Borland command-line\ncompiler tools and the Borland C++ Builder IDE.  The project files have been\ntested with both versions 5 and 6 of the C++ Builder product.\n\n             Using the free BCC32 command line compiler\n\nAfter downloading and installing the free C++ Builder commandline version,\nperform the following steps (assuming it was installed under C:\\Borland\\BCC55):\n\n1) Add \"C:\\Borland\\BCC55\\BIN\" to your path\n2) Set the environment variable BCB to \"C:\\Borland\\BCC55\".\n3) edit makefile.mak: enable or comment out the appropriate commands under\n   clean & distclean, depending on whether your OS can use deltree /y or\n   del /s/f/q.\n\nAfter that, you should simply cd to the bcb5 directory in your Expat directory\ntree (same structure as CVS) and run \"make all\" or just \"make\".\n\n                               Naming\n\nThe libraries have the base name \"libexpat\" followed optionally by an \"s\"\n(static) or a \"w\" (unicode version), then an underscore and optionally\n\"mt\" (multi-threaded) and \"d\" (dynamic RTL).\n\nTo change the name of the library a project file produces, edit the project\noption source (see step 1 under Unicode below) and change the name contained in\nthe PROJECT tag. In a make file, change the value assigned to the PROJECT\nvariable. Also, the LIBRARY entry in the .def file has to be changed to\ncorrespond to the new executable name.\n\n\n                       Unicode Considerations\n\nThere are no facilities in the BCB 5 GUI to create a unicode-enabled\napplication. Fortunately, it is not hard to do by hand.\n\n1. The startup .obj system file must be changed to the unicode version.\n   Go to Project|Edit Option Source, and scroll down to the ALLOBJ tag. Change\n   c0x32.obj to c0x32w.obj. Editing this file can be quirky, but usually the\n   following kludge will make the change stick. Close and save the file\n   (CTRL-F4) then open the options dialog (CTRL-Shift-F11), then click OK on\n   the dialog immediately without changing anything in it. If this doesn't work,\n   you will have to close the project completely and edit the .bpr file by hand.\n\n   If you are using a make file, just change the startup .obj file assigned\n   to the ALLOBJ variable.\n\n2. Add the macro define XML_UNICODE_WCHAR_T. In the GUI that goes in the options\n   dialog, Directories/Conditionals tab, in the Conditional define box. In a\n   make file, put it in the USERDEFINES variable.\n\n3. Of course, your code has to be written for unicode. As a start, the \"main\"\n   function is called \"wmain\". The tchar macros are an interesting way to\n   write code that can easily switch between unicode and utf-8. If these macros\n   are used, then simply adding the conditional define _UNICODE as well as\n   XML_UNICODE_WCHAR_T will bring in the unicode versions of the tchar macros.\n   Otherwise the utf-8 versions are used. xmlwf uses its own versions of the\n   tchar macros which are switched on and off by the XML_UNICODE macro, which\n   itself is set by the XML_UNICODE_WCHAR_T define.\n\n                              Threading\n\nThe libexpat libraries are all built to link with the multi-threaded dynamic RTL's.\nThat means they require CC32xxMT.DLL present on the installation target.\nTo create single-threaded libs, do the following:\n\n1. The compiler option for multi-threading must be turned off. Following the\n   instructions above to edit the option source, remove the -tWM option from\n   the CFLAG1 tag. In a make file, remove it from the CFLAG1 variable.\n\n2. The single threaded RTL must be called. change the RTL in the ALLLIB tag or\n   variable (GUI or makefile repectively) to the version without the \"mt\" in the\n   name. For example, change cw32mti.lib to cw32i.lib.\n\n                              Static RTL's\n\nTo build the libs with static RTL's do the following,\n\n1. For the static expatlibs, in the Tlib tab on the options dialog, uncheck the\n   \"Use dynamic RTL\" box. For the dynamic expatlibs, in the Linker tab on the\n   options dialog, uncheck \"Use dynamic RTL\". If you are using a make file,\n   remove the _RTLDLL assignment to the SYSDEFINES variable, and change the RTL\n   to the version without an \"i\" in the ALLLIB variable. For example,\n   cw32mti.lib would become cw32mt.lib.\n"},{"id":13459,"name":"expatw.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\lib\\xmlparse.c\");\nUSEUNIT(\"..\\lib\\xmlrole.c\");\nUSEUNIT(\"..\\lib\\xmltok.c\");\nUSEDEF(\"libexpatw_mtd.def\");\n//---------------------------------------------------------------------------\n#define DllEntryPoint\n"},{"id":13460,"name":"xmlwf.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\xmlwf.exe\"/>\n    <OBJFILES value=\"Release\\obj\\xmlwf\\codepage.obj Release\\obj\\xmlwf\\win32filemap.obj \n      Release\\obj\\xmlwf\\xmlfile.obj Release\\obj\\xmlwf\\xmlwf.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"Release\\libexpat_mtd.lib\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \n      ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \n      VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \n      dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\"/>\n    <PATHCPP value=\".;..\\xmlwf\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"ilink32\"/>\n    <USERDEFINES value=\"NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"xmlwf.bpf\"/>\n    <INCLUDEPATH value=\"..\\xmlwf;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\xmlwf;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-8065 -w-par -w-8027 -w-8026\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-O2 -X- -a8 -b -k- -vi -q -tWM -I..\\lib -c\"/>\n    <PFLAGS value=\"-N2Release\\obj\\xmlwf -N0Release\\obj\\xmlwf -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"-IRelease\\obj\\xmlwf -D&quot;&quot; -ap -Tpe -x -Gn -q\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"c0x32.obj $(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\xmlwf;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=5\nItem0=..\\xmlwf;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\xmlwf;$(BCB)\\lib;..\\xmlwf\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=6\nItem0=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP\nItem1=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE\nItem2=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T\nItem3=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG\nItem4=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T\nItem5=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE\n\n[HistoryLists\\hlIntOutputDir]\nCount=3\nItem0=Release\\obj\\xmlwf\nItem1=..\\xmlwf\\Release\nItem2=Release\n\n[HistoryLists\\hlFinalOutputDir]\nCount=3\nItem0=Release\\\nItem1=Release\nItem2=.\\Release\\\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=sample.xml\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"id":13461,"name":"xmlwf.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\xmlwf\\codepage.c\");\nUSEUNIT(\"..\\xmlwf\\win32filemap.c\");\nUSEUNIT(\"..\\xmlwf\\xmlfile.c\");\nUSEUNIT(\"..\\xmlwf\\xmlwf.c\");\nUSELIB(\"Release\\libexpat_mtd.lib\");\n//---------------------------------------------------------------------------\nmain\n"},{"id":13462,"name":"elements.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\elements.exe\nOBJFILES = Release\\obj\\examples\\elements.obj\nRESFILES = \nMAINSOURCE = elements.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = Release\\libexpats_mtd.lib\nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \\\n    ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \\\n    VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \\\n    dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\nSPARELIBS = \nDEFFILE = \n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\examples\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = WIN32;NDEBUG;_CONSOLE;XML_STATIC\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\examples;$(BCB)\\include\nLIBPATH = ..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS= -w-par -w-8027 -w-8026\n# ---------------------------------------------------------------------------\nCFLAG1 = -O2 -X- -a8 -b -k- -vi -q -I..\\lib -c\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\examples -N0Release\\obj\\examples -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = -IRelease\\obj\\examples -D\"\" -ap -Tpe -x -Gn -q -L..\\LIB\\RELEASE_STATIC\n# ---------------------------------------------------------------------------\nALLOBJ = c0x32.obj $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = ilink32\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) @&&!\n    $(LFLAGS) -L$(LIBPATH) +\n    $(ALLOBJ), +\n    $(PROJECT),, +\n    $(ALLLIB), +\n    $(DEFFILE), +\n    $(ALLRES)\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13463,"name":"outline.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\examples\\outline.c\");\nUSELIB(\"Release\\libexpat_mtd.lib\");\n//---------------------------------------------------------------------------\nmain\n"},{"id":13464,"name":"expatw_static.bpf","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"USEUNIT(\"..\\lib\\xmlparse.c\");\nUSEUNIT(\"..\\lib\\xmlrole.c\");\nUSEUNIT(\"..\\lib\\xmltok.c\");\n//---------------------------------------------------------------------------\n#define Library\n"},{"id":13465,"name":"outline.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\outline.exe\"/>\n    <OBJFILES value=\"Release\\obj\\examples\\outline.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"Release\\libexpat_mtd.lib\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \n      ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \n      VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \n      dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\"/>\n    <PATHCPP value=\".;..\\examples\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"ilink32\"/>\n    <USERDEFINES value=\"WIN32;NDEBUG;_CONSOLE\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"outline.bpf\"/>\n    <INCLUDEPATH value=\"..\\examples;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-par -w-8027 -w-8026\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-O2 -X- -a8 -b -k- -vi -q -tWM -I..\\lib -c\"/>\n    <PFLAGS value=\"-N2Release\\obj\\examples -N0Release\\obj\\examples -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"-IRelease\\obj\\examples -D&quot;&quot; -ap -Tpe -x -Gn -q\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"c0x32.obj $(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=3\nItem0=..\\examples;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=4\nItem0=..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\examples;$(BCB)\\lib;..\\examples\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=6\nItem0=WIN32;NDEBUG;_CONSOLE\nItem1=WIN32;NDEBUG;_CONSOLE;XML_STATIC\nItem2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC\nItem3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC\nItem4=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE\nItem5=WIN32;NDEBUG;_CONSOLE;_DEBUG\n\n[HistoryLists\\hlIntOutputDir]\nCount=4\nItem0=Release\\obj\\examples\nItem1=Release\\obj\\outline\nItem2=..\\examples\\Release\nItem3=Release\n\n[HistoryLists\\hlFinalOutputDir]\nCount=1\nItem0=Release\\\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"id":13466,"name":"xmlwf.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\xmlwf.exe\nOBJFILES = Release\\obj\\xmlwf\\codepage.obj Release\\obj\\xmlwf\\win32filemap.obj \\\n    Release\\obj\\xmlwf\\xmlfile.obj Release\\obj\\xmlwf\\xmlwf.obj\nRESFILES = \nMAINSOURCE = xmlwf.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = Release\\libexpat_mtd.lib\nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \\\n    ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \\\n    VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \\\n    dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\nSPARELIBS = \nDEFFILE = \n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\xmlwf\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\xmlwf;$(BCB)\\include\nLIBPATH = ..\\xmlwf;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS= -w-8065 -w-par -w-8027 -w-8026\n# ---------------------------------------------------------------------------\nCFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\\lib -c\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\xmlwf -N0Release\\obj\\xmlwf -$Y- -$L- -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = -IRelease\\obj\\xmlwf -D\"\" -ap -Tpe -x -Gn -q\n# ---------------------------------------------------------------------------\nALLOBJ = c0x32.obj $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = ilink32\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) @&&!\n    $(LFLAGS) -L$(LIBPATH) +\n    $(ALLOBJ), +\n    $(PROJECT),, +\n    $(ALLLIB), +\n    $(DEFFILE), +\n    $(ALLRES)\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13467,"name":"expatw_static.mak","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"# ---------------------------------------------------------------------------\n!if !$d(BCB)\nBCB = $(MAKEDIR)\\..\n!endif\n\n# ---------------------------------------------------------------------------\n# IDE SECTION\n# ---------------------------------------------------------------------------\n# The following section of the project makefile is managed by the BCB IDE.\n# It is recommended to use the IDE to change any of the values in this\n# section.\n# ---------------------------------------------------------------------------\n\nVERSION = BCB.05.03\n# ---------------------------------------------------------------------------\nPROJECT = Release\\libexpatws_mtd.lib\nOBJFILES = Release\\obj\\libexpatw_static\\xmlparse.obj \\\n    Release\\obj\\libexpatw_static\\xmlrole.obj \\\n    Release\\obj\\libexpatw_static\\xmltok.obj\nRESFILES = \nMAINSOURCE = expatw_static.bpf\nRESDEPEN = $(RESFILES)\nLIBFILES = \nIDLFILES = \nIDLGENFILES = \nLIBRARIES = \nPACKAGES = \nSPARELIBS = \nDEFFILE = \n# ---------------------------------------------------------------------------\nPATHCPP = .;..\\lib\nPATHASM = .;\nPATHPAS = .;\nPATHRC = .;\nLINKER = TLib\nDEBUGLIBPATH = $(BCB)\\lib\\debug\nRELEASELIBPATH = $(BCB)\\lib\\release\nUSERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T\nSYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\nINCLUDEPATH = ..\\lib;$(BCB)\\include\nLIBPATH = ..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nWARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc\nLISTFILE = \n# ---------------------------------------------------------------------------\nCFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c\nIDLCFLAGS = -I$(BCB)\\include\nPFLAGS = -N2Release\\obj\\libexpatw_static -N0Release\\obj\\libexpatw_static -$Y- -$L- \\\n    -$D-\nRFLAGS = /l 0x409 /d \"NDEBUG\" /i$(BCB)\\include\nAFLAGS = /mx /w2 /zn\nLFLAGS = \n# ---------------------------------------------------------------------------\nALLOBJ = $(OBJFILES)\nALLRES = $(RESFILES)\nALLLIB = $(LIBFILES) $(LIBRARIES)\n# ---------------------------------------------------------------------------\n!ifdef IDEOPTIONS\n\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n!endif\n\n\n\n\n\n# ---------------------------------------------------------------------------\n# MAKE SECTION\n# ---------------------------------------------------------------------------\n# This section of the project file is not used by the BCB IDE.  It is for\n# the benefit of building from the command-line using the MAKE utility.\n# ---------------------------------------------------------------------------\n\n.autodepend\n# ---------------------------------------------------------------------------\n!if \"$(USERDEFINES)\" != \"\"\nAUSERDEFINES = -d$(USERDEFINES:;= -d)\n!else\nAUSERDEFINES =\n!endif\n\n!if !$d(BCC32)\nBCC32 = bcc32\n!endif\n\n!if !$d(CPP32)\nCPP32 = cpp32\n!endif\n\n!if !$d(DCC32)\nDCC32 = dcc32\n!endif\n\n!if !$d(TASM32)\nTASM32 = tasm32\n!endif\n\n!if !$d(LINKER)\nLINKER = TLib\n!endif\n\n!if !$d(BRCC32)\nBRCC32 = brcc32\n!endif\n\n\n# ---------------------------------------------------------------------------\n!if $d(PATHCPP)\n.PATH.CPP = $(PATHCPP)\n.PATH.C   = $(PATHCPP)\n!endif\n\n!if $d(PATHPAS)\n.PATH.PAS = $(PATHPAS)\n!endif\n\n!if $d(PATHASM)\n.PATH.ASM = $(PATHASM)\n!endif\n\n!if $d(PATHRC)\n.PATH.RC  = $(PATHRC)\n!endif\n# ---------------------------------------------------------------------------\n!if \"$(LISTFILE)\" ==  \"\"\nCOMMA =\n!else\nCOMMA = ,\n!endif\n\n$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)\n    $(BCB)\\BIN\\$(LINKER) /u $@ @&&!\n    $(LFLAGS) $? $(COMMA) $(LISTFILE)\n\n!\n# ---------------------------------------------------------------------------\n.pas.hpp:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.pas.obj:\n    $(BCB)\\BIN\\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }\n\n.cpp.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.obj:\n    $(BCB)\\BIN\\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }\n\n.c.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.cpp.i:\n    $(BCB)\\BIN\\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }\n\n.asm.obj:\n    $(BCB)\\BIN\\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@\n\n.rc.res:\n    $(BCB)\\BIN\\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<\n# ---------------------------------------------------------------------------\n\n\n\n\n"},{"id":13468,"name":"expat.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\libexpat_mtd.dll\"/>\n    <OBJFILES value=\"Release\\obj\\libexpat\\xmlparse.obj Release\\obj\\libexpat\\xmlrole.obj \n      Release\\obj\\libexpat\\xmltok.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"libexpat_mtd.def\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \n      ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \n      VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \n      dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\"/>\n    <PATHCPP value=\".;..\\lib\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"ilink32\"/>\n    <USERDEFINES value=\"_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"expat.bpf\"/>\n    <INCLUDEPATH value=\"..\\lib;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-rch -w-par -w-8027 -w-8026 -w-ccc\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD\"/>\n    <PFLAGS value=\"-N2Release\\obj\\libexpat -N0Release\\obj\\libexpat -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"-IRelease\\obj\\libexpat -D&quot;&quot; -aa -Tpd -x -Gn -Gi -q\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"c0d32.obj $(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\lib;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=5\nItem0=..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\lib;$(BCB)\\lib;..\\lib\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=8\nItem0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS\nItem1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS\nItem2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS\nItem3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP\nItem4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS;COMPILED_FROM_DSP\nItem5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG\nItem6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG\nItem7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP\n\n[HistoryLists\\hlIntOutputDir]\nCount=7\nItem0=Release\\obj\\libexpat\nItem1=Release\\obj\\libexpat_static\nItem2=Release\\obj\\mtd\nItem3=Release\\obj\\mt\nItem4=Release\\obj\nItem5=Release\nItem6=..\\lib\\Release\n\n[HistoryLists\\hlFinalOutputDir]\nCount=1\nItem0=Release\\\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"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":668,"header":"def display_minor_ticks(self, display_minor_ticks)","id":13469,"name":"display_minor_ticks","nodeType":"Function","startLoc":659,"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)"},{"id":13470,"name":"setup.bat","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"REM CommandInterpreter: $(COMSPEC)\nif not exist .\\release\\nul mkdir release\nif not exist .\\release\\obj\\nul mkdir release\\obj\nif not exist .\\release\\obj\\libexpat\\nul mkdir release\\obj\\libexpat\nif not exist .\\release\\obj\\libexpatw\\nul mkdir release\\obj\\libexpatw\nif not exist .\\release\\obj\\libexpat_static\\nul mkdir release\\obj\\libexpat_static\nif not exist .\\release\\obj\\libexpatw_static\\nul mkdir release\\obj\\libexpatw_static\nif not exist .\\release\\obj\\examples\\nul mkdir release\\obj\\examples\nif not exist .\\release\\obj\\xmlwf\\nul mkdir release\\obj\\xmlwf\n"},{"id":13471,"name":"libexpat_mtd.def","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"; DEF file for BCB5\nLIBRARY   LIBEXPAT_MTD\nDESCRIPTION \"Implements an XML parser.\"\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\n; Aliases for MS compatible names\n  XML_DefaultCurrent = _XML_DefaultCurrent\n  XML_ErrorString = _XML_ErrorString\n  XML_ExpatVersion = _XML_ExpatVersion\n  XML_ExpatVersionInfo = _XML_ExpatVersionInfo\n  XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate\n  XML_GetBase = _XML_GetBase\n  XML_GetBuffer = _XML_GetBuffer\n  XML_GetCurrentByteCount = _XML_GetCurrentByteCount\n  XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex\n  XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber\n  XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber\n  XML_GetErrorCode = _XML_GetErrorCode\n  XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex\n  XML_GetInputContext = _XML_GetInputContext\n  XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount\n  XML_Parse = _XML_Parse\n  XML_ParseBuffer = _XML_ParseBuffer\n  XML_ParserCreate = _XML_ParserCreate\n  XML_ParserCreateNS = _XML_ParserCreateNS\n  XML_ParserCreate_MM = _XML_ParserCreate_MM\n  XML_ParserFree = _XML_ParserFree\n  XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler\n  XML_SetBase = _XML_SetBase\n  XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler\n  XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler\n  XML_SetCommentHandler = _XML_SetCommentHandler\n  XML_SetDefaultHandler = _XML_SetDefaultHandler\n  XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand\n  XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler\n  XML_SetElementDeclHandler = _XML_SetElementDeclHandler\n  XML_SetElementHandler = _XML_SetElementHandler\n  XML_SetEncoding = _XML_SetEncoding\n  XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler\n  XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler\n  XML_SetEndElementHandler = _XML_SetEndElementHandler\n  XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler\n  XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler\n  XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler\n  XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg\n  XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler\n  XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler\n  XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler\n  XML_SetParamEntityParsing = _XML_SetParamEntityParsing\n  XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler\n  XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet\n  XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler\n  XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler\n  XML_SetStartElementHandler = _XML_SetStartElementHandler\n  XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler\n  XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler\n  XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler\n  XML_SetUserData = _XML_SetUserData\n  XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler\n  XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg\n  XML_ParserReset = _XML_ParserReset\n  XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler\n  XML_GetFeatureList = _XML_GetFeatureList\n  XML_UseForeignDTD = _XML_UseForeignDTD\n  XML_FreeContentModel = _XML_FreeContentModel\n  XML_MemMalloc = _XML_MemMalloc\n  XML_MemRealloc = _XML_MemRealloc\n  XML_MemFree = _XML_MemFree\n  XML_StopParser = _XML_StopParser\n  XML_ResumeParser = _XML_ResumeParser\n  XML_GetParsingStatus = _XML_GetParsingStatus\n\n"},{"id":13472,"name":"cextern/expat/amiga","nodeType":"Package"},{"id":13473,"name":"expat_68k.h","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef EXPAT_68K_H\n#define EXPAT_68K_H\n\n#ifndef LIBRARIES_EXPAT_H\n#include <libraries/expat.h>\n#endif\n\ntypedef struct M68kXML_ParserStruct {\n\tXML_Parser p;\n\tstruct ExecIFace *IExec;\n\tvoid *handlerarg;\n\tvoid *extenthandlerarg;\n\tvoid *enchandlerarg;\n\tvoid *startelementhandler;\n\tvoid *endelementhandler;\n\tvoid *chardatahandler;\n\tvoid *procinsthandler;\n\tvoid *commenthandler;\n\tvoid *startcdatahandler;\n\tvoid *endcdatahandler;\n\tvoid *defaulthandler;\n\tvoid *defaulthandlerexp;\n\tvoid *extentrefhandler;\n\tvoid *unknownenchandler;\n\tvoid *startnamespacehandler;\n\tvoid *endnamespacehandler;\n\tvoid *xmldeclhandler;\n\tvoid *startdoctypehandler;\n\tvoid *enddoctypehandler;\n\tvoid *elementdeclhandler;\n\tvoid *attlistdeclhandler;\n\tvoid *entitydeclhandler;\n\tvoid *unparseddeclhandler;\n\tvoid *notationdeclhandler;\n\tvoid *notstandalonehandler;\n\tvoid *skippedentityhandler;\n} *M68kXML_Parser;\n\n/* expat_68k_handler_stubs.c */\nvoid _68k_startelementhandler(void *userdata, const char *name, const char **attrs);\nvoid _68k_endelementhandler(void *userdata, const char *name);\nvoid _68k_chardatahandler(void *userdata, const char *s, int len);\nvoid _68k_procinsthandler(void *userdata, const char *target, const char *data);\nvoid _68k_commenthandler(void *userdata, const char *data);\nvoid _68k_startcdatahandler(void *userdata);\nvoid _68k_endcdatahandler(void *userdata);\nvoid _68k_defaulthandler(void *userdata, const char *s, int len);\nvoid _68k_defaulthandlerexp(void *userdata, const char *s, int len);\nint _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base,\n\tconst char *sysid, const char *pubid);\nint _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info);\nvoid _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri);\nvoid _68k_endnamespacehandler(void *userdata, const char *prefix);\nvoid _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone);\nvoid _68k_startdoctypehandler(void *userdata, const char *doctypename,\n\tconst char *sysid, const char *pubid, int has_internal_subset);\nvoid _68k_enddoctypehandler(void *userdata);\nvoid _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model);\nvoid _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname,\n\tconst char *att_type, const char *dflt, int isrequired);\nvoid _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity,\n\tconst char *value, int value_length, const char *base, const char *sysid, const char *pubid,\n\tconst char *notationname);\nvoid _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base,\n\tconst char *sysid, const char *pubid, const char *notationname);\nvoid _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base,\n\tconst char *sysid, const char *pubid);\nint _68k_notstandalonehandler(void *userdata);\nvoid _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity);\n\n#endif\n"},{"id":13474,"name":"expat_lib.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifdef __USE_INLINE__\n#undef __USE_INLINE__\n#endif\n\n#define __NOLIBBASE__\n#define __NOGLOBALIFACE__\n\n#include <dos/dos.h>\n#include <proto/exec.h>\n\n#include \"expat_base.h\"\n\n\n#define LIBNAME\t\t\"expat.library\"\n#define LIBPRI\t\t0\n#define VERSION\t\t53\n#define REVISION\t1\n#define VSTRING\t\t\"expat.library 53.1 (7.8.2009)\"  /* dd.mm.yyyy */\n\n\nstatic const char* __attribute__((used)) verstag = \"\\0$VER: \" VSTRING;\n\n\nstruct Interface *INewlib = 0;\n\n\nstruct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys);\nuint32 libObtain (struct LibraryManagerInterface *Self);\nuint32 libRelease (struct LibraryManagerInterface *Self);\nstruct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version);\nBPTR libClose (struct LibraryManagerInterface *Self);\nBPTR libExpunge (struct LibraryManagerInterface *Self);\nstruct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer);\nvoid closeInterface(struct ExecIFace *IExec, struct Interface *iface);\n\n\nstatic APTR lib_manager_vectors[] = {\n\tlibObtain,\n\tlibRelease,\n\tNULL,\n\tNULL,\n\tlibOpen,\n\tlibClose,\n\tlibExpunge,\n\tNULL,\n\t(APTR)-1,\n};\n\n\nstatic struct TagItem lib_managerTags[] = {\n\t{ MIT_Name, (uint32)\"__library\" },\n\t{ MIT_VectorTable, (uint32)lib_manager_vectors },\n\t{ MIT_Version, 1 },\n\t{ TAG_END, 0 }\n};\n\n\nextern void *main_vectors[];\n\nstatic struct TagItem lib_mainTags[] = {\n\t{ MIT_Name, (uint32)\"main\" },\n\t{ MIT_VectorTable, (uint32)main_vectors },\n\t{ MIT_Version, 1 },\n\t{ TAG_END, 0 }\n};\n\n\nstatic APTR libInterfaces[] = {\n\tlib_managerTags,\n\tlib_mainTags,\n\tNULL\n};\n\n\nextern void *VecTable68K[];\n\nstatic struct TagItem libCreateTags[] = {\n\t{ CLT_DataSize, sizeof(struct ExpatBase) },\n\t{ CLT_InitFunc, (uint32)libInit },\n\t{ CLT_Interfaces, (uint32)libInterfaces },\n\t{ CLT_Vector68K, (uint32)VecTable68K },\n\t{ TAG_END, 0 }\n};\n\n\nstatic struct Resident __attribute__((used)) lib_res = {\n\tRTC_MATCHWORD,\t// rt_MatchWord\n\t&lib_res,\t\t// rt_MatchTag\n\t&lib_res+1,\t\t// rt_EndSkip\n\tRTF_NATIVE | RTF_AUTOINIT,\t// rt_Flags\n\tVERSION,\t\t// rt_Version\n\tNT_LIBRARY,\t\t// rt_Type\n\tLIBPRI,\t\t\t// rt_Pri\n\tLIBNAME,\t\t// rt_Name\n\tVSTRING,\t\t// rt_IdString\n\tlibCreateTags\t// rt_Init\n};\n\n\nint32 _start()\n{\n\treturn RETURN_FAIL;\n}\n\n\nstruct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *iexec)\n{\n\tlibBase->libNode.lib_Node.ln_Type = NT_LIBRARY;\n\tlibBase->libNode.lib_Node.ln_Pri = LIBPRI;\n\tlibBase->libNode.lib_Node.ln_Name = LIBNAME;\n\tlibBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED;\n\tlibBase->libNode.lib_Version = VERSION;\n\tlibBase->libNode.lib_Revision = REVISION;\n\tlibBase->libNode.lib_IdString = VSTRING;\n\n\tlibBase->SegList = seglist;\n\n\tlibBase->IExec = iexec;\n\tINewlib        = openInterface(iexec, \"newlib.library\", 0);\n\n\tif ( INewlib != 0 )  {\n\t\treturn libBase;\n\t}\n\n\tcloseInterface(iexec, INewlib);\n\tINewlib = 0;\n\n\tiexec->DeleteLibrary(&libBase->libNode);\n\n\treturn NULL;\n}\n\n\nuint32 libObtain( struct LibraryManagerInterface *Self )\n{\n\t++Self->Data.RefCount;\n\treturn Self->Data.RefCount;\n}\n\n\nuint32 libRelease( struct LibraryManagerInterface *Self )\n{\n\t--Self->Data.RefCount;\n\treturn Self->Data.RefCount;\n}\n\n\nstruct ExpatBase *libOpen( struct LibraryManagerInterface *Self, uint32 version )\n{\n\tstruct ExpatBase *libBase;\n\n\tlibBase = (struct ExpatBase *)Self->Data.LibBase;\n\n\t++libBase->libNode.lib_OpenCnt;\n\tlibBase->libNode.lib_Flags &= ~LIBF_DELEXP;\n\n\treturn libBase;\n}\n\n\nBPTR libClose( struct LibraryManagerInterface *Self )\n{\n\tstruct ExpatBase *libBase;\n\n\tlibBase = (struct ExpatBase *)Self->Data.LibBase;\n\n\t--libBase->libNode.lib_OpenCnt;\n\tif ( libBase->libNode.lib_OpenCnt ) {\n\t\treturn 0;\n\t}\n\n\tif ( libBase->libNode.lib_Flags & LIBF_DELEXP ) {\n\t\treturn (BPTR)Self->LibExpunge();\n\t}\n\telse {\n\t\treturn ZERO;\n\t}\n}\n\n\nBPTR libExpunge( struct LibraryManagerInterface *Self )\n{\n\tstruct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase;\n\tBPTR result = ZERO;\n\n\tif (libBase->libNode.lib_OpenCnt == 0) {\n\t\tlibBase->IExec->Remove(&libBase->libNode.lib_Node);\n\n\t\tresult = libBase->SegList;\n\n\t\tcloseInterface(libBase->IExec, INewlib);\n\t\tINewlib = 0;\n\n\t\tlibBase->IExec->DeleteLibrary(&libBase->libNode);\n\t}\n\telse {\n\t\tlibBase->libNode.lib_Flags |= LIBF_DELEXP;\n\t}\n\n\treturn result;\n}\n\n\nstruct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer)\n{\n\tstruct Library *base = IExec->OpenLibrary(libName, libVer);\n\tstruct Interface *iface = IExec->GetInterface(base, \"main\", 1, 0);\n\tif (iface == 0) {\n\t\tIExec->CloseLibrary(base);\n\t}\n\n\treturn iface;\n}\n\n\nvoid closeInterface(struct ExecIFace *IExec, struct Interface *iface)\n{\n\tif (iface != 0)\n\t{\n\t\tstruct Library *base = iface->Data.LibBase;\n\t\tIExec->DropInterface(iface);\n\t\tIExec->CloseLibrary(base);\n\t}\n}\n"},{"id":13475,"name":"expat_base.h","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifndef EXPAT_BASE_H\n#define EXPAT_BASE_H\n\n#include <exec/libraries.h>\n#include <dos/dos.h>\n#include <interfaces/exec.h>\n#include <interfaces/utility.h>\n\n\nstruct ExpatBase {\n\tstruct Library libNode;\n\tuint16 pad;\n\tBPTR SegList;\n\tstruct ExecIFace *IExec;\n};\n\n#endif\n"},{"id":13476,"name":"expatw_static.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\libexpatws_mtd.lib\"/>\n    <OBJFILES value=\"Release\\obj\\libexpatw_static\\xmlparse.obj \n      Release\\obj\\libexpatw_static\\xmlrole.obj \n      Release\\obj\\libexpatw_static\\xmltok.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"\"/>\n    <PATHCPP value=\".;..\\lib\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"TLib\"/>\n    <USERDEFINES value=\"_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"expatw_static.bpf\"/>\n    <INCLUDEPATH value=\"..\\lib;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-rch -w-par -w-8027 -w-8026 -w-ccc\"/>\n    <LISTFILE value=\"\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-O2 -X- -a8 -b -k- -vi -q -tWM -c\"/>\n    <PFLAGS value=\"-N2Release\\obj\\libexpatw_static -N0Release\\obj\\libexpatw_static -$Y- -$L- \n      -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"$(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES)\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\lib;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=5\nItem0=..\\lib;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\lib;$(BCB)\\lib;..\\lib\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=15\nItem0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T\nItem1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T\nItem2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T\nItem3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T\nItem4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T\nItem5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG\nItem6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus\nItem7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG\nItem8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG\nItem9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T\nItem10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE\nItem11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG;_UNICODE\nItem12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG\nItem13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T\nItem14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;XML_UNICODE\n\n[HistoryLists\\hlIntOutputDir]\nCount=6\nItem0=Release\\obj\\libexpatw_static\nItem1=Release\\obj\\libexpat_static\nItem2=Release\\obj\\mts\nItem3=Release\\obj\\mt\nItem4=..\\lib\\Release-w_static\nItem5=Release-w_static\n\n[HistoryLists\\hlFinalOutputDir]\nCount=3\nItem0=Release\\\nItem1=Release\nItem2=Release-w_static\\\n\n[HistoryLists\\hlTlibPageSize]\nCount=1\nItem0=0x0010\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"id":13477,"name":"elements.bpr","nodeType":"TextFile","path":"cextern/expat/bcb5","text":"<?xml version='1.0' encoding='utf-8' ?>\n<!-- C++Builder XML Project -->\n<PROJECT>\n  <MACROS>\n    <VERSION value=\"BCB.05.03\"/>\n    <PROJECT value=\"Release\\elements.exe\"/>\n    <OBJFILES value=\"Release\\obj\\examples\\elements.obj\"/>\n    <RESFILES value=\"\"/>\n    <IDLFILES value=\"\"/>\n    <IDLGENFILES value=\"\"/>\n    <DEFFILE value=\"\"/>\n    <RESDEPEN value=\"$(RESFILES)\"/>\n    <LIBFILES value=\"Release\\libexpats_mtd.lib\"/>\n    <LIBRARIES value=\"\"/>\n    <SPARELIBS value=\"\"/>\n    <PACKAGES value=\"VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \n      ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \n      VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \n      dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi\"/>\n    <PATHCPP value=\".;..\\examples\"/>\n    <PATHPAS value=\".;\"/>\n    <PATHRC value=\".;\"/>\n    <PATHASM value=\".;\"/>\n    <DEBUGLIBPATH value=\"$(BCB)\\lib\\debug\"/>\n    <RELEASELIBPATH value=\"$(BCB)\\lib\\release\"/>\n    <LINKER value=\"ilink32\"/>\n    <USERDEFINES value=\"WIN32;NDEBUG;_CONSOLE;XML_STATIC\"/>\n    <SYSDEFINES value=\"_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL\"/>\n    <MAINSOURCE value=\"elements.bpf\"/>\n    <INCLUDEPATH value=\"..\\examples;$(BCB)\\include\"/>\n    <LIBPATH value=\"..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\"/>\n    <WARNINGS value=\"-w-par -w-8027 -w-8026\"/>\n  </MACROS>\n  <OPTIONS>\n    <IDLCFLAGS value=\"-I$(BCB)\\include\"/>\n    <CFLAG1 value=\"-O2 -X- -a8 -b -k- -vi -q -tWM -I..\\lib -c\"/>\n    <PFLAGS value=\"-N2Release\\obj\\examples -N0Release\\obj\\examples -$Y- -$L- -$D-\"/>\n    <RFLAGS value=\"/l 0x409 /d &quot;NDEBUG&quot; /i$(BCB)\\include\"/>\n    <AFLAGS value=\"/mx /w2 /zn\"/>\n    <LFLAGS value=\"-IRelease\\obj\\examples -D&quot;&quot; -ap -Tpe -x -Gn -q -L..\\LIB\\RELEASE_STATIC\"/>\n  </OPTIONS>\n  <LINKER>\n    <ALLOBJ value=\"c0x32.obj $(OBJFILES)\"/>\n    <ALLRES value=\"$(RESFILES)\"/>\n    <ALLLIB value=\"$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib\"/>\n  </LINKER>\n  <IDEOPTIONS>\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1033\nCodePage=1252\n\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n[HistoryLists\\hlIncludePath]\nCount=4\nItem0=..\\examples;$(BCB)\\include\nItem1=$(BCB)\\include\nItem2=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl\nItem3=$(BCB)\\include;$(BCB)\\include\\mfc;$(BCB)\\include\\atl;\n\n[HistoryLists\\hlLibraryPath]\nCount=8\nItem0=..\\examples;$(BCB)\\lib;$(RELEASELIBPATH)\nItem1=..\\examples;$(BCB)\\lib;..\\examples\\$(RELEASELIBPATH)\nItem2=$(BCB)\\lib;$(RELEASELIBPATH)\nItem3=$(BCB)\\lib;$(RELEASELIBPATH);..\\lib\\Release-w_static\nItem4=$(BCB)\\lib;$(RELEASELIBPATH);..\\lib\\Release_static\nItem5=$(BCB)\\lib;$(RELEASELIBPATH);C:\\src\\expat\\lib\\Release_static\nItem6=$(BCB)\\lib;$(RELEASELIBPATH);$(BCB)\\lib\\psdk\nItem7=$(BCB)\\lib;$(RELEASELIBPATH);;$(BCB)\\lib\\psdk;\n\n[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\n\n[HistoryLists\\hlConditionals]\nCount=17\nItem0=WIN32;NDEBUG;_CONSOLE;XML_STATIC\nItem1=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC\nItem2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC\nItem3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE\nItem4=WIN32;NDEBUG;_CONSOLE;_DEBUG\nItem5=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG\nItem6=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;_UNICODE\nItem7=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T\nItem8=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T\nItem9=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T\nItem10=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE\nItem11=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;__WCHAR_T\nItem12=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE\nItem13=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE;_UNICODE\nItem14=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE\nItem15=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG\nItem16=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC\n\n[HistoryLists\\hlIntOutputDir]\nCount=5\nItem0=Release\\obj\\examples\nItem1=Release\\obj\\elements\nItem2=Release\\obj\\mts\nItem3=..\\examples\\Release\nItem4=Release\n\n[HistoryLists\\hlFinalOutputDir]\nCount=1\nItem0=Release\\\n\n[Debugging]\nDebugSourceDirs=\n\n[Parameters]\nRunParams=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteDebug=0\n\n[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n  </IDEOPTIONS>\n</PROJECT>"},{"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":682,"header":"def set_minor_frequency(self, frequency)","id":13478,"name":"set_minor_frequency","nodeType":"Function","startLoc":673,"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"},{"attributeType":"WCSAxes","col":8,"comment":"null","endLoc":68,"id":13479,"name":"parent_axes","nodeType":"Attribute","startLoc":68,"text":"self.parent_axes"},{"attributeType":"null","col":8,"comment":"null","endLoc":90,"id":13480,"name":"axislabels","nodeType":"Attribute","startLoc":90,"text":"self.axislabels"},{"attributeType":"null","col":8,"comment":"null","endLoc":110,"id":13481,"name":"grid_lines_kwargs","nodeType":"Attribute","startLoc":110,"text":"self.grid_lines_kwargs"},{"id":13482,"name":"expat.xml","nodeType":"TextFile","path":"cextern/expat/amiga","text":"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE library SYSTEM \"library.dtd\">\n<!-- autogenerated by fdtrans v51.16 -->\n<library name=\"expat\" basename=\"ExpatBase\" basetype=\"Library\" openname=\"expat.library\">\n\t<include>libraries/expat.h</include>\n\t<interface name=\"main\" version=\"1.0\" struct=\"ExpatIFace\" prefix=\"_Expat_\" asmprefix=\"IExpat\" global=\"IExpat\">\n\t\t<method name=\"Obtain\" result=\"uint32\"/>\n\t\t<method name=\"Release\" result=\"uint32\"/>\n\t\t<method name=\"Expunge\" result=\"void\" status=\"unimplemented\"/>\n\t\t<method name=\"Clone\" result=\"struct Interface *\" status=\"unimplemented\"/>\n\t\t<method name=\"XML_ParserCreate\" result=\"XML_Parser\">\n\t\t\t<arg name=\"encodingName\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_ParserCreateNS\" result=\"XML_Parser\">\n\t\t\t<arg name=\"encodingName\" type=\"const XML_Char *\"/>\n\t\t\t<arg name=\"nsSep\" type=\"XML_Char\"/>\n\t\t</method>\n\t\t<method name=\"XML_ParserCreate_MM\" result=\"XML_Parser\">\n\t\t\t<arg name=\"encoding\" type=\"const XML_Char *\"/>\n\t\t\t<arg name=\"memsuite\" type=\"const XML_Memory_Handling_Suite *\"/>\n\t\t\t<arg name=\"namespaceSeparator\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_ExternalEntityParserCreate\" result=\"XML_Parser\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"context\" type=\"const XML_Char *\"/>\n\t\t\t<arg name=\"encoding\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_ParserFree\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_Parse\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"s\" type=\"const char *\"/>\n\t\t\t<arg name=\"len\" type=\"int\"/>\n\t\t\t<arg name=\"isFinal\" type=\"int\"/>\n\t\t</method>\n\t\t<method name=\"XML_ParseBuffer\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"len\" type=\"int\"/>\n\t\t\t<arg name=\"isFinal\" type=\"int\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetBuffer\" result=\"void *\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"len\" type=\"int\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetStartElementHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartElementHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEndElementHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndElementHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetElementHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartElementHandler\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndElementHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetCharacterDataHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_CharacterDataHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetProcessingInstructionHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_ProcessingInstructionHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetCommentHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_CommentHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetStartCdataSectionHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartCdataSectionHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEndCdataSectionHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndCdataSectionHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetCdataSectionHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartCdataSectionHandler\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndCdataSectionHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetDefaultHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_DefaultHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetDefaultHandlerExpand\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_DefaultHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetExternalEntityRefHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_ExternalEntityRefHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetExternalEntityRefHandlerArg\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"arg\" type=\"void *\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetUnknownEncodingHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_UnknownEncodingHandler\"/>\n\t\t\t<arg name=\"data\" type=\"void *\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetStartNamespaceDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartNamespaceDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEndNamespaceDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndNamespaceDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetNamespaceDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartNamespaceDeclHandler\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndNamespaceDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetXmlDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_XmlDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetStartDoctypeDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartDoctypeDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEndDoctypeDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndDoctypeDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetDoctypeDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"start\" type=\"XML_StartDoctypeDeclHandler\"/>\n\t\t\t<arg name=\"end\" type=\"XML_EndDoctypeDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetElementDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"eldecl\" type=\"XML_ElementDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetAttlistDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"attdecl\" type=\"XML_AttlistDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEntityDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_EntityDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetUnparsedEntityDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_UnparsedEntityDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetNotationDeclHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_NotationDeclHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetNotStandaloneHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_NotStandaloneHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetErrorCode\" result=\"enum XML_Error\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_ErrorString\" result=\"const XML_LChar *\">\n\t\t\t<arg name=\"code\" type=\"enum XML_Error\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetCurrentByteIndex\" result=\"long\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetCurrentLineNumber\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetCurrentColumnNumber\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetCurrentByteCount\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetInputContext\" result=\"const char *\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"offset\" type=\"int *\"/>\n\t\t\t<arg name=\"size\" type=\"int *\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetUserData\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"userData\" type=\"void *\"/>\n\t\t</method>\n\t\t<method name=\"XML_DefaultCurrent\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_UseParserAsHandlerArg\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetBase\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"base\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetBase\" result=\"const XML_Char *\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetSpecifiedAttributeCount\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetIdAttributeIndex\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetEncoding\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"encoding\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetParamEntityParsing\" result=\"int\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"parsing\" type=\"enum XML_ParamEntityParsing\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetReturnNSTriplet\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"do_nst\" type=\"int\"/>\n\t\t</method>\n\t\t<method name=\"XML_ExpatVersion\" result=\"const XML_LChar *\">\n\t\t</method>\n\t\t<method name=\"XML_ExpatVersionInfo\" result=\"XML_Expat_Version\">\n\t\t</method>\n\t\t<method name=\"XML_ParserReset\" result=\"XML_Bool\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"encoding\" type=\"const XML_Char *\"/>\n\t\t</method>\n\t\t<method name=\"XML_SetSkippedEntityHandler\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"handler\" type=\"XML_SkippedEntityHandler\"/>\n\t\t</method>\n\t\t<method name=\"XML_UseForeignDTD\" result=\"enum XML_Error\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"useDTD\" type=\"XML_Bool\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetFeatureList\" result=\"const XML_Feature *\">\n\t\t</method>\n\t\t<method name=\"XML_StopParser\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"resumable\" type=\"XML_Bool\"/>\n\t\t</method>\n\t\t<method name=\"XML_ResumeParser\" result=\"enum XML_Status\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t</method>\n\t\t<method name=\"XML_GetParsingStatus\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"status\" type=\"XML_ParsingStatus *\"/>\n\t\t</method>\n\t\t<method name=\"XML_FreeContentModel\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"model\" type=\"XML_Content *\"/>\n\t\t</method>\n\t\t<method name=\"XML_MemMalloc\" result=\"void *\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"size\" type=\"size_t\"/>\n\t\t</method>\n\t\t<method name=\"XML_MemRealloc\" result=\"void *\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"ptr\" type=\"void *\"/>\n\t\t\t<arg name=\"size\" type=\"size_t\"/>\n\t\t</method>\n\t\t<method name=\"XML_MemFree\" result=\"void\">\n\t\t\t<arg name=\"parser\" type=\"XML_Parser\"/>\n\t\t\t<arg name=\"ptr\" type=\"void *\"/>\n\t\t</method>\n\t</interface>\n</library>\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":83,"id":13483,"name":"ticklabels","nodeType":"Attribute","startLoc":83,"text":"self.ticklabels"},{"attributeType":"null","col":8,"comment":"null","endLoc":80,"id":13484,"name":"ticks","nodeType":"Attribute","startLoc":80,"text":"self.ticks"},{"attributeType":"null","col":12,"comment":"null","endLoc":170,"id":13485,"name":"coord_wrap","nodeType":"Attribute","startLoc":170,"text":"self.coord_wrap"},{"id":13486,"name":"Makefile","nodeType":"TextFile","path":"cextern/expat/amiga","text":"#\n# Makefile for AmigaOS\n#\n\n.PHONY: help all check clean package\n.PHONY: clib2 newlib library so\n\nvpath %.c ../lib ../examples ../xmlwf ../tests ../tests/benchmark\nvpath %.h ../lib ../tests\n\n#############################################################################\n\nhelp:\n\t@echo \"Requires:\"\n\t@echo \" AmigaOS 4.x\"\n\t@echo \" SDK 53.13\"\n\t@echo \"\"\n\t@echo \"Targets:\"\n\t@echo \" all     - make libraries, xmlwf, examples and runs tests\"\n\t@echo \" install - install expat libraries and tools into SDK\"\n\t@echo \" clean   - clean object files\"\n\t@echo \" check   - run all the tests\"\n\t@echo \" package - prepare distribution archive\"\n\nall: clib2 newlib library so check\n\nclib2: clib2/libexpat.a clib2/xmlwf clib2/elements clib2/outline clib2/runtests clib2/benchmark\n\nnewlib: newlib/libexpat.a newlib/xmlwf newlib/elements newlib/outline newlib/runtests newlib/benchmark\n\nlibrary: libs/expat.library libs/xmlwf libs/elements libs/outline libs/runtests libs/benchmark\n\nso: so/libexpat.so so/xmlwf so/elements so/outline so/runtests so/benchmark\n\ncheck: clib2/runtests newlib/runtests libs/runtests so/runtests\n\tclib2/runtests\n\tnewlib/runtests\n\tlibs/runtests\n\tso/runtests\n\nclean:\n\t-delete clib2/#?.o quiet\n\t-delete newlib/#?.o quiet\n\t-delete libs/#?.o quiet\n\t-delete so/#?.o quiet\n\npackage:\n\t$(MAKE) all\n\t-delete T:expat all force quiet\n\tmakedir all T:expat/Workbench/Libs\n\tcopy clone libs/expat.library T:expat/Workbench/Libs\n\tmakedir all T:expat/Workbench/SObjs\n\tcopy clone so/libexpat.so T:expat/Workbench/SObjs\n\tmakedir all T:expat/SDK/Local/C\n\tcopy clone libs/xmlwf T:expat/SDK/Local/C\n\tmakedir all T:expat/SDK/Local/clib2/lib\n\tcopy clone clib2/libexpat.a T:expat/SDK/Local/clib2/lib\n\tmakedir all T:expat/SDK/Local/newlib/lib\n\tcopy clone newlib/libexpat.a T:expat/SDK/Local/newlib/lib\n\tmakedir all T:expat/SDK/Local/common/include\n\tcopy clone /lib/expat.h /lib/expat_external.h T:expat/SDK/Local/common/include\n\tmakedir all T:expat/SDK/Include/include_h/inline4\n\tcopy clone include/inline4/expat.h T:expat/SDK/Include/include_h/inline4\n\tmakedir all T:expat/SDK/Include/include_h/interfaces\n\tcopy clone include/interfaces/expat.h T:expat/SDK/Include/include_h/interfaces\n\tmakedir all T:expat/SDK/Include/include_h/libraries\n\tcopy clone include/libraries/expat.h T:expat/SDK/Include/include_h/libraries\n\tmakedir all T:expat/SDK/Include/include_h/proto\n\tcopy clone include/proto/expat.h T:expat/SDK/Include/include_h/proto\n\tmakedir all T:expat/SDK/Documentation/Libs/Expat\n\tcopy clone /COPYING T:expat/SDK/Documentation/Libs/Expat\n\tcopy clone /README T:expat/SDK/Documentation/Libs/Expat\n\tcopy clone README.txt T:expat/SDK/Documentation/Libs/Expat/README.AmigaOS\n\t-delete expat.lha\n\tlha -r a expat.lha T:expat\n\n#############################################################################\n\nCC         := gcc\nLIBTOOL    := ar\nSTRIP      := strip\n\nCFLAGS     := -DNDEBUG -O3\nLTFLAGS    := -crs\nSTRIPFLAGS := -R.comment\n\n#############################################################################\n\nclib2/libexpat.a: clib2/xmlparse.o clib2/xmltok.o clib2/xmlrole.o\n\t$(LIBTOOL) $(LTFLAGS) $@ $^\n\tprotect $@ -e\n\nclib2/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \\\n\texpat_external.h internal.h amigaconfig.h\n\nclib2/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \\\n\tinternal.h amigaconfig.h\n\nclib2/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \\\n\tiasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \\\n\texpat_external.h internal.h amigaconfig.h\n\n#############################################################################\n\nclib2/xmlwf: clib2/xmlwf.o clib2/xmlfile.o clib2/codepage.o clib2/readfilemap.o\n\t$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nclib2/xmlwf.o: xmlwf.c\n\nclib2/xmlfile.o: xmlfile.c\n\nclib2/codepage.o: codepage.c\n\nclib2/readfilemap.o: readfilemap.c\n\n#############################################################################\n\nclib2/elements: clib2/elements.o\n\t$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nclib2/elements.o: elements.c\n\n#############################################################################\n\nclib2/outline: clib2/outline.o\n\t$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nclib2/outline.o: outline.c\n\n#############################################################################\n\nclib2/runtests: clib2/runtests.o clib2/chardata.o clib2/minicheck.o\n\t$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a\n\nclib2/chardata.o: chardata.c chardata.h\n\nclib2/minicheck.o: minicheck.c minicheck.h\n\nclib2/runtests.o: runtests.c chardata.h\n\n#############################################################################\n\nclib2/benchmark: clib2/benchmark.o\n\t$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a -lm\n\nclib2/benchmark.o: benchmark.c\n\n#############################################################################\n\nnewlib/libexpat.a: newlib/xmlparse.o newlib/xmltok.o newlib/xmlrole.o\n\t$(LIBTOOL) $(LTFLAGS) $@ $^\n\tprotect $@ -e\n\nnewlib/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \\\n\texpat_external.h internal.h amigaconfig.h\n\nnewlib/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \\\n\tinternal.h amigaconfig.h\n\nnewlib/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \\\n\tiasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \\\n\texpat_external.h internal.h amigaconfig.h\n\n#############################################################################\n\nnewlib/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o\n\t$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nnewlib/xmlwf.o: xmlwf.c\n\nnewlib/xmlfile.o: xmlfile.c\n\nnewlib/codepage.o: codepage.c\n\nnewlib/readfilemap.o: readfilemap.c\n\n#############################################################################\n\nnewlib/elements: newlib/elements.o\n\t$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nnewlib/elements.o: elements.c\n\n#############################################################################\n\nnewlib/outline: newlib/outline.o\n\t$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a\n\t$(STRIP) $(STRIPFLAGS) $@\n\nnewlib/outline.o: outline.c\n\n#############################################################################\n\nnewlib/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o\n\t$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a\n\nnewlib/chardata.o: chardata.c chardata.h\n\nnewlib/minicheck.o: minicheck.c minicheck.h\n\nnewlib/runtests.o: runtests.c chardata.h\n\n#############################################################################\n\nnewlib/benchmark: newlib/benchmark.o\n\t$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a\n\nnewlib/benchmark.o: benchmark.c\n\n#############################################################################\n\nlibs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o newlib/libexpat.a\n\t$(CC) -mcrt=newlib -nostartfiles $^ -o $@ newlib/libexpat.a -Wl,--cref,-M,-Map=$@.map\n\tprotect $@ -e\n\t$(STRIP) $(STRIPFLAGS) $@\n\nlibs/expat_lib.o: expat_lib.c expat_base.h\n\nlibs/expat_68k.o: expat_68k.c expat_68k.h expat_base.h\n\nlibs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h\n\nlibs/expat_vectors.o: expat_vectors.c\n\nlibs/launch.o: launch.c\n\n#############################################################################\n\nlibs/xmlwf: libs/xmlwf.o libs/xmlfile.o libs/codepage.o libs/readfilemap.o libs/launch.o\n\t$(CC) -mcrt=newlib $^ -o $@\n\t$(STRIP) $(STRIPFLAGS) $@\n\nlibs/xmlwf.o: xmlwf.c\n\nlibs/xmlfile.o: xmlfile.c\n\nlibs/codepage.o: codepage.c\n\nlibs/readfilemap.o: readfilemap.c\n\n#############################################################################\n\nlibs/elements: libs/elements.o libs/launch.o\n\t$(CC) -mcrt=newlib $^ -o $@\n\t$(STRIP) $(STRIPFLAGS) $@\n\nlibs/elements.o: elements.c\n\n#############################################################################\n\nlibs/outline: libs/outline.o libs/launch.o\n\t$(CC) -mcrt=newlib $^ -o $@\n\t$(STRIP) $(STRIPFLAGS) $@\n\nlibs/outline.o: outline.c\n\n#############################################################################\n\nlibs/runtests: libs/runtests.o libs/chardata.o libs/minicheck.o libs/launch.o\n\t$(CC) -mcrt=newlib $^ -o $@\n\nlibs/chardata.o: chardata.c chardata.h\n\nlibs/minicheck.o: minicheck.c minicheck.h\n\nlibs/runtests.o: runtests.c chardata.h\n\n#############################################################################\n\nlibs/benchmark: libs/benchmark.o libs/launch.o\n\t$(CC) -mcrt=newlib $^ -o $@\n\nlibs/benchmark.o: benchmark.c\n\n#############################################################################\n\nso/libexpat.so: so/xmlparse.o so/xmltok.o so/xmlrole.o\n\t$(CC) -mcrt=newlib -shared -o $@ $^\n\tprotect $@ -e\n\nso/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \\\n\texpat_external.h internal.h amigaconfig.h\n\nso/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \\\n\tinternal.h amigaconfig.h\n\nso/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \\\n\tiasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \\\n\texpat_external.h internal.h amigaconfig.h\n\n#############################################################################\n\nso/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o\n\t$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat\n\t$(STRIP) $(STRIPFLAGS) $@\n\n#############################################################################\n\nso/elements: newlib/elements.o\n\t$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat\n\t$(STRIP) $(STRIPFLAGS) $@\n\n#############################################################################\n\nso/outline: newlib/outline.o\n\t$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat\n\t$(STRIP) $(STRIPFLAGS) $@\n\n#############################################################################\n\nso/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o\n\t$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat\n\n#############################################################################\n\nso/benchmark: newlib/benchmark.o\n\t$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat\n\n#############################################################################\n\nclib2/%.o: %.c\n\t$(CC) -mcrt=clib2 $(CFLAGS) -I../lib -c $< -o $@\n\nnewlib/%.o: %.c\n\t$(CC) -mcrt=newlib $(CFLAGS) -I../lib -c $< -o $@\n\nlibs/%.o: %.c\n\t$(CC) -mcrt=newlib $(CFLAGS) -D__USE_INLINE__ -I. -Iinclude -Iinclude/libraries -I../lib -c $< -o $@\n\nso/%.o: %.c\n\t$(CC) -mcrt=newlib $(CFLAGS) -fPIC -I../lib -c $< -o $@\n"},{"id":13487,"name":"expat_68k.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/*\n** Note: This file was originally automatically generated by fdtrans.\n*/\n\n#ifdef __USE_INLINE__\n#undef __USE_INLINE__\n#endif\n\n#include <exec/interfaces.h>\n#include <exec/libraries.h>\n#include <exec/emulation.h>\n#include <proto/exec.h>\n#include <interfaces/expat.h>\n#include \"expat_68k.h\"\n#include \"expat_base.h\"\n\n\nSTATIC ULONG stub_OpenPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary;\n\n\treturn (ULONG) Self->Open(0);\n}\nstruct EmuTrap stub_Open = { TRAPINST, TRAPTYPE, stub_OpenPPC };\n\nSTATIC ULONG stub_ClosePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary;\n\n\treturn (ULONG) Self->Close();\n}\nstruct EmuTrap stub_Close = { TRAPINST, TRAPTYPE, stub_ClosePPC };\n\nSTATIC ULONG stub_ExpungePPC(ULONG *regarray)\n{\n\treturn 0UL;\n}\nstruct EmuTrap stub_Expunge = { TRAPINST, TRAPTYPE, stub_ExpungePPC };\n\nSTATIC ULONG stub_ReservedPPC(ULONG *regarray)\n{\n\treturn 0UL;\n}\nstruct EmuTrap stub_Reserved = { TRAPINST, TRAPTYPE, stub_ReservedPPC };\n\nstatic M68kXML_Parser stub_XML_ParserCreatePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\tstruct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;\n\n\tM68kXML_Parser p;\n\tp = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);\n\tif (p) {\n\t\tp->p = Self->XML_ParserCreate((const XML_Char *)regarray[8]);\n\t\tif (p->p) {\n\t\t\tp->IExec = IExec;\n\t\t\tSelf->XML_SetUserData(p->p, p);\n\t\t\treturn p;\n\t\t}\n\t\tIExec->FreeVec(p);\n\t}\n\treturn NULL;\n}\nstruct EmuTrap stub_XML_ParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreatePPC };\n\nstatic M68kXML_Parser stub_XML_ParserCreateNSPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\tstruct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;\n\n\tM68kXML_Parser p;\n\tp = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);\n\tif (p) {\n\t\tp->p = Self->XML_ParserCreateNS((const XML_Char *)regarray[8], (XML_Char)regarray[0]);\n\t\tif (p->p) {\n\t\t\tp->IExec = IExec;\n\t\t\tSelf->XML_SetUserData(p->p, p);\n\t\t\treturn p;\n\t\t}\n\t\tIExec->FreeVec(p);\n\t}\n\treturn NULL;\n}\nstruct EmuTrap stub_XML_ParserCreateNS = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreateNSPPC };\n\nstatic M68kXML_Parser stub_XML_ParserCreate_MMPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\tstruct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;\n\n\tM68kXML_Parser p;\n\tp = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);\n\tif (p) {\n\t\tp->p = Self->XML_ParserCreate_MM((const XML_Char *)regarray[8],\n\t\t\t(const XML_Memory_Handling_Suite *)regarray[9],\n\t\t\t(const XML_Char *)regarray[10]);\n\t\tif (p->p) {\n\t\t\tp->IExec = IExec;\n\t\t\tSelf->XML_SetUserData(p->p, p);\n\t\t\treturn p;\n\t\t}\n\t\tIExec->FreeVec(p);\n\t}\n\treturn NULL;\n}\nstruct EmuTrap stub_XML_ParserCreate_MM = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreate_MMPPC };\n\nstatic M68kXML_Parser stub_XML_ExternalEntityParserCreatePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\tstruct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;\n\n\tM68kXML_Parser p;\n\tp = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR);\n\tif (p) {\n\t\tp->p = Self->XML_ExternalEntityParserCreate((XML_Parser)regarray[8],\n\t\t\t(const XML_Char *)regarray[9], (const XML_Char *)regarray[10]);\n\t\tif (p->p) {\n\t\t\tp->IExec = IExec;\n\t\t\tSelf->XML_SetUserData(p->p, p);\n\t\t\treturn p;\n\t\t}\n\t\tIExec->FreeVec(p);\n\t}\n\treturn NULL;\n}\nstruct EmuTrap stub_XML_ExternalEntityParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExternalEntityParserCreatePPC };\n\nstatic void stub_XML_ParserFreePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\tstruct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tif (p) {\n\t\tSelf->XML_ParserFree(p->p);\n\t\tIExec->FreeVec(p);\n\t}\n}\nstruct EmuTrap stub_XML_ParserFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserFreePPC };\n\nstatic int stub_XML_ParsePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_SetUserData(p->p, p);\n\treturn Self->XML_Parse(p->p, (const char *)regarray[9], (int)regarray[0], (int)regarray[1]);\n}\nstruct EmuTrap stub_XML_Parse = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParsePPC };\n\nstatic int stub_XML_ParseBufferPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_ParseBuffer(p->p, (int)regarray[0], (int)regarray[1]);\n}\nstruct EmuTrap stub_XML_ParseBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParseBufferPPC };\n\nstatic void * stub_XML_GetBufferPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetBuffer(p->p, (int)regarray[0]);\n}\nstruct EmuTrap stub_XML_GetBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBufferPPC };\n\nstatic void stub_XML_SetStartElementHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startelementhandler = (void *)regarray[9];\n\tSelf->XML_SetStartElementHandler(p->p, _68k_startelementhandler);\n}\nstruct EmuTrap stub_XML_SetStartElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartElementHandlerPPC };\n\nstatic void stub_XML_SetEndElementHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->endelementhandler = (void *)regarray[9];\n\tSelf->XML_SetEndElementHandler(p->p, _68k_endelementhandler);\n}\nstruct EmuTrap stub_XML_SetEndElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndElementHandlerPPC };\n\nstatic void stub_XML_SetElementHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startelementhandler = (void *)regarray[9];\n\tp->endelementhandler = (void *)regarray[10];\n\tSelf->XML_SetElementHandler(p->p, _68k_startelementhandler, _68k_endelementhandler);\n}\nstruct EmuTrap stub_XML_SetElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementHandlerPPC };\n\nstatic void stub_XML_SetCharacterDataHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->chardatahandler = (void *)regarray[9];\n\tSelf->XML_SetCharacterDataHandler(p->p, _68k_chardatahandler);\n}\nstruct EmuTrap stub_XML_SetCharacterDataHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCharacterDataHandlerPPC };\n\nstatic void stub_XML_SetProcessingInstructionHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->procinsthandler = (void *)regarray[9];\n\tSelf->XML_SetProcessingInstructionHandler(p->p, _68k_procinsthandler);\n}\nstruct EmuTrap stub_XML_SetProcessingInstructionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetProcessingInstructionHandlerPPC };\n\nstatic void stub_XML_SetCommentHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->commenthandler = (void *)regarray[9];\n\tSelf->XML_SetCommentHandler(p->p, _68k_commenthandler);\n}\nstruct EmuTrap stub_XML_SetCommentHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCommentHandlerPPC };\n\nstatic void stub_XML_SetStartCdataSectionHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startcdatahandler = (void *)regarray[9];\n\tSelf->XML_SetStartCdataSectionHandler(p->p, _68k_startcdatahandler);\n}\nstruct EmuTrap stub_XML_SetStartCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartCdataSectionHandlerPPC };\n\nstatic void stub_XML_SetEndCdataSectionHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->endcdatahandler = (void *)regarray[9];\n\tSelf->XML_SetEndCdataSectionHandler(p->p, _68k_endcdatahandler);\n}\nstruct EmuTrap stub_XML_SetEndCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndCdataSectionHandlerPPC };\n\nstatic void stub_XML_SetCdataSectionHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startcdatahandler = (void *)regarray[9];\n\tp->endcdatahandler = (void *)regarray[10];\n\tSelf->XML_SetCdataSectionHandler(p->p, _68k_startcdatahandler, _68k_endcdatahandler);\n}\nstruct EmuTrap stub_XML_SetCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCdataSectionHandlerPPC };\n\nstatic void stub_XML_SetDefaultHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->defaulthandler = (void *)regarray[9];\n\tSelf->XML_SetDefaultHandler(p->p, _68k_defaulthandler);\n}\nstruct EmuTrap stub_XML_SetDefaultHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerPPC };\n\nstatic void stub_XML_SetDefaultHandlerExpandPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->defaulthandlerexp = (void *)regarray[9];\n\tSelf->XML_SetDefaultHandlerExpand(p->p, _68k_defaulthandlerexp);\n}\nstruct EmuTrap stub_XML_SetDefaultHandlerExpand = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerExpandPPC };\n\nstatic void stub_XML_SetExternalEntityRefHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->extentrefhandler = (void *)regarray[9];\n\tSelf->XML_SetExternalEntityRefHandler(p->p, _68k_extentrefhandler);\n}\nstruct EmuTrap stub_XML_SetExternalEntityRefHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerPPC };\n\nstatic void stub_XML_SetExternalEntityRefHandlerArgPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->extenthandlerarg = (void *)regarray[9];\n}\nstruct EmuTrap stub_XML_SetExternalEntityRefHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerArgPPC };\n\nstatic void stub_XML_SetUnknownEncodingHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->unknownenchandler = (void *)regarray[9];\n\tp->enchandlerarg = (void *)regarray[10];\n\tSelf->XML_SetUnknownEncodingHandler(p->p, _68k_unknownenchandler, p);\n}\nstruct EmuTrap stub_XML_SetUnknownEncodingHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnknownEncodingHandlerPPC };\n\nstatic void stub_XML_SetStartNamespaceDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startnamespacehandler = (void *)regarray[9];\n\tSelf->XML_SetStartNamespaceDeclHandler(p->p, _68k_startnamespacehandler);\n}\nstruct EmuTrap stub_XML_SetStartNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartNamespaceDeclHandlerPPC };\n\nstatic void stub_XML_SetEndNamespaceDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->endnamespacehandler = (void *)regarray[9];\n\tSelf->XML_SetEndNamespaceDeclHandler(p->p, _68k_endnamespacehandler);\n}\nstruct EmuTrap stub_XML_SetEndNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndNamespaceDeclHandlerPPC };\n\nstatic void stub_XML_SetNamespaceDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startnamespacehandler = (void *)regarray[9];\n\tp->endnamespacehandler = (void *)regarray[10];\n\tSelf->XML_SetNamespaceDeclHandler(p->p, _68k_startnamespacehandler, _68k_endnamespacehandler);\n}\nstruct EmuTrap stub_XML_SetNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNamespaceDeclHandlerPPC };\n\nstatic void stub_XML_SetXmlDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->xmldeclhandler = (void *)regarray[9];\n\tSelf->XML_SetXmlDeclHandler(p->p, _68k_xmldeclhandler);\n}\nstruct EmuTrap stub_XML_SetXmlDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetXmlDeclHandlerPPC };\n\nstatic void stub_XML_SetStartDoctypeDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startdoctypehandler = (void *)regarray[9];\n\tSelf->XML_SetStartDoctypeDeclHandler(p->p, _68k_startdoctypehandler);\n}\nstruct EmuTrap stub_XML_SetStartDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartDoctypeDeclHandlerPPC };\n\nstatic void stub_XML_SetEndDoctypeDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->enddoctypehandler = (void *)regarray[9];\n\tSelf->XML_SetEndDoctypeDeclHandler(p->p, _68k_enddoctypehandler);\n}\nstruct EmuTrap stub_XML_SetEndDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndDoctypeDeclHandlerPPC };\n\nstatic void stub_XML_SetDoctypeDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->startdoctypehandler = (void *)regarray[9];\n\tp->enddoctypehandler = (void *)regarray[10];\n\tSelf->XML_SetDoctypeDeclHandler(p->p, _68k_startdoctypehandler, _68k_enddoctypehandler);\n}\nstruct EmuTrap stub_XML_SetDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDoctypeDeclHandlerPPC };\n\nstatic void stub_XML_SetElementDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->elementdeclhandler = (void *)regarray[9];\n\tSelf->XML_SetElementDeclHandler(p->p, _68k_elementdeclhandler);\n}\nstruct EmuTrap stub_XML_SetElementDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementDeclHandlerPPC };\n\nstatic void stub_XML_SetAttlistDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->attlistdeclhandler = (void *)regarray[9];\n\tSelf->XML_SetAttlistDeclHandler(p->p, _68k_attlistdeclhandler);\n}\nstruct EmuTrap stub_XML_SetAttlistDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetAttlistDeclHandlerPPC };\n\nstatic void stub_XML_SetEntityDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->entitydeclhandler = (void *)regarray[9];\n\tSelf->XML_SetEntityDeclHandler(p->p, _68k_entitydeclhandler);\n}\nstruct EmuTrap stub_XML_SetEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEntityDeclHandlerPPC };\n\nstatic void stub_XML_SetUnparsedEntityDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->unparseddeclhandler = (void *)regarray[9];\n\tSelf->XML_SetUnparsedEntityDeclHandler(p->p, _68k_unparseddeclhandler);\n}\nstruct EmuTrap stub_XML_SetUnparsedEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnparsedEntityDeclHandlerPPC };\n\nstatic void stub_XML_SetNotationDeclHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->notationdeclhandler = (void *)regarray[9];\n\tSelf->XML_SetNotationDeclHandler(p->p, _68k_notationdeclhandler);\n}\nstruct EmuTrap stub_XML_SetNotationDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotationDeclHandlerPPC };\n\nstatic void stub_XML_SetNotStandaloneHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->notstandalonehandler = (void *)regarray[9];\n\tSelf->XML_SetNotStandaloneHandler(p->p, _68k_notstandalonehandler);\n}\nstruct EmuTrap stub_XML_SetNotStandaloneHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotStandaloneHandlerPPC };\n\nstatic int stub_XML_GetErrorCodePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetErrorCode(p->p);\n}\nstruct EmuTrap stub_XML_GetErrorCode = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetErrorCodePPC };\n\nstatic const XML_LChar * stub_XML_ErrorStringPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\treturn Self->XML_ErrorString((int)regarray[0]);\n}\nstruct EmuTrap stub_XML_ErrorString = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ErrorStringPPC };\n\nstatic long stub_XML_GetCurrentByteIndexPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetCurrentByteIndex(p->p);\n}\nstruct EmuTrap stub_XML_GetCurrentByteIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteIndexPPC };\n\nstatic int stub_XML_GetCurrentLineNumberPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetCurrentLineNumber(p->p);\n}\nstruct EmuTrap stub_XML_GetCurrentLineNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentLineNumberPPC };\n\nstatic int stub_XML_GetCurrentColumnNumberPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetCurrentColumnNumber(p->p);\n}\nstruct EmuTrap stub_XML_GetCurrentColumnNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentColumnNumberPPC };\n\nstatic int stub_XML_GetCurrentByteCountPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetCurrentByteCount(p->p);\n}\nstruct EmuTrap stub_XML_GetCurrentByteCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteCountPPC };\n\nstatic const char * stub_XML_GetInputContextPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetInputContext(p->p, (int *)regarray[9], (int *)regarray[10]);\n}\nstruct EmuTrap stub_XML_GetInputContext = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetInputContextPPC };\n\nstatic void stub_XML_SetUserDataPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->handlerarg = (void *)regarray[9];\n}\nstruct EmuTrap stub_XML_SetUserData = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUserDataPPC };\n\nstatic void stub_XML_DefaultCurrentPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_DefaultCurrent(p->p);\n}\nstruct EmuTrap stub_XML_DefaultCurrent = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_DefaultCurrentPPC };\n\nstatic void stub_XML_UseParserAsHandlerArgPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->handlerarg = p;\n}\nstruct EmuTrap stub_XML_UseParserAsHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseParserAsHandlerArgPPC };\n\nstatic int stub_XML_SetBasePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_SetBase(p->p, (const XML_Char *)regarray[9]);\n}\nstruct EmuTrap stub_XML_SetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetBasePPC };\n\nstatic const XML_Char * stub_XML_GetBasePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetBase(p->p);\n}\nstruct EmuTrap stub_XML_GetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBasePPC };\n\nstatic int stub_XML_GetSpecifiedAttributeCountPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetSpecifiedAttributeCount(p->p);\n}\nstruct EmuTrap stub_XML_GetSpecifiedAttributeCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetSpecifiedAttributeCountPPC };\n\nstatic int stub_XML_GetIdAttributeIndexPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_GetIdAttributeIndex(p->p);\n}\nstruct EmuTrap stub_XML_GetIdAttributeIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetIdAttributeIndexPPC };\n\nstatic int stub_XML_SetEncodingPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_SetEncoding(p->p, (const XML_Char *)regarray[9]);\n}\nstruct EmuTrap stub_XML_SetEncoding = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEncodingPPC };\n\nstatic int stub_XML_SetParamEntityParsingPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_SetParamEntityParsing(p->p, (enum XML_ParamEntityParsing)regarray[9]);\n}\nstruct EmuTrap stub_XML_SetParamEntityParsing = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetParamEntityParsingPPC };\n\nstatic void stub_XML_SetReturnNSTripletPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_SetReturnNSTriplet(p->p, (int)regarray[0]);\n}\nstruct EmuTrap stub_XML_SetReturnNSTriplet = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetReturnNSTripletPPC };\n\nstatic const XML_LChar * stub_XML_ExpatVersionPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\treturn Self->XML_ExpatVersion();\n}\nstruct EmuTrap stub_XML_ExpatVersion = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionPPC };\n\nstatic XML_Expat_Version stub_XML_ExpatVersionInfoPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\treturn Self->XML_ExpatVersionInfo();\n}\nstruct EmuTrap stub_XML_ExpatVersionInfo = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionInfoPPC };\n\nstatic int stub_XML_ParserResetPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_ParserReset(p->p, (const XML_Char *)regarray[9]);\n}\nstruct EmuTrap stub_XML_ParserReset = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserResetPPC };\n\nstatic void stub_XML_SetSkippedEntityHandlerPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tp->skippedentityhandler = (void *)regarray[9];\n\tSelf->XML_SetSkippedEntityHandler(p->p, _68k_skippedentityhandler);\n}\nstruct EmuTrap stub_XML_SetSkippedEntityHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetSkippedEntityHandlerPPC };\n\nstatic int stub_XML_UseForeignDTDPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_UseForeignDTD(p->p, (XML_Bool)regarray[0]);\n}\nstruct EmuTrap stub_XML_UseForeignDTD = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseForeignDTDPPC };\n\nstatic const XML_Feature * stub_XML_GetFeatureListPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\treturn Self->XML_GetFeatureList();\n}\nstruct EmuTrap stub_XML_GetFeatureList = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetFeatureListPPC };\n\nstatic int stub_XML_StopParserPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_StopParser(p->p, (XML_Bool)regarray[0]);\n}\nstruct EmuTrap stub_XML_StopParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_StopParserPPC };\n\nstatic int stub_XML_ResumeParserPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_ResumeParser(p->p);\n}\nstruct EmuTrap stub_XML_ResumeParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ResumeParserPPC };\n\nstatic void stub_XML_GetParsingStatusPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_GetParsingStatus(p->p, (XML_ParsingStatus *)regarray[9]);\n}\nstruct EmuTrap stub_XML_GetParsingStatus = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetParsingStatusPPC };\n\nstatic void stub_XML_FreeContentModelPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_FreeContentModel(p->p, (XML_Content *)regarray[9]);\n}\nstruct EmuTrap stub_XML_FreeContentModel = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_FreeContentModelPPC };\n\nstatic void *stub_XML_MemMallocPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_MemMalloc(p->p, (size_t)regarray[0]);\n}\nstruct EmuTrap stub_XML_MemMalloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemMallocPPC };\n\nstatic void *stub_XML_MemReallocPPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\treturn Self->XML_MemRealloc(p->p, (void *)regarray[9], (size_t)regarray[0]);\n}\nstruct EmuTrap stub_XML_MemRealloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemReallocPPC };\n\nstatic void stub_XML_MemFreePPC(ULONG *regarray)\n{\n\tstruct Library *Base = (struct Library *) regarray[REG68K_A6/4];\n\tstruct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize);\n\tstruct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace;\n\n\tM68kXML_Parser p = (M68kXML_Parser)regarray[8];\n\tSelf->XML_MemFree(p->p, (void *)regarray[9]);\n}\nstruct EmuTrap stub_XML_MemFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemFreePPC };\n\nULONG VecTable68K[] = {\n\t(ULONG)&stub_Open,\n\t(ULONG)&stub_Close,\n\t(ULONG)&stub_Expunge,\n\t(ULONG)&stub_Reserved,\n\t(ULONG)&stub_XML_ParserCreate,\n\t(ULONG)&stub_XML_ParserCreateNS,\n\t(ULONG)&stub_XML_ParserCreate_MM,\n\t(ULONG)&stub_XML_ExternalEntityParserCreate,\n\t(ULONG)&stub_XML_ParserFree,\n\t(ULONG)&stub_XML_Parse,\n\t(ULONG)&stub_XML_ParseBuffer,\n\t(ULONG)&stub_XML_GetBuffer,\n\t(ULONG)&stub_XML_SetStartElementHandler,\n\t(ULONG)&stub_XML_SetEndElementHandler,\n\t(ULONG)&stub_XML_SetElementHandler,\n\t(ULONG)&stub_XML_SetCharacterDataHandler,\n\t(ULONG)&stub_XML_SetProcessingInstructionHandler,\n\t(ULONG)&stub_XML_SetCommentHandler,\n\t(ULONG)&stub_XML_SetStartCdataSectionHandler,\n\t(ULONG)&stub_XML_SetEndCdataSectionHandler,\n\t(ULONG)&stub_XML_SetCdataSectionHandler,\n\t(ULONG)&stub_XML_SetDefaultHandler,\n\t(ULONG)&stub_XML_SetDefaultHandlerExpand,\n\t(ULONG)&stub_XML_SetExternalEntityRefHandler,\n\t(ULONG)&stub_XML_SetExternalEntityRefHandlerArg,\n\t(ULONG)&stub_XML_SetUnknownEncodingHandler,\n\t(ULONG)&stub_XML_SetStartNamespaceDeclHandler,\n\t(ULONG)&stub_XML_SetEndNamespaceDeclHandler,\n\t(ULONG)&stub_XML_SetNamespaceDeclHandler,\n\t(ULONG)&stub_XML_SetXmlDeclHandler,\n\t(ULONG)&stub_XML_SetStartDoctypeDeclHandler,\n\t(ULONG)&stub_XML_SetEndDoctypeDeclHandler,\n\t(ULONG)&stub_XML_SetDoctypeDeclHandler,\n\t(ULONG)&stub_XML_SetElementDeclHandler,\n\t(ULONG)&stub_XML_SetAttlistDeclHandler,\n\t(ULONG)&stub_XML_SetEntityDeclHandler,\n\t(ULONG)&stub_XML_SetUnparsedEntityDeclHandler,\n\t(ULONG)&stub_XML_SetNotationDeclHandler,\n\t(ULONG)&stub_XML_SetNotStandaloneHandler,\n\t(ULONG)&stub_XML_GetErrorCode,\n\t(ULONG)&stub_XML_ErrorString,\n\t(ULONG)&stub_XML_GetCurrentByteIndex,\n\t(ULONG)&stub_XML_GetCurrentLineNumber,\n\t(ULONG)&stub_XML_GetCurrentColumnNumber,\n\t(ULONG)&stub_XML_GetCurrentByteCount,\n\t(ULONG)&stub_XML_GetInputContext,\n\t(ULONG)&stub_XML_SetUserData,\n\t(ULONG)&stub_XML_DefaultCurrent,\n\t(ULONG)&stub_XML_UseParserAsHandlerArg,\n\t(ULONG)&stub_XML_SetBase,\n\t(ULONG)&stub_XML_GetBase,\n\t(ULONG)&stub_XML_GetSpecifiedAttributeCount,\n\t(ULONG)&stub_XML_GetIdAttributeIndex,\n\t(ULONG)&stub_XML_SetEncoding,\n\t(ULONG)&stub_XML_SetParamEntityParsing,\n\t(ULONG)&stub_XML_SetReturnNSTriplet,\n\t(ULONG)&stub_XML_ExpatVersion,\n\t(ULONG)&stub_XML_ExpatVersionInfo,\n\t(ULONG)&stub_XML_ParserReset,\n\t(ULONG)&stub_XML_SetSkippedEntityHandler,\n\t(ULONG)&stub_XML_UseForeignDTD,\n\t(ULONG)&stub_XML_GetFeatureList,\n\t(ULONG)&stub_XML_StopParser,\n\t(ULONG)&stub_XML_ResumeParser,\n\t(ULONG)&stub_XML_GetParsingStatus,\n\t(ULONG)&stub_XML_FreeContentModel,\n\t(ULONG)&stub_XML_MemMalloc,\n\t(ULONG)&stub_XML_MemRealloc,\n\t(ULONG)&stub_XML_MemFree,\n\t(ULONG)-1\n};\n"},{"id":13488,"name":"launch.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifdef __USE_INLINE__\n#undef __USE_INLINE__\n#endif\n\n#include <stdlib.h>\n#include <proto/exec.h>\n\nstruct Library* ExpatBase = 0;\nstruct ExpatIFace* IExpat = 0;\n\n\nvoid setup() __attribute__((constructor));\nvoid cleanup() __attribute__((destructor));\n\n\nvoid setup()\n{\n\tExpatBase = IExec->OpenLibrary(\"expat.library\", 53);\n\tIExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, \"main\", 1, NULL);\n\n\tif ( IExpat == 0 )  {\n\t\tIExec->DebugPrintF(\"Can't open expat.library\\n\");\n\t}\n}\n\n\nvoid cleanup()\n{\n\tIExec->DropInterface((struct Interface*)IExpat);\n\tIExpat = 0;\n\n\tIExec->CloseLibrary(ExpatBase);\n\tExpatBase = 0;\n}\n"},{"id":13489,"name":"expat_vectors.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#include <exec/types.h>\n#include <exec/exec.h>\n#include <exec/interfaces.h>\n#include <interfaces/expat.h>\n\nextern uint32                _Expat_Obtain(struct ExpatIFace *);\nextern uint32                _Expat_Release(struct ExpatIFace *);\nextern XML_Parser            _Expat_XML_ParserCreate(struct ExpatIFace *, const XML_Char * encodingName);\nextern XML_Parser            _Expat_XML_ParserCreateNS(struct ExpatIFace *, const XML_Char * encodingName, XML_Char nsSep);\nextern XML_Parser            _Expat_XML_ParserCreate_MM(struct ExpatIFace *, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator);\nextern XML_Parser            _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace *, XML_Parser parser, const XML_Char * context, const XML_Char * encoding);\nextern void                  _Expat_XML_ParserFree(struct ExpatIFace *, XML_Parser parser);\nextern enum XML_Status       _Expat_XML_Parse(struct ExpatIFace *, XML_Parser parser, const char * s, int len, int isFinal);\nextern enum XML_Status       _Expat_XML_ParseBuffer(struct ExpatIFace *, XML_Parser parser, int len, int isFinal);\nextern void *                _Expat_XML_GetBuffer(struct ExpatIFace *, XML_Parser parser, int len);\nextern void                  _Expat_XML_SetStartElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start);\nextern void                  _Expat_XML_SetEndElementHandler(struct ExpatIFace *, XML_Parser parser, XML_EndElementHandler end);\nextern void                  _Expat_XML_SetElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end);\nextern void                  _Expat_XML_SetCharacterDataHandler(struct ExpatIFace *, XML_Parser parser, XML_CharacterDataHandler handler);\nextern void                  _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace *, XML_Parser parser, XML_ProcessingInstructionHandler handler);\nextern void                  _Expat_XML_SetCommentHandler(struct ExpatIFace *, XML_Parser parser, XML_CommentHandler handler);\nextern void                  _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start);\nextern void                  _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_EndCdataSectionHandler end);\nextern void                  _Expat_XML_SetCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end);\nextern void                  _Expat_XML_SetDefaultHandler(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler);\nextern void                  _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler);\nextern void                  _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace *, XML_Parser parser, XML_ExternalEntityRefHandler handler);\nextern void                  _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace *, XML_Parser parser, void * arg);\nextern void                  _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace *, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data);\nextern void                  _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start);\nextern void                  _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndNamespaceDeclHandler end);\nextern void                  _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end);\nextern void                  _Expat_XML_SetXmlDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_XmlDeclHandler handler);\nextern void                  _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start);\nextern void                  _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndDoctypeDeclHandler end);\nextern void                  _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end);\nextern void                  _Expat_XML_SetElementDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_ElementDeclHandler eldecl);\nextern void                  _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_AttlistDeclHandler attdecl);\nextern void                  _Expat_XML_SetEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EntityDeclHandler handler);\nextern void                  _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_UnparsedEntityDeclHandler handler);\nextern void                  _Expat_XML_SetNotationDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_NotationDeclHandler handler);\nextern void                  _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace *, XML_Parser parser, XML_NotStandaloneHandler handler);\nextern enum XML_Error        _Expat_XML_GetErrorCode(struct ExpatIFace *, XML_Parser parser);\nextern const XML_LChar *     _Expat_XML_ErrorString(struct ExpatIFace *, enum XML_Error code);\nextern long                  _Expat_XML_GetCurrentByteIndex(struct ExpatIFace *, XML_Parser parser);\nextern int                   _Expat_XML_GetCurrentLineNumber(struct ExpatIFace *, XML_Parser parser);\nextern int                   _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace *, XML_Parser parser);\nextern int                   _Expat_XML_GetCurrentByteCount(struct ExpatIFace *, XML_Parser parser);\nextern const char *          _Expat_XML_GetInputContext(struct ExpatIFace *, XML_Parser parser, int * offset, int * size);\nextern void                  _Expat_XML_SetUserData(struct ExpatIFace *, XML_Parser parser, void * userData);\nextern void                  _Expat_XML_DefaultCurrent(struct ExpatIFace *, XML_Parser parser);\nextern void                  _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace *, XML_Parser parser);\nextern enum XML_Status       _Expat_XML_SetBase(struct ExpatIFace *, XML_Parser parser, const XML_Char * base);\nextern const XML_Char *      _Expat_XML_GetBase(struct ExpatIFace *, XML_Parser parser);\nextern int                   _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace *, XML_Parser parser);\nextern int                   _Expat_XML_GetIdAttributeIndex(struct ExpatIFace *, XML_Parser parser);\nextern enum XML_Status       _Expat_XML_SetEncoding(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding);\nextern int                   _Expat_XML_SetParamEntityParsing(struct ExpatIFace *, XML_Parser parser, enum XML_ParamEntityParsing parsing);\nextern void                  _Expat_XML_SetReturnNSTriplet(struct ExpatIFace *, XML_Parser parser, int do_nst);\nextern const XML_LChar *     _Expat_XML_ExpatVersion(struct ExpatIFace *);\nextern XML_Expat_Version     _Expat_XML_ExpatVersionInfo(struct ExpatIFace *);\nextern XML_Bool              _Expat_XML_ParserReset(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding);\nextern void                  _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace *, XML_Parser parser, XML_SkippedEntityHandler handler);\nextern enum XML_Error        _Expat_XML_UseForeignDTD(struct ExpatIFace *, XML_Parser parser, XML_Bool useDTD);\nextern const XML_Feature *   _Expat_XML_GetFeatureList(struct ExpatIFace *);\nextern enum XML_Status       _Expat_XML_StopParser(struct ExpatIFace *, XML_Parser parser, XML_Bool resumable);\nextern enum XML_Status       _Expat_XML_ResumeParser(struct ExpatIFace *, XML_Parser parser);\nextern void                  _Expat_XML_GetParsingStatus(struct ExpatIFace *, XML_Parser parser, XML_ParsingStatus * status);\nextern void                  _Expat_XML_FreeContentModel(struct ExpatIFace *, XML_Parser parser, XML_Content * model);\nextern void *                _Expat_XML_MemMalloc(struct ExpatIFace *, XML_Parser parser, size_t size);\nextern void *                _Expat_XML_MemRealloc(struct ExpatIFace *, XML_Parser parser, void * ptr, size_t size);\nextern void                  _Expat_XML_MemFree(struct ExpatIFace *, XML_Parser parser, void * ptr);\n\n\nCONST APTR main_vectors[] =\n{\n    _Expat_Obtain,\n    _Expat_Release,\n    NULL,\n    NULL,\n    _Expat_XML_ParserCreate,\n    _Expat_XML_ParserCreateNS,\n    _Expat_XML_ParserCreate_MM,\n    _Expat_XML_ExternalEntityParserCreate,\n    _Expat_XML_ParserFree,\n    _Expat_XML_Parse,\n    _Expat_XML_ParseBuffer,\n    _Expat_XML_GetBuffer,\n    _Expat_XML_SetStartElementHandler,\n    _Expat_XML_SetEndElementHandler,\n    _Expat_XML_SetElementHandler,\n    _Expat_XML_SetCharacterDataHandler,\n    _Expat_XML_SetProcessingInstructionHandler,\n    _Expat_XML_SetCommentHandler,\n    _Expat_XML_SetStartCdataSectionHandler,\n    _Expat_XML_SetEndCdataSectionHandler,\n    _Expat_XML_SetCdataSectionHandler,\n    _Expat_XML_SetDefaultHandler,\n    _Expat_XML_SetDefaultHandlerExpand,\n    _Expat_XML_SetExternalEntityRefHandler,\n    _Expat_XML_SetExternalEntityRefHandlerArg,\n    _Expat_XML_SetUnknownEncodingHandler,\n    _Expat_XML_SetStartNamespaceDeclHandler,\n    _Expat_XML_SetEndNamespaceDeclHandler,\n    _Expat_XML_SetNamespaceDeclHandler,\n    _Expat_XML_SetXmlDeclHandler,\n    _Expat_XML_SetStartDoctypeDeclHandler,\n    _Expat_XML_SetEndDoctypeDeclHandler,\n    _Expat_XML_SetDoctypeDeclHandler,\n    _Expat_XML_SetElementDeclHandler,\n    _Expat_XML_SetAttlistDeclHandler,\n    _Expat_XML_SetEntityDeclHandler,\n    _Expat_XML_SetUnparsedEntityDeclHandler,\n    _Expat_XML_SetNotationDeclHandler,\n    _Expat_XML_SetNotStandaloneHandler,\n    _Expat_XML_GetErrorCode,\n    _Expat_XML_ErrorString,\n    _Expat_XML_GetCurrentByteIndex,\n    _Expat_XML_GetCurrentLineNumber,\n    _Expat_XML_GetCurrentColumnNumber,\n    _Expat_XML_GetCurrentByteCount,\n    _Expat_XML_GetInputContext,\n    _Expat_XML_SetUserData,\n    _Expat_XML_DefaultCurrent,\n    _Expat_XML_UseParserAsHandlerArg,\n    _Expat_XML_SetBase,\n    _Expat_XML_GetBase,\n    _Expat_XML_GetSpecifiedAttributeCount,\n    _Expat_XML_GetIdAttributeIndex,\n    _Expat_XML_SetEncoding,\n    _Expat_XML_SetParamEntityParsing,\n    _Expat_XML_SetReturnNSTriplet,\n    _Expat_XML_ExpatVersion,\n    _Expat_XML_ExpatVersionInfo,\n    _Expat_XML_ParserReset,\n    _Expat_XML_SetSkippedEntityHandler,\n    _Expat_XML_UseForeignDTD,\n    _Expat_XML_GetFeatureList,\n    _Expat_XML_StopParser,\n    _Expat_XML_ResumeParser,\n    _Expat_XML_GetParsingStatus,\n    _Expat_XML_FreeContentModel,\n    _Expat_XML_MemMalloc,\n    _Expat_XML_MemRealloc,\n    _Expat_XML_MemFree,\n    (APTR)-1\n};\n\nuint32 _Expat_Obtain(struct ExpatIFace *Self)\n{\n\treturn ++Self->Data.RefCount;\n}\n\nuint32 _Expat_Release(struct ExpatIFace *Self)\n{\n\treturn --Self->Data.RefCount;\n}\n\nXML_Parser _Expat_XML_ParserCreate(struct ExpatIFace * Self, const XML_Char *encoding)\n{\n\treturn XML_ParserCreate(encoding);\n}\n\nXML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace * Self, const XML_Char *encoding, XML_Char nsSep)\n{\n\treturn XML_ParserCreateNS(encoding, nsSep);\n}\n\nXML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace * Self, const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator)\n{\n\treturn XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator);\n}\n\nXML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *context, const XML_Char *encoding)\n{\n\treturn XML_ExternalEntityParserCreate(parser, context, encoding);\n}\n\nvoid _Expat_XML_ParserFree(struct ExpatIFace *Self, XML_Parser parser)\n{\n\tXML_ParserFree(parser);\n}\n\nenum XML_Status _Expat_XML_Parse(struct ExpatIFace * Self, XML_Parser parser, const char * s, int len, int isFinal)\n{\n\treturn XML_Parse(parser, s, len, isFinal);\n}\n\nenum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace * Self, XML_Parser parser, int len, int isFinal)\n{\n\treturn XML_ParseBuffer(parser, len, isFinal);\n}\n\nvoid * _Expat_XML_GetBuffer(struct ExpatIFace * Self, XML_Parser parser, int len)\n{\n\treturn XML_GetBuffer(parser, len);\n}\n\nvoid _Expat_XML_SetStartElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start)\n{\n\tXML_SetStartElementHandler(parser, start);\n}\n\nvoid _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end)\n{\n\tXML_SetEndElementHandler(parser, end);\n}\n\nvoid _Expat_XML_SetElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)\n{\n\tXML_SetElementHandler(parser, start, end);\n}\n\nvoid _Expat_XML_SetCharacterDataHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CharacterDataHandler handler)\n{\n\tXML_SetCharacterDataHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ProcessingInstructionHandler handler)\n{\n\tXML_SetProcessingInstructionHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetCommentHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CommentHandler handler)\n{\n\tXML_SetCommentHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start)\n{\n\tXML_SetStartCdataSectionHandler(parser, start);\n}\n\nvoid _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndCdataSectionHandler end)\n{\n\tXML_SetEndCdataSectionHandler(parser, end);\n}\n\nvoid _Expat_XML_SetCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)\n{\n\tXML_SetCdataSectionHandler(parser, start, end);\n}\n\nvoid _Expat_XML_SetDefaultHandler(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler)\n{\n\tXML_SetDefaultHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler)\n{\n\tXML_SetDefaultHandlerExpand(parser, handler);\n}\n\nvoid _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ExternalEntityRefHandler handler)\n{\n\tXML_SetExternalEntityRefHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace * Self, XML_Parser parser, void * arg)\n{\n\tXML_SetExternalEntityRefHandlerArg(parser, arg);\n}\n\nvoid _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data)\n{\n\tXML_SetUnknownEncodingHandler(parser, handler, data);\n}\n\nvoid _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start)\n{\n\tXML_SetStartNamespaceDeclHandler(parser, start);\n}\n\nvoid _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndNamespaceDeclHandler end)\n{\n\tXML_SetEndNamespaceDeclHandler(parser, end);\n}\n\nvoid _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)\n{\n\tXML_SetNamespaceDeclHandler(parser, start, end);\n}\n\nvoid _Expat_XML_SetXmlDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_XmlDeclHandler handler)\n{\n\tXML_SetXmlDeclHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start)\n{\n\tXML_SetStartDoctypeDeclHandler(parser, start);\n}\n\nvoid _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndDoctypeDeclHandler end)\n{\n\tXML_SetEndDoctypeDeclHandler(parser, end);\n}\n\nvoid _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end)\n{\n\tXML_SetDoctypeDeclHandler(parser, start, end);\n}\n\nvoid _Expat_XML_SetElementDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ElementDeclHandler eldecl)\n{\n\tXML_SetElementDeclHandler(parser, eldecl);\n}\n\nvoid _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_AttlistDeclHandler attdecl)\n{\n\tXML_SetAttlistDeclHandler(parser, attdecl);\n}\n\nvoid _Expat_XML_SetEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EntityDeclHandler handler)\n{\n\tXML_SetEntityDeclHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler)\n{\n\tXML_SetUnparsedEntityDeclHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetNotationDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotationDeclHandler handler)\n{\n\tXML_SetNotationDeclHandler(parser, handler);\n}\n\nvoid _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotStandaloneHandler handler)\n{\n\tXML_SetNotStandaloneHandler(parser, handler);\n}\n\nenum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetErrorCode(parser);\n}\n\nconst XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace * Self, enum XML_Error code)\n{\n\treturn XML_ErrorString(code);\n}\n\nlong _Expat_XML_GetCurrentByteIndex(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetCurrentByteIndex(parser);\n}\n\nint _Expat_XML_GetCurrentLineNumber(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetCurrentLineNumber(parser);\n}\n\nint _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetCurrentColumnNumber(parser);\n}\n\nint _Expat_XML_GetCurrentByteCount(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetCurrentByteCount(parser);\n}\n\nconst char * _Expat_XML_GetInputContext(struct ExpatIFace * Self, XML_Parser parser, int * offset, int * size)\n{\n\treturn XML_GetInputContext(parser, offset, size);\n}\n\nvoid _Expat_XML_SetUserData(struct ExpatIFace * Self, XML_Parser parser, void * userData)\n{\n\tXML_SetUserData(parser, userData);\n}\n\nvoid _Expat_XML_DefaultCurrent(struct ExpatIFace * Self, XML_Parser parser)\n{\n\tXML_DefaultCurrent(parser);\n}\n\nvoid _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace * Self, XML_Parser parser)\n{\n\tXML_UseParserAsHandlerArg(parser);\n}\n\nenum XML_Status _Expat_XML_SetBase(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *p)\n{\n\treturn XML_SetBase(parser, p);\n}\n\nconst XML_Char * _Expat_XML_GetBase(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetBase(parser);\n}\n\nint _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetSpecifiedAttributeCount(parser);\n}\n\nint _Expat_XML_GetIdAttributeIndex(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_GetIdAttributeIndex(parser);\n}\n\nenum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding)\n{\n\treturn XML_SetEncoding(parser, encoding);\n}\n\nint _Expat_XML_SetParamEntityParsing(struct ExpatIFace * Self, XML_Parser parser, enum XML_ParamEntityParsing parsing)\n{\n\treturn XML_SetParamEntityParsing(parser, parsing);\n}\n\nvoid _Expat_XML_SetReturnNSTriplet(struct ExpatIFace * Self, XML_Parser parser, int do_nst)\n{\n\tXML_SetReturnNSTriplet(parser, do_nst);\n}\n\nconst XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace * Self)\n{\n\treturn XML_ExpatVersion();\n}\n\nXML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace * Self)\n{\n\treturn XML_ExpatVersionInfo();\n}\n\nXML_Bool _Expat_XML_ParserReset(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding)\n{\n\treturn XML_ParserReset(parser, encoding);\n}\n\nvoid _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace * Self, XML_Parser parser, XML_SkippedEntityHandler handler)\n{\n\tXML_SetSkippedEntityHandler(parser, handler);\n}\n\nenum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace * Self, XML_Parser parser, XML_Bool useDTD)\n{\n\treturn XML_UseForeignDTD(parser, useDTD);\n}\n\nconst XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace * Self)\n{\n\treturn XML_GetFeatureList();\n}\n\nenum XML_Status _Expat_XML_StopParser(struct ExpatIFace * Self, XML_Parser parser, XML_Bool resumable)\n{\n\treturn XML_StopParser(parser, resumable);\n}\n\nenum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace * Self, XML_Parser parser)\n{\n\treturn XML_ResumeParser(parser);\n}\n\nvoid _Expat_XML_GetParsingStatus(struct ExpatIFace * Self, XML_Parser parser, XML_ParsingStatus * status)\n{\n\tXML_GetParsingStatus(parser, status);\n}\n\nvoid _Expat_XML_FreeContentModel(struct ExpatIFace * Self, XML_Parser parser, XML_Content * model)\n{\n\tXML_FreeContentModel(parser, model);\n}\n\nvoid * _Expat_XML_MemMalloc(struct ExpatIFace * Self, XML_Parser parser, size_t size)\n{\n\treturn XML_MemMalloc(parser, size);\n}\n\nvoid * _Expat_XML_MemRealloc(struct ExpatIFace * Self, XML_Parser parser, void * ptr, size_t size)\n{\n\tXML_MemRealloc(parser, ptr, size);\n}\n\nvoid _Expat_XML_MemFree(struct ExpatIFace * Self, XML_Parser parser, void * ptr)\n{\n\tXML_MemFree(parser, ptr);\n}\n"},{"id":13490,"name":"expat_68k_handler_stubs.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2009 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#ifdef __USE_INLINE__\n#undef __USE_INLINE__\n#endif\n\n#include \"expat_68k.h\"\n#include <exec/emulation.h>\n#include <proto/exec.h>\n#include <stdarg.h>\n\nstatic uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) {\n\tuint32 res = 0;\n\n\tva_list vargs;\n\tva_startlinear(vargs, num_args);\n\tuint32 *args = va_getlinearva(vargs, uint32 *);\n\n\tuint8 *stack = IExec->AllocVec(4096, MEMF_SHARED);\n\tif (stack) {\n\t\tuint32 *sp = (uint32 *)(stack + 4096);\n\t\targs += num_args;\n\t\twhile (num_args--) {\n\t\t\t*--sp = *--args;\n\t\t}\n\n\t\tres = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END);\n\t\tIExec->FreeVec(stack);\n\t}\n\n\tva_end(vargs);\n\n\treturn res;\n}\n\nvoid _68k_startelementhandler(void *userdata, const char *name, const char **attrs) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs);\n}\n\nvoid _68k_endelementhandler(void *userdata, const char *name) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name);\n}\n\nvoid _68k_chardatahandler(void *userdata, const char *s, int len) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len);\n}\n\nvoid _68k_procinsthandler(void *userdata, const char *target, const char *data) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data);\n}\n\nvoid _68k_commenthandler(void *userdata, const char *data) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data);\n}\n\nvoid _68k_startcdatahandler(void *userdata) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg);\n}\n\nvoid _68k_endcdatahandler(void *userdata) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg);\n}\n\nvoid _68k_defaulthandler(void *userdata, const char *s, int len) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len);\n}\n\nvoid _68k_defaulthandlerexp(void *userdata, const char *s, int len) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len);\n}\n\nint _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base,\n\tconst char *sysid, const char *pubid)\n{\n\tM68kXML_Parser p = XML_GetUserData(parser);\n\tvoid *arg = p->extenthandlerarg;\n\treturn (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid);\n}\n\nint _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) {\n\tM68kXML_Parser p = enchandlerdata;\n\treturn (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info);\n}\n\nvoid _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri);\n}\n\nvoid _68k_endnamespacehandler(void *userdata, const char *prefix) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix);\n}\n\nvoid _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone);\n}\n\nvoid _68k_startdoctypehandler(void *userdata, const char *doctypename,\n\tconst char *sysid, const char *pubid, int has_internal_subset)\n{\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset);\n}\n\nvoid _68k_enddoctypehandler(void *userdata) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg);\n}\n\nvoid _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model);\n}\n\nvoid _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname,\n\tconst char *att_type, const char *dflt, int isrequired)\n{\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired);\n}\n\nvoid _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity,\n\tconst char *value, int value_length, const char *base, const char *sysid, const char *pubid,\n\tconst char *notationname)\n{\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity,\n\t\tvalue, value_length, base, sysid, pubid, notationname);\n}\n\nvoid _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base,\n\tconst char *sysid, const char *pubid, const char *notationname)\n{\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname);\n}\n\nvoid _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base,\n\tconst char *sysid, const char *pubid)\n{\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid);\n}\n\nint _68k_notstandalonehandler(void *userdata) {\n\tM68kXML_Parser p = userdata;\n\treturn (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg);\n}\n\nvoid _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) {\n\tM68kXML_Parser p = userdata;\n\tcall_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity);\n}\n"},{"id":13491,"name":"stdlib.c","nodeType":"TextFile","path":"cextern/expat/amiga","text":"/*\n** Copyright (c) 2001-2007 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n#include <stdlib.h>\n#include <exec/memory.h>\n#include <proto/exec.h>\n#include <proto/utility.h>\n\nvoid * malloc (size_t len)\n{\n\tuint32 size = sizeof(uint32) + len;\n\n\tuint32 *mem = AllocMem(size, MEMF_SHARED);\n\tif ( mem != 0 )  {\n\t\t*mem = size;\n\t\t++mem;\n\t}\n\n\treturn mem;\n}\n\n\nvoid * realloc (void * mem, size_t len2)\n{\n\tif ( mem == 0 )  {\n\t\treturn malloc(len2);\n\t}\n\n\tif ( len2 == 0 )  {\n\t\tfree(mem);\n\t\treturn 0;\n\t}\n\n\tvoid * new_mem = malloc(len2);\n\tif ( new_mem == 0 )  {\n\t\treturn 0;\n\t}\n\n\tuint32 mem_size = *(((uint32*)mem) - 1);\n\tCopyMem(mem, new_mem, mem_size);\n\tfree(mem);\n\n\treturn new_mem;\n}\n\n\nvoid free (void * mem)\n{\n\tif ( mem != 0 )  {\n\t\tuint32 * size_ptr = ((uint32*)mem) - 1;\n\t\tFreeMem(size_ptr, *size_ptr);\n\t}\n}\n\n\nint memcmp (const void * a, const void * b, size_t len)\n{\n\tsize_t i;\n\tint diff;\n\n\tfor ( i = 0; i < len; ++i )  {\n\t\tdiff = *((uint8 *)a++) - *((uint8 *)b++);\n\t\tif ( diff )  {\n\t\t\treturn diff;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\n\nvoid * memcpy (void * t, const void * a, size_t len)\n{\n\tCopyMem((APTR)a, t, len);\n\treturn t;\n}\n\n\nvoid * memmove (void * t1, const void * t2, size_t len)\n{\n\tMoveMem((APTR)t2, t1, len);\n\treturn t1;\n}\n\n\nvoid * memset (void * t, int c, size_t len)\n{\n\treturn SetMem(t, c, len);\n}\n"},{"id":13492,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat/amiga","text":"SUMMARY\n=======\nThis is a port of expat for AmigaOS 4.x which includes the\nSDK, some XML tools and the libraries.\n\nFour library flavours are supported:\n1. static clib2 (libexpat.a)\n2. static newlib (libexpat.a)\n3. AmigaOS library (expat.library)\n4. AmigaOS shared object library (libexpat.so)\n\nThe AmigaOS library version is based on the work of Fredrik Wikstrom.\n\n\nBUILDING\n========\nTo build all the library flavours, all the tools, examples and run the\ntest suite, simply type 'make all' in the amiga subdirectory.\n\n\nINSTALLATION\n============\nTo install expat into the standard AmigaOS SDK type 'make install'\nin the amiga subdirectory.\n\n\nCONFIGURATION\n=============\nYou may want to edit the lib/amigaconfig.h file to remove\nDTD and/or XML namespace support if they are not required by your\nspecific application for a smaller and faster implementation.\n\n\nSOURCE CODE\n===========\nThe source code is actively maintained and merged with the official\nExpat repository available at http://expat.sourceforge.net/\n\n\nHISTORY\n=======\n53.1 - bumped version to match AmigaOS streaming\n     - modified to remove all global variables (except INewLib)\n     - removed replacements for malloc(), etc. which are now\n       handled by the respective C library\n     - compiled with the latest binutils which bumps the\n       AMIGAOS_DYNVERSION to 2 for the libexpat.so target\n     - now strips the expat.library binary\n\n5.2  - fixed XML_Parse 68k stub which enables xmlviewer to work\n       without crashing\n     - added some new functions to the 68k jump table available\n       in the latest expat.library for AmigaOS 3.x\n     - patches provided by Fredrik Wikstrom\n\n5.1  - fixed package archive which was missing libexpat.so\n     - fixed library protection bits\n     - fixed up copyright notices\n\n5.0  - integrated 68k patches from Fredrik Wikstrom which means\n       expat.library is now callable from 68k code\n     - bumped version for the addition of the 68k interface so\n       executables can explicitly ask for version 5 and know\n       it includes the 68k interface\n     - refactored Makefile to avoid recursive make calls and\n       build all the library flavours\n     - added static newlib version\n     - added shared objects version\n     - added package target to Makefile\n     - compiled with SDK 53.13 (GCC 4.2.4) at -O3\n\n4.2  - updated to correspond to Expat 2.0.1 release\n     - bumped copyright banners and versions\n     - simplified amigaconfig.h\n     - updated include/libraries/expat.h file\n     - modified launch.c to use contructor/deconstructor\n     - removed need for amiga_main() from expat utilities\n\n4.1  - fixed memory freeing bug in shared library version\n     - now allocates shared memory\n\n4.0  - updated for corresponding Expat 2.0 release\n     - some minor CVS related changes\n\n3.1  - removed obsolete sfd file\n     - added library description xml file\n     - refactored Makefile\n     - removed extraneous VARARGS68K keywords\n     - reworked default memory handling functions in shared lib\n     - updated amigaconfig.h\n\n3.0  - initial release\n     - based on expat 1.95.8\n\n\nTO DO\n=====\n- wide character support (UTF-16)\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":140,"id":13493,"name":"_grid_type","nodeType":"Attribute","startLoc":140,"text":"self._grid_type"},{"id":13494,"name":"cextern/expat/amiga/include/inline4","nodeType":"Package"},{"id":13495,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/amiga/include/inline4","text":"#ifndef INLINE4_EXPAT_H\n#define INLINE4_EXPAT_H\n\n/*\n** This file was auto generated by idltool 51.6.\n**\n** It provides compatibility to OS3 style library\n** calls by substituting functions.\n**\n** Do not edit manually.\n*/ \n\n#ifndef EXEC_TYPES_H\n#include <exec/types.h>\n#endif\n#ifndef EXEC_EXEC_H\n#include <exec/exec.h>\n#endif\n#ifndef EXEC_INTERFACES_H\n#include <exec/interfaces.h>\n#endif\n\n#ifndef LIBRARIES_EXPAT_H\n#include <libraries/expat.h>\n#endif\n\n/* Inline macros for Interface \"main\" */\n#define XML_ParserCreate(encodingName) IExpat->XML_ParserCreate(encodingName) \n#define XML_ParserCreateNS(encodingName, nsSep) IExpat->XML_ParserCreateNS(encodingName, nsSep) \n#define XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) IExpat->XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) \n#define XML_ExternalEntityParserCreate(parser, context, encoding) IExpat->XML_ExternalEntityParserCreate(parser, context, encoding) \n#define XML_ParserFree(parser) IExpat->XML_ParserFree(parser) \n#define XML_Parse(parser, s, len, isFinal) IExpat->XML_Parse(parser, s, len, isFinal) \n#define XML_ParseBuffer(parser, len, isFinal) IExpat->XML_ParseBuffer(parser, len, isFinal) \n#define XML_GetBuffer(parser, len) IExpat->XML_GetBuffer(parser, len) \n#define XML_SetStartElementHandler(parser, start) IExpat->XML_SetStartElementHandler(parser, start) \n#define XML_SetEndElementHandler(parser, end) IExpat->XML_SetEndElementHandler(parser, end) \n#define XML_SetElementHandler(parser, start, end) IExpat->XML_SetElementHandler(parser, start, end) \n#define XML_SetCharacterDataHandler(parser, handler) IExpat->XML_SetCharacterDataHandler(parser, handler) \n#define XML_SetProcessingInstructionHandler(parser, handler) IExpat->XML_SetProcessingInstructionHandler(parser, handler) \n#define XML_SetCommentHandler(parser, handler) IExpat->XML_SetCommentHandler(parser, handler) \n#define XML_SetStartCdataSectionHandler(parser, start) IExpat->XML_SetStartCdataSectionHandler(parser, start) \n#define XML_SetEndCdataSectionHandler(parser, end) IExpat->XML_SetEndCdataSectionHandler(parser, end) \n#define XML_SetCdataSectionHandler(parser, start, end) IExpat->XML_SetCdataSectionHandler(parser, start, end) \n#define XML_SetDefaultHandler(parser, handler) IExpat->XML_SetDefaultHandler(parser, handler) \n#define XML_SetDefaultHandlerExpand(parser, handler) IExpat->XML_SetDefaultHandlerExpand(parser, handler) \n#define XML_SetExternalEntityRefHandler(parser, handler) IExpat->XML_SetExternalEntityRefHandler(parser, handler) \n#define XML_SetExternalEntityRefHandlerArg(parser, arg) IExpat->XML_SetExternalEntityRefHandlerArg(parser, arg) \n#define XML_SetUnknownEncodingHandler(parser, handler, data) IExpat->XML_SetUnknownEncodingHandler(parser, handler, data) \n#define XML_SetStartNamespaceDeclHandler(parser, start) IExpat->XML_SetStartNamespaceDeclHandler(parser, start) \n#define XML_SetEndNamespaceDeclHandler(parser, end) IExpat->XML_SetEndNamespaceDeclHandler(parser, end) \n#define XML_SetNamespaceDeclHandler(parser, start, end) IExpat->XML_SetNamespaceDeclHandler(parser, start, end) \n#define XML_SetXmlDeclHandler(parser, handler) IExpat->XML_SetXmlDeclHandler(parser, handler) \n#define XML_SetStartDoctypeDeclHandler(parser, start) IExpat->XML_SetStartDoctypeDeclHandler(parser, start) \n#define XML_SetEndDoctypeDeclHandler(parser, end) IExpat->XML_SetEndDoctypeDeclHandler(parser, end) \n#define XML_SetDoctypeDeclHandler(parser, start, end) IExpat->XML_SetDoctypeDeclHandler(parser, start, end) \n#define XML_SetElementDeclHandler(parser, eldecl) IExpat->XML_SetElementDeclHandler(parser, eldecl) \n#define XML_SetAttlistDeclHandler(parser, attdecl) IExpat->XML_SetAttlistDeclHandler(parser, attdecl) \n#define XML_SetEntityDeclHandler(parser, handler) IExpat->XML_SetEntityDeclHandler(parser, handler) \n#define XML_SetUnparsedEntityDeclHandler(parser, handler) IExpat->XML_SetUnparsedEntityDeclHandler(parser, handler) \n#define XML_SetNotationDeclHandler(parser, handler) IExpat->XML_SetNotationDeclHandler(parser, handler) \n#define XML_SetNotStandaloneHandler(parser, handler) IExpat->XML_SetNotStandaloneHandler(parser, handler) \n#define XML_GetErrorCode(parser) IExpat->XML_GetErrorCode(parser) \n#define XML_ErrorString(code) IExpat->XML_ErrorString(code) \n#define XML_GetCurrentByteIndex(parser) IExpat->XML_GetCurrentByteIndex(parser) \n#define XML_GetCurrentLineNumber(parser) IExpat->XML_GetCurrentLineNumber(parser) \n#define XML_GetCurrentColumnNumber(parser) IExpat->XML_GetCurrentColumnNumber(parser) \n#define XML_GetCurrentByteCount(parser) IExpat->XML_GetCurrentByteCount(parser) \n#define XML_GetInputContext(parser, offset, size) IExpat->XML_GetInputContext(parser, offset, size) \n#define XML_SetUserData(parser, userData) IExpat->XML_SetUserData(parser, userData) \n#define XML_DefaultCurrent(parser) IExpat->XML_DefaultCurrent(parser) \n#define XML_UseParserAsHandlerArg(parser) IExpat->XML_UseParserAsHandlerArg(parser) \n#define XML_SetBase(parser, base) IExpat->XML_SetBase(parser, base) \n#define XML_GetBase(parser) IExpat->XML_GetBase(parser) \n#define XML_GetSpecifiedAttributeCount(parser) IExpat->XML_GetSpecifiedAttributeCount(parser) \n#define XML_GetIdAttributeIndex(parser) IExpat->XML_GetIdAttributeIndex(parser) \n#define XML_SetEncoding(parser, encoding) IExpat->XML_SetEncoding(parser, encoding) \n#define XML_SetParamEntityParsing(parser, parsing) IExpat->XML_SetParamEntityParsing(parser, parsing) \n#define XML_SetReturnNSTriplet(parser, do_nst) IExpat->XML_SetReturnNSTriplet(parser, do_nst) \n#define XML_ExpatVersion() IExpat->XML_ExpatVersion() \n#define XML_ExpatVersionInfo() IExpat->XML_ExpatVersionInfo() \n#define XML_ParserReset(parser, encoding) IExpat->XML_ParserReset(parser, encoding) \n#define XML_SetSkippedEntityHandler(parser, handler) IExpat->XML_SetSkippedEntityHandler(parser, handler) \n#define XML_UseForeignDTD(parser, useDTD) IExpat->XML_UseForeignDTD(parser, useDTD) \n#define XML_GetFeatureList() IExpat->XML_GetFeatureList() \n#define XML_StopParser(parser, resumable) IExpat->XML_StopParser(parser, resumable) \n#define XML_ResumeParser(parser) IExpat->XML_ResumeParser(parser) \n#define XML_GetParsingStatus(parser, status) IExpat->XML_GetParsingStatus(parser, status) \n#define XML_FreeContentModel(parser, model) IExpat->XML_FreeContentModel(parser, model) \n#define XML_MemMalloc(parser, size) IExpat->XML_MemMalloc(parser, size) \n#define XML_MemRealloc(parser, ptr, size) IExpat->XML_MemRealloc(parser, ptr, size) \n#define XML_MemFree(parser, ptr) IExpat->XML_MemFree(parser, ptr) \n\n#endif /* INLINE4_EXPAT_H */\n"},{"id":13496,"name":"cextern/expat/amiga/include/proto","nodeType":"Package"},{"id":13497,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/amiga/include/proto","text":"#ifndef PROTO_EXPAT_H\n#define PROTO_EXPAT_H\n\n#ifndef LIBRARIES_EXPAT_H\n#include <libraries/expat.h>\n#endif\n\n/****************************************************************************/\n\n#ifndef __NOLIBBASE__\n #ifndef __USE_BASETYPE__\n  extern struct Library * ExpatBase;\n #else\n  extern struct Library * ExpatBase;\n #endif /* __USE_BASETYPE__ */\n#endif /* __NOLIBBASE__ */\n\n/****************************************************************************/\n\n#ifdef __amigaos4__\n #include <interfaces/expat.h>\n #ifdef __USE_INLINE__\n  #include <inline4/expat.h>\n #endif /* __USE_INLINE__ */\n #ifndef CLIB_EXPAT_PROTOS_H\n  #define CLIB_EXPAT_PROTOS_H 1\n #endif /* CLIB_EXPAT_PROTOS_H */\n #ifndef __NOGLOBALIFACE__\n  extern struct ExpatIFace *IExpat;\n #endif /* __NOGLOBALIFACE__ */\n#else /* __amigaos4__ */\n #ifndef CLIB_EXPAT_PROTOS_H\n  #include <clib/expat_protos.h>\n #endif /* CLIB_EXPAT_PROTOS_H */\n #if defined(__GNUC__)\n  #ifndef __PPC__\n   #include <inline/expat.h>\n  #else\n   #include <ppcinline/expat.h>\n  #endif /* __PPC__ */\n #elif defined(__VBCC__)\n  #ifndef __PPC__\n   #include <inline/expat_protos.h>\n  #endif /* __PPC__ */\n #else\n  #include <pragmas/expat_pragmas.h>\n #endif /* __GNUC__ */\n#endif /* __amigaos4__ */\n\n/****************************************************************************/\n\n#endif /* PROTO_EXPAT_H */\n"},{"id":13498,"name":"cextern/expat/amiga/include/interfaces","nodeType":"Package"},{"id":13499,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/amiga/include/interfaces","text":"#ifndef EXPAT_INTERFACE_DEF_H\n#define EXPAT_INTERFACE_DEF_H\n\n/*\n** This file was machine generated by idltool 51.6.\n** Do not edit\n*/ \n\n#ifndef EXEC_TYPES_H\n#include <exec/types.h>\n#endif\n#ifndef EXEC_EXEC_H\n#include <exec/exec.h>\n#endif\n#ifndef EXEC_INTERFACES_H\n#include <exec/interfaces.h>\n#endif\n\n#ifndef LIBRARIES_EXPAT_H\n#include <libraries/expat.h>\n#endif\n\nstruct ExpatIFace\n{\n\tstruct InterfaceData Data;\n\n\tuint32 APICALL (*Obtain)(struct ExpatIFace *Self);\n\tuint32 APICALL (*Release)(struct ExpatIFace *Self);\n\tvoid APICALL (*Expunge)(struct ExpatIFace *Self);\n\tstruct Interface * APICALL (*Clone)(struct ExpatIFace *Self);\n\tXML_Parser APICALL (*XML_ParserCreate)(struct ExpatIFace *Self, const XML_Char * encodingName);\n\tXML_Parser APICALL (*XML_ParserCreateNS)(struct ExpatIFace *Self, const XML_Char * encodingName, XML_Char nsSep);\n\tXML_Parser APICALL (*XML_ParserCreate_MM)(struct ExpatIFace *Self, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator);\n\tXML_Parser APICALL (*XML_ExternalEntityParserCreate)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * context, const XML_Char * encoding);\n\tvoid APICALL (*XML_ParserFree)(struct ExpatIFace *Self, XML_Parser parser);\n\tenum XML_Status APICALL (*XML_Parse)(struct ExpatIFace *Self, XML_Parser parser, const char * s, int len, int isFinal);\n\tenum XML_Status APICALL (*XML_ParseBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len, int isFinal);\n\tvoid * APICALL (*XML_GetBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len);\n\tvoid APICALL (*XML_SetStartElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start);\n\tvoid APICALL (*XML_SetEndElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndElementHandler end);\n\tvoid APICALL (*XML_SetElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end);\n\tvoid APICALL (*XML_SetCharacterDataHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CharacterDataHandler handler);\n\tvoid APICALL (*XML_SetProcessingInstructionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ProcessingInstructionHandler handler);\n\tvoid APICALL (*XML_SetCommentHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CommentHandler handler);\n\tvoid APICALL (*XML_SetStartCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start);\n\tvoid APICALL (*XML_SetEndCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndCdataSectionHandler end);\n\tvoid APICALL (*XML_SetCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end);\n\tvoid APICALL (*XML_SetDefaultHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler);\n\tvoid APICALL (*XML_SetDefaultHandlerExpand)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler);\n\tvoid APICALL (*XML_SetExternalEntityRefHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ExternalEntityRefHandler handler);\n\tvoid APICALL (*XML_SetExternalEntityRefHandlerArg)(struct ExpatIFace *Self, XML_Parser parser, void * arg);\n\tvoid APICALL (*XML_SetUnknownEncodingHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data);\n\tvoid APICALL (*XML_SetStartNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start);\n\tvoid APICALL (*XML_SetEndNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndNamespaceDeclHandler end);\n\tvoid APICALL (*XML_SetNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end);\n\tvoid APICALL (*XML_SetXmlDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_XmlDeclHandler handler);\n\tvoid APICALL (*XML_SetStartDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start);\n\tvoid APICALL (*XML_SetEndDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndDoctypeDeclHandler end);\n\tvoid APICALL (*XML_SetDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end);\n\tvoid APICALL (*XML_SetElementDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ElementDeclHandler eldecl);\n\tvoid APICALL (*XML_SetAttlistDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_AttlistDeclHandler attdecl);\n\tvoid APICALL (*XML_SetEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EntityDeclHandler handler);\n\tvoid APICALL (*XML_SetUnparsedEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler);\n\tvoid APICALL (*XML_SetNotationDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotationDeclHandler handler);\n\tvoid APICALL (*XML_SetNotStandaloneHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotStandaloneHandler handler);\n\tenum XML_Error APICALL (*XML_GetErrorCode)(struct ExpatIFace *Self, XML_Parser parser);\n\tconst XML_LChar * APICALL (*XML_ErrorString)(struct ExpatIFace *Self, enum XML_Error code);\n\tlong APICALL (*XML_GetCurrentByteIndex)(struct ExpatIFace *Self, XML_Parser parser);\n\tint APICALL (*XML_GetCurrentLineNumber)(struct ExpatIFace *Self, XML_Parser parser);\n\tint APICALL (*XML_GetCurrentColumnNumber)(struct ExpatIFace *Self, XML_Parser parser);\n\tint APICALL (*XML_GetCurrentByteCount)(struct ExpatIFace *Self, XML_Parser parser);\n\tconst char * APICALL (*XML_GetInputContext)(struct ExpatIFace *Self, XML_Parser parser, int * offset, int * size);\n\tvoid APICALL (*XML_SetUserData)(struct ExpatIFace *Self, XML_Parser parser, void * userData);\n\tvoid APICALL (*XML_DefaultCurrent)(struct ExpatIFace *Self, XML_Parser parser);\n\tvoid APICALL (*XML_UseParserAsHandlerArg)(struct ExpatIFace *Self, XML_Parser parser);\n\tenum XML_Status APICALL (*XML_SetBase)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * base);\n\tconst XML_Char * APICALL (*XML_GetBase)(struct ExpatIFace *Self, XML_Parser parser);\n\tint APICALL (*XML_GetSpecifiedAttributeCount)(struct ExpatIFace *Self, XML_Parser parser);\n\tint APICALL (*XML_GetIdAttributeIndex)(struct ExpatIFace *Self, XML_Parser parser);\n\tenum XML_Status APICALL (*XML_SetEncoding)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding);\n\tint APICALL (*XML_SetParamEntityParsing)(struct ExpatIFace *Self, XML_Parser parser, enum XML_ParamEntityParsing parsing);\n\tvoid APICALL (*XML_SetReturnNSTriplet)(struct ExpatIFace *Self, XML_Parser parser, int do_nst);\n\tconst XML_LChar * APICALL (*XML_ExpatVersion)(struct ExpatIFace *Self);\n\tXML_Expat_Version APICALL (*XML_ExpatVersionInfo)(struct ExpatIFace *Self);\n\tXML_Bool APICALL (*XML_ParserReset)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding);\n\tvoid APICALL (*XML_SetSkippedEntityHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_SkippedEntityHandler handler);\n\tenum XML_Error APICALL (*XML_UseForeignDTD)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool useDTD);\n\tconst XML_Feature * APICALL (*XML_GetFeatureList)(struct ExpatIFace *Self);\n\tenum XML_Status APICALL (*XML_StopParser)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool resumable);\n\tenum XML_Status APICALL (*XML_ResumeParser)(struct ExpatIFace *Self, XML_Parser parser);\n\tvoid APICALL (*XML_GetParsingStatus)(struct ExpatIFace *Self, XML_Parser parser, XML_ParsingStatus * status);\n\tvoid APICALL (*XML_FreeContentModel)(struct ExpatIFace *Self, XML_Parser parser, XML_Content * model);\n\tvoid * APICALL (*XML_MemMalloc)(struct ExpatIFace *Self, XML_Parser parser, size_t size);\n\tvoid * APICALL (*XML_MemRealloc)(struct ExpatIFace *Self, XML_Parser parser, void * ptr, size_t size);\n\tvoid APICALL (*XML_MemFree)(struct ExpatIFace *Self, XML_Parser parser, void * ptr);\n};\n\n#endif /* EXPAT_INTERFACE_DEF_H */\n"},{"id":13500,"name":"cextern/expat/tests","nodeType":"Package"},{"id":13501,"name":"runtestspp.cpp","nodeType":"TextFile","path":"cextern/expat/tests","text":"// C++ compilation harness for the test suite.\n//\n// This is used to ensure the Expat headers can be included from C++\n// and have everything work as expected.\n//\n#include \"runtests.c\"\n"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":69,"id":13502,"name":"parent_map","nodeType":"Attribute","startLoc":69,"text":"self.parent_map"},{"id":13503,"name":"cextern/expat/amiga/include/libraries","nodeType":"Package"},{"id":13504,"name":"expat.h","nodeType":"TextFile","path":"cextern/expat/amiga/include/libraries","text":"#ifndef LIBRARIES_EXPAT_H\n#define LIBRARIES_EXPAT_H\n\n/*\n** Copyright (c) 2001-2007 Expat maintainers.\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\n** permit persons to whom the Software is furnished to do so, subject to\n** the 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.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n\n/****************************************************************************/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef __GNUC__\n   #ifdef __PPC__\n    #pragma pack(2)\n   #endif\n#elif defined(__VBCC__)\n   #pragma amiga-align\n#endif\n\n/****************************************************************************/\n\n\n#include <stdlib.h>\n\n#ifndef XMLCALL\n#define XMLCALL\n#endif\n\ntypedef char XML_Char;\ntypedef char XML_LChar;\ntypedef long XML_Index;\ntypedef unsigned long XML_Size;\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\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  XML_ERROR_UNBOUND_PREFIX,\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  XML_ERROR_RESERVED_PREFIX_XML,\n  XML_ERROR_RESERVED_PREFIX_XMLNS,\n  XML_ERROR_RESERVED_NAMESPACE_URI\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\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\ntypedef void (*XML_ElementDeclHandler) (void *userData,\n                                        const XML_Char *name,\n                                        XML_Content *model);\n\nvoid\nXML_SetElementDeclHandler(XML_Parser parser,\n                          XML_ElementDeclHandler eldecl);\n\ntypedef void (*XML_AttlistDeclHandler) (\n                                    void            *userData,\n                                    const XML_Char  *elname,\n                                    const XML_Char  *attname,\n                                    const XML_Char  *att_type,\n                                    const XML_Char  *dflt,\n                                    int              isrequired);\n\nvoid\nXML_SetAttlistDeclHandler(XML_Parser parser,\n                          XML_AttlistDeclHandler attdecl);\n\ntypedef void (*XML_XmlDeclHandler) (void *userData,\n                                    const XML_Char *version,\n                                    const XML_Char *encoding,\n                                    int             standalone);\n\nvoid\nXML_SetXmlDeclHandler(XML_Parser parser,\n                      XML_XmlDeclHandler xmldecl);\n\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\nXML_Parser\nXML_ParserCreate(const XML_Char *encoding);\n\nXML_Parser\nXML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);\n\n\nXML_Parser\nXML_ParserCreate_MM(const XML_Char *encoding,\n                    const XML_Memory_Handling_Suite *memsuite,\n                    const XML_Char *namespaceSeparator);\n\nXML_Bool\nXML_ParserReset(XML_Parser parser, const XML_Char *encoding);\n\ntypedef void (*XML_StartElementHandler) (void *userData,\n                                         const XML_Char *name,\n                                         const XML_Char **atts);\n\ntypedef void (*XML_EndElementHandler) (void *userData,\n                                       const XML_Char *name);\n\n\ntypedef void (*XML_CharacterDataHandler) (void *userData,\n                                          const XML_Char *s,\n                                          int len);\n\ntypedef void (*XML_ProcessingInstructionHandler) (\n                                                void *userData,\n                                                const XML_Char *target,\n                                                const XML_Char *data);\n\ntypedef void (*XML_CommentHandler) (void *userData,\n                                    const XML_Char *data);\n\ntypedef void (*XML_StartCdataSectionHandler) (void *userData);\ntypedef void (*XML_EndCdataSectionHandler) (void *userData);\n\ntypedef void (*XML_DefaultHandler) (void *userData,\n                                    const XML_Char *s,\n                                    int len);\n\ntypedef void (*XML_StartDoctypeDeclHandler) (\n                                            void *userData,\n                                            const XML_Char *doctypeName,\n                                            const XML_Char *sysid,\n                                            const XML_Char *pubid,\n                                            int has_internal_subset);\n\ntypedef void (*XML_EndDoctypeDeclHandler)(void *userData);\n\ntypedef void (*XML_EntityDeclHandler) (\n                              void *userData,\n                              const XML_Char *entityName,\n                              int is_parameter_entity,\n                              const XML_Char *value,\n                              int value_length,\n                              const XML_Char *base,\n                              const XML_Char *systemId,\n                              const XML_Char *publicId,\n                              const XML_Char *notationName);\n\nvoid\nXML_SetEntityDeclHandler(XML_Parser parser,\n                         XML_EntityDeclHandler handler);\n\ntypedef void (*XML_UnparsedEntityDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *entityName,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId,\n                                    const XML_Char *notationName);\n\ntypedef void (*XML_NotationDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *notationName,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId);\n\ntypedef void (*XML_StartNamespaceDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *prefix,\n                                    const XML_Char *uri);\n\ntypedef void (*XML_EndNamespaceDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *prefix);\n\ntypedef int (*XML_NotStandaloneHandler) (void *userData);\n\ntypedef int (*XML_ExternalEntityRefHandler) (\n                                    XML_Parser parser,\n                                    const XML_Char *context,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId);\n\ntypedef void (*XML_SkippedEntityHandler) (\n                                    void *userData,\n                                    const XML_Char *entityName,\n                                    int is_parameter_entity);\n\ntypedef struct {\n  int map[256];\n  void *data;\n  int (*convert)(void *data, const char *s);\n  void (*release)(void *data);\n} XML_Encoding;\n\ntypedef int (*XML_UnknownEncodingHandler) (\n                                    void *encodingHandlerData,\n                                    const XML_Char *name,\n                                    XML_Encoding *info);\n\nvoid\nXML_SetElementHandler(XML_Parser parser,\n                      XML_StartElementHandler start,\n                      XML_EndElementHandler end);\n\nvoid\nXML_SetStartElementHandler(XML_Parser parser,\n                           XML_StartElementHandler handler);\n\nvoid\nXML_SetEndElementHandler(XML_Parser parser,\n                         XML_EndElementHandler handler);\n\nvoid\nXML_SetCharacterDataHandler(XML_Parser parser,\n                            XML_CharacterDataHandler handler);\n\nvoid\nXML_SetProcessingInstructionHandler(XML_Parser parser,\n                                    XML_ProcessingInstructionHandler handler);\nvoid\nXML_SetCommentHandler(XML_Parser parser,\n                      XML_CommentHandler handler);\n\nvoid\nXML_SetCdataSectionHandler(XML_Parser parser,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end);\n\nvoid\nXML_SetStartCdataSectionHandler(XML_Parser parser,\n                                XML_StartCdataSectionHandler start);\n\nvoid\nXML_SetEndCdataSectionHandler(XML_Parser parser,\n                              XML_EndCdataSectionHandler end);\n\nvoid\nXML_SetDefaultHandler(XML_Parser parser,\n                      XML_DefaultHandler handler);\n\nvoid\nXML_SetDefaultHandlerExpand(XML_Parser parser,\n                            XML_DefaultHandler handler);\n\nvoid\nXML_SetDoctypeDeclHandler(XML_Parser parser,\n                          XML_StartDoctypeDeclHandler start,\n                          XML_EndDoctypeDeclHandler end);\n\nvoid\nXML_SetStartDoctypeDeclHandler(XML_Parser parser,\n                               XML_StartDoctypeDeclHandler start);\n\nvoid\nXML_SetEndDoctypeDeclHandler(XML_Parser parser,\n                             XML_EndDoctypeDeclHandler end);\n\nvoid\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler);\n\nvoid\nXML_SetNotationDeclHandler(XML_Parser parser,\n                           XML_NotationDeclHandler handler);\n\nvoid\nXML_SetNamespaceDeclHandler(XML_Parser parser,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end);\n\nvoid\nXML_SetStartNamespaceDeclHandler(XML_Parser parser,\n                                 XML_StartNamespaceDeclHandler start);\n\nvoid\nXML_SetEndNamespaceDeclHandler(XML_Parser parser,\n                               XML_EndNamespaceDeclHandler end);\n\nvoid\nXML_SetNotStandaloneHandler(XML_Parser parser,\n                            XML_NotStandaloneHandler handler);\n\nvoid\nXML_SetExternalEntityRefHandler(XML_Parser parser,\n                                XML_ExternalEntityRefHandler handler);\n\nvoid\nXML_SetExternalEntityRefHandlerArg(XML_Parser parser,\n                                   void *arg);\n\nvoid\nXML_SetSkippedEntityHandler(XML_Parser parser,\n                            XML_SkippedEntityHandler handler);\n\nvoid\nXML_SetUnknownEncodingHandler(XML_Parser parser,\n                              XML_UnknownEncodingHandler handler,\n                              void *encodingHandlerData);\n\nvoid\nXML_DefaultCurrent(XML_Parser parser);\n\nvoid\nXML_SetReturnNSTriplet(XML_Parser parser, int do_nst);\n\nvoid\nXML_SetUserData(XML_Parser parser, void *userData);\n\n#define XML_GetUserData(parser) (*(void **)(parser))\n\nenum XML_Status\nXML_SetEncoding(XML_Parser parser, const XML_Char *encoding);\n\nvoid\nXML_UseParserAsHandlerArg(XML_Parser parser);\n\nenum XML_Error\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);\n\n\nenum XML_Status\nXML_SetBase(XML_Parser parser, const XML_Char *base);\n\nconst XML_Char *\nXML_GetBase(XML_Parser parser);\n\nint\nXML_GetSpecifiedAttributeCount(XML_Parser parser);\n\nint\nXML_GetIdAttributeIndex(XML_Parser parser);\n\nenum XML_Status\nXML_Parse(XML_Parser parser, const char *s, int len, int isFinal);\n\nvoid *\nXML_GetBuffer(XML_Parser parser, int len);\n\nenum XML_Status\nXML_ParseBuffer(XML_Parser parser, int len, int isFinal);\n\nenum XML_Status\nXML_StopParser(XML_Parser parser, XML_Bool resumable);\n\nenum XML_Status\nXML_ResumeParser(XML_Parser parser);\n\nenum XML_Parsing {\n  XML_INITIALIZED,\n  XML_PARSING,\n  XML_FINISHED,\n  XML_SUSPENDED\n};\n\ntypedef struct {\n  enum XML_Parsing parsing;\n  XML_Bool finalBuffer;\n} XML_ParsingStatus;\n\nvoid\nXML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);\n\nXML_Parser\nXML_ExternalEntityParserCreate(XML_Parser parser,\n                               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\nint\nXML_SetParamEntityParsing(XML_Parser parser,\n                          enum XML_ParamEntityParsing parsing);\n\nenum XML_Error\nXML_GetErrorCode(XML_Parser parser);\n\nint XML_GetCurrentLineNumber(XML_Parser parser);\nint XML_GetCurrentColumnNumber(XML_Parser parser);\nlong XML_GetCurrentByteIndex(XML_Parser parser);\n\nint\nXML_GetCurrentByteCount(XML_Parser parser);\n\nconst char *\nXML_GetInputContext(XML_Parser parser,\n                    int *offset,\n                    int *size);\n\n#define XML_GetErrorLineNumber   XML_GetCurrentLineNumber\n#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber\n#define XML_GetErrorByteIndex    XML_GetCurrentByteIndex\n\nvoid\nXML_FreeContentModel(XML_Parser parser, XML_Content *model);\n\nvoid *\nXML_MemMalloc(XML_Parser parser, size_t size);\n\nvoid *\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size);\n\nvoid\nXML_MemFree(XML_Parser parser, void *ptr);\n\nvoid\nXML_ParserFree(XML_Parser parser);\n\nconst XML_LChar *\nXML_ErrorString(enum XML_Error code);\n\nconst XML_LChar *\nXML_ExpatVersion(void);\n\ntypedef struct {\n  int major;\n  int minor;\n  int micro;\n} XML_Expat_Version;\n\nXML_Expat_Version \nXML_ExpatVersionInfo(void);\n\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};\n\ntypedef struct {\n  enum XML_FeatureEnum  feature;\n  const XML_LChar       *name;\n  long int              value;\n} XML_Feature;\n\nconst XML_Feature *\nXML_GetFeatureList(void);\n\n\n#define XML_MAJOR_VERSION 2\n#define XML_MINOR_VERSION 0\n#define XML_MICRO_VERSION 1\n\n\n/****************************************************************************/\n\n#ifdef __GNUC__\n   #ifdef __PPC__\n    #pragma pack()\n   #endif\n#elif defined(__VBCC__)\n   #pragma default-align\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n/****************************************************************************/\n\n#endif  /* EXPAT_EXPAT_H */\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":71,"id":13505,"name":"coord_index","nodeType":"Attribute","startLoc":71,"text":"self.coord_index"},{"id":13506,"name":"chardata.h","nodeType":"TextFile","path":"cextern/expat/tests","text":"/* chardata.h\n\n   Interface to some helper routines used to accumulate and check text\n   and attribute content.\n*/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef XML_CHARDATA_H\n#define XML_CHARDATA_H 1\n\n#ifndef XML_VERSION\n#include \"expat.h\"                      /* need XML_Char */\n#endif\n\n\ntypedef struct {\n    int count;                          /* # of chars, < 0 if not set */\n    XML_Char data[1024];\n} CharData;\n\n\nvoid CharData_Init(CharData *storage);\n\nvoid CharData_AppendString(CharData *storage, const char *s);\n\nvoid CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);\n\nint CharData_CheckString(CharData *storage, const char *s);\n\nint CharData_CheckXMLChars(CharData *storage, const XML_Char *s);\n\n\n#endif  /* XML_CHARDATA_H */\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":13507,"name":"chardata.c","nodeType":"TextFile","path":"cextern/expat/tests","text":"/* Copyright (c) 1998-2003 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n\n   chardata.c\n*/\n\n#ifdef HAVE_EXPAT_CONFIG_H\n#include <expat_config.h>\n#endif\n#ifdef HAVE_CHECK_H\n#include <check.h>\n#else\n#include \"minicheck.h\"\n#endif\n\n#include <assert.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"chardata.h\"\n\n\nstatic int\nxmlstrlen(const XML_Char *s)\n{\n    int len = 0;\n    assert(s != NULL);\n    while (s[len] != 0)\n        ++len;\n    return len;\n}\n\n\nvoid\nCharData_Init(CharData *storage)\n{\n    assert(storage != NULL);\n    storage->count = -1;\n}\n\nvoid\nCharData_AppendString(CharData *storage, const char *s)\n{\n    int maxchars = sizeof(storage->data) / sizeof(storage->data[0]);\n    int len;\n\n    assert(s != NULL);\n    len = strlen(s);\n    if (storage->count < 0)\n        storage->count = 0;\n    if ((len + storage->count) > maxchars) {\n        len = (maxchars - storage->count);\n    }\n    if (len + storage->count < sizeof(storage->data)) {\n        memcpy(storage->data + storage->count, s, len);\n        storage->count += len;\n    }\n}\n\nvoid\nCharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len)\n{\n    int maxchars;\n\n    assert(storage != NULL);\n    assert(s != NULL);\n    maxchars = sizeof(storage->data) / sizeof(storage->data[0]);\n    if (storage->count < 0)\n        storage->count = 0;\n    if (len < 0)\n        len = xmlstrlen(s);\n    if ((len + storage->count) > maxchars) {\n        len = (maxchars - storage->count);\n    }\n    if (len + storage->count < sizeof(storage->data)) {\n        memcpy(storage->data + storage->count, s,\n               len * sizeof(storage->data[0]));\n        storage->count += len;\n    }\n}\n\nint\nCharData_CheckString(CharData *storage, const char *expected)\n{\n    char buffer[1280];\n    int len;\n    int count;\n\n    assert(storage != NULL);\n    assert(expected != NULL);\n    count = (storage->count < 0) ? 0 : storage->count;\n    len = strlen(expected);\n    if (len != count) {\n        if (sizeof(XML_Char) == 1)\n            sprintf(buffer, \"wrong number of data characters:\"\n                    \" got %d, expected %d:\\n%s\", count, len, storage->data);\n        else\n            sprintf(buffer,\n                    \"wrong number of data characters: got %d, expected %d\",\n                    count, len);\n        fail(buffer);\n        return 0;\n    }\n    if (memcmp(expected, storage->data, len) != 0) {\n        fail(\"got bad data bytes\");\n        return 0;\n    }\n    return 1;\n}\n\nint\nCharData_CheckXMLChars(CharData *storage, const XML_Char *expected)\n{\n    char buffer[1024];\n    int len = xmlstrlen(expected);\n    int count;\n\n    assert(storage != NULL);\n    count = (storage->count < 0) ? 0 : storage->count;\n    if (len != count) {\n        sprintf(buffer, \"wrong number of data characters: got %d, expected %d\",\n                count, len);\n        fail(buffer);\n        return 0;\n    }\n    if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) {\n        fail(\"got bad data bytes\");\n        return 0;\n    }\n    return 1;\n}\n"},{"id":13508,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat/tests","text":"This directory contains the (fledgling) test suite for Expat.  The\ntests provide general unit testing and regression coverage.  The tests\nare not expected to be useful examples of Expat usage; see the\nexamples/ directory for that.\n\nThe Expat tests use a partial internal implementation of the \"Check\"\nunit testing framework for C. More information on Check can be found at:\n\n        http://check.sourceforge.net/\n\nExpat must be built and, depending on platform, must be installed, before \"make check\" can be executed.\n\nThis test suite can all change in a later version.\n"},{"id":13509,"name":"runtests.c","nodeType":"TextFile","path":"cextern/expat/tests","text":"/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n\n   runtest.c : run the Expat test suite\n*/\n\n#ifdef HAVE_EXPAT_CONFIG_H\n#include <expat_config.h>\n#endif\n\n#include <assert.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdint.h>\n\n#include \"expat.h\"\n#include \"chardata.h\"\n#include \"minicheck.h\"\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n#ifdef XML_LARGE_SIZE\n#define XML_FMT_INT_MOD \"ll\"\n#else\n#define XML_FMT_INT_MOD \"l\"\n#endif\n\nstatic XML_Parser parser;\n\n\nstatic void\nbasic_setup(void)\n{\n    parser = XML_ParserCreate(NULL);\n    if (parser == NULL)\n        fail(\"Parser not created.\");\n}\n\nstatic void\nbasic_teardown(void)\n{\n    if (parser != NULL)\n        XML_ParserFree(parser);\n}\n\n/* Generate a failure using the parser state to create an error message;\n   this should be used when the parser reports an error we weren't\n   expecting.\n*/\nstatic void\n_xml_failure(XML_Parser parser, const char *file, int line)\n{\n    char buffer[1024];\n    enum XML_Error err = XML_GetErrorCode(parser);\n    sprintf(buffer,\n            \"    %d: %s (line %\" XML_FMT_INT_MOD \"u, offset %\"\\\n                XML_FMT_INT_MOD \"u)\\n    reported from %s, line %d\\n\",\n            err,\n            XML_ErrorString(err),\n            XML_GetCurrentLineNumber(parser),\n            XML_GetCurrentColumnNumber(parser),\n            file, line);\n    _fail_unless(0, file, line, buffer);\n}\n\n#define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__)\n\nstatic void\n_expect_failure(char *text, enum XML_Error errorCode, char *errorMessage,\n                char *file, int lineno)\n{\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK)\n        /* Hackish use of _fail_unless() macro, but let's us report\n           the right filename and line number. */\n        _fail_unless(0, file, lineno, errorMessage);\n    if (XML_GetErrorCode(parser) != errorCode)\n        _xml_failure(parser, file, lineno);\n}\n\n#define expect_failure(text, errorCode, errorMessage) \\\n        _expect_failure((text), (errorCode), (errorMessage), \\\n                        __FILE__, __LINE__)\n\n/* Dummy handlers for when we need to set a handler to tickle a bug,\n   but it doesn't need to do anything.\n*/\n\nstatic void XMLCALL\ndummy_start_doctype_handler(void           *userData,\n                            const XML_Char *doctypeName,\n                            const XML_Char *sysid,\n                            const XML_Char *pubid,\n                            int            has_internal_subset)\n{}\n\nstatic void XMLCALL\ndummy_end_doctype_handler(void *userData)\n{}\n\nstatic void XMLCALL\ndummy_entity_decl_handler(void           *userData,\n                          const XML_Char *entityName,\n                          int            is_parameter_entity,\n                          const XML_Char *value,\n                          int            value_length,\n                          const XML_Char *base,\n                          const XML_Char *systemId,\n                          const XML_Char *publicId,\n                          const XML_Char *notationName)\n{}\n\nstatic void XMLCALL\ndummy_notation_decl_handler(void *userData,\n                            const XML_Char *notationName,\n                            const XML_Char *base,\n                            const XML_Char *systemId,\n                            const XML_Char *publicId)\n{}\n\nstatic void XMLCALL\ndummy_element_decl_handler(void *userData,\n                           const XML_Char *name,\n                           XML_Content *model)\n{}\n\nstatic void XMLCALL\ndummy_attlist_decl_handler(void           *userData,\n                           const XML_Char *elname,\n                           const XML_Char *attname,\n                           const XML_Char *att_type,\n                           const XML_Char *dflt,\n                           int            isrequired)\n{}\n\nstatic void XMLCALL\ndummy_comment_handler(void *userData, const XML_Char *data)\n{}\n\nstatic void XMLCALL\ndummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data)\n{}\n\nstatic void XMLCALL\ndummy_start_element(void *userData,\n                    const XML_Char *name, const XML_Char **atts)\n{}\n\n\n/*\n * Character & encoding tests.\n */\n\nSTART_TEST(test_nul_byte)\n{\n    char text[] = \"<doc>\\0</doc>\";\n\n    /* test that a NUL byte (in US-ASCII data) is an error */\n    if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK)\n        fail(\"Parser did not report error on NUL-byte.\");\n    if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)\n        xml_failure(parser);\n}\nEND_TEST\n\n\nSTART_TEST(test_u0000_char)\n{\n    /* test that a NUL byte (in US-ASCII data) is an error */\n    expect_failure(\"<doc>&#0;</doc>\",\n                   XML_ERROR_BAD_CHAR_REF,\n                   \"Parser did not report error on NUL-byte.\");\n}\nEND_TEST\n\nSTART_TEST(test_bom_utf8)\n{\n    /* This test is really just making sure we don't core on a UTF-8 BOM. */\n    char *text = \"\\357\\273\\277<e/>\";\n\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nSTART_TEST(test_bom_utf16_be)\n{\n    char text[] = \"\\376\\377\\0<\\0e\\0/\\0>\";\n\n    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nSTART_TEST(test_bom_utf16_le)\n{\n    char text[] = \"\\377\\376<\\0e\\0/\\0>\\0\";\n\n    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nstatic void XMLCALL\naccumulate_characters(void *userData, const XML_Char *s, int len)\n{\n    CharData_AppendXMLChars((CharData *)userData, s, len);\n}\n\nstatic void XMLCALL\naccumulate_attribute(void *userData, const XML_Char *name,\n                     const XML_Char **atts)\n{\n    CharData *storage = (CharData *)userData;\n    if (storage->count < 0 && atts != NULL && atts[0] != NULL) {\n        /* \"accumulate\" the value of the first attribute we see */\n        CharData_AppendXMLChars(storage, atts[1], -1);\n    }\n}\n\n\nstatic void\n_run_character_check(XML_Char *text, XML_Char *expected,\n                     const char *file, int line)\n{\n    CharData storage;\n\n    CharData_Init(&storage);\n    XML_SetUserData(parser, &storage);\n    XML_SetCharacterDataHandler(parser, accumulate_characters);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        _xml_failure(parser, file, line);\n    CharData_CheckXMLChars(&storage, expected);\n}\n\n#define run_character_check(text, expected) \\\n        _run_character_check(text, expected, __FILE__, __LINE__)\n\nstatic void\n_run_attribute_check(XML_Char *text, XML_Char *expected,\n                     const char *file, int line)\n{\n    CharData storage;\n\n    CharData_Init(&storage);\n    XML_SetUserData(parser, &storage);\n    XML_SetStartElementHandler(parser, accumulate_attribute);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        _xml_failure(parser, file, line);\n    CharData_CheckXMLChars(&storage, expected);\n}\n\n#define run_attribute_check(text, expected) \\\n        _run_attribute_check(text, expected, __FILE__, __LINE__)\n\n/* Regression test for SF bug #491986. */\nSTART_TEST(test_danish_latin1)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='iso-8859-1'?>\\n\"\n        \"<e>J\\xF8rgen \\xE6\\xF8\\xE5\\xC6\\xD8\\xC5</e>\";\n    run_character_check(text,\n             \"J\\xC3\\xB8rgen \\xC3\\xA6\\xC3\\xB8\\xC3\\xA5\\xC3\\x86\\xC3\\x98\\xC3\\x85\");\n}\nEND_TEST\n\n\n/* Regression test for SF bug #514281. */\nSTART_TEST(test_french_charref_hexidecimal)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='iso-8859-1'?>\\n\"\n        \"<doc>&#xE9;&#xE8;&#xE0;&#xE7;&#xEA;&#xC8;</doc>\";\n    run_character_check(text,\n                        \"\\xC3\\xA9\\xC3\\xA8\\xC3\\xA0\\xC3\\xA7\\xC3\\xAA\\xC3\\x88\");\n}\nEND_TEST\n\nSTART_TEST(test_french_charref_decimal)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='iso-8859-1'?>\\n\"\n        \"<doc>&#233;&#232;&#224;&#231;&#234;&#200;</doc>\";\n    run_character_check(text,\n                        \"\\xC3\\xA9\\xC3\\xA8\\xC3\\xA0\\xC3\\xA7\\xC3\\xAA\\xC3\\x88\");\n}\nEND_TEST\n\nSTART_TEST(test_french_latin1)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='iso-8859-1'?>\\n\"\n        \"<doc>\\xE9\\xE8\\xE0\\xE7\\xEa\\xC8</doc>\";\n    run_character_check(text,\n                        \"\\xC3\\xA9\\xC3\\xA8\\xC3\\xA0\\xC3\\xA7\\xC3\\xAA\\xC3\\x88\");\n}\nEND_TEST\n\nSTART_TEST(test_french_utf8)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='utf-8'?>\\n\"\n        \"<doc>\\xC3\\xA9</doc>\";\n    run_character_check(text, \"\\xC3\\xA9\");\n}\nEND_TEST\n\n/* Regression test for SF bug #600479.\n   XXX There should be a test that exercises all legal XML Unicode\n   characters as PCDATA and attribute value content, and XML Name\n   characters as part of element and attribute names.\n*/\nSTART_TEST(test_utf8_false_rejection)\n{\n    char *text = \"<doc>\\xEF\\xBA\\xBF</doc>\";\n    run_character_check(text, \"\\xEF\\xBA\\xBF\");\n}\nEND_TEST\n\n/* Regression test for SF bug #477667.\n   This test assures that any 8-bit character followed by a 7-bit\n   character will not be mistakenly interpreted as a valid UTF-8\n   sequence.\n*/\nSTART_TEST(test_illegal_utf8)\n{\n    char text[100];\n    int i;\n\n    for (i = 128; i <= 255; ++i) {\n        sprintf(text, \"<e>%ccd</e>\", i);\n        if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) {\n            sprintf(text,\n                    \"expected token error for '%c' (ordinal %d) in UTF-8 text\",\n                    i, i);\n            fail(text);\n        }\n        else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)\n            xml_failure(parser);\n        /* Reset the parser since we use the same parser repeatedly. */\n        XML_ParserReset(parser, NULL);\n    }\n}\nEND_TEST\n\nSTART_TEST(test_utf16)\n{\n    /* <?xml version=\"1.0\" encoding=\"UTF-16\"?>\n       <doc a='123'>some text</doc>\n    */\n    char text[] =\n        \"\\000<\\000?\\000x\\000m\\000\\154\\000 \\000v\\000e\\000r\\000s\\000i\\000o\"\n        \"\\000n\\000=\\000'\\0001\\000.\\000\\060\\000'\\000 \\000e\\000n\\000c\\000o\"\n        \"\\000d\\000i\\000n\\000g\\000=\\000'\\000U\\000T\\000F\\000-\\0001\\000\\066\"\n        \"\\000'\\000?\\000>\\000\\n\"\n        \"\\000<\\000d\\000o\\000c\\000 \\000a\\000=\\000'\\0001\\0002\\0003\\000'\"\n        \"\\000>\\000s\\000o\\000m\\000e\\000 \\000t\\000e\\000x\\000t\\000<\\000/\"\n        \"\\000d\\000o\\000c\\000>\";\n    if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nSTART_TEST(test_utf16_le_epilog_newline)\n{\n    unsigned int first_chunk_bytes = 17;\n    char text[] = \n        \"\\xFF\\xFE\"                      /* BOM */\n        \"<\\000e\\000/\\000>\\000\"          /* document element */\n        \"\\r\\000\\n\\000\\r\\000\\n\\000\";     /* epilog */\n\n    if (first_chunk_bytes >= sizeof(text) - 1)\n        fail(\"bad value of first_chunk_bytes\");\n    if (  XML_Parse(parser, text, first_chunk_bytes, XML_FALSE)\n          == XML_STATUS_ERROR)\n        xml_failure(parser);\n    else {\n        enum XML_Status rc;\n        rc = XML_Parse(parser, text + first_chunk_bytes,\n                       sizeof(text) - first_chunk_bytes - 1, XML_TRUE);\n        if (rc == XML_STATUS_ERROR)\n            xml_failure(parser);\n    }\n}\nEND_TEST\n\n/* Regression test for SF bug #481609, #774028. */\nSTART_TEST(test_latin1_umlauts)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='iso-8859-1'?>\\n\"\n        \"<e a='\\xE4 \\xF6 \\xFC &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; >'\\n\"\n        \"  >\\xE4 \\xF6 \\xFC &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; ></e>\";\n    char *utf8 =\n        \"\\xC3\\xA4 \\xC3\\xB6 \\xC3\\xBC \"\n        \"\\xC3\\xA4 \\xC3\\xB6 \\xC3\\xBC \"\n        \"\\xC3\\xA4 \\xC3\\xB6 \\xC3\\xBC >\";\n    run_character_check(text, utf8);\n    XML_ParserReset(parser, NULL);\n    run_attribute_check(text, utf8);\n}\nEND_TEST\n\n/* Regression test #1 for SF bug #653180. */\nSTART_TEST(test_line_number_after_parse)\n{  \n    char *text =\n        \"<tag>\\n\"\n        \"\\n\"\n        \"\\n</tag>\";\n    XML_Size lineno;\n\n    if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n    lineno = XML_GetCurrentLineNumber(parser);\n    if (lineno != 4) {\n        char buffer[100];\n        sprintf(buffer, \n            \"expected 4 lines, saw %\" XML_FMT_INT_MOD \"u\", lineno);\n        fail(buffer);\n    }\n}\nEND_TEST\n\n/* Regression test #2 for SF bug #653180. */\nSTART_TEST(test_column_number_after_parse)\n{\n    char *text = \"<tag></tag>\";\n    XML_Size colno;\n\n    if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n    colno = XML_GetCurrentColumnNumber(parser);\n    if (colno != 11) {\n        char buffer[100];\n        sprintf(buffer, \n            \"expected 11 columns, saw %\" XML_FMT_INT_MOD \"u\", colno);\n        fail(buffer);\n    }\n}\nEND_TEST\n\nstatic void XMLCALL\nstart_element_event_handler2(void *userData, const XML_Char *name,\n\t\t\t     const XML_Char **attr)\n{\n    CharData *storage = (CharData *) userData;\n    char buffer[100];\n\n    sprintf(buffer,\n        \"<%s> at col:%\" XML_FMT_INT_MOD \"u line:%\"\\\n            XML_FMT_INT_MOD \"u\\n\", name,\n\t    XML_GetCurrentColumnNumber(parser),\n\t    XML_GetCurrentLineNumber(parser));\n    CharData_AppendString(storage, buffer);\n}\n\nstatic void XMLCALL\nend_element_event_handler2(void *userData, const XML_Char *name)\n{\n    CharData *storage = (CharData *) userData;\n    char buffer[100];\n\n    sprintf(buffer,\n        \"</%s> at col:%\" XML_FMT_INT_MOD \"u line:%\"\\\n            XML_FMT_INT_MOD \"u\\n\", name,\n\t    XML_GetCurrentColumnNumber(parser),\n\t    XML_GetCurrentLineNumber(parser));\n    CharData_AppendString(storage, buffer);\n}\n\n/* Regression test #3 for SF bug #653180. */\nSTART_TEST(test_line_and_column_numbers_inside_handlers)\n{\n    char *text =\n        \"<a>\\n\"        /* Unix end-of-line */\n        \"  <b>\\r\\n\"    /* Windows end-of-line */\n        \"    <c/>\\r\"   /* Mac OS end-of-line */\n        \"  </b>\\n\"\n        \"  <d>\\n\"\n        \"    <f/>\\n\"\n        \"  </d>\\n\"\n        \"</a>\";\n    char *expected =\n        \"<a> at col:0 line:1\\n\"\n        \"<b> at col:2 line:2\\n\"\n        \"<c> at col:4 line:3\\n\"\n        \"</c> at col:8 line:3\\n\"\n        \"</b> at col:2 line:4\\n\"\n        \"<d> at col:2 line:5\\n\"\n        \"<f> at col:4 line:6\\n\"\n        \"</f> at col:8 line:6\\n\"\n        \"</d> at col:2 line:7\\n\"\n        \"</a> at col:0 line:8\\n\";\n    CharData storage;\n\n    CharData_Init(&storage);\n    XML_SetUserData(parser, &storage);\n    XML_SetStartElementHandler(parser, start_element_event_handler2);\n    XML_SetEndElementHandler(parser, end_element_event_handler2);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n\n    CharData_CheckString(&storage, expected); \n}\nEND_TEST\n\n/* Regression test #4 for SF bug #653180. */\nSTART_TEST(test_line_number_after_error)\n{\n    char *text =\n        \"<a>\\n\"\n        \"  <b>\\n\"\n        \"  </a>\";  /* missing </b> */\n    XML_Size lineno;\n    if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)\n        fail(\"Expected a parse error\");\n\n    lineno = XML_GetCurrentLineNumber(parser);\n    if (lineno != 3) {\n        char buffer[100];\n        sprintf(buffer, \"expected 3 lines, saw %\" XML_FMT_INT_MOD \"u\", lineno);\n        fail(buffer);\n    }\n}\nEND_TEST\n    \n/* Regression test #5 for SF bug #653180. */\nSTART_TEST(test_column_number_after_error)\n{\n    char *text =\n        \"<a>\\n\"\n        \"  <b>\\n\"\n        \"  </a>\";  /* missing </b> */\n    XML_Size colno;\n    if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)\n        fail(\"Expected a parse error\");\n\n    colno = XML_GetCurrentColumnNumber(parser);\n    if (colno != 4) { \n        char buffer[100];\n        sprintf(buffer, \n            \"expected 4 columns, saw %\" XML_FMT_INT_MOD \"u\", colno);\n        fail(buffer);\n    }\n}\nEND_TEST\n\n/* Regression test for SF bug #478332. */\nSTART_TEST(test_really_long_lines)\n{\n    /* This parses an input line longer than INIT_DATA_BUF_SIZE\n       characters long (defined to be 1024 in xmlparse.c).  We take a\n       really cheesy approach to building the input buffer, because\n       this avoids writing bugs in buffer-filling code.\n    */\n    char *text =\n        \"<e>\"\n        /* 64 chars */\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        /* until we have at least 1024 characters on the line: */\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+\"\n        \"</e>\";\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n\n/*\n * Element event tests.\n */\n\nstatic void XMLCALL\nend_element_event_handler(void *userData, const XML_Char *name)\n{\n    CharData *storage = (CharData *) userData;\n    CharData_AppendString(storage, \"/\");\n    CharData_AppendXMLChars(storage, name, -1);\n}\n\nSTART_TEST(test_end_element_events)\n{\n    char *text = \"<a><b><c/></b><d><f/></d></a>\";\n    char *expected = \"/c/b/f/d/a\";\n    CharData storage;\n\n    CharData_Init(&storage);\n    XML_SetUserData(parser, &storage);\n    XML_SetEndElementHandler(parser, end_element_event_handler);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n    CharData_CheckString(&storage, expected);\n}\nEND_TEST\n\n\n/*\n * Attribute tests.\n */\n\n/* Helpers used by the following test; this checks any \"attr\" and \"refs\"\n   attributes to make sure whitespace has been normalized.\n\n   Return true if whitespace has been normalized in a string, using\n   the rules for attribute value normalization.  The 'is_cdata' flag\n   is needed since CDATA attributes don't need to have multiple\n   whitespace characters collapsed to a single space, while other\n   attribute data types do.  (Section 3.3.3 of the recommendation.)\n*/\nstatic int\nis_whitespace_normalized(const XML_Char *s, int is_cdata)\n{\n    int blanks = 0;\n    int at_start = 1;\n    while (*s) {\n        if (*s == ' ')\n            ++blanks;\n        else if (*s == '\\t' || *s == '\\n' || *s == '\\r')\n            return 0;\n        else {\n            if (at_start) {\n                at_start = 0;\n                if (blanks && !is_cdata)\n                    /* illegal leading blanks */\n                    return 0;\n            }\n            else if (blanks > 1 && !is_cdata)\n                return 0;\n            blanks = 0;\n        }\n        ++s;\n    }\n    if (blanks && !is_cdata)\n        return 0;\n    return 1;\n}\n\n/* Check the attribute whitespace checker: */\nstatic void\ntesthelper_is_whitespace_normalized(void)\n{\n    assert(is_whitespace_normalized(\"abc\", 0));\n    assert(is_whitespace_normalized(\"abc\", 1));\n    assert(is_whitespace_normalized(\"abc def ghi\", 0));\n    assert(is_whitespace_normalized(\"abc def ghi\", 1));\n    assert(!is_whitespace_normalized(\" abc def ghi\", 0));\n    assert(is_whitespace_normalized(\" abc def ghi\", 1));\n    assert(!is_whitespace_normalized(\"abc  def ghi\", 0));\n    assert(is_whitespace_normalized(\"abc  def ghi\", 1));\n    assert(!is_whitespace_normalized(\"abc def ghi \", 0));\n    assert(is_whitespace_normalized(\"abc def ghi \", 1));\n    assert(!is_whitespace_normalized(\" \", 0));\n    assert(is_whitespace_normalized(\" \", 1));\n    assert(!is_whitespace_normalized(\"\\t\", 0));\n    assert(!is_whitespace_normalized(\"\\t\", 1));\n    assert(!is_whitespace_normalized(\"\\n\", 0));\n    assert(!is_whitespace_normalized(\"\\n\", 1));\n    assert(!is_whitespace_normalized(\"\\r\", 0));\n    assert(!is_whitespace_normalized(\"\\r\", 1));\n    assert(!is_whitespace_normalized(\"abc\\t def\", 1));\n}\n\nstatic void XMLCALL\ncheck_attr_contains_normalized_whitespace(void *userData,\n                                          const XML_Char *name,\n                                          const XML_Char **atts)\n{\n    int i;\n    for (i = 0; atts[i] != NULL; i += 2) {\n        const XML_Char *attrname = atts[i];\n        const XML_Char *value = atts[i + 1];\n        if (strcmp(\"attr\", attrname) == 0\n            || strcmp(\"ents\", attrname) == 0\n            || strcmp(\"refs\", attrname) == 0) {\n            if (!is_whitespace_normalized(value, 0)) {\n                char buffer[256];\n                sprintf(buffer, \"attribute value not normalized: %s='%s'\",\n                        attrname, value);\n                fail(buffer);\n            }\n        }\n    }\n}\n\nSTART_TEST(test_attr_whitespace_normalization)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"  <!ATTLIST doc\\n\"\n        \"            attr NMTOKENS #REQUIRED\\n\"\n        \"            ents ENTITIES #REQUIRED\\n\"\n        \"            refs IDREFS   #REQUIRED>\\n\"\n        \"]>\\n\"\n        \"<doc attr='    a  b c\\t\\td\\te\\t' refs=' id-1   \\t  id-2\\t\\t'  \\n\"\n        \"     ents=' ent-1   \\t\\r\\n\"\n        \"            ent-2  ' >\\n\"\n        \"  <e id='id-1'/>\\n\"\n        \"  <e id='id-2'/>\\n\"\n        \"</doc>\";\n\n    XML_SetStartElementHandler(parser,\n                               check_attr_contains_normalized_whitespace);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n\n/*\n * XML declaration tests.\n */\n\nSTART_TEST(test_xmldecl_misplaced)\n{\n    expect_failure(\"\\n\"\n                   \"<?xml version='1.0'?>\\n\"\n                   \"<a/>\",\n                   XML_ERROR_MISPLACED_XML_PI,\n                   \"failed to report misplaced XML declaration\");\n}\nEND_TEST\n\n/* Regression test for SF bug #584832. */\nstatic int XMLCALL\nUnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info)\n{\n    if (strcmp(encoding,\"unsupported-encoding\") == 0) {\n        int i;\n        for (i = 0; i < 256; ++i)\n            info->map[i] = i;\n        info->data = NULL;\n        info->convert = NULL;\n        info->release = NULL;\n        return XML_STATUS_OK;\n    }\n    return XML_STATUS_ERROR;\n}\n\nSTART_TEST(test_unknown_encoding_internal_entity)\n{\n    char *text =\n        \"<?xml version='1.0' encoding='unsupported-encoding'?>\\n\"\n        \"<!DOCTYPE test [<!ENTITY foo 'bar'>]>\\n\"\n        \"<test a='&foo;'/>\";\n\n    XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test for SF bug #620106. */\nstatic int XMLCALL\nexternal_entity_loader_set_encoding(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 text says it's an unsupported encoding, but it's really\n       UTF-8, which we tell Expat using XML_SetEncoding().\n    */\n    char *text =\n        \"<?xml encoding='iso-8859-3'?>\"\n        \"\\xC3\\xA9\";\n    XML_Parser extparser;\n\n    extparser = XML_ExternalEntityParserCreate(parser, context, NULL);\n    if (extparser == NULL)\n        fail(\"Could not create external entity parser.\");\n    if (!XML_SetEncoding(extparser, \"utf-8\"))\n        fail(\"XML_SetEncoding() ignored for external entity\");\n    if (  XML_Parse(extparser, text, strlen(text), XML_TRUE)\n          == XML_STATUS_ERROR) {\n        xml_failure(parser);\n        return 0;\n    }\n    return 1;\n}\n\nSTART_TEST(test_ext_entity_set_encoding)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"  <!ENTITY en SYSTEM 'http://xml.libexpat.org/dummy.ent'>\\n\"\n        \"]>\\n\"\n        \"<doc>&en;</doc>\";\n\n    XML_SetExternalEntityRefHandler(parser,\n                                    external_entity_loader_set_encoding);\n    run_character_check(text, \"\\xC3\\xA9\");\n}\nEND_TEST\n\n/* Test that no error is reported for unknown entities if we don't\n   read an external subset.  This was fixed in Expat 1.95.5.\n*/\nSTART_TEST(test_wfc_undeclared_entity_unread_external_subset) {\n    char *text =\n        \"<!DOCTYPE doc SYSTEM 'foo'>\\n\"\n        \"<doc>&entity;</doc>\";\n\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Test that an error is reported for unknown entities if we don't\n   have an external subset.\n*/\nSTART_TEST(test_wfc_undeclared_entity_no_external_subset) {\n    expect_failure(\"<doc>&entity;</doc>\",\n                   XML_ERROR_UNDEFINED_ENTITY,\n                   \"Parser did not report undefined entity w/out a DTD.\");\n}\nEND_TEST\n\n/* Test that an error is reported for unknown entities if we don't\n   read an external subset, but have been declared standalone.\n*/\nSTART_TEST(test_wfc_undeclared_entity_standalone) {\n    char *text =\n        \"<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\\n\"\n        \"<!DOCTYPE doc SYSTEM 'foo'>\\n\"\n        \"<doc>&entity;</doc>\";\n\n    expect_failure(text,\n                   XML_ERROR_UNDEFINED_ENTITY,\n                   \"Parser did not report undefined entity (standalone).\");\n}\nEND_TEST\n\nstatic int XMLCALL\nexternal_entity_loader(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    char *text = (char *)XML_GetUserData(parser);\n    XML_Parser extparser;\n\n    extparser = XML_ExternalEntityParserCreate(parser, context, NULL);\n    if (extparser == NULL)\n        fail(\"Could not create external entity parser.\");\n    if (  XML_Parse(extparser, text, strlen(text), XML_TRUE)\n          == XML_STATUS_ERROR) {\n        xml_failure(parser);\n        return XML_STATUS_ERROR;\n    }\n    return XML_STATUS_OK;\n}\n\n/* Test that an error is reported for unknown entities if we have read\n   an external subset, and standalone is true.\n*/\nSTART_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) {\n    char *text =\n        \"<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\\n\"\n        \"<!DOCTYPE doc SYSTEM 'foo'>\\n\"\n        \"<doc>&entity;</doc>\";\n    char *foo_text =\n        \"<!ELEMENT doc (#PCDATA)*>\";\n\n    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);\n    XML_SetUserData(parser, foo_text);\n    XML_SetExternalEntityRefHandler(parser, external_entity_loader);\n    expect_failure(text,\n                   XML_ERROR_UNDEFINED_ENTITY,\n                   \"Parser did not report undefined entity (external DTD).\");\n}\nEND_TEST\n\n/* Test that no error is reported for unknown entities if we have read\n   an external subset, and standalone is false.\n*/\nSTART_TEST(test_wfc_undeclared_entity_with_external_subset) {\n    char *text =\n        \"<?xml version='1.0' encoding='us-ascii'?>\\n\"\n        \"<!DOCTYPE doc SYSTEM 'foo'>\\n\"\n        \"<doc>&entity;</doc>\";\n    char *foo_text =\n        \"<!ELEMENT doc (#PCDATA)*>\";\n\n    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);\n    XML_SetUserData(parser, foo_text);\n    XML_SetExternalEntityRefHandler(parser, external_entity_loader);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nSTART_TEST(test_wfc_no_recursive_entity_refs)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"  <!ENTITY entity '&#38;entity;'>\\n\"\n        \"]>\\n\"\n        \"<doc>&entity;</doc>\";\n\n    expect_failure(text,\n                   XML_ERROR_RECURSIVE_ENTITY_REF,\n                   \"Parser did not report recursive entity reference.\");\n}\nEND_TEST\n\n/* Regression test for SF bug #483514. */\nSTART_TEST(test_dtd_default_handling)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"<!ENTITY e SYSTEM 'http://xml.libexpat.org/e'>\\n\"\n        \"<!NOTATION n SYSTEM 'http://xml.libexpat.org/n'>\\n\"\n        \"<!ELEMENT doc EMPTY>\\n\"\n        \"<!ATTLIST doc a CDATA #IMPLIED>\\n\"\n        \"<?pi in dtd?>\\n\"\n        \"<!--comment in dtd-->\\n\"\n        \"]><doc/>\";\n\n    XML_SetDefaultHandler(parser, accumulate_characters);\n    XML_SetDoctypeDeclHandler(parser,\n                              dummy_start_doctype_handler,\n                              dummy_end_doctype_handler);\n    XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler);\n    XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler);\n    XML_SetElementDeclHandler(parser, dummy_element_decl_handler);\n    XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler);\n    XML_SetProcessingInstructionHandler(parser, dummy_pi_handler);\n    XML_SetCommentHandler(parser, dummy_comment_handler);\n    run_character_check(text, \"\\n\\n\\n\\n\\n\\n\\n<doc/>\");\n}\nEND_TEST\n\n/* See related SF bug #673791.\n   When namespace processing is enabled, setting the namespace URI for\n   a prefix is not allowed; this test ensures that it *is* allowed\n   when namespace processing is not enabled.\n   (See Namespaces in XML, section 2.)\n*/\nSTART_TEST(test_empty_ns_without_namespaces)\n{\n    char *text =\n        \"<doc xmlns:prefix='http://www.example.com/'>\\n\"\n        \"  <e xmlns:prefix=''/>\\n\"\n        \"</doc>\";\n\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test for SF bug #824420.\n   Checks that an xmlns:prefix attribute set in an attribute's default\n   value isn't misinterpreted.\n*/\nSTART_TEST(test_ns_in_attribute_default_without_namespaces)\n{\n    char *text =\n        \"<!DOCTYPE e:element [\\n\"\n        \"  <!ATTLIST e:element\\n\"\n        \"    xmlns:e CDATA 'http://example.com/'>\\n\"\n        \"      ]>\\n\"\n        \"<e:element/>\";\n\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nstatic char *long_character_data_text =\n    \"<?xml version='1.0' encoding='iso-8859-1'?><s>\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"012345678901234567890123456789012345678901234567890123456789\"\n    \"</s>\";\n\nstatic XML_Bool resumable = XML_FALSE;\n\nstatic void\nclearing_aborting_character_handler(void *userData,\n                                    const XML_Char *s, int len)\n{\n    XML_StopParser(parser, resumable);\n    XML_SetCharacterDataHandler(parser, NULL);\n}\n\n/* Regression test for SF bug #1515266: missing check of stopped\n   parser in doContext() 'for' loop. */\nSTART_TEST(test_stop_parser_between_char_data_calls)\n{\n    /* The sample data must be big enough that there are two calls to\n       the character data handler from within the inner \"for\" loop of\n       the XML_TOK_DATA_CHARS case in doContent(), and the character\n       handler must stop the parser and clear the character data\n       handler.\n    */\n    char *text = long_character_data_text;\n\n    XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);\n    resumable = XML_FALSE;\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR)\n        xml_failure(parser);\n    if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test for SF bug #1515266: missing check of stopped\n   parser in doContext() 'for' loop. */\nSTART_TEST(test_suspend_parser_between_char_data_calls)\n{\n    /* The sample data must be big enough that there are two calls to\n       the character data handler from within the inner \"for\" loop of\n       the XML_TOK_DATA_CHARS case in doContent(), and the character\n       handler must stop the parser and clear the character data\n       handler.\n    */\n    char *text = long_character_data_text;\n\n    XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);\n    resumable = XML_TRUE;\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED)\n        xml_failure(parser);\n    if (XML_GetErrorCode(parser) != XML_ERROR_NONE)\n        xml_failure(parser);\n}\nEND_TEST\n\n\n/*\n * Namespaces tests.\n */\n\nstatic void\nnamespace_setup(void)\n{\n    parser = XML_ParserCreateNS(NULL, ' ');\n    if (parser == NULL)\n        fail(\"Parser not created.\");\n}\n\nstatic void\nnamespace_teardown(void)\n{\n    basic_teardown();\n}\n\n/* Check that an element name and attribute name match the expected values.\n   The expected values are passed as an array reference of string pointers\n   provided as the userData argument; the first is the expected\n   element name, and the second is the expected attribute name.\n*/\nstatic void XMLCALL\ntriplet_start_checker(void *userData, const XML_Char *name,\n                      const XML_Char **atts)\n{\n    char **elemstr = (char **)userData;\n    char buffer[1024];\n    if (strcmp(elemstr[0], name) != 0) {\n        sprintf(buffer, \"unexpected start string: '%s'\", name);\n        fail(buffer);\n    }\n    if (strcmp(elemstr[1], atts[0]) != 0) {\n        sprintf(buffer, \"unexpected attribute string: '%s'\", atts[0]);\n        fail(buffer);\n    }\n}\n\n/* Check that the element name passed to the end-element handler matches\n   the expected value.  The expected value is passed as the first element\n   in an array of strings passed as the userData argument.\n*/\nstatic void XMLCALL\ntriplet_end_checker(void *userData, const XML_Char *name)\n{\n    char **elemstr = (char **)userData;\n    if (strcmp(elemstr[0], name) != 0) {\n        char buffer[1024];\n        sprintf(buffer, \"unexpected end string: '%s'\", name);\n        fail(buffer);\n    }\n}\n\nSTART_TEST(test_return_ns_triplet)\n{\n    char *text =\n        \"<foo:e xmlns:foo='http://expat.sf.net/' bar:a='12'\\n\"\n        \"       xmlns:bar='http://expat.sf.net/'></foo:e>\";\n    char *elemstr[] = {\n        \"http://expat.sf.net/ e foo\",\n        \"http://expat.sf.net/ a bar\"\n    };\n    XML_SetReturnNSTriplet(parser, XML_TRUE);\n    XML_SetUserData(parser, elemstr);\n    XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nstatic void XMLCALL\noverwrite_start_checker(void *userData, const XML_Char *name,\n                        const XML_Char **atts)\n{\n    CharData *storage = (CharData *) userData;\n    CharData_AppendString(storage, \"start \");\n    CharData_AppendXMLChars(storage, name, -1);\n    while (*atts != NULL) {\n        CharData_AppendString(storage, \"\\nattribute \");\n        CharData_AppendXMLChars(storage, *atts, -1);\n        atts += 2;\n    }\n    CharData_AppendString(storage, \"\\n\");\n}\n\nstatic void XMLCALL\noverwrite_end_checker(void *userData, const XML_Char *name)\n{\n    CharData *storage = (CharData *) userData;\n    CharData_AppendString(storage, \"end \");\n    CharData_AppendXMLChars(storage, name, -1);\n    CharData_AppendString(storage, \"\\n\");\n}\n\nstatic void\nrun_ns_tagname_overwrite_test(char *text, char *result)\n{\n    CharData storage;\n    CharData_Init(&storage);\n    XML_SetUserData(parser, &storage);\n    XML_SetElementHandler(parser,\n                          overwrite_start_checker, overwrite_end_checker);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n    CharData_CheckString(&storage, result);\n}\n\n/* Regression test for SF bug #566334. */\nSTART_TEST(test_ns_tagname_overwrite)\n{\n    char *text =\n        \"<n:e xmlns:n='http://xml.libexpat.org/'>\\n\"\n        \"  <n:f n:attr='foo'/>\\n\"\n        \"  <n:g n:attr2='bar'/>\\n\"\n        \"</n:e>\";\n    char *result =\n        \"start http://xml.libexpat.org/ e\\n\"\n        \"start http://xml.libexpat.org/ f\\n\"\n        \"attribute http://xml.libexpat.org/ attr\\n\"\n        \"end http://xml.libexpat.org/ f\\n\"\n        \"start http://xml.libexpat.org/ g\\n\"\n        \"attribute http://xml.libexpat.org/ attr2\\n\"\n        \"end http://xml.libexpat.org/ g\\n\"\n        \"end http://xml.libexpat.org/ e\\n\";\n    run_ns_tagname_overwrite_test(text, result);\n}\nEND_TEST\n\n/* Regression test for SF bug #566334. */\nSTART_TEST(test_ns_tagname_overwrite_triplet)\n{\n    char *text =\n        \"<n:e xmlns:n='http://xml.libexpat.org/'>\\n\"\n        \"  <n:f n:attr='foo'/>\\n\"\n        \"  <n:g n:attr2='bar'/>\\n\"\n        \"</n:e>\";\n    char *result =\n        \"start http://xml.libexpat.org/ e n\\n\"\n        \"start http://xml.libexpat.org/ f n\\n\"\n        \"attribute http://xml.libexpat.org/ attr n\\n\"\n        \"end http://xml.libexpat.org/ f n\\n\"\n        \"start http://xml.libexpat.org/ g n\\n\"\n        \"attribute http://xml.libexpat.org/ attr2 n\\n\"\n        \"end http://xml.libexpat.org/ g n\\n\"\n        \"end http://xml.libexpat.org/ e n\\n\";\n    XML_SetReturnNSTriplet(parser, XML_TRUE);\n    run_ns_tagname_overwrite_test(text, result);\n}\nEND_TEST\n\n\n/* Regression test for SF bug #620343. */\nstatic void XMLCALL\nstart_element_fail(void *userData,\n                   const XML_Char *name, const XML_Char **atts)\n{\n    /* We should never get here. */\n    fail(\"should never reach start_element_fail()\");\n}\n\nstatic void XMLCALL\nstart_ns_clearing_start_element(void *userData,\n                                const XML_Char *prefix,\n                                const XML_Char *uri)\n{\n    XML_SetStartElementHandler((XML_Parser) userData, NULL);\n}\n\nSTART_TEST(test_start_ns_clears_start_element)\n{\n    /* This needs to use separate start/end tags; using the empty tag\n       syntax doesn't cause the problematic path through Expat to be\n       taken.\n    */\n    char *text = \"<e xmlns='http://xml.libexpat.org/'></e>\";\n\n    XML_SetStartElementHandler(parser, start_element_fail);\n    XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element);\n    XML_UseParserAsHandlerArg(parser);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test for SF bug #616863. */\nstatic int XMLCALL\nexternal_entity_handler(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    intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser);\n    char *text;\n    XML_Parser p2;\n\n    if (callno == 1)\n        text = (\"<!ELEMENT doc (e+)>\\n\"\n                \"<!ATTLIST doc xmlns CDATA #IMPLIED>\\n\"\n                \"<!ELEMENT e EMPTY>\\n\");\n    else\n        text = (\"<?xml version='1.0' encoding='us-ascii'?>\"\n                \"<e/>\");\n\n    XML_SetUserData(parser, (void *) callno);\n    p2 = XML_ExternalEntityParserCreate(parser, context, NULL);\n    if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) {\n        xml_failure(p2);\n        return 0;\n    }\n    XML_ParserFree(p2);\n    return 1;\n}\n\nSTART_TEST(test_default_ns_from_ext_subset_and_ext_ge)\n{\n    char *text =\n        \"<?xml version='1.0'?>\\n\"\n        \"<!DOCTYPE doc SYSTEM 'http://xml.libexpat.org/doc.dtd' [\\n\"\n        \"  <!ENTITY en SYSTEM 'http://xml.libexpat.org/entity.ent'>\\n\"\n        \"]>\\n\"\n        \"<doc xmlns='http://xml.libexpat.org/ns1'>\\n\"\n        \"&en;\\n\"\n        \"</doc>\";\n\n    XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);\n    XML_SetExternalEntityRefHandler(parser, external_entity_handler);\n    /* We actually need to set this handler to tickle this bug. */\n    XML_SetStartElementHandler(parser, dummy_start_element);\n    XML_SetUserData(parser, NULL);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test #1 for SF bug #673791. */\nSTART_TEST(test_ns_prefix_with_empty_uri_1)\n{\n    char *text =\n        \"<doc xmlns:prefix='http://xml.libexpat.org/'>\\n\"\n        \"  <e xmlns:prefix=''/>\\n\"\n        \"</doc>\";\n\n    expect_failure(text,\n                   XML_ERROR_UNDECLARING_PREFIX,\n                   \"Did not report re-setting namespace\"\n                   \" URI with prefix to ''.\");\n}\nEND_TEST\n\n/* Regression test #2 for SF bug #673791. */\nSTART_TEST(test_ns_prefix_with_empty_uri_2)\n{\n    char *text =\n        \"<?xml version='1.0'?>\\n\"\n        \"<docelem xmlns:pre=''/>\";\n\n    expect_failure(text,\n                   XML_ERROR_UNDECLARING_PREFIX,\n                   \"Did not report setting namespace URI with prefix to ''.\");\n}\nEND_TEST\n\n/* Regression test #3 for SF bug #673791. */\nSTART_TEST(test_ns_prefix_with_empty_uri_3)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"  <!ELEMENT doc EMPTY>\\n\"\n        \"  <!ATTLIST doc\\n\"\n        \"    xmlns:prefix CDATA ''>\\n\"\n        \"]>\\n\"\n        \"<doc/>\";\n\n    expect_failure(text,\n                   XML_ERROR_UNDECLARING_PREFIX,\n                   \"Didn't report attr default setting NS w/ prefix to ''.\");\n}\nEND_TEST\n\n/* Regression test #4 for SF bug #673791. */\nSTART_TEST(test_ns_prefix_with_empty_uri_4)\n{\n    char *text =\n        \"<!DOCTYPE doc [\\n\"\n        \"  <!ELEMENT prefix:doc EMPTY>\\n\"\n        \"  <!ATTLIST prefix:doc\\n\"\n        \"    xmlns:prefix CDATA 'http://xml.libexpat.org/'>\\n\"\n        \"]>\\n\"\n        \"<prefix:doc/>\";\n    /* Packaged info expected by the end element handler;\n       the weird structuring lets us re-use the triplet_end_checker()\n       function also used for another test. */\n    char *elemstr[] = {\n        \"http://xml.libexpat.org/ doc prefix\"\n    };\n    XML_SetReturnNSTriplet(parser, XML_TRUE);\n    XML_SetUserData(parser, elemstr);\n    XML_SetEndElementHandler(parser, triplet_end_checker);\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\nSTART_TEST(test_ns_default_with_empty_uri)\n{\n    char *text =\n        \"<doc xmlns='http://xml.libexpat.org/'>\\n\"\n        \"  <e xmlns=''/>\\n\"\n        \"</doc>\";\n    if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)\n        xml_failure(parser);\n}\nEND_TEST\n\n/* Regression test for SF bug #692964: two prefixes for one namespace. */\nSTART_TEST(test_ns_duplicate_attrs_diff_prefixes)\n{\n    char *text =\n        \"<doc xmlns:a='http://xml.libexpat.org/a'\\n\"\n        \"     xmlns:b='http://xml.libexpat.org/a'\\n\"\n        \"     a:a='v' b:a='v' />\";\n    expect_failure(text,\n                   XML_ERROR_DUPLICATE_ATTRIBUTE,\n                   \"did not report multiple attributes with same URI+name\");\n}\nEND_TEST\n\n/* Regression test for SF bug #695401: unbound prefix. */\nSTART_TEST(test_ns_unbound_prefix_on_attribute)\n{\n    char *text = \"<doc a:attr=''/>\";\n    expect_failure(text,\n                   XML_ERROR_UNBOUND_PREFIX,\n                   \"did not report unbound prefix on attribute\");\n}\nEND_TEST\n\n/* Regression test for SF bug #695401: unbound prefix. */\nSTART_TEST(test_ns_unbound_prefix_on_element)\n{\n    char *text = \"<a:doc/>\";\n    expect_failure(text,\n                   XML_ERROR_UNBOUND_PREFIX,\n                   \"did not report unbound prefix on element\");\n}\nEND_TEST\n\nstatic Suite *\nmake_suite(void)\n{\n    Suite *s = suite_create(\"basic\");\n    TCase *tc_basic = tcase_create(\"basic tests\");\n    TCase *tc_namespace = tcase_create(\"XML namespaces\");\n\n    suite_add_tcase(s, tc_basic);\n    tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown);\n    tcase_add_test(tc_basic, test_nul_byte);\n    tcase_add_test(tc_basic, test_u0000_char);\n    tcase_add_test(tc_basic, test_bom_utf8);\n    tcase_add_test(tc_basic, test_bom_utf16_be);\n    tcase_add_test(tc_basic, test_bom_utf16_le);\n    tcase_add_test(tc_basic, test_illegal_utf8);\n    tcase_add_test(tc_basic, test_utf16);\n    tcase_add_test(tc_basic, test_utf16_le_epilog_newline);\n    tcase_add_test(tc_basic, test_latin1_umlauts);\n    /* Regression test for SF bug #491986. */\n    tcase_add_test(tc_basic, test_danish_latin1);\n    /* Regression test for SF bug #514281. */\n    tcase_add_test(tc_basic, test_french_charref_hexidecimal);\n    tcase_add_test(tc_basic, test_french_charref_decimal);\n    tcase_add_test(tc_basic, test_french_latin1);\n    tcase_add_test(tc_basic, test_french_utf8);\n    tcase_add_test(tc_basic, test_utf8_false_rejection);\n    tcase_add_test(tc_basic, test_line_number_after_parse);\n    tcase_add_test(tc_basic, test_column_number_after_parse);\n    tcase_add_test(tc_basic, test_line_and_column_numbers_inside_handlers);\n    tcase_add_test(tc_basic, test_line_number_after_error);\n    tcase_add_test(tc_basic, test_column_number_after_error);\n    tcase_add_test(tc_basic, test_really_long_lines);\n    tcase_add_test(tc_basic, test_end_element_events);\n    tcase_add_test(tc_basic, test_attr_whitespace_normalization);\n    tcase_add_test(tc_basic, test_xmldecl_misplaced);\n    tcase_add_test(tc_basic, test_unknown_encoding_internal_entity);\n    tcase_add_test(tc_basic,\n                   test_wfc_undeclared_entity_unread_external_subset);\n    tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset);\n    tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone);\n    tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset);\n    tcase_add_test(tc_basic,\n                   test_wfc_undeclared_entity_with_external_subset_standalone);\n    tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs);\n    tcase_add_test(tc_basic, test_ext_entity_set_encoding);\n    tcase_add_test(tc_basic, test_dtd_default_handling);\n    tcase_add_test(tc_basic, test_empty_ns_without_namespaces);\n    tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces);\n    tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls);\n    tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls);\n\n    suite_add_tcase(s, tc_namespace);\n    tcase_add_checked_fixture(tc_namespace,\n                              namespace_setup, namespace_teardown);\n    tcase_add_test(tc_namespace, test_return_ns_triplet);\n    tcase_add_test(tc_namespace, test_ns_tagname_overwrite);\n    tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet);\n    tcase_add_test(tc_namespace, test_start_ns_clears_start_element);\n    tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge);\n    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_1);\n    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2);\n    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3);\n    tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4);\n    tcase_add_test(tc_namespace, test_ns_default_with_empty_uri);\n    tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes);\n    tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute);\n    tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_element);\n\n    return s;\n}\n\n\nint\nmain(int argc, char *argv[])\n{\n    int i, nf;\n    int verbosity = CK_NORMAL;\n    Suite *s = make_suite();\n    SRunner *sr = srunner_create(s);\n\n    /* run the tests for internal helper functions */\n    testhelper_is_whitespace_normalized();\n\n    for (i = 1; i < argc; ++i) {\n        char *opt = argv[i];\n        if (strcmp(opt, \"-v\") == 0 || strcmp(opt, \"--verbose\") == 0)\n            verbosity = CK_VERBOSE;\n        else if (strcmp(opt, \"-q\") == 0 || strcmp(opt, \"--quiet\") == 0)\n            verbosity = CK_SILENT;\n        else {\n            fprintf(stderr, \"runtests: unknown option '%s'\\n\", opt);\n            return 2;\n        }\n    }\n    if (verbosity != CK_SILENT)\n        printf(\"Expat version: %s\\n\", XML_ExpatVersion());\n    srunner_run_all(sr, verbosity);\n    nf = srunner_ntests_failed(sr);\n    srunner_free(sr);\n\n    return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;\n}\n"},{"id":13510,"name":"xmltest.sh","nodeType":"TextFile","path":"cextern/expat/tests","text":"#! /bin/sh\n\n#   EXPAT TEST SCRIPT FOR W3C XML TEST SUITE\n\n# This script can be used to exercise Expat against the\n# w3c.org xml test suite, available from\n# http://www.w3.org/XML/Test/xmlts20020606.zip.\n\n# To run this script, first set XMLWF below so that xmlwf can be\n# found, then set the output directory with OUTPUT.\n\n# The script lists all test cases where Expat shows a discrepancy\n# from the expected result. Test cases where only the canonical\n# output differs are prefixed with \"Output differs:\", and a diff file\n# is generated in the appropriate subdirectory under $OUTPUT.\n\n# If there are output files provided, the script will use\n# output from xmlwf and compare the desired output against it.\n# However, one has to take into account that the canonical output\n# produced by xmlwf conforms to an older definition of canonical XML\n# and does not generate notation declarations.\n\nMYDIR=\"`dirname \\\"$0\\\"`\"\ncd \"$MYDIR\"\nMYDIR=\"`pwd`\"\nXMLWF=\"`dirname \\\"$MYDIR\\\"`/xmlwf/xmlwf\"\n# XMLWF=/usr/local/bin/xmlwf\nTS=\"$MYDIR/XML-Test-Suite\"\n# OUTPUT must terminate with the directory separator.\nOUTPUT=\"$TS/out/\"\n# OUTPUT=/home/tmp/xml-testsuite-out/\n\n\n# RunXmlwfNotWF file reldir\n# reldir includes trailing slash\nRunXmlwfNotWF() {\n  file=\"$1\"\n  reldir=\"$2\"\n  $XMLWF -p \"$file\" > outfile || return $?\n  read outdata < outfile\n  if test \"$outdata\" = \"\" ; then\n      echo \"Expected not well-formed: $reldir$file\"\n      return 1\n  else\n      return 0\n  fi \n}\n\n# RunXmlwfWF file reldir\n# reldir includes trailing slash\nRunXmlwfWF() {\n  file=\"$1\"\n  reldir=\"$2\"\n  $XMLWF -p -d \"$OUTPUT$reldir\" \"$file\" > outfile || return $?\n  read outdata < outfile \n  if test \"$outdata\" = \"\" ; then \n      if [ -f \"out/$file\" ] ; then \n          diff -u \"$OUTPUT$reldir$file\" \"out/$file\" > outfile \n          if [ -s outfile ] ; then \n              cp outfile \"$OUTPUT$reldir$file.diff\"\n              echo \"Output differs: $reldir$file\"\n              return 1\n          fi \n      fi \n      return 0\n  else \n      echo \"In $reldir: $outdata\"\n      return 1\n  fi \n}\n\nSUCCESS=0\nERROR=0\n\nUpdateStatus() {\n  if [ \"$1\" -eq 0 ] ; then\n    SUCCESS=`expr $SUCCESS + 1`\n  else\n    ERROR=`expr $ERROR + 1`\n  fi\n}\n\n##########################\n# well-formed test cases #\n##########################\n\ncd \"$TS/xmlconf\"\nfor xmldir in ibm/valid/P* \\\n              ibm/invalid/P* \\\n              xmltest/valid/ext-sa \\\n              xmltest/valid/not-sa \\\n              xmltest/invalid \\\n              xmltest/invalid/not-sa \\\n              xmltest/valid/sa \\\n              sun/valid \\\n              sun/invalid ; do\n  cd \"$TS/xmlconf/$xmldir\"\n  mkdir -p \"$OUTPUT$xmldir\"\n  for xmlfile in *.xml ; do\n      RunXmlwfWF \"$xmlfile\" \"$xmldir/\"\n      UpdateStatus $?\n  done\n  rm outfile\ndone\n\ncd \"$TS/xmlconf/oasis\"\nmkdir -p \"$OUTPUT\"oasis\nfor xmlfile in *pass*.xml ; do\n    RunXmlwfWF \"$xmlfile\" \"oasis/\"\n    UpdateStatus $?\ndone\nrm outfile\n\n##############################\n# not well-formed test cases #\n##############################\n\ncd \"$TS/xmlconf\"\nfor xmldir in ibm/not-wf/P* \\\n              ibm/not-wf/p28a \\\n              ibm/not-wf/misc \\\n              xmltest/not-wf/ext-sa \\\n              xmltest/not-wf/not-sa \\\n              xmltest/not-wf/sa \\\n              sun/not-wf ; do\n  cd \"$TS/xmlconf/$xmldir\"\n  for xmlfile in *.xml ; do\n      RunXmlwfNotWF \"$xmlfile\" \"$xmldir/\"\n      UpdateStatus $?\n  done\n  rm outfile\ndone\n\ncd \"$TS/xmlconf/oasis\"\nfor xmlfile in *fail*.xml ; do\n    RunXmlwfNotWF \"$xmlfile\" \"oasis/\"\n    UpdateStatus $?\ndone\nrm outfile\n\necho \"Passed: $SUCCESS\"\necho \"Failed: $ERROR\"\n"},{"id":13511,"name":"cextern/expat/tests/benchmark","nodeType":"Package"},{"id":13512,"name":"benchmark.dsp","nodeType":"TextFile","path":"cextern/expat/tests/benchmark","text":"# Microsoft Developer Studio Project File - Name=\"benchmark\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\nCFG=benchmark - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"benchmark.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"benchmark.mak\" CFG=\"benchmark - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"benchmark - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \"benchmark - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"benchmark - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release\"\n# PROP BASE Intermediate_Dir \"Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"Release\"\n# PROP Intermediate_Dir \"Release\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n# ADD CPP /nologo /W3 /GX /O2 /I \"..\\..\\lib\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n# ADD BASE RSC /l 0x1009 /d \"NDEBUG\"\n# ADD RSC /l 0x1009 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /machine:I386\n# ADD LINK32 libexpat.lib /nologo /subsystem:console /machine:I386 /libpath:\"..\\..\\win32\\bin\\Release\"\n\n!ELSEIF  \"$(CFG)\" == \"benchmark - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug\"\n# PROP BASE Intermediate_Dir \"Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"Debug\"\n# PROP Intermediate_Dir \"Debug\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I \"..\\..\\lib\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n# ADD BASE RSC /l 0x1009 /d \"_DEBUG\"\n# ADD RSC /l 0x1009 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n# ADD LINK32 libexpat.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:\"..\\..\\win32\\bin\\Debug\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"benchmark - Win32 Release\"\n# Name \"benchmark - Win32 Debug\"\n# Begin Source File\n\nSOURCE=.\\benchmark.c\n# End Source File\n# End Target\n# End Project\n"},{"attributeType":"null","col":32,"comment":"null","endLoc":490,"id":13513,"name":"_fl_spacing","nodeType":"Attribute","startLoc":490,"text":"self._fl_spacing"},{"id":13514,"name":"benchmark.dsw","nodeType":"TextFile","path":"cextern/expat/tests/benchmark","text":"Microsoft Developer Studio Workspace File, Format Version 6.00\n# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n###############################################################################\n\nProject: \"benchmark\"=.\\benchmark.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n    Begin Project Dependency\n    Project_Dep_Name expat\n    End Project Dependency\n}}}\n\n###############################################################################\n\nProject: \"expat\"=..\\..\\lib\\expat.dsp - Package Owner=<4>\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<4>\n{{{\n}}}\n\n###############################################################################\n\nGlobal:\n\nPackage=<5>\n{{{\n}}}\n\nPackage=<3>\n{{{\n}}}\n\n###############################################################################\n\n"},{"id":13515,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat/tests/benchmark","text":"Use this benchmark command line utility as follows:\n\n  benchmark [-n] <file name> <buffer size> <# iterations>\n\nThe command line arguments are:\n\n  -n             ... optional; if supplied, namespace processing is turned on\n  <file name>    ... name/path of test xml file\n  <buffer size>  ... size of processing buffer;\n                     the file is parsed in chunks of this size\n  <# iterations> ... how often will the file be parsed\n\nReturns:\n\n  The time (in seconds) it takes to parse the test file,\n  averaged over the number of iterations."},{"id":13516,"name":"cextern/expat/win32","nodeType":"Package"},{"id":13517,"name":"README.txt","nodeType":"TextFile","path":"cextern/expat/win32","text":"\nExpat can be built on Windows in three ways: \n  using MS Visual C++ (6.0 or .NET), Borland C++ Builder 5 or Cygwin.\n\n* Cygwin:\n  This follows the Unix build procedures.\n\n* C++ Builder 5:\n  Possible with make files in the BCB5 subdirectory.\n  Details can be found in the ReadMe file located there.\n\n* MS Visual C++ 6:\n  Based on the workspace file expat.dsw. The related project\n  files (.dsp) are located in the lib subdirectory.\n\n* MS Visual Studio .NET 2002, 2003, 2005, 2008, 2010:\n  The VC++ 6 workspace file (expat.dsw) and project files (.dsp)\n  can be opened and imported in VS.NET without problems.\n\n* All MS C/C++ compilers:\n  The output for all projects will be generated in the win32\\bin\n  directory, intermediate files will be located in project-specific\n  subdirectories of win32\\tmp.\n  \n* Creating MinGW dynamic libraries from MS VC++ DLLs:\n  \n  On the command line, execute these steps:\n  pexports libexpat.dll > expat.def\n  pexports libexpatw.dll > expatw.def\n  dlltool -d expat.def -l libexpat.a\n  dlltool -d expatw.def -l libexpatw.a\n  \n  The *.a files are mingw libraries.\n\n* Special note about MS VC++ and runtime libraries:\n\n  There are three possible configurations: using the\n  single threaded or multithreaded run-time library,\n  or using the multi-threaded run-time Dll. That is, \n  one can build three different Expat libraries depending\n  on the needs of the application.\n\n  Dynamic Linking:\n\n  By default the Expat Dlls are built to link statically\n  with the multi-threaded run-time library. \n  The libraries are named\n  - libexpat(w).dll \n  - libexpat(w).lib (import library)\n  The \"w\" indicates the UTF-16 version of the library.\n\n  One rarely uses other versions of the Dll, but they can\n  be built easily by specifying a different RTL linkage in\n  the IDE on the C/C++ tab under the category Code Generation.\n\n  Static Linking:\n\n  The libraries should be named like this:\n  Single-theaded:     libexpat(w)ML.lib\n  Multi-threaded:     libexpat(w)MT.lib\n  Multi-threaded Dll: libexpat(w)MD.lib\n  The suffixes conform to the compiler switch settings\n  /ML, /MT and /MD for MS VC++.\n  \n  Note: In Visual Studio 2005 (Visual C++ 8.0) and later, the\n  single-threaded runtime library is not supported anymore.\n\n  By default, the expat-static and expatw-static projects are set up\n  to link statically against the multithreaded run-time library,\n  so they will build libexpatMT.lib or libexpatwMT.lib files.\n\n  To build the other versions of the static library, \n  go to Project - Settings:\n  - specify a different RTL linkage on the C/C++ tab\n    under the category Code Generation.\n  - then, on the Library tab, change the output file name\n    accordingly, as described above\n\n  An application linking to the static libraries must\n  have the global macro XML_STATIC defined.\n"},{"id":13518,"name":"MANIFEST.txt","nodeType":"TextFile","path":"cextern/expat/win32","text":"                     Overview of the Expat distribution\n\nThe Expat distribution creates several subdirectories on your system.\nSome of these directories contain components of interest to all Expat\nusers, and some contain material of interest to developers who wish to\nuse Expat in their applications.  In the list below, <top> is the\ndirectory you specified to the installer.\n\n  Directory           Contents\n  ---------------------------------------------------------------------\n  <top>\\              Some general information files.\n\n  <top>\\Doc\\          API documentation for developers.\n\n  <top>\\Bin\\          Pre-compiled dynamic libraries for developers.\n                      Pre-compiled static libraries for developers (*MT.lib).\n                      The XML well-formedness checker xmlwf.\n\n  <top>\\Source\\       Source code, which may interest some developers,\n                      including a workspace for Microsft Visual C++.\n                      The source code includes the parser, the well-\n                      formedness checker, and a couple of small sample\n                      applications.\n\n  <top>\\Source\\bcb5\\  Project files for Borland C++ Builder 5 and BCC 5.5.\n\n\n"},{"id":13519,"name":"minicheck.c","nodeType":"TextFile","path":"cextern/expat/tests","text":"/* Miniature re-implementation of the \"check\" library.\n *\n * This is intended to support just enough of check to run the Expat\n * tests.  This interface is based entirely on the portion of the\n * check library being used.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <setjmp.h>\n#include <assert.h>\n\n#include \"minicheck.h\"\n\nSuite *\nsuite_create(char *name)\n{\n    Suite *suite = (Suite *) calloc(1, sizeof(Suite));\n    if (suite != NULL) {\n        suite->name = name;\n    }\n    return suite;\n}\n\nTCase *\ntcase_create(char *name)\n{\n    TCase *tc = (TCase *) calloc(1, sizeof(TCase));\n    if (tc != NULL) {\n        tc->name = name;\n    }\n    return tc;\n}\n\nvoid\nsuite_add_tcase(Suite *suite, TCase *tc) \n{\n    assert(suite != NULL);\n    assert(tc != NULL);\n    assert(tc->next_tcase == NULL);\n\n    tc->next_tcase = suite->tests;\n    suite->tests = tc;\n}\n\nvoid\ntcase_add_checked_fixture(TCase *tc,\n                          tcase_setup_function setup,\n                          tcase_teardown_function teardown)\n{\n    assert(tc != NULL);\n    tc->setup = setup;\n    tc->teardown = teardown;\n}\n\nvoid\ntcase_add_test(TCase *tc, tcase_test_function test)\n{\n    assert(tc != NULL);\n    if (tc->allocated == tc->ntests) {\n        int nalloc = tc->allocated + 100;\n        size_t new_size = sizeof(tcase_test_function) * nalloc;\n        tcase_test_function *new_tests = realloc(tc->tests, new_size);\n        assert(new_tests != NULL);\n        if (new_tests != tc->tests) {\n            free(tc->tests);\n            tc->tests = new_tests;\n        }\n        tc->allocated = nalloc;\n    }\n    tc->tests[tc->ntests] = test;\n    tc->ntests++;\n}\n\nSRunner *\nsrunner_create(Suite *suite)\n{\n    SRunner *runner = calloc(1, sizeof(SRunner));\n    if (runner != NULL) {\n        runner->suite = suite;\n    }\n    return runner;\n}\n\nstatic jmp_buf env;\n\nstatic char const *_check_current_function = NULL;\nstatic int _check_current_lineno = -1;\nstatic char const *_check_current_filename = NULL;\n\nvoid\n_check_set_test_info(char const *function, char const *filename, int lineno)\n{\n    _check_current_function = function;\n    _check_current_lineno = lineno;\n    _check_current_filename = filename;\n}\n\n\nstatic void\nadd_failure(SRunner *runner, int verbosity)\n{\n    runner->nfailures++;\n    if (verbosity >= CK_VERBOSE) {\n        printf(\"%s:%d: %s\\n\", _check_current_filename,\n               _check_current_lineno, _check_current_function);\n    }\n}\n\nvoid\nsrunner_run_all(SRunner *runner, int verbosity)\n{\n    Suite *suite;\n    TCase *tc;\n    assert(runner != NULL);\n    suite = runner->suite;\n    tc = suite->tests;\n    while (tc != NULL) {\n        int i;\n        for (i = 0; i < tc->ntests; ++i) {\n            runner->nchecks++;\n\n            if (tc->setup != NULL) {\n                /* setup */\n                if (setjmp(env)) {\n                    add_failure(runner, verbosity);\n                    continue;\n                }\n                tc->setup();\n            }\n            /* test */\n            if (setjmp(env)) {\n                add_failure(runner, verbosity);\n                continue;\n            }\n            (tc->tests[i])();\n\n            /* teardown */\n            if (tc->teardown != NULL) {\n                if (setjmp(env)) {\n                    add_failure(runner, verbosity);\n                    continue;\n                }\n                tc->teardown();\n            }\n        }\n        tc = tc->next_tcase;\n    }\n    if (verbosity) {\n        int passed = runner->nchecks - runner->nfailures;\n        double percentage = ((double) passed) / runner->nchecks;\n        int display = (int) (percentage * 100);\n        printf(\"%d%%: Checks: %d, Failed: %d\\n\",\n               display, runner->nchecks, runner->nfailures);\n    }\n}\n\nvoid\n_fail_unless(int condition, const char *file, int line, char *msg)\n{\n    /* Always print the error message so it isn't lost.  In this case,\n       we have a failure, so there's no reason to be quiet about what\n       it is.\n    */\n    if (msg != NULL)\n        printf(\"%s\", msg);\n    longjmp(env, 1);\n}\n\nint\nsrunner_ntests_failed(SRunner *runner)\n{\n    assert(runner != NULL);\n    return runner->nfailures;\n}\n\nvoid\nsrunner_free(SRunner *runner)\n{\n    free(runner->suite);\n    free(runner);\n}\n"},{"id":13520,"name":"minicheck.h","nodeType":"TextFile","path":"cextern/expat/tests","text":"/* Miniature re-implementation of the \"check\" library.\n *\n * This is intended to support just enough of check to run the Expat\n * tests.  This interface is based entirely on the portion of the\n * check library being used.\n *\n * This is *source* compatible, but not necessary *link* compatible.\n */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define CK_NOFORK 0\n#define CK_FORK   1\n\n#define CK_SILENT  0\n#define CK_NORMAL  1\n#define CK_VERBOSE 2\n\n/* Workaround for Microsoft's compiler and Tru64 Unix systems where the\n   C compiler has a working __func__, but the C++ compiler only has a \n   working __FUNCTION__.  This could be fixed in configure.in, but it's\n   not worth it right now. */\n#if defined (_MSC_VER) || (defined(__osf__) && defined(__cplusplus))\n#define __func__ __FUNCTION__\n#endif\n\n#define START_TEST(testname) static void testname(void) { \\\n    _check_set_test_info(__func__, __FILE__, __LINE__);   \\\n    {\n#define END_TEST } }\n\n#define fail(msg)  _fail_unless(0, __FILE__, __LINE__, msg)\n\ntypedef void (*tcase_setup_function)(void);\ntypedef void (*tcase_teardown_function)(void);\ntypedef void (*tcase_test_function)(void);\n\ntypedef struct SRunner SRunner;\ntypedef struct Suite Suite;\ntypedef struct TCase TCase;\n\nstruct SRunner {\n    Suite *suite;\n    int nchecks;\n    int nfailures;\n};\n\nstruct Suite {\n    char *name;\n    TCase *tests;\n};\n\nstruct TCase {\n    char *name;\n    tcase_setup_function setup;\n    tcase_teardown_function teardown;\n    tcase_test_function *tests;\n    int ntests;\n    int allocated;\n    TCase *next_tcase;\n};\n\n\n/* Internal helper. */\nvoid _check_set_test_info(char const *function,\n                          char const *filename, int lineno);\n\n\n/*\n * Prototypes for the actual implementation.\n */\n\nvoid _fail_unless(int condition, const char *file, int line, char *msg);\nSuite *suite_create(char *name);\nTCase *tcase_create(char *name);\nvoid suite_add_tcase(Suite *suite, TCase *tc);\nvoid tcase_add_checked_fixture(TCase *,\n                               tcase_setup_function,\n                               tcase_teardown_function);\nvoid tcase_add_test(TCase *tc, tcase_test_function test);\nSRunner *srunner_create(Suite *suite);\nvoid srunner_run_all(SRunner *runner, int verbosity);\nint srunner_ntests_failed(SRunner *runner);\nvoid srunner_free(SRunner *runner);\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":13521,"name":"benchmark.c","nodeType":"TextFile","path":"cextern/expat/tests/benchmark","text":"#include <sys/stat.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <time.h>\n#include \"expat.h\"\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n#ifdef XML_LARGE_SIZE\n#define XML_FMT_INT_MOD \"ll\"\n#else\n#define XML_FMT_INT_MOD \"l\"\n#endif\n\nstatic void\nusage(const char *prog, int rc)\n{\n  fprintf(stderr,\n          \"usage: %s [-n] filename bufferSize nr_of_loops\\n\", prog);\n  exit(rc);\n}\n\nint main (int argc, char *argv[]) \n{\n  XML_Parser  parser;\n  char        *XMLBuf, *XMLBufEnd, *XMLBufPtr;\n  FILE        *fd;\n  struct stat fileAttr;\n  int         nrOfLoops, bufferSize, fileSize, i, isFinal;\n  int         j = 0, ns = 0;\n  clock_t     tstart, tend;\n  double      cpuTime = 0.0;\n\n  if (argc > 1) {\n    if (argv[1][0] == '-') {\n      if (argv[1][1] == 'n' && argv[1][2] == '\\0') {\n        ns = 1;\n        j = 1;\n      }\n      else\n        usage(argv[0], 1);\n    }\n  }\n\n  if (argc != j + 4)\n    usage(argv[0], 1);\n\n  if (stat (argv[j + 1], &fileAttr) != 0) {\n    fprintf (stderr, \"could not access file '%s'\\n\", argv[j + 1]);\n    return 2;\n  }\n  \n  fd = fopen (argv[j + 1], \"r\");\n  if (!fd) {\n    fprintf (stderr, \"could not open file '%s'\\n\", argv[j + 1]);\n    exit(2);\n  }\n  \n  bufferSize = atoi (argv[j + 2]);\n  nrOfLoops = atoi (argv[j + 3]);\n  if (bufferSize <= 0 || nrOfLoops <= 0) {\n    fprintf (stderr, \n             \"buffer size and nr of loops must be greater than zero.\\n\");\n    exit(3);\n  }\n\n  XMLBuf = malloc (fileAttr.st_size);\n  fileSize = fread (XMLBuf, sizeof (char), fileAttr.st_size, fd);\n  fclose (fd);\n  \n  if (ns)\n    parser = XML_ParserCreateNS(NULL, '!');\n  else\n    parser = XML_ParserCreate(NULL);\n\n  i = 0;\n  XMLBufEnd = XMLBuf + fileSize;\n  while (i < nrOfLoops) {\n    XMLBufPtr = XMLBuf;\n    isFinal = 0;\n    tstart = clock();\n    do {\n      int parseBufferSize = XMLBufEnd - XMLBufPtr;\n      if (parseBufferSize <= bufferSize)\n        isFinal = 1;\n      else\n        parseBufferSize = bufferSize;\n      if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) {\n        fprintf (stderr, \"error '%s' at line %\" XML_FMT_INT_MOD \\\n                     \"u character %\" XML_FMT_INT_MOD \"u\\n\",\n                 XML_ErrorString (XML_GetErrorCode (parser)),\n                 XML_GetCurrentLineNumber (parser),\n                 XML_GetCurrentColumnNumber (parser));\n        free (XMLBuf);\n        XML_ParserFree (parser);\n        exit (4);\n      }\n      XMLBufPtr += bufferSize;\n    } while (!isFinal);\n    tend = clock();\n    cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC;\n    XML_ParserReset(parser, NULL);\n    i++;\n  }\n\n  XML_ParserFree (parser);\n  free (XMLBuf);\n      \n  printf (\"%d loops, with buffer size %d. Average time per loop: %f\\n\", \n          nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops);\n  return 0;\n}\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":180,"id":13522,"name":"_formatter_locator","nodeType":"Attribute","startLoc":180,"text":"self._formatter_locator"},{"attributeType":"null","col":12,"comment":"null","endLoc":777,"id":13523,"name":"_grid","nodeType":"Attribute","startLoc":777,"text":"self._grid"},{"id":13524,"name":"cextern/expat/xmlwf","nodeType":"Package"},{"id":13525,"name":"xmlfile.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#define XML_MAP_FILE 01\n#define XML_EXTERNAL_ENTITIES 02\n\n#ifdef XML_LARGE_SIZE\n#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400\n#define XML_FMT_INT_MOD \"I64\"\n#else\n#define XML_FMT_INT_MOD \"ll\"\n#endif\n#else\n#define XML_FMT_INT_MOD \"l\"\n#endif\n\nextern int XML_ProcessFile(XML_Parser parser,\n                           const XML_Char *filename,\n                           unsigned flags);\n"},{"id":13526,"name":"xmlmime.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Registered charset names are at most 40 characters long. */\n\n#define CHARSET_MAX 41\n\n/* Figure out the charset to use from the ContentType.\n   buf contains the body of the header field (the part after \"Content-Type:\").\n   charset gets the charset to use.  It must be at least CHARSET_MAX chars\n   long.  charset will be empty if the default charset should be used.\n*/\n\nvoid getXMLCharset(const char *buf, char *charset);\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":13527,"name":"codepage.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include \"codepage.h\"\n\n#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))\n#define STRICT 1\n#define WIN32_LEAN_AND_MEAN 1\n\n#include <windows.h>\n\nint\ncodepageMap(int cp, int *map)\n{\n  int i;\n  CPINFO info;\n  if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2)\n    return 0;\n  for (i = 0; i < 256; i++)\n    map[i] = -1;\n  if (info.MaxCharSize > 1) {\n    for (i = 0; i < MAX_LEADBYTES; i+=2) {\n      int j, lim;\n      if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)\n        break;\n      lim = info.LeadByte[i + 1];\n      for (j = info.LeadByte[i]; j <= lim; j++)\n        map[j] = -2;\n    }\n  }\n  for (i = 0; i < 256; i++) {\n   if (map[i] == -1) {\n     char c = (char)i;\n     unsigned short n;\n     if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,\n                             &c, 1, &n, 1) == 1)\n       map[i] = n;\n   }\n  }\n  return 1;\n}\n\nint\ncodepageConvert(int cp, const char *p)\n{\n  unsigned short c;\n  if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,\n                          p, 2, &c, 1) == 1)\n    return c;\n  return -1;\n}\n\n#else /* not WIN32 */\n\nint\ncodepageMap(int cp, int *map)\n{\n  return 0;\n}\n\nint\ncodepageConvert(int cp, const char *p)\n{\n  return -1;\n}\n\n#endif /* not WIN32 */\n"},{"id":13528,"name":"codepage.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\nint codepageMap(int cp, int *map);\nint codepageConvert(int cp, const char *p);\n"},{"id":13529,"name":"xmlmime.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#include <string.h>\n#include \"xmlmime.h\"\n\nstatic const char *\ngetTok(const char **pp)\n{\n  /* inComment means one level of nesting; inComment+1 means two levels etc */\n  enum { inAtom, inString, init, inComment };\n  int state = init;\n  const char *tokStart = 0;\n  for (;;) {\n    switch (**pp) {\n    case '\\0':\n      if (state == inAtom)\n        return tokStart;\n      return 0;\n    case ' ':\n    case '\\r':\n    case '\\t':\n    case '\\n':\n      if (state == inAtom)\n        return tokStart;\n      break;\n    case '(':\n      if (state == inAtom)\n        return tokStart;\n      if (state != inString)\n        state++;\n      break;\n    case ')':\n      if (state > init)\n        --state;\n      else if (state != inString)\n        return 0;\n      break;\n    case ';':\n    case '/':\n    case '=':\n      if (state == inAtom)\n        return tokStart;\n      if (state == init)\n        return (*pp)++;\n      break;\n    case '\\\\':\n      ++*pp;\n      if (**pp == '\\0')\n        return 0;\n      break;\n    case '\"':\n      switch (state) {\n      case inString:\n        ++*pp;\n        return tokStart;\n      case inAtom:\n        return tokStart;\n      case init:\n        tokStart = *pp;\n        state = inString;\n        break;\n      }\n      break;\n    default:\n      if (state == init) {\n        tokStart = *pp;\n        state = inAtom;\n      }\n      break;\n    }\n    ++*pp;\n  }\n  /* not reached */\n}\n\n/* key must be lowercase ASCII */\n\nstatic int\nmatchkey(const char *start, const char *end, const char *key)\n{\n  if (!start)\n    return 0;\n  for (; start != end; start++, key++)\n    if (*start != *key && *start != 'A' + (*key - 'a'))\n      return 0;\n  return *key == '\\0';\n}\n\nvoid\ngetXMLCharset(const char *buf, char *charset)\n{\n  const char *next, *p;\n\n  charset[0] = '\\0';\n  next = buf;\n  p = getTok(&next);\n  if (matchkey(p, next, \"text\"))\n    strcpy(charset, \"us-ascii\");\n  else if (!matchkey(p, next, \"application\"))\n    return;\n  p = getTok(&next);\n  if (!p || *p != '/')\n    return;\n  p = getTok(&next);\n#if 0\n  if (!matchkey(p, next, \"xml\") && charset[0] == '\\0')\n    return;\n#endif\n  p = getTok(&next);\n  while (p) {\n    if (*p == ';') {\n      p = getTok(&next);\n      if (matchkey(p, next, \"charset\")) {\n        p = getTok(&next);\n        if (p && *p == '=') {\n          p = getTok(&next);\n          if (p) {\n            char *s = charset;\n            if (*p == '\"') {\n              while (++p != next - 1) {\n                if (*p == '\\\\')\n                  ++p;\n                if (s == charset + CHARSET_MAX - 1) {\n                  charset[0] = '\\0';\n                  break;\n                }\n                *s++ = *p;\n              }\n              *s++ = '\\0';\n            }\n            else {\n              if (next - p > CHARSET_MAX - 1)\n                break;\n              while (p != next)\n                *s++ = *p++;\n              *s = 0;\n              break;\n            }\n          }\n        }\n        break;\n      }\n    }\n  else\n    p = getTok(&next);\n  }\n}\n\n#ifdef TEST\n\n#include <stdio.h>\n\nint\nmain(int argc, char *argv[])\n{\n  char buf[CHARSET_MAX];\n  if (argc <= 1)\n    return 1;\n  printf(\"%s\\n\", argv[1]);\n  getXMLCharset(argv[1], buf);\n  printf(\"charset=\\\"%s\\\"\\n\", buf);\n  return 0;\n}\n\n#endif /* TEST */\n"},{"id":13530,"name":"unixfilemap.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <sys/types.h>\n#include <sys/mman.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <errno.h>\n#include <string.h>\n#include <stdio.h>\n#include <unistd.h>\n\n#ifndef MAP_FILE\n#define MAP_FILE 0\n#endif\n\n#include \"filemap.h\"\n\nint\nfilemap(const char *name,\n        void (*processor)(const void *, size_t, const char *, void *arg),\n        void *arg)\n{\n  int fd;\n  size_t nbytes;\n  struct stat sb;\n  void *p;\n\n  fd = open(name, O_RDONLY);\n  if (fd < 0) {\n    perror(name);\n    return 0;\n  }\n  if (fstat(fd, &sb) < 0) {\n    perror(name);\n    close(fd);\n    return 0;\n  }\n  if (!S_ISREG(sb.st_mode)) {\n    close(fd);\n    fprintf(stderr, \"%s: not a regular file\\n\", name);\n    return 0;\n  }\n\n  nbytes = sb.st_size;\n  /* mmap fails for zero length files */\n  if (nbytes == 0) {\n    static const char c = '\\0';\n    processor(&c, 0, name, arg);\n    close(fd);\n    return 1;\n  }\n  p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,\n                   MAP_FILE|MAP_PRIVATE, fd, (off_t)0);\n  if (p == (void *)-1) {\n    perror(name);\n    close(fd);\n    return 0;\n  }\n  processor(p, nbytes, name, arg);\n  munmap((caddr_t)p, nbytes);\n  close(fd);\n  return 1;\n}\n"},{"id":13531,"name":"xmlurl.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nint XML_URLInit();\nvoid XML_URLUninit();\nint XML_ProcessURL(XML_Parser parser,\n                   const XML_Char *url,\n                   unsigned flags);\n\n#ifdef __cplusplus\n}\n#endif\n"},{"id":13532,"name":"xmlfile.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <string.h>\n#include <fcntl.h>\n\n#ifdef COMPILED_FROM_DSP\n#include \"winconfig.h\"\n#elif defined(MACOS_CLASSIC)\n#include \"macconfig.h\"\n#elif defined(__amigaos__)\n#include \"amigaconfig.h\"\n#elif defined(__WATCOMC__)\n#include \"watcomconfig.h\"\n#elif defined(HAVE_EXPAT_CONFIG_H)\n#include <expat_config.h>\n#endif /* ndef COMPILED_FROM_DSP */\n\n#include \"expat.h\"\n#include \"xmlfile.h\"\n#include \"xmltchar.h\"\n#include \"filemap.h\"\n\n#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__)))\n#include <io.h>\n#endif\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n#ifdef HAVE_UNISTD_H\n#include <unistd.h>\n#endif\n\n#ifndef O_BINARY\n#ifdef _O_BINARY\n#define O_BINARY _O_BINARY\n#else\n#define O_BINARY 0\n#endif\n#endif\n\n#ifdef _DEBUG\n#define READ_SIZE 16\n#else\n#define READ_SIZE (1024*8)\n#endif\n\n\ntypedef struct {\n  XML_Parser parser;\n  int *retPtr;\n} PROCESS_ARGS;\n\nstatic void\nreportError(XML_Parser parser, const XML_Char *filename)\n{\n  enum XML_Error code = XML_GetErrorCode(parser);\n  const XML_Char *message = XML_ErrorString(code);\n  if (message)\n    ftprintf(stdout, T(\"%s:%\" XML_FMT_INT_MOD \"u:%\" XML_FMT_INT_MOD \"u: %s\\n\"),\n             filename,\n             XML_GetErrorLineNumber(parser),\n             XML_GetErrorColumnNumber(parser),\n             message);\n  else\n    ftprintf(stderr, T(\"%s: (unknown message %d)\\n\"), filename, code);\n}\n \n/* This implementation will give problems on files larger than INT_MAX. */\nstatic void\nprocessFile(const void *data, size_t size,\n            const XML_Char *filename, void *args)\n{\n  XML_Parser parser = ((PROCESS_ARGS *)args)->parser;\n  int *retPtr = ((PROCESS_ARGS *)args)->retPtr;\n  if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) {\n    reportError(parser, filename);\n    *retPtr = 0;\n  }\n  else\n    *retPtr = 1;\n}\n\n#if (defined(WIN32) || defined(__WATCOMC__))\n\nstatic int\nisAsciiLetter(XML_Char c)\n{\n  return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));\n}\n\n#endif /* WIN32 */\n\nstatic const XML_Char *\nresolveSystemId(const XML_Char *base, const XML_Char *systemId,\n                XML_Char **toFree)\n{\n  XML_Char *s;\n  *toFree = 0;\n  if (!base\n      || *systemId == T('/')\n#if (defined(WIN32) || defined(__WATCOMC__))\n      || *systemId == T('\\\\')\n      || (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))\n#endif\n     )\n    return systemId;\n  *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)\n                               * sizeof(XML_Char));\n  if (!*toFree)\n    return systemId;\n  tcscpy(*toFree, base);\n  s = *toFree;\n  if (tcsrchr(s, T('/')))\n    s = tcsrchr(s, T('/')) + 1;\n#if (defined(WIN32) || defined(__WATCOMC__))\n  if (tcsrchr(s, T('\\\\')))\n    s = tcsrchr(s, T('\\\\')) + 1;\n#endif\n  tcscpy(s, systemId);\n  return *toFree;\n}\n\nstatic int\nexternalEntityRefFilemap(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  int result;\n  XML_Char *s;\n  const XML_Char *filename;\n  XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);\n  PROCESS_ARGS args;\n  args.retPtr = &result;\n  args.parser = entParser;\n  filename = resolveSystemId(base, systemId, &s);\n  XML_SetBase(entParser, filename);\n  if (!filemap(filename, processFile, &args))\n    result = 0;\n  free(s);\n  XML_ParserFree(entParser);\n  return result;\n}\n\nstatic int\nprocessStream(const XML_Char *filename, XML_Parser parser)\n{\n  /* passing NULL for filename means read intput from stdin */\n  int fd = 0;   /* 0 is the fileno for stdin */\n\n  if (filename != NULL) {\n    fd = topen(filename, O_BINARY|O_RDONLY);\n    if (fd < 0) {\n      tperror(filename);\n      return 0;\n    }\n  }\n  for (;;) {\n    int nread;\n    char *buf = (char *)XML_GetBuffer(parser, READ_SIZE);\n    if (!buf) {\n      if (filename != NULL)\n        close(fd);\n      ftprintf(stderr, T(\"%s: out of memory\\n\"),\n               filename != NULL ? filename : \"xmlwf\");\n      return 0;\n    }\n    nread = read(fd, buf, READ_SIZE);\n    if (nread < 0) {\n      tperror(filename != NULL ? filename : \"STDIN\");\n      if (filename != NULL)\n        close(fd);\n      return 0;\n    }\n    if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) {\n      reportError(parser, filename != NULL ? filename : \"STDIN\");\n      if (filename != NULL)\n        close(fd);\n      return 0;\n    }\n    if (nread == 0) {\n      if (filename != NULL)\n        close(fd);\n      break;;\n    }\n  }\n  return 1;\n}\n\nstatic int\nexternalEntityRefStream(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  XML_Char *s;\n  const XML_Char *filename;\n  int ret;\n  XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);\n  filename = resolveSystemId(base, systemId, &s);\n  XML_SetBase(entParser, filename);\n  ret = processStream(filename, entParser);\n  free(s);\n  XML_ParserFree(entParser);\n  return ret;\n}\n\nint\nXML_ProcessFile(XML_Parser parser,\n                const XML_Char *filename,\n                unsigned flags)\n{\n  int result;\n\n  if (!XML_SetBase(parser, filename)) {\n    ftprintf(stderr, T(\"%s: out of memory\"), filename);\n    exit(1);\n  }\n\n  if (flags & XML_EXTERNAL_ENTITIES)\n      XML_SetExternalEntityRefHandler(parser,\n                                      (flags & XML_MAP_FILE)\n                                      ? externalEntityRefFilemap\n                                      : externalEntityRefStream);\n  if (flags & XML_MAP_FILE) {\n    PROCESS_ARGS args;\n    args.retPtr = &result;\n    args.parser = parser;\n    if (!filemap(filename, processFile, &args))\n      result = 0;\n  }\n  else\n    result = processStream(filename, parser);\n  return result;\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":87,"id":13533,"name":"minor_frequency","nodeType":"Attribute","startLoc":87,"text":"self.minor_frequency"},{"id":13534,"name":"win32filemap.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#define STRICT 1\n#define WIN32_LEAN_AND_MEAN 1\n\n#ifdef XML_UNICODE_WCHAR_T\n#ifndef XML_UNICODE\n#define XML_UNICODE\n#endif\n#endif\n\n#ifdef XML_UNICODE\n#define UNICODE\n#define _UNICODE\n#endif /* XML_UNICODE */\n#include <windows.h>\n#include <stdio.h>\n#include <tchar.h>\n#include \"filemap.h\"\n\nstatic void win32perror(const TCHAR *);\n\nint\nfilemap(const TCHAR *name,\n        void (*processor)(const void *, size_t, const TCHAR *, void *arg),\n        void *arg)\n{\n  HANDLE f;\n  HANDLE m;\n  DWORD size;\n  DWORD sizeHi;\n  void *p;\n\n  f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,\n                          FILE_FLAG_SEQUENTIAL_SCAN, NULL);\n  if (f == INVALID_HANDLE_VALUE) {\n    win32perror(name);\n    return 0;\n  }\n  size = GetFileSize(f, &sizeHi);\n  if (size == (DWORD)-1) {\n    win32perror(name);\n    return 0;\n  }\n  if (sizeHi) {\n    _ftprintf(stderr, _T(\"%s: bigger than 2Gb\\n\"), name);\n    return 0;\n  }\n  /* CreateFileMapping barfs on zero length files */\n  if (size == 0) {\n    static const char c = '\\0';\n    processor(&c, 0, name, arg);\n    CloseHandle(f);\n    return 1;\n  }\n  m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL);\n  if (m == NULL) {\n    win32perror(name);\n    CloseHandle(f);\n    return 0;\n  }\n  p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0);\n  if (p == NULL) {\n    win32perror(name);\n    CloseHandle(m);\n    CloseHandle(f);\n    return 0;\n  }\n  processor(p, size, name, arg); \n  UnmapViewOfFile(p);\n  CloseHandle(m);\n  CloseHandle(f);\n  return 1;\n}\n\nstatic void\nwin32perror(const TCHAR *s)\n{\n  LPVOID buf;\n  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER\n                    | FORMAT_MESSAGE_FROM_SYSTEM,\n                    NULL,\n                    GetLastError(),\n                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n                    (LPTSTR) &buf,\n                    0,\n                    NULL)) {\n    _ftprintf(stderr, _T(\"%s: %s\"), s, buf);\n    fflush(stderr);\n    LocalFree(buf);\n  }\n  else\n    _ftprintf(stderr, _T(\"%s: unknown Windows error\\n\"), s);\n}\n"},{"id":13535,"name":"readfilemap.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#ifdef __WATCOMC__\n#ifndef __LINUX__\n#include <io.h>\n#else\n#include <unistd.h>\n#endif\n#endif\n\n#ifdef __BEOS__\n#include <unistd.h>\n#endif\n\n#ifndef S_ISREG\n#ifndef S_IFREG\n#define S_IFREG _S_IFREG\n#endif\n#ifndef S_IFMT\n#define S_IFMT _S_IFMT\n#endif\n#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)\n#endif /* not S_ISREG */\n\n#ifndef O_BINARY\n#ifdef _O_BINARY\n#define O_BINARY _O_BINARY\n#else\n#define O_BINARY 0\n#endif\n#endif\n\n#include \"filemap.h\"\n\nint\nfilemap(const char *name,\n        void (*processor)(const void *, size_t, const char *, void *arg),\n        void *arg)\n{\n  size_t nbytes;\n  int fd;\n  int n;\n  struct stat sb;\n  void *p;\n\n  fd = open(name, O_RDONLY|O_BINARY);\n  if (fd < 0) {\n    perror(name);\n    return 0;\n  }\n  if (fstat(fd, &sb) < 0) {\n    perror(name);\n    close(fd);\n    return 0;\n  }\n  if (!S_ISREG(sb.st_mode)) {\n    fprintf(stderr, \"%s: not a regular file\\n\", name);\n    close(fd);\n    return 0;\n  }\n  nbytes = sb.st_size;\n  /* malloc will return NULL with nbytes == 0, handle files with size 0 */\n  if (nbytes == 0) {\n    static const char c = '\\0';\n    processor(&c, 0, name, arg);\n    close(fd);\n    return 1;\n  }\n  p = malloc(nbytes);\n  if (!p) {\n    fprintf(stderr, \"%s: out of memory\\n\", name);\n    close(fd);\n    return 0;\n  }\n  n = read(fd, p, nbytes);\n  if (n < 0) {\n    perror(name);\n    free(p);\n    close(fd);\n    return 0;\n  }\n  if (n != nbytes) {\n    fprintf(stderr, \"%s: read unexpected number of bytes\\n\", name);\n    free(p);\n    close(fd);\n    return 0;\n  }\n  processor(p, nbytes, name, arg);\n  free(p);\n  close(fd);\n  return 1;\n}\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":70,"id":13536,"name":"transform","nodeType":"Attribute","startLoc":70,"text":"self.transform"},{"attributeType":"null","col":8,"comment":"null","endLoc":167,"id":13537,"name":"coord_type","nodeType":"Attribute","startLoc":167,"text":"self.coord_type"},{"id":13538,"name":"xmlwf.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <string.h>\n\n#include \"expat.h\"\n#include \"codepage.h\"\n#include \"xmlfile.h\"\n#include \"xmltchar.h\"\n\n#ifdef _MSC_VER\n#include <crtdbg.h>\n#endif\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n/* This ensures proper sorting. */\n\n#define NSSEP T('\\001')\n\nstatic void XMLCALL\ncharacterData(void *userData, const XML_Char *s, int len)\n{\n  FILE *fp = (FILE *)userData;\n  for (; len > 0; --len, ++s) {\n    switch (*s) {\n    case T('&'):\n      fputts(T(\"&amp;\"), fp);\n      break;\n    case T('<'):\n      fputts(T(\"&lt;\"), fp);\n      break;\n    case T('>'):\n      fputts(T(\"&gt;\"), fp);\n      break;\n#ifdef W3C14N\n    case 13:\n      fputts(T(\"&#xD;\"), fp);\n      break;\n#else\n    case T('\"'):\n      fputts(T(\"&quot;\"), fp);\n      break;\n    case 9:\n    case 10:\n    case 13:\n      ftprintf(fp, T(\"&#%d;\"), *s);\n      break;\n#endif\n    default:\n      puttc(*s, fp);\n      break;\n    }\n  }\n}\n\nstatic void\nattributeValue(FILE *fp, const XML_Char *s)\n{\n  puttc(T('='), fp);\n  puttc(T('\"'), fp);\n  for (;;) {\n    switch (*s) {\n    case 0:\n    case NSSEP:\n      puttc(T('\"'), fp);\n      return;\n    case T('&'):\n      fputts(T(\"&amp;\"), fp);\n      break;\n    case T('<'):\n      fputts(T(\"&lt;\"), fp);\n      break;\n    case T('\"'):\n      fputts(T(\"&quot;\"), fp);\n      break;\n#ifdef W3C14N\n    case 9:\n      fputts(T(\"&#x9;\"), fp);\n      break;\n    case 10:\n      fputts(T(\"&#xA;\"), fp);\n      break;\n    case 13:\n      fputts(T(\"&#xD;\"), fp);\n      break;\n#else\n    case T('>'):\n      fputts(T(\"&gt;\"), fp);\n      break;\n    case 9:\n    case 10:\n    case 13:\n      ftprintf(fp, T(\"&#%d;\"), *s);\n      break;\n#endif\n    default:\n      puttc(*s, fp);\n      break;\n    }\n    s++;\n  }\n}\n\n/* Lexicographically comparing UTF-8 encoded attribute values,\nis equivalent to lexicographically comparing based on the character number. */\n\nstatic int\nattcmp(const void *att1, const void *att2)\n{\n  return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);\n}\n\nstatic void XMLCALL\nstartElement(void *userData, const XML_Char *name, const XML_Char **atts)\n{\n  int nAtts;\n  const XML_Char **p;\n  FILE *fp = (FILE *)userData;\n  puttc(T('<'), fp);\n  fputts(name, fp);\n\n  p = atts;\n  while (*p)\n    ++p;\n  nAtts = (int)((p - atts) >> 1);\n  if (nAtts > 1)\n    qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp);\n  while (*atts) {\n    puttc(T(' '), fp);\n    fputts(*atts++, fp);\n    attributeValue(fp, *atts);\n    atts++;\n  }\n  puttc(T('>'), fp);\n}\n\nstatic void XMLCALL\nendElement(void *userData, const XML_Char *name)\n{\n  FILE *fp = (FILE *)userData;\n  puttc(T('<'), fp);\n  puttc(T('/'), fp);\n  fputts(name, fp);\n  puttc(T('>'), fp);\n}\n\nstatic int\nnsattcmp(const void *p1, const void *p2)\n{\n  const XML_Char *att1 = *(const XML_Char **)p1;\n  const XML_Char *att2 = *(const XML_Char **)p2;\n  int sep1 = (tcsrchr(att1, NSSEP) != 0);\n  int sep2 = (tcsrchr(att1, NSSEP) != 0);\n  if (sep1 != sep2)\n    return sep1 - sep2;\n  return tcscmp(att1, att2);\n}\n\nstatic void XMLCALL\nstartElementNS(void *userData, const XML_Char *name, const XML_Char **atts)\n{\n  int nAtts;\n  int nsi;\n  const XML_Char **p;\n  FILE *fp = (FILE *)userData;\n  const XML_Char *sep;\n  puttc(T('<'), fp);\n\n  sep = tcsrchr(name, NSSEP);\n  if (sep) {\n    fputts(T(\"n1:\"), fp);\n    fputts(sep + 1, fp);\n    fputts(T(\" xmlns:n1\"), fp);\n    attributeValue(fp, name);\n    nsi = 2;\n  }\n  else {\n    fputts(name, fp);\n    nsi = 1;\n  }\n\n  p = atts;\n  while (*p)\n    ++p;\n  nAtts = (int)((p - atts) >> 1);\n  if (nAtts > 1)\n    qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp);\n  while (*atts) {\n    name = *atts++;\n    sep = tcsrchr(name, NSSEP);\n    puttc(T(' '), fp);\n    if (sep) {\n      ftprintf(fp, T(\"n%d:\"), nsi);\n      fputts(sep + 1, fp);\n    }\n    else\n      fputts(name, fp);\n    attributeValue(fp, *atts);\n    if (sep) {\n      ftprintf(fp, T(\" xmlns:n%d\"), nsi++);\n      attributeValue(fp, name);\n    }\n    atts++;\n  }\n  puttc(T('>'), fp);\n}\n\nstatic void XMLCALL\nendElementNS(void *userData, const XML_Char *name)\n{\n  FILE *fp = (FILE *)userData;\n  const XML_Char *sep;\n  puttc(T('<'), fp);\n  puttc(T('/'), fp);\n  sep = tcsrchr(name, NSSEP);\n  if (sep) {\n    fputts(T(\"n1:\"), fp);\n    fputts(sep + 1, fp);\n  }\n  else\n    fputts(name, fp);\n  puttc(T('>'), fp);\n}\n\n#ifndef W3C14N\n\nstatic void XMLCALL\nprocessingInstruction(void *userData, const XML_Char *target,\n                      const XML_Char *data)\n{\n  FILE *fp = (FILE *)userData;\n  puttc(T('<'), fp);\n  puttc(T('?'), fp);\n  fputts(target, fp);\n  puttc(T(' '), fp);\n  fputts(data, fp);\n  puttc(T('?'), fp);\n  puttc(T('>'), fp);\n}\n\n#endif /* not W3C14N */\n\nstatic void XMLCALL\ndefaultCharacterData(void *userData, const XML_Char *s, int len)\n{\n  XML_DefaultCurrent((XML_Parser) userData);\n}\n\nstatic void XMLCALL\ndefaultStartElement(void *userData, const XML_Char *name,\n                    const XML_Char **atts)\n{\n  XML_DefaultCurrent((XML_Parser) userData);\n}\n\nstatic void XMLCALL\ndefaultEndElement(void *userData, const XML_Char *name)\n{\n  XML_DefaultCurrent((XML_Parser) userData);\n}\n\nstatic void XMLCALL\ndefaultProcessingInstruction(void *userData, const XML_Char *target,\n                             const XML_Char *data)\n{\n  XML_DefaultCurrent((XML_Parser) userData);\n}\n\nstatic void XMLCALL\nnopCharacterData(void *userData, const XML_Char *s, int len)\n{\n}\n\nstatic void XMLCALL\nnopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)\n{\n}\n\nstatic void XMLCALL\nnopEndElement(void *userData, const XML_Char *name)\n{\n}\n\nstatic void XMLCALL\nnopProcessingInstruction(void *userData, const XML_Char *target,\n                         const XML_Char *data)\n{\n}\n\nstatic void XMLCALL\nmarkup(void *userData, const XML_Char *s, int len)\n{\n  FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData);\n  for (; len > 0; --len, ++s)\n    puttc(*s, fp);\n}\n\nstatic void\nmetaLocation(XML_Parser parser)\n{\n  const XML_Char *uri = XML_GetBase(parser);\n  if (uri)\n    ftprintf((FILE *)XML_GetUserData(parser), T(\" uri=\\\"%s\\\"\"), uri);\n  ftprintf((FILE *)XML_GetUserData(parser),\n           T(\" byte=\\\"%\" XML_FMT_INT_MOD \"d\\\" nbytes=\\\"%d\\\" \\\n\t\t\t line=\\\"%\" XML_FMT_INT_MOD \"u\\\" col=\\\"%\" XML_FMT_INT_MOD \"u\\\"\"),\n           XML_GetCurrentByteIndex(parser),\n           XML_GetCurrentByteCount(parser),\n           XML_GetCurrentLineNumber(parser),\n           XML_GetCurrentColumnNumber(parser));\n}\n\nstatic void\nmetaStartDocument(void *userData)\n{\n  fputts(T(\"<document>\\n\"), (FILE *)XML_GetUserData((XML_Parser) userData));\n}\n\nstatic void\nmetaEndDocument(void *userData)\n{\n  fputts(T(\"</document>\\n\"), (FILE *)XML_GetUserData((XML_Parser) userData));\n}\n\nstatic void XMLCALL\nmetaStartElement(void *userData, const XML_Char *name,\n                 const XML_Char **atts)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  const XML_Char **specifiedAttsEnd\n    = atts + XML_GetSpecifiedAttributeCount(parser);\n  const XML_Char **idAttPtr;\n  int idAttIndex = XML_GetIdAttributeIndex(parser);\n  if (idAttIndex < 0)\n    idAttPtr = 0;\n  else\n    idAttPtr = atts + idAttIndex;\n    \n  ftprintf(fp, T(\"<starttag name=\\\"%s\\\"\"), name);\n  metaLocation(parser);\n  if (*atts) {\n    fputts(T(\">\\n\"), fp);\n    do {\n      ftprintf(fp, T(\"<attribute name=\\\"%s\\\" value=\\\"\"), atts[0]);\n      characterData(fp, atts[1], (int)tcslen(atts[1]));\n      if (atts >= specifiedAttsEnd)\n        fputts(T(\"\\\" defaulted=\\\"yes\\\"/>\\n\"), fp);\n      else if (atts == idAttPtr)\n        fputts(T(\"\\\" id=\\\"yes\\\"/>\\n\"), fp);\n      else\n        fputts(T(\"\\\"/>\\n\"), fp);\n    } while (*(atts += 2));\n    fputts(T(\"</starttag>\\n\"), fp);\n  }\n  else\n    fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaEndElement(void *userData, const XML_Char *name)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  ftprintf(fp, T(\"<endtag name=\\\"%s\\\"\"), name);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaProcessingInstruction(void *userData, const XML_Char *target,\n                          const XML_Char *data)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  ftprintf(fp, T(\"<pi target=\\\"%s\\\" data=\\\"\"), target);\n  characterData(fp, data, (int)tcslen(data));\n  puttc(T('\"'), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaComment(void *userData, const XML_Char *data)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<comment data=\\\"\"), fp);\n  characterData(fp, data, (int)tcslen(data));\n  puttc(T('\"'), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaStartCdataSection(void *userData)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<startcdata\"), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaEndCdataSection(void *userData)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<endcdata\"), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaCharacterData(void *userData, const XML_Char *s, int len)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<chars str=\\\"\"), fp);\n  characterData(fp, s, len);\n  puttc(T('\"'), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaStartDoctypeDecl(void *userData,\n                     const XML_Char *doctypeName,\n                     const XML_Char *sysid,\n                     const XML_Char *pubid,\n                     int has_internal_subset)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  ftprintf(fp, T(\"<startdoctype name=\\\"%s\\\"\"), doctypeName);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaEndDoctypeDecl(void *userData)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<enddoctype\"), fp);\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaNotationDecl(void *userData,\n                 const XML_Char *notationName,\n                 const XML_Char *base,\n                 const XML_Char *systemId,\n                 const XML_Char *publicId)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  ftprintf(fp, T(\"<notation name=\\\"%s\\\"\"), notationName);\n  if (publicId)\n    ftprintf(fp, T(\" public=\\\"%s\\\"\"), publicId);\n  if (systemId) {\n    fputts(T(\" system=\\\"\"), fp);\n    characterData(fp, systemId, (int)tcslen(systemId));\n    puttc(T('\"'), fp);\n  }\n  metaLocation(parser);\n  fputts(T(\"/>\\n\"), fp);\n}\n\n\nstatic void XMLCALL\nmetaEntityDecl(void *userData,\n               const XML_Char *entityName,\n               int  is_param,\n               const XML_Char *value,\n               int  value_length,\n               const XML_Char *base,\n               const XML_Char *systemId,\n               const XML_Char *publicId,\n               const XML_Char *notationName)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n\n  if (value) {\n    ftprintf(fp, T(\"<entity name=\\\"%s\\\"\"), entityName);\n    metaLocation(parser);\n    puttc(T('>'), fp);\n    characterData(fp, value, value_length);\n    fputts(T(\"</entity/>\\n\"), fp);\n  }\n  else if (notationName) {\n    ftprintf(fp, T(\"<entity name=\\\"%s\\\"\"), entityName);\n    if (publicId)\n      ftprintf(fp, T(\" public=\\\"%s\\\"\"), publicId);\n    fputts(T(\" system=\\\"\"), fp);\n    characterData(fp, systemId, (int)tcslen(systemId));\n    puttc(T('\"'), fp);\n    ftprintf(fp, T(\" notation=\\\"%s\\\"\"), notationName);\n    metaLocation(parser);\n    fputts(T(\"/>\\n\"), fp);\n  }\n  else {\n    ftprintf(fp, T(\"<entity name=\\\"%s\\\"\"), entityName);\n    if (publicId)\n      ftprintf(fp, T(\" public=\\\"%s\\\"\"), publicId);\n    fputts(T(\" system=\\\"\"), fp);\n    characterData(fp, systemId, (int)tcslen(systemId));\n    puttc(T('\"'), fp);\n    metaLocation(parser);\n    fputts(T(\"/>\\n\"), fp);\n  }\n}\n\nstatic void XMLCALL\nmetaStartNamespaceDecl(void *userData,\n                       const XML_Char *prefix,\n                       const XML_Char *uri)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  fputts(T(\"<startns\"), fp);\n  if (prefix)\n    ftprintf(fp, T(\" prefix=\\\"%s\\\"\"), prefix);\n  if (uri) {\n    fputts(T(\" ns=\\\"\"), fp);\n    characterData(fp, uri, (int)tcslen(uri));\n    fputts(T(\"\\\"/>\\n\"), fp);\n  }\n  else\n    fputts(T(\"/>\\n\"), fp);\n}\n\nstatic void XMLCALL\nmetaEndNamespaceDecl(void *userData, const XML_Char *prefix)\n{\n  XML_Parser parser = (XML_Parser) userData;\n  FILE *fp = (FILE *)XML_GetUserData(parser);\n  if (!prefix)\n    fputts(T(\"<endns/>\\n\"), fp);\n  else\n    ftprintf(fp, T(\"<endns prefix=\\\"%s\\\"/>\\n\"), prefix);\n}\n\nstatic int XMLCALL\nunknownEncodingConvert(void *data, const char *p)\n{\n  return codepageConvert(*(int *)data, p);\n}\n\nstatic int XMLCALL\nunknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)\n{\n  int cp;\n  static const XML_Char prefixL[] = T(\"windows-\");\n  static const XML_Char prefixU[] = T(\"WINDOWS-\");\n  int i;\n\n  for (i = 0; prefixU[i]; i++)\n    if (name[i] != prefixU[i] && name[i] != prefixL[i])\n      return 0;\n  \n  cp = 0;\n  for (; name[i]; i++) {\n    static const XML_Char digits[] = T(\"0123456789\");\n    const XML_Char *s = tcschr(digits, name[i]);\n    if (!s)\n      return 0;\n    cp *= 10;\n    cp += (int)(s - digits);\n    if (cp >= 0x10000)\n      return 0;\n  }\n  if (!codepageMap(cp, info->map))\n    return 0;\n  info->convert = unknownEncodingConvert;\n  /* We could just cast the code page integer to a void *,\n  and avoid the use of release. */\n  info->release = free;\n  info->data = malloc(sizeof(int));\n  if (!info->data)\n    return 0;\n  *(int *)info->data = cp;\n  return 1;\n}\n\nstatic int XMLCALL\nnotStandalone(void *userData)\n{\n  return 0;\n}\n\nstatic void\nshowVersion(XML_Char *prog)\n{\n  XML_Char *s = prog;\n  XML_Char ch;\n  const XML_Feature *features = XML_GetFeatureList();\n  while ((ch = *s) != 0) {\n    if (ch == '/'\n#if (defined(WIN32) || defined(__WATCOMC__))\n        || ch == '\\\\'\n#endif\n        )\n      prog = s + 1;\n    ++s;\n  }\n  ftprintf(stdout, T(\"%s using %s\\n\"), prog, XML_ExpatVersion());\n  if (features != NULL && features[0].feature != XML_FEATURE_END) {\n    int i = 1;\n    ftprintf(stdout, T(\"%s\"), features[0].name);\n    if (features[0].value)\n      ftprintf(stdout, T(\"=%ld\"), features[0].value);\n    while (features[i].feature != XML_FEATURE_END) {\n      ftprintf(stdout, T(\", %s\"), features[i].name);\n      if (features[i].value)\n        ftprintf(stdout, T(\"=%ld\"), features[i].value);\n      ++i;\n    }\n    ftprintf(stdout, T(\"\\n\"));\n  }\n}\n\nstatic void\nusage(const XML_Char *prog, int rc)\n{\n  ftprintf(stderr,\n           T(\"usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] \"\n             \"[-e encoding] file ...\\n\"), prog);\n  exit(rc);\n}\n\nint\ntmain(int argc, XML_Char **argv)\n{\n  int i, j;\n  const XML_Char *outputDir = NULL;\n  const XML_Char *encoding = NULL;\n  unsigned processFlags = XML_MAP_FILE;\n  int windowsCodePages = 0;\n  int outputType = 0;\n  int useNamespaces = 0;\n  int requireStandalone = 0;\n  enum XML_ParamEntityParsing paramEntityParsing = \n    XML_PARAM_ENTITY_PARSING_NEVER;\n  int useStdin = 0;\n\n#ifdef _MSC_VER\n  _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);\n#endif\n\n  i = 1;\n  j = 0;\n  while (i < argc) {\n    if (j == 0) {\n      if (argv[i][0] != T('-'))\n        break;\n      if (argv[i][1] == T('-') && argv[i][2] == T('\\0')) {\n        i++;\n        break;\n      }\n      j++;\n    }\n    switch (argv[i][j]) {\n    case T('r'):\n      processFlags &= ~XML_MAP_FILE;\n      j++;\n      break;\n    case T('s'):\n      requireStandalone = 1;\n      j++;\n      break;\n    case T('n'):\n      useNamespaces = 1;\n      j++;\n      break;\n    case T('p'):\n      paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS;\n      /* fall through */\n    case T('x'):\n      processFlags |= XML_EXTERNAL_ENTITIES;\n      j++;\n      break;\n    case T('w'):\n      windowsCodePages = 1;\n      j++;\n      break;\n    case T('m'):\n      outputType = 'm';\n      j++;\n      break;\n    case T('c'):\n      outputType = 'c';\n      useNamespaces = 0;\n      j++;\n      break;\n    case T('t'):\n      outputType = 't';\n      j++;\n      break;\n    case T('d'):\n      if (argv[i][j + 1] == T('\\0')) {\n        if (++i == argc)\n          usage(argv[0], 2);\n        outputDir = argv[i];\n      }\n      else\n        outputDir = argv[i] + j + 1;\n      i++;\n      j = 0;\n      break;\n    case T('e'):\n      if (argv[i][j + 1] == T('\\0')) {\n        if (++i == argc)\n          usage(argv[0], 2);\n        encoding = argv[i];\n      }\n      else\n        encoding = argv[i] + j + 1;\n      i++;\n      j = 0;\n      break;\n    case T('h'):\n      usage(argv[0], 0);\n      return 0;\n    case T('v'):\n      showVersion(argv[0]);\n      return 0;\n    case T('\\0'):\n      if (j > 1) {\n        i++;\n        j = 0;\n        break;\n      }\n      /* fall through */\n    default:\n      usage(argv[0], 2);\n    }\n  }\n  if (i == argc) {\n    useStdin = 1;\n    processFlags &= ~XML_MAP_FILE;\n    i--;\n  }\n  for (; i < argc; i++) {\n    FILE *fp = 0;\n    XML_Char *outName = 0;\n    int result;\n    XML_Parser parser;\n    if (useNamespaces)\n      parser = XML_ParserCreateNS(encoding, NSSEP);\n    else\n      parser = XML_ParserCreate(encoding);\n    if (requireStandalone)\n      XML_SetNotStandaloneHandler(parser, notStandalone);\n    XML_SetParamEntityParsing(parser, paramEntityParsing);\n    if (outputType == 't') {\n      /* This is for doing timings; this gives a more realistic estimate of\n         the parsing time. */\n      outputDir = 0;\n      XML_SetElementHandler(parser, nopStartElement, nopEndElement);\n      XML_SetCharacterDataHandler(parser, nopCharacterData);\n      XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);\n    }\n    else if (outputDir) {\n      const XML_Char * delim = T(\"/\");\n      const XML_Char *file = useStdin ? T(\"STDIN\") : argv[i];\n      if (!useStdin) {\n        /* Jump after last (back)slash */\n        const XML_Char * lastDelim = tcsrchr(file, delim[0]);\n        if (lastDelim)\n          file = lastDelim + 1;\n#if (defined(WIN32) || defined(__WATCOMC__))\n        else {\n          const XML_Char * winDelim = T(\"\\\\\");\n          lastDelim = tcsrchr(file, winDelim[0]);\n          if (lastDelim) {\n            file = lastDelim + 1;\n            delim = winDelim;\n          }\n        }\n#endif\n      }\n      outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2)\n                       * sizeof(XML_Char));\n      tcscpy(outName, outputDir);\n      tcscat(outName, delim);\n      tcscat(outName, file);\n      fp = tfopen(outName, T(\"wb\"));\n      if (!fp) {\n        tperror(outName);\n        exit(1);\n      }\n      setvbuf(fp, NULL, _IOFBF, 16384);\n#ifdef XML_UNICODE\n      puttc(0xFEFF, fp);\n#endif\n      XML_SetUserData(parser, fp);\n      switch (outputType) {\n      case 'm':\n        XML_UseParserAsHandlerArg(parser);\n        XML_SetElementHandler(parser, metaStartElement, metaEndElement);\n        XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction);\n        XML_SetCommentHandler(parser, metaComment);\n        XML_SetCdataSectionHandler(parser, metaStartCdataSection,\n                                   metaEndCdataSection);\n        XML_SetCharacterDataHandler(parser, metaCharacterData);\n        XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl,\n                                  metaEndDoctypeDecl);\n        XML_SetEntityDeclHandler(parser, metaEntityDecl);\n        XML_SetNotationDeclHandler(parser, metaNotationDecl);\n        XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl,\n                                    metaEndNamespaceDecl);\n        metaStartDocument(parser);\n        break;\n      case 'c':\n        XML_UseParserAsHandlerArg(parser);\n        XML_SetDefaultHandler(parser, markup);\n        XML_SetElementHandler(parser, defaultStartElement, defaultEndElement);\n        XML_SetCharacterDataHandler(parser, defaultCharacterData);\n        XML_SetProcessingInstructionHandler(parser,\n                                            defaultProcessingInstruction);\n        break;\n      default:\n        if (useNamespaces)\n          XML_SetElementHandler(parser, startElementNS, endElementNS);\n        else\n          XML_SetElementHandler(parser, startElement, endElement);\n        XML_SetCharacterDataHandler(parser, characterData);\n#ifndef W3C14N\n        XML_SetProcessingInstructionHandler(parser, processingInstruction);\n#endif /* not W3C14N */\n        break;\n      }\n    }\n    if (windowsCodePages)\n      XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0);\n    result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags);\n    if (outputDir) {\n      if (outputType == 'm')\n        metaEndDocument(parser);\n      fclose(fp);\n      if (!result) {\n        tremove(outName);\n        exit(2);\n      }\n      free(outName);\n    }\n    XML_ParserFree(parser);\n  }\n  return 0;\n}\n"},{"id":13539,"name":"ct.c","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#define CHARSET_MAX 41\n\nstatic const char *\ngetTok(const char **pp)\n{\n  enum { inAtom, inString, init, inComment };\n  int state = init;\n  const char *tokStart = 0;\n  for (;;) {\n    switch (**pp) {\n    case '\\0':\n      return 0;\n    case ' ':\n    case '\\r':\n    case '\\t':\n    case '\\n':\n      if (state == inAtom)\n        return tokStart;\n      break;\n    case '(':\n      if (state == inAtom)\n        return tokStart;\n      if (state != inString)\n        state++;\n      break;\n    case ')':\n      if (state > init)\n        --state;\n      else if (state != inString)\n        return 0;\n      break;\n    case ';':\n    case '/':\n    case '=':\n      if (state == inAtom)\n        return tokStart;\n      if (state == init)\n        return (*pp)++;\n      break;\n    case '\\\\':\n      ++*pp;\n      if (**pp == '\\0')\n        return 0;\n      break;\n    case '\"':\n      switch (state) {\n      case inString:\n        ++*pp;\n        return tokStart;\n      case inAtom:\n        return tokStart;\n      case init:\n        tokStart = *pp;\n        state = inString;\n        break;\n      }\n      break;\n    default:\n      if (state == init) {\n        tokStart = *pp;\n        state = inAtom;\n      }\n      break;\n    }\n    ++*pp;\n  }\n  /* not reached */\n}\n\n/* key must be lowercase ASCII */\n\nstatic int\nmatchkey(const char *start, const char *end, const char *key)\n{\n  if (!start)\n    return 0;\n  for (; start != end; start++, key++)\n    if (*start != *key && *start != 'A' + (*key - 'a'))\n      return 0;\n  return *key == '\\0';\n}\n\nvoid\ngetXMLCharset(const char *buf, char *charset)\n{\n  const char *next, *p;\n\n  charset[0] = '\\0';\n  next = buf;\n  p = getTok(&next);\n  if (matchkey(p, next, \"text\"))\n    strcpy(charset, \"us-ascii\");\n  else if (!matchkey(p, next, \"application\"))\n    return;\n  p = getTok(&next);\n  if (!p || *p != '/')\n    return;\n  p = getTok(&next);\n  if (matchkey(p, next, \"xml\"))\n    isXml = 1;\n  p = getTok(&next);\n  while (p) {\n    if (*p == ';') {\n      p = getTok(&next);\n      if (matchkey(p, next, \"charset\")) {\n        p = getTok(&next);\n        if (p && *p == '=') {\n          p = getTok(&next);\n          if (p) {\n            char *s = charset;\n            if (*p == '\"') {\n              while (++p != next - 1) {\n                if (*p == '\\\\')\n                  ++p;\n                if (s == charset + CHARSET_MAX - 1) {\n                  charset[0] = '\\0';\n                  break;\n                }\n                *s++ = *p;\n              }\n              *s++ = '\\0';\n            }\n            else {\n              if (next - p > CHARSET_MAX - 1)\n                break;\n              while (p != next)\n                *s++ = *p++;\n              *s = 0;\n              break;\n            }\n          }\n        }\n      }\n    }\n  else\n    p = getTok(&next);\n  }\n}\n\nint\nmain(int argc, char **argv)\n{\n  char buf[CHARSET_MAX];\n  getXMLCharset(argv[1], buf);\n  printf(\"charset = \\\"%s\\\"\\n\", buf);\n  return 0;\n}\n"},{"id":13540,"name":"xmlwf.dsp","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"# Microsoft Developer Studio Project File - Name=\"xmlwf\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\nCFG=xmlwf - Win32 Release\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"xmlwf.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"xmlwf.mak\" CFG=\"xmlwf - Win32 Release\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"xmlwf - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \"xmlwf - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"xmlwf - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \".\\Release\"\n# PROP BASE Intermediate_Dir \".\\Release\"\n# PROP BASE Target_Dir \".\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release-xmlwf\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \".\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /YX /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /I \"..\\lib\" /D \"NDEBUG\" /D \"WIN32\" /D \"_CONSOLE\" /D \"COMPILED_FROM_DSP\" /FD /c\n# SUBTRACT CPP /YX /Yc /Yu\n# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /machine:I386\n# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /libpath:\"..\\win32\\bin\\Release\" /out:\"..\\win32\\bin\\Release\\xmlwf.exe\"\n# SUBTRACT LINK32 /nodefaultlib\n\n!ELSEIF  \"$(CFG)\" == \"xmlwf - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \".\\Debug\"\n# PROP BASE Intermediate_Dir \".\\Debug\"\n# PROP BASE Target_Dir \".\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug-xmlwf\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \".\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /YX /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I \"..\\lib\" /D \"_DEBUG\" /D \"WIN32\" /D \"_CONSOLE\" /D \"COMPILED_FROM_DSP\" /FD /c\n# SUBTRACT CPP /Fr /YX\n# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386\n# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:\"..\\win32\\bin\\Debug\" /out:\"..\\win32\\bin\\Debug\\xmlwf.exe\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"xmlwf - Win32 Release\"\n# Name \"xmlwf - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90\"\n# Begin Source File\n\nSOURCE=.\\codepage.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\readfilemap.c\n# PROP Exclude_From_Build 1\n# End Source File\n# Begin Source File\n\nSOURCE=.\\unixfilemap.c\n# PROP Exclude_From_Build 1\n# End Source File\n# Begin Source File\n\nSOURCE=.\\win32filemap.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlfile.c\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlwf.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"\n# Begin Source File\n\nSOURCE=.\\codepage.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmlfile.h\n# End Source File\n# Begin Source File\n\nSOURCE=.\\xmltchar.h\n# End Source File\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"},{"id":13541,"name":"xmlwin32url.cxx","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#include \"expat.h\"\n#ifdef XML_UNICODE\n#define UNICODE\n#endif\n#include <windows.h>\n#include <urlmon.h>\n#include <wininet.h>\n#include <stdio.h>\n#include <tchar.h>\n#include \"xmlurl.h\"\n#include \"xmlmime.h\"\n\nstatic int\nprocessURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url);\n\ntypedef void (*StopHandler)(void *, HRESULT);\n\nclass Callback : public IBindStatusCallback {\npublic:\n  // IUnknown methods\n  STDMETHODIMP QueryInterface(REFIID,void **);\n  STDMETHODIMP_(ULONG) AddRef();\n  STDMETHODIMP_(ULONG) Release();\n  // IBindStatusCallback methods\n  STDMETHODIMP OnStartBinding(DWORD, IBinding *);\n  STDMETHODIMP GetPriority(LONG *);\n  STDMETHODIMP OnLowResource(DWORD);\n  STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR);\n  STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR);\n  STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *);\n  STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *);\n  STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *);\n  Callback(XML_Parser, IMoniker *, StopHandler, void *);\n  ~Callback();\n  int externalEntityRef(const XML_Char *context,\n                        const XML_Char *systemId, const XML_Char *publicId);\nprivate:\n  XML_Parser parser_;\n  IMoniker *baseMoniker_;\n  DWORD totalRead_;\n  ULONG ref_;\n  IBinding *pBinding_;\n  StopHandler stopHandler_;\n  void *stopArg_;\n};\n\nSTDMETHODIMP_(ULONG)\nCallback::AddRef()\n{ \n  return ref_++;\n}\n\nSTDMETHODIMP_(ULONG)\nCallback::Release()\n{ \n  if (--ref_ == 0) {\n    delete this;\n    return 0;\n  }\n  return ref_;\n}\n\nSTDMETHODIMP\nCallback::QueryInterface(REFIID riid, void** ppv)\n{ \n  if (IsEqualGUID(riid, IID_IUnknown))\n    *ppv = (IUnknown *)this;\n  else if (IsEqualGUID(riid, IID_IBindStatusCallback))\n    *ppv = (IBindStatusCallback *)this;\n  else\n    return E_NOINTERFACE;\n  ((LPUNKNOWN)*ppv)->AddRef();\n  return S_OK;\n}\n\nSTDMETHODIMP\nCallback::OnStartBinding(DWORD, IBinding* pBinding)\n{\n  pBinding_ = pBinding;\n  pBinding->AddRef();\n  return S_OK;\n}\n\nSTDMETHODIMP\nCallback::GetPriority(LONG *)\n{\n  return E_NOTIMPL;\n}\n\nSTDMETHODIMP\nCallback::OnLowResource(DWORD)\n{\n  return E_NOTIMPL;\n}\n\nSTDMETHODIMP\nCallback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR)\n{\n  return S_OK;\n}\n\nSTDMETHODIMP\nCallback::OnStopBinding(HRESULT hr, LPCWSTR szError)\n{\n  if (pBinding_) {\n    pBinding_->Release();\n    pBinding_ = 0;\n  }\n  if (baseMoniker_) {\n    baseMoniker_->Release();\n    baseMoniker_ = 0;\n  }\n  stopHandler_(stopArg_, hr);\n  return S_OK;\n}\n\nSTDMETHODIMP\nCallback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo)\n{\n  *pgrfBINDF = BINDF_ASYNCHRONOUS;\n  return S_OK;\n}\n\nstatic void\nreportError(XML_Parser parser)\n{\n  int code = XML_GetErrorCode(parser);\n  const XML_Char *message = XML_ErrorString(code);\n  if (message)\n    _ftprintf(stderr, _T(\"%s:%d:%ld: %s\\n\"),\n\t     XML_GetBase(parser),\n\t     XML_GetErrorLineNumber(parser),\n\t     XML_GetErrorColumnNumber(parser),\n\t     message);\n  else\n    _ftprintf(stderr, _T(\"%s: (unknown message %d)\\n\"),\n              XML_GetBase(parser), code);\n}\n\nSTDMETHODIMP\nCallback::OnDataAvailable(DWORD grfBSCF,\n                          DWORD dwSize,\n                          FORMATETC *pfmtetc,\n                          STGMEDIUM* pstgmed)\n{\n  if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) {\n    IWinInetHttpInfo *hp;\n    HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo,\n                                           (void **)&hp);\n    if (SUCCEEDED(hr)) {\n      char contentType[1024];\n      DWORD bufSize = sizeof(contentType);\n      DWORD flags = 0;\n      contentType[0] = 0;\n      hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType,\n                         &bufSize, 0, NULL);\n      if (SUCCEEDED(hr)) {\n\tchar charset[CHARSET_MAX];\n\tgetXMLCharset(contentType, charset);\n\tif (charset[0]) {\n#ifdef XML_UNICODE\n\t  XML_Char wcharset[CHARSET_MAX];\n\t  XML_Char *p1 = wcharset;\n\t  const char *p2 = charset;\n\t  while ((*p1++ = (unsigned char)*p2++) != 0)\n\t    ;\n\t  XML_SetEncoding(parser_, wcharset);\n#else\n\t  XML_SetEncoding(parser_, charset);\n#endif\n\t}\n      }\n      hp->Release();\n    }\n  }\n  if (!parser_)\n    return E_ABORT;\n  if (pstgmed->tymed == TYMED_ISTREAM) {\n    while (totalRead_ < dwSize) {\n#define READ_MAX (64*1024)\n      DWORD nToRead = dwSize - totalRead_;\n      if (nToRead > READ_MAX)\n\tnToRead = READ_MAX;\n      void *buf = XML_GetBuffer(parser_, nToRead);\n      if (!buf) {\n\t_ftprintf(stderr, _T(\"out of memory\\n\"));\n\treturn E_ABORT;\n      }\n      DWORD nRead;\n      HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead);\n      if (SUCCEEDED(hr)) {\n\ttotalRead_ += nRead;\n\tif (!XML_ParseBuffer(parser_,\n\t\t\t     nRead,\n\t\t\t     (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0\n\t\t\t     && totalRead_ == dwSize)) {\n\t  reportError(parser_);\n\t  return E_ABORT;\n\t}\n      }\n    }\n  }\n  return S_OK;\n}\n\nSTDMETHODIMP\nCallback::OnObjectAvailable(REFIID, IUnknown *)\n{\n  return S_OK;\n}\n\nint\nCallback::externalEntityRef(const XML_Char *context,\n                            const XML_Char *systemId,\n                            const XML_Char *publicId)\n{\n  XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0);\n  XML_SetBase(entParser, systemId);\n  int ret = processURL(entParser, baseMoniker_, systemId);\n  XML_ParserFree(entParser);\n  return ret;\n}\n\nCallback::Callback(XML_Parser parser, IMoniker *baseMoniker,\n                   StopHandler stopHandler, void *stopArg)\n: parser_(parser),\n  baseMoniker_(baseMoniker),\n  ref_(0),\n  pBinding_(0),\n  totalRead_(0),\n  stopHandler_(stopHandler),\n  stopArg_(stopArg)\n{\n  if (baseMoniker_)\n    baseMoniker_->AddRef();\n}\n\nCallback::~Callback()\n{\n  if (pBinding_)\n    pBinding_->Release();\n  if (baseMoniker_)\n    baseMoniker_->Release();\n}\n\nstatic int\nexternalEntityRef(void *arg,\n                  const XML_Char *context,\n                  const XML_Char *base,\n                  const XML_Char *systemId,\n                  const XML_Char *publicId)\n{\n  return ((Callback *)arg)->externalEntityRef(context, systemId, publicId);\n}\n\n\nstatic HRESULT\nopenStream(XML_Parser parser,\n           IMoniker *baseMoniker,\n           const XML_Char *uri,\n           StopHandler stopHandler, void *stopArg)\n{\n  if (!XML_SetBase(parser, uri))\n    return E_OUTOFMEMORY;\n  HRESULT hr;\n  IMoniker *m;\n#ifdef XML_UNICODE\n  hr = CreateURLMoniker(0, uri, &m);\n#else\n  LPWSTR uriw = new wchar_t[strlen(uri) + 1];\n  for (int i = 0;; i++) {\n    uriw[i] = uri[i];\n    if (uriw[i] == 0)\n      break;\n  }\n  hr = CreateURLMoniker(baseMoniker, uriw, &m);\n  delete [] uriw;\n#endif\n  if (FAILED(hr))\n    return hr;\n  IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg);\n  XML_SetExternalEntityRefHandler(parser, externalEntityRef);\n  XML_SetExternalEntityRefHandlerArg(parser, cb);\n  cb->AddRef();\n  IBindCtx *b;\n  if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) {\n    cb->Release();\n    m->Release();\n    return hr;\n  }\n  cb->Release();\n  IStream *pStream;\n  hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream);\n  if (SUCCEEDED(hr)) {\n    if (pStream)\n      pStream->Release();\n  }\n  if (hr == MK_S_ASYNCHRONOUS)\n    hr = S_OK;\n  m->Release();\n  b->Release();\n  return hr;\n}\n\nstruct QuitInfo {\n  const XML_Char *url;\n  HRESULT hr;\n  int stop;\n};\n\nstatic void\nwinPerror(const XML_Char *url, HRESULT hr)\n{\n  LPVOID buf;\n  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER\n\t\t    | FORMAT_MESSAGE_FROM_HMODULE,\n\t\t    GetModuleHandleA(\"urlmon.dll\"),\n\t\t    hr,\n\t\t    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n\t\t    (LPTSTR) &buf,\n\t\t    0,\n\t\t    NULL)\n      || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER\n\t\t      | FORMAT_MESSAGE_FROM_SYSTEM,\n\t\t      0,\n\t\t      hr,\n\t\t      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n\t\t      (LPTSTR) &buf,\n\t\t      0,\n\t\t      NULL)) {\n    /* The system error messages seem to end with a newline. */\n    _ftprintf(stderr, _T(\"%s: %s\"), url, buf);\n    fflush(stderr);\n    LocalFree(buf);\n  }\n  else\n    _ftprintf(stderr, _T(\"%s: error %x\\n\"), url, hr);\n}\n\nstatic void\nthreadQuit(void *p, HRESULT hr)\n{\n  QuitInfo *qi = (QuitInfo *)p;\n  qi->hr = hr;\n  qi->stop = 1;\n}\n\nextern \"C\"\nint\nXML_URLInit(void)\n{\n  return SUCCEEDED(CoInitialize(0));\n}\n\nextern \"C\"\nvoid\nXML_URLUninit(void)\n{\n  CoUninitialize();\n}\n\nstatic int\nprocessURL(XML_Parser parser, IMoniker *baseMoniker,\n           const XML_Char *url)\n{\n  QuitInfo qi;\n  qi.stop = 0;\n  qi.url = url;\n\n  XML_SetBase(parser, url);\n  HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi);\n  if (FAILED(hr)) {\n    winPerror(url, hr);\n    return 0;\n  }\n  else if (FAILED(qi.hr)) {\n    winPerror(url, qi.hr);\n    return 0;\n  }\n  MSG msg;\n  while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) {\n    TranslateMessage (&msg);\n    DispatchMessage (&msg);\n  }\n  return 1;\n}\n\nextern \"C\"\nint\nXML_ProcessURL(XML_Parser parser,\n               const XML_Char *url,\n               unsigned flags)\n{\n  return processURL(parser, 0, url);\n}\n"},{"id":13542,"name":"xmltchar.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"#ifdef XML_UNICODE\n#ifndef XML_UNICODE_WCHAR_T\n#error xmlwf requires a 16-bit Unicode-compatible wchar_t \n#endif\n#define T(x) L ## x\n#define ftprintf fwprintf\n#define tfopen _wfopen\n#define fputts fputws\n#define puttc putwc\n#define tcscmp wcscmp\n#define tcscpy wcscpy\n#define tcscat wcscat\n#define tcschr wcschr\n#define tcsrchr wcsrchr\n#define tcslen wcslen\n#define tperror _wperror\n#define topen _wopen\n#define tmain wmain\n#define tremove _wremove\n#else /* not XML_UNICODE */\n#define T(x) x\n#define ftprintf fprintf\n#define tfopen fopen\n#define fputts fputs\n#define puttc putc\n#define tcscmp strcmp\n#define tcscpy strcpy\n#define tcscat strcat\n#define tcschr strchr\n#define tcsrchr strrchr\n#define tcslen strlen\n#define tperror perror\n#define topen open\n#define tmain main\n#define tremove remove\n#endif /* not XML_UNICODE */\n"},{"id":13543,"name":"filemap.h","nodeType":"TextFile","path":"cextern/expat/xmlwf","text":"/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#include <stddef.h>\n\n#ifdef XML_UNICODE\nint filemap(const wchar_t *name,\n            void (*processor)(const void *, size_t,\n                              const wchar_t *, void *arg),\n            void *arg);\n#else\nint filemap(const char *name,\n            void (*processor)(const void *, size_t,\n                              const char *, void *arg),\n            void *arg);\n#endif\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":95,"id":13544,"name":"grid_lines","nodeType":"Attribute","startLoc":95,"text":"self.grid_lines"},{"id":13545,"name":"cextern/expat/examples","nodeType":"Package"},{"id":13546,"name":"elements.c","nodeType":"TextFile","path":"cextern/expat/examples","text":"/* This is simple demonstration of how to use expat. This program\n   reads an XML document from standard input and writes a line with\n   the name of each element to standard output indenting child\n   elements by one tab stop more than their parent element.\n   It must be used with Expat compiled for UTF-8 output.\n*/\n\n#include <stdio.h>\n#include \"expat.h\"\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n#ifdef XML_LARGE_SIZE\n#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400\n#define XML_FMT_INT_MOD \"I64\"\n#else\n#define XML_FMT_INT_MOD \"ll\"\n#endif\n#else\n#define XML_FMT_INT_MOD \"l\"\n#endif\n\nstatic void XMLCALL\nstartElement(void *userData, const char *name, const char **atts)\n{\n  int i;\n  int *depthPtr = (int *)userData;\n  for (i = 0; i < *depthPtr; i++)\n    putchar('\\t');\n  puts(name);\n  *depthPtr += 1;\n}\n\nstatic void XMLCALL\nendElement(void *userData, const char *name)\n{\n  int *depthPtr = (int *)userData;\n  *depthPtr -= 1;\n}\n\nint\nmain(int argc, char *argv[])\n{\n  char buf[BUFSIZ];\n  XML_Parser parser = XML_ParserCreate(NULL);\n  int done;\n  int depth = 0;\n  XML_SetUserData(parser, &depth);\n  XML_SetElementHandler(parser, startElement, endElement);\n  do {\n    int len = (int)fread(buf, 1, sizeof(buf), stdin);\n    done = len < sizeof(buf);\n    if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {\n      fprintf(stderr,\n              \"%s at line %\" XML_FMT_INT_MOD \"u\\n\",\n              XML_ErrorString(XML_GetErrorCode(parser)),\n              XML_GetCurrentLineNumber(parser));\n      return 1;\n    }\n  } while (!done);\n  XML_ParserFree(parser);\n  return 0;\n}\n"},{"id":13547,"name":"outline.dsp","nodeType":"TextFile","path":"cextern/expat/examples","text":"# Microsoft Developer Studio Project File - Name=\"outline\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\nCFG=outline - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"outline.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"outline.mak\" CFG=\"outline - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"outline - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \"outline - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"outline - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release\"\n# PROP BASE Intermediate_Dir \"Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release-outline\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /I \"..\\lib\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /FD /c\n# SUBTRACT CPP /X /YX\n# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /machine:I386\n# ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:\"..\\win32\\bin\\Release\" /out:\"..\\win32\\bin\\Release\\outline.exe\"\n\n!ELSEIF  \"$(CFG)\" == \"outline - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug\"\n# PROP BASE Intermediate_Dir \"Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug-outline\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I \"..\\lib\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /FD /GZ /c\n# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n# ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:\"..\\win32\\bin\\Debug\" /out:\"..\\win32\\bin\\Debug\\outline.exe\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"outline - Win32 Release\"\n# Name \"outline - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\outline.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"},{"id":13548,"name":"elements.dsp","nodeType":"TextFile","path":"cextern/expat/examples","text":"# Microsoft Developer Studio Project File - Name=\"elements\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\nCFG=elements - Win32 Debug\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"elements.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"elements.mak\" CFG=\"elements - Win32 Debug\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"elements - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \"elements - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"elements - Win32 Release\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release\"\n# PROP BASE Intermediate_Dir \"Release\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"..\\win32\\bin\\Release\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Release-elements\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n# ADD CPP /nologo /MT /W3 /GX /O2 /I \"..\\lib\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"XML_STATIC\" /FD /c\n# SUBTRACT CPP /X /YX\n# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\n# ADD RSC /l 0x409 /d \"NDEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /machine:I386\n# ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:\"..\\win32\\bin\\Release\" /out:\"..\\win32\\bin\\Release\\elements.exe\"\n\n!ELSEIF  \"$(CFG)\" == \"elements - Win32 Debug\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug\"\n# PROP BASE Intermediate_Dir \"Debug\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"..\\win32\\bin\\Debug\"\n# PROP Intermediate_Dir \"..\\win32\\tmp\\Debug-elements\"\n# PROP Ignore_Export_Lib 0\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ /c\n# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I \"..\\lib\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"XML_STATIC\" /FR /FD /GZ /c\n# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\n# ADD RSC /l 0x409 /d \"_DEBUG\"\nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo\n# ADD BSC32 /nologo\nLINK32=link.exe\n# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n# ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:\"..\\win32\\bin\\Debug\" /out:\"..\\win32\\bin\\Debug\\elements.exe\"\n\n!ENDIF \n\n# Begin Target\n\n# Name \"elements - Win32 Release\"\n# Name \"elements - Win32 Debug\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n# Begin Source File\n\nSOURCE=.\\elements.c\n# End Source File\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"},{"id":13549,"name":"outline.c","nodeType":"TextFile","path":"cextern/expat/examples","text":"/*****************************************************************\n * outline.c\n *\n * Copyright 1999, Clark Cooper\n * All rights reserved.\n *\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the license contained in the\n * COPYING file that comes with the expat distribution.\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.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n *\n * Read an XML document from standard input and print an element\n * outline on standard output.\n * Must be used with Expat compiled for UTF-8 output.\n */\n\n\n#include <stdio.h>\n#include <expat.h>\n\n#if defined(__amigaos__) && defined(__USE_INLINE__)\n#include <proto/expat.h>\n#endif\n\n#ifdef XML_LARGE_SIZE\n#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400\n#define XML_FMT_INT_MOD \"I64\"\n#else\n#define XML_FMT_INT_MOD \"ll\"\n#endif\n#else\n#define XML_FMT_INT_MOD \"l\"\n#endif\n\n#define BUFFSIZE        8192\n\nchar Buff[BUFFSIZE];\n\nint Depth;\n\nstatic void XMLCALL\nstart(void *data, const char *el, const char **attr)\n{\n  int i;\n\n  for (i = 0; i < Depth; i++)\n    printf(\"  \");\n\n  printf(\"%s\", el);\n\n  for (i = 0; attr[i]; i += 2) {\n    printf(\" %s='%s'\", attr[i], attr[i + 1]);\n  }\n\n  printf(\"\\n\");\n  Depth++;\n}\n\nstatic void XMLCALL\nend(void *data, const char *el)\n{\n  Depth--;\n}\n\nint\nmain(int argc, char *argv[])\n{\n  XML_Parser p = XML_ParserCreate(NULL);\n  if (! p) {\n    fprintf(stderr, \"Couldn't allocate memory for parser\\n\");\n    exit(-1);\n  }\n\n  XML_SetElementHandler(p, start, end);\n\n  for (;;) {\n    int done;\n    int len;\n\n    len = (int)fread(Buff, 1, BUFFSIZE, stdin);\n    if (ferror(stdin)) {\n      fprintf(stderr, \"Read error\\n\");\n      exit(-1);\n    }\n    done = feof(stdin);\n\n    if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) {\n      fprintf(stderr, \"Parse error at line %\" XML_FMT_INT_MOD \"u:\\n%s\\n\",\n              XML_GetCurrentLineNumber(p),\n              XML_ErrorString(XML_GetErrorCode(p)));\n      exit(-1);\n    }\n\n    if (done)\n      break;\n  }\n  XML_ParserFree(p);\n  return 0;\n}\n"},{"id":13550,"name":"cextern/expat/conftools","nodeType":"Package"},{"id":13551,"name":"ac_c_bigendian_cross.m4","nodeType":"TextFile","path":"cextern/expat/conftools","text":"dnl @synopsis AC_C_BIGENDIAN_CROSS\ndnl\ndnl Check endianess even when crosscompiling\ndnl (partially based on the original AC_C_BIGENDIAN).\ndnl\ndnl The implementation will create a binary, and instead of running\ndnl the binary it will be grep'ed for some symbols that will look\ndnl different for different endianess of the binary.\ndnl\ndnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp $\ndnl @author Guido Draheim <guidod@gmx.de>\ndnl\nAC_DEFUN([AC_C_BIGENDIAN_CROSS],\n[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,\n[ac_cv_c_bigendian=unknown\n# See if sys/param.h defines the BYTE_ORDER macro.\nAC_TRY_COMPILE([#include <sys/types.h>\n#include <sys/param.h>], [\n#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN\n bogus endian macros\n#endif], [# It does; now see whether it defined to BIG_ENDIAN or not.\nAC_TRY_COMPILE([#include <sys/types.h>\n#include <sys/param.h>], [\n#if BYTE_ORDER != BIG_ENDIAN\n not big endian\n#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])\nif test $ac_cv_c_bigendian = unknown; then\nAC_TRY_RUN([main () {\n  /* Are we little or big endian?  From Harbison&Steele.  */\n  union\n  {\n    long l;\n    char c[sizeof (long)];\n  } u;\n  u.l = 1;\n  exit (u.c[sizeof (long) - 1] == 1);\n}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes,\n[ echo $ac_n \"cross-compiling... \" 2>&AC_FD_MSG ])\nfi])\nif test $ac_cv_c_bigendian = unknown; then\nAC_MSG_CHECKING(to probe for byte ordering)\n[\ncat >conftest.c <<EOF\nshort ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };\nshort ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };\nvoid _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }\nshort ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };\nshort ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };\nvoid _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }\nint main() { _ascii (); _ebcdic (); return 0; }\nEOF\n] if test -f conftest.c ; then\n     if ${CC-cc} -c conftest.c -o conftest.o && test -f conftest.o ; then\n        if test `grep -l BIGenDianSyS conftest.o` ; then\n           echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG\n           ac_cv_c_bigendian=yes\n        fi\n        if test `grep -l LiTTleEnDian conftest.o` ; then\n           echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG\n           if test $ac_cv_c_bigendian = yes ; then\n            ac_cv_c_bigendian=unknown;\n           else\n            ac_cv_c_bigendian=no\n           fi\n        fi\n        echo $ac_n 'guessing bigendian ...  ' >&AC_FD_MSG\n     fi\n  fi\nAC_MSG_RESULT($ac_cv_c_bigendian)\nfi\nif test $ac_cv_c_bigendian = yes; then\n  AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian])\n  BYTEORDER=4321\nelse\n  BYTEORDER=1234\nfi\nAC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN])\nif test $ac_cv_c_bigendian = unknown; then\n  AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian)\nfi\n])\n"},{"attributeType":"null","col":8,"comment":"null","endLoc":78,"id":13552,"name":"dpi_transform","nodeType":"Attribute","startLoc":78,"text":"self.dpi_transform"},{"id":13553,"name":"expat.m4","nodeType":"TextFile","path":"cextern/expat/conftools","text":"dnl Check if --with-expat[=PREFIX] is specified and\ndnl Expat >= 1.95.0 is installed in the system.\ndnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to\ndnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX\ndnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined.\ndnl If --with-expat has not been specified, set with_expat to 'no'.\ndnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly.\ndnl This is necessary to adapt a whole lot of packages that have expat\ndnl bundled as a static library.\nAC_DEFUN([AM_WITH_EXPAT],\n[ AC_ARG_WITH(expat,\n\t      [  --with-expat=PREFIX     Use system Expat library],\n\t      , with_expat=no)\n\n  AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no)\n\n  EXPAT_CFLAGS=\n  EXPAT_LIBS=\n  if test $with_expat != no; then\n\tif test $with_expat != yes; then\n\t\tEXPAT_CFLAGS=\"-I$with_expat/include\"\n\t\tEXPAT_LIBS=\"-L$with_expat/lib\"\n\tfi\n\tAC_CHECK_LIB(expat, XML_ParserCreate,\n\t\t     [ EXPAT_LIBS=\"$EXPAT_LIBS -lexpat\"\n\t\t       expat_found=yes ],\n\t\t     [ expat_found=no ],\n\t\t     \"$EXPAT_LIBS\")\n\tif test $expat_found = no; then\n\t\tAC_MSG_ERROR([Could not find the Expat library])\n\tfi\n\texpat_save_CFLAGS=\"$CFLAGS\"\n\tCFLAGS=\"$CFLAGS $EXPAT_CFLAGS\"\n\tAC_CHECK_HEADERS(expat.h, , expat_found=no)\n\tif test $expat_found = no; then\n\t\tAC_MSG_ERROR([Could not find expat.h])\n\tfi\n\tCFLAGS=\"$expat_save_CFLAGS\"\n  fi\n\n  AC_SUBST(EXPAT_CFLAGS)\n  AC_SUBST(EXPAT_LIBS)\n])\n"},{"id":13554,"name":"PrintPath","nodeType":"TextFile","path":"cextern/expat/conftools","text":"#!/bin/sh\n# Look for program[s] somewhere in $PATH.\n#\n# Options:\n#  -s\n#    Do not print out full pathname. (silent)\n#  -pPATHNAME\n#    Look in PATHNAME instead of $PATH\n#\n# Usage:\n#  PrintPath [-s] [-pPATHNAME] program [program ...]\n#\n# Initially written by Jim Jagielski for the Apache configuration mechanism\n#  (with kudos to Kernighan/Pike)\n#\n# This script falls under the Apache License.\n# See http://www.apache.org/licenses/LICENSE\n\n##\n# Some \"constants\"\n##\npathname=$PATH\necho=\"yes\"\n\n##\n# Find out what OS we are running for later on\n##\nos=`(uname) 2>/dev/null`\n\n##\n# Parse command line\n##\nfor args in $*\ndo\n    case $args in\n\t-s  ) echo=\"no\" ;;\n\t-p* ) pathname=\"`echo $args | sed 's/^..//'`\" ;;\n\t*   ) programs=\"$programs $args\" ;;\n    esac\ndone\n\n##\n# Now we make the adjustments required for OS/2 and everyone\n# else :)\n#\n# First of all, all OS/2 programs have the '.exe' extension.\n# Next, we adjust PATH (or what was given to us as PATH) to\n# be whitespace separated directories.\n# Finally, we try to determine the best flag to use for\n# test/[] to look for an executable file. OS/2 just has '-r'\n# but with other OSs, we do some funny stuff to check to see\n# if test/[] knows about -x, which is the preferred flag.\n##\n\nif [ \"x$os\" = \"xOS/2\" ]\nthen\n    ext=\".exe\"\n    pathname=`echo -E $pathname |\n     sed 's/^;/.;/\n\t  s/;;/;.;/g\n\t  s/;$/;./\n\t  s/;/ /g\n\t  s/\\\\\\\\/\\\\//g' `\n    test_exec_flag=\"-r\"\nelse\n    ext=\"\"\t# No default extensions\n    pathname=`echo $pathname |\n     sed 's/^:/.:/\n\t  s/::/:.:/g\n\t  s/:$/:./\n\t  s/:/ /g' `\n    # Here is how we test to see if test/[] can handle -x\n    testfile=\"pp.t.$$\"\n\n    cat > $testfile <<ENDTEST\n#!/bin/sh\nif [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then\n    exit 0\nfi\nexit 1\nENDTEST\n\n    if `/bin/sh $testfile 2>/dev/null`; then\n\ttest_exec_flag=\"-x\"\n    else\n\ttest_exec_flag=\"-r\"\n    fi\n    rm -f $testfile\nfi\n\nfor program in $programs\ndo\n    for path in $pathname\n    do\n\tif [ $test_exec_flag $path/${program}${ext} ] && \\\n\t   [ ! -d $path/${program}${ext} ]; then\n\t    if [ \"x$echo\" = \"xyes\" ]; then\n\t\techo $path/${program}${ext}\n\t    fi\n\t    exit 0\n\tfi\n\n# Next try without extension (if one was used above)\n\tif [ \"x$ext\" != \"x\" ]; then\n            if [ $test_exec_flag $path/${program} ] && \\\n               [ ! -d $path/${program} ]; then\n                if [ \"x$echo\" = \"xyes\" ]; then\n                    echo $path/${program}\n                fi\n                exit 0\n            fi\n        fi\n    done\ndone\nexit 1\n\n"},{"attributeType":"null","col":12,"comment":"null","endLoc":179,"id":13555,"name":"_coord_unit_scale","nodeType":"Attribute","startLoc":179,"text":"self._coord_unit_scale"},{"id":13556,"name":"get-version.sh","nodeType":"TextFile","path":"cextern/expat/conftools","text":"#!/bin/sh\n#\n# USAGE: get-version.sh path/to/expat.h\n#\n# This script will print Expat's version number on stdout. For example:\n#\n#   $ ./conftools/get-version.sh ./lib/expat.h\n#   1.95.3\n#   $\n#\n\nif test $# = 0; then\n  echo \"ERROR: pathname for expat.h was not provided.\"\n  echo \"\"\n  echo \"USAGE: $0 path/to/expat.h\"\n  exit 1\nfi\nif test $# != 1; then\n  echo \"ERROR: too many arguments were provided.\"\n  echo \"\"\n  echo \"USAGE: $0 path/to/expat.h\"\n  exit 1\nfi\n\nhdr=\"$1\"\nif test ! -r \"$hdr\"; then\n  echo \"ERROR: '$hdr' does not exist, or is not readable.\"\n  exit 1\nfi\n\nMAJOR_VERSION=\"`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`\"\nMINOR_VERSION=\"`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`\"\nMICRO_VERSION=\"`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`\"\n\n# Determine how to tell echo not to print the trailing \\n. This is\n# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't\n#  generate this file via autoconf (in fact, get-version.sh is used\n# to *create* ./configure), so we just do something similar inline.\ncase `echo \"testing\\c\"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in\n  *c*,-n*) ECHO_N= ECHO_C='\n' ;;\n  *c*,*  ) ECHO_N=-n ECHO_C= ;;\n  *)      ECHO_N= ECHO_C='\\c' ;;\nesac\n\necho $ECHO_N \"$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C\"\n"},{"id":13557,"name":"cextern/wcslib","nodeType":"Package"},{"id":13558,"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":13559,"name":"install-sh","nodeType":"TextFile","path":"cextern/expat/conftools","text":"#!/bin/sh\n# install - install a program, script, or datafile\n\nscriptversion=2009-04-28.21; # 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\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  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  trap '(exit $?); exit' 1 2 13 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 starting with `-'.\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\n    dst=$dst_arg\n    # Protect names starting with `-'.\n    case $dst in\n      -*) dst=./$dst;;\n    esac\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-writeable 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 -z \"$d\" && 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":502,"id":13560,"name":"lbl_world","nodeType":"Attribute","startLoc":502,"text":"self.lbl_world"},{"attributeType":"null","col":8,"comment":"null","endLoc":501,"id":13561,"name":"lblinfo","nodeType":"Attribute","startLoc":501,"text":"self.lblinfo"},{"attributeType":"null","col":8,"comment":"null","endLoc":79,"id":13562,"name":"offset_transform","nodeType":"Attribute","startLoc":79,"text":"self.offset_transform"},{"id":13563,"name":"README","nodeType":"TextFile","path":"cextern/wcslib","text":"------------------------------------------------------------------------------\n                         WCSLIB 5.17 and PGSBOX 5.17\n------------------------------------------------------------------------------\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: README,v 5.17 2017/09/18 08:44:25 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":13564,"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 5.17 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 5.17 2017/09/18 08:44:25 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"},{"attributeType":"null","col":8,"comment":"null","endLoc":72,"id":13565,"name":"coord_unit","nodeType":"Attribute","startLoc":72,"text":"self.coord_unit"},{"attributeType":"null","col":8,"comment":"null","endLoc":73,"id":13566,"name":"frame","nodeType":"Attribute","startLoc":73,"text":"self.frame"},{"id":13567,"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":13568,"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"},{"className":"Conf","col":0,"comment":"\n    Configuration parameters for `astropy.visualization.wcsaxes`.\n    ","endLoc":35,"id":13569,"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.')"},{"id":13570,"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 5.17 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 5.17 2017/09/18 08:44:25 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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":26,"id":13571,"name":"coordinate_range_samples","nodeType":"Attribute","startLoc":26,"text":"coordinate_range_samples"},{"id":13572,"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 5.17 2017/09/18 08:44:25 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# Various C standards handled by features.h in Linux.\nFEATURES :=\nifeq \"$(notdir $(shell pwd))\" \"utils\"\n  # To get off_t for fseeko() usage in fitshdr when gcc is invoked with the\n  # -std=c89 (same as -ansi) or the -std=c99 options.\n  FEATURES := -D_XOPEN_SOURCE\nendif\n\n\n# Linux with gcc/gfortran (also works for Darwin).\nifeq \"$(FLAVOUR)\" \"Linux\"\n  F := $(FLAVOUR)\n  export CC       := gcc -std=c89 -pedantic\n  export CPPFLAGS := $(FEATURES)\n  export CFLAGS   := -g -O0 -Wall -Wextra -Wpadded -Wno-long-long\n  export F77      := gfortran\n  export FFLAGS   := -g -O0 -fimplicit-none -Wall -I.\n  export LDFLAGS  :=\n         VALGRIND := valgrind -v --leak-check=full --show-leak-kinds=all\n         VALGRIND += --track-origins=yes\nendif\n\nifeq \"$(FLAVOUR)\" \"Linuxp\"\n  F := $(FLAVOUR)\n  export CC       := gcc -std=c89 -pedantic\n  export CPPFLAGS := $(FEATURES)\n  export CFLAGS   := -pg -g -O -Wall -Wextra -Wpadded -Wno-long-long\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=c89\n  export CPPFLAGS := $(FEATURES)\n  export CFLAGS   := -g -Wall -Wpadded -Wno-long-long\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=c89\n  export CPPFLAGS := $(FEATURES)\n  export CFLAGS   := -g -Wall -Wpadded -Wno-long-long\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=c89 -pedantic\n  export CPPFLAGS := $(FEATURES)\n  export CFLAGS   := -pg -a -g -O -Wall -Wpadded -Wno-long-long\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\nifneq \"$F\" \"$(FLAVOUR)\"\n  override FLAVOUR := unrecognised\nendif\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 '  VALGRIND    := $(VALGRIND)'\n\t-@ echo '  EXTRA_CLEAN := $(EXTRA_CLEAN)'\n\t-@ echo ''\n"},{"id":13573,"name":"makedefs.in","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# GNU makefile definitions for building WCSLIB 5.17\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.5.17 or libwcs.5.17.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.5.17.\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 5.17 2017/09/18 08:44:25 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Version.\n  LIBVER    := @LIBVER@\n  WCSLIBPKG := wcslib-@PACKAGE_VERSION@\n\n# System architecture.\n  ARCH     := @ARCH@\n\n# Flex and options.\n  FLEX     := @FLEX@\n  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  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\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 printenv show\n\nall : show build\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 '  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 '  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\n# Code development overrides, for use in the code subdirectories.\n-include ../flavours\n"},{"id":13574,"name":"VALIDATION","nodeType":"TextFile","path":"cextern/wcslib","text":"Platforms on which the installation procedures and test suite were exercised.\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 5.17 2017/09/18 08:44:25 mcalabre Exp $\n"},{"id":13575,"name":"GNUmakefile","nodeType":"TextFile","path":"cextern/wcslib","text":"#-----------------------------------------------------------------------------\n# GNU makefile for building WCSLIB 5.17\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#   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 5.17 2017/09/18 08:44:25 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Get configure settings.\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 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 ; \\\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   $(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\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\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 \"  CC       = $${CC-(undefined)}\"\n\t-@ echo \"  CFLAGS   = $${CFLAGS-(undefined)}\"\n\t-@ echo \"  CPP      = $${CPP-(undefined)}\"\n\t-@ echo \"  CPPFLAGS = $${CPPFLAGS-(undefined)}\"\n\t-@ echo \"  F77      = $${F77-(undefined)}\"\n\t-@ echo \"  FFLAGS   = $${FFLAGS-(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":13576,"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 5.17\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 5.17 2017/09/18 08:44:25 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":13577,"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 5.17\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 5.17 2017/09/18 08:44:25 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":13578,"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 5.17 2017/09/18 08:44:25 mcalabre Exp $\n#-----------------------------------------------------------------------------\n\nAC_INIT([WCSLIB], [5.17], [mark@calabretta.id.au], [wcslib-5.17])\nAC_PREREQ([2.53])\nAC_REVISION([$Revision: 5.17 $])\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_BUILD\nARCH=\"${build_cpu}-$build_os\"\nAC_SUBST([ARCH])\n\n\n# Look for Flex.\nAC_CHECK_PROG([FLEX], [flex], [flex], [], [], [])\nif test \"x$FLEX\" = xflex ; then\n  # Version 2.5.9 or later is required.\n  V=`flex --version | awk '{print $2}'`\n  W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20509) print \"no\"}'`\n  if test \"x$W\" != x ; then\n    AC_MSG_NOTICE([Flex version $V is too old, ignored.])\n    FLEX=\n  else\n    AC_MSG_NOTICE([Using Flex version $V.])\n  fi\nfi\n\nif test \"x$FLEX\" = x ; then\n  AC_MSG_WARN([Flex version 2.5.9 or later does not appear to be\n           available, will use pre-generated sources.])\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# 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    # 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.\nAC_PROG_RANLIB\n\n# Shared library generation.\nif test \"x$ac_cv_c_compiler_gnu\" = xyes ; then\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 \"$build_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\"\n    SHRLN=\"libwcs.dylib\"\n\n    case \"$build_cpu\" in\n    powerpc*)\n      # Switch off -fPIC (not applicable for PowerPC Macs).\n      CFLAGS=\"$CFLAGS -mdynamic-no-pic\"\n      ;;\n    esac\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\nelse\n  SHRLIB=\n  SONAME=\n  SHRFLAGS=\n  SHRLD=\n  SHRSFX=\n  SHRLN=\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\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  SUBDIRS=\"$SUBDIRS utils\"\n  INSTDIR=\"$INSTDIR utils\"\nelse\n  AC_MSG_WARN([Compilation of WCS utilities disabled])\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_MSG_NOTICE([End of auxiliary configuration.\n])\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":13579,"name":"cextern/wcslib/C","nodeType":"Package"},{"id":13580,"name":"wcsutil.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutil.c,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*===========================================================================*/\n\n#include <ctype.h>\n#include <locale.h>\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"wcsutil.h\"\n#include \"wcsmath.h\"\n#include \"dis.h\"\n\n/*--------------------------------------------------------------------------*/\n\nvoid wcsutil_blank_fill(int n, char c[])\n\n{\n  int k;\n\n  for (k = strlen(c); k < n; k++) {\n    c[k] = ' ';\n  }\n\n  return;\n}\n\n/*--------------------------------------------------------------------------*/\n\nvoid wcsutil_null_fill(int n, char c[])\n\n{\n  int j, k;\n\n  if (n <= 0) return;\n\n  /* Null-fill the string. */\n  *(c+n-1) = '\\0';\n  for (j = 0; j < n; j++) {\n    if (c[j] == '\\0') {\n      for (k = j+1; k < n; k++) {\n        c[k] = '\\0';\n      }\n      break;\n    }\n  }\n\n  for (k = j-1; k > 0; k--) {\n    if (c[k] != ' ') break;\n    c[k] = '\\0';\n  }\n\n   return;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsutil_allEq(int nvec, int nelem, const double *first)\n\n{\n  double v0;\n  const double *vp;\n\n  if (nvec <= 0 || nelem <= 0) return 0;\n\n  v0 = *first;\n  for (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_Eq(int nelem, double tol, const double *arr1, const double *arr2)\n\n{\n  int i;\n\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (arr1 == 0x0 && arr2 == 0x0) return 1;\n  if (arr1 == 0x0 || arr2 == 0x0) return 0;\n\n  if (tol == 0.0) {\n    /* Handled separately for speed of execution. */\n    for (i = 0; i < nelem; i++, arr1++, arr2++) {\n      if (*arr1 != *arr2) return 0;\n    }\n\n  } else {\n    for (i = 0; i < nelem; i++, arr1++, arr2++) {\n      /* Undefined values must match exactly. */\n      if (*arr1 == UNDEFINED && *arr2 != UNDEFINED) return 0;\n      if (*arr1 != UNDEFINED && *arr2 == UNDEFINED) return 0;\n\n      /* Otherwise, compare within the specified tolerance. */\n      if (fabs(*arr1 - *arr2) > 0.5*tol) return 0;\n    }\n  }\n\n  return 1;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsutil_intEq(int nelem, const int *arr1, const int *arr2)\n\n{\n  int i;\n\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (arr1 == 0x0 && arr2 == 0x0) return 1;\n  if (arr1 == 0x0 || arr2 == 0x0) return 0;\n\n  for (i = 0; i < nelem; i++, arr1++, arr2++) {\n    if (*arr1 != *arr2) return 0;\n  }\n\n  return 1;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsutil_strEq(int nelem, char (*arr1)[72], char (*arr2)[72])\n\n{\n  int i;\n\n  if (nelem == 0) return 1;\n  if (nelem  < 0) return 0;\n\n  if (arr1 == 0x0 && arr2 == 0x0) return 1;\n  if (arr1 == 0x0 || arr2 == 0x0) return 0;\n\n  for (i = 0; i < nelem; i++, arr1++, arr2++) {\n    if (strncmp(*arr1, *arr2, 72)) return 0;\n  }\n\n  return 1;\n}\n\n/*--------------------------------------------------------------------------*/\n\nvoid wcsutil_setAll(int nvec, int nelem, double *first)\n\n{\n  double v0, *vp;\n\n  if (nvec <= 0 || nelem <= 0) return;\n\n  v0 = *first;\n  for (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  int v0, *vp;\n\n  if (nvec <= 0 || nelem <= 0) return;\n\n  v0 = *first;\n  for (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  int *arrp;\n\n  if (bits == 0 || nelem <= 0) return;\n\n  if (sel == 0x0) {\n    /* All elements selected. */\n    for (arrp = array; arrp < array + nelem; arrp++) {\n      *arrp |= bits;\n    }\n\n  } else {\n    /* Some elements selected. */\n    for (arrp = array; arrp < array + nelem; arrp++) {\n      if (*(sel++)) *arrp |= bits;\n    }\n  }\n}\n\n/*--------------------------------------------------------------------------*/\n\nchar *wcsutil_fptr2str(int (*func)(void), char hext[19])\n\n{\n  unsigned char *p = (unsigned char *)(&func);\n  char *t = hext;\n  unsigned int i;\n  int *(ip[2]), j[2], le = 1, gotone = 0;\n\n  /* Test for little-endian addresses. */\n  ip[0] = j;\n  ip[1] = j + 1;\n  if ((unsigned char *)ip[0] < (unsigned char *)ip[1]) {\n    /* Little-endian, reverse it. */\n    p += sizeof(func) - 1;\n    le = -1;\n  }\n\n  sprintf(t, \"0x0\");\n  t += 2;\n\n  for (i = 0; i < sizeof(func); 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  char *bp, *cp;\n\n  sprintf(buf, format, value);\n  wcsutil_locale_to_dot(buf);\n\n  /* Look for a decimal point or exponent. */\n  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    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        strncpy(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/*--------------------------------------------------------------------------*/\n\nint wcsutil_dpkey_int(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 wcsutil_dpkey_double(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"},{"id":13581,"name":"cel.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: cel.c,v 5.17 2017/09/18 08:44:23 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(cel)\n\nstruct 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(cel)\n\nstruct celprm *cel;\n\n{\n  if (cel == 0x0) return CELERR_NULL_POINTER;\n\n  if (cel->err) {\n    free(cel->err);\n    cel->err = 0x0;\n  }\n\n  return cel_prjerr[prjfree(&(cel->prj))];\n}\n\n/*--------------------------------------------------------------------------*/\n\nint celprt(cel)\n\nconst 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(cel)\n\nstruct 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      } 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(cel, nx, ny, sxy, sll, x, y, phi, theta, lng, lat, stat)\n\nstruct celprm *cel;\nint nx, ny, sxy, sll;\nconst double x[], y[];\ndouble phi[], theta[];\ndouble lng[], lat[];\nint 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(cel, nlng, nlat, sll, sxy, lng, lat, phi, theta, x, y, stat)\n\nstruct celprm *cel;\nint nlng, nlat, sll, sxy;\nconst double lng[], lat[];\ndouble phi[], theta[];\ndouble x[], y[];\nint 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":13582,"name":"wcsfix.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsfix.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* 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.\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 and\n*   as such are accomodated by the 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 and derive mjdobs from it if not already set.\n*     Alternatively, if mjdobs is set and dateobs isn't, then derive dateobs\n*     from it.\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* wcsfix() applies all of the corrections handled separately by cdfix(),\n* datfix(), 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, UNITFIX, SPCFIX, CELFIX, and CYLFIX\n*                       to access its elements.  A status value of -2 is set\n*                       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, UNITFIX, SPCFIX, CELFIX, and CYLFIX\n*                       to access its elements.\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\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* 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) and derives MJD-OBS from it if\n* not already set.  Alternatively, if wcsprm::mjdobs is set and\n* wcsprm::dateobs isn't, then datfix() derives wcsprm::dateobs from it.  If\n* both are set but disagree by more than half a day then status 5 is returned.\n*\n* Given and returned:\n*   wcs       struct wcsprm*\n*                       Coordinate transformation parameters.  wcsprm::dateobs\n*                       and/or wcsprm::mjdobs 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 > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\n*\n* Notes:\n*   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 CLDJ\n*   and DJCL.\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* 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. status 0), status -2\n*                       is set in the wcserr struct to allow an informative\n*                       message to be returned.\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* 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 > 1, a detailed error message is set in\n*                       wcsprm::err if enabled, see wcserr_enable().\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* 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* 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* 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 UNITFIX  2\n#define SPCFIX   3\n#define CELFIX   4\n#define CYLFIX   5\n#define NWCSFIX  6\n\nextern const char *wcsfix_errmsg[];\n#define cylfix_errmsg wcsfix_errmsg\n\nenum wcsfix_errmsg_enum {\n  FIXERR_DATE_FIX         = -4, /* The date formatting has been fixed up. */\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\n\t\t\t\t   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\n\t\t\t\t   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 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\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* WCSLIB_WCSFIX */\n"},{"id":13583,"name":"INSTALL","nodeType":"TextFile","path":"cextern/wcslib","text":"------------------------------------------------------------------------------\nWCSLIB 5.17 and PGSBOX 5.17 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-5.17.tar.bz2\n  cd wcslib-5.17\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-5.17.tar.bz2 | tar pvxf -\n  cd wcslib-5.17\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 5.17 2017/09/18 08:44:25 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":13584,"name":"wcsprintf.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsprintf.c,v 5.17 2017/09/18 08:44:23 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    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":13585,"name":"wcstrig.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcstrig.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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":13586,"name":"dis.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: dis.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* 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* 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* 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: 3, 11, 23, 39, and 59.  While the mapping\n* between WAT's monomial coefficients and TPD is fairly simple, for its\n* expression in terms of a sum of Chebyshev or Legendre polynomials it is much\n* less so.\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* disndp(), dpfill(), disini(), discpy(), and disfree() are provided to manage\n* the disprm struct, and another, 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() changes the value of NDPMAX (default 256).  This global variable\n* controls the number of dpkey structs, for holding DPja or DQia keyvalues,\n* that disini() should allocate space for.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NDPMAX; ignored if < 0.\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* disini() - Default constructor for the disprm struct\n* ----------------------------------------------------\n* disini() allocates memory for arrays in a disprm struct and sets all members\n* of the struct to default values.  Memory is allocated for up to NDPMAX DPja\n* or DQia keywords per WCS representation.  This may be changed via disndp()\n* before disini() is called.\n*\n* PLEASE NOTE: every disprm struct must be initialized by disini(), 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 disini() 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* 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 disini() to\n* 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 disini().\n* disini() 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 disini().\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* 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* disini() 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 disini() 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 disini() 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 disini() 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 **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*   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.\n*\n*   double **offset\n*     (Returned) Pointer to the first element of an array of double*\n*     containing an offset used to renormalize the independent variables of\n*     the distortion function for 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 a scale used to renormalize the independent variables of the\n*     distortion function for 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    **axmap;\t\t/* For each axis, the axis mapping array.   */\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  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 disini(int alloc, int naxis, struct disprm *dis);\n\nint discpy(int alloc, const struct disprm *dissrc, struct disprm *disdst);\n\nint disfree(struct disprm *dis);\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":13587,"name":"sph.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: sph.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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*   sphdpa() uses sphs2x() to rotate coordinates so that the reference point\n*   is at the north pole of the new system with the north pole of the old\n*   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 obtained\n*   from the longitude and latitude of the field point in the new system.\n*   This applies even if the reference point is at one of the poles, in which\n*   case the \"position angle\" returned is as would be computed for a reference\n*   point at (lng0,+90-epsilon) or (lng0,-90+epsilon), in the limit as epsilon\n*   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 position\n*   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 points\n*   with that containing the reference point and the pole.  It has its normal\n*   meaning when the the reference and field points are specified in\n*   equatorial coordinates (right ascension and declination).\n*\n*   Interchanging the reference and field points changes the position angle in\n*   a non-intuitive way (because the sum of the angles of a spherical triangle\n*   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 distance\n*   of 0 or 180 degrees (within rounding tolerance).  sphdpa() will return an\n*   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*   sphpad() is implemented analogously to sphdpa() although using sphx2s()\n*   for the inverse transformation.  In particular, when the reference point\n*   is at one of the poles, \"position angle\" is interpreted as though the\n*   reference point was at (lng0,+90-epsilon) or (lng0,-90+epsilon), in the\n*   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":13588,"name":"wcslib.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcslib.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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\n#endif /* WCSLIB_WCSLIB */\n"},{"id":13589,"name":"wcserr.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\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 5.17 2017/09/18 08:44:23 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_prt(\n  const struct wcserr *err,\n  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(\n  struct wcserr **errp)\n\n{\n  if (*errp) free(*errp);\n  *errp = 0x0;\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  char fmt[128];\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    err->status   = status;\n    err->function = function;\n    err->file     = file;\n    err->line_no  = line_no;\n\n    /* Workaround for a compiler segv from gcc 4.2.1 in MacOSX 10.7. */\n    strncpy(fmt, format, 128);\n\n    va_start(argp, format);\n    vsnprintf(err->msg, WCSERR_MSG_LENGTH, fmt, argp);\n    va_end(argp);\n\n  } else if (err) {\n    free(err);\n    *errp = 0x0;\n  }\n\n  return status;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcserr_copy(\n  const struct wcserr *src,\n  struct wcserr *dst)\n\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\n  return src->status;\n}\n"},{"id":13590,"name":"fitshdr.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.l,v 5.17 2017/09/18 08:44:23 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 nounput\n%option noyywrap\n%option outfile=\"fitshdr.c\"\n%option prefix=\"fitshdr\"\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#define YY_DECL int fitshdr(const char header[], int nkeyrec, int nkeyids, \\\n                            struct fitskeyid keyids[], int *nreject, \\\n                            struct fitskey **keys)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (fitshdr_nkeyrec) { \\\n\t    strncpy(inbuff, fitshdr_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    fitshdr_hdr += 80; \\\n\t    fitshdr_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n/* These global variables are required by YY_INPUT. */\nconst char *fitshdr_hdr;\nint  fitshdr_nkeyrec;\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf fitshdr_abort_jmp_env;\n#define exit(status) longjmp(fitshdr_abort_jmp_env, status)\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 *cptr, ctmp[72];\n\tint  blank, continuation, end, j, k, keyno;\n\tdouble dtmp;\n\tstruct fitskey *kptr;\n\tstruct fitskeyid *iptr;\n\tvoid nullfill(char cptr[], int len);\n\tint  yylex_destroy(void);\n\t\n\tfitshdr_hdr = header;\n\tfitshdr_nkeyrec = nkeyrec;\n\t\n\t*nreject = 0;\n\tkeyno = 0;\n\t\n\tif (keys == 0x0) {\n\t  return 1;\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\tif (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) {\n\t  return 2;\n\t}\n\t\n\t/* Initialize keyids[]. */\n\tiptr = keyids;\n\tfor (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\t\n\tblank = 0;\n\tcontinuation = 0;\n\tend = 0;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(fitshdr_abort_jmp_env)) {\n\t  return 3;\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    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  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, \"%lld\", &(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  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, \"%lld\", &(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  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  cptr = kptr->keyvalue.s;\n\t  strcpy(cptr, yytext+1);\n\t\n\t  /* Squeeze out repeated quotes. */\n\t  k = 0;\n\t  for (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\", fitshdr_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 (j = 0; j < nkeyids; j++, iptr++) {\n\t    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    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  yylex_destroy();\n\t  return 0;\n\t}\n\n%%\n\n/*--------------------------------------------------------------------------*/\n\nvoid nullfill(char cptr[], int len)\n\n{\n  int j, k;\n\n  /* Null-fill the string. */\n  for (j = 0; j < len; j++) {\n    if (cptr[j] == '\\0') {\n      for (k = j+1; k < len; k++) {\n        cptr[k] = '\\0';\n      }\n      break;\n    }\n  }\n\n  for (k = j-1; k >= 0; k--) {\n    if (cptr[k] != ' ') break;\n    cptr[k] = '\\0';\n  }\n\n  return;\n}\n"},{"id":13591,"name":"lin.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: lin.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* Four routines, linini(), lindis(), lincpy(), and linfree() are provided to\n* manage the linprm struct, and another, 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() allocates memory for arrays in a linprm struct and sets all members\n* of the struct to default values.\n*\n* PLEASE NOTE: every linprm struct must be initialized by linini(), 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 linini() 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* 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() 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 linini().\n*\n* The disprm struct must have been allocated from the heap (e.g. using\n* malloc(), calloc(), etc.).  lindis() 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 linini(), and freed by linfree(), neither of which\n* would happen if the disprm struct was assigned directly.\n*\n* If the disprm struct had previously been assigned via lindis(), 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* 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 linini() 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 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 linini() and/or\n* linset().  linini() 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 linini().\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* 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 linini() 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 linini() 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 lindis() 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=         lindis(1, lin, dispre);\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 lindis() which takes control of the\n*     allocated memory.  It will be free'd 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=         lindis(1, lin, &dispre);   // 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 lindis(int sequence, struct linprm *lin, struct disprm *dis);\n\nint lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst);\n\nint linfree(struct linprm *lin);\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":13592,"name":"wcsutrn.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutrn.l,v 5.17 2017/09/18 08:44:23 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 noyywrap\n%option outfile=\"wcsutrn.c\"\n%option prefix=\"wcsutrn\"\n\n/* Exclusive start states. */\n%x NEXT FLUSH\n\n%{\n/* To get the prototype for fileno() from stdio.h when gcc is invoked with\n * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */\n#define _POSIX_SOURCE 1\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#define YY_DECL int wcsutrne(int ctrl, char unitstr[], struct wcserr **err)\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsutrn_abort_jmp_env;\n#define exit(status) longjmp(wcsutrn_abort_jmp_env, status)\n\n%}\n\n%%\n\tstatic const char *function = \"wcsutrne\";\n\t\n\tchar orig[80], subs[80];\n\tint bracket = 0;\n\tint unsafe  = 0;\n\tint status  = -1;\n\tint yylex_destroy(void);\n\t\n\tif (err) *err = 0x0;\n\t\n\t*orig = '\\0';\n\t*subs = '\\0';\n\t\n\tyy_delete_buffer(YY_CURRENT_BUFFER);\n\tyy_scan_string(unitstr);\n\t*unitstr = '\\0';\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsutrn_abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units translator 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^\" \"*\"[\" {\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\nangstrom {\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? {\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  yylex_destroy();\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"},{"id":13593,"name":"spc.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spc.c,v 5.17 2017/09/18 08:44:23 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  if (spc->err) {\n    free(spc->err);\n    spc->err = 0x0;\n  }\n\n  return 0;\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((int (*)(void))spc->spxX2P, hext));\n  wcsprintf(\"     spxP2S: %s\\n\",\n    wcsutil_fptr2str((int (*)(void))spc->spxP2S, hext));\n  wcsprintf(\"     spxS2P: %s\\n\",\n    wcsutil_fptr2str((int (*)(void))spc->spxS2P, hext));\n  wcsprintf(\"     spxP2X: %s\\n\",\n    wcsutil_fptr2str((int (*)(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  strncpy(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    strncpy(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      free(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      free(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":13594,"name":"wcs.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcs.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* 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(), wcssub(), and wcsfree() are provided to manage\n* the wcsprm struct and another, 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* 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* 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() changes the value of NPVMAX (default 64).  This global variable\n* controls the number of pvcard structs, for holding PVi_ma keyvalues, that\n* wcsini() should allocate space for.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NPVMAX; ignored if < 0.\n*\n* Function return value:\n*             int       Current value of NPVMAX.\n*\n*\n* wcsnps() - Memory allocation for PSi_ma\n* ---------------------------------------\n* wcsnps() changes the values 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.\n*\n* PLEASE NOTE: This function is not thread-safe.\n*\n* Given:\n*   n         int       Value of NPSMAX; ignored if < 0.\n*\n* Function return value:\n*             int       Current value of NPSMAX.\n*\n*\n* wcsini() - Default constructor for the wcsprm struct\n* ----------------------------------------------------\n* wcsini() optionally allocates memory for arrays in a wcsprm struct and sets\n* all members of the struct to default values.  Memory is allocated for up to\n* NPVMAX PVi_ma keywords or NPSMAX PSi_ma keywords per WCS representation.\n* These may be changed via wcsnpv() and wcsnps() before wcsini() is called.\n*\n* PLEASE NOTE: every wcsprm struct should be initialized by wcsini(), possibly\n* repeatedly.  On the first invokation, and only the first invokation,\n* wcsprm::flag must be set to -1 to initialize memory management, regardless\n* of whether wcsini() will actually be used to allocate memory.\n*\n* Given:\n*   alloc     int       If true, allocate memory unconditionally for the\n*                       crpix, etc. arrays.\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* 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* 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 wcsini() 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 wcsini() 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 wcsini().  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*   Combinations of subimage axes of particular types may be extracted in the\n*   same order as they occur in the input image by combining preprocessor\n*   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 order\n*   as the input image.  If one of each were present, *nsub = 3 would be\n*   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, for\n*   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 Stokes.\n*   Extraction is done in the order specified by axes[] a longitude axis (if\n*   present) would be extracted first (via axes[0]) and not subsequently (via\n*   axes[3]).  Likewise for the latitude and cubeface axes in this example.\n*\n*   From the foregoing, it is apparent that the value of *nsub returned may be\n*   less than or greater than that given.  However, it will never exceed the\n*   number of axes in the input image (plus the number of newly-created axes\n*   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 grid map.  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 wcsini() and/or\n* wcsset().  wcsini() 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 wcsini().\n*\n* 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* 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*   wcsset() always enables strict bounds checking in the projection routines\n*   (via a call to prjini()).  Use wcsbchk() to modify bounds-checking after\n*   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*   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 the\n*   upper limit of the solution interval and decrementing by the specified\n*   step size.  A crossing is indicated if the trial value of the pixel\n*   coordinate steps through the value specified.  If a crossing interval is\n*   found then the solution is determined by a modified form of \"regula falsi\"\n*   division of the crossing interval.  If no crossing interval was found\n*   within the specified solution interval then a search is made for a\n*   \"non-crossing\" solution as may arise from a point of tangency.  The\n*   process is complicated by having to make allowance for the discontinuities\n*   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 native\n*   pole of a projection in which the pole is represented as a finite curve,\n*   for example the zenithals and conics.  In such cases two or more valid\n*   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 be\n*   written for simple projections, for example non-oblique cylindrical\n*   projections.\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* 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 wcsini() 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 wcsini() 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 celprm struct.  celset() will reset flag to\n*     indicate that this has been done.\n*\n*     PLEASE NOTE: flag should be set to -1 when wcsini() 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 wcsini() 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 wcsini()\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 wcsini(), 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 wcsini() 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 wcsini() 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 CROTAia 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 CROTAia 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\n*       equivalent to the product CDi_ja = CDELTia * PCi_ja, but the\n*       defaults differ from that of the PCi_ja matrix.  If one or more\n*       CDi_ja keywords are present then all unspecified CDi_ja default to\n*       zero.  If no CDi_ja (or CROTAia) keywords are present, then the\n*       header is assumed to be in PCi_ja form whether or not any PCi_ja\n*       keywords are present since this results in an interpretation of\n*       CDELTia consistent with the original FITS specification.\n*\n*       While CDi_ja may not formally co-exist with PCi_ja, it may co-exist\n*       with CDELTia and CROTAia which are to be ignored.\n*\n*     - Bit 2: CROTAia is present.\n*\n*       In the AIPS convention, CROTAia may only be\n*       associated with the latitude axis of a celestial axis pair.  It\n*       specifies a rotation in the image plane that is applied AFTER the\n*       CDELTia; any other CROTAia keywords are ignored.\n*\n*       CROTAia may not formally co-exist with PCi_ja.\n*\n*       CROTAia and CDELTia may formally co-exist with CDi_ja but if so are to\n*       be ignored.\n*\n*     CDi_ja and CROTAia keywords, if found, are to be stored in the\n*     wcsprm::cd and wcsprm::crota arrays which are dimensioned similarly to\n*     wcsprm::pc and wcsprm::cdelt.  FITS\n*     header parsers should use the following 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 CROTAia 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, wcsset() resets\n*     wcsprm::cdelt to unity if CDi_ja is present (and no PCi_ja).\n*\n*     If CROTAia 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*   char dateavg[72]\n*     (Given, auxiliary) The date of a representative mid-point 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::dateavg is changed.\n*\n*   char dateobs[72]\n*     (Given, auxiliary) The date of the start of the observation unless\n*     otherwise explained in the comment field of the DATE-OBS keyword, 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*   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*   double mjdavg\n*     (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-AVG,\n*     corresponding to DATE-AVG.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdavg is changed.\n*\n*   double mjdobs\n*     (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-OBS,\n*     corresponding to DATE-OBS.\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::mjdobs is changed.\n*\n*   double obsgeo[3]\n*     (Given, auxiliary) Location of the observer in a standard terrestrial\n*     reference frame, OBSGEO-X, OBSGEO-Y, OBSGEO-Z [m].\n*\n*     It is not necessary to reset the wcsprm struct (via wcsset()) when\n*     wcsprm::obsgeo 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*   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*   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*   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*   void *padding\n*     (An unused variable inserted for alignment purposes only.)\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*   void *m_padding\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*   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*   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* 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 wcs.h itself.\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* 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#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\n\t\t\t\t   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\n\t\t\t\t   system. */\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\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.                         */\n#ifdef __cplusplus\n#define wtbarr wtbarr_s\t\t/* See prologue above.                      */\n#endif\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\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/* CROTAia 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: CROTAia is present.             */\n  int    velref;\t\t/* AIPS velocity code, VELREF.              */\n\n  /* Auxiliary coordinate system information, not used by WCSLIB.           */\n  char   alt[4];\n  int    colnum;\n  int    *colax;\n\n  char   (*cname)[72];\n  double *crder;\n  double *csyer;\n  char   dateavg[72];\n  char   dateobs[72];\n  double equinox;\n  double mjdavg;\n  double mjdobs;\n  double obsgeo[3];\n  char   radesys[72];\n  char   specsys[72];\n  char   ssysobs[72];\n  double velosys;\n  double zsource;\n  char   ssyssrc[72];\n  double velangl;\n  char   wcsname[72];\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  /* 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  void   *padding;\t\t/* (Dummy inserted for alignment purposes.) */\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  /* Error handling, if enabled.                                            */\n  /*------------------------------------------------------------------------*/\n  struct wcserr *err;\n\n  /* Private - the remainder are for memory management.                     */\n  /*------------------------------------------------------------------------*/\n  void   *m_padding;\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;\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 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 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[],\n           double vstep, int viter, double world[], double phi[],\n           double theta[], double imgcrd[], double pixcrd[]);\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":13595,"name":"wcsunits.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsunits.c,v 5.17 2017/09/18 08:44:23 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(\n    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    func1, func2, i, status;\n  double scale1, scale2, units1[WCSUNITS_NTYPE], units2[WCSUNITS_NTYPE];\n\n  if ((status = wcsulexe(have, &func1, &scale1, units1, err))) {\n    return status;\n  }\n\n  if ((status = wcsulexe(want, &func2, &scale2, units2, err))) {\n    return status;\n  }\n\n  /* Check conformance. */\n  for (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(const char unitstr[], int *func, double *scale, double units[])\n\n{\n  return wcsulexe(unitstr, func, scale, units, 0x0);\n}\n"},{"id":13596,"name":"prj.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: prj.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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, 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*   - prjprt()                Print the 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* 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* 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\n/* Use the preprocessor to help declare function prototypes (see above). */\nint prjini(struct prjprm *prj);\nint prjfree(struct prjprm *prj);\nint prjprt(const struct prjprm *prj);\nint prjperr(const struct prjprm *prj, const char *prefix);\nint prjbchk(double tol, int nx, int ny, int spt, double phi[], double theta[],\n           int stat[]);\n\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":13597,"name":"wcspih.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcspih.l,v 5.17 2017/09/18 08:44:23 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 noyywrap\n%option outfile=\"wcspih.c\"\n%option prefix=\"wcspih\"\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 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 <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 STRING  2\n#define RECORD  3\n\n#define PRIOR   1\n#define SEQUENT 2\n\n#define SIP     1\n#define DSS     2\n#define WAT     3\n\n#define YY_DECL int wcspih(char *header, int nkeyrec, int relax, int ctrl, \\\n                           int *nreject, int *nwcs, struct wcsprm **wcs)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (wcspih_nkeyrec) { \\\n\t    strncpy(inbuff, wcspih_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    wcspih_hdr += 80; \\\n\t    wcspih_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n/* These global variables are required by YY_INPUT. */\nchar *wcspih_hdr;\nint  wcspih_nkeyrec;\n\nint wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[],\n        char *wat[], int *nwcs, struct wcsprm **wcs);\nint wcspih_inits(int naxis, int alts[], int dpq[], int npv[], int nps[],\n        int ndp[], int ndq[], int distran, int *nwcs, struct wcsprm **wcs);\nvoid wcspih_naxes(int naxis, int i, int j, char a, int distype, int alts[],\n        int dpq[], int *npptr);\n\nint wcspih_epoch(double *wptr, double epoch);\nint wcspih_vsource(double *wptr, double vsource);\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcspih_abort_jmp_env;\n#define exit(status) longjmp(wcspih_abort_jmp_env, status)\n\n%}\n\n%%\n\t/* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */\n\tchar a;\n\tint  i, j, m, p, q;\n\t\n\tchar *cptr, *errmsg, errtxt[80], *hptr, *keep, *keyname, *keyrec,\n\t     keyword[16], strtmp[80], *wat[2], *watstr;\n\tint  altlin, alts[27], distran, distype, dpq[27], dssflag, gotone,\n\t     ialt, inttmp, ipass, ipx, ix, jx, naxis, ndp[27], ndq[27],\n\t     nother, *npptr, nps[27], npass, npv[27], nvalid, rectype,\n\t     sipflag, status, valtype, voff, watflag, watn;\n\tdouble dbltmp, dsstmp[20];\n\tvoid *vptr, *wptr;\n\tstruct disprm *disp, distem;\n\tstruct wcsprm *wcsp, wcstem;\n\tint (*special)(double *, double);\n\tint yylex_destroy(void);\n\t\n\tnaxis = 0;\n\tfor (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/* Parameters used to implement YY_INPUT. */\n\twcspih_hdr = header;\n\twcspih_nkeyrec = nkeyrec;\n\t\n\t/* Our handle on the input stream. */\n\tkeyrec = header;\n\thptr = header;\n\tkeep = 0x0;\n\t\n\t/* For keeping tallies of keywords found. */\n\t*nreject = 0;\n\tnvalid = 0;\n\tnother = 0;\n\t\n\t/* If strict, then also reject. */\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t/* Keyword parameters. */\n\ti = j = 0;\n\tm = 0;\n\ta = ' ';\n\t\n\t/* For decoding the keyvalue. */\n\tvaltype = -1;\n\tdistype =  0;\n\tvptr    = 0x0;\n\t\n\t/* For keywords that require special handling. */\n\taltlin  = 0;\n\tnpptr   = 0x0;\n\tspecial = 0x0;\n\tdistran = 0;\n\tsipflag = 0;\n\tdssflag = 0;\n\twatflag = 0;\n\twatn    = 0;\n\t\n\t/* The data structures produced. */\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t/* Control variables. */\n\tipass = 1;\n\tnpass = 2;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcspih_abort_jmp_env)) {\n\t  return 3;\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^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^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-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^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^MJD-AVG\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^MJD-OBS\" \" {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\n^OBSGEO-X {\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t\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\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\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Z\";\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^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^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^VELOSYS {\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  keyname = \"VELOSYSa\";\n\t  BEGIN(CCCCCCCa);\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^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^WCSNAME {\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  keyname = \"WCSNAMEa\";\n\t  BEGIN(CCCCCCCa);\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^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 (wcspih_nkeyrec) {\n\t    wcspih_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 == 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\t\n\t    BEGIN(COMMENT);\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<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    ix = 0;\n\t    for (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_naxes(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    gotone = 0;\n\t    for (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          disp = (*wcs)->lin.dispre;\n\t          ipx = (disp->ndp)++;\n\t\n\t          /* SIP doesn't have alternates. */\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              disp = (*wcs)->lin.disseq;\n\t              ipx = (disp->ndp)++;\n\t\n\t              /* DSS doesn't have alternates. */\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          wcsp = *wcs + ialt;\n\t          if (distype == 0) {\n\t            voff = (char *)vptr - (char *)(&wcstem);\n\t            wptr = (void *)((char *)wcsp + voff);\n\t\n\t          } else {\n\t            voff = (char *)vptr - (char *)(&distem);\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            wptr = (void *)((char *)disp + 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              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 == STRING) {\n\t            /* Apply keyword parameterization. */\n\t            if (npptr == nps) {\n\t              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            cptr = (char *)wptr;\n\t            strcpy(cptr, strtmp);\n\t\n\t          } else if (valtype == RECORD) {\n\t            ipx = (disp->ndp)++;\n\t\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            \"recognised 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  /* 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  special = 0x0;\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  if (ipass == 1) {\n\t    if ((status = wcspih_inits(naxis, alts, dpq, npv, nps, ndp, ndq,\n\t                               distran, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      yylex_destroy();\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    wcspih_hdr = header;\n\t    wcspih_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    special = 0x0;\n\t    sipflag = 0;\n\t    dssflag = 0;\n\t    watflag = 0;\n\t\n\t    yyrestart(yyin);\n\t\n\t  } else {\n\t    yylex_destroy();\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* 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_naxes(\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  int ialt, *ip;\n\n  if (a == 0) {\n    return;\n  }\n\n  ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  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_inits(\n  int naxis,\n  int alts[],\n  int dpq[],\n  int npv[],\n  int nps[],\n  int ndp[],\n  int ndq[],\n  int distran,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, defaults, ndis, ndpmax, npsmax, npvmax, status = 0;\n  struct wcsprm *wcsp;\n  struct disprm *dis;\n\n  /* Find the number of coordinate descriptions. */\n  *nwcs = 0;\n  for (ialt = 0; ialt < 27; ialt++) {\n    if (alts[ialt]) (*nwcs)++;\n  }\n\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_naxes(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    /* Record the current values of NPVMAX, NPSMAX, and NDPMAX. */\n    npvmax = wcsnpv(-1);\n    npsmax = wcsnps(-1);\n    ndpmax = disndp(-1);\n\n    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    wcsp = *wcs;\n    *nwcs = 0;\n    for (ialt = 0; ialt < 27; ialt++) {\n      if (alts[ialt]) {\n        wcsp->flag = -1;\n        wcsnpv(npv[ialt]);\n        wcsnps(nps[ialt]);\n        if ((status = wcsini(1, alts[ialt], wcsp))) {\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 distortions present? */\n        if (dpq[ialt] & 1) {\n          if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          /* Attach it to linprm.  Also inits it. */\n          ndis++;\n          disndp(ndp[ialt]);\n          dis->flag = -1;\n          lindis(1, &(wcsp->lin), dis);\n        }\n\n        if (dpq[ialt] & 2) {\n          if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          /* Attach it to linprm.  Also inits it. */\n          ndis++;\n          disndp(ndq[ialt]);\n          dis->flag = -1;\n          lindis(2, &(wcsp->lin), dis);\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    /* Restore the original values of NPVMAX, NPSMAX, and NDPMAX. */\n    wcsnpv(npvmax);\n    wcsnps(npsmax);\n    if (ndis) disndp(ndpmax);\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 EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_epoch(double *equinox, 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, double vsource)\n\n{\n  double beta, 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    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* 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  char   field[16], *wp, wpoly[12], wtype[8];\n  int    i, ialt, idp, ipv, m, npv, n, nterms, omax, omin, status, wctrl[4];\n  double A1, A2, A3, B1, B2, B3, CNPIX1, CNPIX2, *crval, Rx, Ry, S, wval,\n         X0, Y0, Xc, Yc;\n  struct disprm *disp;\n  struct wcsprm *wcsp;\n\n  for (ialt = 0; ialt < *nwcs; ialt++) {\n    /* Interpret -TAB header keywords. */\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  wcsp = *wcs;\n  if (distran == SIP) {\n    /* SIP doesn't have alternates, nor axis mapping. */\n    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    CNPIX1 = dsstmp[0];\n    CNPIX2 = dsstmp[1];\n\n    Xc = dsstmp[2]/1000.0;\n    Yc = dsstmp[3]/1000.0;\n    Rx = dsstmp[4]/1000.0;\n    Ry = dsstmp[5]/1000.0;\n\n    A1 = dsstmp[14];\n    A2 = dsstmp[15];\n    A3 = dsstmp[16];\n    B1 = dsstmp[17];\n    B2 = dsstmp[18];\n    B3 = dsstmp[19];\n    S  = sqrt(fabs(A1*B1 - A2*B2));\n\n    X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n    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    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    disp = wcsp->lin.disseq;\n\n    /* Decipher the core dump stored in the WATi_m strings. */\n    nterms = 0;\n    for (i = 0; i < 2; i++) {\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        lindis(2, &(wcsp->lin), 0x0);\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        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 (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n\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 (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    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 (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      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      for (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 (n = 0; n < wctrl[2]; n++) {\n        for (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"},{"id":13598,"name":"wcsutil.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutil.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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 for internal use only by WCSLIB.  They are\n* documented here solely as an aid to understanding the code.  They are not\n* intended for external use - the API may change without notice!\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 string with blanks starting with the\n* terminating NULL character.\n*\n* Used by the Fortran wrapper functions in translating C character strings\n* into Fortran CHARACTER variables.\n*\n* Given:\n*   n         int       Length of the character array, c[].\n*\n* Given and returned:\n*   c         char[]    The character string.  It will not be null-terminated\n*                       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 off trailing blanks and pads the character array\n* holding the string with NULL characters.\n*\n* Used mainly to make character strings intelligible in the GNU debugger which\n* prints the rubbish following the terminating NULL, obscuring the valid part\n* of the string.\n*\n* Given:\n*   n         int       Number of characters.\n*\n* Given and returned:\n*   c         char[]    The character string.\n*\n* Function return value:\n*             void\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_Eq() - Test for equality of two double arrays\n* -----------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_Eq() 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 int arrays\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*\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*\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      int(*)()  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_dpkey_int() - Get the data value in a dpkey struct as int\n* -----------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_dpkey_int() returns the data value in a dpkey struct as an integer\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*             int       The record's value as int.\n*\n*\n* wcsutil_dpkey_double() - Get the data value in a dpkey struct as double\n* -----------------------------------------------------------------------\n* INTERNAL USE ONLY.\n*\n* wcsutil_dpkey_double() returns the data value in a dpkey struct as a\n* floating point 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\n#ifndef WCSLIB_WCSUTIL\n#define WCSLIB_WCSUTIL\n\n#include \"dis.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nvoid wcsutil_blank_fill(int n, char c[]);\nvoid wcsutil_null_fill (int n, char c[]);\n\nint  wcsutil_allEq (int nvec, int nelem, const double *first);\nint  wcsutil_Eq(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(int (*func)(void), char hext[19]);\nint  wcsutil_str2double(const char *buf, double *value);\nvoid wcsutil_double2str(char *buf, const char *format, double value);\nint    wcsutil_dpkey_int(const struct dpkey *dp);\ndouble wcsutil_dpkey_double(const struct dpkey *dp);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* WCSLIB_WCSUTIL */\n"},{"id":13599,"name":"tab.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: tab.c,v 5.17 2017/09/18 08:44:23 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  int k, m, N;\n  double *dp;\n  struct wcserr **err;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n\n  /* Initialize error message handling. */\n  err = &(tab->err);\n  if (tab->flag != -1) {\n    if (tab->err) free(tab->err);\n  }\n  tab->err = 0x0;\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  if (K) {\n    N = M;\n\n    for (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 (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 (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 (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      if ((dp = tab->index[m])) {\n        for (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 (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  int m, M, N;\n  struct wcserr **err;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  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  N = M = tab->M;\n  for (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 (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 k, m, M, n, N, status;\n  double *dstp, *srcp;\n  struct wcserr **err;\n\n  if (tabsrc == 0x0) return TABERR_NULL_POINTER;\n  if (tabdst == 0x0) return TABERR_NULL_POINTER;\n  err = &(tabdst->err);\n\n  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  N = M;\n  for (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  for (m = 0; m < M; m++) {\n    if ((srcp = tabsrc->index[m])) {\n      dstp = tabdst->index[m];\n      for (k = 0; k < tabsrc->K[m]; k++) {\n        *(dstp++) = *(srcp++);\n      }\n    }\n  }\n\n  srcp = tabsrc->coord;\n  dstp = tabdst->coord;\n  for (n = 0; n < N; n++) {\n    *(dstp++) = *(srcp++);\n  }\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint tabcmp(int dummy,\n           double tol,\n           const struct tabprm *tab1,\n           const struct tabprm *tab2,\n           int *equal)\n\n{\n  int m, M, N;\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  M = tab1->M;\n\n  if (!wcsutil_intEq(M, tab1->K, tab2->K) ||\n      !wcsutil_intEq(M, tab1->map, tab2->map) ||\n      !wcsutil_Eq(M, tol, tab1->crval, tab2->crval)) {\n    return 0;\n  }\n\n  N = M;\n  for (m = 0; m < M; m++) {\n    if (!wcsutil_Eq(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_Eq(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  int m;\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 (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 (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  if (tab->err) {\n    free(tab->err);\n    tab->err = 0x0;\n  }\n\n  tab->flag = 0;\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint tabprt(const struct tabprm *tab)\n\n{\n  char   *cp, text[128];\n  int    j, k, m, n, nd;\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 (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 (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 (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 (m = 0; m < tab->M; m++) {\n    wcsprintf(\"   index[%d]: \", m);\n    WCSPRINTF_PTR(\"\", tab->index[m], \"\");\n    if (tab->index[m]) {\n      for (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 (n = 0; n < tab->nc; n++) {\n    /* Array index. */\n    j = n;\n    cp = text;\n    for (m = 0; m < tab->M; m++) {\n      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 (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 (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 (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 (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 (n = 0; n < tab->nc/tab->K[0]; n++) {\n    /* Array index. */\n    j = n;\n    cp = text;\n    *cp = '\\0';\n    for (m = 1; m < tab->M; m++) {\n      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 (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 (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  int i, ic, k, *Km, m, M, ne;\n  double *dcrd, *dmax, *dmin, dPsi, dval, *Psi;\n  struct wcserr **err;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  err = &(tab->err);\n\n  /* Check the number of tabular coordinate axes. */\n  if ((M = tab->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 (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 (m = 0; m < M; m++) {\n    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 (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    ne = M * tab->nc * 2 / tab->K[0];\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  Km = tab->K;\n  for (m = 0; m < M; m++, Km++) {\n    tab->sense[m] = 0;\n\n    if (*Km > 1) {\n      if ((Psi = tab->index[m]) == 0x0) {\n        /* Default indexing. */\n        tab->sense[m] = 1;\n\n      } else {\n        for (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  dcrd = tab->coord;\n  dmin = tab->extrema;\n  dmax = tab->extrema + M;\n  for (ic = 0; ic < tab->nc; ic += tab->K[0]) {\n    for (m = 0; m < M; m++, dcrd++) {\n      if (tab->K[0] > 1) {\n        /* Extrapolate a little before the start of the row. */\n        Psi = tab->index[0];\n        if (Psi == 0x0) {\n          dPsi = 1.0;\n        } else {\n          dPsi = Psi[1] - Psi[0];\n        }\n\n        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 (i = 0; i < tab->K[0]; i++) {\n      for (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          Psi = tab->index[0];\n          if (Psi == 0x0) {\n            dPsi = 1.0;\n          } else {\n            dPsi = Psi[i] - Psi[i-1];\n          }\n\n          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 i, iv, k, *Km, m, M, n, nv, offset, p1, status;\n  double *coord, *Psi, psi_m, upsilon, wgt;\n  register int *statp;\n  register const double *xp;\n  register double *wp;\n  struct wcserr **err;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  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  M = tab->M;\n\n  status = 0;\n  xp = x;\n  wp = world;\n  statp = stat;\n  for (n = 0; n < ncoord; n++) {\n    /* Determine the indexes. */\n    Km = tab->K;\n    for (m = 0; m < M; m++, Km++) {\n      /* N.B. psi_m and Upsilon_m are 1-relative FITS indexes. */\n      i = tab->map[m];\n      psi_m = *(xp+i) + tab->crval[m];\n\n      Psi = tab->index[m];\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          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      p1 = (int)floor(upsilon);\n      tab->p0[m] = p1 - 1;\n      tab->delta[m] = upsilon - p1;\n\n      if (p1 == 0) {\n        tab->p0[m] += 1;\n        tab->delta[m] -= 1.0;\n      } else if (p1 == *Km && *Km > 1) {\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 (m = 0; m < M; m++) {\n     i = tab->map[m];\n     *(wp+i) = 0.0;\n    }\n\n    /* Loop over the 2^M vertices surrounding P. */\n    nv = 1 << M;\n    for (iv = 0; iv < nv; iv++) {\n      /* Locate vertex in the coordinate array and compute its weight. */\n      offset = 0;\n      wgt = 1.0;\n      for (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      coord = tab->coord + offset*M;\n      for (m = 0; m < M; m++) {\n        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\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 tabedge(struct tabprm *);\n  int tabrow(struct tabprm *, const double *);\n  int tabvox(struct tabprm *, const double *, int, double **, unsigned int *);\n\n  int edge, i, ic, iv, k, *Km, M, m, n, nv, offset, status;\n  double *dcrd, delta, *Psi, psi_m, **tabcoord, upsilon;\n  register int *statp;\n  register const double *wp;\n  register double *xp;\n  struct wcserr **err;\n\n  if (tab == 0x0) return TABERR_NULL_POINTER;\n  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  M = tab->M;\n\n  tabcoord = 0x0;\n  nv = 0;\n  if (M > 1) {\n    nv = 1 << M;\n    tabcoord = calloc(nv, sizeof(double *));\n  }\n\n\n  status = 0;\n  wp = world;\n  xp = x;\n  statp = stat;\n  for (n = 0; n < ncoord; n++) {\n    /* Locate this coordinate in the coordinate array. */\n    edge = 0;\n    for (m = 0; m < M; m++) {\n      tab->p0[m] = 0;\n    }\n\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          tab->p0[1]++;\n          edge = tabedge(tab);\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        if (*wp == 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] <= *wp && *wp <= tab->coord[ic+1]) ||\n               (tab->coord[ic] >= *wp && *wp >= 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] = (*wp - 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 (iv = 0; iv < nv; iv++) {\n            offset = 0;\n            for (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        if (tab->extrema[0] <= *wp && *wp <= tab->extrema[1]) {\n          dcrd = tab->coord;\n          for (i = 0; i < 2; i++) {\n            if (i) dcrd += tab->K[0] - 2;\n\n            delta = (*wp - *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      Km = tab->K;\n      for (m = 0; m < M; m++, Km++) {\n        /* N.B. Upsilon_m and psi_m are 1-relative FITS indexes. */\n        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          Psi = tab->index[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              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          i = tab->map[m];\n          xp[i] = 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 deal with of edge effects in tabprm::p0.\n*---------------------------------------------------------------------------*/\n\nint tabedge(struct tabprm* tab)\n\n{\n  int edge, *Km, m;\n\n  edge = 0;\n  Km = tab->K;\n  for (m = 0; m < tab->M; m++, Km++) {\n    if (tab->p0[m] == *Km) {\n      /* p0 has been incremented beyond the end of the row, point it to the\n         next one. */\n      tab->p0[m] = 0;\n      tab->p0[m+1]++;\n    } else if (tab->p0[m] == *Km - 1 && *Km > 1) {\n      /* p0 is sitting at the end of a non-degenerate row. */\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  int M, m, offset;\n  unsigned int eq, gt, iv, lt, nv;\n  const double tol = 1e-10;\n  double *cp, w;\n\n  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  nv = 1 << M;\n\n  eq = 0;\n  lt = 0;\n  gt = 0;\n  for (iv = 0; iv < nv; iv++) {\n    /* Find the index into tabprm::extrema for this row. */\n    offset = 0;\n    for (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    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 (m = 0; m < M; m++, cp++) {\n      /* Apply the axis mapping. */\n      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 16.\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  int i, M, m;\n  unsigned int eq, et, gt, iv, jv, lt, nv, vox2[16];\n  const double tol = 1e-10;\n  double coord[16], *cp, dv, w, wgt;\n\n  M = tab->M;\n\n  /* The number of corners in a voxel. */\n  nv = 1 << M;\n\n  dv = 1.0;\n  for (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  lt = 0;\n  gt = 0;\n  eq = 0;\n  for (iv = 0; iv < nv; iv++) {\n    /* Select a corner of the sub-voxel. */\n    for (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 (jv = 0; jv < nv; jv++) {\n      /* Find the weight for this corner of the parent voxel. */\n      wgt = 1.0;\n      for (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      cp = tabcoord[jv];\n      for (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    et = 0;\n    for (m = 0; m < M; m++) {\n      /* Apply the axis mapping. */\n      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 (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 (iv = 0; iv < nv; iv++) {\n      /* Select the subdivision. */\n      for (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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":30,"id":13600,"name":"frame_boundary_samples","nodeType":"Attribute","startLoc":30,"text":"frame_boundary_samples"},{"id":13601,"name":"spc.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spc.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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, 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* 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* 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* 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 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":13602,"name":"wcsmath.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsmath.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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":13603,"name":"wcsprintf.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsprintf.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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 <stdio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define WCSPRINTF_PTR(str1, ptr, str2) \\\n  if (ptr) { \\\n    wcsprintf(\"%s%#lx%s\", (str1), (unsigned long)(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":13604,"name":"wcshdr.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcshdr.c,v 5.17 2017/09/18 08:44:23 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 \"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#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_DOCORR  3\t/* True if distortion func computes a correction.   */\n#define I_TPDNCO  4\t/* No. of TPD coefficients, forward...              */\n#define I_TPDINV  5     /* ...and inverse.                                  */\n#define I_TPDAUX  6\t/* True if auxiliary variables are used.            */\n#define I_TPDRAD  7\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[72], keyword[16], *kp, *kp0, obsg[8] = \"OBSG?\",\n       obsgeo[8] = \"OBSGEO-?\", pq, ptype, xtype, term[16], tpdsrc[24],\n       xyz[] = \"XYZ\";\n  int  *axmap, bintab, col0, *colax, colnum, degree, direct, doaux, dofmt,\n       dosip, dotpd, dotpv, i, idis, idp, *iparm, j, jhat, k, m, naxis,\n       ncoeff, Nhat, p, pixlist, precision, primage, q, status = 0;\n  double *dparm, keyval;\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    col0 = colnum;\n  } else if (colax[0]) {\n    pixlist = 1;\n    col0 = colax[0];\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  /* 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  /* 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  /* 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,\n      colnum, colax, keyvalue, \"Equatorial coordinate system\",\n      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,\n      colnum, colax, keyvalue, \"[yr] Equinox of equatorial coordinates\",\n      nkeyrec, header, &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,\n      colnum, colax, keyvalue, \"Reference frame of spectral coordinates\",\n      nkeyrec, header, &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,\n      colnum, colax, keyvalue, \"Reference frame of spectral observation\",\n      nkeyrec, header, &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,\n      colnum, colax, keyvalue, \"[m/s] Velocity towards source\",\n      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,\n      colnum, colax, keyvalue, \"Reference frame of source redshift\",\n      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,\n      colnum, colax, keyvalue, \"Redshift of the source\",\n      nkeyrec, header, &status);\n  }\n\n  /* Observatory coordinates. */\n  for (k = 0; k < 3; k++) {\n    if (undefined(wcs->obsgeo[k])) continue;\n\n    wcsutil_double2str(keyvalue, format, wcs->obsgeo[k]);\n    sprintf(comment, \"[m] ITRF 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  /* MJD of observation. */\n  if (!undefined(wcs->mjdobs)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdobs);\n\n    strcpy(comment, \"[d] MJD of observation\");\n    if (wcs->dateobs[0]) {\n      if (primage || (ctrl & 1) == 0) {\n        sprintf(comment+22, \" matching DATE-OBS\");\n      } else {\n        sprintf(comment+22, \" matching DOBS%d\", col0);\n      }\n    }\n\n    wcshdo_util(ctrl, \"MJD-OBS\", \"MJDOB\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n  /* MJD mid-observation time. */\n  if (!undefined(wcs->mjdavg)) {\n    wcsutil_double2str(keyvalue, format, wcs->mjdavg);\n\n    strcpy(comment, \"[d] MJD mid-observation\");\n    if (wcs->dateavg[0]) {\n      if (primage) {\n        sprintf(comment+23, \" matching DATE-AVG\");\n      } else {\n        sprintf(comment+23, \" matching DAVG%d\", col0);\n      }\n    }\n\n    wcshdo_util(ctrl, \"MJD-AVG\", \"MJDA\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n  /* ISO-8601 date corresponding to MJD-OBS. */\n  if (wcs->dateobs[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->dateobs);\n\n    strcpy(comment, \"ISO-8601 observation date\");\n    if (!undefined(wcs->mjdobs)) {\n      if (primage) {\n        sprintf(comment+25, \" matching MJD-OBS\");\n      } else {\n        sprintf(comment+25, \" matching MJDOB%d\", col0);\n      }\n    }\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, ' ', 0,\n        0x0, keyvalue, comment, nkeyrec, header, &status);\n    }\n  }\n\n  /* ISO-8601 date corresponding to MJD-OBS. */\n  if (wcs->dateavg[0]) {\n    sprintf(keyvalue, \"'%s'\", wcs->dateavg);\n\n    strcpy(comment, \"ISO-8601 mid-observation date\");\n    if (!undefined(wcs->mjdavg)) {\n      if (primage) {\n        sprintf(comment+29, \" matching MJD-AVG\");\n      } else {\n        sprintf(comment+29, \" matching MJDA%d\", col0);\n      }\n    }\n\n    wcshdo_util(ctrl, \"DATE-AVG\", \"DAVG\", 0, 0x0, 0, 0, 0, ' ',\n      colnum, colax, keyvalue, comment, nkeyrec, header, &status);\n  }\n\n\n  /* Write distortion function parameters. */\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  = keyvalue + 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\", wcsutil_dpkey_double(keyp));\n\n        kp = keyvalue + 15;\n        while (kp0 < kp && *kp == '0') kp--;\n        kp0 = kp;\n      }\n\n      precision = kp - (keyvalue + 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 = wcsutil_dpkey_double(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 = wcsutil_dpkey_double(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 = wcsutil_dpkey_double(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 (iparm[I_DOCORR]) {\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        }\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, wcsutil_dpkey_int(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 = wcsutil_dpkey_double(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, wcsutil_dpkey_int(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 = wcsutil_dpkey_double(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  char *cp, *cp0, cval[24];\n  int  i, expmax, expon, nsig, precision;\n\n  if (fmt == 'G') {\n    fmt = 'f';\n    for (i = 0; i < nval; i++) {\n      if (fabs(val[i]) < 1e-4 || 1e12 < val[i]) {\n        fmt = 'E';\n        break;\n      }\n    }\n  }\n\n  cp0 = cval + 2;\n  expmax = -999;\n  for (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    wcsutil_double2str(cval, \"%21.14E\", val[i]);\n\n    cp = cval + 16;\n    while (cp0 < cp && *cp == '0') cp--;\n    cp0 = cp;\n\n    sscanf(cval+18, \"%d\", &expon);\n    if (expmax < expon) expmax = expon;\n  }\n\n  nsig = cp0 - (cval + 2) + 1;\n\n\n  if (fmt == 'f') {\n    precision = nsig - (expmax + 1);\n    if (precision < 1)  precision = 1;\n    if (17 < precision) precision = 17;\n    sprintf(format, \"%%20.%df\", precision);\n\n  } else {\n    precision = nsig - 1;\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      strncpy(term, \"rrrrrrrrr\", degree);\n    } else if (direct) {\n      strncpy(term, \"xxxxxxxxx\", k);\n      strncpy(term+k, \"yyyyyyyyy\", degree-k);\n    } else {\n      strncpy(term, \"yyyyyyyyy\", k);\n      strncpy(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[16], *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":13605,"name":"lin.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: lin.c,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*===========================================================================*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.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  static const char *function = \"linini\";\n\n  int i, j;\n  double *pc;\n  struct wcserr **err;\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n\n  /* Initialize error message handling. */\n  err = &(lin->err);\n  if (lin->flag != -1) {\n    if (lin->err) free(lin->err);\n  }\n  lin->err = 0x0;\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    disini(1, naxis, lin->dispre);\n  }\n\n  if (lin->m_disseq) {\n    disini(1, naxis, lin->disseq);\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 (j = 0; j < naxis; j++) {\n    lin->crpix[j] = 0.0;\n  }\n\n  /* PCi_ja defaults to the unit matrix. */\n  pc = lin->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  /* CDELTia defaults to 1.0. */\n  for (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  static const char *function = \"lindis\";\n\n  int status;\n  struct wcserr **err;\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  err = &(lin->err);\n\n  if (sequence == 1) {\n    if (lin->m_dispre) free(lin->m_dispre);\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) free(lin->m_disseq);\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    if ((status = disini(1, lin->naxis, dis))) {\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  int i, j, naxis, status;\n  const double *srcp;\n  double *dstp;\n  struct wcserr **err;\n\n  if (linsrc == 0x0) return LINERR_NULL_POINTER;\n  if (lindst == 0x0) return LINERR_NULL_POINTER;\n  err = &(lindst->err);\n\n  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  if ((status = linini(alloc, naxis, lindst))) {\n    return status;\n  }\n\n  srcp = linsrc->crpix;\n  dstp = lindst->crpix;\n  for (j = 0; j < naxis; j++) {\n    *(dstp++) = *(srcp++);\n  }\n\n  srcp = linsrc->pc;\n  dstp = lindst->pc;\n  for (i = 0; i < naxis; i++) {\n    for (j = 0; j < naxis; j++) {\n      *(dstp++) = *(srcp++);\n    }\n  }\n\n  srcp = linsrc->cdelt;\n  dstp = lindst->cdelt;\n  for (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 && (lindst->m_dispre || lindst->m_disseq)) {\n    if (lindst->dispre) free(lindst->dispre);\n    if (lindst->disseq) free(lindst->disseq);\n    lindst->dispre = 0x0;\n    lindst->disseq = 0x0;\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 linini() 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    if (lin->err) free(lin->err);\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  lin->err  = 0x0;\n\n  lin->flag = 0;\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint linprt(const struct linprm *lin)\n\n{\n  int i, j, k;\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 (j = 0; j < lin->naxis; j++) {\n    wcsprintf(\"  %#- 11.5g\", lin->crpix[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  k = 0;\n  WCSPRINTF_PTR(\"         pc: \", lin->pc, \"\\n\");\n  for (i = 0; i < lin->naxis; i++) {\n    wcsprintf(\"    pc[%d][]:\", i);\n    for (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 (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    k = 0;\n    for (i = 0; i < lin->naxis; i++) {\n      wcsprintf(\"piximg[%d][]:\", i);\n      for (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    k = 0;\n    for (i = 0; i < lin->naxis; i++) {\n      wcsprintf(\"imgpix[%d][]:\", i);\n      for (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  int i, j, naxis, status;\n  double *pc, *piximg;\n  struct wcserr **err;\n\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  err = &(lin->err);\n\n  naxis = lin->naxis;\n\n  /* Check for a unit matrix. */\n  lin->unity = 1;\n  pc = lin->pc;\n  for (i = 0; i < naxis; i++) {\n    for (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 (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    piximg = lin->piximg;\n    for (i = 0; i < naxis; i++) {\n      for (j = 0; j < naxis; j++) {\n        if (lin->disseq == 0x0) {\n          /* No sequent distortions, incorporate cdelt into piximg. */\n          *(piximg++) = lin->cdelt[i] * (*(pc++));\n        } else {\n          *(piximg++) = *(pc++);\n        }\n      }\n    }\n\n    /* Compute the image-to-pixel transformation matrix. */\n    if ((status = matinv(naxis, lin->piximg, lin->imgpix))) {\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    if ((status = disset(lin->dispre))) {\n      return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n    }\n\n    lin->affine = 0;\n  }\n\n  if (lin->disseq) {\n    if ((status = disset(lin->disseq))) {\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  int i, j, k, n, ndbl, nelemn, status;\n  double temp;\n  register const double *pix;\n  register double *img, *piximg, *tmp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  err = &(lin->err);\n\n  if (lin->flag != LINSET) {\n    if ((status = linset(lin))) return status;\n  }\n\n  n = lin->naxis;\n\n\n  /* Convert pixel coordinates to intermediate world coordinates. */\n  pix = pixcrd;\n  img = imgcrd;\n\n  if (lin->simple) {\n    /* Handle the simplest and most common case with maximum efficiency. */\n    nelemn = nelem - n;\n    for (k = 0; k < ncoord; k++) {\n      for (i = 0; i < n; 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    ndbl   = n * sizeof(double);\n    nelemn = nelem - n;\n    for (k = 0; k < ncoord; k++) {\n      memset(img, 0, ndbl);\n\n      for (j = 0; j < n; j++) {\n        /* cdelt will have been incorporated into piximg. */\n        piximg = lin->piximg + j;\n\n        /* Column-wise multiplication allows this to be cached. */\n        temp = *(pix++) - lin->crpix[j];\n        for (i = 0; i < n; i++, piximg += n) {\n          img[i] += *piximg * temp;\n        }\n      }\n\n      pix += nelemn;\n      img += nelem;\n    }\n\n  } else {\n    /* Distortions are present. */\n    ndbl = n * sizeof(double);\n    tmp  = lin->tmpcrd;\n\n    for (k = 0; k < ncoord; k++) {\n      if (lin->dispre) {\n        if ((status = disp2x(lin->dispre, pix, tmp))) {\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 (i = 0; i < n; i++) {\n          img[i] = tmp[i] - lin->crpix[i];\n        }\n\n      } else {\n        for (j = 0; j < n; j++) {\n          tmp[j] -= lin->crpix[j];\n        }\n\n        piximg = lin->piximg;\n        for (i = 0; i < n; i++) {\n          img[i] = 0.0;\n          for (j = 0; j < n; j++) {\n            img[i] += *(piximg++) * tmp[j];\n          }\n        }\n      }\n\n      if (lin->disseq) {\n        if ((status = disp2x(lin->disseq, img, tmp))) {\n          return wcserr_set(LIN_ERRMSG(lin_diserr[status]));\n        }\n\n        /* With sequent distortions, cdelt is not incorporated into piximg. */\n        for (i = 0; i < n; 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 (i = 0; i < n; 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  int i, j, k, n, ndbl, nelemn, status;\n  register const double *img;\n  register double *imgpix, *pix, *tmp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  err = &(lin->err);\n\n  if (lin->flag != LINSET) {\n    if ((status = linset(lin))) return status;\n  }\n\n  n = lin->naxis;\n\n\n  /* Convert intermediate world coordinates to pixel coordinates. */\n  img = imgcrd;\n  pix = pixcrd;\n\n  if (lin->simple) {\n    /* Handle the simplest and most common case with maximum efficiency. */\n    nelemn = nelem - n;\n    for (k = 0; k < ncoord; k++) {\n      for (j = 0; j < n; 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    nelemn = nelem - n;\n    for (k = 0; k < ncoord; k++) {\n      /* cdelt will have been incorporated into imgpix. */\n      imgpix = lin->imgpix;\n\n      for (j = 0; j < n; j++) {\n        *pix = 0.0;\n        for (i = 0; i < n; 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    ndbl = n * sizeof(double);\n    tmp  = lin->tmpcrd;\n\n    for (k = 0; k < ncoord; k++) {\n      if (lin->disseq) {\n        /* With sequent distortions, cdelt is not incorporated into imgpix. */\n        for (i = 0; i < n; i++) {\n          tmp[i] = img[i] / lin->cdelt[i];\n        }\n\n        if ((status = disx2p(lin->disseq, tmp, pix))) {\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 (i = 0; i < n; 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 (j = 0; j < n; j++) {\n          pix[j] = tmp[j] + lin->crpix[j];\n        }\n\n      } else {\n        imgpix = lin->imgpix;\n        for (j = 0; j < n; j++) {\n          pix[j] = lin->crpix[j];\n          for (i = 0; i < n; i++) {\n            pix[j] += *(imgpix++) * tmp[i];\n          }\n        }\n      }\n\n      if (lin->dispre) {\n        memcpy(tmp, pix, ndbl);\n\n        if ((status = disx2p(lin->dispre, tmp, pix))) {\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  int carry, i, j, naxis, ncoord, status = 0;\n  double dpix, dpx2, dssq, *img, *pix0, *pix0p, *pix1, *pix1p, *pixend,\n         *pixinc, pixspan, *ssqdis, ssqtot, *sumdis, sumtot, totdis;\n  struct linprm affine;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (lin == 0x0) return LINERR_NULL_POINTER;\n  err = &(lin->err);\n\n  naxis = lin->naxis;\n\n  if (nsamp) *nsamp = 0;\n  for (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    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  affine.flag = -1;\n  if ((status = (lincpy(1, lin, &affine) ||\n                 lindis(1, &affine, 0x0) ||\n                 lindis(2, &affine, 0x0) ||\n                 linset(&affine)))) {\n    return wcserr_set(LIN_ERRMSG(status));\n  }\n\n  /* Work out increments on each axis. */\n  pixinc = lin->tmpcrd;\n  for (j = 0; j < naxis; j++) {\n    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  /* Get memory for processing the image row by row. */\n  if ((pix0 = calloc((3*ncoord+4)*naxis, sizeof(double))) == 0x0) {\n    return wcserr_set(LIN_ERRMSG(LINERR_MEMORY));\n  }\n\n  img    = pix0 + naxis*ncoord;\n  pix1   = img  + naxis*ncoord;\n  pixinc = pix1 + naxis*ncoord;\n  pixend = pixinc + naxis;\n  sumdis = pixend + naxis;\n  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 (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  pix0p = pix0 + naxis;\n  for (i = 1; i < ncoord; i++) {\n    *(pix0p++) = pix0[0] + i*pixinc[0];\n\n    for (j = 1; j < naxis; j++) {\n      *(pix0p++) = pix0[j];\n    }\n  }\n\n  /* Initialize accumulators. */\n  for (j = 0; j < naxis; j++) {\n    sumdis[j] = 0.0;\n    ssqdis[j] = 0.0;\n  }\n  sumtot = 0.0;\n  ssqtot = 0.0;\n\n\n  /* Loop over N dimensions. */\n  carry = 0;\n  while (carry == 0) {\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    pix0p = pix0;\n    pix1p = pix1;\n    for (i = 0; i < ncoord; i++) {\n      (*nsamp)++;\n\n      dssq = 0.0;\n      for (j = 0; j < naxis; j++) {\n        dpix = *(pix1p++) - *(pix0p++);\n        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      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 (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 (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 (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 matinv(int n, const double mat[], double inv[])\n\n{\n  register int i, ij, ik, j, k, kj, pj;\n  int    itemp, *mxl, *lxm, pivot;\n  double colmax, *lu, *rowmax, dtemp;\n\n\n  /* Allocate memory for internal arrays. */\n  if ((mxl = calloc(n, sizeof(int))) == 0x0) {\n    return LINERR_MEMORY;\n  }\n  if ((lxm = calloc(n, sizeof(int))) == 0x0) {\n    free(mxl);\n    return LINERR_MEMORY;\n  }\n\n  if ((rowmax = calloc(n, sizeof(double))) == 0x0) {\n    free(mxl);\n    free(lxm);\n    return LINERR_MEMORY;\n  }\n\n  if ((lu = calloc(n*n, sizeof(double))) == 0x0) {\n    free(mxl);\n    free(lxm);\n    free(rowmax);\n    return LINERR_MEMORY;\n  }\n\n\n  /* Initialize arrays. */\n  for (i = 0, ij = 0; i < n; i++) {\n    /* Vector that records row interchanges. */\n    mxl[i] = i;\n\n    rowmax[i] = 0.0;\n\n    for (j = 0; j < n; j++, ij++) {\n      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 (k = 0; k < n; k++) {\n    /* Decide whether to pivot. */\n    colmax = fabs(lu[k*n+k]) / rowmax[k];\n    pivot = k;\n\n    for (i = k+1; i < n; i++) {\n      ik = i*n + k;\n      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      for (j = 0, pj = pivot*n, kj = k*n; j < n; j++, pj++, kj++) {\n        dtemp = lu[pj];\n        lu[pj] = lu[kj];\n        lu[kj] = dtemp;\n      }\n\n      /* Amend the vector of row maxima. */\n      dtemp = rowmax[pivot];\n      rowmax[pivot] = rowmax[k];\n      rowmax[k] = dtemp;\n\n      /* Record the interchange for later use. */\n      itemp = mxl[pivot];\n      mxl[pivot] = mxl[k];\n      mxl[k] = itemp;\n    }\n\n    /* Gaussian elimination. */\n    for (i = k+1; i < n; i++) {\n      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 (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 (i = 0; i < n; i++) {\n    lxm[mxl[i]] = i;\n  }\n\n\n  /* Determine the inverse matrix. */\n  for (i = 0, ij = 0; i < n; i++) {\n    for (j = 0; j < n; j++, ij++) {\n      inv[ij] = 0.0;\n    }\n  }\n\n  for (k = 0; k < n; k++) {\n    inv[lxm[k]*n+k] = 1.0;\n\n    /* Forward substitution. */\n    for (i = lxm[k]+1; i < n; i++) {\n      for (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 (i = n-1; i >= 0; i--) {\n      for (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"},{"attributeType":"ConfigItem","col":4,"comment":"null","endLoc":34,"id":13606,"name":"grid_samples","nodeType":"Attribute","startLoc":34,"text":"grid_samples"},{"id":13607,"name":"ltmain.sh","nodeType":"TextFile","path":"cextern/expat/conftools","text":"\n# libtool (GNU libtool) 2.4\n# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996\n\n# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,\n# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.\n# This is free software; see the source for copying conditions.  There is NO\n# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n# GNU Libtool 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 2 of the License, or\n# (at your option) any later version.\n#\n# As a special exception to the GNU General Public License,\n# if you distribute this file as part of a program or library that\n# is built using GNU Libtool, you may include this file under the\n# same distribution terms that you use for the rest of that program.\n#\n# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy\n# can be downloaded from http://www.gnu.org/licenses/gpl.html,\n# or obtained by writing to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n# Usage: $progname [OPTION]... [MODE-ARG]...\n#\n# Provide generalized library-building support services.\n#\n#       --config             show all configuration variables\n#       --debug              enable verbose shell tracing\n#   -n, --dry-run            display commands without modifying any files\n#       --features           display basic configuration information and exit\n#       --mode=MODE          use operation mode MODE\n#       --preserve-dup-deps  don't remove duplicate dependency libraries\n#       --quiet, --silent    don't print informational messages\n#       --no-quiet, --no-silent\n#                            print informational messages (default)\n#       --tag=TAG            use configuration variables from tag TAG\n#   -v, --verbose            print more informational messages than default\n#       --no-verbose         don't print the extra informational messages\n#       --version            print version information\n#   -h, --help, --help-all   print short, long, or detailed help message\n#\n# MODE must be one of the following:\n#\n#         clean              remove files from the build directory\n#         compile            compile a source file into a libtool object\n#         execute            automatically set library path, then run a program\n#         finish             complete the installation of libtool libraries\n#         install            install libraries or executables\n#         link               create a library or an executable\n#         uninstall          remove libraries from an installed directory\n#\n# MODE-ARGS vary depending on the MODE.  When passed as first option,\n# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.\n# Try `$progname --help --mode=MODE' for a more detailed description of MODE.\n#\n# When reporting a bug, please describe a test case to reproduce it and\n# include the following information:\n#\n#         host-triplet:\t$host\n#         shell:\t\t$SHELL\n#         compiler:\t\t$LTCC\n#         compiler flags:\t\t$LTCFLAGS\n#         linker:\t\t$LD (gnu? $with_gnu_ld)\n#         $progname:\t(GNU libtool) 2.4 Debian-2.4-2ubuntu1\n#         automake:\t$automake_version\n#         autoconf:\t$autoconf_version\n#\n# Report bugs to <bug-libtool@gnu.org>.\n# GNU libtool home page: <http://www.gnu.org/software/libtool/>.\n# General help using GNU software: <http://www.gnu.org/gethelp/>.\n\nPROGRAM=libtool\nPACKAGE=libtool\nVERSION=\"2.4 Debian-2.4-2ubuntu1\"\nTIMESTAMP=\"\"\npackage_revision=1.3293\n\n# Be Bourne compatible\nif test -n \"${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on ${1+\"$@\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '${1+\"$@\"}'='\"$@\"'\n  setopt NO_GLOB_SUBST\nelse\n  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n$1\n_LTECHO_EOF'\n}\n\n# NLS nuisances: We save the old values to restore during execute mode.\nlt_user_locale=\nlt_safe_locale=\nfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\ndo\n  eval \"if test \\\"\\${$lt_var+set}\\\" = set; then\n          save_$lt_var=\\$$lt_var\n          $lt_var=C\n\t  export $lt_var\n\t  lt_user_locale=\\\"$lt_var=\\\\\\$save_\\$lt_var; \\$lt_user_locale\\\"\n\t  lt_safe_locale=\\\"$lt_var=C; \\$lt_safe_locale\\\"\n\tfi\"\ndone\nLC_ALL=C\nLANGUAGE=C\nexport LANGUAGE LC_ALL\n\n$lt_unset CDPATH\n\n\n# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh\n# is ksh but when the shell is invoked as \"sh\" and the current value of\n# the _XPG environment variable is not equal to 1 (one), the special\n# positional parameter $0, within a function call, is the name of the\n# function.\nprogpath=\"$0\"\n\n\n\n: ${CP=\"cp -f\"}\ntest \"${ECHO+set}\" = set || ECHO=${as_echo-'printf %s\\n'}\n: ${EGREP=\"/bin/grep -E\"}\n: ${FGREP=\"/bin/grep -F\"}\n: ${GREP=\"/bin/grep\"}\n: ${LN_S=\"ln -s\"}\n: ${MAKE=\"make\"}\n: ${MKDIR=\"mkdir\"}\n: ${MV=\"mv -f\"}\n: ${RM=\"rm -f\"}\n: ${SED=\"/bin/sed\"}\n: ${SHELL=\"${CONFIG_SHELL-/bin/sh}\"}\n: ${Xsed=\"$SED -e 1s/^X//\"}\n\n# Global variables:\nEXIT_SUCCESS=0\nEXIT_FAILURE=1\nEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.\nEXIT_SKIP=77\t  # $? = 77 is used to indicate a skipped test to automake.\n\nexit_status=$EXIT_SUCCESS\n\n# Make sure IFS has a sensible default\nlt_nl='\n'\nIFS=\" \t$lt_nl\"\n\ndirname=\"s,/[^/]*$,,\"\nbasename=\"s,^.*/,,\"\n\n# func_dirname file append nondir_replacement\n# Compute the dirname of FILE.  If nonempty, add APPEND to the result,\n# otherwise set result to NONDIR_REPLACEMENT.\nfunc_dirname ()\n{\n    func_dirname_result=`$ECHO \"${1}\" | $SED \"$dirname\"`\n    if test \"X$func_dirname_result\" = \"X${1}\"; then\n      func_dirname_result=\"${3}\"\n    else\n      func_dirname_result=\"$func_dirname_result${2}\"\n    fi\n} # func_dirname may be replaced by extended shell implementation\n\n\n# func_basename file\nfunc_basename ()\n{\n    func_basename_result=`$ECHO \"${1}\" | $SED \"$basename\"`\n} # func_basename may be replaced by extended shell implementation\n\n\n# func_dirname_and_basename file append nondir_replacement\n# perform func_basename and func_dirname in a single function\n# call:\n#   dirname:  Compute the dirname of FILE.  If nonempty,\n#             add APPEND to the result, otherwise set result\n#             to NONDIR_REPLACEMENT.\n#             value returned in \"$func_dirname_result\"\n#   basename: Compute filename of FILE.\n#             value retuned in \"$func_basename_result\"\n# Implementation must be kept synchronized with func_dirname\n# and func_basename. For efficiency, we do not delegate to\n# those functions but instead duplicate the functionality here.\nfunc_dirname_and_basename ()\n{\n    # Extract subdirectory from the argument.\n    func_dirname_result=`$ECHO \"${1}\" | $SED -e \"$dirname\"`\n    if test \"X$func_dirname_result\" = \"X${1}\"; then\n      func_dirname_result=\"${3}\"\n    else\n      func_dirname_result=\"$func_dirname_result${2}\"\n    fi\n    func_basename_result=`$ECHO \"${1}\" | $SED -e \"$basename\"`\n} # func_dirname_and_basename may be replaced by extended shell implementation\n\n\n# func_stripname prefix suffix name\n# strip PREFIX and SUFFIX off of NAME.\n# PREFIX and SUFFIX must not contain globbing or regex special\n# characters, hashes, percent signs, but SUFFIX may contain a leading\n# dot (in which case that matches only a dot).\n# func_strip_suffix prefix name\nfunc_stripname ()\n{\n    case ${2} in\n      .*) func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%\\\\\\\\${2}\\$%%\"`;;\n      *)  func_stripname_result=`$ECHO \"${3}\" | $SED \"s%^${1}%%; s%${2}\\$%%\"`;;\n    esac\n} # func_stripname may be replaced by extended shell implementation\n\n\n# These SED scripts presuppose an absolute path with a trailing slash.\npathcar='s,^/\\([^/]*\\).*$,\\1,'\npathcdr='s,^/[^/]*,,'\nremovedotparts=':dotsl\n\t\ts@/\\./@/@g\n\t\tt dotsl\n\t\ts,/\\.$,/,'\ncollapseslashes='s@/\\{1,\\}@/@g'\nfinalslash='s,/*$,/,'\n\n# func_normal_abspath PATH\n# Remove doubled-up and trailing slashes, \".\" path components,\n# and cancel out any \"..\" path components in PATH after making\n# it an absolute path.\n#             value returned in \"$func_normal_abspath_result\"\nfunc_normal_abspath ()\n{\n  # Start from root dir and reassemble the path.\n  func_normal_abspath_result=\n  func_normal_abspath_tpath=$1\n  func_normal_abspath_altnamespace=\n  case $func_normal_abspath_tpath in\n    \"\")\n      # Empty path, that just means $cwd.\n      func_stripname '' '/' \"`pwd`\"\n      func_normal_abspath_result=$func_stripname_result\n      return\n    ;;\n    # The next three entries are used to spot a run of precisely\n    # two leading slashes without using negated character classes;\n    # we take advantage of case's first-match behaviour.\n    ///*)\n      # Unusual form of absolute path, do nothing.\n    ;;\n    //*)\n      # Not necessarily an ordinary path; POSIX reserves leading '//'\n      # and for example Cygwin uses it to access remote file shares\n      # over CIFS/SMB, so we conserve a leading double slash if found.\n      func_normal_abspath_altnamespace=/\n    ;;\n    /*)\n      # Absolute path, do nothing.\n    ;;\n    *)\n      # Relative path, prepend $cwd.\n      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath\n    ;;\n  esac\n  # Cancel out all the simple stuff to save iterations.  We also want\n  # the path to end with a slash for ease of parsing, so make sure\n  # there is one (and only one) here.\n  func_normal_abspath_tpath=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$removedotparts\" -e \"$collapseslashes\" -e \"$finalslash\"`\n  while :; do\n    # Processed it all yet?\n    if test \"$func_normal_abspath_tpath\" = / ; then\n      # If we ascended to the root using \"..\" the result may be empty now.\n      if test -z \"$func_normal_abspath_result\" ; then\n        func_normal_abspath_result=/\n      fi\n      break\n    fi\n    func_normal_abspath_tcomponent=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$pathcar\"`\n    func_normal_abspath_tpath=`$ECHO \"$func_normal_abspath_tpath\" | $SED \\\n        -e \"$pathcdr\"`\n    # Figure out what to do with it\n    case $func_normal_abspath_tcomponent in\n      \"\")\n        # Trailing empty path component, ignore it.\n      ;;\n      ..)\n        # Parent dir; strip last assembled component from result.\n        func_dirname \"$func_normal_abspath_result\"\n        func_normal_abspath_result=$func_dirname_result\n      ;;\n      *)\n        # Actual path component, append it.\n        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent\n      ;;\n    esac\n  done\n  # Restore leading double-slash if one was found on entry.\n  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result\n}\n\n# func_relative_path SRCDIR DSTDIR\n# generates a relative path from SRCDIR to DSTDIR, with a trailing\n# slash if non-empty, suitable for immediately appending a filename\n# without needing to append a separator.\n#             value returned in \"$func_relative_path_result\"\nfunc_relative_path ()\n{\n  func_relative_path_result=\n  func_normal_abspath \"$1\"\n  func_relative_path_tlibdir=$func_normal_abspath_result\n  func_normal_abspath \"$2\"\n  func_relative_path_tbindir=$func_normal_abspath_result\n\n  # Ascend the tree starting from libdir\n  while :; do\n    # check if we have found a prefix of bindir\n    case $func_relative_path_tbindir in\n      $func_relative_path_tlibdir)\n        # found an exact match\n        func_relative_path_tcancelled=\n        break\n        ;;\n      $func_relative_path_tlibdir*)\n        # found a matching prefix\n        func_stripname \"$func_relative_path_tlibdir\" '' \"$func_relative_path_tbindir\"\n        func_relative_path_tcancelled=$func_stripname_result\n        if test -z \"$func_relative_path_result\"; then\n          func_relative_path_result=.\n        fi\n        break\n        ;;\n      *)\n        func_dirname $func_relative_path_tlibdir\n        func_relative_path_tlibdir=${func_dirname_result}\n        if test \"x$func_relative_path_tlibdir\" = x ; then\n          # Have to descend all the way to the root!\n          func_relative_path_result=../$func_relative_path_result\n          func_relative_path_tcancelled=$func_relative_path_tbindir\n          break\n        fi\n        func_relative_path_result=../$func_relative_path_result\n        ;;\n    esac\n  done\n\n  # Now calculate path; take care to avoid doubling-up slashes.\n  func_stripname '' '/' \"$func_relative_path_result\"\n  func_relative_path_result=$func_stripname_result\n  func_stripname '/' '/' \"$func_relative_path_tcancelled\"\n  if test \"x$func_stripname_result\" != x ; then\n    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}\n  fi\n\n  # Normalisation. If bindir is libdir, return empty string,\n  # else relative path ending with a slash; either way, target\n  # file name can be directly appended.\n  if test ! -z \"$func_relative_path_result\"; then\n    func_stripname './' '' \"$func_relative_path_result/\"\n    func_relative_path_result=$func_stripname_result\n  fi\n}\n\n# The name of this program:\nfunc_dirname_and_basename \"$progpath\"\nprogname=$func_basename_result\n\n# Make sure we have an absolute path for reexecution:\ncase $progpath in\n  [\\\\/]*|[A-Za-z]:\\\\*) ;;\n  *[\\\\/]*)\n     progdir=$func_dirname_result\n     progdir=`cd \"$progdir\" && pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\n  *)\n     save_IFS=\"$IFS\"\n     IFS=:\n     for progdir in $PATH; do\n       IFS=\"$save_IFS\"\n       test -x \"$progdir/$progname\" && break\n     done\n     IFS=\"$save_IFS\"\n     test -n \"$progdir\" || progdir=`pwd`\n     progpath=\"$progdir/$progname\"\n     ;;\nesac\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nXsed=\"${SED}\"' -e 1s/^X//'\nsed_quote_subst='s/\\([`\"$\\\\]\\)/\\\\\\1/g'\n\n# Same as above, but do not quote variable references.\ndouble_quote_subst='s/\\([\"`\\\\]\\)/\\\\\\1/g'\n\n# Sed substitution that turns a string into a regex matching for the\n# string literally.\nsed_make_literal_regex='s,[].[^$\\\\*\\/],\\\\&,g'\n\n# Sed substitution that converts a w32 file name or path\n# which contains forward slashes, into one that contains\n# (escaped) backslashes.  A very naive implementation.\nlt_sed_naive_backslashify='s|\\\\\\\\*|\\\\|g;s|/|\\\\|g;s|\\\\|\\\\\\\\|g'\n\n# Re-`\\' parameter expansions in output of double_quote_subst that were\n# `\\'-ed in input to the same.  If an odd number of `\\' preceded a '$'\n# in input to double_quote_subst, that '$' was protected from expansion.\n# Since each input `\\' is now two `\\'s, look for any number of runs of\n# four `\\'s followed by two `\\'s and then a '$'.  `\\' that '$'.\nbs='\\\\'\nbs2='\\\\\\\\'\nbs4='\\\\\\\\\\\\\\\\'\ndollar='\\$'\nsed_double_backslash=\"\\\n  s/$bs4/&\\\\\n/g\n  s/^$bs2$dollar/$bs&/\n  s/\\\\([^$bs]\\\\)$bs2$dollar/\\\\1$bs2$bs$dollar/g\n  s/\\n//g\"\n\n# Standard options:\nopt_dry_run=false\nopt_help=false\nopt_quiet=false\nopt_verbose=false\nopt_warning=:\n\n# func_echo arg...\n# Echo program name prefixed message, along with the current mode\n# name if it has been set yet.\nfunc_echo ()\n{\n    $ECHO \"$progname: ${opt_mode+$opt_mode: }$*\"\n}\n\n# func_verbose arg...\n# Echo program name prefixed message in verbose mode only.\nfunc_verbose ()\n{\n    $opt_verbose && func_echo ${1+\"$@\"}\n\n    # A bug in bash halts the script if the last line of a function\n    # fails when set -e is in force, so we need another command to\n    # work around that:\n    :\n}\n\n# func_echo_all arg...\n# Invoke $ECHO with all args, space-separated.\nfunc_echo_all ()\n{\n    $ECHO \"$*\"\n}\n\n# func_error arg...\n# Echo program name prefixed message to standard error.\nfunc_error ()\n{\n    $ECHO \"$progname: ${opt_mode+$opt_mode: }\"${1+\"$@\"} 1>&2\n}\n\n# func_warning arg...\n# Echo program name prefixed warning message to standard error.\nfunc_warning ()\n{\n    $opt_warning && $ECHO \"$progname: ${opt_mode+$opt_mode: }warning: \"${1+\"$@\"} 1>&2\n\n    # bash bug again:\n    :\n}\n\n# func_fatal_error arg...\n# Echo program name prefixed message to standard error, and exit.\nfunc_fatal_error ()\n{\n    func_error ${1+\"$@\"}\n    exit $EXIT_FAILURE\n}\n\n# func_fatal_help arg...\n# Echo program name prefixed message to standard error, followed by\n# a help hint, and exit.\nfunc_fatal_help ()\n{\n    func_error ${1+\"$@\"}\n    func_fatal_error \"$help\"\n}\nhelp=\"Try \\`$progname --help' for more information.\"  ## default\n\n\n# func_grep expression filename\n# Check whether EXPRESSION matches any line of FILENAME, without output.\nfunc_grep ()\n{\n    $GREP \"$1\" \"$2\" >/dev/null 2>&1\n}\n\n\n# func_mkdir_p directory-path\n# Make sure the entire path to DIRECTORY-PATH is available.\nfunc_mkdir_p ()\n{\n    my_directory_path=\"$1\"\n    my_dir_list=\n\n    if test -n \"$my_directory_path\" && test \"$opt_dry_run\" != \":\"; then\n\n      # Protect directory names starting with `-'\n      case $my_directory_path in\n        -*) my_directory_path=\"./$my_directory_path\" ;;\n      esac\n\n      # While some portion of DIR does not yet exist...\n      while test ! -d \"$my_directory_path\"; do\n        # ...make a list in topmost first order.  Use a colon delimited\n\t# list incase some portion of path contains whitespace.\n        my_dir_list=\"$my_directory_path:$my_dir_list\"\n\n        # If the last portion added has no slash in it, the list is done\n        case $my_directory_path in */*) ;; *) break ;; esac\n\n        # ...otherwise throw away the child directory and loop\n        my_directory_path=`$ECHO \"$my_directory_path\" | $SED -e \"$dirname\"`\n      done\n      my_dir_list=`$ECHO \"$my_dir_list\" | $SED 's,:*$,,'`\n\n      save_mkdir_p_IFS=\"$IFS\"; IFS=':'\n      for my_dir in $my_dir_list; do\n\tIFS=\"$save_mkdir_p_IFS\"\n        # mkdir can fail with a `File exist' error if two processes\n        # try to create one of the directories concurrently.  Don't\n        # stop in that case!\n        $MKDIR \"$my_dir\" 2>/dev/null || :\n      done\n      IFS=\"$save_mkdir_p_IFS\"\n\n      # Bail out if we (or some other process) failed to create a directory.\n      test -d \"$my_directory_path\" || \\\n        func_fatal_error \"Failed to create \\`$1'\"\n    fi\n}\n\n\n# func_mktempdir [string]\n# Make a temporary directory that won't clash with other running\n# libtool processes, and avoids race conditions if possible.  If\n# given, STRING is the basename for that directory.\nfunc_mktempdir ()\n{\n    my_template=\"${TMPDIR-/tmp}/${1-$progname}\"\n\n    if test \"$opt_dry_run\" = \":\"; then\n      # Return a directory name, but don't create it in dry-run mode\n      my_tmpdir=\"${my_template}-$$\"\n    else\n\n      # If mktemp works, use that first and foremost\n      my_tmpdir=`mktemp -d \"${my_template}-XXXXXXXX\" 2>/dev/null`\n\n      if test ! -d \"$my_tmpdir\"; then\n        # Failing that, at least try and use $RANDOM to avoid a race\n        my_tmpdir=\"${my_template}-${RANDOM-0}$$\"\n\n        save_mktempdir_umask=`umask`\n        umask 0077\n        $MKDIR \"$my_tmpdir\"\n        umask $save_mktempdir_umask\n      fi\n\n      # If we're not in dry-run mode, bomb out on failure\n      test -d \"$my_tmpdir\" || \\\n        func_fatal_error \"cannot create temporary directory \\`$my_tmpdir'\"\n    fi\n\n    $ECHO \"$my_tmpdir\"\n}\n\n\n# func_quote_for_eval arg\n# Aesthetically quote ARG to be evaled later.\n# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT\n# is double-quoted, suitable for a subsequent eval, whereas\n# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters\n# which are still active within double quotes backslashified.\nfunc_quote_for_eval ()\n{\n    case $1 in\n      *[\\\\\\`\\\"\\$]*)\n\tfunc_quote_for_eval_unquoted_result=`$ECHO \"$1\" | $SED \"$sed_quote_subst\"` ;;\n      *)\n        func_quote_for_eval_unquoted_result=\"$1\" ;;\n    esac\n\n    case $func_quote_for_eval_unquoted_result in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting, command substitution and and variable\n      # expansion for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        func_quote_for_eval_result=\"\\\"$func_quote_for_eval_unquoted_result\\\"\"\n        ;;\n      *)\n        func_quote_for_eval_result=\"$func_quote_for_eval_unquoted_result\"\n    esac\n}\n\n\n# func_quote_for_expand arg\n# Aesthetically quote ARG to be evaled later; same as above,\n# but do not quote variable references.\nfunc_quote_for_expand ()\n{\n    case $1 in\n      *[\\\\\\`\\\"]*)\n\tmy_arg=`$ECHO \"$1\" | $SED \\\n\t    -e \"$double_quote_subst\" -e \"$sed_double_backslash\"` ;;\n      *)\n        my_arg=\"$1\" ;;\n    esac\n\n    case $my_arg in\n      # Double-quote args containing shell metacharacters to delay\n      # word splitting and command substitution for a subsequent eval.\n      # Many Bourne shells cannot handle close brackets correctly\n      # in scan sets, so we specify it separately.\n      *[\\[\\~\\#\\^\\&\\*\\(\\)\\{\\}\\|\\;\\<\\>\\?\\'\\ \\\t]*|*]*|\"\")\n        my_arg=\"\\\"$my_arg\\\"\"\n        ;;\n    esac\n\n    func_quote_for_expand_result=\"$my_arg\"\n}\n\n\n# func_show_eval cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.\nfunc_show_eval ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$my_cmd\"\n      my_status=$?\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n\n# func_show_eval_locale cmd [fail_exp]\n# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is\n# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP\n# is given, then evaluate it.  Use the saved locale for evaluation.\nfunc_show_eval_locale ()\n{\n    my_cmd=\"$1\"\n    my_fail_exp=\"${2-:}\"\n\n    ${opt_silent-false} || {\n      func_quote_for_expand \"$my_cmd\"\n      eval \"func_echo $func_quote_for_expand_result\"\n    }\n\n    if ${opt_dry_run-false}; then :; else\n      eval \"$lt_user_locale\n\t    $my_cmd\"\n      my_status=$?\n      eval \"$lt_safe_locale\"\n      if test \"$my_status\" -eq 0; then :; else\n\teval \"(exit $my_status); $my_fail_exp\"\n      fi\n    fi\n}\n\n# func_tr_sh\n# Turn $1 into a string suitable for a shell variable name.\n# Result is stored in $func_tr_sh_result.  All characters\n# not in the set a-zA-Z0-9_ are replaced with '_'. Further,\n# if $1 begins with a digit, a '_' is prepended as well.\nfunc_tr_sh ()\n{\n  case $1 in\n  [0-9]* | *[!a-zA-Z0-9_]*)\n    func_tr_sh_result=`$ECHO \"$1\" | $SED 's/^\\([0-9]\\)/_\\1/; s/[^a-zA-Z0-9_]/_/g'`\n    ;;\n  * )\n    func_tr_sh_result=$1\n    ;;\n  esac\n}\n\n\n# func_version\n# Echo version message to standard output and exit.\nfunc_version ()\n{\n    $opt_debug\n\n    $SED -n '/(C)/!b go\n\t:more\n\t/\\./!{\n\t  N\n\t  s/\\n# / /\n\t  b more\n\t}\n\t:go\n\t/^# '$PROGRAM' (GNU /,/# warranty; / {\n        s/^# //\n\ts/^# *$//\n        s/\\((C)\\)[ 0-9,-]*\\( [1-9][0-9]*\\)/\\1\\2/\n        p\n     }' < \"$progpath\"\n     exit $?\n}\n\n# func_usage\n# Echo short help message to standard output and exit.\nfunc_usage ()\n{\n    $opt_debug\n\n    $SED -n '/^# Usage:/,/^#  *.*--help/ {\n        s/^# //\n\ts/^# *$//\n\ts/\\$progname/'$progname'/\n\tp\n    }' < \"$progpath\"\n    echo\n    $ECHO \"run \\`$progname --help | more' for full usage\"\n    exit $?\n}\n\n# func_help [NOEXIT]\n# Echo long help message to standard output and exit,\n# unless 'noexit' is passed as argument.\nfunc_help ()\n{\n    $opt_debug\n\n    $SED -n '/^# Usage:/,/# Report bugs to/ {\n\t:print\n        s/^# //\n\ts/^# *$//\n\ts*\\$progname*'$progname'*\n\ts*\\$host*'\"$host\"'*\n\ts*\\$SHELL*'\"$SHELL\"'*\n\ts*\\$LTCC*'\"$LTCC\"'*\n\ts*\\$LTCFLAGS*'\"$LTCFLAGS\"'*\n\ts*\\$LD*'\"$LD\"'*\n\ts/\\$with_gnu_ld/'\"$with_gnu_ld\"'/\n\ts/\\$automake_version/'\"`(automake --version) 2>/dev/null |$SED 1q`\"'/\n\ts/\\$autoconf_version/'\"`(autoconf --version) 2>/dev/null |$SED 1q`\"'/\n\tp\n\td\n     }\n     /^# .* home page:/b print\n     /^# General help using/b print\n     ' < \"$progpath\"\n    ret=$?\n    if test -z \"$1\"; then\n      exit $ret\n    fi\n}\n\n# func_missing_arg argname\n# Echo program name prefixed message to standard error and set global\n# exit_cmd.\nfunc_missing_arg ()\n{\n    $opt_debug\n\n    func_error \"missing argument for $1.\"\n    exit_cmd=exit\n}\n\n\n# func_split_short_opt shortopt\n# Set func_split_short_opt_name and func_split_short_opt_arg shell\n# variables after splitting SHORTOPT after the 2nd character.\nfunc_split_short_opt ()\n{\n    my_sed_short_opt='1s/^\\(..\\).*$/\\1/;q'\n    my_sed_short_rest='1s/^..\\(.*\\)$/\\1/;q'\n\n    func_split_short_opt_name=`$ECHO \"$1\" | $SED \"$my_sed_short_opt\"`\n    func_split_short_opt_arg=`$ECHO \"$1\" | $SED \"$my_sed_short_rest\"`\n} # func_split_short_opt may be replaced by extended shell implementation\n\n\n# func_split_long_opt longopt\n# Set func_split_long_opt_name and func_split_long_opt_arg shell\n# variables after splitting LONGOPT at the `=' sign.\nfunc_split_long_opt ()\n{\n    my_sed_long_opt='1s/^\\(--[^=]*\\)=.*/\\1/;q'\n    my_sed_long_arg='1s/^--[^=]*=//'\n\n    func_split_long_opt_name=`$ECHO \"$1\" | $SED \"$my_sed_long_opt\"`\n    func_split_long_opt_arg=`$ECHO \"$1\" | $SED \"$my_sed_long_arg\"`\n} # func_split_long_opt may be replaced by extended shell implementation\n\nexit_cmd=:\n\n\n\n\n\nmagic=\"%%%MAGIC variable%%%\"\nmagic_exe=\"%%%MAGIC EXE variable%%%\"\n\n# Global variables.\nnonopt=\npreserve_args=\nlo2o=\"s/\\\\.lo\\$/.${objext}/\"\no2lo=\"s/\\\\.${objext}\\$/.lo/\"\nextracted_archives=\nextracted_serial=0\n\n# If this variable is set in any of the actions, the command in it\n# will be execed at the end.  This prevents here-documents from being\n# left over by shells.\nexec_cmd=\n\n# func_append var value\n# Append VALUE to the end of shell variable VAR.\nfunc_append ()\n{\n    eval \"${1}=\\$${1}\\${2}\"\n} # func_append may be replaced by extended shell implementation\n\n# func_append_quoted var value\n# Quote VALUE and append to the end of shell variable VAR, separated\n# by a space.\nfunc_append_quoted ()\n{\n    func_quote_for_eval \"${2}\"\n    eval \"${1}=\\$${1}\\\\ \\$func_quote_for_eval_result\"\n} # func_append_quoted may be replaced by extended shell implementation\n\n\n# func_arith arithmetic-term...\nfunc_arith ()\n{\n    func_arith_result=`expr \"${@}\"`\n} # func_arith may be replaced by extended shell implementation\n\n\n# func_len string\n# STRING may not start with a hyphen.\nfunc_len ()\n{\n    func_len_result=`expr \"${1}\" : \".*\" 2>/dev/null || echo $max_cmd_len`\n} # func_len may be replaced by extended shell implementation\n\n\n# func_lo2o object\nfunc_lo2o ()\n{\n    func_lo2o_result=`$ECHO \"${1}\" | $SED \"$lo2o\"`\n} # func_lo2o may be replaced by extended shell implementation\n\n\n# func_xform libobj-or-source\nfunc_xform ()\n{\n    func_xform_result=`$ECHO \"${1}\" | $SED 's/\\.[^.]*$/.lo/'`\n} # func_xform may be replaced by extended shell implementation\n\n\n# func_fatal_configuration arg...\n# Echo program name prefixed message to standard error, followed by\n# a configuration failure hint, and exit.\nfunc_fatal_configuration ()\n{\n    func_error ${1+\"$@\"}\n    func_error \"See the $PACKAGE documentation for more information.\"\n    func_fatal_error \"Fatal configuration error.\"\n}\n\n\n# func_config\n# Display the configuration for all the tags in this script.\nfunc_config ()\n{\n    re_begincf='^# ### BEGIN LIBTOOL'\n    re_endcf='^# ### END LIBTOOL'\n\n    # Default configuration.\n    $SED \"1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\\$d\" < \"$progpath\"\n\n    # Now print the configurations for the tags.\n    for tagname in $taglist; do\n      $SED -n \"/$re_begincf TAG CONFIG: $tagname\\$/,/$re_endcf TAG CONFIG: $tagname\\$/p\" < \"$progpath\"\n    done\n\n    exit $?\n}\n\n# func_features\n# Display the features supported by this script.\nfunc_features ()\n{\n    echo \"host: $host\"\n    if test \"$build_libtool_libs\" = yes; then\n      echo \"enable shared libraries\"\n    else\n      echo \"disable shared libraries\"\n    fi\n    if test \"$build_old_libs\" = yes; then\n      echo \"enable static libraries\"\n    else\n      echo \"disable static libraries\"\n    fi\n\n    exit $?\n}\n\n# func_enable_tag tagname\n# Verify that TAGNAME is valid, and either flag an error and exit, or\n# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist\n# variable here.\nfunc_enable_tag ()\n{\n  # Global variable:\n  tagname=\"$1\"\n\n  re_begincf=\"^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\\$\"\n  re_endcf=\"^# ### END LIBTOOL TAG CONFIG: $tagname\\$\"\n  sed_extractcf=\"/$re_begincf/,/$re_endcf/p\"\n\n  # Validate tagname.\n  case $tagname in\n    *[!-_A-Za-z0-9,/]*)\n      func_fatal_error \"invalid tag name: $tagname\"\n      ;;\n  esac\n\n  # Don't test for the \"default\" C tag, as we know it's\n  # there but not specially marked.\n  case $tagname in\n    CC) ;;\n    *)\n      if $GREP \"$re_begincf\" \"$progpath\" >/dev/null 2>&1; then\n\ttaglist=\"$taglist $tagname\"\n\n\t# Evaluate the configuration.  Be careful to quote the path\n\t# and the sed script, to avoid splitting on whitespace, but\n\t# also don't use non-portable quotes within backquotes within\n\t# quotes we have to do it in 2 steps:\n\textractedcf=`$SED -n -e \"$sed_extractcf\" < \"$progpath\"`\n\teval \"$extractedcf\"\n      else\n\tfunc_error \"ignoring unknown tag $tagname\"\n      fi\n      ;;\n  esac\n}\n\n# func_check_version_match\n# Ensure that we are using m4 macros, and libtool script from the same\n# release of libtool.\nfunc_check_version_match ()\n{\n  if test \"$package_revision\" != \"$macro_revision\"; then\n    if test \"$VERSION\" != \"$macro_version\"; then\n      if test -z \"$macro_version\"; then\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from an older release.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      else\n        cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the\n$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.\n$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION\n$progname: and run autoconf again.\n_LT_EOF\n      fi\n    else\n      cat >&2 <<_LT_EOF\n$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,\n$progname: but the definition of this LT_INIT comes from revision $macro_revision.\n$progname: You should recreate aclocal.m4 with macros from revision $package_revision\n$progname: of $PACKAGE $VERSION and run autoconf again.\n_LT_EOF\n    fi\n\n    exit $EXIT_MISMATCH\n  fi\n}\n\n\n# Shorthand for --mode=foo, only valid as the first argument\ncase $1 in\nclean|clea|cle|cl)\n  shift; set dummy --mode clean ${1+\"$@\"}; shift\n  ;;\ncompile|compil|compi|comp|com|co|c)\n  shift; set dummy --mode compile ${1+\"$@\"}; shift\n  ;;\nexecute|execut|execu|exec|exe|ex|e)\n  shift; set dummy --mode execute ${1+\"$@\"}; shift\n  ;;\nfinish|finis|fini|fin|fi|f)\n  shift; set dummy --mode finish ${1+\"$@\"}; shift\n  ;;\ninstall|instal|insta|inst|ins|in|i)\n  shift; set dummy --mode install ${1+\"$@\"}; shift\n  ;;\nlink|lin|li|l)\n  shift; set dummy --mode link ${1+\"$@\"}; shift\n  ;;\nuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)\n  shift; set dummy --mode uninstall ${1+\"$@\"}; shift\n  ;;\nesac\n\n\n\n# Option defaults:\nopt_debug=:\nopt_dry_run=false\nopt_config=false\nopt_preserve_dup_deps=false\nopt_features=false\nopt_finish=false\nopt_help=false\nopt_help_all=false\nopt_silent=:\nopt_verbose=:\nopt_silent=false\nopt_verbose=false\n\n\n# Parse options once, thoroughly.  This comes as soon as possible in the\n# script to make things like `--version' happen as quickly as we can.\n{\n  # this just eases exit handling\n  while test $# -gt 0; do\n    opt=\"$1\"\n    shift\n    case $opt in\n      --debug|-x)\topt_debug='set -x'\n\t\t\tfunc_echo \"enabling shell trace mode\"\n\t\t\t$opt_debug\n\t\t\t;;\n      --dry-run|--dryrun|-n)\n\t\t\topt_dry_run=:\n\t\t\t;;\n      --config)\n\t\t\topt_config=:\nfunc_config\n\t\t\t;;\n      --dlopen|-dlopen)\n\t\t\toptarg=\"$1\"\n\t\t\topt_dlopen=\"${opt_dlopen+$opt_dlopen\n}$optarg\"\n\t\t\tshift\n\t\t\t;;\n      --preserve-dup-deps)\n\t\t\topt_preserve_dup_deps=:\n\t\t\t;;\n      --features)\n\t\t\topt_features=:\nfunc_features\n\t\t\t;;\n      --finish)\n\t\t\topt_finish=:\nset dummy --mode finish ${1+\"$@\"}; shift\n\t\t\t;;\n      --help)\n\t\t\topt_help=:\n\t\t\t;;\n      --help-all)\n\t\t\topt_help_all=:\nopt_help=': help-all'\n\t\t\t;;\n      --mode)\n\t\t\ttest $# = 0 && func_missing_arg $opt && break\n\t\t\toptarg=\"$1\"\n\t\t\topt_mode=\"$optarg\"\ncase $optarg in\n  # Valid mode arguments:\n  clean|compile|execute|finish|install|link|relink|uninstall) ;;\n\n  # Catch anything else as an error\n  *) func_error \"invalid argument for $opt\"\n     exit_cmd=exit\n     break\n     ;;\nesac\n\t\t\tshift\n\t\t\t;;\n      --no-silent|--no-quiet)\n\t\t\topt_silent=false\nfunc_append preserve_args \" $opt\"\n\t\t\t;;\n      --no-verbose)\n\t\t\topt_verbose=false\nfunc_append preserve_args \" $opt\"\n\t\t\t;;\n      --silent|--quiet)\n\t\t\topt_silent=:\nfunc_append preserve_args \" $opt\"\n        opt_verbose=false\n\t\t\t;;\n      --verbose|-v)\n\t\t\topt_verbose=:\nfunc_append preserve_args \" $opt\"\nopt_silent=false\n\t\t\t;;\n      --tag)\n\t\t\ttest $# = 0 && func_missing_arg $opt && break\n\t\t\toptarg=\"$1\"\n\t\t\topt_tag=\"$optarg\"\nfunc_append preserve_args \" $opt $optarg\"\nfunc_enable_tag \"$optarg\"\n\t\t\tshift\n\t\t\t;;\n\n      -\\?|-h)\t\tfunc_usage\t\t\t\t;;\n      --help)\t\tfunc_help\t\t\t\t;;\n      --version)\tfunc_version\t\t\t\t;;\n\n      # Separate optargs to long options:\n      --*=*)\n\t\t\tfunc_split_long_opt \"$opt\"\n\t\t\tset dummy \"$func_split_long_opt_name\" \"$func_split_long_opt_arg\" ${1+\"$@\"}\n\t\t\tshift\n\t\t\t;;\n\n      # Separate non-argument short options:\n      -\\?*|-h*|-n*|-v*)\n\t\t\tfunc_split_short_opt \"$opt\"\n\t\t\tset dummy \"$func_split_short_opt_name\" \"-$func_split_short_opt_arg\" ${1+\"$@\"}\n\t\t\tshift\n\t\t\t;;\n\n      --)\t\tbreak\t\t\t\t\t;;\n      -*)\t\tfunc_fatal_help \"unrecognized option \\`$opt'\" ;;\n      *)\t\tset dummy \"$opt\" ${1+\"$@\"};\tshift; break  ;;\n    esac\n  done\n\n  # Validate options:\n\n  # save first non-option argument\n  if test \"$#\" -gt 0; then\n    nonopt=\"$opt\"\n    shift\n  fi\n\n  # preserve --debug\n  test \"$opt_debug\" = : || func_append preserve_args \" --debug\"\n\n  case $host in\n    *cygwin* | *mingw* | *pw32* | *cegcc*)\n      # don't eliminate duplications in $postdeps and $predeps\n      opt_duplicate_compiler_generated_deps=:\n      ;;\n    *)\n      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps\n      ;;\n  esac\n\n  $opt_help || {\n    # Sanity checks first:\n    func_check_version_match\n\n    if test \"$build_libtool_libs\" != yes && test \"$build_old_libs\" != yes; then\n      func_fatal_configuration \"not configured to build any kind of library\"\n    fi\n\n    # Darwin sucks\n    eval std_shrext=\\\"$shrext_cmds\\\"\n\n    # Only execute mode is allowed to have -dlopen flags.\n    if test -n \"$opt_dlopen\" && test \"$opt_mode\" != execute; then\n      func_error \"unrecognized option \\`-dlopen'\"\n      $ECHO \"$help\" 1>&2\n      exit $EXIT_FAILURE\n    fi\n\n    # Change the help message to a mode-specific one.\n    generic_help=\"$help\"\n    help=\"Try \\`$progname --help --mode=$opt_mode' for more information.\"\n  }\n\n\n  # Bail if the options were screwed\n  $exit_cmd $EXIT_FAILURE\n}\n\n\n\n\n## ----------- ##\n##    Main.    ##\n## ----------- ##\n\n# func_lalib_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_lalib_p ()\n{\n    test -f \"$1\" &&\n      $SED -e 4q \"$1\" 2>/dev/null \\\n        | $GREP \"^# Generated by .*$PACKAGE\" > /dev/null 2>&1\n}\n\n# func_lalib_unsafe_p file\n# True iff FILE is a libtool `.la' library or `.lo' object file.\n# This function implements the same check as func_lalib_p without\n# resorting to external programs.  To this end, it redirects stdin and\n# closes it afterwards, without saving the original file descriptor.\n# As a safety measure, use it only where a negative result would be\n# fatal anyway.  Works if `file' does not exist.\nfunc_lalib_unsafe_p ()\n{\n    lalib_p=no\n    if test -f \"$1\" && test -r \"$1\" && exec 5<&0 <\"$1\"; then\n\tfor lalib_p_l in 1 2 3 4\n\tdo\n\t    read lalib_p_line\n\t    case \"$lalib_p_line\" in\n\t\t\\#\\ Generated\\ by\\ *$PACKAGE* ) lalib_p=yes; break;;\n\t    esac\n\tdone\n\texec 0<&5 5<&-\n    fi\n    test \"$lalib_p\" = yes\n}\n\n# func_ltwrapper_script_p file\n# True iff FILE is a libtool wrapper script\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_script_p ()\n{\n    func_lalib_p \"$1\"\n}\n\n# func_ltwrapper_executable_p file\n# True iff FILE is a libtool wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_executable_p ()\n{\n    func_ltwrapper_exec_suffix=\n    case $1 in\n    *.exe) ;;\n    *) func_ltwrapper_exec_suffix=.exe ;;\n    esac\n    $GREP \"$magic_exe\" \"$1$func_ltwrapper_exec_suffix\" >/dev/null 2>&1\n}\n\n# func_ltwrapper_scriptname file\n# Assumes file is an ltwrapper_executable\n# uses $file to determine the appropriate filename for a\n# temporary ltwrapper_script.\nfunc_ltwrapper_scriptname ()\n{\n    func_dirname_and_basename \"$1\" \"\" \".\"\n    func_stripname '' '.exe' \"$func_basename_result\"\n    func_ltwrapper_scriptname_result=\"$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper\"\n}\n\n# func_ltwrapper_p file\n# True iff FILE is a libtool wrapper script or wrapper executable\n# This function is only a basic sanity check; it will hardly flush out\n# determined imposters.\nfunc_ltwrapper_p ()\n{\n    func_ltwrapper_script_p \"$1\" || func_ltwrapper_executable_p \"$1\"\n}\n\n\n# func_execute_cmds commands fail_cmd\n# Execute tilde-delimited COMMANDS.\n# If FAIL_CMD is given, eval that upon failure.\n# FAIL_CMD may read-access the current command in variable CMD!\nfunc_execute_cmds ()\n{\n    $opt_debug\n    save_ifs=$IFS; IFS='~'\n    for cmd in $1; do\n      IFS=$save_ifs\n      eval cmd=\\\"$cmd\\\"\n      func_show_eval \"$cmd\" \"${2-:}\"\n    done\n    IFS=$save_ifs\n}\n\n\n# func_source file\n# Source FILE, adding directory component if necessary.\n# Note that it is not necessary on cygwin/mingw to append a dot to\n# FILE even if both FILE and FILE.exe exist: automatic-append-.exe\n# behavior happens only for exec(3), not for open(2)!  Also, sourcing\n# `FILE.' does not work on cygwin managed mounts.\nfunc_source ()\n{\n    $opt_debug\n    case $1 in\n    */* | *\\\\*)\t. \"$1\" ;;\n    *)\t\t. \"./$1\" ;;\n    esac\n}\n\n\n# func_resolve_sysroot PATH\n# Replace a leading = in PATH with a sysroot.  Store the result into\n# func_resolve_sysroot_result\nfunc_resolve_sysroot ()\n{\n  func_resolve_sysroot_result=$1\n  case $func_resolve_sysroot_result in\n  =*)\n    func_stripname '=' '' \"$func_resolve_sysroot_result\"\n    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result\n    ;;\n  esac\n}\n\n# func_replace_sysroot PATH\n# If PATH begins with the sysroot, replace it with = and\n# store the result into func_replace_sysroot_result.\nfunc_replace_sysroot ()\n{\n  case \"$lt_sysroot:$1\" in\n  ?*:\"$lt_sysroot\"*)\n    func_stripname \"$lt_sysroot\" '' \"$1\"\n    func_replace_sysroot_result=\"=$func_stripname_result\"\n    ;;\n  *)\n    # Including no sysroot.\n    func_replace_sysroot_result=$1\n    ;;\n  esac\n}\n\n# func_infer_tag arg\n# Infer tagged configuration to use if any are available and\n# if one wasn't chosen via the \"--tag\" command line option.\n# Only attempt this if the compiler in the base compile\n# command doesn't match the default compiler.\n# arg is usually of the form 'gcc ...'\nfunc_infer_tag ()\n{\n    $opt_debug\n    if test -n \"$available_tags\" && test -z \"$tagname\"; then\n      CC_quoted=\n      for arg in $CC; do\n\tfunc_append_quoted CC_quoted \"$arg\"\n      done\n      CC_expanded=`func_echo_all $CC`\n      CC_quoted_expanded=`func_echo_all $CC_quoted`\n      case $@ in\n      # Blanks in the command may have been stripped by the calling shell,\n      # but not from the CC environment variable when configure was run.\n      \" $CC \"* | \"$CC \"* | \" $CC_expanded \"* | \"$CC_expanded \"* | \\\n      \" $CC_quoted\"* | \"$CC_quoted \"* | \" $CC_quoted_expanded \"* | \"$CC_quoted_expanded \"*) ;;\n      # Blanks at the start of $base_compile will cause this to fail\n      # if we don't check for them as well.\n      *)\n\tfor z in $available_tags; do\n\t  if $GREP \"^# ### BEGIN LIBTOOL TAG CONFIG: $z$\" < \"$progpath\" > /dev/null; then\n\t    # Evaluate the configuration.\n\t    eval \"`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`\"\n\t    CC_quoted=\n\t    for arg in $CC; do\n\t      # Double-quote args containing other shell metacharacters.\n\t      func_append_quoted CC_quoted \"$arg\"\n\t    done\n\t    CC_expanded=`func_echo_all $CC`\n\t    CC_quoted_expanded=`func_echo_all $CC_quoted`\n\t    case \"$@ \" in\n\t    \" $CC \"* | \"$CC \"* | \" $CC_expanded \"* | \"$CC_expanded \"* | \\\n\t    \" $CC_quoted\"* | \"$CC_quoted \"* | \" $CC_quoted_expanded \"* | \"$CC_quoted_expanded \"*)\n\t      # The compiler in the base compile command matches\n\t      # the one in the tagged configuration.\n\t      # Assume this is the tagged configuration we want.\n\t      tagname=$z\n\t      break\n\t      ;;\n\t    esac\n\t  fi\n\tdone\n\t# If $tagname still isn't set, then no tagged configuration\n\t# was found and let the user know that the \"--tag\" command\n\t# line option must be used.\n\tif test -z \"$tagname\"; then\n\t  func_echo \"unable to infer tagged configuration\"\n\t  func_fatal_error \"specify a tag with \\`--tag'\"\n#\telse\n#\t  func_verbose \"using $tagname tagged configuration\"\n\tfi\n\t;;\n      esac\n    fi\n}\n\n\n\n# func_write_libtool_object output_name pic_name nonpic_name\n# Create a libtool object file (analogous to a \".la\" file),\n# but don't create it if we're doing a dry run.\nfunc_write_libtool_object ()\n{\n    write_libobj=${1}\n    if test \"$build_libtool_libs\" = yes; then\n      write_lobj=\\'${2}\\'\n    else\n      write_lobj=none\n    fi\n\n    if test \"$build_old_libs\" = yes; then\n      write_oldobj=\\'${3}\\'\n    else\n      write_oldobj=none\n    fi\n\n    $opt_dry_run || {\n      cat >${write_libobj}T <<EOF\n# $write_libobj - a libtool object file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# Name of the PIC object.\npic_object=$write_lobj\n\n# Name of the non-PIC object\nnon_pic_object=$write_oldobj\n\nEOF\n      $MV \"${write_libobj}T\" \"${write_libobj}\"\n    }\n}\n\n\n##################################################\n# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #\n##################################################\n\n# func_convert_core_file_wine_to_w32 ARG\n# Helper function used by file name conversion functions when $build is *nix,\n# and $host is mingw, cygwin, or some other w32 environment. Relies on a\n# correctly configured wine environment available, with the winepath program\n# in $build's $PATH.\n#\n# ARG is the $build file name to be converted to w32 format.\n# Result is available in $func_convert_core_file_wine_to_w32_result, and will\n# be empty on error (or when ARG is empty)\nfunc_convert_core_file_wine_to_w32 ()\n{\n  $opt_debug\n  func_convert_core_file_wine_to_w32_result=\"$1\"\n  if test -n \"$1\"; then\n    # Unfortunately, winepath does not exit with a non-zero error code, so we\n    # are forced to check the contents of stdout. On the other hand, if the\n    # command is not found, the shell will set an exit code of 127 and print\n    # *an error message* to stdout. So we must check for both error code of\n    # zero AND non-empty stdout, which explains the odd construction:\n    func_convert_core_file_wine_to_w32_tmp=`winepath -w \"$1\" 2>/dev/null`\n    if test \"$?\" -eq 0 && test -n \"${func_convert_core_file_wine_to_w32_tmp}\"; then\n      func_convert_core_file_wine_to_w32_result=`$ECHO \"$func_convert_core_file_wine_to_w32_tmp\" |\n        $SED -e \"$lt_sed_naive_backslashify\"`\n    else\n      func_convert_core_file_wine_to_w32_result=\n    fi\n  fi\n}\n# end: func_convert_core_file_wine_to_w32\n\n\n# func_convert_core_path_wine_to_w32 ARG\n# Helper function used by path conversion functions when $build is *nix, and\n# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly\n# configured wine environment available, with the winepath program in $build's\n# $PATH. Assumes ARG has no leading or trailing path separator characters.\n#\n# ARG is path to be converted from $build format to win32.\n# Result is available in $func_convert_core_path_wine_to_w32_result.\n# Unconvertible file (directory) names in ARG are skipped; if no directory names\n# are convertible, then the result may be empty.\nfunc_convert_core_path_wine_to_w32 ()\n{\n  $opt_debug\n  # unfortunately, winepath doesn't convert paths, only file names\n  func_convert_core_path_wine_to_w32_result=\"\"\n  if test -n \"$1\"; then\n    oldIFS=$IFS\n    IFS=:\n    for func_convert_core_path_wine_to_w32_f in $1; do\n      IFS=$oldIFS\n      func_convert_core_file_wine_to_w32 \"$func_convert_core_path_wine_to_w32_f\"\n      if test -n \"$func_convert_core_file_wine_to_w32_result\" ; then\n        if test -z \"$func_convert_core_path_wine_to_w32_result\"; then\n          func_convert_core_path_wine_to_w32_result=\"$func_convert_core_file_wine_to_w32_result\"\n        else\n          func_append func_convert_core_path_wine_to_w32_result \";$func_convert_core_file_wine_to_w32_result\"\n        fi\n      fi\n    done\n    IFS=$oldIFS\n  fi\n}\n# end: func_convert_core_path_wine_to_w32\n\n\n# func_cygpath ARGS...\n# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when\n# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)\n# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or\n# (2), returns the Cygwin file name or path in func_cygpath_result (input\n# file name or path is assumed to be in w32 format, as previously converted\n# from $build's *nix or MSYS format). In case (3), returns the w32 file name\n# or path in func_cygpath_result (input file name or path is assumed to be in\n# Cygwin format). Returns an empty string on error.\n#\n# ARGS are passed to cygpath, with the last one being the file name or path to\n# be converted.\n#\n# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH\n# environment variable; do not put it in $PATH.\nfunc_cygpath ()\n{\n  $opt_debug\n  if test -n \"$LT_CYGPATH\" && test -f \"$LT_CYGPATH\"; then\n    func_cygpath_result=`$LT_CYGPATH \"$@\" 2>/dev/null`\n    if test \"$?\" -ne 0; then\n      # on failure, ensure result is empty\n      func_cygpath_result=\n    fi\n  else\n    func_cygpath_result=\n    func_error \"LT_CYGPATH is empty or specifies non-existent file: \\`$LT_CYGPATH'\"\n  fi\n}\n#end: func_cygpath\n\n\n# func_convert_core_msys_to_w32 ARG\n# Convert file name or path ARG from MSYS format to w32 format.  Return\n# result in func_convert_core_msys_to_w32_result.\nfunc_convert_core_msys_to_w32 ()\n{\n  $opt_debug\n  # awkward: cmd appends spaces to result\n  func_convert_core_msys_to_w32_result=`( cmd //c echo \"$1\" ) 2>/dev/null |\n    $SED -e 's/[ ]*$//' -e \"$lt_sed_naive_backslashify\"`\n}\n#end: func_convert_core_msys_to_w32\n\n\n# func_convert_file_check ARG1 ARG2\n# Verify that ARG1 (a file name in $build format) was converted to $host\n# format in ARG2. Otherwise, emit an error message, but continue (resetting\n# func_to_host_file_result to ARG1).\nfunc_convert_file_check ()\n{\n  $opt_debug\n  if test -z \"$2\" && test -n \"$1\" ; then\n    func_error \"Could not determine host file name corresponding to\"\n    func_error \"  \\`$1'\"\n    func_error \"Continuing, but uninstalled executables may not work.\"\n    # Fallback:\n    func_to_host_file_result=\"$1\"\n  fi\n}\n# end func_convert_file_check\n\n\n# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH\n# Verify that FROM_PATH (a path in $build format) was converted to $host\n# format in TO_PATH. Otherwise, emit an error message, but continue, resetting\n# func_to_host_file_result to a simplistic fallback value (see below).\nfunc_convert_path_check ()\n{\n  $opt_debug\n  if test -z \"$4\" && test -n \"$3\"; then\n    func_error \"Could not determine the host path corresponding to\"\n    func_error \"  \\`$3'\"\n    func_error \"Continuing, but uninstalled executables may not work.\"\n    # Fallback.  This is a deliberately simplistic \"conversion\" and\n    # should not be \"improved\".  See libtool.info.\n    if test \"x$1\" != \"x$2\"; then\n      lt_replace_pathsep_chars=\"s|$1|$2|g\"\n      func_to_host_path_result=`echo \"$3\" |\n        $SED -e \"$lt_replace_pathsep_chars\"`\n    else\n      func_to_host_path_result=\"$3\"\n    fi\n  fi\n}\n# end func_convert_path_check\n\n\n# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG\n# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT\n# and appending REPL if ORIG matches BACKPAT.\nfunc_convert_path_front_back_pathsep ()\n{\n  $opt_debug\n  case $4 in\n  $1 ) func_to_host_path_result=\"$3$func_to_host_path_result\"\n    ;;\n  esac\n  case $4 in\n  $2 ) func_append func_to_host_path_result \"$3\"\n    ;;\n  esac\n}\n# end func_convert_path_front_back_pathsep\n\n\n##################################################\n# $build to $host FILE NAME CONVERSION FUNCTIONS #\n##################################################\n# invoked via `$to_host_file_cmd ARG'\n#\n# In each case, ARG is the path to be converted from $build to $host format.\n# Result will be available in $func_to_host_file_result.\n\n\n# func_to_host_file ARG\n# Converts the file name ARG from $build format to $host format. Return result\n# in func_to_host_file_result.\nfunc_to_host_file ()\n{\n  $opt_debug\n  $to_host_file_cmd \"$1\"\n}\n# end func_to_host_file\n\n\n# func_to_tool_file ARG LAZY\n# converts the file name ARG from $build format to toolchain format. Return\n# result in func_to_tool_file_result.  If the conversion in use is listed\n# in (the comma separated) LAZY, no conversion takes place.\nfunc_to_tool_file ()\n{\n  $opt_debug\n  case ,$2, in\n    *,\"$to_tool_file_cmd\",*)\n      func_to_tool_file_result=$1\n      ;;\n    *)\n      $to_tool_file_cmd \"$1\"\n      func_to_tool_file_result=$func_to_host_file_result\n      ;;\n  esac\n}\n# end func_to_tool_file\n\n\n# func_convert_file_noop ARG\n# Copy ARG to func_to_host_file_result.\nfunc_convert_file_noop ()\n{\n  func_to_host_file_result=\"$1\"\n}\n# end func_convert_file_noop\n\n\n# func_convert_file_msys_to_w32 ARG\n# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic\n# conversion to w32 is not available inside the cwrapper.  Returns result in\n# func_to_host_file_result.\nfunc_convert_file_msys_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_msys_to_w32 \"$1\"\n    func_to_host_file_result=\"$func_convert_core_msys_to_w32_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_msys_to_w32\n\n\n# func_convert_file_cygwin_to_w32 ARG\n# Convert file name ARG from Cygwin to w32 format.  Returns result in\n# func_to_host_file_result.\nfunc_convert_file_cygwin_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    # because $build is cygwin, we call \"the\" cygpath in $PATH; no need to use\n    # LT_CYGPATH in this case.\n    func_to_host_file_result=`cygpath -m \"$1\"`\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_cygwin_to_w32\n\n\n# func_convert_file_nix_to_w32 ARG\n# Convert file name ARG from *nix to w32 format.  Requires a wine environment\n# and a working winepath. Returns result in func_to_host_file_result.\nfunc_convert_file_nix_to_w32 ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_file_wine_to_w32 \"$1\"\n    func_to_host_file_result=\"$func_convert_core_file_wine_to_w32_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_nix_to_w32\n\n\n# func_convert_file_msys_to_cygwin ARG\n# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.\n# Returns result in func_to_host_file_result.\nfunc_convert_file_msys_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    func_convert_core_msys_to_w32 \"$1\"\n    func_cygpath -u \"$func_convert_core_msys_to_w32_result\"\n    func_to_host_file_result=\"$func_cygpath_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_msys_to_cygwin\n\n\n# func_convert_file_nix_to_cygwin ARG\n# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed\n# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result\n# in func_to_host_file_result.\nfunc_convert_file_nix_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_file_result=\"$1\"\n  if test -n \"$1\"; then\n    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.\n    func_convert_core_file_wine_to_w32 \"$1\"\n    func_cygpath -u \"$func_convert_core_file_wine_to_w32_result\"\n    func_to_host_file_result=\"$func_cygpath_result\"\n  fi\n  func_convert_file_check \"$1\" \"$func_to_host_file_result\"\n}\n# end func_convert_file_nix_to_cygwin\n\n\n#############################################\n# $build to $host PATH CONVERSION FUNCTIONS #\n#############################################\n# invoked via `$to_host_path_cmd ARG'\n#\n# In each case, ARG is the path to be converted from $build to $host format.\n# The result will be available in $func_to_host_path_result.\n#\n# Path separators are also converted from $build format to $host format.  If\n# ARG begins or ends with a path separator character, it is preserved (but\n# converted to $host format) on output.\n#\n# All path conversion functions are named using the following convention:\n#   file name conversion function    : func_convert_file_X_to_Y ()\n#   path conversion function         : func_convert_path_X_to_Y ()\n# where, for any given $build/$host combination the 'X_to_Y' value is the\n# same.  If conversion functions are added for new $build/$host combinations,\n# the two new functions must follow this pattern, or func_init_to_host_path_cmd\n# will break.\n\n\n# func_init_to_host_path_cmd\n# Ensures that function \"pointer\" variable $to_host_path_cmd is set to the\n# appropriate value, based on the value of $to_host_file_cmd.\nto_host_path_cmd=\nfunc_init_to_host_path_cmd ()\n{\n  $opt_debug\n  if test -z \"$to_host_path_cmd\"; then\n    func_stripname 'func_convert_file_' '' \"$to_host_file_cmd\"\n    to_host_path_cmd=\"func_convert_path_${func_stripname_result}\"\n  fi\n}\n\n\n# func_to_host_path ARG\n# Converts the path ARG from $build format to $host format. Return result\n# in func_to_host_path_result.\nfunc_to_host_path ()\n{\n  $opt_debug\n  func_init_to_host_path_cmd\n  $to_host_path_cmd \"$1\"\n}\n# end func_to_host_path\n\n\n# func_convert_path_noop ARG\n# Copy ARG to func_to_host_path_result.\nfunc_convert_path_noop ()\n{\n  func_to_host_path_result=\"$1\"\n}\n# end func_convert_path_noop\n\n\n# func_convert_path_msys_to_w32 ARG\n# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic\n# conversion to w32 is not available inside the cwrapper.  Returns result in\n# func_to_host_path_result.\nfunc_convert_path_msys_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # Remove leading and trailing path separator characters from ARG.  MSYS\n    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';\n    # and winepath ignores them completely.\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_msys_to_w32 \"$func_to_host_path_tmp1\"\n    func_to_host_path_result=\"$func_convert_core_msys_to_w32_result\"\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_msys_to_w32\n\n\n# func_convert_path_cygwin_to_w32 ARG\n# Convert path ARG from Cygwin to w32 format.  Returns result in\n# func_to_host_file_result.\nfunc_convert_path_cygwin_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_to_host_path_result=`cygpath -m -p \"$func_to_host_path_tmp1\"`\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_cygwin_to_w32\n\n\n# func_convert_path_nix_to_w32 ARG\n# Convert path ARG from *nix to w32 format.  Requires a wine environment and\n# a working winepath.  Returns result in func_to_host_file_result.\nfunc_convert_path_nix_to_w32 ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_path_wine_to_w32 \"$func_to_host_path_tmp1\"\n    func_to_host_path_result=\"$func_convert_core_path_wine_to_w32_result\"\n    func_convert_path_check : \";\" \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" \";\" \"$1\"\n  fi\n}\n# end func_convert_path_nix_to_w32\n\n\n# func_convert_path_msys_to_cygwin ARG\n# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.\n# Returns result in func_to_host_file_result.\nfunc_convert_path_msys_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # See func_convert_path_msys_to_w32:\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_msys_to_w32 \"$func_to_host_path_tmp1\"\n    func_cygpath -u -p \"$func_convert_core_msys_to_w32_result\"\n    func_to_host_path_result=\"$func_cygpath_result\"\n    func_convert_path_check : : \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" : \"$1\"\n  fi\n}\n# end func_convert_path_msys_to_cygwin\n\n\n# func_convert_path_nix_to_cygwin ARG\n# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a\n# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in\n# func_to_host_file_result.\nfunc_convert_path_nix_to_cygwin ()\n{\n  $opt_debug\n  func_to_host_path_result=\"$1\"\n  if test -n \"$1\"; then\n    # Remove leading and trailing path separator characters from\n    # ARG. msys behavior is inconsistent here, cygpath turns them\n    # into '.;' and ';.', and winepath ignores them completely.\n    func_stripname : : \"$1\"\n    func_to_host_path_tmp1=$func_stripname_result\n    func_convert_core_path_wine_to_w32 \"$func_to_host_path_tmp1\"\n    func_cygpath -u -p \"$func_convert_core_path_wine_to_w32_result\"\n    func_to_host_path_result=\"$func_cygpath_result\"\n    func_convert_path_check : : \\\n      \"$func_to_host_path_tmp1\" \"$func_to_host_path_result\"\n    func_convert_path_front_back_pathsep \":*\" \"*:\" : \"$1\"\n  fi\n}\n# end func_convert_path_nix_to_cygwin\n\n\n# func_mode_compile arg...\nfunc_mode_compile ()\n{\n    $opt_debug\n    # Get the compilation command and the source file.\n    base_compile=\n    srcfile=\"$nonopt\"  #  always keep a non-empty value in \"srcfile\"\n    suppress_opt=yes\n    suppress_output=\n    arg_mode=normal\n    libobj=\n    later=\n    pie_flag=\n\n    for arg\n    do\n      case $arg_mode in\n      arg  )\n\t# do not \"continue\".  Instead, add this to base_compile\n\tlastarg=\"$arg\"\n\targ_mode=normal\n\t;;\n\n      target )\n\tlibobj=\"$arg\"\n\targ_mode=normal\n\tcontinue\n\t;;\n\n      normal )\n\t# Accept any command-line options.\n\tcase $arg in\n\t-o)\n\t  test -n \"$libobj\" && \\\n\t    func_fatal_error \"you cannot specify \\`-o' more than once\"\n\t  arg_mode=target\n\t  continue\n\t  ;;\n\n\t-pie | -fpie | -fPIE)\n          func_append pie_flag \" $arg\"\n\t  continue\n\t  ;;\n\n\t-shared | -static | -prefer-pic | -prefer-non-pic)\n\t  func_append later \" $arg\"\n\t  continue\n\t  ;;\n\n\t-no-suppress)\n\t  suppress_opt=no\n\t  continue\n\t  ;;\n\n\t-Xcompiler)\n\t  arg_mode=arg  #  the next one goes into the \"base_compile\" arg list\n\t  continue      #  The current \"srcfile\" will either be retained or\n\t  ;;            #  replaced later.  I would guess that would be a bug.\n\n\t-Wc,*)\n\t  func_stripname '-Wc,' '' \"$arg\"\n\t  args=$func_stripname_result\n\t  lastarg=\n\t  save_ifs=\"$IFS\"; IFS=','\n\t  for arg in $args; do\n\t    IFS=\"$save_ifs\"\n\t    func_append_quoted lastarg \"$arg\"\n\t  done\n\t  IFS=\"$save_ifs\"\n\t  func_stripname ' ' '' \"$lastarg\"\n\t  lastarg=$func_stripname_result\n\n\t  # Add the arguments to base_compile.\n\t  func_append base_compile \" $lastarg\"\n\t  continue\n\t  ;;\n\n\t*)\n\t  # Accept the current argument as the source file.\n\t  # The previous \"srcfile\" becomes the current argument.\n\t  #\n\t  lastarg=\"$srcfile\"\n\t  srcfile=\"$arg\"\n\t  ;;\n\tesac  #  case $arg\n\t;;\n      esac    #  case $arg_mode\n\n      # Aesthetically quote the previous argument.\n      func_append_quoted base_compile \"$lastarg\"\n    done # for arg\n\n    case $arg_mode in\n    arg)\n      func_fatal_error \"you must specify an argument for -Xcompile\"\n      ;;\n    target)\n      func_fatal_error \"you must specify a target with \\`-o'\"\n      ;;\n    *)\n      # Get the name of the library object.\n      test -z \"$libobj\" && {\n\tfunc_basename \"$srcfile\"\n\tlibobj=\"$func_basename_result\"\n      }\n      ;;\n    esac\n\n    # Recognize several different file suffixes.\n    # If the user specifies -o file.o, it is replaced with file.lo\n    case $libobj in\n    *.[cCFSifmso] | \\\n    *.ada | *.adb | *.ads | *.asm | \\\n    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \\\n    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)\n      func_xform \"$libobj\"\n      libobj=$func_xform_result\n      ;;\n    esac\n\n    case $libobj in\n    *.lo) func_lo2o \"$libobj\"; obj=$func_lo2o_result ;;\n    *)\n      func_fatal_error \"cannot determine name of library object from \\`$libobj'\"\n      ;;\n    esac\n\n    func_infer_tag $base_compile\n\n    for arg in $later; do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tcontinue\n\t;;\n\n      -static)\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tcontinue\n\t;;\n\n      -prefer-pic)\n\tpic_mode=yes\n\tcontinue\n\t;;\n\n      -prefer-non-pic)\n\tpic_mode=no\n\tcontinue\n\t;;\n      esac\n    done\n\n    func_quote_for_eval \"$libobj\"\n    test \"X$libobj\" != \"X$func_quote_for_eval_result\" \\\n      && $ECHO \"X$libobj\" | $GREP '[]~#^*{};<>?\"'\"'\"'\t &()|`$[]' \\\n      && func_warning \"libobj name \\`$libobj' may not contain shell special characters.\"\n    func_dirname_and_basename \"$obj\" \"/\" \"\"\n    objname=\"$func_basename_result\"\n    xdir=\"$func_dirname_result\"\n    lobj=${xdir}$objdir/$objname\n\n    test -z \"$base_compile\" && \\\n      func_fatal_help \"you must specify a compilation command\"\n\n    # Delete any leftover library objects.\n    if test \"$build_old_libs\" = yes; then\n      removelist=\"$obj $lobj $libobj ${libobj}T\"\n    else\n      removelist=\"$lobj $libobj ${libobj}T\"\n    fi\n\n    # On Cygwin there's no \"real\" PIC flag so we must build both object types\n    case $host_os in\n    cygwin* | mingw* | pw32* | os2* | cegcc*)\n      pic_mode=default\n      ;;\n    esac\n    if test \"$pic_mode\" = no && test \"$deplibs_check_method\" != pass_all; then\n      # non-PIC code in shared libraries is not supported\n      pic_mode=default\n    fi\n\n    # Calculate the filename of the output object if compiler does\n    # not support -o with -c\n    if test \"$compiler_c_o\" = no; then\n      output_obj=`$ECHO \"$srcfile\" | $SED 's%^.*/%%; s%\\.[^.]*$%%'`.${objext}\n      lockfile=\"$output_obj.lock\"\n    else\n      output_obj=\n      need_locks=no\n      lockfile=\n    fi\n\n    # Lock this critical section if it is needed\n    # We use this script file to make the link, it avoids creating a new file\n    if test \"$need_locks\" = yes; then\n      until $opt_dry_run || ln \"$progpath\" \"$lockfile\" 2>/dev/null; do\n\tfunc_echo \"Waiting for $lockfile to be removed\"\n\tsleep 2\n      done\n    elif test \"$need_locks\" = warn; then\n      if test -f \"$lockfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile exists and contains:\n`cat $lockfile 2>/dev/null`\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n      func_append removelist \" $output_obj\"\n      $ECHO \"$srcfile\" > \"$lockfile\"\n    fi\n\n    $opt_dry_run || $RM $removelist\n    func_append removelist \" $lockfile\"\n    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15\n\n    func_to_tool_file \"$srcfile\" func_convert_file_msys_to_w32\n    srcfile=$func_to_tool_file_result\n    func_quote_for_eval \"$srcfile\"\n    qsrcfile=$func_quote_for_eval_result\n\n    # Only build a PIC object if we are building libtool libraries.\n    if test \"$build_libtool_libs\" = yes; then\n      # Without this assignment, base_compile gets emptied.\n      fbsd_hideous_sh_bug=$base_compile\n\n      if test \"$pic_mode\" != no; then\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      else\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile\"\n      fi\n\n      func_mkdir_p \"$xdir$objdir\"\n\n      if test -z \"$output_obj\"; then\n\t# Place PIC objects in $objdir\n\tfunc_append command \" -o $lobj\"\n      fi\n\n      func_show_eval_locale \"$command\"\t\\\n          'test -n \"$output_obj\" && $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed, then go on to compile the next one\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$lobj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$lobj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n\n      # Allow error messages only from the first compilation.\n      if test \"$suppress_opt\" = yes; then\n\tsuppress_output=' >/dev/null 2>&1'\n      fi\n    fi\n\n    # Only build a position-dependent object if we build old libraries.\n    if test \"$build_old_libs\" = yes; then\n      if test \"$pic_mode\" != yes; then\n\t# Don't build PIC code\n\tcommand=\"$base_compile $qsrcfile$pie_flag\"\n      else\n\tcommand=\"$base_compile $qsrcfile $pic_flag\"\n      fi\n      if test \"$compiler_c_o\" = yes; then\n\tfunc_append command \" -o $obj\"\n      fi\n\n      # Suppress compiler output if we already did a PIC compilation.\n      func_append command \"$suppress_output\"\n      func_show_eval_locale \"$command\" \\\n        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'\n\n      if test \"$need_locks\" = warn &&\n\t test \"X`cat $lockfile 2>/dev/null`\" != \"X$srcfile\"; then\n\t$ECHO \"\\\n*** ERROR, $lockfile contains:\n`cat $lockfile 2>/dev/null`\n\nbut it should contain:\n$srcfile\n\nThis indicates that another process is trying to use the same\ntemporary object file, and libtool could not work around it because\nyour compiler does not support \\`-c' and \\`-o' together.  If you\nrepeat this compilation, it may succeed, by chance, but you had better\navoid parallel builds (make -j) in this platform, or get a better\ncompiler.\"\n\n\t$opt_dry_run || $RM $removelist\n\texit $EXIT_FAILURE\n      fi\n\n      # Just move the object if needed\n      if test -n \"$output_obj\" && test \"X$output_obj\" != \"X$obj\"; then\n\tfunc_show_eval '$MV \"$output_obj\" \"$obj\"' \\\n\t  'error=$?; $opt_dry_run || $RM $removelist; exit $error'\n      fi\n    fi\n\n    $opt_dry_run || {\n      func_write_libtool_object \"$libobj\" \"$objdir/$objname\" \"$objname\"\n\n      # Unlock the critical section if it was locked\n      if test \"$need_locks\" != no; then\n\tremovelist=$lockfile\n        $RM \"$lockfile\"\n      fi\n    }\n\n    exit $EXIT_SUCCESS\n}\n\n$opt_help || {\n  test \"$opt_mode\" = compile && func_mode_compile ${1+\"$@\"}\n}\n\nfunc_mode_help ()\n{\n    # We need to display help for each of the modes.\n    case $opt_mode in\n      \"\")\n        # Generic help is extracted from the usage comments\n        # at the start of this file.\n        func_help\n        ;;\n\n      clean)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...\n\nRemove files from the build directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, object or program, all the files associated\nwith it are deleted. Otherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      compile)\n      $ECHO \\\n\"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE\n\nCompile a source file into a libtool library object.\n\nThis mode accepts the following additional options:\n\n  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE\n  -no-suppress      do not suppress compiler output for multiple passes\n  -prefer-pic       try to build PIC objects only\n  -prefer-non-pic   try to build non-PIC objects only\n  -shared           do not build a \\`.o' file suitable for static linking\n  -static           only build a \\`.o' file suitable for static linking\n  -Wc,FLAG          pass FLAG directly to the compiler\n\nCOMPILE-COMMAND is a command to be used in creating a \\`standard' object file\nfrom the given SOURCEFILE.\n\nThe output file name is determined by removing the directory component from\nSOURCEFILE, then substituting the C source code suffix \\`.c' with the\nlibrary object suffix, \\`.lo'.\"\n        ;;\n\n      execute)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...\n\nAutomatically set library path, then run a program.\n\nThis mode accepts the following additional options:\n\n  -dlopen FILE      add the directory containing FILE to the library path\n\nThis mode sets the library path environment variable according to \\`-dlopen'\nflags.\n\nIf any of the ARGS are libtool executable wrappers, then they are translated\ninto their corresponding uninstalled binary, and any of their required library\ndirectories are added to the library path.\n\nThen, COMMAND is executed, with ARGS as arguments.\"\n        ;;\n\n      finish)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...\n\nComplete the installation of libtool libraries.\n\nEach LIBDIR is a directory that contains libtool libraries.\n\nThe commands that this mode executes may require superuser privileges.  Use\nthe \\`--dry-run' option if you just want to see what would be executed.\"\n        ;;\n\n      install)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...\n\nInstall executables or libraries.\n\nINSTALL-COMMAND is the installation command.  The first component should be\neither the \\`install' or \\`cp' program.\n\nThe following components of INSTALL-COMMAND are treated specially:\n\n  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation\n\nThe rest of the components are interpreted as arguments to that command (only\nBSD-compatible install options are recognized).\"\n        ;;\n\n      link)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...\n\nLink object files or libraries together to form another library, or to\ncreate an executable program.\n\nLINK-COMMAND is a command using the C compiler that you would use to create\na program from several object files.\n\nThe following components of LINK-COMMAND are treated specially:\n\n  -all-static       do not do any dynamic linking at all\n  -avoid-version    do not add a version suffix if possible\n  -bindir BINDIR    specify path to binaries directory (for systems where\n                    libraries must be found in the PATH setting at runtime)\n  -dlopen FILE      \\`-dlpreopen' FILE if it cannot be dlopened at runtime\n  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols\n  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)\n  -export-symbols SYMFILE\n                    try to export only the symbols listed in SYMFILE\n  -export-symbols-regex REGEX\n                    try to export only the symbols matching REGEX\n  -LLIBDIR          search LIBDIR for required installed libraries\n  -lNAME            OUTPUT-FILE requires the installed library libNAME\n  -module           build a library that can dlopened\n  -no-fast-install  disable the fast-install mode\n  -no-install       link a not-installable executable\n  -no-undefined     declare that a library does not refer to external symbols\n  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects\n  -objectlist FILE  Use a list of object files found in FILE to specify objects\n  -precious-files-regex REGEX\n                    don't remove output files matching REGEX\n  -release RELEASE  specify package release information\n  -rpath LIBDIR     the created library will eventually be installed in LIBDIR\n  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries\n  -shared           only do dynamic linking of libtool libraries\n  -shrext SUFFIX    override the standard shared library file extension\n  -static           do not do any dynamic linking of uninstalled libtool libraries\n  -static-libtool-libs\n                    do not do any dynamic linking of libtool libraries\n  -version-info CURRENT[:REVISION[:AGE]]\n                    specify library version info [each variable defaults to 0]\n  -weak LIBNAME     declare that the target provides the LIBNAME interface\n  -Wc,FLAG\n  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler\n  -Wl,FLAG\n  -Xlinker FLAG     pass linker-specific FLAG directly to the linker\n  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)\n\nAll other options (arguments beginning with \\`-') are ignored.\n\nEvery other argument is treated as a filename.  Files ending in \\`.la' are\ntreated as uninstalled libtool libraries, other files are standard or library\nobject files.\n\nIf the OUTPUT-FILE ends in \\`.la', then a libtool library is created,\nonly library objects (\\`.lo' files) may be specified, and \\`-rpath' is\nrequired, except when creating a convenience library.\n\nIf OUTPUT-FILE ends in \\`.a' or \\`.lib', then a standard library is created\nusing \\`ar' and \\`ranlib', or on Windows using \\`lib'.\n\nIf OUTPUT-FILE ends in \\`.lo' or \\`.${objext}', then a reloadable object file\nis created, otherwise an executable program is created.\"\n        ;;\n\n      uninstall)\n        $ECHO \\\n\"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...\n\nRemove libraries from an installation directory.\n\nRM is the name of the program to use to delete files associated with each FILE\n(typically \\`/bin/rm').  RM-OPTIONS are options (such as \\`-f') to be passed\nto RM.\n\nIf FILE is a libtool library, all the files associated with it are deleted.\nOtherwise, only FILE itself is deleted using RM.\"\n        ;;\n\n      *)\n        func_fatal_help \"invalid operation mode \\`$opt_mode'\"\n        ;;\n    esac\n\n    echo\n    $ECHO \"Try \\`$progname --help' for more information about other modes.\"\n}\n\n# Now that we've collected a possible --mode arg, show help if necessary\nif $opt_help; then\n  if test \"$opt_help\" = :; then\n    func_mode_help\n  else\n    {\n      func_help noexit\n      for opt_mode in compile link execute install finish uninstall clean; do\n\tfunc_mode_help\n      done\n    } | sed -n '1p; 2,$s/^Usage:/  or: /p'\n    {\n      func_help noexit\n      for opt_mode in compile link execute install finish uninstall clean; do\n\techo\n\tfunc_mode_help\n      done\n    } |\n    sed '1d\n      /^When reporting/,/^Report/{\n\tH\n\td\n      }\n      $x\n      /information about other modes/d\n      /more detailed .*MODE/d\n      s/^Usage:.*--mode=\\([^ ]*\\) .*/Description of \\1 mode:/'\n  fi\n  exit $?\nfi\n\n\n# func_mode_execute arg...\nfunc_mode_execute ()\n{\n    $opt_debug\n    # The first argument is the command name.\n    cmd=\"$nonopt\"\n    test -z \"$cmd\" && \\\n      func_fatal_help \"you must specify a COMMAND\"\n\n    # Handle -dlopen flags immediately.\n    for file in $opt_dlopen; do\n      test -f \"$file\" \\\n\t|| func_fatal_help \"\\`$file' is not a file\"\n\n      dir=\n      case $file in\n      *.la)\n\tfunc_resolve_sysroot \"$file\"\n\tfile=$func_resolve_sysroot_result\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$lib' is not a valid libtool archive\"\n\n\t# Read the libtool library.\n\tdlname=\n\tlibrary_names=\n\tfunc_source \"$file\"\n\n\t# Skip this library if it cannot be dlopened.\n\tif test -z \"$dlname\"; then\n\t  # Warn if it was a shared library.\n\t  test -n \"$library_names\" && \\\n\t    func_warning \"\\`$file' was not linked with \\`-export-dynamic'\"\n\t  continue\n\tfi\n\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\n\tif test -f \"$dir/$objdir/$dlname\"; then\n\t  func_append dir \"/$objdir\"\n\telse\n\t  if test ! -f \"$dir/$dlname\"; then\n\t    func_fatal_error \"cannot find \\`$dlname' in \\`$dir' or \\`$dir/$objdir'\"\n\t  fi\n\tfi\n\t;;\n\n      *.lo)\n\t# Just add the directory containing the .lo file.\n\tfunc_dirname \"$file\" \"\" \".\"\n\tdir=\"$func_dirname_result\"\n\t;;\n\n      *)\n\tfunc_warning \"\\`-dlopen' is ignored for non-libtool libraries and objects\"\n\tcontinue\n\t;;\n      esac\n\n      # Get the absolute pathname.\n      absdir=`cd \"$dir\" && pwd`\n      test -n \"$absdir\" && dir=\"$absdir\"\n\n      # Now add the directory to shlibpath_var.\n      if eval \"test -z \\\"\\$$shlibpath_var\\\"\"; then\n\teval \"$shlibpath_var=\\\"\\$dir\\\"\"\n      else\n\teval \"$shlibpath_var=\\\"\\$dir:\\$$shlibpath_var\\\"\"\n      fi\n    done\n\n    # This variable tells wrapper scripts just to set shlibpath_var\n    # rather than running their programs.\n    libtool_execute_magic=\"$magic\"\n\n    # Check if any of the arguments is a wrapper script.\n    args=\n    for file\n    do\n      case $file in\n      -* | *.la | *.lo ) ;;\n      *)\n\t# Do a test to see if this is really a libtool program.\n\tif func_ltwrapper_script_p \"$file\"; then\n\t  func_source \"$file\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\telif func_ltwrapper_executable_p \"$file\"; then\n\t  func_ltwrapper_scriptname \"$file\"\n\t  func_source \"$func_ltwrapper_scriptname_result\"\n\t  # Transform arg to wrapped name.\n\t  file=\"$progdir/$program\"\n\tfi\n\t;;\n      esac\n      # Quote arguments (to preserve shell metacharacters).\n      func_append_quoted args \"$file\"\n    done\n\n    if test \"X$opt_dry_run\" = Xfalse; then\n      if test -n \"$shlibpath_var\"; then\n\t# Export the shlibpath_var.\n\teval \"export $shlibpath_var\"\n      fi\n\n      # Restore saved environment variables\n      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES\n      do\n\teval \"if test \\\"\\${save_$lt_var+set}\\\" = set; then\n                $lt_var=\\$save_$lt_var; export $lt_var\n\t      else\n\t\t$lt_unset $lt_var\n\t      fi\"\n      done\n\n      # Now prepare to actually exec the command.\n      exec_cmd=\"\\$cmd$args\"\n    else\n      # Display what would be done.\n      if test -n \"$shlibpath_var\"; then\n\teval \"\\$ECHO \\\"\\$shlibpath_var=\\$$shlibpath_var\\\"\"\n\techo \"export $shlibpath_var\"\n      fi\n      $ECHO \"$cmd$args\"\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$opt_mode\" = execute && func_mode_execute ${1+\"$@\"}\n\n\n# func_mode_finish arg...\nfunc_mode_finish ()\n{\n    $opt_debug\n    libs=\n    libdirs=\n    admincmds=\n\n    for opt in \"$nonopt\" ${1+\"$@\"}\n    do\n      if test -d \"$opt\"; then\n\tfunc_append libdirs \" $opt\"\n\n      elif test -f \"$opt\"; then\n\tif func_lalib_unsafe_p \"$opt\"; then\n\t  func_append libs \" $opt\"\n\telse\n\t  func_warning \"\\`$opt' is not a valid libtool archive\"\n\tfi\n\n      else\n\tfunc_fatal_error \"invalid argument \\`$opt'\"\n      fi\n    done\n\n    if test -n \"$libs\"; then\n      if test -n \"$lt_sysroot\"; then\n        sysroot_regex=`$ECHO \"$lt_sysroot\" | $SED \"$sed_make_literal_regex\"`\n        sysroot_cmd=\"s/\\([ ']\\)$sysroot_regex/\\1/g;\"\n      else\n        sysroot_cmd=\n      fi\n\n      # Remove sysroot references\n      if $opt_dry_run; then\n        for lib in $libs; do\n          echo \"removing references to $lt_sysroot and \\`=' prefixes from $lib\"\n        done\n      else\n        tmpdir=`func_mktempdir`\n        for lib in $libs; do\n\t  sed -e \"${sysroot_cmd} s/\\([ ']-[LR]\\)=/\\1/g; s/\\([ ']\\)=/\\1/g\" $lib \\\n\t    > $tmpdir/tmp-la\n\t  mv -f $tmpdir/tmp-la $lib\n\tdone\n        ${RM}r \"$tmpdir\"\n      fi\n    fi\n\n    if test -n \"$finish_cmds$finish_eval\" && test -n \"$libdirs\"; then\n      for libdir in $libdirs; do\n\tif test -n \"$finish_cmds\"; then\n\t  # Do each command in the finish commands.\n\t  func_execute_cmds \"$finish_cmds\" 'admincmds=\"$admincmds\n'\"$cmd\"'\"'\n\tfi\n\tif test -n \"$finish_eval\"; then\n\t  # Do the single finish_eval.\n\t  eval cmds=\\\"$finish_eval\\\"\n\t  $opt_dry_run || eval \"$cmds\" || func_append admincmds \"\n       $cmds\"\n\tfi\n      done\n    fi\n\n    # Exit here if they wanted silent mode.\n    $opt_silent && exit $EXIT_SUCCESS\n\n    if test -n \"$finish_cmds$finish_eval\" && test -n \"$libdirs\"; then\n      echo \"----------------------------------------------------------------------\"\n      echo \"Libraries have been installed in:\"\n      for libdir in $libdirs; do\n\t$ECHO \"   $libdir\"\n      done\n      echo\n      echo \"If you ever happen to want to link against installed libraries\"\n      echo \"in a given directory, LIBDIR, you must either use libtool, and\"\n      echo \"specify the full pathname of the library, or use the \\`-LLIBDIR'\"\n      echo \"flag during linking and do at least one of the following:\"\n      if test -n \"$shlibpath_var\"; then\n\techo \"   - add LIBDIR to the \\`$shlibpath_var' environment variable\"\n\techo \"     during execution\"\n      fi\n      if test -n \"$runpath_var\"; then\n\techo \"   - add LIBDIR to the \\`$runpath_var' environment variable\"\n\techo \"     during linking\"\n      fi\n      if test -n \"$hardcode_libdir_flag_spec\"; then\n\tlibdir=LIBDIR\n\teval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\n\t$ECHO \"   - use the \\`$flag' linker flag\"\n      fi\n      if test -n \"$admincmds\"; then\n\t$ECHO \"   - have your system administrator run these commands:$admincmds\"\n      fi\n      if test -f /etc/ld.so.conf; then\n\techo \"   - have your system administrator add LIBDIR to \\`/etc/ld.so.conf'\"\n      fi\n      echo\n\n      echo \"See any operating system documentation about shared libraries for\"\n      case $host in\n\tsolaris2.[6789]|solaris2.1[0-9])\n\t  echo \"more information, such as the ld(1), crle(1) and ld.so(8) manual\"\n\t  echo \"pages.\"\n\t  ;;\n\t*)\n\t  echo \"more information, such as the ld(1) and ld.so(8) manual pages.\"\n\t  ;;\n      esac\n      echo \"----------------------------------------------------------------------\"\n    fi\n    exit $EXIT_SUCCESS\n}\n\ntest \"$opt_mode\" = finish && func_mode_finish ${1+\"$@\"}\n\n\n# func_mode_install arg...\nfunc_mode_install ()\n{\n    $opt_debug\n    # There may be an optional sh(1) argument at the beginning of\n    # install_prog (especially on Windows NT).\n    if test \"$nonopt\" = \"$SHELL\" || test \"$nonopt\" = /bin/sh ||\n       # Allow the use of GNU shtool's install command.\n       case $nonopt in *shtool*) :;; *) false;; esac; then\n      # Aesthetically quote it.\n      func_quote_for_eval \"$nonopt\"\n      install_prog=\"$func_quote_for_eval_result \"\n      arg=$1\n      shift\n    else\n      install_prog=\n      arg=$nonopt\n    fi\n\n    # The real first argument should be the name of the installation program.\n    # Aesthetically quote it.\n    func_quote_for_eval \"$arg\"\n    func_append install_prog \"$func_quote_for_eval_result\"\n    install_shared_prog=$install_prog\n    case \" $install_prog \" in\n      *[\\\\\\ /]cp\\ *) install_cp=: ;;\n      *) install_cp=false ;;\n    esac\n\n    # We need to accept at least all the BSD install flags.\n    dest=\n    files=\n    opts=\n    prev=\n    install_type=\n    isdir=no\n    stripme=\n    no_mode=:\n    for arg\n    do\n      arg2=\n      if test -n \"$dest\"; then\n\tfunc_append files \" $dest\"\n\tdest=$arg\n\tcontinue\n      fi\n\n      case $arg in\n      -d) isdir=yes ;;\n      -f)\n\tif $install_cp; then :; else\n\t  prev=$arg\n\tfi\n\t;;\n      -g | -m | -o)\n\tprev=$arg\n\t;;\n      -s)\n\tstripme=\" -s\"\n\tcontinue\n\t;;\n      -*)\n\t;;\n      *)\n\t# If the previous option needed an argument, then skip it.\n\tif test -n \"$prev\"; then\n\t  if test \"x$prev\" = x-m && test -n \"$install_override_mode\"; then\n\t    arg2=$install_override_mode\n\t    no_mode=false\n\t  fi\n\t  prev=\n\telse\n\t  dest=$arg\n\t  continue\n\tfi\n\t;;\n      esac\n\n      # Aesthetically quote the argument.\n      func_quote_for_eval \"$arg\"\n      func_append install_prog \" $func_quote_for_eval_result\"\n      if test -n \"$arg2\"; then\n\tfunc_quote_for_eval \"$arg2\"\n      fi\n      func_append install_shared_prog \" $func_quote_for_eval_result\"\n    done\n\n    test -z \"$install_prog\" && \\\n      func_fatal_help \"you must specify an install program\"\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prev' option requires an argument\"\n\n    if test -n \"$install_override_mode\" && $no_mode; then\n      if $install_cp; then :; else\n\tfunc_quote_for_eval \"$install_override_mode\"\n\tfunc_append install_shared_prog \" -m $func_quote_for_eval_result\"\n      fi\n    fi\n\n    if test -z \"$files\"; then\n      if test -z \"$dest\"; then\n\tfunc_fatal_help \"no file or destination specified\"\n      else\n\tfunc_fatal_help \"you must specify a destination\"\n      fi\n    fi\n\n    # Strip any trailing slash from the destination.\n    func_stripname '' '/' \"$dest\"\n    dest=$func_stripname_result\n\n    # Check to see that the destination is a directory.\n    test -d \"$dest\" && isdir=yes\n    if test \"$isdir\" = yes; then\n      destdir=\"$dest\"\n      destname=\n    else\n      func_dirname_and_basename \"$dest\" \"\" \".\"\n      destdir=\"$func_dirname_result\"\n      destname=\"$func_basename_result\"\n\n      # Not a directory, so check to see that there is only one file specified.\n      set dummy $files; shift\n      test \"$#\" -gt 1 && \\\n\tfunc_fatal_help \"\\`$dest' is not a directory\"\n    fi\n    case $destdir in\n    [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n    *)\n      for file in $files; do\n\tcase $file in\n\t*.lo) ;;\n\t*)\n\t  func_fatal_help \"\\`$destdir' must be an absolute directory name\"\n\t  ;;\n\tesac\n      done\n      ;;\n    esac\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    staticlibs=\n    future_libdirs=\n    current_libdirs=\n    for file in $files; do\n\n      # Do each installation.\n      case $file in\n      *.$libext)\n\t# Do the static libraries later.\n\tfunc_append staticlibs \" $file\"\n\t;;\n\n      *.la)\n\tfunc_resolve_sysroot \"$file\"\n\tfile=$func_resolve_sysroot_result\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$file\" \\\n\t  || func_fatal_help \"\\`$file' is not a valid libtool archive\"\n\n\tlibrary_names=\n\told_library=\n\trelink_command=\n\tfunc_source \"$file\"\n\n\t# Add the libdir to current_libdirs if it is the destination.\n\tif test \"X$destdir\" = \"X$libdir\"; then\n\t  case \"$current_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append current_libdirs \" $libdir\" ;;\n\t  esac\n\telse\n\t  # Note the libdir as a future libdir.\n\t  case \"$future_libdirs \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append future_libdirs \" $libdir\" ;;\n\t  esac\n\tfi\n\n\tfunc_dirname \"$file\" \"/\" \"\"\n\tdir=\"$func_dirname_result\"\n\tfunc_append dir \"$objdir\"\n\n\tif test -n \"$relink_command\"; then\n\t  # Determine the prefix the user has applied to our future dir.\n\t  inst_prefix_dir=`$ECHO \"$destdir\" | $SED -e \"s%$libdir\\$%%\"`\n\n\t  # Don't allow the user to place us outside of our expected\n\t  # location b/c this prevents finding dependent libraries that\n\t  # are installed to the same prefix.\n\t  # At present, this check doesn't affect windows .dll's that\n\t  # are installed into $libdir/../bin (currently, that works fine)\n\t  # but it's something to keep an eye on.\n\t  test \"$inst_prefix_dir\" = \"$destdir\" && \\\n\t    func_fatal_error \"error: cannot install \\`$file' to a directory not ending in $libdir\"\n\n\t  if test -n \"$inst_prefix_dir\"; then\n\t    # Stick the inst_prefix_dir data into the link command.\n\t    relink_command=`$ECHO \"$relink_command\" | $SED \"s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%\"`\n\t  else\n\t    relink_command=`$ECHO \"$relink_command\" | $SED \"s%@inst_prefix_dir@%%\"`\n\t  fi\n\n\t  func_warning \"relinking \\`$file'\"\n\t  func_show_eval \"$relink_command\" \\\n\t    'func_fatal_error \"error: relink \\`$file'\\'' with the above command before installing it\"'\n\tfi\n\n\t# See the names of the shared library.\n\tset dummy $library_names; shift\n\tif test -n \"$1\"; then\n\t  realname=\"$1\"\n\t  shift\n\n\t  srcname=\"$realname\"\n\t  test -n \"$relink_command\" && srcname=\"$realname\"T\n\n\t  # Install the shared library and build the symlinks.\n\t  func_show_eval \"$install_shared_prog $dir/$srcname $destdir/$realname\" \\\n\t      'exit $?'\n\t  tstripme=\"$stripme\"\n\t  case $host_os in\n\t  cygwin* | mingw* | pw32* | cegcc*)\n\t    case $realname in\n\t    *.dll.a)\n\t      tstripme=\"\"\n\t      ;;\n\t    esac\n\t    ;;\n\t  esac\n\t  if test -n \"$tstripme\" && test -n \"$striplib\"; then\n\t    func_show_eval \"$striplib $destdir/$realname\" 'exit $?'\n\t  fi\n\n\t  if test \"$#\" -gt 0; then\n\t    # Delete the old symlinks, and create new ones.\n\t    # Try `ln -sf' first, because the `ln' binary might depend on\n\t    # the symlink we replace!  Solaris /bin/ln does not understand -f,\n\t    # so we also need to try rm && ln -s.\n\t    for linkname\n\t    do\n\t      test \"$linkname\" != \"$realname\" \\\n\t\t&& func_show_eval \"(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })\"\n\t    done\n\t  fi\n\n\t  # Do each command in the postinstall commands.\n\t  lib=\"$destdir/$realname\"\n\t  func_execute_cmds \"$postinstall_cmds\" 'exit $?'\n\tfi\n\n\t# Install the pseudo-library for information purposes.\n\tfunc_basename \"$file\"\n\tname=\"$func_basename_result\"\n\tinstname=\"$dir/$name\"i\n\tfunc_show_eval \"$install_prog $instname $destdir/$name\" 'exit $?'\n\n\t# Maybe install the static library, too.\n\ttest -n \"$old_library\" && func_append staticlibs \" $dir/$old_library\"\n\t;;\n\n      *.lo)\n\t# Install (i.e. copy) a libtool object.\n\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# Deduce the name of the destination old-style object file.\n\tcase $destfile in\n\t*.lo)\n\t  func_lo2o \"$destfile\"\n\t  staticdest=$func_lo2o_result\n\t  ;;\n\t*.$objext)\n\t  staticdest=\"$destfile\"\n\t  destfile=\n\t  ;;\n\t*)\n\t  func_fatal_help \"cannot copy a libtool object to \\`$destfile'\"\n\t  ;;\n\tesac\n\n\t# Install the libtool object if requested.\n\ttest -n \"$destfile\" && \\\n\t  func_show_eval \"$install_prog $file $destfile\" 'exit $?'\n\n\t# Install the old object if enabled.\n\tif test \"$build_old_libs\" = yes; then\n\t  # Deduce the name of the old-style object file.\n\t  func_lo2o \"$file\"\n\t  staticobj=$func_lo2o_result\n\t  func_show_eval \"$install_prog \\$staticobj \\$staticdest\" 'exit $?'\n\tfi\n\texit $EXIT_SUCCESS\n\t;;\n\n      *)\n\t# Figure out destination file name, if it wasn't already specified.\n\tif test -n \"$destname\"; then\n\t  destfile=\"$destdir/$destname\"\n\telse\n\t  func_basename \"$file\"\n\t  destfile=\"$func_basename_result\"\n\t  destfile=\"$destdir/$destfile\"\n\tfi\n\n\t# If the file is missing, and there is a .exe on the end, strip it\n\t# because it is most likely a libtool script we actually want to\n\t# install\n\tstripped_ext=\"\"\n\tcase $file in\n\t  *.exe)\n\t    if test ! -f \"$file\"; then\n\t      func_stripname '' '.exe' \"$file\"\n\t      file=$func_stripname_result\n\t      stripped_ext=\".exe\"\n\t    fi\n\t    ;;\n\tesac\n\n\t# Do a test to see if this is really a libtool program.\n\tcase $host in\n\t*cygwin* | *mingw*)\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      wrapper=$func_ltwrapper_scriptname_result\n\t    else\n\t      func_stripname '' '.exe' \"$file\"\n\t      wrapper=$func_stripname_result\n\t    fi\n\t    ;;\n\t*)\n\t    wrapper=$file\n\t    ;;\n\tesac\n\tif func_ltwrapper_script_p \"$wrapper\"; then\n\t  notinst_deplibs=\n\t  relink_command=\n\n\t  func_source \"$wrapper\"\n\n\t  # Check the variables that should have been set.\n\t  test -z \"$generated_by_libtool_version\" && \\\n\t    func_fatal_error \"invalid libtool wrapper script \\`$wrapper'\"\n\n\t  finalize=yes\n\t  for lib in $notinst_deplibs; do\n\t    # Check to see that each library is installed.\n\t    libdir=\n\t    if test -f \"$lib\"; then\n\t      func_source \"$lib\"\n\t    fi\n\t    libfile=\"$libdir/\"`$ECHO \"$lib\" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test\n\t    if test -n \"$libdir\" && test ! -f \"$libfile\"; then\n\t      func_warning \"\\`$lib' has not been installed in \\`$libdir'\"\n\t      finalize=no\n\t    fi\n\t  done\n\n\t  relink_command=\n\t  func_source \"$wrapper\"\n\n\t  outputname=\n\t  if test \"$fast_install\" = no && test -n \"$relink_command\"; then\n\t    $opt_dry_run || {\n\t      if test \"$finalize\" = yes; then\n\t        tmpdir=`func_mktempdir`\n\t\tfunc_basename \"$file$stripped_ext\"\n\t\tfile=\"$func_basename_result\"\n\t        outputname=\"$tmpdir/$file\"\n\t        # Replace the output file specification.\n\t        relink_command=`$ECHO \"$relink_command\" | $SED 's%@OUTPUT@%'\"$outputname\"'%g'`\n\n\t        $opt_silent || {\n\t          func_quote_for_expand \"$relink_command\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t        }\n\t        if eval \"$relink_command\"; then :\n\t          else\n\t\t  func_error \"error: relink \\`$file' with the above command before installing it\"\n\t\t  $opt_dry_run || ${RM}r \"$tmpdir\"\n\t\t  continue\n\t        fi\n\t        file=\"$outputname\"\n\t      else\n\t        func_warning \"cannot relink \\`$file'\"\n\t      fi\n\t    }\n\t  else\n\t    # Install the binary that we compiled earlier.\n\t    file=`$ECHO \"$file$stripped_ext\" | $SED \"s%\\([^/]*\\)$%$objdir/\\1%\"`\n\t  fi\n\tfi\n\n\t# remove .exe since cygwin /usr/bin/install will append another\n\t# one anyway\n\tcase $install_prog,$host in\n\t*/usr/bin/install*,*cygwin*)\n\t  case $file:$destfile in\n\t  *.exe:*.exe)\n\t    # this is ok\n\t    ;;\n\t  *.exe:*)\n\t    destfile=$destfile.exe\n\t    ;;\n\t  *:*.exe)\n\t    func_stripname '' '.exe' \"$destfile\"\n\t    destfile=$func_stripname_result\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tfunc_show_eval \"$install_prog\\$stripme \\$file \\$destfile\" 'exit $?'\n\t$opt_dry_run || if test -n \"$outputname\"; then\n\t  ${RM}r \"$tmpdir\"\n\tfi\n\t;;\n      esac\n    done\n\n    for file in $staticlibs; do\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n\n      # Set up the ranlib parameters.\n      oldlib=\"$destdir/$name\"\n\n      func_show_eval \"$install_prog \\$file \\$oldlib\" 'exit $?'\n\n      if test -n \"$stripme\" && test -n \"$old_striplib\"; then\n\tfunc_show_eval \"$old_striplib $oldlib\" 'exit $?'\n      fi\n\n      # Do each command in the postinstall commands.\n      func_execute_cmds \"$old_postinstall_cmds\" 'exit $?'\n    done\n\n    test -n \"$future_libdirs\" && \\\n      func_warning \"remember to run \\`$progname --finish$future_libdirs'\"\n\n    if test -n \"$current_libdirs\"; then\n      # Maybe just do a dry run.\n      $opt_dry_run && current_libdirs=\" -n$current_libdirs\"\n      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'\n    else\n      exit $EXIT_SUCCESS\n    fi\n}\n\ntest \"$opt_mode\" = install && func_mode_install ${1+\"$@\"}\n\n\n# func_generate_dlsyms outputname originator pic_p\n# Extract symbols from dlprefiles and create ${outputname}S.o with\n# a dlpreopen symbol table.\nfunc_generate_dlsyms ()\n{\n    $opt_debug\n    my_outputname=\"$1\"\n    my_originator=\"$2\"\n    my_pic_p=\"${3-no}\"\n    my_prefix=`$ECHO \"$my_originator\" | sed 's%[^a-zA-Z0-9]%_%g'`\n    my_dlsyms=\n\n    if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n      if test -n \"$NM\" && test -n \"$global_symbol_pipe\"; then\n\tmy_dlsyms=\"${my_outputname}S.c\"\n      else\n\tfunc_error \"not configured to extract global symbols from dlpreopened files\"\n      fi\n    fi\n\n    if test -n \"$my_dlsyms\"; then\n      case $my_dlsyms in\n      \"\") ;;\n      *.c)\n\t# Discover the nlist of each of the dlfiles.\n\tnlist=\"$output_objdir/${my_outputname}.nm\"\n\n\tfunc_show_eval \"$RM $nlist ${nlist}S ${nlist}T\"\n\n\t# Parse the name list into a source file.\n\tfunc_verbose \"creating $output_objdir/$my_dlsyms\"\n\n\t$opt_dry_run || $ECHO > \"$output_objdir/$my_dlsyms\" \"\\\n/* $my_dlsyms - symbol resolution table for \\`$my_outputname' dlsym emulation. */\n/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */\n\n#ifdef __cplusplus\nextern \\\"C\\\" {\n#endif\n\n#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))\n#pragma GCC diagnostic ignored \\\"-Wstrict-prototypes\\\"\n#endif\n\n/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */\n#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)\n/* DATA imports from DLLs on WIN32 con't be const, because runtime\n   relocations are performed -- see ld's documentation on pseudo-relocs.  */\n# define LT_DLSYM_CONST\n#elif defined(__osf__)\n/* This system does not cope well with relocations in const data.  */\n# define LT_DLSYM_CONST\n#else\n# define LT_DLSYM_CONST const\n#endif\n\n/* External symbol declarations for the compiler. */\\\n\"\n\n\tif test \"$dlself\" = yes; then\n\t  func_verbose \"generating symbol list for \\`$output'\"\n\n\t  $opt_dry_run || echo ': @PROGRAM@ ' > \"$nlist\"\n\n\t  # Add our own program objects to the symbol list.\n\t  progfiles=`$ECHO \"$objs$old_deplibs\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\t  for progfile in $progfiles; do\n\t    func_to_tool_file \"$progfile\" func_convert_file_msys_to_w32\n\t    func_verbose \"extracting global C symbols from \\`$func_to_tool_file_result'\"\n\t    $opt_dry_run || eval \"$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'\"\n\t  done\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  if test -n \"$export_symbols_regex\"; then\n\t    $opt_dry_run || {\n\t      eval '$EGREP -e \"$export_symbols_regex\" \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t    }\n\t  fi\n\n\t  # Prepare the list of exported symbols\n\t  if test -z \"$export_symbols\"; then\n\t    export_symbols=\"$output_objdir/$outputname.exp\"\n\t    $opt_dry_run || {\n\t      $RM $export_symbols\n\t      eval \"${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \\(.*\\)$/\\1/p' \"'< \"$nlist\" > \"$export_symbols\"'\n\t      case $host in\n\t      *cygwin* | *mingw* | *cegcc* )\n                eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n                eval 'cat \"$export_symbols\" >> \"$output_objdir/$outputname.def\"'\n\t        ;;\n\t      esac\n\t    }\n\t  else\n\t    $opt_dry_run || {\n\t      eval \"${SED} -e 's/\\([].[*^$]\\)/\\\\\\\\\\1/g' -e 's/^/ /' -e 's/$/$/'\"' < \"$export_symbols\" > \"$output_objdir/$outputname.exp\"'\n\t      eval '$GREP -f \"$output_objdir/$outputname.exp\" < \"$nlist\" > \"$nlist\"T'\n\t      eval '$MV \"$nlist\"T \"$nlist\"'\n\t      case $host in\n\t        *cygwin* | *mingw* | *cegcc* )\n\t          eval \"echo EXPORTS \"'> \"$output_objdir/$outputname.def\"'\n\t          eval 'cat \"$nlist\" >> \"$output_objdir/$outputname.def\"'\n\t          ;;\n\t      esac\n\t    }\n\t  fi\n\tfi\n\n\tfor dlprefile in $dlprefiles; do\n\t  func_verbose \"extracting global C symbols from \\`$dlprefile'\"\n\t  func_basename \"$dlprefile\"\n\t  name=\"$func_basename_result\"\n          case $host in\n\t    *cygwin* | *mingw* | *cegcc* )\n\t      # if an import library, we need to obtain dlname\n\t      if func_win32_import_lib_p \"$dlprefile\"; then\n\t        func_tr_sh \"$dlprefile\"\n\t        eval \"curr_lafile=\\$libfile_$func_tr_sh_result\"\n\t        dlprefile_dlbasename=\"\"\n\t        if test -n \"$curr_lafile\" && func_lalib_p \"$curr_lafile\"; then\n\t          # Use subshell, to avoid clobbering current variable values\n\t          dlprefile_dlname=`source \"$curr_lafile\" && echo \"$dlname\"`\n\t          if test -n \"$dlprefile_dlname\" ; then\n\t            func_basename \"$dlprefile_dlname\"\n\t            dlprefile_dlbasename=\"$func_basename_result\"\n\t          else\n\t            # no lafile. user explicitly requested -dlpreopen <import library>.\n\t            $sharedlib_from_linklib_cmd \"$dlprefile\"\n\t            dlprefile_dlbasename=$sharedlib_from_linklib_result\n\t          fi\n\t        fi\n\t        $opt_dry_run || {\n\t          if test -n \"$dlprefile_dlbasename\" ; then\n\t            eval '$ECHO \": $dlprefile_dlbasename\" >> \"$nlist\"'\n\t          else\n\t            func_warning \"Could not compute DLL name from $name\"\n\t            eval '$ECHO \": $name \" >> \"$nlist\"'\n\t          fi\n\t          func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t          eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe |\n\t            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'\"\n\t        }\n\t      else # not an import lib\n\t        $opt_dry_run || {\n\t          eval '$ECHO \": $name \" >> \"$nlist\"'\n\t          func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t          eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe >> '$nlist'\"\n\t        }\n\t      fi\n\t    ;;\n\t    *)\n\t      $opt_dry_run || {\n\t        eval '$ECHO \": $name \" >> \"$nlist\"'\n\t        func_to_tool_file \"$dlprefile\" func_convert_file_msys_to_w32\n\t        eval \"$NM \\\"$func_to_tool_file_result\\\" 2>/dev/null | $global_symbol_pipe >> '$nlist'\"\n\t      }\n\t    ;;\n          esac\n\tdone\n\n\t$opt_dry_run || {\n\t  # Make sure we have at least an empty file.\n\t  test -f \"$nlist\" || : > \"$nlist\"\n\n\t  if test -n \"$exclude_expsyms\"; then\n\t    $EGREP -v \" ($exclude_expsyms)$\" \"$nlist\" > \"$nlist\"T\n\t    $MV \"$nlist\"T \"$nlist\"\n\t  fi\n\n\t  # Try sorting and uniquifying the output.\n\t  if $GREP -v \"^: \" < \"$nlist\" |\n\t      if sort -k 3 </dev/null >/dev/null 2>&1; then\n\t\tsort -k 3\n\t      else\n\t\tsort +2\n\t      fi |\n\t      uniq > \"$nlist\"S; then\n\t    :\n\t  else\n\t    $GREP -v \"^: \" < \"$nlist\" > \"$nlist\"S\n\t  fi\n\n\t  if test -f \"$nlist\"S; then\n\t    eval \"$global_symbol_to_cdecl\"' < \"$nlist\"S >> \"$output_objdir/$my_dlsyms\"'\n\t  else\n\t    echo '/* NONE */' >> \"$output_objdir/$my_dlsyms\"\n\t  fi\n\n\t  echo >> \"$output_objdir/$my_dlsyms\" \"\\\n\n/* The mapping between symbol names and symbols.  */\ntypedef struct {\n  const char *name;\n  void *address;\n} lt_dlsymlist;\nextern LT_DLSYM_CONST lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[];\nLT_DLSYM_CONST lt_dlsymlist\nlt_${my_prefix}_LTX_preloaded_symbols[] =\n{\\\n  { \\\"$my_originator\\\", (void *) 0 },\"\n\n\t  case $need_lib_prefix in\n\t  no)\n\t    eval \"$global_symbol_to_c_name_address\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  *)\n\t    eval \"$global_symbol_to_c_name_address_lib_prefix\" < \"$nlist\" >> \"$output_objdir/$my_dlsyms\"\n\t    ;;\n\t  esac\n\t  echo >> \"$output_objdir/$my_dlsyms\" \"\\\n  {0, (void *) 0}\n};\n\n/* This works around a problem in FreeBSD linker */\n#ifdef FREEBSD_WORKAROUND\nstatic const void *lt_preloaded_setup() {\n  return lt_${my_prefix}_LTX_preloaded_symbols;\n}\n#endif\n\n#ifdef __cplusplus\n}\n#endif\\\n\"\n\t} # !$opt_dry_run\n\n\tpic_flag_for_symtable=\n\tcase \"$compile_command \" in\n\t*\" -static \"*) ;;\n\t*)\n\t  case $host in\n\t  # compiling the symbol table file with pic_flag works around\n\t  # a FreeBSD bug that causes programs to crash when -lm is\n\t  # linked before any other PIC object.  But we must not use\n\t  # pic_flag when linking with -static.  The problem exists in\n\t  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.\n\t  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)\n\t    pic_flag_for_symtable=\" $pic_flag -DFREEBSD_WORKAROUND\" ;;\n\t  *-*-hpux*)\n\t    pic_flag_for_symtable=\" $pic_flag\"  ;;\n\t  *)\n\t    if test \"X$my_pic_p\" != Xno; then\n\t      pic_flag_for_symtable=\" $pic_flag\"\n\t    fi\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tsymtab_cflags=\n\tfor arg in $LTCFLAGS; do\n\t  case $arg in\n\t  -pie | -fpie | -fPIE) ;;\n\t  *) func_append symtab_cflags \" $arg\" ;;\n\t  esac\n\tdone\n\n\t# Now compile the dynamic symbol file.\n\tfunc_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")' 'exit $?'\n\n\t# Clean up the generated files.\n\tfunc_show_eval '$RM \"$output_objdir/$my_dlsyms\" \"$nlist\" \"${nlist}S\" \"${nlist}T\"'\n\n\t# Transform the symbol file into the correct name.\n\tsymfileobj=\"$output_objdir/${my_outputname}S.$objext\"\n\tcase $host in\n\t*cygwin* | *mingw* | *cegcc* )\n\t  if test -f \"$output_objdir/$my_outputname.def\"; then\n\t    compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t    finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%\"`\n\t  else\n\t    compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t    finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  fi\n\t  ;;\n\t*)\n\t  compile_command=`$ECHO \"$compile_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  finalize_command=`$ECHO \"$finalize_command\" | $SED \"s%@SYMFILE@%$symfileobj%\"`\n\t  ;;\n\tesac\n\t;;\n      *)\n\tfunc_fatal_error \"unknown suffix for \\`$my_dlsyms'\"\n\t;;\n      esac\n    else\n      # We keep going just in case the user didn't refer to\n      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe\n      # really was required.\n\n      # Nullify the symbol file.\n      compile_command=`$ECHO \"$compile_command\" | $SED \"s% @SYMFILE@%%\"`\n      finalize_command=`$ECHO \"$finalize_command\" | $SED \"s% @SYMFILE@%%\"`\n    fi\n}\n\n# func_win32_libid arg\n# return the library type of file 'arg'\n#\n# Need a lot of goo to handle *both* DLLs and import libs\n# Has to be a shell function in order to 'eat' the argument\n# that is supplied when $file_magic_command is called.\n# Despite the name, also deal with 64 bit binaries.\nfunc_win32_libid ()\n{\n  $opt_debug\n  win32_libid_type=\"unknown\"\n  win32_fileres=`file -L $1 2>/dev/null`\n  case $win32_fileres in\n  *ar\\ archive\\ import\\ library*) # definitely import\n    win32_libid_type=\"x86 archive import\"\n    ;;\n  *ar\\ archive*) # could be an import, or static\n    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.\n    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |\n       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then\n      func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n      win32_nmres=`eval $NM -f posix -A \\\"$func_to_tool_file_result\\\" |\n\t$SED -n -e '\n\t    1,100{\n\t\t/ I /{\n\t\t    s,.*,import,\n\t\t    p\n\t\t    q\n\t\t}\n\t    }'`\n      case $win32_nmres in\n      import*)  win32_libid_type=\"x86 archive import\";;\n      *)        win32_libid_type=\"x86 archive static\";;\n      esac\n    fi\n    ;;\n  *DLL*)\n    win32_libid_type=\"x86 DLL\"\n    ;;\n  *executable*) # but shell scripts are \"executable\" too...\n    case $win32_fileres in\n    *MS\\ Windows\\ PE\\ Intel*)\n      win32_libid_type=\"x86 DLL\"\n      ;;\n    esac\n    ;;\n  esac\n  $ECHO \"$win32_libid_type\"\n}\n\n# func_cygming_dll_for_implib ARG\n#\n# Platform-specific function to extract the\n# name of the DLL associated with the specified\n# import library ARG.\n# Invoked by eval'ing the libtool variable\n#    $sharedlib_from_linklib_cmd\n# Result is available in the variable\n#    $sharedlib_from_linklib_result\nfunc_cygming_dll_for_implib ()\n{\n  $opt_debug\n  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify \"$1\"`\n}\n\n# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs\n#\n# The is the core of a fallback implementation of a\n# platform-specific function to extract the name of the\n# DLL associated with the specified import library LIBNAME.\n#\n# SECTION_NAME is either .idata$6 or .idata$7, depending\n# on the platform and compiler that created the implib.\n#\n# Echos the name of the DLL associated with the\n# specified import library.\nfunc_cygming_dll_for_implib_fallback_core ()\n{\n  $opt_debug\n  match_literal=`$ECHO \"$1\" | $SED \"$sed_make_literal_regex\"`\n  $OBJDUMP -s --section \"$1\" \"$2\" 2>/dev/null |\n    $SED '/^Contents of section '\"$match_literal\"':/{\n      # Place marker at beginning of archive member dllname section\n      s/.*/====MARK====/\n      p\n      d\n    }\n    # These lines can sometimes be longer than 43 characters, but\n    # are always uninteresting\n    /:[\t ]*file format pe[i]\\{,1\\}-/d\n    /^In archive [^:]*:/d\n    # Ensure marker is printed\n    /^====MARK====/p\n    # Remove all lines with less than 43 characters\n    /^.\\{43\\}/!d\n    # From remaining lines, remove first 43 characters\n    s/^.\\{43\\}//' |\n    $SED -n '\n      # Join marker and all lines until next marker into a single line\n      /^====MARK====/ b para\n      H\n      $ b para\n      b\n      :para\n      x\n      s/\\n//g\n      # Remove the marker\n      s/^====MARK====//\n      # Remove trailing dots and whitespace\n      s/[\\. \\t]*$//\n      # Print\n      /./p' |\n    # we now have a list, one entry per line, of the stringified\n    # contents of the appropriate section of all members of the\n    # archive which possess that section. Heuristic: eliminate\n    # all those which have a first or second character that is\n    # a '.' (that is, objdump's representation of an unprintable\n    # character.) This should work for all archives with less than\n    # 0x302f exports -- but will fail for DLLs whose name actually\n    # begins with a literal '.' or a single character followed by\n    # a '.'.\n    #\n    # Of those that remain, print the first one.\n    $SED -e '/^\\./d;/^.\\./d;q'\n}\n\n# func_cygming_gnu_implib_p ARG\n# This predicate returns with zero status (TRUE) if\n# ARG is a GNU/binutils-style import library. Returns\n# with nonzero status (FALSE) otherwise.\nfunc_cygming_gnu_implib_p ()\n{\n  $opt_debug\n  func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n  func_cygming_gnu_implib_tmp=`$NM \"$func_to_tool_file_result\" | eval \"$global_symbol_pipe\" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`\n  test -n \"$func_cygming_gnu_implib_tmp\"\n}\n\n# func_cygming_ms_implib_p ARG\n# This predicate returns with zero status (TRUE) if\n# ARG is an MS-style import library. Returns\n# with nonzero status (FALSE) otherwise.\nfunc_cygming_ms_implib_p ()\n{\n  $opt_debug\n  func_to_tool_file \"$1\" func_convert_file_msys_to_w32\n  func_cygming_ms_implib_tmp=`$NM \"$func_to_tool_file_result\" | eval \"$global_symbol_pipe\" | $GREP '_NULL_IMPORT_DESCRIPTOR'`\n  test -n \"$func_cygming_ms_implib_tmp\"\n}\n\n# func_cygming_dll_for_implib_fallback ARG\n# Platform-specific function to extract the\n# name of the DLL associated with the specified\n# import library ARG.\n#\n# This fallback implementation is for use when $DLLTOOL\n# does not support the --identify-strict option.\n# Invoked by eval'ing the libtool variable\n#    $sharedlib_from_linklib_cmd\n# Result is available in the variable\n#    $sharedlib_from_linklib_result\nfunc_cygming_dll_for_implib_fallback ()\n{\n  $opt_debug\n  if func_cygming_gnu_implib_p \"$1\" ; then\n    # binutils import library\n    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' \"$1\"`\n  elif func_cygming_ms_implib_p \"$1\" ; then\n    # ms-generated import library\n    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' \"$1\"`\n  else\n    # unknown\n    sharedlib_from_linklib_result=\"\"\n  fi\n}\n\n\n# func_extract_an_archive dir oldlib\nfunc_extract_an_archive ()\n{\n    $opt_debug\n    f_ex_an_ar_dir=\"$1\"; shift\n    f_ex_an_ar_oldlib=\"$1\"\n    if test \"$lock_old_archive_extraction\" = yes; then\n      lockfile=$f_ex_an_ar_oldlib.lock\n      until $opt_dry_run || ln \"$progpath\" \"$lockfile\" 2>/dev/null; do\n\tfunc_echo \"Waiting for $lockfile to be removed\"\n\tsleep 2\n      done\n    fi\n    func_show_eval \"(cd \\$f_ex_an_ar_dir && $AR x \\\"\\$f_ex_an_ar_oldlib\\\")\" \\\n\t\t   'stat=$?; rm -f \"$lockfile\"; exit $stat'\n    if test \"$lock_old_archive_extraction\" = yes; then\n      $opt_dry_run || rm -f \"$lockfile\"\n    fi\n    if ($AR t \"$f_ex_an_ar_oldlib\" | sort | sort -uc >/dev/null 2>&1); then\n     :\n    else\n      func_fatal_error \"object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib\"\n    fi\n}\n\n\n# func_extract_archives gentop oldlib ...\nfunc_extract_archives ()\n{\n    $opt_debug\n    my_gentop=\"$1\"; shift\n    my_oldlibs=${1+\"$@\"}\n    my_oldobjs=\"\"\n    my_xlib=\"\"\n    my_xabs=\"\"\n    my_xdir=\"\"\n\n    for my_xlib in $my_oldlibs; do\n      # Extract the objects.\n      case $my_xlib in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) my_xabs=\"$my_xlib\" ;;\n\t*) my_xabs=`pwd`\"/$my_xlib\" ;;\n      esac\n      func_basename \"$my_xlib\"\n      my_xlib=\"$func_basename_result\"\n      my_xlib_u=$my_xlib\n      while :; do\n        case \" $extracted_archives \" in\n\t*\" $my_xlib_u \"*)\n\t  func_arith $extracted_serial + 1\n\t  extracted_serial=$func_arith_result\n\t  my_xlib_u=lt$extracted_serial-$my_xlib ;;\n\t*) break ;;\n\tesac\n      done\n      extracted_archives=\"$extracted_archives $my_xlib_u\"\n      my_xdir=\"$my_gentop/$my_xlib_u\"\n\n      func_mkdir_p \"$my_xdir\"\n\n      case $host in\n      *-darwin*)\n\tfunc_verbose \"Extracting $my_xabs\"\n\t# Do not bother doing anything if just a dry run\n\t$opt_dry_run || {\n\t  darwin_orig_dir=`pwd`\n\t  cd $my_xdir || exit $?\n\t  darwin_archive=$my_xabs\n\t  darwin_curdir=`pwd`\n\t  darwin_base_archive=`basename \"$darwin_archive\"`\n\t  darwin_arches=`$LIPO -info \"$darwin_archive\" 2>/dev/null | $GREP Architectures 2>/dev/null || true`\n\t  if test -n \"$darwin_arches\"; then\n\t    darwin_arches=`$ECHO \"$darwin_arches\" | $SED -e 's/.*are://'`\n\t    darwin_arch=\n\t    func_verbose \"$darwin_base_archive has multiple architectures $darwin_arches\"\n\t    for darwin_arch in  $darwin_arches ; do\n\t      func_mkdir_p \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      $LIPO -thin $darwin_arch -output \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\" \"${darwin_archive}\"\n\t      cd \"unfat-$$/${darwin_base_archive}-${darwin_arch}\"\n\t      func_extract_an_archive \"`pwd`\" \"${darwin_base_archive}\"\n\t      cd \"$darwin_curdir\"\n\t      $RM \"unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}\"\n\t    done # $darwin_arches\n            ## Okay now we've a bunch of thin objects, gotta fatten them up :)\n\t    darwin_filelist=`find unfat-$$ -type f -name \\*.o -print -o -name \\*.lo -print | $SED -e \"$basename\" | sort -u`\n\t    darwin_file=\n\t    darwin_files=\n\t    for darwin_file in $darwin_filelist; do\n\t      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`\n\t      $LIPO -create -output \"$darwin_file\" $darwin_files\n\t    done # $darwin_filelist\n\t    $RM -rf unfat-$$\n\t    cd \"$darwin_orig_dir\"\n\t  else\n\t    cd $darwin_orig_dir\n\t    func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t  fi # $darwin_arches\n\t} # !$opt_dry_run\n\t;;\n      *)\n        func_extract_an_archive \"$my_xdir\" \"$my_xabs\"\n\t;;\n      esac\n      my_oldobjs=\"$my_oldobjs \"`find $my_xdir -name \\*.$objext -print -o -name \\*.lo -print | sort | $NL2SP`\n    done\n\n    func_extract_archives_result=\"$my_oldobjs\"\n}\n\n\n# func_emit_wrapper [arg=no]\n#\n# Emit a libtool wrapper script on stdout.\n# Don't directly open a file because we may want to\n# incorporate the script contents within a cygwin/mingw\n# wrapper executable.  Must ONLY be called from within\n# func_mode_link because it depends on a number of variables\n# set therein.\n#\n# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\n# variable will take.  If 'yes', then the emitted script\n# will assume that the directory in which it is stored is\n# the $objdir directory.  This is a cygwin/mingw-specific\n# behavior.\nfunc_emit_wrapper ()\n{\n\tfunc_emit_wrapper_arg1=${1-no}\n\n\t$ECHO \"\\\n#! $SHELL\n\n# $output - temporary wrapper script for $objdir/$outputname\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# The $output program cannot be directly executed until all the libtool\n# libraries that it depends on are installed.\n#\n# This wrapper script should never be moved out of the build directory.\n# If it is, it will not operate correctly.\n\n# Sed substitution that helps us do robust quoting.  It backslashifies\n# metacharacters that are still active within double-quoted strings.\nsed_quote_subst='$sed_quote_subst'\n\n# Be Bourne compatible\nif test -n \\\"\\${ZSH_VERSION+set}\\\" && (emulate sh) >/dev/null 2>&1; then\n  emulate sh\n  NULLCMD=:\n  # Zsh 3.x and 4.x performs word splitting on \\${1+\\\"\\$@\\\"}, which\n  # is contrary to our usage.  Disable this feature.\n  alias -g '\\${1+\\\"\\$@\\\"}'='\\\"\\$@\\\"'\n  setopt NO_GLOB_SUBST\nelse\n  case \\`(set -o) 2>/dev/null\\` in *posix*) set -o posix;; esac\nfi\nBIN_SH=xpg4; export BIN_SH # for Tru64\nDUALCASE=1; export DUALCASE # for MKS sh\n\n# The HP-UX ksh and POSIX shell print the target directory to stdout\n# if CDPATH is set.\n(unset CDPATH) >/dev/null 2>&1 && unset CDPATH\n\nrelink_command=\\\"$relink_command\\\"\n\n# This environment variable determines our operation mode.\nif test \\\"\\$libtool_install_magic\\\" = \\\"$magic\\\"; then\n  # install mode needs the following variables:\n  generated_by_libtool_version='$macro_version'\n  notinst_deplibs='$notinst_deplibs'\nelse\n  # When we are sourced in execute mode, \\$file and \\$ECHO are already set.\n  if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n    file=\\\"\\$0\\\"\"\n\n    qECHO=`$ECHO \"$ECHO\" | $SED \"$sed_quote_subst\"`\n    $ECHO \"\\\n\n# A function that is used when there is no print builtin or printf.\nfunc_fallback_echo ()\n{\n  eval 'cat <<_LTECHO_EOF\n\\$1\n_LTECHO_EOF'\n}\n    ECHO=\\\"$qECHO\\\"\n  fi\n\n# Very basic option parsing. These options are (a) specific to\n# the libtool wrapper, (b) are identical between the wrapper\n# /script/ and the wrapper /executable/ which is used only on\n# windows platforms, and (c) all begin with the string \"--lt-\"\n# (application programs are unlikely to have options which match\n# this pattern).\n#\n# There are only two supported options: --lt-debug and\n# --lt-dump-script. There is, deliberately, no --lt-help.\n#\n# The first argument to this parsing function should be the\n# script's $0 value, followed by \"$@\".\nlt_option_debug=\nfunc_parse_lt_options ()\n{\n  lt_script_arg0=\\$0\n  shift\n  for lt_opt\n  do\n    case \\\"\\$lt_opt\\\" in\n    --lt-debug) lt_option_debug=1 ;;\n    --lt-dump-script)\n        lt_dump_D=\\`\\$ECHO \\\"X\\$lt_script_arg0\\\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\\`\n        test \\\"X\\$lt_dump_D\\\" = \\\"X\\$lt_script_arg0\\\" && lt_dump_D=.\n        lt_dump_F=\\`\\$ECHO \\\"X\\$lt_script_arg0\\\" | $SED -e 's/^X//' -e 's%^.*/%%'\\`\n        cat \\\"\\$lt_dump_D/\\$lt_dump_F\\\"\n        exit 0\n      ;;\n    --lt-*)\n        \\$ECHO \\\"Unrecognized --lt- option: '\\$lt_opt'\\\" 1>&2\n        exit 1\n      ;;\n    esac\n  done\n\n  # Print the debug banner immediately:\n  if test -n \\\"\\$lt_option_debug\\\"; then\n    echo \\\"${outputname}:${output}:\\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\\\" 1>&2\n  fi\n}\n\n# Used when --lt-debug. Prints its arguments to stdout\n# (redirection is the responsibility of the caller)\nfunc_lt_dump_args ()\n{\n  lt_dump_args_N=1;\n  for lt_arg\n  do\n    \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[\\$lt_dump_args_N]: \\$lt_arg\\\"\n    lt_dump_args_N=\\`expr \\$lt_dump_args_N + 1\\`\n  done\n}\n\n# Core function for launching the target application\nfunc_exec_program_core ()\n{\n\"\n  case $host in\n  # Backslashes separate directories on plain windows\n  *-*-mingw | *-*-os2* | *-cegcc*)\n    $ECHO \"\\\n      if test -n \\\"\\$lt_option_debug\\\"; then\n        \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[0]: \\$progdir\\\\\\\\\\$program\\\" 1>&2\n        func_lt_dump_args \\${1+\\\"\\$@\\\"} 1>&2\n      fi\n      exec \\\"\\$progdir\\\\\\\\\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n    ;;\n\n  *)\n    $ECHO \"\\\n      if test -n \\\"\\$lt_option_debug\\\"; then\n        \\$ECHO \\\"${outputname}:${output}:\\${LINENO}: newargv[0]: \\$progdir/\\$program\\\" 1>&2\n        func_lt_dump_args \\${1+\\\"\\$@\\\"} 1>&2\n      fi\n      exec \\\"\\$progdir/\\$program\\\" \\${1+\\\"\\$@\\\"}\n\"\n    ;;\n  esac\n  $ECHO \"\\\n      \\$ECHO \\\"\\$0: cannot exec \\$program \\$*\\\" 1>&2\n      exit 1\n}\n\n# A function to encapsulate launching the target application\n# Strips options in the --lt-* namespace from \\$@ and\n# launches target application with the remaining arguments.\nfunc_exec_program ()\n{\n  for lt_wr_arg\n  do\n    case \\$lt_wr_arg in\n    --lt-*) ;;\n    *) set x \\\"\\$@\\\" \\\"\\$lt_wr_arg\\\"; shift;;\n    esac\n    shift\n  done\n  func_exec_program_core \\${1+\\\"\\$@\\\"}\n}\n\n  # Parse options\n  func_parse_lt_options \\\"\\$0\\\" \\${1+\\\"\\$@\\\"}\n\n  # Find the directory that this script lives in.\n  thisdir=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%/[^/]*$%%'\\`\n  test \\\"x\\$thisdir\\\" = \\\"x\\$file\\\" && thisdir=.\n\n  # Follow symbolic links until we get to the real thisdir.\n  file=\\`ls -ld \\\"\\$file\\\" | $SED -n 's/.*-> //p'\\`\n  while test -n \\\"\\$file\\\"; do\n    destdir=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%/[^/]*\\$%%'\\`\n\n    # If there was a directory component, then change thisdir.\n    if test \\\"x\\$destdir\\\" != \\\"x\\$file\\\"; then\n      case \\\"\\$destdir\\\" in\n      [\\\\\\\\/]* | [A-Za-z]:[\\\\\\\\/]*) thisdir=\\\"\\$destdir\\\" ;;\n      *) thisdir=\\\"\\$thisdir/\\$destdir\\\" ;;\n      esac\n    fi\n\n    file=\\`\\$ECHO \\\"\\$file\\\" | $SED 's%^.*/%%'\\`\n    file=\\`ls -ld \\\"\\$thisdir/\\$file\\\" | $SED -n 's/.*-> //p'\\`\n  done\n\n  # Usually 'no', except on cygwin/mingw when embedded into\n  # the cwrapper.\n  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1\n  if test \\\"\\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\\\" = \\\"yes\\\"; then\n    # special case for '.'\n    if test \\\"\\$thisdir\\\" = \\\".\\\"; then\n      thisdir=\\`pwd\\`\n    fi\n    # remove .libs from thisdir\n    case \\\"\\$thisdir\\\" in\n    *[\\\\\\\\/]$objdir ) thisdir=\\`\\$ECHO \\\"\\$thisdir\\\" | $SED 's%[\\\\\\\\/][^\\\\\\\\/]*$%%'\\` ;;\n    $objdir )   thisdir=. ;;\n    esac\n  fi\n\n  # Try to get the absolute directory name.\n  absdir=\\`cd \\\"\\$thisdir\\\" && pwd\\`\n  test -n \\\"\\$absdir\\\" && thisdir=\\\"\\$absdir\\\"\n\"\n\n\tif test \"$fast_install\" = yes; then\n\t  $ECHO \"\\\n  program=lt-'$outputname'$exeext\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\n  if test ! -f \\\"\\$progdir/\\$program\\\" ||\n     { file=\\`ls -1dt \\\"\\$progdir/\\$program\\\" \\\"\\$progdir/../\\$program\\\" 2>/dev/null | ${SED} 1q\\`; \\\\\n       test \\\"X\\$file\\\" != \\\"X\\$progdir/\\$program\\\"; }; then\n\n    file=\\\"\\$\\$-\\$program\\\"\n\n    if test ! -d \\\"\\$progdir\\\"; then\n      $MKDIR \\\"\\$progdir\\\"\n    else\n      $RM \\\"\\$progdir/\\$file\\\"\n    fi\"\n\n\t  $ECHO \"\\\n\n    # relink executable if necessary\n    if test -n \\\"\\$relink_command\\\"; then\n      if relink_command_output=\\`eval \\$relink_command 2>&1\\`; then :\n      else\n\t$ECHO \\\"\\$relink_command_output\\\" >&2\n\t$RM \\\"\\$progdir/\\$file\\\"\n\texit 1\n      fi\n    fi\n\n    $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\" 2>/dev/null ||\n    { $RM \\\"\\$progdir/\\$program\\\";\n      $MV \\\"\\$progdir/\\$file\\\" \\\"\\$progdir/\\$program\\\"; }\n    $RM \\\"\\$progdir/\\$file\\\"\n  fi\"\n\telse\n\t  $ECHO \"\\\n  program='$outputname'\n  progdir=\\\"\\$thisdir/$objdir\\\"\n\"\n\tfi\n\n\t$ECHO \"\\\n\n  if test -f \\\"\\$progdir/\\$program\\\"; then\"\n\n\t# fixup the dll searchpath if we need to.\n\t#\n\t# Fix the DLL searchpath if we need to.  Do this before prepending\n\t# to shlibpath, because on Windows, both are PATH and uninstalled\n\t# libraries must come first.\n\tif test -n \"$dllsearchpath\"; then\n\t  $ECHO \"\\\n    # Add the dll search path components to the executable PATH\n    PATH=$dllsearchpath:\\$PATH\n\"\n\tfi\n\n\t# Export our shlibpath_var if we have one.\n\tif test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n\t  $ECHO \"\\\n    # Add our own library path to $shlibpath_var\n    $shlibpath_var=\\\"$temp_rpath\\$$shlibpath_var\\\"\n\n    # Some systems cannot cope with colon-terminated $shlibpath_var\n    # The second colon is a workaround for a bug in BeOS R4 sed\n    $shlibpath_var=\\`\\$ECHO \\\"\\$$shlibpath_var\\\" | $SED 's/::*\\$//'\\`\n\n    export $shlibpath_var\n\"\n\tfi\n\n\t$ECHO \"\\\n    if test \\\"\\$libtool_execute_magic\\\" != \\\"$magic\\\"; then\n      # Run the actual program with our arguments.\n      func_exec_program \\${1+\\\"\\$@\\\"}\n    fi\n  else\n    # The program doesn't exist.\n    \\$ECHO \\\"\\$0: error: \\\\\\`\\$progdir/\\$program' does not exist\\\" 1>&2\n    \\$ECHO \\\"This script is just a wrapper for \\$program.\\\" 1>&2\n    \\$ECHO \\\"See the $PACKAGE documentation for more information.\\\" 1>&2\n    exit 1\n  fi\nfi\\\n\"\n}\n\n\n# func_emit_cwrapperexe_src\n# emit the source code for a wrapper executable on stdout\n# Must ONLY be called from within func_mode_link because\n# it depends on a number of variable set therein.\nfunc_emit_cwrapperexe_src ()\n{\n\tcat <<EOF\n\n/* $cwrappersource - temporary wrapper executable for $objdir/$outputname\n   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n\n   The $output program cannot be directly executed until all the libtool\n   libraries that it depends on are installed.\n\n   This wrapper executable should never be moved out of the build directory.\n   If it is, it will not operate correctly.\n*/\nEOF\n\t    cat <<\"EOF\"\n#ifdef _MSC_VER\n# define _CRT_SECURE_NO_DEPRECATE 1\n#endif\n#include <stdio.h>\n#include <stdlib.h>\n#ifdef _MSC_VER\n# include <direct.h>\n# include <process.h>\n# include <io.h>\n#else\n# include <unistd.h>\n# include <stdint.h>\n# ifdef __CYGWIN__\n#  include <io.h>\n# endif\n#endif\n#include <malloc.h>\n#include <stdarg.h>\n#include <assert.h>\n#include <string.h>\n#include <ctype.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <sys/stat.h>\n\n/* declarations of non-ANSI functions */\n#if defined(__MINGW32__)\n# ifdef __STRICT_ANSI__\nint _putenv (const char *);\n# endif\n#elif defined(__CYGWIN__)\n# ifdef __STRICT_ANSI__\nchar *realpath (const char *, char *);\nint putenv (char *);\nint setenv (const char *, const char *, int);\n# endif\n/* #elif defined (other platforms) ... */\n#endif\n\n/* portability defines, excluding path handling macros */\n#if defined(_MSC_VER)\n# define setmode _setmode\n# define stat    _stat\n# define chmod   _chmod\n# define getcwd  _getcwd\n# define putenv  _putenv\n# define S_IXUSR _S_IEXEC\n# ifndef _INTPTR_T_DEFINED\n#  define _INTPTR_T_DEFINED\n#  define intptr_t int\n# endif\n#elif defined(__MINGW32__)\n# define setmode _setmode\n# define stat    _stat\n# define chmod   _chmod\n# define getcwd  _getcwd\n# define putenv  _putenv\n#elif defined(__CYGWIN__)\n# define HAVE_SETENV\n# define FOPEN_WB \"wb\"\n/* #elif defined (other platforms) ... */\n#endif\n\n#if defined(PATH_MAX)\n# define LT_PATHMAX PATH_MAX\n#elif defined(MAXPATHLEN)\n# define LT_PATHMAX MAXPATHLEN\n#else\n# define LT_PATHMAX 1024\n#endif\n\n#ifndef S_IXOTH\n# define S_IXOTH 0\n#endif\n#ifndef S_IXGRP\n# define S_IXGRP 0\n#endif\n\n/* path handling portability macros */\n#ifndef DIR_SEPARATOR\n# define DIR_SEPARATOR '/'\n# define PATH_SEPARATOR ':'\n#endif\n\n#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \\\n  defined (__OS2__)\n# define HAVE_DOS_BASED_FILE_SYSTEM\n# define FOPEN_WB \"wb\"\n# ifndef DIR_SEPARATOR_2\n#  define DIR_SEPARATOR_2 '\\\\'\n# endif\n# ifndef PATH_SEPARATOR_2\n#  define PATH_SEPARATOR_2 ';'\n# endif\n#endif\n\n#ifndef DIR_SEPARATOR_2\n# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)\n#else /* DIR_SEPARATOR_2 */\n# define IS_DIR_SEPARATOR(ch) \\\n\t(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))\n#endif /* DIR_SEPARATOR_2 */\n\n#ifndef PATH_SEPARATOR_2\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)\n#else /* PATH_SEPARATOR_2 */\n# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)\n#endif /* PATH_SEPARATOR_2 */\n\n#ifndef FOPEN_WB\n# define FOPEN_WB \"w\"\n#endif\n#ifndef _O_BINARY\n# define _O_BINARY 0\n#endif\n\n#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))\n#define XFREE(stale) do { \\\n  if (stale) { free ((void *) stale); stale = 0; } \\\n} while (0)\n\n#if defined(LT_DEBUGWRAPPER)\nstatic int lt_debug = 1;\n#else\nstatic int lt_debug = 0;\n#endif\n\nconst char *program_name = \"libtool-wrapper\"; /* in case xstrdup fails */\n\nvoid *xmalloc (size_t num);\nchar *xstrdup (const char *string);\nconst char *base_name (const char *name);\nchar *find_executable (const char *wrapper);\nchar *chase_symlinks (const char *pathspec);\nint make_executable (const char *path);\nint check_executable (const char *path);\nchar *strendzap (char *str, const char *pat);\nvoid lt_debugprintf (const char *file, int line, const char *fmt, ...);\nvoid lt_fatal (const char *file, int line, const char *message, ...);\nstatic const char *nonnull (const char *s);\nstatic const char *nonempty (const char *s);\nvoid lt_setenv (const char *name, const char *value);\nchar *lt_extend_str (const char *orig_value, const char *add, int to_end);\nvoid lt_update_exe_path (const char *name, const char *value);\nvoid lt_update_lib_path (const char *name, const char *value);\nchar **prepare_spawn (char **argv);\nvoid lt_dump_script (FILE *f);\nEOF\n\n\t    cat <<EOF\nvolatile const char * MAGIC_EXE = \"$magic_exe\";\nconst char * LIB_PATH_VARNAME = \"$shlibpath_var\";\nEOF\n\n\t    if test \"$shlibpath_overrides_runpath\" = yes && test -n \"$shlibpath_var\" && test -n \"$temp_rpath\"; then\n              func_to_host_path \"$temp_rpath\"\n\t      cat <<EOF\nconst char * LIB_PATH_VALUE   = \"$func_to_host_path_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * LIB_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test -n \"$dllsearchpath\"; then\n              func_to_host_path \"$dllsearchpath:\"\n\t      cat <<EOF\nconst char * EXE_PATH_VARNAME = \"PATH\";\nconst char * EXE_PATH_VALUE   = \"$func_to_host_path_result\";\nEOF\n\t    else\n\t      cat <<\"EOF\"\nconst char * EXE_PATH_VARNAME = \"\";\nconst char * EXE_PATH_VALUE   = \"\";\nEOF\n\t    fi\n\n\t    if test \"$fast_install\" = yes; then\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"lt-$outputname\"; /* hopefully, no .exe */\nEOF\n\t    else\n\t      cat <<EOF\nconst char * TARGET_PROGRAM_NAME = \"$outputname\"; /* hopefully, no .exe */\nEOF\n\t    fi\n\n\n\t    cat <<\"EOF\"\n\n#define LTWRAPPER_OPTION_PREFIX         \"--lt-\"\n\nstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;\nstatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX \"dump-script\";\nstatic const char *debug_opt            = LTWRAPPER_OPTION_PREFIX \"debug\";\n\nint\nmain (int argc, char *argv[])\n{\n  char **newargz;\n  int  newargc;\n  char *tmp_pathspec;\n  char *actual_cwrapper_path;\n  char *actual_cwrapper_name;\n  char *target_name;\n  char *lt_argv_zero;\n  intptr_t rval = 127;\n\n  int i;\n\n  program_name = (char *) xstrdup (base_name (argv[0]));\n  newargz = XMALLOC (char *, argc + 1);\n\n  /* very simple arg parsing; don't want to rely on getopt\n   * also, copy all non cwrapper options to newargz, except\n   * argz[0], which is handled differently\n   */\n  newargc=0;\n  for (i = 1; i < argc; i++)\n    {\n      if (strcmp (argv[i], dumpscript_opt) == 0)\n\t{\nEOF\n\t    case \"$host\" in\n\t      *mingw* | *cygwin* )\n\t\t# make stdout use \"unix\" line endings\n\t\techo \"          setmode(1,_O_BINARY);\"\n\t\t;;\n\t      esac\n\n\t    cat <<\"EOF\"\n\t  lt_dump_script (stdout);\n\t  return 0;\n\t}\n      if (strcmp (argv[i], debug_opt) == 0)\n\t{\n          lt_debug = 1;\n          continue;\n\t}\n      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)\n        {\n          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX\n             namespace, but it is not one of the ones we know about and\n             have already dealt with, above (inluding dump-script), then\n             report an error. Otherwise, targets might begin to believe\n             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX\n             namespace. The first time any user complains about this, we'll\n             need to make LTWRAPPER_OPTION_PREFIX a configure-time option\n             or a configure.ac-settable value.\n           */\n          lt_fatal (__FILE__, __LINE__,\n\t\t    \"unrecognized %s option: '%s'\",\n                    ltwrapper_option_prefix, argv[i]);\n        }\n      /* otherwise ... */\n      newargz[++newargc] = xstrdup (argv[i]);\n    }\n  newargz[++newargc] = NULL;\n\nEOF\n\t    cat <<EOF\n  /* The GNU banner must be the first non-error debug message */\n  lt_debugprintf (__FILE__, __LINE__, \"libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\\n\");\nEOF\n\t    cat <<\"EOF\"\n  lt_debugprintf (__FILE__, __LINE__, \"(main) argv[0]: %s\\n\", argv[0]);\n  lt_debugprintf (__FILE__, __LINE__, \"(main) program_name: %s\\n\", program_name);\n\n  tmp_pathspec = find_executable (argv[0]);\n  if (tmp_pathspec == NULL)\n    lt_fatal (__FILE__, __LINE__, \"couldn't find %s\", argv[0]);\n  lt_debugprintf (__FILE__, __LINE__,\n                  \"(main) found exe (before symlink chase) at: %s\\n\",\n\t\t  tmp_pathspec);\n\n  actual_cwrapper_path = chase_symlinks (tmp_pathspec);\n  lt_debugprintf (__FILE__, __LINE__,\n                  \"(main) found exe (after symlink chase) at: %s\\n\",\n\t\t  actual_cwrapper_path);\n  XFREE (tmp_pathspec);\n\n  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));\n  strendzap (actual_cwrapper_path, actual_cwrapper_name);\n\n  /* wrapper name transforms */\n  strendzap (actual_cwrapper_name, \".exe\");\n  tmp_pathspec = lt_extend_str (actual_cwrapper_name, \".exe\", 1);\n  XFREE (actual_cwrapper_name);\n  actual_cwrapper_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  /* target_name transforms -- use actual target program name; might have lt- prefix */\n  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));\n  strendzap (target_name, \".exe\");\n  tmp_pathspec = lt_extend_str (target_name, \".exe\", 1);\n  XFREE (target_name);\n  target_name = tmp_pathspec;\n  tmp_pathspec = 0;\n\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(main) libtool target name: %s\\n\",\n\t\t  target_name);\nEOF\n\n\t    cat <<EOF\n  newargz[0] =\n    XMALLOC (char, (strlen (actual_cwrapper_path) +\n\t\t    strlen (\"$objdir\") + 1 + strlen (actual_cwrapper_name) + 1));\n  strcpy (newargz[0], actual_cwrapper_path);\n  strcat (newargz[0], \"$objdir\");\n  strcat (newargz[0], \"/\");\nEOF\n\n\t    cat <<\"EOF\"\n  /* stop here, and copy so we don't have to do this twice */\n  tmp_pathspec = xstrdup (newargz[0]);\n\n  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */\n  strcat (newargz[0], actual_cwrapper_name);\n\n  /* DO want the lt- prefix here if it exists, so use target_name */\n  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);\n  XFREE (tmp_pathspec);\n  tmp_pathspec = NULL;\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t    cat <<\"EOF\"\n  {\n    char* p;\n    while ((p = strchr (newargz[0], '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n    while ((p = strchr (lt_argv_zero, '\\\\')) != NULL)\n      {\n\t*p = '/';\n      }\n  }\nEOF\n\t    ;;\n\t    esac\n\n\t    cat <<\"EOF\"\n  XFREE (target_name);\n  XFREE (actual_cwrapper_path);\n  XFREE (actual_cwrapper_name);\n\n  lt_setenv (\"BIN_SH\", \"xpg4\"); /* for Tru64 */\n  lt_setenv (\"DUALCASE\", \"1\");  /* for MSK sh */\n  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must\n     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)\n     because on Windows, both *_VARNAMEs are PATH but uninstalled\n     libraries must come first. */\n  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);\n  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);\n\n  lt_debugprintf (__FILE__, __LINE__, \"(main) lt_argv_zero: %s\\n\",\n\t\t  nonnull (lt_argv_zero));\n  for (i = 0; i < newargc; i++)\n    {\n      lt_debugprintf (__FILE__, __LINE__, \"(main) newargz[%d]: %s\\n\",\n\t\t      i, nonnull (newargz[i]));\n    }\n\nEOF\n\n\t    case $host_os in\n\t      mingw*)\n\t\tcat <<\"EOF\"\n  /* execv doesn't actually work on mingw as expected on unix */\n  newargz = prepare_spawn (newargz);\n  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);\n  if (rval == -1)\n    {\n      /* failed to start process */\n      lt_debugprintf (__FILE__, __LINE__,\n\t\t      \"(main) failed to launch target \\\"%s\\\": %s\\n\",\n\t\t      lt_argv_zero, nonnull (strerror (errno)));\n      return 127;\n    }\n  return rval;\nEOF\n\t\t;;\n\t      *)\n\t\tcat <<\"EOF\"\n  execv (lt_argv_zero, newargz);\n  return rval; /* =127, but avoids unused variable warning */\nEOF\n\t\t;;\n\t    esac\n\n\t    cat <<\"EOF\"\n}\n\nvoid *\nxmalloc (size_t num)\n{\n  void *p = (void *) malloc (num);\n  if (!p)\n    lt_fatal (__FILE__, __LINE__, \"memory exhausted\");\n\n  return p;\n}\n\nchar *\nxstrdup (const char *string)\n{\n  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),\n\t\t\t  string) : NULL;\n}\n\nconst char *\nbase_name (const char *name)\n{\n  const char *base;\n\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  /* Skip over the disk name in MSDOS pathnames. */\n  if (isalpha ((unsigned char) name[0]) && name[1] == ':')\n    name += 2;\n#endif\n\n  for (base = name; *name; name++)\n    if (IS_DIR_SEPARATOR (*name))\n      base = name + 1;\n  return base;\n}\n\nint\ncheck_executable (const char *path)\n{\n  struct stat st;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(check_executable): %s\\n\",\n                  nonempty (path));\n  if ((!path) || (!*path))\n    return 0;\n\n  if ((stat (path, &st) >= 0)\n      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))\n    return 1;\n  else\n    return 0;\n}\n\nint\nmake_executable (const char *path)\n{\n  int rval = 0;\n  struct stat st;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(make_executable): %s\\n\",\n                  nonempty (path));\n  if ((!path) || (!*path))\n    return 0;\n\n  if (stat (path, &st) >= 0)\n    {\n      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);\n    }\n  return rval;\n}\n\n/* Searches for the full path of the wrapper.  Returns\n   newly allocated full path name if found, NULL otherwise\n   Does not chase symlinks, even on platforms that support them.\n*/\nchar *\nfind_executable (const char *wrapper)\n{\n  int has_slash = 0;\n  const char *p;\n  const char *p_next;\n  /* static buffer for getcwd */\n  char tmp[LT_PATHMAX + 1];\n  int tmp_len;\n  char *concat_name;\n\n  lt_debugprintf (__FILE__, __LINE__, \"(find_executable): %s\\n\",\n                  nonempty (wrapper));\n\n  if ((wrapper == NULL) || (*wrapper == '\\0'))\n    return NULL;\n\n  /* Absolute path? */\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')\n    {\n      concat_name = xstrdup (wrapper);\n      if (check_executable (concat_name))\n\treturn concat_name;\n      XFREE (concat_name);\n    }\n  else\n    {\n#endif\n      if (IS_DIR_SEPARATOR (wrapper[0]))\n\t{\n\t  concat_name = xstrdup (wrapper);\n\t  if (check_executable (concat_name))\n\t    return concat_name;\n\t  XFREE (concat_name);\n\t}\n#if defined (HAVE_DOS_BASED_FILE_SYSTEM)\n    }\n#endif\n\n  for (p = wrapper; *p; p++)\n    if (*p == '/')\n      {\n\thas_slash = 1;\n\tbreak;\n      }\n  if (!has_slash)\n    {\n      /* no slashes; search PATH */\n      const char *path = getenv (\"PATH\");\n      if (path != NULL)\n\t{\n\t  for (p = path; *p; p = p_next)\n\t    {\n\t      const char *q;\n\t      size_t p_len;\n\t      for (q = p; *q; q++)\n\t\tif (IS_PATH_SEPARATOR (*q))\n\t\t  break;\n\t      p_len = q - p;\n\t      p_next = (*q == '\\0' ? q : q + 1);\n\t      if (p_len == 0)\n\t\t{\n\t\t  /* empty path: current directory */\n\t\t  if (getcwd (tmp, LT_PATHMAX) == NULL)\n\t\t    lt_fatal (__FILE__, __LINE__, \"getcwd failed: %s\",\n                              nonnull (strerror (errno)));\n\t\t  tmp_len = strlen (tmp);\n\t\t  concat_name =\n\t\t    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, tmp, tmp_len);\n\t\t  concat_name[tmp_len] = '/';\n\t\t  strcpy (concat_name + tmp_len + 1, wrapper);\n\t\t}\n\t      else\n\t\t{\n\t\t  concat_name =\n\t\t    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);\n\t\t  memcpy (concat_name, p, p_len);\n\t\t  concat_name[p_len] = '/';\n\t\t  strcpy (concat_name + p_len + 1, wrapper);\n\t\t}\n\t      if (check_executable (concat_name))\n\t\treturn concat_name;\n\t      XFREE (concat_name);\n\t    }\n\t}\n      /* not found in PATH; assume curdir */\n    }\n  /* Relative path | not found in path: prepend cwd */\n  if (getcwd (tmp, LT_PATHMAX) == NULL)\n    lt_fatal (__FILE__, __LINE__, \"getcwd failed: %s\",\n              nonnull (strerror (errno)));\n  tmp_len = strlen (tmp);\n  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);\n  memcpy (concat_name, tmp, tmp_len);\n  concat_name[tmp_len] = '/';\n  strcpy (concat_name + tmp_len + 1, wrapper);\n\n  if (check_executable (concat_name))\n    return concat_name;\n  XFREE (concat_name);\n  return NULL;\n}\n\nchar *\nchase_symlinks (const char *pathspec)\n{\n#ifndef S_ISLNK\n  return xstrdup (pathspec);\n#else\n  char buf[LT_PATHMAX];\n  struct stat s;\n  char *tmp_pathspec = xstrdup (pathspec);\n  char *p;\n  int has_symlinks = 0;\n  while (strlen (tmp_pathspec) && !has_symlinks)\n    {\n      lt_debugprintf (__FILE__, __LINE__,\n\t\t      \"checking path component for symlinks: %s\\n\",\n\t\t      tmp_pathspec);\n      if (lstat (tmp_pathspec, &s) == 0)\n\t{\n\t  if (S_ISLNK (s.st_mode) != 0)\n\t    {\n\t      has_symlinks = 1;\n\t      break;\n\t    }\n\n\t  /* search backwards for last DIR_SEPARATOR */\n\t  p = tmp_pathspec + strlen (tmp_pathspec) - 1;\n\t  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    p--;\n\t  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))\n\t    {\n\t      /* no more DIR_SEPARATORS left */\n\t      break;\n\t    }\n\t  *p = '\\0';\n\t}\n      else\n\t{\n\t  lt_fatal (__FILE__, __LINE__,\n\t\t    \"error accessing file \\\"%s\\\": %s\",\n\t\t    tmp_pathspec, nonnull (strerror (errno)));\n\t}\n    }\n  XFREE (tmp_pathspec);\n\n  if (!has_symlinks)\n    {\n      return xstrdup (pathspec);\n    }\n\n  tmp_pathspec = realpath (pathspec, buf);\n  if (tmp_pathspec == 0)\n    {\n      lt_fatal (__FILE__, __LINE__,\n\t\t\"could not follow symlinks for %s\", pathspec);\n    }\n  return xstrdup (tmp_pathspec);\n#endif\n}\n\nchar *\nstrendzap (char *str, const char *pat)\n{\n  size_t len, patlen;\n\n  assert (str != NULL);\n  assert (pat != NULL);\n\n  len = strlen (str);\n  patlen = strlen (pat);\n\n  if (patlen <= len)\n    {\n      str += len - patlen;\n      if (strcmp (str, pat) == 0)\n\t*str = '\\0';\n    }\n  return str;\n}\n\nvoid\nlt_debugprintf (const char *file, int line, const char *fmt, ...)\n{\n  va_list args;\n  if (lt_debug)\n    {\n      (void) fprintf (stderr, \"%s:%s:%d: \", program_name, file, line);\n      va_start (args, fmt);\n      (void) vfprintf (stderr, fmt, args);\n      va_end (args);\n    }\n}\n\nstatic void\nlt_error_core (int exit_status, const char *file,\n\t       int line, const char *mode,\n\t       const char *message, va_list ap)\n{\n  fprintf (stderr, \"%s:%s:%d: %s: \", program_name, file, line, mode);\n  vfprintf (stderr, message, ap);\n  fprintf (stderr, \".\\n\");\n\n  if (exit_status >= 0)\n    exit (exit_status);\n}\n\nvoid\nlt_fatal (const char *file, int line, const char *message, ...)\n{\n  va_list ap;\n  va_start (ap, message);\n  lt_error_core (EXIT_FAILURE, file, line, \"FATAL\", message, ap);\n  va_end (ap);\n}\n\nstatic const char *\nnonnull (const char *s)\n{\n  return s ? s : \"(null)\";\n}\n\nstatic const char *\nnonempty (const char *s)\n{\n  return (s && !*s) ? \"(empty)\" : nonnull (s);\n}\n\nvoid\nlt_setenv (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_setenv) setting '%s' to '%s'\\n\",\n                  nonnull (name), nonnull (value));\n  {\n#ifdef HAVE_SETENV\n    /* always make a copy, for consistency with !HAVE_SETENV */\n    char *str = xstrdup (value);\n    setenv (name, str, 1);\n#else\n    int len = strlen (name) + 1 + strlen (value) + 1;\n    char *str = XMALLOC (char, len);\n    sprintf (str, \"%s=%s\", name, value);\n    if (putenv (str) != EXIT_SUCCESS)\n      {\n        XFREE (str);\n      }\n#endif\n  }\n}\n\nchar *\nlt_extend_str (const char *orig_value, const char *add, int to_end)\n{\n  char *new_value;\n  if (orig_value && *orig_value)\n    {\n      int orig_value_len = strlen (orig_value);\n      int add_len = strlen (add);\n      new_value = XMALLOC (char, add_len + orig_value_len + 1);\n      if (to_end)\n        {\n          strcpy (new_value, orig_value);\n          strcpy (new_value + orig_value_len, add);\n        }\n      else\n        {\n          strcpy (new_value, add);\n          strcpy (new_value + add_len, orig_value);\n        }\n    }\n  else\n    {\n      new_value = xstrdup (add);\n    }\n  return new_value;\n}\n\nvoid\nlt_update_exe_path (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_update_exe_path) modifying '%s' by prepending '%s'\\n\",\n                  nonnull (name), nonnull (value));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      /* some systems can't cope with a ':'-terminated path #' */\n      int len = strlen (new_value);\n      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))\n        {\n          new_value[len-1] = '\\0';\n        }\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\nvoid\nlt_update_lib_path (const char *name, const char *value)\n{\n  lt_debugprintf (__FILE__, __LINE__,\n\t\t  \"(lt_update_lib_path) modifying '%s' by prepending '%s'\\n\",\n                  nonnull (name), nonnull (value));\n\n  if (name && *name && value && *value)\n    {\n      char *new_value = lt_extend_str (getenv (name), value, 0);\n      lt_setenv (name, new_value);\n      XFREE (new_value);\n    }\n}\n\nEOF\n\t    case $host_os in\n\t      mingw*)\n\t\tcat <<\"EOF\"\n\n/* Prepares an argument vector before calling spawn().\n   Note that spawn() does not by itself call the command interpreter\n     (getenv (\"COMSPEC\") != NULL ? getenv (\"COMSPEC\") :\n      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);\n         GetVersionEx(&v);\n         v.dwPlatformId == VER_PLATFORM_WIN32_NT;\n      }) ? \"cmd.exe\" : \"command.com\").\n   Instead it simply concatenates the arguments, separated by ' ', and calls\n   CreateProcess().  We must quote the arguments since Win32 CreateProcess()\n   interprets characters like ' ', '\\t', '\\\\', '\"' (but not '<' and '>') in a\n   special way:\n   - Space and tab are interpreted as delimiters. They are not treated as\n     delimiters if they are surrounded by double quotes: \"...\".\n   - Unescaped double quotes are removed from the input. Their only effect is\n     that within double quotes, space and tab are treated like normal\n     characters.\n   - Backslashes not followed by double quotes are not special.\n   - But 2*n+1 backslashes followed by a double quote become\n     n backslashes followed by a double quote (n >= 0):\n       \\\" -> \"\n       \\\\\\\" -> \\\"\n       \\\\\\\\\\\" -> \\\\\"\n */\n#define SHELL_SPECIAL_CHARS \"\\\"\\\\ \\001\\002\\003\\004\\005\\006\\007\\010\\011\\012\\013\\014\\015\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"\n#define SHELL_SPACE_CHARS \" \\001\\002\\003\\004\\005\\006\\007\\010\\011\\012\\013\\014\\015\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"\nchar **\nprepare_spawn (char **argv)\n{\n  size_t argc;\n  char **new_argv;\n  size_t i;\n\n  /* Count number of arguments.  */\n  for (argc = 0; argv[argc] != NULL; argc++)\n    ;\n\n  /* Allocate new argument vector.  */\n  new_argv = XMALLOC (char *, argc + 1);\n\n  /* Put quoted arguments into the new argument vector.  */\n  for (i = 0; i < argc; i++)\n    {\n      const char *string = argv[i];\n\n      if (string[0] == '\\0')\n\tnew_argv[i] = xstrdup (\"\\\"\\\"\");\n      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)\n\t{\n\t  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);\n\t  size_t length;\n\t  unsigned int backslashes;\n\t  const char *s;\n\t  char *quoted_string;\n\t  char *p;\n\n\t  length = 0;\n\t  backslashes = 0;\n\t  if (quote_around)\n\t    length++;\n\t  for (s = string; *s != '\\0'; s++)\n\t    {\n\t      char c = *s;\n\t      if (c == '\"')\n\t\tlength += backslashes + 1;\n\t      length++;\n\t      if (c == '\\\\')\n\t\tbackslashes++;\n\t      else\n\t\tbackslashes = 0;\n\t    }\n\t  if (quote_around)\n\t    length += backslashes + 1;\n\n\t  quoted_string = XMALLOC (char, length + 1);\n\n\t  p = quoted_string;\n\t  backslashes = 0;\n\t  if (quote_around)\n\t    *p++ = '\"';\n\t  for (s = string; *s != '\\0'; s++)\n\t    {\n\t      char c = *s;\n\t      if (c == '\"')\n\t\t{\n\t\t  unsigned int j;\n\t\t  for (j = backslashes + 1; j > 0; j--)\n\t\t    *p++ = '\\\\';\n\t\t}\n\t      *p++ = c;\n\t      if (c == '\\\\')\n\t\tbackslashes++;\n\t      else\n\t\tbackslashes = 0;\n\t    }\n\t  if (quote_around)\n\t    {\n\t      unsigned int j;\n\t      for (j = backslashes; j > 0; j--)\n\t\t*p++ = '\\\\';\n\t      *p++ = '\"';\n\t    }\n\t  *p = '\\0';\n\n\t  new_argv[i] = quoted_string;\n\t}\n      else\n\tnew_argv[i] = (char *) string;\n    }\n  new_argv[argc] = NULL;\n\n  return new_argv;\n}\nEOF\n\t\t;;\n\t    esac\n\n            cat <<\"EOF\"\nvoid lt_dump_script (FILE* f)\n{\nEOF\n\t    func_emit_wrapper yes |\n              $SED -e 's/\\([\\\\\"]\\)/\\\\\\1/g' \\\n\t           -e 's/^/  fputs (\"/' -e 's/$/\\\\n\", f);/'\n\n            cat <<\"EOF\"\n}\nEOF\n}\n# end: func_emit_cwrapperexe_src\n\n# func_win32_import_lib_p ARG\n# True if ARG is an import lib, as indicated by $file_magic_cmd\nfunc_win32_import_lib_p ()\n{\n    $opt_debug\n    case `eval $file_magic_cmd \\\"\\$1\\\" 2>/dev/null | $SED -e 10q` in\n    *import*) : ;;\n    *) false ;;\n    esac\n}\n\n# func_mode_link arg...\nfunc_mode_link ()\n{\n    $opt_debug\n    case $host in\n    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n      # It is impossible to link a dll without this setting, and\n      # we shouldn't force the makefile maintainer to figure out\n      # which system we are compiling for in order to pass an extra\n      # flag for every libtool invocation.\n      # allow_undefined=no\n\n      # FIXME: Unfortunately, there are problems with the above when trying\n      # to make a dll which has undefined symbols, in which case not\n      # even a static library is built.  For now, we need to specify\n      # -no-undefined on the libtool link line when we can be certain\n      # that all symbols are satisfied, otherwise we get a static library.\n      allow_undefined=yes\n      ;;\n    *)\n      allow_undefined=yes\n      ;;\n    esac\n    libtool_args=$nonopt\n    base_compile=\"$nonopt $@\"\n    compile_command=$nonopt\n    finalize_command=$nonopt\n\n    compile_rpath=\n    finalize_rpath=\n    compile_shlibpath=\n    finalize_shlibpath=\n    convenience=\n    old_convenience=\n    deplibs=\n    old_deplibs=\n    compiler_flags=\n    linker_flags=\n    dllsearchpath=\n    lib_search_path=`pwd`\n    inst_prefix_dir=\n    new_inherited_linker_flags=\n\n    avoid_version=no\n    bindir=\n    dlfiles=\n    dlprefiles=\n    dlself=no\n    export_dynamic=no\n    export_symbols=\n    export_symbols_regex=\n    generated=\n    libobjs=\n    ltlibs=\n    module=no\n    no_install=no\n    objs=\n    non_pic_objects=\n    precious_files_regex=\n    prefer_static_libs=no\n    preload=no\n    prev=\n    prevarg=\n    release=\n    rpath=\n    xrpath=\n    perm_rpath=\n    temp_rpath=\n    thread_safe=no\n    vinfo=\n    vinfo_number=no\n    weak_libs=\n    single_module=\"${wl}-single_module\"\n    func_infer_tag $base_compile\n\n    # We need to know -static, to get the right output filenames.\n    for arg\n    do\n      case $arg in\n      -shared)\n\ttest \"$build_libtool_libs\" != yes && \\\n\t  func_fatal_configuration \"can not build a shared library\"\n\tbuild_old_libs=no\n\tbreak\n\t;;\n      -all-static | -static | -static-libtool-libs)\n\tcase $arg in\n\t-all-static)\n\t  if test \"$build_libtool_libs\" = yes && test -z \"$link_static_flag\"; then\n\t    func_warning \"complete static linking is impossible in this configuration\"\n\t  fi\n\t  if test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\t-static)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=built\n\t  ;;\n\t-static-libtool-libs)\n\t  if test -z \"$pic_flag\" && test -n \"$link_static_flag\"; then\n\t    dlopen_self=$dlopen_self_static\n\t  fi\n\t  prefer_static_libs=yes\n\t  ;;\n\tesac\n\tbuild_libtool_libs=no\n\tbuild_old_libs=yes\n\tbreak\n\t;;\n      esac\n    done\n\n    # See if our shared archives depend on static archives.\n    test -n \"$old_archive_from_new_cmds\" && build_old_libs=yes\n\n    # Go through the arguments, transforming them on the way.\n    while test \"$#\" -gt 0; do\n      arg=\"$1\"\n      shift\n      func_quote_for_eval \"$arg\"\n      qarg=$func_quote_for_eval_unquoted_result\n      func_append libtool_args \" $func_quote_for_eval_result\"\n\n      # If the previous option needs an argument, assign it.\n      if test -n \"$prev\"; then\n\tcase $prev in\n\toutput)\n\t  func_append compile_command \" @OUTPUT@\"\n\t  func_append finalize_command \" @OUTPUT@\"\n\t  ;;\n\tesac\n\n\tcase $prev in\n\tbindir)\n\t  bindir=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tdlfiles|dlprefiles)\n\t  if test \"$preload\" = no; then\n\t    # Add the symbol object into the linking commands.\n\t    func_append compile_command \" @SYMFILE@\"\n\t    func_append finalize_command \" @SYMFILE@\"\n\t    preload=yes\n\t  fi\n\t  case $arg in\n\t  *.la | *.lo) ;;  # We handle these cases below.\n\t  force)\n\t    if test \"$dlself\" = no; then\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  self)\n\t    if test \"$prev\" = dlprefiles; then\n\t      dlself=yes\n\t    elif test \"$prev\" = dlfiles && test \"$dlopen_self\" != yes; then\n\t      dlself=yes\n\t    else\n\t      dlself=needless\n\t      export_dynamic=yes\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  *)\n\t    if test \"$prev\" = dlfiles; then\n\t      func_append dlfiles \" $arg\"\n\t    else\n\t      func_append dlprefiles \" $arg\"\n\t    fi\n\t    prev=\n\t    continue\n\t    ;;\n\t  esac\n\t  ;;\n\texpsyms)\n\t  export_symbols=\"$arg\"\n\t  test -f \"$arg\" \\\n\t    || func_fatal_error \"symbol file \\`$arg' does not exist\"\n\t  prev=\n\t  continue\n\t  ;;\n\texpsyms_regex)\n\t  export_symbols_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tframework)\n\t  case $host in\n\t    *-*-darwin*)\n\t      case \"$deplibs \" in\n\t\t*\" $qarg.ltframework \"*) ;;\n\t\t*) func_append deplibs \" $qarg.ltframework\" # this is fixed later\n\t\t   ;;\n\t      esac\n\t      ;;\n\t  esac\n\t  prev=\n\t  continue\n\t  ;;\n\tinst_prefix)\n\t  inst_prefix_dir=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tobjectlist)\n\t  if test -f \"$arg\"; then\n\t    save_arg=$arg\n\t    moreargs=\n\t    for fil in `cat \"$save_arg\"`\n\t    do\n#\t      func_append moreargs \" $fil\"\n\t      arg=$fil\n\t      # A libtool-controlled object.\n\n\t      # Check to see that this really is a libtool object.\n\t      if func_lalib_unsafe_p \"$arg\"; then\n\t\tpic_object=\n\t\tnon_pic_object=\n\n\t\t# Read the .lo file\n\t\tfunc_source \"$arg\"\n\n\t\tif test -z \"$pic_object\" ||\n\t\t   test -z \"$non_pic_object\" ||\n\t\t   test \"$pic_object\" = none &&\n\t\t   test \"$non_pic_object\" = none; then\n\t\t  func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t\tfi\n\n\t\t# Extract subdirectory from the argument.\n\t\tfunc_dirname \"$arg\" \"/\" \"\"\n\t\txdir=\"$func_dirname_result\"\n\n\t\tif test \"$pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  pic_object=\"$xdir$pic_object\"\n\n\t\t  if test \"$prev\" = dlfiles; then\n\t\t    if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\t      func_append dlfiles \" $pic_object\"\n\t\t      prev=\n\t\t      continue\n\t\t    else\n\t\t      # If libtool objects are unsupported, then we need to preload.\n\t\t      prev=dlprefiles\n\t\t    fi\n\t\t  fi\n\n\t\t  # CHECK ME:  I think I busted this.  -Ossama\n\t\t  if test \"$prev\" = dlprefiles; then\n\t\t    # Preload the old-style object.\n\t\t    func_append dlprefiles \" $pic_object\"\n\t\t    prev=\n\t\t  fi\n\n\t\t  # A PIC object.\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  arg=\"$pic_object\"\n\t\tfi\n\n\t\t# Non-PIC object.\n\t\tif test \"$non_pic_object\" != none; then\n\t\t  # Prepend the subdirectory the object is found in.\n\t\t  non_pic_object=\"$xdir$non_pic_object\"\n\n\t\t  # A standard non-PIC object\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\t  if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t\t    arg=\"$non_pic_object\"\n\t\t  fi\n\t\telse\n\t\t  # If the PIC object exists, use it instead.\n\t\t  # $xdir was prepended to $pic_object above.\n\t\t  non_pic_object=\"$pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t\tfi\n\t      else\n\t\t# Only an error if not doing a dry-run.\n\t\tif $opt_dry_run; then\n\t\t  # Extract subdirectory from the argument.\n\t\t  func_dirname \"$arg\" \"/\" \"\"\n\t\t  xdir=\"$func_dirname_result\"\n\n\t\t  func_lo2o \"$arg\"\n\t\t  pic_object=$xdir$objdir/$func_lo2o_result\n\t\t  non_pic_object=$xdir$func_lo2o_result\n\t\t  func_append libobjs \" $pic_object\"\n\t\t  func_append non_pic_objects \" $non_pic_object\"\n\t        else\n\t\t  func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t\tfi\n\t      fi\n\t    done\n\t  else\n\t    func_fatal_error \"link input file \\`$arg' does not exist\"\n\t  fi\n\t  arg=$save_arg\n\t  prev=\n\t  continue\n\t  ;;\n\tprecious_regex)\n\t  precious_files_regex=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trelease)\n\t  release=\"-$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\trpath | xrpath)\n\t  # We need an absolute path.\n\t  case $arg in\n\t  [\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t  *)\n\t    func_fatal_error \"only absolute run-paths are allowed\"\n\t    ;;\n\t  esac\n\t  if test \"$prev\" = rpath; then\n\t    case \"$rpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) func_append rpath \" $arg\" ;;\n\t    esac\n\t  else\n\t    case \"$xrpath \" in\n\t    *\" $arg \"*) ;;\n\t    *) func_append xrpath \" $arg\" ;;\n\t    esac\n\t  fi\n\t  prev=\n\t  continue\n\t  ;;\n\tshrext)\n\t  shrext_cmds=\"$arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\tweak)\n\t  func_append weak_libs \" $arg\"\n\t  prev=\n\t  continue\n\t  ;;\n\txcclinker)\n\t  func_append linker_flags \" $qarg\"\n\t  func_append compiler_flags \" $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txcompiler)\n\t  func_append compiler_flags \" $qarg\"\n\t  prev=\n\t  func_append compile_command \" $qarg\"\n\t  func_append finalize_command \" $qarg\"\n\t  continue\n\t  ;;\n\txlinker)\n\t  func_append linker_flags \" $qarg\"\n\t  func_append compiler_flags \" $wl$qarg\"\n\t  prev=\n\t  func_append compile_command \" $wl$qarg\"\n\t  func_append finalize_command \" $wl$qarg\"\n\t  continue\n\t  ;;\n\t*)\n\t  eval \"$prev=\\\"\\$arg\\\"\"\n\t  prev=\n\t  continue\n\t  ;;\n\tesac\n      fi # test -n \"$prev\"\n\n      prevarg=\"$arg\"\n\n      case $arg in\n      -all-static)\n\tif test -n \"$link_static_flag\"; then\n\t  # See comment for -static flag below, for more details.\n\t  func_append compile_command \" $link_static_flag\"\n\t  func_append finalize_command \" $link_static_flag\"\n\tfi\n\tcontinue\n\t;;\n\n      -allow-undefined)\n\t# FIXME: remove this flag sometime in the future.\n\tfunc_fatal_error \"\\`-allow-undefined' must not be used because it is the default\"\n\t;;\n\n      -avoid-version)\n\tavoid_version=yes\n\tcontinue\n\t;;\n\n      -bindir)\n\tprev=bindir\n\tcontinue\n\t;;\n\n      -dlopen)\n\tprev=dlfiles\n\tcontinue\n\t;;\n\n      -dlpreopen)\n\tprev=dlprefiles\n\tcontinue\n\t;;\n\n      -export-dynamic)\n\texport_dynamic=yes\n\tcontinue\n\t;;\n\n      -export-symbols | -export-symbols-regex)\n\tif test -n \"$export_symbols\" || test -n \"$export_symbols_regex\"; then\n\t  func_fatal_error \"more than one -exported-symbols argument is not allowed\"\n\tfi\n\tif test \"X$arg\" = \"X-export-symbols\"; then\n\t  prev=expsyms\n\telse\n\t  prev=expsyms_regex\n\tfi\n\tcontinue\n\t;;\n\n      -framework)\n\tprev=framework\n\tcontinue\n\t;;\n\n      -inst-prefix-dir)\n\tprev=inst_prefix\n\tcontinue\n\t;;\n\n      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*\n      # so, if we see these flags be careful not to treat them like -L\n      -L[A-Z][A-Z]*:*)\n\tcase $with_gcc/$host in\n\tno/*-*-irix* | /*-*-irix*)\n\t  func_append compile_command \" $arg\"\n\t  func_append finalize_command \" $arg\"\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -L*)\n\tfunc_stripname \"-L\" '' \"$arg\"\n\tif test -z \"$func_stripname_result\"; then\n\t  if test \"$#\" -gt 0; then\n\t    func_fatal_error \"require no space between \\`-L' and \\`$1'\"\n\t  else\n\t    func_fatal_error \"need path for \\`-L' option\"\n\t  fi\n\tfi\n\tfunc_resolve_sysroot \"$func_stripname_result\"\n\tdir=$func_resolve_sysroot_result\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t*)\n\t  absdir=`cd \"$dir\" && pwd`\n\t  test -z \"$absdir\" && \\\n\t    func_fatal_error \"cannot determine absolute directory name of \\`$dir'\"\n\t  dir=\"$absdir\"\n\t  ;;\n\tesac\n\tcase \"$deplibs \" in\n\t*\" -L$dir \"* | *\" $arg \"*)\n\t  # Will only happen for absolute or sysroot arguments\n\t  ;;\n\t*)\n\t  # Preserve sysroot, but never include relative directories\n\t  case $dir in\n\t    [\\\\/]* | [A-Za-z]:[\\\\/]* | =*) func_append deplibs \" $arg\" ;;\n\t    *) func_append deplibs \" -L$dir\" ;;\n\t  esac\n\t  func_append lib_search_path \" $dir\"\n\t  ;;\n\tesac\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`$ECHO \"$dir\" | $SED 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$dir:\"*) ;;\n\t  ::) dllsearchpath=$dir;;\n\t  *) func_append dllsearchpath \":$dir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) func_append dllsearchpath \":$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n\tcontinue\n\t;;\n\n      -l*)\n\tif test \"X$arg\" = \"X-lc\" || test \"X$arg\" = \"X-lm\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)\n\t    # These systems don't actually have a C or math library (as such)\n\t    continue\n\t    ;;\n\t  *-*-os2*)\n\t    # These systems don't actually have a C library (as such)\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C and math libraries are in the System framework\n\t    func_append deplibs \" System.ltframework\"\n\t    continue\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    test \"X$arg\" = \"X-lc\" && continue\n\t    ;;\n\t  esac\n\telif test \"X$arg\" = \"X-lc_r\"; then\n\t case $host in\n\t *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t   # Do not include libc_r directly, use -pthread flag.\n\t   continue\n\t   ;;\n\t esac\n\tfi\n\tfunc_append deplibs \" $arg\"\n\tcontinue\n\t;;\n\n      -module)\n\tmodule=yes\n\tcontinue\n\t;;\n\n      # Tru64 UNIX uses -model [arg] to determine the layout of C++\n      # classes, name mangling, and exception handling.\n      # Darwin uses the -arch flag to determine output architecture.\n      -model|-arch|-isysroot|--sysroot)\n\tfunc_append compiler_flags \" $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)\n\tfunc_append compiler_flags \" $arg\"\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n\tcase \"$new_inherited_linker_flags \" in\n\t    *\" $arg \"*) ;;\n\t    * ) func_append new_inherited_linker_flags \" $arg\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -multi_module)\n\tsingle_module=\"${wl}-multi_module\"\n\tcontinue\n\t;;\n\n      -no-fast-install)\n\tfast_install=no\n\tcontinue\n\t;;\n\n      -no-install)\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)\n\t  # The PATH hackery in wrapper scripts is required on Windows\n\t  # and Darwin in order for the loader to find any dlls it needs.\n\t  func_warning \"\\`-no-install' is ignored for $host\"\n\t  func_warning \"assuming \\`-no-fast-install' instead\"\n\t  fast_install=no\n\t  ;;\n\t*) no_install=yes ;;\n\tesac\n\tcontinue\n\t;;\n\n      -no-undefined)\n\tallow_undefined=no\n\tcontinue\n\t;;\n\n      -objectlist)\n\tprev=objectlist\n\tcontinue\n\t;;\n\n      -o) prev=output ;;\n\n      -precious-files-regex)\n\tprev=precious_regex\n\tcontinue\n\t;;\n\n      -release)\n\tprev=release\n\tcontinue\n\t;;\n\n      -rpath)\n\tprev=rpath\n\tcontinue\n\t;;\n\n      -R)\n\tprev=xrpath\n\tcontinue\n\t;;\n\n      -R*)\n\tfunc_stripname '-R' '' \"$arg\"\n\tdir=$func_stripname_result\n\t# We need an absolute path.\n\tcase $dir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) ;;\n\t=*)\n\t  func_stripname '=' '' \"$dir\"\n\t  dir=$lt_sysroot$func_stripname_result\n\t  ;;\n\t*)\n\t  func_fatal_error \"only absolute run-paths are allowed\"\n\t  ;;\n\tesac\n\tcase \"$xrpath \" in\n\t*\" $dir \"*) ;;\n\t*) func_append xrpath \" $dir\" ;;\n\tesac\n\tcontinue\n\t;;\n\n      -shared)\n\t# The effects of -shared are defined in a previous loop.\n\tcontinue\n\t;;\n\n      -shrext)\n\tprev=shrext\n\tcontinue\n\t;;\n\n      -static | -static-libtool-libs)\n\t# The effects of -static are defined in a previous loop.\n\t# We used to do the same as -all-static on platforms that\n\t# didn't have a PIC flag, but the assumption that the effects\n\t# would be equivalent was wrong.  It would break on at least\n\t# Digital Unix and AIX.\n\tcontinue\n\t;;\n\n      -thread-safe)\n\tthread_safe=yes\n\tcontinue\n\t;;\n\n      -version-info)\n\tprev=vinfo\n\tcontinue\n\t;;\n\n      -version-number)\n\tprev=vinfo\n\tvinfo_number=yes\n\tcontinue\n\t;;\n\n      -weak)\n        prev=weak\n\tcontinue\n\t;;\n\n      -Wc,*)\n\tfunc_stripname '-Wc,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  func_append arg \" $func_quote_for_eval_result\"\n\t  func_append compiler_flags \" $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Wl,*)\n\tfunc_stripname '-Wl,' '' \"$arg\"\n\targs=$func_stripname_result\n\targ=\n\tsave_ifs=\"$IFS\"; IFS=','\n\tfor flag in $args; do\n\t  IFS=\"$save_ifs\"\n          func_quote_for_eval \"$flag\"\n\t  func_append arg \" $wl$func_quote_for_eval_result\"\n\t  func_append compiler_flags \" $wl$func_quote_for_eval_result\"\n\t  func_append linker_flags \" $func_quote_for_eval_result\"\n\tdone\n\tIFS=\"$save_ifs\"\n\tfunc_stripname ' ' '' \"$arg\"\n\targ=$func_stripname_result\n\t;;\n\n      -Xcompiler)\n\tprev=xcompiler\n\tcontinue\n\t;;\n\n      -Xlinker)\n\tprev=xlinker\n\tcontinue\n\t;;\n\n      -XCClinker)\n\tprev=xcclinker\n\tcontinue\n\t;;\n\n      # -msg_* for osf cc\n      -msg_*)\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      # Flags to be passed through unchanged, with rationale:\n      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler\n      # -r[0-9][0-9]*        specify processor for the SGI compiler\n      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler\n      # +DA*, +DD*           enable 64-bit mode for the HP compiler\n      # -q*                  compiler args for the IBM compiler\n      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC\n      # -F/path              path to uninstalled frameworks, gcc on darwin\n      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC\n      # @file                GCC response files\n      # -tp=*                Portland pgcc target processor selection\n      # --sysroot=*          for sysroot support\n      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization\n      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \\\n      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \\\n      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n        func_append compile_command \" $arg\"\n        func_append finalize_command \" $arg\"\n        func_append compiler_flags \" $arg\"\n        continue\n        ;;\n\n      # Some other compiler flag.\n      -* | +*)\n        func_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n\n      *.$objext)\n\t# A standard object.\n\tfunc_append objs \" $arg\"\n\t;;\n\n      *.lo)\n\t# A libtool-controlled object.\n\n\t# Check to see that this really is a libtool object.\n\tif func_lalib_unsafe_p \"$arg\"; then\n\t  pic_object=\n\t  non_pic_object=\n\n\t  # Read the .lo file\n\t  func_source \"$arg\"\n\n\t  if test -z \"$pic_object\" ||\n\t     test -z \"$non_pic_object\" ||\n\t     test \"$pic_object\" = none &&\n\t     test \"$non_pic_object\" = none; then\n\t    func_fatal_error \"cannot find name of object for \\`$arg'\"\n\t  fi\n\n\t  # Extract subdirectory from the argument.\n\t  func_dirname \"$arg\" \"/\" \"\"\n\t  xdir=\"$func_dirname_result\"\n\n\t  if test \"$pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    pic_object=\"$xdir$pic_object\"\n\n\t    if test \"$prev\" = dlfiles; then\n\t      if test \"$build_libtool_libs\" = yes && test \"$dlopen_support\" = yes; then\n\t\tfunc_append dlfiles \" $pic_object\"\n\t\tprev=\n\t\tcontinue\n\t      else\n\t\t# If libtool objects are unsupported, then we need to preload.\n\t\tprev=dlprefiles\n\t      fi\n\t    fi\n\n\t    # CHECK ME:  I think I busted this.  -Ossama\n\t    if test \"$prev\" = dlprefiles; then\n\t      # Preload the old-style object.\n\t      func_append dlprefiles \" $pic_object\"\n\t      prev=\n\t    fi\n\n\t    # A PIC object.\n\t    func_append libobjs \" $pic_object\"\n\t    arg=\"$pic_object\"\n\t  fi\n\n\t  # Non-PIC object.\n\t  if test \"$non_pic_object\" != none; then\n\t    # Prepend the subdirectory the object is found in.\n\t    non_pic_object=\"$xdir$non_pic_object\"\n\n\t    # A standard non-PIC object\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t    if test -z \"$pic_object\" || test \"$pic_object\" = none ; then\n\t      arg=\"$non_pic_object\"\n\t    fi\n\t  else\n\t    # If the PIC object exists, use it instead.\n\t    # $xdir was prepended to $pic_object above.\n\t    non_pic_object=\"$pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  fi\n\telse\n\t  # Only an error if not doing a dry-run.\n\t  if $opt_dry_run; then\n\t    # Extract subdirectory from the argument.\n\t    func_dirname \"$arg\" \"/\" \"\"\n\t    xdir=\"$func_dirname_result\"\n\n\t    func_lo2o \"$arg\"\n\t    pic_object=$xdir$objdir/$func_lo2o_result\n\t    non_pic_object=$xdir$func_lo2o_result\n\t    func_append libobjs \" $pic_object\"\n\t    func_append non_pic_objects \" $non_pic_object\"\n\t  else\n\t    func_fatal_error \"\\`$arg' is not a valid libtool object\"\n\t  fi\n\tfi\n\t;;\n\n      *.$libext)\n\t# An archive.\n\tfunc_append deplibs \" $arg\"\n\tfunc_append old_deplibs \" $arg\"\n\tcontinue\n\t;;\n\n      *.la)\n\t# A libtool-controlled library.\n\n\tfunc_resolve_sysroot \"$arg\"\n\tif test \"$prev\" = dlfiles; then\n\t  # This library was specified with -dlopen.\n\t  func_append dlfiles \" $func_resolve_sysroot_result\"\n\t  prev=\n\telif test \"$prev\" = dlprefiles; then\n\t  # The library was specified with -dlpreopen.\n\t  func_append dlprefiles \" $func_resolve_sysroot_result\"\n\t  prev=\n\telse\n\t  func_append deplibs \" $func_resolve_sysroot_result\"\n\tfi\n\tcontinue\n\t;;\n\n      # Some other compiler argument.\n      *)\n\t# Unknown arguments in both finalize_command and compile_command need\n\t# to be aesthetically quoted because they are evaled later.\n\tfunc_quote_for_eval \"$arg\"\n\targ=\"$func_quote_for_eval_result\"\n\t;;\n      esac # arg\n\n      # Now actually substitute the argument into the commands.\n      if test -n \"$arg\"; then\n\tfunc_append compile_command \" $arg\"\n\tfunc_append finalize_command \" $arg\"\n      fi\n    done # argument parsing loop\n\n    test -n \"$prev\" && \\\n      func_fatal_help \"the \\`$prevarg' option requires an argument\"\n\n    if test \"$export_dynamic\" = yes && test -n \"$export_dynamic_flag_spec\"; then\n      eval arg=\\\"$export_dynamic_flag_spec\\\"\n      func_append compile_command \" $arg\"\n      func_append finalize_command \" $arg\"\n    fi\n\n    oldlibs=\n    # calculate the name of the file, without its directory\n    func_basename \"$output\"\n    outputname=\"$func_basename_result\"\n    libobjs_save=\"$libobjs\"\n\n    if test -n \"$shlibpath_var\"; then\n      # get the directories listed in $shlibpath_var\n      eval shlib_search_path=\\`\\$ECHO \\\"\\${$shlibpath_var}\\\" \\| \\$SED \\'s/:/ /g\\'\\`\n    else\n      shlib_search_path=\n    fi\n    eval sys_lib_search_path=\\\"$sys_lib_search_path_spec\\\"\n    eval sys_lib_dlsearch_path=\\\"$sys_lib_dlsearch_path_spec\\\"\n\n    func_dirname \"$output\" \"/\" \"\"\n    output_objdir=\"$func_dirname_result$objdir\"\n    func_to_tool_file \"$output_objdir/\"\n    tool_output_objdir=$func_to_tool_file_result\n    # Create the object directory.\n    func_mkdir_p \"$output_objdir\"\n\n    # Determine the type of output\n    case $output in\n    \"\")\n      func_fatal_help \"you must specify an output file\"\n      ;;\n    *.$libext) linkmode=oldlib ;;\n    *.lo | *.$objext) linkmode=obj ;;\n    *.la) linkmode=lib ;;\n    *) linkmode=prog ;; # Anything else should be a program.\n    esac\n\n    specialdeplibs=\n\n    libs=\n    # Find all interdependent deplibs by searching for libraries\n    # that are linked more than once (e.g. -la -lb -la)\n    for deplib in $deplibs; do\n      if $opt_preserve_dup_deps ; then\n\tcase \"$libs \" in\n\t*\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\tesac\n      fi\n      func_append libs \" $deplib\"\n    done\n\n    if test \"$linkmode\" = lib; then\n      libs=\"$predeps $libs $compiler_lib_search_path $postdeps\"\n\n      # Compute libraries that are listed more than once in $predeps\n      # $postdeps and mark them as special (i.e., whose duplicates are\n      # not to be eliminated).\n      pre_post_deps=\n      if $opt_duplicate_compiler_generated_deps; then\n\tfor pre_post_dep in $predeps $postdeps; do\n\t  case \"$pre_post_deps \" in\n\t  *\" $pre_post_dep \"*) func_append specialdeplibs \" $pre_post_deps\" ;;\n\t  esac\n\t  func_append pre_post_deps \" $pre_post_dep\"\n\tdone\n      fi\n      pre_post_deps=\n    fi\n\n    deplibs=\n    newdependency_libs=\n    newlib_search_path=\n    need_relink=no # whether we're linking any uninstalled libtool libraries\n    notinst_deplibs= # not-installed libtool libraries\n    notinst_path= # paths that contain not-installed libtool libraries\n\n    case $linkmode in\n    lib)\n\tpasses=\"conv dlpreopen link\"\n\tfor file in $dlfiles $dlprefiles; do\n\t  case $file in\n\t  *.la) ;;\n\t  *)\n\t    func_fatal_help \"libraries can \\`-dlopen' only libtool libraries: $file\"\n\t    ;;\n\t  esac\n\tdone\n\t;;\n    prog)\n\tcompile_deplibs=\n\tfinalize_deplibs=\n\talldeplibs=no\n\tnewdlfiles=\n\tnewdlprefiles=\n\tpasses=\"conv scan dlopen dlpreopen link\"\n\t;;\n    *)  passes=\"conv\"\n\t;;\n    esac\n\n    for pass in $passes; do\n      # The preopen pass in lib mode reverses $deplibs; put it back here\n      # so that -L comes before libs that need it for instance...\n      if test \"$linkmode,$pass\" = \"lib,link\"; then\n\t## FIXME: Find the place where the list is rebuilt in the wrong\n\t##        order, and fix it there properly\n        tmp_deplibs=\n\tfor deplib in $deplibs; do\n\t  tmp_deplibs=\"$deplib $tmp_deplibs\"\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n      fi\n\n      if test \"$linkmode,$pass\" = \"lib,link\" ||\n\t test \"$linkmode,$pass\" = \"prog,scan\"; then\n\tlibs=\"$deplibs\"\n\tdeplibs=\n      fi\n      if test \"$linkmode\" = prog; then\n\tcase $pass in\n\tdlopen) libs=\"$dlfiles\" ;;\n\tdlpreopen) libs=\"$dlprefiles\" ;;\n\tlink)\n\t  libs=\"$deplibs %DEPLIBS%\"\n\t  test \"X$link_all_deplibs\" != Xno && libs=\"$libs $dependency_libs\"\n\t  ;;\n\tesac\n      fi\n      if test \"$linkmode,$pass\" = \"lib,dlpreopen\"; then\n\t# Collect and forward deplibs of preopened libtool libs\n\tfor lib in $dlprefiles; do\n\t  # Ignore non-libtool-libs\n\t  dependency_libs=\n\t  func_resolve_sysroot \"$lib\"\n\t  case $lib in\n\t  *.la)\tfunc_source \"$func_resolve_sysroot_result\" ;;\n\t  esac\n\n\t  # Collect preopened libtool deplibs, except any this library\n\t  # has declared as weak libs\n\t  for deplib in $dependency_libs; do\n\t    func_basename \"$deplib\"\n            deplib_base=$func_basename_result\n\t    case \" $weak_libs \" in\n\t    *\" $deplib_base \"*) ;;\n\t    *) func_append deplibs \" $deplib\" ;;\n\t    esac\n\t  done\n\tdone\n\tlibs=\"$dlprefiles\"\n      fi\n      if test \"$pass\" = dlopen; then\n\t# Collect dlpreopened libraries\n\tsave_deplibs=\"$deplibs\"\n\tdeplibs=\n      fi\n\n      for deplib in $libs; do\n\tlib=\n\tfound=no\n\tcase $deplib in\n\t-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    func_append compiler_flags \" $deplib\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) func_append new_inherited_linker_flags \" $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-l*)\n\t  if test \"$linkmode\" != lib && test \"$linkmode\" != prog; then\n\t    func_warning \"\\`-l' is ignored for archives/objects\"\n\t    continue\n\t  fi\n\t  func_stripname '-l' '' \"$deplib\"\n\t  name=$func_stripname_result\n\t  if test \"$linkmode\" = lib; then\n\t    searchdirs=\"$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path\"\n\t  else\n\t    searchdirs=\"$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path\"\n\t  fi\n\t  for searchdir in $searchdirs; do\n\t    for search_ext in .la $std_shrext .so .a; do\n\t      # Search the libtool library\n\t      lib=\"$searchdir/lib${name}${search_ext}\"\n\t      if test -f \"$lib\"; then\n\t\tif test \"$search_ext\" = \".la\"; then\n\t\t  found=yes\n\t\telse\n\t\t  found=no\n\t\tfi\n\t\tbreak 2\n\t      fi\n\t    done\n\t  done\n\t  if test \"$found\" != yes; then\n\t    # deplib doesn't seem to be a libtool library\n\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      deplibs=\"$deplib $deplibs\"\n\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    continue\n\t  else # deplib is a libtool library\n\t    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,\n\t    # We need to do some special things here, and not later.\n\t    if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t      case \" $predeps $postdeps \" in\n\t      *\" $deplib \"*)\n\t\tif func_lalib_p \"$lib\"; then\n\t\t  library_names=\n\t\t  old_library=\n\t\t  func_source \"$lib\"\n\t\t  for l in $old_library $library_names; do\n\t\t    ll=\"$l\"\n\t\t  done\n\t\t  if test \"X$ll\" = \"X$old_library\" ; then # only static version available\n\t\t    found=no\n\t\t    func_dirname \"$lib\" \"\" \".\"\n\t\t    ladir=\"$func_dirname_result\"\n\t\t    lib=$ladir/$old_library\n\t\t    if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t\t    else\n\t\t      deplibs=\"$deplib $deplibs\"\n\t\t      test \"$linkmode\" = lib && newdependency_libs=\"$deplib $newdependency_libs\"\n\t\t    fi\n\t\t    continue\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *) ;;\n\t      esac\n\t    fi\n\t  fi\n\t  ;; # -l\n\t*.ltframework)\n\t  if test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$deplib $compile_deplibs\"\n\t    finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$deplib $deplibs\"\n\t    if test \"$linkmode\" = lib ; then\n\t\tcase \"$new_inherited_linker_flags \" in\n\t\t    *\" $deplib \"*) ;;\n\t\t    * ) func_append new_inherited_linker_flags \" $deplib\" ;;\n\t\tesac\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t-L*)\n\t  case $linkmode in\n\t  lib)\n\t    deplibs=\"$deplib $deplibs\"\n\t    test \"$pass\" = conv && continue\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    func_stripname '-L' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" = conv; then\n\t      deplibs=\"$deplib $deplibs\"\n\t      continue\n\t    fi\n\t    if test \"$pass\" = scan; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    func_stripname '-L' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t    ;;\n\t  *)\n\t    func_warning \"\\`-L' is ignored for archives/objects\"\n\t    ;;\n\t  esac # linkmode\n\t  continue\n\t  ;; # -L\n\t-R*)\n\t  if test \"$pass\" = link; then\n\t    func_stripname '-R' '' \"$deplib\"\n\t    func_resolve_sysroot \"$func_stripname_result\"\n\t    dir=$func_resolve_sysroot_result\n\t    # Make sure the xrpath contains only unique directories.\n\t    case \"$xrpath \" in\n\t    *\" $dir \"*) ;;\n\t    *) func_append xrpath \" $dir\" ;;\n\t    esac\n\t  fi\n\t  deplibs=\"$deplib $deplibs\"\n\t  continue\n\t  ;;\n\t*.la)\n\t  func_resolve_sysroot \"$deplib\"\n\t  lib=$func_resolve_sysroot_result\n\t  ;;\n\t*.$libext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t    continue\n\t  fi\n\t  case $linkmode in\n\t  lib)\n\t    # Linking convenience modules into shared libraries is allowed,\n\t    # but linking other static libraries is non-portable.\n\t    case \" $dlpreconveniencelibs \" in\n\t    *\" $deplib \"*) ;;\n\t    *)\n\t      valid_a_lib=no\n\t      case $deplibs_check_method in\n\t\tmatch_pattern*)\n\t\t  set dummy $deplibs_check_method; shift\n\t\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t\t  if eval \"\\$ECHO \\\"$deplib\\\"\" 2>/dev/null | $SED 10q \\\n\t\t    | $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t    valid_a_lib=yes\n\t\t  fi\n\t\t;;\n\t\tpass_all)\n\t\t  valid_a_lib=yes\n\t\t;;\n\t      esac\n\t      if test \"$valid_a_lib\" != yes; then\n\t\techo\n\t\t$ECHO \"*** Warning: Trying to link with static lib archive $deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because the file extensions .$libext of this argument makes me believe\"\n\t\techo \"*** that it is just a static archive that I should not use here.\"\n\t      else\n\t\techo\n\t\t$ECHO \"*** Warning: Linking the shared library $output against the\"\n\t\t$ECHO \"*** static library $deplib is not portable!\"\n\t\tdeplibs=\"$deplib $deplibs\"\n\t      fi\n\t      ;;\n\t    esac\n\t    continue\n\t    ;;\n\t  prog)\n\t    if test \"$pass\" != link; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    fi\n\t    continue\n\t    ;;\n\t  esac # linkmode\n\t  ;; # *.$libext\n\t*.lo | *.$objext)\n\t  if test \"$pass\" = conv; then\n\t    deplibs=\"$deplib $deplibs\"\n\t  elif test \"$linkmode\" = prog; then\n\t    if test \"$pass\" = dlpreopen || test \"$dlopen_support\" != yes || test \"$build_libtool_libs\" = no; then\n\t      # If there is no dlopen support or we're linking statically,\n\t      # we need to preload.\n\t      func_append newdlprefiles \" $deplib\"\n\t      compile_deplibs=\"$deplib $compile_deplibs\"\n\t      finalize_deplibs=\"$deplib $finalize_deplibs\"\n\t    else\n\t      func_append newdlfiles \" $deplib\"\n\t    fi\n\t  fi\n\t  continue\n\t  ;;\n\t%DEPLIBS%)\n\t  alldeplibs=yes\n\t  continue\n\t  ;;\n\tesac # case $deplib\n\n\tif test \"$found\" = yes || test -f \"$lib\"; then :\n\telse\n\t  func_fatal_error \"cannot find the library \\`$lib' or unhandled argument \\`$deplib'\"\n\tfi\n\n\t# Check to see that this really is a libtool archive.\n\tfunc_lalib_unsafe_p \"$lib\" \\\n\t  || func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\n\tfunc_dirname \"$lib\" \"\" \".\"\n\tladir=\"$func_dirname_result\"\n\n\tdlname=\n\tdlopen=\n\tdlpreopen=\n\tlibdir=\n\tlibrary_names=\n\told_library=\n\tinherited_linker_flags=\n\t# If the library was installed with an old release of libtool,\n\t# it will not redefine variables installed, or shouldnotlink\n\tinstalled=yes\n\tshouldnotlink=no\n\tavoidtemprpath=\n\n\n\t# Read the .la file\n\tfunc_source \"$lib\"\n\n\t# Convert \"-framework foo\" to \"foo.ltframework\"\n\tif test -n \"$inherited_linker_flags\"; then\n\t  tmp_inherited_linker_flags=`$ECHO \"$inherited_linker_flags\" | $SED 's/-framework \\([^ $]*\\)/\\1.ltframework/g'`\n\t  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do\n\t    case \" $new_inherited_linker_flags \" in\n\t      *\" $tmp_inherited_linker_flag \"*) ;;\n\t      *) func_append new_inherited_linker_flags \" $tmp_inherited_linker_flag\";;\n\t    esac\n\t  done\n\tfi\n\tdependency_libs=`$ECHO \" $dependency_libs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tif test \"$linkmode,$pass\" = \"lib,link\" ||\n\t   test \"$linkmode,$pass\" = \"prog,scan\" ||\n\t   { test \"$linkmode\" != prog && test \"$linkmode\" != lib; }; then\n\t  test -n \"$dlopen\" && func_append dlfiles \" $dlopen\"\n\t  test -n \"$dlpreopen\" && func_append dlprefiles \" $dlpreopen\"\n\tfi\n\n\tif test \"$pass\" = conv; then\n\t  # Only check for convenience libraries\n\t  deplibs=\"$lib $deplibs\"\n\t  if test -z \"$libdir\"; then\n\t    if test -z \"$old_library\"; then\n\t      func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\t    fi\n\t    # It is a libtool convenience library, so add in its objects.\n\t    func_append convenience \" $ladir/$objdir/$old_library\"\n\t    func_append old_convenience \" $ladir/$objdir/$old_library\"\n\t    tmp_libs=\n\t    for deplib in $dependency_libs; do\n\t      deplibs=\"$deplib $deplibs\"\n\t      if $opt_preserve_dup_deps ; then\n\t\tcase \"$tmp_libs \" in\n\t\t*\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\t\tesac\n\t      fi\n\t      func_append tmp_libs \" $deplib\"\n\t    done\n\t  elif test \"$linkmode\" != prog && test \"$linkmode\" != lib; then\n\t    func_fatal_error \"\\`$lib' is not a convenience library\"\n\t  fi\n\t  continue\n\tfi # $pass = conv\n\n\n\t# Get the name of the library we link against.\n\tlinklib=\n\tif test -n \"$old_library\" &&\n\t   { test \"$prefer_static_libs\" = yes ||\n\t     test \"$prefer_static_libs,$installed\" = \"built,no\"; }; then\n\t  linklib=$old_library\n\telse\n\t  for l in $old_library $library_names; do\n\t    linklib=\"$l\"\n\t  done\n\tfi\n\tif test -z \"$linklib\"; then\n\t  func_fatal_error \"cannot find name of link library for \\`$lib'\"\n\tfi\n\n\t# This library was specified with -dlopen.\n\tif test \"$pass\" = dlopen; then\n\t  if test -z \"$libdir\"; then\n\t    func_fatal_error \"cannot -dlopen a convenience library: \\`$lib'\"\n\t  fi\n\t  if test -z \"$dlname\" ||\n\t     test \"$dlopen_support\" != yes ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    # If there is no dlname, no dlopen support or we're linking\n\t    # statically, we need to preload.  We also need to preload any\n\t    # dependent libraries so libltdl's deplib preloader doesn't\n\t    # bomb out in the load deplibs phase.\n\t    func_append dlprefiles \" $lib $dependency_libs\"\n\t  else\n\t    func_append newdlfiles \" $lib\"\n\t  fi\n\t  continue\n\tfi # $pass = dlopen\n\n\t# We need an absolute path.\n\tcase $ladir in\n\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs_ladir=\"$ladir\" ;;\n\t*)\n\t  abs_ladir=`cd \"$ladir\" && pwd`\n\t  if test -z \"$abs_ladir\"; then\n\t    func_warning \"cannot determine absolute directory name of \\`$ladir'\"\n\t    func_warning \"passing it literally to the linker, although it might fail\"\n\t    abs_ladir=\"$ladir\"\n\t  fi\n\t  ;;\n\tesac\n\tfunc_basename \"$lib\"\n\tlaname=\"$func_basename_result\"\n\n\t# Find the relevant object directory and library name.\n\tif test \"X$installed\" = Xyes; then\n\t  if test ! -f \"$lt_sysroot$libdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    func_warning \"library \\`$lib' was moved.\"\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    libdir=\"$abs_ladir\"\n\t  else\n\t    dir=\"$lt_sysroot$libdir\"\n\t    absdir=\"$lt_sysroot$libdir\"\n\t  fi\n\t  test \"X$hardcode_automatic\" = Xyes && avoidtemprpath=yes\n\telse\n\t  if test ! -f \"$ladir/$objdir/$linklib\" && test -f \"$abs_ladir/$linklib\"; then\n\t    dir=\"$ladir\"\n\t    absdir=\"$abs_ladir\"\n\t    # Remove this search path later\n\t    func_append notinst_path \" $abs_ladir\"\n\t  else\n\t    dir=\"$ladir/$objdir\"\n\t    absdir=\"$abs_ladir/$objdir\"\n\t    # Remove this search path later\n\t    func_append notinst_path \" $abs_ladir\"\n\t  fi\n\tfi # $installed = yes\n\tfunc_stripname 'lib' '.la' \"$laname\"\n\tname=$func_stripname_result\n\n\t# This library was specified with -dlpreopen.\n\tif test \"$pass\" = dlpreopen; then\n\t  if test -z \"$libdir\" && test \"$linkmode\" = prog; then\n\t    func_fatal_error \"only libraries may -dlpreopen a convenience library: \\`$lib'\"\n\t  fi\n\t  case \"$host\" in\n\t    # special handling for platforms with PE-DLLs.\n\t    *cygwin* | *mingw* | *cegcc* )\n\t      # Linker will automatically link against shared library if both\n\t      # static and shared are present.  Therefore, ensure we extract\n\t      # symbols from the import library if a shared library is present\n\t      # (otherwise, the dlopen module name will be incorrect).  We do\n\t      # this by putting the import library name into $newdlprefiles.\n\t      # We recover the dlopen module name by 'saving' the la file\n\t      # name in a special purpose variable, and (later) extracting the\n\t      # dlname from the la file.\n\t      if test -n \"$dlname\"; then\n\t        func_tr_sh \"$dir/$linklib\"\n\t        eval \"libfile_$func_tr_sh_result=\\$abs_ladir/\\$laname\"\n\t        func_append newdlprefiles \" $dir/$linklib\"\n\t      else\n\t        func_append newdlprefiles \" $dir/$old_library\"\n\t        # Keep a list of preopened convenience libraries to check\n\t        # that they are being used correctly in the link pass.\n\t        test -z \"$libdir\" && \\\n\t          func_append dlpreconveniencelibs \" $dir/$old_library\"\n\t      fi\n\t    ;;\n\t    * )\n\t      # Prefer using a static library (so that no silly _DYNAMIC symbols\n\t      # are required to link).\n\t      if test -n \"$old_library\"; then\n\t        func_append newdlprefiles \" $dir/$old_library\"\n\t        # Keep a list of preopened convenience libraries to check\n\t        # that they are being used correctly in the link pass.\n\t        test -z \"$libdir\" && \\\n\t          func_append dlpreconveniencelibs \" $dir/$old_library\"\n\t      # Otherwise, use the dlname, so that lt_dlopen finds it.\n\t      elif test -n \"$dlname\"; then\n\t        func_append newdlprefiles \" $dir/$dlname\"\n\t      else\n\t        func_append newdlprefiles \" $dir/$linklib\"\n\t      fi\n\t    ;;\n\t  esac\n\tfi # $pass = dlpreopen\n\n\tif test -z \"$libdir\"; then\n\t  # Link the convenience library\n\t  if test \"$linkmode\" = lib; then\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t  elif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t    compile_deplibs=\"$dir/$old_library $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$old_library $finalize_deplibs\"\n\t  else\n\t    deplibs=\"$lib $deplibs\" # used for prog,scan pass\n\t  fi\n\t  continue\n\tfi\n\n\n\tif test \"$linkmode\" = prog && test \"$pass\" != link; then\n\t  func_append newlib_search_path \" $ladir\"\n\t  deplibs=\"$lib $deplibs\"\n\n\t  linkalldeplibs=no\n\t  if test \"$link_all_deplibs\" != no || test -z \"$library_names\" ||\n\t     test \"$build_libtool_libs\" = no; then\n\t    linkalldeplibs=yes\n\t  fi\n\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    case $deplib in\n\t    -L*) func_stripname '-L' '' \"$deplib\"\n\t         func_resolve_sysroot \"$func_stripname_result\"\n\t         func_append newlib_search_path \" $func_resolve_sysroot_result\"\n\t\t ;;\n\t    esac\n\t    # Need to link against all dependency_libs?\n\t    if test \"$linkalldeplibs\" = yes; then\n\t      deplibs=\"$deplib $deplibs\"\n\t    else\n\t      # Need to hardcode shared library paths\n\t      # or/and link against static libraries\n\t      newdependency_libs=\"$deplib $newdependency_libs\"\n\t    fi\n\t    if $opt_preserve_dup_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $deplib \"*) func_append specialdeplibs \" $deplib\" ;;\n\t      esac\n\t    fi\n\t    func_append tmp_libs \" $deplib\"\n\t  done # for deplib\n\t  continue\n\tfi # $linkmode = prog...\n\n\tif test \"$linkmode,$pass\" = \"prog,link\"; then\n\t  if test -n \"$library_names\" &&\n\t     { { test \"$prefer_static_libs\" = no ||\n\t         test \"$prefer_static_libs,$installed\" = \"built,yes\"; } ||\n\t       test -z \"$old_library\"; }; then\n\t    # We need to hardcode the library path\n\t    if test -n \"$shlibpath_var\" && test -z \"$avoidtemprpath\" ; then\n\t      # Make sure the rpath contains only unique directories.\n\t      case \"$temp_rpath:\" in\n\t      *\"$absdir:\"*) ;;\n\t      *) func_append temp_rpath \"$absdir:\" ;;\n\t      esac\n\t    fi\n\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) func_append compile_rpath \" $absdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_append finalize_rpath \" $libdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t  fi # $linkmode,$pass = prog,link...\n\n\t  if test \"$alldeplibs\" = yes &&\n\t     { test \"$deplibs_check_method\" = pass_all ||\n\t       { test \"$build_libtool_libs\" = yes &&\n\t\t test -n \"$library_names\"; }; }; then\n\t    # We only need to search for static libraries\n\t    continue\n\t  fi\n\tfi\n\n\tlink_static=no # Whether the deplib will be linked statically\n\tuse_static_libs=$prefer_static_libs\n\tif test \"$use_static_libs\" = built && test \"$installed\" = yes; then\n\t  use_static_libs=no\n\tfi\n\tif test -n \"$library_names\" &&\n\t   { test \"$use_static_libs\" = no || test -z \"$old_library\"; }; then\n\t  case $host in\n\t  *cygwin* | *mingw* | *cegcc*)\n\t      # No point in relinking DLLs because paths are not encoded\n\t      func_append notinst_deplibs \" $lib\"\n\t      need_relink=no\n\t    ;;\n\t  *)\n\t    if test \"$installed\" = no; then\n\t      func_append notinst_deplibs \" $lib\"\n\t      need_relink=yes\n\t    fi\n\t    ;;\n\t  esac\n\t  # This is a shared library\n\n\t  # Warn about portability, can't link against -module's on some\n\t  # systems (darwin).  Don't bleat about dlopened modules though!\n\t  dlopenmodule=\"\"\n\t  for dlpremoduletest in $dlprefiles; do\n\t    if test \"X$dlpremoduletest\" = \"X$lib\"; then\n\t      dlopenmodule=\"$dlpremoduletest\"\n\t      break\n\t    fi\n\t  done\n\t  if test -z \"$dlopenmodule\" && test \"$shouldnotlink\" = yes && test \"$pass\" = link; then\n\t    echo\n\t    if test \"$linkmode\" = prog; then\n\t      $ECHO \"*** Warning: Linking the executable $output against the loadable module\"\n\t    else\n\t      $ECHO \"*** Warning: Linking the shared library $output against the loadable module\"\n\t    fi\n\t    $ECHO \"*** $linklib is not portable!\"\n\t  fi\n\t  if test \"$linkmode\" = lib &&\n\t     test \"$hardcode_into_libs\" = yes; then\n\t    # Hardcode the library path.\n\t    # Skip directories that are in the system default run-time\n\t    # search path.\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $absdir \"*) ;;\n\t    *)\n\t      case \"$compile_rpath \" in\n\t      *\" $absdir \"*) ;;\n\t      *) func_append compile_rpath \" $absdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t    case \" $sys_lib_dlsearch_path \" in\n\t    *\" $libdir \"*) ;;\n\t    *)\n\t      case \"$finalize_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_append finalize_rpath \" $libdir\" ;;\n\t      esac\n\t      ;;\n\t    esac\n\t  fi\n\n\t  if test -n \"$old_archive_from_expsyms_cmds\"; then\n\t    # figure out the soname\n\t    set dummy $library_names\n\t    shift\n\t    realname=\"$1\"\n\t    shift\n\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t    # use dlname if we got it. it's perfectly good, no?\n\t    if test -n \"$dlname\"; then\n\t      soname=\"$dlname\"\n\t    elif test -n \"$soname_spec\"; then\n\t      # bleh windows\n\t      case $host in\n\t      *cygwin* | mingw* | *cegcc*)\n\t        func_arith $current - $age\n\t\tmajor=$func_arith_result\n\t\tversuffix=\"-$major\"\n\t\t;;\n\t      esac\n\t      eval soname=\\\"$soname_spec\\\"\n\t    else\n\t      soname=\"$realname\"\n\t    fi\n\n\t    # Make a new name for the extract_expsyms_cmds to use\n\t    soroot=\"$soname\"\n\t    func_basename \"$soroot\"\n\t    soname=\"$func_basename_result\"\n\t    func_stripname 'lib' '.dll' \"$soname\"\n\t    newlib=libimp-$func_stripname_result.a\n\n\t    # If the library has no export list, then create one now\n\t    if test -f \"$output_objdir/$soname-def\"; then :\n\t    else\n\t      func_verbose \"extracting exported symbol list from \\`$soname'\"\n\t      func_execute_cmds \"$extract_expsyms_cmds\" 'exit $?'\n\t    fi\n\n\t    # Create $newlib\n\t    if test -f \"$output_objdir/$newlib\"; then :; else\n\t      func_verbose \"generating import library for \\`$soname'\"\n\t      func_execute_cmds \"$old_archive_from_expsyms_cmds\" 'exit $?'\n\t    fi\n\t    # make sure the library variables are pointing to the new library\n\t    dir=$output_objdir\n\t    linklib=$newlib\n\t  fi # test -n \"$old_archive_from_expsyms_cmds\"\n\n\t  if test \"$linkmode\" = prog || test \"$opt_mode\" != relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    lib_linked=yes\n\t    case $hardcode_action in\n\t    immediate | unsupported)\n\t      if test \"$hardcode_direct\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t\tcase $host in\n\t\t  *-*-sco3.2v5.0.[024]*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv4*uw2*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \\\n\t\t    *-*-unixware7*) add_dir=\"-L$dir\" ;;\n\t\t  *-*-darwin* )\n\t\t    # if the lib is a (non-dlopened) module then we can not\n\t\t    # link against it, someone is ignoring the earlier warnings\n\t\t    if /usr/bin/file -L $add 2> /dev/null |\n\t\t\t $GREP \": [^:]* bundle\" >/dev/null ; then\n\t\t      if test \"X$dlopenmodule\" != \"X$lib\"; then\n\t\t\t$ECHO \"*** Warning: lib $linklib is a module, not a shared library\"\n\t\t\tif test -z \"$old_library\" ; then\n\t\t\t  echo\n\t\t\t  echo \"*** And there doesn't seem to be a static archive available\"\n\t\t\t  echo \"*** The link will probably fail, sorry\"\n\t\t\telse\n\t\t\t  add=\"$dir/$old_library\"\n\t\t\tfi\n\t\t      elif test -n \"$old_library\"; then\n\t\t\tadd=\"$dir/$old_library\"\n\t\t      fi\n\t\t    fi\n\t\tesac\n\t      elif test \"$hardcode_minus_L\" = no; then\n\t\tcase $host in\n\t\t*-*-sunos*) add_shlibpath=\"$dir\" ;;\n\t\tesac\n\t\tadd_dir=\"-L$dir\"\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = no; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    relink)\n\t      if test \"$hardcode_direct\" = yes &&\n\t         test \"$hardcode_direct_absolute\" = no; then\n\t\tadd=\"$dir/$linklib\"\n\t      elif test \"$hardcode_minus_L\" = yes; then\n\t\tadd_dir=\"-L$dir\"\n\t\t# Try looking first in the location we're being installed to.\n\t\tif test -n \"$inst_prefix_dir\"; then\n\t\t  case $libdir in\n\t\t    [\\\\/]*)\n\t\t      func_append add_dir \" -L$inst_prefix_dir$libdir\"\n\t\t      ;;\n\t\t  esac\n\t\tfi\n\t\tadd=\"-l$name\"\n\t      elif test \"$hardcode_shlibpath_var\" = yes; then\n\t\tadd_shlibpath=\"$dir\"\n\t\tadd=\"-l$name\"\n\t      else\n\t\tlib_linked=no\n\t      fi\n\t      ;;\n\t    *) lib_linked=no ;;\n\t    esac\n\n\t    if test \"$lib_linked\" != yes; then\n\t      func_fatal_configuration \"unsupported hardcode properties\"\n\t    fi\n\n\t    if test -n \"$add_shlibpath\"; then\n\t      case :$compile_shlibpath: in\n\t      *\":$add_shlibpath:\"*) ;;\n\t      *) func_append compile_shlibpath \"$add_shlibpath:\" ;;\n\t      esac\n\t    fi\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && compile_deplibs=\"$add_dir $compile_deplibs\"\n\t      test -n \"$add\" && compile_deplibs=\"$add $compile_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t      if test \"$hardcode_direct\" != yes &&\n\t\t test \"$hardcode_minus_L\" != yes &&\n\t\t test \"$hardcode_shlibpath_var\" = yes; then\n\t\tcase :$finalize_shlibpath: in\n\t\t*\":$libdir:\"*) ;;\n\t\t*) func_append finalize_shlibpath \"$libdir:\" ;;\n\t\tesac\n\t      fi\n\t    fi\n\t  fi\n\n\t  if test \"$linkmode\" = prog || test \"$opt_mode\" = relink; then\n\t    add_shlibpath=\n\t    add_dir=\n\t    add=\n\t    # Finalize command for both is simple: just hardcode it.\n\t    if test \"$hardcode_direct\" = yes &&\n\t       test \"$hardcode_direct_absolute\" = no; then\n\t      add=\"$libdir/$linklib\"\n\t    elif test \"$hardcode_minus_L\" = yes; then\n\t      add_dir=\"-L$libdir\"\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_shlibpath_var\" = yes; then\n\t      case :$finalize_shlibpath: in\n\t      *\":$libdir:\"*) ;;\n\t      *) func_append finalize_shlibpath \"$libdir:\" ;;\n\t      esac\n\t      add=\"-l$name\"\n\t    elif test \"$hardcode_automatic\" = yes; then\n\t      if test -n \"$inst_prefix_dir\" &&\n\t\t test -f \"$inst_prefix_dir$libdir/$linklib\" ; then\n\t\tadd=\"$inst_prefix_dir$libdir/$linklib\"\n\t      else\n\t\tadd=\"$libdir/$linklib\"\n\t      fi\n\t    else\n\t      # We cannot seem to hardcode it, guess we'll fake it.\n\t      add_dir=\"-L$libdir\"\n\t      # Try looking first in the location we're being installed to.\n\t      if test -n \"$inst_prefix_dir\"; then\n\t\tcase $libdir in\n\t\t  [\\\\/]*)\n\t\t    func_append add_dir \" -L$inst_prefix_dir$libdir\"\n\t\t    ;;\n\t\tesac\n\t      fi\n\t      add=\"-l$name\"\n\t    fi\n\n\t    if test \"$linkmode\" = prog; then\n\t      test -n \"$add_dir\" && finalize_deplibs=\"$add_dir $finalize_deplibs\"\n\t      test -n \"$add\" && finalize_deplibs=\"$add $finalize_deplibs\"\n\t    else\n\t      test -n \"$add_dir\" && deplibs=\"$add_dir $deplibs\"\n\t      test -n \"$add\" && deplibs=\"$add $deplibs\"\n\t    fi\n\t  fi\n\telif test \"$linkmode\" = prog; then\n\t  # Here we assume that one of hardcode_direct or hardcode_minus_L\n\t  # is not unsupported.  This is valid on all known static and\n\t  # shared platforms.\n\t  if test \"$hardcode_direct\" != unsupported; then\n\t    test -n \"$old_library\" && linklib=\"$old_library\"\n\t    compile_deplibs=\"$dir/$linklib $compile_deplibs\"\n\t    finalize_deplibs=\"$dir/$linklib $finalize_deplibs\"\n\t  else\n\t    compile_deplibs=\"-l$name -L$dir $compile_deplibs\"\n\t    finalize_deplibs=\"-l$name -L$dir $finalize_deplibs\"\n\t  fi\n\telif test \"$build_libtool_libs\" = yes; then\n\t  # Not a shared library\n\t  if test \"$deplibs_check_method\" != pass_all; then\n\t    # We're trying link a shared library against a static one\n\t    # but the system doesn't support it.\n\n\t    # Just print a warning and add the library to dependency_libs so\n\t    # that the program can be linked against the static library.\n\t    echo\n\t    $ECHO \"*** Warning: This system can not link to static lib archive $lib.\"\n\t    echo \"*** I have the capability to make that library automatically link in when\"\n\t    echo \"*** you link to this library.  But I can only do this if you have a\"\n\t    echo \"*** shared version of the library, which you do not appear to have.\"\n\t    if test \"$module\" = yes; then\n\t      echo \"*** But as you try to build a module library, libtool will still create \"\n\t      echo \"*** a static module, that should work as long as the dlopening application\"\n\t      echo \"*** is linked with the -dlopen flag to resolve symbols at runtime.\"\n\t      if test -z \"$global_symbol_pipe\"; then\n\t\techo\n\t\techo \"*** However, this would only work if libtool was able to extract symbol\"\n\t\techo \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t\techo \"*** not find such a program.  So, this module is probably useless.\"\n\t\techo \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t      fi\n\t      if test \"$build_old_libs\" = no; then\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  else\n\t    deplibs=\"$dir/$old_library $deplibs\"\n\t    link_static=yes\n\t  fi\n\tfi # link shared/static library?\n\n\tif test \"$linkmode\" = lib; then\n\t  if test -n \"$dependency_libs\" &&\n\t     { test \"$hardcode_into_libs\" != yes ||\n\t       test \"$build_old_libs\" = yes ||\n\t       test \"$link_static\" = yes; }; then\n\t    # Extract -R from dependency_libs\n\t    temp_deplibs=\n\t    for libdir in $dependency_libs; do\n\t      case $libdir in\n\t      -R*) func_stripname '-R' '' \"$libdir\"\n\t           temp_xrpath=$func_stripname_result\n\t\t   case \" $xrpath \" in\n\t\t   *\" $temp_xrpath \"*) ;;\n\t\t   *) func_append xrpath \" $temp_xrpath\";;\n\t\t   esac;;\n\t      *) func_append temp_deplibs \" $libdir\";;\n\t      esac\n\t    done\n\t    dependency_libs=\"$temp_deplibs\"\n\t  fi\n\n\t  func_append newlib_search_path \" $absdir\"\n\t  # Link against this library\n\t  test \"$link_static\" = no && newdependency_libs=\"$abs_ladir/$laname $newdependency_libs\"\n\t  # ... and its dependency_libs\n\t  tmp_libs=\n\t  for deplib in $dependency_libs; do\n\t    newdependency_libs=\"$deplib $newdependency_libs\"\n\t    case $deplib in\n              -L*) func_stripname '-L' '' \"$deplib\"\n                   func_resolve_sysroot \"$func_stripname_result\";;\n              *) func_resolve_sysroot \"$deplib\" ;;\n            esac\n\t    if $opt_preserve_dup_deps ; then\n\t      case \"$tmp_libs \" in\n\t      *\" $func_resolve_sysroot_result \"*)\n                func_append specialdeplibs \" $func_resolve_sysroot_result\" ;;\n\t      esac\n\t    fi\n\t    func_append tmp_libs \" $func_resolve_sysroot_result\"\n\t  done\n\n\t  if test \"$link_all_deplibs\" != no; then\n\t    # Add the search paths of all dependency libraries\n\t    for deplib in $dependency_libs; do\n\t      path=\n\t      case $deplib in\n\t      -L*) path=\"$deplib\" ;;\n\t      *.la)\n\t        func_resolve_sysroot \"$deplib\"\n\t        deplib=$func_resolve_sysroot_result\n\t        func_dirname \"$deplib\" \"\" \".\"\n\t\tdir=$func_dirname_result\n\t\t# We need an absolute path.\n\t\tcase $dir in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) absdir=\"$dir\" ;;\n\t\t*)\n\t\t  absdir=`cd \"$dir\" && pwd`\n\t\t  if test -z \"$absdir\"; then\n\t\t    func_warning \"cannot determine absolute directory name of \\`$dir'\"\n\t\t    absdir=\"$dir\"\n\t\t  fi\n\t\t  ;;\n\t\tesac\n\t\tif $GREP \"^installed=no\" $deplib > /dev/null; then\n\t\tcase $host in\n\t\t*-*-darwin*)\n\t\t  depdepl=\n\t\t  eval deplibrary_names=`${SED} -n -e 's/^library_names=\\(.*\\)$/\\1/p' $deplib`\n\t\t  if test -n \"$deplibrary_names\" ; then\n\t\t    for tmp in $deplibrary_names ; do\n\t\t      depdepl=$tmp\n\t\t    done\n\t\t    if test -f \"$absdir/$objdir/$depdepl\" ; then\n\t\t      depdepl=\"$absdir/$objdir/$depdepl\"\n\t\t      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`\n                      if test -z \"$darwin_install_name\"; then\n                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`\n                      fi\n\t\t      func_append compiler_flags \" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}\"\n\t\t      func_append linker_flags \" -dylib_file ${darwin_install_name}:${depdepl}\"\n\t\t      path=\n\t\t    fi\n\t\t  fi\n\t\t  ;;\n\t\t*)\n\t\t  path=\"-L$absdir/$objdir\"\n\t\t  ;;\n\t\tesac\n\t\telse\n\t\t  eval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $deplib`\n\t\t  test -z \"$libdir\" && \\\n\t\t    func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\t  test \"$absdir\" != \"$libdir\" && \\\n\t\t    func_warning \"\\`$deplib' seems to be moved\"\n\n\t\t  path=\"-L$absdir\"\n\t\tfi\n\t\t;;\n\t      esac\n\t      case \" $deplibs \" in\n\t      *\" $path \"*) ;;\n\t      *) deplibs=\"$path $deplibs\" ;;\n\t      esac\n\t    done\n\t  fi # link_all_deplibs != no\n\tfi # linkmode = lib\n      done # for deplib in $libs\n      if test \"$pass\" = link; then\n\tif test \"$linkmode\" = \"prog\"; then\n\t  compile_deplibs=\"$new_inherited_linker_flags $compile_deplibs\"\n\t  finalize_deplibs=\"$new_inherited_linker_flags $finalize_deplibs\"\n\telse\n\t  compiler_flags=\"$compiler_flags \"`$ECHO \" $new_inherited_linker_flags\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfi\n      fi\n      dependency_libs=\"$newdependency_libs\"\n      if test \"$pass\" = dlpreopen; then\n\t# Link the dlpreopened libraries before other libraries\n\tfor deplib in $save_deplibs; do\n\t  deplibs=\"$deplib $deplibs\"\n\tdone\n      fi\n      if test \"$pass\" != dlopen; then\n\tif test \"$pass\" != conv; then\n\t  # Make sure lib_search_path contains only unique directories.\n\t  lib_search_path=\n\t  for dir in $newlib_search_path; do\n\t    case \"$lib_search_path \" in\n\t    *\" $dir \"*) ;;\n\t    *) func_append lib_search_path \" $dir\" ;;\n\t    esac\n\t  done\n\t  newlib_search_path=\n\tfi\n\n\tif test \"$linkmode,$pass\" != \"prog,link\"; then\n\t  vars=\"deplibs\"\n\telse\n\t  vars=\"compile_deplibs finalize_deplibs\"\n\tfi\n\tfor var in $vars dependency_libs; do\n\t  # Add libraries to $var in reverse order\n\t  eval tmp_libs=\\\"\\$$var\\\"\n\t  new_libs=\n\t  for deplib in $tmp_libs; do\n\t    # FIXME: Pedantically, this is the right thing to do, so\n\t    #        that some nasty dependency loop isn't accidentally\n\t    #        broken:\n\t    #new_libs=\"$deplib $new_libs\"\n\t    # Pragmatically, this seems to cause very few problems in\n\t    # practice:\n\t    case $deplib in\n\t    -L*) new_libs=\"$deplib $new_libs\" ;;\n\t    -R*) ;;\n\t    *)\n\t      # And here is the reason: when a library appears more\n\t      # than once as an explicit dependence of a library, or\n\t      # is implicitly linked in more than once by the\n\t      # compiler, it is considered special, and multiple\n\t      # occurrences thereof are not removed.  Compare this\n\t      # with having the same library being listed as a\n\t      # dependency of multiple other libraries: in this case,\n\t      # we know (pedantically, we assume) the library does not\n\t      # need to be listed more than once, so we keep only the\n\t      # last copy.  This is not always right, but it is rare\n\t      # enough that we require users that really mean to play\n\t      # such unportable linking tricks to link the library\n\t      # using -Wl,-lname, so that libtool does not consider it\n\t      # for duplicate removal.\n\t      case \" $specialdeplibs \" in\n\t      *\" $deplib \"*) new_libs=\"$deplib $new_libs\" ;;\n\t      *)\n\t\tcase \" $new_libs \" in\n\t\t*\" $deplib \"*) ;;\n\t\t*) new_libs=\"$deplib $new_libs\" ;;\n\t\tesac\n\t\t;;\n\t      esac\n\t      ;;\n\t    esac\n\t  done\n\t  tmp_libs=\n\t  for deplib in $new_libs; do\n\t    case $deplib in\n\t    -L*)\n\t      case \" $tmp_libs \" in\n\t      *\" $deplib \"*) ;;\n\t      *) func_append tmp_libs \" $deplib\" ;;\n\t      esac\n\t      ;;\n\t    *) func_append tmp_libs \" $deplib\" ;;\n\t    esac\n\t  done\n\t  eval $var=\\\"$tmp_libs\\\"\n\tdone # for var\n      fi\n      # Last step: remove runtime libs from dependency_libs\n      # (they stay in deplibs)\n      tmp_libs=\n      for i in $dependency_libs ; do\n\tcase \" $predeps $postdeps $compiler_lib_search_path \" in\n\t*\" $i \"*)\n\t  i=\"\"\n\t  ;;\n\tesac\n\tif test -n \"$i\" ; then\n\t  func_append tmp_libs \" $i\"\n\tfi\n      done\n      dependency_libs=$tmp_libs\n    done # for pass\n    if test \"$linkmode\" = prog; then\n      dlfiles=\"$newdlfiles\"\n    fi\n    if test \"$linkmode\" = prog || test \"$linkmode\" = lib; then\n      dlprefiles=\"$newdlprefiles\"\n    fi\n\n    case $linkmode in\n    oldlib)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for archives\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for archives\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for archives\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for archives\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info/-version-number' is ignored for archives\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for archives\"\n\n      test -n \"$export_symbols$export_symbols_regex\" && \\\n\tfunc_warning \"\\`-export-symbols' is ignored for archives\"\n\n      # Now set the variables for building old libraries.\n      build_libtool_libs=no\n      oldlibs=\"$output\"\n      func_append objs \"$old_deplibs\"\n      ;;\n\n    lib)\n      # Make sure we only generate libraries of the form `libNAME.la'.\n      case $outputname in\n      lib*)\n\tfunc_stripname 'lib' '.la' \"$outputname\"\n\tname=$func_stripname_result\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval libname=\\\"$libname_spec\\\"\n\t;;\n      *)\n\ttest \"$module\" = no && \\\n\t  func_fatal_help \"libtool library \\`$output' must begin with \\`lib'\"\n\n\tif test \"$need_lib_prefix\" != no; then\n\t  # Add the \"lib\" prefix for modules if required\n\t  func_stripname '' '.la' \"$outputname\"\n\t  name=$func_stripname_result\n\t  eval shared_ext=\\\"$shrext_cmds\\\"\n\t  eval libname=\\\"$libname_spec\\\"\n\telse\n\t  func_stripname '' '.la' \"$outputname\"\n\t  libname=$func_stripname_result\n\tfi\n\t;;\n      esac\n\n      if test -n \"$objs\"; then\n\tif test \"$deplibs_check_method\" != pass_all; then\n\t  func_fatal_error \"cannot build libtool library \\`$output' from non-libtool objects on this host:$objs\"\n\telse\n\t  echo\n\t  $ECHO \"*** Warning: Linking the shared library $output against the non-libtool\"\n\t  $ECHO \"*** objects $objs is not portable!\"\n\t  func_append libobjs \" $objs\"\n\tfi\n      fi\n\n      test \"$dlself\" != no && \\\n\tfunc_warning \"\\`-dlopen self' is ignored for libtool libraries\"\n\n      set dummy $rpath\n      shift\n      test \"$#\" -gt 1 && \\\n\tfunc_warning \"ignoring multiple \\`-rpath's for a libtool library\"\n\n      install_libdir=\"$1\"\n\n      oldlibs=\n      if test -z \"$rpath\"; then\n\tif test \"$build_libtool_libs\" = yes; then\n\t  # Building a libtool convenience library.\n\t  # Some compilers have problems with a `.al' extension so\n\t  # convenience libraries should have the same extension an\n\t  # archive normally would.\n\t  oldlibs=\"$output_objdir/$libname.$libext $oldlibs\"\n\t  build_libtool_libs=convenience\n\t  build_old_libs=yes\n\tfi\n\n\ttest -n \"$vinfo\" && \\\n\t  func_warning \"\\`-version-info/-version-number' is ignored for convenience libraries\"\n\n\ttest -n \"$release\" && \\\n\t  func_warning \"\\`-release' is ignored for convenience libraries\"\n      else\n\n\t# Parse the version information argument.\n\tsave_ifs=\"$IFS\"; IFS=':'\n\tset dummy $vinfo 0 0 0\n\tshift\n\tIFS=\"$save_ifs\"\n\n\ttest -n \"$7\" && \\\n\t  func_fatal_help \"too many parameters to \\`-version-info'\"\n\n\t# convert absolute version numbers to libtool ages\n\t# this retains compatibility with .la files and attempts\n\t# to make the code below a bit more comprehensible\n\n\tcase $vinfo_number in\n\tyes)\n\t  number_major=\"$1\"\n\t  number_minor=\"$2\"\n\t  number_revision=\"$3\"\n\t  #\n\t  # There are really only two kinds -- those that\n\t  # use the current revision as the major version\n\t  # and those that subtract age and use age as\n\t  # a minor version.  But, then there is irix\n\t  # which has an extra 1 added just for fun\n\t  #\n\t  case $version_type in\n\t  darwin|linux|osf|windows|none)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_revision\"\n\t    ;;\n\t  freebsd-aout|freebsd-elf|qnx|sunos)\n\t    current=\"$number_major\"\n\t    revision=\"$number_minor\"\n\t    age=\"0\"\n\t    ;;\n\t  irix|nonstopux)\n\t    func_arith $number_major + $number_minor\n\t    current=$func_arith_result\n\t    age=\"$number_minor\"\n\t    revision=\"$number_minor\"\n\t    lt_irix_increment=no\n\t    ;;\n\t  *)\n\t    func_fatal_configuration \"$modename: unknown library version type \\`$version_type'\"\n\t    ;;\n\t  esac\n\t  ;;\n\tno)\n\t  current=\"$1\"\n\t  revision=\"$2\"\n\t  age=\"$3\"\n\t  ;;\n\tesac\n\n\t# Check that each of the things are valid numbers.\n\tcase $current in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"CURRENT \\`$current' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $revision in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"REVISION \\`$revision' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tcase $age in\n\t0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;\n\t*)\n\t  func_error \"AGE \\`$age' must be a nonnegative integer\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\t  ;;\n\tesac\n\n\tif test \"$age\" -gt \"$current\"; then\n\t  func_error \"AGE \\`$age' is greater than the current interface number \\`$current'\"\n\t  func_fatal_error \"\\`$vinfo' is not valid version information\"\n\tfi\n\n\t# Calculate the version variables.\n\tmajor=\n\tversuffix=\n\tverstring=\n\tcase $version_type in\n\tnone) ;;\n\n\tdarwin)\n\t  # Like Linux, but with the current version available in\n\t  # verstring for coding it into the library header\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  # Darwin ld doesn't like 0 for these options...\n\t  func_arith $current + 1\n\t  minor_current=$func_arith_result\n\t  xlcverstring=\"${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision\"\n\t  verstring=\"-compatibility_version $minor_current -current_version $minor_current.$revision\"\n\t  ;;\n\n\tfreebsd-aout)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\";\n\t  ;;\n\n\tfreebsd-elf)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tirix | nonstopux)\n\t  if test \"X$lt_irix_increment\" = \"Xno\"; then\n\t    func_arith $current - $age\n\t  else\n\t    func_arith $current - $age + 1\n\t  fi\n\t  major=$func_arith_result\n\n\t  case $version_type in\n\t    nonstopux) verstring_prefix=nonstopux ;;\n\t    *)         verstring_prefix=sgi ;;\n\t  esac\n\t  verstring=\"$verstring_prefix$major.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$revision\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $revision - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring_prefix$major.$iface:$verstring\"\n\t  done\n\n\t  # Before this point, $major must not contain `.'.\n\t  major=.$major\n\t  versuffix=\"$major.$revision\"\n\t  ;;\n\n\tlinux)\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\"$major.$age.$revision\"\n\t  ;;\n\n\tosf)\n\t  func_arith $current - $age\n\t  major=.$func_arith_result\n\t  versuffix=\".$current.$age.$revision\"\n\t  verstring=\"$current.$age.$revision\"\n\n\t  # Add in all the interfaces that we are compatible with.\n\t  loop=$age\n\t  while test \"$loop\" -ne 0; do\n\t    func_arith $current - $loop\n\t    iface=$func_arith_result\n\t    func_arith $loop - 1\n\t    loop=$func_arith_result\n\t    verstring=\"$verstring:${iface}.0\"\n\t  done\n\n\t  # Make executables depend on our current version.\n\t  func_append verstring \":${current}.0\"\n\t  ;;\n\n\tqnx)\n\t  major=\".$current\"\n\t  versuffix=\".$current\"\n\t  ;;\n\n\tsunos)\n\t  major=\".$current\"\n\t  versuffix=\".$current.$revision\"\n\t  ;;\n\n\twindows)\n\t  # Use '-' rather than '.', since we only want one\n\t  # extension on DOS 8.3 filesystems.\n\t  func_arith $current - $age\n\t  major=$func_arith_result\n\t  versuffix=\"-$major\"\n\t  ;;\n\n\t*)\n\t  func_fatal_configuration \"unknown library version type \\`$version_type'\"\n\t  ;;\n\tesac\n\n\t# Clear the version info if we defaulted, and they specified a release.\n\tif test -z \"$vinfo\" && test -n \"$release\"; then\n\t  major=\n\t  case $version_type in\n\t  darwin)\n\t    # we can't check for \"0.0\" in archive_cmds due to quoting\n\t    # problems, so we reset it completely\n\t    verstring=\n\t    ;;\n\t  *)\n\t    verstring=\"0.0\"\n\t    ;;\n\t  esac\n\t  if test \"$need_version\" = no; then\n\t    versuffix=\n\t  else\n\t    versuffix=\".0.0\"\n\t  fi\n\tfi\n\n\t# Remove version info from name if versioning should be avoided\n\tif test \"$avoid_version\" = yes && test \"$need_version\" = no; then\n\t  major=\n\t  versuffix=\n\t  verstring=\"\"\n\tfi\n\n\t# Check to see if the archive will have undefined symbols.\n\tif test \"$allow_undefined\" = yes; then\n\t  if test \"$allow_undefined_flag\" = unsupported; then\n\t    func_warning \"undefined symbols not allowed in $host shared libraries\"\n\t    build_libtool_libs=no\n\t    build_old_libs=yes\n\t  fi\n\telse\n\t  # Don't allow undefined symbols.\n\t  allow_undefined_flag=\"$no_undefined_flag\"\n\tfi\n\n      fi\n\n      func_generate_dlsyms \"$libname\" \"$libname\" \"yes\"\n      func_append libobjs \" $symfileobj\"\n      test \"X$libobjs\" = \"X \" && libobjs=\n\n      if test \"$opt_mode\" != relink; then\n\t# Remove our outputs, but don't remove object files since they\n\t# may have been created when compiling PIC objects.\n\tremovelist=\n\ttempremovelist=`$ECHO \"$output_objdir/*\"`\n\tfor p in $tempremovelist; do\n\t  case $p in\n\t    *.$objext | *.gcno)\n\t       ;;\n\t    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)\n\t       if test \"X$precious_files_regex\" != \"X\"; then\n\t\t if $ECHO \"$p\" | $EGREP -e \"$precious_files_regex\" >/dev/null 2>&1\n\t\t then\n\t\t   continue\n\t\t fi\n\t       fi\n\t       func_append removelist \" $p\"\n\t       ;;\n\t    *) ;;\n\t  esac\n\tdone\n\ttest -n \"$removelist\" && \\\n\t  func_show_eval \"${RM}r \\$removelist\"\n      fi\n\n      # Now set the variables for building old libraries.\n      if test \"$build_old_libs\" = yes && test \"$build_libtool_libs\" != convenience ; then\n\tfunc_append oldlibs \" $output_objdir/$libname.$libext\"\n\n\t# Transform .lo files to .o files.\n\toldobjs=\"$objs \"`$ECHO \"$libobjs\" | $SP2NL | $SED \"/\\.${libext}$/d; $lo2o\" | $NL2SP`\n      fi\n\n      # Eliminate all temporary directories.\n      #for path in $notinst_path; do\n      #\tlib_search_path=`$ECHO \"$lib_search_path \" | $SED \"s% $path % %g\"`\n      #\tdeplibs=`$ECHO \"$deplibs \" | $SED \"s% -L$path % %g\"`\n      #\tdependency_libs=`$ECHO \"$dependency_libs \" | $SED \"s% -L$path % %g\"`\n      #done\n\n      if test -n \"$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\ttemp_xrpath=\n\tfor libdir in $xrpath; do\n\t  func_replace_sysroot \"$libdir\"\n\t  func_append temp_xrpath \" -R$func_replace_sysroot_result\"\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_rpath \" $libdir\" ;;\n\t  esac\n\tdone\n\tif test \"$hardcode_into_libs\" != yes || test \"$build_old_libs\" = yes; then\n\t  dependency_libs=\"$temp_xrpath $dependency_libs\"\n\tfi\n      fi\n\n      # Make sure dlfiles contains only unique files that won't be dlpreopened\n      old_dlfiles=\"$dlfiles\"\n      dlfiles=\n      for lib in $old_dlfiles; do\n\tcase \" $dlprefiles $dlfiles \" in\n\t*\" $lib \"*) ;;\n\t*) func_append dlfiles \" $lib\" ;;\n\tesac\n      done\n\n      # Make sure dlprefiles contains only unique files\n      old_dlprefiles=\"$dlprefiles\"\n      dlprefiles=\n      for lib in $old_dlprefiles; do\n\tcase \"$dlprefiles \" in\n\t*\" $lib \"*) ;;\n\t*) func_append dlprefiles \" $lib\" ;;\n\tesac\n      done\n\n      if test \"$build_libtool_libs\" = yes; then\n\tif test -n \"$rpath\"; then\n\t  case $host in\n\t  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)\n\t    # these systems don't actually have a c library (as such)!\n\t    ;;\n\t  *-*-rhapsody* | *-*-darwin1.[012])\n\t    # Rhapsody C library is in the System framework\n\t    func_append deplibs \" System.ltframework\"\n\t    ;;\n\t  *-*-netbsd*)\n\t    # Don't link with libc until the a.out ld.so is fixed.\n\t    ;;\n\t  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)\n\t    # Do not include libc due to us having libc/libc_r.\n\t    ;;\n\t  *-*-sco3.2v5* | *-*-sco5v6*)\n\t    # Causes problems with __ctype\n\t    ;;\n\t  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)\n\t    # Compiler inserts libc in the correct place for threads to work\n\t    ;;\n\t  *)\n\t    # Add libc to deplibs on all other systems if necessary.\n\t    if test \"$build_libtool_need_lc\" = \"yes\"; then\n\t      func_append deplibs \" -lc\"\n\t    fi\n\t    ;;\n\t  esac\n\tfi\n\n\t# Transform deplibs into only deplibs that can be linked in shared.\n\tname_save=$name\n\tlibname_save=$libname\n\trelease_save=$release\n\tversuffix_save=$versuffix\n\tmajor_save=$major\n\t# I'm not sure if I'm treating the release correctly.  I think\n\t# release should show up in the -l (ie -lgmp5) so we don't want to\n\t# add it in twice.  Is that correct?\n\trelease=\"\"\n\tversuffix=\"\"\n\tmajor=\"\"\n\tnewdeplibs=\n\tdroppeddeps=no\n\tcase $deplibs_check_method in\n\tpass_all)\n\t  # Don't check for shared/static.  Everything works.\n\t  # This might be a little naive.  We might want to check\n\t  # whether the library exists or not.  But this is on\n\t  # osf3 & osf4 and I'm not really sure... Just\n\t  # implementing what was already the behavior.\n\t  newdeplibs=$deplibs\n\t  ;;\n\ttest_compile)\n\t  # This code stresses the \"libraries are programs\" paradigm to its\n\t  # limits. Maybe even breaks it.  We compile a program, linking it\n\t  # against the deplibs as a proxy for the library.  Then we can check\n\t  # whether they linked in statically or dynamically with ldd.\n\t  $opt_dry_run || $RM conftest.c\n\t  cat > conftest.c <<EOF\n\t  int main() { return 0; }\nEOF\n\t  $opt_dry_run || $RM conftest\n\t  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then\n\t    ldd_output=`ldd conftest`\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\tif test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t  case \" $predeps $postdeps \" in\n\t\t  *\" $i \"*)\n\t\t    func_append newdeplibs \" $i\"\n\t\t    i=\"\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t\tif test -n \"$i\" ; then\n\t\t  libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t  deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t  set dummy $deplib_matches; shift\n\t\t  deplib_match=$1\n\t\t  if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t    func_append newdeplibs \" $i\"\n\t\t  else\n\t\t    droppeddeps=yes\n\t\t    echo\n\t\t    $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t    echo \"*** I have the capability to make that library automatically link in when\"\n\t\t    echo \"*** you link to this library.  But I can only do this if you have a\"\n\t\t    echo \"*** shared version of the library, which I believe you do not have\"\n\t\t    echo \"*** because a test_compile did reveal that the linker did not use it for\"\n\t\t    echo \"*** its dynamic dependency list that programs get resolved with at runtime.\"\n\t\t  fi\n\t\tfi\n\t\t;;\n\t      *)\n\t\tfunc_append newdeplibs \" $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  else\n\t    # Error occurred in the first compile.  Let's try to salvage\n\t    # the situation: Compile a separate program for each library.\n\t    for i in $deplibs; do\n\t      case $i in\n\t      -l*)\n\t\tfunc_stripname -l '' \"$i\"\n\t\tname=$func_stripname_result\n\t\t$opt_dry_run || $RM conftest\n\t\tif $LTCC $LTCFLAGS -o conftest conftest.c $i; then\n\t\t  ldd_output=`ldd conftest`\n\t\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\t    case \" $predeps $postdeps \" in\n\t\t    *\" $i \"*)\n\t\t      func_append newdeplibs \" $i\"\n\t\t      i=\"\"\n\t\t      ;;\n\t\t    esac\n\t\t  fi\n\t\t  if test -n \"$i\" ; then\n\t\t    libname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\t    deplib_matches=`eval \"\\\\$ECHO \\\"$library_names_spec\\\"\"`\n\t\t    set dummy $deplib_matches; shift\n\t\t    deplib_match=$1\n\t\t    if test `expr \"$ldd_output\" : \".*$deplib_match\"` -ne 0 ; then\n\t\t      func_append newdeplibs \" $i\"\n\t\t    else\n\t\t      droppeddeps=yes\n\t\t      echo\n\t\t      $ECHO \"*** Warning: dynamic linker does not accept needed library $i.\"\n\t\t      echo \"*** I have the capability to make that library automatically link in when\"\n\t\t      echo \"*** you link to this library.  But I can only do this if you have a\"\n\t\t      echo \"*** shared version of the library, which you do not appear to have\"\n\t\t      echo \"*** because a test_compile did reveal that the linker did not use this one\"\n\t\t      echo \"*** as a dynamic dependency that programs can get resolved with at runtime.\"\n\t\t    fi\n\t\t  fi\n\t\telse\n\t\t  droppeddeps=yes\n\t\t  echo\n\t\t  $ECHO \"*** Warning!  Library $i is needed by this library but I was not able to\"\n\t\t  echo \"*** make it link in!  You will probably need to install it or some\"\n\t\t  echo \"*** library that it depends on before this library will be fully\"\n\t\t  echo \"*** functional.  Installing it before continuing would be even better.\"\n\t\tfi\n\t\t;;\n\t      *)\n\t\tfunc_append newdeplibs \" $i\"\n\t\t;;\n\t      esac\n\t    done\n\t  fi\n\t  ;;\n\tfile_magic*)\n\t  set dummy $deplibs_check_method; shift\n\t  file_magic_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  func_append newdeplibs \" $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tif test -n \"$file_magic_glob\"; then\n\t\t  libnameglob=`func_echo_all \"$libname\" | $SED -e $file_magic_glob`\n\t\telse\n\t\t  libnameglob=$libname\n\t\tfi\n\t\ttest \"$want_nocaseglob\" = yes && nocaseglob=`shopt -p nocaseglob`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  if test \"$want_nocaseglob\" = yes; then\n\t\t    shopt -s nocaseglob\n\t\t    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`\n\t\t    $nocaseglob\n\t\t  else\n\t\t    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`\n\t\t  fi\n\t\t  for potent_lib in $potential_libs; do\n\t\t      # Follow soft links.\n\t\t      if ls -lLd \"$potent_lib\" 2>/dev/null |\n\t\t\t $GREP \" -> \" >/dev/null; then\n\t\t\tcontinue\n\t\t      fi\n\t\t      # The statement above tries to avoid entering an\n\t\t      # endless loop below, in case of cyclic links.\n\t\t      # We might still enter an endless loop, since a link\n\t\t      # loop can be closed while we follow links,\n\t\t      # but so what?\n\t\t      potlib=\"$potent_lib\"\n\t\t      while test -h \"$potlib\" 2>/dev/null; do\n\t\t\tpotliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`\n\t\t\tcase $potliblink in\n\t\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) potlib=\"$potliblink\";;\n\t\t\t*) potlib=`$ECHO \"$potlib\" | $SED 's,[^/]*$,,'`\"$potliblink\";;\n\t\t\tesac\n\t\t      done\n\t\t      if eval $file_magic_cmd \\\"\\$potlib\\\" 2>/dev/null |\n\t\t\t $SED -e 10q |\n\t\t\t $EGREP \"$file_magic_regex\" > /dev/null; then\n\t\t\tfunc_append newdeplibs \" $a_deplib\"\n\t\t\ta_deplib=\"\"\n\t\t\tbreak 2\n\t\t      fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\techo\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for file magic test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a file magic. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      func_append newdeplibs \" $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tmatch_pattern*)\n\t  set dummy $deplibs_check_method; shift\n\t  match_pattern_regex=`expr \"$deplibs_check_method\" : \"$1 \\(.*\\)\"`\n\t  for a_deplib in $deplibs; do\n\t    case $a_deplib in\n\t    -l*)\n\t      func_stripname -l '' \"$a_deplib\"\n\t      name=$func_stripname_result\n\t      if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t\tcase \" $predeps $postdeps \" in\n\t\t*\" $a_deplib \"*)\n\t\t  func_append newdeplibs \" $a_deplib\"\n\t\t  a_deplib=\"\"\n\t\t  ;;\n\t\tesac\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tlibname=`eval \"\\\\$ECHO \\\"$libname_spec\\\"\"`\n\t\tfor i in $lib_search_path $sys_lib_search_path $shlib_search_path; do\n\t\t  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`\n\t\t  for potent_lib in $potential_libs; do\n\t\t    potlib=\"$potent_lib\" # see symlink-check above in file_magic test\n\t\t    if eval \"\\$ECHO \\\"$potent_lib\\\"\" 2>/dev/null | $SED 10q | \\\n\t\t       $EGREP \"$match_pattern_regex\" > /dev/null; then\n\t\t      func_append newdeplibs \" $a_deplib\"\n\t\t      a_deplib=\"\"\n\t\t      break 2\n\t\t    fi\n\t\t  done\n\t\tdone\n\t      fi\n\t      if test -n \"$a_deplib\" ; then\n\t\tdroppeddeps=yes\n\t\techo\n\t\t$ECHO \"*** Warning: linker path does not have real file for library $a_deplib.\"\n\t\techo \"*** I have the capability to make that library automatically link in when\"\n\t\techo \"*** you link to this library.  But I can only do this if you have a\"\n\t\techo \"*** shared version of the library, which you do not appear to have\"\n\t\techo \"*** because I did check the linker path looking for a file starting\"\n\t\tif test -z \"$potlib\" ; then\n\t\t  $ECHO \"*** with $libname but no candidates were found. (...for regex pattern test)\"\n\t\telse\n\t\t  $ECHO \"*** with $libname and none of the candidates passed a file format test\"\n\t\t  $ECHO \"*** using a regex pattern. Last file checked: $potlib\"\n\t\tfi\n\t      fi\n\t      ;;\n\t    *)\n\t      # Add a -L argument.\n\t      func_append newdeplibs \" $a_deplib\"\n\t      ;;\n\t    esac\n\t  done # Gone through all deplibs.\n\t  ;;\n\tnone | unknown | *)\n\t  newdeplibs=\"\"\n\t  tmp_deplibs=`$ECHO \" $deplibs\" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`\n\t  if test \"X$allow_libtool_libs_with_static_runtimes\" = \"Xyes\" ; then\n\t    for i in $predeps $postdeps ; do\n\t      # can't use Xsed below, because $i might contain '/'\n\t      tmp_deplibs=`$ECHO \" $tmp_deplibs\" | $SED \"s,$i,,\"`\n\t    done\n\t  fi\n\t  case $tmp_deplibs in\n\t  *[!\\\t\\ ]*)\n\t    echo\n\t    if test \"X$deplibs_check_method\" = \"Xnone\"; then\n\t      echo \"*** Warning: inter-library dependencies are not supported in this platform.\"\n\t    else\n\t      echo \"*** Warning: inter-library dependencies are not known to be supported.\"\n\t    fi\n\t    echo \"*** All declared inter-library dependencies are being dropped.\"\n\t    droppeddeps=yes\n\t    ;;\n\t  esac\n\t  ;;\n\tesac\n\tversuffix=$versuffix_save\n\tmajor=$major_save\n\trelease=$release_save\n\tlibname=$libname_save\n\tname=$name_save\n\n\tcase $host in\n\t*-*-rhapsody* | *-*-darwin1.[012])\n\t  # On Rhapsody replace the C library with the System framework\n\t  newdeplibs=`$ECHO \" $newdeplibs\" | $SED 's/ -lc / System.ltframework /'`\n\t  ;;\n\tesac\n\n\tif test \"$droppeddeps\" = yes; then\n\t  if test \"$module\" = yes; then\n\t    echo\n\t    echo \"*** Warning: libtool could not satisfy all declared inter-library\"\n\t    $ECHO \"*** dependencies of module $libname.  Therefore, libtool will create\"\n\t    echo \"*** a static module, that should work as long as the dlopening\"\n\t    echo \"*** application is linked with the -dlopen flag.\"\n\t    if test -z \"$global_symbol_pipe\"; then\n\t      echo\n\t      echo \"*** However, this would only work if libtool was able to extract symbol\"\n\t      echo \"*** lists from a program, using \\`nm' or equivalent, but libtool could\"\n\t      echo \"*** not find such a program.  So, this module is probably useless.\"\n\t      echo \"*** \\`nm' from GNU binutils and a full rebuild may help.\"\n\t    fi\n\t    if test \"$build_old_libs\" = no; then\n\t      oldlibs=\"$output_objdir/$libname.$libext\"\n\t      build_libtool_libs=module\n\t      build_old_libs=yes\n\t    else\n\t      build_libtool_libs=no\n\t    fi\n\t  else\n\t    echo \"*** The inter-library dependencies that have been dropped here will be\"\n\t    echo \"*** automatically added whenever a program is linked with this library\"\n\t    echo \"*** or is declared to -dlopen it.\"\n\n\t    if test \"$allow_undefined\" = no; then\n\t      echo\n\t      echo \"*** Since this library must not contain undefined symbols,\"\n\t      echo \"*** because either the platform does not support them or\"\n\t      echo \"*** it was explicitly requested with -no-undefined,\"\n\t      echo \"*** libtool will only create a static version of it.\"\n\t      if test \"$build_old_libs\" = no; then\n\t\toldlibs=\"$output_objdir/$libname.$libext\"\n\t\tbuild_libtool_libs=module\n\t\tbuild_old_libs=yes\n\t      else\n\t\tbuild_libtool_libs=no\n\t      fi\n\t    fi\n\t  fi\n\tfi\n\t# Done checking deplibs!\n\tdeplibs=$newdeplibs\n      fi\n      # Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n      case $host in\n\t*-*-darwin*)\n\t  newdeplibs=`$ECHO \" $newdeplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  new_inherited_linker_flags=`$ECHO \" $new_inherited_linker_flags\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  deplibs=`$ECHO \" $deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t  ;;\n      esac\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    func_append new_libs \" -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) func_append new_libs \" $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) func_append new_libs \" $deplib\" ;;\n\tesac\n      done\n      deplibs=\"$new_libs\"\n\n      # All the library-specific variables (install_libdir is set above).\n      library_names=\n      old_library=\n      dlname=\n\n      # Test again, we may have decided not to build it any more\n      if test \"$build_libtool_libs\" = yes; then\n\tif test \"$hardcode_into_libs\" = yes; then\n\t  # Hardcode the library paths\n\t  hardcode_libdirs=\n\t  dep_rpath=\n\t  rpath=\"$finalize_rpath\"\n\t  test \"$opt_mode\" != relink && rpath=\"$compile_rpath$rpath\"\n\t  for libdir in $rpath; do\n\t    if test -n \"$hardcode_libdir_flag_spec\"; then\n\t      if test -n \"$hardcode_libdir_separator\"; then\n\t\tfunc_replace_sysroot \"$libdir\"\n\t\tlibdir=$func_replace_sysroot_result\n\t\tif test -z \"$hardcode_libdirs\"; then\n\t\t  hardcode_libdirs=\"$libdir\"\n\t\telse\n\t\t  # Just accumulate the unique libdirs.\n\t\t  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t\t  *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t    ;;\n\t\t  *)\n\t\t    func_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t    ;;\n\t\t  esac\n\t\tfi\n\t      else\n\t\teval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t\tfunc_append dep_rpath \" $flag\"\n\t      fi\n\t    elif test -n \"$runpath_var\"; then\n\t      case \"$perm_rpath \" in\n\t      *\" $libdir \"*) ;;\n\t      *) func_apped perm_rpath \" $libdir\" ;;\n\t      esac\n\t    fi\n\t  done\n\t  # Substitute the hardcoded libdirs into the rpath.\n\t  if test -n \"$hardcode_libdir_separator\" &&\n\t     test -n \"$hardcode_libdirs\"; then\n\t    libdir=\"$hardcode_libdirs\"\n\t    if test -n \"$hardcode_libdir_flag_spec_ld\"; then\n\t      eval dep_rpath=\\\"$hardcode_libdir_flag_spec_ld\\\"\n\t    else\n\t      eval dep_rpath=\\\"$hardcode_libdir_flag_spec\\\"\n\t    fi\n\t  fi\n\t  if test -n \"$runpath_var\" && test -n \"$perm_rpath\"; then\n\t    # We should set the runpath_var.\n\t    rpath=\n\t    for dir in $perm_rpath; do\n\t      func_append rpath \"$dir:\"\n\t    done\n\t    eval \"$runpath_var='$rpath\\$$runpath_var'; export $runpath_var\"\n\t  fi\n\t  test -n \"$dep_rpath\" && deplibs=\"$dep_rpath $deplibs\"\n\tfi\n\n\tshlibpath=\"$finalize_shlibpath\"\n\ttest \"$opt_mode\" != relink && shlibpath=\"$compile_shlibpath$shlibpath\"\n\tif test -n \"$shlibpath\"; then\n\t  eval \"$shlibpath_var='$shlibpath\\$$shlibpath_var'; export $shlibpath_var\"\n\tfi\n\n\t# Get the real and link names of the library.\n\teval shared_ext=\\\"$shrext_cmds\\\"\n\teval library_names=\\\"$library_names_spec\\\"\n\tset dummy $library_names\n\tshift\n\trealname=\"$1\"\n\tshift\n\n\tif test -n \"$soname_spec\"; then\n\t  eval soname=\\\"$soname_spec\\\"\n\telse\n\t  soname=\"$realname\"\n\tfi\n\tif test -z \"$dlname\"; then\n\t  dlname=$soname\n\tfi\n\n\tlib=\"$output_objdir/$realname\"\n\tlinknames=\n\tfor link\n\tdo\n\t  func_append linknames \" $link\"\n\tdone\n\n\t# Use standard objects if they are pic\n\ttest -z \"$pic_flag\" && libobjs=`$ECHO \"$libobjs\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\ttest \"X$libobjs\" = \"X \" && libobjs=\n\n\tdelfiles=\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  $opt_dry_run || cp \"$export_symbols\" \"$output_objdir/$libname.uexp\"\n\t  export_symbols=\"$output_objdir/$libname.uexp\"\n\t  func_append delfiles \" $export_symbols\"\n\tfi\n\n\torig_export_symbols=\n\tcase $host_os in\n\tcygwin* | mingw* | cegcc*)\n\t  if test -n \"$export_symbols\" && test -z \"$export_symbols_regex\"; then\n\t    # exporting using user supplied symfile\n\t    if test \"x`$SED 1q $export_symbols`\" != xEXPORTS; then\n\t      # and it's NOT already a .def file. Must figure out\n\t      # which of the given symbols are data symbols and tag\n\t      # them as such. So, trigger use of export_symbols_cmds.\n\t      # export_symbols gets reassigned inside the \"prepare\n\t      # the list of exported symbols\" if statement, so the\n\t      # include_expsyms logic still works.\n\t      orig_export_symbols=\"$export_symbols\"\n\t      export_symbols=\n\t      always_export_symbols=yes\n\t    fi\n\t  fi\n\t  ;;\n\tesac\n\n\t# Prepare the list of exported symbols\n\tif test -z \"$export_symbols\"; then\n\t  if test \"$always_export_symbols\" = yes || test -n \"$export_symbols_regex\"; then\n\t    func_verbose \"generating symbol list for \\`$libname.la'\"\n\t    export_symbols=\"$output_objdir/$libname.exp\"\n\t    $opt_dry_run || $RM $export_symbols\n\t    cmds=$export_symbols_cmds\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd1 in $cmds; do\n\t      IFS=\"$save_ifs\"\n\t      # Take the normal branch if the nm_file_list_spec branch\n\t      # doesn't work or if tool conversion is not needed.\n\t      case $nm_file_list_spec~$to_tool_file_cmd in\n\t\t*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)\n\t\t  try_normal_branch=yes\n\t\t  eval cmd=\\\"$cmd1\\\"\n\t\t  func_len \" $cmd\"\n\t\t  len=$func_len_result\n\t\t  ;;\n\t\t*)\n\t\t  try_normal_branch=no\n\t\t  ;;\n\t      esac\n\t      if test \"$try_normal_branch\" = yes \\\n\t\t && { test \"$len\" -lt \"$max_cmd_len\" \\\n\t\t      || test \"$max_cmd_len\" -le -1; }\n\t      then\n\t\tfunc_show_eval \"$cmd\" 'exit $?'\n\t\tskipped_export=false\n\t      elif test -n \"$nm_file_list_spec\"; then\n\t\tfunc_basename \"$output\"\n\t\toutput_la=$func_basename_result\n\t\tsave_libobjs=$libobjs\n\t\tsave_output=$output\n\t\toutput=${output_objdir}/${output_la}.nm\n\t\tfunc_to_tool_file \"$output\"\n\t\tlibobjs=$nm_file_list_spec$func_to_tool_file_result\n\t\tfunc_append delfiles \" $output\"\n\t\tfunc_verbose \"creating $NM input file list: $output\"\n\t\tfor obj in $save_libobjs; do\n\t\t  func_to_tool_file \"$obj\"\n\t\t  $ECHO \"$func_to_tool_file_result\"\n\t\tdone > \"$output\"\n\t\teval cmd=\\\"$cmd1\\\"\n\t\tfunc_show_eval \"$cmd\" 'exit $?'\n\t\toutput=$save_output\n\t\tlibobjs=$save_libobjs\n\t\tskipped_export=false\n\t      else\n\t\t# The command line is too long to execute in one step.\n\t\tfunc_verbose \"using reloadable object file for export list...\"\n\t\tskipped_export=:\n\t\t# Break out early, otherwise skipped_export may be\n\t\t# set to false by a later but shorter cmd.\n\t\tbreak\n\t      fi\n\t    done\n\t    IFS=\"$save_ifs\"\n\t    if test -n \"$export_symbols_regex\" && test \"X$skipped_export\" != \"X:\"; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t  tmp_export_symbols=\"$export_symbols\"\n\t  test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t  $opt_dry_run || eval '$ECHO \"$include_expsyms\" | $SP2NL >> \"$tmp_export_symbols\"'\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" && test -n \"$orig_export_symbols\"; then\n\t  # The given exports_symbols file has to be filtered, so filter it.\n\t  func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t  # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t  # 's' commands which not all seds can handle. GNU sed should be fine\n\t  # though. Also, the filter scales superlinearly with the number of\n\t  # global variables. join(1) would be nice here, but unfortunately\n\t  # isn't a blessed tool.\n\t  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t  func_append delfiles \" $export_symbols $output_objdir/$libname.filter\"\n\t  export_symbols=$output_objdir/$libname.def\n\t  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\tfi\n\n\ttmp_deplibs=\n\tfor test_deplib in $deplibs; do\n\t  case \" $convenience \" in\n\t  *\" $test_deplib \"*) ;;\n\t  *)\n\t    func_append tmp_deplibs \" $test_deplib\"\n\t    ;;\n\t  esac\n\tdone\n\tdeplibs=\"$tmp_deplibs\"\n\n\tif test -n \"$convenience\"; then\n\t  if test -n \"$whole_archive_flag_spec\" &&\n\t    test \"$compiler_needs_object\" = yes &&\n\t    test -z \"$libobjs\"; then\n\t    # extract the archives, so we have objects to list.\n\t    # TODO: could optimize this to just extract one archive.\n\t    whole_archive_flag_spec=\n\t  fi\n\t  if test -n \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  else\n\t    gentop=\"$output_objdir/${outputname}x\"\n\t    func_append generated \" $gentop\"\n\n\t    func_extract_archives $gentop $convenience\n\t    func_append libobjs \" $func_extract_archives_result\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\tfi\n\n\tif test \"$thread_safe\" = yes && test -n \"$thread_safe_flag_spec\"; then\n\t  eval flag=\\\"$thread_safe_flag_spec\\\"\n\t  func_append linker_flags \" $flag\"\n\tfi\n\n\t# Make a backup of the uninstalled library when relinking\n\tif test \"$opt_mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?\n\tfi\n\n\t# Do each of the archive commands.\n\tif test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t  if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$module_expsym_cmds\\\"\n\t    cmds=$module_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$module_cmds\\\"\n\t    cmds=$module_cmds\n\t  fi\n\telse\n\t  if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t    eval test_cmds=\\\"$archive_expsym_cmds\\\"\n\t    cmds=$archive_expsym_cmds\n\t  else\n\t    eval test_cmds=\\\"$archive_cmds\\\"\n\t    cmds=$archive_cmds\n\t  fi\n\tfi\n\n\tif test \"X$skipped_export\" != \"X:\" &&\n\t   func_len \" $test_cmds\" &&\n\t   len=$func_len_result &&\n\t   test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  :\n\telse\n\t  # The command line is too long to link in one step, link piecewise\n\t  # or, if using GNU ld and skipped_export is not :, use a linker\n\t  # script.\n\n\t  # Save the value of $output and $libobjs because we want to\n\t  # use them later.  If we have whole_archive_flag_spec, we\n\t  # want to use save_libobjs as it was before\n\t  # whole_archive_flag_spec was expanded, because we can't\n\t  # assume the linker understands whole_archive_flag_spec.\n\t  # This may have to be revisited, in case too many\n\t  # convenience libraries get linked in and end up exceeding\n\t  # the spec.\n\t  if test -z \"$convenience\" || test -z \"$whole_archive_flag_spec\"; then\n\t    save_libobjs=$libobjs\n\t  fi\n\t  save_output=$output\n\t  func_basename \"$output\"\n\t  output_la=$func_basename_result\n\n\t  # Clear the reloadable object creation command queue and\n\t  # initialize k to one.\n\t  test_cmds=\n\t  concat_cmds=\n\t  objlist=\n\t  last_robj=\n\t  k=1\n\n\t  if test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"$with_gnu_ld\" = yes; then\n\t    output=${output_objdir}/${output_la}.lnkscript\n\t    func_verbose \"creating GNU ld script: $output\"\n\t    echo 'INPUT (' > $output\n\t    for obj in $save_libobjs\n\t    do\n\t      func_to_tool_file \"$obj\"\n\t      $ECHO \"$func_to_tool_file_result\" >> $output\n\t    done\n\t    echo ')' >> $output\n\t    func_append delfiles \" $output\"\n\t    func_to_tool_file \"$output\"\n\t    output=$func_to_tool_file_result\n\t  elif test -n \"$save_libobjs\" && test \"X$skipped_export\" != \"X:\" && test \"X$file_list_spec\" != X; then\n\t    output=${output_objdir}/${output_la}.lnk\n\t    func_verbose \"creating linker input file list: $output\"\n\t    : > $output\n\t    set x $save_libobjs\n\t    shift\n\t    firstobj=\n\t    if test \"$compiler_needs_object\" = yes; then\n\t      firstobj=\"$1 \"\n\t      shift\n\t    fi\n\t    for obj\n\t    do\n\t      func_to_tool_file \"$obj\"\n\t      $ECHO \"$func_to_tool_file_result\" >> $output\n\t    done\n\t    func_append delfiles \" $output\"\n\t    func_to_tool_file \"$output\"\n\t    output=$firstobj\\\"$file_list_spec$func_to_tool_file_result\\\"\n\t  else\n\t    if test -n \"$save_libobjs\"; then\n\t      func_verbose \"creating reloadable object files...\"\n\t      output=$output_objdir/$output_la-${k}.$objext\n\t      eval test_cmds=\\\"$reload_cmds\\\"\n\t      func_len \" $test_cmds\"\n\t      len0=$func_len_result\n\t      len=$len0\n\n\t      # Loop over the list of objects to be linked.\n\t      for obj in $save_libobjs\n\t      do\n\t\tfunc_len \" $obj\"\n\t\tfunc_arith $len + $func_len_result\n\t\tlen=$func_arith_result\n\t\tif test \"X$objlist\" = X ||\n\t\t   test \"$len\" -lt \"$max_cmd_len\"; then\n\t\t  func_append objlist \" $obj\"\n\t\telse\n\t\t  # The command $test_cmds is almost too long, add a\n\t\t  # command to the queue.\n\t\t  if test \"$k\" -eq 1 ; then\n\t\t    # The first file doesn't have a previous command to add.\n\t\t    reload_objs=$objlist\n\t\t    eval concat_cmds=\\\"$reload_cmds\\\"\n\t\t  else\n\t\t    # All subsequent reloadable object files will link in\n\t\t    # the last one created.\n\t\t    reload_objs=\"$objlist $last_robj\"\n\t\t    eval concat_cmds=\\\"\\$concat_cmds~$reload_cmds~\\$RM $last_robj\\\"\n\t\t  fi\n\t\t  last_robj=$output_objdir/$output_la-${k}.$objext\n\t\t  func_arith $k + 1\n\t\t  k=$func_arith_result\n\t\t  output=$output_objdir/$output_la-${k}.$objext\n\t\t  objlist=\" $obj\"\n\t\t  func_len \" $last_robj\"\n\t\t  func_arith $len0 + $func_len_result\n\t\t  len=$func_arith_result\n\t\tfi\n\t      done\n\t      # Handle the remaining objects by creating one last\n\t      # reloadable object file.  All subsequent reloadable object\n\t      # files will link in the last one created.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      reload_objs=\"$objlist $last_robj\"\n\t      eval concat_cmds=\\\"\\${concat_cmds}$reload_cmds\\\"\n\t      if test -n \"$last_robj\"; then\n\t        eval concat_cmds=\\\"\\${concat_cmds}~\\$RM $last_robj\\\"\n\t      fi\n\t      func_append delfiles \" $output\"\n\n\t    else\n\t      output=\n\t    fi\n\n\t    if ${skipped_export-false}; then\n\t      func_verbose \"generating symbol list for \\`$libname.la'\"\n\t      export_symbols=\"$output_objdir/$libname.exp\"\n\t      $opt_dry_run || $RM $export_symbols\n\t      libobjs=$output\n\t      # Append the command to create the export file.\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\$concat_cmds$export_symbols_cmds\\\"\n\t      if test -n \"$last_robj\"; then\n\t\teval concat_cmds=\\\"\\$concat_cmds~\\$RM $last_robj\\\"\n\t      fi\n\t    fi\n\n\t    test -n \"$save_libobjs\" &&\n\t      func_verbose \"creating a temporary reloadable object file: $output\"\n\n\t    # Loop through the commands generated above and execute them.\n\t    save_ifs=\"$IFS\"; IFS='~'\n\t    for cmd in $concat_cmds; do\n\t      IFS=\"$save_ifs\"\n\t      $opt_silent || {\n\t\t  func_quote_for_expand \"$cmd\"\n\t\t  eval \"func_echo $func_quote_for_expand_result\"\n\t      }\n\t      $opt_dry_run || eval \"$cmd\" || {\n\t\tlt_exit=$?\n\n\t\t# Restore the uninstalled library and exit\n\t\tif test \"$opt_mode\" = relink; then\n\t\t  ( cd \"$output_objdir\" && \\\n\t\t    $RM \"${realname}T\" && \\\n\t\t    $MV \"${realname}U\" \"$realname\" )\n\t\tfi\n\n\t\texit $lt_exit\n\t      }\n\t    done\n\t    IFS=\"$save_ifs\"\n\n\t    if test -n \"$export_symbols_regex\" && ${skipped_export-false}; then\n\t      func_show_eval '$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"'\n\t      func_show_eval '$MV \"${export_symbols}T\" \"$export_symbols\"'\n\t    fi\n\t  fi\n\n          if ${skipped_export-false}; then\n\t    if test -n \"$export_symbols\" && test -n \"$include_expsyms\"; then\n\t      tmp_export_symbols=\"$export_symbols\"\n\t      test -n \"$orig_export_symbols\" && tmp_export_symbols=\"$orig_export_symbols\"\n\t      $opt_dry_run || eval '$ECHO \"$include_expsyms\" | $SP2NL >> \"$tmp_export_symbols\"'\n\t    fi\n\n\t    if test -n \"$orig_export_symbols\"; then\n\t      # The given exports_symbols file has to be filtered, so filter it.\n\t      func_verbose \"filter symbol list for \\`$libname.la' to tag DATA exports\"\n\t      # FIXME: $output_objdir/$libname.filter potentially contains lots of\n\t      # 's' commands which not all seds can handle. GNU sed should be fine\n\t      # though. Also, the filter scales superlinearly with the number of\n\t      # global variables. join(1) would be nice here, but unfortunately\n\t      # isn't a blessed tool.\n\t      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\\(.*\\)\\([ \\,].*\\),s|^\\1$|\\1\\2|,' < $export_symbols > $output_objdir/$libname.filter\n\t      func_append delfiles \" $export_symbols $output_objdir/$libname.filter\"\n\t      export_symbols=$output_objdir/$libname.def\n\t      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols\n\t    fi\n\t  fi\n\n\t  libobjs=$output\n\t  # Restore the value of output.\n\t  output=$save_output\n\n\t  if test -n \"$convenience\" && test -n \"$whole_archive_flag_spec\"; then\n\t    eval libobjs=\\\"\\$libobjs $whole_archive_flag_spec\\\"\n\t    test \"X$libobjs\" = \"X \" && libobjs=\n\t  fi\n\t  # Expand the library linking commands again to reset the\n\t  # value of $libobjs for piecewise linking.\n\n\t  # Do each of the archive commands.\n\t  if test \"$module\" = yes && test -n \"$module_cmds\" ; then\n\t    if test -n \"$export_symbols\" && test -n \"$module_expsym_cmds\"; then\n\t      cmds=$module_expsym_cmds\n\t    else\n\t      cmds=$module_cmds\n\t    fi\n\t  else\n\t    if test -n \"$export_symbols\" && test -n \"$archive_expsym_cmds\"; then\n\t      cmds=$archive_expsym_cmds\n\t    else\n\t      cmds=$archive_cmds\n\t    fi\n\t  fi\n\tfi\n\n\tif test -n \"$delfiles\"; then\n\t  # Append the command to remove temporary files to $cmds.\n\t  eval cmds=\\\"\\$cmds~\\$RM $delfiles\\\"\n\tfi\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  func_append libobjs \" $func_extract_archives_result\"\n\t  test \"X$libobjs\" = \"X \" && libobjs=\n\tfi\n\n\tsave_ifs=\"$IFS\"; IFS='~'\n\tfor cmd in $cmds; do\n\t  IFS=\"$save_ifs\"\n\t  eval cmd=\\\"$cmd\\\"\n\t  $opt_silent || {\n\t    func_quote_for_expand \"$cmd\"\n\t    eval \"func_echo $func_quote_for_expand_result\"\n\t  }\n\t  $opt_dry_run || eval \"$cmd\" || {\n\t    lt_exit=$?\n\n\t    # Restore the uninstalled library and exit\n\t    if test \"$opt_mode\" = relink; then\n\t      ( cd \"$output_objdir\" && \\\n\t        $RM \"${realname}T\" && \\\n\t\t$MV \"${realname}U\" \"$realname\" )\n\t    fi\n\n\t    exit $lt_exit\n\t  }\n\tdone\n\tIFS=\"$save_ifs\"\n\n\t# Restore the uninstalled library and exit\n\tif test \"$opt_mode\" = relink; then\n\t  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?\n\n\t  if test -n \"$convenience\"; then\n\t    if test -z \"$whole_archive_flag_spec\"; then\n\t      func_show_eval '${RM}r \"$gentop\"'\n\t    fi\n\t  fi\n\n\t  exit $EXIT_SUCCESS\n\tfi\n\n\t# Create links to the real library.\n\tfor linkname in $linknames; do\n\t  if test \"$realname\" != \"$linkname\"; then\n\t    func_show_eval '(cd \"$output_objdir\" && $RM \"$linkname\" && $LN_S \"$realname\" \"$linkname\")' 'exit $?'\n\t  fi\n\tdone\n\n\t# If -module or -export-dynamic was specified, set the dlname.\n\tif test \"$module\" = yes || test \"$export_dynamic\" = yes; then\n\t  # On all known operating systems, these are identical.\n\t  dlname=\"$soname\"\n\tfi\n      fi\n      ;;\n\n    obj)\n      if test -n \"$dlfiles$dlprefiles\" || test \"$dlself\" != no; then\n\tfunc_warning \"\\`-dlopen' is ignored for objects\"\n      fi\n\n      case \" $deplibs\" in\n      *\\ -l* | *\\ -L*)\n\tfunc_warning \"\\`-l' and \\`-L' are ignored for objects\" ;;\n      esac\n\n      test -n \"$rpath\" && \\\n\tfunc_warning \"\\`-rpath' is ignored for objects\"\n\n      test -n \"$xrpath\" && \\\n\tfunc_warning \"\\`-R' is ignored for objects\"\n\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for objects\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for objects\"\n\n      case $output in\n      *.lo)\n\ttest -n \"$objs$old_deplibs\" && \\\n\t  func_fatal_error \"cannot build library object \\`$output' from non-libtool objects\"\n\n\tlibobj=$output\n\tfunc_lo2o \"$libobj\"\n\tobj=$func_lo2o_result\n\t;;\n      *)\n\tlibobj=\n\tobj=\"$output\"\n\t;;\n      esac\n\n      # Delete the old objects.\n      $opt_dry_run || $RM $obj $libobj\n\n      # Objects from convenience libraries.  This assumes\n      # single-version convenience libraries.  Whenever we create\n      # different ones for PIC/non-PIC, this we'll have to duplicate\n      # the extraction.\n      reload_conv_objs=\n      gentop=\n      # reload_cmds runs $LD directly, so let us get rid of\n      # -Wl from whole_archive_flag_spec and hope we can get by with\n      # turning comma into space..\n      wl=\n\n      if test -n \"$convenience\"; then\n\tif test -n \"$whole_archive_flag_spec\"; then\n\t  eval tmp_whole_archive_flags=\\\"$whole_archive_flag_spec\\\"\n\t  reload_conv_objs=$reload_objs\\ `$ECHO \"$tmp_whole_archive_flags\" | $SED 's|,| |g'`\n\telse\n\t  gentop=\"$output_objdir/${obj}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $convenience\n\t  reload_conv_objs=\"$reload_objs $func_extract_archives_result\"\n\tfi\n      fi\n\n      # If we're not building shared, we need to use non_pic_objs\n      test \"$build_libtool_libs\" != yes && libobjs=\"$non_pic_objects\"\n\n      # Create the old-style object.\n      reload_objs=\"$objs$old_deplibs \"`$ECHO \"$libobjs\" | $SP2NL | $SED \"/\\.${libext}$/d; /\\.lib$/d; $lo2o\" | $NL2SP`\" $reload_conv_objs\" ### testsuite: skip nested quoting test\n\n      output=\"$obj\"\n      func_execute_cmds \"$reload_cmds\" 'exit $?'\n\n      # Exit if we aren't doing a library object file.\n      if test -z \"$libobj\"; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$build_libtool_libs\" != yes; then\n\tif test -n \"$gentop\"; then\n\t  func_show_eval '${RM}r \"$gentop\"'\n\tfi\n\n\t# Create an invalid libtool object if no PIC, so that we don't\n\t# accidentally link it into a program.\n\t# $show \"echo timestamp > $libobj\"\n\t# $opt_dry_run || eval \"echo timestamp > $libobj\" || exit $?\n\texit $EXIT_SUCCESS\n      fi\n\n      if test -n \"$pic_flag\" || test \"$pic_mode\" != default; then\n\t# Only do commands if we really have different PIC objects.\n\treload_objs=\"$libobjs $reload_conv_objs\"\n\toutput=\"$libobj\"\n\tfunc_execute_cmds \"$reload_cmds\" 'exit $?'\n      fi\n\n      if test -n \"$gentop\"; then\n\tfunc_show_eval '${RM}r \"$gentop\"'\n      fi\n\n      exit $EXIT_SUCCESS\n      ;;\n\n    prog)\n      case $host in\n\t*cygwin*) func_stripname '' '.exe' \"$output\"\n\t          output=$func_stripname_result.exe;;\n      esac\n      test -n \"$vinfo\" && \\\n\tfunc_warning \"\\`-version-info' is ignored for programs\"\n\n      test -n \"$release\" && \\\n\tfunc_warning \"\\`-release' is ignored for programs\"\n\n      test \"$preload\" = yes \\\n        && test \"$dlopen_support\" = unknown \\\n\t&& test \"$dlopen_self\" = unknown \\\n\t&& test \"$dlopen_self_static\" = unknown && \\\n\t  func_warning \"\\`LT_INIT([dlopen])' not used. Assuming no dlopen support.\"\n\n      case $host in\n      *-*-rhapsody* | *-*-darwin1.[012])\n\t# On Rhapsody replace the C library is the System framework\n\tcompile_deplibs=`$ECHO \" $compile_deplibs\" | $SED 's/ -lc / System.ltframework /'`\n\tfinalize_deplibs=`$ECHO \" $finalize_deplibs\" | $SED 's/ -lc / System.ltframework /'`\n\t;;\n      esac\n\n      case $host in\n      *-*-darwin*)\n\t# Don't allow lazy linking, it breaks C++ global constructors\n\t# But is supposedly fixed on 10.4 or later (yay!).\n\tif test \"$tagname\" = CXX ; then\n\t  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in\n\t    10.[0123])\n\t      func_append compile_command \" ${wl}-bind_at_load\"\n\t      func_append finalize_command \" ${wl}-bind_at_load\"\n\t    ;;\n\t  esac\n\tfi\n\t# Time to change all our \"foo.ltframework\" stuff back to \"-framework foo\"\n\tcompile_deplibs=`$ECHO \" $compile_deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\tfinalize_deplibs=`$ECHO \" $finalize_deplibs\" | $SED 's% \\([^ $]*\\).ltframework% -framework \\1%g'`\n\t;;\n      esac\n\n\n      # move library search paths that coincide with paths to not yet\n      # installed libraries to the beginning of the library search list\n      new_libs=\n      for path in $notinst_path; do\n\tcase \" $new_libs \" in\n\t*\" -L$path/$objdir \"*) ;;\n\t*)\n\t  case \" $compile_deplibs \" in\n\t  *\" -L$path/$objdir \"*)\n\t    func_append new_libs \" -L$path/$objdir\" ;;\n\t  esac\n\t  ;;\n\tesac\n      done\n      for deplib in $compile_deplibs; do\n\tcase $deplib in\n\t-L*)\n\t  case \" $new_libs \" in\n\t  *\" $deplib \"*) ;;\n\t  *) func_append new_libs \" $deplib\" ;;\n\t  esac\n\t  ;;\n\t*) func_append new_libs \" $deplib\" ;;\n\tesac\n      done\n      compile_deplibs=\"$new_libs\"\n\n\n      func_append compile_command \" $compile_deplibs\"\n      func_append finalize_command \" $finalize_deplibs\"\n\n      if test -n \"$rpath$xrpath\"; then\n\t# If the user specified any rpath flags, then add them.\n\tfor libdir in $rpath $xrpath; do\n\t  # This is the magic to use -rpath.\n\t  case \"$finalize_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_rpath \" $libdir\" ;;\n\t  esac\n\tdone\n      fi\n\n      # Now hardcode the library paths\n      rpath=\n      hardcode_libdirs=\n      for libdir in $compile_rpath $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\tfunc_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    func_append rpath \" $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append perm_rpath \" $libdir\" ;;\n\t  esac\n\tfi\n\tcase $host in\n\t*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)\n\t  testbindir=`${ECHO} \"$libdir\" | ${SED} -e 's*/lib$*/bin*'`\n\t  case :$dllsearchpath: in\n\t  *\":$libdir:\"*) ;;\n\t  ::) dllsearchpath=$libdir;;\n\t  *) func_append dllsearchpath \":$libdir\";;\n\t  esac\n\t  case :$dllsearchpath: in\n\t  *\":$testbindir:\"*) ;;\n\t  ::) dllsearchpath=$testbindir;;\n\t  *) func_append dllsearchpath \":$testbindir\";;\n\t  esac\n\t  ;;\n\tesac\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      compile_rpath=\"$rpath\"\n\n      rpath=\n      hardcode_libdirs=\n      for libdir in $finalize_rpath; do\n\tif test -n \"$hardcode_libdir_flag_spec\"; then\n\t  if test -n \"$hardcode_libdir_separator\"; then\n\t    if test -z \"$hardcode_libdirs\"; then\n\t      hardcode_libdirs=\"$libdir\"\n\t    else\n\t      # Just accumulate the unique libdirs.\n\t      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in\n\t      *\"$hardcode_libdir_separator$libdir$hardcode_libdir_separator\"*)\n\t\t;;\n\t      *)\n\t\tfunc_append hardcode_libdirs \"$hardcode_libdir_separator$libdir\"\n\t\t;;\n\t      esac\n\t    fi\n\t  else\n\t    eval flag=\\\"$hardcode_libdir_flag_spec\\\"\n\t    func_append rpath \" $flag\"\n\t  fi\n\telif test -n \"$runpath_var\"; then\n\t  case \"$finalize_perm_rpath \" in\n\t  *\" $libdir \"*) ;;\n\t  *) func_append finalize_perm_rpath \" $libdir\" ;;\n\t  esac\n\tfi\n      done\n      # Substitute the hardcoded libdirs into the rpath.\n      if test -n \"$hardcode_libdir_separator\" &&\n\t test -n \"$hardcode_libdirs\"; then\n\tlibdir=\"$hardcode_libdirs\"\n\teval rpath=\\\" $hardcode_libdir_flag_spec\\\"\n      fi\n      finalize_rpath=\"$rpath\"\n\n      if test -n \"$libobjs\" && test \"$build_old_libs\" = yes; then\n\t# Transform all the library objects into standard objects.\n\tcompile_command=`$ECHO \"$compile_command\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n\tfinalize_command=`$ECHO \"$finalize_command\" | $SP2NL | $SED \"$lo2o\" | $NL2SP`\n      fi\n\n      func_generate_dlsyms \"$outputname\" \"@PROGRAM@\" \"no\"\n\n      # template prelinking step\n      if test -n \"$prelink_cmds\"; then\n\tfunc_execute_cmds \"$prelink_cmds\" 'exit $?'\n      fi\n\n      wrappers_required=yes\n      case $host in\n      *cegcc* | *mingw32ce*)\n        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.\n        wrappers_required=no\n        ;;\n      *cygwin* | *mingw* )\n        if test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      *)\n        if test \"$need_relink\" = no || test \"$build_libtool_libs\" != yes; then\n          wrappers_required=no\n        fi\n        ;;\n      esac\n      if test \"$wrappers_required\" = no; then\n\t# Replace the output file specification.\n\tcompile_command=`$ECHO \"$compile_command\" | $SED 's%@OUTPUT@%'\"$output\"'%g'`\n\tlink_command=\"$compile_command$compile_rpath\"\n\n\t# We have no uninstalled library dependencies, so finalize right now.\n\texit_status=0\n\tfunc_show_eval \"$link_command\" 'exit_status=$?'\n\n\tif test -n \"$postlink_cmds\"; then\n\t  func_to_tool_file \"$output\"\n\t  postlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\t  func_execute_cmds \"$postlink_cmds\" 'exit $?'\n\tfi\n\n\t# Delete the generated files.\n\tif test -f \"$output_objdir/${outputname}S.${objext}\"; then\n\t  func_show_eval '$RM \"$output_objdir/${outputname}S.${objext}\"'\n\tfi\n\n\texit $exit_status\n      fi\n\n      if test -n \"$compile_shlibpath$finalize_shlibpath\"; then\n\tcompile_command=\"$shlibpath_var=\\\"$compile_shlibpath$finalize_shlibpath\\$$shlibpath_var\\\" $compile_command\"\n      fi\n      if test -n \"$finalize_shlibpath\"; then\n\tfinalize_command=\"$shlibpath_var=\\\"$finalize_shlibpath\\$$shlibpath_var\\\" $finalize_command\"\n      fi\n\n      compile_var=\n      finalize_var=\n      if test -n \"$runpath_var\"; then\n\tif test -n \"$perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $perm_rpath; do\n\t    func_append rpath \"$dir:\"\n\t  done\n\t  compile_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n\tif test -n \"$finalize_perm_rpath\"; then\n\t  # We should set the runpath_var.\n\t  rpath=\n\t  for dir in $finalize_perm_rpath; do\n\t    func_append rpath \"$dir:\"\n\t  done\n\t  finalize_var=\"$runpath_var=\\\"$rpath\\$$runpath_var\\\" \"\n\tfi\n      fi\n\n      if test \"$no_install\" = yes; then\n\t# We don't need to create a wrapper script.\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\t# Replace the output file specification.\n\tlink_command=`$ECHO \"$link_command\" | $SED 's%@OUTPUT@%'\"$output\"'%g'`\n\t# Delete the old output file.\n\t$opt_dry_run || $RM $output\n\t# Link the executable and exit\n\tfunc_show_eval \"$link_command\" 'exit $?'\n\n\tif test -n \"$postlink_cmds\"; then\n\t  func_to_tool_file \"$output\"\n\t  postlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\t  func_execute_cmds \"$postlink_cmds\" 'exit $?'\n\tfi\n\n\texit $EXIT_SUCCESS\n      fi\n\n      if test \"$hardcode_action\" = relink; then\n\t# Fast installation is not supported\n\tlink_command=\"$compile_var$compile_command$compile_rpath\"\n\trelink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\n\tfunc_warning \"this platform does not like uninstalled shared libraries\"\n\tfunc_warning \"\\`$output' will be relinked during installation\"\n      else\n\tif test \"$fast_install\" != no; then\n\t  link_command=\"$finalize_var$compile_command$finalize_rpath\"\n\t  if test \"$fast_install\" = yes; then\n\t    relink_command=`$ECHO \"$compile_var$compile_command$compile_rpath\" | $SED 's%@OUTPUT@%\\$progdir/\\$file%g'`\n\t  else\n\t    # fast_install is set to needless\n\t    relink_command=\n\t  fi\n\telse\n\t  link_command=\"$compile_var$compile_command$compile_rpath\"\n\t  relink_command=\"$finalize_var$finalize_command$finalize_rpath\"\n\tfi\n      fi\n\n      # Replace the output file specification.\n      link_command=`$ECHO \"$link_command\" | $SED 's%@OUTPUT@%'\"$output_objdir/$outputname\"'%g'`\n\n      # Delete the old output files.\n      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname\n\n      func_show_eval \"$link_command\" 'exit $?'\n\n      if test -n \"$postlink_cmds\"; then\n\tfunc_to_tool_file \"$output_objdir/$outputname\"\n\tpostlink_cmds=`func_echo_all \"$postlink_cmds\" | $SED -e 's%@OUTPUT@%'\"$output_objdir/$outputname\"'%g' -e 's%@TOOL_OUTPUT@%'\"$func_to_tool_file_result\"'%g'`\n\tfunc_execute_cmds \"$postlink_cmds\" 'exit $?'\n      fi\n\n      # Now create the wrapper script.\n      func_verbose \"creating $output\"\n\n      # Quote the relink command for shipping.\n      if test -n \"$relink_command\"; then\n\t# Preserve any variables that may affect compiler behavior\n\tfor var in $variables_saved_for_relink; do\n\t  if eval test -z \\\"\\${$var+set}\\\"; then\n\t    relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\t  elif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t    relink_command=\"$var=; export $var; $relink_command\"\n\t  else\n\t    func_quote_for_eval \"$var_value\"\n\t    relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\t  fi\n\tdone\n\trelink_command=\"(cd `pwd`; $relink_command)\"\n\trelink_command=`$ECHO \"$relink_command\" | $SED \"$sed_quote_subst\"`\n      fi\n\n      # Only actually do things if not in dry run mode.\n      $opt_dry_run || {\n\t# win32 will think the script is a binary if it has\n\t# a .exe suffix, so we strip it off here.\n\tcase $output in\n\t  *.exe) func_stripname '' '.exe' \"$output\"\n\t         output=$func_stripname_result ;;\n\tesac\n\t# test for cygwin because mv fails w/o .exe extensions\n\tcase $host in\n\t  *cygwin*)\n\t    exeext=.exe\n\t    func_stripname '' '.exe' \"$outputname\"\n\t    outputname=$func_stripname_result ;;\n\t  *) exeext= ;;\n\tesac\n\tcase $host in\n\t  *cygwin* | *mingw* )\n\t    func_dirname_and_basename \"$output\" \"\" \".\"\n\t    output_name=$func_basename_result\n\t    output_path=$func_dirname_result\n\t    cwrappersource=\"$output_path/$objdir/lt-$output_name.c\"\n\t    cwrapper=\"$output_path/$output_name.exe\"\n\t    $RM $cwrappersource $cwrapper\n\t    trap \"$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_cwrapperexe_src > $cwrappersource\n\n\t    # The wrapper executable is built using the $host compiler,\n\t    # because it contains $host paths and files. If cross-\n\t    # compiling, it, like the target executable, must be\n\t    # executed on the $host or under an emulation environment.\n\t    $opt_dry_run || {\n\t      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource\n\t      $STRIP $cwrapper\n\t    }\n\n\t    # Now, create the wrapper script for func_source use:\n\t    func_ltwrapper_scriptname $cwrapper\n\t    $RM $func_ltwrapper_scriptname_result\n\t    trap \"$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE\" 1 2 15\n\t    $opt_dry_run || {\n\t      # note: this script will not be executed, so do not chmod.\n\t      if test \"x$build\" = \"x$host\" ; then\n\t\t$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result\n\t      else\n\t\tfunc_emit_wrapper no > $func_ltwrapper_scriptname_result\n\t      fi\n\t    }\n\t  ;;\n\t  * )\n\t    $RM $output\n\t    trap \"$RM $output; exit $EXIT_FAILURE\" 1 2 15\n\n\t    func_emit_wrapper no > $output\n\t    chmod +x $output\n\t  ;;\n\tesac\n      }\n      exit $EXIT_SUCCESS\n      ;;\n    esac\n\n    # See if we need to build an old-fashioned archive.\n    for oldlib in $oldlibs; do\n\n      if test \"$build_libtool_libs\" = convenience; then\n\toldobjs=\"$libobjs_save $symfileobj\"\n\taddlibs=\"$convenience\"\n\tbuild_libtool_libs=no\n      else\n\tif test \"$build_libtool_libs\" = module; then\n\t  oldobjs=\"$libobjs_save\"\n\t  build_libtool_libs=no\n\telse\n\t  oldobjs=\"$old_deplibs $non_pic_objects\"\n\t  if test \"$preload\" = yes && test -f \"$symfileobj\"; then\n\t    func_append oldobjs \" $symfileobj\"\n\t  fi\n\tfi\n\taddlibs=\"$old_convenience\"\n      fi\n\n      if test -n \"$addlibs\"; then\n\tgentop=\"$output_objdir/${outputname}x\"\n\tfunc_append generated \" $gentop\"\n\n\tfunc_extract_archives $gentop $addlibs\n\tfunc_append oldobjs \" $func_extract_archives_result\"\n      fi\n\n      # Do each command in the archive commands.\n      if test -n \"$old_archive_from_new_cmds\" && test \"$build_libtool_libs\" = yes; then\n\tcmds=$old_archive_from_new_cmds\n      else\n\n\t# Add any objects from preloaded convenience libraries\n\tif test -n \"$dlprefiles\"; then\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\n\t  func_extract_archives $gentop $dlprefiles\n\t  func_append oldobjs \" $func_extract_archives_result\"\n\tfi\n\n\t# POSIX demands no paths to be encoded in archives.  We have\n\t# to avoid creating archives with duplicate basenames if we\n\t# might have to extract them afterwards, e.g., when creating a\n\t# static archive out of a convenience library, or when linking\n\t# the entirety of a libtool archive into another (currently\n\t# not supported by libtool).\n\tif (for obj in $oldobjs\n\t    do\n\t      func_basename \"$obj\"\n\t      $ECHO \"$func_basename_result\"\n\t    done | sort | sort -uc >/dev/null 2>&1); then\n\t  :\n\telse\n\t  echo \"copying selected object files to avoid basename conflicts...\"\n\t  gentop=\"$output_objdir/${outputname}x\"\n\t  func_append generated \" $gentop\"\n\t  func_mkdir_p \"$gentop\"\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  counter=1\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_basename \"$obj\"\n\t    objbase=\"$func_basename_result\"\n\t    case \" $oldobjs \" in\n\t    \" \") oldobjs=$obj ;;\n\t    *[\\ /]\"$objbase \"*)\n\t      while :; do\n\t\t# Make sure we don't pick an alternate name that also\n\t\t# overlaps.\n\t\tnewobj=lt$counter-$objbase\n\t\tfunc_arith $counter + 1\n\t\tcounter=$func_arith_result\n\t\tcase \" $oldobjs \" in\n\t\t*[\\ /]\"$newobj \"*) ;;\n\t\t*) if test ! -f \"$gentop/$newobj\"; then break; fi ;;\n\t\tesac\n\t      done\n\t      func_show_eval \"ln $obj $gentop/$newobj || cp $obj $gentop/$newobj\"\n\t      func_append oldobjs \" $gentop/$newobj\"\n\t      ;;\n\t    *) func_append oldobjs \" $obj\" ;;\n\t    esac\n\t  done\n\tfi\n\teval cmds=\\\"$old_archive_cmds\\\"\n\n\tfunc_len \" $cmds\"\n\tlen=$func_len_result\n\tif test \"$len\" -lt \"$max_cmd_len\" || test \"$max_cmd_len\" -le -1; then\n\t  cmds=$old_archive_cmds\n\telif test -n \"$archiver_list_spec\"; then\n\t  func_verbose \"using command file archive linking...\"\n\t  for obj in $oldobjs\n\t  do\n\t    func_to_tool_file \"$obj\"\n\t    $ECHO \"$func_to_tool_file_result\"\n\t  done > $output_objdir/$libname.libcmd\n\t  func_to_tool_file \"$output_objdir/$libname.libcmd\"\n\t  oldobjs=\" $archiver_list_spec$func_to_tool_file_result\"\n\t  cmds=$old_archive_cmds\n\telse\n\t  # the command line is too long to link in one step, link in parts\n\t  func_verbose \"using piecewise archive linking...\"\n\t  save_RANLIB=$RANLIB\n\t  RANLIB=:\n\t  objlist=\n\t  concat_cmds=\n\t  save_oldobjs=$oldobjs\n\t  oldobjs=\n\t  # Is there a better way of finding the last object in the list?\n\t  for obj in $save_oldobjs\n\t  do\n\t    last_oldobj=$obj\n\t  done\n\t  eval test_cmds=\\\"$old_archive_cmds\\\"\n\t  func_len \" $test_cmds\"\n\t  len0=$func_len_result\n\t  len=$len0\n\t  for obj in $save_oldobjs\n\t  do\n\t    func_len \" $obj\"\n\t    func_arith $len + $func_len_result\n\t    len=$func_arith_result\n\t    func_append objlist \" $obj\"\n\t    if test \"$len\" -lt \"$max_cmd_len\"; then\n\t      :\n\t    else\n\t      # the above command should be used before it gets too long\n\t      oldobjs=$objlist\n\t      if test \"$obj\" = \"$last_oldobj\" ; then\n\t\tRANLIB=$save_RANLIB\n\t      fi\n\t      test -z \"$concat_cmds\" || concat_cmds=$concat_cmds~\n\t      eval concat_cmds=\\\"\\${concat_cmds}$old_archive_cmds\\\"\n\t      objlist=\n\t      len=$len0\n\t    fi\n\t  done\n\t  RANLIB=$save_RANLIB\n\t  oldobjs=$objlist\n\t  if test \"X$oldobjs\" = \"X\" ; then\n\t    eval cmds=\\\"\\$concat_cmds\\\"\n\t  else\n\t    eval cmds=\\\"\\$concat_cmds~\\$old_archive_cmds\\\"\n\t  fi\n\tfi\n      fi\n      func_execute_cmds \"$cmds\" 'exit $?'\n    done\n\n    test -n \"$generated\" && \\\n      func_show_eval \"${RM}r$generated\"\n\n    # Now create the libtool archive.\n    case $output in\n    *.la)\n      old_library=\n      test \"$build_old_libs\" = yes && old_library=\"$libname.$libext\"\n      func_verbose \"creating $output\"\n\n      # Preserve any variables that may affect compiler behavior\n      for var in $variables_saved_for_relink; do\n\tif eval test -z \\\"\\${$var+set}\\\"; then\n\t  relink_command=\"{ test -z \\\"\\${$var+set}\\\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command\"\n\telif eval var_value=\\$$var; test -z \"$var_value\"; then\n\t  relink_command=\"$var=; export $var; $relink_command\"\n\telse\n\t  func_quote_for_eval \"$var_value\"\n\t  relink_command=\"$var=$func_quote_for_eval_result; export $var; $relink_command\"\n\tfi\n      done\n      # Quote the link command for shipping.\n      relink_command=\"(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)\"\n      relink_command=`$ECHO \"$relink_command\" | $SED \"$sed_quote_subst\"`\n      if test \"$hardcode_automatic\" = yes ; then\n\trelink_command=\n      fi\n\n      # Only create the output if not a dry run.\n      $opt_dry_run || {\n\tfor installed in no yes; do\n\t  if test \"$installed\" = yes; then\n\t    if test -z \"$install_libdir\"; then\n\t      break\n\t    fi\n\t    output=\"$output_objdir/$outputname\"i\n\t    # Replace all uninstalled libtool libraries with the installed ones\n\t    newdependency_libs=\n\t    for deplib in $dependency_libs; do\n\t      case $deplib in\n\t      *.la)\n\t\tfunc_basename \"$deplib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $deplib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$deplib' is not a valid libtool archive\"\n\t\tfunc_append newdependency_libs \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      -L*)\n\t\tfunc_stripname -L '' \"$deplib\"\n\t\tfunc_replace_sysroot \"$func_stripname_result\"\n\t\tfunc_append newdependency_libs \" -L$func_replace_sysroot_result\"\n\t\t;;\n\t      -R*)\n\t\tfunc_stripname -R '' \"$deplib\"\n\t\tfunc_replace_sysroot \"$func_stripname_result\"\n\t\tfunc_append newdependency_libs \" -R$func_replace_sysroot_result\"\n\t\t;;\n\t      *) func_append newdependency_libs \" $deplib\" ;;\n\t      esac\n\t    done\n\t    dependency_libs=\"$newdependency_libs\"\n\t    newdlfiles=\n\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t      *.la)\n\t        func_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tfunc_append newdlfiles \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      *) func_append newdlfiles \" $lib\" ;;\n\t      esac\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t      *.la)\n\t\t# Only pass preopened files to the pseudo-archive (for\n\t\t# eventual linking with the app. that links it) if we\n\t\t# didn't already link the preopened objects directly into\n\t\t# the library:\n\t\tfunc_basename \"$lib\"\n\t\tname=\"$func_basename_result\"\n\t\teval libdir=`${SED} -n -e 's/^libdir=\\(.*\\)$/\\1/p' $lib`\n\t\ttest -z \"$libdir\" && \\\n\t\t  func_fatal_error \"\\`$lib' is not a valid libtool archive\"\n\t\tfunc_append newdlprefiles \" ${lt_sysroot:+=}$libdir/$name\"\n\t\t;;\n\t      esac\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  else\n\t    newdlfiles=\n\t    for lib in $dlfiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      func_append newdlfiles \" $abs\"\n\t    done\n\t    dlfiles=\"$newdlfiles\"\n\t    newdlprefiles=\n\t    for lib in $dlprefiles; do\n\t      case $lib in\n\t\t[\\\\/]* | [A-Za-z]:[\\\\/]*) abs=\"$lib\" ;;\n\t\t*) abs=`pwd`\"/$lib\" ;;\n\t      esac\n\t      func_append newdlprefiles \" $abs\"\n\t    done\n\t    dlprefiles=\"$newdlprefiles\"\n\t  fi\n\t  $RM $output\n\t  # place dlname in correct position for cygwin\n\t  # In fact, it would be nice if we could use this code for all target\n\t  # systems that can't hard-code library paths into their executables\n\t  # and that have no shared library path variable independent of PATH,\n\t  # but it turns out we can't easily determine that from inspecting\n\t  # libtool variables, so we have to hard-code the OSs to which it\n\t  # applies here; at the moment, that means platforms that use the PE\n\t  # object format with DLL files.  See the long comment at the top of\n\t  # tests/bindir.at for full details.\n\t  tdlname=$dlname\n\t  case $host,$output,$installed,$module,$dlname in\n\t    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)\n\t      # If a -bindir argument was supplied, place the dll there.\n\t      if test \"x$bindir\" != x ;\n\t      then\n\t\tfunc_relative_path \"$install_libdir\" \"$bindir\"\n\t\ttdlname=$func_relative_path_result$dlname\n\t      else\n\t\t# Otherwise fall back on heuristic.\n\t\ttdlname=../bin/$dlname\n\t      fi\n\t      ;;\n\t  esac\n\t  $ECHO > $output \"\\\n# $outputname - a libtool library file\n# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION\n#\n# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n# The name that we can dlopen(3).\ndlname='$tdlname'\n\n# Names of this library.\nlibrary_names='$library_names'\n\n# The name of the static archive.\nold_library='$old_library'\n\n# Linker flags that can not go in dependency_libs.\ninherited_linker_flags='$new_inherited_linker_flags'\n\n# Libraries that this one depends upon.\ndependency_libs='$dependency_libs'\n\n# Names of additional weak libraries provided by this library\nweak_library_names='$weak_libs'\n\n# Version information for $libname.\ncurrent=$current\nage=$age\nrevision=$revision\n\n# Is this an already installed library?\ninstalled=$installed\n\n# Should we warn about portability when linking against -modules?\nshouldnotlink=$module\n\n# Files to dlopen/dlpreopen\ndlopen='$dlfiles'\ndlpreopen='$dlprefiles'\n\n# Directory that this library needs to be installed in:\nlibdir='$install_libdir'\"\n\t  if test \"$installed\" = no && test \"$need_relink\" = yes; then\n\t    $ECHO >> $output \"\\\nrelink_command=\\\"$relink_command\\\"\"\n\t  fi\n\tdone\n      }\n\n      # Do a symbolic link so that the libtool archive can be found in\n      # LD_LIBRARY_PATH before the program is installed.\n      func_show_eval '( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )' 'exit $?'\n      ;;\n    esac\n    exit $EXIT_SUCCESS\n}\n\n{ test \"$opt_mode\" = link || test \"$opt_mode\" = relink; } &&\n    func_mode_link ${1+\"$@\"}\n\n\n# func_mode_uninstall arg...\nfunc_mode_uninstall ()\n{\n    $opt_debug\n    RM=\"$nonopt\"\n    files=\n    rmforce=\n    exit_status=0\n\n    # This variable tells wrapper scripts just to set variables rather\n    # than running their programs.\n    libtool_install_magic=\"$magic\"\n\n    for arg\n    do\n      case $arg in\n      -f) func_append RM \" $arg\"; rmforce=yes ;;\n      -*) func_append RM \" $arg\" ;;\n      *) func_append files \" $arg\" ;;\n      esac\n    done\n\n    test -z \"$RM\" && \\\n      func_fatal_help \"you must specify an RM program\"\n\n    rmdirs=\n\n    for file in $files; do\n      func_dirname \"$file\" \"\" \".\"\n      dir=\"$func_dirname_result\"\n      if test \"X$dir\" = X.; then\n\todir=\"$objdir\"\n      else\n\todir=\"$dir/$objdir\"\n      fi\n      func_basename \"$file\"\n      name=\"$func_basename_result\"\n      test \"$opt_mode\" = uninstall && odir=\"$dir\"\n\n      # Remember odir for removal later, being careful to avoid duplicates\n      if test \"$opt_mode\" = clean; then\n\tcase \" $rmdirs \" in\n\t  *\" $odir \"*) ;;\n\t  *) func_append rmdirs \" $odir\" ;;\n\tesac\n      fi\n\n      # Don't error if the file doesn't exist and rm -f was used.\n      if { test -L \"$file\"; } >/dev/null 2>&1 ||\n\t { test -h \"$file\"; } >/dev/null 2>&1 ||\n\t test -f \"$file\"; then\n\t:\n      elif test -d \"$file\"; then\n\texit_status=1\n\tcontinue\n      elif test \"$rmforce\" = yes; then\n\tcontinue\n      fi\n\n      rmfiles=\"$file\"\n\n      case $name in\n      *.la)\n\t# Possibly a libtool archive, so verify it.\n\tif func_lalib_p \"$file\"; then\n\t  func_source $dir/$name\n\n\t  # Delete the libtool libraries and symlinks.\n\t  for n in $library_names; do\n\t    func_append rmfiles \" $odir/$n\"\n\t  done\n\t  test -n \"$old_library\" && func_append rmfiles \" $odir/$old_library\"\n\n\t  case \"$opt_mode\" in\n\t  clean)\n\t    case \" $library_names \" in\n\t    *\" $dlname \"*) ;;\n\t    *) test -n \"$dlname\" && func_append rmfiles \" $odir/$dlname\" ;;\n\t    esac\n\t    test -n \"$libdir\" && func_append rmfiles \" $odir/$name $odir/${name}i\"\n\t    ;;\n\t  uninstall)\n\t    if test -n \"$library_names\"; then\n\t      # Do each command in the postuninstall commands.\n\t      func_execute_cmds \"$postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\n\t    if test -n \"$old_library\"; then\n\t      # Do each command in the old_postuninstall commands.\n\t      func_execute_cmds \"$old_postuninstall_cmds\" 'test \"$rmforce\" = yes || exit_status=1'\n\t    fi\n\t    # FIXME: should reinstall the best remaining shared library.\n\t    ;;\n\t  esac\n\tfi\n\t;;\n\n      *.lo)\n\t# Possibly a libtool object, so verify it.\n\tif func_lalib_p \"$file\"; then\n\n\t  # Read the .lo file\n\t  func_source $dir/$name\n\n\t  # Add PIC object to the list of files to remove.\n\t  if test -n \"$pic_object\" &&\n\t     test \"$pic_object\" != none; then\n\t    func_append rmfiles \" $dir/$pic_object\"\n\t  fi\n\n\t  # Add non-PIC object to the list of files to remove.\n\t  if test -n \"$non_pic_object\" &&\n\t     test \"$non_pic_object\" != none; then\n\t    func_append rmfiles \" $dir/$non_pic_object\"\n\t  fi\n\tfi\n\t;;\n\n      *)\n\tif test \"$opt_mode\" = clean ; then\n\t  noexename=$name\n\t  case $file in\n\t  *.exe)\n\t    func_stripname '' '.exe' \"$file\"\n\t    file=$func_stripname_result\n\t    func_stripname '' '.exe' \"$name\"\n\t    noexename=$func_stripname_result\n\t    # $file with .exe has already been added to rmfiles,\n\t    # add $file without .exe\n\t    func_append rmfiles \" $file\"\n\t    ;;\n\t  esac\n\t  # Do a test to see if this is a libtool program.\n\t  if func_ltwrapper_p \"$file\"; then\n\t    if func_ltwrapper_executable_p \"$file\"; then\n\t      func_ltwrapper_scriptname \"$file\"\n\t      relink_command=\n\t      func_source $func_ltwrapper_scriptname_result\n\t      func_append rmfiles \" $func_ltwrapper_scriptname_result\"\n\t    else\n\t      relink_command=\n\t      func_source $dir/$noexename\n\t    fi\n\n\t    # note $name still contains .exe if it was in $file originally\n\t    # as does the version of $file that was added into $rmfiles\n\t    func_append rmfiles \" $odir/$name $odir/${name}S.${objext}\"\n\t    if test \"$fast_install\" = yes && test -n \"$relink_command\"; then\n\t      func_append rmfiles \" $odir/lt-$name\"\n\t    fi\n\t    if test \"X$noexename\" != \"X$name\" ; then\n\t      func_append rmfiles \" $odir/lt-${noexename}.c\"\n\t    fi\n\t  fi\n\tfi\n\t;;\n      esac\n      func_show_eval \"$RM $rmfiles\" 'exit_status=1'\n    done\n\n    # Try to remove the ${objdir}s in the directories where we deleted files\n    for dir in $rmdirs; do\n      if test -d \"$dir\"; then\n\tfunc_show_eval \"rmdir $dir >/dev/null 2>&1\"\n      fi\n    done\n\n    exit $exit_status\n}\n\n{ test \"$opt_mode\" = uninstall || test \"$opt_mode\" = clean; } &&\n    func_mode_uninstall ${1+\"$@\"}\n\ntest -z \"$opt_mode\" && {\n  help=\"$generic_help\"\n  func_fatal_help \"you must specify a MODE\"\n}\n\ntest -z \"$exec_cmd\" && \\\n  func_fatal_help \"invalid operation mode \\`$opt_mode'\"\n\nif test -n \"$exec_cmd\"; then\n  eval exec \"$exec_cmd\"\n  exit $EXIT_FAILURE\nfi\n\nexit $exit_status\n\n\n# The TAGs below are defined such that we never get into a situation\n# in which we disable both kinds of libraries.  Given conflicting\n# choices, we go for a static library, that is the most portable,\n# since we can't tell whether shared libraries were disabled because\n# the user asked for that or because the platform doesn't support\n# them.  This is particularly important on AIX, because we don't\n# support having both static and shared libraries enabled at the same\n# time on that platform, so we default to a shared-only configuration.\n# If a disable-shared tag is given, we'll fallback to a static-only\n# configuration.  But we'll never go from static-only to shared-only.\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-shared\nbuild_libtool_libs=no\nbuild_old_libs=yes\n# ### END LIBTOOL TAG CONFIG: disable-shared\n\n# ### BEGIN LIBTOOL TAG CONFIG: disable-static\nbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`\n# ### END LIBTOOL TAG CONFIG: disable-static\n\n# Local Variables:\n# mode:shell-script\n# sh-indentation:2\n# End:\n# vi:sw=2\n\n"},{"id":13608,"name":"wcshdr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcshdr.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* 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*        free'd 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, and III are recognized, and also those used by the\n* AIPS convention and certain other keywords that existed in early drafts of\n* the WCS papers as explained in wcsbth() note 5.\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.\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 the basic keywords\n*                              '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'.\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*   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, and III are recognized, and also\n* those used by the AIPS convention and certain other keywords that existed in\n* 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 the basic keywords\n*                              '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'.\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 and III that are not parameterized by axis\n*      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_EPOCHa:  Accept EPOCHa.\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_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_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_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_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*\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*      - WCSHDR_CNAMn (wcsbth() only): Accept iCNAMn, iCRDEn, iCSYEn, TCNAMn,\n*              TCRDEn, and TCSYEn, i.e. with \"a\" blank.  While non-standard,\n*              these are the obvious analogues 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#                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\n*              that provide auxiliary information that is simply stored in\n*              the wcsprm 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\n*              values 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\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 the only potential difficulty\n*              in using WCSHDR_AUXIMG is that of erroneously inheriting one\n*              of these four 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, such as\n*              CTYPEia, that are parameterized by axis number.\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 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\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.\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.\n*\n*      In the absence of a formal mechanism for identifying the columns\n*      containing pixel coordinates (as opposed to pixel values or ancillary\n*      data recorded at the time the photon or neutrino was detected),\n*      Paper I discusses how the WCS keywords themselves may be used to\n*      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\n*      list convention is also silent on the method to be used to associate\n*      table columns with image axes.\n*\n*      wcsbth() simply collects all WCS keywords for a particular coordinate\n*      representation (i.e. the \"a\" value in TCTYna) into one wcsprm struct.\n*      However, these alternates need not be associated with the same table\n*      columns and this allows a pixel list to contain up to 27 separate\n*      images.  As usual, if one of these representations happened to contain\n*      more than two celestial axes, for example, then an error would result\n*      when wcsset() is invoked on it.  In this case the \"colsel\" argument\n*      could be used to restrict the columns used to construct the\n*      representation so that it only contained one pair of celestial axes.\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 wcs.h) to assist in extracting the required arrays from the\n* 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 free'd 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 free'd 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*   - Deprecated (e.g. CROTAn) or non-standard usage will be translated to\n*     standard (this is partially dependent on whether wcsfix() was applied).\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*   - 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*   - Additional keywords such as WCSAXESa, CUNITia, LONPOLEa and LATPOLEa may\n*     appear.\n*\n*   - The original keycomments will be lost, although wcshdo() tries hard to\n*     write meaningful comments.\n*\n*   - Keyword order may 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 free'd by the user to avoid memory leaks.\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*   wcshdo() interprets the \"relax\" argument as a vector of flag bits to\n*   provide fine-grained control over what non-standard WCS keywords to write.\n*   The flag bits are subject to change in future and should be set by using\n*   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 each\n*           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 for\n*           use in binary tables and pixel lists.  WCS Paper III introduced\n*           DATE-AVG and DAVGn but by an oversight DOBSn (the obvious analogy)\n*           was never formally defined by the standard.  The alternative to\n*           using DOBSn is to write DATE-OBS which applies to the whole table.\n*           This usage is 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 the\n*           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 and\n*           subsequently the errata for the WCS papers legitimized the use 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 bintables and\n*           - TCRPXn, TCDLTn, TCUNIn, TCTYPn, and TCRVLn for 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 bintables and\n*           - TCRPna, TCDEna, TCUNna, TCTYna and TCRVna for pixel lists\n*\n*           for use with an alternate version specifier (the \"a\").  Like the\n*           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 very\n*           unlikely that any parser would reject keywords in the first set\n*           with a non-blank alternate version specifier so this usage is\n*           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: In light of wcsbth() note 4, write WCSNna instead of\n*           TWCSna for pixel lists.  While wcsbth() treats WCSNna and TWCSna\n*           as equivalent, other parsers may not.  Consequently, this usage\n*           is potentially unsafe and is not recommended at this 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_EPOCHa   0x00000002\n#define WCSHDR_VELREFa  0x00000004\n#define WCSHDR_CD00i00j 0x00000008\n#define WCSHDR_PC00i00j 0x00000010\n#define WCSHDR_PROJPn   0x00000020\n#define WCSHDR_CD0i_0ja 0x00000040\n#define WCSHDR_PC0i_0ja 0x00000080\n#define WCSHDR_PV0i_0ma 0x00000100\n#define WCSHDR_PS0i_0ma 0x00000200\n#define WCSHDR_RADECSYS 0x00000400\n#define WCSHDR_VSOURCE  0x00000800\n#define WCSHDR_DOBSn    0x00001000\n#define WCSHDR_LONGKEY  0x00002000\n#define WCSHDR_CNAMn    0x00004000\n#define WCSHDR_AUXIMG   0x00008000\n#define WCSHDR_ALLIMG   0x00010000\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 relax, struct wcsprm *wcs, int *nkeyrec, char **header);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* WCSLIB_WCSHDR */\n"},{"attributeType":"null","col":26,"comment":"null","endLoc":18,"id":13609,"name":"_config","nodeType":"Attribute","startLoc":18,"text":"_config"},{"attributeType":"Conf","col":0,"comment":"null","endLoc":38,"id":13610,"name":"conf","nodeType":"Attribute","startLoc":38,"text":"conf"},{"id":13611,"name":"cel.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: cel.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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, 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* 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* 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* 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 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":13612,"name":"getwcstab.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: getwcstab.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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*   In order to maintain WCSLIB and CFITSIO as independent libraries it is not\n*   permissible for any CFITSIO library code to include WCSLIB header files,\n*   or vice versa.  However, the CFITSIO function fits_read_wcstab() accepts\n*   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 not\n*   always) be included together with fitsio.h in an applications program that\n*   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 type\n*   without conflict by virtue of the fact that structure tags and typedef\n*   names share different name spaces in C; Appendix A, Sect. A11.1 (p227) of\n*   the K&R ANSI edition states that:\n*\n*     Identifiers fall into several name spaces that do not interfere with one\n*     another; the same identifier may be used for different purposes, even in\n*     the same scope, if the uses are in different name spaces.  These classes\n*     are: objects, functions, typedef names, and enum constants; labels; tags\n*     of structures, unions, and enumerations; and members of each structure\n*     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 complicated\n*   by the fact that typedefs and structs share the same namespace; C++\n*   Annotated Reference Manual, Sect. 7.1.3 (p105).  In that case the wtbarr\n*   struct in wcs.h is renamed by preprocessor macro substitution to wtbarr_s\n*   to distinguish it from the typedef defined in fitsio.h.  However, the\n*   scope of this macro substitution is limited to wcs.h itself and CFITSIO\n*   programmer code, whether in C++ or C, should always use the wtbarr\n*   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":13613,"name":"sph.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: sph.c,v 5.17 2017/09/18 08:44:23 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":13614,"name":"wcstrig.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcstrig.c,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*===========================================================================*/\n\n#include <math.h>\n#include <stdlib.h>\n#include \"wcsmath.h\"\n#include \"wcstrig.h\"\n\ndouble cosd(angle)\n\ndouble 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(angle)\n\ndouble 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(angle)\n\ndouble 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(v)\n\ndouble 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(v)\n\ndouble 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(v)\n\ndouble 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(y, x)\n\ndouble x, y;\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":13615,"name":"wcsbth.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsbth.l,v 5.17 2017/09/18 08:44:23 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 noyywrap\n%option outfile=\"wcsbth.c\"\n%option prefix=\"wcsbth\"\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 STRING_VAL\n%x COMMENT DISCARD ERROR FLUSH\n\n%{\n#include <math.h>\n#include <setjmp.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 STRING  2\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/* Image header of either type.             */\n#define BIMGARR 0x4\t/* Binary table image array with axis       */\n\t\t\t/* number, e.g. iCTYna.                     */\n#define PIXLIST 0x8\t/* Pixel list, e.g. TCTYna.                 */\n#define BINTAB  0xC\t/* Shared binary table image array (without */\n\t\t\t/* axis number) or pixel list, e.g. LONPna  */\n\t\t\t/* or OBSGXn.                               */\n\n#define YY_DECL int wcsbth(char *header, int nkeyrec, int relax, int ctrl, \\\n                           int keysel, int *colsel, int *nreject, int *nwcs, \\\n\t\t\t   struct wcsprm **wcs)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (wcsbth_nkeyrec) { \\\n\t    strncpy(inbuff, wcsbth_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    wcsbth_hdr += 80; \\\n\t    wcsbth_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\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  itmp = strlen(strtmp); \\\n  while (itmp) unput(strtmp[--itmp]);\n\n/* These global variables are required by YY_INPUT. */\nchar *wcsbth_hdr;\nint  wcsbth_nkeyrec;\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsbth_abort_jmp_env;\n#define exit(status) longjmp(wcsbth_abort_jmp_env, status)\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\nint wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype,\n        struct wcsbth_alts *alts);\nint wcsbth_init1(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs);\n\nstruct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts,\n        int keytype, int n, char a);\nint wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a);\n\nint wcsbth_epoch(double *wptr, double epoch);\nint wcsbth_vsource(double *wptr, double vsource);\n\nint wcsbth_final(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs);\n\n%}\n\n%%\n\t/* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */\n\tchar a;\n\tint  i, j, k, m, n;\n\t\n\tchar *cptr, *errmsg, errtxt[80], exclude[1000], gotone, *hptr, *keep,\n\t     *keyname, *keyrec, ptype, strtmp[80];\n\tint  altlin, ialt, icol, incl, inttmp, ipass, ipx, itmp, ix, jx,\n\t     keytype, nother, nsel, npass, nvalid, status, valtype, voff;\n\tdouble dbltmp;\n\tvoid   *vptr, *wptr;\n\tstruct wcsbth_alts alts;\n\tstruct wcsprm *wcsp, wcstem;\n\tint (*special)(double *, double);\n\tint yylex_destroy(void);\n\t\n\t/* The data structures produced. */\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t/* Parameters used to implement YY_INPUT. */\n\twcsbth_hdr = header;\n\twcsbth_nkeyrec = nkeyrec;\n\t\n\t/* Our handle on the input stream. */\n\tkeyrec = header;\n\thptr = header;\n\tkeep = 0x0;\n\t\n\t/* For keeping tallies of keywords found. */\n\t*nreject = 0;\n\tnvalid = 0;\n\tnother = 0;\n\t\n\t/* If strict, then also reject. */\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t/* Keyword parameters. */\n\ti = j = 0;\n\tn = k = 0;\n\tm = 0;\n\ta = ' ';\n\t\n\t/* Header bookkeeping. */\n\talts.ncol = 0;\n\talts.arridx  = 0x0;\n\talts.pixlist = 0x0;\n\talts.npv = 0x0;\n\talts.nps = 0x0;\n\t\n\tfor (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\tkeytype =  0;\n\tvaltype = -1;\n\tvptr    = 0x0;\n\t\n\t/* For keywords that require special handling. */\n\taltlin  = 0;\n\tptype   = ' ';\n\tspecial = 0x0;\n\t\n\t/* Selection by column number. */\n\tnsel = colsel ? colsel[0] : 0;\n\tincl = (nsel > 0);\n\tfor (icol = 0; icol < 1000; icol++) {\n\t  exclude[icol] = incl;\n\t}\n\tfor (icol = 1; icol <= abs(nsel); icol++) {\n\t  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\titmp = keysel;\n\tkeysel = 0;\n\tif (itmp) {\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\tipass = 1;\n\tnpass = 2;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsbth_abort_jmp_env)) {\n\t  return 4;\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\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    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    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^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^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 = \"DAVGna\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\n^DATE-OBS {\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\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 = \"DOBSna\";\n\t    BEGIN(CCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"DOBSna keyword is non-standard\";\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    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    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"EQUIna\";\n\t    BEGIN(CCCCna);\n\t  }\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-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    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDOn\";\n\t    BEGIN(CCCCCn);\n\t  }\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^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    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    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\n\t  } else {\n\t    BEGIN(DISCARD);\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^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^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^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^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^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    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^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^END\" \"{77} {\n\t  if (wcsbth_nkeyrec) {\n\t    wcsbth_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 (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      yylex_destroy();\n\t      return 3;\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 == 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    BEGIN(COMMENT);\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<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    ix = 0;\n\t    for (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    gotone = 0;\n\t    while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) {\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        voff = (char *)vptr - (char *)(&wcstem);\n\t        wptr = (void *)((char *)wcsp + voff);\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            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 == STRING) {\n\t          /* Apply keyword parameterization. */\n\t          if (ptype == 's') {\n\t            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          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  /* 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  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    if ((status = wcsbth_init1(&alts, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      yylex_destroy();\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    wcsbth_hdr = header;\n\t    wcsbth_nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\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    special = 0x0;\n\t\n\t    yyrestart(yyin);\n\t\n\t  } else {\n\t    yylex_destroy();\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* 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  int ialt, icol, mask, ncol;\n\n  if (a == 0) {\n    /* Keywords such as DATE-OBS go along for the ride. */\n    return 0;\n  }\n\n  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 2;\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 2;\n    }\n\n    /* Since realloc() doesn't initialize the extra memory. */\n    for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) {\n      for (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  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    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 *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0;\n  struct wcsprm *wcsp;\n\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  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 (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  for (ialt = 0; ialt < 27; ialt++) {\n    inherit[ialt] = 0;\n\n    for (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 2;\n    }\n\n    /* Record the current values of NPVMAX and NPSMAX. */\n    npvmax = wcsnpv(-1);\n    npsmax = wcsnps(-1);\n\n    /* Initialize each wcsprm struct. */\n    wcsp = *wcs;\n    *nwcs = 0;\n    for (icol = 0; icol <= ncol; icol++) {\n      for (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          wcsnpv(alts->npv[icol][ialt]);\n          wcsnps(alts->nps[icol][ialt]);\n          if ((status = wcsini(1, (int)(alts->arridx[icol][ialt]), wcsp))) {\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 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 (ialt = 0; ialt < 27; ialt++) {\n      if (alts->pixidx[ialt]) {\n        /* Pixel lists representations. */\n        wcsp->flag = -1;\n        wcsnpv(alts->pixnpv[ialt]);\n        wcsnps(alts->pixnps[ialt]);\n        if ((status = wcsini(1, (int)(alts->pixidx[ialt]), wcsp))) {\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 the pixel list column numbers. */\n        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    /* Restore the original values of NPVMAX and NPSMAX. */\n    wcsnpv(npvmax);\n    wcsnps(npsmax);\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  int iwcs;\n\n  if (!wcs) return 0x0;\n\n  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  int ix;\n  struct wcsprm *wcsp;\n\n  if (!wcs) return 0;\n\n  wcsp = wcs;\n  if (a != ' ') {\n    wcsp += alts->pixidx[a-'A'+1];\n  }\n\n  for (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 EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_epoch(double *equinox, 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, double vsource)\n\n{\n  double beta, 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    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* Tie up loose ends.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_final(\n  struct wcsbth_alts *alts,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, status;\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 (ialt = 0; ialt < *nwcs; ialt++) {\n    /* Interpret -TAB header keywords. */\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n  }\n\n  return 0;\n}\n"},{"id":13616,"name":"wcsulex.l","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsulex.l,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* wcsulex.l is a Flex description file containing the definition of a\n* recursive, multi-buffered lexical scanner that parses 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 noyywrap\n%option outfile=\"wcsulex.c\"\n%option prefix=\"wcsulex\"\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|d|h|min|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/* To get the prototype for fileno() from stdio.h when gcc is invoked with\n * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */\n#define _POSIX_SOURCE 1\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#define YY_DECL int wcsulexe(const char unitstr[], int *func, double *scale, \\\n                             double units[WCSUNITS_NTYPE], struct wcserr **err)\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsulex_abort_jmp_env;\n#define exit(status) longjmp(wcsulex_abort_jmp_env, status)\n\n%}\n\n%%\n\tstatic const char *function = \"wcsulexe\";\n\t\n\tchar ctmp[72];\n\tint bracket  = 0;\n\tint operator = 0;\n\tint paren    = 0;\n\tint status   = 0;\n\tint func_r, i, j;\n\tdouble dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE];\n\tYY_BUFFER_STATE buf;\n\tvoid add(double *factor, double types[], double *expon, double *scale,\n\t    double units[]);\n\tint yylex_destroy(void);\n\t\n\tif (err) *err = 0x0;\n\t\n\t*func = 0;\n\tfor (i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  units[i] = 0.0;\n\t  types[i] = 0.0;\n\t}\n\texpon  = 1.0;\n\tfactor = 1.0;\n\t*scale = 1.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);\n\t}\n\t\n\tyy_scan_string(unitstr);\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsulex_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    buf = YY_CURRENT_BUFFER;\n\t    status = wcsulexe(yytext+1, &func_r, &factor_r, types, err);\n\t    yy_switch_to_buffer(buf);\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  /* 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>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>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  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  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  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  sscanf(yytext, \" (%s)\", ctmp);\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  yylex_destroy();\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 (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* 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  int i;\n\n  *scale *= pow(*factor, *expon);\n\n  for (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":13617,"name":"GNUmakefile","nodeType":"TextFile","path":"cextern/wcslib/C","text":"#-----------------------------------------------------------------------------\n# GNU makefile for building WCSLIB 5.17 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 5.17 2017/09/18 08:44:23 mcalabre Exp $\n#-----------------------------------------------------------------------------\n# Get configure settings.\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\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 PGPLOT and PGSBOX.\nTEST_B := tpih2\n\n# Test programs that aren't automatically exercised.\nTEST_X := tsphdpa twcshdr\n\nTESTS  := $(TEST_N)\n\n# Add test programs that require CFITSIO if we have it.\nifneq \"$(CFITSIOINC)\" \"\"\nifneq \"$(CFITSIOLIB)\" \"\"\n  TESTS += $(TEST_C)\nendif\nendif\n\n# Add test programs that require PGPLOT if we have it.\nifneq \"$(CHECK)\" \"nopgplot\"\nifneq \"$(PGPLOTINC)\" \"\"\nifneq \"$(PGPLOTLIB)\" \"\"\n  TESTS += $(TEST_P) $(TEST_B)\nendif\nendif\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   $(AR) r $(WCSLIB) $%\n\t-@ $(RM) $%\n\n$(PICLIB)(%.o) : %.c\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $<\n\t   $(AR) r $(PICLIB) $%\n\t-@ $(RM) $%\n\n%.i : %.c\n\t-@ echo ''\n\t-@ $(RM) $@\n\t   $(CPP) $(CPPFLAGS) $(CFLAGS) $< > $@\n\n%.fits : test/%.keyrec tofits\n\t   ./tofits < $< > $@\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   sort -u\n\n# Use 'make FLAVOUR=Linux run_%' to have VALGRIND defined (from flavours).\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_test.tmp' 0 1 2 3 15 ; \\\n\t         sed -e 's/$(ADDRE)/0x<address>/g' $<.out > \\\n\t           run_test.tmp ; \\\n\t         mv -f run_test.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\n\nbuild : lib\n\nlib : $(FLEXMODS) $(WCSLIB) $(SHRLIB)\n\n$(WCSLIB) : $(MODULES:%=$(WCSLIB)(%))\n\t-@ echo ''\n\t   $(RANLIB) $@\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) : $(MODULES:%.o=$(PICLIB)(%.o)) ;\n\ninstall : build\n\t-  if [ ! -d \"$(LIBDIR)\" ] ; then \\\n\t     $(INSTALL) -d -m 775 $(LIBDIR) ; \\\n\t   fi\n\t   $(INSTALL) -m 644 $(WCSLIB) $(LIBDIR)\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\nclean :\n\t- $(RM) -r *.o *.i a.out t*.out core *.dSYM $(EXTRA_CLEAN)\n\ncleaner : clean\n\t-  $(RM) .gdb_history\n\t-  $(RM) $(TEST_N) $(TEST_n) $(TEST_X)\n\t-  $(RM) $(TEST_P) tdis3 tpih2 twcshdr twcslint twcstab\n\t-  $(RM) tofits\n\t-  $(RM) bth.fits fitshdr.fits pih.fits wcslint.fits wcstab.fits\n\t-  $(RM) SIP.fits SIPTPV.fits TPV3.fits TPV5.fits TPV7.fits\n\t-  $(RM) 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) $(TEST_n) : % : test/%.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o\n\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\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\ntfitshdr_cfitsio tpih1_cfitsio tbth1_cfitsio : %_cfitsio : test/%.c $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) -DDO_CFITSIO $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) \\\n\t     -o $@ $< $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(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) $(CFLAGS) -c -o $@.o $<\n\t   $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) \\\n\t     $(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS)\n\t-@ $(RM) $@.o\n\ntwcstab : test/twcstab.c $(GETWCSTAB) $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) -o $@ $< $(GETWCSTAB) \\\n\t     $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o\n\ntwcshdr : test/twcshdr.c $(GETWCSTAB) $(WCSLIB)\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) -o $@ $< $(GETWCSTAB) \\\n\t     $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS)\n\t-@ $(RM) $@.o\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\ngetwcstab.o : getwcstab.c getwcstab.h\n\t-@ echo ''\n\t   $(CC) $(CPPFLAGS) $(CFLAGS) $(CFITSIOINC) -c $<\n\n$(PGSBOXLIB) :\n\t-@ echo ''\n\t   $(MAKE) -C ../pgsbox $(notdir $@)\n\ntofits : test/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\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)(fitshdr.o)  : wcsconfig.h fitshdr.h wcsutil.h\n$(WCSLIB)(dis.o)      : dis.h wcserr.h wcsprintf.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 lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \\\n                        wcshdr.h wcsmath.h wcsutil.h\n$(WCSLIB)(wcspih.o)   : cel.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 tab.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 : fitshdr.h wcsconfig.h wcsconfig_tests.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 dis.h lin.h prj.h spc.h spx.h wcs.h wcserr.h wcshdr.h \\\n          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 fitshdr.h lin.h log.h prj.h spc.h sph.h spx.h tab.h wcs.h \\\n          wcsconfig.h wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcslib.h \\\n          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 wcsprintf.h \\\n          wcsunits.h\ntwcshdr : cel.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \\\n          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 fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \\\n          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":13618,"name":"spx.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spx.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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* 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"},{"col":0,"comment":"","endLoc":11,"header":"__init__.py#<anonymous>","id":13619,"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()"},{"id":13620,"name":"spx.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: spx.c,v 5.17 2017/09/18 08:44:23 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(type, spec, restfrq, restwav, spx)\n\nconst char *type;\ndouble spec, restfrq, restwav;\nstruct 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(dummy, nfreq, sfreq, swave, freq, wave, stat)\n\ndouble dummy;\nint nfreq, sfreq, swave;\nconst double freq[];\ndouble wave[];\nint stat[];\n\n{\n  int status = 0;\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *wavep;\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(dummy, nwave, swave, sfreq, wave, freq, stat)\n\ndouble dummy;\nint nwave, swave, sfreq;\nconst double wave[];\ndouble freq[];\nint stat[];\n\n{\n  int status = 0;\n  register int iwave, *statp;\n  register const double *wavep;\n  register double *freqp;\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(dummy, nfreq, sfreq, sawav, freq, awav, stat)\n\ndouble dummy;\nint nfreq, sfreq, sawav;\nconst double freq[];\ndouble awav[];\nint 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(dummy, nawav, sawav, sfreq, awav, freq, stat)\n\ndouble dummy;\nint nawav, sawav, sfreq;\nconst double awav[];\ndouble freq[];\nint 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(restfrq, nfreq, sfreq, svelo, freq, velo, stat)\n\ndouble restfrq;\nint nfreq, sfreq, svelo;\nconst double freq[];\ndouble velo[];\nint 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(restfrq, nvelo, svelo, sfreq, velo, freq, stat)\n\ndouble restfrq;\nint nvelo, svelo, sfreq;\nconst double velo[];\ndouble freq[];\nint 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(dummy, nwave, swave, sawav, wave, awav, stat)\n\ndouble dummy;\nint nwave, swave, sawav;\nconst double wave[];\ndouble awav[];\nint 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  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(dummy, nawav, sawav, swave, awav, wave, stat)\n\ndouble dummy;\nint nawav, sawav, swave;\nconst double awav[];\ndouble wave[];\nint 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  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(restwav, nwave, swave, svelo, wave, velo, stat)\n\ndouble restwav;\nint nwave, swave, svelo;\nconst double wave[];\ndouble velo[];\nint 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(restwav, nvelo, svelo, swave, velo, wave, stat)\n\ndouble restwav;\nint nvelo, svelo, swave;\nconst double velo[];\ndouble wave[];\nint 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(dummy, nawav, sawav, svelo, awav, velo, stat)\n\ndouble dummy;\nint nawav, sawav, svelo;\nconst double awav[];\ndouble velo[];\nint 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(dummy, nvelo, svelo, sawav, velo, awav, stat)\n\ndouble dummy;\nint nvelo, svelo, sawav;\nconst double velo[];\ndouble awav[];\nint 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(dummy, nfreq, sfreq, safrq, freq, afrq, stat)\n\ndouble dummy;\nint nfreq, sfreq, safrq;\nconst double freq[];\ndouble afrq[];\nint stat[];\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *afrqp;\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(dummy, nafrq, safrq, sfreq, afrq, freq, stat)\n\ndouble dummy;\nint nafrq, safrq, sfreq;\nconst double afrq[];\ndouble freq[];\nint stat[];\n\n{\n  register int iafrq, *statp;\n  register const double *afrqp;\n  register double *freqp;\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(dummy, nfreq, sfreq, sener, freq, ener, stat)\n\ndouble dummy;\nint nfreq, sfreq, sener;\nconst double freq[];\ndouble ener[];\nint stat[];\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *enerp;\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(dummy, nener, sener, sfreq, ener, freq, stat)\n\ndouble dummy;\nint nener, sener, sfreq;\nconst double ener[];\ndouble freq[];\nint stat[];\n\n{\n  register int iener, *statp;\n  register const double *enerp;\n  register double *freqp;\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(dummy, nfreq, sfreq, swavn, freq, wavn, stat)\n\ndouble dummy;\nint nfreq, sfreq, swavn;\nconst double freq[];\ndouble wavn[];\nint stat[];\n\n{\n  register int ifreq, *statp;\n  register const double *freqp;\n  register double *wavnp;\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(dummy, nwavn, swavn, sfreq, wavn, freq, stat)\n\ndouble dummy;\nint nwavn, swavn, sfreq;\nconst double wavn[];\ndouble freq[];\nint stat[];\n\n{\n  register int iwavn, *statp;\n  register const double *wavnp;\n  register double *freqp;\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(restfrq, nfreq, sfreq, svrad, freq, vrad, stat)\n\ndouble restfrq;\nint nfreq, sfreq, svrad;\nconst double freq[];\ndouble vrad[];\nint 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(restfrq, nvrad, svrad, sfreq, vrad, freq, stat)\n\ndouble restfrq;\nint nvrad, svrad, sfreq;\nconst double vrad[];\ndouble freq[];\nint 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(restwav, nwave, swave, svopt, wave, vopt, stat)\n\ndouble restwav;\nint nwave, swave, svopt;\nconst double wave[];\ndouble vopt[];\nint 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(restwav, nvopt, svopt, swave, vopt, wave, stat)\n\ndouble restwav;\nint nvopt, svopt, swave;\nconst double vopt[];\ndouble wave[];\nint 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(restwav, nwave, swave, szopt, wave, zopt, stat)\n\ndouble restwav;\nint nwave, swave, szopt;\nconst double wave[];\ndouble zopt[];\nint 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(restwav, nzopt, szopt, swave, zopt, wave, stat)\n\ndouble restwav;\nint nzopt, szopt, swave;\nconst double zopt[];\ndouble wave[];\nint 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(dummy, nvelo, svelo, sbeta, velo, beta, stat)\n\ndouble dummy;\nint nvelo, svelo, sbeta;\nconst double velo[];\ndouble beta[];\nint stat[];\n\n{\n  register int ivelo, *statp;\n  register const double *velop;\n  register double *betap;\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(dummy, nbeta, sbeta, svelo, beta, velo, stat)\n\ndouble dummy;\nint nbeta, sbeta, svelo;\nconst double beta[];\ndouble velo[];\nint stat[];\n\n{\n  register int ibeta, *statp;\n  register const double *betap;\n  register double *velop;\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":13621,"name":"prj.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: prj.c,v 5.17 2017/09/18 08:44:23 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* 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(prj)\n\nstruct 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(prj)\n\nstruct prjprm *prj;\n\n{\n  if (prj == 0x0) return PRJERR_NULL_POINTER;\n\n  if (prj->err) {\n    free(prj->err);\n    prj->err = 0x0;\n  }\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint prjprt(prj)\n\nconst 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((int (*)(void))prj->prjx2s, hext));\n  wcsprintf(\"     prjs2x: %s\\n\",\n    wcsutil_fptr2str((int (*)(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(tol, nphi, ntheta, spt, phi, theta, stat)\n\ndouble tol;\nint nphi, ntheta, spt;\ndouble phi[], theta[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj, phi0, theta0)\n\nstruct prjprm *prj;\nconst double phi0, 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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 float 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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(prj)\n\nstruct 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(prj, nx, ny, sxy, spt, x, y, phi, theta, stat)\n\nstruct prjprm *prj;\nint nx, ny, sxy, spt;\nconst double x[], y[];\ndouble phi[], theta[];\nint 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(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat)\n\nstruct prjprm *prj;\nint nphi, ntheta, spt, sxy;\nconst double phi[], theta[];\ndouble x[], y[];\nint 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":13622,"name":"dis.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: dis.c,v 5.17 2017/09/18 08:44:23 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 four 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#define I_DOCORR  3\t/* True if distortion func computes a correction.   */\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  char axno[8], *cp;\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          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    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 disini(int alloc, int naxis, struct disprm *dis)\n\n{\n  static const char *function = \"disini\";\n\n  struct wcserr **err;\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  /* Initialize error message handling. */\n  err = &(dis->err);\n  if (dis->flag != -1) {\n    if (dis->err) free(dis->err);\n  }\n  dis->err = 0x0;\n\n\n  /* Initialize pointers. */\n  if (dis->flag == -1 || dis->m_flag != DISSET) {\n    if (dis->flag == -1) {\n      dis->axmap  = 0x0;\n      dis->Nhat   = 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  memset(dis->dtype,  0, naxis*sizeof(char [72]));\n  dis->ndp = 0;\n  memset(dis->dp,     0, NDPMAX*sizeof(struct dpkey));\n  memset(dis->maxdis, 0, naxis*sizeof(double));\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  int naxis, ndp, status;\n  struct wcserr **err;\n\n  if (dissrc == 0x0) return DISERR_NULL_POINTER;\n  if (disdst == 0x0) return DISERR_NULL_POINTER;\n  err = &(disdst->err);\n\n  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  ndp = NDPMAX;\n  NDPMAX = dissrc->ndpmax;\n\n  if ((status = disini(alloc, naxis, disdst))) {\n    return status;\n  }\n\n  NDPMAX = ndp;\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  int j;\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n\n  if (dis->flag != -1) {\n    /* Optionally allocated by disini() 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    /* Recall that these were allocated in bulk by disset(). */\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->Nhat)   free(dis->Nhat);\n    if (dis->offset) free(dis->offset);\n    if (dis->scale)  free(dis->scale);\n    for (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    }\n    if (dis->iparm)  free(dis->iparm);\n    if (dis->dparm)  free(dis->dparm);\n\n    if (dis->disp2x) free(dis->disp2x);\n    if (dis->disx2p) free(dis->disx2p);\n    if (dis->tmpmem) free(dis->tmpmem);\n\n    if (dis->err) free(dis->err);\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->axmap  = 0x0;\n  dis->Nhat   = 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  dis->err  = 0x0;\n\n  dis->flag = 0;\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint disprt(const struct disprm *dis)\n\n{\n  char hext[32];\n  int i, j, jhat, k, naxis;\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  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 (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 (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 (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(\"      axmap: \", dis->axmap, \"\\n\");\n  for (j = 0; j < naxis; j++) {\n    wcsprintf(\" axmap[%d][]:\", j);\n    for (jhat = 0; jhat < naxis; jhat++) {\n      wcsprintf(\"%6d\", dis->axmap[j][jhat]);\n    }\n    wcsprintf(\"\\n            \");\n    for (jhat = naxis; jhat < 2*naxis; jhat++) {\n      wcsprintf(\"%6d\", dis->axmap[j][jhat]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  WCSPRINTF_PTR(\"       Nhat: \", dis->Nhat, \"\\n\");\n  wcsprintf(\"            \");\n  for (j = 0; j < naxis; j++) {\n    wcsprintf(\"%6d\", dis->Nhat[j]);\n  }\n  wcsprintf(\"\\n\");\n\n  WCSPRINTF_PTR(\"     offset: \", dis->offset, \"\\n\");\n  for (j = 0; j < naxis; j++) {\n    wcsprintf(\"offset[%d][]:\", j);\n    for (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 (j = 0; j < naxis; j++) {\n    wcsprintf(\" scale[%d][]:\", j);\n    for (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 (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 (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 (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 (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  WCSPRINTF_PTR(\"     disp2x: \", dis->disp2x, \"\\n\");\n  for (j = 0; j < naxis; j++) {\n    wcsprintf(\"  disp2x[%d]: %s\", j,\n      wcsutil_fptr2str((int (*)(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 (j = 0; j < naxis; j++) {\n    wcsprintf(\"  disx2p[%d]: %s\\n\", j,\n      wcsutil_fptr2str((int (*)(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  int j, status;\n  struct wcserr **err;\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  status = 0;\n  for (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  char   *dpq, *fp;\n  int    idp, j, jhat, k, naxis, ndis, Nhat, status;\n  struct dpkey *keyp;\n  struct wcserr **err;\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  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  ndis = 0;\n  for (j = 0; j < naxis; j++) {\n    if (strlen(dis->dtype[j])) {\n      ndis++;\n      break;\n    }\n  }\n\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\n\n  /* Allocate memory for derived parameters and work arrays. */\n  if (dis->i_naxis < naxis) {\n    if (dis->i_naxis) {\n      /* Recall that axmap, offset, and scale are allocated in bulk. */\n      free(dis->axmap[0]);\n      free(dis->axmap);\n      free(dis->Nhat);\n      free(dis->offset[0]);\n      free(dis->offset);\n      free(dis->scale[0]);\n      free(dis->scale);\n\n      for (j = 0; j < dis->i_naxis; j++) {\n        /* Memory allocated separately for each axis. */\n        if (dis->iparm[j]) free(dis->iparm[j]);\n        if (dis->dparm[j]) free(dis->dparm[j]);\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->axmap = 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[0] = calloc(2*naxis*naxis, sizeof(int))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    for (j = 1; j < naxis; j++) {\n      dis->axmap[j] = dis->axmap[j-1] + 2*naxis;\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    if ((dis->offset = calloc(naxis, sizeof(double *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    /* Allocate offset[][] in bulk and then carve it up. */\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 (j = 1; j < naxis; j++) {\n      dis->offset[j] = dis->offset[j-1] + naxis;\n    }\n\n    if ((dis->scale = calloc(naxis, sizeof(double *))) == 0x0) {\n      disfree(dis);\n      return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n    }\n\n    /* Allocate scale[][] in bulk and then carve it up. */\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 (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 (jhat = 0; jhat < 2*naxis*naxis; jhat++) {\n    dis->axmap[0][jhat] = -1;\n  }\n\n  memset(dis->Nhat,      0, naxis*sizeof(int));\n  memset(dis->offset[0], 0, naxis*naxis*sizeof(double));\n\n  for (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  keyp = dis->dp;\n  for (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    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    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    j--;\n    if (strncmp(fp, \"NAXES\", 6) == 0) {\n      Nhat = wcsutil_dpkey_int(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      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] = wcsutil_dpkey_int(keyp) - 1;\n\n    } else if (strncmp(fp, \"OFFSET.\", 7) == 0) {\n      sscanf(fp+7, \"%d\", &jhat);\n      dis->offset[j][jhat-1] = wcsutil_dpkey_double(keyp);\n\n    } else if (strncmp(fp, \"SCALE.\", 6) == 0) {\n      sscanf(fp+6, \"%d\", &jhat);\n      dis->scale[j][jhat-1] = wcsutil_dpkey_double(keyp);\n    }\n\n    /* DOCORR should also be handled here but no space was provided for it\n       in disprm. */\n  }\n\n  /* Set defaults and do sanity checks on axmap[][].  */\n  for (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 (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    Nhat = dis->Nhat[j];\n    for (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 (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 (jhat = 0; jhat < Nhat; jhat++) {\n      for (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    /* Construct the inverse axis map. */\n    for (jhat = 0; jhat < Nhat; jhat++) {\n      k = naxis + dis->axmap[j][jhat];\n      dis->axmap[j][k] = jhat;\n    }\n  }\n\n\n  /* Identify the distortion functions. */\n  ndis = 0;\n  for (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    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  int    axisj, j, jhat, naxis, Nhat, status;\n  double dtmp, *offset, *scale, *tmpcrd;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  if (dis->flag != DISSET) {\n    if ((status = disset(dis))) return status;\n  }\n\n  naxis = dis->naxis;\n\n\n  /* Invoke the distortion functions for each axis. */\n  tmpcrd = dis->tmpmem;\n  for (j = 0; j < naxis; j++) {\n    if (dis->disp2x[j]) {\n      offset = dis->offset[j];\n      scale  = dis->scale[j];\n\n      Nhat = dis->Nhat[j];\n      for (jhat = 0; jhat < Nhat; jhat++) {\n        axisj = dis->axmap[j][jhat];\n        tmpcrd[jhat] = (rawcrd[axisj] - offset[jhat])*scale[jhat];\n      }\n\n      if ((status = (dis->disp2x[j])(0, dis->iparm[j], dis->dparm[j], Nhat,\n                                     tmpcrd, &dtmp))) {\n        return wcserr_set(DIS_ERRMSG(DISERR_DISTORT));\n      }\n\n      if (dis->iparm[j][I_DOCORR]) {\n        /* Distortion function computes a correction. */\n        discrd[j] = rawcrd[j] + dtmp;\n      } else {\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    axisj, convergence, iter, itermax, j, jhat, naxis, Nhat, status;\n  double dd, *dcrd0, *dcrd1, *delta, *offset, residual, *rcrd1, rtmp, *scale,\n         *tmpcrd;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  naxis = dis->naxis;\n\n  /* Carve up working memory, noting that disp2x() gets to it first. */\n  dcrd0 = dis->tmpmem + naxis;\n  dcrd1 = dcrd0 + naxis;\n  rcrd1 = dcrd1 + naxis;\n  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 (j = 0; j < naxis; j++) {\n    if (dis->disx2p[j]) {\n      offset = dis->offset[j];\n      scale  = dis->scale[j];\n      tmpcrd = dis->tmpmem;\n\n      Nhat = dis->Nhat[j];\n      for (jhat = 0; jhat < Nhat; jhat++) {\n        axisj = dis->axmap[j][jhat];\n        tmpcrd[jhat] = (discrd[axisj] - offset[jhat])*scale[jhat];\n      }\n\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->iparm[j][I_DOCORR]) {\n        /* Inverse distortion function computes a correction. */\n        rawcrd[j] = discrd[j] + rtmp;\n      } else {\n        rawcrd[j] = rtmp;\n      }\n    }\n  }\n\n  /* Quick return debugging hook, assumes inverse functions were defined. */\n  if ((itermax = disitermax(-1)) == 0) {\n    return 0;\n  }\n\n\n  /* Iteratively invert the (well-behaved!) distortion function. */\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 (j = 0; j < naxis; j++) {\n      delta[j] = discrd[j] - dcrd0[j];\n\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 (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 (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 (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 (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    residual = 0.0;\n    for (j = 0; j < naxis; j++) {\n      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 carry, j, naxis, status = 0;\n  double dpix, dpx2, dssq, *pix0, *pix1, *pixend, *pixinc, pixspan, *ssqdis,\n         ssqtot, *sumdis, sumtot, totdis;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  naxis = dis->naxis;\n\n  if (nsamp) *nsamp = 0;\n  for (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  pixinc = dis->tmpmem + naxis;\n  pixend = pixinc + naxis;\n  sumdis = pixend + naxis;\n  ssqdis = sumdis + naxis;\n\n  /* Work out increments on each axis. */\n  for (j = 0; j < naxis; j++) {\n    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  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 (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 (j = 0; j < naxis; j++) {\n    sumdis[j] = 0.0;\n    ssqdis[j] = 0.0;\n  }\n  sumtot = 0.0;\n  ssqtot = 0.0;\n\n\n  /* Loop over N dimensions. */\n  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    dssq = 0.0;\n    for (j = 0; j < naxis; j++) {\n      dpix = pix1[j] - pix0[j];\n      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    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 (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 (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  char   *fp, id[32];\n  int    i, idp, *iparm, ipow, ivar, jhat, k, K, lendp, m, M, naxis, ndparm,\n         Nhat, niparm, nKparm, npow, nTparm, nVar, offset;\n  double *dparm, *dptr, power;\n  struct dpkey *keyp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  naxis = dis->naxis;\n  sprintf(id, \"Polynomial on axis %d\", j+1);\n\n\n  /* Find the number of auxiliary variables and terms. */\n  K = 0;\n  M = 0;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\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 = wcsutil_dpkey_int(keyp);\n    } else if (strcmp(fp, \"NTERMS\") == 0) {\n      M = wcsutil_dpkey_int(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  Nhat = dis->Nhat[j];\n  nKparm = 2*(Nhat + 1);\n  nVar   = Nhat + K;\n  nTparm = 1 + nVar;\n  ndparm = K*nKparm + M*nTparm;\n\n/* These iparm indices are specific to Polynomial.                          */\n#define I_NIDX    4\t/* No. of indexes in iparm[].                       */\n#define I_LENDP   5\t/* Full (allocated) length of dparm[].              */\n#define I_K       6\t/* No. of auxiliary variables.                      */\n#define I_M       7\t/* No. of terms in the polynomial.                  */\n#define I_NKPARM  8\t/* No. of parameters used to define each auxiliary. */\n#define I_NTPARM  9\t/* No. of parameters used to define each term.      */\n#define I_NVAR   10\t/* No. of independent + auxiliary variables.        */\n#define I_MNVAR  11\t/* No. of powers (exponents) in the polynomial.     */\n#define I_DPOLY  12\t/* dparm offset for polynomial coefficients.        */\n#define I_DAUX   13\t/* dparm offset for auxiliary coefficients.         */\n#define I_DVPOW  14\t/* dparm offset for integral powers of variables.   */\n#define I_MAXPOW 15\t/* iparm offset for max powers.                     */\n#define I_DPOFF  16\t/* iparm offset for dparm offsets.                  */\n#define I_FLAGS  17\t/* iparm offset for flags.                          */\n#define I_IPOW   18\t/* iparm offset for integral powers.                */\n#define I_NPOLY  19\n\n  /* Add extra for handling integer exponents.  See \"Optimization\" below. */\n  niparm = I_NPOLY + (2 + 2*M)*nVar;\n\n  /* Add extra memory for temporaries. */\n  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  iparm = dis->iparm[j];\n  dparm = dis->dparm[j];\n\n\n  /* Record the indexing parameters.  The first four are more widely used. */\n  iparm[I_DTYPE]  = DIS_POLYNOMIAL;\n  iparm[I_NIPARM] = niparm;\n  iparm[I_NDPARM] = ndparm;\n  iparm[I_DOCORR] = 0;\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  dptr = dparm + (1 + Nhat);\n  for (k = 0; k < K; k++) {\n    for (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 (m = 0; m < M; m++) {\n    *dptr = 1.0;\n    dptr += nTparm;\n  }\n\n  /* Extract parameter values from DPja or DQia. */\n  k = m = 0;\n  keyp = dis->dp;\n  for (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    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"DOCORR:\", 7) == 0) {\n      fp += 7;\n      sscanf(fp, \"%d\", &k);\n      if (k) iparm[I_DOCORR] = 1;\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      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        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      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] = wcsutil_dpkey_double(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] = wcsutil_dpkey_double(keyp);\n\n      } else if (strncmp(fp, \"VAR.\", 4) == 0) {\n        /* N.B. jhat here is 1-relative. */\n        fp += 4;\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        power = wcsutil_dpkey_double(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        power = wcsutil_dpkey_double(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, \"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 (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 (ivar = 0; ivar < nVar; ivar++) {\n    for (m = 0; m < M; m++) {\n      i = iparm[I_DPOLY] + m*nTparm + 1 + ivar;\n      power = dparm[i];\n\n      /* Is it integral?  (Positive, negative, or zero.) */\n      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  npow = 0;\n  for (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  char   *fp, id[16];\n  int    doaux, docorr, doradial, idis, idp, k, m, ncoeff[2], ndparm, niparm;\n  struct dpkey *keyp;\n  struct wcserr **err;\n  int (*(distpd[2]))(DISP2X_ARGS);\n\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\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  ncoeff[0] = 0;\n  ncoeff[1] = 0;\n  doaux     = 0;\n  doradial  = 0;\n  docorr    = 0;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"TPD.\", 4) == 0) {\n      fp += 4;\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      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 (strncmp(fp, \"DOCORR:\", 7) == 0) {\n      fp += 7;\n      sscanf(fp, \"%d\", &k);\n      if (k) docorr = 1;\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  distpd[0] = 0x0;\n  distpd[1] = 0x0;\n  for (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.                      */\n#define I_TPDNCO  4\t/* No. of TPD coefficients, forward...   */\n#define I_TPDINV  5     /* ...and inverse.                       */\n#define I_TPDAUX  6\t/* True if auxiliary variables are used. */\n#define I_TPDRAD  7\t/* True if the radial variable is used.  */\n#define I_NTPD    8\n\n  /* Record indexing parameters. */\n  niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  ndparm = (doaux?6:0) + ncoeff[0] + ncoeff[1];\n\n  /* The first four 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  dis->iparm[j][I_DOCORR] = docorr;\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 (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"AUX.\", 4) == 0) {\n      /* Auxiliary variables. */\n      fp += 4;\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      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      idis = 3*(k-1) + m;\n      dis->dparm[j][idis] = wcsutil_dpkey_double(keyp);\n\n    } else if (strncmp(fp, \"TPD.\", 4) == 0) {\n      fp += 4;\n      idis = (doaux?6:0);\n      if (strncmp(fp, \"REV.\", 4) == 0) {\n        idis += ncoeff[0];\n      }\n\n      sscanf(fp+4, \"%d\", &k);\n      dis->dparm[j][idis+k] = wcsutil_dpkey_double(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  int deg, degree, *iflgp, *iparm, *ipowp, jhat, K, m, n, ndparm, Nhat,\n      niparm, p[2], *tpd_iparm;\n  double *dparm, *dpolp, *tpd_dparm;\n  struct wcserr **err;\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  iparm = dis->iparm[j];\n  dparm = dis->dparm[j];\n\n\n  /* Check the number of independent variables, no more than two. */\n  Nhat = dis->Nhat[j];\n  if (2 < Nhat) return -1;\n\n  /* Check auxiliaries: only one is allowed... */\n  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  iflgp = iparm + iparm[I_FLAGS];\n  ipowp = iparm + iparm[I_IPOW];\n  degree = 0;\n  for (m = 0; m < iparm[I_M]; m++) {\n    deg = 0;\n    for (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  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  niparm = I_NTPD;\n  if ((tpd_iparm = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  /* The first four are more widely used. */\n  tpd_iparm[I_DTYPE]  = DIS_TPD;\n  tpd_iparm[I_NIPARM] = niparm;\n  tpd_iparm[I_NDPARM] = ndparm;\n  tpd_iparm[I_DOCORR] = iparm[I_DOCORR];\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  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  dpolp = dparm + iparm[I_DPOLY];\n  for (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      p[0] = p[1] = 0;\n      for (jhat = 0; jhat < Nhat; jhat++) {\n        p[jhat] = ipowp[jhat];\n      }\n\n      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  char   *fp, id[16];\n  int    doradial, idp, k, ndparm, niparm;\n  struct dpkey *keyp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  /* TPV \"projection\". */\n  sprintf(id, \"TPV on axis %d\", j+1);\n\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  ndparm   = 0;\n  doradial = 0;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"TPV.\", 4) == 0) {\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  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 four 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  dis->iparm[j][I_DOCORR] = 0;\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 (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    /* One-to-one correspondence between TPV and TPD coefficients. */\n    if (strncmp(fp, \"TPV.\", 4) == 0) {\n      sscanf(fp+4, \"%d\", &k);\n      dis->dparm[j][k] = wcsutil_dpkey_double(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  char   *fp, id[16];\n  int    deg, degree[2], idis, idp, jhat, naxis, ncoeff[2], ndparm, niparm,\n         p, q;\n  struct dpkey *keyp;\n  struct wcserr **err;\n  int (*(distpd[2]))(DISP2X_ARGS);\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  /* Simple Imaging Polynomial. */\n  sprintf(id, \"SIP on axis %d\", j+1);\n\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  degree[0] =  1;\n  degree[1] = -1;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"SIP.\", 4) == 0) {\n      fp += 4;\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      sscanf(fp, \"%d_%d\", &p, &q);\n      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  distpd[0] = 0x0;\n  distpd[1] = 0x0;\n  for (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  niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  ndparm = ncoeff[0] + ncoeff[1];\n\n  /* The first four 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  dis->iparm[j][I_DOCORR] = 0;\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 (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"SIP.\", 4) == 0) {\n      fp += 4;\n      if (strncmp(fp, \"FWD.\", 4) == 0) {\n        idis = 0;\n      } else {\n        idis = ncoeff[0];\n      }\n\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] = wcsutil_dpkey_double(keyp);\n    }\n  }\n\n  /* Account for the fact that the SIP distortion provides an additive    */\n  /* correction to the offset of the pixel coordinate from CRPIX, whereas */\n  /* we expect the distortion function to provide the actual value of the */\n  /* distorted pixel coordinate.                                          */\n  naxis = dis->naxis;\n  jhat  = dis->axmap[j][naxis+j];\n  idis  = jhat + 1;\n  dis->dparm[j][0] = dis->offset[j][jhat];\n  dis->dparm[j][idis] += 1.0;\n  if (degree[1] > 0) {\n    dis->dparm[j][ncoeff[0]] = dis->offset[j][jhat];\n    dis->dparm[j][ncoeff[0]+idis] += 1.0;\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  char   *fp, id[16];\n  int    degree, idp, m, ncoeff, ndparm, niparm;\n  double A1, A2, A3, B1, B2, B3, coeff, *dparm, S, X0, Y0;\n  struct dpkey *keyp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  /* Digitized Sky Survey. */\n  sprintf(id, \"DSS on axis %d\", j+1);\n\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  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  niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  ndparm = 6 + ncoeff;\n\n  /* The first four 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  dis->iparm[j][I_DOCORR] = 0;\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  A1 = A2 = A3 = 0.0;\n  B1 = B2 = B3 = 0.0;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    fp = strchr(keyp->field, '.') + 1;\n    if (strncmp(fp, \"DSS.AMD.\", 8) == 0) {\n      fp += 8;\n      sscanf(fp, \"%d\", &m);\n\n      if (m == 1) {\n        if (keyp->j == 1) {\n          A1 = wcsutil_dpkey_double(keyp);\n        } else {\n          B1 = wcsutil_dpkey_double(keyp);\n        }\n      } else if (m == 2) {\n        if (keyp->j == 1) {\n          A2 = wcsutil_dpkey_double(keyp);\n        } else {\n          B2 = wcsutil_dpkey_double(keyp);\n        }\n      } else if (m == 3) {\n        if (keyp->j == 1) {\n          A3 = wcsutil_dpkey_double(keyp);\n        } else {\n          B3 = wcsutil_dpkey_double(keyp);\n        }\n      }\n    }\n  }\n\n  X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n  Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2);\n\n  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  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  degree = 3;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    fp = strchr(keyp->field, '.') + 1;\n\n    if (strncmp(fp, \"DSS.AMD.\", 8) == 0) {\n      /* Skip zero coefficients. */\n      if ((coeff = wcsutil_dpkey_double(keyp)) == 0.0) continue;\n\n      fp += 8;\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\tdegree = 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  char   *fp, id[20];\n  int    deg, degree, doaux, idis, idp, im, in, *iparm, kind, m, n, ncoeff,\n         ndparm, niparm;\n  double coeff, coeffm[10], coeffn[10], *dparm, dx, dy, x0, xmax, xmin,\n         y0, ymax, ymin;\n  struct dpkey *keyp;\n  struct wcserr **err;\n\n\n  /* Initialize. */\n  if (dis == 0x0) return DISERR_NULL_POINTER;\n  err = &(dis->err);\n\n  /* WAT (TNX or ZPX) Polynomial. */\n  sprintf(id, \"WAT (%s) on axis %d\", dis->dtype[0]+4, 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  degree = 1;\n  kind = 0;\n  xmin = xmax = 0.0;\n  ymin = ymax = 0.0;\n  keyp = dis->dp;\n  for (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    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        sscanf(fp, \"%d_%d\", &m, &n);\n        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 = wcsutil_dpkey_int(keyp);\n\n      } else if (strcmp(fp, \"XMIN\") == 0) {\n        xmin = wcsutil_dpkey_double(keyp);\n\n      } else if (strcmp(fp, \"XMAX\") == 0) {\n        xmax = wcsutil_dpkey_double(keyp);\n\n      } else if (strcmp(fp, \"YMIN\") == 0) {\n        ymin = wcsutil_dpkey_double(keyp);\n\n      } else if (strcmp(fp, \"YMAX\") == 0) {\n        ymax = wcsutil_dpkey_double(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  doaux = (kind == 1 || kind == 2);\n\n  /* TPD is going to do the dirty work. */\n  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  niparm = I_NTPD;\n  if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) {\n    return wcserr_set(DIS_ERRMSG(DISERR_MEMORY));\n  }\n\n  iparm = dis->iparm[j];\n\n  ndparm = 6 + ncoeff;\n\n  /* The first four are more widely used. */\n  iparm[I_DTYPE]  = DIS_TPD;\n  iparm[I_NIPARM] = niparm;\n  iparm[I_NDPARM] = ndparm;\n  iparm[I_DOCORR] = 1;\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  dparm = dis->dparm[j];\n\n\n  /* Coefficients for the auxiliary variables. */\n  if (doaux) {\n    x0 = (xmax + xmin)/2.0;\n    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    y0 = (ymax + ymin)/2.0;\n    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 (idp = 0; idp < dis->ndp; idp++, keyp++) {\n    if (keyp->j-1 != j) continue;\n\n    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      sscanf(fp, \"%d_%d\", &m, &n);\n\n      if (kind == MONOMIAL) {\n        /* Monomial coefficient, maps simply to TPD coefficient number. */\n        idis = map[m][n];\n        dparm[idis] = wcsutil_dpkey_double(keyp);\n\n      } else {\n        /* Coefficient of the product of two Chebyshev or two Legendre */\n        /* polynomials.  Find the corresponding monomial coefficients. */\n        coeff = wcsutil_dpkey_double(keyp);\n\n        cheleg(kind, m, n, coeffm, coeffn);\n        for (im = 0; im <= m; im++) {\n          if (coeffm[im] == 0.0) continue;\n\n          for (in = 0; in <= n; in++) {\n            if (coeffn[in] == 0.0) continue;\n\n            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    j, j0, j1, j2, k, N;\n  double *coeff[3], d;\n\n  N = (m > n) ? m : n;\n\n  /* Allocate work arrays. */\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 (j = 0; j <= N; j++) {\n    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      j1 = (j-1)%3;\n      j2 = (j-2)%3;\n\n      memset(coeff[j0], 0, (N+1)*sizeof(double));\n\n      d = (double)j;\n      for (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  const int *iflgp, *imaxp, *imaxpow, *ipowp;\n  int    ip, ivar, jhat, k, m;\n  const double *cptr, *dpolp, *pptr;\n  double *aux, auxp0, *dvarpow, *dpowp, term, var;\n\n  /* Check for zeroes. */\n  for (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  aux = (double *)(dparm + iparm[I_DAUX]);\n\n  /* Compute the auxiliary variables. */\n  for (k = 0; k < iparm[I_K]; k++) {\n    cptr = dparm + k*iparm[I_NKPARM];\n    pptr = cptr + (1+Nhat);\n\n    aux[k] = *(cptr++);\n    auxp0  = *(pptr++);\n\n    for (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  imaxpow = iparm + iparm[I_MAXPOW];\n  dvarpow = (double *)(dparm + iparm[I_DVPOW]);\n\n  imaxp = imaxpow;\n  dpowp = dvarpow;\n  for (jhat = 0; jhat < Nhat; jhat++, imaxp++) {\n    var = 1.0;\n    for (ip = 0; ip < *imaxp; ip++, dpowp++) {\n      var *= rawcrd[jhat];\n      *dpowp = var;\n    }\n  }\n\n  for (k = 0; k < iparm[I_K]; k++, imaxp++) {\n    var = 1.0;\n    for (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  iflgp = iparm + iparm[I_FLAGS];\n  ipowp = iparm + iparm[I_IPOW];\n  dpolp = dparm + iparm[I_DPOLY];\n  for (m = 0; m < iparm[I_M]; m++) {\n    term = *(dpolp++);\n\n    /* Loop over all variables. */\n    imaxp = imaxpow;\n    dpowp = dvarpow - 1;\n    for (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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 4 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 7 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 12 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 17 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 24 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 31 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 40 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 49 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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  double r, s, u, v;\n\n  if (i[I_TPDNCO+inverse] != 60 || 2 < Nhat) {\n    return 1;\n  }\n\n  u = rawcrd[0];\n  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":13623,"name":"wcserr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\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 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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[WCSERR_MSG_LENGTH]\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_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 the error (if any) contained in 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\n#define WCSERR_MSG_LENGTH 160\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[WCSERR_MSG_LENGTH];\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_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":13624,"name":"fitshdr.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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 by invoking free() on\n*                       the array.\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*\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\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":13625,"name":"log.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: log.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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":13626,"name":"getwcstab.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: getwcstab.c,v 5.17 2017/09/18 08:44:23 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":13627,"name":"wcsfix.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsfix.c,v 5.17 2017/09/18 08:44:23 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 \"wcsutil.h\"\n#include \"lin.h\"\n#include \"sph.h\"\n#include \"wcs.h\"\n#include \"wcsunits.h\"\n#include \"wcsfix.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[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(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[],\n            struct wcserr info[])\n\n{\n  int ifix, status = 0;\n  struct wcserr err;\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 before\n  each sub-fixer.  The last real error to occur, excluding informative\n  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  wcserr_copy(wcs->err, &err);\n\n  for (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 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  int  i, k, naxis, status = FIXERR_NO_CHANGE;\n  double *cd;\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  naxis = wcs->naxis;\n  status = FIXERR_NO_CHANGE;\n  for (i = 0; i < naxis; i++) {\n    /* Row of zeros? */\n    cd = wcs->cd + i * naxis;\n    for (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 (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 = 0;\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\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\nstatic void write_date(char *buf, int hour, int minute, double sec)\n\n{\n  char ctmp[72];\n\n  wcsutil_double2str(ctmp, \"%04.1f\", sec);\n  sprintf(buf, \"T%.2d:%.2d:%s\", hour, minute, ctmp);\n}\n\nint datfix(struct wcsprm *wcs)\n\n{\n  static const char *function = \"datfix\";\n\n  char orig_dateobs[72];\n  char *dateobs;\n  int  day, dd, hour = 0, jd, minute = 0, month, msec, n4, year;\n  double mjdobs, sec = 0.0, t;\n  struct wcserr **err;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  dateobs = wcs->dateobs;\n  strncpy(orig_dateobs, dateobs, 72);\n  if (dateobs[0] == '\\0') {\n    if (undefined(wcs->mjdobs)) {\n     /* No date information was provided. */\n      return FIXERR_NO_CHANGE;\n\n    } else {\n      /* Calendar date from MJD. */\n      jd = 2400001 + (int)wcs->mjdobs;\n\n      n4 =  4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37);\n      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(dateobs, \"%.4d-%.2d-%.2d\", year, month, day);\n\n      /* Write time part only if non-zero. */\n      if ((t = wcs->mjdobs - (int)wcs->mjdobs) > 0.0) {\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        msec = dd - 60000 * minute;\n        sprintf(dateobs+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(dateobs+19, \".%.3d\", msec%1000);\n        }\n      }\n    }\n\n  } else {\n    if (strlen(dateobs) < 8) {\n      /* Can't be a valid date. */\n      return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n        \"Invalid parameter value: date string too short '%s'\", dateobs);\n    }\n\n    /* Identify the date format. */\n    if (dateobs[4] == '-' && dateobs[7] == '-') {\n      /* Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]] */\n      if (sscanf(dateobs, \"%4d-%2d-%2d\", &year, &month, &day) < 3) {\n        return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n          \"Invalid parameter value: invalid date '%s'\", dateobs);\n      }\n\n      if (dateobs[10] == 'T') {\n        if (parse_date(dateobs+11, &hour, &minute, &sec)) {\n          return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n            \"Invalid parameter value: invalid time '%s'\", dateobs+11);\n        }\n      } else if (dateobs[10] == ' ') {\n        hour = 0;\n        minute = 0;\n        sec = 0.0;\n        if (parse_date(dateobs+11, &hour, &minute, &sec)) {\n          write_date(dateobs+10, hour, minute, sec);\n        } else {\n          dateobs[10] = 'T';\n        }\n      }\n\n    } else if (dateobs[4] == '/' && dateobs[7] == '/') {\n      /* Also allow CCYY/MM/DD[Thh:mm:ss[.sss...]] */\n      if (sscanf(dateobs, \"%4d/%2d/%2d\", &year, &month, &day) < 3) {\n        return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n          \"Invalid parameter value: invalid date '%s'\", dateobs);\n      }\n\n      if (dateobs[10] == 'T') {\n        if (parse_date(dateobs+11, &hour, &minute, &sec)) {\n          return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n            \"Invalid parameter value: invalid time '%s'\", dateobs+11);\n        }\n      } else if (dateobs[10] == ' ') {\n        hour = 0;\n        minute = 0;\n        sec = 0.0;\n        if (parse_date(dateobs+11, &hour, &minute, &sec)) {\n          write_date(dateobs+10, hour, minute, sec);\n        } else {\n          dateobs[10] = 'T';\n        }\n      }\n\n      /* Looks ok, fix it up. */\n      dateobs[4]  = '-';\n      dateobs[7]  = '-';\n\n    } else {\n      if (dateobs[2] == '/' && dateobs[5] == '/') {\n        /* Old format date: DD/MM/YY, also allowing DD/MM/CCYY. */\n        if (sscanf(dateobs, \"%2d/%2d/%4d\", &day, &month, &year) < 3) {\n          return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n            \"Invalid parameter value: invalid date '%s'\", dateobs);\n        }\n\n      } else if (dateobs[2] == '-' && dateobs[5] == '-') {\n        /* Also recognize DD-MM-YY and DD-MM-CCYY */\n        if (sscanf(dateobs, \"%2d-%2d-%4d\", &day, &month, &year) < 3) {\n          return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n            \"Invalid parameter value: invalid date '%s'\", dateobs);\n        }\n\n      } else {\n        /* Not a valid date format. */\n        return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n          \"Invalid parameter value: invalid date '%s'\", dateobs);\n      }\n\n      if (year < 100) year += 1900;\n\n      /* Doesn't have a time. */\n      sprintf(dateobs, \"%.4d-%.2d-%.2d\", year, month, day);\n    }\n\n    /* Compute MJD. */\n    mjdobs = (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             + (hour + (minute + sec/60.0)/60.0)/24.0;\n\n    if (undefined(wcs->mjdobs)) {\n      wcs->mjdobs = mjdobs;\n    } else {\n      /* Check for consistency. */\n      if (fabs(mjdobs - wcs->mjdobs) > 0.5) {\n        return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM),\n          \"Invalid parameter value: inconsistent date '%s'\", dateobs);\n      }\n    }\n  }\n\n  if (strncmp(orig_dateobs, dateobs, 72)) {\n    wcserr_set(WCSERR_SET(FIXERR_DATE_FIX),\n      \"Changed '%s' to '%s'\", orig_dateobs, dateobs);\n\n    return 0;\n  }\n\n  return FIXERR_NO_CHANGE;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint unitfix(int ctrl, struct wcsprm *wcs)\n\n{\n  int  i, k, result, status = FIXERR_NO_CHANGE;\n  char orig_unit[80], msg[WCSERR_MSG_LENGTH], msgtmp[WCSERR_MSG_LENGTH];\n  const char *function = \"unitfix\";\n  struct wcserr **err;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  strncpy(msg, \"Changed units: \", WCSERR_MSG_LENGTH);\n\n  for (i = 0; i < wcs->naxis; i++) {\n    strncpy(orig_unit, wcs->cunit[i], 80);\n    result = wcsutrne(ctrl, wcs->cunit[i], &(wcs->err));\n    if (result == 0 || result == 12) {\n      k = strlen(msg);\n      if (k < WCSERR_MSG_LENGTH-1) {\n        wcsutil_null_fill(80, orig_unit);\n        sprintf(msgtmp, \"'%s' -> '%s', \", orig_unit, wcs->cunit[i]);\n        strncpy(msg+k, msgtmp, WCSERR_MSG_LENGTH-1-k);\n        status = FIXERR_UNITS_ALIAS;\n      }\n    }\n  }\n\n  if (status == FIXERR_UNITS_ALIAS) {\n    /* Chop off the trailing \", \". */\n    k = strlen(msg) - 2;\n    msg[k] = '\\0';\n    wcserr_set(WCSERR_SET(FIXERR_UNITS_ALIAS), msg);\n\n    status = 0;\n  }\n\n  return status;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint spcfix(struct wcsprm *wcs)\n\n{\n  static const char *function = \"spcfix\";\n\n  char ctype[9], specsys[9];\n  int  i, status;\n  struct wcserr **err;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  for (i = 0; i < wcs->naxis; i++) {\n    /* Translate an AIPS-convention spectral type if present. */\n    status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys);\n    if (status == 0) {\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 = 0;\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 == 0) {\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 = 0;\n        }\n\n        strncpy(wcs->ctype[i], ctype, 9);\n      }\n\n      /* Tidy up. */\n      if (status == 0) {\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  int k, status;\n  struct celprm *wcscel = &(wcs->cel);\n  struct prjprm *wcsprj = &(wcscel->prj);\n  struct wcserr **err;\n\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  /* Initialize if required. */\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 (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->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 0;\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 (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 0;\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  unsigned short icnr, indx[NMAX], ncnr;\n  int    j, k, stat[4], status;\n  double img[4][NMAX], lat, lng, phi[4], phi0, phimax, phimin, pix[4][NMAX],\n         *pixj, theta[4], theta0, world[4][NMAX], x, y;\n  struct wcserr **err;\n\n  if (naxis == 0x0) return FIXERR_NO_CHANGE;\n  if (wcs == 0x0) return FIXERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  /* Initialize if required. */\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  ncnr = 1 << wcs->naxis;\n\n  for (k = 0; k < NMAX; k++) {\n    indx[k] = 1 << k;\n  }\n\n  phimin =  1.0e99;\n  phimax = -1.0e99;\n  for (icnr = 0; icnr < ncnr;) {\n    /* Do four corners at a time. */\n    for (j = 0; j < 4; j++, icnr++) {\n      pixj = pix[j];\n\n      for (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 (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  phi0 = (phimin + phimax) / 2.0;\n  theta0 = 0.0;\n\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 (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  lng =  0.0;\n  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"},{"id":13628,"name":"cextern/wcslib/C/flexed","nodeType":"Package"},{"id":13629,"name":"wcspih.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcspih.c\"\n\n#line 4 \"wcspih.c\"\n\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define yy_create_buffer wcspih_create_buffer\n#define yy_delete_buffer wcspih_delete_buffer\n#define yy_flex_debug wcspih_flex_debug\n#define yy_init_buffer wcspih_init_buffer\n#define yy_flush_buffer wcspih_flush_buffer\n#define yy_load_buffer_state wcspih_load_buffer_state\n#define yy_switch_to_buffer wcspih_switch_to_buffer\n#define yyin wcspihin\n#define yyleng wcspihleng\n#define yylex wcspihlex\n#define yylineno wcspihlineno\n#define yyout wcspihout\n#define yyrestart wcspihrestart\n#define yytext wcspihtext\n#define yywrap wcspihwrap\n#define yyalloc wcspihalloc\n#define yyrealloc wcspihrealloc\n#define yyfree wcspihfree\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 5\n#define YY_FLEX_SUBMINOR_VERSION 39\n#if YY_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;\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#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define YY_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define YY_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef YY_USE_CONST\n#define yyconst const\n#else\n#define yyconst\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 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 YY_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 (yy_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 YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START (((yy_start) - 1) / 2)\n#define YYSTATE YY_START\n\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE wcspihrestart(wcspihin  )\n\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\nextern yy_size_t wcspihleng;\n\nextern FILE *wcspihin, *wcspihout;\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 wcspihtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = (yy_hold_char); \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\t(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up wcspihtext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) yyunput( c, (yytext_ptr)  )\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\tyy_size_t yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tyy_size_t 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 wcspihrestart()), so that the user can continue scanning by\n\t * just pointing wcspihin 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/* Stack of input buffers. */\nstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\nstatic YY_BUFFER_STATE * yy_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 YY_CURRENT_BUFFER ( (yy_buffer_stack) \\\n                          ? (yy_buffer_stack)[(yy_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 YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\n\n/* yy_hold_char holds the character lost when wcspihtext is formed. */\nstatic char yy_hold_char;\nstatic yy_size_t yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\nyy_size_t wcspihleng;\n\n/* Points to current character in buffer. */\nstatic char *yy_c_buf_p = (char *) 0;\nstatic int yy_init = 0;\t\t/* whether we need to initialize */\nstatic int yy_start = 0;\t/* start state number */\n\n/* Flag which is used to allow wcspihwrap()'s to do buffer switches\n * instead of setting up a fresh wcspihin.  A bit of a hack ...\n */\nstatic int yy_did_buffer_switch_on_eof;\n\nvoid wcspihrestart (FILE *input_file  );\nvoid wcspih_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\nYY_BUFFER_STATE wcspih_create_buffer (FILE *file,int size  );\nvoid wcspih_delete_buffer (YY_BUFFER_STATE b  );\nvoid wcspih_flush_buffer (YY_BUFFER_STATE b  );\nvoid wcspihpush_buffer_state (YY_BUFFER_STATE new_buffer  );\nvoid wcspihpop_buffer_state (void );\n\nstatic void wcspihensure_buffer_stack (void );\nstatic void wcspih_load_buffer_state (void );\nstatic void wcspih_init_buffer (YY_BUFFER_STATE b,FILE *file  );\n\n#define YY_FLUSH_BUFFER wcspih_flush_buffer(YY_CURRENT_BUFFER )\n\nYY_BUFFER_STATE wcspih_scan_buffer (char *base,yy_size_t size  );\nYY_BUFFER_STATE wcspih_scan_string (yyconst char *yy_str  );\nYY_BUFFER_STATE wcspih_scan_bytes (yyconst char *bytes,yy_size_t len  );\n\nvoid *wcspihalloc (yy_size_t  );\nvoid *wcspihrealloc (void *,yy_size_t  );\nvoid wcspihfree (void *  );\n\n#define yy_new_buffer wcspih_create_buffer\n\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        wcspihensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        wcspihensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcspihwrap() 1\n#define YY_SKIP_YYWRAP\n\ntypedef char YY_CHAR;\n\nFILE *wcspihin = (FILE *) 0, *wcspihout = (FILE *) 0;\n\ntypedef int yy_state_type;\n\nextern int wcspihlineno;\n\nint wcspihlineno = 1;\n\nextern char *wcspihtext;\n#define yytext_ptr wcspihtext\n\nstatic yyconst 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       53,   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,   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,   54,   54,\n       54,   54,   54,   54,   54,   54,   54,   54\n    },\n\n    {\n       53,   55,   55,   55,   55,   55,   55,   55,   55,   55,\n       54,   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,   56,   57,   58,   59,   60,\n       55,   55,   55,   55,   55,   55,   61,   62,   63,   64,\n       65,   55,   66,   67,   55,   55,   68,   69,   70,   71,\n       72,   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       53,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n\n       54,   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,   74,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   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       53,   73,   73,   73,   73,   73,   73,   73,   73,   73,\n       54,   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,   74,   75,\n       75,   75,   75,   75,   75,   75,   75,   75,   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,   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       53,   76,   76,   76,   76,   76,   76,   76,   76,   76,\n       54,   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,   77,   78,\n\n       78,   78,   78,   78,   78,   78,   78,   78,   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\n    },\n\n    {\n       53,   76,   76,   76,   76,   76,   76,   76,   76,   76,\n       54,   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,   77,   78,\n       78,   78,   78,   78,   78,   78,   78,   78,   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       53,   79,   79,   79,   79,   79,   79,   79,   79,   79,\n       54,   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,   80,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   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\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       53,   79,   79,   79,   79,   79,   79,   79,   79,   79,\n       54,   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,   80,   81,\n       81,   81,   81,   81,   81,   81,   81,   81,   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\n    },\n\n    {\n       53,   82,   82,   82,   82,   82,   82,   82,   82,   82,\n       54,   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,   83,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   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    {\n       53,   82,   82,   82,   82,   82,   82,   82,   82,   82,\n       54,   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,   83,   84,\n       84,   84,   84,   84,   84,   84,   84,   84,   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\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       53,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       54,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   86,   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,   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,   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       53,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       54,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n       85,   85,   86,   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,   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,   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       53,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n\n       54,   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       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\n    },\n\n    {\n       53,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       54,   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,   87,   87,\n       87,   87,   87,   87,   87,   87,   87,   87\n    },\n\n    {\n       53,   88,   88,   88,   88,   88,   88,   88,   88,   88,\n       54,   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,   89,   89,\n\n       89,   89,   89,   89,   89,   89,   89,   89,   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,   88,   88,\n       88,   88,   88,   88,   88,   88,   88,   88\n    },\n\n    {\n       53,   88,   88,   88,   88,   88,   88,   88,   88,   88,\n       54,   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,   89,   89,\n       89,   89,   89,   89,   89,   89,   89,   89,   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,   88,   88,\n\n       88,   88,   88,   88,   88,   88,   88,   88\n    },\n\n    {\n       53,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       54,   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,   91,\n       91,   91,   91,   91,   91,   91,   91,   91,   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,   90,   90,\n       90,   90,   90,   90,   90,   90,   90,   90\n    },\n\n    {\n       53,   90,   90,   90,   90,   90,   90,   90,   90,   90,\n       54,   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,   91,\n       91,   91,   91,   91,   91,   91,   91,   91,   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,   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       53,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       54,   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,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   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    {\n       53,   92,   92,   92,   92,   92,   92,   92,   92,   92,\n       54,   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,   93,   93,\n       93,   93,   93,   93,   93,   93,   93,   93,   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\n    },\n\n    {\n       53,   94,   94,   94,   94,   94,   94,   94,   94,   94,\n       54,   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,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   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,   94,   94,   94,   94,   94,   94,   94,   94,   94,\n       94,   94,   94,   94,   94,   94,   94,   94\n    },\n\n    {\n       53,   94,   94,   94,   94,   94,   94,   94,   94,   94,\n       54,   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,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95,   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\n    },\n\n    {\n       53,   96,   96,   96,   96,   96,   96,   96,   96,   96,\n\n       54,   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,   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\n       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,\n       96,   96,   96,   96,   96,   96,   96,   96\n    },\n\n    {\n       53,   96,   96,   96,   96,   96,   96,   96,   96,   96,\n       54,   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,   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\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\n    },\n\n    {\n       53,   98,   98,   98,   98,   98,   98,   98,   98,   98,\n       54,   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,   99,   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       98,   98,   98,   98,   98,   98,   98,   98\n    },\n\n    {\n       53,   98,   98,   98,   98,   98,   98,   98,   98,   98,\n       54,   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,   98,   98,\n       98,   99,   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\n    },\n\n    {\n       53,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n       54,  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,  101,  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       53,  100,  100,  100,  100,  100,  100,  100,  100,  100,\n       54,  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,  101,  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       53,  102,  102,  102,  102,  102,  102,  102,  102,  102,\n       54,  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,  103,  102,  103,  102,  102,  104,  104,\n      104,  104,  104,  104,  104,  104,  104,  104,  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    {\n       53,  102,  102,  102,  102,  102,  102,  102,  102,  102,\n       54,  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,  103,  102,  103,  102,  102,  104,  104,\n      104,  104,  104,  104,  104,  104,  104,  104,  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\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       53,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       54,  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,  106,  105,  106,  107,  105,  108,  108,\n      108,  108,  108,  108,  108,  108,  108,  108,  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\n    },\n\n    {\n       53,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       54,  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,  106,  105,  106,  107,  105,  108,  108,\n      108,  108,  108,  108,  108,  108,  108,  108,  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       53,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n\n       54,  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,  110,\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\n      109,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n      109,  109,  109,  109,  109,  109,  109,  109\n    },\n\n    {\n       53,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n       54,  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,  110,\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\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       53,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n       54,  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      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,  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       53,  111,  111,  111,  111,  111,  111,  111,  111,  111,\n       54,  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,  112,\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      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\n    },\n\n    {\n       53,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       54,  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,  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,  113,  113,  113,  113,  114,  113,  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,  113,  113,  113,  113,  113\n    },\n\n    {\n       53,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       54,  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,  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,  113,  113,  113,  113,  114,  113,  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,  113,  113,  113,  113,  113\n    },\n\n    {\n       53,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       54,  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,  116,  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    {\n       53,  115,  115,  115,  115,  115,  115,  115,  115,  115,\n       54,  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,  116,  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\n    },\n\n    {\n       53,  117,  117,  117,  117,  117,  117,  117,  117,  117,\n       54,  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,  118,  117,  118,  119,  117,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  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,  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       53,  117,  117,  117,  117,  117,  117,  117,  117,  117,\n       54,  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,  118,  117,  118,  119,  117,  120,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  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,  117,  117,  117,  117,  117,\n      117,  117,  117,  117,  117,  117,  117,  117\n    },\n\n    {\n       53,   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,  121,\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,   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\n    },\n\n    {\n       53,   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,  121,\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\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       53,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      123,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  124,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  125,  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\n    },\n\n    {\n       53,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      123,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n\n      122,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  124,  122,  122,  122,  122,  122,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  125,  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\n      122,  122,  122,  122,  122,  122,  122,  122\n    },\n\n    {\n       53,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      127,  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,  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       53,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      127,  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,  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       53,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      129,  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       53,  128,  128,  128,  128,  128,  128,  128,  128,  128,\n      129,  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       53,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      131,  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,  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\n    },\n\n    {\n       53,  130,  130,  130,  130,  130,  130,  130,  130,  130,\n      131,  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,  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\n    },\n\n    {\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,  -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       53,  -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,  -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       53,  -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       53,  -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,  132,  -56,  -56,\n      133,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n      -56,  -56,  -56,  -56,  -56,  134,  -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       53,  -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      135,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,\n\n      -57,  -57,  -57,  -57,  -57,  136,  -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       53,  -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,  137,  -58,\n      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  138,  -58,\n      139,  140,  141,  142,  143,  144,  -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       53,  -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,  145,  -59,  -59,  -59,  -59,\n      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,\n      146,  147,  -59,  -59,  -59,  -59,  148,  -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       53,  -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,  149,  -60,\n      150,  151,  -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       53,  -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,  152,  -61,  -61,  -61,  -61,\n\n      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  153,\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       53,  -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,  154,  -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       53,  -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,  155,  -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       53,  -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,  156,  -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       53,  -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,  157,  -65,  -65,\n      -65,  -65,  -65,  -65,  -65,  -65,  158,  -65,  -65,  -65,\n      159,  -65,  160,  161,  -65,  -65,  162,  -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       53,  -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,  163,  -66,  -66,  -66,  164,\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       53,  -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      165,  -67,  -67,  166,  -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       53,  -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,  167,\n      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,\n      -68,  -68,  -68,  168,  -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       53,  -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,  169,  -69,  170,  -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       53,  -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      171,  -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       53,  -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      172,  -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       53,  -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,  173,  -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       53,  -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       53,  -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,  174,  -74,  -74,  -74,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  175,  176,\n      176,  176,  176,  176,  176,  176,  176,  176,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  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,  -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       53,  -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,  177,  -75,  -75,  -75,  -75,  -75,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  178,  178,\n\n      178,  178,  178,  178,  178,  178,  178,  178,  -75,  -75,\n      -75,  -75,  -75,  -75,  -75,  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,  -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       53,  -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       53,  -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,  179,  -77,  -77,  180,  181,\n      181,  181,  181,  181,  181,  181,  181,  181,  -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,  182,  -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       53,  -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,  179,  -78,  -78,  183,  183,\n      183,  183,  183,  183,  183,  183,  183,  183,  -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,  184,  -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       53,  -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       53,  -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,  185,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  186,  187,\n      187,  187,  187,  187,  187,  187,  187,  187,  -80,  -80,\n      -80,  -80,  -80,  -80,  -80,  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,  -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       53,  -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,  188,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  189,  189,\n      189,  189,  189,  189,  189,  189,  189,  189,  -81,  -81,\n      -81,  -81,  -81,  -81,  -81,  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,  -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       53,  -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       53,  -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,  190,  -83,  -83,  191,  192,\n      192,  192,  192,  192,  192,  192,  192,  192,  -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,  193,  -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       53,  -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,  190,  -84,  -84,  194,  194,\n      194,  194,  194,  194,  194,  194,  194,  194,  -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,  195,  -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       53,  -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       53,  -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       53,  -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       53,  -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,  -88,  -88,  -88,  -88,  -88,  -88\n    },\n\n    {\n       53,  -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,  196,  -89,  -89,  -89,  -89,  -89,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  197,  197,\n      197,  197,  197,  197,  197,  197,  197,  197,  -89,  -89,\n      -89,  -89,  -89,  -89,  -89,  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,  -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       53,  -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       53,  -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,  198,  -91,  -91,  -91,  -91,  -91,  -91,  -91,\n      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  199,  199,\n      199,  199,  199,  199,  199,  199,  199,  199,  -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       53,  -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       53,  -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,  200,  -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       53,  -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,  -94,  -94,  -94,  -94,  -94,  -94,  -94\n    },\n\n    {\n       53,  -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,  201,  -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       53,  -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       53,  -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,  202,  -97,  -97,  -97,  -97,  -97,  -97,  -97,\n      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  203,  203,\n      203,  203,  203,  203,  203,  203,  203,  203,  -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       53,  -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,  -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       53,  -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,  204,  -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       53, -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, -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       53, -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,  205, -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       53, -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, -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       53, -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,  206,  206,\n      206,  206,  206,  206,  206,  206,  206,  206, -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       53, -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,  206,  206,\n      206,  206,  206,  206,  206,  206,  206,  206, -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       53, -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       53, -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,  207, -106,  208,  208,\n      208,  208,  208,  208,  208,  208,  208,  208, -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       53, -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,  209,  209,\n      209,  209,  209,  209,  209,  209,  209,  209, -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       53, -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,  210, -108,  211,  211,\n      211,  211,  211,  211,  211,  211,  211,  211, -108, -108,\n\n     -108, -108, -108, -108, -108, -108, -108, -108,  212,  212,\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      212,  212, -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       53, -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       53,  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,  214,\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,  213,  213,\n      213,  213,  213,  213,  213,  213,  213,  213\n    },\n\n    {\n       53, -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       53,  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,  216,\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,  215,  215,\n      215,  215,  215,  215,  215,  215,  215,  215\n    },\n\n    {\n       53, -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       53, -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,  217, -114,  217,  217,\n      217,  217,  217,  217,  217,  217,  217,  217, -114, -114,\n     -114, -114, -114, -114, -114,  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, -114, -114, -114, -114,  217, -114,  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, -114, -114, -114, -114, -114\n    },\n\n    {\n       53, -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       53, -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,  218, -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     -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       53, -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, -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       53, -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,  219, -118,  220,  220,\n      220,  220,  220,  220,  220,  220,  220,  220, -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       53, -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,  221,  221,\n      221,  221,  221,  221,  221,  221,  221,  221, -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       53, -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,  222, -120,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120,  224,  224,\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      224,  224, -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       53, -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, -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       53,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      226,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      225,  225,  227,  225,  225,  225,  225,  225,  225,  225,\n\n      225,  225,  225,  225,  225,  225,  225,  228,  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,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  225\n    },\n\n    {\n       53, -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       53,  229,  229,  229,  229,  229,  229,  229,  229,  229,\n      230,  229,  229,  229,  229,  229,  229,  229,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229,  229,  229,\n      229,  229,  231,  229,  229,  229,  229,  229,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  232,  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\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       53,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      234,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  235,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  236,  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,  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\n    },\n\n    {\n       53,  237,  237,  237,  237,  237,  237,  237,  237,  237,\n      238,  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,  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,  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\n    },\n\n    {\n       53, -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       53,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      240,  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\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       53, -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       53,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      242,  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,  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\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       53, -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       53, -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,  243, -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       53, -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,  244, -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       53, -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,  245, -134,\n     -134, -134, -134, -134, -134, -134, -134, -134, -134,  246,\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, -134, -134, -134, -134, -134, -134\n    },\n\n    {\n       53, -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,  247, -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       53, -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,  248, -136,\n     -136, -136, -136, -136, -136, -136, -136, -136, -136,  249,\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       53, -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,  250,\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       53, -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,  251, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n      252, -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       53, -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,  253,  254,\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       53, -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,  255,  256,\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       53, -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,  257, -141,\n\n     -141, -141, -141, -141, -141, -141, -141, -141, -141,  258,\n      259, -141, -141, -141, -141, -141,  260, -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       53, -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,  261,\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       53, -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,  262,\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       53, -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,  263, -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       53, -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,  264, -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       53, -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, -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       53, -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, -147, -147, -147, -147, -147, -147,\n     -147, -147, -147, -147, -147, -147, -147, -147\n    },\n\n    {\n       53, -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,  265,\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       53, -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,  266, -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       53, -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,  267,\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       53, -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,  268, -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\n    },\n\n    {\n       53, -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,  269, -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       53, -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,  270, -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       53, -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,  271, -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\n    },\n\n    {\n       53, -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,  272, -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       53, -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,  273, -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\n     -156, -156, -156, -156, -156, -156, -156, -156\n    },\n\n    {\n       53, -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       53, -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,  274, -158, -158, -158, -158,\n     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,\n     -158, -158, -158, -158,  275, -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       53, -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,  276,\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       53, -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,  277,\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       53, -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       53, -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       53, -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,  278, -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       53, -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,  279, -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       53, -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,  280,\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       53, -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, -166, -166, -166, -166, -166, -166,  281,\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       53, -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,  282, -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       53, -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,  283,\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       53, -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,  284, -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       53, -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,  285, -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       53, -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,  286, -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       53, -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,  287, -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       53, -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,  288,\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\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       53, -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,  289, -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, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       53, -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,  290, -175, -175, -175, -175, -175, -175, -175,\n     -175, -175, -175, -175, -175, -175, -175, -175,  291,  292,\n\n      292,  292,  292,  292,  292,  292,  292,  292, -175, -175,\n     -175, -175, -175, -175, -175,  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, -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       53, -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,  293, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176, -176, -176, -176, -176,  291,  292,\n      292,  292,  292,  292,  292,  292,  292,  292, -176, -176,\n     -176, -176, -176, -176, -176,  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, -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       53, -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,  294, -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       53, -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,  295, -178, -178, -178, -178, -178, -178, -178,\n     -178, -178, -178, -178, -178, -178, -178, -178,  296,  296,\n      296,  296,  296,  296,  296,  296,  296,  296, -178, -178,\n\n     -178, -178, -178, -178, -178,  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, -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       53, -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,  297,  297,\n      297,  297,  297,  297,  297,  297,  297,  297, -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\n\n    },\n\n    {\n       53, -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,  298, -180, -180,  299,  300,\n      300,  300,  300,  300,  300,  300,  300,  300, -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,  301, -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       53, -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,  298, -181, -181,  302,  303,\n      303,  303,  303,  303,  303,  303,  303,  303, -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,  304, -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       53, -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,  305,  305,\n      305,  305,  305,  305,  305,  305,  305,  305, -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       53, -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,  298, -183, -183,  306,  307,\n      307,  307,  307,  307,  307,  307,  307,  307, -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,  308, -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       53, -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,  309,  310,\n      310,  310,  310,  310,  310,  310,  310,  310, -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       53, -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,  311, -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, -185, -185, -185, -185, -185, -185, -185, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185\n    },\n\n    {\n       53, -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,  312, -186, -186, -186, -186, -186, -186, -186,\n     -186, -186, -186, -186, -186, -186, -186, -186,  313,  314,\n      314,  314,  314,  314,  314,  314,  314,  314, -186, -186,\n     -186, -186, -186, -186, -186,  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, -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       53, -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,  315, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187,  313,  314,\n      314,  314,  314,  314,  314,  314,  314,  314, -187, -187,\n     -187, -187, -187, -187, -187,  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, -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       53, -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,  316, -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       53, -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,  317, -189, -189, -189, -189, -189, -189, -189,\n     -189, -189, -189, -189, -189, -189, -189, -189,  313,  313,\n      313,  313,  313,  313,  313,  313,  313,  313, -189, -189,\n     -189, -189, -189, -189, -189,  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, -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       53, -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,  318,  318,\n      318,  318,  318,  318,  318,  318,  318,  318, -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       53, -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,  319, -191, -191,  320,  321,\n      321,  321,  321,  321,  321,  321,  321,  321, -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,  322, -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       53, -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,  319, -192, -192,  323,  323,\n      323,  323,  323,  323,  323,  323,  323,  323, -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,  324, -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       53, -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,  325,  325,\n      325,  325,  325,  325,  325,  325,  325,  325, -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       53, -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,  319, -194, -194,  326,  326,\n      326,  326,  326,  326,  326,  326,  326,  326, -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,  327, -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       53, -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,  328,  329,\n\n      329,  329,  329,  329,  329,  329,  329,  329, -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       53, -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,  330, -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       53, -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,  331, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197,  332,  332,\n      332,  332,  332,  332,  332,  332,  332,  332, -197, -197,\n     -197, -197, -197, -197, -197,  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, -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       53, -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,  333, -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     -198, -198, -198, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198\n    },\n\n    {\n       53, -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,  334, -199, -199, -199, -199, -199, -199, -199,\n     -199, -199, -199, -199, -199, -199, -199, -199,  335,  335,\n      335,  335,  335,  335,  335,  335,  335,  335, -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       53, -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,  336,  336,\n      336,  336,  336,  336,  336,  336,  336,  336, -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, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200\n    },\n\n    {\n       53, -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,  337,  337,\n      337,  337,  337,  337,  337,  337,  337,  337, -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, -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       53, -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,  338, -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, -202, -202, -202, -202, -202, -202,\n     -202, -202, -202, -202, -202, -202, -202, -202\n    },\n\n    {\n       53, -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,  339, -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\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       53, -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,  340,\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     -204, -204, -204, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204\n    },\n\n    {\n       53, -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       53, -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, -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       53, -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,  209,  209,\n      209,  209,  209,  209,  209,  209,  209,  209, -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, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207\n    },\n\n    {\n       53, -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,  210, -208,  211,  211,\n      211,  211,  211,  211,  211,  211,  211,  211, -208, -208,\n\n     -208, -208, -208, -208, -208, -208, -208, -208,  212,  212,\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      212,  212, -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       53, -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,  212,  212,\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      212,  212, -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       53, -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,  341,  341,\n      341,  341,  341,  341,  341,  341,  341,  341, -210, -210,\n     -210, -210, -210, -210, -210, -210, -210, -210,  212,  212,\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      212,  212, -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       53, -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,  210, -211,  211,  211,\n      211,  211,  211,  211,  211,  211,  211,  211, -211, -211,\n     -211, -211, -211, -211, -211, -211, -211, -211,  212,  212,\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      212,  212, -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       53, -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,  342, -212,  342, -212, -212,  343,  343,\n      343,  343,  343,  343,  343,  343,  343,  343, -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       53,  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,  214,\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       53, -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,  213,\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       53,  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,  216,\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       53, -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, -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       53, -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      217,  217,  217,  217,  217,  217,  217,  217,  217,  217,\n      217,  217,  217, -217, -217, -217, -217, -217\n    },\n\n    {\n       53, -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, -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       53, -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,  221,  221,\n      221,  221,  221,  221,  221,  221,  221,  221, -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       53, -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,  222, -220,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223, -220, -220,\n     -220, -220, -220, -220, -220, -220, -220, -220,  224,  224,\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      224,  224, -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       53, -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,  224,  224,\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      224,  224, -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       53, -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,  344,  344,\n      344,  344,  344,  344,  344,  344,  344,  344, -222, -222,\n     -222, -222, -222, -222, -222, -222, -222, -222,  224,  224,\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      224,  224, -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       53, -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,  222, -223,  223,  223,\n      223,  223,  223,  223,  223,  223,  223,  223, -223, -223,\n     -223, -223, -223, -223, -223, -223, -223, -223,  224,  224,\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      224,  224, -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       53, -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,  345, -224,  345, -224, -224,  346,  346,\n      346,  346,  346,  346,  346,  346,  346,  346, -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       53,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      226,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  225,  225,  225,\n      225,  225,  227,  225,  225,  225,  225,  225,  225,  225,\n      225,  225,  225,  225,  225,  225,  225,  228,  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       53, -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       53,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      226,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  227,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  347,  347,  347,  347,  347,  228,  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      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       53,  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      348,  348,  350,  348,  348,  348,  348,  348,  348,  348,\n      348,  348,  348,  348,  348,  348,  348,  351,  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       53,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      353,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n\n      352,  352,  354,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  355,  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    {\n       53, -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     -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       53,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      357,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  358,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  359,  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,  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\n    },\n\n    {\n       53,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      234,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  235,  233,  233,  233,  233,  233,  233,  233,\n\n      233,  233,  233,  233,  233,  233,  233,  236,  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      233,  233,  233,  233,  233,  233,  233,  233\n    },\n\n    {\n       53,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n\n      234,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  235,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  236,  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       53, -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, -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\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       53,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      234,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  235,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  236,  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,  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\n    },\n\n    {\n       53,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      234,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n\n      233,  233,  233,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  235,  233,  233,  233,  233,  233,  233,  233,\n      233,  233,  233,  233,  233,  233,  233,  236,  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\n    },\n\n    {\n       53,  237,  237,  237,  237,  237,  237,  237,  237,  237,\n      238,  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,  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       53, -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\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       53,  239,  239,  239,  239,  239,  239,  239,  239,  239,\n      240,  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,  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       53, -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     -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       53,  241,  241,  241,  241,  241,  241,  241,  241,  241,\n      242,  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,  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       53, -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       53, -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,  360,  361,\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       53, -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,  362,\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       53, -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,  363, -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       53, -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,  364, -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       53, -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,  365,\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, -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       53, -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,  366, -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       53, -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,  367, -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\n\n    },\n\n    {\n       53, -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,  368, -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       53, -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,  369, -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       53, -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,  370, -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       53, -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,  371, -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       53, -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,  372, -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       53, -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,  373, -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\n    },\n\n    {\n       53, -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,  374, -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       53, -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,  375,\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       53, -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,  376, -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       53, -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,  377, -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       53, -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,  378, -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       53, -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,  379,\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       53, -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      380, -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\n    },\n\n    {\n       53, -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,  381, -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       53, -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,  382,\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       53, -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,  383, -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       53, -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,  384, -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       53, -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,  385, -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       53, -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,  386, -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       53, -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      387, -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       53, -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      388, -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       53, -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,  389, -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       53, -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,  390, -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       53, -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,  391, -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\n     -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,\n     -273, -273, -273, -273, -273, -273, -273, -273\n    },\n\n    {\n       53, -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,  392, -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       53, -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,  393, -275,\n     -275, -275, -275, -275, -275, -275, -275, -275, -275, -275,\n     -275, -275,  394, -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       53, -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,  395, -276, -276,  396, -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       53, -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,  397, -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       53, -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,  398,\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       53, -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,  399, -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       53, -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,  400, -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       53, -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,  401, -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       53, -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,  402, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282, -282,  403,\n     -282, -282,  404, -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       53, -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,  405, -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       53, -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,  406,\n      406, -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       53, -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,  407, -285, -285, -285, -285,\n     -285, -285, -285, -285, -285, -285, -285, -285,  408, -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       53, -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,  409, -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       53, -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,  410, -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       53, -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,  411, -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       53, -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,  412, -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       53, -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,  413, -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       53, -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,  414, -291, -291, -291, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291,  415,  416,\n      416,  416,  416,  416,  416,  416,  416,  416, -291, -291,\n     -291, -291, -291, -291, -291,  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, -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       53, -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,  417, -292, -292, -292, -292, -292, -292, -292,\n\n     -292, -292, -292, -292, -292, -292, -292, -292,  415,  416,\n      416,  416,  416,  416,  416,  416,  416,  416, -292, -292,\n     -292, -292, -292, -292, -292,  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, -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       53, -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,  418, -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       53, -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,  419, -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\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       53, -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,  420, -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       53, -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,  414, -296, -296, -296, -296, -296, -296, -296,\n     -296, -296, -296, -296, -296, -296, -296, -296,  421,  421,\n      421,  421,  421,  421,  421,  421,  421,  421, -296, -296,\n     -296, -296, -296, -296, -296,  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, -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       53, -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,  422, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297,  423,  423,\n      423,  423,  423,  423,  423,  423,  423,  423, -297, -297,\n     -297, -297, -297, -297, -297,  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, -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       53, -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,  424,  424,\n      424,  424,  424,  424,  424,  424,  424,  424, -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       53, -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,  425, -299, -299,  426,  427,\n      427,  427,  427,  427,  427,  427,  427,  427, -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,  428, -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       53, -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,  425, -300, -300,  429,  429,\n      429,  429,  429,  429,  429,  429,  429,  429, -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,  430, -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       53, -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,  431,  431,\n      431,  431,  431,  431,  431,  431,  431,  431, -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       53, -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,  425, -302, -302,  426,  426,\n      426,  426,  426,  426,  426,  426,  426,  426, -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,  432, -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       53, -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,  425, -303, -303,  433,  433,\n      433,  433,  433,  433,  433,  433,  433,  433, -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,  432, -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       53, -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,  434,  435,\n      435,  435,  435,  435,  435,  435,  435,  435, -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       53, -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,  436, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -305, -305,  437,  437,\n\n      437,  437,  437,  437,  437,  437,  437,  437, -305, -305,\n     -305, -305, -305, -305, -305,  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, -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       53, -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,  425, -306, -306,  426,  426,\n      426,  426,  426,  426,  426,  426,  426,  426, -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,  428, -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       53, -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,  425, -307, -307,  433,  433,\n      433,  433,  433,  433,  433,  433,  433,  433, -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,  428, -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       53, -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,  438,  439,\n      439,  439,  439,  439,  439,  439,  439,  439, -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       53, -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,  436, -309, -309, -309, -309, -309, -309, -309,\n     -309, -309, -309, -309, -309, -309, -309, -309,  440,  441,\n      441,  441,  441,  441,  441,  441,  441,  441, -309, -309,\n     -309, -309, -309, -309, -309,  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, -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       53, -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,  442, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310,  443,  443,\n      443,  443,  443,  443,  443,  443,  443,  443, -310, -310,\n     -310, -310, -310, -310, -310,  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, -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       53, -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       53, -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, -312, -312, -312, -312,\n     -312, -312, -312, -312, -312, -312, -312, -312\n    },\n\n    {\n       53, -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, -313, -313, -313, -313, -313, -313, -313, -313, -313,\n     -313, -313, -313, -313, -313, -313, -313, -313\n    },\n\n    {\n       53, -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, -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       53, -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, -315, -315, -315,\n     -315, -315, -315, -315, -315, -315, -315, -315\n    },\n\n    {\n       53, -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, -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       53, -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, -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       53, -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,  444, -318, -318, -318, -318, -318, -318, -318,\n     -318, -318, -318, -318, -318, -318, -318, -318,  445,  445,\n      445,  445,  445,  445,  445,  445,  445,  445, -318, -318,\n\n     -318, -318, -318, -318, -318,  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, -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       53, -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,  446,  446,\n      446,  446,  446,  446,  446,  446,  446,  446, -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\n\n    },\n\n    {\n       53, -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,  447, -320, -320,  448,  449,\n      449,  449,  449,  449,  449,  449,  449,  449, -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,  450, -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       53, -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,  447, -321, -321,  451,  451,\n      451,  451,  451,  451,  451,  451,  451,  451, -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,  452, -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       53, -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,  453,  453,\n      453,  453,  453,  453,  453,  453,  453,  453, -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       53, -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,  447, -323, -323,  448,  448,\n      448,  448,  448,  448,  448,  448,  448,  448, -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,  454, -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       53, -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,  455,  456,\n      456,  456,  456,  456,  456,  456,  456,  456, -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       53, -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,  457, -325, -325, -325, -325, -325, -325, -325,\n     -325, -325, -325, -325, -325, -325, -325, -325,  458,  458,\n\n      458,  458,  458,  458,  458,  458,  458,  458, -325, -325,\n     -325, -325, -325, -325, -325,  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, -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       53, -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,  447, -326, -326,  448,  448,\n      448,  448,  448,  448,  448,  448,  448,  448, -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,  450, -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       53, -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,  459,  460,\n      460,  460,  460,  460,  460,  460,  460,  460, -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       53, -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,  461, -328, -328, -328, -328, -328, -328, -328,\n     -328, -328, -328, -328, -328, -328, -328, -328,  462,  463,\n      463,  463,  463,  463,  463,  463,  463,  463, -328, -328,\n\n     -328, -328, -328, -328, -328,  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, -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       53, -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,  461, -329, -329, -329, -329, -329, -329, -329,\n     -329, -329, -329, -329, -329, -329, -329, -329,  464,  464,\n      464,  464,  464,  464,  464,  464,  464,  464, -329, -329,\n     -329, -329, -329, -329, -329,  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, -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       53, -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       53, -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, -331, -331, -331, -331,\n     -331, -331, -331, -331, -331, -331, -331, -331\n    },\n\n    {\n       53, -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, -332, -332, -332, -332, -332, -332, -332, -332, -332,\n     -332, -332, -332, -332, -332, -332, -332, -332\n    },\n\n    {\n       53, -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, -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       53, -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, -334, -334, -334,\n     -334, -334, -334, -334, -334, -334, -334, -334\n    },\n\n    {\n       53, -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, -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       53, -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,  465, -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       53, -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,  466, -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       53, -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,  467, -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, -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       53, -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,  468, -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, -339, -339,\n     -339, -339, -339, -339, -339, -339, -339, -339\n\n    },\n\n    {\n       53,  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,  470,\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\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       53, -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,  212,  212,\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      212,  212, -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       53, -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,  343,  343,\n      343,  343,  343,  343,  343,  343,  343,  343, -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       53, -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, -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       53, -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,  224,  224,\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      224,  224, -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       53, -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,  346,  346,\n\n      346,  346,  346,  346,  346,  346,  346,  346, -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       53, -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, -346, -346, -346, -346, -346,\n\n     -346, -346, -346, -346, -346, -346, -346, -346\n    },\n\n    {\n       53,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      471,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  472,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  347,  347,  347,  347,  347,  473,  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      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       53,  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      348,  348,  350,  348,  348,  348,  348,  348,  348,  348,\n      348,  348,  348,  348,  348,  348,  348,  351,  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       53, -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       53,  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      348,  348,  350,  348,  348,  348,  348,  348,  348,  348,\n      348,  348,  348,  348,  348,  348,  348,  351,  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      348,  348,  348,  348,  348,  348,  348,  348\n    },\n\n    {\n       53,  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      348,  348,  350,  348,  348,  348,  348,  348,  348,  348,\n      348,  348,  348,  348,  348,  348,  348,  351,  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      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       53,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      353,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  354,  352,  352,  352,  352,  352,  352,  352,\n\n      352,  352,  352,  352,  352,  352,  352,  355,  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       53, -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       53,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      353,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  354,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  355,  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\n    },\n\n    {\n       53,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n      475,  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,  477,  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,  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       53,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      353,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n\n      352,  352,  352,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  354,  352,  352,  352,  352,  352,  352,  352,\n      352,  352,  352,  352,  352,  352,  352,  355,  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\n      352,  352,  352,  352,  352,  352,  352,  352\n    },\n\n    {\n       53, -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       53,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      357,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  358,  356,  356,  356,  356,  356,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  359,  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\n    },\n\n    {\n       53,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n      479,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n      478,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n\n      478,  478,  480,  478,  478,  478,  478,  478,  478,  478,\n      478,  478,  478,  478,  478,  478,  478,  481,  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,  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    {\n       53, -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       53, -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, -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       53, -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,  482, -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\n    },\n\n    {\n       53, -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,  483, -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       53, -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,  484, -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       53, -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,  485, -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       53, -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,  486, -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       53, -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,  487, -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       53, -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,  488, -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       53, -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,  489,\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\n\n    },\n\n    {\n       53, -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,  490, -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       53, -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,  491, -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       53, -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,  492, -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       53, -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,  493, -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       53, -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,  494, -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       53, -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,  495, -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       53, -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,  496, -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       53, -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, -377, -377, -377, -377, -377, -377, -377,\n     -377, -377, -377, -377, -377, -377, -377, -377,  497, -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       53, -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     -378, -378, -378, -378, -378, -378,  498, -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       53, -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, -379,\n     -379, -379,  499, -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       53, -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, -380, -380, -380, -380,  500,\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       53, -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, -381,  501, -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       53, -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,  502, -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, -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       53, -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, -383, -383, -383, -383, -383,\n     -383, -383, -383, -383, -383, -383, -383, -383, -383, -383,\n     -383, -383,  503, -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       53, -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,  504, -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       53, -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,  505, -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     -385, -385, -385, -385, -385, -385, -385, -385\n    },\n\n    {\n       53, -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,  506, -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       53, -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,  507,\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       53, -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,  508,\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\n    },\n\n    {\n       53, -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,  509, -389, -389, -389, -389,\n     -389, -389, -389, -389, -389, -389, -389, -389, -389,  510,\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       53, -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,  511, -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       53, -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,  512,\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       53, -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,  513,\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       53, -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,  514,\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       53, -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,  515, -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       53, -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,  516, -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       53, -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,  517, -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       53, -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      518, -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       53, -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\n     -398, -398, -398, -398, -398, -398, -398,  519, -398, -398,\n     -398, -398, -398, -398, -398, -398, -398, -398, -398, -398,\n     -398, -398, -398,  520, -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       53, -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, -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      521, -399, -399, -399, -399, -399, -399, -399, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399,  522, -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, -399, -399,\n     -399, -399, -399, -399, -399, -399, -399, -399\n\n    },\n\n    {\n       53, -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,  523, -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       53, -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,  524,\n     -401, -401, -401,  525, -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       53, -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,  526, -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       53, -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,  527, -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       53, -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,  528,\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       53, -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,  529, -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       53, -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, -406, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406,  530, -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       53, -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, -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,  531, -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       53, -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,  532, -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       53, -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,  533,\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       53, -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,  534,\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       53, -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,  535, -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       53, -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,  536, -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       53, -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,  537, -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, -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       53, -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,  538, -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\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       53, -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,  539, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415,  540,  541,\n\n      541,  541,  541,  541,  541,  541,  541,  541, -415, -415,\n     -415, -415, -415, -415, -415,  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, -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       53, -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,  542, -416, -416, -416, -416, -416, -416, -416,\n     -416, -416, -416, -416, -416, -416, -416, -416,  540,  541,\n      541,  541,  541,  541,  541,  541,  541,  541, -416, -416,\n     -416, -416, -416, -416, -416,  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, -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       53, -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,  543, -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\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       53, -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,  544, -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, -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\n    },\n\n    {\n       53, -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,  545, -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, -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       53, -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,  546, -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\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       53, -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,  539, -421, -421, -421, -421, -421, -421, -421,\n     -421, -421, -421, -421, -421, -421, -421, -421,  547,  547,\n      547,  547,  547,  547,  547,  547,  547,  547, -421, -421,\n     -421, -421, -421, -421, -421,  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, -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\n    },\n\n    {\n       53, -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,  548, -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, -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       53, -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,  549, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423,  550,  550,\n      550,  550,  550,  550,  550,  550,  550,  550, -423, -423,\n     -423, -423, -423, -423, -423,  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, -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       53, -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,  551, -424, -424, -424, -424, -424, -424, -424,\n     -424, -424, -424, -424, -424, -424, -424, -424,  552,  552,\n      552,  552,  552,  552,  552,  552,  552,  552, -424, -424,\n     -424, -424, -424, -424, -424,  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,  551,\n      551, -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       53, -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,  553,  553,\n\n      553,  553,  553,  553,  553,  553,  553,  553, -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       53, -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,  554, -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,  555, -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       53, -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,  554, -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\n     -427, -427, -427, -427, -427,  556, -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       53, -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,  557,  557,\n      557,  557,  557,  557,  557,  557,  557,  557, -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, -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       53, -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,  554, -429, -429,  558,  558,\n      558,  558,  558,  558,  558,  558,  558,  558, -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,  559, -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       53, -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, -430, -430,  560,  561,\n      561,  561,  561,  561,  561,  561,  561,  561, -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, -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       53, -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,  562, -431, -431, -431, -431, -431, -431, -431,\n     -431, -431, -431, -431, -431, -431, -431, -431,  563,  563,\n      563,  563,  563,  563,  563,  563,  563,  563, -431, -431,\n     -431, -431, -431, -431, -431,  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, -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       53, -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,  564,  565,\n      565,  565,  565,  565,  565,  565,  565,  565, -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       53, -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, -433, -433, -433, -433, -433, -433, -433, -433,\n     -433, -433, -433, -433, -433,  554, -433, -433,  558,  558,\n      558,  558,  558,  558,  558,  558,  558,  558, -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,  555, -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       53, -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,  562, -434, -434, -434, -434, -434, -434, -434,\n     -434, -434, -434, -434, -434, -434, -434, -434,  566,  567,\n      567,  567,  567,  567,  567,  567,  567,  567, -434, -434,\n     -434, -434, -434, -434, -434,  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, -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       53, -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,  568, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435,  569,  569,\n\n      569,  569,  569,  569,  569,  569,  569,  569, -435, -435,\n     -435, -435, -435, -435, -435,  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, -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       53, -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,  570, -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       53, -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,  571, -437, -437, -437, -437, -437, -437, -437,\n     -437, -437, -437, -437, -437, -437, -437, -437,  572,  572,\n      572,  572,  572,  572,  572,  572,  572,  572, -437, -437,\n     -437, -437, -437, -437, -437,  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, -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       53, -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,  562, -438, -438, -438, -438, -438, -438, -438,\n     -438, -438, -438, -438, -438, -438, -438, -438,  573,  574,\n      574,  574,  574,  574,  574,  574,  574,  574, -438, -438,\n\n     -438, -438, -438, -438, -438,  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, -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       53, -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,  575, -439, -439, -439, -439, -439, -439, -439,\n     -439, -439, -439, -439, -439, -439, -439, -439,  576,  576,\n      576,  576,  576,  576,  576,  576,  576,  576, -439, -439,\n     -439, -439, -439, -439, -439,  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, -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       53, -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,  571, -440, -440, -440, -440, -440, -440, -440,\n     -440, -440, -440, -440, -440, -440, -440, -440,  577,  578,\n      578,  578,  578,  578,  578,  578,  578,  578, -440, -440,\n     -440, -440, -440, -440, -440,  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, -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       53, -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,  579, -441, -441, -441, -441, -441, -441, -441,\n     -441, -441, -441, -441, -441, -441, -441, -441,  580,  580,\n      580,  580,  580,  580,  580,  580,  580,  580, -441, -441,\n     -441, -441, -441, -441, -441,  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, -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       53, -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,  581, -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       53, -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,  582, -443, -443, -443, -443, -443, -443, -443,\n     -443, -443, -443, -443, -443, -443, -443, -443,  572,  572,\n      572,  572,  572,  572,  572,  572,  572,  572, -443, -443,\n     -443, -443, -443, -443, -443,  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, -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       53, -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,  583, -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       53, -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,  584, -445, -445, -445, -445, -445, -445, -445,\n     -445, -445, -445, -445, -445, -445, -445, -445,  585,  585,\n\n      585,  585,  585,  585,  585,  585,  585,  585, -445, -445,\n     -445, -445, -445, -445, -445,  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, -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       53, -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,  586, -446, -446, -446, -446, -446, -446, -446,\n     -446, -446, -446, -446, -446, -446, -446, -446,  587,  587,\n      587,  587,  587,  587,  587,  587,  587,  587, -446, -446,\n     -446, -446, -446, -446, -446,  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, -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       53, -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,  588,  588,\n      588,  588,  588,  588,  588,  588,  588,  588, -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       53, -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,  589, -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,  590, -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       53, -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,  589, -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,  591, -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       53, -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,  592,  592,\n      592,  592,  592,  592,  592,  592,  592,  592, -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       53, -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,  589, -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,  593, -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       53, -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, -452, -452, -452,  594,  595,\n      595,  595,  595,  595,  595,  595,  595,  595, -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       53, -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,  596, -453, -453, -453, -453, -453, -453, -453,\n     -453, -453, -453, -453, -453, -453, -453, -453,  597,  597,\n      597,  597,  597,  597,  597,  597,  597,  597, -453, -453,\n     -453, -453, -453, -453, -453,  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, -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       53, -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,  598,  599,\n      599,  599,  599,  599,  599,  599,  599,  599, -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       53, -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,  600, -455, -455, -455, -455, -455, -455, -455,\n     -455, -455, -455, -455, -455, -455, -455, -455,  601,  602,\n\n      602,  602,  602,  602,  602,  602,  602,  602, -455, -455,\n     -455, -455, -455, -455, -455,  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, -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       53, -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,  600, -456, -456, -456, -456, -456, -456, -456,\n     -456, -456, -456, -456, -456, -456, -456, -456,  603,  603,\n      603,  603,  603,  603,  603,  603,  603,  603, -456, -456,\n     -456, -456, -456, -456, -456,  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, -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       53, -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,  604, -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       53, -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,  605, -458, -458, -458, -458, -458, -458, -458,\n     -458, -458, -458, -458, -458, -458, -458, -458,  606,  606,\n      606,  606,  606,  606,  606,  606,  606,  606, -458, -458,\n\n     -458, -458, -458, -458, -458,  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, -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       53, -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,  607, -459, -459, -459, -459, -459, -459, -459,\n     -459, -459, -459, -459, -459, -459, -459, -459,  608,  609,\n      609,  609,  609,  609,  609,  609,  609,  609, -459, -459,\n     -459, -459, -459, -459, -459,  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, -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       53, -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,  607, -460, -460, -460, -460, -460, -460, -460,\n     -460, -460, -460, -460, -460, -460, -460, -460,  610,  610,\n      610,  610,  610,  610,  610,  610,  610,  610, -460, -460,\n     -460, -460, -460, -460, -460,  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, -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       53, -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,  611, -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       53, -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,  612, -462, -462, -462, -462, -462, -462, -462,\n\n     -462, -462, -462, -462, -462, -462, -462, -462,  613,  614,\n      614,  614,  614,  614,  614,  614,  614,  614, -462, -462,\n     -462, -462, -462, -462, -462,  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, -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       53, -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,  612, -463, -463, -463, -463, -463, -463, -463,\n     -463, -463, -463, -463, -463, -463, -463, -463,  615,  615,\n      615,  615,  615,  615,  615,  615,  615,  615, -463, -463,\n     -463, -463, -463, -463, -463,  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, -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       53, -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,  616, -464, -464, -464, -464, -464, -464, -464,\n     -464, -464, -464, -464, -464, -464, -464, -464,  606,  606,\n      606,  606,  606,  606,  606,  606,  606,  606, -464, -464,\n     -464, -464, -464, -464, -464,  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, -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       53, -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,  617, -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       53, -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,  618, -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       53, -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, -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       53, -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, -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       53,  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,  470,\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       53, -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,  469,\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       53, -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, -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       53,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      471,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  347,  347,  347,  347,  347,  347,  347,  347,\n      347,  347,  472,  347,  347,  347,  347,  347,  347,  347,\n\n      347,  347,  347,  347,  347,  347,  347,  473,  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\n    },\n\n    {\n       53,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n\n      620,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  621,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  622,  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,  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\n    },\n\n    {\n       53,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n      475,  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,  477,  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       53, -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       53,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n      475,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n\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,  477,  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,  474,\n      474,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n\n      474,  474,  474,  474,  474,  474,  474,  474\n    },\n\n    {\n       53,  474,  474,  474,  474,  474,  474,  474,  474,  474,\n      475,  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,  477,  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\n    },\n\n    {\n       53,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n      479,  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,  481,  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       53, -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, -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, -479, -479,\n     -479, -479, -479, -479, -479, -479, -479, -479\n\n    },\n\n    {\n       53,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n      479,  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,  481,  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\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       53,  478,  478,  478,  478,  478,  478,  478,  478,  478,\n      479,  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,  481,  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\n    },\n\n    {\n       53, -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,  623, -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       53, -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,  624, -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       53, -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, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484,  625,\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       53, -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\n     -485, -485, -485, -485, -485, -485, -485, -485, -485, -485,\n     -485, -485, -485, -485, -485, -485, -485, -485,  626, -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       53, -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, -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,  627, -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       53, -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,  628,\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       53, -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       53, -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       53, -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,  629,\n      630, -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       53, -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, -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       53, -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       53, -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, -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       53, -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, -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       53, -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       53, -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, -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       53, -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, -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       53, -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       53, -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, -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       53, -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     -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       53, -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\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       53, -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,  631, -502, -502, -502, -502,\n     -502, -502, -502, -502, -502, -502, -502, -502, -502,  632,\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       53, -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, -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     -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       53, -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,  633, -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       53, -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,  634, -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,  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, -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       53, -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,  635,\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       53, -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     -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,  636, -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       53, -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\n     -508, -508, -508, -508, -508, -508, -508, -508, -508, -508,\n     -508, -508, -508, -508, -508, -508,  637, -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       53, -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,  638, -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       53, -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,  639, -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       53, -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,  640, -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       53, -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,  641,\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       53, -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,  642, -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       53, -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,  643, -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       53, -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,  644, -515, -515, -515, -515,  645, -515, -515,\n     -515, -515, -515,  646, -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       53, -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,  647, -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       53, -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,  648, -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       53, -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, -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       53, -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, -519, -519, -519, -519,\n     -519, -519, -519,  649, -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       53, -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, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520,  650,\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       53, -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     -521, -521,  651, -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       53, -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,  652, -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       53, -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, -523, -523, -523, -523, -523, -523, -523, -523,\n     -523, -523, -523, -523, -523, -523, -523, -523, -523,  653,\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       53, -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,  654, -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       53, -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,  655, -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       53, -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, -526,\n     -526,  656, -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       53, -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, -527, -527, -527, -527, -527, -527, -527,\n     -527, -527, -527, -527, -527, -527, -527, -527, -527,  657,\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       53, -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      658, -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       53, -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,  659, -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       53, -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,  660,  660,\n      660,  660,  660,  660,  660,  660,  660,  660, -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       53, -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, -531, -531, -531, -531,  661,\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       53, -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,  662, -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       53, -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,  663, -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       53, -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,  664, -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       53, -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,  665, -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       53, -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,  666, -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       53, -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,  667, -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       53, -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,  668, -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       53, -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,  669, -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       53, -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,  670, -540, -540, -540, -540, -540, -540, -540,\n     -540, -540, -540, -540, -540, -540, -540, -540,  671,  672,\n      672,  672,  672,  672,  672,  672,  672,  672, -540, -540,\n     -540, -540, -540, -540, -540,  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, -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       53, -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,  673, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541,  671,  672,\n      672,  672,  672,  672,  672,  672,  672,  672, -541, -541,\n     -541, -541, -541, -541, -541,  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, -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       53, -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,  674, -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       53, -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,  675, -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       53, -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,  676, -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       53, -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,  677, -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       53, -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,  678, -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       53, -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,  670, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547,  671,  671,\n      671,  671,  671,  671,  671,  671,  671,  671, -547, -547,\n     -547, -547, -547, -547, -547,  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, -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       53, -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,  679, -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       53, -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,  680, -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       53, -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,  681, -550, -550, -550, -550, -550, -550, -550,\n     -550, -550, -550, -550, -550, -550, -550, -550,  682,  682,\n      682,  682,  682,  682,  682,  682,  682,  682, -550, -550,\n     -550, -550, -550, -550, -550,  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, -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       53, -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,  683, -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, -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       53, -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,  684, -552, -552, -552, -552, -552, -552, -552,\n\n     -552, -552, -552, -552, -552, -552, -552, -552,  685,  685,\n      685,  685,  685,  685,  685,  685,  685,  685, -552, -552,\n     -552, -552, -552, -552, -552,  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, -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       53, -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,  686, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553,  687,  687,\n      687,  687,  687,  687,  687,  687,  687,  687, -553, -553,\n     -553, -553, -553, -553, -553,  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, -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       53, -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,  688,  688,\n      688,  688,  688,  688,  688,  688,  688,  688, -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\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       53, -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,  689,  689,\n\n      689,  689,  689,  689,  689,  689,  689,  689, -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       53, -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,  689,  690,\n      690,  690,  690,  690,  690,  690,  690,  690, -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       53, -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,  691, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557,  692,  692,\n      692,  692,  692,  692,  692,  692,  692,  692, -557, -557,\n     -557, -557, -557, -557, -557,  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, -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       53, -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,  693,\n      693,  693,  693,  693,  693,  693,  693,  693, -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       53, -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,  689,  694,\n      694,  694,  694,  694,  694,  694,  694,  694, -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       53, -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,  691, -560, -560, -560, -560, -560, -560, -560,\n     -560, -560, -560, -560, -560, -560, -560, -560,  692,  695,\n      695,  695,  695,  695,  695,  695,  695,  695, -560, -560,\n     -560, -560, -560, -560, -560,  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, -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       53, -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,  696, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561,  697,  697,\n      697,  697,  697,  697,  697,  697,  697,  697, -561, -561,\n     -561, -561, -561, -561, -561,  696,  696,  696,  696,  696,\n\n      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,\n      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,\n      696, -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       53, -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,  698, -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       53, -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,  699, -563, -563, -563, -563, -563, -563, -563,\n     -563, -563, -563, -563, -563, -563, -563, -563,  700,  700,\n      700,  700,  700,  700,  700,  700,  700,  700, -563, -563,\n     -563, -563, -563, -563, -563,  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, -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       53, -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,  691, -564, -564, -564, -564, -564, -564, -564,\n     -564, -564, -564, -564, -564, -564, -564, -564,  692,  701,\n      701,  701,  701,  701,  701,  701,  701,  701, -564, -564,\n     -564, -564, -564, -564, -564,  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, -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       53, -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,  702, -565, -565, -565, -565, -565, -565, -565,\n     -565, -565, -565, -565, -565, -565, -565, -565,  703,  703,\n\n      703,  703,  703,  703,  703,  703,  703,  703, -565, -565,\n     -565, -565, -565, -565, -565,  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, -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       53, -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,  699, -566, -566, -566, -566, -566, -566, -566,\n     -566, -566, -566, -566, -566, -566, -566, -566,  700,  704,\n      704,  704,  704,  704,  704,  704,  704,  704, -566, -566,\n     -566, -566, -566, -566, -566,  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, -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       53, -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,  705, -567, -567, -567, -567, -567, -567, -567,\n     -567, -567, -567, -567, -567, -567, -567, -567,  706,  706,\n      706,  706,  706,  706,  706,  706,  706,  706, -567, -567,\n     -567, -567, -567, -567, -567,  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\n      705, -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       53, -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,  707, -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       53, -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,  708, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569,  700,  700,\n      700,  700,  700,  700,  700,  700,  700,  700, -569, -569,\n     -569, -569, -569, -569, -569,  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, -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       53, -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,  709, -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       53, -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,  710, -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       53, -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,  711, -572, -572, -572, -572, -572, -572, -572,\n\n     -572, -572, -572, -572, -572, -572, -572, -572,  712,  712,\n      712,  712,  712,  712,  712,  712,  712,  712, -572, -572,\n     -572, -572, -572, -572, -572,  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, -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       53, -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,  699, -573, -573, -573, -573, -573, -573, -573,\n     -573, -573, -573, -573, -573, -573, -573, -573,  700,  713,\n      713,  713,  713,  713,  713,  713,  713,  713, -573, -573,\n     -573, -573, -573, -573, -573,  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, -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       53, -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,  714, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574,  715,  715,\n      715,  715,  715,  715,  715,  715,  715,  715, -574, -574,\n     -574, -574, -574, -574, -574,  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, -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       53, -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,  716, -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, -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       53, -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,  717, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576,  700,  700,\n      700,  700,  700,  700,  700,  700,  700,  700, -576, -576,\n     -576, -576, -576, -576, -576,  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, -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       53, -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,  711, -577, -577, -577, -577, -577, -577, -577,\n     -577, -577, -577, -577, -577, -577, -577, -577,  712,  718,\n      718,  718,  718,  718,  718,  718,  718,  718, -577, -577,\n     -577, -577, -577, -577, -577,  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, -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       53, -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,  719, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578,  720,  720,\n      720,  720,  720,  720,  720,  720,  720,  720, -578, -578,\n\n     -578, -578, -578, -578, -578,  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, -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       53, -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,  721, -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     -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       53, -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,  722, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580,  712,  712,\n      712,  712,  712,  712,  712,  712,  712,  712, -580, -580,\n     -580, -580, -580, -580, -580,  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, -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       53, -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,  723, -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, -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       53, -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,  724, -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     -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       53, -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,  725, -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, -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       53, -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,  726, -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\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       53, -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,  727, -585, -585, -585, -585, -585, -585, -585,\n     -585, -585, -585, -585, -585, -585, -585, -585,  728,  728,\n\n      728,  728,  728,  728,  728,  728,  728,  728, -585, -585,\n     -585, -585, -585, -585, -585,  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, -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       53, -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,  729, -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, -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       53, -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,  730, -587, -587, -587, -587, -587, -587, -587,\n     -587, -587, -587, -587, -587, -587, -587, -587,  731,  731,\n      731,  731,  731,  731,  731,  731,  731,  731, -587, -587,\n     -587, -587, -587, -587, -587,  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, -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       53, -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,  732, -588, -588, -588, -588, -588, -588, -588,\n     -588, -588, -588, -588, -588, -588, -588, -588,  733,  733,\n      733,  733,  733,  733,  733,  733,  733,  733, -588, -588,\n\n     -588, -588, -588, -588, -588,  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, -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       53, -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,  734,  734,\n      734,  734,  734,  734,  734,  734,  734,  734, -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, -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       53, -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,  735,  735,\n      735,  735,  735,  735,  735,  735,  735,  735, -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\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       53, -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,  736,  736,\n      736,  736,  736,  736,  736,  736,  736,  736, -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     -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       53, -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,  737, -592, -592, -592, -592, -592, -592, -592,\n\n     -592, -592, -592, -592, -592, -592, -592, -592,  738,  738,\n      738,  738,  738,  738,  738,  738,  738,  738, -592, -592,\n     -592, -592, -592, -592, -592,  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, -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       53, -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,  739,  739,\n      739,  739,  739,  739,  739,  739,  739,  739, -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       53, -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,  740, -594, -594, -594, -594, -594, -594, -594,\n     -594, -594, -594, -594, -594, -594, -594, -594,  741,  741,\n      741,  741,  741,  741,  741,  741,  741,  741, -594, -594,\n     -594, -594, -594, -594, -594,  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, -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       53, -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,  740, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595,  742,  742,\n\n      742,  742,  742,  742,  742,  742,  742,  742, -595, -595,\n     -595, -595, -595, -595, -595,  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, -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       53, -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,  743, -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, -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       53, -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,  744, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597,  745,  745,\n      745,  745,  745,  745,  745,  745,  745,  745, -597, -597,\n     -597, -597, -597, -597, -597,  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\n      744, -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       53, -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,  746, -598, -598, -598, -598, -598, -598, -598,\n     -598, -598, -598, -598, -598, -598, -598, -598,  747,  747,\n      747,  747,  747,  747,  747,  747,  747,  747, -598, -598,\n\n     -598, -598, -598, -598, -598,  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, -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       53, -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,  746, -599, -599, -599, -599, -599, -599, -599,\n     -599, -599, -599, -599, -599, -599, -599, -599,  748,  748,\n      748,  748,  748,  748,  748,  748,  748,  748, -599, -599,\n     -599, -599, -599, -599, -599,  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, -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       53, -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,  749, -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       53, -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,  750, -601, -601, -601, -601, -601, -601, -601,\n     -601, -601, -601, -601, -601, -601, -601, -601,  751,  751,\n      751,  751,  751,  751,  751,  751,  751,  751, -601, -601,\n     -601, -601, -601, -601, -601,  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, -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       53, -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,  750, -602, -602, -602, -602, -602, -602, -602,\n\n     -602, -602, -602, -602, -602, -602, -602, -602,  752,  752,\n      752,  752,  752,  752,  752,  752,  752,  752, -602, -602,\n     -602, -602, -602, -602, -602,  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, -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       53, -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,  753, -603, -603, -603, -603, -603, -603, -603,\n     -603, -603, -603, -603, -603, -603, -603, -603,  745,  745,\n      745,  745,  745,  745,  745,  745,  745,  745, -603, -603,\n     -603, -603, -603, -603, -603,  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, -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       53, -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,  754, -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, -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       53, -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,  755, -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, -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\n    },\n\n    {\n       53, -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,  756, -606, -606, -606, -606, -606, -606, -606,\n     -606, -606, -606, -606, -606, -606, -606, -606,  757,  757,\n      757,  757,  757,  757,  757,  757,  757,  757, -606, -606,\n     -606, -606, -606, -606, -606,  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, -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       53, -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,  758, -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       53, -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,  759, -608, -608, -608, -608, -608, -608, -608,\n     -608, -608, -608, -608, -608, -608, -608, -608,  760,  760,\n      760,  760,  760,  760,  760,  760,  760,  760, -608, -608,\n\n     -608, -608, -608, -608, -608,  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, -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       53, -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,  759, -609, -609, -609, -609, -609, -609, -609,\n     -609, -609, -609, -609, -609, -609, -609, -609,  761,  761,\n      761,  761,  761,  761,  761,  761,  761,  761, -609, -609,\n     -609, -609, -609, -609, -609,  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, -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       53, -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,  762, -610, -610, -610, -610, -610, -610, -610,\n     -610, -610, -610, -610, -610, -610, -610, -610,  745,  745,\n      745,  745,  745,  745,  745,  745,  745,  745, -610, -610,\n     -610, -610, -610, -610, -610,  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, -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       53, -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,  763, -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       53, -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,  764, -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       53, -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,  765, -613, -613, -613, -613, -613, -613, -613,\n     -613, -613, -613, -613, -613, -613, -613, -613,  766,  766,\n      766,  766,  766,  766,  766,  766,  766,  766, -613, -613,\n     -613, -613, -613, -613, -613,  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, -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       53, -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,  765, -614, -614, -614, -614, -614, -614, -614,\n     -614, -614, -614, -614, -614, -614, -614, -614,  767,  767,\n      767,  767,  767,  767,  767,  767,  767,  767, -614, -614,\n     -614, -614, -614, -614, -614,  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, -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       53, -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,  768, -615, -615, -615, -615, -615, -615, -615,\n     -615, -615, -615, -615, -615, -615, -615, -615,  757,  757,\n\n      757,  757,  757,  757,  757,  757,  757,  757, -615, -615,\n     -615, -615, -615, -615, -615,  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, -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       53, -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,  769, -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, -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       53, -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,  770, -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\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       53, -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, -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       53,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      620,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n\n      619,  619,  621,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  622,  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,  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       53, -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, -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       53,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      620,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  621,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  622,  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,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619\n    },\n\n    {\n       53,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      620,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,\n      619,  619,  621,  619,  619,  619,  619,  619,  619,  619,\n\n      619,  619,  619,  619,  619,  619,  619,  622,  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,  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       53, -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,  771,\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\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623\n    },\n\n    {\n       53, -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,  772, -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, -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\n    },\n\n    {\n       53, -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     -625, -625, -625, -625, -625, -625, -625, -625, -625, -625,\n     -625, -625,  773, -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       53, -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, -626, -626,  774,\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       53, -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,  775, -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, -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       53, -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, -628,\n     -628, -628, -628, -628, -628, -628, -628, -628, -628, -628,\n     -628, -628,  776, -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       53, -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,  777, -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, -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       53, -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,  778, -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\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       53, -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, -631, -631, -631, -631,  779, -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       53, -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,  780, -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, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632\n    },\n\n    {\n       53, -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,  781, -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       53, -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,  782, -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       53, -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,  783, -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       53, -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,  784,\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       53, -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     -637, -637, -637, -637, -637, -637, -637, -637, -637, -637,\n     -637, -637, -637, -637, -637, -637, -637, -637, -637,  785,\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       53, -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, -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\n     -638, -638, -638, -638, -638, -638, -638, -638, -638, -638,\n     -638,  786, -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, -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       53, -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, -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,  787, -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       53, -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,  788, -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       53, -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,  789, -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       53, -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\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,  790, -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       53, -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, -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,  791, -643,\n     -643, -643, -643, -643, -643, -643, -643,  792, -643, -643,\n     -643, -643, -643,  793, -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       53, -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,  794, -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       53, -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,  795, -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       53, -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,  796, -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       53, -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,  797, -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       53, -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,  798, -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\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       53, -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, -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,  799,\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       53, -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, -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,  800, -650, -650, -650, -650, -650, -650,\n     -650, -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       53, -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, -651, -651,\n     -651, -651, -651, -651, -651, -651, -651, -651, -651,  801,\n\n     -651, -651, -651, -651, -651, -651, -651, -651, -651, -651,\n     -651,  802, -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       53, -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, -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,  803, -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       53, -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, -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,  804, -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       53, -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, -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\n     -654, -654, -654,  805, -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       53, -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\n     -655, -655, -655, -655, -655, -655, -655, -655, -655, -655,\n     -655, -655, -655, -655, -655, -655, -655,  806, -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       53, -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, -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,  807, -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       53, -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, -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,  808, -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       53, -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,  809, -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,  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, -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       53, -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, -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, -659,  810,\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, -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       53, -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,  811,  811,\n      811,  811,  811,  811,  811,  811,  811,  811, -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       53, -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, -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, -661, -661,\n\n     -661, -661, -661, -661, -661, -661, -661, -661, -661, -661,\n     -661, -661, -661,  812, -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, -661, -661,\n     -661, -661, -661, -661, -661, -661, -661, -661\n    },\n\n    {\n       53, -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\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,  813,\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       53, -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, -663, -663, -663, -663, -663, -663, -663, -663,\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, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663, -663, -663, -663, -663, -663, -663, -663,\n     -663, -663, -663,  814, -663, -663, -663, -663, -663, -663,\n     -663, -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       53, -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, -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, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n\n     -664, -664, -664,  815, -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, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664\n    },\n\n    {\n       53, -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, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665,  816,\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, -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       53, -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, -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       53, -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, -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, -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       53, -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\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       53, -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, -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, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669\n\n    },\n\n    {\n       53, -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     -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       53, -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, -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, -671, -671,\n\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, -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       53, -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, -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, -672, -672,\n     -672, -672, -672, -672, -672, -672, -672, -672\n    },\n\n    {\n       53, -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, -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     -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       53, -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, -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, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674, -674, -674,\n\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, -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       53, -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\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       53, -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, -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     -676, -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     -676, -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       53, -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, -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       53, -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\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       53, -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, -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, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679\n\n    },\n\n    {\n       53, -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     -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       53, -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, -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       53, -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\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       53, -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, -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     -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       53, -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, -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       53, -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, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n\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, -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, -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       53, -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, -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     -686, -686, -686, -686, -686, -686, -686, -686, -686, -686,\n\n     -686, -686, -686, -686, -686, -686, -686, -686\n    },\n\n    {\n       53, -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, -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, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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, -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     -696, -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     -696, -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       53, -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, -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, -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\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, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697\n    },\n\n    {\n       53, -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\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       53, -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       53, -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, -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, -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, -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       53, -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, -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, -701, -701,\n\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, -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       53, -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\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       53, -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       53, -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, -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, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n\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, -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       53, -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\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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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, -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       53, -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       53, -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       53, -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       53, -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       53, -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, -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       53, -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, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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, -731, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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     -736, -736, -736, -736, -736, -736, -736, -736, -736, -736,\n\n     -736, -736, -736, -736, -736, -736, -736, -736\n    },\n\n    {\n       53, -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, -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       53, -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, -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       53, -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, -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       53, -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     -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749\n\n    },\n\n    {\n       53, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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     -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       53, -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       53, -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       53, -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       53, -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, -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       53, -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, -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       53, -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       53, -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, -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, -762, -762, -762, -762, -762\n    },\n\n    {\n       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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       53, -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,  817, -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       53, -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,  818, -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       53, -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,  819, -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       53, -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,  820, -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       53, -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,  821, -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       53, -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,  822, -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       53, -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,  823, -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       53, -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,  824, -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       53, -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,  825, -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       53, -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,  826, -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       53, -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,  827, -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, -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       53, -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,  828, -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, -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       53, -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, -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       53, -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, -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       53, -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, -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       53, -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,  829, -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       53, -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,  830, -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       53, -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,  831, -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, -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       53, -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, -789, -789, -789, -789, -789,  832,  833,\n      834, -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       53, -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,  835, -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       53, -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,  836, -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, -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       53, -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,  837, -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, -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       53, -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,  838, -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,  839, -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       53, -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,  840, -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, -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       53, -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,  841, -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       53, -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,  842, -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, -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       53, -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,  843, -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\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       53, -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,  844, -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     -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       53, -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,  845, -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       53, -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       53, -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,  846, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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,  847, -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       53, -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,  848, -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,  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, -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       53, -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,  849,  849,\n      849,  849,  849,  849,  849,  849,  849,  849, -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       53, -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,  850, -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,  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, -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       53, -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       53, -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      851, -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       53, -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      852, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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,  853, -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       53, -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       53, -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       53, -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       53, -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,  854, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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       53, -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,  855, -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       53, -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       53, -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       53, -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,  856, -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       53, -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,  857, -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       53, -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,  858, -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       53, -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,  859, -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       53, -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,  860, -857, -857, -857, -857, -857, -857, -857,\n     -857, -857, -857,  861, -857,  861, -857, -857,  862,  862,\n      862,  862,  862,  862,  862,  862,  862,  862, -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       53, -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,  863, -858, -858, -858, -858, -858, -858, -858,\n     -858, -858, -858,  864, -858,  864, -858, -858,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865, -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       53, -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,  866, -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       53, -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,  861, -860,  861, -860, -860,  862,  862,\n      862,  862,  862,  862,  862,  862,  862,  862, -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       53, -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,  862,  862,\n      862,  862,  862,  862,  862,  862,  862,  862, -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       53, -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,  867, -862, -862, -862, -862, -862, -862, -862,\n\n     -862, -862, -862, -862, -862, -862, -862,  868,  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       53, -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,  864, -863,  864, -863, -863,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865, -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       53, -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,  865,  865,\n      865,  865,  865,  865,  865,  865,  865,  865, -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       53, -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       53, -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,  869, -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       53, -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,  868, -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       53,  870,  870,  870,  870,  870,  870,  870,  870,  870,\n     -868,  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,  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\n    },\n\n    {\n       53, -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,  871, -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       53,  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       53, -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,  872, -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       53, -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,  873, -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       53, -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,  874, -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       53, -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,  875, -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       53, -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,  876, -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       53, -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,  877, -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       53, -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,  878, -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       53, -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,  879, -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       53, -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,  880, -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       53, -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,  881, -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       53, -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,  882, -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       53, -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,  883, -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       53, -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,  884, -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       53, -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,  885, -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       53, -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,  886, -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       53, -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,  887, -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       53, -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,  888, -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       53, -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,  889, -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       53, -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,  890, -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       53, -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,  891, -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       53, -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,  892, -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       53, -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,  893, -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       53, -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,  894, -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       53, -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,  895, -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       53, -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,  896, -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       53, -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,  897, -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       53, -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,  898, -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       53, -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,  899, -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       53, -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,  900, -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       53, -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,  901, -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       53, -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,  902, -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       53, -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,  903, -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       53, -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,  904, -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       53, -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,  905, -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, -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       53, -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,  906, -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       53, -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,  907, -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       53, -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,  908, -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       53, -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,  909, -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, -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\n    },\n\n    {\n       53, -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,  910, -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       53, -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,  911, -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       53, -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,  912, -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       53, -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,  913, -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       53, -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,  914, -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       53, -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,  915, -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       53, -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,  916, -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       53, -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,  917, -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       53, -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,  918, -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       53, -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,  919, -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, -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       53, -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,  920, -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       53, -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,  921, -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       53, -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,  922, -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, -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\n    },\n\n    {\n       53, -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,  923, -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       53, -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,  924, -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       53, -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,  925, -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       53, -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,  926, -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, -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       53, -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,  927, -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, -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       53, -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,  928, -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       53, -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,  929, -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       53, -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,  930, -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       53, -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,  931, -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       53, -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,  932, -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       53, -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,  933, -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       53, -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,  934, -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       53, -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,  935, -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       53, -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,  936, -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       53, -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,  937, -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       53, -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, -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\nstatic yy_state_type yy_get_previous_state (void );\nstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\nstatic int yy_get_next_buffer (void );\nstatic void yy_fatal_error (yyconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up wcspihtext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\t(yytext_ptr) = yy_bp; \\\n\twcspihleng = (size_t) (yy_cp - yy_bp); \\\n\t(yy_hold_char) = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\t(yy_c_buf_p) = yy_cp;\n\n#define YY_NUM_RULES 239\n#define YY_END_OF_BUFFER 240\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 yyconst flex_int16_t yy_accept[938] =\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,  240,  239,   77,   77,   77,   77,   77,   77,\n       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,\n       77,   77,   98,   98,   98,  146,  146,  146,   99,   99,\n       99,  195,  195,  195,  149,  147,  148,  199,  199,  203,\n      203,  206,  206,  207,  207,  210,  210,  212,  212,  214,\n\n      214,  216,  216,  215,  218,  218,  218,  217,  220,  220,\n      222,  222,  224,  223,  226,  226,  229,  229,  229,  227,\n      230,  239,  231,  239,  239,  239,  236,  239,  237,  239,\n      238,    0,    0,   55,    0,   56,    5,    0,    0,    0,\n        0,    0,    0,    0,    0,   44,   45,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    4,    0,    0,    0,\n       18,   16,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  213,  215,    0,  217,  217,  217,\n      217,    0,    0,  219,    0,  221,  223,  225,    0,  227,\n      228,  228,  227,    0,    0,  233,    0,    0,    0,  231,\n        0,    0,    0,  231,    0,    0,    0,  236,    0,  237,\n        0,  238,    0,   57,    0,    0,   58,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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       95,   96,   97,   88,   87,   80,   81,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,  196,\n      197,  198,  200,  201,  202,    0,    0,    0,    0,    0,\n      217,    0,  217,  228,    0,  228,    0,    0,  232,    0,\n        0,    0,  234,    0,    0,    0,  231,    0,    0,   73,\n       74,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  208,  209,    0,  211,\n      235,    0,    0,    0,  232,    0,    0,    0,  231,    0,\n        0,    0,    0,    0,    0,    0,    0,    6,   19,    0,\n       42,   46,   43,   47,   20,    7,    3,   10,   21,    9,\n\n        8,    0,   48,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,   17,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  205,    0,  232,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,   89,   90,   91,   92,   93,\n       94,   86,   85,   84,   83,   82,   78,   79,  135,  137,\n      140,  144,  136,  139,  143,  138,  142,  141,  131,  109,\n      128,  132,  145,  120,  110,  106,  115,  126,  129,  133,\n\n      121,  118,  123,  111,  107,  116,  104,  113,  125,  127,\n      130,  134,  122,  119,  124,  102,  103,  112,  108,  117,\n      105,  114,  100,  101,  185,  187,  190,  194,  186,  189,\n      193,  188,  192,  191,  181,  159,  178,  182,  170,  156,\n      160,  165,  176,  179,  183,  168,  171,  173,  154,  157,\n      161,  166,  163,  175,  177,  180,  184,  152,  169,  172,\n      174,  153,  150,  155,  158,  162,  167,  164,  151,  204,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   25,   12,   11,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,   31,\n\n        0,   13,   15,   33,   34,   35,   36,   37,    0,    0,\n        0,    0,   40,    0,    0,   41,   51,   53,   49,   52,\n       54,   50,   59,   60,   22,   23,    0,   24,   26,   27,\n        0,   28,   29,   30,   72,   69,   70,   71,   68,   65,\n       66,   67,   61,   62,   32,   14,   38,   39,   75,    0,\n       63,   64,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    1,    0,    0,    2,    0,    1,    1,    0,    1,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,   76\n    } ;\n\nstatic yy_state_type yy_last_accepting_state;\nstatic char *yy_last_accepting_cpos;\n\nstatic yyconst yy_state_type yy_NUL_trans[938] =\n    {   0,\n       54,   55,   73,   73,   76,   76,   79,   79,   82,   82,\n       85,   85,   87,   87,   88,   88,   90,   90,   92,   92,\n       94,   94,   96,   96,   98,   98,  100,  100,  102,  102,\n      105,  105,  109,  109,  111,  111,  113,  113,  115,  115,\n      117,  117,   54,   54,  122,  122,  126,  126,  128,  128,\n      130,  130,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  213,\n        0,  215,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  225,    0,  229,  233,  237,    0,  239,    0,  241,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  213,    0,  215,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  225,    0,  347,  348,  352,    0,\n      356,  233,  233,    0,  233,  233,  237,    0,  239,    0,\n      241,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  469,\n        0,    0,    0,    0,    0,    0,  347,  348,    0,  348,\n      348,  352,    0,  352,  474,  352,    0,  356,  478,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  469,    0,\n        0,  347,  619,  474,    0,  474,  474,  478,    0,  478,\n      478,    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,  619,    0,\n      619,  619,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  870,    0,  870,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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\n    } ;\n\nextern int wcspih_flex_debug;\nint wcspih_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 yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\nchar *wcspihtext;\n#line 1 \"wcspih.l\"\n/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcspih.c,v 5.17 2017/09/18 08:44:24 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/* 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 <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 STRING  2\n#define RECORD  3\n\n#define PRIOR   1\n#define SEQUENT 2\n\n#define SIP     1\n#define DSS     2\n#define WAT     3\n\n#define YY_DECL int wcspih(char *header, int nkeyrec, int relax, int ctrl, \\\n                           int *nreject, int *nwcs, struct wcsprm **wcs)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (wcspih_nkeyrec) { \\\n\t    strncpy(inbuff, wcspih_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    wcspih_hdr += 80; \\\n\t    wcspih_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n/* These global variables are required by YY_INPUT. */\nchar *wcspih_hdr;\nint  wcspih_nkeyrec;\n\nint wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[],\n        char *wat[], int *nwcs, struct wcsprm **wcs);\nint wcspih_inits(int naxis, int alts[], int dpq[], int npv[], int nps[],\n        int ndp[], int ndq[], int distran, int *nwcs, struct wcsprm **wcs);\nvoid wcspih_naxes(int naxis, int i, int j, char a, int distype, int alts[],\n        int dpq[], int *npptr);\n\nint wcspih_epoch(double *wptr, double epoch);\nint wcspih_vsource(double *wptr, double vsource);\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcspih_abort_jmp_env;\n#define exit(status) longjmp(wcspih_abort_jmp_env, status)\n\n#line 17004 \"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 STRING_VAL 16\n#define RECORD_VAL 17\n#define RECFIELD 18\n#define RECCOLON 19\n#define RECVALUE 20\n#define RECEND 21\n#define COMMENT 22\n#define DISCARD 23\n#define ERROR 24\n#define FLUSH 25\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#ifndef YY_EXTRA_TYPE\n#define YY_EXTRA_TYPE void *\n#endif\n\nstatic int yy_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint wcspihlex_destroy (void );\n\nint wcspihget_debug (void );\n\nvoid wcspihset_debug (int debug_flag  );\n\nYY_EXTRA_TYPE wcspihget_extra (void );\n\nvoid wcspihset_extra (YY_EXTRA_TYPE user_defined  );\n\nFILE *wcspihget_in (void );\n\nvoid wcspihset_in  (FILE * in_str  );\n\nFILE *wcspihget_out (void );\n\nvoid wcspihset_out  (FILE * out_str  );\n\nyy_size_t wcspihget_leng (void );\n\nchar *wcspihget_text (void );\n\nint wcspihget_lineno (void );\n\nvoid wcspihset_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 YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int wcspihwrap (void );\n#else\nextern int wcspihwrap (void );\n#endif\n#endif\n\n    static void yyunput (int c,char *buf_ptr  );\n    \n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char *,yyconst char *,int );\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst char * );\n#endif\n\n#ifndef YY_NO_INPUT\n\n#ifdef __cplusplus\nstatic int yyinput (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 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( wcspihtext, wcspihleng, 1, wcspihout )) {} } 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 = read( fileno(wcspihin), (char *) 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(wcspihin); \\\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 )\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 wcspihlex (void);\n\n#define YY_DECL int wcspihlex (void)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after wcspihtext and wcspihleng\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 break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( wcspihleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(wcspihtext[wcspihleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp, *yy_bp;\n\tregister int yy_act;\n    \n\tif ( !(yy_init) )\n\t\t{\n\t\t(yy_init) = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! (yy_start) )\n\t\t\t(yy_start) = 1;\t/* first start state */\n\n\t\tif ( ! wcspihin )\n\t\t\twcspihin = stdin;\n\n\t\tif ( ! wcspihout )\n\t\t\twcspihout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\twcspihensure_buffer_stack ();\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\twcspih_create_buffer(wcspihin,YY_BUF_SIZE );\n\t\t}\n\n\t\twcspih_load_buffer_state( );\n\t\t}\n\n\t{\n#line 172 \"wcspih.l\"\n\n\t/* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */\n\tchar a;\n\tint  i, j, m, p, q;\n\t\n\tchar *cptr, *errmsg, errtxt[80], *hptr, *keep, *keyname, *keyrec,\n\t     keyword[16], strtmp[80], *wat[2], *watstr;\n\tint  altlin, alts[27], distran, distype, dpq[27], dssflag, gotone,\n\t     ialt, inttmp, ipass, ipx, ix, jx, naxis, ndp[27], ndq[27],\n\t     nother, *npptr, nps[27], npass, npv[27], nvalid, rectype,\n\t     sipflag, status, valtype, voff, watflag, watn;\n\tdouble dbltmp, dsstmp[20];\n\tvoid *vptr, *wptr;\n\tstruct disprm *disp, distem;\n\tstruct wcsprm *wcsp, wcstem;\n\tint (*special)(double *, double);\n\tint wcspihlex_destroy(void);\n\t\n\tnaxis = 0;\n\tfor (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/* Parameters used to implement YY_INPUT. */\n\twcspih_hdr = header;\n\twcspih_nkeyrec = nkeyrec;\n\t\n\t/* Our handle on the input stream. */\n\tkeyrec = header;\n\thptr = header;\n\tkeep = 0x0;\n\t\n\t/* For keeping tallies of keywords found. */\n\t*nreject = 0;\n\tnvalid = 0;\n\tnother = 0;\n\t\n\t/* If strict, then also reject. */\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t/* Keyword parameters. */\n\ti = j = 0;\n\tm = 0;\n\ta = ' ';\n\t\n\t/* For decoding the keyvalue. */\n\tvaltype = -1;\n\tdistype =  0;\n\tvptr    = 0x0;\n\t\n\t/* For keywords that require special handling. */\n\taltlin  = 0;\n\tnpptr   = 0x0;\n\tspecial = 0x0;\n\tdistran = 0;\n\tsipflag = 0;\n\tdssflag = 0;\n\twatflag = 0;\n\twatn    = 0;\n\t\n\t/* The data structures produced. */\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t/* Control variables. */\n\tipass = 1;\n\tnpass = 2;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcspih_abort_jmp_env)) {\n\t  return 3;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n#line 17312 \"wcspih.c\"\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = (yy_c_buf_p);\n\n\t\t/* Support of wcspihtext. */\n\t\t*yy_cp = (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 = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t\t(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 = (yy_hold_char);\n\t\t\tyy_cp = (yy_last_accepting_cpos) + 1;\n\t\t\tyy_current_state = (yy_last_accepting_state);\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 253 \"wcspih.l\"\n{\n\t  keyname = \"NAXISn\";\n\t\n\t  if (ipass == 1) {\n\t    sscanf(wcspihtext, \"NAXIS   = %d\", &naxis);\n\t    if (naxis < 0) naxis = 0;\n\t    BEGIN(FLUSH);\n\t\n\t  } else {\n\t    sscanf(wcspihtext, \"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 273 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"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 289 \"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 297 \"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 306 \"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 315 \"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 323 \"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 332 \"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 340 \"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 348 \"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 356 \"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 364 \"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 372 \"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 380 \"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 396 \"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 404 \"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 413 \"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 422 \"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 431 \"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 20:\nYY_RULE_SETUP\n#line 439 \"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 21:\nYY_RULE_SETUP\n#line 447 \"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 22:\nYY_RULE_SETUP\n#line 455 \"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 23:\nYY_RULE_SETUP\n#line 464 \"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 24:\nYY_RULE_SETUP\n#line 473 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"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 25:\nYY_RULE_SETUP\n#line 499 \"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 26:\nYY_RULE_SETUP\n#line 507 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-AVG\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 517 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"MJD-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 527 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-X\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 537 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Y\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 547 \"wcspih.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"OBSGEO-Z\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 557 \"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 32:\nYY_RULE_SETUP\n#line 565 \"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 33:\nYY_RULE_SETUP\n#line 584 \"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 34:\nYY_RULE_SETUP\n#line 592 \"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 35:\nYY_RULE_SETUP\n#line 600 \"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 36:\nYY_RULE_SETUP\n#line 608 \"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 37:\nYY_RULE_SETUP\n#line 616 \"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 38:\nYY_RULE_SETUP\n#line 624 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"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 39:\nYY_RULE_SETUP\n#line 649 \"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 40:\nYY_RULE_SETUP\n#line 669 \"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 41:\nYY_RULE_SETUP\n#line 677 \"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 42:\nYY_RULE_SETUP\n#line 685 \"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 43:\nYY_RULE_SETUP\n#line 694 \"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 44:\nYY_RULE_SETUP\n#line 703 \"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 45:\nYY_RULE_SETUP\n#line 713 \"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 46:\nYY_RULE_SETUP\n#line 723 \"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 47:\nYY_RULE_SETUP\n#line 732 \"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 48:\nYY_RULE_SETUP\n#line 741 \"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 49:\nYY_RULE_SETUP\n#line 750 \"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 50:\nYY_RULE_SETUP\n#line 763 \"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 51:\nYY_RULE_SETUP\n#line 776 \"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 52:\nYY_RULE_SETUP\n#line 789 \"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 53:\nYY_RULE_SETUP\n#line 802 \"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 54:\nYY_RULE_SETUP\n#line 815 \"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 55:\nYY_RULE_SETUP\n#line 828 \"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 56:\nYY_RULE_SETUP\n#line 837 \"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 57:\nYY_RULE_SETUP\n#line 846 \"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 58:\nYY_RULE_SETUP\n#line 855 \"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 59:\nYY_RULE_SETUP\n#line 864 \"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 60:\nYY_RULE_SETUP\n#line 876 \"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 61:\nYY_RULE_SETUP\n#line 888 \"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 62:\nYY_RULE_SETUP\n#line 900 \"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 63:\nYY_RULE_SETUP\n#line 912 \"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 64:\nYY_RULE_SETUP\n#line 924 \"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 65:\nYY_RULE_SETUP\n#line 936 \"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 66:\nYY_RULE_SETUP\n#line 948 \"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 67:\nYY_RULE_SETUP\n#line 960 \"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 68:\nYY_RULE_SETUP\n#line 972 \"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 69:\nYY_RULE_SETUP\n#line 984 \"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 70:\nYY_RULE_SETUP\n#line 996 \"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 71:\nYY_RULE_SETUP\n#line 1008 \"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 72:\nYY_RULE_SETUP\n#line 1020 \"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 73:\nYY_RULE_SETUP\n#line 1032 \"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 74:\nYY_RULE_SETUP\n#line 1041 \"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 75:\nYY_RULE_SETUP\n#line 1050 \"wcspih.l\"\n{\n\t  /* TNX or ZPX: string-encoded data array. */\n\t  sscanf(wcspihtext, \"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 76:\nYY_RULE_SETUP\n#line 1067 \"wcspih.l\"\n{\n\t  if (wcspih_nkeyrec) {\n\t    wcspih_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 77:\nYY_RULE_SETUP\n#line 1077 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 78:\n#line 1082 \"wcspih.l\"\ncase 79:\n#line 1083 \"wcspih.l\"\ncase 80:\n#line 1084 \"wcspih.l\"\ncase 81:\nYY_RULE_SETUP\n#line 1084 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"%d%c\", &i, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 82:\n#line 1090 \"wcspih.l\"\ncase 83:\n#line 1091 \"wcspih.l\"\ncase 84:\n#line 1092 \"wcspih.l\"\ncase 85:\n#line 1093 \"wcspih.l\"\ncase 86:\n#line 1094 \"wcspih.l\"\ncase 87:\n#line 1095 \"wcspih.l\"\ncase 88:\nYY_RULE_SETUP\n#line 1095 \"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 89:\n#line 1109 \"wcspih.l\"\ncase 90:\n#line 1110 \"wcspih.l\"\ncase 91:\n#line 1111 \"wcspih.l\"\ncase 92:\n#line 1112 \"wcspih.l\"\ncase 93:\n#line 1113 \"wcspih.l\"\ncase 94:\n#line 1114 \"wcspih.l\"\ncase 95:\n#line 1115 \"wcspih.l\"\ncase 96:\n#line 1116 \"wcspih.l\"\ncase 97:\nYY_RULE_SETUP\n#line 1116 \"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 98:\nYY_RULE_SETUP\n#line 1123 \"wcspih.l\"\n{\n\t  /* Let it go. */\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 99:\nYY_RULE_SETUP\n#line 1128 \"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 100:\n#line 1143 \"wcspih.l\"\ncase 101:\n#line 1144 \"wcspih.l\"\ncase 102:\n#line 1145 \"wcspih.l\"\ncase 103:\nYY_RULE_SETUP\n#line 1145 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"%d_%d%c\", &i, &j, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 104:\n#line 1152 \"wcspih.l\"\ncase 105:\n#line 1153 \"wcspih.l\"\ncase 106:\n#line 1154 \"wcspih.l\"\ncase 107:\n#line 1155 \"wcspih.l\"\ncase 108:\n#line 1156 \"wcspih.l\"\ncase 109:\n#line 1157 \"wcspih.l\"\ncase 110:\n#line 1158 \"wcspih.l\"\ncase 111:\n#line 1159 \"wcspih.l\"\ncase 112:\n#line 1160 \"wcspih.l\"\ncase 113:\n#line 1161 \"wcspih.l\"\ncase 114:\n#line 1162 \"wcspih.l\"\ncase 115:\n#line 1163 \"wcspih.l\"\ncase 116:\n#line 1164 \"wcspih.l\"\ncase 117:\n#line 1165 \"wcspih.l\"\ncase 118:\n#line 1166 \"wcspih.l\"\ncase 119:\n#line 1167 \"wcspih.l\"\ncase 120:\n#line 1168 \"wcspih.l\"\ncase 121:\n#line 1169 \"wcspih.l\"\ncase 122:\n#line 1170 \"wcspih.l\"\ncase 123:\n#line 1171 \"wcspih.l\"\ncase 124:\nYY_RULE_SETUP\n#line 1171 \"wcspih.l\"\n{\n\t  if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) ||\n\t      ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) {\n\t    sscanf(wcspihtext, \"%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 125:\n#line 1189 \"wcspih.l\"\ncase 126:\n#line 1190 \"wcspih.l\"\ncase 127:\n#line 1191 \"wcspih.l\"\ncase 128:\n#line 1192 \"wcspih.l\"\ncase 129:\n#line 1193 \"wcspih.l\"\ncase 130:\n#line 1194 \"wcspih.l\"\ncase 131:\n#line 1195 \"wcspih.l\"\ncase 132:\n#line 1196 \"wcspih.l\"\ncase 133:\n#line 1197 \"wcspih.l\"\ncase 134:\nYY_RULE_SETUP\n#line 1197 \"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 135:\n#line 1205 \"wcspih.l\"\ncase 136:\n#line 1206 \"wcspih.l\"\ncase 137:\n#line 1207 \"wcspih.l\"\ncase 138:\n#line 1208 \"wcspih.l\"\ncase 139:\n#line 1209 \"wcspih.l\"\ncase 140:\n#line 1210 \"wcspih.l\"\ncase 141:\n#line 1211 \"wcspih.l\"\ncase 142:\n#line 1212 \"wcspih.l\"\ncase 143:\n#line 1213 \"wcspih.l\"\ncase 144:\nYY_RULE_SETUP\n#line 1213 \"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 145:\nYY_RULE_SETUP\n#line 1220 \"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(wcspihtext, \"%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 146:\nYY_RULE_SETUP\n#line 1241 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 147:\n#line 1246 \"wcspih.l\"\ncase 148:\nYY_RULE_SETUP\n#line 1246 \"wcspih.l\"\n{\n\t  if (YY_START == CCCCCCCa) {\n\t    sscanf(wcspihtext, \"%c\", &a);\n\t  } else {\n\t    unput(wcspihtext[0]);\n\t    a = 0;\n\t  }\n\t\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 149:\nYY_RULE_SETUP\n#line 1257 \"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 150:\n#line 1272 \"wcspih.l\"\ncase 151:\n#line 1273 \"wcspih.l\"\ncase 152:\n#line 1274 \"wcspih.l\"\ncase 153:\nYY_RULE_SETUP\n#line 1274 \"wcspih.l\"\n{\n\t  sscanf(wcspihtext, \"%d_%d%c\", &i, &m, &a);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 154:\n#line 1280 \"wcspih.l\"\ncase 155:\n#line 1281 \"wcspih.l\"\ncase 156:\n#line 1282 \"wcspih.l\"\ncase 157:\n#line 1283 \"wcspih.l\"\ncase 158:\n#line 1284 \"wcspih.l\"\ncase 159:\n#line 1285 \"wcspih.l\"\ncase 160:\n#line 1286 \"wcspih.l\"\ncase 161:\n#line 1287 \"wcspih.l\"\ncase 162:\n#line 1288 \"wcspih.l\"\ncase 163:\n#line 1289 \"wcspih.l\"\ncase 164:\n#line 1290 \"wcspih.l\"\ncase 165:\n#line 1291 \"wcspih.l\"\ncase 166:\n#line 1292 \"wcspih.l\"\ncase 167:\n#line 1293 \"wcspih.l\"\ncase 168:\n#line 1294 \"wcspih.l\"\ncase 169:\n#line 1295 \"wcspih.l\"\ncase 170:\n#line 1296 \"wcspih.l\"\ncase 171:\n#line 1297 \"wcspih.l\"\ncase 172:\n#line 1298 \"wcspih.l\"\ncase 173:\n#line 1299 \"wcspih.l\"\ncase 174:\nYY_RULE_SETUP\n#line 1299 \"wcspih.l\"\n{\n\t  if (((valtype == FLOAT)  && (relax & WCSHDR_PV0i_0ma)) ||\n\t      ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) {\n\t    sscanf(wcspihtext, \"%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 175:\n#line 1317 \"wcspih.l\"\ncase 176:\n#line 1318 \"wcspih.l\"\ncase 177:\n#line 1319 \"wcspih.l\"\ncase 178:\n#line 1320 \"wcspih.l\"\ncase 179:\n#line 1321 \"wcspih.l\"\ncase 180:\n#line 1322 \"wcspih.l\"\ncase 181:\n#line 1323 \"wcspih.l\"\ncase 182:\n#line 1324 \"wcspih.l\"\ncase 183:\n#line 1325 \"wcspih.l\"\ncase 184:\nYY_RULE_SETUP\n#line 1325 \"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 185:\n#line 1333 \"wcspih.l\"\ncase 186:\n#line 1334 \"wcspih.l\"\ncase 187:\n#line 1335 \"wcspih.l\"\ncase 188:\n#line 1336 \"wcspih.l\"\ncase 189:\n#line 1337 \"wcspih.l\"\ncase 190:\n#line 1338 \"wcspih.l\"\ncase 191:\n#line 1339 \"wcspih.l\"\ncase 192:\n#line 1340 \"wcspih.l\"\ncase 193:\n#line 1341 \"wcspih.l\"\ncase 194:\nYY_RULE_SETUP\n#line 1341 \"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 195:\nYY_RULE_SETUP\n#line 1348 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 196:\n#line 1353 \"wcspih.l\"\ncase 197:\n#line 1354 \"wcspih.l\"\ncase 198:\nYY_RULE_SETUP\n#line 1354 \"wcspih.l\"\n{\n\t  a = ' ';\n\t  sscanf(wcspihtext, \"%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 199:\nYY_RULE_SETUP\n#line 1376 \"wcspih.l\"\n{\n\t  yyless(0);\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 200:\nYY_RULE_SETUP\n#line 1381 \"wcspih.l\"\n{\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(wcspihtext, \"%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 201:\n#line 1398 \"wcspih.l\"\ncase 202:\nYY_RULE_SETUP\n#line 1398 \"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 203:\nYY_RULE_SETUP\n#line 1408 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 204:\n#line 1413 \"wcspih.l\"\ncase 205:\nYY_RULE_SETUP\n#line 1413 \"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(wcspihtext, \"%d_%d\", &p, &q);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 206:\n#line 1428 \"wcspih.l\"\ncase 207:\nYY_RULE_SETUP\n#line 1428 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 208:\n#line 1433 \"wcspih.l\"\ncase 209:\nYY_RULE_SETUP\n#line 1433 \"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(wcspihtext, \"%d\", &m);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 210:\nYY_RULE_SETUP\n#line 1447 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 211:\n/* rule 211 can match eol */\nYY_RULE_SETUP\n#line 1451 \"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(wcspihtext, \"= '%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 212:\nYY_RULE_SETUP\n#line 1462 \"wcspih.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 213:\nYY_RULE_SETUP\n#line 1466 \"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 == 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 214:\nYY_RULE_SETUP\n#line 1500 \"wcspih.l\"\n{\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 215:\nYY_RULE_SETUP\n#line 1505 \"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(wcspihtext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 216:\nYY_RULE_SETUP\n#line 1517 \"wcspih.l\"\n{\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 217:\nYY_RULE_SETUP\n#line 1522 \"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(wcspihtext, &dbltmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 218:\nYY_RULE_SETUP\n#line 1534 \"wcspih.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 219:\n/* rule 219 can match eol */\nYY_RULE_SETUP\n#line 1539 \"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, wcspihtext+1);\n\t\n\t    /* Squeeze out repeated quotes. */\n\t    ix = 0;\n\t    for (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 220:\nYY_RULE_SETUP\n#line 1568 \"wcspih.l\"\n{\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 221:\n/* rule 221 can match eol */\nYY_RULE_SETUP\n#line 1573 \"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 222:\nYY_RULE_SETUP\n#line 1584 \"wcspih.l\"\n{\n\t  errmsg = \"a record was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 223:\nYY_RULE_SETUP\n#line 1589 \"wcspih.l\"\n{\n\t  strcpy(strtmp, wcspihtext);\n\t  BEGIN(RECCOLON);\n\t}\n\tYY_BREAK\ncase 224:\nYY_RULE_SETUP\n#line 1594 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record field\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 225:\nYY_RULE_SETUP\n#line 1599 \"wcspih.l\"\n{\n\t  BEGIN(RECVALUE);\n\t}\n\tYY_BREAK\ncase 226:\nYY_RULE_SETUP\n#line 1603 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 227:\nYY_RULE_SETUP\n#line 1608 \"wcspih.l\"\n{\n\t  rectype = 0;\n\t  sscanf(wcspihtext, \"%d\", &inttmp);\n\t  BEGIN(RECEND);\n\t}\n\tYY_BREAK\ncase 228:\nYY_RULE_SETUP\n#line 1614 \"wcspih.l\"\n{\n\t  rectype = 1;\n\t  wcsutil_str2double(wcspihtext, &dbltmp);\n\t  BEGIN(RECEND);\n\t}\n\tYY_BREAK\ncase 229:\nYY_RULE_SETUP\n#line 1620 \"wcspih.l\"\n{\n\t  errmsg = \"invalid record value\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 230:\nYY_RULE_SETUP\n#line 1625 \"wcspih.l\"\n{\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 231:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1629 \"wcspih.l\"\n{\n\t  if (ipass == 1) {\n\t    /* Do first-pass bookkeeping. */\n\t    wcspih_naxes(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    gotone = 0;\n\t    for (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          disp = (*wcs)->lin.dispre;\n\t          ipx = (disp->ndp)++;\n\t\n\t          /* SIP doesn't have alternates. */\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              disp = (*wcs)->lin.disseq;\n\t              ipx = (disp->ndp)++;\n\t\n\t              /* DSS doesn't have alternates. */\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          wcsp = *wcs + ialt;\n\t          if (distype == 0) {\n\t            voff = (char *)vptr - (char *)(&wcstem);\n\t            wptr = (void *)((char *)wcsp + voff);\n\t\n\t          } else {\n\t            voff = (char *)vptr - (char *)(&distem);\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            wptr = (void *)((char *)disp + 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              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 == STRING) {\n\t            /* Apply keyword parameterization. */\n\t            if (npptr == nps) {\n\t              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            cptr = (char *)wptr;\n\t            strcpy(cptr, strtmp);\n\t\n\t          } else if (valtype == RECORD) {\n\t            ipx = (disp->ndp)++;\n\t\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            \"recognised 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 232:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1806 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 233:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1811 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 234:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1816 \"wcspih.l\"\n{\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 235:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1821 \"wcspih.l\"\n{\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 236:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1826 \"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 237:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcspihtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcspihtext again */\nYY_RULE_SETUP\n#line 1841 \"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 238:\n/* rule 238 can match eol */\nYY_RULE_SETUP\n#line 1858 \"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  /* 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  special = 0x0;\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(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 1888 \"wcspih.l\"\n{\n\t  /* End-of-input. */\n\t  if (ipass == 1) {\n\t    if ((status = wcspih_inits(naxis, alts, dpq, npv, nps, ndp, ndq,\n\t                               distran, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      wcspihlex_destroy();\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    wcspih_hdr = header;\n\t    wcspih_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    special = 0x0;\n\t    sipflag = 0;\n\t    dssflag = 0;\n\t    watflag = 0;\n\t\n\t    wcspihrestart(wcspihin);\n\t\n\t  } else {\n\t    wcspihlex_destroy();\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 239:\nYY_RULE_SETUP\n#line 1961 \"wcspih.l\"\nECHO;\n\tYY_BREAK\n#line 19624 \"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 - (yytext_ptr)) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = (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 wcspihin at a new source and called\n\t\t\t * wcspihlex().  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\t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = wcspihin;\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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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\t(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_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 * 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 );\n\n\t\t\tyy_bp = (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 = ++(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 = (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(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(yy_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( wcspihwrap( ) )\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 * wcspihtext, 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\t(yy_c_buf_p) = (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 ( ! (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\t(yy_c_buf_p) =\n\t\t\t\t\t(yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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\t(yy_c_buf_p) =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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 wcspihlex */\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 (void)\n{\n    \tregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tregister char *source = (yytext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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 ( (yy_c_buf_p) - (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) ((yy_c_buf_p) - (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 = (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) ((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\tyy_size_t 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\twcspihrealloc((void *) b->yy_ch_buf,b->yy_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->yy_ch_buf = 0;\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\t(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\t(yy_n_chars), num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tif ( (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\twcspihrestart(wcspihin  );\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 ((yy_size_t) ((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\tyy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcspihrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\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}\n\n\t(yy_n_chars) += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\n\n\t(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 (void)\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp;\n    \n\tyy_current_state = (yy_start);\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(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 )\n{\n\tregister int yy_is_jam;\n    \tregister char *yy_cp = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(yy_last_accepting_cpos) = yy_cp;\n\t\t\t}\n\t\t}\n\n\t\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n    static void yyunput (int c, register char * yy_bp )\n{\n\tregister char *yy_cp;\n    \n    yy_cp = (yy_c_buf_p);\n\n\t/* undo effects of setting up wcspihtext */\n\t*yy_cp = (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\tregister yy_size_t number_to_move = (yy_n_chars) + 2;\n\t\tregister char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tregister char *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\t(yy_n_chars) = 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\t(yytext_ptr) = yy_bp;\n\t(yy_hold_char) = *yy_cp;\n\t(yy_c_buf_p) = yy_cp;\n}\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(yy_c_buf_p) = (yy_hold_char);\n\n\tif ( *(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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(yy_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tyy_size_t offset = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t++(yy_c_buf_p);\n\n\t\t\tswitch ( yy_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 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\twcspihrestart(wcspihin );\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 ( wcspihwrap( ) )\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tif ( ! (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();\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(yy_c_buf_p) = (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 *) (yy_c_buf_p);\t/* cast for 8-bit char's */\n\t*(yy_c_buf_p) = '\\0';\t/* preserve wcspihtext */\n\t(yy_hold_char) = *++(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 * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void wcspihrestart  (FILE * input_file )\n{\n    \n\tif ( ! YY_CURRENT_BUFFER ){\n        wcspihensure_buffer_stack ();\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            wcspih_create_buffer(wcspihin,YY_BUF_SIZE );\n\t}\n\n\twcspih_init_buffer(YY_CURRENT_BUFFER,input_file );\n\twcspih_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void wcspih_switch_to_buffer  (YY_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\twcspihpop_buffer_state();\n\t *\t\twcspihpush_buffer_state(new_buffer);\n     */\n\twcspihensure_buffer_stack ();\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*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\twcspih_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (wcspihwrap()) processing, but the only time this flag\n\t * is looked at is after wcspihwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(yy_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void wcspih_load_buffer_state  (void)\n{\n    \t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\twcspihin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\t(yy_hold_char) = *(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 * \n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE wcspih_create_buffer  (FILE * file, int  size )\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) wcspihalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspih_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 *) wcspihalloc(b->yy_buf_size + 2  );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspih_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\twcspih_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with wcspih_create_buffer()\n * \n */\n    void wcspih_delete_buffer (YY_BUFFER_STATE  b )\n{\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\twcspihfree((void *) b->yy_ch_buf  );\n\n\twcspihfree((void *) b  );\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 wcspihrestart() or at EOF.\n */\n    static void wcspih_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\twcspih_flush_buffer(b );\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then wcspih_init_buffer was _probably_\n     * called from wcspihrestart() 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 * \n */\n    void wcspih_flush_buffer (YY_BUFFER_STATE  b )\n{\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\twcspih_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 wcspihpush_buffer_state (YY_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\twcspihensure_buffer_stack();\n\n\t/* This block is copied from wcspih_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\t(yy_buffer_stack_top)++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from wcspih_switch_to_buffer. */\n\twcspih_load_buffer_state( );\n\t(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 *  \n */\nvoid wcspihpop_buffer_state (void)\n{\n    \tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\twcspih_delete_buffer(YY_CURRENT_BUFFER );\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((yy_buffer_stack_top) > 0)\n\t\t--(yy_buffer_stack_top);\n\n\tif (YY_CURRENT_BUFFER) {\n\t\twcspih_load_buffer_state( );\n\t\t(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 wcspihensure_buffer_stack (void)\n{\n\tyy_size_t num_to_alloc;\n    \n\tif (!(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\t\tnum_to_alloc = 1;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcspihalloc\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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspihensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\t\t\t\t\n\t\t(yy_buffer_stack_max) = num_to_alloc;\n\t\t(yy_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((yy_buffer_stack_top) >= ((yy_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 = (yy_buffer_stack_max) + grow_size;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcspihrealloc\n\t\t\t\t\t\t\t\t((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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspihensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\t(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 * \n * @return the newly allocated buffer state object. \n */\nYY_BUFFER_STATE wcspih_scan_buffer  (char * base, yy_size_t  size )\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 0;\n\n\tb = (YY_BUFFER_STATE) wcspihalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspih_scan_buffer()\" );\n\n\tb->yy_buf_size = 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 = 0;\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\twcspih_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to wcspihlex() will\n * scan from a @e copy of @a str.\n * @param yystr 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 *       wcspih_scan_bytes() instead.\n */\nYY_BUFFER_STATE wcspih_scan_string (yyconst char * yystr )\n{\n    \n\treturn wcspih_scan_bytes(yystr,strlen(yystr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to wcspihlex() 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 * \n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE wcspih_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tyy_size_t i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _yybytes_len + 2;\n\tbuf = (char *) wcspihalloc(n  );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcspih_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 = wcspih_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in wcspih_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 yy_fatal_error (yyconst char* msg )\n{\n    \t(void) fprintf( 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 wcspihtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\twcspihtext[wcspihleng] = (yy_hold_char); \\\n\t\t(yy_c_buf_p) = wcspihtext + yyless_macro_arg; \\\n\t\t(yy_hold_char) = *(yy_c_buf_p); \\\n\t\t*(yy_c_buf_p) = '\\0'; \\\n\t\twcspihleng = yyless_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 wcspihget_lineno  (void)\n{\n        \n    return wcspihlineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *wcspihget_in  (void)\n{\n        return wcspihin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *wcspihget_out  (void)\n{\n        return wcspihout;\n}\n\n/** Get the length of the current token.\n * \n */\nyy_size_t wcspihget_leng  (void)\n{\n        return wcspihleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *wcspihget_text  (void)\n{\n        return wcspihtext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid wcspihset_lineno (int  line_number )\n{\n    \n    wcspihlineno = 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 wcspih_switch_to_buffer\n */\nvoid wcspihset_in (FILE *  in_str )\n{\n        wcspihin = in_str ;\n}\n\nvoid wcspihset_out (FILE *  out_str )\n{\n        wcspihout = out_str ;\n}\n\nint wcspihget_debug  (void)\n{\n        return wcspih_flex_debug;\n}\n\nvoid wcspihset_debug (int  bdebug )\n{\n        wcspih_flex_debug = bdebug ;\n}\n\nstatic int yy_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from wcspihlex_destroy(), so don't allocate here.\n     */\n\n    (yy_buffer_stack) = 0;\n    (yy_buffer_stack_top) = 0;\n    (yy_buffer_stack_max) = 0;\n    (yy_c_buf_p) = (char *) 0;\n    (yy_init) = 0;\n    (yy_start) = 0;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    wcspihin = stdin;\n    wcspihout = stdout;\n#else\n    wcspihin = (FILE *) 0;\n    wcspihout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * wcspihlex_init()\n     */\n    return 0;\n}\n\n/* wcspihlex_destroy is for both reentrant and non-reentrant scanners. */\nint wcspihlex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\twcspih_delete_buffer(YY_CURRENT_BUFFER  );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\twcspihpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\twcspihfree((yy_buffer_stack) );\n\t(yy_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * wcspihlex() is called, initialization will occur. */\n    yy_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, yyconst 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 YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst 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 *wcspihalloc (yy_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *wcspihrealloc  (void * ptr, yy_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 wcspihfree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see wcspihrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 1960 \"wcspih.l\"\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_naxes(\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  int ialt, *ip;\n\n  if (a == 0) {\n    return;\n  }\n\n  ialt = 0;\n  if (a != ' ') {\n    ialt = a - 'A' + 1;\n  }\n\n  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_inits(\n  int naxis,\n  int alts[],\n  int dpq[],\n  int npv[],\n  int nps[],\n  int ndp[],\n  int ndq[],\n  int distran,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, defaults, ndis, ndpmax, npsmax, npvmax, status = 0;\n  struct wcsprm *wcsp;\n  struct disprm *dis;\n\n  /* Find the number of coordinate descriptions. */\n  *nwcs = 0;\n  for (ialt = 0; ialt < 27; ialt++) {\n    if (alts[ialt]) (*nwcs)++;\n  }\n\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_naxes(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    /* Record the current values of NPVMAX, NPSMAX, and NDPMAX. */\n    npvmax = wcsnpv(-1);\n    npsmax = wcsnps(-1);\n    ndpmax = disndp(-1);\n\n    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    wcsp = *wcs;\n    *nwcs = 0;\n    for (ialt = 0; ialt < 27; ialt++) {\n      if (alts[ialt]) {\n        wcsp->flag = -1;\n        wcsnpv(npv[ialt]);\n        wcsnps(nps[ialt]);\n        if ((status = wcsini(1, alts[ialt], wcsp))) {\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 distortions present? */\n        if (dpq[ialt] & 1) {\n          if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          /* Attach it to linprm.  Also inits it. */\n          ndis++;\n          disndp(ndp[ialt]);\n          dis->flag = -1;\n          lindis(1, &(wcsp->lin), dis);\n        }\n\n        if (dpq[ialt] & 2) {\n          if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n            return WCSHDRERR_MEMORY;\n          }\n\n          /* Attach it to linprm.  Also inits it. */\n          ndis++;\n          disndp(ndq[ialt]);\n          dis->flag = -1;\n          lindis(2, &(wcsp->lin), dis);\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    /* Restore the original values of NPVMAX, NPSMAX, and NDPMAX. */\n    wcsnpv(npvmax);\n    wcsnps(npsmax);\n    if (ndis) disndp(ndpmax);\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 EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcspih_epoch(double *equinox, 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, double vsource)\n\n{\n  double beta, 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    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* 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  char   field[16], *wp, wpoly[12], wtype[8];\n  int    i, ialt, idp, ipv, m, npv, n, nterms, omax, omin, status, wctrl[4];\n  double A1, A2, A3, B1, B2, B3, CNPIX1, CNPIX2, *crval, Rx, Ry, S, wval,\n         X0, Y0, Xc, Yc;\n  struct disprm *disp;\n  struct wcsprm *wcsp;\n\n  for (ialt = 0; ialt < *nwcs; ialt++) {\n    /* Interpret -TAB header keywords. */\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  wcsp = *wcs;\n  if (distran == SIP) {\n    /* SIP doesn't have alternates, nor axis mapping. */\n    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    CNPIX1 = dsstmp[0];\n    CNPIX2 = dsstmp[1];\n\n    Xc = dsstmp[2]/1000.0;\n    Yc = dsstmp[3]/1000.0;\n    Rx = dsstmp[4]/1000.0;\n    Ry = dsstmp[5]/1000.0;\n\n    A1 = dsstmp[14];\n    A2 = dsstmp[15];\n    A3 = dsstmp[16];\n    B1 = dsstmp[17];\n    B2 = dsstmp[18];\n    B3 = dsstmp[19];\n    S  = sqrt(fabs(A1*B1 - A2*B2));\n\n    X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2);\n    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    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    disp = wcsp->lin.disseq;\n\n    /* Decipher the core dump stored in the WATi_m strings. */\n    nterms = 0;\n    for (i = 0; i < 2; i++) {\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        lindis(2, &(wcsp->lin), 0x0);\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        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 (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) {\n          if ((wp = strstr(wp, \"projp\")) == 0x0) break;\n\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 (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    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 (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      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      for (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 (n = 0; n < wctrl[2]; n++) {\n        for (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":13630,"name":"wcsunits.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsunits.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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 the 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*   Translation of non-standard unit specifications: apart from leading and\n*   trailing blanks, a case-sensitive match is required for the aliases listed\n*   below, in particular the only recognized aliases with metric prefixes are\n*   \"KM\", \"KHZ\", \"MHZ\", and \"GHZ\".  Potentially unsafe translations of \"D\",\n*   \"H\", and \"S\", shown in parentheses, are optional.\n*\n=     Unit       Recognized aliases\n=     ----       -------------------------------------------------------------\n=     Angstrom   angstrom\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\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, 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\n\t\t\t\t\t   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\n\t\t\t\t\t   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":13631,"name":"tab.h","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: tab.h,v 5.17 2017/09/18 08:44:23 mcalabre Exp $\n*=============================================================================\n*\n* WCSLIB 5.17 - 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, and another, tabprt(), to print 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* 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 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":13632,"name":"log.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: log.c,v 5.17 2017/09/18 08:44:23 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":13633,"name":"wcs.c","nodeType":"TextFile","path":"cextern/wcslib/C","text":"/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcs.c,v 5.17 2017/09/18 08:44:23 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 \"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\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  static const char *function = \"wcsini\";\n\n  int i, j, k, status;\n  double *cd;\n  struct wcserr **err;\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  /* Initialize error message handling. */\n  err = &(wcs->err);\n  if (wcs->flag != -1) {\n    if (wcs->err) free(wcs->err);\n    if (wcs->lin.err) free(wcs->lin.err);\n    if (wcs->cel.err) free(wcs->cel.err);\n    if (wcs->spc.err) free(wcs->spc.err);\n  }\n  wcs->err = 0x0;\n  wcs->lin.err = 0x0;\n  wcs->cel.err = 0x0;\n  wcs->spc.err = 0x0;\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_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\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\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 = linini(0, naxis, &(wcs->lin)))) {\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  }\n\n  memset(wcs->dateavg, 0, 72);\n  memset(wcs->dateobs, 0, 72);\n  wcs->equinox    = UNDEFINED;\n  wcs->mjdavg     = UNDEFINED;\n  wcs->mjdobs     = UNDEFINED;\n  wcs->obsgeo[0]  = UNDEFINED;\n  wcs->obsgeo[1]  = UNDEFINED;\n  wcs->obsgeo[2]  = UNDEFINED;\n  memset(wcs->radesys, 0, 72);\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  memset(wcs->wcsname, 0, 72);\n\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 0;\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[8], *fp;\n  int  axis, axmap[10], 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 an uninitialized pointer on cleanup. */\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    status = wcsini(alloc, 0, wcsdst);\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 < 10; 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 = wcsutil_dpkey_int(dpsrc);\n          } else if (strncmp(fp, \"AXIS.\", 5) == 0) {\n            sscanf(fp+5, \"%d\", &jhat);\n            axmap[jhat-1] = wcsutil_dpkey_int(dpsrc) - 1;\n          }\n        }\n\n        if (Nhat < 0 || (Nhat == 0 && 1 < ndp) || naxis < Nhat || 10 < 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  npv = wcsnpv(-1);\n  wcsnpv(npvmax);\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  nps = wcsnps(-1);\n  wcsnps(npsmax);\n\n  /* Number of distortion parameters, if any. */\n  ndp = disndp(-1);\n  disndp(ndpmax);\n\n  /* Initialize the destination. */\n  status = wcsini(alloc, *nsub, wcsdst);\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      lindis(m+1, &(wcsdst->lin), disdst);\n    }\n  }\n\n  /* Reset NPVMAX, NPSMAX, and NDPMAX. */\n  wcsnpv(npv);\n  wcsnps(nps);\n  disndp(ndp);\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  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 wcsini(). */\n        *dstp = 1.0;\n      }\n    }\n  }\n\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  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      wcsdst->colax[i] = wcssrc->colax[k];\n      strncpy(wcsdst->cname[i], wcssrc->cname[k], 72);\n      wcsdst->crder[i] = wcssrc->crder[k];\n      wcsdst->csyer[i] = wcssrc->csyer[k];\n    }\n  }\n\n  strncpy(wcsdst->dateavg, wcssrc->dateavg, 72);\n  strncpy(wcsdst->dateobs, wcssrc->dateobs, 72);\n\n  wcsdst->equinox = wcssrc->equinox;\n\n  wcsdst->mjdavg = wcssrc->mjdavg;\n  wcsdst->mjdobs = wcssrc->mjdobs;\n\n  wcsdst->obsgeo[0] = wcssrc->obsgeo[0];\n  wcsdst->obsgeo[1] = wcssrc->obsgeo[1];\n  wcsdst->obsgeo[2] = wcssrc->obsgeo[2];\n\n  strncpy(wcsdst->radesys, wcssrc->radesys, 72);\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  strncpy(wcsdst->wcsname, wcssrc->wcsname, 72);\n\n\n  /* Distortion parameters. */\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 < 10; jhat++) {\n          axmap[jhat] = -1;\n        }\n\n        dpsrc = dissrc->dp;\n        for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) {\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          if (strncmp(fp, \"NAXES\", 6) == 0) {\n            Nhat = wcsutil_dpkey_int(dpsrc);\n          } else if (strncmp(fp, \"AXIS.\", 5) == 0) {\n            sscanf(fp+5, \"%d\", &jhat);\n            axmap[jhat-1] = wcsutil_dpkey_int(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\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-1]) {\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-1]) {\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\ncleanup:\n  if (itmp) free(itmp);\n  if (dealloc) {\n    free(axes);\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_Eq(naxis, tol, wcs1->crpix, wcs2->crpix)) {\n      return 0;\n    }\n  }\n\n  if (!wcsutil_Eq(naxis2, tol, wcs1->pc, wcs2->pc) ||\n      !wcsutil_Eq(naxis, tol, wcs1->cdelt, wcs2->cdelt) ||\n      !wcsutil_Eq(naxis, tol, wcs1->crval, wcs2->crval) ||\n      !wcsutil_strEq(naxis, wcs1->cunit, wcs2->cunit) ||\n      !wcsutil_strEq(naxis, wcs1->ctype, wcs2->ctype) ||\n      !wcsutil_Eq(1, tol, &wcs1->lonpole, &wcs2->lonpole) ||\n      !wcsutil_Eq(1, tol, &wcs1->latpole, &wcs2->latpole) ||\n      !wcsutil_Eq(1, tol, &wcs1->restfrq, &wcs2->restfrq) ||\n      !wcsutil_Eq(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_Eq(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_Eq(naxis2, tol, wcs1->cd, wcs2->cd) ||\n        !wcsutil_Eq(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_Eq(naxis, tol, wcs1->crder, wcs2->crder) ||\n        !wcsutil_Eq(naxis, tol, wcs1->csyer, wcs2->csyer) ||\n        strncmp(wcs1->dateavg, wcs2->dateavg, 72) ||\n        strncmp(wcs1->dateobs, wcs2->dateobs, 72) ||\n        !wcsutil_Eq(1, tol, &wcs1->equinox, &wcs2->equinox) ||\n        !wcsutil_Eq(1, tol, &wcs1->mjdavg, &wcs2->mjdavg) ||\n        !wcsutil_Eq(1, tol, &wcs1->mjdobs, &wcs2->mjdobs) ||\n        !wcsutil_Eq(3, tol, wcs1->obsgeo, wcs2->obsgeo) ||\n        strncmp(wcs1->radesys, wcs2->radesys, 72) ||\n        strncmp(wcs1->specsys, wcs2->specsys, 72) ||\n        strncmp(wcs1->ssysobs, wcs2->ssysobs, 72) ||\n        !wcsutil_Eq(1, tol, &wcs1->velosys, &wcs2->velosys) ||\n        !wcsutil_Eq(1, tol, &wcs1->zsource, &wcs2->zsource) ||\n        strncmp(wcs1->ssyssrc, wcs2->ssyssrc, 72) ||\n        !wcsutil_Eq(1, tol, &wcs1->velangl, &wcs2->velangl) ||\n        strncmp(wcs1->wcsname, wcs2->wcsname, 72)) {\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  int j;\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 wcsini() for given parameters. */\n    if (wcs->m_flag == WCSSET) {\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->tab   == wcs->m_tab)   wcs->tab   = 0x0;\n      if (wcs->wtb   == wcs->m_wtb)   wcs->wtb   = 0x0;\n\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\n      /* Allocated unconditionally by wcstab(). */\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      if (wcs->m_wtb) free(wcs->m_wtb);\n    }\n\n    if (wcs->err) free(wcs->err);\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\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  wcs->err  = 0x0;\n\n  wcs->flag = 0;\n\n  linfree(&(wcs->lin));\n  celfree(&(wcs->cel));\n  spcfree(&(wcs->spc));\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsprt(const struct wcsprm *wcs)\n\n{\n  int i, j, k;\n  struct wtbarr *wtbp;\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 0;\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 (i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"  %#- 11.5g\", wcs->crpix[i]);\n  }\n  wcsprintf(\"\\n\");\n\n  /* Linear transformation. */\n  k = 0;\n  WCSPRINTF_PTR(\"         pc: \", wcs->pc, \"\\n\");\n  for (i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"    pc[%d][]:\", i);\n    for (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 (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 (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 (i = 0; i < wcs->naxis; i++) {\n    wcsprintf(\"             \\\"%s\\\"\\n\", wcs->cunit[i]);\n  }\n\n  WCSPRINTF_PTR(\"      ctype: \", wcs->ctype, \"\\n\");\n  for (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 (i = 0; i < wcs->npv; i++) {\n    wcsprintf(\"             %3d%4d  %#- 11.5g\\n\", (wcs->pv[i]).i,\n      (wcs->pv[i]).m, (wcs->pv[i]).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 (i = 0; i < wcs->nps; i++) {\n    wcsprintf(\"             %3d%4d  %s\\n\", (wcs->ps[i]).i,\n      (wcs->ps[i]).m, (wcs->ps[i]).value);\n  }\n\n  /* Alternate linear transformations. */\n  k = 0;\n  WCSPRINTF_PTR(\"         cd: \", wcs->cd, \"\\n\");\n  if (wcs->cd) {\n    for (i = 0; i < wcs->naxis; i++) {\n      wcsprintf(\"    cd[%d][]:\", i);\n      for (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 (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 (i = 0; i < wcs->naxis; i++) {\n      wcsprintf(\"  %5d\", wcs->colax[i]);\n    }\n    wcsprintf(\"\\n\");\n  }\n\n  if (wcs->wcsname[0] == '\\0') {\n    wcsprintf(\"    wcsname: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    wcsname: \\\"%s\\\"\\n\", wcs->wcsname);\n  }\n\n  WCSPRINTF_PTR(\"      cname: \", wcs->cname, \"\\n\");\n  if (wcs->cname) {\n    for (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 (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 (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  if (wcs->radesys[0] == '\\0') {\n    wcsprintf(\"    radesys: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    radesys: \\\"%s\\\"\\n\", wcs->radesys);\n  }\n\n  if (undefined(wcs->equinox)) {\n    wcsprintf(\"    equinox: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    equinox: %9f\\n\", wcs->equinox);\n  }\n\n  if (wcs->specsys[0] == '\\0') {\n    wcsprintf(\"    specsys: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    specsys: \\\"%s\\\"\\n\", wcs->specsys);\n  }\n\n  if (wcs->ssysobs[0] == '\\0') {\n    wcsprintf(\"    ssysobs: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    ssysobs: \\\"%s\\\"\\n\", wcs->ssysobs);\n  }\n\n  if (undefined(wcs->velosys)) {\n    wcsprintf(\"    velosys: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    velosys: %9f\\n\", wcs->velosys);\n  }\n\n  if (wcs->ssyssrc[0] == '\\0') {\n    wcsprintf(\"    ssyssrc: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    ssyssrc: \\\"%s\\\"\\n\", wcs->ssyssrc);\n  }\n\n  if (undefined(wcs->zsource)) {\n    wcsprintf(\"    zsource: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    zsource: %9f\\n\", wcs->zsource);\n  }\n\n  wcsprintf(\"     obsgeo: \");\n  for (i = 0; i < 3; i++) {\n    if (undefined(wcs->obsgeo[i])) {\n      wcsprintf(\"UNDEFINED     \");\n    } else {\n      wcsprintf(\"  %#- 11.5g\", wcs->obsgeo[i]);\n    }\n  }\n  wcsprintf(\"\\n\");\n\n  if (wcs->dateobs[0] == '\\0') {\n    wcsprintf(\"    dateobs: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    dateobs: \\\"%s\\\"\\n\", wcs->dateobs);\n  }\n\n  if (wcs->dateavg[0] == '\\0') {\n    wcsprintf(\"    dateavg: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"    dateavg: \\\"%s\\\"\\n\", wcs->dateavg);\n  }\n\n  if (undefined(wcs->mjdobs)) {\n    wcsprintf(\"     mjdobs: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"     mjdobs: %9f\\n\", wcs->mjdobs);\n  }\n\n  if (undefined(wcs->mjdavg)) {\n    wcsprintf(\"     mjdavg: UNDEFINED\\n\");\n  } else {\n    wcsprintf(\"     mjdavg: %9f\\n\", wcs->mjdavg);\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 (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_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  if ((wtbp = wcs->wtb)) {\n    for (j = 0; j < wcs->nwtb; j++, wtbp++) {\n      wcsprintf(\"\\n\");\n      wcsprintf(\"wtb[%d].*\\n\", j);\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 (j = 0; j < wcs->ntab; j++) {\n      wcsprintf(\"\\n\");\n      wcsprintf(\"tab[%d].*\\n\", j);\n      tabprt(wcs->tab + j);\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 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsperr(const struct wcsprm *wcs, const char *prefix)\n\n{\n  int j;\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 (j = 0; j < wcs->ntab; j++) {\n        wcserr_prt((wcs->tab + j)->err, prefix);\n      }\n    }\n  }\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsbchk(struct wcsprm *wcs, int bounds)\n\n{\n  int status;\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n\n  if (wcs->flag != WCSSET) {\n    if ((status = wcsset(wcs))) return status;\n  }\n\n  wcs->cel.prj.bounds = bounds;\n\n  return 0;\n}\n\n/*--------------------------------------------------------------------------*/\n\nint wcsset(struct wcsprm *wcs)\n\n{\n  static const char *function = \"wcsset\";\n\n  char   dpq[8], scode[4], stype[5];\n  int    i, j, k, m, n, naxis, ndpmax, status;\n  double lambda, rho;\n  double *cd, *pc;\n  struct disprm *dis;\n  struct dpkey  *keyp;\n  struct linprm *wcslin = &(wcs->lin);\n  struct celprm *wcscel = &(wcs->cel);\n  struct prjprm *wcsprj = &(wcscel->prj);\n  struct spcprm *wcsspc = &(wcs->spc);\n  struct wcserr **err;\n\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  err = &(wcs->err);\n\n  /* Determine axis types from CTYPEia. */\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  naxis = wcs->naxis;\n\n\n  /* Non-linear celestial axes present? */\n  if (wcs->lng >= 0 && wcs->types[wcs->lng] == 2200) {\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    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      if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) {\n        return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY));\n      }\n\n      ndpmax = disndp(-1);\n      disndp(6+wcs->npv);\n\n      /* Attach it to linprm.  Also inits it. */\n      dis->flag = -1;\n      if (strncmp(wcsprj->code, \"TPU\", 3) == 0) {\n        /* Prior distortion. */\n        lindis(1, wcslin, dis);\n        strcpy(dpq, \"DP\");\n      } else {\n        /* Sequent distortion. */\n        lindis(2, wcslin, dis);\n        strcpy(dpq, \"DQ\");\n      }\n\n      disndp(ndpmax);\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      keyp = dis->dp;\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\n      /* Copy distortion parameters for the longitude axis. */\n      for (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      }\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\n      for (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      }\n\n      dis->ndp = keyp - dis->dp;\n\n      /* Erase PVi_ma associated with the celestial axes. */\n      n = 0;\n      for (k = 0; k < wcs->npv; k++) {\n        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 (k = 0; k < wcs->npv; k++) {\n      i = wcs->pv[k].i - 1;\n      m = wcs->pv[k].m;\n\n      if (i == -1) {\n        /* From a PROJPn keyword. */\n        i = wcs->lat;\n      }\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 (k = 0; k < wcs->npv; k++) {\n      i = wcs->pv[k].i - 1;\n      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    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 (k = 0; k < wcs->npv; k++) {\n      i = wcs->pv[k].i - 1;\n      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 (j = 0; j < wcs->ntab; j++) {\n    if ((status = tabset(wcs->tab + j))) {\n      return wcserr_set(WCS_ERRMSG(wcs_taberr[status]));\n    }\n  }\n\n\n  /* Initialize the linear transformation. */\n  wcs->altlin &= 7;\n  if (wcs->altlin > 1 && !(wcs->altlin & 1)) {\n    pc = wcs->pc;\n\n    if (wcs->altlin & 2) {\n      /* Copy CDi_ja to PCi_ja and reset CDELTia. */\n      cd = wcs->cd;\n      for (i = 0; i < naxis; i++) {\n        for (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      if ((i = wcs->lng) >= 0 && (j = wcs->lat) >= 0) {\n        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        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  wcsutil_null_fill(4, wcs->alt);\n  wcsutil_null_fill(72, wcs->wcsname);\n  for (i = 0; i < naxis; i++) {\n    wcsutil_null_fill(72, wcs->cname[i]);\n  }\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  wcsutil_null_fill(72, wcs->dateobs);\n  wcsutil_null_fill(72, wcs->dateavg);\n\n  wcs->flag = WCSSET;\n\n  return 0;\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[9], scode[4], specsys[9];\n  int i, j, m, naxis, *ndx = 0x0, type;\n  struct wcserr **err;\n\n  if (wcs == 0x0) return WCSERR_NULL_POINTER;\n  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 0;\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    /* 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    wcsutil_null_fill(72, wcs->cunit[i]);\n    if (wcs->cunit[i][0]) {\n      if (wcsunitse(wcs->cunit[i], units, &scale, &offset, &power,\n                    &uniterr)) {\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        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 0;\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  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 0;\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 0;\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 0;\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 0;\n\n            if (dlat < tol) {\n              /* An artifact of numerical imprecision. */\n              if (dabs < tol2) return 0;\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 0;\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 0;\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 0;\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 0;\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 0;\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 0;\n\n            if (dlng < tol) {\n              /* An artifact of numerical imprecision. */\n              if (dabs < tol2) return 0;\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 0;\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 0;\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      if (wcs->err) free(wcs->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 0;\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        if (wcs->err) free(wcs->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 0;\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        if (wcs->err) free(wcs->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 0;\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 wcssptr(\n  struct wcsprm *wcs,\n  int  *i,\n  char ctype[9])\n\n{\n  static const char *function = \"wcssptr\";\n\n  int    j, status;\n  double cdelt, crval;\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 ((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  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  return 0;\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":13634,"name":"README","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"This directory contains C code generated by flex 2.5.39 under Debian 8.3\n(jessie) from the Flex description files (*.l) in the parent 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"},{"id":13635,"name":"wcsutrn.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsutrn.c\"\n\n#line 4 \"wcsutrn.c\"\n\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define yy_create_buffer wcsutrn_create_buffer\n#define yy_delete_buffer wcsutrn_delete_buffer\n#define yy_flex_debug wcsutrn_flex_debug\n#define yy_init_buffer wcsutrn_init_buffer\n#define yy_flush_buffer wcsutrn_flush_buffer\n#define yy_load_buffer_state wcsutrn_load_buffer_state\n#define yy_switch_to_buffer wcsutrn_switch_to_buffer\n#define yyin wcsutrnin\n#define yyleng wcsutrnleng\n#define yylex wcsutrnlex\n#define yylineno wcsutrnlineno\n#define yyout wcsutrnout\n#define yyrestart wcsutrnrestart\n#define yytext wcsutrntext\n#define yywrap wcsutrnwrap\n#define yyalloc wcsutrnalloc\n#define yyrealloc wcsutrnrealloc\n#define yyfree wcsutrnfree\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 5\n#define YY_FLEX_SUBMINOR_VERSION 39\n#if YY_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;\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#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define YY_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define YY_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef YY_USE_CONST\n#define yyconst const\n#else\n#define yyconst\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 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 YY_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 (yy_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 YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START (((yy_start) - 1) / 2)\n#define YYSTATE YY_START\n\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE wcsutrnrestart(wcsutrnin  )\n\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\nextern yy_size_t wcsutrnleng;\n\nextern FILE *wcsutrnin, *wcsutrnout;\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 wcsutrntext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = (yy_hold_char); \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\t(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up wcsutrntext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) yyunput( c, (yytext_ptr)  )\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\tyy_size_t yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tyy_size_t 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 wcsutrnrestart()), so that the user can continue scanning by\n\t * just pointing wcsutrnin 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/* Stack of input buffers. */\nstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\nstatic YY_BUFFER_STATE * yy_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 YY_CURRENT_BUFFER ( (yy_buffer_stack) \\\n                          ? (yy_buffer_stack)[(yy_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 YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\n\n/* yy_hold_char holds the character lost when wcsutrntext is formed. */\nstatic char yy_hold_char;\nstatic yy_size_t yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\nyy_size_t wcsutrnleng;\n\n/* Points to current character in buffer. */\nstatic char *yy_c_buf_p = (char *) 0;\nstatic int yy_init = 0;\t\t/* whether we need to initialize */\nstatic int yy_start = 0;\t/* start state number */\n\n/* Flag which is used to allow wcsutrnwrap()'s to do buffer switches\n * instead of setting up a fresh wcsutrnin.  A bit of a hack ...\n */\nstatic int yy_did_buffer_switch_on_eof;\n\nvoid wcsutrnrestart (FILE *input_file  );\nvoid wcsutrn_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\nYY_BUFFER_STATE wcsutrn_create_buffer (FILE *file,int size  );\nvoid wcsutrn_delete_buffer (YY_BUFFER_STATE b  );\nvoid wcsutrn_flush_buffer (YY_BUFFER_STATE b  );\nvoid wcsutrnpush_buffer_state (YY_BUFFER_STATE new_buffer  );\nvoid wcsutrnpop_buffer_state (void );\n\nstatic void wcsutrnensure_buffer_stack (void );\nstatic void wcsutrn_load_buffer_state (void );\nstatic void wcsutrn_init_buffer (YY_BUFFER_STATE b,FILE *file  );\n\n#define YY_FLUSH_BUFFER wcsutrn_flush_buffer(YY_CURRENT_BUFFER )\n\nYY_BUFFER_STATE wcsutrn_scan_buffer (char *base,yy_size_t size  );\nYY_BUFFER_STATE wcsutrn_scan_string (yyconst char *yy_str  );\nYY_BUFFER_STATE wcsutrn_scan_bytes (yyconst char *bytes,yy_size_t len  );\n\nvoid *wcsutrnalloc (yy_size_t  );\nvoid *wcsutrnrealloc (void *,yy_size_t  );\nvoid wcsutrnfree (void *  );\n\n#define yy_new_buffer wcsutrn_create_buffer\n\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        wcsutrnensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        wcsutrnensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsutrnwrap() 1\n#define YY_SKIP_YYWRAP\n\ntypedef char YY_CHAR;\n\nFILE *wcsutrnin = (FILE *) 0, *wcsutrnout = (FILE *) 0;\n\ntypedef int yy_state_type;\n\nextern int wcsutrnlineno;\n\nint wcsutrnlineno = 1;\n\nextern char *wcsutrntext;\n#define yytext_ptr wcsutrntext\n\nstatic yyconst 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       43,   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,   45,\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,   46,   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,   47,   43,   43,   43,   48,\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,   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,  -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,   49,   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,   50,   43,   43,   43,   43,   43,   43,   43,\n       51,  -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,   52,\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,   53,\n       43,   43,   54,   43,   43,   43,   43,   55,   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,   56,   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,   57,\n       43,   43,   58,   59,   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,   60,   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,   61,   43,   43,   43,   43,\n       43,   43,   43,   62,   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,   63,   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,   64,   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,   65,\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,   66,\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,   67,   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,   68,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   69,   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       70,   43,   43,   43,   71,   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,   72,   43,   43,\n       43,   73,   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,   50,   43,   43,   43,   43,   43,\n       43,   43,   51,  -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,   56,   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,   74,   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,   63,   43,   43,\n\n       43,   43,   43,   43,   43,   75,   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,   76,   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,   77,   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,   67,   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,   78,   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,   79,  -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,   80,  -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,   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,   82,   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,   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,   81,   81,   81,   81,   81,   81,   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,   81,   81,   81,   81,   81\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,   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,  -40,  -40,  -40,  -40,  -40,  -40,   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,  -40,  -40,  -40,  -40,  -40\n    },\n\n    {\n        7,   85,   85,   85,   85,   85,   85,   85,   85,   85,\n      -41,   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\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,  -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,   86,   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,   87,   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,   43,   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,   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,  -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,   88,   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,   89,\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,   43,   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,   90,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\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,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       91,  -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,   43,   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       43,  -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,   92,   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       93,  -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,   43,   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       43,  -56,  -56,  -56,  -56,  -56,  -56,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   94,   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,   95,   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       96,  -58,  -58,  -58,  -58,  -58,  -58,   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,  -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,   97,   43,\n       43,   43,   43,   43,   43,   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       43,  -60,  -60,  -60,  -60,  -60,  -60,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   98,\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,   43,   43,\n       43,   43,   43,   99,   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,  100,   43,\n       43,  -62,  -62,  -62,  -62,  -62,  -62,   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,  -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,   43,   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,  101,   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,  102,   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,  -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,  103,   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,   43,   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,   43,   43,\n       43,   43,   43,   43,   43,   43,  104,   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,   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,  -67,  -67,  -67,  -67,  -67,  -67,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  105,   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,  106,   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,  -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,   43,   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,   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,  -70,  -70,  -70,  -70,  -70,  -70,   43,   43,   43,\n\n       43,   43,   43,  107,   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,  108,\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,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  109,   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,   43,\n       43,   43,   43,  110,   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,  111,   43,   43,   43,\n       43,   43,   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,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n      112,   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      113,   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,  -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,  114,\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,  -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,  115,   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,  -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,  -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,   80,  -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        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,  -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        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,  -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        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,   82,   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,   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,   81,   81,   81,   81,   81,   81,   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,   81,   81,   81,   81,   81\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,  -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        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,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,  116,   43,   43,\n       43,   43,   43,  117,   43,   43,   43,   43,   43,   43,\n       43,  -86,  -86,  -86,  -86,  -86,  -86,   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,  -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,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,  118,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,  -87,  -87,  -87,  -87,  -87,  -87,   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,  -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,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,  -88,  -88,  -88,  -88,  -88,  -88,   43,   43,   43,\n       43,  119,   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,  120,   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,   43,   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,   43,   43,   43,\n       43,   43,  121,   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,   43,   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,   43,   43,   43,  122,   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,   43,   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,   43,   43,   43,   43,  123,   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,  124,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  125,   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,   43,   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,   43,   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,  126,   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,  -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,  127,\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,  128,\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,  129,   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,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,  130,\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,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n\n       43,   43,   43,   43,  131,   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,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  132,   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,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,  133,   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,   43,\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,  134,   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,   43,   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,  135,\n       43,   43,   43,   43,   43,  136,   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,  137,   43,   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,   43,   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,  138,   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,  139,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  140,   43,   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,  141,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   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,  142,   43,   43,   43,   43,\n\n       43,   43,   43,   43,   43,   43,   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,  143,   43,   43,   43,   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,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,  144,   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,  145,   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,   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, -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,  146,\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,   43,   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,   43,   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,   43,   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,   43,   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,  147,\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,  148,   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,   43,   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,  149,   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,  150,   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,  151,\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,  152,   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, -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,  153,   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,   43,   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,   43,   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,  154,   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,  155,   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,   43,   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,  156,   43,\n       43,   43,   43,   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,   43,\n\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,  157,   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,   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, -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,  158,   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,   43,   43,   43,   43,\n       43,   43,   43,  159,   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,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  160,   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,   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, -135, -135, -135, -135, -135, -135,   43,   43,   43,\n       43,   43,   43,   43,   43,  161,   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,   43,   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,  162,   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,   43,   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,  163,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   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,   43,   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,  164,   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,  165,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   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,   43,   43,   43,  166,   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,  167,   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, -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      168,   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,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   69,   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,  169,   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,   43,   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,  170,   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,   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, -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,  171,\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,   43,   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,  172,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43, -148, -148, -148, -148, -148, -148,   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, -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      173,   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,  174,   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,   43,   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,   43,   43,\n       43,   43,   43,  175,   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,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,  176,   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,  177,   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,   43,   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,   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, -154, -154, -154, -154, -154, -154,   43,   43,   43,\n       43,   43,   43,   43,   43,   43,   43,   43,  178,   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,  179,   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,   43,   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,  180,   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, -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       43,   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,   43,   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,   43,   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,   43,   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,  181,   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,   43,   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      182,   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,  183,\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, -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,   43,   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,  184,   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,   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, -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,  185,   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,  186,   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,  177,   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      187,   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      188,   43,   43,   43,   43,   43,   43,   43,   43,   43,\n       43,   43,   43,   43,   43,   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,  189,   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       43,   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,  190,   43,   43,   43,   43,   43,   43,\n       43, -170, -170, -170, -170, -170, -170,   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, -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,  191,   43,   43,   43,   43,   43,   43,\n       43, -171, -171, -171, -171, -171, -171,   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, -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,  192,   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,   43,   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,  193,   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,   43,   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       43,   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,  194,   43,   43,   43,   43,   43,   43,\n       43, -176, -176, -176, -176, -176, -176,   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, -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,   43,   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,   43,   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,  195,   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,  196,   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,   43,   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,  197,   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,  198,   43,   43,   43,   43,   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,   43,   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,  189,   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,  190,   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,  199,   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,   43,   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,  200,   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,  201,   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,   43,   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,   43,   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,   43,   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,   43,   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,   43,   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,   43,   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,   43,   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,  202,\n       43,   43,   43,   43,   43,   43,   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,   43,\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\nstatic yy_state_type yy_get_previous_state (void );\nstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\nstatic int yy_get_next_buffer (void );\nstatic void yy_fatal_error (yyconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up wcsutrntext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\t(yytext_ptr) = yy_bp; \\\n\twcsutrnleng = (size_t) (yy_cp - yy_bp); \\\n\t(yy_hold_char) = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\t(yy_c_buf_p) = yy_cp;\n\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 yyconst flex_int16_t yy_accept[203] =\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,   13,\n       15,   17,   31,   31,   19,   31,   31,   31,   31,   31,\n       31,   31,   31,   31,   31,   31,   31,   31,   30,   31,\n       31,   31,   31,   31,   31,   31,   31,   31,    2,    1,\n       33,   33,   34,   32,   36,   31,   31,   31,    9,   11,\n       12,   31,   16,   31,   31,   22,   21,   23,   31,   31,\n\n       31,   26,   27,   31,   31,   31,   31,   31,    9,   31,\n       31,   31,   31,   27,   31,   31,   31,    7,    8,    9,\n       31,   31,   31,   31,   31,   31,   31,   31,   31,   31,\n       29,   29,   30,   31,   31,   31,    9,   31,   31,   31,\n       31,   31,   31,   30,   31,   31,   31,   31,   31,   20,\n       20,   31,   25,   31,   31,   31,   29,   29,   30,   31,\n       31,   31,   31,   20,   20,   31,   31,   31,    5,    6,\n       11,   18,   18,   20,   20,   24,   25,   24,   26,   27,\n       31,   31,   31,   11,   20,   20,   26,   27,    5,    6,\n       11,   18,   18,   24,   24,   26,   27,   31,   11,   26,\n\n       27,    4\n    } ;\n\nstatic yyconst yy_state_type yy_NUL_trans[203] =\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,   81,    0,\n       85,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,   81,    0,    0,   85,    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\n    } ;\n\nextern int wcsutrn_flex_debug;\nint wcsutrn_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 yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\nchar *wcsutrntext;\n#line 1 \"wcsutrn.l\"\n/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsutrn.c,v 5.17 2017/09/18 08:44:24 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/* Exclusive start states. */\n\n#line 49 \"wcsutrn.l\"\n/* To get the prototype for fileno() from stdio.h when gcc is invoked with\n * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */\n#define _POSIX_SOURCE 1\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#define YY_DECL int wcsutrne(int ctrl, char unitstr[], struct wcserr **err)\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsutrn_abort_jmp_env;\n#define exit(status) longjmp(wcsutrn_abort_jmp_env, status)\n\n#line 4044 \"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#ifndef YY_EXTRA_TYPE\n#define YY_EXTRA_TYPE void *\n#endif\n\nstatic int yy_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint wcsutrnlex_destroy (void );\n\nint wcsutrnget_debug (void );\n\nvoid wcsutrnset_debug (int debug_flag  );\n\nYY_EXTRA_TYPE wcsutrnget_extra (void );\n\nvoid wcsutrnset_extra (YY_EXTRA_TYPE user_defined  );\n\nFILE *wcsutrnget_in (void );\n\nvoid wcsutrnset_in  (FILE * in_str  );\n\nFILE *wcsutrnget_out (void );\n\nvoid wcsutrnset_out  (FILE * out_str  );\n\nyy_size_t wcsutrnget_leng (void );\n\nchar *wcsutrnget_text (void );\n\nint wcsutrnget_lineno (void );\n\nvoid wcsutrnset_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 YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int wcsutrnwrap (void );\n#else\nextern int wcsutrnwrap (void );\n#endif\n#endif\n\n    static void yyunput (int c,char *buf_ptr  );\n    \n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char *,yyconst char *,int );\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst char * );\n#endif\n\n#ifndef YY_NO_INPUT\n\n#ifdef __cplusplus\nstatic int yyinput (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 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( wcsutrntext, wcsutrnleng, 1, wcsutrnout )) {} } 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 = read( fileno(wcsutrnin), (char *) 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(wcsutrnin); \\\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 )\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 wcsutrnlex (void);\n\n#define YY_DECL int wcsutrnlex (void)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after wcsutrntext and wcsutrnleng\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 break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( wcsutrnleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(wcsutrntext[wcsutrnleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp, *yy_bp;\n\tregister int yy_act;\n    \n\tif ( !(yy_init) )\n\t\t{\n\t\t(yy_init) = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! (yy_start) )\n\t\t\t(yy_start) = 1;\t/* first start state */\n\n\t\tif ( ! wcsutrnin )\n\t\t\twcsutrnin = stdin;\n\n\t\tif ( ! wcsutrnout )\n\t\t\twcsutrnout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\twcsutrnensure_buffer_stack ();\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\twcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE );\n\t\t}\n\n\t\twcsutrn_load_buffer_state( );\n\t\t}\n\n\t{\n#line 69 \"wcsutrn.l\"\n\n\tstatic const char *function = \"wcsutrne\";\n\t\n\tchar orig[80], subs[80];\n\tint bracket = 0;\n\tint unsafe  = 0;\n\tint status  = -1;\n\tint wcsutrnlex_destroy(void);\n\t\n\tif (err) *err = 0x0;\n\t\n\t*orig = '\\0';\n\t*subs = '\\0';\n\t\n\twcsutrn_delete_buffer(YY_CURRENT_BUFFER);\n\twcsutrn_scan_string(unitstr);\n\t*unitstr = '\\0';\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsutrn_abort_jmp_env)) {\n\t  return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR),\n\t    \"Internal units translator 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 4278 \"wcsutrn.c\"\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = (yy_c_buf_p);\n\n\t\t/* Support of wcsutrntext. */\n\t\t*yy_cp = (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 = (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 99 \"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 105 \"wcsutrn.l\"\n/* Discard leading whitespace. */\n\tYY_BREAK\ncase 3:\n/* rule 3 can match eol */\nYY_RULE_SETUP\n#line 107 \"wcsutrn.l\"\n{\n\t  /* Non-alphabetic character. */\n\t  strcat(unitstr, wcsutrntext);\n\t  if (bracket && *wcsutrntext == ']') {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 115 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"Angstrom\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 121 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"arcmin\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 127 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"arcsec\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 7:\nYY_RULE_SETUP\n#line 133 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"beam\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 8:\nYY_RULE_SETUP\n#line 139 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"byte\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 145 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"d\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 151 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, (ctrl & 4) ? \"d\" : \"D\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 11:\nYY_RULE_SETUP\n#line 158 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"deg\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 164 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"GHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 13:\nYY_RULE_SETUP\n#line 170 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"h\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 14:\nYY_RULE_SETUP\n#line 176 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, (ctrl & 2) ? \"h\" : \"H\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 15:\nYY_RULE_SETUP\n#line 183 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"Hz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 16:\nYY_RULE_SETUP\n#line 189 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"kHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 17:\nYY_RULE_SETUP\n#line 195 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"Jy\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 18:\nYY_RULE_SETUP\n#line 201 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"K\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 19:\nYY_RULE_SETUP\n#line 207 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"km\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 213 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"m\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 21:\nYY_RULE_SETUP\n#line 219 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"min\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 22:\nYY_RULE_SETUP\n#line 225 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"MHz\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 23:\nYY_RULE_SETUP\n#line 231 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"ohm\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 237 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"Pa\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 243 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"pixel\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 249 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"rad\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 255 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"s\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 261 \"wcsutrn.l\"\n{\n\t  unsafe = 1;\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, (ctrl & 1) ? \"s\" : \"S\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 268 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"V\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 274 \"wcsutrn.l\"\n{\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, \"yr\");\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 280 \"wcsutrn.l\"\n{\n\t  /* Not a recognized alias. */\n\t  strcpy(orig, wcsutrntext);\n\t  strcpy(subs, orig);\n\t  BEGIN(NEXT);\n\t}\n\tYY_BREAK\ncase 32:\nYY_RULE_SETUP\n#line 287 \"wcsutrn.l\"\n{\n\t  /* Reject the alias match. */\n\t  strcat(orig, wcsutrntext);\n\t  strcpy(subs, orig);\n\t}\n\tYY_BREAK\ncase 33:\n/* rule 33 can match eol */\nYY_RULE_SETUP\n#line 293 \"wcsutrn.l\"\n{\n\t  /* Discard separating whitespace. */\n\t  unput(wcsutrntext[wcsutrnleng-1]);\n\t}\n\tYY_BREAK\ncase 34:\nYY_RULE_SETUP\n#line 298 \"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(wcsutrntext[wcsutrnleng-1]);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 35:\nYY_RULE_SETUP\n#line 308 \"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(*wcsutrntext);\n\t  *subs = '\\0';\n\t  BEGIN(INITIAL);\n\t}\n\tYY_BREAK\ncase 36:\nYY_RULE_SETUP\n#line 317 \"wcsutrn.l\"\n{\n\t  /* Copy out remaining input. */\n\t  strcat(unitstr, wcsutrntext);\n\t}\n\tYY_BREAK\ncase YY_STATE_EOF(INITIAL):\ncase YY_STATE_EOF(NEXT):\ncase YY_STATE_EOF(FLUSH):\n#line 322 \"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  wcsutrnlex_destroy();\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 337 \"wcsutrn.l\"\nECHO;\n\tYY_BREAK\n#line 4666 \"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 - (yytext_ptr)) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = (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 wcsutrnin at a new source and called\n\t\t\t * wcsutrnlex().  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\t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsutrnin;\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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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\t(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_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 * 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 );\n\n\t\t\tyy_bp = (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 = ++(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 = (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(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(yy_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( wcsutrnwrap( ) )\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 * wcsutrntext, 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\t(yy_c_buf_p) = (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 ( ! (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\t(yy_c_buf_p) =\n\t\t\t\t\t(yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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\t(yy_c_buf_p) =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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 wcsutrnlex */\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 (void)\n{\n    \tregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tregister char *source = (yytext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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 ( (yy_c_buf_p) - (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) ((yy_c_buf_p) - (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 = (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) ((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\tyy_size_t 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\twcsutrnrealloc((void *) b->yy_ch_buf,b->yy_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->yy_ch_buf = 0;\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\t(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\t(yy_n_chars), num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tif ( (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\twcsutrnrestart(wcsutrnin  );\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 ((yy_size_t) ((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\tyy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsutrnrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\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}\n\n\t(yy_n_chars) += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\n\n\t(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 (void)\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp;\n    \n\tyy_current_state = (yy_start);\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (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 )\n{\n\tregister int yy_is_jam;\n    \n\tyy_current_state = yy_NUL_trans[yy_current_state];\n\tyy_is_jam = (yy_current_state == 0);\n\n\t\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n    static void yyunput (int c, register char * yy_bp )\n{\n\tregister char *yy_cp;\n    \n    yy_cp = (yy_c_buf_p);\n\n\t/* undo effects of setting up wcsutrntext */\n\t*yy_cp = (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\tregister yy_size_t number_to_move = (yy_n_chars) + 2;\n\t\tregister char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tregister char *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\t(yy_n_chars) = 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\t(yytext_ptr) = yy_bp;\n\t(yy_hold_char) = *yy_cp;\n\t(yy_c_buf_p) = yy_cp;\n}\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(yy_c_buf_p) = (yy_hold_char);\n\n\tif ( *(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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(yy_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tyy_size_t offset = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t++(yy_c_buf_p);\n\n\t\t\tswitch ( yy_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 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\twcsutrnrestart(wcsutrnin );\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 ( wcsutrnwrap( ) )\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tif ( ! (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();\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(yy_c_buf_p) = (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 *) (yy_c_buf_p);\t/* cast for 8-bit char's */\n\t*(yy_c_buf_p) = '\\0';\t/* preserve wcsutrntext */\n\t(yy_hold_char) = *++(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 * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void wcsutrnrestart  (FILE * input_file )\n{\n    \n\tif ( ! YY_CURRENT_BUFFER ){\n        wcsutrnensure_buffer_stack ();\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE );\n\t}\n\n\twcsutrn_init_buffer(YY_CURRENT_BUFFER,input_file );\n\twcsutrn_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void wcsutrn_switch_to_buffer  (YY_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\twcsutrnpop_buffer_state();\n\t *\t\twcsutrnpush_buffer_state(new_buffer);\n     */\n\twcsutrnensure_buffer_stack ();\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*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\twcsutrn_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (wcsutrnwrap()) processing, but the only time this flag\n\t * is looked at is after wcsutrnwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(yy_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void wcsutrn_load_buffer_state  (void)\n{\n    \t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\twcsutrnin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\t(yy_hold_char) = *(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 * \n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE wcsutrn_create_buffer  (FILE * file, int  size )\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) wcsutrnalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrn_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 *) wcsutrnalloc(b->yy_buf_size + 2  );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrn_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\twcsutrn_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with wcsutrn_create_buffer()\n * \n */\n    void wcsutrn_delete_buffer (YY_BUFFER_STATE  b )\n{\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\twcsutrnfree((void *) b->yy_ch_buf  );\n\n\twcsutrnfree((void *) b  );\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 wcsutrnrestart() or at EOF.\n */\n    static void wcsutrn_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\twcsutrn_flush_buffer(b );\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then wcsutrn_init_buffer was _probably_\n     * called from wcsutrnrestart() 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 * \n */\n    void wcsutrn_flush_buffer (YY_BUFFER_STATE  b )\n{\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\twcsutrn_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 wcsutrnpush_buffer_state (YY_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\twcsutrnensure_buffer_stack();\n\n\t/* This block is copied from wcsutrn_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\t(yy_buffer_stack_top)++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from wcsutrn_switch_to_buffer. */\n\twcsutrn_load_buffer_state( );\n\t(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 *  \n */\nvoid wcsutrnpop_buffer_state (void)\n{\n    \tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\twcsutrn_delete_buffer(YY_CURRENT_BUFFER );\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((yy_buffer_stack_top) > 0)\n\t\t--(yy_buffer_stack_top);\n\n\tif (YY_CURRENT_BUFFER) {\n\t\twcsutrn_load_buffer_state( );\n\t\t(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 wcsutrnensure_buffer_stack (void)\n{\n\tyy_size_t num_to_alloc;\n    \n\tif (!(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\t\tnum_to_alloc = 1;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsutrnalloc\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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrnensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\t\t\t\t\n\t\t(yy_buffer_stack_max) = num_to_alloc;\n\t\t(yy_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((yy_buffer_stack_top) >= ((yy_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 = (yy_buffer_stack_max) + grow_size;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsutrnrealloc\n\t\t\t\t\t\t\t\t((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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrnensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\t(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 * \n * @return the newly allocated buffer state object. \n */\nYY_BUFFER_STATE wcsutrn_scan_buffer  (char * base, yy_size_t  size )\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 0;\n\n\tb = (YY_BUFFER_STATE) wcsutrnalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrn_scan_buffer()\" );\n\n\tb->yy_buf_size = 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 = 0;\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\twcsutrn_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to wcsutrnlex() will\n * scan from a @e copy of @a str.\n * @param yystr 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 *       wcsutrn_scan_bytes() instead.\n */\nYY_BUFFER_STATE wcsutrn_scan_string (yyconst char * yystr )\n{\n    \n\treturn wcsutrn_scan_bytes(yystr,strlen(yystr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to wcsutrnlex() 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 * \n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE wcsutrn_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tyy_size_t i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _yybytes_len + 2;\n\tbuf = (char *) wcsutrnalloc(n  );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsutrn_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 = wcsutrn_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in wcsutrn_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 yy_fatal_error (yyconst char* msg )\n{\n    \t(void) fprintf( 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 wcsutrntext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\twcsutrntext[wcsutrnleng] = (yy_hold_char); \\\n\t\t(yy_c_buf_p) = wcsutrntext + yyless_macro_arg; \\\n\t\t(yy_hold_char) = *(yy_c_buf_p); \\\n\t\t*(yy_c_buf_p) = '\\0'; \\\n\t\twcsutrnleng = yyless_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 wcsutrnget_lineno  (void)\n{\n        \n    return wcsutrnlineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *wcsutrnget_in  (void)\n{\n        return wcsutrnin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *wcsutrnget_out  (void)\n{\n        return wcsutrnout;\n}\n\n/** Get the length of the current token.\n * \n */\nyy_size_t wcsutrnget_leng  (void)\n{\n        return wcsutrnleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *wcsutrnget_text  (void)\n{\n        return wcsutrntext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid wcsutrnset_lineno (int  line_number )\n{\n    \n    wcsutrnlineno = 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 wcsutrn_switch_to_buffer\n */\nvoid wcsutrnset_in (FILE *  in_str )\n{\n        wcsutrnin = in_str ;\n}\n\nvoid wcsutrnset_out (FILE *  out_str )\n{\n        wcsutrnout = out_str ;\n}\n\nint wcsutrnget_debug  (void)\n{\n        return wcsutrn_flex_debug;\n}\n\nvoid wcsutrnset_debug (int  bdebug )\n{\n        wcsutrn_flex_debug = bdebug ;\n}\n\nstatic int yy_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from wcsutrnlex_destroy(), so don't allocate here.\n     */\n\n    (yy_buffer_stack) = 0;\n    (yy_buffer_stack_top) = 0;\n    (yy_buffer_stack_max) = 0;\n    (yy_c_buf_p) = (char *) 0;\n    (yy_init) = 0;\n    (yy_start) = 0;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    wcsutrnin = stdin;\n    wcsutrnout = stdout;\n#else\n    wcsutrnin = (FILE *) 0;\n    wcsutrnout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * wcsutrnlex_init()\n     */\n    return 0;\n}\n\n/* wcsutrnlex_destroy is for both reentrant and non-reentrant scanners. */\nint wcsutrnlex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\twcsutrn_delete_buffer(YY_CURRENT_BUFFER  );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\twcsutrnpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\twcsutrnfree((yy_buffer_stack) );\n\t(yy_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * wcsutrnlex() is called, initialization will occur. */\n    yy_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, yyconst 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 YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst 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 *wcsutrnalloc (yy_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *wcsutrnrealloc  (void * ptr, yy_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 wcsutrnfree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see wcsutrnrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 336 \"wcsutrn.l\"\n\n\n\n"},{"id":13636,"name":"cextern/wcslib/config","nodeType":"Package"},{"id":13637,"name":"elisp-comp","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#!/bin/sh\n# Copyright (C) 1995, 2000, 2003  Free Software Foundation, Inc.\n# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1995.\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 2, or (at your option)\n# 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, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\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 program.\n\n# This script byte-compiles all `.el' files which are part of its\n# arguments, using GNU Emacs, and put the resulting `.elc' files into\n# the current directory, so disregarding the original directories used\n# in `.el' arguments.\n#\n# This script manages in such a way that all Emacs LISP files to\n# be compiled are made visible between themselves, in the event\n# they require or load-library one another.\n\nif test $# = 0; then\n  echo 1>&2 \"No files given to $0\"\n  exit 1\nfi\n\nif test -z \"$EMACS\" || test \"$EMACS\" = \"t\"; then\n  # Value of \"t\" means we are running in a shell under Emacs.\n  # Just assume Emacs is called \"emacs\".\n  EMACS=emacs\nfi\n\ntempdir=elc.$$\n\n# Cleanup the temporary directory on exit.\ntrap 'status=$?; rm -rf \"$tempdir\" && exit $status' 0\ntrap '(exit $?); exit' 1 2 13 15\n\nmkdir $tempdir\ncp \"$@\" $tempdir\n\n(\n  cd $tempdir\n  echo \"(setq load-path (cons nil load-path))\" > script\n  $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?\n  mv *.elc ..\n) || exit $?\n\n(exit 0); exit\n"},{"id":13638,"name":"wcsulex.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsulex.c\"\n\n#line 4 \"wcsulex.c\"\n\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define yy_create_buffer wcsulex_create_buffer\n#define yy_delete_buffer wcsulex_delete_buffer\n#define yy_flex_debug wcsulex_flex_debug\n#define yy_init_buffer wcsulex_init_buffer\n#define yy_flush_buffer wcsulex_flush_buffer\n#define yy_load_buffer_state wcsulex_load_buffer_state\n#define yy_switch_to_buffer wcsulex_switch_to_buffer\n#define yyin wcsulexin\n#define yyleng wcsulexleng\n#define yylex wcsulexlex\n#define yylineno wcsulexlineno\n#define yyout wcsulexout\n#define yyrestart wcsulexrestart\n#define yytext wcsulextext\n#define yywrap wcsulexwrap\n#define yyalloc wcsulexalloc\n#define yyrealloc wcsulexrealloc\n#define yyfree wcsulexfree\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 5\n#define YY_FLEX_SUBMINOR_VERSION 39\n#if YY_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;\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#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define YY_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define YY_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef YY_USE_CONST\n#define yyconst const\n#else\n#define yyconst\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 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 YY_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 (yy_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 YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START (((yy_start) - 1) / 2)\n#define YYSTATE YY_START\n\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE wcsulexrestart(wcsulexin  )\n\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\nextern yy_size_t wcsulexleng;\n\nextern FILE *wcsulexin, *wcsulexout;\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 wcsulextext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = (yy_hold_char); \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\t(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up wcsulextext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) yyunput( c, (yytext_ptr)  )\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\tyy_size_t yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tyy_size_t 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 wcsulexrestart()), so that the user can continue scanning by\n\t * just pointing wcsulexin 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/* Stack of input buffers. */\nstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\nstatic YY_BUFFER_STATE * yy_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 YY_CURRENT_BUFFER ( (yy_buffer_stack) \\\n                          ? (yy_buffer_stack)[(yy_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 YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\n\n/* yy_hold_char holds the character lost when wcsulextext is formed. */\nstatic char yy_hold_char;\nstatic yy_size_t yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\nyy_size_t wcsulexleng;\n\n/* Points to current character in buffer. */\nstatic char *yy_c_buf_p = (char *) 0;\nstatic int yy_init = 0;\t\t/* whether we need to initialize */\nstatic int yy_start = 0;\t/* start state number */\n\n/* Flag which is used to allow wcsulexwrap()'s to do buffer switches\n * instead of setting up a fresh wcsulexin.  A bit of a hack ...\n */\nstatic int yy_did_buffer_switch_on_eof;\n\nvoid wcsulexrestart (FILE *input_file  );\nvoid wcsulex_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\nYY_BUFFER_STATE wcsulex_create_buffer (FILE *file,int size  );\nvoid wcsulex_delete_buffer (YY_BUFFER_STATE b  );\nvoid wcsulex_flush_buffer (YY_BUFFER_STATE b  );\nvoid wcsulexpush_buffer_state (YY_BUFFER_STATE new_buffer  );\nvoid wcsulexpop_buffer_state (void );\n\nstatic void wcsulexensure_buffer_stack (void );\nstatic void wcsulex_load_buffer_state (void );\nstatic void wcsulex_init_buffer (YY_BUFFER_STATE b,FILE *file  );\n\n#define YY_FLUSH_BUFFER wcsulex_flush_buffer(YY_CURRENT_BUFFER )\n\nYY_BUFFER_STATE wcsulex_scan_buffer (char *base,yy_size_t size  );\nYY_BUFFER_STATE wcsulex_scan_string (yyconst char *yy_str  );\nYY_BUFFER_STATE wcsulex_scan_bytes (yyconst char *bytes,yy_size_t len  );\n\nvoid *wcsulexalloc (yy_size_t  );\nvoid *wcsulexrealloc (void *,yy_size_t  );\nvoid wcsulexfree (void *  );\n\n#define yy_new_buffer wcsulex_create_buffer\n\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        wcsulexensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        wcsulexensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsulexwrap() 1\n#define YY_SKIP_YYWRAP\n\ntypedef char YY_CHAR;\n\nFILE *wcsulexin = (FILE *) 0, *wcsulexout = (FILE *) 0;\n\ntypedef int yy_state_type;\n\nextern int wcsulexlineno;\n\nint wcsulexlineno = 1;\n\nextern char *wcsulextext;\n#define yytext_ptr wcsulextext\n\nstatic yyconst 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,   14,   48,   49,   14,\n       14,   50,   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,   51,   14,   14,   14,   14,   14,   14,   14,\n\n       17,   14,   52,   14,   14,   14,   52,   19,   14,   53,\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,   54,   14,   35,   14,   14,   14,   36,   37,   38,\n       39,   55,   41,   28,   42,   14,   14,   24,   56,   44,\n       41,   29,   45,   14,   46,   47,   14,   48,   49,   14,\n       14,   50,   41,   14,   14,   14,   14,   14\n    },\n\n    {\n       13,   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       58,   59,   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\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       58,   59,   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,   57,   57,\n       57,   57,   57,   57,   57,   57,   57,   57\n    },\n\n    {\n       13,   60,   60,   60,   60,   60,   60,   60,   60,   60,\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\n       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,\n       60,   60,   60,   60,   60,   60,   60,   60,   60,   61,\n       60,   62,   60,   60,   60,   60,   60,   63,   60,   60,\n       64,   60,   60,   60,   65,   60,   60,   60,   60,   66,\n       67,   60,   60,   60,   60,   60,   60,   68,   60,   69,\n       70,   60,   71,   60,   72,   60,   60,   73,   60,   74,\n       75,   60,   76,   60,   60,   60,   60,   77,   60,   60,\n       60,   78,   79,   60,   60,   60,   60,   60\n    },\n\n    {\n       13,   60,   60,   60,   60,   60,   60,   60,   60,   60,\n       15,   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,   60,   60,\n       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,\n       60,   60,   60,   60,   60,   60,   60,   60,   60,   61,\n       60,   62,   60,   60,   60,   60,   60,   63,   60,   60,\n       64,   60,   60,   60,   65,   60,   60,   60,   60,   66,\n       67,   60,   60,   60,   60,   60,   60,   68,   60,   69,\n       70,   60,   71,   60,   72,   60,   60,   73,   60,   74,\n       75,   60,   76,   60,   60,   60,   60,   77,   60,   60,\n\n       60,   78,   79,   60,   60,   60,   60,   60\n    },\n\n    {\n       13,   80,   80,   80,   80,   80,   80,   80,   80,   80,\n       15,   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,   81,   82,   83,   84,   80,\n       85,   86,   87,   80,   88,   89,   80,   80,   90,   91,\n       92,   80,   93,   94,   95,   80,   96,   97,   80,   80,\n\n       80,   80,   80,   80,   80,   80,   80,   98,   99,  100,\n      101,  102,   80,  103,  104,   80,   80,   80,  105,  106,\n       80,   91,  107,   80,  108,  109,   80,  110,  111,   80,\n       80,  112,   80,   80,   80,   80,   80,   80\n    },\n\n    {\n       13,   80,   80,   80,   80,   80,   80,   80,   80,   80,\n       15,   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,   81,   82,   83,   84,   80,\n       85,   86,   87,   80,   88,   89,   80,   80,   90,   91,\n       92,   80,   93,   94,   95,   80,   96,   97,   80,   80,\n       80,   80,   80,   80,   80,   80,   80,   98,   99,  100,\n      101,  102,   80,  103,  104,   80,   80,   80,  105,  106,\n       80,   91,  107,   80,  108,  109,   80,  110,  111,   80,\n       80,  112,   80,   80,   80,   80,   80,   80\n    },\n\n    {\n       13,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       15,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n\n      113,  113,  114,  113,  113,  113,  113,  113,  113,  113,\n      115,  113,  116,  117,  113,  117,  118,  119,  113,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  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,  121,  122,  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    {\n       13,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n       15,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,\n      113,  113,  114,  113,  113,  113,  113,  113,  113,  113,\n      115,  113,  116,  117,  113,  117,  118,  119,  113,  120,\n      120,  120,  120,  120,  120,  120,  120,  120,  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,  121,  122,  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\n    },\n\n    {\n       13,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n       15,  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,  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\n    },\n\n    {\n       13,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n       15,  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,  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\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,  124,  -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,  125,  -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      126,  -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,  127,  -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,  128,  129,  130,  -24,  -24,\n      130,  131,  132,  -24,  133,  128,  -24,  -24,  130,  134,\n\n      135,  -24,  131,  130,  130,  -24,  130,  136,  -24,  -24,\n      -24,  -24,  -24,  -24,  -24,  -24,  -24,  137,  138,  139,\n      -24,  140,  -24,  128,  -24,  -24,  -24,  -24,  141,  142,\n      -24,  134,  143,  -24,  144,  145,  -24,  -24,  -24,  -24,\n      -24,  146,  -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,  128,  129,  130,  -25,  -25,\n      130,  131,  132,  -25,  133,  128,  -25,  -25,  130,  134,\n      135,  -25,  131,  130,  130,  -25,  130,  136,  -25,  -25,\n      -25,  -25,  -25,  -25,  -25,  -25,  -25,  137,  138,  139,\n      -25,  140,  -25,  128,  -25,  -25,  -25,  -25,  141,  142,\n      -25,  134,  143,  -25,  144,  145,  -25,  -25,  -25,  -25,\n      -25,  146,  -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,  147,  -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,  148,  -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,  149,  -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,  128,  129,  130,  -30,  -30,\n      130,  131,  132,  -30,  133,  128,  -30,  -30,  130,  134,\n      135,  -30,  131,  130,  130,  -30,  130,  136,  -30,  -30,\n      -30,  -30,  -30,  -30,  -30,  -30,  -30,  150,  138,  139,\n\n      -30,  140,  -30,  128,  -30,  -30,  -30,  -30,  141,  142,\n      -30,  134,  143,  -30,  144,  145,  -30,  -30,  -30,  -30,\n      -30,  146,  -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,  151,  -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,  152,  -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,  128,  129,  130,  -33,  -33,\n      130,  131,  132,  -33,  133,  128,  -33,  -33,  130,  134,\n      135,  -33,  131,  130,  130,  -33,  130,  136,  -33,  -33,\n      -33,  -33,  -33,  -33,  -33,  -33,  -33,  137,  138,  139,\n      -33,  140,  -33,  128,  -33,  -33,  -33,  -33,  141,  142,\n\n      -33,  134,  143,  -33,  144,  145,  -33,  -33,  -33,  -33,\n      -33,  146,  -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,  147,  -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,  128,  -36,  130,  -36,  -36,\n      130,  131,  132,  -36,  133,  128,  -36,  -36,  130,  134,\n      135,  -36,  131,  130,  130,  -36,  130,  136,  -36,  -36,\n      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  153,  139,\n      154,  140,  -36,  128,  -36,  -36,  -36,  -36,  141,  155,\n      126,  134,  -36,  -36,  156,  145,  -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,  157,  -37,  -37,\n      -37,  158,  -37,  -37,  -37,  159,  -37,  -37,  -37,  -37,\n      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,\n      -37,  127,  -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,  128,  -38,  130,  -38,  -38,\n      130,  131,  132,  -38,  133,  128,  -38,  -38,  130,  134,\n      135,  -38,  131,  130,  130,  -38,  130,  136,  -38,  -38,\n      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  153,  139,\n      160,  140,  -38,  128,  161,  -38,  -38,  -38,  141,  155,\n      -38,  162,  -38,  -38,  144,  145,  163,  -38,  -38,  -38,\n      -38,  -38,  -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,  128,  -39,  130,  -39,  -39,\n      130,  131,  132,  -39,  133,  128,  -39,  -39,  130,  134,\n      135,  -39,  131,  130,  130,  -39,  130,  136,  -39,  -39,\n      -39,  -39,  -39,  -39,  -39,  -39,  -39,  164,  153,  139,\n      -39,  165,  -39,  128,  -39,  -39,  -39,  -39,  141,  155,\n      -39,  134,  -39,  -39,  144,  145,  -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,  148,  -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,  166,  -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,  128,  -41,  130,  -41,  -41,\n\n      130,  131,  132,  -41,  133,  128,  -41,  -41,  130,  134,\n      135,  -41,  131,  130,  130,  -41,  130,  136,  -41,  -41,\n      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  153,  139,\n      -41,  140,  -41,  128,  -41,  -41,  -41,  -41,  141,  155,\n      -41,  134,  -41,  -41,  144,  145,  -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,  128,  129,  130,  -42,  -42,\n      130,  131,  132,  -42,  133,  128,  -42,  -42,  130,  134,\n      135,  -42,  131,  130,  130,  -42,  130,  136,  -42,  -42,\n      -42,  -42,  -42,  -42,  -42,  -42,  -42,  137,  138,  139,\n      -42,  140,  -42,  128,  -42,  -42,  -42,  -42,  141,  142,\n      -42,  134,  143,  -42,  144,  145,  -42,  -42,  -42,  -42,\n      -42,  146,  -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,  147,\n\n      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,\n      147,  167,  -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,  128,  -44,  130,  -44,  -44,\n      130,  131,  132,  -44,  133,  128,  -44,  -44,  130,  134,\n\n      135,  -44,  131,  130,  130,  -44,  130,  136,  -44,  -44,\n      -44,  -44,  -44,  -44,  -44,  -44,  -44,  168,  153,  139,\n      -44,  140,  -44,  128,  -44,  169,  -44,  -44,  141,  155,\n      -44,  170,  -44,  -44,  144,  145,  -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,  128,  -45,  130,  -45,  -45,\n      130,  131,  132,  -45,  133,  128,  -45,  -45,  130,  134,\n      135,  -45,  131,  130,  130,  -45,  130,  136,  -45,  -45,\n      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  153,  171,\n      -45,  140,  -45,  128,  172,  173,  -45,  -45,  141,  155,\n      -45,  134,  -45,  -45,  144,  145,  -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,  174,  -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,  175,  -47,  176,  160,  -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,  128,  -48,  130,  -48,  -48,\n      130,  131,  132,  -48,  133,  128,  -48,  -48,  130,  134,\n      135,  -48,  131,  130,  130,  -48,  130,  136,  -48,  -48,\n      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  153,  139,\n      -48,  140,  -48,  128,  -48,  -48,  -48,  -48,  141,  155,\n      -48,  134,  -48,  -48,  144,  145,  -48,  -48,  -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,  -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,  -49,  -49,  -49,  -49,  -49,\n      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,\n      -49,  177,  -49,  -49,  -49,  -49,  -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,  128,  -50,  130,  -50,  -50,\n      130,  131,  132,  -50,  133,  128,  -50,  -50,  130,  134,\n      135,  -50,  131,  130,  130,  -50,  130,  136,  -50,  -50,\n      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  153,  139,\n\n      -50,  140,  -50,  128,  -50,  -50,  -50,  -50,  141,  155,\n      -50,  134,  -50,  -50,  178,  145,  -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,  179,  -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       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,  -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,  -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,  180,  181,  -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,  -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\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,  148,  -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,  166,  -55,  -55,  -55,  -55,  -55,\n      182,  -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,  -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,  147,\n      183,  184,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,\n\n      147,  167,  -56,  -56,  -56,  -56,  -56,  -56\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      -57,  -57,  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\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      -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,  -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,  -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,  186,  -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,  -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       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,  187,  -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      188,  -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,  -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,  189,  -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,  -83,  -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,  190,  -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,  191,  -88,  -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,  -89,  -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,  192,  -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,  193,  -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       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,  -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,  194,  -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,  195,  -94,  -94,\n      -94,  -94,  -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,  -95,  -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,  196,  -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,  -98,  -98,\n      197,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      188,  -98,  -98,  -98,  198,  -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,  199,  -99,  -99,\n      -99,  200,  -99,  -99,  -99,  201,  -99,  -99,  -99,  -99,\n      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,\n      -99,  189,  -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, -100, -100, -100,\n\n      202, -100, -100, -100,  203, -100, -100, -100, -100, -100,\n     -100,  204, -100, -100, -100, -100,  205, -100, -100, -100,\n     -100, -100, -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     -101,  206, -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       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,  207, -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,  208, -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, -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       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,  209,\n     -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,\n      210,  211, -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,  212, -106, -106,\n     -106, -106, -106, -106, -106,  213, -106, -106, -106, -106,\n     -106,  214, -106, -106, -106, -106, -106, -106, -106, -106,\n\n     -106, -106, -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, -107, -107,  215,\n     -107, -107, -107, -107,  216,  217, -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       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,  218, -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       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, -109, -109, -109,\n     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,\n     -109,  219, -109, -109,  220, -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, -110, -110, -110, -110, -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,  221, -111, -111, -111, -111, -111, -111, -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,  222, -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, -113, -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,  223, -114, -114, -114, -114, -114, -114, -114,\n      224, -114,  225,  226, -114,  226,  227,  228, -114,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -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,  230,  231, -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       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,  232, -115, -115, -115, -115, -115, -115, -115,\n     -115, -115, -115,  233, -115,  233,  234, -115,  235,  236,\n\n      236,  236,  236,  236,  236,  236,  236,  236, -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,  237, -116, -116, -116, -116, -116, -116, -116,\n     -116, -116,  231, -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     -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, -117, -117, -117, -117, -117, -117, -117, -117,\n     -117, -117, -117, -117, -117, -117, -117, -117, -117,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -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,  237, -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       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,  238, -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, -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, -120, -120, -120, -120, -120, -120, -120, -120,\n     -120, -120, -120, -120, -120, -120, -120, -120,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239, -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, -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\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, -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       13,  240,  240,  240,  240,  240,  240,  240,  240,  240,\n\n     -123,  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      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\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, -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, -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, -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,  241, -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,  242, -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, -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       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, -129, -129, -129, -129,\n     -129,  243, -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, -131, -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,  130, -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,  131, -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,  244, -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       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,  130, -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       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,  130, -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       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, -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       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,  245, -138, -138,\n     -138, -138, -138, -138, -138,  246, -138, -138, -138, -138,\n     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,\n     -138,  243, -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      128, -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,  131, -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       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     -141, -141, -141, -141, -141, -141, -141, -141, -141,  130,\n     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,\n      130, -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, -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,  247, -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,  137,\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       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,  248, -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       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, -145,\n     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,\n     -145, -145, -145, -145,  128, -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, -146, -146, -146,\n     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,\n     -146, -146, -146, -146,  137, -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, -147, -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, -148, -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,  147,\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, -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       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      125, -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,  245, -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     -154, -154, -154, -154, -154, -154, -154,  163, -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,  249, -155, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,\n     -155,  247, -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,  248, -156,  250,\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       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, -157, -157, -157,\n     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,\n     -157, -157, -157, -157,  251, -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,  252, -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       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      163, -159, -159, -159, -159, -159,  253, -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, -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       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,  254, -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       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,  244, -162, -162, -162, -162, -162,\n     -162, -162, -162, -162, -162, -162, -162,  255, -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, -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       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,  128,  129,  130, -164, -164,\n      130,  131,  132, -164,  133,  128, -164, -164,  130,  134,\n\n      135, -164,  131,  130,  130, -164,  130,  136, -164, -164,\n     -164, -164, -164, -164, -164, -164, -164,  137,  138,  139,\n     -164,  140, -164,  128, -164, -164, -164, -164,  141,  142,\n     -164,  134,  143, -164,  144,  145, -164, -164, -164, -164,\n     -164,  146, -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,  131, -165, -165, -165,\n     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,\n     -165, -165, -165,  151, -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, -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,  151, -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       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, -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,  125, -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,  148, -168, -168, -168, -168, -168, -168,\n     -168, -168, -168, -168, -168,  151, -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      151, -169, -169, -169, -169, -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, -170,  244, -170, -170, -170,  160, -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       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      128, -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       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, -172, -172, -172, -172, -172, -172,\n     -172,  256, -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     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n      257, -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      160, -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       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,  258, -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       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     -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,\n     -176, -176, -176, -176,  259, -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, -177, -177,\n     -177, -177, -177, -177, -177, -177, -177, -177, -177, -177,\n      260, -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,  248, -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       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, -179, -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     -180, -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,  261,  261,\n      261,  261,  261,  261,  261,  261,  261,  261, -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, -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       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,  262, -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,  263, -183, -183, -183, -183, -183, -183, -183,\n      264, -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, -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\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,  265, -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,  185,  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, -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     -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, -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       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,  266, -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,  267, -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, -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       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,  268,\n     -192, -192, -192, -192, -192, -192, -192, -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, -195,\n      269, -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,  270, -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,  271,\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       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,  272, -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,  273, -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       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, -201,\n     -201, -201, -201, -201, -201, -201, -201, -201, -201, -201,\n      274, -201, -201, -201, -201, -201,  275, -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, -202, -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,  276, -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     -204, -204, -204, -204, -204, -204, -204,  277, -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, -206, -206, -206,\n     -206, -206, -206,  278, -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, -207, -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,  279, -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, -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       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,  280, -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,  281, -212, -212, -212, -212, -212, -212,\n     -212, -212, -212, -212, -212,  282, -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      283, -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,  284, -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, -215, -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, -216, -216, -216, -216, -216, -216, -216,\n     -216,  285, -216, -216, -216, -216, -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     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n      286, -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      287, -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       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,  288, -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, -220, -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      289, -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     -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       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      224, -223,  225,  226, -223,  226,  227,  228, -223,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -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,  230,  231, -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       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,  232, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224,  233, -224,  233,  234, -224,  235,  236,\n      236,  236,  236,  236,  236,  236,  236,  236, -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,  237, -225, -225, -225, -225, -225, -225, -225,\n     -225, -225,  231, -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       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,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -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       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,  237, -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,  238, -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       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, -229, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229,  239,  239,\n      239,  239,  239,  239,  239,  239,  239,  239, -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, -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     -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, -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       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,  232, -232, -232, -232, -232, -232, -232, -232,\n\n     -232, -232, -232,  233, -232,  233,  234, -232,  235,  236,\n      236,  236,  236,  236,  236,  236,  236,  236, -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, -233, -233, -233, -233, -233, -233, -233, -233,\n     -233, -233, -233, -233, -233, -233,  234, -233,  235,  236,\n      236,  236,  236,  236,  236,  236,  236,  236, -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,  290,  290,\n      290,  290,  290,  290,  290,  290,  290,  290, -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,  291, -235, -235, -235, -235, -235, -235, -235,\n     -235,  292, -235, -235, -235, -235,  293, -235,  294,  294,\n\n      294,  294,  294,  294,  294,  294,  294,  294, -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,  295, -236, -236, -236, -236, -236, -236, -236,\n     -236,  296, -236, -236, -236, -236,  293,  297,  298,  298,\n      298,  298,  298,  298,  298,  298,  298,  298, -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, -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, -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, -238, -238, -238, -238,\n     -238, -238, -238, -238, -238, -238, -238, -238, -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,  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       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,  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      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, -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\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,  299, -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,  253, -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,  300, -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,  130,\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,  301, -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, -246,  137, -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, -247, -247, -247, -247, -247, -247, -247,  128, -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      128, -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       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,  302, -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       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,  303,\n     -250, -250, -250, -250, -250,  304, -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      148, -251, -251, -251, -251, -251, -251, -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, -252,  125,\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     -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       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, -254, -254, -254, -254, -254, -254, -254,\n      163, -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, -255,\n      305, -255, -255, -255, -255, -255, -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     -256, -256, -256, -256, -256, -256,  306, -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,  307, -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       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,  308,  309, -258, -258,\n     -258, -258,  310, -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     -259, -259, -259, -259, -259, -259,  311, -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,  312, -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       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, -261, -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,  313, -262, -262, -262, -262, -262, -262, -262,\n\n      314, -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, -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       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      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\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, -264, -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,  315, -265, -265, -265, -265, -265, -265, -265,\n      316, -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       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, -266, -266, -266, -266, -266, -266, -266, -266, -266,\n     -266, -266, -266, -266, -266,  317, -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,  318, -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, -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       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     -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, -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, -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, -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,  319,\n     -271, -271, -271, -271, -271,  320, -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      321, -272, -272, -272, -272, -272, -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, -273, -273, -273, -273, -273, -273, -273, -273,  322,\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      323, -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, -277,\n      324, -277, -277, -277, -277, -277, -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     -278, -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, -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       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     -282, -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     -283, -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,  325, -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,  326, -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,  327,  328, -288, -288,\n     -288, -288,  329, -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,  330, -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,  291, -290, -290, -290, -290, -290, -290, -290,\n     -290,  292, -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,  292, -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       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, -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       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,  291, -293, -293, -293, -293, -293, -293, -293,\n     -293,  292, -293, -293, -293, -293, -293, -293,  331,  331,\n      331,  331,  331,  331,  331,  331,  331,  331, -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,  291, -294, -294, -294, -294, -294, -294, -294,\n     -294,  292, -294, -294, -294, -294,  293, -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\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       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,  296, -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       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, -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       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, -297, -297, -297, -297, -297, -297, -297, -297,\n     -297, -297, -297, -297, -297, -297, -297, -297, -297,  332,\n      332,  332,  332,  332,  332,  332,  332,  332, -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,  295, -298, -298, -298, -298, -298, -298, -298,\n     -298,  296, -298, -298, -298, -298,  293,  297,  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,  333, -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, -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\n     -300,  137, -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, -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\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      131, -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, -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, -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,  334, -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, -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     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304, -304, -304, -304, -304, -304, -304, -304, -304, -304,\n     -304,  335, -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, -305, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -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, -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,  163, -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,  336, -306, -306, -306, -306, -306, -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, -307, -307, -307, -307, -307, -307, -307,  163, -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     -308, -308, -308, -308, -308, -308, -308,  337, -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,  338, -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,  339, -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       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,  340, -311, -311, -311, -311, -311, -311, -311,\n      341, -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       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,  163, -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       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      314, -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, -313, -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, -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       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      316, -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, -315, -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, -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       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, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317, -317, -317, -317, -317,\n     -317, -317, -317, -317, -317, -317,  342, -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, -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, -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,  343, -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       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     -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\n     -320,  344, -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     -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       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,  205, -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,  345, -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, -326, -326, -326,  346, -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, -327, -327, -327, -327, -327, -327, -327, -327, -327,\n     -327, -327, -327, -327, -327, -327, -327,  347, -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,  348, -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,  349, -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,  350, -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,  291, -331, -331, -331, -331, -331, -331, -331,\n     -331,  292, -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       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,  351, -332, -332, -332, -332, -332, -332, -332,\n\n     -332,  352, -332, -332, -332, -332, -332, -332,  353,  353,\n      353,  353,  353,  353,  353,  353,  353,  353, -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, -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, -333, -333,\n\n     -333, -333, -333, -333,  354, -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      151, -334, -334, -334, -334, -334, -334, -334, -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, -335, -335,  151,\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, -336, -336, -336,\n     -336, -336, -336, -336, -336, -336, -336, -336, -336, -336,\n      163, -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,  125,\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, -338, -338,\n     -338, -338, -338, -338, -338,  355, -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, -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      125, -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,  340, -340, -340, -340, -340, -340, -340, -340,\n      341, -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\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, -341, -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     -342, -342, -342, -342,  356, -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, -343,\n     -343, -343, -343, -343, -343, -343, -343, -343, -343, -343,\n\n      357, -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,  358,\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       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, -345,\n      359, -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, -346, -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     -347, -347, -347, -347, -347, -347, -347, -347, -347,  360,\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     -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     -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,  361, -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      362, -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, -350, -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,  352, -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     -351, -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, -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       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,  351, -353, -353, -353, -353, -353, -353, -353,\n     -353,  352, -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       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,  363, -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, -355,\n     -355, -355, -355, -355, -355,  125, -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,  364, -356, -356, -356, -356, -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     -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       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, -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, -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, -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\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,  365, -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, -362, -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,  125,\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       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,  366,\n     -364, -364, -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\nstatic yy_state_type yy_get_previous_state (void );\nstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\nstatic int yy_get_next_buffer (void );\nstatic void yy_fatal_error (yyconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up wcsulextext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\t(yytext_ptr) = yy_bp; \\\n\t(yytext_ptr) -= (yy_more_len); \\\n\twcsulexleng = (size_t) (yy_cp - (yytext_ptr)); \\\n\t(yy_hold_char) = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\t(yy_c_buf_p) = yy_cp;\n\n#define YY_NUM_RULES 118\n#define YY_END_OF_BUFFER 119\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 yyconst flex_int16_t yy_accept[367] =\n    {   0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n      117,  117,  119,   20,  118,    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,   15,   20,   20,\n        1,    8,   20,    2,   20,   20,   23,   21,   22,   44,\n       41,   38,   37,   40,   39,   43,   42,   31,   25,   24,\n       30,   35,   36,   26,   28,   29,   27,   33,   32,  105,\n       45,  105,   57,   61,   66,   67,   69,   72,   74,   83,\n      105,  105,   89,   92,   99,  101,  103,   46,  105,  105,\n\n       62,  105,   68,   70,  105,   78,  105,  105,   93,  100,\n      105,  105,  116,  113,  112,  111,  116,  111,  114,  107,\n      115,  106,  117,    9,   15,    0,    0,   16,    0,   16,\n       16,   16,   16,    0,    0,   16,   17,    0,    0,    0,\n        0,   16,    0,    0,   16,    0,   15,   15,    0,   15,\n       15,    0,    0,    0,   16,    0,    0,    0,    0,   15,\n        0,    0,   15,    0,    0,    0,    0,    0,    0,    0,\n       15,   15,    0,    0,    0,    0,    0,   15,    1,   13,\n        4,    0,    0,    0,   23,   34,   51,    0,    0,   71,\n       73,    0,   85,   91,    0,  104,    0,    0,    0,    0,\n\n        0,   58,    0,    0,   60,    0,   65,    0,   75,   76,\n        0,    0,    0,    0,   86,   87,    0,    0,    0,   97,\n        0,   46,  113,  112,  111,    0,  111,  114,  107,  115,\n      106,    0,    0,    0,    0,    0,  111,  114,  107,  117,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,   15,    0,    0,    0,   15,    0,    0,    0,\n        3,    0,    0,    6,    0,    0,    0,   84,   98,   47,\n        0,    0,    0,   54,   55,    0,    0,   63,   64,   77,\n       79,   80,   81,   82,    0,   88,   90,    0,    0,    0,\n        0,  110,    0,    0,    0,  108,    0,    0,    0,    0,\n\n        0,   18,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    7,    0,    5,    0,   56,    0,    0,\n       52,   53,   59,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n       10,    0,    0,    0,    0,   88,    0,    0,    0,  102,\n        0,  109,    0,    0,    0,    0,   49,   50,   87,   94,\n        0,   96,    0,    0,   95,   48\n    } ;\n\nstatic yy_state_type yy_last_accepting_state;\nstatic char *yy_last_accepting_cpos;\n\nstatic yyconst yy_state_type yy_NUL_trans[367] =\n    {   0,\n       14,   14,   57,   57,   60,   60,   80,   80,  113,  113,\n      123,  123,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,  185,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  240,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  185,    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,  240,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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\n    } ;\n\nextern int wcsulex_flex_debug;\nint wcsulex_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\nstatic int yy_more_flag = 0;\nstatic int yy_more_len = 0;\n#define yymore() ((yy_more_flag) = 1)\n#define YY_MORE_ADJ (yy_more_len)\n#define YY_RESTORE_YY_MORE_OFFSET\nchar *wcsulextext;\n#line 1 \"wcsulex.l\"\n/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsulex.c,v 5.17 2017/09/18 08:44:24 mcalabre Exp $\n*=============================================================================\n*\n* wcsulex.l is a Flex description file containing the definition of a\n* recursive, multi-buffered lexical scanner that parses 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/* 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/* To get the prototype for fileno() from stdio.h when gcc is invoked with\n * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */\n#define _POSIX_SOURCE 1\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#define YY_DECL int wcsulexe(const char unitstr[], int *func, double *scale, \\\n                             double units[WCSUNITS_NTYPE], struct wcserr **err)\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsulex_abort_jmp_env;\n#define exit(status) longjmp(wcsulex_abort_jmp_env, status)\n\n#line 6934 \"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#ifndef YY_EXTRA_TYPE\n#define YY_EXTRA_TYPE void *\n#endif\n\nstatic int yy_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint wcsulexlex_destroy (void );\n\nint wcsulexget_debug (void );\n\nvoid wcsulexset_debug (int debug_flag  );\n\nYY_EXTRA_TYPE wcsulexget_extra (void );\n\nvoid wcsulexset_extra (YY_EXTRA_TYPE user_defined  );\n\nFILE *wcsulexget_in (void );\n\nvoid wcsulexset_in  (FILE * in_str  );\n\nFILE *wcsulexget_out (void );\n\nvoid wcsulexset_out  (FILE * out_str  );\n\nyy_size_t wcsulexget_leng (void );\n\nchar *wcsulexget_text (void );\n\nint wcsulexget_lineno (void );\n\nvoid wcsulexset_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 YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int wcsulexwrap (void );\n#else\nextern int wcsulexwrap (void );\n#endif\n#endif\n\n    static void yyunput (int c,char *buf_ptr  );\n    \n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char *,yyconst char *,int );\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst char * );\n#endif\n\n#ifndef YY_NO_INPUT\n\n#ifdef __cplusplus\nstatic int yyinput (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 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( wcsulextext, wcsulexleng, 1, wcsulexout )) {} } 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 = read( fileno(wcsulexin), (char *) 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(wcsulexin); \\\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 )\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 wcsulexlex (void);\n\n#define YY_DECL int wcsulexlex (void)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after wcsulextext and wcsulexleng\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 break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( wcsulexleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(wcsulextext[wcsulexleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp, *yy_bp;\n\tregister int yy_act;\n    \n\tif ( !(yy_init) )\n\t\t{\n\t\t(yy_init) = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! (yy_start) )\n\t\t\t(yy_start) = 1;\t/* first start state */\n\n\t\tif ( ! wcsulexin )\n\t\t\twcsulexin = stdin;\n\n\t\tif ( ! wcsulexout )\n\t\t\twcsulexout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\twcsulexensure_buffer_stack ();\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\twcsulex_create_buffer(wcsulexin,YY_BUF_SIZE );\n\t\t}\n\n\t\twcsulex_load_buffer_state( );\n\t\t}\n\n\t{\n#line 108 \"wcsulex.l\"\n\n\tstatic const char *function = \"wcsulexe\";\n\t\n\tchar ctmp[72];\n\tint bracket  = 0;\n\tint operator = 0;\n\tint paren    = 0;\n\tint status   = 0;\n\tint func_r, i, j;\n\tdouble dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE];\n\tYY_BUFFER_STATE buf;\n\tvoid add(double *factor, double types[], double *expon, double *scale,\n\t    double units[]);\n\tint wcsulexlex_destroy(void);\n\t\n\tif (err) *err = 0x0;\n\t\n\t*func = 0;\n\tfor (i = 0; i < WCSUNITS_NTYPE; i++) {\n\t  units[i] = 0.0;\n\t  types[i] = 0.0;\n\t}\n\texpon  = 1.0;\n\tfactor = 1.0;\n\t*scale = 1.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  wcsulex_delete_buffer(YY_CURRENT_BUFFER);\n\t}\n\t\n\twcsulex_scan_string(unitstr);\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsulex_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 7186 \"wcsulex.c\"\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\t(yy_more_len) = 0;\n\t\tif ( (yy_more_flag) )\n\t\t\t{\n\t\t\t(yy_more_len) = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t(yy_more_flag) = 0;\n\t\t\t}\n\t\tyy_cp = (yy_c_buf_p);\n\n\t\t/* Support of wcsulextext. */\n\t\t*yy_cp = (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 = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t\t(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 = (yy_hold_char);\n\t\t\tyy_cp = (yy_last_accepting_cpos) + 1;\n\t\t\tyy_current_state = (yy_last_accepting_state);\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 153 \"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 158 \"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 166 \"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 172 \"wcsulex.l\"\n{\n\t  factor = 10.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 177 \"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 183 \"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 189 \"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 195 \"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 202 \"wcsulex.l\"\n/* Discard whitespace in INITIAL context. */\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 204 \"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 210 \"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 216 \"wcsulex.l\"\n{\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 13:\n#line 223 \"wcsulex.l\"\ncase 14:\nYY_RULE_SETUP\n#line 223 \"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 231 \"wcsulex.l\"\n{\n\t  operator = 0;\n\t  yyless(0);\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 16:\n#line 238 \"wcsulex.l\"\ncase 17:\n#line 239 \"wcsulex.l\"\ncase 18:\nYY_RULE_SETUP\n#line 239 \"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 245 \"wcsulex.l\"\n{\n\t  bracket = !bracket;\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 20:\nYY_RULE_SETUP\n#line 250 \"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 256 \"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 262 \"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    wcsulextext[wcsulexleng-1] = '\\0';\n\t\n\t    buf = YY_CURRENT_BUFFER;\n\t    status = wcsulexe(wcsulextext+1, &func_r, &factor_r, types, err);\n\t    wcsulex_switch_to_buffer(buf);\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 290 \"wcsulex.l\"\n{\n\t  yymore();\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 294 \"wcsulex.l\"\n{\n\t  factor = 1e-1;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 25:\nYY_RULE_SETUP\n#line 299 \"wcsulex.l\"\n{\n\t  factor = 1e-2;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 26:\nYY_RULE_SETUP\n#line 304 \"wcsulex.l\"\n{\n\t  factor = 1e-3;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 309 \"wcsulex.l\"\n{\n\t  factor = 1e-6;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 314 \"wcsulex.l\"\n{\n\t  factor = 1e-9;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 319 \"wcsulex.l\"\n{\n\t  factor = 1e-12;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 30:\nYY_RULE_SETUP\n#line 324 \"wcsulex.l\"\n{\n\t  factor = 1e-15;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 329 \"wcsulex.l\"\n{\n\t  factor = 1e-18;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 32:\nYY_RULE_SETUP\n#line 334 \"wcsulex.l\"\n{\n\t  factor = 1e-21;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 33:\nYY_RULE_SETUP\n#line 339 \"wcsulex.l\"\n{\n\t  factor = 1e-24;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 34:\nYY_RULE_SETUP\n#line 344 \"wcsulex.l\"\n{\n\t  factor = 1e+1;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 35:\nYY_RULE_SETUP\n#line 349 \"wcsulex.l\"\n{\n\t  factor = 1e+2;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 36:\nYY_RULE_SETUP\n#line 354 \"wcsulex.l\"\n{\n\t  factor = 1e+3;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 37:\nYY_RULE_SETUP\n#line 359 \"wcsulex.l\"\n{\n\t  factor = 1e+6;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 38:\nYY_RULE_SETUP\n#line 364 \"wcsulex.l\"\n{\n\t  factor = 1e+9;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 39:\nYY_RULE_SETUP\n#line 369 \"wcsulex.l\"\n{\n\t  factor = 1e+12;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 40:\nYY_RULE_SETUP\n#line 374 \"wcsulex.l\"\n{\n\t  factor = 1e+15;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 41:\nYY_RULE_SETUP\n#line 379 \"wcsulex.l\"\n{\n\t  factor = 1e+18;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 42:\nYY_RULE_SETUP\n#line 384 \"wcsulex.l\"\n{\n\t  factor = 1e+21;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 43:\nYY_RULE_SETUP\n#line 389 \"wcsulex.l\"\n{\n\t  factor = 1e+24;\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 44:\nYY_RULE_SETUP\n#line 394 \"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 401 \"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 408 \"wcsulex.l\"\n{\n\t  /* 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 415 \"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 421 \"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 428 \"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 435 \"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 442 \"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 449 \"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 456 \"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 462 \"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 468 \"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 474 \"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 481 \"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 487 \"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 493 \"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 499 \"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 505 \"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 62:\nYY_RULE_SETUP\n#line 513 \"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 63:\nYY_RULE_SETUP\n#line 520 \"wcsulex.l\"\n{\n\t  /* Degree. */\n\t  types[WCSUNITS_PLANE_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 64:\nYY_RULE_SETUP\n#line 526 \"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 65:\nYY_RULE_SETUP\n#line 535 \"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 66:\nYY_RULE_SETUP\n#line 544 \"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 67:\nYY_RULE_SETUP\n#line 553 \"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 68:\nYY_RULE_SETUP\n#line 562 \"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 69:\nYY_RULE_SETUP\n#line 569 \"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 70:\nYY_RULE_SETUP\n#line 578 \"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 71:\nYY_RULE_SETUP\n#line 585 \"wcsulex.l\"\n{\n\t  /* Hertz. */\n\t  types[WCSUNITS_TIME] -= 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 72:\nYY_RULE_SETUP\n#line 591 \"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 73:\nYY_RULE_SETUP\n#line 599 \"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 74:\nYY_RULE_SETUP\n#line 607 \"wcsulex.l\"\n{\n\t  /* Kelvin. */\n\t  types[WCSUNITS_TEMPERATURE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 75:\nYY_RULE_SETUP\n#line 613 \"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 76:\nYY_RULE_SETUP\n#line 620 \"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 77:\nYY_RULE_SETUP\n#line 628 \"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 78:\nYY_RULE_SETUP\n#line 635 \"wcsulex.l\"\n{\n\t  /* Metre. */\n\t  types[WCSUNITS_LENGTH] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 79:\nYY_RULE_SETUP\n#line 641 \"wcsulex.l\"\n{\n\t  /* Stellar magnitude. */\n\t  types[WCSUNITS_MAGNITUDE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 80:\nYY_RULE_SETUP\n#line 647 \"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 81:\nYY_RULE_SETUP\n#line 654 \"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 82:\nYY_RULE_SETUP\n#line 661 \"wcsulex.l\"\n{\n\t  /* Mole. */\n\t  types[WCSUNITS_MOLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 83:\nYY_RULE_SETUP\n#line 667 \"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 84:\nYY_RULE_SETUP\n#line 675 \"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 85:\nYY_RULE_SETUP\n#line 684 \"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 86:\nYY_RULE_SETUP\n#line 692 \"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 87:\nYY_RULE_SETUP\n#line 699 \"wcsulex.l\"\n{\n\t  /* Photon. */\n\t  types[WCSUNITS_COUNT] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 88:\nYY_RULE_SETUP\n#line 705 \"wcsulex.l\"\n{\n\t  /* Pixel. */\n\t  types[WCSUNITS_PIXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 89:\nYY_RULE_SETUP\n#line 711 \"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 90:\nYY_RULE_SETUP\n#line 720 \"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 91:\nYY_RULE_SETUP\n#line 727 \"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 92:\nYY_RULE_SETUP\n#line 736 \"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 93:\nYY_RULE_SETUP\n#line 745 \"wcsulex.l\"\n{\n\t  /* Second. */\n\t  types[WCSUNITS_TIME] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 94:\nYY_RULE_SETUP\n#line 751 \"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 95:\nYY_RULE_SETUP\n#line 760 \"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 96:\nYY_RULE_SETUP\n#line 767 \"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 97:\nYY_RULE_SETUP\n#line 774 \"wcsulex.l\"\n{\n\t  /* Steradian. */\n\t  types[WCSUNITS_SOLID_ANGLE] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 98:\nYY_RULE_SETUP\n#line 780 \"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 99:\nYY_RULE_SETUP\n#line 786 \"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 100:\nYY_RULE_SETUP\n#line 794 \"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 101:\nYY_RULE_SETUP\n#line 801 \"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 102:\nYY_RULE_SETUP\n#line 810 \"wcsulex.l\"\n{\n\t  /* Voxel. */\n\t  types[WCSUNITS_VOXEL] += 1.0;\n\t  BEGIN(EXPON);\n\t}\n\tYY_BREAK\ncase 103:\nYY_RULE_SETUP\n#line 816 \"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 104:\nYY_RULE_SETUP\n#line 824 \"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 105:\nYY_RULE_SETUP\n#line 833 \"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 106:\nYY_RULE_SETUP\n#line 840 \"wcsulex.l\"\n{\n\t  /* Exponentiation. */\n\t  if (operator++) {\n\t    BEGIN(FLUSH);\n\t  }\n\t}\n\tYY_BREAK\ncase 107:\nYY_RULE_SETUP\n#line 847 \"wcsulex.l\"\n{\n\t  sscanf(wcsulextext, \" %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 108:\nYY_RULE_SETUP\n#line 855 \"wcsulex.l\"\n{\n\t  sscanf(wcsulextext, \" (%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 109:\nYY_RULE_SETUP\n#line 863 \"wcsulex.l\"\n{\n\t  sscanf(wcsulextext, \" (%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 110:\nYY_RULE_SETUP\n#line 871 \"wcsulex.l\"\n{\n\t  sscanf(wcsulextext, \" (%s)\", ctmp);\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 111:\nYY_RULE_SETUP\n#line 880 \"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 112:\nYY_RULE_SETUP\n#line 890 \"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 113:\nYY_RULE_SETUP\n#line 901 \"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 911 \"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 115:\nYY_RULE_SETUP\n#line 922 \"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 116:\nYY_RULE_SETUP\n#line 928 \"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 117:\nYY_RULE_SETUP\n#line 934 \"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 938 \"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  wcsulexlex_destroy();\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 (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 118:\nYY_RULE_SETUP\n#line 974 \"wcsulex.l\"\nECHO;\n\tYY_BREAK\n#line 8417 \"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 - (yytext_ptr)) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = (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 wcsulexin at a new source and called\n\t\t\t * wcsulexlex().  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\t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsulexin;\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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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\t(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_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 * 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 );\n\n\t\t\tyy_bp = (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 = ++(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 = (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(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(yy_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( wcsulexwrap( ) )\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 * wcsulextext, 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\t(yy_c_buf_p) = (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 ( ! (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\t(yy_c_buf_p) =\n\t\t\t\t\t(yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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\t(yy_c_buf_p) =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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 wcsulexlex */\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 (void)\n{\n    \tregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tregister char *source = (yytext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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 ( (yy_c_buf_p) - (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) ((yy_c_buf_p) - (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 = (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) ((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\tyy_size_t 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\twcsulexrealloc((void *) b->yy_ch_buf,b->yy_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->yy_ch_buf = 0;\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\t(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\t(yy_n_chars), num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tif ( (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\twcsulexrestart(wcsulexin  );\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 ((yy_size_t) ((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\tyy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsulexrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\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}\n\n\t(yy_n_chars) += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\n\n\t(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 (void)\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp;\n    \n\tyy_current_state = (yy_start);\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(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 )\n{\n\tregister int yy_is_jam;\n    \tregister char *yy_cp = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(yy_last_accepting_cpos) = yy_cp;\n\t\t\t}\n\t\t}\n\n\t\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n    static void yyunput (int c, register char * yy_bp )\n{\n\tregister char *yy_cp;\n    \n    yy_cp = (yy_c_buf_p);\n\n\t/* undo effects of setting up wcsulextext */\n\t*yy_cp = (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\tregister yy_size_t number_to_move = (yy_n_chars) + 2;\n\t\tregister char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tregister char *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\t(yy_n_chars) = 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\t(yytext_ptr) = yy_bp;\n\t(yy_hold_char) = *yy_cp;\n\t(yy_c_buf_p) = yy_cp;\n}\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(yy_c_buf_p) = (yy_hold_char);\n\n\tif ( *(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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(yy_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tyy_size_t offset = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t++(yy_c_buf_p);\n\n\t\t\tswitch ( yy_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 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\twcsulexrestart(wcsulexin );\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 ( wcsulexwrap( ) )\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tif ( ! (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();\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(yy_c_buf_p) = (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 *) (yy_c_buf_p);\t/* cast for 8-bit char's */\n\t*(yy_c_buf_p) = '\\0';\t/* preserve wcsulextext */\n\t(yy_hold_char) = *++(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 * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void wcsulexrestart  (FILE * input_file )\n{\n    \n\tif ( ! YY_CURRENT_BUFFER ){\n        wcsulexensure_buffer_stack ();\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE );\n\t}\n\n\twcsulex_init_buffer(YY_CURRENT_BUFFER,input_file );\n\twcsulex_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void wcsulex_switch_to_buffer  (YY_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\twcsulexpop_buffer_state();\n\t *\t\twcsulexpush_buffer_state(new_buffer);\n     */\n\twcsulexensure_buffer_stack ();\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*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\twcsulex_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (wcsulexwrap()) processing, but the only time this flag\n\t * is looked at is after wcsulexwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(yy_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void wcsulex_load_buffer_state  (void)\n{\n    \t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\twcsulexin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\t(yy_hold_char) = *(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 * \n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE wcsulex_create_buffer  (FILE * file, int  size )\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) wcsulexalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulex_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 *) wcsulexalloc(b->yy_buf_size + 2  );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulex_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\twcsulex_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with wcsulex_create_buffer()\n * \n */\n    void wcsulex_delete_buffer (YY_BUFFER_STATE  b )\n{\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\twcsulexfree((void *) b->yy_ch_buf  );\n\n\twcsulexfree((void *) b  );\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 wcsulexrestart() or at EOF.\n */\n    static void wcsulex_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\twcsulex_flush_buffer(b );\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then wcsulex_init_buffer was _probably_\n     * called from wcsulexrestart() 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 * \n */\n    void wcsulex_flush_buffer (YY_BUFFER_STATE  b )\n{\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\twcsulex_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 wcsulexpush_buffer_state (YY_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\twcsulexensure_buffer_stack();\n\n\t/* This block is copied from wcsulex_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\t(yy_buffer_stack_top)++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from wcsulex_switch_to_buffer. */\n\twcsulex_load_buffer_state( );\n\t(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 *  \n */\nvoid wcsulexpop_buffer_state (void)\n{\n    \tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\twcsulex_delete_buffer(YY_CURRENT_BUFFER );\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((yy_buffer_stack_top) > 0)\n\t\t--(yy_buffer_stack_top);\n\n\tif (YY_CURRENT_BUFFER) {\n\t\twcsulex_load_buffer_state( );\n\t\t(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 wcsulexensure_buffer_stack (void)\n{\n\tyy_size_t num_to_alloc;\n    \n\tif (!(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\t\tnum_to_alloc = 1;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsulexalloc\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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulexensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\t\t\t\t\n\t\t(yy_buffer_stack_max) = num_to_alloc;\n\t\t(yy_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((yy_buffer_stack_top) >= ((yy_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 = (yy_buffer_stack_max) + grow_size;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsulexrealloc\n\t\t\t\t\t\t\t\t((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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulexensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\t(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 * \n * @return the newly allocated buffer state object. \n */\nYY_BUFFER_STATE wcsulex_scan_buffer  (char * base, yy_size_t  size )\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 0;\n\n\tb = (YY_BUFFER_STATE) wcsulexalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulex_scan_buffer()\" );\n\n\tb->yy_buf_size = 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 = 0;\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\twcsulex_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to wcsulexlex() will\n * scan from a @e copy of @a str.\n * @param yystr 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 *       wcsulex_scan_bytes() instead.\n */\nYY_BUFFER_STATE wcsulex_scan_string (yyconst char * yystr )\n{\n    \n\treturn wcsulex_scan_bytes(yystr,strlen(yystr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to wcsulexlex() 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 * \n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE wcsulex_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tyy_size_t i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _yybytes_len + 2;\n\tbuf = (char *) wcsulexalloc(n  );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsulex_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 = wcsulex_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in wcsulex_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 yy_fatal_error (yyconst char* msg )\n{\n    \t(void) fprintf( 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 wcsulextext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\twcsulextext[wcsulexleng] = (yy_hold_char); \\\n\t\t(yy_c_buf_p) = wcsulextext + yyless_macro_arg; \\\n\t\t(yy_hold_char) = *(yy_c_buf_p); \\\n\t\t*(yy_c_buf_p) = '\\0'; \\\n\t\twcsulexleng = yyless_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 wcsulexget_lineno  (void)\n{\n        \n    return wcsulexlineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *wcsulexget_in  (void)\n{\n        return wcsulexin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *wcsulexget_out  (void)\n{\n        return wcsulexout;\n}\n\n/** Get the length of the current token.\n * \n */\nyy_size_t wcsulexget_leng  (void)\n{\n        return wcsulexleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *wcsulexget_text  (void)\n{\n        return wcsulextext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid wcsulexset_lineno (int  line_number )\n{\n    \n    wcsulexlineno = 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 wcsulex_switch_to_buffer\n */\nvoid wcsulexset_in (FILE *  in_str )\n{\n        wcsulexin = in_str ;\n}\n\nvoid wcsulexset_out (FILE *  out_str )\n{\n        wcsulexout = out_str ;\n}\n\nint wcsulexget_debug  (void)\n{\n        return wcsulex_flex_debug;\n}\n\nvoid wcsulexset_debug (int  bdebug )\n{\n        wcsulex_flex_debug = bdebug ;\n}\n\nstatic int yy_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from wcsulexlex_destroy(), so don't allocate here.\n     */\n\n    (yy_buffer_stack) = 0;\n    (yy_buffer_stack_top) = 0;\n    (yy_buffer_stack_max) = 0;\n    (yy_c_buf_p) = (char *) 0;\n    (yy_init) = 0;\n    (yy_start) = 0;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    wcsulexin = stdin;\n    wcsulexout = stdout;\n#else\n    wcsulexin = (FILE *) 0;\n    wcsulexout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * wcsulexlex_init()\n     */\n    return 0;\n}\n\n/* wcsulexlex_destroy is for both reentrant and non-reentrant scanners. */\nint wcsulexlex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\twcsulex_delete_buffer(YY_CURRENT_BUFFER  );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\twcsulexpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\twcsulexfree((yy_buffer_stack) );\n\t(yy_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * wcsulexlex() is called, initialization will occur. */\n    yy_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, yyconst 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 YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst 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 *wcsulexalloc (yy_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *wcsulexrealloc  (void * ptr, yy_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 wcsulexfree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see wcsulexrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 973 \"wcsulex.l\"\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  int i;\n\n  *scale *= pow(*factor, *expon);\n\n  for (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"},{"id":13639,"name":"missing","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# Common stub for a few missing GNU programs while installing.\n\nscriptversion=2003-09-02.23\n\n# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 \n#   Free Software Foundation, Inc.\n# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.\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 2, or (at your option)\n# 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, write to the Free Software\n# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n# 02111-1307, USA.\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 program.\n\nif test $# -eq 0; then\n  echo 1>&2 \"Try \\`$0 --help' for more information\"\n  exit 1\nfi\n\nrun=:\n\n# In the cases where this matters, `missing' is being run in the\n# srcdir already.\nif test -f configure.ac; then\n  configure_ac=configure.ac\nelse\n  configure_ac=configure.in\nfi\n\nmsg=\"missing on your system\"\n\ncase \"$1\" in\n--run)\n  # Try to run requested program, and just exit if it succeeds.\n  run=\n  shift\n  \"$@\" && exit 0\n  # Exit code 63 means version mismatch.  This often happens\n  # when the user try to use an ancient version of a tool on\n  # a file that requires a minimum version.  In this case we\n  # we should proceed has if the program had been absent, or\n  # if --run hadn't been passed.\n  if test $? = 63; then\n    run=:\n    msg=\"probably too old\"\n  fi\n  ;;\nesac\n\n# If it does not exist, or fails to run (possibly an outdated version),\n# try to emulate it.\ncase \"$1\" in\n\n  -h|--h|--he|--hel|--help)\n    echo \"\\\n$0 [OPTION]... PROGRAM [ARGUMENT]...\n\nHandle \\`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an\nerror status if there is no known handling for PROGRAM.\n\nOptions:\n  -h, --help      display this help and exit\n  -v, --version   output version information and exit\n  --run           try to run the given command, and emulate it if it fails\n\nSupported PROGRAM values:\n  aclocal      touch file \\`aclocal.m4'\n  autoconf     touch file \\`configure'\n  autoheader   touch file \\`config.h.in'\n  automake     touch all \\`Makefile.in' files\n  bison        create \\`y.tab.[ch]', if possible, from existing .[ch]\n  flex         create \\`lex.yy.c', if possible, from existing .c\n  help2man     touch the output file\n  lex          create \\`lex.yy.c', if possible, from existing .c\n  makeinfo     touch the output file\n  tar          try tar, gnutar, gtar, then tar without non-portable flags\n  yacc         create \\`y.tab.[ch]', if possible, from existing .[ch]\n\nSend bug reports to <bug-automake@gnu.org>.\"\n    ;;\n\n  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)\n    echo \"missing $scriptversion (GNU Automake)\"\n    ;;\n\n  -*)\n    echo 1>&2 \"$0: Unknown \\`$1' option\"\n    echo 1>&2 \"Try \\`$0 --help' for more information\"\n    exit 1\n    ;;\n\n  aclocal*)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acinclude.m4' or \\`${configure_ac}'.  You might want\n         to install the \\`Automake' and \\`Perl' packages.  Grab them from\n         any GNU archive site.\"\n    touch aclocal.m4\n    ;;\n\n  autoconf)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`${configure_ac}'.  You might want to install the\n         \\`Autoconf' and \\`GNU m4' packages.  Grab them from any GNU\n         archive site.\"\n    touch configure\n    ;;\n\n  autoheader)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`acconfig.h' or \\`${configure_ac}'.  You might want\n         to install the \\`Autoconf' and \\`GNU m4' packages.  Grab them\n         from any GNU archive site.\"\n    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\\([^)]*\\)).*/\\1/p' ${configure_ac}`\n    test -z \"$files\" && files=\"config.h\"\n    touch_files=\n    for f in $files; do\n      case \"$f\" in\n      *:*) touch_files=\"$touch_files \"`echo \"$f\" |\n\t\t\t\t       sed -e 's/^[^:]*://' -e 's/:.*//'`;;\n      *) touch_files=\"$touch_files $f.in\";;\n      esac\n    done\n    touch $touch_files\n    ;;\n\n  automake*)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified \\`Makefile.am', \\`acinclude.m4' or \\`${configure_ac}'.\n         You might want to install the \\`Automake' and \\`Perl' packages.\n         Grab them from any GNU archive site.\"\n    find . -type f -name Makefile.am -print |\n\t   sed 's/\\.am$/.in/' |\n\t   while read f; do touch \"$f\"; done\n    ;;\n\n  autom4te)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, but is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.\n         You can get \\`$1' as part of \\`Autoconf' from any GNU\n         archive site.\"\n\n    file=`echo \"$*\" | sed -n 's/.*--output[ =]*\\([^ ]*\\).*/\\1/p'`\n    test -z \"$file\" && file=`echo \"$*\" | sed -n 's/.*-o[ ]*\\([^ ]*\\).*/\\1/p'`\n    if test -f \"$file\"; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \"#! /bin/sh\"\n\techo \"# Created by GNU Automake missing as a replacement of\"\n\techo \"#  $ $@\"\n\techo \"exit 0\"\n\tchmod +x $file\n\texit 1\n    fi\n    ;;\n\n  bison|yacc)\n    echo 1>&2 \"\\\nWARNING: \\`$1' $msg.  You should only need it if\n         you modified a \\`.y' file.  You may need the \\`Bison' package\n         in order for those modifications to take effect.  You can get\n         \\`Bison' from any GNU archive site.\"\n    rm -f y.tab.c y.tab.h\n    if [ $# -ne 1 ]; then\n        eval LASTARG=\"\\${$#}\"\n\tcase \"$LASTARG\" in\n\t*.y)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/c/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" y.tab.c\n\t    fi\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/y$/h/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" y.tab.h\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if [ ! -f y.tab.h ]; then\n\techo >y.tab.h\n    fi\n    if [ ! -f y.tab.c ]; then\n\techo 'main() { return 0; }' >y.tab.c\n    fi\n    ;;\n\n  lex|flex)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.l' file.  You may need the \\`Flex' package\n         in order for those modifications to take effect.  You can get\n         \\`Flex' from any GNU archive site.\"\n    rm -f lex.yy.c\n    if [ $# -ne 1 ]; then\n        eval LASTARG=\"\\${$#}\"\n\tcase \"$LASTARG\" in\n\t*.l)\n\t    SRCFILE=`echo \"$LASTARG\" | sed 's/l$/c/'`\n\t    if [ -f \"$SRCFILE\" ]; then\n\t         cp \"$SRCFILE\" lex.yy.c\n\t    fi\n\t  ;;\n\tesac\n    fi\n    if [ ! -f lex.yy.c ]; then\n\techo 'main() { return 0; }' >lex.yy.c\n    fi\n    ;;\n\n  help2man)\n    if test -z \"$run\" && ($1 --version) > /dev/null 2>&1; then\n       # We have it, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n\t you modified a dependency of a manual page.  You may need the\n\t \\`Help2man' package in order for those modifications to take\n\t effect.  You can get \\`Help2man' from any GNU archive site.\"\n\n    file=`echo \"$*\" | sed -n 's/.*-o \\([^ ]*\\).*/\\1/p'`\n    if test -z \"$file\"; then\n\tfile=`echo \"$*\" | sed -n 's/.*--output=\\([^ ]*\\).*/\\1/p'`\n    fi\n    if [ -f \"$file\" ]; then\n\ttouch $file\n    else\n\ttest -z \"$file\" || exec >$file\n\techo \".ab help2man is required to generate this page\"\n\texit 1\n    fi\n    ;;\n\n  makeinfo)\n    if test -z \"$run\" && (makeinfo --version) > /dev/null 2>&1; then\n       # We have makeinfo, but it failed.\n       exit 1\n    fi\n\n    echo 1>&2 \"\\\nWARNING: \\`$1' is $msg.  You should only need it if\n         you modified a \\`.texi' or \\`.texinfo' file, or any other file\n         indirectly affecting the aspect of the manual.  The spurious\n         call might also be the consequence of using a buggy \\`make' (AIX,\n         DU, IRIX).  You might want to install the \\`Texinfo' package or\n         the \\`GNU make' package.  Grab either from any GNU archive site.\"\n    file=`echo \"$*\" | sed -n 's/.*-o \\([^ ]*\\).*/\\1/p'`\n    if test -z \"$file\"; then\n      file=`echo \"$*\" | sed 's/.* \\([^ ]*\\) *$/\\1/'`\n      file=`sed -n '/^@setfilename/ { s/.* \\([^ ]*\\) *$/\\1/; p; q; }' $file`\n    fi\n    touch $file\n    ;;\n\n  tar)\n    shift\n    if test -n \"$run\"; then\n      echo 1>&2 \"ERROR: \\`tar' requires --run\"\n      exit 1\n    fi\n\n    # We have already tried tar in the generic part.\n    # Look for gnutar/gtar before invocation to avoid ugly error\n    # messages.\n    if (gnutar --version > /dev/null 2>&1); then\n       gnutar \"$@\" && exit 0\n    fi\n    if (gtar --version > /dev/null 2>&1); then\n       gtar \"$@\" && exit 0\n    fi\n    firstarg=\"$1\"\n    if shift; then\n\tcase \"$firstarg\" in\n\t*o*)\n\t    firstarg=`echo \"$firstarg\" | sed s/o//`\n\t    tar \"$firstarg\" \"$@\" && exit 0\n\t    ;;\n\tesac\n\tcase \"$firstarg\" in\n\t*h*)\n\t    firstarg=`echo \"$firstarg\" | sed s/h//`\n\t    tar \"$firstarg\" \"$@\" && exit 0\n\t    ;;\n\tesac\n    fi\n\n    echo 1>&2 \"\\\nWARNING: I can't seem to be able to run \\`tar' with the given arguments.\n         You may want to install GNU tar or Free paxutils, or check the\n         command line arguments.\"\n    exit 1\n    ;;\n\n  *)\n    echo 1>&2 \"\\\nWARNING: \\`$1' is needed, and is $msg.\n         You might have modified some files without having the\n         proper tools for further handling them.  Check the \\`README' file,\n         it often tells you about the needed prerequisites for installing\n         this package.  You may also peek at any GNU archive site, in case\n         some other package would contain this missing \\`$1' program.\"\n    exit 1\n    ;;\nesac\n\nexit 0\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-end: \"$\"\n# End:\n"},{"id":13640,"name":"fitshdr.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"fitshdr.c\"\n\n#line 4 \"fitshdr.c\"\n\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define yy_create_buffer fitshdr_create_buffer\n#define yy_delete_buffer fitshdr_delete_buffer\n#define yy_flex_debug fitshdr_flex_debug\n#define yy_init_buffer fitshdr_init_buffer\n#define yy_flush_buffer fitshdr_flush_buffer\n#define yy_load_buffer_state fitshdr_load_buffer_state\n#define yy_switch_to_buffer fitshdr_switch_to_buffer\n#define yyin fitshdrin\n#define yyleng fitshdrleng\n#define yylex fitshdrlex\n#define yylineno fitshdrlineno\n#define yyout fitshdrout\n#define yyrestart fitshdrrestart\n#define yytext fitshdrtext\n#define yywrap fitshdrwrap\n#define yyalloc fitshdralloc\n#define yyrealloc fitshdrrealloc\n#define yyfree fitshdrfree\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 5\n#define YY_FLEX_SUBMINOR_VERSION 39\n#if YY_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;\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#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define YY_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define YY_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef YY_USE_CONST\n#define yyconst const\n#else\n#define yyconst\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 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 YY_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 (yy_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 YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START (((yy_start) - 1) / 2)\n#define YYSTATE YY_START\n\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE fitshdrrestart(fitshdrin  )\n\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\nextern yy_size_t fitshdrleng;\n\nextern FILE *fitshdrin, *fitshdrout;\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 fitshdrtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = (yy_hold_char); \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\t(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up fitshdrtext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) yyunput( c, (yytext_ptr)  )\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\tyy_size_t yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tyy_size_t 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 fitshdrrestart()), so that the user can continue scanning by\n\t * just pointing fitshdrin 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/* Stack of input buffers. */\nstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\nstatic YY_BUFFER_STATE * yy_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 YY_CURRENT_BUFFER ( (yy_buffer_stack) \\\n                          ? (yy_buffer_stack)[(yy_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 YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\n\n/* yy_hold_char holds the character lost when fitshdrtext is formed. */\nstatic char yy_hold_char;\nstatic yy_size_t yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\nyy_size_t fitshdrleng;\n\n/* Points to current character in buffer. */\nstatic char *yy_c_buf_p = (char *) 0;\nstatic int yy_init = 0;\t\t/* whether we need to initialize */\nstatic int yy_start = 0;\t/* start state number */\n\n/* Flag which is used to allow fitshdrwrap()'s to do buffer switches\n * instead of setting up a fresh fitshdrin.  A bit of a hack ...\n */\nstatic int yy_did_buffer_switch_on_eof;\n\nvoid fitshdrrestart (FILE *input_file  );\nvoid fitshdr_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\nYY_BUFFER_STATE fitshdr_create_buffer (FILE *file,int size  );\nvoid fitshdr_delete_buffer (YY_BUFFER_STATE b  );\nvoid fitshdr_flush_buffer (YY_BUFFER_STATE b  );\nvoid fitshdrpush_buffer_state (YY_BUFFER_STATE new_buffer  );\nvoid fitshdrpop_buffer_state (void );\n\nstatic void fitshdrensure_buffer_stack (void );\nstatic void fitshdr_load_buffer_state (void );\nstatic void fitshdr_init_buffer (YY_BUFFER_STATE b,FILE *file  );\n\n#define YY_FLUSH_BUFFER fitshdr_flush_buffer(YY_CURRENT_BUFFER )\n\nYY_BUFFER_STATE fitshdr_scan_buffer (char *base,yy_size_t size  );\nYY_BUFFER_STATE fitshdr_scan_string (yyconst char *yy_str  );\nYY_BUFFER_STATE fitshdr_scan_bytes (yyconst char *bytes,yy_size_t len  );\n\nvoid *fitshdralloc (yy_size_t  );\nvoid *fitshdrrealloc (void *,yy_size_t  );\nvoid fitshdrfree (void *  );\n\n#define yy_new_buffer fitshdr_create_buffer\n\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        fitshdrensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        fitshdrensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define fitshdrwrap() 1\n#define YY_SKIP_YYWRAP\n\ntypedef char YY_CHAR;\n\nFILE *fitshdrin = (FILE *) 0, *fitshdrout = (FILE *) 0;\n\ntypedef int yy_state_type;\n\nextern int fitshdrlineno;\n\nint fitshdrlineno = 1;\n\nextern char *fitshdrtext;\n#define yytext_ptr fitshdrtext\n\nstatic yyconst 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 (void );\nstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\nstatic int yy_get_next_buffer (void );\nstatic void yy_fatal_error (yyconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up fitshdrtext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\t(yytext_ptr) = yy_bp; \\\n\t(yytext_ptr) -= (yy_more_len); \\\n\tfitshdrleng = (size_t) (yy_cp - (yytext_ptr)); \\\n\t(yy_hold_char) = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\t(yy_c_buf_p) = yy_cp;\n\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 yyconst 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 yy_state_type yy_last_accepting_state;\nstatic char *yy_last_accepting_cpos;\n\nstatic yyconst 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\nextern int fitshdr_flex_debug;\nint fitshdr_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\nstatic int yy_more_flag = 0;\nstatic int yy_more_len = 0;\n#define yymore() ((yy_more_flag) = 1)\n#define YY_MORE_ADJ (yy_more_len)\n#define YY_RESTORE_YY_MORE_OFFSET\nchar *fitshdrtext;\n#line 1 \"fitshdr.l\"\n/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: fitshdr.c,v 5.17 2017/09/18 08:44:24 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/* 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#define YY_DECL int fitshdr(const char header[], int nkeyrec, int nkeyids, \\\n                            struct fitskeyid keyids[], int *nreject, \\\n                            struct fitskey **keys)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (fitshdr_nkeyrec) { \\\n\t    strncpy(inbuff, fitshdr_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    fitshdr_hdr += 80; \\\n\t    fitshdr_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n/* These global variables are required by YY_INPUT. */\nconst char *fitshdr_hdr;\nint  fitshdr_nkeyrec;\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf fitshdr_abort_jmp_env;\n#define exit(status) longjmp(fitshdr_abort_jmp_env, status)\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 10171 \"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#ifndef YY_EXTRA_TYPE\n#define YY_EXTRA_TYPE void *\n#endif\n\nstatic int yy_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint fitshdrlex_destroy (void );\n\nint fitshdrget_debug (void );\n\nvoid fitshdrset_debug (int debug_flag  );\n\nYY_EXTRA_TYPE fitshdrget_extra (void );\n\nvoid fitshdrset_extra (YY_EXTRA_TYPE user_defined  );\n\nFILE *fitshdrget_in (void );\n\nvoid fitshdrset_in  (FILE * in_str  );\n\nFILE *fitshdrget_out (void );\n\nvoid fitshdrset_out  (FILE * out_str  );\n\nyy_size_t fitshdrget_leng (void );\n\nchar *fitshdrget_text (void );\n\nint fitshdrget_lineno (void );\n\nvoid fitshdrset_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 YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int fitshdrwrap (void );\n#else\nextern int fitshdrwrap (void );\n#endif\n#endif\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char *,yyconst char *,int );\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst char * );\n#endif\n\n#ifndef YY_NO_INPUT\n\n#ifdef __cplusplus\nstatic int yyinput (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 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( fitshdrtext, fitshdrleng, 1, fitshdrout )) {} } 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 = read( fileno(fitshdrin), (char *) 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(fitshdrin); \\\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 )\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 fitshdrlex (void);\n\n#define YY_DECL int fitshdrlex (void)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after fitshdrtext and fitshdrleng\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 break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( fitshdrleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(fitshdrtext[fitshdrleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp, *yy_bp;\n\tregister int yy_act;\n    \n\tif ( !(yy_init) )\n\t\t{\n\t\t(yy_init) = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! (yy_start) )\n\t\t\t(yy_start) = 1;\t/* first start state */\n\n\t\tif ( ! fitshdrin )\n\t\t\tfitshdrin = stdin;\n\n\t\tif ( ! fitshdrout )\n\t\t\tfitshdrout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\tfitshdrensure_buffer_stack ();\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\tfitshdr_create_buffer(fitshdrin,YY_BUF_SIZE );\n\t\t}\n\n\t\tfitshdr_load_buffer_state( );\n\t\t}\n\n\t{\n#line 119 \"fitshdr.l\"\n\n\tchar *cptr, ctmp[72];\n\tint  blank, continuation, end, j, k, keyno;\n\tdouble dtmp;\n\tstruct fitskey *kptr;\n\tstruct fitskeyid *iptr;\n\tvoid nullfill(char cptr[], int len);\n\tint  fitshdrlex_destroy(void);\n\t\n\tfitshdr_hdr = header;\n\tfitshdr_nkeyrec = nkeyrec;\n\t\n\t*nreject = 0;\n\tkeyno = 0;\n\t\n\tif (keys == 0x0) {\n\t  return 1;\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\tif (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) {\n\t  return 2;\n\t}\n\t\n\t/* Initialize keyids[]. */\n\tiptr = keyids;\n\tfor (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\t\n\tblank = 0;\n\tcontinuation = 0;\n\tend = 0;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(fitshdr_abort_jmp_env)) {\n\t  return 3;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n#line 10421 \"fitshdr.c\"\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\t(yy_more_len) = 0;\n\t\tif ( (yy_more_flag) )\n\t\t\t{\n\t\t\t(yy_more_len) = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t(yy_more_flag) = 0;\n\t\t\t}\n\t\tyy_cp = (yy_c_buf_p);\n\n\t\t/* Support of fitshdrtext. */\n\t\t*yy_cp = (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 = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t\t(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 = (yy_hold_char);\n\t\t\tyy_cp = (yy_last_accepting_cpos) + 1;\n\t\t\tyy_current_state = (yy_last_accepting_state);\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 163 \"fitshdr.l\"\n{\n\t  /* A completely blank keyrecord. */\n\t  strncpy(kptr->keyword, fitshdrtext, 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 171 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 3:\nYY_RULE_SETUP\n#line 176 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  end = 1;\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 4:\nYY_RULE_SETUP\n#line 182 \"fitshdr.l\"\n{\n\t  /* Illegal END keyrecord. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 5:\nYY_RULE_SETUP\n#line 189 \"fitshdr.l\"\n{\n\t  /* Illegal END keyrecord. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  kptr->status |= FITSHDR_KEYREC;\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 6:\nYY_RULE_SETUP\n#line 196 \"fitshdr.l\"\n{\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 7:\n/* rule 7 can match eol */\nYY_RULE_SETUP\n#line 201 \"fitshdr.l\"\n{\n\t  /* Continued string keyvalue. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t\n\t  if (keyno > 0 && (kptr-1)->type%10 == 8) {\n\t    /* Put back the string keyvalue. */\n\t    for (k = 10; fitshdrtext[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 219 \"fitshdr.l\"\n{\n\t  /* Keyword without value. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 9:\nYY_RULE_SETUP\n#line 225 \"fitshdr.l\"\n{\n\t  /* Illegal keyword, carry on regardless. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 10:\nYY_RULE_SETUP\n#line 232 \"fitshdr.l\"\n{\n\t  /* Illegal keyword, carry on regardless. */\n\t  strncpy(kptr->keyword, fitshdrtext, 8);\n\t  kptr->status |= FITSHDR_KEYWORD;\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 11:\n*yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up fitshdrtext again */\nYY_RULE_SETUP\n#line 239 \"fitshdr.l\"\n{\n\t  /* Null keyvalue. */\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 12:\nYY_RULE_SETUP\n#line 244 \"fitshdr.l\"\n{\n\t  /* Logical keyvalue. */\n\t  kptr->type = 1;\n\t  kptr->keyvalue.i = (*fitshdrtext == 'T');\n\t  BEGIN(INLINE);\n\t}\n\tYY_BREAK\ncase 13:\nYY_RULE_SETUP\n#line 251 \"fitshdr.l\"\n{\n\t  /* 32-bit signed integer keyvalue. */\n\t  kptr->type = 2;\n\t  if (sscanf(fitshdrtext, \"%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 262 \"fitshdr.l\"\n{\n\t  /* 64-bit signed integer keyvalue (up to 18 digits). */\n\t  if (wcsutil_str2double(fitshdrtext, &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(fitshdrtext, \"%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(fitshdrtext, \"%lld\", &(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\", fitshdrleng-9);\n\t      if (sscanf(fitshdrtext, 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 (*fitshdrtext == '-') {\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 303 \"fitshdr.l\"\n{\n\t  /* Very long integer keyvalue (and 19-digit int64). */\n\t  kptr->type = 4;\n\t  strcpy(ctmp, fitshdrtext);\n\t  k = fitshdrleng;\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 (*fitshdrtext == '-') {\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(fitshdrtext, \"%lld\", &(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 344 \"fitshdr.l\"\n{\n\t  /* Float keyvalue. */\n\t  kptr->type = 5;\n\t  if (wcsutil_str2double(fitshdrtext, &(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 355 \"fitshdr.l\"\n{\n\t  /* Integer complex keyvalue. */\n\t  kptr->type = 6;\n\t  if (sscanf(fitshdrtext, \"(%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 367 \"fitshdr.l\"\n{\n\t  /* Floating point complex keyvalue. */\n\t  kptr->type = 7;\n\t\n\t  for (cptr = ctmp, k = 1; fitshdrtext[k] != ','; cptr++, k++) {\n\t    *cptr = fitshdrtext[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++; fitshdrtext[k] != ')'; cptr++, k++) {\n\t    *cptr = fitshdrtext[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 394 \"fitshdr.l\"\n{\n\t  /* String keyvalue. */\n\t  kptr->type = 8;\n\t  cptr = kptr->keyvalue.s;\n\t  strcpy(cptr, fitshdrtext+1);\n\t\n\t  /* Squeeze out repeated quotes. */\n\t  k = 0;\n\t  for (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 427 \"fitshdr.l\"\n{\n\t  kptr->status |= FITSHDR_KEYVALUE;\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 21:\n*yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up fitshdrtext again */\nYY_RULE_SETUP\n#line 432 \"fitshdr.l\"\n{\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 22:\n*yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up fitshdrtext again */\nYY_RULE_SETUP\n#line 436 \"fitshdr.l\"\n{\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 23:\nYY_RULE_SETUP\n#line 440 \"fitshdr.l\"\n{\n\t  BEGIN(UNITS);\n\t}\n\tYY_BREAK\ncase 24:\nYY_RULE_SETUP\n#line 444 \"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 449 \"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 456 \"fitshdr.l\"\n{\n\t  kptr->ulen = fitshdrleng;\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 27:\nYY_RULE_SETUP\n#line 462 \"fitshdr.l\"\n{\n\t  yymore();\n\t  BEGIN(COMMENT);\n\t}\n\tYY_BREAK\ncase 28:\nYY_RULE_SETUP\n#line 467 \"fitshdr.l\"\n{\n\t  strcpy(kptr->comment, fitshdrtext);\n\t  nullfill(kptr->comment, 84);\n\t  BEGIN(FLUSH);\n\t}\n\tYY_BREAK\ncase 29:\nYY_RULE_SETUP\n#line 473 \"fitshdr.l\"\n{\n\t  if (!continuation) kptr->type = -abs(kptr->type);\n\t\n\t  sprintf(kptr->comment, \"%.80s\", fitshdr_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 483 \"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 (j = 0; j < nkeyids; j++, iptr++) {\n\t    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    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 539 \"fitshdr.l\"\n{\n\t  /* End-of-input. */\n\t  fitshdrlex_destroy();\n\t  return 0;\n\t}\n\tYY_BREAK\ncase 31:\nYY_RULE_SETUP\n#line 545 \"fitshdr.l\"\nECHO;\n\tYY_BREAK\n#line 10970 \"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 - (yytext_ptr)) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = (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 fitshdrin at a new source and called\n\t\t\t * fitshdrlex().  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\t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = fitshdrin;\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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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\t(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_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 * 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 );\n\n\t\t\tyy_bp = (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 = ++(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 = (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(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(yy_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( fitshdrwrap( ) )\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 * fitshdrtext, 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\t(yy_c_buf_p) = (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 ( ! (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\t(yy_c_buf_p) =\n\t\t\t\t\t(yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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\t(yy_c_buf_p) =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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 fitshdrlex */\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 (void)\n{\n    \tregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tregister char *source = (yytext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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 ( (yy_c_buf_p) - (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) ((yy_c_buf_p) - (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 = (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) ((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\tyy_size_t 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\tfitshdrrealloc((void *) b->yy_ch_buf,b->yy_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->yy_ch_buf = 0;\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\t(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\t(yy_n_chars), num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tif ( (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\tfitshdrrestart(fitshdrin  );\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 ((yy_size_t) ((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\tyy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) fitshdrrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\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}\n\n\t(yy_n_chars) += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\n\n\t(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 (void)\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp;\n    \n\tyy_current_state = (yy_start);\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(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 )\n{\n\tregister int yy_is_jam;\n    \tregister char *yy_cp = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(yy_last_accepting_cpos) = yy_cp;\n\t\t\t}\n\t\t}\n\n\t\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(yy_c_buf_p) = (yy_hold_char);\n\n\tif ( *(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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(yy_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tyy_size_t offset = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t++(yy_c_buf_p);\n\n\t\t\tswitch ( yy_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 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\tfitshdrrestart(fitshdrin );\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 ( fitshdrwrap( ) )\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tif ( ! (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();\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(yy_c_buf_p) = (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 *) (yy_c_buf_p);\t/* cast for 8-bit char's */\n\t*(yy_c_buf_p) = '\\0';\t/* preserve fitshdrtext */\n\t(yy_hold_char) = *++(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 * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void fitshdrrestart  (FILE * input_file )\n{\n    \n\tif ( ! YY_CURRENT_BUFFER ){\n        fitshdrensure_buffer_stack ();\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE );\n\t}\n\n\tfitshdr_init_buffer(YY_CURRENT_BUFFER,input_file );\n\tfitshdr_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void fitshdr_switch_to_buffer  (YY_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\tfitshdrpop_buffer_state();\n\t *\t\tfitshdrpush_buffer_state(new_buffer);\n     */\n\tfitshdrensure_buffer_stack ();\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*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\tfitshdr_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (fitshdrwrap()) processing, but the only time this flag\n\t * is looked at is after fitshdrwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(yy_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void fitshdr_load_buffer_state  (void)\n{\n    \t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\tfitshdrin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\t(yy_hold_char) = *(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 * \n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE fitshdr_create_buffer  (FILE * file, int  size )\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) fitshdralloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdr_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 *) fitshdralloc(b->yy_buf_size + 2  );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdr_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\tfitshdr_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with fitshdr_create_buffer()\n * \n */\n    void fitshdr_delete_buffer (YY_BUFFER_STATE  b )\n{\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\tfitshdrfree((void *) b->yy_ch_buf  );\n\n\tfitshdrfree((void *) b  );\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 fitshdrrestart() or at EOF.\n */\n    static void fitshdr_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\tfitshdr_flush_buffer(b );\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then fitshdr_init_buffer was _probably_\n     * called from fitshdrrestart() 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 * \n */\n    void fitshdr_flush_buffer (YY_BUFFER_STATE  b )\n{\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\tfitshdr_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 fitshdrpush_buffer_state (YY_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\tfitshdrensure_buffer_stack();\n\n\t/* This block is copied from fitshdr_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\t(yy_buffer_stack_top)++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from fitshdr_switch_to_buffer. */\n\tfitshdr_load_buffer_state( );\n\t(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 *  \n */\nvoid fitshdrpop_buffer_state (void)\n{\n    \tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\tfitshdr_delete_buffer(YY_CURRENT_BUFFER );\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((yy_buffer_stack_top) > 0)\n\t\t--(yy_buffer_stack_top);\n\n\tif (YY_CURRENT_BUFFER) {\n\t\tfitshdr_load_buffer_state( );\n\t\t(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 fitshdrensure_buffer_stack (void)\n{\n\tyy_size_t num_to_alloc;\n    \n\tif (!(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\t\tnum_to_alloc = 1;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)fitshdralloc\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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdrensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\t\t\t\t\n\t\t(yy_buffer_stack_max) = num_to_alloc;\n\t\t(yy_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((yy_buffer_stack_top) >= ((yy_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 = (yy_buffer_stack_max) + grow_size;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)fitshdrrealloc\n\t\t\t\t\t\t\t\t((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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdrensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\t(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 * \n * @return the newly allocated buffer state object. \n */\nYY_BUFFER_STATE fitshdr_scan_buffer  (char * base, yy_size_t  size )\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 0;\n\n\tb = (YY_BUFFER_STATE) fitshdralloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdr_scan_buffer()\" );\n\n\tb->yy_buf_size = 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 = 0;\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\tfitshdr_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to fitshdrlex() will\n * scan from a @e copy of @a str.\n * @param yystr 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 *       fitshdr_scan_bytes() instead.\n */\nYY_BUFFER_STATE fitshdr_scan_string (yyconst char * yystr )\n{\n    \n\treturn fitshdr_scan_bytes(yystr,strlen(yystr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to fitshdrlex() 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 * \n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE fitshdr_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tyy_size_t i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _yybytes_len + 2;\n\tbuf = (char *) fitshdralloc(n  );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in fitshdr_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 = fitshdr_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in fitshdr_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 yy_fatal_error (yyconst char* msg )\n{\n    \t(void) fprintf( 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 fitshdrtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\tfitshdrtext[fitshdrleng] = (yy_hold_char); \\\n\t\t(yy_c_buf_p) = fitshdrtext + yyless_macro_arg; \\\n\t\t(yy_hold_char) = *(yy_c_buf_p); \\\n\t\t*(yy_c_buf_p) = '\\0'; \\\n\t\tfitshdrleng = yyless_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 fitshdrget_lineno  (void)\n{\n        \n    return fitshdrlineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *fitshdrget_in  (void)\n{\n        return fitshdrin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *fitshdrget_out  (void)\n{\n        return fitshdrout;\n}\n\n/** Get the length of the current token.\n * \n */\nyy_size_t fitshdrget_leng  (void)\n{\n        return fitshdrleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *fitshdrget_text  (void)\n{\n        return fitshdrtext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid fitshdrset_lineno (int  line_number )\n{\n    \n    fitshdrlineno = 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 fitshdr_switch_to_buffer\n */\nvoid fitshdrset_in (FILE *  in_str )\n{\n        fitshdrin = in_str ;\n}\n\nvoid fitshdrset_out (FILE *  out_str )\n{\n        fitshdrout = out_str ;\n}\n\nint fitshdrget_debug  (void)\n{\n        return fitshdr_flex_debug;\n}\n\nvoid fitshdrset_debug (int  bdebug )\n{\n        fitshdr_flex_debug = bdebug ;\n}\n\nstatic int yy_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from fitshdrlex_destroy(), so don't allocate here.\n     */\n\n    (yy_buffer_stack) = 0;\n    (yy_buffer_stack_top) = 0;\n    (yy_buffer_stack_max) = 0;\n    (yy_c_buf_p) = (char *) 0;\n    (yy_init) = 0;\n    (yy_start) = 0;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    fitshdrin = stdin;\n    fitshdrout = stdout;\n#else\n    fitshdrin = (FILE *) 0;\n    fitshdrout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * fitshdrlex_init()\n     */\n    return 0;\n}\n\n/* fitshdrlex_destroy is for both reentrant and non-reentrant scanners. */\nint fitshdrlex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\tfitshdr_delete_buffer(YY_CURRENT_BUFFER  );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\tfitshdrpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\tfitshdrfree((yy_buffer_stack) );\n\t(yy_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * fitshdrlex() is called, initialization will occur. */\n    yy_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, yyconst 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 YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst 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 *fitshdralloc (yy_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *fitshdrrealloc  (void * ptr, yy_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 fitshdrfree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see fitshdrrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 544 \"fitshdr.l\"\n\n\n\n/*--------------------------------------------------------------------------*/\n\nvoid nullfill(char cptr[], int len)\n\n{\n  int j, k;\n\n  /* Null-fill the string. */\n  for (j = 0; j < len; j++) {\n    if (cptr[j] == '\\0') {\n      for (k = j+1; k < len; k++) {\n        cptr[k] = '\\0';\n      }\n      break;\n    }\n  }\n\n  for (k = j-1; k >= 0; k--) {\n    if (cptr[k] != ' ') break;\n    cptr[k] = '\\0';\n  }\n\n  return;\n}\n\n"},{"id":13641,"name":"config.guess","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# Attempt to guess a canonical system name.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n#   2011 Free Software Foundation, Inc.\n\ntimestamp='2011-10-01'\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 2 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, write to the Free Software\n# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA\n# 02110-1301, USA.\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 program.\n\n\n# Originally written by Per Bothner.  Please send patches (context\n# diff format) to <config-patches@gnu.org> and include a ChangeLog\n# entry.\n#\n# This script attempts to guess a canonical system name similar to\n# config.sub.  If it succeeds, it prints the system name on stdout, and\n# exits with 0.  Otherwise, it exits with 1.\n#\n# You can get the latest version of this script from:\n# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD\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\nOperation modes:\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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,\n2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free\nSoftware 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\ntrap 'exit 1' 1 2 15\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\nset_cc_for_build='\ntrap \"exitcode=\\$?; (rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null) && exit \\$exitcode\" 0 ;\ntrap \"rm -f \\$tmpfiles 2>/dev/null; rmdir \\$tmp 2>/dev/null; exit 1\" 1 2 13 15 ;\n: ${TMPDIR=/tmp} ;\n { tmp=`(umask 077 && mktemp -d \"$TMPDIR/cgXXXXXX\") 2>/dev/null` && test -n \"$tmp\" && test -d \"$tmp\" ; } ||\n { test -n \"$RANDOM\" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||\n { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo \"Warning: creating insecure temp directory\" >&2 ; } ||\n { echo \"$me: cannot create a temporary directory in $TMPDIR\" >&2 ; exit 1 ; } ;\ndummy=$tmp/dummy ;\ntmpfiles=\"$dummy.c $dummy.o $dummy.rel $dummy\" ;\ncase $CC_FOR_BUILD,$HOST_CC,$CC in\n ,,)    echo \"int x;\" > $dummy.c ;\n\tfor c in cc gcc c89 c99 ; do\n\t  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then\n\t     CC_FOR_BUILD=\"$c\"; break ;\n\t  fi ;\n\tdone ;\n\tif test x\"$CC_FOR_BUILD\" = x ; then\n\t  CC_FOR_BUILD=no_compiler_found ;\n\tfi\n\t;;\n ,,*)   CC_FOR_BUILD=$CC ;;\n ,*,*)  CC_FOR_BUILD=$HOST_CC ;;\nesac ; set_cc_for_build= ;'\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\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 tupples: *-*-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=`(/sbin/$sysctl 2>/dev/null || \\\n\t    /usr/sbin/$sysctl 2>/dev/null || 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    *) 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.\n\tcase \"${UNAME_MACHINE_ARCH}\" in\n\t    arm*|i386|m68k|ns32k|sh3*|sparc|vax)\n\t\teval $set_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# 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/[-_].*/\\./'`\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}\"\n\texit ;;\n    *:OpenBSD:*:*)\n\tUNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`\n\techo ${UNAME_MACHINE_ARCH}-unknown-openbsd${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    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    Alpha\\ *:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# Should we change UNAME_MACHINE based on the output of uname instead\n\t# of the specific Alpha model?\n\techo alpha-pc-interix\n\texit ;;\n    21064:Windows_NT:50:3)\n\techo alpha-dec-winnt3.5\n\texit ;;\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\teval $set_cc_for_build\n\tSUN_ARCH=\"i386\"\n\t# If there is a compiler, see if it is configured for 64-bit objects.\n\t# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.\n\t# This test works for both compilers.\n\tif [ \"$CC_FOR_BUILD\" != 'no_compiler_found' ]; then\n\t    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \\\n\t\t(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \\\n\t\tgrep IS_64BIT_ARCH >/dev/null\n\t    then\n\t\tSUN_ARCH=\"x86_64\"\n\t    fi\n\tfi\n\techo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`\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\teval $set_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\teval $set_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/oslevel ] ; then\n\t\tIBM_REV=`/usr/bin/oslevel`\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:BSD:*)\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    eval $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    eval $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\teval $set_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    *:FreeBSD:*:*)\n\tUNAME_PROCESSOR=`/usr/bin/uname -p`\n\tcase ${UNAME_PROCESSOR} in\n\t    amd64)\n\t\techo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\t    *)\n\t\techo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;\n\tesac\n\texit ;;\n    i*:CYGWIN*:*)\n\techo ${UNAME_MACHINE}-pc-cygwin\n\texit ;;\n    *:MINGW*:*)\n\techo ${UNAME_MACHINE}-pc-mingw32\n\texit ;;\n    i*:windows32*:*)\n\t# uname -m includes \"-pc\" on this system.\n\techo ${UNAME_MACHINE}-mingw32\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    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)\n\techo i${UNAME_MACHINE}-pc-mks\n\texit ;;\n    8664:Windows_NT:*)\n\techo x86_64-pc-mks\n\texit ;;\n    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)\n\t# How do we know it's Interix rather than the generic POSIX subsystem?\n\t# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we\n\t# UNAME_MACHINE based on the output of uname instead of i386?\n\techo i586-pc-interix\n\texit ;;\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    p*:CYGWIN*:*)\n\techo powerpcle-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-gnu`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 '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu\n\texit ;;\n    i*86:Minix:*:*)\n\techo ${UNAME_MACHINE}-pc-minix\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=\"libc1\" ; else LIBC=\"\" ; fi\n\techo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}\n\texit ;;\n    arm*:Linux:*:*)\n\teval $set_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-gnu\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-gnueabi\n\t    else\n\t\techo ${UNAME_MACHINE}-unknown-linux-gnueabihf\n\t    fi\n\tfi\n\texit ;;\n    avr32*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    cris:Linux:*:*)\n\techo cris-axis-linux-gnu\n\texit ;;\n    crisv32:Linux:*:*)\n\techo crisv32-axis-linux-gnu\n\texit ;;\n    frv:Linux:*:*)\n\techo frv-unknown-linux-gnu\n\texit ;;\n    hexagon:Linux:*:*)\n\techo hexagon-unknown-linux-gnu\n\texit ;;\n    i*86:Linux:*:*)\n\tLIBC=gnu\n\teval $set_cc_for_build\n\tsed 's/^\t//' << EOF >$dummy.c\n\t#ifdef __dietlibc__\n\tLIBC=dietlibc\n\t#endif\nEOF\n\teval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`\n\techo \"${UNAME_MACHINE}-pc-linux-${LIBC}\"\n\texit ;;\n    ia64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m32r*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    m68*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    mips:Linux:*:* | mips64:Linux:*:*)\n\teval $set_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-gnu\"; exit; }\n\t;;\n    or32:Linux:*:*)\n\techo or32-unknown-linux-gnu\n\texit ;;\n    padre:Linux:*:*)\n\techo sparc-unknown-linux-gnu\n\texit ;;\n    parisc64:Linux:*:* | hppa64:Linux:*:*)\n\techo hppa64-unknown-linux-gnu\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-gnu ;;\n\t  PA8*) echo hppa2.0-unknown-linux-gnu ;;\n\t  *)    echo hppa-unknown-linux-gnu ;;\n\tesac\n\texit ;;\n    ppc64:Linux:*:*)\n\techo powerpc64-unknown-linux-gnu\n\texit ;;\n    ppc:Linux:*:*)\n\techo powerpc-unknown-linux-gnu\n\texit ;;\n    s390:Linux:*:* | s390x:Linux:*:*)\n\techo ${UNAME_MACHINE}-ibm-linux\n\texit ;;\n    sh64*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sh*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    sparc:Linux:*:* | sparc64:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    tile*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\n\texit ;;\n    vax:Linux:*:*)\n\techo ${UNAME_MACHINE}-dec-linux-gnu\n\texit ;;\n    x86_64:Linux:*:*)\n\techo x86_64-unknown-linux-gnu\n\texit ;;\n    xtensa*:Linux:*:*)\n\techo ${UNAME_MACHINE}-unknown-linux-gnu\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.*:* | i*86:SYSTEM_V: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 configury 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    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    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\tcase $UNAME_PROCESSOR in\n\t    i386)\n\t\teval $set_cc_for_build\n\t\tif [ \"$CC_FOR_BUILD\" != 'no_compiler_found' ]; then\n\t\t  if (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\t  then\n\t\t      UNAME_PROCESSOR=\"x86_64\"\n\t\t  fi\n\t\tfi ;;\n\t    unknown) UNAME_PROCESSOR=powerpc ;;\n\tesac\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    *: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\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 ;;\nesac\n\n#echo '(No uname command or uname output not recognized.)' 1>&2\n#echo \"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}\" 1>&2\n\neval $set_cc_for_build\ncat >$dummy.c <<EOF\n#ifdef _SEQUENT_\n# include <sys/types.h>\n# include <sys/utsname.h>\n#endif\nmain ()\n{\n#if defined (sony)\n#if defined (MIPSEB)\n  /* BFD wants \"bsd\" instead of \"newsos\".  Perhaps BFD should be changed,\n     I don't know....  */\n  printf (\"mips-sony-bsd\\n\"); exit (0);\n#else\n#include <sys/param.h>\n  printf (\"m68k-sony-newsos%s\\n\",\n#ifdef NEWSOS4\n\t\"4\"\n#else\n\t\"\"\n#endif\n\t); exit (0);\n#endif\n#endif\n\n#if defined (__arm) && defined (__acorn) && defined (__unix)\n  printf (\"arm-acorn-riscix\\n\"); exit (0);\n#endif\n\n#if defined (hp300) && !defined (hpux)\n  printf (\"m68k-hp-bsd\\n\"); exit (0);\n#endif\n\n#if defined (NeXT)\n#if !defined (__ARCHITECTURE__)\n#define __ARCHITECTURE__ \"m68k\"\n#endif\n  int version;\n  version=`(hostinfo | sed -n 's/.*NeXT Mach \\([0-9]*\\).*/\\1/p') 2>/dev/null`;\n  if (version < 4)\n    printf (\"%s-next-nextstep%d\\n\", __ARCHITECTURE__, version);\n  else\n    printf (\"%s-next-openstep%d\\n\", __ARCHITECTURE__, version);\n  exit (0);\n#endif\n\n#if defined (MULTIMAX) || defined (n16)\n#if defined (UMAXV)\n  printf (\"ns32k-encore-sysv\\n\"); exit (0);\n#else\n#if defined (CMU)\n  printf (\"ns32k-encore-mach\\n\"); exit (0);\n#else\n  printf (\"ns32k-encore-bsd\\n\"); exit (0);\n#endif\n#endif\n#endif\n\n#if defined (__386BSD__)\n  printf (\"i386-pc-bsd\\n\"); exit (0);\n#endif\n\n#if defined (sequent)\n#if defined (i386)\n  printf (\"i386-sequent-dynix\\n\"); exit (0);\n#endif\n#if defined (ns32000)\n  printf (\"ns32k-sequent-dynix\\n\"); exit (0);\n#endif\n#endif\n\n#if defined (_SEQUENT_)\n    struct utsname un;\n\n    uname(&un);\n\n    if (strncmp(un.version, \"V2\", 2) == 0) {\n\tprintf (\"i386-sequent-ptx2\\n\"); exit (0);\n    }\n    if (strncmp(un.version, \"V1\", 2) == 0) { /* XXX is V1 correct? */\n\tprintf (\"i386-sequent-ptx1\\n\"); exit (0);\n    }\n    printf (\"i386-sequent-ptx\\n\"); exit (0);\n\n#endif\n\n#if defined (vax)\n# if !defined (ultrix)\n#  include <sys/param.h>\n#  if defined (BSD)\n#   if BSD == 43\n      printf (\"vax-dec-bsd4.3\\n\"); exit (0);\n#   else\n#    if BSD == 199006\n      printf (\"vax-dec-bsd4.3reno\\n\"); exit (0);\n#    else\n      printf (\"vax-dec-bsd\\n\"); exit (0);\n#    endif\n#   endif\n#  else\n    printf (\"vax-dec-bsd\\n\"); exit (0);\n#  endif\n# else\n    printf (\"vax-dec-ultrix\\n\"); exit (0);\n# endif\n#endif\n\n#if defined (alliant) && defined (i860)\n  printf (\"i860-alliant-bsd\\n\"); exit (0);\n#endif\n\n  exit (1);\n}\nEOF\n\n$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&\n\t{ echo \"$SYSTEM_NAME\"; exit; }\n\n# Apollos put the system type in the environment.\n\ntest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }\n\n# Convex versions that predate uname can use getsysinfo(1)\n\nif [ -x /usr/convex/getsysinfo ]\nthen\n    case `getsysinfo -f cpu_type` in\n    c1*)\n\techo c1-convex-bsd\n\texit ;;\n    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*)\n\techo c34-convex-bsd\n\texit ;;\n    c38*)\n\techo c38-convex-bsd\n\texit ;;\n    c4*)\n\techo c4-convex-bsd\n\texit ;;\n    esac\nfi\n\ncat >&2 <<EOF\n$0: unable to guess system type\n\nThis script, last modified $timestamp, has failed to recognize\nthe operating system you are using. It is advised that you\ndownload the most up to date version of the config scripts from\n\n  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD\nand\n  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD\n\nIf the version you run ($0) is already up to date, please\nsend the following data and any information you think might be\npertinent to <config-patches@gnu.org> in order to provide the needed\ninformation 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 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"},{"id":13642,"name":"config.sub","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# Configuration validation subroutine script.\n#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,\n#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n#   2011 Free Software Foundation, Inc.\n\ntimestamp='2011-09-09'\n\n# This file is (in principle) common to ALL GNU software.\n# The presence of a machine in this file suggests that SOME GNU software\n# can handle that machine.  It does not imply ALL GNU software can.\n#\n# This file 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 2 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, write to the Free Software\n# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA\n# 02110-1301, USA.\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 program.\n\n\n# Please send patches to <config-patches@gnu.org>.  Submit a context\n# diff and a properly formatted GNU ChangeLog entry.\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# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD\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\n       $0 [OPTION] ALIAS\n\nCanonicalize a configuration name.\n\nOperation modes:\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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,\n2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free\nSoftware 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# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).\n# Here we must recognize all the valid KERNEL-OS combinations.\nmaybe_os=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\2/'`\ncase $maybe_os in\n  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \\\n  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \\\n  knetbsd*-gnu* | netbsd*-gnu* | \\\n  kopensolaris*-gnu* | \\\n  storm-chaos* | os2-emx* | rtmk-nova*)\n    os=-$maybe_os\n    basic_machine=`echo $1 | sed 's/^\\(.*\\)-\\([^-]*-[^-]*\\)$/\\1/'`\n    ;;\n  *)\n    basic_machine=`echo $1 | sed 's/-[^-]*$//'`\n    if [ $basic_machine != $1 ]\n    then os=`echo $1 | sed 's/.*-/-/'`\n    else os=; fi\n    ;;\nesac\n\n### Let's recognize common machines as not being operating systems so\n### that things like config.sub decstation-3100 work.  We also\n### recognize some manufacturers as not being operating systems, so we\n### can provide default operating systems below.\ncase $os in\n\t-sun*os*)\n\t\t# Prevent following clause from handling this invalid input.\n\t\t;;\n\t-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \\\n\t-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \\\n\t-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \\\n\t-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\\\n\t-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \\\n\t-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \\\n\t-apple | -axis | -knuth | -cray | -microblaze)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-bluegene*)\n\t\tos=-cnk\n\t\t;;\n\t-sim | -cisco | -oki | -wec | -winbond)\n\t\tos=\n\t\tbasic_machine=$1\n\t\t;;\n\t-scout)\n\t\t;;\n\t-wrs)\n\t\tos=-vxworks\n\t\tbasic_machine=$1\n\t\t;;\n\t-chorusos*)\n\t\tos=-chorusos\n\t\tbasic_machine=$1\n\t\t;;\n\t-chorusrdb)\n\t\tos=-chorusrdb\n\t\tbasic_machine=$1\n\t\t;;\n\t-hiux*)\n\t\tos=-hiuxwe2\n\t\t;;\n\t-sco6)\n\t\tos=-sco5v6\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5)\n\t\tos=-sco3.2v5\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco4)\n\t\tos=-sco3.2v4\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2.[4-9]*)\n\t\tos=`echo $os | sed -e 's/sco3.2./sco3.2v/'`\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco3.2v[4-9]*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco5v6*)\n\t\t# Don't forget version if it is 3.2v4 or newer.\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-sco*)\n\t\tos=-sco3.2v2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-udk*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-isc)\n\t\tos=-isc2.2\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-clix*)\n\t\tbasic_machine=clipper-intergraph\n\t\t;;\n\t-isc*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`\n\t\t;;\n\t-lynx*)\n\t\tos=-lynxos\n\t\t;;\n\t-ptx*)\n\t\tbasic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`\n\t\t;;\n\t-windowsnt*)\n\t\tos=`echo $os | sed -e 's/windowsnt/winnt/'`\n\t\t;;\n\t-psos*)\n\t\tos=-psos\n\t\t;;\n\t-mint | -mint[0-9]*)\n\t\tbasic_machine=m68k-atari\n\t\tos=-mint\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| 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 | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \\\n        | be32 | be64 \\\n\t| bfin \\\n\t| c4x | clipper \\\n\t| d10v | d30v | dlx | dsp16xx \\\n\t| fido | fr30 | frv \\\n\t| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \\\n\t| hexagon \\\n\t| i370 | i860 | i960 | ia64 \\\n\t| ip2k | iq2000 \\\n\t| le32 | le64 \\\n\t| lm32 \\\n\t| m32c | m32r | m32rle | m68000 | m68k | m88k \\\n\t| maxq | mb | microblaze | 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| mipsisa64 | mipsisa64el \\\n\t| mipsisa64r2 | mipsisa64r2el \\\n\t| mipsisa64sb1 | mipsisa64sb1el \\\n\t| mipsisa64sr71k | mipsisa64sr71kel \\\n\t| mipstx39 | mipstx39el \\\n\t| mn10200 | mn10300 \\\n\t| moxie \\\n\t| mt \\\n\t| msp430 \\\n\t| nds32 | nds32le | nds32be \\\n\t| nios | nios2 \\\n\t| ns16k | ns32k \\\n\t| open8 \\\n\t| or32 \\\n\t| pdp10 | pdp11 | pj | pjl \\\n\t| powerpc | powerpc64 | powerpc64le | powerpcle \\\n\t| pyramid \\\n\t| rx \\\n\t| score \\\n\t| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]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| we32k \\\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\tm6811 | m68hc11 | m6812 | m68hc12 | picochip)\n\t\t# Motorola 68HC11/12.\n\t\tbasic_machine=$basic_machine-unknown\n\t\tos=-none\n\t\t;;\n\tm88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)\n\t\t;;\n\tms1)\n\t\tbasic_machine=mt-unknown\n\t\t;;\n\n\tstrongarm | thumb | xscale)\n\t\tbasic_machine=arm-unknown\n\t\t;;\n\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# Object if more than one company name word.\n\t*-*-*)\n\t\techo Invalid configuration \\`$1\\': machine \\`$basic_machine\\' not recognized 1>&2\n\t\texit 1\n\t\t;;\n\t# Recognize the basic CPU types with company name.\n\t580-* \\\n\t| a29k-* \\\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-* \\\n\t| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \\\n\t| avr-* | avr32-* \\\n\t| be32-* | be64-* \\\n\t| bfin-* | bs2000-* \\\n\t| c[123]* | c30-* | [cjt]90-* | c4x-* \\\n\t| clipper-* | craynv-* | cydra-* \\\n\t| d10v-* | d30v-* | dlx-* \\\n\t| 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-* | ia64-* \\\n\t| ip2k-* | iq2000-* \\\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-* | microblaze-* \\\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| mipsisa64-* | mipsisa64el-* \\\n\t| mipsisa64r2-* | mipsisa64r2el-* \\\n\t| mipsisa64sb1-* | mipsisa64sb1el-* \\\n\t| mipsisa64sr71k-* | mipsisa64sr71kel-* \\\n\t| mipstx39-* | mipstx39el-* \\\n\t| mmix-* \\\n\t| mt-* \\\n\t| msp430-* \\\n\t| nds32-* | nds32le-* | nds32be-* \\\n\t| nios-* | nios2-* \\\n\t| none-* | np1-* | ns16k-* | ns32k-* \\\n\t| open8-* \\\n\t| orion-* \\\n\t| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \\\n\t| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \\\n\t| pyramid-* \\\n\t| 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| 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\t386bsd)\n\t\tbasic_machine=i386-unknown\n\t\tos=-bsd\n\t\t;;\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\ta29khif)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tabacus)\n\t\tbasic_machine=abacus-unknown\n\t\t;;\n\tadobe68k)\n\t\tbasic_machine=m68010-adobe\n\t\tos=-scout\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\tam29k)\n\t\tbasic_machine=a29k-none\n\t\tos=-bsd\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\tamdahl)\n\t\tbasic_machine=580-amdahl\n\t\tos=-sysv\n\t\t;;\n\tamiga | amiga-*)\n\t\tbasic_machine=m68k-unknown\n\t\t;;\n\tamigaos | amigados)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-amigaos\n\t\t;;\n\tamigaunix | amix)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-sysv4\n\t\t;;\n\tapollo68)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-sysv\n\t\t;;\n\tapollo68bsd)\n\t\tbasic_machine=m68k-apollo\n\t\tos=-bsd\n\t\t;;\n\taros)\n\t\tbasic_machine=i386-pc\n\t\tos=-aros\n\t\t;;\n\taux)\n\t\tbasic_machine=m68k-apple\n\t\tos=-aux\n\t\t;;\n\tbalance)\n\t\tbasic_machine=ns32k-sequent\n\t\tos=-dynix\n\t\t;;\n\tblackfin)\n\t\tbasic_machine=bfin-unknown\n\t\tos=-linux\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=-unicos\n\t\t;;\n\tcegcc)\n\t\tbasic_machine=arm-unknown\n\t\tos=-cegcc\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\tcray | j90)\n\t\tbasic_machine=j90-cray\n\t\tos=-unicos\n\t\t;;\n\tcraynv)\n\t\tbasic_machine=craynv-cray\n\t\tos=-unicosmp\n\t\t;;\n\tcr16 | cr16-*)\n\t\tbasic_machine=cr16-unknown\n\t\tos=-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=-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\tdelta88)\n\t\tbasic_machine=m88k-motorola\n\t\tos=-sysv3\n\t\t;;\n\tdicos)\n\t\tbasic_machine=i686-pc\n\t\tos=-dicos\n\t\t;;\n\tdjgpp)\n\t\tbasic_machine=i586-pc\n\t\tos=-msdosdjgpp\n\t\t;;\n\tdpx20 | dpx20-*)\n\t\tbasic_machine=rs6000-bull\n\t\tos=-bosx\n\t\t;;\n\tdpx2* | dpx2*-bull)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv3\n\t\t;;\n\tebmon29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-ebmon\n\t\t;;\n\telxsi)\n\t\tbasic_machine=elxsi-elxsi\n\t\tos=-bsd\n\t\t;;\n\tencore | umax | mmax)\n\t\tbasic_machine=ns32k-encore\n\t\t;;\n\tes1800 | OSE68k | ose68k | ose | OSE)\n\t\tbasic_machine=m68k-ericsson\n\t\tos=-ose\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\tgmicro)\n\t\tbasic_machine=tron-gmicro\n\t\tos=-sysv\n\t\t;;\n\tgo32)\n\t\tbasic_machine=i386-pc\n\t\tos=-go32\n\t\t;;\n\th3050r* | hiux*)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\th8300hms)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-hms\n\t\t;;\n\th8300xray)\n\t\tbasic_machine=h8300-hitachi\n\t\tos=-xray\n\t\t;;\n\th8500hms)\n\t\tbasic_machine=h8500-hitachi\n\t\tos=-hms\n\t\t;;\n\tharris)\n\t\tbasic_machine=m88k-harris\n\t\tos=-sysv3\n\t\t;;\n\thp300-*)\n\t\tbasic_machine=m68k-hp\n\t\t;;\n\thp300bsd)\n\t\tbasic_machine=m68k-hp\n\t\tos=-bsd\n\t\t;;\n\thp300hpux)\n\t\tbasic_machine=m68k-hp\n\t\tos=-hpux\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\thppa-next)\n\t\tos=-nextstep3\n\t\t;;\n\thppaosf)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-osf\n\t\t;;\n\thppro)\n\t\tbasic_machine=hppa1.1-hp\n\t\tos=-proelf\n\t\t;;\n\ti370-ibm* | ibm*)\n\t\tbasic_machine=i370-ibm\n\t\t;;\n# I'm not sure what \"Sysv32\" means.  Should this be sysv3.2?\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\ti386mach)\n\t\tbasic_machine=i386-mach\n\t\tos=-mach\n\t\t;;\n\ti386-vsta | vsta)\n\t\tbasic_machine=i386-unknown\n\t\tos=-vsta\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\tisi68 | isi)\n\t\tbasic_machine=m68k-isi\n\t\tos=-sysv\n\t\t;;\n\tm68knommu)\n\t\tbasic_machine=m68k-unknown\n\t\tos=-linux\n\t\t;;\n\tm68knommu-*)\n\t\tbasic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`\n\t\tos=-linux\n\t\t;;\n\tm88k-omron*)\n\t\tbasic_machine=m88k-omron\n\t\t;;\n\tmagnum | m3230)\n\t\tbasic_machine=mips-mips\n\t\tos=-sysv\n\t\t;;\n\tmerlin)\n\t\tbasic_machine=ns32k-utek\n\t\tos=-sysv\n\t\t;;\n\tmicroblaze)\n\t\tbasic_machine=microblaze-xilinx\n\t\t;;\n\tmingw32)\n\t\tbasic_machine=i386-pc\n\t\tos=-mingw32\n\t\t;;\n\tmingw32ce)\n\t\tbasic_machine=arm-unknown\n\t\tos=-mingw32ce\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\tmonitor)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\n\t\t;;\n\tmorphos)\n\t\tbasic_machine=powerpc-unknown\n\t\tos=-morphos\n\t\t;;\n\tmsdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-msdos\n\t\t;;\n\tms1-*)\n\t\tbasic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`\n\t\t;;\n\tmvs)\n\t\tbasic_machine=i370-ibm\n\t\tos=-mvs\n\t\t;;\n\tnacl)\n\t\tbasic_machine=le32-unknown\n\t\tos=-nacl\n\t\t;;\n\tncr3000)\n\t\tbasic_machine=i486-ncr\n\t\tos=-sysv4\n\t\t;;\n\tnetbsd386)\n\t\tbasic_machine=i386-unknown\n\t\tos=-netbsd\n\t\t;;\n\tnetwinder)\n\t\tbasic_machine=armv4l-rebel\n\t\tos=-linux\n\t\t;;\n\tnews | news700 | news800 | news900)\n\t\tbasic_machine=m68k-sony\n\t\tos=-newsos\n\t\t;;\n\tnews1000)\n\t\tbasic_machine=m68030-sony\n\t\tos=-newsos\n\t\t;;\n\tnews-3600 | risc-news)\n\t\tbasic_machine=mips-sony\n\t\tos=-newsos\n\t\t;;\n\tnecv70)\n\t\tbasic_machine=v70-nec\n\t\tos=-sysv\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\tnh3000)\n\t\tbasic_machine=m68k-harris\n\t\tos=-cxux\n\t\t;;\n\tnh[45]000)\n\t\tbasic_machine=m88k-harris\n\t\tos=-cxux\n\t\t;;\n\tnindy960)\n\t\tbasic_machine=i960-intel\n\t\tos=-nindy\n\t\t;;\n\tmon960)\n\t\tbasic_machine=i960-intel\n\t\tos=-mon960\n\t\t;;\n\tnonstopux)\n\t\tbasic_machine=mips-compaq\n\t\tos=-nonstopux\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\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\tos400)\n\t\tbasic_machine=powerpc-ibm\n\t\tos=-os400\n\t\t;;\n\tOSE68000 | ose68000)\n\t\tbasic_machine=m68000-ericsson\n\t\tos=-ose\n\t\t;;\n\tos68k)\n\t\tbasic_machine=m68k-none\n\t\tos=-os68k\n\t\t;;\n\tpa-hitachi)\n\t\tbasic_machine=hppa1.1-hitachi\n\t\tos=-hiuxwe2\n\t\t;;\n\tparagon)\n\t\tbasic_machine=i860-intel\n\t\tos=-osf\n\t\t;;\n\tparisc)\n\t\tbasic_machine=hppa-unknown\n\t\tos=-linux\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 | ppc-le | powerpc-little)\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 | ppc64-le | powerpc64-little)\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\tpw32)\n\t\tbasic_machine=i586-unknown\n\t\tos=-pw32\n\t\t;;\n\trdos)\n\t\tbasic_machine=i386-pc\n\t\tos=-rdos\n\t\t;;\n\trom68k)\n\t\tbasic_machine=m68k-rom68k\n\t\tos=-coff\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\tsa29200)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\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=-elf\n\t\t;;\n\tsei)\n\t\tbasic_machine=mips-sei\n\t\tos=-seiux\n\t\t;;\n\tsequent)\n\t\tbasic_machine=i386-sequent\n\t\t;;\n\tsh)\n\t\tbasic_machine=sh-hitachi\n\t\tos=-hms\n\t\t;;\n\tsh5el)\n\t\tbasic_machine=sh5le-unknown\n\t\t;;\n\tsh64)\n\t\tbasic_machine=sh64-unknown\n\t\t;;\n\tsparclite-wrs | simso-wrs)\n\t\tbasic_machine=sparclite-wrs\n\t\tos=-vxworks\n\t\t;;\n\tsps7)\n\t\tbasic_machine=m68k-bull\n\t\tos=-sysv2\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\tstratus)\n\t\tbasic_machine=i860-stratus\n\t\tos=-sysv4\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\tsun2os3)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun2os4)\n\t\tbasic_machine=m68000-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun3os3)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun3os4)\n\t\tbasic_machine=m68k-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4os3)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos3\n\t\t;;\n\tsun4os4)\n\t\tbasic_machine=sparc-sun\n\t\tos=-sunos4\n\t\t;;\n\tsun4sol2)\n\t\tbasic_machine=sparc-sun\n\t\tos=-solaris2\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\tsv1)\n\t\tbasic_machine=sv1-cray\n\t\tos=-unicos\n\t\t;;\n\tsymmetry)\n\t\tbasic_machine=i386-sequent\n\t\tos=-dynix\n\t\t;;\n\tt3e)\n\t\tbasic_machine=alphaev5-cray\n\t\tos=-unicos\n\t\t;;\n\tt90)\n\t\tbasic_machine=t90-cray\n\t\tos=-unicos\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\ttoad1)\n\t\tbasic_machine=pdp10-xkl\n\t\tos=-tops20\n\t\t;;\n\ttower | tower-32)\n\t\tbasic_machine=m68k-ncr\n\t\t;;\n\ttpf)\n\t\tbasic_machine=s390x-ibm\n\t\tos=-tpf\n\t\t;;\n\tudi29k)\n\t\tbasic_machine=a29k-amd\n\t\tos=-udi\n\t\t;;\n\tultra3)\n\t\tbasic_machine=a29k-nyu\n\t\tos=-sym1\n\t\t;;\n\tv810 | necv810)\n\t\tbasic_machine=v810-nec\n\t\tos=-none\n\t\t;;\n\tvaxv)\n\t\tbasic_machine=vax-dec\n\t\tos=-sysv\n\t\t;;\n\tvms)\n\t\tbasic_machine=vax-dec\n\t\tos=-vms\n\t\t;;\n\tvpp*|vx|vx-*)\n\t\tbasic_machine=f301-fujitsu\n\t\t;;\n\tvxworks960)\n\t\tbasic_machine=i960-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks68)\n\t\tbasic_machine=m68k-wrs\n\t\tos=-vxworks\n\t\t;;\n\tvxworks29k)\n\t\tbasic_machine=a29k-wrs\n\t\tos=-vxworks\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\txbox)\n\t\tbasic_machine=i686-pc\n\t\tos=-mingw32\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\tymp)\n\t\tbasic_machine=ymp-cray\n\t\tos=-unicos\n\t\t;;\n\tz8k-*-coff)\n\t\tbasic_machine=z8k-unknown\n\t\tos=-sim\n\t\t;;\n\tz80-*-coff)\n\t\tbasic_machine=z80-unknown\n\t\tos=-sim\n\t\t;;\n\tnone)\n\t\tbasic_machine=none-none\n\t\tos=-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\tpdp10)\n\t\t# there are many clones, so DEC is not a safe bet\n\t\tbasic_machine=pdp10-unknown\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\tsparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)\n\t\tbasic_machine=sparc-sun\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*-unknown)\n\t\t# Make sure to match an already-canonicalized machine name.\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\n\t# that might get confused with valid system types.\n\t# -solaris* is a basic system type, with this one exception.\n\t-auroraux)\n\t\tos=-auroraux\n\t\t;;\n\t-solaris1 | -solaris1.*)\n\t\tos=`echo $os | sed -e 's|solaris1|sunos4|'`\n\t\t;;\n\t-solaris)\n\t\tos=-solaris2\n\t\t;;\n\t-svr4*)\n\t\tos=-sysv4\n\t\t;;\n\t-unixware*)\n\t\tos=-sysv4.2uw\n\t\t;;\n\t-gnu/linux*)\n\t\tos=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`\n\t\t;;\n\t# First 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\t-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \\\n\t      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\\\n\t      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \\\n\t      | -sym* | -kopensolaris* \\\n\t      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \\\n\t      | -aos* | -aros* \\\n\t      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \\\n\t      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \\\n\t      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \\\n\t      | -openbsd* | -solidbsd* \\\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* \\\n\t      | -chorusos* | -chorusrdb* | -cegcc* \\\n\t      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \\\n\t      | -mingw32* | -linux-gnu* | -linux-android* \\\n\t      | -linux-newlib* | -linux-uclibc* \\\n\t      | -uxpv* | -beos* | -mpeix* | -udk* \\\n\t      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \\\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* | -rtmk-nova* | -windiss* \\\n\t      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \\\n\t      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)\n\t# Remember, each alternative MUST END IN *, to match a version number.\n\t\t;;\n\t-qnx*)\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\t-nto-qnx*)\n\t\t;;\n\t-nto*)\n\t\tos=`echo $os | sed -e 's|nto|nto-qnx|'`\n\t\t;;\n\t-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \\\n\t      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \\\n\t      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)\n\t\t;;\n\t-mac*)\n\t\tos=`echo $os | sed -e 's|mac|macos|'`\n\t\t;;\n\t-linux-dietlibc)\n\t\tos=-linux-dietlibc\n\t\t;;\n\t-linux*)\n\t\tos=`echo $os | sed -e 's|linux|linux-gnu|'`\n\t\t;;\n\t-sunos5*)\n\t\tos=`echo $os | sed -e 's|sunos5|solaris2|'`\n\t\t;;\n\t-sunos6*)\n\t\tos=`echo $os | sed -e 's|sunos6|solaris3|'`\n\t\t;;\n\t-opened*)\n\t\tos=-openedition\n\t\t;;\n\t-os400*)\n\t\tos=-os400\n\t\t;;\n\t-wince*)\n\t\tos=-wince\n\t\t;;\n\t-osfrose*)\n\t\tos=-osfrose\n\t\t;;\n\t-osf*)\n\t\tos=-osf\n\t\t;;\n\t-utek*)\n\t\tos=-bsd\n\t\t;;\n\t-dynix*)\n\t\tos=-bsd\n\t\t;;\n\t-acis*)\n\t\tos=-aos\n\t\t;;\n\t-atheos*)\n\t\tos=-atheos\n\t\t;;\n\t-syllable*)\n\t\tos=-syllable\n\t\t;;\n\t-386bsd)\n\t\tos=-bsd\n\t\t;;\n\t-ctix* | -uts*)\n\t\tos=-sysv\n\t\t;;\n\t-nova*)\n\t\tos=-rtmk-nova\n\t\t;;\n\t-ns2 )\n\t\tos=-nextstep2\n\t\t;;\n\t-nsk*)\n\t\tos=-nsk\n\t\t;;\n\t# Preserve the version number of sinix5.\n\t-sinix5.*)\n\t\tos=`echo $os | sed -e 's|sinix|sysv|'`\n\t\t;;\n\t-sinix*)\n\t\tos=-sysv4\n\t\t;;\n\t-tpf*)\n\t\tos=-tpf\n\t\t;;\n\t-triton*)\n\t\tos=-sysv3\n\t\t;;\n\t-oss*)\n\t\tos=-sysv3\n\t\t;;\n\t-svr4)\n\t\tos=-sysv4\n\t\t;;\n\t-svr3)\n\t\tos=-sysv3\n\t\t;;\n\t-sysvr4)\n\t\tos=-sysv4\n\t\t;;\n\t# This must come after -sysvr4.\n\t-sysv*)\n\t\t;;\n\t-ose*)\n\t\tos=-ose\n\t\t;;\n\t-es1800*)\n\t\tos=-ose\n\t\t;;\n\t-xenix)\n\t\tos=-xenix\n\t\t;;\n\t-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)\n\t\tos=-mint\n\t\t;;\n\t-aros*)\n\t\tos=-aros\n\t\t;;\n\t-kaos*)\n\t\tos=-kaos\n\t\t;;\n\t-zvmoe)\n\t\tos=-zvmoe\n\t\t;;\n\t-dicos*)\n\t\tos=-dicos\n\t\t;;\n\t-nacl*)\n\t\t;;\n\t-none)\n\t\t;;\n\t*)\n\t\t# Get rid of the `-' at the beginning of $os.\n\t\tos=`echo $os | sed 's/[^-]*-//'`\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\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# This also exists in the configure program, but was not the\n\t\t# default.\n\t\t# os=-sunos4\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\t*-be)\n\t\tos=-beos\n\t\t;;\n\t*-haiku)\n\t\tos=-haiku\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*-next)\n\t\tos=-nextstep3\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*)\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\t-riscix*)\n\t\t\t\tvendor=acorn\n\t\t\t\t;;\n\t\t\t-sunos*)\n\t\t\t\tvendor=sun\n\t\t\t\t;;\n\t\t\t-cnk*|-aix*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-beos*)\n\t\t\t\tvendor=be\n\t\t\t\t;;\n\t\t\t-hpux*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-mpeix*)\n\t\t\t\tvendor=hp\n\t\t\t\t;;\n\t\t\t-hiux*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-unos*)\n\t\t\t\tvendor=crds\n\t\t\t\t;;\n\t\t\t-dgux*)\n\t\t\t\tvendor=dg\n\t\t\t\t;;\n\t\t\t-luna*)\n\t\t\t\tvendor=omron\n\t\t\t\t;;\n\t\t\t-genix*)\n\t\t\t\tvendor=ns\n\t\t\t\t;;\n\t\t\t-mvs* | -opened*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-os400*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-ptx*)\n\t\t\t\tvendor=sequent\n\t\t\t\t;;\n\t\t\t-tpf*)\n\t\t\t\tvendor=ibm\n\t\t\t\t;;\n\t\t\t-vxsim* | -vxworks* | -windiss*)\n\t\t\t\tvendor=wrs\n\t\t\t\t;;\n\t\t\t-aux*)\n\t\t\t\tvendor=apple\n\t\t\t\t;;\n\t\t\t-hms*)\n\t\t\t\tvendor=hitachi\n\t\t\t\t;;\n\t\t\t-mpw* | -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\t-vos*)\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 'write-file-hooks 'time-stamp)\n# time-stamp-start: \"timestamp='\"\n# time-stamp-format: \"%:y-%02m-%02d\"\n# time-stamp-end: \"'\"\n# End:\n"},{"id":13643,"name":"mkinstalldirs","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#! /bin/sh\n# mkinstalldirs --- make directory hierarchy\n# Original author: Noah Friedman <friedman@prep.ai.mit.edu>\n# Created: 1993-05-16\n# Public domain.\n\nscriptversion=2003-09-26.19\n\nerrstatus=0\ndirmode=\"\"\n\nusage=\"\\\nUsage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...\n\nCreate each directory DIR (with mode MODE, if specified), including all\nleading file name components.\n\"\n\n# process command line arguments\nwhile test $# -gt 0 ; do\n  case $1 in\n    -h | --help | --h*)         # -h for help\n      echo \"$usage\"\n      exit 0\n      ;;\n    -m)                         # -m PERM arg\n      shift\n      test $# -eq 0 && { echo \"$usage\" 1>&2; exit 1; }\n      dirmode=$1\n      shift\n      ;;\n    --version)\n      echo \"$0 $scriptversion\"\n      exit 0\n      ;;\n    --)                         # stop option processing\n      shift\n      break\n      ;;\n    -*)                         # unknown option\n      echo \"$usage\" 1>&2\n      exit 1\n      ;;\n    *)                          # first non-opt arg\n      break\n      ;;\n  esac\ndone\n\nfor file\ndo\n  if test -d \"$file\"; then\n    shift\n  else\n    break\n  fi\ndone\n\ncase $# in\n  0) exit 0 ;;\nesac\n\ncase $dirmode in\n  '')\n    if mkdir -p -- . 2>/dev/null; then\n      echo \"mkdir -p -- $*\"\n      exec mkdir -p -- \"$@\"\n    else\n      # On NextStep and OpenStep, the `mkdir' command does not\n      # recognize any option.  It will interpret all options as\n      # directories to create, and then abort because `.' already\n      # exists.\n      test -d ./-p && rmdir ./-p\n      test -d ./-- && rmdir ./--\n    fi\n    ;;\n  *)\n    if mkdir -m \"$dirmode\" -p -- . 2>/dev/null; then\n      echo \"mkdir -m $dirmode -p -- $*\"\n      exec mkdir -m \"$dirmode\" -p -- \"$@\"\n    else\n      # Clean up after NextStep and OpenStep mkdir.\n      for d in ./-m ./-p ./-- \"./$dirmode\";\n      do\n        test -d $d && rmdir $d\n      done\n    fi\n    ;;\nesac\n\nfor file\ndo\n  set fnord `echo \":$file\" | sed -ne 's/^:\\//#/;s/^://;s/\\// /g;s/^#/\\//;p'`\n  shift\n\n  pathcomp=\n  for d\n  do\n    pathcomp=\"$pathcomp$d\"\n    case $pathcomp in\n      -*) pathcomp=./$pathcomp ;;\n    esac\n\n    if test ! -d \"$pathcomp\"; then\n      echo \"mkdir $pathcomp\"\n\n      mkdir \"$pathcomp\" || lasterr=$?\n\n      if test ! -d \"$pathcomp\"; then\n\terrstatus=$lasterr\n      else\n\tif test ! -z \"$dirmode\"; then\n\t  echo \"chmod $dirmode $pathcomp\"\n\t  lasterr=\"\"\n\t  chmod \"$dirmode\" \"$pathcomp\" || lasterr=$?\n\n\t  if test ! -z \"$lasterr\"; then\n\t    errstatus=$lasterr\n\t  fi\n\tfi\n      fi\n    fi\n\n    pathcomp=\"$pathcomp/\"\n  done\ndone\n\nexit $errstatus\n\n# Local Variables:\n# mode: shell-script\n# sh-indentation: 2\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-end: \"$\"\n# End:\n"},{"id":13644,"name":"install-sh","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#!/bin/sh\n# install - install a program, script, or datafile\n\nscriptversion=2003-09-24.23\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.  It can only install one file at a time, a restriction\n# shared with many OS's install programs.\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-}\"\n\n# put in absolute paths if you don't have them in your path; or use env. vars.\n\nmvprog=\"${MVPROG-mv}\"\ncpprog=\"${CPPROG-cp}\"\nchmodprog=\"${CHMODPROG-chmod}\"\nchownprog=\"${CHOWNPROG-chown}\"\nchgrpprog=\"${CHGRPPROG-chgrp}\"\nstripprog=\"${STRIPPROG-strip}\"\nrmprog=\"${RMPROG-rm}\"\nmkdirprog=\"${MKDIRPROG-mkdir}\"\n\ntransformbasename=\ntransform_arg=\ninstcmd=\"$mvprog\"\nchmodcmd=\"$chmodprog 0755\"\nchowncmd=\nchgrpcmd=\nstripcmd=\nrmcmd=\"$rmprog -f\"\nmvcmd=\"$mvprog\"\nsrc=\ndst=\ndir_arg=\n\nusage=\"Usage: $0 [OPTION]... SRCFILE DSTFILE\n   or: $0 -d DIR1 DIR2...\n\nIn the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.\nIn the second, create the directory path DIR.\n\nOptions:\n-b=TRANSFORMBASENAME\n-c         copy source (using $cpprog) instead of moving (using $mvprog).\n-d         create directories instead of installing files.\n-g GROUP   $chgrp installed files to GROUP.\n-m MODE    $chmod installed files to MODE.\n-o USER    $chown installed files to USER.\n-s         strip installed files (using $stripprog).\n-t=TRANSFORM\n--help     display this help and exit.\n--version  display version info and exit.\n\nEnvironment variables override the default commands:\n  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG\n\"\n\nwhile test -n \"$1\"; do\n  case $1 in\n    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`\n        shift\n        continue;;\n\n    -c) instcmd=$cpprog\n        shift\n        continue;;\n\n    -d) dir_arg=true\n        shift\n        continue;;\n\n    -g) chgrpcmd=\"$chgrpprog $2\"\n        shift\n        shift\n        continue;;\n\n    --help) echo \"$usage\"; exit 0;;\n\n    -m) chmodcmd=\"$chmodprog $2\"\n        shift\n        shift\n        continue;;\n\n    -o) chowncmd=\"$chownprog $2\"\n        shift\n        shift\n        continue;;\n\n    -s) stripcmd=$stripprog\n        shift\n        continue;;\n\n    -t=*) transformarg=`echo $1 | sed 's/-t=//'`\n        shift\n        continue;;\n\n    --version) echo \"$0 $scriptversion\"; exit 0;;\n\n    *)  if test -z \"$src\"; then\n          src=$1\n        else\n          # this colon is to work around a 386BSD /bin/sh bug\n          :\n          dst=$1\n        fi\n        shift\n        continue;;\n  esac\ndone\n\nif test -z \"$src\"; then\n  echo \"$0: no input file specified.\" >&2\n  exit 1\nfi\n\n# Protect names starting with `-'.\ncase $src in\n  -*) src=./$src ;;\nesac\n\nif test -n \"$dir_arg\"; then\n  dst=$src\n  src=\n\n  if test -d \"$dst\"; then\n    instcmd=:\n    chmodcmd=\n  else\n    instcmd=$mkdirprog\n  fi\nelse\n  # Waiting for this to be detected by the \"$instcmd $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\"; then\n    echo \"$0: no destination specified.\" >&2\n    exit 1\n  fi\n\n  # Protect names starting with `-'.\n  case $dst in\n    -*) dst=./$dst ;;\n  esac\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    dst=$dst/`basename \"$src\"`\n  fi\nfi\n\n# This sed command emulates the dirname command.\ndstdir=`echo \"$dst\" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`\n\n# Make sure that the destination directory exists.\n\n# Skip lots of stat calls in the usual case.\nif test ! -d \"$dstdir\"; then\n  defaultIFS='\n\t'\n  IFS=\"${IFS-$defaultIFS}\"\n\n  oIFS=$IFS\n  # Some sh's can't handle IFS=/ for some reason.\n  IFS='%'\n  set - `echo \"$dstdir\" | sed -e 's@/@%@g' -e 's@^%@/@'`\n  IFS=$oIFS\n\n  pathcomp=\n\n  while test $# -ne 0 ; do\n    pathcomp=$pathcomp$1\n    shift\n    test -d \"$pathcomp\" || $mkdirprog \"$pathcomp\"\n    pathcomp=$pathcomp/\n  done\nfi\n\nif test -n \"$dir_arg\"; then\n  $doit $instcmd \"$dst\" \\\n    && { test -z \"$chowncmd\" || $doit $chowncmd \"$dst\"; } \\\n    && { test -z \"$chgrpcmd\" || $doit $chgrpcmd \"$dst\"; } \\\n    && { test -z \"$stripcmd\" || $doit $stripcmd \"$dst\"; } \\\n    && { test -z \"$chmodcmd\" || $doit $chmodcmd \"$dst\"; }\n\nelse\n  # If we're going to rename the final executable, determine the name now.\n  if test -z \"$transformarg\"; then\n    dstfile=`basename \"$dst\"`\n  else\n    dstfile=`basename \"$dst\" $transformbasename \\\n             | sed $transformarg`$transformbasename\n  fi\n\n  # don't allow the sed command to completely eliminate the filename.\n  test -z \"$dstfile\" && dstfile=`basename \"$dst\"`\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 'status=$?; rm -f \"$dsttmp\" \"$rmtmp\" && exit $status' 0\n  trap '(exit $?); exit' 1 2 13 15\n\n  # Move or copy the file name to the temp name\n  $doit $instcmd \"$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 $instcmd $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 \"$dsttmp\"; } &&\n\n  # Now remove or move aside any old file at destination location.  We\n  # try this two ways since rm can't unlink itself on some systems and\n  # the destination file might be busy for other reasons.  In this case,\n  # the final cleanup might fail but the new file should still install\n  # successfully.\n  {\n    if test -f \"$dstdir/$dstfile\"; then\n      $doit $rmcmd -f \"$dstdir/$dstfile\" 2>/dev/null \\\n      || $doit $mvcmd -f \"$dstdir/$dstfile\" \"$rmtmp\" 2>/dev/null \\\n      || {\n\t  echo \"$0: cannot unlink or rename $dstdir/$dstfile\" >&2\n\t  (exit 1); exit\n      }\n    else\n      :\n    fi\n  } &&\n\n  # Now rename the file to the real destination.\n  $doit $mvcmd \"$dsttmp\" \"$dstdir/$dstfile\"\nfi &&\n\n# The final little trick to \"correctly\" pass the exit status to the exit trap.\n{\n  (exit 0); exit\n}\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-end: \"$\"\n# End:\n"},{"id":13645,"name":"cextern/cfitsio","nodeType":"Package"},{"id":13646,"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":13647,"name":"move-if-change","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#!/bin/sh\n# Like mv $1 $2, but if the files are the same, just delete $1.\n# Status is 0 if $2 is changed, 1 otherwise.\nif test -r $2; then\n  if cmp -s $1 $2; then\n    echo $2 is unchanged\n    rm -f $1\n  else\n    mv -f $1 $2\n  fi\nelse\n  mv -f $1 $2\nfi\n"},{"id":13648,"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":13649,"name":"cextern/cfitsio/lib","nodeType":"Package"},{"id":13650,"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                sprintf(message, \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           sprintf(message,\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         ffswap4( (INT32BIT*) &i8null, 2); /* 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                sprintf(message, \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           sprintf(message,\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":13651,"name":"mdate-sh","nodeType":"TextFile","path":"cextern/wcslib/config","text":"#!/bin/sh\n# Get modification time of a file or directory and pretty-print it.\n# Copyright (C) 1995, 1996, 1997, 2003  Free Software Foundation, Inc.\n# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995\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 2, or (at your option)\n# 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, write to the Free Software Foundation,\n# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\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 program.\n\n# Prevent date giving response in another language.\nLANG=C\nexport LANG\nLC_ALL=C\nexport LC_ALL\nLC_TIME=C\nexport LC_TIME\n\nsave_arg1=\"$1\"\n\n# Find out how to get the extended ls output of a file or directory.\nif ls -L /dev/null 1>/dev/null 2>&1; then\n  ls_command='ls -L -l -d'\nelse\n  ls_command='ls -l -d'\nfi\n\n# A `ls -l' line looks as follows on OS/2.\n#  drwxrwx---        0 Aug 11  2001 foo\n# This differs from Unix, which adds ownership information.\n#  drwxrwx---   2 root  root      4096 Aug 11  2001 foo\n#\n# To find the date, we split the line on spaces and iterate on words\n# until we find a month.  This cannot work with files whose owner is a\n# user named `Jan', or `Feb', etc.  However, it's unlikely that `/'\n# will be owned by a user whose name is a month.  So we first look at\n# the extended ls output of the root directory to decide how many\n# words should be skipped to get the date.\n\n# On HPUX /bin/sh, \"set\" interprets \"-rw-r--r--\" as options, so the \"x\" below.\nset - x`$ls_command /`\n\n# Find which argument is the month.\nmonth=\ncommand=\nuntil test $month\ndo\n  shift\n  # Add another shift to the command.\n  command=\"$command shift;\"\n  case $1 in\n    Jan) month=January; nummonth=1;;\n    Feb) month=February; nummonth=2;;\n    Mar) month=March; nummonth=3;;\n    Apr) month=April; nummonth=4;;\n    May) month=May; nummonth=5;;\n    Jun) month=June; nummonth=6;;\n    Jul) month=July; nummonth=7;;\n    Aug) month=August; nummonth=8;;\n    Sep) month=September; nummonth=9;;\n    Oct) month=October; nummonth=10;;\n    Nov) month=November; nummonth=11;;\n    Dec) month=December; nummonth=12;;\n  esac\ndone\n\n# Get the extended ls output of the file or directory.\nset - x`eval \"$ls_command \\\"\\$save_arg1\\\"\"`\n\n# Remove all preceding arguments\neval $command\n\n# Get the month.  Next argument is day, followed by the year or time.\ncase $1 in\n  Jan) month=January; nummonth=1;;\n  Feb) month=February; nummonth=2;;\n  Mar) month=March; nummonth=3;;\n  Apr) month=April; nummonth=4;;\n  May) month=May; nummonth=5;;\n  Jun) month=June; nummonth=6;;\n  Jul) month=July; nummonth=7;;\n  Aug) month=August; nummonth=8;;\n  Sep) month=September; nummonth=9;;\n  Oct) month=October; nummonth=10;;\n  Nov) month=November; nummonth=11;;\n  Dec) month=December; nummonth=12;;\nesac\n\nday=$2\n\n# Here we have to deal with the problem that the ls output gives either\n# the time of day or the year.\ncase $3 in\n  *:*) set `date`; eval year=\\$$#\n       case $2 in\n\t Jan) nummonthtod=1;;\n\t Feb) nummonthtod=2;;\n\t Mar) nummonthtod=3;;\n\t Apr) nummonthtod=4;;\n\t May) nummonthtod=5;;\n\t Jun) nummonthtod=6;;\n\t Jul) nummonthtod=7;;\n\t Aug) nummonthtod=8;;\n\t Sep) nummonthtod=9;;\n\t Oct) nummonthtod=10;;\n\t Nov) nummonthtod=11;;\n\t Dec) nummonthtod=12;;\n       esac\n       # For the first six month of the year the time notation can also\n       # be used for files modified in the last year.\n       if (expr $nummonth \\> $nummonthtod) > /dev/null;\n       then\n\t year=`expr $year - 1`\n       fi;;\n  *) year=$3;;\nesac\n\n# The result.\necho $day $month $year\n"},{"id":13652,"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /* 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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcluk).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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] > 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 == 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[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          sprintf(message, \"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":13653,"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":13654,"name":"wcsbth.c","nodeType":"TextFile","path":"cextern/wcslib/C/flexed","text":"#line 2 \"wcsbth.c\"\n\n#line 4 \"wcsbth.c\"\n\n#define  YY_INT_ALIGNED short int\n\n/* A lexical scanner generated by flex */\n\n#define yy_create_buffer wcsbth_create_buffer\n#define yy_delete_buffer wcsbth_delete_buffer\n#define yy_flex_debug wcsbth_flex_debug\n#define yy_init_buffer wcsbth_init_buffer\n#define yy_flush_buffer wcsbth_flush_buffer\n#define yy_load_buffer_state wcsbth_load_buffer_state\n#define yy_switch_to_buffer wcsbth_switch_to_buffer\n#define yyin wcsbthin\n#define yyleng wcsbthleng\n#define yylex wcsbthlex\n#define yylineno wcsbthlineno\n#define yyout wcsbthout\n#define yyrestart wcsbthrestart\n#define yytext wcsbthtext\n#define yywrap wcsbthwrap\n#define yyalloc wcsbthalloc\n#define yyrealloc wcsbthrealloc\n#define yyfree wcsbthfree\n\n#define FLEX_SCANNER\n#define YY_FLEX_MAJOR_VERSION 2\n#define YY_FLEX_MINOR_VERSION 5\n#define YY_FLEX_SUBMINOR_VERSION 39\n#if YY_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;\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#endif /* ! C99 */\n\n#endif /* ! FLEXINT_H */\n\n#ifdef __cplusplus\n\n/* The \"const\" storage-class-modifier is valid. */\n#define YY_USE_CONST\n\n#else\t/* ! __cplusplus */\n\n/* C99 requires __STDC__ to be defined as 1. */\n#if defined (__STDC__)\n\n#define YY_USE_CONST\n\n#endif\t/* defined (__STDC__) */\n#endif\t/* ! __cplusplus */\n\n#ifdef YY_USE_CONST\n#define yyconst const\n#else\n#define yyconst\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 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 YY_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 (yy_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 YYSTATE alias is for lex\n * compatibility.\n */\n#define YY_START (((yy_start) - 1) / 2)\n#define YYSTATE YY_START\n\n/* Action number for EOF rule of a given start state. */\n#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\n\n/* Special action meaning \"start processing a new file\". */\n#define YY_NEW_FILE wcsbthrestart(wcsbthin  )\n\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\nextern yy_size_t wcsbthleng;\n\nextern FILE *wcsbthin, *wcsbthout;\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 wcsbthtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\t*yy_cp = (yy_hold_char); \\\n\t\tYY_RESTORE_YY_MORE_OFFSET \\\n\t\t(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\\n\t\tYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */ \\\n\t\t} \\\n\twhile ( 0 )\n\n#define unput(c) yyunput( c, (yytext_ptr)  )\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\tyy_size_t yy_buf_size;\n\n\t/* Number of characters read into yy_ch_buf, not including EOB\n\t * characters.\n\t */\n\tyy_size_t 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 wcsbthrestart()), so that the user can continue scanning by\n\t * just pointing wcsbthin 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/* Stack of input buffers. */\nstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\nstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\nstatic YY_BUFFER_STATE * yy_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 YY_CURRENT_BUFFER ( (yy_buffer_stack) \\\n                          ? (yy_buffer_stack)[(yy_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 YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\n\n/* yy_hold_char holds the character lost when wcsbthtext is formed. */\nstatic char yy_hold_char;\nstatic yy_size_t yy_n_chars;\t\t/* number of characters read into yy_ch_buf */\nyy_size_t wcsbthleng;\n\n/* Points to current character in buffer. */\nstatic char *yy_c_buf_p = (char *) 0;\nstatic int yy_init = 0;\t\t/* whether we need to initialize */\nstatic int yy_start = 0;\t/* start state number */\n\n/* Flag which is used to allow wcsbthwrap()'s to do buffer switches\n * instead of setting up a fresh wcsbthin.  A bit of a hack ...\n */\nstatic int yy_did_buffer_switch_on_eof;\n\nvoid wcsbthrestart (FILE *input_file  );\nvoid wcsbth_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\nYY_BUFFER_STATE wcsbth_create_buffer (FILE *file,int size  );\nvoid wcsbth_delete_buffer (YY_BUFFER_STATE b  );\nvoid wcsbth_flush_buffer (YY_BUFFER_STATE b  );\nvoid wcsbthpush_buffer_state (YY_BUFFER_STATE new_buffer  );\nvoid wcsbthpop_buffer_state (void );\n\nstatic void wcsbthensure_buffer_stack (void );\nstatic void wcsbth_load_buffer_state (void );\nstatic void wcsbth_init_buffer (YY_BUFFER_STATE b,FILE *file  );\n\n#define YY_FLUSH_BUFFER wcsbth_flush_buffer(YY_CURRENT_BUFFER )\n\nYY_BUFFER_STATE wcsbth_scan_buffer (char *base,yy_size_t size  );\nYY_BUFFER_STATE wcsbth_scan_string (yyconst char *yy_str  );\nYY_BUFFER_STATE wcsbth_scan_bytes (yyconst char *bytes,yy_size_t len  );\n\nvoid *wcsbthalloc (yy_size_t  );\nvoid *wcsbthrealloc (void *,yy_size_t  );\nvoid wcsbthfree (void *  );\n\n#define yy_new_buffer wcsbth_create_buffer\n\n#define yy_set_interactive(is_interactive) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){ \\\n        wcsbthensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\\n\t}\n\n#define yy_set_bol(at_bol) \\\n\t{ \\\n\tif ( ! YY_CURRENT_BUFFER ){\\\n        wcsbthensure_buffer_stack (); \\\n\t\tYY_CURRENT_BUFFER_LVALUE =    \\\n            wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); \\\n\t} \\\n\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\\n\t}\n\n#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\n\n/* Begin user sect3 */\n\n#define wcsbthwrap() 1\n#define YY_SKIP_YYWRAP\n\ntypedef char YY_CHAR;\n\nFILE *wcsbthin = (FILE *) 0, *wcsbthout = (FILE *) 0;\n\ntypedef int yy_state_type;\n\nextern int wcsbthlineno;\n\nint wcsbthlineno = 1;\n\nextern char *wcsbthtext;\n#define yytext_ptr wcsbthtext\n\nstatic yyconst 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       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,   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\n    },\n\n    {\n       67,   69,   69,   69,   69,   69,   69,   69,   69,   69,\n       68,   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,   70,\n       70,   70,   70,   70,   70,   70,   70,   70,   69,   69,\n       69,   69,   69,   69,   69,   69,   69,   71,   72,   73,\n       69,   69,   69,   69,   69,   69,   74,   75,   69,   76,\n       77,   69,   78,   79,   80,   69,   81,   82,   69,   69,\n       83,   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       67,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n\n       68,   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       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\n    },\n\n    {\n       67,   84,   84,   84,   84,   84,   84,   84,   84,   84,\n       68,   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\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       67,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       68,   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,   88,\n\n       88,   88,   88,   88,   88,   88,   88,   88,   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       67,   87,   87,   87,   87,   87,   87,   87,   87,   87,\n       68,   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,   88,\n       88,   88,   88,   88,   88,   88,   88,   88,   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\n    },\n\n    {\n       67,   89,   89,   89,   89,   89,   89,   89,   89,   89,\n       68,   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,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   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\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       67,   89,   89,   89,   89,   89,   89,   89,   89,   89,\n       68,   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,   90,\n       90,   90,   90,   90,   90,   90,   90,   90,   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\n    },\n\n    {\n       67,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       68,   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,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   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       91,   91,   91,   91,   91,   91,   91,   91\n\n    },\n\n    {\n       67,   91,   91,   91,   91,   91,   91,   91,   91,   91,\n       68,   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,   92,\n       92,   92,   92,   92,   92,   92,   92,   92,   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\n    },\n\n    {\n       67,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       68,   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       94,   94,   94,   94,   94,   94,   94,   94,   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,   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       67,   93,   93,   93,   93,   93,   93,   93,   93,   93,\n       68,   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,   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       93,   93,   93,   93,   93,   93,   93,   93\n    },\n\n    {\n       67,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n\n       68,   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,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   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\n       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       95,   95,   95,   95,   95,   95,   95,   95\n    },\n\n    {\n       67,   95,   95,   95,   95,   95,   95,   95,   95,   95,\n       68,   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,   97,\n       97,   97,   97,   97,   97,   97,   97,   97,   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\n    },\n\n    {\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,   68,   68,   68,\n       68,   68,   68,   68,   68,   68,   68,   68,   68,   98,\n\n       98,   98,   98,   98,   98,   98,   98,   98,   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,   68,   68,\n       68,   68,   68,   68,   68,   68,   68,   68\n    },\n\n    {\n       67,   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,   98,\n       98,   98,   98,   98,   98,   98,   98,   98,   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,   68,   68,\n\n       68,   68,   68,   68,   68,   68,   68,   68\n    },\n\n    {\n       67,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       68,   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       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\n    },\n\n    {\n       67,   99,   99,   99,   99,   99,   99,   99,   99,   99,\n       68,   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\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       67,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n       68,  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,  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      101,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n      101,  101,  101,  101,  101,  101,  101,  101\n\n    },\n\n    {\n       67,  101,  101,  101,  101,  101,  101,  101,  101,  101,\n       68,  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\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       67,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n       68,  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,  104,  104,\n      104,  104,  104,  104,  104,  104,  104,  104,  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,  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       67,  103,  103,  103,  103,  103,  103,  103,  103,  103,\n       68,  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,  104,  104,\n      104,  104,  104,  104,  104,  104,  104,  104,  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\n    },\n\n    {\n       67,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n\n       68,  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      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\n    },\n\n    {\n       67,  105,  105,  105,  105,  105,  105,  105,  105,  105,\n       68,  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\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       67,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       68,  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\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       67,  107,  107,  107,  107,  107,  107,  107,  107,  107,\n       68,  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,  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\n      107,  107,  107,  107,  107,  107,  107,  107\n    },\n\n    {\n       67,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n       68,  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,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  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\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       67,  109,  109,  109,  109,  109,  109,  109,  109,  109,\n       68,  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,  111,\n      111,  111,  111,  111,  111,  111,  111,  111,  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\n    },\n\n    {\n       67,  112,  112,  112,  112,  112,  112,  112,  112,  112,\n       68,  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,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  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    {\n       67,  112,  112,  112,  112,  112,  112,  112,  112,  112,\n       68,  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,  113,\n      113,  113,  113,  113,  113,  113,  113,  113,  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\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       67,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n       68,  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,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  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,  114,  114,\n      114,  114,  114,  114,  114,  114,  114,  114\n    },\n\n    {\n       67,  114,  114,  114,  114,  114,  114,  114,  114,  114,\n       68,  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,  115,\n      115,  115,  115,  115,  115,  115,  115,  115,  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\n    },\n\n    {\n       67,  116,  116,  116,  116,  116,  116,  116,  116,  116,\n\n       68,  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,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  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,  116,  116,\n      116,  116,  116,  116,  116,  116,  116,  116\n    },\n\n    {\n       67,  116,  116,  116,  116,  116,  116,  116,  116,  116,\n       68,  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,  117,\n      117,  117,  117,  117,  117,  117,  117,  117,  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,  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\n    },\n\n    {\n       67,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       68,  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\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       67,  118,  118,  118,  118,  118,  118,  118,  118,  118,\n       68,  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,  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\n      118,  118,  118,  118,  118,  118,  118,  118\n    },\n\n    {\n       67,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       68,  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,  121,  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\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       67,  120,  120,  120,  120,  120,  120,  120,  120,  120,\n       68,  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,  121,  121,\n      121,  121,  121,  121,  121,  121,  121,  121,  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       67,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n       68,  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,  122,  122,\n      122,  122,  122,  122,  122,  122,  122,  122\n\n    },\n\n    {\n       67,  122,  122,  122,  122,  122,  122,  122,  122,  122,\n       68,  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,  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\n    },\n\n    {\n       67,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n       68,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  124,  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,  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,  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\n    },\n\n    {\n       67,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n       68,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,\n      123,  123,  124,  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,  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,  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\n    },\n\n    {\n       67,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n\n       68,  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,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  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\n    },\n\n    {\n       67,  125,  125,  125,  125,  125,  125,  125,  125,  125,\n       68,  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,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  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\n    },\n\n    {\n       67,  127,  127,  127,  127,  127,  127,  127,  127,  127,\n       68,  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,  128,\n\n      128,  128,  128,  128,  128,  128,  128,  128,  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\n    },\n\n    {\n       67,  127,  127,  127,  127,  127,  127,  127,  127,  127,\n       68,  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,  128,\n      128,  128,  128,  128,  128,  128,  128,  128,  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\n    },\n\n    {\n       67,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n       68,  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,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  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\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       67,  129,  129,  129,  129,  129,  129,  129,  129,  129,\n       68,  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,  130,\n      130,  130,  130,  130,  130,  130,  130,  130,  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\n    },\n\n    {\n       67,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n       68,  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,  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      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n      131,  131,  131,  131,  131,  131,  131,  131\n\n    },\n\n    {\n       67,  131,  131,  131,  131,  131,  131,  131,  131,  131,\n       68,  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\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       67,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n       68,  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,  134,  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\n    },\n\n    {\n       67,  133,  133,  133,  133,  133,  133,  133,  133,  133,\n       68,  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,  133,  133,\n      133,  134,  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       67,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n\n       68,  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,  135,  135,  137,  137,\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\n      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n      135,  135,  135,  135,  135,  135,  135,  135\n    },\n\n    {\n       67,  135,  135,  135,  135,  135,  135,  135,  135,  135,\n       68,  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,  135,  135,  137,  137,\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\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       67,  138,  138,  138,  138,  138,  138,  138,  138,  138,\n       68,  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,  139,  138,  139,  140,  138,  141,  141,\n\n      141,  141,  141,  141,  141,  141,  141,  141,  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,  138,  138,\n      138,  138,  138,  138,  138,  138,  138,  138\n    },\n\n    {\n       67,  138,  138,  138,  138,  138,  138,  138,  138,  138,\n       68,  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,  139,  138,  139,  140,  138,  141,  141,\n      141,  141,  141,  141,  141,  141,  141,  141,  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,  138,  138,\n\n      138,  138,  138,  138,  138,  138,  138,  138\n    },\n\n    {\n       67,  142,  142,  142,  142,  142,  142,  142,  142,  142,\n       68,  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,  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      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\n    },\n\n    {\n       67,  142,  142,  142,  142,  142,  142,  142,  142,  142,\n       68,  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,  143,\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,  142,  142,  142,  142,  142,\n      142,  142,  142,  142,  142,  142,  142,  142\n    },\n\n    {\n       67,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      145,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n\n      144,  144,  146,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  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,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144\n\n    },\n\n    {\n       67,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      145,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  146,  144,  144,  144,  144,  144,  144,  144,\n      144,  144,  144,  144,  144,  144,  144,  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\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       67,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      149,  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\n    },\n\n    {\n       67,  148,  148,  148,  148,  148,  148,  148,  148,  148,\n      149,  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,  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       67,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n\n      151,  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\n    },\n\n    {\n       67,  150,  150,  150,  150,  150,  150,  150,  150,  150,\n      151,  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       67,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      153,  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\n    },\n\n    {\n       67,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n      153,  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,  152,  152,\n      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,\n\n      152,  152,  152,  152,  152,  152,  152,  152\n    },\n\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,  -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       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,  -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       67,  -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       67,  -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,  154,  154,\n      154,  154,  154,  154,  154,  154,  154,  154,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  155,  -70,  -70,\n      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,\n      156,  -70,  -70,  157,  -70,  -70,  158,  -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       67,  -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,  159,  -71,\n\n      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  160,  -71,\n      -71,  -71,  161,  162,  163,  164,  -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       67,  -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,  165,  -72,  -72,  -72,  -72,\n      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  166,\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       67,  -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,  167,  -73,\n      168,  169,  -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       67,  -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,  170,  -74,  -74,  -74,  -74,\n      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  171,\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       67,  -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,  172,  -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       67,  -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,  173,  -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       67,  -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,  174,  -77,  -77,\n      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,\n      -77,  -77,  175,  176,  -77,  -77,  177,  -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       67,  -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,  178,  -78,  -78,  -78,  179,\n      180,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,\n      -78,  -78,  -78,  -78,  -78,  -78,  -78,  181,  -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       67,  -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,  182,\n      183,  -79,  -79,  184,  -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       67,  -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,  185,  -80,  -80,\n      186,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,\n      187,  -80,  -80,  188,  -80,  -80,  189,  190,  -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       67,  -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,  191,  -81,  -81,  -81,  192,\n\n      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,\n      -81,  -81,  -81,  193,  -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       67,  -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,  194,  -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       67,  -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,  195,  -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       67,  -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       67,  -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,  196,  -85,  -85,  -85,  -85,  -85,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  197,  198,\n\n      198,  198,  198,  198,  198,  198,  198,  198,  -85,  -85,\n      -85,  -85,  -85,  -85,  -85,  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,  -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       67,  -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,  199,  -86,  -86,  -86,  -86,  -86,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  200,  200,\n      200,  200,  200,  200,  200,  200,  200,  200,  -86,  -86,\n      -86,  -86,  -86,  -86,  -86,  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,  -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       67,  -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       67,  -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,  201,  -88,  -88,  -88,  -88,  -88,  -88,  -88,\n      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  202,  202,\n      202,  202,  202,  202,  202,  202,  202,  202,  -88,  -88,\n\n      -88,  -88,  -88,  -88,  -88,  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,  -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       67,  -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,  -89,  -89,  -89,  -89,  -89,  -89,  -89\n\n    },\n\n    {\n       67,  -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,  203,  -90,  -90,  -90,  -90,  -90,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  204,  204,\n      204,  204,  204,  204,  204,  204,  204,  204,  -90,  -90,\n      -90,  -90,  -90,  -90,  -90,  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,  -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       67,  -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       67,  -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,  206,  -92,  -92,  -92,  -92,  -92,  -92,  -92,\n\n      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  207,  207,\n      207,  207,  207,  207,  207,  207,  207,  207,  -92,  -92,\n      -92,  -92,  -92,  -92,  -92,  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,  -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       67,  -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       67,  -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,  208,  -94,  -94,  -94,  -94,  -94,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  209,  209,\n      209,  209,  209,  209,  209,  209,  209,  209,  -94,  -94,\n      -94,  -94,  -94,  -94,  -94,  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,  -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       67,  -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       67,  -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,  211,  -96,  -96,  212,  213,\n      213,  213,  213,  213,  213,  213,  213,  213,  -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,  214,  -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       67,  -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,  211,  -97,  -97,  215,  215,\n      215,  215,  215,  215,  215,  215,  215,  215,  -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,  216,  -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       67,  -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,  217,  -98,  -98,  -98,  -98,  -98,  -98,  -98,\n      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  218,  218,\n      218,  218,  218,  218,  218,  218,  218,  218,  -98,  -98,\n\n      -98,  -98,  -98,  -98,  -98,  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,  -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       67,  -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       67, -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,  219,  219,\n      219,  219,  219,  219,  219,  219,  219,  219, -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,  220, -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       67, -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       67, -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,  221,  221,\n      221,  221,  221,  221,  221,  221,  221,  221, -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,  222, -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       67, -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       67, -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,  223, -104, -104, -104, -104, -104, -104, -104,\n     -104, -104, -104, -104, -104, -104, -104, -104,  224,  224,\n      224,  224,  224,  224,  224,  224,  224,  224, -104, -104,\n     -104, -104, -104, -104, -104,  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, -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       67, -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       67, -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,  226,  226,\n      226,  226,  226,  226,  226,  226,  226,  226, -106, -106,\n     -106, -106, -106, -106, -106,  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, -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       67, -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       67, -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,  228, -108, -108, -108, -108, -108, -108, -108,\n     -108, -108, -108, -108, -108, -108, -108, -108,  229,  229,\n      229,  229,  229,  229,  229,  229,  229,  229, -108, -108,\n\n     -108, -108, -108, -108, -108,  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, -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       67, -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       67, -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,  231, -110, -110,  232,  233,\n      233,  233,  233,  233,  233,  233,  233,  233, -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,  234, -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       67, -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,  231, -111, -111,  235,  235,\n      235,  235,  235,  235,  235,  235,  235,  235, -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,  236, -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       67, -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       67, -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,  237,  237,\n      237,  237,  237,  237,  237,  237,  237,  237, -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,  238, -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       67, -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       67, -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,  239,  239,\n\n      239,  239,  239,  239,  239,  239,  239,  239, -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,  240, -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       67, -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, -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       67, -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,  241,  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,  242, -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       67, -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       67, -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,  243,  243,\n      243,  243,  243,  243,  243,  243,  243,  243, -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,  244, -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       67, -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       67, -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,  245, -121, -121, -121, -121, -121, -121, -121,\n     -121, -121, -121, -121, -121, -121, -121, -121,  246,  246,\n      246,  246,  246,  246,  246,  246,  246,  246, -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       67, -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       67, -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       67, -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       67, -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, -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       67, -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,  247, -126, -126, -126, -126, -126, -126, -126,\n     -126, -126, -126, -126, -126, -126, -126, -126,  248,  248,\n      248,  248,  248,  248,  248,  248,  248,  248, -126, -126,\n     -126, -126, -126, -126, -126,  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, -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       67, -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       67, -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,  249, -128, -128, -128, -128, -128, -128, -128,\n     -128, -128, -128, -128, -128, -128, -128, -128,  250,  250,\n      250,  250,  250,  250,  250,  250,  250,  250, -128, -128,\n\n     -128, -128, -128, -128, -128,  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, -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       67, -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       67, -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,  251, -130, -130, -130, -130, -130, -130, -130,\n     -130, -130, -130, -130, -130, -130, -130, -130,  252,  252,\n      252,  252,  252,  252,  252,  252,  252,  252, -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       67, -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       67, -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,  253, -132, -132, -132, -132, -132, -132, -132,\n\n     -132, -132, -132, -132, -132, -132, -132, -132,  254,  254,\n      254,  254,  254,  254,  254,  254,  254,  254, -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       67, -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       67, -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,  255, -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, -134, -134, -134, -134, -134, -134\n    },\n\n    {\n       67, -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       67, -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,  256,  256,\n      256,  256,  256,  256,  256,  256,  256,  256, -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       67, -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,  256,  256,\n      256,  256,  256,  256,  256,  256,  256,  256, -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       67, -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       67, -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,  257, -139,  258,  258,\n      258,  258,  258,  258,  258,  258,  258,  258, -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       67, -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,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259, -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       67, -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,  260, -141,  261,  261,\n      261,  261,  261,  261,  261,  261,  261,  261, -141, -141,\n     -141, -141, -141, -141, -141, -141, -141, -141,  262,  262,\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      262,  262, -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       67, -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, -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       67,  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,  264,\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       67,  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,  267,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  268,  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\n    },\n\n    {\n       67, -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, -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       67,  269,  269,  269,  269,  269,  269,  269,  269,  269,\n      270,  269,  269,  269,  269,  269,  269,  269,  269,  269,\n\n      269,  269,  269,  269,  269,  269,  269,  269,  269,  269,\n      269,  269,  271,  269,  269,  269,  269,  269,  269,  269,\n      269,  269,  269,  269,  269,  269,  269,  272,  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\n      269,  269,  269,  269,  269,  269,  269,  269\n    },\n\n    {\n       67,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      274,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  275,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  276,  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\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\n    },\n\n    {\n       67,  277,  277,  277,  277,  277,  277,  277,  277,  277,\n      278,  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,  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\n    },\n\n    {\n       67, -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       67,  279,  279,  279,  279,  279,  279,  279,  279,  279,\n      280,  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\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       67, -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, -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       67,  281,  281,  281,  281,  281,  281,  281,  281,  281,\n      282,  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,  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       67, -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       67, -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,  283, -154, -154,\n     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,\n\n      284, -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       67, -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,  285, -155,\n     -155, -155, -155, -155, -155, -155, -155, -155,  286, -155,\n     -155, -155,  287,  288,  289,  290, -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       67, -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,  291, -156, -156,  292, -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       67, -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       67, -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       67, -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,  293,\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       67, -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,  294, -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\n    },\n\n    {\n       67, -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,  295, -161,\n\n     -161, -161, -161, -161, -161, -161, -161, -161, -161,  296,\n      297, -161, -161, -161, -161, -161,  298, -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       67, -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,  299,\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       67, -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,  300,\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       67, -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,  301, -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       67, -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,  302, -165,  303, -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       67, -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,  304, -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       67, -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,  305, -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       67, -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,  306,\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       67, -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,  307, -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       67, -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,  308, -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       67, -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,  309, -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       67, -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,  310, -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       67, -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,  311, -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\n     -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,\n     -173, -173, -173, -173, -173, -173, -173, -173\n    },\n\n    {\n       67, -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, -174, -174, -174, -174, -174, -174, -174, -174, -174,\n     -174, -174, -174, -174, -174, -174, -174, -174\n    },\n\n    {\n       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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,  315, -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     -180, -180, -180, -180, -180, -180, -180, -180\n    },\n\n    {\n       67, -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,  316, -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, -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       67, -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,  317, -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       67, -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,  318,\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       67, -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, -184, -184, -184,\n\n     -184, -184,  319, -184, -184, -184, -184, -184, -184,  320,\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       67, -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,  321, -185,\n     -185, -185, -185, -185, -185, -185, -185, -185,  322, -185,\n     -185, -185,  323,  324,  325,  326, -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       67, -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,  327, -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       67, -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,  328, -187, -187,\n     -187, -187, -187, -187, -187, -187, -187, -187, -187, -187,\n     -187, -187, -187,  329, -187, -187,  330, -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       67, -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       67, -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       67, -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,  331, -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       67, -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,  332, -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       67, -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,  333, -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       67, -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,  334,\n     -193, -193, -193, -193, -193, -193, -193, -193, -193,  335,\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       67, -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,  336, -194, -194, -194, -194,\n     -194, -194, -194, -194, -194, -194, -194, -194, -194, -194,\n\n     -194, -194, -194,  337, -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       67, -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,  338,\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       67, -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,  339, -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       67, -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,  340, -197, -197, -197, -197, -197, -197, -197,\n     -197, -197, -197, -197, -197, -197, -197, -197,  341,  342,\n      342,  342,  342,  342,  342,  342,  342,  342, -197, -197,\n     -197, -197, -197, -197, -197,  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, -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       67, -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,  343, -198, -198, -198, -198, -198, -198, -198,\n     -198, -198, -198, -198, -198, -198, -198, -198,  341,  341,\n      341,  341,  341,  341,  341,  341,  341,  341, -198, -198,\n\n     -198, -198, -198, -198, -198,  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, -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       67, -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,  344, -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       67, -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,  345, -200, -200, -200, -200, -200, -200, -200,\n     -200, -200, -200, -200, -200, -200, -200, -200,  341,  341,\n      341,  341,  341,  341,  341,  341,  341,  341, -200, -200,\n     -200, -200, -200, -200, -200,  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, -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       67, -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,  346, -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, -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       67, -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,  347, -202, -202, -202, -202, -202, -202, -202,\n\n     -202, -202, -202, -202, -202, -202, -202, -202,  348,  348,\n      348,  348,  348,  348,  348,  348,  348,  348, -202, -202,\n     -202, -202, -202, -202, -202,  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, -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       67, -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,  349, -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\n     -203, -203, -203, -203, -203, -203, -203, -203, -203, -203,\n     -203, -203, -203, -203, -203, -203, -203, -203\n    },\n\n    {\n       67, -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,  350, -204, -204, -204, -204, -204, -204, -204,\n     -204, -204, -204, -204, -204, -204, -204, -204,  351,  351,\n      351,  351,  351,  351,  351,  351,  351,  351, -204, -204,\n     -204, -204, -204, -204, -204,  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, -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       67, -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,  353, -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       67, -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,  354, -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, -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       67, -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,  355, -207, -207, -207, -207, -207, -207, -207,\n     -207, -207, -207, -207, -207, -207, -207, -207,  356,  356,\n      356,  356,  356,  356,  356,  356,  356,  356, -207, -207,\n     -207, -207, -207, -207, -207,  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, -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       67, -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       67, -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,  359,  359,\n      359,  359,  359,  359,  359,  359,  359,  359, -209, -209,\n     -209, -209, -209, -209, -209,  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, -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       67, -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,  361, -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       67, -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,  362,  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, -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       67, -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,  363, -212, -212,  364,  365,\n      365,  365,  365,  365,  365,  365,  365,  365, -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,  366, -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       67, -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,  363, -213, -213,  367,  367,\n      367,  367,  367,  367,  367,  367,  367,  367, -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,  368, -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       67, -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,  369,  369,\n      369,  369,  369,  369,  369,  369,  369,  369, -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       67, -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,  363, -215, -215,  370,  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,  371, -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       67, -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,  372,  373,\n      373,  373,  373,  373,  373,  373,  373,  373, -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       67, -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,  374, -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     -217, -217, -217, -217, -217, -217, -217, -217, -217, -217,\n     -217, -217, -217, -217, -217, -217, -217, -217\n    },\n\n    {\n       67, -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,  375, -218, -218, -218, -218, -218, -218, -218,\n     -218, -218, -218, -218, -218, -218, -218, -218,  376,  376,\n      376,  376,  376,  376,  376,  376,  376,  376, -218, -218,\n\n     -218, -218, -218, -218, -218,  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, -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       67, -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,  377,  377,\n      377,  377,  377,  377,  377,  377,  377,  377, -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,  378, -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       67, -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,  379,\n      379,  379,  379,  379,  379,  379,  379,  379, -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       67, -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,  380,  380,\n      380,  380,  380,  380,  380,  380,  380,  380, -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,  381, -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       67, -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,  382,\n      382,  382,  382,  382,  382,  382,  382,  382, -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       67, -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,  383, -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       67, -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,  384, -224, -224, -224, -224, -224, -224, -224,\n     -224, -224, -224, -224, -224, -224, -224, -224,  385,  385,\n      385,  385,  385,  385,  385,  385,  385,  385, -224, -224,\n     -224, -224, -224, -224, -224,  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, -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       67, -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,  386, -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       67, -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,  387, -226, -226, -226, -226, -226, -226, -226,\n     -226, -226, -226, -226, -226, -226, -226, -226,  388,  388,\n      388,  388,  388,  388,  388,  388,  388,  388, -226, -226,\n     -226, -226, -226, -226, -226,  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, -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       67, -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,  390, -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       67, -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,  391, -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       67, -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,  392, -229, -229, -229, -229, -229, -229, -229,\n     -229, -229, -229, -229, -229, -229, -229, -229,  393,  393,\n      393,  393,  393,  393,  393,  393,  393,  393, -229, -229,\n     -229, -229, -229, -229, -229,  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, -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       67, -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,  395, -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       67, -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,  396,  396,\n      396,  396,  396,  396,  396,  396,  396,  396, -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       67, -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,  397, -232, -232,  398,  399,\n      399,  399,  399,  399,  399,  399,  399,  399, -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,  400, -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       67, -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,  397, -233, -233,  401,  401,\n      401,  401,  401,  401,  401,  401,  401,  401, -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,  402, -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       67, -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,  403,  403,\n      403,  403,  403,  403,  403,  403,  403,  403, -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       67, -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,  397, -235, -235,  404,  404,\n\n      404,  404,  404,  404,  404,  404,  404,  404, -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,  405, -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       67, -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,  406,  407,\n      407,  407,  407,  407,  407,  407,  407,  407, -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       67, -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,  408,  408,\n      408,  408,  408,  408,  408,  408,  408,  408, -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,  409, -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       67, -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,  410,  411,\n      411,  411,  411,  411,  411,  411,  411,  411, -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       67, -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,  412,  412,\n      412,  412,  412,  412,  412,  412,  412,  412, -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,  413, -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       67, -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,  414,  415,\n      415,  415,  415,  415,  415,  415,  415,  415, -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       67, -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,  416,  416,\n      416,  416,  416,  416,  416,  416,  416,  416, -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,  417, -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       67, -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,  418,  419,\n      419,  419,  419,  419,  419,  419,  419,  419, -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       67, -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,  420,  420,\n      420,  420,  420,  420,  420,  420,  420,  420, -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,  421, -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       67, -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,  422,  423,\n      423,  423,  423,  423,  423,  423,  423,  423, -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       67, -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,  424, -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       67, -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,  425, -246, -246, -246, -246, -246, -246, -246,\n     -246, -246, -246, -246, -246, -246, -246, -246,  426,  426,\n      426,  426,  426,  426,  426,  426,  426,  426, -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       67, -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,  427, -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, -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       67, -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,  428, -248, -248, -248, -248, -248, -248, -248,\n     -248, -248, -248, -248, -248, -248, -248, -248,  429,  429,\n      429,  429,  429,  429,  429,  429,  429,  429, -248, -248,\n\n     -248, -248, -248, -248, -248,  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, -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       67, -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,  430, -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, -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       67, -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,  431, -250, -250, -250, -250, -250, -250, -250,\n     -250, -250, -250, -250, -250, -250, -250, -250,  432,  432,\n      432,  432,  432,  432,  432,  432,  432,  432, -250, -250,\n     -250, -250, -250, -250, -250,  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, -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       67, -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,  433, -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       67, -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,  434, -252, -252, -252, -252, -252, -252, -252,\n\n     -252, -252, -252, -252, -252, -252, -252, -252,  435,  435,\n      435,  435,  435,  435,  435,  435,  435,  435, -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       67, -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,  436, -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       67, -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,  437, -254, -254, -254, -254, -254, -254, -254,\n     -254, -254, -254, -254, -254, -254, -254, -254,  438,  438,\n      438,  438,  438,  438,  438,  438,  438,  438, -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       67, -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, -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       67, -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       67, -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,  259,  259,\n      259,  259,  259,  259,  259,  259,  259,  259, -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       67, -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,  260, -258,  261,  261,\n      261,  261,  261,  261,  261,  261,  261,  261, -258, -258,\n\n     -258, -258, -258, -258, -258, -258, -258, -258,  262,  262,\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      262,  262, -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       67, -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,  262,  262,\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      262,  262, -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       67, -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,  439,  439,\n      439,  439,  439,  439,  439,  439,  439,  439, -260, -260,\n     -260, -260, -260, -260, -260, -260, -260, -260,  262,  262,\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      262,  262, -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       67, -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,  260, -261,  261,  261,\n      261,  261,  261,  261,  261,  261,  261,  261, -261, -261,\n     -261, -261, -261, -261, -261, -261, -261, -261,  262,  262,\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      262,  262, -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       67, -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,  440, -262,  440, -262, -262,  441,  441,\n      441,  441,  441,  441,  441,  441,  441,  441, -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, -262, -262, -262, -262, -262, -262, -262, -262, -262,\n     -262, -262, -262, -262, -262, -262, -262, -262\n    },\n\n    {\n       67,  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,  264,\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       67, -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,  263,\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       67,  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,  267,  265,  265,  265,  265,  265,  265,  265,\n      265,  265,  265,  265,  265,  265,  265,  268,  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       67, -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       67,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      266,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  267,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  442,  442,  442,  442,  442,  268,  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\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       67,  443,  443,  443,  443,  443,  443,  443,  443,  443,\n      444,  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,  446,  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,  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\n    },\n\n    {\n       67,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      448,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n\n      447,  447,  449,  447,  447,  447,  447,  447,  447,  447,\n      447,  447,  447,  447,  447,  447,  447,  450,  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,  447,  447,  447,  447,  447,  447\n\n    },\n\n    {\n       67, -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       67,  451,  451,  451,  451,  451,  451,  451,  451,  451,\n      452,  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,  454,  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       67,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      274,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  275,  273,  273,  273,  273,  273,  273,  273,\n\n      273,  273,  273,  273,  273,  273,  273,  276,  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\n    },\n\n    {\n       67,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n\n      274,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  275,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  276,  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\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273\n    },\n\n    {\n       67, -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       67,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      274,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  275,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  276,  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\n    },\n\n    {\n       67,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      274,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n\n      273,  273,  273,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  275,  273,  273,  273,  273,  273,  273,  273,\n      273,  273,  273,  273,  273,  273,  273,  276,  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\n      273,  273,  273,  273,  273,  273,  273,  273\n    },\n\n    {\n       67,  277,  277,  277,  277,  277,  277,  277,  277,  277,\n      278,  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,  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       67, -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       67,  279,  279,  279,  279,  279,  279,  279,  279,  279,\n      280,  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       67, -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       67,  281,  281,  281,  281,  281,  281,  281,  281,  281,\n      282,  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       67, -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     -282, -282, -282, -282, -282, -282, -282, -282, -282, -282,\n     -282, -282, -282, -282, -282, -282, -282, -282\n    },\n\n    {\n       67, -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,  455, -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     -283, -283, -283, -283, -283, -283, -283, -283, -283, -283,\n     -283, -283, -283, -283, -283, -283, -283, -283\n    },\n\n    {\n       67, -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,  456, -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       67, -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,  457,\n     -285, -285, -285, -285, -285, -285,  458, -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       67, -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,  459, -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       67, -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,  460, -287,\n     -287, -287, -287, -287, -287, -287, -287, -287, -287,  461,\n      462, -287, -287, -287, -287, -287,  463, -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       67, -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,  464,\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       67, -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,  465,\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       67, -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,  466, -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       67, -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, -291, -291, -291, -291,\n     -291, -291, -291, -291, -291, -291, -291, -291\n    },\n\n    {\n       67, -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, -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       67, -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,  467, -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       67, -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,  468, -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       67, -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,  469,\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       67, -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,  470, -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       67, -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, -297, -297, -297,\n     -297, -297, -297,  471, -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       67, -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,  472, -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       67, -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,  473,\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       67, -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      474, -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       67, -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, -301,\n\n     -301, -301, -301,  475, -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       67, -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,  476,\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       67, -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,  477, -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       67, -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     -304, -304, -304,  478, -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       67, -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,  479, -305, -305, -305, -305, -305, -305, -305,\n     -305, -305, -305, -305, -305, -305, -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, -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       67, -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,  480, -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       67, -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,  481, -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       67, -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      482, -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       67, -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      483, -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       67, -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,  484, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310,  485, -310, -310, -310, -310,\n     -310, -310, -310, -310, -310, -310, -310, -310, -310,  486,\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       67, -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,  487, -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       67, -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,  488, -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       67, -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,  489,\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       67, -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,  490, -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       67, -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,  491, -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       67, -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,  492, -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       67, -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,  493, -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       67, -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,  494, -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       67, -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,  495, -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\n\n    },\n\n    {\n       67, -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, -320, -320,\n     -320, -320, -320,  496, -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       67, -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,  497,\n\n     -321, -321, -321, -321, -321, -321,  498, -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       67, -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,  499, -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       67, -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,  500, -323,\n     -323, -323, -323, -323, -323, -323, -323, -323, -323,  501,\n      502, -323, -323, -323, -323, -323,  503, -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       67, -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,  504,\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       67, -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,  505,\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       67, -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,  506, -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       67, -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,  507,\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       67, -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       67, -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       67, -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       67, -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,  508, -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       67, -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,  509, -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       67, -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,  510, -333, -333, -333, -333,\n     -333, -333, -333, -333, -333, -333, -333, -333, -333,  511,\n     -333, -333,  512, -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       67, -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,  513, -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       67, -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,  514, -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       67, -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,  515, -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       67, -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,  516, -337, -337, -337, -337,\n     -337, -337, -337, -337, -337, -337, -337, -337,  517, -337,\n     -337, -337, -337, -337,  518, -337, -337, -337,  519, -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       67, -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,  520, -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       67, -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, -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       67, -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, -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       67, -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, -341, -341, -341, -341, -341, -341,\n     -341, -341, -341, -341, -341, -341, -341, -341\n    },\n\n    {\n       67, -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     -342, -342, -342, -342, -342, -342, -342, -342, -342, -342,\n     -342, -342, -342, -342, -342, -342, -342, -342\n    },\n\n    {\n       67, -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, -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       67, -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     -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,\n     -344, -344, -344, -344, -344, -344, -344, -344\n    },\n\n    {\n       67, -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, -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       67, -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,  521, -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       67, -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,  522, -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     -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       67, -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,  523, -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,  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, -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       67, -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       67, -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, -350, -350, -350, -350, -350, -350,\n     -350, -350, -350, -350, -350, -350, -350, -350\n    },\n\n    {\n       67, -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     -351, -351, -351, -351, -351, -351, -351, -351, -351, -351,\n     -351, -351, -351, -351, -351, -351, -351, -351\n    },\n\n    {\n       67, -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       67, -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       67, -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,  524, -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       67, -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,  525, -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       67, -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,  526, -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,  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, -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       67, -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       67, -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       67, -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, -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       67, -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       67, -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, -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       67, -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,  527, -362, -362, -362, -362, -362, -362, -362,\n\n     -362, -362, -362, -362, -362, -362, -362, -362,  528,  528,\n      528,  528,  528,  528,  528,  528,  528,  528, -362, -362,\n     -362, -362, -362, -362, -362,  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, -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       67, -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,  529,  529,\n      529,  529,  529,  529,  529,  529,  529,  529, -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       67, -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,  530, -364, -364,  531,  532,\n      532,  532,  532,  532,  532,  532,  532,  532, -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,  533, -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       67, -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,  530, -365, -365,  534,  534,\n\n      534,  534,  534,  534,  534,  534,  534,  534, -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,  535, -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       67, -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,  536,  536,\n      536,  536,  536,  536,  536,  536,  536,  536, -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       67, -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,  530, -367, -367,  531,  531,\n      531,  531,  531,  531,  531,  531,  531,  531, -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,  537, -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       67, -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,  538,  539,\n      539,  539,  539,  539,  539,  539,  539,  539, -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       67, -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,  540, -369, -369, -369, -369, -369, -369, -369,\n     -369, -369, -369, -369, -369, -369, -369, -369,  541,  541,\n      541,  541,  541,  541,  541,  541,  541,  541, -369, -369,\n     -369, -369, -369, -369, -369,  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, -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       67, -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,  530, -370, -370,  531,  531,\n      531,  531,  531,  531,  531,  531,  531,  531, -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,  533, -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       67, -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,  542,  543,\n      543,  543,  543,  543,  543,  543,  543,  543, -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       67, -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,  540, -372, -372, -372, -372, -372, -372, -372,\n\n     -372, -372, -372, -372, -372, -372, -372, -372,  544,  545,\n      545,  545,  545,  545,  545,  545,  545,  545, -372, -372,\n     -372, -372, -372, -372, -372,  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, -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       67, -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,  546, -373, -373, -373, -373, -373, -373, -373,\n     -373, -373, -373, -373, -373, -373, -373, -373,  547,  547,\n      547,  547,  547,  547,  547,  547,  547,  547, -373, -373,\n     -373, -373, -373, -373, -373,  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, -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       67, -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,  548, -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       67, -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,  549, -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       67, -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,  550, -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,  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, -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       67, -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,  551,  551,\n      551,  551,  551,  551,  551,  551,  551,  551, -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,  552, -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       67, -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,  553,\n      553,  553,  553,  553,  553,  553,  553,  553, -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       67, -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,  554, -379, -379, -379, -379, -379, -379, -379,\n     -379, -379, -379, -379, -379, -379, -379, -379,  555,  555,\n      555,  555,  555,  555,  555,  555,  555,  555, -379, -379,\n     -379, -379, -379, -379, -379,  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, -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       67, -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, -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,  556, -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       67, -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,  557,\n      557,  557,  557,  557,  557,  557,  557,  557, -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, -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\n    },\n\n    {\n       67, -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,  558, -382, -382, -382, -382, -382, -382, -382,\n\n     -382, -382, -382, -382, -382, -382, -382, -382,  559,  559,\n      559,  559,  559,  559,  559,  559,  559,  559, -382, -382,\n     -382, -382, -382, -382, -382,  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, -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       67, -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, -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       67, -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       67, -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, -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\n    },\n\n    {\n       67, -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, -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       67, -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       67, -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, -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\n    },\n\n    {\n       67, -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, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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,  560, -396, -396, -396, -396, -396, -396, -396,\n     -396, -396, -396, -396, -396, -396, -396, -396,  561,  561,\n      561,  561,  561,  561,  561,  561,  561,  561, -396, -396,\n     -396, -396, -396, -396, -396,  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, -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       67, -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,  562,  562,\n      562,  562,  562,  562,  562,  562,  562,  562, -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       67, -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,  563, -398, -398,  564,  565,\n      565,  565,  565,  565,  565,  565,  565,  565, -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,  566, -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       67, -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,  563, -399, -399,  567,  567,\n      567,  567,  567,  567,  567,  567,  567,  567, -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, -399, -399,\n     -399, -399, -399, -399, -399,  568, -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       67, -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,  569,  569,\n      569,  569,  569,  569,  569,  569,  569,  569, -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       67, -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,  563, -401, -401,  564,  564,\n      564,  564,  564,  564,  564,  564,  564,  564, -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,  570, -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       67, -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,  571,  572,\n      572,  572,  572,  572,  572,  572,  572,  572, -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       67, -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,  573, -403, -403, -403, -403, -403, -403, -403,\n     -403, -403, -403, -403, -403, -403, -403, -403,  574,  574,\n      574,  574,  574,  574,  574,  574,  574,  574, -403, -403,\n     -403, -403, -403, -403, -403,  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, -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       67, -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,  563, -404, -404,  564,  564,\n      564,  564,  564,  564,  564,  564,  564,  564, -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,  566, -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       67, -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,  575,  576,\n\n      576,  576,  576,  576,  576,  576,  576,  576, -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       67, -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,  577, -406, -406, -406, -406, -406, -406, -406,\n     -406, -406, -406, -406, -406, -406, -406, -406,  578,  579,\n      579,  579,  579,  579,  579,  579,  579,  579, -406, -406,\n     -406, -406, -406, -406, -406,  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, -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       67, -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,  577, -407, -407, -407, -407, -407, -407, -407,\n     -407, -407, -407, -407, -407, -407, -407, -407,  580,  580,\n      580,  580,  580,  580,  580,  580,  580,  580, -407, -407,\n     -407, -407, -407, -407, -407,  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, -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       67, -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,  581,  581,\n      581,  581,  581,  581,  581,  581,  581,  581, -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,  582, -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       67, -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,  583,  584,\n      584,  584,  584,  584,  584,  584,  584,  584, -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       67, -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,  585, -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,  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, -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       67, -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,  585, -411, -411, -411, -411, -411, -411, -411,\n     -411, -411, -411, -411, -411, -411, -411, -411,  586,  586,\n      586,  586,  586,  586,  586,  586,  586,  586, -411, -411,\n     -411, -411, -411, -411, -411,  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, -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       67, -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,  587, -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       67, -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,  588,  589,\n      589,  589,  589,  589,  589,  589,  589,  589, -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\n     -413, -413, -413, -413, -413, -413, -413, -413, -413, -413,\n     -413, -413, -413, -413, -413, -413, -413, -413\n    },\n\n    {\n       67, -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,  590, -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,  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, -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       67, -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,  590, -415, -415, -415, -415, -415, -415, -415,\n     -415, -415, -415, -415, -415, -415, -415, -415,  591,  591,\n\n      591,  591,  591,  591,  591,  591,  591,  591, -415, -415,\n     -415, -415, -415, -415, -415,  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, -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       67, -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,  592,  592,\n      592,  592,  592,  592,  592,  592,  592,  592, -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,  593, -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       67, -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,  594,  595,\n      595,  595,  595,  595,  595,  595,  595,  595, -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       67, -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,  596, -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,  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, -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       67, -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,  596, -419, -419, -419, -419, -419, -419, -419,\n     -419, -419, -419, -419, -419, -419, -419, -419,  597,  597,\n      597,  597,  597,  597,  597,  597,  597,  597, -419, -419,\n     -419, -419, -419, -419, -419,  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, -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       67, -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, -420, -420, -420, -420, -420, -420, -420, -420,\n     -420, -420, -420, -420, -420,  598, -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       67, -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,  599,  600,\n      600,  600,  600,  600,  600,  600,  600,  600, -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, -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\n    },\n\n    {\n       67, -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,  601, -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,  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, -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       67, -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,  601, -423, -423, -423, -423, -423, -423, -423,\n     -423, -423, -423, -423, -423, -423, -423, -423,  602,  602,\n      602,  602,  602,  602,  602,  602,  602,  602, -423, -423,\n     -423, -423, -423, -423, -423,  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, -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       67, -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, -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\n    },\n\n    {\n       67, -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, -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       67, -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, -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       67, -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,  603, -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\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       67, -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,  604, -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, -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\n    },\n\n    {\n       67, -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,  605, -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,  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, -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       67, -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, -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, -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       67, -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, -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       67, -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, -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       67, -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,  606, -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       67, -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,  607, -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       67, -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,  608, -435, -435, -435, -435, -435, -435, -435,\n     -435, -435, -435, -435, -435, -435, -435, -435,  609,  609,\n\n      609,  609,  609,  609,  609,  609,  609,  609, -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       67, -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       67, -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       67, -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       67, -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,  262,  262,\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      262,  262, -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       67, -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,  441,  441,\n      441,  441,  441,  441,  441,  441,  441,  441, -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       67, -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       67,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      610,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  611,  442,  442,  442,  442,  442,  442,  442,\n\n      442,  442,  442,  442,  442,  442,  442,  612,  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       67,  443,  443,  443,  443,  443,  443,  443,  443,  443,\n\n      444,  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,  446,  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       67, -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       67,  443,  443,  443,  443,  443,  443,  443,  443,  443,\n      444,  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,  446,  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\n    },\n\n    {\n       67,  443,  443,  443,  443,  443,  443,  443,  443,  443,\n      444,  443,  443,  443,  443,  443,  443,  443,  443,  443,\n\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,  446,  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\n    },\n\n    {\n       67,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      448,  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,  450,  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       67, -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, -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       67,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      448,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n\n      447,  447,  449,  447,  447,  447,  447,  447,  447,  447,\n      447,  447,  447,  447,  447,  447,  447,  450,  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,  447,  447,  447,  447,  447,  447\n\n    },\n\n    {\n       67,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      614,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  615,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  616,  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\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\n    },\n\n    {\n       67,  447,  447,  447,  447,  447,  447,  447,  447,  447,\n      448,  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,  450,  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,  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       67, -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, -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       67,  451,  451,  451,  451,  451,  451,  451,  451,  451,\n\n      452,  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,  454,  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,  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\n    },\n\n    {\n       67,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      618,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  619,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  620,  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,  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\n    },\n\n    {\n       67, -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, -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       67, -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     -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       67, -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, -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       67, -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, -458,  621, -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       67, -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,  622, -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       67, -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,  623,\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       67, -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, -461, -461,\n\n     -461, -461, -461, -461, -461, -461, -461, -461, -461, -461,\n     -461, -461, -461, -461,  624, -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       67, -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, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462, -462, -462,\n     -462, -462, -462, -462, -462, -462, -462, -462,  625, -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       67, -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,  626, -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       67, -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, -464,  627,\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       67, -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      628, -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       67, -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,  629, -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       67, -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, -467, -467,\n     -467, -467, -467, -467,  630, -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       67, -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,  631,\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       67, -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, -469,\n     -469, -469, -469, -469, -469, -469, -469, -469, -469, -469,\n     -469, -469,  632, -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       67, -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,  633, -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       67, -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,  634, -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       67, -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,  635, -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       67, -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, -473, -473, -473, -473, -473,\n     -473, -473, -473, -473, -473, -473, -473, -473, -473, -473,\n     -473, -473,  636, -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       67, -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,  637,\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       67, -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,  638, -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       67, -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,  639, -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       67, -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       67, -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,  640,\n      640,  640,  640,  640,  640,  640,  640,  640, -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       67, -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,  641, -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       67, -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     -480, -480, -480, -480, -480, -480, -480, -480, -480, -480,\n     -480, -480,  642, -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       67, -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,  643, -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       67, -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,  644,\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       67, -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,  645,\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       67, -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, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484,  646, -484, -484, -484, -484,\n     -484, -484, -484, -484, -484, -484, -484, -484, -484,  647,\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       67, -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\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       67, -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, -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,  648, -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       67, -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,  649,\n     -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,\n     -487, -487, -487, -487, -487, -487, -487, -487,  650,  651,\n\n      652, -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       67, -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      653, -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       67, -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,  654, -489, -489,\n     -489, -489, -489, -489, -489, -489, -489, -489, -489, -489,\n     -489, -489, -489,  655, -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       67, -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, -490, -490,\n      656, -490, -490, -490, -490, -490, -490, -490, -490, -490,\n     -490, -490, -490, -490, -490, -490, -490,  657, -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       67, -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, -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       67, -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       67, -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, -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       67, -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, -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,  658, -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       67, -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       67, -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, -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,  659,\n     -496, -496, -496,  660, -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       67, -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, -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       67, -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,  661, -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       67, -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, -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,  662, -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       67, -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     -500, -500, -500, -500, -500, -500, -500, -500, -500,  663,\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       67, -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\n     -501, -501, -501, -501, -501, -501, -501, -501, -501, -501,\n     -501, -501, -501, -501,  664, -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       67, -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,  665, -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       67, -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, -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,  666, -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       67, -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, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504, -504,\n     -504, -504, -504, -504, -504, -504, -504, -504, -504,  667,\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       67, -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, -505, -505,\n      668, -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       67, -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,  669, -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       67, -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     -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,  670, -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       67, -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\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       67, -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       67, -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,  671, -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       67, -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,  672, -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       67, -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,  673,\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       67, -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,  674,\n      674,  674,  674,  674,  674,  674,  674,  674, -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,  675, -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       67, -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, -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       67, -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,  676,\n\n      676,  676,  676,  676,  676,  676,  676,  676, -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       67, -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, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516, -516, -516,\n     -516, -516, -516, -516, -516, -516, -516, -516,  677, -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       67, -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,  678, -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       67, -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,  679,\n      679,  679,  679,  679,  679,  679,  679,  679, -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       67, -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,  680,\n      680,  680,  680,  680,  680,  680,  680,  680, -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       67, -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, -520,\n     -520, -520, -520, -520, -520, -520, -520, -520, -520, -520,\n     -520, -520,  681, -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       67, -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     -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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,  682, -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       67, -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,  683, -528, -528, -528, -528, -528, -528, -528,\n     -528, -528, -528, -528, -528, -528, -528, -528,  684,  684,\n      684,  684,  684,  684,  684,  684,  684,  684, -528, -528,\n\n     -528, -528, -528, -528, -528,  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, -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       67, -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,  685, -529, -529, -529, -529, -529, -529, -529,\n     -529, -529, -529, -529, -529, -529, -529, -529,  686,  686,\n      686,  686,  686,  686,  686,  686,  686,  686, -529, -529,\n     -529, -529, -529, -529, -529,  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, -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       67, -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,  687,  687,\n      687,  687,  687,  687,  687,  687,  687,  687, -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       67, -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,  688, -531, -531,  689,  689,\n      689,  689,  689,  689,  689,  689,  689,  689, -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,  690, -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       67, -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,  688, -532, -532,  689,  689,\n      689,  689,  689,  689,  689,  689,  689,  689, -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,  691, -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       67, -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,  692,  692,\n      692,  692,  692,  692,  692,  692,  692,  692, -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       67, -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,  688, -534, -534,  689,  689,\n      689,  689,  689,  689,  689,  689,  689,  689, -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,  693, -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       67, -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,  694,  695,\n\n      695,  695,  695,  695,  695,  695,  695,  695, -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       67, -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,  696, -536, -536, -536, -536, -536, -536, -536,\n     -536, -536, -536, -536, -536, -536, -536, -536,  697,  697,\n      697,  697,  697,  697,  697,  697,  697,  697, -536, -536,\n     -536, -536, -536, -536, -536,  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      696, -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       67, -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,  698,  699,\n      699,  699,  699,  699,  699,  699,  699,  699, -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       67, -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,  696, -538, -538, -538, -538, -538, -538, -538,\n     -538, -538, -538, -538, -538, -538, -538, -538,  700,  701,\n      701,  701,  701,  701,  701,  701,  701,  701, -538, -538,\n\n     -538, -538, -538, -538, -538,  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      696, -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       67, -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,  702, -539, -539, -539, -539, -539, -539, -539,\n     -539, -539, -539, -539, -539, -539, -539, -539,  703,  703,\n      703,  703,  703,  703,  703,  703,  703,  703, -539, -539,\n     -539, -539, -539, -539, -539,  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, -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       67, -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,  704, -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       67, -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,  705, -541, -541, -541, -541, -541, -541, -541,\n     -541, -541, -541, -541, -541, -541, -541, -541,  706,  706,\n      706,  706,  706,  706,  706,  706,  706,  706, -541, -541,\n     -541, -541, -541, -541, -541,  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, -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       67, -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,  696, -542, -542, -542, -542, -542, -542, -542,\n\n     -542, -542, -542, -542, -542, -542, -542, -542,  707,  708,\n      708,  708,  708,  708,  708,  708,  708,  708, -542, -542,\n     -542, -542, -542, -542, -542,  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      696, -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       67, -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,  709, -543, -543, -543, -543, -543, -543, -543,\n     -543, -543, -543, -543, -543, -543, -543, -543,  710,  710,\n      710,  710,  710,  710,  710,  710,  710,  710, -543, -543,\n     -543, -543, -543, -543, -543,  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, -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       67, -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,  705, -544, -544, -544, -544, -544, -544, -544,\n     -544, -544, -544, -544, -544, -544, -544, -544,  711,  712,\n      712,  712,  712,  712,  712,  712,  712,  712, -544, -544,\n     -544, -544, -544, -544, -544,  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, -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       67, -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,  713, -545, -545, -545, -545, -545, -545, -545,\n     -545, -545, -545, -545, -545, -545, -545, -545,  714,  714,\n\n      714,  714,  714,  714,  714,  714,  714,  714, -545, -545,\n     -545, -545, -545, -545, -545,  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, -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       67, -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,  715, -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       67, -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,  716, -547, -547, -547, -547, -547, -547, -547,\n     -547, -547, -547, -547, -547, -547, -547, -547,  706,  706,\n      706,  706,  706,  706,  706,  706,  706,  706, -547, -547,\n     -547, -547, -547, -547, -547,  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, -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       67, -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     -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       67, -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       67, -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       67, -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, -551,\n     -551, -551, -551, -551, -551, -551, -551, -551, -551, -551,\n     -551, -551, -551, -551, -551,  717, -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       67, -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,  718,\n      718,  718,  718,  718,  718,  718,  718,  718, -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, -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       67, -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,  719, -553, -553, -553, -553, -553, -553, -553,\n     -553, -553, -553, -553, -553, -553, -553, -553,  720,  720,\n      720,  720,  720,  720,  720,  720,  720,  720, -553, -553,\n     -553, -553, -553, -553, -553,  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, -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       67, -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,  721, -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\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       67, -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,  722, -555, -555, -555, -555, -555, -555, -555,\n     -555, -555, -555, -555, -555, -555, -555, -555,  723,  723,\n\n      723,  723,  723,  723,  723,  723,  723,  723, -555, -555,\n     -555, -555, -555, -555, -555,  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, -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       67, -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,  724,\n      724,  724,  724,  724,  724,  724,  724,  724, -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       67, -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,  725, -557, -557, -557, -557, -557, -557, -557,\n     -557, -557, -557, -557, -557, -557, -557, -557,  726,  726,\n      726,  726,  726,  726,  726,  726,  726,  726, -557, -557,\n     -557, -557, -557, -557, -557,  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, -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       67, -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,  727, -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       67, -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,  728, -559, -559, -559, -559, -559, -559, -559,\n     -559, -559, -559, -559, -559, -559, -559, -559,  729,  729,\n      729,  729,  729,  729,  729,  729,  729,  729, -559, -559,\n     -559, -559, -559, -559, -559,  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, -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       67, -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,  730, -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       67, -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,  731, -561, -561, -561, -561, -561, -561, -561,\n     -561, -561, -561, -561, -561, -561, -561, -561,  732,  732,\n      732,  732,  732,  732,  732,  732,  732,  732, -561, -561,\n     -561, -561, -561, -561, -561,  731,  731,  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, -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       67, -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,  733, -562, -562, -562, -562, -562, -562, -562,\n\n     -562, -562, -562, -562, -562, -562, -562, -562,  734,  734,\n      734,  734,  734,  734,  734,  734,  734,  734, -562, -562,\n     -562, -562, -562, -562, -562,  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, -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       67, -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,  735,  735,\n      735,  735,  735,  735,  735,  735,  735,  735, -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       67, -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,  736, -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,  737, -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       67, -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,  736, -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,  738, -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       67, -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,  739,  739,\n      739,  739,  739,  739,  739,  739,  739,  739, -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       67, -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,  736, -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,  740, -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       67, -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,  741,  742,\n      742,  742,  742,  742,  742,  742,  742,  742, -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       67, -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,  743, -569, -569, -569, -569, -569, -569, -569,\n     -569, -569, -569, -569, -569, -569, -569, -569,  744,  744,\n      744,  744,  744,  744,  744,  744,  744,  744, -569, -569,\n     -569, -569, -569, -569, -569,  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, -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       67, -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,  745,  746,\n      746,  746,  746,  746,  746,  746,  746,  746, -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       67, -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,  747, -571, -571, -571, -571, -571, -571, -571,\n     -571, -571, -571, -571, -571, -571, -571, -571,  748,  749,\n      749,  749,  749,  749,  749,  749,  749,  749, -571, -571,\n     -571, -571, -571, -571, -571,  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, -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       67, -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,  747, -572, -572, -572, -572, -572, -572, -572,\n\n     -572, -572, -572, -572, -572, -572, -572, -572,  750,  750,\n      750,  750,  750,  750,  750,  750,  750,  750, -572, -572,\n     -572, -572, -572, -572, -572,  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, -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       67, -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,  751, -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       67, -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,  752, -574, -574, -574, -574, -574, -574, -574,\n     -574, -574, -574, -574, -574, -574, -574, -574,  753,  753,\n      753,  753,  753,  753,  753,  753,  753,  753, -574, -574,\n     -574, -574, -574, -574, -574,  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, -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       67, -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,  754, -575, -575, -575, -575, -575, -575, -575,\n     -575, -575, -575, -575, -575, -575, -575, -575,  755,  756,\n\n      756,  756,  756,  756,  756,  756,  756,  756, -575, -575,\n     -575, -575, -575, -575, -575,  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, -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       67, -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,  754, -576, -576, -576, -576, -576, -576, -576,\n     -576, -576, -576, -576, -576, -576, -576, -576,  757,  757,\n      757,  757,  757,  757,  757,  757,  757,  757, -576, -576,\n     -576, -576, -576, -576, -576,  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, -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       67, -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,  758, -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       67, -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,  759, -578, -578, -578, -578, -578, -578, -578,\n     -578, -578, -578, -578, -578, -578, -578, -578,  760,  761,\n      761,  761,  761,  761,  761,  761,  761,  761, -578, -578,\n\n     -578, -578, -578, -578, -578,  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, -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       67, -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,  759, -579, -579, -579, -579, -579, -579, -579,\n     -579, -579, -579, -579, -579, -579, -579, -579,  762,  762,\n      762,  762,  762,  762,  762,  762,  762,  762, -579, -579,\n     -579, -579, -579, -579, -579,  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, -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       67, -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,  763, -580, -580, -580, -580, -580, -580, -580,\n     -580, -580, -580, -580, -580, -580, -580, -580,  753,  753,\n      753,  753,  753,  753,  753,  753,  753,  753, -580, -580,\n     -580, -580, -580, -580, -580,  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, -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       67, -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, -581,\n     -581, -581, -581, -581, -581, -581, -581, -581, -581, -581,\n     -581, -581, -581, -581, -581,  764, -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       67, -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,  765,  766,\n      766,  766,  766,  766,  766,  766,  766,  766, -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, -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       67, -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,  767, -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,  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, -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       67, -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,  767, -584, -584, -584, -584, -584, -584, -584,\n     -584, -584, -584, -584, -584, -584, -584, -584,  768,  768,\n      768,  768,  768,  768,  768,  768,  768,  768, -584, -584,\n     -584, -584, -584, -584, -584,  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, -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       67, -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,  769, -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, -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       67, -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,  770, -586, -586, -586, -586, -586, -586, -586,\n     -586, -586, -586, -586, -586, -586, -586, -586,  771,  771,\n      771,  771,  771,  771,  771,  771,  771,  771, -586, -586,\n     -586, -586, -586, -586, -586,  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, -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       67, -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,  772,  772,\n      772,  772,  772,  772,  772,  772,  772,  772, -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\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       67, -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,  773, -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,  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, -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       67, -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,  773, -589, -589, -589, -589, -589, -589, -589,\n     -589, -589, -589, -589, -589, -589, -589, -589,  774,  774,\n      774,  774,  774,  774,  774,  774,  774,  774, -589, -589,\n     -589, -589, -589, -589, -589,  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, -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       67, -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,  775, -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\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       67, -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,  776, -591, -591, -591, -591, -591, -591, -591,\n     -591, -591, -591, -591, -591, -591, -591, -591,  777,  777,\n      777,  777,  777,  777,  777,  777,  777,  777, -591, -591,\n     -591, -591, -591, -591, -591,  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, -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       67, -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,  778, -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       67, -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,  779,  780,\n      780,  780,  780,  780,  780,  780,  780,  780, -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       67, -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,  781, -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,  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, -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       67, -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,  781, -595, -595, -595, -595, -595, -595, -595,\n     -595, -595, -595, -595, -595, -595, -595, -595,  782,  782,\n\n      782,  782,  782,  782,  782,  782,  782,  782, -595, -595,\n     -595, -595, -595, -595, -595,  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, -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       67, -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,  783, -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, -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       67, -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,  784, -597, -597, -597, -597, -597, -597, -597,\n     -597, -597, -597, -597, -597, -597, -597, -597,  785,  785,\n      785,  785,  785,  785,  785,  785,  785,  785, -597, -597,\n     -597, -597, -597, -597, -597,  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, -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       67, -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,  786,  786,\n      786,  786,  786,  786,  786,  786,  786,  786, -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       67, -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,  787, -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,  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, -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       67, -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,  787, -600, -600, -600, -600, -600, -600, -600,\n     -600, -600, -600, -600, -600, -600, -600, -600,  788,  788,\n      788,  788,  788,  788,  788,  788,  788,  788, -600, -600,\n     -600, -600, -600, -600, -600,  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, -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       67, -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,  789, -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       67, -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,  790, -602, -602, -602, -602, -602, -602, -602,\n\n     -602, -602, -602, -602, -602, -602, -602, -602,  791,  791,\n      791,  791,  791,  791,  791,  791,  791,  791, -602, -602,\n     -602, -602, -602, -602, -602,  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, -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       67, -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, -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       67, -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, -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       67, -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, -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\n    },\n\n    {\n       67, -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       67, -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       67, -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       67, -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       67, -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       67,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      610,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  611,  442,  442,  442,  442,  442,  442,  442,\n      442,  442,  442,  442,  442,  442,  442,  612,  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\n    },\n\n    {\n       67,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      793,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  794,  792,  792,  792,  792,  792,  792,  792,\n\n      792,  792,  792,  792,  792,  792,  792,  795,  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,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792\n    },\n\n    {\n       67,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n\n      614,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  615,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  616,  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      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       67, -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, -614, -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       67,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      614,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  615,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  616,  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      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  613\n    },\n\n    {\n       67,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      614,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n\n      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  615,  613,  613,  613,  613,  613,  613,  613,\n      613,  613,  613,  613,  613,  613,  613,  616,  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      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\n    },\n\n    {\n       67,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      618,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  619,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  620,  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\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       67, -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, -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       67,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      618,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n\n      617,  617,  619,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  620,  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,  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    {\n       67,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      618,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  619,  617,  617,  617,  617,  617,  617,  617,\n      617,  617,  617,  617,  617,  617,  617,  620,  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\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       67, -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, -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\n    },\n\n    {\n       67, -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, -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       67, -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, -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\n     -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,\n     -623, -623, -623, -623, -623, -623, -623, -623\n    },\n\n    {\n       67, -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, -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\n    },\n\n    {\n       67, -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     -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       67, -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, -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     -626, -626, -626, -626, -626, -626, -626, -626, -626, -626,\n\n     -626, -626, -626, -626, -626, -626, -626, -626\n    },\n\n    {\n       67, -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, -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, -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       67, -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, -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     -628, -628, -628, -628, -628, -628, -628, -628\n    },\n\n    {\n       67, -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, -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, -629, -629,\n     -629, -629, -629, -629, -629, -629, -629, -629\n\n    },\n\n    {\n       67, -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, -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\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       67, -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, -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       67, -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, -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, -632, -632,\n     -632, -632, -632, -632, -632, -632, -632, -632\n    },\n\n    {\n       67, -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       67, -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       67, -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       67, -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, -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       67, -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     -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       67, -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, -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\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, -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, -638, -638,\n     -638, -638, -638, -638, -638, -638, -638, -638\n    },\n\n    {\n       67, -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, -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,  796, -639, -639, -639, -639,\n     -639, -639, -639, -639, -639, -639, -639, -639, -639,  797,\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       67, -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,  798, -640, -640, -640, -640, -640, -640, -640,\n     -640, -640, -640, -640, -640, -640, -640, -640,  799,  799,\n      799,  799,  799,  799,  799,  799,  799,  799, -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       67, -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,  800, -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       67, -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,  801, -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,  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, -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       67, -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, -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,  802,\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       67, -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, -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,  803, -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       67, -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\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,  804, -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       67, -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, -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,  805, -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       67, -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     -647, -647, -647, -647, -647, -647, -647, -647, -647, -647,\n     -647, -647, -647, -647, -647, -647,  806, -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       67, -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\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       67, -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, -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,  807,\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       67, -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, -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, -650, -650, -650, -650, -650,\n     -650, -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       67, -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, -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       67, -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, -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, -652, -652,\n     -652, -652, -652, -652, -652, -652, -652, -652\n    },\n\n    {\n       67, -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, -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     -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       67, -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, -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\n     -654, -654, -654,  808, -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       67, -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\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,  809,\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       67, -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, -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,  810, -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       67, -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, -657, -657,\n     -657, -657, -657, -657, -657, -657, -657, -657, -657, -657,\n     -657, -657, -657, -657, -657,  811, -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       67, -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\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,  812,\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       67, -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, -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,  813, -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, -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       67, -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     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660, -660, -660, -660, -660, -660, -660, -660, -660,\n     -660, -660,  814, -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       67, -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, -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, -661, -661,\n\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, -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       67, -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\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       67, -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, -663, -663, -663, -663, -663, -663, -663, -663,\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, -663, -663, -663, -663, -663, -663, -663, -663,\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, -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       67, -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, -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, -664, -664,\n     -664, -664, -664, -664, -664, -664, -664, -664, -664, -664,\n\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, -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       67, -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, -665, -665,\n     -665, -665, -665, -665, -665, -665, -665, -665, -665, -665,\n\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, -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, -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       67, -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, -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       67, -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, -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, -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       67, -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\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       67, -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, -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, -669, -669,\n     -669, -669, -669, -669, -669, -669, -669, -669\n\n    },\n\n    {\n       67, -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     -670, -670, -670, -670, -670, -670, -670, -670,  815, -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       67, -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, -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, -671, -671,\n\n     -671,  816, -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, -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       67, -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, -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,  817,\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       67, -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, -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      818, -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       67, -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,  819, -674, -674, -674, -674, -674, -674, -674,\n     -674, -674, -674, -674, -674, -674, -674, -674,  820,  820,\n      820,  820,  820,  820,  820,  820,  820,  820, -674, -674,\n     -674, -674, -674, -674, -674,  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, -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       67, -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\n     -675, -675, -675, -675, -675, -675, -675, -675, -675, -675,\n     -675, -675, -675, -675, -675, -675, -675,  821, -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       67, -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,  822, -676, -676, -676, -676, -676, -676, -676,\n     -676, -676, -676, -676, -676, -676, -676, -676,  823,  823,\n      823,  823,  823,  823,  823,  823,  823,  823, -676, -676,\n     -676, -676, -676, -676, -676,  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, -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       67, -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,  824,\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       67, -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\n     -678, -678, -678, -678, -678, -678, -678, -678, -678, -678,\n     -678, -678, -678, -678, -678, -678, -678,  825, -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       67, -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,  826, -679, -679, -679, -679, -679, -679, -679,\n     -679, -679, -679, -679, -679, -679, -679, -679,  827,  827,\n      827,  827,  827,  827,  827,  827,  827,  827, -679, -679,\n     -679, -679, -679, -679, -679,  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, -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       67, -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,  828, -680, -680, -680, -680, -680, -680, -680,\n     -680, -680, -680, -680, -680, -680, -680, -680,  829,  829,\n      829,  829,  829,  829,  829,  829,  829,  829, -680, -680,\n     -680, -680, -680, -680, -680,  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, -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       67, -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, -681, -681,\n     -681, -681, -681, -681, -681, -681, -681,  830, -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       67, -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,  831, -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       67, -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,  832, -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     -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       67, -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,  833, -684, -684, -684, -684, -684, -684, -684,\n     -684, -684, -684, -684, -684, -684, -684, -684,  834,  834,\n      834,  834,  834,  834,  834,  834,  834,  834, -684, -684,\n     -684, -684, -684, -684, -684,  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, -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       67, -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,  835, -685, -685, -685, -685, -685, -685, -685,\n     -685, -685, -685, -685, -685, -685, -685, -685, -685, -685,\n\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, -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, -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       67, -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,  836, -686, -686, -686, -686, -686, -686, -686,\n     -686, -686, -686, -686, -686, -686, -686, -686,  837,  837,\n      837,  837,  837,  837,  837,  837,  837,  837, -686, -686,\n     -686, -686, -686, -686, -686,  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, -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       67, -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,  838, -687, -687, -687, -687, -687, -687, -687,\n     -687, -687, -687, -687, -687, -687, -687, -687,  839,  839,\n      839,  839,  839,  839,  839,  839,  839,  839, -687, -687,\n     -687, -687, -687, -687, -687,  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, -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       67, -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,  840,  840,\n      840,  840,  840,  840,  840,  840,  840,  840, -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       67, -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,  841,  841,\n      841,  841,  841,  841,  841,  841,  841,  841, -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       67, -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,  842,  842,\n      842,  842,  842,  842,  842,  842,  842,  842, -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       67, -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,  842,  843,\n      843,  843,  843,  843,  843,  843,  843,  843, -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       67, -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,  844, -692, -692, -692, -692, -692, -692, -692,\n\n     -692, -692, -692, -692, -692, -692, -692, -692,  845,  845,\n      845,  845,  845,  845,  845,  845,  845,  845, -692, -692,\n     -692, -692, -692, -692, -692,  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, -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       67, -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,  842,  846,\n      846,  846,  846,  846,  846,  846,  846,  846, -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       67, -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,  844, -694, -694, -694, -694, -694, -694, -694,\n     -694, -694, -694, -694, -694, -694, -694, -694,  845,  847,\n      847,  847,  847,  847,  847,  847,  847,  847, -694, -694,\n     -694, -694, -694, -694, -694,  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, -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       67, -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,  848, -695, -695, -695, -695, -695, -695, -695,\n     -695, -695, -695, -695, -695, -695, -695, -695,  849,  849,\n\n      849,  849,  849,  849,  849,  849,  849,  849, -695, -695,\n     -695, -695, -695, -695, -695,  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, -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       67, -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,  850, -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     -696, -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     -696, -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       67, -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,  851, -697, -697, -697, -697, -697, -697, -697,\n     -697, -697, -697, -697, -697, -697, -697, -697,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852, -697, -697,\n     -697, -697, -697, -697, -697,  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, -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       67, -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,  844, -698, -698, -698, -698, -698, -698, -698,\n     -698, -698, -698, -698, -698, -698, -698, -698,  845,  853,\n      853,  853,  853,  853,  853,  853,  853,  853, -698, -698,\n\n     -698, -698, -698, -698, -698,  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, -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       67, -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,  854, -699, -699, -699, -699, -699, -699, -699,\n     -699, -699, -699, -699, -699, -699, -699, -699,  855,  855,\n      855,  855,  855,  855,  855,  855,  855,  855, -699, -699,\n     -699, -699, -699, -699, -699,  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, -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       67, -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,  851, -700, -700, -700, -700, -700, -700, -700,\n     -700, -700, -700, -700, -700, -700, -700, -700,  852,  856,\n      856,  856,  856,  856,  856,  856,  856,  856, -700, -700,\n     -700, -700, -700, -700, -700,  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, -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       67, -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,  857, -701, -701, -701, -701, -701, -701, -701,\n     -701, -701, -701, -701, -701, -701, -701, -701,  858,  858,\n      858,  858,  858,  858,  858,  858,  858,  858, -701, -701,\n     -701, -701, -701, -701, -701,  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, -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       67, -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,  859, -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       67, -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,  860, -703, -703, -703, -703, -703, -703, -703,\n     -703, -703, -703, -703, -703, -703, -703, -703,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852, -703, -703,\n     -703, -703, -703, -703, -703,  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, -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       67, -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,  861, -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, -704, -704,\n     -704, -704, -704, -704, -704, -704, -704, -704, -704, -704,\n\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, -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       67, -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,  862, -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       67, -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,  863, -706, -706, -706, -706, -706, -706, -706,\n     -706, -706, -706, -706, -706, -706, -706, -706,  864,  864,\n      864,  864,  864,  864,  864,  864,  864,  864, -706, -706,\n     -706, -706, -706, -706, -706,  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, -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       67, -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,  851, -707, -707, -707, -707, -707, -707, -707,\n     -707, -707, -707, -707, -707, -707, -707, -707,  852,  865,\n      865,  865,  865,  865,  865,  865,  865,  865, -707, -707,\n     -707, -707, -707, -707, -707,  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, -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       67, -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,  866, -708, -708, -708, -708, -708, -708, -708,\n     -708, -708, -708, -708, -708, -708, -708, -708,  867,  867,\n      867,  867,  867,  867,  867,  867,  867,  867, -708, -708,\n\n     -708, -708, -708, -708, -708,  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, -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       67, -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,  868, -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       67, -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,  869, -710, -710, -710, -710, -710, -710, -710,\n     -710, -710, -710, -710, -710, -710, -710, -710,  852,  852,\n      852,  852,  852,  852,  852,  852,  852,  852, -710, -710,\n     -710, -710, -710, -710, -710,  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, -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       67, -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,  863, -711, -711, -711, -711, -711, -711, -711,\n     -711, -711, -711, -711, -711, -711, -711, -711,  864,  870,\n      870,  870,  870,  870,  870,  870,  870,  870, -711, -711,\n     -711, -711, -711, -711, -711,  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, -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       67, -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,  871, -712, -712, -712, -712, -712, -712, -712,\n\n     -712, -712, -712, -712, -712, -712, -712, -712,  872,  872,\n      872,  872,  872,  872,  872,  872,  872,  872, -712, -712,\n     -712, -712, -712, -712, -712,  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, -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       67, -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,  873, -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       67, -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,  874, -714, -714, -714, -714, -714, -714, -714,\n     -714, -714, -714, -714, -714, -714, -714, -714,  864,  864,\n      864,  864,  864,  864,  864,  864,  864,  864, -714, -714,\n     -714, -714, -714, -714, -714,  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, -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       67, -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,  875, -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       67, -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,  876, -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       67, -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,  877,\n      877,  877,  877,  877,  877,  877,  877,  877, -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       67, -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,  878, -718, -718, -718, -718, -718, -718, -718,\n     -718, -718, -718, -718, -718, -718, -718, -718,  879,  879,\n      879,  879,  879,  879,  879,  879,  879,  879, -718, -718,\n\n     -718, -718, -718, -718, -718,  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, -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       67, -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,  880, -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       67, -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,  881, -720, -720, -720, -720, -720, -720, -720,\n     -720, -720, -720, -720, -720, -720, -720, -720,  882,  882,\n      882,  882,  882,  882,  882,  882,  882,  882, -720, -720,\n     -720, -720, -720, -720, -720,  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, -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       67, -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,  883, -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       67, -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,  884, -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       67, -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,  885, -723, -723, -723, -723, -723, -723, -723,\n     -723, -723, -723, -723, -723, -723, -723, -723,  886,  886,\n      886,  886,  886,  886,  886,  886,  886,  886, -723, -723,\n     -723, -723, -723, -723, -723,  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, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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,  887, -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       67, -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,  888, -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\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       67, -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,  889, -732, -732, -732, -732, -732, -732, -732,\n\n     -732, -732, -732, -732, -732, -732, -732, -732,  890,  890,\n      890,  890,  890,  890,  890,  890,  890,  890, -732, -732,\n     -732, -732, -732, -732, -732,  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, -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       67, -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,  891, -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, -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       67, -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,  892, -734, -734, -734, -734, -734, -734, -734,\n     -734, -734, -734, -734, -734, -734, -734, -734,  893,  893,\n      893,  893,  893,  893,  893,  893,  893,  893, -734, -734,\n     -734, -734, -734, -734, -734,  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, -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       67, -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,  894, -735, -735, -735, -735, -735, -735, -735,\n     -735, -735, -735, -735, -735, -735, -735, -735,  895,  895,\n\n      895,  895,  895,  895,  895,  895,  895,  895, -735, -735,\n     -735, -735, -735, -735, -735,  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, -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       67, -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,  896,  896,\n      896,  896,  896,  896,  896,  896,  896,  896, -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     -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       67, -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,  897,  897,\n      897,  897,  897,  897,  897,  897,  897,  897, -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\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       67, -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,  898,  898,\n      898,  898,  898,  898,  898,  898,  898,  898, -738, -738,\n\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, -738, -738,\n     -738, -738, -738, -738, -738, -738, -738, -738\n    },\n\n    {\n       67, -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,  899, -739, -739, -739, -739, -739, -739, -739,\n     -739, -739, -739, -739, -739, -739, -739, -739,  900,  900,\n      900,  900,  900,  900,  900,  900,  900,  900, -739, -739,\n     -739, -739, -739, -739, -739,  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, -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       67, -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,  901,  901,\n      901,  901,  901,  901,  901,  901,  901,  901, -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       67, -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,  902, -741, -741, -741, -741, -741, -741, -741,\n     -741, -741, -741, -741, -741, -741, -741, -741,  903,  903,\n      903,  903,  903,  903,  903,  903,  903,  903, -741, -741,\n     -741, -741, -741, -741, -741,  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, -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       67, -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,  902, -742, -742, -742, -742, -742, -742, -742,\n\n     -742, -742, -742, -742, -742, -742, -742, -742,  904,  904,\n      904,  904,  904,  904,  904,  904,  904,  904, -742, -742,\n     -742, -742, -742, -742, -742,  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, -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       67, -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,  905, -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, -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       67, -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,  906, -744, -744, -744, -744, -744, -744, -744,\n     -744, -744, -744, -744, -744, -744, -744, -744,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907, -744, -744,\n     -744, -744, -744, -744, -744,  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, -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       67, -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,  908, -745, -745, -745, -745, -745, -745, -745,\n     -745, -745, -745, -745, -745, -745, -745, -745,  909,  909,\n\n      909,  909,  909,  909,  909,  909,  909,  909, -745, -745,\n     -745, -745, -745, -745, -745,  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, -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       67, -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,  908, -746, -746, -746, -746, -746, -746, -746,\n     -746, -746, -746, -746, -746, -746, -746, -746,  910,  910,\n      910,  910,  910,  910,  910,  910,  910,  910, -746, -746,\n     -746, -746, -746, -746, -746,  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, -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       67, -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,  911, -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       67, -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,  912, -748, -748, -748, -748, -748, -748, -748,\n     -748, -748, -748, -748, -748, -748, -748, -748,  913,  913,\n      913,  913,  913,  913,  913,  913,  913,  913, -748, -748,\n\n     -748, -748, -748, -748, -748,  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, -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       67, -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,  912, -749, -749, -749, -749, -749, -749, -749,\n     -749, -749, -749, -749, -749, -749, -749, -749,  914,  914,\n      914,  914,  914,  914,  914,  914,  914,  914, -749, -749,\n     -749, -749, -749, -749, -749,  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, -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       67, -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,  915, -750, -750, -750, -750, -750, -750, -750,\n     -750, -750, -750, -750, -750, -750, -750, -750,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907, -750, -750,\n     -750, -750, -750, -750, -750,  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, -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       67, -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,  916, -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, -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       67, -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,  917, -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, -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       67, -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,  918, -753, -753, -753, -753, -753, -753, -753,\n     -753, -753, -753, -753, -753, -753, -753, -753,  919,  919,\n      919,  919,  919,  919,  919,  919,  919,  919, -753, -753,\n     -753, -753, -753, -753, -753,  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, -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       67, -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,  920, -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, -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       67, -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,  921, -755, -755, -755, -755, -755, -755, -755,\n     -755, -755, -755, -755, -755, -755, -755, -755,  922,  922,\n\n      922,  922,  922,  922,  922,  922,  922,  922, -755, -755,\n     -755, -755, -755, -755, -755,  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, -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       67, -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,  921, -756, -756, -756, -756, -756, -756, -756,\n     -756, -756, -756, -756, -756, -756, -756, -756,  923,  923,\n      923,  923,  923,  923,  923,  923,  923,  923, -756, -756,\n     -756, -756, -756, -756, -756,  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, -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       67, -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,  924, -757, -757, -757, -757, -757, -757, -757,\n     -757, -757, -757, -757, -757, -757, -757, -757,  907,  907,\n      907,  907,  907,  907,  907,  907,  907,  907, -757, -757,\n     -757, -757, -757, -757, -757,  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, -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       67, -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,  925, -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       67, -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,  926, -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, -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       67, -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,  927, -760, -760, -760, -760, -760, -760, -760,\n     -760, -760, -760, -760, -760, -760, -760, -760,  928,  928,\n      928,  928,  928,  928,  928,  928,  928,  928, -760, -760,\n     -760, -760, -760, -760, -760,  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, -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       67, -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,  927, -761, -761, -761, -761, -761, -761, -761,\n     -761, -761, -761, -761, -761, -761, -761, -761,  929,  929,\n      929,  929,  929,  929,  929,  929,  929,  929, -761, -761,\n     -761, -761, -761, -761, -761,  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, -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       67, -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,  930, -762, -762, -762, -762, -762, -762, -762,\n\n     -762, -762, -762, -762, -762, -762, -762, -762,  919,  919,\n      919,  919,  919,  919,  919,  919,  919,  919, -762, -762,\n     -762, -762, -762, -762, -762,  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, -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       67, -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,  931, -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       67, -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,  932,  932,\n      932,  932,  932,  932,  932,  932,  932,  932, -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       67, -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,  933, -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,  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, -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       67, -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,  933, -766, -766, -766, -766, -766, -766, -766,\n     -766, -766, -766, -766, -766, -766, -766, -766,  934,  934,\n      934,  934,  934,  934,  934,  934,  934,  934, -766, -766,\n     -766, -766, -766, -766, -766,  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, -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       67, -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,  935, -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       67, -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,  936, -768, -768, -768, -768, -768, -768, -768,\n     -768, -768, -768, -768, -768, -768, -768, -768,  937,  937,\n      937,  937,  937,  937,  937,  937,  937,  937, -768, -768,\n\n     -768, -768, -768, -768, -768,  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, -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       67, -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,  938, -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, -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       67, -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,  939, -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       67, -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,  940, -771, -771, -771, -771, -771, -771, -771,\n     -771, -771, -771, -771, -771, -771, -771, -771,  941,  941,\n      941,  941,  941,  941,  941,  941,  941,  941, -771, -771,\n     -771, -771, -771, -771, -771,  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, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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,  942,  942,\n      942,  942,  942,  942,  942,  942,  942,  942, -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       67, -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,  943, -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,  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, -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       67, -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,  943, -780, -780, -780, -780, -780, -780, -780,\n     -780, -780, -780, -780, -780, -780, -780, -780,  944,  944,\n      944,  944,  944,  944,  944,  944,  944,  944, -780, -780,\n     -780, -780, -780, -780, -780,  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, -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       67, -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,  945, -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, -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       67, -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,  946, -782, -782, -782, -782, -782, -782, -782,\n\n     -782, -782, -782, -782, -782, -782, -782, -782,  947,  947,\n      947,  947,  947,  947,  947,  947,  947,  947, -782, -782,\n     -782, -782, -782, -782, -782,  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, -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       67, -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,  948, -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, -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       67, -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,  949, -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, -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       67, -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,  950, -785, -785, -785, -785, -785, -785, -785,\n     -785, -785, -785, -785, -785, -785, -785, -785,  951,  951,\n\n      951,  951,  951,  951,  951,  951,  951,  951, -785, -785,\n     -785, -785, -785, -785, -785,  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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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       67, -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, -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       67,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      793,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  794,  792,  792,  792,  792,  792,  792,  792,\n\n      792,  792,  792,  792,  792,  792,  792,  795,  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,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792\n    },\n\n    {\n       67, -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       67,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      793,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  794,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  795,  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,  792,\n      792,  792,  792,  792,  792,  792,  792,  792\n    },\n\n    {\n       67,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      793,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  794,  792,  792,  792,  792,  792,  792,  792,\n      792,  792,  792,  792,  792,  792,  792,  795,  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,  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       67, -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, -796, -796, -796, -796, -796, -796, -796, -796, -796,\n     -796, -796, -796, -796, -796, -796,  952, -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       67, -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,  953, -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\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       67, -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,  954, -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     -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       67, -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,  955, -799, -799, -799, -799, -799, -799, -799,\n     -799, -799, -799, -799, -799, -799, -799, -799,  956,  956,\n      956,  956,  956,  956,  956,  956,  956,  956, -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       67, -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,  957, -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       67, -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,  958, -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       67, -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,  959, -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       67, -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,  960,\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       67, -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,  961,\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       67, -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,  962, -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       67, -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,  963, -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       67, -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,  964, -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       67, -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,  965,\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       67, -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,  966, -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       67, -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,  967,\n     -810, -810, -810, -810, -810, -810, -810, -810, -810, -810,\n     -810,  968, -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       67, -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,  969, -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       67, -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,  970, -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       67, -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,  971, -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       67, -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,  972, -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       67, -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,  973, -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       67, -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,  974, -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       67, -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,  975, -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       67, -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,  976, -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,  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, -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       67, -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,  977, -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       67, -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,  978, -820, -820, -820, -820, -820, -820, -820,\n     -820, -820, -820, -820, -820, -820, -820, -820,  979,  979,\n      979,  979,  979,  979,  979,  979,  979,  979, -820, -820,\n     -820, -820, -820, -820, -820,  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, -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       67, -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,  980,\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       67, -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,  981, -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       67, -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,  982, -823, -823, -823, -823, -823, -823, -823,\n     -823, -823, -823, -823, -823, -823, -823, -823,  983,  983,\n      983,  983,  983,  983,  983,  983,  983,  983, -823, -823,\n     -823, -823, -823, -823, -823,  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, -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       67, -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,  984, -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       67, -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,  985,\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       67, -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,  986, -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       67, -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,  987, -827, -827, -827, -827, -827, -827, -827,\n     -827, -827, -827, -827, -827, -827, -827, -827,  988,  988,\n      988,  988,  988,  988,  988,  988,  988,  988, -827, -827,\n     -827, -827, -827, -827, -827,  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      987, -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       67, -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,  989, -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       67, -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,  990, -829, -829, -829, -829, -829, -829, -829,\n     -829, -829, -829, -829, -829, -829, -829, -829,  991,  991,\n      991,  991,  991,  991,  991,  991,  991,  991, -829, -829,\n     -829, -829, -829, -829, -829,  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, -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       67, -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,  992,\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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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, -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       67, -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\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       67, -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, -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     -906, -906, -906, -906, -906, -906, -906, -906, -906, -906,\n\n     -906, -906, -906, -906, -906, -906, -906, -906\n    },\n\n    {\n       67, -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     -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       67, -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, -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\n    },\n\n    {\n       67, -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, -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, -909, -909,\n     -909, -909, -909, -909, -909, -909, -909, -909\n\n    },\n\n    {\n       67, -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     -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       67, -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, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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, -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       67, -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       67, -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     -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       67, -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, -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\n    },\n\n    {\n       67, -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\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       67, -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, -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       67, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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       67, -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       67, -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     -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       67, -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, -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       67, -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\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       67, -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, -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       67, -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       67, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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, -939, -939,\n     -939, -939, -939, -939, -939, -939, -939, -939\n\n    },\n\n    {\n       67, -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     -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       67, -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, -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       67, -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\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       67, -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, -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     -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       67, -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, -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       67, -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, -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, -945, -945,\n     -945, -945, -945, -945, -945, -945, -945, -945\n    },\n\n    {\n       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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     -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       67, -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, -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, -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       67, -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\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,  993, -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       67, -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, -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,  994, -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       67, -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,  995, -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       67, -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,  996, -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       67, -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,  997, -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       67, -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,  998, -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\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       67, -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,  999, -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       67, -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, -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       67, -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       67, -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       67, -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, 1000, -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     -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       67, -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, 1001, -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       67, -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, 1002, 1003,\n     1004, -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       67, -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, 1005, -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       67, -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, -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       67, -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, 1006, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, -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       67, -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, 1007, -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       67, -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, -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       67, -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, -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       67, -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, 1008, -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       67, -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, 1009, -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       67, -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, 1010, -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       67, -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, 1011, -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, 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, -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       67, -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, 1012, -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, 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, -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       67, -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, 1013, -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, -981, -981,\n\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, -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       67, -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, 1014, -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       67, -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, 1015, -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, 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, -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       67, -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, 1016, -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, 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, -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       67, -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     -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       67, -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, 1017, -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       67, -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, 1018, -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     -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       67, -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, 1019, -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, 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, -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       67, -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, 1020, -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       67, -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, 1021, -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       67, -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, 1022, -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, 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, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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       67, -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, 1023, -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       67, -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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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, 1024,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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, 1025,-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       67,-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, 1026,-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       67,-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, 1027,-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       67,-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, 1028,-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       67,-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, 1029,-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       67,-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, 1030,-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       67,-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, 1031,-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       67,-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, 1032,-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       67,-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, 1033,-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       67,-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, 1034,-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       67,-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, 1035,-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       67,-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, 1036,-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       67,-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, 1037,-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       67,-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, 1038,-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       67,-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, 1039,-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       67,-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, 1040,-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       67,-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, 1041,-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       67,-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, 1042,-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       67,-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, 1043,-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       67,-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, 1044,-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       67,-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, 1045,-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       67,-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, 1046,-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       67,-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, 1047,-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       67,-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, 1048,-1036,-1036,-1036,-1036,-1036,-1036,-1036,\n    -1036,-1036,-1036, 1049,-1036, 1049,-1036,-1036, 1050, 1050,\n     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,-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       67,-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, 1051,-1037,-1037,-1037,-1037,-1037,-1037,-1037,\n    -1037,-1037,-1037, 1052,-1037, 1052,-1037,-1037, 1053, 1053,\n     1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053,-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       67,-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, 1054,-1038,-1038,-1038,-1038,-1038,-1038,-1038,\n    -1038,-1038,-1038, 1055,-1038, 1055,-1038,-1038, 1056, 1056,\n     1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056,-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       67,-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, 1057,-1039,-1039,-1039,-1039,-1039,-1039,-1039,\n    -1039,-1039,-1039, 1058,-1039, 1058,-1039,-1039, 1059, 1059,\n     1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059,-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       67,-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, 1060,-1040,-1040,-1040,-1040,-1040,-1040,-1040,\n    -1040,-1040,-1040, 1061,-1040, 1061,-1040,-1040, 1062, 1062,\n     1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,-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       67,-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, 1063,-1041,-1041,-1041,-1041,-1041,-1041, 1064,\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       67,-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, 1065,-1042,-1042,-1042,-1042,-1042,-1042, 1066,\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       67,-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, 1067,-1043,-1043,-1043,-1043,-1043,-1043, 1068,\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       67,-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, 1069,-1044,-1044,-1044,-1044,-1044,-1044, 1070,\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       67,-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, 1071,-1045,-1045,-1045,-1045,-1045,-1045, 1072,\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       67,-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, 1073,-1046,-1046,-1046,-1046,-1046,-1046, 1074,\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       67,-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, 1075,-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       67,-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, 1049,-1048, 1049,-1048,-1048, 1050, 1050,\n     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,-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       67,-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, 1050, 1050,\n     1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,-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       67,-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       67,-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, 1052,-1051, 1052,-1051,-1051, 1053, 1053,\n     1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053,-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       67,-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, 1053, 1053,\n     1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053,-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       67,-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       67,-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, 1055,-1054, 1055,-1054,-1054, 1056, 1056,\n     1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056,-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       67,-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, 1056, 1056,\n\n     1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056,-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       67,-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       67,-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, 1058,-1057, 1058,-1057,-1057, 1059, 1059,\n     1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059,-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       67,-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, 1059, 1059,\n     1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059,-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       67,-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       67,-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, 1061,-1060, 1061,-1060,-1060, 1062, 1062,\n     1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,-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       67,-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, 1062, 1062,\n     1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,-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       67,-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       67,-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, 1064,\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       67, 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, 1077,\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, 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\n    },\n\n    {\n       67,-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, 1066,\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       67, 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, 1079,\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, 1078, 1078,\n     1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078,\n\n     1078, 1078, 1078, 1078, 1078, 1078, 1078, 1078\n    },\n\n    {\n       67,-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, 1068,\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       67, 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, 1081,\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, 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\n    },\n\n    {\n       67,-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, 1070,\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       67, 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, 1083,\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\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       67,-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, 1072,\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       67, 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, 1085,\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       67,-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, 1074,\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       67, 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, 1087,\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, 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\n    },\n\n    {\n       67,-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, 1088,-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       67, 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, 1077,\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       67,-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, 1076,\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       67, 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, 1079,\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       67,-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, 1078,\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       67, 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, 1081,\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       67,-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, 1080,\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       67, 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, 1083,\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       67,-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, 1082,\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       67, 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, 1085,\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       67,-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, 1084,\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       67, 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, 1087,\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       67,-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, 1086,\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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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       67,-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, 1152,-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       67,-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, 1153,-1152,-1152,-1152,-1152,-1152,-1152,-1152,\n\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,-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       67,-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, 1154,-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,-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\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153,\n    -1153,-1153,-1153,-1153,-1153,-1153,-1153,-1153\n    },\n\n    {\n       67,-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, 1155,-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       67,-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\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,-1155,-1155,\n    -1155,-1155,-1155,-1155,-1155,-1155,-1155,-1155\n    },\n\n    } ;\n\nstatic yy_state_type yy_get_previous_state (void );\nstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\nstatic int yy_get_next_buffer (void );\nstatic void yy_fatal_error (yyconst char msg[]  );\n\n/* Done after the current pattern has been matched and before the\n * corresponding action - sets up wcsbthtext.\n */\n#define YY_DO_BEFORE_ACTION \\\n\t(yytext_ptr) = yy_bp; \\\n\twcsbthleng = (size_t) (yy_cp - yy_bp); \\\n\t(yy_hold_char) = *yy_cp; \\\n\t*yy_cp = '\\0'; \\\n\t(yy_c_buf_p) = yy_cp;\n\n#define YY_NUM_RULES 361\n#define YY_END_OF_BUFFER 362\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 yyconst flex_int16_t yy_accept[1156] =\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,  362,  361,  126,  126,\n      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,\n      126,  126,  126,  134,  134,  134,  153,  153,  145,  145,\n      154,  154,  146,  146,  201,  201,  201,  361,  222,  222,\n\n      211,  211,  226,  226,  237,  237,  238,  238,  304,  304,\n      304,  339,  339,  317,  317,  340,  340,  318,  318,  344,\n      344,  240,  241,  239,  248,  248,  249,  249,  257,  257,\n      258,  258,  346,  346,  348,  348,  347,  350,  350,  350,\n      349,  352,  352,  361,  353,  361,  361,  361,  358,  361,\n      359,  361,  360,    0,    0,    0,   64,   58,   21,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,   17,    0,   63,   57,    0,    0,    0,\n        0,    0,    0,    0,   23,    0,   19,   66,   60,    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,  345,  347,    0,  349,  349,  349,\n      349,    0,    0,  351,    0,  355,    0,    0,    0,  353,\n        0,    0,    0,  353,    0,    0,    0,  358,    0,  359,\n        0,  360,    0,    0,    0,    0,    0,    0,    0,    0,\n       65,   59,    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       24,    0,    0,    0,    0,    0,    0,   20,   67,   61,\n        0,    0,    0,    0,    0,    0,    0,    0,  131,  132,\n      133,  130,  129,  127,  128,    0,    0,    0,  135,  136,\n      137,  142,  141,    0,    0,    0,  138,  139,  140,  144,\n      143,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,  223,  224,  225,  227,  228,  229,  234,  233,\n      230,  231,  232,  236,  235,    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,  341,  342,  343,    0,    0,    0,  245,\n      246,  247,    0,    0,    0,  254,  255,  256,  349,    0,\n      349,    0,    0,  354,    0,    0,    0,  356,    0,    0,\n        0,  353,    0,    0,   22,   18,   26,    0,   69,   74,\n        0,   13,   44,   79,   39,   34,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,   84,    0,    0,    0,\n       91,   51,   49,    0,   93,    0,    0,    0,  103,    0,\n       54,   56,  108,  106,  110,    0,   28,    0,   71,   76,\n\n        0,   15,   46,   81,   41,   36,    0,  122,  112,    0,\n        0,    0,    0,  114,    0,    0,  121,    0,    0,  124,\n      147,  148,  149,  150,  151,  152,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,  202,  203,  204,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  242,  243,  244,  250,  251,  252,  253,  357,\n        0,    0,    0,  354,    0,    0,    0,  353,    0,    0,\n       27,   70,   75,   31,   14,   45,   80,   40,   35,   25,\n       68,   73,   30,   12,   43,   78,   38,   33,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,   95,    0,   97,\n       99,  101,   62,    0,    0,    0,    0,    0,    0,    0,\n       29,   72,   77,   32,   16,   47,   82,   42,   37,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  210,  207,  209,  205,  206,  208,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,  310,  308,  309,  305,  306,  307,    0,    0,    0,\n        0,    0,    0,    0,    0,  316,  314,  315,  311,  312,\n      313,    0,  354,    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      190,  192,  195,  199,  191,  194,  198,  193,  197,  196,\n      200,  186,  164,  183,  187,  175,  165,  161,  170,  181,\n      184,  188,  176,  173,  178,  166,  162,  171,  159,  168,\n      180,  182,  185,  189,  177,  174,  179,  157,  158,  167,\n      163,  172,  160,  169,  155,  156,  221,  217,  220,  214,\n      216,  219,  212,  213,  215,  218,  294,  296,  299,  303,\n      295,  298,  302,  297,  301,  300,  290,  268,  287,  291,\n\n      279,  265,  269,  274,  285,  288,  292,  277,  280,  282,\n      263,  266,  270,  275,  272,  284,  286,  289,  293,  261,\n      278,  281,  283,  262,  259,  264,  267,  271,  276,  273,\n      260,  334,  324,  333,  322,  323,  332,  319,  320,  321,\n      331,  338,  330,  337,  328,  329,  336,  325,  326,  327,\n      335,    0,    0,    0,    0,    0,    0,    0,   90,   50,\n       48,    0,    0,    0,    0,  102,    0,   53,   55,  105,\n      107,  109,    0,  111,  113,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  120,    0,    0,    0,    0,    0,\n        0,  123,   83,   85,   86,   87,   88,    0,   89,   92,\n\n       94,   96,   98,  100,  104,   52,    0,  115,  117,  118,\n      119,  116,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\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\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,  125\n    } ;\n\nstatic yy_state_type yy_last_accepting_state;\nstatic char *yy_last_accepting_cpos;\n\nstatic yyconst yy_state_type yy_NUL_trans[1156] =\n    {   0,\n       68,   69,   84,   84,   87,   87,   89,   89,   91,   91,\n       93,   93,   95,   95,   68,   68,   99,   99,  101,  101,\n      103,  103,  105,  105,  107,  107,  109,  109,  112,  112,\n      114,  114,  116,  116,  118,  118,  120,  120,  122,  122,\n      123,  123,  125,  125,  127,  127,  129,  129,  131,  131,\n      133,  133,  135,  135,  138,  138,  142,  142,  144,  144,\n      148,  148,  150,  150,  152,  152,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  263,  265,    0,  269,  273,  277,    0,  279,\n        0,  281,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  263,    0,  265,    0,  442,  443,  447,    0,\n      451,  273,  273,    0,  273,  273,  277,    0,  279,    0,\n      281,    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,  442,  443,    0,  443,  443,  447,    0,  447,  613,\n      447,    0,  451,  617,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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      442,  792,  613,    0,  613,  613,  617,    0,  617,  617,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    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,  792,    0,  792,  792,    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, 1076,    0, 1078,    0, 1080,    0, 1082,\n        0, 1084,    0, 1086,    0, 1076,    0, 1078,    0, 1080,\n        0, 1082,    0, 1084,    0, 1086,    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\n    } ;\n\nextern int wcsbth_flex_debug;\nint wcsbth_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 yymore() yymore_used_but_not_detected\n#define YY_MORE_ADJ 0\n#define YY_RESTORE_YY_MORE_OFFSET\nchar *wcsbthtext;\n#line 1 \"wcsbth.l\"\n/*============================================================================\n\n  WCSLIB 5.17 - an implementation of the FITS WCS standard.\n  Copyright (C) 1995-2017, 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  Direct correspondence concerning WCSLIB to mark@calabretta.id.au\n\n  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.\n  http://www.atnf.csiro.au/people/Mark.Calabretta\n  $Id: wcsbth.c,v 5.17 2017/09/18 08:44:24 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/* 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 <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 STRING  2\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/* Image header of either type.             */\n#define BIMGARR 0x4\t/* Binary table image array with axis       */\n\t\t\t/* number, e.g. iCTYna.                     */\n#define PIXLIST 0x8\t/* Pixel list, e.g. TCTYna.                 */\n#define BINTAB  0xC\t/* Shared binary table image array (without */\n\t\t\t/* axis number) or pixel list, e.g. LONPna  */\n\t\t\t/* or OBSGXn.                               */\n\n#define YY_DECL int wcsbth(char *header, int nkeyrec, int relax, int ctrl, \\\n                           int keysel, int *colsel, int *nreject, int *nwcs, \\\n\t\t\t   struct wcsprm **wcs)\n\n#define YY_INPUT(inbuff, count, bufsize) \\\n\t{ \\\n\t  if (wcsbth_nkeyrec) { \\\n\t    strncpy(inbuff, wcsbth_hdr, 80); \\\n\t    inbuff[80] = '\\n'; \\\n\t    wcsbth_hdr += 80; \\\n\t    wcsbth_nkeyrec--; \\\n\t    count = 81; \\\n\t  } else { \\\n\t    count = YY_NULL; \\\n\t  } \\\n\t}\n\n/* A convenience macro to get around incompatibilities between unput() and\n   yyless(): put wcsbthtext followed by a blank back onto the input stream. */\n#define WCSBTH_PUTBACK \\\n  sprintf(strtmp, \"%s \", wcsbthtext); \\\n  itmp = strlen(strtmp); \\\n  while (itmp) unput(strtmp[--itmp]);\n\n/* These global variables are required by YY_INPUT. */\nchar *wcsbth_hdr;\nint  wcsbth_nkeyrec;\n\n/* Used in preempting the call to exit() by yy_fatal_error(). */\njmp_buf wcsbth_abort_jmp_env;\n#define exit(status) longjmp(wcsbth_abort_jmp_env, status)\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\nint wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype,\n        struct wcsbth_alts *alts);\nint wcsbth_init1(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs);\n\nstruct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts,\n        int keytype, int n, char a);\nint wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a);\n\nint wcsbth_epoch(double *wptr, double epoch);\nint wcsbth_vsource(double *wptr, double vsource);\n\nint wcsbth_final(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs);\n\n#line 20860 \"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 STRING_VAL 28\n#define COMMENT 29\n#define DISCARD 30\n#define ERROR 31\n#define FLUSH 32\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#ifndef YY_EXTRA_TYPE\n#define YY_EXTRA_TYPE void *\n#endif\n\nstatic int yy_init_globals (void );\n\n/* Accessor methods to globals.\n   These are made visible to non-reentrant scanners for convenience. */\n\nint wcsbthlex_destroy (void );\n\nint wcsbthget_debug (void );\n\nvoid wcsbthset_debug (int debug_flag  );\n\nYY_EXTRA_TYPE wcsbthget_extra (void );\n\nvoid wcsbthset_extra (YY_EXTRA_TYPE user_defined  );\n\nFILE *wcsbthget_in (void );\n\nvoid wcsbthset_in  (FILE * in_str  );\n\nFILE *wcsbthget_out (void );\n\nvoid wcsbthset_out  (FILE * out_str  );\n\nyy_size_t wcsbthget_leng (void );\n\nchar *wcsbthget_text (void );\n\nint wcsbthget_lineno (void );\n\nvoid wcsbthset_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 YY_SKIP_YYWRAP\n#ifdef __cplusplus\nextern \"C\" int wcsbthwrap (void );\n#else\nextern int wcsbthwrap (void );\n#endif\n#endif\n\n    static void yyunput (int c,char *buf_ptr  );\n    \n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char *,yyconst char *,int );\n#endif\n\n#ifdef YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst char * );\n#endif\n\n#ifndef YY_NO_INPUT\n\n#ifdef __cplusplus\nstatic int yyinput (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 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( wcsbthtext, wcsbthleng, 1, wcsbthout )) {} } 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 = read( fileno(wcsbthin), (char *) 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(wcsbthin); \\\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 )\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 wcsbthlex (void);\n\n#define YY_DECL int wcsbthlex (void)\n#endif /* !YY_DECL */\n\n/* Code executed at the beginning of each rule, after wcsbthtext and wcsbthleng\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 break;\n#endif\n\n#define YY_RULE_SETUP \\\n\tif ( wcsbthleng > 0 ) \\\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_at_bol = \\\n\t\t\t\t(wcsbthtext[wcsbthleng - 1] == '\\n'); \\\n\tYY_USER_ACTION\n\n/** The main scanner function which does all the work.\n */\nYY_DECL\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp, *yy_bp;\n\tregister int yy_act;\n    \n\tif ( !(yy_init) )\n\t\t{\n\t\t(yy_init) = 1;\n\n#ifdef YY_USER_INIT\n\t\tYY_USER_INIT;\n#endif\n\n\t\tif ( ! (yy_start) )\n\t\t\t(yy_start) = 1;\t/* first start state */\n\n\t\tif ( ! wcsbthin )\n\t\t\twcsbthin = stdin;\n\n\t\tif ( ! wcsbthout )\n\t\t\twcsbthout = stdout;\n\n\t\tif ( ! YY_CURRENT_BUFFER ) {\n\t\t\twcsbthensure_buffer_stack ();\n\t\t\tYY_CURRENT_BUFFER_LVALUE =\n\t\t\t\twcsbth_create_buffer(wcsbthin,YY_BUF_SIZE );\n\t\t}\n\n\t\twcsbth_load_buffer_state( );\n\t\t}\n\n\t{\n#line 205 \"wcsbth.l\"\n\n\t/* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */\n\tchar a;\n\tint  i, j, k, m, n;\n\t\n\tchar *cptr, *errmsg, errtxt[80], exclude[1000], gotone, *hptr, *keep,\n\t     *keyname, *keyrec, ptype, strtmp[80];\n\tint  altlin, ialt, icol, incl, inttmp, ipass, ipx, itmp, ix, jx,\n\t     keytype, nother, nsel, npass, nvalid, status, valtype, voff;\n\tdouble dbltmp;\n\tvoid   *vptr, *wptr;\n\tstruct wcsbth_alts alts;\n\tstruct wcsprm *wcsp, wcstem;\n\tint (*special)(double *, double);\n\tint wcsbthlex_destroy(void);\n\t\n\t/* The data structures produced. */\n\t*nwcs = 0;\n\t*wcs  = 0x0;\n\t\n\t/* Parameters used to implement YY_INPUT. */\n\twcsbth_hdr = header;\n\twcsbth_nkeyrec = nkeyrec;\n\t\n\t/* Our handle on the input stream. */\n\tkeyrec = header;\n\thptr = header;\n\tkeep = 0x0;\n\t\n\t/* For keeping tallies of keywords found. */\n\t*nreject = 0;\n\tnvalid = 0;\n\tnother = 0;\n\t\n\t/* If strict, then also reject. */\n\tif (relax & WCSHDR_strict) relax |= WCSHDR_reject;\n\t\n\t/* Keyword parameters. */\n\ti = j = 0;\n\tn = k = 0;\n\tm = 0;\n\ta = ' ';\n\t\n\t/* Header bookkeeping. */\n\talts.ncol = 0;\n\talts.arridx  = 0x0;\n\talts.pixlist = 0x0;\n\talts.npv = 0x0;\n\talts.nps = 0x0;\n\t\n\tfor (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\tkeytype =  0;\n\tvaltype = -1;\n\tvptr    = 0x0;\n\t\n\t/* For keywords that require special handling. */\n\taltlin  = 0;\n\tptype   = ' ';\n\tspecial = 0x0;\n\t\n\t/* Selection by column number. */\n\tnsel = colsel ? colsel[0] : 0;\n\tincl = (nsel > 0);\n\tfor (icol = 0; icol < 1000; icol++) {\n\t  exclude[icol] = incl;\n\t}\n\tfor (icol = 1; icol <= abs(nsel); icol++) {\n\t  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\titmp = keysel;\n\tkeysel = 0;\n\tif (itmp) {\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\tipass = 1;\n\tnpass = 2;\n\t\n\t/* Return here via longjmp() invoked by yy_fatal_error(). */\n\tif (setjmp(wcsbth_abort_jmp_env)) {\n\t  return 4;\n\t}\n\t\n\tBEGIN(INITIAL);\n\n\n#line 21198 \"wcsbth.c\"\n\n\twhile ( 1 )\t\t/* loops until end-of-file is reached */\n\t\t{\n\t\tyy_cp = (yy_c_buf_p);\n\n\t\t/* Support of wcsbthtext. */\n\t\t*yy_cp = (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 = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t\t(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 = (yy_hold_char);\n\t\t\tyy_cp = (yy_last_accepting_cpos) + 1;\n\t\t\tyy_current_state = (yy_last_accepting_state);\n\t\t\tgoto yy_find_action;\n\ncase 1:\nYY_RULE_SETUP\n#line 309 \"wcsbth.l\"\n{\n\t  if (ipass == 1) {\n\t    if (alts.ncol == 0) {\n\t      sscanf(wcsbthtext, \"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 324 \"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(wcsbthtext, \"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 358 \"wcsbth.l\"\ncase 4:\n#line 359 \"wcsbth.l\"\ncase 5:\nYY_RULE_SETUP\n#line 359 \"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(wcsbthtext, \"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 385 \"wcsbth.l\"\ncase 7:\n/* rule 7 can match eol */\n#line 386 \"wcsbth.l\"\ncase 8:\n/* rule 8 can match eol */\nYY_RULE_SETUP\n#line 386 \"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 394 \"wcsbth.l\"\ncase 10:\n/* rule 10 can match eol */\n#line 395 \"wcsbth.l\"\ncase 11:\n/* rule 11 can match eol */\nYY_RULE_SETUP\n#line 395 \"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 402 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\n\t  keyname = \"CRPIXja\";\n\t  BEGIN(CCCCCia);\n\t}\n\tYY_BREAK\ncase 13:\n#line 411 \"wcsbth.l\"\ncase 14:\nYY_RULE_SETUP\n#line 411 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 427 \"wcsbth.l\"\ncase 16:\nYY_RULE_SETUP\n#line 427 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crpix);\n\t\n\t  if (wcsbthleng == 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 440 \"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 449 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  sscanf(wcsbthtext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijPCna\";\n\t  BEGIN(ijCCna);\n\t}\n\tYY_BREAK\ncase 19:\n#line 461 \"wcsbth.l\"\ncase 20:\nYY_RULE_SETUP\n#line 461 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pc);\n\t  altlin  = 1;\n\t\n\t  if (wcsbthleng == 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 475 \"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 484 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  sscanf(wcsbthtext, \"%1d%1d\", &i, &j);\n\t\n\t  keyname = \"ijCDna\";\n\t  BEGIN(ijCCna);\n\t}\n\tYY_BREAK\ncase 23:\n#line 496 \"wcsbth.l\"\ncase 24:\nYY_RULE_SETUP\n#line 496 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cd);\n\t  altlin  = 2;\n\t\n\t  if (wcsbthleng == 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 510 \"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 519 \"wcsbth.l\"\ncase 27:\nYY_RULE_SETUP\n#line 519 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 535 \"wcsbth.l\"\ncase 29:\nYY_RULE_SETUP\n#line 535 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.cdelt);\n\t\n\t  if (wcsbthleng == 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 548 \"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 557 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crota);\n\t  altlin  = 4;\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  keyname = \"iCROTn\";\n\t  BEGIN(iCROTn);\n\t}\n\tYY_BREAK\ncase 32:\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 = \"TCROTn\";\n\t  BEGIN(TCROTn);\n\t}\n\tYY_BREAK\ncase 33:\nYY_RULE_SETUP\n#line 577 \"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 586 \"wcsbth.l\"\ncase 35:\nYY_RULE_SETUP\n#line 586 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 602 \"wcsbth.l\"\ncase 37:\nYY_RULE_SETUP\n#line 602 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cunit);\n\t\n\t  if (wcsbthleng == 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 615 \"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 624 \"wcsbth.l\"\ncase 40:\nYY_RULE_SETUP\n#line 624 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 640 \"wcsbth.l\"\ncase 42:\nYY_RULE_SETUP\n#line 640 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ctype);\n\t\n\t  if (wcsbthleng == 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 653 \"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 662 \"wcsbth.l\"\ncase 45:\nYY_RULE_SETUP\n#line 662 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 678 \"wcsbth.l\"\ncase 47:\nYY_RULE_SETUP\n#line 678 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crval);\n\t\n\t  if (wcsbthleng == 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 692 \"wcsbth.l\"\ncase 49:\nYY_RULE_SETUP\n#line 692 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.lonpole);\n\t\n\t  if (wcsbthleng == 7) {\n\t    keyname = \"LONPOLEa\";\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 706 \"wcsbth.l\"\ncase 51:\nYY_RULE_SETUP\n#line 706 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.latpole);\n\t\n\t  if (wcsbthleng == 7) {\n\t    keyname = \"LATPOLEa\";\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 720 \"wcsbth.l\"\ncase 53:\n#line 721 \"wcsbth.l\"\ncase 54:\nYY_RULE_SETUP\n#line 721 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restfrq);\n\t\n\t  if (wcsbthleng == 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 (wcsbthleng == 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 748 \"wcsbth.l\"\ncase 56:\nYY_RULE_SETUP\n#line 748 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.restwav);\n\t\n\t  if (wcsbthleng == 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 761 \"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 771 \"wcsbth.l\"\ncase 59:\nYY_RULE_SETUP\n#line 771 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 788 \"wcsbth.l\"\ncase 61:\nYY_RULE_SETUP\n#line 788 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.pv);\n\t  ptype   = 'v';\n\t\n\t  if (wcsbthleng == 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 802 \"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 811 \"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 821 \"wcsbth.l\"\ncase 65:\nYY_RULE_SETUP\n#line 821 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 838 \"wcsbth.l\"\ncase 67:\nYY_RULE_SETUP\n#line 838 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.ps);\n\t  ptype   = 's';\n\t\n\t  if (wcsbthleng == 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 852 \"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 69:\n#line 861 \"wcsbth.l\"\ncase 70:\nYY_RULE_SETUP\n#line 861 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 71:\n#line 878 \"wcsbth.l\"\ncase 72:\nYY_RULE_SETUP\n#line 878 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = &(wcstem.cname);\n\t\n\t  if (wcsbthleng == 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 73:\nYY_RULE_SETUP\n#line 892 \"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 74:\n#line 901 \"wcsbth.l\"\ncase 75:\nYY_RULE_SETUP\n#line 901 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 76:\n#line 918 \"wcsbth.l\"\ncase 77:\nYY_RULE_SETUP\n#line 918 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.crder);\n\t\n\t  if (wcsbthleng == 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 78:\nYY_RULE_SETUP\n#line 932 \"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 79:\n#line 941 \"wcsbth.l\"\ncase 80:\nYY_RULE_SETUP\n#line 941 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  sscanf(wcsbthtext, \"%d\", &i);\n\t\n\t  if (wcsbthleng == 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 81:\n#line 958 \"wcsbth.l\"\ncase 82:\nYY_RULE_SETUP\n#line 958 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.csyer);\n\t\n\t  if (wcsbthleng == 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 83:\n#line 973 \"wcsbth.l\"\ncase 84:\nYY_RULE_SETUP\n#line 973 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateavg;\n\t\n\t  if (wcsbthleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"DATE-AVG\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"DAVGna\";\n\t    BEGIN(CCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 85:\nYY_RULE_SETUP\n#line 987 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.dateobs;\n\t\n\t  if (ctrl < -10) keep = keyrec;\n\t\n\t  keyname = \"DATE-OBS\";\n\t  BEGIN(CCCCCCCC);\n\t}\n\tYY_BREAK\ncase 86:\n#line 998 \"wcsbth.l\"\ncase 87:\n#line 999 \"wcsbth.l\"\ncase 88:\nYY_RULE_SETUP\n#line 999 \"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 = \"DOBSna\";\n\t    BEGIN(CCCCn);\n\t\n\t  } else if (relax & WCSHDR_reject) {\n\t    errmsg = \"DOBSna 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 89:\nYY_RULE_SETUP\n#line 1018 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"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    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 90:\n#line 1045 \"wcsbth.l\"\ncase 91:\nYY_RULE_SETUP\n#line 1045 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.equinox);\n\t\n\t  if (wcsbthleng == 7) {\n\t    keyname = \"EQUINOXa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"EQUIna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 92:\n#line 1059 \"wcsbth.l\"\ncase 93:\nYY_RULE_SETUP\n#line 1059 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdavg);\n\t\n\t  if (wcsbthleng == 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 94:\n#line 1074 \"wcsbth.l\"\ncase 95:\nYY_RULE_SETUP\n#line 1074 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.mjdobs);\n\t\n\t  if (wcsbthleng == 8) {\n\t    if (ctrl < -10) keep = keyrec;\n\t    keyname = \"MJD-OBS\";\n\t    BEGIN(CCCCCCCC);\n\t  } else {\n\t    keyname = \"MJDOn\";\n\t    BEGIN(CCCCCn);\n\t  }\n\t}\n\tYY_BREAK\ncase 96:\n#line 1089 \"wcsbth.l\"\ncase 97:\nYY_RULE_SETUP\n#line 1089 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo;\n\t\n\t  if (wcsbthleng == 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 98:\n#line 1104 \"wcsbth.l\"\ncase 99:\nYY_RULE_SETUP\n#line 1104 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 1;\n\t\n\t  if (wcsbthleng == 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 100:\n#line 1119 \"wcsbth.l\"\ncase 101:\nYY_RULE_SETUP\n#line 1119 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = wcstem.obsgeo + 2;\n\t\n\t  if (wcsbthleng == 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 102:\n#line 1134 \"wcsbth.l\"\ncase 103:\nYY_RULE_SETUP\n#line 1134 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.radesys;\n\t\n\t  if (wcsbthleng == 7) {\n\t    keyname = \"RADESYSa\";\n\t    BEGIN(CCCCCCCa);\n\t  } else {\n\t    keyname = \"RADEna\";\n\t    BEGIN(CCCCna);\n\t  }\n\t}\n\tYY_BREAK\ncase 104:\nYY_RULE_SETUP\n#line 1147 \"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    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\n\t  } else {\n\t    BEGIN(DISCARD);\n\t  }\n\t}\n\tYY_BREAK\ncase 105:\n#line 1167 \"wcsbth.l\"\ncase 106:\nYY_RULE_SETUP\n#line 1167 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.specsys;\n\t\n\t  if (wcsbthleng == 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 107:\n#line 1181 \"wcsbth.l\"\ncase 108:\nYY_RULE_SETUP\n#line 1181 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssysobs;\n\t\n\t  if (wcsbthleng == 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 109:\n#line 1195 \"wcsbth.l\"\ncase 110:\nYY_RULE_SETUP\n#line 1195 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.ssyssrc;\n\t\n\t  if (wcsbthleng == 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 111:\n#line 1209 \"wcsbth.l\"\ncase 112:\nYY_RULE_SETUP\n#line 1209 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velangl);\n\t\n\t  if (wcsbthleng == 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 113:\n#line 1223 \"wcsbth.l\"\ncase 114:\nYY_RULE_SETUP\n#line 1223 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.velosys);\n\t\n\t  if (wcsbthleng == 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 115:\nYY_RULE_SETUP\n#line 1236 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"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 116:\nYY_RULE_SETUP\n#line 1261 \"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 117:\n#line 1282 \"wcsbth.l\"\ncase 118:\n#line 1283 \"wcsbth.l\"\ncase 119:\nYY_RULE_SETUP\n#line 1283 \"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 120:\n#line 1304 \"wcsbth.l\"\ncase 121:\n#line 1305 \"wcsbth.l\"\ncase 122:\nYY_RULE_SETUP\n#line 1305 \"wcsbth.l\"\n{\n\t  valtype = STRING;\n\t  vptr    = wcstem.wcsname;\n\t\n\t  if (wcsbthleng == 7) {\n\t    keyname = \"WCSNAMEa\";\n\t    BEGIN(CCCCCCCa);\n\t\n\t  } else {\n\t    if (*wcsbthtext == '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 123:\n#line 1324 \"wcsbth.l\"\ncase 124:\nYY_RULE_SETUP\n#line 1324 \"wcsbth.l\"\n{\n\t  valtype = FLOAT;\n\t  vptr    = &(wcstem.zsource);\n\t\n\t  if (wcsbthleng == 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 125:\nYY_RULE_SETUP\n#line 1337 \"wcsbth.l\"\n{\n\t  if (wcsbth_nkeyrec) {\n\t    wcsbth_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 126:\nYY_RULE_SETUP\n#line 1347 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 127:\n#line 1352 \"wcsbth.l\"\ncase 128:\nYY_RULE_SETUP\n#line 1352 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(wcsbthtext, \"%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 129:\n#line 1371 \"wcsbth.l\"\ncase 130:\nYY_RULE_SETUP\n#line 1371 \"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 131:\n#line 1397 \"wcsbth.l\"\ncase 132:\n#line 1398 \"wcsbth.l\"\ncase 133:\nYY_RULE_SETUP\n#line 1398 \"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 134:\nYY_RULE_SETUP\n#line 1417 \"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 135:\n#line 1432 \"wcsbth.l\"\ncase 136:\n#line 1433 \"wcsbth.l\"\ncase 137:\n#line 1434 \"wcsbth.l\"\ncase 138:\n#line 1435 \"wcsbth.l\"\ncase 139:\n#line 1436 \"wcsbth.l\"\ncase 140:\nYY_RULE_SETUP\n#line 1436 \"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 141:\n#line 1452 \"wcsbth.l\"\ncase 142:\n#line 1453 \"wcsbth.l\"\ncase 143:\n#line 1454 \"wcsbth.l\"\ncase 144:\nYY_RULE_SETUP\n#line 1454 \"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 145:\n#line 1476 \"wcsbth.l\"\ncase 146:\nYY_RULE_SETUP\n#line 1476 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 147:\n#line 1481 \"wcsbth.l\"\ncase 148:\n#line 1482 \"wcsbth.l\"\ncase 149:\n#line 1483 \"wcsbth.l\"\ncase 150:\n#line 1484 \"wcsbth.l\"\ncase 151:\n#line 1485 \"wcsbth.l\"\ncase 152:\nYY_RULE_SETUP\n#line 1485 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%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 153:\n#line 1493 \"wcsbth.l\"\ncase 154:\nYY_RULE_SETUP\n#line 1493 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 155:\n#line 1498 \"wcsbth.l\"\ncase 156:\n#line 1499 \"wcsbth.l\"\ncase 157:\n#line 1500 \"wcsbth.l\"\ncase 158:\nYY_RULE_SETUP\n#line 1500 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(wcsbthtext, \"%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 159:\n#line 1519 \"wcsbth.l\"\ncase 160:\n#line 1520 \"wcsbth.l\"\ncase 161:\n#line 1521 \"wcsbth.l\"\ncase 162:\n#line 1522 \"wcsbth.l\"\ncase 163:\n#line 1523 \"wcsbth.l\"\ncase 164:\n#line 1524 \"wcsbth.l\"\ncase 165:\n#line 1525 \"wcsbth.l\"\ncase 166:\n#line 1526 \"wcsbth.l\"\ncase 167:\n#line 1527 \"wcsbth.l\"\ncase 168:\n#line 1528 \"wcsbth.l\"\ncase 169:\n#line 1529 \"wcsbth.l\"\ncase 170:\n#line 1530 \"wcsbth.l\"\ncase 171:\n#line 1531 \"wcsbth.l\"\ncase 172:\n#line 1532 \"wcsbth.l\"\ncase 173:\n#line 1533 \"wcsbth.l\"\ncase 174:\n#line 1534 \"wcsbth.l\"\ncase 175:\n#line 1535 \"wcsbth.l\"\ncase 176:\n#line 1536 \"wcsbth.l\"\ncase 177:\n#line 1537 \"wcsbth.l\"\ncase 178:\n#line 1538 \"wcsbth.l\"\ncase 179:\nYY_RULE_SETUP\n#line 1538 \"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(wcsbthtext, \"%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 180:\n#line 1569 \"wcsbth.l\"\ncase 181:\n#line 1570 \"wcsbth.l\"\ncase 182:\n#line 1571 \"wcsbth.l\"\ncase 183:\n#line 1572 \"wcsbth.l\"\ncase 184:\n#line 1573 \"wcsbth.l\"\ncase 185:\n#line 1574 \"wcsbth.l\"\ncase 186:\n#line 1575 \"wcsbth.l\"\ncase 187:\n#line 1576 \"wcsbth.l\"\ncase 188:\n#line 1577 \"wcsbth.l\"\ncase 189:\nYY_RULE_SETUP\n#line 1577 \"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 190:\n#line 1597 \"wcsbth.l\"\ncase 191:\n#line 1598 \"wcsbth.l\"\ncase 192:\n#line 1599 \"wcsbth.l\"\ncase 193:\n#line 1600 \"wcsbth.l\"\ncase 194:\n#line 1601 \"wcsbth.l\"\ncase 195:\n#line 1602 \"wcsbth.l\"\ncase 196:\n#line 1603 \"wcsbth.l\"\ncase 197:\n#line 1604 \"wcsbth.l\"\ncase 198:\n#line 1605 \"wcsbth.l\"\ncase 199:\nYY_RULE_SETUP\n#line 1605 \"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 200:\nYY_RULE_SETUP\n#line 1624 \"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(wcsbthtext, \"%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 201:\nYY_RULE_SETUP\n#line 1658 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 202:\n#line 1663 \"wcsbth.l\"\ncase 203:\n#line 1664 \"wcsbth.l\"\ncase 204:\nYY_RULE_SETUP\n#line 1664 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%d%c\", &n, &a);\n\t  keytype = BIMGARR;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 205:\n#line 1671 \"wcsbth.l\"\ncase 206:\n#line 1672 \"wcsbth.l\"\ncase 207:\n#line 1673 \"wcsbth.l\"\ncase 208:\n#line 1674 \"wcsbth.l\"\ncase 209:\n#line 1675 \"wcsbth.l\"\ncase 210:\nYY_RULE_SETUP\n#line 1675 \"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 211:\nYY_RULE_SETUP\n#line 1691 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 212:\n#line 1696 \"wcsbth.l\"\ncase 213:\n#line 1697 \"wcsbth.l\"\ncase 214:\n#line 1698 \"wcsbth.l\"\ncase 215:\n#line 1699 \"wcsbth.l\"\ncase 216:\n#line 1700 \"wcsbth.l\"\ncase 217:\nYY_RULE_SETUP\n#line 1700 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%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 218:\n#line 1709 \"wcsbth.l\"\ncase 219:\n#line 1710 \"wcsbth.l\"\ncase 220:\n#line 1711 \"wcsbth.l\"\ncase 221:\nYY_RULE_SETUP\n#line 1711 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%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 222:\nYY_RULE_SETUP\n#line 1720 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 223:\n#line 1725 \"wcsbth.l\"\ncase 224:\n#line 1726 \"wcsbth.l\"\ncase 225:\nYY_RULE_SETUP\n#line 1726 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    a = ' ';\n\t    sscanf(wcsbthtext, \"%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 226:\nYY_RULE_SETUP\n#line 1760 \"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 227:\n#line 1771 \"wcsbth.l\"\ncase 228:\n#line 1772 \"wcsbth.l\"\ncase 229:\n#line 1773 \"wcsbth.l\"\ncase 230:\n#line 1774 \"wcsbth.l\"\ncase 231:\n#line 1775 \"wcsbth.l\"\ncase 232:\nYY_RULE_SETUP\n#line 1775 \"wcsbth.l\"\n{\n\t  WCSBTH_PUTBACK;\n\t  BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna);\n\t}\n\tYY_BREAK\ncase 233:\n#line 1781 \"wcsbth.l\"\ncase 234:\n#line 1782 \"wcsbth.l\"\ncase 235:\n#line 1783 \"wcsbth.l\"\ncase 236:\nYY_RULE_SETUP\n#line 1783 \"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 237:\n#line 1801 \"wcsbth.l\"\ncase 238:\nYY_RULE_SETUP\n#line 1801 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 239:\n#line 1806 \"wcsbth.l\"\ncase 240:\nYY_RULE_SETUP\n#line 1806 \"wcsbth.l\"\n{\n\t  /* Image-header keyword. */\n\t  if (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG)) {\n\t    if (YY_START == CCCCCCCa) {\n\t      sscanf(wcsbthtext, \"%c\", &a);\n\t    } else {\n\t      a = 0;\n\t      unput(wcsbthtext[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 241:\nYY_RULE_SETUP\n#line 1830 \"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 242:\n#line 1845 \"wcsbth.l\"\ncase 243:\n#line 1846 \"wcsbth.l\"\ncase 244:\n#line 1847 \"wcsbth.l\"\ncase 245:\n#line 1848 \"wcsbth.l\"\ncase 246:\nYY_RULE_SETUP\n#line 1848 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%d%c\", &n, &a);\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 247:\nYY_RULE_SETUP\n#line 1854 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%d\", &n);\n\t  a = ' ';\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 248:\n#line 1862 \"wcsbth.l\"\ncase 249:\nYY_RULE_SETUP\n#line 1862 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 250:\n#line 1867 \"wcsbth.l\"\ncase 251:\n#line 1868 \"wcsbth.l\"\ncase 252:\n#line 1869 \"wcsbth.l\"\ncase 253:\n#line 1870 \"wcsbth.l\"\ncase 254:\n#line 1871 \"wcsbth.l\"\ncase 255:\n#line 1872 \"wcsbth.l\"\ncase 256:\nYY_RULE_SETUP\n#line 1872 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%d\", &n);\n\t  a = 0;\n\t  keytype = BINTAB;\n\t  BEGIN(VALUE);\n\t}\n\tYY_BREAK\ncase 257:\n#line 1880 \"wcsbth.l\"\ncase 258:\nYY_RULE_SETUP\n#line 1880 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 259:\n#line 1885 \"wcsbth.l\"\ncase 260:\n#line 1886 \"wcsbth.l\"\ncase 261:\n#line 1887 \"wcsbth.l\"\ncase 262:\nYY_RULE_SETUP\n#line 1887 \"wcsbth.l\"\n{\n\t  /* Image-header keyword. */\n\t  if (relax & WCSHDR_ALLIMG) {\n\t    sscanf(wcsbthtext, \"%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 263:\n#line 1907 \"wcsbth.l\"\ncase 264:\n#line 1908 \"wcsbth.l\"\ncase 265:\n#line 1909 \"wcsbth.l\"\ncase 266:\n#line 1910 \"wcsbth.l\"\ncase 267:\n#line 1911 \"wcsbth.l\"\ncase 268:\n#line 1912 \"wcsbth.l\"\ncase 269:\n#line 1913 \"wcsbth.l\"\ncase 270:\n#line 1914 \"wcsbth.l\"\ncase 271:\n#line 1915 \"wcsbth.l\"\ncase 272:\n#line 1916 \"wcsbth.l\"\ncase 273:\n#line 1917 \"wcsbth.l\"\ncase 274:\n#line 1918 \"wcsbth.l\"\ncase 275:\n#line 1919 \"wcsbth.l\"\ncase 276:\n#line 1920 \"wcsbth.l\"\ncase 277:\n#line 1921 \"wcsbth.l\"\ncase 278:\n#line 1922 \"wcsbth.l\"\ncase 279:\n#line 1923 \"wcsbth.l\"\ncase 280:\n#line 1924 \"wcsbth.l\"\ncase 281:\n#line 1925 \"wcsbth.l\"\ncase 282:\n#line 1926 \"wcsbth.l\"\ncase 283:\nYY_RULE_SETUP\n#line 1926 \"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(wcsbthtext, \"%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 284:\n#line 1957 \"wcsbth.l\"\ncase 285:\n#line 1958 \"wcsbth.l\"\ncase 286:\n#line 1959 \"wcsbth.l\"\ncase 287:\n#line 1960 \"wcsbth.l\"\ncase 288:\n#line 1961 \"wcsbth.l\"\ncase 289:\n#line 1962 \"wcsbth.l\"\ncase 290:\n#line 1963 \"wcsbth.l\"\ncase 291:\n#line 1964 \"wcsbth.l\"\ncase 292:\n#line 1965 \"wcsbth.l\"\ncase 293:\nYY_RULE_SETUP\n#line 1965 \"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 294:\n#line 1985 \"wcsbth.l\"\ncase 295:\n#line 1986 \"wcsbth.l\"\ncase 296:\n#line 1987 \"wcsbth.l\"\ncase 297:\n#line 1988 \"wcsbth.l\"\ncase 298:\n#line 1989 \"wcsbth.l\"\ncase 299:\n#line 1990 \"wcsbth.l\"\ncase 300:\n#line 1991 \"wcsbth.l\"\ncase 301:\n#line 1992 \"wcsbth.l\"\ncase 302:\n#line 1993 \"wcsbth.l\"\ncase 303:\nYY_RULE_SETUP\n#line 1993 \"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 304:\nYY_RULE_SETUP\n#line 2000 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 305:\n#line 2005 \"wcsbth.l\"\ncase 306:\n#line 2006 \"wcsbth.l\"\ncase 307:\n#line 2007 \"wcsbth.l\"\ncase 308:\n#line 2008 \"wcsbth.l\"\ncase 309:\n#line 2009 \"wcsbth.l\"\ncase 310:\n#line 2010 \"wcsbth.l\"\ncase 311:\n#line 2011 \"wcsbth.l\"\ncase 312:\n#line 2012 \"wcsbth.l\"\ncase 313:\n#line 2013 \"wcsbth.l\"\ncase 314:\n#line 2014 \"wcsbth.l\"\ncase 315:\n#line 2015 \"wcsbth.l\"\ncase 316:\nYY_RULE_SETUP\n#line 2015 \"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 317:\n#line 2032 \"wcsbth.l\"\ncase 318:\nYY_RULE_SETUP\n#line 2032 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 319:\n#line 2037 \"wcsbth.l\"\ncase 320:\n#line 2038 \"wcsbth.l\"\ncase 321:\n#line 2039 \"wcsbth.l\"\ncase 322:\n#line 2040 \"wcsbth.l\"\ncase 323:\n#line 2041 \"wcsbth.l\"\ncase 324:\n#line 2042 \"wcsbth.l\"\ncase 325:\n#line 2043 \"wcsbth.l\"\ncase 326:\n#line 2044 \"wcsbth.l\"\ncase 327:\n#line 2045 \"wcsbth.l\"\ncase 328:\n#line 2046 \"wcsbth.l\"\ncase 329:\n#line 2047 \"wcsbth.l\"\ncase 330:\nYY_RULE_SETUP\n#line 2047 \"wcsbth.l\"\n{\n\t  sscanf(wcsbthtext, \"%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 331:\n#line 2055 \"wcsbth.l\"\ncase 332:\n#line 2056 \"wcsbth.l\"\ncase 333:\n#line 2057 \"wcsbth.l\"\ncase 334:\n#line 2058 \"wcsbth.l\"\ncase 335:\n#line 2059 \"wcsbth.l\"\ncase 336:\n#line 2060 \"wcsbth.l\"\ncase 337:\n#line 2061 \"wcsbth.l\"\ncase 338:\nYY_RULE_SETUP\n#line 2061 \"wcsbth.l\"\n{\n\t  /* Invalid combinations will be flagged by <VALUE>. */\n\t  sscanf(wcsbthtext, \"%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 339:\n#line 2071 \"wcsbth.l\"\ncase 340:\nYY_RULE_SETUP\n#line 2071 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 341:\nYY_RULE_SETUP\n#line 2075 \"wcsbth.l\"\n{\n\t  if (relax & WCSHDR_PROJPn) {\n\t    sscanf(wcsbthtext, \"%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 342:\n#line 2094 \"wcsbth.l\"\ncase 343:\nYY_RULE_SETUP\n#line 2094 \"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 344:\nYY_RULE_SETUP\n#line 2104 \"wcsbth.l\"\n{\n\t  BEGIN(DISCARD);\n\t}\n\tYY_BREAK\ncase 345:\nYY_RULE_SETUP\n#line 2108 \"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      wcsbthlex_destroy();\n\t      return 3;\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 == 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 346:\nYY_RULE_SETUP\n#line 2169 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid KEYWORD = VALUE syntax\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 347:\nYY_RULE_SETUP\n#line 2174 \"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(wcsbthtext, \"%d\", &inttmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 348:\nYY_RULE_SETUP\n#line 2186 \"wcsbth.l\"\n{\n\t  errmsg = \"an integer value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 349:\nYY_RULE_SETUP\n#line 2191 \"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(wcsbthtext, &dbltmp);\n\t\n\t    BEGIN(COMMENT);\n\t  }\n\t}\n\tYY_BREAK\ncase 350:\nYY_RULE_SETUP\n#line 2203 \"wcsbth.l\"\n{\n\t  errmsg = \"a floating-point value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 351:\n/* rule 351 can match eol */\nYY_RULE_SETUP\n#line 2208 \"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, wcsbthtext+1);\n\t\n\t    /* Squeeze out repeated quotes. */\n\t    ix = 0;\n\t    for (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 352:\nYY_RULE_SETUP\n#line 2237 \"wcsbth.l\"\n{\n\t  errmsg = \"a string value was expected\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 353:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2242 \"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    gotone = 0;\n\t    while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) {\n\t      gotone = 1;\n\t\n\t      if (vptr) {\n\t        voff = (char *)vptr - (char *)(&wcstem);\n\t        wptr = (void *)((char *)wcsp + voff);\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            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 == STRING) {\n\t          /* Apply keyword parameterization. */\n\t          if (ptype == 's') {\n\t            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          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 354:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2340 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 355:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2345 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 356:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2350 \"wcsbth.l\"\n{\n\t  errmsg = \"invalid keyvalue or malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 357:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2355 \"wcsbth.l\"\n{\n\t  errmsg = \"malformed keycomment\";\n\t  BEGIN(ERROR);\n\t}\n\tYY_BREAK\ncase 358:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2360 \"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 359:\n*yy_cp = (yy_hold_char); /* undo effects of setting up wcsbthtext */\n(yy_c_buf_p) = yy_cp -= 1;\nYY_DO_BEFORE_ACTION; /* set up wcsbthtext again */\nYY_RULE_SETUP\n#line 2375 \"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 360:\n/* rule 360 can match eol */\nYY_RULE_SETUP\n#line 2391 \"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  /* 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  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(STRING_VAL):\ncase YY_STATE_EOF(COMMENT):\ncase YY_STATE_EOF(DISCARD):\ncase YY_STATE_EOF(ERROR):\ncase YY_STATE_EOF(FLUSH):\n#line 2419 \"wcsbth.l\"\n{\n\t  /* End-of-input. */\n\t  if (ipass == 1) {\n\t    if ((status = wcsbth_init1(&alts, nwcs, wcs)) ||\n\t        (*nwcs == 0 && ctrl == 0)) {\n\t      wcsbthlex_destroy();\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    wcsbth_hdr = header;\n\t    wcsbth_nkeyrec = nkeyrec;\n\t    keyrec = header;\n\t    *nreject = 0;\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    special = 0x0;\n\t\n\t    wcsbthrestart(wcsbthin);\n\t\n\t  } else {\n\t    wcsbthlex_destroy();\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 361:\nYY_RULE_SETUP\n#line 2485 \"wcsbth.l\"\nECHO;\n\tYY_BREAK\n#line 24118 \"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 - (yytext_ptr)) - 1;\n\n\t\t/* Undo the effects of YY_DO_BEFORE_ACTION. */\n\t\t*yy_cp = (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 wcsbthin at a new source and called\n\t\t\t * wcsbthlex().  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\t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsbthin;\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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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\t(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\tyy_current_state = yy_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 * 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 );\n\n\t\t\tyy_bp = (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 = ++(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 = (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(  ) )\n\t\t\t{\n\t\t\tcase EOB_ACT_END_OF_FILE:\n\t\t\t\t{\n\t\t\t\t(yy_did_buffer_switch_on_eof) = 0;\n\n\t\t\t\tif ( wcsbthwrap( ) )\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 * wcsbthtext, 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\t(yy_c_buf_p) = (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 ( ! (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\t(yy_c_buf_p) =\n\t\t\t\t\t(yytext_ptr) + yy_amount_of_matched_text;\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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\t(yy_c_buf_p) =\n\t\t\t\t&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\n\n\t\t\t\tyy_current_state = yy_get_previous_state(  );\n\n\t\t\t\tyy_cp = (yy_c_buf_p);\n\t\t\t\tyy_bp = (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 wcsbthlex */\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 (void)\n{\n    \tregister char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\n\tregister char *source = (yytext_ptr);\n\tregister int number_to_move, i;\n\tint ret_val;\n\n\tif ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(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 ( (yy_c_buf_p) - (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) ((yy_c_buf_p) - (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 = (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) ((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\tyy_size_t 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\twcsbthrealloc((void *) b->yy_ch_buf,b->yy_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->yy_ch_buf = 0;\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\t(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\t(yy_n_chars), num_to_read );\n\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tif ( (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\twcsbthrestart(wcsbthin  );\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 ((yy_size_t) ((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\tyy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsbthrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\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}\n\n\t(yy_n_chars) += number_to_move;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\n\tYY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\n\n\t(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 (void)\n{\n\tregister yy_state_type yy_current_state;\n\tregister char *yy_cp;\n    \n\tyy_current_state = (yy_start);\n\tyy_current_state += YY_AT_BOL();\n\n\tfor ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(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 )\n{\n\tregister int yy_is_jam;\n    \tregister char *yy_cp = (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\t(yy_last_accepting_state) = yy_current_state;\n\t\t\t(yy_last_accepting_cpos) = yy_cp;\n\t\t\t}\n\t\t}\n\n\t\treturn yy_is_jam ? 0 : yy_current_state;\n}\n\n    static void yyunput (int c, register char * yy_bp )\n{\n\tregister char *yy_cp;\n    \n    yy_cp = (yy_c_buf_p);\n\n\t/* undo effects of setting up wcsbthtext */\n\t*yy_cp = (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\tregister yy_size_t number_to_move = (yy_n_chars) + 2;\n\t\tregister char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[\n\t\t\t\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];\n\t\tregister char *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\t(yy_n_chars) = 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\t(yytext_ptr) = yy_bp;\n\t(yy_hold_char) = *yy_cp;\n\t(yy_c_buf_p) = yy_cp;\n}\n\n#ifndef YY_NO_INPUT\n#ifdef __cplusplus\n    static int yyinput (void)\n#else\n    static int input  (void)\n#endif\n\n{\n\tint c;\n    \n\t*(yy_c_buf_p) = (yy_hold_char);\n\n\tif ( *(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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\n\t\t\t/* This was really a NUL. */\n\t\t\t*(yy_c_buf_p) = '\\0';\n\n\t\telse\n\t\t\t{ /* need more input */\n\t\t\tyy_size_t offset = (yy_c_buf_p) - (yytext_ptr);\n\t\t\t++(yy_c_buf_p);\n\n\t\t\tswitch ( yy_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 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\twcsbthrestart(wcsbthin );\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 ( wcsbthwrap( ) )\n\t\t\t\t\t\treturn EOF;\n\n\t\t\t\t\tif ( ! (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();\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(yy_c_buf_p) = (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 *) (yy_c_buf_p);\t/* cast for 8-bit char's */\n\t*(yy_c_buf_p) = '\\0';\t/* preserve wcsbthtext */\n\t(yy_hold_char) = *++(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 * \n * @note This function does not reset the start condition to @c INITIAL .\n */\n    void wcsbthrestart  (FILE * input_file )\n{\n    \n\tif ( ! YY_CURRENT_BUFFER ){\n        wcsbthensure_buffer_stack ();\n\t\tYY_CURRENT_BUFFER_LVALUE =\n            wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE );\n\t}\n\n\twcsbth_init_buffer(YY_CURRENT_BUFFER,input_file );\n\twcsbth_load_buffer_state( );\n}\n\n/** Switch to a different input buffer.\n * @param new_buffer The new input buffer.\n * \n */\n    void wcsbth_switch_to_buffer  (YY_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\twcsbthpop_buffer_state();\n\t *\t\twcsbthpush_buffer_state(new_buffer);\n     */\n\twcsbthensure_buffer_stack ();\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*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\twcsbth_load_buffer_state( );\n\n\t/* We don't actually know whether we did this switch during\n\t * EOF (wcsbthwrap()) processing, but the only time this flag\n\t * is looked at is after wcsbthwrap() is called, so it's safe\n\t * to go ahead and always set it.\n\t */\n\t(yy_did_buffer_switch_on_eof) = 1;\n}\n\nstatic void wcsbth_load_buffer_state  (void)\n{\n    \t(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\n\t(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\n\twcsbthin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\n\t(yy_hold_char) = *(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 * \n * @return the allocated buffer state.\n */\n    YY_BUFFER_STATE wcsbth_create_buffer  (FILE * file, int  size )\n{\n\tYY_BUFFER_STATE b;\n    \n\tb = (YY_BUFFER_STATE) wcsbthalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbth_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 *) wcsbthalloc(b->yy_buf_size + 2  );\n\tif ( ! b->yy_ch_buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbth_create_buffer()\" );\n\n\tb->yy_is_our_buffer = 1;\n\n\twcsbth_init_buffer(b,file );\n\n\treturn b;\n}\n\n/** Destroy the buffer.\n * @param b a buffer created with wcsbth_create_buffer()\n * \n */\n    void wcsbth_delete_buffer (YY_BUFFER_STATE  b )\n{\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\twcsbthfree((void *) b->yy_ch_buf  );\n\n\twcsbthfree((void *) b  );\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 wcsbthrestart() or at EOF.\n */\n    static void wcsbth_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\n\n{\n\tint oerrno = errno;\n    \n\twcsbth_flush_buffer(b );\n\n\tb->yy_input_file = file;\n\tb->yy_fill_buffer = 1;\n\n    /* If b is the current buffer, then wcsbth_init_buffer was _probably_\n     * called from wcsbthrestart() 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 * \n */\n    void wcsbth_flush_buffer (YY_BUFFER_STATE  b )\n{\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\twcsbth_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 wcsbthpush_buffer_state (YY_BUFFER_STATE new_buffer )\n{\n    \tif (new_buffer == NULL)\n\t\treturn;\n\n\twcsbthensure_buffer_stack();\n\n\t/* This block is copied from wcsbth_switch_to_buffer. */\n\tif ( YY_CURRENT_BUFFER )\n\t\t{\n\t\t/* Flush out information for old buffer. */\n\t\t*(yy_c_buf_p) = (yy_hold_char);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\n\t\tYY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\n\t\t}\n\n\t/* Only push if top exists. Otherwise, replace top. */\n\tif (YY_CURRENT_BUFFER)\n\t\t(yy_buffer_stack_top)++;\n\tYY_CURRENT_BUFFER_LVALUE = new_buffer;\n\n\t/* copied from wcsbth_switch_to_buffer. */\n\twcsbth_load_buffer_state( );\n\t(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 *  \n */\nvoid wcsbthpop_buffer_state (void)\n{\n    \tif (!YY_CURRENT_BUFFER)\n\t\treturn;\n\n\twcsbth_delete_buffer(YY_CURRENT_BUFFER );\n\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\tif ((yy_buffer_stack_top) > 0)\n\t\t--(yy_buffer_stack_top);\n\n\tif (YY_CURRENT_BUFFER) {\n\t\twcsbth_load_buffer_state( );\n\t\t(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 wcsbthensure_buffer_stack (void)\n{\n\tyy_size_t num_to_alloc;\n    \n\tif (!(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\t\tnum_to_alloc = 1;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsbthalloc\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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbthensure_buffer_stack()\" );\n\t\t\t\t\t\t\t\t  \n\t\tmemset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\n\t\t\t\t\n\t\t(yy_buffer_stack_max) = num_to_alloc;\n\t\t(yy_buffer_stack_top) = 0;\n\t\treturn;\n\t}\n\n\tif ((yy_buffer_stack_top) >= ((yy_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 = (yy_buffer_stack_max) + grow_size;\n\t\t(yy_buffer_stack) = (struct yy_buffer_state**)wcsbthrealloc\n\t\t\t\t\t\t\t\t((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);\n\t\tif ( ! (yy_buffer_stack) )\n\t\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbthensure_buffer_stack()\" );\n\n\t\t/* zero only the new slots.*/\n\t\tmemset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\n\t\t(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 * \n * @return the newly allocated buffer state object. \n */\nYY_BUFFER_STATE wcsbth_scan_buffer  (char * base, yy_size_t  size )\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 0;\n\n\tb = (YY_BUFFER_STATE) wcsbthalloc(sizeof( struct yy_buffer_state )  );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbth_scan_buffer()\" );\n\n\tb->yy_buf_size = 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 = 0;\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\twcsbth_switch_to_buffer(b  );\n\n\treturn b;\n}\n\n/** Setup the input buffer state to scan a string. The next call to wcsbthlex() will\n * scan from a @e copy of @a str.\n * @param yystr 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 *       wcsbth_scan_bytes() instead.\n */\nYY_BUFFER_STATE wcsbth_scan_string (yyconst char * yystr )\n{\n    \n\treturn wcsbth_scan_bytes(yystr,strlen(yystr) );\n}\n\n/** Setup the input buffer state to scan the given bytes. The next call to wcsbthlex() 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 * \n * @return the newly allocated buffer state object.\n */\nYY_BUFFER_STATE wcsbth_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )\n{\n\tYY_BUFFER_STATE b;\n\tchar *buf;\n\tyy_size_t n;\n\tyy_size_t i;\n    \n\t/* Get memory for full buffer, including space for trailing EOB's. */\n\tn = _yybytes_len + 2;\n\tbuf = (char *) wcsbthalloc(n  );\n\tif ( ! buf )\n\t\tYY_FATAL_ERROR( \"out of dynamic memory in wcsbth_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 = wcsbth_scan_buffer(buf,n );\n\tif ( ! b )\n\t\tYY_FATAL_ERROR( \"bad buffer in wcsbth_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 yy_fatal_error (yyconst char* msg )\n{\n    \t(void) fprintf( 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 wcsbthtext. */ \\\n        int yyless_macro_arg = (n); \\\n        YY_LESS_LINENO(yyless_macro_arg);\\\n\t\twcsbthtext[wcsbthleng] = (yy_hold_char); \\\n\t\t(yy_c_buf_p) = wcsbthtext + yyless_macro_arg; \\\n\t\t(yy_hold_char) = *(yy_c_buf_p); \\\n\t\t*(yy_c_buf_p) = '\\0'; \\\n\t\twcsbthleng = yyless_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 wcsbthget_lineno  (void)\n{\n        \n    return wcsbthlineno;\n}\n\n/** Get the input stream.\n * \n */\nFILE *wcsbthget_in  (void)\n{\n        return wcsbthin;\n}\n\n/** Get the output stream.\n * \n */\nFILE *wcsbthget_out  (void)\n{\n        return wcsbthout;\n}\n\n/** Get the length of the current token.\n * \n */\nyy_size_t wcsbthget_leng  (void)\n{\n        return wcsbthleng;\n}\n\n/** Get the current token.\n * \n */\n\nchar *wcsbthget_text  (void)\n{\n        return wcsbthtext;\n}\n\n/** Set the current line number.\n * @param line_number\n * \n */\nvoid wcsbthset_lineno (int  line_number )\n{\n    \n    wcsbthlineno = 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 wcsbth_switch_to_buffer\n */\nvoid wcsbthset_in (FILE *  in_str )\n{\n        wcsbthin = in_str ;\n}\n\nvoid wcsbthset_out (FILE *  out_str )\n{\n        wcsbthout = out_str ;\n}\n\nint wcsbthget_debug  (void)\n{\n        return wcsbth_flex_debug;\n}\n\nvoid wcsbthset_debug (int  bdebug )\n{\n        wcsbth_flex_debug = bdebug ;\n}\n\nstatic int yy_init_globals (void)\n{\n        /* Initialization is the same as for the non-reentrant scanner.\n     * This function is called from wcsbthlex_destroy(), so don't allocate here.\n     */\n\n    (yy_buffer_stack) = 0;\n    (yy_buffer_stack_top) = 0;\n    (yy_buffer_stack_max) = 0;\n    (yy_c_buf_p) = (char *) 0;\n    (yy_init) = 0;\n    (yy_start) = 0;\n\n/* Defined in main.c */\n#ifdef YY_STDINIT\n    wcsbthin = stdin;\n    wcsbthout = stdout;\n#else\n    wcsbthin = (FILE *) 0;\n    wcsbthout = (FILE *) 0;\n#endif\n\n    /* For future reference: Set errno on error, since we are called by\n     * wcsbthlex_init()\n     */\n    return 0;\n}\n\n/* wcsbthlex_destroy is for both reentrant and non-reentrant scanners. */\nint wcsbthlex_destroy  (void)\n{\n    \n    /* Pop the buffer stack, destroying each element. */\n\twhile(YY_CURRENT_BUFFER){\n\t\twcsbth_delete_buffer(YY_CURRENT_BUFFER  );\n\t\tYY_CURRENT_BUFFER_LVALUE = NULL;\n\t\twcsbthpop_buffer_state();\n\t}\n\n\t/* Destroy the stack itself. */\n\twcsbthfree((yy_buffer_stack) );\n\t(yy_buffer_stack) = NULL;\n\n    /* Reset the globals. This is important in a non-reentrant scanner so the next time\n     * wcsbthlex() is called, initialization will occur. */\n    yy_init_globals( );\n\n    return 0;\n}\n\n/*\n * Internal utility routines.\n */\n\n#ifndef yytext_ptr\nstatic void yy_flex_strncpy (char* s1, yyconst 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 YY_NEED_STRLEN\nstatic int yy_flex_strlen (yyconst 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 *wcsbthalloc (yy_size_t  size )\n{\n\treturn (void *) malloc( size );\n}\n\nvoid *wcsbthrealloc  (void * ptr, yy_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 wcsbthfree (void * ptr )\n{\n\tfree( (char *) ptr );\t/* see wcsbthrealloc() for (char *) cast */\n}\n\n#define YYTABLES_NAME \"yytables\"\n\n#line 2484 \"wcsbth.l\"\n\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  int ialt, icol, mask, ncol;\n\n  if (a == 0) {\n    /* Keywords such as DATE-OBS go along for the ride. */\n    return 0;\n  }\n\n  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 2;\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 2;\n    }\n\n    /* Since realloc() doesn't initialize the extra memory. */\n    for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) {\n      for (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  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    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 *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0;\n  struct wcsprm *wcsp;\n\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  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 (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  for (ialt = 0; ialt < 27; ialt++) {\n    inherit[ialt] = 0;\n\n    for (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 2;\n    }\n\n    /* Record the current values of NPVMAX and NPSMAX. */\n    npvmax = wcsnpv(-1);\n    npsmax = wcsnps(-1);\n\n    /* Initialize each wcsprm struct. */\n    wcsp = *wcs;\n    *nwcs = 0;\n    for (icol = 0; icol <= ncol; icol++) {\n      for (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          wcsnpv(alts->npv[icol][ialt]);\n          wcsnps(alts->nps[icol][ialt]);\n          if ((status = wcsini(1, (int)(alts->arridx[icol][ialt]), wcsp))) {\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 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 (ialt = 0; ialt < 27; ialt++) {\n      if (alts->pixidx[ialt]) {\n        /* Pixel lists representations. */\n        wcsp->flag = -1;\n        wcsnpv(alts->pixnpv[ialt]);\n        wcsnps(alts->pixnps[ialt]);\n        if ((status = wcsini(1, (int)(alts->pixidx[ialt]), wcsp))) {\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 the pixel list column numbers. */\n        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    /* Restore the original values of NPVMAX and NPSMAX. */\n    wcsnpv(npvmax);\n    wcsnps(npsmax);\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  int iwcs;\n\n  if (!wcs) return 0x0;\n\n  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  int ix;\n  struct wcsprm *wcsp;\n\n  if (!wcs) return 0;\n\n  wcsp = wcs;\n  if (a != ' ') {\n    wcsp += alts->pixidx[a-'A'+1];\n  }\n\n  for (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 EPOCHa keywords.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_epoch(double *equinox, 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, double vsource)\n\n{\n  double beta, 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    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* Tie up loose ends.\n*---------------------------------------------------------------------------*/\n\nint wcsbth_final(\n  struct wcsbth_alts *alts,\n  int *nwcs,\n  struct wcsprm **wcs)\n\n{\n  int ialt, status;\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 (ialt = 0; ialt < *nwcs; ialt++) {\n    /* Interpret -TAB header keywords. */\n    if ((status = wcstab(*wcs+ialt))) {\n       wcsvfree(nwcs, wcs);\n       return status;\n    }\n  }\n\n  return 0;\n}\n\n"},{"id":13655,"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;\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\nextern int 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_TYPEDEF_FF_SIZE_T\n#define FF_TYPEDEF_FF_SIZE_T\ntypedef size_t ff_size_t;\n#endif\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\tint 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 int ff_n_chars;\t\t/* number of characters read into ff_ch_buf */\nint 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,int 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 = (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 26\n#define FF_END_OF_BUFFER 27\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[160] =\n    {   0,\n        0,    0,   27,   25,    1,   24,   15,   25,   25,   25,\n       25,   25,   25,   25,    7,    5,   21,   25,   20,   10,\n       10,   10,   10,    6,   10,   10,   10,   10,   10,   14,\n       10,   10,   10,   10,   10,   10,   10,   25,    1,   19,\n        0,    9,    0,    8,    0,   10,   17,    0,    0,    0,\n        0,    0,    0,    0,   14,    0,    7,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    7,\n        5,    0,   23,   18,   22,   10,   10,   10,    2,   10,\n       10,   10,    4,   10,   10,   10,   10,    3,   10,   10,\n       10,   10,   10,   10,   10,   10,   10,   10,   16,    0,\n\n        8,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,    0,    0,    7,   11,   10,\n       20,   21,   10,   10,   10,    0,    0,    0,    0,    0,\n        0,    0,    0,    0,    0,   15,    0,    0,   12,    0,\n        0,    0,    0,    0,    0,    0,   13,    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,   15,   16,\n       16,   16,   16,   16,   16,   17,   17,    1,    1,   18,\n       19,   20,    1,    1,   21,   22,   23,   24,   25,   26,\n       27,   28,   29,   30,   30,   31,   30,   32,   33,   30,\n       34,   35,   30,   36,   37,   30,   30,   38,   30,   30,\n        1,    1,    1,   39,   40,    1,   41,   42,   23,   43,\n\n       44,   45,   46,   28,   47,   30,   30,   48,   30,   49,\n       50,   30,   51,   52,   30,   53,   54,   30,   30,   38,\n       30,   30,    1,   55,    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[56] =\n    {   0,\n        1,    1,    2,    1,    1,    1,    3,    1,    1,    1,\n        1,    1,    1,    1,    4,    4,    4,    1,    1,    1,\n        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,\n        4,    4,    4,    4,    4,    4,    4,    4,    1,    4,\n        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,\n        4,    4,    4,    4,    1\n    } ;\n\nstatic ffconst flex_int16_t ff_base[167] =\n    {   0,\n        0,    0,  367,  368,  364,  368,  346,  359,  356,  355,\n      353,  351,   32,  347,   66,  103,  339,   44,  338,   25,\n       52,  316,   26,  315,   34,  133,   48,   61,  125,  368,\n        0,   29,   45,   60,   81,   82,   93,  299,  351,  368,\n      347,  368,  344,  343,  342,  368,  368,  339,  314,  315,\n      313,  294,  295,  293,  368,  121,  164,  307,  301,   70,\n      117,   43,  296,  276,  271,   58,   86,   79,  269,  152,\n      168,  181,  368,  368,  368,  151,  162,    0,  180,  189,\n      190,  191,  309,  196,  199,  205,  204,  211,  214,  207,\n      223,  224,  232,  238,  243,  245,  222,  246,  368,  311,\n\n      310,  279,  282,  278,  259,  262,  258,  252,  286,  295,\n      294,  293,  292,  291,  290,  267,  288,  258,  285,  284,\n      278,  270,  268,  259,  218,  252,  264,  272,  368,  251,\n      368,  368,  260,  280,  283,  236,  222,  230,  193,  184,\n      212,  208,  202,  173,  156,  368,  133,  126,  368,  104,\n       98,  119,  132,   80,   94,   92,  368,   78,  368,  323,\n      325,  329,  333,   68,   67,  337\n    } ;\n\nstatic ffconst flex_int16_t ff_def[167] =\n    {   0,\n      159,    1,  159,  159,  159,  159,  159,  160,  161,  162,\n      159,  163,  159,  159,  159,  159,  159,  159,  159,  164,\n      164,  164,  164,  164,  164,  164,  164,  164,  164,  159,\n      165,  164,  164,  164,  164,  164,  164,  159,  159,  159,\n      160,  159,  166,  161,  162,  159,  159,  163,  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,  164,  164,  165,  164,  164,\n      164,  164,   26,  164,  164,  164,  164,  164,  164,  164,\n      164,  164,  164,  164,  164,  164,  164,  164,  159,  166,\n\n      166,  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,  164,\n      159,  159,  164,  164,  164,  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,    0,  159,\n      159,  159,  159,  159,  159,  159\n    } ;\n\nstatic ffconst flex_int16_t ff_nxt[424] =\n    {   0,\n        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,\n        4,   14,    4,   15,   16,   16,   16,   17,   18,   19,\n       20,   21,   22,   22,   23,   24,   25,   26,   22,   22,\n       27,   28,   29,   22,   22,   24,   22,   22,   30,   31,\n       32,   21,   22,   33,   24,   34,   22,   35,   36,   37,\n       22,   22,   24,   22,   38,   49,   77,   50,   81,   80,\n       51,   73,   74,   75,   78,   78,   79,  115,   78,   82,\n       78,   76,   84,   78,   52,  116,   53,   90,   54,   56,\n       57,   57,   57,   85,   78,   86,   58,   78,  157,   79,\n       59,   78,   60,   87,  111,   91,   61,   62,   63,   78,\n\n       78,  120,  157,   92,  157,  112,   64,   88,   88,   65,\n      121,   66,   93,   67,   68,   69,   70,   71,   71,   71,\n       78,   78,  124,  158,   94,   96,   72,   72,  125,  122,\n       88,   97,   78,   95,   56,  108,  108,  108,  123,   88,\n       88,  113,  157,  156,   98,   72,   72,   83,   83,   83,\n      155,  154,  114,   83,   83,   83,   83,   83,   83,   89,\n      129,  153,   88,  152,   78,   56,   57,   57,   57,  146,\n       83,  129,   78,   83,   83,   83,   83,   83,   57,   57,\n       57,   70,   71,   71,   71,  130,   47,   72,   72,  129,\n       78,   72,   72,  127,   79,  128,  128,  128,  129,  129,\n\n      129,   78,   74,   75,  131,  129,   72,   72,  129,   73,\n       72,   72,  132,  129,  129,  146,  129,   79,   40,   78,\n      129,   47,  149,  129,  151,   88,   88,   99,   78,   78,\n       78,  129,  129,  129,  150,   78,   74,   75,   78,  133,\n      149,  129,  148,   78,   78,  131,   78,  129,   88,  134,\n       78,   73,  129,   78,  129,  129,  132,  147,   40,   99,\n      129,   78,   78,   78,   47,   99,  108,  108,  108,  129,\n      145,   78,   40,  146,  135,   72,   72,   78,  128,  128,\n      128,  132,   78,   73,   78,   78,  128,  128,  128,  129,\n       78,  131,  129,   47,   72,   72,  146,   75,   74,   78,\n\n      144,   99,  143,   40,  132,   73,  131,   75,   74,  142,\n      141,  140,  139,  138,  137,  136,  101,  101,  129,   78,\n      126,  119,   78,   41,  118,   41,   41,   44,   44,   45,\n      117,   45,   45,   48,  110,   48,   48,  100,  109,  100,\n      100,  107,  106,  105,  104,  103,  102,   42,   46,  159,\n      101,   42,   39,   99,   78,   78,   75,   73,   55,   42,\n       47,   46,   43,   42,   40,   39,  159,    3,  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\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\n    } ;\n\nstatic ffconst flex_int16_t ff_chk[424] =\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,   13,   20,   13,   25,   23,\n       13,   18,   18,   18,   20,   23,   21,   62,   32,   25,\n      165,  164,   27,   25,   13,   62,   13,   32,   13,   15,\n       15,   15,   15,   27,   33,   28,   15,   27,  158,   21,\n       15,   21,   15,   28,   60,   33,   15,   15,   15,   34,\n\n       28,   66,  156,   34,  155,   60,   15,   37,   37,   15,\n       66,   15,   34,   15,   15,   15,   16,   16,   16,   16,\n       35,   36,   68,  154,   35,   36,   16,   16,   68,   67,\n       37,   36,   37,   35,   56,   56,   56,   56,   67,   29,\n       29,   61,  153,  152,   37,   16,   16,   26,   26,   26,\n      151,  150,   61,   26,   26,   26,   26,   26,   26,   29,\n       76,  148,   29,  147,   29,   70,   70,   70,   70,  145,\n       26,   77,   26,   26,   26,   26,   26,   26,   57,   57,\n       57,   71,   71,   71,   71,   77,  144,   57,   57,   79,\n       76,   71,   71,   72,   79,   72,   72,   72,   80,   81,\n\n       82,   77,   80,   81,   82,   84,   57,   57,   85,   84,\n       71,   71,   85,   87,   86,  143,   90,   79,   86,   79,\n       88,  142,  141,   89,  140,   88,   88,   89,   80,   81,\n       82,   97,   91,   92,  139,   84,   91,   92,   85,   87,\n      138,   93,  137,   87,   86,   93,   90,   94,   88,   90,\n       88,   94,   95,   89,   96,   98,   95,  136,   96,   98,\n      130,   97,   91,   92,  130,  126,  108,  108,  108,  133,\n      125,   93,  124,  133,   97,  108,  108,   94,  127,  127,\n      127,  123,   95,  122,   96,   98,  128,  128,  128,  134,\n      130,  121,  135,  134,  108,  108,  135,  120,  119,  133,\n\n      118,  117,  116,  115,  114,  113,  112,  111,  110,  109,\n      107,  106,  105,  104,  103,  102,  101,  100,   83,  134,\n       69,   65,  135,  160,   64,  160,  160,  161,  161,  162,\n       63,  162,  162,  163,   59,  163,  163,  166,   58,  166,\n      166,   54,   53,   52,   51,   50,   49,   48,   45,   44,\n       43,   41,   39,   38,   24,   22,   19,   17,   14,   12,\n       11,   10,    9,    8,    7,    5,    3,  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\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\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 712 \"<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\nint 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 do { if (fwrite( fftext, ffleng, 1, ffout )) {} } while (0)\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\tunsigned 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 142 \"eval.l\"\n\n\n#line 897 \"<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 >= 160 )\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] != 368 );\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 144 \"eval.l\"\n;\n\tFF_BREAK\ncase 2:\nFF_RULE_SETUP\n#line 145 \"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 155 \"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 215 \"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 306 \"eval.l\"\n{\n                  fflval.lng = atol(fftext);\n\t\t  return( LONG );\n\t\t}\n\tFF_BREAK\ncase 6:\nFF_RULE_SETUP\n#line 310 \"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 7:\nFF_RULE_SETUP\n#line 317 \"eval.l\"\n{\n                  fflval.dbl = atof(fftext);\n\t\t  return( DOUBLE );\n\t\t}\n\tFF_BREAK\ncase 8:\nFF_RULE_SETUP\n#line 321 \"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 9:\nFF_RULE_SETUP\n#line 349 \"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 10:\nFF_RULE_SETUP\n#line 366 \"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 11:\nFF_RULE_SETUP\n#line 378 \"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,\"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 12:\nFF_RULE_SETUP\n#line 405 \"eval.l\"\n{ return( INTCAST ); }\n\tFF_BREAK\ncase 13:\nFF_RULE_SETUP\n#line 406 \"eval.l\"\n{ return( FLTCAST ); }\n\tFF_BREAK\ncase 14:\nFF_RULE_SETUP\n#line 407 \"eval.l\"\n{ return( POWER   ); }\n\tFF_BREAK\ncase 15:\nFF_RULE_SETUP\n#line 408 \"eval.l\"\n{ return( NOT     ); }\n\tFF_BREAK\ncase 16:\nFF_RULE_SETUP\n#line 409 \"eval.l\"\n{ return( OR      ); }\n\tFF_BREAK\ncase 17:\nFF_RULE_SETUP\n#line 410 \"eval.l\"\n{ return( AND     ); }\n\tFF_BREAK\ncase 18:\nFF_RULE_SETUP\n#line 411 \"eval.l\"\n{ return( EQ      ); }\n\tFF_BREAK\ncase 19:\nFF_RULE_SETUP\n#line 412 \"eval.l\"\n{ return( NE      ); }\n\tFF_BREAK\ncase 20:\nFF_RULE_SETUP\n#line 413 \"eval.l\"\n{ return( GT      ); }\n\tFF_BREAK\ncase 21:\nFF_RULE_SETUP\n#line 414 \"eval.l\"\n{ return( LT      ); }\n\tFF_BREAK\ncase 22:\nFF_RULE_SETUP\n#line 415 \"eval.l\"\n{ return( GTE     ); }\n\tFF_BREAK\ncase 23:\nFF_RULE_SETUP\n#line 416 \"eval.l\"\n{ return( LTE     ); }\n\tFF_BREAK\ncase 24:\n/* rule 24 can match eol */\nFF_RULE_SETUP\n#line 417 \"eval.l\"\n{ return( '\\n'    ); }\n\tFF_BREAK\ncase 25:\nFF_RULE_SETUP\n#line 418 \"eval.l\"\n{ return( fftext[0] ); }\n\tFF_BREAK\ncase 26:\nFF_RULE_SETUP\n#line 419 \"eval.l\"\nECHO;\n\tFF_BREAK\n#line 1361 \"<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\tint 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\tint 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), (size_t) 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 >= 160 )\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 >= 160 )\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 == 159);\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 int 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\tint 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 EOF;\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\tint 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, int  _ffbytes_len )\n{\n\tFF_BUFFER_STATE b;\n\tchar *buf;\n\tff_size_t n;\n\tint 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 */\nint 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 419 \"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":13656,"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 == 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 == 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 == 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 == 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 == 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 == 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 == TLONGLONG)\n    {\n        ffpssjj(fptr, 1, naxis, naxes, blc, trc,\n               (LONGLONG *) array, status);\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 == 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 == 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    strcpy(col->colname, colname);\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    strcpy(col->colname, colname);\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, 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      sprintf(message,\n              \"Variable length array not allowed for output column number %d (ffiter)\",\n                    jj + 1);\n\t    } else {\n            sprintf(message,\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                sprintf(message,\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                sprintf(message,\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                    sprintf(message,\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                sprintf(message,\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        sprintf(message,\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\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            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          sprintf(message,\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":13657,"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                fflongfi8(&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                sprintf(message, \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          sprintf(message,\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 fflongfi8(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 == 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 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 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 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 to compressed image is not supported\");\n\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                sprintf(message, \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          sprintf(message,\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 == 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":13658,"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 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, 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, 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":13659,"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) 3.41;\n\n/*       Nov 2016\n\n   Previous releases:\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 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[81], 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                    sprintf(msg,\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            sprintf(msg, \"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[81];\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            sprintf(msg, \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        strcat(msg, \" (NULL char.)\");\n            else if (card[ii] == 9)\n\t        strcat(msg, \" (TAB char.)\");\n            else if (card[ii] == 10)\n\t        strcat(msg, \" (Line Feed char.)\");\n            else if (card[ii] == 11)\n\t        strcat(msg, \" (Vertical Tab)\");\n            else if (card[ii] == 12)\n\t        strcat(msg, \" (Form Feed char.)\");\n            else if (card[ii] == 13)\n\t        strcat(msg, \" (Carriage Return)\");\n            else if (card[ii] == 27)\n\t        strcat(msg, \" (Escape char.)\");\n            else if (card[ii] == 127)\n\t        strcat(msg, \" (Delete char.)\");\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            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  Note: this allows keyword names longer than 8 characters.\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    sprintf(suffix, \"%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\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    sprintf(keyname, \"%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;\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        if (len < 8)  /* not a blank name? */\n        {\n          len = strcspn(tok, \" =\");  /* length of name */\n          if (len >= FLEN_KEYWORD)\n            return(*status = BAD_KEYCHAR);\n\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\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        if (len > 40)  /* name has to fit on columns 41-80 of card */\n          return(*status = BAD_KEYCHAR);\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+1); /* copy len+1 to get terminator */\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, 73);\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          while (more)\n          {\n            tok++;  /* temporarily move past the quote char */\n            len = strcspn(tok, \"'\");  /* length of quoted string */\n            tok--;\n            strncat(value, tok, 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\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              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: 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\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; 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 (outrec[0]) {\n\tffprec(outfptr, outrec, status); /* copy the keyword */\n\trec[8] = 0; outrec[8] = 0;\n      } else {\n\trec[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    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        sprintf(message,\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        sprintf(message,\"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    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        sscanf(form,\"%ld\", &repeat);  /* read repeat count */\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] == '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        sprintf(message,\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    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] == '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        sprintf(message,\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              sprintf(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        /*  simply reuse the TLONG values */\n        min_val = -2147483648.0;\n        max_val =  2147483647.0;\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       (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 {  /* exceeds the range of a 32-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[81];\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       sprintf(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            sprintf(message,\"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            sprintf(message,\"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            sprintf(message,\"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            sprintf(message,\"Column %d is too wide to fit in table (ffainit)\",\n            ii+1);\n            ffpmsg(message);\n            sprintf(message, \" 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            sprintf(message,\"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        sprintf(message,\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\tsprintf(message,\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            sprintf(message,\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            sprintf(message,\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            sprintf(message,\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                sprintf(message,\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            sprintf(message,\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        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 - 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[81];\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) {\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          sprintf(message, \"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          sprintf(message, \"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        sprintf(message, \"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        sprintf(message, \"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        sprintf(message, \"Specified column number is out of range: %d\",\n                colnum);\n        ffpmsg(message);\n        sprintf(message, \"  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:  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       *repeat = *repeat / *twidth;  /* repeat = # of unit strings in field */\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       *maxelem = (DBUFFSIZE - 1)/ *twidth; /* leave room for final \\0 */\n       if (*maxelem == 0) {\n            sprintf(message,\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            sprintf(message,\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                       sprintf(message,\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                sprintf(message, \n                  \"Attempted to read from group %ld of the HDU,\", (long) firstrow);\n                ffpmsg(message);\n\n                sprintf(message, \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                sprintf(message, \n                  \"  Image has  %ld elements;\", (long) *repeat);\n                ffpmsg(message);\n\n                sprintf(message, \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              sprintf(message, \n                \"  Table has %.0f rows with %.0f elements per row;\",\n                    (double) ((fptr->Fptr)->numrows), (double) *repeat);\n              ffpmsg(message);\n\n              sprintf(message, \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                sprintf(message,\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                  sprintf(message,\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            sprintf(message, \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            sprintf(message, \n         \"Starting element to read in variable length column is too large: %ld\",\n                    (long) firstelem);\n            ffpmsg(message);\n            sprintf(message, \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[81];\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        sprintf(message,\"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                sprintf(message,\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[81];\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        sprintf(message,\"Failed to create temporary file for the heap\");\n        ffpmsg(message);\n        return(*status);\n    }\n    if ( ffcopy(fptr, tptr, 0, status) )\n    {\n        sprintf(message,\"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        sprintf(message,\"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                  sprintf(message,\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        sprintf(message,\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;\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        sprintf(message,\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          strcat(newform, tform);\n\n          /* print as double, because the string-to-64-bit */\n          /* conversion is platform dependent (%lld, %ld, %I64d) */\n\n          sprintf(lenval, \"(%.0f)\", (double) maxlen);\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              sprintf(valstring, \"%.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                sprintf(message,\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(extname, hduname, 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(extname, hduname, 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 > 19) {\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*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 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 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,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        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        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":13660,"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"},{"id":13661,"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 *status);\nstatic int fits_ushort_to_int_inplace(unsigned short *intarray, long length, 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\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,  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    \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)->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         if (naxis < 2 ) {\n            ffpmsg(\"Hcompress cannot be used with 1-dimensional images (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);\n\n\t } else if  (naxes[0] < 4 || naxes[1] < 4) {\n            ffpmsg(\"Hcompress minimum image dimension is 4 pixels (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);\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) &&\n             (actual_tilesize[1] == 0 || actual_tilesize[1] == 1) ){\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 if (actual_tilesize[0] < 4 ||\n                   actual_tilesize[1] < 4) {\n\n            /* user-specified tile size is too small */\n            ffpmsg(\"Hcompress minimum tile dimension is 4 pixels (imcomp_init_table)\");\n            return(*status = DATA_COMPRESSION_ERR);\n\t}\n\t\n        /* check if requested tile size causes the last tile to to have less than 4 pixels */\n        remain = naxes[0] % (actual_tilesize[0]);  /* 1st dimension */\n        if (remain > 0 && remain < 4) {\n            (actual_tilesize[0])++; /* try increasing tile size by 1 */\n\t   \n            remain = naxes[0] % (actual_tilesize[0]);\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[1] % (actual_tilesize[1]);  /* 2nd dimension */\n        if (remain > 0 && remain < 4) {\n            (actual_tilesize[1])++; /* try increasing tile size by 1 */\n\t   \n            remain = naxes[1] % (actual_tilesize[1]);\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    /* 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        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            sprintf (keyname, \"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        sprintf (keyname, \"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;\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          if (anynul && datatype == TFLOAT) {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               tile[0], tile[1], 1, &fltnull, status);\n          } else if (anynul && datatype == TDOUBLE) {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               tile[0], tile[1], 1, &dblnull, status);\n          } else {\n              imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen,\n                               tile[0], tile[1], 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         ffpmsg(\"Lossless compression of floating point images must use GZIP (imcomp_compress_tile)\");\n         return(*status = DATA_COMPRESSION_ERR);\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, 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 {  /* 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, 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, 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                 /* have to convert usbuff to an I*4 array, in place */\n                 /* usbuff must have been allocated large enough to do this */\n                 fits_ushort_to_int_inplace(usbuff, tilelen, status);\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;\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              /* 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    tlpixel[0] - tfpixel[0] + 1,\n\t\t\t\t    tlpixel[1] - tfpixel[1] + 1,\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;\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, doffset;\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    /* 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    } else {\n\n        if (!FSTRCMP(value, \"NONE\") ) {\n            (infptr->Fptr)->quantize_level = NO_QUANTIZE;\n       } 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    /* 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,  \"ZBITPIX\",  &(infptr->Fptr)->zbitpix,  \n               NULL, status) > 0)\n    {\n        ffpmsg(\"required ZBITPIX compression keyword not found\");\n        return(*status);\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        sprintf (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\tsprintf (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        if (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    sprintf(card2, \"  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 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            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                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 *) 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                  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\t        if (*status == NUM_OVERFLOW) *status = 0;\n\t    }\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  sprintf(results[ii],\"%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 algorthm\");\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 algorthm\");\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\tsprintf(tempstring,\" r=%6.2f\",cratio[ii]);\n\t\tstrcat(results[ii],tempstring);\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    sprintf(tempstring,\" r=%6.2f\",cratio[ii]);\n\t    strcat(results[ii],tempstring);\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 algorthm\");\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 algorthm\");\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 *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] = shortarray[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_ushort_to_int_inplace(unsigned short *ushortarray, long length, \n                                      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] = ushortarray[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_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"},{"id":13662,"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[81];\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                 sprintf(message,\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":13663,"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                sprintf(message, \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          sprintf(message,\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 == 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"},{"id":13664,"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        sprintf(message, \"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         sprintf(message,\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         sprintf(message,\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"},{"id":13665,"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                sprintf(message, \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          sprintf(message,\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 == 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 > DINT_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":13666,"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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 ( 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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclui).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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          sprintf(message, \"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":13667,"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 3.41\n#define CFITSIO_MINOR 41\n#define CFITSIO_MAJOR 3\n#define CFITSIO_SONAME 5\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#else                   /* newer versions do support 'long long' */\n    typedef long long LONGLONG; \n#endif\n\n#elif defined( __BORLANDC__)  /* for the Borland 5.5 compiler, in particular */\n    typedef __int64 LONGLONG;\n#else\n    typedef long long LONGLONG; \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 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\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    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\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 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 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 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 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 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 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 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 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 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 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 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);\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);\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);\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);\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);\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);\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 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 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 ffcprw(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,  float *amin, \n    float *amax, float *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_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);\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/*  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":13668,"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":13669,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /*------------------------------------------------------------------*/\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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcld).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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          sprintf(message, \"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"},{"id":13670,"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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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#endif\n"},{"id":13671,"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":"null","endLoc":137,"header":"def _hide_parent_artists(self)","id":13672,"name":"_hide_parent_artists","nodeType":"Function","startLoc":131,"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        self.yaxis.set_visible(False)"},{"id":13673,"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":13674,"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   float amin1, amin2, amin3, amin4;\n   float maxbin1, maxbin2, maxbin3, maxbin4;\n   float binsize1, binsize2, binsize3, binsize4;\n   int   wtrecip, wtcolnum;\n   float 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[30], *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;\n    char token[FLEN_VALUE];\n\n    if (*status > 0)\n        return(*status);\n\n    slen = fits_get_token(ptr, \" ,=:;\", token, &isanumber); /* get 1st token */\n\n    if (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        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\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        slen = fits_get_token(ptr, \" ,:;\", token, &isanumber); /* get token */\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 */\n        if (!isanumber)\n            strcpy(binname, token);\n        else\n            *binsizein =  strtod(token, NULL);\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                strcpy(minname, token);\n            else\n                *minin = strtod(token, NULL);\n        }\n    }\n\n    (*ptr)++;  /* skip the colon between the min and max values */\n    slen = fits_get_token(ptr, \" ,:;\", token, &isanumber); /* get token */\n\n    /* the token contains the max value */\n    if (slen)\n    {\n        if (!isanumber)\n            strcpy(maxname, token);\n        else\n            *maxin = strtod(token, NULL);\n    }\n\n    if (**ptr != ':')\n        return(*status);  /* reached the end; no binsize token */\n\n    (*ptr)++;  /* skip the colon between the max and binsize values */\n    slen = fits_get_token(ptr, \" ,:;\", token, &isanumber); /* get token */\n\n    /* the token contains the binsize value */\n    if (slen)\n    {\n        if (!isanumber)\n            strcpy(binname, token);\n        else\n            *binsizein = strtod(token, NULL);\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    float 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_binning(\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, TFLOAT, 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 = FLOATNULLVALUE;\n        }\n    }\n    else\n        weight = (float) weightin;\n\n    if (weight <= 0. && weight != FLOATNULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n        return(*status = URL_PARSE_ERROR);\n    }\n\n    if (recip && weight != FLOATNULLVALUE)\n       /* take reciprocal of weight */\n       weight = (float) (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_wcs(histptr, naxis, amin, binsize,  status);      \n    \n    /* now compute the output image by binning the column values */\n    if (fits_make_hist(*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    float 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_binning(\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, TFLOAT, 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 = FLOATNULLVALUE;\n        }\n    }\n    else\n        weight = (float) weightin;\n\n    if (weight <= 0. && weight != FLOATNULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n\t*status = URL_PARSE_ERROR;\n        return(NULL);\n    }\n\n    if (recip && weight != FLOATNULLVALUE)\n       /* take reciprocal of weight */\n       weight = (float) (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_wcs(histptr, naxis, amin, binsize,  status);      \n    \n    /* now compute the output image by binning the column values */\n    if (fits_make_hist(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    float amin[4], amax[4], binsize[4], maxbin[4];\n    float datamin = FLOATNULLVALUE, datamax = FLOATNULLVALUE;\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        strcat(errmsg, colname[ii]);\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        strcat(errmsg, colname[ii]);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* get the datatype of the column */\n      fits_get_coltype(*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        strcat(errmsg, colname[ii]);\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, TFLOAT, 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                strcat(errmsg, colname[ii]);\n                ffpmsg(errmsg);\n                return(*status);\n            }\n         }\n      }\n      else\n      {\n        amin[ii] = (float) minin[ii];\n      }\n\n      if (maxin[ii] == DOUBLENULLVALUE)\n      {\n        ffkeyn(\"TLMAX\", histData.hcolnum[ii], keyname, status);\n        if (ffgky(*fptr, TFLOAT, keyname, &amax[ii], NULL, status) > 0)\n        {\n          *status = 0;\n          if(datamax != FLOATNULLVALUE)  /* 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                 strcat(errmsg, colname[ii]);\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] = (float) 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] = (float) -binsizein[ii];  /* reverse the sign of binsize */\n      else\n          binsize[ii] =  (float) 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 && (float) imin == amin[ii] &&\n                               (float) imax == amax[ii] &&\n                               (float) 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] = (float) (haxes[ii] + 1.);  /* add 1. instead of .5 to avoid roundoff */\n\n        if (amin[ii] < amax[ii])\n        {\n          amin[ii] = (float) (amin[ii] - 0.5);\n          amax[ii] = (float) (amax[ii] + 0.5);\n        }\n        else\n        {\n          amin[ii] = (float) (amin[ii] + 0.5);\n          amax[ii] = (float) (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, TFLOAT, 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 = FLOATNULLVALUE;\n        }\n    }\n    else\n        histData.weight = (float) weightin;\n\n    if (histData.weight <= 0. && histData.weight != FLOATNULLVALUE)\n    {\n        ffpmsg(\"Illegal histogramming weighting factor <= 0.\");\n        return(*status = URL_PARSE_ERROR);\n    }\n\n    if (recip && histData.weight != FLOATNULLVALUE)\n       /* take reciprocal of weight */\n       histData.weight = (float) (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/*--------------------------------------------------------------------------*/\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    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    float 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          strcat(errmsg, colname[ii]);\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        strcat(errmsg, colname[ii]);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* get the datatype of the column */\n      fits_get_coltype(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        strcat(errmsg, colname[ii]);\n        ffpmsg(errmsg);\n        return(*status = BAD_DATATYPE);\n      }\n\n      /* ================================================================ */\n      /* get the minimum value */\n\n      datamin = FLOATNULLVALUE;\n      datamax = FLOATNULLVALUE;\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] = (float) minin[ii];\n      }\n      else\n      {\n        ffkeyn(\"TLMIN\", colnum[ii], keyname, status);\n        if (ffgky(fptr, TFLOAT, 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                strcat(errmsg, colname[ii]);\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] = (float) maxin[ii];\n      }\n      else\n      {\n        ffkeyn(\"TLMAX\", colnum[ii], keyname, status);\n        if (ffgky(fptr, TFLOAT, keyname, &amax[ii], NULL, status) > 0)\n        {\n          *status = 0;\n          if(datamax != FLOATNULLVALUE)  /* 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                 strcat(errmsg, colname[ii]);\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] = (float) 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 && (float) imin == amin[ii] &&\n                               (float) imax == amax[ii] &&\n                               (float) 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] = (float) (amin[ii] - 0.5);\n          amax[ii] = (float) (amax[ii] + 0.5);\n        }\n        else\n        {\n          amin[ii] = (float) (amin[ii] + 0.5);\n          amax[ii] = (float) (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   /*  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\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    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    float 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] = (float) 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_coltype(fptr, colnum[ii], &datatype, NULL, NULL, status);\n\n      if (datatype <= TLONG && (float) imin == tmin[ii] &&\n                               (float) imax == tmax[ii] &&\n                               (float) 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, float *datamin, \n                     float *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    float array[1000], nulval;\n\n    ffgky(fptr, TLONG, \"NAXIS2\", &nrows, NULL, status); /* no. of rows */\n\n    firstrow = 1;\n    nulval = FLOATNULLVALUE;\n    *datamin =  9.0E36F;\n    *datamax = -9.0E36F;\n\n    while(nrows)\n    {\n        ntodo = minvalue(nrows, 100);\n        ffgcv(fptr, TFLOAT, 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], TFLOAT, InputCol);\n    }\n    ncols = histData->haxis;\n\n    if (histData->weight == FLOATNULLVALUE)\n    {\n      fits_iter_set_by_num(&colpars[histData->haxis], histData->tblptr,\n\t\t\t   histData->wtcolnum, TFLOAT, 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    float pix, axisbin;\n    static float *col1, *col2, *col3, *col4; /* static to preserve values */\n    static float *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 = (float *) fits_iter_get_array(&colpars[0]);\n      if (histData.haxis > 1)\n      {\n        col2 = (float *) fits_iter_get_array(&colpars[1]);\n        incr2 = histData.haxis1;\n\n        if (histData.haxis > 2)\n        {\n          col3 = (float *) fits_iter_get_array(&colpars[2]);\n          incr3 = incr2 * histData.haxis2;\n\n          if (histData.haxis > 3)\n          {\n            col4 = (float *) 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 = (float *) 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] == FLOATNULLVALUE)  /* 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] == FLOATNULLVALUE)\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] == FLOATNULLVALUE)\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] == FLOATNULLVALUE)\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 != FLOATNULLVALUE) /* 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":13675,"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       sprintf(buf, \"%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   sprintf(segname+1,\"%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":13676,"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        sprintf(message,\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        sprintf(message,\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            sprintf(message,\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 (fficol)\");\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        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      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 sprintf is platform dependent ( %lld, %ld, %I64d ) */\n\n    sprintf(tfm,\"%.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, 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\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\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    else    /* 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        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        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    else\n    {\n        free(dvalues);\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;\n    unsigned char *buffer;\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    /* 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    /* copy the rows, 1 at a time */\n    jj = outnaxis2 + 1;\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    free(buffer);\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        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                  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 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":13677,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /*----------------------------------------------------------------------*/\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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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] < 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 == 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[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          sprintf(message, \"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /*----------------------------------------------------------------------*/\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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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] =  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] = 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[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          sprintf(message, \"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":13678,"name":"eval_tab.h","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"\n/* A Bison parser, made by GNU Bison 2.4.1.  */\n\n/* Skeleton interface for Bison's Yacc-like parsers in C\n   \n      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n   Free Software Foundation, 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\n/* Tokens.  */\n#ifndef FFTOKENTYPE\n# define FFTOKENTYPE\n   /* Put the tokens into the symbol table, so that GDB and other debuggers\n      know about them.  */\n   enum fftokentype {\n     BOOLEAN = 258,\n     LONG = 259,\n     DOUBLE = 260,\n     STRING = 261,\n     BITSTR = 262,\n     FUNCTION = 263,\n     BFUNCTION = 264,\n     IFUNCTION = 265,\n     GTIFILTER = 266,\n     REGFILTER = 267,\n     COLUMN = 268,\n     BCOLUMN = 269,\n     SCOLUMN = 270,\n     BITCOL = 271,\n     ROWREF = 272,\n     NULLREF = 273,\n     SNULLREF = 274,\n     OR = 275,\n     AND = 276,\n     NE = 277,\n     EQ = 278,\n     GTE = 279,\n     LTE = 280,\n     LT = 281,\n     GT = 282,\n     POWER = 283,\n     NOT = 284,\n     FLTCAST = 285,\n     INTCAST = 286,\n     UMINUS = 287,\n     DIFF = 288,\n     ACCUM = 289\n   };\n#endif\n/* Tokens.  */\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 REGFILTER 267\n#define COLUMN 268\n#define BCOLUMN 269\n#define SCOLUMN 270\n#define BITCOL 271\n#define ROWREF 272\n#define NULLREF 273\n#define SNULLREF 274\n#define OR 275\n#define AND 276\n#define NE 277\n#define EQ 278\n#define GTE 279\n#define LTE 280\n#define LT 281\n#define GT 282\n#define POWER 283\n#define NOT 284\n#define FLTCAST 285\n#define INTCAST 286\n#define UMINUS 287\n#define DIFF 288\n#define ACCUM 289\n\n\n\n\n#if ! defined FFSTYPE && ! defined FFSTYPE_IS_DECLARED\ntypedef union FFSTYPE\n{\n\n/* Line 1676 of yacc.c  */\n#line 192 \"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\n\n/* Line 1676 of yacc.c  */\n#line 130 \"y.tab.h\"\n} FFSTYPE;\n# define FFSTYPE_IS_TRIVIAL 1\n# define ffstype FFSTYPE /* obsolescent; will be withdrawn */\n# define FFSTYPE_IS_DECLARED 1\n#endif\n\nextern FFSTYPE fflval;\n\n\n"},{"col":4,"comment":"null","endLoc":123,"header":"def _display_world_coords(self, x, y)","id":13679,"name":"_display_world_coords","nodeType":"Function","startLoc":99,"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 \"%s %s (pixel)\" % (x, y)\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        xw = coords[self._x_index].format_coord(world[self._x_index])\n        yw = coords[self._y_index].format_coord(world[self._y_index])\n\n        if self._display_coords_index == 0:\n            system = \"world\"\n        else:\n            system = \"world, overlay {0}\".format(self._display_coords_index)\n\n        coord_string = \"%s %s (%s)\" % (xw, yw, system)\n\n        return coord_string"},{"id":13680,"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[81];\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\tsprintf(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\tsprintf(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[81];\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\tsprintf(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\tsprintf(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\tsprintf(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[81];\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\tsprintf(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    sprintf(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\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\t    else\n\t\tstr[0] = value[0];\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\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    sprintf (value,\"%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":13681,"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\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        sprintf(message, \"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    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\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\n             sprintf(tmpstr, cform, earray[jj]);\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\n             sprintf(tmpstr, cform, earray[jj]);\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\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\n             sprintf(tmpstr, cform, darray[jj]);\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\n             sprintf(tmpstr, cform, darray[jj]);\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          strcpy(tmpnull, nulval);\n          nulwidth = strlen(nulval);\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        sprintf(tmpstr, \"%20I64d\", llarray[ii]);\n#elif (USE_LL_SUFFIX == 1)\n        sprintf(tmpstr, \"%20lld\", llarray[ii]);\n#else\n        sprintf(tmpstr, \"%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\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\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          strcpy(tmpnull, nulval);\n          nulwidth = strlen(nulval);\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                sprintf(tmpstr, cform, (int) darray[ii]);\n              } else {\n                sprintf(tmpstr, 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        sprintf(message, \"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                     cptr = dispfmt;\n                     while(!isdigit((int) *cptr) && *cptr != '\\0') \n                         cptr++;\n\n                     *width = atoi(cptr);\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        sprintf(message, \"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         sprintf(message,\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":13682,"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\tsprintf(buf, \"%-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        sprintf(ngp_linkey.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  { sprintf(grnm, \"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        sprintf(ngp_linkey.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   if ((NULL == ff) || (NULL == ngp_template))\n     { *status = NGP_NUL_PTR;\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       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) return(*status);\t/* error here means file is corrupted */\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   if (NGP_OK != *status) return(*status);\n                                                                          \n   if (NGP_OK != (*status = ngp_include_file(ngp_template))) return(*status);\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  { sprintf(grnm, \"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   return(r);\n }\n"},{"id":13683,"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                                } 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":13684,"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                sprintf(message, \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          sprintf(message,\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 == 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 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":13685,"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                sprintf(message, \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         sprintf(message,\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 == 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":13686,"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        sprintf(datasum, \"%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":13687,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclsb).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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;\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          sprintf(message, \"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"},{"id":13688,"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":13689,"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               sprintf(tform,\"%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:      sprintf(tform,\"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            sprintf(tform,\"%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                  nullVal = LONG_MIN;\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         sprintf(msg, \"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         sprintf( parName, \"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         sprintf(temp, \"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      sprintf(temp, \"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      sprintf(temp,\"TZERO%d\",colnum);\n      istatus = 0;\n      if(fits_read_key(fptr,TDOUBLE,temp,&tzero,NULL,&istatus)) {\n          tzero = 0.0;\n      } \n      sprintf(temp,\"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\tsprintf(temp, \"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        sprintf(temp, \"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         sprintf(keyvalue, \"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      sprintf(msg,\"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            sprintf(msg, \"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            sprintf(msg, \"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           sprintf(msg, \"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                nullVal = LONG_MIN;\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         sprintf(msg, \"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":13690,"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\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\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#define NETTIMEOUT 180 /* in secs */\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\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 ftp_open_network(char *url, FILE **ftpfile, FILE **command, \n\t\t\t    int *sock);\n\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);\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\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 newfilename[MAXLEN];\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    goto error;\n  }\n\n  (void) signal(SIGALRM, signal_handler);\n  \n  /* Open the network connection */\n\n  /* Does the file have a .Z or .gz in it */\n  /* Also, if file has a '?' in it (probably cgi script) */\n  if (strstr(filename,\".Z\") || strstr(filename,\".gz\") || \n      strstr(filename,\"?\")) {\n    alarm(NETTIMEOUT);\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  } else {\n  \n    if (strlen(filename) >= MAXLEN - 4) {\n\t  ffpmsg(\"http file name is too long (http_open)\");\n          ffpmsg(filename);\n\t  goto error;\n    }\n  \n    alarm(NETTIMEOUT);\n    /* Try the .gz one */    \n    strcpy(newfilename,filename);\n    strcat(newfilename,\".gz\");\n    \n    if (http_open_network(newfilename,&httpfile,contentencoding,\n\t\t\t  &contentlength)) {\n      alarm(0);\n      /* Now the .Z one */\n      strcpy(newfilename,filename);\n      strcat(newfilename,\".Z\");\n      alarm(NETTIMEOUT);\n      if (http_open_network(newfilename,&httpfile,contentencoding,\n\t\t\t    &contentlength)) {\n\talarm(0);\n\talarm(NETTIMEOUT);\n\tif (http_open_network(filename,&httpfile,contentencoding,\n\t\t\t      &contentlength)) { \n\t  alarm(0);\n\t  ffpmsg(\"Unable to open http file (http_open)\");\n          ffpmsg(filename);\n\t  goto error;\n\t}\n      }\n    }\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*NETTIMEOUT,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n    \n    alarm(NETTIMEOUT*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      sprintf(errorstr,\"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(NETTIMEOUT);\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(NETTIMEOUT); /* 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/* 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 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  /* cfileio made a mistake, should set the netoufile first otherwise \n     we don't know where to write the output file */\n\n  flen = strlen(netoutfile);\n  if (!flen)  {\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    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* Open the http connectin */\n  alarm(NETTIMEOUT);\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(NETTIMEOUT);\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(NETTIMEOUT);\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  /* cfileio made a mistake, we need to know where to write the file */\n  flen = strlen(netoutfile);\n  if (!flen) {\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    goto error;\n  }\n\n  signal(SIGALRM, signal_handler);\n  \n  /* Open the network connection */\n  alarm(NETTIMEOUT);\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*NETTIMEOUT,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n\n    alarm(NETTIMEOUT*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      sprintf(errorstr,\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(NETTIMEOUT);\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 lenght 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 *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    sprintf(errorstr,\"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  /* 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      sprintf(errorstr,\"URL Parse Error (http_open) %s\",proxy);\n      ffpmsg(errorstr);\n      return (FILE_NOT_OPENED);\n    }\n    sock = NET_TcpConnect(phost,pport);\n  }\n  else\n    sock = NET_TcpConnect(host,port); \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    sprintf(tmpstr,\"GET http://%s:%-d%s HTTP/1.0\\r\\n\",host,port,fn);\n  else\n    sprintf(tmpstr,\"GET %s HTTP/1.0\\r\\n\",fn);\n\n  if (strcmp(userpass, \"\")) {\n    encode64(strlen(userpass), userpass, MAXLEN, tmpstr2);\n    sprintf(tmpstr1, \"Authorization: Basic %s\\r\\n\", tmpstr2);\n\n    if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n        return (FILE_NOT_OPENED);\n\n    strcat(tmpstr,tmpstr1);\n  }\n\n  sprintf(tmpstr1,\"User-Agent: HEASARC/CFITSIO/%-8.3f\\r\\n\",ffvers(&version));\n\n  if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n        return (FILE_NOT_OPENED);\n\n  strcat(tmpstr,tmpstr1);\n\n  /* HTTP 1.1 servers require the following 'Host: ' string */\n  sprintf(tmpstr1,\"Host: %s:%-d\\r\\n\\r\\n\",host,port);\n\n  if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1)\n        return (FILE_NOT_OPENED);\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    sprintf (errorstr,\"http header short (http_open_network) %s\",recbuf);\n    ffpmsg(errorstr);\n    fclose(*httpfile);\n    return (FILE_NOT_OPENED);\n  }\n  *contentlength = 0;\n  contentencoding[0] = '\\0';\n\n  /* Our choices are 200, ok, 301, temporary redirect, or 302 perm redirect */\n  sscanf(recbuf,\"%s %d\",tmpstr,&status);\n  if (status != 200){\n    if (status == 301 || status == 302) {\n      /* got a redirect */\n      if (status == 301) {\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      /* now, let's not write the most sophisticated parser here */\n\n      while (fgets(recbuf,MAXLEN,*httpfile)) {\n\tscratchstr = strstr(recbuf,\"<A HREF=\\\"\");\n\tif (scratchstr != NULL) {\n\t  /* Ok, we found the beginning of the anchor */\n\t  scratchstr += 9; /* skip the <A HREF=\" bits */\n\t  scratchstr += 7; /* skip http://, we die if it's really ftp:// */\n\t  strcpy(turl,ffstrtok(scratchstr,\"\\\"\",&saveptr));\n\t  sprintf(errorstr,\"to %s\\n\",turl);\n\t  ffpmsg(errorstr);\n\t  fclose (*httpfile);\n\t  return \n\t    http_open_network(turl,httpfile,contentencoding,contentlength);\n\t}\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/*    sprintf(errorstr, \n\t    \"(http_open_network) Status not 200, was %d\\nLine was %s\\n\",\n\t    status,recbuf); \n    ffpmsg(errorstr);\n*/\n    fclose(*httpfile);\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\tstrcpy(contentencoding,scratchstr);\n      }\n    }\n  }\n  \n  /* we're done, so return */\n  return 0;\n}\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\n  FILE *ftpfile;\n  FILE *command;\n  int sock;\n  char newfilename[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 (http_open)\");\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(NETTIMEOUT);\n  strcpy(newfilename,filename);\n  /* Does the file have a .Z or .gz in it */\n  if (strstr(newfilename,\".Z\") || strstr(newfilename,\".gz\")) {\n    alarm(NETTIMEOUT);\n    if (ftp_open_network(filename,&ftpfile,&command,&sock)) {\n\n      alarm(0);\n      ffpmsg(\"Unable to open ftp file (ftp_open)\");\n      ffpmsg(filename);\n      goto error;\n    } \n  } else {\n    /* Try the .gz one */\n    strcpy(newfilename,filename);\n    strcat(newfilename,\".gz\");\n    alarm(NETTIMEOUT);\n    if (ftp_open_network(newfilename,&ftpfile,&command,&sock)) {\n      \n      alarm(0);\n      strcpy(newfilename,filename);\n      strcat(newfilename,\".Z\");\n      alarm(NETTIMEOUT);\n      if (ftp_open_network(newfilename,&ftpfile,&command,&sock)) {\n\t\n\t/* Now as given */\n\talarm(0);\n\tstrcpy(newfilename,filename);\n\talarm(NETTIMEOUT);\n\tif (ftp_open_network(newfilename,&ftpfile,&command,&sock)) {\n\t  alarm(0);\n\t  ffpmsg(\"Unable to open ftp file (ftp_open)\");\n          ffpmsg(newfilename);\n\t  goto error;\n\t}\n      }\n    }\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(newfilename,\".gz\") || \n      strstr(newfilename,\".Z\") ||\n      ('\\037' == firstchar)) {\n    \n    status = 0;\n    /* A bit arbritary really, the user will probably hit ^C */\n    alarm(NETTIMEOUT*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(NETTIMEOUT);\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(NETTIMEOUT);\n    }\n  }\n\n  /* close and clean up */\n  fclose(ftpfile);\n  closeftpfile--;\n\n  NET_SendRaw(sock,\"QUIT\\n\",5,NET_DEFAULT);\n  fclose(command);\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  }\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 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 (http_open)\");\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(NETTIMEOUT);\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*NETTIMEOUT,\n       Given the choices for nettimeout above they'll probaby ^C before, but\n       it's always worth a shot*/\n\n    alarm(NETTIMEOUT*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(NETTIMEOUT);\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(NETTIMEOUT);\n    }\n    file_close(*handle);\n  }\n  fclose(ftpfile);\n  closeftpfile--;\n  \n  NET_SendRaw(sock,\"QUIT\\n\",5,NET_DEFAULT);\n  fclose(command);\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  }\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 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 (http_open)\");\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(NETTIMEOUT);\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(NETTIMEOUT);\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(NETTIMEOUT);\n    }\n\n    file_close(*handle);\n    closediskfile--;\n    fclose(ftpfile);\n    closeftpfile--;\n    /* Close down the ftp connection */\n    NET_SendRaw(sock,\"QUIT\\n\",5,NET_DEFAULT);\n    fclose(command);\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  }\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\nint 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 *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\n  /* parse the URL */\n  if (strlen(filename) > MAXLEN - 7) {\n    ffpmsg(\"ftp filename is too long (ftp_open)\");\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    sprintf(errorstr,\"URL Parse Error (ftp_open) %s\",filename);\n    ffpmsg(errorstr);\n    return (FILE_NOT_OPENED);\n  }\n#ifdef DEBUG\n  printf (\"proto, %s, host, %s, port %d, fn %s\\n\",proto,host,port,fn);\n#endif\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#ifdef DEBUG\n  printf(\"User %s pass %s\\n\",username,password); \n#endif\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)\");\n    return (FILE_NOT_OPENED);\n    \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_open)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* Send the user name and wait for the right response */\n  sprintf(tmpstr,\"USER %s\\n\",username);\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)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n    \n  }\n  \n  /* Send the password and wait for the right response */\n  sprintf(tmpstr,\"PASS %s\\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)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n  }\n  \n  \n  /* now do the cwd command */\n  newfn = strrchr(fn,'/');\n  if (newfn == NULL) {\n    strcpy(tmpstr,\"CWD /\\n\");\n    newfn = fn;\n  } else {\n    *newfn = '\\0';\n    newfn++;\n    if (strlen(fn) == 0) {\n      strcpy(tmpstr,\"CWD /\\n\");\n    } else {\n      /* remove the leading slash */\n      if (fn[0] == '/') {\n\tsprintf(tmpstr,\"CWD %s\\n\",&fn[1]);\n      } else {\n\tsprintf(tmpstr,\"CWD %s\\n\",fn);\n      } \n    }\n  }\n  \n#ifdef DEBUG\n  printf(\"CWD command is %s\\n\",tmpstr);\n#endif\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)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n  }\n  \n  if (!strlen(newfn)) {\n    ffpmsg(\"Null file name (ftp_open)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n  }\n  \n \n  /* Always use binary mode */\n  sprintf(tmpstr,\"TYPE I\\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)\");\n    fclose(*command);\n    return (FILE_NOT_OPENED);\n  }\n \n  status = NET_SendRaw(*sock,\"PASV\\n\",5,NET_DEFAULT);\n  if (!(fgets(recbuf,MAXLEN,*command))) {\n    ffpmsg (\"PASV error (ftp_open)\");\n    fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\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)\");\n      fclose(*command);\n      return (FILE_NOT_OPENED);\n    }\n    sscanf(tstr,\"%d\",&tmpint);\n    port += tmpint;\n    \n    \n    if (!strlen(newfn)) {\n      ffpmsg(\"Null file name (ftp_open)\");\n      fclose(*command);\n      return (FILE_NOT_OPENED);\n    }\n    \n\n#ifdef DEBUG\n    puts(\"connection to passive port\");\n#endif\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)\");\n      fclose(*command);\n      return (FILE_NOT_OPENED);\n    }\n\n    /* now we return */\n\n    /* Send the retrieve command */\n    sprintf(tmpstr,\"RETR %s\\n\",newfn);\n    status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT);\n\n#ifdef DEBUG\n    puts(\"Sent RETR command\");\n#endif\n    if (ftp_status(*command,\"150 \")) {\n    /*  ffpmsg (\"RETR error, most likely file is not there (ftp_open)\"); */\n      fclose(*command);\n#ifdef DEBUG\n      puts(\"File not there\");\n#endif\n      return (FILE_NOT_OPENED);\n    }\n    return 0;\n  }\n  \n  /* no passive mode */\n\n  NET_SendRaw(*sock,\"QUIT\\n\",5,NET_DEFAULT);\n  fclose(*command);\n  return (FILE_NOT_OPENED);\n}\n\n/*--------------------------------------------------------------------------*/\n/* return a socket which results from connection to hostname on port port */\nstatic int 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(\"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#ifdef DEBUG\n     printf (\"send raw, sent %d bytes\\n\",nsent);\n#endif\n   }\n#ifdef DEBUG\n   printf (\"send raw end, sent %d bytes\\n\",n);\n#endif\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    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    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    strcpy(fn,urlcopy);\n  }\n  free(urlcopyorig);\n  return 0;\n}\n\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\nint http_checkfile (char *urltype, char *infile, char *outfile1)\n{\n  char newinfile[MAXLEN];\n  FILE *httpfile;\n  char contentencoding[MAXLEN];\n  int contentlength;\n  \n  /* default to http:// if there is no output file */\n    \n  strcpy(urltype,\"http://\");\n\n  if (strlen(outfile1)) {\n    /* there is an output file */\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 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; don't open it */\n      strcpy(urltype,\"httpfile://\");\n      return 0;\n    }\n\n    if (!http_open_network(infile,&httpfile,contentencoding,&contentlength)) {\n      fclose(httpfile);\n      /* It's there, we're happy */\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      return 0;\n    }\n\n    /* Ok, let's try the .gz one */\n    strcpy(newinfile,infile);\n    strcat(newinfile,\".gz\");\n    if (!http_open_network(newinfile,&httpfile,contentencoding,\n\t\t\t   &contentlength)) {\n      fclose(httpfile);\n      strcpy(infile,newinfile);\n      /* It's there, we're happy, and, it's compressed  */\n      /* It's compressed */\n      if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\tstrcpy(urltype,\"httpcompress://\");\n      } else {\n\tstrcpy(urltype,\"httpfile://\");\n      }\n      return 0;\n    }\n    \n    /* Ok, let's try the .Z one */\n    strcpy(newinfile,infile);\n    strcat(newinfile,\".Z\");\n    if (!http_open_network(newinfile,&httpfile,contentencoding,\n\t\t\t   &contentlength)) {\n      fclose(httpfile);\n      strcpy(infile,newinfile);\n      /* It's there, we're happy, and, it's compressed  */\n      if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\tstrcpy(urltype,\"httpcompress://\");\n      } else {\n\tstrcpy(urltype,\"httpfile://\");\n      }\n      return 0;\n    }\n    \n  } \n  return 0;\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\n  \n  /* default to ftp://   */\n    \n  strcpy(urltype,\"ftp://\");\n\n  if (strlen(outfile1)) {\n    /* there is an output file */\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 (!ftp_open_network(infile,&ftpfile,&command,&sock)) {\n      fclose(ftpfile);\n      fclose(command);\n      /* It's there, we're happy */\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,\"ftpcompress://\");\n\t} else {\n\t  strcpy(urltype,\"ftpfile://\");\n\t}\n      } else {\n\tstrcpy(urltype,\"ftpfile://\");\n      }\n      return 0;\n    }\n\n    /* Ok, let's try the .gz one */\n    strcpy(newinfile,infile);\n    strcat(newinfile,\".gz\");\n    if (!ftp_open_network(newinfile,&ftpfile,&command,&sock)) {\n      fclose(ftpfile);\n      fclose(command);\n      strcpy(infile,newinfile);\n      /* It's there, we're happy, and, it's compressed  */\n      if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\tstrcpy(urltype,\"ftpcompress://\");\n      } else {\n\tstrcpy(urltype,\"ftpfile://\");\n      }\n      return 0;\n    }\n    \n    /* Ok, let's try the .Z one */\n    strcpy(newinfile,infile);\n    strcat(newinfile,\".Z\");\n    if (!ftp_open_network(newinfile,&ftpfile,&command,&sock)) {\n      fclose(ftpfile);\n      fclose(command);\n      strcpy(infile,newinfile);\n      if (strstr(outfile1,\".gz\") || (strstr(outfile1,\".Z\"))) {\n\tstrcpy(urltype,\"ftpcompress://\");\n      } else {\n\tstrcpy(urltype,\"ftpfile://\");\n      }\n      return 0;\n    }\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  char recbuf[MAXLEN];\n  int len;\n\n  len = strlen(statusstr);\n  while (1) {\n    if (!(fgets(recbuf,MAXLEN,ftp))) {\n#ifdef DEBUG\n      puts(\"error reading response in ftp_status\");\n#endif\n      return 1; /* error reading */\n    }\n    \n#ifdef DEBUG\n    printf(\"ftp_status, return string was %s\\n\",recbuf);\n#endif\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      return 1; \n    }\n  }\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  sprintf(msg,\"%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#ifdef DEBUG\n  printf(\"root_read, op %d astat %d\\n\",op,astat);\n#endif\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  sprintf(msg,\"%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#ifdef DEBUG\n  printf(\"root_read, op %d astat %d\\n\",op,astat);\n#endif\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  strcpy(turl,\"root://\");\n  strcat(turl,url);\n  if (NET_ParseUrl(turl,proto,host,&port,fn)) {\n    sprintf(errorstr,\"URL Parse Error (root_open) %s\",url);\n    ffpmsg(errorstr);\n    return (FILE_NOT_OPENED);\n  }\n  \n#ifdef DEBUG\n  printf(\"Connecting to %s on port %d\\n\",host,port);\n#endif\n  /* Connect to the remote host */\n  *sock = NET_TcpConnect(host,port);\n  if (*sock < 0) {\n    ffpmsg(\"Couldn't connect to host (http_open_network)\");\n    return (FILE_NOT_OPENED);\n  }\n  \n  /* get the username */\n  if (NULL != getenv(\"ROOTUSERNAME\")) {\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#ifdef DEBUG\n  printf(\"op is %d and authstat is %d\\n\",op,authstat);\n#endif\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    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#ifdef DEBUG\n  printf(\"op is %d and authstat is %d\\n\",op,authstat);\n#endif\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  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#ifdef DEBUG\n  printf(\"op is %d and recbuf is %d\\n\",op,authstat);\n#endif\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\n#ifdef DEBUG\n  printf(\"len sent is %x\\n\",hdr[0]);\n#endif\n\n  hdr[1] = htonl(op);\n#ifdef DEBUG\n  printf(\"op sent is %x\\n\",hdr[1]);\n#endif\n  \n\n#ifdef DEBUG\n  printf(\"Sending op %d and length of %d\\n\",op,len);\n#endif\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\n  int recv1 = 0;\n  int len;\n  int status;\n  char recbuf[MAXLEN];\n\n  status = NET_RecvRaw(sock,&len,4);\n#ifdef DEBUG\n  printf(\"Recv: status from rec is %d\\n\",status);\n#endif\n  if (status < 0) {\n    return status;\n  }\n  recv1 += status;\n\n  len = ntohl(len);\n#ifdef DEBUG\n  printf (\"Recv: length is %d\\n\",len);\n#endif\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#ifdef DEBUG\n  printf (\"Recv: Operation is %d\\n\",*op);\n#endif\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\n#endif\n"},{"col":4,"comment":"null","endLoc":129,"header":"def _set_cursor_prefs(self, event, **kwargs)","id":13691,"name":"_set_cursor_prefs","nodeType":"Function","startLoc":125,"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"},{"id":13692,"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":13693,"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                sprintf(message, \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          sprintf(message,\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 == 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 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":13694,"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":13695,"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        sprintf(message,\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[81];\n\n    if (*status > 0 || nrows == 0)\n        return(*status);\n\n    /*  check input parameters */\n    if (firstrow < 1)\n    {\n          sprintf(message, \"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          sprintf(message, \"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          sprintf(message, \"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      sprintf(message, \"Specified column number is out of range: %d (ffgcxui)\",\n                colnum);\n        ffpmsg(message);\n        sprintf(message, \"  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[81];\n\n    if (*status > 0 || nrows == 0)\n        return(*status);\n\n    /*  check input parameters */\n    if (firstrow < 1)\n    {\n          sprintf(message, \"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          sprintf(message, \"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          sprintf(message, \"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      sprintf(message, \"Specified column number is out of range: %d (ffgcxuk)\",\n                colnum);\n        ffpmsg(message);\n        sprintf(message, \"  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":13696,"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      sprintf(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      sprintf(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      sprintf(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      sprintf(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  sprintf(errstr,\"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  sprintf(errstr,\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  sprintf(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      sprintf(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      sprintf(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  sprintf(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      sprintf(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\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\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  sprintf(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  sprintf(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,groupLocation,status);\n\n\t\t      if(groupLocation[0] != '/')\n\t\t\t{\n\t\t\t  strcpy(tmp, cwd);\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,groupLocation,status);\n\n\t\t      if(groupLocation[0] != '/')\n\t\t\t{\n\t\t\t  strcpy(tmp, cwd);\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  sprintf(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  sprintf(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  sprintf(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      sprintf(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      sprintf(newKeyword,\"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      sprintf(keyword,\"GRPLC%d\",index);\n\t      sprintf(newKeyword,\"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      /*\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  sprintf(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\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\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\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\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  sprintf(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      sprintf(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  sprintf(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\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  sprintf(keyword,\"GRPID%d\",found);\n\t\t  *status = fits_delete_key(mfptr,keyword,status);\n\t\t  \n\t\t  sprintf(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 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      sprintf(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      sprintf(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      sprintf(keyword,\"GRPID%d\",(int)index);\n\t      fits_delete_key(mfptr,keyword,status);\n\t      \n\t      sprintf(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,tmpLocation,status);\n\n      if(*tmpLocation != '/')\n\t{\n\t  fits_get_cwd(cwd,status);\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 ==> ingore 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\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\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\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\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  sprintf(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\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,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  getcwd(buff,FLEN_FILENAME);\n\n#endif\n\n  /*\n    convert the cwd string to a URL standard path string\n  */\n\n  fits_path2url(buff,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 vaild 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 vaild 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 vaild 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,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,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      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] == '/') strcat(relURL,\"../\");\n\t  \n\t  /* copy all remaining characters of absURL to the output relURL */\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      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\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) strcat(absURL,\"/\");\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\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\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 output path is at least as large as, if not larger than\n       the input path, so that OUTPATH should be passed to this function\n       with room for growth. If not a runtime error could result. It is\n       assumed that OUTPATH has been allocated with enough room to hold\n       the resulting encoded 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  unsigned char a;\n  \n  char *p;\n  char *q;\n  char *hex = \"0123456789ABCDEF\";\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; 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\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\t}\n      /* else just copy the character as is */\n      else *q++ = *p;\n    }\n\n  /* null terminate the outpath string */\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":13697,"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        sprintf(message, \"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    long longval;\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 (ffgkyj(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 (ffgkyj(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 (ffgkyj(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 (ffgkyj(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 (ffgkyj(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 (ffgkyj(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 (ffgkyd(fptr, keyname, &doubleval, comm, status) <= 0)\n        {\n            if (doubleval > (double) ULONG_MAX || doubleval < 0)\n                *status = NUM_OVERFLOW;\n            else\n                 *(unsigned long *) value = (unsigned long) doubleval;\n        }\n    }\n    else if (datatype == TLONG)\n    {\n        ffgkyj(fptr, keyname, (long *) 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 anpersand?  */\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            }\n\n            /* concantenate comment strings (if any) */\n\t    if ((commspace > 0) && (*nextcomm != 0)) \n\t    {\n                strncat(comm, \" \", 1);\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            }\n\n            /* concantenate comment strings (if any) */\n\t    if ((commspace > 0) && (*nextcomm != 0)) \n\t    {\n                strncat(comm, \" \", 1);\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 (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    ffc2j(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[81];\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      sprintf(message, \"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[81];\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      sprintf(message, \"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     sprintf(sbuff,\"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          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          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          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          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          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          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[81];\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            sprintf(message, \"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            sprintf(message, \"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          sprintf(message,\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[81];\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            sprintf(message, \"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            sprintf(message, \"Illegal TDIM keyword value: %s\", tdimstr);\n            return(*status = BAD_TDIM);\n        }\n\n        if ((colptr->tdatatype > 0) && (colptr->trepeat != totalpix))\n        {\n          sprintf(message,\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[81];\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                sprintf(message,\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        sprintf(message,\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       sprintf(message, \"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[81];\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                sprintf(message,\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        sprintf(message,\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       sprintf(message, \"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[81];\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                sprintf(message,\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        sprintf(message,\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[81];\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                sprintf(message,\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        sprintf(message,\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            sprintf(message,\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                sprintf(message,\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            sprintf(message,\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            sprintf(message,\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            sprintf(message,\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            sprintf(message,\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            sprintf(message,\"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          sprintf(message,\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                sprintf(message,\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                sprintf(message,\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                sprintf(message,\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                sprintf(message,\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                sprintf(message,\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                sprintf(message,\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            sprintf(message,\n              \"ffgtkn found unexpected keyword or value for keyword no. %d.\",\n              numkey);\n            ffpmsg(message);\n\n            sprintf(message,\n              \" Expected positive integer keyword %s, but instead\", name);\n            ffpmsg(message);\n\n            sprintf(message,\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            sprintf(message,\n              \"ffgtknjj found unexpected keyword or value for keyword no. %d.\",\n              numkey);\n            ffpmsg(message);\n\n            sprintf(message,\n              \" Expected positive integer keyword %s, but instead\", name);\n            ffpmsg(message);\n\n            sprintf(message,\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        sprintf(message,\n          \"fftkyn found unexpected keyword or value for keyword no. %d.\",\n          numkey);\n        ffpmsg(message);\n\n        sprintf(message,\n          \" Expected keyword %s with value %s, but\", name, value);\n        ffpmsg(message);\n\n        sprintf(message,\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":13698,"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[81];\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        ffpkyg(fptr, keyname, (double) *(unsigned long *) value, 0,\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        sprintf(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 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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\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    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[81];\n    \n\n    if (year < 0 || year > 9999)\n    {\n       sprintf(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       sprintf(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           sprintf(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           sprintf(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        sprintf(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                sprintf(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[81];\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       sprintf(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       sprintf(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       sprintf(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       sprintf(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[81];\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' && datestr[13] == ':' && datestr[16] == ':')\n        {\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    }\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          sprintf(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          sprintf(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          sprintf(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 (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 (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 (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 (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 (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 (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 (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 (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[81];\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        sprintf(value, \"%ld\", naxes[ii]);\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        sprintf(message,\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        sprintf(value, \"%.0f\", (double) naxes[ii]);\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        sprintf(message,\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\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 == 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        sprintf(message,\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        sprintf(message,\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            sprintf(message,\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        sprintf(&comm[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 == 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          sprintf(comm, \"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        sprintf(comm, \"beginning column of field %3d\", ii + 1);\n        ffkeyn(\"TBCOL\", ii + 1, name, status);\n        ffpkyj(fptr, name, tbcol[ii], comm, status);\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;\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          sprintf(comm, \"label for field %3d\", ii + 1);\n          ffkeyn(\"TTYPE\", ii + 1, name, status);\n          ffpkys(fptr, name, ttype[ii], comm, status);\n        }\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 == 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\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        sprintf(message,\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            sprintf(message,\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        sprintf(&comm[20], \"%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 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 (sprintf(cval, \"%.*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 ( sprintf(cval, \"%.*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 ( sprintf(cval, \"%.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 ( sprintf(cval, \"%.*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') )\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 (sprintf(cval, \"%.*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 ( sprintf(cval, \"%.*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 ( sprintf(cval, \"%.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 ( sprintf(cval, \"%.*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') )\n        {\n            /* add decimal point if necessary to distinquish from integer */\n            strcat(cval, \".\");\n        }\n    }\n\n    return(*status);\n}\n\n"},{"id":13699,"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 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        sprintf(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        sprintf(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            sprintf(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[81], 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        sprintf(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[81], 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        sprintf(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":13700,"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                sprintf(message, \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          sprintf(message,\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 == 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":13701,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /*------------------------------------------------------------------*/\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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcle).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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          sprintf(message, \"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":13702,"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 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 \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                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                  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                sprintf(message, \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          sprintf(message,\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 == 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":13703,"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        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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\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        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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2f(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffr2e(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2f(value[1], decim, tmpstring, status); /* convert to string */\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    strcat(valstring, tmpstring);\n    strcat(valstring, \", \");\n    ffd2e(value[1], decim, tmpstring, status); /* convert to string */\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    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        sprintf(message, \"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        sprintf(message, \"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        sprintf(message, \"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":13704,"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":13705,"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\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"},{"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":174,"header":"def imshow(self, X, *args, **kwargs)","id":13706,"name":"imshow","nodeType":"Function","startLoc":142,"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.get('origin', None)\n\n        if 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                kwargs['origin'] = 'lower'\n\n        return super().imshow(X, *args, **kwargs)"},{"id":13707,"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                sprintf(message, \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         sprintf(message,\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 == 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":13708,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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 = 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    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    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 (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    /*  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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclb).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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;\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          sprintf(message, \"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":13709,"name":"drvrgsiftp.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"\n/*  This file, drvrgsiftp.c contains driver routines for gsiftp files. */\n/*  Andrea Barisani <lcars@si.inaf.it>                                 */\n/* Taffoni Giuliano <taffoni@oats.inaf.it>                             */\n#ifdef HAVE_NET_SERVICES\n#ifdef HAVE_GSIFTP\n\n#include <sys/types.h>\n#include <string.h>\n#include <signal.h>\n#include <stdlib.h>\n#include <setjmp.h>\n#include \"fitsio2.h\"\n\n#include <globus_ftp_client.h>\n\n#define MAXLEN 1200\n#define NETTIMEOUT 80\n#define MAX_BUFFER_SIZE_R 1024\n#define MAX_BUFFER_SIZE_W (64*1024)\n\nstatic int gsiftpopen = 0;\nstatic int global_offset = 0;\nstatic int gsiftp_get(char *filename, FILE **gsiftpfile, int num_streams);\n\nstatic globus_mutex_t lock;\nstatic globus_cond_t cond;\nstatic globus_bool_t done;\n\nstatic char *gsiftp_tmpfile;\nstatic char *gsiftpurl = NULL;\nstatic char gsiftp_tmpdir[MAXLEN];\n\nstatic jmp_buf env; /* holds the jump buffer for setjmp/longjmp pairs */\nstatic void signal_handler(int sig);\n\nint gsiftp_init(void)\n{\n\n  if (getenv(\"GSIFTP_TMPFILE\")) {\n    gsiftp_tmpfile = getenv(\"GSIFTP_TMPFILE\");\n  } else {\n    strncpy(gsiftp_tmpdir, \"/tmp/gsiftp_XXXXXX\", sizeof gsiftp_tmpdir);\n    if (mkdtemp(gsiftp_tmpdir) == NULL) {\n        ffpmsg(\"Cannot create temporary directory!\");\n        return (FILE_NOT_OPENED);\n    }\n    gsiftp_tmpfile = malloc(strlen(gsiftp_tmpdir) + strlen(\"/gsiftp_buffer.tmp\"));\n    strcat(gsiftp_tmpfile, gsiftp_tmpdir);\n    strcat(gsiftp_tmpfile, \"/gsiftp_buffer.tmp\");\n  }\n\n  return file_init();\n}\n\nint gsiftp_shutdown(void)\n{\n  free(gsiftpurl);\n  free(gsiftp_tmpfile);\n  free(gsiftp_tmpdir);\n\n  return file_shutdown();\n}\n\nint gsiftp_setoptions(int options)\n{\n  return file_setoptions(options);\n}\n\nint gsiftp_getoptions(int *options)\n{\n  return file_getoptions(options);\n}\n\nint gsiftp_getversion(int *version)\n{\n  return file_getversion(version);\n}\n\nint gsiftp_checkfile(char *urltype, char *infile, char *outfile)\n{\n  return file_checkfile(urltype, infile, outfile);\n}\n\nint gsiftp_open(char *filename, int rwmode, int *handle)\n{\n  FILE *gsiftpfile;\n  int num_streams;\n\n  if (getenv(\"GSIFTP_STREAMS\")) {\n    num_streams = (int)getenv(\"GSIFTP_STREAMS\");\n  } else {\n    num_streams = 1;\n  }\n  \n  if (rwmode) {\n    gsiftpopen = 2;\n  } else {\n    gsiftpopen = 1;\n  }\n \n  if (gsiftpurl)\n    free(gsiftpurl);\n \n  gsiftpurl = strdup(filename);\n\n  if (setjmp(env) != 0) {\n    ffpmsg(\"Timeout (gsiftp_open)\");\n    goto error;\n  }\n  \n  signal(SIGALRM, signal_handler);\n  alarm(NETTIMEOUT);\n\n  if (gsiftp_get(filename,&gsiftpfile,num_streams)) {\n    alarm(0);\n    ffpmsg(\"Unable to open gsiftp file (gsiftp_open)\");\n    ffpmsg(filename);\n    goto error;\n  } \n  \n  fclose(gsiftpfile);\n  \n  signal(SIGALRM, SIG_DFL);\n  alarm(0);\n\n  return file_open(gsiftp_tmpfile, rwmode, handle);\n\n  error:\n   alarm(0);\n   signal(SIGALRM, SIG_DFL);\n   return (FILE_NOT_OPENED);\n}\n\nint gsiftp_create(char *filename, int *handle)\n{\n  if (gsiftpurl)\n    free(gsiftpurl);\n\n  gsiftpurl = strdup(filename);\n\n  return file_create(gsiftp_tmpfile, handle);\n}\n\nint gsiftp_truncate(int handle, LONGLONG filesize)\n{\n  return file_truncate(handle, filesize);\n}\n\nint gsiftp_size(int handle, LONGLONG *filesize)\n{\n  return file_size(handle, filesize);\n}\n\nint gsiftp_flush(int handle)\n{\n  FILE *gsiftpfile;\n  int num_streams;\n\n  if (getenv(\"GSIFTP_STREAMS\")) {\n    num_streams = (int)getenv(\"GSIFTP_STREAMS\");\n  } else {\n    num_streams = 1;\n  }\n  \n  int rc = file_flush(handle);\n\n  if (gsiftpopen != 1) {\n  \n    if (setjmp(env) != 0) {\n      ffpmsg(\"Timeout (gsiftp_write)\");\n      goto error;\n    }\n  \n    signal(SIGALRM, signal_handler);\n    alarm(NETTIMEOUT);\n\n    if (gsiftp_put(gsiftpurl,&gsiftpfile,num_streams)) {\n      alarm(0);\n      ffpmsg(\"Unable to open gsiftp file (gsiftp_flush)\");\n      ffpmsg(gsiftpurl);\n      goto error;\n    } \n  \n    fclose(gsiftpfile);\n  \n    signal(SIGALRM, SIG_DFL);\n    alarm(0);\n  }\n  \n  return rc;\n\n  error:\n   alarm(0);\n   signal(SIGALRM, SIG_DFL);\n   return (FILE_NOT_OPENED);\n}\n\nint gsiftp_seek(int handle, LONGLONG offset)\n{\n  return file_seek(handle, offset);\n}\n\nint gsiftp_read(int hdl, void *buffer, long nbytes)\n{\n  return file_read(hdl, buffer, nbytes);\n}\n\nint gsiftp_write(int hdl, void *buffer, long nbytes)\n{\n  return file_write(hdl, buffer, nbytes);\n}\n\nint gsiftp_close(int handle)\n{\n    unlink(gsiftp_tmpfile);\n    \n    if (gsiftp_tmpdir)\n        rmdir(gsiftp_tmpdir);\n\n    return file_close(handle);\n}\n\nstatic void done_cb( void * \t\t\t\tuser_arg,\n                     globus_ftp_client_handle_t * \thandle,\n                     globus_object_t * \t\t\terr)\n{\n\n    if(err){\n        fprintf(stderr, \"%s\", globus_object_printable_to_string(err));\n    }\n    \n    globus_mutex_lock(&lock);\n    done = GLOBUS_TRUE;\n    globus_cond_signal(&cond);\n    globus_mutex_unlock(&lock);\n    return;\n}\n\nstatic void data_cb_read( void * \t\t\tuser_arg,\n                          globus_ftp_client_handle_t * \thandle,\n                          globus_object_t * \t\terr,\n                          globus_byte_t * \t\tbuffer,\n                          globus_size_t \t\tlength,\n                          globus_off_t \t\t\toffset,\n                          globus_bool_t \t\teof)\n{\n    if(err) {\n        fprintf(stderr, \"%s\", globus_object_printable_to_string(err));\n    }\n    else {\n        FILE* fd = (FILE*) user_arg;\n        int rc = fwrite(buffer, 1, length, fd);\n        if (ferror(fd)) {\n            printf(\"Read error in function data_cb_read; errno = %d\\n\", errno);\n            return;\n        }\n\n        if (!eof) {\n            globus_ftp_client_register_read(handle,\n                                            buffer,\n                                            MAX_BUFFER_SIZE_R,\n                                            data_cb_read,\n                                            (void*) fd);\n        }\n    }\n    return;\n}\n\nstatic void data_cb_write( void * \t\t\tuser_arg,\n                           globus_ftp_client_handle_t * handle,\n                           globus_object_t * \t\terr,\n                           globus_byte_t * \t\tbuffer,\n                           globus_size_t \t\tlength,\n                           globus_off_t \t\toffset,\n                           globus_bool_t \t\teof)\n{\n    int curr_offset;\n    if(err) {\n        fprintf(stderr, \"%s\", globus_object_printable_to_string(err));\n    }\n    else {\n        if (!eof) {\n            FILE* fd = (FILE*) user_arg;\n            int rc;\n            globus_mutex_lock(&lock);\n            curr_offset = global_offset;\n            rc = fread(buffer, 1, MAX_BUFFER_SIZE_W, fd);\n            global_offset += rc;\n            globus_mutex_unlock(&lock);\n            if (ferror(fd)) {\n                printf(\"Read error in function data_cb_write; errno = %d\\n\", errno);\n                return;\n            }\n\n            globus_ftp_client_register_write(handle,\n                                             buffer,\n\t\t\t\t\t     rc,\n\t\t\t\t\t     curr_offset,\n                                             feof(fd) != 0,\n                                             data_cb_write,\n                                             (void*) fd);\n        } else {\n            globus_libc_free(buffer);\n        }\n    }\n    return;\n}\n\nint gsiftp_get(char *filename, FILE **gsiftpfile, int num_streams)\n{\n    char gsiurl[MAXLEN];\n\n    globus_ftp_client_handle_t \t\thandle;\n    globus_ftp_client_operationattr_t \tattr;\n    globus_ftp_client_handleattr_t \thandle_attr;\n    globus_ftp_control_parallelism_t   \tparallelism;\n    globus_ftp_control_layout_t\t\tlayout;\n    globus_byte_t \t\t\tbuffer[MAX_BUFFER_SIZE_R];\n    globus_size_t buffer_length = sizeof(buffer);\n    globus_result_t \t\t\tresult;\n    globus_ftp_client_restart_marker_t\trestart;\n    globus_ftp_control_type_t \t\tfiletype;\n   \n    globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);\n    globus_mutex_init(&lock, GLOBUS_NULL);\n    globus_cond_init(&cond, GLOBUS_NULL);\n    globus_ftp_client_handle_init(&handle,  GLOBUS_NULL);\n    globus_ftp_client_handleattr_init(&handle_attr);\n    globus_ftp_client_operationattr_init(&attr);\n    layout.mode = GLOBUS_FTP_CONTROL_STRIPING_NONE;\n    globus_ftp_client_restart_marker_init(&restart);\n    globus_ftp_client_operationattr_set_mode(\n            &attr,\n            GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK);\n   \n    if (num_streams >= 1)\n    {\n        parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED;\n        parallelism.fixed.size = num_streams;\n       \n        globus_ftp_client_operationattr_set_parallelism(\n            &attr,\n            &parallelism);\n    }\n   \n    globus_ftp_client_operationattr_set_layout(&attr,\n                                               &layout);\n   \n    filetype = GLOBUS_FTP_CONTROL_TYPE_IMAGE;\n    globus_ftp_client_operationattr_set_type (&attr,\n                                              filetype);\n   \n    globus_ftp_client_handle_init(&handle, &handle_attr);\n   \n    done = GLOBUS_FALSE;\n\n    strcpy(gsiurl,\"gsiftp://\");\n    strcat(gsiurl,filename);\n\n    *gsiftpfile = fopen(gsiftp_tmpfile,\"w+\");\n    \n    if (!*gsiftpfile) {\n        ffpmsg(\"Unable to open temporary file!\");\n        return (FILE_NOT_OPENED);\n    }\n   \n    result = globus_ftp_client_get(&handle,\n                                   gsiurl,\n                                   &attr,\n                                   &restart,\n                                   done_cb,\n                                   0);\n    if(result != GLOBUS_SUCCESS) {\n        globus_object_t * err;\n        err = globus_error_get(result);\n        fprintf(stderr, \"%s\", globus_object_printable_to_string(err));\n        done = GLOBUS_TRUE;\n    }\n    else {\n        globus_ftp_client_register_read(&handle,\n                                        buffer,\n                                        buffer_length,\n                                        data_cb_read,\n                                        (void*) *gsiftpfile);\n    }\n   \n    globus_mutex_lock(&lock);\n\n    while(!done) {\n        globus_cond_wait(&cond, &lock);\n    }\n\n    globus_mutex_unlock(&lock);\n    globus_ftp_client_handle_destroy(&handle);\n    globus_module_deactivate_all();\n   \n    return 0;\n}\n\nint gsiftp_put(char *filename, FILE **gsiftpfile, int num_streams)\n{\n    int i;\n    char gsiurl[MAXLEN];\n\n    globus_ftp_client_handle_t \t\thandle;\n    globus_ftp_client_operationattr_t \tattr;\n    globus_ftp_client_handleattr_t \thandle_attr;\n    globus_ftp_control_parallelism_t   \tparallelism;\n    globus_ftp_control_layout_t\t\tlayout;\n    globus_byte_t * \t\t\tbuffer;\n    globus_size_t buffer_length = sizeof(buffer);\n    globus_result_t \t\t\tresult;\n    globus_ftp_client_restart_marker_t\trestart;\n    globus_ftp_control_type_t \t\tfiletype;\n   \n    globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);\n    globus_mutex_init(&lock, GLOBUS_NULL);\n    globus_cond_init(&cond, GLOBUS_NULL);\n    globus_ftp_client_handle_init(&handle,  GLOBUS_NULL);\n    globus_ftp_client_handleattr_init(&handle_attr);\n    globus_ftp_client_operationattr_init(&attr);\n    layout.mode = GLOBUS_FTP_CONTROL_STRIPING_NONE;\n    globus_ftp_client_restart_marker_init(&restart);\n    globus_ftp_client_operationattr_set_mode(\n            &attr,\n            GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK);\n   \n    if (num_streams >= 1)\n    {\n        parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED;\n        parallelism.fixed.size = num_streams;\n       \n        globus_ftp_client_operationattr_set_parallelism(\n            &attr,\n            &parallelism);\n    }\n   \n    globus_ftp_client_operationattr_set_layout(&attr,\n                                               &layout);\n   \n    filetype = GLOBUS_FTP_CONTROL_TYPE_IMAGE;\n    globus_ftp_client_operationattr_set_type (&attr,\n                                              filetype);\n   \n    globus_ftp_client_handle_init(&handle, &handle_attr);\n   \n    done = GLOBUS_FALSE;\n    \n    strcpy(gsiurl,\"gsiftp://\");\n    strcat(gsiurl,filename);\n\n    *gsiftpfile = fopen(gsiftp_tmpfile,\"r\");\n\n    if (!*gsiftpfile) {\n        ffpmsg(\"Unable to open temporary file!\");\n        return (FILE_NOT_OPENED);\n    }\n   \n    result = globus_ftp_client_put(&handle,\n                                   gsiurl,\n                                   &attr,\n                                   &restart,\n                                   done_cb,\n                                   0);\n    if(result != GLOBUS_SUCCESS) {\n        globus_object_t * err;\n        err = globus_error_get(result);\n        fprintf(stderr, \"%s\", globus_object_printable_to_string(err));\n        done = GLOBUS_TRUE;\n    }\n    else {\n        int rc;\n        int curr_offset;\n\n\tfor (i = 0; i< 2 * num_streams && feof(*gsiftpfile) == 0; i++)\n        {\n            buffer = malloc(MAX_BUFFER_SIZE_W);\n            globus_mutex_lock(&lock);\n            curr_offset = global_offset;\n            rc = fread(buffer, 1, MAX_BUFFER_SIZE_W, *gsiftpfile);\n            global_offset += rc;\n            globus_mutex_unlock(&lock);\n            globus_ftp_client_register_write(\n                &handle,\n                buffer,\n                rc,\n                curr_offset,\n                feof(*gsiftpfile) != 0,\n                data_cb_write,\n                (void*) *gsiftpfile);\n        }\n    }\n   \n    globus_mutex_lock(&lock);\n\n    while(!done) {\n        globus_cond_wait(&cond, &lock);\n    }\n\n    globus_mutex_unlock(&lock);\n    globus_ftp_client_handle_destroy(&handle);\n    globus_module_deactivate_all();\n   \n    return 0;\n}\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#endif\n#endif\n"},{"id":13710,"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":13711,"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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 ( 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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcluj).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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] > 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 == 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[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          sprintf(message, \"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"},{"id":13712,"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      sprintf(currLine,\"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/*---------------------------------------------------------------------------*/\n{\n   int i;\n\n   for( i=0; i<Rgn->nShapes; i++ )\n      if( Rgn->Shapes[i].shape == poly_rgn )\n         free( Rgn->Shapes[i].param.poly.Pts );\n   if( Rgn->Shapes )\n      free( Rgn->Shapes );\n   free( Rgn );\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\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<9; 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":13713,"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 == 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 == 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 == 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 == 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 == 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 == 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 == 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":13714,"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                sprintf(message, \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          sprintf(message,\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 == 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":13715,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /* 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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgclk).\",\n              dtemp+1., dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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] < 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 == 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[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          sprintf(message, \"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 `~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\n        matplotlib.axes.Axes.plot : This method is called from this function with all arguments passed to it.\n\n        ","endLoc":227,"header":"def plot_coord(self, *args, **kwargs)","id":13716,"name":"plot_coord","nodeType":"Function","startLoc":176,"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\n        matplotlib.axes.Axes.plot : 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            plot_data = []\n            for coord in self.coords:\n                if coord.coord_type == 'longitude':\n                    plot_data.append(frame0.data.lon.to_value(coord.coord_unit))\n                elif coord.coord_type == 'latitude':\n                    plot_data.append(frame0.data.lat.to_value(coord.coord_unit))\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(frame0)\n            kwargs.update({'transform': transform})\n\n            args = tuple(plot_data) + args[1:]\n\n        super().plot(*args, **kwargs)"},{"id":13717,"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":13718,"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  1000   /* 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/* ============================================================== */\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 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 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 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 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 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 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  *isopen, int  *status);\nint ffedit_columns(fitsfile **fptr, char *outfile, char *expr, int *status);\nint fits_get_col_minmax(fitsfile *fptr, int colnum, float *datamin, \n                     float *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 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);\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 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 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 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 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 fflongfi8(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 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 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 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 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\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/* 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":13719,"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":13720,"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":13721,"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":13722,"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        sprintf(msg, \"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          sprintf(msg, \"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        sprintf(msg, \"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        sprintf(msg, \"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[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    /*----------------------------------------------------------------------*/\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                sprintf(message, \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            sprintf(message,\n            \"Error reading elements %.0f thru %.0f from column %d (ffgcli).\",\n              dtemp+1, dtemp+ntodo, colnum);\n          else\n            sprintf(message,\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\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 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[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          sprintf(message, \"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":13723,"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 (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\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 - 1)\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(tmpfilename,filename);\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":13724,"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        sprintf(message,\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":13725,"name":"cextern/cfitsio/zlib","nodeType":"Package"},{"id":13726,"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"},{"id":13727,"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":13728,"name":"cextern/cfitsio/docs","nodeType":"Package"},{"id":13729,"name":"changes.txt","nodeType":"TextFile","path":"cextern/cfitsio/docs","text":"                   Log of Changes Made to CFITSIO\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":13730,"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":13731,"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":13732,"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":13733,"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":13734,"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\n#define MAX_PREFIX_LEN 20  /* max length of file type prefix (e.g. 'http://') */\n#define MAX_DRIVERS 24     /* 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);\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\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          sprintf(errmsg,\n          \" extension number %d doesn't exist or couldn't be opened.\",extnum);\n          ffpmsg(errmsg);\n        }\n        else\n        {\n          sprintf(errmsg,\n          \" extension with EXTNAME = %s,\", extname);\n          ffpmsg(errmsg);\n\n          if (extvers)\n          {\n             sprintf(errmsg,\n             \"           and with EXTVERS = %d,\", extvers);\n             ffpmsg(errmsg);\n          }\n\n          if (movetotype != ANY_HDU)\n          {\n             sprintf(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, 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_img_dim(*fptr, &naxis, status);\n\n    if( (hdunum == 1) && (naxis == 0) ){ \n      /* look through the extension list */\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    fits_get_hdu_type(*fptr, hdutype, status);\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, &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\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          sprintf(errmsg,\n          \" extension number %d doesn't exist or couldn't be opened.\",extnum);\n          ffpmsg(errmsg);\n        }\n        else\n        {\n          sprintf(errmsg,\n          \" extension with EXTNAME = %s,\", extname);\n          ffpmsg(errmsg);\n\n          if (extvers)\n          {\n             sprintf(errmsg,\n             \"           and with EXTVERS = %d,\", extvers);\n             ffpmsg(errmsg);\n          }\n\n          if (movetotype != ANY_HDU)\n          {\n             sprintf(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 statisfying 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       /* add some HISTORY; fits_copy_image_cell also wrote HISTORY keywords */\n       \n/*  disable this; leave it up to calling routine to write any HISTORY keywords\n       if (*extname)\n        sprintf(card,\"HISTORY  in HDU '%.16s' of file '%.36s'\",extname,infile);\n       else\n        sprintf(card,\"HISTORY  in HDU %d of file '%.45s'\", extnum, infile);\n\n       ffprec(*fptr, card, status);\n*/\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  *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;\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    if(fits_strcasecmp(urltype,\"FILE://\") == 0)\n      {\n        fits_path2url(infile,tmpinfile,status);\n\n        if(tmpinfile[0] != '/')\n          {\n            fits_get_cwd(cwd,status);\n            strcat(cwd,\"/\");\n \n            if (strlen(cwd) + strlen(tmpinfile) > FLEN_FILENAME-1) {\n\t\t  ffpmsg(\"File name is too long. (fits_already_open)\");\n                  return(*status = FILE_NOT_OPENED);\n            }\n\n            strcat(cwd,tmpinfile);\n            fits_clean_url(cwd,tmpinfile,status);\n          }\n      }\n    else\n      strcpy(tmpinfile,infile);\n\n    for (ii = 0; ii < NMAXFILES; ii++)   /* check every buffer */\n    {\n        if (FptrTable[ii] != 0)\n        {\n          oldFptr = FptrTable[ii];\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              fits_path2url(oldinfile,tmpStr,status);\n              \n              if(tmpStr[0] != '/')\n                {\n                  fits_get_cwd(cwd,status);\n                  strcat(cwd,\"/\");\n\n\n                  strcat(cwd,tmpStr);\n                  fits_clean_url(cwd,tmpStr,status);\n                }\n\n              strcpy(oldinfile,tmpStr);\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\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            }\n        }\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 *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            /* ===================================== */\n            /* Case I. delete this column or keyword */\n            /* ===================================== */\n\n            if (ffgcno(*fptr, CASEINSEN, &clause[1], &colnum, status) <= 0)\n            {\n                /* a column with this name exists, so try to delete it */\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            else\n            {\n\t        ffcmsg();   /* clear previous error message from ffgcno */\n                /* try deleting a keyword with this name */\n                *status = 0;\n                if (ffdkey(*fptr, &clause[1], status) > 0)\n                {\n                    ffpmsg(\"column or keyword to be deleted does not exist:\");\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            }\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_token(&cptr2, \"( =\", colname, NULL);\n\n            if (slen == 0)\n            {\n                ffpmsg(\"error: column or keyword name is blank:\");\n                ffpmsg(clause);\n                if( colindex ) free( colindex );\n                if( file_expr ) free( file_expr );\n\t\tif (clause) free(clause);\n                return(*status= URL_PARSE_ERROR);\n            }\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                fits_get_token(&cptr2, \")\", oldname, NULL);\n                strcat(colname, oldname);\n                strcat(colname, \")\");\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\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                fits_get_token(&cptr2, \" \", oldname, NULL);\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                fits_get_token(&cptr3, \"(\", oldname, NULL);\n\n                if (cptr3[0] == '(' )\n                {\n                   cptr3++;  /* skip the '(' */\n                   fits_get_token(&cptr3, \")\", colformat, NULL);\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    sprintf(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      sprintf(tform, \"%.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    sprintf(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    sprintf(filename+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];\n\n    if (*status > 0)\n        return(*status);\n\n    slen = fits_get_token(ptr, \" ,:\", token, &isanumber); /* get 1st token */\n\n    /* support [:2,:2] type syntax, where the leading * is implied */\n    if (slen==0) strcpy(token,\"*\");\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_token(ptr, \" ,:\", token, &isanumber); /* get token */\n\n      if (slen == 0 || !isanumber)\n        return(*status = URL_PARSE_ERROR);   \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_token(ptr, \" ,\", token, &isanumber); /* get token */\n\n        if (slen == 0 || !isanumber)\n            return(*status = URL_PARSE_ERROR);   \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\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\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    /* 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\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 (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\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    if (ptr1)\n    {           /* find the end of the column specifier */\n        ptr2 = ptr1 + 5;\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 > FLEN_FILENAME - 1) {\n                       free(infile);\n                       return(*status = URL_PARSE_ERROR);\n            }\n\n            strncpy(colspec, ptr1 + 1, collen);       \n            colspec[collen] = '\\0';\n \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\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       ptr2 = rowfilter + strlen(rowfilter) - 1;\n       if( rowfilter[0]=='[' && *ptr2==']' ) {\n          *ptr2 = '\\0';\n\n\t   if (strlen(rowfilter + 1)  > FLEN_FILENAME - 1)\n\t   {\n                    free(infile);\n                    return(*status = URL_PARSE_ERROR);\n           }\n\n          strcpy(rowfilterx, rowfilter+1);\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;\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\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 (!ptr2)\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      sprintf(line,\"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"},{"id":13735,"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":13736,"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":13737,"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":13738,"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":13739,"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":13740,"name":"eval_y.c","nodeType":"TextFile","path":"cextern/cfitsio/lib","text":"\n/* A Bison parser, made by GNU Bison 2.4.1.  */\n\n/* Skeleton implementation for Bison's Yacc-like parsers in C\n   \n      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n   Free Software Foundation, 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/* 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.  */\n#define FFBISON 1\n\n/* Bison version.  */\n#define FFBISON_VERSION \"2.4.1\"\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/* Using locations.  */\n#define FFLSP_NEEDED 0\n\n\n\n/* Copy the first part of user declarations.  */\n\n/* Line 189 of yacc.c  */\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/*                                                                      */\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   ( char *fname, int Node1, 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_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 );\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\n/* Line 189 of yacc.c  */\n#line 265 \"y.tab.c\"\n\n/* Enabling traces.  */\n#ifndef FFDEBUG\n# define FFDEBUG 0\n#endif\n\n/* Enabling verbose error messages.  */\n#ifdef FFERROR_VERBOSE\n# undef FFERROR_VERBOSE\n# define FFERROR_VERBOSE 1\n#else\n# define FFERROR_VERBOSE 0\n#endif\n\n/* Enabling the token table.  */\n#ifndef FFTOKEN_TABLE\n# define FFTOKEN_TABLE 0\n#endif\n\n\n/* Tokens.  */\n#ifndef FFTOKENTYPE\n# define FFTOKENTYPE\n   /* Put the tokens into the symbol table, so that GDB and other debuggers\n      know about them.  */\n   enum fftokentype {\n     BOOLEAN = 258,\n     LONG = 259,\n     DOUBLE = 260,\n     STRING = 261,\n     BITSTR = 262,\n     FUNCTION = 263,\n     BFUNCTION = 264,\n     IFUNCTION = 265,\n     GTIFILTER = 266,\n     REGFILTER = 267,\n     COLUMN = 268,\n     BCOLUMN = 269,\n     SCOLUMN = 270,\n     BITCOL = 271,\n     ROWREF = 272,\n     NULLREF = 273,\n     SNULLREF = 274,\n     OR = 275,\n     AND = 276,\n     NE = 277,\n     EQ = 278,\n     GTE = 279,\n     LTE = 280,\n     LT = 281,\n     GT = 282,\n     POWER = 283,\n     NOT = 284,\n     FLTCAST = 285,\n     INTCAST = 286,\n     UMINUS = 287,\n     DIFF = 288,\n     ACCUM = 289\n   };\n#endif\n/* Tokens.  */\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 REGFILTER 267\n#define COLUMN 268\n#define BCOLUMN 269\n#define SCOLUMN 270\n#define BITCOL 271\n#define ROWREF 272\n#define NULLREF 273\n#define SNULLREF 274\n#define OR 275\n#define AND 276\n#define NE 277\n#define EQ 278\n#define GTE 279\n#define LTE 280\n#define LT 281\n#define GT 282\n#define POWER 283\n#define NOT 284\n#define FLTCAST 285\n#define INTCAST 286\n#define UMINUS 287\n#define DIFF 288\n#define ACCUM 289\n\n\n\n\n#if ! defined FFSTYPE && ! defined FFSTYPE_IS_DECLARED\ntypedef union FFSTYPE\n{\n\n/* Line 214 of yacc.c  */\n#line 192 \"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\n\n/* Line 214 of yacc.c  */\n#line 379 \"y.tab.c\"\n} FFSTYPE;\n# define FFSTYPE_IS_TRIVIAL 1\n# define ffstype FFSTYPE /* obsolescent; will be withdrawn */\n# define FFSTYPE_IS_DECLARED 1\n#endif\n\n\n/* Copy the second part of user declarations.  */\n\n\n/* Line 264 of yacc.c  */\n#line 391 \"y.tab.c\"\n\n#ifdef short\n# undef short\n#endif\n\n#ifdef FFTYPE_UINT8\ntypedef FFTYPE_UINT8 fftype_uint8;\n#else\ntypedef unsigned char fftype_uint8;\n#endif\n\n#ifdef FFTYPE_INT8\ntypedef FFTYPE_INT8 fftype_int8;\n#elif (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\ntypedef signed char fftype_int8;\n#else\ntypedef short int fftype_int8;\n#endif\n\n#ifdef FFTYPE_UINT16\ntypedef FFTYPE_UINT16 fftype_uint16;\n#else\ntypedef unsigned short int fftype_uint16;\n#endif\n\n#ifdef FFTYPE_INT16\ntypedef FFTYPE_INT16 fftype_int16;\n#else\ntypedef short int fftype_int16;\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 FFSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\n#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */\n#  define FFSIZE_T size_t\n# else\n#  define FFSIZE_T unsigned int\n# endif\n#endif\n\n#define FFSIZE_MAXIMUM ((FFSIZE_T) -1)\n\n#ifndef FF_\n# if 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/* 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/* Identity function, used to suppress warnings about constant conditions.  */\n#ifndef lint\n# define FFID(n) (n)\n#else\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic int\nFFID (int ffi)\n#else\nstatic int\nFFID (ffi)\n    int ffi;\n#endif\n{\n  return ffi;\n}\n#endif\n\n#if ! defined ffoverflow || FFERROR_VERBOSE\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 _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\n#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\n#     ifndef _STDLIB_H\n#      define _STDLIB_H 1\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 (FFID (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 _STDLIB_H \\\n       && ! ((defined FFMALLOC || defined malloc) \\\n\t     && (defined FFFREE || defined free)))\n#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\n#   ifndef _STDLIB_H\n#    define _STDLIB_H 1\n#   endif\n#  endif\n#  ifndef FFMALLOC\n#   define FFMALLOC malloc\n#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\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 _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nvoid free (void *); /* INFRINGES ON USER NAME SPACE */\n#   endif\n#  endif\n# endif\n#endif /* ! defined ffoverflow || FFERROR_VERBOSE */\n\n\n#if (! defined ffoverflow \\\n     && (! defined __cplusplus \\\n\t || (defined FFSTYPE_IS_TRIVIAL && FFSTYPE_IS_TRIVIAL)))\n\n/* A type that is properly aligned for any stack member.  */\nunion ffalloc\n{\n  fftype_int16 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 (sizeof (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) * (sizeof (fftype_int16) + sizeof (FFSTYPE)) \\\n      + FFSTACK_GAP_MAXIMUM)\n\n/* Copy COUNT objects from FROM to TO.  The source and destination do\n   not overlap.  */\n# ifndef FFCOPY\n#  if defined __GNUC__ && 1 < __GNUC__\n#   define FFCOPY(To, From, Count) \\\n      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))\n#  else\n#   define FFCOPY(To, From, Count)\t\t\\\n      do\t\t\t\t\t\\\n\t{\t\t\t\t\t\\\n\t  FFSIZE_T ffi;\t\t\t\t\\\n\t  for (ffi = 0; ffi < (Count); ffi++)\t\\\n\t    (To)[ffi] = (From)[ffi];\t\t\\\n\t}\t\t\t\t\t\\\n      while (FFID (0))\n#  endif\n# endif\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)\t\t\t\t\\\n    do\t\t\t\t\t\t\t\t\t\\\n      {\t\t\t\t\t\t\t\t\t\\\n\tFFSIZE_T ffnewbytes;\t\t\t\t\t\t\\\n\tFFCOPY (&ffptr->Stack_alloc, Stack, ffsize);\t\t\t\\\n\tStack = &ffptr->Stack_alloc;\t\t\t\t\t\\\n\tffnewbytes = ffstacksize * sizeof (*Stack) + FFSTACK_GAP_MAXIMUM; \\\n\tffptr += ffnewbytes / sizeof (*ffptr);\t\t\t\t\\\n      }\t\t\t\t\t\t\t\t\t\\\n    while (FFID (0))\n\n#endif\n\n/* FFFINAL -- State number of the termination state.  */\n#define FFFINAL  2\n/* FFLAST -- Last index in FFTABLE.  */\n#define FFLAST   1603\n\n/* FFNTOKENS -- Number of terminals.  */\n#define FFNTOKENS  54\n/* FFNNTS -- Number of nonterminals.  */\n#define FFNNTS  9\n/* FFNRULES -- Number of rules.  */\n#define FFNRULES  125\n/* FFNRULES -- Number of states.  */\n#define FFNSTATES  290\n\n/* FFTRANSLATE(FFLEX) -- Bison symbol number corresponding to FFLEX.  */\n#define FFUNDEFTOK  2\n#define FFMAXUTOK   289\n\n#define FFTRANSLATE(FFX)\t\t\t\t\t\t\\\n  ((unsigned int) (FFX) <= FFMAXUTOK ? fftranslate[FFX] : FFUNDEFTOK)\n\n/* FFTRANSLATE[FFLEX] -- Bison symbol number corresponding to FFLEX.  */\nstatic const fftype_uint8 fftranslate[] =\n{\n       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,\n      50,     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,    37,    41,     2,\n      52,    53,    38,    35,    20,    36,     2,    39,     2,     2,\n       2,     2,     2,     2,     2,     2,     2,     2,    22,     2,\n       2,    21,     2,    25,     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,    47,     2,    51,     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,    23,    40,    24,    28,     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,    26,    27,    29,    30,    31,\n      32,    33,    34,    42,    43,    44,    45,    46,    48,    49\n};\n\n#if FFDEBUG\n/* FFPRHS[FFN] -- Index of the first RHS symbol of rule number FFN in\n   FFRHS.  */\nstatic const fftype_uint16 ffprhs[] =\n{\n       0,     0,     3,     4,     7,     9,    12,    15,    18,    21,\n      24,    27,    31,    34,    38,    42,    46,    49,    52,    54,\n      56,    61,    65,    69,    73,    78,    85,    94,   105,   118,\n     121,   125,   127,   129,   131,   136,   138,   140,   144,   148,\n     152,   156,   160,   164,   167,   170,   174,   178,   182,   188,\n     194,   200,   203,   207,   211,   215,   219,   225,   231,   241,\n     246,   253,   262,   273,   286,   289,   292,   295,   298,   300,\n     302,   307,   311,   315,   319,   323,   327,   331,   335,   339,\n     343,   347,   351,   355,   359,   363,   367,   371,   375,   379,\n     383,   387,   391,   395,   399,   405,   411,   415,   419,   423,\n     429,   437,   449,   465,   468,   472,   478,   488,   492,   500,\n     510,   515,   522,   531,   542,   555,   558,   562,   564,   566,\n     571,   573,   577,   581,   587,   593\n};\n\n/* FFRHS -- A `-1'-separated list of the rules' RHS.  */\nstatic const fftype_int8 ffrhs[] =\n{\n      55,     0,    -1,    -1,    55,    56,    -1,    50,    -1,    59,\n      50,    -1,    60,    50,    -1,    62,    50,    -1,    61,    50,\n      -1,     1,    50,    -1,    23,    60,    -1,    57,    20,    60,\n      -1,    23,    59,    -1,    58,    20,    59,    -1,    58,    20,\n      60,    -1,    57,    20,    59,    -1,    58,    24,    -1,    57,\n      24,    -1,     7,    -1,    16,    -1,    16,    23,    59,    24,\n      -1,    61,    41,    61,    -1,    61,    40,    61,    -1,    61,\n      35,    61,    -1,    61,    47,    59,    51,    -1,    61,    47,\n      59,    20,    59,    51,    -1,    61,    47,    59,    20,    59,\n      20,    59,    51,    -1,    61,    47,    59,    20,    59,    20,\n      59,    20,    59,    51,    -1,    61,    47,    59,    20,    59,\n      20,    59,    20,    59,    20,    59,    51,    -1,    43,    61,\n      -1,    52,    61,    53,    -1,     4,    -1,     5,    -1,    13,\n      -1,    13,    23,    59,    24,    -1,    17,    -1,    18,    -1,\n      59,    37,    59,    -1,    59,    35,    59,    -1,    59,    36,\n      59,    -1,    59,    38,    59,    -1,    59,    39,    59,    -1,\n      59,    42,    59,    -1,    35,    59,    -1,    36,    59,    -1,\n      52,    59,    53,    -1,    59,    38,    60,    -1,    60,    38,\n      59,    -1,    60,    25,    59,    22,    59,    -1,    60,    25,\n      60,    22,    59,    -1,    60,    25,    59,    22,    60,    -1,\n       8,    53,    -1,     8,    60,    53,    -1,     8,    62,    53,\n      -1,     8,    61,    53,    -1,     8,    59,    53,    -1,    10,\n      62,    20,    62,    53,    -1,     8,    59,    20,    59,    53,\n      -1,     8,    59,    20,    59,    20,    59,    20,    59,    53,\n      -1,    59,    47,    59,    51,    -1,    59,    47,    59,    20,\n      59,    51,    -1,    59,    47,    59,    20,    59,    20,    59,\n      51,    -1,    59,    47,    59,    20,    59,    20,    59,    20,\n      59,    51,    -1,    59,    47,    59,    20,    59,    20,    59,\n      20,    59,    20,    59,    51,    -1,    45,    59,    -1,    45,\n      60,    -1,    44,    59,    -1,    44,    60,    -1,     3,    -1,\n      14,    -1,    14,    23,    59,    24,    -1,    61,    30,    61,\n      -1,    61,    29,    61,    -1,    61,    33,    61,    -1,    61,\n      32,    61,    -1,    61,    34,    61,    -1,    61,    31,    61,\n      -1,    59,    34,    59,    -1,    59,    33,    59,    -1,    59,\n      31,    59,    -1,    59,    32,    59,    -1,    59,    28,    59,\n      -1,    59,    30,    59,    -1,    59,    29,    59,    -1,    62,\n      30,    62,    -1,    62,    29,    62,    -1,    62,    34,    62,\n      -1,    62,    31,    62,    -1,    62,    33,    62,    -1,    62,\n      32,    62,    -1,    60,    27,    60,    -1,    60,    26,    60,\n      -1,    60,    30,    60,    -1,    60,    29,    60,    -1,    59,\n      21,    59,    22,    59,    -1,    60,    25,    60,    22,    60,\n      -1,     9,    59,    53,    -1,     9,    60,    53,    -1,     9,\n      62,    53,    -1,     8,    60,    20,    60,    53,    -1,     9,\n      59,    20,    59,    20,    59,    53,    -1,     9,    59,    20,\n      59,    20,    59,    20,    59,    20,    59,    53,    -1,     9,\n      59,    20,    59,    20,    59,    20,    59,    20,    59,    20,\n      59,    20,    59,    53,    -1,    11,    53,    -1,    11,     6,\n      53,    -1,    11,     6,    20,    59,    53,    -1,    11,     6,\n      20,    59,    20,     6,    20,     6,    53,    -1,    12,     6,\n      53,    -1,    12,     6,    20,    59,    20,    59,    53,    -1,\n      12,     6,    20,    59,    20,    59,    20,     6,    53,    -1,\n      60,    47,    59,    51,    -1,    60,    47,    59,    20,    59,\n      51,    -1,    60,    47,    59,    20,    59,    20,    59,    51,\n      -1,    60,    47,    59,    20,    59,    20,    59,    20,    59,\n      51,    -1,    60,    47,    59,    20,    59,    20,    59,    20,\n      59,    20,    59,    51,    -1,    43,    60,    -1,    52,    60,\n      53,    -1,     6,    -1,    15,    -1,    15,    23,    59,    24,\n      -1,    19,    -1,    52,    62,    53,    -1,    62,    35,    62,\n      -1,    60,    25,    62,    22,    62,    -1,     8,    62,    20,\n      62,    53,    -1,     8,    62,    20,    59,    20,    59,    53,\n      -1\n};\n\n/* FFRLINE[FFN] -- source line where rule number FFN was defined.  */\nstatic const fftype_uint16 ffrline[] =\n{\n       0,   244,   244,   245,   248,   249,   255,   261,   267,   273,\n     276,   278,   291,   293,   306,   317,   331,   335,   339,   343,\n     345,   354,   357,   360,   369,   371,   373,   375,   377,   379,\n     382,   386,   388,   390,   392,   401,   403,   405,   408,   411,\n     414,   417,   420,   423,   425,   427,   429,   433,   437,   456,\n     475,   494,   505,   519,   531,   562,   657,   665,   727,   751,\n     753,   755,   757,   759,   761,   763,   765,   767,   771,   773,\n     775,   784,   787,   790,   793,   796,   799,   802,   805,   808,\n     811,   814,   817,   820,   823,   826,   829,   832,   835,   838,\n     841,   843,   845,   847,   850,   857,   874,   887,   900,   911,\n     927,   951,   979,  1016,  1020,  1024,  1027,  1031,  1035,  1038,\n    1042,  1044,  1046,  1048,  1050,  1052,  1054,  1058,  1061,  1063,\n    1072,  1074,  1076,  1085,  1104,  1123\n};\n#endif\n\n#if FFDEBUG || FFERROR_VERBOSE || FFTOKEN_TABLE\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\", \"error\", \"$undefined\", \"BOOLEAN\", \"LONG\", \"DOUBLE\", \"STRING\",\n  \"BITSTR\", \"FUNCTION\", \"BFUNCTION\", \"IFUNCTION\", \"GTIFILTER\", \"REGFILTER\",\n  \"COLUMN\", \"BCOLUMN\", \"SCOLUMN\", \"BITCOL\", \"ROWREF\", \"NULLREF\",\n  \"SNULLREF\", \"','\", \"'='\", \"':'\", \"'{'\", \"'}'\", \"'?'\", \"OR\", \"AND\", \"'~'\",\n  \"NE\", \"EQ\", \"GTE\", \"LTE\", \"LT\", \"GT\", \"'+'\", \"'-'\", \"'%'\", \"'*'\", \"'/'\",\n  \"'|'\", \"'&'\", \"POWER\", \"NOT\", \"FLTCAST\", \"INTCAST\", \"UMINUS\", \"'['\",\n  \"DIFF\", \"ACCUM\", \"'\\\\n'\", \"']'\", \"'('\", \"')'\", \"$accept\", \"lines\",\n  \"line\", \"bvector\", \"vector\", \"expr\", \"bexpr\", \"bits\", \"sexpr\", 0\n};\n#endif\n\n# ifdef FFPRINT\n/* FFTOKNUM[FFLEX-NUM] -- Internal token number corresponding to\n   token FFLEX-NUM.  */\nstatic const fftype_uint16 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      44,    61,    58,   123,   125,    63,   275,   276,   126,   277,\n     278,   279,   280,   281,   282,    43,    45,    37,    42,    47,\n     124,    38,   283,   284,   285,   286,   287,    91,   288,   289,\n      10,    93,    40,    41\n};\n# endif\n\n/* FFR1[FFN] -- Symbol number of symbol that rule FFN derives.  */\nstatic const fftype_uint8 ffr1[] =\n{\n       0,    54,    55,    55,    56,    56,    56,    56,    56,    56,\n      57,    57,    58,    58,    58,    58,    59,    60,    61,    61,\n      61,    61,    61,    61,    61,    61,    61,    61,    61,    61,\n      61,    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,    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,    62,    62,    62,\n      62,    62,    62,    62,    62,    62\n};\n\n/* FFR2[FFN] -- Number of symbols composing right hand side of rule FFN.  */\nstatic const fftype_uint8 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,     2,     2,     3,     3,     3,     5,     5,\n       5,     2,     3,     3,     3,     3,     5,     5,     9,     4,\n       6,     8,    10,    12,     2,     2,     2,     2,     1,     1,\n       4,     3,     3,     3,     3,     3,     3,     3,     3,     3,\n       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,\n       3,     3,     3,     3,     5,     5,     3,     3,     3,     5,\n       7,    11,    15,     2,     3,     5,     9,     3,     7,     9,\n       4,     6,     8,    10,    12,     2,     3,     1,     1,     4,\n       1,     3,     3,     5,     5,     7\n};\n\n/* FFDEFACT[STATE-NAME] -- Default rule to reduce with in state\n   STATE-NUM when FFTABLE doesn't specify something else to do.  Zero\n   means the default is an error.  */\nstatic const fftype_uint8 ffdefact[] =\n{\n       2,     0,     1,     0,    68,    31,    32,   117,    18,     0,\n       0,     0,     0,     0,    33,    69,   118,    19,    35,    36,\n     120,     0,     0,     0,     0,     0,     0,     4,     0,     3,\n       0,     0,     0,     0,     0,     0,     9,    51,     0,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\n     103,     0,     0,     0,     0,     0,    12,    10,     0,    43,\n      44,   115,    29,    66,    67,    64,    65,     0,     0,     0,\n       0,     0,    17,     0,    16,     0,     0,     0,     0,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\n       5,     0,     0,     0,     0,     0,     0,     0,     6,     0,\n       0,     0,     0,     0,     0,     0,     0,     0,     0,     8,\n       0,     0,     0,     0,     0,     0,     0,     7,     0,    55,\n       0,    52,    54,     0,    53,     0,    96,    97,    98,     0,\n       0,   104,     0,   107,     0,     0,     0,     0,    45,   116,\n      30,   121,    15,    11,    13,    14,     0,    81,    83,    82,\n      79,    80,    78,    77,    38,    39,    37,    40,    46,    41,\n      42,     0,     0,     0,     0,    91,    90,    93,    92,    47,\n       0,     0,     0,    72,    71,    76,    74,    73,    75,    23,\n      22,    21,     0,    85,    84,    87,    89,    88,    86,   122,\n       0,     0,     0,     0,     0,     0,     0,     0,    34,    70,\n     119,    20,     0,     0,    59,     0,     0,     0,     0,   110,\n      29,     0,     0,    24,     0,    57,    99,     0,   124,     0,\n      56,     0,   105,     0,    94,     0,    48,    50,    49,    95,\n     123,     0,     0,     0,     0,     0,     0,     0,     0,    60,\n       0,   111,     0,    25,     0,   125,     0,   100,     0,     0,\n     108,     0,     0,     0,     0,     0,     0,     0,     0,    61,\n       0,   112,     0,    26,    58,     0,   106,   109,     0,     0,\n       0,     0,     0,    62,     0,   113,     0,    27,     0,   101,\n       0,     0,     0,     0,    63,   114,    28,     0,     0,   102\n};\n\n/* FFDEFGOTO[NTERM-NUM].  */\nstatic const fftype_int8 ffdefgoto[] =\n{\n      -1,     1,    29,    30,    31,    46,    47,    44,    58\n};\n\n/* FFPACT[STATE-NUM] -- Index in FFTABLE of the portion describing\n   STATE-NUM.  */\n#define FFPACT_NINF -46\nstatic const fftype_int16 ffpact[] =\n{\n     -46,   297,   -46,   -45,   -46,   -46,   -46,   -46,   -46,   347,\n     398,   398,    -5,     0,    -4,     5,    19,    23,   -46,   -46,\n     -46,   398,   398,   398,   398,   398,   398,   -46,   398,   -46,\n       6,    17,  1088,   296,  1468,  1490,   -46,   -46,   424,     9,\n    1374,   135,   452,   168,  1518,   344,  1355,  1449,  1555,   -10,\n     -46,    -9,   398,   398,   398,   398,  1355,  1449,   250,    -2,\n      -2,    10,    11,    -2,    10,    -2,    10,   619,   240,  1399,\n    1424,   398,   -46,   398,   -46,   398,   398,   398,   398,   398,\n     398,   398,   398,   398,   398,   398,   398,   398,   398,   398,\n     -46,   398,   398,   398,   398,   398,   398,   398,   -46,    -3,\n      -3,    -3,    -3,    -3,    -3,    -3,    -3,    -3,   398,   -46,\n     398,   398,   398,   398,   398,   398,   398,   -46,   398,   -46,\n     398,   -46,   -46,   398,   -46,   398,   -46,   -46,   -46,   398,\n     398,   -46,   398,   -46,  1231,  1251,  1271,  1291,   -46,   -46,\n     -46,   -46,  1355,  1449,  1355,  1449,  1313,  1535,  1535,  1535,\n    1556,  1556,  1556,  1556,    55,    55,    55,   -40,    10,   -40,\n     -40,   728,  1335,   400,   201,    74,   111,   -35,   -35,   -40,\n     752,    -3,    -3,    24,    24,    24,    24,    24,    24,    79,\n      11,    11,   776,   -17,   -17,    28,    28,    28,    28,   -46,\n     480,   342,  1111,  1431,  1131,  1438,   508,  1151,   -46,   -46,\n     -46,   -46,   398,   398,   -46,   398,   398,   398,   398,   -46,\n      11,    20,   398,   -46,   398,   -46,   -46,   398,   -46,   398,\n     -46,    60,   -46,   398,  1499,   800,  1499,  1449,  1499,  1449,\n     250,   824,   848,  1171,   646,   536,    48,   564,   398,   -46,\n     398,   -46,   398,   -46,   398,   -46,   398,   -46,    63,    83,\n     -46,   872,   896,   920,   673,  1191,    39,    45,   398,   -46,\n     398,   -46,   398,   -46,   -46,   398,   -46,   -46,   944,   968,\n     992,   592,   398,   -46,   398,   -46,   398,   -46,   398,   -46,\n    1016,  1040,  1064,  1211,   -46,   -46,   -46,   398,   700,   -46\n};\n\n/* FFPGOTO[NTERM-NUM].  */\nstatic const fftype_int16 ffpgoto[] =\n{\n     -46,   -46,   -46,   -46,   -46,    -1,    90,   147,    22\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 which\n   number is the opposite.  If zero, do what FFDEFACT says.\n   If FFTABLE_NINF, syntax error.  */\n#define FFTABLE_NINF -1\nstatic const fftype_uint16 fftable[] =\n{\n      32,    49,    88,    96,     8,    36,    51,    89,    38,    42,\n     130,   132,    97,    17,   112,   113,   114,   115,   116,    52,\n      56,    59,    60,    35,    63,    65,    71,    67,    53,   120,\n      72,    41,    45,    48,    91,    92,    93,    73,    94,    95,\n     171,    74,    54,   131,   133,    89,    55,    96,    50,   172,\n      70,   134,   135,   136,   137,   105,    97,    97,   108,   105,\n     106,   107,   121,   116,   106,   107,   236,   108,   248,   256,\n     142,   108,   144,   140,   146,   147,   148,   149,   150,   151,\n     152,   153,   154,   155,   156,   157,   159,   160,   161,   257,\n     162,    33,   266,    86,    87,   169,   170,    88,   267,    39,\n      43,    93,    89,    94,    95,     0,     0,   182,     0,     0,\n       0,    57,    96,   164,    61,    64,    66,   190,    68,   106,\n     107,    97,   192,     0,   194,     0,   108,     0,     0,   196,\n       0,   197,   183,   184,   185,   186,   187,   188,   189,     0,\n      94,    95,     0,     0,     0,   193,     0,     0,    34,    96,\n       0,   195,     0,     0,     0,   123,    40,     0,    97,     0,\n       0,   143,     0,   145,   110,   111,   112,   113,   114,   115,\n     116,    62,     0,     0,     0,    69,   158,     0,     0,     0,\n       0,   163,   165,   166,   167,   168,     0,     0,   124,     0,\n       0,     0,     0,    91,    92,    93,     0,    94,    95,     0,\n       0,   224,   225,     0,   226,   228,    96,   231,     0,     0,\n     191,   232,     0,   233,     0,    97,   234,     0,   235,     0,\n       0,   127,   237,   207,     0,     0,     0,     0,     0,   230,\n     110,   111,   112,   113,   114,   115,   116,   251,     0,   252,\n       0,   253,     0,   254,     0,   255,   173,   174,   175,   176,\n     177,   178,   179,   180,   181,     0,     0,   268,     0,   269,\n       0,   270,     0,     0,   271,    91,    92,    93,     0,    94,\n      95,   280,     0,   281,     0,   282,     0,   283,    96,   110,\n     111,   112,   113,   114,   115,   116,   288,    97,     0,     0,\n       0,     0,     0,   139,     0,   227,   229,     2,     3,     0,\n       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,\n      14,    15,    16,    17,    18,    19,    20,     0,   210,   211,\n      21,    91,    92,    93,     0,    94,    95,     0,     0,     0,\n       0,     0,    22,    23,    96,     0,     0,     0,     0,     0,\n      24,    25,    26,    97,     0,     0,    98,    27,     0,    28,\n       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,\n      14,    15,    16,    17,    18,    19,    20,    91,    92,    93,\n      21,    94,    95,   110,   111,   112,   113,   114,   115,   116,\n      96,     0,    22,    23,     0,     0,     0,     0,     0,    97,\n      24,    25,    26,     0,     0,   216,     0,   128,     0,    28,\n      37,     4,     5,     6,     7,     8,     9,    10,    11,    12,\n      13,    14,    15,    16,    17,    18,    19,    20,     0,     0,\n       0,    21,   206,     0,     0,    91,    92,    93,     0,    94,\n      95,     0,     0,    22,    23,     0,     0,     0,    96,     0,\n       0,    24,    25,    26,   118,    75,     0,    97,     0,     0,\n      28,     0,    76,    77,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,     0,     0,    88,     0,     0,     0,\n       0,    89,   125,    75,     0,     0,     0,   119,     0,     0,\n      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,     0,     0,    88,     0,     0,     0,     0,    89,\n     214,    75,     0,     0,     0,   126,     0,     0,    76,    77,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n       0,     0,    88,     0,     0,     0,     0,    89,   221,    75,\n       0,     0,     0,   215,     0,     0,    76,    77,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,     0,     0,\n      88,     0,     0,     0,     0,    89,   246,    75,     0,     0,\n       0,   222,     0,     0,    76,    77,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n       0,     0,     0,    89,   249,    75,     0,     0,     0,   247,\n       0,     0,    76,    77,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,     0,     0,    88,     0,     0,     0,\n       0,    89,   278,    75,     0,     0,     0,   250,     0,     0,\n      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,     0,     0,    88,     0,     0,     0,     0,    89,\n      75,     0,     0,     0,     0,   279,     0,    76,    77,    78,\n      79,    80,    81,    82,    83,    84,    85,    86,    87,     0,\n       0,    88,     0,     0,     0,     0,    89,    75,     0,     0,\n       0,     0,   138,     0,    76,    77,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n       0,     0,     0,    89,    75,     0,     0,     0,     0,   245,\n       0,    76,    77,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,     0,     0,    88,     0,     0,     0,     0,\n      89,    75,     0,     0,     0,     0,   264,     0,    76,    77,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n       0,     0,    88,     0,     0,     0,     0,    89,   203,    75,\n       0,     0,     0,   289,     0,     0,    76,    77,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,     0,     0,\n      88,     0,   208,    75,     0,    89,     0,     0,     0,   204,\n      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,     0,     0,    88,     0,   212,    75,     0,    89,\n       0,     0,     0,   209,    76,    77,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n     238,    75,     0,    89,     0,     0,     0,   213,    76,    77,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n       0,     0,    88,     0,   240,    75,     0,    89,     0,     0,\n       0,   239,    76,    77,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,     0,     0,    88,     0,   242,    75,\n       0,    89,     0,     0,     0,   241,    76,    77,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,     0,     0,\n      88,     0,   258,    75,     0,    89,     0,     0,     0,   243,\n      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,     0,     0,    88,     0,   260,    75,     0,    89,\n       0,     0,     0,   259,    76,    77,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n     262,    75,     0,    89,     0,     0,     0,   261,    76,    77,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n       0,     0,    88,     0,   272,    75,     0,    89,     0,     0,\n       0,   263,    76,    77,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,     0,     0,    88,     0,   274,    75,\n       0,    89,     0,     0,     0,   273,    76,    77,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,     0,     0,\n      88,     0,   276,    75,     0,    89,     0,     0,     0,   275,\n      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,\n      86,    87,     0,     0,    88,     0,     0,    75,     0,    89,\n       0,     0,     0,   277,    76,    77,    78,    79,    80,    81,\n      82,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n       0,    75,     0,    89,     0,     0,     0,   284,    76,    77,\n      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,\n       0,     0,    88,     0,     0,    75,     0,    89,     0,     0,\n       0,   285,    76,    77,    78,    79,    80,    81,    82,    83,\n      84,    85,    86,    87,     0,     0,    88,     0,     0,    75,\n       0,    89,     0,     0,     0,   286,    76,    77,    78,    79,\n      80,    81,    82,    83,    84,    85,    86,    87,     0,     0,\n      88,   217,    75,     0,     0,    89,     0,     0,    90,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,   219,    75,    88,     0,     0,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,   223,    75,    88,     0,     0,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,   244,    75,    88,     0,     0,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,   265,    75,    88,     0,     0,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,   287,    75,    88,     0,     0,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,     0,    75,    88,     0,   198,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,     0,    75,    88,     0,   199,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,     0,    75,    88,     0,   200,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,     0,    75,    88,     0,   201,     0,     0,    89,    76,\n      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,\n      87,     0,     0,    88,    75,   202,     0,     0,    89,     0,\n       0,    76,    77,    78,    79,    80,    81,    82,    83,    84,\n      85,    86,    87,     0,     0,    88,    75,   205,     0,     0,\n      89,     0,     0,    76,    77,    78,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,     0,    75,    88,     0,     0,\n       0,     0,    89,    76,    77,    78,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,     0,     0,    88,     0,     0,\n       0,     0,    89,    99,   100,   101,   102,   103,   104,   105,\n       0,     0,     0,     0,   106,   107,     0,     0,     0,     0,\n       0,   108,     0,     0,     0,     0,     0,   122,    99,   100,\n     101,   102,   103,   104,   105,     0,     0,     0,     0,   106,\n     107,     0,     0,     0,     0,     0,   108,     0,     0,     0,\n       0,     0,   140,   110,   111,   112,   113,   114,   115,   116,\n     110,   111,   112,   113,   114,   115,   116,   110,   111,   112,\n     113,   114,   115,   116,    91,    92,    93,   141,    94,    95,\n       0,     0,     0,     0,   218,     0,     0,    96,     0,     0,\n       0,   220,     0,     0,     0,     0,    97,    99,   100,   101,\n     102,   103,   104,   105,     0,     0,     0,     0,   106,   107,\n       0,     0,     0,     0,     0,   108,     0,     0,   109,   110,\n     111,   112,   113,   114,   115,   116,     0,    76,    77,    78,\n      79,    80,    81,    82,    83,    84,    85,    86,    87,     0,\n     117,    88,     0,     0,     0,     0,    89,    99,   100,   101,\n     102,   103,   104,   105,     0,     0,     0,     0,   106,   107,\n       0,     0,     0,     0,     0,   108,    79,    80,    81,    82,\n      83,    84,    85,    86,    87,   129,     0,    88,     0,     0,\n       0,     0,    89,     0,   110,   111,   112,   113,   114,   115,\n     116,    83,    84,    85,    86,    87,     0,     0,    88,     0,\n       0,     0,     0,    89\n};\n\nstatic const fftype_int16 ffcheck[] =\n{\n       1,     6,    42,    38,     7,    50,     6,    47,     9,    10,\n      20,    20,    47,    16,    31,    32,    33,    34,    35,    23,\n      21,    22,    23,     1,    25,    26,    20,    28,    23,    20,\n      24,     9,    10,    11,    25,    26,    27,    20,    29,    30,\n      43,    24,    23,    53,    53,    47,    23,    38,    53,    52,\n      28,    52,    53,    54,    55,    35,    47,    47,    47,    35,\n      40,    41,    53,    35,    40,    41,     6,    47,    20,     6,\n      71,    47,    73,    53,    75,    76,    77,    78,    79,    80,\n      81,    82,    83,    84,    85,    86,    87,    88,    89,     6,\n      91,     1,    53,    38,    39,    96,    97,    42,    53,     9,\n      10,    27,    47,    29,    30,    -1,    -1,   108,    -1,    -1,\n      -1,    21,    38,    91,    24,    25,    26,   118,    28,    40,\n      41,    47,   123,    -1,   125,    -1,    47,    -1,    -1,   130,\n      -1,   132,   110,   111,   112,   113,   114,   115,   116,    -1,\n      29,    30,    -1,    -1,    -1,   123,    -1,    -1,     1,    38,\n      -1,   129,    -1,    -1,    -1,    20,     9,    -1,    47,    -1,\n      -1,    71,    -1,    73,    29,    30,    31,    32,    33,    34,\n      35,    24,    -1,    -1,    -1,    28,    86,    -1,    -1,    -1,\n      -1,    91,    92,    93,    94,    95,    -1,    -1,    53,    -1,\n      -1,    -1,    -1,    25,    26,    27,    -1,    29,    30,    -1,\n      -1,   202,   203,    -1,   205,   206,    38,   208,    -1,    -1,\n     120,   212,    -1,   214,    -1,    47,   217,    -1,   219,    -1,\n      -1,    53,   223,    22,    -1,    -1,    -1,    -1,    -1,   207,\n      29,    30,    31,    32,    33,    34,    35,   238,    -1,   240,\n      -1,   242,    -1,   244,    -1,   246,    99,   100,   101,   102,\n     103,   104,   105,   106,   107,    -1,    -1,   258,    -1,   260,\n      -1,   262,    -1,    -1,   265,    25,    26,    27,    -1,    29,\n      30,   272,    -1,   274,    -1,   276,    -1,   278,    38,    29,\n      30,    31,    32,    33,    34,    35,   287,    47,    -1,    -1,\n      -1,    -1,    -1,    53,    -1,   205,   206,     0,     1,    -1,\n       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,\n      13,    14,    15,    16,    17,    18,    19,    -1,   171,   172,\n      23,    25,    26,    27,    -1,    29,    30,    -1,    -1,    -1,\n      -1,    -1,    35,    36,    38,    -1,    -1,    -1,    -1,    -1,\n      43,    44,    45,    47,    -1,    -1,    50,    50,    -1,    52,\n       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,\n      13,    14,    15,    16,    17,    18,    19,    25,    26,    27,\n      23,    29,    30,    29,    30,    31,    32,    33,    34,    35,\n      38,    -1,    35,    36,    -1,    -1,    -1,    -1,    -1,    47,\n      43,    44,    45,    -1,    -1,    53,    -1,    53,    -1,    52,\n      53,     3,     4,     5,     6,     7,     8,     9,    10,    11,\n      12,    13,    14,    15,    16,    17,    18,    19,    -1,    -1,\n      -1,    23,    22,    -1,    -1,    25,    26,    27,    -1,    29,\n      30,    -1,    -1,    35,    36,    -1,    -1,    -1,    38,    -1,\n      -1,    43,    44,    45,    20,    21,    -1,    47,    -1,    -1,\n      52,    -1,    28,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    -1,    -1,    42,    -1,    -1,    -1,\n      -1,    47,    20,    21,    -1,    -1,    -1,    53,    -1,    -1,\n      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,\n      38,    39,    -1,    -1,    42,    -1,    -1,    -1,    -1,    47,\n      20,    21,    -1,    -1,    -1,    53,    -1,    -1,    28,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      -1,    -1,    42,    -1,    -1,    -1,    -1,    47,    20,    21,\n      -1,    -1,    -1,    53,    -1,    -1,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,\n      42,    -1,    -1,    -1,    -1,    47,    20,    21,    -1,    -1,\n      -1,    53,    -1,    -1,    28,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      -1,    -1,    -1,    47,    20,    21,    -1,    -1,    -1,    53,\n      -1,    -1,    28,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    -1,    -1,    42,    -1,    -1,    -1,\n      -1,    47,    20,    21,    -1,    -1,    -1,    53,    -1,    -1,\n      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,\n      38,    39,    -1,    -1,    42,    -1,    -1,    -1,    -1,    47,\n      21,    -1,    -1,    -1,    -1,    53,    -1,    28,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    -1,\n      -1,    42,    -1,    -1,    -1,    -1,    47,    21,    -1,    -1,\n      -1,    -1,    53,    -1,    28,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      -1,    -1,    -1,    47,    21,    -1,    -1,    -1,    -1,    53,\n      -1,    28,    29,    30,    31,    32,    33,    34,    35,    36,\n      37,    38,    39,    -1,    -1,    42,    -1,    -1,    -1,    -1,\n      47,    21,    -1,    -1,    -1,    -1,    53,    -1,    28,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      -1,    -1,    42,    -1,    -1,    -1,    -1,    47,    20,    21,\n      -1,    -1,    -1,    53,    -1,    -1,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,\n      42,    -1,    20,    21,    -1,    47,    -1,    -1,    -1,    51,\n      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,\n      38,    39,    -1,    -1,    42,    -1,    20,    21,    -1,    47,\n      -1,    -1,    -1,    51,    28,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      20,    21,    -1,    47,    -1,    -1,    -1,    51,    28,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      -1,    -1,    42,    -1,    20,    21,    -1,    47,    -1,    -1,\n      -1,    51,    28,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    -1,    -1,    42,    -1,    20,    21,\n      -1,    47,    -1,    -1,    -1,    51,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,\n      42,    -1,    20,    21,    -1,    47,    -1,    -1,    -1,    51,\n      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,\n      38,    39,    -1,    -1,    42,    -1,    20,    21,    -1,    47,\n      -1,    -1,    -1,    51,    28,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      20,    21,    -1,    47,    -1,    -1,    -1,    51,    28,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      -1,    -1,    42,    -1,    20,    21,    -1,    47,    -1,    -1,\n      -1,    51,    28,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    -1,    -1,    42,    -1,    20,    21,\n      -1,    47,    -1,    -1,    -1,    51,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,\n      42,    -1,    20,    21,    -1,    47,    -1,    -1,    -1,    51,\n      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,\n      38,    39,    -1,    -1,    42,    -1,    -1,    21,    -1,    47,\n      -1,    -1,    -1,    51,    28,    29,    30,    31,    32,    33,\n      34,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      -1,    21,    -1,    47,    -1,    -1,    -1,    51,    28,    29,\n      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,\n      -1,    -1,    42,    -1,    -1,    21,    -1,    47,    -1,    -1,\n      -1,    51,    28,    29,    30,    31,    32,    33,    34,    35,\n      36,    37,    38,    39,    -1,    -1,    42,    -1,    -1,    21,\n      -1,    47,    -1,    -1,    -1,    51,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,\n      42,    20,    21,    -1,    -1,    47,    -1,    -1,    50,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    20,    21,    42,    -1,    -1,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    20,    21,    42,    -1,    -1,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    20,    21,    42,    -1,    -1,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    20,    21,    42,    -1,    -1,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    20,    21,    42,    -1,    -1,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    -1,    21,    42,    -1,    24,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    -1,    21,    42,    -1,    24,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    -1,    21,    42,    -1,    24,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    -1,    21,    42,    -1,    24,    -1,    -1,    47,    28,\n      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,\n      39,    -1,    -1,    42,    21,    22,    -1,    -1,    47,    -1,\n      -1,    28,    29,    30,    31,    32,    33,    34,    35,    36,\n      37,    38,    39,    -1,    -1,    42,    21,    22,    -1,    -1,\n      47,    -1,    -1,    28,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    -1,    21,    42,    -1,    -1,\n      -1,    -1,    47,    28,    29,    30,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    -1,    -1,    42,    -1,    -1,\n      -1,    -1,    47,    29,    30,    31,    32,    33,    34,    35,\n      -1,    -1,    -1,    -1,    40,    41,    -1,    -1,    -1,    -1,\n      -1,    47,    -1,    -1,    -1,    -1,    -1,    53,    29,    30,\n      31,    32,    33,    34,    35,    -1,    -1,    -1,    -1,    40,\n      41,    -1,    -1,    -1,    -1,    -1,    47,    -1,    -1,    -1,\n      -1,    -1,    53,    29,    30,    31,    32,    33,    34,    35,\n      29,    30,    31,    32,    33,    34,    35,    29,    30,    31,\n      32,    33,    34,    35,    25,    26,    27,    53,    29,    30,\n      -1,    -1,    -1,    -1,    53,    -1,    -1,    38,    -1,    -1,\n      -1,    53,    -1,    -1,    -1,    -1,    47,    29,    30,    31,\n      32,    33,    34,    35,    -1,    -1,    -1,    -1,    40,    41,\n      -1,    -1,    -1,    -1,    -1,    47,    -1,    -1,    50,    29,\n      30,    31,    32,    33,    34,    35,    -1,    28,    29,    30,\n      31,    32,    33,    34,    35,    36,    37,    38,    39,    -1,\n      50,    42,    -1,    -1,    -1,    -1,    47,    29,    30,    31,\n      32,    33,    34,    35,    -1,    -1,    -1,    -1,    40,    41,\n      -1,    -1,    -1,    -1,    -1,    47,    31,    32,    33,    34,\n      35,    36,    37,    38,    39,    20,    -1,    42,    -1,    -1,\n      -1,    -1,    47,    -1,    29,    30,    31,    32,    33,    34,\n      35,    35,    36,    37,    38,    39,    -1,    -1,    42,    -1,\n      -1,    -1,    -1,    47\n};\n\n/* FFSTOS[STATE-NUM] -- The (internal number of the) accessing\n   symbol of state STATE-NUM.  */\nstatic const fftype_uint8 ffstos[] =\n{\n       0,    55,     0,     1,     3,     4,     5,     6,     7,     8,\n       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,\n      19,    23,    35,    36,    43,    44,    45,    50,    52,    56,\n      57,    58,    59,    60,    61,    62,    50,    53,    59,    60,\n      61,    62,    59,    60,    61,    62,    59,    60,    62,     6,\n      53,     6,    23,    23,    23,    23,    59,    60,    62,    59,\n      59,    60,    61,    59,    60,    59,    60,    59,    60,    61,\n      62,    20,    24,    20,    24,    21,    28,    29,    30,    31,\n      32,    33,    34,    35,    36,    37,    38,    39,    42,    47,\n      50,    25,    26,    27,    29,    30,    38,    47,    50,    29,\n      30,    31,    32,    33,    34,    35,    40,    41,    47,    50,\n      29,    30,    31,    32,    33,    34,    35,    50,    20,    53,\n      20,    53,    53,    20,    53,    20,    53,    53,    53,    20,\n      20,    53,    20,    53,    59,    59,    59,    59,    53,    53,\n      53,    53,    59,    60,    59,    60,    59,    59,    59,    59,\n      59,    59,    59,    59,    59,    59,    59,    59,    60,    59,\n      59,    59,    59,    60,    62,    60,    60,    60,    60,    59,\n      59,    43,    52,    61,    61,    61,    61,    61,    61,    61,\n      61,    61,    59,    62,    62,    62,    62,    62,    62,    62,\n      59,    60,    59,    62,    59,    62,    59,    59,    24,    24,\n      24,    24,    22,    20,    51,    22,    22,    22,    20,    51,\n      61,    61,    20,    51,    20,    53,    53,    20,    53,    20,\n      53,    20,    53,    20,    59,    59,    59,    60,    59,    60,\n      62,    59,    59,    59,    59,    59,     6,    59,    20,    51,\n      20,    51,    20,    51,    20,    53,    20,    53,    20,    20,\n      53,    59,    59,    59,    59,    59,     6,     6,    20,    51,\n      20,    51,    20,    51,    53,    20,    53,    53,    59,    59,\n      59,    59,    20,    51,    20,    51,    20,    51,    20,    53,\n      59,    59,    59,    59,    51,    51,    51,    20,    59,    53\n};\n\n#define fferrok\t\t(fferrstatus = 0)\n#define ffclearin\t(ffchar = FFEMPTY)\n#define FFEMPTY\t\t(-2)\n#define FFEOF\t\t0\n\n#define FFACCEPT\tgoto ffacceptlab\n#define FFABORT\t\tgoto ffabortlab\n#define FFERROR\t\tgoto fferrorlab\n\n\n/* Like FFERROR except do call fferror.  This remains here temporarily\n   to ease the transition to the new meaning of FFERROR, for GCC.\n   Once GCC version 2 has supplanted version 1, this can go.  */\n\n#define FFFAIL\t\tgoto fferrlab\n\n#define FFRECOVERING()  (!!fferrstatus)\n\n#define FFBACKUP(Token, Value)\t\t\t\t\t\\\ndo\t\t\t\t\t\t\t\t\\\n  if (ffchar == FFEMPTY && fflen == 1)\t\t\t\t\\\n    {\t\t\t\t\t\t\t\t\\\n      ffchar = (Token);\t\t\t\t\t\t\\\n      fflval = (Value);\t\t\t\t\t\t\\\n      fftoken = FFTRANSLATE (ffchar);\t\t\t\t\\\n      FFPOPSTACK (1);\t\t\t\t\t\t\\\n      goto ffbackup;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\\\n  else\t\t\t\t\t\t\t\t\\\n    {\t\t\t\t\t\t\t\t\\\n      fferror (FF_(\"syntax error: cannot back up\")); \\\n      FFERROR;\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\\\nwhile (FFID (0))\n\n\n#define FFTERROR\t1\n#define FFERRCODE\t256\n\n\n/* FFLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].\n   If N is 0, then set CURRENT to the empty location which ends\n   the previous symbol: RHS[0] (always defined).  */\n\n#define FFRHSLOC(Rhs, K) ((Rhs)[K])\n#ifndef FFLLOC_DEFAULT\n# define FFLLOC_DEFAULT(Current, Rhs, N)\t\t\t\t\\\n    do\t\t\t\t\t\t\t\t\t\\\n      if (FFID (N))                                                    \\\n\t{\t\t\t\t\t\t\t\t\\\n\t  (Current).first_line   = FFRHSLOC (Rhs, 1).first_line;\t\\\n\t  (Current).first_column = FFRHSLOC (Rhs, 1).first_column;\t\\\n\t  (Current).last_line    = FFRHSLOC (Rhs, N).last_line;\t\t\\\n\t  (Current).last_column  = FFRHSLOC (Rhs, N).last_column;\t\\\n\t}\t\t\t\t\t\t\t\t\\\n      else\t\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  (Current).first_line   = (Current).last_line   =\t\t\\\n\t    FFRHSLOC (Rhs, 0).last_line;\t\t\t\t\\\n\t  (Current).first_column = (Current).last_column =\t\t\\\n\t    FFRHSLOC (Rhs, 0).last_column;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    while (FFID (0))\n#endif\n\n\n/* FF_LOCATION_PRINT -- Print the location on the stream.\n   This macro was not mandated originally: define only if we know\n   we won't break user code: when these are the locations we know.  */\n\n#ifndef FF_LOCATION_PRINT\n# if FFLTYPE_IS_TRIVIAL\n#  define FF_LOCATION_PRINT(File, Loc)\t\t\t\\\n     fprintf (File, \"%d.%d-%d.%d\",\t\t\t\\\n\t      (Loc).first_line, (Loc).first_column,\t\\\n\t      (Loc).last_line,  (Loc).last_column)\n# else\n#  define FF_LOCATION_PRINT(File, Loc) ((void) 0)\n# endif\n#endif\n\n\n/* FFLEX -- calling `fflex' with the right arguments.  */\n\n#ifdef FFLEX_PARAM\n# define FFLEX fflex (FFLEX_PARAM)\n#else\n# define FFLEX fflex ()\n#endif\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)\t\t\t\\\ndo {\t\t\t\t\t\t\\\n  if (ffdebug)\t\t\t\t\t\\\n    FFFPRINTF Args;\t\t\t\t\\\n} while (FFID (0))\n\n# define FF_SYMBOL_PRINT(Title, Type, Value, Location)\t\t\t  \\\ndo {\t\t\t\t\t\t\t\t\t  \\\n  if (ffdebug)\t\t\t\t\t\t\t\t  \\\n    {\t\t\t\t\t\t\t\t\t  \\\n      FFFPRINTF (stderr, \"%s \", Title);\t\t\t\t\t  \\\n      ff_symbol_print (stderr,\t\t\t\t\t\t  \\\n\t\t  Type, Value); \\\n      FFFPRINTF (stderr, \"\\n\");\t\t\t\t\t\t  \\\n    }\t\t\t\t\t\t\t\t\t  \\\n} while (FFID (0))\n\n\n/*--------------------------------.\n| Print this symbol on FFOUTPUT.  |\n`--------------------------------*/\n\n/*ARGSUSED*/\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic void\nff_symbol_value_print (FILE *ffoutput, int fftype, FFSTYPE const * const ffvaluep)\n#else\nstatic void\nff_symbol_value_print (ffoutput, fftype, ffvaluep)\n    FILE *ffoutput;\n    int fftype;\n    FFSTYPE const * const ffvaluep;\n#endif\n{\n  if (!ffvaluep)\n    return;\n# ifdef FFPRINT\n  if (fftype < FFNTOKENS)\n    FFPRINT (ffoutput, fftoknum[fftype], *ffvaluep);\n# else\n  FFUSE (ffoutput);\n# endif\n  switch (fftype)\n    {\n      default:\n\tbreak;\n    }\n}\n\n\n/*--------------------------------.\n| Print this symbol on FFOUTPUT.  |\n`--------------------------------*/\n\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic void\nff_symbol_print (FILE *ffoutput, int fftype, FFSTYPE const * const ffvaluep)\n#else\nstatic void\nff_symbol_print (ffoutput, fftype, ffvaluep)\n    FILE *ffoutput;\n    int fftype;\n    FFSTYPE const * const ffvaluep;\n#endif\n{\n  if (fftype < FFNTOKENS)\n    FFFPRINTF (ffoutput, \"token %s (\", fftname[fftype]);\n  else\n    FFFPRINTF (ffoutput, \"nterm %s (\", fftname[fftype]);\n\n  ff_symbol_value_print (ffoutput, fftype, ffvaluep);\n  FFFPRINTF (ffoutput, \")\");\n}\n\n/*------------------------------------------------------------------.\n| ff_stack_print -- Print the state stack from its BOTTOM up to its |\n| TOP (included).                                                   |\n`------------------------------------------------------------------*/\n\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic void\nff_stack_print (fftype_int16 *ffbottom, fftype_int16 *fftop)\n#else\nstatic void\nff_stack_print (ffbottom, fftop)\n    fftype_int16 *ffbottom;\n    fftype_int16 *fftop;\n#endif\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)\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\\\n  if (ffdebug)\t\t\t\t\t\t\t\\\n    ff_stack_print ((Bottom), (Top));\t\t\t\t\\\n} while (FFID (0))\n\n\n/*------------------------------------------------.\n| Report that the FFRULE is going to be reduced.  |\n`------------------------------------------------*/\n\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic void\nff_reduce_print (FFSTYPE *ffvsp, int ffrule)\n#else\nstatic void\nff_reduce_print (ffvsp, ffrule)\n    FFSTYPE *ffvsp;\n    int ffrule;\n#endif\n{\n  int ffnrhs = ffr2[ffrule];\n  int ffi;\n  unsigned long int fflno = ffrline[ffrule];\n  FFFPRINTF (stderr, \"Reducing stack by rule %d (line %lu):\\n\",\n\t     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, ffrhs[ffprhs[ffrule] + ffi],\n\t\t       &(ffvsp[(ffi + 1) - (ffnrhs)])\n\t\t       \t\t       );\n      FFFPRINTF (stderr, \"\\n\");\n    }\n}\n\n# define FF_REDUCE_PRINT(Rule)\t\t\\\ndo {\t\t\t\t\t\\\n  if (ffdebug)\t\t\t\t\\\n    ff_reduce_print (ffvsp, Rule); \\\n} while (FFID (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)\n# define FF_SYMBOL_PRINT(Title, Type, 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\tFFINITDEPTH\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\f\n\n#if FFERROR_VERBOSE\n\n# ifndef ffstrlen\n#  if defined __GLIBC__ && defined _STRING_H\n#   define ffstrlen strlen\n#  else\n/* Return the length of FFSTR.  */\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic FFSIZE_T\nffstrlen (const char *ffstr)\n#else\nstatic FFSIZE_T\nffstrlen (ffstr)\n    const char *ffstr;\n#endif\n{\n  FFSIZE_T fflen;\n  for (fflen = 0; ffstr[fflen]; fflen++)\n    continue;\n  return fflen;\n}\n#  endif\n# endif\n\n# ifndef ffstpcpy\n#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE\n#   define ffstpcpy stpcpy\n#  else\n/* Copy FFSRC to FFDEST, returning the address of the terminating '\\0' in\n   FFDEST.  */\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic char *\nffstpcpy (char *ffdest, const char *ffsrc)\n#else\nstatic char *\nffstpcpy (ffdest, ffsrc)\n    char *ffdest;\n    const char *ffsrc;\n#endif\n{\n  char *ffd = ffdest;\n  const char *ffs = ffsrc;\n\n  while ((*ffd++ = *ffs++) != '\\0')\n    continue;\n\n  return ffd - 1;\n}\n#  endif\n# endif\n\n# ifndef fftnamerr\n/* Copy to FFRES the contents of FFSTR after stripping away unnecessary\n   quotes and backslashes, so that it's suitable for fferror.  The\n   heuristic is that double-quoting is unnecessary unless the string\n   contains an apostrophe, a comma, or backslash (other than\n   backslash-backslash).  FFSTR is taken from fftname.  If FFRES is\n   null, do not copy; instead, return the length of what the result\n   would have been.  */\nstatic FFSIZE_T\nfftnamerr (char *ffres, const char *ffstr)\n{\n  if (*ffstr == '\"')\n    {\n      FFSIZE_T ffn = 0;\n      char const *ffp = ffstr;\n\n      for (;;)\n\tswitch (*++ffp)\n\t  {\n\t  case '\\'':\n\t  case ',':\n\t    goto do_not_strip_quotes;\n\n\t  case '\\\\':\n\t    if (*++ffp != '\\\\')\n\t      goto do_not_strip_quotes;\n\t    /* Fall through.  */\n\t  default:\n\t    if (ffres)\n\t      ffres[ffn] = *ffp;\n\t    ffn++;\n\t    break;\n\n\t  case '\"':\n\t    if (ffres)\n\t      ffres[ffn] = '\\0';\n\t    return ffn;\n\t  }\n    do_not_strip_quotes: ;\n    }\n\n  if (! ffres)\n    return ffstrlen (ffstr);\n\n  return ffstpcpy (ffres, ffstr) - ffres;\n}\n# endif\n\n/* Copy into FFRESULT an error message about the unexpected token\n   FFCHAR while in state FFSTATE.  Return the number of bytes copied,\n   including the terminating null byte.  If FFRESULT is null, do not\n   copy anything; just return the number of bytes that would be\n   copied.  As a special case, return 0 if an ordinary \"syntax error\"\n   message will do.  Return FFSIZE_MAXIMUM if overflow occurs during\n   size calculation.  */\nstatic FFSIZE_T\nffsyntax_error (char *ffresult, int ffstate, int ffchar)\n{\n  int ffn = ffpact[ffstate];\n\n  if (! (FFPACT_NINF < ffn && ffn <= FFLAST))\n    return 0;\n  else\n    {\n      int fftype = FFTRANSLATE (ffchar);\n      FFSIZE_T ffsize0 = fftnamerr (0, fftname[fftype]);\n      FFSIZE_T ffsize = ffsize0;\n      FFSIZE_T ffsize1;\n      int ffsize_overflow = 0;\n      enum { FFERROR_VERBOSE_ARGS_MAXIMUM = 5 };\n      char const *ffarg[FFERROR_VERBOSE_ARGS_MAXIMUM];\n      int ffx;\n\n# if 0\n      /* This is so xgettext sees the translatable formats that are\n\t constructed on the fly.  */\n      FF_(\"syntax error, unexpected %s\");\n      FF_(\"syntax error, unexpected %s, expecting %s\");\n      FF_(\"syntax error, unexpected %s, expecting %s or %s\");\n      FF_(\"syntax error, unexpected %s, expecting %s or %s or %s\");\n      FF_(\"syntax error, unexpected %s, expecting %s or %s or %s or %s\");\n# endif\n      char *fffmt;\n      char const *fff;\n      static char const ffunexpected[] = \"syntax error, unexpected %s\";\n      static char const ffexpecting[] = \", expecting %s\";\n      static char const ffor[] = \" or %s\";\n      char ffformat[sizeof ffunexpected\n\t\t    + sizeof ffexpecting - 1\n\t\t    + ((FFERROR_VERBOSE_ARGS_MAXIMUM - 2)\n\t\t       * (sizeof ffor - 1))];\n      char const *ffprefix = ffexpecting;\n\n      /* Start FFX at -FFN if negative to avoid negative indexes in\n\t FFCHECK.  */\n      int ffxbegin = ffn < 0 ? -ffn : 0;\n\n      /* Stay within bounds of both ffcheck and fftname.  */\n      int ffchecklim = FFLAST - ffn + 1;\n      int ffxend = ffchecklim < FFNTOKENS ? ffchecklim : FFNTOKENS;\n      int ffcount = 1;\n\n      ffarg[0] = fftname[fftype];\n      fffmt = ffstpcpy (ffformat, ffunexpected);\n\n      for (ffx = ffxbegin; ffx < ffxend; ++ffx)\n\tif (ffcheck[ffx + ffn] == ffx && ffx != FFTERROR)\n\t  {\n\t    if (ffcount == FFERROR_VERBOSE_ARGS_MAXIMUM)\n\t      {\n\t\tffcount = 1;\n\t\tffsize = ffsize0;\n\t\tffformat[sizeof ffunexpected - 1] = '\\0';\n\t\tbreak;\n\t      }\n\t    ffarg[ffcount++] = fftname[ffx];\n\t    ffsize1 = ffsize + fftnamerr (0, fftname[ffx]);\n\t    ffsize_overflow |= (ffsize1 < ffsize);\n\t    ffsize = ffsize1;\n\t    fffmt = ffstpcpy (fffmt, ffprefix);\n\t    ffprefix = ffor;\n\t  }\n\n      fff = FF_(ffformat);\n      ffsize1 = ffsize + ffstrlen (fff);\n      ffsize_overflow |= (ffsize1 < ffsize);\n      ffsize = ffsize1;\n\n      if (ffsize_overflow)\n\treturn FFSIZE_MAXIMUM;\n\n      if (ffresult)\n\t{\n\t  /* Avoid sprintf, as that infringes on the user's name space.\n\t     Don't have undefined behavior even if the translation\n\t     produced a string with the wrong number of \"%s\"s.  */\n\t  char *ffp = ffresult;\n\t  int ffi = 0;\n\t  while ((*ffp = *fff) != '\\0')\n\t    {\n\t      if (*ffp == '%' && fff[1] == 's' && ffi < ffcount)\n\t\t{\n\t\t  ffp += fftnamerr (ffp, ffarg[ffi++]);\n\t\t  fff += 2;\n\t\t}\n\t      else\n\t\t{\n\t\t  ffp++;\n\t\t  fff++;\n\t\t}\n\t    }\n\t}\n      return ffsize;\n    }\n}\n#endif /* FFERROR_VERBOSE */\n\f\n\n/*-----------------------------------------------.\n| Release the memory associated to this symbol.  |\n`-----------------------------------------------*/\n\n/*ARGSUSED*/\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nstatic void\nffdestruct (const char *ffmsg, int fftype, FFSTYPE *ffvaluep)\n#else\nstatic void\nffdestruct (ffmsg, fftype, ffvaluep)\n    const char *ffmsg;\n    int fftype;\n    FFSTYPE *ffvaluep;\n#endif\n{\n  FFUSE (ffvaluep);\n\n  if (!ffmsg)\n    ffmsg = \"Deleting\";\n  FF_SYMBOL_PRINT (ffmsg, fftype, ffvaluep, fflocationp);\n\n  switch (fftype)\n    {\n\n      default:\n\tbreak;\n    }\n}\n\n/* Prevent warnings from -Wmissing-prototypes.  */\n#ifdef FFPARSE_PARAM\n#if defined __STDC__ || defined __cplusplus\nint ffparse (void *FFPARSE_PARAM);\n#else\nint ffparse ();\n#endif\n#else /* ! FFPARSE_PARAM */\n#if defined __STDC__ || defined __cplusplus\nint ffparse (void);\n#else\nint ffparse ();\n#endif\n#endif /* ! FFPARSE_PARAM */\n\n\n/* The lookahead symbol.  */\nint ffchar;\n\n/* The semantic value of the lookahead symbol.  */\nFFSTYPE fflval;\n\n/* Number of syntax errors so far.  */\nint ffnerrs;\n\n\n\n/*-------------------------.\n| ffparse or ffpush_parse.  |\n`-------------------------*/\n\n#ifdef FFPARSE_PARAM\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nint\nffparse (void *FFPARSE_PARAM)\n#else\nint\nffparse (FFPARSE_PARAM)\n    void *FFPARSE_PARAM;\n#endif\n#else /* ! FFPARSE_PARAM */\n#if (defined __STDC__ || defined __C99__FUNC__ \\\n     || defined __cplusplus || defined _MSC_VER)\nint\nffparse (void)\n#else\nint\nffparse ()\n\n#endif\n#endif\n{\n\n\n    int ffstate;\n    /* Number of tokens to shift before error messages enabled.  */\n    int fferrstatus;\n\n    /* The stacks and their tools:\n       `ffss': related to states.\n       `ffvs': related to semantic values.\n\n       Refer to the stacks thru separate pointers, to allow ffoverflow\n       to reallocate them elsewhere.  */\n\n    /* The state stack.  */\n    fftype_int16 ffssa[FFINITDEPTH];\n    fftype_int16 *ffss;\n    fftype_int16 *ffssp;\n\n    /* The semantic value stack.  */\n    FFSTYPE ffvsa[FFINITDEPTH];\n    FFSTYPE *ffvs;\n    FFSTYPE *ffvsp;\n\n    FFSIZE_T ffstacksize;\n\n  int ffn;\n  int ffresult;\n  /* Lookahead token as an internal (translated) token number.  */\n  int fftoken;\n  /* The variables used to return semantic value and location from the\n     action routines.  */\n  FFSTYPE ffval;\n\n#if FFERROR_VERBOSE\n  /* Buffer for error messages, and its allocated size.  */\n  char ffmsgbuf[128];\n  char *ffmsg = ffmsgbuf;\n  FFSIZE_T ffmsg_alloc = sizeof ffmsgbuf;\n#endif\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  fftoken = 0;\n  ffss = ffssa;\n  ffvs = ffvsa;\n  ffstacksize = FFINITDEPTH;\n\n  FFDPRINTF ((stderr, \"Starting parse\\n\"));\n\n  ffstate = 0;\n  fferrstatus = 0;\n  ffnerrs = 0;\n  ffchar = FFEMPTY; /* Cause a token to be read.  */\n\n  /* Initialize stack pointers.\n     Waste one element of value and location stack\n     so that they stay on the same level as the state stack.\n     The wasted elements are never initialized.  */\n  ffssp = ffss;\n  ffvsp = ffvs;\n\n  goto ffsetstate;\n\n/*------------------------------------------------------------.\n| ffnewstate -- Push a new state, which is found in ffstate.  |\n`------------------------------------------------------------*/\n ffnewstate:\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 ffsetstate:\n  *ffssp = ffstate;\n\n  if (ffss + ffstacksize - 1 <= ffssp)\n    {\n      /* Get the current used size of the three stacks, in elements.  */\n      FFSIZE_T ffsize = ffssp - ffss + 1;\n\n#ifdef ffoverflow\n      {\n\t/* Give user a chance to reallocate the stack.  Use copies of\n\t   these so that the &'s don't force the real ones into\n\t   memory.  */\n\tFFSTYPE *ffvs1 = ffvs;\n\tfftype_int16 *ffss1 = ffss;\n\n\t/* Each stack pointer address is followed by the size of the\n\t   data in use in that stack, in bytes.  This used to be a\n\t   conditional around just the two extra args, but that might\n\t   be undefined if ffoverflow is a macro.  */\n\tffoverflow (FF_(\"memory exhausted\"),\n\t\t    &ffss1, ffsize * sizeof (*ffssp),\n\t\t    &ffvs1, ffsize * sizeof (*ffvsp),\n\t\t    &ffstacksize);\n\n\tffss = ffss1;\n\tffvs = ffvs1;\n      }\n#else /* no ffoverflow */\n# ifndef FFSTACK_RELOCATE\n      goto ffexhaustedlab;\n# else\n      /* Extend the stack our own way.  */\n      if (FFMAXDEPTH <= ffstacksize)\n\tgoto ffexhaustedlab;\n      ffstacksize *= 2;\n      if (FFMAXDEPTH < ffstacksize)\n\tffstacksize = FFMAXDEPTH;\n\n      {\n\tfftype_int16 *ffss1 = ffss;\n\tunion ffalloc *ffptr =\n\t  (union ffalloc *) FFSTACK_ALLOC (FFSTACK_BYTES (ffstacksize));\n\tif (! ffptr)\n\t  goto ffexhaustedlab;\n\tFFSTACK_RELOCATE (ffss_alloc, ffss);\n\tFFSTACK_RELOCATE (ffvs_alloc, ffvs);\n#  undef FFSTACK_RELOCATE\n\tif (ffss1 != ffssa)\n\t  FFSTACK_FREE (ffss1);\n      }\n# endif\n#endif /* no ffoverflow */\n\n      ffssp = ffss + ffsize - 1;\n      ffvsp = ffvs + ffsize - 1;\n\n      FFDPRINTF ((stderr, \"Stack size increased to %lu\\n\",\n\t\t  (unsigned long int) ffstacksize));\n\n      if (ffss + ffstacksize - 1 <= ffssp)\n\tFFABORT;\n    }\n\n  FFDPRINTF ((stderr, \"Entering state %d\\n\", ffstate));\n\n  if (ffstate == FFFINAL)\n    FFACCEPT;\n\n  goto ffbackup;\n\n/*-----------.\n| ffbackup.  |\n`-----------*/\nffbackup:\n\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 (ffn == FFPACT_NINF)\n    goto ffdefault;\n\n  /* Not known => get a lookahead token if don't already have one.  */\n\n  /* FFCHAR is either FFEMPTY or FFEOF or a valid lookahead symbol.  */\n  if (ffchar == FFEMPTY)\n    {\n      FFDPRINTF ((stderr, \"Reading a token: \"));\n      ffchar = FFLEX;\n    }\n\n  if (ffchar <= FFEOF)\n    {\n      ffchar = fftoken = FFEOF;\n      FFDPRINTF ((stderr, \"Now at end of input.\\n\"));\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 (ffn == 0 || ffn == FFTABLE_NINF)\n\tgoto 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\n  /* Discard the shifted token.  */\n  ffchar = FFEMPTY;\n\n  ffstate = ffn;\n  *++ffvsp = fflval;\n\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:\n\n/* Line 1455 of yacc.c  */\n#line 248 \"eval.y\"\n    {}\n    break;\n\n  case 5:\n\n/* Line 1455 of yacc.c  */\n#line 250 \"eval.y\"\n    { if( (ffvsp[(1) - (2)].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[(1) - (2)].Node);\n\t\t}\n    break;\n\n  case 6:\n\n/* Line 1455 of yacc.c  */\n#line 256 \"eval.y\"\n    { if( (ffvsp[(1) - (2)].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[(1) - (2)].Node);\n\t\t}\n    break;\n\n  case 7:\n\n/* Line 1455 of yacc.c  */\n#line 262 \"eval.y\"\n    { if( (ffvsp[(1) - (2)].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  } \n                  gParse.resultNode = (ffvsp[(1) - (2)].Node);\n\t\t}\n    break;\n\n  case 8:\n\n/* Line 1455 of yacc.c  */\n#line 268 \"eval.y\"\n    { if( (ffvsp[(1) - (2)].Node)<0 ) {\n\t\t     fferror(\"Couldn't build node structure: out of memory?\");\n\t\t     FFERROR;  }\n                  gParse.resultNode = (ffvsp[(1) - (2)].Node);\n\t\t}\n    break;\n\n  case 9:\n\n/* Line 1455 of yacc.c  */\n#line 273 \"eval.y\"\n    {  fferrok;  }\n    break;\n\n  case 10:\n\n/* Line 1455 of yacc.c  */\n#line 277 \"eval.y\"\n    { (ffval.Node) = New_Vector( (ffvsp[(2) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 11:\n\n/* Line 1455 of yacc.c  */\n#line 279 \"eval.y\"\n    {\n                  if( gParse.Nodes[(ffvsp[(1) - (3)].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[(1) - (3)].Node) = Close_Vec( (ffvsp[(1) - (3)].Node) ); TEST((ffvsp[(1) - (3)].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[(1) - (3)].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[(1) - (3)].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[(3) - (3)].Node);\n                }\n    break;\n\n  case 12:\n\n/* Line 1455 of yacc.c  */\n#line 292 \"eval.y\"\n    { (ffval.Node) = New_Vector( (ffvsp[(2) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 13:\n\n/* Line 1455 of yacc.c  */\n#line 294 \"eval.y\"\n    {\n                  if( TYPE((ffvsp[(1) - (3)].Node)) < TYPE((ffvsp[(3) - (3)].Node)) )\n                     TYPE((ffvsp[(1) - (3)].Node)) = TYPE((ffvsp[(3) - (3)].Node));\n                  if( gParse.Nodes[(ffvsp[(1) - (3)].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[(1) - (3)].Node) = Close_Vec( (ffvsp[(1) - (3)].Node) ); TEST((ffvsp[(1) - (3)].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[(1) - (3)].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[(1) - (3)].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[(3) - (3)].Node);\n                }\n    break;\n\n  case 14:\n\n/* Line 1455 of yacc.c  */\n#line 307 \"eval.y\"\n    {\n                  if( gParse.Nodes[(ffvsp[(1) - (3)].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[(1) - (3)].Node) = Close_Vec( (ffvsp[(1) - (3)].Node) ); TEST((ffvsp[(1) - (3)].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[(1) - (3)].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[(1) - (3)].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[(3) - (3)].Node);\n                }\n    break;\n\n  case 15:\n\n/* Line 1455 of yacc.c  */\n#line 318 \"eval.y\"\n    {\n                  TYPE((ffvsp[(1) - (3)].Node)) = TYPE((ffvsp[(3) - (3)].Node));\n                  if( gParse.Nodes[(ffvsp[(1) - (3)].Node)].nSubNodes >= MAXSUBS ) {\n\t\t     (ffvsp[(1) - (3)].Node) = Close_Vec( (ffvsp[(1) - (3)].Node) ); TEST((ffvsp[(1) - (3)].Node));\n\t\t     (ffval.Node) = New_Vector( (ffvsp[(1) - (3)].Node) ); TEST((ffval.Node));\n                  } else {\n                     (ffval.Node) = (ffvsp[(1) - (3)].Node);\n                  }\n\t\t  gParse.Nodes[(ffval.Node)].SubNodes[ gParse.Nodes[(ffval.Node)].nSubNodes++ ]\n\t\t     = (ffvsp[(3) - (3)].Node);\n                }\n    break;\n\n  case 16:\n\n/* Line 1455 of yacc.c  */\n#line 332 \"eval.y\"\n    { (ffval.Node) = Close_Vec( (ffvsp[(1) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 17:\n\n/* Line 1455 of yacc.c  */\n#line 336 \"eval.y\"\n    { (ffval.Node) = Close_Vec( (ffvsp[(1) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 18:\n\n/* Line 1455 of yacc.c  */\n#line 340 \"eval.y\"\n    {\n                  (ffval.Node) = New_Const( BITSTR, (ffvsp[(1) - (1)].str), strlen((ffvsp[(1) - (1)].str))+1 ); TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = strlen((ffvsp[(1) - (1)].str)); }\n    break;\n\n  case 19:\n\n/* Line 1455 of yacc.c  */\n#line 344 \"eval.y\"\n    { (ffval.Node) = New_Column( (ffvsp[(1) - (1)].lng) ); TEST((ffval.Node)); }\n    break;\n\n  case 20:\n\n/* Line 1455 of yacc.c  */\n#line 346 \"eval.y\"\n    {\n                  if( TYPE((ffvsp[(3) - (4)].Node)) != LONG\n\t\t      || OPER((ffvsp[(3) - (4)].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[(1) - (4)].lng), (ffvsp[(3) - (4)].Node) ); TEST((ffval.Node));\n                }\n    break;\n\n  case 21:\n\n/* Line 1455 of yacc.c  */\n#line 355 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BITSTR, (ffvsp[(1) - (3)].Node), '&', (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = ( SIZE((ffvsp[(1) - (3)].Node))>SIZE((ffvsp[(3) - (3)].Node)) ? SIZE((ffvsp[(1) - (3)].Node)) : SIZE((ffvsp[(3) - (3)].Node)) );  }\n    break;\n\n  case 22:\n\n/* Line 1455 of yacc.c  */\n#line 358 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BITSTR, (ffvsp[(1) - (3)].Node), '|', (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = ( SIZE((ffvsp[(1) - (3)].Node))>SIZE((ffvsp[(3) - (3)].Node)) ? SIZE((ffvsp[(1) - (3)].Node)) : SIZE((ffvsp[(3) - (3)].Node)) );  }\n    break;\n\n  case 23:\n\n/* Line 1455 of yacc.c  */\n#line 361 \"eval.y\"\n    { \n\t\t  if (SIZE((ffvsp[(1) - (3)].Node))+SIZE((ffvsp[(3) - (3)].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[(1) - (3)].Node), '+', (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = SIZE((ffvsp[(1) - (3)].Node)) + SIZE((ffvsp[(3) - (3)].Node)); \n\t\t}\n    break;\n\n  case 24:\n\n/* Line 1455 of yacc.c  */\n#line 370 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (4)].Node), 1, (ffvsp[(3) - (4)].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 25:\n\n/* Line 1455 of yacc.c  */\n#line 372 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (6)].Node), 2, (ffvsp[(3) - (6)].Node), (ffvsp[(5) - (6)].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 26:\n\n/* Line 1455 of yacc.c  */\n#line 374 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (8)].Node), 3, (ffvsp[(3) - (8)].Node), (ffvsp[(5) - (8)].Node), (ffvsp[(7) - (8)].Node),  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 27:\n\n/* Line 1455 of yacc.c  */\n#line 376 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (10)].Node), 4, (ffvsp[(3) - (10)].Node), (ffvsp[(5) - (10)].Node), (ffvsp[(7) - (10)].Node), (ffvsp[(9) - (10)].Node),   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 28:\n\n/* Line 1455 of yacc.c  */\n#line 378 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (12)].Node), 5, (ffvsp[(3) - (12)].Node), (ffvsp[(5) - (12)].Node), (ffvsp[(7) - (12)].Node), (ffvsp[(9) - (12)].Node), (ffvsp[(11) - (12)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 29:\n\n/* Line 1455 of yacc.c  */\n#line 380 \"eval.y\"\n    { (ffval.Node) = New_Unary( BITSTR, NOT, (ffvsp[(2) - (2)].Node) ); TEST((ffval.Node));     }\n    break;\n\n  case 30:\n\n/* Line 1455 of yacc.c  */\n#line 383 \"eval.y\"\n    { (ffval.Node) = (ffvsp[(2) - (3)].Node); }\n    break;\n\n  case 31:\n\n/* Line 1455 of yacc.c  */\n#line 387 \"eval.y\"\n    { (ffval.Node) = New_Const( LONG,   &((ffvsp[(1) - (1)].lng)), sizeof(long)   ); TEST((ffval.Node)); }\n    break;\n\n  case 32:\n\n/* Line 1455 of yacc.c  */\n#line 389 \"eval.y\"\n    { (ffval.Node) = New_Const( DOUBLE, &((ffvsp[(1) - (1)].dbl)), sizeof(double) ); TEST((ffval.Node)); }\n    break;\n\n  case 33:\n\n/* Line 1455 of yacc.c  */\n#line 391 \"eval.y\"\n    { (ffval.Node) = New_Column( (ffvsp[(1) - (1)].lng) ); TEST((ffval.Node)); }\n    break;\n\n  case 34:\n\n/* Line 1455 of yacc.c  */\n#line 393 \"eval.y\"\n    {\n                  if( TYPE((ffvsp[(3) - (4)].Node)) != LONG\n\t\t      || OPER((ffvsp[(3) - (4)].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[(1) - (4)].lng), (ffvsp[(3) - (4)].Node) ); TEST((ffval.Node));\n                }\n    break;\n\n  case 35:\n\n/* Line 1455 of yacc.c  */\n#line 402 \"eval.y\"\n    { (ffval.Node) = New_Func( LONG, row_fct,  0, 0, 0, 0, 0, 0, 0, 0 ); }\n    break;\n\n  case 36:\n\n/* Line 1455 of yacc.c  */\n#line 404 \"eval.y\"\n    { (ffval.Node) = New_Func( LONG, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); }\n    break;\n\n  case 37:\n\n/* Line 1455 of yacc.c  */\n#line 406 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '%', (ffvsp[(3) - (3)].Node) );\n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 38:\n\n/* Line 1455 of yacc.c  */\n#line 409 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '+', (ffvsp[(3) - (3)].Node) );\n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 39:\n\n/* Line 1455 of yacc.c  */\n#line 412 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '-', (ffvsp[(3) - (3)].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 40:\n\n/* Line 1455 of yacc.c  */\n#line 415 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '*', (ffvsp[(3) - (3)].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 41:\n\n/* Line 1455 of yacc.c  */\n#line 418 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '/', (ffvsp[(3) - (3)].Node) ); \n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 42:\n\n/* Line 1455 of yacc.c  */\n#line 421 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), POWER, (ffvsp[(3) - (3)].Node) );\n\t\t  TEST((ffval.Node));                                                }\n    break;\n\n  case 43:\n\n/* Line 1455 of yacc.c  */\n#line 424 \"eval.y\"\n    { (ffval.Node) = (ffvsp[(2) - (2)].Node); }\n    break;\n\n  case 44:\n\n/* Line 1455 of yacc.c  */\n#line 426 \"eval.y\"\n    { (ffval.Node) = New_Unary( TYPE((ffvsp[(2) - (2)].Node)), UMINUS, (ffvsp[(2) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 45:\n\n/* Line 1455 of yacc.c  */\n#line 428 \"eval.y\"\n    { (ffval.Node) = (ffvsp[(2) - (3)].Node); }\n    break;\n\n  case 46:\n\n/* Line 1455 of yacc.c  */\n#line 430 \"eval.y\"\n    { (ffvsp[(3) - (3)].Node) = New_Unary( TYPE((ffvsp[(1) - (3)].Node)), 0, (ffvsp[(3) - (3)].Node) );\n                  (ffval.Node) = New_BinOp( TYPE((ffvsp[(1) - (3)].Node)), (ffvsp[(1) - (3)].Node), '*', (ffvsp[(3) - (3)].Node) ); \n\t\t  TEST((ffval.Node));                                }\n    break;\n\n  case 47:\n\n/* Line 1455 of yacc.c  */\n#line 434 \"eval.y\"\n    { (ffvsp[(1) - (3)].Node) = New_Unary( TYPE((ffvsp[(3) - (3)].Node)), 0, (ffvsp[(1) - (3)].Node) );\n                  (ffval.Node) = New_BinOp( TYPE((ffvsp[(3) - (3)].Node)), (ffvsp[(1) - (3)].Node), '*', (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                }\n    break;\n\n  case 48:\n\n/* Line 1455 of yacc.c  */\n#line 438 \"eval.y\"\n    {\n                  PROMOTE((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[(3) - (5)].Node), (ffvsp[(5) - (5)].Node), (ffvsp[(1) - (5)].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[(3) - (5)].Node))<SIZE((ffvsp[(5) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(5) - (5)].Node));\n                  TYPE((ffvsp[(1) - (5)].Node)) = TYPE((ffvsp[(3) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(1) - (5)].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[(1) - (5)].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[(1) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(1) - (5)].Node));\n                }\n    break;\n\n  case 49:\n\n/* Line 1455 of yacc.c  */\n#line 457 \"eval.y\"\n    {\n                  PROMOTE((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[(3) - (5)].Node), (ffvsp[(5) - (5)].Node), (ffvsp[(1) - (5)].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[(3) - (5)].Node))<SIZE((ffvsp[(5) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(5) - (5)].Node));\n                  TYPE((ffvsp[(1) - (5)].Node)) = TYPE((ffvsp[(3) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(1) - (5)].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[(1) - (5)].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[(1) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(1) - (5)].Node));\n                }\n    break;\n\n  case 50:\n\n/* Line 1455 of yacc.c  */\n#line 476 \"eval.y\"\n    {\n                  PROMOTE((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[(3) - (5)].Node), (ffvsp[(5) - (5)].Node), (ffvsp[(1) - (5)].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[(3) - (5)].Node))<SIZE((ffvsp[(5) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(5) - (5)].Node));\n                  TYPE((ffvsp[(1) - (5)].Node)) = TYPE((ffvsp[(3) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(1) - (5)].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  TYPE((ffvsp[(1) - (5)].Node)) = BOOLEAN;\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[(1) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(1) - (5)].Node));\n                }\n    break;\n\n  case 51:\n\n/* Line 1455 of yacc.c  */\n#line 495 \"eval.y\"\n    { if (FSTRCMP((ffvsp[(1) - (2)].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) - (2)].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    break;\n\n  case 52:\n\n/* Line 1455 of yacc.c  */\n#line 506 \"eval.y\"\n    { if (FSTRCMP((ffvsp[(1) - (3)].str),\"SUM(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, sum_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n                  } else if (FSTRCMP((ffvsp[(1) - (3)].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[(2) - (3)].Node)) ), sizeof(long) );\n                  } else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ACCUM(\") == 0) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG , (ffvsp[(2) - (3)].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    break;\n\n  case 53:\n\n/* Line 1455 of yacc.c  */\n#line 520 \"eval.y\"\n    { if (FSTRCMP((ffvsp[(1) - (3)].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[(2) - (3)].Node)) ), sizeof(long) );\n\t\t  } else if (FSTRCMP((ffvsp[(1) - (3)].str),\"NVALID(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, nonnull_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 54:\n\n/* Line 1455 of yacc.c  */\n#line 532 \"eval.y\"\n    { if (FSTRCMP((ffvsp[(1) - (3)].str),\"NELEM(\") == 0) {\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[(2) - (3)].Node)) ), sizeof(long) );\n\t\t} else if (FSTRCMP((ffvsp[(1) - (3)].str),\"NVALID(\") == 0) { /* Bit arrays do not have NULL */\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[(2) - (3)].Node)) ), sizeof(long) );\n\t\t} else if (FSTRCMP((ffvsp[(1) - (3)].str),\"SUM(\") == 0) {\n\t\t     (ffval.Node) = New_Func( LONG, sum_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t} else if (FSTRCMP((ffvsp[(1) - (3)].str),\"MIN(\") == 0) {\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)),  /* Force 1D result */\n\t\t\t\t    min1_fct, 1, (ffvsp[(2) - (3)].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[(1) - (3)].str),\"ACCUM(\") == 0) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG , (ffvsp[(2) - (3)].Node), ACCUM, New_Const( LONG, &zero, sizeof(zero) ));\n\t\t} else if (FSTRCMP((ffvsp[(1) - (3)].str),\"MAX(\") == 0) {\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)),  /* Force 1D result */\n\t\t\t\t    max1_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 55:\n\n/* Line 1455 of yacc.c  */\n#line 563 \"eval.y\"\n    { if (FSTRCMP((ffvsp[(1) - (3)].str),\"SUM(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)), sum_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"AVERAGE(\") == 0)\n\t\t     (ffval.Node) = New_Func( DOUBLE, average_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"STDDEV(\") == 0)\n\t\t     (ffval.Node) = New_Func( DOUBLE, stddev_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"MEDIAN(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)), median_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"NELEM(\") == 0)\n                     (ffval.Node) = New_Const( LONG, &( SIZE((ffvsp[(2) - (3)].Node)) ), sizeof(long) );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"NVALID(\") == 0)\n\t\t     (ffval.Node) = New_Func( LONG, nonnull_fct, 1, (ffvsp[(2) - (3)].Node),\n\t\t\t\t    0, 0, 0, 0, 0, 0 );\n\t\t  else if   ((FSTRCMP((ffvsp[(1) - (3)].str),\"ACCUM(\") == 0) && (TYPE((ffvsp[(2) - (3)].Node)) == LONG)) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG ,   (ffvsp[(2) - (3)].Node), ACCUM, New_Const( LONG,   &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[(1) - (3)].str),\"ACCUM(\") == 0) && (TYPE((ffvsp[(2) - (3)].Node)) == DOUBLE)) {\n\t\t    double zero = 0;\n\t\t    (ffval.Node) = New_BinOp( DOUBLE , (ffvsp[(2) - (3)].Node), ACCUM, New_Const( DOUBLE, &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[(1) - (3)].str),\"SEQDIFF(\") == 0) && (TYPE((ffvsp[(2) - (3)].Node)) == LONG)) {\n\t\t    long zero = 0;\n\t\t    (ffval.Node) = New_BinOp( LONG ,   (ffvsp[(2) - (3)].Node), DIFF, New_Const( LONG,   &zero, sizeof(zero) ));\n\t\t  } else if ((FSTRCMP((ffvsp[(1) - (3)].str),\"SEQDIFF(\") == 0) && (TYPE((ffvsp[(2) - (3)].Node)) == DOUBLE)) {\n\t\t    double zero = 0;\n\t\t    (ffval.Node) = New_BinOp( DOUBLE , (ffvsp[(2) - (3)].Node), DIFF, New_Const( DOUBLE, &zero, sizeof(zero) ));\n\t\t  } else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ABS(\") == 0)\n\t\t     (ffval.Node) = New_Func( 0, abs_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n \t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"MIN(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)),  /* Force 1D result */\n\t\t\t\t    min1_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"MAX(\") == 0)\n\t\t     (ffval.Node) = New_Func( TYPE((ffvsp[(2) - (3)].Node)),  /* Force 1D result */\n\t\t\t\t    max1_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t  else if (FSTRCMP((ffvsp[(1) - (3)].str),\"RANDOM(\") == 0) { /* Vector RANDOM() */\n                     (ffval.Node) = New_Func( 0, rnd_fct, 1, (ffvsp[(2) - (3)].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[(1) - (3)].str),\"RANDOMN(\") == 0) {\n\t\t     (ffval.Node) = New_Func( 0, gasrnd_fct, 1, (ffvsp[(2) - (3)].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[(2) - (3)].Node)) != DOUBLE ) (ffvsp[(2) - (3)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (3)].Node) );\n                     if (FSTRCMP((ffvsp[(1) - (3)].str),\"SIN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sin_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"COS(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, cos_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"TAN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, tan_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ARCSIN(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[(1) - (3)].str),\"ASIN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, asin_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ARCCOS(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[(1) - (3)].str),\"ACOS(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, acos_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ARCTAN(\") == 0\n\t\t\t      || FSTRCMP((ffvsp[(1) - (3)].str),\"ATAN(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, atan_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"SINH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sinh_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"COSH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, cosh_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"TANH(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, tanh_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"EXP(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, exp_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"LOG(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, log_fct,  1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"LOG10(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, log10_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"SQRT(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, sqrt_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"ROUND(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, round_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"FLOOR(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, floor_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"CEIL(\") == 0)\n\t\t\t(ffval.Node) = New_Func( 0, ceil_fct, 1, (ffvsp[(2) - (3)].Node), 0, 0, 0, 0, 0, 0 );\n\t\t     else if (FSTRCMP((ffvsp[(1) - (3)].str),\"RANDOMP(\") == 0) {\n\t\t       (ffval.Node) = New_Func( 0, poirnd_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 56:\n\n/* Line 1455 of yacc.c  */\n#line 658 \"eval.y\"\n    { \n\t\t  if (FSTRCMP((ffvsp[(1) - (5)].str),\"STRSTR(\") == 0) {\n\t\t    (ffval.Node) = New_Func( LONG, strpos_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0, \n\t\t\t\t   0, 0, 0, 0 );\n\t\t    TEST((ffval.Node));\n\t\t  }\n                }\n    break;\n\n  case 57:\n\n/* Line 1455 of yacc.c  */\n#line 666 \"eval.y\"\n    { \n\t\t   if (FSTRCMP((ffvsp[(1) - (5)].str),\"DEFNULL(\") == 0) {\n\t\t      if( SIZE((ffvsp[(2) - (5)].Node))>=SIZE((ffvsp[(4) - (5)].Node)) && Test_Dims( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) ) ) {\n\t\t\t PROMOTE((ffvsp[(2) - (5)].Node),(ffvsp[(4) - (5)].Node));\n\t\t\t (ffval.Node) = New_Func( 0, defnull_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].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[(1) - (5)].str),\"ARCTAN2(\") == 0) {\n\t\t     if( TYPE((ffvsp[(2) - (5)].Node)) != DOUBLE ) (ffvsp[(2) - (5)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (5)].Node) );\n\t\t     if( TYPE((ffvsp[(4) - (5)].Node)) != DOUBLE ) (ffvsp[(4) - (5)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(4) - (5)].Node) );\n\t\t     if( Test_Dims( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, atan2_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node)); \n\t\t\tif( SIZE((ffvsp[(2) - (5)].Node))<SIZE((ffvsp[(4) - (5)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(4) - (5)].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[(1) - (5)].str),\"MIN(\") == 0) {\n\t\t      PROMOTE( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) );\n\t\t      if( Test_Dims( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, min2_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node));\n\t\t\tif( SIZE((ffvsp[(2) - (5)].Node))<SIZE((ffvsp[(4) - (5)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(4) - (5)].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[(1) - (5)].str),\"MAX(\") == 0) {\n\t\t      PROMOTE( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) );\n\t\t      if( Test_Dims( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) ) ) {\n\t\t\t(ffval.Node) = New_Func( 0, max2_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0, 0, 0, 0, 0 );\n\t\t\tTEST((ffval.Node));\n\t\t\tif( SIZE((ffvsp[(2) - (5)].Node))<SIZE((ffvsp[(4) - (5)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(4) - (5)].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#if 0\n\t\t   } else if (FSTRCMP((ffvsp[(1) - (5)].str),\"STRSTR(\") == 0) {\n\t\t     if( TYPE((ffvsp[(2) - (5)].Node)) != STRING || TYPE((ffvsp[(4) - (5)].Node)) != STRING) {\n\t\t       fferror(\"Arguments to strstr(s,r) must be strings\");\n\t\t       FFERROR;\n\t\t     }\n\t\t     (ffval.Node) = New_Func( LONG, strpos_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0, \n\t\t\t\t    0, 0, 0, 0 );\n\t\t     TEST((ffval.Node));\n#endif\n\t\t   } else {\n\t\t      fferror(\"Function(expr,expr) not supported\");\n\t\t      FFERROR;\n\t\t   }\n                }\n    break;\n\n  case 58:\n\n/* Line 1455 of yacc.c  */\n#line 728 \"eval.y\"\n    { \n\t\t  if (FSTRCMP((ffvsp[(1) - (9)].str),\"ANGSEP(\") == 0) {\n\t\t    if( TYPE((ffvsp[(2) - (9)].Node)) != DOUBLE ) (ffvsp[(2) - (9)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (9)].Node) );\n\t\t    if( TYPE((ffvsp[(4) - (9)].Node)) != DOUBLE ) (ffvsp[(4) - (9)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(4) - (9)].Node) );\n\t\t    if( TYPE((ffvsp[(6) - (9)].Node)) != DOUBLE ) (ffvsp[(6) - (9)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(6) - (9)].Node) );\n\t\t    if( TYPE((ffvsp[(8) - (9)].Node)) != DOUBLE ) (ffvsp[(8) - (9)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(8) - (9)].Node) );\n\t\t    if( Test_Dims( (ffvsp[(2) - (9)].Node), (ffvsp[(4) - (9)].Node) ) && Test_Dims( (ffvsp[(4) - (9)].Node), (ffvsp[(6) - (9)].Node) ) && \n\t\t\tTest_Dims( (ffvsp[(6) - (9)].Node), (ffvsp[(8) - (9)].Node) ) ) {\n\t\t      (ffval.Node) = New_Func( 0, angsep_fct, 4, (ffvsp[(2) - (9)].Node), (ffvsp[(4) - (9)].Node), (ffvsp[(6) - (9)].Node), (ffvsp[(8) - (9)].Node),0,0,0 );\n\t\t      TEST((ffval.Node)); \n\t\t      if( SIZE((ffvsp[(2) - (9)].Node))<SIZE((ffvsp[(4) - (9)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(4) - (9)].Node));\n\t\t      if( SIZE((ffvsp[(4) - (9)].Node))<SIZE((ffvsp[(6) - (9)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(6) - (9)].Node));\n\t\t      if( SIZE((ffvsp[(6) - (9)].Node))<SIZE((ffvsp[(8) - (9)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(8) - (9)].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    break;\n\n  case 59:\n\n/* Line 1455 of yacc.c  */\n#line 752 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (4)].Node), 1, (ffvsp[(3) - (4)].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 60:\n\n/* Line 1455 of yacc.c  */\n#line 754 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (6)].Node), 2, (ffvsp[(3) - (6)].Node), (ffvsp[(5) - (6)].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 61:\n\n/* Line 1455 of yacc.c  */\n#line 756 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (8)].Node), 3, (ffvsp[(3) - (8)].Node), (ffvsp[(5) - (8)].Node), (ffvsp[(7) - (8)].Node),  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 62:\n\n/* Line 1455 of yacc.c  */\n#line 758 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (10)].Node), 4, (ffvsp[(3) - (10)].Node), (ffvsp[(5) - (10)].Node), (ffvsp[(7) - (10)].Node), (ffvsp[(9) - (10)].Node),   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 63:\n\n/* Line 1455 of yacc.c  */\n#line 760 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (12)].Node), 5, (ffvsp[(3) - (12)].Node), (ffvsp[(5) - (12)].Node), (ffvsp[(7) - (12)].Node), (ffvsp[(9) - (12)].Node), (ffvsp[(11) - (12)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 64:\n\n/* Line 1455 of yacc.c  */\n#line 762 \"eval.y\"\n    { (ffval.Node) = New_Unary( LONG,   INTCAST, (ffvsp[(2) - (2)].Node) );  TEST((ffval.Node));  }\n    break;\n\n  case 65:\n\n/* Line 1455 of yacc.c  */\n#line 764 \"eval.y\"\n    { (ffval.Node) = New_Unary( LONG,   INTCAST, (ffvsp[(2) - (2)].Node) );  TEST((ffval.Node));  }\n    break;\n\n  case 66:\n\n/* Line 1455 of yacc.c  */\n#line 766 \"eval.y\"\n    { (ffval.Node) = New_Unary( DOUBLE, FLTCAST, (ffvsp[(2) - (2)].Node) );  TEST((ffval.Node));  }\n    break;\n\n  case 67:\n\n/* Line 1455 of yacc.c  */\n#line 768 \"eval.y\"\n    { (ffval.Node) = New_Unary( DOUBLE, FLTCAST, (ffvsp[(2) - (2)].Node) );  TEST((ffval.Node));  }\n    break;\n\n  case 68:\n\n/* Line 1455 of yacc.c  */\n#line 772 \"eval.y\"\n    { (ffval.Node) = New_Const( BOOLEAN, &((ffvsp[(1) - (1)].log)), sizeof(char) ); TEST((ffval.Node)); }\n    break;\n\n  case 69:\n\n/* Line 1455 of yacc.c  */\n#line 774 \"eval.y\"\n    { (ffval.Node) = New_Column( (ffvsp[(1) - (1)].lng) ); TEST((ffval.Node)); }\n    break;\n\n  case 70:\n\n/* Line 1455 of yacc.c  */\n#line 776 \"eval.y\"\n    {\n                  if( TYPE((ffvsp[(3) - (4)].Node)) != LONG\n\t\t      || OPER((ffvsp[(3) - (4)].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[(1) - (4)].lng), (ffvsp[(3) - (4)].Node) ); TEST((ffval.Node));\n                }\n    break;\n\n  case 71:\n\n/* Line 1455 of yacc.c  */\n#line 785 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), EQ,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 72:\n\n/* Line 1455 of yacc.c  */\n#line 788 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), NE,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 73:\n\n/* Line 1455 of yacc.c  */\n#line 791 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LT,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 74:\n\n/* Line 1455 of yacc.c  */\n#line 794 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LTE, (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 75:\n\n/* Line 1455 of yacc.c  */\n#line 797 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GT,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 76:\n\n/* Line 1455 of yacc.c  */\n#line 800 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GTE, (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); \n\t\t  SIZE((ffval.Node)) = 1;                                     }\n    break;\n\n  case 77:\n\n/* Line 1455 of yacc.c  */\n#line 803 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GT,  (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 78:\n\n/* Line 1455 of yacc.c  */\n#line 806 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LT,  (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 79:\n\n/* Line 1455 of yacc.c  */\n#line 809 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GTE, (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 80:\n\n/* Line 1455 of yacc.c  */\n#line 812 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LTE, (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 81:\n\n/* Line 1455 of yacc.c  */\n#line 815 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), '~', (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 82:\n\n/* Line 1455 of yacc.c  */\n#line 818 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), EQ,  (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 83:\n\n/* Line 1455 of yacc.c  */\n#line 821 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (3)].Node),(ffvsp[(3) - (3)].Node)); (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), NE,  (ffvsp[(3) - (3)].Node) );\n                  TEST((ffval.Node));                                               }\n    break;\n\n  case 84:\n\n/* Line 1455 of yacc.c  */\n#line 824 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), EQ,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 85:\n\n/* Line 1455 of yacc.c  */\n#line 827 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), NE,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 86:\n\n/* Line 1455 of yacc.c  */\n#line 830 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GT,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 87:\n\n/* Line 1455 of yacc.c  */\n#line 833 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), GTE, (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 88:\n\n/* Line 1455 of yacc.c  */\n#line 836 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LT,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 89:\n\n/* Line 1455 of yacc.c  */\n#line 839 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), LTE, (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = 1; }\n    break;\n\n  case 90:\n\n/* Line 1455 of yacc.c  */\n#line 842 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), AND, (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 91:\n\n/* Line 1455 of yacc.c  */\n#line 844 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), OR,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 92:\n\n/* Line 1455 of yacc.c  */\n#line 846 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), EQ,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 93:\n\n/* Line 1455 of yacc.c  */\n#line 848 \"eval.y\"\n    { (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (3)].Node), NE,  (ffvsp[(3) - (3)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 94:\n\n/* Line 1455 of yacc.c  */\n#line 851 \"eval.y\"\n    { PROMOTE((ffvsp[(1) - (5)].Node),(ffvsp[(3) - (5)].Node)); PROMOTE((ffvsp[(1) - (5)].Node),(ffvsp[(5) - (5)].Node)); PROMOTE((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node));\n\t\t  (ffvsp[(3) - (5)].Node) = New_BinOp( BOOLEAN, (ffvsp[(3) - (5)].Node), LTE, (ffvsp[(1) - (5)].Node) );\n                  (ffvsp[(5) - (5)].Node) = New_BinOp( BOOLEAN, (ffvsp[(1) - (5)].Node), LTE, (ffvsp[(5) - (5)].Node) );\n                  (ffval.Node) = New_BinOp( BOOLEAN, (ffvsp[(3) - (5)].Node), AND, (ffvsp[(5) - (5)].Node) );\n                  TEST((ffval.Node));                                         }\n    break;\n\n  case 95:\n\n/* Line 1455 of yacc.c  */\n#line 858 \"eval.y\"\n    {\n                  if( ! Test_Dims((ffvsp[(3) - (5)].Node),(ffvsp[(5) - (5)].Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' arguments\");\n\t\t     FFERROR;\n                  }\n                  (ffval.Node) = New_Func( 0, ifthenelse_fct, 3, (ffvsp[(3) - (5)].Node), (ffvsp[(5) - (5)].Node), (ffvsp[(1) - (5)].Node),\n                                 0, 0, 0, 0 );\n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[(3) - (5)].Node))<SIZE((ffvsp[(5) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(5) - (5)].Node));\n                  if( ! Test_Dims((ffvsp[(1) - (5)].Node),(ffval.Node)) ) {\n                     fferror(\"Incompatible dimensions in '?:' condition\");\n\t\t     FFERROR;\n                  }\n                  if( SIZE((ffval.Node))<SIZE((ffvsp[(1) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(1) - (5)].Node));\n                }\n    break;\n\n  case 96:\n\n/* Line 1455 of yacc.c  */\n#line 875 \"eval.y\"\n    {\n\t\t   if (FSTRCMP((ffvsp[(1) - (3)].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( 0, isnull_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 97:\n\n/* Line 1455 of yacc.c  */\n#line 888 \"eval.y\"\n    {\n\t\t   if (FSTRCMP((ffvsp[(1) - (3)].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( 0, isnull_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 98:\n\n/* Line 1455 of yacc.c  */\n#line 901 \"eval.y\"\n    {\n\t\t   if (FSTRCMP((ffvsp[(1) - (3)].str),\"ISNULL(\") == 0) {\n\t\t      (ffval.Node) = New_Func( BOOLEAN, isnull_fct, 1, (ffvsp[(2) - (3)].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    break;\n\n  case 99:\n\n/* Line 1455 of yacc.c  */\n#line 912 \"eval.y\"\n    {\n\t\t   if (FSTRCMP((ffvsp[(1) - (5)].str),\"DEFNULL(\") == 0) {\n\t\t      if( SIZE((ffvsp[(2) - (5)].Node))>=SIZE((ffvsp[(4) - (5)].Node)) && Test_Dims( (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node) ) ) {\n\t\t\t (ffval.Node) = New_Func( 0, defnull_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].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    break;\n\n  case 100:\n\n/* Line 1455 of yacc.c  */\n#line 928 \"eval.y\"\n    {\n\t\t   if( TYPE((ffvsp[(2) - (7)].Node)) != DOUBLE ) (ffvsp[(2) - (7)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (7)].Node) );\n\t\t   if( TYPE((ffvsp[(4) - (7)].Node)) != DOUBLE ) (ffvsp[(4) - (7)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(4) - (7)].Node) );\n\t\t   if( TYPE((ffvsp[(6) - (7)].Node)) != DOUBLE ) (ffvsp[(6) - (7)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(6) - (7)].Node) );\n\t\t   if( ! (Test_Dims( (ffvsp[(2) - (7)].Node), (ffvsp[(4) - (7)].Node) ) && Test_Dims( (ffvsp[(4) - (7)].Node), (ffvsp[(6) - (7)].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[(1) - (7)].str),\"NEAR(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, near_fct, 3, (ffvsp[(2) - (7)].Node), (ffvsp[(4) - (7)].Node), (ffvsp[(6) - (7)].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[(2) - (7)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(2) - (7)].Node));\n\t\t     if( SIZE((ffvsp[(2) - (7)].Node))<SIZE((ffvsp[(4) - (7)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(4) - (7)].Node));\n\t\t     if( SIZE((ffvsp[(4) - (7)].Node))<SIZE((ffvsp[(6) - (7)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(6) - (7)].Node));\n\t\t   }\n\t\t}\n    break;\n\n  case 101:\n\n/* Line 1455 of yacc.c  */\n#line 952 \"eval.y\"\n    {\n\t\t   if( TYPE((ffvsp[(2) - (11)].Node)) != DOUBLE ) (ffvsp[(2) - (11)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (11)].Node) );\n\t\t   if( TYPE((ffvsp[(4) - (11)].Node)) != DOUBLE ) (ffvsp[(4) - (11)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(4) - (11)].Node) );\n\t\t   if( TYPE((ffvsp[(6) - (11)].Node)) != DOUBLE ) (ffvsp[(6) - (11)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(6) - (11)].Node) );\n\t\t   if( TYPE((ffvsp[(8) - (11)].Node)) != DOUBLE ) (ffvsp[(8) - (11)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(8) - (11)].Node) );\n\t\t   if( TYPE((ffvsp[(10) - (11)].Node))!= DOUBLE ) (ffvsp[(10) - (11)].Node)= New_Unary( DOUBLE, 0, (ffvsp[(10) - (11)].Node));\n\t\t   if( ! (Test_Dims( (ffvsp[(2) - (11)].Node), (ffvsp[(4) - (11)].Node) ) && Test_Dims( (ffvsp[(4) - (11)].Node), (ffvsp[(6) - (11)].Node) ) && \n\t\t\t  Test_Dims( (ffvsp[(6) - (11)].Node), (ffvsp[(8) - (11)].Node) ) && Test_Dims( (ffvsp[(8) - (11)].Node), (ffvsp[(10) - (11)].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[(1) - (11)].str),\"CIRCLE(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, circle_fct, 5, (ffvsp[(2) - (11)].Node), (ffvsp[(4) - (11)].Node), (ffvsp[(6) - (11)].Node), (ffvsp[(8) - (11)].Node),\n\t\t\t\t      (ffvsp[(10) - (11)].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[(2) - (11)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(2) - (11)].Node));\n\t\t     if( SIZE((ffvsp[(2) - (11)].Node))<SIZE((ffvsp[(4) - (11)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(4) - (11)].Node));\n\t\t     if( SIZE((ffvsp[(4) - (11)].Node))<SIZE((ffvsp[(6) - (11)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(6) - (11)].Node));\n\t\t     if( SIZE((ffvsp[(6) - (11)].Node))<SIZE((ffvsp[(8) - (11)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(8) - (11)].Node));\n\t\t     if( SIZE((ffvsp[(8) - (11)].Node))<SIZE((ffvsp[(10) - (11)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(10) - (11)].Node));\n\t\t   }\n\t\t}\n    break;\n\n  case 102:\n\n/* Line 1455 of yacc.c  */\n#line 980 \"eval.y\"\n    {\n\t\t   if( TYPE((ffvsp[(2) - (15)].Node)) != DOUBLE ) (ffvsp[(2) - (15)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(2) - (15)].Node) );\n\t\t   if( TYPE((ffvsp[(4) - (15)].Node)) != DOUBLE ) (ffvsp[(4) - (15)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(4) - (15)].Node) );\n\t\t   if( TYPE((ffvsp[(6) - (15)].Node)) != DOUBLE ) (ffvsp[(6) - (15)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(6) - (15)].Node) );\n\t\t   if( TYPE((ffvsp[(8) - (15)].Node)) != DOUBLE ) (ffvsp[(8) - (15)].Node) = New_Unary( DOUBLE, 0, (ffvsp[(8) - (15)].Node) );\n\t\t   if( TYPE((ffvsp[(10) - (15)].Node))!= DOUBLE ) (ffvsp[(10) - (15)].Node)= New_Unary( DOUBLE, 0, (ffvsp[(10) - (15)].Node));\n\t\t   if( TYPE((ffvsp[(12) - (15)].Node))!= DOUBLE ) (ffvsp[(12) - (15)].Node)= New_Unary( DOUBLE, 0, (ffvsp[(12) - (15)].Node));\n\t\t   if( TYPE((ffvsp[(14) - (15)].Node))!= DOUBLE ) (ffvsp[(14) - (15)].Node)= New_Unary( DOUBLE, 0, (ffvsp[(14) - (15)].Node));\n\t\t   if( ! (Test_Dims( (ffvsp[(2) - (15)].Node), (ffvsp[(4) - (15)].Node) ) && Test_Dims( (ffvsp[(4) - (15)].Node), (ffvsp[(6) - (15)].Node) ) && \n\t\t\t  Test_Dims( (ffvsp[(6) - (15)].Node), (ffvsp[(8) - (15)].Node) ) && Test_Dims( (ffvsp[(8) - (15)].Node), (ffvsp[(10) - (15)].Node) ) &&\n\t\t\t  Test_Dims((ffvsp[(10) - (15)].Node),(ffvsp[(12) - (15)].Node) ) && Test_Dims((ffvsp[(12) - (15)].Node), (ffvsp[(14) - (15)].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[(1) - (15)].str),\"BOX(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, box_fct, 7, (ffvsp[(2) - (15)].Node), (ffvsp[(4) - (15)].Node), (ffvsp[(6) - (15)].Node), (ffvsp[(8) - (15)].Node),\n\t\t\t\t      (ffvsp[(10) - (15)].Node), (ffvsp[(12) - (15)].Node), (ffvsp[(14) - (15)].Node) );\n\t\t     } else if (FSTRCMP((ffvsp[(1) - (15)].str),\"ELLIPSE(\") == 0) {\n\t\t       (ffval.Node) = New_Func( BOOLEAN, elps_fct, 7, (ffvsp[(2) - (15)].Node), (ffvsp[(4) - (15)].Node), (ffvsp[(6) - (15)].Node), (ffvsp[(8) - (15)].Node),\n\t\t\t\t      (ffvsp[(10) - (15)].Node), (ffvsp[(12) - (15)].Node), (ffvsp[(14) - (15)].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[(2) - (15)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(2) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(2) - (15)].Node))<SIZE((ffvsp[(4) - (15)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(4) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(4) - (15)].Node))<SIZE((ffvsp[(6) - (15)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(6) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(6) - (15)].Node))<SIZE((ffvsp[(8) - (15)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(8) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(8) - (15)].Node))<SIZE((ffvsp[(10) - (15)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(10) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(10) - (15)].Node))<SIZE((ffvsp[(12) - (15)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(12) - (15)].Node));\n\t\t     if( SIZE((ffvsp[(12) - (15)].Node))<SIZE((ffvsp[(14) - (15)].Node)) ) Copy_Dims((ffval.Node), (ffvsp[(14) - (15)].Node));\n\t\t   }\n\t\t}\n    break;\n\n  case 103:\n\n/* Line 1455 of yacc.c  */\n#line 1017 \"eval.y\"\n    { /* Use defaults for all elements */\n                   (ffval.Node) = New_GTI( \"\", -99, \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 104:\n\n/* Line 1455 of yacc.c  */\n#line 1021 \"eval.y\"\n    { /* Use defaults for all except filename */\n                   (ffval.Node) = New_GTI( (ffvsp[(2) - (3)].str), -99, \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 105:\n\n/* Line 1455 of yacc.c  */\n#line 1025 \"eval.y\"\n    {  (ffval.Node) = New_GTI( (ffvsp[(2) - (5)].str), (ffvsp[(4) - (5)].Node), \"*START*\", \"*STOP*\" );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 106:\n\n/* Line 1455 of yacc.c  */\n#line 1028 \"eval.y\"\n    {  (ffval.Node) = New_GTI( (ffvsp[(2) - (9)].str), (ffvsp[(4) - (9)].Node), (ffvsp[(6) - (9)].str), (ffvsp[(8) - (9)].str) );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 107:\n\n/* Line 1455 of yacc.c  */\n#line 1032 \"eval.y\"\n    { /* Use defaults for all except filename */\n                   (ffval.Node) = New_REG( (ffvsp[(2) - (3)].str), -99, -99, \"\" );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 108:\n\n/* Line 1455 of yacc.c  */\n#line 1036 \"eval.y\"\n    {  (ffval.Node) = New_REG( (ffvsp[(2) - (7)].str), (ffvsp[(4) - (7)].Node), (ffvsp[(6) - (7)].Node), \"\" );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 109:\n\n/* Line 1455 of yacc.c  */\n#line 1039 \"eval.y\"\n    {  (ffval.Node) = New_REG( (ffvsp[(2) - (9)].str), (ffvsp[(4) - (9)].Node), (ffvsp[(6) - (9)].Node), (ffvsp[(8) - (9)].str) );\n                   TEST((ffval.Node));                                        }\n    break;\n\n  case 110:\n\n/* Line 1455 of yacc.c  */\n#line 1043 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (4)].Node), 1, (ffvsp[(3) - (4)].Node),  0,  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 111:\n\n/* Line 1455 of yacc.c  */\n#line 1045 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (6)].Node), 2, (ffvsp[(3) - (6)].Node), (ffvsp[(5) - (6)].Node),  0,  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 112:\n\n/* Line 1455 of yacc.c  */\n#line 1047 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (8)].Node), 3, (ffvsp[(3) - (8)].Node), (ffvsp[(5) - (8)].Node), (ffvsp[(7) - (8)].Node),  0,   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 113:\n\n/* Line 1455 of yacc.c  */\n#line 1049 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (10)].Node), 4, (ffvsp[(3) - (10)].Node), (ffvsp[(5) - (10)].Node), (ffvsp[(7) - (10)].Node), (ffvsp[(9) - (10)].Node),   0 ); TEST((ffval.Node)); }\n    break;\n\n  case 114:\n\n/* Line 1455 of yacc.c  */\n#line 1051 \"eval.y\"\n    { (ffval.Node) = New_Deref( (ffvsp[(1) - (12)].Node), 5, (ffvsp[(3) - (12)].Node), (ffvsp[(5) - (12)].Node), (ffvsp[(7) - (12)].Node), (ffvsp[(9) - (12)].Node), (ffvsp[(11) - (12)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 115:\n\n/* Line 1455 of yacc.c  */\n#line 1053 \"eval.y\"\n    { (ffval.Node) = New_Unary( BOOLEAN, NOT, (ffvsp[(2) - (2)].Node) ); TEST((ffval.Node)); }\n    break;\n\n  case 116:\n\n/* Line 1455 of yacc.c  */\n#line 1055 \"eval.y\"\n    { (ffval.Node) = (ffvsp[(2) - (3)].Node); }\n    break;\n\n  case 117:\n\n/* Line 1455 of yacc.c  */\n#line 1059 \"eval.y\"\n    { (ffval.Node) = New_Const( STRING, (ffvsp[(1) - (1)].str), strlen((ffvsp[(1) - (1)].str))+1 ); TEST((ffval.Node));\n                  SIZE((ffval.Node)) = strlen((ffvsp[(1) - (1)].str)); }\n    break;\n\n  case 118:\n\n/* Line 1455 of yacc.c  */\n#line 1062 \"eval.y\"\n    { (ffval.Node) = New_Column( (ffvsp[(1) - (1)].lng) ); TEST((ffval.Node)); }\n    break;\n\n  case 119:\n\n/* Line 1455 of yacc.c  */\n#line 1064 \"eval.y\"\n    {\n                  if( TYPE((ffvsp[(3) - (4)].Node)) != LONG\n\t\t      || OPER((ffvsp[(3) - (4)].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[(1) - (4)].lng), (ffvsp[(3) - (4)].Node) ); TEST((ffval.Node));\n                }\n    break;\n\n  case 120:\n\n/* Line 1455 of yacc.c  */\n#line 1073 \"eval.y\"\n    { (ffval.Node) = New_Func( STRING, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); }\n    break;\n\n  case 121:\n\n/* Line 1455 of yacc.c  */\n#line 1075 \"eval.y\"\n    { (ffval.Node) = (ffvsp[(2) - (3)].Node); }\n    break;\n\n  case 122:\n\n/* Line 1455 of yacc.c  */\n#line 1077 \"eval.y\"\n    { \n\t\t  if (SIZE((ffvsp[(1) - (3)].Node))+SIZE((ffvsp[(3) - (3)].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[(1) - (3)].Node), '+', (ffvsp[(3) - (3)].Node) );  TEST((ffval.Node));\n\t\t  SIZE((ffval.Node)) = SIZE((ffvsp[(1) - (3)].Node)) + SIZE((ffvsp[(3) - (3)].Node));\n\t\t}\n    break;\n\n  case 123:\n\n/* Line 1455 of yacc.c  */\n#line 1086 \"eval.y\"\n    {\n\t\t  int outSize;\n                  if( SIZE((ffvsp[(1) - (5)].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[(3) - (5)].Node));\n\t\t  if (SIZE((ffvsp[(5) - (5)].Node)) > outSize) outSize = SIZE((ffvsp[(5) - (5)].Node));\n                  (ffval.Node) = New_FuncSize( 0, ifthenelse_fct, 3, (ffvsp[(3) - (5)].Node), (ffvsp[(5) - (5)].Node), (ffvsp[(1) - (5)].Node),\n\t\t\t\t     0, 0, 0, 0, outSize);\n\t\t  \n                  TEST((ffval.Node));\n                  if( SIZE((ffvsp[(3) - (5)].Node))<SIZE((ffvsp[(5) - (5)].Node)) )  Copy_Dims((ffval.Node), (ffvsp[(5) - (5)].Node));\n                }\n    break;\n\n  case 124:\n\n/* Line 1455 of yacc.c  */\n#line 1105 \"eval.y\"\n    { \n\t\t  if (FSTRCMP((ffvsp[(1) - (5)].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[(2) - (5)].Node));\n\t\t     if (SIZE((ffvsp[(4) - (5)].Node)) > outSize) outSize = SIZE((ffvsp[(4) - (5)].Node));\n\t\t     \n\t\t     (ffval.Node) = New_FuncSize( 0, defnull_fct, 2, (ffvsp[(2) - (5)].Node), (ffvsp[(4) - (5)].Node), 0,\n\t\t\t\t\t0, 0, 0, 0, outSize );\n\t\t     TEST((ffval.Node)); \n\t\t     if( SIZE((ffvsp[(4) - (5)].Node))>SIZE((ffvsp[(2) - (5)].Node)) ) SIZE((ffval.Node)) = SIZE((ffvsp[(4) - (5)].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    break;\n\n  case 125:\n\n/* Line 1455 of yacc.c  */\n#line 1124 \"eval.y\"\n    { \n\t\t  if (FSTRCMP((ffvsp[(1) - (7)].str),\"STRMID(\") == 0) {\n\t\t    int len;\n\t\t    if( TYPE((ffvsp[(4) - (7)].Node)) != LONG || SIZE((ffvsp[(4) - (7)].Node)) != 1 ||\n\t\t\tTYPE((ffvsp[(6) - (7)].Node)) != LONG || SIZE((ffvsp[(6) - (7)].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[(6) - (7)].Node)) == CONST_OP) {\n\t\t      /* Constant value: use that directly */\n\t\t      len = (gParse.Nodes[(ffvsp[(6) - (7)].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[(2) - (7)].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[(2) - (7)].Node), (ffvsp[(4) - (7)].Node),(ffvsp[(6) - (7)].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    break;\n\n\n\n/* Line 1455 of yacc.c  */\n#line 3584 \"y.tab.c\"\n      default: break;\n    }\n  FF_SYMBOL_PRINT (\"-> $$ =\", ffr1[ffn], &ffval, &ffloc);\n\n  FFPOPSTACK (fflen);\n  fflen = 0;\n  FF_STACK_PRINT (ffss, ffssp);\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  ffn = ffr1[ffn];\n\n  ffstate = ffpgoto[ffn - FFNTOKENS] + *ffssp;\n  if (0 <= ffstate && ffstate <= FFLAST && ffcheck[ffstate] == *ffssp)\n    ffstate = fftable[ffstate];\n  else\n    ffstate = ffdefgoto[ffn - FFNTOKENS];\n\n  goto ffnewstate;\n\n\n/*------------------------------------.\n| fferrlab -- here on detecting error |\n`------------------------------------*/\nfferrlab:\n  /* If not already recovering from an error, report this error.  */\n  if (!fferrstatus)\n    {\n      ++ffnerrs;\n#if ! FFERROR_VERBOSE\n      fferror (FF_(\"syntax error\"));\n#else\n      {\n\tFFSIZE_T ffsize = ffsyntax_error (0, ffstate, ffchar);\n\tif (ffmsg_alloc < ffsize && ffmsg_alloc < FFSTACK_ALLOC_MAXIMUM)\n\t  {\n\t    FFSIZE_T ffalloc = 2 * ffsize;\n\t    if (! (ffsize <= ffalloc && ffalloc <= FFSTACK_ALLOC_MAXIMUM))\n\t      ffalloc = FFSTACK_ALLOC_MAXIMUM;\n\t    if (ffmsg != ffmsgbuf)\n\t      FFSTACK_FREE (ffmsg);\n\t    ffmsg = (char *) FFSTACK_ALLOC (ffalloc);\n\t    if (ffmsg)\n\t      ffmsg_alloc = ffalloc;\n\t    else\n\t      {\n\t\tffmsg = ffmsgbuf;\n\t\tffmsg_alloc = sizeof ffmsgbuf;\n\t      }\n\t  }\n\n\tif (0 < ffsize && ffsize <= ffmsg_alloc)\n\t  {\n\t    (void) ffsyntax_error (ffmsg, ffstate, ffchar);\n\t    fferror (ffmsg);\n\t  }\n\telse\n\t  {\n\t    fferror (FF_(\"syntax error\"));\n\t    if (ffsize != 0)\n\t      goto ffexhaustedlab;\n\t  }\n      }\n#endif\n    }\n\n\n\n  if (fferrstatus == 3)\n    {\n      /* If just tried and failed to reuse lookahead token after an\n\t error, discard it.  */\n\n      if (ffchar <= FFEOF)\n\t{\n\t  /* Return failure if at end of input.  */\n\t  if (ffchar == FFEOF)\n\t    FFABORT;\n\t}\n      else\n\t{\n\t  ffdestruct (\"Error: discarding\",\n\t\t      fftoken, &fflval);\n\t  ffchar = FFEMPTY;\n\t}\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\n  /* Pacify compilers like GCC when the user code never invokes\n     FFERROR and the label fferrorlab therefore never appears in user\n     code.  */\n  if (/*CONSTCOND*/ 0)\n     goto fferrorlab;\n\n  /* Do not reclaim the symbols of the rule which 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;\t/* Each real token shifted decrements this.  */\n\n  for (;;)\n    {\n      ffn = ffpact[ffstate];\n      if (ffn != FFPACT_NINF)\n\t{\n\t  ffn += FFTERROR;\n\t  if (0 <= ffn && ffn <= FFLAST && ffcheck[ffn] == FFTERROR)\n\t    {\n\t      ffn = fftable[ffn];\n\t      if (0 < ffn)\n\t\tbreak;\n\t    }\n\t}\n\n      /* Pop the current state because it cannot handle the error token.  */\n      if (ffssp == ffss)\n\tFFABORT;\n\n\n      ffdestruct (\"Error: popping\",\n\t\t  ffstos[ffstate], ffvsp);\n      FFPOPSTACK (1);\n      ffstate = *ffssp;\n      FF_STACK_PRINT (ffss, ffssp);\n    }\n\n  *++ffvsp = fflval;\n\n\n  /* Shift the error token.  */\n  FF_SYMBOL_PRINT (\"Shifting\", ffstos[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| ffabortlab -- FFABORT comes here.  |\n`-----------------------------------*/\nffabortlab:\n  ffresult = 1;\n  goto ffreturn;\n\n#if !defined(ffoverflow) || FFERROR_VERBOSE\n/*-------------------------------------------------.\n| ffexhaustedlab -- memory exhaustion comes here.  |\n`-------------------------------------------------*/\nffexhaustedlab:\n  fferror (FF_(\"memory exhausted\"));\n  ffresult = 2;\n  /* Fall through.  */\n#endif\n\nffreturn:\n  if (ffchar != FFEMPTY)\n     ffdestruct (\"Cleanup: discarding lookahead\",\n\t\t fftoken, &fflval);\n  /* Do not reclaim the symbols of the rule which 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\t\t  ffstos[*ffssp], ffvsp);\n      FFPOPSTACK (1);\n    }\n#ifndef ffoverflow\n  if (ffss != ffssa)\n    FFSTACK_FREE (ffss);\n#endif\n#if FFERROR_VERBOSE\n  if (ffmsg != ffmsgbuf)\n    FFSTACK_FREE (ffmsg);\n#endif\n  /* Make sure FFID is used.  */\n  return FFID (ffresult);\n}\n\n\n\n/* Line 1675 of yacc.c  */\n#line 1153 \"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( char *fname, int Node1, char *start, char *stop )\n{\n   fitsfile *fptr;\n   Node *this, *that0, *that1;\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( 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   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->nSubNodes      = 2;\n      this->SubNodes[1]    = Node1;\n      this->operation      = (int)gtifilt_fct;\n      this->DoOp           = Do_GTI;\n      this->type           = BOOLEAN;\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\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\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( OPER(Node1)==CONST_OP )\n\t this->DoOp( this );\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 '%':\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 '%':   \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\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\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);\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 );\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 long Search_GTI( double evtTime, long nGTI, double *start,\n\t\t\tdouble *stop, int ordered )\n{\n   long gti, 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  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  gti = -1L;\n\t\t  break;\n\t       }\n\t    } else {\n\t       break;\n\t    }\n\t }\n      } else\n\t gti = -1L;\n      \n   } else { /*  Use \"SLOW\" linear search  */\n      gti = nGTI;\n      while( gti-- )\n\t if( evtTime>=start[gti] && evtTime<=stop[gti] )\n\t    break;\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\n"},{"id":13741,"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":13742,"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":13743,"name":"zcompress.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","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":13744,"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"},{"id":13745,"name":"zuncompress.c","nodeType":"TextFile","path":"cextern/cfitsio/zlib","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":13746,"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"},{"id":13747,"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":13748,"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":13749,"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":13750,"name":"examples/io","nodeType":"Package"},{"fileName":"create-mef.py","filePath":"examples/io","id":13751,"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\n*By: Erik Bray*\n\n*License: BSD*\n\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":13752,"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 <http://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\n*By: Erik Bray, Adrian Price-Whelan*\n\n*License: BSD*\n\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(\"Image size: {} x {}\".format(xsize, ysize))\nplt.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)\ng_data = g_data.reshape(ysize, xsize)\nb_data = b_data.reshape(ysize, xsize)\n\n##############################################################################\n# Write out the channels as separate FITS images\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\n##############################################################################\n# Delete the files created\nimport os\nos.remove('red.fits')\nos.remove('green.fits')\nos.remove('blue.fits')\n"},{"id":13753,"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":13754,"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"},{"fileName":"modify-fits-header.py","filePath":"examples/io","id":13755,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\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 <http://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":"HDUList","col":0,"comment":"null","endLoc":29,"id":13756,"name":"new_hdul","nodeType":"Attribute","startLoc":29,"text":"new_hdul"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":13757,"name":"fits_file","nodeType":"Attribute","startLoc":27,"text":"fits_file"},{"attributeType":"null","col":16,"comment":"null","endLoc":23,"id":13758,"name":"np","nodeType":"Attribute","startLoc":23,"text":"np"},{"attributeType":"null","col":28,"comment":"null","endLoc":30,"id":13759,"name":"plt","nodeType":"Attribute","startLoc":30,"text":"plt"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":13760,"name":"image","nodeType":"Attribute","startLoc":37,"text":"image"},{"attributeType":"null","col":0,"comment":"null","endLoc":38,"id":13761,"name":"xsize","nodeType":"Attribute","startLoc":38,"text":"xsize"},{"attributeType":"null","col":39,"comment":"null","endLoc":76,"id":13762,"name":"f","nodeType":"Attribute","startLoc":76,"text":"f"},{"attributeType":"null","col":7,"comment":"null","endLoc":38,"id":13763,"name":"ysize","nodeType":"Attribute","startLoc":38,"text":"ysize"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":46,"id":13764,"name":"hdu1","nodeType":"Attribute","startLoc":46,"text":"hdu1"},{"attributeType":"null","col":0,"comment":"null","endLoc":46,"id":13765,"name":"r","nodeType":"Attribute","startLoc":46,"text":"r"},{"fileName":"fits-tables.py","filePath":"examples/io","id":13766,"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\n*By: Lia Corrales, Adrian Price-Whelan, and Kelle Cruz*\n\n*License: BSD*\n\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"},{"attributeType":"null","col":3,"comment":"null","endLoc":46,"id":13767,"name":"g","nodeType":"Attribute","startLoc":46,"text":"g"},{"id":13768,"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"},{"attributeType":"null","col":6,"comment":"null","endLoc":46,"id":13769,"name":"b","nodeType":"Attribute","startLoc":46,"text":"b"},{"attributeType":"null","col":0,"comment":"null","endLoc":37,"id":13770,"name":"event_filename","nodeType":"Attribute","startLoc":37,"text":"event_filename"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":13771,"name":"r_data","nodeType":"Attribute","startLoc":47,"text":"r_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":48,"id":13772,"name":"g_data","nodeType":"Attribute","startLoc":48,"text":"g_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":49,"id":13773,"name":"b_data","nodeType":"Attribute","startLoc":49,"text":"b_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":50,"id":13774,"name":"events","nodeType":"Attribute","startLoc":50,"text":"events"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":13775,"name":"r_data","nodeType":"Attribute","startLoc":55,"text":"r_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":13776,"name":"g_data","nodeType":"Attribute","startLoc":56,"text":"g_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":57,"id":13777,"name":"b_data","nodeType":"Attribute","startLoc":57,"text":"b_data"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":62,"id":13778,"name":"red","nodeType":"Attribute","startLoc":62,"text":"red"},{"col":0,"comment":"","endLoc":23,"header":"fits-tables.py#<anonymous>","id":13779,"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\n*By: Lia Corrales, Adrian Price-Whelan, and Kelle Cruz*\n\n*License: BSD*\n\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'])"},{"fileName":"plot_fits-image.py","filePath":"examples/io","id":13780,"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\n*By: Lia R. Corrales, Adrian Price-Whelan, Kelle Cruz*\n\n*License: BSD*\n\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":25,"id":13781,"name":"plt","nodeType":"Attribute","startLoc":25,"text":"plt"},{"attributeType":"null","col":0,"comment":"null","endLoc":35,"id":13782,"name":"image_file","nodeType":"Attribute","startLoc":35,"text":"image_file"},{"fileName":"skip_create-large-fits.py","filePath":"examples/io","id":13783,"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\n*By: Erik Bray*\n\n*License: BSD*\n\n-------------------\n\"\"\"\n\n##############################################################################\n#  Normally to create a single image FITS file one would do something like:\n\nimport os\nimport numpy\nfrom astropy.io import fits\ndata = numpy.zeros((40000, 40000), dtype=numpy.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 = numpy.zeros((100, 100), dtype=numpy.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['NAXIS{0}'.format(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"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":67,"id":13784,"name":"green","nodeType":"Attribute","startLoc":67,"text":"green"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":13785,"name":"data","nodeType":"Attribute","startLoc":25,"text":"data"},{"attributeType":"ImageHDU","col":0,"comment":"null","endLoc":47,"id":13786,"name":"hdu2","nodeType":"Attribute","startLoc":47,"text":"hdu2"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":26,"id":13787,"name":"hdu","nodeType":"Attribute","startLoc":26,"text":"hdu"},{"attributeType":"HDUList","col":0,"comment":"null","endLoc":48,"id":13788,"name":"new_hdul","nodeType":"Attribute","startLoc":48,"text":"new_hdul"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":13789,"name":"image_data","nodeType":"Attribute","startLoc":47,"text":"image_data"},{"col":0,"comment":"","endLoc":18,"header":"create-mef.py#<anonymous>","id":13790,"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\n*By: Erik Bray*\n\n*License: BSD*\n\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":8,"comment":"null","endLoc":77,"id":13791,"name":"hdu","nodeType":"Attribute","startLoc":77,"text":"hdu"},{"col":0,"comment":"","endLoc":18,"header":"modify-fits-header.py#<anonymous>","id":13792,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\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)))"},{"col":0,"comment":"","endLoc":20,"header":"plot_fits-image.py#<anonymous>","id":13793,"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\n*By: Lia R. Corrales, Adrian Price-Whelan, Kelle Cruz*\n\n*License: BSD*\n\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()"},{"id":13794,"name":"examples/template","nodeType":"Package"},{"fileName":"example-template.py","filePath":"examples/template","id":13795,"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\n*By: <names>*\n\n*License: BSD*\n\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 commend\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# 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"},{"id":13796,"name":"examples/coordinates","nodeType":"Package"},{"fileName":"plot_obs-planning.py","filePath":"examples/coordinates","id":13797,"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\n*By: Erik Tollerud, Kelle Cruz*\n\n*License: BSD*\n\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# 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 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(\"M33's Altitude = {0.alt:.2}\".format(m33altaz))\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.to('hr').value, 0, 90,\n                 sunaltazs_July12_to_13.alt < -0*u.deg, color='0.5', zorder=0)\nplt.fill_between(delta_midnight.to('hr').value, 0, 90,\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, 12)\nplt.xticks(np.arange(13)*2 -12)\nplt.ylim(0, 90)\nplt.xlabel('Hours from EDT Midnight')\nplt.ylabel('Altitude [deg]')\nplt.show()\n"},{"fileName":"rv-to-gsr.py","filePath":"examples/coordinates","id":13798,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\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# For this example, let's work with the coordinates and barycentric radial\n# velocity of the star HD 155967, as obtained from\n# `Simbad <http://simbad.harvard.edu/simbad/>`_:\nicrs = coord.ICRS(ra=258.58356362*u.deg, dec=14.55255619*u.deg,\n                  radial_velocity=-16.1*u.km/u.s)\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# 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 = icrs.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\nrv_gsr = rv_to_gsr(icrs)\nprint(rv_gsr)\n"},{"col":0,"comment":"Dummy function to make sure docstrings don't get rendered as text","endLoc":83,"header":"def dummy()","id":13799,"name":"dummy","nodeType":"Function","startLoc":81,"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":27,"id":13800,"name":"np","nodeType":"Attribute","startLoc":27,"text":"np"},{"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":101,"header":"def rv_to_gsr(c, v_sun=None)","id":13801,"name":"rv_to_gsr","nodeType":"Function","startLoc":70,"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 = icrs.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"},{"attributeType":"null","col":28,"comment":"null","endLoc":28,"id":13802,"name":"plt","nodeType":"Attribute","startLoc":28,"text":"plt"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":13803,"name":"x","nodeType":"Attribute","startLoc":53,"text":"x"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":13804,"name":"xx","nodeType":"Attribute","startLoc":54,"text":"xx"},{"attributeType":"null","col":4,"comment":"null","endLoc":54,"id":13805,"name":"yy","nodeType":"Attribute","startLoc":54,"text":"yy"},{"attributeType":"null","col":16,"comment":"null","endLoc":39,"id":13806,"name":"np","nodeType":"Attribute","startLoc":39,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":13807,"name":"z","nodeType":"Attribute","startLoc":55,"text":"z"},{"attributeType":"null","col":28,"comment":"null","endLoc":40,"id":13808,"name":"plt","nodeType":"Attribute","startLoc":40,"text":"plt"},{"attributeType":"null","col":24,"comment":"null","endLoc":49,"id":13809,"name":"u","nodeType":"Attribute","startLoc":49,"text":"u"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":59,"id":13810,"name":"m33","nodeType":"Attribute","startLoc":59,"text":"m33"},{"attributeType":"null","col":0,"comment":"null","endLoc":87,"id":13811,"name":"string","nodeType":"Attribute","startLoc":87,"text":"string"},{"col":0,"comment":"","endLoc":21,"header":"example-template.py#<anonymous>","id":13812,"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\n*By: <names>*\n\n*License: BSD*\n\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()"},{"attributeType":"EarthLocation","col":0,"comment":"null","endLoc":65,"id":13813,"name":"bear_mountain","nodeType":"Attribute","startLoc":65,"text":"bear_mountain"},{"id":13814,"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"},{"fileName":"plot_galactocentric-frame.py","filePath":"examples/coordinates","id":13815,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\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# <simbad.harvard.edu/simbad/>`_ database:\n\nc1 = coord.ICRS(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\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 must be specified as a\n# `~astropy.coordinates.CartesianDifferential` instance, as in the example\n# below. Note that, as with the positions, the Galactocentric frame is a\n# right-handed system - the x-axis is positive towards the Galactic center, so\n# ``v_x`` is opposite of the Galactocentric radial velocity:\n\nv_sun = coord.CartesianDifferential([11.1, 244, 7.25]*u.km/u.s)\ngc_frame = coord.Galactocentric(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\n\ngc_frame2 = coord.Galactocentric(galcen_distance=galcen_distance,\n                                 galcen_v_sun=coord.CartesianDifferential(vx, vy, vz),\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.Galactocentric(ring_rep)\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('$v_x$ [{0}]'.format((u.km/u.s).to_string(\"latex_inline\")))\naxes[1].set_ylabel('$v_y$ [{0}]'.format((u.km/u.s).to_string(\"latex_inline\")))\n\nfig.tight_layout()\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(r'$\\mu_l \\, \\cos b$ [{0}]'.format((u.mas/u.yr).to_string('latex_inline')))\n\nax.legend()\n"},{"attributeType":"null","col":16,"comment":"null","endLoc":38,"id":13816,"name":"np","nodeType":"Attribute","startLoc":38,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":56,"id":13817,"name":"data","nodeType":"Attribute","startLoc":56,"text":"data"},{"attributeType":"null","col":0,"comment":"null","endLoc":66,"id":13818,"name":"utcoffset","nodeType":"Attribute","startLoc":66,"text":"utcoffset"},{"attributeType":"null","col":28,"comment":"null","endLoc":39,"id":13819,"name":"plt","nodeType":"Attribute","startLoc":39,"text":"plt"},{"attributeType":"null","col":30,"comment":"null","endLoc":47,"id":13820,"name":"coord","nodeType":"Attribute","startLoc":47,"text":"coord"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":72,"id":13821,"name":"blue","nodeType":"Attribute","startLoc":72,"text":"blue"},{"attributeType":"null","col":24,"comment":"null","endLoc":48,"id":13822,"name":"u","nodeType":"Attribute","startLoc":48,"text":"u"},{"attributeType":"ICRS","col":0,"comment":"null","endLoc":55,"id":13823,"name":"c1","nodeType":"Attribute","startLoc":55,"text":"c1"},{"attributeType":"null","col":24,"comment":"null","endLoc":30,"id":13824,"name":"u","nodeType":"Attribute","startLoc":30,"text":"u"},{"attributeType":"null","col":30,"comment":"null","endLoc":31,"id":13825,"name":"coord","nodeType":"Attribute","startLoc":31,"text":"coord"},{"attributeType":"ICRS","col":0,"comment":"null","endLoc":37,"id":13826,"name":"icrs","nodeType":"Attribute","startLoc":37,"text":"icrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":47,"id":13827,"name":"v_sun","nodeType":"Attribute","startLoc":47,"text":"v_sun"},{"attributeType":"null","col":0,"comment":"null","endLoc":53,"id":13828,"name":"gal","nodeType":"Attribute","startLoc":53,"text":"gal"},{"attributeType":"null","col":0,"comment":"null","endLoc":67,"id":13829,"name":"time","nodeType":"Attribute","startLoc":67,"text":"time"},{"attributeType":"null","col":0,"comment":"null","endLoc":54,"id":13830,"name":"cart_data","nodeType":"Attribute","startLoc":54,"text":"cart_data"},{"attributeType":"null","col":0,"comment":"null","endLoc":55,"id":13831,"name":"unit_vector","nodeType":"Attribute","startLoc":55,"text":"unit_vector"},{"attributeType":"PrimaryHDU","col":0,"comment":"null","endLoc":57,"id":13832,"name":"hdu","nodeType":"Attribute","startLoc":57,"text":"hdu"},{"attributeType":"null","col":0,"comment":"null","endLoc":59,"id":13833,"name":"v_proj","nodeType":"Attribute","startLoc":59,"text":"v_proj"},{"col":0,"comment":"","endLoc":21,"header":"split-jpeg-to-fits.py#<anonymous>","id":13834,"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 <http://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\n*By: Erik Bray, Adrian Price-Whelan*\n\n*License: BSD*\n\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(\"Image size: {} x {}\".format(xsize, ysize))\n\nplt.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)\n\ng_data = g_data.reshape(ysize, xsize)\n\nb_data = b_data.reshape(ysize, xsize)\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\nos.remove('red.fits')\n\nos.remove('green.fits')\n\nos.remove('blue.fits')"},{"attributeType":"null","col":0,"comment":"null","endLoc":64,"id":13835,"name":"rv_gsr","nodeType":"Attribute","startLoc":64,"text":"rv_gsr"},{"attributeType":"null","col":0,"comment":"null","endLoc":103,"id":13836,"name":"rv_gsr","nodeType":"Attribute","startLoc":103,"text":"rv_gsr"},{"attributeType":"null","col":0,"comment":"null","endLoc":58,"id":13837,"name":"header","nodeType":"Attribute","startLoc":58,"text":"header"},{"col":0,"comment":"","endLoc":25,"header":"rv-to-gsr.py#<anonymous>","id":13838,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n-------------------\n\n\"\"\"\n\nicrs = coord.ICRS(ra=258.58356362*u.deg, dec=14.55255619*u.deg,\n                  radial_velocity=-16.1*u.km/u.s)\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":"null","col":34,"comment":"null","endLoc":80,"id":13839,"name":"fobj","nodeType":"Attribute","startLoc":80,"text":"fobj"},{"attributeType":"null","col":0,"comment":"null","endLoc":93,"id":13840,"name":"shape","nodeType":"Attribute","startLoc":93,"text":"shape"},{"attributeType":"null","col":48,"comment":"null","endLoc":93,"id":13841,"name":"ii","nodeType":"Attribute","startLoc":93,"text":"ii"},{"attributeType":"null","col":0,"comment":"null","endLoc":67,"id":13842,"name":"gc1","nodeType":"Attribute","startLoc":67,"text":"gc1"},{"fileName":"plot_sgr-coordinate-frame.py","filePath":"examples/coordinates","id":13843,"nodeType":"File","text":"# -*- coding: utf-8 -*-\n\"\"\"\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-coordinates-design` and the\ndocstring for `~astropy.coordinates.BaseCoordinateFrame`. In this example, we\nwill define a coordinate system defined by the plane of orbit of the Sagittarius\nDwarf Galaxy (hereafter Sgr; as defined in Majewski et al. 2003).  The Sgr\ncoordinate system is often referred to in terms of two angular coordinates,\n:math:`\\Lambda,B`.\n\nTo do this, wee 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* 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 http://www.stsci.edu/~dlaw/Sgr/\n\n-------------------\n\n*By: Adrian Price-Whelan, Erik Tollerud*\n\n*License: BSD*\n\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\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        http://adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        http://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : :class:`~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 : :class:`~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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\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        coord.SphericalCosLatDifferential: [\n            coord.RepresentationMapping('d_lon_coslat', 'pm_Lambda_cosBeta'),\n            coord.RepresentationMapping('d_lat', 'pm_Beta'),\n            coord.RepresentationMapping('d_distance', 'radial_velocity')],\n        coord.SphericalDifferential: [\n            coord.RepresentationMapping('d_lon', 'pm_Lambda'),\n            coord.RepresentationMapping('d_lat', 'pm_Beta'),\n            coord.RepresentationMapping('d_distance', 'radial_velocity')]\n    }\n\n    frame_specific_representation_info[coord.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[coord.SphericalRepresentation]\n    frame_specific_representation_info[coord.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[coord.SphericalCosLatDifferential]\n    frame_specific_representation_info[coord.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[coord.SphericalDifferential]\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-deteremined 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# 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# 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# 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.ICRS(280.161732*u.degree, 11.91934*u.degree)\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 = Sagittarius(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                  Beta=np.zeros(128)*u.radian)\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 = Sagittarius(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)\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(r\"$\\mu_\\Lambda \\, \\cos B$ [{0}]\"\n                   .format(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(r\"$\\mu_\\alpha \\, \\cos\\delta$ [{0}]\"\n                   .format(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(r\"$\\mu_\\delta$ [{0}]\"\n                   .format(icrs.pm_dec.unit.to_string('latex_inline')))\n\nplt.show()\n"},{"attributeType":"null","col":34,"comment":"null","endLoc":94,"id":13844,"name":"fobj","nodeType":"Attribute","startLoc":94,"text":"fobj"},{"col":0,"comment":"","endLoc":17,"header":"skip_create-large-fits.py#<anonymous>","id":13845,"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\n*By: Erik Bray*\n\n*License: BSD*\n\n-------------------\n\"\"\"\n\ndata = numpy.zeros((40000, 40000), dtype=numpy.float64)\n\nhdu = fits.PrimaryHDU(data=data)\n\nhdu.writeto('large.fits')\n\ndata = numpy.zeros((100, 100), dtype=numpy.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['NAXIS{0}'.format(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')"},{"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        http://adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        http://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : :class:`~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 : :class:`~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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\n\n    ","endLoc":117,"id":13846,"nodeType":"Class","startLoc":66,"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        http://adsabs.harvard.edu/abs/2003ApJ...599.1082M\n    and further explained in\n        http://www.stsci.edu/~dlaw/Sgr/.\n\n    Parameters\n    ----------\n    representation : `BaseRepresentation` or None\n        A representation object or None to have no data (or use the other keywords)\n    Lambda : `Angle`, optional, must be keyword\n        The longitude-like angle corresponding to Sagittarius' orbit.\n    Beta : `Angle`, optional, must be keyword\n        The latitude-like angle corresponding to Sagittarius' orbit.\n    distance : `Quantity`, optional, must be keyword\n        The Distance for this object along the line-of-sight.\n    pm_Lambda_cosBeta : :class:`~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 : :class:`~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 : :class:`~astropy.units.Quantity`, optional, must be keyword\n        The radial velocity of this object.\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        coord.SphericalCosLatDifferential: [\n            coord.RepresentationMapping('d_lon_coslat', 'pm_Lambda_cosBeta'),\n            coord.RepresentationMapping('d_lat', 'pm_Beta'),\n            coord.RepresentationMapping('d_distance', 'radial_velocity')],\n        coord.SphericalDifferential: [\n            coord.RepresentationMapping('d_lon', 'pm_Lambda'),\n            coord.RepresentationMapping('d_lat', 'pm_Beta'),\n            coord.RepresentationMapping('d_distance', 'radial_velocity')]\n    }\n\n    frame_specific_representation_info[coord.UnitSphericalRepresentation] = \\\n        frame_specific_representation_info[coord.SphericalRepresentation]\n    frame_specific_representation_info[coord.UnitSphericalCosLatDifferential] = \\\n        frame_specific_representation_info[coord.SphericalCosLatDifferential]\n    frame_specific_representation_info[coord.UnitSphericalDifferential] = \\\n        frame_specific_representation_info[coord.SphericalDifferential]"},{"attributeType":"SphericalRepresentation","col":4,"comment":"null","endLoc":94,"id":13847,"name":"default_representation","nodeType":"Attribute","startLoc":94,"text":"default_representation"},{"attributeType":"CartesianDifferential","col":0,"comment":"null","endLoc":88,"id":13848,"name":"v_sun","nodeType":"Attribute","startLoc":88,"text":"v_sun"},{"attributeType":"SphericalCosLatDifferential","col":4,"comment":"null","endLoc":95,"id":13849,"name":"default_differential","nodeType":"Attribute","startLoc":95,"text":"default_differential"},{"attributeType":"null","col":4,"comment":"null","endLoc":97,"id":13850,"name":"frame_specific_representation_info","nodeType":"Attribute","startLoc":97,"text":"frame_specific_representation_info"},{"col":0,"comment":" Compute the transformation matrix from Galactic spherical to\n        heliocentric Sgr coordinates.\n    ","endLoc":160,"header":"@frame_transform_graph.transform(coord.StaticMatrixTransform, coord.Galactic, Sagittarius)\ndef galactic_to_sgr()","id":13851,"name":"galactic_to_sgr","nodeType":"Function","startLoc":155,"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"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":77,"id":13852,"name":"m33altaz","nodeType":"Attribute","startLoc":77,"text":"m33altaz"},{"attributeType":"null","col":0,"comment":"null","endLoc":88,"id":13853,"name":"midnight","nodeType":"Attribute","startLoc":88,"text":"midnight"},{"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":427,"header":"def get_transform(self, frame)","id":13854,"name":"get_transform","nodeType":"Function","startLoc":396,"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":477,"header":"def _get_transform_no_transdata(self, frame)","id":13855,"name":"_get_transform_no_transdata","nodeType":"Function","startLoc":429,"text":"def _get_transform_no_transdata(self, frame):\n        \"\"\"\n        Return a transform from data to the specified frame\n        \"\"\"\n\n        if self.wcs is None and frame != 'pixel':\n            raise ValueError('No WCS specified, so only pixel coordinates are available')\n\n        if isinstance(frame, WCS):\n\n            coord_in = wcs_to_celestial_frame(self.wcs)\n            coord_out = wcs_to_celestial_frame(frame)\n\n            if coord_in == coord_out:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        WCSWorld2PixelTransform(frame))\n\n            else:\n\n                return (WCSPixel2WorldTransform(self.wcs, slice=self.slices) +\n                        CoordinateTransform(self.wcs, frame) +\n                        WCSWorld2PixelTransform(frame))\n\n        elif frame == 'pixel':\n\n            return Affine2D()\n\n        elif isinstance(frame, Transform):\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            return pixel2world + frame\n\n        else:\n\n            pixel2world = WCSPixel2WorldTransform(self.wcs, slice=self.slices)\n\n            if frame == 'world':\n\n                return pixel2world\n\n            else:\n                coordinate_transform = CoordinateTransform(self.wcs, frame)\n\n                if coordinate_transform.same_frames:\n                    return pixel2world\n                else:\n                    return pixel2world + CoordinateTransform(self.wcs, frame)"},{"attributeType":"Galactocentric","col":0,"comment":"null","endLoc":89,"id":13856,"name":"gc_frame","nodeType":"Attribute","startLoc":89,"text":"gc_frame"},{"col":4,"comment":"null","endLoc":356,"header":"def draw(self, renderer, inframe=False)","id":13857,"name":"draw","nodeType":"Function","startLoc":310,"text":"def draw(self, renderer, inframe=False):\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        # 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, inframe)\n\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        self._ticklabels_bbox = []\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=self._ticklabels_bbox)\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=self._ticklabels_bbox,\n                                       visible_ticks=visible_ticks)\n\n        self.coords.frame.draw(renderer)\n\n        self._drawn = True"},{"attributeType":"null","col":0,"comment":"null","endLoc":89,"id":13858,"name":"delta_midnight","nodeType":"Attribute","startLoc":89,"text":"delta_midnight"},{"attributeType":"AltAz","col":0,"comment":"null","endLoc":90,"id":13859,"name":"frame_July13night","nodeType":"Attribute","startLoc":90,"text":"frame_July13night"},{"attributeType":"null","col":0,"comment":"null","endLoc":96,"id":13860,"name":"gc2","nodeType":"Attribute","startLoc":96,"text":"gc2"},{"col":4,"comment":"null","endLoc":359,"header":"def set_xlabel(self, label, labelpad=1, **kwargs)","id":13861,"name":"set_xlabel","nodeType":"Function","startLoc":358,"text":"def set_xlabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._x_index].set_axislabel(label, minpad=labelpad, **kwargs)"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":92,"id":13862,"name":"m33altazs_July13night","nodeType":"Attribute","startLoc":92,"text":"m33altazs_July13night"},{"col":4,"comment":"null","endLoc":362,"header":"def set_ylabel(self, label, labelpad=1, **kwargs)","id":13863,"name":"set_ylabel","nodeType":"Function","startLoc":361,"text":"def set_ylabel(self, label, labelpad=1, **kwargs):\n        self.coords[self._y_index].set_axislabel(label, minpad=labelpad, **kwargs)"},{"attributeType":"null","col":0,"comment":"null","endLoc":97,"id":13864,"name":"m33airmasss_July13night","nodeType":"Attribute","startLoc":97,"text":"m33airmasss_July13night"},{"col":4,"comment":"null","endLoc":365,"header":"def get_xlabel(self)","id":13865,"name":"get_xlabel","nodeType":"Function","startLoc":364,"text":"def get_xlabel(self):\n        return self.coords[self._x_index].get_axislabel()"},{"attributeType":"null","col":0,"comment":"null","endLoc":114,"id":13866,"name":"delta_midnight","nodeType":"Attribute","startLoc":114,"text":"delta_midnight"},{"col":4,"comment":"null","endLoc":368,"header":"def get_ylabel(self)","id":13867,"name":"get_ylabel","nodeType":"Function","startLoc":367,"text":"def get_ylabel(self):\n        return self.coords[self._y_index].get_axislabel()"},{"col":4,"comment":"null","endLoc":394,"header":"def get_coords_overlay(self, frame, coord_meta=None)","id":13868,"name":"get_coords_overlay","nodeType":"Function","startLoc":370,"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            coords = CoordinatesMap(self, frame, frame_class=self.frame_class)\n        else:\n            if coord_meta is None:\n                coord_meta = get_coord_meta(frame)\n            transform = self._get_transform_no_transdata(frame)\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"},{"attributeType":"null","col":0,"comment":"null","endLoc":115,"id":13869,"name":"times_July12_to_13","nodeType":"Attribute","startLoc":115,"text":"times_July12_to_13"},{"attributeType":"AltAz","col":0,"comment":"null","endLoc":116,"id":13870,"name":"frame_July12_to_13","nodeType":"Attribute","startLoc":116,"text":"frame_July12_to_13"},{"attributeType":"null","col":0,"comment":"null","endLoc":105,"id":13871,"name":"galcen_distance","nodeType":"Attribute","startLoc":105,"text":"galcen_distance"},{"attributeType":"null","col":0,"comment":"null","endLoc":106,"id":13872,"name":"pm_gal_sgrA","nodeType":"Attribute","startLoc":106,"text":"pm_gal_sgrA"},{"attributeType":"null","col":0,"comment":"null","endLoc":117,"id":13873,"name":"sunaltazs_July12_to_13","nodeType":"Attribute","startLoc":117,"text":"sunaltazs_July12_to_13"},{"attributeType":"null","col":0,"comment":"null","endLoc":107,"id":13874,"name":"vy","nodeType":"Attribute","startLoc":107,"text":"vy"},{"attributeType":"null","col":0,"comment":"null","endLoc":126,"id":13875,"name":"moon_July12_to_13","nodeType":"Attribute","startLoc":126,"text":"moon_July12_to_13"},{"attributeType":"null","col":4,"comment":"null","endLoc":107,"id":13876,"name":"vz","nodeType":"Attribute","startLoc":107,"text":"vz"},{"attributeType":"null","col":0,"comment":"null","endLoc":127,"id":13877,"name":"moonaltazs_July12_to_13","nodeType":"Attribute","startLoc":127,"text":"moonaltazs_July12_to_13"},{"attributeType":"SkyCoord","col":0,"comment":"null","endLoc":132,"id":13878,"name":"m33altazs_July12_to_13","nodeType":"Attribute","startLoc":132,"text":"m33altazs_July12_to_13"},{"col":0,"comment":"","endLoc":27,"header":"plot_obs-planning.py#<anonymous>","id":13879,"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\n*By: Erik Tollerud, Kelle Cruz*\n\n*License: BSD*\n\n-------------------\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\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(\"M33's Altitude = {0.alt:.2}\".format(m33altaz))\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.to('hr').value, 0, 90,\n                 sunaltazs_July12_to_13.alt < -0*u.deg, color='0.5', zorder=0)\n\nplt.fill_between(delta_midnight.to('hr').value, 0, 90,\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, 12)\n\nplt.xticks(np.arange(13)*2 -12)\n\nplt.ylim(0, 90)\n\nplt.xlabel('Hours from EDT Midnight')\n\nplt.ylabel('Altitude [deg]')\n\nplt.show()"},{"col":4,"comment":"null","endLoc":490,"header":"def get_tightbbox(self, renderer)","id":13880,"name":"get_tightbbox","nodeType":"Function","startLoc":479,"text":"def get_tightbbox(self, renderer):\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\n        if bb:\n            _bbox = Bbox.union(bb)\n            return _bbox\n        else:\n            return self.get_window_extent(renderer)"},{"attributeType":"null","col":0,"comment":"null","endLoc":112,"id":13881,"name":"vx","nodeType":"Attribute","startLoc":112,"text":"vx"},{"col":0,"comment":" Compute the transformation matrix from heliocentric Sgr coordinates to\n        spherical Galactic.\n    ","endLoc":176,"header":"@frame_transform_graph.transform(coord.StaticMatrixTransform, Sagittarius, coord.Galactic)\ndef sgr_to_galactic()","id":13882,"name":"sgr_to_galactic","nodeType":"Function","startLoc":171,"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":"Galactocentric","col":0,"comment":"null","endLoc":114,"id":13883,"name":"gc_frame2","nodeType":"Attribute","startLoc":114,"text":"gc_frame2"},{"attributeType":"null","col":16,"comment":"null","endLoc":47,"id":13884,"name":"np","nodeType":"Attribute","startLoc":47,"text":"np"},{"attributeType":"null","col":28,"comment":"null","endLoc":48,"id":13885,"name":"plt","nodeType":"Attribute","startLoc":48,"text":"plt"},{"attributeType":"null","col":30,"comment":"null","endLoc":58,"id":13886,"name":"coord","nodeType":"Attribute","startLoc":58,"text":"coord"},{"attributeType":"null","col":0,"comment":"null","endLoc":117,"id":13887,"name":"gc3","nodeType":"Attribute","startLoc":117,"text":"gc3"},{"attributeType":"null","col":24,"comment":"null","endLoc":59,"id":13888,"name":"u","nodeType":"Attribute","startLoc":59,"text":"u"},{"attributeType":"null","col":0,"comment":"null","endLoc":139,"id":13889,"name":"SGR_PHI","nodeType":"Attribute","startLoc":139,"text":"SGR_PHI"},{"attributeType":"null","col":0,"comment":"null","endLoc":140,"id":13890,"name":"SGR_THETA","nodeType":"Attribute","startLoc":140,"text":"SGR_THETA"},{"attributeType":"null","col":0,"comment":"null","endLoc":141,"id":13891,"name":"SGR_PSI","nodeType":"Attribute","startLoc":141,"text":"SGR_PSI"},{"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        ","endLoc":521,"header":"def grid(self, b=None, axis='both', *, which='major', **kwargs)","id":13892,"name":"grid","nodeType":"Function","startLoc":492,"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        \"\"\"\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')"},{"attributeType":"null","col":0,"comment":"null","endLoc":144,"id":13893,"name":"D","nodeType":"Attribute","startLoc":144,"text":"D"},{"attributeType":"null","col":0,"comment":"null","endLoc":127,"id":13894,"name":"ring_distances","nodeType":"Attribute","startLoc":127,"text":"ring_distances"},{"attributeType":"null","col":0,"comment":"null","endLoc":145,"id":13895,"name":"C","nodeType":"Attribute","startLoc":145,"text":"C"},{"attributeType":"null","col":0,"comment":"null","endLoc":128,"id":13896,"name":"circ_velocity","nodeType":"Attribute","startLoc":128,"text":"circ_velocity"},{"attributeType":"null","col":0,"comment":"null","endLoc":146,"id":13897,"name":"B","nodeType":"Attribute","startLoc":146,"text":"B"},{"attributeType":"null","col":0,"comment":"null","endLoc":130,"id":13898,"name":"phi_grid","nodeType":"Attribute","startLoc":130,"text":"phi_grid"},{"attributeType":"null","col":0,"comment":"null","endLoc":147,"id":13899,"name":"A","nodeType":"Attribute","startLoc":147,"text":"A"},{"attributeType":"null","col":0,"comment":"null","endLoc":148,"id":13900,"name":"SGR_MATRIX","nodeType":"Attribute","startLoc":148,"text":"SGR_MATRIX"},{"attributeType":"CylindricalRepresentation","col":0,"comment":"null","endLoc":131,"id":13901,"name":"ring_rep","nodeType":"Attribute","startLoc":131,"text":"ring_rep"},{"attributeType":"ICRS","col":0,"comment":"null","endLoc":185,"id":13902,"name":"icrs","nodeType":"Attribute","startLoc":185,"text":"icrs"},{"attributeType":"null","col":12,"comment":"null","endLoc":273,"id":13903,"name":"slices","nodeType":"Attribute","startLoc":273,"text":"self.slices"},{"attributeType":"WCS","col":12,"comment":"null","endLoc":237,"id":13904,"name":"wcs","nodeType":"Attribute","startLoc":237,"text":"self.wcs"},{"attributeType":"null","col":0,"comment":"null","endLoc":136,"id":13905,"name":"angular_velocity","nodeType":"Attribute","startLoc":136,"text":"angular_velocity"},{"attributeType":"null","col":0,"comment":"null","endLoc":186,"id":13906,"name":"sgr","nodeType":"Attribute","startLoc":186,"text":"sgr"},{"attributeType":"Sagittarius","col":0,"comment":"null","endLoc":193,"id":13907,"name":"sgr","nodeType":"Attribute","startLoc":193,"text":"sgr"},{"attributeType":"CylindricalDifferential","col":0,"comment":"null","endLoc":138,"id":13908,"name":"ring_dif","nodeType":"Attribute","startLoc":138,"text":"ring_dif"},{"attributeType":"null","col":0,"comment":"null","endLoc":195,"id":13909,"name":"icrs","nodeType":"Attribute","startLoc":195,"text":"icrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":144,"id":13910,"name":"ring_rep","nodeType":"Attribute","startLoc":144,"text":"ring_rep"},{"attributeType":"null","col":0,"comment":"null","endLoc":201,"id":13911,"name":"fig","nodeType":"Attribute","startLoc":201,"text":"fig"},{"attributeType":"null","col":5,"comment":"null","endLoc":201,"id":13912,"name":"axes","nodeType":"Attribute","startLoc":201,"text":"axes"},{"attributeType":"Sagittarius","col":0,"comment":"null","endLoc":220,"id":13913,"name":"sgr","nodeType":"Attribute","startLoc":220,"text":"sgr"},{"attributeType":"Galactocentric","col":0,"comment":"null","endLoc":145,"id":13914,"name":"gc_rings","nodeType":"Attribute","startLoc":145,"text":"gc_rings"},{"attributeType":"null","col":0,"comment":"null","endLoc":224,"id":13915,"name":"icrs","nodeType":"Attribute","startLoc":224,"text":"icrs"},{"attributeType":"null","col":0,"comment":"null","endLoc":152,"id":13916,"name":"fig","nodeType":"Attribute","startLoc":152,"text":"fig"},{"attributeType":"null","col":0,"comment":"null","endLoc":227,"id":13917,"name":"fig","nodeType":"Attribute","startLoc":227,"text":"fig"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":392,"id":13918,"name":"overlay_coords","nodeType":"Attribute","startLoc":392,"text":"self.overlay_coords"},{"attributeType":"null","col":5,"comment":"null","endLoc":227,"id":13919,"name":"axes","nodeType":"Attribute","startLoc":227,"text":"axes"},{"col":0,"comment":"","endLoc":41,"header":"plot_sgr-coordinate-frame.py#<anonymous>","id":13920,"name":"<anonymous>","nodeType":"Function","startLoc":2,"text":"\"\"\"\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-coordinates-design` and the\ndocstring for `~astropy.coordinates.BaseCoordinateFrame`. In this example, we\nwill define a coordinate system defined by the plane of orbit of the Sagittarius\nDwarf Galaxy (hereafter Sgr; as defined in Majewski et al. 2003).  The Sgr\ncoordinate system is often referred to in terms of two angular coordinates,\n:math:`\\Lambda,B`.\n\nTo do this, wee 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* 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 http://www.stsci.edu/~dlaw/Sgr/\n\n-------------------\n\n*By: Adrian Price-Whelan, Erik Tollerud*\n\n*License: BSD*\n\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.ICRS(280.161732*u.degree, 11.91934*u.degree)\n\nsgr = icrs.transform_to(Sagittarius)\n\nprint(sgr)\n\nsgr = Sagittarius(Lambda=np.linspace(0, 2*np.pi, 128)*u.radian,\n                  Beta=np.zeros(128)*u.radian)\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 = Sagittarius(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\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(r\"$\\mu_\\Lambda \\, \\cos B$ [{0}]\"\n                   .format(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(r\"$\\mu_\\alpha \\, \\cos\\delta$ [{0}]\"\n                   .format(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(r\"$\\mu_\\delta$ [{0}]\"\n                   .format(icrs.pm_dec.unit.to_string('latex_inline')))\n\nplt.show()"},{"attributeType":"null","col":4,"comment":"null","endLoc":152,"id":13921,"name":"axes","nodeType":"Attribute","startLoc":152,"text":"axes"},{"attributeType":"null","col":0,"comment":"null","endLoc":178,"id":13922,"name":"gal_rings","nodeType":"Attribute","startLoc":178,"text":"gal_rings"},{"attributeType":"null","col":8,"comment":"null","endLoc":96,"id":13923,"name":"patch","nodeType":"Attribute","startLoc":96,"text":"self.patch"},{"attributeType":"null","col":8,"comment":"null","endLoc":82,"id":13924,"name":"_bboxes","nodeType":"Attribute","startLoc":82,"text":"self._bboxes"},{"attributeType":"null","col":8,"comment":"null","endLoc":94,"id":13925,"name":"_display_coords_index","nodeType":"Attribute","startLoc":94,"text":"self._display_coords_index"},{"attributeType":"null","col":12,"comment":"null","endLoc":275,"id":13926,"name":"_y_index","nodeType":"Attribute","startLoc":275,"text":"self._y_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":97,"id":13927,"name":"_drawn","nodeType":"Attribute","startLoc":97,"text":"self._drawn"},{"attributeType":"null","col":8,"comment":"null","endLoc":270,"id":13928,"name":"_all_coords","nodeType":"Attribute","startLoc":270,"text":"self._all_coords"},{"attributeType":"null","col":12,"comment":"null","endLoc":89,"id":13929,"name":"transData","nodeType":"Attribute","startLoc":89,"text":"self.transData"},{"attributeType":"function","col":8,"comment":"null","endLoc":93,"id":13930,"name":"format_coord","nodeType":"Attribute","startLoc":93,"text":"self.format_coord"},{"attributeType":"null","col":0,"comment":"null","endLoc":180,"id":13931,"name":"fig","nodeType":"Attribute","startLoc":180,"text":"fig"},{"attributeType":"null","col":4,"comment":"null","endLoc":180,"id":13932,"name":"ax","nodeType":"Attribute","startLoc":180,"text":"ax"},{"attributeType":"null","col":4,"comment":"null","endLoc":181,"id":13933,"name":"i","nodeType":"Attribute","startLoc":181,"text":"i"},{"col":0,"comment":"","endLoc":32,"header":"plot_galactocentric-frame.py#<anonymous>","id":13934,"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\n*By: Adrian Price-Whelan*\n\n*License: BSD*\n\n-------------------\n\n\"\"\"\n\nplt.style.use(astropy_mpl_style)\n\nc1 = coord.ICRS(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\ngc1 = c1.transform_to(coord.Galactocentric)\n\nprint(gc1.v_x, gc1.v_y, gc1.v_z)\n\nv_sun = coord.CartesianDifferential([11.1, 244, 7.25]*u.km/u.s)\n\ngc_frame = coord.Galactocentric(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\ngc_frame2 = coord.Galactocentric(galcen_distance=galcen_distance,\n                                 galcen_v_sun=coord.CartesianDifferential(vx, vy, vz),\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.Galactocentric(ring_rep)\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('$v_x$ [{0}]'.format((u.km/u.s).to_string(\"latex_inline\")))\n\naxes[1].set_ylabel('$v_y$ [{0}]'.format((u.km/u.s).to_string(\"latex_inline\")))\n\nfig.tight_layout()\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(r'$\\mu_l \\, \\cos b$ [{0}]'.format((u.mas/u.yr).to_string('latex_inline')))\n\nax.legend()"},{"attributeType":"null","col":8,"comment":"null","endLoc":331,"id":13935,"name":"_ticklabels_bbox","nodeType":"Attribute","startLoc":331,"text":"self._ticklabels_bbox"},{"attributeType":"CoordinatesMap","col":8,"comment":"null","endLoc":261,"id":13936,"name":"coords","nodeType":"Attribute","startLoc":261,"text":"self.coords"},{"attributeType":"null","col":12,"comment":"null","endLoc":274,"id":13937,"name":"_x_index","nodeType":"Attribute","startLoc":274,"text":"self._x_index"},{"attributeType":"null","col":8,"comment":"null","endLoc":84,"id":13938,"name":"frame_class","nodeType":"Attribute","startLoc":84,"text":"self.frame_class"},{"className":"WCSAxesSubplot","col":0,"comment":"\n    A subclass class for WCSAxes\n    ","endLoc":532,"id":13939,"nodeType":"Class","startLoc":528,"text":"class WCSAxesSubplot(subplot_class_factory(WCSAxes)):\n    \"\"\"\n    A subclass class for WCSAxes\n    \"\"\"\n    pass"},{"attributeType":"null","col":16,"comment":"null","endLoc":4,"id":13940,"name":"np","nodeType":"Attribute","startLoc":4,"text":"np"},{"attributeType":"null","col":0,"comment":"null","endLoc":19,"id":13941,"name":"__all__","nodeType":"Attribute","startLoc":19,"text":"__all__"},{"attributeType":"null","col":0,"comment":"null","endLoc":21,"id":13942,"name":"VISUAL_PROPERTIES","nodeType":"Attribute","startLoc":21,"text":"VISUAL_PROPERTIES"},{"attributeType":"WCS","col":0,"comment":"null","endLoc":23,"id":13943,"name":"IDENTITY","nodeType":"Attribute","startLoc":23,"text":"IDENTITY"},{"attributeType":"null","col":0,"comment":"null","endLoc":24,"id":13944,"name":"ctype","nodeType":"Attribute","startLoc":24,"text":"IDENTITY.wcs.ctype"},{"attributeType":"null","col":0,"comment":"null","endLoc":25,"id":13945,"name":"crval","nodeType":"Attribute","startLoc":25,"text":"IDENTITY.wcs.crval"},{"attributeType":"null","col":0,"comment":"null","endLoc":26,"id":13946,"name":"crpix","nodeType":"Attribute","startLoc":26,"text":"IDENTITY.wcs.crpix"},{"attributeType":"null","col":0,"comment":"null","endLoc":27,"id":13947,"name":"cdelt","nodeType":"Attribute","startLoc":27,"text":"IDENTITY.wcs.cdelt"},{"col":0,"comment":"","endLoc":4,"header":"core.py#<anonymous>","id":13948,"name":"<anonymous>","nodeType":"Function","startLoc":4,"text":"__all__ = ['WCSAxes', 'WCSAxesSubplot']\n\nVISUAL_PROPERTIES = ['facecolor', 'edgecolor', 'linewidth', 'alpha', 'linestyle']\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.]"}]}